Commit Graph

3686 Commits

Author SHA1 Message Date
Teknium 74e56381d4 Merge branch 'simp/hclia-providers' into simp/integration 2026-09-02 14:19:39 -07:00
Teknium 796e81b391 Merge branch 'simp/hclia-prompt' into simp/integration 2026-09-02 14:19:39 -07:00
Teknium b226b80752 Merge branch 'simp/hclia-review' into simp/integration 2026-09-02 14:19:39 -07:00
Teknium 0b18fe0bcd Merge branch 'simp/hclia-aux' into simp/integration 2026-09-02 14:19:39 -07:00
Teknium 583e49ab4f Merge branch 'simp/hclia-transports' into simp/integration 2026-09-02 14:19:38 -07:00
Teknium db03f855c7 Merge branch 'simp/hclia-runtime' into simp/integration 2026-09-02 14:19:38 -07:00
Teknium 6ad4ed9fba Merge branch 'simp/hclia-adapters' into simp/integration 2026-09-02 14:19:38 -07:00
Teknium db46847dbf Merge branch 'simp/hclia-creds-c' into simp/integration 2026-09-02 14:19:38 -07:00
Teknium 52028c4464 Merge branch 'simp/hclia-creds-b' into simp/integration 2026-09-02 14:19:38 -07:00
Teknium 343ceb6abe Merge branch 'simp/hclia-creds-a' into simp/integration 2026-09-02 14:19:38 -07:00
Teknium 4dfd383765 Merge branch 'simp/agent-loop' into simp/integration 2026-09-02 14:19:36 -07:00
Teknium 673b2c6d5a Merge branch 'simp/agent-runagent' into simp/integration 2026-09-02 14:19:36 -07:00
Teknium 8c40fc4aba Merge branch 'simp/agent-ctxcomp' into simp/integration 2026-09-02 14:19:35 -07:00
Teknium 082dd91c79 Merge branch 'simp/agent-convcomp' into simp/integration 2026-09-02 14:19:35 -07:00
Teknium 7c6a581d38 Merge branch 'simp/agent-chat' into simp/integration 2026-09-02 14:19:35 -07:00
Teknium 53ab9d1ed0 Merge branch 'simp/agent-init-pb' into simp/integration 2026-09-02 14:19:35 -07:00
Teknium c43c0bcfa6 Merge branch 'simp/agent-init-moa' into simp/integration 2026-09-02 14:19:35 -07:00
Teknium 44982309b8 refactor(agent/prompt): dispatch tables and helper extraction in display, context refs, breakdown, compaction
build_tool_preview -> _PREVIEW_BUILDERS per-tool table; git @refs -> _GIT_REFERENCE_ARGS; context_breakdown
_skills_block/_append_overflow dedupe; prune_pre_checkpoint_items summary retention folded into one closure;
build_skill_invocation_message reuses _render_skill_block; ruff SIM collapses; restored two compacted
cache-policy invariant comments.
2026-09-02 13:53:58 -07:00
Teknium 593c8e9146 refactor(agent/prompt): split build_system_prompt_parts into tier helpers; unify model-gate resolver
_tool_guidance_block, _skills_prompt, _bot_mode_parts, _active_profile_line, _platform_hint, _memory_parts,
_zone_bits, _timestamp_line lifted out of the 600-line builder; tool_use_enforcement and execution_guidance
gates share _model_gate. Emitted prompt text is byte-identical.
2026-09-02 13:53:57 -07:00
Teknium be5c6a2fd8 refactor(agent/prompt): remove dead code, unify duplicated helpers, compact docstrings across prompt/skill/redaction modules
Dead (zero refs): coding_system_blocks, get_friendly_tool_labels, get_scan_ordered_skills_dirs,
_project_quarantine_cache_clear, clear_stable_prefixes, _redact_http_request_target_query_params,
_has_http_method_substring, PromptCachePlan.marker_count, display _diff_* colour thunks (-> _diff_ansi),
pass-through RedactingFormatter.__init__.
Unified: _slugify -> slugify_skill_name; reload diff -> diff_command_snapshots; _is_summary_item ->
is_compaction_summary_message alias; sanitizer walkers -> _sanitize_messages/_sanitize_structure;
assignment redaction passes -> _redact_assignments/_should_redact_assignment; quiet-mode tool lines -> _CUTE_LINES table.
2026-09-02 13:53:57 -07:00
Teknium 96e952a4f8 refactor(agent/providers): one ProviderRegistry engine behind every *_registry module
- provider_registry.py: ProviderRegistry (global + per-scope maps, lock,
  generation counters, register/list/get/snapshot/restore/reset) with
  export() binding the historical module-level names and _providers/
  _scoped_providers/_lock test hooks into each *_registry module
