@kodax-ai/kodax 0.7.96 → 0.7.97-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +85 -62
  3. package/README_CN.md +57 -67
  4. package/config-templates/config.example.jsonc +0 -14
  5. package/dist/chunks/{agent-7N427EVB.js → agent-J7SHFM5N.js} +1 -1
  6. package/dist/chunks/argument-completer-ZJQOWTIS.js +2 -0
  7. package/dist/chunks/{chunk-ABZDFK2X.js → chunk-2GV6MQ4T.js} +14 -14
  8. package/dist/chunks/{chunk-6QI3GOYG.js → chunk-3PS3YEDS.js} +1 -1
  9. package/dist/chunks/chunk-4VJMQDTH.js +417 -0
  10. package/dist/chunks/{chunk-NI7PBPUR.js → chunk-5DSUVP46.js} +1 -1
  11. package/dist/chunks/chunk-5P7RTSZT.js +21 -0
  12. package/dist/chunks/{chunk-XXNR6S4Q.js → chunk-6ZAQKFIM.js} +1 -1
  13. package/dist/chunks/chunk-7V2QBZ73.js +137 -0
  14. package/dist/chunks/{chunk-C7U542KM.js → chunk-F7DHZH6T.js} +1 -1
  15. package/dist/chunks/{chunk-7IMWOR34.js → chunk-HSRYDDPF.js} +1 -1
  16. package/dist/chunks/chunk-K3DQGSQU.js +372 -0
  17. package/dist/chunks/chunk-NO23K2CB.js +2 -0
  18. package/dist/chunks/{chunk-NKT3B3DR.js → chunk-OT5WHAX4.js} +1 -1
  19. package/dist/chunks/{chunk-YEAUDI6U.js → chunk-QGWHJIO4.js} +1 -1
  20. package/dist/chunks/chunk-QOFFAY5C.js +261 -0
  21. package/dist/chunks/{chunk-4PFZ7BEE.js → chunk-QVDTORL3.js} +11 -11
  22. package/dist/chunks/chunk-QZ4B4AWG.js +473 -0
  23. package/dist/chunks/chunk-RXDS6CNA.js +355 -0
  24. package/dist/chunks/{chunk-WV3DJVW4.js → chunk-VDGPJQL7.js} +135 -135
  25. package/dist/chunks/chunk-VEZ4WHPN.js +641 -0
  26. package/dist/chunks/chunk-ZPPAT25E.js +5 -0
  27. package/dist/chunks/chunk-ZQYWDI4O.js +1 -0
  28. package/dist/chunks/chunk-ZS2GUADU.js +498 -0
  29. package/dist/chunks/{chunk-GN2IY5YE.js → chunk-ZTYZYXGV.js} +1 -1
  30. package/dist/chunks/{chunk-EM4XJBTK.js → chunk-ZZQ4GDVU.js} +1 -1
  31. package/dist/chunks/{client-6WZZTTSV.js → client-MXOJ5XUN.js} +1 -1
  32. package/dist/chunks/{compaction-config-ZMEJU4U7.js → compaction-config-5VZSGKBQ.js} +1 -1
  33. package/dist/chunks/{construction-bootstrap-RX4DMHI7.js → construction-bootstrap-U2ZU2WAT.js} +1 -1
  34. package/dist/chunks/dist-CSLNWLOE.js +2 -0
  35. package/dist/chunks/dist-XXMJMJDU.js +2 -0
  36. package/dist/chunks/host-RUXYZFYN.js +2 -0
  37. package/dist/chunks/readline-helpers-JCVULR4C.js +2 -0
  38. package/dist/chunks/run-manager-DRIM5VNE.js +2 -0
  39. package/dist/chunks/utils-MQEBGKIX.js +2 -0
  40. package/dist/index.d.ts +63 -30
  41. package/dist/index.js +10 -6
  42. package/dist/kodax_bootstrap.js +1 -1
  43. package/dist/kodax_cli.js +1745 -1734
  44. package/dist/kodax_resume.js +32 -35
  45. package/dist/native/win32-x64/kodax-windows-sandbox.exe +0 -0
  46. package/dist/native/win32-x64/kodax-windows-text-transaction.node +0 -0
  47. package/dist/native/win32-x64/manifest.json +2 -2
  48. package/dist/sandbox-network-broker.js +77 -77
  49. package/dist/sdk-a2a.d.ts +33 -18
  50. package/dist/sdk-a2a.js +8 -9
  51. package/dist/sdk-agent.d.ts +33 -26
  52. package/dist/sdk-agent.js +1 -1
  53. package/dist/sdk-client.d.ts +40 -0
  54. package/dist/sdk-client.js +2 -0
  55. package/dist/sdk-coding.d.ts +87 -499
  56. package/dist/sdk-coding.js +1 -1
  57. package/dist/sdk-experimental-memory.d.ts +3 -4
  58. package/dist/sdk-experimental-memory.js +1 -1
  59. package/dist/sdk-llm.d.ts +11 -9
  60. package/dist/sdk-llm.js +1 -1
  61. package/dist/sdk-mcp.d.ts +3 -3
  62. package/dist/sdk-mcp.js +1 -1
  63. package/dist/sdk-media.d.ts +3 -1
  64. package/dist/sdk-media.js +1 -1
  65. package/dist/sdk-repl.d.ts +317 -70
  66. package/dist/sdk-repl.js +2 -2
  67. package/dist/sdk-runtime.d.ts +580 -452
  68. package/dist/sdk-runtime.js +1 -1
  69. package/dist/sdk-sandbox.js +1 -1
  70. package/dist/sdk-session.d.ts +13 -9
  71. package/dist/sdk-session.js +1 -1
  72. package/dist/sdk-skills.js +1 -1
  73. package/dist/semantic-worker.js +57 -57
  74. package/dist/types-chunks/{base.d-Bt9lhwSV.d.ts → base.d-ZBOdjDUT.d.ts} +2 -1
  75. package/dist/types-chunks/{bash-prefix-extractor.d-DWFIMg0v.d.ts → bash-prefix-extractor.d-DvswAXKS.d.ts} +136 -66
  76. package/dist/types-chunks/{capability-learning.d-gRtO03f6.d.ts → capability-learning.d-B4pxKwP4.d.ts} +1 -1
  77. package/dist/types-chunks/{capability.d-Ch5Vos33.d.ts → capability.d-DOF3r0fJ.d.ts} +1 -1
  78. package/dist/types-chunks/{capsule.d-Dj1n6s0Y.d.ts → capsule.d-B4atvlxE.d.ts} +7 -19
  79. package/dist/types-chunks/client-contract-A1jdk6xz.d.ts +1993 -0
  80. package/dist/types-chunks/{controller.d-C0IM1Tud.d.ts → controller.d-BkUJ_3sl.d.ts} +1 -1
  81. package/dist/types-chunks/{controller.d-J2t1q8Ly.d.ts → controller.d-yyKajPTi.d.ts} +140 -1380
  82. package/dist/types-chunks/{cost-tracker.d-BWI4lFWn.d.ts → cost-tracker.d-BeaenODW.d.ts} +2 -47
  83. package/dist/types-chunks/{history-retrieval.d-CPN5PMBV.d.ts → history-retrieval.d-JdFfkeF3.d.ts} +2 -2
  84. package/dist/types-chunks/{manager.d-rtmywU9M.d.ts → manager.d-C_20XqCV.d.ts} +8 -1
  85. package/dist/types-chunks/manifest.d-Bw2i-zQi.d.ts +18 -0
  86. package/dist/types-chunks/provider-credential-context.d-BH2OaB1b.d.ts +47 -0
  87. package/dist/types-chunks/provider-request-observation.d-jL8T6wVO.d.ts +34 -0
  88. package/dist/types-chunks/{public-api.d-amBop8Nk.d.ts → public-api.d-Cq8ILMte.d.ts} +52 -13
  89. package/dist/types-chunks/{resolver.d-BrwLoWNr.d.ts → resolver.d-DLY01RHx.d.ts} +4 -2
  90. package/dist/types-chunks/{types.d-CSv0_cZC.d.ts → review-inbox.d-BeaLRNHx.d.ts} +251 -3
  91. package/dist/types-chunks/{shell-command-sets.d-oejwpP_7.d.ts → review-packet.d-D4bbTbq3.d.ts} +46 -3
  92. package/dist/types-chunks/{exec-policy.d-BPESl90L.d.ts → run-manager.d-C7Q71rin.d.ts} +385 -62
  93. package/dist/types-chunks/runtime-client-info-CxnlZlW5.d.ts +175 -0
  94. package/dist/types-chunks/{sdk-session-B6XjHNU1.d.ts → sdk-session-BDFjCpDn.d.ts} +12 -4
  95. package/dist/types-chunks/{side-query.d-DHWG1JZg.d.ts → side-query.d-DTrhVd_r.d.ts} +4 -3
  96. package/dist/types-chunks/trusted-repl-entry-vbUM8R6P.d.ts +445 -0
  97. package/dist/types-chunks/{types.d-CtO8mR1s.d.ts → types.d-BJTN-RZr.d.ts} +5 -5
  98. package/dist/types-chunks/{types.d-BrQMB-hy.d.ts → types.d-BjOq57-z.d.ts} +6 -0
  99. package/dist/types-chunks/types.d-o7t9dds4.d.ts +1484 -0
  100. package/dist/types-chunks/{utils.d-DcznBeQ3.d.ts → utils.d-CWiMhFfu.d.ts} +202 -36
  101. package/docs/CLIENT_CONTRACT.md +441 -0
  102. package/docs/SDK_MIGRATION.md +123 -0
  103. package/docs/SPACE_SDK_SEAMS.md +139 -0
  104. package/package.json +10 -5
  105. package/public_docs/README.md +12 -133
  106. package/public_docs/configuration/config-files.md +8 -14
  107. package/public_docs/sdk/embedder-guide.md +494 -420
  108. package/dist/chunks/argument-completer-FAIHW7HZ.js +0 -2
  109. package/dist/chunks/chunk-66XN5AFU.js +0 -417
  110. package/dist/chunks/chunk-7O2AIFNE.js +0 -373
  111. package/dist/chunks/chunk-DSXUXUZG.js +0 -5
  112. package/dist/chunks/chunk-GYO73UYQ.js +0 -275
  113. package/dist/chunks/chunk-HPCS3LZ5.js +0 -324
  114. package/dist/chunks/chunk-HZYRLIOC.js +0 -137
  115. package/dist/chunks/chunk-SC2ELSUS.js +0 -675
  116. package/dist/chunks/chunk-TEUD5VPJ.js +0 -471
  117. package/dist/chunks/chunk-TYZ2ZAYL.js +0 -487
  118. package/dist/chunks/dist-3UCCMCYR.js +0 -2
  119. package/dist/chunks/dist-F5IWZSAY.js +0 -2
  120. package/dist/chunks/host-W2JJ3V3Q.js +0 -2
  121. package/dist/chunks/run-manager-RBWU3EVE.js +0 -2
  122. package/dist/chunks/utils-DJ4ZFJGL.js +0 -2
  123. package/dist/runtime-worker.js +0 -5381
  124. package/dist/types-chunks/review-inbox.d-CTeUIKda.d.ts +0 -225
  125. package/dist/types-chunks/run-manager.d-hm1XgEou.d.ts +0 -94
  126. package/dist/types-chunks/trusted-repl-entry-D0w5M0UZ.d.ts +0 -323
  127. package/dist/types-chunks/types.d-B1l9pWyX.d.ts +0 -146
