Commit Graph

27776 Commits

Author SHA1 Message Date
Teknium 6cfed45fde Merge branch 'simp/r2a-mcp-oauth' into simp/r2a-mcp 2026-09-02 17:14:56 -07:00
Teknium 3bfb199bde Merge branch 'simp/r2a-mcp-transport' into simp/r2a-mcp 2026-09-02 17:14:55 -07:00
Teknium 493c3841ed refactor(mcp): handlers — fold utility on_failure into an inline lambda, single guard in reconnectable lookup (602 -> 598) 2026-09-02 17:07:42 -07:00
Teknium 5a8ffa5179 refactor(mcp): health — recycle reason via next(), change-list comprehension in _refresh_tools, docstrings compacted by hand (380 -> 316) 2026-09-02 17:07:08 -07:00
Teknium 607a5b711e refactor(mcp): errors — one _jsonrpc_matches for both code/marker classifiers, one _exc_children walk for connect-error rendering, docstrings compacted by hand (455 -> 384; differential fuzz 20k cases identical) 2026-09-02 17:05:28 -07:00
Teknium 6e1089a23c refactor(mcp): compact mcp_oauth_manager docstrings/comments by hand; flatten single-use call sites 2026-09-02 17:05:22 -07:00
Teknium 36aefc2638 refactor(mcp): transport — one guarded-attempt helper for both protocol-negotiation fallbacks, kwargs tables for optional httpx args, docstrings compacted by hand (645 -> 511) 2026-09-02 17:02:34 -07:00
Teknium 98d1635421 refactor(mcp): compact mcp_oauth docstrings/comments by hand; fold model_dump JSON shape into _model_json, inline single-use CIMD-port note and SSH hint printer 2026-09-02 17:01:47 -07:00
Teknium d18b136417 refactor(mcp): one fail-fast branch for URL validation + content-type preflight 2026-09-02 17:00:43 -07:00
Teknium e59090acee refactor(mcp): flatten _LockCookie.release nested try ladders (same best-effort semantics) 2026-09-02 16:59:27 -07:00
Teknium a0f15d1f2a refactor(mcp): _running_loop helper for the loop-up check 2026-09-02 16:58:35 -07:00
Teknium 0a38a611eb refactor(mcp): handlers — one _strike helper for breaker-strike+tool_error tails, reconnectable-server lookup owns the loop check, docstrings compacted by hand (783 -> 602) 2026-09-02 16:57:52 -07:00
Teknium 3016bb9020 refactor(mcp): fold duplicate recycle check into _recycle_if_due; drop probe wrapper closure 2026-09-02 16:57:39 -07:00
Teknium d507b71e7c Merge branch 'simp/r2a-mcp-oauth' into simp/r2a-mcp 2026-09-02 16:41:11 -07:00
Teknium 40e4338d27 Merge branch 'simp/r2a-mcp-transport' into simp/r2a-mcp 2026-09-02 16:41:11 -07:00
Teknium 1623697cb7 refactor(mcp): compact session-expired marker table 2026-09-02 16:34:23 -07:00
Teknium 546bb4eefc refactor(mcp): repack wrapped message literals (AST-identical) 2026-09-02 16:33:18 -07:00
Teknium 2c389b5a2f refactor(mcp): compact mcp_oauth listener, cached-registration lookups and stderr messages by hand 2026-09-02 16:31:39 -07:00
Teknium 2bebe0ba9b refactor(mcp): tighten section headers in mcp_oauth / mcp_oauth_manager 2026-09-02 16:30:18 -07:00
Teknium 304118797b refactor(mcp): join short multi-line statements across the transport/handlers subset (AST-identical) 2026-09-02 16:29:53 -07:00
Teknium 41f873da6e refactor(mcp): HermesProviderMixin reuses HermesTokenStorage._coerce_secret_auth_method for the in-memory client-secret coercion 2026-09-02 16:28:35 -07:00
Teknium 069338f7bb refactor(mcp): compact mcp_oauth_manager docstrings and metadata prefetch loop by hand 2026-09-02 16:27:29 -07:00
Teknium 7916d8e41c refactor(mcp): utility handlers become (rpc, render) pairs on one factory; join short multi-line statements 2026-09-02 16:27:05 -07:00
Teknium 0437336b7d refactor(mcp): contextlib.suppress for swallowed-error ladders in mcp_oauth storage/json helpers 2026-09-02 16:26:18 -07:00
Teknium b2d1d4cc1f refactor(mcp): compact mcp_oauth_provider token-request stamping and dashboard flow dataclass
- _stamp_token_user_agent -> _prepare_token_request (no external refs)
- DashboardOAuthFlow event fields via one _event_field() factory
2026-09-02 16:24:53 -07:00
Teknium 3507382469 refactor(mcp): health — one recycle-deadline table, shared owned-deregister helper, module-level stdio liveness probe 2026-09-02 16:24:16 -07:00
Teknium 088eda22ae refactor(mcp): compact mcp_oauth module docstring, helpers and CIMD constants by hand
- config-key reference folded into the module docstring (all WHY kept)
- _park_reserved_socket / _pick_cimd_port / _is_valid_cimd_url / _can_open_browser /
  _resolve_redirect_uri / token_request_user_agent tightened, same results
