stitchkit 0.77.0 → 0.79.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/dist/agent-runtime-browser.js +53 -581
- package/dist/agent-runtime-coding-tools.js +6 -5
- package/dist/agent-runtime-harness.js +20 -93
- package/dist/agent-runtime-openrouter.js +1 -1
- package/dist/agent-runtime.js +65 -61
- package/dist/application/decisions.d.ts +28 -25
- package/dist/application/decisions.d.ts.map +1 -1
- package/dist/application/kernel.d.ts +2 -0
- package/dist/application/kernel.d.ts.map +1 -1
- package/dist/application/keyspace.d.ts +11 -1
- package/dist/application/keyspace.d.ts.map +1 -1
- package/dist/application/schedule.d.ts.map +1 -1
- package/dist/application/schemas.d.ts +2 -0
- package/dist/application/schemas.d.ts.map +1 -1
- package/dist/application/server-resource.d.ts.map +1 -1
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/application-diagnostic-journal.d.ts +21 -0
- package/dist/application-diagnostic-journal.d.ts.map +1 -0
- package/dist/application-diagnostic-journal.js +632 -0
- package/dist/application-opentelemetry.js +3 -2
- package/dist/application-schemas.js +14 -98
- package/dist/application.d.ts +1 -2
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +155 -882
- package/dist/cli.js +13 -11
- package/dist/contract/index.js +15 -10
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files.js +1 -1
- package/dist/{index-7b188kmz.js → index-2qzskm8h.js} +15 -1
- package/dist/{index-k2zczx1g.js → index-2rwwmr7v.js} +3 -3
- package/dist/{index-8eywc9zv.js → index-3gye9wzb.js} +6 -3
- package/dist/index-4fpa9dy2.js +51 -0
- package/dist/{index-7qy2ex0m.js → index-5mtc969c.js} +2 -2
- package/dist/index-5s3zajp8.js +192 -0
- package/dist/{index-3cwck0rm.js → index-6s7n2v50.js} +60 -374
- package/dist/{index-s4c8wy8m.js → index-758zx2ha.js} +11 -90
- package/dist/{index-qyrqwr4c.js → index-77fekveh.js} +4 -1
- package/dist/{index-58jzmnn4.js → index-7ag81v2f.js} +355 -34
- package/dist/index-7gnkny4z.js +326 -0
- package/dist/index-7zbps32p.js +89 -0
- package/dist/index-85vfqd7m.js +135 -0
- package/dist/{index-m668wzyc.js → index-9s6z8vgf.js} +17 -141
- package/dist/{index-bfcpjw20.js → index-actkayzn.js} +7 -3
- package/dist/index-b9aefrqd.js +20 -0
- package/dist/index-dre2ywck.js +48 -0
- package/dist/{index-nemjkxjp.js → index-dwf1f2ap.js} +16 -12
- package/dist/{index-wwst0td5.js → index-dx9xehwt.js} +1 -1
- package/dist/{index-ezmn6ac6.js → index-dxesg10d.js} +4 -4
- package/dist/{index-aczggrty.js → index-dxjjv399.js} +2 -2
- package/dist/{index-jqtsc9mj.js → index-egaabxkz.js} +3 -3
- package/dist/{index-vc1b0b1b.js → index-evcnmsc3.js} +49 -8
- package/dist/{index-nt1mp8km.js → index-fxz0v7vg.js} +84 -84
- package/dist/index-h4pj6fta.js +87 -0
- package/dist/{index-1rxswfbv.js → index-hb5pf3s4.js} +1 -1
- package/dist/{index-t8qyvrvg.js → index-k9ay6v6d.js} +21 -272
- package/dist/index-kzfs85xp.js +9 -0
- package/dist/{index-vbf2p6me.js → index-m9kzax52.js} +91 -89
- package/dist/{index-22by16v6.js → index-mgtxfe6b.js} +1 -1
- package/dist/index-p7hgdyhb.js +22 -0
- package/dist/index-pq95qkbf.js +0 -0
- package/dist/index-t0z5p5w6.js +318 -0
- package/dist/{index-s2rchahr.js → index-vwp69871.js} +13 -11
- package/dist/index-wc4x00bn.js +103 -0
- package/dist/{index-da1aqnhb.js → index-xcetq6j3.js} +8 -6
- package/dist/{index-f6n5n7nz.js → index-y01f4223.js} +33 -126
- package/dist/{index-35z5h2ty.js → index-ywd0y6m1.js} +18 -218
- package/dist/index.js +65 -1588
- package/dist/internal/deadline.d.ts +17 -0
- package/dist/internal/deadline.d.ts.map +1 -0
- package/dist/live.js +15 -89
- package/dist/node.js +17 -15
- package/dist/observability/context.d.ts.map +1 -1
- package/dist/observability/index.js +7 -6
- package/dist/primitives.js +5 -2
- package/dist/react.js +1 -1
- package/dist/remote.js +7 -6
- package/dist/server/event-bus.d.ts.map +1 -1
- package/dist/server/index.js +26 -38
- package/dist/telegram.js +1 -1
- package/dist/testing.js +86 -97
- package/dist/tool-invoker.js +11 -9
- package/dist/tools/async-operation-contract.d.ts +61 -0
- package/dist/tools/async-operation-contract.d.ts.map +1 -0
- package/dist/tools/async-operation.d.ts +2 -47
- package/dist/tools/async-operation.d.ts.map +1 -1
- package/dist/tools/view-file-contract.d.ts +98 -0
- package/dist/tools/view-file-contract.d.ts.map +1 -0
- package/dist/tools/view-file.d.ts +4 -83
- package/dist/tools/view-file.d.ts.map +1 -1
- package/dist/tools-contract.d.ts +29 -0
- package/dist/tools-contract.d.ts.map +1 -0
- package/dist/tools-contract.js +24 -0
- package/dist/tools.d.ts +3 -3
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +59 -95
- package/llms-full.txt +146 -14
- package/package.json +14 -7
- package/dist/index-ksp6e2ye.js +0 -24
- package/dist/index-vj3vvpaa.js +0 -307
|
@@ -13,87 +13,11 @@
|
|
|
13
13
|
* sandboxed to a `baseDir`, and downloads are capped before they reach memory.
|
|
14
14
|
*/
|
|
15
15
|
import type { McpServer } from '@modelcontextprotocol/server';
|
|
16
|
-
import { z } from 'zod';
|
|
16
|
+
import type { z } from 'zod';
|
|
17
|
+
import type { McpMediaContent, ViewFileOutput } from './view-file-contract.js';
|
|
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';
|
|
17
20
|
import { type ManagedFileBoundary } from '../files/boundary.js';
|
|
18
|
-
/**
|
|
19
|
-
* Annotation telling the client who a content block is for. `audience` lists
|
|
20
|
-
* `'user'` (render for the human) and/or `'assistant'` (keep in model context);
|
|
21
|
-
* `priority` (0–1) hints how prominently. Same shape as the MCP resource/prompt
|
|
22
|
-
* annotation.
|
|
23
|
-
*/
|
|
24
|
-
export declare const McpAnnotationsSchema: z.ZodObject<{
|
|
25
|
-
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
26
|
-
assistant: "assistant";
|
|
27
|
-
user: "user";
|
|
28
|
-
}>>>;
|
|
29
|
-
priority: z.ZodOptional<z.ZodNumber>;
|
|
30
|
-
}, z.core.$strip>;
|
|
31
|
-
export type McpAnnotations = z.infer<typeof McpAnnotationsSchema>;
|
|
32
|
-
/** An MCP content block — text / image / audio (video cannot be inlined). */
|
|
33
|
-
export declare const McpMediaContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
|
-
type: z.ZodLiteral<"text">;
|
|
35
|
-
text: z.ZodString;
|
|
36
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
-
type: z.ZodLiteral<"image">;
|
|
38
|
-
data: z.ZodString;
|
|
39
|
-
mimeType: z.ZodString;
|
|
40
|
-
annotations: z.ZodOptional<z.ZodObject<{
|
|
41
|
-
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
42
|
-
assistant: "assistant";
|
|
43
|
-
user: "user";
|
|
44
|
-
}>>>;
|
|
45
|
-
priority: z.ZodOptional<z.ZodNumber>;
|
|
46
|
-
}, z.core.$strip>>;
|
|
47
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
48
|
-
type: z.ZodLiteral<"audio">;
|
|
49
|
-
data: z.ZodString;
|
|
50
|
-
mimeType: z.ZodString;
|
|
51
|
-
annotations: z.ZodOptional<z.ZodObject<{
|
|
52
|
-
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
53
|
-
assistant: "assistant";
|
|
54
|
-
user: "user";
|
|
55
|
-
}>>>;
|
|
56
|
-
priority: z.ZodOptional<z.ZodNumber>;
|
|
57
|
-
}, z.core.$strip>>;
|
|
58
|
-
}, z.core.$strip>], "type">;
|
|
59
|
-
export type McpMediaContent = z.infer<typeof McpMediaContentSchema>;
|
|
60
|
-
export declare const ViewFileErrorSchema: z.ZodObject<{
|
|
61
|
-
path: z.ZodString;
|
|
62
|
-
message: z.ZodString;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
export declare const ViewFileOutputSchema: z.ZodObject<{
|
|
65
|
-
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
66
|
-
type: z.ZodLiteral<"text">;
|
|
67
|
-
text: z.ZodString;
|
|
68
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
-
type: z.ZodLiteral<"image">;
|
|
70
|
-
data: z.ZodString;
|
|
71
|
-
mimeType: z.ZodString;
|
|
72
|
-
annotations: z.ZodOptional<z.ZodObject<{
|
|
73
|
-
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
74
|
-
assistant: "assistant";
|
|
75
|
-
user: "user";
|
|
76
|
-
}>>>;
|
|
77
|
-
priority: z.ZodOptional<z.ZodNumber>;
|
|
78
|
-
}, z.core.$strip>>;
|
|
79
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
80
|
-
type: z.ZodLiteral<"audio">;
|
|
81
|
-
data: z.ZodString;
|
|
82
|
-
mimeType: z.ZodString;
|
|
83
|
-
annotations: z.ZodOptional<z.ZodObject<{
|
|
84
|
-
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
85
|
-
assistant: "assistant";
|
|
86
|
-
user: "user";
|
|
87
|
-
}>>>;
|
|
88
|
-
priority: z.ZodOptional<z.ZodNumber>;
|
|
89
|
-
}, z.core.$strip>>;
|
|
90
|
-
}, z.core.$strip>], "type">>;
|
|
91
|
-
errors: z.ZodArray<z.ZodObject<{
|
|
92
|
-
path: z.ZodString;
|
|
93
|
-
message: z.ZodString;
|
|
94
|
-
}, z.core.$strip>>;
|
|
95
|
-
}, z.core.$strip>;
|
|
96
|
-
export type ViewFileOutput = z.infer<typeof ViewFileOutputSchema>;
|
|
97
21
|
export interface ViewFileOptions {
|
|
98
22
|
/**
|
|
99
23
|
* Managed boundary that owns local files. Omitted → local access is disabled
|
|
@@ -121,9 +45,6 @@ export interface ViewFileOptions {
|
|
|
121
45
|
* - anything else, or too large → a text link.
|
|
122
46
|
*/
|
|
123
47
|
export declare function resolveMedia(pathOrUrl: string, options?: ViewFileOptions): Promise<McpMediaContent[]>;
|
|
124
|
-
export declare const ViewFileInputSchema: z.ZodObject<{
|
|
125
|
-
paths: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
126
|
-
}, z.core.$strip>;
|
|
127
48
|
/**
|
|
128
49
|
* Resolve one bounded batch into neutral media content. Per-item failures stay
|
|
129
50
|
* visible beside successful items; every item shares one total inline/read
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-file.d.ts","sourceRoot":"","sources":["../../src/tools/view-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"view-file.d.ts","sourceRoot":"","sources":["../../src/tools/view-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,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,mBAAmB,CAAC;AAuB/E,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;AAoKD;;;;;;;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,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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes a tool surface speaks, without the runtime that serves them.
|
|
3
|
+
*
|
|
4
|
+
* `stitchkit/tools` mounts MCP, spawns processes, reads files and opens
|
|
5
|
+
* sockets — five of its first-hop imports reach `node:`, so a browser bundler
|
|
6
|
+
* cannot initialise it at all. Everything here is Zod and type-level code, and a
|
|
7
|
+
* client that has to *call* an async operation needs exactly these: the contract
|
|
8
|
+
* it was declared with, the snapshot schema it polls, the cancel result it may
|
|
9
|
+
* receive, and the input and output of a view-file tool.
|
|
10
|
+
*
|
|
11
|
+
* Reaching them only through the implementation was contract-first failing on
|
|
12
|
+
* its own promise, one entrypoint over from where
|
|
13
|
+
* `stitchkit/application/schemas` fixed the same thing. The names live here and
|
|
14
|
+
* `stitchkit/tools` re-exports them, so there is one list rather than two.
|
|
15
|
+
*
|
|
16
|
+
* Every module behind this entry is a leaf: zod and nothing else.
|
|
17
|
+
* `async-operation.ts` and `view-file.ts` are 1,400 and 500 lines that reach the
|
|
18
|
+
* tool runtime, the MCP server types and the `ai` package, and a module is
|
|
19
|
+
* imported whole — so re-exporting from them dragged all of that into the graph
|
|
20
|
+
* and, worse, into the `.d.ts`, where a consumer without the optional MCP peer
|
|
21
|
+
* could not typecheck against a snapshot schema. The consumer lane caught that;
|
|
22
|
+
* neither browser gate could, because both are about `node:`.
|
|
23
|
+
*
|
|
24
|
+
* → ADR 0156.
|
|
25
|
+
*/
|
|
26
|
+
export { type AsyncOperationCancelResult, AsyncOperationCancelResultSchema, type AsyncOperationCapability, createAsyncOperationSnapshotSchema, } from './tools/async-operation-contract.js';
|
|
27
|
+
export { coerceJsonArgs } from './tools/coerce.js';
|
|
28
|
+
export { type McpAnnotations, McpAnnotationsSchema, type McpMediaContent, McpMediaContentSchema, ViewFileErrorSchema, ViewFileInputSchema, type ViewFileOutput, ViewFileOutputSchema, } from './tools/view-file-contract.js';
|
|
29
|
+
//# sourceMappingURL=tools-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-contract.d.ts","sourceRoot":"","sources":["../src/tools-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,wBAAwB,EAC7B,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,eAAe,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AsyncOperationCancelResultSchema,
|
|
3
|
+
McpAnnotationsSchema,
|
|
4
|
+
McpMediaContentSchema,
|
|
5
|
+
ViewFileErrorSchema,
|
|
6
|
+
ViewFileInputSchema,
|
|
7
|
+
ViewFileOutputSchema,
|
|
8
|
+
createAsyncOperationSnapshotSchema
|
|
9
|
+
} from "./index-4fpa9dy2.js";
|
|
10
|
+
import {
|
|
11
|
+
coerceJsonArgs
|
|
12
|
+
} from "./index-7zbps32p.js";
|
|
13
|
+
import"./index-kzfs85xp.js";
|
|
14
|
+
import"./index-77fekveh.js";
|
|
15
|
+
export {
|
|
16
|
+
createAsyncOperationSnapshotSchema,
|
|
17
|
+
coerceJsonArgs,
|
|
18
|
+
ViewFileOutputSchema,
|
|
19
|
+
ViewFileInputSchema,
|
|
20
|
+
ViewFileErrorSchema,
|
|
21
|
+
McpMediaContentSchema,
|
|
22
|
+
McpAnnotationsSchema,
|
|
23
|
+
AsyncOperationCancelResultSchema
|
|
24
|
+
};
|
package/dist/tools.d.ts
CHANGED
|
@@ -2,13 +2,12 @@ export type { McpServer } from '@modelcontextprotocol/server';
|
|
|
2
2
|
export type { ManagedFileBoundary, ManagedFileReadOptions, ManagedFileSource, ManagedFileWriteOptions, } from './files/boundary.js';
|
|
3
3
|
export type { OperationIdentity } from './server/types.js';
|
|
4
4
|
export { type AgentContext, type AgentMountConfig, mountAgent } from './tools/agent.js';
|
|
5
|
-
export { type AdaptedContractAsyncOperationConfig, type AdaptedContractAsyncOperationFollowKey, type AdaptedContractAsyncOperationStartKey, type AdaptedContractAsyncOperationWaitKey, type AsyncOperationCancelCapability, type
|
|
5
|
+
export { type AdaptedContractAsyncOperationConfig, type AdaptedContractAsyncOperationFollowKey, type AdaptedContractAsyncOperationStartKey, type AdaptedContractAsyncOperationWaitKey, type AsyncOperationCancelCapability, type AsyncOperationContractConfig, type AsyncOperationContractWithStartOutputConfig, type AsyncOperationFollowDefinition, type AsyncOperationIdentity, type AsyncOperationOutputCapability, type AsyncOperationStartDefinition, type BoundAdaptedContractAsyncOperation, bindContractAsyncOperation, type ContractAsyncOperationConfig, type ContractAsyncOperationFollowKey, type ContractAsyncOperationInputAdapters, type ContractAsyncOperationKeys, type ContractAsyncOperationStartKey, type ContractAsyncOperationWaitKey, type DefinedAsyncOperationContract, defineAsyncOperation, defineAsyncOperationContract, type RuntimeAsyncOperation, type RuntimeAsyncOperationConfig, } from './tools/async-operation.js';
|
|
6
6
|
export { type CliConfig, type CliSurfaceSource, createCli } from './tools/cli.js';
|
|
7
7
|
export { type CliCommandContext, type CliCommandDefinition, type CliCommandDefinitionBase, type CliCommandDefinitionWithOutput, type CliCommandDefinitionWithoutOutput, defineCliCommand, } from './tools/cli-command.js';
|
|
8
8
|
export type { ExitCodeMap } from './tools/cli-format.js';
|
|
9
9
|
export type { CliPresentationPolicyConfig } from './tools/cli-policy.js';
|
|
10
10
|
export type { CliWaitConfig } from './tools/cli-wait.js';
|
|
11
|
-
export { coerceJsonArgs } from './tools/coerce.js';
|
|
12
11
|
export { type DefineDownloadToolConfig, defineDownloadTool, } from './tools/define-download-tool.js';
|
|
13
12
|
export { type DefineUploadToolConfig, defineUploadTool, UploadToolInputSchema, } from './tools/define-upload-tool.js';
|
|
14
13
|
export { type DefineViewFileToolConfig, defineViewFileTool, } from './tools/define-view-file-tool.js';
|
|
@@ -40,5 +39,6 @@ export { createToolLogger, type ToolCallRecord, type ToolLoggerConfig, } from '.
|
|
|
40
39
|
export { createToolkit, type Toolkit } from './tools/toolkit.js';
|
|
41
40
|
export { summarizeTransports, type TransportCounts, type TransportSummary, } from './tools/transports.js';
|
|
42
41
|
export { findUntypedProperties, type UntypedProperty } from './tools/untyped-properties.js';
|
|
43
|
-
export {
|
|
42
|
+
export { mountViewFile, resolveMedia, type ViewFileOptions } from './tools/view-file.js';
|
|
43
|
+
export * from './tools-contract.js';
|
|
44
44
|
//# sourceMappingURL=tools.d.ts.map
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,KAAK,mCAAmC,EACxC,KAAK,sCAAsC,EAC3C,KAAK,qCAAqC,EAC1C,KAAK,oCAAoC,EACzC,KAAK,8BAA8B,EACnC,KAAK,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,KAAK,mCAAmC,EACxC,KAAK,sCAAsC,EAC3C,KAAK,qCAAqC,EAC1C,KAAK,oCAAoC,EACzC,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,2CAA2C,EAChD,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,kCAAkC,EACvC,0BAA0B,EAC1B,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,mCAAmC,EACxC,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KA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BAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtF,cAAc,kBAAkB,CAAC"}
|
package/dist/tools.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./index-
|
|
4
|
-
import {
|
|
5
|
-
buildToolManifest,
|
|
6
|
-
mountAgent
|
|
7
|
-
} from "./index-ezmn6ac6.js";
|
|
8
|
-
import"./index-3xnq72rz.js";
|
|
9
|
-
import {
|
|
10
|
-
argumentsDigest
|
|
11
|
-
} from "./index-a916km3r.js";
|
|
2
|
+
ManagedFileError
|
|
3
|
+
} from "./index-actkayzn.js";
|
|
12
4
|
import {
|
|
13
5
|
signJwt,
|
|
14
6
|
verifyPkce
|
|
15
|
-
} from "./index-
|
|
7
|
+
} from "./index-xcetq6j3.js";
|
|
16
8
|
import {
|
|
17
9
|
DEFAULT_CORS_ALLOW_HEADERS,
|
|
18
10
|
DEFAULT_PROCESS_SIGNALS,
|
|
@@ -20,10 +12,30 @@ import {
|
|
|
20
12
|
defaultSignalSource,
|
|
21
13
|
guardSignalCallback,
|
|
22
14
|
reportSignalError
|
|
23
|
-
} from "./index-
|
|
15
|
+
} from "./index-m9kzax52.js";
|
|
16
|
+
import {
|
|
17
|
+
redact
|
|
18
|
+
} from "./index-dxjjv399.js";
|
|
19
|
+
import {
|
|
20
|
+
buildToolManifest,
|
|
21
|
+
mountAgent
|
|
22
|
+
} from "./index-dxesg10d.js";
|
|
23
|
+
import"./index-3xnq72rz.js";
|
|
24
|
+
import {
|
|
25
|
+
argumentsDigest
|
|
26
|
+
} from "./index-a916km3r.js";
|
|
27
|
+
import {
|
|
28
|
+
AsyncOperationCancelResultSchema,
|
|
29
|
+
McpAnnotationsSchema,
|
|
30
|
+
McpMediaContentSchema,
|
|
31
|
+
ViewFileErrorSchema,
|
|
32
|
+
ViewFileInputSchema,
|
|
33
|
+
ViewFileOutputSchema,
|
|
34
|
+
createAsyncOperationSnapshotSchema
|
|
35
|
+
} from "./index-4fpa9dy2.js";
|
|
24
36
|
import {
|
|
25
37
|
createToolInvoker
|
|
26
|
-
} from "./index-
|
|
38
|
+
} from "./index-egaabxkz.js";
|
|
27
39
|
import {
|
|
28
40
|
WaitTimeoutError,
|
|
29
41
|
createCli,
|
|
@@ -32,35 +44,31 @@ import {
|
|
|
32
44
|
fetchPinnedDocument,
|
|
33
45
|
readCapped,
|
|
34
46
|
runWaitOperation
|
|
35
|
-
} from "./index-
|
|
47
|
+
} from "./index-vwp69871.js";
|
|
48
|
+
import"./index-sbdmyz75.js";
|
|
36
49
|
import {
|
|
37
50
|
collectToolSurface
|
|
38
|
-
} from "./index-
|
|
51
|
+
} from "./index-2rwwmr7v.js";
|
|
39
52
|
import {
|
|
40
53
|
createRuntimeToolFactory,
|
|
41
54
|
defineRuntimeTool
|
|
42
|
-
} from "./index-
|
|
55
|
+
} from "./index-dx9xehwt.js";
|
|
43
56
|
import {
|
|
44
57
|
collectTools,
|
|
45
58
|
createToolRunner,
|
|
46
59
|
formatToolError
|
|
47
|
-
} from "./index-
|
|
60
|
+
} from "./index-5mtc969c.js";
|
|
48
61
|
import {
|
|
49
62
|
ToolExecutionControlError,
|
|
50
|
-
coerceJsonArgs,
|
|
51
63
|
executeToolMethod,
|
|
52
64
|
isToolExecutionControlError,
|
|
53
65
|
toolResultFromError
|
|
54
|
-
} from "./index-
|
|
66
|
+
} from "./index-758zx2ha.js";
|
|
55
67
|
import {
|
|
56
68
|
getRequestContext,
|
|
57
69
|
getTraceId,
|
|
58
70
|
runWithRequestContext
|
|
59
|
-
} from "./index-
|
|
60
|
-
import {
|
|
61
|
-
ManagedFileError
|
|
62
|
-
} from "./index-bfcpjw20.js";
|
|
63
|
-
import"./index-sbdmyz75.js";
|
|
71
|
+
} from "./index-dwf1f2ap.js";
|
|
64
72
|
import {
|
|
65
73
|
PORTABLE_JSON_SCHEMA_FORMATS,
|
|
66
74
|
assertToolName,
|
|
@@ -71,29 +79,32 @@ import {
|
|
|
71
79
|
prepareProjectedMcpTools,
|
|
72
80
|
presentationMetadata,
|
|
73
81
|
validateMcpRoundPolicy
|
|
74
|
-
} from "./index-
|
|
82
|
+
} from "./index-mgtxfe6b.js";
|
|
75
83
|
import"./index-cby4ar3v.js";
|
|
84
|
+
import {
|
|
85
|
+
coerceJsonArgs
|
|
86
|
+
} from "./index-7zbps32p.js";
|
|
76
87
|
import {
|
|
77
88
|
normalizeError,
|
|
78
89
|
resolvePropagationContext
|
|
79
|
-
} from "./index-
|
|
90
|
+
} from "./index-fxz0v7vg.js";
|
|
80
91
|
import {
|
|
81
92
|
defineContract
|
|
82
|
-
} from "./index-
|
|
93
|
+
} from "./index-y01f4223.js";
|
|
94
|
+
import {
|
|
95
|
+
ManagedFilePathSchema,
|
|
96
|
+
ManagedFileRefSchema
|
|
97
|
+
} from "./index-6k1937bx.js";
|
|
83
98
|
import {
|
|
84
99
|
AppError,
|
|
85
100
|
STITCH_ERROR_STATUS
|
|
86
101
|
} from "./index-0w9abg87.js";
|
|
102
|
+
import"./index-kzfs85xp.js";
|
|
87
103
|
import {
|
|
88
104
|
isRecord
|
|
89
|
-
} from "./index-
|
|
90
|
-
import {
|
|
91
|
-
ManagedFilePathSchema,
|
|
92
|
-
ManagedFileRefSchema
|
|
93
|
-
} from "./index-6k1937bx.js";
|
|
105
|
+
} from "./index-77fekveh.js";
|
|
94
106
|
// src/tools/async-operation.ts
|
|
95
107
|
import { z } from "zod";
|
|
96
|
-
|
|
97
108
|
// src/tools/native-definition.ts
|
|
98
109
|
function managedNativeIdentity(identity, method) {
|
|
99
110
|
return { ...identity, method };
|
|
@@ -154,21 +165,6 @@ function defineWaitTool(config) {
|
|
|
154
165
|
}
|
|
155
166
|
|
|
156
167
|
// src/tools/async-operation.ts
|
|
157
|
-
var AsyncOperationCancelResultSchema = z.discriminatedUnion("outcome", [
|
|
158
|
-
z.object({ outcome: z.literal("accepted") }),
|
|
159
|
-
z.object({ outcome: z.literal("already_terminal") }),
|
|
160
|
-
z.object({ outcome: z.literal("rejected"), reason: z.string().min(1) })
|
|
161
|
-
]);
|
|
162
|
-
function createAsyncOperationSnapshotSchema(config) {
|
|
163
|
-
const progress = config.progress ? { progress: config.progress.optional() } : {};
|
|
164
|
-
return z.discriminatedUnion("phase", [
|
|
165
|
-
z.object({ phase: z.literal("pending"), ...progress }),
|
|
166
|
-
z.object({ phase: z.literal("running"), ...progress }),
|
|
167
|
-
z.object({ phase: z.literal("succeeded"), ...progress }),
|
|
168
|
-
z.object({ phase: z.literal("failed"), failure: config.failure, ...progress }),
|
|
169
|
-
z.object({ phase: z.literal("cancelled"), ...progress })
|
|
170
|
-
]);
|
|
171
|
-
}
|
|
172
168
|
function terminal(snapshot) {
|
|
173
169
|
if (typeof snapshot !== "object" || snapshot === null || !("phase" in snapshot)) {
|
|
174
170
|
return false;
|
|
@@ -662,9 +658,7 @@ function defineUploadTool(config) {
|
|
|
662
658
|
}
|
|
663
659
|
// src/tools/view-file.ts
|
|
664
660
|
import { extname as extname2 } from "node:path";
|
|
665
|
-
import { z as z3 } from "zod";
|
|
666
661
|
var MAX_INLINE_BYTES = 20 * 1024 * 1024;
|
|
667
|
-
var MAX_VIEW_FILES = 20;
|
|
668
662
|
var EXT_MIME = {
|
|
669
663
|
".png": "image/png",
|
|
670
664
|
".jpg": "image/jpeg",
|
|
@@ -679,33 +673,6 @@ var EXT_MIME = {
|
|
|
679
673
|
".webm": "video/webm",
|
|
680
674
|
".mov": "video/quicktime"
|
|
681
675
|
};
|
|
682
|
-
var McpAnnotationsSchema = z3.object({
|
|
683
|
-
audience: z3.array(z3.enum(["user", "assistant"])).optional(),
|
|
684
|
-
priority: z3.number().optional()
|
|
685
|
-
});
|
|
686
|
-
var McpMediaContentSchema = z3.discriminatedUnion("type", [
|
|
687
|
-
z3.object({ type: z3.literal("text"), text: z3.string() }),
|
|
688
|
-
z3.object({
|
|
689
|
-
type: z3.literal("image"),
|
|
690
|
-
data: z3.string(),
|
|
691
|
-
mimeType: z3.string(),
|
|
692
|
-
annotations: McpAnnotationsSchema.optional()
|
|
693
|
-
}),
|
|
694
|
-
z3.object({
|
|
695
|
-
type: z3.literal("audio"),
|
|
696
|
-
data: z3.string(),
|
|
697
|
-
mimeType: z3.string(),
|
|
698
|
-
annotations: McpAnnotationsSchema.optional()
|
|
699
|
-
})
|
|
700
|
-
]);
|
|
701
|
-
var ViewFileErrorSchema = z3.object({
|
|
702
|
-
path: z3.string(),
|
|
703
|
-
message: z3.string()
|
|
704
|
-
});
|
|
705
|
-
var ViewFileOutputSchema = z3.object({
|
|
706
|
-
content: z3.array(McpMediaContentSchema),
|
|
707
|
-
errors: z3.array(ViewFileErrorSchema)
|
|
708
|
-
});
|
|
709
676
|
async function fetchSource(pathOrUrl, options, maxBytes) {
|
|
710
677
|
const extMime = EXT_MIME[extname2(pathOrUrl).toLowerCase()];
|
|
711
678
|
if (pathOrUrl.startsWith("http://") || pathOrUrl.startsWith("https://")) {
|
|
@@ -824,9 +791,6 @@ async function resolveMediaWithinBudget(pathOrUrl, options, maxBytes) {
|
|
|
824
791
|
async function resolveMedia(pathOrUrl, options = {}) {
|
|
825
792
|
return (await resolveMediaWithinBudget(pathOrUrl, options, MAX_INLINE_BYTES)).content;
|
|
826
793
|
}
|
|
827
|
-
var ViewFileInputSchema = z3.object({
|
|
828
|
-
paths: z3.union([z3.string(), z3.array(z3.string()).max(MAX_VIEW_FILES)]).describe("Media URL(s) or file path(s) to view")
|
|
829
|
-
});
|
|
830
794
|
async function runViewFileOperation(paths, options = {}, signal) {
|
|
831
795
|
const list = Array.isArray(paths) ? paths : [paths];
|
|
832
796
|
const content = [];
|
|
@@ -950,7 +914,7 @@ import {
|
|
|
950
914
|
createRequestStateCodec,
|
|
951
915
|
McpServer
|
|
952
916
|
} from "@modelcontextprotocol/server";
|
|
953
|
-
import { z as
|
|
917
|
+
import { z as z4 } from "zod";
|
|
954
918
|
|
|
955
919
|
// src/tools/mcp-app.ts
|
|
956
920
|
import { readFileSync } from "node:fs";
|
|
@@ -1292,13 +1256,13 @@ function runInMcpRequestContext(context, toolName, body) {
|
|
|
1292
1256
|
import {
|
|
1293
1257
|
isCallToolResult
|
|
1294
1258
|
} from "@modelcontextprotocol/server";
|
|
1295
|
-
import { z as
|
|
1259
|
+
import { z as z3 } from "zod";
|
|
1296
1260
|
function mountPreparedRuntimeMcp(server, tools, config) {
|
|
1297
1261
|
for (const { definition, descriptor } of tools) {
|
|
1298
1262
|
const { mountable } = descriptor;
|
|
1299
1263
|
const toolConfig = {
|
|
1300
1264
|
description: definition.description,
|
|
1301
|
-
inputSchema:
|
|
1265
|
+
inputSchema: z3.looseObject({}).meta(presentationMetadata(descriptor.inputSchema))
|
|
1302
1266
|
};
|
|
1303
1267
|
if (descriptor.outputSchema)
|
|
1304
1268
|
toolConfig.outputSchema = descriptor.outputSchema;
|
|
@@ -1387,7 +1351,7 @@ function mountPreparedMcp(mcpServer, prepared, config = {}) {
|
|
|
1387
1351
|
const { mountable } = descriptor;
|
|
1388
1352
|
const toolConfig = {
|
|
1389
1353
|
description: mountable.method.desc,
|
|
1390
|
-
inputSchema:
|
|
1354
|
+
inputSchema: z4.looseObject({}).meta(presentationMetadata(descriptor.inputSchema))
|
|
1391
1355
|
};
|
|
1392
1356
|
if (descriptor.outputSchema)
|
|
1393
1357
|
toolConfig.outputSchema = descriptor.outputSchema;
|
|
@@ -1822,7 +1786,7 @@ function bindStdioProcessSignals(handle, options = {}) {
|
|
|
1822
1786
|
return { promise, close };
|
|
1823
1787
|
}
|
|
1824
1788
|
// src/tools/mount-download.ts
|
|
1825
|
-
import { z as
|
|
1789
|
+
import { z as z5 } from "zod";
|
|
1826
1790
|
|
|
1827
1791
|
// src/tools/native-result.ts
|
|
1828
1792
|
function textResult(text, isError = false) {
|
|
@@ -1834,7 +1798,7 @@ function textResult(text, isError = false) {
|
|
|
1834
1798
|
function mountDownload(server, config) {
|
|
1835
1799
|
const name = config.name ?? "download";
|
|
1836
1800
|
assertToolName(name, "<native>", "download");
|
|
1837
|
-
server.registerTool(name, { description: config.description, inputSchema:
|
|
1801
|
+
server.registerTool(name, { description: config.description, inputSchema: z5.object(config.inputSchema) }, async (rawArgs) => {
|
|
1838
1802
|
const args = isRecord(rawArgs) ? rawArgs : {};
|
|
1839
1803
|
try {
|
|
1840
1804
|
const url = await config.resolveUrl(args);
|
|
@@ -1882,11 +1846,11 @@ function mountUpload(server, config) {
|
|
|
1882
1846
|
});
|
|
1883
1847
|
}
|
|
1884
1848
|
// src/tools/mount-wait.ts
|
|
1885
|
-
import { z as
|
|
1849
|
+
import { z as z6 } from "zod";
|
|
1886
1850
|
function mountWait(server, config) {
|
|
1887
1851
|
const name = config.name ?? "wait";
|
|
1888
1852
|
assertToolName(name, "<native>", "wait");
|
|
1889
|
-
server.registerTool(name, { description: config.description, inputSchema:
|
|
1853
|
+
server.registerTool(name, { description: config.description, inputSchema: z6.object(config.inputSchema) }, async (rawArgs) => {
|
|
1890
1854
|
const args = isRecord(rawArgs) ? rawArgs : {};
|
|
1891
1855
|
try {
|
|
1892
1856
|
const { state, timedOut } = await runWaitOperation({
|
|
@@ -1905,19 +1869,19 @@ function mountWait(server, config) {
|
|
|
1905
1869
|
}
|
|
1906
1870
|
// src/tools/oauth-provider.ts
|
|
1907
1871
|
import { randomUUID } from "node:crypto";
|
|
1908
|
-
import { z as
|
|
1872
|
+
import { z as z7 } from "zod";
|
|
1909
1873
|
function isPlainDisplayCharacter(character) {
|
|
1910
1874
|
const codePoint = character.codePointAt(0);
|
|
1911
1875
|
return codePoint !== undefined && codePoint >= 32 && codePoint !== 127 && character !== "<" && character !== ">";
|
|
1912
1876
|
}
|
|
1913
|
-
var CimdClientMetadataSchema =
|
|
1914
|
-
client_id:
|
|
1915
|
-
redirect_uris:
|
|
1916
|
-
client_name:
|
|
1877
|
+
var CimdClientMetadataSchema = z7.object({
|
|
1878
|
+
client_id: z7.url(),
|
|
1879
|
+
redirect_uris: z7.array(z7.url()).min(1),
|
|
1880
|
+
client_name: z7.string().trim().min(1).max(200).refine((value) => Array.from(value).every(isPlainDisplayCharacter), {
|
|
1917
1881
|
message: "client_name must be plain display text"
|
|
1918
1882
|
}),
|
|
1919
|
-
token_endpoint_auth_method:
|
|
1920
|
-
application_type:
|
|
1883
|
+
token_endpoint_auth_method: z7.literal("none"),
|
|
1884
|
+
application_type: z7.enum(["native", "web"]).optional()
|
|
1921
1885
|
});
|
|
1922
1886
|
function createSecureClientMetadataFetcher(policy = {}) {
|
|
1923
1887
|
assertPositiveInteger("cimd.maxBytes", policy.maxBytes ?? DEFAULT_CIMD_MAX_BYTES);
|