@kodax-ai/kodax 0.7.78 → 0.7.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +3556 -3197
  2. package/README.md +371 -277
  3. package/README_CN.md +295 -215
  4. package/config-templates/config.example.jsonc +24 -2
  5. package/config-templates/integrations/a2a.example.jsonc +23 -7
  6. package/dist/builtin/skill-creator/scripts/aggregate-benchmark.js +2 -1
  7. package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +1 -0
  8. package/dist/builtin/skill-creator/scripts/analyze-benchmark.js +4 -3
  9. package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +1 -0
  10. package/dist/builtin/skill-creator/scripts/compare-runs.js +4 -3
  11. package/dist/builtin/skill-creator/scripts/generate-review.js +2 -1
  12. package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +1 -0
  13. package/dist/builtin/skill-creator/scripts/grade-evals.js +4 -3
  14. package/dist/builtin/skill-creator/scripts/improve-description.js +2 -1
  15. package/dist/builtin/skill-creator/scripts/init-skill.d.ts +1 -0
  16. package/dist/builtin/skill-creator/scripts/init-skill.js +4 -3
  17. package/dist/builtin/skill-creator/scripts/install-skill.d.ts +1 -0
  18. package/dist/builtin/skill-creator/scripts/install-skill.js +4 -3
  19. package/dist/builtin/skill-creator/scripts/package-skill.d.ts +1 -0
  20. package/dist/builtin/skill-creator/scripts/package-skill.js +4 -3
  21. package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +1 -0
  22. package/dist/builtin/skill-creator/scripts/quick-validate.js +4 -3
  23. package/dist/builtin/skill-creator/scripts/run-eval.d.ts +1 -0
  24. package/dist/builtin/skill-creator/scripts/run-eval.js +4 -3
  25. package/dist/builtin/skill-creator/scripts/run-loop.js +2 -1
  26. package/dist/builtin/skill-creator/scripts/run-trigger-eval.js +2 -1
  27. package/dist/builtin/skill-creator/scripts/utils.d.ts +3 -0
  28. package/dist/builtin/skill-creator/scripts/utils.js +5 -1
  29. package/dist/chunks/agent-5PHGNFW3.js +2 -0
  30. package/dist/chunks/argument-completer-FXRZFMTC.js +2 -0
  31. package/dist/chunks/chunk-6UENDY33.js +89 -0
  32. package/dist/chunks/{chunk-6FOJVETH.js → chunk-BWX4YZX3.js} +7 -7
  33. package/dist/chunks/chunk-CDCCTM5I.js +278 -0
  34. package/dist/chunks/chunk-CEB5FDND.js +810 -0
  35. package/dist/chunks/{chunk-2CFHBKRE.js → chunk-E7C4DRD2.js} +2 -2
  36. package/dist/chunks/chunk-EVXIJPZ6.js +218 -0
  37. package/dist/chunks/chunk-FQ7NVMSU.js +319 -0
  38. package/dist/chunks/chunk-GC4JBMBS.js +385 -0
  39. package/dist/chunks/{chunk-Z3KFRTSB.js → chunk-HTVLCHWH.js} +1 -1
  40. package/dist/chunks/chunk-IHPH3444.js +655 -0
  41. package/dist/chunks/{chunk-YAZQTC2L.js → chunk-KHEFUT6O.js} +1 -1
  42. package/dist/chunks/{chunk-7OEBJGHK.js → chunk-PMKAG4SZ.js} +1 -1
  43. package/dist/chunks/chunk-RPF5RGWZ.js +479 -0
  44. package/dist/chunks/{chunk-UID7BLAB.js → chunk-RXXKDR6Y.js} +1 -1
  45. package/dist/chunks/chunk-T5U4OP2N.js +292 -0
  46. package/dist/chunks/chunk-TRNAWSXP.js +123 -0
  47. package/dist/chunks/chunk-UZSHBQER.js +30 -0
  48. package/dist/chunks/{chunk-TQDBTTIM.js → chunk-VECRQTSD.js} +44 -44
  49. package/dist/chunks/compaction-config-6J6XCBJS.js +2 -0
  50. package/dist/chunks/{construction-bootstrap-VQLQGWPY.js → construction-bootstrap-KPCAE3VN.js} +1 -1
  51. package/dist/chunks/dist-RWEVZOFK.js +2 -0
  52. package/dist/chunks/{dist-BFT5YIGU.js → dist-WWL2DNIJ.js} +1 -1
  53. package/dist/chunks/host-OGS2R5J4.js +2 -0
  54. package/dist/chunks/run-manager-2YMM3BOT.js +2 -0
  55. package/dist/chunks/{utils-SID4HW2Q.js → utils-2YHRUZYC.js} +1 -1
  56. package/dist/index.d.ts +21 -20
  57. package/dist/index.js +4 -4
  58. package/dist/kodax_bootstrap.js +2 -1
  59. package/dist/kodax_cli.js +1850 -1476
  60. package/dist/kodax_resume.js +570 -34
  61. package/dist/provider-capabilities.json +85 -50
  62. package/dist/runtime-worker.js +1737 -1369
  63. package/dist/sandbox-workspace-session.js +285 -19
  64. package/dist/sdk-a2a.d.ts +19 -13
  65. package/dist/sdk-a2a.js +8 -8
  66. package/dist/sdk-agent.d.ts +80 -150
  67. package/dist/sdk-agent.js +1 -1
  68. package/dist/sdk-coding.d.ts +186 -66
  69. package/dist/sdk-coding.js +1 -1
  70. package/dist/sdk-experimental-memory.d.ts +3 -3
  71. package/dist/sdk-experimental-memory.js +1 -1
  72. package/dist/sdk-llm.d.ts +7 -7
  73. package/dist/sdk-llm.js +1 -1
  74. package/dist/sdk-mcp.d.ts +1 -1
  75. package/dist/sdk-mcp.js +1 -1
  76. package/dist/sdk-media.d.ts +1 -1
  77. package/dist/sdk-media.js +1 -1
  78. package/dist/sdk-repl.d.ts +31 -213
  79. package/dist/sdk-repl.js +2 -2
  80. package/dist/sdk-runtime.d.ts +230 -31
  81. package/dist/sdk-runtime.js +1 -1
  82. package/dist/sdk-sandbox.js +1 -1
  83. package/dist/sdk-session.d.ts +8 -8
  84. package/dist/sdk-session.js +1 -1
  85. package/dist/sdk-skills.js +1 -1
  86. package/dist/semantic-worker.js +283 -18
  87. package/dist/types-chunks/{base.d-4e74xDdy.d.ts → base.d-DxG0m09Z.d.ts} +1 -1
  88. package/dist/types-chunks/{bash-prefix-extractor.d-uAe2Oqda.d.ts → bash-prefix-extractor.d-DStqKIlu.d.ts} +31 -8
  89. package/dist/types-chunks/{capability-learning.d-CVsdHw4j.d.ts → capability-learning.d-iPSiAmc_.d.ts} +1 -1
  90. package/dist/types-chunks/{capsule.d-BlSv9l3V.d.ts → capsule.d-BuFJaYxA.d.ts} +14 -21
  91. package/dist/types-chunks/{types.d-BA-Jwpfs.d.ts → controller.d-C2aHqzHj.d.ts} +344 -11
  92. package/dist/types-chunks/{guardrail.d-CXDYRgZ3.d.ts → guardrail.d-DM-OK0m3.d.ts} +187 -116
  93. package/dist/types-chunks/{history-retrieval.d-DtCy7x64.d.ts → history-retrieval.d-DImTKgO6.d.ts} +16 -3
  94. package/dist/types-chunks/{oauth-login.d-Bgb4rdLN.d.ts → oauth-login.d-6i-vidxv.d.ts} +6 -2
  95. package/dist/types-chunks/{public-api.d-B3AohsxN.d.ts → public-api.d-CewTvUKV.d.ts} +335 -38
  96. package/dist/types-chunks/{repl.d-Ie_ZXb_U.d.ts → repl.d-DvXQtgr7.d.ts} +5 -5
  97. package/dist/types-chunks/{resolver.d-iAQ9ocLB.d.ts → resolver.d-C9IW4fmU.d.ts} +5 -2
  98. package/dist/types-chunks/{run-manager.d-D1twIhF9.d.ts → run-manager.d-C6ahvZqK.d.ts} +1 -1
  99. package/dist/types-chunks/{sdk-session-DB9KksIx.d.ts → sdk-session-C59RUrri.d.ts} +3 -3
  100. package/dist/types-chunks/shell-command-sets.d-Dp4UvPLL.d.ts +297 -0
  101. package/dist/types-chunks/{side-query.d-DTuLPcC5.d.ts → side-query.d-CP1LiRiH.d.ts} +8 -2
  102. package/dist/types-chunks/{types-D3g6XUQr.d.ts → types-Bf3Y3mW-.d.ts} +1 -1
  103. package/dist/types-chunks/{types.d-BH0ZkTGf.d.ts → types.d-BzpPDBPV.d.ts} +2 -2
  104. package/dist/types-chunks/{types.d-DIpZJKUl.d.ts → types.d-CgrXrFrq.d.ts} +16 -2
  105. package/dist/types-chunks/{types.d-DVDTIfB_.d.ts → types.d-yuJzE82x.d.ts} +4 -4
  106. package/dist/types-chunks/{utils.d-CVp6bFl9.d.ts → utils.d-BpACJmzt.d.ts} +24 -6
  107. package/docs/SDK_EMBEDDER_GUIDE.md +1148 -598
  108. package/package.json +6 -3
  109. package/dist/chunks/agent-ASP4MS3X.js +0 -2
  110. package/dist/chunks/argument-completer-JYQ7FX3W.js +0 -2
  111. package/dist/chunks/chunk-35PPHOQ2.js +0 -292
  112. package/dist/chunks/chunk-43QNNDHR.js +0 -29
  113. package/dist/chunks/chunk-5GO6FH7L.js +0 -458
  114. package/dist/chunks/chunk-5NDCSFOP.js +0 -78
  115. package/dist/chunks/chunk-6XM4B6K2.js +0 -48
  116. package/dist/chunks/chunk-6YZUE6NC.js +0 -240
  117. package/dist/chunks/chunk-KQLQYHWU.js +0 -386
  118. package/dist/chunks/chunk-NXO6GWSY.js +0 -46
  119. package/dist/chunks/chunk-T2XZTLYE.js +0 -316
  120. package/dist/chunks/chunk-VAT2QYXM.js +0 -765
  121. package/dist/chunks/chunk-YVRYHC4C.js +0 -655
  122. package/dist/chunks/compaction-config-BQSSIWK5.js +0 -2
  123. package/dist/chunks/dist-PCFE24YP.js +0 -2
  124. package/dist/chunks/host-UTFXCYYM.js +0 -2
  125. package/dist/chunks/run-manager-PJU3WIFJ.js +0 -2
  126. package/dist/types-chunks/guardrail.d-BRE_ErEj.d.ts +0 -156
