@kodax-ai/kodax 0.7.47 → 0.7.48
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 +19 -1
- package/dist/chunks/{chunk-QZFZIGPF.js → chunk-6Z75SHX3.js} +1 -1
- package/dist/chunks/{chunk-2SMCCP44.js → chunk-DEODZG6Q.js} +1 -1
- package/dist/chunks/chunk-EP46H5P3.js +415 -0
- package/dist/chunks/{chunk-VGRG2F6H.js → chunk-LNJNRREL.js} +223 -207
- package/dist/chunks/{chunk-KRHAO2T3.js → chunk-UHAP234X.js} +234 -234
- package/dist/chunks/{compaction-config-YU7SI6L6.js → compaction-config-YWCHOP2U.js} +1 -1
- package/dist/chunks/{construction-bootstrap-6UN3OY7X.js → construction-bootstrap-AIWATBWW.js} +1 -1
- package/dist/chunks/dist-4WABQRJU.js +2 -0
- package/dist/chunks/{utils-3ISOUEFC.js → utils-OG57XTPC.js} +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +5 -5
- package/dist/kodax_cli.js +635 -619
- package/dist/sdk-agent.d.ts +5 -5
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +42 -11
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-mcp.d.ts +3 -3
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-repl.d.ts +9 -9
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-D6hL0Cuv.d.ts → bash-prefix-extractor.d-DNO2-ycp.d.ts} +5 -31
- package/dist/types-chunks/{config.d-BfJUXxC0.d.ts → config.d-CJy1WENT.d.ts} +17 -7
- package/dist/types-chunks/{file-tracker.d-BNTIvsdb.d.ts → file-tracker.d-D7L_SbRm.d.ts} +1 -1
- package/dist/types-chunks/manager.d-DLmDhX3i.d.ts +696 -0
- package/dist/types-chunks/{types.d-D2RNa5Y7.d.ts → types.d-BCnbYG_A.d.ts} +68 -2
- package/dist/types-chunks/{utils.d-umRKgMAu.d.ts → utils.d-Dgy5SVrq.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-VX6HN3JP.js +0 -415
- package/dist/chunks/dist-DS2KIZQG.js +0 -2
- package/dist/types-chunks/manager.d-U3UEwY1P.d.ts +0 -385
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
> Full history for versions prior to v0.7.0: [CHANGELOG_ARCHIVE.md](docs/CHANGELOG_ARCHIVE.md)
|
|
6
6
|
|
|
7
|
+
## [0.7.48] - 2026-06-11
|
|
8
|
+
|
|
9
|
+
> Scope note: this ships the **server→client (reverse) half** of MCP `2025-11-25` — roots, elicitation, and OAuth discovery/login/step-up — on top of the forward client delivered in v0.7.47. It is **not** "all of 2025-11-25": `sampling` and `tasks` are deferred to v0.7.50 (see below).
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **FEATURE_222 — MCP `2025-11-25` reverse capabilities: roots, elicitation (form + url), and OAuth discovery/login/step-up.** KodaX's self-built MCP client now serves the server→client requests it previously stubbed (`capabilities: {}` → real handlers), aligned to the Claude Code / Codex MCP clients. A capability is advertised **only** when the host injects its handler ("declaration = implementation promise"), so it is incrementally safe and a headless host degrades to the old behaviour. **roots:** a connected server can call `roots/list` and KodaX answers with the workspace as `file://` roots (CLI + ACP). **elicitation:** a server can ask the user for input — every prompt shows **which MCP server is asking** (anti-phishing); `form` mode maps the requested schema (string / number / enum / boolean / confirm-only) onto the host's ask-user dialogs and lets the user **review the exact values before they are sent**; `url` mode is an anti-phishing consent gate (shows the full URL + domain, never auto-opens, never exposes the URL to the model); a `-32042 UrlElicitationRequired` from a tool call is closed by eliciting, waiting for `notifications/elicitation/complete`, then retrying (bounded). The `ask_user_question` primitive moved down to `@kodax-ai/agent` so coding tools and MCP elicitation share one host-injected surface, resolved live at call time. **OAuth:** zero-config authentication — on a `401` KodaX discovers the authorization server (RFC 9728 Protected Resource Metadata → RFC 8414 / OIDC metadata), dynamically registers a client (RFC 7591), and runs PKCE (**S256 required — refuses to downgrade**) with the RFC 8707 `resource` indicator through a `127.0.0.1` loopback callback that is **listening before the URL is shown** (no lost-redirect race; consent uses the same anti-phishing url prompt — the browser is never opened for you), then persists + refreshes the token; a mid-session `403 insufficient_scope` triggers a step-up re-login. MCP `config.auth` endpoint fields are now **optional** (provide them only to pin a static pre-registered client). New `@kodax-ai/agent` MCP exports include `setActiveUserInteraction`, `discoverOAuthEndpoints`, `performOAuthLogin`, and `McpAuthRequiredError`, plus the coding-layer `buildMcpReverseCapabilities`. **Not implemented (deliberate):** Client ID Metadata Documents (SEP-991) — DCR is the registration baseline (matches Codex). Covered by 130+ MCP tests including fake-MCP-server end-to-end cases (elicitation, `-32042` retry, OAuth callback race/buffer/cleanup, S256 refusal, and the full `401 → discovery → DCR → consent → loopback → token → retry`). See [docs/features/v0.7.48.md FEATURE_222](docs/features/v0.7.48.md).
|
|
14
|
+
- **MCP config `type: "http"` — transport auto-detection (ecosystem config compat).** Other MCP clients' config files use `type: "http"` as a single entry that means "an HTTP MCP server, figure out the flavour". KodaX now accepts it as a **config-layer alias** (not a wire protocol): it POSTs `initialize` as Streamable HTTP first and, only on `400/404/405`, falls back to the legacy HTTP+SSE transport — `401`/`403`/`5xx`/network errors never fall back (so an auth challenge still reaches the OAuth flow). The resolved transport is recorded in diagnostics (`http:auto->streamable-http` / `http:auto->sse`). Accepted by the REPL config validator and the ACP conversion path too.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **MCP catalog tolerates servers that don't implement every list.** A `-32601` (method-not-found, by error code) from `resources/list` or `prompts/list` is now treated as an empty list instead of failing the whole catalog refresh, so a tools-only server's tools stay usable. `tools/list` still hard-fails (no tools = no core capability).
|
|
19
|
+
- **ACP sessions now connect configured MCP servers** (resolves the long-standing gap where `mcpServers` did not take effect in editor / ACP scenarios). Reverse capabilities over ACP are roots-only (out-of-process; no interactive dialog), so elicitation/OAuth there degrade to decline.
|
|
20
|
+
|
|
21
|
+
**Deferred to v0.7.50** (see [docs/features/v0.7.50.md](docs/features/v0.7.50.md)): `sampling` (server-driven LLM calls — the runtime seam exists but is **not advertised or wired** to `@kodax-ai/llm`; security-sensitive, needs opt-in + quota guardrails) and `tasks`.
|
|
22
|
+
|
|
23
|
+
> Known test-suite note: a handful of `vitest` files (worktree / session-storage / repo-intelligence / selection / recovery) intermittently time out or hit Windows temp-dir locks under full-suite parallelism; all pass when run in isolation. These are environment/load flakes, not regressions — the MCP suite and full build are green.
|
|
24
|
+
|
|
7
25
|
## [0.7.47] - 2026-06-10
|
|
8
26
|
|
|
9
27
|
### Added
|
|
@@ -763,7 +781,7 @@ Two features close out v0.7.32 and the Plan B roadmap. **FEATURE_090** is the ro
|
|
|
763
781
|
### Documentation
|
|
764
782
|
|
|
765
783
|
- **EVAL_GUIDELINES rewrite** — `benchmark/EVAL_GUIDELINES.md` now documents the **single-turn probe methodology** as the official KodaX eval pattern and removes end-to-end loop comparisons from the recommended set. Loops conflate prompt quality with tool-availability artefacts (model tries to verify with `read`/`grep`/`bash`, harness can't provide tools, benchmark scores the format-fail). Single-turn probes test the prompt-only contract.
|
|
766
|
-
- **FEATURE_108 design** (`docs/features/v0.7.47.md`) — Session-Driven Reflective Prompt Patcher spec landed for v0.7.47 design preview
|
|
784
|
+
- **FEATURE_108 design** (`docs/features/v0.7.47.md`) — Session-Driven Reflective Prompt Patcher spec landed for v0.7.47 design preview.(注:版本重排后 FEATURE_108 先于 2026-06-05 迁至 v0.7.54,再于 2026-06-11 顺延至 [`docs/features/v0.7.57.md`](docs/features/v0.7.57.md);`v0.7.47.md` 现为 FEATURE_218 + FEATURE_132)
|
|
767
785
|
- **FEATURE_109 design** (`docs/features/v0.7.48.md`) — Harness Observability Substrate (long-term memory + prediction contract + cross-family prose guard) spec landed for v0.7.48 design preview.
|
|
768
786
|
- **`docs/features/v0.7.29.md` 1496-line expansion** — folds back the historical capability-inventory artifact (`v0.7.29-capability-inventory.md` deleted) and adds deeper FEATURE_103/104/107-related context to the v0.7.29 retrospective.
|
|
769
787
|
- **`docs/CODING_AGENT_PROMPTS.md`** — cross-project prompt-system reference (4 open-source coding agents) for KodaX prompt design comparison. Research artefact, not a project doc.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{mc as k,oc as D}from"./chunk-VGRG2F6H.js";import{U as S,V as w,W as L,X as I,Y as x,Z as h,ea as O,fa as m,ia as b,sa as R}from"./chunk-66B6ZOU7.js";import{va as A}from"./chunk-VX6HN3JP.js";import{a as i}from"./chunk-V4WSBIXB.js";import s from"fs";import c from"path";import{exec as H,spawnSync as z}from"child_process";import{promisify as U}from"util";import{fileURLToPath as q}from"url";var E="en";function G(){return(process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"").toLowerCase().startsWith("zh")?"zh":"en"}i(G,"detectSystemLocale");function T(e){if(!e||e==="auto"){E=G();return}E=e.toLowerCase().replace(/[-_].*/,"")==="zh"?"zh":"en"}i(T,"setLocale");var M={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.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":"\u4EE3\u7406\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.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 ye(e,t){let o=M[E][e]??M.en[e]??e;if(t)for(let[r,u]of Object.entries(t))o=o.replace(`{${r}}`,String(u));return o}i(ye,"t");var W=U(H),X=A(),Ie=c.join(X,"sessions"),l=c.join(X,"config.json"),xe=60,a=null,_=!1,J="dumb";function Q(e){let t=c.basename(e).toLowerCase(),n="__KODAX_SHELL_ENV_START__",o=`printf '%s\\0' '${n}'; env -0`;return t==="fish"?{args:["-i","-c",o],sentinel:n}:{args:t==="bash"||t==="zsh"?["-ic",o]:["-lc",o],sentinel:n}}i(Q,"buildShellEnvCommand");function Y(e,t){let n=`${t}\0`,o=e.lastIndexOf(n);if(o===-1)return{};let r=e.slice(o+n.length),u={};for(let p of r.split("\0")){if(!p)continue;let d=p.indexOf("=");d<=0||(u[p.slice(0,d)]=p.slice(d+1))}return u}i(Y,"parseNullDelimitedShellEnv");function Z(e={}){let t=e.env??process.env;if((e.platform??process.platform)==="win32"||t.KODAX_DISABLE_SHELL_ENV_HYDRATION==="1")return!1;let o=e.shell??t.SHELL;if(!o||!c.isAbsolute(o))return!1;let{args:r,sentinel:u}=Q(o),p=e.run??z,d={...t,TERM:J},f=p(o,r,{encoding:"utf8",env:d,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(f.status!==0||!f.stdout)return!1;let j=typeof f.stdout=="string"?f.stdout:f.stdout.toString("utf8"),B=Y(j,u),C=!1;for(let[v,V]of Object.entries(B))v!=="TERM"&&t[v]===void 0&&(t[v]=V,C=!0);return C}i(Z,"hydrateProcessEnvFromShell");function ee(){if(!_){_=!0;try{Z()}catch{}}}i(ee,"ensureShellEnvironmentHydrated");function Oe(){_=!1}i(Oe,"resetShellEnvironmentHydrationForTesting");function te(e){O(e.customProviders??[])}i(te,"registerConfiguredCustomProviders");function $(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:[]}i($,"normalizeConfiguredExtensions");function ne(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{s.mkdirSync(c.dirname(l),{recursive:!0}),s.writeFileSync(l,JSON.stringify(t,null,2))}catch{}return t}i(ne,"migrateLegacyPermissionModeInConfig");function oe(e){if(e.permissionMode!=="auto-in-project")return e;try{let t=s.readFileSync(l,"utf-8"),n=t.replace(/("permissionMode"\s*:\s*)"auto-in-project"/,'$1"auto"');n!==t&&s.writeFileSync(l,n)}catch{}return{...e,permissionMode:"auto"}}i(oe,"migrateAutoInProjectAliasInConfig");function ie(){if(a)return a;let e="0.7.47";if(e)return a=e,a;let t=c.join(c.dirname(q(import.meta.url)),"../../package.json");if(s.existsSync(t))try{return a=JSON.parse(s.readFileSync(t,"utf-8")).version??"0.0.0",a??"0.0.0"}catch{}return a="0.0.0",a}i(ie,"getVersion");var Re=ie();function Ae(e){return w(e)}i(Ae,"getProviderModel");function P(e,t){let n=new Set(e.map(r=>r.toLowerCase())),o=[...e];for(let r of t)n.has(r.toLowerCase())||o.push(r);return o}i(P,"mergeModels");function re(e,t){t||(t=y().providerModels);let n=t?.[e];if(n&&n.length>0){try{let o=h(e);if(o.length>0)return P(n,o)}catch{}try{let o=m(e);if(o)return P(n,o.getAvailableModels())}catch{}return n}try{let o=h(e);if(o.length>0)return o}catch{}try{let o=m(e);if(o)return o.getAvailableModels()}catch{}return[]}i(re,"getProviderAvailableModels");function se(e,t){let n=L(e,t);if(n!=="unknown")return n;try{let o=m(e);if(o)return o.getReasoningCapability(t)}catch{}return"unknown"}i(se,"getProviderReasoningCapability");function ae(e){let t=I(e);if(t)return t;try{return b().find(o=>o.name===e)?.capabilityProfile??null}catch{return null}}i(ae,"getProviderCapabilityProfile");function F(e,t){let n=ae(e),o=se(e,t);if(n)return{capabilityProfile:n,reasoningCapability:o};try{let r=R(e);return{capabilityProfile:r.getCapabilityProfile(),reasoningCapability:r.getReasoningCapability(t)}}catch{return null}}i(F,"getProviderCapabilityMetadata");function ke(e,t){let n=F(e,t);return n?k({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}i(ke,"getProviderCapabilitySnapshot");function ce(e,t,n,o){let r=F(e,t);return r?D({providerName:e,model:t,capabilityProfile:r.capabilityProfile,reasoningCapability:r.reasoningCapability==="unknown"?void 0:r.reasoningCapability,reasoningMode:n,hints:o}):null}i(ce,"getProviderPolicyDecision");function De(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",o=e.mcpSupport==="native"?"MCP available":"MCP unavailable";return`${t}; ${n}; ${o}`}i(De,"describeProviderCapabilitySummary");function Me(e){switch(e){case"native-budget":return"B";case"native-effort":return"E";case"native-toggle":return"T";default:return"-"}}i(Me,"formatReasoningCapabilityShort");function le(e){switch(e){case"native-budget":return"budget";case"native-effort":return"effort";case"native-toggle":return"toggle";default:return"none"}}i(le,"describeReasoningCapabilityControl");function Te(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"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"}}i(Te,"describeReasoningExecution");function Ne(e){let t=[];e||(e=y().providerModels);for(let n of x())t.push({name:n.name,model:n.model,models:re(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=b().map(o=>({...o,models:(()=>{let r=e?.[o.name];return r&&r.length>0?P(r,o.models):o.models})()}));t.push(...n)}catch{}return t}i(Ne,"getProviderList");function Ke(e){if(S(e))return!0;try{return m(e)?.isConfigured()??!1}catch{return!1}}i(Ke,"isProviderConfigured");function y(){try{if(s.existsSync(l)){let e=JSON.parse(s.readFileSync(l,"utf-8")),t=e.reasoningCeiling??e.reasoningMode;return oe(ne({...e,reasoningMode:t,extensions:$(e.extensions)}))}}catch{}return{}}i(y,"loadConfig");function ue(e){e.streamIdleTimeoutMs&&!process.env.KODAX_STREAM_IDLE_TIMEOUT_MS&&(process.env.KODAX_STREAM_IDLE_TIMEOUT_MS=String(e.streamIdleTimeoutMs))}i(ue,"applyResilienceRuntimeEnv");function pe(e){e.repoIntelligenceMode&&!process.env.KODAX_REPO_INTELLIGENCE_MODE&&(process.env.KODAX_REPO_INTELLIGENCE_MODE=e.repoIntelligenceMode),e.repointelEndpoint&&!process.env.KODAX_REPOINTEL_ENDPOINT&&(process.env.KODAX_REPOINTEL_ENDPOINT=e.repointelEndpoint),e.repointelBin&&!process.env.KODAX_REPOINTEL_BIN&&(process.env.KODAX_REPOINTEL_BIN=e.repointelBin),e.repoIntelligenceTrace===!0&&!process.env.KODAX_REPO_INTELLIGENCE_TRACE&&(process.env.KODAX_REPO_INTELLIGENCE_TRACE="1")}i(pe,"applyRepoIntelligenceRuntimeEnv");function de(e){e.verifierLog===!0&&!process.env.KODAX_VERIFIER_LOG&&(process.env.KODAX_VERIFIER_LOG="1")}i(de,"applyVerifierRuntimeEnv");function fe(e){e.stallLog===!0&&!process.env.KODAX_STALL_LOG&&(process.env.KODAX_STALL_LOG="1")}i(fe,"applyStallSidecarRuntimeEnv");function me(e){let t=e.fallbackProviders?.filter(n=>n.trim().length>0)??[];t.length>0&&!process.env.KODAX_FALLBACK_PROVIDERS&&(process.env.KODAX_FALLBACK_PROVIDERS=t.join(","))}i(me,"applyFallbackRuntimeEnv");function Xe(){ee();let e=y();return ue(e),pe(e),de(e),fe(e),me(e),te(e),T(e.locale),e}i(Xe,"prepareRuntimeConfig");function $e(e){let n={...y(),...e},o=$(n.extensions);o!==void 0&&(n.extensions=o);for(let r of Object.keys(e))e[r]===void 0&&delete n[r];s.mkdirSync(c.dirname(l),{recursive:!0}),s.writeFileSync(l,JSON.stringify(n,null,2))}i($e,"saveConfig");async function Fe(e){try{let{stdout:t}=await W("git rev-parse --show-toplevel",{cwd:e});return t.trim()}catch{return null}}i(Fe,"getGitRoot");function ge(e){switch(e){case"builtin":return"Built-in";case"runtime":return"Runtime extension";case"custom":return"Custom config";default:return"Unknown"}}i(ge,"formatProviderSourceKind");function je(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: ${ge(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: ${le(e.reasoningCapability)}`]}i(je,"formatProviderCapabilityDetailLines");function Be(e,t,n){return[{label:"General coding",hints:{}},{label:"Evidence-heavy review",hints:{evidenceHeavy:!0}},{label:"Long-running task",hints:{longRunning:!0}}].map(r=>({label:r.label,decision:ce(e,t,n,r.hints)})).filter(r=>r.decision!==null)}i(Be,"getProviderCommonPolicyScenarios");var N=.5,K=0,g={locked:!1,queue:[]};async function Ve(e){for(;g.locked;)await new Promise(t=>g.queue.push(t));g.locked=!0;try{let t=(Date.now()-K)/1e3;t<N&&await new Promise(o=>setTimeout(o,(N-t)*1e3));let n=await e();return K=Date.now(),n}finally{g.locked=!1;let t=g.queue.shift();t&&t()}}i(Ve,"rateLimitedCall");export{ye as a,X as b,Ie as c,l as d,xe as e,Z as f,Oe as g,te as h,ie as i,Re as j,Ae as k,re as l,se as m,ae as n,ke as o,ce as p,De as q,Me as r,le as s,Te as t,Ne as u,Ke as v,y as w,Xe as x,$e as y,Fe as z,ge as A,je as B,Be as C,Ve as D};
|
|
2
|
+
import{mc as k,oc as D}from"./chunk-LNJNRREL.js";import{U as S,V as w,W as L,X as I,Y as x,Z as h,ea as O,fa as m,ia as b,sa as R}from"./chunk-66B6ZOU7.js";import{va as A}from"./chunk-EP46H5P3.js";import{a as i}from"./chunk-V4WSBIXB.js";import s from"fs";import c from"path";import{exec as H,spawnSync as z}from"child_process";import{promisify as U}from"util";import{fileURLToPath as q}from"url";var E="en";function G(){return(process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"").toLowerCase().startsWith("zh")?"zh":"en"}i(G,"detectSystemLocale");function T(e){if(!e||e==="auto"){E=G();return}E=e.toLowerCase().replace(/[-_].*/,"")==="zh"?"zh":"en"}i(T,"setLocale");var M={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.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":"\u4EE3\u7406\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.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 ye(e,t){let o=M[E][e]??M.en[e]??e;if(t)for(let[r,u]of Object.entries(t))o=o.replace(`{${r}}`,String(u));return o}i(ye,"t");var W=U(H),X=A(),Ie=c.join(X,"sessions"),l=c.join(X,"config.json"),xe=60,a=null,_=!1,J="dumb";function Q(e){let t=c.basename(e).toLowerCase(),n="__KODAX_SHELL_ENV_START__",o=`printf '%s\\0' '${n}'; env -0`;return t==="fish"?{args:["-i","-c",o],sentinel:n}:{args:t==="bash"||t==="zsh"?["-ic",o]:["-lc",o],sentinel:n}}i(Q,"buildShellEnvCommand");function Y(e,t){let n=`${t}\0`,o=e.lastIndexOf(n);if(o===-1)return{};let r=e.slice(o+n.length),u={};for(let p of r.split("\0")){if(!p)continue;let d=p.indexOf("=");d<=0||(u[p.slice(0,d)]=p.slice(d+1))}return u}i(Y,"parseNullDelimitedShellEnv");function Z(e={}){let t=e.env??process.env;if((e.platform??process.platform)==="win32"||t.KODAX_DISABLE_SHELL_ENV_HYDRATION==="1")return!1;let o=e.shell??t.SHELL;if(!o||!c.isAbsolute(o))return!1;let{args:r,sentinel:u}=Q(o),p=e.run??z,d={...t,TERM:J},f=p(o,r,{encoding:"utf8",env:d,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(f.status!==0||!f.stdout)return!1;let j=typeof f.stdout=="string"?f.stdout:f.stdout.toString("utf8"),B=Y(j,u),C=!1;for(let[v,V]of Object.entries(B))v!=="TERM"&&t[v]===void 0&&(t[v]=V,C=!0);return C}i(Z,"hydrateProcessEnvFromShell");function ee(){if(!_){_=!0;try{Z()}catch{}}}i(ee,"ensureShellEnvironmentHydrated");function Oe(){_=!1}i(Oe,"resetShellEnvironmentHydrationForTesting");function te(e){O(e.customProviders??[])}i(te,"registerConfiguredCustomProviders");function $(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:[]}i($,"normalizeConfiguredExtensions");function ne(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{s.mkdirSync(c.dirname(l),{recursive:!0}),s.writeFileSync(l,JSON.stringify(t,null,2))}catch{}return t}i(ne,"migrateLegacyPermissionModeInConfig");function oe(e){if(e.permissionMode!=="auto-in-project")return e;try{let t=s.readFileSync(l,"utf-8"),n=t.replace(/("permissionMode"\s*:\s*)"auto-in-project"/,'$1"auto"');n!==t&&s.writeFileSync(l,n)}catch{}return{...e,permissionMode:"auto"}}i(oe,"migrateAutoInProjectAliasInConfig");function ie(){if(a)return a;let e="0.7.48";if(e)return a=e,a;let t=c.join(c.dirname(q(import.meta.url)),"../../package.json");if(s.existsSync(t))try{return a=JSON.parse(s.readFileSync(t,"utf-8")).version??"0.0.0",a??"0.0.0"}catch{}return a="0.0.0",a}i(ie,"getVersion");var Re=ie();function Ae(e){return w(e)}i(Ae,"getProviderModel");function P(e,t){let n=new Set(e.map(r=>r.toLowerCase())),o=[...e];for(let r of t)n.has(r.toLowerCase())||o.push(r);return o}i(P,"mergeModels");function re(e,t){t||(t=y().providerModels);let n=t?.[e];if(n&&n.length>0){try{let o=h(e);if(o.length>0)return P(n,o)}catch{}try{let o=m(e);if(o)return P(n,o.getAvailableModels())}catch{}return n}try{let o=h(e);if(o.length>0)return o}catch{}try{let o=m(e);if(o)return o.getAvailableModels()}catch{}return[]}i(re,"getProviderAvailableModels");function se(e,t){let n=L(e,t);if(n!=="unknown")return n;try{let o=m(e);if(o)return o.getReasoningCapability(t)}catch{}return"unknown"}i(se,"getProviderReasoningCapability");function ae(e){let t=I(e);if(t)return t;try{return b().find(o=>o.name===e)?.capabilityProfile??null}catch{return null}}i(ae,"getProviderCapabilityProfile");function F(e,t){let n=ae(e),o=se(e,t);if(n)return{capabilityProfile:n,reasoningCapability:o};try{let r=R(e);return{capabilityProfile:r.getCapabilityProfile(),reasoningCapability:r.getReasoningCapability(t)}}catch{return null}}i(F,"getProviderCapabilityMetadata");function ke(e,t){let n=F(e,t);return n?k({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}i(ke,"getProviderCapabilitySnapshot");function ce(e,t,n,o){let r=F(e,t);return r?D({providerName:e,model:t,capabilityProfile:r.capabilityProfile,reasoningCapability:r.reasoningCapability==="unknown"?void 0:r.reasoningCapability,reasoningMode:n,hints:o}):null}i(ce,"getProviderPolicyDecision");function De(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",o=e.mcpSupport==="native"?"MCP available":"MCP unavailable";return`${t}; ${n}; ${o}`}i(De,"describeProviderCapabilitySummary");function Me(e){switch(e){case"native-budget":return"B";case"native-effort":return"E";case"native-toggle":return"T";default:return"-"}}i(Me,"formatReasoningCapabilityShort");function le(e){switch(e){case"native-budget":return"budget";case"native-effort":return"effort";case"native-toggle":return"toggle";default:return"none"}}i(le,"describeReasoningCapabilityControl");function Te(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"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"}}i(Te,"describeReasoningExecution");function Ne(e){let t=[];e||(e=y().providerModels);for(let n of x())t.push({name:n.name,model:n.model,models:re(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=b().map(o=>({...o,models:(()=>{let r=e?.[o.name];return r&&r.length>0?P(r,o.models):o.models})()}));t.push(...n)}catch{}return t}i(Ne,"getProviderList");function Ke(e){if(S(e))return!0;try{return m(e)?.isConfigured()??!1}catch{return!1}}i(Ke,"isProviderConfigured");function y(){try{if(s.existsSync(l)){let e=JSON.parse(s.readFileSync(l,"utf-8")),t=e.reasoningCeiling??e.reasoningMode;return oe(ne({...e,reasoningMode:t,extensions:$(e.extensions)}))}}catch{}return{}}i(y,"loadConfig");function ue(e){e.streamIdleTimeoutMs&&!process.env.KODAX_STREAM_IDLE_TIMEOUT_MS&&(process.env.KODAX_STREAM_IDLE_TIMEOUT_MS=String(e.streamIdleTimeoutMs))}i(ue,"applyResilienceRuntimeEnv");function pe(e){e.repoIntelligenceMode&&!process.env.KODAX_REPO_INTELLIGENCE_MODE&&(process.env.KODAX_REPO_INTELLIGENCE_MODE=e.repoIntelligenceMode),e.repointelEndpoint&&!process.env.KODAX_REPOINTEL_ENDPOINT&&(process.env.KODAX_REPOINTEL_ENDPOINT=e.repointelEndpoint),e.repointelBin&&!process.env.KODAX_REPOINTEL_BIN&&(process.env.KODAX_REPOINTEL_BIN=e.repointelBin),e.repoIntelligenceTrace===!0&&!process.env.KODAX_REPO_INTELLIGENCE_TRACE&&(process.env.KODAX_REPO_INTELLIGENCE_TRACE="1")}i(pe,"applyRepoIntelligenceRuntimeEnv");function de(e){e.verifierLog===!0&&!process.env.KODAX_VERIFIER_LOG&&(process.env.KODAX_VERIFIER_LOG="1")}i(de,"applyVerifierRuntimeEnv");function fe(e){e.stallLog===!0&&!process.env.KODAX_STALL_LOG&&(process.env.KODAX_STALL_LOG="1")}i(fe,"applyStallSidecarRuntimeEnv");function me(e){let t=e.fallbackProviders?.filter(n=>n.trim().length>0)??[];t.length>0&&!process.env.KODAX_FALLBACK_PROVIDERS&&(process.env.KODAX_FALLBACK_PROVIDERS=t.join(","))}i(me,"applyFallbackRuntimeEnv");function Xe(){ee();let e=y();return ue(e),pe(e),de(e),fe(e),me(e),te(e),T(e.locale),e}i(Xe,"prepareRuntimeConfig");function $e(e){let n={...y(),...e},o=$(n.extensions);o!==void 0&&(n.extensions=o);for(let r of Object.keys(e))e[r]===void 0&&delete n[r];s.mkdirSync(c.dirname(l),{recursive:!0}),s.writeFileSync(l,JSON.stringify(n,null,2))}i($e,"saveConfig");async function Fe(e){try{let{stdout:t}=await W("git rev-parse --show-toplevel",{cwd:e});return t.trim()}catch{return null}}i(Fe,"getGitRoot");function ge(e){switch(e){case"builtin":return"Built-in";case"runtime":return"Runtime extension";case"custom":return"Custom config";default:return"Unknown"}}i(ge,"formatProviderSourceKind");function je(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: ${ge(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: ${le(e.reasoningCapability)}`]}i(je,"formatProviderCapabilityDetailLines");function Be(e,t,n){return[{label:"General coding",hints:{}},{label:"Evidence-heavy review",hints:{evidenceHeavy:!0}},{label:"Long-running task",hints:{longRunning:!0}}].map(r=>({label:r.label,decision:ce(e,t,n,r.hints)})).filter(r=>r.decision!==null)}i(Be,"getProviderCommonPolicyScenarios");var N=.5,K=0,g={locked:!1,queue:[]};async function Ve(e){for(;g.locked;)await new Promise(t=>g.queue.push(t));g.locked=!0;try{let t=(Date.now()-K)/1e3;t<N&&await new Promise(o=>setTimeout(o,(N-t)*1e3));let n=await e();return K=Date.now(),n}finally{g.locked=!1;let t=g.queue.shift();t&&t()}}i(Ve,"rateLimitedCall");export{ye as a,X as b,Ie as c,l as d,xe as e,Z as f,Oe as g,te as h,ie as i,Re as j,Ae as k,re as l,se as m,ae as n,ke as o,ce as p,De as q,Me as r,le as s,Te as t,Ne as u,Ke as v,y as w,Xe as x,$e as y,Fe as z,ge as A,je as B,Be as C,Ve as D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{wa as e}from"./chunk-
|
|
2
|
+
import{wa as e}from"./chunk-EP46H5P3.js";import{a as n}from"./chunk-V4WSBIXB.js";import{readFile as i}from"fs/promises";var c={enabled:!0,triggerPercent:75};async function g(o){let t=e("config.json");try{let r=await a(t);if(r?.compaction)return{...c,...r.compaction}}catch{}return c}n(g,"loadCompactionConfig");async function a(o){try{let t=await i(o,"utf-8");return JSON.parse(t)}catch{return null}}n(a,"readConfigFile");export{g as a};
|