- is_available_safe / configured_provider_name replace the 4 nested
  _is_available_safe closures and 2 config-reading blocks
- browser/image_gen/video_gen/web_search/terminal_env/tts/transcription
  registries keep their public API, log strings, error strings, builtin
  collision policy (warn vs raise) and key normalization (strip vs lower)
2026-09-02 13:53:28 -07:00
Teknium 8dcb2b6ada refactor(agent/providers): shared ProviderBase/CatalogProviderBase and provider_media; compact contract docs
- provider_base.py: ProviderBase (name/display_name/get_setup_schema) and
  CatalogProviderBase (default_model/list_models/is_available) replace the
  identical default-method bodies duplicated across 7 provider ABCs
- provider_media.py: one save_b64/save_bytes/save_url/cache_dir implementation
  behind image_gen_provider and video_gen_provider
- memory_manager.py: _each_provider fan-out helper replaces per-hook
  try/except loops; _signature_params/_has_var_kwargs unify signature probes
- image_routing.py: _resolve_inference_value shared by base_url/api_key
  resolution; _dict_or_empty/_clean_str/_custom_provider_entries helpers
- MemoryProvider/ContextEngine/TTS/browser/web/terminal-env ABC docstrings
  compacted to their invariants; method names and signatures unchanged
2026-09-02 13:53:28 -07:00
Teknium b6e1037730 refactor(agent/lsp): table-driven server registry, shared client/manager helpers, compact docs
- servers.py: per-language _root_*/_spawn_* functions collapsed into declarative
  ServerDef entries built by _make_spec/_simple_spawn/_markers_root (-707 LOC)
- client.py: _write/_send_reply/_cancel_task helpers replace repeated
  try/except blocks; handler dispatch tables for server->client requests
- manager.py: _broken_key unifies the (server_id, root) key derivation
- install.py/cli.py/eventlog.py/workspace.py/protocol.py/range_shift.py/
  reporter.py: dedupe helpers (_find_binary, _link_into_bin, _run_installer,
  _emit_once, _walk_up), drop dead log_no_server_configured, compact docs