package/CHANGELOG.md CHANGED
@@ -8,6 +8,92 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  ---
10
10
 
11
+ ## [0.7.97-alpha.2] - 2026-10-10
12
+
13
+ Second alpha of the v0.7.97 line: completes the FEATURE_298 product seams
14
+ embedders need to run the client inside a trusted shell (Space). Execution
15
+ authorization moves to the trusted Main process, every provider wire request
16
+ carries its attribution, and full exits become verifiable. Every
17
+ v0.7.96 stable and v0.7.97-alpha.1 contract is retained. npm publication
18
+ remains a manual maintainer action.
19
+
20
+ ### Added
21
+
22
+ - Trusted Main execution authorization: `connectKodaXClient` /
23
+ `ensureKodaXClient` accept an `authorizeExecution(request, services)`
24
+ callback that runs only in the trusted Main process (Host capability
25
+ `productExecutionAuthorization:1`; older Hosts reject it instead of
26
+ silently dropping bindings). It registers scoped credential and hostTools
27
+ leases and attaches non-secret bindings per operation kind — input,
28
+ command, review, agents_lean, tool, workflow, agent_spawn, agent_followup,
29
+ and manual compaction. Queued consumes bind at consumption time, steers
30
+ keep the target Run's authorization, redirects carry their own, and
31
+ different authorizations never merge or widen.
32
+ - Provider request attribution: every provider wire request carries its
33
+ execution identity and route so hosts and embedders can observe which
34
+ authorization issued it.
35
+ - Client lifecycle and exit: `lifecycle.requestExit` settles client work and
36
+ records durable exit receipts that `readKodaXClientExits` verifies after
37
+ reconnect; full exits no longer rely on disconnect side effects.
38
+ - Host surfaces for embedders: an execution facts store and per-session
39
+ statistics exposed through the daemon, and a bundled product-exit smoke
40
+ joined the release gates.
41
+
42
+ ---
43
+
44
+ ## [0.7.97-alpha.1] - 2026-10-08
45
+
46
+ First alpha of the v0.7.97 line: FEATURE_298's unified product Host and
47
+ client contract. The interactive product pins to the independent Host, one
48
+ shared session contract carries data, control, and information semantics to
49
+ every consumer, and execution funnels through one prepared action. Every
50
+ v0.7.96 stable contract is retained. npm publication remains a manual
51
+ maintainer action.
52
+
53
+ ### Added
54
+
55
+ - Shared product session contract and SDK entry: `KodaXProductClient`
56
+ through `/client` exposes sessions, goals, notices, paged history reads,
57
+ and Host-estimated token accounting to product consumers (T01, T09, T32).
58
+ - The interactive REPL pins to the independent Host: session-command
59
+ mutations, `/compact`, `/goal`, full-text queue retention with atomic
60
+ pull-back, prompt input artifacts, and canonical session writes route
61
+ through the Host plane (T27, T34).
62
+ - Host-owned planes replace client-side reimplementations: queued inputs
63
+ with batching and withdrawal (T06), steer/redirect/explicit-stop delivery
64
+ with required target runs (T07), one permission authority (T14), skills
65
+ preparation expanded at consumption (T37), declarative workflow start and
66
+ control operations (T22), memory management (T36), per-session MCP
67
+ persistence with typed catalogs (T12), A2A serving from bootstrap listen
68
+ config (T21), agent registry and Actor collaboration (T30), invocations
69
+ preparation over RPC for all interactive faces (T37), session derivation
70
+ by fork or deterministic recovery seed (T10), lineage selection/labels/
71
+ rewind (T11), and conservative legacy-run reads with event repair (T33).
72
+
73
+ ### Fixed
74
+
75
+ - Preserve canonical history and ordinary browsing: complete canonical items
76
+ restore before identity assignment, reverse wheel input routes from frozen
77
+ windows, browse waiting is bounded and cancellable, partial pages keep the
78
+ final answer after older tools, and quoted managed protocol markers no
79
+ longer truncate ordinary assistant answers (Issues 344-349).
80
+ - Host command failures stay visible with their feedback, late observation
81
+ cleanup keeps its diagnostics, and Host message counts drive `/new`.
82
+ - Frontmatter hooks execute on Linux: the default hook contract no longer
83
+ pairs the bash contract with `/bin/sh`, which is dash on Debian/Ubuntu and
84
+ rejected every hook at shell environment resolution (Issue 354).
85
+ - Crash recovery proceeds after a `SIGKILL`ed daemon on Linux: a zombie pid
86
+ waiting for its parent to reap it is no longer classified as a live
87
+ competing owner (Issue 355).
88
+ - Release validation hardened the interactive fixtures (CI static-output
89
+ detection, learning-review request classification), raised the
90
+ machine-relative long-line layout budget on CI evidence (Issues 356-358;
91
+ 358 remains open for profiling), and aligned the release binary provider
92
+ smoke with Host-owned execution by seeding every provider's key env per
93
+ probe.
94
+
95
+ ---
96
+
11
97
  ## [0.7.96] - 2026-10-01
