stitchkit 0.123.6 → 0.123.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/entrypoints/application/diagnostic-journal.js +1 -1
  3. package/dist/entrypoints/application/directory-inbox.js +3 -3
  4. package/dist/entrypoints/cli/publish.js +2 -2
  5. package/dist/entrypoints/cli.js +2 -1
  6. package/dist/entrypoints/files.js +2 -2
  7. package/dist/entrypoints/node.js +2 -2
  8. package/dist/entrypoints/server.js +5 -5
  9. package/dist/entrypoints/telegram.js +1 -1
  10. package/dist/entrypoints/tools/contract.js +4 -2
  11. package/dist/entrypoints/tools/toolkit.js +2 -1
  12. package/dist/entrypoints/tools.js +33 -27
  13. package/dist/{index-xjb131sc.js → index-1a741dpf.js} +188 -51
  14. package/dist/{index-yfpt7sxr.js → index-6qrspvxp.js} +5 -3
  15. package/dist/index-81t0bf0f.js +18 -0
  16. package/dist/{index-d9cg0gen.js → index-8yky60kq.js} +1 -1
  17. package/dist/{index-bph35vpy.js → index-9cxxfkhb.js} +21 -1
  18. package/dist/index-bknzva6n.js +39 -0
  19. package/dist/{index-73dappvg.js → index-ezwvsqx9.js} +1 -1
  20. package/dist/{index-chz7c830.js → index-mqttte96.js} +39 -6
  21. package/dist/{index-eabx6qjh.js → index-tnnmekgb.js} +1 -6
  22. package/dist/index-zs8cze4j.js +6 -0
  23. package/dist/internal/exclusive-lock.d.ts.map +1 -1
  24. package/dist/internal/media-extension.d.ts +3 -0
  25. package/dist/internal/media-extension.d.ts.map +1 -0
  26. package/dist/tools/cli/args.d.ts +1 -1
  27. package/dist/tools/cli/args.d.ts.map +1 -1
  28. package/dist/tools/cli/command.d.ts +7 -1
  29. package/dist/tools/cli/command.d.ts.map +1 -1
  30. package/dist/tools/cli/config.d.ts +5 -2
  31. package/dist/tools/cli/config.d.ts.map +1 -1
  32. package/dist/tools/cli/download.d.ts +25 -4
  33. package/dist/tools/cli/download.d.ts.map +1 -1
  34. package/dist/tools/cli/inline-files.d.ts +70 -0
  35. package/dist/tools/cli/inline-files.d.ts.map +1 -0
  36. package/dist/tools/cli/session.d.ts.map +1 -1
  37. package/dist/tools/transfer/download-core.d.ts +2 -0
  38. package/dist/tools/transfer/download-core.d.ts.map +1 -1
  39. package/dist/tools/transfer/view-file-contract.d.ts +34 -4
  40. package/dist/tools/transfer/view-file-contract.d.ts.map +1 -1
  41. package/dist/tools/transfer/view-file.d.ts.map +1 -1
  42. package/llms/cli.txt +63 -3
  43. package/llms/tools.2.txt +5 -0
  44. package/llms-full.txt +68 -3
  45. package/llms.txt +2 -2
  46. package/package.json +1 -1
  47. package/dist/index-sba3e6m4.js +0 -52
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGjD,OAAO,EAAoB,KAAK,UAAU,EAAuB,MAAM,mBAAmB,CAAC;AAG3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAGjB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,SAAS,CAAE,SAAQ,UAAU;IAC7E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACjC;;;;;OAKG;IACH,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,wBAAwB,CAAC,MAAM,SAAS,SAAS;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CA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AAiF;AACjF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,OAAO,EACnB,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAC9C,OAAO,CAAC,UAAU,CAAC,CAoCrB"}
@@ -59,7 +59,7 @@ export interface CliConfig<TAuth = unknown, TContext extends Record<string, unkn
59
59
  passthrough?: Record<string, string>;
60
60
  /** Per-command `--wait` polling behaviour, keyed by command name. */
