@kodax-ai/kodax 0.7.79 → 0.7.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +124 -12
  2. package/README.md +44 -10
  3. package/README_CN.md +36 -7
  4. package/config-templates/config.example.jsonc +14 -2
  5. package/dist/chunks/agent-UMBMZLCW.js +2 -0
  6. package/dist/chunks/argument-completer-MHRFNBWB.js +2 -0
  7. package/dist/chunks/{chunk-BBOVVDQJ.js → chunk-5XCQGFGP.js} +1 -1
  8. package/dist/chunks/{chunk-H5LLM7DB.js → chunk-6UENDY33.js} +2 -2
  9. package/dist/chunks/{chunk-EDZ4QILG.js → chunk-BNFUIZKY.js} +17 -5
  10. package/dist/chunks/{chunk-TSTVAU5E.js → chunk-D66EWPAX.js} +190 -191
  11. package/dist/chunks/{chunk-M4N2JZTZ.js → chunk-E7C4DRD2.js} +1 -1
  12. package/dist/chunks/{chunk-GEECPO2H.js → chunk-EVXIJPZ6.js} +66 -66
  13. package/dist/chunks/{chunk-CXHEZY5G.js → chunk-FGQZUN7C.js} +1 -1
  14. package/dist/chunks/chunk-FUK6OUCW.js +30 -0
  15. package/dist/chunks/{chunk-67THZRM6.js → chunk-HTVLCHWH.js} +1 -1
  16. package/dist/chunks/chunk-ITY7HLSS.js +655 -0
  17. package/dist/chunks/{chunk-OWQT3FTE.js → chunk-KHEFUT6O.js} +1 -1
  18. package/dist/chunks/{chunk-6GVQDQTQ.js → chunk-LLWRPP6U.js} +1 -1
  19. package/dist/chunks/chunk-QMPJJCBE.js +810 -0
  20. package/dist/chunks/{chunk-QCZLCLFL.js → chunk-RX3X3PER.js} +2 -2
  21. package/dist/chunks/chunk-THBWLOA3.js +319 -0
  22. package/dist/chunks/{chunk-SG6P4SZS.js → chunk-TRNAWSXP.js} +21 -21
  23. package/dist/chunks/chunk-VTFG3B7U.js +348 -0
  24. package/dist/chunks/chunk-WLGQ6XI2.js +479 -0
  25. package/dist/chunks/compaction-config-SSPH4V36.js +2 -0
  26. package/dist/chunks/{construction-bootstrap-K3ZGEN5N.js → construction-bootstrap-P5ZKDLTM.js} +1 -1
  27. package/dist/chunks/dist-7J763N5L.js +2 -0
  28. package/dist/chunks/{dist-JMO47GJV.js → dist-WWL2DNIJ.js} +1 -1
  29. package/dist/chunks/host-22ITM5E3.js +2 -0
  30. package/dist/chunks/run-manager-ABNHISGD.js +2 -0
  31. package/dist/chunks/{utils-6LEKJPQN.js → utils-ATKWKEDP.js} +1 -1
  32. package/dist/index.d.ts +13 -12
  33. package/dist/index.js +4 -4
  34. package/dist/kodax_bootstrap.js +1 -1
  35. package/dist/kodax_cli.js +1304 -1288
  36. package/dist/kodax_resume.js +63 -63
  37. package/dist/runtime-worker.js +1202 -1186
  38. package/dist/sandbox-workspace-session.js +43 -43
  39. package/dist/sdk-a2a.d.ts +8 -8
  40. package/dist/sdk-a2a.js +1 -1
  41. package/dist/sdk-agent.d.ts +15 -17
  42. package/dist/sdk-agent.js +1 -1
  43. package/dist/sdk-coding.d.ts +171 -20
  44. package/dist/sdk-coding.js +1 -1
  45. package/dist/sdk-experimental-memory.js +1 -1
  46. package/dist/sdk-llm.js +1 -1
  47. package/dist/sdk-mcp.js +1 -1
  48. package/dist/sdk-media.js +1 -1
  49. package/dist/sdk-repl.d.ts +19 -200
  50. package/dist/sdk-repl.js +2 -2
  51. package/dist/sdk-runtime.d.ts +18 -8
  52. package/dist/sdk-runtime.js +1 -1
  53. package/dist/sdk-sandbox.js +1 -1
  54. package/dist/sdk-session.d.ts +4 -4
  55. package/dist/sdk-session.js +1 -1
  56. package/dist/sdk-skills.js +1 -1
  57. package/dist/semantic-worker.js +44 -44
  58. package/dist/types-chunks/{bash-prefix-extractor.d-CNSidpmv.d.ts → bash-prefix-extractor.d-D_bvmnHs.d.ts} +6 -2
  59. package/dist/types-chunks/{capsule.d-B3q98pLQ.d.ts → capsule.d-BFpbFq-C.d.ts} +9 -16
  60. package/dist/types-chunks/{controller.d-RGV7Pjv9.d.ts → controller.d-C2aHqzHj.d.ts} +18 -10
  61. package/dist/types-chunks/{guardrail.d-1NLSFTyN.d.ts → guardrail.d-CrSR1T_a.d.ts} +74 -77
  62. package/dist/types-chunks/{history-retrieval.d-BAegI14A.d.ts → history-retrieval.d-DImTKgO6.d.ts} +1 -1
  63. package/dist/types-chunks/{public-api.d-BpJhHoa7.d.ts → public-api.d-C-lVOhdt.d.ts} +5 -17
  64. package/dist/types-chunks/{repl.d-CZ12Ow3X.d.ts → repl.d-DGi0nhpl.d.ts} +5 -5
  65. package/dist/types-chunks/{run-manager.d-CX3AUocA.d.ts → run-manager.d-C6ahvZqK.d.ts} +1 -1
  66. package/dist/types-chunks/{sdk-session-B3cfJKqF.d.ts → sdk-session-D5Ffq4h-.d.ts} +2 -2
  67. package/dist/types-chunks/shell-command-sets.d-jmXn8K7r.d.ts +297 -0
  68. package/dist/types-chunks/{types.d-C0_rn--1.d.ts → types.d-BqYq_ljy.d.ts} +2 -2
  69. package/dist/types-chunks/{types.d-BZ9oXvTV.d.ts → types.d-BzpPDBPV.d.ts} +1 -1
  70. package/dist/types-chunks/{utils.d-CGpHavsU.d.ts → utils.d-Z-YpaiUS.d.ts} +15 -5
  71. package/docs/SDK_EMBEDDER_GUIDE.md +49 -36
  72. package/package.json +3 -3
  73. package/dist/chunks/agent-V4AC5JZD.js +0 -2
  74. package/dist/chunks/argument-completer-ZPC2MLES.js +0 -2
  75. package/dist/chunks/chunk-B6UY3VHV.js +0 -348
  76. package/dist/chunks/chunk-CR2IF7VF.js +0 -30
  77. package/dist/chunks/chunk-KLWP7POA.js +0 -467
  78. package/dist/chunks/chunk-Q4M7DJOD.js +0 -319
  79. package/dist/chunks/chunk-RQPMGRTR.js +0 -810
  80. package/dist/chunks/chunk-ZCZZUE5E.js +0 -662
  81. package/dist/chunks/compaction-config-AEUGVROL.js +0 -2
  82. package/dist/chunks/dist-GFJFRPAV.js +0 -2
  83. package/dist/chunks/host-23K2Q6RZ.js +0 -2
  84. package/dist/chunks/run-manager-PGIR6ITA.js +0 -2
package/CHANGELOG.md CHANGED
@@ -6,23 +6,123 @@ All notable changes to this project will be documented in this file.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ No changes yet.
10
+
11
+ ---
12
+
13
+ ## [0.7.81] - 2026-08-05
14
+
15
+ > Git tag and GitHub Release are created by the release workflow. npm
16
+ > publication remains a separate manual operator step.
17
+
9
18
  ### Added
10
19
 
11
- - User-level `sandbox.envPass` now accepts an exact list of host environment
12
- variable names to expose to model-issued command targets, including ASRT and
13
- the ordinary fallback path. The default remains empty; configuration stores
14
- names rather than values, project configuration cannot broaden the list, and
15
- execution-control variables remain blocked. Commands can read and emit any
16
- variable that the user explicitly allows. SDK callers can supply the same
17
- Run-scoped setting through `KodaXOptions.sandbox`, including Worker and daemon
18
- transports, without mutating process-global configuration.
20
+ - Delivered Runtime interrupt inputs now expose an `entryId`: the exact physical
21
+ Session-lineage entry created by canonical user-input persistence. The value
22
+ is available in both `RuntimeInterruptInputStatus` and the
23
+ `run.input.delivered` event payload, so an SDK host can correlate a completed
24
+ interrupt with conversation history without reconstructing ordinal position.
25
+
26
+ ### Changed
27
+
28
+ - A safe-boundary drain keeps every queued user prompt as its own transcript
29
+ message and passes the per-queue-id `queuedMessageEntryIds` mapping through
30
+ the Runner/Runtime boundary. A delivered batch is therefore ordered and
31
+ referentially exact even when it contains multiple prompts.
19
32
 
20
33
  ### Fixed
21
34
 
