Commit Graph

14239 Commits

Author SHA1 Message Date
Teknium 8dca2031d3 Merge branch 'simp/r2-cli-rest-setup' into simp/integration2
# Conflicts:
#	hermes_cli/setup.py
2026-09-02 17:27:09 -07:00
Teknium caa29fb43a Merge branch 'simp/r2-tools-a' into simp/integration2
# Conflicts:
#	tests/test_managed_runtime_resolution.py
2026-09-02 17:07:24 -07:00
Teknium 6360d3d9c4 Merge branch 'simp/r2-gw-rest' into simp/integration2
# Conflicts:
#	tests/gateway/test_48031_model_switch_after_auto_reset.py
2026-09-02 17:06:54 -07:00
Teknium e51bfa0672 Merge branch 'simp/r2-cli-rest-commands' into simp/integration2 2026-09-02 17:05:27 -07:00
Teknium 70f42ed4f3 Merge branch 'simp/r2-cli-rest-plugins' into simp/integration2 2026-09-02 17:05:26 -07:00
Teknium 8f2d511228 Merge branch 'simp/r2-tools-b-termhub' into simp/integration2 2026-09-02 17:05:25 -07:00
Teknium 5e7ff3d8fc Merge branch 'simp/r2-update-cmd-sub' into simp/integration2 2026-09-02 17:05:23 -07:00
Teknium d48a0e604f Merge branch 'simp/r2-gw-rest-config' into simp/integration2 2026-09-02 17:05:22 -07:00
Teknium a3b6d91302 Merge branch 'simp/r2-update-doctor' into simp/integration2 2026-09-02 17:05:20 -07:00
Teknium 74b4d698fc Merge branch 'simp/r2-config-tools' into simp/integration2 2026-09-02 17:05:18 -07:00
Teknium d6f56549c0 Merge branch 'simp/r2-webserver' into simp/integration2 2026-09-02 17:05:16 -07:00
Teknium 75e19f3836 Merge branch 'simp/r2-cua-tool2' into simp/integration2 2026-09-02 17:05:15 -07:00
Teknium eb807c026f Merge branch 'simp/r2-loop-fin' into simp/integration2 2026-09-02 17:05:12 -07:00
Teknium d9853c57ad Merge branch 'simp/r2-climain' into simp/integration2 2026-09-02 17:05:06 -07:00
Teknium 93673653fa Merge branch 'simp/r2-kanban' into simp/integration2 2026-09-02 17:05:05 -07:00
Teknium b80dc57a09 Merge branch 'simp/r2-gwrun' into simp/integration2 2026-09-02 17:05:04 -07:00
Teknium cba6a6de8e Merge branch 'simp/r2-clipy' into simp/integration2 2026-09-02 17:05:04 -07:00
Teknium 6979b6a2f0 Merge branch 'simp/r2a-tts' into simp/integration2 2026-09-02 17:05:03 -07:00
Teknium d9fe98b259 Merge branch 'simp/r2a-mcp' into simp/integration2 2026-09-02 17:05:02 -07:00
Teknium e037d3d55e Merge branch 'simp/r2-loop' into simp/integration2 2026-09-02 17:05:02 -07:00
Teknium e753b034a4 Merge branch 'simp/r2-auth' into simp/integration2 2026-09-02 17:05:01 -07:00
Teknium b6b432f81e Merge branch 'simp/r2a-browser' into simp/r2-tools-a 2026-09-02 17:04:12 -07:00
Teknium ba7599c953 Merge branch 'simp/r2-gw-rest-config' into simp/r2-gw-rest 2026-09-02 16:55:01 -07:00
Teknium 5820d0b0d5 refactor(gateway/config): extract the config.yaml phase to gateway/config_loader.py; table-driven from_dict; defensive collapse
- load_gateway_config (536 LOC) is now a thin orchestrator: legacy gateway.json
  -> config_loader.load_yaml_layer -> GatewayConfig.from_dict -> env overrides
  -> validation. The yaml phase lives in gateway/config_loader.py as small
  functions driven by tables: _TOPLEVEL_BRIDGE (23 top-level/nested
  gateway.<key> bridges with 5 fallback modes), _SHARED_KEYS (28 per-platform
  keys copied into extra, with per-platform restrictions and transforms) and
  _PORT_BRIDGE_KEYS. Logger name kept as "gateway.config".
- GatewayConfig.from_dict: shared pick()/key_label() helpers replace the
  repeated "top-level key present else nested gateway.<key>" blocks; warning
  order preserved.
- _normalize_unauthorized_dm_behavior / _normalize_notice_delivery unified into
  _normalize_choice; _ensure_platform_extra_dict -> _dict_slot (also used by
  persist_home_channel); _getenv_int removed (dead since the env pass moved to
  config_env, which has its own _int_or).
- Platform._missing_: one _add_pseudo_member helper for both branches.
- Single warning sites in _coerce_optional_positive_int and
  coerce_systemd_watchdog_seconds; _validate_gateway_config placeholder pass
  flattened; small to_dict/getter collapses. Ruff F401/SIM102 clean.
- tests/hermes_cli/test_config_read_guard.py: allowlist gateway/config_loader.py
  (same owner as gateway/config.py — the extracted load_gateway_config phase).

