@namzu/sdk 30.2.0 → 31.1.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 +562 -0
- package/README.md +43 -2
- package/dist/advisory/executor.d.ts +2 -1
- package/dist/advisory/executor.d.ts.map +1 -1
- package/dist/advisory/executor.js +4 -1
- package/dist/advisory/executor.js.map +1 -1
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +12 -0
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/RouterAgent.d.ts.map +1 -1
- package/dist/agents/RouterAgent.js +21 -3
- package/dist/agents/RouterAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +34 -11
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/agents/runAgent.d.ts +12 -0
- package/dist/agents/runAgent.d.ts.map +1 -1
- package/dist/agents/runAgent.js +26 -2
- package/dist/agents/runAgent.js.map +1 -1
- package/dist/authorization/command-line.d.ts +81 -0
- package/dist/authorization/command-line.d.ts.map +1 -0
- package/dist/authorization/command-line.js +347 -0
- package/dist/authorization/command-line.js.map +1 -0
- package/dist/authorization/rules.d.ts.map +1 -1
- package/dist/authorization/rules.js +22 -1
- package/dist/authorization/rules.js.map +1 -1
- package/dist/bridge/a2a/client.d.ts +23 -5
- package/dist/bridge/a2a/client.d.ts.map +1 -1
- package/dist/bridge/a2a/client.js +320 -73
- package/dist/bridge/a2a/client.js.map +1 -1
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +4 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/acp/server.d.ts +13 -1
- package/dist/bridge/acp/server.d.ts.map +1 -1
- package/dist/bridge/acp/server.js +150 -44
- package/dist/bridge/acp/server.js.map +1 -1
- package/dist/bridge/mcp/connector/adapter.d.ts +3 -2
- package/dist/bridge/mcp/connector/adapter.d.ts.map +1 -1
- package/dist/bridge/mcp/connector/adapter.js +17 -21
- package/dist/bridge/mcp/connector/adapter.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +3 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/compaction/dangling.d.ts +29 -2
- package/dist/compaction/dangling.d.ts.map +1 -1
- package/dist/compaction/dangling.js +172 -35
- package/dist/compaction/dangling.js.map +1 -1
- package/dist/compaction/index.d.ts +3 -2
- package/dist/compaction/index.d.ts.map +1 -1
- package/dist/compaction/index.js +1 -1
- package/dist/compaction/index.js.map +1 -1
- package/dist/compaction/manual.d.ts +11 -1
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +89 -14
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/plan.d.ts +19 -6
- package/dist/compaction/plan.d.ts.map +1 -1
- package/dist/compaction/plan.js +18 -4
- package/dist/compaction/plan.js.map +1 -1
- package/dist/compaction/retention.d.ts +10 -7
- package/dist/compaction/retention.d.ts.map +1 -1
- package/dist/compaction/retention.js +26 -8
- package/dist/compaction/retention.js.map +1 -1
- package/dist/compaction/summary.d.ts +4 -4
- package/dist/compaction/summary.js +4 -4
- package/dist/compaction/verifier.d.ts +19 -1
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +20 -1
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/config/runtime.d.ts +6 -6
- package/dist/connector/BaseConnector.d.ts +6 -4
- package/dist/connector/BaseConnector.d.ts.map +1 -1
- package/dist/connector/BaseConnector.js +8 -2
- package/dist/connector/BaseConnector.js.map +1 -1
- package/dist/connector/builtins/http.d.ts +16 -4
- package/dist/connector/builtins/http.d.ts.map +1 -1
- package/dist/connector/builtins/http.js +177 -44
- package/dist/connector/builtins/http.js.map +1 -1
- package/dist/connector/builtins/webhook.d.ts +15 -4
- package/dist/connector/builtins/webhook.d.ts.map +1 -1
- package/dist/connector/builtins/webhook.js +165 -45
- package/dist/connector/builtins/webhook.js.map +1 -1
- package/dist/connector/execution-contract.d.ts +11 -0
- package/dist/connector/execution-contract.d.ts.map +1 -0
- package/dist/connector/execution-contract.js +14 -0
- package/dist/connector/execution-contract.js.map +1 -0
- package/dist/connector/http-operation.d.ts +48 -0
- package/dist/connector/http-operation.d.ts.map +1 -0
- package/dist/connector/http-operation.js +205 -0
- package/dist/connector/http-operation.js.map +1 -0
- package/dist/connector/mcp/adapter.d.ts.map +1 -1
- package/dist/connector/mcp/adapter.js +8 -3
- package/dist/connector/mcp/adapter.js.map +1 -1
- package/dist/connector/mcp/client.d.ts +14 -8
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +160 -44
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/http-sse.d.ts +8 -2
- package/dist/connector/mcp/http-sse.d.ts.map +1 -1
- package/dist/connector/mcp/http-sse.js +70 -17
- package/dist/connector/mcp/http-sse.js.map +1 -1
- package/dist/connector/mcp/prompt-adapter.d.ts.map +1 -1
- package/dist/connector/mcp/prompt-adapter.js +9 -2
- package/dist/connector/mcp/prompt-adapter.js.map +1 -1
- package/dist/connector/mcp/stdio.d.ts +2 -2
- package/dist/connector/mcp/stdio.d.ts.map +1 -1
- package/dist/connector/mcp/stdio.js +14 -50
- package/dist/connector/mcp/stdio.js.map +1 -1
- package/dist/connector/mcp/streamable-http.d.ts +7 -2
- package/dist/connector/mcp/streamable-http.d.ts.map +1 -1
- package/dist/connector/mcp/streamable-http.js +66 -18
- package/dist/connector/mcp/streamable-http.js.map +1 -1
- package/dist/connector/tools/adapter.d.ts +2 -2
- package/dist/connector/tools/adapter.d.ts.map +1 -1
- package/dist/connector/tools/adapter.js +23 -14
- package/dist/connector/tools/adapter.js.map +1 -1
- package/dist/connector/tools/definitions.d.ts.map +1 -1
- package/dist/connector/tools/definitions.js +5 -2
- package/dist/connector/tools/definitions.js.map +1 -1
- package/dist/connector/tools/result.d.ts +4 -0
- package/dist/connector/tools/result.d.ts.map +1 -0
- package/dist/connector/tools/result.js +20 -0
- package/dist/connector/tools/result.js.map +1 -0
- package/dist/connector/web/guarded-fetch.d.ts +4 -2
- package/dist/connector/web/guarded-fetch.d.ts.map +1 -1
- package/dist/connector/web/guarded-fetch.js +157 -43
- package/dist/connector/web/guarded-fetch.js.map +1 -1
- package/dist/constants/sandbox/index.d.ts +3 -2
- package/dist/constants/sandbox/index.d.ts.map +1 -1
- package/dist/constants/sandbox/index.js +3 -2
- package/dist/constants/sandbox/index.js.map +1 -1
- package/dist/contracts/api.d.ts +2 -0
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/schemas.d.ts +38 -12
- package/dist/contracts/schemas.d.ts.map +1 -1
- package/dist/contracts/schemas.js +7 -0
- package/dist/contracts/schemas.js.map +1 -1
- package/dist/directory/derive-supervisor.d.ts.map +1 -1
- package/dist/directory/derive-supervisor.js +8 -0
- package/dist/directory/derive-supervisor.js.map +1 -1
- package/dist/directory/derive.d.ts.map +1 -1
- package/dist/directory/derive.js +8 -0
- package/dist/directory/derive.js.map +1 -1
- package/dist/directory/load.d.ts.map +1 -1
- package/dist/directory/load.js +2 -0
- package/dist/directory/load.js.map +1 -1
- package/dist/directory/types.d.ts +4 -0
- package/dist/directory/types.d.ts.map +1 -1
- package/dist/eval/experiment.d.ts +10 -10
- package/dist/eval/experiment.d.ts.map +1 -1
- package/dist/eval/experiment.js +121 -91
- package/dist/eval/experiment.js.map +1 -1
- package/dist/eval/judge.d.ts +6 -0
- package/dist/eval/judge.d.ts.map +1 -1
- package/dist/eval/judge.js +7 -2
- package/dist/eval/judge.js.map +1 -1
- package/dist/eval/types.d.ts +7 -1
- package/dist/eval/types.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts +12 -10
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +16 -3
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/connector/environment.d.ts +2 -2
- package/dist/manager/connector/environment.d.ts.map +1 -1
- package/dist/manager/connector/environment.js +2 -2
- package/dist/manager/connector/environment.js.map +1 -1
- package/dist/manager/connector/lifecycle.d.ts +10 -2
- package/dist/manager/connector/lifecycle.d.ts.map +1 -1
- package/dist/manager/connector/lifecycle.js +273 -24
- package/dist/manager/connector/lifecycle.js.map +1 -1
- package/dist/manager/connector/tenant.d.ts +5 -4
- package/dist/manager/connector/tenant.d.ts.map +1 -1
- package/dist/manager/connector/tenant.js +47 -22
- package/dist/manager/connector/tenant.js.map +1 -1
- package/dist/manager/goal/activation.d.ts +23 -0
- package/dist/manager/goal/activation.d.ts.map +1 -0
- package/dist/manager/goal/activation.js +41 -0
- package/dist/manager/goal/activation.js.map +1 -0
- package/dist/manager/index.d.ts +3 -2
- package/dist/manager/index.d.ts.map +1 -1
- package/dist/manager/index.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +2 -0
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +5 -1
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/manager/topic/dependency.d.ts +24 -0
- package/dist/manager/topic/dependency.d.ts.map +1 -0
- package/dist/manager/topic/dependency.js +13 -0
- package/dist/manager/topic/dependency.js.map +1 -0
- package/dist/manager/topic/lifecycle.d.ts +9 -21
- package/dist/manager/topic/lifecycle.d.ts.map +1 -1
- package/dist/manager/topic/lifecycle.js +17 -29
- package/dist/manager/topic/lifecycle.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/lifecycle.d.ts +15 -0
- package/dist/plugin/lifecycle.d.ts.map +1 -1
- package/dist/plugin/lifecycle.js +144 -38
- package/dist/plugin/lifecycle.js.map +1 -1
- package/dist/plugin/loader.d.ts +3 -3
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +58 -12
- package/dist/plugin/loader.js.map +1 -1
- package/dist/provider/collect-chat-completion.d.ts.map +1 -1
- package/dist/provider/collect-chat-completion.js +4 -0
- package/dist/provider/collect-chat-completion.js.map +1 -1
- package/dist/provider/fallback.d.ts +3 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +62 -10
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/idle-timeout.d.ts +4 -0
- package/dist/provider/idle-timeout.d.ts.map +1 -1
- package/dist/provider/idle-timeout.js +131 -15
- package/dist/provider/idle-timeout.js.map +1 -1
- package/dist/provider/index.d.ts +2 -0
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +1 -0
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/instrumentation.d.ts.map +1 -1
- package/dist/provider/instrumentation.js +1 -0
- package/dist/provider/instrumentation.js.map +1 -1
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +13 -1
- package/dist/provider/retry.js.map +1 -1
- package/dist/public-runtime.d.ts +57 -24
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +42 -35
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +1 -0
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +5 -0
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +33 -12
- package/dist/public-types.d.ts.map +1 -1
- package/dist/rag/embedding.d.ts +8 -3
- package/dist/rag/embedding.d.ts.map +1 -1
- package/dist/rag/embedding.js +120 -9
- package/dist/rag/embedding.js.map +1 -1
- package/dist/rag/index.d.ts +1 -1
- package/dist/rag/index.d.ts.map +1 -1
- package/dist/rag/index.js +1 -1
- package/dist/rag/index.js.map +1 -1
- package/dist/rag/ingestion.d.ts +2 -2
- package/dist/rag/ingestion.d.ts.map +1 -1
- package/dist/rag/ingestion.js +15 -3
- package/dist/rag/ingestion.js.map +1 -1
- package/dist/rag/knowledge-base.d.ts +3 -3
- package/dist/rag/knowledge-base.d.ts.map +1 -1
- package/dist/rag/knowledge-base.js +8 -4
- package/dist/rag/knowledge-base.js.map +1 -1
- package/dist/rag/operation.d.ts +10 -0
- package/dist/rag/operation.d.ts.map +1 -0
- package/dist/rag/operation.js +26 -0
- package/dist/rag/operation.js.map +1 -0
- package/dist/rag/rag-tool.d.ts.map +1 -1
- package/dist/rag/rag-tool.js +6 -3
- package/dist/rag/rag-tool.js.map +1 -1
- package/dist/rag/retriever.d.ts +2 -2
- package/dist/rag/retriever.d.ts.map +1 -1
- package/dist/rag/retriever.js +31 -15
- package/dist/rag/retriever.js.map +1 -1
- package/dist/rag/vector-store.d.ts +3 -3
- package/dist/rag/vector-store.d.ts.map +1 -1
- package/dist/rag/vector-store.js +4 -2
- package/dist/rag/vector-store.js.map +1 -1
- package/dist/registry/command/kernel-commands.d.ts +16 -4
- package/dist/registry/command/kernel-commands.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.js +171 -0
- package/dist/registry/command/kernel-commands.js.map +1 -1
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +9 -0
- package/dist/run/reporter.js.map +1 -1
- package/dist/run-query/index.d.ts +15 -1
- package/dist/run-query/index.d.ts.map +1 -1
- package/dist/run-query/index.js +69 -15
- package/dist/run-query/index.js.map +1 -1
- package/dist/runtime/query/context.d.ts.map +1 -1
- package/dist/runtime/query/context.js +10 -3
- package/dist/runtime/query/context.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +3 -0
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +80 -18
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/guard.d.ts +9 -0
- package/dist/runtime/query/guard.d.ts.map +1 -1
- package/dist/runtime/query/guard.js +11 -0
- package/dist/runtime/query/guard.js.map +1 -1
- package/dist/runtime/query/index.d.ts +30 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +548 -95
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +74 -14
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +94 -53
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +3 -0
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +21 -0
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +4 -0
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/project-instructions.d.ts +69 -0
- package/dist/runtime/query/project-instructions.d.ts.map +1 -0
- package/dist/runtime/query/project-instructions.js +137 -0
- package/dist/runtime/query/project-instructions.js.map +1 -0
- package/dist/runtime/query/request-rich-content.d.ts +22 -0
- package/dist/runtime/query/request-rich-content.d.ts.map +1 -0
- package/dist/runtime/query/request-rich-content.js +122 -0
- package/dist/runtime/query/request-rich-content.js.map +1 -0
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/runtime/query/result.js +12 -1
- package/dist/runtime/query/result.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +19 -20
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/resume-run.d.ts.map +1 -1
- package/dist/runtime/query/resume-run.js +54 -8
- package/dist/runtime/query/resume-run.js.map +1 -1
- package/dist/runtime/query/run-state.d.ts +5 -0
- package/dist/runtime/query/run-state.d.ts.map +1 -1
- package/dist/runtime/query/run-state.js +6 -1
- package/dist/runtime/query/run-state.js.map +1 -1
- package/dist/runtime/query/sandbox-lifecycle.d.ts +54 -0
- package/dist/runtime/query/sandbox-lifecycle.d.ts.map +1 -0
- package/dist/runtime/query/sandbox-lifecycle.js +167 -0
- package/dist/runtime/query/sandbox-lifecycle.js.map +1 -0
- package/dist/sandbox/isolation.d.ts.map +1 -1
- package/dist/sandbox/isolation.js +9 -0
- package/dist/sandbox/isolation.js.map +1 -1
- package/dist/sandbox/provider/local.d.ts +56 -6
- package/dist/sandbox/provider/local.d.ts.map +1 -1
- package/dist/sandbox/provider/local.js +181 -76
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/sandbox/terminal.d.ts +13 -5
- package/dist/sandbox/terminal.d.ts.map +1 -1
- package/dist/sandbox/terminal.js +11 -3
- package/dist/sandbox/terminal.js.map +1 -1
- package/dist/session/errors.d.ts +28 -29
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/errors.js +28 -29
- package/dist/session/errors.js.map +1 -1
- package/dist/session/handoff/broadcast.d.ts +5 -8
- package/dist/session/handoff/broadcast.d.ts.map +1 -1
- package/dist/session/handoff/broadcast.js +16 -6
- package/dist/session/handoff/broadcast.js.map +1 -1
- package/dist/session/handoff/single.d.ts +5 -8
- package/dist/session/handoff/single.d.ts.map +1 -1
- package/dist/session/handoff/single.js +7 -4
- package/dist/session/handoff/single.js.map +1 -1
- package/dist/store/attachment/index.d.ts +11 -3
- package/dist/store/attachment/index.d.ts.map +1 -1
- package/dist/store/attachment/index.js +49 -4
- package/dist/store/attachment/index.js.map +1 -1
- package/dist/store/feedback/conformance.d.ts.map +1 -1
- package/dist/store/feedback/conformance.js +32 -0
- package/dist/store/feedback/conformance.js.map +1 -1
- package/dist/store/feedback/disk.d.ts +8 -6
- package/dist/store/feedback/disk.d.ts.map +1 -1
- package/dist/store/feedback/disk.js +111 -76
- package/dist/store/feedback/disk.js.map +1 -1
- package/dist/store/goal/index.d.ts +111 -0
- package/dist/store/goal/index.d.ts.map +1 -0
- package/dist/store/goal/index.js +436 -0
- package/dist/store/goal/index.js.map +1 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/index.js.map +1 -1
- package/dist/store/kv/revision-record-store.d.ts +70 -0
- package/dist/store/kv/revision-record-store.d.ts.map +1 -0
- package/dist/store/kv/revision-record-store.js +290 -0
- package/dist/store/kv/revision-record-store.js.map +1 -0
- package/dist/store/memory/disk.d.ts +9 -7
- package/dist/store/memory/disk.d.ts.map +1 -1
- package/dist/store/memory/disk.js +256 -98
- package/dist/store/memory/disk.js.map +1 -1
- package/dist/store/run/disk.d.ts +10 -2
- package/dist/store/run/disk.d.ts.map +1 -1
- package/dist/store/run/disk.js +70 -4
- package/dist/store/run/disk.js.map +1 -1
- package/dist/store/run/memory.d.ts +4 -2
- package/dist/store/run/memory.d.ts.map +1 -1
- package/dist/store/run/memory.js +15 -1
- package/dist/store/run/memory.js.map +1 -1
- package/dist/store/session/disk.d.ts +9 -0
- package/dist/store/session/disk.d.ts.map +1 -1
- package/dist/store/session/disk.js +57 -5
- package/dist/store/session/disk.js.map +1 -1
- package/dist/store/session/memory.d.ts +1 -0
- package/dist/store/session/memory.d.ts.map +1 -1
- package/dist/store/session/memory.js +14 -0
- package/dist/store/session/memory.js.map +1 -1
- package/dist/store/topic/memory.d.ts +1 -2
- package/dist/store/topic/memory.d.ts.map +1 -1
- package/dist/store/topic/memory.js +4 -5
- package/dist/store/topic/memory.js.map +1 -1
- package/dist/store/topic/objective.d.ts +8 -4
- package/dist/store/topic/objective.d.ts.map +1 -1
- package/dist/store/topic/objective.js +185 -100
- package/dist/store/topic/objective.js.map +1 -1
- package/dist/store/topic/state.d.ts +1 -2
- package/dist/store/topic/state.d.ts.map +1 -1
- package/dist/store/topic/state.js +50 -62
- package/dist/store/topic/state.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +20 -0
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +9 -1
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/content-fingerprint.d.ts +8 -7
- package/dist/tools/builtins/content-fingerprint.d.ts.map +1 -1
- package/dist/tools/builtins/content-fingerprint.js +9 -10
- package/dist/tools/builtins/content-fingerprint.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts +6 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +166 -27
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +45 -19
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/command-arguments.d.ts +43 -0
- package/dist/tools/command-arguments.d.ts.map +1 -0
- package/dist/tools/command-arguments.js +52 -0
- package/dist/tools/command-arguments.js.map +1 -0
- package/dist/tools/coordinator/index.d.ts +2 -0
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +3 -1
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/defineTool.d.ts +10 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +1 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/env-scrub.d.ts +7 -5
- package/dist/tools/env-scrub.d.ts.map +1 -1
- package/dist/tools/env-scrub.js +7 -5
- package/dist/tools/env-scrub.js.map +1 -1
- package/dist/tools/goal/index.d.ts +20 -0
- package/dist/tools/goal/index.d.ts.map +1 -0
- package/dist/tools/goal/index.js +104 -0
- package/dist/tools/goal/index.js.map +1 -0
- package/dist/tools/memory/index.d.ts +16 -0
- package/dist/tools/memory/index.d.ts.map +1 -1
- package/dist/tools/memory/index.js +6 -2
- package/dist/tools/memory/index.js.map +1 -1
- package/dist/tools/memory/search.d.ts +4 -1
- package/dist/tools/memory/search.d.ts.map +1 -1
- package/dist/tools/memory/search.js +10 -2
- package/dist/tools/memory/search.js.map +1 -1
- package/dist/types/agent/base.d.ts +11 -3
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/factory.d.ts +2 -0
- package/dist/types/agent/factory.d.ts.map +1 -1
- package/dist/types/agent/reactive.d.ts +2 -0
- package/dist/types/agent/reactive.d.ts.map +1 -1
- package/dist/types/agent/supervisor.d.ts +6 -0
- package/dist/types/agent/supervisor.d.ts.map +1 -1
- package/dist/types/agent/task.d.ts +6 -2
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/connector/core.d.ts +13 -8
- package/dist/types/connector/core.d.ts.map +1 -1
- package/dist/types/connector/definition.d.ts +37 -18
- package/dist/types/connector/definition.d.ts.map +1 -1
- package/dist/types/connector/http.d.ts +6 -0
- package/dist/types/connector/http.d.ts.map +1 -1
- package/dist/types/connector/mcp.d.ts +24 -6
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/connector/tenant.d.ts +17 -7
- package/dist/types/connector/tenant.d.ts.map +1 -1
- package/dist/types/connector/webhook.d.ts +6 -0
- package/dist/types/connector/webhook.d.ts.map +1 -1
- package/dist/types/goal/index.d.ts +46 -0
- package/dist/types/goal/index.d.ts.map +1 -0
- package/dist/types/goal/index.js +2 -0
- package/dist/types/goal/index.js.map +1 -0
- package/dist/types/ids/index.d.ts +2 -0
- package/dist/types/ids/index.d.ts.map +1 -1
- package/dist/types/ids/index.js.map +1 -1
- package/dist/types/message/index.d.ts +79 -13
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +49 -3
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +7 -5
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/provider/chat.d.ts +27 -4
- package/dist/types/provider/chat.d.ts.map +1 -1
- package/dist/types/provider/index.d.ts +1 -1
- package/dist/types/provider/index.d.ts.map +1 -1
- package/dist/types/provider/interface.d.ts +18 -7
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/provider/model.d.ts +12 -0
- package/dist/types/provider/model.d.ts.map +1 -1
- package/dist/types/provider/stream.d.ts +6 -0
- package/dist/types/provider/stream.d.ts.map +1 -1
- package/dist/types/rag/embedding.d.ts +15 -2
- package/dist/types/rag/embedding.d.ts.map +1 -1
- package/dist/types/rag/ingestion.d.ts +2 -2
- package/dist/types/rag/ingestion.d.ts.map +1 -1
- package/dist/types/rag/knowledge-base.d.ts +3 -3
- package/dist/types/rag/knowledge-base.d.ts.map +1 -1
- package/dist/types/rag/retrieval.d.ts +2 -2
- package/dist/types/rag/retrieval.d.ts.map +1 -1
- package/dist/types/rag/scope.d.ts +4 -0
- package/dist/types/rag/scope.d.ts.map +1 -1
- package/dist/types/rag/vector.d.ts +5 -2
- package/dist/types/rag/vector.d.ts.map +1 -1
- package/dist/types/run/config.d.ts +20 -0
- package/dist/types/run/config.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +25 -1
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/run/metadata.d.ts +2 -0
- package/dist/types/run/metadata.d.ts.map +1 -1
- package/dist/types/run/step.d.ts +2 -6
- package/dist/types/run/step.d.ts.map +1 -1
- package/dist/types/run/step.js.map +1 -1
- package/dist/types/run/store.d.ts +55 -2
- package/dist/types/run/store.d.ts.map +1 -1
- package/dist/types/sandbox/index.d.ts +47 -6
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js +23 -10
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/session/store.d.ts +13 -0
- package/dist/types/session/store.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +33 -11
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/topic/entity.d.ts +3 -4
- package/dist/types/topic/entity.d.ts.map +1 -1
- package/dist/types/topic/store.d.ts +3 -3
- package/dist/utils/id.d.ts +3 -1
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +4 -0
- package/dist/utils/id.js.map +1 -1
- package/dist/utils/process-environment.d.ts +26 -0
- package/dist/utils/process-environment.d.ts.map +1 -0
- package/dist/utils/process-environment.js +78 -0
- package/dist/utils/process-environment.js.map +1 -0
- package/dist/vault/InMemoryCredentialVault.d.ts +2 -0
- package/dist/vault/InMemoryCredentialVault.d.ts.map +1 -1
- package/dist/vault/InMemoryCredentialVault.js +24 -4
- package/dist/vault/InMemoryCredentialVault.js.map +1 -1
- package/dist/vault/instrumentation.d.ts.map +1 -1
- package/dist/vault/instrumentation.js +15 -0
- package/dist/vault/instrumentation.js.map +1 -1
- package/package.json +1 -1
- package/src/advisory/executor.ts +4 -1
- package/src/agents/ReactiveAgent.ts +12 -0
- package/src/agents/RouterAgent.ts +25 -3
- package/src/agents/SupervisorAgent.ts +33 -11
- package/src/agents/runAgent.ts +38 -2
- package/src/authorization/command-line.ts +390 -0
- package/src/authorization/rules.ts +22 -1
- package/src/bridge/a2a/client.ts +384 -97
- package/src/bridge/a2a/mapper.ts +5 -0
- package/src/bridge/acp/server.ts +184 -42
- package/src/bridge/mcp/connector/adapter.ts +28 -20
- package/src/bridge/sse/mapper.ts +3 -0
- package/src/compaction/dangling.ts +203 -38
- package/src/compaction/index.ts +9 -2
- package/src/compaction/manual.ts +125 -18
- package/src/compaction/plan.ts +42 -11
- package/src/compaction/retention.ts +23 -8
- package/src/compaction/summary.ts +4 -4
- package/src/compaction/verifier.ts +66 -0
- package/src/connector/BaseConnector.ts +19 -4
- package/src/connector/builtins/http.ts +236 -46
- package/src/connector/builtins/webhook.ts +207 -47
- package/src/connector/execution-contract.ts +27 -0
- package/src/connector/http-operation.ts +238 -0
- package/src/connector/mcp/adapter.ts +8 -3
- package/src/connector/mcp/client.ts +207 -58
- package/src/connector/mcp/http-sse.ts +91 -23
- package/src/connector/mcp/prompt-adapter.ts +8 -2
- package/src/connector/mcp/stdio.ts +21 -46
- package/src/connector/mcp/streamable-http.ts +86 -22
- package/src/connector/tools/adapter.ts +23 -14
- package/src/connector/tools/definitions.ts +5 -2
- package/src/connector/tools/result.ts +21 -0
- package/src/connector/web/guarded-fetch.ts +188 -48
- package/src/constants/sandbox/index.ts +3 -2
- package/src/contracts/api.ts +2 -0
- package/src/contracts/schemas.ts +7 -0
- package/src/directory/derive-supervisor.ts +8 -0
- package/src/directory/derive.ts +8 -0
- package/src/directory/load.ts +2 -0
- package/src/directory/types.ts +4 -0
- package/src/eval/experiment.ts +160 -111
- package/src/eval/judge.ts +13 -2
- package/src/eval/types.ts +7 -1
- package/src/manager/agent/lifecycle.ts +28 -12
- package/src/manager/connector/environment.ts +3 -1
- package/src/manager/connector/lifecycle.ts +364 -24
- package/src/manager/connector/tenant.ts +56 -23
- package/src/manager/goal/activation.ts +52 -0
- package/src/manager/index.ts +10 -2
- package/src/manager/run/persistence.ts +6 -1
- package/src/manager/topic/dependency.ts +39 -0
- package/src/manager/topic/lifecycle.ts +19 -31
- package/src/plugin/index.ts +1 -0
- package/src/plugin/lifecycle.ts +180 -39
- package/src/plugin/loader.ts +70 -13
- package/src/provider/collect-chat-completion.ts +3 -0
- package/src/provider/fallback.ts +79 -11
- package/src/provider/idle-timeout.ts +143 -17
- package/src/provider/index.ts +2 -0
- package/src/provider/instrumentation.ts +1 -0
- package/src/provider/retry.ts +16 -1
- package/src/public-runtime.ts +190 -32
- package/src/public-tools.ts +5 -0
- package/src/public-types.ts +85 -11
- package/src/rag/embedding.ts +147 -19
- package/src/rag/index.ts +1 -1
- package/src/rag/ingestion.ts +16 -2
- package/src/rag/knowledge-base.ts +13 -4
- package/src/rag/operation.ts +28 -0
- package/src/rag/rag-tool.ts +6 -3
- package/src/rag/retriever.ts +62 -11
- package/src/rag/vector-store.ts +8 -2
- package/src/registry/command/kernel-commands.ts +223 -4
- package/src/run/reporter.ts +10 -0
- package/src/run-query/index.ts +84 -15
- package/src/runtime/query/context.ts +13 -3
- package/src/runtime/query/executor.ts +90 -17
- package/src/runtime/query/guard.ts +12 -0
- package/src/runtime/query/index.ts +652 -103
- package/src/runtime/query/iteration/index.ts +89 -13
- package/src/runtime/query/iteration/phases/compaction.ts +120 -55
- package/src/runtime/query/iteration/phases/context.ts +4 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +28 -0
- package/src/runtime/query/iteration/stream-turn.ts +3 -0
- package/src/runtime/query/project-instructions.ts +212 -0
- package/src/runtime/query/request-rich-content.ts +153 -0
- package/src/runtime/query/result.ts +12 -1
- package/src/runtime/query/resume-pending.ts +20 -18
- package/src/runtime/query/resume-run.ts +52 -8
- package/src/runtime/query/run-state.ts +11 -1
- package/src/runtime/query/sandbox-lifecycle.ts +210 -0
- package/src/sandbox/isolation.ts +9 -0
- package/src/sandbox/provider/local.ts +255 -90
- package/src/sandbox/terminal.ts +13 -5
- package/src/session/errors.ts +68 -42
- package/src/session/handoff/broadcast.ts +20 -14
- package/src/session/handoff/single.ts +14 -13
- package/src/store/attachment/index.ts +65 -3
- package/src/store/feedback/conformance.ts +39 -0
- package/src/store/feedback/disk.ts +128 -82
- package/src/store/goal/index.ts +594 -0
- package/src/store/index.ts +1 -1
- package/src/store/kv/revision-record-store.ts +346 -0
- package/src/store/memory/disk.ts +288 -113
- package/src/store/run/disk.ts +96 -5
- package/src/store/run/memory.ts +22 -2
- package/src/store/session/disk.ts +93 -6
- package/src/store/session/memory.ts +22 -0
- package/src/store/topic/memory.ts +4 -5
- package/src/store/topic/objective.ts +215 -100
- package/src/store/topic/state.ts +100 -63
- package/src/tools/builtins/bash.ts +21 -0
- package/src/tools/builtins/computer-use.ts +9 -1
- package/src/tools/builtins/content-fingerprint.ts +9 -12
- package/src/tools/builtins/edit.ts +190 -27
- package/src/tools/builtins/write-file.ts +55 -19
- package/src/tools/command-arguments.ts +54 -0
- package/src/tools/coordinator/index.ts +4 -1
- package/src/tools/defineTool.ts +11 -0
- package/src/tools/env-scrub.ts +7 -5
- package/src/tools/goal/index.ts +129 -0
- package/src/tools/memory/index.ts +26 -3
- package/src/tools/memory/search.ts +20 -3
- package/src/types/agent/base.ts +12 -3
- package/src/types/agent/factory.ts +2 -0
- package/src/types/agent/reactive.ts +2 -0
- package/src/types/agent/supervisor.ts +6 -0
- package/src/types/agent/task.ts +6 -2
- package/src/types/connector/core.ts +13 -8
- package/src/types/connector/definition.ts +54 -20
- package/src/types/connector/http.ts +7 -0
- package/src/types/connector/mcp.ts +27 -6
- package/src/types/connector/tenant.ts +21 -7
- package/src/types/connector/webhook.ts +7 -0
- package/src/types/goal/index.ts +50 -0
- package/src/types/ids/index.ts +2 -0
- package/src/types/message/index.ts +147 -12
- package/src/types/plugin/index.ts +7 -5
- package/src/types/provider/chat.ts +35 -4
- package/src/types/provider/index.ts +1 -1
- package/src/types/provider/interface.ts +22 -7
- package/src/types/provider/model.ts +13 -0
- package/src/types/provider/stream.ts +6 -0
- package/src/types/rag/embedding.ts +16 -2
- package/src/types/rag/ingestion.ts +2 -1
- package/src/types/rag/knowledge-base.ts +7 -3
- package/src/types/rag/retrieval.ts +2 -1
- package/src/types/rag/scope.ts +5 -0
- package/src/types/rag/vector.ts +5 -2
- package/src/types/run/config.ts +20 -0
- package/src/types/run/events.ts +28 -3
- package/src/types/run/metadata.ts +2 -0
- package/src/types/run/step.ts +2 -7
- package/src/types/run/store.ts +60 -2
- package/src/types/sandbox/index.ts +57 -14
- package/src/types/session/store.ts +18 -0
- package/src/types/tool/index.ts +33 -11
- package/src/types/topic/entity.ts +3 -4
- package/src/types/topic/store.ts +3 -3
- package/src/utils/id.ts +6 -0
- package/src/utils/process-environment.ts +101 -0
- package/src/vault/InMemoryCredentialVault.ts +29 -4
- package/src/vault/instrumentation.ts +24 -0
|
@@ -2,21 +2,52 @@ import { createHmac } from 'node:crypto'
|
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
import type {
|
|
4
4
|
AuthConfig,
|
|
5
|
+
AuthType,
|
|
5
6
|
ConnectionType,
|
|
6
7
|
ConnectorExecuteResult,
|
|
8
|
+
ConnectorExecutionMetadata,
|
|
7
9
|
ConnectorMethod,
|
|
10
|
+
ConnectorOperationOptions,
|
|
8
11
|
WebhookConnectorConfig,
|
|
9
12
|
WebhookSendInput,
|
|
10
13
|
WebhookSendOutput,
|
|
11
14
|
} from '../../types/connector/index.js'
|
|
12
15
|
import { asConnectorId } from '../../utils/id.js'
|
|
13
16
|
import { BaseConnector } from '../BaseConnector.js'
|
|
17
|
+
import {
|
|
18
|
+
CONNECTOR_HEALTH_TIMEOUT_MS,
|
|
19
|
+
ConnectorHttpOperation,
|
|
20
|
+
DEFAULT_CONNECTOR_MAX_RESPONSE_BYTES,
|
|
21
|
+
DEFAULT_CONNECTOR_REQUEST_TIMEOUT_MS,
|
|
22
|
+
readConnectorResponseBody,
|
|
23
|
+
requireHttpUrl,
|
|
24
|
+
requireSafeConnectorInputHeaders,
|
|
25
|
+
requireSameOrigin,
|
|
26
|
+
validateConnectorMaxResponseBytes,
|
|
27
|
+
validateConnectorTimeoutMs,
|
|
28
|
+
} from '../http-operation.js'
|
|
14
29
|
|
|
15
30
|
const WebhookConnectorConfigSchema = z.object({
|
|
16
|
-
url: z
|
|
31
|
+
url: z
|
|
32
|
+
.string()
|
|
33
|
+
.url()
|
|
34
|
+
.refine((value) => /^https?:/i.test(value), 'url must use http: or https:'),
|
|
17
35
|
secret: z.string().optional(),
|
|
18
36
|
defaultHeaders: z.record(z.string()).optional(),
|
|
19
|
-
|
|
37
|
+
maxResponseBytes: z
|
|
38
|
+
.number()
|
|
39
|
+
.int()
|
|
40
|
+
.positive()
|
|
41
|
+
.max(2_147_483_647)
|
|
42
|
+
.optional()
|
|
43
|
+
.default(DEFAULT_CONNECTOR_MAX_RESPONSE_BYTES),
|
|
44
|
+
timeoutMs: z
|
|
45
|
+
.number()
|
|
46
|
+
.int()
|
|
47
|
+
.positive()
|
|
48
|
+
.max(2_147_483_647)
|
|
49
|
+
.optional()
|
|
50
|
+
.default(DEFAULT_CONNECTOR_REQUEST_TIMEOUT_MS),
|
|
20
51
|
})
|
|
21
52
|
|
|
22
53
|
const WebhookSendInputSchema = z.object({
|
|
@@ -33,6 +64,7 @@ export class WebhookConnector extends BaseConnector<WebhookConnectorConfig> {
|
|
|
33
64
|
readonly name = 'Webhook Connector'
|
|
34
65
|
readonly description = 'Send webhook payloads to configured endpoints with optional HMAC signing'
|
|
35
66
|
readonly connectionType: ConnectionType = 'webhook'
|
|
67
|
+
override readonly supportedAuth: readonly AuthType[] = ['none', 'bearer']
|
|
36
68
|
readonly configSchema = WebhookConnectorConfigSchema
|
|
37
69
|
readonly methods: ConnectorMethod[] = [
|
|
38
70
|
{
|
|
@@ -43,69 +75,97 @@ export class WebhookConnector extends BaseConnector<WebhookConnectorConfig> {
|
|
|
43
75
|
]
|
|
44
76
|
|
|
45
77
|
private url = ''
|
|
78
|
+
private origin = ''
|
|
46
79
|
private secret: string | undefined
|
|
47
80
|
private defaultHeaders: Record<string, string> = {}
|
|
48
|
-
private timeoutMs =
|
|
81
|
+
private timeoutMs = DEFAULT_CONNECTOR_REQUEST_TIMEOUT_MS
|
|
82
|
+
private maxResponseBytes = DEFAULT_CONNECTOR_MAX_RESPONSE_BYTES
|
|
49
83
|
|
|
50
84
|
async connect(config: WebhookConnectorConfig, auth?: AuthConfig): Promise<void> {
|
|
51
|
-
|
|
85
|
+
const validated = WebhookConnectorConfigSchema.parse(config)
|
|
86
|
+
const parsedUrl = requireHttpUrl(validated.url, 'WebhookConnector url')
|
|
87
|
+
this.config = validated
|
|
52
88
|
this.auth = auth
|
|
53
|
-
this.url =
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
89
|
+
this.url = validated.url
|
|
90
|
+
this.origin = parsedUrl.origin
|
|
91
|
+
this.secret = validated.secret
|
|
92
|
+
this.defaultHeaders = { ...(validated.defaultHeaders ?? {}) }
|
|
93
|
+
this.timeoutMs = validateConnectorTimeoutMs(validated.timeoutMs, 'WebhookConnector timeoutMs')
|
|
94
|
+
this.maxResponseBytes = validateConnectorMaxResponseBytes(
|
|
95
|
+
validated.maxResponseBytes,
|
|
96
|
+
'WebhookConnector maxResponseBytes',
|
|
97
|
+
)
|
|
57
98
|
|
|
58
99
|
if (auth?.type === 'bearer' && auth.credentials?.token) {
|
|
59
100
|
this.defaultHeaders.Authorization = `Bearer ${auth.credentials.token}`
|
|
60
101
|
}
|
|
61
102
|
|
|
62
|
-
this.log.info('Webhook connector connected', {
|
|
103
|
+
this.log.info('Webhook connector connected', {
|
|
104
|
+
'namzu.connector.url': this.url,
|
|
105
|
+
})
|
|
63
106
|
}
|
|
64
107
|
|
|
65
108
|
async disconnect(): Promise<void> {
|
|
66
109
|
this.config = null
|
|
67
110
|
this.auth = undefined
|
|
68
111
|
this.url = ''
|
|
112
|
+
this.origin = ''
|
|
69
113
|
this.secret = undefined
|
|
70
114
|
this.defaultHeaders = {}
|
|
71
115
|
this.log.info('Webhook connector disconnected')
|
|
72
116
|
}
|
|
73
117
|
|
|
74
|
-
async healthCheck(): Promise<boolean> {
|
|
118
|
+
async healthCheck(options?: ConnectorOperationOptions): Promise<boolean> {
|
|
75
119
|
if (!this.url) return false
|
|
120
|
+
let operation: ConnectorHttpOperation | undefined
|
|
76
121
|
try {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
122
|
+
operation = new ConnectorHttpOperation(
|
|
123
|
+
options?.signal,
|
|
124
|
+
CONNECTOR_HEALTH_TIMEOUT_MS,
|
|
125
|
+
'Webhook connector health check',
|
|
126
|
+
)
|
|
127
|
+
const activeOperation = operation
|
|
128
|
+
const response = await activeOperation.run(() =>
|
|
129
|
+
fetch(this.url, {
|
|
130
|
+
method: 'HEAD',
|
|
131
|
+
redirect: 'manual',
|
|
132
|
+
signal: activeOperation.signal,
|
|
133
|
+
}),
|
|
134
|
+
)
|
|
84
135
|
return response.ok || response.status < 500
|
|
85
136
|
} catch {
|
|
86
137
|
return false
|
|
138
|
+
} finally {
|
|
139
|
+
operation?.close()
|
|
87
140
|
}
|
|
88
141
|
}
|
|
89
142
|
|
|
90
|
-
async execute(
|
|
143
|
+
async execute(
|
|
144
|
+
method: string,
|
|
145
|
+
input: unknown,
|
|
146
|
+
options?: ConnectorOperationOptions,
|
|
147
|
+
): Promise<ConnectorExecuteResult> {
|
|
91
148
|
this.requireMethod(method)
|
|
92
|
-
const validated = this.validateInput(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
metadata: {
|
|
101
|
-
status: result.status,
|
|
102
|
-
deliveredAt: result.deliveredAt,
|
|
103
|
-
},
|
|
149
|
+
const validated = (await this.validateInput(
|
|
150
|
+
this.requireMethod(method),
|
|
151
|
+
input,
|
|
152
|
+
options,
|
|
153
|
+
)) as WebhookSendInput
|
|
154
|
+
const startedAt = performance.now()
|
|
155
|
+
if (options?.signal?.aborted) {
|
|
156
|
+
return this.notStarted(options.signal.reason, startedAt)
|
|
104
157
|
}
|
|
158
|
+
return this.doSend(validated, options, startedAt)
|
|
105
159
|
}
|
|
106
160
|
|
|
107
|
-
private async doSend(
|
|
161
|
+
private async doSend(
|
|
162
|
+
input: WebhookSendInput,
|
|
163
|
+
options: ConnectorOperationOptions | undefined,
|
|
164
|
+
startedAt: number,
|
|
165
|
+
): Promise<ConnectorExecuteResult> {
|
|
108
166
|
const targetUrl = input.url ?? this.url
|
|
167
|
+
requireSameOrigin(targetUrl, this.origin, 'WebhookConnector request URL')
|
|
168
|
+
requireSafeConnectorInputHeaders(input.headers, 'WebhookConnector request headers')
|
|
109
169
|
const bodyStr = JSON.stringify(input.payload)
|
|
110
170
|
|
|
111
171
|
const headers: Record<string, string> = {
|
|
@@ -119,32 +179,132 @@ export class WebhookConnector extends BaseConnector<WebhookConnectorConfig> {
|
|
|
119
179
|
headers['X-Webhook-Signature'] = `sha256=${signature}`
|
|
120
180
|
}
|
|
121
181
|
|
|
122
|
-
|
|
123
|
-
const timeout = setTimeout(() => controller.abort(), this.timeoutMs)
|
|
182
|
+
let operation: ConnectorHttpOperation | undefined
|
|
124
183
|
|
|
125
184
|
try {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
185
|
+
try {
|
|
186
|
+
operation = new ConnectorHttpOperation(
|
|
187
|
+
options?.signal,
|
|
188
|
+
this.timeoutMs,
|
|
189
|
+
'Webhook connector POST',
|
|
190
|
+
)
|
|
191
|
+
} catch (error) {
|
|
192
|
+
return this.notStarted(error, startedAt)
|
|
193
|
+
}
|
|
194
|
+
let response: Response
|
|
195
|
+
try {
|
|
196
|
+
const activeOperation = operation
|
|
197
|
+
response = await activeOperation.run(() =>
|
|
198
|
+
fetch(targetUrl, {
|
|
199
|
+
method: 'POST',
|
|
200
|
+
headers,
|
|
201
|
+
body: bodyStr,
|
|
202
|
+
redirect: 'manual',
|
|
203
|
+
signal: activeOperation.signal,
|
|
204
|
+
}),
|
|
205
|
+
)
|
|
206
|
+
} catch (error) {
|
|
207
|
+
return this.unknownOutcome(error, startedAt)
|
|
208
|
+
}
|
|
132
209
|
|
|
210
|
+
const deliveredAt = Date.now()
|
|
211
|
+
const metadata: ConnectorExecutionMetadata = {
|
|
212
|
+
status: response.status,
|
|
213
|
+
deliveredAt,
|
|
214
|
+
remoteOutcome: 'response_received',
|
|
215
|
+
retrySafety: 'unsafe',
|
|
216
|
+
bodyAvailable: true,
|
|
217
|
+
}
|
|
218
|
+
const redirectLocation = response.headers.get('location')
|
|
219
|
+
if (redirectLocation) metadata.redirectLocation = redirectLocation
|
|
133
220
|
let body: unknown
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
221
|
+
try {
|
|
222
|
+
body = await readConnectorResponseBody(response, operation, this.maxResponseBytes)
|
|
223
|
+
} catch (error) {
|
|
224
|
+
const output: WebhookSendOutput = {
|
|
225
|
+
status: response.status,
|
|
226
|
+
body: null,
|
|
227
|
+
deliveredAt,
|
|
228
|
+
bodyAvailable: false,
|
|
229
|
+
bodyError: `Response body unavailable: ${this.errorText(error)}`,
|
|
230
|
+
remoteOutcome: 'response_received',
|
|
231
|
+
retrySafety: 'unsafe',
|
|
232
|
+
}
|
|
233
|
+
metadata.bodyAvailable = false
|
|
234
|
+
return {
|
|
235
|
+
success: response.status >= 200 && response.status < 300,
|
|
236
|
+
output,
|
|
237
|
+
...(response.status < 200 || response.status >= 300
|
|
238
|
+
? { error: this.statusError(response, true) }
|
|
239
|
+
: {}),
|
|
240
|
+
durationMs: this.duration(startedAt),
|
|
241
|
+
metadata,
|
|
242
|
+
}
|
|
139
243
|
}
|
|
140
244
|
|
|
141
|
-
|
|
245
|
+
const output: WebhookSendOutput = {
|
|
142
246
|
status: response.status,
|
|
143
247
|
body,
|
|
144
|
-
deliveredAt
|
|
248
|
+
deliveredAt,
|
|
249
|
+
bodyAvailable: true,
|
|
250
|
+
remoteOutcome: 'response_received',
|
|
251
|
+
retrySafety: 'unsafe',
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
success: response.status >= 200 && response.status < 300,
|
|
255
|
+
output,
|
|
256
|
+
...(response.status < 200 || response.status >= 300
|
|
257
|
+
? { error: this.statusError(response, false) }
|
|
258
|
+
: {}),
|
|
259
|
+
durationMs: this.duration(startedAt),
|
|
260
|
+
metadata,
|
|
145
261
|
}
|
|
146
262
|
} finally {
|
|
147
|
-
|
|
263
|
+
operation?.close()
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
private notStarted(reason: unknown, startedAt: number): ConnectorExecuteResult {
|
|
268
|
+
return {
|
|
269
|
+
success: false,
|
|
270
|
+
output: null,
|
|
271
|
+
error: `Webhook POST was cancelled before it started: ${this.errorText(reason)}. No remote request was started; retry is safe.`,
|
|
272
|
+
durationMs: this.duration(startedAt),
|
|
273
|
+
metadata: {
|
|
274
|
+
remoteOutcome: 'not_started',
|
|
275
|
+
retrySafety: 'safe',
|
|
276
|
+
bodyAvailable: false,
|
|
277
|
+
},
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
private unknownOutcome(error: unknown, startedAt: number): ConnectorExecuteResult {
|
|
282
|
+
return {
|
|
283
|
+
success: false,
|
|
284
|
+
output: null,
|
|
285
|
+
error: `Webhook POST produced no response: ${this.errorText(error)}. The remote outcome is unknown. Do not automatically retry this request; it may duplicate a delivery.`,
|
|
286
|
+
durationMs: this.duration(startedAt),
|
|
287
|
+
metadata: {
|
|
288
|
+
remoteOutcome: 'unknown',
|
|
289
|
+
retrySafety: 'unsafe',
|
|
290
|
+
bodyAvailable: false,
|
|
291
|
+
},
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private statusError(response: Response, bodyMissing: boolean): string {
|
|
296
|
+
if (response.status >= 300 && response.status < 400) {
|
|
297
|
+
const location = response.headers.get('location')
|
|
298
|
+
return `HTTP ${response.status}: ${response.statusText}. The redirect was not followed because webhook requests cannot leave their configured origin.${location ? ` Location: ${location}.` : ''} Do not automatically retry; the webhook may already have been applied.`
|
|
148
299
|
}
|
|
300
|
+
return `HTTP ${response.status}: ${response.statusText}.${bodyMissing ? ' The response body was unavailable.' : ''} Do not automatically retry; the webhook may already have been applied.`
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
private duration(startedAt: number): number {
|
|
304
|
+
return Math.round(performance.now() - startedAt)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
private errorText(error: unknown): string {
|
|
308
|
+
return error instanceof Error ? error.message : String(error)
|
|
149
309
|
}
|
|
150
310
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ConnectorOperationOptions } from '../types/connector/index.js'
|
|
2
|
+
|
|
3
|
+
const MANAGER_VALIDATED_INPUT = Symbol('namzu.connector.manager-validated-input')
|
|
4
|
+
|
|
5
|
+
export type ManagedConnectorOperationOptions = ConnectorOperationOptions & {
|
|
6
|
+
readonly [MANAGER_VALIDATED_INPUT]: true
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Internal hand-off: the manager already produced the method's canonical input. */
|
|
10
|
+
export function managedConnectorOptions(
|
|
11
|
+
options: ConnectorOperationOptions,
|
|
12
|
+
): ManagedConnectorOperationOptions {
|
|
13
|
+
return {
|
|
14
|
+
...options,
|
|
15
|
+
[MANAGER_VALIDATED_INPUT]: true,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Used by BaseConnector helpers so direct calls still validate exactly once. */
|
|
20
|
+
export function hasManagerValidatedInput(
|
|
21
|
+
options: ConnectorOperationOptions | undefined,
|
|
22
|
+
): options is ManagedConnectorOperationOptions {
|
|
23
|
+
return Boolean(
|
|
24
|
+
options &&
|
|
25
|
+
(options as Partial<ManagedConnectorOperationOptions>)[MANAGER_VALIDATED_INPUT] === true,
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
const MAX_TIMER_DELAY_MS = 2_147_483_647
|
|
2
|
+
const MAX_RESPONSE_BYTES = 2_147_483_647
|
|
3
|
+
|
|
4
|
+
// These headers can change where an already-validated URL is routed. Connector
|
|
5
|
+
// method input is commonly model-authored, while the base URL and credentials
|
|
6
|
+
// are host-configured. Letting the former supply `Host` would attach the
|
|
7
|
+
// latter's bearer/cookie headers to a different virtual host on the same
|
|
8
|
+
// socket. Proxy credentials are equally outside method-input authority.
|
|
9
|
+
const FORBIDDEN_CONNECTOR_INPUT_HEADERS = new Set([
|
|
10
|
+
'host',
|
|
11
|
+
'proxy-authorization',
|
|
12
|
+
'proxy-connection',
|
|
13
|
+
])
|
|
14
|
+
|
|
15
|
+
export const DEFAULT_CONNECTOR_REQUEST_TIMEOUT_MS = 30_000
|
|
16
|
+
export const CONNECTOR_HEALTH_TIMEOUT_MS = 5_000
|
|
17
|
+
export const DEFAULT_CONNECTOR_MAX_RESPONSE_BYTES = 2 * 1024 * 1024
|
|
18
|
+
|
|
19
|
+
export function validateConnectorTimeoutMs(value: number, label: string): number {
|
|
20
|
+
if (!Number.isInteger(value) || value < 1 || value > MAX_TIMER_DELAY_MS) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`${label} must be an integer from 1 to ${MAX_TIMER_DELAY_MS}; received ${String(value)}`,
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
return value
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function validateConnectorMaxResponseBytes(value: number, label: string): number {
|
|
29
|
+
if (!Number.isInteger(value) || value < 1 || value > MAX_RESPONSE_BYTES) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`${label} must be an integer from 1 to ${MAX_RESPONSE_BYTES}; received ${String(value)}`,
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
return value
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function requireSafeConnectorInputHeaders(
|
|
38
|
+
headers: Readonly<Record<string, string>> | undefined,
|
|
39
|
+
label: string,
|
|
40
|
+
): void {
|
|
41
|
+
if (!headers) return
|
|
42
|
+
for (const name of Object.keys(headers)) {
|
|
43
|
+
if (FORBIDDEN_CONNECTOR_INPUT_HEADERS.has(name.toLowerCase())) {
|
|
44
|
+
throw new Error(`${label} cannot set routing header "${name}"`)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function requireHttpUrl(value: string, label: string): URL {
|
|
50
|
+
const parsed = new URL(value)
|
|
51
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
52
|
+
throw new Error(`${label} must use http: or https:; received ${parsed.protocol}`)
|
|
53
|
+
}
|
|
54
|
+
return parsed
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function requireSameOrigin(value: string, configuredOrigin: string, label: string): URL {
|
|
58
|
+
const parsed = requireHttpUrl(value, label)
|
|
59
|
+
if (parsed.origin !== configuredOrigin) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`${label} must stay on the configured connector origin ${configuredOrigin}; received ${parsed.origin}`,
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
return parsed
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function timeoutError(label: string, timeoutMs: number): Error {
|
|
68
|
+
const error = new Error(`${label} timed out after ${timeoutMs}ms`)
|
|
69
|
+
error.name = 'TimeoutError'
|
|
70
|
+
return error
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function responseSizeError(maxBytes: number): Error {
|
|
74
|
+
const error = new Error(`Response body exceeded the configured ${maxBytes}-byte limit`)
|
|
75
|
+
error.name = 'ResponseSizeError'
|
|
76
|
+
return error
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Read a platform response without allocating beyond the connector's byte
|
|
81
|
+
* budget. `Content-Length` is only an early refusal; the streaming count is
|
|
82
|
+
* authoritative because chunked and dishonest responses omit or understate it.
|
|
83
|
+
*/
|
|
84
|
+
export async function readConnectorResponseBody(
|
|
85
|
+
response: Response,
|
|
86
|
+
operation: ConnectorHttpOperation,
|
|
87
|
+
maxBytes: number,
|
|
88
|
+
): Promise<unknown> {
|
|
89
|
+
const contentType = response.headers.get('content-type') ?? ''
|
|
90
|
+
const contentLength = response.headers.get('content-length')
|
|
91
|
+
if (contentLength !== null) {
|
|
92
|
+
const declaredBytes = Number(contentLength)
|
|
93
|
+
if (Number.isFinite(declaredBytes) && declaredBytes > maxBytes) {
|
|
94
|
+
const error = responseSizeError(maxBytes)
|
|
95
|
+
operation.cancel(error)
|
|
96
|
+
throw error
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// A real fetch Response has a byte stream whenever it has a body. The
|
|
101
|
+
// fallback preserves compatibility with body-less responses and injected
|
|
102
|
+
// Response-shaped test doubles; there are no remote bytes to stream when
|
|
103
|
+
// the platform reports `body === null`.
|
|
104
|
+
if (!response.body) {
|
|
105
|
+
return operation.run(() =>
|
|
106
|
+
contentType.includes('application/json') ? response.json() : response.text(),
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const reader = response.body.getReader()
|
|
111
|
+
const chunks: Uint8Array[] = []
|
|
112
|
+
let totalBytes = 0
|
|
113
|
+
try {
|
|
114
|
+
while (true) {
|
|
115
|
+
const { done, value } = await operation.run(() => reader.read())
|
|
116
|
+
if (done) break
|
|
117
|
+
totalBytes += value.byteLength
|
|
118
|
+
if (totalBytes > maxBytes) {
|
|
119
|
+
const error = responseSizeError(maxBytes)
|
|
120
|
+
void reader.cancel(error).catch(() => undefined)
|
|
121
|
+
operation.cancel(error)
|
|
122
|
+
throw error
|
|
123
|
+
}
|
|
124
|
+
chunks.push(value)
|
|
125
|
+
}
|
|
126
|
+
} finally {
|
|
127
|
+
reader.releaseLock()
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const bytes = new Uint8Array(totalBytes)
|
|
131
|
+
let offset = 0
|
|
132
|
+
for (const chunk of chunks) {
|
|
133
|
+
bytes.set(chunk, offset)
|
|
134
|
+
offset += chunk.byteLength
|
|
135
|
+
}
|
|
136
|
+
const text = new TextDecoder().decode(bytes)
|
|
137
|
+
return contentType.includes('application/json') ? JSON.parse(text) : text
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* One whole HTTP operation boundary: fetch and body reads share one clock.
|
|
142
|
+
*
|
|
143
|
+
* The promise race is intentional. Forwarding a signal cannot settle a custom
|
|
144
|
+
* fetch/body implementation that ignores it, and a connector lifecycle is a
|
|
145
|
+
* public entry point independent of the run executor's own tool deadline.
|
|
146
|
+
*/
|
|
147
|
+
export class ConnectorHttpOperation {
|
|
148
|
+
readonly signal: AbortSignal
|
|
149
|
+
private readonly controller = new AbortController()
|
|
150
|
+
private readonly aborted: Promise<never>
|
|
151
|
+
private readonly callerSignal: AbortSignal | undefined
|
|
152
|
+
private readonly onCallerAbort: (() => void) | undefined
|
|
153
|
+
private readonly timer: ReturnType<typeof setTimeout>
|
|
154
|
+
private rejectAbort!: (reason: unknown) => void
|
|
155
|
+
private hasCause = false
|
|
156
|
+
private firstCause: unknown
|
|
157
|
+
|
|
158
|
+
constructor(callerSignal: AbortSignal | undefined, timeoutMs: number, label: string) {
|
|
159
|
+
callerSignal?.throwIfAborted()
|
|
160
|
+
this.signal = this.controller.signal
|
|
161
|
+
this.callerSignal = callerSignal
|
|
162
|
+
this.aborted = new Promise<never>((_resolve, reject) => {
|
|
163
|
+
this.rejectAbort = reject
|
|
164
|
+
})
|
|
165
|
+
// Cancellation may arrive between construction and the first `wait`.
|
|
166
|
+
// Keep that owned rejection observed even when the next `run` refuses
|
|
167
|
+
// before attaching a race handler.
|
|
168
|
+
void this.aborted.catch(() => undefined)
|
|
169
|
+
this.onCallerAbort = callerSignal ? () => this.stop(callerSignal.reason) : undefined
|
|
170
|
+
callerSignal?.addEventListener('abort', this.onCallerAbort as () => void, {
|
|
171
|
+
once: true,
|
|
172
|
+
})
|
|
173
|
+
this.timer = setTimeout(() => this.stop(timeoutError(label, timeoutMs)), timeoutMs)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
get cause(): unknown {
|
|
177
|
+
return this.firstCause
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async wait<T>(operation: Promise<T>): Promise<T> {
|
|
181
|
+
this.throwIfStopped()
|
|
182
|
+
try {
|
|
183
|
+
const result = await Promise.race([operation, this.aborted])
|
|
184
|
+
// A foreign promise and caller abort can settle in the same turn. The
|
|
185
|
+
// promise race may pick the value first even though authority has
|
|
186
|
+
// already been withdrawn; never publish that late value as success.
|
|
187
|
+
this.throwIfStopped()
|
|
188
|
+
return result
|
|
189
|
+
} catch (error) {
|
|
190
|
+
if (
|
|
191
|
+
this.hasCause &&
|
|
192
|
+
error instanceof Error &&
|
|
193
|
+
(error.name === 'AbortError' || error.name === 'TimeoutError')
|
|
194
|
+
) {
|
|
195
|
+
throw this.firstCause
|
|
196
|
+
}
|
|
197
|
+
throw error
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Check authority before starting foreign work, then again after it wins.
|
|
203
|
+
*
|
|
204
|
+
* Passing an already-created promise to `wait()` cannot prevent the work
|
|
205
|
+
* that created it from starting. Callers use this thunk form at every
|
|
206
|
+
* network, resolver and stream boundary where admission matters.
|
|
207
|
+
*/
|
|
208
|
+
async run<T>(start: () => Promise<T>): Promise<T> {
|
|
209
|
+
this.throwIfStopped()
|
|
210
|
+
return this.wait(start())
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
throwIfStopped(): void {
|
|
214
|
+
this.signal.throwIfAborted()
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
close(): void {
|
|
218
|
+
clearTimeout(this.timer)
|
|
219
|
+
if (this.callerSignal && this.onCallerAbort) {
|
|
220
|
+
this.callerSignal.removeEventListener('abort', this.onCallerAbort)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
cancel(reason: unknown): void {
|
|
225
|
+
this.stop(reason)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private stop(reason: unknown): void {
|
|
229
|
+
if (this.hasCause) return
|
|
230
|
+
this.hasCause = true
|
|
231
|
+
this.firstCause = reason
|
|
232
|
+
// Reject the owned wait before aborting transport. A fetch implementation
|
|
233
|
+
// may synchronously translate transport abort into a generic AbortError;
|
|
234
|
+
// that fallout must not erase the caller/deadline cause that won first.
|
|
235
|
+
this.rejectAbort(reason)
|
|
236
|
+
this.controller.abort(reason)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -452,8 +452,10 @@ export function mcpToolToToolDefinition(
|
|
|
452
452
|
isConcurrencySafe: () => true,
|
|
453
453
|
provenance: { server: serverName, readOnlyHintTrusted },
|
|
454
454
|
|
|
455
|
-
async execute(input: unknown,
|
|
456
|
-
const result = await client.callTool(tool.name, input as Record<string, unknown
|
|
455
|
+
async execute(input: unknown, context: ToolContext): Promise<ToolResult> {
|
|
456
|
+
const result = await client.callTool(tool.name, input as Record<string, unknown>, {
|
|
457
|
+
signal: context.abortSignal,
|
|
458
|
+
})
|
|
457
459
|
return frameServerResult(mcpToolResultToToolResult(result), serverName, tool.name)
|
|
458
460
|
},
|
|
459
461
|
}
|
|
@@ -463,7 +465,10 @@ export function toolDefinitionToMCPTool(tool: ToolDefinition): MCPToolDefinition
|
|
|
463
465
|
return {
|
|
464
466
|
name: tool.name,
|
|
465
467
|
description: tool.description,
|
|
466
|
-
inputSchema:
|
|
468
|
+
inputSchema: tool.modelInputSchema
|
|
469
|
+
? (inlineSchemaRefs(tool.modelInputSchema) as MCPJsonSchema)
|
|
470
|
+
: zodToMCPJsonSchema(tool.inputSchema),
|
|
471
|
+
...(tool.outputSchema ? { outputSchema: inlineSchemaRefs(tool.outputSchema) } : {}),
|
|
467
472
|
annotations: {
|
|
468
473
|
readOnlyHint: tool.isReadOnly?.(undefined as never),
|
|
469
474
|
destructiveHint: tool.isDestructive?.(undefined as never),
|