stitchkit 0.100.2 → 0.101.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 +153 -0
- package/README.md +2 -1
- package/dist/entrypoints/agent-runtime/browser.js +119 -119
- package/dist/entrypoints/agent-runtime/coding-tools.js +15 -20
- package/dist/entrypoints/agent-runtime/harness.js +55 -63
- package/dist/entrypoints/agent-runtime/openrouter.js +6 -6
- package/dist/entrypoints/agent-runtime/sandbox.js +20 -25
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +11 -13
- package/dist/entrypoints/agent-runtime/sqlite/node.js +11 -13
- package/dist/entrypoints/agent-runtime/testing.js +32 -34
- package/dist/entrypoints/agent-runtime.js +395 -402
- package/dist/entrypoints/application/diagnostic-journal.js +26 -27
- package/dist/entrypoints/application/directory-inbox.js +16 -17
- package/dist/entrypoints/application/grammy.js +13 -13
- package/dist/entrypoints/application/opentelemetry.js +13 -13
- package/dist/entrypoints/application/schemas.js +24 -24
- package/dist/entrypoints/application.js +209 -210
- package/dist/entrypoints/bin/upgrade-cli.js +2 -2
- package/dist/entrypoints/cli.js +81 -84
- package/dist/entrypoints/contract.js +54 -57
- package/dist/entrypoints/declaration.js +22 -22
- package/dist/entrypoints/files.js +18 -21
- package/dist/entrypoints/geo.js +7 -8
- package/dist/entrypoints/google.js +2 -2
- package/dist/entrypoints/index.js +150 -154
- package/dist/entrypoints/live.js +45 -47
- package/dist/entrypoints/node.js +68 -74
- package/dist/entrypoints/oauth.js +6 -6
- package/dist/entrypoints/observability.d.ts +1 -0
- package/dist/entrypoints/observability.d.ts.map +1 -1
- package/dist/entrypoints/observability.js +116 -87
- package/dist/entrypoints/primitives.js +35 -35
- package/dist/entrypoints/react/keyboard.d.ts +4 -0
- package/dist/entrypoints/react/keyboard.d.ts.map +1 -0
- package/dist/entrypoints/react/keyboard.js +397 -0
- package/dist/entrypoints/react.js +10 -10
- package/dist/entrypoints/release.js +7 -7
- package/dist/entrypoints/remote.js +15 -17
- package/dist/entrypoints/server.js +198 -200
- package/dist/entrypoints/telegram/html.d.ts +5 -0
- package/dist/entrypoints/telegram/html.d.ts.map +1 -0
- package/dist/entrypoints/telegram/html.js +26 -0
- package/dist/entrypoints/telegram/screens.d.ts +14 -0
- package/dist/entrypoints/telegram/screens.d.ts.map +1 -0
- package/dist/entrypoints/telegram/screens.js +2028 -0
- package/dist/entrypoints/telegram.d.ts +11 -3
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +779 -159
- package/dist/entrypoints/testing.js +75 -79
- package/dist/entrypoints/tools/connections.js +30 -32
- package/dist/entrypoints/tools/contract.js +18 -20
- package/dist/entrypoints/tools/invoker.js +12 -17
- package/dist/entrypoints/tools.js +224 -229
- package/dist/entrypoints/tracking/server.js +6 -6
- package/dist/entrypoints/tracking.js +40 -42
- package/dist/entrypoints/voice.js +3 -3
- package/dist/{index-eaysmdtq.js → index-0ndk4555.js} +56 -56
- package/dist/{index-2bxbyab0.js → index-1bx1xv1k.js} +1 -1
- package/dist/{index-p5r7qpdd.js → index-1eeqpadm.js} +4 -4
- package/dist/{index-hadmp193.js → index-3ct7hhq6.js} +210 -210
- package/dist/{index-e01r054k.js → index-45tdvqa3.js} +26 -26
- package/dist/{index-dce5wxcq.js → index-4s0fep5q.js} +8 -8
- package/dist/index-50ejfz75.js +9 -0
- package/dist/{index-m9zn6cpq.js → index-5107q189.js} +12 -12
- package/dist/{index-sbdmyz75.js → index-5cc6r990.js} +3 -3
- package/dist/{index-c6bxbsnc.js → index-7kxw1awn.js} +2 -2
- package/dist/{index-0r0fbk7z.js → index-7z9ym7t8.js} +28 -28
- package/dist/{index-p7hgdyhb.js → index-814xpr6d.js} +2 -2
- package/dist/{index-gtj3zc53.js → index-8kzct1d6.js} +99 -99
- package/dist/{index-1zbbzgfh.js → index-9pw0a51a.js} +4 -4
- package/dist/{index-79z7m7dt.js → index-a9pd417t.js} +35 -35
- package/dist/{index-ham5sz8m.js → index-aaj97r4y.js} +45 -45
- package/dist/{index-s812ycat.js → index-aan6hqb9.js} +3 -3
- package/dist/{index-10x2hbx0.js → index-adhgd4pe.js} +44 -44
- package/dist/{index-2gxzjvyr.js → index-afjvjyck.js} +23 -23
- package/dist/{index-qmy6zq75.js → index-ahvsksw5.js} +16 -16
- package/dist/{index-hr4tzbwq.js → index-ap3gqe56.js} +3 -3
- package/dist/{index-znfs20ss.js → index-b2bz0kdm.js} +16 -16
- package/dist/{index-r066jx76.js → index-c6aagrbd.js} +148 -120
- package/dist/{index-k30h66yd.js → index-ck71tbcf.js} +9 -9
- package/dist/{index-eqqvgdb3.js → index-ct75c3at.js} +2 -2
- package/dist/{index-gw8bmyaj.js → index-djjhhgjk.js} +41 -41
- package/dist/{index-8qt2m66q.js → index-dvwj1f43.js} +43 -43
- package/dist/index-e05cjgtf.js +144 -0
- package/dist/{index-yw4fzmdz.js → index-e6c2spsd.js} +79 -30
- package/dist/{index-fhwqwxe0.js → index-ej331hah.js} +1 -1
- package/dist/{index-9t3dffv2.js → index-ewbaywk5.js} +5 -5
- package/dist/{index-7p1f0vp2.js → index-fyphpknh.js} +25 -25
- package/dist/{index-83bdg97s.js → index-g149e9pk.js} +1 -1
- package/dist/{index-ngfhvfpd.js → index-g6a3na27.js} +4 -4
- package/dist/{index-qwhynv6x.js → index-h124epcf.js} +20 -20
- package/dist/{index-h6eeys1v.js → index-h97tqqp1.js} +9 -9
- package/dist/{index-zcgf3gqf.js → index-hby4qhax.js} +10 -10
- package/dist/{index-5jrd0yng.js → index-j8aw2c0e.js} +4 -4
- package/dist/{index-d8m8zpd8.js → index-jzczzcsb.js} +14 -14
- package/dist/index-kqnd6a85.js +26 -0
- package/dist/{index-35mh5bhj.js → index-kw1ws0cs.js} +12 -12
- package/dist/{index-4gcnakhx.js → index-m38ej7e5.js} +2 -2
- package/dist/{index-ndddxtyx.js → index-m79yr938.js} +19 -19
- package/dist/{index-5p2m7we1.js → index-m9fndta6.js} +11 -11
- package/dist/index-mnkk1ffz.js +150 -0
- package/dist/index-n15jny5b.js +4 -0
- package/dist/{index-2vtcmrj9.js → index-n53mswt3.js} +20 -20
- package/dist/{index-bt14acb5.js → index-n5yqxd3d.js} +21 -21
- package/dist/{index-bm5rx7n6.js → index-n9tyz8z3.js} +12 -12
- package/dist/index-nmaqxdx7.js +463 -0
- package/dist/{index-mqv3b5rh.js → index-nx6eazt0.js} +30 -30
- package/dist/{index-3z73fh2c.js → index-q0th8q0z.js} +9 -9
- package/dist/{index-v260df89.js → index-qjeggp8w.js} +20 -20
- package/dist/{index-zfrhfn82.js → index-r1z0rd9c.js} +20 -20
- package/dist/{index-wqgjfstn.js → index-r5c4fedv.js} +3 -3
- package/dist/{index-cyktc4bp.js → index-r5hsgkz5.js} +118 -118
- package/dist/{index-0b1ess5e.js → index-r7a7r7ha.js} +1 -1
- package/dist/{index-1j8pm5t0.js → index-rfkh44ss.js} +15 -15
- package/dist/index-rz3z13e9.js +47 -0
- package/dist/{index-k6gpggb9.js → index-s80awwsw.js} +35 -35
- package/dist/{index-vqr7f7v8.js → index-ssmd41kh.js} +124 -124
- package/dist/index-sznqf8fx.js +20 -0
- package/dist/{index-ensd0r74.js → index-v14qqmys.js} +41 -41
- package/dist/{index-paz6sgdp.js → index-v4a2fjtk.js} +36 -36
- package/dist/{index-d9pk3td4.js → index-w0eqdhyd.js} +14 -14
- package/dist/{index-5qn1kx34.js → index-w575evhq.js} +29 -29
- package/dist/{index-3gye9wzb.js → index-w5s3xftz.js} +26 -26
- package/dist/{index-tm88avnj.js → index-wykebpn9.js} +3 -3
- package/dist/{index-sh3s86na.js → index-xkhk5d6g.js} +17 -17
- package/dist/{index-6k1937bx.js → index-xqhede6x.js} +4 -4
- package/dist/{index-f4fx2tza.js → index-zs4ms3th.js} +181 -181
- package/dist/{index-k5hsfc3j.js → index-zsvzhjtk.js} +1 -1
- package/dist/internal/secret-shapes.d.ts +21 -0
- package/dist/internal/secret-shapes.d.ts.map +1 -0
- package/dist/observability/bounded-logger.d.ts +2 -0
- package/dist/observability/bounded-logger.d.ts.map +1 -1
- package/dist/observability/sanitize.d.ts +6 -0
- package/dist/observability/sanitize.d.ts.map +1 -1
- package/dist/observability/secret-values.d.ts +25 -0
- package/dist/observability/secret-values.d.ts.map +1 -0
- package/dist/react/keyboard/hooks.d.ts +71 -0
- package/dist/react/keyboard/hooks.d.ts.map +1 -0
- package/dist/react/keyboard/layers.d.ts +98 -0
- package/dist/react/keyboard/layers.d.ts.map +1 -0
- package/dist/react/keyboard/zone.d.ts +139 -0
- package/dist/react/keyboard/zone.d.ts.map +1 -0
- package/dist/telegram/bot-api.d.ts +7 -4
- package/dist/telegram/bot-api.d.ts.map +1 -1
- package/dist/telegram/crypto.d.ts +16 -0
- package/dist/telegram/crypto.d.ts.map +1 -0
- package/dist/telegram/html/check.d.ts +26 -0
- package/dist/telegram/html/check.d.ts.map +1 -0
- package/dist/telegram/html/nodes.d.ts +70 -0
- package/dist/telegram/html/nodes.d.ts.map +1 -0
- package/dist/telegram/html/parse.d.ts +35 -0
- package/dist/telegram/html/parse.d.ts.map +1 -0
- package/dist/telegram/html/render.d.ts +39 -0
- package/dist/telegram/html/render.d.ts.map +1 -0
- package/dist/telegram/init-data.d.ts +3 -44
- package/dist/telegram/init-data.d.ts.map +1 -1
- package/dist/telegram/operator-channel.d.ts +19 -3
- package/dist/telegram/operator-channel.d.ts.map +1 -1
- package/dist/telegram/operator-dedupe.d.ts +44 -0
- package/dist/telegram/operator-dedupe.d.ts.map +1 -0
- package/dist/telegram/screens/callback-codec.d.ts +34 -0
- package/dist/telegram/screens/callback-codec.d.ts.map +1 -0
- package/dist/telegram/screens/dispatch.d.ts +22 -0
- package/dist/telegram/screens/dispatch.d.ts.map +1 -0
- package/dist/telegram/screens/display.d.ts +70 -0
- package/dist/telegram/screens/display.d.ts.map +1 -0
- package/dist/telegram/screens/execute.d.ts +57 -0
- package/dist/telegram/screens/execute.d.ts.map +1 -0
- package/dist/telegram/screens/html.d.ts +36 -0
- package/dist/telegram/screens/html.d.ts.map +1 -0
- package/dist/telegram/screens/outcome.d.ts +74 -0
- package/dist/telegram/screens/outcome.d.ts.map +1 -0
- package/dist/telegram/screens/path.d.ts +29 -0
- package/dist/telegram/screens/path.d.ts.map +1 -0
- package/dist/telegram/screens/reconcile.d.ts +67 -0
- package/dist/telegram/screens/reconcile.d.ts.map +1 -0
- package/dist/telegram/screens/registry.d.ts +23 -0
- package/dist/telegram/screens/registry.d.ts.map +1 -0
- package/dist/telegram/screens/render.d.ts +70 -0
- package/dist/telegram/screens/render.d.ts.map +1 -0
- package/dist/telegram/screens/runtime.d.ts +133 -0
- package/dist/telegram/screens/runtime.d.ts.map +1 -0
- package/dist/telegram/screens/screen-types.d.ts +130 -0
- package/dist/telegram/screens/screen-types.d.ts.map +1 -0
- package/dist/telegram/screens/screen.d.ts +138 -0
- package/dist/telegram/screens/screen.d.ts.map +1 -0
- package/dist/telegram/screens/state.d.ts +115 -0
- package/dist/telegram/screens/state.d.ts.map +1 -0
- package/dist/telegram/screens/telegram-screens.d.ts +18 -0
- package/dist/telegram/screens/telegram-screens.d.ts.map +1 -0
- package/dist/telegram/screens/test-chat-telegram.d.ts +47 -0
- package/dist/telegram/screens/test-chat-telegram.d.ts.map +1 -0
- package/dist/telegram/screens/test-chat.d.ts +66 -0
- package/dist/telegram/screens/test-chat.d.ts.map +1 -0
- package/dist/telegram/screens/view.d.ts +89 -0
- package/dist/telegram/screens/view.d.ts.map +1 -0
- package/dist/telegram/send-failure.d.ts +25 -0
- package/dist/telegram/send-failure.d.ts.map +1 -1
- package/dist/telegram/update-intake.d.ts +82 -0
- package/dist/telegram/update-intake.d.ts.map +1 -0
- package/dist/telegram/update-store-check.d.ts +22 -0
- package/dist/telegram/update-store-check.d.ts.map +1 -0
- package/dist/telegram/update-store-postgres.d.ts +33 -0
- package/dist/telegram/update-store-postgres.d.ts.map +1 -0
- package/dist/telegram/update-store-sqlite.d.ts +26 -0
- package/dist/telegram/update-store-sqlite.d.ts.map +1 -0
- package/dist/telegram/update-store.d.ts +67 -0
- package/dist/telegram/update-store.d.ts.map +1 -0
- package/dist/telegram/user.d.ts +51 -0
- package/dist/telegram/user.d.ts.map +1 -0
- package/dist/telegram/webhook.d.ts +105 -0
- package/dist/telegram/webhook.d.ts.map +1 -0
- package/dist/tools/cli/args-fields.d.ts +8 -0
- package/dist/tools/cli/args-fields.d.ts.map +1 -1
- package/dist/tools/cli/args-route.d.ts.map +1 -1
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/dist/tools/cli/help.d.ts.map +1 -1
- package/llms/cli.txt +8 -2
- package/llms/observability.txt +15 -2
- package/llms/react-keyboard.txt +193 -0
- package/llms/server.4.txt +16 -0
- package/llms/stitchkit.txt +10 -4
- package/llms/telegram-html.txt +35 -0
- package/llms/telegram-screens.txt +365 -0
- package/llms/telegram.txt +245 -11
- package/llms/{upgrading-0.74.0-0.100.0.txt → upgrading-0.74.0-0.101.0.txt} +39 -3
- package/llms/upgrading.txt +1 -1
- package/llms-full.txt +889 -19
- package/llms.txt +12 -7
- package/package.json +17 -2
- package/dist/index-2k4yrqkc.js +0 -9
- package/dist/index-crykmqkr.js +0 -26
- package/dist/index-y64k3s0h.js +0 -150
- package/dist/index-y91ry9h2.js +0 -4
- /package/dist/{index-hffjpmq9.js → index-9jfdm5tg.js} +0 -0
- /package/dist/{index-zjjyynm3.js → index-d4pa2bgs.js} +0 -0
- /package/dist/{index-rxfy4cq7.js → index-dwfv9a85.js} +0 -0
- /package/dist/{index-5jm36zv1.js → index-gfk7nrht.js} +0 -0
- /package/dist/{index-b9aefrqd.js → index-n1dqr7gf.js} +0 -0
- /package/dist/{index-q3pyb9n0.js → index-sykb5ag7.js} +0 -0
- /package/dist/{index-48ffdxgk.js → index-xhzq2qvj.js} +0 -0
- /package/dist/{index-kzfs85xp.js → index-zsarb5xp.js} +0 -0
|
@@ -1,133 +1,128 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
EffectUnresolvedError2,
|
|
3
|
+
createLocalStepDurability2,
|
|
4
|
+
AgentToolError2,
|
|
5
|
+
isAgentToolError2
|
|
6
|
+
} from "../index-a9pd417t.js";
|
|
4
7
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "../index-
|
|
8
|
-
import"../index-hr4tzbwq.js";
|
|
8
|
+
AppError2,
|
|
9
|
+
STITCH_ERROR_STATUS2
|
|
10
|
+
} from "../index-n53mswt3.js";
|
|
9
11
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
contractOnlyService,
|
|
13
|
-
defaultSignalSource,
|
|
14
|
-
guardSignalCallback,
|
|
15
|
-
mediaTypeEssence,
|
|
16
|
-
reportSignalError
|
|
17
|
-
} from "../index-2gxzjvyr.js";
|
|
18
|
-
import"../index-2bxbyab0.js";
|
|
12
|
+
normalizeError2
|
|
13
|
+
} from "../index-b2bz0kdm.js";
|
|
19
14
|
import {
|
|
20
|
-
|
|
21
|
-
} from "../index-
|
|
15
|
+
resolvePropagationContext2
|
|
16
|
+
} from "../index-hby4qhax.js";
|
|
22
17
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
mountAgent
|
|
26
|
-
} from "../index-sh3s86na.js";
|
|
18
|
+
coerceJsonArgs2
|
|
19
|
+
} from "../index-9pw0a51a.js";
|
|
27
20
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
createLocalStepDurability,
|
|
31
|
-
isAgentToolError
|
|
32
|
-
} from "../index-79z7m7dt.js";
|
|
33
|
-
import"../index-rxfy4cq7.js";
|
|
21
|
+
toJsonSchema
|
|
22
|
+
} from "../index-ct75c3at.js";
|
|
34
23
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
toolSurfaceOutputSchema,
|
|
25
|
+
staticInputRounds,
|
|
26
|
+
validateMcpRoundPolicy,
|
|
27
|
+
validateResolvedInputRounds,
|
|
28
|
+
assertToolName,
|
|
29
|
+
assertUniqueToolName,
|
|
30
|
+
PORTABLE_JSON_SCHEMA_FORMATS2,
|
|
31
|
+
findNonPortableFormats2,
|
|
32
|
+
flattenToolJsonSchema2,
|
|
33
|
+
presentationMetadata,
|
|
34
|
+
findUntypedProperties2,
|
|
35
|
+
prepareProjectedMcpTools
|
|
36
|
+
} from "../index-7z9ym7t8.js";
|
|
40
37
|
import {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
parseToolCallArguments,
|
|
39
|
+
toolResultFromError,
|
|
40
|
+
ToolExecutionControlError2,
|
|
41
|
+
isToolExecutionControlError2
|
|
42
|
+
} from "../index-dvwj1f43.js";
|
|
44
43
|
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
ViewFileInputSchema,
|
|
50
|
-
ViewFileOutputSchema,
|
|
51
|
-
createAsyncOperationSnapshotSchema
|
|
52
|
-
} from "../index-m9zn6cpq.js";
|
|
44
|
+
collectTools2,
|
|
45
|
+
createToolRunner,
|
|
46
|
+
formatToolError
|
|
47
|
+
} from "../index-n9tyz8z3.js";
|
|
53
48
|
import {
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
mountAgent2,
|
|
50
|
+
describeToolCatalog2,
|
|
51
|
+
buildToolManifest2
|
|
52
|
+
} from "../index-xkhk5d6g.js";
|
|
53
|
+
import"../index-m38ej7e5.js";
|
|
56
54
|
import {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} from "../index-r066jx76.js";
|
|
64
|
-
import"../index-sbdmyz75.js";
|
|
55
|
+
ALL_TRANSPORTS2,
|
|
56
|
+
TOOL_TRANSPORTS2,
|
|
57
|
+
defineContract2
|
|
58
|
+
} from "../index-ck71tbcf.js";
|
|
59
|
+
import"../index-1bx1xv1k.js";
|
|
60
|
+
import"../index-sznqf8fx.js";
|
|
65
61
|
import {
|
|
66
|
-
|
|
67
|
-
} from "../index-
|
|
62
|
+
redact2
|
|
63
|
+
} from "../index-e6c2spsd.js";
|
|
68
64
|
import {
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
AsyncOperationCancelResultSchema2,
|
|
66
|
+
createAsyncOperationSnapshotSchema2,
|
|
67
|
+
McpAnnotationsSchema2,
|
|
68
|
+
McpMediaContentSchema2,
|
|
69
|
+
ViewFileErrorSchema2,
|
|
70
|
+
ViewFileOutputSchema2,
|
|
71
|
+
ViewFileInputSchema2
|
|
72
|
+
} from "../index-5107q189.js";
|
|
71
73
|
import {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
fetchGuarded,
|
|
75
|
+
fetchPinnedDocument,
|
|
76
|
+
readCapped,
|
|
77
|
+
WaitTimeoutError,
|
|
78
|
+
runWaitOperation,
|
|
79
|
+
createCli2
|
|
80
|
+
} from "../index-c6aagrbd.js";
|
|
76
81
|
import {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
toolResultFromError
|
|
81
|
-
} from "../index-8qt2m66q.js";
|
|
82
|
+
ManagedFilePathSchema2,
|
|
83
|
+
ManagedFileRefSchema2
|
|
84
|
+
} from "../index-xqhede6x.js";
|
|
82
85
|
import {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
runWithRequestContext
|
|
86
|
-
} from "../index-zfrhfn82.js";
|
|
87
|
-
import"../index-35mh5bhj.js";
|
|
86
|
+
ManagedFileError2
|
|
87
|
+
} from "../index-v4a2fjtk.js";
|
|
88
88
|
import {
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
signJwt2,
|
|
90
|
+
verifyPkce2
|
|
91
|
+
} from "../index-45tdvqa3.js";
|
|
91
92
|
import {
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
DEFAULT_CORS_ALLOW_HEADERS2,
|
|
94
|
+
contractOnlyService,
|
|
95
|
+
DEFAULT_PROCESS_SIGNALS,
|
|
96
|
+
defaultSignalSource,
|
|
97
|
+
reportSignalError,
|
|
98
|
+
guardSignalCallback,
|
|
99
|
+
mediaTypeEssence
|
|
100
|
+
} from "../index-afjvjyck.js";
|
|
94
101
|
import {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
} from "../index-d8m8zpd8.js";
|
|
102
|
+
collectToolSurface
|
|
103
|
+
} from "../index-ewbaywk5.js";
|
|
98
104
|
import {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
assertUniqueToolName,
|
|
102
|
-
findNonPortableFormats,
|
|
103
|
-
findUntypedProperties,
|
|
104
|
-
flattenToolJsonSchema,
|
|
105
|
-
prepareProjectedMcpTools,
|
|
106
|
-
presentationMetadata,
|
|
107
|
-
staticInputRounds,
|
|
108
|
-
toolSurfaceOutputSchema,
|
|
109
|
-
validateMcpRoundPolicy,
|
|
110
|
-
validateResolvedInputRounds
|
|
111
|
-
} from "../index-0r0fbk7z.js";
|
|
105
|
+
argumentsDigest
|
|
106
|
+
} from "../index-r7a7r7ha.js";
|
|
112
107
|
import {
|
|
113
|
-
|
|
114
|
-
} from "../index-
|
|
108
|
+
createToolInvoker2
|
|
109
|
+
} from "../index-m9fndta6.js";
|
|
115
110
|
import {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
runWithRequestContext2,
|
|
112
|
+
getRequestContext2,
|
|
113
|
+
getTraceId2
|
|
114
|
+
} from "../index-r1z0rd9c.js";
|
|
119
115
|
import {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} from "../index-
|
|
116
|
+
defineRuntimeTool2,
|
|
117
|
+
createRuntimeToolFactory2
|
|
118
|
+
} from "../index-jzczzcsb.js";
|
|
123
119
|
import {
|
|
124
120
|
compareCodeUnits,
|
|
125
121
|
serializeCanonicalJson
|
|
126
|
-
} from "../index-
|
|
127
|
-
import"../index-kzfs85xp.js";
|
|
122
|
+
} from "../index-zsvzhjtk.js";
|
|
128
123
|
import {
|
|
129
124
|
isRecord
|
|
130
|
-
} from "../index-
|
|
125
|
+
} from "../index-9jfdm5tg.js";
|
|
131
126
|
// src/server/oauth/cimd.ts
|
|
132
127
|
import { z } from "zod";
|
|
133
128
|
function isPlainDisplayCharacter(character) {
|
|
@@ -454,7 +449,7 @@ function wwwAuthenticateHeader(resource) {
|
|
|
454
449
|
var PUBLIC_CORS = {
|
|
455
450
|
"Access-Control-Allow-Origin": "*",
|
|
456
451
|
"Access-Control-Allow-Methods": "GET, OPTIONS",
|
|
457
|
-
"Access-Control-Allow-Headers":
|
|
452
|
+
"Access-Control-Allow-Headers": DEFAULT_CORS_ALLOW_HEADERS2
|
|
458
453
|
};
|
|
459
454
|
function oauthProtectedResourceRoute(config) {
|
|
460
455
|
const body = JSON.stringify({
|
|
@@ -483,7 +478,7 @@ import { randomUUID } from "node:crypto";
|
|
|
483
478
|
var PUBLIC_CORS2 = {
|
|
484
479
|
"Access-Control-Allow-Origin": "*",
|
|
485
480
|
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
486
|
-
"Access-Control-Allow-Headers":
|
|
481
|
+
"Access-Control-Allow-Headers": DEFAULT_CORS_ALLOW_HEADERS2
|
|
487
482
|
};
|
|
488
483
|
var AS_METADATA_PATH = "/.well-known/oauth-authorization-server";
|
|
489
484
|
var AUTH_CODE_TTL_MS = 60000;
|
|
@@ -657,7 +652,7 @@ function authorizeRoute(ctx) {
|
|
|
657
652
|
}
|
|
658
653
|
const requestedScopes = parseScopes(scope);
|
|
659
654
|
const supportedScopes = new Set(config.scopesSupported ?? []);
|
|
660
|
-
if (config.scopesSupported && requestedScopes.some((
|
|
655
|
+
if (config.scopesSupported && requestedScopes.some((requestedScope) => !supportedScopes.has(requestedScope))) {
|
|
661
656
|
return ctx.redirectToClient(redirectUri, {
|
|
662
657
|
error: "invalid_scope",
|
|
663
658
|
error_description: "One or more requested scopes are not supported",
|
|
@@ -685,11 +680,11 @@ function authorizeRoute(ctx) {
|
|
|
685
680
|
const result = await config.authorizeUser(req, authRequest);
|
|
686
681
|
if (result instanceof Response)
|
|
687
682
|
return result;
|
|
688
|
-
if (!Array.isArray(result.approvedScopes) || !result.approvedScopes.every((
|
|
683
|
+
if (!Array.isArray(result.approvedScopes) || !result.approvedScopes.every((scope) => typeof scope === "string")) {
|
|
689
684
|
throw new Error("authorizeUser must return approvedScopes as an array of strings");
|
|
690
685
|
}
|
|
691
686
|
const approvedScopes = [...new Set(result.approvedScopes)];
|
|
692
|
-
if (approvedScopes.some((
|
|
687
|
+
if (approvedScopes.some((approvedScope) => !requestedScopes.includes(approvedScope) || config.scopesSupported !== undefined && !supportedScopes.has(approvedScope))) {
|
|
693
688
|
throw new Error("authorizeUser approvedScopes must be a subset of requested scopes");
|
|
694
689
|
}
|
|
695
690
|
const approvedScope = approvedScopes.length > 0 ? approvedScopes.join(" ") : undefined;
|
|
@@ -737,7 +732,7 @@ function tokenRoute(ctx) {
|
|
|
737
732
|
return oauthError("invalid_grant", "client_id mismatch");
|
|
738
733
|
if (data.redirectUri !== redirectUri)
|
|
739
734
|
return oauthError("invalid_grant", "redirect_uri mismatch");
|
|
740
|
-
if (!await
|
|
735
|
+
if (!await verifyPkce2(verifier, data.codeChallenge)) {
|
|
741
736
|
return oauthError("invalid_grant", "PKCE verification failed");
|
|
742
737
|
}
|
|
743
738
|
const accessToken = await ctx.issueAccessToken(data.userId, data.resource, data.clientId, data.scope);
|
|
@@ -823,7 +818,7 @@ function mountOAuthProvider(config) {
|
|
|
823
818
|
return dcrClient?.clientId === clientId ? dcrClient : null;
|
|
824
819
|
};
|
|
825
820
|
const redirectToClient = (uri, params) => redirectWith(uri, { ...params, iss: config.issuer });
|
|
826
|
-
const issueAccessToken = (userId, audience, clientId, scope) =>
|
|
821
|
+
const issueAccessToken = (userId, audience, clientId, scope) => signJwt2({ scope, client_id: clientId }, config.signingSecret, {
|
|
827
822
|
issuer: config.issuer,
|
|
828
823
|
audience,
|
|
829
824
|
subject: userId,
|
|
@@ -862,7 +857,7 @@ function composeToolLifecycle(...hooks) {
|
|
|
862
857
|
// src/tools/list-names.ts
|
|
863
858
|
function listToolNames(surface) {
|
|
864
859
|
const entries = new Map;
|
|
865
|
-
for (const transport of
|
|
860
|
+
for (const transport of TOOL_TRANSPORTS2) {
|
|
866
861
|
for (const entry of collectToolSurface({
|
|
867
862
|
surface,
|
|
868
863
|
transport,
|
|
@@ -995,7 +990,7 @@ function formatMcpResult(result, mode, toolName, errorHint) {
|
|
|
995
990
|
serialized = undefined;
|
|
996
991
|
}
|
|
997
992
|
if (serialized === undefined) {
|
|
998
|
-
const safe =
|
|
993
|
+
const safe = redact2(result.data, { sensitiveKeys: /(?!)/ });
|
|
999
994
|
return { content: textBlock(JSON.stringify(safe, null, 2)), structuredContent: safe };
|
|
1000
995
|
}
|
|
1001
996
|
return { content: textBlock(serialized), structuredContent: result.data };
|
|
@@ -1007,7 +1002,7 @@ function formatMcpResult(result, mode, toolName, errorHint) {
|
|
|
1007
1002
|
}
|
|
1008
1003
|
function prepareMcpSurface(services, config = {}) {
|
|
1009
1004
|
const serviceList = Array.isArray(services) ? services : [services];
|
|
1010
|
-
const tools = serviceList.flatMap((service) =>
|
|
1005
|
+
const tools = serviceList.flatMap((service) => collectTools2(service, "MCP", config));
|
|
1011
1006
|
return prepareMcpTools(tools, config);
|
|
1012
1007
|
}
|
|
1013
1008
|
function prepareMcpTools(tools, config = {}) {
|
|
@@ -1177,7 +1172,7 @@ async function runRoundFailure(tool, rawArgs, runTool, context, code, message) {
|
|
|
1177
1172
|
...tool.method,
|
|
1178
1173
|
outputSchema: undefined,
|
|
1179
1174
|
handler: () => {
|
|
1180
|
-
throw new
|
|
1175
|
+
throw new AppError2(code, message, 400);
|
|
1181
1176
|
}
|
|
1182
1177
|
}
|
|
1183
1178
|
}, rawArgs, context);
|
|
@@ -1322,10 +1317,10 @@ async function resolveMcpRound(options) {
|
|
|
1322
1317
|
return { kind: "response", response: options.formatFailure(guarded) };
|
|
1323
1318
|
}
|
|
1324
1319
|
}
|
|
1325
|
-
const
|
|
1326
|
-
if (!
|
|
1320
|
+
const request = requests[0];
|
|
1321
|
+
if (!request)
|
|
1327
1322
|
throw new Error("[stitchkit] validated MRTR policy has no first round");
|
|
1328
|
-
return askRound(options.runtime, options.context,
|
|
1323
|
+
return askRound(options.runtime, options.context, request, {
|
|
1329
1324
|
identity: operationIdentity(options.tool),
|
|
1330
1325
|
argumentsDigest: digest,
|
|
1331
1326
|
round: 0,
|
|
@@ -1388,7 +1383,7 @@ import {
|
|
|
1388
1383
|
TRACESTATE_META_KEY
|
|
1389
1384
|
} from "@modelcontextprotocol/server";
|
|
1390
1385
|
function runInMcpRequestContext(context, toolName, body) {
|
|
1391
|
-
const ambient =
|
|
1386
|
+
const ambient = getRequestContext2();
|
|
1392
1387
|
const metadata = context.mcpReq._meta;
|
|
1393
1388
|
const propagation = metadata ? {
|
|
1394
1389
|
traceparent: metadata[TRACEPARENT_META_KEY],
|
|
@@ -1402,7 +1397,7 @@ function runInMcpRequestContext(context, toolName, body) {
|
|
|
1402
1397
|
path: `/mcp/${toolName}`,
|
|
1403
1398
|
startedAt: process.hrtime.bigint()
|
|
1404
1399
|
},
|
|
1405
|
-
trace:
|
|
1400
|
+
trace: resolvePropagationContext2(propagation, ambient?.trace),
|
|
1406
1401
|
source: "mcp",
|
|
1407
1402
|
method: "MCP",
|
|
1408
1403
|
path: `/mcp/${toolName}`,
|
|
@@ -1410,7 +1405,7 @@ function runInMcpRequestContext(context, toolName, body) {
|
|
|
1410
1405
|
dimensions: ambient?.dimensions ? { ...ambient.dimensions } : undefined,
|
|
1411
1406
|
error: undefined
|
|
1412
1407
|
};
|
|
1413
|
-
return
|
|
1408
|
+
return runWithRequestContext2(request, body);
|
|
1414
1409
|
}
|
|
1415
1410
|
|
|
1416
1411
|
// src/tools/mcp/register.ts
|
|
@@ -1442,28 +1437,28 @@ function registerMcpTool(server, presentation, descriptor, config) {
|
|
|
1442
1437
|
policy: mountable.method.mcp,
|
|
1443
1438
|
runtime: config.multiRoundRuntime,
|
|
1444
1439
|
runTool: config.runTool,
|
|
1445
|
-
formatFailure: (
|
|
1440
|
+
formatFailure: (result) => format(result, "none", name)
|
|
1446
1441
|
});
|
|
1447
1442
|
if (round.kind === "response")
|
|
1448
1443
|
return round.response;
|
|
1449
1444
|
const { present } = presentation;
|
|
1450
1445
|
if (!present) {
|
|
1451
|
-
const
|
|
1452
|
-
return format(
|
|
1446
|
+
const result = await config.runTool(mountable, args, round.context);
|
|
1447
|
+
return format(result, descriptor.outputMode, name);
|
|
1453
1448
|
}
|
|
1454
1449
|
const result = await config.runTool(mountable, args, round.context, {
|
|
1455
1450
|
finalizeOutput: async (data) => {
|
|
1456
1451
|
const presented = await present(data);
|
|
1457
1452
|
if (!isRecord(presented)) {
|
|
1458
|
-
throw new
|
|
1453
|
+
throw new AppError2("INTERNAL_SERVER_ERROR", "Runtime MCP presenter did not return a result", 500);
|
|
1459
1454
|
}
|
|
1460
1455
|
if ("structuredContent" in presented || "isError" in presented) {
|
|
1461
|
-
throw new
|
|
1456
|
+
throw new AppError2("INTERNAL_SERVER_ERROR", "Runtime MCP presenter cannot set framework-owned structuredContent or isError", 500);
|
|
1462
1457
|
}
|
|
1463
1458
|
const structured = format({ ok: true, data }, descriptor.outputMode, name).structuredContent;
|
|
1464
1459
|
const response = structured === undefined ? presented : { ...presented, structuredContent: structured };
|
|
1465
1460
|
if (!isCallToolResult(response)) {
|
|
1466
|
-
throw new
|
|
1461
|
+
throw new AppError2("INTERNAL_SERVER_ERROR", "Runtime MCP presenter returned an invalid CallToolResult", 500);
|
|
1467
1462
|
}
|
|
1468
1463
|
return response;
|
|
1469
1464
|
}
|
|
@@ -2091,16 +2086,16 @@ function buildCanonicalEndpointTable(config, startOutput) {
|
|
|
2091
2086
|
startOutput,
|
|
2092
2087
|
id: config.id,
|
|
2093
2088
|
snapshot: config.snapshot,
|
|
2094
|
-
cancelResult:
|
|
2089
|
+
cancelResult: AsyncOperationCancelResultSchema2
|
|
2095
2090
|
};
|
|
2096
2091
|
const inputFor = {
|
|
2097
2092
|
status: (id) => adapterResult("status", "input", config.id, id),
|
|
2098
2093
|
wait: (id) => adapterResult("wait", "input", config.id, id)
|
|
2099
2094
|
};
|
|
2100
2095
|
if (config.cancel) {
|
|
2101
|
-
endpoints.cancel = endpoint("cancel", "POST", "/cancel", config.id,
|
|
2096
|
+
endpoints.cancel = endpoint("cancel", "POST", "/cancel", config.id, AsyncOperationCancelResultSchema2);
|
|
2102
2097
|
capabilities.cancel = "cancel";
|
|
2103
|
-
schemas.cancel =
|
|
2098
|
+
schemas.cancel = AsyncOperationCancelResultSchema2;
|
|
2104
2099
|
inputFor.cancel = (id) => adapterResult("cancel", "input", config.id, id);
|
|
2105
2100
|
}
|
|
2106
2101
|
if (config.result) {
|
|
@@ -2126,7 +2121,7 @@ function defineAsyncOperationContract(config) {
|
|
|
2126
2121
|
}
|
|
2127
2122
|
const startOutput = config.startOutput ?? config.id;
|
|
2128
2123
|
const { endpoints, capabilities, schemas, inputFor } = buildCanonicalEndpointTable(config, startOutput);
|
|
2129
|
-
const contract = config.scope ?
|
|
2124
|
+
const contract = config.scope ? defineContract2({ prefix: config.prefix, scope: config.scope }, endpoints) : defineContract2({ prefix: config.prefix }, endpoints);
|
|
2130
2125
|
const applicationStartOutput = config.startOutput;
|
|
2131
2126
|
const applicationIdFromStart = config.idFromStart;
|
|
2132
2127
|
const idFromStart = applicationStartOutput && applicationIdFromStart ? (output) => adapterResult("start", "id", config.id, applicationIdFromStart(output)) : (output) => adapterResult("start", "id", config.id, output);
|
|
@@ -2158,7 +2153,7 @@ function defineWaitTool(config) {
|
|
|
2158
2153
|
}
|
|
2159
2154
|
} : undefined;
|
|
2160
2155
|
const present = renderedMcp || config.present ? { ...renderedMcp, ...config.present } : undefined;
|
|
2161
|
-
return
|
|
2156
|
+
return defineRuntimeTool2({
|
|
2162
2157
|
name: config.name ?? "wait",
|
|
2163
2158
|
description: config.description,
|
|
2164
2159
|
identity: managedNativeIdentity(config.identity, "GET"),
|
|
@@ -2180,16 +2175,16 @@ function defineWaitTool(config) {
|
|
|
2180
2175
|
});
|
|
2181
2176
|
} catch (error) {
|
|
2182
2177
|
if (error instanceof WaitTimeoutError) {
|
|
2183
|
-
throw new
|
|
2178
|
+
throw new AppError2("WAIT_TIMEOUT", "Wait timed out before the first snapshot", 408);
|
|
2184
2179
|
}
|
|
2185
2180
|
throw error;
|
|
2186
2181
|
}
|
|
2187
2182
|
const rendered = config.render?.(result.state, result.timedOut);
|
|
2188
2183
|
if (result.timedOut) {
|
|
2189
|
-
throw new
|
|
2184
|
+
throw new AppError2("WAIT_TIMEOUT", rendered?.text ?? "Wait timed out before the operation completed", 408);
|
|
2190
2185
|
}
|
|
2191
2186
|
if (rendered?.isError) {
|
|
2192
|
-
throw new
|
|
2187
|
+
throw new AppError2("WAIT_FAILED", rendered.text, 409);
|
|
2193
2188
|
}
|
|
2194
2189
|
return result.state;
|
|
2195
2190
|
}
|
|
@@ -2234,7 +2229,7 @@ function createRuntimeOperationSurface(config) {
|
|
|
2234
2229
|
}
|
|
2235
2230
|
function defineObservationTools(surface) {
|
|
2236
2231
|
const { config } = surface;
|
|
2237
|
-
const status =
|
|
2232
|
+
const status = defineRuntimeTool2({
|
|
2238
2233
|
...surface.common("status"),
|
|
2239
2234
|
identity: surface.identity("status", "GET"),
|
|
2240
2235
|
input: config.id,
|
|
@@ -2255,11 +2250,11 @@ function defineObservationTools(surface) {
|
|
|
2255
2250
|
return { status, wait };
|
|
2256
2251
|
}
|
|
2257
2252
|
function defineCancelTool(surface, capability) {
|
|
2258
|
-
return
|
|
2253
|
+
return defineRuntimeTool2({
|
|
2259
2254
|
...surface.common("cancel"),
|
|
2260
2255
|
identity: surface.identity("cancel", "DELETE"),
|
|
2261
2256
|
input: surface.config.id,
|
|
2262
|
-
output:
|
|
2257
|
+
output: AsyncOperationCancelResultSchema2,
|
|
2263
2258
|
handler: async (context) => {
|
|
2264
2259
|
const inspected = await surface.inspect("cancel", context);
|
|
2265
2260
|
return capability.handler(inspected.state, context);
|
|
@@ -2267,7 +2262,7 @@ function defineCancelTool(surface, capability) {
|
|
|
2267
2262
|
});
|
|
2268
2263
|
}
|
|
2269
2264
|
function defineSucceededOutputTool(surface, kind, capability, unavailableMessage) {
|
|
2270
|
-
return
|
|
2265
|
+
return defineRuntimeTool2({
|
|
2271
2266
|
...surface.common(kind),
|
|
2272
2267
|
identity: surface.identity(kind, "GET"),
|
|
2273
2268
|
input: surface.config.id,
|
|
@@ -2275,7 +2270,7 @@ function defineSucceededOutputTool(surface, kind, capability, unavailableMessage
|
|
|
2275
2270
|
handler: async (context) => {
|
|
2276
2271
|
const inspected = await surface.inspect(kind, context);
|
|
2277
2272
|
if (!succeeded(inspected.snapshot)) {
|
|
2278
|
-
throw new
|
|
2273
|
+
throw new AppError2("OPERATION_NOT_SUCCEEDED", unavailableMessage, 409);
|
|
2279
2274
|
}
|
|
2280
2275
|
return capability.handler(inspected.state, context);
|
|
2281
2276
|
}
|
|
@@ -2285,7 +2280,7 @@ function defineSucceededOutputTool(surface, kind, capability, unavailableMessage
|
|
|
2285
2280
|
// src/tools/operations/async-operation-runtime.ts
|
|
2286
2281
|
function defineAsyncOperation(config) {
|
|
2287
2282
|
const surface = createRuntimeOperationSurface(config);
|
|
2288
|
-
const start =
|
|
2283
|
+
const start = defineRuntimeTool2({
|
|
2289
2284
|
...surface.common("start"),
|
|
2290
2285
|
identity: surface.identity("start", "POST"),
|
|
2291
2286
|
input: config.startInput,
|
|
@@ -2314,7 +2309,7 @@ function defineAsyncOperation(config) {
|
|
|
2314
2309
|
schemas: {
|
|
2315
2310
|
id: config.id,
|
|
2316
2311
|
snapshot: config.snapshot,
|
|
2317
|
-
cancelResult:
|
|
2312
|
+
cancelResult: AsyncOperationCancelResultSchema2
|
|
2318
2313
|
}
|
|
2319
2314
|
};
|
|
2320
2315
|
}
|
|
@@ -2431,7 +2426,7 @@ function createToolLogger(config = {}) {
|
|
|
2431
2426
|
code: result.ok ? undefined : result.code,
|
|
2432
2427
|
durationMs: Math.round(durationMs),
|
|
2433
2428
|
source: String(context.source),
|
|
2434
|
-
traceId:
|
|
2429
|
+
traceId: getTraceId2()
|
|
2435
2430
|
};
|
|
2436
2431
|
const codePart = result.ok ? "" : ` ${result.code}`;
|
|
2437
2432
|
log(`[tool] ${result.ok ? "ok" : "warn"} ${toolName} (${endpoint.serviceName}.${endpoint.key})${codePart} ${record.durationMs}ms`);
|
|
@@ -2443,11 +2438,11 @@ function createToolLogger(config = {}) {
|
|
|
2443
2438
|
function createToolkit() {
|
|
2444
2439
|
return {
|
|
2445
2440
|
mountMcp: (server, services, config) => mountMcp(server, services, config),
|
|
2446
|
-
mountAgent: (services, config) =>
|
|
2441
|
+
mountAgent: (services, config) => mountAgent2(services, config),
|
|
2447
2442
|
buildMcpServer: (config, auth) => buildMcpServer(config, auth),
|
|
2448
2443
|
createMcpHandler: (config) => createMcpHandler(config),
|
|
2449
2444
|
createStdioMcpServer: (config) => createStdioMcpServer(config),
|
|
2450
|
-
createCli: (config) =>
|
|
2445
|
+
createCli: (config) => createCli2(config)
|
|
2451
2446
|
};
|
|
2452
2447
|
}
|
|
2453
2448
|
// src/tools/transfer/download-core.ts
|
|
@@ -2527,7 +2522,7 @@ var SAFE_MANAGED_FILE_MESSAGES = {
|
|
|
2527
2522
|
FILE_EXISTS: "Managed file already exists"
|
|
2528
2523
|
};
|
|
2529
2524
|
function managedFileAppError(error) {
|
|
2530
|
-
if (!(error instanceof
|
|
2525
|
+
if (!(error instanceof ManagedFileError2))
|
|
2531
2526
|
return null;
|
|
2532
2527
|
switch (error.code) {
|
|
2533
2528
|
case "FILE_INVALID_PATH":
|
|
@@ -2537,30 +2532,30 @@ function managedFileAppError(error) {
|
|
|
2537
2532
|
case "FILE_INSPECTION_REJECTED":
|
|
2538
2533
|
case "FILE_TOO_LARGE":
|
|
2539
2534
|
case "FILE_EXISTS":
|
|
2540
|
-
return new
|
|
2535
|
+
return new AppError2(error.code, SAFE_MANAGED_FILE_MESSAGES[error.code], STITCH_ERROR_STATUS2[error.code]);
|
|
2541
2536
|
case "FILE_IO_ERROR":
|
|
2542
2537
|
return null;
|
|
2543
2538
|
}
|
|
2544
2539
|
}
|
|
2545
2540
|
function normalizeFileToolError(error) {
|
|
2546
|
-
return managedFileAppError(error) ??
|
|
2541
|
+
return managedFileAppError(error) ?? normalizeError2(error);
|
|
2547
2542
|
}
|
|
2548
2543
|
|
|
2549
2544
|
// src/tools/transfer/define-download-tool.ts
|
|
2550
2545
|
function defineDownloadTool(config) {
|
|
2551
|
-
return
|
|
2546
|
+
return defineRuntimeTool2({
|
|
2552
2547
|
name: config.name ?? "download",
|
|
2553
2548
|
description: config.description,
|
|
2554
2549
|
identity: managedNativeIdentity(config.identity, "POST"),
|
|
2555
2550
|
input: config.input,
|
|
2556
|
-
output:
|
|
2551
|
+
output: ManagedFileRefSchema2,
|
|
2557
2552
|
transports: config.transports,
|
|
2558
2553
|
annotations: config.annotations,
|
|
2559
2554
|
present: config.present,
|
|
2560
2555
|
handler: async (context) => {
|
|
2561
2556
|
const url = await config.resolveUrl(context.input, context);
|
|
2562
2557
|
if (!url) {
|
|
2563
|
-
throw new
|
|
2558
|
+
throw new AppError2("DOWNLOAD_NOT_FOUND", "Nothing to download", 404);
|
|
2564
2559
|
}
|
|
2565
2560
|
try {
|
|
2566
2561
|
return await runDownloadOperation({
|
|
@@ -2574,7 +2569,7 @@ function defineDownloadTool(config) {
|
|
|
2574
2569
|
});
|
|
2575
2570
|
} catch (error) {
|
|
2576
2571
|
if (error instanceof DownloadOperationError) {
|
|
2577
|
-
throw new
|
|
2572
|
+
throw new AppError2(error.code, `Download failed: ${error.message}`, error.status);
|
|
2578
2573
|
}
|
|
2579
2574
|
const managedError = managedFileAppError(error);
|
|
2580
2575
|
if (managedError)
|
|
@@ -2595,10 +2590,10 @@ function runUploadOperation(files, path, upload, signal) {
|
|
|
2595
2590
|
|
|
2596
2591
|
// src/tools/transfer/define-upload-tool.ts
|
|
2597
2592
|
var UploadToolInputSchema = z6.object({
|
|
2598
|
-
path:
|
|
2593
|
+
path: ManagedFilePathSchema2.describe("Path relative to the configured file boundary")
|
|
2599
2594
|
});
|
|
2600
2595
|
function defineUploadTool(config) {
|
|
2601
|
-
return
|
|
2596
|
+
return defineRuntimeTool2({
|
|
2602
2597
|
name: config.name ?? "upload",
|
|
2603
2598
|
description: config.description,
|
|
2604
2599
|
identity: managedNativeIdentity(config.identity, "POST"),
|
|
@@ -2645,7 +2640,7 @@ async function fetchSource(pathOrUrl, options, maxBytes) {
|
|
|
2645
2640
|
signal: options.signal
|
|
2646
2641
|
});
|
|
2647
2642
|
if (!res.ok)
|
|
2648
|
-
throw new
|
|
2643
|
+
throw new AppError2("VIEW_HTTP_ERROR", `HTTP ${res.status}`, 502);
|
|
2649
2644
|
const headerMime = mediaTypeEssence(res.headers.get("content-type"));
|
|
2650
2645
|
const mimeType = headerMime || extMime || "application/octet-stream";
|
|
2651
2646
|
if (mimeType.startsWith("video/")) {
|
|
@@ -2661,11 +2656,11 @@ async function fetchSource(pathOrUrl, options, maxBytes) {
|
|
|
2661
2656
|
return buffer ? { buffer, mimeType, bytesRead: buffer.length } : { tooLarge: true, mimeType, bytesRead: maxBytes };
|
|
2662
2657
|
}
|
|
2663
2658
|
if (!options.files) {
|
|
2664
|
-
throw new
|
|
2659
|
+
throw new AppError2("FILE_INVALID_PATH", "local file paths are disabled — set files to allow them", 400);
|
|
2665
2660
|
}
|
|
2666
2661
|
options.signal?.throwIfAborted();
|
|
2667
2662
|
if (!extMime) {
|
|
2668
|
-
throw new
|
|
2663
|
+
throw new AppError2("FILE_INSPECTION_REJECTED", "refusing to read a non-media file", 422);
|
|
2669
2664
|
}
|
|
2670
2665
|
try {
|
|
2671
2666
|
const source = await options.files.read(pathOrUrl, {
|
|
@@ -2679,7 +2674,7 @@ async function fetchSource(pathOrUrl, options, maxBytes) {
|
|
|
2679
2674
|
bytesRead: buffer.length
|
|
2680
2675
|
};
|
|
2681
2676
|
} catch (error) {
|
|
2682
|
-
if (error instanceof
|
|
2677
|
+
if (error instanceof ManagedFileError2 && error.code === "FILE_TOO_LARGE") {
|
|
2683
2678
|
return { tooLarge: true, mimeType: extMime, bytesRead: maxBytes };
|
|
2684
2679
|
}
|
|
2685
2680
|
throw error;
|
|
@@ -2773,12 +2768,12 @@ async function runViewFileOperation(paths, options = {}, signal) {
|
|
|
2773
2768
|
content.push({ type: "text", text: `[${pathOrUrl}] Error: ${message}` });
|
|
2774
2769
|
}
|
|
2775
2770
|
}
|
|
2776
|
-
return
|
|
2771
|
+
return ViewFileOutputSchema2.parse({ content, errors });
|
|
2777
2772
|
}
|
|
2778
2773
|
function mountViewFile(server, options = {}) {
|
|
2779
2774
|
server.registerTool("view_file", {
|
|
2780
2775
|
description: "View media (image, audio, video) by URL or local path — returns it as content you can SEE / HEAR. Pass several paths to view multiple files at once. Use it on a generation `output` url to inspect the result.",
|
|
2781
|
-
inputSchema:
|
|
2776
|
+
inputSchema: ViewFileInputSchema2.shape,
|
|
2782
2777
|
annotations: { title: "View Media", readOnlyHint: true, idempotentHint: true }
|
|
2783
2778
|
}, async (args) => {
|
|
2784
2779
|
const result = await runViewFileOperation(args.paths, options);
|
|
@@ -2803,12 +2798,12 @@ function defineViewFileTool(config) {
|
|
|
2803
2798
|
})
|
|
2804
2799
|
})
|
|
2805
2800
|
};
|
|
2806
|
-
return
|
|
2801
|
+
return defineRuntimeTool2({
|
|
2807
2802
|
name: config.name ?? "view_file",
|
|
2808
2803
|
description: config.description,
|
|
2809
2804
|
identity: managedNativeIdentity(config.identity, "GET"),
|
|
2810
|
-
input:
|
|
2811
|
-
output:
|
|
2805
|
+
input: ViewFileInputSchema2,
|
|
2806
|
+
output: ViewFileOutputSchema2,
|
|
2812
2807
|
transports: config.transports,
|
|
2813
2808
|
annotations: config.annotations ?? {
|
|
2814
2809
|
title: "View Media",
|
|
@@ -2859,7 +2854,7 @@ function mountUpload(server, config) {
|
|
|
2859
2854
|
server.registerTool(name, {
|
|
2860
2855
|
description: config.description,
|
|
2861
2856
|
inputSchema: {
|
|
2862
|
-
path:
|
|
2857
|
+
path: ManagedFilePathSchema2.describe("Path relative to the configured file boundary")
|
|
2863
2858
|
}
|
|
2864
2859
|
}, async (rawArgs) => {
|
|
2865
2860
|
const args = isRecord(rawArgs) ? rawArgs : {};
|
|
@@ -2885,7 +2880,7 @@ function contractCounts(service) {
|
|
|
2885
2880
|
if (!method.expose || method.expose.includes("HTTP"))
|
|
2886
2881
|
counts.HTTP += 1;
|
|
2887
2882
|
}
|
|
2888
|
-
for (const transport of
|
|
2883
|
+
for (const transport of TOOL_TRANSPORTS2) {
|
|
2889
2884
|
counts[transport] = collectToolSurface({
|
|
2890
2885
|
surface: { services: [service] },
|
|
2891
2886
|
transport,
|
|
@@ -2897,7 +2892,7 @@ function contractCounts(service) {
|
|
|
2897
2892
|
}
|
|
2898
2893
|
function runtimeCounts(runtimeTools) {
|
|
2899
2894
|
const counts = emptyCounts();
|
|
2900
|
-
for (const transport of
|
|
2895
|
+
for (const transport of TOOL_TRANSPORTS2) {
|
|
2901
2896
|
counts[transport] = collectToolSurface({
|
|
2902
2897
|
surface: { runtimeTools },
|
|
2903
2898
|
transport,
|
|
@@ -2908,7 +2903,7 @@ function runtimeCounts(runtimeTools) {
|
|
|
2908
2903
|
return counts;
|
|
2909
2904
|
}
|
|
2910
2905
|
function addCounts(target, source) {
|
|
2911
|
-
for (const transport of
|
|
2906
|
+
for (const transport of ALL_TRANSPORTS2)
|
|
2912
2907
|
target[transport] += source[transport];
|
|
2913
2908
|
}
|
|
2914
2909
|
function summarizeTransports(surface) {
|
|
@@ -2941,69 +2936,69 @@ function summarizeTransports(surface) {
|
|
|
2941
2936
|
};
|
|
2942
2937
|
}
|
|
2943
2938
|
export {
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
summarizeTransports,
|
|
2947
|
-
resolveMedia,
|
|
2948
|
-
readMcpCatalogStamp,
|
|
2949
|
-
protectedResourceMetadataUrl,
|
|
2950
|
-
oauthProtectedResourceRoute,
|
|
2951
|
-
mountWait,
|
|
2952
|
-
mountViewFile,
|
|
2953
|
-
mountUpload,
|
|
2954
|
-
mountOAuthProvider,
|
|
2955
|
-
mountMcpResource,
|
|
2956
|
-
mountMcp,
|
|
2957
|
-
mountDownload,
|
|
2958
|
-
mountAgent,
|
|
2959
|
-
mcpCatalogMeta,
|
|
2960
|
-
listToolNames,
|
|
2961
|
-
listContractToolNames,
|
|
2962
|
-
isToolExecutionControlError,
|
|
2963
|
-
isAgentToolError,
|
|
2964
|
-
inlineMcpAppBundle,
|
|
2965
|
-
flattenToolJsonSchema,
|
|
2966
|
-
findUntypedProperties,
|
|
2967
|
-
findNonPortableFormats,
|
|
2968
|
-
describeToolCatalog,
|
|
2969
|
-
defineWaitTool,
|
|
2970
|
-
defineViewFileTool,
|
|
2971
|
-
defineUploadTool,
|
|
2972
|
-
defineToolRegistry,
|
|
2973
|
-
defineRuntimeTool,
|
|
2974
|
-
defineDownloadTool,
|
|
2975
|
-
defineAsyncOperationContract,
|
|
2976
|
-
defineAsyncOperation,
|
|
2977
|
-
createToolkit,
|
|
2978
|
-
createToolLogger,
|
|
2979
|
-
createToolInvoker,
|
|
2980
|
-
createStdioMcpServer,
|
|
2981
|
-
createSecureClientMetadataFetcher,
|
|
2982
|
-
createRuntimeToolFactory,
|
|
2983
|
-
createMcpHttpRoute,
|
|
2984
|
-
createMcpHandler,
|
|
2985
|
-
createLocalStepDurability,
|
|
2986
|
-
createAsyncOperationSnapshotSchema,
|
|
2987
|
-
composeToolLifecycle,
|
|
2988
|
-
collectTools,
|
|
2989
|
-
coerceJsonArgs,
|
|
2990
|
-
buildToolManifest,
|
|
2991
|
-
buildMcpServer,
|
|
2992
|
-
bindStdioProcessSignals,
|
|
2993
|
-
bindContractAsyncOperation,
|
|
2994
|
-
ViewFileOutputSchema,
|
|
2995
|
-
ViewFileInputSchema,
|
|
2996
|
-
ViewFileErrorSchema,
|
|
2997
|
-
UploadToolInputSchema,
|
|
2998
|
-
ToolExecutionControlError,
|
|
2999
|
-
RESOURCE_MIME_TYPE,
|
|
3000
|
-
PROTECTED_RESOURCE_PATH,
|
|
3001
|
-
PORTABLE_JSON_SCHEMA_FORMATS,
|
|
3002
|
-
McpMediaContentSchema,
|
|
3003
|
-
McpAnnotationsSchema,
|
|
3004
|
-
MCP_CATALOG_META_KEY,
|
|
3005
|
-
EffectUnresolvedError,
|
|
2939
|
+
AgentToolError2 as AgentToolError,
|
|
2940
|
+
AsyncOperationCancelResultSchema2 as AsyncOperationCancelResultSchema,
|
|
3006
2941
|
EXT_APPS_BUNDLE_PLACEHOLDER,
|
|
3007
|
-
|
|
3008
|
-
|
|
2942
|
+
EffectUnresolvedError2 as EffectUnresolvedError,
|
|
2943
|
+
MCP_CATALOG_META_KEY,
|
|
2944
|
+
McpAnnotationsSchema2 as McpAnnotationsSchema,
|
|
2945
|
+
McpMediaContentSchema2 as McpMediaContentSchema,
|
|
2946
|
+
PORTABLE_JSON_SCHEMA_FORMATS2 as PORTABLE_JSON_SCHEMA_FORMATS,
|
|
2947
|
+
PROTECTED_RESOURCE_PATH,
|
|
2948
|
+
RESOURCE_MIME_TYPE,
|
|
2949
|
+
ToolExecutionControlError2 as ToolExecutionControlError,
|
|
2950
|
+
UploadToolInputSchema,
|
|
2951
|
+
ViewFileErrorSchema2 as ViewFileErrorSchema,
|
|
2952
|
+
ViewFileInputSchema2 as ViewFileInputSchema,
|
|
2953
|
+
ViewFileOutputSchema2 as ViewFileOutputSchema,
|
|
2954
|
+
bindContractAsyncOperation,
|
|
2955
|
+
bindStdioProcessSignals,
|
|
2956
|
+
buildMcpServer,
|
|
2957
|
+
buildToolManifest2 as buildToolManifest,
|
|
2958
|
+
coerceJsonArgs2 as coerceJsonArgs,
|
|
2959
|
+
collectTools2 as collectTools,
|
|
2960
|
+
composeToolLifecycle,
|
|
2961
|
+
createAsyncOperationSnapshotSchema2 as createAsyncOperationSnapshotSchema,
|
|
2962
|
+
createLocalStepDurability2 as createLocalStepDurability,
|
|
2963
|
+
createMcpHandler,
|
|
2964
|
+
createMcpHttpRoute,
|
|
2965
|
+
createRuntimeToolFactory2 as createRuntimeToolFactory,
|
|
2966
|
+
createSecureClientMetadataFetcher,
|
|
2967
|
+
createStdioMcpServer,
|
|
2968
|
+
createToolInvoker2 as createToolInvoker,
|
|
2969
|
+
createToolLogger,
|
|
2970
|
+
createToolkit,
|
|
2971
|
+
defineAsyncOperation,
|
|
2972
|
+
defineAsyncOperationContract,
|
|
2973
|
+
defineDownloadTool,
|
|
2974
|
+
defineRuntimeTool2 as defineRuntimeTool,
|
|
2975
|
+
defineToolRegistry,
|
|
2976
|
+
defineUploadTool,
|
|
2977
|
+
defineViewFileTool,
|
|
2978
|
+
defineWaitTool,
|
|
2979
|
+
describeToolCatalog2 as describeToolCatalog,
|
|
2980
|
+
findNonPortableFormats2 as findNonPortableFormats,
|
|
2981
|
+
findUntypedProperties2 as findUntypedProperties,
|
|
2982
|
+
flattenToolJsonSchema2 as flattenToolJsonSchema,
|
|
2983
|
+
inlineMcpAppBundle,
|
|
2984
|
+
isAgentToolError2 as isAgentToolError,
|
|
2985
|
+
isToolExecutionControlError2 as isToolExecutionControlError,
|
|
2986
|
+
listContractToolNames,
|
|
2987
|
+
listToolNames,
|
|
2988
|
+
mcpCatalogMeta,
|
|
2989
|
+
mountAgent2 as mountAgent,
|
|
2990
|
+
mountDownload,
|
|
2991
|
+
mountMcp,
|
|
2992
|
+
mountMcpResource,
|
|
2993
|
+
mountOAuthProvider,
|
|
2994
|
+
mountUpload,
|
|
2995
|
+
mountViewFile,
|
|
2996
|
+
mountWait,
|
|
2997
|
+
oauthProtectedResourceRoute,
|
|
2998
|
+
protectedResourceMetadataUrl,
|
|
2999
|
+
readMcpCatalogStamp,
|
|
3000
|
+
resolveMedia,
|
|
3001
|
+
summarizeTransports,
|
|
3002
|
+
validateMcpSchemas,
|
|
3003
|
+
wwwAuthenticateHeader
|
|
3009
3004
|
};
|