Commit Graph

3698 Commits

Author SHA1 Message Date
Teknium
aa0163d361 Merge branch 'simp/agent-runtime' into simp/integration
Conflict in agent/error_classifier.py: both simp/agent-chat and
simp/agent-runtime simplified the same file. Kept simp/agent-chat's
rule-table version, which already subsumes agent-runtime's
billing/rate-limit/overflow verdict helpers (as _V_* verdicts + _first_match
rule tables) and its dead _THINKING_SIG_PATTERNS removal. Verified with a
60k-case differential fuzz: identical ClassifiedError output vs base and vs
agent-runtime's version.
2026-09-02 14:44:19 -07:00
Teknium
3721bcfd41 Merge branch 'simp/hclia-models' into simp/integration 2026-09-02 14:19:39 -07:00
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
2273f2bd20 refactor(agent/models): unify model_metadata TTL disk memos
_ttl_memo_get/_ttl_memo_put back both the local-probe and endpoint-metadata
disk caches (file layout, key order and log strings verified identical).
2026-09-02 13:52:52 -07:00
Teknium
684e8322ff refactor(agent/models): extract LM Studio and llama.cpp /props branches from fetch_endpoint_model_metadata
_lmstudio_native_models and _apply_llamacpp_props; the router-mode child probe
shares one /v1/props -> /props fallback helper. HTTP call sequence verified
identical old vs new across 10 fake-endpoint scenarios.
2026-09-02 13:52:52 -07:00
Teknium
771045655b refactor(agent/models): table-driven credits header parsing, unified account-usage fetchers
- credits_tracker: _MICROS_FIELDS/_USD_FIELDS/_BOOL_FIELDS drive parse_credits_headers;
  _sticky_notice() replaces repeated AgentNotice literals; collapsed defensive layers
- account_usage: _USAGE_FETCHERS dispatch table replaces provider if/elif; shared
  fetch/parse helpers across the codex/anthropic/openrouter fetchers; drop dead
  _resolve_codex_usage_url
- billing_links, fast_mode: compacted docstrings, collapsed if/return chains
- model_metadata: fold effective_provider inference into one expression
Notice keys, header names, URLs, log strings and dataclass defaults unchanged.
2026-09-02 13:52:52 -07:00
Teknium
d465b45f38 refactor(agent/models): compact model_metadata comment essays to their invariants
Every non-obvious rule, ordering, failure mode and WHY is kept (1-3 lines);
issue numbers, dates and narrative dropped. Data tables unchanged.
2026-09-02 13:52:51 -07:00
Teknium
4a65e98f50 refactor(agent/models): extract get_model_context_length steps into helpers
_validate_cached_context_length (step 1), _resolve_bedrock_context_length (1b),
_resolve_custom_endpoint_context_length (2-3); resolution order and every log
message unchanged. Compact the per-step comment essays to their invariants.
2026-09-02 13:52:51 -07:00
Teknium
f3a46eb5d0 refactor(agent/models): dedupe model_metadata probe helpers
- _server_root / _ollama_show_context / _longest_key_match / _probe_local_context_length /
  _endpoint_model_entry replace 5 copies of the same local-probe and lookup bodies
- detect_local_server_type waterfall as an ordered (name, probe) table
- output-cap error classification via phrase-group tables shared by
  is_output_cap_error and parse_available_output_tokens_from_error
- endpoint-scoped context overrides as a data table
- drop dead _fetch_codex_oauth_context_lengths, _resolve_codex_oauth_context_length,
  _estimate_message_chars (zero refs repo-wide)
Verified with a differential harness (old vs new module, ~700 pure-function probes, 0 mismatches).
2026-09-02 13:52:51 -07:00
Teknium
77743eac8a refactor(agent/models): compact pricing snapshot, billing/subscription views, reasoning helpers
- usage_pricing: _snap() builder for official-docs pricing entries (table values identical, verified by dump), shared source/version dicts, drop dead DEFAULT_PRICING
- models_dev: _registry_models/_iter_model_entries/_extract_limit helpers replace repeated registry walking; drop dead ModelInfo.format_cost
- billing_view/subscription_view: OrgRoleCapability mixin replaces duplicated is_admin/can_change_plan; shared fetch_portal_state/parse_org_fields
- reasoning_effort/timeouts/summaries, thinking_timeout_guidance, portal_tags: dispatch tables and compacted comment essays; drop dead CODEX_RESPONSES_EFFORTS alias and _match_any
2026-09-02 13:52:51 -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