Commit Graph

28271 Commits

Author SHA1 Message Date
Teknium 3da2ff88e3 refactor(delegate): pack re-import block; single blank line between top-level defs (AST-identical) 2026-09-02 17:03:55 -07:00
Teknium d66a62469b refactor(update): lift parked-branch guard out of _prepare_checkout_for_update (161 -> 101 LOC) 2026-09-02 17:03:42 -07:00
Teknium 0223eeca66 refactor(computer_use): walrus-fold guard checks, wrap wide lines (931->929 LOC) 2026-09-02 17:03:36 -07:00
Teknium 987bc82574 refactor(delegate): compact docstrings/comments by hand (every WHY kept); collapse orchestrator toolset branches 2026-09-02 17:03:05 -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 693893df5c refactor(kanban-db): compact Task field/constant comments that duplicated SCHEMA_SQL; contextlib.suppress for try/except/pass 2026-09-02 17:02:26 -07:00
Teknium 73ca3efea4 refactor(update): lift divergence reconcile and syntax-guard rollback out of _pull_updates (153 -> 47 LOC) 2026-09-02 17:02:23 -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 21372a16b2 refactor(computer_use): compact response helpers, NoopBackend recorder, docstrings/comments (976->931 LOC) 2026-09-02 17:00:40 -07:00
Teknium d1df0f21ab refactor(hermes_cli/main): extract memory/acp/tools/insights/monitoring/skills handlers to main_agent_cmds.py 2026-09-02 17:00:17 -07:00
Teknium 2d7fcf636e refactor(update): compact re-export import blocks (AST-identical, -117 lines) 2026-09-02 17:00:07 -07:00
Teknium 8656cc31f2 refactor(state): table-driven _rows_to_conversation column copy; unify tool-call counting; collapse defensive locals 2026-09-02 16:59:58 -07:00
Teknium aa4ffc98e9 refactor(hermes_cli/main): extract WhatsApp/Slack/Skill-Sync setup wizards to main_platform_setup.py 2026-09-02 16:59:52 -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 016f31375d refactor(delegate): join wrapped logical lines that fit in 120 cols (AST-identical) 2026-09-02 16:59:26 -07:00
Teknium 231ee6bf69 refactor(update): lift profile syncs and post-summary notices out of _run_post_update_maintenance (174 -> 67 LOC) 2026-09-02 16:59:18 -07:00
Teknium a0f15d1f2a refactor(mcp): _running_loop helper for the loop-up check 2026-09-02 16:58:35 -07:00
Teknium 9994d2b113 refactor(hermes_cli/main): unify lazy re-export tables into _LAZY_ATTR_SOURCES; drop 26 unreferenced re-exports 2026-09-02 16:58:15 -07:00
Teknium 0f1c1d9388 refactor(turn): module docstrings list every helper in turn_iteration_prep / turn_api_call 2026-09-02 16:57:55 -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 e204008f10 refactor(delegate): _knob() unifies config>env>default int/float knobs; timeout diagnostic sections -> _diag_sizes/_diag_threads + attr table; drop dead _handle_child_wait_failure re-import 2026-09-02 16:57:22 -07:00
Teknium 832f77939a refactor(update): lift snapshot safety nets out of _check_and_apply_config_migration (192 -> 130 LOC) 2026-09-02 16:57:00 -07:00
Teknium 0556cbf52b refactor(model_setup_flows): re-export only names that existed on the origin at base
Helpers introduced by the split (_azure_*, _bedrock_text_model_ids, _configured_model_ids, ...)
never lived in model_setup_flows before, so nothing imports/patches them there; keep the
origin's re-export list to the historical surface. Corpus 396/0 diffs, 364 tests green.
2026-09-02 16:56:40 -07:00
Teknium a11464423a refactor(kanban-db): drop dead _clear_spawn_failures alias, unify per-task row/link accessors, compact three docstrings 2026-09-02 16:55:53 -07:00
Teknium ce45e216e7 refactor(update): promote nested _restart_one_systemd_gateway_unit closure to a module-level function (184 -> 70 LOC orchestrator) 2026-09-02 16:55:53 -07:00
Teknium 686b6824ef Merge branch 'simp/r2-gw-rest-sess' into simp/r2-gw-rest 2026-09-02 16:55:02 -07:00
Teknium 182724d09f Merge branch 'simp/r2-gw-rest-stream' into simp/r2-gw-rest 2026-09-02 16:55:01 -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 b3754e4e19 Merge branch 'simp/r2-gw-rest-slash' into simp/r2-gw-rest 2026-09-02 16:55:01 -07:00
Teknium 8c86804dc4 refactor(approval_detection): compact option tables; drop stale section banner in approval.py 2026-09-02 16:54:57 -07:00
Teknium ebb9f312dc refactor(status): extract credential sections into status_auth, unify redact_key
- new hermes_cli/status_auth.py: _render_api_keys / _render_auth_providers /
  _render_nous_gateway / _render_apikey_providers + their data tables and the
  OAuth/timestamp helpers; origin helpers imported lazily so status monkeypatches hold
- status.redact_key was a verbatim copy of hermes_cli.config.redact_key -> imported
- sessions/cron/deep/footer renderers compacted; 624 -> 372 lines (base 639)

Parity: r2m_status_golden.py 33 fixtures byte-identical vs base; real
`hermes status`, `status --deep`, `status --help` byte-identical after normalizing
the per-run temp HERMES_HOME path; test_status*/test_estop/test_jobs_json_utf8_bom green.
2026-09-02 16:54:55 -07:00
Teknium ce54c8e04a refactor(model_switch): collapse duplicate bodies, flatten alias/flag parsing, trim re-exports
- parse_model_flags_detailed: boolean flags via _BOOL_FLAGS table; scope ladder as data
- _load_direct_aliases / _configured_provider_matches / _config_declares_model /
  resolve_alias: single scan or builder per shape instead of parallel branches
