stitchkit 0.101.3 → 0.102.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 CHANGED
@@ -15,6 +15,27 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.102.0] — 2026-09-30
19
+
20
+ ### ⚠️ Breaking changes
21
+
22
+ - `stitchkit/tools`, `stitchkit/tools/contract`, `stitchkit/cli` — **`view_file`
23
+ rejects JSON arrays encoded inside a `paths` string during input validation**,
24
+ before file or network access, with a hint to pass an array or one path.
25
+ Previously the text was accepted as one filename and failed with a misleading
26
+ media-extension refusal. `paths: '["image.png"]'` → `paths: ['image.png']`.
27
+ An encoded array inside an array element is refused too. Managed surfaces
28
+ return `VALIDATION_ERROR`; raw MCP reports an input-validation error. → ADR 0218.
29
+
30
+ **Who must act:** callers that serialize the `paths` array into a string, or
31
+ branch on the former media-extension error for that input. Pass a real array
32
+ (or a single path string) and handle the validation error.
33
+
34
+ ### Fixed
35
+
36
+ - `stitchkit/tools` — a local non-media extension refusal identifies the
37
+ caller's path and the extension it saw, without reading the file.
38
+
18
39
  ## [0.101.3] — 2026-09-29
19
40
 
20
41
  ### Fixed
@@ -6,7 +6,7 @@ import {
6
6
  ViewFileErrorSchema2,
7
7
  ViewFileOutputSchema2,
8
8
  ViewFileInputSchema2
9
- } from "../../index-5107q189.js";
9
+ } from "../../index-zax7resm.js";
10
10
  import {
11
11
  coerceJsonArgs2
12
12
  } from "../../index-9pw0a51a.js";
