@kodax-ai/kodax 0.7.76 → 0.7.78
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 +758 -371
- package/LICENSE +158 -158
- package/README.md +1702 -1508
- package/README_CN.md +1019 -869
- package/config-templates/config.example.jsonc +86 -4
- package/config-templates/integrations/a2a.example.jsonc +98 -98
- package/config-templates/integrations/extensions.example.jsonc +7 -7
- package/config-templates/integrations/mcp.example.jsonc +16 -16
- package/dist/builtin/code-review/SKILL.md +22 -22
- package/dist/builtin/skill-creator/scripts/aggregate-benchmark.d.ts +46 -46
- package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +46 -46
- package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +62 -62
- package/dist/builtin/skill-creator/scripts/generate-review.d.ts +33 -33
- package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +73 -73
- package/dist/builtin/skill-creator/scripts/improve-description.d.ts +23 -23
- package/dist/builtin/skill-creator/scripts/init-skill.d.ts +14 -14
- package/dist/builtin/skill-creator/scripts/install-skill.d.ts +29 -29
- package/dist/builtin/skill-creator/scripts/package-skill.d.ts +38 -38
- package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +8 -8
- package/dist/builtin/skill-creator/scripts/run-eval.d.ts +66 -66
- package/dist/builtin/skill-creator/scripts/run-loop.d.ts +49 -49
- package/dist/builtin/skill-creator/scripts/run-trigger-eval.d.ts +58 -58
- package/dist/chunks/agent-ASP4MS3X.js +2 -0
- package/dist/chunks/argument-completer-JYQ7FX3W.js +2 -0
- package/dist/chunks/chunk-2CFHBKRE.js +5 -0
- package/dist/chunks/chunk-35PPHOQ2.js +292 -0
- package/dist/chunks/chunk-43QNNDHR.js +29 -0
- package/dist/chunks/chunk-5BNQXXGY.js +1 -0
- package/dist/chunks/chunk-5GO6FH7L.js +458 -0
- package/dist/chunks/chunk-5NDCSFOP.js +78 -0
- package/dist/chunks/chunk-6FOJVETH.js +22 -0
- package/dist/chunks/chunk-6XM4B6K2.js +48 -0
- package/dist/chunks/chunk-6YZUE6NC.js +240 -0
- package/dist/chunks/{chunk-RDXRM3UI.js → chunk-7OEBJGHK.js} +1 -1
- package/dist/chunks/chunk-KQLQYHWU.js +386 -0
- package/dist/chunks/chunk-NXO6GWSY.js +46 -0
- package/dist/chunks/chunk-T2XZTLYE.js +316 -0
- package/dist/chunks/chunk-TQDBTTIM.js +348 -0
- package/dist/chunks/{chunk-SMT2JSM3.js → chunk-UID7BLAB.js} +9 -9
- package/dist/chunks/chunk-VAT2QYXM.js +765 -0
- package/dist/chunks/chunk-YAZQTC2L.js +5 -0
- package/dist/chunks/chunk-YVRYHC4C.js +655 -0
- package/dist/chunks/{chunk-PXKSE54E.js → chunk-Z3KFRTSB.js} +1 -1
- package/dist/chunks/compaction-config-BQSSIWK5.js +2 -0
- package/dist/chunks/{construction-bootstrap-5F5KF2BZ.js → construction-bootstrap-VQLQGWPY.js} +1 -1
- package/dist/chunks/dist-BFT5YIGU.js +2 -0
- package/dist/chunks/dist-PCFE24YP.js +2 -0
- package/dist/chunks/host-UTFXCYYM.js +2 -0
- package/dist/chunks/run-manager-PJU3WIFJ.js +2 -0
- package/dist/chunks/utils-SID4HW2Q.js +2 -0
- package/dist/index.d.ts +21 -19
- package/dist/index.js +6 -6
- package/dist/kodax_bootstrap.js +25 -25
- package/dist/kodax_cli.js +1787 -1341
- package/dist/kodax_resume.js +17 -17
- package/dist/provider-capabilities.json +392 -362
- package/dist/runtime-worker.js +1707 -1279
- package/dist/sandbox-workspace-session.js +563 -0
- package/dist/sdk-a2a.d.ts +18 -17
- package/dist/sdk-a2a.js +8 -8
- package/dist/sdk-agent.d.ts +320 -70
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +135 -168
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +14 -597
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +219 -6
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +70 -27
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +212 -149
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.d.ts +93 -0
- package/dist/sdk-sandbox.js +2 -0
- package/dist/sdk-session.d.ts +8 -8
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.d.ts +2 -2
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +15 -15
- package/dist/types-chunks/{base.d-ChvpaKjZ.d.ts → base.d-4e74xDdy.d.ts} +13 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-r1beOESM.d.ts → bash-prefix-extractor.d-uAe2Oqda.d.ts} +319 -9
- package/dist/types-chunks/{capability-learning.d-DPrYxRjF.d.ts → capability-learning.d-CVsdHw4j.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-zeqV4IQX.d.ts → capsule.d-BlSv9l3V.d.ts} +2 -2
- package/dist/types-chunks/{guardrail.d-CWYD1bdL.d.ts → guardrail.d-BRE_ErEj.d.ts} +1 -1
- package/dist/types-chunks/{guardrail.d-qjuKJZ31.d.ts → guardrail.d-CXDYRgZ3.d.ts} +201 -35
- package/dist/types-chunks/{history-retrieval.d-BKTJIrVd.d.ts → history-retrieval.d-DtCy7x64.d.ts} +2 -2
- package/dist/types-chunks/{integration-config.d-ojG4swOP.d.ts → integration-config.d-BNowXE8k.d.ts} +23 -8
- package/dist/types-chunks/{public-api.d-CX4B11qY.d.ts → public-api.d-B3AohsxN.d.ts} +37 -8
- package/dist/types-chunks/{commands.d-DUxnK2TU.d.ts → repl.d-Ie_ZXb_U.d.ts} +89 -78
- package/dist/types-chunks/{side-query.d-DWTMsndP.d.ts → resolver.d-iAQ9ocLB.d.ts} +23 -74
- package/dist/types-chunks/{run-manager.d-B9fEIjZk.d.ts → run-manager.d-D1twIhF9.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-B0fhAOPa.d.ts → sdk-session-DB9KksIx.d.ts} +3 -3
- package/dist/types-chunks/side-query.d-DTuLPcC5.d.ts +77 -0
- package/dist/types-chunks/types-D3g6XUQr.d.ts +662 -0
- package/dist/types-chunks/{types.d-sRLugmjy.d.ts → types.d-BA-Jwpfs.d.ts} +506 -11
- package/dist/types-chunks/{types.d-DEctY20M.d.ts → types.d-BH0ZkTGf.d.ts} +2 -2
- package/dist/types-chunks/{types.d-DCQVBqVn.d.ts → types.d-BbtGlKZu.d.ts} +25 -3
- package/dist/types-chunks/{types.d-CSmF0t0n.d.ts → types.d-DIpZJKUl.d.ts} +15 -0
- package/dist/types-chunks/{types.d-Bm_y6YuM.d.ts → types.d-DVDTIfB_.d.ts} +4 -4
- package/dist/types-chunks/{utils.d-D0wPxz8y.d.ts → utils.d-CVp6bFl9.d.ts} +23 -7
- package/docs/SDK_EMBEDDER_GUIDE.md +592 -119
- package/package.json +9 -1
- package/scripts/kodax-bin.cjs +28 -28
- package/scripts/production-env.cjs +25 -25
- package/dist/chunks/agent-7X5CFET2.js +0 -2
- package/dist/chunks/argument-completer-3NHIKB4N.js +0 -2
- package/dist/chunks/chunk-4PWPNCNK.js +0 -158
- package/dist/chunks/chunk-7FJNLJLF.js +0 -369
- package/dist/chunks/chunk-COQYLD4U.js +0 -5
- package/dist/chunks/chunk-D3T24FJW.js +0 -78
- package/dist/chunks/chunk-EI4JBQKL.js +0 -46
- package/dist/chunks/chunk-HGT6WQ24.js +0 -321
- package/dist/chunks/chunk-HS3XHF3R.js +0 -622
- package/dist/chunks/chunk-IDCGNQ4H.js +0 -5
- package/dist/chunks/chunk-KAY2XLCP.js +0 -74
- package/dist/chunks/chunk-OD6LVXU6.js +0 -329
- package/dist/chunks/chunk-OSF3H4RR.js +0 -22
- package/dist/chunks/chunk-TGMBHGZO.js +0 -427
- package/dist/chunks/chunk-VWSLC2WO.js +0 -770
- package/dist/chunks/chunk-Y3AMP22L.js +0 -37
- package/dist/chunks/compaction-config-7J2XE35D.js +0 -2
- package/dist/chunks/dist-2RA7LSH3.js +0 -2
- package/dist/chunks/dist-URKXBOC6.js +0 -2
- package/dist/chunks/host-RKZ2OGFT.js +0 -2
- package/dist/chunks/run-manager-7RM4HEH6.js +0 -2
- package/dist/chunks/utils-X3TEH6IO.js +0 -2
- package/dist/types-chunks/center-types.d-BBT122uJ.d.ts +0 -91
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kodax-ai/kodax",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.78",
|
|
4
4
|
"description": "KodaX lightweight coding agent - TypeScript implementation with 16 built-in LLM provider aliases, published as a Node-free single-file CLI and SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
|
+
"kodaxRuntimeContracts": {
|
|
11
|
+
"integrationConfigResilience": 1
|
|
12
|
+
},
|
|
10
13
|
"workspaces": [
|
|
11
14
|
"packages/*"
|
|
12
15
|
],
|
|
@@ -56,6 +59,10 @@
|
|
|
56
59
|
"types": "./dist/sdk-runtime.d.ts",
|
|
57
60
|
"import": "./dist/sdk-runtime.js"
|
|
58
61
|
},
|
|
62
|
+
"./sandbox": {
|
|
63
|
+
"types": "./dist/sdk-sandbox.d.ts",
|
|
64
|
+
"import": "./dist/sdk-sandbox.js"
|
|
65
|
+
},
|
|
59
66
|
"./a2a": {
|
|
60
67
|
"types": "./dist/sdk-a2a.d.ts",
|
|
61
68
|
"import": "./dist/sdk-a2a.js"
|
|
@@ -79,6 +86,7 @@
|
|
|
79
86
|
"dev:mem-snapshot": "node scripts/mem-diag-launch.cjs 2",
|
|
80
87
|
"probe:reasoning": "tsx scripts/probe-reasoning.ts",
|
|
81
88
|
"probe:max-tokens": "node scripts/probe-max-tokens.mjs",
|
|
89
|
+
"probe:prompt-cache": "node scripts/probe-prompt-cache.mjs",
|
|
82
90
|
"start": "node --max-old-space-size=4096 --require ./scripts/production-env.cjs dist/kodax_bootstrap.js",
|
|
83
91
|
"build:binary": "node scripts/build-binary.mjs",
|
|
84
92
|
"build:binary:all": "node scripts/build-binary.mjs --all",
|
package/scripts/kodax-bin.cjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* KodaX bin entry — CJS shim.
|
|
4
|
-
*
|
|
5
|
-
* Purpose: set NODE_ENV=production BEFORE any ESM module is evaluated.
|
|
6
|
-
* Background: when users invoke `kodax` via `npm link` / global install,
|
|
7
|
-
* node runs this bin directly without the --require preload used by
|
|
8
|
-
* `npm run dev` / `npm run start`. ESM static imports are hoisted and
|
|
9
|
-
* evaluated before module-body code runs, so setting NODE_ENV inside
|
|
10
|
-
* `src/kodax_cli.ts` is too late — React would already have loaded its
|
|
11
|
-
* development reconciler, leaking ~100 MB/turn of profiling objects.
|
|
12
|
-
*
|
|
13
|
-
* This CJS file runs synchronously first, requires the env preload,
|
|
14
|
-
* then dynamic-imports the lightweight compiled bootstrap.
|
|
15
|
-
*
|
|
16
|
-
* Opt back into development by setting KODAX_DEV=1.
|
|
17
|
-
*/
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
require('./production-env.cjs');
|
|
21
|
-
|
|
22
|
-
import('../dist/kodax_bootstrap.js').then(
|
|
23
|
-
({ runKodaXBootstrapAsEntry }) => runKodaXBootstrapAsEntry(),
|
|
24
|
-
).catch((err) => {
|
|
25
|
-
// Surface unexpected errors with a full stack — this path should be rare.
|
|
26
|
-
// eslint-disable-next-line no-console
|
|
27
|
-
console.error(err);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
});
|
|
2
|
+
/**
|
|
3
|
+
* KodaX bin entry — CJS shim.
|
|
4
|
+
*
|
|
5
|
+
* Purpose: set NODE_ENV=production BEFORE any ESM module is evaluated.
|
|
6
|
+
* Background: when users invoke `kodax` via `npm link` / global install,
|
|
7
|
+
* node runs this bin directly without the --require preload used by
|
|
8
|
+
* `npm run dev` / `npm run start`. ESM static imports are hoisted and
|
|
9
|
+
* evaluated before module-body code runs, so setting NODE_ENV inside
|
|
10
|
+
* `src/kodax_cli.ts` is too late — React would already have loaded its
|
|
11
|
+
* development reconciler, leaking ~100 MB/turn of profiling objects.
|
|
12
|
+
*
|
|
13
|
+
* This CJS file runs synchronously first, requires the env preload,
|
|
14
|
+
* then dynamic-imports the lightweight compiled bootstrap.
|
|
15
|
+
*
|
|
16
|
+
* Opt back into development by setting KODAX_DEV=1.
|
|
17
|
+
*/
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
require('./production-env.cjs');
|
|
21
|
+
|
|
22
|
+
import('../dist/kodax_bootstrap.js').then(
|
|
23
|
+
({ runKodaXBootstrapAsEntry }) => runKodaXBootstrapAsEntry(),
|
|
24
|
+
).catch((err) => {
|
|
25
|
+
// Surface unexpected errors with a full stack — this path should be rare.
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.error(err);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
});
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Preload script — must execute before any ESM module evaluation.
|
|
3
|
-
* Loaded via: node --require ./scripts/production-env.cjs ...
|
|
4
|
-
*
|
|
5
|
-
* React ships two runtimes: development (with PerformanceMeasure tracking,
|
|
6
|
-
* prop diff strings, component profiling) and production (zero overhead).
|
|
7
|
-
* Development mode creates ~100 MB/turn of profiling objects that are never
|
|
8
|
-
* released, causing inevitable OOM after 10-20 conversation rounds.
|
|
9
|
-
*
|
|
10
|
-
* Default to production. Set KODAX_DEV=1 to opt-in to development mode.
|
|
11
|
-
*/
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
if (!process.env.NODE_ENV) {
|
|
15
|
-
process.env.NODE_ENV = process.env.KODAX_DEV === '1' ? 'development' : 'production';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Bootstrap hardening must run before the first application ESM import.
|
|
19
|
-
// ELECTRON_RUN_AS_NODE is a one-shot exec-boundary switch and is never kept.
|
|
20
|
-
delete process.env.ELECTRON_RUN_AS_NODE;
|
|
21
|
-
if (process.env.KODAX_DISABLE_HARDENING !== '1') {
|
|
22
|
-
delete process.env.LD_PRELOAD;
|
|
23
|
-
delete process.env.DYLD_INSERT_LIBRARIES;
|
|
24
|
-
delete process.env.DYLD_LIBRARY_PATH;
|
|
25
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Preload script — must execute before any ESM module evaluation.
|
|
3
|
+
* Loaded via: node --require ./scripts/production-env.cjs ...
|
|
4
|
+
*
|
|
5
|
+
* React ships two runtimes: development (with PerformanceMeasure tracking,
|
|
6
|
+
* prop diff strings, component profiling) and production (zero overhead).
|
|
7
|
+
* Development mode creates ~100 MB/turn of profiling objects that are never
|
|
8
|
+
* released, causing inevitable OOM after 10-20 conversation rounds.
|
|
9
|
+
*
|
|
10
|
+
* Default to production. Set KODAX_DEV=1 to opt-in to development mode.
|
|
11
|
+
*/
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
if (!process.env.NODE_ENV) {
|
|
15
|
+
process.env.NODE_ENV = process.env.KODAX_DEV === '1' ? 'development' : 'production';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Bootstrap hardening must run before the first application ESM import.
|
|
19
|
+
// ELECTRON_RUN_AS_NODE is a one-shot exec-boundary switch and is never kept.
|
|
20
|
+
delete process.env.ELECTRON_RUN_AS_NODE;
|
|
21
|
+
if (process.env.KODAX_DISABLE_HARDENING !== '1') {
|
|
22
|
+
delete process.env.LD_PRELOAD;
|
|
23
|
+
delete process.env.DYLD_INSERT_LIBRARIES;
|
|
24
|
+
delete process.env.DYLD_LIBRARY_PATH;
|
|
25
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
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-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};
|
|
@@ -1,2 +0,0 @@
|
|
|
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,158 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
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
|
-
// Copy only the fields you need to ~/.kodax/config.json (strict JSON).
|
|
4
|
-
// MCP, A2A, and Extensions live in ~/.kodax/integrations/*.json; use
|
|
5
|
-
// \`kodax integrations migrate --dry-run\` for legacy declarations.
|
|
6
|
-
{
|
|
7
|
-
// "provider": "deepseek",
|
|
8
|
-
// "model": "deepseek-v4",
|
|
9
|
-
// "runtimeMode": "embedded",
|
|
10
|
-
// "effort": "high",
|
|
11
|
-
// "agentMode": "ama",
|
|
12
|
-
// "permissionMode": "accept-edits",
|
|
13
|
-
// "locale": "zh",
|
|
14
|
-
// "customProviders": [
|
|
15
|
-
// {
|
|
16
|
-
// "name": "my-relay",
|
|
17
|
-
// "protocol": "openai",
|
|
18
|
-
// "baseUrl": "https://api.example.com/v1",
|
|
19
|
-
// "apiKeyEnv": "MY_RELAY_API_KEY",
|
|
20
|
-
// "model": "provider/model",
|
|
21
|
-
// "reasoning": { "efforts": ["off", "low", "high"], "default": "high" }
|
|
22
|
-
// }
|
|
23
|
-
// ],
|
|
24
|
-
// "repoIntelligenceMode": "auto",
|
|
25
|
-
// Automatic large compaction is always enabled. Percentage defaults to 75
|
|
26
|
-
// and is clamped to 15..90. A missing/zero absolute threshold is inactive;
|
|
27
|
-
// otherwise the smaller percentage, absolute, and physical limit wins.
|
|
28
|
-
// "compaction": {
|
|
29
|
-
// "triggerPercent": 75,
|
|
30
|
-
// "triggerTokens": 0
|
|
31
|
-
// },
|
|
32
|
-
// "sessionRetentionDays": 0,
|
|
33
|
-
// "workflow": { "maxConcurrency": 8 }
|
|
34
|
-
}
|
|
35
|
-
`,mcp:`// User MCP declarations: ~/.kodax/integrations/mcp.json (strict JSON).
|
|
36
|
-
// The whole file hot-reloads; healthy entries remain active if one new entry
|
|
37
|
-
// fails to prepare. Keep credentials in \${env:NAME} references.
|
|
38
|
-
{
|
|
39
|
-
"version": 1,
|
|
40
|
-
"servers": {}
|
|
41
|
-
// Example:
|
|
42
|
-
// "servers": {
|
|
43
|
-
// "reporting": {
|
|
44
|
-
// "type": "streamable-http",
|
|
45
|
-
// "url": "https://mcp.example.com",
|
|
46
|
-
// "headers": { "Authorization": "Bearer \${env:REPORTING_MCP_TOKEN}" },
|
|
47
|
-
// "connect": "lazy"
|
|
48
|
-
// }
|
|
49
|
-
// }
|
|
50
|
-
}
|
|
51
|
-
`,a2a:`// Bidirectional A2A configuration: ~/.kodax/integrations/a2a.json.
|
|
52
|
-
// \`agents\` calls many third-party Agents. The optional singleton \`server\`
|
|
53
|
-
// exposes exactly one KodaX general task Agent; ACP remains the coding/editor
|
|
54
|
-
// protocol. Uncomment only the entries you need; no token value belongs here.
|
|
55
|
-
// Legacy version 1 files remain readable. Non-empty files require an explicit
|
|
56
|
-
// stopped-daemon migration; new/empty files and every later write use version 2.
|
|
57
|
-
{
|
|
58
|
-
"version": 2,
|
|
59
|
-
|
|
60
|
-
// Create this inbound block with \`kodax a2a expose\`; config never starts a
|
|
61
|
-
// listener by itself. Do not copy private Agent instructions, Runtime Skills,
|
|
62
|
-
// model names, or local paths into the public \`published.skills\` list.
|
|
63
|
-
// Managed workspaces default below
|
|
64
|
-
// ~/kodax_a2a_server_workspace/<runtime-profile>/contexts/<context-key>/.
|
|
65
|
-
// Native read/grep/glob remains available according to workspace access.
|
|
66
|
-
// Arbitrary shell is never exposed. Skill instructions/assets need no
|
|
67
|
-
// process authority. An exact checked-in scripts/... entry requires
|
|
68
|
-
// process="isolated", skillScripts admission, and \`kodax sandbox doctor\`.
|
|
69
|
-
// ASRT receives no KodaX credentials or ambient ~/.srt-settings.json and its
|
|
70
|
-
// script quota is observed; hostile tenants also require an outer container/VM.
|
|
71
|
-
//
|
|
72
|
-
// "server": {
|
|
73
|
-
// "execution": {
|
|
74
|
-
// "kind": "local-agent",
|
|
75
|
-
// "agentRef": { "source": "markdown:user", "name": "report-agent" },
|
|
76
|
-
// "workspace": { "mode": "managed" },
|
|
77
|
-
// "toolPolicy": {
|
|
78
|
-
// "workspace": "write",
|
|
79
|
-
// "process": "deny",
|
|
80
|
-
// "network": { "mode": "deny" },
|
|
81
|
-
// "tools": [],
|
|
82
|
-
// "mcp": {},
|
|
83
|
-
// "skillScripts": {},
|
|
84
|
-
// "subagents": "deny"
|
|
85
|
-
// }
|
|
86
|
-
// },
|
|
87
|
-
// "published": {
|
|
88
|
-
// "name": "KodaX Agent",
|
|
89
|
-
// "description": "Completes approved general tasks.",
|
|
90
|
-
// "version": "0.7.71",
|
|
91
|
-
// "skills": [{ "id": "general", "name": "General", "description": "Complete general tasks.", "tags": [] }],
|
|
92
|
-
// "inputModes": ["text/plain"],
|
|
93
|
-
// "outputModes": ["text/plain"]
|
|
94
|
-
// },
|
|
95
|
-
// "authentication": { "type": "bearer-env", "tokenEnv": "KODAX_A2A_TOKEN", "principalId": "configured-client" },
|
|
96
|
-
// "dataDir": "~/.kodax/a2a/tasks"
|
|
97
|
-
// },
|
|
98
|
-
|
|
99
|
-
// Production OAuth2 resource-server alternative for the server above. The
|
|
100
|
-
// external Authorization Server issues access tokens and, for JWT tokens,
|
|
101
|
-
// signs them. KodaX holds no issuer signing key; it validates RFC 9068 tokens
|
|
102
|
-
// against the issuer's rotating JWKS, audience, expiry, subject, and scopes.
|
|
103
|
-
// Replace the server.authentication value above with:
|
|
104
|
-
// {
|
|
105
|
-
// "type": "oauth2-jwt",
|
|
106
|
-
// "scheme": "enterprise-oauth",
|
|
107
|
-
// "issuer": "https://identity.example.com",
|
|
108
|
-
// "audience": "https://agent.example.com/a2a",
|
|
109
|
-
// "jwksUrl": "https://identity.example.com/.well-known/jwks.json",
|
|
110
|
-
// "tokenUrl": "https://identity.example.com/oauth/token",
|
|
111
|
-
// "metadataUrl": "https://identity.example.com/.well-known/oauth-authorization-server",
|
|
112
|
-
// "requiredScopes": ["a2a.invoke"]
|
|
113
|
-
// }
|
|
114
|
-
|
|
115
|
-
"agents": {
|
|
116
|
-
// Fixed Bearer compatibility example. \`enabled\` is hot desired state:
|
|
117
|
-
// disabled Agents remain configured but are not candidates for new
|
|
118
|
-
// orchestration, while already admitted remote tasks may finish.
|
|
119
|
-
// "reporting": {
|
|
120
|
-
// "cardUrl": "https://agents.example.com/.well-known/agent-card.json",
|
|
121
|
-
// "enabled": true,
|
|
122
|
-
// "credentialEnv": "REPORTING_A2A_TOKEN",
|
|
123
|
-
// "effect": "read"
|
|
124
|
-
// },
|
|
125
|
-
|
|
126
|
-
// Standards-based machine-to-machine OAuth2 example. The external
|
|
127
|
-
// Authorization Server issues access tokens; KodaX obtains and caches them
|
|
128
|
-
// only in process memory. \`tokenUrl\` must exactly match the selected Card
|
|
129
|
-
// OAuth2 clientCredentials flow. Use \`kodax a2a enable|disable <name>\` to
|
|
130
|
-
// mutate \`enabled\` atomically; the owning Runtime applies it asynchronously.
|
|
131
|
-
// "reviewer": {
|
|
132
|
-
// "cardUrl": "https://reviewer.example.com/.well-known/agent-card.json",
|
|
133
|
-
// "enabled": false,
|
|
134
|
-
// "effect": "read",
|
|
135
|
-
// "authentication": {
|
|
136
|
-
// "type": "oauth2-client-credentials",
|
|
137
|
-
// "scheme": "enterprise-oauth",
|
|
138
|
-
// "issuer": "https://identity.example.com",
|
|
139
|
-
// "tokenUrl": "https://identity.example.com/oauth/token",
|
|
140
|
-
// "clientId": "kodax-reviewer",
|
|
141
|
-
// "clientSecretEnv": "REVIEWER_CLIENT_SECRET",
|
|
142
|
-
// "scopes": ["a2a.invoke"],
|
|
143
|
-
// "resource": "https://reviewer.example.com/",
|
|
144
|
-
// "clientAuthentication": "client-secret-basic"
|
|
145
|
-
// }
|
|
146
|
-
// }
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
`,extensions:`// Trusted user Extension paths: ~/.kodax/integrations/extensions.json.
|
|
150
|
-
// Extensions are host code. Reload is whole-domain atomic; use MCP for
|
|
151
|
-
// capabilities that should remain outside the KodaX process.
|
|
152
|
-
{
|
|
153
|
-
"version": 1,
|
|
154
|
-
"paths": []
|
|
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"},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};
|