@kodax-ai/kodax 0.7.55 → 0.7.57

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 (70) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +22 -24
  3. package/README_CN.md +16 -18
  4. package/dist/builtin/code-review/SKILL.md +22 -3
  5. package/dist/chunks/agent-EHWQZA4C.js +2 -0
  6. package/dist/chunks/argument-completer-AYDAYGKL.js +2 -0
  7. package/dist/chunks/chunk-3WWPJGPQ.js +2 -0
  8. package/dist/chunks/chunk-4SHP3M67.js +2 -0
  9. package/dist/chunks/chunk-KN6IJMTB.js +636 -0
  10. package/dist/chunks/{chunk-ZBK3DZ3S.js → chunk-LZKGOR2C.js} +1 -1
  11. package/dist/chunks/chunk-MJFPFRGK.js +423 -0
  12. package/dist/chunks/chunk-N2N2W3AQ.js +584 -0
  13. package/dist/chunks/chunk-PCPFLPS4.js +5 -0
  14. package/dist/chunks/chunk-TCLSPUTR.js +31 -0
  15. package/dist/chunks/chunk-VACH6QWN.js +315 -0
  16. package/dist/chunks/chunk-YSVPF6SN.js +597 -0
  17. package/dist/chunks/{compaction-config-NAJEEPG5.js → compaction-config-TLDMFMZO.js} +1 -1
  18. package/dist/chunks/{construction-bootstrap-4CIVZMQ5.js → construction-bootstrap-55B7Q5RX.js} +4 -4
  19. package/dist/chunks/dist-IE4HVWP7.js +2 -0
  20. package/dist/chunks/dist-IKOK2MJQ.js +2 -0
  21. package/dist/chunks/paste-WTL2XN7P.js +2 -0
  22. package/dist/chunks/utils-EJ2VCRTC.js +2 -0
  23. package/dist/index.d.ts +21 -16
  24. package/dist/index.js +6 -6
  25. package/dist/kodax_cli.js +1128 -1099
  26. package/dist/provider-capabilities.json +986 -195
  27. package/dist/sdk-agent.d.ts +20 -12
  28. package/dist/sdk-agent.js +1 -1
  29. package/dist/sdk-coding.d.ts +223 -108
  30. package/dist/sdk-coding.js +1 -1
  31. package/dist/sdk-llm.d.ts +10 -5
  32. package/dist/sdk-llm.js +1 -1
  33. package/dist/sdk-mcp.d.ts +1 -1
  34. package/dist/sdk-mcp.js +1 -1
  35. package/dist/sdk-media.d.ts +142 -0
  36. package/dist/sdk-media.js +2 -0
  37. package/dist/sdk-repl.d.ts +106 -96
  38. package/dist/sdk-repl.js +1 -1
  39. package/dist/sdk-session.d.ts +6 -5
  40. package/dist/sdk-session.js +1 -1
  41. package/dist/sdk-skills.js +1 -1
  42. package/dist/semantic-worker.js +11 -0
  43. package/dist/types-chunks/base.d-BnjQrSVf.d.ts +301 -0
  44. package/dist/types-chunks/{bash-prefix-extractor.d-LUGkQHcd.d.ts → bash-prefix-extractor.d-BgvMbfq6.d.ts} +198 -139
  45. package/dist/types-chunks/{capsule.d-CNonpwAZ.d.ts → capsule.d-DwJp5r63.d.ts} +14 -11
  46. package/dist/types-chunks/{types.d-D4jL-gAA.d.ts → guardrail.d-BP3yyr6u.d.ts} +3 -121
  47. package/dist/types-chunks/{guardrail.d-B18oO1gt.d.ts → guardrail.d-C1DhxnvC.d.ts} +31 -9
  48. package/dist/types-chunks/{manager.d-DLmDhX3i.d.ts → manager.d-DBD7SOTT.d.ts} +7 -2
  49. package/dist/types-chunks/{process.d-Bj82oJhD.d.ts → process.d-BZncyzEj.d.ts} +2 -1
  50. package/dist/types-chunks/{resolver.d-CCX9NXWP.d.ts → resolver.d-ZvKQgl0X.d.ts} +82 -17
  51. package/dist/types-chunks/{sdk-session-SjrnWb4-.d.ts → sdk-session-DAScB0rW.d.ts} +6 -4
  52. package/dist/types-chunks/{storage.d-BAuJ0Ks7.d.ts → storage.d-CPvn9qI0.d.ts} +2 -2
  53. package/dist/types-chunks/{base.d-BBNUF9nz.d.ts → types.d-6VOXvF88.d.ts} +101 -290
  54. package/dist/types-chunks/types.d-D8WcfrOD.d.ts +143 -0
  55. package/dist/types-chunks/{utils.d-C9MUY8n3.d.ts → utils.d-CpgVIjYZ.d.ts} +16 -18
  56. package/package.json +15 -6
  57. package/dist/chunks/agent-PYSVWY7M.js +0 -2
  58. package/dist/chunks/argument-completer-CTDNNWV3.js +0 -2
  59. package/dist/chunks/chunk-7C2QUBLE.js +0 -31
  60. package/dist/chunks/chunk-EVIDQWMF.js +0 -5
  61. package/dist/chunks/chunk-FRI7UQSB.js +0 -2
  62. package/dist/chunks/chunk-HQCLPWRI.js +0 -551
  63. package/dist/chunks/chunk-JCDO2FR4.js +0 -584
  64. package/dist/chunks/chunk-MX4G42EV.js +0 -425
  65. package/dist/chunks/chunk-RGPPZOD5.js +0 -314
  66. package/dist/chunks/chunk-THAKTCPE.js +0 -652
  67. package/dist/chunks/dist-7KTO2PUU.js +0 -2
  68. package/dist/chunks/dist-BNKIZRCP.js +0 -2
  69. package/dist/chunks/paste-5DSTHQGK.js +0 -2
  70. package/dist/chunks/utils-2QXBKYPJ.js +0 -2