22
- - A2A integration watching now ignores unchanged content revisions, preventing
23
- repeated false `hot-reloaded` notices and their unnecessary root-TUI render.
24
- Explicit manual reload still repairs missing registrations and retries
25
- transient discovery failures without requiring a file rewrite.
35
+ - Runtime-owned Session persistence completes before an interrupt is reported
36
+ as delivered. Missing, ambiguous, or failed canonical persistence now fails
37
+ delivery closed; no durable delivery event or delivered status is published.
38
+ The canonical entry reference survives event replay, Session compaction, and
39
+ Runtime restart. Legacy persisted delivery records remain readable without an
40
+ `entryId`.
41
+
42
+ ---
43
+
44
+ ## [0.7.80] - 2026-08-04
45
+
46
+ > Git tag and GitHub Release are created by the release workflow. npm
47
+ > publication remains a separate manual operator step.
48
+
49
+ ### Added
50
+
51
+ - Runtime SDK capability negotiation now advertises `managedRunDurability` v1,
52
+ allowing embedders to reject or safely replace daemons that do not guarantee
53
+ canonical managed-Run boundaries.
54
+ - The CLI honors `worker.configuredA2A` in `~/.kodax/config.json`: the embedded
55
+ Runtime is created Worker-hosted with the configured A2A plane installed
56
+ inside the Worker owner, so configured outbound A2A Agents appear as
57
+ `external:<name>` in `list_dispatchable_agents` and can be dispatched with
58
+ `spawn_agent`. The function-valued inline `externalAgents` plane is skipped
59
+ in that mode because it cannot cross the Worker boundary, and the mode
60
+ rejects configured MCP servers or Extensions. Config templates document the
61
+ `worker` block.
62
+ - `@kodax-ai/agent` now exports the structured `RunnerIterationLimitError` and
63
+ `isRunnerIterationLimitError` guard. A Runner that exhausts its mechanical
64
+ tool-loop fuse fails with `code: 'RUNNER_ITERATION_LIMIT'` and carries the
65
+ last legal transcript, readable through `readRunnerRecoveryTranscript`, so
66
+ callers can distinguish a runaway tool loop from other failures.
67
+
68
+ ### Changed
69
+
70
+ - Public `countTokens` / `estimateTokens` keep their existing signatures but
71
+ now use a provider-neutral O(n) multilingual and dense-data estimate instead
72
+ of synchronous `cl100k_base` BPE tokenization.
73
+ - Managed AMA turns now bound one uninterrupted `Runner.run` tool loop by a
74
+ 500-iteration mechanical panic fuse instead of being unbounded. Each
75
+ idle-yield resume starts a fresh Runner invocation and resets the counter, so
76
+ the fuse is a runaway-loop breaker, never a cumulative task budget; the
77
+ managed-task idle-yield lifecycle itself remains unbounded. Iteration events
78
+ report the real fuse and a fuse exit keeps the recovery transcript and
79
+ checkpoint available for diagnosis or resume.
80
+
81
+ ### Fixed
82
+
83
+ - Direct `@kodax-ai/coding` SDK guardrails now use the same deterministic
84
+ filesystem, shell, and Git permission analyzer as the REPL, so ordinary
85
+ project `read`/`grep`/`glob` and read-only shell calls no longer depend on
86
+ host-specific analyzer wiring. Classifier truncation recognizes
87
+ OpenAI-compatible `length`, with default attempt deadlines of 45s and 90s;
88
+ an explicit `timeoutMs` remains authoritative for both attempts.
89
+ - Oversized tool output is byte/line-spilled before token estimation, avoiding
90
+ main-loop stalls on long Base64/ASCII output while preserving a bounded
91
+ preview and complete artifact.
92
+ - Runtime-owned managed Runs durably save the initial accepted prompt, each
93
+ completed turn, and each queued prompt before publishing the corresponding
94
+ lifecycle event. Required persistence failures fail closed, and queued turns
95
+ are not started until their user input is canonical.
96
+
97
+ - Auto permission analysis no longer treats ordinary grep/glob/directory and
98
+ Git metadata/content reads as unresolved, and no longer invents an unknown
99
+ effect for tools with trusted side-effect metadata — GET-only `web_fetch` is
100
+ reclassified as a network read. A classifier response truncated by
101
+ `max_tokens` is retried once with a 1024-token output budget instead of
102
+ repeating the same impossible 256-token attempt (Issue 275).
103
+ - Managed runs can no longer spin in repetition loops across idle-yield child
104
+ completions: bounded managed-run/runtime context projections, stall
105
+ detection, verifier-recorder and LLM-judge convergence, and worker-role
106
+ prompt guidance keep repeated convergence stable while parallel review is
107
+ restored.
108
+ - `quality_strategy` Actor-Turn evidence refs stay inside the executing
109
+ Actor's controlled subtree: same-parent sibling provenance is rejected as
110
+ outside the visibility boundary, while unknown actors and stale exact turn
111
+ refs drop the optional telemetry without blocking the underlying legal Actor
112
+ operation.
113
+ - Parallel delegation guidance is tightened so independent work lanes fan out
114
+ through ordinary Actor operations while genuinely indivisible or strongly
115
+ serial work stays solo, without re-opening the managed-run repetition
116
+ regression.
117
+ - CLI sessions on a Worker-hosted embedded Runtime now reduce run options to
118
+ the JSON-safe wire DTO before crossing the Worker transport boundary: host
119
+ callbacks (`events.beforeToolExecute`, `onTextDelta`), session storage,
120
+ memory identity, and the host-owned extension runtime are stripped, matching
121
+ daemon-mode sanitization instead of crashing with
122
+ `RuntimeTransportBoundaryError`. Daemon mode itself keeps its loud
123
+ host-binding rejection — a configured `events.beforeToolExecute` or
124
+ `extensionRuntime` still errors instead of being silently disabled; only
125
+ Worker-hosted embedded Runtimes strip them.
26
126
 
27
127
  ## [0.7.79] - 2026-08-03
28
128
 
@@ -46,6 +146,14 @@ All notable changes to this project will be documented in this file.
46
146
  reports unresolved legacy ambiguity, and supplies revision-fenced
47
147
  fork/rewind boundaries while leaving raw transcript audit data unchanged.
48
148
  Standalone session consumers receive the same mutation boundary contract.
149
+ - User-level `sandbox.envPass` now accepts an exact list of host environment
150
+ variable names to expose to model-issued command targets, including ASRT and
151
+ the ordinary fallback path. The default remains empty; configuration stores
152
+ names rather than values, project configuration cannot broaden the list, and
153
+ execution-control variables remain blocked. Commands can read and emit any
154
+ variable that the user explicitly allows. SDK callers can supply the same
155
+ Run-scoped setting through `KodaXOptions.sandbox`, including Worker and daemon
156
+ transports, without mutating process-global configuration.
49
157
 
50
158
  ### Changed
51
159
 
@@ -276,6 +384,10 @@ All notable changes to this project will be documented in this file.
276
384
  frames obey the request-ID fence and cannot acknowledge unfinished requests.
277
385
  Daemon startup cleanup also surfaces an indeterminate process-tree outcome
278
386
  instead of treating an already-exited root as proof of descendant cleanup.
387
+ - A2A integration watching now ignores unchanged content revisions, preventing
388
+ repeated false `hot-reloaded` notices and their unnecessary root-TUI render.
389
+ Explicit manual reload still repairs missing registrations and retries
390
+ transient discovery failures without requiring a file rewrite.
279
391
 
280
392
  ### Performance
281
393
 
package/README.md CHANGED
@@ -559,7 +559,7 @@ hosts. Actor ownership additionally uses Runtime identity rather than PID alone,
559
559
  so PID reuse cannot pin a crashed owner. The resume Session picker also renders
560
560
  timestamps in the host's local timezone.
561
561
 
562
- **v0.7.79 release-preparation candidate:** Configured outbound A2A Agents can persist two
562
+ **v0.7.79 release:** Configured outbound A2A Agents can persist two
563
563
  independent, default-deny network permissions: private-address access and
564
564
  non-loopback plaintext HTTP. The embedded Worker and shared daemon reconcile
565
565
  and execute the same authorized configuration. Runtime embedders also gain one
@@ -574,13 +574,45 @@ OpenAI-compatible custom providers can now choose `max_tokens` or
574
574
  `max_completion_tokens` per provider or model. DeepSeek V4 Flash and Pro use
575
575
  separate reasoning profiles and are advertised as text-only. See the
576
576
  [v0.7.79 design](docs/features/v0.7.79.md) and
