Commit Graph

5936 Commits

Author SHA1 Message Date
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 291c33040c refactor(models): fold credential-file mtime fingerprinting into one helper 2026-09-02 16:38:16 -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 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 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
Teknium 601dfdec82 refactor(auth): pack re-export tuples; plugin registry auto-extend as one helper 2026-09-02 16:33:09 -07:00
Teknium c633aee918 refactor(kanban-db): split create_task into project-link + skills helpers 2026-09-02 16:32:35 -07:00
Teknium 55b8f0e0ab refactor(kanban-cli): extract dispatcher/maintenance verbs to kanban_ops; unify single-mutation ok/err reporting 2026-09-02 16:32:06 -07:00
Teknium 80b2cc4814 refactor(tools_config): reflow re-import blocks and TOOL_CATEGORIES env_vars rows 2026-09-02 16:31:32 -07:00
Teknium ebf2875049 refactor(update): lift already-up-to-date finish out of _cmd_update_impl (290 -> 257 LOC) 2026-09-02 16:31:17 -07:00
Teknium ec8e85965d refactor(tools_config): compact extracted modules (join statements, tighten comments) 2026-09-02 16:29:58 -07:00
Teknium 9ebda92cca refactor(kanban-cli): extract boards cluster to kanban_boards; unify goal-gate, id/reason, run-state and config helpers across handlers 2026-09-02 16:29:40 -07:00
Teknium bff23bea2c refactor(update): lift option resolution, receipt/plan, git prep, HEAD verification and CalledProcessError handling out of _cmd_update_impl (521 -> 290 LOC) 2026-09-02 16:29:04 -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 bf16d5f996 refactor(doctor): trim re-exports to names referenced outside their module 2026-09-02 16:25:28 -07:00
Teknium 5cc3651b3b refactor(kanban-cli): extract data-driven argparse tree to kanban_parser and output helpers to kanban_output 2026-09-02 16:25:20 -07:00
Teknium ffa08e6591 refactor(hermes_cli/main): extract dashboard/serve support cluster to main_dashboard.py 2026-09-02 16:24:55 -07:00
Teknium 568afa038b refactor(auth): trim re-export tuples to names with a caller outside the origin package 2026-09-02 16:24:36 -07:00
Teknium 64cf496ca5 refactor(models): collapse deepinfra/custom-cache/provider-list helpers; module docstrings 2026-09-02 16:24:19 -07:00
Teknium e118abc61a refactor(update): lift manual-gateway restart, stuck-PID sweep and phase-abort recovery out of _restart_gateway_fleet_after_update (362 -> 154 LOC) 2026-09-02 16:23:31 -07:00
Teknium 2a9c5d8cf5 refactor(doctor_state): unify state.db repair path, memory-provider dispatch table; doctor.py header 2026-09-02 16:23:25 -07:00
Teknium f78d519e5a refactor(auth): collapse duplicate corrupt-store warning, drop dead _SUPPORTED_PREFIXES 2026-09-02 16:23:15 -07:00
Teknium f28dfda667 refactor(web_server): flatten nested guards in auth middleware + plugin cache; module docstring describes the split 2026-09-02 16:23:06 -07:00
Teknium 55ba3cbd61 refactor(tools_config): extract MCP checklist + enable/disable command into tools_config_mcp; compact checklist/reconfigure helpers 2026-09-02 16:22:15 -07:00
Teknium 975783c31e refactor(models): table-drive opencode api-mode routing; collapse copilot/anthropic catalog helpers 2026-09-02 16:20:36 -07:00
Teknium 7b30652d8f refactor(auth): explicit-config check table, _store_section helper, docstring repairs, move orphaned section comments to their modules 2026-09-02 16:20:00 -07:00
Teknium d482bd534d refactor(hermes_cli/main): split select_provider_and_model + cmd_dashboard into named helpers; drop unused imports 2026-09-02 16:19:17 -07:00
Teknium 8b34d23366 refactor(web_server): move skills-hub action helpers to web_server_profiles; trim fastapi import block to what web_server still uses 2026-09-02 16:19:10 -07:00
Teknium 95804887c1 refactor(doctor): tighten platform + tools checks — shared helpers, backend dispatch table, compact docstrings 2026-09-02 16:19:08 -07:00
Teknium 4d8d479e41 refactor(tools_config): split _get_platform_tools into explicit/composite resolvers; compact header comments 2026-09-02 16:18:39 -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 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 ffed5b1503 refactor(tools_config): split tools_command into flow helpers; drop unused imports 2026-09-02 16:14:49 -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 96d8883986 refactor(models): collapse copilot catalog filter, probe/dedupe helpers, static-detect ladders; compact comments 2026-09-02 16:12:56 -07:00
Teknium 13e7cb8eb9 refactor(tools_config): merge provider-selection extraction (tools_config_providers) 2026-09-02 16:11:56 -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 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 7d43c20af7 refactor(web_server): move _process_start_marker with the lifecycle cluster 2026-09-02 16:10:10 -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