12
98
 
13
99
  Stable release of the v0.7.96 line, finalizing the fourteen release
package/README.md CHANGED
@@ -424,21 +424,30 @@ const result = await runKodaX(
424
424
 
425
425
  ## Runtime SDK and daemon
426
426
 
427
- SDK hosts can use `@kodax-ai/kodax/runtime` in three forms: inline embedded for
428
- lowest latency, Worker-hosted embedded for private state plus hard V8 disposal,
429
- or a local daemon shared by REPL, Space, IDE adapters, and custom SDK clients.
430
- All three expose the same `KodaXRuntime` services.
427
+ For shared Sessions, use `KodaXProductClient` from `@kodax-ai/kodax/client`.
428
+ The Host owns execution, settings and persistence; the UI submits inputs,
429
+ answers Host interactions and replaces its display from `sessions.observe`.
430
+ See the [Client contract](docs/CLIENT_CONTRACT.md), [SDK migration guide](docs/SDK_MIGRATION.md),
431
+ and [integration example](public_docs/sdk/embedder-guide.md#product-client-integration).
431
432
 
432
433
  ```ts
433
- import { createKodaXRuntime } from '@kodax-ai/kodax/runtime';
434
-
435
- const isolated = await createKodaXRuntime({
436
- mode: 'embedded',
437
- isolation: 'worker',
438
- requirements: { hardDispose: true },
439
- });
434
+ import { ensureKodaXClient } from '@kodax-ai/kodax/client';
435
+
436
+ const client = await ensureKodaXClient();
437
+ try {
438
+ const sessions = await client.sessions.list();
439
+ process.stdout.write(`Sessions: ${sessions.length}\n`);
440
+ } finally {
441
+ await client.disconnect(); // Shared Host and Runs remain alive.
442
+ }
440
443
  ```
441
444
 
445
+ `connectKodaXClient` attaches without starting or replacing a Host. The Node
446
+ connector does not provide browser HTTP/WebSocket transport. The retained
447
+ `/runtime` inline/daemon APIs are for explicit low-level Host integration;
448
+ Worker-hosted embedded Runtime is removed. The following structured-failure
449
+ reference is scoped to that low-level API, not fields promised by Product Client.
450
+
442
451
  ### Structured Runtime failures
443
452
 
444
453
  Since v0.7.96, when Runtime has a structured failure fact, failed/cancelled runs
@@ -470,47 +479,21 @@ collections, URLs, full local paths, stacks, or raw `Error` objects into
470
479
  See [Structured Runtime failures](public_docs/sdk/embedder-guide.md#structured-credential-safe-runtime-failures)
471
480
  for the field contract, taxonomy, migration guidance, and security boundary.
472
481
 
473
- Inline is private and lowest-overhead; Worker is private and hard-disposable;
474
- daemon is process-isolated and shared. `runtime.close()` closes private
475
- inline/Worker ownership, but only detaches one daemon client. Contradictory
476
- isolation options fail instead of silently selecting a weaker mode. Worker
477
- isolation is a V8 fault boundary, not a security sandbox.
478
-
479
- Because a daemon is intentionally persistent, tests that auto-start one must
480
- also run `kodax daemon stop --home <dir> --profile <name>` (or send authenticated
481
- `runtime.shutdown`) before deleting their temporary home. A remaining Node
482
- process is not safe to kill by name alone; verify its command line and owner.
482
+ The product CLI uses the shared Host; `--runtime-mode`, `KODAX_RUNTIME_MODE`
483
+ and the `runtimeMode` config key are removed. Explicit low-level inline
484
+ embedding retains private ownership, while daemon clients detach independently.
485
+ Worker-hosted embedded Runtime is no longer an option.
483
486
 
484
487
  ```bash
485
488
  kodax daemon start
489
+ kodax -p "Review this repository"
486
490
  kodax daemon stop --profile default
487
- kodax --runtime-mode daemon
488
- kodax -p "Review this repository" --runtime-mode daemon
489
491
  ```
490
492
 
491
- All CLI task forms now use the same Runtime path: interactive REPL, positional
492
- prompts, slash-command prompts, and `kodax -p`. Select the persistent default in
493
- `~/.kodax/config.json`:
494
-
495
- ```json
496
- {
497
- "runtimeMode": "daemon"
498
- }
499
- ```
500
-
501
- Resolution order is explicit CLI/SDK option > environment variable >
502
- `config.json` > built-in default (`embedded`). `KODAX_RUNTIME_MODE=daemon` is a
503
- temporary environment override. The same rule applies to other paired settings,
504
- for example `provider` ↔ `KODAX_PROVIDER` and `effort` ↔ `KODAX_EFFORT`.
505
- JSON names stay camelCase while environment names use `KODAX_UPPER_SNAKE_CASE`.
506
-
507
- By default, daemon state, config, and runtime session storage use the exact
508
- resolved `KODAX_HOME` (normally `<OS user home>/.kodax`), so CLI and SDK clients
509
- converge on the same local daemon even when `KODAX_HOME` is an arbitrary custom
510
- directory. The high-level `createKodaXRuntime({ mode: 'daemon' })` API starts or
511
- reuses that daemon unless you pass an explicit endpoint/transport or
512
- `autoStartDaemon: false`. An explicit `--home <dir>` or `homeDir` selects the
513
- isolated `<dir>/.kodax` namespace for tests, CI, or project-local experiments.
493
+ Tests that start an isolated Host must close that exact Host after its work has
494
+ settled, before removing its temporary home. Never stop arbitrary Node processes.
495
+ With no explicit home, CLI and SDK use the resolved `KODAX_HOME`; explicit
496
+ `homeDir` / `--home` selects a base directory containing `.kodax`.
514
497
 
515
498
  **v0.7.71 packaged Electron patch:** packaged/asar Electron hosts can use daemon
516
499
  auto-start without relaunching the GUI. `ELECTRON_RUN_AS_NODE` is limited to a
@@ -616,7 +599,7 @@ FEATURE_280 was explicitly rescheduled to v0.7.81 (then to v0.7.86 on
616
599
  Issue 256 was explicitly rescheduled to v0.7.84 and is likewise not represented
617
600
  as shipped by this release.
618
601
 
619
- **v0.7.80 hardening release:** The CLI honors `worker.configuredA2A` in
602
+ **v0.7.80 hardening release:** The CLI honored `worker.configuredA2A` in
620
603
  `~/.kodax/config.json`: the embedded Runtime becomes Worker-hosted and loads
621
604
  the configured A2A plane inside the Worker owner, so configured outbound
622
605
  Agents appear as `external:<name>` in `list_dispatchable_agents` and can be
@@ -786,6 +769,30 @@ provider's model, REPL `/compact` clears the UI only after a durable save, and
786
769
  successful reports carry bounded `summaryRequests` plus `commitMs` per
787
770
  physical summary call.
788
771
 
772
+ **v0.7.97-alpha.2 release:** Completes the FEATURE_298 product seams
773
+ embedders need to run the client inside a trusted shell (Space).
774
+ `connectKodaXClient`/`ensureKodaXClient` accept a trusted
775
+ `authorizeExecution` callback that registers scoped credential and hostTools
776
+ leases and attaches non-secret bindings per operation kind (queued consumes
777
+ bind at consumption, steers keep the target Run's authorization, redirects
778
+ carry their own); every provider wire request carries its execution
779
+ attribution; `lifecycle.requestExit` settles client work and records
780
+ durable exit receipts that `readKodaXClientExits` verifies; and the Host
781
+ exposes execution facts and per-session statistics. See
782
+ [docs/SPACE_SDK_SEAMS.md](docs/SPACE_SDK_SEAMS.md). Every v0.7.96 stable
783
+ and v0.7.97-alpha.1 contract is retained.
784
+
785
+ **v0.7.97-alpha.1 release:** First alpha of the v0.7.97 line — FEATURE_298's
786
+ unified product Host and client contract. The interactive REPL pins to the
787
+ independent Host; the shared product session contract (`KodaXProductClient`
788
+ through `/client`) carries sessions, goals, notices, paged history, queued
789
+ inputs with batching and withdrawal, and the steer/redirect/stop delivery
790
+ distinction; one permission authority, skills, workflows, memory, per-session
791
+ MCP persistence, and A2A serving become Host-owned; sessions derive by fork
792
+ or deterministic recovery seed; and runtime read/write gaps close (Issues
793
+ 344-349). Every v0.7.96 stable contract is retained; cross-platform manual
794
+ acceptance remains open.
795
+
789
796
  **v0.7.96 stable release:** The stable release of the v0.7.96 line,
790
797
  finalizing the fourteen release candidates: trusted text transactions and
791
798
  platform shell containment across Windows, Linux, and macOS; Windows daemon
@@ -1285,10 +1292,10 @@ effective draft after streaming and reconnect while raw journals retain the
1285
1292
  complete audit trail. They must not replay provider recovery checkpoints or
1286
1293
  deduplicate text heuristically.
1287
1294
 
1288
- For the full host-integration contract, including inline/Worker/daemon selection,
1295
+ For the full host-integration contract, including Product Client and explicit inline/daemon ownership,
1289
1296
  multi-client permission handling, config/catalog/MCP admin APIs, artifacts,
1290
1297
  context diagnostics, and daemon protocol schemas, see
1291
- [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).
1298
+ [public_docs/sdk/embedder-guide.md §17](public_docs/sdk/embedder-guide.md#17-runtime-sdk-and-local-daemon-feature_253-feature_257).
1292
1299
 
1293
1300
  The Space/IDE shared-daemon contract is documented in
1294
1301
  [SDK Embedder Guide section 23](public_docs/sdk/embedder-guide.md#23-shared-coder-daemon-for-space-and-ide-hosts-feature_269-v0769).
@@ -1319,7 +1326,7 @@ kodax --repo-intelligence full --repo-intelligence-trace
1319
1326
 
1320
1327
  ## Architecture
1321
1328
 
1322
- 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):
1329
+ KodaX uses a **monorepo architecture** with npm workspaces. Source layout currently has 4 workspace packages; the current source packages them as a single bundled npm package `@kodax-ai/kodax` with 13 SDK subpath exports (`/agent`, `/llm`, `/coding`, `/media`, `/repl`, `/skills`, `/mcp`, `/session`, `/client`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`; ADR-024 + ADR-032 + ADR-038, with ADR-036 consolidation):
1323
1330
 
1324
1331
  ```
1325
1332
  KodaX/
@@ -1394,9 +1401,9 @@ Source-side workspace package names (`@kodax-ai/*`). npm consumers install the s
1394
1401
  KodaX has two layers that consumers should understand separately:
1395
1402
 
1396
1403
  - **Source-side**: 4 workspace packages above (what developers see when reading the repo).
1397
- - **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:
1404
+ - **Current packaged exports** (not a claim of npm availability): a single bundled package `@kodax-ai/kodax` with 13 SDK subpaths (what SDK consumers `import` from). The subpaths are split into two roles:
1398
1405
  - **Full-package subpaths** (`/agent`, `/llm`, `/coding`, `/repl`) — each one maps 1:1 to a source workspace and exposes its complete public API.
1399
- - **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`.
1406
+ - **Integration and narrow subpaths** (`/media`, `/skills`, `/mcp`, `/session`, `/client`, `/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`.
1400
1407
 
1401
1408
  | Source package | npm subpath | Type | What you get | Example consumer |
1402
1409
  |---|---|---|---|---|
@@ -1409,7 +1416,8 @@ KodaX has two layers that consumers should understand separately:
1409
1416
  | `packages/coding` | `@kodax-ai/kodax/coding` | Full package | Coding agent + 50+ tools + repo-intelligence (505 exports) | Build a Claude Code-shape product |
1410
1417
  | `packages/repl` | `@kodax-ai/kodax/repl` | Full package | Ink TUI + permission modes + commands (217 exports) | Terminal-UI consumers |
1411
1418
  | `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 |
1412
- | `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 |
1419
+ | `src` | `@kodax-ai/kodax/client` | Product API | Shared Host connection and `KodaXProductClient` contract | TUI, desktop/IDE and automation applications |
1420
+ | `src` | `@kodax-ai/kodax/runtime` | Host API | Explicit inline/daemon runtime facade, sessions/runs/events/permissions/catalog/MCP/artifacts/diagnostics/external agents, daemon protocol schema (10 exports) | Trusted Host integration |
1413
1421
  | `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 |
1414
1422
  | `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 |
1415
1423
 
@@ -1532,10 +1540,11 @@ later re-enable. Private-address access and non-loopback plaintext HTTP are
1532
1540
  independent, persisted, default-deny permissions (`--allow-private` and
1533
1541
  `--allow-insecure-http`); exact loopback HTTP remains available without either.
1534
1542
  OAuth token endpoints retain their stricter HTTPS-or-exact-loopback rule.
1535
- Worker-hosted SDK Runtimes can load this same configured plane inside the Worker
1536
- owner with `worker: { configuredA2A: true }`. The CLI honors the same opt-in
1537
- from `~/.kodax/config.json` (`"worker": { "configuredA2A": true }`) by creating
1538
- a Worker-hosted embedded Runtime that loads the configured A2A plane. `a2a serve` loads
1543
+ SDK hosts load this same configured plane by wiring
1544
+ `createConfiguredA2ARuntimeIntegration({ configHome })` and passing its
1545
+ `runtimeOptions` as `externalAgents` — the CLI does this for its embedded
1546
+ sessions and the daemon Host it launches, and the `worker.configuredA2A` opt-in
1547
+ was removed with the Worker facade in v0.7.97. `a2a serve` loads
1539
1548
  its configured MCP/Extension capability surface before listening and pins that
1540
1549
  execution authority; it hot-reloads publication, authentication, and limits.
1541
1550
 
@@ -1623,7 +1632,6 @@ dist/binary/linux-x64/
1623
1632
  ├── builtin/ # Sidecar built-in skills
1624
1633
  ├── provider-capabilities.json
1625
1634
  ├── semantic-worker.js # Repo-intelligence Worker
1626
- ├── runtime-worker.js # SDK Runtime Worker
1627
1635
  └── constructed-handler-worker.js # Constructed-tool Worker
1628
1636
  ```
1629
1637
 
@@ -1635,6 +1643,10 @@ See [docs/release.md](docs/release.md) for full details on build flags, archive
1635
1643
 
1636
1644
  ### As Library
1637
1645
 
1646
+ For shared-Session applications, use the [Product Client integration](public_docs/sdk/embedder-guide.md#product-client-integration)
1647
+ and [migration guide](docs/SDK_MIGRATION.md). The example below is independent
1648
+ in-process coding library usage; it is not the product UI contract.
1649
+
1638
1650
  ```bash
1639
1651
  npm install @kodax-ai/kodax
1640
1652
  ```
@@ -1662,6 +1674,7 @@ For smaller surface and tree-shake-friendly imports, the SDK is also exposed via
1662
1674
 
1663
1675
  ```typescript
1664
1676
  import { Runner } from '@kodax-ai/kodax/agent'; // agent runtime
1677
+ import { ensureKodaXClient } from '@kodax-ai/kodax/client'; // shared product Client
1665
1678
  import { getProvider } from '@kodax-ai/kodax/llm'; // LLM abstraction (16 aliases)
1666
1679
  import { runKodaX } from '@kodax-ai/kodax/coding'; // coding tools + prompts
1667
1680
  import { createImageArtifactFromPath } from '@kodax-ai/kodax/media'; // input artifacts
@@ -1675,9 +1688,9 @@ import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 client
1675
1688
  import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in memory SDK
1676
1689
  ```
1677
1690
 
1678
- 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.
1691
+ All 14 SDK entries (root + 13 subpaths, including `/client`) share internal code via ESM chunk splitting — importing from `/agent` does not pull in `/repl`'s Ink + React surface.
1679
1692
 
1680
- For the complete host-facing contract — including embedded/Worker/daemon ownership,
1693
+ For the product contract and separate low-level inline/daemon ownership,
1681
1694
  external-agent registration and task control, session cursor pagination, workflow
1682
1695
  model-tier routing, and efficiency telemetry — see the
1683
1696
  [SDK Embedder Integration Guide](public_docs/sdk/embedder-guide.md).
@@ -1926,6 +1939,10 @@ stays silent.
1926
1939
 
1927
1940
  ## Advanced Library Usage
1928
1941
 
1942
+ These examples describe independent coding-library ownership. Shared product
1943
+ clients use `/client`; see the [migration guide](docs/SDK_MIGRATION.md) before
1944
+ adapting these callbacks or storage examples into a UI.
1945
+
1929
1946
  #### Simple Mode (runKodaX)
1930
1947
 
1931
1948
  ```typescript
@@ -2009,7 +2026,11 @@ await runKodaX({
2009
2026
 
2010
2027
  ## SDK Usage
2011
2028
 
2012
- 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:
2029
+ This development tree exposes 13 SDK subpaths plus the root. Shared product
2030
+ applications use `@kodax-ai/kodax/client`; independent libraries and trusted Host
2031
+ APIs remain available through the other subpaths. See the [Client contract](docs/CLIENT_CONTRACT.md)
2032
+ and [SDK migration guide](docs/SDK_MIGRATION.md). The package version is still
2033
+ `0.7.96-rc.11`; npm publication is separate from the `v0.7.97` design target.
2013
2034
 
2014
2035
  ```bash
2015
2036
  npm install @kodax-ai/kodax
@@ -2017,6 +2038,7 @@ npm install @kodax-ai/kodax
2017
2038
 
2018
2039
  ```typescript
2019
2040
  import { runKodaX } from '@kodax-ai/kodax'; // root: CLI helpers + runKodaX
2041
+ import { ensureKodaXClient, connectKodaXClient } from '@kodax-ai/kodax/client'; // shared product contract
2020
2042
  import { Runner, runFanOut } from '@kodax-ai/kodax/agent'; // generic Agent framework
2021
2043
  import { getProvider } from '@kodax-ai/kodax/llm'; // 16-alias LLM abstraction
2022
2044
  import { KODAX_TOOLS } from '@kodax-ai/kodax/coding'; // tools + prompts + agent loop
@@ -2186,7 +2208,8 @@ await runInkInteractiveMode({ provider: 'zhipu-coding', effort: 'auto' });
2186
2208
  | Building custom agent | `@kodax-ai/kodax/agent` | Runner + fan-out + idle-yield + session-lineage + capabilities |
2187
2209
  | Coding tasks | `@kodax-ai/kodax/coding` | Complete coding agent + tools |
2188
2210
  | Terminal app | `@kodax-ai/kodax/repl` | Full interactive experience |
2189
- | Runtime host / daemon client | `@kodax-ai/kodax/runtime` | Sessions, runs, events, permissions, catalog, MCP, artifacts, diagnostics |
2211
+ | Shared Session application | `@kodax-ai/kodax/client` | Unified product intent, observation, interactions and history |
2212
+ | Trusted Runtime host | `@kodax-ai/kodax/runtime` | Explicit embedding, credentials/Host Tools and diagnostics |
2190
2213
  | Experimental governed memory | `@kodax-ai/kodax/experimental-memory` | Governed `MemoryAgent` list/remember/forget and scoped `MemorySession` recall/outcome contracts |
2191
2214
 
2192
2215
  ---
package/README_CN.md CHANGED
@@ -82,18 +82,23 @@ macOS/Linux 会报告 Seatbelt/bubblewrap 所需依赖。拒绝 UAC 或缺少依
82
82
 
83
83
  ## Runtime SDK 与共享 daemon
84
84
 
85
- `@kodax-ai/kodax/runtime` 支持 inline、Worker 和本机共享 daemon。FEATURE_269
86
- 让 CLI、Space、IDE 与其他本地 SDK 客户端可以原子加入同一个 Coder
87
- session/run,共享 transcript、Todo、tool、AskUser、permission、队列与唯一终态。
88
- daemon mutation 使用持久 operation identity 和 revision CAS;崩溃后不会盲目重放
89
- 可能已有副作用的 provider、run 或 Host Tool 调用。
90
-
91
- Space 的 provider credential 仍由 OS keychain 持有,只通过 run/provider-scoped
92
- broker 使用;Space Artifact/Office/Control 只通过显式绑定到该 run 的 Host Tool
93
- lease 暴露。CLI run 不会因为 Space 后来加入而继承这些能力。Partner 继续使用独立
94
- data/session root 下的 inline Runtime,不参与 Coder owner fence。capability 缺失时必须
95
- fail closed,不能静默退回 inline Coder。完整接入说明见
96
- [SDK Embedder Guide §23](public_docs/sdk/embedder-guide.md#23-shared-coder-daemon-for-space-and-ide-hosts-feature_269-v0769)。
85
+ 产品接入统一使用 `@kodax-ai/kodax/client` 的 `KodaXProductClient`。Host 负责执行、设置和存储,TUI、SDK 应用及其他 UI 提交意图并观察同一事实。详见[迁移指南](docs/SDK_MIGRATION.md)、[Client 契约](docs/CLIENT_CONTRACT.md)和[接入示例](public_docs/sdk/embedder-guide.md#product-client-integration)。
86
+
87
+ ```ts
88
+ import { ensureKodaXClient } from '@kodax-ai/kodax/client';
89
+
90
+ const client = await ensureKodaXClient();
91
+ try {
92
+ const sessions = await client.sessions.list();
93
+ process.stdout.write(`Sessions: ${sessions.length}\n`);
94
+ } finally {
95
+ await client.disconnect(); // 只断开当前连接,共享 Host 和 Run 继续存在。
96
+ }
97
+ ```
98
+
99
+ `connectKodaXClient` 只连接已有兼容 Host;`ensureKodaXClient` 通过统一启动器启动或正常更新空闲 Host。Node 连接器不提供浏览器 HTTP/WebSocket transport。
100
+
101
+ 底层 `/runtime` 仍支持显式 inline embedded 与 daemon,供受信任宿主处理凭据桥、Host Tools、启动和诊断;Worker-hosted embedded、通用 operation receipt/journal 已移除。不能在产品连接失败时退回私有 Runtime。下方结构化 Runtime 错误说明仅属于底层接口,不能假定 Product Client 暴露相同字段。
97
102
 
98
103
  ### 结构化且凭据安全的 Runtime 错误
99
104
 
@@ -296,6 +301,25 @@ SDK 系统代码契约更新,但没有放宽 shell/sandbox 的 fail-closed 边
296
301
  `handleRuntimePermissionRequest()` 管理 SDK 权限 UI,并在 prepared Session 尾部遇到
297
302
  `data_changed` 时通过权威 delta 合并恢复;后台持久化失败会显示为诊断,不再静默丢失。
298
303
 
304
+ **v0.7.97-alpha.2 发布**:补齐 FEATURE_298 面向嵌入方(Space)的产品接缝——
305
+ 在可信壳内运行客户端所需的最后一块。`connectKodaXClient`/`ensureKodaXClient`
306
+ 接受仅在可信 Main 进程执行的 `authorizeExecution` 回调,注册 scoped credential
307
+ 与 hostTools lease,并按操作种类附加非秘密绑定(排队消费在消费时绑定、steer
308
+ 保留目标 Run 的授权、redirect 携带自身授权);每条 Provider wire request 携带
309
+ 其执行归因;`lifecycle.requestExit` 结清客户端工作并记录持久退出回执,由
310
+ `readKodaXClientExits` 在重连后核验;宿主暴露 execution facts 与按会话统计。
311
+ 详见 [docs/SPACE_SDK_SEAMS.md](docs/SPACE_SDK_SEAMS.md) 与
312
+ [v0.7.97-alpha.2 发布清单](docs/release.md#v0797-alpha2-release-preparation)。
313
+ 所有 v0.7.96 稳定与 v0.7.97-alpha.1 契约全部保留。
314
+
315
+ **v0.7.97-alpha.1 发布**:v0.7.97 线首个 alpha——FEATURE_298 统一产品宿主
316
+ 与客户端契约。交互式 REPL 绑定独立宿主;共享产品会话契约
317
+ (`KodaXProductClient`,经 `/client`)承载会话、目标、通知、分页历史、
318
+ 带批量与撤回的排队输入,以及 steer/redirect/stop 投递区分;唯一权限权威、
319
+ 技能、工作流、内存、按会话 MCP 持久化与 A2A 服务收归宿主;会话按 fork 或
320
+ 确定性恢复种子派生;运行时读写缺口闭合(Issues 344-349)。所有 v0.7.96
321
+ 稳定契约全部保留;跨平台人工验收保持开放。
322
+
299
323
  **v0.7.96 正式版发布**:v0.7.96 线的正式版本,定格十四个发布候选的全部
300
324
  成果:跨 Windows/Linux/macOS 的受信文本事务与平台 Shell 隔离;Windows
301
325
  daemon 生命周期仲裁与不阻塞的不确定 Shell 清理;按回合匹配的中断 Run 跨
@@ -478,7 +502,7 @@ native 文本权威改在摘要固定的 `manylinux_2_28` 构建器中编译,
478
502
  scope 在 SDK、Agent 摘要、CLI 与 Runtime Worker 请求间共享,保留结构化的 Child Agent Provider
479
503
  失败信息,精确遵循 run-scoped 凭据校验,并为严格 vLLM 网关省略空 `tools` 数组(Issues 329-332)。
480
504
  npm 发布仍由
481
- 维护者手动执行。详见 [v0.7.96 正式版发布清单](docs/release.md#v0796-release-preparation)。
505
+ 维护者手动执行。详见 [v0.7.97-alpha.1 发布清单](docs/release.md#v0797-alpha1-release-preparation)。
482
506
 
483
507
  **v0.7.96-alpha.3 发布**:Provider 凭据成为惰性、受限、可撤销的能力(ADR-068)。v2
484
508
  credential broker 将 Provider 密钥保留在 OS keychain,按每次 wire call、为单一封闭
@@ -876,6 +900,8 @@ kodax "Review this repository and summarize the architecture"
876
900
 
877
901
  ### 4. 作为库使用
878
902
 
903
+ 共享 Session 的 TUI、桌面/IDE 和自动化应用应使用 `@kodax-ai/kodax/client`,见[迁移指南](docs/SDK_MIGRATION.md)和[完整 Client 契约](docs/CLIENT_CONTRACT.md)。以下 `runKodaX` 示例属于独立 coding 库,不是产品客户端入口。
904
+
879
905
  ```bash
880
906
  npm install @kodax-ai/kodax
881
907
  ```
@@ -905,15 +931,15 @@ import { SkillRegistry } from '@kodax-ai/kodax/skills'; // 零依赖 ski
905
931
  import { loadConfig } from '@kodax-ai/kodax/repl'; // REPL 配置 / session 工具
906
932
  import { createMcpManager } from '@kodax-ai/kodax/mcp'; // MCP popout manager(v0.7.42 起)
907
933
  import { listSessions } from '@kodax-ai/kodax/session'; // session 历史工具
908
- import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // embedded/Worker/daemon 宿主 API
934
+ import { createKodaXRuntime } from '@kodax-ai/kodax/runtime'; // inline/daemon 宿主 API
909
935
  import { runKodaXSandboxed } from '@kodax-ai/kodax/sandbox'; // 独立 ASRT 受控执行
910
936
  import { createKodaXA2AServer } from '@kodax-ai/kodax/a2a'; // A2A 1.0 双向接入
911
937
  import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-in 实验性记忆 SDK
912
938
  ```
913
939
 
914
- 13 个 SDK 入口(root + 12 subpath)通过 ESM 共享 chunk 复用底层代码 —— 只 import `/agent` 不会把 `/repl` 的 Ink + React 一起拉进来。
940
+ 14 个 SDK 入口(root + 13 subpath,包含产品 `/client`)通过 ESM 共享 chunk 复用底层代码 —— 只 import `/agent` 不会把 `/repl` 的 Ink + React 一起拉进来。
915
941
 
916
- 完整的宿主集成契约——包括 embedded/Worker/daemon 所有权、外部 Agent 注册与任务控制、session cursor 分页、workflow 模型分层和效率遥测——见 [SDK Embedder Integration Guide](public_docs/sdk/embedder-guide.md)。
942
+ 完整的宿主集成契约——包括 inline/daemon 所有权、外部 Agent 注册与任务控制、session cursor 分页、workflow 模型分层和效率遥测——见 [SDK Embedder Integration Guide](public_docs/sdk/embedder-guide.md)。
917
943
 
918
944
  > **SDK 是 ESM-only**。在 CommonJS 上下文(Electron main 进程、传统 Webpack CJS bundle、`require()` 调用方)必须用 `await import('@kodax-ai/kodax/...')` 代替 `require()`。详见 [public_docs/sdk/embedder-guide.md §5](public_docs/sdk/embedder-guide.md#5-consuming-from-a-commonjs-context-electron-main-cjs-bundles),含 Electron main 完整 recipe + 为什么大多数 subpath 物理上无法做 dual ESM/CJS bundle。
919
945
 
@@ -1056,55 +1082,19 @@ registerCustomProviders([
1056
1082
  await runKodaX({ provider: 'my-openai-compatible' }, '解释这个仓库');
1057
1083
  ```
1058
1084
 
1059
- ### 6. Runtime 与本机 daemon
1060
-
1061
- 交互 REPL、位置参数、slash-command 生成的任务和 `kodax -p` 现在都走统一的
1062
- `KodaXRuntime` 入口。默认使用最低延迟的进程内 `embedded`;单一 SDK 宿主需要
1063
- 独立 V8 与硬销毁时,可选择 Worker-hosted embedded;需要后台持续运行、断线后
1064
- 查询或多个本机客户端共享时,可切到 `daemon`:
1065
-
1066
- ```ts
1067
- import { createKodaXRuntime } from '@kodax-ai/kodax/runtime';
1068
-
1069
- const isolated = await createKodaXRuntime({
1070
- mode: 'embedded',
1071
- isolation: 'worker',
1072
- requirements: { hardDispose: true },
1073
- });
1074
- ```
1075
-
1076
- inline 形态由调用方私有且开销最低;Worker 形态仍然私有,但可硬销毁;
1077
- daemon 形态使用独立进程并允许多个客户端共享。`runtime.close()` 会关闭
1078
- 私有 inline/Worker Runtime,但对 daemon 只断开当前客户端。矛盾的隔离参数
1079
- 会直接报错,不会静默降级。Worker 是 V8 故障隔离边界,不是安全沙箱。
1085
+ ### 6. 统一 Client 与本机 Host
1080
1086
 
1081
- daemon 按设计会持续驻留。测试若自动启动 daemon,删除临时 home 前还必须执行
1082
- `kodax daemon stop --home <目录> --profile <名称>`(或发送已认证的
1083
- `runtime.shutdown`)。不要按进程名批量结束 Node;应先核验命令行和父进程归属。
1087
+ 当前产品入口采用共享 daemon Host,TUI 和 SDK 产品客户端都通过统一契约提交输入、读取状态、回答交互。`--runtime-mode`、`KODAX_RUNTIME_MODE` 和 config 的 `runtimeMode` 已从产品面移除。
1084
1088
 
1085
1089
  ```bash
1086
1090
  kodax daemon start
1091
+ kodax -p "检查这个仓库"
1087
1092
  kodax daemon stop --profile default
1088
- kodax --runtime-mode daemon
1089
- kodax -p "检查这个仓库" --runtime-mode daemon
1090
- ```
1091
-
1092
- 持久设置写入 `~/.kodax/config.json`:
1093
-
1094
- ```json
1095
- {
1096
- "runtimeMode": "daemon"
1097
- }
1098
1093
  ```
1099
1094
 
1100
- 统一优先级是:显式 CLI/SDK 参数 > 环境变量 > `config.json` > 内置默认值。
1101
- `KODAX_RUNTIME_MODE=daemon` 适合临时覆盖。其他成对配置也遵循相同规则,例如
1102
- `provider` ↔ `KODAX_PROVIDER`、`effort` ↔ `KODAX_EFFORT`。JSON 保持 camelCase,
1103
- 环境变量保持 `KODAX_UPPER_SNAKE_CASE`,两者按语义一一对应。
1095
+ daemon 可承载多个 Session;不同 Session 可以并发,同一 Session 的交付由 Host 串行协调。`after_turn` 可在当前 Run 的安全点交付,不必等整个长任务结束。客户端关闭观察或断开连接不会停止 Run。停止任务使用 `runs.stop` 或 `sessions.cancel`;关闭空闲 Host 才使用 `host.shutdown`/daemon stop。
1104
1096
 
1105
- 一个 daemon 可以承载多个 session。不同 session 可以并发运行;同一个 session
1106
- 内部仍保持一次只运行一个任务,后续任务按队列执行。多个 `kodax` 进程可以连接
1107
- 同一个 daemon,并分别打开或观察不同 session。
1097
+ 显式独立库嵌入仍可使用 `/runtime` 的 `createKodaXRuntime({mode:'embedded'})`,其 owner 和退出责任属于调用者。这不是 CLI 的可选运行模式,也不是产品客户端的连接失败回退。当前包版本与发布状态见[SDK 迁移指南](docs/SDK_MIGRATION.md)。
1108
1098
 
1109
1099
  ### 7. 打包成单文件二进制(无需 Node)
1110
1100
 
@@ -1131,7 +1121,6 @@ dist/binary/linux-x64/
1131
1121
  ├── builtin/ # 内置 skills sidecar
1132
1122
  ├── provider-capabilities.json
1133
1123
  ├── semantic-worker.js # Repo intelligence Worker
1134
- ├── runtime-worker.js # SDK Runtime Worker
1135
1124
  └── constructed-handler-worker.js # Constructed tool Worker
1136
1125
  ```
1137
1126
 
@@ -1243,7 +1232,7 @@ kodax --repo-intelligence full --repo-intelligence-trace
1243
1232
 
1244
1233
  ## 仓库结构
1245
1234
 
1246
- KodaX 是基于 npm workspaces 的 TypeScript monorepo,**源码层 4 个 workspace 包**(FEATURE_194 v0.7.43 包合并 — 9 → 4,ADR-036),npm 上以单 bundle 包 `@kodax-ai/kodax` 发布 + 12 个 SDK subpath exports(`/agent`、`/llm`、`/coding`、`/media`、`/repl`、`/skills`、`/mcp`、`/session`、`/runtime`、`/sandbox`、`/a2a`、`/experimental-memory`;ADR-024 + ADR-032 + ADR-038)。核心包:
1235
+ KodaX 是基于 npm workspaces 的 TypeScript monorepo,**源码层 4 个 workspace 包**(FEATURE_194 v0.7.43 包合并 — 9 → 4,ADR-036),npm 上以单 bundle 包 `@kodax-ai/kodax` 发布 + 13 个 SDK subpath exports(`/agent`、`/llm`、`/coding`、`/media`、`/repl`、`/skills`、`/mcp`、`/session`、`/client`、`/runtime`、`/sandbox`、`/a2a`、`/experimental-memory`;ADR-024 + ADR-032 + ADR-038)。核心包:
1247
1236
 
1248
1237
  | Workspace 包 | 作用 | 主要依赖 |
1249
1238
  |----|------|---------|
@@ -1259,9 +1248,9 @@ KodaX 是基于 npm workspaces 的 TypeScript monorepo,**源码层 4 个 works
1259
1248
  KodaX 有两层结构,SDK 用户需要分开理解:
1260
1249
 
1261
1250
  - **源码层**:上面 4 个 workspace 包(开发者读代码时看到的物理结构)。
1262
- - **npm 发布层**:单个 bundled 包 `@kodax-ai/kodax`,对外暴露 12 个 SDK subpath(SDK 消费者 `import` 时看到的接口)。subpath 分两种角色:
1251
+ - **当前源码打包导出**(不表示已发布到 npm):单个 bundled 包 `@kodax-ai/kodax`,对外暴露 13 个 SDK subpath(SDK 消费者 `import` 时看到的接口)。subpath 分两种角色:
1263
1252
  - **完整包 subpath**(`/agent`、`/llm`、`/coding`、`/repl`)—— 每个 1:1 对应一个源码包,暴露完整公开 API。
1264
- - **集成与窄子集 subpath**(`/media`、`/skills`、`/mcp`、`/session`、`/runtime`、`/sandbox`、`/a2a`、`/experimental-memory`)—— 聚焦能力或宿主集成边界;`/experimental-memory` 明确为 opt-in 不稳定接口。
1253
+ - **集成与窄子集 subpath**(`/media`、`/skills`、`/mcp`、`/session`、`/client`、`/runtime`、`/sandbox`、`/a2a`、`/experimental-memory`)—— 聚焦能力或宿主集成边界;`/experimental-memory` 明确为 opt-in 不稳定接口。
1265
1254
 
1266
1255
  | 源码包 | npm subpath | 类型 | 内容 | 典型消费者 |
1267
1256
  |---|---|---|---|---|
@@ -1274,7 +1263,8 @@ KodaX 有两层结构,SDK 用户需要分开理解:
1274
1263
  | `packages/coding` | `@kodax-ai/kodax/coding` | 完整包 | Coding agent + 50+ 工具 + repo-intelligence (505 exports) | 构建 Claude Code 形态产品 |
1275
1264
  | `packages/repl` | `@kodax-ai/kodax/repl` | 完整包 | Ink TUI + 权限模式 + 命令系统 (217 exports) | 终端 UI 消费者 |
1276
1265
  | `packages/repl` | `@kodax-ai/kodax/session` | **窄子集** | 仅会话管理 —— `listSessions` / `loadFullTranscript` / `appendClientNotice` / `forkSession` / `compactSession` / `watchSessions` 等 (17 exports) | 读取 session 历史的 IDE 插件和桌面宿主 |
1277
- | `src` | `@kodax-ai/kodax/runtime` | 宿主 API | Embedded/Worker/daemon facade,含 sessions/runs/events/permissions/catalog/MCP/artifacts/diagnostics/外部 Agent 和 daemon schema (10 exports) | SDK 宿主、Space/IDE、daemon client |
1266
+ | `src` | `@kodax-ai/kodax/client` | 产品 API | 共享 Host 连接与 `KodaXProductClient` 统一契约 | TUI、桌面/IDE 和自动化应用 |
1267
+ | `src` | `@kodax-ai/kodax/runtime` | 宿主 API | Explicit inline/daemon facade,含 sessions/runs/events/permissions/catalog/MCP/artifacts/diagnostics/外部 Agent 和 daemon schema (10 exports) | 受信任宿主集成 |
1278
1268
  | `src` | `@kodax-ai/kodax/sandbox` | 宿主 API | 显式 ASRT capability/doctor/setup 与宿主自有受控命令执行;不可用时绝不静默普通执行 | 需要独立进程 containment 的 SDK 宿主 |
1279
1269
  | `src` | `@kodax-ai/kodax/a2a` | 集成边界 | A2A 1.0 Agent Card 发现、JSON-RPC/SSE F258 executor、安全 fetch 与鉴权 Runtime Agent server | Agent 编排器和 KodaX 宿主 |
1280
1270
 
@@ -1369,10 +1359,10 @@ MCP、A2A、Extension 分别使用 `~/.kodax/integrations/` 下的一个用户
1369
1359
  停用条目可随时重新启用。私网地址访问与非 loopback 明文 HTTP 是两项独立、
1370
1360
  持久化且默认拒绝的权限(`--allow-private` 与 `--allow-insecure-http`);精确
1371
1361
  loopback HTTP 无需这两项授权。OAuth token endpoint 仍保持更严格的
1372
- HTTPS 或精确 loopback 规则。Worker-hosted SDK Runtime 可通过
1373
- `worker: { configuredA2A: true }` 让 Worker owner 装载同一配置执行平面。
1374
- CLI 同样支持在 `~/.kodax/config.json` 中配置 `"worker": { "configuredA2A": true }`,
1375
- 将嵌入式运行时改为 Worker 托管并装载配置的 A2A 执行平面。
1362
+ HTTPS 或精确 loopback 规则。SDK 宿主通过 `createConfiguredA2ARuntimeIntegration({ configHome })` 装载同一
1363
+ 配置执行平面,并把其 `runtimeOptions` 作为 `externalAgents` 传入——CLI 为其嵌入式
1364
+ 会话和它启动的 daemon Host 完成同样的接线;`worker.configuredA2A` 选项已随
1365
+ Worker facade 在 v0.7.97 移除。
1376
1366
  `a2a serve` 会在监听前装载已配置的 MCP/Extension 能力并固定执行权威,同时热加载
1377
1367
  公开信息、鉴权和限额。Agent、Skill、Extension 工具权威、工作区、tool policy
1378
1368
  或任务存储变更必须显式重启服务。
@@ -1430,7 +1420,7 @@ KodaX/ # 4 workspace packages(FEATURE_194 v0.7.43)
1430
1420
  │ ├── kodax_cli.ts # CLI 主入口(bin: `kodax`)
1431
1421
  │ └── sdk-*.ts # SDK subpath 入口 → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session,runtime,sandbox,a2a,experimental-memory}
1432
1422
  ├── scripts/
1433
- │ ├── build-bundle.mjs # esbuild 单 bundle 多 entry 打包(CLI + root + 12 SDK subpath + chunks)
1423
+ │ ├── build-bundle.mjs # esbuild 单 bundle 多 entry 打包(CLI + root + 13 SDK subpath + chunks)
1434
1424
  │ ├── build-binary.mjs # Bun --compile 单文件二进制打包
1435
1425
  │ └── release.mjs # 发布 CI 构建的通用 tarball;本地 --pack-only 保持 private:true
1436
1426
  └── .github/workflows/
@@ -13,20 +13,6 @@
13
13
  // "deepseek": ["deepseek-flash", "deepseek-v4-pro"]
14
14
  // },
15
15
 
16
- // Interactive Runtime hosting: "embedded" (this process) or "daemon".
17
- // "runtimeMode": "embedded",
18
-
19
- // Worker-hosted embedded Runtime options. `configuredA2A` lets a
20
- // Worker-hosted embedded Runtime load and reconcile
21
- // ~/.kodax/integrations/a2a.json inside the Worker owner, so configured
22
- // outbound A2A Agents appear as `external:<name>` and can be dispatched
23
- // with spawn_agent. Default inline (non-Worker) CLI sessions already load
24
- // the configured A2A plane automatically; this key switches the embedded
25
- // session to a Worker-hosted Runtime and loads the plane in that mode.
26
- // "worker": {
27
- // "configuredA2A": true
28
- // },
29
-
30
16
  // Native model reasoning. `effort` is the preferred explicit depth;
31
17
  // `reasoningCeiling` is the session ceiling. `reasoningMode` and `thinking`
32
18
  // remain accepted for backward compatibility.
@@ -1,2 +1,2 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{Fb as k,Va as g,Xa as h,a as c,qa as d,ra as e,sa as f,wb as i,xb as j}from"./chunk-7O2AIFNE.js";import"./chunk-EM4XJBTK.js";import"./chunk-66XN5AFU.js";import"./chunk-C7U542KM.js";import"./chunk-NI7PBPUR.js";import{Rb as a,Sb as b}from"./chunk-WV3DJVW4.js";import"./chunk-DSXUXUZG.js";import"./chunk-HZYRLIOC.js";import"./chunk-ONUPGMER.js";export{e as bucketProviderPayloadSize,g as buildAutoRepoIntelligenceContext,f as checkPromiseSignal,b as cleanupIncompleteToolCalls,h as describeTransientProviderRetry,c as emitResilienceDebug,d as estimateProviderPayloadBytes,k as runKodaX,j as saveRequiredSessionSnapshot,i as saveSessionSnapshot,a as validateAndFixToolHistory};
2
+ import{Ib as k,Xa as g,Za as h,a as c,sa as d,ta as e,ua as f,yb as i,zb as j}from"./chunk-K3DQGSQU.js";import"./chunk-ZZQ4GDVU.js";import"./chunk-4VJMQDTH.js";import"./chunk-F7DHZH6T.js";import"./chunk-5DSUVP46.js";import{Rb as a,Sb as b}from"./chunk-VDGPJQL7.js";import"./chunk-ZPPAT25E.js";import"./chunk-7V2QBZ73.js";import"./chunk-ONUPGMER.js";export{e as bucketProviderPayloadSize,g as buildAutoRepoIntelligenceContext,f as checkPromiseSignal,b as cleanupIncompleteToolCalls,h as describeTransientProviderRetry,c as emitResilienceDebug,d as estimateProviderPayloadBytes,k as runKodaX,j as saveRequiredSessionSnapshot,i as saveSessionSnapshot,a as validateAndFixToolHistory};