@kodax-ai/kodax 0.7.74 → 0.7.76
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 +62 -0
- package/README.md +21 -1
- package/README_CN.md +17 -1
- package/dist/chunks/{agent-2ABIG5NW.js → agent-7X5CFET2.js} +1 -1
- package/dist/chunks/argument-completer-3NHIKB4N.js +2 -0
- package/dist/chunks/{chunk-XMP66YWG.js → chunk-4PWPNCNK.js} +4 -4
- package/dist/chunks/{chunk-C7TZAT3S.js → chunk-7FJNLJLF.js} +9 -9
- package/dist/chunks/chunk-COQYLD4U.js +5 -0
- package/dist/chunks/{chunk-XXQLPTAN.js → chunk-D3T24FJW.js} +7 -7
- package/dist/chunks/{chunk-F7AIEHSS.js → chunk-EI4JBQKL.js} +2 -2
- package/dist/chunks/{chunk-KPGVY6PF.js → chunk-HGT6WQ24.js} +4 -4
- package/dist/chunks/{chunk-7W6KYJU2.js → chunk-HS3XHF3R.js} +4 -4
- package/dist/chunks/{chunk-64M5HOCA.js → chunk-IDCGNQ4H.js} +1 -1
- package/dist/chunks/{chunk-5GH3SVI3.js → chunk-KAY2XLCP.js} +21 -21
- package/dist/chunks/{chunk-XM724XAA.js → chunk-OD6LVXU6.js} +4 -4
- package/dist/chunks/{chunk-VK5QTHS6.js → chunk-OSF3H4RR.js} +3 -3
- package/dist/chunks/{chunk-MBAPT2R5.js → chunk-PXKSE54E.js} +1 -1
- package/dist/chunks/{chunk-QH56WEHK.js → chunk-RDXRM3UI.js} +1 -1
- package/dist/chunks/{chunk-MVCAFD6M.js → chunk-SMT2JSM3.js} +1 -1
- package/dist/chunks/{chunk-VPURXE2F.js → chunk-TGMBHGZO.js} +119 -119
- package/dist/chunks/{chunk-UJS7JAO6.js → chunk-VWSLC2WO.js} +1 -1
- package/dist/chunks/{chunk-GAFFYJU3.js → chunk-Y3AMP22L.js} +12 -12
- package/dist/chunks/compaction-config-7J2XE35D.js +2 -0
- package/dist/chunks/{construction-bootstrap-BKNPJI7O.js → construction-bootstrap-5F5KF2BZ.js} +1 -1
- package/dist/chunks/{dist-EVEJAII2.js → dist-2RA7LSH3.js} +1 -1
- package/dist/chunks/{dist-6EK4H7TP.js → dist-URKXBOC6.js} +1 -1
- package/dist/chunks/host-RKZ2OGFT.js +2 -0
- package/dist/chunks/run-manager-7RM4HEH6.js +2 -0
- package/dist/chunks/{utils-GTJLL4GT.js → utils-X3TEH6IO.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/kodax_cli.js +825 -825
- package/dist/provider-capabilities.json +35 -7
- package/dist/runtime-worker.js +756 -756
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.js +1 -1
- 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.js +1 -1
- package/dist/sdk-runtime.d.ts +2 -1
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/docs/SDK_EMBEDDER_GUIDE.md +144 -110
- package/package.json +1 -1
- package/dist/chunks/argument-completer-C45DEO34.js +0 -2
- package/dist/chunks/chunk-PP53SIIL.js +0 -5
- package/dist/chunks/compaction-config-QYCDOW3Q.js +0 -2
- package/dist/chunks/host-KS4TJKWQ.js +0 -2
- package/dist/chunks/run-manager-L7MKGQNX.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,68 @@ All notable changes to this project will be documented in this file.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.7.76] - 2026-07-25
|
|
10
|
+
|
|
11
|
+
> Git tag and GitHub Release are published by the release workflow. npm
|
|
12
|
+
> publication remains the operator's final manual step.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **Kimi Code defaults to the official K3 256K route.** The `kimi-code`
|
|
17
|
+
provider now defaults to `k3-256k` and sends that exact upstream model ID.
|
|
18
|
+
`kimi-for-coding` remains selectable for K2.7 Code, alongside
|
|
19
|
+
`kimi-for-coding-highspeed` and the 1M `k3` tier. K3 now exposes the
|
|
20
|
+
documented `low` / `high` / `max` reasoning levels with `high` as default;
|
|
21
|
+
media metadata marks `k3-256k` as image-capable but not video-capable, and
|
|
22
|
+
nominal subscription accounting reflects the 1M `k3` route's roughly 2x
|
|
23
|
+
quota consumption.
|
|
24
|
+
|
|
25
|
+
### Verification
|
|
26
|
+
|
|
27
|
+
- Added direct live-wire smoke coverage for all four Kimi Code subscription
|
|
28
|
+
routes: `k3-256k`, `k3`, `kimi-for-coding`, and
|
|
29
|
+
`kimi-for-coding-highspeed`.
|
|
30
|
+
|
|
31
|
+
## [0.7.75] - 2026-07-24
|
|
32
|
+
|
|
33
|
+
> The npm package was published manually. The `v0.7.75` Git tag and GitHub
|
|
34
|
+
> Release were skipped; the binary-release changes roll into `v0.7.76`.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- **Exact audited npm candidate bytes.** The release script now packs first,
|
|
39
|
+
audits the generated Sidecar prompt and budget bridge, and publishes that
|
|
40
|
+
exact tarball so SDK validation and registry publication cannot drift.
|
|
41
|
+
- **Windows GUI background-process hardening.** Runtime
|
|
42
|
+
Worker-reachable non-interactive child processes now request hidden Windows
|
|
43
|
+
consoles across memory/Git metadata, provider CLI and ACP, LSP, clipboard,
|
|
44
|
+
worktree, review, extension-command, checkpoint, and sandbox paths. Explicit
|
|
45
|
+
editor, terminal, and PTY interaction remains unchanged.
|
|
46
|
+
- **Published Runtime Worker audit and packaged-host regression.** The bundle
|
|
47
|
+
build now audits statically identifiable child-process calls in the published
|
|
48
|
+
Runtime Worker, and the packaged Electron daemon smoke runs 20 ordinary
|
|
49
|
+
queries with a Win32 console-visibility probe. Packaged KodaX Space validation
|
|
50
|
+
on Windows 10 and Windows 11 remains a non-blocking product follow-up; it does
|
|
51
|
+
not gate the tag, package build, or npm publication.
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- **Sidecar completion and Runtime terminal semantics.** Optional work offered
|
|
56
|
+
after the current request is complete is accepted rather than reported as
|
|
57
|
+
blocked; only clarification required to finish the current request remains
|
|
58
|
+
blocked. Budget-approval state is emitted only for an eligible `revise`, and
|
|
59
|
+
structured blocked codes and reasons survive live events, persistence,
|
|
60
|
+
daemon round trips, and restart recovery.
|
|
61
|
+
|
|
62
|
+
### Documentation
|
|
63
|
+
|
|
64
|
+
- Updated the release guide, current architecture/design baselines, SDK
|
|
65
|
+
embedder guidance, feature index, roadmap, issue tracker, English/Chinese
|
|
66
|
+
READMEs, and the v0.7.75 regression guide for the SDK validation candidate.
|
|
67
|
+
- Rescheduled FEATURE_263 from v0.7.75 to v0.7.77 and then to v0.7.78; moved
|
|
68
|
+
FEATURE_274 from v0.7.76 to v0.7.77. v0.7.75 and v0.7.76 remain feature-free
|
|
69
|
+
stabilization releases.
|
|
70
|
+
|
|
9
71
|
## [0.7.74] - 2026-07-23
|
|
10
72
|
|
|
11
73
|
> Git tag and GitHub Release are published by the release workflow. npm
|
package/README.md
CHANGED
|
@@ -385,6 +385,26 @@ hosts that disable it must start the daemon through ordinary Node/KodaX CLI and
|
|
|
385
385
|
connect in attach-only mode. For SDK calls, `homeDir` is the CLI-style base
|
|
386
386
|
directory that owns `.kodax`, not the `.kodax` path itself.
|
|
387
387
|
|
|
388
|
+
**v0.7.75 Windows GUI stabilization candidate:** Runtime Worker-reachable
|
|
389
|
+
non-interactive subprocesses request hidden Windows consoles across memory/Git,
|
|
390
|
+
provider CLI/ACP, LSP, clipboard, worktree, review, extension-command,
|
|
391
|
+
checkpoint, and sandbox paths. Explicit editor, terminal, and PTY behavior is
|
|
392
|
+
unchanged. The SDK bundle includes a static child-process audit and a packaged
|
|
393
|
+
Electron 20-query console-visibility regression. Product-level packaged KodaX
|
|
394
|
+
Space verification remains useful but does not gate SDK packaging or
|
|
395
|
+
publication.
|
|
396
|
+
|
|
397
|
+
The same candidate distinguishes optional post-completion offers from
|
|
398
|
+
clarification required to finish the current request, emits budget-approval
|
|
399
|
+
state only for eligible Sidecar revisions, and preserves structured blocked
|
|
400
|
+
reasons across embedded and daemon Runtime boundaries.
|
|
401
|
+
|
|
402
|
+
**v0.7.76 Kimi Code catalog refresh:** `kimi-code` now defaults to the official
|
|
403
|
+
`k3-256k` Model ID and sends it unchanged. `kimi-for-coding` remains selectable
|
|
404
|
+
for K2.7 Code, alongside `kimi-for-coding-highspeed` and the 1M `k3` tier. K3
|
|
405
|
+
supports `low` / `high` / `max` reasoning with `high` as default; the 256K
|
|
406
|
+
route supports image input but not video input.
|
|
407
|
+
|
|
388
408
|
One daemon owns many sessions. Different sessions may run concurrently; starts
|
|
389
409
|
within the same session are queued so that only one run is active for that
|
|
390
410
|
session. Multiple `kodax` processes can attach to the same daemon and open or
|
|
@@ -1279,7 +1299,7 @@ await runInkInteractiveMode({ provider: 'zhipu-coding', effort: 'auto' });
|
|
|
1279
1299
|
| anthropic | `ANTHROPIC_API_KEY` | Native | claude-sonnet-4-6 (`claude-opus-4-6` / `claude-haiku-4-5` via `/model`) |
|
|
1280
1300
|
| openai | `OPENAI_API_KEY` | Native | gpt-5.3-codex (`gpt-5.4` / `gpt-5.3-codex-spark` via `/model`) |
|
|
1281
1301
|
| kimi | `KIMI_API_KEY` | Native | kimi-k2.7-code (262,144-token context; `kimi-k2.7-code-highspeed` / `kimi-k2.6` / `kimi-k2.5` via `/model`) |
|
|
1282
|
-
| kimi-code | `KIMI_CODE_API_KEY` | Native |
|
|
1302
|
+
| kimi-code | `KIMI_CODE_API_KEY` | Native | k3-256k (Moderato+, 256K, direct upstream ID; `k3` 1M / `kimi-for-coding` K2.7 Code / `kimi-for-coding-highspeed` via `/model`) |
|
|
1283
1303
|
| qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
|
|
1284
1304
|
| qwen-token-plan | `QWEN_TOKEN_API_KEY` | Native | qwen3.8-max-preview (Anthropic-compat; `qwen3.7-max` / `qwen3.7-plus` / `qwen3.6-flash` / `glm-5.2` / `deepseek-v4-pro` via `/model`; all 1M context; image input on Qwen 3.8 / 3.7 Plus / 3.6 Flash) |
|
|
1285
1305
|
| zhipu | `ZHIPU_API_KEY` | Native | glm-5 (`glm-5.2` 1M ctx / `glm-5.1` / `glm-5-turbo` via `/model`) |
|
package/README_CN.md
CHANGED
|
@@ -91,6 +91,22 @@ daemon,不会再次打开 GUI。`ELECTRON_RUN_AS_NODE` 只存在于子进程
|
|
|
91
91
|
再使用 attach-only 模式连接。SDK 的 `homeDir` 是拥有 `.kodax` 的 CLI 风格基础目录,
|
|
92
92
|
不是 `.kodax` 目录本身。
|
|
93
93
|
|
|
94
|
+
**v0.7.75 Windows GUI 稳定性候选版**:Runtime Worker 可达的非交互后台子进程
|
|
95
|
+
在 Windows 上统一请求隐藏控制台,覆盖 memory/Git、provider CLI/ACP、LSP、
|
|
96
|
+
clipboard、worktree、review、extension command、checkpoint 与 sandbox 路径;
|
|
97
|
+
显式 editor、terminal 和 PTY 行为保持不变。SDK bundle 增加静态子进程审计,
|
|
98
|
+
packaged Electron 回归连续执行 20 次普通查询并检查控制台可见性。KodaX Space
|
|
99
|
+
产品级验证仍然有价值,但不阻塞 SDK 打包、tag 或 npm 发布。
|
|
100
|
+
|
|
101
|
+
同一候选版还会区分“当前请求完成后的可选后续工作”和“完成当前请求所必需的
|
|
102
|
+
澄清”,只为符合资格的 Sidecar `revise` 发布预算审批状态,并在 embedded 与
|
|
103
|
+
daemon Runtime 边界保留结构化 blocked 原因。
|
|
104
|
+
|
|
105
|
+
**v0.7.76 Kimi Code 模型目录更新**:`kimi-code` 现在默认使用官方
|
|
106
|
+
`k3-256k` Model ID,并直接发送该同名 ID。`kimi-for-coding` 继续作为 K2.7 Code
|
|
107
|
+
可选模型,同时保留 `kimi-for-coding-highspeed` 与 1M `k3` tier。K3 支持
|
|
108
|
+
`low` / `high` / `max` 思考强度,默认 `high`;256K 路由支持图片但不支持视频输入。
|
|
109
|
+
|
|
94
110
|
**v0.7.72–v0.7.73 Runtime 权限契约:**Auto Mode 的权限决策由 Runtime Session 持有,
|
|
95
111
|
不再由 UI hook 抢先决定。Runtime 会跨 turn 复用 LLM/rules guardrail,先分类、
|
|
96
112
|
仅在 `escalate` 时创建共享 permission 请求,并把自动降级到 rules 的结果持久化到
|
|
@@ -498,7 +514,7 @@ dist/binary/linux-x64/
|
|
|
498
514
|
| anthropic | `ANTHROPIC_API_KEY` | Native | claude-sonnet-4-6(可 `/model` 切换 `claude-opus-4-6` / `claude-haiku-4-5`) |
|
|
499
515
|
| openai | `OPENAI_API_KEY` | Native | gpt-5.3-codex(可 `/model` 切换 `gpt-5.4` / `gpt-5.3-codex-spark`) |
|
|
500
516
|
| kimi | `KIMI_API_KEY` | Native | kimi-k2.7-code(262,144 token;可 `/model` 切换 `kimi-k2.7-code-highspeed` / `kimi-k2.6` / `kimi-k2.5`) |
|
|
501
|
-
| kimi-code | `KIMI_CODE_API_KEY` | Native |
|
|
517
|
+
| kimi-code | `KIMI_CODE_API_KEY` | Native | k3-256k(Moderato+,256K,直接请求同名上游模型;可 `/model` 切换 `k3`〔Allegretto+,1M〕/ `kimi-for-coding`〔K2.7 Code〕/ `kimi-for-coding-highspeed`) |
|
|
502
518
|
| qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
|
|
503
519
|
| qwen-token-plan | `QWEN_TOKEN_API_KEY` | Native | qwen3.8-max-preview(Anthropic 协议;可 `/model` 切换 `qwen3.7-max` / `qwen3.7-plus` / `qwen3.6-flash` / `glm-5.2` / `deepseek-v4-pro`;均为 1M ctx;Qwen 3.8 / 3.7 Plus / 3.6 Flash 支持图片理解) |
|
|
504
520
|
| zhipu | `ZHIPU_API_KEY` | Native | glm-5(可 `/model` 切换 `glm-5.2` 1M ctx / `glm-5.1` / `glm-5-turbo`) |
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{Ea as i,Ka as j,da as d,ea as e,fa as f,j as c,ua as g,wa as h}from"./chunk-
|
|
2
|
+
import{Ea as i,Ka as j,da as d,ea as e,fa as f,j as c,ua as g,wa as h}from"./chunk-OD6LVXU6.js";import"./chunk-IDCGNQ4H.js";import"./chunk-PXKSE54E.js";import"./chunk-7FJNLJLF.js";import"./chunk-D3T24FJW.js";import{sb as a,tb as b}from"./chunk-VWSLC2WO.js";import"./chunk-Y3AMP22L.js";import"./chunk-COQYLD4U.js";import"./chunk-EI4JBQKL.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,j as runKodaX,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{Ja as a,Ka as b}from"./chunk-HS3XHF3R.js";import"./chunk-4PWPNCNK.js";import"./chunk-RDXRM3UI.js";import"./chunk-TGMBHGZO.js";import"./chunk-SMT2JSM3.js";import"./chunk-OSF3H4RR.js";import"./chunk-OD6LVXU6.js";import"./chunk-IDCGNQ4H.js";import"./chunk-PXKSE54E.js";import"./chunk-7FJNLJLF.js";import"./chunk-D3T24FJW.js";import"./chunk-VWSLC2WO.js";import"./chunk-Y3AMP22L.js";import"./chunk-COQYLD4U.js";import"./chunk-EI4JBQKL.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{T as xe,V as be}from"./chunk-
|
|
2
|
+
import{T as xe,V as be}from"./chunk-OD6LVXU6.js";import{C as z,Ca as W,F as V,G as ue,H as q,Ma as ve,Qa as ye,ma as de,na as fe,oa as pe,pa as me,q as le,qa as ge,ra as H,ya as he,za as C}from"./chunk-D3T24FJW.js";import{Fa as Ee}from"./chunk-VWSLC2WO.js";import{e as we}from"./chunk-Y3AMP22L.js";import{a as o}from"./chunk-ONUPGMER.js";import u from"fs";import p from"path";import{exec as tt,spawnSync as nt}from"child_process";import{promisify as rt}from"util";import{fileURLToPath as ot}from"url";var J="en";function Ue(){return(process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"").toLowerCase().startsWith("zh")?"zh":"en"}o(Ue,"detectSystemLocale");function Se(e){if(!e||e==="auto"){J=Ue();return}J=e.toLowerCase().replace(/[-_].*/,"")==="zh"?"zh":"en"}o(Se,"setLocale");var Pe={en:{"dialog.confirm":"[Confirm]","dialog.select":"[Select]","dialog.input":"[Input]","confirm.instruction.basic":"Press (y) yes, (n) no","confirm.instruction.always":"Press (y) yes, (a) always yes for this tool, (n) no","confirm.instruction.runtime_session":"Press (y) allow once, (s) allow this Runtime scope for the session, (n) no","confirm.instruction.runtime_persistent":"Press (y) allow once, (s) allow this Runtime scope for the session, (a) always allow this Runtime scope, (n) no","confirm.instruction.protected":"Press (y) to confirm, (n) to cancel (protected path)","confirm.result.approved":"Approved","confirm.result.approved_always":"Approved (always)","confirm.result.approved_session":"Approved (this session)","confirm.result.denied":"Denied","tool.bash.title":"Execute bash command?","tool.shell.title":"Execute shell command?","tool.write.title":"Write to file?","tool.edit.title":"Edit file?","tool.generic.title":"Execute {tool}?","field.reason":"Reason","field.intent":"Intent","field.target":"Target","field.scope":"Scope","field.risk":"Risk","field.summary":"Summary","intent.read":"Read project files","intent.delete":"Delete files","intent.deps":"Modify dependencies or environment","intent.modify":"Modify files","intent.execute":"Execute command","intent.write_file":"Write file","intent.edit_file":"Edit file","intent.use_tool":"Use {tool}","risk.destructive":"Destructive change","risk.deps":"May change dependencies or local tools","risk.modify":"May modify files","risk.unknown":"Command effects depend on its arguments","risk.network":"May access network","scope.outside":"Outside project","scope.protected":"Protected path","waiting.confirm":"Waiting: approval required","waiting.select":"Waiting: choose an option","waiting.input":"Waiting: answer the prompt","placeholder.confirm":"Respond to the approval prompt above...","placeholder.select":"Choose an option above...","placeholder.input":"Answer the prompt above...","placeholder.busy":"Agent is busy...","placeholder.queue":"Queue a follow-up for the next round...","placeholder.idle":"Type a message...","select.choice":"Choice:","select.type_number":"(type a number)","select.more":"{count} more choices...","select.more_above":"\u2191 {count} more above","select.more_below":"\u2193 {count} more below","select.confirm_hint":"Press Enter to confirm, Esc to cancel","select.navigate_hint":"Use \u2191\u2193 to navigate, Enter to confirm, Esc to cancel","select.multiselect_hint":"Use \u2191\u2193 to navigate, Space to toggle, Enter to confirm, Esc to cancel","select.multiselect_empty":"Select at least one option with Space before confirming.","select.multiselect_min":"Select at least {min} option(s) with Space before confirming.","select.multiselect_max":"Select at most {max} option(s) with Space before confirming.","select.back_prev":"\u2190 Back to previous question","input.default":"Default:","input.value":"Value:","input.type_response":"(type your response)","managed.completed":"Task completed","managed.completed.blocked":"Task blocked","managed.completed.continuation":"Task needs continuation",cancelled:"[Cancelled] Operation cancelled by user"},zh:{"dialog.confirm":"[\u786E\u8BA4]","dialog.select":"[\u9009\u62E9]","dialog.input":"[\u8F93\u5165]","confirm.instruction.basic":"\u6309 (y) \u786E\u8BA4, (n) \u62D2\u7EDD","confirm.instruction.always":"\u6309 (y) \u786E\u8BA4, (a) \u59CB\u7EC8\u5141\u8BB8\u6B64\u5DE5\u5177, (n) \u62D2\u7EDD","confirm.instruction.runtime_session":"\u6309 (y) \u4EC5\u5141\u8BB8\u4E00\u6B21, (s) \u672C\u4F1A\u8BDD\u59CB\u7EC8\u5141\u8BB8\u8FD9\u9879\u7CBE\u786E\u64CD\u4F5C, (n) \u62D2\u7EDD","confirm.instruction.runtime_persistent":"\u6309 (y) \u4EC5\u5141\u8BB8\u4E00\u6B21, (s) \u672C\u4F1A\u8BDD\u59CB\u7EC8\u5141\u8BB8\u8FD9\u9879\u7CBE\u786E\u64CD\u4F5C, (a) \u59CB\u7EC8\u5141\u8BB8\u8FD9\u9879\u7CBE\u786E\u64CD\u4F5C, (n) \u62D2\u7EDD","confirm.instruction.protected":"\u6309 (y) \u786E\u8BA4, (n) \u53D6\u6D88 (\u53D7\u4FDD\u62A4\u8DEF\u5F84)","confirm.result.approved":"\u5DF2\u6279\u51C6","confirm.result.approved_always":"\u5DF2\u6279\u51C6 (\u59CB\u7EC8\u5141\u8BB8)","confirm.result.approved_session":"\u5DF2\u6279\u51C6 (\u672C\u4F1A\u8BDD)","confirm.result.denied":"\u5DF2\u62D2\u7EDD","tool.bash.title":"\u6267\u884C bash \u547D\u4EE4\uFF1F","tool.shell.title":"\u6267\u884C shell \u547D\u4EE4\uFF1F","tool.write.title":"\u5199\u5165\u6587\u4EF6\uFF1F","tool.edit.title":"\u7F16\u8F91\u6587\u4EF6\uFF1F","tool.generic.title":"\u6267\u884C {tool}\uFF1F","field.reason":"\u539F\u56E0","field.intent":"\u610F\u56FE","field.target":"\u76EE\u6807","field.scope":"\u8303\u56F4","field.risk":"\u98CE\u9669","field.summary":"\u6458\u8981","intent.read":"\u8BFB\u53D6\u9879\u76EE\u6587\u4EF6","intent.delete":"\u5220\u9664\u6587\u4EF6","intent.deps":"\u4FEE\u6539\u4F9D\u8D56\u6216\u73AF\u5883","intent.modify":"\u4FEE\u6539\u6587\u4EF6","intent.execute":"\u6267\u884C\u547D\u4EE4","intent.write_file":"\u5199\u5165\u6587\u4EF6","intent.edit_file":"\u7F16\u8F91\u6587\u4EF6","intent.use_tool":"\u4F7F\u7528 {tool}","risk.destructive":"\u7834\u574F\u6027\u53D8\u66F4","risk.deps":"\u53EF\u80FD\u4FEE\u6539\u4F9D\u8D56\u6216\u672C\u5730\u5DE5\u5177","risk.modify":"\u53EF\u80FD\u4FEE\u6539\u6587\u4EF6","risk.unknown":"\u547D\u4EE4\u6548\u679C\u53D6\u51B3\u4E8E\u53C2\u6570","risk.network":"\u53EF\u80FD\u8BBF\u95EE\u7F51\u7EDC","scope.outside":"\u9879\u76EE\u5916\u90E8","scope.protected":"\u53D7\u4FDD\u62A4\u8DEF\u5F84","waiting.confirm":"\u7B49\u5F85\u4E2D\uFF1A\u9700\u8981\u5BA1\u6279","waiting.select":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u9009\u62E9","waiting.input":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u56DE\u7B54","placeholder.confirm":"\u8BF7\u56DE\u5E94\u4E0A\u65B9\u7684\u5BA1\u6279\u63D0\u793A...","placeholder.select":"\u8BF7\u5728\u4E0A\u65B9\u9009\u62E9\u4E00\u4E2A\u9009\u9879...","placeholder.input":"\u8BF7\u56DE\u7B54\u4E0A\u65B9\u7684\u63D0\u793A...","placeholder.busy":"\u667A\u80FD\u4F53\u6B63\u5728\u5DE5\u4F5C\u4E2D...","placeholder.queue":"\u6392\u961F\u7B49\u5F85\u4E0B\u4E00\u8F6E\u8DDF\u8FDB...","placeholder.idle":"\u8F93\u5165\u6D88\u606F...","select.choice":"\u9009\u9879\uFF1A","select.type_number":"(\u8F93\u5165\u7F16\u53F7)","select.more":"\u8FD8\u6709 {count} \u4E2A\u9009\u9879...","select.more_above":"\u2191 \u4E0A\u65B9\u8FD8\u6709 {count} \u4E2A","select.more_below":"\u2193 \u4E0B\u65B9\u8FD8\u6709 {count} \u4E2A","select.confirm_hint":"\u6309 Enter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.navigate_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0C\u7A7A\u683C \u5207\u6362\u9009\u4E2D\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_empty":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u9009\u9879\u3002","select.multiselect_min":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u81F3\u5C11\u9009\u62E9 {min} \u4E2A\u9009\u9879\u3002","select.multiselect_max":"\u6700\u591A\u53EA\u80FD\u9009\u62E9 {max} \u4E2A\u9009\u9879\u3002","select.back_prev":"\u2190 \u8FD4\u56DE\u4E0A\u4E00\u9898","input.default":"\u9ED8\u8BA4\u503C\uFF1A","input.value":"\u503C\uFF1A","input.type_response":"(\u8F93\u5165\u4F60\u7684\u56DE\u7B54)","managed.completed":"\u4EFB\u52A1\u5B8C\u6210","managed.completed.blocked":"\u4EFB\u52A1\u53D7\u963B","managed.completed.continuation":"\u4EFB\u52A1\u9700\u8981\u7EE7\u7EED",cancelled:"[\u5DF2\u53D6\u6D88] \u64CD\u4F5C\u5DF2\u88AB\u7528\u6237\u53D6\u6D88"}};function Dt(e,t){let r=Pe[J][e]??Pe.en[e]??e;if(t)for(let[i,s]of Object.entries(t))r=r.replace(`{${i}}`,String(s));return r}o(Dt,"t");var _e={core:`// KodaX core configuration template.
|
|
3
3
|
// Copy only the fields you need to ~/.kodax/config.json (strict JSON).
|
|
4
4
|
// MCP, A2A, and Extensions live in ~/.kodax/integrations/*.json; use
|
|
5
5
|
// \`kodax integrations migrate --dry-run\` for legacy declarations.
|
|
@@ -153,6 +153,6 @@ import{T as xe,V as be}from"./chunk-XM724XAA.js";import{C as z,Ca as H,F as V,G
|
|
|
153
153
|
"version": 1,
|
|
154
154
|
"paths": []
|
|
155
155
|
}
|
|
156
|
-
`};function Ce(e){return _e[e]}o(Ce,"getConfigTemplate");import{closeSync as Y,existsSync as m,fsyncSync as Oe,mkdirSync as ee,openSync as te,readFileSync as Ie,renameSync as Re,statSync as Ge,unlinkSync as Q,watch as ze,writeFileSync as De}from"node:fs";import{createHash as Ve}from"node:crypto";import g from"node:path";var qe={mcp:"mcp.json",a2a:"a2a.json",extensions:"extensions.json"},
|
|
157
|
-
`,"utf8"),Oe(i)}finally{Y(i)}try{Re(r,n)}catch(s){throw m(r)&&Q(r),new Error("Failed to atomically clean legacy integration fields.",{cause:s})}}o(Ye,"writeCoreConfigAtomically");function Ft(e){let t=Be(e.configHome),n=N(e.configHome),r=[];t.mcp.action==="create"&&(O({domain:"mcp",configHome:e.configHome,document:{version:1,servers:
|
|
158
|
-
`,a=`${t}.${process.pid}.${Date.now()}.tmp`,l=te(a,"wx",384);try{De(l,s,"utf8"),Oe(l)}finally{Y(l)}try{Re(a,t)}catch(c){throw m(a)&&Q(a),new Error(`Failed to atomically replace ${g.basename(t)}.`,{cause:c})}return A({domain:e.domain,source:"user",path:t,raw:s,document:n})}finally{Y(r.fd),m(r.path)&&Q(r.path)}}o(O,"writeIntegrationDocument");function Me(e){if(!m(e))return"missing";let t=Ge(e);return`${t.dev}:${t.ino}:${t.size}:${t.mtimeMs}`}o(Me,"metadataSignature");function L(e,t){return{code:e,message:t,time:new Date().toISOString()}}o(L,"safeDiagnostic");var Ae=class{static{o(this,"IntegrationConfigController")}#a;#r;#c;#l;#e;#t;#u="";#o;#n;#i;#d=Promise.resolve();#s=new Set;constructor(t){this.#a=t.domain,this.#r=P(t.domain,t.configHome),this.#l=t.validate,this.#c=t.read}async initialize(){let t=await this.reload();if(!t.ok||!this.#e)throw new Error(t.ok?"Integration configuration did not produce a snapshot.":t.error);return structuredClone(this.#e)}snapshot(){return this.#e?structuredClone(this.#e):void 0}status(){return{domain:this.#a,path:this.#r,...this.#e?{revision:this.#e.revision,source:this.#e.source,lastReloadAt:this.#e.loadedAt}:{},...this.#t?{diagnostic:this.#t}:{},watching:this.#o!==void 0}}subscribe(t){return this.#s.add(t),()=>{this.#s.delete(t)}}reload(){let t=this.#d.then(()=>this.#f());return this.#d=t.then(()=>{},()=>{}),t}async#f(){this.#u=Me(this.#r);let t;try{t=this.#c(),this.#l(t.document)}catch{return this.#t=L("invalid-config","Integration configuration is invalid; check the file against its versioned schema."),{ok:!1,error:this.#t.message}}let n=this.#e?structuredClone(this.#e):void 0;try{for(let r of this.#s)await r(structuredClone(t),n)}catch{return this.#t=L("activation-failed","Integration configuration could not be activated; the previous configuration remains active."),{ok:!1,error:this.#t.message}}return this.#e=t,this.#t=void 0,{ok:!0,snapshot:structuredClone(t)}}async ensureCurrent(){return Me(this.#r)===this.#u&&this.#e?{ok:!0,snapshot:structuredClone(this.#e)}:this.reload()}startWatching(t=100,n=2e3){if(!(this.#o||this.#i)){ee(g.dirname(this.#r),{recursive:!0,mode:448});try{this.#o=ze(g.dirname(this.#r),(r,i)=>{i!==null&&i.toString()!==g.basename(this.#r)||(this.#n&&clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#n=void 0,this.reload()},t),this.#n.unref?.())}),this.#o.unref(),this.#o.on("error",()=>{this.#t=L("watcher-degraded","Integration watcher is degraded; metadata polling remains active.")})}catch{this.#t=L("watcher-degraded","Integration watcher is degraded; metadata polling remains active.")}this.#i=setInterval(()=>{this.ensureCurrent()},n),this.#i.unref?.()}}close(){this.#n&&clearTimeout(this.#n),this.#n=void 0,this.#i&&clearInterval(this.#i),this.#i=void 0,this.#o?.close(),this.#o=void 0,this.#s.clear()}};var it=rt(tt),st=2,Ne=!1,d=Ee(),tn=p.join(d,"sessions"),f=p.join(d,"config.json"),nn=60,h=null,ie=!1,at="dumb";function ct(e){let t=p.basename(e).toLowerCase(),n="__KODAX_SHELL_ENV_START__",r=`printf '%s\\0' '${n}'; env -0`;return t==="fish"?{args:["-i","-c",r],sentinel:n}:{args:t==="bash"||t==="zsh"?["-ic",r]:["-lc",r],sentinel:n}}o(ct,"buildShellEnvCommand");function lt(e,t){let n=`${t}\0`,r=e.lastIndexOf(n);if(r===-1)return{};let i=e.slice(r+n.length),s={};for(let a of i.split("\0")){if(!a)continue;let l=a.indexOf("=");l<=0||(s[a.slice(0,l)]=a.slice(l+1))}return s}o(lt,"parseNullDelimitedShellEnv");function ut(e={}){let t=e.env??process.env;if((e.platform??process.platform)==="win32"||t.KODAX_DISABLE_SHELL_ENV_HYDRATION==="1")return!1;let r=e.shell??t.SHELL;if(!r||!p.isAbsolute(r))return!1;let{args:i,sentinel:s}=ct(r),a=e.run??nt,l={...t,TERM:at},c=a(r,i,{encoding:"utf8",env:l,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(c.status!==0||!c.stdout)return!1;let b=typeof c.stdout=="string"?c.stdout:c.stdout.toString("utf8"),R=lt(b,s),D=!1;for(let[G,Fe]of Object.entries(R))G!=="TERM"&&t[G]===void 0&&(t[G]=Fe,D=!0);return D}o(ut,"hydrateProcessEnvFromShell");function dt(){if(!ie){ie=!0;try{ut()}catch{}}}o(dt,"ensureShellEnvironmentHydrated");function rn(){ie=!1}o(rn,"resetShellEnvironmentHydrationForTesting");function ft(e){he(e.customProviders??[])}o(ft,"registerConfiguredCustomProviders");function se(e){if(!Array.isArray(e))return;let t=e.filter(n=>typeof n=="string").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:[]}o(se,"normalizeConfiguredExtensions");function pt(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{u.mkdirSync(p.dirname(f),{recursive:!0}),u.writeFileSync(f,JSON.stringify(t,null,2))}catch{}return t}o(pt,"migrateLegacyPermissionModeInConfig");function mt(e){if(e.permissionMode!=="auto-in-project")return e;try{let t=u.readFileSync(f,"utf-8"),n=t.replace(/("permissionMode"\s*:\s*)"auto-in-project"/,'$1"auto"');n!==t&&u.writeFileSync(f,n)}catch{}return{...e,permissionMode:"auto"}}o(mt,"migrateAutoInProjectAliasInConfig");function gt(){if(h)return h;let e="0.7.74";if(e)return h=e,h;let t=p.join(p.dirname(ot(import.meta.url)),"../../package.json");if(u.existsSync(t))try{return h=JSON.parse(u.readFileSync(t,"utf-8")).version??"0.0.0",h??"0.0.0"}catch{}return h="0.0.0",h}o(gt,"getVersion");var on=gt();function ht(e){return fe(e)}o(ht,"getProviderModel");function ae(e,t){let n=new Set(e.map(i=>i.toLowerCase())),r=[...e];for(let i of t)n.has(i.toLowerCase())||r.push(i);return r}o(ae,"mergeModels");function vt(e,t){t||(t=ce().providerModels);let n=t?.[e];if(n&&n.length>0){try{let r=W(e);if(r.length>0)return ae(n,r)}catch{}try{let r=C(e);if(r)return ae(n,r.getAvailableModels())}catch{}return n}try{let r=W(e);if(r.length>0)return r}catch{}try{let r=C(e);if(r)return r.getAvailableModels()}catch{}return[]}o(vt,"getProviderAvailableModels");function yt(e,t){let n=pe(e,t);if(n!=="unknown")return n;try{let r=C(e);if(r)return r.getReasoningCapability(t)}catch{}return"unknown"}o(yt,"getProviderReasoningCapability");function Et(e){let t=me(e);if(t)return t;try{return H().find(r=>r.name===e)?.capabilityProfile??null}catch{return null}}o(Et,"getProviderCapabilityProfile");function je(e,t){let n=Et(e),r=yt(e,t);if(n)return{capabilityProfile:n,reasoningCapability:r};try{let i=ve(e);return{capabilityProfile:i.getCapabilityProfile(),reasoningCapability:i.getReasoningCapability(t)}}catch{return null}}o(je,"getProviderCapabilityMetadata");function sn(e,t){let n=je(e,t);return n?xe({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}o(sn,"getProviderCapabilitySnapshot");function wt(e,t,n,r){let i=je(e,t);return i?be({providerName:e,model:t,capabilityProfile:i.capabilityProfile,reasoningCapability:i.reasoningCapability==="unknown"?void 0:i.reasoningCapability,reasoningMode:n,hints:r}):null}o(wt,"getProviderPolicyDecision");function an(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"forwards only the latest user message":"preserves full conversation history",r=e.mcpSupport==="native"?"MCP available":"MCP unavailable";return`${t}; ${n}; ${r}`}o(an,"describeProviderCapabilitySummary");function cn(e){switch(e){case"native-budget":return"B";case"native-effort":return"E";case"native-toggle":return"T";case"native-adaptive":return"A";default:return"-"}}o(cn,"formatReasoningCapabilityShort");function _(e){if(e)return e==="none"?"off":e}o(_,"formatReasoningEffortForDisplay");function X(e,t){let n=_(t);n&&!e.includes(n)&&e.push(n)}o(X,"pushUniqueEffortDisplay");function ln(e,t){let n=["auto"],i=U(e,t)?.supportedEfforts?.filter(s=>s.isUserVisible!==!1);if(!i||i.length===0){for(let s of["off","low","medium","high"])X(n,s);return n}for(let s of i)X(n,s.value);return n}o(ln,"getProviderReasoningEffortOptions");function un(e,t){let n=U(e,t),r=new Set(n?.disabledEfforts??[]),i=n?.supportedEfforts?.filter(c=>c.isUserVisible!==!1),s=[],a=n?.supportsDisabledThinking===!0;if(!i||i.length===0){for(let c of["low","medium","high"])X(s,c);a=!0}else for(let c of i){if(c.value==="none"){a=!0;continue}if(r.has(c.value)){a=!0;continue}X(s,c.value)}let l=[];return a&&l.push("off"),l.push(...s),l.push("auto"),l}o(un,"getProviderReasoningEffortCycle");function xt(e,t){if(t===!1)return"off";switch(e){case"off":return"off";case"quick":return"low";case"balanced":return"medium";case"deep":return"high";default:return"auto"}}o(xt,"legacyReasoningModeToEffortDisplay");function U(e,t){let n=t??ht(e);if(!n)return;let r=ye(e,n)?.reasoningProfile;if(r)return le(r,we(e,n))}o(U,"resolveReasoningProfileForDisplay");function dn(e){let t=_(e.effort)??xt(e.reasoningMode,e.thinking),n=U(e.provider,e.model);if(!n)return t;try{let r=ue({capability:n,explicitEffort:e.effortOverride?e.effort:void 0,sessionEffort:e.effortOverride?void 0:e.effort,legacyReasoningMode:e.reasoningMode,thinking:e.thinking}),i=_(r.configuredEffort)??t,a=r.configuredEffort!==void 0&&n.disabledEfforts?.includes(r.configuredEffort)===!0?"off":_(r.effectiveEffort);return a&&a!==i?`${i}->${a}`:i}catch{if(e.effort)try{let r=q({currentEffort:e.effort,capability:n}),i=_(e.effort)??t,s=_(r.effectiveEffort);return s&&s!==i?`${i}->${s}`:i}catch{return t}return t}}o(dn,"formatReasoningEffortStatusLabel");function fn(e){let t=It(e);if(!t)return{preserved:!0};let n=U(e.provider,e.model);if(!n)return{configuredEffort:t,runtimeEffort:t,preserved:!0};let r=q({currentEffort:t,capability:n});return{configuredEffort:t,runtimeEffort:r.effectiveEffort,preserved:r.preserved,diagnostic:r.diagnostic}}o(fn,"resolveProviderReasoningRuntimeEffort");function bt(e){switch(e){case"native-budget":return"budget";case"native-effort":return"effort";case"native-toggle":return"toggle";case"native-adaptive":return"adaptive";default:return"none"}}o(bt,"describeReasoningCapabilityControl");function pn(e,t){if(e==="off")return"Reasoning disabled";switch(t){case"native-budget":return"Uses native thinking budget control";case"native-effort":return"Uses native reasoning effort control";case"native-toggle":return"Uses provider-native thinking toggle only";case"native-adaptive":return"Model adaptively decides thinking depth (Opus 4.7+)";case"none":return"Runs without native reasoning parameters";case"prompt-only":return"Uses prompt overlays only; no native reasoning parameter";default:return"Runs without native reasoning parameters"}}o(pn,"describeReasoningExecution");function mn(e){let t=[];e||(e=ce().providerModels);for(let n of ge())t.push({name:n.name,model:n.model,models:vt(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=H().map(r=>({...r,models:(()=>{let i=e?.[r.name];return i&&i.length>0?ae(i,r.models):r.models})()}));t.push(...n)}catch{}return t}o(mn,"getProviderList");function gn(e){if(de(e))return!0;try{return C(e)?.isConfigured()??!1}catch{return!1}}o(gn,"isProviderConfigured");var F=class extends Error{static{o(this,"InvalidAgentModeConfigError")}};function Pt(e){let t=e.agentMode;if(t===void 0||t==="ama"||t==="sa")return e;if(t!=="amaw"&&t!=="ama-workflow")throw new F(`Invalid agentMode "${t}" in ${f}. Expected "ama" or "sa".`);let n={...e,agentMode:"ama",schemaVersion:Math.max(e.schemaVersion??0,st)},r=`${f}.migrate-${process.pid}.tmp`;try{u.writeFileSync(r,JSON.stringify(n,null,2),{mode:384}),u.renameSync(r,f)}catch{u.rmSync(r,{force:!0})}return Ne||(process.emitWarning(`Migrated persisted agentMode "${t}" to "ama". Workflow use is now explicit intent.`,{code:"KODAX_AGENT_MODE_MIGRATED"}),Ne=!0),n}o(Pt,"migrateLegacyAgentModeConfig");function ce(){try{if(u.existsSync(f)){let n=JSON.parse(u.readFileSync(f,"utf-8")),r=Pt(n),i=r.reasoningCeiling??r.reasoningMode,s=[],a={};try{s=[...K(d).document.paths]}catch{}try{a=$(d).document.servers}catch{}return mt(pt({...r,reasoningMode:i,extensions:se(s),mcpServers:a}))}}catch(n){if(n instanceof F)throw n}let e,t;try{let n=K(d);n.source!=="default"&&(e=se([...n.document.paths]))}catch{}try{let n=$(d);n.source!=="default"&&(t=n.document.servers)}catch{}return{...e===void 0?{}:{extensions:e},...t===void 0?{}:{mcpServers:t}}}o(ce,"loadConfig");var St=p.join(d,"config.example.jsonc"),oe={mcp:p.join(d,"integrations","mcp.example.jsonc"),a2a:p.join(d,"integrations","a2a.example.jsonc"),extensions:p.join(d,"integrations","extensions.example.jsonc")},_t=[{name:"core",path:St},{name:"mcp",path:oe.mcp},{name:"a2a",path:oe.a2a},{name:"extensions",path:oe.extensions}];function Ct(){let e=[];for(let t of _t)try{if(u.existsSync(t.path))continue;u.mkdirSync(p.dirname(t.path),{recursive:!0}),u.writeFileSync(t.path,Ce(t.name),"utf8"),e.push(t.path)}catch{}return e}o(Ct,"ensureExampleConfigFiles");function hn(){return Ct()[0]}o(hn,"ensureExampleConfigFile");var j=new Map;function kt(e,t){let n=process.env[e],r=j.get(e),i=r!==void 0&&n===r;if(n!==void 0&&!i){j.delete(e);return}if(t===void 0){i&&delete process.env[e],j.delete(e);return}process.env[e]=t,j.set(e,t)}o(kt,"projectConfigEnvironment");var Xe=[{configPath:"streamIdleTimeoutMs",env:"KODAX_STREAM_IDLE_TIMEOUT_MS",value:o(e=>x(e.streamIdleTimeoutMs),"value")},{configPath:"repoIntelligenceMode",env:"KODAX_REPO_INTELLIGENCE",value:o(e=>e.repoIntelligenceMode,"value")},{configPath:"repoIntelligenceTrace",env:"KODAX_REPO_INTELLIGENCE_TRACE",value:o(e=>S(e.repoIntelligenceTrace),"value")},{configPath:"verifierLog",env:"KODAX_VERIFIER_LOG",value:o(e=>S(e.verifierLog),"value")},{configPath:"stallLog",env:"KODAX_STALL_LOG",value:o(e=>S(e.stallLog),"value")},{configPath:"fallbackProviders",env:"KODAX_FALLBACK_PROVIDERS",value:o(e=>At(e.fallbackProviders),"value")},{configPath:"fastProvider",env:"KODAX_FAST_PROVIDER",value:o(e=>v(e.fastProvider),"value")},{configPath:"fastModel",env:"KODAX_FAST_MODEL",value:o(e=>v(e.fastModel),"value")},{configPath:"deepProvider",env:"KODAX_DEEP_PROVIDER",value:o(e=>v(e.deepProvider),"value")},{configPath:"deepModel",env:"KODAX_DEEP_MODEL",value:o(e=>v(e.deepModel),"value")},{configPath:"provider",env:"KODAX_PROVIDER",value:o(e=>v(e.provider),"value")},{configPath:"effort",env:"KODAX_EFFORT",value:o(e=>v(e.effort),"value")},{configPath:"runtimeMode",env:"KODAX_RUNTIME_MODE",value:o(e=>e.runtimeMode,"value")},{configPath:"sessionRetentionDays",env:"KODAX_SESSION_RETENTION_DAYS",value:o(e=>x(e.sessionRetentionDays),"value")},{configPath:"maxOutputTokens",env:"KODAX_MAX_OUTPUT_TOKENS",value:o(e=>x(e.maxOutputTokens),"value")},{configPath:"disablePromptCache",env:"KODAX_DISABLE_PROMPT_CACHE",value:o(e=>S(e.disablePromptCache),"value")},{configPath:"lsp",env:"KODAX_LSP",value:o(e=>S(e.lsp),"value")},{configPath:"lspAutoDownload",env:"KODAX_LSP_DOWNLOAD",value:o(e=>S(e.lspAutoDownload),"value")},{configPath:"acpLogLevel",env:"KODAX_ACP_LOG",value:o(e=>v(e.acpLogLevel),"value")},{configPath:"repoIntelligence.toolWaitMs",env:"KODAX_REPO_INTELLIGENCE_TOOL_WAIT_MS",value:o(e=>x(e.repoIntelligence?.toolWaitMs),"value")},{configPath:"repoIntelligence.workerTimeoutMs",env:"KODAX_REPO_INTELLIGENCE_WORKER_TIMEOUT_MS",value:o(e=>x(e.repoIntelligence?.workerTimeoutMs),"value")},{configPath:"repoIntelligence.workerOldSpaceMb",env:"KODAX_REPO_INTELLIGENCE_WORKER_OLD_SPACE_MB",value:o(e=>x(e.repoIntelligence?.workerOldSpaceMb),"value")},{configPath:"repoIntelligence.storageDir",env:"KODAX_REPO_INTELLIGENCE_STORAGE_DIR",value:o(e=>v(e.repoIntelligence?.storageDir),"value")},{configPath:"workflow.maxConcurrency",env:"KODAX_WORKFLOW_MAX_CONCURRENCY",value:o(e=>x(e.workflow?.maxConcurrency),"value")}];function Mt(e){for(let t of Xe)kt(t.env,t.value(e))}o(Mt,"applyConfigSurfaceBridges");function v(e){return e?.trim()||void 0}o(v,"normalizedConfigString");function x(e){return typeof e=="number"&&Number.isFinite(e)?String(e):void 0}o(x,"configNumberString");function S(e){return e===void 0?void 0:e?"1":"0"}o(S,"configBooleanString");function At(e){return e?.filter(t=>t.trim().length>0).join(",")}o(At,"configStringList");var vn=[...Xe.map(({configPath:e,env:t})=>({configPath:e,env:t}))];function Ot(e){Mt(e)}o(Ot,"applyConfigEnvironment");function yn(){dt();let e=ce();return Ot(e),ft(e),Se(e.locale),e}o(yn,"prepareRuntimeConfig");function En(e){let t={};if(u.existsSync(f))try{let a=JSON.parse(u.readFileSync(f,"utf8"));a&&typeof a=="object"&&!Array.isArray(a)&&(t=a)}catch{}let{extensions:n,mcpServers:r,...i}=e,s={...t,...i};for(let a of Object.keys(i))i[a]===void 0&&delete s[a];if(u.mkdirSync(p.dirname(f),{recursive:!0}),u.writeFileSync(f,JSON.stringify(s,null,2)),n!==void 0){let a=K(d);O({domain:"extensions",configHome:d,...a.source==="user"?{expectedRevision:a.revision}:{},document:{version:1,paths:se(n)??[]},validate:M})}if(r!==void 0){let a=$(d);O({domain:"mcp",configHome:d,...a.source==="user"?{expectedRevision:a.revision}:{},document:{version:1,servers:r},validate:k})}}o(En,"saveConfig");function wn(e,t,n){return e.effort!==void 0||V(n).kind==="value"||t.effort!==void 0}o(wn,"resolveInitialEffortOverride");function y(e){return e?.trim()?e:void 0}o(y,"nonEmptySelection");function xn(e){return y(e.explicitProvider)??y(e.environmentProvider)??y(e.configuredProvider)??e.defaultProvider}o(xn,"resolveRuntimeProviderSelection");function bn(e){let t=y(e.explicitModel);if(t)return t;let n=y(e.configuredModel);if(!n)return;let r=y(e.explicitProvider)??y(e.environmentProvider);return r?y(e.configuredProvider)===r?n:void 0:n}o(bn,"resolveRuntimeModelSelection");function Pn(e){if(e.explicitEffort!==void 0)return z(e.explicitEffort);let t=V(e.environmentEffort);return t.kind==="value"?t.value:e.configuredEffort===void 0?void 0:z(e.configuredEffort)}o(Pn,"resolveRuntimeEffortSelection");function It(e){return e.permissionMode==="plan"&&e.effortOverride!==!0&&e.planModeEffort!==void 0?e.planModeEffort:e.effort}o(It,"resolvePermissionModeEffort");async function Sn(e){try{let{stdout:t}=await it("git rev-parse --show-toplevel",{cwd:e});return t.trim()}catch{return null}}o(Sn,"getGitRoot");function Rt(e){switch(e){case"builtin":return"Built-in";case"runtime":return"Runtime extension";case"custom":return"Custom config";default:return"Unknown"}}o(Rt,"formatProviderSourceKind");function _n(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"latest-user-message only":"full conversation history";return[`Source: ${Rt(e.sourceKind)}`,`Transport: ${t}`,`Conversation semantics: ${n}`,`Context fidelity: ${e.contextFidelity}`,`Tool calling: ${e.toolCallingFidelity}`,`Session behavior: ${e.sessionSupport}`,`Long-running support: ${e.longRunningSupport}`,`Evidence-heavy flows: ${e.evidenceSupport}`,`Multimodal support: ${e.multimodalSupport}`,`MCP support: ${e.mcpSupport}`,`Reasoning control: ${bt(e.reasoningCapability)}`]}o(_n,"formatProviderCapabilityDetailLines");function Cn(e,t,n){return[{label:"General coding",hints:{}},{label:"Evidence-heavy review",hints:{evidenceHeavy:!0}},{label:"Long-running task",hints:{longRunning:!0}}].map(i=>({label:i.label,decision:wt(e,t,n,i.hints)})).filter(i=>i.decision!==null)}o(Cn,"getProviderCommonPolicyScenarios");var $e=.5,Ke=0,I={locked:!1,queue:[]};async function kn(e){for(;I.locked;)await new Promise(t=>I.queue.push(t));I.locked=!0;try{let t=(Date.now()-Ke)/1e3;t<$e&&await new Promise(r=>setTimeout(r,($e-t)*1e3));let n=await e();return Ke=Date.now(),n}finally{I.locked=!1;let t=I.queue.shift();t&&t()}}o(kn,"rateLimitedCall");export{Dt as a,_e as b,Ce as c,k as d,M as e,P as f,$ as g,K as h,Be as i,Ft as j,O as k,Ae as l,d as m,tn as n,f as o,nn as p,ut as q,rn as r,ft as s,gt as t,on as u,ht as v,vt as w,yt as x,Et as y,sn as z,wt as A,an as B,cn as C,_ as D,ln as E,un as F,dn as G,fn as H,bt as I,pn as J,mn as K,gn as L,ce as M,St as N,oe as O,Ct as P,hn as Q,vn as R,Ot as S,yn as T,En as U,wn as V,xn as W,bn as X,Pn as Y,It as Z,Sn as _,Rt as $,_n as aa,Cn as ba,kn as ca};
|
|
156
|
+
`};function Ce(e){return _e[e]}o(Ce,"getConfigTemplate");import{closeSync as Y,existsSync as m,fsyncSync as Oe,mkdirSync as ee,openSync as te,readFileSync as Ie,renameSync as Re,statSync as Ge,unlinkSync as Q,watch as ze,writeFileSync as De}from"node:fs";import{createHash as Ve}from"node:crypto";import g from"node:path";var qe={mcp:"mcp.json",a2a:"a2a.json",extensions:"extensions.json"},He=new Set(["type","command","args","cwd","env","url","headers","connect","startupTimeoutMs","requestTimeoutMs","auth"]);function w(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}o(w,"isRecord");function E(e,t){if(!w(e))throw new Error(`${t} must be an object.`);return e}o(E,"requireRecord");function T(e,t,n){let r=Object.keys(e).find(i=>!t.has(i));if(r!==void 0)throw new Error(`${n} has unknown field "${r}".`)}o(T,"assertNoUnknownKeys");function Le(e,t){if(e.version!==1)throw new Error(`${t} version must be 1.`)}o(Le,"requireVersionOne");function ke(e,t){let n=E(e,t);for(let[r,i]of Object.entries(n))if(r.trim().length===0||typeof i!="string")throw new Error(`${t} must contain non-empty string keys and string values.`);return structuredClone(n)}o(ke,"requireStringMap");function Z(e,t){if(!Array.isArray(e)||!e.every(n=>typeof n=="string"&&n.trim().length>0))throw new Error(`${t} must be an array of non-empty strings.`);return e.map(n=>n.trim())}o(Z,"requireStringArray");function B(e,t){if(e!==void 0&&(!Number.isFinite(e)||Number(e)<=0))throw new Error(`${t} must be a positive number.`)}o(B,"validatePositiveNumber");function We(e,t){if(e.trim().length===0)throw new Error("MCP server names must not be empty.");let n=E(t,`MCP server "${e}"`);T(n,He,`MCP server "${e}"`);let r=n.type??"stdio";if(!["stdio","sse","streamable-http","http"].includes(String(r)))throw new Error(`MCP server "${e}" has an unsupported transport type.`);if(r==="stdio"){if(typeof n.command!="string"||n.command.trim().length===0)throw new Error(`MCP server "${e}" stdio transport requires command.`)}else if(typeof n.url!="string"||n.url.trim().length===0)throw new Error(`MCP server "${e}" ${String(r)} transport requires url.`);if(n.args!==void 0&&Z(n.args,`MCP server "${e}" args`),n.cwd!==void 0&&typeof n.cwd!="string")throw new Error(`MCP server "${e}" cwd must be a string.`);if(n.env!==void 0&&ke(n.env,`MCP server "${e}" env`),n.headers!==void 0&&ke(n.headers,`MCP server "${e}" headers`),n.connect!==void 0&&!["lazy","prewarm","disabled"].includes(String(n.connect)))throw new Error(`MCP server "${e}" has an unsupported connect mode.`);if(B(n.startupTimeoutMs,`MCP server "${e}" startupTimeoutMs`),B(n.requestTimeoutMs,`MCP server "${e}" requestTimeoutMs`),n.auth!==void 0){let i=E(n.auth,`MCP server "${e}" auth`);if(T(i,new Set(["type","clientId","authorizationUrl","tokenUrl","scopes","redirectPort"]),`MCP server "${e}" auth`),i.type!=="oauth2")throw new Error(`MCP server "${e}" auth type must be oauth2.`);for(let a of["clientId","authorizationUrl","tokenUrl"])if(i[a]!==void 0&&typeof i[a]!="string")throw new Error(`MCP server "${e}" auth.${a} must be a string.`);i.scopes!==void 0&&Z(i.scopes,`MCP server "${e}" auth.scopes`),B(i.redirectPort,`MCP server "${e}" auth.redirectPort`)}return structuredClone(n)}o(We,"parseMcpServer");function k(e){let t=E(e,"MCP integration config");T(t,new Set(["version","servers"]),"MCP integration config"),Le(t,"MCP integration config");let n=E(t.servers,"MCP integration config servers"),r={};for(let[i,s]of Object.entries(n))r[i]=We(i,s);return{version:1,servers:r}}o(k,"parseMcpIntegrationDocument");function M(e){let t=E(e,"Extensions integration config");T(t,new Set(["version","paths"]),"Extensions integration config"),Le(t,"Extensions integration config");let n=Z(t.paths,"Extensions integration config paths");if(new Set(n).size!==n.length)throw new Error("Extensions integration config paths must not contain duplicates.");return{version:1,paths:n}}o(M,"parseExtensionsIntegrationDocument");function P(e,t){return g.join(g.resolve(t),"integrations",qe[e])}o(P,"resolveIntegrationConfigPath");function ne(e){return g.join(g.resolve(e),"config.json")}o(ne,"coreConfigPath");function Te(e){return Ve("sha256").update(e).digest("hex")}o(Te,"hashText");function re(e){let t=Ie(e,"utf8");try{return{raw:t,value:JSON.parse(t)}}catch(n){let r=n instanceof Error?n.message:String(n);throw new Error(`Invalid JSON: ${r}`)}}o(re,"readJsonFile");function A(e){return{domain:e.domain,source:e.source,path:e.path,revision:Te(e.raw),document:structuredClone(e.document),loadedAt:new Date().toISOString()}}o(A,"snapshot");function N(e){let t=ne(e);return m(t)?E(re(t).value,"Core config"):{}}o(N,"readCoreConfig");function $(e){let t=P("mcp",e);if(m(t)){let i=re(t);return A({domain:"mcp",source:"user",path:t,raw:i.raw,document:k(i.value)})}let n=N(e).mcpServers,r=k({version:1,servers:w(n)?n:{}});return A({domain:"mcp",source:n===void 0?"default":"legacy-user",path:t,raw:JSON.stringify(r),document:r})}o($,"readMcpIntegration");function K(e){let t=P("extensions",e);if(m(t)){let i=re(t);return A({domain:"extensions",source:"user",path:t,raw:i.raw,document:M(i.value)})}let n=N(e).extensions,r=M({version:1,paths:Array.isArray(n)?n:[]});return A({domain:"extensions",source:n===void 0?"default":"legacy-user",path:t,raw:JSON.stringify(r),document:r})}o(K,"readExtensionsIntegration");function Je(e){if(!w(e))return[];let t=[],n=/(token|secret|password|api[_-]?key|authorization)/i;for(let[r,i]of Object.entries(e))if(w(i))for(let s of["env","headers"]){let a=i[s];if(w(a))for(let[l,c]of Object.entries(a))n.test(l)&&typeof c=="string"&&!c.startsWith("${env:")&&t.push(`MCP server "${r}" ${s}.${l} may contain a literal secret.`)}return t}o(Je,"likelySecretWarnings");function Be(e){let t=N(e),n=P("mcp",e),r=P("extensions",e),i=t.mcpServers,s=t.extensions,a=w(i)?Object.keys(i).length:0,l=Array.isArray(s)?s.length:0,c=o((b,R,D)=>m(b)?{action:"none",entries:R,destination:b,reason:"destination-exists"}:D?{action:"create",entries:R,destination:b}:{action:"none",entries:0,destination:b,reason:"legacy-absent"},"domainPlan");return{mcp:c(n,a,i!==void 0),extensions:c(r,l,s!==void 0),warnings:Je(i)}}o(Be,"planLegacyIntegrationMigration");function Ye(e,t){let n=ne(e);ee(g.dirname(n),{recursive:!0,mode:448});let r=`${n}.${process.pid}.${Date.now()}.tmp`,i=te(r,"wx",384);try{De(i,`${JSON.stringify(t,null,2)}
|
|
157
|
+
`,"utf8"),Oe(i)}finally{Y(i)}try{Re(r,n)}catch(s){throw m(r)&&Q(r),new Error("Failed to atomically clean legacy integration fields.",{cause:s})}}o(Ye,"writeCoreConfigAtomically");function Ft(e){let t=Be(e.configHome),n=N(e.configHome),r=[];t.mcp.action==="create"&&(O({domain:"mcp",configHome:e.configHome,document:{version:1,servers:w(n.mcpServers)?n.mcpServers:{}},validate:k}),r.push("mcp")),t.extensions.action==="create"&&(O({domain:"extensions",configHome:e.configHome,document:{version:1,paths:Array.isArray(n.extensions)?n.extensions:[]},validate:M}),r.push("extensions"));let i=!1;if(e.cleanupLegacy&&m(ne(e.configHome))){let s={...n};m(t.mcp.destination)&&delete s.mcpServers,m(t.extensions.destination)&&delete s.extensions,Qe(n,s)||(Ye(e.configHome,s),i=!0)}return{...t,applied:r,cleanedLegacy:i}}o(Ft,"migrateLegacyIntegrationConfig");function Qe(e,t){return JSON.stringify(e)===JSON.stringify(t)}o(Qe,"isDeepStrictEqualForConfig");function Ze(e){return m(e)?Te(Ie(e,"utf8")):void 0}o(Ze,"currentUserRevision");function et(e){let t=`${e}.lock`;try{return{fd:te(t,"wx",384),path:t}}catch(n){throw new Error(`Integration configuration is busy: ${g.basename(e)}`,{cause:n})}}o(et,"acquireWriteLock");function O(e){let t=P(e.domain,e.configHome),n=e.validate(e.document);ee(g.dirname(t),{recursive:!0,mode:448});let r=et(t);try{let i=Ze(t);if(e.expectedRevision!==void 0&&i!==e.expectedRevision)throw new Error(`Integration configuration revision changed (expected ${e.expectedRevision}, actual ${i??"missing"}).`);let s=`${JSON.stringify(n,null,2)}
|
|
158
|
+
`,a=`${t}.${process.pid}.${Date.now()}.tmp`,l=te(a,"wx",384);try{De(l,s,"utf8"),Oe(l)}finally{Y(l)}try{Re(a,t)}catch(c){throw m(a)&&Q(a),new Error(`Failed to atomically replace ${g.basename(t)}.`,{cause:c})}return A({domain:e.domain,source:"user",path:t,raw:s,document:n})}finally{Y(r.fd),m(r.path)&&Q(r.path)}}o(O,"writeIntegrationDocument");function Me(e){if(!m(e))return"missing";let t=Ge(e);return`${t.dev}:${t.ino}:${t.size}:${t.mtimeMs}`}o(Me,"metadataSignature");function L(e,t){return{code:e,message:t,time:new Date().toISOString()}}o(L,"safeDiagnostic");var Ae=class{static{o(this,"IntegrationConfigController")}#a;#r;#c;#l;#e;#t;#u="";#o;#n;#i;#d=Promise.resolve();#s=new Set;constructor(t){this.#a=t.domain,this.#r=P(t.domain,t.configHome),this.#l=t.validate,this.#c=t.read}async initialize(){let t=await this.reload();if(!t.ok||!this.#e)throw new Error(t.ok?"Integration configuration did not produce a snapshot.":t.error);return structuredClone(this.#e)}snapshot(){return this.#e?structuredClone(this.#e):void 0}status(){return{domain:this.#a,path:this.#r,...this.#e?{revision:this.#e.revision,source:this.#e.source,lastReloadAt:this.#e.loadedAt}:{},...this.#t?{diagnostic:this.#t}:{},watching:this.#o!==void 0}}subscribe(t){return this.#s.add(t),()=>{this.#s.delete(t)}}reload(){let t=this.#d.then(()=>this.#f());return this.#d=t.then(()=>{},()=>{}),t}async#f(){this.#u=Me(this.#r);let t;try{t=this.#c(),this.#l(t.document)}catch{return this.#t=L("invalid-config","Integration configuration is invalid; check the file against its versioned schema."),{ok:!1,error:this.#t.message}}let n=this.#e?structuredClone(this.#e):void 0;try{for(let r of this.#s)await r(structuredClone(t),n)}catch{return this.#t=L("activation-failed","Integration configuration could not be activated; the previous configuration remains active."),{ok:!1,error:this.#t.message}}return this.#e=t,this.#t=void 0,{ok:!0,snapshot:structuredClone(t)}}async ensureCurrent(){return Me(this.#r)===this.#u&&this.#e?{ok:!0,snapshot:structuredClone(this.#e)}:this.reload()}startWatching(t=100,n=2e3){if(!(this.#o||this.#i)){ee(g.dirname(this.#r),{recursive:!0,mode:448});try{this.#o=ze(g.dirname(this.#r),(r,i)=>{i!==null&&i.toString()!==g.basename(this.#r)||(this.#n&&clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#n=void 0,this.reload()},t),this.#n.unref?.())}),this.#o.unref(),this.#o.on("error",()=>{this.#t=L("watcher-degraded","Integration watcher is degraded; metadata polling remains active.")})}catch{this.#t=L("watcher-degraded","Integration watcher is degraded; metadata polling remains active.")}this.#i=setInterval(()=>{this.ensureCurrent()},n),this.#i.unref?.()}}close(){this.#n&&clearTimeout(this.#n),this.#n=void 0,this.#i&&clearInterval(this.#i),this.#i=void 0,this.#o?.close(),this.#o=void 0,this.#s.clear()}};var it=rt(tt),st=2,Ne=!1,d=we(),tn=p.join(d,"sessions"),f=p.join(d,"config.json"),nn=60,h=null,ie=!1,at="dumb";function ct(e){let t=p.basename(e).toLowerCase(),n="__KODAX_SHELL_ENV_START__",r=`printf '%s\\0' '${n}'; env -0`;return t==="fish"?{args:["-i","-c",r],sentinel:n}:{args:t==="bash"||t==="zsh"?["-ic",r]:["-lc",r],sentinel:n}}o(ct,"buildShellEnvCommand");function lt(e,t){let n=`${t}\0`,r=e.lastIndexOf(n);if(r===-1)return{};let i=e.slice(r+n.length),s={};for(let a of i.split("\0")){if(!a)continue;let l=a.indexOf("=");l<=0||(s[a.slice(0,l)]=a.slice(l+1))}return s}o(lt,"parseNullDelimitedShellEnv");function ut(e={}){let t=e.env??process.env;if((e.platform??process.platform)==="win32"||t.KODAX_DISABLE_SHELL_ENV_HYDRATION==="1")return!1;let r=e.shell??t.SHELL;if(!r||!p.isAbsolute(r))return!1;let{args:i,sentinel:s}=ct(r),a=e.run??nt,l={...t,TERM:at},c=a(r,i,{encoding:"utf8",env:l,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(c.status!==0||!c.stdout)return!1;let b=typeof c.stdout=="string"?c.stdout:c.stdout.toString("utf8"),R=lt(b,s),D=!1;for(let[G,Fe]of Object.entries(R))G!=="TERM"&&t[G]===void 0&&(t[G]=Fe,D=!0);return D}o(ut,"hydrateProcessEnvFromShell");function dt(){if(!ie){ie=!0;try{ut()}catch{}}}o(dt,"ensureShellEnvironmentHydrated");function rn(){ie=!1}o(rn,"resetShellEnvironmentHydrationForTesting");function ft(e){he(e.customProviders??[])}o(ft,"registerConfiguredCustomProviders");function se(e){if(!Array.isArray(e))return;let t=e.filter(n=>typeof n=="string").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:[]}o(se,"normalizeConfiguredExtensions");function pt(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{u.mkdirSync(p.dirname(f),{recursive:!0}),u.writeFileSync(f,JSON.stringify(t,null,2))}catch{}return t}o(pt,"migrateLegacyPermissionModeInConfig");function mt(e){if(e.permissionMode!=="auto-in-project")return e;try{let t=u.readFileSync(f,"utf-8"),n=t.replace(/("permissionMode"\s*:\s*)"auto-in-project"/,'$1"auto"');n!==t&&u.writeFileSync(f,n)}catch{}return{...e,permissionMode:"auto"}}o(mt,"migrateAutoInProjectAliasInConfig");function gt(){if(h)return h;let e="0.7.76";if(e)return h=e,h;let t=p.join(p.dirname(ot(import.meta.url)),"../../package.json");if(u.existsSync(t))try{return h=JSON.parse(u.readFileSync(t,"utf-8")).version??"0.0.0",h??"0.0.0"}catch{}return h="0.0.0",h}o(gt,"getVersion");var on=gt();function ht(e){return fe(e)}o(ht,"getProviderModel");function ae(e,t){let n=new Set(e.map(i=>i.toLowerCase())),r=[...e];for(let i of t)n.has(i.toLowerCase())||r.push(i);return r}o(ae,"mergeModels");function vt(e,t){t||(t=ce().providerModels);let n=t?.[e];if(n&&n.length>0){try{let r=H(e);if(r.length>0)return ae(n,r)}catch{}try{let r=C(e);if(r)return ae(n,r.getAvailableModels())}catch{}return n}try{let r=H(e);if(r.length>0)return r}catch{}try{let r=C(e);if(r)return r.getAvailableModels()}catch{}return[]}o(vt,"getProviderAvailableModels");function yt(e,t){let n=pe(e,t);if(n!=="unknown")return n;try{let r=C(e);if(r)return r.getReasoningCapability(t)}catch{}return"unknown"}o(yt,"getProviderReasoningCapability");function wt(e){let t=me(e);if(t)return t;try{return W().find(r=>r.name===e)?.capabilityProfile??null}catch{return null}}o(wt,"getProviderCapabilityProfile");function je(e,t){let n=wt(e),r=yt(e,t);if(n)return{capabilityProfile:n,reasoningCapability:r};try{let i=ve(e);return{capabilityProfile:i.getCapabilityProfile(),reasoningCapability:i.getReasoningCapability(t)}}catch{return null}}o(je,"getProviderCapabilityMetadata");function sn(e,t){let n=je(e,t);return n?xe({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}o(sn,"getProviderCapabilitySnapshot");function Et(e,t,n,r){let i=je(e,t);return i?be({providerName:e,model:t,capabilityProfile:i.capabilityProfile,reasoningCapability:i.reasoningCapability==="unknown"?void 0:i.reasoningCapability,reasoningMode:n,hints:r}):null}o(Et,"getProviderPolicyDecision");function an(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"forwards only the latest user message":"preserves full conversation history",r=e.mcpSupport==="native"?"MCP available":"MCP unavailable";return`${t}; ${n}; ${r}`}o(an,"describeProviderCapabilitySummary");function cn(e){switch(e){case"native-budget":return"B";case"native-effort":return"E";case"native-toggle":return"T";case"native-adaptive":return"A";default:return"-"}}o(cn,"formatReasoningCapabilityShort");function _(e){if(e)return e==="none"?"off":e}o(_,"formatReasoningEffortForDisplay");function X(e,t){let n=_(t);n&&!e.includes(n)&&e.push(n)}o(X,"pushUniqueEffortDisplay");function ln(e,t){let n=["auto"],i=U(e,t)?.supportedEfforts?.filter(s=>s.isUserVisible!==!1);if(!i||i.length===0){for(let s of["off","low","medium","high"])X(n,s);return n}for(let s of i)X(n,s.value);return n}o(ln,"getProviderReasoningEffortOptions");function un(e,t){let n=U(e,t),r=new Set(n?.disabledEfforts??[]),i=n?.supportedEfforts?.filter(c=>c.isUserVisible!==!1),s=[],a=n?.supportsDisabledThinking===!0;if(!i||i.length===0){for(let c of["low","medium","high"])X(s,c);a=!0}else for(let c of i){if(c.value==="none"){a=!0;continue}if(r.has(c.value)){a=!0;continue}X(s,c.value)}let l=[];return a&&l.push("off"),l.push(...s),l.push("auto"),l}o(un,"getProviderReasoningEffortCycle");function xt(e,t){if(t===!1)return"off";switch(e){case"off":return"off";case"quick":return"low";case"balanced":return"medium";case"deep":return"high";default:return"auto"}}o(xt,"legacyReasoningModeToEffortDisplay");function U(e,t){let n=t??ht(e);if(!n)return;let r=ye(e,n)?.reasoningProfile;if(r)return le(r,Ee(e,n))}o(U,"resolveReasoningProfileForDisplay");function dn(e){let t=_(e.effort)??xt(e.reasoningMode,e.thinking),n=U(e.provider,e.model);if(!n)return t;try{let r=ue({capability:n,explicitEffort:e.effortOverride?e.effort:void 0,sessionEffort:e.effortOverride?void 0:e.effort,legacyReasoningMode:e.reasoningMode,thinking:e.thinking}),i=_(r.configuredEffort)??t,a=r.configuredEffort!==void 0&&n.disabledEfforts?.includes(r.configuredEffort)===!0?"off":_(r.effectiveEffort);return a&&a!==i?`${i}->${a}`:i}catch{if(e.effort)try{let r=q({currentEffort:e.effort,capability:n}),i=_(e.effort)??t,s=_(r.effectiveEffort);return s&&s!==i?`${i}->${s}`:i}catch{return t}return t}}o(dn,"formatReasoningEffortStatusLabel");function fn(e){let t=It(e);if(!t)return{preserved:!0};let n=U(e.provider,e.model);if(!n)return{configuredEffort:t,runtimeEffort:t,preserved:!0};let r=q({currentEffort:t,capability:n});return{configuredEffort:t,runtimeEffort:r.effectiveEffort,preserved:r.preserved,diagnostic:r.diagnostic}}o(fn,"resolveProviderReasoningRuntimeEffort");function bt(e){switch(e){case"native-budget":return"budget";case"native-effort":return"effort";case"native-toggle":return"toggle";case"native-adaptive":return"adaptive";default:return"none"}}o(bt,"describeReasoningCapabilityControl");function pn(e,t){if(e==="off")return"Reasoning disabled";switch(t){case"native-budget":return"Uses native thinking budget control";case"native-effort":return"Uses native reasoning effort control";case"native-toggle":return"Uses provider-native thinking toggle only";case"native-adaptive":return"Model adaptively decides thinking depth (Opus 4.7+)";case"none":return"Runs without native reasoning parameters";case"prompt-only":return"Uses prompt overlays only; no native reasoning parameter";default:return"Runs without native reasoning parameters"}}o(pn,"describeReasoningExecution");function mn(e){let t=[];e||(e=ce().providerModels);for(let n of ge())t.push({name:n.name,model:n.model,models:vt(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=W().map(r=>({...r,models:(()=>{let i=e?.[r.name];return i&&i.length>0?ae(i,r.models):r.models})()}));t.push(...n)}catch{}return t}o(mn,"getProviderList");function gn(e){if(de(e))return!0;try{return C(e)?.isConfigured()??!1}catch{return!1}}o(gn,"isProviderConfigured");var F=class extends Error{static{o(this,"InvalidAgentModeConfigError")}};function Pt(e){let t=e.agentMode;if(t===void 0||t==="ama"||t==="sa")return e;if(t!=="amaw"&&t!=="ama-workflow")throw new F(`Invalid agentMode "${t}" in ${f}. Expected "ama" or "sa".`);let n={...e,agentMode:"ama",schemaVersion:Math.max(e.schemaVersion??0,st)},r=`${f}.migrate-${process.pid}.tmp`;try{u.writeFileSync(r,JSON.stringify(n,null,2),{mode:384}),u.renameSync(r,f)}catch{u.rmSync(r,{force:!0})}return Ne||(process.emitWarning(`Migrated persisted agentMode "${t}" to "ama". Workflow use is now explicit intent.`,{code:"KODAX_AGENT_MODE_MIGRATED"}),Ne=!0),n}o(Pt,"migrateLegacyAgentModeConfig");function ce(){try{if(u.existsSync(f)){let n=JSON.parse(u.readFileSync(f,"utf-8")),r=Pt(n),i=r.reasoningCeiling??r.reasoningMode,s=[],a={};try{s=[...K(d).document.paths]}catch{}try{a=$(d).document.servers}catch{}return mt(pt({...r,reasoningMode:i,extensions:se(s),mcpServers:a}))}}catch(n){if(n instanceof F)throw n}let e,t;try{let n=K(d);n.source!=="default"&&(e=se([...n.document.paths]))}catch{}try{let n=$(d);n.source!=="default"&&(t=n.document.servers)}catch{}return{...e===void 0?{}:{extensions:e},...t===void 0?{}:{mcpServers:t}}}o(ce,"loadConfig");var St=p.join(d,"config.example.jsonc"),oe={mcp:p.join(d,"integrations","mcp.example.jsonc"),a2a:p.join(d,"integrations","a2a.example.jsonc"),extensions:p.join(d,"integrations","extensions.example.jsonc")},_t=[{name:"core",path:St},{name:"mcp",path:oe.mcp},{name:"a2a",path:oe.a2a},{name:"extensions",path:oe.extensions}];function Ct(){let e=[];for(let t of _t)try{if(u.existsSync(t.path))continue;u.mkdirSync(p.dirname(t.path),{recursive:!0}),u.writeFileSync(t.path,Ce(t.name),"utf8"),e.push(t.path)}catch{}return e}o(Ct,"ensureExampleConfigFiles");function hn(){return Ct()[0]}o(hn,"ensureExampleConfigFile");var j=new Map;function kt(e,t){let n=process.env[e],r=j.get(e),i=r!==void 0&&n===r;if(n!==void 0&&!i){j.delete(e);return}if(t===void 0){i&&delete process.env[e],j.delete(e);return}process.env[e]=t,j.set(e,t)}o(kt,"projectConfigEnvironment");var Xe=[{configPath:"streamIdleTimeoutMs",env:"KODAX_STREAM_IDLE_TIMEOUT_MS",value:o(e=>x(e.streamIdleTimeoutMs),"value")},{configPath:"repoIntelligenceMode",env:"KODAX_REPO_INTELLIGENCE",value:o(e=>e.repoIntelligenceMode,"value")},{configPath:"repoIntelligenceTrace",env:"KODAX_REPO_INTELLIGENCE_TRACE",value:o(e=>S(e.repoIntelligenceTrace),"value")},{configPath:"verifierLog",env:"KODAX_VERIFIER_LOG",value:o(e=>S(e.verifierLog),"value")},{configPath:"stallLog",env:"KODAX_STALL_LOG",value:o(e=>S(e.stallLog),"value")},{configPath:"fallbackProviders",env:"KODAX_FALLBACK_PROVIDERS",value:o(e=>At(e.fallbackProviders),"value")},{configPath:"fastProvider",env:"KODAX_FAST_PROVIDER",value:o(e=>v(e.fastProvider),"value")},{configPath:"fastModel",env:"KODAX_FAST_MODEL",value:o(e=>v(e.fastModel),"value")},{configPath:"deepProvider",env:"KODAX_DEEP_PROVIDER",value:o(e=>v(e.deepProvider),"value")},{configPath:"deepModel",env:"KODAX_DEEP_MODEL",value:o(e=>v(e.deepModel),"value")},{configPath:"provider",env:"KODAX_PROVIDER",value:o(e=>v(e.provider),"value")},{configPath:"effort",env:"KODAX_EFFORT",value:o(e=>v(e.effort),"value")},{configPath:"runtimeMode",env:"KODAX_RUNTIME_MODE",value:o(e=>e.runtimeMode,"value")},{configPath:"sessionRetentionDays",env:"KODAX_SESSION_RETENTION_DAYS",value:o(e=>x(e.sessionRetentionDays),"value")},{configPath:"maxOutputTokens",env:"KODAX_MAX_OUTPUT_TOKENS",value:o(e=>x(e.maxOutputTokens),"value")},{configPath:"disablePromptCache",env:"KODAX_DISABLE_PROMPT_CACHE",value:o(e=>S(e.disablePromptCache),"value")},{configPath:"lsp",env:"KODAX_LSP",value:o(e=>S(e.lsp),"value")},{configPath:"lspAutoDownload",env:"KODAX_LSP_DOWNLOAD",value:o(e=>S(e.lspAutoDownload),"value")},{configPath:"acpLogLevel",env:"KODAX_ACP_LOG",value:o(e=>v(e.acpLogLevel),"value")},{configPath:"repoIntelligence.toolWaitMs",env:"KODAX_REPO_INTELLIGENCE_TOOL_WAIT_MS",value:o(e=>x(e.repoIntelligence?.toolWaitMs),"value")},{configPath:"repoIntelligence.workerTimeoutMs",env:"KODAX_REPO_INTELLIGENCE_WORKER_TIMEOUT_MS",value:o(e=>x(e.repoIntelligence?.workerTimeoutMs),"value")},{configPath:"repoIntelligence.workerOldSpaceMb",env:"KODAX_REPO_INTELLIGENCE_WORKER_OLD_SPACE_MB",value:o(e=>x(e.repoIntelligence?.workerOldSpaceMb),"value")},{configPath:"repoIntelligence.storageDir",env:"KODAX_REPO_INTELLIGENCE_STORAGE_DIR",value:o(e=>v(e.repoIntelligence?.storageDir),"value")},{configPath:"workflow.maxConcurrency",env:"KODAX_WORKFLOW_MAX_CONCURRENCY",value:o(e=>x(e.workflow?.maxConcurrency),"value")}];function Mt(e){for(let t of Xe)kt(t.env,t.value(e))}o(Mt,"applyConfigSurfaceBridges");function v(e){return e?.trim()||void 0}o(v,"normalizedConfigString");function x(e){return typeof e=="number"&&Number.isFinite(e)?String(e):void 0}o(x,"configNumberString");function S(e){return e===void 0?void 0:e?"1":"0"}o(S,"configBooleanString");function At(e){return e?.filter(t=>t.trim().length>0).join(",")}o(At,"configStringList");var vn=[...Xe.map(({configPath:e,env:t})=>({configPath:e,env:t}))];function Ot(e){Mt(e)}o(Ot,"applyConfigEnvironment");function yn(){dt();let e=ce();return Ot(e),ft(e),Se(e.locale),e}o(yn,"prepareRuntimeConfig");function wn(e){let t={};if(u.existsSync(f))try{let a=JSON.parse(u.readFileSync(f,"utf8"));a&&typeof a=="object"&&!Array.isArray(a)&&(t=a)}catch{}let{extensions:n,mcpServers:r,...i}=e,s={...t,...i};for(let a of Object.keys(i))i[a]===void 0&&delete s[a];if(u.mkdirSync(p.dirname(f),{recursive:!0}),u.writeFileSync(f,JSON.stringify(s,null,2)),n!==void 0){let a=K(d);O({domain:"extensions",configHome:d,...a.source==="user"?{expectedRevision:a.revision}:{},document:{version:1,paths:se(n)??[]},validate:M})}if(r!==void 0){let a=$(d);O({domain:"mcp",configHome:d,...a.source==="user"?{expectedRevision:a.revision}:{},document:{version:1,servers:r},validate:k})}}o(wn,"saveConfig");function En(e,t,n){return e.effort!==void 0||V(n).kind==="value"||t.effort!==void 0}o(En,"resolveInitialEffortOverride");function y(e){return e?.trim()?e:void 0}o(y,"nonEmptySelection");function xn(e){return y(e.explicitProvider)??y(e.environmentProvider)??y(e.configuredProvider)??e.defaultProvider}o(xn,"resolveRuntimeProviderSelection");function bn(e){let t=y(e.explicitModel);if(t)return t;let n=y(e.configuredModel);if(!n)return;let r=y(e.explicitProvider)??y(e.environmentProvider);return r?y(e.configuredProvider)===r?n:void 0:n}o(bn,"resolveRuntimeModelSelection");function Pn(e){if(e.explicitEffort!==void 0)return z(e.explicitEffort);let t=V(e.environmentEffort);return t.kind==="value"?t.value:e.configuredEffort===void 0?void 0:z(e.configuredEffort)}o(Pn,"resolveRuntimeEffortSelection");function It(e){return e.permissionMode==="plan"&&e.effortOverride!==!0&&e.planModeEffort!==void 0?e.planModeEffort:e.effort}o(It,"resolvePermissionModeEffort");async function Sn(e){try{let{stdout:t}=await it("git rev-parse --show-toplevel",{cwd:e,windowsHide:!0});return t.trim()}catch{return null}}o(Sn,"getGitRoot");function Rt(e){switch(e){case"builtin":return"Built-in";case"runtime":return"Runtime extension";case"custom":return"Custom config";default:return"Unknown"}}o(Rt,"formatProviderSourceKind");function _n(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"latest-user-message only":"full conversation history";return[`Source: ${Rt(e.sourceKind)}`,`Transport: ${t}`,`Conversation semantics: ${n}`,`Context fidelity: ${e.contextFidelity}`,`Tool calling: ${e.toolCallingFidelity}`,`Session behavior: ${e.sessionSupport}`,`Long-running support: ${e.longRunningSupport}`,`Evidence-heavy flows: ${e.evidenceSupport}`,`Multimodal support: ${e.multimodalSupport}`,`MCP support: ${e.mcpSupport}`,`Reasoning control: ${bt(e.reasoningCapability)}`]}o(_n,"formatProviderCapabilityDetailLines");function Cn(e,t,n){return[{label:"General coding",hints:{}},{label:"Evidence-heavy review",hints:{evidenceHeavy:!0}},{label:"Long-running task",hints:{longRunning:!0}}].map(i=>({label:i.label,decision:Et(e,t,n,i.hints)})).filter(i=>i.decision!==null)}o(Cn,"getProviderCommonPolicyScenarios");var $e=.5,Ke=0,I={locked:!1,queue:[]};async function kn(e){for(;I.locked;)await new Promise(t=>I.queue.push(t));I.locked=!0;try{let t=(Date.now()-Ke)/1e3;t<$e&&await new Promise(r=>setTimeout(r,($e-t)*1e3));let n=await e();return Ke=Date.now(),n}finally{I.locked=!1;let t=I.queue.shift();t&&t()}}o(kn,"rateLimitedCall");export{Dt as a,_e as b,Ce as c,k as d,M as e,P as f,$ as g,K as h,Be as i,Ft as j,O as k,Ae as l,d as m,tn as n,f as o,nn as p,ut as q,rn as r,ft as s,gt as t,on as u,ht as v,vt as w,yt as x,wt as y,sn as z,Et as A,an as B,cn as C,_ as D,ln as E,un as F,dn as G,fn as H,bt as I,pn as J,mn as K,gn as L,ce as M,St as N,oe as O,Ct as P,hn as Q,vn as R,Ot as S,yn as T,wn as U,En as V,xn as W,bn as X,Pn as Y,It as Z,Sn as _,Rt as $,_n as aa,Cn as ba,kn as ca};
|