- _route_from_model_input split at the MoA/alias seam (-> _route_after_alias)
- re-export block trimmed to the names referenced through hermes_cli.model_switch
  (acp_adapter, cli.py, tui_gateway, inventory, gateway, tests); orphaned trailing
  comment blocks folded into model_switch_providers docstrings
- 2389 -> 2079 lines; largest function _model_sort_key (90 LOC)

Parity: r2m_switch_corpus.py 434 entries byte-identical vs base; 70 model_switch test
files + tests/test_tui_gateway_server.py green.
2026-09-02 16:54:55 -07:00
Teknium 884c697291 refactor(delegate): split _finalize_child_results (memory/hooks/cost rollup), lift _create_isolated_worktree and _report_child_done, collapse dead worktree-attach import fallback 2026-09-02 16:54:15 -07:00
Teknium 79fc9d127f Merge simp/r2m-runtime into simp/r2-models-runtime 2026-09-02 16:53:16 -07:00
Teknium 934a35a604 Merge simp/r2m-models into simp/r2-models-runtime 2026-09-02 16:53:16 -07:00
Teknium 015639a6d7 refactor(computer_use): compact capture mixin (name helper, flat signatures/log calls) 2026-09-02 16:53:14 -07:00
Teknium 18fa584366 refactor(computer_use): _CaptureView shares capture-derived facts across response branches; _detach_locked, _bounds_hints, _best_effort_write dedupe (997->976 LOC) 2026-09-02 16:52:47 -07:00
Teknium 60041b787a refactor(update): join short multi-line statements onto one line (AST-identical, -416 lines) 2026-09-02 16:52:38 -07:00
Teknium f54075e0bb refactor(state): unify lock/lease claim (_claim_lease_row); finalize_orphaned via _write_rowcount 2026-09-02 16:52:21 -07:00
Teknium 3d0e9af47a refactor(tool_executor): inline memory_manager_executor into resolve_invoke_tool_executor
Single-caller factory replaced by the equivalent closure; comment compaction only
otherwise.
2026-09-02 16:51:42 -07:00
Teknium 3f93fdfc95 refactor(tool_executor): split execute_tool_calls_concurrent into _ConcurrentBatch + shared result helpers
Behavior-neutral extraction of the 686-LOC concurrent executor and the 429-LOC
sequential executor into focused helpers:

- _ConcurrentBatch (run_worker / submit_all / await_completion / run) and
  _StartOrderGate replace the nested closures + nonlocal counters; _ToolOutcome
  replaces the 7-tuple result slots; _ParsedCall/_parse_tool_call replaces the
  6-tuple parsed-call rows in both executors (-> 2 sites).
- _append_skipped_tool_results unifies the four cancelled/skipped-result loops
  (concurrent pre-flight, sequential pre-tool interrupt, sequential
  KeyboardInterrupt, sequential post-tool interrupt) -> 4 sites; absorbs
  _append_cancelled_tool_results.
- _observe_tool_result / _commit_tool_result / _finalize_tool_batch /
  _print_tool_completed / _tool_progress_enabled unify the post-execution
  guardrail-observe -> append+flush -> tool.completed -> budget -> /steer tail
  shared by the concurrent, sequential and segmented paths (-> 2-3 sites each).
- _unfinished_tool_result, _blocked_tool_result, _abandoned_sequential_result
  collapse the duplicated synthesize-result + terminal post_tool_call blocks.
- _registered_tool_worker / _interrupt_worker_tids unify worker tid tracking and
  interrupt fan-out between the two middleware runners (-> 2 / 3 sites).
- _run_with_activity_heartbeat extracts the heartbeat thread wrapper.
- _resolve_sequential_dispatch + _SequentialDispatch turn the 5-branch
  inline/delegate/context-engine/memory/registry if/elif into a resolver with
  per-branch spinner/error/KeyboardInterrupt policy, preserving branch order.
- _cancelled_tool_result and _managed_values inlined (single caller each).

Public signatures (execute_tool_calls_concurrent/sequential/segmented, both
middleware runners, every symbol imported by run_agent.py/agent/tests) are
unchanged; middleware/hook/persistence/progress-callback order is identical.
2026-09-02 16:51:42 -07:00
Teknium 338da30a45 refactor(delegate): _resolve_child_runtime returns AIAgent kwargs (drop _ChildRuntime; routing-filter table); dispatch reuses _detach_child/_signal_child_stop; control actions -> _CONTROL_OUTCOMES table; attribution lookup dedupe 2026-09-02 16:50:57 -07:00
Teknium 6f38d64b7a refactor(approval): module docstring for the split, blank-line hygiene 2026-09-02 16:50:44 -07:00
Teknium f65d395535 refactor(state): _FTS_DDL layout table; flatten _fts_table_probe except ladder 2026-09-02 16:50:16 -07:00
Teknium 15651bd877 refactor(update): lift cold-start plan and SCM service pause out of _pause_windows_gateways_for_update (261 -> 163 LOC) 2026-09-02 16:50:01 -07:00
Teknium d43ad31c4d refactor(approval): table-drive interpreter families, fold home-prefix rewriters, compact re-export blocks, drop dead _SHELL_PUNCTUATION 2026-09-02 16:49:10 -07:00
Teknium 0bfcf42133 refactor(update): unify venv-prefix and backend-argv helpers in update_cmd_windows (3+2 call sites) 2026-09-02 16:48:45 -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