package/CHANGELOG.md CHANGED
@@ -6,6 +6,56 @@ All notable changes to this project will be documented in this file.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.7.57] - 2026-06-28
10
+
11
+ > Scope note: a large architecture release for custom-provider / SDK embedders, built on three ADRs plus a repo-intelligence rewrite. **ADR-041** stops persisting placeholder `...` empty replies into history. **ADR-042** collapses the `mode`/`depth` reasoning dual-track into a single `effort` axis (wire behaviour preserved — `effortToThinkingDepth` mirrors the old `effort→mode→depth` derivation, so every provider×effort still emits the same `reasoning_effort` / `thinking.budget_tokens`). **ADR-043** turns harness routing into static LLM judgment: the keyword router, AMA-controller, fanout-scheduler and prompt-overlay machinery are deleted in favour of a shared static `EXECUTION GUIDANCE` block + an objective-metric Sidecar Verifier gate (`harnessProfile` is retained as a constant `H0_DIRECT`). Repo-intelligence moves from an external host/premium daemon to a fully built-in local semantic index engine with a worker sidecar. **This release contains breaking changes for SDK embedders and custom-provider authors — see the migration notes under Removed / Changed.**
12
+
13
+ ### Added
14
+
15
+ - **Reasoning effort v2 controls.** New `effort` axis end to end: `effort` / `planModeEffort` config, `--effort` CLI flag, `KODAX_EFFORT` env var, the `/effort` REPL command, Ctrl+T effort cycling, and effort-first status display. Custom providers declare support with `reasoning: { efforts: [...], default: "..." }`.
16
+ - **`zai-coding` provider.** Zhipu's overseas mirror (`api.z.ai/anthropic`), keyed by `ZAI_CODING_API_KEY`.
17
+ - **Built-in semantic repo-intelligence engine.** ~17 `semantic-*` modules (multi-language symbol extraction for ts/js/py/java/go/rust/cpp, build cache, materialize, workspace) plus a worker sidecar (`dist/semantic-worker.js`). New `relationship-scan` tool and a `repo-intelligence-index` perf benchmark + baseline.
18
+ - **Passive capability learning.** `~/.kodax/capability-cache.json` records provider/model effort rejections (rebuildable; clear with `/provider forget-capability`); `/provider probe` and `/agents` (idempotent `AGENTS.md` bootstrap) commands.
19
+ - **Multimodal input artifacts** extended; lean review command.
20
+
21
+ ### Changed
22
+
23
+ - **Reasoning control is single-track `effort` (BREAKING).** `KodaXReasoningRequest.mode` / `.depth` were removed — use `.effort`. Legacy custom-provider fields (`reasoningCapability` / `reasoningPreset` / `supportsThinking`) are `@deprecated` and auto-migrated to the new `reasoning` shape at load; the `setThinkingLevel` / `provider:before` hooks now carry effort values rather than legacy mode strings.
24
+ - **Harness is static (ADR-043).** `harnessProfile` / `topologyCeiling` / `upgradeCeiling` are now the single `H0_DIRECT` tier (retained as accurate constants for REPL/status/checkpoint schema). The REPL status bar no longer shows a per-task harness prefix.
25
+ - **Repo-intelligence config (BREAKING).** `repoIntelligenceMode` enum narrows from `auto/off/oss/premium-shared/premium-native` to `auto/off/light/full` (old `oss`/`premium-*` values are rejected). The env var `KODAX_REPO_INTELLIGENCE_MODE` is renamed to `KODAX_REPO_INTELLIGENCE`; `repointelEndpoint` / `repointelBin` config and `KODAX_REPOINTEL_ENDPOINT` / `_BIN` env vars are removed.
26
+ - **`package.json` `files`** tightened from `"dist"` to an explicit glob list (includes `dist/semantic-worker.js`, `dist/builtin`, `provider-capabilities.json`).
27
+
28
+ ### Removed
29
+
30
+ - **Routing / harness machinery (BREAKING for embedders).** Removed the LLM-router cluster, the AMA-controller (`buildAmaControllerDecision` + `KodaXAmaProfile/Tactic/FanoutPolicy/ControllerDecision` types + the `amaProfile`/`amaTactics`/`amaFanout` runtime fields), the `fanout-scheduler` subsystem (`buildFanoutSchedulerPlan` / `createFanoutSchedulerInput` / `applyFanoutBranchTransition` + `KodaXFanout*` types), and `buildPromptOverlay` / `HARNESS_PROFILE_OVERLAYS` / `EXECUTION_MODE_OVERLAYS`. `KodaXAmaFanoutClass` is renamed to `KodaXChildFanoutClass`. None of these were in the SDK embedder guide.
31
+ - **Repo-intel external clients (BREAKING).** `premium-client.ts` / `query-fallback.ts` and the `clients/repointel` host skill are deleted; `warmRepoIntelligenceRuntime` / `REPOINTEL_DEFAULT_ENDPOINT` are gone. Import paths move from `./repo-intelligence/query.js` → `./semantic-types.js` / `./semantic-render.js`, and `./premium-client.js` → `./runtime.js`.
32
+ - **`reasoning-overrides.ts`** and the CAP-019 auto-reroute middleware (dead after the harness static-ization).
33
+
34
+ ### Fixed
35
+
36
+ - **Empty-content contract (ADR-041).** Empty assistant turns are stored as `{ text: "" }`; the placeholder `...` is synthesized wire-only by the Anthropic/OpenAI serializers and never persisted into history. Anthropic gained orphan tool_use/result repair.
37
+ - **Sidecar Verifier objective-metric gate.** Fires on write/risky-shell/round/plan/unattributed-write signals from a mutation tracker that now covers every `mutates-fs` registry tool (incl. `multi_edit`), counts touched lines as `max(old,new)`, and tracks handler-computed-path writes (`undo` / `worktree_*` / `stage_*`) via `unattributedWriteOps`. Restored the SA Direct Path Rule + caller overlay that an interim ADR-043 step had dropped.
38
+ - **Deterministic child-task IDs** (monotonic counter, not `Math.random`/`Date.now`); rate-limit / context-limit provider-error classification; MCP capability-id normalization; child wait-expired review hardening; `glm-5.2` maxOutputTokens 131072 → 128000.
39
+ - **Source-comment encoding.** A host-codepage (cp936) editor save mangled Unicode punctuation — em/en-dashes, arrows, check marks and section signs — into mojibake across 20 source files and the SDK embedder guide; all occurrences are restored against the clean v0.7.56 blobs (Chinese comments were unaffected). Added `.editorconfig` (charset=utf-8) to prevent recurrence.
40
+ - **Self-knowledge manual.** Synced the `config` topic to the new `effort` / `planModeEffort` / `KODAX_EFFORT` reasoning axis and added `/effort` + `/provider` to the `commands` topic.
41
+
42
+ ## [0.7.56] - 2026-06-25
43
+
44
+ > Scope note: a feature release pairing **FEATURE_239** (a public SDK media-input contract so host apps like KodaX Space can build image paste/drop without importing REPL internals) with **FEATURE_240** (provider-neutral `stopReason` normalization), plus a GLM/Kimi provider-model refresh. No LLM-facing prompt surface changed (these are SDK + runtime infrastructure), so per ADR-033 / FEATURE_104 no prompt eval is triggered. The new media helpers ship behind dedicated unit tests; FEATURE_240 ships a cross-protocol integration test (`agent.stop-reason.test.ts`).
45
+
46
+ ### Added
47
+
48
+ - **FEATURE_239 - SDK media input artifacts.** Added `@kodax-ai/kodax/media` and `@kodax-ai/coding/media` with shared image clipboard, normalization, persistence, artifact construction, model input capability, and artifact validation helpers. REPL paste internals now re-export the shared media helpers, and runtime validation rejects unsupported image/video/file artifacts before provider send.
49
+
50
+ ### Changed
51
+
52
+ - **GLM-5.2 and Kimi K2.7 Code on `ark-coding`.** The `ark-coding` provider now serves `glm-5.2` (1M context) and `kimi-k2.7-code` (256K context); the `kimi` provider also exposes `kimi-k2.7-code`. Effective context-window / max-output values are pinned by regression tests.
53
+ - **SDK typing note.** `KodaXInputArtifact.mediaType` is now narrowed from `string` to `KodaXImageMediaType` (`image/png` | `image/jpeg` | `image/webp` | `image/gif`). The runtime shape remains image-only for v0.7.56, but TypeScript SDK consumers passing arbitrary media strings may need to narrow or validate them first.
54
+
55
+ ### Fixed
56
+
57
+ - **FEATURE_240 - Cross-protocol stop reason handling.** Added a provider-neutral stop-reason classifier while keeping `KodaXStreamResult.stopReason` as the raw upstream string. OpenAI-compatible `length` now reaches max-token continuation, `stop` reaches managed-protocol recovery, and pause/refusal/unknown terminal cases are handled explicitly.
58
+
9
59
  ## [0.7.55] - 2026-06-23
