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
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveRouteParamsSchema
|
|
3
|
+
} from "./index-4gcnakhx.js";
|
|
1
4
|
import {
|
|
2
5
|
isUnsafeKey
|
|
3
6
|
} from "./index-kzfs85xp.js";
|
|
@@ -38,15 +41,14 @@ function assertToolView(prefix, key, ep) {
|
|
|
38
41
|
if (project !== undefined && typeof project !== "function") {
|
|
39
42
|
throw new Error(`${where}.project must be a function`);
|
|
40
43
|
}
|
|
41
|
-
if (output === undefined && project === undefined) {
|
|
42
|
-
throw new Error(`${where} declares neither output nor project — it would change nothing`);
|
|
43
|
-
}
|
|
44
44
|
const defaults = view.defaults;
|
|
45
|
-
if (defaults
|
|
46
|
-
return;
|
|
47
|
-
if (!isRecord(defaults))
|
|
45
|
+
if (defaults !== undefined && !isRecord(defaults)) {
|
|
48
46
|
throw new Error(`${where}.defaults must be an object`);
|
|
49
|
-
|
|
47
|
+
}
|
|
48
|
+
const entries = defaults === undefined ? [] : Object.entries(defaults);
|
|
49
|
+
if (output === undefined && project === undefined && entries.length === 0) {
|
|
50
|
+
throw new Error(`${where} declares no defaults, output or project — it would change nothing`);
|
|
51
|
+
}
|
|
50
52
|
if (entries.length === 0)
|
|
51
53
|
return;
|
|
52
54
|
if (!(ep.input instanceof z.ZodObject)) {
|
|
@@ -68,143 +70,7 @@ function assertToolView(prefix, key, ep) {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
// src/
|
|
72
|
-
import { z as z2 } from "zod";
|
|
73
|
-
var PARAM_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
74
|
-
function joinRoutePath(...parts) {
|
|
75
|
-
const joined = parts.filter((part) => Boolean(part)).map((part) => part.replace(/^\/+|\/+$/g, "")).filter(Boolean).join("/");
|
|
76
|
-
return `/${joined}`;
|
|
77
|
-
}
|
|
78
|
-
function parseRoutePattern(path) {
|
|
79
|
-
const segments = path.split("/").filter(Boolean);
|
|
80
|
-
const parameters = [];
|
|
81
|
-
const names = new Set;
|
|
82
|
-
for (const [segmentIndex, segment] of segments.entries()) {
|
|
83
|
-
const marker = segment.at(0);
|
|
84
|
-
if (marker !== ":" && marker !== "*") {
|
|
85
|
-
if (segment.includes("*")) {
|
|
86
|
-
throw new Error(`Wildcard must occupy its own segment in path "${path}"`);
|
|
87
|
-
}
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
const name = segment.slice(1);
|
|
91
|
-
if (marker === "*" && name === "") {
|
|
92
|
-
throw new Error(`Trailing wildcard in path "${path}" must be named, for example "/*filePath"`);
|
|
93
|
-
}
|
|
94
|
-
if (!PARAM_IDENTIFIER.test(name) || isUnsafeKey(name)) {
|
|
95
|
-
const label = marker === "*" ? "wildcard" : "route parameter";
|
|
96
|
-
throw new Error(`Invalid ${label} name "${name}" in path "${path}"`);
|
|
97
|
-
}
|
|
98
|
-
if (names.has(name)) {
|
|
99
|
-
throw new Error(`Duplicate route parameter name "${name}" in path "${path}"`);
|
|
100
|
-
}
|
|
101
|
-
if (marker === "*" && segmentIndex !== segments.length - 1) {
|
|
102
|
-
throw new Error(`Wildcard "*${name}" must be the final segment in path "${path}"`);
|
|
103
|
-
}
|
|
104
|
-
names.add(name);
|
|
105
|
-
parameters.push({
|
|
106
|
-
name,
|
|
107
|
-
kind: marker === "*" ? "wildcard" : "segment",
|
|
108
|
-
segmentIndex
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
return parameters;
|
|
112
|
-
}
|
|
113
|
-
function resolveRouteParamsSchema(path, schema) {
|
|
114
|
-
const parameters = parseRoutePattern(path);
|
|
115
|
-
if (parameters.length === 0)
|
|
116
|
-
return schema;
|
|
117
|
-
if (!schema) {
|
|
118
|
-
const shape = {};
|
|
119
|
-
for (const parameter of parameters)
|
|
120
|
-
shape[parameter.name] = z2.string();
|
|
121
|
-
return z2.object(shape);
|
|
122
|
-
}
|
|
123
|
-
const jsonSchema = z2.toJSONSchema(schema, { io: "input", unrepresentable: "any" });
|
|
124
|
-
const properties = jsonSchema.properties;
|
|
125
|
-
if (!properties) {
|
|
126
|
-
throw new Error(`Route params schema for path "${path}" must be an object schema with a property per path field`);
|
|
127
|
-
}
|
|
128
|
-
for (const parameter of parameters) {
|
|
129
|
-
if (!(parameter.name in properties)) {
|
|
130
|
-
const kind = parameter.kind === "wildcard" ? "wildcard" : "path";
|
|
131
|
-
throw new Error(`Route params schema for path "${path}" is missing ${kind} field "${parameter.name}"`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
const names = new Set(parameters.map((parameter) => parameter.name));
|
|
135
|
-
const required = Array.isArray(jsonSchema.required) ? jsonSchema.required : [];
|
|
136
|
-
for (const field of required) {
|
|
137
|
-
if (typeof field === "string" && !names.has(field)) {
|
|
138
|
-
throw new Error(`Route params schema for path "${path}" requires field "${field}" that the path does not carry`);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return schema;
|
|
142
|
-
}
|
|
143
|
-
function parseTrailingWildcard(path) {
|
|
144
|
-
const wildcard = parseRoutePattern(path).find((parameter) => parameter.kind === "wildcard");
|
|
145
|
-
return wildcard ? { name: wildcard.name, segmentIndex: wildcard.segmentIndex } : null;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// src/contract/define.ts
|
|
149
|
-
var ALL_TRANSPORTS = ["HTTP", "MCP", "AGENT", "CLI"];
|
|
150
|
-
var TOOL_TRANSPORTS = ["MCP", "AGENT", "CLI"];
|
|
151
|
-
function defineContract(meta, endpoints) {
|
|
152
|
-
const materializedEndpoints = {};
|
|
153
|
-
for (const [key, endpoint] of Object.entries(endpoints)) {
|
|
154
|
-
const params = resolveRouteParamsSchema(endpoint.path, endpoint.params);
|
|
155
|
-
materializedEndpoints[key] = params === endpoint.params ? endpoint : { ...endpoint, params };
|
|
156
|
-
}
|
|
157
|
-
const toolTransports = new Map;
|
|
158
|
-
for (const [key, ep] of Object.entries(materializedEndpoints)) {
|
|
159
|
-
if (ep.desc.trim() === "") {
|
|
160
|
-
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" has an empty desc`);
|
|
161
|
-
}
|
|
162
|
-
if (ep.maxJsonBodyBytes !== undefined && (!Number.isSafeInteger(ep.maxJsonBodyBytes) || ep.maxJsonBodyBytes <= 0)) {
|
|
163
|
-
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" maxJsonBodyBytes must be a positive safe integer, received ${ep.maxJsonBodyBytes}`);
|
|
164
|
-
}
|
|
165
|
-
if (ep.multipart)
|
|
166
|
-
assertMultipartEndpoint(meta.prefix, key, ep);
|
|
167
|
-
if (ep.rawResponse)
|
|
168
|
-
assertRawEndpoint(meta.prefix, key, ep);
|
|
169
|
-
if ("stream" in ep)
|
|
170
|
-
assertStreamingResponseEndpoint(meta.prefix, key, ep);
|
|
171
|
-
if (ep.method === "HEAD")
|
|
172
|
-
assertHeadEndpoint(meta.prefix, key, ep);
|
|
173
|
-
if (ep.rawBody)
|
|
174
|
-
assertRawBodyEndpoint(meta.prefix, key, ep);
|
|
175
|
-
if (ep.safelistedBody)
|
|
176
|
-
assertSafelistedBodyEndpoint(meta.prefix, key, ep);
|
|
177
|
-
if ("responseMeta" in ep)
|
|
178
|
-
assertResponseMetaEndpoint(meta.prefix, key, ep);
|
|
179
|
-
assertNoUngroupedToolOptions(meta.prefix, key, ep);
|
|
180
|
-
const tool = "tool" in ep ? ep.tool : undefined;
|
|
181
|
-
if (tool === undefined)
|
|
182
|
-
continue;
|
|
183
|
-
if (typeof tool !== "object" || tool === null) {
|
|
184
|
-
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" tool must be an object`);
|
|
185
|
-
}
|
|
186
|
-
const transports = new Set(ep.expose ? ep.expose.filter((t) => t !== "HTTP") : ["MCP", "AGENT"]);
|
|
187
|
-
if (transports.size === 0) {
|
|
188
|
-
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" sets tool options but is not exposed on any tool transport (${TOOL_TRANSPORTS.join(" / ")}) — a contract factory with toolExposure 'explicit' makes an omitted expose HTTP-only`);
|
|
189
|
-
}
|
|
190
|
-
if (tool.view !== undefined)
|
|
191
|
-
assertToolView(meta.prefix, key, ep);
|
|
192
|
-
if (!tool.name)
|
|
193
|
-
continue;
|
|
194
|
-
const existing = toolTransports.get(tool.name);
|
|
195
|
-
if (existing) {
|
|
196
|
-
for (const t of transports) {
|
|
197
|
-
if (existing.transports.has(t)) {
|
|
198
|
-
throw new Error(`Contract "${meta.prefix}": duplicate tool name "${tool.name}" on transport "${t}" (endpoints: "${existing.key}" and "${key}")`);
|
|
199
|
-
}
|
|
200
|
-
existing.transports.add(t);
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
toolTransports.set(tool.name, { key, transports });
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return { meta, endpoints: materializedEndpoints };
|
|
207
|
-
}
|
|
73
|
+
// src/contract/define-validation.ts
|
|
208
74
|
function assertPositiveLimit(where, name, value) {
|
|
209
75
|
if (value !== undefined && (!Number.isSafeInteger(value) || value <= 0)) {
|
|
210
76
|
throw new Error(`${where} ${name} must be a positive safe integer, received ${value}`);
|
|
@@ -386,12 +252,66 @@ function assertResponseMetaEndpoint(prefix, key, ep) {
|
|
|
386
252
|
throw new Error(`${where} is HTTP-only — remove ${nonHttp.join(", ")} from expose`);
|
|
387
253
|
}
|
|
388
254
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
255
|
+
|
|
256
|
+
// src/contract/define.ts
|
|
257
|
+
var ALL_TRANSPORTS = ["HTTP", "MCP", "AGENT", "CLI"];
|
|
258
|
+
var TOOL_TRANSPORTS = ["MCP", "AGENT", "CLI"];
|
|
259
|
+
function defineContract(meta, endpoints) {
|
|
260
|
+
const materializedEndpoints = {};
|
|
261
|
+
for (const [key, endpoint] of Object.entries(endpoints)) {
|
|
262
|
+
const params = resolveRouteParamsSchema(endpoint.path, endpoint.params);
|
|
263
|
+
materializedEndpoints[key] = params === endpoint.params ? endpoint : { ...endpoint, params };
|
|
264
|
+
}
|
|
265
|
+
const toolTransports = new Map;
|
|
266
|
+
for (const [key, ep] of Object.entries(materializedEndpoints)) {
|
|
267
|
+
if (ep.desc.trim() === "") {
|
|
268
|
+
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" has an empty desc`);
|
|
269
|
+
}
|
|
270
|
+
if (ep.maxJsonBodyBytes !== undefined && (!Number.isSafeInteger(ep.maxJsonBodyBytes) || ep.maxJsonBodyBytes <= 0)) {
|
|
271
|
+
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" maxJsonBodyBytes must be a positive safe integer, received ${ep.maxJsonBodyBytes}`);
|
|
272
|
+
}
|
|
273
|
+
if (ep.multipart)
|
|
274
|
+
assertMultipartEndpoint(meta.prefix, key, ep);
|
|
275
|
+
if (ep.rawResponse)
|
|
276
|
+
assertRawEndpoint(meta.prefix, key, ep);
|
|
277
|
+
if ("stream" in ep)
|
|
278
|
+
assertStreamingResponseEndpoint(meta.prefix, key, ep);
|
|
279
|
+
if (ep.method === "HEAD")
|
|
280
|
+
assertHeadEndpoint(meta.prefix, key, ep);
|
|
281
|
+
if (ep.rawBody)
|
|
282
|
+
assertRawBodyEndpoint(meta.prefix, key, ep);
|
|
283
|
+
if (ep.safelistedBody)
|
|
284
|
+
assertSafelistedBodyEndpoint(meta.prefix, key, ep);
|
|
285
|
+
if ("responseMeta" in ep)
|
|
286
|
+
assertResponseMetaEndpoint(meta.prefix, key, ep);
|
|
287
|
+
assertNoUngroupedToolOptions(meta.prefix, key, ep);
|
|
288
|
+
const tool = "tool" in ep ? ep.tool : undefined;
|
|
289
|
+
if (tool === undefined)
|
|
290
|
+
continue;
|
|
291
|
+
if (typeof tool !== "object" || tool === null) {
|
|
292
|
+
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" tool must be an object`);
|
|
293
|
+
}
|
|
294
|
+
const transports = new Set(ep.expose ? ep.expose.filter((t) => t !== "HTTP") : ["MCP", "AGENT"]);
|
|
295
|
+
if (transports.size === 0) {
|
|
296
|
+
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" sets tool options but is not exposed on any tool transport (${TOOL_TRANSPORTS.join(" / ")}) — a contract factory with toolExposure 'explicit' makes an omitted expose HTTP-only`);
|
|
297
|
+
}
|
|
298
|
+
if (tool.view !== undefined)
|
|
299
|
+
assertToolView(meta.prefix, key, ep);
|
|
300
|
+
if (!tool.name)
|
|
301
|
+
continue;
|
|
302
|
+
const existing = toolTransports.get(tool.name);
|
|
303
|
+
if (existing) {
|
|
304
|
+
for (const t of transports) {
|
|
305
|
+
if (existing.transports.has(t)) {
|
|
306
|
+
throw new Error(`Contract "${meta.prefix}": duplicate tool name "${tool.name}" on transport "${t}" (endpoints: "${existing.key}" and "${key}")`);
|
|
307
|
+
}
|
|
308
|
+
existing.transports.add(t);
|
|
309
|
+
}
|
|
310
|
+
} else {
|
|
311
|
+
toolTransports.set(tool.name, { key, transports });
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return { meta, endpoints: materializedEndpoints };
|
|
395
315
|
}
|
|
396
316
|
|
|
397
|
-
export {
|
|
317
|
+
export { withToolView, ALL_TRANSPORTS, TOOL_TRANSPORTS, defineContract };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeToolMethod,
|
|
3
3
|
toolErrorFromResult
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-55hkhm67.js";
|
|
5
5
|
import {
|
|
6
6
|
assertToolExtensionCompatible,
|
|
7
7
|
mergeSchemas,
|
|
8
8
|
projectToolSurface,
|
|
9
9
|
rebuildObject
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-np4m8hd3.js";
|
|
11
11
|
import {
|
|
12
12
|
isRetryableStatus
|
|
13
13
|
} from "./index-2vtcmrj9.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RealtimeRequestInvalidAcknowledgementError,
|
|
3
3
|
RealtimeRequestRejectedError
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-dce5wxcq.js";
|
|
5
5
|
import {
|
|
6
6
|
zodIssues
|
|
7
7
|
} from "./index-p5r7qpdd.js";
|
|
@@ -55,15 +55,6 @@ function parseIssues(value) {
|
|
|
55
55
|
return issues.length > 0 ? issues : undefined;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
// src/internal/optional-peer.ts
|
|
59
|
-
function isModuleNotFound(error) {
|
|
60
|
-
if (typeof error !== "object" || error === null)
|
|
61
|
-
return false;
|
|
62
|
-
const code = "code" in error ? error.code : undefined;
|
|
63
|
-
const message = "message" in error && typeof error.message === "string" ? error.message : "";
|
|
64
|
-
return code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND" || message.includes("Cannot find module") || message.includes("Cannot find package");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
58
|
// src/realtime/rejection.ts
|
|
68
59
|
import { z } from "zod";
|
|
69
60
|
function realtimeContractViolation(options) {
|
|
@@ -321,4 +312,13 @@ function createValidatedRealtimeSocket({
|
|
|
321
312
|
};
|
|
322
313
|
}
|
|
323
314
|
|
|
324
|
-
|
|
315
|
+
// src/internal/optional-peer.ts
|
|
316
|
+
function isModuleNotFound(error) {
|
|
317
|
+
if (typeof error !== "object" || error === null)
|
|
318
|
+
return false;
|
|
319
|
+
const code = "code" in error ? error.code : undefined;
|
|
320
|
+
const message = "message" in error && typeof error.message === "string" ? error.message : "";
|
|
321
|
+
return code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND" || message.includes("Cannot find module") || message.includes("Cannot find package");
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export { REALTIME_REJECTION_KEY, asRealtimeRejection, parseRealtimeRequestArguments, parseRealtimeRequestAcknowledgement, createValidatedRealtimeSocket, isModuleNotFound };
|
|
@@ -649,42 +649,6 @@ function mergeSchemas(paramsSchema, inputSchema) {
|
|
|
649
649
|
return paramsObject ? z.intersection(paramsObject, inputSchema) : inputSchema;
|
|
650
650
|
}
|
|
651
651
|
|
|
652
|
-
// src/tools/mcp/round-policy.ts
|
|
653
|
-
function staticInputRounds(policy) {
|
|
654
|
-
return Array.isArray(policy.inputRequired) ? policy.inputRequired : undefined;
|
|
655
|
-
}
|
|
656
|
-
function validateMcpRoundPolicy(tool, policy, runtime) {
|
|
657
|
-
if (!runtime?.stateConfigured) {
|
|
658
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares inputRequired but no multiRound.state key is configured`);
|
|
659
|
-
}
|
|
660
|
-
const { maxRounds } = runtime;
|
|
661
|
-
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
662
|
-
throw new Error("[stitchkit] multiRound.serving.maxRounds must be a positive integer");
|
|
663
|
-
}
|
|
664
|
-
const declared = staticInputRounds(policy);
|
|
665
|
-
if (!declared)
|
|
666
|
-
return;
|
|
667
|
-
if (declared.length === 0) {
|
|
668
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" must declare at least one input round`);
|
|
669
|
-
}
|
|
670
|
-
assertRoundShape(tool, declared, maxRounds);
|
|
671
|
-
}
|
|
672
|
-
function validateResolvedInputRounds(tool, resolved, maxRounds) {
|
|
673
|
-
assertRoundShape(tool, resolved, maxRounds);
|
|
674
|
-
}
|
|
675
|
-
function assertRoundShape(tool, rounds, maxRounds) {
|
|
676
|
-
if (rounds.length > maxRounds) {
|
|
677
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares ${rounds.length} input rounds, exceeding maxRounds ${maxRounds}`);
|
|
678
|
-
}
|
|
679
|
-
const keys = new Set;
|
|
680
|
-
for (const request of rounds) {
|
|
681
|
-
if (keys.has(request.key)) {
|
|
682
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares duplicate input key "${request.key}"`);
|
|
683
|
-
}
|
|
684
|
-
keys.add(request.key);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
|
|
688
652
|
// src/tools/names.ts
|
|
689
653
|
var SINGULAR_EXCEPTIONS = new Set([
|
|
690
654
|
"analytics",
|
|
@@ -976,6 +940,44 @@ function presentationMetadata(schema) {
|
|
|
976
940
|
|
|
977
941
|
// src/tools/internal/surface-projector.ts
|
|
978
942
|
import { z as z3 } from "zod";
|
|
943
|
+
|
|
944
|
+
// src/tools/mcp/round-policy.ts
|
|
945
|
+
function staticInputRounds(policy) {
|
|
946
|
+
return Array.isArray(policy.inputRequired) ? policy.inputRequired : undefined;
|
|
947
|
+
}
|
|
948
|
+
function validateMcpRoundPolicy(tool, policy, runtime) {
|
|
949
|
+
if (!runtime?.stateConfigured) {
|
|
950
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares inputRequired but no multiRound.state key is configured`);
|
|
951
|
+
}
|
|
952
|
+
const { maxRounds } = runtime;
|
|
953
|
+
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
954
|
+
throw new Error("[stitchkit] multiRound.serving.maxRounds must be a positive integer");
|
|
955
|
+
}
|
|
956
|
+
const declared = staticInputRounds(policy);
|
|
957
|
+
if (!declared)
|
|
958
|
+
return;
|
|
959
|
+
if (declared.length === 0) {
|
|
960
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" must declare at least one input round`);
|
|
961
|
+
}
|
|
962
|
+
assertRoundShape(tool, declared, maxRounds);
|
|
963
|
+
}
|
|
964
|
+
function validateResolvedInputRounds(tool, resolved, maxRounds) {
|
|
965
|
+
assertRoundShape(tool, resolved, maxRounds);
|
|
966
|
+
}
|
|
967
|
+
function assertRoundShape(tool, rounds, maxRounds) {
|
|
968
|
+
if (rounds.length > maxRounds) {
|
|
969
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares ${rounds.length} input rounds, exceeding maxRounds ${maxRounds}`);
|
|
970
|
+
}
|
|
971
|
+
const keys = new Set;
|
|
972
|
+
for (const request of rounds) {
|
|
973
|
+
if (keys.has(request.key)) {
|
|
974
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares duplicate input key "${request.key}"`);
|
|
975
|
+
}
|
|
976
|
+
keys.add(request.key);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// src/tools/internal/surface-projector.ts
|
|
979
981
|
function assertToolExtensionCompatible(base, extra) {
|
|
980
982
|
if (!(base instanceof z3.ZodObject))
|
|
981
983
|
return;
|