577
- [release preparation checklist](docs/release.md#v0779-release-preparation).
578
- FEATURE_280 was explicitly rescheduled to v0.7.81 and is not represented as
579
- shipped by this candidate.
577
+ [release checklist](docs/release.md#v0779-release-preparation).
578
+ FEATURE_280 was explicitly rescheduled to v0.7.81 (then to v0.7.86 on
579
+ 2026-08-04) and is not represented as shipped by this release.
580
580
  Issue 256 was explicitly rescheduled to v0.7.84 and is likewise not represented
581
- as shipped by this candidate.
582
-
583
- The v0.7.77 release also adds an opt-in, host-configurable Shell Execution Contract.
581
+ as shipped by this release.
582
+
583
+ **v0.7.80 hardening release:** The CLI honors `worker.configuredA2A` in
584
+ `~/.kodax/config.json`: the embedded Runtime becomes Worker-hosted and loads
585
+ the configured A2A plane inside the Worker owner, so configured outbound
586
+ Agents appear as `external:<name>` in `list_dispatchable_agents` and can be
587
+ dispatched with `spawn_agent`. The mode rejects configured MCP servers or
588
+ Extensions (they cannot cross the Worker boundary); use the default inline
589
+ Runtime to retain those capabilities. Worker-hosted embedded CLI sessions also
590
+ reduce run options to the JSON-safe wire DTO exactly like daemon mode instead of
591
+ crashing with `RuntimeTransportBoundaryError`. Auto permission analysis no
592
+ longer treats ordinary search scopes and tool metadata as unresolved, and a
593
+ `max_tokens`-truncated classifier retry uses a 1024-token budget (Issue 275).
594
+ Managed AMA turns now bound one uninterrupted tool loop by a 500-iteration
595
+ panic fuse that resets on every idle-yield resume — a runaway-loop breaker,
596
+ never a cumulative task budget — and a fused Runner fails with a structured
597
+ `RunnerIterationLimitError` carrying the recovery transcript. Managed-run
598
+ repetition loops are closed; parallel review and delegation guidance are
599
+ restored and tightened. FEATURE_278/279/282/283/285 were explicitly
600
+ rescheduled to v0.7.85, so v0.7.80 remains a debug/patch slot and no incomplete
601
+ feature is represented as shipped. See the
602
+ [v0.7.80 release checklist](docs/release.md#v0780-release-preparation).
603
+
604
+ **v0.7.81 Runtime interrupt integrity release:** Active-Run inputs submitted
605
+ with `delivery: 'interrupt'` now receive one canonical physical Session entry
606
+ before KodaX reports them as delivered. Every delivered item exposes its
607
+ `entryId` in both `runtime.runs.get(...).interruptInputs` and the durable
608
+ `run.input.delivered` event, including after compaction, replay, or Runtime
609
+ restart. A multi-input safe-boundary drain keeps each prompt as a separate user
610
+ message and maps it to its own entry. Runtime-owned persistence or provenance
611
+ failure fails the delivery closed rather than emitting an unverifiable event.
612
+ FEATURE_287 remains planned for v0.7.88; this is a non-Feature patch. See the
613
+ [v0.7.81 release checklist](docs/release.md#v0781-release-preparation).
614
+
615
+ The v0.7.77 release also adds an opt-in, host-configurable Shell Execution Contract.
584
616
  Runtime Session settings or an individual Run can select `pwsh`, Windows
585
617
  PowerShell, `cmd`, `bash`, `zsh`, or an explicit Git Bash executable; KodaX
586
618
  resolves the shell environment in the effective project cwd and then executes
@@ -730,7 +762,7 @@ Source-side workspace package names (`@kodax-ai/*`). npm consumers install the s
730
762
  | Workspace package | Purpose | Key Dependencies |
731
763
  |---------|---------|------------------|
732
764
  | `@kodax-ai/llm` | LLM abstraction (16 built-in provider aliases + custom registration) | @anthropic-ai/sdk, openai |
733
- | `@kodax-ai/agent` | Generic Agent framework — Runner, fan-out, idle-yield, media/input artifacts, session-lineage, capabilities (mcp + skills), tracing (ADR-036 v0.7.43 consolidation; subpaths: `/media`, `/session-lineage`, `/capabilities/mcp`, `/capabilities/skills`, `/tracing`) | @kodax-ai/llm, js-tiktoken, fflate, jimp, yaml |
765
+ | `@kodax-ai/agent` | Generic Agent framework — Runner, fan-out, idle-yield, media/input artifacts, session-lineage, capabilities (mcp + skills), tracing (ADR-036 v0.7.43 consolidation; subpaths: `/media`, `/session-lineage`, `/capabilities/mcp`, `/capabilities/skills`, `/tracing`) | @kodax-ai/llm, fflate, jimp, yaml |
734
766
  | `@kodax-ai/coding` | Coding Agent — 50+ tools (incl. canonical Actor collaboration tools) + role prompts + auto-continue + repo-intelligence protocol | @kodax-ai/llm, @kodax-ai/agent |
735
767
  | `@kodax-ai/repl` | Complete interactive terminal UI (Ink/React, permission modes, commands, streaming) | @kodax-ai/coding, ink, react |
736
768
 
@@ -878,7 +910,9 @@ independent, persisted, default-deny permissions (`--allow-private` and
878
910
  `--allow-insecure-http`); exact loopback HTTP remains available without either.
879
911
  OAuth token endpoints retain their stricter HTTPS-or-exact-loopback rule.
880
912
  Worker-hosted SDK Runtimes can load this same configured plane inside the Worker
881
- owner with `worker: { configuredA2A: true }`. `a2a serve` loads
913
+ owner with `worker: { configuredA2A: true }`. The CLI honors the same opt-in
914
+ from `~/.kodax/config.json` (`"worker": { "configuredA2A": true }`) by creating
915
+ a Worker-hosted embedded Runtime that loads the configured A2A plane. `a2a serve` loads
882
916
  its configured MCP/Extension capability surface before listening and pins that
883
917
  execution authority; it hot-reloads publication, authentication, and limits.
884
918
 
@@ -1425,7 +1459,7 @@ const policy = new DefaultSummaryCompaction({ thresholdRatio: 0.8, keepRecent: 1
1425
1459
  loops. It does not replace or disable KodaX's always-on coding-runtime policy
1426
1460
  described under FEATURE_272 above.
1427
1461
 
1428
- **Key Features**: `Runner` + per-step lifecycle · `runFanOut` (bounded-concurrency + abort + progress events) · `runWithIdleYield` (chat-while-waiting) · `AgentActorController` / `AgentTurnScheduler` · session-id generation · tiktoken-based token estimation · `CompactionPolicy` interface.
1462
+ **Key Features**: `Runner` + per-step lifecycle · `runFanOut` (bounded-concurrency + abort + progress events) · `runWithIdleYield` (chat-while-waiting) · `AgentActorController` / `AgentTurnScheduler` · session-id generation · provider-neutral O(n) token estimation · `CompactionPolicy` interface.
1429
1463
 
1430
1464
  ### `@kodax-ai/kodax/skills` — Skills System
1431
1465
 
package/README_CN.md CHANGED
@@ -181,7 +181,7 @@ deadline 时才超时;embedded、Worker 与 daemon 的 Runtime Auto v4 均声
181
181
  `fallbackPersistsEngine:false`。Actor owner 还会验证 Runtime identity,而不是只看
182
182
  PID,因此 PID 复用不会卡住已崩溃 owner。恢复 Session 选择器也改为显示宿主本地时区。
183
183
 
184
- **v0.7.79 发布准备候选版**:configured outbound A2A Agent 现在可持久化两项彼此独立、
184
+ **v0.7.79 发布**:configured outbound A2A Agent 现在可持久化两项彼此独立、
185
185
  默认拒绝的网络权限:private-address 访问与非 loopback 明文 HTTP。embedded Worker
186
186
  与共享 daemon 会协调并执行同一份授权配置。Runtime 宿主同时获得唯一权威的
187
187
  Session 状态、有界只读诊断、字节保持的 Session 导出、严格 transcript 观测,
@@ -192,11 +192,38 @@ Session 状态、有界只读诊断、字节保持的 Session 导出、严格 tr
192
192
  OpenAI-compatible 自定义 provider 现在可在 provider 或 model 级选择 `max_tokens`
193
193
  或 `max_completion_tokens`。DeepSeek V4 Flash/Pro 使用各自的 reasoning profile,
194
194
  并正确标记为纯文本。详见 [v0.7.79 设计](docs/features/v0.7.79.md)与
195
- [发布准备清单](docs/release.md#v0779-release-preparation)。FEATURE_280 已显式改期到
196
- v0.7.81,本候选版没有把它表述为已交付。Issue 256 同样已显式改期到 v0.7.84,
197
- 本候选版没有把它表述为已交付。
198
-
199
- v0.7.77 还增加了由宿主显式配置的 Shell Execution Contract。Runtime Session
195
+ [发布清单](docs/release.md#v0779-release-preparation)。FEATURE_280 已显式改期到
196
+ v0.7.81(2026-08-04 再改期到 v0.7.86),本版本没有把它表述为已交付。Issue 256 同样已显式改期到 v0.7.84,
197
+ 本版本没有把它表述为已交付。
198
+
199
+ **v0.7.80 加固发布**:CLI 现在支持在 `~/.kodax/config.json` 中配置
200
+ `worker.configuredA2A`:嵌入式 Runtime 改为 Worker 托管,并在 Worker owner 内
201
+ 装载 configured A2A 执行平面,因此 configured outbound Agent 会以
202
+ `external:<name>` 出现在 `list_dispatchable_agents` 中并可用 `spawn_agent`
203
+ 调度。该模式会拒绝 configured MCP server 或 Extension(它们无法跨 Worker
204
+ 边界);如需保留这些能力,请使用默认 inline Runtime。Worker 托管的嵌入式
205
+ CLI 会话也会像 daemon 模式一样把 run options 收敛为
206
+ JSON 安全的 wire DTO,而不再以 `RuntimeTransportBoundaryError` 崩溃。Auto
207
+ permission 分析不再把普通搜索范围与工具 metadata 当作 unresolved,
208
+ `max_tokens` 截断的 classifier 重试改用 1024-token 预算(Issue 275)。Managed
209
+ AMA 回合现在以 500 次迭代的机械 panic fuse 约束单次不间断工具循环,每次
210
+ idle-yield 恢复都会重置计数——它只是失控循环的熔断,绝不是累计任务预算;触发
211
+ 熔断的 Runner 会抛出携带恢复 transcript 的结构化 `RunnerIterationLimitError`。
212
+ Managed-run 重复循环已被封堵,并行 review 与 delegation 指引已恢复并收紧。
213
+ FEATURE_278/279/282/283/285 已显式改期到 v0.7.85,因此 v0.7.80 仍是
214
+ debug/patch 槽位,没有把未完成特性表述为已交付。详见
215
+ [v0.7.80 发布清单](docs/release.md#v0780-release-preparation)。
216
+
217
+ **v0.7.81 Runtime 中断交付完整性发布**:以 `delivery: 'interrupt'` 提交给活动 Run
218
+ 的输入,会先获得唯一的 canonical Session 物理 entry,之后才会被标记为已交付。
219
+ `runtime.runs.get(...).interruptInputs` 与 durable `run.input.delivered` 事件均公开
220
+ 每项的 `entryId`;压缩、事件重放和 Runtime 重启后该引用仍可追溯。一次批量安全边界
221
+ 交付会保留每条 prompt 独立的 user message 与 entry 映射。Runtime-owned 持久化或
222
+ provenance 失败会 fail closed,不会发布无法验证的交付事件。FEATURE_287 仍计划于
223
+ v0.7.88;本版本是非 Feature 补丁。详见
224
+ [v0.7.81 发布清单](docs/release.md#v0781-release-preparation)。
225
+
226
+ v0.7.77 还增加了由宿主显式配置的 Shell Execution Contract。Runtime Session
200
227
  设置或单次 Run 可以选择 `pwsh`、Windows PowerShell、`cmd`、`bash`、`zsh`
201
228
  或 Git Bash 的绝对路径;KodaX 会在实际项目 cwd 中解析 shell 环境,再通过同一
202
229
  解释器执行命令。环境缓存按 contract 与 cwd 隔离,使用有界 TTL,也可由宿主显式
@@ -814,7 +841,7 @@ KodaX 是基于 npm workspaces 的 TypeScript monorepo,**源码层 4 个 works
814
841
  | Workspace 包 | 作用 | 主要依赖 |
815
842
  |----|------|---------|
816
843
  | `@kodax-ai/llm` | LLM 抽象层(16 个内置 provider alias + 自定义 provider 注册),可独立使用 | `@anthropic-ai/sdk`, `openai` |
817
- | `@kodax-ai/agent` | 通用 Agent 框架 —— Runner / runFanOut / runWithIdleYield / AgentActorController / AgentTurnScheduler + media/input artifacts + 会话管理 + tokenization + 面向自定义 loop 的可插拔 compaction primitive(不关闭 KodaX coding runtime 的始终开启策略)+ **inline 后**:session-lineage 子树 + capabilities (mcp + skills + builtin) + tracing(subpaths: `/media`、`/session-lineage`、`/capabilities/mcp`、`/capabilities/skills`、`/tracing`) | `@kodax-ai/llm`, `js-tiktoken`, `fflate`, `jimp`, `yaml` |
844
+ | `@kodax-ai/agent` | 通用 Agent 框架 —— Runner / runFanOut / runWithIdleYield / AgentActorController / AgentTurnScheduler + media/input artifacts + 会话管理 + tokenization + 面向自定义 loop 的可插拔 compaction primitive(不关闭 KodaX coding runtime 的始终开启策略)+ **inline 后**:session-lineage 子树 + capabilities (mcp + skills + builtin) + tracing(subpaths: `/media`、`/session-lineage`、`/capabilities/mcp`、`/capabilities/skills`、`/tracing`) | `@kodax-ai/llm`, `fflate`, `jimp`, `yaml` |
818
845
  | `@kodax-ai/coding` | Coding Agent:50+ 工具(含 canonical Actor 协作工具)、role prompts、agent loop、auto-continue + repo-intelligence protocol(v0.7.43 inline) | `@kodax-ai/llm`, `@kodax-ai/agent` |
819
846
  | `@kodax-ai/repl` | 完整交互式终端 UI(Ink / React、权限模式、命令系统、流式渲染) | `@kodax-ai/coding`, `ink`, `react` |
820
847
 
@@ -935,6 +962,8 @@ MCP、A2A、Extension 分别使用 `~/.kodax/integrations/` 下的一个用户
935
962
  loopback HTTP 无需这两项授权。OAuth token endpoint 仍保持更严格的
936
963
  HTTPS 或精确 loopback 规则。Worker-hosted SDK Runtime 可通过
937
964
  `worker: { configuredA2A: true }` 让 Worker owner 装载同一配置执行平面。
965
+ CLI 同样支持在 `~/.kodax/config.json` 中配置 `"worker": { "configuredA2A": true }`,
966
+ 将嵌入式运行时改为 Worker 托管并装载配置的 A2A 执行平面。
938
967
  `a2a serve` 会在监听前装载已配置的 MCP/Extension 能力并固定执行权威,同时热加载
939
968
  公开信息、鉴权和限额。Agent、Skill、Extension 工具权威、工作区、tool policy
940
969
  或任务存储变更必须显式重启服务。
@@ -16,6 +16,17 @@
16
16
  // Interactive Runtime hosting: "embedded" (this process) or "daemon".
17
17
  // "runtimeMode": "embedded",
18
18
 
19
+ // Worker-hosted embedded Runtime options. `configuredA2A` lets a
20
+ // Worker-hosted embedded Runtime load and reconcile
21
+ // ~/.kodax/integrations/a2a.json inside the Worker owner, so configured
22
+ // outbound A2A Agents appear as `external:<name>` and can be dispatched
23
+ // with spawn_agent. Default inline (non-Worker) CLI sessions already load
24
+ // the configured A2A plane automatically; this key switches the embedded
25
+ // session to a Worker-hosted Runtime and loads the plane in that mode.
26
+ // "worker": {
27
+ // "configuredA2A": true
28
+ // },
29
+
19
30
  // Native model reasoning. `effort` is the preferred explicit depth;
20
31
  // `reasoningCeiling` is the session ceiling. `reasoningMode` and `thinking`
21
32
  // remain accepted for backward compatibility.
@@ -36,7 +47,8 @@
36
47
  // "autoMode": {
37
48
  // "engine": "llm",
38
49
  // "classifierModel": "provider:model",
39
- // "timeoutMs": 30000,
50
+ // // Omit timeoutMs for the 45s first-attempt / 90s retry defaults.
51
+ // // A configured timeoutMs applies the same deadline to both attempts.
40
52
  // "speculativeWindowMs": 500
41
53
  // },
42
54
 
@@ -58,7 +70,7 @@
58
70
  // "customProviders": [
59
71
  // {
60
72
  // "name": "my-relay",
61
- // "protocol": "openai",
73
+ // "protocol": "openai",
62
74
  // "baseUrl": "https://api.example.com/v1",
63
75
  // "apiKeyEnv": "MY_RELAY_API_KEY",
64
76
  // "model": "provider/model",
@@ -0,0 +1,2 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{Ja as g,La as h,Ya as i,Za as j,a as c,db as k,ra as d,sa as e,ta as f}from"./chunk-VTFG3B7U.js";import"./chunk-HTVLCHWH.js";import"./chunk-D66EWPAX.js";import"./chunk-KHEFUT6O.js";import"./chunk-TRNAWSXP.js";import{wb as a,xb as b}from"./chunk-QMPJJCBE.js";import"./chunk-EVXIJPZ6.js";import"./chunk-E7C4DRD2.js";import"./chunk-6UENDY33.js";import"./chunk-ONUPGMER.js";export{e as bucketProviderPayloadSize,g as buildAutoRepoIntelligenceContext,f as checkPromiseSignal,b as cleanupIncompleteToolCalls,h as describeTransientProviderRetry,c as emitResilienceDebug,d as estimateProviderPayloadBytes,k as runKodaX,j as saveRequiredSessionSnapshot,i as saveSessionSnapshot,a as validateAndFixToolHistory};
@@ -0,0 +1,2 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{Ea as a,Fa as b}from"./chunk-ITY7HLSS.js";import"./chunk-BNFUIZKY.js";import"./chunk-5XCQGFGP.js";import"./chunk-WLGQ6XI2.js";import"./chunk-VTFG3B7U.js";import"./chunk-FGQZUN7C.js";import"./chunk-HTVLCHWH.js";import"./chunk-RX3X3PER.js";import"./chunk-D66EWPAX.js";import"./chunk-KHEFUT6O.js";import"./chunk-TRNAWSXP.js";import"./chunk-QMPJJCBE.js";import"./chunk-EVXIJPZ6.js";import"./chunk-E7C4DRD2.js";import"./chunk-6UENDY33.js";import"./chunk-ONUPGMER.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
@@ -1,2 +1,2 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{nc as o}from"./chunk-RQPMGRTR.js";import{h as c}from"./chunk-GEECPO2H.js";import{a as n}from"./chunk-ONUPGMER.js";import{readFile as a}from"fs/promises";var i={enabled:!0,triggerPercent:75};async function s(r){let t=c("config.json");try{let e=await f(t);if(e?.compaction)return o({...i,...e.compaction})}catch{}return o(i)}n(s,"loadCompactionConfig");async function f(r){try{let t=await a(r,"utf-8");return JSON.parse(t)}catch{return null}}n(f,"readConfigFile");export{s as a};
2
+ import{pc as o}from"./chunk-QMPJJCBE.js";import{h as c}from"./chunk-EVXIJPZ6.js";import{a as n}from"./chunk-ONUPGMER.js";import{readFile as a}from"fs/promises";var i={enabled:!0,triggerPercent:75};async function s(r){let t=c("config.json");try{let e=await f(t);if(e?.compaction)return o({...i,...e.compaction})}catch{}return o(i)}n(s,"loadCompactionConfig");async function f(r){try{let t=await a(r,"utf-8");return JSON.parse(t)}catch{return null}}n(f,"readConfigFile");export{s as a};
@@ -1,5 +1,5 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{a as n}from"./chunk-ONUPGMER.js";import{AsyncLocalStorage as $e}from"node:async_hooks";var Ue=new $e;function We(e){let t=Ue.getStore()?.credential;return t?S(e,t,new WeakMap):e}n(We,"redactScopedProviderCredential");function S(e,t,o){if(typeof e=="string")return e.split(t).join("[REDACTED_CREDENTIAL]");if(e===null||typeof e!="object")return e;let r=o.get(e);if(r!==void 0)return r;if(e instanceof Error){let s=new Error(S(e.message,t,o));return o.set(e,s),s.name=e.name,e.stack!==void 0&&(s.stack=S(e.stack,t,o)),s}if(Array.isArray(e)){let s=[];o.set(e,s);for(let l of e)s.push(S(l,t,o));return s}let i={};o.set(e,i);for(let[s,l]of Object.entries(Object.getOwnPropertyDescriptors(e))){if(!l.enumerable||!("value"in l))continue;let u=s.split(t).join("[REDACTED_CREDENTIAL]");i[u]=S(l.value,t,o)}return i}n(S,"redactCredentialValue");function X(e,t){return`${e}/${t??""}`}n(X,"capabilityCacheKey");function Ve(e,t,o){return e[X(t,o)]?.rejected??[]}n(Ve,"getRejectedEfforts");function ze(e,t,o,r,i,s){let l=X(t,o),u=e[l],m=u?.rejected.includes(r)?u.rejected:[...u?.rejected??[],r];return{...e,[l]:{rejected:m,source:i,updatedAt:s}}}n(ze,"addRejectedEffort");function He(e,t,o){if(!t)return{};let r={...e};return delete r[X(t,o)],r}n(He,"removeCacheEntry");function Ge(e){if(!e||typeof e!="object")return{};let t={};for(let[o,r]of Object.entries(e)){if(!r||typeof r!="object")continue;let i=r,s=Array.isArray(i.rejected)?i.rejected.filter(m=>typeof m=="string"):[],l=i.source==="probed"?"probed":"observed",u=typeof i.updatedAt=="string"?i.updatedAt:"";t[o]={rejected:s,source:l,updatedAt:u}}return t}n(Ge,"sanitizeCapabilityCache");import{AsyncLocalStorage as qe}from"node:async_hooks";var Je=new qe,Q=8,Y=32;function Qe(e){if(e===void 0)return;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:void 0}n(Qe,"parsePositiveInt");function Ye(){let e=L()?.workflow?.maxConcurrency,t=typeof e=="number"&&Number.isInteger(e)&&e>0?e:Qe(process.env.KODAX_WORKFLOW_MAX_CONCURRENCY)??Q;return Math.max(1,Math.min(Y,t))}n(Ye,"resolveWorkflowMaxConcurrency");function L(){return Je.getStore()}n(L,"getRunScopedConfig");var K={transport:"native-api",conversationSemantics:"full-history",mcpSupport:"none",contextFidelity:"full",toolCallingFidelity:"full",sessionSupport:"full",longRunningSupport:"full",multimodalSupport:"none",evidenceSupport:"full"},Z={...K,multimodalSupport:"image-input"},O={transport:"cli-bridge",conversationSemantics:"last-user-message",mcpSupport:"none",contextFidelity:"lossy",toolCallingFidelity:"limited",sessionSupport:"stateless",longRunningSupport:"limited",multimodalSupport:"none",evidenceSupport:"limited"},ee={...O,multimodalSupport:"image-input"};function F(e){return{transport:e.transport,conversationSemantics:e.conversationSemantics,mcpSupport:e.mcpSupport,contextFidelity:e.contextFidelity??"full",toolCallingFidelity:e.toolCallingFidelity??"full",sessionSupport:e.sessionSupport??"full",longRunningSupport:e.longRunningSupport??"full",multimodalSupport:e.multimodalSupport??"none",evidenceSupport:e.evidenceSupport??"full"}}n(F,"normalizeCapabilityProfile");import lo from"@anthropic-ai/sdk";import{parse as Gn}from"partial-json";import To from"openai";import{ClientSideConnection as Wo,PROTOCOL_VERSION as Vo,ndJsonStream as zo}from"@agentclientprotocol/sdk";var No=Object.freeze({status:"terminated"}),Bo=Object.freeze({status:"already-exited"}),Lo=Object.freeze({status:"unknown"}),Fo=String.raw`
2
+ import{a as n}from"./chunk-ONUPGMER.js";import{AsyncLocalStorage as $e}from"node:async_hooks";var Ue=new $e;function We(e){let t=Ue.getStore()?.credential;return t?S(e,t,new WeakMap):e}n(We,"redactScopedProviderCredential");function S(e,t,o){if(typeof e=="string")return e.split(t).join("[REDACTED_CREDENTIAL]");if(e===null||typeof e!="object")return e;let r=o.get(e);if(r!==void 0)return r;if(e instanceof Error){let s=new Error(S(e.message,t,o));return o.set(e,s),s.name=e.name,e.stack!==void 0&&(s.stack=S(e.stack,t,o)),s}if(Array.isArray(e)){let s=[];o.set(e,s);for(let l of e)s.push(S(l,t,o));return s}let i={};o.set(e,i);for(let[s,l]of Object.entries(Object.getOwnPropertyDescriptors(e))){if(!l.enumerable||!("value"in l))continue;let u=s.split(t).join("[REDACTED_CREDENTIAL]");i[u]=S(l.value,t,o)}return i}n(S,"redactCredentialValue");function X(e,t){return`${e}/${t??""}`}n(X,"capabilityCacheKey");function Ve(e,t,o){return e[X(t,o)]?.rejected??[]}n(Ve,"getRejectedEfforts");function ze(e,t,o,r,i,s){let l=X(t,o),u=e[l],m=u?.rejected.includes(r)?u.rejected:[...u?.rejected??[],r];return{...e,[l]:{rejected:m,source:i,updatedAt:s}}}n(ze,"addRejectedEffort");function He(e,t,o){if(!t)return{};let r={...e};return delete r[X(t,o)],r}n(He,"removeCacheEntry");function Ge(e){if(!e||typeof e!="object")return{};let t={};for(let[o,r]of Object.entries(e)){if(!r||typeof r!="object")continue;let i=r,s=Array.isArray(i.rejected)?i.rejected.filter(m=>typeof m=="string"):[],l=i.source==="probed"?"probed":"observed",u=typeof i.updatedAt=="string"?i.updatedAt:"";t[o]={rejected:s,source:l,updatedAt:u}}return t}n(Ge,"sanitizeCapabilityCache");import{AsyncLocalStorage as qe}from"node:async_hooks";var Je=new qe,Q=8,Y=32;function Qe(e){if(e===void 0)return;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:void 0}n(Qe,"parsePositiveInt");function Ye(){let e=L()?.workflow?.maxConcurrency,t=typeof e=="number"&&Number.isInteger(e)&&e>0?e:Qe(process.env.KODAX_WORKFLOW_MAX_CONCURRENCY)??Q;return Math.max(1,Math.min(Y,t))}n(Ye,"resolveWorkflowMaxConcurrency");function L(){return Je.getStore()}n(L,"getRunScopedConfig");var K={transport:"native-api",conversationSemantics:"full-history",mcpSupport:"none",contextFidelity:"full",toolCallingFidelity:"full",sessionSupport:"full",longRunningSupport:"full",multimodalSupport:"none",evidenceSupport:"full"},Z={...K,multimodalSupport:"image-input"},O={transport:"cli-bridge",conversationSemantics:"last-user-message",mcpSupport:"none",contextFidelity:"lossy",toolCallingFidelity:"limited",sessionSupport:"stateless",longRunningSupport:"limited",multimodalSupport:"none",evidenceSupport:"limited"},ee={...O,multimodalSupport:"image-input"};function F(e){return{transport:e.transport,conversationSemantics:e.conversationSemantics,mcpSupport:e.mcpSupport,contextFidelity:e.contextFidelity??"full",toolCallingFidelity:e.toolCallingFidelity??"full",sessionSupport:e.sessionSupport??"full",longRunningSupport:e.longRunningSupport??"full",multimodalSupport:e.multimodalSupport??"none",evidenceSupport:e.evidenceSupport??"full"}}n(F,"normalizeCapabilityProfile");import uo from"@anthropic-ai/sdk";import{parse as qn}from"partial-json";import xo from"openai";import{ClientSideConnection as Vo,PROTOCOL_VERSION as zo,ndJsonStream as Ho}from"@agentclientprotocol/sdk";var Bo=Object.freeze({status:"terminated"}),Lo=Object.freeze({status:"already-exited"}),Fo=Object.freeze({status:"unknown"}),jo=String.raw`
3
3
  using System;
4
4
  using System.Runtime.InteropServices;
5
5
  using System.Text;
@@ -86,4 +86,4 @@ public static class KodaXNativeProcessSnapshot {
86
86
  CloseHandle(snapshot);
87
87
  }
88
88
  }
89
- }`;import ae from"node:fs";import de from"node:os";import le from"node:path";var kt="gpt-5.4",Ct="auto-gemini-3",Pt=["gpt-5.4","gpt-5.3-codex","gpt-5.3-codex-spark"],Rt=["auto-gemini-3","gemini-3.1-pro-preview","gemini-3-flash-preview","gemini-2.5-pro","gemini-2.5-flash"];function ue(e){let t=new Set,o=[];for(let r of e){let i=r.trim();if(!i)continue;let s=i.toLowerCase();t.has(s)||(t.add(s),o.push(i))}return o}n(ue,"dedupePreserveOrder");function Et(){let e=le.join(de.homedir(),".codex","config.toml");try{return ae.readFileSync(e,"utf8").match(/^\s*model\s*=\s*"([^"]+)"/m)?.[1]?.trim()||null}catch{return null}}n(Et,"readCodexConfiguredModel");function Tt(){let e=le.join(de.homedir(),".gemini","settings.json");try{let t=JSON.parse(ae.readFileSync(e,"utf8")),o=typeof t.model=="string"?t.model.trim():"";return o||(typeof t.general?.model=="string"?t.general.model.trim():"")||null}catch{return null}}n(Tt,"readGeminiConfiguredModel");function T(){return Et()||kt}n(T,"getCodexCliDefaultModel");function x(){return Tt()||Ct}n(x,"getGeminiCliDefaultModel");function _(){return ue([T(),...Pt])}n(_,"getCodexCliKnownModels");function A(){return ue([x(),...Rt])}n(A,"getGeminiCliKnownModels");var xr=x(),Mr=A();var Lr=T(),Fr=_();import{existsSync as Dt,readFileSync as Nt}from"node:fs";import w from"node:path";import{fileURLToPath as Bt}from"node:url";var ce=["none","prompt-only","native-effort","native-budget","native-toggle","native-adaptive","unknown"],fe=["openai-responses-effort","openai-chat-effort","codex-cli-config","anthropic-output-effort","anthropic-reasoning-effort","provider-budget","provider-toggle","prompt-only","none"],pe=["anthropic-adaptive","anthropic-budget","provider-budget","provider-toggle","none"],ge=["zai-glm-5.2","zai-glm-toggle","deepseek-v4-flash-openai","deepseek-v4-pro-openai","deepseek-v4-openai","deepseek-v4-anthropic","deepseek-toggle","kimi-k3","kimi-k2.7-code","kimi-hybrid-toggle","minimax-m3","minimax-m2-always","mimo-v2.5-toggle","qwen-hybrid-thinking","openai-chat-reasoning","openai-responses-reasoning","codex-cli-effort","claude-adaptive-xhigh","claude-adaptive-max","anthropic-budget","generic-thinking-toggle","none"],me=["max_tokens","max_completion_tokens"],he=["native","image-input-native","cli-bridge","image-input-cli-bridge"],ye=["count-tokens","models-list","minimal-message","unsupported"];function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(h,"isPlainObject");function E(e,t){if(typeof e!="string"||e.length===0)throw new Error(`provider-capabilities.json: ${t} must be a non-empty string`);return e}n(E,"requireString");function M(e,t){if(e!==void 0)return E(e,t)}n(M,"optionalString");function ke(e,t){if(e!==void 0){if(typeof e!="string"||!me.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${me.join(", ")}, got ${JSON.stringify(e)}`);return e}}n(ke,"optionalMaxOutputTokensField");function R(e,t){if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e)||e<0)throw new Error(`provider-capabilities.json: ${t} must be a non-negative finite number`);return e}}n(R,"optionalNumber");function p(e,t){if(e!==void 0){if(typeof e!="boolean")throw new Error(`provider-capabilities.json: ${t} must be a boolean`);return e}}n(p,"optionalBoolean");function be(e,t){if(e!==void 0){if(!Array.isArray(e))throw new Error(`provider-capabilities.json: ${t} must be an array`);return e.map((o,r)=>E(o,`${t}[${r}]`))}}n(be,"optionalStringArray");function Mt(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o={};for(let[r,i]of Object.entries(e))o[r]=E(i,`${t}.${r}`);return o}n(Mt,"optionalStringMap");function wt(e,t){if(e!==void 0){if(typeof e!="string"||!ge.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ge.join(", ")}, got ${JSON.stringify(e)}`);return e}}n(wt,"optionalReasoningPreset");function U(e,t){if(typeof e!="string"||!ce.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ce.join(", ")}, got ${JSON.stringify(e)}`);return e}n(U,"requireReasoningCapability");function St(e,t){if(typeof e!="string"||!fe.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${fe.join(", ")}, got ${JSON.stringify(e)}`);return e}n(St,"requireEffortStrategy");function Kt(e,t){if(e!==void 0){if(typeof e!="string"||!pe.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${pe.join(", ")}, got ${JSON.stringify(e)}`);return e}}n(Kt,"optionalThinkingStrategy");function ve(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o=St(e.effortStrategy,`${t}.effortStrategy`),r=wt(e.reasoningPreset,`${t}.reasoningPreset`),i=Kt(e.thinkingStrategy,`${t}.thinkingStrategy`),s=M(e.defaultEffort,`${t}.defaultEffort`),l=Mt(e.effortAliases,`${t}.effortAliases`),u=be(e.disabledEfforts,`${t}.disabledEfforts`),m=be(e.localRejectEfforts,`${t}.localRejectEfforts`),y=p(e.allowCustomEffort,`${t}.allowCustomEffort`),b=p(e.supportsReasoningEffort,`${t}.supportsReasoningEffort`),v=p(e.supportsReasoningSummary,`${t}.supportsReasoningSummary`),k=p(e.supportsEncryptedReasoningReplay,`${t}.supportsEncryptedReasoningReplay`),C=p(e.supportsAdaptiveThinking,`${t}.supportsAdaptiveThinking`),a=p(e.supportsManualThinkingBudget,`${t}.supportsManualThinkingBudget`),P=p(e.supportsDisabledThinking,`${t}.supportsDisabledThinking`),g=p(e.requiresEffortBetaHeader,`${t}.requiresEffortBetaHeader`),d={effortStrategy:o};if(r!==void 0&&(d.reasoningPreset=r),i!==void 0&&(d.thinkingStrategy=i),s!==void 0&&(d.defaultEffort=s),l!==void 0&&(d.effortAliases=l),u!==void 0&&(d.disabledEfforts=u),m!==void 0&&(d.localRejectEfforts=m),e.supportedEfforts!==void 0){if(!Array.isArray(e.supportedEfforts))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts must be an array`);d.supportedEfforts=e.supportedEfforts.map((c,f)=>{if(!h(c))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts[${f}] must be an object`);return{value:E(c.value,`${t}.supportedEfforts[${f}].value`),...M(c.description,`${t}.supportedEfforts[${f}].description`)!==void 0?{description:M(c.description,`${t}.supportedEfforts[${f}].description`)}:{},...p(c.isDefault,`${t}.supportedEfforts[${f}].isDefault`)!==void 0?{isDefault:p(c.isDefault,`${t}.supportedEfforts[${f}].isDefault`)}:{},...p(c.isUserVisible,`${t}.supportedEfforts[${f}].isUserVisible`)!==void 0?{isUserVisible:p(c.isUserVisible,`${t}.supportedEfforts[${f}].isUserVisible`)}:{}}})}if(e.budgetByEffort!==void 0){if(!h(e.budgetByEffort))throw new Error(`provider-capabilities.json: ${t}.budgetByEffort must be an object`);let c={};for(let[f,J]of Object.entries(e.budgetByEffort))c[f]=R(J,`${t}.budgetByEffort.${f}`)??0;d.budgetByEffort=c}return y!==void 0&&(d.allowCustomEffort=y),b!==void 0&&(d.supportsReasoningEffort=b),v!==void 0&&(d.supportsReasoningSummary=v),k!==void 0&&(d.supportsEncryptedReasoningReplay=k),C!==void 0&&(d.supportsAdaptiveThinking=C),a!==void 0&&(d.supportsManualThinkingBudget=a),P!==void 0&&(d.supportsDisabledThinking=P),g!==void 0&&(d.requiresEffortBetaHeader=g),d}n(ve,"validateReasoningProfile");function Ce(e,t){let o=e.reasoningProfile,r=e.reasoningCapabilityV2;if(o!==void 0&&r!==void 0)throw new Error(`provider-capabilities.json: ${t} must not define both reasoningProfile and deprecated reasoningCapabilityV2`);return o!==void 0?ve(o,`${t}.reasoningProfile`):ve(r,`${t}.reasoningCapabilityV2`)}n(Ce,"validateReasoningProfileField");function _t(e,t){if(typeof e!="string"||!he.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${he.join(", ")}, got ${JSON.stringify(e)}`);return e}n(_t,"requireProfileName");function At(e,t){if(typeof e!="string"||!ye.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ye.join(", ")}, got ${JSON.stringify(e)}`);return e}n(At,"requireVerifyStrategy");function Xt(e,t){if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o=E(e.id,`${t}.id`),r=M(e.wireModel,`${t}.wireModel`),i=M(e.displayName,`${t}.displayName`),s=R(e.contextWindow,`${t}.contextWindow`),l=R(e.maxOutputTokens,`${t}.maxOutputTokens`),u=ke(e.maxOutputTokensField,`${t}.maxOutputTokensField`),m=R(e.thinkingBudgetCap,`${t}.thinkingBudgetCap`),y=p(e.replayReasoningContent,`${t}.replayReasoningContent`),b=p(e.strictThinkingSignature,`${t}.strictThinkingSignature`),v=R(e.streamMaxDurationMs,`${t}.streamMaxDurationMs`),k=e.reasoningCapability===void 0?void 0:U(e.reasoningCapability,`${t}.reasoningCapability`),C=Ce(e,t),a={id:o};return r!==void 0&&(a.wireModel=r),i!==void 0&&(a.displayName=i),s!==void 0&&(a.contextWindow=s),l!==void 0&&(a.maxOutputTokens=l),u!==void 0&&(a.maxOutputTokensField=u),m!==void 0&&(a.thinkingBudgetCap=m),k!==void 0&&(a.reasoningCapability=k),C!==void 0&&(a.reasoningProfile=C),y!==void 0&&(a.replayReasoningContent=y),b!==void 0&&(a.strictThinkingSignature=b),v!==void 0&&(a.streamMaxDurationMs=v),a}n(Xt,"validateModelDescriptor");function Ot(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o={};for(let[r,i]of Object.entries(e))o[r]=U(i,`${t}.${r}`);return o}n(Ot,"validateModelReasoningCapabilities");function It(e,t){if(!h(e))throw new Error(`provider-capabilities.json: providers.${t} must be an object`);let o=p(e.cliBridge,`providers.${t}.cliBridge`),r=E(e.apiKeyEnv,`providers.${t}.apiKeyEnv`),i=U(e.reasoningCapability,`providers.${t}.reasoningCapability`),s=Ce(e,`providers.${t}`),l=_t(e.capabilityProfile,`providers.${t}.capabilityProfile`),u=At(e.verifyStrategy,`providers.${t}.verifyStrategy`);if(o&&u!=="unsupported")throw new Error(`provider-capabilities.json: providers.${t} is a cliBridge entry but verifyStrategy="${u}" \u2014 must be "unsupported" (CLI binary owns credentials)`);let m=R(e.contextWindow,`providers.${t}.contextWindow`),y=R(e.maxOutputTokens,`providers.${t}.maxOutputTokens`),b=ke(e.maxOutputTokensField,`providers.${t}.maxOutputTokensField`),v=R(e.thinkingBudgetCap,`providers.${t}.thinkingBudgetCap`),k=p(e.supportsThinking,`providers.${t}.supportsThinking`),C=Ot(e.modelReasoningCapabilities,`providers.${t}.modelReasoningCapabilities`),a=M(e.model,`providers.${t}.model`);if(o&&(a!==void 0||e.models!==void 0))throw new Error(`provider-capabilities.json: providers.${t} is a cliBridge entry but defines model/models \u2014 must be omitted (filled at load time)`);if(!o&&a===void 0)throw new Error(`provider-capabilities.json: providers.${t}.model is required (only cliBridge entries may omit)`);let P;if(e.models!==void 0){if(!Array.isArray(e.models))throw new Error(`provider-capabilities.json: providers.${t}.models must be an array`);P=e.models.map((c,f)=>Xt(c,`providers.${t}.models[${f}]`));let d=new Set([...a===void 0?[]:[a],...P.map(c=>c.id)]);for(let[c,f]of P.entries())if(f.wireModel!==void 0&&!d.has(f.wireModel))throw new Error(`provider-capabilities.json: providers.${t}.models[${c}].wireModel must reference a declared model, got ${JSON.stringify(f.wireModel)}`)}let g={apiKeyEnv:r,reasoningCapability:i,capabilityProfile:l,verifyStrategy:u};return s!==void 0&&(g.reasoningProfile=s),a!==void 0&&(g.model=a),P!==void 0&&(g.models=P),m!==void 0&&(g.contextWindow=m),y!==void 0&&(g.maxOutputTokens=y),b!==void 0&&(g.maxOutputTokensField=b),v!==void 0&&(g.thinkingBudgetCap=v),k!==void 0&&(g.supportsThinking=k),C!==void 0&&(g.modelReasoningCapabilities=C),o&&(g.cliBridge=!0),g}n(It,"validateProviderEntry");function Pe(e){if(!h(e))throw new Error("provider-capabilities.json: root must be an object");if(e.version!==1)throw new Error(`provider-capabilities.json: version must be 1, got ${JSON.stringify(e.version)}`);let t=E(e.updatedAt,"updatedAt");if(!h(e.providers))throw new Error("provider-capabilities.json: providers must be an object");let o={};for(let[r,i]of Object.entries(e.providers))o[r]=It(i,r);return{version:1,updatedAt:t,providers:o}}n(Pe,"validateProviderCapabilitiesJson");var Lt=Object.freeze({native:K,"image-input-native":Z,"cli-bridge":O,"image-input-cli-bridge":ee}),B=null;function Ft(){if(process.env.KODAX_BUNDLED==="true")return w.join(w.dirname(process.execPath),"provider-capabilities.json");let e=w.dirname(Bt(import.meta.url)),t=[w.join(e,"provider-capabilities.json"),w.join(w.dirname(e),"provider-capabilities.json")];for(let o of t)if(Dt(o))return o;return t[0]}n(Ft,"resolveJsonPath");function jt(e){if(e.models){for(let t of e.models)t.reasoningProfile&&Re(t.reasoningProfile);for(let t of e.models)Object.freeze(t);Object.freeze(e.models)}return e.reasoningProfile&&Re(e.reasoningProfile),e.modelReasoningCapabilities&&Object.freeze(e.modelReasoningCapabilities),Object.freeze(e)}n(jt,"deepFreezeSnapshot");function Re(e){if(e.supportedEfforts){for(let t of e.supportedEfforts)Object.freeze(t);Object.freeze(e.supportedEfforts)}e.budgetByEffort&&Object.freeze(e.budgetByEffort),e.effortAliases&&Object.freeze(e.effortAliases),e.disabledEfforts&&Object.freeze(e.disabledEfforts),e.localRejectEfforts&&Object.freeze(e.localRejectEfforts),Object.freeze(e)}n(Re,"freezeReasoningProfile");function $t(e){if(e==="gemini-cli"){let t=x();return{model:t,models:A().filter(o=>o!==t).map(o=>({id:o}))}}if(e==="codex-cli"){let t=T();return{model:t,models:_().filter(o=>o!==t).map(o=>({id:o}))}}throw new Error(`provider-capabilities loader: unknown cliBridge provider '${e}'`)}n($t,"resolveCliBridgeModels");function Ut(e,t){let o=Lt[t.capabilityProfile];if(!o)throw new Error(`provider-capabilities loader: unknown capabilityProfile '${t.capabilityProfile}' for provider '${e}'`);if(t.cliBridge){let i=$t(e),s={model:i.model,models:i.models,apiKeyEnv:t.apiKeyEnv,reasoningCapability:t.reasoningCapability,capabilityProfile:o,verifyStrategy:t.verifyStrategy};return t.reasoningProfile!==void 0&&(s.reasoningProfile=t.reasoningProfile),t.supportsThinking!==void 0&&(s.supportsThinking=t.supportsThinking),s}let r={model:t.model,apiKeyEnv:t.apiKeyEnv,reasoningCapability:t.reasoningCapability,capabilityProfile:o,verifyStrategy:t.verifyStrategy};return t.reasoningProfile!==void 0&&(r.reasoningProfile=t.reasoningProfile),t.models!==void 0&&(r.models=t.models),t.modelReasoningCapabilities!==void 0&&(r.modelReasoningCapabilities=t.modelReasoningCapabilities),t.contextWindow!==void 0&&(r.contextWindow=t.contextWindow),t.maxOutputTokens!==void 0&&(r.maxOutputTokens=t.maxOutputTokens),t.maxOutputTokensField!==void 0&&(r.maxOutputTokensField=t.maxOutputTokensField),t.thinkingBudgetCap!==void 0&&(r.thinkingBudgetCap=t.thinkingBudgetCap),t.supportsThinking!==void 0&&(r.supportsThinking=t.supportsThinking),r}n(Ut,"buildSnapshot");function Ee(){if(B)return B;let e=Ft(),t;try{let i=Nt(e,"utf8");t=JSON.parse(i)}catch(i){let s=i instanceof Error?i.message:String(i);throw new Error(`provider-capabilities loader: failed to read ${e}: ${s}`)}let o=Pe(t),r={};for(let[i,s]of Object.entries(o.providers))r[i]=jt(Ut(i,s));return B=Object.freeze(r),B}n(Ee,"getProviderSnapshots");import ui from"@anthropic-ai/sdk";var z=Ee();var Te=process.env.KODAX_PROVIDER??"zhipu-coding";export{We as a,Ve as b,ze as c,He as d,Ge as e,Ye as f,F as g,z as h};
89
+ }`;import ae from"node:fs";import de from"node:os";import le from"node:path";var kt="gpt-5.4",Ct="auto-gemini-3",Pt=["gpt-5.4","gpt-5.3-codex","gpt-5.3-codex-spark"],Rt=["auto-gemini-3","gemini-3.1-pro-preview","gemini-3-flash-preview","gemini-2.5-pro","gemini-2.5-flash"];function ue(e){let t=new Set,o=[];for(let r of e){let i=r.trim();if(!i)continue;let s=i.toLowerCase();t.has(s)||(t.add(s),o.push(i))}return o}n(ue,"dedupePreserveOrder");function Et(){let e=le.join(de.homedir(),".codex","config.toml");try{return ae.readFileSync(e,"utf8").match(/^\s*model\s*=\s*"([^"]+)"/m)?.[1]?.trim()||null}catch{return null}}n(Et,"readCodexConfiguredModel");function Tt(){let e=le.join(de.homedir(),".gemini","settings.json");try{let t=JSON.parse(ae.readFileSync(e,"utf8")),o=typeof t.model=="string"?t.model.trim():"";return o||(typeof t.general?.model=="string"?t.general.model.trim():"")||null}catch{return null}}n(Tt,"readGeminiConfiguredModel");function T(){return Et()||kt}n(T,"getCodexCliDefaultModel");function x(){return Tt()||Ct}n(x,"getGeminiCliDefaultModel");function _(){return ue([T(),...Pt])}n(_,"getCodexCliKnownModels");function A(){return ue([x(),...Rt])}n(A,"getGeminiCliKnownModels");var Mr=x(),wr=A();var Fr=T(),jr=_();import{existsSync as Dt,readFileSync as Nt}from"node:fs";import w from"node:path";import{fileURLToPath as Bt}from"node:url";var ce=["none","prompt-only","native-effort","native-budget","native-toggle","native-adaptive","unknown"],fe=["openai-responses-effort","openai-chat-effort","codex-cli-config","anthropic-output-effort","anthropic-reasoning-effort","provider-budget","provider-toggle","prompt-only","none"],pe=["anthropic-adaptive","anthropic-budget","provider-budget","provider-toggle","none"],ge=["zai-glm-5.2","zai-glm-toggle","deepseek-v4-flash-openai","deepseek-v4-pro-openai","deepseek-v4-openai","deepseek-v4-anthropic","deepseek-toggle","kimi-k3","kimi-k2.7-code","kimi-hybrid-toggle","minimax-m3","minimax-m2-always","mimo-v2.5-toggle","qwen-hybrid-thinking","openai-chat-reasoning","openai-responses-reasoning","codex-cli-effort","claude-adaptive-xhigh","claude-adaptive-max","anthropic-budget","generic-thinking-toggle","none"],me=["max_tokens","max_completion_tokens"],he=["native","image-input-native","cli-bridge","image-input-cli-bridge"],ye=["count-tokens","models-list","minimal-message","unsupported"];function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(h,"isPlainObject");function E(e,t){if(typeof e!="string"||e.length===0)throw new Error(`provider-capabilities.json: ${t} must be a non-empty string`);return e}n(E,"requireString");function M(e,t){if(e!==void 0)return E(e,t)}n(M,"optionalString");function ke(e,t){if(e!==void 0){if(typeof e!="string"||!me.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${me.join(", ")}, got ${JSON.stringify(e)}`);return e}}n(ke,"optionalMaxOutputTokensField");function R(e,t){if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e)||e<0)throw new Error(`provider-capabilities.json: ${t} must be a non-negative finite number`);return e}}n(R,"optionalNumber");function p(e,t){if(e!==void 0){if(typeof e!="boolean")throw new Error(`provider-capabilities.json: ${t} must be a boolean`);return e}}n(p,"optionalBoolean");function be(e,t){if(e!==void 0){if(!Array.isArray(e))throw new Error(`provider-capabilities.json: ${t} must be an array`);return e.map((o,r)=>E(o,`${t}[${r}]`))}}n(be,"optionalStringArray");function Mt(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o={};for(let[r,i]of Object.entries(e))o[r]=E(i,`${t}.${r}`);return o}n(Mt,"optionalStringMap");function wt(e,t){if(e!==void 0){if(typeof e!="string"||!ge.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ge.join(", ")}, got ${JSON.stringify(e)}`);return e}}n(wt,"optionalReasoningPreset");function U(e,t){if(typeof e!="string"||!ce.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ce.join(", ")}, got ${JSON.stringify(e)}`);return e}n(U,"requireReasoningCapability");function St(e,t){if(typeof e!="string"||!fe.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${fe.join(", ")}, got ${JSON.stringify(e)}`);return e}n(St,"requireEffortStrategy");function Kt(e,t){if(e!==void 0){if(typeof e!="string"||!pe.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${pe.join(", ")}, got ${JSON.stringify(e)}`);return e}}n(Kt,"optionalThinkingStrategy");function ve(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o=St(e.effortStrategy,`${t}.effortStrategy`),r=wt(e.reasoningPreset,`${t}.reasoningPreset`),i=Kt(e.thinkingStrategy,`${t}.thinkingStrategy`),s=M(e.defaultEffort,`${t}.defaultEffort`),l=Mt(e.effortAliases,`${t}.effortAliases`),u=be(e.disabledEfforts,`${t}.disabledEfforts`),m=be(e.localRejectEfforts,`${t}.localRejectEfforts`),y=p(e.allowCustomEffort,`${t}.allowCustomEffort`),b=p(e.supportsReasoningEffort,`${t}.supportsReasoningEffort`),v=p(e.supportsReasoningSummary,`${t}.supportsReasoningSummary`),k=p(e.supportsEncryptedReasoningReplay,`${t}.supportsEncryptedReasoningReplay`),C=p(e.supportsAdaptiveThinking,`${t}.supportsAdaptiveThinking`),a=p(e.supportsManualThinkingBudget,`${t}.supportsManualThinkingBudget`),P=p(e.supportsDisabledThinking,`${t}.supportsDisabledThinking`),g=p(e.requiresEffortBetaHeader,`${t}.requiresEffortBetaHeader`),d={effortStrategy:o};if(r!==void 0&&(d.reasoningPreset=r),i!==void 0&&(d.thinkingStrategy=i),s!==void 0&&(d.defaultEffort=s),l!==void 0&&(d.effortAliases=l),u!==void 0&&(d.disabledEfforts=u),m!==void 0&&(d.localRejectEfforts=m),e.supportedEfforts!==void 0){if(!Array.isArray(e.supportedEfforts))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts must be an array`);d.supportedEfforts=e.supportedEfforts.map((c,f)=>{if(!h(c))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts[${f}] must be an object`);return{value:E(c.value,`${t}.supportedEfforts[${f}].value`),...M(c.description,`${t}.supportedEfforts[${f}].description`)!==void 0?{description:M(c.description,`${t}.supportedEfforts[${f}].description`)}:{},...p(c.isDefault,`${t}.supportedEfforts[${f}].isDefault`)!==void 0?{isDefault:p(c.isDefault,`${t}.supportedEfforts[${f}].isDefault`)}:{},...p(c.isUserVisible,`${t}.supportedEfforts[${f}].isUserVisible`)!==void 0?{isUserVisible:p(c.isUserVisible,`${t}.supportedEfforts[${f}].isUserVisible`)}:{}}})}if(e.budgetByEffort!==void 0){if(!h(e.budgetByEffort))throw new Error(`provider-capabilities.json: ${t}.budgetByEffort must be an object`);let c={};for(let[f,J]of Object.entries(e.budgetByEffort))c[f]=R(J,`${t}.budgetByEffort.${f}`)??0;d.budgetByEffort=c}return y!==void 0&&(d.allowCustomEffort=y),b!==void 0&&(d.supportsReasoningEffort=b),v!==void 0&&(d.supportsReasoningSummary=v),k!==void 0&&(d.supportsEncryptedReasoningReplay=k),C!==void 0&&(d.supportsAdaptiveThinking=C),a!==void 0&&(d.supportsManualThinkingBudget=a),P!==void 0&&(d.supportsDisabledThinking=P),g!==void 0&&(d.requiresEffortBetaHeader=g),d}n(ve,"validateReasoningProfile");function Ce(e,t){let o=e.reasoningProfile,r=e.reasoningCapabilityV2;if(o!==void 0&&r!==void 0)throw new Error(`provider-capabilities.json: ${t} must not define both reasoningProfile and deprecated reasoningCapabilityV2`);return o!==void 0?ve(o,`${t}.reasoningProfile`):ve(r,`${t}.reasoningCapabilityV2`)}n(Ce,"validateReasoningProfileField");function _t(e,t){if(typeof e!="string"||!he.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${he.join(", ")}, got ${JSON.stringify(e)}`);return e}n(_t,"requireProfileName");function At(e,t){if(typeof e!="string"||!ye.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ye.join(", ")}, got ${JSON.stringify(e)}`);return e}n(At,"requireVerifyStrategy");function Xt(e,t){if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o=E(e.id,`${t}.id`),r=M(e.wireModel,`${t}.wireModel`),i=M(e.displayName,`${t}.displayName`),s=R(e.contextWindow,`${t}.contextWindow`),l=R(e.maxOutputTokens,`${t}.maxOutputTokens`),u=ke(e.maxOutputTokensField,`${t}.maxOutputTokensField`),m=R(e.thinkingBudgetCap,`${t}.thinkingBudgetCap`),y=p(e.replayReasoningContent,`${t}.replayReasoningContent`),b=p(e.strictThinkingSignature,`${t}.strictThinkingSignature`),v=R(e.streamMaxDurationMs,`${t}.streamMaxDurationMs`),k=e.reasoningCapability===void 0?void 0:U(e.reasoningCapability,`${t}.reasoningCapability`),C=Ce(e,t),a={id:o};return r!==void 0&&(a.wireModel=r),i!==void 0&&(a.displayName=i),s!==void 0&&(a.contextWindow=s),l!==void 0&&(a.maxOutputTokens=l),u!==void 0&&(a.maxOutputTokensField=u),m!==void 0&&(a.thinkingBudgetCap=m),k!==void 0&&(a.reasoningCapability=k),C!==void 0&&(a.reasoningProfile=C),y!==void 0&&(a.replayReasoningContent=y),b!==void 0&&(a.strictThinkingSignature=b),v!==void 0&&(a.streamMaxDurationMs=v),a}n(Xt,"validateModelDescriptor");function Ot(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o={};for(let[r,i]of Object.entries(e))o[r]=U(i,`${t}.${r}`);return o}n(Ot,"validateModelReasoningCapabilities");function It(e,t){if(!h(e))throw new Error(`provider-capabilities.json: providers.${t} must be an object`);let o=p(e.cliBridge,`providers.${t}.cliBridge`),r=E(e.apiKeyEnv,`providers.${t}.apiKeyEnv`),i=U(e.reasoningCapability,`providers.${t}.reasoningCapability`),s=Ce(e,`providers.${t}`),l=_t(e.capabilityProfile,`providers.${t}.capabilityProfile`),u=At(e.verifyStrategy,`providers.${t}.verifyStrategy`);if(o&&u!=="unsupported")throw new Error(`provider-capabilities.json: providers.${t} is a cliBridge entry but verifyStrategy="${u}" \u2014 must be "unsupported" (CLI binary owns credentials)`);let m=R(e.contextWindow,`providers.${t}.contextWindow`),y=R(e.maxOutputTokens,`providers.${t}.maxOutputTokens`),b=ke(e.maxOutputTokensField,`providers.${t}.maxOutputTokensField`),v=R(e.thinkingBudgetCap,`providers.${t}.thinkingBudgetCap`),k=p(e.supportsThinking,`providers.${t}.supportsThinking`),C=Ot(e.modelReasoningCapabilities,`providers.${t}.modelReasoningCapabilities`),a=M(e.model,`providers.${t}.model`);if(o&&(a!==void 0||e.models!==void 0))throw new Error(`provider-capabilities.json: providers.${t} is a cliBridge entry but defines model/models \u2014 must be omitted (filled at load time)`);if(!o&&a===void 0)throw new Error(`provider-capabilities.json: providers.${t}.model is required (only cliBridge entries may omit)`);let P;if(e.models!==void 0){if(!Array.isArray(e.models))throw new Error(`provider-capabilities.json: providers.${t}.models must be an array`);P=e.models.map((c,f)=>Xt(c,`providers.${t}.models[${f}]`));let d=new Set([...a===void 0?[]:[a],...P.map(c=>c.id)]);for(let[c,f]of P.entries())if(f.wireModel!==void 0&&!d.has(f.wireModel))throw new Error(`provider-capabilities.json: providers.${t}.models[${c}].wireModel must reference a declared model, got ${JSON.stringify(f.wireModel)}`)}let g={apiKeyEnv:r,reasoningCapability:i,capabilityProfile:l,verifyStrategy:u};return s!==void 0&&(g.reasoningProfile=s),a!==void 0&&(g.model=a),P!==void 0&&(g.models=P),m!==void 0&&(g.contextWindow=m),y!==void 0&&(g.maxOutputTokens=y),b!==void 0&&(g.maxOutputTokensField=b),v!==void 0&&(g.thinkingBudgetCap=v),k!==void 0&&(g.supportsThinking=k),C!==void 0&&(g.modelReasoningCapabilities=C),o&&(g.cliBridge=!0),g}n(It,"validateProviderEntry");function Pe(e){if(!h(e))throw new Error("provider-capabilities.json: root must be an object");if(e.version!==1)throw new Error(`provider-capabilities.json: version must be 1, got ${JSON.stringify(e.version)}`);let t=E(e.updatedAt,"updatedAt");if(!h(e.providers))throw new Error("provider-capabilities.json: providers must be an object");let o={};for(let[r,i]of Object.entries(e.providers))o[r]=It(i,r);return{version:1,updatedAt:t,providers:o}}n(Pe,"validateProviderCapabilitiesJson");var Lt=Object.freeze({native:K,"image-input-native":Z,"cli-bridge":O,"image-input-cli-bridge":ee}),B=null;function Ft(){if(process.env.KODAX_BUNDLED==="true")return w.join(w.dirname(process.execPath),"provider-capabilities.json");let e=w.dirname(Bt(import.meta.url)),t=[w.join(e,"provider-capabilities.json"),w.join(w.dirname(e),"provider-capabilities.json")];for(let o of t)if(Dt(o))return o;return t[0]}n(Ft,"resolveJsonPath");function jt(e){if(e.models){for(let t of e.models)t.reasoningProfile&&Re(t.reasoningProfile);for(let t of e.models)Object.freeze(t);Object.freeze(e.models)}return e.reasoningProfile&&Re(e.reasoningProfile),e.modelReasoningCapabilities&&Object.freeze(e.modelReasoningCapabilities),Object.freeze(e)}n(jt,"deepFreezeSnapshot");function Re(e){if(e.supportedEfforts){for(let t of e.supportedEfforts)Object.freeze(t);Object.freeze(e.supportedEfforts)}e.budgetByEffort&&Object.freeze(e.budgetByEffort),e.effortAliases&&Object.freeze(e.effortAliases),e.disabledEfforts&&Object.freeze(e.disabledEfforts),e.localRejectEfforts&&Object.freeze(e.localRejectEfforts),Object.freeze(e)}n(Re,"freezeReasoningProfile");function $t(e){if(e==="gemini-cli"){let t=x();return{model:t,models:A().filter(o=>o!==t).map(o=>({id:o}))}}if(e==="codex-cli"){let t=T();return{model:t,models:_().filter(o=>o!==t).map(o=>({id:o}))}}throw new Error(`provider-capabilities loader: unknown cliBridge provider '${e}'`)}n($t,"resolveCliBridgeModels");function Ut(e,t){let o=Lt[t.capabilityProfile];if(!o)throw new Error(`provider-capabilities loader: unknown capabilityProfile '${t.capabilityProfile}' for provider '${e}'`);if(t.cliBridge){let i=$t(e),s={model:i.model,models:i.models,apiKeyEnv:t.apiKeyEnv,reasoningCapability:t.reasoningCapability,capabilityProfile:o,verifyStrategy:t.verifyStrategy};return t.reasoningProfile!==void 0&&(s.reasoningProfile=t.reasoningProfile),t.supportsThinking!==void 0&&(s.supportsThinking=t.supportsThinking),s}let r={model:t.model,apiKeyEnv:t.apiKeyEnv,reasoningCapability:t.reasoningCapability,capabilityProfile:o,verifyStrategy:t.verifyStrategy};return t.reasoningProfile!==void 0&&(r.reasoningProfile=t.reasoningProfile),t.models!==void 0&&(r.models=t.models),t.modelReasoningCapabilities!==void 0&&(r.modelReasoningCapabilities=t.modelReasoningCapabilities),t.contextWindow!==void 0&&(r.contextWindow=t.contextWindow),t.maxOutputTokens!==void 0&&(r.maxOutputTokens=t.maxOutputTokens),t.maxOutputTokensField!==void 0&&(r.maxOutputTokensField=t.maxOutputTokensField),t.thinkingBudgetCap!==void 0&&(r.thinkingBudgetCap=t.thinkingBudgetCap),t.supportsThinking!==void 0&&(r.supportsThinking=t.supportsThinking),r}n(Ut,"buildSnapshot");function Ee(){if(B)return B;let e=Ft(),t;try{let i=Nt(e,"utf8");t=JSON.parse(i)}catch(i){let s=i instanceof Error?i.message:String(i);throw new Error(`provider-capabilities loader: failed to read ${e}: ${s}`)}let o=Pe(t),r={};for(let[i,s]of Object.entries(o.providers))r[i]=jt(Ut(i,s));return B=Object.freeze(r),B}n(Ee,"getProviderSnapshots");import ci from"@anthropic-ai/sdk";var z=Ee();var Te=process.env.KODAX_PROVIDER??"zhipu-coding";export{We as a,Ve as b,ze as c,He as d,Ge as e,Ye as f,F as g,z as h};