10
60
 
11
61
  > Scope note: a fast emergency release hardening **concurrent same-directory session safety**. When two KodaX sessions run against the same git root, they previously shared one scratch root, one extension-store temp file, and an ownerless managed-task checkpoint — so they could overwrite each other's helper files, clobber each other's atomic writes, and resume each other's in-flight tasks. This release scopes each of those to the owning session/process. The one LLM-facing surface (the Worker / role / system workspace-discipline block plus a new `Session Scratch Directory` environment line) ships with a paired prompt eval (`tests/v0755-session-scratch-discipline.eval.ts`); the 5-alias panel shows the reworded discipline introduces **zero** new scratch leakage to the project root or system tmp (`no_leak` 5/5 on every alias for both the v0.7.54 and v0.7.55 wording), with positive session-directory adoption wherever a model writes its scratch file in-turn (ADR-033 / FEATURE_104).
package/README.md CHANGED
@@ -31,7 +31,7 @@
31
31
  </p>
32
32
 
33
33
  <p align="center">
34
- <img src="kodax.gif" alt="KodaX in action" width="880">
34
+ <img src="kodax-hd.gif" alt="KodaX in action" width="880">
35
35
  </p>
36
36
 
37
37
  ---
@@ -191,8 +191,7 @@ Some OpenAI-compatible reasoning models require KodaX to replay the previous ass
191
191
  "baseUrl": "https://example.com/v1",
192
192
  "apiKeyEnv": "MY_DEEPSEEK_API_KEY",
193
193
  "model": "deepseek-v4-flash",
194
- "supportsThinking": true,
195
- "reasoningCapability": "native-toggle",
194
+ "reasoningPreset": "deepseek-v4-openai",
196
195
  "replayReasoningContent": true
197
196
  }
198
197
  ]
