@kodax-ai/kodax 0.7.66 → 0.7.67
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 +108 -3
- package/README.md +40 -10
- package/README_CN.md +26 -9
- package/dist/chunks/{agent-KER4WDNO.js → agent-E4V5SLX6.js} +1 -1
- package/dist/chunks/argument-completer-N6RT5KYT.js +2 -0
- package/dist/chunks/{chunk-QJVZZSEO.js → chunk-AKMXJSGM.js} +1 -1
- package/dist/chunks/{chunk-WMIZCY2J.js → chunk-CW32NQFO.js} +1 -1
- package/dist/chunks/{chunk-ALS32RNZ.js → chunk-DEICMTHO.js} +9 -9
- package/dist/chunks/{chunk-VS4CDDEF.js → chunk-EN3O2C43.js} +221 -221
- package/dist/chunks/chunk-KBBGDRER.js +22 -0
- package/dist/chunks/chunk-NVDK375I.js +729 -0
- package/dist/chunks/chunk-QI6SQ2UQ.js +306 -0
- package/dist/chunks/{chunk-MHRN2LQV.js → chunk-RS2GAABJ.js} +17 -17
- package/dist/chunks/chunk-W2XMNYLK.js +15 -0
- package/dist/chunks/{chunk-QAQ2HNXD.js → chunk-WCSSXBHR.js} +126 -112
- package/dist/chunks/chunk-YH5BTUQO.js +343 -0
- package/dist/chunks/{compaction-config-7GMUFNPB.js → compaction-config-56NO42ZI.js} +1 -1
- package/dist/chunks/{construction-bootstrap-3XDS2D5K.js → construction-bootstrap-GLEHQ2KB.js} +1 -1
- package/dist/chunks/dist-4UIRSSFS.js +2 -0
- package/dist/chunks/host-DMREFNSO.js +2 -0
- package/dist/chunks/{run-manager-6CAH3KTA.js → run-manager-P5XMSGZ7.js} +1 -1
- package/dist/chunks/{utils-OT5ENFUL.js → utils-JENPFKAE.js} +1 -1
- package/dist/index.d.ts +15 -12
- package/dist/index.js +6 -6
- package/dist/kodax_cli.js +1237 -1214
- package/dist/runtime-worker.js +1147 -1118
- package/dist/sdk-agent.d.ts +27 -10
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +277 -16
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-repl.d.ts +23 -14
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +99 -11
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-session.d.ts +4 -4
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +11 -11
- package/dist/types-chunks/{bash-prefix-extractor.d-BjkITAva.d.ts → bash-prefix-extractor.d-D57Gt6n8.d.ts} +44 -9
- package/dist/types-chunks/{capsule.d-hVhPNkHd.d.ts → capsule.d-BZmqu_HL.d.ts} +2 -2
- package/dist/types-chunks/{commands.d-C3B1TdGM.d.ts → commands.d-Cg26ud-Y.d.ts} +4 -4
- package/dist/types-chunks/{guardrail.d-C_Siraua.d.ts → guardrail.d-Ds7JHxR1.d.ts} +1 -1
- package/dist/types-chunks/{guardrail.d-wk-s0psS.d.ts → guardrail.d-vSaBe64I.d.ts} +2 -2
- package/dist/types-chunks/{public-api.d-jtREVfEq.d.ts → public-api.d-CPBMPDiU.d.ts} +8 -2
- package/dist/types-chunks/{run-manager.d-CFknOfo1.d.ts → run-manager.d-lnwnfyNC.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-CLqyfAmf.d.ts → sdk-session-ByoMLoUS.d.ts} +3 -3
- package/dist/types-chunks/{process.d-CY2g03Mb.d.ts → types.d-DG9B4SMm.d.ts} +369 -4
- package/dist/types-chunks/{types.d-BMLxKV69.d.ts → types.d-DU9lLkmE.d.ts} +1 -1
- package/dist/types-chunks/{types.d-CUN_bZU7.d.ts → types.d-DYv3a1ka.d.ts} +2 -2
- package/dist/types-chunks/{utils.d-C1rpoeDh.d.ts → utils.d-DMI-9GTR.d.ts} +8 -4
- package/docs/SDK_EMBEDDER_GUIDE.md +3079 -0
- package/package.json +2 -1
- package/dist/chunks/argument-completer-HK3MHA3K.js +0 -2
- package/dist/chunks/chunk-3HKBBY74.js +0 -339
- package/dist/chunks/chunk-AKBH2EEE.js +0 -8
- package/dist/chunks/chunk-NBQW7PNZ.js +0 -18
- package/dist/chunks/chunk-TLJGOKBT.js +0 -729
- package/dist/chunks/chunk-WBBEJIAY.js +0 -306
- package/dist/chunks/dist-4YAYT2TO.js +0 -2
- package/dist/chunks/host-KG3456QP.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,114 @@ 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
|
-
## [Unreleased]
|
|
8
|
-
|
|
9
|
-
## [0.7.
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.7.67] - 2026-07-11
|
|
10
|
+
|
|
11
|
+
> Scope note: a stabilization and agent-efficiency release. **FEATURE_258**
|
|
12
|
+
> adds the protocol-neutral external-agent executor plane, **FEATURE_259**
|
|
13
|
+
> makes workflow/review orchestration more focused and cost-disciplined, and
|
|
14
|
+
> the bounded corrective **FEATURE_261** delivers searchable session resume
|
|
15
|
+
> plus safe ACP-session cleanup. GitHub source/binary release work is included;
|
|
16
|
+
> npm publication remains a separate operator step.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **External Agent Executor Plane and dispatchable catalog.** Host-injected
|
|
21
|
+
executors now share a protocol-neutral registration/catalog/task contract,
|
|
22
|
+
redacted policy-filtered discovery, durable task ledger, recovery, and a
|
|
23
|
+
reference executor. Worker tools, Workflow, Embedded Runtime, and daemon
|
|
24
|
+
clients discover and dispatch the same canonical agent IDs.
|
|
25
|
+
- **External-agent SDK and daemon surfaces.** Runtime sessions expose catalog,
|
|
26
|
+
start/continue/cancel/reconcile, event, and task-result operations with
|
|
27
|
+
versioned schemas, configuration revisions, credential-presence checks, and
|
|
28
|
+
public in-process daemon-factory bootstrap support.
|
|
29
|
+
- **Focused scoped-review workflow.** `/review --workflow` now uses immutable
|
|
30
|
+
review packets, one primary per scope, an additional authoritative primary
|
|
31
|
+
only for risk-flagged packets, batched fresh verification for candidate
|
|
32
|
+
findings, stable finding IDs, capable synthesis, and an audit artifact.
|
|
33
|
+
- **Explicit model-tier intent and route telemetry.** Workflow and substantive
|
|
34
|
+
child briefs carry focused scope/constraints/evidence/output fields plus
|
|
35
|
+
explicit `fast` / `balanced` / `deep` intent. Runtime reports the resolved
|
|
36
|
+
source, fallback, effort, usage, duration, packet-read topology, and token
|
|
37
|
+
coverage without fabricating missing external usage.
|
|
38
|
+
- **Searchable session resume picker.** Running `kodax -r` without an ID now
|
|
39
|
+
opens an interactive TUI with incremental search, keyboard selection, title
|
|
40
|
+
completion, pagination, and the full selected session ID. An explicit value
|
|
41
|
+
resolves a complete ID first, then a unique exact title; duplicate titles
|
|
42
|
+
open a narrowed picker rather than silently selecting one.
|
|
43
|
+
- **Session listing filters and cursors.** SessionManager, Runtime SDK, and
|
|
44
|
+
daemon protocol listings now accept an exact `surface` filter and an opaque
|
|
45
|
+
continuation `cursor`, applied before the requested page limit.
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- **Resident workflow context is smaller and discoverable.** The turn-resident
|
|
50
|
+
`run_workflow` hint stays below the deferred-tool budget while the full
|
|
51
|
+
authoring contract remains available through `tool_search`. Recorded
|
|
52
|
+
workflow-shaped plans start directly instead of being expanded into duplicate
|
|
53
|
+
todo/dispatch scaffolding.
|
|
54
|
+
- **Review handoffs are structured and conservative.** Positive observations
|
|
55
|
+
are not findings; missing evidence remains `not-verifiable` rather than being
|
|
56
|
+
promoted into a defect; unreasoned severity overrides retain the original
|
|
57
|
+
severity instead of failing the review.
|
|
58
|
+
- **Eval execution is value-driven and bounded.** Main-session evidence review
|
|
59
|
+
determines whether a candidate has material value over baseline; executor
|
|
60
|
+
aliases are not reused as judge models. Raw reuse, per-call/round/token/cost
|
|
61
|
+
caps, one bounded structured repair, and provider/model concurrency lanes
|
|
62
|
+
prevent runaway panels.
|
|
63
|
+
- **SDK embedder documentation matches the v0.7.67 public surface.** The guide
|
|
64
|
+
now covers external-agent owner/consumer setup and safety boundaries, Runtime
|
|
65
|
+
registration/catalog/task services, exact-surface session pagination,
|
|
66
|
+
run-scoped workflow tiers, live route facts, and durable efficiency reports;
|
|
67
|
+
the English/Chinese subpath tables reflect all 10 published SDK entries.
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- **Restricted Workflow scripts preserve the public Agent routing contract.**
|
|
72
|
+
`phase` and FEATURE_258 `target` values now cross the script host boundary
|
|
73
|
+
with fail-loud validation, so generated/saved workflows can route the same
|
|
74
|
+
canonical external Agent IDs as direct Workflow and Worker dispatch.
|
|
75
|
+
- **Executor-plane shutdown is terminal and waiter-safe.** Closing the plane is
|
|
76
|
+
idempotent, rejects pending task waits, and prevents later registration,
|
|
77
|
+
catalog, or task operations from recreating executors after owner shutdown.
|
|
78
|
+
- **Review/eval trust boundaries fail loudly without replacing real results.**
|
|
79
|
+
Built-in scoped-review outputs are validated against their declared schemas;
|
|
80
|
+
local ledger mirror failures retain the authoritative child result/error;
|
|
81
|
+
Feature 259 baseline reconstruction now requires every exact rewrite and no
|
|
82
|
+
longer leaks candidate-only briefing fields into the baseline.
|
|
83
|
+
- **Runtime tests no longer leave detached Node processes behind.** The config
|
|
84
|
+
suite explicitly shuts down its auto-started daemon owner before deleting
|
|
85
|
+
temporary state, and long-running process fixtures self-exit if an abnormal
|
|
86
|
+
test-runner termination prevents normal managed cleanup.
|
|
87
|
+
- **External tasks keep identity and terminal state across failures.** A remote
|
|
88
|
+
start followed by ledger failure preserves its executor reference as
|
|
89
|
+
`unknown`; in-flight tasks retain immutable executor bindings across catalog
|
|
90
|
+
updates; task-level mutation queues prevent late callbacks from overwriting a
|
|
91
|
+
terminal snapshot; Workflow external waits honor `timeoutMs`.
|
|
92
|
+
- **External task safety and policy boundaries fail closed.** Executor
|
|
93
|
+
availability, health, capability, concurrency, credential presence,
|
|
94
|
+
configuration revision, target side effects, and read-only intent are checked
|
|
95
|
+
before start without exposing secret values.
|
|
96
|
+
- **ACP tests no longer pollute real user sessions.** ACP harnesses now use an
|
|
97
|
+
isolated temporary runtime home and session store, with a guard that rejects
|
|
98
|
+
paths under the real user home. ACP sessions remain provisional until the
|
|
99
|
+
first valid prompt instead of persisting an empty `ACP Session` during
|
|
100
|
+
protocol setup.
|
|
101
|
+
- **Empty ACP pollution can be audited and recovered safely.**
|
|
102
|
+
`kodax -s cleanup-acp` previews only strict empty ACP matches; explicit
|
|
103
|
+
`--apply-session-cleanup` archives them reversibly instead of deleting data.
|
|
104
|
+
|
|
105
|
+
### Performance
|
|
106
|
+
|
|
107
|
+
- **Feature 259 controlled comparison validates the review optimization.** The
|
|
108
|
+
proposed topology passed 8/8 Layer-3 oracle cells versus 6/8 baseline, reduced
|
|
109
|
+
total model tokens 16.9% and output tokens 49.1%, and on standard reviews
|
|
110
|
+
reduced median tokens 57.2%, primary starts 75%, and duplicate packet reads
|
|
111
|
+
83.3%. High-risk multi-area reviews intentionally spend more calls for fresh
|
|
112
|
+
verification and explicit packet coverage.
|
|
113
|
+
|
|
114
|
+
## [0.7.66] - 2026-07-10
|
|
10
115
|
|
|
11
116
|
> Scope note: the runtime migration was developed across the v0.7.64-v0.7.66
|
|
12
117
|
> planning slots and is released as one v0.7.66 cut; v0.7.64 and v0.7.65 were
|
package/README.md
CHANGED
|
@@ -319,8 +319,14 @@ inline/Worker ownership, but only detaches one daemon client. Contradictory
|
|
|
319
319
|
isolation options fail instead of silently selecting a weaker mode. Worker
|
|
320
320
|
isolation is a V8 fault boundary, not a security sandbox.
|
|
321
321
|
|
|
322
|
+
Because a daemon is intentionally persistent, tests that auto-start one must
|
|
323
|
+
also run `kodax daemon stop --home <dir> --profile <name>` (or send authenticated
|
|
324
|
+
`runtime.shutdown`) before deleting their temporary home. A remaining Node
|
|
325
|
+
process is not safe to kill by name alone; verify its command line and owner.
|
|
326
|
+
|
|
322
327
|
```bash
|
|
323
328
|
kodax daemon start
|
|
329
|
+
kodax daemon stop --profile default
|
|
324
330
|
kodax --runtime-mode daemon
|
|
325
331
|
kodax -p "Review this repository" --runtime-mode daemon
|
|
326
332
|
```
|
|
@@ -454,14 +460,15 @@ KodaX has two layers that consumers should understand separately:
|
|
|
454
460
|
|
|
455
461
|
| Source package | npm subpath | Type | What you get | Example consumer |
|
|
456
462
|
|---|---|---|---|---|
|
|
457
|
-
| `packages/llm` | `@kodax-ai/kodax/llm` | Full package | 15-alias LLM abstraction (
|
|
458
|
-
| `packages/agent` | `@kodax-ai/kodax/agent` | Full package | Runner / fan-out / session-lineage / capabilities / tracing (
|
|
463
|
+
| `packages/llm` | `@kodax-ai/kodax/llm` | Full package | 15-alias LLM abstraction (108 exports) | Standalone LLM clients |
|
|
464
|
+
| `packages/agent` | `@kodax-ai/kodax/agent` | Full package | Runner / fan-out / external-agent plane / session-lineage / capabilities / tracing (331 exports) | Custom agent frameworks |
|
|
459
465
|
| `packages/agent` | `@kodax-ai/kodax/skills` | **Narrow subset** | Skills system only — `SkillRegistry` / `loadFullSkill` / `expandSkillForLLM` / ... (26 exports = pre-v0.7.43 `@kodax-ai/skills` complete API) | Skill loaders, IDE plugins |
|
|
460
|
-
| `packages/agent` | `@kodax-ai/kodax/mcp` | **Narrow subset** | MCP only — `McpCapabilityProvider` / `createMcpTransport` / `searchMcpCatalog` / ... (
|
|
461
|
-
| `packages/
|
|
462
|
-
| `packages/
|
|
463
|
-
| `packages/repl` | `@kodax-ai/kodax/
|
|
464
|
-
| `
|
|
466
|
+
| `packages/agent` | `@kodax-ai/kodax/mcp` | **Narrow subset** | MCP only — `McpCapabilityProvider` / `createMcpTransport` / `searchMcpCatalog` / ... (23 exports) | MCP server hosts |
|
|
467
|
+
| `packages/agent` | `@kodax-ai/kodax/media` | **Narrow subset** | Structured image/file/video input-artifact helpers (22 exports) | Desktop hosts and multimodal clients |
|
|
468
|
+
| `packages/coding` | `@kodax-ai/kodax/coding` | Full package | Coding agent + 50+ tools + repo-intelligence (505 exports) | Build a Claude Code-shape product |
|
|
469
|
+
| `packages/repl` | `@kodax-ai/kodax/repl` | Full package | Ink TUI + permission modes + commands (217 exports) | Terminal-UI consumers |
|
|
470
|
+
| `packages/repl` | `@kodax-ai/kodax/session` | **Narrow subset** | Session management only — `listSessions` / `loadFullTranscript` / `appendClientNotice` / `forkSession` / `compactSession` / `watchSessions` / ... (17 exports) | IDE plugins and desktop hosts reading session history |
|
|
471
|
+
| `src` | `@kodax-ai/kodax/runtime` | Host API | Embedded/Worker/daemon runtime facade, sessions/runs/events/permissions/catalog/MCP/artifacts/diagnostics/external agents, daemon protocol schema (10 exports) | SDK hosts, Space/IDE clients, daemon clients |
|
|
465
472
|
|
|
466
473
|
**Rule of thumb**: if you need Runner / Agent / fan-out, import from `/agent`. If you only need skills or mcp APIs, import from `/skills` or `/mcp` to get a smaller bundle. The narrow subsets are subsets of the full packages — they do **not** expose extra symbols.
|
|
467
474
|
|
|
@@ -479,6 +486,12 @@ KodaX has two layers that consumers should understand separately:
|
|
|
479
486
|
|
|
480
487
|
**Tool-Output Compression + Workflow Quality Preflight (FEATURE_251 + FEATURE_252, v0.7.61)**: KodaX's own `bash` tool now compresses noisy command output **inside the tool**, so a big `git diff`, test run, package install, or `docker build` no longer spends thousands of context tokens — command-aware filters (git/test/lint/JSON + a declarative package/docker/infra long-tail) summarize the stdout/stderr body while the `Command:`/`Exit:` header stays verbatim and every lossy summary keeps a raw-recovery path; isolated measurements show ~66–99% body-token reduction. Alongside it, inline `run_workflow` gains a deterministic pre-start quality lint that hard-fails weak-model authoring contract bugs (unawaited workflow-command used as a boolean, top-level access of `result.structured` fields, literal agent fanout above manifest/host caps) before a run starts. Both are deterministic (no prompt change). See [docs/features/v0.7.61.md](docs/features/v0.7.61.md) and [docs/ADR.md ADR-050](docs/ADR.md).
|
|
481
488
|
|
|
489
|
+
**External Agent SDK Plane (FEATURE_258, v0.7.67)**: `/agent` exports the protocol-neutral executor, registration, policy, credential-broker, artifact-policy, catalog, and durable task contracts. `/runtime` exposes the installed plane through `admin.agentRegistrations`, `agents`, and `agentTasks`, with the same DTO service methods over embedded and daemon clients. Executor factories are host functions: install them in an inline owner or while creating a new in-process daemon owner; they cannot be injected through an existing daemon connection or across a Runtime Worker boundary. Plane shutdown is terminal: pending waits and all later service calls reject. Restricted Workflow scripts preserve validated `phase` and external `target` routing. See the [complete owner/consumer recipes and safety contract](docs/SDK_EMBEDDER_GUIDE.md#18-external-agent-executor-plane-feature_258-v0767).
|
|
490
|
+
|
|
491
|
+
**Cost-Disciplined Workflow SDK (FEATURE_259, v0.7.67)**: SDK callers configure run-scoped `modelTiers` and `workflow.maxConcurrency`, while workflow authors express semantic `fast` / `balanced` / `deep` intent. Terminal workflow events expose resolved tier/source/fallback/usage/duration facts, and each durable `run.json` contains an `efficiencyReport` with token coverage, role/tier starts, packet-read topology, review waves, and quality-gate outcomes. See the [routing and telemetry contract](docs/SDK_EMBEDDER_GUIDE.md#20-cost-disciplined-workflow-routing-and-telemetry-feature_259-v0767).
|
|
492
|
+
|
|
493
|
+
**Paged Session Listing (FEATURE_261, v0.7.67)**: both `/session` `listSessions()` and `runtime.sessions.list()` accept an exact `surface` filter and opaque continuation `cursor`; each returned summary carries the cursor for the next page. Filtering happens before the page limit, so a host does not need to over-fetch mixed surfaces. See the [pagination recipes](docs/SDK_EMBEDDER_GUIDE.md#19-session-surface-filtering-and-cursor-pagination-feature_261-v0767).
|
|
494
|
+
|
|
482
495
|
---
|
|
483
496
|
|
|
484
497
|
## Features
|
|
@@ -588,6 +601,7 @@ For smaller surface and tree-shake-friendly imports, the SDK is also exposed via
|
|
|
588
601
|
import { Runner } from '@kodax-ai/kodax/agent'; // agent runtime
|
|
589
602
|
import { getProvider } from '@kodax-ai/kodax/llm'; // LLM abstraction (15 aliases)
|
|
590
603
|
import { runKodaX } from '@kodax-ai/kodax/coding'; // coding tools + prompts
|
|
604
|
+
import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifacts
|
|
591
605
|
import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
|
|
592
606
|
import { loadConfig } from '@kodax-ai/kodax/repl'; // REPL config / session helpers
|
|
593
607
|
import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
|
|
@@ -597,6 +611,11 @@ import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daem
|
|
|
597
611
|
|
|
598
612
|
All 10 SDK entries (root + 9 subpaths) share internal code via ESM chunk splitting — importing from `/agent` does not pull in `/repl`'s Ink + React surface.
|
|
599
613
|
|
|
614
|
+
For the complete host-facing contract — including embedded/Worker/daemon ownership,
|
|
615
|
+
external-agent registration and task control, session cursor pagination, workflow
|
|
616
|
+
model-tier routing, and efficiency telemetry — see the
|
|
617
|
+
[SDK Embedder Integration Guide](docs/SDK_EMBEDDER_GUIDE.md).
|
|
618
|
+
|
|
600
619
|
> **ESM-only.** The SDK is published as ES Modules. In a CommonJS context (Electron main process, legacy Webpack CJS bundles, `require()`-based code) you must use `await import(...)` instead of `require()`. See [docs/SDK_EMBEDDER_GUIDE.md §5](docs/SDK_EMBEDDER_GUIDE.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles) for the canonical recipe + the technical reason most subpaths cannot ship a dual ESM/CJS build.
|
|
601
620
|
|
|
602
621
|
For CLI users, provider defaults live in `~/.kodax/config.json`. For library users, API keys are still read from environment variables; if you need custom base URLs or provider aliases, use `registerCustomProviders()` as shown above.
|
|
@@ -653,10 +672,21 @@ kodax --session my-project "Summarize it"
|
|
|
653
672
|
kodax --session my-project "How should I fix the first issue?"
|
|
654
673
|
|
|
655
674
|
# Session management
|
|
656
|
-
kodax
|
|
657
|
-
kodax
|
|
675
|
+
kodax -r # Search, page, and select a non-empty session
|
|
676
|
+
kodax -r <session-id> # Resume a known session directly
|
|
677
|
+
kodax -r "Review runtime" # Resume a unique exact title; duplicates open the picker
|
|
678
|
+
kodax --session list # List up to 50 non-empty sessions
|
|
679
|
+
kodax --session cleanup-acp # Preview strictly matched empty ACP-test pollution
|
|
658
680
|
```
|
|
659
681
|
|
|
682
|
+
Bare `-r` opens an interactive picker with incremental search, arrow/PageUp/PageDown
|
|
683
|
+
navigation, Tab completion, full selected-session ID display, and Enter-to-resume.
|
|
684
|
+
An explicit value checks the complete session ID first, then an exact
|
|
685
|
+
case-insensitive title; duplicate titles open a narrowed picker instead of
|
|
686
|
+
silently choosing one. Cleanup is preview-only unless
|
|
687
|
+
`--apply-session-cleanup` is also provided; matching sessions are archived rather
|
|
688
|
+
than permanently deleted.
|
|
689
|
+
|
|
660
690
|
### Session Patterns
|
|
661
691
|
|
|
662
692
|
```bash
|
|
@@ -691,7 +721,7 @@ kodax Start the interactive REPL
|
|
|
691
721
|
-h, --help [topic] Show help or topic help
|
|
692
722
|
-p, --print <text> Run a single task and exit
|
|
693
723
|
-c, --continue Continue the most recent conversation in this directory
|
|
694
|
-
-r, --resume [
|
|
724
|
+
-r, --resume [value] Resume by ID/exact title, or open the searchable picker
|
|
695
725
|
-m, --provider Provider to use
|
|
696
726
|
--model <name> Override the model
|
|
697
727
|
--reasoning <mode> off | auto | quick | balanced | deep
|
package/README_CN.md
CHANGED
|
@@ -213,9 +213,12 @@ import { SkillRegistry } from '@kodax-ai/kodax/skills'; // 零依赖 ski
|
|
|
213
213
|
import { loadConfig } from '@kodax-ai/kodax/repl'; // REPL 配置 / session 工具
|
|
214
214
|
import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager(v0.7.42 起)
|
|
215
215
|
import { listSessions } from '@kodax-ai/kodax/session'; // session 历史工具
|
|
216
|
+
import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/Worker/daemon 宿主 API
|
|
216
217
|
```
|
|
217
218
|
|
|
218
|
-
|
|
219
|
+
10 个 SDK 入口(root + 9 subpath)通过 ESM 共享 chunk 复用底层代码 —— 只 import `/agent` 不会把 `/repl` 的 Ink + React 一起拉进来。
|
|
220
|
+
|
|
221
|
+
完整的宿主集成契约——包括 embedded/Worker/daemon 所有权、外部 Agent 注册与任务控制、session cursor 分页、workflow 模型分层和效率遥测——见 [SDK Embedder Integration Guide](docs/SDK_EMBEDDER_GUIDE.md)。
|
|
219
222
|
|
|
220
223
|
> **SDK 是 ESM-only**。在 CommonJS 上下文(Electron main 进程、传统 Webpack CJS bundle、`require()` 调用方)必须用 `await import('@kodax-ai/kodax/...')` 代替 `require()`。详见 [docs/SDK_EMBEDDER_GUIDE.md §5](docs/SDK_EMBEDDER_GUIDE.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles),含 Electron main 完整 recipe + 为什么大多数 subpath 物理上无法做 dual ESM/CJS bundle。
|
|
221
224
|
|
|
@@ -366,8 +369,13 @@ daemon 形态使用独立进程并允许多个客户端共享。`runtime.close()
|
|
|
366
369
|
私有 inline/Worker Runtime,但对 daemon 只断开当前客户端。矛盾的隔离参数
|
|
367
370
|
会直接报错,不会静默降级。Worker 是 V8 故障隔离边界,不是安全沙箱。
|
|
368
371
|
|
|
372
|
+
daemon 按设计会持续驻留。测试若自动启动 daemon,删除临时 home 前还必须执行
|
|
373
|
+
`kodax daemon stop --home <目录> --profile <名称>`(或发送已认证的
|
|
374
|
+
`runtime.shutdown`)。不要按进程名批量结束 Node;应先核验命令行和父进程归属。
|
|
375
|
+
|
|
369
376
|
```bash
|
|
370
377
|
kodax daemon start
|
|
378
|
+
kodax daemon stop --profile default
|
|
371
379
|
kodax --runtime-mode daemon
|
|
372
380
|
kodax -p "检查这个仓库" --runtime-mode daemon
|
|
373
381
|
```
|
|
@@ -543,13 +551,15 @@ KodaX 有两层结构,SDK 用户需要分开理解:
|
|
|
543
551
|
|
|
544
552
|
| 源码包 | npm subpath | 类型 | 内容 | 典型消费者 |
|
|
545
553
|
|---|---|---|---|---|
|
|
546
|
-
| `packages/llm` | `@kodax-ai/kodax/llm` | 完整包 | 15-alias LLM 抽象 (
|
|
547
|
-
| `packages/agent` | `@kodax-ai/kodax/agent` | 完整包 | Runner / fan-out / session-lineage / capabilities / tracing (
|
|
554
|
+
| `packages/llm` | `@kodax-ai/kodax/llm` | 完整包 | 15-alias LLM 抽象 (108 exports) | 独立 LLM 客户端 |
|
|
555
|
+
| `packages/agent` | `@kodax-ai/kodax/agent` | 完整包 | Runner / fan-out / 外部 Agent plane / session-lineage / capabilities / tracing (331 exports) | 自定义 agent 框架 |
|
|
548
556
|
| `packages/agent` | `@kodax-ai/kodax/skills` | **窄子集** | 仅 Skills 系统 —— `SkillRegistry` / `loadFullSkill` / `expandSkillForLLM` 等 (26 exports = v0.7.43 之前 `@kodax-ai/skills` 完整 API) | Skill 加载器、IDE 插件 |
|
|
549
|
-
| `packages/agent` | `@kodax-ai/kodax/mcp` | **窄子集** | 仅 MCP —— `McpCapabilityProvider` / `createMcpTransport` / `searchMcpCatalog` 等 (
|
|
550
|
-
| `packages/
|
|
551
|
-
| `packages/
|
|
552
|
-
| `packages/repl` | `@kodax-ai/kodax/
|
|
557
|
+
| `packages/agent` | `@kodax-ai/kodax/mcp` | **窄子集** | 仅 MCP —— `McpCapabilityProvider` / `createMcpTransport` / `searchMcpCatalog` 等 (23 exports) | MCP server 宿主 |
|
|
558
|
+
| `packages/agent` | `@kodax-ai/kodax/media` | **窄子集** | 结构化图片/文件/视频输入 artifact helpers (22 exports) | 桌面宿主、多模态客户端 |
|
|
559
|
+
| `packages/coding` | `@kodax-ai/kodax/coding` | 完整包 | Coding agent + 50+ 工具 + repo-intelligence (505 exports) | 构建 Claude Code 形态产品 |
|
|
560
|
+
| `packages/repl` | `@kodax-ai/kodax/repl` | 完整包 | Ink TUI + 权限模式 + 命令系统 (217 exports) | 终端 UI 消费者 |
|
|
561
|
+
| `packages/repl` | `@kodax-ai/kodax/session` | **窄子集** | 仅会话管理 —— `listSessions` / `loadFullTranscript` / `appendClientNotice` / `forkSession` / `compactSession` / `watchSessions` 等 (17 exports) | 读取 session 历史的 IDE 插件和桌面宿主 |
|
|
562
|
+
| `src` | `@kodax-ai/kodax/runtime` | 宿主 API | Embedded/Worker/daemon facade,含 sessions/runs/events/permissions/catalog/MCP/artifacts/diagnostics/外部 Agent 和 daemon schema (10 exports) | SDK 宿主、Space/IDE、daemon client |
|
|
553
563
|
|
|
554
564
|
**经验法则**:需要 Runner / Agent / fan-out 时从 `/agent` 引入;只需要 skills 或 mcp API 时从 `/skills` 或 `/mcp` 引入,bundle 更小。窄子集是完整包的真子集 —— **不会**有额外符号。
|
|
555
565
|
|
|
@@ -557,6 +567,12 @@ KodaX 有两层结构,SDK 用户需要分开理解:
|
|
|
557
567
|
|
|
558
568
|
**宿主读持久化历史(FEATURE_230 + FEATURE_234,v0.7.51;v0.7.63 hardening)**:面向「宿主读持久化状态」的 additive 闭环。**持久化工具记录回放**——resume 的会话现在会回放助手用过的工具卡片,而不是退化成纯文本。`messages` / `lineage` 仍是 canonical;`SessionData.uiHistory` 成为有界、脱敏、仅 terminal 状态的回放缓存。SDK transcript 契约明确化:`loadSession()` = 活动 model context,`loadFullTranscript()` = 带结构化条目的追加序 host scrollback(`message` / `compaction` / `branch_summary` / `rewind_marker` / `client_notice` / `task_result`)并带 clone provenance(`logicalId` / `sourceEntryId`),`uiHistory` = 可选回放缓存,工具卡片始终可从 canonical messages 重建。宿主可用 `appendClientNotice()` 持久化本地 slash 输出且不进入模型上下文;workflow/child 完成结果通过结构化 `taskResults[]` 暴露,不再要求解析 `<task-completed>` 文本。`rewind_marker` 只用于 host scrollback 审计,不进入 model-context messages。**Workflow run 宿主归属**——`WorkflowProcessTrackerOptions` / `WorkflowProcessSnapshot` 新增 host-owned 不透明 `hostMetadata?: Record<string, string>`,SDK 存储、持久化进 `run.json`、回读回显(含进程重启后)但不解释其含义,让宿主零侧表把 run 归回发起它的 session/surface。未 stamp 的旧 run 诚实回显 `hostMetadata === undefined`。详见 [docs/features/v0.7.51.md](docs/features/v0.7.51.md)。
|
|
559
569
|
|
|
570
|
+
**会话恢复与 ACP 污染修复(FEATURE_261,v0.7.67)**:直接运行 `kodax -r` 会进入可搜索、上下选择、Tab 补全和翻页的交互式会话选择器,并显示当前选中项的完整 session ID;`kodax -r <值>` 优先按完整 ID 恢复,ID 不存在时再按忽略大小写的完整标题匹配。标题唯一则直接恢复,同名标题则进入只包含候选项的选择器,绝不静默选第一条。`listSessions()` / Runtime / daemon 会话列表新增 `surface` 精确过滤和不透明 `cursor` 分页。ACP session 改为收到首个有效 prompt 后才持久化,ACP 测试强制使用临时 runtime home,避免测试记录写入真实 `~/.kodax/sessions`。`kodax -s cleanup-acp` 只预览严格匹配的空 ACP 污染记录;仅显式追加 `--apply-session-cleanup` 时才归档,不做永久删除。
|
|
571
|
+
|
|
572
|
+
**外部 Agent SDK plane(FEATURE_258,v0.7.67)**:`/agent` 导出协议中立的 executor、registration、policy、credential broker、artifact policy、catalog 和 durable task 契约;`/runtime` 通过 `admin.agentRegistrations`、`agents`、`agentTasks` 向 embedded 与 daemon client 提供同一组 DTO API。Executor factory 是宿主函数,只能装入 inline owner,或在创建新的 in-process daemon owner 时装入;不能通过既有 daemon 连接或 Runtime Worker 边界注入。Plane 关闭后是终态:未完成的 wait 和后续所有服务调用都会拒绝;受限 Workflow 脚本会完整校验并传递 `phase` 与外部 `target`。完整所有权、注册、preflight、启动/等待/继续/取消/对账和安全边界见 [SDK Embedder Guide §18](docs/SDK_EMBEDDER_GUIDE.md#18-external-agent-executor-plane-feature_258-v0767)。
|
|
573
|
+
|
|
574
|
+
**成本受控 Workflow SDK(FEATURE_259,v0.7.67)**:SDK 调用方用 run-scoped `modelTiers` 与 `workflow.maxConcurrency` 配置路由和并发,workflow 作者只表达 `fast` / `balanced` / `deep` 语义意图。terminal workflow event 回显 tier/source/fallback/usage/duration,持久化 `run.json.efficiencyReport` 给出 token coverage、role/tier 启动数、packet-read 拓扑、review wave 和 quality gate 结果。完整配置与遥测读取方式见 [SDK Embedder Guide §20](docs/SDK_EMBEDDER_GUIDE.md#20-cost-disciplined-workflow-routing-and-telemetry-feature_259-v0767)。
|
|
575
|
+
|
|
560
576
|
**Inline workflow authoring(FEATURE_246,v0.7.58)**:AMA/AMAW 下 Worker 现在可通过 model-callable 的 `run_workflow` 工具在会话内直接编写并运行工作流——先用自己的工具 scout 代码库,再把具体发现烤进每个 child prompt,然后走**不变的** sandbox + 静态校验 + postcondition 验证流水线。它取代 context-blind 的 `sideQuery` generator 成为主交互路径(generator 仅作为显式 `/workflow create` 命令与无 investigating Worker 的 non-interactive/CI 主机的 fallback 保留);新增结构化 child 输出(`outputSchema`)、无 barrier 的 `wf.pipeline` 分阶段原语、同会话 resume(`resumeFromRunId`)、嵌套 `wf.workflow(...)`,`/workflow create` 重定向到 Worker 的 scout-then-author;`run_workflow` 为 async / idle-yield,不阻塞当前轮。中立的 run-lifecycle manager(`createWorkflowRunManager`)已移入 `@kodax-ai/kodax/agent` 供非 coding SDK 宿主使用。详见 [docs/features/v0.7.58.md](docs/features/v0.7.58.md) 与 [docs/ADR.md](docs/ADR.md) ADR-044/046/047/048/049。
|
|
561
577
|
|
|
562
578
|
**工作流激活分层(FEATURE_248 + FEATURE_249,v0.7.59)**:三种 agent 模式现在有一致的工作流姿态。**AMAW** 携带 mode-level 的 `ORCHESTRATION DEFAULT` 常驻指令(对齐参考实现的 "ultracode" 姿态):实质性工作——多文件调查、设计决策、任何做错代价高的任务——默认编排多个交叉验证的 agent,并有 PLAN-TIME COMMITMENT 流程修正把 orchestrate-vs-solo 决策前置到第 0 轮。**AMA** 同样 host `run_workflow` 工具但没有常驻指令——当你用自然语言请求编排时才激活,绝不因复杂度独自触发。**SA** 保持单独作业。该指令通过 `amawOrchestrationAvailable` 关闭泄漏,因此 AMA 与 SA 的 prompt 保持逐字节一致。详见 [docs/features/v0.7.59.md](docs/features/v0.7.59.md)。
|
|
@@ -580,9 +596,9 @@ KodaX/ # 4 workspace packages(FEATURE_194 v0.7.43)
|
|
|
580
596
|
│ └── repl/ # @kodax-ai/repl —— Ink TUI
|
|
581
597
|
├── src/
|
|
582
598
|
│ ├── kodax_cli.ts # CLI 主入口(bin: `kodax`)
|
|
583
|
-
│ └── sdk-*.ts # SDK subpath 入口 → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session}
|
|
599
|
+
│ └── sdk-*.ts # SDK subpath 入口 → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session,runtime}
|
|
584
600
|
├── scripts/
|
|
585
|
-
│ ├── build-bundle.mjs # esbuild 单 bundle 多 entry 打包(CLI + root +
|
|
601
|
+
│ ├── build-bundle.mjs # esbuild 单 bundle 多 entry 打包(CLI + root + 9 SDK subpath + chunks)
|
|
586
602
|
│ ├── build-binary.mjs # Bun --compile 单文件二进制打包
|
|
587
603
|
│ └── release.mjs # ADR-024 release-time pkg name/exports 注入
|
|
588
604
|
└── .github/workflows/
|
|
@@ -676,6 +692,7 @@ KodaX 现在会把 Repo Intelligence 的本地缓存分成内置引擎 profile
|
|
|
676
692
|
## 文档
|
|
677
693
|
|
|
678
694
|
- [README.md](README.md) - 英文版 README
|
|
695
|
+
- [docs/SDK_EMBEDDER_GUIDE.md](docs/SDK_EMBEDDER_GUIDE.md) - SDK 宿主集成与 v0.7.67 公共 API 契约
|
|
679
696
|
- [docs/release.md](docs/release.md) - 单文件二进制构建与发布流程
|
|
680
697
|
- [docs/PRD.md](docs/PRD.md) - 产品需求
|
|
681
698
|
- [docs/ADR.md](docs/ADR.md) - 架构决策
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{I as c,J as d,K as e,L as f,Z as g,_ as h,ra as i,za as j}from"./chunk-
|
|
2
|
+
import{I as c,J as d,K as e,L as f,Z as g,_ as h,ra as i,za as j}from"./chunk-RS2GAABJ.js";import"./chunk-D6QVXQNI.js";import"./chunk-YRBNXFHY.js";import"./chunk-YH5BTUQO.js";import"./chunk-O7N22GJ3.js";import{rb as a,sb as b}from"./chunk-NVDK375I.js";import"./chunk-PZTG2C33.js";import"./chunk-ONUPGMER.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{Ba as a,Ca as b}from"./chunk-EN3O2C43.js";import"./chunk-AKMXJSGM.js";import"./chunk-CW32NQFO.js";import"./chunk-WCSSXBHR.js";import"./chunk-DEICMTHO.js";import"./chunk-KBBGDRER.js";import"./chunk-RS2GAABJ.js";import"./chunk-D6QVXQNI.js";import"./chunk-YRBNXFHY.js";import"./chunk-YH5BTUQO.js";import"./chunk-O7N22GJ3.js";import"./chunk-NVDK375I.js";import"./chunk-PZTG2C33.js";import"./chunk-ONUPGMER.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{w as q,y as J}from"./chunk-MHRN2LQV.js";import{C as k,D as X,E as R,Ja as B,Na as z,ja as F,ka as j,la as G,ma as U,n as K,na as V,oa as A,va as $,wa as E,z as x,za as I}from"./chunk-O7N22GJ3.js";import{Ea as H,ya as W}from"./chunk-TLJGOKBT.js";import{a as o}from"./chunk-ONUPGMER.js";import c from"fs";import f from"path";import{exec as ce,spawnSync as le}from"child_process";import{promisify as ue}from"util";import{fileURLToPath as fe}from"url";var L="en";function ae(){return(process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"").toLowerCase().startsWith("zh")?"zh":"en"}o(ae,"detectSystemLocale");function Q(e){if(!e||e==="auto"){L=ae();return}L=e.toLowerCase().replace(/[-_].*/,"")==="zh"?"zh":"en"}o(Q,"setLocale");var Y={en:{"dialog.confirm":"[Confirm]","dialog.select":"[Select]","dialog.input":"[Input]","confirm.instruction.basic":"Press (y) yes, (n) no","confirm.instruction.always":"Press (y) yes, (a) always yes for this tool, (n) no","confirm.instruction.protected":"Press (y) to confirm, (n) to cancel (protected path)","confirm.result.approved":"Approved","confirm.result.approved_always":"Approved (always)","confirm.result.denied":"Denied","tool.bash.title":"Execute bash command?","tool.shell.title":"Execute shell command?","tool.write.title":"Write to file?","tool.edit.title":"Edit file?","tool.generic.title":"Execute {tool}?","field.reason":"Reason","field.intent":"Intent","field.target":"Target","field.scope":"Scope","field.risk":"Risk","field.summary":"Summary","intent.read":"Read project files","intent.delete":"Delete files","intent.deps":"Modify dependencies or environment","intent.modify":"Modify files","intent.execute":"Execute command","intent.write_file":"Write file","intent.edit_file":"Edit file","intent.use_tool":"Use {tool}","risk.destructive":"Destructive change","risk.deps":"May change dependencies or local tools","risk.modify":"May modify files","risk.unknown":"Command effects depend on its arguments","risk.network":"May access network","scope.outside":"Outside project","scope.protected":"Protected path","waiting.confirm":"Waiting: approval required","waiting.select":"Waiting: choose an option","waiting.input":"Waiting: answer the prompt","placeholder.confirm":"Respond to the approval prompt above...","placeholder.select":"Choose an option above...","placeholder.input":"Answer the prompt above...","placeholder.busy":"Agent is busy...","placeholder.queue":"Queue a follow-up for the next round...","placeholder.idle":"Type a message...","select.choice":"Choice:","select.type_number":"(type a number)","select.more":"{count} more choices...","select.more_above":"\u2191 {count} more above","select.more_below":"\u2193 {count} more below","select.confirm_hint":"Press Enter to confirm, Esc to cancel","select.navigate_hint":"Use \u2191\u2193 to navigate, Enter to confirm, Esc to cancel","select.multiselect_hint":"Use \u2191\u2193 to navigate, Space to toggle, Enter to confirm, Esc to cancel","select.multiselect_empty":"Select at least one option with Space before confirming.","select.multiselect_min":"Select at least {min} option(s) with Space before confirming.","select.multiselect_max":"Select at most {max} option(s) with Space before confirming.","select.back_prev":"\u2190 Back to previous question","input.default":"Default:","input.value":"Value:","input.type_response":"(type your response)","managed.completed":"Task completed","managed.completed.blocked":"Task blocked","managed.completed.continuation":"Task needs continuation",cancelled:"[Cancelled] Operation cancelled by user"},zh:{"dialog.confirm":"[\u786E\u8BA4]","dialog.select":"[\u9009\u62E9]","dialog.input":"[\u8F93\u5165]","confirm.instruction.basic":"\u6309 (y) \u786E\u8BA4, (n) \u62D2\u7EDD","confirm.instruction.always":"\u6309 (y) \u786E\u8BA4, (a) \u59CB\u7EC8\u5141\u8BB8\u6B64\u5DE5\u5177, (n) \u62D2\u7EDD","confirm.instruction.protected":"\u6309 (y) \u786E\u8BA4, (n) \u53D6\u6D88 (\u53D7\u4FDD\u62A4\u8DEF\u5F84)","confirm.result.approved":"\u5DF2\u6279\u51C6","confirm.result.approved_always":"\u5DF2\u6279\u51C6 (\u59CB\u7EC8\u5141\u8BB8)","confirm.result.denied":"\u5DF2\u62D2\u7EDD","tool.bash.title":"\u6267\u884C bash \u547D\u4EE4\uFF1F","tool.shell.title":"\u6267\u884C shell \u547D\u4EE4\uFF1F","tool.write.title":"\u5199\u5165\u6587\u4EF6\uFF1F","tool.edit.title":"\u7F16\u8F91\u6587\u4EF6\uFF1F","tool.generic.title":"\u6267\u884C {tool}\uFF1F","field.reason":"\u539F\u56E0","field.intent":"\u610F\u56FE","field.target":"\u76EE\u6807","field.scope":"\u8303\u56F4","field.risk":"\u98CE\u9669","field.summary":"\u6458\u8981","intent.read":"\u8BFB\u53D6\u9879\u76EE\u6587\u4EF6","intent.delete":"\u5220\u9664\u6587\u4EF6","intent.deps":"\u4FEE\u6539\u4F9D\u8D56\u6216\u73AF\u5883","intent.modify":"\u4FEE\u6539\u6587\u4EF6","intent.execute":"\u6267\u884C\u547D\u4EE4","intent.write_file":"\u5199\u5165\u6587\u4EF6","intent.edit_file":"\u7F16\u8F91\u6587\u4EF6","intent.use_tool":"\u4F7F\u7528 {tool}","risk.destructive":"\u7834\u574F\u6027\u53D8\u66F4","risk.deps":"\u53EF\u80FD\u4FEE\u6539\u4F9D\u8D56\u6216\u672C\u5730\u5DE5\u5177","risk.modify":"\u53EF\u80FD\u4FEE\u6539\u6587\u4EF6","risk.unknown":"\u547D\u4EE4\u6548\u679C\u53D6\u51B3\u4E8E\u53C2\u6570","risk.network":"\u53EF\u80FD\u8BBF\u95EE\u7F51\u7EDC","scope.outside":"\u9879\u76EE\u5916\u90E8","scope.protected":"\u53D7\u4FDD\u62A4\u8DEF\u5F84","waiting.confirm":"\u7B49\u5F85\u4E2D\uFF1A\u9700\u8981\u5BA1\u6279","waiting.select":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u9009\u62E9","waiting.input":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u56DE\u7B54","placeholder.confirm":"\u8BF7\u56DE\u5E94\u4E0A\u65B9\u7684\u5BA1\u6279\u63D0\u793A...","placeholder.select":"\u8BF7\u5728\u4E0A\u65B9\u9009\u62E9\u4E00\u4E2A\u9009\u9879...","placeholder.input":"\u8BF7\u56DE\u7B54\u4E0A\u65B9\u7684\u63D0\u793A...","placeholder.busy":"\u667A\u80FD\u4F53\u6B63\u5728\u5DE5\u4F5C\u4E2D...","placeholder.queue":"\u6392\u961F\u7B49\u5F85\u4E0B\u4E00\u8F6E\u8DDF\u8FDB...","placeholder.idle":"\u8F93\u5165\u6D88\u606F...","select.choice":"\u9009\u9879\uFF1A","select.type_number":"(\u8F93\u5165\u7F16\u53F7)","select.more":"\u8FD8\u6709 {count} \u4E2A\u9009\u9879...","select.more_above":"\u2191 \u4E0A\u65B9\u8FD8\u6709 {count} \u4E2A","select.more_below":"\u2193 \u4E0B\u65B9\u8FD8\u6709 {count} \u4E2A","select.confirm_hint":"\u6309 Enter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.navigate_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0C\u7A7A\u683C \u5207\u6362\u9009\u4E2D\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_empty":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u9009\u9879\u3002","select.multiselect_min":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u81F3\u5C11\u9009\u62E9 {min} \u4E2A\u9009\u9879\u3002","select.multiselect_max":"\u6700\u591A\u53EA\u80FD\u9009\u62E9 {max} \u4E2A\u9009\u9879\u3002","select.back_prev":"\u2190 \u8FD4\u56DE\u4E0A\u4E00\u9898","input.default":"\u9ED8\u8BA4\u503C\uFF1A","input.value":"\u503C\uFF1A","input.type_response":"(\u8F93\u5165\u4F60\u7684\u56DE\u7B54)","managed.completed":"\u4EFB\u52A1\u5B8C\u6210","managed.completed.blocked":"\u4EFB\u52A1\u53D7\u963B","managed.completed.continuation":"\u4EFB\u52A1\u9700\u8981\u7EE7\u7EED",cancelled:"[\u5DF2\u53D6\u6D88] \u64CD\u4F5C\u5DF2\u88AB\u7528\u6237\u53D6\u6D88"}};function Ne(e,t){let r=Y[L][e]??Y.en[e]??e;if(t)for(let[i,s]of Object.entries(t))r=r.replace(`{${i}}`,String(s));return r}o(Ne,"t");var de=ue(ce),S=W(),He=f.join(S,"sessions"),d=f.join(S,"config.json"),qe=60,p=null,D=!1,pe="dumb";function me(e){let t=f.basename(e).toLowerCase(),n="__KODAX_SHELL_ENV_START__",r=`printf '%s\\0' '${n}'; env -0`;return t==="fish"?{args:["-i","-c",r],sentinel:n}:{args:t==="bash"||t==="zsh"?["-ic",r]:["-lc",r],sentinel:n}}o(me,"buildShellEnvCommand");function ge(e,t){let n=`${t}\0`,r=e.lastIndexOf(n);if(r===-1)return{};let i=e.slice(r+n.length),s={};for(let a of i.split("\0")){if(!a)continue;let u=a.indexOf("=");u<=0||(s[a.slice(0,u)]=a.slice(u+1))}return s}o(ge,"parseNullDelimitedShellEnv");function ve(e={}){let t=e.env??process.env;if((e.platform??process.platform)==="win32"||t.KODAX_DISABLE_SHELL_ENV_HYDRATION==="1")return!1;let r=e.shell??t.SHELL;if(!r||!f.isAbsolute(r))return!1;let{args:i,sentinel:s}=me(r),a=e.run??le,u={...t,TERM:pe},l=a(r,i,{encoding:"utf8",env:u,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(l.status!==0||!l.stdout)return!1;let re=typeof l.stdout=="string"?l.stdout:l.stdout.toString("utf8"),ie=ge(re,s),N=!1;for(let[C,se]of Object.entries(ie))C!=="TERM"&&t[C]===void 0&&(t[C]=se,N=!0);return N}o(ve,"hydrateProcessEnvFromShell");function he(){if(!D){D=!0;try{ve()}catch{}}}o(he,"ensureShellEnvironmentHydrated");function Je(){D=!1}o(Je,"resetShellEnvironmentHydrationForTesting");function ye(e){$(e.customProviders??[])}o(ye,"registerConfiguredCustomProviders");function te(e){if(!Array.isArray(e))return;let t=e.filter(n=>typeof n=="string").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:[]}o(te,"normalizeConfiguredExtensions");function Ee(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{c.mkdirSync(f.dirname(d),{recursive:!0}),c.writeFileSync(d,JSON.stringify(t,null,2))}catch{}return t}o(Ee,"migrateLegacyPermissionModeInConfig");function Pe(e){if(e.permissionMode!=="auto-in-project")return e;try{let t=c.readFileSync(d,"utf-8"),n=t.replace(/("permissionMode"\s*:\s*)"auto-in-project"/,'$1"auto"');n!==t&&c.writeFileSync(d,n)}catch{}return{...e,permissionMode:"auto"}}o(Pe,"migrateAutoInProjectAliasInConfig");function be(){if(p)return p;let e="0.7.66";if(e)return p=e,p;let t=f.join(f.dirname(fe(import.meta.url)),"../../package.json");if(c.existsSync(t))try{return p=JSON.parse(c.readFileSync(t,"utf-8")).version??"0.0.0",p??"0.0.0"}catch{}return p="0.0.0",p}o(be,"getVersion");var Ye=be();function _e(e){return j(e)}o(_e,"getProviderModel");function T(e,t){let n=new Set(e.map(i=>i.toLowerCase())),r=[...e];for(let i of t)n.has(i.toLowerCase())||r.push(i);return r}o(T,"mergeModels");function Se(e,t){t||(t=w().providerModels);let n=t?.[e];if(n&&n.length>0){try{let r=A(e);if(r.length>0)return T(n,r)}catch{}try{let r=E(e);if(r)return T(n,r.getAvailableModels())}catch{}return n}try{let r=A(e);if(r.length>0)return r}catch{}try{let r=E(e);if(r)return r.getAvailableModels()}catch{}return[]}o(Se,"getProviderAvailableModels");function Oe(e,t){let n=G(e,t);if(n!=="unknown")return n;try{let r=E(e);if(r)return r.getReasoningCapability(t)}catch{}return"unknown"}o(Oe,"getProviderReasoningCapability");function we(e){let t=U(e);if(t)return t;try{return I().find(r=>r.name===e)?.capabilityProfile??null}catch{return null}}o(we,"getProviderCapabilityProfile");function ne(e,t){let n=we(e),r=Oe(e,t);if(n)return{capabilityProfile:n,reasoningCapability:r};try{let i=B(e);return{capabilityProfile:i.getCapabilityProfile(),reasoningCapability:i.getReasoningCapability(t)}}catch{return null}}o(ne,"getProviderCapabilityMetadata");function Qe(e,t){let n=ne(e,t);return n?q({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}o(Qe,"getProviderCapabilitySnapshot");function Ce(e,t,n,r){let i=ne(e,t);return i?J({providerName:e,model:t,capabilityProfile:i.capabilityProfile,reasoningCapability:i.reasoningCapability==="unknown"?void 0:i.reasoningCapability,reasoningMode:n,hints:r}):null}o(Ce,"getProviderPolicyDecision");function Ze(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"forwards only the latest user message":"preserves full conversation history",r=e.mcpSupport==="native"?"MCP available":"MCP unavailable";return`${t}; ${n}; ${r}`}o(Ze,"describeProviderCapabilitySummary");function et(e){switch(e){case"native-budget":return"B";case"native-effort":return"E";case"native-toggle":return"T";case"native-adaptive":return"A";default:return"-"}}o(et,"formatReasoningCapabilityShort");function y(e){if(e)return e==="none"?"off":e}o(y,"formatReasoningEffortForDisplay");function _(e,t){let n=y(t);n&&!e.includes(n)&&e.push(n)}o(_,"pushUniqueEffortDisplay");function tt(e,t){let n=["auto"],i=O(e,t)?.supportedEfforts?.filter(s=>s.isUserVisible!==!1);if(!i||i.length===0){for(let s of["off","low","medium","high"])_(n,s);return n}for(let s of i)_(n,s.value);return n}o(tt,"getProviderReasoningEffortOptions");function nt(e,t){let n=O(e,t),r=new Set(n?.disabledEfforts??[]),i=n?.supportedEfforts?.filter(l=>l.isUserVisible!==!1),s=[],a=n?.supportsDisabledThinking===!0;if(!i||i.length===0){for(let l of["low","medium","high"])_(s,l);a=!0}else for(let l of i){if(l.value==="none"){a=!0;continue}if(r.has(l.value)){a=!0;continue}_(s,l.value)}let u=[];return a&&u.push("off"),u.push(...s),u.push("auto"),u}o(nt,"getProviderReasoningEffortCycle");function xe(e,t){if(t===!1)return"off";switch(e){case"off":return"off";case"quick":return"low";case"balanced":return"medium";case"deep":return"high";default:return"auto"}}o(xe,"legacyReasoningModeToEffortDisplay");function O(e,t){let n=t??_e(e);if(!n)return;let r=z(e,n)?.reasoningProfile;if(r)return K(r,H(e,n))}o(O,"resolveReasoningProfileForDisplay");function ot(e){let t=y(e.effort)??xe(e.reasoningMode,e.thinking),n=O(e.provider,e.model);if(!n)return t;try{let r=X({capability:n,explicitEffort:e.effortOverride?e.effort:void 0,sessionEffort:e.effortOverride?void 0:e.effort,legacyReasoningMode:e.reasoningMode,thinking:e.thinking}),i=y(r.configuredEffort)??t,a=r.configuredEffort!==void 0&&n.disabledEfforts?.includes(r.configuredEffort)===!0?"off":y(r.effectiveEffort);return a&&a!==i?`${i}->${a}`:i}catch{if(e.effort)try{let r=R({currentEffort:e.effort,capability:n}),i=y(e.effort)??t,s=y(r.effectiveEffort);return s&&s!==i?`${i}->${s}`:i}catch{return t}return t}}o(ot,"formatReasoningEffortStatusLabel");function rt(e){let t=De(e);if(!t)return{preserved:!0};let n=O(e.provider,e.model);if(!n)return{configuredEffort:t,runtimeEffort:t,preserved:!0};let r=R({currentEffort:t,capability:n});return{configuredEffort:t,runtimeEffort:r.effectiveEffort,preserved:r.preserved,diagnostic:r.diagnostic}}o(rt,"resolveProviderReasoningRuntimeEffort");function ke(e){switch(e){case"native-budget":return"budget";case"native-effort":return"effort";case"native-toggle":return"toggle";case"native-adaptive":return"adaptive";default:return"none"}}o(ke,"describeReasoningCapabilityControl");function it(e,t){if(e==="off")return"Reasoning disabled";switch(t){case"native-budget":return"Uses native thinking budget control";case"native-effort":return"Uses native reasoning effort control";case"native-toggle":return"Uses provider-native thinking toggle only";case"native-adaptive":return"Model adaptively decides thinking depth (Opus 4.7+)";case"none":return"Runs without native reasoning parameters";case"prompt-only":return"Uses prompt overlays only; no native reasoning parameter";default:return"Runs without native reasoning parameters"}}o(it,"describeReasoningExecution");function st(e){let t=[];e||(e=w().providerModels);for(let n of V())t.push({name:n.name,model:n.model,models:Se(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=I().map(r=>({...r,models:(()=>{let i=e?.[r.name];return i&&i.length>0?T(i,r.models):r.models})()}));t.push(...n)}catch{}return t}o(st,"getProviderList");function at(e){if(F(e))return!0;try{return E(e)?.isConfigured()??!1}catch{return!1}}o(at,"isProviderConfigured");function w(){try{if(c.existsSync(d)){let e=JSON.parse(c.readFileSync(d,"utf-8")),t=e.reasoningCeiling??e.reasoningMode;return Pe(Ee({...e,reasoningMode:t,extensions:te(e.extensions)}))}}catch{}return{}}o(w,"loadConfig");var M=f.join(S,"config.example.jsonc"),Re=`// KodaX example configuration \u2014 copy what you need into config.json (in this same
|
|
2
|
+
import{w as q,y as J}from"./chunk-RS2GAABJ.js";import{C as k,D as X,E as R,Ja as B,Na as z,ja as F,ka as j,la as G,ma as U,n as K,na as V,oa as A,va as $,wa as E,z as x,za as I}from"./chunk-O7N22GJ3.js";import{Ea as H,ya as W}from"./chunk-NVDK375I.js";import{a as o}from"./chunk-ONUPGMER.js";import c from"fs";import f from"path";import{exec as ce,spawnSync as le}from"child_process";import{promisify as ue}from"util";import{fileURLToPath as fe}from"url";var L="en";function ae(){return(process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"").toLowerCase().startsWith("zh")?"zh":"en"}o(ae,"detectSystemLocale");function Q(e){if(!e||e==="auto"){L=ae();return}L=e.toLowerCase().replace(/[-_].*/,"")==="zh"?"zh":"en"}o(Q,"setLocale");var Y={en:{"dialog.confirm":"[Confirm]","dialog.select":"[Select]","dialog.input":"[Input]","confirm.instruction.basic":"Press (y) yes, (n) no","confirm.instruction.always":"Press (y) yes, (a) always yes for this tool, (n) no","confirm.instruction.protected":"Press (y) to confirm, (n) to cancel (protected path)","confirm.result.approved":"Approved","confirm.result.approved_always":"Approved (always)","confirm.result.denied":"Denied","tool.bash.title":"Execute bash command?","tool.shell.title":"Execute shell command?","tool.write.title":"Write to file?","tool.edit.title":"Edit file?","tool.generic.title":"Execute {tool}?","field.reason":"Reason","field.intent":"Intent","field.target":"Target","field.scope":"Scope","field.risk":"Risk","field.summary":"Summary","intent.read":"Read project files","intent.delete":"Delete files","intent.deps":"Modify dependencies or environment","intent.modify":"Modify files","intent.execute":"Execute command","intent.write_file":"Write file","intent.edit_file":"Edit file","intent.use_tool":"Use {tool}","risk.destructive":"Destructive change","risk.deps":"May change dependencies or local tools","risk.modify":"May modify files","risk.unknown":"Command effects depend on its arguments","risk.network":"May access network","scope.outside":"Outside project","scope.protected":"Protected path","waiting.confirm":"Waiting: approval required","waiting.select":"Waiting: choose an option","waiting.input":"Waiting: answer the prompt","placeholder.confirm":"Respond to the approval prompt above...","placeholder.select":"Choose an option above...","placeholder.input":"Answer the prompt above...","placeholder.busy":"Agent is busy...","placeholder.queue":"Queue a follow-up for the next round...","placeholder.idle":"Type a message...","select.choice":"Choice:","select.type_number":"(type a number)","select.more":"{count} more choices...","select.more_above":"\u2191 {count} more above","select.more_below":"\u2193 {count} more below","select.confirm_hint":"Press Enter to confirm, Esc to cancel","select.navigate_hint":"Use \u2191\u2193 to navigate, Enter to confirm, Esc to cancel","select.multiselect_hint":"Use \u2191\u2193 to navigate, Space to toggle, Enter to confirm, Esc to cancel","select.multiselect_empty":"Select at least one option with Space before confirming.","select.multiselect_min":"Select at least {min} option(s) with Space before confirming.","select.multiselect_max":"Select at most {max} option(s) with Space before confirming.","select.back_prev":"\u2190 Back to previous question","input.default":"Default:","input.value":"Value:","input.type_response":"(type your response)","managed.completed":"Task completed","managed.completed.blocked":"Task blocked","managed.completed.continuation":"Task needs continuation",cancelled:"[Cancelled] Operation cancelled by user"},zh:{"dialog.confirm":"[\u786E\u8BA4]","dialog.select":"[\u9009\u62E9]","dialog.input":"[\u8F93\u5165]","confirm.instruction.basic":"\u6309 (y) \u786E\u8BA4, (n) \u62D2\u7EDD","confirm.instruction.always":"\u6309 (y) \u786E\u8BA4, (a) \u59CB\u7EC8\u5141\u8BB8\u6B64\u5DE5\u5177, (n) \u62D2\u7EDD","confirm.instruction.protected":"\u6309 (y) \u786E\u8BA4, (n) \u53D6\u6D88 (\u53D7\u4FDD\u62A4\u8DEF\u5F84)","confirm.result.approved":"\u5DF2\u6279\u51C6","confirm.result.approved_always":"\u5DF2\u6279\u51C6 (\u59CB\u7EC8\u5141\u8BB8)","confirm.result.denied":"\u5DF2\u62D2\u7EDD","tool.bash.title":"\u6267\u884C bash \u547D\u4EE4\uFF1F","tool.shell.title":"\u6267\u884C shell \u547D\u4EE4\uFF1F","tool.write.title":"\u5199\u5165\u6587\u4EF6\uFF1F","tool.edit.title":"\u7F16\u8F91\u6587\u4EF6\uFF1F","tool.generic.title":"\u6267\u884C {tool}\uFF1F","field.reason":"\u539F\u56E0","field.intent":"\u610F\u56FE","field.target":"\u76EE\u6807","field.scope":"\u8303\u56F4","field.risk":"\u98CE\u9669","field.summary":"\u6458\u8981","intent.read":"\u8BFB\u53D6\u9879\u76EE\u6587\u4EF6","intent.delete":"\u5220\u9664\u6587\u4EF6","intent.deps":"\u4FEE\u6539\u4F9D\u8D56\u6216\u73AF\u5883","intent.modify":"\u4FEE\u6539\u6587\u4EF6","intent.execute":"\u6267\u884C\u547D\u4EE4","intent.write_file":"\u5199\u5165\u6587\u4EF6","intent.edit_file":"\u7F16\u8F91\u6587\u4EF6","intent.use_tool":"\u4F7F\u7528 {tool}","risk.destructive":"\u7834\u574F\u6027\u53D8\u66F4","risk.deps":"\u53EF\u80FD\u4FEE\u6539\u4F9D\u8D56\u6216\u672C\u5730\u5DE5\u5177","risk.modify":"\u53EF\u80FD\u4FEE\u6539\u6587\u4EF6","risk.unknown":"\u547D\u4EE4\u6548\u679C\u53D6\u51B3\u4E8E\u53C2\u6570","risk.network":"\u53EF\u80FD\u8BBF\u95EE\u7F51\u7EDC","scope.outside":"\u9879\u76EE\u5916\u90E8","scope.protected":"\u53D7\u4FDD\u62A4\u8DEF\u5F84","waiting.confirm":"\u7B49\u5F85\u4E2D\uFF1A\u9700\u8981\u5BA1\u6279","waiting.select":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u9009\u62E9","waiting.input":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u56DE\u7B54","placeholder.confirm":"\u8BF7\u56DE\u5E94\u4E0A\u65B9\u7684\u5BA1\u6279\u63D0\u793A...","placeholder.select":"\u8BF7\u5728\u4E0A\u65B9\u9009\u62E9\u4E00\u4E2A\u9009\u9879...","placeholder.input":"\u8BF7\u56DE\u7B54\u4E0A\u65B9\u7684\u63D0\u793A...","placeholder.busy":"\u667A\u80FD\u4F53\u6B63\u5728\u5DE5\u4F5C\u4E2D...","placeholder.queue":"\u6392\u961F\u7B49\u5F85\u4E0B\u4E00\u8F6E\u8DDF\u8FDB...","placeholder.idle":"\u8F93\u5165\u6D88\u606F...","select.choice":"\u9009\u9879\uFF1A","select.type_number":"(\u8F93\u5165\u7F16\u53F7)","select.more":"\u8FD8\u6709 {count} \u4E2A\u9009\u9879...","select.more_above":"\u2191 \u4E0A\u65B9\u8FD8\u6709 {count} \u4E2A","select.more_below":"\u2193 \u4E0B\u65B9\u8FD8\u6709 {count} \u4E2A","select.confirm_hint":"\u6309 Enter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.navigate_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0C\u7A7A\u683C \u5207\u6362\u9009\u4E2D\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_empty":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u9009\u9879\u3002","select.multiselect_min":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u81F3\u5C11\u9009\u62E9 {min} \u4E2A\u9009\u9879\u3002","select.multiselect_max":"\u6700\u591A\u53EA\u80FD\u9009\u62E9 {max} \u4E2A\u9009\u9879\u3002","select.back_prev":"\u2190 \u8FD4\u56DE\u4E0A\u4E00\u9898","input.default":"\u9ED8\u8BA4\u503C\uFF1A","input.value":"\u503C\uFF1A","input.type_response":"(\u8F93\u5165\u4F60\u7684\u56DE\u7B54)","managed.completed":"\u4EFB\u52A1\u5B8C\u6210","managed.completed.blocked":"\u4EFB\u52A1\u53D7\u963B","managed.completed.continuation":"\u4EFB\u52A1\u9700\u8981\u7EE7\u7EED",cancelled:"[\u5DF2\u53D6\u6D88] \u64CD\u4F5C\u5DF2\u88AB\u7528\u6237\u53D6\u6D88"}};function Ne(e,t){let r=Y[L][e]??Y.en[e]??e;if(t)for(let[i,s]of Object.entries(t))r=r.replace(`{${i}}`,String(s));return r}o(Ne,"t");var de=ue(ce),S=W(),He=f.join(S,"sessions"),d=f.join(S,"config.json"),qe=60,p=null,D=!1,pe="dumb";function me(e){let t=f.basename(e).toLowerCase(),n="__KODAX_SHELL_ENV_START__",r=`printf '%s\\0' '${n}'; env -0`;return t==="fish"?{args:["-i","-c",r],sentinel:n}:{args:t==="bash"||t==="zsh"?["-ic",r]:["-lc",r],sentinel:n}}o(me,"buildShellEnvCommand");function ge(e,t){let n=`${t}\0`,r=e.lastIndexOf(n);if(r===-1)return{};let i=e.slice(r+n.length),s={};for(let a of i.split("\0")){if(!a)continue;let u=a.indexOf("=");u<=0||(s[a.slice(0,u)]=a.slice(u+1))}return s}o(ge,"parseNullDelimitedShellEnv");function ve(e={}){let t=e.env??process.env;if((e.platform??process.platform)==="win32"||t.KODAX_DISABLE_SHELL_ENV_HYDRATION==="1")return!1;let r=e.shell??t.SHELL;if(!r||!f.isAbsolute(r))return!1;let{args:i,sentinel:s}=me(r),a=e.run??le,u={...t,TERM:pe},l=a(r,i,{encoding:"utf8",env:u,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(l.status!==0||!l.stdout)return!1;let re=typeof l.stdout=="string"?l.stdout:l.stdout.toString("utf8"),ie=ge(re,s),N=!1;for(let[C,se]of Object.entries(ie))C!=="TERM"&&t[C]===void 0&&(t[C]=se,N=!0);return N}o(ve,"hydrateProcessEnvFromShell");function he(){if(!D){D=!0;try{ve()}catch{}}}o(he,"ensureShellEnvironmentHydrated");function Je(){D=!1}o(Je,"resetShellEnvironmentHydrationForTesting");function ye(e){$(e.customProviders??[])}o(ye,"registerConfiguredCustomProviders");function te(e){if(!Array.isArray(e))return;let t=e.filter(n=>typeof n=="string").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:[]}o(te,"normalizeConfiguredExtensions");function Ee(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{c.mkdirSync(f.dirname(d),{recursive:!0}),c.writeFileSync(d,JSON.stringify(t,null,2))}catch{}return t}o(Ee,"migrateLegacyPermissionModeInConfig");function Pe(e){if(e.permissionMode!=="auto-in-project")return e;try{let t=c.readFileSync(d,"utf-8"),n=t.replace(/("permissionMode"\s*:\s*)"auto-in-project"/,'$1"auto"');n!==t&&c.writeFileSync(d,n)}catch{}return{...e,permissionMode:"auto"}}o(Pe,"migrateAutoInProjectAliasInConfig");function be(){if(p)return p;let e="0.7.67";if(e)return p=e,p;let t=f.join(f.dirname(fe(import.meta.url)),"../../package.json");if(c.existsSync(t))try{return p=JSON.parse(c.readFileSync(t,"utf-8")).version??"0.0.0",p??"0.0.0"}catch{}return p="0.0.0",p}o(be,"getVersion");var Ye=be();function _e(e){return j(e)}o(_e,"getProviderModel");function T(e,t){let n=new Set(e.map(i=>i.toLowerCase())),r=[...e];for(let i of t)n.has(i.toLowerCase())||r.push(i);return r}o(T,"mergeModels");function Se(e,t){t||(t=w().providerModels);let n=t?.[e];if(n&&n.length>0){try{let r=A(e);if(r.length>0)return T(n,r)}catch{}try{let r=E(e);if(r)return T(n,r.getAvailableModels())}catch{}return n}try{let r=A(e);if(r.length>0)return r}catch{}try{let r=E(e);if(r)return r.getAvailableModels()}catch{}return[]}o(Se,"getProviderAvailableModels");function Oe(e,t){let n=G(e,t);if(n!=="unknown")return n;try{let r=E(e);if(r)return r.getReasoningCapability(t)}catch{}return"unknown"}o(Oe,"getProviderReasoningCapability");function we(e){let t=U(e);if(t)return t;try{return I().find(r=>r.name===e)?.capabilityProfile??null}catch{return null}}o(we,"getProviderCapabilityProfile");function ne(e,t){let n=we(e),r=Oe(e,t);if(n)return{capabilityProfile:n,reasoningCapability:r};try{let i=B(e);return{capabilityProfile:i.getCapabilityProfile(),reasoningCapability:i.getReasoningCapability(t)}}catch{return null}}o(ne,"getProviderCapabilityMetadata");function Qe(e,t){let n=ne(e,t);return n?q({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}o(Qe,"getProviderCapabilitySnapshot");function Ce(e,t,n,r){let i=ne(e,t);return i?J({providerName:e,model:t,capabilityProfile:i.capabilityProfile,reasoningCapability:i.reasoningCapability==="unknown"?void 0:i.reasoningCapability,reasoningMode:n,hints:r}):null}o(Ce,"getProviderPolicyDecision");function Ze(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"forwards only the latest user message":"preserves full conversation history",r=e.mcpSupport==="native"?"MCP available":"MCP unavailable";return`${t}; ${n}; ${r}`}o(Ze,"describeProviderCapabilitySummary");function et(e){switch(e){case"native-budget":return"B";case"native-effort":return"E";case"native-toggle":return"T";case"native-adaptive":return"A";default:return"-"}}o(et,"formatReasoningCapabilityShort");function y(e){if(e)return e==="none"?"off":e}o(y,"formatReasoningEffortForDisplay");function _(e,t){let n=y(t);n&&!e.includes(n)&&e.push(n)}o(_,"pushUniqueEffortDisplay");function tt(e,t){let n=["auto"],i=O(e,t)?.supportedEfforts?.filter(s=>s.isUserVisible!==!1);if(!i||i.length===0){for(let s of["off","low","medium","high"])_(n,s);return n}for(let s of i)_(n,s.value);return n}o(tt,"getProviderReasoningEffortOptions");function nt(e,t){let n=O(e,t),r=new Set(n?.disabledEfforts??[]),i=n?.supportedEfforts?.filter(l=>l.isUserVisible!==!1),s=[],a=n?.supportsDisabledThinking===!0;if(!i||i.length===0){for(let l of["low","medium","high"])_(s,l);a=!0}else for(let l of i){if(l.value==="none"){a=!0;continue}if(r.has(l.value)){a=!0;continue}_(s,l.value)}let u=[];return a&&u.push("off"),u.push(...s),u.push("auto"),u}o(nt,"getProviderReasoningEffortCycle");function xe(e,t){if(t===!1)return"off";switch(e){case"off":return"off";case"quick":return"low";case"balanced":return"medium";case"deep":return"high";default:return"auto"}}o(xe,"legacyReasoningModeToEffortDisplay");function O(e,t){let n=t??_e(e);if(!n)return;let r=z(e,n)?.reasoningProfile;if(r)return K(r,H(e,n))}o(O,"resolveReasoningProfileForDisplay");function ot(e){let t=y(e.effort)??xe(e.reasoningMode,e.thinking),n=O(e.provider,e.model);if(!n)return t;try{let r=X({capability:n,explicitEffort:e.effortOverride?e.effort:void 0,sessionEffort:e.effortOverride?void 0:e.effort,legacyReasoningMode:e.reasoningMode,thinking:e.thinking}),i=y(r.configuredEffort)??t,a=r.configuredEffort!==void 0&&n.disabledEfforts?.includes(r.configuredEffort)===!0?"off":y(r.effectiveEffort);return a&&a!==i?`${i}->${a}`:i}catch{if(e.effort)try{let r=R({currentEffort:e.effort,capability:n}),i=y(e.effort)??t,s=y(r.effectiveEffort);return s&&s!==i?`${i}->${s}`:i}catch{return t}return t}}o(ot,"formatReasoningEffortStatusLabel");function rt(e){let t=De(e);if(!t)return{preserved:!0};let n=O(e.provider,e.model);if(!n)return{configuredEffort:t,runtimeEffort:t,preserved:!0};let r=R({currentEffort:t,capability:n});return{configuredEffort:t,runtimeEffort:r.effectiveEffort,preserved:r.preserved,diagnostic:r.diagnostic}}o(rt,"resolveProviderReasoningRuntimeEffort");function ke(e){switch(e){case"native-budget":return"budget";case"native-effort":return"effort";case"native-toggle":return"toggle";case"native-adaptive":return"adaptive";default:return"none"}}o(ke,"describeReasoningCapabilityControl");function it(e,t){if(e==="off")return"Reasoning disabled";switch(t){case"native-budget":return"Uses native thinking budget control";case"native-effort":return"Uses native reasoning effort control";case"native-toggle":return"Uses provider-native thinking toggle only";case"native-adaptive":return"Model adaptively decides thinking depth (Opus 4.7+)";case"none":return"Runs without native reasoning parameters";case"prompt-only":return"Uses prompt overlays only; no native reasoning parameter";default:return"Runs without native reasoning parameters"}}o(it,"describeReasoningExecution");function st(e){let t=[];e||(e=w().providerModels);for(let n of V())t.push({name:n.name,model:n.model,models:Se(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=I().map(r=>({...r,models:(()=>{let i=e?.[r.name];return i&&i.length>0?T(i,r.models):r.models})()}));t.push(...n)}catch{}return t}o(st,"getProviderList");function at(e){if(F(e))return!0;try{return E(e)?.isConfigured()??!1}catch{return!1}}o(at,"isProviderConfigured");function w(){try{if(c.existsSync(d)){let e=JSON.parse(c.readFileSync(d,"utf-8")),t=e.reasoningCeiling??e.reasoningMode;return Pe(Ee({...e,reasoningMode:t,extensions:te(e.extensions)}))}}catch{}return{}}o(w,"loadConfig");var M=f.join(S,"config.example.jsonc"),Re=`// KodaX example configuration \u2014 copy what you need into config.json (in this same
|
|
3
3
|
// folder). config.json must be STRICT JSON: no comments, no trailing commas. Most
|
|
4
4
|
// settings also have a semantic KODAX_* env counterpart that overrides the file.
|
|
5
5
|
// Priority: explicit option > environment > config.json > default. Delete anything
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{za as e}from"./chunk-
|
|
2
|
+
import{za as e}from"./chunk-NVDK375I.js";import{a as n}from"./chunk-ONUPGMER.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};
|