@kodax-ai/kodax 0.7.67 → 0.7.69

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 (102) hide show
  1. package/CHANGELOG.md +209 -3
  2. package/README.md +61 -9
  3. package/README_CN.md +58 -9
  4. package/config-templates/config.example.jsonc +26 -0
  5. package/config-templates/integrations/a2a.example.jsonc +54 -0
  6. package/config-templates/integrations/extensions.example.jsonc +7 -0
  7. package/config-templates/integrations/mcp.example.jsonc +16 -0
  8. package/dist/chunks/agent-DQRXT6M7.js +2 -0
  9. package/dist/chunks/argument-completer-RSK6CCGP.js +2 -0
  10. package/dist/chunks/chunk-4WIODYOH.js +329 -0
  11. package/dist/chunks/chunk-AWMTNUDS.js +37 -0
  12. package/dist/chunks/chunk-F7C7J6IM.js +7 -0
  13. package/dist/chunks/chunk-I4TPQEJN.js +5 -0
  14. package/dist/chunks/chunk-M7TCFYTO.js +107 -0
  15. package/dist/chunks/chunk-NGHQIGVW.js +46 -0
  16. package/dist/chunks/chunk-NGJURAY5.js +306 -0
  17. package/dist/chunks/{chunk-KBBGDRER.js → chunk-PA76WUBL.js} +2 -2
  18. package/dist/chunks/chunk-PQ3XUSY2.js +357 -0
  19. package/dist/chunks/chunk-UJEMSPM5.js +78 -0
  20. package/dist/chunks/{chunk-DEICMTHO.js → chunk-URC6ZI6P.js} +1 -1
  21. package/dist/chunks/{chunk-EN3O2C43.js → chunk-VAZ25MDX.js} +122 -122
  22. package/dist/chunks/chunk-VYKFM3TB.js +751 -0
  23. package/dist/chunks/chunk-WW2O2DEP.js +2 -0
  24. package/dist/chunks/chunk-Y4WOTWUC.js +2 -0
  25. package/dist/chunks/chunk-Z4PPLJF2.js +60 -0
  26. package/dist/chunks/chunk-ZG4DMYBS.js +422 -0
  27. package/dist/chunks/compaction-config-ABLL6UH3.js +2 -0
  28. package/dist/chunks/{construction-bootstrap-GLEHQ2KB.js → construction-bootstrap-GH6RW6ST.js} +1 -1
  29. package/dist/chunks/dist-DRBKYVHF.js +2 -0
  30. package/dist/chunks/dist-RWL2RBO4.js +2 -0
  31. package/dist/chunks/host-7SAB4WEC.js +2 -0
  32. package/dist/chunks/run-manager-XMDKTONJ.js +2 -0
  33. package/dist/chunks/utils-QYE5Y73D.js +2 -0
  34. package/dist/index.d.ts +19 -19
  35. package/dist/index.js +6 -6
  36. package/dist/kodax_cli.js +1497 -1209
  37. package/dist/runtime-worker.js +1371 -1107
  38. package/dist/sdk-a2a.d.ts +397 -0
  39. package/dist/sdk-a2a.js +9 -0
  40. package/dist/sdk-agent.d.ts +172 -33
  41. package/dist/sdk-agent.js +1 -1
  42. package/dist/sdk-coding.d.ts +126 -51
  43. package/dist/sdk-coding.js +1 -1
  44. package/dist/sdk-experimental-memory.d.ts +618 -0
  45. package/dist/sdk-experimental-memory.js +2 -0
  46. package/dist/sdk-llm.d.ts +16 -9
  47. package/dist/sdk-llm.js +1 -1
  48. package/dist/sdk-mcp.d.ts +1 -1
  49. package/dist/sdk-mcp.js +1 -1
  50. package/dist/sdk-media.d.ts +1 -1
  51. package/dist/sdk-media.js +1 -1
  52. package/dist/sdk-repl.d.ts +35 -101
  53. package/dist/sdk-repl.js +2 -2
  54. package/dist/sdk-runtime.d.ts +744 -21
  55. package/dist/sdk-runtime.js +1 -1
  56. package/dist/sdk-session.d.ts +7 -7
  57. package/dist/sdk-session.js +1 -1
  58. package/dist/sdk-skills.js +1 -1
  59. package/dist/semantic-worker.js +100 -12
  60. package/dist/types-chunks/{base.d-DalIRhbb.d.ts → base.d-CYjtB68X.d.ts} +1 -1
  61. package/dist/types-chunks/{bash-prefix-extractor.d-D57Gt6n8.d.ts → bash-prefix-extractor.d-BkIA8Wto.d.ts} +89 -18
  62. package/dist/types-chunks/{capability-learning.d-BQB0M70w.d.ts → capability-learning.d-WtsyRv3O.d.ts} +1 -1
  63. package/dist/types-chunks/{capsule.d-BZmqu_HL.d.ts → capsule.d-xJvfh4YR.d.ts} +5 -5
  64. package/dist/types-chunks/{commands.d-Cg26ud-Y.d.ts → commands.d-DkPfcQWG.d.ts} +4 -4
  65. package/dist/types-chunks/{cost-tracker.d-CBLk1fiD.d.ts → cost-tracker.d-BeaenODW.d.ts} +4 -1
  66. package/dist/types-chunks/{guardrail.d-Ds7JHxR1.d.ts → guardrail.d-6ZDbNbHO.d.ts} +1 -1
  67. package/dist/types-chunks/{guardrail.d-vSaBe64I.d.ts → guardrail.d-R7AiGfrI.d.ts} +4 -4
  68. package/dist/types-chunks/integration-config.d-ojG4swOP.d.ts +95 -0
  69. package/dist/types-chunks/{manager.d-Zum9cGHU.d.ts → manager.d-CoEuPRAo.d.ts} +4 -1
  70. package/dist/types-chunks/{public-api.d-CPBMPDiU.d.ts → public-api.d-7G4--RZE.d.ts} +6 -7
  71. package/dist/types-chunks/{resolver.d-CGkfRULj.d.ts → resolver.d-CIVoGc97.d.ts} +2 -2
  72. package/dist/types-chunks/{run-manager.d-lnwnfyNC.d.ts → run-manager.d-BaXtkryp.d.ts} +1 -1
  73. package/dist/types-chunks/{sdk-session-ByoMLoUS.d.ts → sdk-session-BQccrODn.d.ts} +6 -4
  74. package/dist/types-chunks/{types.d-DG9B4SMm.d.ts → types.d-BtC4yLYO.d.ts} +170 -13
  75. package/dist/types-chunks/{types.d-DYv3a1ka.d.ts → types.d-C9YHEAmA.d.ts} +38 -7
  76. package/dist/types-chunks/{types.d-DU9lLkmE.d.ts → types.d-CJR7t6iW.d.ts} +2 -2
  77. package/dist/types-chunks/{types.d-Bp4Lm1jv.d.ts → types.d-TTvpAGWf.d.ts} +11 -1
  78. package/dist/types-chunks/{utils.d-DMI-9GTR.d.ts → utils.d-BbB5jzi1.d.ts} +15 -7
  79. package/docs/SDK_EMBEDDER_GUIDE.md +732 -14
  80. package/package.json +14 -2
  81. package/dist/chunks/agent-E4V5SLX6.js +0 -2
  82. package/dist/chunks/argument-completer-N6RT5KYT.js +0 -2
  83. package/dist/chunks/chunk-AKMXJSGM.js +0 -56
  84. package/dist/chunks/chunk-CW32NQFO.js +0 -2
  85. package/dist/chunks/chunk-D6QVXQNI.js +0 -1
  86. package/dist/chunks/chunk-NVDK375I.js +0 -729
  87. package/dist/chunks/chunk-O7N22GJ3.js +0 -31
  88. package/dist/chunks/chunk-PZTG2C33.js +0 -7
  89. package/dist/chunks/chunk-QI6SQ2UQ.js +0 -306
  90. package/dist/chunks/chunk-QJJKMNZF.js +0 -2
  91. package/dist/chunks/chunk-RS2GAABJ.js +0 -328
  92. package/dist/chunks/chunk-W2XMNYLK.js +0 -15
  93. package/dist/chunks/chunk-WCSSXBHR.js +0 -419
  94. package/dist/chunks/chunk-YH5BTUQO.js +0 -343
  95. package/dist/chunks/chunk-YRBNXFHY.js +0 -2
  96. package/dist/chunks/compaction-config-56NO42ZI.js +0 -2
  97. package/dist/chunks/dist-4PXB7U22.js +0 -2
  98. package/dist/chunks/dist-4UIRSSFS.js +0 -2
  99. package/dist/chunks/host-DMREFNSO.js +0 -2
  100. package/dist/chunks/paste-C33GZQV5.js +0 -2
  101. package/dist/chunks/run-manager-P5XMSGZ7.js +0 -2
  102. package/dist/chunks/utils-JENPFKAE.js +0 -2