@@ -292,19 +291,17 @@ const result = await runKodaX(
292
291
  > surface (`startKodaX` + `RunningSession`), MCP popout manager API (`McpManager`),
293
292
  > Skill `` !`cmd` `` host hook, and per-app data dir namespacing (`getAppDataDir`).
294
293
 
295
- ## Repo Intelligence (optional premium engine)
294
+ ## Repo Intelligence
296
295
 
297
- KodaX ships with built-in OSS repo intelligence (`repo_overview`, `module_context`, `symbol_context`, `process_context`, `impact_estimate`, ) that helps the coding agent understand large codebases without ad-hoc grep/glob exploration.
296
+ KodaX ships with built-in repo intelligence (`repo_overview`, `module_context`, `symbol_context`, `process_context`, `impact_estimate`, and related tools) that helps the coding agent understand large codebases without ad-hoc grep/glob exploration.
298
297
 
299
- An optional **premium engine** (`repointel` local daemon, distributed via the sibling `KodaX-private` repo) adds proactive context injection, deeper module capsules, and a native auto-lane integration. KodaX automatically falls back to OSS when premium is unavailable.
298
+ Use `/repo-intel status` in the REPL to inspect the active engine. The former standalone `repointel` host skill has been removed; repo intelligence is built into KodaX and requires no external installation.
300
299
 
301
300
  ```bash
302
- # Pick a runtime mode (off | oss | premium-shared | premium-native | auto)
303
- kodax --repo-intelligence premium-native --repo-intelligence-trace
301
+ # Pick a runtime mode (auto | full | light | off)
302
+ kodax --repo-intelligence full --repo-intelligence-trace
304
303
  ```
305
304
 
306
- Setup, runtime modes, REPL controls, config schema, and external-host integrations: see [docs/REPOINTEL.md](docs/REPOINTEL.md).
307
-
308
305
  ## Architecture
309
306
 
310
307
  KodaX uses a **monorepo architecture** with npm workspaces. Source layout currently has 4 workspace packages; published as a single bundled npm package `@kodax-ai/kodax` with 7 SDK subpath exports (`/agent`, `/llm`, `/coding`, `/repl`, `/skills`, `/mcp`, `/session`; ADR-024 + ADR-032 + ADR-038, with ADR-036 consolidation):
@@ -412,11 +409,11 @@ KodaX has two layers that consumers should understand separately:
412
409
  - **14 Built-in Provider Aliases** - Anthropic, OpenAI, DeepSeek, Kimi, Kimi Code, Qwen, Zhipu, Zhipu Coding, MiniMax Coding, MiMo Coding, MiMo, Ark Coding, Gemini CLI, Codex CLI - plus user-defined OpenAI/Anthropic-compatible providers
413
410
  - **Dynamic Workflows + SDK Process Surface** - Generate/reuse capability-routed workflows, observe live progress through `WorkflowProcessSnapshot`, and control workflow lifecycle from SDK hosts without parsing REPL output
414
411
  - **V2 Worker single-loop + Sidecar Verifier (default)** - Single-agent main loop with an out-of-band Sidecar Verifier as Stop-hook (claudecode-shape; FEATURE_184 v0.7.42, ADR-030). Verifier returns accept/revise/blocked verdict on Worker text-only termination. The pre-v0.7.43 V1 chain is retired, `emit_handoff` is deleted, accept-verdict UI silently passes through, and content-aware gating skips trivial-chat sidecar calls. Async child steering uses `dispatch_child_task` + `send_message` + `task_stop` with idle-yield wait; specialist routing uses `subagent_type`.
415
- - **Reasoning Modes** - Unified `off/auto/quick/balanced/deep` interface across providers
412
+ - **Reasoning Effort** - Effort-first control (`off/auto/low/medium/high` plus model-supported extras) across providers
416
413
  - **Streaming Output** - Real-time response display
417
414
  - **Session Management** - JSONL format with branchable session lineage tree
418
415
  - **Skills System** - Natural language triggering, extensible, role-projected in AMA
419
- - **Repo Intelligence** - OSS baseline + optional `repointel` premium engine, with native KodaX auto-injection lane
416
+ - **Repo Intelligence** - Built-in full/light repository intelligence with native KodaX auto-injection lane
420
417
  - **Rich Tool Surface** - 50+ built-in tools across file ops, shell, search, repo intelligence, MCP capabilities, git worktree, and agent control
421
418
  - **Permission Control** - 3 permission modes with pattern-based control
422
419
  - **Standalone Binary** - `bun --compile` releases for Win/macOS/Linux x64+arm64, no Node.js required on target machines
@@ -554,8 +551,8 @@ kodax "Help me create a TypeScript project"
554
551
  # Choose a provider explicitly
555
552
  kodax --provider openai --model gpt-5.4 "Create a REST API"
556
553
 
557
- # Use a deeper reasoning mode
558
- kodax --reasoning deep "Review this architecture"
554
+ # Use higher reasoning effort
555
+ kodax --effort high "Review this architecture"
559
556
  ```
560
557
 
561
558
  ### Session Workflows
@@ -664,7 +661,7 @@ kodax -h init # Long-running project initialization
664
661
  kodax -h project # Project mode / harness workflow
665
662
  kodax -h auto # Auto-continue mode
666
663
  kodax -h provider # LLM provider configuration
667
- kodax -h thinking # Thinking/reasoning mode
664
+ kodax -h thinking # Thinking/reasoning effort and compatibility modes
668
665
  kodax -h team # Multi-agent parallel execution
669
666
  kodax -h print # Print configuration
670
667
  ```
@@ -840,7 +837,7 @@ for await (const result of stream) {
840
837
  }
841
838
  ```
842
839
 
843
- **Key Features**: unified provider interface · streaming · reasoning modes (`off/auto/quick/balanced/deep`) · per-provider retry + error handling · zero business-logic dependencies.
840
+ **Key Features**: unified provider interface · streaming · reasoning effort (`off/auto/low/medium/high` plus model-supported extras) · per-provider retry + error handling · zero business-logic dependencies.
844
841
 
845
842
  ### `@kodax-ai/kodax/agent` — Agent Framework (standalone-consumable)
846
843
 
@@ -977,6 +974,7 @@ await runInkInteractiveMode({ provider: 'zhipu-coding', reasoningMode: 'auto' })
977
974
  | qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
978
975
  | zhipu | `ZHIPU_API_KEY` | Native | glm-5 (`glm-5.2` 1M ctx / `glm-5.1` / `glm-5-turbo` via `/model`) |
979
976
  | zhipu-coding | `ZHIPU_CODING_API_KEY` | Native | glm-5 (`glm-5.2` 1M ctx / `glm-5.1` / `glm-5-turbo` via `/model`) |
977
+ | zai-coding | `ZAI_CODING_API_KEY` | Native | glm-5.2 (Zhipu Coding Plan overseas mirror via `api.z.ai`, Anthropic-compat — same model lineup as `zhipu-coding`, served from outside CN) |
980
978
  | minimax-coding | `MINIMAX_CODING_API_KEY` | Native | MiniMax-M2.7 (`MiniMax-M3` Frontier Coding, native multimodal + 1M ctx, plus `MiniMax-M2.7-highspeed` via `/model`) |
981
979
  | mimo | `MIMO_API_KEY` | Native | mimo-v2.5-pro (Xiaomi MiMo pay-per-token, Anthropic-compat) |
982
980
  | mimo-coding | `MIMO_CODING_API_KEY` | Native | mimo-v2.5-pro (Xiaomi Token Plan, Anthropic-compat) |
@@ -1168,20 +1166,20 @@ npm run clean
1168
1166
 
1169
1167
  ### Repo Intelligence cache directories
1170
1168
 
1171
- KodaX now uses two repo-intelligence cache locations on disk:
1169
+ KodaX uses one repo-intelligence cache root with separate built-in engine profiles:
1172
1170
 
1173
1171
  - `.agent/repo-intelligence/`
1174
- - OSS baseline repo-intelligence artifacts and existing task-engine snapshots.
1175
- - `.repointel/`
1176
- - Premium `repointel` workspace cache shared by the local daemon/native frontdoor.
1172
+ - Full-engine repo-intelligence artifacts and existing task-engine snapshots.
1173
+ - `.agent/repo-intelligence/light/`
1174
+ - Light-mode heuristic index artifacts.
1177
1175
 
1178
1176
  They are intentionally separated so:
1179
1177
 
1180
- - OSS fallback stays available even when premium is disabled or unavailable.
1181
- - Premium cache does not pollute OSS artifacts.
1182
- - KodaX and other hosts can share the same premium workspace cache.
1178
+ - full and light profiles can be rebuilt independently.
1179
+ - light-mode confidence/capability state cannot be mistaken for full-engine state.
1180
+ - future cache migrations can delete one profile without corrupting the other.
1183
1181
 
1184
- `.repointel/` is a local generated directory and should not be committed.
1182
+ `.agent/repo-intelligence/` is local generated state and should not be committed.
1185
1183
 
1186
1184
  ---
1187
1185
 
package/README_CN.md CHANGED
@@ -31,7 +31,7 @@
31
31
  </p>
32
32
 
33
33
  <p align="center">
34
- <img src="kodax.gif" alt="KodaX 实战演示" width="880">
34
+ <img src="kodax-hd.gif" alt="KodaX 实战演示" width="880">
35
35
  </p>
36
36
 
37
37
  ---
@@ -253,8 +253,7 @@ import { listSessions } from '@kodax-ai/kodax/session'; // session 历
253
253
  "baseUrl": "https://example.com/v1",
254
254
  "apiKeyEnv": "MY_DEEPSEEK_API_KEY",
255
255
  "model": "deepseek-v4-flash",
256
- "supportsThinking": true,
257
- "reasoningCapability": "native-toggle",
256
+ "reasoningPreset": "deepseek-v4-openai",
258
257
  "replayReasoningContent": true
259
258
  }
260
259
  ]
@@ -380,6 +379,7 @@ dist/binary/linux-x64/
380
379
  | qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
381
380
  | zhipu | `ZHIPU_API_KEY` | Native | glm-5(可 `/model` 切换 `glm-5.2` 1M ctx / `glm-5.1` / `glm-5-turbo`) |
382
381
  | zhipu-coding | `ZHIPU_CODING_API_KEY` | Native | glm-5(GLM Coding Plan;可 `/model` 切换 `glm-5.2` 1M ctx / `glm-5.1` / `glm-5-turbo`) |
382
+ | zai-coding | `ZAI_CODING_API_KEY` | Native | glm-5.2(GLM Coding Plan 海外站,通过 `api.z.ai` 接入,Anthropic 协议 — 模型清单和 `zhipu-coding` 完全一致) |
383
383
  | minimax-coding | `MINIMAX_CODING_API_KEY` | Native | MiniMax-M2.7(可 `/model` 切换 `MiniMax-M3` Frontier Coding,原生多模态 + 1M ctx;以及 `MiniMax-M2.7-highspeed`) |
384
384
  | mimo | `MIMO_API_KEY` | Native | mimo-v2.5-pro(小米 MiMo 按量计费,Anthropic 协议) |
385
385
  | mimo-coding | `MIMO_CODING_API_KEY` | Native | mimo-v2.5-pro(小米 MiMo Token Plan,Anthropic 协议) |
@@ -452,19 +452,17 @@ KodaX 有 50+ 个内置工具,按类别分组如下(实际暴露给 LLM 是
452
452
  | `exit_plan_mode` | Plan 模式下提交最终方案给用户审批(仅 REPL) |
453
453
  | `emit_managed_protocol` | managed-task 协议侧信道(verdict role payload)。v0.7.42 FEATURE_184 起默认走 V2 Worker 单循环 + Sidecar Verifier;v0.7.43 FEATURE_193 退役 V1 chain。 |
454
454
 
455
- ## Repo Intelligence(可选 premium 引擎)
455
+ ## Repo Intelligence(内置 full/light 引擎)
456
456
 
457
- KodaX 内置 OSS repo intelligence(`repo_overview` / `module_context` / `symbol_context` / `process_context` / `impact_estimate` 等),让 coding agent 不靠零散 grep/glob 就能理解大型仓库。
457
+ KodaX 内置 repo intelligence(`repo_overview` / `module_context` / `symbol_context` / `process_context` / `impact_estimate` 等),让 coding agent 不靠零散 grep/glob 就能理解大型仓库。
458
458
 
459
- 可选的 **premium 引擎**(`repointel` 本地 daemon,通过 sibling `KodaX-private` 仓发布)增加主动上下文注入、更深的 module capsule,以及一条 KodaX 原生 auto-lane。premium 不可用时 KodaX 自动 fallback 到 OSS。
459
+ REPL 中使用 `/repo-intel status` 查看当前引擎状态。旧的独立 `repointel` host skill 已移除;repo intelligence 已内置于 KodaX,无需任何外部安装。
460
460
 
461
461
  ```bash
462
- # 选一个运行模式(off | oss | premium-shared | premium-native | auto
463
- kodax --repo-intelligence premium-native --repo-intelligence-trace
462
+ # 选一个运行模式(auto | full | light | off
463
+ kodax --repo-intelligence full --repo-intelligence-trace
464
464
  ```
465
465
 
466
- 完整安装 / 运行模式 / REPL 控制 / config schema / 第三方宿主接入,详见 [docs/REPOINTEL.md](docs/REPOINTEL.md)。
467
-
468
466
  ## 仓库结构
469
467
 
470
468
  KodaX 是基于 npm workspaces 的 TypeScript monorepo,**源码层 4 个 workspace 包**(FEATURE_194 v0.7.43 包合并 — 9 → 4,ADR-036),npm 上以单 bundle 包 `@kodax-ai/kodax` 发布 + 7 个 SDK subpath exports(`/agent`、`/llm`、`/coding`、`/repl`、`/skills`、`/mcp`、`/session`;ADR-024 + ADR-032 + ADR-038)。核心包:
@@ -594,20 +592,20 @@ npm run clean
594
592
 
595
593
  ### Repo Intelligence 缓存目录
596
594
 
597
- KodaX 现在会把 Repo Intelligence 的本地缓存分成两条路径:
595
+ KodaX 现在会把 Repo Intelligence 的本地缓存分成内置引擎 profile:
598
596
 
599
597
  - `.agent/repo-intelligence/`
600
- - OSS baseline 的索引、缓存和现有 task-engine 产物。
601
- - `.repointel/`
602
- - premium `repointel` 的 workspace 级共享缓存,供本地 daemon / native frontdoor 使用。
598
+ - full 引擎索引、缓存和现有 task-engine 产物。
599
+ - `.agent/repo-intelligence/light/`
600
+ - light 模式启发式索引缓存。
603
601
 
604
602
  这样拆开的目的很明确:
605
603
 
606
- - premium 不可用时,OSS fallback 仍然可以稳定工作。
607
- - premium 缓存不会污染 OSS 产物目录。
608
- - KodaX 和其他宿主可以共享同一份 premium workspace cache。
604
+ - full light profile 可以独立重建。
605
+ - light 模式的低置信度状态不会被误认为 full 引擎状态。
606
+ - 未来缓存迁移可以删除一个 profile,而不破坏另一个。
609
607
 
610
- `.repointel/` 是本地生成目录,不应该提交到 Git。
608
+ `.agent/repo-intelligence/` 是本地生成目录,不应该提交到 Git。
611
609
 
612
610
  ---
613
611
 
@@ -58,6 +58,25 @@ compatibility: "Works best in a git repository or when the review target is prov
58
58
 
59
59
  ## 使用示例
60
60
 
61
- - `/code-review src/auth.ts` - 审查单个文件
62
- - `/code-review packages/coding/src/` - 审查目录
63
- - `/code-review` - 审查当前 git 变更
61
+ - `/code-review src/auth.ts` - 审查单个文件
62
+ - `/code-review packages/coding/src/` - 审查目录
63
+ - `/code-review` - 审查当前 git 变更
64
+
65
+ ## Lean Review Lens
66
+
67
+ When the user asks for lean review, minimal diff, YAGNI, over-engineering, or
68
+ native/stdlib replacement opportunities, add this lens after correctness and
69
+ security findings:
70
+
71
+ - Look for code, files, abstractions, dependencies, configuration, or workflow
72
+ changes that can be deleted without losing requested behavior.
73
+ - Prefer existing repository code, stdlib/native platform features, or an
74
+ already-installed dependency when that is verifiably simpler than new custom
75
+ code.
76
+ - Do not recommend cutting trust-boundary validation, security checks,
77
+ data-loss protection, accessibility basics, observability needed for safety,
78
+ or explicitly requested behavior.
79
+ - Do not present optional cleanup as a high-severity finding. Put non-blocking
80
+ deletion/replacement ideas under `## Lean Suggestions`.
81
+ - For each lean suggestion, explain what can be skipped or removed and when it
82
+ should be added back.
@@ -0,0 +1,2 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{Ab as f,ac as g,ec as h,ld as i,qd as j,xb as c,yb as d,zb as e}from"./chunk-KN6IJMTB.js";import"./chunk-PCPFLPS4.js";import"./chunk-TCLSPUTR.js";import{kb as a,lb as b}from"./chunk-N2N2W3AQ.js";import"./chunk-V4WSBIXB.js";export{d as bucketProviderPayloadSize,g as buildAutoRepoIntelligenceContext,e as checkPromiseSignal,b as cleanupIncompleteToolCalls,h as describeTransientProviderRetry,f as emitResilienceDebug,c as estimateProviderPayloadBytes,j as runKodaX,i as saveSessionSnapshot,a as validateAndFixToolHistory};
@@ -0,0 +1,2 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{wa as a,xa as b}from"./chunk-YSVPF6SN.js";import"./chunk-3WWPJGPQ.js";import"./chunk-LZKGOR2C.js";import"./chunk-MJFPFRGK.js";import"./chunk-KN6IJMTB.js";import"./chunk-PCPFLPS4.js";import"./chunk-TCLSPUTR.js";import"./chunk-N2N2W3AQ.js";import"./chunk-V4WSBIXB.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
@@ -0,0 +1,2 @@
1
+ // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
+ import{lb as G,nb as H}from"./chunk-KN6IJMTB.js";import{V as T,W as j,X as N,Y as F,Z as K,_ as w,fa as $,ga as y,ja as x,ta as X,u as D,v as P,xa as V}from"./chunk-TCLSPUTR.js";import{va as v}from"./chunk-N2N2W3AQ.js";import{a as r}from"./chunk-V4WSBIXB.js";import u from"fs";import d from"path";import{exec as ue,spawnSync as fe}from"child_process";import{promisify as de}from"util";import{fileURLToPath as pe}from"url";var R="en";function ie(){return(process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"").toLowerCase().startsWith("zh")?"zh":"en"}r(ie,"detectSystemLocale");function z(e){if(!e||e==="auto"){R=ie();return}R=e.toLowerCase().replace(/[-_].*/,"")==="zh"?"zh":"en"}r(z,"setLocale");var U={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":"\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.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 Fe(e,t){let o=U[R][e]??U.en[e]??e;if(t)for(let[i,s]of Object.entries(t))o=o.replace(`{${i}}`,String(s));return o}r(Fe,"t");import b from"fs";import L from"path";var He=L.join(v(),"capability-cache.json");function B(){return L.join(v(),"capability-cache.json")}r(B,"getCapabilityCacheFile");function A(e,t){return`${e}/${t??""}`}r(A,"capabilityCacheKey");function q(e,t){if(t.length===0)return e;let n=new Set(t);return{...e,supportedEfforts:e.supportedEfforts?.filter(o=>!n.has(o.value)),localRejectEfforts:Array.from(new Set([...e.localRejectEfforts??[],...t]))}}r(q,"narrowReasoningProfile");function se(e,t,n){return e[A(t,n)]?.rejected??[]}r(se,"getRejectedEfforts");function ce(e,t,n,o,i,s){let c=A(t,n),l=e[c],a=l?.rejected.includes(o)?l.rejected:[...l?.rejected??[],o];return{...e,[c]:{rejected:a,source:i,updatedAt:s}}}r(ce,"addRejectedEffort");function ae(e,t,n){if(!t)return{};let o={...e};return delete o[A(t,n)],o}r(ae,"removeCacheEntry");function le(e){if(!e||typeof e!="object")return{};let t={};for(let[n,o]of Object.entries(e)){if(!o||typeof o!="object")continue;let i=o,s=Array.isArray(i.rejected)?i.rejected.filter(a=>typeof a=="string"):[],c=i.source==="probed"?"probed":"observed",l=typeof i.updatedAt=="string"?i.updatedAt:"";t[n]={rejected:s,source:c,updatedAt:l}}return t}r(le,"sanitizeCache");var m=null;function k(){if(m)return m;let e=B();try{m=b.existsSync(e)?le(JSON.parse(b.readFileSync(e,"utf-8"))):{}}catch{m={}}return m}r(k,"loadCapabilityCache");function J(e){m=e;let t=B();b.mkdirSync(L.dirname(t),{recursive:!0}),b.writeFileSync(t,JSON.stringify(e,null,2))}r(J,"persistCapabilityCache");function W(e,t){return se(k(),e,t)}r(W,"getCachedRejectedEfforts");function Ue(e,t,n,o,i){J(ce(k(),e,t,n,o,i))}r(Ue,"recordRejectedEffort");function ze(e,t){J(ae(k(),e,t))}r(ze,"clearCapabilityCache");var me=de(ue),Z=v(),rt=d.join(Z,"sessions"),p=d.join(Z,"config.json"),it=60,f=null,I=!1,ge="dumb";function ye(e){let t=d.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}}r(ye,"buildShellEnvCommand");function ve(e,t){let n=`${t}\0`,o=e.lastIndexOf(n);if(o===-1)return{};let i=e.slice(o+n.length),s={};for(let c of i.split("\0")){if(!c)continue;let l=c.indexOf("=");l<=0||(s[c.slice(0,l)]=c.slice(l+1))}return s}r(ve,"parseNullDelimitedShellEnv");function he(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||!d.isAbsolute(o))return!1;let{args:i,sentinel:s}=ye(o),c=e.run??fe,l={...t,TERM:ge},a=c(o,i,{encoding:"utf8",env:l,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(a.status!==0||!a.stdout)return!1;let ne=typeof a.stdout=="string"?a.stdout:a.stdout.toString("utf8"),oe=ve(ne,s),M=!1;for(let[_,re]of Object.entries(oe))_!=="TERM"&&t[_]===void 0&&(t[_]=re,M=!0);return M}r(he,"hydrateProcessEnvFromShell");function be(){if(!I){I=!0;try{he()}catch{}}}r(be,"ensureShellEnvironmentHydrated");function st(){I=!1}r(st,"resetShellEnvironmentHydrationForTesting");function Ee(e){$(e.customProviders??[])}r(Ee,"registerConfiguredCustomProviders");function ee(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:[]}r(ee,"normalizeConfiguredExtensions");function Ce(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{u.mkdirSync(d.dirname(p),{recursive:!0}),u.writeFileSync(p,JSON.stringify(t,null,2))}catch{}return t}r(Ce,"migrateLegacyPermissionModeInConfig");function Se(e){if(e.permissionMode!=="auto-in-project")return e;try{let t=u.readFileSync(p,"utf-8"),n=t.replace(/("permissionMode"\s*:\s*)"auto-in-project"/,'$1"auto"');n!==t&&u.writeFileSync(p,n)}catch{}return{...e,permissionMode:"auto"}}r(Se,"migrateAutoInProjectAliasInConfig");function _e(){if(f)return f;let e="0.7.57";if(e)return f=e,f;let t=d.join(d.dirname(pe(import.meta.url)),"../../package.json");if(u.existsSync(t))try{return f=JSON.parse(u.readFileSync(t,"utf-8")).version??"0.0.0",f??"0.0.0"}catch{}return f="0.0.0",f}r(_e,"getVersion");var ct=_e();function Pe(e){return j(e)}r(Pe,"getProviderModel");function O(e,t){let n=new Set(e.map(i=>i.toLowerCase())),o=[...e];for(let i of t)n.has(i.toLowerCase())||o.push(i);return o}r(O,"mergeModels");function we(e,t){t||(t=S().providerModels);let n=t?.[e];if(n&&n.length>0){try{let o=w(e);if(o.length>0)return O(n,o)}catch{}try{let o=y(e);if(o)return O(n,o.getAvailableModels())}catch{}return n}try{let o=w(e);if(o.length>0)return o}catch{}try{let o=y(e);if(o)return o.getAvailableModels()}catch{}return[]}r(we,"getProviderAvailableModels");function xe(e,t){let n=N(e,t);if(n!=="unknown")return n;try{let o=y(e);if(o)return o.getReasoningCapability(t)}catch{}return"unknown"}r(xe,"getProviderReasoningCapability");function Re(e){let t=F(e);if(t)return t;try{return x().find(o=>o.name===e)?.capabilityProfile??null}catch{return null}}r(Re,"getProviderCapabilityProfile");function te(e,t){let n=Re(e),o=xe(e,t);if(n)return{capabilityProfile:n,reasoningCapability:o};try{let i=X(e);return{capabilityProfile:i.getCapabilityProfile(),reasoningCapability:i.getReasoningCapability(t)}}catch{return null}}r(te,"getProviderCapabilityMetadata");function at(e,t){let n=te(e,t);return n?G({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}r(at,"getProviderCapabilitySnapshot");function Le(e,t,n,o){let i=te(e,t);return i?H({providerName:e,model:t,capabilityProfile:i.capabilityProfile,reasoningCapability:i.reasoningCapability==="unknown"?void 0:i.reasoningCapability,reasoningMode:n,hints:o}):null}r(Le,"getProviderPolicyDecision");function lt(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}`}r(lt,"describeProviderCapabilitySummary");function ut(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"-"}}r(ut,"formatReasoningCapabilityShort");function g(e){if(e)return e==="none"?"off":e}r(g,"formatReasoningEffortForDisplay");function E(e,t){let n=g(t);n&&!e.includes(n)&&e.push(n)}r(E,"pushUniqueEffortDisplay");function ft(e,t){let n=["auto"],i=C(e,t)?.supportedEfforts?.filter(s=>s.isUserVisible!==!1);if(!i||i.length===0){for(let s of["off","low","medium","high"])E(n,s);return n}for(let s of i)E(n,s.value);return n}r(ft,"getProviderReasoningEffortOptions");function dt(e,t){let n=C(e,t),o=new Set(n?.disabledEfforts??[]),i=n?.supportedEfforts?.filter(a=>a.isUserVisible!==!1),s=[],c=n?.supportsDisabledThinking===!0;if(!i||i.length===0){for(let a of["low","medium","high"])E(s,a);c=!0}else for(let a of i){if(a.value==="none"){c=!0;continue}if(o.has(a.value)){c=!0;continue}E(s,a.value)}let l=[];return c&&l.push("off"),l.push(...s),l.push("auto"),l}r(dt,"getProviderReasoningEffortCycle");function Ae(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"}}r(Ae,"legacyReasoningModeToEffortDisplay");function C(e,t){let n=t??Pe(e);if(!n)return;let o=V(e,n)?.reasoningProfile;if(o)return q(o,W(e,n))}r(C,"resolveReasoningProfileForDisplay");function pt(e){let t=g(e.effort)??Ae(e.reasoningMode,e.thinking),n=C(e.provider,e.model);if(!n)return t;try{let o=D({capability:n,explicitEffort:e.effortOverride?e.effort:void 0,sessionEffort:e.effortOverride?void 0:e.effort,legacyReasoningMode:e.reasoningMode,thinking:e.thinking}),i=g(o.configuredEffort)??t,c=o.configuredEffort!==void 0&&n.disabledEfforts?.includes(o.configuredEffort)===!0?"off":g(o.effectiveEffort);return c&&c!==i?`${i}->${c}`:i}catch{if(e.effort)try{let o=P({currentEffort:e.effort,capability:n}),i=g(e.effort)??t,s=g(o.effectiveEffort);return s&&s!==i?`${i}->${s}`:i}catch{return t}return t}}r(pt,"formatReasoningEffortStatusLabel");function mt(e){let t=je(e);if(!t)return{preserved:!0};let n=C(e.provider,e.model);if(!n)return{configuredEffort:t,runtimeEffort:t,preserved:!0};let o=P({currentEffort:t,capability:n});return{configuredEffort:t,runtimeEffort:o.effectiveEffort,preserved:o.preserved,diagnostic:o.diagnostic}}r(mt,"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"}}r(ke,"describeReasoningCapabilityControl");function gt(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"}}r(gt,"describeReasoningExecution");function yt(e){let t=[];e||(e=S().providerModels);for(let n of K())t.push({name:n.name,model:n.model,models:we(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=x().map(o=>({...o,models:(()=>{let i=e?.[o.name];return i&&i.length>0?O(i,o.models):o.models})()}));t.push(...n)}catch{}return t}r(yt,"getProviderList");function vt(e){if(T(e))return!0;try{return y(e)?.isConfigured()??!1}catch{return!1}}r(vt,"isProviderConfigured");function S(){try{if(u.existsSync(p)){let e=JSON.parse(u.readFileSync(p,"utf-8")),t=e.reasoningCeiling??e.reasoningMode;return Se(Ce({...e,reasoningMode:t,extensions:ee(e.extensions)}))}}catch{}return{}}r(S,"loadConfig");function Ie(e){e.streamIdleTimeoutMs&&!process.env.KODAX_STREAM_IDLE_TIMEOUT_MS&&(process.env.KODAX_STREAM_IDLE_TIMEOUT_MS=String(e.streamIdleTimeoutMs))}r(Ie,"applyResilienceRuntimeEnv");function Oe(e){e.repoIntelligenceMode&&!process.env.KODAX_REPO_INTELLIGENCE&&(process.env.KODAX_REPO_INTELLIGENCE=e.repoIntelligenceMode),e.repoIntelligenceTrace===!0&&!process.env.KODAX_REPO_INTELLIGENCE_TRACE&&(process.env.KODAX_REPO_INTELLIGENCE_TRACE="1")}r(Oe,"applyRepoIntelligenceRuntimeEnv");function Me(e){e.verifierLog===!0&&!process.env.KODAX_VERIFIER_LOG&&(process.env.KODAX_VERIFIER_LOG="1")}r(Me,"applyVerifierRuntimeEnv");function De(e){e.stallLog===!0&&!process.env.KODAX_STALL_LOG&&(process.env.KODAX_STALL_LOG="1")}r(De,"applyStallSidecarRuntimeEnv");function Te(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(","))}r(Te,"applyFallbackRuntimeEnv");function ht(){be();let e=S();return Ie(e),Oe(e),Me(e),De(e),Te(e),Ee(e),z(e.locale),e}r(ht,"prepareRuntimeConfig");function bt(e){let n={...S(),...e},o=ee(n.extensions);o!==void 0&&(n.extensions=o);for(let i of Object.keys(e))e[i]===void 0&&delete n[i];u.mkdirSync(d.dirname(p),{recursive:!0}),u.writeFileSync(p,JSON.stringify(n,null,2))}r(bt,"saveConfig");function Et(e,t){return e.effort!==void 0||t.effort!==void 0}r(Et,"resolveInitialEffortOverride");function je(e){return e.permissionMode==="plan"&&e.effortOverride!==!0&&e.planModeEffort!==void 0?e.planModeEffort:e.effort}r(je,"resolvePermissionModeEffort");async function Ct(e){try{let{stdout:t}=await me("git rev-parse --show-toplevel",{cwd:e});return t.trim()}catch{return null}}r(Ct,"getGitRoot");function Ne(e){switch(e){case"builtin":return"Built-in";case"runtime":return"Runtime extension";case"custom":return"Custom config";default:return"Unknown"}}r(Ne,"formatProviderSourceKind");function St(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: ${Ne(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)}`]}r(St,"formatProviderCapabilityDetailLines");function _t(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:Le(e,t,n,i.hints)})).filter(i=>i.decision!==null)}r(_t,"getProviderCommonPolicyScenarios");var Y=.5,Q=0,h={locked:!1,queue:[]};async function Pt(e){for(;h.locked;)await new Promise(t=>h.queue.push(t));h.locked=!0;try{let t=(Date.now()-Q)/1e3;t<Y&&await new Promise(o=>setTimeout(o,(Y-t)*1e3));let n=await e();return Q=Date.now(),n}finally{h.locked=!1;let t=h.queue.shift();t&&t()}}r(Pt,"rateLimitedCall");export{Fe as a,W as b,Ue as c,ze as d,Z as e,rt as f,p as g,it as h,he as i,st as j,Ee as k,_e as l,ct as m,Pe as n,we as o,xe as p,Re as q,at as r,Le as s,lt as t,ut as u,g as v,ft as w,dt as x,pt as y,mt as z,ke as A,gt as B,yt as C,vt as D,S as E,ht as F,bt as G,Et as H,je as I,Ct as J,Ne as K,St as L,_t as M,Pt as N};
@@ -0,0 +1,2 @@
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-PCPFLPS4.js";import{a as t}from"./chunk-V4WSBIXB.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};