61
61
  wait?: Record<string, CliWaitConfig>;
62
- /** Extract downloadable media URLs from a result for `--output-dir`. */
62
+ /** Name a result's URL files for `--output-dir`; files inline in `content` need no callback. */
63
63
  download?: (result: unknown) => Array<{
64
64
  url: string;
65
65
  name: string;
@@ -69,7 +69,10 @@ export interface CliConfig<TAuth = unknown, TContext extends Record<string, unkn
69
69
  * Default `false` — the SSRF guard, since the URLs come from handler output.
70
70
  */
71
71
  allowPrivateDownloadHosts?: boolean;
72
- /** Max bytes per `--output-dir` download before aborting. Default 100 MB. */
72
+ /**
73
+ * Byte cap per URL or inline file of `--output-dir`. A positive safe
74
+ * integer, checked when the CLI is created. Default 100 MB.
75
+ */
73
76
  maxDownloadBytes?: number;
74
77
  /**
75
78
  * Deadline for producing response headers per `--output-dir` download (DNS,
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,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G,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrE;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,gEAAgE;IAChE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACtC"}
@@ -1,8 +1,29 @@
1
- /** Default memory cap per downloaded file — overridable via `maxDownloadBytes`. */
1
+ /** Default decoded byte cap per file — overridable via `maxDownloadBytes`. */
2
2
  export declare const DEFAULT_DOWNLOAD_MAX_BYTES: number;
3
- /** Download each extracted URL into `dir`, reporting per-file outcome to stderr. */
4
- export declare function downloadResults(files: Array<{
3
+ interface UrlMedia {
5
4
  url: string;
6
5
  name: string;
7
- }>, dir: string, stderr: (text: string) => void, quiet: boolean, allowPrivate: boolean, maxBytes: number, timeoutMs: number | undefined): Promise<boolean>;
6
+ }
7
+ export interface SaveResultMediaOptions {
8
+ /** `--output-dir` as typed; resolved and pinned once for the whole batch. */
9
+ dir: string;
10
+ /** The application's `download` callback: the URL media a result names. */
11
+ download: ((result: unknown) => UrlMedia[]) | undefined;
12
+ allowPrivateHosts: boolean;
13
+ maxBytes: number;
14
+ timeoutMs: number | undefined;
15
+ quiet: boolean;
16
+ stderr: (text: string) => void;
17
+ }
18
+ /**
19
+ * `--output-dir`: save the URL files a successful result names and the files its `content`
20
+ * carries inline as one batch, reporting each outcome to stderr. `ok` is false when any file
21
+ * failed. `data` is the result as stdout prints it: a saved inline block is a link to its
22
+ * file, everything else is as it was.
23
+ */
24
+ export declare function saveResultMedia(data: unknown, options: SaveResultMediaOptions): Promise<{
25
+ ok: boolean;
26
+ data: unknown;
27
+ }>;
28
+ export {};
8
29
  //# sourceMappingURL=download.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/download.ts"],"names":[],"mappings":"AAOA,mFAAmF;AACnF,eAAO,MAAM,0BAA0B,QAAoB,CAAC;AAE5D,oFAAoF;AACpF,wBAAsB,eAAe,CACnC,KAAK,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAC3C,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAC9B,KAAK,EAAE,OAAO,EACd,YAAY,EAAE,OAAO,EACrB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,OAAO,CAAC,CA8ClB"}
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/download.ts"],"names":[],"mappings":"AAeA,8EAA8E;AAC9E,eAAO,MAAM,0BAA0B,QAAoB,CAAC;AAE5D,UAAU,QAAQ;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAWD,MAAM,WAAW,sBAAsB;IACrC,6EAA6E;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,QAAQ,EAAE,CAAC,GAAG,SAAS,CAAC;IACxD,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAYzC"}
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+ declare const InlineFileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ data: z.ZodString;
4
+ mimeType: z.ZodString;
5
+ name: z.ZodOptional<z.ZodString>;
6
+ annotations: z.ZodOptional<z.ZodObject<{
7
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
8
+ assistant: "assistant";
9
+ user: "user";
10
+ }>>>;
11
+ priority: z.ZodOptional<z.ZodNumber>;
12
+ }, z.core.$strip>>;
13
+ type: z.ZodLiteral<"image">;
14
+ }, z.core.$strip>, z.ZodObject<{
15
+ data: z.ZodString;
16
+ mimeType: z.ZodString;
17
+ name: z.ZodOptional<z.ZodString>;
18
+ annotations: z.ZodOptional<z.ZodObject<{
19
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
20
+ assistant: "assistant";
21
+ user: "user";
22
+ }>>>;
23
+ priority: z.ZodOptional<z.ZodNumber>;
24
+ }, z.core.$strip>>;
25
+ type: z.ZodLiteral<"audio">;
26
+ }, z.core.$strip>, z.ZodObject<{
27
+ type: z.ZodLiteral<"resource">;
28
+ resource: z.ZodUnion<readonly [z.ZodObject<{
29
+ uri: z.ZodString;
30
+ mimeType: z.ZodOptional<z.ZodString>;
31
+ blob: z.ZodString;
32
+ }, z.core.$strip>, z.ZodObject<{
33
+ uri: z.ZodString;
34
+ mimeType: z.ZodOptional<z.ZodString>;
35
+ text: z.ZodString;
36
+ }, z.core.$strip>]>;
37
+ }, z.core.$strip>], "type">;
38
+ type InlineFile = z.infer<typeof InlineFileSchema>;
39
+ /** One block of a result that carries a file, and its position in the result's `content`. */
40
+ export interface InlineFileBlock {
41
+ index: number;
42
+ file: InlineFile;
43
+ }
44
+ /**
45
+ * The blocks in a result's top-level `content` that carry a file: an `image` or `audio`
46
+ * block of the media schema, or an embedded `resource` of any type. A part of any other
47
+ * shape — a rich-text node that also calls itself `image` — is the result's own data and
48
+ * is left alone.
49
+ */
50
+ export declare function inlineFileBlocks(data: unknown): InlineFileBlock[];
51
+ /** The bytes of one block, bounded before they are allocated. */
52
+ export declare function inlineFileBytes(file: InlineFile, maxBytes: number): Buffer;
53
+ export declare function inlineFileMimeType(file: InlineFile): string | undefined;
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.
58
+ */
59
+ export declare function inlineFileName(file: InlineFile, digest: string): string;
60
+ /**
61
+ * The result as stdout prints it once its files are saved: each saved block gives up its
62
+ * bytes for an MCP resource link to the file. A block that was not saved keeps its bytes.
63
+ */
64
+ export declare function linkSavedFiles(data: unknown, blocks: readonly InlineFileBlock[], saved: (block: InlineFileBlock) => {
65
+ path: string;
66
+ name: string;
67
+ size: number;
68
+ } | undefined): unknown;
69
+ export {};
70
+ //# sourceMappingURL=inline-files.d.ts.map
@@ -0,0 +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;AAC7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AAS,CAgEhC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,sBAAsB,GACjC,MAAM,CAcR;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,CAAC,EAClD,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,GACf,WAAW,CAOb"}
@@ -6,6 +6,8 @@ export declare class DownloadOperationError extends Error {
6
6
  readonly status: number;
7
7
  constructor(code: 'DOWNLOAD_HTTP_ERROR' | 'DOWNLOAD_TOO_LARGE', message: string, status: number);
8
8
  }
