stitchkit 0.123.7 → 0.124.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,35 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.124.0] - 2026-11-17
19
+
20
+ ### ⚠️ Breaking changes
21
+
22
+ **Who must act:** code that builds or reads an `image` or `audio` block of `McpMediaContentSchema` with a `name` — a tool that returns such a block, or a reader of a `defineViewFileTool`, `mountViewFile` or `resolveMedia` result. See the migration: [media-block-file-name](docs/guide/upgrading.md#media-block-file-name).
23
+
24
+ - `stitchkit/tools`, `stitchkit/tools/contract` — **the file name of an image or audio block
25
+ lives in its `_meta`, and the block has no `name`.** MCP's `ImageContent` and `AudioContent`
26
+ declare no file name, and the MCP server SDK drops a field they do not declare from `content`
27
+ before a result is sent: the `name` added in 0.123.7 reached `structuredContent` and an Agent,
28
+ and never a host reading `content` or a caller of the raw `mountViewFile`. A block of
29
+ `McpMediaContentSchema` is now the protocol's block field for field — `type`, `data`,
30
+ `mimeType`, `annotations`, `_meta` — and the name is `_meta['stitchkit/fileName']`, exported
31
+ as `MCP_FILE_NAME_META_KEY`. `defineViewFileTool`, `mountViewFile` and `resolveMedia` set it;
32
+ the handler output, the Agent result, `structuredContent` and MCP `content` carry the same
33
+ block. A `name` on a block is not read any more: the schema drops it, and a TypeScript object
34
+ typed `McpMediaContent` does not compile with it.
35
+ Before: `{ type: 'image', data, mimeType, name: 'shot.png' }`. After: `{ type: 'image', data, mimeType, _meta: { [MCP_FILE_NAME_META_KEY]: 'shot.png' } }`.
36
+ [migration](docs/guide/upgrading.md#media-block-file-name). → ADR 0292
37
+ **Affects:** `stitchkit/tools` McpMediaContentSchema, McpMediaContent, ViewFileOutputSchema, ViewFileOutput, defineViewFileTool, mountViewFile, resolveMedia; `stitchkit/tools/contract` McpMediaContentSchema, McpMediaContent, ViewFileOutputSchema, ViewFileOutput
38
+
39
+ ### Fixed
40
+
41
+ - `stitchkit/cli` — **`--output-dir` saves the media of a raw `mountViewFile` under its source
42
+ name through an MCP connection.** That result has no `structuredContent`, so the name the
43
+ block lost on the wire left the file named `image-<sha256>.png`. The CLI reads the name where
44
+ the block now carries it, `_meta['stitchkit/fileName']`.
45
+ **Affects:** `stitchkit/cli` behaviour
46
+
18
47
  ## [0.123.7] - 2026-11-17
19
48
 
20
49
  ### Added
@@ -17,7 +17,7 @@ import {
17
17
  renderCliView2,
18
18
  pollUntilDone2,
19
19
  createCli2
20
- } from "../index-1a741dpf.js";
20
+ } from "../index-q89kd1xc.js";
21
21
  import"../index-ndjzbt2v.js";
22
22
  import"../index-ct75c3at.js";
23
23
  import"../index-tynna0n4.js";
@@ -26,7 +26,7 @@ import"../index-yt1gg11x.js";
26
26
  import"../index-qc7tq0za.js";
27
27
  import"../index-332d0m9g.js";
28
28
  import"../index-sqc6ezrb.js";
29
- import"../index-bknzva6n.js";
29
+ import"../index-gy9x38a2.js";
30
30
  import"../index-0v9xb8pz.js";
31
31
  import {
32
32
  CliBuildSignatureSchema2,
@@ -25,5 +25,5 @@
25
25
  */
26
26
  export { type AsyncOperationCancelResult, AsyncOperationCancelResultSchema, type AsyncOperationCapability, type AsyncOperationSnapshotSchema, type AsyncOperationSnapshotSchemaWithProgress, createAsyncOperationSnapshotSchema, } from '../../tools/operations/async-operation-contract.js';
27
27
  export { coerceJsonArgs } from '../../tools/schema/coerce.js';
28
- export { type McpAnnotations, McpAnnotationsSchema, type McpMediaContent, McpMediaContentSchema, ViewFileErrorSchema, ViewFileInputSchema, type ViewFileOutput, ViewFileOutputSchema, } from '../../tools/transfer/view-file-contract.js';
28
+ export { MCP_FILE_NAME_META_KEY, type McpAnnotations, McpAnnotationsSchema, type McpMediaContent, McpMediaContentSchema, ViewFileErrorSchema, ViewFileInputSchema, type ViewFileOutput, ViewFileOutputSchema, } from '../../tools/transfer/view-file-contract.js';
29
29
  //# sourceMappingURL=contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/tools/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,wCAAwC,EAC7C,kCAAkC,GACnC,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,eAAe,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/tools/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,wCAAwC,EAC7C,kCAAkC,GACnC,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,sBAAsB,EACtB,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,eAAe,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,yCAAyC,CAAC"}
@@ -4,17 +4,19 @@ import {
4
4
  } from "../../index-81t0bf0f.js";
5
5
  import {
6
6
  McpAnnotationsSchema2,
7
+ MCP_FILE_NAME_META_KEY2,
7
8
  McpMediaContentSchema2,
8
9
  ViewFileErrorSchema2,
9
10
  ViewFileOutputSchema2,
10
11
  ViewFileInputSchema2
11
- } from "../../index-bknzva6n.js";
12
+ } from "../../index-gy9x38a2.js";
12
13
  import {
13
14
  coerceJsonArgs2
14
15
  } from "../../index-t8jz0e20.js";
15
16
  import"../../index-dsa676h8.js";
16
17
  export {
17
18
  AsyncOperationCancelResultSchema2 as AsyncOperationCancelResultSchema,
19
+ MCP_FILE_NAME_META_KEY2 as MCP_FILE_NAME_META_KEY,
18
20
  McpAnnotationsSchema2 as McpAnnotationsSchema,
19
21
  McpMediaContentSchema2 as McpMediaContentSchema,
20
22
  ViewFileErrorSchema2 as ViewFileErrorSchema,
@@ -11,10 +11,10 @@ import {
11
11
  } from "../../index-yebkpytc.js";
12
12
  import {
13
13
  createCli2
14
- } from "../../index-1a741dpf.js";
14
+ } from "../../index-q89kd1xc.js";
15
15
  import"../../index-332d0m9g.js";
16
16
  import"../../index-sqc6ezrb.js";
17
- import"../../index-bknzva6n.js";
17
+ import"../../index-gy9x38a2.js";
18
18
  import"../../index-0v9xb8pz.js";
19
19
  import {
20
20
  mountMcp2,
@@ -38,7 +38,7 @@ export { type DefineUploadToolConfig, defineUploadTool, UploadToolInputSchema, }
38
38
  export { type DefineViewFileToolConfig, defineViewFileTool, } from '../tools/transfer/define-view-file-tool.js';
39
39
  export { type DownloadToolConfig, mountDownload } from '../tools/transfer/mount-download.js';
40
40
  export { mountUpload, type UploadToolConfig } from '../tools/transfer/mount-upload.js';
41
- export { mountViewFile, resolveMedia, type ViewFileOptions, } from '../tools/transfer/view-file.js';
41
+ export { MCP_FILE_NAME_META_KEY, mountViewFile, resolveMedia, type ViewFileOptions, } from '../tools/transfer/view-file.js';
42
42
  export { summarizeTransports, type TransportCounts, type TransportSummary, } from '../tools/transports.js';
43
43
  export * from './tools/contract.js';
44
44
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/entrypoints/tools.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,yBAAyB,EACzB,KAAK,c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Y2,
48
49
  McpMediaContentSchema2,
49
50
  ViewFileErrorSchema2,
50
51
  ViewFileOutputSchema2,
51
52
  ViewFileInputSchema2
52
- } from "../index-bknzva6n.js";
53
+ } from "../index-gy9x38a2.js";
53
54
  import {
54
55
  signJwt2,
55
56
  verifyPkce2
@@ -1625,6 +1626,13 @@ function isHttpUrl(pathOrUrl) {
1625
1626
  function sourceName(pathOrUrl, mimeType) {
1626
1627
  return isHttpUrl(pathOrUrl) ? downloadFileName(pathOrUrl, mimeType) : basename2(pathOrUrl);
1627
1628
  }
1629
+ function inlineBlockType(mimeType) {
1630
+ if (mimeType.startsWith("image/"))
1631
+ return "image";
1632
+ if (mimeType.startsWith("audio/"))
1633
+ return "audio";
1634
+ return;
1635
+ }
1628
1636
  async function fetchSource(pathOrUrl, options, maxBytes) {
1629
1637
  const extension = extname2(pathOrUrl);
1630
1638
  const extMime = EXT_MIME[extension.toLowerCase()];
@@ -1714,38 +1722,24 @@ async function resolveMediaWithinBudget(pathOrUrl, options, maxBytes) {
1714
1722
  }
1715
1723
  const { buffer, mimeType } = result;
1716
1724
  const sizeKb = (buffer.length / 1024).toFixed(0);
1717
- if (mimeType.startsWith("image/")) {
1725
+ const type = inlineBlockType(mimeType);
1726
+ if (type === undefined) {
1718
1727
  return {
1719
- content: [
1720
- {
1721
- type: "image",
1722
- data: buffer.toString("base64"),
1723
- mimeType,
1724
- name: sourceName(pathOrUrl, mimeType),
1725
- annotations: { audience: ["user", "assistant"], priority: 0.9 }
1726
- },
1727
- { type: "text", text: `[image] ${mimeType}, ${sizeKb}KB` }
1728
- ],
1729
- bytes: buffer.length
1730
- };
1731
- }
1732
- if (mimeType.startsWith("audio/")) {
1733
- return {
1734
- content: [
1735
- {
1736
- type: "audio",
1737
- data: buffer.toString("base64"),
1738
- mimeType,
1739
- name: sourceName(pathOrUrl, mimeType),
1740
- annotations: { audience: ["user", "assistant"], priority: 0.9 }
1741
- },
1742
- { type: "text", text: `[audio] ${mimeType}, ${sizeKb}KB` }
1743
- ],
1728
+ content: [{ type: "text", text: `[${mimeType}] ${sizeKb}KB — ${pathOrUrl}` }],
1744
1729
  bytes: buffer.length
1745
1730
  };
1746
1731
  }
1747
1732
  return {
1748
- content: [{ type: "text", text: `[${mimeType}] ${sizeKb}KB — ${pathOrUrl}` }],
1733
+ content: [
1734
+ {
1735
+ type,
1736
+ data: buffer.toString("base64"),
1737
+ mimeType,
1738
+ annotations: { audience: ["user", "assistant"], priority: 0.9 },
1739
+ _meta: { [MCP_FILE_NAME_META_KEY2]: sourceName(pathOrUrl, mimeType) }
1740
+ },
1741
+ { type: "text", text: `[${type}] ${mimeType}, ${sizeKb}KB` }
1742
+ ],
1749
1743
  bytes: buffer.length
1750
1744
  };
1751
1745
  }
@@ -1950,6 +1944,7 @@ export {
1950
1944
  AgentToolError2 as AgentToolError,
1951
1945
  AsyncOperationCancelResultSchema2 as AsyncOperationCancelResultSchema,
1952
1946
  EffectUnresolvedError2 as EffectUnresolvedError,
1947
+ MCP_FILE_NAME_META_KEY2 as MCP_FILE_NAME_META_KEY,
1953
1948
  McpAnnotationsSchema2 as McpAnnotationsSchema,
1954
1949
  McpMediaContentSchema2 as McpMediaContentSchema,
1955
1950
  PORTABLE_JSON_SCHEMA_FORMATS2 as PORTABLE_JSON_SCHEMA_FORMATS,
@@ -5,11 +5,12 @@ var McpAnnotationsSchema2 = z.object({
5
5
  audience: z.array(z.enum(["user", "assistant"])).optional(),
6
6
  priority: z.number().optional()
7
7
  });
8
+ var MCP_FILE_NAME_META_KEY2 = "stitchkit/fileName";
8
9
  var inlineMediaShape = {
9
10
  data: z.string(),
10
11
  mimeType: z.string(),
11
- name: z.string().optional(),
12
- annotations: McpAnnotationsSchema2.optional()
12
+ annotations: McpAnnotationsSchema2.optional(),
13
+ _meta: z.record(z.string(), z.unknown()).optional()
13
14
  };
14
15
  var McpImageContentSchema = z.object({
15
16
  type: z.literal("image"),
@@ -36,4 +37,4 @@ var ViewFileInputSchema2 = z.object({
36
37
  paths: z.union([z.string(), z.array(z.string()).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.")
37
38
  });
38
39
 
39
- export { McpAnnotationsSchema2, McpImageContentSchema, McpAudioContentSchema, McpMediaContentSchema2, ViewFileErrorSchema2, ViewFileOutputSchema2, ViewFileInputSchema2 };
40
+ export { McpAnnotationsSchema2, MCP_FILE_NAME_META_KEY2, McpImageContentSchema, McpAudioContentSchema, McpMediaContentSchema2, ViewFileErrorSchema2, ViewFileOutputSchema2, ViewFileInputSchema2 };
@@ -31,9 +31,10 @@ import {
31
31
  isRepeatableRead
32
32
  } from "./index-332d0m9g.js";
33
33
  import {
34
+ MCP_FILE_NAME_META_KEY2,
34
35
  McpImageContentSchema,
35
36
  McpAudioContentSchema
36
- } from "./index-bknzva6n.js";
37
+ } from "./index-gy9x38a2.js";
37
38
  import {
38
39
  readContractStreamItems,
39
40
  contractStreamLifetimeExceeded
@@ -1021,9 +1022,14 @@ function uriFileName(uri) {
1021
1022
  function inlineFileMimeType(file) {
1022
1023
  return file.type === "resource" ? file.resource.mimeType : file.mimeType;
1023
1024
  }
1025
+ function ownFileName(file) {
1026
+ if (file.type === "resource")
1027
+ return uriFileName(file.resource.uri) || undefined;
1028
+ const name = file._meta?.[MCP_FILE_NAME_META_KEY2];
1029
+ return typeof name === "string" ? name : undefined;
1030
+ }
1024
1031
  function inlineFileName(file, digest) {
1025
- const own = file.type === "resource" ? uriFileName(file.resource.uri) || undefined : file.name;
1026
- return own ?? `${file.type}-${digest}${mediaExtension(inlineFileMimeType(file) ?? "") ?? ".bin"}`;
1032
+ return ownFileName(file) ?? `${file.type}-${digest}${mediaExtension(inlineFileMimeType(file) ?? "") ?? ".bin"}`;
1027
1033
  }
1028
1034
  function linkSavedFiles(data, blocks, saved) {
1029
1035
  if (!isRecord(data) || !Array.isArray(data.content))
@@ -2,7 +2,6 @@ import { z } from 'zod';
2
2
  declare const InlineFileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
3
  data: z.ZodString;
4
4
  mimeType: z.ZodString;
5
- name: z.ZodOptional<z.ZodString>;
6
5
  annotations: z.ZodOptional<z.ZodObject<{
7
6
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
8
7
  assistant: "assistant";
@@ -10,11 +9,11 @@ declare const InlineFileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
10
9
  }>>>;
11
10
  priority: z.ZodOptional<z.ZodNumber>;
12
11
  }, z.core.$strip>>;
12
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
13
  type: z.ZodLiteral<"image">;
14
14
  }, z.core.$strip>, z.ZodObject<{
15
15
  data: z.ZodString;
16
16
  mimeType: z.ZodString;
17
- name: z.ZodOptional<z.ZodString>;
18
17
  annotations: z.ZodOptional<z.ZodObject<{
19
18
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
20
19
  assistant: "assistant";
@@ -22,6 +21,7 @@ declare const InlineFileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
22
21
  }>>>;
23
22
  priority: z.ZodOptional<z.ZodNumber>;
24
23
  }, z.core.$strip>>;
24
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
25
25
  type: z.ZodLiteral<"audio">;
26
26
  }, z.core.$strip>, z.ZodObject<{
27
27
  type: z.ZodLiteral<"resource">;
@@ -52,9 +52,9 @@ export declare function inlineFileBlocks(data: unknown): InlineFileBlock[];
52
52
  export declare function inlineFileBytes(file: InlineFile, maxBytes: number): Buffer;
53
53
  export declare function inlineFileMimeType(file: InlineFile): string | undefined;
54
54
  /**
55
- * The file name of a block: a media block's `name` or the file name in a resource's URI.
56
- * A block that names no file is `<type>-<sha256 of its bytes><extension>`; a media block
57
- * that names an empty one is refused by the writer like any other unusable name.
55
+ * The file name of a block: a media block's `_meta` file name or the file name in a
56
+ * resource's URI. A block that names no file is `<type>-<sha256 of its bytes><extension>`;
57
+ * a media block that names an empty one is refused by the writer like any other unusable name.
58
58
  */
59
59
  export declare function inlineFileName(file: InlineFile, digest: string): string;
60
60
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"inline-files.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/inline-files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAIpB,CAAC;AAEH,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEnD,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,EAAE,CAMjE;AAgCD,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK1E;AAWD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,KAAK,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAC1F,OAAO,CAiBT"}
1
+ {"version":3,"file":"inline-files.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/inline-files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAIpB,CAAC;AAEH,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEnD,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,EAAE,CAMjE;AAgCD,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK1E;AAWD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAEvE;AASD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAKvE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,KAAK,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAC1F,OAAO,CAiBT"}
@@ -27,10 +27,20 @@ export declare const McpAnnotationsSchema: z.ZodObject<{
27
27
  priority: z.ZodOptional<z.ZodNumber>;
28
28
  }, z.core.$strip>;
29
29
  export type McpAnnotations = z.infer<typeof McpAnnotationsSchema>;
30
+ /**
31
+ * The `_meta` key under which an image or audio block carries the file name of its
32
+ * source. A consumer that saves the bytes saves them under it, as a CLI's
33
+ * `--output-dir` does.
34
+ *
35
+ * MCP's `ImageContent` and `AudioContent` have no field for a file name, and the
36
+ * official SDK drops a field the protocol does not declare from `content` before it
37
+ * is sent. `_meta` is the protocol's place for what a block carries beyond it, and
38
+ * the key is namespaced because that place is shared.
39
+ */
40
+ export declare const MCP_FILE_NAME_META_KEY = "stitchkit/fileName";
30
41
  export declare const McpImageContentSchema: z.ZodObject<{
31
42
  data: z.ZodString;
32
43
  mimeType: z.ZodString;
33
- name: z.ZodOptional<z.ZodString>;
34
44
  annotations: z.ZodOptional<z.ZodObject<{
35
45
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
36
46
  assistant: "assistant";
@@ -38,12 +48,12 @@ export declare const McpImageContentSchema: z.ZodObject<{
38
48
  }>>>;
39
49
  priority: z.ZodOptional<z.ZodNumber>;
40
50
  }, z.core.$strip>>;
51
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
41
52
  type: z.ZodLiteral<"image">;
42
53
  }, z.core.$strip>;
43
54
  export declare const McpAudioContentSchema: z.ZodObject<{
44
55
  data: z.ZodString;
45
56
  mimeType: z.ZodString;
46
- name: z.ZodOptional<z.ZodString>;
47
57
  annotations: z.ZodOptional<z.ZodObject<{
48
58
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
49
59
  assistant: "assistant";
@@ -51,6 +61,7 @@ export declare const McpAudioContentSchema: z.ZodObject<{
51
61
  }>>>;
52
62
  priority: z.ZodOptional<z.ZodNumber>;
53
63
  }, z.core.$strip>>;
64
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
54
65
  type: z.ZodLiteral<"audio">;
55
66
  }, z.core.$strip>;
56
67
  /** An MCP content block — text / image / audio (video cannot be inlined). */
@@ -60,7 +71,6 @@ export declare const McpMediaContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject
60
71
  }, z.core.$strip>, z.ZodObject<{
61
72
  data: z.ZodString;
62
73
  mimeType: z.ZodString;
63
- name: z.ZodOptional<z.ZodString>;
64
74
  annotations: z.ZodOptional<z.ZodObject<{
65
75
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
66
76
  assistant: "assistant";
@@ -68,11 +78,11 @@ export declare const McpMediaContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject
68
78
  }>>>;
69
79
  priority: z.ZodOptional<z.ZodNumber>;
70
80
  }, z.core.$strip>>;
81
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
71
82
  type: z.ZodLiteral<"image">;
72
83
  }, z.core.$strip>, z.ZodObject<{
73
84
  data: z.ZodString;
74
85
  mimeType: z.ZodString;
75
- name: z.ZodOptional<z.ZodString>;
76
86
  annotations: z.ZodOptional<z.ZodObject<{
77
87
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
78
88
  assistant: "assistant";
@@ -80,6 +90,7 @@ export declare const McpMediaContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject
80
90
  }>>>;
81
91
  priority: z.ZodOptional<z.ZodNumber>;
82
92
  }, z.core.$strip>>;
93
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
83
94
  type: z.ZodLiteral<"audio">;
84
95
  }, z.core.$strip>], "type">;
85
96
  export type McpMediaContent = z.infer<typeof McpMediaContentSchema>;
@@ -94,7 +105,6 @@ export declare const ViewFileOutputSchema: z.ZodObject<{
94
105
  }, z.core.$strip>, z.ZodObject<{
95
106
  data: z.ZodString;
96
107
  mimeType: z.ZodString;
97
- name: z.ZodOptional<z.ZodString>;
98
108
  annotations: z.ZodOptional<z.ZodObject<{
99
109
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
100
110
  assistant: "assistant";
@@ -102,11 +112,11 @@ export declare const ViewFileOutputSchema: z.ZodObject<{
102
112
  }>>>;
103
113
  priority: z.ZodOptional<z.ZodNumber>;
104
114
  }, z.core.$strip>>;
115
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
105
116
  type: z.ZodLiteral<"image">;
106
117
  }, z.core.$strip>, z.ZodObject<{
107
118
  data: z.ZodString;
108
119
  mimeType: z.ZodString;
109
- name: z.ZodOptional<z.ZodString>;
110
120
  annotations: z.ZodOptional<z.ZodObject<{
111
121
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
112
122
  assistant: "assistant";
@@ -114,6 +124,7 @@ export declare const ViewFileOutputSchema: z.ZodObject<{
114
124
  }>>>;
115
125
  priority: z.ZodOptional<z.ZodNumber>;
116
126
  }, z.core.$strip>>;
127
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
117
128
  type: z.ZodLiteral<"audio">;
118
129
  }, z.core.$strip>], "type">>;
119
130
  errors: z.ZodArray<z.ZodObject<{
@@ -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;AAclE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAGhC,CAAC;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAGhC,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAIhC,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;;iBAM9B,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;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAe3D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAGhC,CAAC;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAGhC,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAIhC,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;;iBAM9B,CAAC"}
@@ -16,7 +16,7 @@ import type { McpServer } from '@modelcontextprotocol/server';
16
16
  import { z } from 'zod';
17
17
  import type { McpMediaContent, ViewFileOutput } from './view-file-contract.js';
18
18
  import { ViewFileInputSchema } from './view-file-contract.js';
19
- export { type McpAnnotations, McpAnnotationsSchema, type McpMediaContent, McpMediaContentSchema, ViewFileErrorSchema, ViewFileInputSchema, type ViewFileOutput, ViewFileOutputSchema, } from './view-file-contract.js';
19
+ export { MCP_FILE_NAME_META_KEY, type McpAnnotations, McpAnnotationsSchema, type McpMediaContent, McpMediaContentSchema, ViewFileErrorSchema, ViewFileInputSchema, type ViewFileOutput, ViewFileOutputSchema, } from './view-file-contract.js';
20
20
  import { type ManagedFileBoundary } from '../../files/boundary.js';
21
21
  export interface ViewFileOptions {
22
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"view-file.d.ts","sourceRoot":"","sources":["../../../src/tools/transfer/view-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAwB,MAAM,sBAAsB,CAAC;AAEjF,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,eAAe,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,KAAK,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AA2BlF,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmLD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,eAAe,EAAE,CAAC,CAE5B;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,CAAC,CA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AAC,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,CAyBpF"}
package/llms/cli.txt CHANGED
@@ -692,7 +692,7 @@ Three kinds of block hold a file, and the file may be of any type:
692
692
 
693
693
  | Block | Bytes | File name |
694
694
  | --- | --- | --- |
695
- | `image`, `audio` (`McpMediaContentSchema`) | standard base64 in `data` | `name` |
695
+ | `image`, `audio` (`McpMediaContentSchema`) | standard base64 in `data` | `_meta['stitchkit/fileName']` |
696
696
  | `resource` with `blob` — a PDF, a spreadsheet, an archive | standard base64 in `resource.blob` | last path segment of `resource.uri` |
697
697
  | `resource` with `text` — CSV, Markdown, JSON | `resource.text` as UTF-8 | last path segment of `resource.uri` |
698
698
 
@@ -701,7 +701,8 @@ rich-text node that also calls itself `image`, a `resource` without content —
701
701
  own data and is left alone.
702
702
 
703
703
  **Names.** A name is reduced to its basename, like a URL download name;
704
- `defineViewFileTool` sets `name` to the file name of the source. A block that names no file
704
+ `defineViewFileTool` and `mountViewFile` set a media block's `_meta['stitchkit/fileName']`
705
+ (`MCP_FILE_NAME_META_KEY`) to the file name of the source. A block that names no file
705
706
  is `<type>-<sha256-of-its-bytes><extension>`: known media types supply the extension and
706
707
  the rest use `.bin`. A name is written once per batch. The same bytes under the same name
707
708
  are one file; different bytes under a name the batch already wrote fail that file, and the
@@ -94,13 +94,13 @@ own, recorded as an ADR.
94
94
  | `stitchkit/xlsx` | browser **and** server | evolving | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
95
95
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
96
96
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
97
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 68 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
97
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 69 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
98
98
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, the managed-resource conformance kit and manual time for schedules and retries |
99
99
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
100
100
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
101
101
  | `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) |
102
102
  | `stitchkit/react/keyboard/testing` | server (Bun or Node) | evolving | the keyboard layers and zones without a DOM — fakes for the window, elements and key events beside the two engines, to test the order of layers, `scope`/`inert` and the edges of a zone in milliseconds |
103
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 26 of the 68 minors since 0.56.2, most recently 0.121.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
103
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 26 of the 69 minors since 0.56.2, most recently 0.121.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
104
104
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
105
105
  | `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 |
106
106
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -112,7 +112,7 @@ own, recorded as an ADR.
112
112
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
113
113
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
114
114
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
115
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 68 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
115
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 69 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
116
116
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
117
117
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
118
118
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
package/llms/tools.2.txt CHANGED
@@ -556,10 +556,16 @@ Ordinary file names containing brackets, such as `[preview].png`, remain valid.
556
556
  A local file with an unsupported extension is refused before reading; its
557
557
  per-item error identifies the caller's path and the extension it saw.
558
558
 
559
- Each inline `image` and `audio` block carries `name`, the file name of its
560
- source: a managed file keeps its own name, a URL takes its download name — the
561
- path's base name with the body's extension. A CLI saves the block under that
562
- name with [`--output-dir`](cli.md#saving-result-media).
559
+ Each inline `image` and `audio` block carries the file name of its source in
560
+ `_meta['stitchkit/fileName']` (`MCP_FILE_NAME_META_KEY`): a managed file keeps
561
+ its own name, a URL takes its download name — the path's base name with the
562
+ body's extension. MCP declares no file name on `ImageContent` or `AudioContent`,
563
+ and the MCP server SDK drops an undeclared field from `content`, so the name is
564
+ in `_meta`, the protocol's place for what a block carries beyond it. The block
565
+ is therefore the same in the handler's output, an Agent's result,
566
+ `structuredContent` and MCP `content`, and a host reads the name from the block
567
+ it renders. A CLI saves the block under that name with
568
+ [`--output-dir`](cli.md#saving-result-media).
563
569
 
564
570
  The older `mountWait`, `mountDownload`, `mountUpload` and `mountViewFile`
565
571
  functions remain
package/llms/tools.3.txt CHANGED
@@ -83,7 +83,8 @@ server SDK), [`stitchkit/tools/agent`](#stitchkittoolsagent) (the `ai` peer) and
83
83
  | `ViewFileErrorSchema` | constant | Zod schema for one structured per-item view failure |
84
84
  | `McpAnnotations` | _type_ | MCP annotations on a media result |
85
85
  | `McpAnnotationsSchema` | constant | Zod schema for MCP media annotations |
86
- | `McpMediaContentSchema` | constant | Zod schema for text/image/audio media content |
86
+ | `McpMediaContentSchema` | constant | Zod schema for text/image/audio media content — the blocks MCP declares, field for field |
87
+ | `MCP_FILE_NAME_META_KEY` | constant | the namespaced `_meta` key (`stitchkit/fileName`) under which an `image` or `audio` block carries the file name of its source |
87
88
  | `CollectToolsConfig` | _type_ | options for `collectTools` |
88
89
  | `findUntypedProperties` | function | every property in a JSON Schema with no `type`/`enum`/`$ref` — what a model is shown and cannot obey ([guide](../guide/mcp-and-agents.md)) |
89
90
  | `UntypedProperty` | _type_ | one such property — `{ path, description? }` |
@@ -1,14 +1,50 @@
1
- # Upgrading 0.106.0 → 0.123.0 — stitchkit docs slice
1
+ # Upgrading 0.106.0 → 0.124.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.106.0 → 0.123.0 (docs/guide/upgrading.md)
6
+ Contains: Guide: Upgrading, 0.106.0 → 0.124.0 (docs/guide/upgrading.md)
7
7
 
8
8
  ==============================================================================
9
- # Guide: Upgrading, 0.106.0 → 0.123.0 (docs/guide/upgrading.md)
9
+ # Guide: Upgrading, 0.106.0 → 0.124.0 (docs/guide/upgrading.md)
10
10
  ==============================================================================
11
11
 
12
+ ## Released migration: 0.124.0
13
+
14
+ ### media-block-file-name
15
+
16
+ **Who must act:** code that builds or reads an `image` or `audio` block of
17
+ `McpMediaContentSchema` with a `name` — a tool that returns such a block, or a reader of a
18
+ `defineViewFileTool`, `mountViewFile` or `resolveMedia` result. The field exists only in 0.123.7.
19
+
20
+ The file name of a media block lives in the block's `_meta`, under the key
21
+ `MCP_FILE_NAME_META_KEY` (`stitchkit/fileName`), and the block has no `name`. The block is now
22
+ exactly what MCP declares, so the same block reaches a handler's caller, an Agent,
23
+ `structuredContent` and MCP `content`; the `name` field never reached `content`.
24
+
25
+ ```ts
26
+ import { MCP_FILE_NAME_META_KEY } from 'stitchkit/tools/contract'
27
+
28
+ // before
29
+ const block = { type: 'image', data, mimeType: 'image/png', name: 'shot.png' }
30
+ const fileName = block.name
31
+
32
+ // after
33
+ const block = {
34
+ type: 'image',
35
+ data,
36
+ mimeType: 'image/png',
37
+ _meta: { [MCP_FILE_NAME_META_KEY]: 'shot.png' },
38
+ }
39
+ const fileName = block._meta?.[MCP_FILE_NAME_META_KEY] // unknown: check it is a string
40
+ ```
41
+
42
+ A block that still carries `name` is not refused: the schema drops the field, and a CLI's
43
+ `--output-dir` then names the file `<type>-<sha256><extension>`. An object typed
44
+ `McpMediaContent` does not compile with `name`, which is where TypeScript code finds every
45
+ site; search untyped code for `name:` beside `type: 'image'` or `type: 'audio'`. A test that
46
+ compared MCP `content` with `structuredContent` minus `name` compares them whole.
47
+
12
48
  ## Released migration: 0.123.0
13
49
 
14
50
  ### unknown-operation
@@ -11,7 +11,7 @@ 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.106.0 → 0.123.0: `llms/upgrading-0.106.0-0.123.0.txt`
14
+ - 0.106.0 → 0.124.0: `llms/upgrading-0.106.0-0.124.0.txt`
15
15
  - 0.96.0 → 0.105.0: `llms/upgrading-0.96.0-0.105.0.txt`
16
16
  - 0.69.0 → 0.95.0: `llms/upgrading-0.69.0-0.95.0.txt`
17
17
  - 0.55.0 → 0.68.0: `llms/upgrading-0.55.0-0.68.0.txt`
package/llms-full.txt CHANGED
@@ -85,13 +85,13 @@ own, recorded as an ADR.
85
85
  | `stitchkit/xlsx` | browser **and** server | evolving | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
86
86
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
87
87
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
88
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 68 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
88
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 69 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
89
89
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, the managed-resource conformance kit and manual time for schedules and retries |
90
90
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
91
91
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
92
92
  | `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) |
93
93
  | `stitchkit/react/keyboard/testing` | server (Bun or Node) | evolving | the keyboard layers and zones without a DOM — fakes for the window, elements and key events beside the two engines, to test the order of layers, `scope`/`inert` and the edges of a zone in milliseconds |
94
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 26 of the 68 minors since 0.56.2, most recently 0.121.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
94
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 26 of the 69 minors since 0.56.2, most recently 0.121.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
95
95
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
96
96
  | `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 |
97
97
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -103,7 +103,7 @@ own, recorded as an ADR.
103
103
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
104
104
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
105
105
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
106
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 68 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
106
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 69 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
107
107
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
108
108
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
109
109
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
@@ -5413,10 +5413,16 @@ Ordinary file names containing brackets, such as `[preview].png`, remain valid.
5413
5413
  A local file with an unsupported extension is refused before reading; its
5414
5414
  per-item error identifies the caller's path and the extension it saw.
5415
5415
 
5416
- Each inline `image` and `audio` block carries `name`, the file name of its
5417
- source: a managed file keeps its own name, a URL takes its download name — the
5418
- path's base name with the body's extension. A CLI saves the block under that
5419
- name with [`--output-dir`](cli.md#saving-result-media).
5416
+ Each inline `image` and `audio` block carries the file name of its source in
5417
+ `_meta['stitchkit/fileName']` (`MCP_FILE_NAME_META_KEY`): a managed file keeps
5418
+ its own name, a URL takes its download name — the path's base name with the
5419
+ body's extension. MCP declares no file name on `ImageContent` or `AudioContent`,
5420
+ and the MCP server SDK drops an undeclared field from `content`, so the name is
5421
+ in `_meta`, the protocol's place for what a block carries beyond it. The block
5422
+ is therefore the same in the handler's output, an Agent's result,
5423
+ `structuredContent` and MCP `content`, and a host reads the name from the block
5424
+ it renders. A CLI saves the block under that name with
5425
+ [`--output-dir`](cli.md#saving-result-media).
5420
5426
 
5421
5427
  The older `mountWait`, `mountDownload`, `mountUpload` and `mountViewFile`
5422
5428
  functions remain
@@ -11104,7 +11110,7 @@ Three kinds of block hold a file, and the file may be of any type:
11104
11110
 
11105
11111
  | Block | Bytes | File name |
11106
11112
  | --- | --- | --- |
11107
- | `image`, `audio` (`McpMediaContentSchema`) | standard base64 in `data` | `name` |
11113
+ | `image`, `audio` (`McpMediaContentSchema`) | standard base64 in `data` | `_meta['stitchkit/fileName']` |
11108
11114
  | `resource` with `blob` — a PDF, a spreadsheet, an archive | standard base64 in `resource.blob` | last path segment of `resource.uri` |
11109
11115
  | `resource` with `text` — CSV, Markdown, JSON | `resource.text` as UTF-8 | last path segment of `resource.uri` |
11110
11116
 
@@ -11113,7 +11119,8 @@ rich-text node that also calls itself `image`, a `resource` without content —
11113
11119
  own data and is left alone.
11114
11120
 
11115
11121
  **Names.** A name is reduced to its basename, like a URL download name;
11116
- `defineViewFileTool` sets `name` to the file name of the source. A block that names no file
11122
+ `defineViewFileTool` and `mountViewFile` set a media block's `_meta['stitchkit/fileName']`
11123
+ (`MCP_FILE_NAME_META_KEY`) to the file name of the source. A block that names no file
11117
11124
  is `<type>-<sha256-of-its-bytes><extension>`: known media types supply the extension and
11118
11125
  the rest use `.bin`. A name is written once per batch. The same bytes under the same name
11119
11126
  are one file; different bytes under a name the batch already wrote fail that file, and the
@@ -17878,6 +17885,42 @@ charts, no merged cells and no streaming: an application that needs them takes a
17878
17885
 
17879
17886
  # Upgrading stitchkit
17880
17887
 
17888
+ ## Released migration: 0.124.0
17889
+
17890
+ ### media-block-file-name
17891
+
17892
+ **Who must act:** code that builds or reads an `image` or `audio` block of
17893
+ `McpMediaContentSchema` with a `name` — a tool that returns such a block, or a reader of a
17894
+ `defineViewFileTool`, `mountViewFile` or `resolveMedia` result. The field exists only in 0.123.7.
17895
+
17896
+ The file name of a media block lives in the block's `_meta`, under the key
17897
+ `MCP_FILE_NAME_META_KEY` (`stitchkit/fileName`), and the block has no `name`. The block is now
17898
+ exactly what MCP declares, so the same block reaches a handler's caller, an Agent,
17899
+ `structuredContent` and MCP `content`; the `name` field never reached `content`.
17900
+
17901
+ ```ts
17902
+ import { MCP_FILE_NAME_META_KEY } from 'stitchkit/tools/contract'
17903
+
17904
+ // before
17905
+ const block = { type: 'image', data, mimeType: 'image/png', name: 'shot.png' }
17906
+ const fileName = block.name
17907
+
17908
+ // after
17909
+ const block = {
17910
+ type: 'image',
17911
+ data,
17912
+ mimeType: 'image/png',
17913
+ _meta: { [MCP_FILE_NAME_META_KEY]: 'shot.png' },
17914
+ }
17915
+ const fileName = block._meta?.[MCP_FILE_NAME_META_KEY] // unknown: check it is a string
17916
+ ```
17917
+
17918
+ A block that still carries `name` is not refused: the schema drops the field, and a CLI's
17919
+ `--output-dir` then names the file `<type>-<sha256><extension>`. An object typed
17920
+ `McpMediaContent` does not compile with `name`, which is where TypeScript code finds every
17921
+ site; search untyped code for `name:` beside `type: 'image'` or `type: 'audio'`. A test that
17922
+ compared MCP `content` with `structuredContent` minus `name` compares them whole.
17923
+
17881
17924
  ## Released migration: 0.123.0
17882
17925
 
17883
17926
  ### unknown-operation
@@ -24991,7 +25034,8 @@ server SDK), [`stitchkit/tools/agent`](#stitchkittoolsagent) (the `ai` peer) and
24991
25034
  | `ViewFileErrorSchema` | constant | Zod schema for one structured per-item view failure |
24992
25035
  | `McpAnnotations` | _type_ | MCP annotations on a media result |
24993
25036
  | `McpAnnotationsSchema` | constant | Zod schema for MCP media annotations |
24994
- | `McpMediaContentSchema` | constant | Zod schema for text/image/audio media content |
25037
+ | `McpMediaContentSchema` | constant | Zod schema for text/image/audio media content — the blocks MCP declares, field for field |
25038
+ | `MCP_FILE_NAME_META_KEY` | constant | the namespaced `_meta` key (`stitchkit/fileName`) under which an `image` or `audio` block carries the file name of its source |
24995
25039
  | `CollectToolsConfig` | _type_ | options for `collectTools` |
24996
25040
  | `findUntypedProperties` | function | every property in a JSON Schema with no `type`/`enum`/`$ref` — what a model is shown and cannot obey ([guide](../guide/mcp-and-agents.md)) |
24997
25041
  | `UntypedProperty` | _type_ | one such property — `{ path, description? }` |
package/llms.txt CHANGED
@@ -14,14 +14,14 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.7 KB
15
15
  - **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 22.7 KB
16
16
  - **stitchkit/react/keyboard/testing**: [llms/react-keyboard-testing.txt](llms/react-keyboard-testing.txt) 1.9 KB
17
- - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 43.2 KB → [llms/tools.2.txt](llms/tools.2.txt) 36.0 KB → [llms/tools.3.txt](llms/tools.3.txt) 21.0 KB
17
+ - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 43.2 KB → [llms/tools.2.txt](llms/tools.2.txt) 36.5 KB → [llms/tools.3.txt](llms/tools.3.txt) 21.2 KB
18
18
  - **stitchkit/tools/mcp**: [llms/tools-mcp.txt](llms/tools-mcp.txt) 6.6 KB
19
19
  - **stitchkit/tools/agent**: [llms/tools-agent.txt](llms/tools-agent.txt) 1.1 KB
20
20
  - **stitchkit/tools/toolkit**: [llms/tools-toolkit.txt](llms/tools-toolkit.txt) 0.9 KB
21
21
  - **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
22
22
  - **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
23
23
  - **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 3.9 KB
24
- - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 44.0 KB → [llms/cli.2.txt](llms/cli.2.txt) 39.0 KB
24
+ - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 44.1 KB → [llms/cli.2.txt](llms/cli.2.txt) 39.0 KB
25
25
  - **stitchkit/cli/publish**: [llms/cli-publish.txt](llms/cli-publish.txt) 1.5 KB
26
26
  - **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
27
27
  - **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 34.1 KB
@@ -73,7 +73,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
73
73
 
74
74
  ## Upgrading slices
75
75
  - **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 12.7 KB
76
- - **Upgrading 0.106.0 → 0.123.0**: [llms/upgrading-0.106.0-0.123.0.txt](llms/upgrading-0.106.0-0.123.0.txt) 36.3 KB
76
+ - **Upgrading 0.106.0 → 0.124.0**: [llms/upgrading-0.106.0-0.124.0.txt](llms/upgrading-0.106.0-0.124.0.txt) 37.8 KB
77
77
  - **Upgrading 0.96.0 → 0.105.0**: [llms/upgrading-0.96.0-0.105.0.txt](llms/upgrading-0.96.0-0.105.0.txt) 45.8 KB
78
78
  - **Upgrading 0.69.0 → 0.95.0**: [llms/upgrading-0.69.0-0.95.0.txt](llms/upgrading-0.69.0-0.95.0.txt) 46.6 KB
79
79
  - **Upgrading 0.55.0 → 0.68.0**: [llms/upgrading-0.55.0-0.68.0.txt](llms/upgrading-0.55.0-0.68.0.txt) 47.0 KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.123.7",
3
+ "version": "0.124.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",