@kodax-ai/kodax 0.7.79 → 0.7.80
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.
- package/CHANGELOG.md +93 -12
- package/README.md +31 -8
- package/README_CN.md +25 -5
- package/config-templates/config.example.jsonc +14 -2
- package/dist/chunks/agent-5PHGNFW3.js +2 -0
- package/dist/chunks/argument-completer-FXRZFMTC.js +2 -0
- package/dist/chunks/{chunk-H5LLM7DB.js → chunk-6UENDY33.js} +2 -2
- package/dist/chunks/{chunk-QCZLCLFL.js → chunk-BWX4YZX3.js} +2 -2
- package/dist/chunks/{chunk-EDZ4QILG.js → chunk-CDCCTM5I.js} +17 -5
- package/dist/chunks/chunk-CEB5FDND.js +810 -0
- package/dist/chunks/{chunk-M4N2JZTZ.js → chunk-E7C4DRD2.js} +1 -1
- package/dist/chunks/{chunk-GEECPO2H.js → chunk-EVXIJPZ6.js} +66 -66
- package/dist/chunks/chunk-FQ7NVMSU.js +319 -0
- package/dist/chunks/chunk-GC4JBMBS.js +385 -0
- package/dist/chunks/{chunk-67THZRM6.js → chunk-HTVLCHWH.js} +1 -1
- package/dist/chunks/chunk-IHPH3444.js +655 -0
- package/dist/chunks/{chunk-OWQT3FTE.js → chunk-KHEFUT6O.js} +1 -1
- package/dist/chunks/{chunk-BBOVVDQJ.js → chunk-PMKAG4SZ.js} +1 -1
- package/dist/chunks/chunk-RPF5RGWZ.js +479 -0
- package/dist/chunks/{chunk-CXHEZY5G.js → chunk-RXXKDR6Y.js} +1 -1
- package/dist/chunks/{chunk-6GVQDQTQ.js → chunk-T5U4OP2N.js} +1 -1
- package/dist/chunks/{chunk-SG6P4SZS.js → chunk-TRNAWSXP.js} +21 -21
- package/dist/chunks/{chunk-CR2IF7VF.js → chunk-UZSHBQER.js} +5 -5
- package/dist/chunks/{chunk-B6UY3VHV.js → chunk-VECRQTSD.js} +44 -44
- package/dist/chunks/compaction-config-6J6XCBJS.js +2 -0
- package/dist/chunks/{construction-bootstrap-K3ZGEN5N.js → construction-bootstrap-KPCAE3VN.js} +1 -1
- package/dist/chunks/dist-RWEVZOFK.js +2 -0
- package/dist/chunks/{dist-JMO47GJV.js → dist-WWL2DNIJ.js} +1 -1
- package/dist/chunks/host-OGS2R5J4.js +2 -0
- package/dist/chunks/run-manager-2YMM3BOT.js +2 -0
- package/dist/chunks/{utils-6LEKJPQN.js → utils-2YHRUZYC.js} +1 -1
- package/dist/index.d.ts +13 -12
- package/dist/index.js +4 -4
- package/dist/kodax_bootstrap.js +1 -1
- package/dist/kodax_cli.js +1301 -1285
- package/dist/kodax_resume.js +63 -63
- package/dist/runtime-worker.js +1205 -1189
- package/dist/sandbox-workspace-session.js +43 -43
- package/dist/sdk-a2a.d.ts +8 -8
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.d.ts +15 -17
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +171 -20
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +19 -200
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +11 -8
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.d.ts +4 -4
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +44 -44
- package/dist/types-chunks/{bash-prefix-extractor.d-CNSidpmv.d.ts → bash-prefix-extractor.d-DStqKIlu.d.ts} +4 -2
- package/dist/types-chunks/{capsule.d-B3q98pLQ.d.ts → capsule.d-BuFJaYxA.d.ts} +6 -15
- package/dist/types-chunks/{controller.d-RGV7Pjv9.d.ts → controller.d-C2aHqzHj.d.ts} +18 -10
- package/dist/types-chunks/{guardrail.d-1NLSFTyN.d.ts → guardrail.d-DM-OK0m3.d.ts} +74 -77
- package/dist/types-chunks/{history-retrieval.d-BAegI14A.d.ts → history-retrieval.d-DImTKgO6.d.ts} +1 -1
- package/dist/types-chunks/{public-api.d-BpJhHoa7.d.ts → public-api.d-CewTvUKV.d.ts} +5 -17
- package/dist/types-chunks/{repl.d-CZ12Ow3X.d.ts → repl.d-DvXQtgr7.d.ts} +5 -5
- package/dist/types-chunks/{run-manager.d-CX3AUocA.d.ts → run-manager.d-C6ahvZqK.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-B3cfJKqF.d.ts → sdk-session-C59RUrri.d.ts} +2 -2
- package/dist/types-chunks/shell-command-sets.d-Dp4UvPLL.d.ts +297 -0
- package/dist/types-chunks/{types.d-BZ9oXvTV.d.ts → types.d-BzpPDBPV.d.ts} +1 -1
- package/dist/types-chunks/{types.d-C0_rn--1.d.ts → types.d-yuJzE82x.d.ts} +2 -2
- package/dist/types-chunks/{utils.d-CGpHavsU.d.ts → utils.d-BpACJmzt.d.ts} +15 -5
- package/docs/SDK_EMBEDDER_GUIDE.md +36 -32
- package/package.json +3 -3
- package/dist/chunks/agent-V4AC5JZD.js +0 -2
- package/dist/chunks/argument-completer-ZPC2MLES.js +0 -2
- package/dist/chunks/chunk-KLWP7POA.js +0 -467
- package/dist/chunks/chunk-Q4M7DJOD.js +0 -319
- package/dist/chunks/chunk-RQPMGRTR.js +0 -810
- package/dist/chunks/chunk-TSTVAU5E.js +0 -386
- package/dist/chunks/chunk-ZCZZUE5E.js +0 -662
- package/dist/chunks/compaction-config-AEUGVROL.js +0 -2
- package/dist/chunks/dist-GFJFRPAV.js +0 -2
- package/dist/chunks/host-23K2Q6RZ.js +0 -2
- package/dist/chunks/run-manager-PGIR6ITA.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,23 +6,92 @@ 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.80] - 2026-08-04
|
|
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
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
- Runtime SDK capability negotiation now advertises `managedRunDurability` v1,
|
|
21
|
+
allowing embedders to reject or safely replace daemons that do not guarantee
|
|
22
|
+
canonical managed-Run boundaries.
|
|
23
|
+
- The CLI honors `worker.configuredA2A` in `~/.kodax/config.json`: the embedded
|
|
24
|
+
Runtime is created Worker-hosted with the configured A2A plane installed
|
|
25
|
+
inside the Worker owner, so configured outbound A2A Agents appear as
|
|
26
|
+
`external:<name>` in `list_dispatchable_agents` and can be dispatched with
|
|
27
|
+
`spawn_agent`. The function-valued inline `externalAgents` plane is skipped
|
|
28
|
+
in that mode because it cannot cross the Worker boundary, and the mode
|
|
29
|
+
rejects configured MCP servers or Extensions. Config templates document the
|
|
30
|
+
`worker` block.
|
|
31
|
+
- `@kodax-ai/agent` now exports the structured `RunnerIterationLimitError` and
|
|
32
|
+
`isRunnerIterationLimitError` guard. A Runner that exhausts its mechanical
|
|
33
|
+
tool-loop fuse fails with `code: 'RUNNER_ITERATION_LIMIT'` and carries the
|
|
34
|
+
last legal transcript, readable through `readRunnerRecoveryTranscript`, so
|
|
35
|
+
callers can distinguish a runaway tool loop from other failures.
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- Public `countTokens` / `estimateTokens` keep their existing signatures but
|
|
40
|
+
now use a provider-neutral O(n) multilingual and dense-data estimate instead
|
|
41
|
+
of synchronous `cl100k_base` BPE tokenization.
|
|
42
|
+
- Managed AMA turns now bound one uninterrupted `Runner.run` tool loop by a
|
|
43
|
+
500-iteration mechanical panic fuse instead of being unbounded. Each
|
|
44
|
+
idle-yield resume starts a fresh Runner invocation and resets the counter, so
|
|
45
|
+
the fuse is a runaway-loop breaker, never a cumulative task budget; the
|
|
46
|
+
managed-task idle-yield lifecycle itself remains unbounded. Iteration events
|
|
47
|
+
report the real fuse and a fuse exit keeps the recovery transcript and
|
|
48
|
+
checkpoint available for diagnosis or resume.
|
|
19
49
|
|
|
20
50
|
### Fixed
|
|
21
51
|
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
52
|
+
- Direct `@kodax-ai/coding` SDK guardrails now use the same deterministic
|
|
53
|
+
filesystem, shell, and Git permission analyzer as the REPL, so ordinary
|
|
54
|
+
project `read`/`grep`/`glob` and read-only shell calls no longer depend on
|
|
55
|
+
host-specific analyzer wiring. Classifier truncation recognizes
|
|
56
|
+
OpenAI-compatible `length`, with default attempt deadlines of 45s and 90s;
|
|
57
|
+
an explicit `timeoutMs` remains authoritative for both attempts.
|
|
58
|
+
- Oversized tool output is byte/line-spilled before token estimation, avoiding
|
|
59
|
+
main-loop stalls on long Base64/ASCII output while preserving a bounded
|
|
60
|
+
preview and complete artifact.
|
|
61
|
+
- Runtime-owned managed Runs durably save the initial accepted prompt, each
|
|
62
|
+
completed turn, and each queued prompt before publishing the corresponding
|
|
63
|
+
lifecycle event. Required persistence failures fail closed, and queued turns
|
|
64
|
+
are not started until their user input is canonical.
|
|
65
|
+
|
|
66
|
+
- Auto permission analysis no longer treats ordinary grep/glob/directory and
|
|
67
|
+
Git metadata/content reads as unresolved, and no longer invents an unknown
|
|
68
|
+
effect for tools with trusted side-effect metadata — GET-only `web_fetch` is
|
|
69
|
+
reclassified as a network read. A classifier response truncated by
|
|
70
|
+
`max_tokens` is retried once with a 1024-token output budget instead of
|
|
71
|
+
repeating the same impossible 256-token attempt (Issue 275).
|
|
72
|
+
- Managed runs can no longer spin in repetition loops across idle-yield child
|
|
73
|
+
completions: bounded managed-run/runtime context projections, stall
|
|
74
|
+
detection, verifier-recorder and LLM-judge convergence, and worker-role
|
|
75
|
+
prompt guidance keep repeated convergence stable while parallel review is
|
|
76
|
+
restored.
|
|
77
|
+
- `quality_strategy` Actor-Turn evidence refs stay inside the executing
|
|
78
|
+
Actor's controlled subtree: same-parent sibling provenance is rejected as
|
|
79
|
+
outside the visibility boundary, while unknown actors and stale exact turn
|
|
80
|
+
refs drop the optional telemetry without blocking the underlying legal Actor
|
|
81
|
+
operation.
|
|
82
|
+
- Parallel delegation guidance is tightened so independent work lanes fan out
|
|
83
|
+
through ordinary Actor operations while genuinely indivisible or strongly
|
|
84
|
+
serial work stays solo, without re-opening the managed-run repetition
|
|
85
|
+
regression.
|
|
86
|
+
- CLI sessions on a Worker-hosted embedded Runtime now reduce run options to
|
|
87
|
+
the JSON-safe wire DTO before crossing the Worker transport boundary: host
|
|
88
|
+
callbacks (`events.beforeToolExecute`, `onTextDelta`), session storage,
|
|
89
|
+
memory identity, and the host-owned extension runtime are stripped, matching
|
|
90
|
+
daemon-mode sanitization instead of crashing with
|
|
91
|
+
`RuntimeTransportBoundaryError`. Daemon mode itself keeps its loud
|
|
92
|
+
host-binding rejection — a configured `events.beforeToolExecute` or
|
|
93
|
+
`extensionRuntime` still errors instead of being silently disabled; only
|
|
94
|
+
Worker-hosted embedded Runtimes strip them.
|
|
26
95
|
|
|
27
96
|
## [0.7.79] - 2026-08-03
|
|
28
97
|
|
|
@@ -46,6 +115,14 @@ All notable changes to this project will be documented in this file.
|
|
|
46
115
|
reports unresolved legacy ambiguity, and supplies revision-fenced
|
|
47
116
|
fork/rewind boundaries while leaving raw transcript audit data unchanged.
|
|
48
117
|
Standalone session consumers receive the same mutation boundary contract.
|
|
118
|
+
- User-level `sandbox.envPass` now accepts an exact list of host environment
|
|
119
|
+
variable names to expose to model-issued command targets, including ASRT and
|
|
120
|
+
the ordinary fallback path. The default remains empty; configuration stores
|
|
121
|
+
names rather than values, project configuration cannot broaden the list, and
|
|
122
|
+
execution-control variables remain blocked. Commands can read and emit any
|
|
123
|
+
variable that the user explicitly allows. SDK callers can supply the same
|
|
124
|
+
Run-scoped setting through `KodaXOptions.sandbox`, including Worker and daemon
|
|
125
|
+
transports, without mutating process-global configuration.
|
|
49
126
|
|
|
50
127
|
### Changed
|
|
51
128
|
|
|
@@ -276,6 +353,10 @@ All notable changes to this project will be documented in this file.
|
|
|
276
353
|
frames obey the request-ID fence and cannot acknowledge unfinished requests.
|
|
277
354
|
Daemon startup cleanup also surfaces an indeterminate process-tree outcome
|
|
278
355
|
instead of treating an already-exited root as proof of descendant cleanup.
|
|
356
|
+
- A2A integration watching now ignores unchanged content revisions, preventing
|
|
357
|
+
repeated false `hot-reloaded` notices and their unnecessary root-TUI render.
|
|
358
|
+
Explicit manual reload still repairs missing registrations and retries
|
|
359
|
+
transient discovery failures without requiring a file rewrite.
|
|
279
360
|
|
|
280
361
|
### Performance
|
|
281
362
|
|
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
|
|
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,11 +574,32 @@ 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
|
|
578
|
-
FEATURE_280 was explicitly rescheduled to v0.7.81
|
|
579
|
-
shipped by this
|
|
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
|
|
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).
|
|
582
603
|
|
|
583
604
|
The v0.7.77 release also adds an opt-in, host-configurable Shell Execution Contract.
|
|
584
605
|
Runtime Session settings or an individual Run can select `pwsh`, Windows
|
|
@@ -730,7 +751,7 @@ Source-side workspace package names (`@kodax-ai/*`). npm consumers install the s
|
|
|
730
751
|
| Workspace package | Purpose | Key Dependencies |
|
|
731
752
|
|---------|---------|------------------|
|
|
732
753
|
| `@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,
|
|
754
|
+
| `@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
755
|
| `@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
756
|
| `@kodax-ai/repl` | Complete interactive terminal UI (Ink/React, permission modes, commands, streaming) | @kodax-ai/coding, ink, react |
|
|
736
757
|
|
|
@@ -878,7 +899,9 @@ independent, persisted, default-deny permissions (`--allow-private` and
|
|
|
878
899
|
`--allow-insecure-http`); exact loopback HTTP remains available without either.
|
|
879
900
|
OAuth token endpoints retain their stricter HTTPS-or-exact-loopback rule.
|
|
880
901
|
Worker-hosted SDK Runtimes can load this same configured plane inside the Worker
|
|
881
|
-
owner with `worker: { configuredA2A: true }`.
|
|
902
|
+
owner with `worker: { configuredA2A: true }`. The CLI honors the same opt-in
|
|
903
|
+
from `~/.kodax/config.json` (`"worker": { "configuredA2A": true }`) by creating
|
|
904
|
+
a Worker-hosted embedded Runtime that loads the configured A2A plane. `a2a serve` loads
|
|
882
905
|
its configured MCP/Extension capability surface before listening and pins that
|
|
883
906
|
execution authority; it hot-reloads publication, authentication, and limits.
|
|
884
907
|
|
|
@@ -1425,7 +1448,7 @@ const policy = new DefaultSummaryCompaction({ thresholdRatio: 0.8, keepRecent: 1
|
|
|
1425
1448
|
loops. It does not replace or disable KodaX's always-on coding-runtime policy
|
|
1426
1449
|
described under FEATURE_272 above.
|
|
1427
1450
|
|
|
1428
|
-
**Key Features**: `Runner` + per-step lifecycle · `runFanOut` (bounded-concurrency + abort + progress events) · `runWithIdleYield` (chat-while-waiting) · `AgentActorController` / `AgentTurnScheduler` · session-id generation ·
|
|
1451
|
+
**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
1452
|
|
|
1430
1453
|
### `@kodax-ai/kodax/skills` — Skills System
|
|
1431
1454
|
|
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
|
|
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,9 +192,27 @@ 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
|
-
[
|
|
196
|
-
v0.7.81
|
|
197
|
-
|
|
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)。
|
|
198
216
|
|
|
199
217
|
v0.7.77 还增加了由宿主显式配置的 Shell Execution Contract。Runtime Session
|
|
200
218
|
设置或单次 Run 可以选择 `pwsh`、Windows PowerShell、`cmd`、`bash`、`zsh`
|
|
@@ -814,7 +832,7 @@ KodaX 是基于 npm workspaces 的 TypeScript monorepo,**源码层 4 个 works
|
|
|
814
832
|
| Workspace 包 | 作用 | 主要依赖 |
|
|
815
833
|
|----|------|---------|
|
|
816
834
|
| `@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`, `
|
|
835
|
+
| `@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
836
|
| `@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
837
|
| `@kodax-ai/repl` | 完整交互式终端 UI(Ink / React、权限模式、命令系统、流式渲染) | `@kodax-ai/coding`, `ink`, `react` |
|
|
820
838
|
|
|
@@ -935,6 +953,8 @@ MCP、A2A、Extension 分别使用 `~/.kodax/integrations/` 下的一个用户
|
|
|
935
953
|
loopback HTTP 无需这两项授权。OAuth token endpoint 仍保持更严格的
|
|
936
954
|
HTTPS 或精确 loopback 规则。Worker-hosted SDK Runtime 可通过
|
|
937
955
|
`worker: { configuredA2A: true }` 让 Worker owner 装载同一配置执行平面。
|
|
956
|
+
CLI 同样支持在 `~/.kodax/config.json` 中配置 `"worker": { "configuredA2A": true }`,
|
|
957
|
+
将嵌入式运行时改为 Worker 托管并装载配置的 A2A 执行平面。
|
|
938
958
|
`a2a serve` 会在监听前装载已配置的 MCP/Extension 能力并固定执行权威,同时热加载
|
|
939
959
|
公开信息、鉴权和限额。Agent、Skill、Extension 工具权威、工作区、tool policy
|
|
940
960
|
或任务存储变更必须显式重启服务。
|
|
@@ -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
|
-
//
|
|
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-VECRQTSD.js";import"./chunk-HTVLCHWH.js";import"./chunk-GC4JBMBS.js";import"./chunk-KHEFUT6O.js";import"./chunk-TRNAWSXP.js";import{wb as a,xb as b}from"./chunk-CEB5FDND.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-IHPH3444.js";import"./chunk-CDCCTM5I.js";import"./chunk-PMKAG4SZ.js";import"./chunk-RPF5RGWZ.js";import"./chunk-VECRQTSD.js";import"./chunk-RXXKDR6Y.js";import"./chunk-HTVLCHWH.js";import"./chunk-BWX4YZX3.js";import"./chunk-GC4JBMBS.js";import"./chunk-KHEFUT6O.js";import"./chunk-TRNAWSXP.js";import"./chunk-CEB5FDND.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,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
|
|
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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{$d as
|
|
2
|
+
import{$d as Ye,Xd as ge,Yd as Ge,_d as Xe,ae as Ze,he as Qe,tb as Ke,ub as Le,xb as ze,yb as Je}from"./chunk-GC4JBMBS.js";import{Q as Ne}from"./chunk-TRNAWSXP.js";import{Ad as Z,Ed as me,Kd as pe,Ld as B,Md as we,Nd as Ue,Ud as Ve,Vd as Be,Wd as He,ud as re,xd as De,yd as je}from"./chunk-CEB5FDND.js";import{d as fe}from"./chunk-EVXIJPZ6.js";import{a as i}from"./chunk-ONUPGMER.js";import{basename as kr,dirname as vr}from"node:path";import{execFile as Qt}from"node:child_process";import oe from"node:path";import{promisify as en}from"node:util";var tn=en(Qt),nn=1e4,at=2,et=new Set(["write","edit","multi_edit","insert_after_anchor"]),tt=new Set(["read"]);function rn(e,t){if(t.includes("*"))return e;if(e.includes("*"))return t;let n=new Set(t);return e.filter(r=>n.has(r))}i(rn,"intersectWorkflowToolCeilings");var on=/^\s*(?:let me|i will|i'll|i am going to)\b[\s\S]{0,120}\b(?:start|create|implement|write|build|plan)\b|^\s*(?:我将|让我|接下来)[\s\S]{0,80}(?:开始|创建|编写|实现|制定)/i;function an(e){if(e?.timeoutMs!==void 0){if(!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0)throw new Error("workflow wait timeoutMs must be a positive number");return Math.floor(e.timeoutMs)}}i(an,"normalizeWaitTimeoutMs");function he(e){return e?.requiresMutation===!0||(e?.requiredChangedPaths?.length??0)>0}i(he,"hasVerificationWork");function H(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").trim()}i(H,"normalizeWorkspacePath");function ye(e,t){let n=t.gitRoot?oe.resolve(t.gitRoot):void 0,r=oe.isAbsolute(e)&&n?oe.relative(n,oe.resolve(e)):e;return H(r)}i(ye,"normalizeRequiredPath");function sn(e){let t=(e.readOnly??!1)===!1?{enforcement:"warn",requiresMutation:!0,rejectPreparatoryFinalText:!0}:void 0;if(e.verification!==void 0){let n={...t??{},...e.verification,enforcement:e.verification.enforcement??"hard"},r=e.verification.requiredChangedPaths;return{verification:{...n,...r!==void 0&&r.length>0&&n.requiresMutation===void 0?{requiresMutation:!0}:{}}}}return{verification:t}}i(sn,"resolveVerificationForInput");function cn(e,t){if(t===!0&&e.readOnly===!1)throw new Error(`workflow manifest readOnly=true cannot spawn write-capable child "${e.name}"; set the workflow manifest readOnly=false or use child readOnly:true`);let n=e.readOnly??t??!1;return e.readOnly===n?e:{...e,readOnly:n}}i(cn,"resolveSpawnAgentInput");function st(e){let t=e.trim();return t.length>0&&on.test(t)}i(st,"isPreparatoryOnlyText");function dn(e,t){let n=e.trim(),r=t?.trim();return r&&(n.length===0||st(n))?r:e}i(dn,"selectWorkflowFinalText");async function ie(e,t){return(await tn("git",[...e],{cwd:t,timeout:nn,windowsHide:!0,maxBuffer:4194304})).stdout.toString()}i(ie,"runGit");async function un(e){let t=e.gitRoot??e.executionCwd??process.cwd(),n=(await ie(["rev-parse","--show-toplevel"],t)).trim(),r=await Promise.all([ie(["diff","--name-only","--"],n),ie(["diff","--cached","--name-only","--"],n),ie(["ls-files","--others","--exclude-standard"],n)]);return[...new Set(r.flatMap(a=>a.split(/\r?\n/)).map(H).filter(a=>a.length>0))]}i(un,"listGitChangedFiles");async function ke(e,t){try{return{paths:(await t(e)).map(H).filter(r=>r.length>0)}}catch(n){return{paths:[],error:n instanceof Error?n.message:String(n)}}}i(ke,"captureChangedPaths");function ln(){return{toolNameById:new Map,toolPathById:new Map,succeededToolCalls:[],succeededPaths:[],readPathById:new Map,succeededReadPaths:[]}}i(ln,"createMutationRecorder");function nt(e){if(e)for(let t of["path","file_path","target_path"]){let n=e[t];if(typeof n=="string"&&n.trim().length>0)return H(n)}}i(nt,"readMutationPath");function fn(e,t){return{...e??{},onToolUseStart:i((n,r)=>{if(et.has(n.name)){t.toolNameById.set(n.id,n.name);let a=nt(n.input);a!==void 0&&t.toolPathById.set(n.id,a)}if(tt.has(n.name)){let a=nt(n.input);a!==void 0&&t.readPathById.set(n.id,a)}e?.onToolUseStart?.(n,r)},"onToolUseStart"),onToolResult:i((n,r)=>{let a=t.toolNameById.get(n.id)??n.name;if(et.has(a)&&!n.content.trimStart().startsWith("[Tool Error]")){t.succeededToolCalls.push(a);let o=t.toolPathById.get(n.id);o!==void 0&&t.succeededPaths.push(o)}if(tt.has(a)&&!n.content.trimStart().startsWith("[Tool Error]")){let o=t.readPathById.get(n.id);o!==void 0&&t.succeededReadPaths.push(o)}e?.onToolResult?.(n,r)},"onToolResult")}}i(fn,"wrapEventsForMutationRecording");function ae(e){return[...new Set(e.filter(t=>t.trim().length>0))]}i(ae,"uniqueItems");function rt(e){let t=e.verification;if(!t)return;let n=[],r=new Set(e.before.paths.map(H)),a=ae(e.after.paths.map(H)),o=a.filter(m=>!r.has(m)),s=ae(e.mutationRecorder.succeededToolCalls),d=e.acceptToolMutationEvidence?s:[],g=e.acceptToolMutationEvidence?ae(e.mutationRecorder.succeededPaths.map(H)):[],h=o.length>0||d.length>0,y=t.enforcement??"hard",p=(t.requiredChangedPaths??[]).map(m=>ye(m,e.ctx)),b=ae(e.mutationRecorder.succeededReadPaths.map(m=>ye(m,e.ctx))),v=(t.requiredReadPaths??[]).map(m=>ye(m,e.ctx));t.requiresMutation===!0&&(e.before.error!==void 0||e.after.error!==void 0?n.push(`workspace mutation verification could not read changed files: ${e.after.error??e.before.error}`):h||n.push(e.acceptToolMutationEvidence||s.length===0?"expected file mutations, but no new workspace changes or successful write tools were observed":"write tools ran in an isolated worktree, but no main workspace changes were present after cleanup")),e.term.limitReached===!0&&!h&&n.push("workflow child reached its iteration limit before satisfying the task");for(let m of p)!a.includes(m)&&!g.includes(m)&&n.push(`required changed path was not present in workspace changes: ${m}`);for(let m of v)b.includes(m)||n.push(`required review evidence was not read: ${m}`);let W=t.minFinalTextChars;return W!==void 0&&!h&&e.term.finalText.trim().length<W&&n.push(`finalText was shorter than the required ${W} characters`),t.rejectPreparatoryFinalText===!0&&!h&&st(e.term.finalText)&&n.push("finalText looks preparatory instead of terminal"),{ok:n.length===0,enforcement:y,reasons:n,changedPaths:a,mutationToolCalls:s,mutationEvidence:h,...b.length>0?{readPaths:b}:{}}}i(rt,"evaluateVerification");function ve(e,t){if(t.ok)return e;let r=[t.enforcement==="warn"?"[Workflow task completed without verification]":"[Workflow task verification failed]",...t.reasons.map(a=>`- ${a}`)].join(`
|
|
3
3
|
`);return e.trim().length>0?`${e}
|
|
4
4
|
|
|
5
5
|
${r}`:r}i(ve,"appendVerificationFailure");function ot(){return{ok:!1,enforcement:"warn",reasons:["workflow child reached its iteration limit before satisfying the task"],mutationEvidence:!1}}i(ot,"limitReachedWarningVerification");function mn(e){return e.entry.bundle.readOnly!==!0&&e.entry.repairAttempts<at&&e.term.status==="completed"&&e.verification!==void 0&&e.verification.ok!==!0&&e.verification.enforcement!=="warn"}i(mn,"shouldRepairVerificationFailure");function pn(e){let t=e.verification.reasons.map(r=>`- ${r}`).join(`
|
|
@@ -13,7 +13,7 @@ ${s.text}`),rubric:t.rubric??vn}))).text,findings:r,degraded:a}}i(Pn,"runParalle
|
|
|
13
13
|
`).trim().replace(/[\t\n\f\r ]+/g," ")}i(j,"normalizeText");function lt(e){return j(e).replace(/\\/g,"/")}i(lt,"normalizeLocation");function se(e){return[...new Set(e.map(j).filter(Boolean))].sort((t,n)=>t<n?-1:t>n?1:0)}i(se,"uniqueSorted");function An(e,t,n){return Mn("sha256").update(`${e}\0${lt(t)}\0${j(n)}`,"utf8").digest("hex")}i(An,"findingId");function ft(e,t,n){if(!t&&n.specVerdict!=="not-verifiable")throw new Error('review result must use specVerdict "not-verifiable" when requirements are absent');return{specVerdict:n.specVerdict,qualityVerdict:n.qualityVerdict,findings:n.findings.map(r=>{let a=lt(r.location),o=j(r.claim),s=j(r.evidence);return{findingId:An(e,a,o),severity:r.severity,location:a,claim:o,evidence:s,...r.suggestedFix?{suggestedFix:j(r.suggestedFix)}:{}}}).sort((r,a)=>r.findingId<a.findingId?-1:r.findingId>a.findingId?1:0),unverifiedRequirements:se(n.unverifiedRequirements)}}i(ft,"normalizeScopedReviewResult");var ut={low:0,medium:1,high:2,critical:3};function En(e){return e.reduce((t,n)=>ut[n]>ut[t]?n:t,"low")}i(En,"maxSeverity");function mt(e){if(e.length===0)throw new Error("at least one primary review result is required");let t=new Map;for(let a of e)for(let o of a.findings)t.set(o.findingId,[...t.get(o.findingId)??[],o]);let n=[...t.entries()].map(([a,o])=>({findingId:a,severity:En(o.map(s=>s.severity)),location:o[0].location,claim:o[0].claim,evidence:se(o.map(s=>s.evidence)),suggestedFixes:se(o.flatMap(s=>s.suggestedFix?[s.suggestedFix]:[]))})).sort((a,o)=>a.findingId<o.findingId?-1:a.findingId>o.findingId?1:0);return{specVerdict:e.some(a=>a.specVerdict==="issues")?"issues":e.some(a=>a.specVerdict==="not-verifiable")?"not-verifiable":"compliant",qualityVerdict:e.some(a=>a.qualityVerdict==="needs-fixes")?"needs-fixes":"approved",findings:n,unverifiedRequirements:se(e.flatMap(a=>a.unverifiedRequirements))}}i(mt,"mergeScopedReviewResults");function pt(e,t){let n=new Set(e.findings.map(s=>s.findingId)),r=new Set;for(let s of t.findings){if(!n.has(s.findingId)||r.has(s.findingId))throw new Error("verifier must return every input findingId exactly once");r.add(s.findingId)}if(r.size!==n.size)throw new Error("verifier must return every input findingId exactly once");let a=new Map(t.findings.map(s=>[s.findingId,s])),o=e.findings.flatMap(s=>{let d=a.get(s.findingId);if(d.disposition==="refuted")return[];let g=d.severityReason?.trim(),h=d.effectiveSeverity!==void 0&&!!g;return[{...s,disposition:d.disposition,severity:h?d.effectiveSeverity:s.severity,verificationEvidence:j(d.evidence),...g?{severityReason:j(g)}:{}}]});return{specVerdict:e.specVerdict,qualityVerdict:e.qualityVerdict,unverifiedRequirements:e.unverifiedRequirements,actionable:o,audit:t,unqualifiedApprovalAllowed:o.length===0&&e.unverifiedRequirements.length===0&&e.specVerdict==="compliant"&&e.qualityVerdict==="approved"}}i(pt,"applyFindingVerification");var Wn={type:"object",additionalProperties:!1,required:["summary"],properties:{summary:{type:"string"}}};function gt(e){return[e.packetPath,...e.evidenceChunks.map(t=>t.path)]}i(gt,"evidencePaths");function Fn(e){let t=ge(e,Se);if(t.length>0)throw new Error(`primary reviewer structured result is invalid: ${t.join("; ")}`);return e}i(Fn,"rawReview");function On(e){let t=ge(e,Re);if(t.length>0)throw new Error(`finding verifier structured result is invalid: ${t.join("; ")}`);return e}i(On,"rawVerification");function be(e,t){if(e===null||e.status!=="completed")throw new Error(`${t} did not complete; no verdict was accepted`);if(e.verification!==void 0&&!e.verification.ok)throw new Error(`${t} did not read every required packet path; no verdict was accepted`);return e}i(be,"resultOrThrow");function qn(e,t,n){return["Review one immutable KodaX packet as an independent third-party reviewer.",`Packet manifest: ${e.packetPath}`,...e.evidenceChunks.map(r=>`Evidence chunk: ${r.path}`),`This packet has binding requirements: ${e.requirementsPresent?"yes":"no"}.`,t?"This is the additional high-risk primary. Actively seek a disagreement with the first reader; do not assume it was correct.":"Own both specification and implementation-quality verdicts for this scope.",n.lean?"Also identify unnecessary additions, but never remove validation, security, data-loss protection, accessibility, or requested behavior.":"",n.reviewFocus?`Additional user focus: ${n.reviewFocus}`:"","Read the manifest and every listed chunk with the read tool before deciding.","Begin with the required JSON result. No preamble or process narration.","The findings array contains only actionable defects, never approval evidence or positive observations.","When the scope is compliant and approved with no actionable defect, findings must be empty.","If a named requirement cannot be proven compliant or violated from surfaced evidence, use specVerdict not-verifiable, list it in unverifiedRequirements, and emit no finding for that uncertainty; absence of evidence is not proof of a defect.","If requirements are absent, specVerdict must be not-verifiable."].filter(Boolean).join(`
|
|
14
14
|
`)}i(qn,"buildScopedReviewPrimaryPrompt");function Cn(e,t){return["Independently attempt to refute every candidate finding in this batch.",`Packet manifest: ${e.packetPath}`,...e.evidenceChunks.map(n=>`Evidence chunk: ${n.path}`),`Canonical candidates: ${JSON.stringify(t.findings)}`,"Read the packet evidence. You may run one focused check after naming the concrete doubt.","Return every findingId exactly once. A severity change requires severityReason.","Begin with the required JSON result; no preamble."].join(`
|
|
15
15
|
`)}i(Cn,"buildScopedReviewVerificationPrompt");function $n(e){return["Synthesize the structured review results below without rereading packet bodies.","Lead with confirmed findings, keep unresolved findings visibly unresolved, omit refuted findings from the actionable list, and never silently downgrade severity.","Cite locations and state explicitly when no actionable issue was confirmed.",JSON.stringify(e)].join(`
|
|
16
|
-
`)}i($n,"buildScopedReviewFinalPrompt");async function wt(e,t,n,r){let a=be(await e.runAgent({name:`${n?"high-risk-":""}primary-${t.partitionKey}`,phase:"primary-review",prompt:qn(t,n,r),scopeSummary:`${t.partitionKey}: ${t.scopePaths.join(", ")}`,constraints:["read every required packet path","return both verdicts","cite evidence at each finding"],readOnly:!0,modelHint:n?"deep":"balanced",verification:{enforcement:"hard",requiredReadPaths:gt(t)},outputSchema:Se,terseResult:!0}),"primary reviewer");return e.log({message:`primary read accepted for ${t.partitionKey}`,data:{kind:"review_packet_read",role:"primary",contentHash:t.contentHash}}),Fn(a.structured)}i(wt,"runPrimary");async function _n(e,t,n){if(n.findings.length===0)return{specVerdict:n.specVerdict,qualityVerdict:n.qualityVerdict,unverifiedRequirements:n.unverifiedRequirements,actionable:[],audit:{findings:[]},unqualifiedApprovalAllowed:n.unverifiedRequirements.length===0&&n.specVerdict==="compliant"&&n.qualityVerdict==="approved"};let r=be(await e.runAgent({name:`verify-${t.partitionKey}`,phase:"verifier",prompt:Cn(t,n),scopeSummary:`verify ${n.findings.length} candidate finding(s) in ${t.partitionKey}`,constraints:["fresh context","attempt refutation","one disposition per findingId"],readOnly:!0,modelHint:"deep",verification:{enforcement:"hard",requiredReadPaths:gt(t)},outputSchema:Re,terseResult:!0}),"finding verifier");return e.log({message:`verification read accepted for ${t.partitionKey}`,data:{kind:"review_packet_read",role:"verification",contentHash:t.contentHash,reason:"candidate findings"}}),pt(n,On(r.structured))}i(_n,"verifyFindings");async function Nn(e,t,n){let r=[await wt(e,t,!1,n)];t.riskFlags.includes("routing-high")&&r.push(await wt(e,t,!0,n));let a=r.map(d=>ft(t.contentHash,t.requirementsPresent,d)),o=mt(a),s=await _n(e,t,o);return e.log({message:`quality gate completed for ${t.partitionKey}`,data:{kind:"review_quality_gate",contentHash:t.contentHash,actionableFindings:s.actionable.length,unresolvedFindings:s.actionable.filter(d=>d.disposition==="unresolved").length,unqualifiedApprovalAllowed:s.unqualifiedApprovalAllowed}}),{contentHash:t.contentHash,result:s}}i(Nn,"reviewPacket");async function Dn(e,t){if(!Array.isArray(t.packets)||t.packets.length===0)throw new Error("scoped-review requires at least one review packet");let n=await e.parallel(t.packets.map(d=>()=>Nn(e,d,t)),{concurrency:4});if(n.some(d=>d===null))throw new Error("one or more scope packets failed review; no final verdict was accepted");let r=n.filter(d=>d!==null);await e.artifact("scoped-review-audit",r);let a=be(await e.runAgent({name:"final-review-synthesis",phase:"final-synthesis",prompt:$n(r),scopeSummary:`cross-scope synthesis for ${r.length} packet(s)`,constraints:["preserve severity","preserve unresolved uncertainty","do not invent evidence"],readOnly:!0,modelHint:"deep",outputSchema:Wn,terseResult:!0}),"final synthesis"),o=a.structured;return{summary:typeof o?.summary=="string"?o.summary:a.finalText,packetResults:r}}i(Dn,"runScopedReview");var ht={meta:{name:"scoped-review",description:"Review immutable scope packets once, verify only candidate findings, then synthesize.",readOnly:!0,phases:["primary-review","verifier","final-synthesis"],maxAgents:64,maxConcurrency:4},run:Dn};function yt(e){return{meta:e.meta,run:i((t,n)=>e.run(t,n),"run")}}i(yt,"erase");var kt=[yt(dt),yt(ht)];function vt(e){return kt.find(t=>t.meta.name===e)}i(vt,"getBuiltinWorkflow");function no(){return kt.map(e=>e.meta)}i(no,"listBuiltinWorkflows");import{mkdir as Tt,readdir as jn,readFile as Q,rename as Un,unlink as Pe,writeFile as Me}from"node:fs/promises";import{basename as Vn,dirname as Ie,join as K}from"node:path";import{pathToFileURL as Bn}from"node:url";var It=[".workflow.json",".ts",".mjs",".js"],ee="0.7.49";function Pt(){return"0.7.
|
|
16
|
+
`)}i($n,"buildScopedReviewFinalPrompt");async function wt(e,t,n,r){let a=be(await e.runAgent({name:`${n?"high-risk-":""}primary-${t.partitionKey}`,phase:"primary-review",prompt:qn(t,n,r),scopeSummary:`${t.partitionKey}: ${t.scopePaths.join(", ")}`,constraints:["read every required packet path","return both verdicts","cite evidence at each finding"],readOnly:!0,modelHint:n?"deep":"balanced",verification:{enforcement:"hard",requiredReadPaths:gt(t)},outputSchema:Se,terseResult:!0}),"primary reviewer");return e.log({message:`primary read accepted for ${t.partitionKey}`,data:{kind:"review_packet_read",role:"primary",contentHash:t.contentHash}}),Fn(a.structured)}i(wt,"runPrimary");async function _n(e,t,n){if(n.findings.length===0)return{specVerdict:n.specVerdict,qualityVerdict:n.qualityVerdict,unverifiedRequirements:n.unverifiedRequirements,actionable:[],audit:{findings:[]},unqualifiedApprovalAllowed:n.unverifiedRequirements.length===0&&n.specVerdict==="compliant"&&n.qualityVerdict==="approved"};let r=be(await e.runAgent({name:`verify-${t.partitionKey}`,phase:"verifier",prompt:Cn(t,n),scopeSummary:`verify ${n.findings.length} candidate finding(s) in ${t.partitionKey}`,constraints:["fresh context","attempt refutation","one disposition per findingId"],readOnly:!0,modelHint:"deep",verification:{enforcement:"hard",requiredReadPaths:gt(t)},outputSchema:Re,terseResult:!0}),"finding verifier");return e.log({message:`verification read accepted for ${t.partitionKey}`,data:{kind:"review_packet_read",role:"verification",contentHash:t.contentHash,reason:"candidate findings"}}),pt(n,On(r.structured))}i(_n,"verifyFindings");async function Nn(e,t,n){let r=[await wt(e,t,!1,n)];t.riskFlags.includes("routing-high")&&r.push(await wt(e,t,!0,n));let a=r.map(d=>ft(t.contentHash,t.requirementsPresent,d)),o=mt(a),s=await _n(e,t,o);return e.log({message:`quality gate completed for ${t.partitionKey}`,data:{kind:"review_quality_gate",contentHash:t.contentHash,actionableFindings:s.actionable.length,unresolvedFindings:s.actionable.filter(d=>d.disposition==="unresolved").length,unqualifiedApprovalAllowed:s.unqualifiedApprovalAllowed}}),{contentHash:t.contentHash,result:s}}i(Nn,"reviewPacket");async function Dn(e,t){if(!Array.isArray(t.packets)||t.packets.length===0)throw new Error("scoped-review requires at least one review packet");let n=await e.parallel(t.packets.map(d=>()=>Nn(e,d,t)),{concurrency:4});if(n.some(d=>d===null))throw new Error("one or more scope packets failed review; no final verdict was accepted");let r=n.filter(d=>d!==null);await e.artifact("scoped-review-audit",r);let a=be(await e.runAgent({name:"final-review-synthesis",phase:"final-synthesis",prompt:$n(r),scopeSummary:`cross-scope synthesis for ${r.length} packet(s)`,constraints:["preserve severity","preserve unresolved uncertainty","do not invent evidence"],readOnly:!0,modelHint:"deep",outputSchema:Wn,terseResult:!0}),"final synthesis"),o=a.structured;return{summary:typeof o?.summary=="string"?o.summary:a.finalText,packetResults:r}}i(Dn,"runScopedReview");var ht={meta:{name:"scoped-review",description:"Review immutable scope packets once, verify only candidate findings, then synthesize.",readOnly:!0,phases:["primary-review","verifier","final-synthesis"],maxAgents:64,maxConcurrency:4},run:Dn};function yt(e){return{meta:e.meta,run:i((t,n)=>e.run(t,n),"run")}}i(yt,"erase");var kt=[yt(dt),yt(ht)];function vt(e){return kt.find(t=>t.meta.name===e)}i(vt,"getBuiltinWorkflow");function no(){return kt.map(e=>e.meta)}i(no,"listBuiltinWorkflows");import{mkdir as Tt,readdir as jn,readFile as Q,rename as Un,unlink as Pe,writeFile as Me}from"node:fs/promises";import{basename as Vn,dirname as Ie,join as K}from"node:path";import{pathToFileURL as Bn}from"node:url";var It=[".workflow.json",".ts",".mjs",".js"],ee="0.7.49";function Pt(){return"0.7.80"}i(Pt,"currentKodaxWorkflowVersion");function Hn(e){return e.endsWith(".workflow.json")?"capability-generated":"trusted-local"}i(Hn,"executionForPath");function Kn(e){let t=It.find(n=>e.endsWith(n));return t?e.slice(0,-t.length):void 0}i(Kn,"stripWorkflowSuffix");function Ae(e){let t=e.trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^[.-]+|[.-]+$/g,"").slice(0,80);if(!t||t==="."||t==="..")throw new Error("workflow name must contain at least one safe filename character");return t}i(Ae,"safeWorkflowName");function Ee(e){return typeof e=="object"&&e!==null}i(Ee,"isRecord");function xt(e,t){let n=e[t];if(typeof n!="string"||n.length===0)throw new Error(`workflow run.json missing ${t}`);return n}i(xt,"readRequiredString");async function St(e,t){if(!e)return[];let n;try{n=await jn(e)}catch{return[]}let r=new Map;for(let a of It)for(let o of n){if(!o.endsWith(a))continue;let s=Kn(o);if(!s||s.length===0||r.has(s))continue;let d=K(e,o);r.set(s,{name:s,path:d,source:t,execution:Hn(d)})}return[...r.values()]}i(St,"scanDir");async function te(e){let t=await St(e.personal,"personal"),n=await St(e.project,"project"),r=new Map;for(let a of t)r.set(a.name,a);for(let a of n)r.set(a.name,a);return[...r.values()].sort((a,o)=>a.name.localeCompare(o.name))}i(te,"discoverSavedWorkflows");function Ln(e){return typeof e=="object"&&e!==null&&"meta"in e&&"run"in e&&typeof e.run=="function"}i(Ln,"isWorkflowModule");function zn(e){let t=e.default;if(Ln(t))return t;let n=typeof t=="function"?t:e.run,r=e.workflow??e.meta;if(typeof n=="function"&&typeof r=="object"&&r!==null&&"name"in r)return{meta:r,run:n};throw new Error("invalid workflow module: expected a `{ meta, run }` default export, or `export const workflow = {...}` + a default run function")}i(zn,"normalizeWorkflowModule");function Jn(e){let t=JSON.parse(e);if(!Ee(t))throw new Error("generated workflow file must be an object");if(t.format!==void 0&&t.format!=="kodax.workflow")throw new Error(`unsupported workflow capsule format: ${String(t.format)}`);if(t.format==="kodax.workflow"){let a=pe(t);return{manifest:a.manifest,source:a.source,capsule:a,legacy:!1}}let n=t.source;if(typeof n!="string"||n.trim().length===0)throw new Error("generated workflow file source must be a non-empty string");let r=Z(t.manifest);return{manifest:r,source:n,capsule:B({minKodaxVersion:ee,manifest:r,source:n}),legacy:!0}}i(Jn,"parseGeneratedWorkflowFile");async function We(e){let t=Jn(await Q(e,"utf8"));return t.capsule??B({minKodaxVersion:ee,manifest:t.manifest,source:t.source})}i(We,"loadSavedWorkflowCapsule");async function Mt(e){if(e.endsWith(".workflow.json"))return we(await We(e));let t=await import(Bn(e).href);return zn(t)}i(Mt,"loadSavedWorkflow");function Fe(e){if(e.mayUseWorktree===!0)return{environment:["git-repo","worktree-capable"]}}i(Fe,"deriveRequirements");function ce(e,t){me(t,{filename:`${e.name}.workflow.js`,requireAsyncRun:!0})}i(ce,"assertGeneratedCapsuleSource");async function Gn(e){let t=Ae(e.name),n=Z(e.manifest);ce(n,e.source);let r=e.requires??Fe(n),a=B({minKodaxVersion:e.minKodaxVersion??ee,manifest:n,source:e.source,...e.intent!==void 0?{intent:e.intent}:{},...e.inputs!==void 0?{inputs:e.inputs}:{},...r!==void 0?{requires:r}:{},...e.provenance!==void 0?{provenance:e.provenance}:{}});await Tt(e.dir,{recursive:!0});let o=K(e.dir,`${t}.workflow.json`);return await Me(o,`${JSON.stringify(a,null,2)}
|
|
17
17
|
`,"utf8"),{name:t,path:o,source:"project",execution:"capability-generated"}}i(Gn,"saveGeneratedWorkflow");async function Rt(e,t){await Me(e,`${JSON.stringify(t,null,2)}
|
|
18
18
|
`,"utf8")}i(Rt,"writeCapsuleFile");async function Xn(e){try{return await Q(e,"utf8"),!0}catch{return!1}}i(Xn,"fileExists");async function uo(e){let t=(await te(e.dirs)).filter(d=>d.name===e.name).filter(d=>e.source===void 0||d.source===e.source);if(t.length===0)throw new Error(`saved workflow not found: ${e.name}`);if(t.length>1)throw new Error(`ambiguous saved workflow name: ${e.name}`);let n=t[0];if(!n.path.endsWith(".workflow.json"))throw new Error("only generated workflow capsules can be renamed");let r=Ae(e.newName),a=K(Ie(n.path),`${r}.workflow.json`);if(a!==n.path&&await Xn(a))throw new Error(`saved workflow already exists: ${r}`);let o=await We(n.path);ce(o.manifest,o.source);let s=B({minKodaxVersion:o.minKodaxVersion,manifest:{...o.manifest,name:r},source:o.source,...o.intent!==void 0?{intent:o.intent}:{},...o.inputs!==void 0?{inputs:o.inputs}:{},...o.requires!==void 0?{requires:o.requires}:{},...o.provenance!==void 0?{provenance:o.provenance}:{}});return await Me(a,`${JSON.stringify(s,null,2)}
|
|
19
19
|
`,"utf8"),a!==n.path&&await Pe(n.path),{name:r,path:a,source:n.source,execution:"capability-generated"}}i(uo,"renameSavedWorkflow");async function lo(e){let t=(await te(e.dirs)).filter(r=>r.name===e.name).filter(r=>e.source===void 0||r.source===e.source);if(t.length===0)throw new Error(`saved workflow not found: ${e.name}`);if(t.length>1)throw new Error(`ambiguous saved workflow name: ${e.name}`);let n=t[0];if(!n.path.endsWith(".workflow.json"))throw new Error("only generated workflow capsules can be deleted");return await Pe(n.path),n}i(lo,"deleteSavedWorkflow");async function fo(e){let t=Ae(e.name),n=(await te(e.dirs)).filter(v=>v.name===t).filter(v=>e.savedSource===void 0||v.source===e.savedSource);if(n.length===0)throw new Error(`saved workflow not found: ${t}`);if(n.length>1)throw new Error(`ambiguous saved workflow name: ${t}`);let r=n[0];if(!r.path.endsWith(".workflow.json"))throw new Error("only generated workflow capsules can be replaced");let a=Z({...e.manifest,name:t});ce(a,e.source);let o=e.requires??Fe(a),s=B({minKodaxVersion:e.minKodaxVersion??ee,manifest:a,source:e.source,...e.intent!==void 0?{intent:e.intent}:{},...e.inputs!==void 0?{inputs:e.inputs}:{},...o!==void 0?{requires:o}:{},...e.provenance!==void 0?{provenance:e.provenance}:{}}),d=await We(r.path),g=new Date().toISOString().replace(/[:.]/g,"-"),h=K(Ie(r.path),".revisions",t),y=`${g}-${process.hrtime.bigint().toString(36)}`,p=K(h,`${t}-${y}.workflow.json`),b=K(Ie(r.path),`.${t}.${process.pid}.${Date.now().toString(36)}.tmp`);await Tt(h,{recursive:!0}),await Rt(p,d);try{await Rt(b,s),await Un(b,r.path)}catch(v){try{await Pe(b)}catch{}throw v}return{name:t,path:r.path,source:r.source,execution:"capability-generated",previousPath:p}}i(fo,"replaceSavedWorkflow");function Yn(e){if(!Ee(e))return;let t=e.request;if(typeof t=="string"&&t.trim().length>0)return t;let n=e.question;if(typeof n=="string"&&n.trim().length>0)return n}i(Yn,"readOptionalOriginalRequest");function At(e){return Zn(e)}i(At,"buildCapsuleFromRun");async function Zn(e){let t=JSON.parse(await Q(K(e.runDir,"run.json"),"utf8"));if(!Ee(t))throw new Error("workflow run.json must be an object");let n=xt(t,"scriptSnapshotPath"),r=xt(t,"manifestSnapshotPath"),a=await Q(n,"utf8"),o=Z(JSON.parse(await Q(r,"utf8")));ce(o,a);let s=typeof t.runId=="string"&&t.runId.length>0?t.runId:Vn(e.runDir),d=Yn(t.args),g=Fe(o),h=Ue(o,d!==void 0?{originalRequest:d}:{}),y={description:"Provide new workflow args matching the generated request shape.",..."args"in t?{examples:[t.args]}:{}};return B({minKodaxVersion:ee,manifest:o,source:a,intent:h,inputs:y,...g!==void 0?{requires:g}:{},provenance:{fromRunId:s,createdAt:new Date().toISOString(),kodaxVersion:Pt()}})}i(Zn,"readCapsuleFromRun");async function mo(e){let t=await At(e);return{capsule:t,module:we(t)}}i(mo,"loadGeneratedWorkflowFromRun");async function po(e){let t=await At(e);return Gn({dir:e.targetDir,name:e.name,manifest:t.manifest,source:t.source,...t.intent!==void 0?{intent:t.intent}:{},...t.inputs!==void 0?{inputs:t.inputs}:{},...t.requires!==void 0?{requires:t.requires}:{},...t.provenance!==void 0?{provenance:t.provenance}:{},minKodaxVersion:t.minKodaxVersion})}i(po,"saveGeneratedWorkflowFromRun");function U(e,t,n,r){e.push({severity:t,requirement:n,message:r})}i(U,"addRequirementIssue");function bt(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e.trim());if(t)return[Number(t[1]),Number(t[2]),Number(t[3])]}i(bt,"parseSemver");function Qn(e,t){for(let n=0;n<3;n+=1){let r=e[n]-t[n];if(r!==0)return r}return 0}i(Qn,"compareSemver");function er(e,t,n){let r=bt(t),a=bt(n);if(!r){U(e,"error","kodax:min-version",`workflow minKodaxVersion is not valid semver: ${t}`);return}if(!a){U(e,"warning","kodax:min-version",`cannot verify workflow minKodaxVersion ${t}; current version is unknown`);return}Qn(a,r)<0&&U(e,"error","kodax:min-version",`workflow requires KodaX >= ${t}, current version is ${n}`)}i(er,"addMinVersionIssue");function Te(e,t,n,r){if(!n)return;if(!r){for(let o of n)U(e,"warning",`${t}:${o}`,`workflow requires ${t}:${o}, but no ${t} inventory was provided`);return}let a=new Set(r);for(let o of n)a.has(o)||U(e,"error",`${t}:${o}`,`missing required workflow ${t}: ${o}`)}i(Te,"addMissingItems");function wo(e,t={}){let n=pe(e),r=[],a=n.requires;er(r,n.minKodaxVersion,t.kodaxVersion??Pt()),a?.environment?.includes("git-repo")&&t.isGitRepo===!1&&U(r,"error","environment:git-repo","workflow requires a git repository"),a?.environment?.includes("worktree-capable")&&t.worktreeCapable===!1&&U(r,"error","environment:worktree-capable","workflow may request git worktree isolation");try{me(n.source,{filename:`${n.manifest.name}.workflow.js`,requireAsyncRun:!0})}catch(o){let s=o instanceof Error?o.message:String(o);U(r,"error","workflow:source",s)}return Te(r,"tools",a?.tools,t.availableTools),Te(r,"mcp",a?.mcp,t.availableMcp),Te(r,"skills",a?.skills,t.availableSkills),{ok:!r.some(o=>o.severity==="error"),issues:r}}i(wo,"preflightWorkflowCapsule");function nr(e){return{project:Et(e,".kodax","workflows"),personal:Et(tr(),".kodax","workflows")}}i(nr,"defaultSavedWorkflowDirs");async function rr(e,t){let r=(await te(t)).find(a=>a.name===e);if(r)return Mt(r.path)}i(rr,"resolveSavedByName");function Wt(e){let t=nr(e);return async n=>vt(n)??await rr(n,t)}i(Wt,"createNestedWorkflowResolver");import{existsSync as or,mkdirSync as ir,readFileSync as ar,writeFileSync as Ft}from"node:fs";import{join as ne}from"node:path";var Ot="results";function qt(e){return e.replace(/[^a-zA-Z0-9._-]/g,"_")}i(qt,"safeKey");function Ct(e,t){let n=ne(e,t);if(or(n))try{return JSON.parse(ar(n,"utf8"))}catch{return}}i(Ct,"readResult");function $t(e,t={}){let n=ne(e,Ot);ir(n,{recursive:!0});let r=t.readFrom?ne(t.readFrom,Ot):void 0;return{get:i(a=>{let o=`${qt(a)}.json`,s=Ct(n,o);if(s!==void 0)return s;if(r===void 0)return;let d=Ct(r,o);if(d!==void 0){try{Ft(ne(n,o),JSON.stringify(d),"utf8")}catch{}return d}},"get"),set:i((a,o)=>{try{Ft(ne(n,`${qt(a)}.json`),JSON.stringify(o),"utf8")}catch{}},"set")}}i($t,"createFsResultCache");import{mkdirSync as sr,appendFileSync as cr,writeFileSync as ue}from"node:fs";import{join as J}from"node:path";function de(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}i(de,"record");function F(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:0}i(F,"finiteNumber");function _t(e){let t=new Map,n=new Set,r=[],a=[],o=new Set,s=[],d=[],g=0,h=0,y=0,p=0,b=0,v=0,W=0,m=0,T={},$=[];for(let C of e){let M=C.data??{};if(C.type==="agent_spawned"){let u=typeof M.taskId=="string"?M.taskId:void 0;u&&t.set(u,M),M.role==="primary-review"&&(v+=1);let w=typeof M.role=="string"?M.role:"agent",S=typeof M.requestedTier=="string"?M.requestedTier:"inherited",I=`${w}/${S}`;T[I]=(T[I]??0)+1;continue}if(C.type==="agent_completed"||C.type==="agent_unverified"||C.type==="agent_failed"){let u=typeof M.taskId=="string"?M.taskId:void 0;if(!u||n.has(u))continue;n.add(u);let w=de(M.usage);!w||typeof w.totalTokens!="number"?typeof t.get(u)?.externalTarget=="string"?a.push(u):r.push(u):(g+=F(w.totalTokens),h+=F(w.inputTokens),y+=F(w.cacheReadTokens??w.cachedReadTokens),p+=F(w.outputTokens));let S=de(M.digestUsage);b+=F(S?.totalTokens),h+=F(S?.inputTokens),p+=F(S?.outputTokens),y+=F(S?.cacheReadTokens??S?.cachedReadTokens),W+=F(M.iterations);continue}if(C.type==="agent_summary_updated"){let u=de(M.usage),w=M.summaryKind;if((w==="digest"||w==="digest-failed")&&u){let S=F(u.totalTokens);g+=S,b+=S,h+=F(u.inputTokens),p+=F(u.outputTokens),y+=F(u.cacheReadTokens??u.cachedReadTokens)}continue}if(C.type!=="workflow_log")continue;let f=de(M.data);if(f?.kind==="review_quality_gate"&&typeof f.contentHash=="string"){$.push({contentHash:f.contentHash,actionableFindings:F(f.actionableFindings),unresolvedFindings:F(f.unresolvedFindings),unqualifiedApprovalAllowed:f.unqualifiedApprovalAllowed===!0});continue}if(f?.kind!=="review_packet_read"||typeof f.contentHash!="string")continue;let l={contentHash:f.contentHash,...typeof f.reason=="string"?{reason:f.reason}:{}};f.role==="primary"?(o.has(f.contentHash)&&(m+=1),o.add(f.contentHash)):f.role==="verification"?s.push(l):f.role==="synthesis"&&d.push(l)}for(let C of t.keys())n.has(C)||r.push(C);let G=[...new Set(r)].sort();return{totalModelTokens:g,inputTokens:h,cacheReadTokens:y,outputTokens:p,digestTokens:b,agentStarts:t.size,childTurns:W,agentStartsByRoleTier:T,primaryReviewStarts:v,duplicatePrimaryPacketReads:m,verificationPacketReads:s,synthesisPacketReads:d,reviewWaves:v>0?1:0,fixWaves:0,rereviewWaves:0,qualityGateOutcomes:$,tokenCoverage:{ok:G.length===0,missingTaskIds:G},excludedExternalTaskIds:[...new Set(a)].sort()}}i(_t,"buildWorkflowCostReport");function dr(e){let t=e.replace(/[^a-zA-Z0-9._-]/g,"_").slice(0,120);return t.length>0?t:"artifact"}i(dr,"safeWorkflowArtifactName");function Nt(e,t={}){let n=t.now??(()=>Date.now()),r=J(e,"artifacts");sr(r,{recursive:!0});let a=J(e,"events.jsonl");return{runDir:e,onEvent:i(o=>{cr(a,`${JSON.stringify({...o,ts:n()})}
|