@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.
Files changed (130) hide show
  1. package/CHANGELOG.md +758 -371
  2. package/LICENSE +158 -158
  3. package/README.md +1702 -1508
  4. package/README_CN.md +1019 -869
  5. package/config-templates/config.example.jsonc +86 -4
  6. package/config-templates/integrations/a2a.example.jsonc +98 -98
  7. package/config-templates/integrations/extensions.example.jsonc +7 -7
  8. package/config-templates/integrations/mcp.example.jsonc +16 -16
  9. package/dist/builtin/code-review/SKILL.md +22 -22
  10. package/dist/builtin/skill-creator/scripts/aggregate-benchmark.d.ts +46 -46
  11. package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +46 -46
  12. package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +62 -62
  13. package/dist/builtin/skill-creator/scripts/generate-review.d.ts +33 -33
  14. package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +73 -73
  15. package/dist/builtin/skill-creator/scripts/improve-description.d.ts +23 -23
  16. package/dist/builtin/skill-creator/scripts/init-skill.d.ts +14 -14
  17. package/dist/builtin/skill-creator/scripts/install-skill.d.ts +29 -29
  18. package/dist/builtin/skill-creator/scripts/package-skill.d.ts +38 -38
  19. package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +8 -8
  20. package/dist/builtin/skill-creator/scripts/run-eval.d.ts +66 -66
  21. package/dist/builtin/skill-creator/scripts/run-loop.d.ts +49 -49
  22. package/dist/builtin/skill-creator/scripts/run-trigger-eval.d.ts +58 -58
  23. package/dist/chunks/agent-ASP4MS3X.js +2 -0
  24. package/dist/chunks/argument-completer-JYQ7FX3W.js +2 -0
  25. package/dist/chunks/chunk-2CFHBKRE.js +5 -0
  26. package/dist/chunks/chunk-35PPHOQ2.js +292 -0
  27. package/dist/chunks/chunk-43QNNDHR.js +29 -0
  28. package/dist/chunks/chunk-5BNQXXGY.js +1 -0
  29. package/dist/chunks/chunk-5GO6FH7L.js +458 -0
  30. package/dist/chunks/chunk-5NDCSFOP.js +78 -0
  31. package/dist/chunks/chunk-6FOJVETH.js +22 -0
  32. package/dist/chunks/chunk-6XM4B6K2.js +48 -0
  33. package/dist/chunks/chunk-6YZUE6NC.js +240 -0
  34. package/dist/chunks/{chunk-RDXRM3UI.js → chunk-7OEBJGHK.js} +1 -1
  35. package/dist/chunks/chunk-KQLQYHWU.js +386 -0
  36. package/dist/chunks/chunk-NXO6GWSY.js +46 -0
  37. package/dist/chunks/chunk-T2XZTLYE.js +316 -0
  38. package/dist/chunks/chunk-TQDBTTIM.js +348 -0
  39. package/dist/chunks/{chunk-SMT2JSM3.js → chunk-UID7BLAB.js} +9 -9
  40. package/dist/chunks/chunk-VAT2QYXM.js +765 -0
  41. package/dist/chunks/chunk-YAZQTC2L.js +5 -0
  42. package/dist/chunks/chunk-YVRYHC4C.js +655 -0
  43. package/dist/chunks/{chunk-PXKSE54E.js → chunk-Z3KFRTSB.js} +1 -1
  44. package/dist/chunks/compaction-config-BQSSIWK5.js +2 -0
  45. package/dist/chunks/{construction-bootstrap-5F5KF2BZ.js → construction-bootstrap-VQLQGWPY.js} +1 -1
  46. package/dist/chunks/dist-BFT5YIGU.js +2 -0
  47. package/dist/chunks/dist-PCFE24YP.js +2 -0
  48. package/dist/chunks/host-UTFXCYYM.js +2 -0
  49. package/dist/chunks/run-manager-PJU3WIFJ.js +2 -0
  50. package/dist/chunks/utils-SID4HW2Q.js +2 -0
  51. package/dist/index.d.ts +21 -19
  52. package/dist/index.js +6 -6
  53. package/dist/kodax_bootstrap.js +25 -25
  54. package/dist/kodax_cli.js +1787 -1341
  55. package/dist/kodax_resume.js +17 -17
  56. package/dist/provider-capabilities.json +392 -362
  57. package/dist/runtime-worker.js +1707 -1279
  58. package/dist/sandbox-workspace-session.js +563 -0
  59. package/dist/sdk-a2a.d.ts +18 -17
  60. package/dist/sdk-a2a.js +8 -8
  61. package/dist/sdk-agent.d.ts +320 -70
  62. package/dist/sdk-agent.js +1 -1
  63. package/dist/sdk-coding.d.ts +135 -168
  64. package/dist/sdk-coding.js +1 -1
  65. package/dist/sdk-experimental-memory.d.ts +14 -597
  66. package/dist/sdk-experimental-memory.js +1 -1
  67. package/dist/sdk-llm.d.ts +219 -6
  68. package/dist/sdk-llm.js +1 -1
  69. package/dist/sdk-mcp.js +1 -1
  70. package/dist/sdk-media.d.ts +1 -1
  71. package/dist/sdk-media.js +1 -1
  72. package/dist/sdk-repl.d.ts +70 -27
  73. package/dist/sdk-repl.js +2 -2
  74. package/dist/sdk-runtime.d.ts +212 -149
  75. package/dist/sdk-runtime.js +1 -1
  76. package/dist/sdk-sandbox.d.ts +93 -0
  77. package/dist/sdk-sandbox.js +2 -0
  78. package/dist/sdk-session.d.ts +8 -8
  79. package/dist/sdk-session.js +1 -1
  80. package/dist/sdk-skills.d.ts +2 -2
  81. package/dist/sdk-skills.js +1 -1
  82. package/dist/semantic-worker.js +15 -15
  83. package/dist/types-chunks/{base.d-ChvpaKjZ.d.ts → base.d-4e74xDdy.d.ts} +13 -1
  84. package/dist/types-chunks/{bash-prefix-extractor.d-r1beOESM.d.ts → bash-prefix-extractor.d-uAe2Oqda.d.ts} +319 -9
  85. package/dist/types-chunks/{capability-learning.d-DPrYxRjF.d.ts → capability-learning.d-CVsdHw4j.d.ts} +1 -1
  86. package/dist/types-chunks/{capsule.d-zeqV4IQX.d.ts → capsule.d-BlSv9l3V.d.ts} +2 -2
  87. package/dist/types-chunks/{guardrail.d-CWYD1bdL.d.ts → guardrail.d-BRE_ErEj.d.ts} +1 -1
  88. package/dist/types-chunks/{guardrail.d-qjuKJZ31.d.ts → guardrail.d-CXDYRgZ3.d.ts} +201 -35
  89. package/dist/types-chunks/{history-retrieval.d-BKTJIrVd.d.ts → history-retrieval.d-DtCy7x64.d.ts} +2 -2
  90. package/dist/types-chunks/{integration-config.d-ojG4swOP.d.ts → integration-config.d-BNowXE8k.d.ts} +23 -8
  91. package/dist/types-chunks/{public-api.d-CX4B11qY.d.ts → public-api.d-B3AohsxN.d.ts} +37 -8
  92. package/dist/types-chunks/{commands.d-DUxnK2TU.d.ts → repl.d-Ie_ZXb_U.d.ts} +89 -78
  93. package/dist/types-chunks/{side-query.d-DWTMsndP.d.ts → resolver.d-iAQ9ocLB.d.ts} +23 -74
  94. package/dist/types-chunks/{run-manager.d-B9fEIjZk.d.ts → run-manager.d-D1twIhF9.d.ts} +1 -1
  95. package/dist/types-chunks/{sdk-session-B0fhAOPa.d.ts → sdk-session-DB9KksIx.d.ts} +3 -3
  96. package/dist/types-chunks/side-query.d-DTuLPcC5.d.ts +77 -0
  97. package/dist/types-chunks/types-D3g6XUQr.d.ts +662 -0
  98. package/dist/types-chunks/{types.d-sRLugmjy.d.ts → types.d-BA-Jwpfs.d.ts} +506 -11
  99. package/dist/types-chunks/{types.d-DEctY20M.d.ts → types.d-BH0ZkTGf.d.ts} +2 -2
  100. package/dist/types-chunks/{types.d-DCQVBqVn.d.ts → types.d-BbtGlKZu.d.ts} +25 -3
  101. package/dist/types-chunks/{types.d-CSmF0t0n.d.ts → types.d-DIpZJKUl.d.ts} +15 -0
  102. package/dist/types-chunks/{types.d-Bm_y6YuM.d.ts → types.d-DVDTIfB_.d.ts} +4 -4
  103. package/dist/types-chunks/{utils.d-D0wPxz8y.d.ts → utils.d-CVp6bFl9.d.ts} +23 -7
  104. package/docs/SDK_EMBEDDER_GUIDE.md +592 -119
  105. package/package.json +9 -1
  106. package/scripts/kodax-bin.cjs +28 -28
  107. package/scripts/production-env.cjs +25 -25
  108. package/dist/chunks/agent-7X5CFET2.js +0 -2
  109. package/dist/chunks/argument-completer-3NHIKB4N.js +0 -2
  110. package/dist/chunks/chunk-4PWPNCNK.js +0 -158
  111. package/dist/chunks/chunk-7FJNLJLF.js +0 -369
  112. package/dist/chunks/chunk-COQYLD4U.js +0 -5
  113. package/dist/chunks/chunk-D3T24FJW.js +0 -78
  114. package/dist/chunks/chunk-EI4JBQKL.js +0 -46
  115. package/dist/chunks/chunk-HGT6WQ24.js +0 -321
  116. package/dist/chunks/chunk-HS3XHF3R.js +0 -622
  117. package/dist/chunks/chunk-IDCGNQ4H.js +0 -5
  118. package/dist/chunks/chunk-KAY2XLCP.js +0 -74
  119. package/dist/chunks/chunk-OD6LVXU6.js +0 -329
  120. package/dist/chunks/chunk-OSF3H4RR.js +0 -22
  121. package/dist/chunks/chunk-TGMBHGZO.js +0 -427
  122. package/dist/chunks/chunk-VWSLC2WO.js +0 -770
  123. package/dist/chunks/chunk-Y3AMP22L.js +0 -37
  124. package/dist/chunks/compaction-config-7J2XE35D.js +0 -2
  125. package/dist/chunks/dist-2RA7LSH3.js +0 -2
  126. package/dist/chunks/dist-URKXBOC6.js +0 -2
  127. package/dist/chunks/host-RKZ2OGFT.js +0 -2
  128. package/dist/chunks/run-manager-7RM4HEH6.js +0 -2
  129. package/dist/chunks/utils-X3TEH6IO.js +0 -2
  130. package/dist/types-chunks/center-types.d-BBT122uJ.d.ts +0 -91