- _maybe_preregister_client optional keys via dict unpacking
2026-09-02 16:23:14 -07:00
Teknium 0048a5bc80 refactor(mcp): handlers — fold structuredContent cap + stdio-retry error tail into helpers, _pick for attr-picking entry builders 2026-09-02 16:21:00 -07:00
Teknium b97e5d96db refactor(mcp): compact mcp_oauth SDK loader, callback handler, CIMD eligibility and legacy provider class
- _ensure_sdk_loaded binds SDK classes by name from the two auth modules
- _maybe_use_cimd if-ladder -> one ineligibility predicate (order and
  short-circuit preserved, comments kept)
- SSH hint bodies -> module templates; browser-open notes -> one print
- _get_hermes_oauth_provider_class builds the class via type() (same name,
  qualname, module, bases, _hermes_logger)
2026-09-02 16:20:30 -07:00
Teknium 6517b2d1c4 refactor(mcp): rewrap re-export blocks (formatting only) 2026-09-02 16:18:43 -07:00
Teknium b1d29ecf87 refactor(mcp): unify connect success/failure bookkeeping (3 sites -> 2 helpers) 2026-09-02 16:18:06 -07:00
Teknium 96280b4cc7 refactor(mcp): split register_mcp_servers/discover_mcp_tools into candidate/lazy/discovery-pass/summary helpers 2026-09-02 16:17:20 -07:00
Teknium e94cc545d5 refactor(mcp): unify HTTP/SSE/legacy transport serve+teardown into _serve_transport; split _run_stdio into ledger/preflight helpers 2026-09-02 16:16:45 -07:00
Teknium 4cf35a68f2 Merge branch 'simp/r2a-mcp-reg' into simp/r2a-mcp 2026-09-02 16:15:20 -07:00
Teknium b9ec602392 refactor(mcp): update mcp_tool module map for the new siblings 2026-09-02 16:15:11 -07:00
Teknium a09512c3ad refactor(mcp): move loop start/stop + reconnect signalling into mcp_tool_loop.py (writes via origin module) 2026-09-02 16:14:37 -07:00
Teknium 9a066f7374 refactor(mcp): split _make_hermes_provider_class into module-level _HermesRuntimeProviderMixin
- 322-LOC factory body -> _HermesRuntimeProviderMixin (largest method now
  async_auth_flow ~70 LOC); returned class keeps name, MRO tail, attributes
- invalid_client token-endpoint match -> _is_invalid_client_at_token_endpoint
- three non-fatal debug logs -> _log_nonfatal (same message shapes)
- handle_401's _do_handle closure -> MCPOAuthManager._recover_401
- HermesProviderMixin imported at module top (leaf module; no cycle);
  tools.mcp_tool.sdk_httpx stays lazy
2026-09-02 16:14:36 -07:00
Teknium 7424035a11 refactor(mcp): split tool handler into breaker check, server acquire, stdio-death-racing call, pure result renderer and one shared recovery ladder 2026-09-02 16:11:48 -07:00
Teknium a011c32975 refactor(mcp): compact mcp_oauth redirect/callback closures and dashboard contextvar helper
- _make_redirect_handler: lift URL announcement into _announce_authorization_url
- _make_callback_waiter: lift poll loop (_poll_callback_result) and result
  interpretation (_callback_outcome) out of the _wait closure
- mcp_dashboard_oauth.contextvar_set shared by force/suppress_interactive_oauth
- mcp_dashboard_oauth imported at module top (stdlib-only leaf, no cycle)
- docstrings compacted by hand; all WHY sentences kept
2026-09-02 16:09:23 -07:00
Teknium 538b9eedae refactor(mcp): flatten child-pid snapshot and MCP-child filter 2026-09-02 16:05:08 -07:00
Teknium 5f48aad2d8 refactor(mcp): _wait_for_lazy_reconnect -> _wait_for_reconnect_or_shutdown (same wait shape) 2026-09-02 16:02:55 -07:00
Teknium 410e95e100 refactor(mcp): restore E305 spacing after squeeze 2026-09-02 16:01:37 -07:00
Teknium d9f6d9eda0 refactor(mcp): wrap overlong lines in reg/sampling/schema/agent 2026-09-02 16:01:24 -07:00
Teknium 7be1f2abe0 refactor(mcp): table-driven SDK symbol binding in _ensure_mcp_sdk 2026-09-02 16:01:09 -07:00
Teknium a3a9cacf93 refactor(mcp): collapse post-build re-injection getters and saved-prefix lookup 2026-09-02 16:00:08 -07:00
Teknium dc1401425d refactor(mcp): drop 33 round-1 re-export shims nothing outside the group imports 2026-09-02 15:58:35 -07:00
Teknium 97fbd7e232 refactor(mcp): table-drive elicitation answers, unify sampling response log, tighten collision diagnostics 2026-09-02 15:57:42 -07:00
Teknium ade852f1d5 refactor(mcp): extract atomic snapshot publish from refresh_agent_mcp_tools; compact docstrings by hand 2026-09-02 15:55:38 -07:00
Teknium d4602539d8 refactor(mcp): move discovery lock + loop scheduling into mcp_tool_loop.py 2026-09-02 15:52:38 -07:00
Teknium f59fb2e292 refactor(mcp): tighten registration candidates and sampling handler; drop dead _extract_tool_result_text 2026-09-02 15:51:24 -07:00