stitchkit 0.135.0 → 0.136.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 +117 -0
- package/README.md +25 -11
- package/dist/agent-executor/acp/v1-session-build.d.ts +51 -0
- package/dist/agent-executor/acp/v1-session-build.d.ts.map +1 -0
- package/dist/agent-executor/acp/v1-session.d.ts +1 -1
- package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
- package/dist/agent-executor/claude/classify.d.ts +1 -1
- package/dist/agent-executor/claude/classify.d.ts.map +1 -1
- package/dist/agent-executor/claude/events-wire.d.ts +13 -0
- package/dist/agent-executor/claude/events-wire.d.ts.map +1 -0
- package/dist/agent-executor/claude/events.d.ts +1 -11
- package/dist/agent-executor/claude/events.d.ts.map +1 -1
- package/dist/agent-executor/codex/protocol.d.ts +0 -143
- package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
- package/dist/agent-executor/codex/request-answers.d.ts +1 -1
- package/dist/agent-executor/codex/request-answers.d.ts.map +1 -1
- package/dist/agent-executor/codex/server-requests.d.ts +150 -0
- package/dist/agent-executor/codex/server-requests.d.ts.map +1 -0
- package/dist/agent-executor/image-input.d.ts +10 -3
- package/dist/agent-executor/image-input.d.ts.map +1 -1
- package/dist/agent-executor/testing/replay-scenarios.d.ts.map +1 -1
- package/dist/agent-executor/testing/replay-transcript.d.ts.map +1 -1
- package/dist/agent-runtime/browser/browser-control-contract.d.ts +4 -0
- package/dist/agent-runtime/browser/browser-control-contract.d.ts.map +1 -1
- package/dist/agent-runtime/browser/control-schema.d.ts +4 -0
- package/dist/agent-runtime/browser/control-schema.d.ts.map +1 -1
- package/dist/agent-runtime/browser/control-view.d.ts.map +1 -1
- package/dist/agent-runtime/event-schema.d.ts +16 -3
- package/dist/agent-runtime/event-schema.d.ts.map +1 -1
- package/dist/agent-runtime/loop/deferred-tools.d.ts.map +1 -1
- package/dist/agent-runtime/loop/invocation-payload.d.ts.map +1 -1
- package/dist/agent-runtime/loop/invocation-stream.d.ts +9 -1
- package/dist/agent-runtime/loop/invocation-stream.d.ts.map +1 -1
- package/dist/agent-runtime/loop/provider-stream-parts.d.ts +6 -0
- package/dist/agent-runtime/loop/provider-stream-parts.d.ts.map +1 -1
- package/dist/agent-runtime/loop/provider-stream-segments.d.ts +1 -1
- package/dist/agent-runtime/loop/provider-stream-segments.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-acquisition.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-approval-signature.d.ts +34 -0
- package/dist/agent-runtime/loop/run-approval-signature.d.ts.map +1 -0
- package/dist/agent-runtime/loop/run-approval.d.ts +0 -28
- package/dist/agent-runtime/loop/run-approval.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-complete-port.d.ts +24 -0
- package/dist/agent-runtime/loop/run-complete-port.d.ts.map +1 -0
- package/dist/agent-runtime/loop/run-complete-stream.d.ts +7 -2
- package/dist/agent-runtime/loop/run-complete-stream.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-complete-types.d.ts +14 -1
- package/dist/agent-runtime/loop/run-complete-types.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-complete.d.ts +2 -2
- package/dist/agent-runtime/loop/run-complete.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-execution-state.d.ts +8 -0
- package/dist/agent-runtime/loop/run-execution-state.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-model-call.d.ts +44 -0
- package/dist/agent-runtime/loop/run-model-call.d.ts.map +1 -0
- package/dist/agent-runtime/loop/run-model-step.d.ts +25 -28
- package/dist/agent-runtime/loop/run-model-step.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-model-steps.d.ts +6 -0
- package/dist/agent-runtime/loop/run-model-steps.d.ts.map +1 -0
- package/dist/agent-runtime/loop/run-model-stream.d.ts +3 -1
- package/dist/agent-runtime/loop/run-model-stream.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-operation-lifecycle.d.ts +0 -2
- package/dist/agent-runtime/loop/run-operation-lifecycle.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-step-loop.d.ts +19 -0
- package/dist/agent-runtime/loop/run-step-loop.d.ts.map +1 -0
- package/dist/agent-runtime/loop/run-step-port.d.ts +175 -0
- package/dist/agent-runtime/loop/run-step-port.d.ts.map +1 -0
- package/dist/agent-runtime/loop/run-stream-parts.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-stream-step-text.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-tool-approval-flow.d.ts +2 -1
- package/dist/agent-runtime/loop/run-tool-approval-flow.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-tool-call-input.d.ts +39 -0
- package/dist/agent-runtime/loop/run-tool-call-input.d.ts.map +1 -0
- package/dist/agent-runtime/loop/run-tool-call.d.ts +2 -31
- package/dist/agent-runtime/loop/run-tool-call.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-tool-errors.d.ts +5 -0
- package/dist/agent-runtime/loop/run-tool-errors.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-tool-executor.d.ts +1 -1
- package/dist/agent-runtime/loop/run-tool-executor.d.ts.map +1 -1
- package/dist/agent-runtime/loop/run-tool-slots.d.ts +2 -1
- package/dist/agent-runtime/loop/run-tool-slots.d.ts.map +1 -1
- package/dist/agent-runtime/loop/runtime-state.d.ts.map +1 -1
- package/dist/agent-runtime/loop/runtime.d.ts +0 -5
- package/dist/agent-runtime/loop/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/providers/ai-sdk-convert.d.ts +1 -5
- package/dist/agent-runtime/providers/ai-sdk-convert.d.ts.map +1 -1
- package/dist/agent-runtime/providers/ai-sdk-normalize.d.ts +11 -0
- package/dist/agent-runtime/providers/ai-sdk-normalize.d.ts.map +1 -0
- package/dist/agent-runtime/providers/ai-sdk-tools.d.ts +11 -0
- package/dist/agent-runtime/providers/ai-sdk-tools.d.ts.map +1 -0
- package/dist/agent-runtime/providers/ai-sdk.d.ts +1 -9
- package/dist/agent-runtime/providers/ai-sdk.d.ts.map +1 -1
- package/dist/agent-runtime/providers/anthropic-sse.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-admission.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-audio.d.ts +164 -0
- package/dist/agent-runtime/providers/openrouter-audio.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-catalog-cache.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-catalog-query.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-catalog.d.ts +4 -2
- package/dist/agent-runtime/providers/openrouter-catalog.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-client.d.ts +37 -0
- package/dist/agent-runtime/providers/openrouter-client.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-http.d.ts +120 -0
- package/dist/agent-runtime/providers/openrouter-http.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-media.d.ts +174 -0
- package/dist/agent-runtime/providers/openrouter-media.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-models.d.ts +2 -23
- package/dist/agent-runtime/providers/openrouter-models.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-options.d.ts +4 -0
- package/dist/agent-runtime/providers/openrouter-options.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-request.d.ts +23 -0
- package/dist/agent-runtime/providers/openrouter-request.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-response.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-retrieval.d.ts +145 -0
- package/dist/agent-runtime/providers/openrouter-retrieval.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-speech.d.ts +90 -0
- package/dist/agent-runtime/providers/openrouter-speech.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-spend.d.ts +7 -3
- package/dist/agent-runtime/providers/openrouter-spend.d.ts.map +1 -1
- package/dist/agent-runtime/providers/openrouter-stream.d.ts +29 -0
- package/dist/agent-runtime/providers/openrouter-stream.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-systemone.d.ts +137 -0
- package/dist/agent-runtime/providers/openrouter-systemone.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-url.d.ts +19 -0
- package/dist/agent-runtime/providers/openrouter-url.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter-wire.d.ts +45 -0
- package/dist/agent-runtime/providers/openrouter-wire.d.ts.map +1 -0
- package/dist/agent-runtime/providers/openrouter.d.ts +5 -4
- package/dist/agent-runtime/providers/openrouter.d.ts.map +1 -1
- package/dist/agent-runtime/providers/provider-http.d.ts +29 -3
- package/dist/agent-runtime/providers/provider-http.d.ts.map +1 -1
- package/dist/agent-runtime/providers/provider-json-schema-strip.d.ts.map +1 -1
- package/dist/agent-runtime/providers/provider-json-schema.d.ts.map +1 -1
- package/dist/agent-runtime/providers/provider-openai-chat-sse.d.ts.map +1 -1
- package/dist/agent-runtime/providers/provider-openai-chat-state.d.ts +42 -0
- package/dist/agent-runtime/providers/provider-openai-chat-state.d.ts.map +1 -0
- package/dist/agent-runtime/providers/provider-usage.d.ts +9 -0
- package/dist/agent-runtime/providers/provider-usage.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox/sandbox-bubblewrap-args.d.ts +9 -0
- package/dist/agent-runtime/sandbox/sandbox-bubblewrap-args.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox/sandbox-bubblewrap.d.ts +6 -0
- package/dist/agent-runtime/sandbox/sandbox-bubblewrap.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox/sandbox-contract.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox/sandbox-process-linux.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox/sandbox-process-spec.d.ts +5 -1
- package/dist/agent-runtime/sandbox/sandbox-process-spec.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox/sandbox-process-wrapper.d.ts.map +1 -1
- package/dist/agent-runtime/stores/branch-messages.d.ts.map +1 -1
- package/dist/agent-runtime/stores/sql-rows.d.ts +10 -10
- package/dist/agent-runtime/terminal-commit.d.ts +10 -10
- package/dist/agent-runtime/testing/fault-bench.d.ts +5 -1
- package/dist/agent-runtime/testing/fault-bench.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
- package/dist/browser/client-executors.d.ts.map +1 -1
- package/dist/browser/client-url.d.ts.map +1 -1
- package/dist/contract/define.d.ts +3 -7
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/normalize.d.ts +17 -5
- package/dist/contract/normalize.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/acp.js +4 -2
- package/dist/entrypoints/agent-executor/claude-sdk.js +20 -20
- package/dist/entrypoints/agent-executor/claude.js +7 -7
- package/dist/entrypoints/agent-executor/codex.d.ts +2 -1
- package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/codex.js +129 -35
- package/dist/entrypoints/agent-executor/testing/claude-sdk.js +2 -2
- package/dist/entrypoints/agent-executor/testing.js +17 -13
- package/dist/entrypoints/agent-executor.js +1 -1
- package/dist/entrypoints/agent-runtime/ai-sdk.d.ts +2 -1
- package/dist/entrypoints/agent-runtime/ai-sdk.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/ai-sdk.js +10 -12
- package/dist/entrypoints/agent-runtime/anthropic.js +13 -10
- package/dist/entrypoints/agent-runtime/browser.js +8 -4
- package/dist/entrypoints/agent-runtime/harness.js +18 -19
- package/dist/entrypoints/agent-runtime/openai.js +5 -5
- package/dist/entrypoints/agent-runtime/openrouter.d.ts +11 -2
- package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/openrouter.js +1940 -496
- package/dist/entrypoints/agent-runtime/postgres.js +2 -2
- package/dist/entrypoints/agent-runtime/realtime.js +5 -5
- package/dist/entrypoints/agent-runtime/sandbox.js +167 -139
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
- package/dist/entrypoints/agent-runtime/testing.js +3 -3
- package/dist/entrypoints/agent-runtime.js +246 -360
- package/dist/entrypoints/application.js +2 -2
- package/dist/entrypoints/cli.js +36 -15
- package/dist/entrypoints/contract.js +12 -10
- package/dist/entrypoints/geo.js +1 -1
- package/dist/entrypoints/handler.js +5 -6
- package/dist/entrypoints/http.d.ts +2 -0
- package/dist/entrypoints/http.d.ts.map +1 -1
- package/dist/entrypoints/http.js +16 -4
- package/dist/entrypoints/index.js +26 -35
- package/dist/entrypoints/live.js +3 -3
- package/dist/entrypoints/node.js +7 -7
- package/dist/entrypoints/observability.js +9 -7
- package/dist/entrypoints/process.js +3 -3
- package/dist/entrypoints/remote.js +5 -5
- package/dist/entrypoints/server.js +29 -16
- package/dist/entrypoints/telegram/grammy.d.ts +1 -1
- package/dist/entrypoints/telegram/grammy.d.ts.map +1 -1
- package/dist/entrypoints/telegram/grammy.js +39 -5
- package/dist/entrypoints/telegram/screens.js +3 -0
- package/dist/entrypoints/telegram.d.ts +1 -1
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +19 -6
- package/dist/entrypoints/testing.js +10 -11
- package/dist/entrypoints/tools/agent.js +8 -9
- package/dist/entrypoints/tools/connections.js +27 -57
- package/dist/entrypoints/tools/contract.js +4 -4
- package/dist/entrypoints/tools/invoker.js +7 -8
- package/dist/entrypoints/tools/mcp.js +9 -10
- package/dist/entrypoints/tools/toolkit.js +11 -12
- package/dist/entrypoints/tools.js +20 -20
- package/dist/entrypoints/tracking/contract.js +1 -1
- package/dist/entrypoints/tracking/performance.js +1 -1
- package/dist/entrypoints/tracking.js +1 -1
- package/dist/{index-3czc3ykr.js → index-08a3qfr8.js} +1 -1
- package/dist/{index-grhhsrd5.js → index-1en7k3q5.js} +2 -1
- package/dist/{index-pdcbjd6a.js → index-1yky29qg.js} +6 -3
- package/dist/{index-b4c9dpzm.js → index-252den5a.js} +10 -11
- package/dist/{index-xtby8rj3.js → index-28kbdn63.js} +5 -47
- package/dist/{index-57sbckhv.js → index-36mtj8xm.js} +2 -2
- package/dist/{index-dm84tsd5.js → index-3kb8dw48.js} +1 -1
- package/dist/index-3tb82xr7.js +11 -0
- package/dist/{index-c24bj2r1.js → index-4243301z.js} +2 -2
- package/dist/{index-nr4fhfn4.js → index-4p2zx593.js} +2 -0
- package/dist/{index-q86qnzzf.js → index-54wp467c.js} +4 -4
- package/dist/{index-mcv7b2n0.js → index-63ctzjp4.js} +497 -495
- package/dist/{index-y0a4gt1s.js → index-65p8v81y.js} +3 -2
- package/dist/{index-z72vazf5.js → index-6y3eae97.js} +27 -83
- package/dist/{index-5awtbyns.js → index-9vj869rx.js} +1 -1
- package/dist/{index-5q0qpw3v.js → index-aqm7e864.js} +23 -8
- package/dist/{index-d4at0q09.js → index-b9mj31q7.js} +90 -88
- package/dist/{index-baba8ehy.js → index-bjrcbcn2.js} +2 -2
- package/dist/{index-fsw9wxk9.js → index-c9j8441q.js} +1 -103
- package/dist/{index-wdb5jhas.js → index-d1pdv8qc.js} +1 -1
- package/dist/{index-73wq9abg.js → index-df5xr2f9.js} +13 -59
- package/dist/{index-n9358ydy.js → index-dm50x3by.js} +1 -1
- package/dist/{index-zyyerdny.js → index-dmrx8xma.js} +3 -0
- package/dist/{index-78da4g74.js → index-dwq6a6sq.js} +17 -13
- package/dist/{index-9be3tf6r.js → index-e413q2cj.js} +49 -22
- package/dist/{index-g4gstmp1.js → index-ednf2cxs.js} +1 -1
- package/dist/{index-84tp547a.js → index-edpkm3k7.js} +29 -97
- package/dist/{index-gs0jw0hy.js → index-efbzm2se.js} +3 -3
- package/dist/{index-de7b0kvz.js → index-epwvp88y.js} +1 -1
- package/dist/{index-asnd4h2k.js → index-f0dzyskg.js} +27 -4
- package/dist/{index-xbb8ysmq.js → index-fatke81t.js} +2 -2
- package/dist/{index-6nzzj7qr.js → index-gq35s3bm.js} +1 -1
- package/dist/index-gvgtmt7a.js +102 -0
- package/dist/{index-m2b49tvc.js → index-h08xqfw9.js} +20 -21
- package/dist/{index-gk6dq9ay.js → index-ha1tv70k.js} +3 -26
- package/dist/{index-wsv11dhg.js → index-hberxns4.js} +1 -1
- package/dist/{index-rkphknhx.js → index-hpzhz1vm.js} +1 -1
- package/dist/{index-npfdymav.js → index-j5vzhj3d.js} +1 -1
- package/dist/{index-d3s070eh.js → index-jperyn0c.js} +1 -1
- package/dist/{index-yhwx4fwk.js → index-kzsetgh9.js} +1 -1
- package/dist/{index-x6sp5vpa.js → index-q4tr9vnf.js} +1 -1
- package/dist/{index-hce3hbdg.js → index-qj0sq69b.js} +6 -2
- package/dist/{index-v0j22shs.js → index-rg08syp1.js} +9 -6
- package/dist/{index-8vzh5wpv.js → index-rw1caff2.js} +14 -26
- package/dist/index-s8af9jqw.js +6 -0
- package/dist/{index-bgj9hbm3.js → index-sdppfbrh.js} +30 -16
- package/dist/{index-y0mwkgkf.js → index-shte29pg.js} +1086 -1055
- package/dist/{index-fec05c9k.js → index-ta0e2daw.js} +9 -7
- package/dist/{index-zfrysr1e.js → index-tb36xawm.js} +110 -75
- package/dist/{index-c0yym4a0.js → index-w7e402wx.js} +11 -105
- package/dist/{index-bvpevwt6.js → index-xnqab06h.js} +207 -202
- package/dist/index-xrbrvn15.js +147 -0
- package/dist/{index-ac3rfec5.js → index-y6wzzk2e.js} +21 -1
- package/dist/{index-3d2c45jn.js → index-yjx5jna7.js} +2 -2
- package/dist/internal/loopback-host.d.ts +8 -0
- package/dist/internal/loopback-host.d.ts.map +1 -0
- package/dist/internal/own-member.d.ts +7 -0
- package/dist/internal/own-member.d.ts.map +1 -0
- package/dist/internal/request.d.ts +17 -8
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/secret-shapes.d.ts +33 -4
- package/dist/internal/secret-shapes.d.ts.map +1 -1
- package/dist/json-schema/dialect.d.ts.map +1 -1
- package/dist/json-schema/keywords.d.ts +25 -6
- package/dist/json-schema/keywords.d.ts.map +1 -1
- package/dist/json-schema/string-format.d.ts.map +1 -1
- package/dist/live/events.d.ts.map +1 -1
- package/dist/live/watch-client.d.ts.map +1 -1
- package/dist/live/watch-delta.d.ts.map +1 -1
- package/dist/observability/context.d.ts +4 -3
- package/dist/observability/context.d.ts.map +1 -1
- package/dist/observability/sanitize.d.ts.map +1 -1
- package/dist/observability/secret-values.d.ts +0 -9
- package/dist/observability/secret-values.d.ts.map +1 -1
- package/dist/server/context.d.ts +3 -2
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +4 -3
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/event-bus.d.ts.map +1 -1
- package/dist/server/file.d.ts +11 -3
- package/dist/server/file.d.ts.map +1 -1
- package/dist/server/handler-state.d.ts +2 -2
- package/dist/server/handler-state.d.ts.map +1 -1
- package/dist/server/middleware/jwt.d.ts +12 -1
- package/dist/server/middleware/jwt.d.ts.map +1 -1
- package/dist/server/middleware/trust-fence.d.ts +4 -0
- package/dist/server/middleware/trust-fence.d.ts.map +1 -1
- package/dist/server/multipart.d.ts +2 -3
- package/dist/server/multipart.d.ts.map +1 -1
- package/dist/server/raw.d.ts.map +1 -1
- package/dist/server/request-body.d.ts +12 -1
- package/dist/server/request-body.d.ts.map +1 -1
- package/dist/server/request-completion.d.ts.map +1 -1
- package/dist/server/types.d.ts +14 -9
- package/dist/server/types.d.ts.map +1 -1
- package/dist/telegram/crypto.d.ts.map +1 -1
- package/dist/telegram/init-data.d.ts +4 -4
- package/dist/telegram/init-data.d.ts.map +1 -1
- package/dist/telegram/outbound-cost.d.ts.map +1 -1
- package/dist/telegram/screens/test-chat.d.ts.map +1 -1
- package/dist/telegram/widget-api.d.ts +85 -13
- package/dist/telegram/widget-api.d.ts.map +1 -1
- package/dist/telegram/widget.d.ts +46 -2
- package/dist/telegram/widget.d.ts.map +1 -1
- package/dist/tools/cli/args-classify.d.ts +4 -74
- package/dist/tools/cli/args-classify.d.ts.map +1 -1
- package/dist/tools/cli/args-framework.d.ts +79 -0
- package/dist/tools/cli/args-framework.d.ts.map +1 -0
- package/dist/tools/cli/args-scan.d.ts.map +1 -1
- package/dist/tools/cli/args-tokens.d.ts.map +1 -1
- package/dist/tools/cli/checkpoint.d.ts +5 -0
- package/dist/tools/cli/checkpoint.d.ts.map +1 -1
- package/dist/tools/cli/stream.d.ts.map +1 -1
- package/dist/tools/connections/foreign-schema-join.d.ts.map +1 -1
- package/dist/tools/connections/openapi.d.ts.map +1 -1
- package/dist/tools/connections/runtime.d.ts.map +1 -1
- package/dist/tools/execute-handler.d.ts +24 -0
- package/dist/tools/execute-handler.d.ts.map +1 -0
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/mcp/round.d.ts.map +1 -1
- package/dist/tools/schema/coerce.d.ts.map +1 -1
- package/dist/tools/schema/flatten.d.ts.map +1 -1
- package/dist/tools/schema/inline-references.d.ts.map +1 -1
- package/dist/tools/schema/nesting-limit.d.ts.map +1 -1
- package/dist/tools/schema/presentation.d.ts.map +1 -1
- package/dist/tracking/privacy.d.ts.map +1 -1
- package/llms/agent-runtime-openrouter.txt +14 -5
- package/llms/agent-runtime-sandbox.txt +50 -11
- package/llms/agent-runtime-testing.txt +1 -1
- package/llms/agent-runtime.2.txt +342 -230
- package/llms/agent-runtime.3.txt +225 -380
- package/llms/agent-runtime.4.txt +387 -158
- package/llms/agent-runtime.5.txt +157 -152
- package/llms/agent-runtime.6.txt +164 -0
- package/llms/agent-runtime.txt +307 -362
- package/llms/application.txt +3 -1
- package/llms/http.txt +1 -1
- package/llms/live.txt +3 -1
- package/llms/observability.txt +16 -9
- package/llms/server.2.txt +13 -8
- package/llms/server.4.txt +23 -11
- package/llms/server.5.txt +5 -5
- package/llms/server.txt +54 -1
- package/llms/spend.txt +18 -1
- package/llms/stitchkit.2.txt +4 -2
- package/llms/stitchkit.txt +113 -93
- package/llms/telegram-grammy.txt +3 -2
- package/llms/telegram.2.txt +3 -1
- package/llms/telegram.txt +35 -10
- package/llms/upgrading-0.128.0-0.129.0.txt +175 -0
- package/llms/{upgrading-0.128.0-0.135.0.txt → upgrading-0.130.0-0.136.0.txt} +353 -169
- package/llms/upgrading.txt +2 -1
- package/llms-full.txt +1035 -208
- package/llms.txt +14 -13
- package/package.json +6 -6
- package/dist/agent-runtime/loop/deferred-tools-internal.d.ts +0 -19
- package/dist/agent-runtime/loop/deferred-tools-internal.d.ts.map +0 -1
- package/dist/agent-runtime/loop/run-complete-retry.d.ts +0 -24
- package/dist/agent-runtime/loop/run-complete-retry.d.ts.map +0 -1
- package/dist/agent-runtime/loop/run-model-attempts.d.ts +0 -6
- package/dist/agent-runtime/loop/run-model-attempts.d.ts.map +0 -1
- package/dist/index-sznqf8fx.js +0 -20
- /package/dist/{index-fthw8dwa.js → index-4gbybjg6.js} +0 -0
|
@@ -6,16 +6,17 @@ import {
|
|
|
6
6
|
} from "./index-rptj3qnc.js";
|
|
7
7
|
|
|
8
8
|
// src/agent-executor/image-input.ts
|
|
9
|
+
import { z } from "zod";
|
|
9
10
|
var DEFAULT_MAX_IMAGE_BYTES = 5 * 1024 * 1024;
|
|
10
11
|
var CLAUDE_CLI_MAX_LINE_BYTES = 16 * 1024 * 1024;
|
|
11
|
-
var
|
|
12
|
+
var SupportedImageMediaTypeSchema = z.enum([
|
|
12
13
|
"image/png",
|
|
13
14
|
"image/jpeg",
|
|
14
15
|
"image/gif",
|
|
15
16
|
"image/webp"
|
|
16
17
|
]);
|
|
17
18
|
function isSupportedImageMediaType(value) {
|
|
18
|
-
return value
|
|
19
|
+
return SupportedImageMediaTypeSchema.safeParse(value).success;
|
|
19
20
|
}
|
|
20
21
|
function validateImageOptions(options) {
|
|
21
22
|
assertPositiveSafeInteger("maxImageBytes", options.maxImageBytes);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
eachSubschema,
|
|
3
|
+
mapSubschemaValue
|
|
4
|
+
} from "./index-e413q2cj.js";
|
|
5
|
+
import {
|
|
6
|
+
setOwnMember
|
|
7
|
+
} from "./index-3tb82xr7.js";
|
|
6
8
|
import {
|
|
7
9
|
isRecord
|
|
8
10
|
} from "./index-ps3djm8d.js";
|
|
@@ -236,19 +238,16 @@ function stripWithSchema(value, schema, root) {
|
|
|
236
238
|
if (entry === null) {
|
|
237
239
|
if (sawDeclaredProp && !isRequired && !allowsNull)
|
|
238
240
|
continue;
|
|
239
|
-
out
|
|
241
|
+
setOwnMember(out, key, null);
|
|
240
242
|
continue;
|
|
241
243
|
}
|
|
242
244
|
const childSchema = propSchema ?? additionalSchema;
|
|
243
|
-
out
|
|
245
|
+
setOwnMember(out, key, childSchema ? stripWithSchema(entry, childSchema, root) : entry);
|
|
244
246
|
}
|
|
245
247
|
return out;
|
|
246
248
|
}
|
|
247
249
|
|
|
248
250
|
// src/agent-runtime/providers/provider-json-schema.ts
|
|
249
|
-
var SINGLE_SUBSCHEMA_KEYWORDS = new Set(SCHEMA_KEYWORDS);
|
|
250
|
-
var LIST_SUBSCHEMA_KEYWORDS = new Set(SCHEMA_LIST_KEYWORDS);
|
|
251
|
-
var MAP_SUBSCHEMA_KEYWORDS = new Set(SCHEMA_MAP_KEYWORDS);
|
|
252
251
|
var OPENAI_UNSUPPORTED_KEYWORDS = new Set(["propertyNames", "$schema", "examples"]);
|
|
253
252
|
var ANTHROPIC_STRIP_TO_DESCRIPTION = new Set([
|
|
254
253
|
"minLength",
|
|
@@ -267,66 +266,7 @@ var ANTHROPIC_STRIP_TO_DESCRIPTION = new Set([
|
|
|
267
266
|
"maxProperties"
|
|
268
267
|
]);
|
|
269
268
|
var REGEX_LOOKAROUND = /\(\?[=!<]/u;
|
|
270
|
-
|
|
271
|
-
if (Array.isArray(value))
|
|
272
|
-
return value.map(cloneJsonValue);
|
|
273
|
-
if (!isRecord(value))
|
|
274
|
-
return value;
|
|
275
|
-
const copy = {};
|
|
276
|
-
for (const [key, entry] of Object.entries(value))
|
|
277
|
-
copy[key] = cloneJsonValue(entry);
|
|
278
|
-
return copy;
|
|
279
|
-
}
|
|
280
|
-
function mapSubschemaEntry(key, entry, visit) {
|
|
281
|
-
if (SINGLE_SUBSCHEMA_KEYWORDS.has(key)) {
|
|
282
|
-
if (Array.isArray(entry))
|
|
283
|
-
return entry.map(visit);
|
|
284
|
-
return isRecord(entry) ? visit(entry) : cloneJsonValue(entry);
|
|
285
|
-
}
|
|
286
|
-
if (LIST_SUBSCHEMA_KEYWORDS.has(key) && Array.isArray(entry)) {
|
|
287
|
-
return entry.map(visit);
|
|
288
|
-
}
|
|
289
|
-
if (MAP_SUBSCHEMA_KEYWORDS.has(key) && isRecord(entry)) {
|
|
290
|
-
const mapped = {};
|
|
291
|
-
for (const [entryKey, entrySchema] of Object.entries(entry)) {
|
|
292
|
-
mapped[entryKey] = isRecord(entrySchema) ? visit(entrySchema) : cloneJsonValue(entrySchema);
|
|
293
|
-
}
|
|
294
|
-
return mapped;
|
|
295
|
-
}
|
|
296
|
-
if (key === "dependencies" && isRecord(entry)) {
|
|
297
|
-
const mapped = {};
|
|
298
|
-
for (const [depKey, depValue] of Object.entries(entry)) {
|
|
299
|
-
mapped[depKey] = isRecord(depValue) ? visit(depValue) : cloneJsonValue(depValue);
|
|
300
|
-
}
|
|
301
|
-
return mapped;
|
|
302
|
-
}
|
|
303
|
-
return cloneJsonValue(entry);
|
|
304
|
-
}
|
|
305
|
-
function eachSubschemaChild(node, skipDefContainers, visit) {
|
|
306
|
-
for (const [key, entry] of Object.entries(node)) {
|
|
307
|
-
if (skipDefContainers && (key === "$defs" || key === "definitions"))
|
|
308
|
-
continue;
|
|
309
|
-
if (SINGLE_SUBSCHEMA_KEYWORDS.has(key)) {
|
|
310
|
-
if (Array.isArray(entry)) {
|
|
311
|
-
for (const item of entry)
|
|
312
|
-
visit(item);
|
|
313
|
-
} else {
|
|
314
|
-
visit(entry);
|
|
315
|
-
}
|
|
316
|
-
} else if (LIST_SUBSCHEMA_KEYWORDS.has(key) && Array.isArray(entry)) {
|
|
317
|
-
for (const item of entry)
|
|
318
|
-
visit(item);
|
|
319
|
-
} else if (MAP_SUBSCHEMA_KEYWORDS.has(key) && isRecord(entry)) {
|
|
320
|
-
for (const child of Object.values(entry))
|
|
321
|
-
visit(child);
|
|
322
|
-
} else if (key === "dependencies" && isRecord(entry)) {
|
|
323
|
-
for (const child of Object.values(entry)) {
|
|
324
|
-
if (isRecord(child))
|
|
325
|
-
visit(child);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
269
|
+
var isDefinitionMap = (keyword) => keyword === "$defs" || keyword === "definitions";
|
|
330
270
|
function flattenStrictAnyOf(branches) {
|
|
331
271
|
const flat = [];
|
|
332
272
|
for (const branch of branches) {
|
|
@@ -376,7 +316,7 @@ function closeStrictObjectJsonSchema(out) {
|
|
|
376
316
|
const allKeys = Object.keys(out.properties);
|
|
377
317
|
for (const propKey of allKeys) {
|
|
378
318
|
const propSchema = out.properties[propKey];
|
|
379
|
-
nextProperties
|
|
319
|
+
setOwnMember(nextProperties, propKey, !existingRequired.has(propKey) && isRecord(propSchema) ? makeStrictNullable(propSchema) : propSchema);
|
|
380
320
|
}
|
|
381
321
|
out.properties = nextProperties;
|
|
382
322
|
out.required = allKeys;
|
|
@@ -388,9 +328,12 @@ function closeStrictObjectJsonSchema(out) {
|
|
|
388
328
|
}
|
|
389
329
|
}
|
|
390
330
|
function normalizeOpenAiJsonSchema(schema, strict) {
|
|
331
|
+
const rewrite = {
|
|
332
|
+
schema: (node) => visitSchema(node),
|
|
333
|
+
literal: structuredClone
|
|
334
|
+
};
|
|
335
|
+
const branchOf = (branch) => isRecord(branch) ? visitSchema(branch) : structuredClone(branch);
|
|
391
336
|
const visitSchema = (value) => {
|
|
392
|
-
if (!isRecord(value))
|
|
393
|
-
return cloneJsonValue(value);
|
|
394
337
|
const unwrapped = unwrapSingletonAllOf(value);
|
|
395
338
|
const out = {};
|
|
396
339
|
for (const [key, entry] of Object.entries(unwrapped)) {
|
|
@@ -400,19 +343,18 @@ function normalizeOpenAiJsonSchema(schema, strict) {
|
|
|
400
343
|
continue;
|
|
401
344
|
}
|
|
402
345
|
if (strict && (key === "oneOf" || key === "anyOf") && Array.isArray(entry)) {
|
|
403
|
-
const mapped = flattenStrictAnyOf(entry.map(
|
|
346
|
+
const mapped = flattenStrictAnyOf(entry.map(branchOf));
|
|
404
347
|
out.anyOf = Array.isArray(out.anyOf) ? [...out.anyOf, ...mapped] : mapped;
|
|
405
348
|
continue;
|
|
406
349
|
}
|
|
407
|
-
out
|
|
350
|
+
setOwnMember(out, key, mapSubschemaValue(key, entry, rewrite));
|
|
408
351
|
}
|
|
409
352
|
if (strict && isObjectSchemaType(out.type)) {
|
|
410
353
|
closeStrictObjectJsonSchema(out);
|
|
411
354
|
}
|
|
412
355
|
return out;
|
|
413
356
|
};
|
|
414
|
-
|
|
415
|
-
return isRecord(normalized) ? normalized : {};
|
|
357
|
+
return visitSchema(schema);
|
|
416
358
|
}
|
|
417
359
|
function stripStrictOptionalNulls(parsed, originalInputSchema) {
|
|
418
360
|
if (!isRecord(originalInputSchema))
|
|
@@ -440,7 +382,7 @@ function assertNoRecursiveRefs(root) {
|
|
|
440
382
|
visited.add(ref);
|
|
441
383
|
}
|
|
442
384
|
}
|
|
443
|
-
|
|
385
|
+
eachSubschema(node, (child) => walk(child, false), skipDefContainers ? isDefinitionMap : undefined);
|
|
444
386
|
};
|
|
445
387
|
walk(root, true);
|
|
446
388
|
visiting.delete("#");
|
|
@@ -462,9 +404,12 @@ function assertNoRecursiveRefs(root) {
|
|
|
462
404
|
}
|
|
463
405
|
function prepareAnthropicJsonSchema(schema) {
|
|
464
406
|
assertNoRecursiveRefs(schema);
|
|
407
|
+
const rewrite = {
|
|
408
|
+
schema: (node) => visitSchema(node),
|
|
409
|
+
literal: structuredClone
|
|
410
|
+
};
|
|
411
|
+
const branchOf = (branch) => isRecord(branch) ? visitSchema(branch) : structuredClone(branch);
|
|
465
412
|
const visitSchema = (value) => {
|
|
466
|
-
if (!isRecord(value))
|
|
467
|
-
return cloneJsonValue(value);
|
|
468
413
|
const unwrapped = unwrapSingletonAllOf(value);
|
|
469
414
|
const out = {};
|
|
470
415
|
const constraintNotes = [];
|
|
@@ -476,11 +421,11 @@ function prepareAnthropicJsonSchema(schema) {
|
|
|
476
421
|
continue;
|
|
477
422
|
}
|
|
478
423
|
if ((key === "oneOf" || key === "anyOf") && Array.isArray(entry)) {
|
|
479
|
-
const mapped = flattenStrictAnyOf(entry.map(
|
|
424
|
+
const mapped = flattenStrictAnyOf(entry.map(branchOf));
|
|
480
425
|
out.anyOf = Array.isArray(out.anyOf) ? [...out.anyOf, ...mapped] : mapped;
|
|
481
426
|
continue;
|
|
482
427
|
}
|
|
483
|
-
out
|
|
428
|
+
setOwnMember(out, key, mapSubschemaValue(key, entry, rewrite));
|
|
484
429
|
}
|
|
485
430
|
if (constraintNotes.length > 0) {
|
|
486
431
|
const existing = typeof out.description === "string" ? out.description : "";
|
|
@@ -495,8 +440,7 @@ function prepareAnthropicJsonSchema(schema) {
|
|
|
495
440
|
}
|
|
496
441
|
return out;
|
|
497
442
|
};
|
|
498
|
-
|
|
499
|
-
return isRecord(prepared) ? prepared : {};
|
|
443
|
+
return visitSchema(schema);
|
|
500
444
|
}
|
|
501
445
|
|
|
502
446
|
export { isObjectSchemaType, normalizeOpenAiJsonSchema, stripStrictOptionalNulls, prepareAnthropicJsonSchema };
|
|
@@ -31,16 +31,31 @@ function resolveSocketIp2(req, server) {
|
|
|
31
31
|
return req.ip;
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
+
function unmapIpv4(address) {
|
|
35
|
+
return address.trim().replace(/^::ffff:/i, "");
|
|
36
|
+
}
|
|
37
|
+
function isIpAddress(value) {
|
|
38
|
+
return parseIpv4(value) !== undefined || parseIpv6(value) !== undefined;
|
|
39
|
+
}
|
|
34
40
|
function extractIp2(req, options = {}) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
const peer = unmapIpv4(options.socketIp ?? "");
|
|
42
|
+
const policy = options.trustProxy;
|
|
43
|
+
if (!policy || !peer || !policy.trustedPeer(peer))
|
|
44
|
+
return peer;
|
|
45
|
+
const forwarded = req.headers.get("x-forwarded-for");
|
|
46
|
+
if (!forwarded)
|
|
47
|
+
return peer;
|
|
48
|
+
const hops = forwarded.split(",").map(unmapIpv4);
|
|
49
|
+
let client = peer;
|
|
50
|
+
for (let index = hops.length - 1;index >= 0; index -= 1) {
|
|
51
|
+
const hop = hops[index] ?? "";
|
|
52
|
+
if (!isIpAddress(hop))
|
|
53
|
+
return "";
|
|
54
|
+
client = hop;
|
|
55
|
+
if (!policy.trustedPeer(hop))
|
|
56
|
+
return client;
|
|
42
57
|
}
|
|
43
|
-
return
|
|
58
|
+
return client;
|
|
44
59
|
}
|
|
45
60
|
function getClientInfo2(req, options = {}) {
|
|
46
61
|
return {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeError2,
|
|
3
|
-
validateDeclaredOutput
|
|
4
|
-
} from "./index-78da4g74.js";
|
|
5
1
|
import {
|
|
6
2
|
localVerdict
|
|
7
3
|
} from "./index-dsa676h8.js";
|
|
@@ -9,20 +5,24 @@ import {
|
|
|
9
5
|
objectShapeKeys,
|
|
10
6
|
rebuildObject,
|
|
11
7
|
mergeSchemas
|
|
12
|
-
} from "./index-
|
|
8
|
+
} from "./index-dm50x3by.js";
|
|
13
9
|
import {
|
|
14
10
|
coerceJsonArgs2
|
|
15
|
-
} from "./index-
|
|
11
|
+
} from "./index-qj0sq69b.js";
|
|
16
12
|
import {
|
|
17
13
|
applyToolViewDefaults,
|
|
18
14
|
projectToolView,
|
|
19
15
|
assertToolExtensionCompatible,
|
|
20
16
|
projectToolSurface
|
|
21
|
-
} from "./index-
|
|
17
|
+
} from "./index-edpkm3k7.js";
|
|
22
18
|
import {
|
|
23
19
|
runWithRequestContext2,
|
|
24
20
|
getRequestContext2
|
|
25
|
-
} from "./index-
|
|
21
|
+
} from "./index-q4tr9vnf.js";
|
|
22
|
+
import {
|
|
23
|
+
normalizeError2,
|
|
24
|
+
validateDeclaredOutput
|
|
25
|
+
} from "./index-dwq6a6sq.js";
|
|
26
26
|
import {
|
|
27
27
|
projectedToolError
|
|
28
28
|
} from "./index-dacxr7nf.js";
|
|
@@ -236,6 +236,88 @@ function parseToolCallArguments(method, callArgs, {
|
|
|
236
236
|
return { ok: true, params, input };
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
// src/tools/execute-handler.ts
|
|
240
|
+
async function invokeToolHandler(method, ctx, input, source, {
|
|
241
|
+
lifecycle,
|
|
242
|
+
onOutputStrip,
|
|
243
|
+
finalizeOutput,
|
|
244
|
+
toolSurface
|
|
245
|
+
}) {
|
|
246
|
+
if (lifecycle?.beforeHandle) {
|
|
247
|
+
await lifecycle.beforeHandle(ctx, method);
|
|
248
|
+
}
|
|
249
|
+
let data = await method.handler(ctx);
|
|
250
|
+
if (method.stream !== undefined)
|
|
251
|
+
return { ok: true, data };
|
|
252
|
+
if (lifecycle?.afterHandle) {
|
|
253
|
+
const transformed = await lifecycle.afterHandle(ctx, data, method);
|
|
254
|
+
if (transformed !== undefined)
|
|
255
|
+
data = transformed;
|
|
256
|
+
}
|
|
257
|
+
const checked = validateDeclaredOutput(method.outputSchema, data, onOutputStrip);
|
|
258
|
+
if (checked.ok) {
|
|
259
|
+
data = checked.data;
|
|
260
|
+
} else {
|
|
261
|
+
const verdict = checked.error && method.outputSchema ? localVerdict(method.outputSchema, checked.error) : undefined;
|
|
262
|
+
if (verdict !== null) {
|
|
263
|
+
const message = verdict && verdict !== checked.error ? `Handler output does not match the contract: ${formatZodError2(verdict)}` : checked.message;
|
|
264
|
+
return {
|
|
265
|
+
ok: false,
|
|
266
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
267
|
+
details: { message }
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (toolSurface && method.toolView && method.outputSchema) {
|
|
272
|
+
const viewed = projectToolView({
|
|
273
|
+
view: method.toolView,
|
|
274
|
+
fullSchema: method.outputSchema,
|
|
275
|
+
full: data,
|
|
276
|
+
call: { input, source },
|
|
277
|
+
operation: `${method.serviceName}.${method.key}`,
|
|
278
|
+
onStripped: onOutputStrip
|
|
279
|
+
});
|
|
280
|
+
if (!viewed.ok) {
|
|
281
|
+
return {
|
|
282
|
+
ok: false,
|
|
283
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
284
|
+
details: { message: viewed.message }
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
data = viewed.data;
|
|
288
|
+
}
|
|
289
|
+
if (finalizeOutput)
|
|
290
|
+
data = await finalizeOutput(data);
|
|
291
|
+
const output = (data === undefined || data === null) && !method.outputSchema ? { status: "ok" } : data;
|
|
292
|
+
return { ok: true, data: output };
|
|
293
|
+
}
|
|
294
|
+
async function resolveToolExtension(extension, keys, rawArgs, context) {
|
|
295
|
+
const extensionArgs = Object.fromEntries(Object.entries(rawArgs).filter(([key]) => keys.has(key)));
|
|
296
|
+
let parsed;
|
|
297
|
+
try {
|
|
298
|
+
parsed = extension.schema.safeParse(extensionArgs);
|
|
299
|
+
} catch (err) {
|
|
300
|
+
return { thrown: err };
|
|
301
|
+
}
|
|
302
|
+
if (!parsed.success)
|
|
303
|
+
return { invalid: formatZodError2(parsed.error) };
|
|
304
|
+
try {
|
|
305
|
+
const resolved = await extension.resolve({ ...rawArgs, ...parsed.data });
|
|
306
|
+
return {
|
|
307
|
+
context: {
|
|
308
|
+
...context,
|
|
309
|
+
...resolved,
|
|
310
|
+
source: context.source,
|
|
311
|
+
...context.mcp !== undefined && { mcp: context.mcp },
|
|
312
|
+
...context.toolCallId !== undefined && { toolCallId: context.toolCallId }
|
|
313
|
+
},
|
|
314
|
+
args: Object.fromEntries(Object.entries(rawArgs).filter(([key]) => !keys.has(key)))
|
|
315
|
+
};
|
|
316
|
+
} catch (err) {
|
|
317
|
+
return { thrown: err };
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
239
321
|
// src/tools/execute-result.ts
|
|
240
322
|
var normalizedToolErrors = new WeakMap;
|
|
241
323
|
function toolResultFromError(err) {
|
|
@@ -324,86 +406,6 @@ function inToolCallContext(call, body) {
|
|
|
324
406
|
action: call.method.key
|
|
325
407
|
}, body);
|
|
326
408
|
}
|
|
327
|
-
async function invokeToolHandler(method, ctx, input, source, {
|
|
328
|
-
lifecycle,
|
|
329
|
-
onOutputStrip,
|
|
330
|
-
finalizeOutput,
|
|
331
|
-
toolSurface
|
|
332
|
-
}) {
|
|
333
|
-
if (lifecycle?.beforeHandle) {
|
|
334
|
-
await lifecycle.beforeHandle(ctx, method);
|
|
335
|
-
}
|
|
336
|
-
let data = await method.handler(ctx);
|
|
337
|
-
if (method.stream !== undefined)
|
|
338
|
-
return { ok: true, data };
|
|
339
|
-
if (lifecycle?.afterHandle) {
|
|
340
|
-
const transformed = await lifecycle.afterHandle(ctx, data, method);
|
|
341
|
-
if (transformed !== undefined)
|
|
342
|
-
data = transformed;
|
|
343
|
-
}
|
|
344
|
-
const checked = validateDeclaredOutput(method.outputSchema, data, onOutputStrip);
|
|
345
|
-
if (checked.ok) {
|
|
346
|
-
data = checked.data;
|
|
347
|
-
} else {
|
|
348
|
-
const verdict = checked.error && method.outputSchema ? localVerdict(method.outputSchema, checked.error) : undefined;
|
|
349
|
-
if (verdict !== null) {
|
|
350
|
-
const message = verdict && verdict !== checked.error ? `Handler output does not match the contract: ${formatZodError2(verdict)}` : checked.message;
|
|
351
|
-
return {
|
|
352
|
-
ok: false,
|
|
353
|
-
code: "INTERNAL_SERVER_ERROR",
|
|
354
|
-
details: { message }
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (toolSurface && method.toolView && method.outputSchema) {
|
|
359
|
-
const viewed = projectToolView({
|
|
360
|
-
view: method.toolView,
|
|
361
|
-
fullSchema: method.outputSchema,
|
|
362
|
-
full: data,
|
|
363
|
-
call: { input, source },
|
|
364
|
-
operation: `${method.serviceName}.${method.key}`,
|
|
365
|
-
onStripped: onOutputStrip
|
|
366
|
-
});
|
|
367
|
-
if (!viewed.ok) {
|
|
368
|
-
return {
|
|
369
|
-
ok: false,
|
|
370
|
-
code: "INTERNAL_SERVER_ERROR",
|
|
371
|
-
details: { message: viewed.message }
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
data = viewed.data;
|
|
375
|
-
}
|
|
376
|
-
if (finalizeOutput)
|
|
377
|
-
data = await finalizeOutput(data);
|
|
378
|
-
const output = (data === undefined || data === null) && !method.outputSchema ? { status: "ok" } : data;
|
|
379
|
-
return { ok: true, data: output };
|
|
380
|
-
}
|
|
381
|
-
async function resolveToolExtension(extension, keys, rawArgs, context) {
|
|
382
|
-
const extensionArgs = Object.fromEntries(Object.entries(rawArgs).filter(([key]) => keys.has(key)));
|
|
383
|
-
let parsed;
|
|
384
|
-
try {
|
|
385
|
-
parsed = extension.schema.safeParse(extensionArgs);
|
|
386
|
-
} catch (err) {
|
|
387
|
-
return { thrown: err };
|
|
388
|
-
}
|
|
389
|
-
if (!parsed.success)
|
|
390
|
-
return { invalid: formatZodError2(parsed.error) };
|
|
391
|
-
try {
|
|
392
|
-
const resolved = await extension.resolve({ ...rawArgs, ...parsed.data });
|
|
393
|
-
return {
|
|
394
|
-
context: {
|
|
395
|
-
...context,
|
|
396
|
-
...resolved,
|
|
397
|
-
source: context.source,
|
|
398
|
-
...context.mcp !== undefined && { mcp: context.mcp },
|
|
399
|
-
...context.toolCallId !== undefined && { toolCallId: context.toolCallId }
|
|
400
|
-
},
|
|
401
|
-
args: Object.fromEntries(Object.entries(rawArgs).filter(([key]) => !keys.has(key)))
|
|
402
|
-
};
|
|
403
|
-
} catch (err) {
|
|
404
|
-
return { thrown: err };
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
409
|
async function runToolMethod(method, { toolName, rawArgs, context }, {
|
|
408
410
|
hooks,
|
|
409
411
|
lifecycle,
|
|
@@ -220,108 +220,6 @@ var CodexThreadRevertResponseSchema = z.looseObject({
|
|
|
220
220
|
turnsBackwardsCursor: z.string().nullable().optional(),
|
|
221
221
|
itemsBackwardsCursor: z.string().nullable().optional()
|
|
222
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
223
|
|
|
326
224
|
// src/agent-executor/codex/capabilities.ts
|
|
327
225
|
function codexDriverCapabilities(options) {
|
|
@@ -346,4 +244,4 @@ function codexSharedServerCapabilities(driver) {
|
|
|
346
244
|
return { ...driver, multiThreadPerProcess: true };
|
|
347
245
|
}
|
|
348
246
|
|
|
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,
|
|
247
|
+
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, codexDriverCapabilities, codexSharedServerCapabilities };
|