@kodax-ai/kodax 0.7.85 → 0.7.87
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 +125 -1
- package/README.md +1879 -1841
- package/README_CN.md +1138 -1130
- package/dist/chunks/{agent-OQ37XUWF.js → agent-Z64QF7KG.js} +1 -1
- package/dist/chunks/argument-completer-HIJBXRUT.js +2 -0
- package/dist/chunks/chunk-3PGNESV3.js +415 -0
- package/dist/chunks/{chunk-IA246OAN.js → chunk-4OLXWSCQ.js} +2 -2
- package/dist/chunks/chunk-7XTUXMAI.js +379 -0
- package/dist/chunks/{chunk-TBBY2DKE.js → chunk-ASFCAPIG.js} +3 -3
- package/dist/chunks/{chunk-CZCEFGQG.js → chunk-BCYJIACJ.js} +2 -2
- package/dist/chunks/{chunk-ZVOXWLT6.js → chunk-DB4O33RR.js} +226 -214
- package/dist/chunks/{chunk-RSOAHVUR.js → chunk-GRJ7NKWP.js} +1 -1
- package/dist/chunks/{chunk-3E4OSFP2.js → chunk-ITP7J5HX.js} +136 -137
- package/dist/chunks/{chunk-HTVLCHWH.js → chunk-JS4RSF4B.js} +1 -1
- package/dist/chunks/chunk-SKELDH3G.js +123 -0
- package/dist/chunks/{chunk-MJ4G5ZCW.js → chunk-U44C5STU.js} +1 -1
- package/dist/chunks/{chunk-IWRNGH4M.js → chunk-UWKM3HNY.js} +5 -5
- package/dist/chunks/chunk-XH7UM4GO.js +92 -0
- package/dist/chunks/{chunk-ODRLFQQH.js → chunk-XKLVC7F6.js} +1 -1
- package/dist/chunks/chunk-YB7YVAPL.js +519 -0
- package/dist/chunks/{chunk-SR4E5FQK.js → chunk-ZQNOEKOB.js} +2 -2
- package/dist/chunks/compaction-config-E4TFBCDJ.js +2 -0
- package/dist/chunks/{construction-bootstrap-CZ6NWEWQ.js → construction-bootstrap-YTFOT4M2.js} +1 -1
- package/dist/chunks/{dist-NFLLOZWF.js → dist-M3JV4PNA.js} +1 -1
- package/dist/chunks/{dist-WWL2DNIJ.js → dist-X55TWIK4.js} +1 -1
- package/dist/chunks/host-SJHHJBPB.js +2 -0
- package/dist/chunks/run-manager-T5QGWNON.js +2 -0
- package/dist/chunks/{utils-KFLK3EHJ.js → utils-2FHVIO6X.js} +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.js +1 -1
- package/dist/kodax_bootstrap.js +1 -1
- package/dist/kodax_cli.js +1459 -1411
- package/dist/kodax_resume.js +78 -76
- package/dist/provider-capabilities.json +239 -133
- package/dist/runtime-worker.js +1467 -1419
- package/dist/sandbox-workspace-session.js +346 -302
- package/dist/sdk-a2a.d.ts +12 -12
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.d.ts +17 -17
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +22 -22
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +4 -4
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +7 -7
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +16 -18
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-runtime.d.ts +22 -14
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.d.ts +1 -1
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.d.ts +7 -7
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +63 -64
- package/dist/types-chunks/{base.d-DxG0m09Z.d.ts → base.d-vopO1rml.d.ts} +1 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-BnZQDirs.d.ts → bash-prefix-extractor.d-B36OQwNA.d.ts} +13 -7
- package/dist/types-chunks/{capability-learning.d-iPSiAmc_.d.ts → capability-learning.d-CE1tm29C.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-CN_iMqAS.d.ts → capsule.d-DEncDNzD.d.ts} +3 -3
- package/dist/types-chunks/{controller.d-A73Kf6tH.d.ts → controller.d-C1YdP_pQ.d.ts} +1 -1
- package/dist/types-chunks/{controller.d-Dzxz22X-.d.ts → controller.d-Dif9pbC9.d.ts} +2 -2
- package/dist/types-chunks/{guardrail.d-BCkgaWT1.d.ts → guardrail.d-DhpnJv4Y.d.ts} +5 -11
- package/dist/types-chunks/{history-retrieval.d-Debbzn1z.d.ts → history-retrieval.d-YJQpQt7h.d.ts} +2 -2
- package/dist/types-chunks/{public-api.d-N6G6Jw8X.d.ts → public-api.d-D4q3WxKq.d.ts} +4 -4
- package/dist/types-chunks/{repl.d-BkTIOkJD.d.ts → repl.d-D4ye29Kk.d.ts} +5 -5
- package/dist/types-chunks/{resolver.d-C9IW4fmU.d.ts → resolver.d-RyPo99tB.d.ts} +2 -2
- package/dist/types-chunks/{review-inbox.d-DuZqFX-z.d.ts → review-inbox.d-C1_xZ-yg.d.ts} +1 -1
- package/dist/types-chunks/{run-manager.d-BS4lJfL3.d.ts → run-manager.d-D30IvnwV.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-DLkZTOc-.d.ts → sdk-session-DIU6sHa2.d.ts} +3 -3
- package/dist/types-chunks/{shell-command-sets.d-BrLw-WN9.d.ts → shell-command-sets.d-rIHkZ_VR.d.ts} +1 -1
- package/dist/types-chunks/{side-query.d-CP1LiRiH.d.ts → side-query.d-iH0P9ASy.d.ts} +2 -2
- package/dist/types-chunks/{types.d-Ch3BD97c.d.ts → types.d-Bz5Y-PD9.d.ts} +4 -4
- package/dist/types-chunks/{types.d-CgrXrFrq.d.ts → types.d-CK9A9rpP.d.ts} +1 -1
- package/dist/types-chunks/{types.d-Bo4fyMLu.d.ts → types.d-COhAF5Xo.d.ts} +2 -2
- package/dist/types-chunks/{types.d-DlLBRqZ9.d.ts → types.d-sW-OqiFt.d.ts} +1 -1
- package/dist/types-chunks/{utils.d-BI-kjuev.d.ts → utils.d-B65ozSTV.d.ts} +6 -6
- package/package.json +1 -1
- package/dist/chunks/argument-completer-IMRSIF2N.js +0 -2
- package/dist/chunks/chunk-2XJQNFVR.js +0 -379
- package/dist/chunks/chunk-CDWYKVZC.js +0 -482
- package/dist/chunks/chunk-RTFVMEF6.js +0 -415
- package/dist/chunks/chunk-TRNAWSXP.js +0 -123
- package/dist/chunks/chunk-UH5WNJXF.js +0 -92
- package/dist/chunks/compaction-config-3WLLNN57.js +0 -2
- package/dist/chunks/host-LWUSSCWH.js +0 -2
- package/dist/chunks/run-manager-PBMOVP7A.js +0 -2
package/README.md
CHANGED
|
@@ -1,605 +1,605 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg">
|
|
4
|
-
<source media="(prefers-color-scheme: light)" srcset="assets/logo-light.svg">
|
|
5
|
-
<img src="assets/logo-light.svg" alt="KodaX" width="640">
|
|
6
|
-
</picture>
|
|
7
|
-
</p>
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
<b>Source-available AI coding agent on every LLM you can reach.</b><br>
|
|
11
|
-
Anthropic · OpenAI · DeepSeek · Kimi · Zhipu · MiniMax · MiMo · Ark · Qwen · Gemini · Codex.<br>
|
|
12
|
-
REPL · CLI · library · Node-free single binary.
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
<p align="center">
|
|
16
|
-
<a href="https://www.npmjs.com/package/@kodax-ai/kodax"><img alt="npm version" src="https://img.shields.io/npm/v/@kodax-ai/kodax?style=flat-square&color=cb3837"></a>
|
|
17
|
-
<a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-KAI--FCL_1.0-orange?style=flat-square"></a>
|
|
18
|
-
<a href="https://github.com/icetomoyo/KodaX/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/icetomoyo/KodaX?style=flat-square&logo=github&color=f1c40f"></a>
|
|
19
|
-
<a href="https://github.com/icetomoyo/KodaX/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/icetomoyo/KodaX/release.yml?style=flat-square&label=release"></a>
|
|
20
|
-
<img alt="providers" src="https://img.shields.io/badge/LLMs-16_aliases_+_custom-2ecc71?style=flat-square">
|
|
21
|
-
</p>
|
|
22
|
-
|
|
23
|
-
<p align="center">
|
|
24
|
-
<a href="#install-in-30-seconds">Install</a> ·
|
|
25
|
-
<a href="#four-ways-to-use-kodax">Usage</a> ·
|
|
26
|
-
<a href="#sdk-usage">SDK</a> ·
|
|
27
|
-
<a href="CHANGELOG.md">Changelog</a> ·
|
|
28
|
-
<a href="docs/FEATURE_LIST.md">Roadmap</a> ·
|
|
29
|
-
<a href="https://github.com/icetomoyo/KodaX/discussions">Discussions</a> ·
|
|
30
|
-
<a href="README_CN.md">中文 README</a>
|
|
31
|
-
</p>
|
|
32
|
-
|
|
33
|
-
<p align="center">
|
|
34
|
-
<img src="kodax-hd.gif" alt="KodaX in action" width="880">
|
|
35
|
-
</p>
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Install in 30 seconds
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npm i -g @kodax-ai/kodax
|
|
43
|
-
|
|
44
|
-
# Pick any one you have an API key for (`kodax setup --help` lists all):
|
|
45
|
-
export ZHIPU_API_KEY=... # ANTHROPIC_API_KEY / OPENAI_API_KEY / DEEPSEEK_API_KEY /
|
|
46
|
-
# KIMI_API_KEY / KIMI_CODE_API_KEY / QWEN_API_KEY /
|
|
47
|
-
# QWEN_TOKEN_API_KEY / ZHIPU_CODING_API_KEY /
|
|
48
|
-
# ZAI_CODING_API_KEY / MINIMAX_CODING_API_KEY /
|
|
49
|
-
# MIMO_API_KEY / MIMO_CODING_API_KEY / ARK_CODING_API_KEY
|
|
50
|
-
|
|
51
|
-
kodax
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
That's it. You're in the REPL — ask anything in natural language. On a new
|
|
55
|
-
machine, bare interactive `kodax` first checks for supported API-key environment
|
|
56
|
-
variables. If none exists, KodaX only prints Windows, macOS, and Linux setup
|
|
57
|
-
instructions and exits without creating configuration or collecting a key.
|
|
58
|
-
After setting the variable, close the current terminal, open a new one, and run
|
|
59
|
-
`kodax` again. If a supported credential exists but no provider is selected,
|
|
60
|
-
KodaX opens the provider/model metadata setup. Use `kodax setup` to rerun the
|
|
61
|
-
flow, `kodax setup --custom` for a guided custom provider, and
|
|
62
|
-
`kodax setup --help` (or REPL `/setup --help`) for paths, provider variables,
|
|
63
|
-
commands, and shortcuts. Interactive setup also checks the optional ASRT sandbox once:
|
|
64
|
-
Windows may show a one-time UAC prompt; macOS/Linux report any required
|
|
65
|
-
Seatbelt/bubblewrap dependencies. Declining or missing a dependency does not
|
|
66
|
-
break ordinary permission handling, and normal startup will not keep reminding
|
|
67
|
-
you.
|
|
68
|
-
|
|
69
|
-
> **No-Node target machines:** download a Bun-compiled single binary for Windows / macOS / Linux × x64 + arm64 from the [GitHub Releases](https://github.com/icetomoyo/KodaX/releases) page. See [docs/release.md](docs/release.md) for the build pipeline.
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Four ways to use KodaX
|
|
74
|
-
|
|
75
|
-
| Form | Command / Import | When to use it |
|
|
76
|
-
|---|---|---|
|
|
77
|
-
| **REPL** | `kodax` | Interactive multi-turn coding session with streaming UI, permissions, slash commands |
|
|
78
|
-
| **CLI** | `kodax -p "your task"` | One-shot scripted task, CI runs, batch processing |
|
|
79
|
-
| **Library** | `import { runKodaX } from '@kodax-ai/kodax'` | Embed in your own tool / agent / web service |
|
|
80
|
-
| **Single binary** | `./kodax` | Distribute to machines that don't have Node installed |
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Why KodaX
|
|
85
|
-
|
|
86
|
-
<table>
|
|
87
|
-
<tr>
|
|
88
|
-
<td width="33%" align="center" valign="top">
|
|
89
|
-
<h3>🇨🇳 6 China-native LLMs</h3>
|
|
90
|
-
<sub>Zhipu · Kimi · MiniMax · MiMo · Ark · Qwen</sub>
|
|
91
|
-
<br><br>
|
|
92
|
-
First-class adapters with cross-provider <a href="benchmark/EVAL_GUIDELINES.md">prompt-eval calibration</a> on a canonical 5-alias panel — not OpenAI-compat shims.
|
|
93
|
-
</td>
|
|
94
|
-
<td width="33%" align="center" valign="top">
|
|
95
|
-
<h3>📦 Single-file binary</h3>
|
|
96
|
-
<sub>Bun --compile · Win / macOS / Linux · x64 + arm64</sub>
|
|
97
|
-
<br><br>
|
|
98
|
-
No Node required on the target machine. Drop one file, run anywhere — restricted envs, CI runners, air-gapped boxes.
|
|
99
|
-
</td>
|
|
100
|
-
<td width="33%" align="center" valign="top">
|
|
101
|
-
<h3>🌳 Branchable session lineage</h3>
|
|
102
|
-
<sub>Fork · rewind · parallel edit</sub>
|
|
103
|
-
<br><br>
|
|
104
|
-
Conversation history is a DAG, not a list. Powers the upcoming <b>KodaX Space</b> desktop app.
|
|
105
|
-
</td>
|
|
106
|
-
</tr>
|
|
107
|
-
<tr>
|
|
108
|
-
<td align="center" valign="top">
|
|
109
|
-
<h3>🤖 Multi-agent by default</h3>
|
|
110
|
-
<sub>V2 Worker single-loop + Sidecar Verifier + async children</sub>
|
|
111
|
-
<br><br>
|
|
112
|
-
<code>spawn_agent</code>, <code>send_message</code>, <code>followup_task</code>, <code>interrupt_agent</code>, multi-instance auto-coordination with content-hash safety net.
|
|
113
|
-
</td>
|
|
114
|
-
<td align="center" valign="top">
|
|
115
|
-
<h3>🧩 Skills + self-construction</h3>
|
|
116
|
-
<sub>Markdown skills, NL triggers</sub>
|
|
117
|
-
<br><br>
|
|
118
|
-
5-stage self-modification staircase (scaffold → validate → stage → test → activate) gated by an 8-invariant admission contract.
|
|
119
|
-
</td>
|
|
120
|
-
<td align="center" valign="top">
|
|
121
|
-
<h3>🛠 50+ built-in tools</h3>
|
|
122
|
-
<sub>File · shell · search · MCP · ACP</sub>
|
|
123
|
-
<br><br>
|
|
124
|
-
Repo intelligence, semantic search, git worktree, web fetch — all addressable through one clean tool surface.
|
|
125
|
-
</td>
|
|
126
|
-
</tr>
|
|
127
|
-
</table>
|
|
128
|
-
|
|
129
|
-
## How KodaX compares
|
|
130
|
-
|
|
131
|
-
| Feature | **KodaX** | Claude Code | Aider | Codex CLI | Cursor | Cline |
|
|
132
|
-
|---|---|---|---|---|---|---|
|
|
133
|
-
| Source license | ⚠️ KAI-FCL, non-commercial | ❌ Source-available | ✅ Apache 2.0 | ✅ Apache 2.0 | ❌ Proprietary | ✅ Apache 2.0 |
|
|
134
|
-
| Node-free single binary | ✅ Bun | ❌ Node | ❌ Python | ✅ Rust | ❌ Electron | ❌ Extension |
|
|
135
|
-
| Native China providers<br><sub>(Zhipu · Kimi · MiniMax · MiMo · Ark · Qwen)</sub> | ✅ 6 native | ❌ | ⚠ via LiteLLM | ❌ OpenAI-first | ❌ no provider menu | ⚠ Kimi / Qwen / DeepSeek |
|
|
136
|
-
| Branchable session lineage | ✅ fork & rewind | ⚠ routines / sessions | ❌ | ❌ | ❌ | ⚠ checkpoints |
|
|
137
|
-
| Multi-agent + MCP + 50+ tools | ✅ all three | ✅ all three | ⚠ tools, no MCP | ✅ all three | ⚠ Composer + MCP | ✅ all three |
|
|
138
|
-
|
|
139
|
-
<sub>Data verified May 2026 against public docs ([Claude Code](https://github.com/anthropics/claude-code) · [Aider](https://aider.chat/docs/llms.html) · [Codex CLI](https://github.com/openai/codex) · [Cursor](https://cursor.com) · [Cline](https://github.com/cline/cline)). ⚠ = partial / requires extra setup / not first-class. Corrections welcome via PR.</sub>
|
|
140
|
-
|
|
141
|
-
## Detailed Setup
|
|
142
|
-
|
|
143
|
-
> The `npm i -g @kodax-ai/kodax` one-liner above is the fastest path. This section is for building from source, configuring custom providers, or using KodaX as a library.
|
|
144
|
-
|
|
145
|
-
### 1. Build the CLI from source
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
git clone https://github.com/icetomoyo/KodaX.git
|
|
149
|
-
cd KodaX
|
|
150
|
-
npm install
|
|
151
|
-
npm run build
|
|
152
|
-
npm link
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### 2. Configure a provider
|
|
156
|
-
|
|
157
|
-
KodaX reads API keys from environment variables. For built-in providers, the fastest path is:
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
# Interactive metadata-only provider/model setup (does not collect a key)
|
|
161
|
-
kodax setup
|
|
162
|
-
|
|
163
|
-
# Guided custom OpenAI/Anthropic-compatible provider
|
|
164
|
-
kodax setup --custom
|
|
165
|
-
|
|
166
|
-
# Complete guide; does not change files
|
|
167
|
-
kodax setup --help
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
Setup checks these active files and matching `*.example.jsonc` references:
|
|
171
|
-
|
|
172
|
-
- `~/.kodax/config.json` and `~/.kodax/config.example.jsonc`
|
|
173
|
-
- `~/.kodax/integrations/mcp.json`
|
|
174
|
-
- `~/.kodax/integrations/extensions.json`
|
|
175
|
-
- `~/.kodax/integrations/a2a.json`
|
|
176
|
-
|
|
177
|
-
The core active file remains strict JSON. The first line of the annotated
|
|
178
|
-
`config.example.jsonc` points to all split files and documents every supported
|
|
179
|
-
core setting. Setup preserves existing files and stages readable legacy
|
|
180
|
-
`config.json#mcpServers` / `config.json#extensions` before creating empty
|
|
181
|
-
authoritative split files. It tells you the exact environment-variable name to
|
|
182
|
-
set and exits so you can restart the terminal. Existing active files are
|
|
183
|
-
validated first; an invalid file is reported without creating or overwriting
|
|
184
|
-
configuration. For a custom provider, setup asks for an `apiKeyEnv` name such
|
|
185
|
-
as `MY_LLM_API_KEY`, not the API key itself. `config.json` stores that name
|
|
186
|
-
only; after setup, set the environment variable with exactly that name to the
|
|
187
|
-
provider's actual API key. KodaX does not set the OS environment variable for
|
|
188
|
-
you. You can also configure it directly:
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
# macOS / Linux
|
|
192
|
-
export ZHIPU_API_KEY=your_api_key
|
|
193
|
-
|
|
194
|
-
# PowerShell
|
|
195
|
-
$env:ZHIPU_API_KEY="your_api_key"
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### 2.1 Activate the optional sandbox
|
|
199
|
-
|
|
200
|
-
`kodax setup` and first-run setup check sandbox readiness. You can inspect or
|
|
201
|
-
activate it explicitly:
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
kodax sandbox doctor
|
|
205
|
-
kodax sandbox setup
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
- Windows uses a restricted sandbox account and network policy. A normal
|
|
209
|
-
terminal is sufficient; approve the one-time UAC prompt.
|
|
210
|
-
- macOS uses Seatbelt/`sandbox-exec` and requires ripgrep
|
|
211
|
-
(`brew install ripgrep`).
|
|
212
|
-
- Linux uses bubblewrap and requires `bubblewrap`, `socat`, and `ripgrep`
|
|
213
|
-
(install them with your distro's `apt`, `dnf`, or `pacman`).
|
|
214
|
-
|
|
215
|
-
KodaX never runs `sudo` or a package manager automatically. If the sandbox is
|
|
216
|
-
not active, deterministic safe operations and Auto[LLM] decisions keep the
|
|
217
|
-
same permission behavior; only OS-level containment is absent. Ordinary runs
|
|
218
|
-
do not repeatedly prompt for setup. In the REPL, `/sandbox` refreshes readiness
|
|
219
|
-
and diagnostics without activating the backend or requesting elevation.
|
|
220
|
-
Per-command sandbox routing remains internal and is not shown in normal command
|
|
221
|
-
history. SDK embedders can use the same capability independently through
|
|
222
|
-
`@kodax-ai/kodax/sandbox`; see the
|
|
223
|
-
[SDK sandbox guide](public_docs/sdk/embedder-guide.md#30-standalone-sandbox-sdk-v0778).
|
|
224
|
-
|
|
225
|
-
Credential-shaped environment variables are filtered from model-issued shell
|
|
226
|
-
commands by default. To expose exact host variables to those command targets,
|
|
227
|
-
including ASRT, add only their names to the user-level core config:
|
|
228
|
-
|
|
229
|
-
```json
|
|
230
|
-
{
|
|
231
|
-
"sandbox": {
|
|
232
|
-
"envPass": ["GH_TOKEN", "GITHUB_TOKEN", "OPENAI_API_KEY"]
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
The default list is empty. Values remain in the host environment and are never
|
|
238
|
-
stored in `config.json`; project configuration cannot extend the list.
|
|
239
|
-
Matching is exact (case-insensitive on Windows), and execution-control
|
|
240
|
-
variables such as `NODE_OPTIONS` and `BASH_ENV` remain blocked. Restart KodaX
|
|
241
|
-
after changing the host variables or this setting; stop/restart a persistent
|
|
242
|
-
KodaX daemon so it receives the new environment and configuration.
|
|
243
|
-
SDK callers pass the same shape per Run as `KodaXOptions.sandbox`, so concurrent
|
|
244
|
-
Runs can use different lists without mutating process-global configuration.
|
|
245
|
-
|
|
246
|
-
For Qwen Token Plan, select `qwen-token-plan` and use its separate credential;
|
|
247
|
-
`QWEN_API_KEY` does not authenticate this route:
|
|
248
|
-
|
|
249
|
-
```bash
|
|
250
|
-
export QWEN_TOKEN_API_KEY=your_api_key
|
|
251
|
-
kodax --provider qwen-token-plan
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
For CLI defaults, create `~/.kodax/config.json`:
|
|
255
|
-
|
|
256
|
-
```json
|
|
257
|
-
{
|
|
258
|
-
"provider": "zhipu-coding",
|
|
259
|
-
"effort": "auto"
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
If you need a custom base URL or an OpenAI/Anthropic-compatible endpoint, define a custom provider in the same config file:
|
|
264
|
-
|
|
265
|
-
```json
|
|
266
|
-
{
|
|
267
|
-
"provider": "my-openai-compatible",
|
|
268
|
-
"customProviders": [
|
|
269
|
-
{
|
|
270
|
-
"name": "my-openai-compatible",
|
|
271
|
-
"protocol": "openai",
|
|
272
|
-
"baseUrl": "https://example.com/v1",
|
|
273
|
-
"apiKeyEnv": "MY_LLM_API_KEY",
|
|
274
|
-
"model": "my-model",
|
|
275
|
-
"userAgentMode": "compat",
|
|
276
|
-
"reasoning": {
|
|
277
|
-
"efforts": ["off", "low", "medium", "high", "max"],
|
|
278
|
-
"default": "high"
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
]
|
|
282
|
-
}
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
Here, `"apiKeyEnv": "MY_LLM_API_KEY"` is a reference to an environment-variable
|
|
286
|
-
name, not an API key value. Put the custom provider's actual API key in the
|
|
287
|
-
`MY_LLM_API_KEY` environment variable, then close the current terminal and open
|
|
288
|
-
a new one before running `kodax`.
|
|
289
|
-
|
|
290
|
-
`userAgentMode` defaults to `"compat"`, which sends `KodaX` instead of the official SDK User-Agent. Switch it to `"sdk"` only when your gateway expects the upstream SDK header.
|
|
291
|
-
For custom reasoning models, `reasoning: { efforts, default }` is the preferred v0.7.57 shape; use `"reasoning": "none"` for models without thinking capability. SDK hosts should render effort pickers from `reasoningProfile.supportedEfforts` / `defaultEffort` rather than assuming a fixed five-option ladder.
|
|
292
|
-
|
|
293
|
-
#### OpenAI-compatible reasoning providers
|
|
294
|
-
|
|
295
|
-
Some OpenAI-compatible reasoning models require KodaX to replay the previous assistant turn's `reasoning_content` on later requests. DeepSeek V4 thinking mode is the known load-bearing case. Built-in DeepSeek already opts in; custom providers must say so explicitly:
|
|
296
|
-
|
|
297
|
-
```json
|
|
298
|
-
{
|
|
299
|
-
"customProviders": [
|
|
300
|
-
{
|
|
301
|
-
"name": "my-deepseek-v4",
|
|
302
|
-
"protocol": "openai",
|
|
303
|
-
"baseUrl": "https://example.com/v1",
|
|
304
|
-
"apiKeyEnv": "MY_DEEPSEEK_API_KEY",
|
|
305
|
-
"model": "deepseek-v4-flash",
|
|
306
|
-
"maxOutputTokensField": "max_tokens",
|
|
307
|
-
"reasoningPreset": "deepseek-v4-flash-openai",
|
|
308
|
-
"replayReasoningContent": true
|
|
309
|
-
}
|
|
310
|
-
]
|
|
311
|
-
}
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
DeepSeek Chat Completions uses `max_tokens`; OpenAI proper defaults to
|
|
315
|
-
`max_completion_tokens`. Keep `replayReasoningContent` unset or `false` for
|
|
316
|
-
OpenAI proper and gateways that reject unknown assistant-message fields. If one
|
|
317
|
-
gateway routes mixed models, prefer per-model overrides for both fields:
|
|
318
|
-
|
|
319
|
-
```json
|
|
320
|
-
{
|
|
321
|
-
"models": [
|
|
322
|
-
{
|
|
323
|
-
"id": "deepseek-v4-flash",
|
|
324
|
-
"maxOutputTokensField": "max_tokens",
|
|
325
|
-
"reasoningPreset": "deepseek-v4-flash-openai",
|
|
326
|
-
"replayReasoningContent": true
|
|
327
|
-
},
|
|
328
|
-
{ "id": "gpt-5", "replayReasoningContent": false }
|
|
329
|
-
]
|
|
330
|
-
}
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
If a custom endpoint is confirmed to support cache-affinity routing, set
|
|
334
|
-
`"promptCacheAffinity": true`. Anthropic-compatible requests then receive the
|
|
335
|
-
opaque logical-context key as `metadata.user_id`; OpenAI-compatible requests
|
|
336
|
-
receive `prompt_cache_key`. The default is `false` because some strict
|
|
337
|
-
compatible gateways reject unknown request fields. Do not enable it solely
|
|
338
|
-
because an endpoint claims protocol compatibility.
|
|
339
|
-
|
|
340
|
-
Sidecar verifier judge calls use provider-level forced tool choice when supported. If a compatible endpoint rejects the `tool_choice` parameter, KodaX retries that verifier request once without forced tool choice and still fails open rather than blocking the main Worker.
|
|
341
|
-
|
|
342
|
-
#### Opting a custom provider into image / vision input (FEATURE_134 v0.7.40)
|
|
343
|
-
|
|
344
|
-
If your custom provider's underlying model supports image input (vision), add a `capabilityProfile.multimodalSupport: "image-input"` block so KodaX does not artificially block multimodal requests at the SA-path policy gate. Built-in vision-capable aliases (Anthropic, OpenAI, compatible aliases such as Kimi, Qwen, Zhipu, MiniMax, MiMo, Ark, plus Gemini-CLI via the CLI's `@<path>` file-include syntax) already ship with this flag enabled by default. DeepSeek V4 and Codex-CLI are text-only; custom providers need to opt in when their underlying model supports image input.
|
|
345
|
-
|
|
346
|
-
```json
|
|
347
|
-
{
|
|
348
|
-
"customProviders": [
|
|
349
|
-
{
|
|
350
|
-
"name": "my-vision-provider",
|
|
351
|
-
"protocol": "openai",
|
|
352
|
-
"baseUrl": "https://example.com/v1",
|
|
353
|
-
"apiKeyEnv": "MY_LLM_API_KEY",
|
|
354
|
-
"model": "my-vision-model",
|
|
355
|
-
"capabilityProfile": {
|
|
356
|
-
"transport": "native-api",
|
|
357
|
-
"conversationSemantics": "full-history",
|
|
358
|
-
"mcpSupport": "none",
|
|
359
|
-
"contextFidelity": "full",
|
|
360
|
-
"toolCallingFidelity": "full",
|
|
361
|
-
"sessionSupport": "full",
|
|
362
|
-
"longRunningSupport": "full",
|
|
363
|
-
"multimodalSupport": "image-input",
|
|
364
|
-
"evidenceSupport": "full"
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
]
|
|
368
|
-
}
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
The serializer layer (`packages/llm/src/providers/anthropic.ts:770` for Anthropic-compat, `openai.ts:904` for OpenAI-compat) forwards image blocks automatically through base-class inheritance. The flag only gates whether KodaX's policy layer pre-rejects multimodal requests — the model-level vision contract remains your upstream provider's responsibility. If the model is actually text-only, you'll see the real upstream API error instead of a KodaX-side rejection.
|
|
372
|
-
|
|
373
|
-
### 3. Start in REPL or run a one-shot task
|
|
374
|
-
|
|
375
|
-
```bash
|
|
376
|
-
# Interactive REPL
|
|
377
|
-
kodax
|
|
378
|
-
|
|
379
|
-
# Then ask naturally inside the REPL
|
|
380
|
-
Read package.json and summarize the architecture
|
|
381
|
-
/mode
|
|
382
|
-
/help
|
|
383
|
-
|
|
384
|
-
# One-shot CLI usage
|
|
385
|
-
kodax "Review this repository and summarize the architecture"
|
|
386
|
-
kodax --session review "Find the riskiest parts of src/"
|
|
387
|
-
kodax --session review "Give me concrete fix suggestions"
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
### 4. Use it as a library
|
|
391
|
-
|
|
392
|
-
Library usage still expects API keys from environment variables. If you want custom provider names or base URLs in code, register them explicitly:
|
|
393
|
-
|
|
394
|
-
```typescript
|
|
395
|
-
import { registerCustomProviders, runKodaX } from '@kodax-ai/kodax';
|
|
396
|
-
|
|
397
|
-
registerCustomProviders([
|
|
398
|
-
{
|
|
399
|
-
name: 'my-openai-compatible',
|
|
400
|
-
protocol: 'openai',
|
|
401
|
-
baseUrl: 'https://example.com/v1',
|
|
402
|
-
apiKeyEnv: 'MY_LLM_API_KEY',
|
|
403
|
-
model: 'my-model',
|
|
404
|
-
userAgentMode: 'compat',
|
|
405
|
-
},
|
|
406
|
-
]);
|
|
407
|
-
|
|
408
|
-
const result = await runKodaX(
|
|
409
|
-
{
|
|
410
|
-
provider: 'my-openai-compatible',
|
|
411
|
-
effort: 'auto',
|
|
412
|
-
},
|
|
413
|
-
'Explain this codebase'
|
|
414
|
-
);
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
> **Embedding KodaX inside another app?** (KodaX Space, IDE extensions, custom CLIs)
|
|
418
|
-
> See [public_docs/sdk/embedder-guide.md](public_docs/sdk/embedder-guide.md) for the runtime-mutation
|
|
419
|
-
> surface (`startKodaX` + `RunningSession`), MCP popout manager API (`McpManager`),
|
|
420
|
-
> Skill `` !`cmd` `` host hook, and per-app data dir namespacing (`getAppDataDir`).
|
|
421
|
-
|
|
422
|
-
## Runtime SDK and daemon
|
|
423
|
-
|
|
424
|
-
SDK hosts can use `@kodax-ai/kodax/runtime` in three forms: inline embedded for
|
|
425
|
-
lowest latency, Worker-hosted embedded for private state plus hard V8 disposal,
|
|
426
|
-
or a local daemon shared by REPL, Space, IDE adapters, and custom SDK clients.
|
|
427
|
-
All three expose the same `KodaXRuntime` services.
|
|
428
|
-
|
|
429
|
-
```ts
|
|
430
|
-
import { createKodaXRuntime } from '@kodax-ai/kodax/runtime';
|
|
431
|
-
|
|
432
|
-
const isolated = await createKodaXRuntime({
|
|
433
|
-
mode: 'embedded',
|
|
434
|
-
isolation: 'worker',
|
|
435
|
-
requirements: { hardDispose: true },
|
|
436
|
-
});
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
Inline is private and lowest-overhead; Worker is private and hard-disposable;
|
|
440
|
-
daemon is process-isolated and shared. `runtime.close()` closes private
|
|
441
|
-
inline/Worker ownership, but only detaches one daemon client. Contradictory
|
|
442
|
-
isolation options fail instead of silently selecting a weaker mode. Worker
|
|
443
|
-
isolation is a V8 fault boundary, not a security sandbox.
|
|
444
|
-
|
|
445
|
-
Because a daemon is intentionally persistent, tests that auto-start one must
|
|
446
|
-
also run `kodax daemon stop --home <dir> --profile <name>` (or send authenticated
|
|
447
|
-
`runtime.shutdown`) before deleting their temporary home. A remaining Node
|
|
448
|
-
process is not safe to kill by name alone; verify its command line and owner.
|
|
449
|
-
|
|
450
|
-
```bash
|
|
451
|
-
kodax daemon start
|
|
452
|
-
kodax daemon stop --profile default
|
|
453
|
-
kodax --runtime-mode daemon
|
|
454
|
-
kodax -p "Review this repository" --runtime-mode daemon
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
All CLI task forms now use the same Runtime path: interactive REPL, positional
|
|
458
|
-
prompts, slash-command prompts, and `kodax -p`. Select the persistent default in
|
|
459
|
-
`~/.kodax/config.json`:
|
|
460
|
-
|
|
461
|
-
```json
|
|
462
|
-
{
|
|
463
|
-
"runtimeMode": "daemon"
|
|
464
|
-
}
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
Resolution order is explicit CLI/SDK option > environment variable >
|
|
468
|
-
`config.json` > built-in default (`embedded`). `KODAX_RUNTIME_MODE=daemon` is a
|
|
469
|
-
temporary environment override. The same rule applies to other paired settings,
|
|
470
|
-
for example `provider` ↔ `KODAX_PROVIDER` and `effort` ↔ `KODAX_EFFORT`.
|
|
471
|
-
JSON names stay camelCase while environment names use `KODAX_UPPER_SNAKE_CASE`.
|
|
472
|
-
|
|
473
|
-
By default, daemon state, config, and runtime session storage use the exact
|
|
474
|
-
resolved `KODAX_HOME` (normally `<OS user home>/.kodax`), so CLI and SDK clients
|
|
475
|
-
converge on the same local daemon even when `KODAX_HOME` is an arbitrary custom
|
|
476
|
-
directory. The high-level `createKodaXRuntime({ mode: 'daemon' })` API starts or
|
|
477
|
-
reuses that daemon unless you pass an explicit endpoint/transport or
|
|
478
|
-
`autoStartDaemon: false`. An explicit `--home <dir>` or `homeDir` selects the
|
|
479
|
-
isolated `<dir>/.kodax` namespace for tests, CI, or project-local experiments.
|
|
480
|
-
|
|
481
|
-
**v0.7.71 packaged Electron patch:** packaged/asar Electron hosts can use daemon
|
|
482
|
-
auto-start without relaunching the GUI. `ELECTRON_RUN_AS_NODE` is limited to a
|
|
483
|
-
bootstrap-only child exec boundary and removed before daemon or ordinary user
|
|
484
|
-
child code loads. The default-enabled Electron `RunAsNode` fuse is required;
|
|
485
|
-
hosts that disable it must start the daemon through ordinary Node/KodaX CLI and
|
|
486
|
-
connect in attach-only mode. For SDK calls, `homeDir` is the CLI-style base
|
|
487
|
-
directory that owns `.kodax`, not the `.kodax` path itself.
|
|
488
|
-
|
|
489
|
-
**v0.7.75 Windows GUI stabilization candidate:** Runtime Worker-reachable
|
|
490
|
-
non-interactive subprocesses request hidden Windows consoles across memory/Git,
|
|
491
|
-
provider CLI/ACP, LSP, clipboard, worktree, review, extension-command,
|
|
492
|
-
checkpoint, and sandbox paths. Explicit editor, terminal, and PTY behavior is
|
|
493
|
-
unchanged. The SDK bundle includes a static child-process audit and a packaged
|
|
494
|
-
Electron 20-query console-visibility regression. Product-level packaged KodaX
|
|
495
|
-
Space verification remains useful but does not gate SDK packaging or
|
|
496
|
-
publication.
|
|
497
|
-
|
|
498
|
-
The same candidate distinguishes optional post-completion offers from
|
|
499
|
-
clarification required to finish the current request, emits budget-approval
|
|
500
|
-
state only for eligible Sidecar revisions, and preserves structured blocked
|
|
501
|
-
reasons across embedded and daemon Runtime boundaries.
|
|
502
|
-
|
|
503
|
-
**v0.7.76 Kimi Code catalog refresh:** `kimi-code` now defaults to the official
|
|
504
|
-
`k3-256k` Model ID and sends it unchanged. `kimi-for-coding` remains selectable
|
|
505
|
-
for K2.7 Code, alongside `kimi-for-coding-highspeed` and the 1M `k3` tier. K3
|
|
506
|
-
supports `low` / `high` / `max` reasoning with `high` as default; the 256K
|
|
507
|
-
route supports image input but not video input.
|
|
508
|
-
|
|
509
|
-
**v0.7.77 release:** AMA now chooses and composes six named
|
|
510
|
-
problem-solving patterns through the existing Actor control plane instead of
|
|
511
|
-
using a fixed topology or hidden Workflow. Optional strategy metadata becomes
|
|
512
|
-
a bounded, fact-only `PatternTrace`; the existing Sidecar remains the only
|
|
513
|
-
terminal-answer quality judge. Governed memory can also react sparsely after a
|
|
514
|
-
tool failure, verification failure, or committed compaction and place at most
|
|
515
|
-
three prompt-safe, low-authority evidence items before the next Action-LLM
|
|
516
|
-
request. The default path adds no selector model call; SDK hosts may opt into
|
|
517
|
-
`memoryRecallRunner` in process. Public `kimi` also gains the 1M `kimi-k3`
|
|
518
|
-
route while retaining K2.7 Code as its default. See the
|
|
519
|
-
[v0.7.77 design](docs/features/v0.7.77.md) and
|
|
520
|
-
[release checklist](docs/release.md#v0777-release-ready-candidate-verification).
|
|
521
|
-
The frozen F274/F275 paid evaluation completed with `recommend-ship` from the
|
|
522
|
-
final F274 Layer 2/Layer 3 reviews and the F275 pilot review, followed by a
|
|
523
|
-
joint `SHIP` decision for the deterministic contracts. Semantic memory
|
|
524
|
-
selection remains experimental and host opt-in; no task-quality, token, or
|
|
525
|
-
latency improvement is claimed.
|
|
526
|
-
|
|
527
|
-
**v0.7.78 evidence-gated learning, setup, and permission/sandbox release:**
|
|
528
|
-
Background learning is Memory-first. Only repeated independently verified
|
|
529
|
-
evidence, or an explicit preserve-as-Skill request with verified terminal
|
|
530
|
-
evidence, can admit a low-risk declarative Skill to a bounded immutable
|
|
531
|
-
project canary; three exact-revision uses and independently verified success
|
|
532
|
-
are required before automatic project trust. Every revision remains visible
|
|
533
|
-
and reversible in `/learn`. Protected/formal Skills, global promotion, and
|
|
534
|
-
Extension authoring remain explicit user actions.
|
|
535
|
-
|
|
536
|
-
First-run setup now creates and validates the split core/MCP/Extensions/A2A
|
|
537
|
-
files and annotated templates without overwriting existing configuration or
|
|
538
|
-
collecting secrets. Auto[LLM] admits precisely modeled ordinary reads and
|
|
539
|
-
workspace/temp mutations before classifier latency, retries classifier
|
|
540
|
-
infrastructure failure once, then falls back at the Accept-edits boundary
|
|
541
|
-
without switching to rules. ASRT is optional execution containment rather
|
|
542
|
-
than permission authority; `/sandbox` is the explicit diagnostic surface, and
|
|
543
|
-
SDK hosts can use the standalone `/sandbox` subpath without a silent
|
|
544
|
-
unsandboxed fallback. KodaX's workspace containment denies reads from common
|
|
545
|
-
home credential paths and the complete resolved agent home without turning
|
|
546
|
-
ordinary external reads into an allowlist. See the
|
|
547
|
-
[v0.7.78 design](docs/features/v0.7.78.md), the
|
|
548
|
-
[release checklist](docs/release.md#v0778-release-verification), and
|
|
549
|
-
[SDK guide sections 29–30](public_docs/sdk/embedder-guide.md#29-evidence-gated-background-skill-learning-feature_263-v0778).
|
|
550
|
-
|
|
551
|
-
The release closure also preserves intent across adjacent surfaces: static
|
|
552
|
-
Skill instructions load in Edit/Plan without granting later side effects,
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="assets/logo-light.svg">
|
|
5
|
+
<img src="assets/logo-light.svg" alt="KodaX" width="640">
|
|
6
|
+
</picture>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<b>Source-available AI coding agent on every LLM you can reach.</b><br>
|
|
11
|
+
Anthropic · OpenAI · DeepSeek · Kimi · Zhipu · MiniMax · MiMo · Ark · Qwen · Gemini · Codex.<br>
|
|
12
|
+
REPL · CLI · library · Node-free single binary.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://www.npmjs.com/package/@kodax-ai/kodax"><img alt="npm version" src="https://img.shields.io/npm/v/@kodax-ai/kodax?style=flat-square&color=cb3837"></a>
|
|
17
|
+
<a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-KAI--FCL_1.0-orange?style=flat-square"></a>
|
|
18
|
+
<a href="https://github.com/icetomoyo/KodaX/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/icetomoyo/KodaX?style=flat-square&logo=github&color=f1c40f"></a>
|
|
19
|
+
<a href="https://github.com/icetomoyo/KodaX/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/icetomoyo/KodaX/release.yml?style=flat-square&label=release"></a>
|
|
20
|
+
<img alt="providers" src="https://img.shields.io/badge/LLMs-16_aliases_+_custom-2ecc71?style=flat-square">
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<a href="#install-in-30-seconds">Install</a> ·
|
|
25
|
+
<a href="#four-ways-to-use-kodax">Usage</a> ·
|
|
26
|
+
<a href="#sdk-usage">SDK</a> ·
|
|
27
|
+
<a href="CHANGELOG.md">Changelog</a> ·
|
|
28
|
+
<a href="docs/FEATURE_LIST.md">Roadmap</a> ·
|
|
29
|
+
<a href="https://github.com/icetomoyo/KodaX/discussions">Discussions</a> ·
|
|
30
|
+
<a href="README_CN.md">中文 README</a>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<img src="kodax-hd.gif" alt="KodaX in action" width="880">
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Install in 30 seconds
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm i -g @kodax-ai/kodax
|
|
43
|
+
|
|
44
|
+
# Pick any one you have an API key for (`kodax setup --help` lists all):
|
|
45
|
+
export ZHIPU_API_KEY=... # ANTHROPIC_API_KEY / OPENAI_API_KEY / DEEPSEEK_API_KEY /
|
|
46
|
+
# KIMI_API_KEY / KIMI_CODE_API_KEY / QWEN_API_KEY /
|
|
47
|
+
# QWEN_TOKEN_API_KEY / ZHIPU_CODING_API_KEY /
|
|
48
|
+
# ZAI_CODING_API_KEY / MINIMAX_CODING_API_KEY /
|
|
49
|
+
# MIMO_API_KEY / MIMO_CODING_API_KEY / ARK_CODING_API_KEY
|
|
50
|
+
|
|
51
|
+
kodax
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
That's it. You're in the REPL — ask anything in natural language. On a new
|
|
55
|
+
machine, bare interactive `kodax` first checks for supported API-key environment
|
|
56
|
+
variables. If none exists, KodaX only prints Windows, macOS, and Linux setup
|
|
57
|
+
instructions and exits without creating configuration or collecting a key.
|
|
58
|
+
After setting the variable, close the current terminal, open a new one, and run
|
|
59
|
+
`kodax` again. If a supported credential exists but no provider is selected,
|
|
60
|
+
KodaX opens the provider/model metadata setup. Use `kodax setup` to rerun the
|
|
61
|
+
flow, `kodax setup --custom` for a guided custom provider, and
|
|
62
|
+
`kodax setup --help` (or REPL `/setup --help`) for paths, provider variables,
|
|
63
|
+
commands, and shortcuts. Interactive setup also checks the optional ASRT sandbox once:
|
|
64
|
+
Windows may show a one-time UAC prompt; macOS/Linux report any required
|
|
65
|
+
Seatbelt/bubblewrap dependencies. Declining or missing a dependency does not
|
|
66
|
+
break ordinary permission handling, and normal startup will not keep reminding
|
|
67
|
+
you.
|
|
68
|
+
|
|
69
|
+
> **No-Node target machines:** download a Bun-compiled single binary for Windows / macOS / Linux × x64 + arm64 from the [GitHub Releases](https://github.com/icetomoyo/KodaX/releases) page. See [docs/release.md](docs/release.md) for the build pipeline.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Four ways to use KodaX
|
|
74
|
+
|
|
75
|
+
| Form | Command / Import | When to use it |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| **REPL** | `kodax` | Interactive multi-turn coding session with streaming UI, permissions, slash commands |
|
|
78
|
+
| **CLI** | `kodax -p "your task"` | One-shot scripted task, CI runs, batch processing |
|
|
79
|
+
| **Library** | `import { runKodaX } from '@kodax-ai/kodax'` | Embed in your own tool / agent / web service |
|
|
80
|
+
| **Single binary** | `./kodax` | Distribute to machines that don't have Node installed |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Why KodaX
|
|
85
|
+
|
|
86
|
+
<table>
|
|
87
|
+
<tr>
|
|
88
|
+
<td width="33%" align="center" valign="top">
|
|
89
|
+
<h3>🇨🇳 6 China-native LLMs</h3>
|
|
90
|
+
<sub>Zhipu · Kimi · MiniMax · MiMo · Ark · Qwen</sub>
|
|
91
|
+
<br><br>
|
|
92
|
+
First-class adapters with cross-provider <a href="benchmark/EVAL_GUIDELINES.md">prompt-eval calibration</a> on a canonical 5-alias panel — not OpenAI-compat shims.
|
|
93
|
+
</td>
|
|
94
|
+
<td width="33%" align="center" valign="top">
|
|
95
|
+
<h3>📦 Single-file binary</h3>
|
|
96
|
+
<sub>Bun --compile · Win / macOS / Linux · x64 + arm64</sub>
|
|
97
|
+
<br><br>
|
|
98
|
+
No Node required on the target machine. Drop one file, run anywhere — restricted envs, CI runners, air-gapped boxes.
|
|
99
|
+
</td>
|
|
100
|
+
<td width="33%" align="center" valign="top">
|
|
101
|
+
<h3>🌳 Branchable session lineage</h3>
|
|
102
|
+
<sub>Fork · rewind · parallel edit</sub>
|
|
103
|
+
<br><br>
|
|
104
|
+
Conversation history is a DAG, not a list. Powers the upcoming <b>KodaX Space</b> desktop app.
|
|
105
|
+
</td>
|
|
106
|
+
</tr>
|
|
107
|
+
<tr>
|
|
108
|
+
<td align="center" valign="top">
|
|
109
|
+
<h3>🤖 Multi-agent by default</h3>
|
|
110
|
+
<sub>V2 Worker single-loop + Sidecar Verifier + async children</sub>
|
|
111
|
+
<br><br>
|
|
112
|
+
<code>spawn_agent</code>, <code>send_message</code>, <code>followup_task</code>, <code>interrupt_agent</code>, multi-instance auto-coordination with content-hash safety net.
|
|
113
|
+
</td>
|
|
114
|
+
<td align="center" valign="top">
|
|
115
|
+
<h3>🧩 Skills + self-construction</h3>
|
|
116
|
+
<sub>Markdown skills, NL triggers</sub>
|
|
117
|
+
<br><br>
|
|
118
|
+
5-stage self-modification staircase (scaffold → validate → stage → test → activate) gated by an 8-invariant admission contract.
|
|
119
|
+
</td>
|
|
120
|
+
<td align="center" valign="top">
|
|
121
|
+
<h3>🛠 50+ built-in tools</h3>
|
|
122
|
+
<sub>File · shell · search · MCP · ACP</sub>
|
|
123
|
+
<br><br>
|
|
124
|
+
Repo intelligence, semantic search, git worktree, web fetch — all addressable through one clean tool surface.
|
|
125
|
+
</td>
|
|
126
|
+
</tr>
|
|
127
|
+
</table>
|
|
128
|
+
|
|
129
|
+
## How KodaX compares
|
|
130
|
+
|
|
131
|
+
| Feature | **KodaX** | Claude Code | Aider | Codex CLI | Cursor | Cline |
|
|
132
|
+
|---|---|---|---|---|---|---|
|
|
133
|
+
| Source license | ⚠️ KAI-FCL, non-commercial | ❌ Source-available | ✅ Apache 2.0 | ✅ Apache 2.0 | ❌ Proprietary | ✅ Apache 2.0 |
|
|
134
|
+
| Node-free single binary | ✅ Bun | ❌ Node | ❌ Python | ✅ Rust | ❌ Electron | ❌ Extension |
|
|
135
|
+
| Native China providers<br><sub>(Zhipu · Kimi · MiniMax · MiMo · Ark · Qwen)</sub> | ✅ 6 native | ❌ | ⚠ via LiteLLM | ❌ OpenAI-first | ❌ no provider menu | ⚠ Kimi / Qwen / DeepSeek |
|
|
136
|
+
| Branchable session lineage | ✅ fork & rewind | ⚠ routines / sessions | ❌ | ❌ | ❌ | ⚠ checkpoints |
|
|
137
|
+
| Multi-agent + MCP + 50+ tools | ✅ all three | ✅ all three | ⚠ tools, no MCP | ✅ all three | ⚠ Composer + MCP | ✅ all three |
|
|
138
|
+
|
|
139
|
+
<sub>Data verified May 2026 against public docs ([Claude Code](https://github.com/anthropics/claude-code) · [Aider](https://aider.chat/docs/llms.html) · [Codex CLI](https://github.com/openai/codex) · [Cursor](https://cursor.com) · [Cline](https://github.com/cline/cline)). ⚠ = partial / requires extra setup / not first-class. Corrections welcome via PR.</sub>
|
|
140
|
+
|
|
141
|
+
## Detailed Setup
|
|
142
|
+
|
|
143
|
+
> The `npm i -g @kodax-ai/kodax` one-liner above is the fastest path. This section is for building from source, configuring custom providers, or using KodaX as a library.
|
|
144
|
+
|
|
145
|
+
### 1. Build the CLI from source
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
git clone https://github.com/icetomoyo/KodaX.git
|
|
149
|
+
cd KodaX
|
|
150
|
+
npm install
|
|
151
|
+
npm run build
|
|
152
|
+
npm link
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 2. Configure a provider
|
|
156
|
+
|
|
157
|
+
KodaX reads API keys from environment variables. For built-in providers, the fastest path is:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Interactive metadata-only provider/model setup (does not collect a key)
|
|
161
|
+
kodax setup
|
|
162
|
+
|
|
163
|
+
# Guided custom OpenAI/Anthropic-compatible provider
|
|
164
|
+
kodax setup --custom
|
|
165
|
+
|
|
166
|
+
# Complete guide; does not change files
|
|
167
|
+
kodax setup --help
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Setup checks these active files and matching `*.example.jsonc` references:
|
|
171
|
+
|
|
172
|
+
- `~/.kodax/config.json` and `~/.kodax/config.example.jsonc`
|
|
173
|
+
- `~/.kodax/integrations/mcp.json`
|
|
174
|
+
- `~/.kodax/integrations/extensions.json`
|
|
175
|
+
- `~/.kodax/integrations/a2a.json`
|
|
176
|
+
|
|
177
|
+
The core active file remains strict JSON. The first line of the annotated
|
|
178
|
+
`config.example.jsonc` points to all split files and documents every supported
|
|
179
|
+
core setting. Setup preserves existing files and stages readable legacy
|
|
180
|
+
`config.json#mcpServers` / `config.json#extensions` before creating empty
|
|
181
|
+
authoritative split files. It tells you the exact environment-variable name to
|
|
182
|
+
set and exits so you can restart the terminal. Existing active files are
|
|
183
|
+
validated first; an invalid file is reported without creating or overwriting
|
|
184
|
+
configuration. For a custom provider, setup asks for an `apiKeyEnv` name such
|
|
185
|
+
as `MY_LLM_API_KEY`, not the API key itself. `config.json` stores that name
|
|
186
|
+
only; after setup, set the environment variable with exactly that name to the
|
|
187
|
+
provider's actual API key. KodaX does not set the OS environment variable for
|
|
188
|
+
you. You can also configure it directly:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# macOS / Linux
|
|
192
|
+
export ZHIPU_API_KEY=your_api_key
|
|
193
|
+
|
|
194
|
+
# PowerShell
|
|
195
|
+
$env:ZHIPU_API_KEY="your_api_key"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 2.1 Activate the optional sandbox
|
|
199
|
+
|
|
200
|
+
`kodax setup` and first-run setup check sandbox readiness. You can inspect or
|
|
201
|
+
activate it explicitly:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
kodax sandbox doctor
|
|
205
|
+
kodax sandbox setup
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
- Windows uses a restricted sandbox account and network policy. A normal
|
|
209
|
+
terminal is sufficient; approve the one-time UAC prompt.
|
|
210
|
+
- macOS uses Seatbelt/`sandbox-exec` and requires ripgrep
|
|
211
|
+
(`brew install ripgrep`).
|
|
212
|
+
- Linux uses bubblewrap and requires `bubblewrap`, `socat`, and `ripgrep`
|
|
213
|
+
(install them with your distro's `apt`, `dnf`, or `pacman`).
|
|
214
|
+
|
|
215
|
+
KodaX never runs `sudo` or a package manager automatically. If the sandbox is
|
|
216
|
+
not active, deterministic safe operations and Auto[LLM] decisions keep the
|
|
217
|
+
same permission behavior; only OS-level containment is absent. Ordinary runs
|
|
218
|
+
do not repeatedly prompt for setup. In the REPL, `/sandbox` refreshes readiness
|
|
219
|
+
and diagnostics without activating the backend or requesting elevation.
|
|
220
|
+
Per-command sandbox routing remains internal and is not shown in normal command
|
|
221
|
+
history. SDK embedders can use the same capability independently through
|
|
222
|
+
`@kodax-ai/kodax/sandbox`; see the
|
|
223
|
+
[SDK sandbox guide](public_docs/sdk/embedder-guide.md#30-standalone-sandbox-sdk-v0778).
|
|
224
|
+
|
|
225
|
+
Credential-shaped environment variables are filtered from model-issued shell
|
|
226
|
+
commands by default. To expose exact host variables to those command targets,
|
|
227
|
+
including ASRT, add only their names to the user-level core config:
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"sandbox": {
|
|
232
|
+
"envPass": ["GH_TOKEN", "GITHUB_TOKEN", "OPENAI_API_KEY"]
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The default list is empty. Values remain in the host environment and are never
|
|
238
|
+
stored in `config.json`; project configuration cannot extend the list.
|
|
239
|
+
Matching is exact (case-insensitive on Windows), and execution-control
|
|
240
|
+
variables such as `NODE_OPTIONS` and `BASH_ENV` remain blocked. Restart KodaX
|
|
241
|
+
after changing the host variables or this setting; stop/restart a persistent
|
|
242
|
+
KodaX daemon so it receives the new environment and configuration.
|
|
243
|
+
SDK callers pass the same shape per Run as `KodaXOptions.sandbox`, so concurrent
|
|
244
|
+
Runs can use different lists without mutating process-global configuration.
|
|
245
|
+
|
|
246
|
+
For Qwen Token Plan, select `qwen-token-plan` and use its separate credential;
|
|
247
|
+
`QWEN_API_KEY` does not authenticate this route:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
export QWEN_TOKEN_API_KEY=your_api_key
|
|
251
|
+
kodax --provider qwen-token-plan
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
For CLI defaults, create `~/.kodax/config.json`:
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"provider": "zhipu-coding",
|
|
259
|
+
"effort": "auto"
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
If you need a custom base URL or an OpenAI/Anthropic-compatible endpoint, define a custom provider in the same config file:
|
|
264
|
+
|
|
265
|
+
```json
|
|
266
|
+
{
|
|
267
|
+
"provider": "my-openai-compatible",
|
|
268
|
+
"customProviders": [
|
|
269
|
+
{
|
|
270
|
+
"name": "my-openai-compatible",
|
|
271
|
+
"protocol": "openai",
|
|
272
|
+
"baseUrl": "https://example.com/v1",
|
|
273
|
+
"apiKeyEnv": "MY_LLM_API_KEY",
|
|
274
|
+
"model": "my-model",
|
|
275
|
+
"userAgentMode": "compat",
|
|
276
|
+
"reasoning": {
|
|
277
|
+
"efforts": ["off", "low", "medium", "high", "max"],
|
|
278
|
+
"default": "high"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Here, `"apiKeyEnv": "MY_LLM_API_KEY"` is a reference to an environment-variable
|
|
286
|
+
name, not an API key value. Put the custom provider's actual API key in the
|
|
287
|
+
`MY_LLM_API_KEY` environment variable, then close the current terminal and open
|
|
288
|
+
a new one before running `kodax`.
|
|
289
|
+
|
|
290
|
+
`userAgentMode` defaults to `"compat"`, which sends `KodaX` instead of the official SDK User-Agent. Switch it to `"sdk"` only when your gateway expects the upstream SDK header.
|
|
291
|
+
For custom reasoning models, `reasoning: { efforts, default }` is the preferred v0.7.57 shape; use `"reasoning": "none"` for models without thinking capability. SDK hosts should render effort pickers from `reasoningProfile.supportedEfforts` / `defaultEffort` rather than assuming a fixed five-option ladder.
|
|
292
|
+
|
|
293
|
+
#### OpenAI-compatible reasoning providers
|
|
294
|
+
|
|
295
|
+
Some OpenAI-compatible reasoning models require KodaX to replay the previous assistant turn's `reasoning_content` on later requests. DeepSeek V4 thinking mode is the known load-bearing case. Built-in DeepSeek already opts in; custom providers must say so explicitly:
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"customProviders": [
|
|
300
|
+
{
|
|
301
|
+
"name": "my-deepseek-v4",
|
|
302
|
+
"protocol": "openai",
|
|
303
|
+
"baseUrl": "https://example.com/v1",
|
|
304
|
+
"apiKeyEnv": "MY_DEEPSEEK_API_KEY",
|
|
305
|
+
"model": "deepseek-v4-flash",
|
|
306
|
+
"maxOutputTokensField": "max_tokens",
|
|
307
|
+
"reasoningPreset": "deepseek-v4-flash-openai",
|
|
308
|
+
"replayReasoningContent": true
|
|
309
|
+
}
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
DeepSeek Chat Completions uses `max_tokens`; OpenAI proper defaults to
|
|
315
|
+
`max_completion_tokens`. Keep `replayReasoningContent` unset or `false` for
|
|
316
|
+
OpenAI proper and gateways that reject unknown assistant-message fields. If one
|
|
317
|
+
gateway routes mixed models, prefer per-model overrides for both fields:
|
|
318
|
+
|
|
319
|
+
```json
|
|
320
|
+
{
|
|
321
|
+
"models": [
|
|
322
|
+
{
|
|
323
|
+
"id": "deepseek-v4-flash",
|
|
324
|
+
"maxOutputTokensField": "max_tokens",
|
|
325
|
+
"reasoningPreset": "deepseek-v4-flash-openai",
|
|
326
|
+
"replayReasoningContent": true
|
|
327
|
+
},
|
|
328
|
+
{ "id": "gpt-5", "replayReasoningContent": false }
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
If a custom endpoint is confirmed to support cache-affinity routing, set
|
|
334
|
+
`"promptCacheAffinity": true`. Anthropic-compatible requests then receive the
|
|
335
|
+
opaque logical-context key as `metadata.user_id`; OpenAI-compatible requests
|
|
336
|
+
receive `prompt_cache_key`. The default is `false` because some strict
|
|
337
|
+
compatible gateways reject unknown request fields. Do not enable it solely
|
|
338
|
+
because an endpoint claims protocol compatibility.
|
|
339
|
+
|
|
340
|
+
Sidecar verifier judge calls use provider-level forced tool choice when supported. If a compatible endpoint rejects the `tool_choice` parameter, KodaX retries that verifier request once without forced tool choice and still fails open rather than blocking the main Worker.
|
|
341
|
+
|
|
342
|
+
#### Opting a custom provider into image / vision input (FEATURE_134 v0.7.40)
|
|
343
|
+
|
|
344
|
+
If your custom provider's underlying model supports image input (vision), add a `capabilityProfile.multimodalSupport: "image-input"` block so KodaX does not artificially block multimodal requests at the SA-path policy gate. Built-in vision-capable aliases (Anthropic, OpenAI, compatible aliases such as Kimi, Qwen, Zhipu, MiniMax, MiMo, Ark, plus Gemini-CLI via the CLI's `@<path>` file-include syntax) already ship with this flag enabled by default. DeepSeek V4 and Codex-CLI are text-only; custom providers need to opt in when their underlying model supports image input.
|
|
345
|
+
|
|
346
|
+
```json
|
|
347
|
+
{
|
|
348
|
+
"customProviders": [
|
|
349
|
+
{
|
|
350
|
+
"name": "my-vision-provider",
|
|
351
|
+
"protocol": "openai",
|
|
352
|
+
"baseUrl": "https://example.com/v1",
|
|
353
|
+
"apiKeyEnv": "MY_LLM_API_KEY",
|
|
354
|
+
"model": "my-vision-model",
|
|
355
|
+
"capabilityProfile": {
|
|
356
|
+
"transport": "native-api",
|
|
357
|
+
"conversationSemantics": "full-history",
|
|
358
|
+
"mcpSupport": "none",
|
|
359
|
+
"contextFidelity": "full",
|
|
360
|
+
"toolCallingFidelity": "full",
|
|
361
|
+
"sessionSupport": "full",
|
|
362
|
+
"longRunningSupport": "full",
|
|
363
|
+
"multimodalSupport": "image-input",
|
|
364
|
+
"evidenceSupport": "full"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
The serializer layer (`packages/llm/src/providers/anthropic.ts:770` for Anthropic-compat, `openai.ts:904` for OpenAI-compat) forwards image blocks automatically through base-class inheritance. The flag only gates whether KodaX's policy layer pre-rejects multimodal requests — the model-level vision contract remains your upstream provider's responsibility. If the model is actually text-only, you'll see the real upstream API error instead of a KodaX-side rejection.
|
|
372
|
+
|
|
373
|
+
### 3. Start in REPL or run a one-shot task
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
# Interactive REPL
|
|
377
|
+
kodax
|
|
378
|
+
|
|
379
|
+
# Then ask naturally inside the REPL
|
|
380
|
+
Read package.json and summarize the architecture
|
|
381
|
+
/mode
|
|
382
|
+
/help
|
|
383
|
+
|
|
384
|
+
# One-shot CLI usage
|
|
385
|
+
kodax "Review this repository and summarize the architecture"
|
|
386
|
+
kodax --session review "Find the riskiest parts of src/"
|
|
387
|
+
kodax --session review "Give me concrete fix suggestions"
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### 4. Use it as a library
|
|
391
|
+
|
|
392
|
+
Library usage still expects API keys from environment variables. If you want custom provider names or base URLs in code, register them explicitly:
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
import { registerCustomProviders, runKodaX } from '@kodax-ai/kodax';
|
|
396
|
+
|
|
397
|
+
registerCustomProviders([
|
|
398
|
+
{
|
|
399
|
+
name: 'my-openai-compatible',
|
|
400
|
+
protocol: 'openai',
|
|
401
|
+
baseUrl: 'https://example.com/v1',
|
|
402
|
+
apiKeyEnv: 'MY_LLM_API_KEY',
|
|
403
|
+
model: 'my-model',
|
|
404
|
+
userAgentMode: 'compat',
|
|
405
|
+
},
|
|
406
|
+
]);
|
|
407
|
+
|
|
408
|
+
const result = await runKodaX(
|
|
409
|
+
{
|
|
410
|
+
provider: 'my-openai-compatible',
|
|
411
|
+
effort: 'auto',
|
|
412
|
+
},
|
|
413
|
+
'Explain this codebase'
|
|
414
|
+
);
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
> **Embedding KodaX inside another app?** (KodaX Space, IDE extensions, custom CLIs)
|
|
418
|
+
> See [public_docs/sdk/embedder-guide.md](public_docs/sdk/embedder-guide.md) for the runtime-mutation
|
|
419
|
+
> surface (`startKodaX` + `RunningSession`), MCP popout manager API (`McpManager`),
|
|
420
|
+
> Skill `` !`cmd` `` host hook, and per-app data dir namespacing (`getAppDataDir`).
|
|
421
|
+
|
|
422
|
+
## Runtime SDK and daemon
|
|
423
|
+
|
|
424
|
+
SDK hosts can use `@kodax-ai/kodax/runtime` in three forms: inline embedded for
|
|
425
|
+
lowest latency, Worker-hosted embedded for private state plus hard V8 disposal,
|
|
426
|
+
or a local daemon shared by REPL, Space, IDE adapters, and custom SDK clients.
|
|
427
|
+
All three expose the same `KodaXRuntime` services.
|
|
428
|
+
|
|
429
|
+
```ts
|
|
430
|
+
import { createKodaXRuntime } from '@kodax-ai/kodax/runtime';
|
|
431
|
+
|
|
432
|
+
const isolated = await createKodaXRuntime({
|
|
433
|
+
mode: 'embedded',
|
|
434
|
+
isolation: 'worker',
|
|
435
|
+
requirements: { hardDispose: true },
|
|
436
|
+
});
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
Inline is private and lowest-overhead; Worker is private and hard-disposable;
|
|
440
|
+
daemon is process-isolated and shared. `runtime.close()` closes private
|
|
441
|
+
inline/Worker ownership, but only detaches one daemon client. Contradictory
|
|
442
|
+
isolation options fail instead of silently selecting a weaker mode. Worker
|
|
443
|
+
isolation is a V8 fault boundary, not a security sandbox.
|
|
444
|
+
|
|
445
|
+
Because a daemon is intentionally persistent, tests that auto-start one must
|
|
446
|
+
also run `kodax daemon stop --home <dir> --profile <name>` (or send authenticated
|
|
447
|
+
`runtime.shutdown`) before deleting their temporary home. A remaining Node
|
|
448
|
+
process is not safe to kill by name alone; verify its command line and owner.
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
kodax daemon start
|
|
452
|
+
kodax daemon stop --profile default
|
|
453
|
+
kodax --runtime-mode daemon
|
|
454
|
+
kodax -p "Review this repository" --runtime-mode daemon
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
All CLI task forms now use the same Runtime path: interactive REPL, positional
|
|
458
|
+
prompts, slash-command prompts, and `kodax -p`. Select the persistent default in
|
|
459
|
+
`~/.kodax/config.json`:
|
|
460
|
+
|
|
461
|
+
```json
|
|
462
|
+
{
|
|
463
|
+
"runtimeMode": "daemon"
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Resolution order is explicit CLI/SDK option > environment variable >
|
|
468
|
+
`config.json` > built-in default (`embedded`). `KODAX_RUNTIME_MODE=daemon` is a
|
|
469
|
+
temporary environment override. The same rule applies to other paired settings,
|
|
470
|
+
for example `provider` ↔ `KODAX_PROVIDER` and `effort` ↔ `KODAX_EFFORT`.
|
|
471
|
+
JSON names stay camelCase while environment names use `KODAX_UPPER_SNAKE_CASE`.
|
|
472
|
+
|
|
473
|
+
By default, daemon state, config, and runtime session storage use the exact
|
|
474
|
+
resolved `KODAX_HOME` (normally `<OS user home>/.kodax`), so CLI and SDK clients
|
|
475
|
+
converge on the same local daemon even when `KODAX_HOME` is an arbitrary custom
|
|
476
|
+
directory. The high-level `createKodaXRuntime({ mode: 'daemon' })` API starts or
|
|
477
|
+
reuses that daemon unless you pass an explicit endpoint/transport or
|
|
478
|
+
`autoStartDaemon: false`. An explicit `--home <dir>` or `homeDir` selects the
|
|
479
|
+
isolated `<dir>/.kodax` namespace for tests, CI, or project-local experiments.
|
|
480
|
+
|
|
481
|
+
**v0.7.71 packaged Electron patch:** packaged/asar Electron hosts can use daemon
|
|
482
|
+
auto-start without relaunching the GUI. `ELECTRON_RUN_AS_NODE` is limited to a
|
|
483
|
+
bootstrap-only child exec boundary and removed before daemon or ordinary user
|
|
484
|
+
child code loads. The default-enabled Electron `RunAsNode` fuse is required;
|
|
485
|
+
hosts that disable it must start the daemon through ordinary Node/KodaX CLI and
|
|
486
|
+
connect in attach-only mode. For SDK calls, `homeDir` is the CLI-style base
|
|
487
|
+
directory that owns `.kodax`, not the `.kodax` path itself.
|
|
488
|
+
|
|
489
|
+
**v0.7.75 Windows GUI stabilization candidate:** Runtime Worker-reachable
|
|
490
|
+
non-interactive subprocesses request hidden Windows consoles across memory/Git,
|
|
491
|
+
provider CLI/ACP, LSP, clipboard, worktree, review, extension-command,
|
|
492
|
+
checkpoint, and sandbox paths. Explicit editor, terminal, and PTY behavior is
|
|
493
|
+
unchanged. The SDK bundle includes a static child-process audit and a packaged
|
|
494
|
+
Electron 20-query console-visibility regression. Product-level packaged KodaX
|
|
495
|
+
Space verification remains useful but does not gate SDK packaging or
|
|
496
|
+
publication.
|
|
497
|
+
|
|
498
|
+
The same candidate distinguishes optional post-completion offers from
|
|
499
|
+
clarification required to finish the current request, emits budget-approval
|
|
500
|
+
state only for eligible Sidecar revisions, and preserves structured blocked
|
|
501
|
+
reasons across embedded and daemon Runtime boundaries.
|
|
502
|
+
|
|
503
|
+
**v0.7.76 Kimi Code catalog refresh:** `kimi-code` now defaults to the official
|
|
504
|
+
`k3-256k` Model ID and sends it unchanged. `kimi-for-coding` remains selectable
|
|
505
|
+
for K2.7 Code, alongside `kimi-for-coding-highspeed` and the 1M `k3` tier. K3
|
|
506
|
+
supports `low` / `high` / `max` reasoning with `high` as default; the 256K
|
|
507
|
+
route supports image input but not video input.
|
|
508
|
+
|
|
509
|
+
**v0.7.77 release:** AMA now chooses and composes six named
|
|
510
|
+
problem-solving patterns through the existing Actor control plane instead of
|
|
511
|
+
using a fixed topology or hidden Workflow. Optional strategy metadata becomes
|
|
512
|
+
a bounded, fact-only `PatternTrace`; the existing Sidecar remains the only
|
|
513
|
+
terminal-answer quality judge. Governed memory can also react sparsely after a
|
|
514
|
+
tool failure, verification failure, or committed compaction and place at most
|
|
515
|
+
three prompt-safe, low-authority evidence items before the next Action-LLM
|
|
516
|
+
request. The default path adds no selector model call; SDK hosts may opt into
|
|
517
|
+
`memoryRecallRunner` in process. Public `kimi` also gains the 1M `kimi-k3`
|
|
518
|
+
route while retaining K2.7 Code as its default. See the
|
|
519
|
+
[v0.7.77 design](docs/features/v0.7.77.md) and
|
|
520
|
+
[release checklist](docs/release.md#v0777-release-ready-candidate-verification).
|
|
521
|
+
The frozen F274/F275 paid evaluation completed with `recommend-ship` from the
|
|
522
|
+
final F274 Layer 2/Layer 3 reviews and the F275 pilot review, followed by a
|
|
523
|
+
joint `SHIP` decision for the deterministic contracts. Semantic memory
|
|
524
|
+
selection remains experimental and host opt-in; no task-quality, token, or
|
|
525
|
+
latency improvement is claimed.
|
|
526
|
+
|
|
527
|
+
**v0.7.78 evidence-gated learning, setup, and permission/sandbox release:**
|
|
528
|
+
Background learning is Memory-first. Only repeated independently verified
|
|
529
|
+
evidence, or an explicit preserve-as-Skill request with verified terminal
|
|
530
|
+
evidence, can admit a low-risk declarative Skill to a bounded immutable
|
|
531
|
+
project canary; three exact-revision uses and independently verified success
|
|
532
|
+
are required before automatic project trust. Every revision remains visible
|
|
533
|
+
and reversible in `/learn`. Protected/formal Skills, global promotion, and
|
|
534
|
+
Extension authoring remain explicit user actions.
|
|
535
|
+
|
|
536
|
+
First-run setup now creates and validates the split core/MCP/Extensions/A2A
|
|
537
|
+
files and annotated templates without overwriting existing configuration or
|
|
538
|
+
collecting secrets. Auto[LLM] admits precisely modeled ordinary reads and
|
|
539
|
+
workspace/temp mutations before classifier latency, retries classifier
|
|
540
|
+
infrastructure failure once, then falls back at the Accept-edits boundary
|
|
541
|
+
without switching to rules. ASRT is optional execution containment rather
|
|
542
|
+
than permission authority; `/sandbox` is the explicit diagnostic surface, and
|
|
543
|
+
SDK hosts can use the standalone `/sandbox` subpath without a silent
|
|
544
|
+
unsandboxed fallback. KodaX's workspace containment denies reads from common
|
|
545
|
+
home credential paths and the complete resolved agent home without turning
|
|
546
|
+
ordinary external reads into an allowlist. See the
|
|
547
|
+
[v0.7.78 design](docs/features/v0.7.78.md), the
|
|
548
|
+
[release checklist](docs/release.md#v0778-release-verification), and
|
|
549
|
+
[SDK guide sections 29–30](public_docs/sdk/embedder-guide.md#29-evidence-gated-background-skill-learning-feature_263-v0778).
|
|
550
|
+
|
|
551
|
+
The release closure also preserves intent across adjacent surfaces: static
|
|
552
|
+
Skill instructions load in Edit/Plan without granting later side effects,
|
|
553
553
|
dynamic Skill commands require an explicit host-controlled executor, root AMA
|
|
554
554
|
handles explicit remember/correct/forget requests immediately through the
|
|
555
555
|
governed `memory_intent` control plane while exceptional or inferred changes
|
|
556
556
|
remain reviewable, Workflow Actor waits remain
|
|
557
|
-
unbounded unless the workflow sets a deadline, and Runtime Auto capability v4
|
|
558
|
-
advertises `fallbackPersistsEngine:false` across embedded, Worker, and daemon
|
|
559
|
-
hosts. Actor ownership additionally uses Runtime identity rather than PID alone,
|
|
560
|
-
so PID reuse cannot pin a crashed owner. The resume Session picker also renders
|
|
561
|
-
timestamps in the host's local timezone.
|
|
562
|
-
|
|
563
|
-
**v0.7.79 release:** Configured outbound A2A Agents can persist two
|
|
564
|
-
independent, default-deny network permissions: private-address access and
|
|
565
|
-
non-loopback plaintext HTTP. The embedded Worker and shared daemon reconcile
|
|
566
|
-
and execute the same authorized configuration. Runtime embedders also gain one
|
|
567
|
-
authoritative Session status, bounded read-only diagnostics, byte-preserving
|
|
568
|
-
Session export, strict transcript observation, a provenance-checked ordinary
|
|
569
|
-
conversation projection, and bounded streaming-event coalescing with
|
|
570
|
-
capability-gated idle daemon upgrade. Standalone child-process, Session lineage,
|
|
571
|
-
shell cleanup, packaged sidecar, and parallel admission paths receive the
|
|
572
|
-
corresponding release hardening.
|
|
573
|
-
|
|
574
|
-
OpenAI-compatible custom providers can now choose `max_tokens` or
|
|
575
|
-
`max_completion_tokens` per provider or model. DeepSeek V4 Flash and Pro use
|
|
576
|
-
separate reasoning profiles and are advertised as text-only. See the
|
|
577
|
-
[v0.7.79 design](docs/features/v0.7.79.md) and
|
|
578
|
-
[release checklist](docs/release.md#v0779-release-preparation).
|
|
579
|
-
FEATURE_280 was explicitly rescheduled to v0.7.81 (then to v0.7.86 on
|
|
580
|
-
2026-08-04) and is not represented as shipped by this release.
|
|
581
|
-
Issue 256 was explicitly rescheduled to v0.7.84 and is likewise not represented
|
|
582
|
-
as shipped by this release.
|
|
583
|
-
|
|
584
|
-
**v0.7.80 hardening release:** The CLI honors `worker.configuredA2A` in
|
|
585
|
-
`~/.kodax/config.json`: the embedded Runtime becomes Worker-hosted and loads
|
|
586
|
-
the configured A2A plane inside the Worker owner, so configured outbound
|
|
587
|
-
Agents appear as `external:<name>` in `list_dispatchable_agents` and can be
|
|
588
|
-
dispatched with `spawn_agent`. The mode rejects configured MCP servers or
|
|
589
|
-
Extensions (they cannot cross the Worker boundary); use the default inline
|
|
590
|
-
Runtime to retain those capabilities. Worker-hosted embedded CLI sessions also
|
|
591
|
-
reduce run options to the JSON-safe wire DTO exactly like daemon mode instead of
|
|
592
|
-
crashing with `RuntimeTransportBoundaryError`. Auto permission analysis no
|
|
593
|
-
longer treats ordinary search scopes and tool metadata as unresolved, and a
|
|
594
|
-
`max_tokens`-truncated classifier retry uses a 1024-token budget (Issue 275).
|
|
595
|
-
Managed AMA turns now bound one uninterrupted tool loop by a 500-iteration
|
|
596
|
-
panic fuse that resets on every idle-yield resume — a runaway-loop breaker,
|
|
597
|
-
never a cumulative task budget — and a fused Runner fails with a structured
|
|
598
|
-
`RunnerIterationLimitError` carrying the recovery transcript. Managed-run
|
|
599
|
-
repetition loops are closed; parallel review and delegation guidance are
|
|
600
|
-
restored and tightened. FEATURE_278/279/282/283/285 were explicitly
|
|
601
|
-
rescheduled to v0.7.85, so v0.7.80 remains a debug/patch slot and no incomplete
|
|
602
|
-
feature is represented as shipped. See the
|
|
557
|
+
unbounded unless the workflow sets a deadline, and Runtime Auto capability v4
|
|
558
|
+
advertises `fallbackPersistsEngine:false` across embedded, Worker, and daemon
|
|
559
|
+
hosts. Actor ownership additionally uses Runtime identity rather than PID alone,
|
|
560
|
+
so PID reuse cannot pin a crashed owner. The resume Session picker also renders
|
|
561
|
+
timestamps in the host's local timezone.
|
|
562
|
+
|
|
563
|
+
**v0.7.79 release:** Configured outbound A2A Agents can persist two
|
|
564
|
+
independent, default-deny network permissions: private-address access and
|
|
565
|
+
non-loopback plaintext HTTP. The embedded Worker and shared daemon reconcile
|
|
566
|
+
and execute the same authorized configuration. Runtime embedders also gain one
|
|
567
|
+
authoritative Session status, bounded read-only diagnostics, byte-preserving
|
|
568
|
+
Session export, strict transcript observation, a provenance-checked ordinary
|
|
569
|
+
conversation projection, and bounded streaming-event coalescing with
|
|
570
|
+
capability-gated idle daemon upgrade. Standalone child-process, Session lineage,
|
|
571
|
+
shell cleanup, packaged sidecar, and parallel admission paths receive the
|
|
572
|
+
corresponding release hardening.
|
|
573
|
+
|
|
574
|
+
OpenAI-compatible custom providers can now choose `max_tokens` or
|
|
575
|
+
`max_completion_tokens` per provider or model. DeepSeek V4 Flash and Pro use
|
|
576
|
+
separate reasoning profiles and are advertised as text-only. See the
|
|
577
|
+
[v0.7.79 design](docs/features/v0.7.79.md) and
|
|
578
|
+
[release checklist](docs/release.md#v0779-release-preparation).
|
|
579
|
+
FEATURE_280 was explicitly rescheduled to v0.7.81 (then to v0.7.86 on
|
|
580
|
+
2026-08-04) and is not represented as shipped by this release.
|
|
581
|
+
Issue 256 was explicitly rescheduled to v0.7.84 and is likewise not represented
|
|
582
|
+
as shipped by this release.
|
|
583
|
+
|
|
584
|
+
**v0.7.80 hardening release:** The CLI honors `worker.configuredA2A` in
|
|
585
|
+
`~/.kodax/config.json`: the embedded Runtime becomes Worker-hosted and loads
|
|
586
|
+
the configured A2A plane inside the Worker owner, so configured outbound
|
|
587
|
+
Agents appear as `external:<name>` in `list_dispatchable_agents` and can be
|
|
588
|
+
dispatched with `spawn_agent`. The mode rejects configured MCP servers or
|
|
589
|
+
Extensions (they cannot cross the Worker boundary); use the default inline
|
|
590
|
+
Runtime to retain those capabilities. Worker-hosted embedded CLI sessions also
|
|
591
|
+
reduce run options to the JSON-safe wire DTO exactly like daemon mode instead of
|
|
592
|
+
crashing with `RuntimeTransportBoundaryError`. Auto permission analysis no
|
|
593
|
+
longer treats ordinary search scopes and tool metadata as unresolved, and a
|
|
594
|
+
`max_tokens`-truncated classifier retry uses a 1024-token budget (Issue 275).
|
|
595
|
+
Managed AMA turns now bound one uninterrupted tool loop by a 500-iteration
|
|
596
|
+
panic fuse that resets on every idle-yield resume — a runaway-loop breaker,
|
|
597
|
+
never a cumulative task budget — and a fused Runner fails with a structured
|
|
598
|
+
`RunnerIterationLimitError` carrying the recovery transcript. Managed-run
|
|
599
|
+
repetition loops are closed; parallel review and delegation guidance are
|
|
600
|
+
restored and tightened. FEATURE_278/279/282/283/285 were explicitly
|
|
601
|
+
rescheduled to v0.7.85, so v0.7.80 remains a debug/patch slot and no incomplete
|
|
602
|
+
feature is represented as shipped. See the
|
|
603
603
|
[v0.7.80 release checklist](docs/release.md#v0780-release-preparation).
|
|
604
604
|
|
|
605
605
|
**v0.7.81 Runtime interrupt integrity release:** Active-Run inputs submitted
|
|
@@ -656,1252 +656,1290 @@ changes. Issue 256's remaining Worker owner-lease boundary is still open and
|
|
|
656
656
|
is scheduled for v0.7.86; this release does not claim descendant-closure proof
|
|
657
657
|
for that unresolved portion. See the [v0.7.85 release checklist](docs/release.md#v0785-release-preparation).
|
|
658
658
|
|
|
659
|
+
**v0.7.86 hardening release:** this patch release adds atomic recovery for
|
|
660
|
+
abandoned inline Runtime owners, process-start identity checks for Runtime and
|
|
661
|
+
learning locks, and Windows sandbox lifecycle attestation. Sandbox ACL owner
|
|
662
|
+
markers are durable and serialized across Runtime profiles; stop waits for
|
|
663
|
+
termination proof before ACL recovery, preserves combined cleanup failures, and
|
|
664
|
+
fences later filesystem effects instead of replaying a command whose process
|
|
665
|
+
tree was not proven drained. POSIX workspace sessions initialize fresh
|
|
666
|
+
`KODAX_HOME` policy roots before admission, settle workspace-local warm-up
|
|
667
|
+
within the Shell abort/deadline, and retire invalid sessions after lease-cleanup failure while
|
|
668
|
+
applying the same fail-closed replacement rule. Windows
|
|
669
|
+
workspace Shell calls also preserve the case-insensitive `PATH`/`Path` contract,
|
|
670
|
+
derive bounded PATH/executable read grants, and carry quoted `cmd.exe` arguments
|
|
671
|
+
through the broker without re-parsing. Commands with the same canonical
|
|
672
|
+
workspace, Agent Home, filesystem, toolchain, and network policy can share one
|
|
673
|
+
Windows sandbox policy group across KodaX processes. The filesystem-effect
|
|
674
|
+
coordinator now waits through its 30-second stale-owner proof window during a
|
|
675
|
+
legitimate process handoff, without extending the one-second fail-closed
|
|
676
|
+
boundary for conflicting effect categories. An incompatible policy or
|
|
677
|
+
pre-start sandbox infrastructure failure returns the already-authorized command
|
|
678
|
+
to normal permission execution; a command that started or may have started is
|
|
679
|
+
never replayed. Runtime sandbox capability v3 fences upgrades from older daemon
|
|
680
|
+
policy revisions. Issue
|
|
681
|
+
256's remaining Worker owner-lease boundary
|
|
682
|
+
stays open and was scheduled for v0.7.87. See the
|
|
683
|
+
[v0.7.86 release checklist](docs/release.md#v0786-release-preparation).
|
|
684
|
+
|
|
685
|
+
**v0.7.87 GLM provider release:** `zhipu-coding` now defaults to `glm-5.3`
|
|
686
|
+
and retains `glm-5.2` as an explicit rollback route. `zai-coding` retains both
|
|
687
|
+
models but defaults to `glm-5.2`, because GLM-5.3 availability on the overseas
|
|
688
|
+
Coding Plan is account-dependent. Both aliases send the upstream model IDs
|
|
689
|
+
verbatim: `glm-5.3` and `glm-5.2`, without a context suffix. GLM-5.3 is an
|
|
690
|
+
always-thinking model, so an `off` / `none` intent is lowered to `low` instead
|
|
691
|
+
of sending an unsupported disabled-thinking request; REPL controls do not offer
|
|
692
|
+
the impossible off rung and label a legacy saved choice as `off->low`. Issue 256's remaining
|
|
693
|
+
Worker owner-lease boundary is not part of this provider release and remains
|
|
694
|
+
open after v0.7.87; this release assigns no replacement target. See the
|
|
695
|
+
[v0.7.87 release checklist](docs/release.md#v0787-release-preparation).
|
|
696
|
+
|
|
659
697
|
The v0.7.77 release also adds an opt-in, host-configurable Shell Execution Contract.
|
|
660
|
-
Runtime Session settings or an individual Run can select `pwsh`, Windows
|
|
661
|
-
PowerShell, `cmd`, `bash`, `zsh`, or an explicit Git Bash executable; KodaX
|
|
662
|
-
resolves the shell environment in the effective project cwd and then executes
|
|
663
|
-
the command through that same interpreter. Resolved environments are isolated
|
|
664
|
-
by contract and cwd, expire after a bounded TTL, and can be explicitly
|
|
665
|
-
refreshed. Provider credentials and execution-control variables are removed
|
|
666
|
-
before profile/setup code and again before the command starts. Credential-shaped
|
|
667
|
-
variables are also filtered on the legacy platform-shell path; explicit names
|
|
668
|
-
in user-level `sandbox.envPass` are restored only for the final command target.
|
|
669
|
-
When `shellExecution` is absent, the established interpreter path is unchanged. See
|
|
670
|
-
[SDK Embedder Guide section 28](public_docs/sdk/embedder-guide.md#28-host-configurable-shell-execution-contract-v0777)
|
|
671
|
-
and the [Issue 214 regression guide](docs/test-guides/ISSUE_214_v0.7.77_REGRESSION_GUIDE.md).
|
|
672
|
-
|
|
673
|
-
Kimi Code requests also receive a stable, opaque prompt-cache affinity key
|
|
674
|
-
derived from the logical Runtime context. It is reused across Runs, retries,
|
|
675
|
-
fallback, resume, and compaction; recursive child Agents receive distinct keys
|
|
676
|
-
based on their canonical Agent path rather than their temporary transcript
|
|
677
|
-
Session. Public Kimi and official OpenAI use the corresponding
|
|
678
|
-
`prompt_cache_key` field, while other compatible gateways remain opt-in because
|
|
679
|
-
some reject unknown request fields. This improves routing stability but cannot
|
|
680
|
-
override Provider TTL or cache sharding. See the
|
|
681
|
-
[Issue 215 regression guide](docs/test-guides/ISSUE_215_v0.7.77_REGRESSION_GUIDE.md).
|
|
682
|
-
Codex CLI cache reads/writes and Gemini CLI cache reads now flow through the
|
|
683
|
-
CLI bridge and Runtime diagnostics without estimation. A reported `0` remains
|
|
684
|
-
distinct from an unreported field; see the
|
|
685
|
-
[Issue 216 regression guide](docs/test-guides/ISSUE_216_v0.7.77_REGRESSION_GUIDE.md).
|
|
686
|
-
The bridge also starts the first native CLI turn fresh, resumes only a native
|
|
687
|
-
session ID reported by that CLI, creates fresh ACP sessions for stateless
|
|
688
|
-
calls, recreates a closed pseudo transport, and validates the process exit even
|
|
689
|
-
after a terminal CLI event. User cancellation stays quiet, while hard/idle
|
|
690
|
-
timeout aborts remain failures eligible for Runtime recovery, and a CLI that
|
|
691
|
-
reports success but never exits is terminated at its configured deadline; see the
|
|
692
|
-
[Issue 217 regression guide](docs/test-guides/ISSUE_217_v0.7.77_REGRESSION_GUIDE.md).
|
|
693
|
-
|
|
694
|
-
One daemon owns many sessions. Different sessions may run concurrently; starts
|
|
695
|
-
within the same session are queued so that only one run is active for that
|
|
696
|
-
session. Multiple `kodax` processes can attach to the same daemon and open or
|
|
697
|
-
observe the same session. FEATURE_269 adds atomic snapshot-plus-stream joining,
|
|
698
|
-
durable idempotent mutations, revision-safe settings and grants, transport-safe
|
|
699
|
-
AskUser/permission responses, run-scoped credential and Host Tool bridges, and
|
|
700
|
-
one daemon/inline Coder owner fence. In-flight external effects are never
|
|
701
|
-
blindly replayed after a crash; clients receive explicit interrupted/unknown
|
|
702
|
-
terminal facts and resync when `runtimeId` changes.
|
|
703
|
-
|
|
704
|
-
Space and IDE hosts should require these capabilities through the Runtime SDK.
|
|
705
|
-
Partner remains on its private inline Runtime and must use a distinct product
|
|
706
|
-
data/session root. A missing daemon capability is an error, not permission to
|
|
707
|
-
silently fall back to inline Coder.
|
|
708
|
-
|
|
709
|
-
For the full host-integration contract, including inline/Worker/daemon selection,
|
|
710
|
-
multi-client permission handling, config/catalog/MCP admin APIs, artifacts,
|
|
711
|
-
context diagnostics, and daemon protocol schemas, see
|
|
712
|
-
[public_docs/sdk/embedder-guide.md §17](public_docs/sdk/embedder-guide.md#17-runtime-sdk-worker-isolation-and-local-daemon-feature_253-feature_257).
|
|
713
|
-
|
|
714
|
-
The Space/IDE shared-daemon contract is documented in
|
|
715
|
-
[SDK Embedder Guide section 23](public_docs/sdk/embedder-guide.md#23-shared-coder-daemon-for-space-and-ide-hosts-feature_269-v0769).
|
|
716
|
-
|
|
717
|
-
**v0.7.72–v0.7.73 Runtime permission contract:** Auto Mode is owned by the Runtime session,
|
|
718
|
-
not by a UI hook. It reuses its LLM/rules guardrail across turns, classifies
|
|
719
|
-
before the shared permission bridge, and persists explicit engine selection.
|
|
720
|
-
The same session settings can select a classifier model and bounded
|
|
721
|
-
timeout; `auto` defaults to LLM classification and fails with a recoverable
|
|
722
|
-
configuration error when no effective classifier model exists, rather than
|
|
723
|
-
silently falling back. In v0.7.78, classifier failures retry once and then use
|
|
724
|
-
the Accept-edits safety boundary; they never change the engine to rules.
|
|
725
|
-
Runtime permission prompts offer opaque, exact
|
|
726
|
-
allow-once/session/persistent grant suggestions; persistent grants are
|
|
727
|
-
daemon-owned and revisioned. Host plan exit is exposed only when the host
|
|
728
|
-
supplies an approval callback. See the [Runtime Auto Mode integration guide](public_docs/sdk/embedder-guide.md#24-runtime-owned-auto-mode-and-plan-approval-bridges-v0772v0773).
|
|
729
|
-
|
|
730
|
-
## Repo Intelligence
|
|
731
|
-
|
|
732
|
-
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.
|
|
733
|
-
|
|
734
|
-
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.
|
|
735
|
-
|
|
736
|
-
```bash
|
|
737
|
-
# Pick a runtime mode (auto | full | light | off)
|
|
738
|
-
kodax --repo-intelligence full --repo-intelligence-trace
|
|
739
|
-
```
|
|
740
|
-
|
|
741
|
-
## Architecture
|
|
742
|
-
|
|
743
|
-
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 12 SDK subpath exports (`/agent`, `/llm`, `/coding`, `/media`, `/repl`, `/skills`, `/mcp`, `/session`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`; ADR-024 + ADR-032 + ADR-038, with ADR-036 consolidation):
|
|
744
|
-
|
|
745
|
-
```
|
|
746
|
-
KodaX/
|
|
747
|
-
├── packages/ # 4 workspace packages (FEATURE_194 v0.7.43)
|
|
748
|
-
│ ├── llm/ # @kodax-ai/llm - LLM abstraction (16 built-in provider aliases)
|
|
749
|
-
│ │ └── providers/ # Anthropic, OpenAI, DeepSeek, Kimi, MiMo, MiniMax, Zhipu, Ark, …
|
|
750
|
-
│ │
|
|
751
|
-
│ ├── agent/ # @kodax-ai/agent - Generic Agent framework
|
|
752
|
-
│ │ ├── actors/ # Runtime-owned Actor tree, scheduler, mailbox, events
|
|
753
|
-
│ │ ├── session-lineage/ # branchable session tree (inline v0.7.43)
|
|
754
|
-
│ │ ├── capabilities/
|
|
755
|
-
│ │ │ ├── mcp/ # MCP integration (inline v0.7.43)
|
|
756
|
-
│ │ │ └── skills/ # Skills standard implementation + builtin (inline v0.7.43)
|
|
757
|
-
│ │ └── tracing/ # tracing / observability (inline v0.7.43)
|
|
758
|
-
│ │
|
|
759
|
-
│ ├── coding/ # @kodax-ai/coding - Coding Agent (tools + prompts)
|
|
760
|
-
│ │ ├── tools/ # 50+ tools: read, write, edit, bash, glob, grep, undo,
|
|
761
|
-
│ │ │ # spawn_agent, send_message, followup_task, wait_agent,
|
|
762
|
-
│ │ │ # ask_user_question, repo-intelligence, …
|
|
763
|
-
│ │ └── repo-intelligence/ # incl. protocol.ts (inline v0.7.43)
|
|
764
|
-
│ │
|
|
765
|
-
│ └── repl/ # @kodax-ai/repl - Interactive terminal UI (Ink TUI)
|
|
766
|
-
│
|
|
767
|
-
├── src/ # CLI entry + SDK subpath entries
|
|
768
|
-
│ ├── kodax_cli.ts # Main CLI entry point (bin: `kodax`)
|
|
769
|
-
│ └── sdk-*.ts # SDK subpath re-exports → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session,runtime,sandbox,a2a,experimental-memory}
|
|
770
|
-
│
|
|
771
|
-
└── package.json # Publish-shaped exports; release.mjs only toggles private during pack/publish
|
|
772
|
-
```
|
|
773
|
-
|
|
774
|
-
### Package Dependencies
|
|
775
|
-
|
|
776
|
-
```
|
|
777
|
-
┌──────────────────┐
|
|
778
|
-
│ kodax (root) │
|
|
779
|
-
│ CLI Entry │
|
|
780
|
-
└────────┬─────────┘
|
|
781
|
-
│
|
|
782
|
-
┌──────────────┴──────────────┐
|
|
783
|
-
│ │
|
|
784
|
-
▼ ▼
|
|
785
|
-
┌──────────────┐ ┌────────────────┐
|
|
786
|
-
│@kodax-ai/repl│ │@kodax-ai/coding│
|
|
787
|
-
│ UI Layer │ │ Tools+Prompts │
|
|
788
|
-
└──────┬───────┘ └──────┬─────────┘
|
|
789
|
-
│ │
|
|
790
|
-
│ ┌──────────────┴──────────────┐
|
|
791
|
-
│ │ │
|
|
792
|
-
▼ ▼ ▼
|
|
793
|
-
┌──────────────┐ ┌──────────────────────────┐ ┌──────────────┐
|
|
794
|
-
│@kodax-ai/ │ │@kodax-ai/agent │ │@kodax-ai/llm │
|
|
795
|
-
│coding (via │ │Runner + fan-out + │ │LLM Abstract │
|
|
796
|
-
│above) │ │idle-yield + session- │ │(16 aliases) │
|
|
797
|
-
│ │ │lineage + skills + mcp + │ │ │
|
|
798
|
-
│ │ │tracing (FEATURE_194) │ │ │
|
|
799
|
-
└──────────────┘ └──────────────────────────┘ └──────────────┘
|
|
800
|
-
```
|
|
801
|
-
|
|
802
|
-
### Package Overview
|
|
803
|
-
|
|
804
|
-
Source-side workspace package names (`@kodax-ai/*`). npm consumers install the single bundled `@kodax-ai/kodax` package and import from SDK subpaths — see [Source-side vs npm-published surface](#source-side-vs-npm-published-surface) and [SDK Usage](#sdk-usage) below.
|
|
805
|
-
|
|
806
|
-
| Workspace package | Purpose | Key Dependencies |
|
|
807
|
-
|---------|---------|------------------|
|
|
808
|
-
| `@kodax-ai/llm` | LLM abstraction (16 built-in provider aliases + custom registration) | @anthropic-ai/sdk, openai |
|
|
698
|
+
Runtime Session settings or an individual Run can select `pwsh`, Windows
|
|
699
|
+
PowerShell, `cmd`, `bash`, `zsh`, or an explicit Git Bash executable; KodaX
|
|
700
|
+
resolves the shell environment in the effective project cwd and then executes
|
|
701
|
+
the command through that same interpreter. Resolved environments are isolated
|
|
702
|
+
by contract and cwd, expire after a bounded TTL, and can be explicitly
|
|
703
|
+
refreshed. Provider credentials and execution-control variables are removed
|
|
704
|
+
before profile/setup code and again before the command starts. Credential-shaped
|
|
705
|
+
variables are also filtered on the legacy platform-shell path; explicit names
|
|
706
|
+
in user-level `sandbox.envPass` are restored only for the final command target.
|
|
707
|
+
When `shellExecution` is absent, the established interpreter path is unchanged. See
|
|
708
|
+
[SDK Embedder Guide section 28](public_docs/sdk/embedder-guide.md#28-host-configurable-shell-execution-contract-v0777)
|
|
709
|
+
and the [Issue 214 regression guide](docs/test-guides/ISSUE_214_v0.7.77_REGRESSION_GUIDE.md).
|
|
710
|
+
|
|
711
|
+
Kimi Code requests also receive a stable, opaque prompt-cache affinity key
|
|
712
|
+
derived from the logical Runtime context. It is reused across Runs, retries,
|
|
713
|
+
fallback, resume, and compaction; recursive child Agents receive distinct keys
|
|
714
|
+
based on their canonical Agent path rather than their temporary transcript
|
|
715
|
+
Session. Public Kimi and official OpenAI use the corresponding
|
|
716
|
+
`prompt_cache_key` field, while other compatible gateways remain opt-in because
|
|
717
|
+
some reject unknown request fields. This improves routing stability but cannot
|
|
718
|
+
override Provider TTL or cache sharding. See the
|
|
719
|
+
[Issue 215 regression guide](docs/test-guides/ISSUE_215_v0.7.77_REGRESSION_GUIDE.md).
|
|
720
|
+
Codex CLI cache reads/writes and Gemini CLI cache reads now flow through the
|
|
721
|
+
CLI bridge and Runtime diagnostics without estimation. A reported `0` remains
|
|
722
|
+
distinct from an unreported field; see the
|
|
723
|
+
[Issue 216 regression guide](docs/test-guides/ISSUE_216_v0.7.77_REGRESSION_GUIDE.md).
|
|
724
|
+
The bridge also starts the first native CLI turn fresh, resumes only a native
|
|
725
|
+
session ID reported by that CLI, creates fresh ACP sessions for stateless
|
|
726
|
+
calls, recreates a closed pseudo transport, and validates the process exit even
|
|
727
|
+
after a terminal CLI event. User cancellation stays quiet, while hard/idle
|
|
728
|
+
timeout aborts remain failures eligible for Runtime recovery, and a CLI that
|
|
729
|
+
reports success but never exits is terminated at its configured deadline; see the
|
|
730
|
+
[Issue 217 regression guide](docs/test-guides/ISSUE_217_v0.7.77_REGRESSION_GUIDE.md).
|
|
731
|
+
|
|
732
|
+
One daemon owns many sessions. Different sessions may run concurrently; starts
|
|
733
|
+
within the same session are queued so that only one run is active for that
|
|
734
|
+
session. Multiple `kodax` processes can attach to the same daemon and open or
|
|
735
|
+
observe the same session. FEATURE_269 adds atomic snapshot-plus-stream joining,
|
|
736
|
+
durable idempotent mutations, revision-safe settings and grants, transport-safe
|
|
737
|
+
AskUser/permission responses, run-scoped credential and Host Tool bridges, and
|
|
738
|
+
one daemon/inline Coder owner fence. In-flight external effects are never
|
|
739
|
+
blindly replayed after a crash; clients receive explicit interrupted/unknown
|
|
740
|
+
terminal facts and resync when `runtimeId` changes.
|
|
741
|
+
|
|
742
|
+
Space and IDE hosts should require these capabilities through the Runtime SDK.
|
|
743
|
+
Partner remains on its private inline Runtime and must use a distinct product
|
|
744
|
+
data/session root. A missing daemon capability is an error, not permission to
|
|
745
|
+
silently fall back to inline Coder.
|
|
746
|
+
|
|
747
|
+
For the full host-integration contract, including inline/Worker/daemon selection,
|
|
748
|
+
multi-client permission handling, config/catalog/MCP admin APIs, artifacts,
|
|
749
|
+
context diagnostics, and daemon protocol schemas, see
|
|
750
|
+
[public_docs/sdk/embedder-guide.md §17](public_docs/sdk/embedder-guide.md#17-runtime-sdk-worker-isolation-and-local-daemon-feature_253-feature_257).
|
|
751
|
+
|
|
752
|
+
The Space/IDE shared-daemon contract is documented in
|
|
753
|
+
[SDK Embedder Guide section 23](public_docs/sdk/embedder-guide.md#23-shared-coder-daemon-for-space-and-ide-hosts-feature_269-v0769).
|
|
754
|
+
|
|
755
|
+
**v0.7.72–v0.7.73 Runtime permission contract:** Auto Mode is owned by the Runtime session,
|
|
756
|
+
not by a UI hook. It reuses its LLM/rules guardrail across turns, classifies
|
|
757
|
+
before the shared permission bridge, and persists explicit engine selection.
|
|
758
|
+
The same session settings can select a classifier model and bounded
|
|
759
|
+
timeout; `auto` defaults to LLM classification and fails with a recoverable
|
|
760
|
+
configuration error when no effective classifier model exists, rather than
|
|
761
|
+
silently falling back. In v0.7.78, classifier failures retry once and then use
|
|
762
|
+
the Accept-edits safety boundary; they never change the engine to rules.
|
|
763
|
+
Runtime permission prompts offer opaque, exact
|
|
764
|
+
allow-once/session/persistent grant suggestions; persistent grants are
|
|
765
|
+
daemon-owned and revisioned. Host plan exit is exposed only when the host
|
|
766
|
+
supplies an approval callback. See the [Runtime Auto Mode integration guide](public_docs/sdk/embedder-guide.md#24-runtime-owned-auto-mode-and-plan-approval-bridges-v0772v0773).
|
|
767
|
+
|
|
768
|
+
## Repo Intelligence
|
|
769
|
+
|
|
770
|
+
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.
|
|
771
|
+
|
|
772
|
+
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.
|
|
773
|
+
|
|
774
|
+
```bash
|
|
775
|
+
# Pick a runtime mode (auto | full | light | off)
|
|
776
|
+
kodax --repo-intelligence full --repo-intelligence-trace
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
## Architecture
|
|
780
|
+
|
|
781
|
+
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 12 SDK subpath exports (`/agent`, `/llm`, `/coding`, `/media`, `/repl`, `/skills`, `/mcp`, `/session`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`; ADR-024 + ADR-032 + ADR-038, with ADR-036 consolidation):
|
|
782
|
+
|
|
783
|
+
```
|
|
784
|
+
KodaX/
|
|
785
|
+
├── packages/ # 4 workspace packages (FEATURE_194 v0.7.43)
|
|
786
|
+
│ ├── llm/ # @kodax-ai/llm - LLM abstraction (16 built-in provider aliases)
|
|
787
|
+
│ │ └── providers/ # Anthropic, OpenAI, DeepSeek, Kimi, MiMo, MiniMax, Zhipu, Ark, …
|
|
788
|
+
│ │
|
|
789
|
+
│ ├── agent/ # @kodax-ai/agent - Generic Agent framework
|
|
790
|
+
│ │ ├── actors/ # Runtime-owned Actor tree, scheduler, mailbox, events
|
|
791
|
+
│ │ ├── session-lineage/ # branchable session tree (inline v0.7.43)
|
|
792
|
+
│ │ ├── capabilities/
|
|
793
|
+
│ │ │ ├── mcp/ # MCP integration (inline v0.7.43)
|
|
794
|
+
│ │ │ └── skills/ # Skills standard implementation + builtin (inline v0.7.43)
|
|
795
|
+
│ │ └── tracing/ # tracing / observability (inline v0.7.43)
|
|
796
|
+
│ │
|
|
797
|
+
│ ├── coding/ # @kodax-ai/coding - Coding Agent (tools + prompts)
|
|
798
|
+
│ │ ├── tools/ # 50+ tools: read, write, edit, bash, glob, grep, undo,
|
|
799
|
+
│ │ │ # spawn_agent, send_message, followup_task, wait_agent,
|
|
800
|
+
│ │ │ # ask_user_question, repo-intelligence, …
|
|
801
|
+
│ │ └── repo-intelligence/ # incl. protocol.ts (inline v0.7.43)
|
|
802
|
+
│ │
|
|
803
|
+
│ └── repl/ # @kodax-ai/repl - Interactive terminal UI (Ink TUI)
|
|
804
|
+
│
|
|
805
|
+
├── src/ # CLI entry + SDK subpath entries
|
|
806
|
+
│ ├── kodax_cli.ts # Main CLI entry point (bin: `kodax`)
|
|
807
|
+
│ └── sdk-*.ts # SDK subpath re-exports → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session,runtime,sandbox,a2a,experimental-memory}
|
|
808
|
+
│
|
|
809
|
+
└── package.json # Publish-shaped exports; release.mjs only toggles private during pack/publish
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### Package Dependencies
|
|
813
|
+
|
|
814
|
+
```
|
|
815
|
+
┌──────────────────┐
|
|
816
|
+
│ kodax (root) │
|
|
817
|
+
│ CLI Entry │
|
|
818
|
+
└────────┬─────────┘
|
|
819
|
+
│
|
|
820
|
+
┌──────────────┴──────────────┐
|
|
821
|
+
│ │
|
|
822
|
+
▼ ▼
|
|
823
|
+
┌──────────────┐ ┌────────────────┐
|
|
824
|
+
│@kodax-ai/repl│ │@kodax-ai/coding│
|
|
825
|
+
│ UI Layer │ │ Tools+Prompts │
|
|
826
|
+
└──────┬───────┘ └──────┬─────────┘
|
|
827
|
+
│ │
|
|
828
|
+
│ ┌──────────────┴──────────────┐
|
|
829
|
+
│ │ │
|
|
830
|
+
▼ ▼ ▼
|
|
831
|
+
┌──────────────┐ ┌──────────────────────────┐ ┌──────────────┐
|
|
832
|
+
│@kodax-ai/ │ │@kodax-ai/agent │ │@kodax-ai/llm │
|
|
833
|
+
│coding (via │ │Runner + fan-out + │ │LLM Abstract │
|
|
834
|
+
│above) │ │idle-yield + session- │ │(16 aliases) │
|
|
835
|
+
│ │ │lineage + skills + mcp + │ │ │
|
|
836
|
+
│ │ │tracing (FEATURE_194) │ │ │
|
|
837
|
+
└──────────────┘ └──────────────────────────┘ └──────────────┘
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
### Package Overview
|
|
841
|
+
|
|
842
|
+
Source-side workspace package names (`@kodax-ai/*`). npm consumers install the single bundled `@kodax-ai/kodax` package and import from SDK subpaths — see [Source-side vs npm-published surface](#source-side-vs-npm-published-surface) and [SDK Usage](#sdk-usage) below.
|
|
843
|
+
|
|
844
|
+
| Workspace package | Purpose | Key Dependencies |
|
|
845
|
+
|---------|---------|------------------|
|
|
846
|
+
| `@kodax-ai/llm` | LLM abstraction (16 built-in provider aliases + custom registration) | @anthropic-ai/sdk, openai |
|
|
809
847
|
| `@kodax-ai/agent` | Generic Agent framework — Runner, fan-out, idle-yield, media/input artifacts, session-lineage, capabilities (mcp + skills), tracing (ADR-036 v0.7.43 consolidation; subpaths: `/media`, `/session-lineage`, `/capabilities/mcp`, `/capabilities/skills`, `/tracing`) | @kodax-ai/llm, fflate, jimp, yaml |
|
|
810
|
-
| `@kodax-ai/coding` | Coding Agent — 50+ tools (incl. canonical Actor collaboration tools) + role prompts + auto-continue + repo-intelligence protocol | @kodax-ai/llm, @kodax-ai/agent |
|
|
811
|
-
| `@kodax-ai/repl` | Complete interactive terminal UI (Ink/React, permission modes, commands, streaming) | @kodax-ai/coding, ink, react |
|
|
812
|
-
|
|
813
|
-
### Source-side vs npm-published surface
|
|
814
|
-
|
|
815
|
-
KodaX has two layers that consumers should understand separately:
|
|
816
|
-
|
|
817
|
-
- **Source-side**: 4 workspace packages above (what developers see when reading the repo).
|
|
818
|
-
- **npm-published**: a single bundled package `@kodax-ai/kodax` with 12 SDK subpaths (what SDK consumers `import` from). The subpaths are split into two roles:
|
|
819
|
-
- **Full-package subpaths** (`/agent`, `/llm`, `/coding`, `/repl`) — each one maps 1:1 to a source workspace and exposes its complete public API.
|
|
820
|
-
- **Integration and narrow subpaths** (`/media`, `/skills`, `/mcp`, `/session`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`) — focused host surfaces. `/a2a` composes the neutral F258 plane with the Runtime facade; it does not add A2A wire types to `/agent`.
|
|
821
|
-
|
|
822
|
-
| Source package | npm subpath | Type | What you get | Example consumer |
|
|
823
|
-
|---|---|---|---|---|
|
|
824
|
-
| `packages/llm` | `@kodax-ai/kodax/llm` | Full package | 16-alias LLM abstraction (108 exports) | Standalone LLM clients |
|
|
825
|
-
| `packages/agent` | `@kodax-ai/kodax/agent` | Full package | Runner / fan-out / external-agent plane / session-lineage / capabilities / tracing (331 exports) | Custom agent frameworks |
|
|
826
|
-
| `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 |
|
|
827
|
-
| `packages/agent` | `@kodax-ai/kodax/mcp` | **Narrow subset** | MCP only — `McpCapabilityProvider` / `createMcpTransport` / `searchMcpCatalog` / ... (23 exports) | MCP server hosts |
|
|
828
|
-
| `packages/agent` | `@kodax-ai/kodax/media` | **Narrow subset** | Structured image/file/video input-artifact helpers (22 exports) | Desktop hosts and multimodal clients |
|
|
848
|
+
| `@kodax-ai/coding` | Coding Agent — 50+ tools (incl. canonical Actor collaboration tools) + role prompts + auto-continue + repo-intelligence protocol | @kodax-ai/llm, @kodax-ai/agent |
|
|
849
|
+
| `@kodax-ai/repl` | Complete interactive terminal UI (Ink/React, permission modes, commands, streaming) | @kodax-ai/coding, ink, react |
|
|
850
|
+
|
|
851
|
+
### Source-side vs npm-published surface
|
|
852
|
+
|
|
853
|
+
KodaX has two layers that consumers should understand separately:
|
|
854
|
+
|
|
855
|
+
- **Source-side**: 4 workspace packages above (what developers see when reading the repo).
|
|
856
|
+
- **npm-published**: a single bundled package `@kodax-ai/kodax` with 12 SDK subpaths (what SDK consumers `import` from). The subpaths are split into two roles:
|
|
857
|
+
- **Full-package subpaths** (`/agent`, `/llm`, `/coding`, `/repl`) — each one maps 1:1 to a source workspace and exposes its complete public API.
|
|
858
|
+
- **Integration and narrow subpaths** (`/media`, `/skills`, `/mcp`, `/session`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`) — focused host surfaces. `/a2a` composes the neutral F258 plane with the Runtime facade; it does not add A2A wire types to `/agent`.
|
|
859
|
+
|
|
860
|
+
| Source package | npm subpath | Type | What you get | Example consumer |
|
|
861
|
+
|---|---|---|---|---|
|
|
862
|
+
| `packages/llm` | `@kodax-ai/kodax/llm` | Full package | 16-alias LLM abstraction (108 exports) | Standalone LLM clients |
|
|
863
|
+
| `packages/agent` | `@kodax-ai/kodax/agent` | Full package | Runner / fan-out / external-agent plane / session-lineage / capabilities / tracing (331 exports) | Custom agent frameworks |
|
|
864
|
+
| `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 |
|
|
865
|
+
| `packages/agent` | `@kodax-ai/kodax/mcp` | **Narrow subset** | MCP only — `McpCapabilityProvider` / `createMcpTransport` / `searchMcpCatalog` / ... (23 exports) | MCP server hosts |
|
|
866
|
+
| `packages/agent` | `@kodax-ai/kodax/media` | **Narrow subset** | Structured image/file/video input-artifact helpers (22 exports) | Desktop hosts and multimodal clients |
|
|
829
867
|
| `packages/agent` | `@kodax-ai/kodax/experimental-memory` | **Experimental subset** | Thin F228-backed `MemoryAgent` / `MemorySession` lifecycle plus additive `MemoryManagementAgent` list/remember/forget | SDK hosts explicitly evaluating FEATURE_260 / FEATURE_292 |
|
|
830
|
-
| `packages/coding` | `@kodax-ai/kodax/coding` | Full package | Coding agent + 50+ tools + repo-intelligence (505 exports) | Build a Claude Code-shape product |
|
|
831
|
-
| `packages/repl` | `@kodax-ai/kodax/repl` | Full package | Ink TUI + permission modes + commands (217 exports) | Terminal-UI consumers |
|
|
832
|
-
| `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 |
|
|
833
|
-
| `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 |
|
|
834
|
-
| `src` | `@kodax-ai/kodax/sandbox` | Host API | Explicit ASRT capability/doctor/setup and host-owned contained command execution; unavailability never means silent ordinary execution | SDK hosts that need standalone process containment |
|
|
835
|
-
| `src` | `@kodax-ai/kodax/a2a` | Integration edge | A2A 1.0 Agent Card discovery, JSON-RPC/SSE F258 executor, safe fetch policy, and authenticated Runtime-backed Agent server | Agent orchestrators and KodaX hosts |
|
|
836
|
-
|
|
837
|
-
**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.
|
|
838
|
-
|
|
839
|
-
**Dynamic Workflows (FEATURE_217, v0.7.49)**: the domain-neutral workflow runtime is part of `/agent` — `import { createWorkflowRuntime, runWorkflow, WorkflowAbortError, WorkflowLimitError } from '@kodax-ai/kodax/agent'`. The coding-side integration (agent backend + built-in workflows + saved-workflow discovery/generation: `createCodingWorkflowBackend`, `runWorkflowFromOptions`, `parallelInvestigation`, `discoverSavedWorkflows`, `generateWorkflowFromOptions`, …) is part of `/coding`. FEATURE_217 is the v0.7.49 home for the full Dynamic Workflow product loop: `/workflow create <request>` generates restricted scripts, `/workflow save <runId> <name>` stores `.workflow.json` rerunnable workflows, generated/saved scripts coordinate agents through `WorkflowApi`, run lifecycle state stays observable, opt-in `isolation:"worktree"` routes selected children to parent-managed worktrees, and all file/shell effects still pass through agent tools and the existing permission gates. There is **no** separate `@kodax-ai/kodax/agent/workflow` root-package subpath; source-package consumers of `@kodax-ai/agent` can still use that package's `./workflow` subpath.
|
|
840
|
-
|
|
841
|
-
**Workflow Process Surface (FEATURE_229, v0.7.50)**: workflow progress is now a reusable Agent-layer process contract rather than private REPL text. SDK hosts can subscribe to `WorkflowProcessEvent`/poll `WorkflowProcessSnapshot`, use `createWorkflowRunManager` and `createWorkflowLifecycleController` for stop/pause/resume/result/artifact/delete/prune/identity/preflight controls, and receive ANSI-free provenance fields (`source`, `sourceRunId`, `sourceWorkflowName`, `savedWorkflowName`, `revisionOf`) plus `resultSummary`. `/coding` owns the coding workflow backend and run graph, `/repl` renders the same snapshots, and the terminal UI is not the hidden source of truth. `KodaXEvents` callbacks also take an optional metadata arg (`KodaXToolEventMeta` / `KodaXActivityEventMeta` / `KodaXWorkflowEventMeta`) so a host can attribute every child-agent tool/thinking/progress event to its workflow run and child id without a second event protocol, and generated/saved workflow scripts pass `validateRestrictedWorkflowSource` (compile + source-policy check) plus a generator repair/smoke loop before they run. See [docs/ADR.md ADR-040](docs/ADR.md) for the layering rationale.
|
|
842
|
-
|
|
843
|
-
**Host Reads Persisted History (FEATURE_230 + FEATURE_234, v0.7.51; v0.7.63 hardening)**: additive closures for hosts that read persisted state. **Durable tool transcript replay** — a resumed session now replays the tool cards the assistant used instead of degrading to text-only. `messages` / `lineage` stay canonical; `SessionData.uiHistory` becomes a bounded, sanitized, terminal-only replay cache. The SDK transcript contract is explicit: `loadSession()` = active model context, `loadFullTranscript()` = append-order host scrollback with typed entries (`message` / `compaction` / `branch_summary` / `rewind_marker` / `client_notice` / `task_result`) plus clone provenance (`logicalId` / `sourceEntryId`), `uiHistory` = optional replay cache, and tool cards can always be reconstructed from canonical messages. Hosts can persist local slash output with `appendClientNotice()` without entering model context, and workflow/child completions expose structured `taskResults[]` instead of requiring `<task-completed>` parsing. `rewind_marker` is an audit entry for host scrollback only and is excluded from model-context messages. **Workflow run host attribution** — `WorkflowProcessTrackerOptions` / `WorkflowProcessSnapshot` gain a host-owned opaque `hostMetadata?: Record<string, string>` that the SDK stores, persists to `run.json`, and echoes back (including after a restart) without interpreting it, so a host can map a run to the session/surface that launched it with zero side table. Unstamped/legacy runs honestly echo `hostMetadata === undefined`. See [docs/features/v0.7.51.md](docs/features/v0.7.51.md).
|
|
844
|
-
|
|
845
|
-
**Inline Workflow Authoring (FEATURE_246, v0.7.58; F270 update in v0.7.72)**: the Worker can author and run a workflow inline via the model-callable `run_workflow` tool when Workflow intent is explicit. It scouts the codebase first, bakes concrete findings into child prompts, and runs the script through the sandbox, static-validation, and postcondition-verification pipeline. F270 retires AMAW and complexity-driven activation; AMA keeps explicit `/workflow`, named/SDK, and natural-language Workflow requests. Workflow child Agents now run on the unified Actor control plane. See [docs/features/v0.7.58.md](docs/features/v0.7.58.md), [docs/features/v0.7.72.md](docs/features/v0.7.72.md), and ADR-044/046/047/048/049/055.
|
|
846
|
-
|
|
847
|
-
**Historical Workflow Activation Tiers (FEATURE_248 + FEATURE_249, v0.7.59; superseded by F270 in v0.7.72)**: v0.7.59 introduced AMAW and explicit-request AMA behavior. F270 retires AMAW and its complexity-driven directive. SA remains solo; AMA is the single adaptive multi-Agent mode and activates Workflow only from explicit Workflow intent. See [docs/features/v0.7.59.md](docs/features/v0.7.59.md) and [docs/features/v0.7.72.md](docs/features/v0.7.72.md).
|
|
848
|
-
|
|
849
|
-
**Progressive Disclosure on the Managed Tool Path (FEATURE_250, v0.7.60; current policy corrected in v0.7.74)**: the deferred-tool mechanism applies to the managed AMA path as well as SA. The current deferred set contains exactly 11 tools: six repo-intelligence tools, four web/code discovery tools, and `run_workflow`. Their `input_schema` remains directly callable while `tool_search` provides the full description on demand. The five fixed `mcp_*` facades and the `get_goal` / `create_goal` / `update_goal` lifecycle tools stay resident with their complete contracts. The v0.7.74 goal correction adds only about 109 estimated schema tokens versus the former hints (`get_goal` is actually 12 tokens smaller when resident), removes a discovery round trip, and changes no tool schema, handler, permission, goal state, or compaction-protection behavior. See [docs/features/v0.7.60.md](docs/features/v0.7.60.md) and [docs/features/v0.7.74.md](docs/features/v0.7.74.md#feature_250-v0774-correction-resident-goal-lifecycle-tools).
|
|
850
|
-
|
|
851
|
-
**Context-Efficient Tool Results + Workflow Quality Preflight (FEATURE_251 + FEATURE_252, v0.7.61; corrected 2026-07-14)**: local tools collect complete output and apply only contract-equivalent normalization that is strictly shorter; command-specific lossy Bash filters are off by default, and compound Bash uses no semantic adapter. One owner evaluates the complete parallel-result batch against the final provider request: it solves the largest final input `Pmax` for which `Pmax + output reserve + max(2048, 3% of Pmax) <= context window`, then admits only the remaining physical capacity. Results stay verbatim whenever they fit; only real overflow persists the complete value and emits `KODAX_RESULT_INCOMPLETE`. History keeps the same physical-capacity safety rule: no default lossy microcompaction below capacity, summary-first at pressure, and typed failure without silent deletion when a recoverable request cannot be formed. FEATURE_272 supersedes FEATURE_251 only for the default major-compaction trigger. FEATURE_252's deterministic pre-start workflow contract lint is unchanged. See [docs/features/v0.7.61.md](docs/features/v0.7.61.md) and [docs/ADR.md ADR-050](docs/ADR.md).
|
|
852
|
-
|
|
853
|
-
**Reliable Always-On Context Compaction (FEATURE_272, v0.7.74)**: automatic major compaction cannot be disabled. Its percentage trigger defaults to 75% and clamps to 15-90%; optional `triggerTokens` is inactive when omitted/zero, otherwise the smaller percentage, absolute, and physical-capacity threshold wins. The protected raw tail is 20% of that effective trigger. One transaction summarizes the complete eligible prefix, preserves every genuine user request through an exact ledger, and emits success only after a physically valid token reduction and awaited durable commit. Before raw bodies are evicted, the Session owner durably flushes their exact lineage; stable entry IDs merge the sidecar and slim Session without duplicates. Root and persistent child Agents can recover omitted user/assistant/tool details through bounded `session_history_search` → `session_history_read`, with children isolated to hidden worker Sessions and never granted root-history access. SDK/Runtime clients use revision-bound `transcriptSearch`, pages, and lossless chunks. Hidden reasoning, system instructions, and synthetic checkpoints are excluded from model search. See [the feature design](docs/features/v0.7.74.md), [SDK guide §25](public_docs/sdk/embedder-guide.md#25-always-on-context-compaction-and-bounded-transcript-recovery-v0774), and [ADR-057](docs/ADR.md#adr-057-large-compaction-is-an-always-on-context-scoped-full-coverage-transaction).
|
|
854
|
-
|
|
855
|
-
**Mailbox-Driven Agent Coordination (FEATURE_273, v0.7.74)**: `wait_agent` is now a true model-facing mailbox yield with one bounded `timeout_ms`, not an Actor progress/event reader. It wakes for scoped Agent messages or completions, root user input, interruption, or timeout; progress remains available to UI/SDK snapshot, replay, and long-poll consumers without resampling the parent model. The tool returns only a wake acknowledgement, while authenticated Agent evidence and structured task metadata enter the next safe model boundary once. Unacknowledged root completions survive a hard restart, same-process Runtime rebuilds deduplicate by child turn ID, and acknowledged or legacy historical completions are not replayed. Use `list_agents` for tree state and `agent_output` for a targeted known result. See [the feature design](docs/features/v0.7.74.md#feature_273-mailbox-driven-agent-wait-and-telemetrycontrol-separation), [SDK guide §26](public_docs/sdk/embedder-guide.md#26-agent-mailbox-control-versus-sdk-event-telemetry-v0774), and [ADR-058](docs/ADR.md#adr-058-model-agent-wait-is-mailbox-control-not-event-telemetry).
|
|
856
|
-
|
|
857
|
-
**Active-Run Interrupt Input (v0.7.74)**: embedded Runtime and the shared daemon advertise `interruptInput:1`. `runtime.runs.submitInput()` queues an immutable, ordered input for the current active Actor Run; all inputs admitted before one safe Runner boundary are delivered FIFO as separate user messages in the next LLM request, without creating continuation Runs. Queued/delivered state is visible in typed Run snapshots/events, delivery is acknowledged against the exact consumed IDs, and terminal cleanup prevents undelivered input from leaking into later Runs.
|
|
858
|
-
|
|
859
|
-
**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](public_docs/sdk/embedder-guide.md#18-external-agent-executor-plane-feature_258-v0767).
|
|
860
|
-
|
|
861
|
-
**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](public_docs/sdk/embedder-guide.md#20-cost-disciplined-workflow-routing-and-telemetry-feature_259-v0767).
|
|
862
|
-
|
|
863
|
-
**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](public_docs/sdk/embedder-guide.md#19-session-surface-filtering-and-cursor-pagination-feature_261-v0767).
|
|
864
|
-
|
|
868
|
+
| `packages/coding` | `@kodax-ai/kodax/coding` | Full package | Coding agent + 50+ tools + repo-intelligence (505 exports) | Build a Claude Code-shape product |
|
|
869
|
+
| `packages/repl` | `@kodax-ai/kodax/repl` | Full package | Ink TUI + permission modes + commands (217 exports) | Terminal-UI consumers |
|
|
870
|
+
| `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 |
|
|
871
|
+
| `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 |
|
|
872
|
+
| `src` | `@kodax-ai/kodax/sandbox` | Host API | Explicit ASRT capability/doctor/setup and host-owned contained command execution; unavailability never means silent ordinary execution | SDK hosts that need standalone process containment |
|
|
873
|
+
| `src` | `@kodax-ai/kodax/a2a` | Integration edge | A2A 1.0 Agent Card discovery, JSON-RPC/SSE F258 executor, safe fetch policy, and authenticated Runtime-backed Agent server | Agent orchestrators and KodaX hosts |
|
|
874
|
+
|
|
875
|
+
**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.
|
|
876
|
+
|
|
877
|
+
**Dynamic Workflows (FEATURE_217, v0.7.49)**: the domain-neutral workflow runtime is part of `/agent` — `import { createWorkflowRuntime, runWorkflow, WorkflowAbortError, WorkflowLimitError } from '@kodax-ai/kodax/agent'`. The coding-side integration (agent backend + built-in workflows + saved-workflow discovery/generation: `createCodingWorkflowBackend`, `runWorkflowFromOptions`, `parallelInvestigation`, `discoverSavedWorkflows`, `generateWorkflowFromOptions`, …) is part of `/coding`. FEATURE_217 is the v0.7.49 home for the full Dynamic Workflow product loop: `/workflow create <request>` generates restricted scripts, `/workflow save <runId> <name>` stores `.workflow.json` rerunnable workflows, generated/saved scripts coordinate agents through `WorkflowApi`, run lifecycle state stays observable, opt-in `isolation:"worktree"` routes selected children to parent-managed worktrees, and all file/shell effects still pass through agent tools and the existing permission gates. There is **no** separate `@kodax-ai/kodax/agent/workflow` root-package subpath; source-package consumers of `@kodax-ai/agent` can still use that package's `./workflow` subpath.
|
|
878
|
+
|
|
879
|
+
**Workflow Process Surface (FEATURE_229, v0.7.50)**: workflow progress is now a reusable Agent-layer process contract rather than private REPL text. SDK hosts can subscribe to `WorkflowProcessEvent`/poll `WorkflowProcessSnapshot`, use `createWorkflowRunManager` and `createWorkflowLifecycleController` for stop/pause/resume/result/artifact/delete/prune/identity/preflight controls, and receive ANSI-free provenance fields (`source`, `sourceRunId`, `sourceWorkflowName`, `savedWorkflowName`, `revisionOf`) plus `resultSummary`. `/coding` owns the coding workflow backend and run graph, `/repl` renders the same snapshots, and the terminal UI is not the hidden source of truth. `KodaXEvents` callbacks also take an optional metadata arg (`KodaXToolEventMeta` / `KodaXActivityEventMeta` / `KodaXWorkflowEventMeta`) so a host can attribute every child-agent tool/thinking/progress event to its workflow run and child id without a second event protocol, and generated/saved workflow scripts pass `validateRestrictedWorkflowSource` (compile + source-policy check) plus a generator repair/smoke loop before they run. See [docs/ADR.md ADR-040](docs/ADR.md) for the layering rationale.
|
|
880
|
+
|
|
881
|
+
**Host Reads Persisted History (FEATURE_230 + FEATURE_234, v0.7.51; v0.7.63 hardening)**: additive closures for hosts that read persisted state. **Durable tool transcript replay** — a resumed session now replays the tool cards the assistant used instead of degrading to text-only. `messages` / `lineage` stay canonical; `SessionData.uiHistory` becomes a bounded, sanitized, terminal-only replay cache. The SDK transcript contract is explicit: `loadSession()` = active model context, `loadFullTranscript()` = append-order host scrollback with typed entries (`message` / `compaction` / `branch_summary` / `rewind_marker` / `client_notice` / `task_result`) plus clone provenance (`logicalId` / `sourceEntryId`), `uiHistory` = optional replay cache, and tool cards can always be reconstructed from canonical messages. Hosts can persist local slash output with `appendClientNotice()` without entering model context, and workflow/child completions expose structured `taskResults[]` instead of requiring `<task-completed>` parsing. `rewind_marker` is an audit entry for host scrollback only and is excluded from model-context messages. **Workflow run host attribution** — `WorkflowProcessTrackerOptions` / `WorkflowProcessSnapshot` gain a host-owned opaque `hostMetadata?: Record<string, string>` that the SDK stores, persists to `run.json`, and echoes back (including after a restart) without interpreting it, so a host can map a run to the session/surface that launched it with zero side table. Unstamped/legacy runs honestly echo `hostMetadata === undefined`. See [docs/features/v0.7.51.md](docs/features/v0.7.51.md).
|
|
882
|
+
|
|
883
|
+
**Inline Workflow Authoring (FEATURE_246, v0.7.58; F270 update in v0.7.72)**: the Worker can author and run a workflow inline via the model-callable `run_workflow` tool when Workflow intent is explicit. It scouts the codebase first, bakes concrete findings into child prompts, and runs the script through the sandbox, static-validation, and postcondition-verification pipeline. F270 retires AMAW and complexity-driven activation; AMA keeps explicit `/workflow`, named/SDK, and natural-language Workflow requests. Workflow child Agents now run on the unified Actor control plane. See [docs/features/v0.7.58.md](docs/features/v0.7.58.md), [docs/features/v0.7.72.md](docs/features/v0.7.72.md), and ADR-044/046/047/048/049/055.
|
|
884
|
+
|
|
885
|
+
**Historical Workflow Activation Tiers (FEATURE_248 + FEATURE_249, v0.7.59; superseded by F270 in v0.7.72)**: v0.7.59 introduced AMAW and explicit-request AMA behavior. F270 retires AMAW and its complexity-driven directive. SA remains solo; AMA is the single adaptive multi-Agent mode and activates Workflow only from explicit Workflow intent. See [docs/features/v0.7.59.md](docs/features/v0.7.59.md) and [docs/features/v0.7.72.md](docs/features/v0.7.72.md).
|
|
886
|
+
|
|
887
|
+
**Progressive Disclosure on the Managed Tool Path (FEATURE_250, v0.7.60; current policy corrected in v0.7.74)**: the deferred-tool mechanism applies to the managed AMA path as well as SA. The current deferred set contains exactly 11 tools: six repo-intelligence tools, four web/code discovery tools, and `run_workflow`. Their `input_schema` remains directly callable while `tool_search` provides the full description on demand. The five fixed `mcp_*` facades and the `get_goal` / `create_goal` / `update_goal` lifecycle tools stay resident with their complete contracts. The v0.7.74 goal correction adds only about 109 estimated schema tokens versus the former hints (`get_goal` is actually 12 tokens smaller when resident), removes a discovery round trip, and changes no tool schema, handler, permission, goal state, or compaction-protection behavior. See [docs/features/v0.7.60.md](docs/features/v0.7.60.md) and [docs/features/v0.7.74.md](docs/features/v0.7.74.md#feature_250-v0774-correction-resident-goal-lifecycle-tools).
|
|
888
|
+
|
|
889
|
+
**Context-Efficient Tool Results + Workflow Quality Preflight (FEATURE_251 + FEATURE_252, v0.7.61; corrected 2026-07-14)**: local tools collect complete output and apply only contract-equivalent normalization that is strictly shorter; command-specific lossy Bash filters are off by default, and compound Bash uses no semantic adapter. One owner evaluates the complete parallel-result batch against the final provider request: it solves the largest final input `Pmax` for which `Pmax + output reserve + max(2048, 3% of Pmax) <= context window`, then admits only the remaining physical capacity. Results stay verbatim whenever they fit; only real overflow persists the complete value and emits `KODAX_RESULT_INCOMPLETE`. History keeps the same physical-capacity safety rule: no default lossy microcompaction below capacity, summary-first at pressure, and typed failure without silent deletion when a recoverable request cannot be formed. FEATURE_272 supersedes FEATURE_251 only for the default major-compaction trigger. FEATURE_252's deterministic pre-start workflow contract lint is unchanged. See [docs/features/v0.7.61.md](docs/features/v0.7.61.md) and [docs/ADR.md ADR-050](docs/ADR.md).
|
|
890
|
+
|
|
891
|
+
**Reliable Always-On Context Compaction (FEATURE_272, v0.7.74)**: automatic major compaction cannot be disabled. Its percentage trigger defaults to 75% and clamps to 15-90%; optional `triggerTokens` is inactive when omitted/zero, otherwise the smaller percentage, absolute, and physical-capacity threshold wins. The protected raw tail is 20% of that effective trigger. One transaction summarizes the complete eligible prefix, preserves every genuine user request through an exact ledger, and emits success only after a physically valid token reduction and awaited durable commit. Before raw bodies are evicted, the Session owner durably flushes their exact lineage; stable entry IDs merge the sidecar and slim Session without duplicates. Root and persistent child Agents can recover omitted user/assistant/tool details through bounded `session_history_search` → `session_history_read`, with children isolated to hidden worker Sessions and never granted root-history access. SDK/Runtime clients use revision-bound `transcriptSearch`, pages, and lossless chunks. Hidden reasoning, system instructions, and synthetic checkpoints are excluded from model search. See [the feature design](docs/features/v0.7.74.md), [SDK guide §25](public_docs/sdk/embedder-guide.md#25-always-on-context-compaction-and-bounded-transcript-recovery-v0774), and [ADR-057](docs/ADR.md#adr-057-large-compaction-is-an-always-on-context-scoped-full-coverage-transaction).
|
|
892
|
+
|
|
893
|
+
**Mailbox-Driven Agent Coordination (FEATURE_273, v0.7.74)**: `wait_agent` is now a true model-facing mailbox yield with one bounded `timeout_ms`, not an Actor progress/event reader. It wakes for scoped Agent messages or completions, root user input, interruption, or timeout; progress remains available to UI/SDK snapshot, replay, and long-poll consumers without resampling the parent model. The tool returns only a wake acknowledgement, while authenticated Agent evidence and structured task metadata enter the next safe model boundary once. Unacknowledged root completions survive a hard restart, same-process Runtime rebuilds deduplicate by child turn ID, and acknowledged or legacy historical completions are not replayed. Use `list_agents` for tree state and `agent_output` for a targeted known result. See [the feature design](docs/features/v0.7.74.md#feature_273-mailbox-driven-agent-wait-and-telemetrycontrol-separation), [SDK guide §26](public_docs/sdk/embedder-guide.md#26-agent-mailbox-control-versus-sdk-event-telemetry-v0774), and [ADR-058](docs/ADR.md#adr-058-model-agent-wait-is-mailbox-control-not-event-telemetry).
|
|
894
|
+
|
|
895
|
+
**Active-Run Interrupt Input (v0.7.74)**: embedded Runtime and the shared daemon advertise `interruptInput:1`. `runtime.runs.submitInput()` queues an immutable, ordered input for the current active Actor Run; all inputs admitted before one safe Runner boundary are delivered FIFO as separate user messages in the next LLM request, without creating continuation Runs. Queued/delivered state is visible in typed Run snapshots/events, delivery is acknowledged against the exact consumed IDs, and terminal cleanup prevents undelivered input from leaking into later Runs.
|
|
896
|
+
|
|
897
|
+
**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](public_docs/sdk/embedder-guide.md#18-external-agent-executor-plane-feature_258-v0767).
|
|
898
|
+
|
|
899
|
+
**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](public_docs/sdk/embedder-guide.md#20-cost-disciplined-workflow-routing-and-telemetry-feature_259-v0767).
|
|
900
|
+
|
|
901
|
+
**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](public_docs/sdk/embedder-guide.md#19-session-surface-filtering-and-cursor-pagination-feature_261-v0767).
|
|
902
|
+
|
|
865
903
|
**Experimental Memory Agent SDK (FEATURE_260 + FEATURE_292)**: `/experimental-memory` exposes the source-compatible `MemoryAgent`/`MemorySession` lifecycle plus the additive `MemoryManagementAgent` facade when `createMemoryAgent()` receives a `MemoryManagementController`. That facade provides governed `list()`, `remember()`, and `forget()` through the same plane used by the conversation-first product surface. Passive recall is zero-wait; `query()` is read-only and deliberate; recalled content stays low-authority, and safety/scope gates remain deterministic. See the [direct session and boundary guide](public_docs/sdk/embedder-guide.md#21-experimental-governed-memory--experimental-memory-feature_260--feature_275--feature_292-v0768v0785).
|
|
866
|
-
|
|
867
|
-
**Bidirectional A2A 1.0 (FEATURE_267, v0.7.69)**: `/a2a` discovers allowed Agent Cards and installs a JSON-RPC/SSE executor through the existing F258 plane. Configured outbound Agents are also registered automatically as `external:<name>` in embedded CLI and user-daemon Runtimes, so the main Agent can orchestrate them without host code. One `a2a.json` may hold many outbound registrations and at most one inbound server, which publishes either the Runtime default or one validated `~/.kodax/agents/*.md` Agent behind an authenticated Runtime facade. The built-in listener is loopback-only and will not return a port blocked by Fetch-compatible clients; public deployment uses `handle()` behind host-owned TLS and authorization. A2A 0.3, gRPC, HTTP+JSON, push notifications, and automatic public exposure are not advertised. See the [client/server recipes and security boundaries](public_docs/sdk/embedder-guide.md#22-bidirectional-a2a-10--a2a-feature_267-v0769).
|
|
868
|
-
|
|
869
|
-
**A2A interoperability and authentication hardening** keeps a discovered
|
|
870
|
-
interface on the trusted Agent Card origin and sends credentials only when one
|
|
871
|
-
complete Card/Skill security requirement is satisfiable. The no-code client
|
|
872
|
-
supports HTTP Bearer compatibility and OAuth 2.0 Client Credentials; for OAuth,
|
|
873
|
-
an external Authorization Server issues short-lived access tokens and KodaX
|
|
874
|
-
caches them only in memory. Inbound `a2a serve` can validate RFC 9068 JWT access
|
|
875
|
-
tokens from an external issuer/JWKS, but never signs or issues production
|
|
876
|
-
tokens itself. It resolves its provider from CLI, then environment, config, and
|
|
877
|
-
the built-in default; a Markdown Agent can pin its own provider. Input
|
|
878
|
-
continuation resumes the original Runtime run, task history and retention are
|
|
879
|
-
bounded with stable cursor pagination, and authenticated SSE is correlated
|
|
880
|
-
before falling back to polling after an early normal EOF. Only direct remote
|
|
881
|
-
artifacts, broker-staged outputs, and outputs from a successfully admitted
|
|
882
|
-
Skill script can be published; ordinary workspace writes and local paths stay
|
|
883
|
-
private.
|
|
884
|
-
|
|
885
|
-
This authentication and per-Agent activation hardening is a post-release
|
|
886
|
-
closure of the v0.7.69 F267/F268 design and ships in the v0.7.71 patch; it is
|
|
887
|
-
not a claim that older v0.7.69 binaries contained the
|
|
888
|
-
later OAuth profiles.
|
|
889
|
-
|
|
890
|
-
**v0.7.70 MCP discovery hardening** uses exact capability IDs and revisioned
|
|
891
|
-
cursors while admitting results against real physical capacity. Compact CJK
|
|
892
|
-
queries are segmented, and a cross-language lexical zero match either returns a
|
|
893
|
-
lossless bounded grouped inventory or one concise retry in the catalog language.
|
|
894
|
-
Partial provider failure remains explicit rather than disappearing into an
|
|
895
|
-
apparently complete result.
|
|
896
|
-
|
|
897
|
-
The complete built-in path is available without writing TypeScript:
|
|
898
|
-
|
|
899
|
-
```bash
|
|
900
|
-
# Call another A2A Agent
|
|
901
|
-
kodax a2a add research https://agent.example/.well-known/agent-card.json --effect read
|
|
902
|
-
kodax a2a test research
|
|
903
|
-
kodax a2a call research "Summarize this topic"
|
|
904
|
-
|
|
905
|
-
# Explicitly authorize a private plaintext endpoint (prefer HTTPS when available)
|
|
906
|
-
kodax a2a add intranet http://10.20.30.40/.well-known/agent-card.json \
|
|
907
|
-
--allow-private --allow-insecure-http --effect read
|
|
908
|
-
|
|
909
|
-
# Stage an OAuth-protected Agent, then hot-activate/deactivate it
|
|
910
|
-
export RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
|
|
911
|
-
# PowerShell: $env:RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
|
|
912
|
-
# PowerShell: run the command on one line or replace each trailing \ with a backtick.
|
|
913
|
-
kodax a2a add reviewer https://reviewer.example/.well-known/agent-card.json \
|
|
914
|
-
--disabled --effect read --oauth-scheme enterprise-oauth \
|
|
915
|
-
--oauth-issuer https://identity.example/ \
|
|
916
|
-
--oauth-token-url https://identity.example/oauth/token \
|
|
917
|
-
--oauth-client-id kodax-reviewer \
|
|
918
|
-
--oauth-client-secret-env RESEARCH_A2A_CLIENT_SECRET \
|
|
919
|
-
--oauth-scope a2a.invoke --oauth-resource https://reviewer.example/
|
|
920
|
-
kodax a2a enable reviewer
|
|
921
|
-
kodax a2a disable reviewer # blocks new dispatch; does not cancel in-flight tasks
|
|
922
|
-
|
|
923
|
-
# Expose the Runtime default Agent, or pass a name from ~/.kodax/agents/*.md
|
|
924
|
-
export KODAX_A2A_TOKEN='replace-with-a-long-random-token'
|
|
925
|
-
# PowerShell: $env:KODAX_A2A_TOKEN='replace-with-a-long-random-token'
|
|
926
|
-
kodax a2a expose # or: kodax a2a expose document-agent
|
|
927
|
-
kodax a2a serve # loopback http://127.0.0.1:8765
|
|
928
|
-
```
|
|
929
|
-
|
|
930
|
-
MCP, A2A, and Extension declarations live in one user file per domain under
|
|
931
|
-
`~/.kodax/integrations/`. Use `kodax config paths`,
|
|
932
|
-
`kodax config template <core|mcp|a2a|extensions>`,
|
|
933
|
-
`kodax integrations migrate --apply`, and the `kodax mcp`, `kodax a2a`, or
|
|
934
|
-
`kodax extensions` commands to manage them. Migration imports only legacy
|
|
935
|
-
`config.json#mcpServers` and `config.json#extensions`; A2A has no legacy source.
|
|
936
|
-
It never overwrites an existing destination. The first MCP/Extension mutation
|
|
937
|
-
can stage legacy entries. Remove legacy keys only with
|
|
938
|
-
`--apply --cleanup-legacy`, after reviewing destination files and
|
|
939
|
-
literal-secret warnings. Running
|
|
940
|
-
CLI/daemon hosts retain the
|
|
941
|
-
last valid revision, atomically replace the complete MCP provider, reconcile
|
|
942
|
-
Extensions per entry, and hot-register outbound A2A Agents. Each A2A entry has
|
|
943
|
-
a desired `enabled` switch; `kodax a2a list` shows configuration, while the
|
|
944
|
-
owning Runtime is authoritative for live applied registrations. Disabled
|
|
945
|
-
entries are not fetched during automatic reconciliation and, after the owning
|
|
946
|
-
Runtime applies the revision, cannot accept new dispatch. The mutation command
|
|
947
|
-
itself is not cross-process acknowledgement. `a2a add --disabled` still checks
|
|
948
|
-
the Card by default unless `--no-test` is supplied, while `a2a test` performs
|
|
949
|
-
discovery/security planning without requesting an OAuth token. The fixed
|
|
950
|
-
`KODAX_A2A_TOKEN` example is an operator-provisioned compatibility credential;
|
|
951
|
-
KodaX does not generate or issue it. Disabled entries remain available for
|
|
952
|
-
later re-enable. Private-address access and non-loopback plaintext HTTP are
|
|
953
|
-
independent, persisted, default-deny permissions (`--allow-private` and
|
|
954
|
-
`--allow-insecure-http`); exact loopback HTTP remains available without either.
|
|
955
|
-
OAuth token endpoints retain their stricter HTTPS-or-exact-loopback rule.
|
|
956
|
-
Worker-hosted SDK Runtimes can load this same configured plane inside the Worker
|
|
957
|
-
owner with `worker: { configuredA2A: true }`. The CLI honors the same opt-in
|
|
958
|
-
from `~/.kodax/config.json` (`"worker": { "configuredA2A": true }`) by creating
|
|
959
|
-
a Worker-hosted embedded Runtime that loads the configured A2A plane. `a2a serve` loads
|
|
960
|
-
its configured MCP/Extension capability surface before listening and pins that
|
|
961
|
-
execution authority; it hot-reloads publication, authentication, and limits.
|
|
962
|
-
|
|
963
|
-
A2A configuration migration and retained task ownership are separate. If a
|
|
964
|
-
v0.7.70 task store must remain addressable after the realm-aware upgrade, stop
|
|
965
|
-
the A2A server, run `kodax a2a migrate-tasks` to inspect the exact-owner plan,
|
|
966
|
-
then apply it with `--apply --confirm-server-stopped`. OAuth migration also
|
|
967
|
-
requires the known historical `--subject`; normal serving never guesses or
|
|
968
|
-
dual-reads a legacy owner key.
|
|
969
|
-
|
|
970
|
-
Agent, Skill, Extension-tool authority, workspace, tool-policy, or task-store
|
|
971
|
-
changes require an explicit server restart. Managed
|
|
972
|
-
A2A contexts default to `~/kodax_a2a_server_workspace/<runtime-profile>/contexts/`.
|
|
973
|
-
Exact Skill scripts require the opt-in isolated policy and a passing
|
|
974
|
-
`kodax sandbox doctor` (`kodax sandbox setup` performs the explicit Windows
|
|
975
|
-
one-time provisioning).
|
|
976
|
-
|
|
977
|
-
---
|
|
978
|
-
|
|
979
|
-
## Features
|
|
980
|
-
|
|
981
|
-
- **Modular Architecture** - Use as CLI, as a library, or as a Node-free single binary
|
|
982
|
-
- **16 Built-in Provider Aliases** - Anthropic, OpenAI, DeepSeek, Kimi, Kimi Code, Qwen, Qwen Token Plan, Zhipu, Zhipu Coding, Zai Coding, MiniMax Coding, MiMo Coding, MiMo, Ark Coding, Gemini CLI, Codex CLI - plus user-defined OpenAI/Anthropic-compatible providers
|
|
983
|
-
- **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
|
|
984
|
-
- **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. Adaptive child steering uses the canonical Actor collaboration tools with idle-yield waiting; specialist routing uses `spawn_agent(agent_id=...)`.
|
|
985
|
-
- **Reasoning Effort** - Effort-first control (`off/auto/low/medium/high` plus model-supported extras) across providers
|
|
986
|
-
- **Streaming Output** - Real-time response display
|
|
987
|
-
- **Session Management** - JSONL format with branchable session lineage tree
|
|
988
|
-
- **Skills System** - Natural language triggering, extensible, role-projected in AMA
|
|
989
|
-
- **Repo Intelligence** - Built-in full/light repository intelligence with native KodaX auto-injection lane
|
|
990
|
-
- **Rich Tool Surface** - 50+ built-in tools across file ops, shell, search, repo intelligence, MCP capabilities, git worktree, and agent control
|
|
991
|
-
- **Permission Control** - 3 permission modes with pattern-based control
|
|
992
|
-
- **Standalone Binary** - `bun --compile` releases for Win/macOS/Linux x64+arm64, no Node.js required on target machines
|
|
993
|
-
- **Cross-Platform** - Windows/macOS/Linux
|
|
994
|
-
- **TypeScript Native** - Full type safety and IDE support
|
|
995
|
-
|
|
996
|
-
---
|
|
997
|
-
|
|
998
|
-
## Installation
|
|
999
|
-
|
|
1000
|
-
### As CLI Tool
|
|
1001
|
-
|
|
1002
|
-
```bash
|
|
1003
|
-
# Clone repository
|
|
1004
|
-
git clone https://github.com/icetomoyo/KodaX.git
|
|
1005
|
-
cd KodaX
|
|
1006
|
-
|
|
1007
|
-
# Install dependencies (includes workspace packages)
|
|
1008
|
-
npm install
|
|
1009
|
-
|
|
1010
|
-
# Build the monorepo
|
|
1011
|
-
npm run build
|
|
1012
|
-
|
|
1013
|
-
# Link globally (development mode)
|
|
1014
|
-
npm link
|
|
1015
|
-
|
|
1016
|
-
# Now you can use 'kodax' anywhere
|
|
1017
|
-
kodax "your task"
|
|
1018
|
-
```
|
|
1019
|
-
|
|
1020
|
-
### As Standalone Binary (no Node required on target)
|
|
1021
|
-
|
|
1022
|
-
KodaX can be packaged into a single executable + a small `builtin/` sidecar directory using `bun --compile`. The target machine does **not** need Node.js or any other runtime.
|
|
1023
|
-
|
|
1024
|
-
Supported targets: `win-x64`, `linux-x64`, `linux-arm64`, `darwin-x64`, `darwin-arm64`. Win7 / pre-glibc-2.27 distros / LoongArch are not supported.
|
|
1025
|
-
|
|
1026
|
-
**Build locally**:
|
|
1027
|
-
|
|
1028
|
-
```bash
|
|
1029
|
-
# Install Bun once on your build machine
|
|
1030
|
-
npm i -g bun # or scoop/brew/curl install — see docs/release.md
|
|
1031
|
-
|
|
1032
|
-
npm run build:binary # Current host platform (fastest)
|
|
1033
|
-
npm run build:binary:all # All five targets in sequence
|
|
1034
|
-
node scripts/build-binary.mjs --target=linux-arm64 # Specific target
|
|
1035
|
-
```
|
|
1036
|
-
|
|
1037
|
-
Output lives under `dist/binary/<target>/`:
|
|
1038
|
-
|
|
1039
|
-
```
|
|
1040
|
-
dist/binary/linux-x64/
|
|
1041
|
-
├── kodax # ~60 MB Bun-compiled executable
|
|
1042
|
-
├── builtin/ # Sidecar built-in skills
|
|
1043
|
-
├── provider-capabilities.json
|
|
1044
|
-
├── semantic-worker.js # Repo-intelligence Worker
|
|
1045
|
-
├── runtime-worker.js # SDK Runtime Worker
|
|
1046
|
-
└── constructed-handler-worker.js # Constructed-tool Worker
|
|
1047
|
-
```
|
|
1048
|
-
|
|
1049
|
-
Smoke-test: `dist/binary/<host>/kodax --version`.
|
|
1050
|
-
|
|
1051
|
-
**Automated release**: pushing a `v*` git tag triggers `.github/workflows/release.yml`, which builds all five targets on native runners, runs smoke tests, and publishes a GitHub Release with archives + SHA256SUMS. Use the `workflow_dispatch` button in the Actions UI to test the pipeline without tagging.
|
|
1052
|
-
|
|
1053
|
-
See [docs/release.md](docs/release.md) for full details on build flags, archive layout, troubleshooting, and the build-time `KODAX_BUNDLED` / `KODAX_VERSION` defines.
|
|
1054
|
-
|
|
1055
|
-
### As Library
|
|
1056
|
-
|
|
1057
|
-
```bash
|
|
1058
|
-
npm install @kodax-ai/kodax
|
|
1059
|
-
```
|
|
1060
|
-
|
|
1061
|
-
```typescript
|
|
1062
|
-
import { runKodaX } from '@kodax-ai/kodax';
|
|
1063
|
-
|
|
1064
|
-
process.env.ZHIPU_API_KEY = process.env.ZHIPU_API_KEY ?? 'your_api_key';
|
|
1065
|
-
|
|
1066
|
-
const result = await runKodaX({
|
|
1067
|
-
provider: 'zhipu-coding',
|
|
1068
|
-
effort: 'auto',
|
|
1069
|
-
events: {
|
|
1070
|
-
onTextDelta: (text) => process.stdout.write(text),
|
|
1071
|
-
onComplete: () => console.log('\nDone!'),
|
|
1072
|
-
},
|
|
1073
|
-
}, 'your task');
|
|
1074
|
-
|
|
1075
|
-
console.log(result.lastText);
|
|
1076
|
-
```
|
|
1077
|
-
|
|
1078
|
-
#### SDK Subpath Imports (v0.7.39+)
|
|
1079
|
-
|
|
1080
|
-
For smaller surface and tree-shake-friendly imports, the SDK is also exposed via subpath exports — pick only the package(s) you need:
|
|
1081
|
-
|
|
1082
|
-
```typescript
|
|
1083
|
-
import { Runner } from '@kodax-ai/kodax/agent'; // agent runtime
|
|
1084
|
-
import { getProvider } from '@kodax-ai/kodax/llm'; // LLM abstraction (16 aliases)
|
|
1085
|
-
import { runKodaX } from '@kodax-ai/kodax/coding'; // coding tools + prompts
|
|
1086
|
-
import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifacts
|
|
1087
|
-
import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
|
|
1088
|
-
import { loadConfig } from '@kodax-ai/kodax/repl'; // REPL config / session helpers
|
|
1089
|
-
import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
|
|
1090
|
-
import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
|
|
1091
|
-
import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
|
|
1092
|
-
import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // standalone ASRT containment
|
|
1093
|
-
import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
|
|
1094
|
-
import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in memory SDK
|
|
1095
|
-
```
|
|
1096
|
-
|
|
1097
|
-
All 13 SDK entries (root + 12 subpaths) share internal code via ESM chunk splitting — importing from `/agent` does not pull in `/repl`'s Ink + React surface.
|
|
1098
|
-
|
|
1099
|
-
For the complete host-facing contract — including embedded/Worker/daemon ownership,
|
|
1100
|
-
external-agent registration and task control, session cursor pagination, workflow
|
|
1101
|
-
model-tier routing, and efficiency telemetry — see the
|
|
1102
|
-
[SDK Embedder Integration Guide](public_docs/sdk/embedder-guide.md).
|
|
1103
|
-
|
|
1104
|
-
> **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 [public_docs/sdk/embedder-guide.md §5](public_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.
|
|
1105
|
-
|
|
1106
|
-
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.
|
|
1107
|
-
|
|
1108
|
-
---
|
|
1109
|
-
|
|
1110
|
-
## Usage
|
|
1111
|
-
|
|
1112
|
-
### REPL Quickstart
|
|
1113
|
-
|
|
1114
|
-
Running `kodax` with no prompt starts the interactive REPL.
|
|
1115
|
-
|
|
1116
|
-
```bash
|
|
1117
|
-
kodax
|
|
1118
|
-
```
|
|
1119
|
-
|
|
1120
|
-
Inside the REPL you can type normal requests or slash commands:
|
|
1121
|
-
|
|
1122
|
-
```text
|
|
1123
|
-
Read package.json and summarize the architecture
|
|
1124
|
-
/model
|
|
1125
|
-
/mode
|
|
1126
|
-
/help
|
|
1127
|
-
```
|
|
1128
|
-
|
|
1129
|
-
### CLI Quickstart
|
|
1130
|
-
|
|
1131
|
-
```bash
|
|
1132
|
-
# Set API key
|
|
1133
|
-
export ZHIPU_API_KEY=your_api_key
|
|
1134
|
-
|
|
1135
|
-
# Basic usage
|
|
1136
|
-
kodax "Help me create a TypeScript project"
|
|
1137
|
-
|
|
1138
|
-
# Choose a provider explicitly
|
|
1139
|
-
kodax --provider openai --model gpt-5.4 "Create a REST API"
|
|
1140
|
-
|
|
1141
|
-
# Use higher reasoning effort
|
|
1142
|
-
kodax --effort high "Review this architecture"
|
|
1143
|
-
```
|
|
1144
|
-
|
|
1145
|
-
### Session Workflows
|
|
1146
|
-
|
|
1147
|
-
Use a session when you want memory across turns. Without a session, each CLI call is independent.
|
|
1148
|
-
|
|
1149
|
-
```bash
|
|
1150
|
-
# No memory: two separate calls
|
|
1151
|
-
kodax "Read src/auth.ts"
|
|
1152
|
-
kodax "Summarize it"
|
|
1153
|
-
|
|
1154
|
-
# With memory: same session
|
|
1155
|
-
kodax --session my-project "Read package.json"
|
|
1156
|
-
kodax --session my-project "Summarize it"
|
|
1157
|
-
kodax --session my-project "How should I fix the first issue?"
|
|
1158
|
-
|
|
1159
|
-
# Session management
|
|
1160
|
-
kodax -r # Search, page, and select a non-empty session
|
|
1161
|
-
kodax -r <session-id> # Resume a known session directly
|
|
1162
|
-
kodax -r "Review runtime" # Resume a unique exact title; duplicates open the picker
|
|
1163
|
-
kodax --session list # List up to 50 non-empty sessions
|
|
1164
|
-
kodax --session cleanup-acp # Preview strictly matched empty ACP-test pollution
|
|
1165
|
-
```
|
|
1166
|
-
|
|
1167
|
-
Bare `-r` opens an interactive picker with incremental search, arrow/PageUp/PageDown
|
|
1168
|
-
navigation, Tab completion, full selected-session ID display, and Enter-to-resume.
|
|
1169
|
-
An explicit value checks the complete session ID first, then an exact
|
|
1170
|
-
case-insensitive title; duplicate titles open a narrowed picker instead of
|
|
1171
|
-
silently choosing one. The picker loads before the full CLI, so session listing
|
|
1172
|
-
remains responsive. After selection it hands terminal input to the resumed
|
|
1173
|
-
REPL; Esc releases the picker's stdin ownership and immediately returns to the
|
|
1174
|
-
invoking shell. Session replay preserves each recorded message/event timestamp.
|
|
1175
|
-
|
|
1176
|
-
Cleanup is preview-only unless
|
|
1177
|
-
`--apply-session-cleanup` is also provided; matching sessions are archived rather
|
|
1178
|
-
than permanently deleted.
|
|
1179
|
-
|
|
1180
|
-
### Session Patterns
|
|
1181
|
-
|
|
1182
|
-
```bash
|
|
1183
|
-
# ❌ No memory: two independent calls
|
|
1184
|
-
kodax "Read src/auth.ts" # Agent reads and responds
|
|
1185
|
-
kodax "Summarize it" # Agent doesn't know what to summarize
|
|
1186
|
-
|
|
1187
|
-
# ✅ With memory: same session
|
|
1188
|
-
kodax --session auth-review "Read src/auth.ts"
|
|
1189
|
-
kodax --session auth-review "Summarize it" # Agent knows to summarize auth.ts
|
|
1190
|
-
kodax --session auth-review "How to fix first issue" # Agent has context
|
|
1191
|
-
```
|
|
1192
|
-
|
|
1193
|
-
### Workflow Examples
|
|
1194
|
-
|
|
1195
|
-
```bash
|
|
1196
|
-
# Code review (multi-turn conversation)
|
|
1197
|
-
kodax --session review "Review src/ directory"
|
|
1198
|
-
kodax --session review "Focus on security issues"
|
|
1199
|
-
kodax --session review "Give me fix suggestions"
|
|
1200
|
-
|
|
1201
|
-
# Project development (continuous session)
|
|
1202
|
-
kodax --session todo-app "Create a Todo application"
|
|
1203
|
-
kodax --session todo-app "Add delete functionality"
|
|
1204
|
-
kodax --session todo-app "Write tests"
|
|
1205
|
-
```
|
|
1206
|
-
|
|
1207
|
-
### CLI Reference
|
|
1208
|
-
|
|
1209
|
-
```text
|
|
1210
|
-
kodax Start the interactive REPL
|
|
1211
|
-
-h, --help [topic] Show help or topic help
|
|
1212
|
-
-p, --print <text> Run a single task and exit
|
|
1213
|
-
-c, --continue Continue the most recent non-empty conversation in this directory
|
|
1214
|
-
-r, --resume [value] Resume by ID/exact title, or open the searchable picker
|
|
1215
|
-
-m, --provider Provider to use
|
|
1216
|
-
--model <name> Override the model
|
|
1217
|
-
--reasoning <mode> off | auto | quick | balanced | deep
|
|
1218
|
-
-t, --thinking Compatibility alias for --reasoning auto
|
|
1219
|
-
-s, --session <op> Session ID or legacy session operation
|
|
1220
|
-
-j, --parallel Enable parallel tool execution
|
|
1221
|
-
--max-iter <n> Max iterations
|
|
1222
|
-
```
|
|
1223
|
-
|
|
1224
|
-
### Permission Control
|
|
1225
|
-
|
|
1226
|
-
KodaX provides 3 permission modes for fine-grained control:
|
|
1227
|
-
|
|
1228
|
-
| Mode | Description | Tools Need Confirmation |
|
|
1229
|
-
|------|-------------|------------------------|
|
|
1230
|
-
| `plan` | Read-only planning mode | All modification tools blocked |
|
|
1231
|
-
| `accept-edits` | Auto-accept file edits | bash only |
|
|
1232
|
-
| `auto` | Runtime-owned LLM/rules classification within the project boundary | Only explicit classifier escalation |
|
|
1233
|
-
|
|
1234
|
-
```bash
|
|
1235
|
-
# In REPL, use /mode command
|
|
1236
|
-
/mode plan # Switch to plan mode (read-only)
|
|
1237
|
-
/mode accept-edits # Switch to accept-edits mode
|
|
1238
|
-
/mode auto # Switch to Runtime-owned Auto Mode
|
|
1239
|
-
/auto # Alias for auto
|
|
1240
|
-
|
|
1241
|
-
# Check current mode
|
|
1242
|
-
/mode
|
|
1243
|
-
```
|
|
1244
|
-
|
|
1245
|
-
**Features:**
|
|
1246
|
-
- In `accept-edits` mode, choosing "always" can persist safe Bash allow-patterns
|
|
1247
|
-
- Plan mode includes system prompt context for LLM awareness
|
|
1248
|
-
- Sensitive/protected or unresolved targets enter Auto[LLM]/approval review;
|
|
1249
|
-
ordinary reads outside the project are allowed
|
|
1250
|
-
- Pattern-based permission: Allow specific Bash commands (e.g., `Bash(npm install)`)
|
|
1251
|
-
- Unified diff display for write/edit operations
|
|
1252
|
-
- Auto Mode first admits exactly modeled safe reads and workspace/temp
|
|
1253
|
-
mutations without classifier latency. Remaining actions are reviewed against
|
|
1254
|
-
bounded user intent and exact operation facts; a safe verdict creates no
|
|
1255
|
-
pending approval request. Classifier failures retry once, then use the
|
|
1256
|
-
Accept-edits safety boundary rather than silently switching to Auto[rules].
|
|
1257
|
-
- Shift-Tab cycles `Plan -> Edits -> Auto`; Shift+Enter inserts a newline. Auto
|
|
1258
|
-
immediately displays `Auto[LLM]` or `Auto[RULES]`, and rapid mode changes are
|
|
1259
|
-
persisted in input order. `Auto[RULES]` remains an explicit/manual engine;
|
|
1260
|
-
use `/auto-engine llm` to select LLM classification.
|
|
1261
|
-
- Runtime-backed prompts can offer exact `allow once`, `allow this session`,
|
|
1262
|
-
and `always allow` choices. Return the Runtime-issued opaque suggestion;
|
|
1263
|
-
never derive or widen a permission rule from the displayed command or path.
|
|
1264
|
-
Persistent grants are daemon-owned, revisioned, and can be listed/revoked
|
|
1265
|
-
through `runtime.permissions` by an authorized SDK host. Dynamic shell
|
|
1266
|
-
commands deliberately receive no persistent-grant suggestion.
|
|
1267
|
-
|
|
1268
|
-
`kodax -c` skips zero-message ACP/bootstrap placeholders even when they are
|
|
1269
|
-
newer than the last real conversation. The same newest non-empty rule applies
|
|
1270
|
-
to Ink, classic, one-shot CLI, and coding-runtime auto-resume; an explicit
|
|
1271
|
-
session ID always wins. Interactive resume also restores the saved workspace
|
|
1272
|
-
runtime before relative shell commands or the next model turn.
|
|
1273
|
-
|
|
1274
|
-
### CLI Help Topics
|
|
1275
|
-
|
|
1276
|
-
Get detailed help for specific topics:
|
|
1277
|
-
|
|
1278
|
-
```bash
|
|
1279
|
-
# Basic help
|
|
1280
|
-
kodax -h
|
|
1281
|
-
kodax --help
|
|
1282
|
-
|
|
1283
|
-
# Detailed topic help
|
|
1284
|
-
kodax -h sessions # Session management details
|
|
1285
|
-
kodax -h init # Long-running project initialization
|
|
1286
|
-
kodax -h project # Project mode / harness workflow
|
|
1287
|
-
kodax -h auto # Auto-continue mode
|
|
1288
|
-
kodax -h provider # LLM provider configuration
|
|
1289
|
-
kodax -h thinking # Thinking/reasoning effort and compatibility modes
|
|
1290
|
-
kodax -h team # Multi-agent parallel execution
|
|
1291
|
-
kodax -h print # Print configuration
|
|
1292
|
-
```
|
|
1293
|
-
|
|
1294
|
-
### Environment Variables
|
|
1295
|
-
|
|
1296
|
-
KodaX recognizes a number of environment variables for tuning runtime behavior. The most commonly used ones are listed below; for the full list, search the repo for `process.env.KODAX_`.
|
|
1297
|
-
|
|
1298
|
-
#### `KODAX_MAX_OUTPUT_TOKENS`
|
|
1299
|
-
|
|
1300
|
-
Overrides the per-turn `max_tokens` value sent to **every** provider (Anthropic, OpenAI, Zhipu, Kimi, MiniMax, Qwen, DeepSeek, MiMo, Gemini, Codex, …). Set to a positive integer; unset or non-numeric values are ignored. This is an **explicit user intent**: when set, it wins over the provider's model descriptor cap, over the provider config default, and over the global `KODAX_MAX_TOKENS` fallback. RST defense is handled at the provider config layer (`streamMaxDurationMs` watchdog + non-streaming fallback in `packages/llm/src/providers/registry.ts`), so this variable is purely an output-budget knob.
|
|
1301
|
-
|
|
1302
|
-
```bash
|
|
1303
|
-
# Allow up to 48K output tokens per turn (use a higher cap when generating long files)
|
|
1304
|
-
export KODAX_MAX_OUTPUT_TOKENS=48000
|
|
1305
|
-
kodax "generate the full implementation"
|
|
1306
|
-
|
|
1307
|
-
# Unset to restore default behavior
|
|
1308
|
-
unset KODAX_MAX_OUTPUT_TOKENS
|
|
1309
|
-
```
|
|
1310
|
-
|
|
1311
|
-
Precedence used by every provider's `getEffectiveMaxOutputTokens()` (see `packages/llm/src/providers/base.ts`):
|
|
1312
|
-
|
|
1313
|
-
1. One-shot per-request override (agent-loop escalation / context-overflow recovery — internal)
|
|
1314
|
-
2. **`KODAX_MAX_OUTPUT_TOKENS`** (this variable, explicit user intent)
|
|
1315
|
-
3. Active model descriptor's `maxOutputTokens` (FEATURE_098 per-model cap)
|
|
1316
|
-
4. Provider config default
|
|
1317
|
-
5. Global `KODAX_MAX_TOKENS` fallback
|
|
1318
|
-
|
|
1319
|
-
Related variables: `KODAX_MAX_TOKENS` (global fallback when no provider/model cap applies), `KODAX_ESCALATED_MAX_OUTPUT_TOKENS` (escalation budget used by the agent loop when a turn returns `stop_reason: max_tokens`).
|
|
1320
|
-
|
|
1321
|
-
> **Retired in v0.7.42**: `KODAX_RST_PRONE_PROVIDERS` and `KODAX_WRITE_TURN_MAX_TOKENS` (the v0.7.28 P2b write-turn cap mechanism) are no longer recognized. The 2026-04 bench measured RST as time-based (zhipu-coding 308s server kill window), not payload-size-based, so the cap was retired in favor of the per-provider `streamMaxDurationMs` watchdog + non-streaming fallback chain (configured in `registry.ts`). Existing env exports become silent no-ops; remove them from shell profiles when convenient.
|
|
1322
|
-
|
|
1323
|
-
#### Sidecar verifier diagnostics
|
|
1324
|
-
|
|
1325
|
-
Use these when diagnosing Worker text-only completion stalls or custom provider verifier behavior:
|
|
1326
|
-
|
|
1327
|
-
```bash
|
|
1328
|
-
export KODAX_VERIFIER_LOG=1
|
|
1329
|
-
export KODAX_VERIFIER_PROVIDER=anthropic
|
|
1330
|
-
export KODAX_VERIFIER_MODEL=claude-haiku-4-5-20251001
|
|
1331
|
-
```
|
|
1332
|
-
|
|
1333
|
-
- `KODAX_VERIFIER_LOG=1` shows verifier gate/elapsed/trace information and is equivalent to `"verifierLog": true` in `~/.kodax/config.json`.
|
|
1334
|
-
- `KODAX_VERIFIER_PROVIDER` + `KODAX_VERIFIER_MODEL` route the verifier to a separate provider/model instead of inheriting the main Worker model. Set both together.
|
|
1335
|
-
- `KODAX_VERIFIER_ALWAYS=1` forces the verifier to fire on every text-only completion for debugging/regression sweeps.
|
|
1336
|
-
|
|
1337
|
-
SDK/headless hosts can observe actionable Sidecar Verifier messages via
|
|
1338
|
-
`KodaXEvents.onSidecarMessage`; JSONL output emits the same payload as
|
|
1339
|
-
`sidecar.message`. Only `revise` and `blocked` verdicts are surfaced; `accept`
|
|
1340
|
-
stays silent.
|
|
1341
|
-
|
|
1342
|
-
## Advanced Library Usage
|
|
1343
|
-
|
|
1344
|
-
#### Simple Mode (runKodaX)
|
|
1345
|
-
|
|
1346
|
-
```typescript
|
|
1347
|
-
import { runKodaX, KodaXEvents } from '@kodax-ai/kodax';
|
|
1348
|
-
|
|
1349
|
-
const events: KodaXEvents = {
|
|
1350
|
-
onTextDelta: (text) => process.stdout.write(text),
|
|
1351
|
-
onThinkingDelta: (text) => console.log(`Thinking delta: ${text.length} chars`),
|
|
1352
|
-
onToolResult: (result) => console.log(`Tool ${result.name}: ${result.content.slice(0, 100)}`),
|
|
1353
|
-
onSidecarMessage: (event) => console.log(`[sidecar:${event.verdict}] ${event.content}`),
|
|
1354
|
-
onComplete: () => console.log('\nDone!'),
|
|
1355
|
-
onError: (e) => console.error(e.message),
|
|
1356
|
-
};
|
|
1357
|
-
|
|
1358
|
-
const result = await runKodaX({
|
|
1359
|
-
provider: 'zhipu-coding',
|
|
1360
|
-
effort: 'auto',
|
|
1361
|
-
events,
|
|
1362
|
-
}, 'What is 1+1?');
|
|
1363
|
-
|
|
1364
|
-
console.log(result.lastText);
|
|
1365
|
-
```
|
|
1366
|
-
|
|
1367
|
-
#### Continuous Session (KodaXClient)
|
|
1368
|
-
|
|
1369
|
-
```typescript
|
|
1370
|
-
import { KodaXClient } from '@kodax-ai/kodax';
|
|
1371
|
-
|
|
1372
|
-
const client = new KodaXClient({
|
|
1373
|
-
provider: 'zhipu-coding',
|
|
1374
|
-
effort: 'auto',
|
|
1375
|
-
events: {
|
|
1376
|
-
onTextDelta: (t) => process.stdout.write(t),
|
|
1377
|
-
},
|
|
1378
|
-
});
|
|
1379
|
-
|
|
1380
|
-
// First message
|
|
1381
|
-
await client.send('Read package.json');
|
|
1382
|
-
|
|
1383
|
-
// Continue same session
|
|
1384
|
-
await client.send('Summarize it');
|
|
1385
|
-
|
|
1386
|
-
console.log(client.getSessionId());
|
|
1387
|
-
```
|
|
1388
|
-
|
|
1389
|
-
#### Custom Session Storage
|
|
1390
|
-
|
|
1391
|
-
```typescript
|
|
1392
|
-
import { runKodaX, KodaXSessionStorage, KodaXMessage } from '@kodax-ai/kodax';
|
|
1393
|
-
|
|
1394
|
-
class MyDatabaseStorage implements KodaXSessionStorage {
|
|
1395
|
-
async save(id: string, data: { messages: KodaXMessage[]; title: string; gitRoot: string }) {
|
|
1396
|
-
// Save to your database
|
|
1397
|
-
}
|
|
1398
|
-
async load(id: string) {
|
|
1399
|
-
// Load from your database
|
|
1400
|
-
return null;
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
await runKodaX({
|
|
1405
|
-
provider: 'zhipu-coding',
|
|
1406
|
-
session: {
|
|
1407
|
-
id: 'my-session-123',
|
|
1408
|
-
storage: new MyDatabaseStorage(),
|
|
1409
|
-
},
|
|
1410
|
-
events: { ... },
|
|
1411
|
-
}, 'task');
|
|
1412
|
-
```
|
|
1413
|
-
|
|
1414
|
-
### Library Modes Comparison
|
|
1415
|
-
|
|
1416
|
-
| Feature | runKodaX | KodaXClient |
|
|
1417
|
-
|---------|----------|-------------|
|
|
1418
|
-
| **Message Memory** | ❌ No | ✅ Yes |
|
|
1419
|
-
| **Call Style** | Function | Class instance |
|
|
1420
|
-
| **Context** | Independent each time | Accumulates |
|
|
1421
|
-
| **Use Case** | Single tasks, batch processing | Interactive dialogue, multi-step tasks |
|
|
1422
|
-
|
|
1423
|
-
---
|
|
1424
|
-
|
|
1425
|
-
## SDK Usage
|
|
1426
|
-
|
|
1427
|
-
KodaX ships as a single npm package `@kodax-ai/kodax` with 12 SDK subpath exports (ADR-024 v0.7.39 + ADR-032 v0.7.42 + ADR-038 v0.7.49 + v0.7.56 `/media` + v0.7.64 `/runtime` + v0.7.68 `/experimental-memory` + v0.7.69 `/a2a` + v0.7.78 `/sandbox`). Each subpath is tree-shake-friendly so consumers pull only what they need:
|
|
1428
|
-
|
|
1429
|
-
```bash
|
|
1430
|
-
npm install @kodax-ai/kodax
|
|
1431
|
-
```
|
|
1432
|
-
|
|
1433
|
-
```typescript
|
|
1434
|
-
import { runKodaX } from '@kodax-ai/kodax'; // root: CLI helpers + runKodaX
|
|
1435
|
-
import { Runner, runFanOut } from '@kodax-ai/kodax/agent'; // generic Agent framework
|
|
1436
|
-
import { getProvider } from '@kodax-ai/kodax/llm'; // 16-alias LLM abstraction
|
|
1437
|
-
import { KODAX_TOOLS } from '@kodax-ai/kodax/coding'; // tools + prompts + agent loop
|
|
1438
|
-
import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifact helpers
|
|
1439
|
-
import { runInkInteractiveMode } from '@kodax-ai/kodax/repl'; // Ink TUI entrypoint
|
|
1440
|
-
import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
|
|
1441
|
-
import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
|
|
1442
|
-
import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
|
|
1443
|
-
import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
|
|
1444
|
-
import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // explicit standalone containment
|
|
1445
|
-
import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
|
|
1446
|
-
import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in experimental memory SDK
|
|
1447
|
-
```
|
|
1448
|
-
|
|
1449
|
-
> The SDK is **ESM-only**. CommonJS consumers (Electron main / Webpack CJS / `require()` callers) must use `await import('@kodax-ai/kodax/...')` — see [public_docs/sdk/embedder-guide.md §5](public_docs/sdk/embedder-guide.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles).
|
|
1450
|
-
|
|
1451
|
-
### `@kodax-ai/kodax/llm` — LLM Abstraction
|
|
1452
|
-
|
|
1453
|
-
16 built-in provider aliases (Anthropic, OpenAI, DeepSeek, Kimi, Kimi-Code, Qwen, Qwen-Token-Plan, Zhipu, Zhipu-Coding, Zai-Coding, MiniMax-Coding, MiMo, MiMo-Coding, Ark-Coding, Gemini-CLI, Codex-CLI) + custom provider registration.
|
|
1454
|
-
|
|
1455
|
-
```typescript
|
|
1456
|
-
import { getProvider, KodaXBaseProvider } from '@kodax-ai/kodax/llm';
|
|
1457
|
-
|
|
1458
|
-
const provider = getProvider('anthropic');
|
|
1459
|
-
const stream = await provider.streamCompletion(
|
|
1460
|
-
[{ role: 'user', content: 'Hello!' }],
|
|
1461
|
-
{ onTextDelta: (text) => process.stdout.write(text) }
|
|
1462
|
-
);
|
|
1463
|
-
|
|
1464
|
-
for await (const result of stream) {
|
|
1465
|
-
if (result.type === 'text') { /* … */ }
|
|
1466
|
-
else if (result.type === 'tool_use') { /* … */ }
|
|
1467
|
-
}
|
|
1468
|
-
```
|
|
1469
|
-
|
|
1470
|
-
**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.
|
|
1471
|
-
|
|
1472
|
-
### `@kodax-ai/kodax/agent` — Agent Framework (standalone-consumable)
|
|
1473
|
-
|
|
1474
|
-
ADR-021 standalone-consumable: `@kodax-ai/agent` has **zero inbound `@kodax-ai/coding` dependency** — you can wire any tool surface on top of it.
|
|
1475
|
-
|
|
1476
|
-
```typescript
|
|
1477
|
-
import {
|
|
1478
|
-
Runner,
|
|
1479
|
-
runFanOut,
|
|
1480
|
-
runWithIdleYield,
|
|
1481
|
-
createAgentActorController,
|
|
1482
|
-
generateSessionId,
|
|
1483
|
-
estimateTokens,
|
|
1484
|
-
DefaultSummaryCompaction,
|
|
1485
|
-
} from '@kodax-ai/kodax/agent';
|
|
1486
|
-
|
|
1487
|
-
// Bounded-concurrency fan-out with abort + structured progress events (v0.7.39 FEATURE_120)
|
|
1488
|
-
const result = await runFanOut({
|
|
1489
|
-
bundles: [{ id: 'a', task: 'audit-foo' }, { id: 'b', task: 'audit-bar' }],
|
|
1490
|
-
maxParallel: 4,
|
|
1491
|
-
run: async (bundle) => doWork(bundle),
|
|
1492
|
-
});
|
|
1493
|
-
|
|
1494
|
-
// Runtime-owned Actor identity tree (inject an executor before starting Turns)
|
|
1495
|
-
const actors = await createAgentActorController();
|
|
1496
|
-
const tree = actors.list('/root');
|
|
1497
|
-
|
|
1498
|
-
// Pluggable compaction policy (FEATURE_081)
|
|
1499
|
-
const policy = new DefaultSummaryCompaction({ thresholdRatio: 0.8, keepRecent: 10 });
|
|
1500
|
-
```
|
|
1501
|
-
|
|
1502
|
-
`DefaultSummaryCompaction` is a standalone agent-layer primitive for custom
|
|
1503
|
-
loops. It does not replace or disable KodaX's always-on coding-runtime policy
|
|
1504
|
-
described under FEATURE_272 above.
|
|
1505
|
-
|
|
904
|
+
|
|
905
|
+
**Bidirectional A2A 1.0 (FEATURE_267, v0.7.69)**: `/a2a` discovers allowed Agent Cards and installs a JSON-RPC/SSE executor through the existing F258 plane. Configured outbound Agents are also registered automatically as `external:<name>` in embedded CLI and user-daemon Runtimes, so the main Agent can orchestrate them without host code. One `a2a.json` may hold many outbound registrations and at most one inbound server, which publishes either the Runtime default or one validated `~/.kodax/agents/*.md` Agent behind an authenticated Runtime facade. The built-in listener is loopback-only and will not return a port blocked by Fetch-compatible clients; public deployment uses `handle()` behind host-owned TLS and authorization. A2A 0.3, gRPC, HTTP+JSON, push notifications, and automatic public exposure are not advertised. See the [client/server recipes and security boundaries](public_docs/sdk/embedder-guide.md#22-bidirectional-a2a-10--a2a-feature_267-v0769).
|
|
906
|
+
|
|
907
|
+
**A2A interoperability and authentication hardening** keeps a discovered
|
|
908
|
+
interface on the trusted Agent Card origin and sends credentials only when one
|
|
909
|
+
complete Card/Skill security requirement is satisfiable. The no-code client
|
|
910
|
+
supports HTTP Bearer compatibility and OAuth 2.0 Client Credentials; for OAuth,
|
|
911
|
+
an external Authorization Server issues short-lived access tokens and KodaX
|
|
912
|
+
caches them only in memory. Inbound `a2a serve` can validate RFC 9068 JWT access
|
|
913
|
+
tokens from an external issuer/JWKS, but never signs or issues production
|
|
914
|
+
tokens itself. It resolves its provider from CLI, then environment, config, and
|
|
915
|
+
the built-in default; a Markdown Agent can pin its own provider. Input
|
|
916
|
+
continuation resumes the original Runtime run, task history and retention are
|
|
917
|
+
bounded with stable cursor pagination, and authenticated SSE is correlated
|
|
918
|
+
before falling back to polling after an early normal EOF. Only direct remote
|
|
919
|
+
artifacts, broker-staged outputs, and outputs from a successfully admitted
|
|
920
|
+
Skill script can be published; ordinary workspace writes and local paths stay
|
|
921
|
+
private.
|
|
922
|
+
|
|
923
|
+
This authentication and per-Agent activation hardening is a post-release
|
|
924
|
+
closure of the v0.7.69 F267/F268 design and ships in the v0.7.71 patch; it is
|
|
925
|
+
not a claim that older v0.7.69 binaries contained the
|
|
926
|
+
later OAuth profiles.
|
|
927
|
+
|
|
928
|
+
**v0.7.70 MCP discovery hardening** uses exact capability IDs and revisioned
|
|
929
|
+
cursors while admitting results against real physical capacity. Compact CJK
|
|
930
|
+
queries are segmented, and a cross-language lexical zero match either returns a
|
|
931
|
+
lossless bounded grouped inventory or one concise retry in the catalog language.
|
|
932
|
+
Partial provider failure remains explicit rather than disappearing into an
|
|
933
|
+
apparently complete result.
|
|
934
|
+
|
|
935
|
+
The complete built-in path is available without writing TypeScript:
|
|
936
|
+
|
|
937
|
+
```bash
|
|
938
|
+
# Call another A2A Agent
|
|
939
|
+
kodax a2a add research https://agent.example/.well-known/agent-card.json --effect read
|
|
940
|
+
kodax a2a test research
|
|
941
|
+
kodax a2a call research "Summarize this topic"
|
|
942
|
+
|
|
943
|
+
# Explicitly authorize a private plaintext endpoint (prefer HTTPS when available)
|
|
944
|
+
kodax a2a add intranet http://10.20.30.40/.well-known/agent-card.json \
|
|
945
|
+
--allow-private --allow-insecure-http --effect read
|
|
946
|
+
|
|
947
|
+
# Stage an OAuth-protected Agent, then hot-activate/deactivate it
|
|
948
|
+
export RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
|
|
949
|
+
# PowerShell: $env:RESEARCH_A2A_CLIENT_SECRET='provisioned-by-your-authorization-server'
|
|
950
|
+
# PowerShell: run the command on one line or replace each trailing \ with a backtick.
|
|
951
|
+
kodax a2a add reviewer https://reviewer.example/.well-known/agent-card.json \
|
|
952
|
+
--disabled --effect read --oauth-scheme enterprise-oauth \
|
|
953
|
+
--oauth-issuer https://identity.example/ \
|
|
954
|
+
--oauth-token-url https://identity.example/oauth/token \
|
|
955
|
+
--oauth-client-id kodax-reviewer \
|
|
956
|
+
--oauth-client-secret-env RESEARCH_A2A_CLIENT_SECRET \
|
|
957
|
+
--oauth-scope a2a.invoke --oauth-resource https://reviewer.example/
|
|
958
|
+
kodax a2a enable reviewer
|
|
959
|
+
kodax a2a disable reviewer # blocks new dispatch; does not cancel in-flight tasks
|
|
960
|
+
|
|
961
|
+
# Expose the Runtime default Agent, or pass a name from ~/.kodax/agents/*.md
|
|
962
|
+
export KODAX_A2A_TOKEN='replace-with-a-long-random-token'
|
|
963
|
+
# PowerShell: $env:KODAX_A2A_TOKEN='replace-with-a-long-random-token'
|
|
964
|
+
kodax a2a expose # or: kodax a2a expose document-agent
|
|
965
|
+
kodax a2a serve # loopback http://127.0.0.1:8765
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
MCP, A2A, and Extension declarations live in one user file per domain under
|
|
969
|
+
`~/.kodax/integrations/`. Use `kodax config paths`,
|
|
970
|
+
`kodax config template <core|mcp|a2a|extensions>`,
|
|
971
|
+
`kodax integrations migrate --apply`, and the `kodax mcp`, `kodax a2a`, or
|
|
972
|
+
`kodax extensions` commands to manage them. Migration imports only legacy
|
|
973
|
+
`config.json#mcpServers` and `config.json#extensions`; A2A has no legacy source.
|
|
974
|
+
It never overwrites an existing destination. The first MCP/Extension mutation
|
|
975
|
+
can stage legacy entries. Remove legacy keys only with
|
|
976
|
+
`--apply --cleanup-legacy`, after reviewing destination files and
|
|
977
|
+
literal-secret warnings. Running
|
|
978
|
+
CLI/daemon hosts retain the
|
|
979
|
+
last valid revision, atomically replace the complete MCP provider, reconcile
|
|
980
|
+
Extensions per entry, and hot-register outbound A2A Agents. Each A2A entry has
|
|
981
|
+
a desired `enabled` switch; `kodax a2a list` shows configuration, while the
|
|
982
|
+
owning Runtime is authoritative for live applied registrations. Disabled
|
|
983
|
+
entries are not fetched during automatic reconciliation and, after the owning
|
|
984
|
+
Runtime applies the revision, cannot accept new dispatch. The mutation command
|
|
985
|
+
itself is not cross-process acknowledgement. `a2a add --disabled` still checks
|
|
986
|
+
the Card by default unless `--no-test` is supplied, while `a2a test` performs
|
|
987
|
+
discovery/security planning without requesting an OAuth token. The fixed
|
|
988
|
+
`KODAX_A2A_TOKEN` example is an operator-provisioned compatibility credential;
|
|
989
|
+
KodaX does not generate or issue it. Disabled entries remain available for
|
|
990
|
+
later re-enable. Private-address access and non-loopback plaintext HTTP are
|
|
991
|
+
independent, persisted, default-deny permissions (`--allow-private` and
|
|
992
|
+
`--allow-insecure-http`); exact loopback HTTP remains available without either.
|
|
993
|
+
OAuth token endpoints retain their stricter HTTPS-or-exact-loopback rule.
|
|
994
|
+
Worker-hosted SDK Runtimes can load this same configured plane inside the Worker
|
|
995
|
+
owner with `worker: { configuredA2A: true }`. The CLI honors the same opt-in
|
|
996
|
+
from `~/.kodax/config.json` (`"worker": { "configuredA2A": true }`) by creating
|
|
997
|
+
a Worker-hosted embedded Runtime that loads the configured A2A plane. `a2a serve` loads
|
|
998
|
+
its configured MCP/Extension capability surface before listening and pins that
|
|
999
|
+
execution authority; it hot-reloads publication, authentication, and limits.
|
|
1000
|
+
|
|
1001
|
+
A2A configuration migration and retained task ownership are separate. If a
|
|
1002
|
+
v0.7.70 task store must remain addressable after the realm-aware upgrade, stop
|
|
1003
|
+
the A2A server, run `kodax a2a migrate-tasks` to inspect the exact-owner plan,
|
|
1004
|
+
then apply it with `--apply --confirm-server-stopped`. OAuth migration also
|
|
1005
|
+
requires the known historical `--subject`; normal serving never guesses or
|
|
1006
|
+
dual-reads a legacy owner key.
|
|
1007
|
+
|
|
1008
|
+
Agent, Skill, Extension-tool authority, workspace, tool-policy, or task-store
|
|
1009
|
+
changes require an explicit server restart. Managed
|
|
1010
|
+
A2A contexts default to `~/kodax_a2a_server_workspace/<runtime-profile>/contexts/`.
|
|
1011
|
+
Exact Skill scripts require the opt-in isolated policy and a passing
|
|
1012
|
+
`kodax sandbox doctor` (`kodax sandbox setup` performs the explicit Windows
|
|
1013
|
+
one-time provisioning).
|
|
1014
|
+
|
|
1015
|
+
---
|
|
1016
|
+
|
|
1017
|
+
## Features
|
|
1018
|
+
|
|
1019
|
+
- **Modular Architecture** - Use as CLI, as a library, or as a Node-free single binary
|
|
1020
|
+
- **16 Built-in Provider Aliases** - Anthropic, OpenAI, DeepSeek, Kimi, Kimi Code, Qwen, Qwen Token Plan, Zhipu, Zhipu Coding, Zai Coding, MiniMax Coding, MiMo Coding, MiMo, Ark Coding, Gemini CLI, Codex CLI - plus user-defined OpenAI/Anthropic-compatible providers
|
|
1021
|
+
- **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
|
|
1022
|
+
- **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. Adaptive child steering uses the canonical Actor collaboration tools with idle-yield waiting; specialist routing uses `spawn_agent(agent_id=...)`.
|
|
1023
|
+
- **Reasoning Effort** - Effort-first control (`off/auto/low/medium/high` plus model-supported extras) across providers
|
|
1024
|
+
- **Streaming Output** - Real-time response display
|
|
1025
|
+
- **Session Management** - JSONL format with branchable session lineage tree
|
|
1026
|
+
- **Skills System** - Natural language triggering, extensible, role-projected in AMA
|
|
1027
|
+
- **Repo Intelligence** - Built-in full/light repository intelligence with native KodaX auto-injection lane
|
|
1028
|
+
- **Rich Tool Surface** - 50+ built-in tools across file ops, shell, search, repo intelligence, MCP capabilities, git worktree, and agent control
|
|
1029
|
+
- **Permission Control** - 3 permission modes with pattern-based control
|
|
1030
|
+
- **Standalone Binary** - `bun --compile` releases for Win/macOS/Linux x64+arm64, no Node.js required on target machines
|
|
1031
|
+
- **Cross-Platform** - Windows/macOS/Linux
|
|
1032
|
+
- **TypeScript Native** - Full type safety and IDE support
|
|
1033
|
+
|
|
1034
|
+
---
|
|
1035
|
+
|
|
1036
|
+
## Installation
|
|
1037
|
+
|
|
1038
|
+
### As CLI Tool
|
|
1039
|
+
|
|
1040
|
+
```bash
|
|
1041
|
+
# Clone repository
|
|
1042
|
+
git clone https://github.com/icetomoyo/KodaX.git
|
|
1043
|
+
cd KodaX
|
|
1044
|
+
|
|
1045
|
+
# Install dependencies (includes workspace packages)
|
|
1046
|
+
npm install
|
|
1047
|
+
|
|
1048
|
+
# Build the monorepo
|
|
1049
|
+
npm run build
|
|
1050
|
+
|
|
1051
|
+
# Link globally (development mode)
|
|
1052
|
+
npm link
|
|
1053
|
+
|
|
1054
|
+
# Now you can use 'kodax' anywhere
|
|
1055
|
+
kodax "your task"
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
### As Standalone Binary (no Node required on target)
|
|
1059
|
+
|
|
1060
|
+
KodaX can be packaged into a single executable + a small `builtin/` sidecar directory using `bun --compile`. The target machine does **not** need Node.js or any other runtime.
|
|
1061
|
+
|
|
1062
|
+
Supported targets: `win-x64`, `linux-x64`, `linux-arm64`, `darwin-x64`, `darwin-arm64`. Win7 / pre-glibc-2.27 distros / LoongArch are not supported.
|
|
1063
|
+
|
|
1064
|
+
**Build locally**:
|
|
1065
|
+
|
|
1066
|
+
```bash
|
|
1067
|
+
# Install Bun once on your build machine
|
|
1068
|
+
npm i -g bun # or scoop/brew/curl install — see docs/release.md
|
|
1069
|
+
|
|
1070
|
+
npm run build:binary # Current host platform (fastest)
|
|
1071
|
+
npm run build:binary:all # All five targets in sequence
|
|
1072
|
+
node scripts/build-binary.mjs --target=linux-arm64 # Specific target
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
Output lives under `dist/binary/<target>/`:
|
|
1076
|
+
|
|
1077
|
+
```
|
|
1078
|
+
dist/binary/linux-x64/
|
|
1079
|
+
├── kodax # ~60 MB Bun-compiled executable
|
|
1080
|
+
├── builtin/ # Sidecar built-in skills
|
|
1081
|
+
├── provider-capabilities.json
|
|
1082
|
+
├── semantic-worker.js # Repo-intelligence Worker
|
|
1083
|
+
├── runtime-worker.js # SDK Runtime Worker
|
|
1084
|
+
└── constructed-handler-worker.js # Constructed-tool Worker
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
Smoke-test: `dist/binary/<host>/kodax --version`.
|
|
1088
|
+
|
|
1089
|
+
**Automated release**: pushing a `v*` git tag triggers `.github/workflows/release.yml`, which builds all five targets on native runners, runs smoke tests, and publishes a GitHub Release with archives + SHA256SUMS. Use the `workflow_dispatch` button in the Actions UI to test the pipeline without tagging.
|
|
1090
|
+
|
|
1091
|
+
See [docs/release.md](docs/release.md) for full details on build flags, archive layout, troubleshooting, and the build-time `KODAX_BUNDLED` / `KODAX_VERSION` defines.
|
|
1092
|
+
|
|
1093
|
+
### As Library
|
|
1094
|
+
|
|
1095
|
+
```bash
|
|
1096
|
+
npm install @kodax-ai/kodax
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
```typescript
|
|
1100
|
+
import { runKodaX } from '@kodax-ai/kodax';
|
|
1101
|
+
|
|
1102
|
+
process.env.ZHIPU_API_KEY = process.env.ZHIPU_API_KEY ?? 'your_api_key';
|
|
1103
|
+
|
|
1104
|
+
const result = await runKodaX({
|
|
1105
|
+
provider: 'zhipu-coding',
|
|
1106
|
+
effort: 'auto',
|
|
1107
|
+
events: {
|
|
1108
|
+
onTextDelta: (text) => process.stdout.write(text),
|
|
1109
|
+
onComplete: () => console.log('\nDone!'),
|
|
1110
|
+
},
|
|
1111
|
+
}, 'your task');
|
|
1112
|
+
|
|
1113
|
+
console.log(result.lastText);
|
|
1114
|
+
```
|
|
1115
|
+
|
|
1116
|
+
#### SDK Subpath Imports (v0.7.39+)
|
|
1117
|
+
|
|
1118
|
+
For smaller surface and tree-shake-friendly imports, the SDK is also exposed via subpath exports — pick only the package(s) you need:
|
|
1119
|
+
|
|
1120
|
+
```typescript
|
|
1121
|
+
import { Runner } from '@kodax-ai/kodax/agent'; // agent runtime
|
|
1122
|
+
import { getProvider } from '@kodax-ai/kodax/llm'; // LLM abstraction (16 aliases)
|
|
1123
|
+
import { runKodaX } from '@kodax-ai/kodax/coding'; // coding tools + prompts
|
|
1124
|
+
import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifacts
|
|
1125
|
+
import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
|
|
1126
|
+
import { loadConfig } from '@kodax-ai/kodax/repl'; // REPL config / session helpers
|
|
1127
|
+
import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
|
|
1128
|
+
import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
|
|
1129
|
+
import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
|
|
1130
|
+
import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // standalone ASRT containment
|
|
1131
|
+
import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
|
|
1132
|
+
import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in memory SDK
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
All 13 SDK entries (root + 12 subpaths) share internal code via ESM chunk splitting — importing from `/agent` does not pull in `/repl`'s Ink + React surface.
|
|
1136
|
+
|
|
1137
|
+
For the complete host-facing contract — including embedded/Worker/daemon ownership,
|
|
1138
|
+
external-agent registration and task control, session cursor pagination, workflow
|
|
1139
|
+
model-tier routing, and efficiency telemetry — see the
|
|
1140
|
+
[SDK Embedder Integration Guide](public_docs/sdk/embedder-guide.md).
|
|
1141
|
+
|
|
1142
|
+
> **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 [public_docs/sdk/embedder-guide.md §5](public_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.
|
|
1143
|
+
|
|
1144
|
+
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.
|
|
1145
|
+
|
|
1146
|
+
---
|
|
1147
|
+
|
|
1148
|
+
## Usage
|
|
1149
|
+
|
|
1150
|
+
### REPL Quickstart
|
|
1151
|
+
|
|
1152
|
+
Running `kodax` with no prompt starts the interactive REPL.
|
|
1153
|
+
|
|
1154
|
+
```bash
|
|
1155
|
+
kodax
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
Inside the REPL you can type normal requests or slash commands:
|
|
1159
|
+
|
|
1160
|
+
```text
|
|
1161
|
+
Read package.json and summarize the architecture
|
|
1162
|
+
/model
|
|
1163
|
+
/mode
|
|
1164
|
+
/help
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
### CLI Quickstart
|
|
1168
|
+
|
|
1169
|
+
```bash
|
|
1170
|
+
# Set API key
|
|
1171
|
+
export ZHIPU_API_KEY=your_api_key
|
|
1172
|
+
|
|
1173
|
+
# Basic usage
|
|
1174
|
+
kodax "Help me create a TypeScript project"
|
|
1175
|
+
|
|
1176
|
+
# Choose a provider explicitly
|
|
1177
|
+
kodax --provider openai --model gpt-5.4 "Create a REST API"
|
|
1178
|
+
|
|
1179
|
+
# Use higher reasoning effort
|
|
1180
|
+
kodax --effort high "Review this architecture"
|
|
1181
|
+
```
|
|
1182
|
+
|
|
1183
|
+
### Session Workflows
|
|
1184
|
+
|
|
1185
|
+
Use a session when you want memory across turns. Without a session, each CLI call is independent.
|
|
1186
|
+
|
|
1187
|
+
```bash
|
|
1188
|
+
# No memory: two separate calls
|
|
1189
|
+
kodax "Read src/auth.ts"
|
|
1190
|
+
kodax "Summarize it"
|
|
1191
|
+
|
|
1192
|
+
# With memory: same session
|
|
1193
|
+
kodax --session my-project "Read package.json"
|
|
1194
|
+
kodax --session my-project "Summarize it"
|
|
1195
|
+
kodax --session my-project "How should I fix the first issue?"
|
|
1196
|
+
|
|
1197
|
+
# Session management
|
|
1198
|
+
kodax -r # Search, page, and select a non-empty session
|
|
1199
|
+
kodax -r <session-id> # Resume a known session directly
|
|
1200
|
+
kodax -r "Review runtime" # Resume a unique exact title; duplicates open the picker
|
|
1201
|
+
kodax --session list # List up to 50 non-empty sessions
|
|
1202
|
+
kodax --session cleanup-acp # Preview strictly matched empty ACP-test pollution
|
|
1203
|
+
```
|
|
1204
|
+
|
|
1205
|
+
Bare `-r` opens an interactive picker with incremental search, arrow/PageUp/PageDown
|
|
1206
|
+
navigation, Tab completion, full selected-session ID display, and Enter-to-resume.
|
|
1207
|
+
An explicit value checks the complete session ID first, then an exact
|
|
1208
|
+
case-insensitive title; duplicate titles open a narrowed picker instead of
|
|
1209
|
+
silently choosing one. The picker loads before the full CLI, so session listing
|
|
1210
|
+
remains responsive. After selection it hands terminal input to the resumed
|
|
1211
|
+
REPL; Esc releases the picker's stdin ownership and immediately returns to the
|
|
1212
|
+
invoking shell. Session replay preserves each recorded message/event timestamp.
|
|
1213
|
+
|
|
1214
|
+
Cleanup is preview-only unless
|
|
1215
|
+
`--apply-session-cleanup` is also provided; matching sessions are archived rather
|
|
1216
|
+
than permanently deleted.
|
|
1217
|
+
|
|
1218
|
+
### Session Patterns
|
|
1219
|
+
|
|
1220
|
+
```bash
|
|
1221
|
+
# ❌ No memory: two independent calls
|
|
1222
|
+
kodax "Read src/auth.ts" # Agent reads and responds
|
|
1223
|
+
kodax "Summarize it" # Agent doesn't know what to summarize
|
|
1224
|
+
|
|
1225
|
+
# ✅ With memory: same session
|
|
1226
|
+
kodax --session auth-review "Read src/auth.ts"
|
|
1227
|
+
kodax --session auth-review "Summarize it" # Agent knows to summarize auth.ts
|
|
1228
|
+
kodax --session auth-review "How to fix first issue" # Agent has context
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
### Workflow Examples
|
|
1232
|
+
|
|
1233
|
+
```bash
|
|
1234
|
+
# Code review (multi-turn conversation)
|
|
1235
|
+
kodax --session review "Review src/ directory"
|
|
1236
|
+
kodax --session review "Focus on security issues"
|
|
1237
|
+
kodax --session review "Give me fix suggestions"
|
|
1238
|
+
|
|
1239
|
+
# Project development (continuous session)
|
|
1240
|
+
kodax --session todo-app "Create a Todo application"
|
|
1241
|
+
kodax --session todo-app "Add delete functionality"
|
|
1242
|
+
kodax --session todo-app "Write tests"
|
|
1243
|
+
```
|
|
1244
|
+
|
|
1245
|
+
### CLI Reference
|
|
1246
|
+
|
|
1247
|
+
```text
|
|
1248
|
+
kodax Start the interactive REPL
|
|
1249
|
+
-h, --help [topic] Show help or topic help
|
|
1250
|
+
-p, --print <text> Run a single task and exit
|
|
1251
|
+
-c, --continue Continue the most recent non-empty conversation in this directory
|
|
1252
|
+
-r, --resume [value] Resume by ID/exact title, or open the searchable picker
|
|
1253
|
+
-m, --provider Provider to use
|
|
1254
|
+
--model <name> Override the model
|
|
1255
|
+
--reasoning <mode> off | auto | quick | balanced | deep
|
|
1256
|
+
-t, --thinking Compatibility alias for --reasoning auto
|
|
1257
|
+
-s, --session <op> Session ID or legacy session operation
|
|
1258
|
+
-j, --parallel Enable parallel tool execution
|
|
1259
|
+
--max-iter <n> Max iterations
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
### Permission Control
|
|
1263
|
+
|
|
1264
|
+
KodaX provides 3 permission modes for fine-grained control:
|
|
1265
|
+
|
|
1266
|
+
| Mode | Description | Tools Need Confirmation |
|
|
1267
|
+
|------|-------------|------------------------|
|
|
1268
|
+
| `plan` | Read-only planning mode | All modification tools blocked |
|
|
1269
|
+
| `accept-edits` | Auto-accept file edits | bash only |
|
|
1270
|
+
| `auto` | Runtime-owned LLM/rules classification within the project boundary | Only explicit classifier escalation |
|
|
1271
|
+
|
|
1272
|
+
```bash
|
|
1273
|
+
# In REPL, use /mode command
|
|
1274
|
+
/mode plan # Switch to plan mode (read-only)
|
|
1275
|
+
/mode accept-edits # Switch to accept-edits mode
|
|
1276
|
+
/mode auto # Switch to Runtime-owned Auto Mode
|
|
1277
|
+
/auto # Alias for auto
|
|
1278
|
+
|
|
1279
|
+
# Check current mode
|
|
1280
|
+
/mode
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
**Features:**
|
|
1284
|
+
- In `accept-edits` mode, choosing "always" can persist safe Bash allow-patterns
|
|
1285
|
+
- Plan mode includes system prompt context for LLM awareness
|
|
1286
|
+
- Sensitive/protected or unresolved targets enter Auto[LLM]/approval review;
|
|
1287
|
+
ordinary reads outside the project are allowed
|
|
1288
|
+
- Pattern-based permission: Allow specific Bash commands (e.g., `Bash(npm install)`)
|
|
1289
|
+
- Unified diff display for write/edit operations
|
|
1290
|
+
- Auto Mode first admits exactly modeled safe reads and workspace/temp
|
|
1291
|
+
mutations without classifier latency. Remaining actions are reviewed against
|
|
1292
|
+
bounded user intent and exact operation facts; a safe verdict creates no
|
|
1293
|
+
pending approval request. Classifier failures retry once, then use the
|
|
1294
|
+
Accept-edits safety boundary rather than silently switching to Auto[rules].
|
|
1295
|
+
- Shift-Tab cycles `Plan -> Edits -> Auto`; Shift+Enter inserts a newline. Auto
|
|
1296
|
+
immediately displays `Auto[LLM]` or `Auto[RULES]`, and rapid mode changes are
|
|
1297
|
+
persisted in input order. `Auto[RULES]` remains an explicit/manual engine;
|
|
1298
|
+
use `/auto-engine llm` to select LLM classification.
|
|
1299
|
+
- Runtime-backed prompts can offer exact `allow once`, `allow this session`,
|
|
1300
|
+
and `always allow` choices. Return the Runtime-issued opaque suggestion;
|
|
1301
|
+
never derive or widen a permission rule from the displayed command or path.
|
|
1302
|
+
Persistent grants are daemon-owned, revisioned, and can be listed/revoked
|
|
1303
|
+
through `runtime.permissions` by an authorized SDK host. Dynamic shell
|
|
1304
|
+
commands deliberately receive no persistent-grant suggestion.
|
|
1305
|
+
|
|
1306
|
+
`kodax -c` skips zero-message ACP/bootstrap placeholders even when they are
|
|
1307
|
+
newer than the last real conversation. The same newest non-empty rule applies
|
|
1308
|
+
to Ink, classic, one-shot CLI, and coding-runtime auto-resume; an explicit
|
|
1309
|
+
session ID always wins. Interactive resume also restores the saved workspace
|
|
1310
|
+
runtime before relative shell commands or the next model turn.
|
|
1311
|
+
|
|
1312
|
+
### CLI Help Topics
|
|
1313
|
+
|
|
1314
|
+
Get detailed help for specific topics:
|
|
1315
|
+
|
|
1316
|
+
```bash
|
|
1317
|
+
# Basic help
|
|
1318
|
+
kodax -h
|
|
1319
|
+
kodax --help
|
|
1320
|
+
|
|
1321
|
+
# Detailed topic help
|
|
1322
|
+
kodax -h sessions # Session management details
|
|
1323
|
+
kodax -h init # Long-running project initialization
|
|
1324
|
+
kodax -h project # Project mode / harness workflow
|
|
1325
|
+
kodax -h auto # Auto-continue mode
|
|
1326
|
+
kodax -h provider # LLM provider configuration
|
|
1327
|
+
kodax -h thinking # Thinking/reasoning effort and compatibility modes
|
|
1328
|
+
kodax -h team # Multi-agent parallel execution
|
|
1329
|
+
kodax -h print # Print configuration
|
|
1330
|
+
```
|
|
1331
|
+
|
|
1332
|
+
### Environment Variables
|
|
1333
|
+
|
|
1334
|
+
KodaX recognizes a number of environment variables for tuning runtime behavior. The most commonly used ones are listed below; for the full list, search the repo for `process.env.KODAX_`.
|
|
1335
|
+
|
|
1336
|
+
#### `KODAX_MAX_OUTPUT_TOKENS`
|
|
1337
|
+
|
|
1338
|
+
Overrides the per-turn `max_tokens` value sent to **every** provider (Anthropic, OpenAI, Zhipu, Kimi, MiniMax, Qwen, DeepSeek, MiMo, Gemini, Codex, …). Set to a positive integer; unset or non-numeric values are ignored. This is an **explicit user intent**: when set, it wins over the provider's model descriptor cap, over the provider config default, and over the global `KODAX_MAX_TOKENS` fallback. RST defense is handled at the provider config layer (`streamMaxDurationMs` watchdog + non-streaming fallback in `packages/llm/src/providers/registry.ts`), so this variable is purely an output-budget knob.
|
|
1339
|
+
|
|
1340
|
+
```bash
|
|
1341
|
+
# Allow up to 48K output tokens per turn (use a higher cap when generating long files)
|
|
1342
|
+
export KODAX_MAX_OUTPUT_TOKENS=48000
|
|
1343
|
+
kodax "generate the full implementation"
|
|
1344
|
+
|
|
1345
|
+
# Unset to restore default behavior
|
|
1346
|
+
unset KODAX_MAX_OUTPUT_TOKENS
|
|
1347
|
+
```
|
|
1348
|
+
|
|
1349
|
+
Precedence used by every provider's `getEffectiveMaxOutputTokens()` (see `packages/llm/src/providers/base.ts`):
|
|
1350
|
+
|
|
1351
|
+
1. One-shot per-request override (agent-loop escalation / context-overflow recovery — internal)
|
|
1352
|
+
2. **`KODAX_MAX_OUTPUT_TOKENS`** (this variable, explicit user intent)
|
|
1353
|
+
3. Active model descriptor's `maxOutputTokens` (FEATURE_098 per-model cap)
|
|
1354
|
+
4. Provider config default
|
|
1355
|
+
5. Global `KODAX_MAX_TOKENS` fallback
|
|
1356
|
+
|
|
1357
|
+
Related variables: `KODAX_MAX_TOKENS` (global fallback when no provider/model cap applies), `KODAX_ESCALATED_MAX_OUTPUT_TOKENS` (escalation budget used by the agent loop when a turn returns `stop_reason: max_tokens`).
|
|
1358
|
+
|
|
1359
|
+
> **Retired in v0.7.42**: `KODAX_RST_PRONE_PROVIDERS` and `KODAX_WRITE_TURN_MAX_TOKENS` (the v0.7.28 P2b write-turn cap mechanism) are no longer recognized. The 2026-04 bench measured RST as time-based (zhipu-coding 308s server kill window), not payload-size-based, so the cap was retired in favor of the per-provider `streamMaxDurationMs` watchdog + non-streaming fallback chain (configured in `registry.ts`). Existing env exports become silent no-ops; remove them from shell profiles when convenient.
|
|
1360
|
+
|
|
1361
|
+
#### Sidecar verifier diagnostics
|
|
1362
|
+
|
|
1363
|
+
Use these when diagnosing Worker text-only completion stalls or custom provider verifier behavior:
|
|
1364
|
+
|
|
1365
|
+
```bash
|
|
1366
|
+
export KODAX_VERIFIER_LOG=1
|
|
1367
|
+
export KODAX_VERIFIER_PROVIDER=anthropic
|
|
1368
|
+
export KODAX_VERIFIER_MODEL=claude-haiku-4-5-20251001
|
|
1369
|
+
```
|
|
1370
|
+
|
|
1371
|
+
- `KODAX_VERIFIER_LOG=1` shows verifier gate/elapsed/trace information and is equivalent to `"verifierLog": true` in `~/.kodax/config.json`.
|
|
1372
|
+
- `KODAX_VERIFIER_PROVIDER` + `KODAX_VERIFIER_MODEL` route the verifier to a separate provider/model instead of inheriting the main Worker model. Set both together.
|
|
1373
|
+
- `KODAX_VERIFIER_ALWAYS=1` forces the verifier to fire on every text-only completion for debugging/regression sweeps.
|
|
1374
|
+
|
|
1375
|
+
SDK/headless hosts can observe actionable Sidecar Verifier messages via
|
|
1376
|
+
`KodaXEvents.onSidecarMessage`; JSONL output emits the same payload as
|
|
1377
|
+
`sidecar.message`. Only `revise` and `blocked` verdicts are surfaced; `accept`
|
|
1378
|
+
stays silent.
|
|
1379
|
+
|
|
1380
|
+
## Advanced Library Usage
|
|
1381
|
+
|
|
1382
|
+
#### Simple Mode (runKodaX)
|
|
1383
|
+
|
|
1384
|
+
```typescript
|
|
1385
|
+
import { runKodaX, KodaXEvents } from '@kodax-ai/kodax';
|
|
1386
|
+
|
|
1387
|
+
const events: KodaXEvents = {
|
|
1388
|
+
onTextDelta: (text) => process.stdout.write(text),
|
|
1389
|
+
onThinkingDelta: (text) => console.log(`Thinking delta: ${text.length} chars`),
|
|
1390
|
+
onToolResult: (result) => console.log(`Tool ${result.name}: ${result.content.slice(0, 100)}`),
|
|
1391
|
+
onSidecarMessage: (event) => console.log(`[sidecar:${event.verdict}] ${event.content}`),
|
|
1392
|
+
onComplete: () => console.log('\nDone!'),
|
|
1393
|
+
onError: (e) => console.error(e.message),
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1396
|
+
const result = await runKodaX({
|
|
1397
|
+
provider: 'zhipu-coding',
|
|
1398
|
+
effort: 'auto',
|
|
1399
|
+
events,
|
|
1400
|
+
}, 'What is 1+1?');
|
|
1401
|
+
|
|
1402
|
+
console.log(result.lastText);
|
|
1403
|
+
```
|
|
1404
|
+
|
|
1405
|
+
#### Continuous Session (KodaXClient)
|
|
1406
|
+
|
|
1407
|
+
```typescript
|
|
1408
|
+
import { KodaXClient } from '@kodax-ai/kodax';
|
|
1409
|
+
|
|
1410
|
+
const client = new KodaXClient({
|
|
1411
|
+
provider: 'zhipu-coding',
|
|
1412
|
+
effort: 'auto',
|
|
1413
|
+
events: {
|
|
1414
|
+
onTextDelta: (t) => process.stdout.write(t),
|
|
1415
|
+
},
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
// First message
|
|
1419
|
+
await client.send('Read package.json');
|
|
1420
|
+
|
|
1421
|
+
// Continue same session
|
|
1422
|
+
await client.send('Summarize it');
|
|
1423
|
+
|
|
1424
|
+
console.log(client.getSessionId());
|
|
1425
|
+
```
|
|
1426
|
+
|
|
1427
|
+
#### Custom Session Storage
|
|
1428
|
+
|
|
1429
|
+
```typescript
|
|
1430
|
+
import { runKodaX, KodaXSessionStorage, KodaXMessage } from '@kodax-ai/kodax';
|
|
1431
|
+
|
|
1432
|
+
class MyDatabaseStorage implements KodaXSessionStorage {
|
|
1433
|
+
async save(id: string, data: { messages: KodaXMessage[]; title: string; gitRoot: string }) {
|
|
1434
|
+
// Save to your database
|
|
1435
|
+
}
|
|
1436
|
+
async load(id: string) {
|
|
1437
|
+
// Load from your database
|
|
1438
|
+
return null;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
await runKodaX({
|
|
1443
|
+
provider: 'zhipu-coding',
|
|
1444
|
+
session: {
|
|
1445
|
+
id: 'my-session-123',
|
|
1446
|
+
storage: new MyDatabaseStorage(),
|
|
1447
|
+
},
|
|
1448
|
+
events: { ... },
|
|
1449
|
+
}, 'task');
|
|
1450
|
+
```
|
|
1451
|
+
|
|
1452
|
+
### Library Modes Comparison
|
|
1453
|
+
|
|
1454
|
+
| Feature | runKodaX | KodaXClient |
|
|
1455
|
+
|---------|----------|-------------|
|
|
1456
|
+
| **Message Memory** | ❌ No | ✅ Yes |
|
|
1457
|
+
| **Call Style** | Function | Class instance |
|
|
1458
|
+
| **Context** | Independent each time | Accumulates |
|
|
1459
|
+
| **Use Case** | Single tasks, batch processing | Interactive dialogue, multi-step tasks |
|
|
1460
|
+
|
|
1461
|
+
---
|
|
1462
|
+
|
|
1463
|
+
## SDK Usage
|
|
1464
|
+
|
|
1465
|
+
KodaX ships as a single npm package `@kodax-ai/kodax` with 12 SDK subpath exports (ADR-024 v0.7.39 + ADR-032 v0.7.42 + ADR-038 v0.7.49 + v0.7.56 `/media` + v0.7.64 `/runtime` + v0.7.68 `/experimental-memory` + v0.7.69 `/a2a` + v0.7.78 `/sandbox`). Each subpath is tree-shake-friendly so consumers pull only what they need:
|
|
1466
|
+
|
|
1467
|
+
```bash
|
|
1468
|
+
npm install @kodax-ai/kodax
|
|
1469
|
+
```
|
|
1470
|
+
|
|
1471
|
+
```typescript
|
|
1472
|
+
import { runKodaX } from '@kodax-ai/kodax'; // root: CLI helpers + runKodaX
|
|
1473
|
+
import { Runner, runFanOut } from '@kodax-ai/kodax/agent'; // generic Agent framework
|
|
1474
|
+
import { getProvider } from '@kodax-ai/kodax/llm'; // 16-alias LLM abstraction
|
|
1475
|
+
import { KODAX_TOOLS } from '@kodax-ai/kodax/coding'; // tools + prompts + agent loop
|
|
1476
|
+
import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifact helpers
|
|
1477
|
+
import { runInkInteractiveMode } from '@kodax-ai/kodax/repl'; // Ink TUI entrypoint
|
|
1478
|
+
import { SkillRegistry } from '@kodax-ai/kodax/skills'; // zero-dep skill loader
|
|
1479
|
+
import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager (v0.7.42)
|
|
1480
|
+
import { listSessions } from '@kodax-ai/kodax/session'; // session history helpers
|
|
1481
|
+
import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/daemon runtime API
|
|
1482
|
+
import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // explicit standalone containment
|
|
1483
|
+
import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client/server edge
|
|
1484
|
+
import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in experimental memory SDK
|
|
1485
|
+
```
|
|
1486
|
+
|
|
1487
|
+
> The SDK is **ESM-only**. CommonJS consumers (Electron main / Webpack CJS / `require()` callers) must use `await import('@kodax-ai/kodax/...')` — see [public_docs/sdk/embedder-guide.md §5](public_docs/sdk/embedder-guide.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles).
|
|
1488
|
+
|
|
1489
|
+
### `@kodax-ai/kodax/llm` — LLM Abstraction
|
|
1490
|
+
|
|
1491
|
+
16 built-in provider aliases (Anthropic, OpenAI, DeepSeek, Kimi, Kimi-Code, Qwen, Qwen-Token-Plan, Zhipu, Zhipu-Coding, Zai-Coding, MiniMax-Coding, MiMo, MiMo-Coding, Ark-Coding, Gemini-CLI, Codex-CLI) + custom provider registration.
|
|
1492
|
+
|
|
1493
|
+
```typescript
|
|
1494
|
+
import { getProvider, KodaXBaseProvider } from '@kodax-ai/kodax/llm';
|
|
1495
|
+
|
|
1496
|
+
const provider = getProvider('anthropic');
|
|
1497
|
+
const stream = await provider.streamCompletion(
|
|
1498
|
+
[{ role: 'user', content: 'Hello!' }],
|
|
1499
|
+
{ onTextDelta: (text) => process.stdout.write(text) }
|
|
1500
|
+
);
|
|
1501
|
+
|
|
1502
|
+
for await (const result of stream) {
|
|
1503
|
+
if (result.type === 'text') { /* … */ }
|
|
1504
|
+
else if (result.type === 'tool_use') { /* … */ }
|
|
1505
|
+
}
|
|
1506
|
+
```
|
|
1507
|
+
|
|
1508
|
+
**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.
|
|
1509
|
+
|
|
1510
|
+
### `@kodax-ai/kodax/agent` — Agent Framework (standalone-consumable)
|
|
1511
|
+
|
|
1512
|
+
ADR-021 standalone-consumable: `@kodax-ai/agent` has **zero inbound `@kodax-ai/coding` dependency** — you can wire any tool surface on top of it.
|
|
1513
|
+
|
|
1514
|
+
```typescript
|
|
1515
|
+
import {
|
|
1516
|
+
Runner,
|
|
1517
|
+
runFanOut,
|
|
1518
|
+
runWithIdleYield,
|
|
1519
|
+
createAgentActorController,
|
|
1520
|
+
generateSessionId,
|
|
1521
|
+
estimateTokens,
|
|
1522
|
+
DefaultSummaryCompaction,
|
|
1523
|
+
} from '@kodax-ai/kodax/agent';
|
|
1524
|
+
|
|
1525
|
+
// Bounded-concurrency fan-out with abort + structured progress events (v0.7.39 FEATURE_120)
|
|
1526
|
+
const result = await runFanOut({
|
|
1527
|
+
bundles: [{ id: 'a', task: 'audit-foo' }, { id: 'b', task: 'audit-bar' }],
|
|
1528
|
+
maxParallel: 4,
|
|
1529
|
+
run: async (bundle) => doWork(bundle),
|
|
1530
|
+
});
|
|
1531
|
+
|
|
1532
|
+
// Runtime-owned Actor identity tree (inject an executor before starting Turns)
|
|
1533
|
+
const actors = await createAgentActorController();
|
|
1534
|
+
const tree = actors.list('/root');
|
|
1535
|
+
|
|
1536
|
+
// Pluggable compaction policy (FEATURE_081)
|
|
1537
|
+
const policy = new DefaultSummaryCompaction({ thresholdRatio: 0.8, keepRecent: 10 });
|
|
1538
|
+
```
|
|
1539
|
+
|
|
1540
|
+
`DefaultSummaryCompaction` is a standalone agent-layer primitive for custom
|
|
1541
|
+
loops. It does not replace or disable KodaX's always-on coding-runtime policy
|
|
1542
|
+
described under FEATURE_272 above.
|
|
1543
|
+
|
|
1506
1544
|
**Key Features**: `Runner` + per-step lifecycle · `runFanOut` (bounded-concurrency + abort + progress events) · `runWithIdleYield` (chat-while-waiting) · `AgentActorController` / `AgentTurnScheduler` · session-id generation · provider-neutral O(n) token estimation · `CompactionPolicy` interface.
|
|
1507
|
-
|
|
1508
|
-
### `@kodax-ai/kodax/skills` — Skills System
|
|
1509
|
-
|
|
1510
|
-
Zero external dependencies. Markdown-based skill files with natural-language triggers and variable resolution.
|
|
1511
|
-
|
|
1512
|
-
```typescript
|
|
1513
|
-
import {
|
|
1514
|
-
SkillRegistry,
|
|
1515
|
-
discoverSkills,
|
|
1516
|
-
executeSkill,
|
|
1517
|
-
type SkillContext,
|
|
1518
|
-
} from '@kodax-ai/kodax/skills';
|
|
1519
|
-
|
|
1520
|
-
const skills = await discoverSkills(['/path/to/skills']);
|
|
1521
|
-
const registry = new SkillRegistry();
|
|
1522
|
-
await registry.registerSkills(skills);
|
|
1523
|
-
|
|
1524
|
-
const result = await executeSkill({
|
|
1525
|
-
skillId: 'code-review',
|
|
1526
|
-
arguments: { target: 'src/' },
|
|
1527
|
-
workingDirectory: process.cwd(),
|
|
1528
|
-
});
|
|
1529
|
-
```
|
|
1530
|
-
|
|
1531
|
-
**Key Features**: zero deps · markdown-based skill files · natural-language triggering · variable resolution · built-in skills included.
|
|
1532
|
-
|
|
1533
|
-
### `@kodax-ai/kodax/coding` — Coding Agent
|
|
1534
|
-
|
|
1535
|
-
Complete coding agent: 50+ tools (`read`/`write`/`edit`/`bash`/`grep`/`glob` plus `spawn_agent`/`send_message`/`followup_task`/`wait_agent`/`interrupt_agent`/`list_agents`/`agent_output`) + Worker role prompt + Sidecar Verifier (out-of-band Stop-hook) + agent loop + auto-continue + session management.
|
|
1536
|
-
|
|
1537
|
-
```typescript
|
|
1538
|
-
import { runKodaX, KodaXClient, KODAX_TOOLS } from '@kodax-ai/kodax/coding';
|
|
1539
|
-
|
|
1540
|
-
// Single-task helper
|
|
1541
|
-
const result = await runKodaX({
|
|
1542
|
-
provider: 'zhipu-coding',
|
|
1543
|
-
effort: 'auto',
|
|
1544
|
-
events: { onTextDelta: (text) => process.stdout.write(text) },
|
|
1545
|
-
}, 'Read package.json and explain the dependencies');
|
|
1546
|
-
|
|
1547
|
-
// Continuous session
|
|
1548
|
-
const client = new KodaXClient({
|
|
1549
|
-
provider: 'anthropic',
|
|
1550
|
-
effort: 'auto',
|
|
1551
|
-
events: { /* … */ },
|
|
1552
|
-
});
|
|
1553
|
-
await client.send('Create a new file');
|
|
1554
|
-
await client.send('Add a function to it'); // Has context from previous message
|
|
1555
|
-
```
|
|
1556
|
-
|
|
1557
|
-
**Key Features**: 50+ built-in tools (see [Tools](#tools)) · V2 Worker single-loop + Sidecar Verifier (FEATURE_184 v0.7.42 / V1 chain fully retired by FEATURE_193 v0.7.43) · Runtime-owned Actor collaboration and safe-boundary steering (FEATURE_270, v0.7.72) · idle-yield waiting · specialist routing via `spawn_agent(agent_id=...)` · auto-continue · session lineage.
|
|
1558
|
-
|
|
1559
|
-
### `@kodax-ai/kodax/repl` — Interactive Terminal UI
|
|
1560
|
-
|
|
1561
|
-
Ink/React-based interactive REPL. Permission modes, command system, themed streaming display.
|
|
1562
|
-
|
|
1563
|
-
```typescript
|
|
1564
|
-
import { runInkInteractiveMode } from '@kodax-ai/kodax/repl';
|
|
1565
|
-
|
|
1566
|
-
// Usually used via the `kodax` bin command; can be embedded:
|
|
1567
|
-
// - Interactive terminal UI (Ink components)
|
|
1568
|
-
// - Permission control (auto/plan/accept-edits modes)
|
|
1569
|
-
// - Command system (/help, /mode, /clear, /status, …)
|
|
1570
|
-
// - Skills integration
|
|
1571
|
-
// - Theme support
|
|
1572
|
-
await runInkInteractiveMode({ provider: 'zhipu-coding', effort: 'auto' });
|
|
1573
|
-
```
|
|
1574
|
-
|
|
1575
|
-
**Key Features**: Ink-based React components · 3 permission modes (auto / plan / accept-edits) · built-in commands · real-time streaming display · context-usage indicator.
|
|
1576
|
-
|
|
1577
|
-
### Package Dependency Graph (workspace internal)
|
|
1578
|
-
|
|
1579
|
-
```
|
|
1580
|
-
@kodax-ai/llm (zero business-logic deps)
|
|
1581
|
-
↓
|
|
1582
|
-
@kodax-ai/agent (depends @kodax-ai/llm; ADR-021 standalone-consumable;
|
|
1583
|
-
inlines session-lineage + capabilities/{mcp,skills} +
|
|
1584
|
-
tracing per ADR-036 v0.7.43)
|
|
1585
|
-
↓
|
|
1586
|
-
@kodax-ai/coding (depends llm + agent; inlines repo-intelligence/protocol per ADR-036)
|
|
1587
|
-
↓
|
|
1588
|
-
@kodax-ai/repl (depends coding + ink + react)
|
|
1589
|
-
```
|
|
1590
|
-
|
|
1591
|
-
**Subpath Recommendations**:
|
|
1592
|
-
|
|
1593
|
-
| Use Case | Subpath | Why |
|
|
1594
|
-
|----------|---------|-----|
|
|
1595
|
-
| Only need LLM abstraction | `@kodax-ai/kodax/llm` | Minimal deps; 16 built-in aliases |
|
|
1596
|
-
| Building custom agent | `@kodax-ai/kodax/agent` | Runner + fan-out + idle-yield + session-lineage + capabilities |
|
|
1597
|
-
| Coding tasks | `@kodax-ai/kodax/coding` | Complete coding agent + tools |
|
|
1598
|
-
| Terminal app | `@kodax-ai/kodax/repl` | Full interactive experience |
|
|
1599
|
-
| Runtime host / daemon client | `@kodax-ai/kodax/runtime` | Sessions, runs, events, permissions, catalog, MCP, artifacts, diagnostics |
|
|
1545
|
+
|
|
1546
|
+
### `@kodax-ai/kodax/skills` — Skills System
|
|
1547
|
+
|
|
1548
|
+
Zero external dependencies. Markdown-based skill files with natural-language triggers and variable resolution.
|
|
1549
|
+
|
|
1550
|
+
```typescript
|
|
1551
|
+
import {
|
|
1552
|
+
SkillRegistry,
|
|
1553
|
+
discoverSkills,
|
|
1554
|
+
executeSkill,
|
|
1555
|
+
type SkillContext,
|
|
1556
|
+
} from '@kodax-ai/kodax/skills';
|
|
1557
|
+
|
|
1558
|
+
const skills = await discoverSkills(['/path/to/skills']);
|
|
1559
|
+
const registry = new SkillRegistry();
|
|
1560
|
+
await registry.registerSkills(skills);
|
|
1561
|
+
|
|
1562
|
+
const result = await executeSkill({
|
|
1563
|
+
skillId: 'code-review',
|
|
1564
|
+
arguments: { target: 'src/' },
|
|
1565
|
+
workingDirectory: process.cwd(),
|
|
1566
|
+
});
|
|
1567
|
+
```
|
|
1568
|
+
|
|
1569
|
+
**Key Features**: zero deps · markdown-based skill files · natural-language triggering · variable resolution · built-in skills included.
|
|
1570
|
+
|
|
1571
|
+
### `@kodax-ai/kodax/coding` — Coding Agent
|
|
1572
|
+
|
|
1573
|
+
Complete coding agent: 50+ tools (`read`/`write`/`edit`/`bash`/`grep`/`glob` plus `spawn_agent`/`send_message`/`followup_task`/`wait_agent`/`interrupt_agent`/`list_agents`/`agent_output`) + Worker role prompt + Sidecar Verifier (out-of-band Stop-hook) + agent loop + auto-continue + session management.
|
|
1574
|
+
|
|
1575
|
+
```typescript
|
|
1576
|
+
import { runKodaX, KodaXClient, KODAX_TOOLS } from '@kodax-ai/kodax/coding';
|
|
1577
|
+
|
|
1578
|
+
// Single-task helper
|
|
1579
|
+
const result = await runKodaX({
|
|
1580
|
+
provider: 'zhipu-coding',
|
|
1581
|
+
effort: 'auto',
|
|
1582
|
+
events: { onTextDelta: (text) => process.stdout.write(text) },
|
|
1583
|
+
}, 'Read package.json and explain the dependencies');
|
|
1584
|
+
|
|
1585
|
+
// Continuous session
|
|
1586
|
+
const client = new KodaXClient({
|
|
1587
|
+
provider: 'anthropic',
|
|
1588
|
+
effort: 'auto',
|
|
1589
|
+
events: { /* … */ },
|
|
1590
|
+
});
|
|
1591
|
+
await client.send('Create a new file');
|
|
1592
|
+
await client.send('Add a function to it'); // Has context from previous message
|
|
1593
|
+
```
|
|
1594
|
+
|
|
1595
|
+
**Key Features**: 50+ built-in tools (see [Tools](#tools)) · V2 Worker single-loop + Sidecar Verifier (FEATURE_184 v0.7.42 / V1 chain fully retired by FEATURE_193 v0.7.43) · Runtime-owned Actor collaboration and safe-boundary steering (FEATURE_270, v0.7.72) · idle-yield waiting · specialist routing via `spawn_agent(agent_id=...)` · auto-continue · session lineage.
|
|
1596
|
+
|
|
1597
|
+
### `@kodax-ai/kodax/repl` — Interactive Terminal UI
|
|
1598
|
+
|
|
1599
|
+
Ink/React-based interactive REPL. Permission modes, command system, themed streaming display.
|
|
1600
|
+
|
|
1601
|
+
```typescript
|
|
1602
|
+
import { runInkInteractiveMode } from '@kodax-ai/kodax/repl';
|
|
1603
|
+
|
|
1604
|
+
// Usually used via the `kodax` bin command; can be embedded:
|
|
1605
|
+
// - Interactive terminal UI (Ink components)
|
|
1606
|
+
// - Permission control (auto/plan/accept-edits modes)
|
|
1607
|
+
// - Command system (/help, /mode, /clear, /status, …)
|
|
1608
|
+
// - Skills integration
|
|
1609
|
+
// - Theme support
|
|
1610
|
+
await runInkInteractiveMode({ provider: 'zhipu-coding', effort: 'auto' });
|
|
1611
|
+
```
|
|
1612
|
+
|
|
1613
|
+
**Key Features**: Ink-based React components · 3 permission modes (auto / plan / accept-edits) · built-in commands · real-time streaming display · context-usage indicator.
|
|
1614
|
+
|
|
1615
|
+
### Package Dependency Graph (workspace internal)
|
|
1616
|
+
|
|
1617
|
+
```
|
|
1618
|
+
@kodax-ai/llm (zero business-logic deps)
|
|
1619
|
+
↓
|
|
1620
|
+
@kodax-ai/agent (depends @kodax-ai/llm; ADR-021 standalone-consumable;
|
|
1621
|
+
inlines session-lineage + capabilities/{mcp,skills} +
|
|
1622
|
+
tracing per ADR-036 v0.7.43)
|
|
1623
|
+
↓
|
|
1624
|
+
@kodax-ai/coding (depends llm + agent; inlines repo-intelligence/protocol per ADR-036)
|
|
1625
|
+
↓
|
|
1626
|
+
@kodax-ai/repl (depends coding + ink + react)
|
|
1627
|
+
```
|
|
1628
|
+
|
|
1629
|
+
**Subpath Recommendations**:
|
|
1630
|
+
|
|
1631
|
+
| Use Case | Subpath | Why |
|
|
1632
|
+
|----------|---------|-----|
|
|
1633
|
+
| Only need LLM abstraction | `@kodax-ai/kodax/llm` | Minimal deps; 16 built-in aliases |
|
|
1634
|
+
| Building custom agent | `@kodax-ai/kodax/agent` | Runner + fan-out + idle-yield + session-lineage + capabilities |
|
|
1635
|
+
| Coding tasks | `@kodax-ai/kodax/coding` | Complete coding agent + tools |
|
|
1636
|
+
| Terminal app | `@kodax-ai/kodax/repl` | Full interactive experience |
|
|
1637
|
+
| Runtime host / daemon client | `@kodax-ai/kodax/runtime` | Sessions, runs, events, permissions, catalog, MCP, artifacts, diagnostics |
|
|
1600
1638
|
| Experimental governed memory | `@kodax-ai/kodax/experimental-memory` | Governed `MemoryAgent` list/remember/forget and scoped `MemorySession` recall/outcome contracts |
|
|
1601
|
-
|
|
1602
|
-
---
|
|
1603
|
-
|
|
1604
|
-
| Provider | Environment Variable | Reasoning Support | Default Model |
|
|
1605
|
-
|----------|----------------------|-------------------|---------------|
|
|
1606
|
-
| anthropic | `ANTHROPIC_API_KEY` | Native | claude-sonnet-4-6 (`claude-opus-4-6` / `claude-haiku-4-5` via `/model`) |
|
|
1607
|
-
| openai | `OPENAI_API_KEY` | Native | gpt-5.3-codex (`gpt-5.4` / `gpt-5.3-codex-spark` via `/model`) |
|
|
1608
|
-
| kimi | `KIMI_API_KEY` | Native | kimi-k2.7-code (262,144-token context; `kimi-k3` 1M / `kimi-k2.7-code-highspeed` / `kimi-k2.6` / `kimi-k2.5` via `/model`) |
|
|
1609
|
-
| kimi-code | `KIMI_CODE_API_KEY` | Native | k3-256k (Moderato+, 256K, direct upstream ID; `k3` 1M / `kimi-for-coding` K2.7 Code / `kimi-for-coding-highspeed` via `/model`) |
|
|
1610
|
-
| qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
|
|
1611
|
-
| qwen-token-plan | `QWEN_TOKEN_API_KEY` | Native | qwen3.8-max (Anthropic-compat; legacy `qwen3.8-max-preview` plus `qwen3.7-max` / `qwen3.7-plus` / `qwen3.6-flash` / `glm-5.2` / `deepseek-v4-pro` via `/model`; all 1M context; image input on both Qwen 3.8 IDs / 3.7 Plus / 3.6 Flash) |
|
|
1612
|
-
| zhipu | `ZHIPU_API_KEY` | Native | glm-5 (`glm-5.2` 1M ctx
|
|
1613
|
-
| zhipu-coding | `ZHIPU_CODING_API_KEY` | Native | glm-5.
|
|
1614
|
-
| zai-coding | `ZAI_CODING_API_KEY` | Native | glm-5.2 (
|
|
1615
|
-
| minimax-coding | `MINIMAX_CODING_API_KEY` | Native | MiniMax-M3 (Frontier Coding, native multimodal + 1M ctx; legacy `MiniMax-M2.7` / `MiniMax-M2.7-highspeed` remain selectable via `/model`) |
|
|
1616
|
-
| mimo | `MIMO_API_KEY` | Native | mimo-v2.5-pro (Xiaomi MiMo pay-per-token, Anthropic-compat) |
|
|
1617
|
-
| mimo-coding | `MIMO_CODING_API_KEY` | Native | mimo-v2.5-pro (Xiaomi Token Plan, Anthropic-compat) |
|
|
1618
|
-
| ark-coding | `ARK_CODING_API_KEY` | Native | glm-5.2 (Volcengine Ark Coding Plan — GLM-5.2 (alias: `glm-latest`) · Kimi K2.7 Code / K2.6 · MiniMax M3 / M2.7 · DeepSeek V4 Pro / V4 Flash · Doubao Seed 2.0 Code / Pro / Lite · Doubao Seed Code) |
|
|
1619
|
-
| deepseek | `DEEPSEEK_API_KEY` | Native | deepseek-v4-flash (`deepseek-v4-pro` via `/model`) |
|
|
1620
|
-
| gemini-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via gemini CLI) |
|
|
1621
|
-
| codex-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via codex CLI) |
|
|
1622
|
-
|
|
1623
|
-
> **Custom providers**: any OpenAI- or Anthropic-compatible endpoint can be added via `customProviders[]` in `~/.kodax/config.json` (CLI) or `registerCustomProviders()` (library). See the [Quick Start](#2-configure-a-provider) for the configuration shape.
|
|
1624
|
-
|
|
1625
|
-
### Examples
|
|
1626
|
-
|
|
1627
|
-
```bash
|
|
1628
|
-
# Use Zhipu Coding
|
|
1629
|
-
kodax --provider zhipu-coding --thinking "Help me optimize this code"
|
|
1630
|
-
|
|
1631
|
-
# Use OpenAI
|
|
1632
|
-
export OPENAI_API_KEY=your_key
|
|
1633
|
-
kodax --provider openai "Create a REST API"
|
|
1634
|
-
|
|
1635
|
-
# Resume last session
|
|
1636
|
-
kodax --session resume
|
|
1637
|
-
|
|
1638
|
-
# List all sessions
|
|
1639
|
-
kodax --session list
|
|
1640
|
-
|
|
1641
|
-
# Parallel tool execution
|
|
1642
|
-
kodax --parallel "Read package.json and tsconfig.json"
|
|
1643
|
-
|
|
1644
|
-
# Adaptive multi-agent (AMA) mode — V2 Worker single-loop with Actor collaboration
|
|
1645
|
-
kodax --agent-mode ama "Analyze code structure, check test coverage, find bugs"
|
|
1646
|
-
```
|
|
1647
|
-
|
|
1648
|
-
---
|
|
1649
|
-
|
|
1650
|
-
## Tools
|
|
1651
|
-
|
|
1652
|
-
KodaX ships 50+ built-in tools, grouped below. They are registered as a single flat tool surface to the LLM; the categories here are just for navigation.
|
|
1653
|
-
|
|
1654
|
-
### File operations
|
|
1655
|
-
| Tool | Description |
|
|
1656
|
-
|------|-------------|
|
|
1657
|
-
| `read` | Read file contents (supports offset/limit) |
|
|
1658
|
-
| `write` | Write a new file or fully rewrite an existing one |
|
|
1659
|
-
| `edit` | Exact string replacement (supports `replace_all`) |
|
|
1660
|
-
| `multi_edit` | Atomic batch of independent edits to one file |
|
|
1661
|
-
| `insert_after_anchor` | Insert content after a unique anchor without rewriting the file |
|
|
1662
|
-
| `undo` | Revert the last file modification |
|
|
1663
|
-
|
|
1664
|
-
### Shell & search
|
|
1665
|
-
| Tool | Description |
|
|
1666
|
-
|------|-------------|
|
|
1667
|
-
| `bash` | Execute a shell command (supports `run_in_background`; complete capture with recoverable capacity fallback) |
|
|
1668
|
-
| `glob` | Find files by pattern |
|
|
1669
|
-
| `grep` | Regex content search (context lines, multiline, file-type filter, pagination) |
|
|
1670
|
-
| `code_search` | Lower-noise code search (extension-provider aware) |
|
|
1671
|
-
| `semantic_lookup` | Symbol/module/process-aware search backed by repo intelligence |
|
|
1672
|
-
| `web_search` | Discovery-oriented web search with trust + freshness signals |
|
|
1673
|
-
| `web_fetch` | Fetch a specific URL with provenance hints |
|
|
1674
|
-
|
|
1675
|
-
### Repo Intelligence (working tools)
|
|
1676
|
-
| Tool | Description |
|
|
1677
|
-
|------|-------------|
|
|
1678
|
-
| `repo_overview` | Summarize structure, key areas, entry hints, intelligence snapshot |
|
|
1679
|
-
| `changed_scope` | Which files/areas/categories the current diff touches |
|
|
1680
|
-
| `changed_diff` | Paged diff slice for a single file |
|
|
1681
|
-
| `changed_diff_bundle` | Paged diff slices for multiple files in one call |
|
|
1682
|
-
| `module_context` | Module capsule (deps, entries, symbols, tests, docs) |
|
|
1683
|
-
| `symbol_context` | Definition + probable callers/callees + alternatives |
|
|
1684
|
-
| `process_context` | Approximate static execution capsule for an entry |
|
|
1685
|
-
| `impact_estimate` | Blast radius for a symbol/path/module |
|
|
1686
|
-
|
|
1687
|
-
### MCP capabilities (when MCP servers are configured)
|
|
1688
|
-
| Tool | Description |
|
|
1689
|
-
|------|-------------|
|
|
1690
|
-
| `mcp_search` / `mcp_describe` / `mcp_call` | Discover and invoke MCP tools through the shared capability runtime |
|
|
1691
|
-
| `mcp_read_resource` / `mcp_get_prompt` | Read MCP resources and prompts |
|
|
1692
|
-
|
|
1693
|
-
### Git worktree
|
|
1694
|
-
| Tool | Description |
|
|
1695
|
-
|------|-------------|
|
|
1696
|
-
| `worktree_create` | Create a new worktree on an isolated branch for safe agent work |
|
|
1697
|
-
| `worktree_remove` | Remove a worktree (with safety checks) |
|
|
1698
|
-
|
|
1699
|
-
### Agent control & UX
|
|
1700
|
-
| Tool | Description |
|
|
1701
|
-
|------|-------------|
|
|
1702
|
-
| `spawn_agent` | Create a named child Actor and start its first Turn under inherited capabilities, session capacity, and root work budget. |
|
|
1703
|
-
| `send_message` | Commit bounded information to an Actor mailbox without starting a new Turn. |
|
|
1704
|
-
| `followup_task` | Join a running Actor at a safe boundary or atomically start a new Turn for an idle Actor. |
|
|
1705
|
-
| `wait_agent` | Yield on scoped mailbox/user/interruption/timeout activity; returns a wake acknowledgement and never uses Actor progress as a model wake source. |
|
|
1706
|
-
| `interrupt_agent` | Request interruption of an active Turn while preserving Actor identity. |
|
|
1707
|
-
| `list_agents` | Inspect the caller-visible Actor subtree and Turn states. |
|
|
1708
|
-
| `agent_output` | Read bounded durable output for an authorized Actor/Turn. |
|
|
1709
|
-
| `ask_user_question` | Single/multi-select or free-text prompt back to the user |
|
|
1710
|
-
| `exit_plan_mode` | Present a finalized plan only when the active REPL/host supplied an approval callback |
|
|
1711
|
-
| `run_workflow` | Author and run a deterministic Workflow protocol in AMA only when Workflow intent is explicit; complexity alone never activates it. Child Agents share the Actor control plane. Async / idle-yield. (FEATURE_246; FEATURE_270 v0.7.72) |
|
|
1712
|
-
| `emit_managed_protocol` | Internal managed-task protocol side-channel for role payloads (verdict). V2 Worker single-loop + Sidecar Verifier is the default since v0.7.42 (FEATURE_184); V1 chain retired in v0.7.43 (FEATURE_193). |
|
|
1713
|
-
|
|
1714
|
-
---
|
|
1715
|
-
|
|
1716
|
-
## Skills System
|
|
1717
|
-
|
|
1718
|
-
KodaX includes a built-in Skills system that can be triggered by natural language:
|
|
1719
|
-
|
|
1720
|
-
```bash
|
|
1721
|
-
# Natural language triggering (no explicit /skill needed)
|
|
1722
|
-
kodax "帮我审查代码" # Triggers code-review skill
|
|
1723
|
-
kodax "写测试用例" # Triggers tdd skill
|
|
1724
|
-
kodax "提交代码" # Triggers git-workflow skill
|
|
1725
|
-
|
|
1726
|
-
# Explicit skill command
|
|
1727
|
-
kodax /skill:code-review
|
|
1728
|
-
```
|
|
1729
|
-
|
|
1730
|
-
Built-in skills include:
|
|
1731
|
-
- **code-review** - Code review and quality analysis
|
|
1732
|
-
- **tdd** - Test-driven development workflow
|
|
1733
|
-
- **git-workflow** - Git commit and workflow automation
|
|
1734
|
-
|
|
1735
|
-
Skills are stored in `~/.kodax/skills/` and can be extended with custom skills.
|
|
1736
|
-
F263 background learning is Memory-first: a single correction does not create
|
|
1737
|
-
a Skill. Repeated independently verified evidence can create a low-risk,
|
|
1738
|
-
immutable project-scoped testing revision for at most three exact-revision
|
|
1739
|
-
uses. Promotion requires independently verified success. Use `/learn` to
|
|
1740
|
-
inspect, disable, rollback, trust, or reject learned revisions. Protected or
|
|
1741
|
-
formal Skills, user-global promotion, and Extension authoring remain explicit
|
|
1742
|
-
user actions.
|
|
1743
|
-
|
|
1744
|
-
### Promote a learned Skill to the user catalog
|
|
1745
|
-
|
|
1746
|
-
Automatic canary activation and user-catalog promotion are different:
|
|
1747
|
-
|
|
1748
|
-
- independently verified canary success changes `testing` to
|
|
1749
|
-
`active_learned` inside the project-scoped Learned Area;
|
|
1750
|
-
- `/learn promote` is an explicit ownership transfer that copies one exact
|
|
1751
|
-
reviewed `ready` or `active_learned` revision into the formal user Skill
|
|
1752
|
-
catalog and changes its lifecycle to `promoted_user`.
|
|
1753
|
-
|
|
1754
|
-
Inspect the revision first, then promote it by name, slug, or exact capability
|
|
1755
|
-
ID:
|
|
1756
|
-
|
|
1757
|
-
```text
|
|
1758
|
-
/learn show normalize-release-notes
|
|
1759
|
-
/learn promote normalize-release-notes --scope user
|
|
1760
|
-
```
|
|
1761
|
-
|
|
1762
|
-
`--scope user` is the only supported scope and may be omitted. Invalid scopes,
|
|
1763
|
-
unknown options, duplicate scope options, and extra operands fail without
|
|
1764
|
-
changing the catalog. Promotion writes to the configured KodaX user Skill
|
|
1765
|
-
directory—normally `~/.kodax/skills/<slug>/SKILL.md`—and never overwrites
|
|
1766
|
-
different formal Skill content.
|
|
1767
|
-
|
|
1768
|
-
Use `/learn promote --help`, `/learn help promote`, or
|
|
1769
|
-
`/help learn promote` for the dedicated command reference. In the Ink Learning
|
|
1770
|
-
Center, open `/learn`, select an `active_learned` Skill, and choose
|
|
1771
|
-
**Promote to user catalog**.
|
|
1772
|
-
|
|
1773
|
-
---
|
|
1774
|
-
|
|
1775
|
-
## Commands (CLI)
|
|
1776
|
-
|
|
1777
|
-
Commands are `/xxx` shortcuts in CLI:
|
|
1778
|
-
|
|
1779
|
-
```bash
|
|
1780
|
-
kodax /review src/auth.ts
|
|
1781
|
-
kodax /test
|
|
1782
|
-
```
|
|
1783
|
-
|
|
1784
|
-
Commands are stored in `~/.kodax/commands/`:
|
|
1785
|
-
- `.md` files → Prompt commands (content used as prompt)
|
|
1786
|
-
- `.ts/.js` files → Programmable commands
|
|
1787
|
-
|
|
1788
|
-
---
|
|
1789
|
-
|
|
1790
|
-
## API Exports
|
|
1791
|
-
|
|
1792
|
-
```typescript
|
|
1793
|
-
// Main functions
|
|
1794
|
-
export { runKodaX, KodaXClient };
|
|
1795
|
-
|
|
1796
|
-
// Types
|
|
1797
|
-
export type {
|
|
1798
|
-
KodaXEvents, KodaXOptions, KodaXResult,
|
|
1799
|
-
KodaXMessage, KodaXContentBlock,
|
|
1800
|
-
KodaXSessionStorage, KodaXToolDefinition
|
|
1801
|
-
};
|
|
1802
|
-
|
|
1803
|
-
// Tools
|
|
1804
|
-
export { KODAX_TOOLS, KODAX_TOOL_REQUIRED_PARAMS, executeTool };
|
|
1805
|
-
|
|
1806
|
-
// Providers
|
|
1807
|
-
export { getProvider, KODAX_PROVIDERS, KodaXBaseProvider };
|
|
1808
|
-
|
|
1809
|
-
// Utilities
|
|
1810
|
-
export {
|
|
1811
|
-
estimateTokens,
|
|
1812
|
-
getGitRoot, getGitContext, getEnvContext, getProjectSnapshot,
|
|
1813
|
-
checkPromiseSignal
|
|
1814
|
-
};
|
|
1815
|
-
```
|
|
1816
|
-
|
|
1817
|
-
---
|
|
1818
|
-
|
|
1819
|
-
## Development
|
|
1820
|
-
|
|
1821
|
-
```bash
|
|
1822
|
-
# Development mode (using tsx)
|
|
1823
|
-
npm run dev "your task"
|
|
1824
|
-
|
|
1825
|
-
# Build
|
|
1826
|
-
npm run build
|
|
1827
|
-
|
|
1828
|
-
# Optional: only build workspace packages
|
|
1829
|
-
npm run build:packages
|
|
1830
|
-
|
|
1831
|
-
# Build standalone binary (current platform / all platforms)
|
|
1832
|
-
npm run build:binary
|
|
1833
|
-
npm run build:binary:all
|
|
1834
|
-
|
|
1835
|
-
# Run tests
|
|
1836
|
-
npm test
|
|
1837
|
-
|
|
1838
|
-
# Eval-driven development tests (provider matrices, identity round-trip, etc.)
|
|
1839
|
-
npm run test:eval
|
|
1840
|
-
|
|
1841
|
-
# Clean
|
|
1842
|
-
npm run clean
|
|
1843
|
-
```
|
|
1844
|
-
|
|
1845
|
-
### Repo Intelligence cache directories
|
|
1846
|
-
|
|
1847
|
-
KodaX uses one repo-intelligence cache root with separate built-in engine profiles:
|
|
1848
|
-
|
|
1849
|
-
- `.agent/repo-intelligence/`
|
|
1850
|
-
- Full-engine repo-intelligence artifacts and existing task-engine snapshots.
|
|
1851
|
-
- `.agent/repo-intelligence/light/`
|
|
1852
|
-
- Light-mode heuristic index artifacts.
|
|
1853
|
-
|
|
1854
|
-
They are intentionally separated so:
|
|
1855
|
-
|
|
1856
|
-
- full and light profiles can be rebuilt independently.
|
|
1857
|
-
- light-mode confidence/capability state cannot be mistaken for full-engine state.
|
|
1858
|
-
- future cache migrations can delete one profile without corrupting the other.
|
|
1859
|
-
|
|
1860
|
-
`.agent/repo-intelligence/` is local generated state and should not be committed.
|
|
1861
|
-
|
|
1862
|
-
---
|
|
1863
|
-
|
|
1864
|
-
## Code Style
|
|
1865
|
-
|
|
1866
|
-
### Comment Guidelines
|
|
1867
|
-
|
|
1868
|
-
KodaX uses an **English-first** comment style with selective Chinese brief notes for complex logic.
|
|
1869
|
-
|
|
1870
|
-
| Situation | Style | Example |
|
|
1871
|
-
|-----------|-------|---------|
|
|
1872
|
-
| Import/Export | English only | `// Import dependencies` |
|
|
1873
|
-
| Simple constants | English only | `// Max retry count` |
|
|
1874
|
-
| Simple logic | English only | `// Return if null` |
|
|
1875
|
-
| **Business rules** | English + Chinese | `// Skip tool_result - 跳过工具结果块` |
|
|
1876
|
-
| **Platform compatibility** | English + Chinese | `// Windows path handling - Windows 路径处理` |
|
|
1877
|
-
| **Performance optimization** | English + Chinese | `// Debounce to prevent flicker - 防抖避免闪烁` |
|
|
1878
|
-
|
|
1879
|
-
---
|
|
1880
|
-
|
|
1881
|
-
## Documentation
|
|
1882
|
-
|
|
1883
|
-
- [README_CN.md](README_CN.md) - Chinese Documentation
|
|
1884
|
-
- [public_docs/sdk/embedder-guide.md](public_docs/sdk/embedder-guide.md) - SDK hosting, shared Runtime daemon, Auto Mode, v0.7.74 compaction/history recovery, Agent telemetry, and active-run input contracts
|
|
1885
|
-
- [docs/release.md](docs/release.md) - Standalone binary build & release pipeline
|
|
1886
|
-
- [docs/PRD.md](docs/PRD.md) - Product Requirements
|
|
1887
|
-
- [docs/ADR.md](docs/ADR.md) - Architecture Decisions
|
|
1888
|
-
- [docs/HLD.md](docs/HLD.md) - High-Level Design
|
|
1889
|
-
- [docs/DD.md](docs/DD.md) - Detailed Design
|
|
1890
|
-
- [docs/FEATURE_LIST.md](docs/FEATURE_LIST.md) - Feature Tracking
|
|
1891
|
-
- [docs/test-guides/](docs/test-guides/) - Feature-specific test guides
|
|
1892
|
-
- [CHANGELOG.md](CHANGELOG.md) - Version History (v0.7.0+; [archive](docs/CHANGELOG_ARCHIVE.md) for older)
|
|
1893
|
-
|
|
1894
|
-
---
|
|
1895
|
-
|
|
1896
|
-
## License
|
|
1897
|
-
|
|
1898
|
-
[KodaX-AI Fair Core License (KAI-FCL) 1.0](LICENSE) - Copyright 2026 [icetomoyo](mailto:icetomoyo@gmail.com).
|
|
1899
|
-
|
|
1900
|
-
KAI-FCL is source-available / fair-core, not OSI open source. Commercial,
|
|
1901
|
-
enterprise, managed deployment, paid service, or customer redistribution use
|
|
1902
|
-
requires KodaX-AI authorization and a valid entitlement where required.
|
|
1903
|
-
|
|
1904
|
-
Official KodaX 0.7.70 and later distributions use KAI-FCL or accompanying
|
|
1905
|
-
KodaX-AI customer terms. Historical tags, archives, binaries, npm packages, or
|
|
1906
|
-
other copies already distributed with Apache-2.0 notices remain Apache-2.0 for
|
|
1907
|
-
those specific copies.
|
|
1639
|
+
|
|
1640
|
+
---
|
|
1641
|
+
|
|
1642
|
+
| Provider | Environment Variable | Reasoning Support | Default Model |
|
|
1643
|
+
|----------|----------------------|-------------------|---------------|
|
|
1644
|
+
| anthropic | `ANTHROPIC_API_KEY` | Native | claude-sonnet-4-6 (`claude-opus-4-6` / `claude-haiku-4-5` via `/model`) |
|
|
1645
|
+
| openai | `OPENAI_API_KEY` | Native | gpt-5.3-codex (`gpt-5.4` / `gpt-5.3-codex-spark` via `/model`) |
|
|
1646
|
+
| kimi | `KIMI_API_KEY` | Native | kimi-k2.7-code (262,144-token context; `kimi-k3` 1M / `kimi-k2.7-code-highspeed` / `kimi-k2.6` / `kimi-k2.5` via `/model`) |
|
|
1647
|
+
| kimi-code | `KIMI_CODE_API_KEY` | Native | k3-256k (Moderato+, 256K, direct upstream ID; `k3` 1M / `kimi-for-coding` K2.7 Code / `kimi-for-coding-highspeed` via `/model`) |
|
|
1648
|
+
| qwen | `QWEN_API_KEY` | Native | qwen3.5-plus |
|
|
1649
|
+
| qwen-token-plan | `QWEN_TOKEN_API_KEY` | Native | qwen3.8-max (Anthropic-compat; legacy `qwen3.8-max-preview` plus `qwen3.7-max` / `qwen3.7-plus` / `qwen3.6-flash` / `glm-5.2` / `deepseek-v4-pro` via `/model`; all 1M context; image input on both Qwen 3.8 IDs / 3.7 Plus / 3.6 Flash) |
|
|
1650
|
+
| zhipu | `ZHIPU_API_KEY` | Native | glm-5 (`glm-5.3` / `glm-5.2` 1M ctx, plus `glm-5.1` / `glm-5-turbo` via `/model`; GLM-5.3 is pre-registered while the public API remains marked upcoming) |
|
|
1651
|
+
| zhipu-coding | `ZHIPU_CODING_API_KEY` | Native | glm-5.3 (1M ctx, 128K output; `glm-5.2` rollback plus `glm-5-turbo` / `glm-4.7` via `/model`; raw upstream IDs) |
|
|
1652
|
+
| zai-coding | `ZAI_CODING_API_KEY` | Native | glm-5.2 (`glm-5.3` remains selectable when the overseas Coding Plan account has access; raw upstream IDs) |
|
|
1653
|
+
| minimax-coding | `MINIMAX_CODING_API_KEY` | Native | MiniMax-M3 (Frontier Coding, native multimodal + 1M ctx; legacy `MiniMax-M2.7` / `MiniMax-M2.7-highspeed` remain selectable via `/model`) |
|
|
1654
|
+
| mimo | `MIMO_API_KEY` | Native | mimo-v2.5-pro (Xiaomi MiMo pay-per-token, Anthropic-compat) |
|
|
1655
|
+
| mimo-coding | `MIMO_CODING_API_KEY` | Native | mimo-v2.5-pro (Xiaomi Token Plan, Anthropic-compat) |
|
|
1656
|
+
| ark-coding | `ARK_CODING_API_KEY` | Native | glm-5.2 (Volcengine Ark Coding Plan — GLM-5.2 (alias: `glm-latest`) · Kimi K2.7 Code / K2.6 · MiniMax M3 / M2.7 · DeepSeek V4 Pro / V4 Flash · Doubao Seed 2.0 Code / Pro / Lite · Doubao Seed Code) |
|
|
1657
|
+
| deepseek | `DEEPSEEK_API_KEY` | Native | deepseek-v4-flash (`deepseek-v4-pro` via `/model`) |
|
|
1658
|
+
| gemini-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via gemini CLI) |
|
|
1659
|
+
| codex-cli | Provider CLI authentication (no KodaX API-key variable) | Prompt-only / CLI bridge | (via codex CLI) |
|
|
1660
|
+
|
|
1661
|
+
> **Custom providers**: any OpenAI- or Anthropic-compatible endpoint can be added via `customProviders[]` in `~/.kodax/config.json` (CLI) or `registerCustomProviders()` (library). See the [Quick Start](#2-configure-a-provider) for the configuration shape.
|
|
1662
|
+
|
|
1663
|
+
### Examples
|
|
1664
|
+
|
|
1665
|
+
```bash
|
|
1666
|
+
# Use Zhipu Coding
|
|
1667
|
+
kodax --provider zhipu-coding --thinking "Help me optimize this code"
|
|
1668
|
+
|
|
1669
|
+
# Use OpenAI
|
|
1670
|
+
export OPENAI_API_KEY=your_key
|
|
1671
|
+
kodax --provider openai "Create a REST API"
|
|
1672
|
+
|
|
1673
|
+
# Resume last session
|
|
1674
|
+
kodax --session resume
|
|
1675
|
+
|
|
1676
|
+
# List all sessions
|
|
1677
|
+
kodax --session list
|
|
1678
|
+
|
|
1679
|
+
# Parallel tool execution
|
|
1680
|
+
kodax --parallel "Read package.json and tsconfig.json"
|
|
1681
|
+
|
|
1682
|
+
# Adaptive multi-agent (AMA) mode — V2 Worker single-loop with Actor collaboration
|
|
1683
|
+
kodax --agent-mode ama "Analyze code structure, check test coverage, find bugs"
|
|
1684
|
+
```
|
|
1685
|
+
|
|
1686
|
+
---
|
|
1687
|
+
|
|
1688
|
+
## Tools
|
|
1689
|
+
|
|
1690
|
+
KodaX ships 50+ built-in tools, grouped below. They are registered as a single flat tool surface to the LLM; the categories here are just for navigation.
|
|
1691
|
+
|
|
1692
|
+
### File operations
|
|
1693
|
+
| Tool | Description |
|
|
1694
|
+
|------|-------------|
|
|
1695
|
+
| `read` | Read file contents (supports offset/limit) |
|
|
1696
|
+
| `write` | Write a new file or fully rewrite an existing one |
|
|
1697
|
+
| `edit` | Exact string replacement (supports `replace_all`) |
|
|
1698
|
+
| `multi_edit` | Atomic batch of independent edits to one file |
|
|
1699
|
+
| `insert_after_anchor` | Insert content after a unique anchor without rewriting the file |
|
|
1700
|
+
| `undo` | Revert the last file modification |
|
|
1701
|
+
|
|
1702
|
+
### Shell & search
|
|
1703
|
+
| Tool | Description |
|
|
1704
|
+
|------|-------------|
|
|
1705
|
+
| `bash` | Execute a shell command (supports `run_in_background`; complete capture with recoverable capacity fallback) |
|
|
1706
|
+
| `glob` | Find files by pattern |
|
|
1707
|
+
| `grep` | Regex content search (context lines, multiline, file-type filter, pagination) |
|
|
1708
|
+
| `code_search` | Lower-noise code search (extension-provider aware) |
|
|
1709
|
+
| `semantic_lookup` | Symbol/module/process-aware search backed by repo intelligence |
|
|
1710
|
+
| `web_search` | Discovery-oriented web search with trust + freshness signals |
|
|
1711
|
+
| `web_fetch` | Fetch a specific URL with provenance hints |
|
|
1712
|
+
|
|
1713
|
+
### Repo Intelligence (working tools)
|
|
1714
|
+
| Tool | Description |
|
|
1715
|
+
|------|-------------|
|
|
1716
|
+
| `repo_overview` | Summarize structure, key areas, entry hints, intelligence snapshot |
|
|
1717
|
+
| `changed_scope` | Which files/areas/categories the current diff touches |
|
|
1718
|
+
| `changed_diff` | Paged diff slice for a single file |
|
|
1719
|
+
| `changed_diff_bundle` | Paged diff slices for multiple files in one call |
|
|
1720
|
+
| `module_context` | Module capsule (deps, entries, symbols, tests, docs) |
|
|
1721
|
+
| `symbol_context` | Definition + probable callers/callees + alternatives |
|
|
1722
|
+
| `process_context` | Approximate static execution capsule for an entry |
|
|
1723
|
+
| `impact_estimate` | Blast radius for a symbol/path/module |
|
|
1724
|
+
|
|
1725
|
+
### MCP capabilities (when MCP servers are configured)
|
|
1726
|
+
| Tool | Description |
|
|
1727
|
+
|------|-------------|
|
|
1728
|
+
| `mcp_search` / `mcp_describe` / `mcp_call` | Discover and invoke MCP tools through the shared capability runtime |
|
|
1729
|
+
| `mcp_read_resource` / `mcp_get_prompt` | Read MCP resources and prompts |
|
|
1730
|
+
|
|
1731
|
+
### Git worktree
|
|
1732
|
+
| Tool | Description |
|
|
1733
|
+
|------|-------------|
|
|
1734
|
+
| `worktree_create` | Create a new worktree on an isolated branch for safe agent work |
|
|
1735
|
+
| `worktree_remove` | Remove a worktree (with safety checks) |
|
|
1736
|
+
|
|
1737
|
+
### Agent control & UX
|
|
1738
|
+
| Tool | Description |
|
|
1739
|
+
|------|-------------|
|
|
1740
|
+
| `spawn_agent` | Create a named child Actor and start its first Turn under inherited capabilities, session capacity, and root work budget. |
|
|
1741
|
+
| `send_message` | Commit bounded information to an Actor mailbox without starting a new Turn. |
|
|
1742
|
+
| `followup_task` | Join a running Actor at a safe boundary or atomically start a new Turn for an idle Actor. |
|
|
1743
|
+
| `wait_agent` | Yield on scoped mailbox/user/interruption/timeout activity; returns a wake acknowledgement and never uses Actor progress as a model wake source. |
|
|
1744
|
+
| `interrupt_agent` | Request interruption of an active Turn while preserving Actor identity. |
|
|
1745
|
+
| `list_agents` | Inspect the caller-visible Actor subtree and Turn states. |
|
|
1746
|
+
| `agent_output` | Read bounded durable output for an authorized Actor/Turn. |
|
|
1747
|
+
| `ask_user_question` | Single/multi-select or free-text prompt back to the user |
|
|
1748
|
+
| `exit_plan_mode` | Present a finalized plan only when the active REPL/host supplied an approval callback |
|
|
1749
|
+
| `run_workflow` | Author and run a deterministic Workflow protocol in AMA only when Workflow intent is explicit; complexity alone never activates it. Child Agents share the Actor control plane. Async / idle-yield. (FEATURE_246; FEATURE_270 v0.7.72) |
|
|
1750
|
+
| `emit_managed_protocol` | Internal managed-task protocol side-channel for role payloads (verdict). V2 Worker single-loop + Sidecar Verifier is the default since v0.7.42 (FEATURE_184); V1 chain retired in v0.7.43 (FEATURE_193). |
|
|
1751
|
+
|
|
1752
|
+
---
|
|
1753
|
+
|
|
1754
|
+
## Skills System
|
|
1755
|
+
|
|
1756
|
+
KodaX includes a built-in Skills system that can be triggered by natural language:
|
|
1757
|
+
|
|
1758
|
+
```bash
|
|
1759
|
+
# Natural language triggering (no explicit /skill needed)
|
|
1760
|
+
kodax "帮我审查代码" # Triggers code-review skill
|
|
1761
|
+
kodax "写测试用例" # Triggers tdd skill
|
|
1762
|
+
kodax "提交代码" # Triggers git-workflow skill
|
|
1763
|
+
|
|
1764
|
+
# Explicit skill command
|
|
1765
|
+
kodax /skill:code-review
|
|
1766
|
+
```
|
|
1767
|
+
|
|
1768
|
+
Built-in skills include:
|
|
1769
|
+
- **code-review** - Code review and quality analysis
|
|
1770
|
+
- **tdd** - Test-driven development workflow
|
|
1771
|
+
- **git-workflow** - Git commit and workflow automation
|
|
1772
|
+
|
|
1773
|
+
Skills are stored in `~/.kodax/skills/` and can be extended with custom skills.
|
|
1774
|
+
F263 background learning is Memory-first: a single correction does not create
|
|
1775
|
+
a Skill. Repeated independently verified evidence can create a low-risk,
|
|
1776
|
+
immutable project-scoped testing revision for at most three exact-revision
|
|
1777
|
+
uses. Promotion requires independently verified success. Use `/learn` to
|
|
1778
|
+
inspect, disable, rollback, trust, or reject learned revisions. Protected or
|
|
1779
|
+
formal Skills, user-global promotion, and Extension authoring remain explicit
|
|
1780
|
+
user actions.
|
|
1781
|
+
|
|
1782
|
+
### Promote a learned Skill to the user catalog
|
|
1783
|
+
|
|
1784
|
+
Automatic canary activation and user-catalog promotion are different:
|
|
1785
|
+
|
|
1786
|
+
- independently verified canary success changes `testing` to
|
|
1787
|
+
`active_learned` inside the project-scoped Learned Area;
|
|
1788
|
+
- `/learn promote` is an explicit ownership transfer that copies one exact
|
|
1789
|
+
reviewed `ready` or `active_learned` revision into the formal user Skill
|
|
1790
|
+
catalog and changes its lifecycle to `promoted_user`.
|
|
1791
|
+
|
|
1792
|
+
Inspect the revision first, then promote it by name, slug, or exact capability
|
|
1793
|
+
ID:
|
|
1794
|
+
|
|
1795
|
+
```text
|
|
1796
|
+
/learn show normalize-release-notes
|
|
1797
|
+
/learn promote normalize-release-notes --scope user
|
|
1798
|
+
```
|
|
1799
|
+
|
|
1800
|
+
`--scope user` is the only supported scope and may be omitted. Invalid scopes,
|
|
1801
|
+
unknown options, duplicate scope options, and extra operands fail without
|
|
1802
|
+
changing the catalog. Promotion writes to the configured KodaX user Skill
|
|
1803
|
+
directory—normally `~/.kodax/skills/<slug>/SKILL.md`—and never overwrites
|
|
1804
|
+
different formal Skill content.
|
|
1805
|
+
|
|
1806
|
+
Use `/learn promote --help`, `/learn help promote`, or
|
|
1807
|
+
`/help learn promote` for the dedicated command reference. In the Ink Learning
|
|
1808
|
+
Center, open `/learn`, select an `active_learned` Skill, and choose
|
|
1809
|
+
**Promote to user catalog**.
|
|
1810
|
+
|
|
1811
|
+
---
|
|
1812
|
+
|
|
1813
|
+
## Commands (CLI)
|
|
1814
|
+
|
|
1815
|
+
Commands are `/xxx` shortcuts in CLI:
|
|
1816
|
+
|
|
1817
|
+
```bash
|
|
1818
|
+
kodax /review src/auth.ts
|
|
1819
|
+
kodax /test
|
|
1820
|
+
```
|
|
1821
|
+
|
|
1822
|
+
Commands are stored in `~/.kodax/commands/`:
|
|
1823
|
+
- `.md` files → Prompt commands (content used as prompt)
|
|
1824
|
+
- `.ts/.js` files → Programmable commands
|
|
1825
|
+
|
|
1826
|
+
---
|
|
1827
|
+
|
|
1828
|
+
## API Exports
|
|
1829
|
+
|
|
1830
|
+
```typescript
|
|
1831
|
+
// Main functions
|
|
1832
|
+
export { runKodaX, KodaXClient };
|
|
1833
|
+
|
|
1834
|
+
// Types
|
|
1835
|
+
export type {
|
|
1836
|
+
KodaXEvents, KodaXOptions, KodaXResult,
|
|
1837
|
+
KodaXMessage, KodaXContentBlock,
|
|
1838
|
+
KodaXSessionStorage, KodaXToolDefinition
|
|
1839
|
+
};
|
|
1840
|
+
|
|
1841
|
+
// Tools
|
|
1842
|
+
export { KODAX_TOOLS, KODAX_TOOL_REQUIRED_PARAMS, executeTool };
|
|
1843
|
+
|
|
1844
|
+
// Providers
|
|
1845
|
+
export { getProvider, KODAX_PROVIDERS, KodaXBaseProvider };
|
|
1846
|
+
|
|
1847
|
+
// Utilities
|
|
1848
|
+
export {
|
|
1849
|
+
estimateTokens,
|
|
1850
|
+
getGitRoot, getGitContext, getEnvContext, getProjectSnapshot,
|
|
1851
|
+
checkPromiseSignal
|
|
1852
|
+
};
|
|
1853
|
+
```
|
|
1854
|
+
|
|
1855
|
+
---
|
|
1856
|
+
|
|
1857
|
+
## Development
|
|
1858
|
+
|
|
1859
|
+
```bash
|
|
1860
|
+
# Development mode (using tsx)
|
|
1861
|
+
npm run dev "your task"
|
|
1862
|
+
|
|
1863
|
+
# Build
|
|
1864
|
+
npm run build
|
|
1865
|
+
|
|
1866
|
+
# Optional: only build workspace packages
|
|
1867
|
+
npm run build:packages
|
|
1868
|
+
|
|
1869
|
+
# Build standalone binary (current platform / all platforms)
|
|
1870
|
+
npm run build:binary
|
|
1871
|
+
npm run build:binary:all
|
|
1872
|
+
|
|
1873
|
+
# Run tests
|
|
1874
|
+
npm test
|
|
1875
|
+
|
|
1876
|
+
# Eval-driven development tests (provider matrices, identity round-trip, etc.)
|
|
1877
|
+
npm run test:eval
|
|
1878
|
+
|
|
1879
|
+
# Clean
|
|
1880
|
+
npm run clean
|
|
1881
|
+
```
|
|
1882
|
+
|
|
1883
|
+
### Repo Intelligence cache directories
|
|
1884
|
+
|
|
1885
|
+
KodaX uses one repo-intelligence cache root with separate built-in engine profiles:
|
|
1886
|
+
|
|
1887
|
+
- `.agent/repo-intelligence/`
|
|
1888
|
+
- Full-engine repo-intelligence artifacts and existing task-engine snapshots.
|
|
1889
|
+
- `.agent/repo-intelligence/light/`
|
|
1890
|
+
- Light-mode heuristic index artifacts.
|
|
1891
|
+
|
|
1892
|
+
They are intentionally separated so:
|
|
1893
|
+
|
|
1894
|
+
- full and light profiles can be rebuilt independently.
|
|
1895
|
+
- light-mode confidence/capability state cannot be mistaken for full-engine state.
|
|
1896
|
+
- future cache migrations can delete one profile without corrupting the other.
|
|
1897
|
+
|
|
1898
|
+
`.agent/repo-intelligence/` is local generated state and should not be committed.
|
|
1899
|
+
|
|
1900
|
+
---
|
|
1901
|
+
|
|
1902
|
+
## Code Style
|
|
1903
|
+
|
|
1904
|
+
### Comment Guidelines
|
|
1905
|
+
|
|
1906
|
+
KodaX uses an **English-first** comment style with selective Chinese brief notes for complex logic.
|
|
1907
|
+
|
|
1908
|
+
| Situation | Style | Example |
|
|
1909
|
+
|-----------|-------|---------|
|
|
1910
|
+
| Import/Export | English only | `// Import dependencies` |
|
|
1911
|
+
| Simple constants | English only | `// Max retry count` |
|
|
1912
|
+
| Simple logic | English only | `// Return if null` |
|
|
1913
|
+
| **Business rules** | English + Chinese | `// Skip tool_result - 跳过工具结果块` |
|
|
1914
|
+
| **Platform compatibility** | English + Chinese | `// Windows path handling - Windows 路径处理` |
|
|
1915
|
+
| **Performance optimization** | English + Chinese | `// Debounce to prevent flicker - 防抖避免闪烁` |
|
|
1916
|
+
|
|
1917
|
+
---
|
|
1918
|
+
|
|
1919
|
+
## Documentation
|
|
1920
|
+
|
|
1921
|
+
- [README_CN.md](README_CN.md) - Chinese Documentation
|
|
1922
|
+
- [public_docs/sdk/embedder-guide.md](public_docs/sdk/embedder-guide.md) - SDK hosting, shared Runtime daemon, Auto Mode, v0.7.74 compaction/history recovery, Agent telemetry, and active-run input contracts
|
|
1923
|
+
- [docs/release.md](docs/release.md) - Standalone binary build & release pipeline
|
|
1924
|
+
- [docs/PRD.md](docs/PRD.md) - Product Requirements
|
|
1925
|
+
- [docs/ADR.md](docs/ADR.md) - Architecture Decisions
|
|
1926
|
+
- [docs/HLD.md](docs/HLD.md) - High-Level Design
|
|
1927
|
+
- [docs/DD.md](docs/DD.md) - Detailed Design
|
|
1928
|
+
- [docs/FEATURE_LIST.md](docs/FEATURE_LIST.md) - Feature Tracking
|
|
1929
|
+
- [docs/test-guides/](docs/test-guides/) - Feature-specific test guides
|
|
1930
|
+
- [CHANGELOG.md](CHANGELOG.md) - Version History (v0.7.0+; [archive](docs/CHANGELOG_ARCHIVE.md) for older)
|
|
1931
|
+
|
|
1932
|
+
---
|
|
1933
|
+
|
|
1934
|
+
## License
|
|
1935
|
+
|
|
1936
|
+
[KodaX-AI Fair Core License (KAI-FCL) 1.0](LICENSE) - Copyright 2026 [icetomoyo](mailto:icetomoyo@gmail.com).
|
|
1937
|
+
|
|
1938
|
+
KAI-FCL is source-available / fair-core, not OSI open source. Commercial,
|
|
1939
|
+
enterprise, managed deployment, paid service, or customer redistribution use
|
|
1940
|
+
requires KodaX-AI authorization and a valid entitlement where required.
|
|
1941
|
+
|
|
1942
|
+
Official KodaX 0.7.70 and later distributions use KAI-FCL or accompanying
|
|
1943
|
+
KodaX-AI customer terms. Historical tags, archives, binaries, npm packages, or
|
|
1944
|
+
other copies already distributed with Apache-2.0 notices remain Apache-2.0 for
|
|
1945
|
+
those specific copies.
|