stitchkit 0.106.1 → 0.108.0
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 +151 -0
- package/README.md +2 -0
- package/darwin-native.cjs +17 -4
- package/dist/agent-runtime/deferred-tool-types.d.ts +6 -27
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
- package/dist/browser/stream.d.ts +38 -12
- package/dist/browser/stream.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/browser.js +2 -3
- package/dist/entrypoints/agent-runtime/coding-tools.js +6 -8
- package/dist/entrypoints/agent-runtime/harness.js +7 -11
- package/dist/entrypoints/agent-runtime/realtime.js +2 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +6 -8
- package/dist/entrypoints/agent-runtime.d.ts +2 -1
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +20 -23
- package/dist/entrypoints/application/diagnostic-journal.js +3 -3
- package/dist/entrypoints/application/directory-inbox.js +8 -9
- package/dist/entrypoints/application/grammy.js +3 -3
- package/dist/entrypoints/application.js +7 -8
- package/dist/entrypoints/bin/upgrade-cli.d.ts +32 -0
- package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -1
- package/dist/entrypoints/bin/upgrade-cli.js +451 -8
- package/dist/entrypoints/cli/publish.js +10 -11
- package/dist/entrypoints/cli.js +12 -16
- package/dist/entrypoints/contract.js +1 -1
- package/dist/entrypoints/files/packaging.d.ts +3 -1
- package/dist/entrypoints/files/packaging.d.ts.map +1 -1
- package/dist/entrypoints/files/packaging.js +171 -55
- package/dist/entrypoints/files.js +16 -16
- package/dist/entrypoints/index.d.ts +1 -1
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +47 -41
- package/dist/entrypoints/node.js +27 -29
- package/dist/entrypoints/observability.js +10 -12
- package/dist/entrypoints/process.js +2 -2
- package/dist/entrypoints/react.js +3 -4
- package/dist/entrypoints/remote.js +8 -9
- package/dist/entrypoints/server.js +48 -51
- package/dist/entrypoints/telegram/html.js +3 -3
- package/dist/entrypoints/telegram/screens.js +6 -6
- package/dist/entrypoints/telegram.d.ts +2 -0
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +344 -11
- package/dist/entrypoints/testing.d.ts +1 -0
- package/dist/entrypoints/testing.d.ts.map +1 -1
- package/dist/entrypoints/testing.js +138 -11
- package/dist/entrypoints/tools/connections.js +11 -11
- package/dist/entrypoints/tools/invoker.js +5 -9
- package/dist/entrypoints/tools/mcp.js +8 -14
- package/dist/entrypoints/tools.js +19 -25
- package/dist/entrypoints/tracking.js +3 -3
- package/dist/files/native-artifact.d.ts +14 -0
- package/dist/files/native-artifact.d.ts.map +1 -0
- package/dist/files/native-packaging-layout.d.ts +11 -2
- package/dist/files/native-packaging-layout.d.ts.map +1 -1
- package/dist/files/native-packaging-plugin.d.ts +53 -0
- package/dist/files/native-packaging-plugin.d.ts.map +1 -0
- package/dist/files/native-packaging.d.ts +44 -43
- package/dist/files/native-packaging.d.ts.map +1 -1
- package/dist/{index-v5ee8ath.js → index-1h2zv8rx.js} +10 -40
- package/dist/index-2kbysk9s.js +42 -0
- package/dist/{index-wbhdzxar.js → index-2s6fpehp.js} +5 -5
- package/dist/{index-ksfagmyz.js → index-4qh90tyw.js} +8 -8
- package/dist/{index-yvfk3y36.js → index-636mggad.js} +4 -3
- package/dist/{index-f199nfq5.js → index-6y9t2fwz.js} +7 -7
- package/dist/{index-w8etpm8j.js → index-9j2atjte.js} +1 -1
- package/dist/index-a5qr2rj6.js +26 -0
- package/dist/{index-azx12jgv.js → index-bh2ht9y5.js} +13 -7
- package/dist/{index-pz3y6b6g.js → index-cx2nh595.js} +3 -3
- package/dist/{index-2k91mewf.js → index-dm2fv45z.js} +9 -9
- package/dist/{index-9bskshe3.js → index-dwf0gymy.js} +10 -10
- package/dist/{index-qaqbdm7s.js → index-h7qms8f9.js} +8 -8
- package/dist/{index-drs41arz.js → index-ktjmgq9p.js} +1 -1
- package/dist/{index-916yh4e2.js → index-mep4sb48.js} +14 -14
- package/dist/{index-wdy68sh6.js → index-njs9gvrh.js} +17 -17
- package/dist/{index-1ptj98e0.js → index-nx49x0tw.js} +2 -2
- package/dist/{index-1pwwan01.js → index-p5kx5vqd.js} +214 -59
- package/dist/{index-sj28htvf.js → index-pvh3z03x.js} +1 -1
- package/dist/{index-r393tnfp.js → index-q6crhe1n.js} +4 -4
- package/dist/{index-dsnjzb62.js → index-t2bsd0hm.js} +1 -1
- package/dist/{index-4vsby8n8.js → index-w9mqgnz9.js} +1 -1
- package/dist/{index-z23rfxhj.js → index-xmgjtkvr.js} +1 -1
- package/dist/{index-e05cjgtf.js → index-xvj9h8yh.js} +28 -1
- package/dist/{index-gr5g3xfw.js → index-yz8x0hbx.js} +1 -1
- package/dist/{index-gxm9rc97.js → index-zrtrjkbf.js} +1 -1
- package/dist/internal/bounded-lines.d.ts +46 -2
- package/dist/internal/bounded-lines.d.ts.map +1 -1
- package/dist/internal/darwin-binding-error.d.ts +9 -1
- package/dist/internal/darwin-binding-error.d.ts.map +1 -1
- package/dist/internal/darwin-binding.d.ts.map +1 -1
- package/dist/internal/process-identity.d.ts.map +1 -1
- package/dist/internal/until-aborted.d.ts +9 -0
- package/dist/internal/until-aborted.d.ts.map +1 -0
- package/dist/internal/upgrade-affects.d.ts +58 -0
- package/dist/internal/upgrade-affects.d.ts.map +1 -0
- package/dist/internal/upgrade-plan.d.ts +20 -0
- package/dist/internal/upgrade-plan.d.ts.map +1 -1
- package/dist/internal/upgrade-usage.d.ts +61 -0
- package/dist/internal/upgrade-usage.d.ts.map +1 -0
- package/dist/telegram/bot-api.d.ts +10 -4
- package/dist/telegram/bot-api.d.ts.map +1 -1
- package/dist/telegram/broadcast.d.ts +2 -1
- package/dist/telegram/broadcast.d.ts.map +1 -1
- package/dist/telegram/not-dispatched.d.ts +26 -0
- package/dist/telegram/not-dispatched.d.ts.map +1 -0
- package/dist/telegram/operator-channel.d.ts +2 -1
- package/dist/telegram/operator-channel.d.ts.map +1 -1
- package/dist/telegram/send-failure.d.ts +4 -3
- package/dist/telegram/send-failure.d.ts.map +1 -1
- package/dist/telegram/transport-connect.d.ts +38 -0
- package/dist/telegram/transport-connect.d.ts.map +1 -0
- package/dist/telegram/transport.d.ts +43 -0
- package/dist/telegram/transport.d.ts.map +1 -0
- package/dist/telegram/webhook.d.ts +2 -1
- package/dist/telegram/webhook.d.ts.map +1 -1
- package/dist/testing/manual-clock.d.ts +82 -0
- package/dist/testing/manual-clock.d.ts.map +1 -0
- package/dist/tools/internal/surface-projector.d.ts +0 -7
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/runtime-tool-declaration.d.ts +11 -0
- package/dist/tools/runtime-tool-declaration.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +2 -3
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/llms/files-packaging.txt +13 -6
- package/llms/process.txt +71 -15
- package/llms/stitchkit.2.txt +211 -628
- package/llms/stitchkit.txt +635 -10
- package/llms/telegram.txt +36 -3
- package/llms/testing.txt +47 -0
- package/llms/{upgrading-0.96.0-0.106.0.txt → upgrading-0.100.0-0.108.0.txt} +112 -144
- package/llms/{upgrading-0.37.0-0.53.0.txt → upgrading-0.37.0-0.58.0.txt} +209 -3
- package/llms/{upgrading-0.55.0-0.68.0.txt → upgrading-0.59.0-0.71.0.txt} +149 -209
- package/llms/{upgrading-0.69.0-0.95.0.txt → upgrading-0.72.0-0.99.0.txt} +137 -149
- package/llms/upgrading.txt +36 -4
- package/llms-full.txt +360 -39
- package/llms.txt +10 -10
- package/package.json +2 -1
- package/llms/stitchkit.3.txt +0 -177
- package/dist/{index-cazts87s.js → index-07dcf2yn.js} +3 -3
- package/dist/{index-n1nszyk0.js → index-7jvwrjqa.js} +3 -3
- package/dist/{index-cmzvhhtd.js → index-85qve8mq.js} +3 -3
- package/dist/{index-rpzewktb.js → index-fynr93w4.js} +3 -3
- package/dist/{index-37asdw3a.js → index-k7qdkh3n.js} +3 -3
- package/dist/{index-x7w1z6pf.js → index-q4hjtyye.js} +4 -4
- package/dist/{index-7n68nmc6.js → index-y3nemndz.js} +3 -3
- package/dist/{index-12zsej7b.js → index-y70v24cw.js} +3 -3
- package/dist/{index-pzb63z66.js → index-ykdcnq1f.js} +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,131 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
|
|
|
15
15
|
|
|
16
16
|
## [Unreleased]
|
|
17
17
|
|
|
18
|
+
## [0.108.0] - 2026-10-06
|
|
19
|
+
|
|
20
|
+
### ⚠️ Breaking changes
|
|
21
|
+
|
|
22
|
+
**Who must act:** code with an exhaustive `switch` or `Record` over `TelegramSendFailureReason` or
|
|
23
|
+
`TelegramSendFailure['evidence']`; builds whose entry imports a `stitchkit` installation other
|
|
24
|
+
than the one their native packaging plugin came from.
|
|
25
|
+
|
|
26
|
+
- `stitchkit/telegram` — **a request that never left is its own send outcome.**
|
|
27
|
+
`TelegramSendFailureReason` gains `not-dispatched` (retryable, recipient reachable) and
|
|
28
|
+
`TelegramSendFailure.evidence` gains `transport`: `classifyTelegramSendFailure` returns them for a
|
|
29
|
+
`TelegramNotDispatchedError` anywhere in the cause chain, so a broadcast retries such a send as
|
|
30
|
+
`transient` and the operator channel sends it again, where both used to give it up as unknown.
|
|
31
|
+
`// before: const code: Record<TelegramSendFailureReason, string> = { …, unknown: 'E_UNKNOWN' }`
|
|
32
|
+
→ `// after: const code: Record<TelegramSendFailureReason, string> = { …, 'not-dispatched': 'E_NOT_SENT', unknown: 'E_UNKNOWN' }`
|
|
33
|
+
**Who must act:** exhaustive code over the reasons or the evidence. See
|
|
34
|
+
[migration](docs/guide/upgrading.md#a-request-that-never-left-is-its-own-send-outcome). → ADR 0253
|
|
35
|
+
**Affects:** `stitchkit/telegram` TelegramSendFailureReason, TelegramSendFailure(evidence), TELEGRAM_SEND_FAILURE_REASONS, classifyTelegramSendFailure(reason)
|
|
36
|
+
- `stitchkit/files/packaging` — **a packaging plugin fails a build that carries another
|
|
37
|
+
installation's loader.** The plugin packages only the default Darwin loader of the `stitchkit` it
|
|
38
|
+
was created from; an entry that imports another installation (another version, or the same
|
|
39
|
+
version under another path, as when a build tool brings its own copy) used to build, ship that
|
|
40
|
+
installation's default loader and refuse the addon on macOS at run time. The build now fails with
|
|
41
|
+
an error naming both versions and roots.
|
|
42
|
+
`// before: Bun.build({ plugins: [toolCopy.createNativePackaging(…).plugin] }) // entry imports another stitchkit`
|
|
43
|
+
→ `// after: Bun.build({ plugins: [entryCopy.createNativePackaging(…).plugin] })`
|
|
44
|
+
**Who must act:** builds that take the plugin from a `stitchkit` the entry does not import. See
|
|
45
|
+
[migration](docs/guide/upgrading.md#a-packaging-plugin-packages-only-its-own-installation). → ADR 0254
|
|
46
|
+
**Affects:** `stitchkit/files/packaging` createNativePackaging(plugin)
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- `stitchkit/telegram` — `createTelegramBotTransport()`, a `fetch` for the Bot API senders that
|
|
51
|
+
connects before it writes: a failure before the first byte is `TelegramNotDispatchedError`
|
|
52
|
+
(`stage`: `lookup`, `connect`, `request`), any later one stays unknown. Addresses race in the
|
|
53
|
+
resolver's order (Happy Eyeballs); the lookup, the connection rounds, the answer's time and its size are bounded.
|
|
54
|
+
The senders' `fetch` option is now typed `TelegramFetch` (`(url, init) => Promise<Response>`), which
|
|
55
|
+
the global `fetch` still satisfies. → ADR 0253
|
|
56
|
+
- `stitchkit` — `parseNDJSON` and `parseSSE` read any byte source: a `Response`, a
|
|
57
|
+
`ReadableStream<Uint8Array>` (a Bun child's `stdout`) or an `AsyncIterable<Uint8Array>` (a Node
|
|
58
|
+
child's `stdout`), with `signal` cancelling the source. `createNDJSONDecoder` drives the same
|
|
59
|
+
bounded reader by `push(chunk)` / `end()` for a socket's `data` callback. A line past
|
|
60
|
+
`maxLineBytes` throws `StreamLineLimitError` (`limitBytes`, `lineBytes`) at the chunk that crossed
|
|
61
|
+
the limit, so memory stays bounded; a source ended inside a line under `finalLine:
|
|
62
|
+
'require-newline'` throws `StreamTruncatedLineError`. They extend the `RangeError` and `SyntaxError`
|
|
63
|
+
thrown before, so `instanceof` still holds; their `name` is now the class name and their message
|
|
64
|
+
ends with the bytes seen. A decoder stops at
|
|
65
|
+
its first error, and an abort rejects with the signal's reason even when `onParseError` is set.
|
|
66
|
+
- `stitchkit/files/packaging` — `inspectNativeArtifact(bytes)` classifies a built artifact as
|
|
67
|
+
`packaged`, `unpackaged` or `no-loader` by a marker every generated loader now carries
|
|
68
|
+
(`module.exports.stitchkitNativeLoader`), in latin1 and UTF-16LE. It replaces the documented search
|
|
69
|
+
for `STITCHKIT_NATIVE_NOT_PACKAGED`, which every bundle with a lock carries as an error code and so
|
|
70
|
+
refused correct builds. → ADR 0254
|
|
71
|
+
- `stitchkit upgrade` — every breaking item from 0.104.0 carries an `**Affects:**` line naming its
|
|
72
|
+
entrypoints and exports (or `behaviour`), and `release:check` refuses a breaking item without it.
|
|
73
|
+
The CLI reads the project's imports (`--cwd`, default `.`) and gives each item a verdict:
|
|
74
|
+
`affects this project` with `path:line`, `not used here`, `behavioural — check by hand` with the
|
|
75
|
+
importing files, or `not declared — check by hand` for older items; `--json` prints the verdicts.
|
|
76
|
+
- `stitchkit/testing` — `createManualClock()`: manual time for schedules, retries and deadlines. Due
|
|
77
|
+
timers fire in deadline order with real event-loop yields between them, so `advance(10_000)` does
|
|
78
|
+
not skip a retry armed at the fifth second; `hold` keeps time still while real work of unknown
|
|
79
|
+
length runs and fails naming it past `holdLimitMs`; `until` moves deadline to deadline; one move
|
|
80
|
+
runs at a time. It is the
|
|
81
|
+
clock of `createManagedSchedule`, a durable sleep, a revision signal and bounded admission.
|
|
82
|
+
|
|
83
|
+
### Fixed
|
|
84
|
+
|
|
85
|
+
- `stitchkit/server`, `stitchkit/process`, `stitchkit/files` — loading these leaves no longer calls
|
|
86
|
+
a Node API: process identity built its command runner with `promisify(execFile)` at module scope,
|
|
87
|
+
so a browser bundle that reached the server leaf for an error class (where `node:util` is an empty
|
|
88
|
+
module) threw `promisify is not a function` while loading, although nothing called it.
|
|
89
|
+
|
|
90
|
+
## [0.107.0] - 2026-10-06
|
|
91
|
+
|
|
92
|
+
### ⚠️ Breaking changes
|
|
93
|
+
|
|
94
|
+
**Who must act:** builds that call `createNativePackaging` with `delivery: 'embedded'`; also rebuild
|
|
95
|
+
any artifact made without the packaging plugin by 0.105.0–0.106.1.
|
|
96
|
+
|
|
97
|
+
- `stitchkit/files/packaging` — **embedded delivery names no output paths.** A standalone executable
|
|
98
|
+
carries the Darwin addon inside itself, so `createNativePackaging({ delivery: 'embedded' })` takes
|
|
99
|
+
only `platform` and `architecture`; `entryPath` and `assetPath` changed nothing in the executable
|
|
100
|
+
and are now refused by the type and the schema. The ready result types its addon as
|
|
101
|
+
`NativePackagingEmbeddedAsset` (`bytes`, `size`, `sha256`, no `outputPath`), with
|
|
102
|
+
`NativePackagingEmbeddedOptions` and `NativePackagingEmbeddedResult` beside it. Companion
|
|
103
|
+
delivery is unchanged.
|
|
104
|
+
`// before: createNativePackaging({ platform: 'darwin', architecture: 'arm64', delivery: 'embedded', entryPath, assetPath })`
|
|
105
|
+
→ `// after: createNativePackaging({ platform: 'darwin', architecture: 'arm64', delivery: 'embedded' })`
|
|
106
|
+
**Who must act:** builds with `delivery: 'embedded'`. See
|
|
107
|
+
[migration](docs/guide/upgrading.md#embedded-native-packaging-names-no-paths). → ADR 0252
|
|
108
|
+
**Affects:** `stitchkit/files/packaging` createNativePackaging(delivery: 'embedded'), NativePackagingOptions, NativePackagingResult, NativePackagingAsset
|
|
109
|
+
|
|
110
|
+
### Fixed
|
|
111
|
+
|
|
112
|
+
- `stitchkit/files`, `stitchkit/server`, `stitchkit/process` — a bundle or compiled executable
|
|
113
|
+
built without native packaging no longer carries the absolute path of the package on the build
|
|
114
|
+
machine. Since 0.105.0 the default Darwin loader computed its addon path from `__dirname`, which
|
|
115
|
+
Bun inlines as a string, so the artifact named the builder's directories and on another Mac
|
|
116
|
+
looked for the addon there. The loader now reads its own file through `module.filename`, which is
|
|
117
|
+
not an absolute path inside a bundle, and refuses there: the first call that needs the addon
|
|
118
|
+
reports the Darwin backend `unavailable` with the new stage `packaging` and native code
|
|
119
|
+
`STITCHKIT_NATIVE_NOT_PACKAGED`, and the message names `createNativePackaging`. An installed
|
|
120
|
+
package loads the addon as before (ADR 0252).
|
|
121
|
+
- `stitchkit` — the package declares `"sideEffects": false`: it has no import side effects, so a
|
|
122
|
+
bundler drops what a consumer does not use. A bundle that imports only the managed file boundary
|
|
123
|
+
from `stitchkit/files` no longer carries the lock, process identity or the Darwin loader, and
|
|
124
|
+
needs no decision about native packaging.
|
|
125
|
+
|
|
126
|
+
- `stitchkit/agent-runtime` — `createDeferredAgentToolSurface({ runtimeTools })` accepts a
|
|
127
|
+
`RuntimeToolDefinition[]` from `stitchkit/tools` again, without a cast. Since 0.105.0 the
|
|
128
|
+
registration type holds `present` as `unknown` while the deferred catalog expected
|
|
129
|
+
`{ agent?: unknown }`, so the two public types of one package no longer met.
|
|
130
|
+
`DeferredAgentRuntimeToolDefinition.present` is open like the registration's; a presenter that is
|
|
131
|
+
not a function, or that has no `output` schema, is still refused at construction.
|
|
132
|
+
|
|
133
|
+
### Documentation
|
|
134
|
+
|
|
135
|
+
- The 0.105.0 entry "bundles no longer emit Darwin addons" said an unpackaged bundle looks for the
|
|
136
|
+
addon beside the original package files and reports the backend `unavailable` elsewhere. In
|
|
137
|
+
0.105.0–0.106.1 "beside the original package files" was the absolute path of the package on the
|
|
138
|
+
build machine, inlined into the artifact. The native IO guide and the 0.103.13 migration now say
|
|
139
|
+
what each release does, which calls load the addon (process identity, exclusive locks and
|
|
140
|
+
contained Agent file operations, on macOS only; never the managed file boundary), and how to
|
|
141
|
+
check an artifact by its loader instead of by the presence of `.node` bytes.
|
|
142
|
+
|
|
18
143
|
## [0.106.1] - 2026-10-06
|
|
19
144
|
|
|
20
145
|
### Documentation
|
|
@@ -47,6 +172,7 @@ or a failing sink).
|
|
|
47
172
|
`// after: onLeaderSettled: (e) => { if (e.kind === 'stopped') stopped(e.cause, e.signal) }`
|
|
48
173
|
**Who must act:** code that handles a stop in `kind === 'error'`. See
|
|
49
174
|
[migration](docs/guide/upgrading.md#a-stopped-leader-settles-as-stopped). → ADR 0248
|
|
175
|
+
**Affects:** `stitchkit/process` runNativeCommand(onLeaderSettled), NativeCommandOptions(onLeaderSettled), NativeCommandSettlement
|
|
50
176
|
|
|
51
177
|
### Added
|
|
52
178
|
|
|
@@ -131,6 +257,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
131
257
|
**Who must act:** code that imports `publishCli` or a `CliPublication*` type from
|
|
132
258
|
`stitchkit/cli`. See [migration](docs/guide/upgrading.md#cli-publication-has-its-own-entrypoint).
|
|
133
259
|
→ ADR 0245
|
|
260
|
+
**Affects:** `stitchkit/cli` publishCli, CliPublicationOptions, CliPublicationPhase, CliPublicationResult
|
|
134
261
|
|
|
135
262
|
- `stitchkit/process` — **`killGraceMs` becomes the `stop` policy.** How a cancelled command
|
|
136
263
|
stops is one named object: `target` `'group'` (the signal goes to every member, as before) or
|
|
@@ -143,6 +270,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
143
270
|
`// before: runNativeCommand({ …, killGraceMs: 500 })` →
|
|
144
271
|
`// after: runNativeCommand({ …, stop: { target: 'group', graceMs: 500 } })`
|
|
145
272
|
**Who must act:** callers that pass `killGraceMs`. → ADR 0243
|
|
273
|
+
**Affects:** `stitchkit/process` runNativeCommand(killGraceMs), NativeCommandOptions(killGraceMs)
|
|
146
274
|
|
|
147
275
|
- `stitchkit/process` — **a command's leftover group members are stopped after its leader
|
|
148
276
|
exits.** `runNativeCommand` takes `descendants: 'terminate-after-leader' | 'leave'`, and
|
|
@@ -157,6 +285,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
157
285
|
keep running after the command returns. See
|
|
158
286
|
[migration](docs/guide/upgrading.md#a-command-stops-what-its-leader-left).
|
|
159
287
|
→ ADR 0246
|
|
288
|
+
**Affects:** `stitchkit/process` runNativeCommand(descendants), NativeCommandOptions(descendants)
|
|
160
289
|
|
|
161
290
|
- `stitchkit/server`, `stitchkit/files`, `stitchkit/process` — **bundles no longer emit Darwin
|
|
162
291
|
addons.** The packaged Darwin loader names its addon by a computed path, so a Bun bundle of
|
|
@@ -170,6 +299,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
170
299
|
**Who must act:** Darwin packagers of bundled or compiled artifacts using these entrypoints.
|
|
171
300
|
Linux and portable bundles need no change. See [migration](docs/guide/upgrading.md#released-migration-010313).
|
|
172
301
|
→ ADR 0235
|
|
302
|
+
**Affects:** `stitchkit/server`, `stitchkit/files`, `stitchkit/process` behaviour
|
|
173
303
|
- `stitchkit/files/packaging` — **`createNativePackaging` checks each addon against a digest the
|
|
174
304
|
package published, and returns the verified bytes.** `native-assets.json` is now written when
|
|
175
305
|
Stitchkit is built, at `formatVersion: 2`, with the `path`, `size` and `sha256` of every Darwin
|
|
@@ -195,6 +325,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
195
325
|
than the literal `'darwin'`.
|
|
196
326
|
See [migration](docs/guide/upgrading.md#native-packaging-verifies-published-digests).
|
|
197
327
|
→ ADR 0241
|
|
328
|
+
**Affects:** `stitchkit/files/packaging` createNativePackaging(platform), NativePackagingAsset(sourcePath), NativePackagingResult(code)
|
|
198
329
|
- `stitchkit/files` — **`withExclusiveLock` publishes its lock with the owner already recorded,
|
|
199
330
|
and `ownerlessGraceMs` defaults to `null`.** The owner record is written to a temporary file
|
|
200
331
|
and hard-linked to the lock name, so the name never exists without an owner and a stalled
|
|
@@ -208,6 +339,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
208
339
|
file, and locks on a filesystem without hard links; every other caller is unaffected.
|
|
209
340
|
See [migration](docs/guide/upgrading.md#exclusive-locks-publish-their-owner-first).
|
|
210
341
|
→ ADR 0238
|
|
342
|
+
**Affects:** `stitchkit/files` withExclusiveLock(ownerlessGraceMs), ExclusiveLockOptions(ownerlessGraceMs)
|
|
211
343
|
- `stitchkit/tools/connections` — **a `timeoutMs` or `maxResponseBytes` that is not a positive
|
|
212
344
|
integer within range throws a `RangeError`** instead of falling back to the default. This
|
|
213
345
|
shipped in 0.104.0 without a breaking entry.
|
|
@@ -215,6 +347,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
215
347
|
`// after: timeoutMs: 0 (RangeError; omit the option to take the default)`
|
|
216
348
|
**Who must act:** callers that passed 0, a negative, a fractional or an oversized limit.
|
|
217
349
|
See [migration](docs/guide/upgrading.md#connection-limits-are-validated).
|
|
350
|
+
**Affects:** `stitchkit/tools/connections` defineMcpClientConnection(timeoutMs), defineOpenApiConnection(timeoutMs), McpConnectionLimits, ConnectionOperationLimits
|
|
218
351
|
- `stitchkit/testing` — **`serializeSurfaceValue` is removed.** It was a second name for the
|
|
219
352
|
package's one canonical serializer. `canonicalJson` from `stitchkit/primitives` is that
|
|
220
353
|
serializer, bounded and with a typed refusal:
|
|
@@ -223,6 +356,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
223
356
|
**Who must act:** tests that call `serializeSurfaceValue`.
|
|
224
357
|
See [migration](docs/guide/upgrading.md#one-canonical-json-serializer).
|
|
225
358
|
→ ADR 0199, ADR 0238
|
|
359
|
+
**Affects:** `stitchkit/testing` serializeSurfaceValue
|
|
226
360
|
- `stitchkit/agent-runtime` — **`canonicalAgentJson` follows the one admissibility table of
|
|
227
361
|
`canonicalJson`.** A value nested deeper than 100 levels is refused with a
|
|
228
362
|
`CanonicalJsonError`, and an `undefined` object member is omitted instead of failing. It still
|
|
@@ -234,6 +368,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
234
368
|
**Who must act:** code that puts a value nested deeper than 100 levels into agent store events,
|
|
235
369
|
archives or projections. See
|
|
236
370
|
[migration](docs/guide/upgrading.md#one-canonical-json-serializer).
|
|
371
|
+
**Affects:** `stitchkit/agent-runtime` canonicalAgentJson
|
|
237
372
|
- `stitchkit/application` — **`DirectoryInbox` sets a hard-linked entry file aside as
|
|
238
373
|
`invalid`, and `accept` takes the schema's input type.** A dropped file with more than one
|
|
239
374
|
link is never trusted, because another name can still rewrite it (since 0.104.0, without a
|
|
@@ -246,6 +381,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
246
381
|
**Who must act:** producers that drop hard links into an inbox directory, and callers that pass
|
|
247
382
|
`accept` the output of a transforming schema.
|
|
248
383
|
See [migration](docs/guide/upgrading.md#directory-inbox-entries).
|
|
384
|
+
**Affects:** `stitchkit/application` DirectoryInbox, DirectoryInboxConfig, DirectoryInboxResource; `stitchkit/application/directory-inbox` createDirectoryInbox
|
|
249
385
|
- `stitchkit/application` — **`createDiagnosticJournal` checks only the last line of each file
|
|
250
386
|
when it opens** (`startupScan: 'tails'`, the default), so opening no longer parses and
|
|
251
387
|
validates every line of every retained generation. The scan still reads each file once in
|
|
@@ -256,6 +392,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
256
392
|
`// after: createDiagnosticJournal({ path, eventSchema, limits, startupScan: 'full' }) (the same full scan)`
|
|
257
393
|
**Who must act:** operators that read `recovery` at startup to find damaged rows in the middle
|
|
258
394
|
of a file. See [migration](docs/guide/upgrading.md#journal-startup-scan).
|
|
395
|
+
**Affects:** `stitchkit/application/diagnostic-journal` createDiagnosticJournal(startupScan)
|
|
259
396
|
- `stitchkit/application/diagnostic-journal`, `stitchkit/application` — **opening a diagnostic
|
|
260
397
|
journal moves a file it cannot keep in place aside and starts, instead of refusing to start.**
|
|
261
398
|
A torn active file with `maxFiles: 1`, a generation name that is not a regular file and a
|
|
@@ -278,6 +415,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
278
415
|
`recovery`; protocols that embed `DiagnosticJournalRecoveryStatusSchema` and their readers.
|
|
279
416
|
See [migration](docs/guide/upgrading.md#journal-startup-quarantine).
|
|
280
417
|
→ ADR 0240
|
|
418
|
+
**Affects:** `stitchkit/application/diagnostic-journal` createDiagnosticJournal(onStartupRefusal); `stitchkit/application` DiagnosticJournalRecoveryError, DiagnosticJournalRecoveryStatusSchema
|
|
281
419
|
|
|
282
420
|
- `stitchkit/cli`, `stitchkit/tools`, `stitchkit/tools/mcp` — **one runtime-tool declaration.**
|
|
283
421
|
`RuntimeToolExecution`, `RuntimeToolExecutionWithOutput` (cli), `RuntimeMcpToolDefinition`,
|
|
@@ -299,6 +437,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
299
437
|
`createRuntimeToolFactory` need no change.
|
|
300
438
|
See [migration](docs/guide/upgrading.md#one-runtime-tool-declaration).
|
|
301
439
|
→ ADR 0236, ADR 0238
|
|
440
|
+
**Affects:** `stitchkit/cli` RuntimeToolExecution, RuntimeToolExecutionWithOutput; `stitchkit/tools/mcp` RuntimeMcpToolDefinition, RuntimeMcpToolDefinitionWithOutput; `stitchkit/tools` ToolSurfaceDefinition, RuntimeToolDefinitionWithOutput
|
|
302
441
|
- `stitchkit/tools`, `stitchkit/tools/mcp` — **a flattened union keeps declaration order.**
|
|
303
442
|
With `flattenUnionInput: true`, properties, enum values and branch labels are advertised in the
|
|
304
443
|
order of their first appearance across the variants instead of alphabetically, so the bytes of
|
|
@@ -310,6 +449,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
310
449
|
anyone using `flattenUnionInput: true`: regenerate the snapshots.
|
|
311
450
|
See [migration](docs/guide/upgrading.md#flattened-unions-keep-declaration-order).
|
|
312
451
|
→ ADR 0238
|
|
452
|
+
**Affects:** `stitchkit/tools`, `stitchkit/tools/mcp` behaviour
|
|
313
453
|
- `stitchkit/tools`, `stitchkit/cli` — **a list written as text is refused in every
|
|
314
454
|
string-or-array field.** `coerceJsonArgs`, and so every tool surface, throws a validation error
|
|
315
455
|
naming the field when a union that keeps a string member receives a string that parses to an
|
|
@@ -321,12 +461,14 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
321
461
|
**Who must act:** callers that send a JSON array as text to a string-or-array field; a plain
|
|
322
462
|
string, including one that is not a list the array member accepts, is unchanged.
|
|
323
463
|
→ ADR 0218, ADR 0239, ADR 0238
|
|
464
|
+
**Affects:** `stitchkit/tools`, `stitchkit/cli` behaviour
|
|
324
465
|
- `stitchkit/agent-runtime` — **the `stitchkit/agent-runtime/harness-tools` leaf is removed.** It
|
|
325
466
|
was one `mountAgent` call with the run's fence composed in; no consumer imported it.
|
|
326
467
|
`// before: tools: createAgentHarnessTools(({ context }) => ({ services: [svc], context }))` →
|
|
327
468
|
`// after: tools: ({ context, toolFenceLifecycle }) => mountAgent([svc], { context, lifecycle: composeToolLifecycle(undefined, toolFenceLifecycle) })`
|
|
328
469
|
**Who must act:** imports of `stitchkit/agent-runtime/harness-tools`. See
|
|
329
470
|
[migration](docs/guide/upgrading.md#one-runtime-tool-declaration).
|
|
471
|
+
**Affects:** `stitchkit/agent-runtime/harness-tools` *
|
|
330
472
|
- `stitchkit/agent-runtime/realtime`, `stitchkit/agent-runtime/browser` — **control errors use one
|
|
331
473
|
vocabulary, and the binding authorizes requests, not events.** `ACCESS_DENIED` is `FORBIDDEN`, and
|
|
332
474
|
a closed connection answers `CONNECTION_CLOSED` instead of a denial. `AgentControlErrorCode`
|
|
@@ -341,6 +483,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
341
483
|
`// after: if (state.error?.code === 'FORBIDDEN') …`
|
|
342
484
|
**Who must act:** code that compares control error codes, and applications that revoke access while
|
|
343
485
|
a stream is open (call `binding.revoke`; before, every event re-asked `authorize`).
|
|
486
|
+
**Affects:** `stitchkit/agent-runtime/browser` AgentControlErrorCode, AgentControlErrorCodeSchema, AgentControllerState(error); `stitchkit/agent-runtime/realtime` bindAgentHarnessRealtime(authorize), AgentHarnessRealtimeBinding(revoke)
|
|
344
487
|
- `stitchkit/contract`, `stitchkit/server`, `stitchkit/node` — **`AppError` takes its fields by
|
|
345
488
|
name.** The constructor had seven positions, so a call that set only `retryable` read
|
|
346
489
|
`new AppError(code, message, 409, undefined, undefined, undefined, true)`. The code stays first;
|
|
@@ -353,6 +496,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
353
496
|
The `notFound`, `badRequest`, `unauthorized`, `forbidden`, `conflict` and `rateLimited` helpers
|
|
354
497
|
are unchanged. See [migration](docs/guide/upgrading.md#error-constructors-take-named-options).
|
|
355
498
|
→ ADR 0238
|
|
499
|
+
**Affects:** `stitchkit/contract`, `stitchkit/server`, `stitchkit/node` AppError
|
|
356
500
|
- `stitchkit` — **`ApiError` takes its fields by name.** The constructor had eight positions
|
|
357
501
|
and call sites ended in `undefined, undefined, retryable`. The code stays first and the rest
|
|
358
502
|
is one options object; `new ApiError(code)` still works:
|
|
@@ -364,6 +508,7 @@ and code that imports `publishCli` or its types from `stitchkit/cli`.
|
|
|
364
508
|
`retryable` or `cause` is unaffected. See
|
|
365
509
|
[migration](docs/guide/upgrading.md#error-constructors-take-named-options).
|
|
366
510
|
→ ADR 0238
|
|
511
|
+
**Affects:** `stitchkit` ApiError
|
|
367
512
|
|
|
368
513
|
### Added
|
|
369
514
|
|
|
@@ -507,16 +652,19 @@ native CLI commands and ordinary one-argument state transitions remain valid.
|
|
|
507
652
|
in `CliConfig.runtimeTools` / `CliInvokerConfig.runtimeTools`. Existing typed definitions and
|
|
508
653
|
native `commands` need no change. See [migration](docs/guide/upgrading.md#released-migration-01040).
|
|
509
654
|
→ ADR 0227
|
|
655
|
+
**Affects:** `stitchkit/cli` CliConfig(runtimeTools), CliInvokerConfig(runtimeTools)
|
|
510
656
|
- `stitchkit/application` — custom state adapters must supply an active, fenced
|
|
511
657
|
`StateStoreUpdateContext`: `transition(current)` → `transition(current, context)` inside
|
|
512
658
|
their protected transaction. Remove file-store `staleLockMs` / `retryMs`:
|
|
513
659
|
`{ staleLockMs, retryMs, lockTimeoutMs }` → `{ lockTimeoutMs }`. Live and unknown owners
|
|
514
660
|
cannot be reclaimed by age; legacy lock recovery requires proof that the owner stopped.
|
|
515
661
|
Ordinary one-argument transition callbacks still work. → ADR 0228
|
|
662
|
+
**Affects:** `stitchkit/application` StateStore, StateStoreUpdate, StateStoreUpdateContext; `stitchkit/server` createFileStateStore(staleLockMs), FileStateStoreOptions(retryMs)
|
|
516
663
|
- `stitchkit/telegram` — broadcast halt uses `TelegramBroadcastFailure`:
|
|
517
664
|
`report.halt.reason` → `report.halt.kind`. An unknown send outcome becomes durable
|
|
518
665
|
`uncertain` and halts without replay; explicit retry classifiers certify that the failed
|
|
519
666
|
attempt did not apply its effect. → ADR 0228
|
|
667
|
+
**Affects:** `stitchkit/telegram` runTelegramBroadcast(halt), TelegramBroadcastReport(halt)
|
|
520
668
|
- `stitchkit/tools`, `stitchkit/tools/mcp` — construct schema-dependent MCP tools before
|
|
521
669
|
heterogeneous registration: `runtimeTools: [{ input, output, handler, present }]` →
|
|
522
670
|
`const tool = { … } satisfies RuntimeMcpToolDefinitionWithOutput<typeof input, typeof output>; runtimeTools: [tool]`.
|
|
@@ -524,16 +672,19 @@ native CLI commands and ordinary one-argument state transitions remain valid.
|
|
|
524
672
|
official SDK's required content and metadata types: `present: { mcp: () => ({}) }` →
|
|
525
673
|
`present: { mcp: () => ({ content: [] }) }`. **Who must act:** inline MCP constructors
|
|
526
674
|
and presenters returning malformed content or metadata. → ADR 0231
|
|
675
|
+
**Affects:** `stitchkit/tools` createMcpHandler(runtimeTools), mountMcp(runtimeTools); `stitchkit/tools/mcp` buildMcpServer(runtimeTools), RuntimeMcpToolPresenters
|
|
527
676
|
- `stitchkit/contract`, `stitchkit/remote` — error envelopes and framed errors admit an
|
|
528
677
|
optional boolean `retryable`. A closed error schema must add
|
|
529
678
|
`retryable: z.boolean().optional()` before upgrading producers that declare it; envelopes
|
|
530
679
|
without a declaration remain unchanged. See [migrations](docs/guide/upgrading.md).
|
|
531
680
|
These migrations require a minor release. → ADR 0232
|
|
681
|
+
**Affects:** `stitchkit/contract`, `stitchkit/remote` behaviour
|
|
532
682
|
- `stitchkit/tools`, `stitchkit/cli` — raw unexpected tool errors are observed through
|
|
533
683
|
`hooks.onToolError` / `hooks.afterToolCall` instead of being printed on protocol stderr.
|
|
534
684
|
**Who must act:** applications collecting raw tool causes from `console.error`; configure
|
|
535
685
|
an internal hook sink instead. MCP resolver failures reach the same observing hooks without
|
|
536
686
|
rerunning the handler or its lifecycle. → ADR 0229
|
|
687
|
+
**Affects:** `stitchkit/tools`, `stitchkit/cli` behaviour
|
|
537
688
|
|
|
538
689
|
### Fixed
|
|
539
690
|
|
package/README.md
CHANGED
|
@@ -359,11 +359,13 @@ import { parseSSE } from 'stitchkit' // client: Response → AsyncGene
|
|
|
359
359
|
| **Cache Bridge** | `createCacheBridge()` — socket events → TanStack Query cache |
|
|
360
360
|
| **Auth** | `createAuthHook()` / `createBearerResolver()` — scope-aware auth from `contract.scope` |
|
|
361
361
|
| **SSE Streaming** | `streamSSE()` / `parseSSE()` — async generator ↔ SSE |
|
|
362
|
+
| **NDJSON** | `ndjsonRoute()` / `parseNDJSON()` / `createNDJSONDecoder()` — bounded lines from a response, a child's stdout or a socket |
|
|
362
363
|
| **Events** | `createEventBus<EventMap>()` — typed in-process pub/sub |
|
|
363
364
|
| **Multipart** | typed buffered or streaming single/multi-file uploads with limits and MIME policy |
|
|
364
365
|
| **Rate Limiting** | `createRateLimiter()` — token bucket, per-key |
|
|
365
366
|
| **Cache** | `createCache()` — in-memory with TTL + `cacheHeaders()` |
|
|
366
367
|
| **Errors** | `AppError`, `notFound()`, `badRequest()`, `unauthorized()` |
|
|
368
|
+
| **Manual time** | `createManualClock()` (`stitchkit/testing`) — schedules, retries and deadlines advanced by the test, in order |
|
|
367
369
|
|
|
368
370
|
## How it compares
|
|
369
371
|
|
package/darwin-native.cjs
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
/** Generated from the owning native asset graph. Loading remains lazy. */
|
|
2
|
-
// The addon path is computed, so a bundler never follows
|
|
3
|
-
//
|
|
2
|
+
// The addon path is computed from this file's own location, so a bundler never follows
|
|
3
|
+
// or embeds it and the build machine never becomes a literal of the artifact. Inside a
|
|
4
|
+
// bundle the file has no location (`module.filename` is not absolute there): loading
|
|
5
|
+
// refuses and names the packaging plugin, which replaces this file with a static loader
|
|
6
|
+
// when an artifact must carry the addon.
|
|
4
7
|
module.exports = function loadDarwinAddon() {
|
|
8
|
+
const location = module.filename;
|
|
9
|
+
if (typeof location !== 'string' || !location.startsWith('/')) {
|
|
10
|
+
const refusal = new Error(
|
|
11
|
+
'The Darwin addon is not packaged into this bundle: build it with createNativePackaging from stitchkit/files/packaging',
|
|
12
|
+
);
|
|
13
|
+
refusal.code = 'STITCHKIT_NATIVE_NOT_PACKAGED';
|
|
14
|
+
throw refusal;
|
|
15
|
+
}
|
|
16
|
+
const directory = location.slice(0, location.lastIndexOf('/'));
|
|
5
17
|
try {
|
|
6
|
-
if (process.arch === 'arm64') return require(`${
|
|
7
|
-
if (process.arch === 'x64') return require(`${
|
|
18
|
+
if (process.arch === 'arm64') return require(`${directory}/native/darwin-arm64.node`);
|
|
19
|
+
if (process.arch === 'x64') return require(`${directory}/native/darwin-x64.node`);
|
|
8
20
|
throw new Error('Unsupported Darwin addon architecture');
|
|
9
21
|
} catch (cause) {
|
|
10
22
|
throw new Error('Darwin addon loading failed', { cause });
|
|
11
23
|
}
|
|
12
24
|
};
|
|
25
|
+
module.exports.stitchkitNativeLoader = 'stitchkit-native-loader:unpackaged';
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import type { ToolSet } from 'ai';
|
|
2
|
-
import {
|
|
3
|
-
import type { HttpMethod, ToolTransport } from '../contract/define.js';
|
|
4
|
-
import type { EndpointToolAnnotations, EndpointUiMeta } from '../contract/tool-options.js';
|
|
2
|
+
import { z } from 'zod';
|
|
5
3
|
import type { ServiceDef } from '../server/types.js';
|
|
6
4
|
import type { ErrorHintFn, ToolCallHooks, ToolLifecycle } from '../tools/execute-hooks.js';
|
|
7
5
|
import type { ToolExtend } from '../tools/mount.js';
|
|
6
|
+
import type { DeferredAgentRuntimeToolDefinition } from '../tools/runtime-tool-declaration.js';
|
|
8
7
|
import type { AgentRuntimePrepareStep, AgentRuntimeRunContext } from './runtime.js';
|
|
9
|
-
export declare const DeferredAgentToolSearchInputSchema: ZodObject<{
|
|
8
|
+
export declare const DeferredAgentToolSearchInputSchema: z.ZodObject<{
|
|
10
9
|
query: z.ZodString;
|
|
11
10
|
reason: z.ZodOptional<z.ZodEnum<{
|
|
12
11
|
inactive_call: "inactive_call";
|
|
13
12
|
}>>;
|
|
14
13
|
}, z.core.$strip>;
|
|
15
|
-
export declare const DeferredAgentToolMatchSchema: ZodObject<{
|
|
14
|
+
export declare const DeferredAgentToolMatchSchema: z.ZodObject<{
|
|
16
15
|
name: z.ZodString;
|
|
17
16
|
description: z.ZodString;
|
|
18
17
|
}, z.core.$strip>;
|
|
19
|
-
export declare const DeferredAgentToolReceiptSchema: ZodObject<{
|
|
18
|
+
export declare const DeferredAgentToolReceiptSchema: z.ZodObject<{
|
|
20
19
|
schemaVersion: z.ZodLiteral<1>;
|
|
21
20
|
kind: z.ZodLiteral<"stitchkit.deferred-tool-selection">;
|
|
22
21
|
status: z.ZodEnum<{
|
|
@@ -28,33 +27,13 @@ export declare const DeferredAgentToolReceiptSchema: ZodObject<{
|
|
|
28
27
|
runId: z.ZodString;
|
|
29
28
|
surfaceKey: z.ZodString;
|
|
30
29
|
selected: z.ZodArray<z.ZodString>;
|
|
31
|
-
matches: z.ZodArray<ZodObject<{
|
|
30
|
+
matches: z.ZodArray<z.ZodObject<{
|
|
32
31
|
name: z.ZodString;
|
|
33
32
|
description: z.ZodString;
|
|
34
33
|
}, z.core.$strip>>;
|
|
35
34
|
truncated: z.ZodBoolean;
|
|
36
35
|
}, z.core.$strip>;
|
|
37
36
|
export type DeferredAgentToolReceipt = z.infer<typeof DeferredAgentToolReceiptSchema>;
|
|
38
|
-
export interface DeferredAgentRuntimeToolDefinition {
|
|
39
|
-
name: string;
|
|
40
|
-
description: string;
|
|
41
|
-
identity: {
|
|
42
|
-
serviceName: string;
|
|
43
|
-
action: string;
|
|
44
|
-
method: HttpMethod;
|
|
45
|
-
scope?: string;
|
|
46
|
-
meta?: Record<string, unknown>;
|
|
47
|
-
};
|
|
48
|
-
input: ZodObject;
|
|
49
|
-
output?: ZodType;
|
|
50
|
-
transports?: readonly ToolTransport[];
|
|
51
|
-
annotations?: EndpointToolAnnotations;
|
|
52
|
-
ui?: EndpointUiMeta;
|
|
53
|
-
handler: unknown;
|
|
54
|
-
present?: {
|
|
55
|
-
agent?: unknown;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
37
|
export interface DeferredAgentToolManifestEntry {
|
|
59
38
|
name: string;
|
|
60
39
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferred-tool-types.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/deferred-tool-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"deferred-tool-types.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/deferred-tool-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,kCAAkC,E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,GAC1F,CACI,kCAAkC,GAClC;IACE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAC,CAAC;IACvE,aAAa,CAAC,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;CAC/D,CACJ,CAAC;AACJ,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,kCAAkC,CAAC;IAC/C,QAAQ,EAAE,SAAS,8BAA8B,EAAE,CAAC;IACpD,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC;IAC5D,WAAW,EAAE,8BAA8B,CAAC;IAC5C,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AACD,MAAM,WAAW,2BAA2B,CAAC,OAAO;IAClD,KAAK,CACH,UAAU,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAC3C,MAAM,CAAC,EAAE,4BAA4B,GACpC,OAAO,CAAC;IACX,WAAW,CACT,sBAAsB,CAAC,EAAE,uBAAuB,CAAC,OAAO,CAAC,GACxD,uBAAuB,CAAC,OAAO,CAAC,CAAC;CACrC"}
|
package/dist/browser/stream.d.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import type { StreamFinalLinePolicy } from '../contract/define.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { type StreamByteSource } from '../internal/bounded-lines.js';
|
|
3
|
+
export { DEFAULT_STREAM_LINE_BYTES, type StreamByteSource, StreamLineLimitError, StreamTruncatedLineError, } from '../internal/bounded-lines.js';
|
|
4
|
+
/** Options for `parseNDJSON` and `createNDJSONDecoder`. */
|
|
4
5
|
export interface ParseNDJSONOptions {
|
|
5
|
-
/** Maximum bytes retained for one line
|
|
6
|
+
/** Maximum bytes retained for one line; past it, `StreamLineLimitError`. Default 1 MiB. */
|
|
6
7
|
maxLineBytes?: number;
|
|
7
8
|
/** Called for invalid UTF-8/JSON; without it parsing fails closed. */
|
|
8
9
|
onParseError?: (raw: string, error: Error) => void;
|
|
9
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Default `allow`; use `require-newline` when a missing delimiter means truncation (a socket or
|
|
12
|
+
* a child's stdout that ends mid-line), so the fragment is `StreamTruncatedLineError`, not a value.
|
|
13
|
+
*/
|
|
10
14
|
finalLine?: StreamFinalLinePolicy;
|
|
15
|
+
/** Stops reading and cancels the source; the iteration rejects with the signal's reason. */
|
|
16
|
+
signal?: AbortSignal;
|
|
11
17
|
}
|
|
12
18
|
/**
|
|
13
|
-
* Parse
|
|
14
|
-
* `
|
|
19
|
+
* Parse newline-delimited JSON — the client half of `ndjsonRoute`, and the reader for any other
|
|
20
|
+
* byte source: a `Response`, a `ReadableStream<Uint8Array>` (a fetch body, a Bun child's
|
|
21
|
+
* `stdout`) or an `AsyncIterable<Uint8Array>` (a Node child's `stdout`). A source that delivers
|
|
22
|
+
* bytes through a callback, such as a `Bun.listen` socket, uses `createNDJSONDecoder`.
|
|
15
23
|
*
|
|
16
24
|
* **Blank lines are skipped**, and that is the contract rather than a
|
|
17
25
|
* convenience. A long-lived NDJSON stream has to send something while it is
|
|
@@ -26,18 +34,36 @@ export interface ParseNDJSONOptions {
|
|
|
26
34
|
* the other end stayed alive for seconds afterwards. An aborted request reaches
|
|
27
35
|
* the route's `context.signal` at once.
|
|
28
36
|
*/
|
|
29
|
-
export declare function parseNDJSON<T>(
|
|
37
|
+
export declare function parseNDJSON<T>(source: StreamByteSource, options?: ParseNDJSONOptions): AsyncGenerator<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Push-driven NDJSON for a source that hands over bytes through a callback. `push` returns the
|
|
40
|
+
* values its chunk completed; `end` returns the value of an unterminated final line, or throws
|
|
41
|
+
* `StreamTruncatedLineError` under `finalLine: 'require-newline'`.
|
|
42
|
+
*/
|
|
43
|
+
export interface NDJSONDecoder<T> {
|
|
44
|
+
push(chunk: Uint8Array): T[];
|
|
45
|
+
end(): T[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The same bounded, fatal-UTF-8 NDJSON reading as `parseNDJSON`, for a `Bun.listen` /
|
|
49
|
+
* `Bun.connect` socket's `data` handler or any other callback source. A line past
|
|
50
|
+
* `maxLineBytes` throws `StreamLineLimitError` as soon as it crosses the limit; invalid JSON
|
|
51
|
+
* goes to `onParseError` or throws. (`signal` does not apply: the caller owns the source.)
|
|
52
|
+
*/
|
|
53
|
+
export declare function createNDJSONDecoder<T>(options?: Omit<ParseNDJSONOptions, 'signal'>): NDJSONDecoder<T>;
|
|
30
54
|
/** Options for `parseSSE`. */
|
|
31
55
|
export interface ParseSSEOptions {
|
|
32
|
-
/** Maximum bytes retained for one SSE line
|
|
56
|
+
/** Maximum bytes retained for one SSE line; past it, `StreamLineLimitError`. Default 1 MiB. */
|
|
33
57
|
maxLineBytes?: number;
|
|
34
58
|
/** Called for invalid UTF-8/JSON; without it parsing fails closed. */
|
|
35
59
|
onParseError?: (raw: string, error: Error) => void;
|
|
60
|
+
/** Stops reading and cancels the source; the iteration rejects with the signal's reason. */
|
|
61
|
+
signal?: AbortSignal;
|
|
36
62
|
}
|
|
37
63
|
/**
|
|
38
|
-
* Parse
|
|
39
|
-
*
|
|
40
|
-
*
|
|
64
|
+
* Parse Server-Sent Events into an async generator of JSON values — the client counterpart of
|
|
65
|
+
* `streamSSE`. Reads the same byte sources as `parseNDJSON`. Stops at the `[DONE]` sentinel;
|
|
66
|
+
* the source is cancelled on every exit path.
|
|
41
67
|
*/
|
|
42
|
-
export declare function parseSSE<T>(
|
|
68
|
+
export declare function parseSSE<T>(source: StreamByteSource, options?: ParseSSEOptions): AsyncGenerator<T>;
|
|
43
69
|
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/browser/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,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AAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACnD,4FAA4F;IAC5F,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAuB,QAAQ,CAAC,CAAC,EAC/B,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,eAAe,GACxB,cAAc,CAAC,CAAC,CAAC,CA6BnB"}
|
|
@@ -68,12 +68,11 @@ import {
|
|
|
68
68
|
AgentBrowserRequestSchema2,
|
|
69
69
|
agentControlRealtimeContract2
|
|
70
70
|
} from "../../index-yt7gyg5x.js";
|
|
71
|
-
import"../../index-
|
|
72
|
-
import"../../index-pzb63z66.js";
|
|
71
|
+
import"../../index-ykdcnq1f.js";
|
|
73
72
|
import"../../index-4s0fep5q.js";
|
|
74
73
|
import {
|
|
75
74
|
bindRealtimeClient2
|
|
76
|
-
} from "../../index-
|
|
75
|
+
} from "../../index-pvh3z03x.js";
|
|
77
76
|
import {
|
|
78
77
|
assertPositiveSafeInteger
|
|
79
78
|
} from "../../index-0s4xebbg.js";
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import"../../index-ct75c3at.js";
|
|
2
|
-
import"../../index-
|
|
3
|
-
import"../../index-
|
|
4
|
-
import"../../index-rpzewktb.js";
|
|
2
|
+
import"../../index-q6crhe1n.js";
|
|
3
|
+
import"../../index-fynr93w4.js";
|
|
5
4
|
import {
|
|
6
5
|
AgentCodingToolLimitsSchema2,
|
|
7
6
|
AgentCodingToolAuthorizationSchema2,
|
|
8
7
|
AgentCodingToolPathAuthorizationSchema2,
|
|
9
8
|
createAgentCodingTools2
|
|
10
|
-
} from "../../index-
|
|
11
|
-
import"../../index-
|
|
12
|
-
import"../../index-j4zh647a.js";
|
|
9
|
+
} from "../../index-dwf0gymy.js";
|
|
10
|
+
import"../../index-2kbysk9s.js";
|
|
13
11
|
import"../../index-4q9jvqg7.js";
|
|
14
12
|
import"../../index-8ks9b85e.js";
|
|
15
|
-
import"../../index-
|
|
16
|
-
import"../../index-
|
|
13
|
+
import"../../index-zrtrjkbf.js";
|
|
14
|
+
import"../../index-636mggad.js";
|
|
17
15
|
export {
|
|
18
16
|
AgentCodingToolAuthorizationSchema2 as AgentCodingToolAuthorizationSchema,
|
|
19
17
|
AgentCodingToolLimitsSchema2 as AgentCodingToolLimitsSchema,
|
|
@@ -5,33 +5,29 @@ import"../../index-8kzct1d6.js";
|
|
|
5
5
|
import {
|
|
6
6
|
composeAgentPrompt2,
|
|
7
7
|
createAgentRuntime2
|
|
8
|
-
} from "../../index-
|
|
8
|
+
} from "../../index-yz8x0hbx.js";
|
|
9
9
|
import"../../index-qaet40b2.js";
|
|
10
10
|
import"../../index-mnkk1ffz.js";
|
|
11
|
-
import"../../index-
|
|
12
|
-
import"../../index-rpzewktb.js";
|
|
13
|
-
import"../../index-yex7eg1v.js";
|
|
11
|
+
import"../../index-fynr93w4.js";
|
|
14
12
|
import"../../index-6yxhe58g.js";
|
|
15
13
|
import"../../index-ct75c3at.js";
|
|
16
|
-
import"../../index-
|
|
17
|
-
import"../../index-
|
|
18
|
-
import"../../index-556g5hsh.js";
|
|
14
|
+
import"../../index-q6crhe1n.js";
|
|
15
|
+
import"../../index-dm2fv45z.js";
|
|
19
16
|
import"../../index-c17xcx4k.js";
|
|
20
17
|
import"../../index-0gs4ymfj.js";
|
|
21
18
|
import"../../index-5w6t91ze.js";
|
|
22
|
-
import"../../index-
|
|
19
|
+
import"../../index-2kbysk9s.js";
|
|
23
20
|
import"../../index-b0w7rbpt.js";
|
|
24
21
|
import {
|
|
25
22
|
walkContainedFiles
|
|
26
|
-
} from "../../index-
|
|
23
|
+
} from "../../index-zrtrjkbf.js";
|
|
27
24
|
import {
|
|
28
25
|
createAgentHarnessControlServer2
|
|
29
26
|
} from "../../index-hjvje0pf.js";
|
|
30
27
|
import"../../index-299sm5tr.js";
|
|
31
28
|
import {
|
|
32
29
|
defineRuntimeTool2
|
|
33
|
-
} from "../../index-
|
|
34
|
-
import"../../index-7n68nmc6.js";
|
|
30
|
+
} from "../../index-636mggad.js";
|
|
35
31
|
|
|
36
32
|
// src/agent-runtime/harness-contract.ts
|
|
37
33
|
import { z } from "zod";
|