9
+ /** The file name a fetched URL is saved under: its path's base name and the body's extension. */
10
+ export declare function downloadFileName(url: string, mime: string): string;
9
11
  export interface DownloadOperationConfig {
10
12
  url: string;
11
13
  files: ManagedFileBoundary;
@@ -1 +1 @@
1
- {"version":3,"file":"download-core.d.ts","sourceRoot":"","sources":["../../../src/tools/transfer/download-core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAmBhE,yFAAyF;AACzF,qBAAa,sBAAuB,SAAQ,KAAK;aAE7B,IAAI,EAAE,qBAAqB,GAAG,oBAAoB;aAElD,MAAM,EAAE,MAAM;IAHhC,YACkB,IAAI,EAAE,qBAAqB,GAAG,oBAAoB,EAClE,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,MAAM,EAI/B;CACF;AAwBD,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,mBAAmB,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,kFAAkF;AAClF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,cAAc,CAAC,CA4BzB"}
1
+ {"version":3,"file":"download-core.d.ts","sourceRoot":"","sources":["../../../src/tools/transfer/download-core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAQhE,yFAAyF;AACzF,qBAAa,sBAAuB,SAAQ,KAAK;aAE7B,IAAI,EAAE,qBAAqB,GAAG,oBAAoB;aAElD,MAAM,EAAE,MAAM;IAHhC,YACkB,IAAI,EAAE,qBAAqB,GAAG,oBAAoB,EAClE,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,MAAM,EAI/B;CACF;AAyBD,iGAAiG;AACjG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,mBAAmB,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,kFAAkF;AAClF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,cAAc,CAAC,CA2BzB"}
@@ -27,14 +27,40 @@ 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
+ export declare const McpImageContentSchema: z.ZodObject<{
31
+ data: z.ZodString;
32
+ mimeType: z.ZodString;
33
+ name: z.ZodOptional<z.ZodString>;
34
+ annotations: z.ZodOptional<z.ZodObject<{
35
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
36
+ assistant: "assistant";
37
+ user: "user";
38
+ }>>>;
39
+ priority: z.ZodOptional<z.ZodNumber>;
40
+ }, z.core.$strip>>;
41
+ type: z.ZodLiteral<"image">;
42
+ }, z.core.$strip>;
43
+ export declare const McpAudioContentSchema: z.ZodObject<{
44
+ data: z.ZodString;
45
+ mimeType: z.ZodString;
46
+ name: z.ZodOptional<z.ZodString>;
47
+ annotations: z.ZodOptional<z.ZodObject<{
48
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
49
+ assistant: "assistant";
50
+ user: "user";
51
+ }>>>;
52
+ priority: z.ZodOptional<z.ZodNumber>;
53
+ }, z.core.$strip>>;
54
+ type: z.ZodLiteral<"audio">;
55
+ }, z.core.$strip>;
30
56
  /** An MCP content block — text / image / audio (video cannot be inlined). */
31
57
  export declare const McpMediaContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
32
58
  type: z.ZodLiteral<"text">;
33
59
  text: z.ZodString;
34
60
  }, z.core.$strip>, z.ZodObject<{
35
- type: z.ZodLiteral<"image">;
36
61
  data: z.ZodString;
37
62
  mimeType: z.ZodString;
63
+ name: z.ZodOptional<z.ZodString>;
38
64
  annotations: z.ZodOptional<z.ZodObject<{
39
65
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
40
66
  assistant: "assistant";
@@ -42,10 +68,11 @@ export declare const McpMediaContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject
42
68
  }>>>;
43
69
  priority: z.ZodOptional<z.ZodNumber>;
44
70
  }, z.core.$strip>>;