@@ -16,6 +16,17 @@
16
16
  // Interactive Runtime hosting: "embedded" (this process) or "daemon".
17
17
  // "runtimeMode": "embedded",
18
18
 
19
+ // Worker-hosted embedded Runtime options. `configuredA2A` lets a
20
+ // Worker-hosted embedded Runtime load and reconcile
21
+ // ~/.kodax/integrations/a2a.json inside the Worker owner, so configured
22
+ // outbound A2A Agents appear as `external:<name>` and can be dispatched
23
+ // with spawn_agent. Default inline (non-Worker) CLI sessions already load
24
+ // the configured A2A plane automatically; this key switches the embedded
25
+ // session to a Worker-hosted Runtime and loads the plane in that mode.
26
+ // "worker": {
27
+ // "configuredA2A": true
28
+ // },
29
+
19
30
  // Native model reasoning. `effort` is the preferred explicit depth;
20
31
  // `reasoningCeiling` is the session ceiling. `reasoningMode` and `thinking`
21
32
  // remain accepted for backward compatibility.
@@ -36,20 +47,30 @@
36
47
  // "autoMode": {
37
48
  // "engine": "llm",
38
49
  // "classifierModel": "provider:model",
39
- // "timeoutMs": 20000,
50
+ // // Omit timeoutMs for the 45s first-attempt / 90s retry defaults.
51
+ // // A configured timeoutMs applies the same deadline to both attempts.
40
52
  // "speculativeWindowMs": 500
41
53
  // },
42
54
 
43
55
  // UI/manual locale.
44
56
  // "locale": "zh",
45
57
 
58
+ // Sensitive environment variables are filtered from model-issued commands by
59
+ // default. List exact host variable names here to pass them to the command
60
+ // target (including ASRT); values are never stored in this file. Project
61
+ // config cannot extend this user-level list. Execution-control variables such
62
+ // as NODE_OPTIONS and BASH_ENV remain blocked.
63
+ // "sandbox": {
64
+ // "envPass": ["GH_TOKEN", "GITHUB_TOKEN", "OPENAI_API_KEY"]
65
+ // },
66
+
46
67
  // Custom providers store public connection metadata only. Put the actual
47
68
  // credential in the named environment variable, never in this file. Use
48
69
  // `kodax setup --custom` for the guided writer.
49
70
  // "customProviders": [
50
71
  // {
51
72
  // "name": "my-relay",
52
- // "protocol": "openai",
73
+ // "protocol": "openai",
53
74
  // "baseUrl": "https://api.example.com/v1",
54
75
  // "apiKeyEnv": "MY_RELAY_API_KEY",
55
76
  // "model": "provider/model",
@@ -58,6 +79,7 @@
58
79
  // "userAgentMode": "compat",
59
80
  // "contextWindow": 128000,
60
81
  // "maxOutputTokens": 8192,
