stitchkit 0.94.0 → 0.94.1
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 +64 -0
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-listing.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/contained-darwin.d.ts +38 -0
- package/dist/agent-runtime/contained-darwin.d.ts.map +1 -0
- package/dist/agent-runtime/contained-files.d.ts +11 -26
- package/dist/agent-runtime/contained-files.d.ts.map +1 -1
- package/dist/agent-runtime/contained-scan.d.ts +21 -0
- package/dist/agent-runtime/contained-scan.d.ts.map +1 -0
- package/dist/agent-runtime/contained-write.d.ts +9 -0
- package/dist/agent-runtime/contained-write.d.ts.map +1 -0
- package/dist/agent-runtime/deferred-tool-types.d.ts +3 -2
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
- package/dist/agent-runtime/harness-control.d.ts +0 -1
- package/dist/agent-runtime/harness-control.d.ts.map +1 -1
- package/dist/agent-runtime/harness.d.ts +0 -5
- package/dist/agent-runtime/harness.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +3 -2
- package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +1 -1
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-records.d.ts +34 -0
- package/dist/agent-runtime/schedule-records.d.ts.map +1 -0
- package/dist/agent-runtime/schedules.d.ts +34 -0
- package/dist/agent-runtime/schedules.d.ts.map +1 -1
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +434 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts +18 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-support.d.ts +130 -0
- package/dist/agent-runtime/store-conformance-support.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts +12 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance.d.ts.map +1 -1
- package/dist/application/admission-rate.d.ts +21 -0
- package/dist/application/admission-rate.d.ts.map +1 -0
- package/dist/application/admission-run.d.ts +8 -0
- package/dist/application/admission-run.d.ts.map +1 -0
- package/dist/application/admission.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-lock.d.ts +9 -34
- package/dist/application/diagnostic-journal-lock.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
- package/dist/application/kernel-resource-context.d.ts.map +1 -1
- package/dist/application/notification-outbox.d.ts.map +1 -1
- package/dist/application/schedule.d.ts +0 -1
- package/dist/application/schedule.d.ts.map +1 -1
- package/dist/application/watch-hub-core.d.ts +122 -0
- package/dist/application/watch-hub-core.d.ts.map +1 -0
- package/dist/application/watch-hub.d.ts +2 -2
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/browser/client-executors.d.ts +14 -0
- package/dist/browser/client-executors.d.ts.map +1 -0
- package/dist/browser/client-multipart.d.ts +1 -1
- package/dist/browser/client-multipart.d.ts.map +1 -1
- package/dist/browser/client.d.ts +3 -2
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/http-fetch.d.ts +22 -0
- package/dist/browser/http-fetch.d.ts.map +1 -0
- package/dist/browser/http.d.ts +1 -3
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/live-state-core.d.ts +63 -0
- package/dist/browser/live-state-core.d.ts.map +1 -0
- package/dist/browser/live-state.d.ts.map +1 -1
- package/dist/browser/realtime-client.d.ts +26 -0
- package/dist/browser/realtime-client.d.ts.map +1 -0
- package/dist/browser/socket-io-connection.d.ts +82 -0
- package/dist/browser/socket-io-connection.d.ts.map +1 -0
- package/dist/browser/socket-io-peer.d.ts +20 -0
- package/dist/browser/socket-io-peer.d.ts.map +1 -0
- package/dist/browser/socket-io-trace.d.ts +31 -0
- package/dist/browser/socket-io-trace.d.ts.map +1 -0
- package/dist/browser/socket-io.d.ts +2 -18
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/contract/client-types.d.ts +134 -0
- package/dist/contract/client-types.d.ts.map +1 -0
- package/dist/contract/define-validation.d.ts +30 -0
- package/dist/contract/define-validation.d.ts.map +1 -0
- package/dist/contract/define.d.ts +3 -357
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/runtime-context.d.ts +131 -0
- package/dist/contract/runtime-context.d.ts.map +1 -0
- package/dist/contract/tool-options.d.ts +105 -0
- package/dist/contract/tool-options.d.ts.map +1 -0
- package/dist/contract/tool-view.d.ts +15 -2
- package/dist/contract/tool-view.d.ts.map +1 -1
- package/dist/durability/contract.d.ts +83 -0
- package/dist/durability/contract.d.ts.map +1 -1
- package/dist/durability/effect.d.ts +24 -0
- package/dist/durability/effect.d.ts.map +1 -0
- package/dist/durability/engine.d.ts +2 -2
- package/dist/durability/engine.d.ts.map +1 -1
- package/dist/durability/events.d.ts +2 -0
- package/dist/durability/events.d.ts.map +1 -1
- package/dist/durability/ledger.d.ts +11 -0
- package/dist/durability/ledger.d.ts.map +1 -1
- package/dist/durability/parks.d.ts +22 -0
- package/dist/durability/parks.d.ts.map +1 -0
- package/dist/durability/scheduler.d.ts +1 -0
- package/dist/durability/scheduler.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/coding-tools.js +4 -4
- package/dist/entrypoints/agent-runtime/harness.js +127 -116
- package/dist/entrypoints/agent-runtime/sandbox.js +4 -4
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
- package/dist/entrypoints/agent-runtime/testing.js +246 -214
- package/dist/entrypoints/agent-runtime.js +224 -203
- package/dist/entrypoints/application/diagnostic-journal.js +63 -203
- package/dist/entrypoints/application/opentelemetry.js +1 -1
- package/dist/entrypoints/application.js +361 -324
- package/dist/entrypoints/cli.d.ts +4 -1
- package/dist/entrypoints/cli.d.ts.map +1 -1
- package/dist/entrypoints/cli.js +57 -35
- package/dist/entrypoints/contract.d.ts +5 -2
- package/dist/entrypoints/contract.d.ts.map +1 -1
- package/dist/entrypoints/contract.js +3 -2
- package/dist/entrypoints/files.d.ts +2 -0
- package/dist/entrypoints/files.d.ts.map +1 -1
- package/dist/entrypoints/files.js +98 -2
- package/dist/entrypoints/index.d.ts +4 -2
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +348 -282
- package/dist/entrypoints/live.js +89 -71
- package/dist/entrypoints/node.d.ts +2 -1
- package/dist/entrypoints/node.d.ts.map +1 -1
- package/dist/entrypoints/node.js +13 -12
- package/dist/entrypoints/react.js +1 -1
- package/dist/entrypoints/remote.js +4 -4
- package/dist/entrypoints/server.d.ts +4 -2
- package/dist/entrypoints/server.d.ts.map +1 -1
- package/dist/entrypoints/server.js +293 -79
- package/dist/entrypoints/testing.d.ts +2 -1
- package/dist/entrypoints/testing.d.ts.map +1 -1
- package/dist/entrypoints/testing.js +288 -281
- package/dist/entrypoints/tools/connections.js +2 -2
- package/dist/entrypoints/tools/invoker.js +4 -4
- package/dist/entrypoints/tools.d.ts +6 -3
- package/dist/entrypoints/tools.d.ts.map +1 -1
- package/dist/entrypoints/tools.js +245 -202
- package/dist/entrypoints/tracking.js +325 -274
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/file-io.d.ts +14 -0
- package/dist/files/file-io.d.ts.map +1 -0
- package/dist/index-1j8pm5t0.js +412 -0
- package/dist/{index-kvj7f4hq.js → index-2bxbyab0.js} +10 -2
- package/dist/{index-xnj9bgxe.js → index-2gxzjvyr.js} +2 -162
- package/dist/index-4gcnakhx.js +82 -0
- package/dist/{index-j05z5gn4.js → index-55hkhm67.js} +136 -119
- package/dist/{index-cq4qfycf.js → index-79z7m7dt.js} +227 -59
- package/dist/{index-97ac4gph.js → index-7f68ghdn.js} +3 -3
- package/dist/{index-r7nmqpsg.js → index-7p1f0vp2.js} +1 -1
- package/dist/{index-dcpdvjsc.js → index-863ea9jb.js} +4 -4
- package/dist/index-8p52kd5p.js +242 -0
- package/dist/{index-2qzskm8h.js → index-dce5wxcq.js} +1 -1
- package/dist/index-e01r054k.js +105 -0
- package/dist/{index-sees8yf8.js → index-ensd0r74.js} +118 -111
- package/dist/{index-1nd48tm9.js → index-gxrt5h6v.js} +2 -1
- package/dist/{index-e87kakm4.js → index-ham5sz8m.js} +112 -110
- package/dist/{index-kj2wbeta.js → index-het2he5g.js} +280 -196
- package/dist/{index-vcvkq30w.js → index-hmp4800j.js} +3 -3
- package/dist/{index-gyr48nzg.js → index-k30h66yd.js} +71 -151
- package/dist/{index-2cr1cqhn.js → index-khtgb21r.js} +2 -2
- package/dist/{index-x4799c19.js → index-ndddxtyx.js} +11 -11
- package/dist/{index-dydjcp8z.js → index-np4m8hd3.js} +38 -36
- package/dist/{index-p81267c2.js → index-p3vsv1fb.js} +621 -357
- package/dist/{index-mp5sn43f.js → index-p9e0w8hs.js} +2 -2
- package/dist/{index-rewkc2hj.js → index-p9sh0xx4.js} +3 -3
- package/dist/{index-70yj2ebz.js → index-paz6sgdp.js} +107 -103
- package/dist/{index-bn2cjajt.js → index-px2gm2jp.js} +26 -102
- package/dist/index-s812ycat.js +65 -0
- package/dist/{index-xsqjkha9.js → index-sp1tzwnb.js} +2 -2
- package/dist/{index-n6hxg8as.js → index-t9rhjr9f.js} +615 -566
- package/dist/{index-zeemqhqx.js → index-v260df89.js} +88 -80
- package/dist/{index-fdp6hdxn.js → index-w906953s.js} +5 -1
- package/dist/{index-mdzh02yc.js → index-wdkt63w3.js} +1 -1
- package/dist/{index-58k4fp34.js → index-wsm5w4ee.js} +1 -1
- package/dist/{index-v38qyerb.js → index-xw3s75nj.js} +1 -1
- package/dist/internal/atomic-file.d.ts +23 -2
- package/dist/internal/atomic-file.d.ts.map +1 -1
- package/dist/internal/exclusive-lock.d.ts +51 -0
- package/dist/internal/exclusive-lock.d.ts.map +1 -0
- package/dist/internal/process-identity.d.ts +47 -0
- package/dist/internal/process-identity.d.ts.map +1 -0
- package/dist/internal/with-exclusive-lock.d.ts +67 -0
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -0
- package/dist/live/watch-client.d.ts.map +1 -1
- package/dist/observability/audit.d.ts +2 -2
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/event.d.ts +2 -1
- package/dist/observability/event.d.ts.map +1 -1
- package/dist/primitives/export-operation.d.ts +1 -1
- package/dist/primitives/export-operation.d.ts.map +1 -1
- package/dist/realtime/registry.d.ts +0 -5
- package/dist/realtime/registry.d.ts.map +1 -1
- package/dist/server/bun.d.ts +0 -1
- package/dist/server/bun.d.ts.map +1 -1
- package/dist/server/context-contribution.d.ts +1 -1
- package/dist/server/context-contribution.d.ts.map +1 -1
- package/dist/server/context.d.ts +1 -1
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/endpoint-response.d.ts +2 -1
- package/dist/server/endpoint-response.d.ts.map +1 -1
- package/dist/server/error-dispatch.d.ts +1 -1
- package/dist/server/error-dispatch.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +1 -1
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/handler-state.d.ts +1 -1
- package/dist/server/handler-state.d.ts.map +1 -1
- package/dist/server/implement-registry.d.ts +54 -0
- package/dist/server/implement-registry.d.ts.map +1 -0
- package/dist/server/implement.d.ts +9 -55
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/middleware/auth.d.ts +1 -31
- package/dist/server/middleware/auth.d.ts.map +1 -1
- package/dist/server/middleware/jwt.d.ts +31 -0
- package/dist/server/middleware/jwt.d.ts.map +1 -0
- package/dist/server/multipart-reader.d.ts +22 -0
- package/dist/server/multipart-reader.d.ts.map +1 -0
- package/dist/server/multipart.d.ts +1 -1
- package/dist/server/multipart.d.ts.map +1 -1
- package/dist/server/oauth/cimd.d.ts +88 -0
- package/dist/server/oauth/cimd.d.ts.map +1 -0
- package/dist/server/oauth/endpoints.d.ts +39 -0
- package/dist/server/oauth/endpoints.d.ts.map +1 -0
- package/dist/server/oauth/provider.d.ts +1 -68
- package/dist/server/oauth/provider.d.ts.map +1 -1
- package/dist/server/streaming-pump.d.ts +66 -0
- package/dist/server/streaming-pump.d.ts.map +1 -0
- package/dist/server/streaming-route.d.ts +12 -5
- package/dist/server/streaming-route.d.ts.map +1 -1
- package/dist/server/types.d.ts +4 -1
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/unix-client-bun.d.ts.map +1 -1
- package/dist/server/unix-client-http1.d.ts +76 -0
- package/dist/server/unix-client-http1.d.ts.map +1 -0
- package/dist/server/unix-client.d.ts.map +1 -1
- package/dist/testing/handler-clients.d.ts +2 -1
- package/dist/testing/handler-clients.d.ts.map +1 -1
- package/dist/testing/realtime-probe.d.ts +33 -0
- package/dist/testing/realtime-probe.d.ts.map +1 -0
- package/dist/testing/surface-conformance.d.ts +0 -31
- package/dist/testing/surface-conformance.d.ts.map +1 -1
- package/dist/testing/surface-manifest-digest.d.ts +44 -0
- package/dist/testing/surface-manifest-digest.d.ts.map +1 -0
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/tools/agent.d.ts +1 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/args-fields.d.ts +31 -0
- package/dist/tools/cli/args-fields.d.ts.map +1 -0
- package/dist/tools/cli/args-route.d.ts +42 -0
- package/dist/tools/cli/args-route.d.ts.map +1 -0
- package/dist/tools/cli/args-view.d.ts +32 -0
- package/dist/tools/cli/args-view.d.ts.map +1 -0
- package/dist/tools/cli/args.d.ts +2 -65
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/dist/tools/cli/argument-error.d.ts +5 -0
- package/dist/tools/cli/argument-error.d.ts.map +1 -0
- package/dist/tools/cli/checkpoint.d.ts.map +1 -1
- package/dist/tools/cli/command.d.ts +1 -1
- package/dist/tools/cli/command.d.ts.map +1 -1
- package/dist/tools/cli/config.d.ts +1 -1
- package/dist/tools/cli/config.d.ts.map +1 -1
- package/dist/tools/cli/format.d.ts +2 -1
- package/dist/tools/cli/format.d.ts.map +1 -1
- package/dist/tools/cli/invoke.d.ts +2 -1
- package/dist/tools/cli/invoke.d.ts.map +1 -1
- package/dist/tools/cli/managed-surface.d.ts +1 -1
- package/dist/tools/cli/managed-surface.d.ts.map +1 -1
- package/dist/tools/cli/policy.d.ts +1 -1
- package/dist/tools/cli/policy.d.ts.map +1 -1
- package/dist/tools/cli/prepare.d.ts.map +1 -1
- package/dist/tools/cli/run-managed.d.ts.map +1 -1
- package/dist/tools/cli/session.d.ts +1 -1
- package/dist/tools/cli/session.d.ts.map +1 -1
- package/dist/tools/cli/update.d.ts +19 -0
- package/dist/tools/cli/update.d.ts.map +1 -1
- package/dist/tools/cli/view.d.ts +1 -1
- package/dist/tools/cli/view.d.ts.map +1 -1
- package/dist/tools/cli/wait.d.ts +1 -1
- package/dist/tools/cli/wait.d.ts.map +1 -1
- package/dist/tools/connections/runtime.d.ts +1 -1
- package/dist/tools/connections/runtime.d.ts.map +1 -1
- package/dist/tools/execute-args.d.ts +23 -0
- package/dist/tools/execute-args.d.ts.map +1 -0
- package/dist/tools/execute-hooks.d.ts +146 -0
- package/dist/tools/execute-hooks.d.ts.map +1 -0
- package/dist/tools/execute-result.d.ts +40 -0
- package/dist/tools/execute-result.d.ts.map +1 -0
- package/dist/tools/execute.d.ts +4 -193
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/internal/surface-projector.d.ts +2 -1
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/invoker.d.ts +2 -1
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/lifecycle.d.ts +1 -1
- package/dist/tools/lifecycle.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +1 -1
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/prepare.d.ts +2 -1
- package/dist/tools/mcp/prepare.d.ts.map +1 -1
- package/dist/tools/mcp/progress.d.ts +1 -1
- package/dist/tools/mcp/progress.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts +3 -2
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/round-context.d.ts +38 -0
- package/dist/tools/mcp/round-context.d.ts.map +1 -0
- package/dist/tools/mcp/round-policy.d.ts +1 -1
- package/dist/tools/mcp/round-policy.d.ts.map +1 -1
- package/dist/tools/mcp/round.d.ts +3 -11
- package/dist/tools/mcp/round.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts +2 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/dist/tools/mount.d.ts +3 -1
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/native-definition.d.ts +2 -1
- package/dist/tools/native-definition.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-tools.d.ts +2 -1
- package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-types.d.ts +2 -1
- package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +3 -1
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/tool-logger.d.ts +1 -1
- package/dist/tools/tool-logger.d.ts.map +1 -1
- package/dist/tracking/client-listeners.d.ts +30 -0
- package/dist/tracking/client-listeners.d.ts.map +1 -0
- package/dist/tracking/client-visit.d.ts +61 -0
- package/dist/tracking/client-visit.d.ts.map +1 -0
- package/dist/tracking/client.d.ts +3 -2
- package/dist/tracking/client.d.ts.map +1 -1
- package/llms/application.2.txt +266 -2
- package/llms/application.txt +8 -266
- package/llms/cli.2.txt +80 -0
- package/llms/cli.txt +45 -74
- package/llms/contract.txt +3 -3
- package/llms/files.txt +3 -0
- package/llms/tools.2.txt +88 -279
- package/llms/tools.3.txt +288 -0
- package/llms/tools.txt +27 -65
- package/llms-full.txt +108 -12
- package/llms.txt +5 -5
- package/package.json +1 -1
- package/dist/index-e2z3ahw9.js +0 -325
- package/dist/index-mkm15s49.js +0 -394
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The hook vocabulary of a tool call: the context every hook is handed, the
|
|
3
|
+
* three per-call hooks (`beforeToolCall`, `afterToolCall`, `onToolError`), the
|
|
4
|
+
* error-hint policy, and the lifecycle gate a tool shares with HTTP.
|
|
5
|
+
*/
|
|
6
|
+
import type { TransportSource } from '../contract/define.js';
|
|
7
|
+
import type { McpCallContext, RuntimeContext } from '../contract/runtime-context.js';
|
|
8
|
+
import type { OperationIdentity } from '../server/types.js';
|
|
9
|
+
import type { ToolResult } from './execute-result.js';
|
|
10
|
+
export interface ToolCallContext {
|
|
11
|
+
source: TransportSource;
|
|
12
|
+
/** Validated metadata for an MCP call; absent on every other transport. */
|
|
13
|
+
mcp?: McpCallContext;
|
|
14
|
+
/**
|
|
15
|
+
* The provider's id for this tool call, on a surface that has one — today
|
|
16
|
+
* `mountAgent`, where it is the AI SDK's `toolCallId`.
|
|
17
|
+
*
|
|
18
|
+
* Without it a consumer running its own agent loop could see the outcome of a
|
|
19
|
+
* call through `afterToolCall` and had no way to say WHICH call it belonged
|
|
20
|
+
* to, so it reconstructed the answer from the serialised error text instead.
|
|
21
|
+
* That reconstruction is the defect: it is written once per consumer and
|
|
22
|
+
* disagrees silently.
|
|
23
|
+
*/
|
|
24
|
+
toolCallId?: string;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
export interface BeforeToolCallOptions {
|
|
28
|
+
toolName: string;
|
|
29
|
+
args: Record<string, unknown>;
|
|
30
|
+
context: ToolCallContext;
|
|
31
|
+
endpoint: OperationIdentity;
|
|
32
|
+
}
|
|
33
|
+
export interface AfterToolCallOptions extends BeforeToolCallOptions {
|
|
34
|
+
result: ToolResult;
|
|
35
|
+
durationMs: number;
|
|
36
|
+
/** The value as thrown; absent for failures that did not throw. */
|
|
37
|
+
error?: unknown;
|
|
38
|
+
/**
|
|
39
|
+
* The arguments the call actually ran on, when `beforeToolCall` replaced
|
|
40
|
+
* them. Absent when nothing rewrote them — so `args` alone stays the honest
|
|
41
|
+
* record of what the caller sent, and a rewrite is visible as a rewrite
|
|
42
|
+
* rather than by overwriting the evidence.
|
|
43
|
+
*/
|
|
44
|
+
effectiveArgs?: Record<string, unknown>;
|
|
45
|
+
}
|
|
46
|
+
export interface ToolErrorOptions {
|
|
47
|
+
toolName: string;
|
|
48
|
+
error: unknown;
|
|
49
|
+
context: ToolCallContext;
|
|
50
|
+
endpoint: OperationIdentity;
|
|
51
|
+
}
|
|
52
|
+
export interface ToolCallHooks {
|
|
53
|
+
/**
|
|
54
|
+
* Before the arguments are validated — and the one place they can still be
|
|
55
|
+
* changed.
|
|
56
|
+
*
|
|
57
|
+
* Returning a record replaces the arguments for this call; returning
|
|
58
|
+
* `undefined`, `null` or nothing leaves them exactly as they arrived. The
|
|
59
|
+
* replacement is validated by the contract schema like any other input, so
|
|
60
|
+
* this is a way to shape a call, never a way around the schema: a hook that
|
|
61
|
+
* returns something the schema refuses produces an ordinary
|
|
62
|
+
* `VALIDATION_ERROR`.
|
|
63
|
+
*
|
|
64
|
+
* This exists because the pipeline was asymmetric. `lifecycle.afterHandle`
|
|
65
|
+
* could already transform the OUTPUT, while the only way to affect the input
|
|
66
|
+
* was to throw — so a caller wanting to expand a reference into a value
|
|
67
|
+
* before validation had nowhere to stand: this hook sees the raw arguments
|
|
68
|
+
* and could not change them, and `lifecycle.beforeHandle` runs after the
|
|
69
|
+
* schemas have already refused.
|
|
70
|
+
*
|
|
71
|
+
* The audit trail is unaffected: `afterToolCall` still reports `args` as they
|
|
72
|
+
* arrived from the caller, and reports the replacement separately as
|
|
73
|
+
* `effectiveArgs`.
|
|
74
|
+
*
|
|
75
|
+
* Typed `unknown` for the same reason `lifecycle.afterHandle` is — the twin
|
|
76
|
+
* this mirrors. Every hook written against the old `void` signature still
|
|
77
|
+
* assigns, which is the whole compatibility claim, and a narrower union here
|
|
78
|
+
* would break exactly the hooks that exist today. What the value must BE is
|
|
79
|
+
* enforced where it is used, not where it is declared: anything that is not a
|
|
80
|
+
* record, `null` or `undefined` is refused by name at the call.
|
|
81
|
+
*/
|
|
82
|
+
beforeToolCall?: (options: BeforeToolCallOptions) => unknown | Promise<unknown>;
|
|
83
|
+
/**
|
|
84
|
+
* Every finished call, success and failure alike — the record of the call.
|
|
85
|
+
*
|
|
86
|
+
* `error` is the value **as thrown**, present only when the call failed by
|
|
87
|
+
* throwing (never for an argument-validation failure, an output-schema
|
|
88
|
+
* mismatch or a `beforeToolCall` rejection — those never had a raw value).
|
|
89
|
+
* It is the same value `onToolError` receives, handed here too so a single
|
|
90
|
+
* hook can build one row that names the cause: the `result` alone cannot,
|
|
91
|
+
* because an unexpected throw is scrubbed to a bare `INTERNAL_SERVER_ERROR`.
|
|
92
|
+
*/
|
|
93
|
+
afterToolCall?: (options: AfterToolCallOptions) => void | Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* The tool execution path threw — the value **as thrown**, before it is normalised
|
|
96
|
+
* into a `ToolResult`. The tool-side answer to HTTP's `hooks.onError`, and the
|
|
97
|
+
* only place the real cause of an unexpected failure is reachable: an error
|
|
98
|
+
* that is not an `AppError` is scrubbed to a bare `INTERNAL_SERVER_ERROR` with
|
|
99
|
+
* no details, so by the time `afterToolCall` sees the result, the stack, the
|
|
100
|
+
* `cause` chain and the message are gone.
|
|
101
|
+
*
|
|
102
|
+
* Fires for a throw from executable input parsing (`ToolExtend`, params or
|
|
103
|
+
* input), extension resolution, `lifecycle.beforeHandle`, the handler, or
|
|
104
|
+
* `lifecycle.afterHandle` — every span where the raw cause would otherwise be
|
|
105
|
+
* destroyed. It does **not** fire for a normal validation result, a
|
|
106
|
+
* `beforeToolCall` rejection or an output-schema mismatch: each is already
|
|
107
|
+
* described in full by the `ToolResult` that `afterToolCall` receives.
|
|
108
|
+
*
|
|
109
|
+
* This is observation, not an error handler — the tool envelope is always
|
|
110
|
+
* `toolResultFromError`, so the return value is ignored and a throw from the
|
|
111
|
+
* hook itself is reported and swallowed rather than replacing the failure it
|
|
112
|
+
* was called to observe. Awaited before `afterToolCall`, so anything the hook
|
|
113
|
+
* records (a request-context error, say) is already in place when the audit
|
|
114
|
+
* hook reads it.
|
|
115
|
+
*/
|
|
116
|
+
onToolError?: (options: ToolErrorOptions) => void | Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* A per-tool hint appended to a failed tool result — given the tool name and the
|
|
120
|
+
* error code, return extra guidance for the model (or `null` for none). Shared
|
|
121
|
+
* by every tool mount (`mountMcp` / `mountAgent` / `createCli`), so a project
|
|
122
|
+
* writes one recovery-hint policy and it reaches all three transports.
|
|
123
|
+
*/
|
|
124
|
+
export type ErrorHintFn = (toolName: string, errorCode: string) => string | null;
|
|
125
|
+
/**
|
|
126
|
+
* The tool-side twin of the HTTP server's `beforeHandle` / `afterHandle`. A
|
|
127
|
+
* tool call runs the same handler an HTTP request would — `ToolLifecycle` makes
|
|
128
|
+
* it run the same gate. Pass a `createAuthHook` result as `beforeHandle` here
|
|
129
|
+
* and tools are scope-guarded exactly as HTTP routes are; without it a tool
|
|
130
|
+
* call bypasses the auth a `createServer` `beforeHandle` enforces.
|
|
131
|
+
*
|
|
132
|
+
* Structurally a subset of `LifecycleHooks` — the same hook object used for
|
|
133
|
+
* `createServer({ hooks })` is assignable here.
|
|
134
|
+
*
|
|
135
|
+
* There is deliberately no `onError` twin: `LifecycleHooks.onError` returns a
|
|
136
|
+
* `Response`, which the tool path has no use for, and narrowing the return type
|
|
137
|
+
* here would break the assignability above. Observing a thrown tool error is
|
|
138
|
+
* `ToolCallHooks.onToolError`.
|
|
139
|
+
*/
|
|
140
|
+
export interface ToolLifecycle {
|
|
141
|
+
/** Auth / scope gate — throw to reject the call. */
|
|
142
|
+
beforeHandle?: (ctx: RuntimeContext, endpoint: OperationIdentity) => void | Promise<void>;
|
|
143
|
+
/** Transform the handler result before it is returned. */
|
|
144
|
+
afterHandle?: (ctx: RuntimeContext, result: unknown, endpoint: OperationIdentity) => unknown | Promise<unknown>;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=execute-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-hooks.d.ts","sourceRoot":"","sources":["../../src/tools/execute-hooks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,eAAe,CAAC;IACxB,2EAA2E;IAC3E,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChF;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnE;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,aAAa;IAC5B,oDAAoD;IACpD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1F,0DAA0D;IAC1D,WAAW,CAAC,EAAE,CACZ,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,iBAAiB,KACxB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a tool call answers — success with data, or a canonical failure — and
|
|
3
|
+
* the one place a thrown value becomes that failure. The normalized error and
|
|
4
|
+
* the raw cause ride beside a failure in-process, never inside it.
|
|
5
|
+
*/
|
|
6
|
+
import { AppError } from '../contract/errors.js';
|
|
7
|
+
export type ToolResult = {
|
|
8
|
+
ok: true;
|
|
9
|
+
data: unknown;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
code: string;
|
|
13
|
+
details?: unknown;
|
|
14
|
+
hint?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A declared retry class, carried so it survives a process hop.
|
|
17
|
+
*
|
|
18
|
+
* The normalized `AppError` lives in a `WeakMap` keyed by the result
|
|
19
|
+
* object, which a serialized failure crossing MCP or the CLI cannot take
|
|
20
|
+
* with it — `toolErrorFromResult` rebuilds from `{code, details, hint}`
|
|
21
|
+
* and resolves the status from the code. A declaration that contradicts
|
|
22
|
+
* its status class would be lost exactly there, which is the failure
|
|
23
|
+
* already recorded for coding-tool refusals.
|
|
24
|
+
*/
|
|
25
|
+
retryable?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type ToolFailure = Extract<ToolResult, {
|
|
28
|
+
ok: false;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Normalise any thrown value into a failed `ToolResult` — the one place an
|
|
32
|
+
* `AppError` becomes a tool error. Shared by `executeToolMethod` and both
|
|
33
|
+
* transport mounts so every tool error has one shape.
|
|
34
|
+
*/
|
|
35
|
+
export declare function toolResultFromError(err: unknown): ToolFailure;
|
|
36
|
+
/** Recover the normalized AppError behind one canonical failed tool result. */
|
|
37
|
+
export declare function toolErrorFromResult(result: ToolFailure): AppError;
|
|
38
|
+
/** Original in-process failure; never part of the serialized tool envelope. */
|
|
39
|
+
export declare function toolCauseFromResult(result: ToolFailure): unknown;
|
|
40
|
+
//# sourceMappingURL=execute-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-result.d.ts","sourceRoot":"","sources":["../../src/tools/execute-result.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,QAAQ,EAIT,MAAM,oBAAoB,CAAC;AAI5B,MAAM,MAAM,UAAU,GAClB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC3B;IACE,EAAE,EAAE,KAAK,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEN,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAa7D;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,CAkB7D;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,CAgBjE;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAEhE"}
|
package/dist/tools/execute.d.ts
CHANGED
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
import type { ZodType, z } from 'zod';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
2
|
+
import type { TransportSource } from '../contract/define.js';
|
|
3
|
+
import type { RuntimeContext } from '../contract/runtime-context.js';
|
|
4
4
|
import type { EndpointToolView } from '../contract/tool-view.js';
|
|
5
5
|
import type { OperationIdentity } from '../server/types.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
data: unknown;
|
|
9
|
-
} | {
|
|
10
|
-
ok: false;
|
|
11
|
-
code: string;
|
|
12
|
-
details?: unknown;
|
|
13
|
-
hint?: string;
|
|
14
|
-
/**
|
|
15
|
-
* A declared retry class, carried so it survives a process hop.
|
|
16
|
-
*
|
|
17
|
-
* The normalized `AppError` lives in a `WeakMap` keyed by the result
|
|
18
|
-
* object, which a serialized failure crossing MCP or the CLI cannot take
|
|
19
|
-
* with it — `toolErrorFromResult` rebuilds from `{code, details, hint}`
|
|
20
|
-
* and resolves the status from the code. A declaration that contradicts
|
|
21
|
-
* its status class would be lost exactly there, which is the failure
|
|
22
|
-
* already recorded for coding-tool refusals.
|
|
23
|
-
*/
|
|
24
|
-
retryable?: boolean;
|
|
25
|
-
};
|
|
26
|
-
type ToolFailure = Extract<ToolResult, {
|
|
27
|
-
ok: false;
|
|
28
|
-
}>;
|
|
6
|
+
import type { ToolCallContext, ToolCallHooks, ToolLifecycle } from './execute-hooks.js';
|
|
7
|
+
import { type ToolResult } from './execute-result.js';
|
|
29
8
|
export type ToolExecutionControlReason = 'stale_run' | 'run_interrupted';
|
|
30
9
|
/** Internal control flow that must never be converted into a model-facing tool failure. */
|
|
31
10
|
export declare class ToolExecutionControlError extends Error {
|
|
@@ -33,142 +12,6 @@ export declare class ToolExecutionControlError extends Error {
|
|
|
33
12
|
constructor(reason: ToolExecutionControlReason);
|
|
34
13
|
}
|
|
35
14
|
export declare function isToolExecutionControlError(value: unknown): value is ToolExecutionControlError;
|
|
36
|
-
export interface ToolCallContext {
|
|
37
|
-
source: TransportSource;
|
|
38
|
-
/** Validated metadata for an MCP call; absent on every other transport. */
|
|
39
|
-
mcp?: McpCallContext;
|
|
40
|
-
/**
|
|
41
|
-
* The provider's id for this tool call, on a surface that has one — today
|
|
42
|
-
* `mountAgent`, where it is the AI SDK's `toolCallId`.
|
|
43
|
-
*
|
|
44
|
-
* Without it a consumer running its own agent loop could see the outcome of a
|
|
45
|
-
* call through `afterToolCall` and had no way to say WHICH call it belonged
|
|
46
|
-
* to, so it reconstructed the answer from the serialised error text instead.
|
|
47
|
-
* That reconstruction is the defect: it is written once per consumer and
|
|
48
|
-
* disagrees silently.
|
|
49
|
-
*/
|
|
50
|
-
toolCallId?: string;
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
}
|
|
53
|
-
export interface BeforeToolCallOptions {
|
|
54
|
-
toolName: string;
|
|
55
|
-
args: Record<string, unknown>;
|
|
56
|
-
context: ToolCallContext;
|
|
57
|
-
endpoint: OperationIdentity;
|
|
58
|
-
}
|
|
59
|
-
export interface AfterToolCallOptions extends BeforeToolCallOptions {
|
|
60
|
-
result: ToolResult;
|
|
61
|
-
durationMs: number;
|
|
62
|
-
/** The value as thrown; absent for failures that did not throw. */
|
|
63
|
-
error?: unknown;
|
|
64
|
-
/**
|
|
65
|
-
* The arguments the call actually ran on, when `beforeToolCall` replaced
|
|
66
|
-
* them. Absent when nothing rewrote them — so `args` alone stays the honest
|
|
67
|
-
* record of what the caller sent, and a rewrite is visible as a rewrite
|
|
68
|
-
* rather than by overwriting the evidence.
|
|
69
|
-
*/
|
|
70
|
-
effectiveArgs?: Record<string, unknown>;
|
|
71
|
-
}
|
|
72
|
-
export interface ToolErrorOptions {
|
|
73
|
-
toolName: string;
|
|
74
|
-
error: unknown;
|
|
75
|
-
context: ToolCallContext;
|
|
76
|
-
endpoint: OperationIdentity;
|
|
77
|
-
}
|
|
78
|
-
export interface ToolCallHooks {
|
|
79
|
-
/**
|
|
80
|
-
* Before the arguments are validated — and the one place they can still be
|
|
81
|
-
* changed.
|
|
82
|
-
*
|
|
83
|
-
* Returning a record replaces the arguments for this call; returning
|
|
84
|
-
* `undefined`, `null` or nothing leaves them exactly as they arrived. The
|
|
85
|
-
* replacement is validated by the contract schema like any other input, so
|
|
86
|
-
* this is a way to shape a call, never a way around the schema: a hook that
|
|
87
|
-
* returns something the schema refuses produces an ordinary
|
|
88
|
-
* `VALIDATION_ERROR`.
|
|
89
|
-
*
|
|
90
|
-
* This exists because the pipeline was asymmetric. `lifecycle.afterHandle`
|
|
91
|
-
* could already transform the OUTPUT, while the only way to affect the input
|
|
92
|
-
* was to throw — so a caller wanting to expand a reference into a value
|
|
93
|
-
* before validation had nowhere to stand: this hook sees the raw arguments
|
|
94
|
-
* and could not change them, and `lifecycle.beforeHandle` runs after the
|
|
95
|
-
* schemas have already refused.
|
|
96
|
-
*
|
|
97
|
-
* The audit trail is unaffected: `afterToolCall` still reports `args` as they
|
|
98
|
-
* arrived from the caller, and reports the replacement separately as
|
|
99
|
-
* `effectiveArgs`.
|
|
100
|
-
*
|
|
101
|
-
* Typed `unknown` for the same reason `lifecycle.afterHandle` is — the twin
|
|
102
|
-
* this mirrors. Every hook written against the old `void` signature still
|
|
103
|
-
* assigns, which is the whole compatibility claim, and a narrower union here
|
|
104
|
-
* would break exactly the hooks that exist today. What the value must BE is
|
|
105
|
-
* enforced where it is used, not where it is declared: anything that is not a
|
|
106
|
-
* record, `null` or `undefined` is refused by name at the call.
|
|
107
|
-
*/
|
|
108
|
-
beforeToolCall?: (options: BeforeToolCallOptions) => unknown | Promise<unknown>;
|
|
109
|
-
/**
|
|
110
|
-
* Every finished call, success and failure alike — the record of the call.
|
|
111
|
-
*
|
|
112
|
-
* `error` is the value **as thrown**, present only when the call failed by
|
|
113
|
-
* throwing (never for an argument-validation failure, an output-schema
|
|
114
|
-
* mismatch or a `beforeToolCall` rejection — those never had a raw value).
|
|
115
|
-
* It is the same value `onToolError` receives, handed here too so a single
|
|
116
|
-
* hook can build one row that names the cause: the `result` alone cannot,
|
|
117
|
-
* because an unexpected throw is scrubbed to a bare `INTERNAL_SERVER_ERROR`.
|
|
118
|
-
*/
|
|
119
|
-
afterToolCall?: (options: AfterToolCallOptions) => void | Promise<void>;
|
|
120
|
-
/**
|
|
121
|
-
* The tool execution path threw — the value **as thrown**, before it is normalised
|
|
122
|
-
* into a `ToolResult`. The tool-side answer to HTTP's `hooks.onError`, and the
|
|
123
|
-
* only place the real cause of an unexpected failure is reachable: an error
|
|
124
|
-
* that is not an `AppError` is scrubbed to a bare `INTERNAL_SERVER_ERROR` with
|
|
125
|
-
* no details, so by the time `afterToolCall` sees the result, the stack, the
|
|
126
|
-
* `cause` chain and the message are gone.
|
|
127
|
-
*
|
|
128
|
-
* Fires for a throw from executable input parsing (`ToolExtend`, params or
|
|
129
|
-
* input), extension resolution, `lifecycle.beforeHandle`, the handler, or
|
|
130
|
-
* `lifecycle.afterHandle` — every span where the raw cause would otherwise be
|
|
131
|
-
* destroyed. It does **not** fire for a normal validation result, a
|
|
132
|
-
* `beforeToolCall` rejection or an output-schema mismatch: each is already
|
|
133
|
-
* described in full by the `ToolResult` that `afterToolCall` receives.
|
|
134
|
-
*
|
|
135
|
-
* This is observation, not an error handler — the tool envelope is always
|
|
136
|
-
* `toolResultFromError`, so the return value is ignored and a throw from the
|
|
137
|
-
* hook itself is reported and swallowed rather than replacing the failure it
|
|
138
|
-
* was called to observe. Awaited before `afterToolCall`, so anything the hook
|
|
139
|
-
* records (a request-context error, say) is already in place when the audit
|
|
140
|
-
* hook reads it.
|
|
141
|
-
*/
|
|
142
|
-
onToolError?: (options: ToolErrorOptions) => void | Promise<void>;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* A per-tool hint appended to a failed tool result — given the tool name and the
|
|
146
|
-
* error code, return extra guidance for the model (or `null` for none). Shared
|
|
147
|
-
* by every tool mount (`mountMcp` / `mountAgent` / `createCli`), so a project
|
|
148
|
-
* writes one recovery-hint policy and it reaches all three transports.
|
|
149
|
-
*/
|
|
150
|
-
export type ErrorHintFn = (toolName: string, errorCode: string) => string | null;
|
|
151
|
-
/**
|
|
152
|
-
* The tool-side twin of the HTTP server's `beforeHandle` / `afterHandle`. A
|
|
153
|
-
* tool call runs the same handler an HTTP request would — `ToolLifecycle` makes
|
|
154
|
-
* it run the same gate. Pass a `createAuthHook` result as `beforeHandle` here
|
|
155
|
-
* and tools are scope-guarded exactly as HTTP routes are; without it a tool
|
|
156
|
-
* call bypasses the auth a `createServer` `beforeHandle` enforces.
|
|
157
|
-
*
|
|
158
|
-
* Structurally a subset of `LifecycleHooks` — the same hook object used for
|
|
159
|
-
* `createServer({ hooks })` is assignable here.
|
|
160
|
-
*
|
|
161
|
-
* There is deliberately no `onError` twin: `LifecycleHooks.onError` returns a
|
|
162
|
-
* `Response`, which the tool path has no use for, and narrowing the return type
|
|
163
|
-
* here would break the assignability above. Observing a thrown tool error is
|
|
164
|
-
* `ToolCallHooks.onToolError`.
|
|
165
|
-
*/
|
|
166
|
-
export interface ToolLifecycle {
|
|
167
|
-
/** Auth / scope gate — throw to reject the call. */
|
|
168
|
-
beforeHandle?: (ctx: RuntimeContext, endpoint: OperationIdentity) => void | Promise<void>;
|
|
169
|
-
/** Transform the handler result before it is returned. */
|
|
170
|
-
afterHandle?: (ctx: RuntimeContext, result: unknown, endpoint: OperationIdentity) => unknown | Promise<unknown>;
|
|
171
|
-
}
|
|
172
15
|
/** Executable tool operation; contract methods and native tools share this runner shape. */
|
|
173
16
|
export interface ToolOperation extends OperationIdentity {
|
|
174
17
|
paramsSchema?: ZodType;
|
|
@@ -183,37 +26,6 @@ export interface ToolArgumentExtension {
|
|
|
183
26
|
schema: z.ZodObject;
|
|
184
27
|
resolve: (args: Record<string, unknown>) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
185
28
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Normalise any thrown value into a failed `ToolResult` — the one place an
|
|
188
|
-
* `AppError` becomes a tool error. Shared by `executeToolMethod` and both
|
|
189
|
-
* transport mounts so every tool error has one shape.
|
|
190
|
-
*/
|
|
191
|
-
/** What one tool call's arguments parse to — or why they did not. */
|
|
192
|
-
export type ParsedToolCallArguments = {
|
|
193
|
-
ok: true;
|
|
194
|
-
params: unknown;
|
|
195
|
-
input: unknown;
|
|
196
|
-
} | {
|
|
197
|
-
ok: false;
|
|
198
|
-
message: string;
|
|
199
|
-
thrown?: unknown;
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* Split and validate a flat tool-argument object exactly as a call does.
|
|
203
|
-
*
|
|
204
|
-
* Exported so the ONE thing that needs the parsed value without running the
|
|
205
|
-
* call — an elicitation resolver choosing this call's questions — gets the same
|
|
206
|
-
* value the handler will get, rather than a second parse written beside this
|
|
207
|
-
* one that drifts on the next coercion change. It is pure: no lifecycle, no
|
|
208
|
-
* hooks, no audit row, so asking what the arguments mean costs nothing that a
|
|
209
|
-
* gate would charge for.
|
|
210
|
-
*/
|
|
211
|
-
export declare function parseToolCallArguments(method: ToolOperation, callArgs: Record<string, unknown>, { coerceJson, toolSurface, }?: Pick<ToolExecutionOptions, 'coerceJson' | 'toolSurface'>): ParsedToolCallArguments;
|
|
212
|
-
export declare function toolResultFromError(err: unknown): ToolFailure;
|
|
213
|
-
/** Recover the normalized AppError behind one canonical failed tool result. */
|
|
214
|
-
export declare function toolErrorFromResult(result: ToolFailure): AppError;
|
|
215
|
-
/** Original in-process failure; never part of the serialized tool envelope. */
|
|
216
|
-
export declare function toolCauseFromResult(result: ToolFailure): unknown;
|
|
217
29
|
/** What one tool call is: the name it was called by, its raw arguments, its context. */
|
|
218
30
|
export interface ToolCall {
|
|
219
31
|
toolName: string;
|
|
@@ -253,5 +65,4 @@ export declare function inToolCallContext<T>(call: {
|
|
|
253
65
|
toolName: string;
|
|
254
66
|
method: OperationIdentity;
|
|
255
67
|
}, body: () => Promise<T>): Promise<T>;
|
|
256
|
-
export {};
|
|
257
68
|
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,OAAO,KAAK,EAAE,iBAA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BAAoB;IACnC,qCAAqC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,0FAA0F;IAC1F,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,kEAAkE;IAClE,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC,4EAA4E;IAC5E,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,+EAA+E;IAC/E,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,QAAQ,EACd,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,UAAU,CAAC,CAgBrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,IAAI,EAAE;IACJ,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,iBAAiB,CAAC;CAC3B,EACD,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAuBZ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ZodObject, type ZodType } from 'zod';
|
|
2
|
-
import type {
|
|
2
|
+
import type { HttpMethod, ToolTransport } from '../../contract/define.js';
|
|
3
|
+
import type { EndpointMcpPolicy, EndpointToolAnnotations, EndpointUiMeta } from '../../contract/tool-options.js';
|
|
3
4
|
import type { MethodDef, ServiceDef, StitchLogger } from '../../server/types.js';
|
|
4
5
|
import type { ToolPresentationSchema } from '../schema/flatten.js';
|
|
5
6
|
/** Non-executable runtime-tool shape needed to project names and advertised schemas. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-projector.d.ts","sourceRoot":"","sources":["../../../src/tools/internal/surface-projector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAK,MAAM,KAAK,CAAC;AACtD,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"surface-projector.d.ts","sourceRoot":"","sources":["../../../src/tools/internal/surface-projector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAK,MAAM,KAAK,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACf,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAUhE,wFAAwF;AACxF,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,UAAU,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,CAAC;IACF,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACtC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,GAAG,CAAC,EAAE,iBAAiB,CA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AC,KAAK,CAAC,EAAE,CA8GnC"}
|
package/dist/tools/invoker.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ToolTransport, TransportSource } from '../contract/define.js';
|
|
2
2
|
import type { ServiceDef } from '../server/types.js';
|
|
3
|
-
import {
|
|
3
|
+
import type { ToolCallContext, ToolCallHooks, ToolLifecycle } from './execute-hooks.js';
|
|
4
|
+
import { type ToolResult } from './execute-result.js';
|
|
4
5
|
import { type ToolExtend } from './mount.js';
|
|
5
6
|
/** Configuration for a compiled in-process contract-tool dispatcher. */
|
|
6
7
|
export interface ToolInvokerConfig {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoker.d.ts","sourceRoot":"","sources":["../../src/tools/invoker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"invoker.d.ts","sourceRoot":"","sources":["../../src/tools/invoker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAsD,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAG9F,wEAAwE;AACxE,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+EAA+E;IAC/E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,mFAAmF;AACnF,MAAM,WAAW,qBAAqB;IACpC,oFAAoF;IACpF,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IAC1C,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,yDAAyD;IACzD,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC7D;AAED,sFAAsF;AACtF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,aAAa,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,UAAU,GAAG,SAAS,UAAU,EAAE,EAC5C,MAAM,EAAE,iBAAiB,GACxB,WAAW,CA4Db"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolLifecycle } from './execute.js';
|
|
1
|
+
import type { ToolLifecycle } from './execute-hooks.js';
|
|
2
2
|
/** Compose tool lifecycle hooks without inventing HTTP-only phases. */
|
|
3
3
|
export declare function composeToolLifecycle(...hooks: readonly (ToolLifecycle | undefined)[]): ToolLifecycle;
|
|
4
4
|
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/tools/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/tools/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,uEAAuE;AACvE,wBAAgB,oBAAoB,CAClC,GAAG,KAAK,EAAE,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC,EAAE,GAC/C,aAAa,CAcf"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { McpServer, type ServerOptions } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { ServiceDef, StitchLogger } from '../../server/types.js';
|
|
3
|
-
import type { ErrorHintFn, ToolCallHooks, ToolLifecycle } from '../execute.js';
|
|
3
|
+
import type { ErrorHintFn, ToolCallHooks, ToolLifecycle } from '../execute-hooks.js';
|
|
4
4
|
import { type ToolExtend } from '../mount.js';
|
|
5
5
|
import type { RuntimeToolDefinition } from '../runtime-tool.js';
|
|
6
6
|
import { type McpResourceDef } from './app.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/mount.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAET,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/mount.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAET,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AA6D;IAC7D,aAAa,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,MAAM,SAAS,EAAE,MAAM,CAAC,CAAC;IACjE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAC9B,KAAK,EACL,SAAS,SAAS,kBAAkB,GAAG,kBAAkB,IACvD,qBAAqB,CAAC,KAAK,CAAC,GAC9B,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AAE7E;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,oBAAoB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AACnF,wBAAgB,cAAc,CAAC,KAAK,EAClC,MAAM,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACnC,IAAI,EAAE,KAAK,GACV,SAAS,CAAC;AAwCb,iFAAiF;AACjF,wBAAgB,0BAA0B,CAAC,KAAK,EAC9C,MAAM,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACnC,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,wBAAwB,GACjC,SAAS,CAqEX;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CAmBlF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { CallToolResult } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
import type { ServiceDef, StitchLogger } from '../../server/types.js';
|
|
4
|
-
import type { ErrorHintFn
|
|
4
|
+
import type { ErrorHintFn } from '../execute-hooks.js';
|
|
5
|
+
import type { ToolResult } from '../execute-result.js';
|
|
5
6
|
import { type McpProjectionPreparationConfig, type McpSchemaValidationConfig } from '../internal/surface-projector.js';
|
|
6
7
|
import { type MountableTool, type ToolExtend } from '../mount.js';
|
|
7
8
|
import type { RuntimeToolDefinition } from '../runtime-tool.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAE/B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAiC,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAC9F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAsB,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE5E;;;;;;;;GAQG;AACH,gFAAgF;AAChF,YAAY,EACV,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AAEvC,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AC;CAC7B;AAED,4EAA4E;AAC5E,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,kBAAkB,CAAC;IAClC,YAAY,EAAE,SAAS,sBAAsB,EAAE,CAAC;CACjD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,oBAAoB,EAC7B,MAAM,GAAE,2BAAgC,GACvC,wBAAwB,CAoC1B"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* (`mount-wait.ts`, which reports its own poll ticks).
|
|
14
14
|
*/
|
|
15
15
|
import type { ServerContext } from '@modelcontextprotocol/server';
|
|
16
|
-
import type { McpReportProgress } from '../../contract/
|
|
16
|
+
import type { McpReportProgress } from '../../contract/runtime-context.js';
|
|
17
17
|
/**
|
|
18
18
|
* The host's progress token, or `undefined` when it asked for none.
|
|
19
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAqB,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAqB,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAE3F;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAGpF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,aAAa,GAAG,iBAAiB,CA4BnF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type CallToolResult, type McpServer } from '@modelcontextprotocol/server';
|
|
2
|
-
import type { EndpointToolAnnotations, EndpointUiMeta } from '../../contract/
|
|
3
|
-
import {
|
|
2
|
+
import type { EndpointToolAnnotations, EndpointUiMeta } from '../../contract/tool-options.js';
|
|
3
|
+
import type { ToolExecutionOptions } from '../execute.js';
|
|
4
|
+
import { type ToolResult } from '../execute-result.js';
|
|
4
5
|
import type { MountableTool } from '../mount.js';
|
|
5
6
|
import { type McpCatalogStamp } from './catalog.js';
|
|
6
7
|
import type { PreparedMcpTool } from './prepare.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/register.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/tools/mcp/register.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,KAAK,eAAe,EAA0C,MAAM,WAAW,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,SAAS,CAAC;AAGhE,uFAAuF;AACvF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,wEAAwE;IACxE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzD;AAED,6EAA6E;AAC7E,MAAM,MAAM,aAAa,GAAG,CAC1B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,OAAO,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,KACnD,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzB,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,aAAa,CAAC;IACvB,YAAY,EAAE,CACZ,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,eAAe,CAAC,YAAY,CAAC,EACnC,QAAQ,EAAE,MAAM,KACb,cAAc,CAAC;IACpB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,iBAAiB,CAAC,EAAE,eAAe,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,mBAAmB,EACjC,UAAU,EAAE,eAAe,EAC3B,MAAM,EAAE,yBAAyB,GAChC,IAAI,CAoGN"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-round pieces of an MCP input round: the transport context a round
|
|
3
|
+
* runs under, the operation identity a continuation is bound to, and the two
|
|
4
|
+
* shapes a round pass takes through the tool pipeline — a guard pass that
|
|
5
|
+
* returns nothing, and a refusal that reports through the pipeline's own
|
|
6
|
+
* failure path.
|
|
7
|
+
*/
|
|
8
|
+
import { type CallToolResult, type ServerContext } from '@modelcontextprotocol/server';
|
|
9
|
+
import type { McpCallContext, McpReportProgress, McpRoundOutcome } from '../../contract/runtime-context.js';
|
|
10
|
+
import type { ToolResult } from '../execute-result.js';
|
|
11
|
+
import type { MountableTool } from '../mount.js';
|
|
12
|
+
import type { McpRoundResolution } from './round.js';
|
|
13
|
+
export interface RoundOperationIdentity {
|
|
14
|
+
toolName: string;
|
|
15
|
+
serviceName: string;
|
|
16
|
+
action: string;
|
|
17
|
+
method: string;
|
|
18
|
+
scope?: string;
|
|
19
|
+
}
|
|
20
|
+
export type ToolRunner = (tool: MountableTool, rawArgs: Record<string, unknown>, context?: Record<string, unknown>) => Promise<ToolResult>;
|
|
21
|
+
export declare function transportContext(context: ServerContext, toolName: string, outcome?: McpRoundOutcome, round?: number): {
|
|
22
|
+
signal: AbortSignal;
|
|
23
|
+
mcp: McpCallContext;
|
|
24
|
+
reportProgress: McpReportProgress;
|
|
25
|
+
};
|
|
26
|
+
export declare function operationIdentity(tool: MountableTool): RoundOperationIdentity;
|
|
27
|
+
export declare function sameIdentity(left: RoundOperationIdentity, right: RoundOperationIdentity): boolean;
|
|
28
|
+
export declare function runRoundSuccess(tool: MountableTool, rawArgs: Record<string, unknown>, runTool: ToolRunner, context: Record<string, unknown>): Promise<ToolResult>;
|
|
29
|
+
export declare function failedResolution(options: {
|
|
30
|
+
tool: MountableTool;
|
|
31
|
+
rawArgs: Record<string, unknown>;
|
|
32
|
+
runTool: ToolRunner;
|
|
33
|
+
context: Record<string, unknown>;
|
|
34
|
+
code: string;
|
|
35
|
+
message: string;
|
|
36
|
+
formatFailure: (result: ToolResult) => CallToolResult;
|
|
37
|
+
}): Promise<McpRoundResolution>;
|
|
38
|
+
//# sourceMappingURL=round-context.d.ts.map
|