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,174 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toJsonSchema
|
|
3
|
+
} from "./index-ngwf1s3c.js";
|
|
4
|
+
import {
|
|
5
|
+
toolSurfaceOutputSchema,
|
|
6
|
+
assertUniqueToolName,
|
|
7
|
+
buildToolPresentationSchema,
|
|
8
|
+
isObjectPresentationSchema
|
|
9
|
+
} from "./index-ma26mfnt.js";
|
|
10
|
+
import {
|
|
11
|
+
findNonPortableFormats2,
|
|
12
|
+
findUntypedProperties2
|
|
13
|
+
} from "./index-k9g061ma.js";
|
|
14
|
+
|
|
15
|
+
// src/tools/mcp/round-policy.ts
|
|
16
|
+
function staticInputRounds(policy) {
|
|
17
|
+
return Array.isArray(policy.inputRequired) ? policy.inputRequired : undefined;
|
|
18
|
+
}
|
|
19
|
+
function validateMcpRoundPolicy(tool, policy, runtime) {
|
|
20
|
+
if (!runtime?.stateConfigured) {
|
|
21
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares inputRequired but no multiRound.state key is configured`);
|
|
22
|
+
}
|
|
23
|
+
const { maxRounds } = runtime;
|
|
24
|
+
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
25
|
+
throw new Error("[stitchkit] multiRound.serving.maxRounds must be a positive integer");
|
|
26
|
+
}
|
|
27
|
+
const declared = staticInputRounds(policy);
|
|
28
|
+
if (!declared)
|
|
29
|
+
return;
|
|
30
|
+
if (declared.length === 0) {
|
|
31
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" must declare at least one input round`);
|
|
32
|
+
}
|
|
33
|
+
assertRoundShape(tool, declared, maxRounds);
|
|
34
|
+
}
|
|
35
|
+
function validateResolvedInputRounds(tool, resolved, maxRounds) {
|
|
36
|
+
assertRoundShape(tool, resolved, maxRounds);
|
|
37
|
+
}
|
|
38
|
+
function assertRoundShape(tool, rounds, maxRounds) {
|
|
39
|
+
if (rounds.length > maxRounds) {
|
|
40
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares ${rounds.length} input rounds, exceeding maxRounds ${maxRounds}`);
|
|
41
|
+
}
|
|
42
|
+
const keys = new Set;
|
|
43
|
+
for (const request of rounds) {
|
|
44
|
+
if (keys.has(request.key)) {
|
|
45
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares duplicate input key "${request.key}"`);
|
|
46
|
+
}
|
|
47
|
+
keys.add(request.key);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/tools/internal/mcp-projection.ts
|
|
52
|
+
function mcpProjectionCandidate(tool) {
|
|
53
|
+
if (tool.kind === "contract") {
|
|
54
|
+
return {
|
|
55
|
+
tool,
|
|
56
|
+
name: tool.name,
|
|
57
|
+
...tool.source.paramsSchema !== undefined && {
|
|
58
|
+
paramsSchema: tool.source.paramsSchema
|
|
59
|
+
},
|
|
60
|
+
...tool.source.inputSchema !== undefined && {
|
|
61
|
+
inputSchema: tool.source.inputSchema
|
|
62
|
+
},
|
|
63
|
+
...tool.source.toolView?.defaults !== undefined && {
|
|
64
|
+
inputDefaults: tool.source.toolView.defaults
|
|
65
|
+
},
|
|
66
|
+
...tool.source.inputRecursionDepth !== undefined && {
|
|
67
|
+
inputRecursionDepth: tool.source.inputRecursionDepth
|
|
68
|
+
},
|
|
69
|
+
...tool.source.inputNestingDepth !== undefined && {
|
|
70
|
+
inputNestingDepth: tool.source.inputNestingDepth
|
|
71
|
+
},
|
|
72
|
+
...toolSurfaceOutputSchema(tool.source) !== undefined && {
|
|
73
|
+
outputSchema: toolSurfaceOutputSchema(tool.source)
|
|
74
|
+
},
|
|
75
|
+
shouldExtend: tool.shouldExtend,
|
|
76
|
+
...tool.mcp !== undefined && { mcp: tool.mcp }
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
tool,
|
|
81
|
+
name: tool.name,
|
|
82
|
+
inputSchema: tool.source.input,
|
|
83
|
+
...tool.source.output !== undefined && { outputSchema: tool.source.output },
|
|
84
|
+
shouldExtend: false,
|
|
85
|
+
...tool.mcp !== undefined && { mcp: tool.mcp }
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function reportIncompatible(message, policy, logger, failures) {
|
|
89
|
+
if (policy === "throw")
|
|
90
|
+
failures.push(message);
|
|
91
|
+
else if (policy === "warn") {
|
|
92
|
+
if (logger)
|
|
93
|
+
logger.warn(`[stitchkit] ${message}`);
|
|
94
|
+
else
|
|
95
|
+
console.warn(`[stitchkit] ${message}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function prepareProjectedMcpTools(tools, config = {}) {
|
|
99
|
+
const policy = config.schemaValidation?.policy ?? "throw";
|
|
100
|
+
const failures = [];
|
|
101
|
+
const prepared = [];
|
|
102
|
+
const names = new Set;
|
|
103
|
+
for (const tool of tools) {
|
|
104
|
+
assertUniqueToolName(tool.name, names.has(tool.name), "MCP tool name");
|
|
105
|
+
names.add(tool.name);
|
|
106
|
+
if (tool.mcp)
|
|
107
|
+
validateMcpRoundPolicy(tool, tool.mcp, config.multiRound);
|
|
108
|
+
let inputSchema;
|
|
109
|
+
const openedByNestingLimit = new Set;
|
|
110
|
+
try {
|
|
111
|
+
inputSchema = buildToolPresentationSchema({
|
|
112
|
+
onInputNestingOpened: (path) => openedByNestingLimit.add(path),
|
|
113
|
+
paramsSchema: tool.paramsSchema,
|
|
114
|
+
inputSchema: tool.inputSchema,
|
|
115
|
+
extendSchema: tool.shouldExtend && config.extend ? config.extend.schema : undefined,
|
|
116
|
+
flattenUnionInput: config.flattenUnionInput,
|
|
117
|
+
inputRecursionDepth: tool.inputRecursionDepth ?? config.inputRecursionDepth,
|
|
118
|
+
inputNestingDepth: tool.inputNestingDepth ?? config.inputNestingDepth,
|
|
119
|
+
unrepresentable: "throw",
|
|
120
|
+
defaults: tool.inputDefaults
|
|
121
|
+
});
|
|
122
|
+
} catch (error) {
|
|
123
|
+
reportIncompatible(`MCP tool "${tool.name}" — input schema is not JSON Schema-compatible: ${error instanceof Error ? error.message : String(error)}`, policy, config.logger, failures);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (!isObjectPresentationSchema(inputSchema)) {
|
|
127
|
+
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);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (config.schemaValidation?.requireTypedProperties) {
|
|
131
|
+
const allowed = new Set(config.schemaValidation.allowUntyped ?? []);
|
|
132
|
+
for (const untyped of findUntypedProperties2(inputSchema)) {
|
|
133
|
+
const path = `${tool.name}.${untyped.path}`;
|
|
134
|
+
if (allowed.has(path) || openedByNestingLimit.has(untyped.path))
|
|
135
|
+
continue;
|
|
136
|
+
const clue = untyped.description ? ` (only a description: "${untyped.description}")` : "";
|
|
137
|
+
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);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (config.schemaValidation?.requirePortableFormats) {
|
|
141
|
+
for (const finding of findNonPortableFormats2(inputSchema, config.schemaValidation.allowFormats)) {
|
|
142
|
+
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);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const outputSchema = tool.outputSchema;
|
|
146
|
+
let compatibleOutput;
|
|
147
|
+
if (outputSchema) {
|
|
148
|
+
try {
|
|
149
|
+
const output = toJsonSchema(outputSchema, "output");
|
|
150
|
+
compatibleOutput = outputSchema;
|
|
151
|
+
if (config.schemaValidation?.requirePortableFormats) {
|
|
152
|
+
for (const finding of findNonPortableFormats2(output, config.schemaValidation.allowFormats)) {
|
|
153
|
+
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);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
} catch (error) {
|
|
157
|
+
reportIncompatible(`MCP tool "${tool.name}" — output schema is not JSON Schema-compatible: ${error instanceof Error ? error.message : String(error)}`, policy, config.logger, failures);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
prepared.push({
|
|
161
|
+
tool: tool.tool,
|
|
162
|
+
inputSchema,
|
|
163
|
+
...compatibleOutput !== undefined && { outputSchema: compatibleOutput }
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (failures.length > 0) {
|
|
167
|
+
throw new Error(`[stitchkit] ${failures.length} problem(s) with MCP tool schemas:
|
|
168
|
+
- ${failures.join(`
|
|
169
|
+
- `)}`);
|
|
170
|
+
}
|
|
171
|
+
return prepared;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export { staticInputRounds, validateMcpRoundPolicy, validateResolvedInputRounds, mcpProjectionCandidate, prepareProjectedMcpTools };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runNativeCommand2
|
|
3
|
+
} from "./index-d04w81fz.js";
|
|
4
|
+
|
|
5
|
+
// src/service-host/macos/runner.ts
|
|
6
|
+
import { realpath } from "node:fs/promises";
|
|
7
|
+
import { posix } from "node:path";
|
|
8
|
+
var CODESIGN_PATH2 = "/usr/bin/codesign";
|
|
9
|
+
var SECURITY_PATH2 = "/usr/bin/security";
|
|
10
|
+
var CLANG_PATH2 = "/usr/bin/clang";
|
|
11
|
+
var SIPS_PATH2 = "/usr/bin/sips";
|
|
12
|
+
var QLMANAGE_PATH2 = "/usr/bin/qlmanage";
|
|
13
|
+
var ICONUTIL_PATH2 = "/usr/bin/iconutil";
|
|
14
|
+
var PS_PATH2 = "/bin/ps";
|
|
15
|
+
var DEFAULT_TIMEOUT_MS = 60000;
|
|
16
|
+
var DEFAULT_MAX_OUTPUT_BYTES = 16 * 1024 * 1024;
|
|
17
|
+
var MAX_STREAMED_STDERR_BYTES = 64 * 1024;
|
|
18
|
+
var MACOS_COMMAND_PATH = "/usr/bin:/bin:/usr/sbin:/sbin";
|
|
19
|
+
var MACOS_COMMAND_KEYS = [
|
|
20
|
+
"HOME",
|
|
21
|
+
"TMPDIR",
|
|
22
|
+
"DEVELOPER_DIR",
|
|
23
|
+
"SDKROOT",
|
|
24
|
+
"TOOLCHAINS"
|
|
25
|
+
];
|
|
26
|
+
function macosCommandEnv(extra) {
|
|
27
|
+
const env = { PATH: MACOS_COMMAND_PATH };
|
|
28
|
+
for (const key of MACOS_COMMAND_KEYS) {
|
|
29
|
+
const value = process.env[key];
|
|
30
|
+
if (value !== undefined)
|
|
31
|
+
env[key] = value;
|
|
32
|
+
}
|
|
33
|
+
return { ...env, ...extra };
|
|
34
|
+
}
|
|
35
|
+
function createDefaultMacosCommandRunner2() {
|
|
36
|
+
const decoder = new TextDecoder;
|
|
37
|
+
return {
|
|
38
|
+
async runCommand(executable, args, options) {
|
|
39
|
+
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
40
|
+
const env = macosCommandEnv(options?.env);
|
|
41
|
+
if (options?.onOutput !== undefined) {
|
|
42
|
+
const sink = options.onOutput;
|
|
43
|
+
const stderrChunks = [];
|
|
44
|
+
let stderrBytes = 0;
|
|
45
|
+
const result = await runNativeCommand2({
|
|
46
|
+
executable,
|
|
47
|
+
args: [...args],
|
|
48
|
+
envPolicy: "declared-only",
|
|
49
|
+
env,
|
|
50
|
+
capture: false,
|
|
51
|
+
timeoutMs,
|
|
52
|
+
...options.maxOutputBytes !== undefined ? { maxOutputBytes: options.maxOutputBytes } : {},
|
|
53
|
+
...options.stdin !== undefined ? { stdin: options.stdin } : {},
|
|
54
|
+
...options.cwd !== undefined ? { cwd: options.cwd } : {},
|
|
55
|
+
async onOutput(bytes, channel) {
|
|
56
|
+
if (channel === "stderr" && stderrBytes < MAX_STREAMED_STDERR_BYTES) {
|
|
57
|
+
const remaining = MAX_STREAMED_STDERR_BYTES - stderrBytes;
|
|
58
|
+
const slice = bytes.byteLength <= remaining ? bytes : bytes.subarray(0, remaining);
|
|
59
|
+
stderrChunks.push(slice.slice());
|
|
60
|
+
stderrBytes += slice.byteLength;
|
|
61
|
+
}
|
|
62
|
+
await sink(bytes, channel);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const stderrCombined = new Uint8Array(stderrBytes);
|
|
66
|
+
let offset = 0;
|
|
67
|
+
for (const chunk of stderrChunks) {
|
|
68
|
+
stderrCombined.set(chunk, offset);
|
|
69
|
+
offset += chunk.byteLength;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
exitCode: result.exitCode ?? 1,
|
|
73
|
+
stdout: "",
|
|
74
|
+
stderr: decoder.decode(stderrCombined)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const result = await runNativeCommand2({
|
|
78
|
+
executable,
|
|
79
|
+
args: [...args],
|
|
80
|
+
envPolicy: "declared-only",
|
|
81
|
+
env,
|
|
82
|
+
capture: true,
|
|
83
|
+
maxOutputBytes: options?.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES,
|
|
84
|
+
timeoutMs,
|
|
85
|
+
...options?.stdin !== undefined ? { stdin: options.stdin } : {},
|
|
86
|
+
...options?.cwd !== undefined ? { cwd: options.cwd } : {}
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
exitCode: result.exitCode ?? 1,
|
|
90
|
+
stdout: decoder.decode(result.stdout),
|
|
91
|
+
stderr: decoder.decode(result.stderr)
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function normalizeMacosSyntheticPath2(targetPath) {
|
|
97
|
+
const normalized = posix.normalize(targetPath).replace(/\/+$/, "");
|
|
98
|
+
if (normalized.length === 0)
|
|
99
|
+
return "/";
|
|
100
|
+
const lowered = normalized.toLowerCase();
|
|
101
|
+
if (lowered === "/var" || lowered.startsWith("/var/") || lowered === "/tmp" || lowered.startsWith("/tmp/") || lowered === "/etc" || lowered.startsWith("/etc/")) {
|
|
102
|
+
return `/private${normalized}`;
|
|
103
|
+
}
|
|
104
|
+
return normalized;
|
|
105
|
+
}
|
|
106
|
+
function macosPathKey(targetPath) {
|
|
107
|
+
return normalizeMacosSyntheticPath2(targetPath).toLowerCase();
|
|
108
|
+
}
|
|
109
|
+
async function canonicalizeMacosPath2(targetPath, realpathFn = realpath) {
|
|
110
|
+
try {
|
|
111
|
+
return normalizeMacosSyntheticPath2(await realpathFn(targetPath));
|
|
112
|
+
} catch {
|
|
113
|
+
return normalizeMacosSyntheticPath2(targetPath);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function isPathWithinDirectory2(candidate, directory) {
|
|
117
|
+
const normCandidate = macosPathKey(candidate);
|
|
118
|
+
const normDir = macosPathKey(directory);
|
|
119
|
+
if (normDir === "/")
|
|
120
|
+
return normCandidate.startsWith("/");
|
|
121
|
+
return normCandidate === normDir || normCandidate.startsWith(`${normDir}/`);
|
|
122
|
+
}
|
|
123
|
+
var APPLICATIONS_PREFIX = "/applications/";
|
|
124
|
+
var PROTECTED_SYSTEM_PREFIXES = [
|
|
125
|
+
"/system/",
|
|
126
|
+
APPLICATIONS_PREFIX,
|
|
127
|
+
"/library/apple/",
|
|
128
|
+
"/usr/",
|
|
129
|
+
"/bin/",
|
|
130
|
+
"/sbin/"
|
|
131
|
+
];
|
|
132
|
+
var FORBIDDEN_BUILD_ROOTS = new Set("/ /system /applications /library /library/apple /users /var /private /private/var /tmp /private/tmp /etc /private/etc /usr /bin /sbin".split(" "));
|
|
133
|
+
var USER_HOME_ROOT_PATTERN = /^\/users\/[^/]+$/;
|
|
134
|
+
function isProtectedMacosSystemPath(targetPath, options = { applications: "protected" }) {
|
|
135
|
+
const normalized = (posix.normalize(targetPath).replace(/\/+$/, "") || "/").toLowerCase();
|
|
136
|
+
const synthetic = macosPathKey(targetPath);
|
|
137
|
+
return PROTECTED_SYSTEM_PREFIXES.some((prefix) => {
|
|
138
|
+
if (prefix === APPLICATIONS_PREFIX && options.applications === "install-target")
|
|
139
|
+
return false;
|
|
140
|
+
const root = prefix.slice(0, -1);
|
|
141
|
+
return normalized === root || normalized.startsWith(prefix) || synthetic === root || synthetic.startsWith(prefix);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function isMacosForbiddenBuildRoot(targetPath) {
|
|
145
|
+
const rawLower = (posix.normalize(targetPath).replace(/\/+$/, "") || "/").toLowerCase();
|
|
146
|
+
const syntheticLower = macosPathKey(targetPath);
|
|
147
|
+
if (FORBIDDEN_BUILD_ROOTS.has(rawLower) || FORBIDDEN_BUILD_ROOTS.has(syntheticLower) || isProtectedMacosSystemPath(targetPath)) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
const strippedRaw = rawLower.startsWith("/private/") ? rawLower.slice("/private".length) : rawLower;
|
|
151
|
+
const strippedSynthetic = syntheticLower.startsWith("/private/") ? syntheticLower.slice("/private".length) : syntheticLower;
|
|
152
|
+
return USER_HOME_ROOT_PATTERN.test(strippedRaw) || USER_HOME_ROOT_PATTERN.test(strippedSynthetic);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export { CODESIGN_PATH2, SECURITY_PATH2, CLANG_PATH2, SIPS_PATH2, QLMANAGE_PATH2, ICONUTIL_PATH2, PS_PATH2, createDefaultMacosCommandRunner2, normalizeMacosSyntheticPath2, macosPathKey, canonicalizeMacosPath2, isPathWithinDirectory2, isProtectedMacosSystemPath, isMacosForbiddenBuildRoot };
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
import {
|
|
72
72
|
ToolExecutionControlError2,
|
|
73
73
|
isToolExecutionControlError2
|
|
74
|
-
} from "./index-
|
|
74
|
+
} from "./index-6kmjcm81.js";
|
|
75
75
|
import {
|
|
76
76
|
contractOperationEffects2
|
|
77
77
|
} from "./index-werjqesf.js";
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
} from "./index-r9kq5ark.js";
|
|
98
98
|
import {
|
|
99
99
|
listContractToolNames2
|
|
100
|
-
} from "./index-
|
|
100
|
+
} from "./index-pq6g1k9t.js";
|
|
101
101
|
import {
|
|
102
102
|
AgentToolError2,
|
|
103
103
|
isAgentToolError2
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import {
|
|
2
|
+
JsonRpcValueSchema2,
|
|
3
|
+
JsonRpcRecordSchema2
|
|
4
|
+
} from "./index-kwsr7j5k.js";
|
|
5
|
+
import {
|
|
6
|
+
isRecord
|
|
7
|
+
} from "./index-ps3djm8d.js";
|
|
8
|
+
|
|
9
|
+
// src/agent-executor/codex/protocol.ts
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
class CodexProtocolError2 extends Error {
|
|
12
|
+
method;
|
|
13
|
+
cause;
|
|
14
|
+
constructor(method, cause, message) {
|
|
15
|
+
super(message ?? `[stitchkit] Codex ${method} response did not match schema: ${cause.issues[0]?.message ?? cause.message}`, { cause });
|
|
16
|
+
this.method = method;
|
|
17
|
+
this.name = "CodexProtocolError";
|
|
18
|
+
this.cause = cause;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function parseCodexResponse(method, schema, raw, kind = "response") {
|
|
22
|
+
const parsed = schema.safeParse(raw);
|
|
23
|
+
if (!parsed.success) {
|
|
24
|
+
throw new CodexProtocolError2(method, parsed.error, `[stitchkit] Codex ${method} ${kind} did not match schema: ${parsed.error.issues[0]?.message ?? parsed.error.message}`);
|
|
25
|
+
}
|
|
26
|
+
return parsed.data;
|
|
27
|
+
}
|
|
28
|
+
var KNOWN_SANDBOX_POLICY_TYPES = new Set([
|
|
29
|
+
"dangerFullAccess",
|
|
30
|
+
"readOnly",
|
|
31
|
+
"externalSandbox",
|
|
32
|
+
"workspaceWrite"
|
|
33
|
+
]);
|
|
34
|
+
var KNOWN_THREAD_STATUS_TYPES = new Set(["notLoaded", "idle", "systemError", "active"]);
|
|
35
|
+
function unknownTypedRecordSchema(knownTypes) {
|
|
36
|
+
return z.custom((value) => isRecord(value) && typeof value.type === "string" && value.type.length > 0 && !knownTypes.has(value.type), { message: "Expected an object with an unknown non-empty type discriminator" });
|
|
37
|
+
}
|
|
38
|
+
var CodexApprovalPolicySchema2 = z.union([
|
|
39
|
+
z.enum(["untrusted", "on-failure", "on-request", "never"]),
|
|
40
|
+
JsonRpcRecordSchema2
|
|
41
|
+
]);
|
|
42
|
+
var CodexSandboxModeSchema2 = z.enum([
|
|
43
|
+
"read-only",
|
|
44
|
+
"workspace-write",
|
|
45
|
+
"danger-full-access"
|
|
46
|
+
]);
|
|
47
|
+
var CodexSandboxPolicySchema2 = z.union([
|
|
48
|
+
z.looseObject({ type: z.literal("dangerFullAccess") }),
|
|
49
|
+
z.looseObject({
|
|
50
|
+
type: z.literal("readOnly"),
|
|
51
|
+
networkAccess: z.boolean().optional()
|
|
52
|
+
}),
|
|
53
|
+
z.looseObject({
|
|
54
|
+
type: z.literal("externalSandbox"),
|
|
55
|
+
networkAccess: z.string().optional()
|
|
56
|
+
}),
|
|
57
|
+
z.looseObject({
|
|
58
|
+
type: z.literal("workspaceWrite"),
|
|
59
|
+
writableRoots: z.array(z.string()).optional(),
|
|
60
|
+
networkAccess: z.boolean().optional(),
|
|
61
|
+
excludeTmpdirEnvVar: z.boolean().optional(),
|
|
62
|
+
excludeSlashTmp: z.boolean().optional()
|
|
63
|
+
}),
|
|
64
|
+
unknownTypedRecordSchema(KNOWN_SANDBOX_POLICY_TYPES)
|
|
65
|
+
]);
|
|
66
|
+
var CodexThreadStatusSchema2 = z.union([
|
|
67
|
+
z.looseObject({ type: z.literal("notLoaded") }),
|
|
68
|
+
z.looseObject({ type: z.literal("idle") }),
|
|
69
|
+
z.looseObject({ type: z.literal("systemError") }),
|
|
70
|
+
z.looseObject({
|
|
71
|
+
type: z.literal("active"),
|
|
72
|
+
activeFlags: z.array(z.string())
|
|
73
|
+
}),
|
|
74
|
+
unknownTypedRecordSchema(KNOWN_THREAD_STATUS_TYPES)
|
|
75
|
+
]);
|
|
76
|
+
var CodexTurnStatusSchema2 = z.enum([
|
|
77
|
+
"completed",
|
|
78
|
+
"interrupted",
|
|
79
|
+
"failed",
|
|
80
|
+
"inProgress"
|
|
81
|
+
]);
|
|
82
|
+
var CodexTurnItemsViewSchema2 = z.union([
|
|
83
|
+
z.enum(["notLoaded", "summary", "full"]),
|
|
84
|
+
z.custom((value) => typeof value === "string" && value.length > 0, {
|
|
85
|
+
message: "Expected a non-empty TurnItemsView string"
|
|
86
|
+
})
|
|
87
|
+
]);
|
|
88
|
+
var CODEX_THREAD_SOURCE_KINDS2 = [
|
|
89
|
+
"cli",
|
|
90
|
+
"vscode",
|
|
91
|
+
"exec",
|
|
92
|
+
"appServer",
|
|
93
|
+
"subAgent",
|
|
94
|
+
"subAgentReview",
|
|
95
|
+
"subAgentCompact",
|
|
96
|
+
"subAgentThreadSpawn",
|
|
97
|
+
"subAgentOther",
|
|
98
|
+
"unknown"
|
|
99
|
+
];
|
|
100
|
+
var CodexThreadSourceKindSchema2 = z.enum(CODEX_THREAD_SOURCE_KINDS2);
|
|
101
|
+
var CodexCollaborationModeSchema2 = z.strictObject({
|
|
102
|
+
mode: z.enum(["plan", "default"]),
|
|
103
|
+
settings: z.strictObject({
|
|
104
|
+
model: z.string().min(1),
|
|
105
|
+
reasoning_effort: z.string().min(1).nullable().optional(),
|
|
106
|
+
developer_instructions: z.string().nullable().optional()
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
var CodexThreadItemSchema2 = z.looseObject({
|
|
110
|
+
type: z.string(),
|
|
111
|
+
id: z.string().min(1)
|
|
112
|
+
});
|
|
113
|
+
var CodexTurnSchema = z.looseObject({
|
|
114
|
+
id: z.string().min(1),
|
|
115
|
+
status: CodexTurnStatusSchema2,
|
|
116
|
+
error: z.looseObject({
|
|
117
|
+
message: z.string(),
|
|
118
|
+
codexErrorInfo: JsonRpcValueSchema2.nullable().optional()
|
|
119
|
+
}).nullable().optional(),
|
|
120
|
+
items: z.array(z.looseObject({ type: z.string(), clientId: z.string().nullable().optional() })).optional(),
|
|
121
|
+
startedAt: z.number().int().nullable().optional(),
|
|
122
|
+
completedAt: z.number().int().nullable().optional(),
|
|
123
|
+
durationMs: z.number().int().nullable().optional(),
|
|
124
|
+
rootTurnId: z.string().nullable().optional()
|
|
125
|
+
});
|
|
126
|
+
var CodexListedTurnItemSchema = z.looseObject({
|
|
127
|
+
type: z.string(),
|
|
128
|
+
clientId: z.string().nullable().optional()
|
|
129
|
+
});
|
|
130
|
+
var CodexListedTurnSchema2 = CodexTurnSchema.extend({
|
|
131
|
+
items: z.array(CodexListedTurnItemSchema),
|
|
132
|
+
itemsView: CodexTurnItemsViewSchema2.optional()
|
|
133
|
+
});
|
|
134
|
+
var CodexTurnsPageSchema2 = z.looseObject({
|
|
135
|
+
data: z.array(CodexListedTurnSchema2),
|
|
136
|
+
nextCursor: z.string().nullable().optional(),
|
|
137
|
+
backwardsCursor: z.string().nullable().optional()
|
|
138
|
+
});
|
|
139
|
+
var CodexThreadSchema2 = z.looseObject({
|
|
140
|
+
id: z.string().min(1),
|
|
141
|
+
name: z.string().nullable().optional(),
|
|
142
|
+
preview: z.string().optional(),
|
|
143
|
+
cwd: z.string().optional(),
|
|
144
|
+
model: z.string().nullable().optional(),
|
|
145
|
+
modelProvider: z.string().optional(),
|
|
146
|
+
reasoningEffort: z.string().nullable().optional(),
|
|
147
|
+
status: CodexThreadStatusSchema2.optional(),
|
|
148
|
+
canAcceptDirectInput: z.boolean().nullable().optional(),
|
|
149
|
+
cliVersion: z.string().optional(),
|
|
150
|
+
createdAt: z.number().int().optional(),
|
|
151
|
+
updatedAt: z.number().int().optional(),
|
|
152
|
+
recencyAt: z.number().int().nullable().optional(),
|
|
153
|
+
ephemeral: z.boolean().optional(),
|
|
154
|
+
path: z.string().nullable().optional(),
|
|
155
|
+
source: JsonRpcValueSchema2.optional(),
|
|
156
|
+
sessionId: z.string().optional(),
|
|
157
|
+
projectId: z.string().nullable().optional(),
|
|
158
|
+
forkedFromId: z.string().nullable().optional(),
|
|
159
|
+
parentThreadId: z.string().nullable().optional(),
|
|
160
|
+
attachedToThreadId: z.string().nullable().optional(),
|
|
161
|
+
originator: z.string().nullable().optional(),
|
|
162
|
+
agentNickname: z.string().nullable().optional(),
|
|
163
|
+
agentRole: z.string().nullable().optional(),
|
|
164
|
+
gitInfo: JsonRpcValueSchema2.nullable().optional(),
|
|
165
|
+
turns: z.array(CodexListedTurnSchema2).optional()
|
|
166
|
+
});
|
|
167
|
+
var CodexThreadContextSchema2 = z.object({
|
|
168
|
+
model: z.string().optional(),
|
|
169
|
+
modelProvider: z.string().optional(),
|
|
170
|
+
reasoningEffort: z.string().nullable().optional(),
|
|
171
|
+
approvalPolicy: CodexApprovalPolicySchema2.optional(),
|
|
172
|
+
sandbox: CodexSandboxPolicySchema2.optional(),
|
|
173
|
+
cwd: z.string().optional(),
|
|
174
|
+
runtimeWorkspaceRoots: z.array(z.string()).readonly().optional(),
|
|
175
|
+
thread: CodexThreadSchema2.optional()
|
|
176
|
+
});
|
|
177
|
+
var CodexInitializeResponseSchema = z.looseObject({
|
|
178
|
+
userAgent: z.string().nullable().optional()
|
|
179
|
+
});
|
|
180
|
+
var CodexInboundCollaborationModeSchema = z.looseObject({
|
|
181
|
+
mode: z.string(),
|
|
182
|
+
settings: z.looseObject({
|
|
183
|
+
model: z.string().optional(),
|
|
184
|
+
reasoning_effort: z.string().nullable().optional(),
|
|
185
|
+
developer_instructions: z.string().nullable().optional()
|
|
186
|
+
}).optional()
|
|
187
|
+
});
|
|
188
|
+
var CodexStartedThreadSchema = CodexThreadContextSchema2.extend({
|
|
189
|
+
thread: CodexThreadSchema2,
|
|
190
|
+
approvalsReviewer: z.string().optional(),
|
|
191
|
+
collaborationMode: CodexInboundCollaborationModeSchema.nullable().optional(),
|
|
192
|
+
turnsBackwardsCursor: z.string().nullable().optional(),
|
|
193
|
+
itemsBackwardsCursor: z.string().nullable().optional(),
|
|
194
|
+
serviceTier: z.string().nullable().optional(),
|
|
195
|
+
disabledPluginIds: z.array(z.string()).optional(),
|
|
196
|
+
instructionSources: z.array(z.string()).optional()
|
|
197
|
+
}).loose();
|
|
198
|
+
function extractCodexThreadContext(parsed) {
|
|
199
|
+
return {
|
|
200
|
+
...parsed.model !== undefined && { model: parsed.model },
|
|
201
|
+
...parsed.modelProvider !== undefined && { modelProvider: parsed.modelProvider },
|
|
202
|
+
...parsed.reasoningEffort !== undefined && { reasoningEffort: parsed.reasoningEffort },
|
|
203
|
+
...parsed.approvalPolicy !== undefined && { approvalPolicy: parsed.approvalPolicy },
|
|
204
|
+
...parsed.sandbox !== undefined && { sandbox: parsed.sandbox },
|
|
205
|
+
...parsed.cwd !== undefined && { cwd: parsed.cwd },
|
|
206
|
+
...parsed.runtimeWorkspaceRoots !== undefined && {
|
|
207
|
+
runtimeWorkspaceRoots: parsed.runtimeWorkspaceRoots
|
|
208
|
+
},
|
|
209
|
+
thread: parsed.thread
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
var CodexStartedTurnSchema = z.looseObject({
|
|
213
|
+
turn: z.looseObject({ id: z.string().min(1) })
|
|
214
|
+
});
|
|
215
|
+
var CodexTurnSteerResponseSchema = z.looseObject({
|
|
216
|
+
turnId: z.string().min(1)
|
|
217
|
+
});
|
|
218
|
+
var CodexThreadRevertResponseSchema = z.looseObject({
|
|
219
|
+
thread: CodexThreadSchema2,
|
|
220
|
+
turnsBackwardsCursor: z.string().nullable().optional(),
|
|
221
|
+
itemsBackwardsCursor: z.string().nullable().optional()
|
|
222
|
+
});
|
|
223
|
+
var CodexApprovalParamsSchema = z.looseObject({
|
|
224
|
+
threadId: z.string().optional(),
|
|
225
|
+
turnId: z.string().optional(),
|
|
226
|
+
itemId: z.string(),
|
|
227
|
+
command: z.string().nullable().optional(),
|
|
228
|
+
cwd: z.string().nullable().optional(),
|
|
229
|
+
reason: z.string().nullable().optional(),
|
|
230
|
+
grantRoot: z.string().nullable().optional(),
|
|
231
|
+
kind: z.string().nullable().optional(),
|
|
232
|
+
approvalId: z.string().nullable().optional(),
|
|
233
|
+
startedAtMs: z.number().int().nullable().optional(),
|
|
234
|
+
commandActions: z.array(JsonRpcValueSchema2).nullable().optional(),
|
|
235
|
+
availableDecisions: z.array(JsonRpcValueSchema2).nullable().optional()
|
|
236
|
+
});
|
|
237
|
+
var CodexUserInputOptionSchema = z.looseObject({
|
|
238
|
+
label: z.string(),
|
|
239
|
+
description: z.string()
|
|
240
|
+
});
|
|
241
|
+
var CodexUserInputQuestionSchema = z.looseObject({
|
|
242
|
+
id: z.string(),
|
|
243
|
+
question: z.string(),
|
|
244
|
+
header: z.string(),
|
|
245
|
+
isOther: z.boolean().optional(),
|
|
246
|
+
isSecret: z.boolean().optional(),
|
|
247
|
+
options: z.array(CodexUserInputOptionSchema).nullable().optional()
|
|
248
|
+
});
|
|
249
|
+
var CodexUserInputParamsSchema = z.looseObject({
|
|
250
|
+
threadId: z.string().optional(),
|
|
251
|
+
turnId: z.string().optional(),
|
|
252
|
+
itemId: z.string(),
|
|
253
|
+
questions: z.array(CodexUserInputQuestionSchema)
|
|
254
|
+
});
|
|
255
|
+
var CodexUserInputAnswersSchema = z.record(z.string(), z.strictObject({ answers: z.array(z.string()) }));
|
|
256
|
+
var CodexPermissionProfileSchema = z.looseObject({
|
|
257
|
+
fileSystem: JsonRpcValueSchema2.nullable().optional(),
|
|
258
|
+
network: JsonRpcValueSchema2.nullable().optional()
|
|
259
|
+
});
|
|
260
|
+
var CodexPermissionsApprovalParamsSchema = z.looseObject({
|
|
261
|
+
threadId: z.string(),
|
|
262
|
+
turnId: z.string(),
|
|
263
|
+
itemId: z.string(),
|
|
264
|
+
cwd: z.string(),
|
|
265
|
+
permissions: CodexPermissionProfileSchema,
|
|
266
|
+
startedAtMs: z.number().int(),
|
|
267
|
+
reason: z.string().nullable().optional(),
|
|
268
|
+
environmentId: z.string().nullable().optional()
|
|
269
|
+
});
|
|
270
|
+
var CodexMcpElicitationBaseFields = {
|
|
271
|
+
serverName: z.string(),
|
|
272
|
+
threadId: z.string(),
|
|
273
|
+
turnId: z.string().nullable().optional(),
|
|
274
|
+
environmentId: z.string().nullable().optional(),
|
|
275
|
+
message: z.string(),
|
|
276
|
+
_meta: JsonRpcValueSchema2.optional()
|
|
277
|
+
};
|
|
278
|
+
var CodexMcpElicitationFormSchemaSchema = z.looseObject({
|
|
279
|
+
type: z.literal("object"),
|
|
280
|
+
properties: z.record(z.string(), JsonRpcValueSchema2),
|
|
281
|
+
required: z.array(z.string()).nullable().optional(),
|
|
282
|
+
$schema: z.string().nullable().optional()
|
|
283
|
+
});
|
|
284
|
+
var CodexMcpElicitationParamsSchema = z.discriminatedUnion("mode", [
|
|
285
|
+
z.looseObject({
|
|
286
|
+
...CodexMcpElicitationBaseFields,
|
|
287
|
+
mode: z.literal("form"),
|
|
288
|
+
requestedSchema: CodexMcpElicitationFormSchemaSchema
|
|
289
|
+
}),
|
|
290
|
+
z.looseObject({
|
|
291
|
+
...CodexMcpElicitationBaseFields,
|
|
292
|
+
mode: z.literal("openai/form"),
|
|
293
|
+
requestedSchema: JsonRpcValueSchema2
|
|
294
|
+
}),
|
|
295
|
+
z.looseObject({
|
|
296
|
+
...CodexMcpElicitationBaseFields,
|
|
297
|
+
mode: z.literal("openaiForm"),
|
|
298
|
+
requestedSchema: JsonRpcValueSchema2
|
|
299
|
+
}),
|
|
300
|
+
z.looseObject({
|
|
301
|
+
...CodexMcpElicitationBaseFields,
|
|
302
|
+
mode: z.literal("url"),
|
|
303
|
+
elicitationId: z.string(),
|
|
304
|
+
url: z.string()
|
|
305
|
+
})
|
|
306
|
+
]);
|
|
307
|
+
var CodexMcpElicitationAnswerSchema = z.strictObject({
|
|
308
|
+
action: z.enum(["accept", "decline", "cancel"]),
|
|
309
|
+
content: JsonRpcValueSchema2.optional(),
|
|
310
|
+
_meta: JsonRpcValueSchema2.optional()
|
|
311
|
+
});
|
|
312
|
+
var CODEX_APPROVAL_REQUESTS = new Set([
|
|
313
|
+
"item/commandExecution/requestApproval",
|
|
314
|
+
"item/fileChange/requestApproval"
|
|
315
|
+
]);
|
|
316
|
+
var CODEX_PERMISSIONS_APPROVAL_REQUEST = "item/permissions/requestApproval";
|
|
317
|
+
var CODEX_INPUT_REQUEST = "item/tool/requestUserInput";
|
|
318
|
+
var CODEX_ELICITATION_REQUEST = "mcpServer/elicitation/request";
|
|
319
|
+
var CODEX_APPROVAL_DECISION = {
|
|
320
|
+
approve: "accept",
|
|
321
|
+
approveForSession: "acceptForSession",
|
|
322
|
+
deny: "decline",
|
|
323
|
+
interrupted: "cancel"
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
// src/agent-executor/codex/capabilities.ts
|
|
327
|
+
function codexDriverCapabilities(options) {
|
|
328
|
+
return {
|
|
329
|
+
runtimePolicyEnforcement: "native",
|
|
330
|
+
sessionApproval: true,
|
|
331
|
+
interruptOnDeny: true,
|
|
332
|
+
updatedToolInput: false,
|
|
333
|
+
structuredInput: true,
|
|
334
|
+
steer: true,
|
|
335
|
+
fork: true,
|
|
336
|
+
revert: true,
|
|
337
|
+
compact: true,
|
|
338
|
+
injectItems: true,
|
|
339
|
+
backgroundWorkOutlivesTurn: false,
|
|
340
|
+
multiThreadPerProcess: false,
|
|
341
|
+
images: options.images,
|
|
342
|
+
planLimits: "pull"
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function codexSharedServerCapabilities(driver) {
|
|
346
|
+
return { ...driver, multiThreadPerProcess: true };
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export { CodexProtocolError2, parseCodexResponse, unknownTypedRecordSchema, CodexApprovalPolicySchema2, CodexSandboxModeSchema2, CodexSandboxPolicySchema2, CodexThreadStatusSchema2, CodexTurnStatusSchema2, CodexTurnItemsViewSchema2, CODEX_THREAD_SOURCE_KINDS2, CodexThreadSourceKindSchema2, CodexCollaborationModeSchema2, CodexThreadItemSchema2, CodexTurnSchema, CodexListedTurnSchema2, CodexTurnsPageSchema2, CodexThreadSchema2, CodexThreadContextSchema2, CodexInitializeResponseSchema, CodexStartedThreadSchema, extractCodexThreadContext, CodexStartedTurnSchema, CodexTurnSteerResponseSchema, CodexThreadRevertResponseSchema, CodexApprovalParamsSchema, CodexUserInputParamsSchema, CodexUserInputAnswersSchema, CodexPermissionsApprovalParamsSchema, CodexMcpElicitationParamsSchema, CodexMcpElicitationAnswerSchema, CODEX_APPROVAL_REQUESTS, CODEX_PERMISSIONS_APPROVAL_REQUEST, CODEX_INPUT_REQUEST, CODEX_ELICITATION_REQUEST, CODEX_APPROVAL_DECISION, codexDriverCapabilities, codexSharedServerCapabilities };
|