@kodax-ai/kodax 0.7.96-beta.9 → 0.7.96-rc.10
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 +234 -0
- package/README.md +98 -1
- package/README_CN.md +71 -2
- package/dist/chunks/{agent-4LNAAVUB.js → agent-SIFLR4F3.js} +1 -1
- package/dist/chunks/argument-completer-OPZOG6XS.js +2 -0
- package/dist/chunks/chunk-3KJZV7C4.js +2 -0
- package/dist/chunks/chunk-4HFXQIQP.js +324 -0
- package/dist/chunks/chunk-54LYU5IB.js +363 -0
- package/dist/chunks/{chunk-P472TI5T.js → chunk-5DJN3YKJ.js} +155 -154
- package/dist/chunks/{chunk-5Z7OAIPW.js → chunk-5MKGSX3I.js} +1 -1
- package/dist/chunks/{chunk-ESDWXMTG.js → chunk-67FTLDKF.js} +224 -218
- package/dist/chunks/{chunk-JA2DY4EC.js → chunk-756FJMN2.js} +1 -1
- package/dist/chunks/chunk-BNQSGCFN.js +471 -0
- package/dist/chunks/{chunk-NYKZ6Z2Q.js → chunk-DTO7YOGG.js} +1 -1
- package/dist/chunks/{chunk-AE5YFXU2.js → chunk-HQTDZW5B.js} +14 -14
- package/dist/chunks/{chunk-A66CMPHV.js → chunk-JMCQ6GNW.js} +2 -2
- package/dist/chunks/{chunk-XIADYNRK.js → chunk-NCNPYSVW.js} +2 -2
- package/dist/chunks/{chunk-74UJ5IFX.js → chunk-NDYG5DGT.js} +1 -1
- package/dist/chunks/{chunk-TWJINGV6.js → chunk-NGD36O5G.js} +1 -1
- package/dist/chunks/chunk-PBRY4LBG.js +486 -0
- package/dist/chunks/{chunk-6HHZ6MJK.js → chunk-UBMU25PI.js} +3 -3
- package/dist/chunks/{chunk-KSAXT7BU.js → chunk-UYRXWZL3.js} +2 -2
- package/dist/chunks/chunk-VCZGME2P.js +2 -0
- package/dist/chunks/chunk-W5XGIRQQ.js +137 -0
- package/dist/chunks/{chunk-WXBRPZMI.js → chunk-WHQCTZKI.js} +1 -1
- package/dist/chunks/{chunk-JOGZFXHZ.js → chunk-XG5PF4N2.js} +1 -1
- package/dist/chunks/{client-GQJBBOLH.js → client-I7MM6DTU.js} +1 -1
- package/dist/chunks/{compaction-config-JLQU7GJH.js → compaction-config-3MGXUVYV.js} +1 -1
- package/dist/chunks/{construction-bootstrap-6UYNF7TE.js → construction-bootstrap-Z52GWWUC.js} +1 -1
- package/dist/chunks/dist-222EMRS3.js +2 -0
- package/dist/chunks/dist-D3F2T7TO.js +2 -0
- package/dist/chunks/host-4W5V62EK.js +2 -0
- package/dist/chunks/run-manager-7FNQ5UYA.js +2 -0
- package/dist/chunks/{utils-GIXQGDJZ.js → utils-OCTLXNV7.js} +1 -1
- package/dist/index.d.ts +23 -22
- package/dist/index.js +2 -2
- package/dist/kodax_bootstrap.js +5 -2
- package/dist/kodax_cli.js +1694 -1552
- package/dist/native/win32-x64/kodax-windows-sandbox.exe +0 -0
- package/dist/native/win32-x64/kodax-windows-text-transaction.node +0 -0
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/runtime-worker.js +1530 -1388
- package/dist/sandbox-network-broker.js +73 -73
- package/dist/sdk-a2a.d.ts +16 -16
- package/dist/sdk-a2a.js +3 -3
- package/dist/sdk-agent.d.ts +22 -52
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +49 -29
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +6 -6
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +38 -9
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +3 -3
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +2 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +19 -19
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-runtime.d.ts +19 -18
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.d.ts +10 -10
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +61 -61
- package/dist/types-chunks/{base.d-BGa4Hcp5.d.ts → base.d-Bt9lhwSV.d.ts} +1 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-sWv2rlSu.d.ts → bash-prefix-extractor.d-k_wdD8ne.d.ts} +37 -9
- package/dist/types-chunks/{capability-learning.d-lRPgA3Or.d.ts → capability-learning.d-gRtO03f6.d.ts} +1 -1
- package/dist/types-chunks/{capability.d-D64w-LP1.d.ts → capability.d-Ch5Vos33.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-CUkwG98f.d.ts → capsule.d-DZ876ZXa.d.ts} +3 -3
- package/dist/types-chunks/{controller.d-ClFvfenm.d.ts → controller.d-BQC-1Xez.d.ts} +2 -2
- package/dist/types-chunks/{controller.d-ChzX_KpU.d.ts → controller.d-DFrGVMe1.d.ts} +53 -5
- package/dist/types-chunks/{exec-policy.d-BSvfbN6Q.d.ts → exec-policy.d-D6ZIpoya.d.ts} +5 -5
- package/dist/types-chunks/{history-retrieval.d-hJix1cJV.d.ts → history-retrieval.d-DbskjCsR.d.ts} +2 -2
- package/dist/types-chunks/image-validation.d-ACJcj02o.d.ts +16 -0
- package/dist/types-chunks/{manager.d-CzNCeCuT.d.ts → manager.d-rtmywU9M.d.ts} +1 -1
- package/dist/types-chunks/{public-api.d-Cho7knWA.d.ts → public-api.d-Dvrukw0s.d.ts} +4 -4
- package/dist/types-chunks/{resolver.d-CJlv-ItU.d.ts → resolver.d-BrwLoWNr.d.ts} +9 -4
- package/dist/types-chunks/{review-inbox.d-DZavlaKF.d.ts → review-inbox.d-BoLtrkGp.d.ts} +6 -2
- package/dist/types-chunks/{run-manager.d-DXSYnIn3.d.ts → run-manager.d-DkzyX7gU.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-DhuZ4cmv.d.ts → sdk-session-DYBO5x-6.d.ts} +3 -3
- package/dist/types-chunks/{shell-command-sets.d-L822XXSh.d.ts → shell-command-sets.d-DVEAhtRp.d.ts} +1 -1
- package/dist/types-chunks/{side-query.d-oO8k7XBL.d.ts → side-query.d-DHWG1JZg.d.ts} +2 -2
- package/dist/types-chunks/{trusted-repl-entry-DU1KJTbd.d.ts → trusted-repl-entry-BBKN2BI5.d.ts} +5 -5
- package/dist/types-chunks/{types-PHjfwebT.d.ts → types-DDJu9iWX.d.ts} +1 -1
- package/dist/types-chunks/{types.d-Xy0f3x4i.d.ts → types.d-BrQMB-hy.d.ts} +27 -1
- package/dist/types-chunks/{types.d-D1wEkn4h.d.ts → types.d-CTpAuikX.d.ts} +5 -3
- package/dist/types-chunks/{types.d-CXtyICUW.d.ts → types.d-D1b05bql.d.ts} +2 -2
- package/dist/types-chunks/{types.d-BhU-SIpK.d.ts → types.d-DTKIKBnb.d.ts} +5 -5
- package/dist/types-chunks/{utils.d-DjOA100v.d.ts → utils.d-BJ-ArLFQ.d.ts} +6 -6
- package/package.json +5 -3
- package/public_docs/README.md +2 -2
- package/public_docs/configuration/permissions.md +23 -0
- package/public_docs/sdk/embedder-guide.md +39 -5
- package/scripts/production-env.cjs +4 -1
- package/dist/chunks/argument-completer-X4GJWD5E.js +0 -2
- package/dist/chunks/chunk-7QJ4JHJE.js +0 -345
- package/dist/chunks/chunk-A42OYZUE.js +0 -384
- package/dist/chunks/chunk-OK4U4SXB.js +0 -471
- package/dist/chunks/chunk-Q4EZLR6T.js +0 -2
- package/dist/chunks/chunk-QP554CFT.js +0 -324
- package/dist/chunks/chunk-SMIOTGQ2.js +0 -2
- package/dist/chunks/chunk-V7ZTP5SV.js +0 -122
- package/dist/chunks/dist-4O6MH6AE.js +0 -2
- package/dist/chunks/dist-LR7HVFHX.js +0 -2
- package/dist/chunks/host-2X5XUTXO.js +0 -2
- package/dist/chunks/run-manager-6XOSEJOM.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,240 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
## [0.7.96-rc.10] - 2026-09-22
|
|
12
|
+
|
|
13
|
+
Tenth release candidate of the v0.7.96 line: Runtime shutdown now owns and
|
|
14
|
+
drains the background work it starts, Edits-mode text tools no longer reject
|
|
15
|
+
ordinary project files when a workspace root contains protected native state,
|
|
16
|
+
and the MCP image-validation cancellation fixture is stabilized. Every rc.9
|
|
17
|
+
contract is retained. npm publication remains a manual maintainer action.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Drain owned managed terminal maintenance on Runtime close: the optional
|
|
22
|
+
repo-intelligence/artifact maintenance factory is registered with its own
|
|
23
|
+
Runtime before it can start, close stops accepting new optional maintenance
|
|
24
|
+
and waits for existing owned work before releasing Actor, executor, and
|
|
25
|
+
owner-liveness resources, so test workspaces are no longer held after
|
|
26
|
+
`Runtime.close()` returns. Run completion, successor admission, and Stop
|
|
27
|
+
stay independent of maintenance; shared repo caches are not cancelled.
|
|
28
|
+
- Own and settle memory work on shutdown: Runtime registers its memory
|
|
29
|
+
setup/finalization IO and background review drains before execution; close
|
|
30
|
+
refuses new work, cancels pending review requests, and awaits
|
|
31
|
+
already-started work before releasing the owner. Managed execution finishes
|
|
32
|
+
its required durable memory finalization before publishing completion, the
|
|
33
|
+
classic finalizer owns learned-Skill outcome and binding-release IO, and
|
|
34
|
+
branch-authority setup checks cancellation before prompt/Git work. A caller
|
|
35
|
+
signal already aborted at entry settles as an interrupt terminal (defined
|
|
36
|
+
`KodaXResult`, terminal `onComplete`) instead of a raw rejection, keeping
|
|
37
|
+
the CAP-005-001b and CAP-086-003 contracts.
|
|
38
|
+
- Scope trusted text transaction cache protection to the authorized canonical
|
|
39
|
+
target: Edits-mode `edit`/`write` no longer fail with `Runtime write policy
|
|
40
|
+
targets protected native text state` for ordinary project files when a
|
|
41
|
+
workspace root contains the protected native cache (for example a home
|
|
42
|
+
root). Development artifact trust still checks every authorized write root,
|
|
43
|
+
so a writable manifest cannot redefine trusted native bytes.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## [0.7.96-rc.9] - 2026-09-21
|
|
48
|
+
|
|
49
|
+
Ninth release candidate of the v0.7.96 line: Windows daemon startup trees
|
|
50
|
+
are reclaimed when a launcher dies before publication, contended daemon state
|
|
51
|
+
replacement retries only Windows EPERM, and Windows Runtime identity probes
|
|
52
|
+
gained structured, privacy-bounded lifecycle diagnostics. Every rc.8
|
|
53
|
+
contract is retained. npm publication remains a manual maintainer action.
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- Arbitrate daemon publication against launcher loss with a one-shot startup
|
|
58
|
+
handoff: unpublished daemon candidates and their Windows Job descendants are
|
|
59
|
+
reclaimed, while published shared services and other clients' execution are
|
|
60
|
+
preserved (Issue 337).
|
|
61
|
+
- Retry only Windows EPERM while atomically publishing the same flushed
|
|
62
|
+
daemon state, under a bounded monotonic failure-path budget; permanent
|
|
63
|
+
errors and staging cleanup are preserved and ownership ordering is
|
|
64
|
+
unchanged, so concurrent JSON readers no longer break state replacement
|
|
65
|
+
(Issue 338).
|
|
66
|
+
- Add structured Windows Runtime lifecycle diagnostics: `setKodaXDiagnosticSink`
|
|
67
|
+
reports boot identity, Job membership, process snapshot, start identity, and
|
|
68
|
+
exit-owner validation stages with bounded evidence and no commands,
|
|
69
|
+
environment, output, or identity values; probes, retries, and checks are
|
|
70
|
+
unchanged.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## [0.7.96-rc.8] - 2026-09-17
|
|
75
|
+
|
|
76
|
+
Eighth release candidate of the v0.7.96 line: custom OpenAI-compatible
|
|
77
|
+
reasoning is negotiated from `auto` with explicit-level fallback, timeout and
|
|
78
|
+
cancellation errors keep their redacted semantics across scoped credentials,
|
|
79
|
+
and KodaX's default `NODE_ENV` no longer leaks into user shell commands.
|
|
80
|
+
Every rc.7 contract is retained. npm publication remains a manual maintainer
|
|
81
|
+
action.
|
|
82
|
+
|
|
83
|
+
### Fixed
|
|
84
|
+
|
|
85
|
+
- Preserve native DOMException timeout/cancellation semantics, nested causes, and
|
|
86
|
+
redacted error stacks across scoped Provider credentials. Keep typed timeouts
|
|
87
|
+
recognizable through Provider wrapping and recovery even without timeout wording.
|
|
88
|
+
- Negotiate custom OpenAI-compatible reasoning from `auto` by default, lower rejected
|
|
89
|
+
efforts without losing explicit disable intent, and reuse hard-rejection caches
|
|
90
|
+
across streaming and non-streaming turns. Report requested/sent effort and fallback
|
|
91
|
+
reasons to SDK hosts, retaining the original rejection across rate-limit retries;
|
|
92
|
+
preserve and replay `reasoning` and structured `reasoning_details`.
|
|
93
|
+
- Keep KodaX's default `NODE_ENV` out of SDK user shell commands so `npm install`
|
|
94
|
+
and `npm ci` no longer implicitly omit devDependencies. Preserve KodaX's own
|
|
95
|
+
production mode and explicitly configured user environment values.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## [0.7.96-rc.7] - 2026-09-14
|
|
100
|
+
|
|
101
|
+
Seventh release candidate of the v0.7.96 line: successful writes return
|
|
102
|
+
eligible file outputs over A2A in both coding and managed execution. Every
|
|
103
|
+
rc.6 contract is retained. npm publication remains a manual maintainer
|
|
104
|
+
action.
|
|
105
|
+
|
|
106
|
+
### Fixed
|
|
107
|
+
|
|
108
|
+
- Return eligible A2A files from successful writes in both coding and managed execution,
|
|
109
|
+
independently of conversation compaction and the memory artifact ledger. Preserve existing
|
|
110
|
+
publication limits and legacy executors; recognize HTML/HTM outputs as `text/html`.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## [0.7.96-rc.6] - 2026-09-14
|
|
115
|
+
|
|
116
|
+
Sixth release candidate of the v0.7.96 line: Windows exit delays from
|
|
117
|
+
unresolved historical Shell records are reduced while unknown cleanup
|
|
118
|
+
outcomes and Run recovery evidence are preserved. Every rc.5 contract is
|
|
119
|
+
retained. npm publication remains a manual maintainer action.
|
|
120
|
+
|
|
121
|
+
### Fixed
|
|
122
|
+
|
|
123
|
+
- Reduce Windows exit delays from unresolved historical Shell records. Skip process-tree
|
|
124
|
+
queries only when every retained target is definitively absent; preserve unknown cleanup
|
|
125
|
+
outcomes and Run recovery evidence.
|
|
126
|
+
- Reuse the Windows termination process for its first post-termination snapshot. Retain
|
|
127
|
+
exact process identity checks, fresh verification and retries when cleanup is uncertain.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## [0.7.96-rc.5] - 2026-09-14
|
|
132
|
+
|
|
133
|
+
Fifth release candidate of the v0.7.96 line: corrupt extracted images no
|
|
134
|
+
longer poison subsequent model requests (Issue 335), and residual native
|
|
135
|
+
request-content errors are diagnosed with an evidence-backed text-only
|
|
136
|
+
request. Every rc.4 contract is retained. npm publication remains a manual
|
|
137
|
+
maintainer action.
|
|
138
|
+
|
|
139
|
+
### Fixed
|
|
140
|
+
|
|
141
|
+
- Prevent corrupt extracted images from poisoning subsequent model requests (Issue 335).
|
|
142
|
+
Prepare read/MCP image bytes at receipt and historical images at run admission; reuse them
|
|
143
|
+
across Anthropic/OpenAI requests, retries and compaction without repeatedly reading files.
|
|
144
|
+
Preserve valid bytes, text, tool status and original history. Revalidate on new reads/resume,
|
|
145
|
+
correct stale MIME, keep diagnostics aligned and preserve nested upstream error codes.
|
|
146
|
+
Cancel preparation promptly while preserving text-only scheduling and direct SDK compatibility.
|
|
147
|
+
Reuse ingress validation verdicts and include decoder queue waits in the existing time budget.
|
|
148
|
+
Avoid unused image snapshots for custom Runner callbacks and ACP transports.
|
|
149
|
+
Decoder unavailability retains the existing image path with an explicit notice.
|
|
150
|
+
Expose `validateImageBytes` through the LLM and media SDK; include the WASM codec in Bun
|
|
151
|
+
binaries and release archives.
|
|
152
|
+
- Diagnose residual native request-content errors with the current Agent using a text-only
|
|
153
|
+
request and the existing output/attempt budgets. Apply only evidence-backed request-view
|
|
154
|
+
repairs, preserve completed and unknown-execution tool records, retain later valid reasoning,
|
|
155
|
+
stop on new input/cancellation and allow one
|
|
156
|
+
diagnostic plus one retry. Preserve precise image evidence through credential redaction;
|
|
157
|
+
authentication, quota and transport failures keep their existing recovery behavior.
|
|
158
|
+
Release settled image-validation contexts without retaining credentials or image snapshots.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## [0.7.96-rc.4] - 2026-09-13
|
|
163
|
+
|
|
164
|
+
Fourth release candidate of the v0.7.96 line: new Session startup no longer
|
|
165
|
+
scans unrelated Run event logs, and lost or corrupt event-sequence cursors
|
|
166
|
+
recover beyond stale cross-Runtime caches (Issue 334). Every rc.3 contract is
|
|
167
|
+
retained. npm publication remains a manual maintainer action.
|
|
168
|
+
|
|
169
|
+
### Fixed
|
|
170
|
+
|
|
171
|
+
- Initialize new Session event journals at sequence zero instead of scanning and
|
|
172
|
+
parsing unrelated Run logs. This removes a synchronous startup stall that could
|
|
173
|
+
also cause concurrent Session history reads to exceed their 15-second timeout.
|
|
174
|
+
- Bind cached event sequence floors to their journal epoch. When an existing
|
|
175
|
+
sequence file is missing or corrupt, recover the durable log maximum even if
|
|
176
|
+
another Runtime has left this process with an older cached floor, preventing
|
|
177
|
+
duplicate event sequences and lost replay progress.
|
|
178
|
+
- Populate both Full RepoIntel routing and preturn caches during startup prewarm
|
|
179
|
+
from the same worker result, avoiding a repeated routing query after the short
|
|
180
|
+
inner cache expires while preserving the complete Full context.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## [0.7.96-rc.3] - 2026-09-13
|
|
185
|
+
|
|
186
|
+
Third release candidate of the v0.7.96 line: daemon capabilities are aligned
|
|
187
|
+
and accepted Shell Stops become recoverable while process-tree cleanup is
|
|
188
|
+
unknown, with shell results keeping their status and output. Every rc.2
|
|
189
|
+
contract is retained. npm publication remains a manual maintainer action.
|
|
190
|
+
|
|
191
|
+
### Fixed
|
|
192
|
+
|
|
193
|
+
- Project the owning Runtime's `sessionCancellation` and `toolInvocation`
|
|
194
|
+
capabilities through the default daemon handshake and capability query.
|
|
195
|
+
Explicit tool execution retains normal permissions, events and persistence.
|
|
196
|
+
- Keep an accepted Shell Stop unconfirmed while process-tree cleanup is unknown.
|
|
197
|
+
Retry cleanup against the original Run, retain exact recovery references across
|
|
198
|
+
owner restarts, and preserve known descendants when refreshing process identities.
|
|
199
|
+
- Preserve Run cleanup evidence during generic process sweeps, and propagate
|
|
200
|
+
the owning Run's Shell cleanup registration through read/write child executors.
|
|
201
|
+
- Keep the cancelled/timeout status and captured output in shell results when
|
|
202
|
+
process-tree cleanup cannot be confirmed: the unconfirmed-cleanup note is
|
|
203
|
+
appended to the command outcome instead of replacing it. The background
|
|
204
|
+
stop owns native termination, so cleanup never terminates the same
|
|
205
|
+
process tree twice.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## [0.7.96-rc.2] - 2026-09-12
|
|
210
|
+
|
|
211
|
+
Second release candidate of the v0.7.96 line: a stale first Session Stop
|
|
212
|
+
request bound to an already terminal Run is rejected atomically before a new
|
|
213
|
+
Stop frontier is published. Every rc.1 contract is retained. npm publication
|
|
214
|
+
remains a manual maintainer action.
|
|
215
|
+
|
|
216
|
+
### Fixed
|
|
217
|
+
|
|
218
|
+
- Reject first `sessions.cancel` requests bound to a terminal Run before
|
|
219
|
+
publishing a cancellation frontier, preventing delayed requests from stopping
|
|
220
|
+
successor Runs. Accepted requests retain normal and post-restart replay.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## [0.7.96-rc.1] - 2026-09-12
|
|
225
|
+
|
|
226
|
+
First release candidate of the v0.7.96 line: trusted text authority is
|
|
227
|
+
unified across Runtime Sessions and direct SDK entries, and provider requests
|
|
228
|
+
carry live permission facts. Every beta.9 contract is retained. npm
|
|
229
|
+
publication remains a manual maintainer action.
|
|
230
|
+
|
|
231
|
+
### Fixed
|
|
232
|
+
|
|
233
|
+
- Unify trusted text authority across Runtime Sessions and direct SDK entries.
|
|
234
|
+
Full Access now reaches native text transactions through `runKodaX`,
|
|
235
|
+
`runManagedTask`, and each `KodaXClient.send`. Auto-approved concrete text
|
|
236
|
+
calls can write their exact external target, including portable `tool_call`
|
|
237
|
+
dispatch, without granting a directory or reusing approval across operations
|
|
238
|
+
or Runs. Explicit denials and native integrity checks remain enforced.
|
|
239
|
+
- Include live host permission facts in direct and managed provider requests,
|
|
240
|
+
including retries, independently of configuration defaults and prompt
|
|
241
|
+
overrides. Runtime permission capability 6 fences older daemon authority.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
11
245
|
## [0.7.96-beta.9] - 2026-09-12
|
|
12
246
|
|
|
13
247
|
Ninth beta pre-release of the v0.7.96 line, carrying FEATURE_299 (unified
|
package/README.md
CHANGED
|
@@ -297,6 +297,8 @@ a new one before running `kodax`.
|
|
|
297
297
|
`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.
|
|
298
298
|
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.
|
|
299
299
|
|
|
300
|
+
An undeclared OpenAI-compatible reasoning profile means capability is unknown. Omitted effort uses `auto`: the declared default wins, otherwise KodaX tries `max` and lowers only after explicit parameter/value rejection. `none` attempts to disable reasoning, then tries the lowest available thinking effort if disabling is rejected. SDK hosts receive `onReasoningResolved` with the requested effort, sent effort, fallback reasons, and `verified: false`; request acceptance does not prove that the model honored the strength. See [reasoning negotiation](docs/DD.md#23-custom-openai-compatible-reasoning) for cache and replay contracts.
|
|
301
|
+
|
|
300
302
|
#### OpenAI-compatible reasoning providers
|
|
301
303
|
|
|
302
304
|
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:
|
|
@@ -784,6 +786,101 @@ provider's model, REPL `/compact` clears the UI only after a durable save, and
|
|
|
784
786
|
successful reports carry bounded `summaryRequests` plus `commitMs` per
|
|
785
787
|
physical summary call.
|
|
786
788
|
|
|
789
|
+
**v0.7.96-rc.10 release:** Tenth release candidate of the v0.7.96 line.
|
|
790
|
+
Runtime shutdown owns and drains the background work it starts: managed
|
|
791
|
+
terminal maintenance and memory setup/finalization IO plus background review
|
|
792
|
+
drains are registered with the owning Runtime, close refuses new work and
|
|
793
|
+
awaits already-started work before releasing resources, and managed execution
|
|
794
|
+
finishes its durable memory finalization before publishing completion.
|
|
795
|
+
Edits-mode `edit`/`write` no longer reject ordinary project files when a
|
|
796
|
+
workspace root contains protected native state: trusted text transaction
|
|
797
|
+
cache protection targets only the authorized canonical file while
|
|
798
|
+
development artifact trust still checks every authorized write root. Every
|
|
799
|
+
rc.9 contract is retained.
|
|
800
|
+
|
|
801
|
+
**v0.7.96-rc.9 release:** Ninth release candidate of the v0.7.96 line.
|
|
802
|
+
Arbitrates daemon publication against launcher loss with a one-shot startup
|
|
803
|
+
handoff: unpublished Windows daemon startup trees and their Job descendants
|
|
804
|
+
are reclaimed while published shared services stay untouched (Issue 337).
|
|
805
|
+
Windows daemon state replacement retries only contended EPERM while
|
|
806
|
+
atomically publishing the same flushed state under a bounded failure budget,
|
|
807
|
+
so concurrent JSON readers no longer break replacement (Issue 338). Windows
|
|
808
|
+
Runtime identity probes emit structured lifecycle diagnostics through
|
|
809
|
+
`setKodaXDiagnosticSink` with bounded evidence and no commands, environment,
|
|
810
|
+
output, or identity values. Every rc.8 contract is retained.
|
|
811
|
+
|
|
812
|
+
**v0.7.96-rc.8 release:** Eighth release candidate of the v0.7.96 line.
|
|
813
|
+
Custom OpenAI-compatible reasoning is negotiated from `auto`: rejected
|
|
814
|
+
efforts lower through explicit levels without losing disable intent,
|
|
815
|
+
hard-rejection caches span streaming and non-streaming turns, and
|
|
816
|
+
requested/sent effort plus fallback reasons reach SDK hosts while
|
|
817
|
+
`reasoning` and `reasoning_details` replay only to the same endpoint and
|
|
818
|
+
model. Timeout and cancellation errors keep native DOMException semantics,
|
|
819
|
+
nested causes, and redacted stacks across scoped credentials. KodaX's
|
|
820
|
+
default `NODE_ENV` no longer reaches user shell commands, so `npm install`
|
|
821
|
+
and `npm ci` keep devDependencies. Every rc.7 contract is retained.
|
|
822
|
+
|
|
823
|
+
**v0.7.96-rc.7 release:** Seventh release candidate of the v0.7.96 line.
|
|
824
|
+
Successful writes return eligible file outputs over A2A in both coding and
|
|
825
|
+
managed execution, independently of conversation compaction and the memory
|
|
826
|
+
artifact ledger, with existing publication limits and legacy executors
|
|
827
|
+
preserved; HTML/HTM outputs are recognized as `text/html`. Every rc.6
|
|
828
|
+
contract is retained.
|
|
829
|
+
|
|
830
|
+
**v0.7.96-rc.6 release:** Sixth release candidate of the v0.7.96 line.
|
|
831
|
+
Reduces Windows exit delays from unresolved historical Shell records:
|
|
832
|
+
process-tree queries are skipped only when every retained target is
|
|
833
|
+
definitively absent, unknown cleanup outcomes and Run recovery evidence are
|
|
834
|
+
preserved, and the Windows termination process is reused for its first
|
|
835
|
+
post-termination snapshot with exact identity checks and fresh verification
|
|
836
|
+
when cleanup is uncertain. Every rc.5 contract is retained.
|
|
837
|
+
|
|
838
|
+
**v0.7.96-rc.5 release:** Fifth release candidate of the v0.7.96 line,
|
|
839
|
+
fixing Issue 335. Read and MCP image bytes are validated at receipt and
|
|
840
|
+
historical images are prepared at run admission, reused across
|
|
841
|
+
Anthropic/OpenAI requests, retries, and compaction; confirmed corrupt images
|
|
842
|
+
become actionable text while valid bytes, tool status, and original history
|
|
843
|
+
are preserved. `validateImageBytes` ships through the LLM and media SDK, and
|
|
844
|
+
the WASM codec is included in Bun binaries and release archives. Residual
|
|
845
|
+
native request-content errors are diagnosed with one evidence-backed
|
|
846
|
+
text-only request plus one retry. Every rc.4 contract is retained.
|
|
847
|
+
|
|
848
|
+
**v0.7.96-rc.4 release:** Fourth release candidate of the v0.7.96 line,
|
|
849
|
+
fixing Issue 334. New Session event journals initialize at sequence zero
|
|
850
|
+
instead of scanning unrelated Run logs, removing a synchronous startup stall
|
|
851
|
+
that could push concurrent Session history reads past their 15-second
|
|
852
|
+
timeout. Cached sequence floors are epoch-aware, and a missing or corrupt
|
|
853
|
+
sequence file recovers the durable log maximum beyond a stale cross-Runtime
|
|
854
|
+
cache, preventing duplicate event sequences and lost replay progress.
|
|
855
|
+
Startup prewarm serves routing and preturn from the same complete result.
|
|
856
|
+
Every rc.3 contract is retained.
|
|
857
|
+
|
|
858
|
+
**v0.7.96-rc.3 release:** Third release candidate of the v0.7.96 line.
|
|
859
|
+
Aligns the daemon `sessionCancellation` and `toolInvocation` capabilities and
|
|
860
|
+
makes accepted Shell Stops recoverable while process-tree cleanup is unknown:
|
|
861
|
+
cleanup retries target the original Run, recovery references survive owner
|
|
862
|
+
restarts, and shell results keep their cancelled/timeout status and captured
|
|
863
|
+
output with the unconfirmed-cleanup note appended. Every rc.2 contract is
|
|
864
|
+
retained.
|
|
865
|
+
|
|
866
|
+
**v0.7.96-rc.2 release:** Second release candidate of the v0.7.96 line. A
|
|
867
|
+
first Session Stop request bound to an already terminal `expectedRunId` is
|
|
868
|
+
rejected atomically before a new Stop frontier is published — typed
|
|
869
|
+
`code: 'conflict'`, `denialSource: 'stale_run'`, `retryable: false` — so a
|
|
870
|
+
delayed request cannot stop successor Runs. Already accepted requests stay
|
|
871
|
+
replayable, including after Runtime restart. Every rc.1 contract is retained.
|
|
872
|
+
|
|
873
|
+
**v0.7.96-rc.1 release:** First release candidate of the v0.7.96 line.
|
|
874
|
+
Unifies trusted text authority across Runtime Sessions and direct SDK
|
|
875
|
+
entries: Full Access reaches native text transactions through `runKodaX`,
|
|
876
|
+
`runManagedTask`, and each `KodaXClient.send`; auto-approved concrete text
|
|
877
|
+
calls write their exact external target, including portable `tool_call`
|
|
878
|
+
dispatch, without granting a directory or reusing approval across operations
|
|
879
|
+
or Runs; explicit denials and native integrity checks remain enforced.
|
|
880
|
+
Direct and managed provider requests carry live host permission facts,
|
|
881
|
+
refreshed on retries, and runtime permission capability 6 fences older
|
|
882
|
+
daemon authority.
|
|
883
|
+
|
|
787
884
|
**v0.7.96-beta.9 release:** Ships FEATURE_299 — unified Stop, Full Access
|
|
788
885
|
and extension execution contracts. Owned Run controls and atomic Session
|
|
789
886
|
Stop work independently of file locks across direct CLI, SDK, daemon, and
|
|
@@ -860,7 +957,7 @@ requests, preserves structured Child Agent Provider failures, honors exact
|
|
|
860
957
|
run-scoped credential verification, and omits empty `tools` arrays for strict
|
|
861
958
|
vLLM gateways (Issues 329-332). npm publication remains a
|
|
862
959
|
manual maintainer action. See the
|
|
863
|
-
[release checklist](docs/release.md#v0796-
|
|
960
|
+
[release checklist](docs/release.md#v0796-rc9-release-preparation).
|
|
864
961
|
|
|
865
962
|
**v0.7.96-alpha.3 release:** Provider credentials are lazy, scoped,
|
|
866
963
|
revocable capabilities (ADR-068). The v2 credential broker keeps Provider
|
package/README_CN.md
CHANGED
|
@@ -296,6 +296,74 @@ SDK 系统代码契约更新,但没有放宽 shell/sandbox 的 fail-closed 边
|
|
|
296
296
|
`handleRuntimePermissionRequest()` 管理 SDK 权限 UI,并在 prepared Session 尾部遇到
|
|
297
297
|
`data_changed` 时通过权威 delta 合并恢复;后台持久化失败会显示为诊断,不再静默丢失。
|
|
298
298
|
|
|
299
|
+
**v0.7.96-rc.10 发布**:v0.7.96 线第十个发布候选。Runtime 关闭时拥有并
|
|
300
|
+
排空自己启动的后台工作:托管终端维护与内存 setup/finalization IO 及后台
|
|
301
|
+
review 排空都注册到所属 Runtime,close 拒绝新工作并等待已开始的工作完成后
|
|
302
|
+
才释放资源,托管执行在发布完成前先落地持久内存 finalization。当工作区根
|
|
303
|
+
包含受保护原生状态时,Edits 模式的 `edit`/`write` 不再拒绝普通项目文件:
|
|
304
|
+
受信文本事务的缓存保护只针对授权的规范化目标文件,而开发工件信任仍检查
|
|
305
|
+
全部授权可写根。所有 rc.9 契约全部保留。
|
|
306
|
+
|
|
307
|
+
**v0.7.96-rc.9 发布**:v0.7.96 线第九个发布候选。以一次性启动交接仲裁
|
|
308
|
+
daemon 发布与 launcher 失联:未发布的 Windows daemon 启动树及其 Job 后代被
|
|
309
|
+
回收,已发布的共享服务不受影响(Issue 337)。Windows daemon 状态替换在有界
|
|
310
|
+
失败预算下只对竞争性 EPERM 重试,原子发布同一份已 flush 状态,并发 JSON
|
|
311
|
+
读取者不再破坏替换(Issue 338)。Windows Runtime 身份探测通过
|
|
312
|
+
`setKodaXDiagnosticSink` 输出结构化生命周期诊断,证据有界且不含命令、环境
|
|
313
|
+
变量、输出或身份值。所有 rc.8 契约全部保留。
|
|
314
|
+
|
|
315
|
+
**v0.7.96-rc.8 发布**:v0.7.96 线第八个发布候选。自定义 OpenAI 兼容推理从
|
|
316
|
+
`auto` 开始协商:被拒绝的 effort 沿显式档位降级且不丢失显式禁用意图,硬拒绝
|
|
317
|
+
缓存跨流式与非流式回合复用,请求/实际发送的 effort 与回退原因上报给 SDK 宿主,
|
|
318
|
+
`reasoning` 与结构化 `reasoning_details` 只向同一 endpoint 与模型重放。超时与
|
|
319
|
+
取消错误跨受限 Provider 凭据保持原生 DOMException 语义、嵌套原因与脱敏栈。
|
|
320
|
+
KodaX 默认 `NODE_ENV` 不再进入用户 shell 命令,`npm install` 与 `npm ci`
|
|
321
|
+
不再隐式省略 devDependencies。所有 rc.7 契约全部保留。
|
|
322
|
+
|
|
323
|
+
**v0.7.96-rc.7 发布**:v0.7.96 线第七个发布候选。成功的写入在 coding 与
|
|
324
|
+
managed 两条执行路径上都通过 A2A 返回符合条件的文件输出,不再依赖对话压缩
|
|
325
|
+
与 memory 工件台账;既有发布限制与 legacy executor 全部保留,HTML/HTM 输出
|
|
326
|
+
识别为 `text/html`。所有 rc.6 契约全部保留。
|
|
327
|
+
|
|
328
|
+
**v0.7.96-rc.6 发布**:v0.7.96 线第六个发布候选。降低未决历史 Shell 记录
|
|
329
|
+
导致的 Windows 退出延迟:仅当所有保留目标都确定不存在时才跳过进程树查询,
|
|
330
|
+
未知的清理结果与 Run 恢复证据全部保留;Windows 终止进程复用于首次终止后
|
|
331
|
+
快照,清理不确定时保留精确的进程身份校验、全新验证与重试。所有 rc.5 契约
|
|
332
|
+
全部保留。
|
|
333
|
+
|
|
334
|
+
**v0.7.96-rc.5 发布**:v0.7.96 线第五个发布候选,修复 Issue 335。`read` 与
|
|
335
|
+
MCP 图片字节在接收时校验,历史图片在 Run 准入时准备,跨 Anthropic/OpenAI
|
|
336
|
+
请求、重试与压缩复用;确认损坏的图片替换为可执行的文字说明,正常图片字节、
|
|
337
|
+
工具状态与原始历史全部保留。`validateImageBytes` 通过 LLM 与 media SDK 暴露,
|
|
338
|
+
WASM 解码器随 Bun 二进制与发布归档附带。残留的原生请求内容错误用一次
|
|
339
|
+
有证据支撑的纯文本请求加一次重试进行诊断。所有 rc.4 契约全部保留。
|
|
340
|
+
|
|
341
|
+
**v0.7.96-rc.4 发布**:v0.7.96 线第四个发布候选,修复 Issue 334。新建
|
|
342
|
+
Session 事件日志从序列零初始化,不再扫描无关的 Run 日志——消除可能把并发
|
|
343
|
+
Session 历史读取拖过 15 秒超时的同步启动停顿。缓存序列下限按 journal epoch
|
|
344
|
+
绑定;序列文件缺失或损坏时,即使另一个 Runtime 留下了更旧的缓存下限,也会
|
|
345
|
+
恢复持久日志最大值,避免重复事件序列与丢失重放进度。启动预热让路由与
|
|
346
|
+
preturn 共用同一完整结果。所有 rc.3 契约全部保留。
|
|
347
|
+
|
|
348
|
+
**v0.7.96-rc.3 发布**:v0.7.96 线第三个发布候选。对齐 daemon 的
|
|
349
|
+
`sessionCancellation` 与 `toolInvocation` capability,并让已受理的 Shell Stop
|
|
350
|
+
在进程树清理未知时保持可恢复:清理重试仍针对原 Run,恢复引用跨宿主重启保留,
|
|
351
|
+
shell 结果保留其取消/超时状态与已捕获输出,未确认清理说明以附加形式呈现。
|
|
352
|
+
所有 rc.2 契约全部保留。
|
|
353
|
+
|
|
354
|
+
**v0.7.96-rc.2 发布**:v0.7.96 线第二个发布候选。绑定到已终态 `expectedRunId`
|
|
355
|
+
的首次 Session Stop 请求会在发布新 Stop frontier 之前被原子拒绝——类型为
|
|
356
|
+
`code: 'conflict'`、`denialSource: 'stale_run'`、`retryable: false`——迟到的
|
|
357
|
+
请求因此无法停止后继 Run。已受理的请求保持可重放,包括 Runtime 重启之后。
|
|
358
|
+
所有 rc.1 契约全部保留。
|
|
359
|
+
|
|
360
|
+
**v0.7.96-rc.1 发布**:v0.7.96 线首个发布候选。统一 Runtime Session 与直接
|
|
361
|
+
SDK 入口的可信文本授权:Full Access 通过 `runKodaX`、`runManagedTask` 与每个
|
|
362
|
+
`KodaXClient.send` 覆盖原生文本事务;自动批准的具体文本调用可写入其确切外部
|
|
363
|
+
目标(包括可移植的 `tool_call` 分发),但不授予目录权限,也不会跨操作或跨 Run
|
|
364
|
+
复用批准;显式拒绝与原生完整性校验继续生效。直接与托管 provider 请求携带实时
|
|
365
|
+
宿主权限事实并在重试时刷新,runtime 权限 capability 6 阻止旧 daemon 提供该授权。
|
|
366
|
+
|
|
299
367
|
**v0.7.96-beta.9 发布**:交付 FEATURE_299——统一 Stop、Full Access 与扩展
|
|
300
368
|
执行契约。owned Run 控制与原子 Session Stop 不依赖文件锁,跨直接 CLI、SDK、
|
|
301
369
|
daemon 与 ACP 宿主在单一"受理 vs 确认"Stop 契约下工作。Full Access 直接在
|
|
@@ -369,8 +437,7 @@ native 文本权威改在摘要固定的 `manylinux_2_28` 构建器中编译,
|
|
|
369
437
|
scope 在 SDK、Agent 摘要、CLI 与 Runtime Worker 请求间共享,保留结构化的 Child Agent Provider
|
|
370
438
|
失败信息,精确遵循 run-scoped 凭据校验,并为严格 vLLM 网关省略空 `tools` 数组(Issues 329-332)。
|
|
371
439
|
npm 发布仍由
|
|
372
|
-
|
|
373
|
-
维护者手动执行。详见 [v0.7.96-beta.9 发布清单](docs/release.md#v0796-beta9-release-preparation)。
|
|
440
|
+
维护者手动执行。详见 [v0.7.96-rc.10 发布清单](docs/release.md#v0796-rc10-release-preparation)。
|
|
374
441
|
|
|
375
442
|
**v0.7.96-alpha.3 发布**:Provider 凭据成为惰性、受限、可撤销的能力(ADR-068)。v2
|
|
376
443
|
credential broker 将 Provider 密钥保留在 OS keychain,按每次 wire call、为单一封闭
|
|
@@ -841,6 +908,8 @@ import { createMemoryAgent } from '@kodax-ai/kodax/experimental-memory'; // opt-
|
|
|
841
908
|
|
|
842
909
|
自定义 reasoning 模型优先使用 v0.7.57 的 `reasoning: { efforts, default }`;无 thinking 能力的模型使用 `"reasoning": "none"`。SDK 宿主的 effort 选择器应从 `reasoningProfile.supportedEfforts` / `defaultEffort` 动态生成,不要假定固定五档。
|
|
843
910
|
|
|
911
|
+
OpenAI-compatible provider 未声明 reasoning profile 表示能力未知。未设置 effort 时使用 `auto`:优先采用已声明默认档,否则从 `max` 开始,仅在明确的参数/档位拒绝后逐档降低。`none` 会尝试关闭;关闭被拒绝后尝试最低可用思考档。SDK 宿主通过 `onReasoningResolved` 收到用户意图、实际发送档位、回退原因和 `verified: false`;请求成功不代表模型已按该强度执行。缓存和推理数据回传规则见[详细设计](docs/DD.md#23-custom-openai-compatible-reasoning)。
|
|
912
|
+
|
|
844
913
|
#### OpenAI 兼容推理模型
|
|
845
914
|
|
|
846
915
|
部分 OpenAI-compatible 推理模型要求多轮请求时回放上一轮 assistant 的 `reasoning_content`。DeepSeek V4 thinking mode 是已知必须开启的场景;内置 DeepSeek provider 已经默认开启,但自定义 provider 需要显式配置:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{
|
|
2
|
+
import{Ab as k,Qa as g,Sa as h,a as c,la as d,ma as e,na as f,rb as i,sb as j}from"./chunk-54LYU5IB.js";import"./chunk-756FJMN2.js";import"./chunk-67FTLDKF.js";import"./chunk-5MKGSX3I.js";import"./chunk-DTO7YOGG.js";import{Pb as a,Qb as b}from"./chunk-5DJN3YKJ.js";import"./chunk-WHQCTZKI.js";import"./chunk-W5XGIRQQ.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
+
import{Ma as a,Na as b}from"./chunk-UYRXWZL3.js";import"./chunk-NCNPYSVW.js";import"./chunk-NDYG5DGT.js";import"./chunk-BNQSGCFN.js";import"./chunk-NGD36O5G.js";import"./chunk-JMCQ6GNW.js";import"./chunk-54LYU5IB.js";import"./chunk-756FJMN2.js";import"./chunk-67FTLDKF.js";import"./chunk-5MKGSX3I.js";import"./chunk-DTO7YOGG.js";import"./chunk-5DJN3YKJ.js";import"./chunk-WHQCTZKI.js";import"./chunk-W5XGIRQQ.js";import"./chunk-ONUPGMER.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
+
import{g,i as x,j as v}from"./chunk-UBMU25PI.js";import{c as T}from"./chunk-67FTLDKF.js";import{a as d}from"./chunk-ONUPGMER.js";import u from"node:fs";import{createHash as C}from"node:crypto";import{createRequire as O}from"node:module";import l from"node:path";var h=5;var E=O(import.meta.url),S=3e4,f;function P(t,o){let e=t.replaceAll("/","\\"),a=e.toLowerCase(),r=e.slice(3),c=(r===""?[]:r.split("\\")).some(n=>{let i=n.split(".",1)[0].toUpperCase(),p=["CON","PRN","AUX","NUL","CONIN$","CONOUT$"].includes(i)||/^(?:COM|LPT)[1-9¹²³]$/.test(i);return n===""||n==="."||n===".."||n.endsWith(".")||n.endsWith(" ")||/[\u0000-\u001f<>"|?*]/.test(n)||/~[0-9¹²³]/.test(n)||p});if(t.includes("\0")||e.startsWith("\\\\")||a.startsWith("\\??\\")||a.startsWith("\\device\\")||a.startsWith("\\global??\\")||a.startsWith("globalroot\\")||!/^[A-Za-z]:\\/.test(e)||e.slice(2).includes(":")||c)throw new T({code:"text_mutation_unsafe_path",path:t,message:`Trusted text mutation ${o} must use a local drive-absolute path; UNC and device namespaces are denied: ${t}`})}d(P,"assertLocalDriveAbsolutePath");function m(t,o){if(process.platform==="win32"){P(t,o);return}if(t.includes("\0")||!l.isAbsolute(t)||t.startsWith("//"))throw new T({code:"text_mutation_unsafe_path",path:t,message:`Trusted text mutation ${o} must use a local absolute path: ${t}`})}d(m,"assertSupportedAbsolutePath");function y(t,o){let e=l.relative(t,o);return e===""||!e.startsWith("..")&&!l.isAbsolute(e)}d(y,"sameOrInside");function A(t){let o=new Map;for(let e of t){let a=l.resolve(e),r=process.platform==="win32"?a.toLowerCase():a;o.has(r)||o.set(r,a)}return[...o.values()].sort((e,a)=>a.length-e.length)}d(A,"normalizedRootCandidates");function w(t,o,e=!1){m(t,"target");for(let n of o)m(n,"write root");let a=l.resolve(t),r=[...A(o)];if(e){let n=l.dirname(a);for(;!u.existsSync(n);){let i=l.dirname(n);if(i===n)break;n=i}r.unshift(n)}let s=r.find(n=>n!==a&&y(n,a)),c=d(n=>{try{if(!u.lstatSync(n).isDirectory())throw new Error("write root is not a directory");return u.realpathSync.native(n)}catch(i){throw new T({code:"text_mutation_unsafe_path",path:t,message:`Trusted text mutation write root is unavailable: ${n}`,cause:i})}},"canonicalizeRoot");if(s!==void 0){let n=c(s);return{canonicalRoot:n,canonicalTarget:l.join(n,l.relative(s,a))}}for(let n of r){let i=c(n);if(i!==a&&y(i,a))return{canonicalRoot:i,canonicalTarget:a}}throw new T({code:"text_mutation_policy_denied",path:t,message:`Trusted text mutation target is outside the Runtime write roots: ${t}`})}d(w,"authorizeTarget");function _(t,o=t){if(g(t),f!==void 0)return f;let e=v(import.meta.url,h,t,o),a=K(e);return f=X(a),f}d(_,"loadNativeBinding");function X(t){if(typeof t.textTransactionProtocol!="function"||typeof t.TrustedTextTransactionRoot!="function"||t.textTransactionProtocol()!==h)throw new Error(`The KodaX trusted text transaction binding must implement protocol ${h}.`);return t}d(X,"validateNativeBinding");function K(t){if(process.platform==="win32")return E(t);let o=u.openSync(t,u.constants.O_RDONLY|u.constants.O_NOFOLLOW);try{let e=u.fstatSync(o);if(!e.isFile()||e.nlink!==1||e.size>64*1024*1024)throw new Error("The protected native text binding has an unsafe identity.");let a=l.basename(l.dirname(t)).toLowerCase(),r=u.readFileSync(o),s=C("sha256").update(r).digest("hex");if(!/^[0-9a-f]{64}$/.test(a)||s!==a)throw new Error("The protected native text binding changed after provisioning.");let c={exports:{}},n=process.platform==="linux"?`/proc/self/fd/${o}`:`/dev/fd/${o}`;return process.dlopen(c,n),c.exports}finally{u.closeSync(o)}}d(K,"loadNativeBindingFile");function N(t,o,e){return process.platform==="win32"?new t.TrustedTextTransactionRoot(o,void 0,e):new t.TrustedTextTransactionRoot(o,x(),e)}d(N,"createNativeRoot");function k(t){switch(t){case"invalid_path":case"reparse_point":case"hard_link":return"text_mutation_unsafe_path";case"unauthorized_path":return"text_mutation_policy_denied";case"remote_filesystem":case"unsupported_filesystem":case"unsupported_platform":return"text_mutation_unsupported_filesystem";case"contended":return"text_mutation_contended";case"stale":return"text_mutation_stale";case"metadata_preservation":return"text_mutation_metadata_preservation_failed";default:return"text_mutation_io_failed"}}d(k,"mappedNativeErrorCode");function R(t,o){if(o instanceof T)throw o;let e=o instanceof Error?o.message:String(o),a="KODAX_TEXT_TRANSACTION:",r=e.indexOf(a),s={};if(r>=0)try{let c=JSON.parse(e.slice(r+a.length));c!==null&&typeof c=="object"&&!Array.isArray(c)&&(s=c)}catch{s={}}throw new T({code:k(s.code),path:t,message:s.message??e,...typeof s.os_code=="number"?{osCode:s.os_code}:{},cause:o})}d(R,"translateNativeError");function B(t){return{state:t.state,content:t.content,revision:t.revision,slot:t.slotId,canonicalPath:t.canonicalPath}}d(B,"publicSnapshot");function L(t,o,e){if(e.status==="stale"){if(typeof e.currentRevision!="string")throw new Error("Native text transaction returned a stale result without a revision.");return{status:"stale",currentRevision:e.currentRevision}}if(typeof e.slotId!="string"||typeof e.preContent!="string"||typeof e.preRevision!="string"||typeof e.postRevision!="string")throw new Error("Native text transaction returned an incomplete commit receipt.");let a={before:{state:e.preRevision.startsWith("missing:")?"missing":"present",content:e.preContent,revision:e.preRevision,slot:e.slotId,canonicalPath:t},after:{state:"present",content:o,revision:e.postRevision,slot:e.slotId,canonicalPath:t},recoveredAbandonedLock:e.abandonedLock===!0};if(e.status==="committed_uncertain"){if(typeof e.message!="string"||e.message==="")throw new Error("Native text transaction returned an uncertain commit without a reason.");return{status:"committed_uncertain",...a,reason:e.message}}return{status:"written",...a}}d(L,"requireWrittenOutcome");function F(t,o,e=()=>!1,a){return{async snapshot(r){if(r.signal?.aborted)throw r.signal.reason;m(r.path,"target");let s=e(),c=a?.(r.toolCall,r.path,"snapshot")===!0,n=w(r.path,t(),s||c);o(n.canonicalTarget),g([n.canonicalTarget]);try{let i=_([n.canonicalTarget],t()),p=N(i,n.canonicalRoot,s);return B(await p.snapshot(n.canonicalTarget))}catch(i){R(n.canonicalTarget,i)}},async commit(r){if(r.signal?.aborted)throw r.signal.reason;m(r.path,"target");let s=e(),c=a?.(r.toolCall,r.path,"commit")===!0,n=w(r.path,t(),s||c);o(n.canonicalTarget),g([n.canonicalTarget]);try{let i=_([n.canonicalTarget],t()),b=await N(i,n.canonicalRoot,s).commit(n.canonicalTarget,r.expectedRevision,r.content,r.createParentDirectories,S);return L(n.canonicalTarget,r.content,b)}catch(i){R(n.canonicalTarget,i)}}}}d(F,"createTrustedTextMutationHost");import W from"node:path";import{isDeepStrictEqual as I}from"node:util";var $=new Set(["write","edit","multi_edit","insert_after_anchor"]);function Z(t,o){let e=new Map,a=d(r=>{let s=W.resolve(t,r);return process.platform==="win32"?s.toLowerCase():s},"normalize");return{grant(r){!o()||!$.has(r.name)||typeof r.input.path!="string"||e.set(r.id,{call:structuredClone(r),target:a(r.input.path),phase:"snapshot"})},authorize(r,s,c){if(!o())return e.clear(),!1;let n=r===void 0?void 0:e.get(r.id);return!n||n.phase!==c||a(s)!==n.target||!I(r,n.call)?!1:(c==="snapshot"?n.phase="commit":e.delete(n.call.id),!0)},revoke(r){e.delete(r)},clear(){e.clear()}}}d(Z,"createTrustedTextApprovals");export{F as a,Z as b};
|