@kodax-ai/kodax 0.7.63 → 0.7.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2300 -2204
- package/README.md +79 -7
- package/README_CN.md +52 -3
- package/dist/chunks/{agent-SL444XLN.js → agent-KER4WDNO.js} +1 -1
- package/dist/chunks/argument-completer-HK3MHA3K.js +2 -0
- package/dist/chunks/{chunk-ARUWXX25.js → chunk-35P7QL2Q.js} +1 -1
- package/dist/chunks/chunk-3HKBBY74.js +339 -0
- package/dist/chunks/chunk-AKBH2EEE.js +8 -0
- package/dist/chunks/{chunk-KCFVGXVK.js → chunk-ALS32RNZ.js} +1 -1
- package/dist/chunks/chunk-MHRN2LQV.js +328 -0
- package/dist/chunks/{chunk-HP4FXMEM.js → chunk-NBQW7PNZ.js} +2 -2
- package/dist/chunks/{chunk-S4GVQO3W.js → chunk-O7N22GJ3.js} +1 -1
- package/dist/chunks/chunk-ONUPGMER.js +2 -0
- package/dist/chunks/{chunk-ZL5CEANW.js → chunk-PZTG2C33.js} +1 -1
- package/dist/chunks/{chunk-4MIHVNB7.js → chunk-QAQ2HNXD.js} +112 -112
- package/dist/chunks/{chunk-6OZ5KWG3.js → chunk-QJJKMNZF.js} +1 -1
- package/dist/chunks/chunk-QJVZZSEO.js +56 -0
- package/dist/chunks/chunk-TLJGOKBT.js +729 -0
- package/dist/chunks/{chunk-7MPU7TP6.js → chunk-VS4CDDEF.js} +243 -243
- package/dist/chunks/chunk-WBBEJIAY.js +306 -0
- package/dist/chunks/{chunk-L3MF5V64.js → chunk-WMIZCY2J.js} +1 -1
- package/dist/chunks/{chunk-UA744TZM.js → chunk-YRBNXFHY.js} +1 -1
- package/dist/chunks/compaction-config-7GMUFNPB.js +2 -0
- package/dist/chunks/{construction-bootstrap-EFZBONTK.js → construction-bootstrap-3XDS2D5K.js} +1 -1
- package/dist/chunks/{devtools-4CRULTR2.js → devtools-CD6KSIHE.js} +1 -1
- package/dist/chunks/{devtools-YINBSZC7.js → devtools-XR5F2C6T.js} +1 -1
- package/dist/chunks/{dist-73L4OYPD.js → dist-4PXB7U22.js} +1 -1
- package/dist/chunks/dist-4YAYT2TO.js +2 -0
- package/dist/chunks/host-KG3456QP.js +2 -0
- package/dist/chunks/{paste-FDYM7SZX.js → paste-C33GZQV5.js} +1 -1
- package/dist/chunks/run-manager-6CAH3KTA.js +2 -0
- package/dist/chunks/utils-OT5ENFUL.js +2 -0
- package/dist/constructed-handler-worker.js +2 -0
- package/dist/index.d.ts +21 -10
- package/dist/index.js +6 -6
- package/dist/kodax_cli.js +1116 -1089
- package/dist/runtime-worker.js +2843 -0
- package/dist/sdk-agent.d.ts +27 -8
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +76 -1020
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +2 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +197 -183
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +982 -0
- package/dist/sdk-runtime.js +2 -0
- package/dist/sdk-session.d.ts +3 -3
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +191 -10
- package/dist/types-chunks/{bash-prefix-extractor.d-CZW9fRoa.d.ts → bash-prefix-extractor.d-BjkITAva.d.ts} +142 -3
- package/dist/types-chunks/{run-manager.d-CYTnWhZY.d.ts → capsule.d-hVhPNkHd.d.ts} +5 -92
- package/dist/types-chunks/commands.d-C3B1TdGM.d.ts +213 -0
- package/dist/types-chunks/{types.d-1CnTg7Sd.d.ts → guardrail.d-C_Siraua.d.ts} +3 -128
- package/dist/types-chunks/{guardrail.d-MR6LwMB2.d.ts → guardrail.d-wk-s0psS.d.ts} +2 -2
- package/dist/types-chunks/{manager.d-DBD7SOTT.d.ts → manager.d-Zum9cGHU.d.ts} +3 -173
- package/dist/types-chunks/oauth-login.d-Bgb4rdLN.d.ts +174 -0
- package/dist/types-chunks/public-api.d-jtREVfEq.d.ts +596 -0
- package/dist/types-chunks/run-manager.d-CFknOfo1.d.ts +91 -0
- package/dist/types-chunks/{sdk-session-RBSBBKol.d.ts → sdk-session-CLqyfAmf.d.ts} +8 -306
- package/dist/types-chunks/types.d-BMLxKV69.d.ts +128 -0
- package/dist/types-chunks/types.d-CUN_bZU7.d.ts +975 -0
- package/dist/types-chunks/{utils.d-C14jZ9ZM.d.ts → utils.d-C1rpoeDh.d.ts} +84 -72
- package/package.json +7 -1
- package/dist/chunks/argument-completer-EN63ZVJK.js +0 -2
- package/dist/chunks/chunk-KHICMJIR.js +0 -310
- package/dist/chunks/chunk-LGR7ACBQ.js +0 -326
- package/dist/chunks/chunk-RR7W7UF6.js +0 -341
- package/dist/chunks/chunk-UGTK2JIJ.js +0 -731
- package/dist/chunks/chunk-V4WSBIXB.js +0 -2
- package/dist/chunks/chunk-VSWROENP.js +0 -52
- package/dist/chunks/compaction-config-4VIONMFB.js +0 -2
- package/dist/chunks/dist-EDF2YUF6.js +0 -2
- package/dist/chunks/host-J4HPDLFC.js +0 -2
- package/dist/chunks/run-manager-ZVSW2OWM.js +0 -2
- package/dist/chunks/utils-5HDLYTZJ.js +0 -2
- package/dist/types-chunks/storage.d-C6kkAEch.d.ts +0 -280
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{b as i,j as c,k as d,o as l}from"./chunk-
|
|
2
|
+
import{b as i,j as c,k as d,o as l}from"./chunk-PZTG2C33.js";import{a as t}from"./chunk-ONUPGMER.js";var b="\x1B[?2004h",P="\x1B[?2004l",f=!1,a=!1;function T(){if(!a)try{process.stdout.write(b),a=!0}catch{}}t(T,"enableBracketedPasteMode");function g(){if(a)try{process.stdout.write(P)}catch{}finally{a=!1}}t(g,"disableBracketedPasteMode");function h(){return a}t(h,"isBracketedPasteModeEnabled");function _(){if(f)return;f=!0;let e=t(()=>g(),"handler");process.once("beforeExit",e),process.once("exit",e),process.once("SIGINT",()=>{e(),process.kill(process.pid,"SIGINT")}),process.once("SIGTERM",()=>{e(),process.kill(process.pid,"SIGTERM")}),process.once("uncaughtException",r=>{throw e(),r})}t(_,"installBracketedPasteShutdownGuard");import{readFile as R}from"node:fs/promises";var y=/\.(png|jpe?g|gif|webp|bmp)$/i;async function N(e){if(e.length===0)return process.platform==="darwin"?I():{kind:"text",text:""};let r=k(e);return r.length>0?G(r,e):{kind:"text",text:e}}t(N,"handleBracketedPaste");async function z(){return I()}t(z,"triggerExplicitClipboardImage");async function I(){let e;try{e=await d()}catch(r){return{kind:"error",message:`Failed to read clipboard image: ${m(r)}`}}return e?E(e):{kind:"noop"}}t(I,"readClipboardAsImagesOutcome");async function G(e,r){let o=[],s=[];for(let p of e){let u;try{u=await R(p)}catch(x){s.push(`Failed to read ${p}: ${m(x)}`);continue}let n=await E(u);n.kind==="images"?o.push(...n.blocks):n.kind==="error"&&s.push(n.message)}return o.length===0?s.length>0?{kind:"error",message:s.join("; ")}:{kind:"text",text:r}:{kind:"images",blocks:o}}t(G,"readImagePathsAsOutcome");async function E(e){try{let r=await c(e);return{kind:"images",blocks:[await l(r)]}}catch(r){return r instanceof i?{kind:"error",message:r.message}:{kind:"error",message:`Failed to process pasted image: ${m(r)}`}}}t(E,"decodeBufferToOutcome");function k(e){return e.split(/ (?=\/|[A-Za-z]:\\)/).filter(o=>y.test(o.trim()))}t(k,"extractImagePaths");function m(e){return e instanceof Error?e.message:String(e)}t(m,"describeError");export{T as a,g as b,h as c,_ as d,N as e,z as f,k as g};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
+
import{w as q,y as J}from"./chunk-MHRN2LQV.js";import{C as k,D as X,E as R,Ja as B,Na as z,ja as F,ka as j,la as G,ma as U,n as K,na as V,oa as A,va as $,wa as E,z as x,za as I}from"./chunk-O7N22GJ3.js";import{Ea as H,ya as W}from"./chunk-TLJGOKBT.js";import{a as o}from"./chunk-ONUPGMER.js";import c from"fs";import f from"path";import{exec as ce,spawnSync as le}from"child_process";import{promisify as ue}from"util";import{fileURLToPath as fe}from"url";var L="en";function ae(){return(process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"").toLowerCase().startsWith("zh")?"zh":"en"}o(ae,"detectSystemLocale");function Q(e){if(!e||e==="auto"){L=ae();return}L=e.toLowerCase().replace(/[-_].*/,"")==="zh"?"zh":"en"}o(Q,"setLocale");var Y={en:{"dialog.confirm":"[Confirm]","dialog.select":"[Select]","dialog.input":"[Input]","confirm.instruction.basic":"Press (y) yes, (n) no","confirm.instruction.always":"Press (y) yes, (a) always yes for this tool, (n) no","confirm.instruction.protected":"Press (y) to confirm, (n) to cancel (protected path)","confirm.result.approved":"Approved","confirm.result.approved_always":"Approved (always)","confirm.result.denied":"Denied","tool.bash.title":"Execute bash command?","tool.shell.title":"Execute shell command?","tool.write.title":"Write to file?","tool.edit.title":"Edit file?","tool.generic.title":"Execute {tool}?","field.reason":"Reason","field.intent":"Intent","field.target":"Target","field.scope":"Scope","field.risk":"Risk","field.summary":"Summary","intent.read":"Read project files","intent.delete":"Delete files","intent.deps":"Modify dependencies or environment","intent.modify":"Modify files","intent.execute":"Execute command","intent.write_file":"Write file","intent.edit_file":"Edit file","intent.use_tool":"Use {tool}","risk.destructive":"Destructive change","risk.deps":"May change dependencies or local tools","risk.modify":"May modify files","risk.unknown":"Command effects depend on its arguments","risk.network":"May access network","scope.outside":"Outside project","scope.protected":"Protected path","waiting.confirm":"Waiting: approval required","waiting.select":"Waiting: choose an option","waiting.input":"Waiting: answer the prompt","placeholder.confirm":"Respond to the approval prompt above...","placeholder.select":"Choose an option above...","placeholder.input":"Answer the prompt above...","placeholder.busy":"Agent is busy...","placeholder.queue":"Queue a follow-up for the next round...","placeholder.idle":"Type a message...","select.choice":"Choice:","select.type_number":"(type a number)","select.more":"{count} more choices...","select.more_above":"\u2191 {count} more above","select.more_below":"\u2193 {count} more below","select.confirm_hint":"Press Enter to confirm, Esc to cancel","select.navigate_hint":"Use \u2191\u2193 to navigate, Enter to confirm, Esc to cancel","select.multiselect_hint":"Use \u2191\u2193 to navigate, Space to toggle, Enter to confirm, Esc to cancel","select.multiselect_empty":"Select at least one option with Space before confirming.","select.multiselect_min":"Select at least {min} option(s) with Space before confirming.","select.multiselect_max":"Select at most {max} option(s) with Space before confirming.","select.back_prev":"\u2190 Back to previous question","input.default":"Default:","input.value":"Value:","input.type_response":"(type your response)","managed.completed":"Task completed","managed.completed.blocked":"Task blocked","managed.completed.continuation":"Task needs continuation",cancelled:"[Cancelled] Operation cancelled by user"},zh:{"dialog.confirm":"[\u786E\u8BA4]","dialog.select":"[\u9009\u62E9]","dialog.input":"[\u8F93\u5165]","confirm.instruction.basic":"\u6309 (y) \u786E\u8BA4, (n) \u62D2\u7EDD","confirm.instruction.always":"\u6309 (y) \u786E\u8BA4, (a) \u59CB\u7EC8\u5141\u8BB8\u6B64\u5DE5\u5177, (n) \u62D2\u7EDD","confirm.instruction.protected":"\u6309 (y) \u786E\u8BA4, (n) \u53D6\u6D88 (\u53D7\u4FDD\u62A4\u8DEF\u5F84)","confirm.result.approved":"\u5DF2\u6279\u51C6","confirm.result.approved_always":"\u5DF2\u6279\u51C6 (\u59CB\u7EC8\u5141\u8BB8)","confirm.result.denied":"\u5DF2\u62D2\u7EDD","tool.bash.title":"\u6267\u884C bash \u547D\u4EE4\uFF1F","tool.shell.title":"\u6267\u884C shell \u547D\u4EE4\uFF1F","tool.write.title":"\u5199\u5165\u6587\u4EF6\uFF1F","tool.edit.title":"\u7F16\u8F91\u6587\u4EF6\uFF1F","tool.generic.title":"\u6267\u884C {tool}\uFF1F","field.reason":"\u539F\u56E0","field.intent":"\u610F\u56FE","field.target":"\u76EE\u6807","field.scope":"\u8303\u56F4","field.risk":"\u98CE\u9669","field.summary":"\u6458\u8981","intent.read":"\u8BFB\u53D6\u9879\u76EE\u6587\u4EF6","intent.delete":"\u5220\u9664\u6587\u4EF6","intent.deps":"\u4FEE\u6539\u4F9D\u8D56\u6216\u73AF\u5883","intent.modify":"\u4FEE\u6539\u6587\u4EF6","intent.execute":"\u6267\u884C\u547D\u4EE4","intent.write_file":"\u5199\u5165\u6587\u4EF6","intent.edit_file":"\u7F16\u8F91\u6587\u4EF6","intent.use_tool":"\u4F7F\u7528 {tool}","risk.destructive":"\u7834\u574F\u6027\u53D8\u66F4","risk.deps":"\u53EF\u80FD\u4FEE\u6539\u4F9D\u8D56\u6216\u672C\u5730\u5DE5\u5177","risk.modify":"\u53EF\u80FD\u4FEE\u6539\u6587\u4EF6","risk.unknown":"\u547D\u4EE4\u6548\u679C\u53D6\u51B3\u4E8E\u53C2\u6570","risk.network":"\u53EF\u80FD\u8BBF\u95EE\u7F51\u7EDC","scope.outside":"\u9879\u76EE\u5916\u90E8","scope.protected":"\u53D7\u4FDD\u62A4\u8DEF\u5F84","waiting.confirm":"\u7B49\u5F85\u4E2D\uFF1A\u9700\u8981\u5BA1\u6279","waiting.select":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u9009\u62E9","waiting.input":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u56DE\u7B54","placeholder.confirm":"\u8BF7\u56DE\u5E94\u4E0A\u65B9\u7684\u5BA1\u6279\u63D0\u793A...","placeholder.select":"\u8BF7\u5728\u4E0A\u65B9\u9009\u62E9\u4E00\u4E2A\u9009\u9879...","placeholder.input":"\u8BF7\u56DE\u7B54\u4E0A\u65B9\u7684\u63D0\u793A...","placeholder.busy":"\u667A\u80FD\u4F53\u6B63\u5728\u5DE5\u4F5C\u4E2D...","placeholder.queue":"\u6392\u961F\u7B49\u5F85\u4E0B\u4E00\u8F6E\u8DDF\u8FDB...","placeholder.idle":"\u8F93\u5165\u6D88\u606F...","select.choice":"\u9009\u9879\uFF1A","select.type_number":"(\u8F93\u5165\u7F16\u53F7)","select.more":"\u8FD8\u6709 {count} \u4E2A\u9009\u9879...","select.more_above":"\u2191 \u4E0A\u65B9\u8FD8\u6709 {count} \u4E2A","select.more_below":"\u2193 \u4E0B\u65B9\u8FD8\u6709 {count} \u4E2A","select.confirm_hint":"\u6309 Enter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.navigate_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0C\u7A7A\u683C \u5207\u6362\u9009\u4E2D\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_empty":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u9009\u9879\u3002","select.multiselect_min":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u81F3\u5C11\u9009\u62E9 {min} \u4E2A\u9009\u9879\u3002","select.multiselect_max":"\u6700\u591A\u53EA\u80FD\u9009\u62E9 {max} \u4E2A\u9009\u9879\u3002","select.back_prev":"\u2190 \u8FD4\u56DE\u4E0A\u4E00\u9898","input.default":"\u9ED8\u8BA4\u503C\uFF1A","input.value":"\u503C\uFF1A","input.type_response":"(\u8F93\u5165\u4F60\u7684\u56DE\u7B54)","managed.completed":"\u4EFB\u52A1\u5B8C\u6210","managed.completed.blocked":"\u4EFB\u52A1\u53D7\u963B","managed.completed.continuation":"\u4EFB\u52A1\u9700\u8981\u7EE7\u7EED",cancelled:"[\u5DF2\u53D6\u6D88] \u64CD\u4F5C\u5DF2\u88AB\u7528\u6237\u53D6\u6D88"}};function Ne(e,t){let r=Y[L][e]??Y.en[e]??e;if(t)for(let[i,s]of Object.entries(t))r=r.replace(`{${i}}`,String(s));return r}o(Ne,"t");var de=ue(ce),S=W(),He=f.join(S,"sessions"),d=f.join(S,"config.json"),qe=60,p=null,D=!1,pe="dumb";function me(e){let t=f.basename(e).toLowerCase(),n="__KODAX_SHELL_ENV_START__",r=`printf '%s\\0' '${n}'; env -0`;return t==="fish"?{args:["-i","-c",r],sentinel:n}:{args:t==="bash"||t==="zsh"?["-ic",r]:["-lc",r],sentinel:n}}o(me,"buildShellEnvCommand");function ge(e,t){let n=`${t}\0`,r=e.lastIndexOf(n);if(r===-1)return{};let i=e.slice(r+n.length),s={};for(let a of i.split("\0")){if(!a)continue;let u=a.indexOf("=");u<=0||(s[a.slice(0,u)]=a.slice(u+1))}return s}o(ge,"parseNullDelimitedShellEnv");function ve(e={}){let t=e.env??process.env;if((e.platform??process.platform)==="win32"||t.KODAX_DISABLE_SHELL_ENV_HYDRATION==="1")return!1;let r=e.shell??t.SHELL;if(!r||!f.isAbsolute(r))return!1;let{args:i,sentinel:s}=me(r),a=e.run??le,u={...t,TERM:pe},l=a(r,i,{encoding:"utf8",env:u,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(l.status!==0||!l.stdout)return!1;let re=typeof l.stdout=="string"?l.stdout:l.stdout.toString("utf8"),ie=ge(re,s),N=!1;for(let[C,se]of Object.entries(ie))C!=="TERM"&&t[C]===void 0&&(t[C]=se,N=!0);return N}o(ve,"hydrateProcessEnvFromShell");function he(){if(!D){D=!0;try{ve()}catch{}}}o(he,"ensureShellEnvironmentHydrated");function Je(){D=!1}o(Je,"resetShellEnvironmentHydrationForTesting");function ye(e){$(e.customProviders??[])}o(ye,"registerConfiguredCustomProviders");function te(e){if(!Array.isArray(e))return;let t=e.filter(n=>typeof n=="string").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:[]}o(te,"normalizeConfiguredExtensions");function Ee(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{c.mkdirSync(f.dirname(d),{recursive:!0}),c.writeFileSync(d,JSON.stringify(t,null,2))}catch{}return t}o(Ee,"migrateLegacyPermissionModeInConfig");function Pe(e){if(e.permissionMode!=="auto-in-project")return e;try{let t=c.readFileSync(d,"utf-8"),n=t.replace(/("permissionMode"\s*:\s*)"auto-in-project"/,'$1"auto"');n!==t&&c.writeFileSync(d,n)}catch{}return{...e,permissionMode:"auto"}}o(Pe,"migrateAutoInProjectAliasInConfig");function be(){if(p)return p;let e="0.7.66";if(e)return p=e,p;let t=f.join(f.dirname(fe(import.meta.url)),"../../package.json");if(c.existsSync(t))try{return p=JSON.parse(c.readFileSync(t,"utf-8")).version??"0.0.0",p??"0.0.0"}catch{}return p="0.0.0",p}o(be,"getVersion");var Ye=be();function _e(e){return j(e)}o(_e,"getProviderModel");function T(e,t){let n=new Set(e.map(i=>i.toLowerCase())),r=[...e];for(let i of t)n.has(i.toLowerCase())||r.push(i);return r}o(T,"mergeModels");function Se(e,t){t||(t=w().providerModels);let n=t?.[e];if(n&&n.length>0){try{let r=A(e);if(r.length>0)return T(n,r)}catch{}try{let r=E(e);if(r)return T(n,r.getAvailableModels())}catch{}return n}try{let r=A(e);if(r.length>0)return r}catch{}try{let r=E(e);if(r)return r.getAvailableModels()}catch{}return[]}o(Se,"getProviderAvailableModels");function Oe(e,t){let n=G(e,t);if(n!=="unknown")return n;try{let r=E(e);if(r)return r.getReasoningCapability(t)}catch{}return"unknown"}o(Oe,"getProviderReasoningCapability");function we(e){let t=U(e);if(t)return t;try{return I().find(r=>r.name===e)?.capabilityProfile??null}catch{return null}}o(we,"getProviderCapabilityProfile");function ne(e,t){let n=we(e),r=Oe(e,t);if(n)return{capabilityProfile:n,reasoningCapability:r};try{let i=B(e);return{capabilityProfile:i.getCapabilityProfile(),reasoningCapability:i.getReasoningCapability(t)}}catch{return null}}o(ne,"getProviderCapabilityMetadata");function Qe(e,t){let n=ne(e,t);return n?q({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}o(Qe,"getProviderCapabilitySnapshot");function Ce(e,t,n,r){let i=ne(e,t);return i?J({providerName:e,model:t,capabilityProfile:i.capabilityProfile,reasoningCapability:i.reasoningCapability==="unknown"?void 0:i.reasoningCapability,reasoningMode:n,hints:r}):null}o(Ce,"getProviderPolicyDecision");function Ze(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"forwards only the latest user message":"preserves full conversation history",r=e.mcpSupport==="native"?"MCP available":"MCP unavailable";return`${t}; ${n}; ${r}`}o(Ze,"describeProviderCapabilitySummary");function et(e){switch(e){case"native-budget":return"B";case"native-effort":return"E";case"native-toggle":return"T";case"native-adaptive":return"A";default:return"-"}}o(et,"formatReasoningCapabilityShort");function y(e){if(e)return e==="none"?"off":e}o(y,"formatReasoningEffortForDisplay");function _(e,t){let n=y(t);n&&!e.includes(n)&&e.push(n)}o(_,"pushUniqueEffortDisplay");function tt(e,t){let n=["auto"],i=O(e,t)?.supportedEfforts?.filter(s=>s.isUserVisible!==!1);if(!i||i.length===0){for(let s of["off","low","medium","high"])_(n,s);return n}for(let s of i)_(n,s.value);return n}o(tt,"getProviderReasoningEffortOptions");function nt(e,t){let n=O(e,t),r=new Set(n?.disabledEfforts??[]),i=n?.supportedEfforts?.filter(l=>l.isUserVisible!==!1),s=[],a=n?.supportsDisabledThinking===!0;if(!i||i.length===0){for(let l of["low","medium","high"])_(s,l);a=!0}else for(let l of i){if(l.value==="none"){a=!0;continue}if(r.has(l.value)){a=!0;continue}_(s,l.value)}let u=[];return a&&u.push("off"),u.push(...s),u.push("auto"),u}o(nt,"getProviderReasoningEffortCycle");function xe(e,t){if(t===!1)return"off";switch(e){case"off":return"off";case"quick":return"low";case"balanced":return"medium";case"deep":return"high";default:return"auto"}}o(xe,"legacyReasoningModeToEffortDisplay");function O(e,t){let n=t??_e(e);if(!n)return;let r=z(e,n)?.reasoningProfile;if(r)return K(r,H(e,n))}o(O,"resolveReasoningProfileForDisplay");function ot(e){let t=y(e.effort)??xe(e.reasoningMode,e.thinking),n=O(e.provider,e.model);if(!n)return t;try{let r=X({capability:n,explicitEffort:e.effortOverride?e.effort:void 0,sessionEffort:e.effortOverride?void 0:e.effort,legacyReasoningMode:e.reasoningMode,thinking:e.thinking}),i=y(r.configuredEffort)??t,a=r.configuredEffort!==void 0&&n.disabledEfforts?.includes(r.configuredEffort)===!0?"off":y(r.effectiveEffort);return a&&a!==i?`${i}->${a}`:i}catch{if(e.effort)try{let r=R({currentEffort:e.effort,capability:n}),i=y(e.effort)??t,s=y(r.effectiveEffort);return s&&s!==i?`${i}->${s}`:i}catch{return t}return t}}o(ot,"formatReasoningEffortStatusLabel");function rt(e){let t=De(e);if(!t)return{preserved:!0};let n=O(e.provider,e.model);if(!n)return{configuredEffort:t,runtimeEffort:t,preserved:!0};let r=R({currentEffort:t,capability:n});return{configuredEffort:t,runtimeEffort:r.effectiveEffort,preserved:r.preserved,diagnostic:r.diagnostic}}o(rt,"resolveProviderReasoningRuntimeEffort");function ke(e){switch(e){case"native-budget":return"budget";case"native-effort":return"effort";case"native-toggle":return"toggle";case"native-adaptive":return"adaptive";default:return"none"}}o(ke,"describeReasoningCapabilityControl");function it(e,t){if(e==="off")return"Reasoning disabled";switch(t){case"native-budget":return"Uses native thinking budget control";case"native-effort":return"Uses native reasoning effort control";case"native-toggle":return"Uses provider-native thinking toggle only";case"native-adaptive":return"Model adaptively decides thinking depth (Opus 4.7+)";case"none":return"Runs without native reasoning parameters";case"prompt-only":return"Uses prompt overlays only; no native reasoning parameter";default:return"Runs without native reasoning parameters"}}o(it,"describeReasoningExecution");function st(e){let t=[];e||(e=w().providerModels);for(let n of V())t.push({name:n.name,model:n.model,models:Se(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=I().map(r=>({...r,models:(()=>{let i=e?.[r.name];return i&&i.length>0?T(i,r.models):r.models})()}));t.push(...n)}catch{}return t}o(st,"getProviderList");function at(e){if(F(e))return!0;try{return E(e)?.isConfigured()??!1}catch{return!1}}o(at,"isProviderConfigured");function w(){try{if(c.existsSync(d)){let e=JSON.parse(c.readFileSync(d,"utf-8")),t=e.reasoningCeiling??e.reasoningMode;return Pe(Ee({...e,reasoningMode:t,extensions:te(e.extensions)}))}}catch{}return{}}o(w,"loadConfig");var M=f.join(S,"config.example.jsonc"),Re=`// KodaX example configuration \u2014 copy what you need into config.json (in this same
|
|
3
|
+
// folder). config.json must be STRICT JSON: no comments, no trailing commas. Most
|
|
4
|
+
// settings also have a semantic KODAX_* env counterpart that overrides the file.
|
|
5
|
+
// Priority: explicit option > environment > config.json > default. Delete anything
|
|
6
|
+
// you don't use; everything here is optional.
|
|
7
|
+
{
|
|
8
|
+
// Default provider + model. Override live with /provider and /model.
|
|
9
|
+
// "provider": "deepseek",
|
|
10
|
+
// "model": "deepseek-v4",
|
|
11
|
+
|
|
12
|
+
// Task runtime: "embedded" (default) or shared local "daemon".
|
|
13
|
+
// "runtimeMode": "embedded",
|
|
14
|
+
|
|
15
|
+
// Reasoning effort for normal turns: off | auto | low | medium | high | xhigh | max.
|
|
16
|
+
// "effort": "high",
|
|
17
|
+
|
|
18
|
+
// Permission mode: "accept-edits" | "plan" | "auto".
|
|
19
|
+
// "permissionMode": "accept-edits",
|
|
20
|
+
|
|
21
|
+
// Custom providers \u2014 point KodaX at an OpenAI/Anthropic-compatible endpoint.
|
|
22
|
+
// "customProviders": [
|
|
23
|
+
// {
|
|
24
|
+
// "name": "my-relay", // unique; do NOT reuse a built-in provider name
|
|
25
|
+
// "protocol": "openai", // "openai" or "anthropic" = the wire format the endpoint speaks
|
|
26
|
+
// "baseUrl": "https://api.example.com/v1",
|
|
27
|
+
// "apiKeyEnv": "MY_RELAY_API_KEY", // env var that holds the key (never put the key here)
|
|
28
|
+
// "model": "deepseek/deepseek-v4",
|
|
29
|
+
// "models": ["deepseek/deepseek-v4"],
|
|
30
|
+
//
|
|
31
|
+
// // --- Thinking / reasoning (optional) ---
|
|
32
|
+
// // For most NON-Claude models this single line is all you need:
|
|
33
|
+
// "supportsThinking": true
|
|
34
|
+
// // openai-compat : KodaX sends no thinking toggle and just shows whatever
|
|
35
|
+
// // reasoning the model emits (deepseek/qwen/etc. via relays).
|
|
36
|
+
// // anthropic-compat: KodaX sends thinking:{type:"enabled"} \u2014 what the Anthropic
|
|
37
|
+
// // endpoints of zhipu / kimi / minimax / deepseek expect.
|
|
38
|
+
// //
|
|
39
|
+
// // openai-compat MULTI-TURN: some models (notably DeepSeek V4) reject later turns
|
|
40
|
+
// // whose history drops the previous reasoning_content. If thinking shows on turn 1
|
|
41
|
+
// // but turn 2 errors, also set: "replayReasoningContent": true
|
|
42
|
+
// //
|
|
43
|
+
// // To expose a TUNABLE effort level, use "reasoning" instead. Include "off" to
|
|
44
|
+
// // allow disabling thinking:
|
|
45
|
+
// // "reasoning": { "efforts": ["off", "low", "high"], "default": "high" }
|
|
46
|
+
// //
|
|
47
|
+
// // Pointing anthropic-compat at REAL Claude (4.6+)? Claude needs ADAPTIVE
|
|
48
|
+
// // thinking, not the enable toggle \u2014 set instead:
|
|
49
|
+
// // "reasoningCapability": "native-adaptive"
|
|
50
|
+
// }
|
|
51
|
+
// ],
|
|
52
|
+
|
|
53
|
+
// MCP servers (stdio or remote). See the /mcp command and manual topic "mcp".
|
|
54
|
+
// "mcpServers": {}
|
|
55
|
+
}
|
|
56
|
+
`;function ct(){try{return c.existsSync(d)||c.existsSync(M)?void 0:(c.mkdirSync(S,{recursive:!0}),c.writeFileSync(M,Re,"utf-8"),M)}catch{return}}o(ct,"ensureExampleConfigFile");var b=new Map;function Ae(e,t){let n=process.env[e],r=b.get(e),i=r!==void 0&&n===r;if(n!==void 0&&!i){b.delete(e);return}if(t===void 0){i&&delete process.env[e],b.delete(e);return}process.env[e]=t,b.set(e,t)}o(Ae,"projectConfigEnvironment");var oe=[{configPath:"streamIdleTimeoutMs",env:"KODAX_STREAM_IDLE_TIMEOUT_MS",value:o(e=>v(e.streamIdleTimeoutMs),"value")},{configPath:"repoIntelligenceMode",env:"KODAX_REPO_INTELLIGENCE",value:o(e=>e.repoIntelligenceMode,"value")},{configPath:"repoIntelligenceTrace",env:"KODAX_REPO_INTELLIGENCE_TRACE",value:o(e=>h(e.repoIntelligenceTrace),"value")},{configPath:"verifierLog",env:"KODAX_VERIFIER_LOG",value:o(e=>h(e.verifierLog),"value")},{configPath:"stallLog",env:"KODAX_STALL_LOG",value:o(e=>h(e.stallLog),"value")},{configPath:"fallbackProviders",env:"KODAX_FALLBACK_PROVIDERS",value:o(e=>Le(e.fallbackProviders),"value")},{configPath:"fastProvider",env:"KODAX_FAST_PROVIDER",value:o(e=>m(e.fastProvider),"value")},{configPath:"fastModel",env:"KODAX_FAST_MODEL",value:o(e=>m(e.fastModel),"value")},{configPath:"deepProvider",env:"KODAX_DEEP_PROVIDER",value:o(e=>m(e.deepProvider),"value")},{configPath:"deepModel",env:"KODAX_DEEP_MODEL",value:o(e=>m(e.deepModel),"value")},{configPath:"provider",env:"KODAX_PROVIDER",value:o(e=>m(e.provider),"value")},{configPath:"effort",env:"KODAX_EFFORT",value:o(e=>m(e.effort),"value")},{configPath:"runtimeMode",env:"KODAX_RUNTIME_MODE",value:o(e=>e.runtimeMode,"value")},{configPath:"sessionRetentionDays",env:"KODAX_SESSION_RETENTION_DAYS",value:o(e=>v(e.sessionRetentionDays),"value")},{configPath:"maxOutputTokens",env:"KODAX_MAX_OUTPUT_TOKENS",value:o(e=>v(e.maxOutputTokens),"value")},{configPath:"disablePromptCache",env:"KODAX_DISABLE_PROMPT_CACHE",value:o(e=>h(e.disablePromptCache),"value")},{configPath:"lsp",env:"KODAX_LSP",value:o(e=>h(e.lsp),"value")},{configPath:"lspAutoDownload",env:"KODAX_LSP_DOWNLOAD",value:o(e=>h(e.lspAutoDownload),"value")},{configPath:"acpLogLevel",env:"KODAX_ACP_LOG",value:o(e=>m(e.acpLogLevel),"value")},{configPath:"repoIntelligence.toolWaitMs",env:"KODAX_REPO_INTELLIGENCE_TOOL_WAIT_MS",value:o(e=>v(e.repoIntelligence?.toolWaitMs),"value")},{configPath:"repoIntelligence.workerTimeoutMs",env:"KODAX_REPO_INTELLIGENCE_WORKER_TIMEOUT_MS",value:o(e=>v(e.repoIntelligence?.workerTimeoutMs),"value")},{configPath:"repoIntelligence.workerOldSpaceMb",env:"KODAX_REPO_INTELLIGENCE_WORKER_OLD_SPACE_MB",value:o(e=>v(e.repoIntelligence?.workerOldSpaceMb),"value")},{configPath:"repoIntelligence.storageDir",env:"KODAX_REPO_INTELLIGENCE_STORAGE_DIR",value:o(e=>m(e.repoIntelligence?.storageDir),"value")},{configPath:"workflow.maxConcurrency",env:"KODAX_WORKFLOW_MAX_CONCURRENCY",value:o(e=>v(e.workflow?.maxConcurrency),"value")}];function Ie(e){for(let t of oe)Ae(t.env,t.value(e))}o(Ie,"applyConfigSurfaceBridges");function m(e){return e?.trim()||void 0}o(m,"normalizedConfigString");function v(e){return typeof e=="number"&&Number.isFinite(e)?String(e):void 0}o(v,"configNumberString");function h(e){return e===void 0?void 0:e?"1":"0"}o(h,"configBooleanString");function Le(e){return e?.filter(t=>t.trim().length>0).join(",")}o(Le,"configStringList");var lt=[...oe.map(({configPath:e,env:t})=>({configPath:e,env:t}))];function Me(e){Ie(e)}o(Me,"applyConfigEnvironment");function ut(){he();let e=w();return Me(e),ye(e),Q(e.locale),e}o(ut,"prepareRuntimeConfig");function ft(e){let n={...w(),...e},r=te(n.extensions);r!==void 0&&(n.extensions=r);for(let i of Object.keys(e))e[i]===void 0&&delete n[i];c.mkdirSync(f.dirname(d),{recursive:!0}),c.writeFileSync(d,JSON.stringify(n,null,2))}o(ft,"saveConfig");function dt(e,t,n){return e.effort!==void 0||k(n).kind==="value"||t.effort!==void 0}o(dt,"resolveInitialEffortOverride");function g(e){return e?.trim()?e:void 0}o(g,"nonEmptySelection");function pt(e){return g(e.explicitProvider)??g(e.environmentProvider)??g(e.configuredProvider)??e.defaultProvider}o(pt,"resolveRuntimeProviderSelection");function mt(e){let t=g(e.explicitModel);if(t)return t;let n=g(e.configuredModel);if(!n)return;let r=g(e.explicitProvider)??g(e.environmentProvider);return r?g(e.configuredProvider)===r?n:void 0:n}o(mt,"resolveRuntimeModelSelection");function gt(e){if(e.explicitEffort!==void 0)return x(e.explicitEffort);let t=k(e.environmentEffort);return t.kind==="value"?t.value:e.configuredEffort===void 0?void 0:x(e.configuredEffort)}o(gt,"resolveRuntimeEffortSelection");function De(e){return e.permissionMode==="plan"&&e.effortOverride!==!0&&e.planModeEffort!==void 0?e.planModeEffort:e.effort}o(De,"resolvePermissionModeEffort");async function vt(e){try{let{stdout:t}=await de("git rev-parse --show-toplevel",{cwd:e});return t.trim()}catch{return null}}o(vt,"getGitRoot");function Te(e){switch(e){case"builtin":return"Built-in";case"runtime":return"Runtime extension";case"custom":return"Custom config";default:return"Unknown"}}o(Te,"formatProviderSourceKind");function ht(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"latest-user-message only":"full conversation history";return[`Source: ${Te(e.sourceKind)}`,`Transport: ${t}`,`Conversation semantics: ${n}`,`Context fidelity: ${e.contextFidelity}`,`Tool calling: ${e.toolCallingFidelity}`,`Session behavior: ${e.sessionSupport}`,`Long-running support: ${e.longRunningSupport}`,`Evidence-heavy flows: ${e.evidenceSupport}`,`Multimodal support: ${e.multimodalSupport}`,`MCP support: ${e.mcpSupport}`,`Reasoning control: ${ke(e.reasoningCapability)}`]}o(ht,"formatProviderCapabilityDetailLines");function yt(e,t,n){return[{label:"General coding",hints:{}},{label:"Evidence-heavy review",hints:{evidenceHeavy:!0}},{label:"Long-running task",hints:{longRunning:!0}}].map(i=>({label:i.label,decision:Ce(e,t,n,i.hints)})).filter(i=>i.decision!==null)}o(yt,"getProviderCommonPolicyScenarios");var Z=.5,ee=0,P={locked:!1,queue:[]};async function Et(e){for(;P.locked;)await new Promise(t=>P.queue.push(t));P.locked=!0;try{let t=(Date.now()-ee)/1e3;t<Z&&await new Promise(r=>setTimeout(r,(Z-t)*1e3));let n=await e();return ee=Date.now(),n}finally{P.locked=!1;let t=P.queue.shift();t&&t()}}o(Et,"rateLimitedCall");export{Ne as a,S as b,He as c,d,qe as e,ve as f,Je as g,ye as h,be as i,Ye as j,_e as k,Se as l,Oe as m,we as n,Qe as o,Ce as p,Ze as q,et as r,y as s,tt as t,nt as u,ot as v,rt as w,ke as x,it as y,st as z,at as A,w as B,M as C,ct as D,lt as E,Me as F,ut as G,ft as H,dt as I,pt as J,mt as K,gt as L,De as M,vt as N,Te as O,ht as P,yt as Q,Et as R};
|