71
+ type: z.ZodLiteral<"image">;
45
72
  }, z.core.$strip>, z.ZodObject<{
46
- type: z.ZodLiteral<"audio">;
47
73
  data: z.ZodString;
48
74
  mimeType: z.ZodString;
75
+ name: z.ZodOptional<z.ZodString>;
49
76
  annotations: z.ZodOptional<z.ZodObject<{
50
77
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
51
78
  assistant: "assistant";
@@ -53,6 +80,7 @@ export declare const McpMediaContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject
53
80
  }>>>;
54
81
  priority: z.ZodOptional<z.ZodNumber>;
55
82
  }, z.core.$strip>>;
83
+ type: z.ZodLiteral<"audio">;
56
84
  }, z.core.$strip>], "type">;
57
85
  export type McpMediaContent = z.infer<typeof McpMediaContentSchema>;
58
86
  export declare const ViewFileErrorSchema: z.ZodObject<{
@@ -64,9 +92,9 @@ export declare const ViewFileOutputSchema: z.ZodObject<{
64
92
  type: z.ZodLiteral<"text">;
65
93
  text: z.ZodString;
66
94
  }, z.core.$strip>, z.ZodObject<{
67
- type: z.ZodLiteral<"image">;
68
95
  data: z.ZodString;
69
96
  mimeType: z.ZodString;
97
+ name: z.ZodOptional<z.ZodString>;
70
98
  annotations: z.ZodOptional<z.ZodObject<{
71
99
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
72
100
  assistant: "assistant";
@@ -74,10 +102,11 @@ export declare const ViewFileOutputSchema: z.ZodObject<{
74
102
  }>>>;
75
103
  priority: z.ZodOptional<z.ZodNumber>;
76
104
  }, z.core.$strip>>;
105
+ type: z.ZodLiteral<"image">;
77
106
  }, z.core.$strip>, z.ZodObject<{
78
- type: z.ZodLiteral<"audio">;
79
107
  data: z.ZodString;
80
108
  mimeType: z.ZodString;
109
+ name: z.ZodOptional<z.ZodString>;
81
110
  annotations: z.ZodOptional<z.ZodObject<{
82
111
  audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
83
112
  assistant: "assistant";
@@ -85,6 +114,7 @@ export declare const ViewFileOutputSchema: z.ZodObject<{
85
114
  }>>>;
86
115
  priority: z.ZodOptional<z.ZodNumber>;
87
116
  }, z.core.$strip>>;
117
+ type: z.ZodLiteral<"audio">;
88
118
  }, z.core.$strip>], "type">>;
