stitchkit 0.132.2 → 0.133.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 +181 -1
- package/dist/agent-executor/acp/v1-connect.d.ts +12 -1
- package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-driver.d.ts +3 -1
- package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-handlers.d.ts +9 -1
- package/dist/agent-executor/acp/v1-handlers.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-permission.d.ts +3 -2
- package/dist/agent-executor/acp/v1-permission.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-probe.d.ts +10 -1
- package/dist/agent-executor/acp/v1-probe.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-session.d.ts +11 -2
- package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-turn.d.ts +13 -10
- package/dist/agent-executor/acp/v1-turn.d.ts.map +1 -1
- package/dist/agent-executor/claude/cli-driver.d.ts +6 -0
- package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
- package/dist/agent-executor/claude/record-router.d.ts +44 -0
- package/dist/agent-executor/claude/record-router.d.ts.map +1 -0
- package/dist/agent-executor/claude/session.d.ts +2 -0
- package/dist/agent-executor/claude/session.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/controls.d.ts +1 -0
- package/dist/agent-executor/claude-sdk/controls.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/driver.d.ts +20 -2
- package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/engine-spawn.d.ts +18 -0
- package/dist/agent-executor/claude-sdk/engine-spawn.d.ts.map +1 -0
- package/dist/agent-executor/claude-sdk/query-loop.d.ts +9 -7
- package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/query-manager.d.ts +42 -0
- package/dist/agent-executor/claude-sdk/query-manager.d.ts.map +1 -0
- package/dist/agent-executor/claude-sdk/query-options.d.ts +4 -1
- package/dist/agent-executor/claude-sdk/query-options.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
- package/dist/agent-executor/codex/capabilities.d.ts +8 -0
- package/dist/agent-executor/codex/capabilities.d.ts.map +1 -0
- package/dist/agent-executor/codex/connect.d.ts +6 -1
- package/dist/agent-executor/codex/connect.d.ts.map +1 -1
- package/dist/agent-executor/codex/driver.d.ts +10 -0
- package/dist/agent-executor/codex/driver.d.ts.map +1 -1
- package/dist/agent-executor/codex/event-routing.d.ts +23 -1
- package/dist/agent-executor/codex/event-routing.d.ts.map +1 -1
- package/dist/agent-executor/codex/handlers.d.ts +24 -4
- package/dist/agent-executor/codex/handlers.d.ts.map +1 -1
- package/dist/agent-executor/codex/limits.d.ts +17 -0
- package/dist/agent-executor/codex/limits.d.ts.map +1 -1
- package/dist/agent-executor/codex/request-answers.d.ts +23 -3
- package/dist/agent-executor/codex/request-answers.d.ts.map +1 -1
- package/dist/agent-executor/codex/session-bind.d.ts +6 -1
- package/dist/agent-executor/codex/session-bind.d.ts.map +1 -1
- package/dist/agent-executor/codex/session-types.d.ts +5 -1
- package/dist/agent-executor/codex/session-types.d.ts.map +1 -1
- package/dist/agent-executor/codex/session.d.ts.map +1 -1
- package/dist/agent-executor/codex/shared-server.d.ts.map +1 -1
- package/dist/agent-executor/codex/shared-thread.d.ts +7 -7
- package/dist/agent-executor/codex/shared-thread.d.ts.map +1 -1
- package/dist/agent-executor/codex/thread-open.d.ts +12 -3
- package/dist/agent-executor/codex/thread-open.d.ts.map +1 -1
- package/dist/agent-executor/engine-requests.d.ts +42 -0
- package/dist/agent-executor/engine-requests.d.ts.map +1 -1
- package/dist/agent-executor/handoff-schemas.d.ts.map +1 -1
- package/dist/agent-executor/handoff.d.ts.map +1 -1
- package/dist/agent-executor/image-input.d.ts +6 -5
- package/dist/agent-executor/image-input.d.ts.map +1 -1
- package/dist/agent-executor/profile.d.ts +3 -5
- package/dist/agent-executor/profile.d.ts.map +1 -1
- package/dist/agent-executor/session-primitives.d.ts +64 -3
- package/dist/agent-executor/session-primitives.d.ts.map +1 -1
- package/dist/agent-executor/testing/claude-sdk-stubs.d.ts +5 -0
- package/dist/agent-executor/testing/claude-sdk-stubs.d.ts.map +1 -0
- package/dist/agent-executor/testing/conformance-lifecycle.d.ts +11 -0
- package/dist/agent-executor/testing/conformance-lifecycle.d.ts.map +1 -0
- package/dist/agent-executor/testing/conformance-support.d.ts +23 -0
- package/dist/agent-executor/testing/conformance-support.d.ts.map +1 -0
- package/dist/agent-executor/testing/conformance.d.ts +7 -2
- package/dist/agent-executor/testing/conformance.d.ts.map +1 -1
- package/dist/agent-executor/testing/consumer-stubs.d.ts +5 -3
- package/dist/agent-executor/testing/consumer-stubs.d.ts.map +1 -1
- package/dist/agent-executor/testing/fake-codex-app-server.d.ts +5 -1
- package/dist/agent-executor/testing/fake-codex-app-server.d.ts.map +1 -1
- package/dist/agent-executor/testing/replay-driver.d.ts +6 -0
- package/dist/agent-executor/testing/replay-driver.d.ts.map +1 -1
- package/dist/agent-executor/testing/replay-gate.d.ts +4 -1
- package/dist/agent-executor/testing/replay-gate.d.ts.map +1 -1
- package/dist/agent-runtime/deferred-tool-types.d.ts +2 -0
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
- package/dist/agent-runtime/deferred-tools.d.ts.map +1 -1
- package/dist/agent-runtime/sql-rows.d.ts +10 -10
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
- package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
- package/dist/agent-runtime/terminal-commit.d.ts +10 -10
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/operation-refusal.d.ts +10 -0
- package/dist/browser/operation-refusal.d.ts.map +1 -0
- package/dist/contract/client-types.d.ts +13 -4
- package/dist/contract/client-types.d.ts.map +1 -1
- package/dist/contract/define-validation.d.ts +6 -0
- package/dist/contract/define-validation.d.ts.map +1 -1
- package/dist/contract/define.d.ts +3 -0
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/errors-factory.d.ts +8 -2
- package/dist/contract/errors-factory.d.ts.map +1 -1
- package/dist/contract/errors.d.ts +9 -0
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/fingerprint.d.ts +4 -1
- package/dist/contract/fingerprint.d.ts.map +1 -1
- package/dist/contract/operation-refusals.d.ts +51 -0
- package/dist/contract/operation-refusals.d.ts.map +1 -0
- package/dist/contract/tool-options.d.ts +4 -0
- package/dist/contract/tool-options.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/acp.js +254 -196
- package/dist/entrypoints/agent-executor/claude-sdk.js +467 -294
- package/dist/entrypoints/agent-executor/claude.js +130 -99
- package/dist/entrypoints/agent-executor/codex.js +441 -314
- package/dist/entrypoints/agent-executor/testing/claude-sdk.d.ts +3 -0
- package/dist/entrypoints/agent-executor/testing/claude-sdk.d.ts.map +1 -0
- package/dist/entrypoints/agent-executor/testing/claude-sdk.js +329 -0
- package/dist/entrypoints/agent-executor/testing.d.ts +1 -2
- package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/testing.js +413 -667
- package/dist/entrypoints/agent-executor.d.ts +1 -1
- package/dist/entrypoints/agent-executor.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor.js +12 -12
- package/dist/entrypoints/agent-runtime/browser.js +2 -2
- package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
- package/dist/entrypoints/agent-runtime/harness.js +8 -8
- package/dist/entrypoints/agent-runtime/postgres.js +5 -5
- package/dist/entrypoints/agent-runtime/realtime.js +2 -2
- package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
- package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
- package/dist/entrypoints/agent-runtime/testing.js +5 -5
- package/dist/entrypoints/agent-runtime.js +26 -18
- package/dist/entrypoints/application/grammy.js +1 -1
- package/dist/entrypoints/application.js +2 -2
- package/dist/entrypoints/cli.js +8 -8
- package/dist/entrypoints/contract.d.ts +3 -2
- package/dist/entrypoints/contract.d.ts.map +1 -1
- package/dist/entrypoints/contract.js +6 -4
- package/dist/entrypoints/files/packaging.d.ts +4 -1
- package/dist/entrypoints/files/packaging.d.ts.map +1 -1
- package/dist/entrypoints/files/packaging.js +868 -167
- package/dist/entrypoints/files.js +1 -1
- package/dist/entrypoints/handler.js +7 -7
- package/dist/entrypoints/http.js +2 -2
- package/dist/entrypoints/index.js +10 -8
- package/dist/entrypoints/node.js +11 -11
- package/dist/entrypoints/observability.js +1 -1
- package/dist/entrypoints/process/bootstrap.d.ts +3 -0
- package/dist/entrypoints/process/bootstrap.d.ts.map +1 -0
- package/dist/entrypoints/process/bootstrap.js +16 -0
- package/dist/entrypoints/process.js +7 -7
- package/dist/entrypoints/realtime.js +3 -3
- package/dist/entrypoints/remote.js +8 -7
- package/dist/entrypoints/server.js +30 -14
- package/dist/entrypoints/service-host/macos.js +72 -206
- package/dist/entrypoints/service-host/work.d.ts +15 -0
- package/dist/entrypoints/service-host/work.d.ts.map +1 -0
- package/dist/entrypoints/service-host/work.js +676 -0
- package/dist/entrypoints/service-host.js +146 -536
- package/dist/entrypoints/telegram/screens.js +4 -4
- package/dist/entrypoints/telegram.js +4 -4
- package/dist/entrypoints/testing.d.ts +2 -1
- package/dist/entrypoints/testing.d.ts.map +1 -1
- package/dist/entrypoints/testing.js +27 -8
- package/dist/entrypoints/tools/agent.js +6 -6
- package/dist/entrypoints/tools/connections.js +2 -2
- package/dist/entrypoints/tools/invoker.js +5 -5
- package/dist/entrypoints/tools/mcp.js +8 -6
- package/dist/entrypoints/tools/toolkit.js +11 -9
- package/dist/entrypoints/tools.js +19 -17
- package/dist/entrypoints/tracking/contract.js +1 -1
- package/dist/entrypoints/tracking/performance.js +3 -3
- package/dist/files/client-artifact.d.ts +14 -42
- package/dist/files/client-artifact.d.ts.map +1 -1
- package/dist/files/client-build.d.ts +57 -0
- package/dist/files/client-build.d.ts.map +1 -0
- package/dist/files/client-declarations.d.ts +35 -0
- package/dist/files/client-declarations.d.ts.map +1 -0
- package/dist/files/client-package-contract.d.ts +162 -0
- package/dist/files/client-package-contract.d.ts.map +1 -0
- package/dist/files/client-package-proof.d.ts +38 -0
- package/dist/files/client-package-proof.d.ts.map +1 -0
- package/dist/files/client-package.d.ts +17 -0
- package/dist/files/client-package.d.ts.map +1 -0
- package/dist/files/declaration-specifiers.d.ts +30 -0
- package/dist/files/declaration-specifiers.d.ts.map +1 -0
- package/dist/{index-v759mzed.js → index-02r5sq9p.js} +36 -23
- package/dist/{index-0r15pkjq.js → index-0k1ba0ss.js} +1 -1
- package/dist/{index-znd1b57f.js → index-1dn2wjq6.js} +5 -4
- package/dist/{index-p06z7g7w.js → index-1p8q0yrt.js} +6 -5
- package/dist/{index-wa6h4tz6.js → index-1qwd54n3.js} +6 -5
- package/dist/index-2dzc7mv9.js +174 -0
- package/dist/index-2mz8hj58.js +155 -0
- package/dist/{index-17qgm6xe.js → index-34k82crg.js} +2 -2
- package/dist/index-3mcbr8sx.js +349 -0
- package/dist/{index-ybdq8kk2.js → index-3y2tzhr8.js} +3 -3
- package/dist/{index-fgahdc7s.js → index-5n3a8hd8.js} +5 -3
- package/dist/{index-jb4m241t.js → index-6918kxbf.js} +45 -1
- package/dist/{index-n3bm7zqq.js → index-6kmjcm81.js} +4 -4
- package/dist/{index-akf0xkrm.js → index-78da4g74.js} +1 -1
- package/dist/{index-9pv126eh.js → index-7fjbdga8.js} +7 -1
- package/dist/{index-zhshhxew.js → index-8jf4bt7v.js} +1 -1
- package/dist/{index-p16q492v.js → index-8t9dr41h.js} +18 -5
- package/dist/{index-xq4s9mka.js → index-8yt3rwe7.js} +1 -1
- package/dist/{index-39c2hj6h.js → index-9c76vfxf.js} +7 -3
- package/dist/index-9ft4n9j1.js +432 -0
- package/dist/{index-sd4e5x5j.js → index-9wdrwx3b.js} +8 -7
- package/dist/{index-z114ax5e.js → index-an7vcmwf.js} +49 -2
- package/dist/{index-pzhqydxb.js → index-d04w81fz.js} +1 -1
- package/dist/index-d2drhb9c.js +219 -0
- package/dist/{index-8gmmdz7k.js → index-dacxr7nf.js} +1 -1
- package/dist/{index-dnzxxf8a.js → index-dm6nxkn1.js} +1 -1
- package/dist/index-dxft2mnm.js +42 -0
- package/dist/{index-rxh3qy4x.js → index-fzd477xk.js} +1 -1
- package/dist/{index-xgae0bn7.js → index-g4gstmp1.js} +2 -2
- package/dist/{index-athc412x.js → index-g5fgeb6v.js} +1 -1
- package/dist/{index-z9d74jmb.js → index-gbhj370g.js} +3 -3
- package/dist/{index-3fym4j8n.js → index-gtaaxe9d.js} +1 -1
- package/dist/{index-v59pxmf1.js → index-jpecjm30.js} +2 -2
- package/dist/index-k9g061ma.js +164 -0
- package/dist/{index-669374qc.js → index-ma26mfnt.js} +84 -315
- package/dist/{index-ryxb427v.js → index-msxf2r8x.js} +16 -3
- package/dist/{index-rbd2rq3z.js → index-nr4fhfn4.js} +1 -1
- package/dist/{index-qa2jjb65.js → index-pbekeqzm.js} +1 -1
- package/dist/{index-mkfhpk11.js → index-pq6g1k9t.js} +2 -2
- package/dist/{index-gya4hwh3.js → index-pws5c3x6.js} +21 -1
- package/dist/{index-x2fb37t0.js → index-q427q23r.js} +3 -2
- package/dist/{index-jcrj0b8z.js → index-qggqqja2.js} +39 -2
- package/dist/{index-jxtg307y.js → index-rkjfzs0a.js} +1 -1
- package/dist/{index-5tdc0q43.js → index-rw8ze745.js} +5 -3
- package/dist/index-s43tr4my.js +129 -0
- package/dist/{index-f9p62ean.js → index-stpy56r3.js} +175 -249
- package/dist/index-t5g5rm9n.js +213 -0
- package/dist/{index-z20pdxeb.js → index-tmv3ez1h.js} +3 -3
- package/dist/{index-dcsxj68j.js → index-tqjamnax.js} +1 -1
- package/dist/{index-j15dhkda.js → index-wddcfbng.js} +1 -325
- package/dist/{index-9sfhje6y.js → index-wh70tmpd.js} +24 -234
- package/dist/index-wxjv4sqx.js +82 -0
- package/dist/{index-qhjmmsm2.js → index-x46y9z26.js} +2 -2
- package/dist/{index-nk0cy9g1.js → index-y53cqwke.js} +1 -1
- package/dist/{index-sv5svtq7.js → index-y68gavb5.js} +1 -1
- package/dist/{index-5y7j383h.js → index-yrhw10ef.js} +1 -1
- package/dist/process/bootstrap.d.ts +12 -0
- package/dist/process/bootstrap.d.ts.map +1 -0
- package/dist/process/owner-loss-guard.d.ts +2 -9
- package/dist/process/owner-loss-guard.d.ts.map +1 -1
- package/dist/process/work-root.d.ts +20 -0
- package/dist/process/work-root.d.ts.map +1 -0
- package/dist/server/contract-identity.d.ts.map +1 -1
- package/dist/server/contract-method.d.ts +12 -0
- package/dist/server/contract-method.d.ts.map +1 -1
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/openapi.d.ts.map +1 -1
- package/dist/server/types.d.ts +10 -9
- package/dist/server/types.d.ts.map +1 -1
- package/dist/service-host/host-adapter.d.ts +2 -0
- package/dist/service-host/host-adapter.d.ts.map +1 -1
- package/dist/service-host/work/command.d.ts +72 -0
- package/dist/service-host/work/command.d.ts.map +1 -0
- package/dist/service-host/work/errors.d.ts +29 -0
- package/dist/service-host/work/errors.d.ts.map +1 -0
- package/dist/service-host/work/host.d.ts +38 -0
- package/dist/service-host/work/host.d.ts.map +1 -0
- package/dist/service-host/work/launch.d.ts +51 -0
- package/dist/service-host/work/launch.d.ts.map +1 -0
- package/dist/service-host/work/membership.d.ts +51 -0
- package/dist/service-host/work/membership.d.ts.map +1 -0
- package/dist/service-host/work/origin.d.ts +79 -0
- package/dist/service-host/work/origin.d.ts.map +1 -0
- package/dist/service-host/work/owner.d.ts +45 -0
- package/dist/service-host/work/owner.d.ts.map +1 -0
- package/dist/service-host/work/placement.d.ts +55 -0
- package/dist/service-host/work/placement.d.ts.map +1 -0
- package/dist/service-host/work/probe.d.ts +24 -0
- package/dist/service-host/work/probe.d.ts.map +1 -0
- package/dist/service-host/work/scope-command.d.ts +68 -0
- package/dist/service-host/work/scope-command.d.ts.map +1 -0
- package/dist/sync/session.d.ts +4 -1
- package/dist/sync/session.d.ts.map +1 -1
- package/dist/testing/surface-manifest-digest.d.ts +2 -0
- package/dist/testing/surface-manifest-digest.d.ts.map +1 -1
- package/dist/testing/surface-manifest.d.ts +32 -3
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/tools/agent.d.ts +2 -0
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/stream-surface.d.ts.map +1 -1
- package/dist/tools/internal/mcp-projection.d.ts +58 -0
- package/dist/tools/internal/mcp-projection.d.ts.map +1 -0
- package/dist/tools/internal/surface-projector.d.ts +3 -47
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/invoker.d.ts +2 -0
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/manifest.d.ts +2 -0
- package/dist/tools/manifest.d.ts.map +1 -1
- package/dist/tools/mcp/handler.d.ts.map +1 -1
- package/dist/tools/mcp/lazy-discovery.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +4 -0
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/prepare.d.ts +5 -2
- package/dist/tools/mcp/prepare.d.ts.map +1 -1
- package/dist/tools/mount.d.ts +2 -0
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/schema/nesting-limit.d.ts +8 -0
- package/dist/tools/schema/nesting-limit.d.ts.map +1 -0
- package/dist/tools/schema/presentation.d.ts +7 -0
- package/dist/tools/schema/presentation.d.ts.map +1 -1
- package/dist/tools/surface.d.ts.map +1 -1
- package/llms/agent-executor-acp.txt +3 -3
- package/llms/agent-executor-claude-sdk.txt +1 -1
- package/llms/agent-executor-claude.txt +1 -1
- package/llms/agent-executor-codex.txt +1 -1
- package/llms/agent-executor-testing-claude-sdk.txt +28 -0
- package/llms/agent-executor-testing.txt +7 -8
- package/llms/agent-executor.txt +27 -4
- package/llms/agent-runtime.txt +1 -1
- package/llms/contract.txt +8 -2
- package/llms/files-packaging.txt +11 -6
- package/llms/process-bootstrap.txt +18 -0
- package/llms/process.2.txt +215 -18
- package/llms/process.txt +130 -92
- package/llms/server.4.txt +49 -1
- package/llms/service-host-work.txt +34 -0
- package/llms/stitchkit.2.txt +31 -0
- package/llms/stitchkit.txt +78 -75
- package/llms/sync.txt +5 -2
- package/llms/testing.txt +1 -0
- package/llms/tools.2.txt +747 -775
- package/llms/tools.3.txt +846 -210
- package/llms/tools.4.txt +226 -0
- package/llms/tools.txt +3 -790
- package/llms/{upgrading-0.128.0-0.132.0.txt → upgrading-0.128.0-0.133.0.txt} +194 -6
- package/llms/upgrading.txt +1 -1
- package/llms-full.txt +746 -135
- package/llms.txt +18 -16
- package/package.json +12 -4
- package/dist/entrypoints/process/owner-loss.d.ts +0 -3
- package/dist/entrypoints/process/owner-loss.d.ts.map +0 -1
- package/dist/entrypoints/process/owner-loss.js +0 -7
- package/llms/process-owner-loss.txt +0 -18
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validateDeclaredOutput
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-78da4g74.js";
|
|
4
4
|
import {
|
|
5
5
|
isHttpOnlyEndpoint
|
|
6
6
|
} from "./index-yt1gg11x.js";
|
|
@@ -8,8 +8,7 @@ import {
|
|
|
8
8
|
JSON_SCHEMA_KEYWORDS,
|
|
9
9
|
SCHEMA_KEYWORDS,
|
|
10
10
|
SCHEMA_LIST_KEYWORDS,
|
|
11
|
-
SCHEMA_MAP_KEYWORDS
|
|
12
|
-
TYPE_DEFINING_KEYWORDS
|
|
11
|
+
SCHEMA_MAP_KEYWORDS
|
|
13
12
|
} from "./index-27hck3z2.js";
|
|
14
13
|
import {
|
|
15
14
|
toJsonSchema
|
|
@@ -26,11 +25,12 @@ import {
|
|
|
26
25
|
assertNoLegacyTransports
|
|
27
26
|
} from "./index-akfgymyr.js";
|
|
28
27
|
import {
|
|
29
|
-
assertInputRecursionDepth
|
|
30
|
-
|
|
28
|
+
assertInputRecursionDepth,
|
|
29
|
+
assertInputNestingDepth
|
|
30
|
+
} from "./index-msxf2r8x.js";
|
|
31
31
|
import {
|
|
32
32
|
AppError2
|
|
33
|
-
} from "./index-
|
|
33
|
+
} from "./index-7fjbdga8.js";
|
|
34
34
|
import {
|
|
35
35
|
isRecord
|
|
36
36
|
} from "./index-ps3djm8d.js";
|
|
@@ -91,42 +91,6 @@ function projectToolView(options) {
|
|
|
91
91
|
// src/tools/internal/surface-projector.ts
|
|
92
92
|
import { z as z2 } from "zod";
|
|
93
93
|
|
|
94
|
-
// src/tools/mcp/round-policy.ts
|
|
95
|
-
function staticInputRounds(policy) {
|
|
96
|
-
return Array.isArray(policy.inputRequired) ? policy.inputRequired : undefined;
|
|
97
|
-
}
|
|
98
|
-
function validateMcpRoundPolicy(tool, policy, runtime) {
|
|
99
|
-
if (!runtime?.stateConfigured) {
|
|
100
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares inputRequired but no multiRound.state key is configured`);
|
|
101
|
-
}
|
|
102
|
-
const { maxRounds } = runtime;
|
|
103
|
-
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
104
|
-
throw new Error("[stitchkit] multiRound.serving.maxRounds must be a positive integer");
|
|
105
|
-
}
|
|
106
|
-
const declared = staticInputRounds(policy);
|
|
107
|
-
if (!declared)
|
|
108
|
-
return;
|
|
109
|
-
if (declared.length === 0) {
|
|
110
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" must declare at least one input round`);
|
|
111
|
-
}
|
|
112
|
-
assertRoundShape(tool, declared, maxRounds);
|
|
113
|
-
}
|
|
114
|
-
function validateResolvedInputRounds(tool, resolved, maxRounds) {
|
|
115
|
-
assertRoundShape(tool, resolved, maxRounds);
|
|
116
|
-
}
|
|
117
|
-
function assertRoundShape(tool, rounds, maxRounds) {
|
|
118
|
-
if (rounds.length > maxRounds) {
|
|
119
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares ${rounds.length} input rounds, exceeding maxRounds ${maxRounds}`);
|
|
120
|
-
}
|
|
121
|
-
const keys = new Set;
|
|
122
|
-
for (const request of rounds) {
|
|
123
|
-
if (keys.has(request.key)) {
|
|
124
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares duplicate input key "${request.key}"`);
|
|
125
|
-
}
|
|
126
|
-
keys.add(request.key);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
94
|
// src/tools/names.ts
|
|
131
95
|
var SINGULAR_EXCEPTIONS = new Set([
|
|
132
96
|
"analytics",
|
|
@@ -192,92 +156,6 @@ function assertUniqueToolName(name, taken, surface) {
|
|
|
192
156
|
}
|
|
193
157
|
}
|
|
194
158
|
|
|
195
|
-
// src/tools/schema/portable-formats.ts
|
|
196
|
-
var PORTABLE_JSON_SCHEMA_FORMATS2 = new Set([
|
|
197
|
-
"date",
|
|
198
|
-
"time",
|
|
199
|
-
"date-time",
|
|
200
|
-
"duration",
|
|
201
|
-
"uri",
|
|
202
|
-
"uri-reference",
|
|
203
|
-
"uri-template",
|
|
204
|
-
"email",
|
|
205
|
-
"hostname",
|
|
206
|
-
"ipv4",
|
|
207
|
-
"ipv6",
|
|
208
|
-
"regex",
|
|
209
|
-
"uuid",
|
|
210
|
-
"json-pointer",
|
|
211
|
-
"relative-json-pointer"
|
|
212
|
-
]);
|
|
213
|
-
function propertyPath(prefix, property) {
|
|
214
|
-
return prefix ? `${prefix}.${property}` : property;
|
|
215
|
-
}
|
|
216
|
-
function keywordPath(prefix, keyword) {
|
|
217
|
-
if (prefix && keyword.startsWith("["))
|
|
218
|
-
return `${prefix}${keyword}`;
|
|
219
|
-
return prefix ? `${prefix}.${keyword}` : keyword;
|
|
220
|
-
}
|
|
221
|
-
function findNonPortableFormats2(schema, allowFormats = []) {
|
|
222
|
-
const allowed = new Set([...PORTABLE_JSON_SCHEMA_FORMATS2, ...allowFormats]);
|
|
223
|
-
const found = [];
|
|
224
|
-
const pending = [{ value: schema, path: "" }];
|
|
225
|
-
while (pending.length > 0) {
|
|
226
|
-
const current = pending.pop();
|
|
227
|
-
if (!current || !isRecord(current.value))
|
|
228
|
-
continue;
|
|
229
|
-
const format = current.value.format;
|
|
230
|
-
if (typeof format === "string" && !allowed.has(format)) {
|
|
231
|
-
found.push({ path: current.path || "(root)", format });
|
|
232
|
-
}
|
|
233
|
-
const properties = current.value.properties;
|
|
234
|
-
if (isRecord(properties)) {
|
|
235
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
236
|
-
pending.push({ value, path: propertyPath(current.path, key) });
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
for (const mapKey of ["$defs", "definitions", "patternProperties", "dependentSchemas"]) {
|
|
240
|
-
const entries = current.value[mapKey];
|
|
241
|
-
if (!isRecord(entries))
|
|
242
|
-
continue;
|
|
243
|
-
for (const [key, value] of Object.entries(entries)) {
|
|
244
|
-
pending.push({ value, path: keywordPath(current.path, `${mapKey}.${key}`) });
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
const directChildren = [
|
|
248
|
-
["items", "[]"],
|
|
249
|
-
["contains", "contains"],
|
|
250
|
-
["additionalProperties", "*"],
|
|
251
|
-
["unevaluatedProperties", "*"],
|
|
252
|
-
["propertyNames", "propertyNames"],
|
|
253
|
-
["not", "not"],
|
|
254
|
-
["if", "if"],
|
|
255
|
-
["then", "then"],
|
|
256
|
-
["else", "else"]
|
|
257
|
-
];
|
|
258
|
-
for (const [keyword, segment] of directChildren) {
|
|
259
|
-
const child = current.value[keyword];
|
|
260
|
-
if (isRecord(child)) {
|
|
261
|
-
pending.push({ value: child, path: keywordPath(current.path, segment) });
|
|
262
|
-
}
|
|
263
|
-
if (Array.isArray(child)) {
|
|
264
|
-
child.forEach((value, index) => {
|
|
265
|
-
pending.push({ value, path: keywordPath(current.path, `${segment}[${index}]`) });
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
for (const keyword of ["prefixItems", "allOf", "anyOf", "oneOf"]) {
|
|
270
|
-
const branches = current.value[keyword];
|
|
271
|
-
if (!Array.isArray(branches))
|
|
272
|
-
continue;
|
|
273
|
-
branches.forEach((value, index) => {
|
|
274
|
-
pending.push({ value, path: keywordPath(current.path, `${keyword}[${index}]`) });
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return found.sort((left, right) => left.path.localeCompare(right.path) || left.format.localeCompare(right.format));
|
|
279
|
-
}
|
|
280
|
-
|
|
281
159
|
// src/tools/schema/presentation.ts
|
|
282
160
|
import { z } from "zod";
|
|
283
161
|
|
|
@@ -679,6 +557,76 @@ function inlineSchemaReferences(schema, depth) {
|
|
|
679
557
|
return isRecord(written) ? written : {};
|
|
680
558
|
}
|
|
681
559
|
|
|
560
|
+
// src/tools/schema/nesting-limit.ts
|
|
561
|
+
var KEYWORD_PROPERTY_NAMES = new Set(["items", "properties"]);
|
|
562
|
+
var FREE_BRANCHES = ["anyOf", "oneOf", "allOf"];
|
|
563
|
+
function steps(node) {
|
|
564
|
+
const found = [];
|
|
565
|
+
if (isRecord(node.properties)) {
|
|
566
|
+
for (const [name, child] of Object.entries(node.properties))
|
|
567
|
+
if (isRecord(child))
|
|
568
|
+
found.push({ child, cost: KEYWORD_PROPERTY_NAMES.has(name) ? 2 : 1 });
|
|
569
|
+
}
|
|
570
|
+
const items = node.items;
|
|
571
|
+
if (isRecord(items))
|
|
572
|
+
found.push({ child: items, cost: 1 });
|
|
573
|
+
if (Array.isArray(items)) {
|
|
574
|
+
for (const entry of items)
|
|
575
|
+
if (isRecord(entry))
|
|
576
|
+
found.push({ child: entry, cost: 1 });
|
|
577
|
+
}
|
|
578
|
+
for (const key of FREE_BRANCHES)
|
|
579
|
+
if (Array.isArray(node[key])) {
|
|
580
|
+
for (const branch of node[key])
|
|
581
|
+
if (isRecord(branch))
|
|
582
|
+
found.push({ child: branch, cost: 0 });
|
|
583
|
+
}
|
|
584
|
+
if (isRecord(node.additionalProperties))
|
|
585
|
+
found.push({ child: node.additionalProperties, cost: 0 });
|
|
586
|
+
return found;
|
|
587
|
+
}
|
|
588
|
+
function reach(node) {
|
|
589
|
+
let deepest = 0;
|
|
590
|
+
for (const { child, cost } of steps(node))
|
|
591
|
+
deepest = Math.max(deepest, cost + reach(child));
|
|
592
|
+
return deepest;
|
|
593
|
+
}
|
|
594
|
+
function openNode2(node) {
|
|
595
|
+
return typeof node.description === "string" ? { description: node.description } : {};
|
|
596
|
+
}
|
|
597
|
+
function limitInputNesting(schema, limit, onOpened) {
|
|
598
|
+
assertInputNestingDepth("inputNestingDepth", limit);
|
|
599
|
+
const visit = (node, depth, path) => {
|
|
600
|
+
if (depth + reach(node) <= limit)
|
|
601
|
+
return node;
|
|
602
|
+
if (steps(node).some(({ cost }) => depth + cost > limit)) {
|
|
603
|
+
onOpened?.(path);
|
|
604
|
+
return openNode2(node);
|
|
605
|
+
}
|
|
606
|
+
const rewritten = { ...node };
|
|
607
|
+
if (isRecord(node.properties)) {
|
|
608
|
+
const properties = {};
|
|
609
|
+
for (const [name, child] of Object.entries(node.properties)) {
|
|
610
|
+
const cost = KEYWORD_PROPERTY_NAMES.has(name) ? 2 : 1;
|
|
611
|
+
properties[name] = isRecord(child) ? visit(child, depth + cost, path === "" ? name : `${path}.${name}`) : child;
|
|
612
|
+
}
|
|
613
|
+
rewritten.properties = properties;
|
|
614
|
+
}
|
|
615
|
+
if (isRecord(node.items))
|
|
616
|
+
rewritten.items = visit(node.items, depth + 1, path);
|
|
617
|
+
if (Array.isArray(node.items))
|
|
618
|
+
rewritten.items = node.items.map((entry) => isRecord(entry) ? visit(entry, depth + 1, path) : entry);
|
|
619
|
+
for (const key of FREE_BRANCHES)
|
|
620
|
+
if (Array.isArray(node[key]))
|
|
621
|
+
rewritten[key] = node[key].map((branch) => isRecord(branch) ? visit(branch, depth, path) : branch);
|
|
622
|
+
if (isRecord(node.additionalProperties))
|
|
623
|
+
rewritten.additionalProperties = visit(node.additionalProperties, depth, path);
|
|
624
|
+
return rewritten;
|
|
625
|
+
};
|
|
626
|
+
const limited = visit(schema, 0, "");
|
|
627
|
+
return isRecord(limited) ? limited : schema;
|
|
628
|
+
}
|
|
629
|
+
|
|
682
630
|
// src/tools/schema/presentation.ts
|
|
683
631
|
function withoutDialect(schema) {
|
|
684
632
|
const result = {};
|
|
@@ -808,6 +756,7 @@ function schemaFromZod(schema, steps) {
|
|
|
808
756
|
}
|
|
809
757
|
function buildToolPresentationSchema(config) {
|
|
810
758
|
assertInputRecursionDepth("inputRecursionDepth", config.inputRecursionDepth);
|
|
759
|
+
assertInputNestingDepth("inputNestingDepth", config.inputNestingDepth);
|
|
811
760
|
const steps = {
|
|
812
761
|
unrepresentable: config.unrepresentable ?? "any",
|
|
813
762
|
flatten: config.flattenUnionInput ?? false,
|
|
@@ -837,6 +786,8 @@ function buildToolPresentationSchema(config) {
|
|
|
837
786
|
}
|
|
838
787
|
if (config.defaults)
|
|
839
788
|
presentation = withToolDefaults(presentation, config.defaults);
|
|
789
|
+
if (config.inputNestingDepth !== undefined)
|
|
790
|
+
presentation = limitInputNesting(presentation, config.inputNestingDepth, config.onInputNestingOpened);
|
|
840
791
|
if (presentation.$schema === undefined) {
|
|
841
792
|
presentation = {
|
|
842
793
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
@@ -873,76 +824,6 @@ function presentationMetadata(schema) {
|
|
|
873
824
|
return withDraft2020Keywords(withoutDialect(schema));
|
|
874
825
|
}
|
|
875
826
|
|
|
876
|
-
// src/tools/schema/untyped-properties.ts
|
|
877
|
-
function saysWhatItIs(schema) {
|
|
878
|
-
return TYPE_DEFINING_KEYWORDS.some((keyword) => schema[keyword] !== undefined);
|
|
879
|
-
}
|
|
880
|
-
function findUntypedProperties2(schema, prefix = "") {
|
|
881
|
-
if (!isRecord(schema))
|
|
882
|
-
return [];
|
|
883
|
-
const found = [];
|
|
884
|
-
const properties = schema.properties;
|
|
885
|
-
if (isRecord(properties)) {
|
|
886
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
887
|
-
const path = prefix ? `${prefix}.${key}` : key;
|
|
888
|
-
if (isRecord(value)) {
|
|
889
|
-
if (!saysWhatItIs(value)) {
|
|
890
|
-
const description = value.description;
|
|
891
|
-
found.push({
|
|
892
|
-
path,
|
|
893
|
-
...typeof description === "string" && { description }
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
found.push(...findUntypedProperties2(value, path));
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
for (const key of ["items", "additionalProperties"]) {
|
|
901
|
-
const child = schema[key];
|
|
902
|
-
if (isRecord(child))
|
|
903
|
-
found.push(...findUntypedProperties2(child, prefix));
|
|
904
|
-
if (Array.isArray(child)) {
|
|
905
|
-
for (const entry of child) {
|
|
906
|
-
if (isRecord(entry))
|
|
907
|
-
found.push(...findUntypedProperties2(entry, prefix));
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
for (const key of ["prefixItems"]) {
|
|
912
|
-
const child = schema[key];
|
|
913
|
-
if (Array.isArray(child)) {
|
|
914
|
-
for (const entry of child) {
|
|
915
|
-
if (isRecord(entry))
|
|
916
|
-
found.push(...findUntypedProperties2(entry, prefix));
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
const patterned = schema.patternProperties;
|
|
921
|
-
if (isRecord(patterned)) {
|
|
922
|
-
for (const value of Object.values(patterned)) {
|
|
923
|
-
if (isRecord(value))
|
|
924
|
-
found.push(...findUntypedProperties2(value, prefix));
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
for (const key of ["$defs", "definitions"]) {
|
|
928
|
-
const container = schema[key];
|
|
929
|
-
if (!isRecord(container))
|
|
930
|
-
continue;
|
|
931
|
-
for (const definition of Object.values(container)) {
|
|
932
|
-
if (isRecord(definition))
|
|
933
|
-
found.push(...findUntypedProperties2(definition, prefix));
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
for (const key of ["allOf", "anyOf", "oneOf"]) {
|
|
937
|
-
const branches = schema[key];
|
|
938
|
-
if (Array.isArray(branches)) {
|
|
939
|
-
for (const branch of branches)
|
|
940
|
-
found.push(...findUntypedProperties2(branch, prefix));
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
return found;
|
|
944
|
-
}
|
|
945
|
-
|
|
946
827
|
// src/tools/internal/surface-projector.ts
|
|
947
828
|
function assertToolExtensionCompatible(base, extra) {
|
|
948
829
|
if (!(base instanceof z2.ZodObject))
|
|
@@ -966,6 +847,7 @@ function projectRuntimeTool(definition, options = {}) {
|
|
|
966
847
|
inputSchema: definition.input,
|
|
967
848
|
flattenUnionInput: options.flattenUnionInput,
|
|
968
849
|
inputRecursionDepth: options.inputRecursionDepth,
|
|
850
|
+
inputNestingDepth: options.inputNestingDepth,
|
|
969
851
|
unrepresentable: "any"
|
|
970
852
|
}),
|
|
971
853
|
shouldExtend: false,
|
|
@@ -1042,6 +924,7 @@ function projectToolSurface(surface, transport, config = {}) {
|
|
|
1042
924
|
extendSchema: shouldExtend ? config.extend?.schema : undefined,
|
|
1043
925
|
flattenUnionInput: config.flattenUnionInput,
|
|
1044
926
|
inputRecursionDepth: method.inputRecursionDepth ?? config.inputRecursionDepth,
|
|
927
|
+
inputNestingDepth: method.inputNestingDepth ?? config.inputNestingDepth,
|
|
1045
928
|
unrepresentable: "any"
|
|
1046
929
|
}),
|
|
1047
930
|
shouldExtend,
|
|
@@ -1058,125 +941,11 @@ function projectToolSurface(surface, transport, config = {}) {
|
|
|
1058
941
|
append(projectRuntimeTool(definition, {
|
|
1059
942
|
assertName: false,
|
|
1060
943
|
flattenUnionInput: config.flattenUnionInput,
|
|
1061
|
-
inputRecursionDepth: config.inputRecursionDepth
|
|
944
|
+
inputRecursionDepth: config.inputRecursionDepth,
|
|
945
|
+
inputNestingDepth: config.inputNestingDepth
|
|
1062
946
|
}));
|
|
1063
947
|
}
|
|
1064
948
|
return projected;
|
|
1065
949
|
}
|
|
1066
|
-
function mcpProjectionCandidate(tool) {
|
|
1067
|
-
if (tool.kind === "contract") {
|
|
1068
|
-
return {
|
|
1069
|
-
tool,
|
|
1070
|
-
name: tool.name,
|
|
1071
|
-
...tool.source.paramsSchema !== undefined && {
|
|
1072
|
-
paramsSchema: tool.source.paramsSchema
|
|
1073
|
-
},
|
|
1074
|
-
...tool.source.inputSchema !== undefined && {
|
|
1075
|
-
inputSchema: tool.source.inputSchema
|
|
1076
|
-
},
|
|
1077
|
-
...tool.source.toolView?.defaults !== undefined && {
|
|
1078
|
-
inputDefaults: tool.source.toolView.defaults
|
|
1079
|
-
},
|
|
1080
|
-
...tool.source.inputRecursionDepth !== undefined && {
|
|
1081
|
-
inputRecursionDepth: tool.source.inputRecursionDepth
|
|
1082
|
-
},
|
|
1083
|
-
...toolSurfaceOutputSchema(tool.source) !== undefined && {
|
|
1084
|
-
outputSchema: toolSurfaceOutputSchema(tool.source)
|
|
1085
|
-
},
|
|
1086
|
-
shouldExtend: tool.shouldExtend,
|
|
1087
|
-
...tool.mcp !== undefined && { mcp: tool.mcp }
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
return {
|
|
1091
|
-
tool,
|
|
1092
|
-
name: tool.name,
|
|
1093
|
-
inputSchema: tool.source.input,
|
|
1094
|
-
...tool.source.output !== undefined && { outputSchema: tool.source.output },
|
|
1095
|
-
shouldExtend: false,
|
|
1096
|
-
...tool.mcp !== undefined && { mcp: tool.mcp }
|
|
1097
|
-
};
|
|
1098
|
-
}
|
|
1099
|
-
function reportIncompatible(message, policy, logger, failures) {
|
|
1100
|
-
if (policy === "throw")
|
|
1101
|
-
failures.push(message);
|
|
1102
|
-
else if (policy === "warn") {
|
|
1103
|
-
if (logger)
|
|
1104
|
-
logger.warn(`[stitchkit] ${message}`);
|
|
1105
|
-
else
|
|
1106
|
-
console.warn(`[stitchkit] ${message}`);
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
function prepareProjectedMcpTools(tools, config = {}) {
|
|
1110
|
-
const policy = config.schemaValidation?.policy ?? "throw";
|
|
1111
|
-
const failures = [];
|
|
1112
|
-
const prepared = [];
|
|
1113
|
-
const names = new Set;
|
|
1114
|
-
for (const tool of tools) {
|
|
1115
|
-
assertUniqueToolName(tool.name, names.has(tool.name), "MCP tool name");
|
|
1116
|
-
names.add(tool.name);
|
|
1117
|
-
if (tool.mcp)
|
|
1118
|
-
validateMcpRoundPolicy(tool, tool.mcp, config.multiRound);
|
|
1119
|
-
let inputSchema;
|
|
1120
|
-
try {
|
|
1121
|
-
inputSchema = buildToolPresentationSchema({
|
|
1122
|
-
paramsSchema: tool.paramsSchema,
|
|
1123
|
-
inputSchema: tool.inputSchema,
|
|
1124
|
-
extendSchema: tool.shouldExtend && config.extend ? config.extend.schema : undefined,
|
|
1125
|
-
flattenUnionInput: config.flattenUnionInput,
|
|
1126
|
-
inputRecursionDepth: tool.inputRecursionDepth ?? config.inputRecursionDepth,
|
|
1127
|
-
unrepresentable: "throw",
|
|
1128
|
-
defaults: tool.inputDefaults
|
|
1129
|
-
});
|
|
1130
|
-
} catch (error) {
|
|
1131
|
-
reportIncompatible(`MCP tool "${tool.name}" — input schema is not JSON Schema-compatible: ${error instanceof Error ? error.message : String(error)}`, policy, config.logger, failures);
|
|
1132
|
-
continue;
|
|
1133
|
-
}
|
|
1134
|
-
if (!isObjectPresentationSchema(inputSchema)) {
|
|
1135
|
-
reportIncompatible(`MCP tool "${tool.name}" — input must be an object schema; a union, discriminated union or scalar cannot be an MCP tool input (flatten it in the contract, or drop MCP from \`expose\`)`, policy, config.logger, failures);
|
|
1136
|
-
continue;
|
|
1137
|
-
}
|
|
1138
|
-
if (config.schemaValidation?.requireTypedProperties) {
|
|
1139
|
-
const allowed = new Set(config.schemaValidation.allowUntyped ?? []);
|
|
1140
|
-
for (const untyped of findUntypedProperties2(inputSchema)) {
|
|
1141
|
-
const path = `${tool.name}.${untyped.path}`;
|
|
1142
|
-
if (allowed.has(path))
|
|
1143
|
-
continue;
|
|
1144
|
-
const clue = untyped.description ? ` (only a description: "${untyped.description}")` : "";
|
|
1145
|
-
reportIncompatible(`MCP tool "${tool.name}" — input property "${untyped.path}" carries no type, enum or $ref${clue}. A model is given no way to know what to send. Use \`z.json()\` for an arbitrary JSON value — its schema refers to itself, so where the model provider refuses recursive schemas also set \`inputRecursionDepth\`; use \`allowUntyped\` only when the presentation value is genuinely not representable as JSON Schema.`, policy === "skip" ? "warn" : policy, config.logger, failures);
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
if (config.schemaValidation?.requirePortableFormats) {
|
|
1149
|
-
for (const finding of findNonPortableFormats2(inputSchema, config.schemaValidation.allowFormats)) {
|
|
1150
|
-
reportIncompatible(`MCP tool "${tool.name}" — input property "${finding.path}" uses non-portable JSON Schema format "${finding.format}". Use a portable pattern/schema, or list the format in \`allowFormats\` only when every MCP client supports it.`, policy === "skip" ? "warn" : policy, config.logger, failures);
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
const outputSchema = tool.outputSchema;
|
|
1154
|
-
let compatibleOutput;
|
|
1155
|
-
if (outputSchema) {
|
|
1156
|
-
try {
|
|
1157
|
-
const output = toJsonSchema(outputSchema, "output");
|
|
1158
|
-
compatibleOutput = outputSchema;
|
|
1159
|
-
if (config.schemaValidation?.requirePortableFormats) {
|
|
1160
|
-
for (const finding of findNonPortableFormats2(output, config.schemaValidation.allowFormats)) {
|
|
1161
|
-
reportIncompatible(`MCP tool "${tool.name}" — output property "${finding.path}" uses non-portable JSON Schema format "${finding.format}". Use a portable pattern/schema, or list the format in \`allowFormats\` only when every MCP client supports it.`, policy === "skip" ? "warn" : policy, config.logger, failures);
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
} catch (error) {
|
|
1165
|
-
reportIncompatible(`MCP tool "${tool.name}" — output schema is not JSON Schema-compatible: ${error instanceof Error ? error.message : String(error)}`, policy, config.logger, failures);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
prepared.push({
|
|
1169
|
-
tool: tool.tool,
|
|
1170
|
-
inputSchema,
|
|
1171
|
-
...compatibleOutput !== undefined && { outputSchema: compatibleOutput }
|
|
1172
|
-
});
|
|
1173
|
-
}
|
|
1174
|
-
if (failures.length > 0) {
|
|
1175
|
-
throw new Error(`[stitchkit] ${failures.length} problem(s) with MCP tool schemas:
|
|
1176
|
-
- ${failures.join(`
|
|
1177
|
-
- `)}`);
|
|
1178
|
-
}
|
|
1179
|
-
return prepared;
|
|
1180
|
-
}
|
|
1181
950
|
|
|
1182
|
-
export { toolSurfaceOutputSchema, applyToolViewDefaults, projectToolView,
|
|
951
|
+
export { toolSurfaceOutputSchema, applyToolViewDefaults, projectToolView, assertToolName, toToolName, assertUniqueToolName, flattenToolJsonSchema2, buildToolPresentationSchema, isObjectPresentationSchema, presentationMetadata, assertToolExtensionCompatible, projectedContractToolName, projectToolSurface };
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
isUnsafeKey
|
|
3
3
|
} from "./index-zsarb5xp.js";
|
|
4
4
|
import {
|
|
5
|
+
isPositiveSafeInteger,
|
|
5
6
|
assertPositiveSafeInteger
|
|
6
7
|
} from "./index-gr0kxymw.js";
|
|
7
8
|
import {
|
|
@@ -99,7 +100,8 @@ var TOOL_OPTION_KEYS = {
|
|
|
99
100
|
ui: true,
|
|
100
101
|
annotations: true,
|
|
101
102
|
mcp: true,
|
|
102
|
-
inputRecursionDepth: true
|
|
103
|
+
inputRecursionDepth: true,
|
|
104
|
+
inputNestingDepth: true
|
|
103
105
|
};
|
|
104
106
|
function assertNoUngroupedToolOptions(prefix, key, ep) {
|
|
105
107
|
const where = `Contract "${prefix}": endpoint "${key}"`;
|
|
@@ -120,10 +122,21 @@ function assertNoUngroupedToolOptions(prefix, key, ep) {
|
|
|
120
122
|
function assertInputRecursionDepth(where, depth) {
|
|
121
123
|
if (depth === undefined)
|
|
122
124
|
return;
|
|
123
|
-
if (
|
|
125
|
+
if (!isPositiveSafeInteger(depth)) {
|
|
124
126
|
throw new Error(`${where} must be a positive integer — the number of levels each recursive input definition is written out (got ${String(depth)})`);
|
|
125
127
|
}
|
|
126
128
|
}
|
|
129
|
+
function assertInputNestingDepth(where, depth) {
|
|
130
|
+
if (depth === undefined)
|
|
131
|
+
return;
|
|
132
|
+
if (!isPositiveSafeInteger(depth)) {
|
|
133
|
+
throw new Error(`${where} must be a positive integer — the most levels a provider accepts in one input document (got ${String(depth)})`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function assertToolDepthOptions(where, tool) {
|
|
137
|
+
assertInputRecursionDepth(`${where}.inputRecursionDepth`, tool.inputRecursionDepth);
|
|
138
|
+
assertInputNestingDepth(`${where}.inputNestingDepth`, tool.inputNestingDepth);
|
|
139
|
+
}
|
|
127
140
|
function assertNoToolOptions(where, ep) {
|
|
128
141
|
if ("tool" in ep && ep.tool !== undefined) {
|
|
129
142
|
throw new Error(`${where} cannot set tool options — it never reaches a tool transport`);
|
|
@@ -179,4 +192,4 @@ function assertResponseMetaEndpoint(prefix, key, ep) {
|
|
|
179
192
|
assertNoToolOptions(where, ep);
|
|
180
193
|
}
|
|
181
194
|
|
|
182
|
-
export { assertMultipartEndpoint, assertRawEndpoint, assertStreamingResponseEndpoint, assertNoUngroupedToolOptions, assertInputRecursionDepth, assertHeadEndpoint, assertRawBodyEndpoint, assertSafelistedBodyEndpoint, assertResponseMetaEndpoint };
|
|
195
|
+
export { assertMultipartEndpoint, assertRawEndpoint, assertStreamingResponseEndpoint, assertNoUngroupedToolOptions, assertInputRecursionDepth, assertInputNestingDepth, assertToolDepthOptions, assertHeadEndpoint, assertRawBodyEndpoint, assertSafelistedBodyEndpoint, assertResponseMetaEndpoint };
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./index-yt1gg11x.js";
|
|
4
4
|
import {
|
|
5
5
|
projectToolSurface
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-ma26mfnt.js";
|
|
7
7
|
import {
|
|
8
8
|
contractOnlyService
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-1qwd54n3.js";
|
|
10
10
|
|
|
11
11
|
// src/tools/list-names.ts
|
|
12
12
|
function listToolNames2(surface) {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES2,
|
|
9
9
|
ContractStreamFrameSchema2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-yrhw10ef.js";
|
|
11
11
|
import {
|
|
12
12
|
classifyBridgeTransportRetry,
|
|
13
13
|
RequestCancellationError,
|
|
@@ -32,6 +32,10 @@ import {
|
|
|
32
32
|
ApiError2,
|
|
33
33
|
refuseLocally
|
|
34
34
|
} from "./index-kfjkb396.js";
|
|
35
|
+
import {
|
|
36
|
+
CLIENT_ERROR_CODES2,
|
|
37
|
+
isStitchErrorCode2
|
|
38
|
+
} from "./index-7fjbdga8.js";
|
|
35
39
|
import {
|
|
36
40
|
isStreamResponse
|
|
37
41
|
} from "./index-877e9y8r.js";
|
|
@@ -785,6 +789,20 @@ async function throwForErrorResponse(res, config, fallbackBody) {
|
|
|
785
789
|
});
|
|
786
790
|
}
|
|
787
791
|
|
|
792
|
+
// src/browser/operation-refusal.ts
|
|
793
|
+
var CLIENT_CODES = new Set(CLIENT_ERROR_CODES2);
|
|
794
|
+
function readOperationRefusal(endpoint, error) {
|
|
795
|
+
if (!ApiError2.is(error))
|
|
796
|
+
return;
|
|
797
|
+
const declared = endpoint.refuses?.find((refusal) => refusal.code === error.code);
|
|
798
|
+
if (declared === undefined)
|
|
799
|
+
return isStitchErrorCode2(error.code) || CLIENT_CODES.has(error.code) ? error : undefined;
|
|
800
|
+
const schema = declared.definition.details;
|
|
801
|
+
if (schema === undefined)
|
|
802
|
+
return error;
|
|
803
|
+
return schema.safeParse(error.details).success ? error : undefined;
|
|
804
|
+
}
|
|
805
|
+
|
|
788
806
|
// src/browser/unknown-operation.ts
|
|
789
807
|
function isRoutingRefusal(error) {
|
|
790
808
|
if (error.code === "UNKNOWN_OPERATION")
|
|
@@ -882,6 +900,7 @@ function createEndpointMethod(endpoint, execute, bound) {
|
|
|
882
900
|
});
|
|
883
901
|
const method = (requestArgs) => settle(execute, readArgs(requestArgs), undefined);
|
|
884
902
|
return Object.assign(method, {
|
|
903
|
+
refusal: (error) => readOperationRefusal(endpoint, error),
|
|
885
904
|
withOptions: (...args) => {
|
|
886
905
|
refuseExtraWithOptionsArguments(endpoint, args.length, 2);
|
|
887
906
|
return settle(execute, readArgs(args[0]), readClientRequestOptions(endpoint, args[1]));
|
|
@@ -890,6 +909,7 @@ function createEndpointMethod(endpoint, execute, bound) {
|
|
|
890
909
|
}
|
|
891
910
|
const method = () => settle(execute, { ...bound.values }, undefined);
|
|
892
911
|
return Object.assign(method, {
|
|
912
|
+
refusal: (error) => readOperationRefusal(endpoint, error),
|
|
893
913
|
withOptions: (...args) => {
|
|
894
914
|
refuseExtraWithOptionsArguments(endpoint, args.length, 1);
|
|
895
915
|
return settle(execute, { ...bound.values }, readClientRequestOptions(endpoint, args[0]));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
projectToolSurface
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-ma26mfnt.js";
|
|
4
4
|
import {
|
|
5
5
|
contractToolMountable
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-5n3a8hd8.js";
|
|
7
7
|
import {
|
|
8
8
|
runtimeToolMountable
|
|
9
9
|
} from "./index-7csn6pva.js";
|
|
@@ -23,6 +23,7 @@ function collectToolSurface({
|
|
|
23
23
|
extend: collectConfig.extend,
|
|
24
24
|
flattenUnionInput: collectConfig.flattenUnionInput,
|
|
25
25
|
inputRecursionDepth: collectConfig.inputRecursionDepth,
|
|
26
|
+
inputNestingDepth: collectConfig.inputNestingDepth,
|
|
26
27
|
assertNames: collectConfig.assertNames,
|
|
27
28
|
assertUniqueNames
|
|
28
29
|
})) {
|