82
+ // "maxOutputTokensField": "max_completion_tokens",
61
83
  // "thinkingBudgetCap": 32000,
62
84
  // "promptCacheAffinity": false,
63
85
  // "replayReasoningContent": false,
@@ -66,13 +66,29 @@
66
66
  // Fixed Bearer compatibility example. `enabled` is hot desired state:
67
67
  // disabled Agents remain configured but are not candidates for new
68
68
  // orchestration, while already admitted remote tasks may finish.
69
- // "reporting": {
70
- // "cardUrl": "https://agents.example.com/.well-known/agent-card.json",
71
- // "enabled": true,
72
- // "credentialEnv": "REPORTING_A2A_TOKEN",
73
- // "effect": "read"
74
- // },
75
-
69
+ // "reporting": {
70
+ // "cardUrl": "https://agents.example.com/.well-known/agent-card.json",
71
+ // "enabled": true,
72
+ // "credentialEnv": "REPORTING_A2A_TOKEN",
73
+ // "effect": "read"
74
+ // },
75
+
76
+ // Private addresses and plaintext HTTP are separate, default-deny
77
+ // permissions. Exact loopback HTTP needs neither. Private HTTP needs both;
78
+ // private HTTPS needs only allowPrivateAddresses. Prefer TLS whenever it is
79
+ // available. The equivalent CLI flags are `--allow-private` and
80
+ // `--allow-insecure-http`. OAuth token endpoints keep their stricter
81
+ // HTTPS-or-exact-loopback rule even when Agent transport HTTP is allowed.
82
+ // "intranet": {
83
+ // "cardUrl": "http://10.20.30.40/.well-known/agent-card.json",
84
+ // "enabled": true,
85
+ // "network": {
86
+ // "allowPrivateAddresses": true,
87
+ // "allowInsecureHttp": true
88
+ // },
89
+ // "effect": "read"
90
+ // },
91
+
76
92
  // Standards-based machine-to-machine OAuth2 example. The external
77
93
  // Authorization Server issues access tokens; KodaX obtains and caches them
78
94
  // only in process memory. `tokenUrl` must exactly match the selected Card
@@ -198,7 +198,8 @@ async function main() {
198
198
  console.log(`Wrote ${benchmarkMdPath}`);
199
199
  }
200
200
 
201
- const isDirectRun = process.argv[1]
201
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
202
+ && process.argv[1]
202
203
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
203
204
 
204
205
  if (isDirectRun) {
@@ -44,3 +44,4 @@ export function analyzeBenchmark(
44
44
  analysisJsonPath: string;
45
45
  analysisMdPath: string;
46
46
  }>;
47
+ export declare function main(argv?: string[]): Promise<void>;
@@ -263,8 +263,8 @@ function parseArgs(argv) {
263
263
  return args;
264
264
  }
265
265
 
266
- async function main() {
267
- const args = parseArgs(process.argv);
266
+ export async function main(argv = process.argv) {
267
+ const args = parseArgs(argv);
268
268
  if (!args.workspaceDir) {
269
269
  console.error('Usage: node scripts/analyze-benchmark.js <workspace> [--benchmark benchmark.json] [--output analysis.json] [--markdown analysis.md]');
270
270
  process.exit(1);
@@ -278,7 +278,8 @@ async function main() {
278
278
  }, null, 2)}\n`);
279
279
  }
280
280
 
281
- const isDirectRun = process.argv[1]
281
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
282
+ && process.argv[1]
282
283
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
283
284
 
284
285
  if (isDirectRun) {
@@ -60,3 +60,4 @@ export function compareWorkspace(
60
60
  outputPath: string;
61
61
  markdownPath: string;
62
62
  }>;
63
+ export declare function main(argv?: string[]): Promise<void>;
@@ -307,8 +307,8 @@ function parseArgs(argv) {
307
307
  return args;
308
308
  }
309
309
 
310
- async function main() {
311
- const args = parseArgs(process.argv);
310
+ export async function main(argv = process.argv) {
311
+ const args = parseArgs(argv);
312
312
  if (!args.workspaceDir) {
313
313
  console.error('Usage: node scripts/compare-runs.js <workspace> [--config-a with_skill] [--config-b without_skill] [--output comparison.json]');
314
314
  process.exit(1);
@@ -322,7 +322,8 @@ async function main() {
322
322
  }, null, 2)}\n`);
323
323
  }
324
324
 
325
- const isDirectRun = process.argv[1]
325
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
326
+ && process.argv[1]
326
327
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
327
328
 
328
329
  if (isDirectRun) {
@@ -404,7 +404,8 @@ async function main() {
404
404
  });
405
405
  }
406
406
 
407
- const isDirectRun = process.argv[1]
407
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
408
+ && process.argv[1]
408
409
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
409
410
 
