stitchkit 0.132.3 → 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 +172 -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/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 +8 -11
- package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/query-manager.d.ts +4 -2
- package/dist/agent-executor/claude-sdk/query-manager.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/query-options.d.ts +1 -0
- 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 +23 -3
- 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 +6 -8
- 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/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 +253 -210
- package/dist/entrypoints/agent-executor/claude-sdk.js +248 -173
- package/dist/entrypoints/agent-executor/claude.js +57 -109
- package/dist/entrypoints/agent-executor/codex.js +412 -335
- 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
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `buildClientPackage` is asked for, what it returns and how it refuses.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import type { ForbiddenModule } from './client-build.js';
|
|
6
|
+
/**
|
|
7
|
+
* Descriptive `package.json` fields of the client package. Any other field is
|
|
8
|
+
* written as given, except the ones the build derives itself — see
|
|
9
|
+
* `CLIENT_PACKAGE_OWNED_FIELDS`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ClientPackageManifestSchema: z.ZodObject<{
|
|
12
|
+
description: z.ZodOptional<z.ZodString>;
|
|
13
|
+
license: z.ZodOptional<z.ZodString>;
|
|
14
|
+
repository: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
15
|
+
type: z.ZodString;
|
|
16
|
+
url: z.ZodString;
|
|
17
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>]>>;
|
|
19
|
+
homepage: z.ZodOptional<z.ZodString>;
|
|
20
|
+
keywords: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
21
|
+
author: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
email: z.ZodOptional<z.ZodString>;
|
|
24
|
+
url: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>]>>;
|
|
26
|
+
}, z.core.$loose>;
|
|
27
|
+
/** Descriptive `package.json` fields of the client package: description, license, repository and the like. */
|
|
28
|
+
export type ClientPackageManifest = z.input<typeof ClientPackageManifestSchema>;
|
|
29
|
+
/**
|
|
30
|
+
* Manifest fields the build writes from its own options and results. One of
|
|
31
|
+
* them in `manifest` would be a second, unproven statement of the same fact.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CLIENT_PACKAGE_OWNED_FIELDS: readonly string[];
|
|
34
|
+
/** What `buildClientPackage` builds, keeps external, refuses and proves. */
|
|
35
|
+
export interface ClientPackageOptions {
|
|
36
|
+
/** The package name, bare or scoped. */
|
|
37
|
+
name: string;
|
|
38
|
+
version: string;
|
|
39
|
+
/**
|
|
40
|
+
* Package subpath → source module (`.ts` or `.tsx`). All of them are built
|
|
41
|
+
* in one pass, so a module two entries import exists once in the package.
|
|
42
|
+
*/
|
|
43
|
+
entries: Readonly<Record<'.' | `./${string}`, string>>;
|
|
44
|
+
/**
|
|
45
|
+
* The project tsconfig the declarations are emitted with. Its directory is
|
|
46
|
+
* the root every entry lies under and the place peers are resolved from.
|
|
47
|
+
*/
|
|
48
|
+
tsconfig: string;
|
|
49
|
+
/** Packages the consumer provides: kept out of the output, written as `peerDependencies`. */
|
|
50
|
+
peerDependencies?: Readonly<Record<string, string>>;
|
|
51
|
+
/** Packages installed with the client: kept out of the output, written as `dependencies`. */
|
|
52
|
+
dependencies?: Readonly<Record<string, string>>;
|
|
53
|
+
/**
|
|
54
|
+
* Modules the client must not reach, bundled or external. A bare or scoped
|
|
55
|
+
* name or subpath (`'chalk'`, `'@scope/name'`, `'stitchkit/server'`) is
|
|
56
|
+
* matched by the specifier that imports it and by its installed path; a
|
|
57
|
+
* string with a slash that names no import is a fragment of the project's own
|
|
58
|
+
* source path (`'src/terminal/'`); a `RegExp` is tested against each bundled
|
|
59
|
+
* module's absolute path.
|
|
60
|
+
*/
|
|
61
|
+
forbiddenModules?: readonly ForbiddenModule[];
|
|
62
|
+
/**
|
|
63
|
+
* The runtime the package is built for. `node` (default) is proven by
|
|
64
|
+
* importing it in Node and in Bun, `bun` in Bun; `browser` is built for
|
|
65
|
+
* browsers and imported in Bun.
|
|
66
|
+
*/
|
|
67
|
+
runtime?: 'node' | 'bun' | 'browser';
|
|
68
|
+
/** Directory the proven `<name>-<version>.tgz` is written to. */
|
|
69
|
+
outDir: string;
|
|
70
|
+
/** Further `package.json` fields; a field the build owns is refused. */
|
|
71
|
+
manifest?: ClientPackageManifest;
|
|
72
|
+
/** Extra files of the package: path inside the package → source file. */
|
|
73
|
+
files?: Readonly<Record<string, string>>;
|
|
74
|
+
/** What the installed archive must additionally satisfy. */
|
|
75
|
+
proof?: {
|
|
76
|
+
/**
|
|
77
|
+
* Consumer source files typechecked against the installed package under
|
|
78
|
+
* both module resolutions. Each imports the package by name and nothing
|
|
79
|
+
* relative.
|
|
80
|
+
*/
|
|
81
|
+
typecheck?: readonly string[];
|
|
82
|
+
/** Per subpath: names the installed package must export. */
|
|
83
|
+
exports?: Readonly<Record<string, readonly string[]>>;
|
|
84
|
+
/** Names that more than one subpath exports as deliberately different values. */
|
|
85
|
+
distinctExports?: readonly string[];
|
|
86
|
+
/**
|
|
87
|
+
* Type packages the consumer typecheck installs and loads, e.g.
|
|
88
|
+
* `'@types/node'` for a client whose declarations name Node types.
|
|
89
|
+
*/
|
|
90
|
+
types?: readonly string[];
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* The tools the build runs. `bun` and `node` default to the ones on `PATH`,
|
|
94
|
+
* `tsc` to the compiler of the `typescript` package resolved from the
|
|
95
|
+
* tsconfig's directory, run by the runtime that runs the build.
|
|
96
|
+
*/
|
|
97
|
+
executables?: {
|
|
98
|
+
bun?: string;
|
|
99
|
+
node?: string;
|
|
100
|
+
tsc?: string;
|
|
101
|
+
};
|
|
102
|
+
/** Deadline of each build, pack, install and proof step. Default 120 000 ms. */
|
|
103
|
+
timeoutMs?: number;
|
|
104
|
+
signal?: AbortSignal;
|
|
105
|
+
}
|
|
106
|
+
/** A proven client package: the archive, what is in it and what the proof ran. */
|
|
107
|
+
export interface ClientPackage {
|
|
108
|
+
/** Absolute path of the archive. */
|
|
109
|
+
tarball: string;
|
|
110
|
+
/** Lowercase hex SHA-256 of the archive. */
|
|
111
|
+
sha256: string;
|
|
112
|
+
bytes: number;
|
|
113
|
+
/** Every packed file — its path inside the package, SHA-256 and size — as installed from the archive. */
|
|
114
|
+
files: readonly {
|
|
115
|
+
path: string;
|
|
116
|
+
sha256: string;
|
|
117
|
+
bytes: number;
|
|
118
|
+
}[];
|
|
119
|
+
/** Absolute path of every source module bundled into the package. */
|
|
120
|
+
modules: readonly string[];
|
|
121
|
+
/** Per subpath: the names the installed package exports at runtime. */
|
|
122
|
+
exports: Readonly<Record<string, readonly string[]>>;
|
|
123
|
+
/** Names more than one subpath exports, each proven to be one value across them. */
|
|
124
|
+
sharedExports: readonly string[];
|
|
125
|
+
proof: {
|
|
126
|
+
/** The runtimes that imported every subpath of the installed package. */
|
|
127
|
+
runtimes: readonly ('node' | 'bun')[];
|
|
128
|
+
/** The module resolutions a strict consumer typechecked under. */
|
|
129
|
+
resolutions: readonly ('bundler' | 'NodeNext')[];
|
|
130
|
+
/** Version of the compiler that emitted the declarations and ran the typecheck. */
|
|
131
|
+
typescript: string;
|
|
132
|
+
/** Each peer and dependency the proof installed → its version. */
|
|
133
|
+
externals: Readonly<Record<string, string>>;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/** Every reason `buildClientPackage` refuses with. */
|
|
137
|
+
export declare const ClientPackageRefusalSchema: z.ZodEnum<{
|
|
138
|
+
build: "build";
|
|
139
|
+
"bundled-peer": "bundled-peer";
|
|
140
|
+
"declaration-dependency": "declaration-dependency";
|
|
141
|
+
"declaration-unresolved": "declaration-unresolved";
|
|
142
|
+
declarations: "declarations";
|
|
143
|
+
install: "install";
|
|
144
|
+
"manifest-owned-field": "manifest-owned-field";
|
|
145
|
+
"missing-export": "missing-export";
|
|
146
|
+
"peer-range": "peer-range";
|
|
147
|
+
"shared-export-split": "shared-export-split";
|
|
148
|
+
typecheck: "typecheck";
|
|
149
|
+
}>;
|
|
150
|
+
/** The refusal of a client package; switch on `reason`, never on the message. */
|
|
151
|
+
export declare class ClientPackageError extends Error {
|
|
152
|
+
/** Why the build refused: one of the reasons in the list above. */
|
|
153
|
+
readonly reason: z.infer<typeof ClientPackageRefusalSchema>;
|
|
154
|
+
/** What the refusal is about: the file, specifier, package or names, and a tool's output. */
|
|
155
|
+
readonly details: Readonly<Record<string, unknown>>;
|
|
156
|
+
constructor(
|
|
157
|
+
/** Why the build refused: one of the reasons in the list above. */
|
|
158
|
+
reason: z.infer<typeof ClientPackageRefusalSchema>, message: string,
|
|
159
|
+
/** What the refusal is about: the file, specifier, package or names, and a tool's output. */
|
|
160
|
+
details?: Readonly<Record<string, unknown>>, options?: ErrorOptions);
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=client-package-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-package-contract.d.ts","sourceRoot":"","sources":["../../src/files/client-package-contract.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ClientBuildStep, type ClientToolCommand } from './client-build.js';
|
|
2
|
+
import { type ClientPackage, type ClientPackageOptions } from './client-package-contract.js';
|
|
3
|
+
/** Where a package the build leaves outside is installed, and which version that is. */
|
|
4
|
+
export interface ExternalPackage {
|
|
5
|
+
/** Real path of the installed package. */
|
|
6
|
+
directory: string;
|
|
7
|
+
version: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Find a package the way a module in `from` would: the nearest
|
|
11
|
+
* `node_modules/<name>` up the tree. The real path is returned, so a linked or
|
|
12
|
+
* workspace package is known by where its code actually is.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveExternalPackage(from: string, name: string): Promise<ExternalPackage>;
|
|
15
|
+
/** What the proof needs from the build. */
|
|
16
|
+
export interface ClientPackageProofInput {
|
|
17
|
+
options: ClientPackageOptions;
|
|
18
|
+
step: ClientBuildStep;
|
|
19
|
+
tools: {
|
|
20
|
+
bun: string;
|
|
21
|
+
node: string;
|
|
22
|
+
tsc: ClientToolCommand;
|
|
23
|
+
};
|
|
24
|
+
/** An empty directory the consumer is created in. */
|
|
25
|
+
consumer: string;
|
|
26
|
+
/** The staged package directory the archive was packed from. */
|
|
27
|
+
staged: string;
|
|
28
|
+
tarball: string;
|
|
29
|
+
/** Every peer and dependency → where the build resolved it. */
|
|
30
|
+
externals: ReadonlyMap<string, ExternalPackage>;
|
|
31
|
+
/** The project directory type packages are resolved from. */
|
|
32
|
+
root: string;
|
|
33
|
+
}
|
|
34
|
+
type ProvenPackage = Pick<ClientPackage, 'files' | 'exports' | 'sharedExports' | 'proof'>;
|
|
35
|
+
/** Prove the packed archive; every refusal is a `ClientPackageError`. */
|
|
36
|
+
export declare function proveClientPackage(input: ClientPackageProofInput): Promise<ProvenPackage>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=client-package-proof.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-package-proof.d.ts","sourceRoot":"","sources":["../../src/files/client-package-proof.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAGvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAID;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC,CAkB1B;AAyDD,2CAA2C;AAC3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,iBAAiB,CAAA;KAAE,CAAC;IAC7D,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAChD,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,KAAK,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,SAAS,GAAG,eAAe,GAAG,OAAO,CAAC,CAAC;AA+O1F,yEAAyE;AACzE,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAgBxB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ClientPackage, type ClientPackageOptions } from './client-package-contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build a typed client as an npm package and prove the packed archive.
|
|
4
|
+
*
|
|
5
|
+
* Every entry is built in one pass over one module graph, with peers and
|
|
6
|
+
* dependencies left outside; declarations are emitted for that graph and
|
|
7
|
+
* rewritten to resolve under both Bundler and NodeNext resolution; the archive
|
|
8
|
+
* is then installed into an empty directory beside its peers, every subpath is
|
|
9
|
+
* imported in each runtime, a name several subpaths export is checked to be one
|
|
10
|
+
* value, and a strict consumer is typechecked under both resolutions.
|
|
11
|
+
*
|
|
12
|
+
* A refusal is a `ClientPackageError` with a `reason`, or a
|
|
13
|
+
* `ForbiddenModuleError`. No archive is left at the output path when the build
|
|
14
|
+
* or the proof refuses: one from an earlier build is removed first.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildClientPackage(options: ClientPackageOptions): Promise<ClientPackage>;
|
|
17
|
+
//# sourceMappingURL=client-package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-package.d.ts","sourceRoot":"","sources":["../../src/files/client-package.ts"],"names":[],"mappings":"AA8BA,OAAO,EAEL,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAgNnC;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAsFxB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** One module named by a declaration file. `start`–`end` is the specifier text between its quotes. */
|
|
2
|
+
export interface DeclarationSpecifier {
|
|
3
|
+
/** How it is named: an import or export, or a `/// <reference path|types>` directive. */
|
|
4
|
+
kind: 'module' | 'reference-path' | 'reference-types';
|
|
5
|
+
text: string;
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
}
|
|
9
|
+
/** Every module specifier and reference directive in one declaration file, in source order. */
|
|
10
|
+
export declare function declarationSpecifiers(source: string): DeclarationSpecifier[];
|
|
11
|
+
/** Whether a specifier is relative to the file that names it. */
|
|
12
|
+
export declare function isRelativeSpecifier(specifier: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The specifier of the JavaScript file a relative declaration import stands
|
|
15
|
+
* for, resolved against the emitted tree `file` is part of: `./x` and `./x.ts`
|
|
16
|
+
* become `./x.js`, a directory becomes its `index.js`. `undefined` when the
|
|
17
|
+
* tree holds no declaration for it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function declarationOutputSpecifier(file: string, specifier: string): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Rewrite a declaration tree in place. `rewrite` sees every specifier of
|
|
22
|
+
* every declaration file and returns the text it should carry, or `undefined`
|
|
23
|
+
* to leave it; it refuses a specifier by throwing. Returns how many files and
|
|
24
|
+
* specifiers changed.
|
|
25
|
+
*/
|
|
26
|
+
export declare function rewriteDeclarationTree(directory: string, rewrite: (specifier: DeclarationSpecifier, file: string) => string | undefined): {
|
|
27
|
+
files: number;
|
|
28
|
+
specifiers: number;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=declaration-specifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration-specifiers.d.ts","sourceRoot":"","sources":["../../src/files/declaration-specifiers.ts"],"names":[],"mappings":"AAqBA,sGAAsG;AACtG,MAAM,WAAW,oBAAoB;IACnC,yFAAyF;IACzF,IAAI,EAAE,QAAQ,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAgID,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAa5E;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE9D;AAcD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAapB;AAYD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,SAAS,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC7E;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAoBvC"}
|
|
@@ -10,23 +10,25 @@ import {
|
|
|
10
10
|
parseToolCallArguments,
|
|
11
11
|
toolResultFromError,
|
|
12
12
|
observed
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-6kmjcm81.js";
|
|
14
14
|
import {
|
|
15
15
|
toolSurfaceOutputSchema,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
validateResolvedInputRounds,
|
|
19
|
-
presentationMetadata,
|
|
20
|
-
prepareProjectedMcpTools
|
|
21
|
-
} from "./index-669374qc.js";
|
|
16
|
+
presentationMetadata
|
|
17
|
+
} from "./index-ma26mfnt.js";
|
|
22
18
|
import {
|
|
23
19
|
collectTools2,
|
|
24
20
|
createToolRunner,
|
|
25
21
|
formatToolError
|
|
26
|
-
} from "./index-
|
|
22
|
+
} from "./index-5n3a8hd8.js";
|
|
27
23
|
import {
|
|
28
24
|
publishedToolAnnotations
|
|
29
25
|
} from "./index-0x4mnwg5.js";
|
|
26
|
+
import {
|
|
27
|
+
staticInputRounds,
|
|
28
|
+
validateMcpRoundPolicy,
|
|
29
|
+
validateResolvedInputRounds,
|
|
30
|
+
prepareProjectedMcpTools
|
|
31
|
+
} from "./index-2dzc7mv9.js";
|
|
30
32
|
import {
|
|
31
33
|
markProtocolOutcome
|
|
32
34
|
} from "./index-cfnmvcq8.js";
|
|
@@ -54,7 +56,7 @@ import {
|
|
|
54
56
|
} from "./index-tazm4dxf.js";
|
|
55
57
|
import {
|
|
56
58
|
collectToolSurface
|
|
57
|
-
} from "./index-
|
|
59
|
+
} from "./index-q427q23r.js";
|
|
58
60
|
import {
|
|
59
61
|
runWithRequestContext2,
|
|
60
62
|
getRequestContext2
|
|
@@ -64,7 +66,7 @@ import {
|
|
|
64
66
|
} from "./index-7csn6pva.js";
|
|
65
67
|
import {
|
|
66
68
|
AppError2
|
|
67
|
-
} from "./index-
|
|
69
|
+
} from "./index-7fjbdga8.js";
|
|
68
70
|
import {
|
|
69
71
|
compareCodeUnits,
|
|
70
72
|
serializeCanonicalJson
|
|
@@ -201,6 +203,9 @@ function prepareMcpTools(tools, config = {}) {
|
|
|
201
203
|
...mountable.method.inputRecursionDepth !== undefined && {
|
|
202
204
|
inputRecursionDepth: mountable.method.inputRecursionDepth
|
|
203
205
|
},
|
|
206
|
+
...mountable.method.inputNestingDepth !== undefined && {
|
|
207
|
+
inputNestingDepth: mountable.method.inputNestingDepth
|
|
208
|
+
},
|
|
204
209
|
...outputSchema !== undefined && { outputSchema },
|
|
205
210
|
shouldExtend: mountable.shouldExtend,
|
|
206
211
|
...mountable.method.mcp !== undefined && { mcp: mountable.method.mcp }
|
|
@@ -225,7 +230,8 @@ function prepareMcpServerSurface(surface, config = {}) {
|
|
|
225
230
|
transport: "MCP",
|
|
226
231
|
extend: config.extend,
|
|
227
232
|
flattenUnionInput: config.flattenUnionInput,
|
|
228
|
-
inputRecursionDepth: config.inputRecursionDepth
|
|
233
|
+
inputRecursionDepth: config.inputRecursionDepth,
|
|
234
|
+
inputNestingDepth: config.inputNestingDepth
|
|
229
235
|
})) {
|
|
230
236
|
if (entry.kind === "contract") {
|
|
231
237
|
contractMountables.push(entry.mountable);
|
|
@@ -238,6 +244,7 @@ function prepareMcpServerSurface(surface, config = {}) {
|
|
|
238
244
|
const runtimeDescriptors = prepareMcpTools(runtimeMountables, {
|
|
239
245
|
flattenUnionInput: config.flattenUnionInput,
|
|
240
246
|
inputRecursionDepth: config.inputRecursionDepth,
|
|
247
|
+
inputNestingDepth: config.inputNestingDepth,
|
|
241
248
|
schemaValidation: config.schemaValidation,
|
|
242
249
|
logger: config.logger,
|
|
243
250
|
multiRound: config.multiRound
|
|
@@ -787,21 +794,21 @@ function applyMcpLazyDiscovery(input) {
|
|
|
787
794
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
788
795
|
handler: ({ input: args }) => {
|
|
789
796
|
const cap = Math.min(args.limit ?? discovery.maxResults, discovery.maxResults);
|
|
790
|
-
const
|
|
797
|
+
const toEnable = rankToolsByQuery(args.query, hiddenTools.filter((entry) => !entry.registered.enabled)).slice(0, cap);
|
|
798
|
+
const alreadyEnabled = rankToolsByQuery(args.query, hiddenTools.filter((entry) => entry.registered.enabled)).slice(0, cap);
|
|
791
799
|
const enabledTools = [];
|
|
792
800
|
const matches = [];
|
|
793
|
-
for (const entry of
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
801
|
+
for (const entry of toEnable) {
|
|
802
|
+
entry.registered.enabled = true;
|
|
803
|
+
enabledTools.push(entry.name);
|
|
804
|
+
matches.push({ name: entry.name, description: entry.description, newlyEnabled: true });
|
|
805
|
+
}
|
|
806
|
+
for (const entry of alreadyEnabled)
|
|
799
807
|
matches.push({
|
|
800
808
|
name: entry.name,
|
|
801
809
|
description: entry.description,
|
|
802
|
-
newlyEnabled
|
|
810
|
+
newlyEnabled: false
|
|
803
811
|
});
|
|
804
|
-
}
|
|
805
812
|
if (enabledTools.length > 0) {
|
|
806
813
|
server.sendToolListChanged();
|
|
807
814
|
}
|
|
@@ -832,6 +839,7 @@ function validateMcpSchemas2(config) {
|
|
|
832
839
|
extend: config.extend,
|
|
833
840
|
flattenUnionInput: config.flattenUnionInput,
|
|
834
841
|
inputRecursionDepth: config.inputRecursionDepth,
|
|
842
|
+
inputNestingDepth: config.inputNestingDepth,
|
|
835
843
|
schemaValidation: config,
|
|
836
844
|
logger: config.logger
|
|
837
845
|
});
|
|
@@ -842,6 +850,7 @@ function mountMcp2(mcpServer, services, config) {
|
|
|
842
850
|
extend: config.extend,
|
|
843
851
|
flattenUnionInput: config.flattenUnionInput,
|
|
844
852
|
inputRecursionDepth: config.inputRecursionDepth,
|
|
853
|
+
inputNestingDepth: config.inputNestingDepth,
|
|
845
854
|
schemaValidation: config.schemaValidation,
|
|
846
855
|
logger: config.logger
|
|
847
856
|
});
|
|
@@ -853,6 +862,7 @@ function mountMcp2(mcpServer, services, config) {
|
|
|
853
862
|
function mountPreparedMcp(mcpServer, prepared, config) {
|
|
854
863
|
const lifecycle = resolveToolAccess("mountPreparedMcp", config);
|
|
855
864
|
const validatedDiscovery = config.discovery !== undefined ? validateMcpLazyDiscovery(config.discovery, prepared.map((descriptor) => descriptor.mountable.name), config.reservedToolNames) : undefined;
|
|
865
|
+
const catalog = validatedDiscovery === undefined ? config.catalog : undefined;
|
|
856
866
|
const runTool = createToolRunner({
|
|
857
867
|
source: "mcp",
|
|
858
868
|
toolSurface: true,
|
|
@@ -873,7 +883,7 @@ function mountPreparedMcp(mcpServer, prepared, config) {
|
|
|
873
883
|
}, descriptor, {
|
|
874
884
|
runTool,
|
|
875
885
|
formatResult: (result, mode, toolName) => formatMcpResult(result, mode, toolName, config.errorHint),
|
|
876
|
-
catalog
|
|
886
|
+
catalog,
|
|
877
887
|
multiRoundRuntime: config.multiRoundRuntime,
|
|
878
888
|
hooks: config.hooks,
|
|
879
889
|
lifecycle,
|
|
@@ -889,7 +899,7 @@ function mountPreparedMcp(mcpServer, prepared, config) {
|
|
|
889
899
|
lifecycle,
|
|
890
900
|
hooks: config.hooks,
|
|
891
901
|
context: config.context,
|
|
892
|
-
catalog
|
|
902
|
+
catalog,
|
|
893
903
|
coerceJsonArgs: config.coerceJsonArgs,
|
|
894
904
|
errorHint: config.errorHint,
|
|
895
905
|
onOutputStrip: config.onOutputStrip
|
|
@@ -920,6 +930,7 @@ function buildMcpServer2(config, auth) {
|
|
|
920
930
|
extend: config.extend,
|
|
921
931
|
flattenUnionInput: config.flattenUnionInput,
|
|
922
932
|
inputRecursionDepth: config.inputRecursionDepth,
|
|
933
|
+
inputNestingDepth: config.inputNestingDepth,
|
|
923
934
|
schemaValidation: config.schemaValidation,
|
|
924
935
|
logger: config.logger,
|
|
925
936
|
multiRound: {
|
|
@@ -963,7 +974,7 @@ function buildMcpServerFromPrepared(config, auth, prepared) {
|
|
|
963
974
|
const server = new McpServer(config.serverInfo, serverOptions);
|
|
964
975
|
const context = config.context?.(auth);
|
|
965
976
|
const catalog = mcpCatalogStamp(prepared);
|
|
966
|
-
if (!config.rawTools)
|
|
977
|
+
if (!config.rawTools && config.discovery === undefined)
|
|
967
978
|
servedCatalogs.set(server, catalog);
|
|
968
979
|
mountPreparedMcp(server, prepared.contractTools, {
|
|
969
980
|
catalog,
|
|
@@ -976,6 +987,7 @@ function buildMcpServerFromPrepared(config, auth, prepared) {
|
|
|
976
987
|
coerceJsonArgs: config.coerceJsonArgs,
|
|
977
988
|
flattenUnionInput: config.flattenUnionInput,
|
|
978
989
|
inputRecursionDepth: config.inputRecursionDepth,
|
|
990
|
+
inputNestingDepth: config.inputNestingDepth,
|
|
979
991
|
errorHint: config.errorHint,
|
|
980
992
|
onOutputStrip: config.onOutputStrip,
|
|
981
993
|
discovery: config.discovery,
|
|
@@ -1043,6 +1055,7 @@ function prepareStaticSurface(config) {
|
|
|
1043
1055
|
extend: config.extend,
|
|
1044
1056
|
flattenUnionInput: config.flattenUnionInput,
|
|
1045
1057
|
inputRecursionDepth: config.inputRecursionDepth,
|
|
1058
|
+
inputNestingDepth: config.inputNestingDepth,
|
|
1046
1059
|
schemaValidation: config.schemaValidation,
|
|
1047
1060
|
multiRound: {
|
|
1048
1061
|
stateConfigured: config.multiRound !== undefined,
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
toolResultFromError,
|
|
8
8
|
toolCauseFromResult,
|
|
9
9
|
isToolExecutionControlError2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-6kmjcm81.js";
|
|
11
11
|
import {
|
|
12
12
|
createToolRunner,
|
|
13
13
|
formatToolError
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-5n3a8hd8.js";
|
|
15
15
|
import {
|
|
16
16
|
resolveRuntimeToolCall
|
|
17
17
|
} from "./index-eh71zr32.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./index-1psbyyhj.js";
|
|
21
21
|
import {
|
|
22
22
|
collectToolSurface
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-q427q23r.js";
|
|
24
24
|
import {
|
|
25
25
|
agentPresenterOf
|
|
26
26
|
} from "./index-7csn6pva.js";
|
|
@@ -53,7 +53,8 @@ function mountAgent2(services, config) {
|
|
|
53
53
|
transport: "AGENT",
|
|
54
54
|
extend: config.extend,
|
|
55
55
|
flattenUnionInput: config.flattenUnionInput,
|
|
56
|
-
inputRecursionDepth: config.inputRecursionDepth
|
|
56
|
+
inputRecursionDepth: config.inputRecursionDepth,
|
|
57
|
+
inputNestingDepth: config.inputNestingDepth
|
|
57
58
|
})) {
|
|
58
59
|
const { mountable } = entry;
|
|
59
60
|
const inputSchema = jsonSchema(mountable.presentationSchema, {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveToolAccess,
|
|
3
3
|
toolErrorFromResult
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-6kmjcm81.js";
|
|
5
5
|
import {
|
|
6
6
|
assertUniqueToolName
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-ma26mfnt.js";
|
|
8
8
|
import {
|
|
9
9
|
collectTools2,
|
|
10
10
|
createToolRunner
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-5n3a8hd8.js";
|
|
12
12
|
import {
|
|
13
13
|
AppError2
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-7fjbdga8.js";
|
|
15
15
|
import {
|
|
16
16
|
isRecord
|
|
17
17
|
} from "./index-ps3djm8d.js";
|
|
@@ -25,7 +25,8 @@ function createToolInvoker2(services, config) {
|
|
|
25
25
|
for (const tool of collectTools2(service, config.transport, {
|
|
26
26
|
extend: config.extend,
|
|
27
27
|
flattenUnionInput: config.flattenUnionInput,
|
|
28
|
-
inputRecursionDepth: config.inputRecursionDepth
|
|
28
|
+
inputRecursionDepth: config.inputRecursionDepth,
|
|
29
|
+
inputNestingDepth: config.inputNestingDepth
|
|
29
30
|
})) {
|
|
30
31
|
assertUniqueToolName(tool.name, tools.has(tool.name), "in-process tool name");
|
|
31
32
|
tools.set(tool.name, tool);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
contractMethodFields
|
|
3
|
-
|
|
2
|
+
contractMethodFields,
|
|
3
|
+
withDeclaredRefusals
|
|
4
|
+
} from "./index-6918kxbf.js";
|
|
4
5
|
import {
|
|
5
6
|
AppError2
|
|
6
|
-
} from "./index-
|
|
7
|
+
} from "./index-7fjbdga8.js";
|
|
7
8
|
import {
|
|
8
9
|
typedEntries,
|
|
9
10
|
callRuntimeHandler
|
|
@@ -96,12 +97,12 @@ function bindContract(contract, handlers, options) {
|
|
|
96
97
|
methods[String(key)] = {
|
|
97
98
|
...contractMethodFields(contract, String(key), endpoint),
|
|
98
99
|
multipartReceivers: streamingHandler?.receivers,
|
|
99
|
-
handler: streamingHandler ? (ctx) => streamingHandler.execute(ctx, ctx.files ?? {}) : (ctx) => {
|
|
100
|
+
handler: withDeclaredRefusals(endpoint, `${contract.meta.prefix}.${String(key)}`, streamingHandler ? (ctx) => streamingHandler.execute(ctx, ctx.files ?? {}) : (ctx) => {
|
|
100
101
|
if (!regularHandler) {
|
|
101
102
|
throw new Error(`[stitchkit] implement: missing handler for "${contract.meta.prefix}.${String(key)}"`);
|
|
102
103
|
}
|
|
103
104
|
return callRuntimeHandler(regularHandler, ctx);
|
|
104
|
-
}
|
|
105
|
+
})
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
return {
|