89
119
  errors: z.ZodArray<z.ZodObject<{
90
120
  path: z.ZodString;
@@ -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;;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;AAclE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAGhC,CAAC;AAC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H,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,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,CAyBpF"}
package/llms/cli.txt CHANGED
@@ -457,7 +457,7 @@ same Zod schema an HTTP or MCP call does.
457
457
  | `--json` | Compact success/error JSON records for scripts |
458
458
  | `--wait` | Block-poll an async result to a terminal state |
459
459
  | `--wait-timeout <s>` | Override the `--wait` timeout |
460
- | `--output-dir <dir>` | Download result media into a directory |
460
+ | `--output-dir <dir>` | Save the files a result names or carries into a directory |
461
461
  | `--quiet` | Suppress non-essential stderr output |
462
462
  | `--dry-run` | Print the resolved call without executing |
463
463
  | `--schema` | One JSON line: the JSON Schema of a command's input and output |
@@ -679,15 +679,75 @@ myapp generate "a fox" --wait --output-dir ./out
679
679
  myapp generate "a fox" --wait --json > result.json &
680
680
  ```
681
681
 
682
+ ### Saving result media
683
+
684
+ `--output-dir <dir>` saves the files a successful result carries, as one batch in one
685
+ directory: the blocks of the result's top-level `content` array that hold a file inline, and
686
+ the `{ url, name }` files the optional `download(result)` callback names. Inline files need
687
+ no callback — a `defineViewFileTool` result, or a file returned through an MCP client
688
+ connection, is saved as it arrives. URL files keep their SSRF checks, redirect checks and
689
+ fetch deadlines.
690
+
691
+ Three kinds of block hold a file, and the file may be of any type:
692
+
693
+ | Block | Bytes | File name |
694
+ | --- | --- | --- |
695
+ | `image`, `audio` (`McpMediaContentSchema`) | standard base64 in `data` | `name` |
696
+ | `resource` with `blob` — a PDF, a spreadsheet, an archive | standard base64 in `resource.blob` | last path segment of `resource.uri` |
697
+ | `resource` with `text` — CSV, Markdown, JSON | `resource.text` as UTF-8 | last path segment of `resource.uri` |
698
+
699
+ A part of `content` is saved only when it matches one of these shapes. Any other part — a
700
+ rich-text node that also calls itself `image`, a `resource` without content — is the result's
701
+ own data and is left alone.
702
+
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
705
+ is `<type>-<sha256-of-its-bytes><extension>`: known media types supply the extension and
706
+ the rest use `.bin`. A name is written once per batch. The same bytes under the same name
707
+ are one file; different bytes under a name the batch already wrote fail that file, and the
708
+ first one stays.
709
+
710
+ **Bytes.** Padded and unpadded canonical base64 are accepted; anything else fails that file
711
+ alone. `maxDownloadBytes` — a positive safe integer, checked when the CLI is created —
712
+ limits each URL file and each inline file by its decoded or UTF-8 size (default 100 MB). The
713
+ size is checked before the bytes are allocated, and inline files are decoded and written one
714
+ at a time.
715
+
716
+ **Output.** `saved <path> (<size>KB)` goes to stderr; `--quiet` suppresses those lines and
717
+ keeps errors. On stdout each saved inline block is replaced by a link to its file, so the
718
+ bytes are not printed a second time:
719
+
720
+ ```json
721
+ {
722
+ "type": "resource_link",
723
+ "uri": "file:///work/out/shot.png",
724
+ "name": "shot.png",
725
+ "mimeType": "image/png",
726
+ "size": 48213
727
+ }
728
+ ```
729
+
730
+ The link carries `mimeType` when the block declared one. A block that could not be saved
731
+ keeps its bytes, so nothing the operation returned is lost;
732
+ the other files of the batch are still saved and the exit is `1`. A result policy
733
+ (`results`) receives the operation's own result, not the linked one. Without `--output-dir`,
734
+ an inline result is ordinary JSON.
735
+
736
+ **Nothing to save.** A result that carries no files is not an error. The command prints and
737
+ exits exactly as it does without the flag — views and result policies included — and stderr
738
+ says `--output-dir: the result carries no files to save` unless `--quiet` is given. A failed
739
+ operation keeps its own error and exit code. Help, schema inspection and dry-run do not
740
+ execute the operation.
741
+
682
742
  ### Download filesystem boundary
683
743
 
684
- `--output-dir` resolves the explicitly configured root once before fetching and pins that
744
+ `--output-dir` resolves the explicitly configured root once before fetching or decoding and pins that
685
745
  one directory for the whole batch. An initial root alias (including a symbolic link) selects
686
746
  its canonical directory; missing components are created through pinned parents. The root
687
747
  capability continues to name the same directory if another actor renames it or replaces its
688
748
  pathname. The original spelling printed in `saved` is a display path, not a re-open of the root.
689
749
 
690
- Each media name becomes a direct child. Downloads atomically replace an existing file,
750
+ Each media name becomes a direct child. URL and inline files atomically replace an existing file,
691
751
  symbolic link (including a dangling link), or hard link without changing the inode a link
692
752
  points to. An existing directory refuses replacement. Ordinary files retain their permission
693
753
  bits; new files use `0666 & ~umask`. Replacing writes a new file beside the old one, so it needs
package/llms/tools.2.txt CHANGED
@@ -556,6 +556,11 @@ 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).
563
+
559
564
  The older `mountWait`, `mountDownload`, `mountUpload` and `mountViewFile`
560
565
  functions remain
561
566
  intentional raw MCP adapters with their text-envelope behavior. Use them under
package/llms-full.txt CHANGED
@@ -5413,6 +5413,11 @@ 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).
5420
+
5416
5421
  The older `mountWait`, `mountDownload`, `mountUpload` and `mountViewFile`
5417
5422
  functions remain
5418
5423
  intentional raw MCP adapters with their text-envelope behavior. Use them under
@@ -10864,7 +10869,7 @@ same Zod schema an HTTP or MCP call does.
10864
10869
  | `--json` | Compact success/error JSON records for scripts |
10865
10870
  | `--wait` | Block-poll an async result to a terminal state |
10866
10871
  | `--wait-timeout <s>` | Override the `--wait` timeout |
10867
- | `--output-dir <dir>` | Download result media into a directory |
10872
+ | `--output-dir <dir>` | Save the files a result names or carries into a directory |
10868
10873
  | `--quiet` | Suppress non-essential stderr output |
10869
10874
  | `--dry-run` | Print the resolved call without executing |
10870
10875
  | `--schema` | One JSON line: the JSON Schema of a command's input and output |
@@ -11086,15 +11091,75 @@ myapp generate "a fox" --wait --output-dir ./out
11086
11091
  myapp generate "a fox" --wait --json > result.json &
11087
11092
  ```
11088
11093
 
11094
+ ### Saving result media
11095
+
11096
+ `--output-dir <dir>` saves the files a successful result carries, as one batch in one
11097
+ directory: the blocks of the result's top-level `content` array that hold a file inline, and
11098
+ the `{ url, name }` files the optional `download(result)` callback names. Inline files need
11099
+ no callback — a `defineViewFileTool` result, or a file returned through an MCP client
11100
+ connection, is saved as it arrives. URL files keep their SSRF checks, redirect checks and
11101
+ fetch deadlines.
11102
+
11103
+ Three kinds of block hold a file, and the file may be of any type:
11104
+
11105
+ | Block | Bytes | File name |
11106
+ | --- | --- | --- |
11107
+ | `image`, `audio` (`McpMediaContentSchema`) | standard base64 in `data` | `name` |
11108
+ | `resource` with `blob` — a PDF, a spreadsheet, an archive | standard base64 in `resource.blob` | last path segment of `resource.uri` |
11109
+ | `resource` with `text` — CSV, Markdown, JSON | `resource.text` as UTF-8 | last path segment of `resource.uri` |
11110
+
11111
+ A part of `content` is saved only when it matches one of these shapes. Any other part — a
11112
+ rich-text node that also calls itself `image`, a `resource` without content — is the result's
11113
+ own data and is left alone.
11114
+
11115
+ **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
11117
+ is `<type>-<sha256-of-its-bytes><extension>`: known media types supply the extension and
11118
+ the rest use `.bin`. A name is written once per batch. The same bytes under the same name
11119
+ are one file; different bytes under a name the batch already wrote fail that file, and the
11120
+ first one stays.
11121
+
11122
+ **Bytes.** Padded and unpadded canonical base64 are accepted; anything else fails that file
11123
+ alone. `maxDownloadBytes` — a positive safe integer, checked when the CLI is created —
11124
+ limits each URL file and each inline file by its decoded or UTF-8 size (default 100 MB). The
11125
+ size is checked before the bytes are allocated, and inline files are decoded and written one
11126
+ at a time.
11127
+
11128
+ **Output.** `saved <path> (<size>KB)` goes to stderr; `--quiet` suppresses those lines and
11129
+ keeps errors. On stdout each saved inline block is replaced by a link to its file, so the
11130
+ bytes are not printed a second time:
11131
+
11132
+ ```json
11133
+ {
11134
+ "type": "resource_link",
11135
+ "uri": "file:///work/out/shot.png",
11136
+ "name": "shot.png",
11137
+ "mimeType": "image/png",
11138
+ "size": 48213
11139
+ }
11140
+ ```
11141
+
11142
+ The link carries `mimeType` when the block declared one. A block that could not be saved
11143
+ keeps its bytes, so nothing the operation returned is lost;
11144
+ the other files of the batch are still saved and the exit is `1`. A result policy
11145
+ (`results`) receives the operation's own result, not the linked one. Without `--output-dir`,
11146
+ an inline result is ordinary JSON.
11147
+
11148
+ **Nothing to save.** A result that carries no files is not an error. The command prints and
11149
+ exits exactly as it does without the flag — views and result policies included — and stderr
11150
+ says `--output-dir: the result carries no files to save` unless `--quiet` is given. A failed
11151
+ operation keeps its own error and exit code. Help, schema inspection and dry-run do not
11152
+ execute the operation.
11153
+
11089
11154
  ### Download filesystem boundary
11090
11155
 
11091
- `--output-dir` resolves the explicitly configured root once before fetching and pins that
11156
+ `--output-dir` resolves the explicitly configured root once before fetching or decoding and pins that
11092
11157
  one directory for the whole batch. An initial root alias (including a symbolic link) selects
11093
11158
  its canonical directory; missing components are created through pinned parents. The root
11094
11159
  capability continues to name the same directory if another actor renames it or replaces its
11095
11160
  pathname. The original spelling printed in `saved` is a display path, not a re-open of the root.
11096
11161
 
11097
- Each media name becomes a direct child. Downloads atomically replace an existing file,
11162
+ Each media name becomes a direct child. URL and inline files atomically replace an existing file,
11098
11163
  symbolic link (including a dangling link), or hard link without changing the inode a link
11099
11164
  points to. An existing directory refuses replacement. Ordinary files retain their permission
11100
11165
  bits; new files use `0666 & ~umask`. Replacing writes a new file beside the old one, so it needs
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) 35.7 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.0 KB → [llms/tools.3.txt](llms/tools.3.txt) 21.0 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) 40.9 KB → [llms/cli.2.txt](llms/cli.2.txt) 39.0 KB
24
+ - **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 44.0 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.123.6",
3
+ "version": "0.123.7",
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",
@@ -1,52 +0,0 @@
1
- // src/tools/operations/async-operation-contract.ts
2
- import { z } from "zod";
3
- var AsyncOperationCancelResultSchema2 = z.discriminatedUnion("outcome", [
4
- z.object({ outcome: z.literal("accepted") }),
5
- z.object({ outcome: z.literal("already_terminal") }),
6
- z.object({ outcome: z.literal("rejected"), reason: z.string().min(1) })
7
- ]);
8
- function createAsyncOperationSnapshotSchema2(config) {
9
- const progress = config.progress ? { progress: config.progress.optional() } : {};
10
- return z.discriminatedUnion("phase", [
11
- z.object({ phase: z.literal("pending"), ...progress }),
12
- z.object({ phase: z.literal("running"), ...progress }),
13
- z.object({ phase: z.literal("succeeded"), ...progress }),
14
- z.object({ phase: z.literal("failed"), failure: config.failure, ...progress }),
15
- z.object({ phase: z.literal("cancelled"), ...progress })
16
- ]);
17
- }
18
-
19
- // src/tools/transfer/view-file-contract.ts
20
- import { z as z2 } from "zod";
21
- var MAX_VIEW_FILES = 20;
22
- var McpAnnotationsSchema2 = z2.object({
23
- audience: z2.array(z2.enum(["user", "assistant"])).optional(),
24
- priority: z2.number().optional()
25
- });
26
- var McpMediaContentSchema2 = z2.discriminatedUnion("type", [
27
- z2.object({ type: z2.literal("text"), text: z2.string() }),
28
- z2.object({
29
- type: z2.literal("image"),
30
- data: z2.string(),
31
- mimeType: z2.string(),
32
- annotations: McpAnnotationsSchema2.optional()
33
- }),
34
- z2.object({
35
- type: z2.literal("audio"),
36
- data: z2.string(),
37
- mimeType: z2.string(),
38
- annotations: McpAnnotationsSchema2.optional()
39
- })
40
- ]);
41
- var ViewFileErrorSchema2 = z2.object({
42
- path: z2.string(),
43
- message: z2.string()
44
- });
45
- var ViewFileOutputSchema2 = z2.object({
46
- content: z2.array(McpMediaContentSchema2),
47
- errors: z2.array(ViewFileErrorSchema2)
48
- });
49
- var ViewFileInputSchema2 = z2.object({
50
- paths: z2.union([z2.string(), z2.array(z2.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.")
51
- });
52
- export { AsyncOperationCancelResultSchema2, createAsyncOperationSnapshotSchema2, McpAnnotationsSchema2, McpMediaContentSchema2, ViewFileErrorSchema2, ViewFileOutputSchema2, ViewFileInputSchema2 };