410
411
  if (isDirectRun) {
@@ -71,3 +71,4 @@ export function gradeWorkspace(
71
71
  processed_runs: Array<Record<string, unknown>>;
72
72
  skipped_runs: string[];
73
73
  }>;
74
+ export declare function main(argv?: string[]): Promise<void>;
@@ -383,8 +383,8 @@ function parseArgs(argv) {
383
383
  return args;
384
384
  }
385
385
 
386
- async function main() {
387
- const args = parseArgs(process.argv);
386
+ export async function main(argv = process.argv) {
387
+ const args = parseArgs(argv);
388
388
  if (!args.workspaceDir) {
389
389
  console.error('Usage: node scripts/grade-evals.js <workspace> [--provider anthropic] [--configs with_skill,without_skill] [--overwrite]');
390
390
  process.exit(1);
@@ -394,7 +394,8 @@ async function main() {
394
394
  process.stdout.write(`${JSON.stringify(summary, null, 2)}\n`);
395
395
  }
396
396
 
397
- const isDirectRun = process.argv[1]
397
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
398
+ && process.argv[1]
398
399
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
399
400
 
400
401
  if (isDirectRun) {
@@ -150,7 +150,8 @@ async function main() {
150
150
  }
151
151
  }
152
152
 
153
- const isDirectRun = process.argv[1]
153
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
154
+ && process.argv[1]
154
155
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
155
156
 
156
157
  if (isDirectRun) {
@@ -12,3 +12,4 @@ export function initSkill(options: InitSkillOptions): Promise<{
12
12
  skillDir: string;
13
13
  created: string[];
14
14
  }>;
15
+ export declare function main(argv?: string[]): Promise<void>;
@@ -131,8 +131,8 @@ function parseArgs(argv) {
131
131
  return args;
132
132
  }
133
133
 
134
- async function main() {
135
- const args = parseArgs(process.argv);
134
+ export async function main(argv = process.argv) {
135
+ const args = parseArgs(argv);
136
136
  if (!args.name) {
137
137
  console.error('Usage: node scripts/init-skill.js <skill-name> [--path <skills-dir>] [--description <text>] [--force] [--no-evals]');
138
138
  process.exit(1);
@@ -142,7 +142,8 @@ async function main() {
142
142
  console.log(`Initialized ${result.skillDir}`);
143
143
  }
144
144
 
145
- const isDirectRun = process.argv[1]
145
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
146
+ && process.argv[1]
146
147
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
147
148
 
148
149
  if (isDirectRun) {
@@ -27,3 +27,4 @@ export function installSkill(
27
27
  inputPath: string,
28
28
  options?: { skillsDir?: string; force?: boolean }
29
29
  ): Promise<InstalledSkillResult>;
30
+ export declare function main(argv?: string[]): Promise<void>;
@@ -154,8 +154,8 @@ function parseArgs(argv) {
154
154
  return args;
155
155
  }
156
156
 
157
- async function main() {
158
- const args = parseArgs(process.argv);
157
+ export async function main(argv = process.argv) {
158
+ const args = parseArgs(argv);
159
159
  if (!args.input) {
160
160
  console.error('Usage: node scripts/install-skill.js <skill-dir-or-archive> [--dest <skills-dir>] [--force]');
161
161
  process.exit(1);
@@ -165,7 +165,8 @@ async function main() {
165
165
  console.log(`Installed ${result.skillName} to ${result.installedTo}`);
166
166
  }
167
167
 
168
- const isDirectRun = process.argv[1]
168
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
169
+ && process.argv[1]
169
170
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
170
171
 
171
172
  if (isDirectRun) {
@@ -36,3 +36,4 @@ export function writeSkillPackage(
36
36
  outputPath: string,
37
37
  options?: { createdAt?: string }
38
38
  ): Promise<{ manifest: SkillPackageManifest; bytes: Uint8Array; outputPath: string }>;
39
+ export declare function main(argv?: string[]): Promise<void>;
@@ -100,8 +100,8 @@ function parseArgs(argv) {
100
100
  return args;
101
101
  }
102
102
 
103
- async function main() {
104
- const args = parseArgs(process.argv);
103
+ export async function main(argv = process.argv) {
104
+ const args = parseArgs(argv);
105
105
  if (!args.skillDir) {
106
106
  console.error('Usage: node scripts/package-skill.js <skill-dir> [--output <file.skill>]');
107
107
  process.exit(1);
@@ -113,7 +113,8 @@ async function main() {
113
113
  console.log(`Wrote ${result.outputPath}`);
114
114
  }
115
115
 
116
- const isDirectRun = process.argv[1]
116
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
117
+ && process.argv[1]
117
118
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
118
119
 
119
120
  if (isDirectRun) {
@@ -6,3 +6,4 @@ export interface SkillValidationResult {
6
6
  }
7
7
 
8
8
  export function validateSkillDirectory(skillDir: string): Promise<SkillValidationResult>;
9
+ export declare function main(argv?: string[]): Promise<void>;
@@ -127,8 +127,8 @@ export async function validateSkillDirectory(skillDir) {
127
127
  return result;
128
128
  }
129
129
 
130
- async function main() {
131
- const skillDir = process.argv[2];
130
+ export async function main(argv = process.argv) {
131
+ const skillDir = argv[2];
132
132
  if (!skillDir) {
133
133
  console.error('Usage: node scripts/quick-validate.js <skill-directory>');
134
134
  process.exit(1);
@@ -155,7 +155,8 @@ async function main() {
155
155
  process.exit(result.valid ? 0 : 1);
156
156
  }
157
157
 
158
- const isDirectRun = process.argv[1]
158
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
159
+ && process.argv[1]
159
160
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
160
161
 
161
162
  if (isDirectRun) {
@@ -64,3 +64,4 @@ export function runEvalWorkspace(
64
64
  runs_per_config: number;
65
65
  reports: Array<Record<string, unknown>>;
66
66
  }>;
67
+ export declare function main(argv?: string[]): Promise<void>;
@@ -327,8 +327,8 @@ function parseArgs(argv) {
327
327
  return args;
328
328
  }
329
329
 
330
- async function main() {
331
- const args = parseArgs(process.argv);
330
+ export async function main(argv = process.argv) {
331
+ const args = parseArgs(argv);
332
332
  if (!args.skillPath || !args.evalsPath || !args.workspaceDir) {
333
333
  console.error('Usage: node scripts/run-eval.js --skill-path <dir> --evals <evals.json> --workspace <dir> [--provider anthropic] [--runs 1]');
334
334
  process.exit(1);
@@ -345,7 +345,8 @@ async function main() {
345
345
  }
346
346
  }
347
347
 
348
- const isDirectRun = process.argv[1]
348
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
349
+ && process.argv[1]
349
350
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
350
351
 
351
352
  if (isDirectRun) {
@@ -232,7 +232,8 @@ async function main() {
232
232
  }
233
233
  }
234
234
 
235
- const isDirectRun = process.argv[1]
235
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
236
+ && process.argv[1]
236
237
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
237
238
 
238
239
  if (isDirectRun) {
@@ -214,7 +214,8 @@ async function main() {
214
214
  }
215
215
  }
216
216
 
217
- const isDirectRun = process.argv[1]
217
+ const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
218
+ && process.argv[1]
218
219
  && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
219
220
 
220
221
  if (isDirectRun) {
@@ -0,0 +1,3 @@
1
+ export declare function setKodaXSDKForSkillCreator(
2
+ sdk: Readonly<Record<string, unknown>>,
3
+ ): void;
@@ -31,7 +31,11 @@ import YAML from 'yaml';
31
31
  // See docs/ADR.md ADR-022 / ADR-024 + docs/HLD.md §12 for the SDK distribution
32
32
  // contract.
33
33
 
34
- let _cachedSdk = null;
34
+ let _cachedSdk = null;
35
+
36
+ export function setKodaXSDKForSkillCreator(sdk) {
37
+ _cachedSdk = sdk;
38
+ }
35
39
 
36
40
  export async function loadKodaXSDK() {
37
41
  if (_cachedSdk) return _cachedSdk;
@@ -0,0 +1,2 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{Ja as g,La as h,Ya as i,Za as j,a as c,db as k,ra as d,sa as e,ta as f}from"./chunk-VECRQTSD.js";import"./chunk-HTVLCHWH.js";import"./chunk-GC4JBMBS.js";import"./chunk-KHEFUT6O.js";import"./chunk-TRNAWSXP.js";import{wb as a,xb as b}from"./chunk-CEB5FDND.js";import"./chunk-EVXIJPZ6.js";import"./chunk-E7C4DRD2.js";import"./chunk-6UENDY33.js";import"./chunk-ONUPGMER.js";export{e as bucketProviderPayloadSize,g as buildAutoRepoIntelligenceContext,f as checkPromiseSignal,b as cleanupIncompleteToolCalls,h as describeTransientProviderRetry,c as emitResilienceDebug,d as estimateProviderPayloadBytes,k as runKodaX,j as saveRequiredSessionSnapshot,i as saveSessionSnapshot,a as validateAndFixToolHistory};
@@ -0,0 +1,2 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{Ea as a,Fa as b}from"./chunk-IHPH3444.js";import"./chunk-CDCCTM5I.js";import"./chunk-PMKAG4SZ.js";import"./chunk-RPF5RGWZ.js";import"./chunk-VECRQTSD.js";import"./chunk-RXXKDR6Y.js";import"./chunk-HTVLCHWH.js";import"./chunk-BWX4YZX3.js";import"./chunk-GC4JBMBS.js";import"./chunk-KHEFUT6O.js";import"./chunk-TRNAWSXP.js";import"./chunk-CEB5FDND.js";import"./chunk-EVXIJPZ6.js";import"./chunk-E7C4DRD2.js";import"./chunk-6UENDY33.js";import"./chunk-ONUPGMER.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
@@ -0,0 +1,89 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{a as n}from"./chunk-ONUPGMER.js";import{AsyncLocalStorage as $e}from"node:async_hooks";var Ue=new $e;function We(e){let t=Ue.getStore()?.credential;return t?S(e,t,new WeakMap):e}n(We,"redactScopedProviderCredential");function S(e,t,o){if(typeof e=="string")return e.split(t).join("[REDACTED_CREDENTIAL]");if(e===null||typeof e!="object")return e;let r=o.get(e);if(r!==void 0)return r;if(e instanceof Error){let s=new Error(S(e.message,t,o));return o.set(e,s),s.name=e.name,e.stack!==void 0&&(s.stack=S(e.stack,t,o)),s}if(Array.isArray(e)){let s=[];o.set(e,s);for(let l of e)s.push(S(l,t,o));return s}let i={};o.set(e,i);for(let[s,l]of Object.entries(Object.getOwnPropertyDescriptors(e))){if(!l.enumerable||!("value"in l))continue;let u=s.split(t).join("[REDACTED_CREDENTIAL]");i[u]=S(l.value,t,o)}return i}n(S,"redactCredentialValue");function X(e,t){return`${e}/${t??""}`}n(X,"capabilityCacheKey");function Ve(e,t,o){return e[X(t,o)]?.rejected??[]}n(Ve,"getRejectedEfforts");function ze(e,t,o,r,i,s){let l=X(t,o),u=e[l],m=u?.rejected.includes(r)?u.rejected:[...u?.rejected??[],r];return{...e,[l]:{rejected:m,source:i,updatedAt:s}}}n(ze,"addRejectedEffort");function He(e,t,o){if(!t)return{};let r={...e};return delete r[X(t,o)],r}n(He,"removeCacheEntry");function Ge(e){if(!e||typeof e!="object")return{};let t={};for(let[o,r]of Object.entries(e)){if(!r||typeof r!="object")continue;let i=r,s=Array.isArray(i.rejected)?i.rejected.filter(m=>typeof m=="string"):[],l=i.source==="probed"?"probed":"observed",u=typeof i.updatedAt=="string"?i.updatedAt:"";t[o]={rejected:s,source:l,updatedAt:u}}return t}n(Ge,"sanitizeCapabilityCache");import{AsyncLocalStorage as qe}from"node:async_hooks";var Je=new qe,Q=8,Y=32;function Qe(e){if(e===void 0)return;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:void 0}n(Qe,"parsePositiveInt");function Ye(){let e=L()?.workflow?.maxConcurrency,t=typeof e=="number"&&Number.isInteger(e)&&e>0?e:Qe(process.env.KODAX_WORKFLOW_MAX_CONCURRENCY)??Q;return Math.max(1,Math.min(Y,t))}n(Ye,"resolveWorkflowMaxConcurrency");function L(){return Je.getStore()}n(L,"getRunScopedConfig");var K={transport:"native-api",conversationSemantics:"full-history",mcpSupport:"none",contextFidelity:"full",toolCallingFidelity:"full",sessionSupport:"full",longRunningSupport:"full",multimodalSupport:"none",evidenceSupport:"full"},Z={...K,multimodalSupport:"image-input"},O={transport:"cli-bridge",conversationSemantics:"last-user-message",mcpSupport:"none",contextFidelity:"lossy",toolCallingFidelity:"limited",sessionSupport:"stateless",longRunningSupport:"limited",multimodalSupport:"none",evidenceSupport:"limited"},ee={...O,multimodalSupport:"image-input"};function F(e){return{transport:e.transport,conversationSemantics:e.conversationSemantics,mcpSupport:e.mcpSupport,contextFidelity:e.contextFidelity??"full",toolCallingFidelity:e.toolCallingFidelity??"full",sessionSupport:e.sessionSupport??"full",longRunningSupport:e.longRunningSupport??"full",multimodalSupport:e.multimodalSupport??"none",evidenceSupport:e.evidenceSupport??"full"}}n(F,"normalizeCapabilityProfile");import uo from"@anthropic-ai/sdk";import{parse as qn}from"partial-json";import xo from"openai";import{ClientSideConnection as Vo,PROTOCOL_VERSION as zo,ndJsonStream as Ho}from"@agentclientprotocol/sdk";var Bo=Object.freeze({status:"terminated"}),Lo=Object.freeze({status:"already-exited"}),Fo=Object.freeze({status:"unknown"}),jo=String.raw`
3
+ using System;
4
+ using System.Runtime.InteropServices;
5
+ using System.Text;
6
+ public static class KodaXNativeProcessSnapshot {
7
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
8
+ private struct ProcessEntry32 {
9
+ public uint dwSize;
10
+ public uint cntUsage;
11
+ public uint th32ProcessID;
12
+ public IntPtr th32DefaultHeapID;
13
+ public uint th32ModuleID;
14
+ public uint cntThreads;
15
+ public uint th32ParentProcessID;
16
+ public int pcPriClassBase;
17
+ public uint dwFlags;
18
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
19
+ public string szExeFile;
20
+ }
21
+ [DllImport("kernel32.dll", SetLastError = true)]
22
+ private static extern IntPtr CreateToolhelp32Snapshot(uint flags, uint processId);
23
+ [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
24
+ private static extern bool Process32First(IntPtr snapshot, ref ProcessEntry32 entry);
25
+ [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
26
+ private static extern bool Process32Next(IntPtr snapshot, ref ProcessEntry32 entry);
27
+ [StructLayout(LayoutKind.Sequential)]
28
+ private struct FileTime {
29
+ public uint Low;
30
+ public uint High;
31
+ }
32
+ [DllImport("kernel32.dll", SetLastError = true)]
33
+ private static extern IntPtr OpenProcess(uint access, bool inheritHandle, uint processId);
34
+ [DllImport("kernel32.dll", SetLastError = true)]
35
+ private static extern bool GetProcessTimes(IntPtr process, out FileTime creation, out FileTime exit, out FileTime kernel, out FileTime user);
36
+ [DllImport("kernel32.dll", SetLastError = true)]
37
+ private static extern bool TerminateProcess(IntPtr process, uint exitCode);
38
+ [DllImport("kernel32.dll")]
39
+ private static extern void GetSystemTimeAsFileTime(out FileTime systemTime);
40
+ [DllImport("kernel32.dll")]
41
+ private static extern bool CloseHandle(IntPtr handle);
42
+ private static ulong ReadCreationTime(uint processId) {
43
+ var process = OpenProcess(0x1000, false, processId);
44
+ if (process == IntPtr.Zero) return 0;
45
+ try {
46
+ FileTime creation, exit, kernel, user;
47
+ if (!GetProcessTimes(process, out creation, out exit, out kernel, out user)) return 0;
48
+ return ((ulong)creation.High << 32) | creation.Low;
49
+ } finally {
50
+ CloseHandle(process);
51
+ }
52
+ }
53
+ public static int TerminateExact(uint processId, ulong expectedCreationTime) {
54
+ var process = OpenProcess(0x1001, false, processId);
55
+ if (process == IntPtr.Zero) return 0;
56
+ try {
57
+ FileTime creation, exit, kernel, user;
58
+ if (!GetProcessTimes(process, out creation, out exit, out kernel, out user)) return 0;
59
+ var actual = (((ulong)creation.High << 32) | creation.Low) / 10000;
60
+ if (actual != expectedCreationTime) return 2;
61
+ return TerminateProcess(process, 1) ? 1 : 0;
62
+ } finally {
63
+ CloseHandle(process);
64
+ }
65
+ }
66
+ public static string ReadRows() {
67
+ FileTime cutoffTime;
68
+ GetSystemTimeAsFileTime(out cutoffTime);
69
+ var cutoff = (((ulong)cutoffTime.High << 32) | cutoffTime.Low) / 10000;
70
+ var snapshot = CreateToolhelp32Snapshot(2, 0);
71
+ if (snapshot == new IntPtr(-1)) return string.Empty;
72
+ var rows = new StringBuilder();
73
+ var entry = new ProcessEntry32();
74
+ entry.dwSize = (uint)Marshal.SizeOf(entry);
75
+ try {
76
+ if (!Process32First(snapshot, ref entry)) return string.Empty;
77
+ do {
78
+ var creationTime = ReadCreationTime(entry.th32ProcessID) / 10000;
79
+ if (creationTime == 0 || creationTime <= cutoff) {
80
+ rows.Append(entry.th32ProcessID).Append(',').Append(entry.th32ParentProcessID).Append(',').Append(creationTime).Append('\n');
81
+ }
82
+ entry.dwSize = (uint)Marshal.SizeOf(entry);
83
+ } while (Process32Next(snapshot, ref entry));
84
+ return rows.ToString();
85
+ } finally {
86
+ CloseHandle(snapshot);
87
+ }
88
+ }
89
+ }`;import ae from"node:fs";import de from"node:os";import le from"node:path";var kt="gpt-5.4",Ct="auto-gemini-3",Pt=["gpt-5.4","gpt-5.3-codex","gpt-5.3-codex-spark"],Rt=["auto-gemini-3","gemini-3.1-pro-preview","gemini-3-flash-preview","gemini-2.5-pro","gemini-2.5-flash"];function ue(e){let t=new Set,o=[];for(let r of e){let i=r.trim();if(!i)continue;let s=i.toLowerCase();t.has(s)||(t.add(s),o.push(i))}return o}n(ue,"dedupePreserveOrder");function Et(){let e=le.join(de.homedir(),".codex","config.toml");try{return ae.readFileSync(e,"utf8").match(/^\s*model\s*=\s*"([^"]+)"/m)?.[1]?.trim()||null}catch{return null}}n(Et,"readCodexConfiguredModel");function Tt(){let e=le.join(de.homedir(),".gemini","settings.json");try{let t=JSON.parse(ae.readFileSync(e,"utf8")),o=typeof t.model=="string"?t.model.trim():"";return o||(typeof t.general?.model=="string"?t.general.model.trim():"")||null}catch{return null}}n(Tt,"readGeminiConfiguredModel");function T(){return Et()||kt}n(T,"getCodexCliDefaultModel");function x(){return Tt()||Ct}n(x,"getGeminiCliDefaultModel");function _(){return ue([T(),...Pt])}n(_,"getCodexCliKnownModels");function A(){return ue([x(),...Rt])}n(A,"getGeminiCliKnownModels");var Mr=x(),wr=A();var Fr=T(),jr=_();import{existsSync as Dt,readFileSync as Nt}from"node:fs";import w from"node:path";import{fileURLToPath as Bt}from"node:url";var ce=["none","prompt-only","native-effort","native-budget","native-toggle","native-adaptive","unknown"],fe=["openai-responses-effort","openai-chat-effort","codex-cli-config","anthropic-output-effort","anthropic-reasoning-effort","provider-budget","provider-toggle","prompt-only","none"],pe=["anthropic-adaptive","anthropic-budget","provider-budget","provider-toggle","none"],ge=["zai-glm-5.2","zai-glm-toggle","deepseek-v4-flash-openai","deepseek-v4-pro-openai","deepseek-v4-openai","deepseek-v4-anthropic","deepseek-toggle","kimi-k3","kimi-k2.7-code","kimi-hybrid-toggle","minimax-m3","minimax-m2-always","mimo-v2.5-toggle","qwen-hybrid-thinking","openai-chat-reasoning","openai-responses-reasoning","codex-cli-effort","claude-adaptive-xhigh","claude-adaptive-max","anthropic-budget","generic-thinking-toggle","none"],me=["max_tokens","max_completion_tokens"],he=["native","image-input-native","cli-bridge","image-input-cli-bridge"],ye=["count-tokens","models-list","minimal-message","unsupported"];function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(h,"isPlainObject");function E(e,t){if(typeof e!="string"||e.length===0)throw new Error(`provider-capabilities.json: ${t} must be a non-empty string`);return e}n(E,"requireString");function M(e,t){if(e!==void 0)return E(e,t)}n(M,"optionalString");function ke(e,t){if(e!==void 0){if(typeof e!="string"||!me.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${me.join(", ")}, got ${JSON.stringify(e)}`);return e}}n(ke,"optionalMaxOutputTokensField");function R(e,t){if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e)||e<0)throw new Error(`provider-capabilities.json: ${t} must be a non-negative finite number`);return e}}n(R,"optionalNumber");function p(e,t){if(e!==void 0){if(typeof e!="boolean")throw new Error(`provider-capabilities.json: ${t} must be a boolean`);return e}}n(p,"optionalBoolean");function be(e,t){if(e!==void 0){if(!Array.isArray(e))throw new Error(`provider-capabilities.json: ${t} must be an array`);return e.map((o,r)=>E(o,`${t}[${r}]`))}}n(be,"optionalStringArray");function Mt(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o={};for(let[r,i]of Object.entries(e))o[r]=E(i,`${t}.${r}`);return o}n(Mt,"optionalStringMap");function wt(e,t){if(e!==void 0){if(typeof e!="string"||!ge.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ge.join(", ")}, got ${JSON.stringify(e)}`);return e}}n(wt,"optionalReasoningPreset");function U(e,t){if(typeof e!="string"||!ce.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ce.join(", ")}, got ${JSON.stringify(e)}`);return e}n(U,"requireReasoningCapability");function St(e,t){if(typeof e!="string"||!fe.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${fe.join(", ")}, got ${JSON.stringify(e)}`);return e}n(St,"requireEffortStrategy");function Kt(e,t){if(e!==void 0){if(typeof e!="string"||!pe.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${pe.join(", ")}, got ${JSON.stringify(e)}`);return e}}n(Kt,"optionalThinkingStrategy");function ve(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o=St(e.effortStrategy,`${t}.effortStrategy`),r=wt(e.reasoningPreset,`${t}.reasoningPreset`),i=Kt(e.thinkingStrategy,`${t}.thinkingStrategy`),s=M(e.defaultEffort,`${t}.defaultEffort`),l=Mt(e.effortAliases,`${t}.effortAliases`),u=be(e.disabledEfforts,`${t}.disabledEfforts`),m=be(e.localRejectEfforts,`${t}.localRejectEfforts`),y=p(e.allowCustomEffort,`${t}.allowCustomEffort`),b=p(e.supportsReasoningEffort,`${t}.supportsReasoningEffort`),v=p(e.supportsReasoningSummary,`${t}.supportsReasoningSummary`),k=p(e.supportsEncryptedReasoningReplay,`${t}.supportsEncryptedReasoningReplay`),C=p(e.supportsAdaptiveThinking,`${t}.supportsAdaptiveThinking`),a=p(e.supportsManualThinkingBudget,`${t}.supportsManualThinkingBudget`),P=p(e.supportsDisabledThinking,`${t}.supportsDisabledThinking`),g=p(e.requiresEffortBetaHeader,`${t}.requiresEffortBetaHeader`),d={effortStrategy:o};if(r!==void 0&&(d.reasoningPreset=r),i!==void 0&&(d.thinkingStrategy=i),s!==void 0&&(d.defaultEffort=s),l!==void 0&&(d.effortAliases=l),u!==void 0&&(d.disabledEfforts=u),m!==void 0&&(d.localRejectEfforts=m),e.supportedEfforts!==void 0){if(!Array.isArray(e.supportedEfforts))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts must be an array`);d.supportedEfforts=e.supportedEfforts.map((c,f)=>{if(!h(c))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts[${f}] must be an object`);return{value:E(c.value,`${t}.supportedEfforts[${f}].value`),...M(c.description,`${t}.supportedEfforts[${f}].description`)!==void 0?{description:M(c.description,`${t}.supportedEfforts[${f}].description`)}:{},...p(c.isDefault,`${t}.supportedEfforts[${f}].isDefault`)!==void 0?{isDefault:p(c.isDefault,`${t}.supportedEfforts[${f}].isDefault`)}:{},...p(c.isUserVisible,`${t}.supportedEfforts[${f}].isUserVisible`)!==void 0?{isUserVisible:p(c.isUserVisible,`${t}.supportedEfforts[${f}].isUserVisible`)}:{}}})}if(e.budgetByEffort!==void 0){if(!h(e.budgetByEffort))throw new Error(`provider-capabilities.json: ${t}.budgetByEffort must be an object`);let c={};for(let[f,J]of Object.entries(e.budgetByEffort))c[f]=R(J,`${t}.budgetByEffort.${f}`)??0;d.budgetByEffort=c}return y!==void 0&&(d.allowCustomEffort=y),b!==void 0&&(d.supportsReasoningEffort=b),v!==void 0&&(d.supportsReasoningSummary=v),k!==void 0&&(d.supportsEncryptedReasoningReplay=k),C!==void 0&&(d.supportsAdaptiveThinking=C),a!==void 0&&(d.supportsManualThinkingBudget=a),P!==void 0&&(d.supportsDisabledThinking=P),g!==void 0&&(d.requiresEffortBetaHeader=g),d}n(ve,"validateReasoningProfile");function Ce(e,t){let o=e.reasoningProfile,r=e.reasoningCapabilityV2;if(o!==void 0&&r!==void 0)throw new Error(`provider-capabilities.json: ${t} must not define both reasoningProfile and deprecated reasoningCapabilityV2`);return o!==void 0?ve(o,`${t}.reasoningProfile`):ve(r,`${t}.reasoningCapabilityV2`)}n(Ce,"validateReasoningProfileField");function _t(e,t){if(typeof e!="string"||!he.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${he.join(", ")}, got ${JSON.stringify(e)}`);return e}n(_t,"requireProfileName");function At(e,t){if(typeof e!="string"||!ye.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ye.join(", ")}, got ${JSON.stringify(e)}`);return e}n(At,"requireVerifyStrategy");function Xt(e,t){if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o=E(e.id,`${t}.id`),r=M(e.wireModel,`${t}.wireModel`),i=M(e.displayName,`${t}.displayName`),s=R(e.contextWindow,`${t}.contextWindow`),l=R(e.maxOutputTokens,`${t}.maxOutputTokens`),u=ke(e.maxOutputTokensField,`${t}.maxOutputTokensField`),m=R(e.thinkingBudgetCap,`${t}.thinkingBudgetCap`),y=p(e.replayReasoningContent,`${t}.replayReasoningContent`),b=p(e.strictThinkingSignature,`${t}.strictThinkingSignature`),v=R(e.streamMaxDurationMs,`${t}.streamMaxDurationMs`),k=e.reasoningCapability===void 0?void 0:U(e.reasoningCapability,`${t}.reasoningCapability`),C=Ce(e,t),a={id:o};return r!==void 0&&(a.wireModel=r),i!==void 0&&(a.displayName=i),s!==void 0&&(a.contextWindow=s),l!==void 0&&(a.maxOutputTokens=l),u!==void 0&&(a.maxOutputTokensField=u),m!==void 0&&(a.thinkingBudgetCap=m),k!==void 0&&(a.reasoningCapability=k),C!==void 0&&(a.reasoningProfile=C),y!==void 0&&(a.replayReasoningContent=y),b!==void 0&&(a.strictThinkingSignature=b),v!==void 0&&(a.streamMaxDurationMs=v),a}n(Xt,"validateModelDescriptor");function Ot(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o={};for(let[r,i]of Object.entries(e))o[r]=U(i,`${t}.${r}`);return o}n(Ot,"validateModelReasoningCapabilities");function It(e,t){if(!h(e))throw new Error(`provider-capabilities.json: providers.${t} must be an object`);let o=p(e.cliBridge,`providers.${t}.cliBridge`),r=E(e.apiKeyEnv,`providers.${t}.apiKeyEnv`),i=U(e.reasoningCapability,`providers.${t}.reasoningCapability`),s=Ce(e,`providers.${t}`),l=_t(e.capabilityProfile,`providers.${t}.capabilityProfile`),u=At(e.verifyStrategy,`providers.${t}.verifyStrategy`);if(o&&u!=="unsupported")throw new Error(`provider-capabilities.json: providers.${t} is a cliBridge entry but verifyStrategy="${u}" \u2014 must be "unsupported" (CLI binary owns credentials)`);let m=R(e.contextWindow,`providers.${t}.contextWindow`),y=R(e.maxOutputTokens,`providers.${t}.maxOutputTokens`),b=ke(e.maxOutputTokensField,`providers.${t}.maxOutputTokensField`),v=R(e.thinkingBudgetCap,`providers.${t}.thinkingBudgetCap`),k=p(e.supportsThinking,`providers.${t}.supportsThinking`),C=Ot(e.modelReasoningCapabilities,`providers.${t}.modelReasoningCapabilities`),a=M(e.model,`providers.${t}.model`);if(o&&(a!==void 0||e.models!==void 0))throw new Error(`provider-capabilities.json: providers.${t} is a cliBridge entry but defines model/models \u2014 must be omitted (filled at load time)`);if(!o&&a===void 0)throw new Error(`provider-capabilities.json: providers.${t}.model is required (only cliBridge entries may omit)`);let P;if(e.models!==void 0){if(!Array.isArray(e.models))throw new Error(`provider-capabilities.json: providers.${t}.models must be an array`);P=e.models.map((c,f)=>Xt(c,`providers.${t}.models[${f}]`));let d=new Set([...a===void 0?[]:[a],...P.map(c=>c.id)]);for(let[c,f]of P.entries())if(f.wireModel!==void 0&&!d.has(f.wireModel))throw new Error(`provider-capabilities.json: providers.${t}.models[${c}].wireModel must reference a declared model, got ${JSON.stringify(f.wireModel)}`)}let g={apiKeyEnv:r,reasoningCapability:i,capabilityProfile:l,verifyStrategy:u};return s!==void 0&&(g.reasoningProfile=s),a!==void 0&&(g.model=a),P!==void 0&&(g.models=P),m!==void 0&&(g.contextWindow=m),y!==void 0&&(g.maxOutputTokens=y),b!==void 0&&(g.maxOutputTokensField=b),v!==void 0&&(g.thinkingBudgetCap=v),k!==void 0&&(g.supportsThinking=k),C!==void 0&&(g.modelReasoningCapabilities=C),o&&(g.cliBridge=!0),g}n(It,"validateProviderEntry");function Pe(e){if(!h(e))throw new Error("provider-capabilities.json: root must be an object");if(e.version!==1)throw new Error(`provider-capabilities.json: version must be 1, got ${JSON.stringify(e.version)}`);let t=E(e.updatedAt,"updatedAt");if(!h(e.providers))throw new Error("provider-capabilities.json: providers must be an object");let o={};for(let[r,i]of Object.entries(e.providers))o[r]=It(i,r);return{version:1,updatedAt:t,providers:o}}n(Pe,"validateProviderCapabilitiesJson");var Lt=Object.freeze({native:K,"image-input-native":Z,"cli-bridge":O,"image-input-cli-bridge":ee}),B=null;function Ft(){if(process.env.KODAX_BUNDLED==="true")return w.join(w.dirname(process.execPath),"provider-capabilities.json");let e=w.dirname(Bt(import.meta.url)),t=[w.join(e,"provider-capabilities.json"),w.join(w.dirname(e),"provider-capabilities.json")];for(let o of t)if(Dt(o))return o;return t[0]}n(Ft,"resolveJsonPath");function jt(e){if(e.models){for(let t of e.models)t.reasoningProfile&&Re(t.reasoningProfile);for(let t of e.models)Object.freeze(t);Object.freeze(e.models)}return e.reasoningProfile&&Re(e.reasoningProfile),e.modelReasoningCapabilities&&Object.freeze(e.modelReasoningCapabilities),Object.freeze(e)}n(jt,"deepFreezeSnapshot");function Re(e){if(e.supportedEfforts){for(let t of e.supportedEfforts)Object.freeze(t);Object.freeze(e.supportedEfforts)}e.budgetByEffort&&Object.freeze(e.budgetByEffort),e.effortAliases&&Object.freeze(e.effortAliases),e.disabledEfforts&&Object.freeze(e.disabledEfforts),e.localRejectEfforts&&Object.freeze(e.localRejectEfforts),Object.freeze(e)}n(Re,"freezeReasoningProfile");function $t(e){if(e==="gemini-cli"){let t=x();return{model:t,models:A().filter(o=>o!==t).map(o=>({id:o}))}}if(e==="codex-cli"){let t=T();return{model:t,models:_().filter(o=>o!==t).map(o=>({id:o}))}}throw new Error(`provider-capabilities loader: unknown cliBridge provider '${e}'`)}n($t,"resolveCliBridgeModels");function Ut(e,t){let o=Lt[t.capabilityProfile];if(!o)throw new Error(`provider-capabilities loader: unknown capabilityProfile '${t.capabilityProfile}' for provider '${e}'`);if(t.cliBridge){let i=$t(e),s={model:i.model,models:i.models,apiKeyEnv:t.apiKeyEnv,reasoningCapability:t.reasoningCapability,capabilityProfile:o,verifyStrategy:t.verifyStrategy};return t.reasoningProfile!==void 0&&(s.reasoningProfile=t.reasoningProfile),t.supportsThinking!==void 0&&(s.supportsThinking=t.supportsThinking),s}let r={model:t.model,apiKeyEnv:t.apiKeyEnv,reasoningCapability:t.reasoningCapability,capabilityProfile:o,verifyStrategy:t.verifyStrategy};return t.reasoningProfile!==void 0&&(r.reasoningProfile=t.reasoningProfile),t.models!==void 0&&(r.models=t.models),t.modelReasoningCapabilities!==void 0&&(r.modelReasoningCapabilities=t.modelReasoningCapabilities),t.contextWindow!==void 0&&(r.contextWindow=t.contextWindow),t.maxOutputTokens!==void 0&&(r.maxOutputTokens=t.maxOutputTokens),t.maxOutputTokensField!==void 0&&(r.maxOutputTokensField=t.maxOutputTokensField),t.thinkingBudgetCap!==void 0&&(r.thinkingBudgetCap=t.thinkingBudgetCap),t.supportsThinking!==void 0&&(r.supportsThinking=t.supportsThinking),r}n(Ut,"buildSnapshot");function Ee(){if(B)return B;let e=Ft(),t;try{let i=Nt(e,"utf8");t=JSON.parse(i)}catch(i){let s=i instanceof Error?i.message:String(i);throw new Error(`provider-capabilities loader: failed to read ${e}: ${s}`)}let o=Pe(t),r={};for(let[i,s]of Object.entries(o.providers))r[i]=jt(Ut(i,s));return B=Object.freeze(r),B}n(Ee,"getProviderSnapshots");import ci from"@anthropic-ai/sdk";var z=Ee();var Te=process.env.KODAX_PROVIDER??"zhipu-coding";export{We as a,Ve as b,ze as c,He as d,Ge as e,Ye as f,F as g,z as h};