2026-09-02 13:53:27 -07:00
Teknium 95177359f8 refactor(agent/aux): ruff SIM cleanups; compact vision custom-runtime recovery 2026-09-02 13:33:04 -07:00
Teknium 05d1136dea refactor(agent/aux): fallback reason via ordered predicate table; single loop for stale-credential re-walk 2026-09-02 13:33:01 -07:00
Teknium d8ef59a415 refactor(agent/aux): recovery-ladder rungs via one _rung() generator helper with named accept predicates 2026-09-02 13:33:01 -07:00
Teknium da388692e4 refactor(agent/aux): one _field accessor for dict/object wire payloads 2026-09-02 13:32:58 -07:00
Teknium 6320c54552 refactor(agent/aux): _to_async_client header selection via _endpoint_default_headers 2026-09-02 13:32:56 -07:00
Teknium 0d41e9bdbc refactor(agent/aux): shared pool loader; restore @_relay_auxiliary_call placement on call_llm 2026-09-02 13:32:55 -07:00
Teknium 14ec5874a5 refactor(agent/aux): collapse cancel-check readers and Codex-route model predicates 2026-09-02 13:32:53 -07:00
Teknium b40d76823f refactor(agent/aux): shared creds-pair and Nous pool entry-state helpers 2026-09-02 13:32:51 -07:00
Teknium 9001ed2365 refactor(agent/aux): shared _prepare_aux_request head for call_llm/async_call_llm 2026-09-02 13:32:49 -07:00
Teknium d46aa77cde refactor(agent/aux): extract named-custom credential resolution, Bedrock and Vertex client builders out of resolve_provider_client 2026-09-02 13:32:45 -07:00
Teknium e3d352872b refactor(agent/aux): shared chain-label aliases, context-window screen, event-loop helper 2026-09-02 13:32:41 -07:00
Teknium 575cd5f34e refactor(agent/aux): shared hook ticker and _is_specialized_aux_client predicate 2026-09-02 13:32:41 -07:00
Teknium 5dfda6a615 refactor(agent/aux): compact _fallback_destination 2026-09-02 13:32:12 -07:00
Teknium 28c3cb1561 refactor(agent/aux): shared _endpoint_default_headers, single primary-attempt closure in call_llm impls, vision tail dedupe 2026-09-02 13:32:09 -07:00
Teknium 936c8bb626 refactor(agent/aux): split _CodexCompletionsAdapter.create into request build / final-response parse; dedupe stream/client close paths 2026-09-02 13:32:07 -07:00
Teknium 312378d9b1 refactor(agent/aux): unify _read_main_{model,provider,api_key,base_url} and relay call-context builders 2026-09-02 13:32:03 -07:00
Teknium 4022e69e69 refactor(agent/aux): lift max_tokens forwarding policy and Nous dual-wire check out of _build_call_kwargs 2026-09-02 13:32:00 -07:00
Teknium dcbf263a09 refactor(agent/aux): unify same-provider retry and fallback-candidate prep across sync/async (_prepare_same_provider_retry, _plan_fallback_candidate) 2026-09-02 13:31:57 -07:00
Teknium 127a179ae5 refactor(agent/aux): share call_llm/async_call_llm route resolution (_resolve_call_client) and recovery ladder (_aux_recovery_ladder generator) across sync/async wires 2026-09-02 13:31:57 -07:00
Teknium 369ebf7532 refactor(agent/aux): resolve_provider_client — single _route() for sync/async return, dedupe named-custom OpenAI-wire build 2026-09-02 13:30:38 -07:00
Teknium c408601937 refactor(agent/review): simplify curator, background_review, verify, insights, title and learning modules (-22% LOC)
Cluster: agent/{curator,curator_backup,background_review,review_engine,
review_idle_queue,insights,learning_graph,learning_graph_render,
learning_mutations,learn_prompt,verification_evidence,verification_stop,
verify_hooks,side_question,title_generator,turn_summary,
manual_compression_feedback,trajectory,moa_trace,trace_upload,verify/*}.
13662 -> 10693 LOC (-2969, -21.7%), behavior-neutral.

- Dead code: 27 private helpers with zero references removed
  (_auto_title_session, _resolve_review_model, _parse_make_targets,
  _filter_verifiable_paths, _find_subsequence, _is_under_root/_temp_dir,
  _merge_runs, learning_graph_render bucket/period/node helpers,
  _memories_dir/_memory_local_index/_node_detail, _cron_jobs_file,
  _retention_cutoff, _scope_for_args, _clean_token, _count_diff_lines,
  _ordered_verbs, _hermes_meta, _iter_skill_files).
- Unified helpers: _read_config_section (curator + curator_backup),
  _write_file/_write_json (4 curator report writers), _msg_text
  (background_review <- side_question), _report_failure/_notify_title
  (title_generator instant/auto paths), _is_under (verification_evidence),
  _scoped SQL pair builder + _query (insights), _optional_lock
  (background_review), verify.recipes table-driven detection.
- if/elif routing -> dict dispatch: side_question role labels,
  curator_backup summary bits, learning_graph_render buckets, insights
  section rendering, verify recipe pickers.
- Redundant defensive layers, single-use wrappers and verbose narrative
  comments collapsed; every non-obvious WHY/invariant kept in compact form.

Verification: parity.py (all REMOVED symbols zero-ref), import smoke for
every module + cli/run_agent/gateway.run/hermes_cli.main/
agent.conversation_loop/tui_gateway.server, old-vs-new fuzz parity on all
shared pure functions, SQL trace parity for insights and
verification_evidence, cluster tests 1354 passed / 0 failed (46 files).
2026-09-02 13:30:25 -07:00
Teknium ab48b1ddc5 refactor(agent): extract per-call API message build into turn_context.build_api_messages 2026-09-02 13:30:23 -07:00
Teknium 30b0759bb3 refactor(agent): extract content_filter refusal handling into turn_truncation.handle_content_policy_refusal 2026-09-02 13:30:23 -07:00
Teknium 4f53d7bd28 refactor(agent): extract post-tool-call compression decision into turn_preflight.compress_after_tool_results 2026-09-02 13:30:23 -07:00
Teknium f0d2355e26 refactor(agent): extract text-response stop gates (verify-on-stop, pre_verify hook, kanban guard) into agent/turn_stop_gates.py 2026-09-02 13:30:23 -07:00
Teknium 22cba7dd41 refactor(agent): extract classified-error routing (compaction gate, long-context tier, eager/auth fallback, Nous 429) into turn_recovery.route_classified_error 2026-09-02 13:30:23 -07:00
Teknium ef9dc88348 refactor(agent): drop write-only _bot_capability_refreshed attribute (zero readers repo-wide) 2026-09-02 13:30:22 -07:00