Commit Graph

28271 Commits

Author SHA1 Message Date
Teknium eb8d628c97 refactor(hermes_state): restore WHY comments dropped by round-2 sub-branches
Comment/docstring-only (AST-identical): surrogate-scrub rationale, persisted
marker stripping invariant, generation counter upgrade semantics, CJK marker
empty-vs-populated rule, WAL 0-page ordering precondition, repair backup
live-connection case, telegram topic delete precondition, mixed-mode
corruption definition, and similar.
2026-09-02 16:48:30 -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 52419bda5d refactor(delegate): split delegate_task into _normalize_task_list/_coerce_task_schemas/_build_children/_execute_and_aggregate(_Batch); _build_child_agent -> _open_child_session_db/_construct_child_agent/_announce_child_spawn; _run_single_child -> _lease_child_credential/_await_child/_merge_late_steer 2026-09-02 16:46:39 -07:00
Teknium 2a9e16fded refactor(computer_use): compact cua_backend re-export imports (AST-identical) 2026-09-02 16:46:34 -07:00
Teknium 629e6eb1b5 refactor(turn): split finalize_turn into phase helpers (576 -> 264 LOC) 2026-09-02 16:46:33 -07:00
Teknium fa827f596e refactor(gateway/hosted_rooms): reflow multi-line SQL constants (whitespace-only, parity-verified) 2026-09-02 16:46:00 -07:00
Teknium 1aa9285312 refactor(update): hand-compact comments/docstrings in update_cmd.py, update_cmd_fleet.py, update_cmd_zip.py (AST-identical); rewrite stale module docstring 2026-09-02 16:45:44 -07:00
Teknium a61298a21c refactor(computer_use): doctor — shared structured/first-line helpers, unified version message 2026-09-02 16:45:39 -07:00
Teknium 52d982281c refactor(state): _stale_holder guard helper; join implicit-concat SQL fragments (AST-identical) 2026-09-02 16:44:38 -07:00
Teknium 067b31bc8c refactor(tts): refresh module-layout docstring for new sibling modules 2026-09-02 16:44:14 -07:00
Teknium 6ebbb6c787 refactor(tts): share auxiliary-model tag rewrite between xAI and Gemini 2026-09-02 16:44:14 -07:00
Teknium 19997e9978 refactor(tts): lift chunk synthesis loop out of text_to_speech_tool 2026-09-02 16:44:14 -07:00
Teknium 93131b17a6 refactor(tts): drop re-export shims with no external consumers; siblings import from defining modules 2026-09-02 16:44:13 -07:00
Teknium fe25c59281 refactor(tts): plugin-provider layer into tts_tool_plugins with one lookup helper 2026-09-02 16:44:13 -07:00
Teknium caf37e23d4 refactor(tts): importer factory, requirements table, caps to delivery, legacy strip to text_normalize, single-chunk dedupe 2026-09-02 16:44:13 -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 529f1ac0aa refactor(turn): drop section-banner comments in turn_facade_lease 2026-09-02 16:43:09 -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 74b928b6a3 refactor(turn): compact log-call formatting in turn_context_compaction 2026-09-02 16:43:08 -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 325a505602 refactor(approval): move smart-verdict observer + elicitation consent to their leaf modules; hoist re-exports 2026-09-02 16:42:18 -07:00
Teknium 2e9a5e9f32 refactor(gateway/slash): collapse /whoami, /platform, /stop, /footer, /verbose duplication; extract /compress preview; module docstrings 2026-09-02 16:41:41 -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 1c20028afd refactor(kanban-cli): split the subcommand spec list so no function exceeds 300 LOC 2026-09-02 16:40:44 -07:00
Teknium 84c2e326f2 refactor(turn): split build_turn_context into helpers; extract turn-start compaction to turn_context_compaction.py 2026-09-02 16:40:40 -07:00
Teknium 2df3d507c9 refactor(tools_config): reflow data tables and compact docstrings/comments in tools_config 2026-09-02 16:40:13 -07:00
Teknium 72490fa6cd refactor(model_setup_flows): extract custom-endpoint, Azure Foundry and Bedrock wizards into concern modules
hermes_cli/model_setup_flows_custom.py (_model_flow_custom, _model_flow_named_custom + helpers),
model_setup_flows_azure.py (_model_flow_azure_foundry + Entra preflight / picker),
model_setup_flows_bedrock.py (BEDROCK_GEO_PREFIXES, routability predicates, both Bedrock flows).
Bodies moved verbatim (AST slices); every name re-exported from model_setup_flows (noqa: F401)
so hermes_cli.main and test imports keep resolving. Origin: 1975 -> 1159 lines.
Flow corpus (396 cases): 0 diffs; 34 test files / 364 tests green.
2026-09-02 16:39:35 -07:00
Teknium 40230dcca7 refactor(hermes_cli/main): replace 23 thin cmd_* forwarders with a _forward_command factory table 2026-09-02 16:39:30 -07:00
Teknium 88cb5c965c Merge branch 'simp/r2-state-d' into simp/r2-state 2026-09-02 16:38:41 -07:00
Teknium ba44b1705c Merge branch 'simp/r2-state-c' into simp/r2-state 2026-09-02 16:38:40 -07:00
Teknium ec8f757b46 Merge branch 'simp/r2-state-b' into simp/r2-state 2026-09-02 16:38:40 -07:00
Teknium 0d7acf67b5 refactor(state): pack hanging signatures/tuples in messages/compression/usage (AST-identical) 2026-09-02 16:38:21 -07:00
Teknium 291c33040c refactor(models): fold credential-file mtime fingerprinting into one helper 2026-09-02 16:38:16 -07:00
Teknium 4711e8105d refactor(delegate): child_run dedupe — shared close/attach/detach/stop helpers, _defer_close_after_timeout, _build_tool_trace, _num; single _fabricated_entry 2026-09-02 16:37:47 -07:00
Teknium 82bdbb0730 refactor(state): compact long docstrings (wal/gateway/maintenance/repair), rules preserved 2026-09-02 16:37:35 -07:00
Teknium 5c3acca66b refactor(state): resume — verified messages/compression/titles/usage simplification 2026-09-02 16:37:21 -07:00
Teknium 3a9940fd6f refactor(state): hoist context-window SQL to a module constant 2026-09-02 16:37:20 -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 278669e412 fix(integration): make /browser sub-handlers module-level so _handle_browser_command works on duck-typed hosts
The simplification split _handle_browser_command into _browser_use/
_browser_connect/_browser_disconnect/_browser_status mixin methods; tests
(and any caller) invoking CLICommandsMixin._handle_browser_command on a
stub object broke with AttributeError. Hoist them to module-level
functions taking the cli host explicitly; dispatcher behavior unchanged.
2026-09-02 16:36:12 -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 5c9580c696 refactor(models): dedupe ollama probe failure/ollama-config lookups, pricing fetch/entry helpers; logger parity in models_local 2026-09-02 16:35:42 -07:00
Teknium 8f877d40f9 refactor(computer_use): single-blank layout between top-level defs (AST-identical) 2026-09-02 16:35:33 -07:00
Teknium d46eb1f964 refactor(update): collapse 90 try/except-pass and try/except-logger.debug blocks into suppress()/_best_effort() (new leaf update_cmd_common.py) 2026-09-02 16:34:55 -07:00
Teknium 85c32cfd4e refactor(kanban-cli): compact docstrings/comments in kanban.py keeping every rationale 2026-09-02 16:34:31 -07:00
Teknium 1623697cb7 refactor(mcp): compact session-expired marker table 2026-09-02 16:34:23 -07:00
Teknium 73475d62f6 refactor(cli): main() 393 -> 226 via _build_cli_from_args / _start_worktree_setup / _run_legacy_gateway
The worktree block keeps its 'global _active_worktree' writer inside cli.py (the
helper is module-level in the same file), so the cleanup path's reads are unchanged;
main() no longer declares the global it never wrote directly.
2026-09-02 16:34:20 -07:00
Teknium 57f828a3da refactor(model_setup_flows): shared wizard skeleton in model_setup_flows_common, flows rebuilt on it (2849 -> 1975 lines)
- new hermes_cli/model_setup_flows_common.py: _say/_ask prompt primitives, _persist_model/
  _finish_model (save model choice -> provider/base_url/api_mode -> scrub creds -> save),
  _activate_provider_model (OAuth providers), _oauth_gate (login / use / reauth / cancel),
  _curses_choice + _print_numbered (radio picker with numbered fallback); every existing
  helper moved there and re-exported from the origin (noqa: F401).
- god flows split: azure_foundry -> _azure_entra_preflight/_azure_pick_model, custom ->
  _probe_custom_endpoint/_pick_detected_model/_parse_context_length, named_custom ->
  _configured_model_ids/_discover_named_custom_models/_pick_named_custom_model, nous ->
  _nous_model_catalog, copilot -> _copilot_obtain_token, bedrock -> _bedrock_text_model_ids.
- 396-case scripted flow corpus (transcript/config.yaml/.env/auth.json): 0 diffs vs base.
2026-09-02 16:33:41 -07:00
Teknium 6eae28cb6d refactor(hermes_cli): split cmd_chat prologue into helpers; split build_top_level_parser into flags + chat builders 2026-09-02 16:33:36 -07:00