@@ -69,7 +69,7 @@ import {
69
69
  ViewFileErrorSchema2,
70
70
  ViewFileOutputSchema2,
71
71
  ViewFileInputSchema2
72
- } from "../index-5107q189.js";
72
+ } from "../index-zax7resm.js";
73
73
  import {
74
74
  fetchGuarded,
75
75
  fetchPinnedDocument,
@@ -2632,7 +2632,8 @@ var EXT_MIME = {
2632
2632
  ".mov": "video/quicktime"
2633
2633
  };
2634
2634
  async function fetchSource(pathOrUrl, options, maxBytes) {
2635
- const extMime = EXT_MIME[extname2(pathOrUrl).toLowerCase()];
2635
+ const extension = extname2(pathOrUrl);
2636
+ const extMime = EXT_MIME[extension.toLowerCase()];
2636
2637
  if (pathOrUrl.startsWith("http://") || pathOrUrl.startsWith("https://")) {
2637
2638
  const url = new URL(pathOrUrl);
2638
2639
  const res = await fetchGuarded(url, options.allowPrivateHosts ?? false, {
@@ -2660,7 +2661,7 @@ async function fetchSource(pathOrUrl, options, maxBytes) {
2660
2661
  }
2661
2662
  options.signal?.throwIfAborted();
2662
2663
  if (!extMime) {
2663
- throw new AppError2("FILE_INSPECTION_REJECTED", "refusing to read a non-media file", 422);
2664
+ throw new AppError2("FILE_INSPECTION_REJECTED", `refusing to read ${JSON.stringify(pathOrUrl)} — ${JSON.stringify(extension)} is not a media extension`, 422);
2664
2665
  }
2665
2666
  try {
2666
2667
  const source = await options.files.read(pathOrUrl, {
@@ -45,7 +45,19 @@ var ViewFileOutputSchema2 = z2.object({
45
45
  content: z2.array(McpMediaContentSchema2),
46
46
  errors: z2.array(ViewFileErrorSchema2)
47
47
  });
48
+ function isTextList(value) {
49
+ if (!value.trimStart().startsWith("["))
50
+ return false;
51
+ try {
52
+ return Array.isArray(JSON.parse(value));
53
+ } catch {
54
+ return false;
55
+ }
56
+ }
57
+ var MediaPathSchema = z2.string().refine((value) => !isTextList(value), {
58
+ message: "paths is a list written as text — pass an array of paths or one path"
59
+ });
48
60
  var ViewFileInputSchema2 = z2.object({
49
- paths: z2.union([z2.string(), z2.array(z2.string()).max(MAX_VIEW_FILES)]).describe("Media URL(s) or file path(s) to view")
61
+ paths: z2.union([MediaPathSchema, z2.array(MediaPathSchema).max(MAX_VIEW_FILES)]).describe("One media URL or file path, or an array of them. Pass the array itself, not JSON written as text.")
50
62
  });
51
63
  export { AsyncOperationCancelResultSchema2, createAsyncOperationSnapshotSchema2, McpAnnotationsSchema2, McpMediaContentSchema2, ViewFileErrorSchema2, ViewFileOutputSchema2, ViewFileInputSchema2 };
@@ -1 +1 @@
1
- {"version":3,"file":"view-file-contract.d.ts","sourceRoot":"","sources":["../../../src/tools/transfer/view-file-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qFAAqF;AACrF,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;iBAG/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;2BAchC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,mBAAmB;;iBAI9B,CAAC"}
1
+ {"version":3,"file":"view-file-contract.d.ts","sourceRoot":"","sources":["../../../src/tools/transfer/view-file-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qFAAqF;AACrF,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;iBAG/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;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AE5B;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC,OAAO,CAAC,EACpD,OAAO,GAAE,eAAoB,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,cAAc,CAAC,CAuBzB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,GAAE,eAAoB,GAAG,IAAI,CAgBpF"}
@@ -79,12 +79,12 @@ own, recorded as an ADR.
79
79
  | `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
80
80
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
81
81
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
82
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 46 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
82
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 47 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
83
83
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, plus the managed-resource conformance kit |
84
84
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
85
85
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
86
86
  | `stitchkit/react/keyboard` | browser | evolving | which part of a screen gets a key — ordered layers, one Escape per level, list zones with real focus; see [keyboard guide](keyboard.md) |
87
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 22 of the 46 minors since 0.56.2, most recently 0.97.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
87
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 22 of the 47 minors since 0.56.2, most recently 0.97.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
88
88
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
89
89
  | `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults, deterministic race controls and the agent-store conformance kit |
90
90
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -94,7 +94,7 @@ own, recorded as an ADR.
94
94
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
95
95
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
96
96
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
97
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 10 of the 46 minors since 0.56.2, most recently 0.100.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
97
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 10 of the 47 minors since 0.56.2, most recently 0.100.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
98
98
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
99
99
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
100
100
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
package/llms/tools.2.txt CHANGED
@@ -365,6 +365,15 @@ multimodal content beside structured per-item `errors`, and charges every item
365
365
  to one total 20 MB batch budget. Its MCP and Agent presenters are built in;
366
366
  remote fetch cancellation follows the active call signal.
367
367
 
368
+ `paths` is one path/URL string or an actual array of strings (at most 20).
369
+ Pass `{ paths: ['image.png'] }`, not `{ paths: '["image.png"]' }`: a JSON
370
+ array written as text fails input validation before any file or network access,
371
+ with the hint `paths is a list written as text — pass an array of paths or one
372
+ path`. The same rule applies to array items and the raw `mountViewFile` input.
373
+ Ordinary file names containing brackets, such as `[preview].png`, remain valid.
374
+ A local file with an unsupported extension is refused before reading; its
375
+ per-item error identifies the caller's path and the extension it saw.
376
+
368
377
  The older `mountWait`, `mountDownload`, `mountUpload` and `mountViewFile`
369
378
  functions remain
370
379
  intentional raw MCP adapters with their text-envelope behavior. Use them under
package/llms/tools.3.txt CHANGED
@@ -113,7 +113,7 @@ payload.
113
113
  | `ToolCallContext` | _type_ | the context every tool hook receives — `{ source, mcp? }` plus whatever the mount's `context` added |
114
114
  | `ViewFileOptions` | _type_ | shared URL/managed-file-boundary policy for `defineViewFileTool`, `mountViewFile` and `resolveMedia` |
115
115
  | `ViewFileOutput` | _type_ | neutral managed batch result with multimodal `content` and per-item `errors` |
116
- | `ViewFileInputSchema` | constant | fixed one-or-many media path/URL input schema |
116
+ | `ViewFileInputSchema` | constant | one media path/URL or an array of at most 20; rejects a JSON array written as text, including in array items, before IO |
117
117
  | `ViewFileOutputSchema` | constant | Zod schema for the neutral managed view-file batch result |
118
118
  | `ViewFileErrorSchema` | constant | Zod schema for one structured per-item view failure |
119
119
  | `McpAnnotations` | _type_ | MCP annotations on a media result |
@@ -1,14 +1,75 @@
1
- # Upgrading 0.61.0 → 0.73.0 — stitchkit docs slice
1
+ # Upgrading 0.61.0 → 0.74.0 — stitchkit docs slice
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
5
5
 
6
- Contains: Guide: Upgrading, 0.61.0 → 0.73.0 (docs/guide/upgrading.md)
6
+ Contains: Guide: Upgrading, 0.61.0 → 0.74.0 (docs/guide/upgrading.md)
7
7
 
8
8
  ==============================================================================
9
- # Guide: Upgrading, 0.61.0 → 0.73.0 (docs/guide/upgrading.md)
9
+ # Guide: Upgrading, 0.61.0 → 0.74.0 (docs/guide/upgrading.md)
10
10
  ==============================================================================
11
11
 
12
+ ## Released migration: 0.74.0
13
+
14
+ One change, and it only reaches you if you catch a refusal the **client** raised — one it made while
15
+ planning the request, before anything was sent. A server refusal is unchanged.
16
+
17
+ ### If you match on the text of a client-side refusal
18
+
19
+ A missing path param, a missing scoped prefix key, a non-flat field in a `GET` input, a missing or
20
+ invalid multipart file: each used to arrive as a plain `Error` carrying only a sentence. They now
21
+ arrive as an `ApiError` in the same shape a server validation failure uses.
22
+
23
+ ```ts
24
+ // before
25
+ catch (e) {
26
+ if (/Missing path param/.test(e.message)) …
27
+ }
28
+
29
+ // after
30
+ catch (e) {
31
+ if (e.code === 'VALIDATION_ERROR' && e.status === 0) … // refused here, nothing was sent
32
+ }
33
+ // e.details.issues[0].path === 'id'
34
+ ```
35
+
36
+ `status` is what separates the two worlds, and it is not new — `0` has always meant *this never
37
+ reached the server*, as `REQUEST_ABORTED` and `REQUEST_TIMEOUT` already used it:
38
+
39
+ | | `code` | `status` |
40
+ |---|---|---|
41
+ | the client refused your arguments | `VALIDATION_ERROR` | `0` |
42
+ | the server refused your arguments | `VALIDATION_ERROR` | `400` |
43
+
44
+ `details.issues` is the same `{ path, code, message }` array on both, so one rendering serves both —
45
+ and `zodIssues` / `ZodIssueSummary` are now importable from `stitchkit` itself, not only from
46
+ `stitchkit/server`.
47
+
48
+ ### If you are on `createHttpClient` and your call site relied on a synchronous throw
49
+
50
+ This is the sharp one, because it is invisible in a diff. Those refusals used to be thrown
51
+ **synchronously** on the Ky-backed client — before the call returned a promise — so
52
+ `api.upload({}).catch(handler)` never reached the handler, while the same mistake on the bare-fetch
53
+ client rejected normally. They now reject on both.
54
+
55
+ ```ts
56
+ // before, on createHttpClient only
57
+ try {
58
+ api.upload({}) // threw here
59
+ } catch (e) { … }
60
+
61
+ // after, on both transports
62
+ await api.upload({}).catch(handler)
63
+ ```
64
+
65
+ A `try/catch` around an `await`ed call keeps working. A `try/catch` around an un-awaited call no
66
+ longer catches anything — which was already true on the other transport.
67
+
68
+ Not a migration, but worth knowing: a missing multipart file used to be reported as
69
+ `UNKNOWN_ERROR`, the code that means *this client cannot tell you what happened*, on the one refusal
70
+ where it is certain nothing was sent. → ADR 0148 carries the reasoning, including why argument
71
+ validation stays on the server.
72
+
12
73
  ## Released migration: 0.73.0
13
74
 
14
75
  Two breaking changes. Nothing you send to a server changed, and only one of these
@@ -1,14 +1,38 @@
1
- # Upgrading 0.74.0 → 0.101.0 — stitchkit docs slice
1
+ # Upgrading 0.75.0 → 0.102.0 — stitchkit docs slice
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
5
5
 
6
- Contains: Guide: Upgrading, 0.74.0 → 0.101.0 (docs/guide/upgrading.md)
6
+ Contains: Guide: Upgrading, 0.75.0 → 0.102.0 (docs/guide/upgrading.md)
7
7
 
8
8
  ==============================================================================
9
- # Guide: Upgrading, 0.74.0 → 0.101.0 (docs/guide/upgrading.md)
9
+ # Guide: Upgrading, 0.75.0 → 0.102.0 (docs/guide/upgrading.md)
10
10
  ==============================================================================
11
11
 
12
+ ## Released migration: 0.102.0
13
+
14
+ ### `view_file` receives an array, not an array encoded as text
15
+
16
+ **Who must act:** callers sending `paths` as a JSON-encoded array string, or
17
+ matching the former media-extension refusal for that input. Managed MCP,
18
+ Agent and CLI surfaces now reject it as `VALIDATION_ERROR` before IO; raw MCP
19
+ reports an input-validation error. Correct single paths and arrays need no change.
20
+
21
+ ```ts
22
+ // Before
23
+ { paths: '["image.png"]' }
24
+ // After
25
+ { paths: ['image.png'] }
26
+ // One file may also be a string
27
+ { paths: 'image.png' }
28
+ ```
29
+
30
+ The same rule applies to an array element containing another encoded array.
31
+ Do not change generic string-union coercion: path strings remain strings.
32
+ A legitimate filename such as `[preview].PNG` is still accepted. Local
33
+ unsupported-extension errors now include the caller's path and extension;
34
+ match the error code rather than the former generic message.
35
+
12
36
  ## Released migration: 0.101.0
13
37
 
14
38
  ### `TelegramInitDataUser` is `TelegramUser`
@@ -1062,64 +1086,3 @@ schema.
1062
1086
  `stitchkit/live`, the watch hub, the keyspace and the trust fence are all
1063
1087
  additive. Adopt them when you want them; the guide is
1064
1088
  [Live data](./live.md).
1065
-
1066
- ## Released migration: 0.74.0
1067
-
1068
- One change, and it only reaches you if you catch a refusal the **client** raised — one it made while
1069
- planning the request, before anything was sent. A server refusal is unchanged.
1070
-
1071
- ### If you match on the text of a client-side refusal
1072
-
1073
- A missing path param, a missing scoped prefix key, a non-flat field in a `GET` input, a missing or
1074
- invalid multipart file: each used to arrive as a plain `Error` carrying only a sentence. They now
1075
- arrive as an `ApiError` in the same shape a server validation failure uses.
1076
-
1077
- ```ts
1078
- // before
1079
- catch (e) {
1080
- if (/Missing path param/.test(e.message)) …
1081
- }
1082
-
1083
- // after
1084
- catch (e) {
1085
- if (e.code === 'VALIDATION_ERROR' && e.status === 0) … // refused here, nothing was sent
1086
- }
1087
- // e.details.issues[0].path === 'id'
1088
- ```
1089
-
1090
- `status` is what separates the two worlds, and it is not new — `0` has always meant *this never
1091
- reached the server*, as `REQUEST_ABORTED` and `REQUEST_TIMEOUT` already used it:
1092
-
1093
- | | `code` | `status` |
1094
- |---|---|---|
1095
- | the client refused your arguments | `VALIDATION_ERROR` | `0` |
1096
- | the server refused your arguments | `VALIDATION_ERROR` | `400` |
1097
-
1098
- `details.issues` is the same `{ path, code, message }` array on both, so one rendering serves both —
1099
- and `zodIssues` / `ZodIssueSummary` are now importable from `stitchkit` itself, not only from
1100
- `stitchkit/server`.
1101
-
1102
- ### If you are on `createHttpClient` and your call site relied on a synchronous throw
1103
-
1104
- This is the sharp one, because it is invisible in a diff. Those refusals used to be thrown
1105
- **synchronously** on the Ky-backed client — before the call returned a promise — so
1106
- `api.upload({}).catch(handler)` never reached the handler, while the same mistake on the bare-fetch
1107
- client rejected normally. They now reject on both.
1108
-
1109
- ```ts
1110
- // before, on createHttpClient only
1111
- try {
1112
- api.upload({}) // threw here
1113
- } catch (e) { … }
1114
-
1115
- // after, on both transports
1116
- await api.upload({}).catch(handler)
1117
- ```
1118
-
1119
- A `try/catch` around an `await`ed call keeps working. A `try/catch` around an un-awaited call no
1120
- longer catches anything — which was already true on the other transport.
1121
-
1122
- Not a migration, but worth knowing: a missing multipart file used to be reported as
1123
- `UNKNOWN_ERROR`, the code that means *this client cannot tell you what happened*, on the one refusal
1124
- where it is certain nothing was sent. → ADR 0148 carries the reasoning, including why argument
1125
- validation stays on the server.
@@ -11,8 +11,8 @@ Contains: Guide: Upgrading, general (docs/guide/upgrading.md)
11
11
 
12
12
  Load this slice, then every range slice between your installed version and the target:
13
13
 
14
- - 0.74.0 → 0.101.0: `llms/upgrading-0.74.0-0.101.0.txt`
15
- - 0.61.0 → 0.73.0: `llms/upgrading-0.61.0-0.73.0.txt`
14
+ - 0.75.0 → 0.102.0: `llms/upgrading-0.75.0-0.102.0.txt`
15
+ - 0.61.0 → 0.74.0: `llms/upgrading-0.61.0-0.74.0.txt`
16
16
  - 0.44.0 → 0.60.0: `llms/upgrading-0.44.0-0.60.0.txt`
17
17
  - 0.37.0 → 0.37.0: `llms/upgrading-0.37.0.txt`
18
18
 
package/llms-full.txt CHANGED
@@ -70,12 +70,12 @@ own, recorded as an ADR.
70
70
  | `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
71
71
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
72
72
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
73
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 46 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
73
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 47 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
74
74
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, plus the managed-resource conformance kit |
75
75
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
76
76
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
77
77
  | `stitchkit/react/keyboard` | browser | evolving | which part of a screen gets a key — ordered layers, one Escape per level, list zones with real focus; see [keyboard guide](keyboard.md) |
78
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 22 of the 46 minors since 0.56.2, most recently 0.97.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
78
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 22 of the 47 minors since 0.56.2, most recently 0.97.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
79
79
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
80
80
  | `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults, deterministic race controls and the agent-store conformance kit |
81
81
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -85,7 +85,7 @@ own, recorded as an ADR.
85
85
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
86
86
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
87
87
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
88
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 10 of the 46 minors since 0.56.2, most recently 0.100.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
88
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 10 of the 47 minors since 0.56.2, most recently 0.100.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
89
89
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
90
90
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
91
91
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
@@ -4777,6 +4777,15 @@ multimodal content beside structured per-item `errors`, and charges every item
4777
4777
  to one total 20 MB batch budget. Its MCP and Agent presenters are built in;
4778
4778
  remote fetch cancellation follows the active call signal.
4779
4779
 
4780
+ `paths` is one path/URL string or an actual array of strings (at most 20).
4781
+ Pass `{ paths: ['image.png'] }`, not `{ paths: '["image.png"]' }`: a JSON
4782
+ array written as text fails input validation before any file or network access,
4783
+ with the hint `paths is a list written as text — pass an array of paths or one
4784
+ path`. The same rule applies to array items and the raw `mountViewFile` input.
4785
+ Ordinary file names containing brackets, such as `[preview].png`, remain valid.
4786
+ A local file with an unsupported extension is refused before reading; its
4787
+ per-item error identifies the caller's path and the extension it saw.
4788
+
4780
4789
  The older `mountWait`, `mountDownload`, `mountUpload` and `mountViewFile`
4781
4790
  functions remain
4782
4791
  intentional raw MCP adapters with their text-envelope behavior. Use them under
@@ -14229,6 +14238,31 @@ analytics policy belong to the application.
14229
14238
 
14230
14239
  # Upgrading stitchkit
14231
14240
 
14241
+ ## Released migration: 0.102.0
14242
+
14243
+ ### `view_file` receives an array, not an array encoded as text
14244
+
14245
+ **Who must act:** callers sending `paths` as a JSON-encoded array string, or
14246
+ matching the former media-extension refusal for that input. Managed MCP,
14247
+ Agent and CLI surfaces now reject it as `VALIDATION_ERROR` before IO; raw MCP
14248
+ reports an input-validation error. Correct single paths and arrays need no change.
14249
+
14250
+ ```ts
14251
+ // Before
14252
+ { paths: '["image.png"]' }
14253
+ // After
14254
+ { paths: ['image.png'] }
14255
+ // One file may also be a string
14256
+ { paths: 'image.png' }
14257
+ ```
14258
+
14259
+ The same rule applies to an array element containing another encoded array.
14260
+ Do not change generic string-union coercion: path strings remain strings.
14261
+ A legitimate filename such as `[preview].PNG` is still accepted. Local
14262
+ unsupported-extension errors now include the caller's path and extension;
14263
+ match the error code rather than the former generic message.
14264
+
14265
+
14232
14266
  ## Released migration: 0.101.0
14233
14267
 
14234
14268
  ### `TelegramInitDataUser` is `TelegramUser`
@@ -19769,7 +19803,7 @@ payload.
19769
19803
  | `ToolCallContext` | _type_ | the context every tool hook receives — `{ source, mcp? }` plus whatever the mount's `context` added |
19770
19804
  | `ViewFileOptions` | _type_ | shared URL/managed-file-boundary policy for `defineViewFileTool`, `mountViewFile` and `resolveMedia` |
19771
19805
  | `ViewFileOutput` | _type_ | neutral managed batch result with multimodal `content` and per-item `errors` |
19772
- | `ViewFileInputSchema` | constant | fixed one-or-many media path/URL input schema |
19806
+ | `ViewFileInputSchema` | constant | one media path/URL or an array of at most 20; rejects a JSON array written as text, including in array items, before IO |
19773
19807
  | `ViewFileOutputSchema` | constant | Zod schema for the neutral managed view-file batch result |
19774
19808
  | `ViewFileErrorSchema` | constant | Zod schema for one structured per-item view failure |
19775
19809
  | `McpAnnotations` | _type_ | MCP annotations on a media result |
package/llms.txt CHANGED
@@ -13,7 +13,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
13
13
  - **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.6 KB
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 9.0 KB
15
15
  - **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 9.4 KB
16
- - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 45.0 KB → [llms/tools.2.txt](llms/tools.2.txt) 26.3 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.4 KB
16
+ - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 45.0 KB → [llms/tools.2.txt](llms/tools.2.txt) 26.9 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.4 KB
17
17
  - **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
18
18
  - **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
19
19
  - **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 3.1 KB
@@ -55,8 +55,8 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
55
55
 
56
56
  ## Upgrading slices
57
57
  - **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 10.3 KB
58
- - **Upgrading 0.74.0 → 0.101.0**: [llms/upgrading-0.74.0-0.101.0.txt](llms/upgrading-0.74.0-0.101.0.txt) 46.3 KB
59
- - **Upgrading 0.61.0 → 0.73.0**: [llms/upgrading-0.61.0-0.73.0.txt](llms/upgrading-0.61.0-0.73.0.txt) 41.2 KB
58
+ - **Upgrading 0.75.0 → 0.102.0**: [llms/upgrading-0.75.0-0.102.0.txt](llms/upgrading-0.75.0-0.102.0.txt) 44.8 KB
59
+ - **Upgrading 0.61.0 → 0.74.0**: [llms/upgrading-0.61.0-0.74.0.txt](llms/upgrading-0.61.0-0.74.0.txt) 43.5 KB
60
60
  - **Upgrading 0.44.0 → 0.60.0**: [llms/upgrading-0.44.0-0.60.0.txt](llms/upgrading-0.44.0-0.60.0.txt) 43.9 KB
61
61
  - **Upgrading 0.37.0 → 0.37.0**: [llms/upgrading-0.37.0.txt](llms/upgrading-0.37.0.txt) 6.2 KB
62
62
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.101.3",
3
+ "version": "0.102.0",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",