stitchkit 0.94.0 → 0.95.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 +104 -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/provider-origin.d.ts +7 -0
- package/dist/agent-runtime/provider-origin.d.ts.map +1 -1
- package/dist/agent-runtime/run-operation-lifecycle.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/process-lifecycle-transitions.d.ts +175 -0
- package/dist/application/process-lifecycle-transitions.d.ts.map +1 -0
- package/dist/application/process-lifecycle.d.ts +3 -131
- package/dist/application/process-lifecycle.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.d.ts +2 -1
- package/dist/entrypoints/application.d.ts.map +1 -1
- package/dist/entrypoints/application.js +506 -380
- 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-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-97ac4gph.js → index-8zja4pkf.js} +26 -4
- 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 +271 -7
- package/llms/application.txt +66 -289
- 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/stitchkit.txt +3 -3
- package/llms/tools.2.txt +88 -279
- package/llms/tools.3.txt +288 -0
- package/llms/tools.txt +27 -65
- package/llms/{upgrading-0.37.0-0.50.0.txt → upgrading-0.37.0-0.53.0.txt} +25 -3
- package/llms/{upgrading-0.53.0-0.67.0.txt → upgrading-0.55.0-0.68.0.txt} +53 -25
- package/llms/{upgrading-0.68.0-0.94.0.txt → upgrading-0.69.0-0.95.0.txt} +45 -53
- package/llms/upgrading.txt +3 -3
- package/llms-full.txt +216 -43
- package/llms.txt +8 -8
- package/package.json +1 -1
- package/dist/index-e2z3ahw9.js +0 -325
- package/dist/index-mkm15s49.js +0 -394
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { TransportSource } from './define.js';
|
|
2
|
+
/**
|
|
3
|
+
* Shallow-merge a contract-wide `meta` default with an endpoint's own — endpoint
|
|
4
|
+
* keys win. Returns `undefined` when neither side declares anything, because
|
|
5
|
+
* readers test `method.meta?.x` and an empty object would read as "declared".
|
|
6
|
+
* One level deep by design: a deep merge invites "how do I unset an inherited
|
|
7
|
+
* key", which has no answer without a sentinel. → ADR 0036.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mergeMeta(contractMeta: Record<string, unknown> | undefined, endpointMeta: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
10
|
+
/** Self-reported MCP host identity. Attribution only — never an auth principal. */
|
|
11
|
+
export interface McpClientInfo {
|
|
12
|
+
name: string;
|
|
13
|
+
version: string;
|
|
14
|
+
}
|
|
15
|
+
/** Outcome of one opt-in MCP multi-round input attempt. */
|
|
16
|
+
export type McpRoundOutcome = 'input_required' | 'declined' | 'cancelled' | 'invalid' | 'complete';
|
|
17
|
+
/**
|
|
18
|
+
* Validated metadata for the active managed MCP tool call.
|
|
19
|
+
*
|
|
20
|
+
* `clientInfo` is supplied by the MCP host. It is useful for display and
|
|
21
|
+
* operational attribution, but MUST NOT be used for authentication,
|
|
22
|
+
* authorization, tenant selection or rate limiting.
|
|
23
|
+
*/
|
|
24
|
+
export interface McpCallContext {
|
|
25
|
+
era: 'modern' | 'legacy';
|
|
26
|
+
method: string;
|
|
27
|
+
toolName: string;
|
|
28
|
+
protocolVersion?: string;
|
|
29
|
+
clientInfo?: McpClientInfo;
|
|
30
|
+
outcome?: McpRoundOutcome;
|
|
31
|
+
round?: number;
|
|
32
|
+
/**
|
|
33
|
+
* The host's progress token for this call, when it asked for progress.
|
|
34
|
+
*
|
|
35
|
+
* Declarative, like everything else on this type: it says the host is
|
|
36
|
+
* listening. Reporting is `ctx.reportProgress`, which is a function and
|
|
37
|
+
* therefore deliberately NOT here — this type is also the type of
|
|
38
|
+
* `RequestEvent.mcp`, and an audit row's shape must not claim to carry
|
|
39
|
+
* behaviour.
|
|
40
|
+
*/
|
|
41
|
+
progressToken?: string | number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* One progress update a tool handler sends to the host mid-call.
|
|
45
|
+
*
|
|
46
|
+
* `progress` is a number the protocol requires. It is optional here because a
|
|
47
|
+
* handler often has a stage to name and no scale to name it on — "uploading",
|
|
48
|
+
* "rendering frame 12" — and the honest answer to "how far along" is then the
|
|
49
|
+
* ordinal of the update itself, which is what gets sent. That is a fact about
|
|
50
|
+
* what happened, not a percentage nobody measured; `total` stays absent, so a
|
|
51
|
+
* host renders it as an unbounded counter rather than a bar at 3%.
|
|
52
|
+
*/
|
|
53
|
+
export interface McpProgressUpdate {
|
|
54
|
+
/** Human-facing stage, shown by the host while the call is still running. */
|
|
55
|
+
message?: string;
|
|
56
|
+
/** How far along, on whatever scale `total` implies. */
|
|
57
|
+
progress?: number;
|
|
58
|
+
/** The scale, when the operation knows it. */
|
|
59
|
+
total?: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Send one progress update for the call in flight.
|
|
63
|
+
*
|
|
64
|
+
* Present on every tool call and a no-op unless the host asked for progress by
|
|
65
|
+
* sending a token, so a handler never branches on transport. It never throws
|
|
66
|
+
* and never rejects: a message about work must not be able to kill the work it
|
|
67
|
+
* describes. Fire-and-forget — the returned promise settles when the
|
|
68
|
+
* notification has been handed to the transport, and ignoring it is correct.
|
|
69
|
+
*/
|
|
70
|
+
export type McpReportProgress = (update: McpProgressUpdate) => Promise<void>;
|
|
71
|
+
export interface RuntimeContext {
|
|
72
|
+
params: unknown;
|
|
73
|
+
input: unknown;
|
|
74
|
+
files?: Record<string, unknown>;
|
|
75
|
+
/** Original decoded JSON request text when the endpoint declares `rawBody: true`. */
|
|
76
|
+
rawBody?: string;
|
|
77
|
+
source: TransportSource;
|
|
78
|
+
/**
|
|
79
|
+
* The raw Web `Request`, its parsed `URL` and `Headers` — set on the HTTP
|
|
80
|
+
* transport (and reachable in every lifecycle hook, including `onError` on a
|
|
81
|
+
* validation failure). Absent on the non-HTTP transports (MCP / agent / CLI /
|
|
82
|
+
* a bring-your-own lane), which carry no `Request`, so they are optional and a
|
|
83
|
+
* reader narrows them. Web Fetch types only — the core stays Fetch-clean
|
|
84
|
+
* (→ ADR 0013).
|
|
85
|
+
*/
|
|
86
|
+
req?: Request;
|
|
87
|
+
url?: URL;
|
|
88
|
+
headers?: Headers;
|
|
89
|
+
traceId?: string;
|
|
90
|
+
spanId?: string;
|
|
91
|
+
ipAddress?: string;
|
|
92
|
+
userAgent?: string;
|
|
93
|
+
/** Transport cancellation for the active call (MCP and future cancellable lanes). */
|
|
94
|
+
signal?: AbortSignal;
|
|
95
|
+
/** Validated metadata for an MCP call; absent on every other transport. */
|
|
96
|
+
mcp?: McpCallContext;
|
|
97
|
+
/**
|
|
98
|
+
* Report progress on the call in flight.
|
|
99
|
+
*
|
|
100
|
+
* Present on every TOOL call — MCP, agent and CLI — and a no-op wherever
|
|
101
|
+
* nobody is listening, so a handler never branches on transport to say what
|
|
102
|
+
* it is doing. Absent on the HTTP transport, which has no channel for it;
|
|
103
|
+
* that is why the field is optional and a handler that also serves HTTP
|
|
104
|
+
* writes `ctx.reportProgress?.(…)`.
|
|
105
|
+
*/
|
|
106
|
+
reportProgress?: McpReportProgress;
|
|
107
|
+
[key: string]: unknown;
|
|
108
|
+
}
|
|
109
|
+
export interface HandlerContext<TParams = undefined, TInput = undefined> {
|
|
110
|
+
params: TParams;
|
|
111
|
+
input: TInput;
|
|
112
|
+
files?: Record<string, unknown>;
|
|
113
|
+
/** Original decoded JSON request text when the endpoint declares `rawBody: true`. */
|
|
114
|
+
rawBody?: string;
|
|
115
|
+
source: TransportSource;
|
|
116
|
+
/** Raw Web `Request` / `URL` / `Headers` — set on the HTTP transport, absent
|
|
117
|
+
* on the tool transports (see {@link RuntimeContext}). */
|
|
118
|
+
req?: Request;
|
|
119
|
+
url?: URL;
|
|
120
|
+
headers?: Headers;
|
|
121
|
+
traceId?: string;
|
|
122
|
+
spanId?: string;
|
|
123
|
+
ipAddress?: string;
|
|
124
|
+
userAgent?: string;
|
|
125
|
+
/** Validated metadata for an MCP call; absent on every other transport. */
|
|
126
|
+
mcp?: McpCallContext;
|
|
127
|
+
/** Report progress on the call in flight — a no-op when none was asked for. */
|
|
128
|
+
reportProgress?: McpReportProgress;
|
|
129
|
+
[key: string]: unknown;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=runtime-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-context.d.ts","sourceRoot":"","sources":["../../src/contract/runtime-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD;;;;;;GA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,CAAC;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an endpoint may declare for its tool surfaces: the UI resource, the annotations, and the MCP input rounds with their resolver.
|
|
3
|
+
*/
|
|
4
|
+
import type { z } from 'zod';
|
|
5
|
+
import type { DeclaredToolView } from './tool-view.js';
|
|
6
|
+
/**
|
|
7
|
+
* MCP Apps UI metadata for a tool (SEP-1865). When set, the tool's MCP
|
|
8
|
+
* registration carries `_meta.ui`, so a host renders the named `ui://` resource
|
|
9
|
+
* as an interactive widget for this tool's results. The resource itself is
|
|
10
|
+
* served separately (see `McpServerBuildConfig.resources`).
|
|
11
|
+
*/
|
|
12
|
+
export interface EndpointUiMeta {
|
|
13
|
+
/** `ui://…` resource the host renders for this tool's results. */
|
|
14
|
+
resourceUri: string;
|
|
15
|
+
/** Who sees the tool — `'model'` (in the tool list) and/or `'app'` (widget-only). */
|
|
16
|
+
visibility?: readonly ('model' | 'app')[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* MCP `ToolAnnotations` — behavioural hints a host reads to group tools and pick
|
|
20
|
+
* permission defaults (read-only auto-allow, destructive needs approval) and to
|
|
21
|
+
* show a human label. Hints only — never a security boundary.
|
|
22
|
+
*/
|
|
23
|
+
export interface EndpointToolAnnotations {
|
|
24
|
+
/** Human-friendly display name (e.g. "Explore Models" instead of `list_models`). */
|
|
25
|
+
title?: string;
|
|
26
|
+
/** Tool does not mutate state — hosts may auto-allow and group as read-only. */
|
|
27
|
+
readOnlyHint?: boolean;
|
|
28
|
+
/** Tool may perform destructive updates (ignored when `readOnlyHint` is true). */
|
|
29
|
+
destructiveHint?: boolean;
|
|
30
|
+
/** Repeated calls with the same args have no additional effect. */
|
|
31
|
+
idempotentHint?: boolean;
|
|
32
|
+
/** Tool interacts with an open/external world (not a closed set). */
|
|
33
|
+
openWorldHint?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** One typed form elicitation required before an MCP tool handler may execute. */
|
|
36
|
+
export interface EndpointMcpInputRequired<TKey extends string = string, TSchema extends z.ZodObject = z.ZodObject> {
|
|
37
|
+
/** Stable response key carried across MRTR rounds. */
|
|
38
|
+
key: TKey;
|
|
39
|
+
/** Human-facing prompt shown by the MCP host. */
|
|
40
|
+
message: string;
|
|
41
|
+
/** Flat primitive object schema accepted from the host. */
|
|
42
|
+
schema: TSchema;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What the tool call looks like when the questions are chosen — the same
|
|
46
|
+
* `params` / `input` the handler would receive, parsed by the contract's own
|
|
47
|
+
* schemas.
|
|
48
|
+
*/
|
|
49
|
+
export interface McpInputRequiredCall {
|
|
50
|
+
params: unknown;
|
|
51
|
+
input: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Choose this call's elicitation rounds from its arguments.
|
|
55
|
+
*
|
|
56
|
+
* The static list is declared before any call exists, which is enough when the
|
|
57
|
+
* questions are a property of the operation. It is not enough when they are a
|
|
58
|
+
* property of the ARGUMENTS — one model takes `aspect_ratio`, another takes
|
|
59
|
+
* `duration`, a third needs an input image — and there the declared list can
|
|
60
|
+
* only be empty, so the tool description ends up teaching the model to work
|
|
61
|
+
* around a mechanism the protocol already has.
|
|
62
|
+
*
|
|
63
|
+
* Returning an empty list is a legitimate answer: this call needs nothing, run
|
|
64
|
+
* it. Everything else about the mechanism is unchanged — the state is still
|
|
65
|
+
* signed, still bound to the principal, the operation and the argument digest,
|
|
66
|
+
* and still counted against `maxRounds`.
|
|
67
|
+
*
|
|
68
|
+
* The resolved list is fingerprinted into the signed state and re-checked on
|
|
69
|
+
* every round, so a resolver that answers differently mid-conversation is
|
|
70
|
+
* refused rather than silently asking round 2's question under round 1's key.
|
|
71
|
+
*/
|
|
72
|
+
export type McpInputRequiredResolver<TRequests extends readonly EndpointMcpInputRequired[] = readonly EndpointMcpInputRequired[]> = (call: McpInputRequiredCall) => TRequests | Promise<TRequests>;
|
|
73
|
+
/** MCP-only execution policy attached to a contract or runtime tool. */
|
|
74
|
+
export interface EndpointMcpPolicy<TRequests extends readonly EndpointMcpInputRequired[] = readonly EndpointMcpInputRequired[]> {
|
|
75
|
+
/**
|
|
76
|
+
* Ordered elicitation rounds — a fixed list, or a function of the parsed
|
|
77
|
+
* arguments. Every key must be unique, in either form.
|
|
78
|
+
*/
|
|
79
|
+
inputRequired: TRequests | McpInputRequiredResolver<TRequests>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Everything a tool surface — MCP, AGENT, CLI — reads from an endpoint that
|
|
83
|
+
* HTTP does not: the name a model calls, the view it is answered with, the MCP
|
|
84
|
+
* widget, host hints and elicitation rounds. One group, so an endpoint that can
|
|
85
|
+
* never be a tool refuses all of it with one key, and a new tool option is
|
|
86
|
+
* added in one place. `expose` is not in it: it chooses transports, HTTP
|
|
87
|
+
* included. → ADR 0196.
|
|
88
|
+
*/
|
|
89
|
+
export interface EndpointToolOptions {
|
|
90
|
+
/** The tool name on MCP / AGENT / CLI; unique per transport within a contract. */
|
|
91
|
+
name?: string;
|
|
92
|
+
/**
|
|
93
|
+
* The answer on the tool surface when it is not the HTTP answer: input
|
|
94
|
+
* defaults, a narrower output, a projection. Declared only by `withToolView`,
|
|
95
|
+
* which types `project` against the endpoint's schemas.
|
|
96
|
+
*/
|
|
97
|
+
view?: DeclaredToolView;
|
|
98
|
+
/** MCP Apps widget for this tool's results (MCP transport only). */
|
|
99
|
+
ui?: EndpointUiMeta;
|
|
100
|
+
/** MCP behavioural hints (read-only / destructive / title) for hosts. */
|
|
101
|
+
annotations?: EndpointToolAnnotations;
|
|
102
|
+
/** Opt-in multi-round input gate; ignored by HTTP, Agent and CLI. */
|
|
103
|
+
mcp?: EndpointMcpPolicy;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=tool-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-options.d.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AC,CAAC;AAEnE,wEAAwE;AACxE,MAAM,WAAW,iBAAiB,CAChC,SAAS,SAAS,SAAS,wBAAwB,EAAE,GAAG,SAAS,wBAAwB,EAAE;IAE3F;;;OAGG;IACH,aAAa,EAAE,SAAS,GAAG,wBAAwB,CAAC,SAAS,CAAC,CAAC;CAChE;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,oEAAoE;IACpE,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,yEAAyE;IACzE,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,qEAAqE;IACrE,GAAG,CAAC,EAAE,iBAAiB,CAAC;CACzB"}
|
|
@@ -77,6 +77,16 @@ export interface SlicedToolView<E, V extends ZodType> {
|
|
|
77
77
|
output: V;
|
|
78
78
|
project?: undefined;
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* A tool view that changes only what a tool call is given: the answer is the
|
|
82
|
+
* endpoint's full `output`, exactly as HTTP answers. The most common view — a
|
|
83
|
+
* model needs a lighter call, not a different answer.
|
|
84
|
+
*/
|
|
85
|
+
export interface DefaultsOnlyToolView<E> {
|
|
86
|
+
defaults: EndpointInputDefaults<E>;
|
|
87
|
+
output?: undefined;
|
|
88
|
+
project?: undefined;
|
|
89
|
+
}
|
|
80
90
|
/** The type error a slice produces when the full result does not fit its schema. */
|
|
81
91
|
export interface ToolViewSliceMismatch {
|
|
82
92
|
'toolView.output must accept the full output — add a project, or narrow the schema': never;
|
|
@@ -118,9 +128,12 @@ export type WithToolView<E> = Omit<E, 'tool'> & {
|
|
|
118
128
|
* ```
|
|
119
129
|
*
|
|
120
130
|
* A view without `project` slices the full result by `output`; the full
|
|
121
|
-
* result must then fit that schema, which the return type checks.
|
|
122
|
-
*
|
|
131
|
+
* result must then fit that schema, which the return type checks. A view of
|
|
132
|
+
* `defaults` alone changes only the tool call's input — the answer is the full
|
|
133
|
+
* `output`, as on HTTP. The view lands in `tool.view`, beside the endpoint's
|
|
134
|
+
* other tool options.
|
|
123
135
|
*/
|
|
136
|
+
export declare function withToolView<const E extends ToolViewEndpoint>(endpoint: E & ToolTransportEndpoint<E>, view: DefaultsOnlyToolView<E>): WithToolView<E>;
|
|
124
137
|
export declare function withToolView<const E extends ToolViewEndpoint, V extends ZodType>(endpoint: E & ToolTransportEndpoint<E>, view: ProjectedToolView<E, V>): WithToolView<E>;
|
|
125
138
|
export declare function withToolView<const E extends ToolViewEndpoint>(endpoint: E & ToolTransportEndpoint<E>, view: ReshapedToolView<E>): WithToolView<E>;
|
|
126
139
|
export declare function withToolView<const E extends ToolViewEndpoint, V extends ZodType>(endpoint: E & ToolTransportEndpoint<E>, view: SlicedToolView<E, V>): [EndpointFullOutput<E>] extends [z.input<V>] ? WithToolView<E> : ToolViewSliceMismatch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-view.d.ts","sourceRoot":"","sources":["../../src/contract/tool-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE9E,mFAAmF;AACnF,MAAM,WAAW,YAAY,CAAC,MAAM,GAAG,OAAO;IAC5C,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,MAAM,EAAE,eAAe,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7C;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B;;;OAGG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S,OAAO,EAC9E,QAAQ,EAAE,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,EACtC,IAAI,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC5B,YAAY,CAAC,CAAC,CAAC,CAAC;AACnB,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,gBAAgB,EAC3D,QAAQ,EAAE,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,EACtC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,GACxB,YAAY,CAAC,CAAC,CAAC,CAAC;AACnB,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,OAAO,EAC9E,QAAQ,EAAE,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,EACtC,IAAI,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GACzB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC;AAa1F;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CA0DjF"}
|
|
@@ -22,6 +22,8 @@ export declare const DURABILITY_STEP_EVENT_KIND = "durability/step";
|
|
|
22
22
|
export declare const DURABILITY_PARK_EVENT_KIND = "durability/park";
|
|
23
23
|
/** Event kind recording an external event delivered to a parked wait. */
|
|
24
24
|
export declare const DURABILITY_EVENT_EVENT_KIND = "durability/event";
|
|
25
|
+
/** Event kind recording one phase of an at-most-once effect: intent, accepted or uncertain. */
|
|
26
|
+
export declare const DURABILITY_EFFECT_EVENT_KIND = "durability/effect";
|
|
25
27
|
export declare const StepEventPayloadSchema: z.ZodObject<{
|
|
26
28
|
runId: z.ZodString;
|
|
27
29
|
stepName: z.ZodString;
|
|
@@ -44,6 +46,25 @@ export declare const DeliveredEventPayloadSchema: z.ZodObject<{
|
|
|
44
46
|
id: z.ZodString;
|
|
45
47
|
encoded: z.ZodString;
|
|
46
48
|
}, z.core.$strip>;
|
|
49
|
+
export declare const EffectEventPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
50
|
+
runId: z.ZodString;
|
|
51
|
+
effectName: z.ZodString;
|
|
52
|
+
phase: z.ZodLiteral<"intent">;
|
|
53
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
+
runId: z.ZodString;
|
|
55
|
+
effectName: z.ZodString;
|
|
56
|
+
phase: z.ZodLiteral<"accepted">;
|
|
57
|
+
encoded: z.ZodString;
|
|
58
|
+
via: z.ZodEnum<{
|
|
59
|
+
reconcile: "reconcile";
|
|
60
|
+
run: "run";
|
|
61
|
+
}>;
|
|
62
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
runId: z.ZodString;
|
|
64
|
+
effectName: z.ZodString;
|
|
65
|
+
phase: z.ZodLiteral<"uncertain">;
|
|
66
|
+
}, z.core.$strip>], "phase">;
|
|
67
|
+
export type EffectEventPayload = z.infer<typeof EffectEventPayloadSchema>;
|
|
47
68
|
export type ParkEventPayload = z.infer<typeof ParkEventPayloadSchema>;
|
|
48
69
|
export type StepEventPayload = z.infer<typeof StepEventPayloadSchema>;
|
|
49
70
|
/**
|
|
@@ -83,6 +104,37 @@ export interface StepRunOptions {
|
|
|
83
104
|
/** Aborting refuses to *start* a body and releases a park; it never removes a record already written. */
|
|
84
105
|
signal?: AbortSignal;
|
|
85
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* What an effect ended as. `uncertain` is a third answer, not a failure to
|
|
109
|
+
* produce one: the effect may have happened, the recipient has no record of it,
|
|
110
|
+
* and nothing here will try it again.
|
|
111
|
+
*/
|
|
112
|
+
export type EffectOutcome<P> = {
|
|
113
|
+
readonly outcome: 'accepted';
|
|
114
|
+
readonly proof: P;
|
|
115
|
+
} | {
|
|
116
|
+
readonly outcome: 'uncertain';
|
|
117
|
+
};
|
|
118
|
+
/** The two halves of an effect in another system. */
|
|
119
|
+
export interface EffectHandlers<P> {
|
|
120
|
+
/**
|
|
121
|
+
* Perform the effect, once, and return what the recipient named it — a
|
|
122
|
+
* message id, a turn id. Called at most once per name, across every process
|
|
123
|
+
* that shares the ledger.
|
|
124
|
+
*/
|
|
125
|
+
run(): P | Promise<P>;
|
|
126
|
+
/**
|
|
127
|
+
* Find the effect at the recipient by the caller's own identity for it, and
|
|
128
|
+
* return the same proof — or `null` when the recipient has no record. Called
|
|
129
|
+
* only when an intent was recorded and no outcome was: the process that ran
|
|
130
|
+
* the effect stopped before it could say how it ended.
|
|
131
|
+
*/
|
|
132
|
+
reconcile(signal: AbortSignal): P | null | Promise<P | null>;
|
|
133
|
+
}
|
|
134
|
+
export interface EffectRunOptions extends StepRunOptions {
|
|
135
|
+
/** How long `reconcile` may take, in milliseconds; its `signal` aborts at the deadline. Default 30 000. */
|
|
136
|
+
reconcileTimeoutMs?: number;
|
|
137
|
+
}
|
|
86
138
|
export interface LocalStepDurability {
|
|
87
139
|
/**
|
|
88
140
|
* Run `name` once and durably record its JSON result.
|
|
@@ -131,6 +183,22 @@ export interface LocalStepDurability {
|
|
|
131
183
|
id: string;
|
|
132
184
|
payload?: unknown;
|
|
133
185
|
}): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Perform an effect in another system at most once.
|
|
188
|
+
*
|
|
189
|
+
* `step` records its result AFTER the body, so a body cut short by a crash
|
|
190
|
+
* runs again — right for a computation, wrong for sending a message, where a
|
|
191
|
+
* repeat is worse than a loss. Here the intent is recorded BEFORE `run`, and
|
|
192
|
+
* its outcome after. A later call that finds the intent without an outcome
|
|
193
|
+
* calls `reconcile`, never `run`: found is `accepted` with the proof, not
|
|
194
|
+
* found is `uncertain`, and both are recorded, so neither is asked again.
|
|
195
|
+
*
|
|
196
|
+
* A `run` that throws leaves the intent standing — whether the effect
|
|
197
|
+
* happened is exactly what is not known — and the call rejects with
|
|
198
|
+
* `EffectUnresolvedError`; the next call reconciles. The proof is JSON of at
|
|
199
|
+
* most 64 KiB: an identity, not a payload.
|
|
200
|
+
*/
|
|
201
|
+
effect<P extends z.infer<ReturnType<typeof z.json>>>(name: string, handlers: EffectHandlers<P>, options?: EffectRunOptions): Promise<EffectOutcome<P>>;
|
|
134
202
|
}
|
|
135
203
|
/**
|
|
136
204
|
* The record for `name` cannot be trusted.
|
|
@@ -152,6 +220,21 @@ export declare class StepResultNotSerializableError extends Error {
|
|
|
152
220
|
export declare class StepAbortedError extends Error {
|
|
153
221
|
constructor(stepName: string);
|
|
154
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* An effect whose outcome could not be settled by this call.
|
|
225
|
+
*
|
|
226
|
+
* Its intent is recorded and stays recorded, so `run` is never called for this
|
|
227
|
+
* name again; the next call reconciles instead. `reason` says which step did
|
|
228
|
+
* not finish: `run` threw, `reconcile` threw or overran its deadline, or the
|
|
229
|
+
* proof could not be recorded.
|
|
230
|
+
*/
|
|
231
|
+
export declare class EffectUnresolvedError extends Error {
|
|
232
|
+
readonly effectName: string;
|
|
233
|
+
readonly reason: 'run-failed' | 'reconcile-failed' | 'reconcile-timeout' | 'proof-rejected';
|
|
234
|
+
constructor(effectName: string, reason: 'run-failed' | 'reconcile-failed' | 'reconcile-timeout' | 'proof-rejected', options?: {
|
|
235
|
+
cause?: unknown;
|
|
236
|
+
});
|
|
237
|
+
}
|
|
155
238
|
/**
|
|
156
239
|
* A park or delivered-event record cannot be trusted.
|
|
157
240
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/durability/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,UAAU,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AAE,gBAAgB,GACzB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAGzD;CACF;AAED,uEAAuE;AACvE,qBAAa,8BAA+B,SAAQ,KAAK;IACvD,YAAY,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAK3C;CACF;AAED,kFAAkF;AAClF,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,QAAQ,EAAE,MAAM,EAG3B;CACF;AAED;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAE5C,QAAQ,CAAC,UAAU,EAAE,MAAM;IAC3B,QAAQ,CAAC,MAAM,EACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,gBAAgB;IANtB,YACW,UAAU,EAAE,MAAM,EAClB,MAAM,EACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,gBAAgB,EACpB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAI9B;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAGzD;CACF;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,IAAI,EAAE,MAAM,EAGvB;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An effect in another system, performed at most once.
|
|
3
|
+
*
|
|
4
|
+
* The rule a consumer had written by hand seven times, and one copy of which
|
|
5
|
+
* had drifted: record the intent BEFORE the effect; record what the recipient
|
|
6
|
+
* named it after; an intent found without an outcome is settled only by the
|
|
7
|
+
* recipient's own record — found is `accepted`, not found is `uncertain` — and
|
|
8
|
+
* `uncertain` is never retried. The copy that drifted wrote nothing before a
|
|
9
|
+
* permission reply, so a lost acknowledgement sent the reply twice.
|
|
10
|
+
*/
|
|
11
|
+
import type { z } from 'zod';
|
|
12
|
+
import { type EffectHandlers, type EffectOutcome, type EffectRunOptions, type StepDurabilityLedger } from './contract.js';
|
|
13
|
+
import { type DurabilityLedgerView } from './ledger.js';
|
|
14
|
+
export interface EffectLedgerContext {
|
|
15
|
+
readonly store: StepDurabilityLedger;
|
|
16
|
+
readonly conversationId: string;
|
|
17
|
+
readonly runId: string;
|
|
18
|
+
readonly signal: AbortSignal | undefined;
|
|
19
|
+
readLedger(): Promise<DurabilityLedgerView>;
|
|
20
|
+
}
|
|
21
|
+
type Proof = z.infer<ReturnType<typeof z.json>>;
|
|
22
|
+
export declare function executeEffect<P extends Proof>(context: EffectLedgerContext, name: string, handlers: EffectHandlers<P>, options: EffectRunOptions | undefined): Promise<EffectOutcome<P>>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../../src/durability/effect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAGrB,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,oBAAoB,EAA+B,MAAM,UAAU,CAAC;AAMlF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC7C;AAED,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAkFhD,wBAAsB,aAAa,CAAC,CAAC,SAAS,KAAK,EACjD,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CA0B3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type LocalStepDurability, type LocalStepDurabilityOptions } from './contract.js';
|
|
2
|
-
export type { LocalStepDurability, LocalStepDurabilityOptions, StepDurabilityLedger, StepRunOptions, } from './contract.js';
|
|
3
|
-
export { DURABILITY_STEP_EVENT_KIND, ParkAbortedError, ParkRecordDecodeError, StepAbortedError, StepResultDecodeError, StepResultNotSerializableError, } from './contract.js';
|
|
2
|
+
export type { EffectHandlers, EffectOutcome, EffectRunOptions, LocalStepDurability, LocalStepDurabilityOptions, StepDurabilityLedger, StepRunOptions, } from './contract.js';
|
|
3
|
+
export { DURABILITY_STEP_EVENT_KIND, EffectUnresolvedError, ParkAbortedError, ParkRecordDecodeError, StepAbortedError, StepResultDecodeError, StepResultNotSerializableError, } from './contract.js';
|
|
4
4
|
/**
|
|
5
5
|
* A local step-durability port over an `AgentRuntimeStore`.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/durability/engine.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/durability/engine.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAGhC,MAAM,YAAY,CAAC;AAepB,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AAmBpB;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CAsLrB"}
|
|
@@ -14,6 +14,7 @@ export declare const AgentStoreEventKindSchema: z.ZodEnum<{
|
|
|
14
14
|
"approval/response-rejected": "approval/response-rejected";
|
|
15
15
|
"child/spawned": "child/spawned";
|
|
16
16
|
"child/state": "child/state";
|
|
17
|
+
"durability/effect": "durability/effect";
|
|
17
18
|
"durability/event": "durability/event";
|
|
18
19
|
"durability/park": "durability/park";
|
|
19
20
|
"durability/step": "durability/step";
|
|
@@ -52,6 +53,7 @@ export declare const AppendAgentStoreEventSchema: z.ZodObject<{
|
|
|
52
53
|
"approval/response-rejected": "approval/response-rejected";
|
|
53
54
|
"child/spawned": "child/spawned";
|
|
54
55
|
"child/state": "child/state";
|
|
56
|
+
"durability/effect": "durability/effect";
|
|
55
57
|
"durability/event": "durability/event";
|
|
56
58
|
"durability/park": "durability/park";
|
|
57
59
|
"durability/step": "durability/step";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/durability/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/durability/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EAwBpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,6BAA6B;;;;;;;;;kBAW/B,CAAC;AAEZ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAQ7B,CAAC;AAEZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,0BAA0B;;;;;kBAYpC,CAAC;AAEJ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;kBAK3B,CAAC;AAEZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { type ParkEventPayload, type StepDurabilityLedger } from './contract.js';
|
|
2
2
|
export declare function stepKey(conversationId: string, runId: string, stepName: string): string;
|
|
3
|
+
export declare function effectKey(conversationId: string, runId: string, effectName: string): string;
|
|
3
4
|
export declare function sleepParkKey(conversationId: string, runId: string, name: string): string;
|
|
4
5
|
export declare function waitParkKey(conversationId: string, runId: string, event: string, id: string): string;
|
|
5
6
|
export declare function parkEventKey(conversationId: string, payload: ParkEventPayload): string;
|
|
6
7
|
export declare function encodeStepResult(stepName: string, value: unknown): string;
|
|
7
8
|
export declare function encodeDeliveredPayload(event: string, id: string, payload: unknown): string;
|
|
9
|
+
/** What the ledger says about one effect: an intent, and at most one outcome. */
|
|
10
|
+
export type EffectRecord = {
|
|
11
|
+
readonly outcome: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
readonly outcome: 'accepted';
|
|
14
|
+
readonly proof: unknown;
|
|
15
|
+
} | {
|
|
16
|
+
readonly outcome: 'uncertain';
|
|
17
|
+
};
|
|
8
18
|
export interface DurabilityLedgerView {
|
|
9
19
|
readonly steps: Map<string, unknown>;
|
|
20
|
+
readonly effects: Map<string, EffectRecord>;
|
|
10
21
|
readonly parks: Map<string, ParkEventPayload>;
|
|
11
22
|
readonly deliveries: Map<string, unknown>;
|
|
12
23
|
nextSeq: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../src/durability/ledger.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../src/durability/ledger.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,gBAAgB,EAGrB,KAAK,oBAAoB,EAK1B,MAAM,YAAY,CAAC;AAGpB,wBAAgB,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvF;AAED,wBAAgB,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3F;AAED,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAExF;AAED,wBAAgB,WAAW,CACzB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,GACT,MAAM,CAER;AAED,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAItF;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAWzE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAa1F;AAmED,iFAAiF;AACjF,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC;AA4BtC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC9C,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,kFAAkF;AAClF,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,oBAAoB,EAC3B,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CA4C/B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two parks — a durable sleep and a wait for a delivered event — as
|
|
3
|
+
* functions over one engine's context. A park is recorded before it waits, so a
|
|
4
|
+
* reconstruction resumes from the record instead of parking again.
|
|
5
|
+
*/
|
|
6
|
+
import { type DurabilityClock, type StepDurabilityLedger, type StepRunOptions } from './contract.js';
|
|
7
|
+
import { type DurabilityLedgerView } from './ledger.js';
|
|
8
|
+
import { type InFlightDurability } from './scheduler.js';
|
|
9
|
+
/** What a park needs from the engine that owns it. */
|
|
10
|
+
export interface ParkContext {
|
|
11
|
+
readonly store: StepDurabilityLedger;
|
|
12
|
+
readonly conversationId: string;
|
|
13
|
+
readonly runId: string;
|
|
14
|
+
readonly signal: AbortSignal | undefined;
|
|
15
|
+
readonly subscribe: ((wake: () => void) => () => void) | undefined;
|
|
16
|
+
readonly clock: DurabilityClock;
|
|
17
|
+
readonly waiters: InFlightDurability['waiters'];
|
|
18
|
+
readLedger(): Promise<DurabilityLedgerView>;
|
|
19
|
+
}
|
|
20
|
+
export declare function executeSleep(park: ParkContext, name: string, seconds: number, runOptions: StepRunOptions | undefined): Promise<void>;
|
|
21
|
+
export declare function executeWait<T>(park: ParkContext, eventName: string, id: string, runOptions: StepRunOptions | undefined): Promise<T>;
|
|
22
|
+
//# sourceMappingURL=parks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parks.d.ts","sourceRoot":"","sources":["../../src/durability/parks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAEL,KAAK,eAAe,EAGpB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,oBAAoB,EAA6B,MAAM,UAAU,CAAC;AAChF,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,aAAa,CAAC;AAErB,sDAAsD;AACtD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACnE,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAChD,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC7C;AAED,wBAAsB,YAAY,CAChC,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,cAAc,GAAG,SAAS,GACrC,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED,wBAAsB,WAAW,CAAC,CAAC,EACjC,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,cAAc,GAAG,SAAS,GACrC,OAAO,CAAC,CAAC,CAAC,CAmCZ"}
|
|
@@ -12,6 +12,7 @@ export declare const systemClock: DurabilityClock;
|
|
|
12
12
|
*/
|
|
13
13
|
export interface InFlightDurability {
|
|
14
14
|
steps: Map<string, Promise<unknown>>;
|
|
15
|
+
effects: Map<string, Promise<unknown>>;
|
|
15
16
|
parks: Map<string, Promise<unknown>>;
|
|
16
17
|
waiters: Map<string, Set<() => void>>;
|
|
17
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../src/durability/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAoB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC/F,eAAO,MAAM,WAAW,EAAE,eAOzB,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,OAAO,EAAE,GAAG,CAAC,MAAM,E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ACvC;AACD,eAAO,MAAM,MAAM,mDAA0D,CAAC;AAE9E,wBAAgB,aAAa,CAAC,WAAW,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAI3F;AA2BD,wBAAsB,eAAe,CACnC,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,UAAU,UAAU;IAClB,sFAAsF;IACtF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC9C,wDAAwD;IACxD,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAC1C,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,WAAW,GACnB,UAAU,CA2BZ"}
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
AgentCodingToolLimitsSchema,
|
|
4
4
|
AgentCodingToolPathAuthorizationSchema,
|
|
5
5
|
createAgentCodingTools
|
|
6
|
-
} from "../../index-
|
|
7
|
-
import"../../index-
|
|
6
|
+
} from "../../index-het2he5g.js";
|
|
7
|
+
import"../../index-px2gm2jp.js";
|
|
8
8
|
import"../../index-qmy6zq75.js";
|
|
9
|
-
import"../../index-
|
|
10
|
-
import"../../index-
|
|
9
|
+
import"../../index-xw3s75nj.js";
|
|
10
|
+
import"../../index-np4m8hd3.js";
|
|
11
11
|
import"../../index-eqqvgdb3.js";
|
|
12
12
|
import"../../index-znfs20ss.js";
|
|
13
13
|
import"../../index-p5r7qpdd.js";
|