gateway/config.py 2684 -> 1319 LOC (-50.9%); largest function now
GatewayConfig.from_dict at 119 LOC. Resolved-config parity: 160 cells
(16 yaml fixtures x 10 env sets) byte-identical to the integration base,
including captured log records and stderr.
2026-09-02 16:48:36 -07:00
Teknium e03a680592 refactor(kanban-db): split into connect/workspace/dispatch/notify modules
Byte-identical bodies moved out of hermes_cli/kanban_db.py into four sibling
modules, re-exported from the origin so kanban_db.<name> keeps resolving and
stays the single monkeypatch target; origin-resident helpers are reached via a
late-bound _kb namespace. AST-identity verified for all 329 moved symbols; SQL
statement multiset parity vs base. Three source-inspection tests repointed at
kanban_db_dispatch; the _add_column_if_missing alias test now imports the real
owner (hermes_cli.sqlite_util).
2026-09-02 16:46:52 -07:00
Teknium 629e6eb1b5 refactor(turn): split finalize_turn into phase helpers (576 -> 264 LOC) 2026-09-02 16:46:33 -07:00
Teknium ef9f860284 refactor(tts): extract OpenAI/DeepInfra backend and lifecycle leases into sibling modules 2026-09-02 16:44:12 -07:00
Teknium d913175067 refactor(tts): move command-provider config layer into tts_command_provider
Completes the half-done move snapshotted by the parent (wip commit 283f63b):
the tts.providers.<name> config layer (_get_named_provider_config,
_resolve_command_provider_config, _generate_command_tts, ...) now lives in
tools/tts_command_provider.py; tts_tool re-imports the historical names.
2026-09-02 16:44:05 -07:00
Teknium b4c38f2aa9 refactor(turn): lift run_conversation lease/liveness closures into agent.turn_facade_lease 2026-09-02 16:43:09 -07:00
Teknium d6ef4190cc refactor(turn): collapse preflight estimator branch, build_api_messages pops, docstrings; add turn_context_compaction tests 2026-09-02 16:42:25 -07:00
Teknium 2769937936 refactor(turn): lift iteration entry/announce, Nous rate guard, API interrupt, retry-restart consumer and preflight-timeout result out of run_conversation 2026-09-02 16:37:14 -07:00
Teknium 4d1880e0bf fix(integration): restore subprocess encoding/stdin guards dropped in simplification
Simplification workers collapsed subprocess call sites into shared kwargs
helpers and dropped the Windows/TUI safety kwargs on the way:

- encoding='utf-8', errors='replace' restored on text=True runs in
  copilot_acp_client, hermes_cli/setup (vercel install), managed_uv
  (codesign steps), local_runtime/hardware._stdout, a2a adapter.
- stdin=subprocess.DEVNULL restored on copilot probe, verify/runner
  _SUBPROCESS_KW, iron_proxy._run, google_meet playwright/system_profiler,
  simplex convert, whatsapp _RUN_TEXT, mem0 ollama serve Popen.
  google_meet sudo/brew install keeps inherited stdin (user-confirmed,
  may prompt) — marked noqa: subprocess-stdin.
- Windows-safe SIGKILL: getattr(signal, 'SIGKILL', SIGTERM) in
  verify/runner; photon _kill call re-marked windows-footgun: ok
  (unreachable on win32).
- scripts/check_subprocess_stdin.py now recognizes **kwargs splats
  (**_KW / **_kw(...)) ONLY when the same-file definition provably sets
  stdin= — covers tui_gateway _capture_run_kwargs/run_kw. Parity test added.
2026-09-02 16:36:10 -07:00
Teknium a56f731ac6 refactor(turn): extract preflight gate + per-iteration transcript prep into agent/turn_preflight_gate.py, agent/turn_iteration_prep.py 2026-09-02 16:27:44 -07:00
Teknium 4ad1c6c1be refactor(gateway): drop dead GatewayRunner._has_setup_skill (no production caller; tests only stub it) 2026-09-02 16:26:11 -07:00
Teknium 6bbb13d625 refactor(gateway/slash): extract introspection commands into gateway/slash_commands_status.py (GatewayStatusCommandsMixin) 2026-09-02 16:25:35 -07:00
Teknium dc4de83c62 refactor(update): lift ZIP download/swap and deps reinstall out of _update_via_zip (327 -> 137 LOC) 2026-09-02 16:25:31 -07:00
Teknium c40645ea2f test(gateway): repoint two source-inspection/logger-patch tests to run_turn_runner / run_voice 2026-09-02 16:24:25 -07:00
Teknium bd30c9b6ac refactor(browser): move cloud-provider/backend selection to tools/browser_tool_cloud.py and agent-browser/Chromium discovery+install to tools/browser_tool_install.py 2026-09-02 16:18:57 -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 ffed5b1503 refactor(tools_config): split tools_command into flow helpers; drop unused imports 2026-09-02 16:14:49 -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 3f0e1165b3 refactor(tools_config): extract post-setup hooks into tools_config_post_setup 2026-09-02 16:11:26 -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 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 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 07cd3ba7c9 refactor(hermes_cli/main): extract install/update recovery cluster to main_install_repair.py 2026-09-02 16:08:08 -07:00
Teknium 9fda4e5bac refactor(turn): extract retry-loop API error handler, request build, provider call and response check into agent/turn_api_*.py + agent/turn_response_check.py 2026-09-02 16:07:51 -07:00
Teknium c11fa53d92 refactor(tools_config): extract provider selection cluster into tools_config_providers 2026-09-02 16:05:46 -07:00