@@ -0,0 +1,46 @@
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 je}from"node:async_hooks";var $e=new je;function Fe(e){let t=$e.getStore()?.credential;return t?M(e,t,new WeakMap):e}n(Fe,"redactScopedProviderCredential");function M(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(M(e.message,t,o));return o.set(e,s),s.name=e.name,e.stack!==void 0&&(s.stack=M(e.stack,t,o)),s}if(Array.isArray(e)){let s=[];o.set(e,s);for(let l of e)s.push(M(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]=M(l.value,t,o)}return i}n(M,"redactCredentialValue");function X(e,t){return`${e}/${t??""}`}n(X,"capabilityCacheKey");function Ue(e,t,o){return e[X(t,o)]?.rejected??[]}n(Ue,"getRejectedEfforts");function We(e,t,o,r,i,s){let l=X(t,o),u=e[l],g=u?.rejected.includes(r)?u.rejected:[...u?.rejected??[],r];return{...e,[l]:{rejected:g,source:i,updatedAt:s}}}n(We,"addRejectedEffort");function Ve(e,t,o){if(!t)return{};let r={...e};return delete r[X(t,o)],r}n(Ve,"removeCacheEntry");function ze(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(g=>typeof g=="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(ze,"sanitizeCapabilityCache");import{AsyncLocalStorage as He}from"node:async_hooks";var Ge=new He,Y=8,Q=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 Je(){let e=L()?.workflow?.maxConcurrency,t=typeof e=="number"&&Number.isInteger(e)&&e>0?e:qe(process.env.KODAX_WORKFLOW_MAX_CONCURRENCY)??Y;return Math.max(1,Math.min(Q,t))}n(Je,"resolveWorkflowMaxConcurrency");function L(){return Ge.getStore()}n(L,"getRunScopedConfig");var w={transport:"native-api",conversationSemantics:"full-history",mcpSupport:"none",contextFidelity:"full",toolCallingFidelity:"full",sessionSupport:"full",longRunningSupport:"full",multimodalSupport:"none",evidenceSupport:"full"},Z={...w,multimodalSupport:"image-input"},I={transport:"cli-bridge",conversationSemantics:"last-user-message",mcpSupport:"none",contextFidelity:"lossy",toolCallingFidelity:"limited",sessionSupport:"stateless",longRunningSupport:"limited",multimodalSupport:"none",evidenceSupport:"limited"},ee={...I,multimodalSupport:"image-input"};function j(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(j,"normalizeCapabilityProfile");import io from"@anthropic-ai/sdk";import{parse as Vn}from"partial-json";import Po from"openai";import{ClientSideConnection as No,PROTOCOL_VERSION as Lo,ndJsonStream as jo}from"@agentclientprotocol/sdk";var Io=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
+ [DllImport("kernel32.dll")]
28
+ private static extern bool CloseHandle(IntPtr handle);
29
+ public static string ReadRows() {
30
+ var snapshot = CreateToolhelp32Snapshot(2, 0);
31
+ if (snapshot == new IntPtr(-1)) return string.Empty;
32
+ var rows = new StringBuilder();
33
+ var entry = new ProcessEntry32();
34
+ entry.dwSize = (uint)Marshal.SizeOf(entry);
35
+ try {
36
+ if (!Process32First(snapshot, ref entry)) return string.Empty;
37
+ do {
38
+ rows.Append(entry.th32ProcessID).Append(',').Append(entry.th32ParentProcessID).Append('\n');
39
+ entry.dwSize = (uint)Marshal.SizeOf(entry);
40
+ } while (Process32Next(snapshot, ref entry));
41
+ return rows.ToString();
42
+ } finally {
43
+ CloseHandle(snapshot);
44
+ }
45
+ }
46
+ }`;import ae from"node:fs";import de from"node:os";import le from"node:path";var yt="gpt-5.4",bt="auto-gemini-3",vt=["gpt-5.4","gpt-5.3-codex","gpt-5.3-codex-spark"],Ct=["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 kt(){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(kt,"readCodexConfiguredModel");function Pt(){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(Pt,"readGeminiConfiguredModel");function E(){return kt()||yt}n(E,"getCodexCliDefaultModel");function T(){return Pt()||bt}n(T,"getGeminiCliDefaultModel");function K(){return ue([E(),...vt])}n(K,"getCodexCliKnownModels");function _(){return ue([T(),...Ct])}n(_,"getGeminiCliKnownModels");var Cr=T(),kr=_();var Xr=E(),Ir=K();import{existsSync as Xt,readFileSync as It}from"node:fs";import S from"node:path";import{fileURLToPath as Ot}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-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=["native","image-input-native","cli-bridge","image-input-cli-bridge"],he=["count-tokens","models-list","minimal-message","unsupported"];function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(h,"isPlainObject");function R(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(R,"requireString");function x(e,t){if(e!==void 0)return R(e,t)}n(x,"optionalString");function P(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(P,"optionalNumber");function f(e,t){if(e!==void 0){if(typeof e!="boolean")throw new Error(`provider-capabilities.json: ${t} must be a boolean`);return e}}n(f,"optionalBoolean");function ye(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)=>R(o,`${t}[${r}]`))}}n(ye,"optionalStringArray");function Et(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]=R(i,`${t}.${r}`);return o}n(Et,"optionalStringMap");function Tt(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(Tt,"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 xt(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(xt,"requireEffortStrategy");function St(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(St,"optionalThinkingStrategy");function be(e,t){if(e===void 0)return;if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o=xt(e.effortStrategy,`${t}.effortStrategy`),r=Tt(e.reasoningPreset,`${t}.reasoningPreset`),i=St(e.thinkingStrategy,`${t}.thinkingStrategy`),s=x(e.defaultEffort,`${t}.defaultEffort`),l=Et(e.effortAliases,`${t}.effortAliases`),u=ye(e.disabledEfforts,`${t}.disabledEfforts`),g=ye(e.localRejectEfforts,`${t}.localRejectEfforts`),y=f(e.allowCustomEffort,`${t}.allowCustomEffort`),b=f(e.supportsReasoningEffort,`${t}.supportsReasoningEffort`),v=f(e.supportsReasoningSummary,`${t}.supportsReasoningSummary`),C=f(e.supportsEncryptedReasoningReplay,`${t}.supportsEncryptedReasoningReplay`),d=f(e.supportsAdaptiveThinking,`${t}.supportsAdaptiveThinking`),k=f(e.supportsManualThinkingBudget,`${t}.supportsManualThinkingBudget`),p=f(e.supportsDisabledThinking,`${t}.supportsDisabledThinking`),A=f(e.requiresEffortBetaHeader,`${t}.requiresEffortBetaHeader`),a={effortStrategy:o};if(r!==void 0&&(a.reasoningPreset=r),i!==void 0&&(a.thinkingStrategy=i),s!==void 0&&(a.defaultEffort=s),l!==void 0&&(a.effortAliases=l),u!==void 0&&(a.disabledEfforts=u),g!==void 0&&(a.localRejectEfforts=g),e.supportedEfforts!==void 0){if(!Array.isArray(e.supportedEfforts))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts must be an array`);a.supportedEfforts=e.supportedEfforts.map((c,m)=>{if(!h(c))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts[${m}] must be an object`);return{value:R(c.value,`${t}.supportedEfforts[${m}].value`),...x(c.description,`${t}.supportedEfforts[${m}].description`)!==void 0?{description:x(c.description,`${t}.supportedEfforts[${m}].description`)}:{},...f(c.isDefault,`${t}.supportedEfforts[${m}].isDefault`)!==void 0?{isDefault:f(c.isDefault,`${t}.supportedEfforts[${m}].isDefault`)}:{},...f(c.isUserVisible,`${t}.supportedEfforts[${m}].isUserVisible`)!==void 0?{isUserVisible:f(c.isUserVisible,`${t}.supportedEfforts[${m}].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[m,J]of Object.entries(e.budgetByEffort))c[m]=P(J,`${t}.budgetByEffort.${m}`)??0;a.budgetByEffort=c}return y!==void 0&&(a.allowCustomEffort=y),b!==void 0&&(a.supportsReasoningEffort=b),v!==void 0&&(a.supportsReasoningSummary=v),C!==void 0&&(a.supportsEncryptedReasoningReplay=C),d!==void 0&&(a.supportsAdaptiveThinking=d),k!==void 0&&(a.supportsManualThinkingBudget=k),p!==void 0&&(a.supportsDisabledThinking=p),A!==void 0&&(a.requiresEffortBetaHeader=A),a}n(be,"validateReasoningProfile");function ve(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?be(o,`${t}.reasoningProfile`):be(r,`${t}.reasoningCapabilityV2`)}n(ve,"validateReasoningProfileField");function Mt(e,t){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(Mt,"requireProfileName");function wt(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(wt,"requireVerifyStrategy");function Kt(e,t){if(!h(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let o=R(e.id,`${t}.id`),r=x(e.wireModel,`${t}.wireModel`),i=x(e.displayName,`${t}.displayName`),s=P(e.contextWindow,`${t}.contextWindow`),l=P(e.maxOutputTokens,`${t}.maxOutputTokens`),u=P(e.thinkingBudgetCap,`${t}.thinkingBudgetCap`),g=f(e.replayReasoningContent,`${t}.replayReasoningContent`),y=f(e.strictThinkingSignature,`${t}.strictThinkingSignature`),b=P(e.streamMaxDurationMs,`${t}.streamMaxDurationMs`),v=e.reasoningCapability===void 0?void 0:U(e.reasoningCapability,`${t}.reasoningCapability`),C=ve(e,t),d={id:o};return r!==void 0&&(d.wireModel=r),i!==void 0&&(d.displayName=i),s!==void 0&&(d.contextWindow=s),l!==void 0&&(d.maxOutputTokens=l),u!==void 0&&(d.thinkingBudgetCap=u),v!==void 0&&(d.reasoningCapability=v),C!==void 0&&(d.reasoningProfile=C),g!==void 0&&(d.replayReasoningContent=g),y!==void 0&&(d.strictThinkingSignature=y),b!==void 0&&(d.streamMaxDurationMs=b),d}n(Kt,"validateModelDescriptor");function _t(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(_t,"validateModelReasoningCapabilities");function At(e,t){if(!h(e))throw new Error(`provider-capabilities.json: providers.${t} must be an object`);let o=f(e.cliBridge,`providers.${t}.cliBridge`),r=R(e.apiKeyEnv,`providers.${t}.apiKeyEnv`),i=U(e.reasoningCapability,`providers.${t}.reasoningCapability`),s=ve(e,`providers.${t}`),l=Mt(e.capabilityProfile,`providers.${t}.capabilityProfile`),u=wt(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 g=P(e.contextWindow,`providers.${t}.contextWindow`),y=P(e.maxOutputTokens,`providers.${t}.maxOutputTokens`),b=P(e.thinkingBudgetCap,`providers.${t}.thinkingBudgetCap`),v=f(e.supportsThinking,`providers.${t}.supportsThinking`),C=_t(e.modelReasoningCapabilities,`providers.${t}.modelReasoningCapabilities`),d=x(e.model,`providers.${t}.model`);if(o&&(d!==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&&d===void 0)throw new Error(`provider-capabilities.json: providers.${t}.model is required (only cliBridge entries may omit)`);let k;if(e.models!==void 0){if(!Array.isArray(e.models))throw new Error(`provider-capabilities.json: providers.${t}.models must be an array`);k=e.models.map((a,c)=>Kt(a,`providers.${t}.models[${c}]`));let A=new Set([...d===void 0?[]:[d],...k.map(a=>a.id)]);for(let[a,c]of k.entries())if(c.wireModel!==void 0&&!A.has(c.wireModel))throw new Error(`provider-capabilities.json: providers.${t}.models[${a}].wireModel must reference a declared model, got ${JSON.stringify(c.wireModel)}`)}let p={apiKeyEnv:r,reasoningCapability:i,capabilityProfile:l,verifyStrategy:u};return s!==void 0&&(p.reasoningProfile=s),d!==void 0&&(p.model=d),k!==void 0&&(p.models=k),g!==void 0&&(p.contextWindow=g),y!==void 0&&(p.maxOutputTokens=y),b!==void 0&&(p.thinkingBudgetCap=b),v!==void 0&&(p.supportsThinking=v),C!==void 0&&(p.modelReasoningCapabilities=C),o&&(p.cliBridge=!0),p}n(At,"validateProviderEntry");function Ce(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=R(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]=At(i,r);return{version:1,updatedAt:t,providers:o}}n(Ce,"validateProviderCapabilitiesJson");var Dt=Object.freeze({native:w,"image-input-native":Z,"cli-bridge":I,"image-input-cli-bridge":ee}),N=null;function Bt(){if(process.env.KODAX_BUNDLED==="true")return S.join(S.dirname(process.execPath),"provider-capabilities.json");let e=S.dirname(Ot(import.meta.url)),t=[S.join(e,"provider-capabilities.json"),S.join(S.dirname(e),"provider-capabilities.json")];for(let o of t)if(Xt(o))return o;return t[0]}n(Bt,"resolveJsonPath");function Nt(e){if(e.models){for(let t of e.models)t.reasoningProfile&&ke(t.reasoningProfile);for(let t of e.models)Object.freeze(t);Object.freeze(e.models)}return e.reasoningProfile&&ke(e.reasoningProfile),e.modelReasoningCapabilities&&Object.freeze(e.modelReasoningCapabilities),Object.freeze(e)}n(Nt,"deepFreezeSnapshot");function ke(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(ke,"freezeReasoningProfile");function Lt(e){if(e==="gemini-cli"){let t=T();return{model:t,models:_().filter(o=>o!==t).map(o=>({id:o}))}}if(e==="codex-cli"){let t=E();return{model:t,models:K().filter(o=>o!==t).map(o=>({id:o}))}}throw new Error(`provider-capabilities loader: unknown cliBridge provider '${e}'`)}n(Lt,"resolveCliBridgeModels");function jt(e,t){let o=Dt[t.capabilityProfile];if(!o)throw new Error(`provider-capabilities loader: unknown capabilityProfile '${t.capabilityProfile}' for provider '${e}'`);if(t.cliBridge){let i=Lt(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.thinkingBudgetCap!==void 0&&(r.thinkingBudgetCap=t.thinkingBudgetCap),t.supportsThinking!==void 0&&(r.supportsThinking=t.supportsThinking),r}n(jt,"buildSnapshot");function Pe(){if(N)return N;let e=Bt(),t;try{let i=It(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=Ce(t),r={};for(let[i,s]of Object.entries(o.providers))r[i]=Nt(jt(i,s));return N=Object.freeze(r),N}n(Pe,"getProviderSnapshots");import ri from"@anthropic-ai/sdk";var z=Pe();var Re=process.env.KODAX_PROVIDER??"zhipu-coding";export{Fe as a,Ue as b,We as c,Ve as d,ze as e,Je as f,j as g,z as h};