Commit Graph

28243 Commits

Author SHA1 Message Date
Teknium b1d29ecf87 refactor(mcp): unify connect success/failure bookkeeping (3 sites -> 2 helpers) 2026-09-02 16:18:06 -07:00
Teknium a8a7b7b849 refactor(doctor_config): model/provider validation -> helpers; config drift -> ordered step table 2026-09-02 16:18:03 -07:00
Teknium 79aeb22886 refactor(cli): unify duplicated model-switch staging and last-assistant-text blocks
cli_model_switch_mixin: the identical snapshot->stage->agent.switch_model->rollback
block in _apply_model_switch_result and _confirm_and_apply_cli_model_switch (2x47
lines) -> _stage_and_swap_model(result, old_model) -> bool. cli_loops_mixin: the
identical reversed-history assistant-text extraction in the loop-tick and goal
post-turn hooks -> _last_assistant_response_text(). Four _StubCLI test doubles bind
the new helper to the real implementation.
2026-09-02 16:17:31 -07:00
Teknium f4e6ccc5f5 refactor(state): unify db-generation halt guard, hoist _is_no_more_rows, collapse flag inits 2026-09-02 16:17:27 -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 865d77a166 refactor(gateway/status): drop dead is_gateway_running/clear_planned_stop_marker, unify PID-record liveness, marker-write, JSON-parse and stale-lock helpers, table-drive runtime-status field writes 2026-09-02 16:16:59 -07:00
Teknium d2add66648 refactor(computer_use): tool.py — verdict-field table, payload merge, stub/record cleanups 2026-09-02 16:16:54 -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 18946a781f refactor(state): join short adjacent string literals (AST-neutral) 2026-09-02 16:16:37 -07:00
Teknium 2086987cdc refactor(computer_use): route unknown-outcome results directly through _outcome_unknown 2026-09-02 16:16:30 -07:00
Teknium f9f21dcf25 refactor(web_server): decompose start_server (544 -> 106 LOC) into auth-gate, uvicorn-build, post-start, and runner helpers 2026-09-02 16:15:52 -07:00
Teknium 26129a1fca refactor(state): repair — strategy table + _apply loop, lock/unlink/sidecar/offline-access helpers, _repair_skip, backup split into free-space + publish helpers; dbfile — shared /proc fd scan, quarantine lock unified, compact stats 2026-09-02 16:15:49 -07:00
Teknium d7bdf2788d refactor(gateway/session): split SessionStore into persistence/recovery/lifecycle/transcript mixins by call-graph cohesion; compact wire helpers 2026-09-02 16:15:42 -07:00
Teknium 70282b6baf refactor(browser): lifecycle module imports hermes_constants directly; drop origin imports left unused by the move 2026-09-02 16:15:20 -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 40fe17f83b refactor(state): fold adjacent string fragments that fit one line (AST-identical) 2026-09-02 16:14:54 -07:00
Teknium ffed5b1503 refactor(tools_config): split tools_command into flow helpers; drop unused imports 2026-09-02 16:14:49 -07:00
Teknium 369dbe4320 refactor(browser): move session lifecycle cluster (janitor, orphan reaper, teardown, atexit cleanup) to tools/browser_tool_lifecycle.py 2026-09-02 16:14:39 -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 5340109e61 refactor(state): compact verbose docstrings (rules/invariants kept) 2026-09-02 16:14:33 -07:00
Teknium 9cf2c364ab refactor(computer_use): _recreate_session helper for the two restart+restore paths 2026-09-02 16:14:11 -07:00
Teknium 88c5d4670d refactor(auth): OAUTH_PROVIDER_FLOWS table (status/resolve/terminal-codes/logout), name-keyed status dispatch, base-URL resolver table 2026-09-02 16:13:37 -07:00
Teknium 0fe9d5f5ae refactor(state): AST-neutral formatting compaction (blank lines, signatures, arg lists) 2026-09-02 16:13:30 -07:00
Teknium 95714f6d93 refactor(state): AST-neutral line packing; derive v22 session_model_usage DDL from the heal DDL 2026-09-02 16:13:05 -07:00
Teknium 96d8883986 refactor(models): collapse copilot catalog filter, probe/dedupe helpers, static-detect ladders; compact comments 2026-09-02 16:12:56 -07:00
Teknium 04403a5632 refactor(computer_use): compact schema.py literal (value byte-identical; verified via tool-schema dump) 2026-09-02 16:12:51 -07:00
Teknium d7cdfbc36b refactor(stt): openai-availability reason helper, one-line section banners, docstring compaction 2026-09-02 16:12:29 -07:00
Teknium 66ecaa31e7 refactor(computer_use): dedupe capability-state reset, tighten CLI result and error-text helpers 2026-09-02 16:12:02 -07:00
Teknium 13e7cb8eb9 refactor(tools_config): merge provider-selection extraction (tools_config_providers) 2026-09-02 16:11:56 -07:00
Teknium 66366d3dab refactor(gateway): split GatewayRunner into 13 run_* mixins + TurnRunner module (run.py 31332 -> 6957)
AST-driven, body-identical move of 359 GatewayRunner methods into cohesive
mixin modules (gateway/run_{voice,adapters,topics,turn,shutdown,busy,
config_loaders,startup,watchers,notifications,inbound,goals,agent_cache}.py)
plus TurnRunner -> gateway/run_turn_runner.py. run.py-internal symbols are
imported lazily inside method bodies so patch('gateway.run.X') keeps
intercepting; neutral deps are top-level; logger name stays 'gateway.run'.
_UNSET moved to leaf gateway/run_common.py (def-time default-arg sentinel).
Whole-module inspect.getsource(gateway_run) AST-walker tests repointed to
the module that now holds the walked code.
2026-09-02 16:11:50 -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 0d32adbbb5 refactor(hermes_cli/main): extract provider-setup helpers to main_provider_setup.py 2026-09-02 16:11:38 -07:00
Teknium 3f0e1165b3 refactor(tools_config): extract post-setup hooks into tools_config_post_setup 2026-09-02 16:11:26 -07:00
Teknium fc2972b299 refactor(state): common — shared freshest-of/after-marker SQL builders, msvcrt lock helper, compact preview constants 2026-09-02 16:11:04 -07:00
Teknium a59680217f refactor(update): hand-compact comments/docstrings in split modules (AST-identical); re-export get_hermes_home/shutil; repoint source-inspection tests 2026-09-02 16:11:02 -07:00
Teknium 7e250ce03e refactor(cli): no function over 300 LOC — split __init__/main/run/load_cli_config + two TUI builders
__init__ 659 -> 39 (_init_display_options / _init_model_routing / _init_runtime_state);
main 651 -> 403 (_install_single_query_signal_handlers, _collect_kanban_task_images,
_route_single_query_images, _run_quiet_single_query as module-level helpers);
run 384 -> 293 (_tui_shutdown); load_cli_config 366 -> 115 (_cli_config_defaults,
_mirror_config_to_env); cli_tui_mixin: _tui_build_layout 352 -> 196 (_tui_build_input_area,
_tui_set_base_style), _tui_handle_enter 333 -> 192 (_tui_enter_overlay -> bool).
All regions are zero-back-ref lifts, ast.dump-identical bodies, unresolved-free-names
check clean. Two source-inspection tests repointed at the helper that now owns the code.
2026-09-02 16:11:02 -07:00
Teknium 0fd89c0ae5 wip(model_switch): snapshot of in-progress provider-listing extraction + status split (worker died mid-run) 2026-09-02 16:10:32 -07:00
Teknium c4ce73edc2 refactor(browser): compact sibling modules — supervisor event dispatch inline, dialog responder unified (_respond/_respond_quiet/_cdp_quiet), dead ConsoleEvent ring buffer removed, browser_use_cli _quiet helper 2026-09-02 16:10:20 -07:00
Teknium 60aa491f3d refactor(stt): local backend detection helper, CPU-eviction helper, module docstrings and import packing 2026-09-02 16:10:20 -07:00
Teknium 7d43c20af7 refactor(web_server): move _process_start_marker with the lifecycle cluster 2026-09-02 16:10:10 -07:00
Teknium 9780739e12 refactor(turn): extract per-iteration request assembly (api_messages/MoA/cache plan/pressure) into agent/turn_request_assembly.py 2026-09-02 16:10:07 -07:00
Teknium c990225fa0 refactor(auth): relocate single-consumer helpers next to their users; _decode_jwt_claims to constants leaf 2026-09-02 16:09:47 -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 c023f00c9c refactor(state): compact session-CRUD comments/docstrings (keep every WHY) 2026-09-02 16:09:13 -07:00
Teknium 67ac6cc619 refactor(computer_use): table-drive unknown-outcome messages; hoist _tool_field helper 2026-09-02 16:09:13 -07:00
Teknium a42c78bd2e Merge branch 'simp/r2-cua-misc' into simp/r2-tools-b-cua 2026-09-02 16:08:20 -07:00
Teknium a739007d77 Merge branch 'simp/r2-cua-tool' into simp/r2-tools-b-cua 2026-09-02 16:08:17 -07:00
Teknium 07cd3ba7c9 refactor(hermes_cli/main): extract install/update recovery cluster to main_install_repair.py 2026-09-02 16:08:08 -07:00