@@ -0,0 +1,46 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{a as o}from"./chunk-ONUPGMER.js";import{AsyncLocalStorage as Be}from"node:async_hooks";var Ne=new Be;function Le(e){let t=Ne.getStore()?.credential;return t?S(e,t,new WeakMap):e}o(Le,"redactScopedProviderCredential");function S(e,t,n){if(typeof e=="string")return e.split(t).join("[REDACTED_CREDENTIAL]");if(e===null||typeof e!="object")return e;let r=n.get(e);if(r!==void 0)return r;if(e instanceof Error){let s=new Error(S(e.message,t,n));return n.set(e,s),s.name=e.name,e.stack!==void 0&&(s.stack=S(e.stack,t,n)),s}if(Array.isArray(e)){let s=[];n.set(e,s);for(let d of e)s.push(S(d,t,n));return s}let i={};n.set(e,i);for(let[s,d]of Object.entries(Object.getOwnPropertyDescriptors(e))){if(!d.enumerable||!("value"in d))continue;let l=s.split(t).join("[REDACTED_CREDENTIAL]");i[l]=S(d.value,t,n)}return i}o(S,"redactCredentialValue");function A(e,t){return`${e}/${t??""}`}o(A,"capabilityCacheKey");function je(e,t,n){return e[A(t,n)]?.rejected??[]}o(je,"getRejectedEfforts");function $e(e,t,n,r,i,s){let d=A(t,n),l=e[d],p=l?.rejected.includes(r)?l.rejected:[...l?.rejected??[],r];return{...e,[d]:{rejected:p,source:i,updatedAt:s}}}o($e,"addRejectedEffort");function Fe(e,t,n){if(!t)return{};let r={...e};return delete r[A(t,n)],r}o(Fe,"removeCacheEntry");function Ue(e){if(!e||typeof e!="object")return{};let t={};for(let[n,r]of Object.entries(e)){if(!r||typeof r!="object")continue;let i=r,s=Array.isArray(i.rejected)?i.rejected.filter(p=>typeof p=="string"):[],d=i.source==="probed"?"probed":"observed",l=typeof i.updatedAt=="string"?i.updatedAt:"";t[n]={rejected:s,source:d,updatedAt:l}}return t}o(Ue,"sanitizeCapabilityCache");import{AsyncLocalStorage as We}from"node:async_hooks";var Ve=new We,J=8,Y=32;function ze(e){if(e===void 0)return;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:void 0}o(ze,"parsePositiveInt");function qe(){let e=I()?.workflow?.maxConcurrency,t=typeof e=="number"&&Number.isInteger(e)&&e>0?e:ze(process.env.KODAX_WORKFLOW_MAX_CONCURRENCY)??J;return Math.max(1,Math.min(Y,t))}o(qe,"resolveWorkflowMaxConcurrency");function I(){return Ve.getStore()}o(I,"getRunScopedConfig");var K={transport:"native-api",conversationSemantics:"full-history",mcpSupport:"none",contextFidelity:"full",toolCallingFidelity:"full",sessionSupport:"full",longRunningSupport:"full",multimodalSupport:"none",evidenceSupport:"full"},Q={...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"},Z={...O,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"}}o(j,"normalizeCapabilityProfile");import tn from"@anthropic-ai/sdk";import{parse as $o}from"partial-json";import yn from"openai";import{ClientSideConnection as _n,PROTOCOL_VERSION as Xn,ndJsonStream as An}from"@agentclientprotocol/sdk";var Sn=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 ie from"node:fs";import se from"node:os";import ae from"node:path";var pt="gpt-5.4",gt="auto-gemini-3",mt=["gpt-5.4","gpt-5.3-codex","gpt-5.3-codex-spark"],yt=["auto-gemini-3","gemini-3.1-pro-preview","gemini-3-flash-preview","gemini-2.5-pro","gemini-2.5-flash"];function de(e){let t=new Set,n=[];for(let r of e){let i=r.trim();if(!i)continue;let s=i.toLowerCase();t.has(s)||(t.add(s),n.push(i))}return n}o(de,"dedupePreserveOrder");function ht(){let e=ae.join(se.homedir(),".codex","config.toml");try{return ie.readFileSync(e,"utf8").match(/^\s*model\s*=\s*"([^"]+)"/m)?.[1]?.trim()||null}catch{return null}}o(ht,"readCodexConfiguredModel");function bt(){let e=ae.join(se.homedir(),".gemini","settings.json");try{let t=JSON.parse(ie.readFileSync(e,"utf8")),n=typeof t.model=="string"?t.model.trim():"";return n||(typeof t.general?.model=="string"?t.general.model.trim():"")||null}catch{return null}}o(bt,"readGeminiConfiguredModel");function E(){return ht()||pt}o(E,"getCodexCliDefaultModel");function T(){return bt()||gt}o(T,"getGeminiCliDefaultModel");function M(){return de([E(),...mt])}o(M,"getCodexCliKnownModels");function w(){return de([T(),...yt])}o(w,"getGeminiCliKnownModels");var pr=T(),gr=w();var xr=E(),Sr=M();import{existsSync as wt,readFileSync as _t}from"node:fs";import x from"node:path";import{fileURLToPath as Xt}from"node:url";var le=["none","prompt-only","native-effort","native-budget","native-toggle","native-adaptive","unknown"],ue=["openai-responses-effort","openai-chat-effort","codex-cli-config","anthropic-output-effort","provider-budget","provider-toggle","prompt-only","none"],ce=["anthropic-adaptive","anthropic-budget","provider-budget","provider-toggle","none"],fe=["zai-glm-5.2","zai-glm-toggle","deepseek-v4-openai","deepseek-v4-anthropic","deepseek-toggle","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"],pe=["native","image-input-native","cli-bridge","image-input-cli-bridge"],ge=["count-tokens","models-list","minimal-message","unsupported"];function y(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(y,"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}o(R,"requireString");function _(e,t){if(e!==void 0)return R(e,t)}o(_,"optionalString");function C(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}}o(C,"optionalNumber");function c(e,t){if(e!==void 0){if(typeof e!="boolean")throw new Error(`provider-capabilities.json: ${t} must be a boolean`);return e}}o(c,"optionalBoolean");function me(e,t){if(e!==void 0){if(!Array.isArray(e))throw new Error(`provider-capabilities.json: ${t} must be an array`);return e.map((n,r)=>R(n,`${t}[${r}]`))}}o(me,"optionalStringArray");function kt(e,t){if(e===void 0)return;if(!y(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let n={};for(let[r,i]of Object.entries(e))n[r]=R(i,`${t}.${r}`);return n}o(kt,"optionalStringMap");function Rt(e,t){if(e!==void 0){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}}o(Rt,"optionalReasoningPreset");function F(e,t){if(typeof e!="string"||!le.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${le.join(", ")}, got ${JSON.stringify(e)}`);return e}o(F,"requireReasoningCapability");function Pt(e,t){if(typeof e!="string"||!ue.includes(e))throw new Error(`provider-capabilities.json: ${t} must be one of ${ue.join(", ")}, got ${JSON.stringify(e)}`);return e}o(Pt,"requireEffortStrategy");function Et(e,t){if(e!==void 0){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}}o(Et,"optionalThinkingStrategy");function ye(e,t){if(e===void 0)return;if(!y(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let n=Pt(e.effortStrategy,`${t}.effortStrategy`),r=Rt(e.reasoningPreset,`${t}.reasoningPreset`),i=Et(e.thinkingStrategy,`${t}.thinkingStrategy`),s=_(e.defaultEffort,`${t}.defaultEffort`),d=kt(e.effortAliases,`${t}.effortAliases`),l=me(e.disabledEfforts,`${t}.disabledEfforts`),p=me(e.localRejectEfforts,`${t}.localRejectEfforts`),h=c(e.allowCustomEffort,`${t}.allowCustomEffort`),b=c(e.supportsReasoningEffort,`${t}.supportsReasoningEffort`),v=c(e.supportsReasoningSummary,`${t}.supportsReasoningSummary`),u=c(e.supportsEncryptedReasoningReplay,`${t}.supportsEncryptedReasoningReplay`),k=c(e.supportsAdaptiveThinking,`${t}.supportsAdaptiveThinking`),P=c(e.supportsManualThinkingBudget,`${t}.supportsManualThinkingBudget`),f=c(e.supportsDisabledThinking,`${t}.supportsDisabledThinking`),X=c(e.requiresEffortBetaHeader,`${t}.requiresEffortBetaHeader`),a={effortStrategy:n};if(r!==void 0&&(a.reasoningPreset=r),i!==void 0&&(a.thinkingStrategy=i),s!==void 0&&(a.defaultEffort=s),d!==void 0&&(a.effortAliases=d),l!==void 0&&(a.disabledEfforts=l),p!==void 0&&(a.localRejectEfforts=p),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((g,m)=>{if(!y(g))throw new Error(`provider-capabilities.json: ${t}.supportedEfforts[${m}] must be an object`);return{value:R(g.value,`${t}.supportedEfforts[${m}].value`),..._(g.description,`${t}.supportedEfforts[${m}].description`)!==void 0?{description:_(g.description,`${t}.supportedEfforts[${m}].description`)}:{},...c(g.isDefault,`${t}.supportedEfforts[${m}].isDefault`)!==void 0?{isDefault:c(g.isDefault,`${t}.supportedEfforts[${m}].isDefault`)}:{},...c(g.isUserVisible,`${t}.supportedEfforts[${m}].isUserVisible`)!==void 0?{isUserVisible:c(g.isUserVisible,`${t}.supportedEfforts[${m}].isUserVisible`)}:{}}})}if(e.budgetByEffort!==void 0){if(!y(e.budgetByEffort))throw new Error(`provider-capabilities.json: ${t}.budgetByEffort must be an object`);let g={};for(let[m,G]of Object.entries(e.budgetByEffort))g[m]=C(G,`${t}.budgetByEffort.${m}`)??0;a.budgetByEffort=g}return h!==void 0&&(a.allowCustomEffort=h),b!==void 0&&(a.supportsReasoningEffort=b),v!==void 0&&(a.supportsReasoningSummary=v),u!==void 0&&(a.supportsEncryptedReasoningReplay=u),k!==void 0&&(a.supportsAdaptiveThinking=k),P!==void 0&&(a.supportsManualThinkingBudget=P),f!==void 0&&(a.supportsDisabledThinking=f),X!==void 0&&(a.requiresEffortBetaHeader=X),a}o(ye,"validateReasoningProfile");function he(e,t){let n=e.reasoningProfile,r=e.reasoningCapabilityV2;if(n!==void 0&&r!==void 0)throw new Error(`provider-capabilities.json: ${t} must not define both reasoningProfile and deprecated reasoningCapabilityV2`);return n!==void 0?ye(n,`${t}.reasoningProfile`):ye(r,`${t}.reasoningCapabilityV2`)}o(he,"validateReasoningProfileField");function Tt(e,t){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}o(Tt,"requireProfileName");function xt(e,t){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}o(xt,"requireVerifyStrategy");function St(e,t){if(!y(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let n=R(e.id,`${t}.id`),r=_(e.displayName,`${t}.displayName`),i=C(e.contextWindow,`${t}.contextWindow`),s=C(e.maxOutputTokens,`${t}.maxOutputTokens`),d=C(e.thinkingBudgetCap,`${t}.thinkingBudgetCap`),l=c(e.replayReasoningContent,`${t}.replayReasoningContent`),p=c(e.strictThinkingSignature,`${t}.strictThinkingSignature`),h=C(e.streamMaxDurationMs,`${t}.streamMaxDurationMs`),b=e.reasoningCapability===void 0?void 0:F(e.reasoningCapability,`${t}.reasoningCapability`),v=he(e,t),u={id:n};return r!==void 0&&(u.displayName=r),i!==void 0&&(u.contextWindow=i),s!==void 0&&(u.maxOutputTokens=s),d!==void 0&&(u.thinkingBudgetCap=d),b!==void 0&&(u.reasoningCapability=b),v!==void 0&&(u.reasoningProfile=v),l!==void 0&&(u.replayReasoningContent=l),p!==void 0&&(u.strictThinkingSignature=p),h!==void 0&&(u.streamMaxDurationMs=h),u}o(St,"validateModelDescriptor");function Kt(e,t){if(e===void 0)return;if(!y(e))throw new Error(`provider-capabilities.json: ${t} must be an object`);let n={};for(let[r,i]of Object.entries(e))n[r]=F(i,`${t}.${r}`);return n}o(Kt,"validateModelReasoningCapabilities");function Mt(e,t){if(!y(e))throw new Error(`provider-capabilities.json: providers.${t} must be an object`);let n=c(e.cliBridge,`providers.${t}.cliBridge`),r=R(e.apiKeyEnv,`providers.${t}.apiKeyEnv`),i=F(e.reasoningCapability,`providers.${t}.reasoningCapability`),s=he(e,`providers.${t}`),d=Tt(e.capabilityProfile,`providers.${t}.capabilityProfile`),l=xt(e.verifyStrategy,`providers.${t}.verifyStrategy`);if(n&&l!=="unsupported")throw new Error(`provider-capabilities.json: providers.${t} is a cliBridge entry but verifyStrategy="${l}" \u2014 must be "unsupported" (CLI binary owns credentials)`);let p=C(e.contextWindow,`providers.${t}.contextWindow`),h=C(e.maxOutputTokens,`providers.${t}.maxOutputTokens`),b=C(e.thinkingBudgetCap,`providers.${t}.thinkingBudgetCap`),v=c(e.supportsThinking,`providers.${t}.supportsThinking`),u=Kt(e.modelReasoningCapabilities,`providers.${t}.modelReasoningCapabilities`),k=_(e.model,`providers.${t}.model`);if(n&&(k!==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(!n&&k===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((X,a)=>St(X,`providers.${t}.models[${a}]`))}let f={apiKeyEnv:r,reasoningCapability:i,capabilityProfile:d,verifyStrategy:l};return s!==void 0&&(f.reasoningProfile=s),k!==void 0&&(f.model=k),P!==void 0&&(f.models=P),p!==void 0&&(f.contextWindow=p),h!==void 0&&(f.maxOutputTokens=h),b!==void 0&&(f.thinkingBudgetCap=b),v!==void 0&&(f.supportsThinking=v),u!==void 0&&(f.modelReasoningCapabilities=u),n&&(f.cliBridge=!0),f}o(Mt,"validateProviderEntry");function be(e){if(!y(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(!y(e.providers))throw new Error("provider-capabilities.json: providers must be an object");let n={};for(let[r,i]of Object.entries(e.providers))n[r]=Mt(i,r);return{version:1,updatedAt:t,providers:n}}o(be,"validateProviderCapabilitiesJson");var At=Object.freeze({native:K,"image-input-native":Q,"cli-bridge":O,"image-input-cli-bridge":Z}),L=null;function It(){if(process.env.KODAX_BUNDLED==="true")return x.join(x.dirname(process.execPath),"provider-capabilities.json");let e=x.dirname(Xt(import.meta.url)),t=[x.join(e,"provider-capabilities.json"),x.join(x.dirname(e),"provider-capabilities.json")];for(let n of t)if(wt(n))return n;return t[0]}o(It,"resolveJsonPath");function Ot(e){if(e.models){for(let t of e.models)t.reasoningProfile&&ve(t.reasoningProfile);for(let t of e.models)Object.freeze(t);Object.freeze(e.models)}return e.reasoningProfile&&ve(e.reasoningProfile),e.modelReasoningCapabilities&&Object.freeze(e.modelReasoningCapabilities),Object.freeze(e)}o(Ot,"deepFreezeSnapshot");function ve(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)}o(ve,"freezeReasoningProfile");function Dt(e){if(e==="gemini-cli"){let t=T();return{model:t,models:w().filter(n=>n!==t).map(n=>({id:n}))}}if(e==="codex-cli"){let t=E();return{model:t,models:M().filter(n=>n!==t).map(n=>({id:n}))}}throw new Error(`provider-capabilities loader: unknown cliBridge provider '${e}'`)}o(Dt,"resolveCliBridgeModels");function Bt(e,t){let n=At[t.capabilityProfile];if(!n)throw new Error(`provider-capabilities loader: unknown capabilityProfile '${t.capabilityProfile}' for provider '${e}'`);if(t.cliBridge){let i=Dt(e),s={model:i.model,models:i.models,apiKeyEnv:t.apiKeyEnv,reasoningCapability:t.reasoningCapability,capabilityProfile:n,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:n,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}o(Bt,"buildSnapshot");function Ce(){if(L)return L;let e=It(),t;try{let i=_t(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 n=be(t),r={};for(let[i,s]of Object.entries(n.providers))r[i]=Ot(Bt(i,s));return L=Object.freeze(r),L}o(Ce,"getProviderSnapshots");import Yr from"@anthropic-ai/sdk";var V=Ce();var ke=process.env.KODAX_PROVIDER??"zhipu-coding";export{Le as a,je as b,$e as c,Fe as d,Ue as e,qe as f,j as g,V as h};