@qodo/sdk 0.13.4 → 2.0.0-next.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/LICENSE +31 -118
- package/README.md +133 -121
- package/bin/qodo-skills.mjs +13 -0
- package/bundled-skills/code-review/SKILL.md +41 -0
- package/bundled-skills/pr-summary/SKILL.md +59 -0
- package/bundled-skills/test-gen/SKILL.md +47 -0
- package/dist/auth/index.browser.d.ts +38 -0
- package/dist/auth/index.browser.d.ts.map +1 -0
- package/dist/auth/index.browser.js +62 -0
- package/dist/auth/index.browser.js.map +1 -0
- package/dist/auth/index.d.ts +44 -30
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +57 -110
- package/dist/auth/index.js.map +1 -1
- package/dist/client/AgentsClient.d.ts +33 -0
- package/dist/client/AgentsClient.d.ts.map +1 -0
- package/dist/client/AgentsClient.js +40 -0
- package/dist/client/AgentsClient.js.map +1 -0
- package/dist/client/ArtifactsClient.d.ts +43 -0
- package/dist/client/ArtifactsClient.d.ts.map +1 -0
- package/dist/client/ArtifactsClient.js +54 -0
- package/dist/client/ArtifactsClient.js.map +1 -0
- package/dist/client/BulletinClient.d.ts +45 -0
- package/dist/client/BulletinClient.d.ts.map +1 -0
- package/dist/client/BulletinClient.js +51 -0
- package/dist/client/BulletinClient.js.map +1 -0
- package/dist/client/InfoClient.d.ts +58 -0
- package/dist/client/InfoClient.d.ts.map +1 -0
- package/dist/client/InfoClient.js +135 -0
- package/dist/client/InfoClient.js.map +1 -0
- package/dist/client/PipelineClient.d.ts +162 -0
- package/dist/client/PipelineClient.d.ts.map +1 -0
- package/dist/client/PipelineClient.js +340 -0
- package/dist/client/PipelineClient.js.map +1 -0
- package/dist/client/QarRegistryClient.d.ts +396 -0
- package/dist/client/QarRegistryClient.d.ts.map +1 -0
- package/dist/client/QarRegistryClient.js +536 -0
- package/dist/client/QarRegistryClient.js.map +1 -0
- package/dist/client/QodoClient.d.ts +296 -0
- package/dist/client/QodoClient.d.ts.map +1 -0
- package/dist/client/QodoClient.js +803 -0
- package/dist/client/QodoClient.js.map +1 -0
- package/dist/client/SpecsClient.d.ts +121 -0
- package/dist/client/SpecsClient.d.ts.map +1 -0
- package/dist/client/SpecsClient.js +252 -0
- package/dist/client/SpecsClient.js.map +1 -0
- package/dist/client/StateClient.d.ts +35 -0
- package/dist/client/StateClient.d.ts.map +1 -0
- package/dist/client/StateClient.js +36 -0
- package/dist/client/StateClient.js.map +1 -0
- package/dist/client/TaskClient.d.ts +706 -0
- package/dist/client/TaskClient.d.ts.map +1 -0
- package/dist/client/TaskClient.js +2522 -0
- package/dist/client/TaskClient.js.map +1 -0
- package/dist/client/ToolClient.d.ts +278 -0
- package/dist/client/ToolClient.d.ts.map +1 -0
- package/dist/client/ToolClient.js +1115 -0
- package/dist/client/ToolClient.js.map +1 -0
- package/dist/client/a2a/index.d.ts +10 -0
- package/dist/client/a2a/index.d.ts.map +1 -0
- package/dist/client/a2a/index.js +9 -0
- package/dist/client/a2a/index.js.map +1 -0
- package/dist/client/a2a/registerA2A.d.ts +170 -0
- package/dist/client/a2a/registerA2A.d.ts.map +1 -0
- package/dist/client/a2a/registerA2A.js +85 -0
- package/dist/client/a2a/registerA2A.js.map +1 -0
- package/dist/client/connection.d.ts +800 -0
- package/dist/client/connection.d.ts.map +1 -0
- package/dist/client/connection.js +2020 -0
- package/dist/client/connection.js.map +1 -0
- package/dist/client/errors.d.ts +735 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +921 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/index.d.ts +26 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +20 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/inlineGraph.d.ts +66 -0
- package/dist/client/inlineGraph.d.ts.map +1 -0
- package/dist/client/inlineGraph.js +500 -0
- package/dist/client/inlineGraph.js.map +1 -0
- package/dist/client/internal/thenable.d.ts +27 -0
- package/dist/client/internal/thenable.d.ts.map +1 -0
- package/dist/client/internal/thenable.js +31 -0
- package/dist/client/internal/thenable.js.map +1 -0
- package/dist/client/iterator.d.ts +32 -0
- package/dist/client/iterator.d.ts.map +1 -0
- package/dist/client/iterator.js +73 -0
- package/dist/client/iterator.js.map +1 -0
- package/dist/client/mcp/McpClientPool.browser.d.ts +76 -0
- package/dist/client/mcp/McpClientPool.browser.d.ts.map +1 -0
- package/dist/client/mcp/McpClientPool.browser.js +78 -0
- package/dist/client/mcp/McpClientPool.browser.js.map +1 -0
- package/dist/client/mcp/McpClientPool.d.ts +236 -0
- package/dist/client/mcp/McpClientPool.d.ts.map +1 -0
- package/dist/client/mcp/McpClientPool.js +585 -0
- package/dist/client/mcp/McpClientPool.js.map +1 -0
- package/dist/client/mcp/projection.d.ts +109 -0
- package/dist/client/mcp/projection.d.ts.map +1 -0
- package/dist/client/mcp/projection.js +446 -0
- package/dist/client/mcp/projection.js.map +1 -0
- package/dist/client/mcp/substituteEnv.browser.d.ts +18 -0
- package/dist/client/mcp/substituteEnv.browser.d.ts.map +1 -0
- package/dist/client/mcp/substituteEnv.browser.js +20 -0
- package/dist/client/mcp/substituteEnv.browser.js.map +1 -0
- package/dist/client/mcp/substituteEnv.d.ts +45 -0
- package/dist/client/mcp/substituteEnv.d.ts.map +1 -0
- package/dist/client/mcp/substituteEnv.js +63 -0
- package/dist/client/mcp/substituteEnv.js.map +1 -0
- package/dist/client/observers.d.ts +57 -0
- package/dist/client/observers.d.ts.map +1 -0
- package/dist/client/observers.js +203 -0
- package/dist/client/observers.js.map +1 -0
- package/dist/client/options.d.ts +269 -0
- package/dist/client/options.d.ts.map +1 -0
- package/dist/client/options.js +9 -0
- package/dist/client/options.js.map +1 -0
- package/dist/client/tools/_readlineApprovalPrompt.browser.d.ts +17 -0
- package/dist/client/tools/_readlineApprovalPrompt.browser.d.ts.map +1 -0
- package/dist/client/tools/_readlineApprovalPrompt.browser.js +24 -0
- package/dist/client/tools/_readlineApprovalPrompt.browser.js.map +1 -0
- package/dist/client/tools/_readlineApprovalPrompt.d.ts +33 -0
- package/dist/client/tools/_readlineApprovalPrompt.d.ts.map +1 -0
- package/dist/client/tools/_readlineApprovalPrompt.js +90 -0
- package/dist/client/tools/_readlineApprovalPrompt.js.map +1 -0
- package/dist/client/tools/approval.d.ts +280 -0
- package/dist/client/tools/approval.d.ts.map +1 -0
- package/dist/client/tools/approval.js +229 -0
- package/dist/client/tools/approval.js.map +1 -0
- package/dist/client/tools/bindFunctionToolDefs.d.ts +156 -0
- package/dist/client/tools/bindFunctionToolDefs.d.ts.map +1 -0
- package/dist/client/tools/bindFunctionToolDefs.js +360 -0
- package/dist/client/tools/bindFunctionToolDefs.js.map +1 -0
- package/dist/client/tools/defineFunctionTool.d.ts +277 -0
- package/dist/client/tools/defineFunctionTool.d.ts.map +1 -0
- package/dist/client/tools/defineFunctionTool.js +190 -0
- package/dist/client/tools/defineFunctionTool.js.map +1 -0
- package/dist/client/transport.browser.d.ts +20 -0
- package/dist/client/transport.browser.d.ts.map +1 -0
- package/dist/client/transport.browser.js +29 -0
- package/dist/client/transport.browser.js.map +1 -0
- package/dist/client/transport.d.ts +47 -0
- package/dist/client/transport.d.ts.map +1 -0
- package/dist/client/transport.js +102 -0
- package/dist/client/transport.js.map +1 -0
- package/dist/client/transport.shared.d.ts +30 -0
- package/dist/client/transport.shared.d.ts.map +1 -0
- package/dist/client/transport.shared.js +40 -0
- package/dist/client/transport.shared.js.map +1 -0
- package/dist/client/uuid.d.ts +32 -0
- package/dist/client/uuid.d.ts.map +1 -0
- package/dist/client/uuid.js +65 -0
- package/dist/client/uuid.js.map +1 -0
- package/dist/index.d.ts +88 -39
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +166 -43
- package/dist/index.js.map +1 -1
- package/dist/observability/attributes.d.ts +136 -0
- package/dist/observability/attributes.d.ts.map +1 -0
- package/dist/observability/attributes.js +184 -0
- package/dist/observability/attributes.js.map +1 -0
- package/dist/observability/index.d.ts +14 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +11 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/resolveOTel.browser.d.ts +13 -0
- package/dist/observability/resolveOTel.browser.d.ts.map +1 -0
- package/dist/observability/resolveOTel.browser.js +14 -0
- package/dist/observability/resolveOTel.browser.js.map +1 -0
- package/dist/observability/resolveOTel.d.ts +28 -0
- package/dist/observability/resolveOTel.d.ts.map +1 -0
- package/dist/observability/resolveOTel.js +74 -0
- package/dist/observability/resolveOTel.js.map +1 -0
- package/dist/observability/spans.d.ts +198 -0
- package/dist/observability/spans.d.ts.map +1 -0
- package/dist/observability/spans.js +300 -0
- package/dist/observability/spans.js.map +1 -0
- package/dist/observability/traceContext.d.ts +51 -0
- package/dist/observability/traceContext.d.ts.map +1 -0
- package/dist/observability/traceContext.js +151 -0
- package/dist/observability/traceContext.js.map +1 -0
- package/dist/observability/transportMetrics.d.ts +58 -0
- package/dist/observability/transportMetrics.d.ts.map +1 -0
- package/dist/observability/transportMetrics.js +55 -0
- package/dist/observability/transportMetrics.js.map +1 -0
- package/dist/qar/agentSpec.d.ts +93 -0
- package/dist/qar/agentSpec.d.ts.map +1 -0
- package/dist/qar/agentSpec.js +184 -0
- package/dist/qar/agentSpec.js.map +1 -0
- package/dist/qar/clientEvents.d.ts +86 -0
- package/dist/qar/clientEvents.d.ts.map +1 -0
- package/dist/qar/clientEvents.js +36 -0
- package/dist/qar/clientEvents.js.map +1 -0
- package/dist/qar/envelopes.d.ts +227 -0
- package/dist/qar/envelopes.d.ts.map +1 -0
- package/dist/qar/envelopes.js +67 -0
- package/dist/qar/envelopes.js.map +1 -0
- package/dist/qar/generated/envelope.d.ts +332 -0
- package/dist/qar/generated/envelope.d.ts.map +1 -0
- package/dist/qar/generated/envelope.js +15 -0
- package/dist/qar/generated/envelope.js.map +1 -0
- package/dist/qar/generated/qar-info.d.ts +76 -0
- package/dist/qar/generated/qar-info.d.ts.map +1 -0
- package/dist/qar/generated/qar-info.js +15 -0
- package/dist/qar/generated/qar-info.js.map +1 -0
- package/dist/qar/generated/qodo-task-start-payload.d.ts +54 -0
- package/dist/qar/generated/qodo-task-start-payload.d.ts.map +1 -0
- package/dist/qar/generated/qodo-task-start-payload.js +15 -0
- package/dist/qar/generated/qodo-task-start-payload.js.map +1 -0
- package/dist/qar/ids.d.ts +19 -0
- package/dist/qar/ids.d.ts.map +1 -0
- package/dist/qar/ids.js +11 -0
- package/dist/qar/ids.js.map +1 -0
- package/dist/qar/index.d.ts +24 -0
- package/dist/qar/index.d.ts.map +1 -0
- package/dist/qar/index.js +16 -0
- package/dist/qar/index.js.map +1 -0
- package/dist/qar/info.d.ts +37 -0
- package/dist/qar/info.d.ts.map +1 -0
- package/dist/qar/info.js +17 -0
- package/dist/qar/info.js.map +1 -0
- package/dist/qar/json.d.ts +14 -0
- package/dist/qar/json.d.ts.map +1 -0
- package/dist/qar/json.js +9 -0
- package/dist/qar/json.js.map +1 -0
- package/dist/qar/payloads.d.ts +480 -0
- package/dist/qar/payloads.d.ts.map +1 -0
- package/dist/qar/payloads.js +37 -0
- package/dist/qar/payloads.js.map +1 -0
- package/dist/qar/specs.d.ts +604 -0
- package/dist/qar/specs.d.ts.map +1 -0
- package/dist/qar/specs.js +29 -0
- package/dist/qar/specs.js.map +1 -0
- package/dist/qar/taskEvents.d.ts +25 -0
- package/dist/qar/taskEvents.d.ts.map +1 -0
- package/dist/qar/taskEvents.js +22 -0
- package/dist/qar/taskEvents.js.map +1 -0
- package/dist/qar/trace.d.ts +12 -0
- package/dist/qar/trace.d.ts.map +1 -0
- package/dist/qar/trace.js +12 -0
- package/dist/qar/trace.js.map +1 -0
- package/dist/skills/activation.d.ts +177 -0
- package/dist/skills/activation.d.ts.map +1 -0
- package/dist/skills/activation.js +428 -0
- package/dist/skills/activation.js.map +1 -0
- package/dist/skills/cli/index.browser.d.ts +18 -0
- package/dist/skills/cli/index.browser.d.ts.map +1 -0
- package/dist/skills/cli/index.browser.js +27 -0
- package/dist/skills/cli/index.browser.js.map +1 -0
- package/dist/skills/cli/index.d.ts +37 -0
- package/dist/skills/cli/index.d.ts.map +1 -0
- package/dist/skills/cli/index.js +494 -0
- package/dist/skills/cli/index.js.map +1 -0
- package/dist/skills/events.d.ts +255 -0
- package/dist/skills/events.d.ts.map +1 -0
- package/dist/skills/events.js +224 -0
- package/dist/skills/events.js.map +1 -0
- package/dist/skills/index.d.ts +45 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +34 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/inject.d.ts +57 -0
- package/dist/skills/inject.d.ts.map +1 -0
- package/dist/skills/inject.js +162 -0
- package/dist/skills/inject.js.map +1 -0
- package/dist/skills/lockfile.browser.d.ts +56 -0
- package/dist/skills/lockfile.browser.d.ts.map +1 -0
- package/dist/skills/lockfile.browser.js +55 -0
- package/dist/skills/lockfile.browser.js.map +1 -0
- package/dist/skills/lockfile.d.ts +137 -0
- package/dist/skills/lockfile.d.ts.map +1 -0
- package/dist/skills/lockfile.js +423 -0
- package/dist/skills/lockfile.js.map +1 -0
- package/dist/skills/manager.browser.d.ts +94 -0
- package/dist/skills/manager.browser.d.ts.map +1 -0
- package/dist/skills/manager.browser.js +159 -0
- package/dist/skills/manager.browser.js.map +1 -0
- package/dist/skills/manager.d.ts +362 -0
- package/dist/skills/manager.d.ts.map +1 -0
- package/dist/skills/manager.js +1386 -0
- package/dist/skills/manager.js.map +1 -0
- package/dist/skills/mcp/index.d.ts +15 -0
- package/dist/skills/mcp/index.d.ts.map +1 -0
- package/dist/skills/mcp/index.js +12 -0
- package/dist/skills/mcp/index.js.map +1 -0
- package/dist/skills/mcp/path.browser.d.ts +27 -0
- package/dist/skills/mcp/path.browser.d.ts.map +1 -0
- package/dist/skills/mcp/path.browser.js +33 -0
- package/dist/skills/mcp/path.browser.js.map +1 -0
- package/dist/skills/mcp/path.d.ts +57 -0
- package/dist/skills/mcp/path.d.ts.map +1 -0
- package/dist/skills/mcp/path.js +150 -0
- package/dist/skills/mcp/path.js.map +1 -0
- package/dist/skills/mcp/server.browser.d.ts +32 -0
- package/dist/skills/mcp/server.browser.d.ts.map +1 -0
- package/dist/skills/mcp/server.browser.js +53 -0
- package/dist/skills/mcp/server.browser.js.map +1 -0
- package/dist/skills/mcp/server.d.ts +144 -0
- package/dist/skills/mcp/server.d.ts.map +1 -0
- package/dist/skills/mcp/server.js +841 -0
- package/dist/skills/mcp/server.js.map +1 -0
- package/dist/skills/mcp/types.d.ts +72 -0
- package/dist/skills/mcp/types.d.ts.map +1 -0
- package/dist/skills/mcp/types.js +20 -0
- package/dist/skills/mcp/types.js.map +1 -0
- package/dist/skills/mcp/wireDefs.d.ts +58 -0
- package/dist/skills/mcp/wireDefs.d.ts.map +1 -0
- package/dist/skills/mcp/wireDefs.js +141 -0
- package/dist/skills/mcp/wireDefs.js.map +1 -0
- package/dist/skills/parser.d.ts +63 -0
- package/dist/skills/parser.d.ts.map +1 -0
- package/dist/skills/parser.js +755 -0
- package/dist/skills/parser.js.map +1 -0
- package/dist/skills/prefilter.d.ts +104 -0
- package/dist/skills/prefilter.d.ts.map +1 -0
- package/dist/skills/prefilter.js +398 -0
- package/dist/skills/prefilter.js.map +1 -0
- package/dist/skills/preprocess.d.ts +169 -0
- package/dist/skills/preprocess.d.ts.map +1 -0
- package/dist/skills/preprocess.js +535 -0
- package/dist/skills/preprocess.js.map +1 -0
- package/dist/skills/render.d.ts +83 -0
- package/dist/skills/render.d.ts.map +1 -0
- package/dist/skills/render.js +397 -0
- package/dist/skills/render.js.map +1 -0
- package/dist/skills/sources/index.browser.d.ts +29 -0
- package/dist/skills/sources/index.browser.d.ts.map +1 -0
- package/dist/skills/sources/index.browser.js +16 -0
- package/dist/skills/sources/index.browser.js.map +1 -0
- package/dist/skills/sources/index.d.ts +59 -0
- package/dist/skills/sources/index.d.ts.map +1 -0
- package/dist/skills/sources/index.js +471 -0
- package/dist/skills/sources/index.js.map +1 -0
- package/dist/skills/sources/walk.browser.d.ts +17 -0
- package/dist/skills/sources/walk.browser.d.ts.map +1 -0
- package/dist/skills/sources/walk.browser.js +19 -0
- package/dist/skills/sources/walk.browser.js.map +1 -0
- package/dist/skills/sources/walk.d.ts +68 -0
- package/dist/skills/sources/walk.d.ts.map +1 -0
- package/dist/skills/sources/walk.js +264 -0
- package/dist/skills/sources/walk.js.map +1 -0
- package/dist/skills/substitute.d.ts +87 -0
- package/dist/skills/substitute.d.ts.map +1 -0
- package/dist/skills/substitute.js +322 -0
- package/dist/skills/substitute.js.map +1 -0
- package/dist/skills/testing/SkillKit.browser.d.ts +62 -0
- package/dist/skills/testing/SkillKit.browser.d.ts.map +1 -0
- package/dist/skills/testing/SkillKit.browser.js +41 -0
- package/dist/skills/testing/SkillKit.browser.js.map +1 -0
- package/dist/skills/testing/SkillKit.d.ts +130 -0
- package/dist/skills/testing/SkillKit.d.ts.map +1 -0
- package/dist/skills/testing/SkillKit.js +316 -0
- package/dist/skills/testing/SkillKit.js.map +1 -0
- package/dist/skills/testing/index.d.ts +9 -0
- package/dist/skills/testing/index.d.ts.map +1 -0
- package/dist/skills/testing/index.js +8 -0
- package/dist/skills/testing/index.js.map +1 -0
- package/dist/skills/trust.d.ts +72 -0
- package/dist/skills/trust.d.ts.map +1 -0
- package/dist/skills/trust.js +183 -0
- package/dist/skills/trust.js.map +1 -0
- package/dist/skills/types.d.ts +627 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +85 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/skills/validator.d.ts +95 -0
- package/dist/skills/validator.d.ts.map +1 -0
- package/dist/skills/validator.js +486 -0
- package/dist/skills/validator.js.map +1 -0
- package/dist/tracing/PipelineTracer.d.ts +35 -22
- package/dist/tracing/PipelineTracer.d.ts.map +1 -1
- package/dist/tracing/PipelineTracer.js +106 -61
- package/dist/tracing/PipelineTracer.js.map +1 -1
- package/dist/tracing/SdkTracer.d.ts +63 -61
- package/dist/tracing/SdkTracer.d.ts.map +1 -1
- package/dist/tracing/SdkTracer.js +185 -177
- package/dist/tracing/SdkTracer.js.map +1 -1
- package/dist/tracing/index.d.ts +10 -1
- package/dist/tracing/index.d.ts.map +1 -1
- package/dist/tracing/index.js +9 -0
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/types.d.ts +89 -16
- package/dist/tracing/types.d.ts.map +1 -1
- package/dist/tracing/types.js +17 -4
- package/dist/tracing/types.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +10 -20
- package/dist/version.js.map +1 -1
- package/package.json +53 -39
- package/.claude/skills/qodo-agent/SKILL.md +0 -974
- package/.claude/skills/qodo-agent/assets/programmatic-agent.ts +0 -407
- package/.claude/skills/qodo-agent/references/builtin-tools.md +0 -342
- package/.claude/skills/qodo-agent/references/common-issues.md +0 -537
- package/bin/rg +0 -0
- package/dist/api/agent.d.ts +0 -105
- package/dist/api/agent.d.ts.map +0 -1
- package/dist/api/agent.js +0 -963
- package/dist/api/agent.js.map +0 -1
- package/dist/api/analytics.d.ts +0 -43
- package/dist/api/analytics.d.ts.map +0 -1
- package/dist/api/analytics.js +0 -163
- package/dist/api/analytics.js.map +0 -1
- package/dist/api/http.d.ts +0 -5
- package/dist/api/http.d.ts.map +0 -1
- package/dist/api/http.js +0 -62
- package/dist/api/http.js.map +0 -1
- package/dist/api/index.d.ts +0 -12
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -17
- package/dist/api/index.js.map +0 -1
- package/dist/api/taskTracking.d.ts +0 -54
- package/dist/api/taskTracking.d.ts.map +0 -1
- package/dist/api/taskTracking.js +0 -208
- package/dist/api/taskTracking.js.map +0 -1
- package/dist/api/types.d.ts +0 -93
- package/dist/api/types.d.ts.map +0 -1
- package/dist/api/types.js +0 -2
- package/dist/api/types.js.map +0 -1
- package/dist/api/utils.d.ts +0 -8
- package/dist/api/utils.d.ts.map +0 -1
- package/dist/api/utils.js +0 -63
- package/dist/api/utils.js.map +0 -1
- package/dist/api/websocket.d.ts +0 -203
- package/dist/api/websocket.d.ts.map +0 -1
- package/dist/api/websocket.js +0 -1166
- package/dist/api/websocket.js.map +0 -1
- package/dist/bin/install-skill.d.ts +0 -14
- package/dist/bin/install-skill.d.ts.map +0 -1
- package/dist/bin/install-skill.js +0 -125
- package/dist/bin/install-skill.js.map +0 -1
- package/dist/bin/run-helpers.d.ts +0 -34
- package/dist/bin/run-helpers.d.ts.map +0 -1
- package/dist/bin/run-helpers.js +0 -186
- package/dist/bin/run-helpers.js.map +0 -1
- package/dist/bin/run.d.ts +0 -13
- package/dist/bin/run.d.ts.map +0 -1
- package/dist/bin/run.js +0 -57
- package/dist/bin/run.js.map +0 -1
- package/dist/clients/index.d.ts +0 -10
- package/dist/clients/index.d.ts.map +0 -1
- package/dist/clients/index.js +0 -8
- package/dist/clients/index.js.map +0 -1
- package/dist/clients/info/InfoClient.d.ts +0 -37
- package/dist/clients/info/InfoClient.d.ts.map +0 -1
- package/dist/clients/info/InfoClient.js +0 -69
- package/dist/clients/info/InfoClient.js.map +0 -1
- package/dist/clients/info/index.d.ts +0 -4
- package/dist/clients/info/index.d.ts.map +0 -1
- package/dist/clients/info/index.js +0 -2
- package/dist/clients/info/index.js.map +0 -1
- package/dist/clients/info/types.d.ts +0 -21
- package/dist/clients/info/types.d.ts.map +0 -1
- package/dist/clients/info/types.js +0 -2
- package/dist/clients/info/types.js.map +0 -1
- package/dist/clients/sessions/SessionsClient.d.ts +0 -34
- package/dist/clients/sessions/SessionsClient.d.ts.map +0 -1
- package/dist/clients/sessions/SessionsClient.js +0 -71
- package/dist/clients/sessions/SessionsClient.js.map +0 -1
- package/dist/clients/sessions/index.d.ts +0 -4
- package/dist/clients/sessions/index.d.ts.map +0 -1
- package/dist/clients/sessions/index.js +0 -2
- package/dist/clients/sessions/index.js.map +0 -1
- package/dist/clients/sessions/types.d.ts +0 -20
- package/dist/clients/sessions/types.d.ts.map +0 -1
- package/dist/clients/sessions/types.js +0 -2
- package/dist/clients/sessions/types.js.map +0 -1
- package/dist/clients/tools/ToolsClient.d.ts +0 -39
- package/dist/clients/tools/ToolsClient.d.ts.map +0 -1
- package/dist/clients/tools/ToolsClient.js +0 -95
- package/dist/clients/tools/ToolsClient.js.map +0 -1
- package/dist/clients/tools/index.d.ts +0 -4
- package/dist/clients/tools/index.d.ts.map +0 -1
- package/dist/clients/tools/index.js +0 -2
- package/dist/clients/tools/index.js.map +0 -1
- package/dist/clients/tools/types.d.ts +0 -14
- package/dist/clients/tools/types.d.ts.map +0 -1
- package/dist/clients/tools/types.js +0 -2
- package/dist/clients/tools/types.js.map +0 -1
- package/dist/config/ConfigManager.d.ts +0 -43
- package/dist/config/ConfigManager.d.ts.map +0 -1
- package/dist/config/ConfigManager.js +0 -472
- package/dist/config/ConfigManager.js.map +0 -1
- package/dist/config/index.d.ts +0 -6
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -7
- package/dist/config/index.js.map +0 -1
- package/dist/config/urlConfig.d.ts +0 -15
- package/dist/config/urlConfig.d.ts.map +0 -1
- package/dist/config/urlConfig.js +0 -75
- package/dist/config/urlConfig.js.map +0 -1
- package/dist/constants/errors.d.ts +0 -2
- package/dist/constants/errors.d.ts.map +0 -1
- package/dist/constants/errors.js +0 -2
- package/dist/constants/errors.js.map +0 -1
- package/dist/constants/index.d.ts +0 -7
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/index.js +0 -11
- package/dist/constants/index.js.map +0 -1
- package/dist/constants/tools.d.ts +0 -4
- package/dist/constants/tools.d.ts.map +0 -1
- package/dist/constants/tools.js +0 -4
- package/dist/constants/tools.js.map +0 -1
- package/dist/constants/versions.d.ts +0 -2
- package/dist/constants/versions.d.ts.map +0 -1
- package/dist/constants/versions.js +0 -2
- package/dist/constants/versions.js.map +0 -1
- package/dist/context/buildUserContext.d.ts +0 -18
- package/dist/context/buildUserContext.d.ts.map +0 -1
- package/dist/context/buildUserContext.js +0 -34
- package/dist/context/buildUserContext.js.map +0 -1
- package/dist/context/index.d.ts +0 -9
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -9
- package/dist/context/index.js.map +0 -1
- package/dist/context/messageManager.d.ts +0 -42
- package/dist/context/messageManager.d.ts.map +0 -1
- package/dist/context/messageManager.js +0 -322
- package/dist/context/messageManager.js.map +0 -1
- package/dist/context/taskFocus.d.ts +0 -2
- package/dist/context/taskFocus.d.ts.map +0 -1
- package/dist/context/taskFocus.js +0 -26
- package/dist/context/taskFocus.js.map +0 -1
- package/dist/context/userInput.d.ts +0 -3
- package/dist/context/userInput.d.ts.map +0 -1
- package/dist/context/userInput.js +0 -20
- package/dist/context/userInput.js.map +0 -1
- package/dist/mcp/MCPManager.d.ts +0 -109
- package/dist/mcp/MCPManager.d.ts.map +0 -1
- package/dist/mcp/MCPManager.js +0 -592
- package/dist/mcp/MCPManager.js.map +0 -1
- package/dist/mcp/approvedTools.d.ts +0 -4
- package/dist/mcp/approvedTools.d.ts.map +0 -1
- package/dist/mcp/approvedTools.js +0 -19
- package/dist/mcp/approvedTools.js.map +0 -1
- package/dist/mcp/baseServer.d.ts +0 -75
- package/dist/mcp/baseServer.d.ts.map +0 -1
- package/dist/mcp/baseServer.js +0 -107
- package/dist/mcp/baseServer.js.map +0 -1
- package/dist/mcp/builtinServers.d.ts +0 -15
- package/dist/mcp/builtinServers.d.ts.map +0 -1
- package/dist/mcp/builtinServers.js +0 -141
- package/dist/mcp/builtinServers.js.map +0 -1
- package/dist/mcp/dynamicBEServer.d.ts +0 -20
- package/dist/mcp/dynamicBEServer.d.ts.map +0 -1
- package/dist/mcp/dynamicBEServer.js +0 -52
- package/dist/mcp/dynamicBEServer.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -18
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -23
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/mcpInitialization.d.ts +0 -2
- package/dist/mcp/mcpInitialization.d.ts.map +0 -1
- package/dist/mcp/mcpInitialization.js +0 -56
- package/dist/mcp/mcpInitialization.js.map +0 -1
- package/dist/mcp/servers/filesystem.d.ts +0 -44
- package/dist/mcp/servers/filesystem.d.ts.map +0 -1
- package/dist/mcp/servers/filesystem.js +0 -776
- package/dist/mcp/servers/filesystem.js.map +0 -1
- package/dist/mcp/servers/git.d.ts +0 -18
- package/dist/mcp/servers/git.d.ts.map +0 -1
- package/dist/mcp/servers/git.js +0 -441
- package/dist/mcp/servers/git.js.map +0 -1
- package/dist/mcp/servers/ripgrep.d.ts +0 -39
- package/dist/mcp/servers/ripgrep.d.ts.map +0 -1
- package/dist/mcp/servers/ripgrep.js +0 -550
- package/dist/mcp/servers/ripgrep.js.map +0 -1
- package/dist/mcp/servers/shell.d.ts +0 -20
- package/dist/mcp/servers/shell.d.ts.map +0 -1
- package/dist/mcp/servers/shell.js +0 -519
- package/dist/mcp/servers/shell.js.map +0 -1
- package/dist/mcp/serversRegistry.d.ts +0 -55
- package/dist/mcp/serversRegistry.d.ts.map +0 -1
- package/dist/mcp/serversRegistry.js +0 -416
- package/dist/mcp/serversRegistry.js.map +0 -1
- package/dist/mcp/toolProcessor.d.ts +0 -82
- package/dist/mcp/toolProcessor.d.ts.map +0 -1
- package/dist/mcp/toolProcessor.js +0 -392
- package/dist/mcp/toolProcessor.js.map +0 -1
- package/dist/mcp/types.d.ts +0 -29
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js +0 -2
- package/dist/mcp/types.js.map +0 -1
- package/dist/messages/index.d.ts +0 -8
- package/dist/messages/index.d.ts.map +0 -1
- package/dist/messages/index.js +0 -7
- package/dist/messages/index.js.map +0 -1
- package/dist/messages/openai.d.ts +0 -26
- package/dist/messages/openai.d.ts.map +0 -1
- package/dist/messages/openai.js +0 -55
- package/dist/messages/openai.js.map +0 -1
- package/dist/messages/types.d.ts +0 -73
- package/dist/messages/types.d.ts.map +0 -1
- package/dist/messages/types.js +0 -78
- package/dist/messages/types.js.map +0 -1
- package/dist/parser/index.d.ts +0 -72
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js +0 -967
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/types.d.ts +0 -153
- package/dist/parser/types.d.ts.map +0 -1
- package/dist/parser/types.js +0 -6
- package/dist/parser/types.js.map +0 -1
- package/dist/parser/utils.d.ts +0 -18
- package/dist/parser/utils.d.ts.map +0 -1
- package/dist/parser/utils.js +0 -64
- package/dist/parser/utils.js.map +0 -1
- package/dist/sdk/QodoSDK.d.ts +0 -218
- package/dist/sdk/QodoSDK.d.ts.map +0 -1
- package/dist/sdk/QodoSDK.js +0 -1115
- package/dist/sdk/QodoSDK.js.map +0 -1
- package/dist/sdk/artifacts.d.ts +0 -156
- package/dist/sdk/artifacts.d.ts.map +0 -1
- package/dist/sdk/artifacts.js +0 -166
- package/dist/sdk/artifacts.js.map +0 -1
- package/dist/sdk/bootstrap.d.ts +0 -16
- package/dist/sdk/bootstrap.d.ts.map +0 -1
- package/dist/sdk/bootstrap.js +0 -28
- package/dist/sdk/bootstrap.js.map +0 -1
- package/dist/sdk/builders.d.ts +0 -54
- package/dist/sdk/builders.d.ts.map +0 -1
- package/dist/sdk/builders.js +0 -117
- package/dist/sdk/builders.js.map +0 -1
- package/dist/sdk/defaults.d.ts +0 -11
- package/dist/sdk/defaults.d.ts.map +0 -1
- package/dist/sdk/defaults.js +0 -39
- package/dist/sdk/defaults.js.map +0 -1
- package/dist/sdk/discovery.d.ts +0 -2
- package/dist/sdk/discovery.d.ts.map +0 -1
- package/dist/sdk/discovery.js +0 -25
- package/dist/sdk/discovery.js.map +0 -1
- package/dist/sdk/events.d.ts +0 -269
- package/dist/sdk/events.d.ts.map +0 -1
- package/dist/sdk/events.js +0 -69
- package/dist/sdk/events.js.map +0 -1
- package/dist/sdk/exit-expression.d.ts +0 -13
- package/dist/sdk/exit-expression.d.ts.map +0 -1
- package/dist/sdk/exit-expression.js +0 -35
- package/dist/sdk/exit-expression.js.map +0 -1
- package/dist/sdk/index.d.ts +0 -17
- package/dist/sdk/index.d.ts.map +0 -1
- package/dist/sdk/index.js +0 -17
- package/dist/sdk/index.js.map +0 -1
- package/dist/sdk/middleware.d.ts +0 -59
- package/dist/sdk/middleware.d.ts.map +0 -1
- package/dist/sdk/middleware.js +0 -69
- package/dist/sdk/middleware.js.map +0 -1
- package/dist/sdk/pipeline/PipelineBuilder.d.ts +0 -79
- package/dist/sdk/pipeline/PipelineBuilder.d.ts.map +0 -1
- package/dist/sdk/pipeline/PipelineBuilder.js +0 -129
- package/dist/sdk/pipeline/PipelineBuilder.js.map +0 -1
- package/dist/sdk/pipeline/PipelineRunner.d.ts +0 -28
- package/dist/sdk/pipeline/PipelineRunner.d.ts.map +0 -1
- package/dist/sdk/pipeline/PipelineRunner.js +0 -326
- package/dist/sdk/pipeline/PipelineRunner.js.map +0 -1
- package/dist/sdk/pipeline/compiler.d.ts +0 -24
- package/dist/sdk/pipeline/compiler.d.ts.map +0 -1
- package/dist/sdk/pipeline/compiler.js +0 -199
- package/dist/sdk/pipeline/compiler.js.map +0 -1
- package/dist/sdk/pipeline/declarative.d.ts +0 -34
- package/dist/sdk/pipeline/declarative.d.ts.map +0 -1
- package/dist/sdk/pipeline/declarative.js +0 -9
- package/dist/sdk/pipeline/declarative.js.map +0 -1
- package/dist/sdk/pipeline/index.d.ts +0 -20
- package/dist/sdk/pipeline/index.d.ts.map +0 -1
- package/dist/sdk/pipeline/index.js +0 -19
- package/dist/sdk/pipeline/index.js.map +0 -1
- package/dist/sdk/pipeline/types.d.ts +0 -93
- package/dist/sdk/pipeline/types.d.ts.map +0 -1
- package/dist/sdk/pipeline/types.js +0 -10
- package/dist/sdk/pipeline/types.js.map +0 -1
- package/dist/sdk/policies.d.ts +0 -163
- package/dist/sdk/policies.d.ts.map +0 -1
- package/dist/sdk/policies.js +0 -243
- package/dist/sdk/policies.js.map +0 -1
- package/dist/sdk/runner/AgentRunner.d.ts +0 -22
- package/dist/sdk/runner/AgentRunner.d.ts.map +0 -1
- package/dist/sdk/runner/AgentRunner.js +0 -222
- package/dist/sdk/runner/AgentRunner.js.map +0 -1
- package/dist/sdk/runner/finalize.d.ts +0 -56
- package/dist/sdk/runner/finalize.d.ts.map +0 -1
- package/dist/sdk/runner/finalize.js +0 -155
- package/dist/sdk/runner/finalize.js.map +0 -1
- package/dist/sdk/runner/formats.d.ts +0 -7
- package/dist/sdk/runner/formats.d.ts.map +0 -1
- package/dist/sdk/runner/formats.js +0 -76
- package/dist/sdk/runner/formats.js.map +0 -1
- package/dist/sdk/runner/index.d.ts +0 -9
- package/dist/sdk/runner/index.d.ts.map +0 -1
- package/dist/sdk/runner/index.js +0 -9
- package/dist/sdk/runner/index.js.map +0 -1
- package/dist/sdk/runner/progress.d.ts +0 -3
- package/dist/sdk/runner/progress.d.ts.map +0 -1
- package/dist/sdk/runner/progress.js +0 -16
- package/dist/sdk/runner/progress.js.map +0 -1
- package/dist/sdk/schemas.d.ts +0 -72
- package/dist/sdk/schemas.d.ts.map +0 -1
- package/dist/sdk/schemas.js +0 -282
- package/dist/sdk/schemas.js.map +0 -1
- package/dist/sdk/trigger-context.d.ts +0 -24
- package/dist/sdk/trigger-context.d.ts.map +0 -1
- package/dist/sdk/trigger-context.js +0 -136
- package/dist/sdk/trigger-context.js.map +0 -1
- package/dist/session/SessionContext.d.ts +0 -89
- package/dist/session/SessionContext.d.ts.map +0 -1
- package/dist/session/SessionContext.js +0 -410
- package/dist/session/SessionContext.js.map +0 -1
- package/dist/session/environment.d.ts +0 -52
- package/dist/session/environment.d.ts.map +0 -1
- package/dist/session/environment.js +0 -27
- package/dist/session/environment.js.map +0 -1
- package/dist/session/history.d.ts +0 -18
- package/dist/session/history.d.ts.map +0 -1
- package/dist/session/history.js +0 -68
- package/dist/session/history.js.map +0 -1
- package/dist/session/index.d.ts +0 -10
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js +0 -9
- package/dist/session/index.js.map +0 -1
- package/dist/session/serverData.d.ts +0 -38
- package/dist/session/serverData.d.ts.map +0 -1
- package/dist/session/serverData.js +0 -261
- package/dist/session/serverData.js.map +0 -1
- package/dist/tracing/pipelineHelpers.d.ts +0 -29
- package/dist/tracing/pipelineHelpers.d.ts.map +0 -1
- package/dist/tracing/pipelineHelpers.js +0 -224
- package/dist/tracing/pipelineHelpers.js.map +0 -1
- package/dist/tracking/Tracker.d.ts +0 -55
- package/dist/tracking/Tracker.d.ts.map +0 -1
- package/dist/tracking/Tracker.js +0 -217
- package/dist/tracking/Tracker.js.map +0 -1
- package/dist/tracking/index.d.ts +0 -8
- package/dist/tracking/index.d.ts.map +0 -1
- package/dist/tracking/index.js +0 -8
- package/dist/tracking/index.js.map +0 -1
- package/dist/tracking/schemas.d.ts +0 -292
- package/dist/tracking/schemas.d.ts.map +0 -1
- package/dist/tracking/schemas.js +0 -91
- package/dist/tracking/schemas.js.map +0 -1
- package/dist/utils/extractSetFlags.d.ts +0 -6
- package/dist/utils/extractSetFlags.d.ts.map +0 -1
- package/dist/utils/extractSetFlags.js +0 -16
- package/dist/utils/extractSetFlags.js.map +0 -1
- package/dist/utils/formatTimeAgo.d.ts +0 -2
- package/dist/utils/formatTimeAgo.d.ts.map +0 -1
- package/dist/utils/formatTimeAgo.js +0 -20
- package/dist/utils/formatTimeAgo.js.map +0 -1
- package/dist/utils/index.d.ts +0 -12
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -12
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/machineId.d.ts +0 -14
- package/dist/utils/machineId.d.ts.map +0 -1
- package/dist/utils/machineId.js +0 -66
- package/dist/utils/machineId.js.map +0 -1
- package/dist/utils/pathUtils.d.ts +0 -22
- package/dist/utils/pathUtils.d.ts.map +0 -1
- package/dist/utils/pathUtils.js +0 -54
- package/dist/utils/pathUtils.js.map +0 -1
- package/scripts/download-ripgrep.js +0 -269
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes thrown by the SDK 2.0 client surface.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Thrown by API surfaces whose bodies haven't landed yet. Loud-but-typed —
|
|
6
|
+
* the `ticket` field tells callers which work item fills this method's
|
|
7
|
+
* body so they can wait for the right milestone.
|
|
8
|
+
*/
|
|
9
|
+
export class QodoNotImplementedError extends Error {
|
|
10
|
+
/** Always `'QodoNotImplementedError'`. */
|
|
11
|
+
name = 'QodoNotImplementedError';
|
|
12
|
+
/** Human-readable name of the API surface that's not yet implemented. */
|
|
13
|
+
api;
|
|
14
|
+
/** Ticket ID that fills this stub. */
|
|
15
|
+
ticket;
|
|
16
|
+
constructor(api, ticket) {
|
|
17
|
+
super(`${api}: Not implemented yet; the API redesign locks the contract here. Implementation lands in ${ticket} and downstream tickets.`);
|
|
18
|
+
this.api = api;
|
|
19
|
+
this.ticket = ticket;
|
|
20
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Thrown when consumer code drives the client into an invalid state at
|
|
25
|
+
* construction time (bad URL, missing required option). Distinct from
|
|
26
|
+
* `QodoNotImplementedError` because this is a real validation failure.
|
|
27
|
+
*/
|
|
28
|
+
export class QodoClientOptionsError extends Error {
|
|
29
|
+
name = 'QodoClientOptionsError';
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Thrown by `tasks.cancel` when the consumer-supplied `AbortSignal`
|
|
37
|
+
* short-circuits the cancel. Distinct from the generic "connection closed
|
|
38
|
+
* before task.done arrived" failure shape so consumers can branch on
|
|
39
|
+
* intentional abort vs. server-side cancel failure.
|
|
40
|
+
*
|
|
41
|
+
* `kind` distinguishes two scenarios with materially different wire
|
|
42
|
+
* effects:
|
|
43
|
+
*
|
|
44
|
+
* - `'pre_aborted'`: signal was already aborted at the call site.
|
|
45
|
+
* NO wire `task.cancel` was emitted (and nothing else). The
|
|
46
|
+
* consumer can safely treat the task as untouched by this call.
|
|
47
|
+
* Because `tasks.cancel` is async, this surfaces as a rejected
|
|
48
|
+
* Promise — `try / catch` around `await tasks.cancel(...)` is
|
|
49
|
+
* the consumer-side pattern, identical to the post-send-abort
|
|
50
|
+
* case below.
|
|
51
|
+
*
|
|
52
|
+
* - `'aborted_after_send'`: the wire `task.cancel` was already on
|
|
53
|
+
* the wire when the signal aborted. The server's terminal
|
|
54
|
+
* `task.done` still arrives on the task's own subscription
|
|
55
|
+
* (initiated by `tasks.start` / `tasks.continue`); only the
|
|
56
|
+
* wait inside `tasks.cancel` was abandoned.
|
|
57
|
+
*
|
|
58
|
+
* Carries `taskId` so consumers can match the throw against their own
|
|
59
|
+
* task-id state without parsing the message.
|
|
60
|
+
*/
|
|
61
|
+
export class QodoCancelAbortedError extends Error {
|
|
62
|
+
name = 'QodoCancelAbortedError';
|
|
63
|
+
taskId;
|
|
64
|
+
kind;
|
|
65
|
+
constructor(kind, taskId, reason) {
|
|
66
|
+
const reasonStr = reason === undefined
|
|
67
|
+
? ''
|
|
68
|
+
: reason instanceof Error
|
|
69
|
+
? `: ${reason.message}`
|
|
70
|
+
: `: ${String(reason)}`;
|
|
71
|
+
const message = kind === 'pre_aborted'
|
|
72
|
+
? `tasks.cancel(${taskId}) — consumer-supplied AbortSignal was ` +
|
|
73
|
+
`already aborted at the call site${reasonStr}. No wire task.cancel ` +
|
|
74
|
+
`was emitted; the task is untouched by this call.`
|
|
75
|
+
: `tasks.cancel(${taskId}) — consumer-supplied AbortSignal fired ` +
|
|
76
|
+
`before task.done arrived${reasonStr}. The wire task.cancel was ` +
|
|
77
|
+
`already sent; the underlying task's terminal ack still routes ` +
|
|
78
|
+
`through its own tasks.start / tasks.continue subscription.`;
|
|
79
|
+
super(message);
|
|
80
|
+
this.kind = kind;
|
|
81
|
+
this.taskId = taskId;
|
|
82
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Thrown synchronously by `tasks.cancel` / `tasks.continue` /
|
|
87
|
+
* `tasks.resubscribe` / `tools.respond` when the SDK can't determine the
|
|
88
|
+
* per-Task / per-ToolCall `session_id` locally AND the caller didn't pass
|
|
89
|
+
* the explicit `sessionId` option.
|
|
90
|
+
*
|
|
91
|
+
* Surfaces locally before the wire write so the remediation lands in the
|
|
92
|
+
* error message rather than in a wire round-trip's
|
|
93
|
+
* `session_mismatch` rejection:
|
|
94
|
+
*
|
|
95
|
+
* - For cross-process recovery: hydrate `{ taskId, sessionId }` from
|
|
96
|
+
* durable storage and pass `sessionId` in the cold-address options.
|
|
97
|
+
* - For HITL respond after restart: same shape via
|
|
98
|
+
* `client.tools.respond(node, response, { sessionId })`.
|
|
99
|
+
*
|
|
100
|
+
* `kind` is a stable discriminator (`'task'` for the three task ongoing
|
|
101
|
+
* envelopes; `'tool_call'` for `tools.respond`) so consumer logging /
|
|
102
|
+
* branching can pick the right hydration path without parsing the message.
|
|
103
|
+
*/
|
|
104
|
+
export class QodoColdAddressError extends Error {
|
|
105
|
+
name = 'QodoColdAddressError';
|
|
106
|
+
kind;
|
|
107
|
+
addressId;
|
|
108
|
+
constructor(kind, addressId) {
|
|
109
|
+
// The cold-address option is named `sessionId` on both
|
|
110
|
+
// surfaces ({@link TaskOptions} / {@link TaskCancelOptions} /
|
|
111
|
+
// {@link ResubscribeOptions} for task ops, {@link ToolRespondOptions}
|
|
112
|
+
// for tool ops). The surface and id-field name differ per kind;
|
|
113
|
+
// the option name is constant.
|
|
114
|
+
const surface = kind === 'task'
|
|
115
|
+
? 'tasks.cancel / tasks.continue / tasks.resubscribe'
|
|
116
|
+
: 'tools.respond';
|
|
117
|
+
super(`No in-memory session for ${kind === 'task' ? 'taskId' : 'tool_call_id'}=${addressId}. ` +
|
|
118
|
+
`This usually means a cross-process recovery path: the SDK didn't observe ` +
|
|
119
|
+
`the originating ${kind === 'task' ? 'task.started' : 'tool.request'} envelope ` +
|
|
120
|
+
`in this process. Hydrate the matching session_id from durable storage and ` +
|
|
121
|
+
`pass it as the \`sessionId\` option to ${surface}.`);
|
|
122
|
+
this.kind = kind;
|
|
123
|
+
this.addressId = addressId;
|
|
124
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Client-side `idempotency_key` validation failure.
|
|
129
|
+
*
|
|
130
|
+
* Thrown synchronously by `tasks.start` / `tasks.startWithAgent` /
|
|
131
|
+
* `tasks.startWithGraph` BEFORE the wire write when the consumer-supplied
|
|
132
|
+
* `idempotencyKey` violates the wire contract (1–512 **Unicode code
|
|
133
|
+
* points** — counted by `[...str].length`, not UTF-16 code units — and no
|
|
134
|
+
* NUL byte). Mirrors QAR's Pydantic `Field(min_length=1, max_length=512,
|
|
135
|
+
* pattern=r"^[^\x00]+$")` on `TaskStartPayload.idempotency_key` so a bad
|
|
136
|
+
* value fails fast on the SDK side without waiting for the wire round-trip.
|
|
137
|
+
*
|
|
138
|
+
* The `reason` field is a stable discriminator (`'too_short'`, `'too_long'`,
|
|
139
|
+
* `'contains_nul'`) so test assertions and downstream consumer error
|
|
140
|
+
* handling can branch without parsing the human message.
|
|
141
|
+
*/
|
|
142
|
+
export class QodoIdempotencyKeyValidationError extends Error {
|
|
143
|
+
name = 'QodoIdempotencyKeyValidationError';
|
|
144
|
+
reason;
|
|
145
|
+
codePoints;
|
|
146
|
+
constructor(reason, codePoints) {
|
|
147
|
+
const messages = {
|
|
148
|
+
too_short: `idempotencyKey must be 1–512 Unicode code points; received 0. ` +
|
|
149
|
+
`Omit the field for the DX-default path (server mints a fresh uuidv7).`,
|
|
150
|
+
too_long: `idempotencyKey must be 1–512 Unicode code points; received ${codePoints}. ` +
|
|
151
|
+
`If the natural-identity composition is too long, hash and pass the digest.`,
|
|
152
|
+
contains_nul: `idempotencyKey must not contain NUL (\\x00); received a key with ${codePoints} ` +
|
|
153
|
+
`code points including at least one NUL.`,
|
|
154
|
+
};
|
|
155
|
+
super(messages[reason]);
|
|
156
|
+
this.reason = reason;
|
|
157
|
+
this.codePoints = codePoints;
|
|
158
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Thrown synchronously by {@link TaskClient.continueOrStart} when the
|
|
163
|
+
* `graphSpec` argument is `undefined`. The helper requires a graphSpec
|
|
164
|
+
* to handle the fresh-dispatch branch; consumers without one on hand
|
|
165
|
+
* should reach for {@link TaskClient.continue} (if they already have a
|
|
166
|
+
* `taskId`) or {@link TaskClient.forceResume} (if they only have the
|
|
167
|
+
* `idempotencyKey` and want stuck-session recovery).
|
|
168
|
+
*
|
|
169
|
+
* Carries the rejected `idempotencyKey` so error-handling code can
|
|
170
|
+
* surface which session-derivation key triggered the throw.
|
|
171
|
+
*/
|
|
172
|
+
export class RequiredGraphSpecError extends Error {
|
|
173
|
+
name = 'RequiredGraphSpecError';
|
|
174
|
+
idempotencyKey;
|
|
175
|
+
constructor(idempotencyKey) {
|
|
176
|
+
super(`continueOrStart requires a graphSpec for the fresh-dispatch branch ` +
|
|
177
|
+
`(idempotencyKey=${idempotencyKey}). Pass the consumer's InlineGraphSpec ` +
|
|
178
|
+
`or use tasks.continue / tasks.forceResume directly when no graphSpec ` +
|
|
179
|
+
`is available.`);
|
|
180
|
+
this.idempotencyKey = idempotencyKey;
|
|
181
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Thrown at the transport seam for inputs that would crash the underlying
|
|
186
|
+
* WebSocket library. Today this is just the RFC 6455 close-frame reason
|
|
187
|
+
* cap — a custom caller synthesizing a reason longer than 123 UTF-8
|
|
188
|
+
* bytes gets a typed SDK error rather than an opaque `ws` crash. The
|
|
189
|
+
* class is the home for any future transport-seam validation.
|
|
190
|
+
*/
|
|
191
|
+
export class QodoTransportError extends Error {
|
|
192
|
+
name = 'QodoTransportError';
|
|
193
|
+
constructor(message) {
|
|
194
|
+
super(message);
|
|
195
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Thrown when an outbound `task.start` / `task.continue` is rejected because
|
|
200
|
+
* the connection is in `flow.pause` state and the paused queue has already
|
|
201
|
+
* reached its cap. The matching wire-level taxonomy is
|
|
202
|
+
* `sdk.error { code: 'flow_backlog_exceeded' }`.
|
|
203
|
+
*
|
|
204
|
+
* Pathological case: under healthy traffic only one or two envelopes ever
|
|
205
|
+
* queue before `flow.resume` arrives. Hitting the cap means the consumer is
|
|
206
|
+
* driving the client far above QAR's per-session in-flight ceiling — backing
|
|
207
|
+
* off and waiting for `flow.resume` is the correct response.
|
|
208
|
+
*/
|
|
209
|
+
export class QodoBackpressureError extends Error {
|
|
210
|
+
name = 'QodoBackpressureError';
|
|
211
|
+
/** Wire-aligned error code. */
|
|
212
|
+
code = 'flow_backlog_exceeded';
|
|
213
|
+
/** How many envelopes were already queued when this call was rejected. */
|
|
214
|
+
queueSize;
|
|
215
|
+
/** The configured cap. */
|
|
216
|
+
queueCap;
|
|
217
|
+
constructor(queueSize, queueCap) {
|
|
218
|
+
super(`Outbound rejected: connection is paused and the backpressure queue is full ` +
|
|
219
|
+
`(${queueSize}/${queueCap}). Wait for flow.resume before sending more, or ` +
|
|
220
|
+
`raise backpressure.maxPausedQueueSize.`);
|
|
221
|
+
this.queueSize = queueSize;
|
|
222
|
+
this.queueCap = queueCap;
|
|
223
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Thrown by `client.specs.validate` when the supplied spec is structurally
|
|
228
|
+
* unfit to send — most commonly a missing or unknown `kind` discriminator.
|
|
229
|
+
*
|
|
230
|
+
* This is a *pre-wire* rejection: the spec never reached QAR. Per-rule
|
|
231
|
+
* failures (D10-R*, D11-R*) come back from the endpoint in the
|
|
232
|
+
* `SpecValidateResult.errors` array — those are not exceptions, they're a
|
|
233
|
+
* normal `valid: false` result.
|
|
234
|
+
*/
|
|
235
|
+
export class QodoSpecValidationError extends Error {
|
|
236
|
+
name = 'QodoSpecValidationError';
|
|
237
|
+
constructor(message) {
|
|
238
|
+
super(message);
|
|
239
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Thrown by `client.qar.registerAgent` / `client.qar.registerMcp` /
|
|
244
|
+
* `client.qar.registerA2A` when a name conflicts with an existing
|
|
245
|
+
* registration (and `replace: true` wasn't passed), or when the supplied
|
|
246
|
+
* name / endpoint is empty.
|
|
247
|
+
*
|
|
248
|
+
* Carries `entity` (`'agent' | 'mcp' | 'a2a'`) and `entryName` so test code
|
|
249
|
+
* and structured loggers can branch on the specific conflict shape without
|
|
250
|
+
* parsing the message text. `name` (the standard Error field) is fixed at
|
|
251
|
+
* `'QodoRegistryConflictError'`.
|
|
252
|
+
*
|
|
253
|
+
* **`entity` is open-ended by design.** New register-helpers (S9 added
|
|
254
|
+
* `'a2a'`; future surfaces will add more) extend this union additively.
|
|
255
|
+
* Consumers writing exhaustive `switch` / `assertNever` patterns on
|
|
256
|
+
* `entity` should treat unknown values as "another registry the SDK
|
|
257
|
+
* grew" — typically by routing through a default arm that surfaces the
|
|
258
|
+
* raw `entryName` + message. The SDK is on the 2.x major; breaking the
|
|
259
|
+
* union literally is allowed within the major per the SDK1→2 migration
|
|
260
|
+
* posture, but each addition lands behind its own feature commit so
|
|
261
|
+
* consumer code can pin if needed.
|
|
262
|
+
*/
|
|
263
|
+
export class QodoRegistryConflictError extends Error {
|
|
264
|
+
name = 'QodoRegistryConflictError';
|
|
265
|
+
/** Which registry the conflict came from. */
|
|
266
|
+
entity;
|
|
267
|
+
/** The name the caller tried to register. */
|
|
268
|
+
entryName;
|
|
269
|
+
constructor(entity, entryName, message) {
|
|
270
|
+
super(message);
|
|
271
|
+
this.entity = entity;
|
|
272
|
+
this.entryName = entryName;
|
|
273
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Surfaced when the SDK's tool-tunneling layer encounters an envelope
|
|
278
|
+
* that violates the parallel-batched wire shape. Two scopes:
|
|
279
|
+
*
|
|
280
|
+
* - **`outbound`** — thrown synchronously from `client.tools.respond(...)`
|
|
281
|
+
* when the caller's input is malformed (empty `node_name`, empty
|
|
282
|
+
* `responses`). Catches consumer bugs at the call site instead of
|
|
283
|
+
* letting them silently ship a malformed envelope onto the wire.
|
|
284
|
+
*
|
|
285
|
+
* - **`inbound`** — NOT thrown (throwing would fail the whole connection
|
|
286
|
+
* across every subscription). Surfaced via
|
|
287
|
+
* `client.tools.onWireValidationError(handler)` after the
|
|
288
|
+
* `[@qodo/sdk]` console.error breadcrumb fires. The SDK has no
|
|
289
|
+
* `tool_call_id` to respond against for these envelopes, so consumers
|
|
290
|
+
* observe the failure but can't actively recover — QAR's per-task
|
|
291
|
+
* tool-response timeout is the wire-side safety net.
|
|
292
|
+
*
|
|
293
|
+
* Handler-return shape violations (positional length mismatch from a
|
|
294
|
+
* `ToolRequestHandler`, malformed `ToolResponseResult`) are NOT surfaced as
|
|
295
|
+
* `QodoWireValidationError` — they're converted to per-call
|
|
296
|
+
* `status: 'error'` items on the wire so the agent loop unblocks
|
|
297
|
+
* deterministically.
|
|
298
|
+
*
|
|
299
|
+
* Distinct from `TypeError` because the failure is wire-shape specific;
|
|
300
|
+
* consumers wanting a broader catch should `instanceof Error`. The
|
|
301
|
+
* structured `context` field is the preferred branch surface —
|
|
302
|
+
* `instanceof QodoWireValidationError` then switch on `err.context.scope`.
|
|
303
|
+
*/
|
|
304
|
+
export class QodoWireValidationError extends Error {
|
|
305
|
+
name = 'QodoWireValidationError';
|
|
306
|
+
/** Structured drop metadata. Always populated. */
|
|
307
|
+
context;
|
|
308
|
+
constructor(message, context = { scope: 'outbound' }) {
|
|
309
|
+
super(message);
|
|
310
|
+
this.context = context;
|
|
311
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// ---------------------------------------------------------------------------
|
|
315
|
+
// MCP projection errors — surfaced synchronously by `tasks.startWithAgent`
|
|
316
|
+
// / `tasks.startWithGraph` BEFORE the wire write when the consumer's
|
|
317
|
+
// `mcpTools` selector references unknown MCPs, unknown tools, or unreachable
|
|
318
|
+
// MCPs whose `unavailability` policy is `'fail'`.
|
|
319
|
+
//
|
|
320
|
+
// All three subclass `QodoWireValidationError` so consumers writing a single
|
|
321
|
+
// catch on the wire-validation taxonomy pick them up. Concrete error classes
|
|
322
|
+
// carry typed `names`/`dottedNames` arrays so structured logging and IDE-side
|
|
323
|
+
// remediation can branch on the exact drift without parsing the message text.
|
|
324
|
+
// ---------------------------------------------------------------------------
|
|
325
|
+
/**
|
|
326
|
+
* Thrown by `tasks.startWithAgent` / `tasks.startWithGraph` when the
|
|
327
|
+
* consumer's `mcpTools` selector references an MCP name that isn't
|
|
328
|
+
* registered on this client.
|
|
329
|
+
*
|
|
330
|
+
* Surface remediation: call `client.qar.registerMcp('<name>', ...)`
|
|
331
|
+
* before the dispatch, or drop the entry from the `mcpTools` selector.
|
|
332
|
+
*/
|
|
333
|
+
export class QodoUnknownMcpError extends QodoWireValidationError {
|
|
334
|
+
name = 'QodoUnknownMcpError';
|
|
335
|
+
/** Distinct MCP names referenced by `mcpTools` but not present in the registry. */
|
|
336
|
+
mcpNames;
|
|
337
|
+
constructor(mcpNames) {
|
|
338
|
+
super(`Inline AgentSpec.mcpTools references ${mcpNames.length} unregistered MCP ` +
|
|
339
|
+
`name${mcpNames.length === 1 ? '' : 's'}: ${mcpNames.map((n) => `'${n}'`).join(', ')}. ` +
|
|
340
|
+
`Register them via client.qar.registerMcp(...) before tasks.start*, or drop ` +
|
|
341
|
+
`them from the selector.`, { scope: 'outbound' });
|
|
342
|
+
this.mcpNames = mcpNames;
|
|
343
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Thrown by `tasks.startWithAgent` / `tasks.startWithGraph` when the
|
|
348
|
+
* consumer's `mcpTools` selector — or the sibling `mcpToolOverrides`
|
|
349
|
+
* map — references a `<mcp>.<tool>` dotted name whose MCP IS registered
|
|
350
|
+
* but whose live catalog doesn't expose the named tool.
|
|
351
|
+
*
|
|
352
|
+
* Catches version drift between consumer code and upstream MCP catalogs
|
|
353
|
+
* at task.start, not at LLM-call time. Pair with
|
|
354
|
+
* `client.qar.listMcpTools(name)` during development to see the live
|
|
355
|
+
* surface.
|
|
356
|
+
*/
|
|
357
|
+
export class QodoUnknownMcpToolError extends QodoWireValidationError {
|
|
358
|
+
name = 'QodoUnknownMcpToolError';
|
|
359
|
+
/** Distinct `<mcp>.<tool>` dotted names that don't resolve to a discovered tool. */
|
|
360
|
+
dottedNames;
|
|
361
|
+
constructor(dottedNames) {
|
|
362
|
+
super(`Inline AgentSpec.mcpTools / mcpToolOverrides references ${dottedNames.length} ` +
|
|
363
|
+
`tool${dottedNames.length === 1 ? '' : 's'} not in the live MCP catalog: ` +
|
|
364
|
+
`${dottedNames.map((n) => `'${n}'`).join(', ')}. ` +
|
|
365
|
+
`Use client.qar.listMcpTools('<mcp>') to inspect the current surface; ` +
|
|
366
|
+
`update the selector after upstream tool renames.`, { scope: 'outbound' });
|
|
367
|
+
this.dottedNames = dottedNames;
|
|
368
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Thrown by `tasks.startWithAgent` / `tasks.startWithGraph` when a
|
|
373
|
+
* registered MCP whose `unavailability` policy is `'fail'` (the default)
|
|
374
|
+
* has no cached catalog at projection time — its cold-start
|
|
375
|
+
* `Client.connect()` + `tools/list` cycle didn't complete inside the
|
|
376
|
+
* SDK's settle window.
|
|
377
|
+
*
|
|
378
|
+
* Indicates a real config / startup bug for local sidecars (typical
|
|
379
|
+
* fail-mode for `litegit`, `slack`, in-cluster MCPs). For third-party
|
|
380
|
+
* remote MCPs that flake transiently, register with
|
|
381
|
+
* `{ unavailability: 'warn' }` to ship without the MCP's tools instead
|
|
382
|
+
* of failing the task.
|
|
383
|
+
*/
|
|
384
|
+
export class QodoMcpUnavailableError extends QodoWireValidationError {
|
|
385
|
+
name = 'QodoMcpUnavailableError';
|
|
386
|
+
/** Distinct MCP names whose `unavailability` is `'fail'` and whose catalog hasn't populated. */
|
|
387
|
+
mcpNames;
|
|
388
|
+
constructor(mcpNames) {
|
|
389
|
+
super(`${mcpNames.length} registered MCP${mcpNames.length === 1 ? '' : 's'} ` +
|
|
390
|
+
`unreachable at tasks.start* (cold-start catalog not populated, ` +
|
|
391
|
+
`unavailability: 'fail'): ${mcpNames.map((n) => `'${n}'`).join(', ')}. ` +
|
|
392
|
+
`Verify the MCP endpoint is reachable, or register with ` +
|
|
393
|
+
`{ unavailability: 'warn' } to degrade gracefully.`, { scope: 'outbound' });
|
|
394
|
+
this.mcpNames = mcpNames;
|
|
395
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Thrown by `client.tasks.startWithGraph(...)` when the inline `GraphSpec`
|
|
400
|
+
* fails one of the SDK's pre-wire structural checks against the
|
|
401
|
+
* GraphSpec safe subset.
|
|
402
|
+
*
|
|
403
|
+
* Pre-wire rejection: the envelope never reaches QAR. Same `rule_id` /
|
|
404
|
+
* `path` / `message` shape as `client.specs.validate(...)` per-rule failures,
|
|
405
|
+
* so consumers can route both surfaces into the same error handler.
|
|
406
|
+
*
|
|
407
|
+
* The SDK enforces the rule subset that doesn't require server-side
|
|
408
|
+
* state (no tenant lookup, no model-registry probe):
|
|
409
|
+
* - `D11-R1..R3` — entry / agents present + named uniquely.
|
|
410
|
+
* - `D11-R6..R8` — edges resolve to declared agents, entry resolves.
|
|
411
|
+
* - `D11-R9` — `evaluate` edges only target evaluator-role nodes.
|
|
412
|
+
* - `D11-R10` — graph depth ≤ configured maximum (default 4).
|
|
413
|
+
* - `D11-R11` — evaluator nodes are leaves (no outbound edges).
|
|
414
|
+
* - `D11-R12` — evaluator `output_schema` is shaped like `VerdictResult`.
|
|
415
|
+
* - `D11-Rcycle` — acyclicity (the SDK rejects cycles unconditionally; QAR
|
|
416
|
+
* surfaces the same rule via `D11-R9` numbering in its own response shape).
|
|
417
|
+
*
|
|
418
|
+
* Rules requiring server-side state (AgentSpec composition, alternate
|
|
419
|
+
* operator-maximum depth) flow through the `client.specs.validate(...)`
|
|
420
|
+
* opt-in pre-flight instead — see `preflight: true` on `TaskOptions`.
|
|
421
|
+
*/
|
|
422
|
+
export class QodoInlineGraphValidationError extends Error {
|
|
423
|
+
name = 'QodoInlineGraphValidationError';
|
|
424
|
+
/** All failures the validator observed, in stable depth-first order. */
|
|
425
|
+
failures;
|
|
426
|
+
constructor(failures) {
|
|
427
|
+
super(`inline GraphSpec failed ${failures.length} client-side validation rule${failures.length === 1 ? '' : 's'}: ` +
|
|
428
|
+
failures
|
|
429
|
+
.map((f) => `[${f.rule_id} @ ${f.path === '' ? '(root)' : f.path}] ${f.message}`)
|
|
430
|
+
.join('; '));
|
|
431
|
+
this.failures = failures;
|
|
432
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Thrown synchronously by `client.tasks.startWithAgent({ agent: spec, ... })`
|
|
437
|
+
* when the supplied `InlineAgentSpec` violates the data-only safe subset
|
|
438
|
+
* before the wire write. Carries the structured `issues` array so
|
|
439
|
+
* structured-logging consumers can branch on `rule_id` / `path` without
|
|
440
|
+
* parsing the message text.
|
|
441
|
+
*
|
|
442
|
+
* **Pre-wire only.** The mirror error for server-rejected specs (after
|
|
443
|
+
* the wire write, when QAR's validator runs the full ruleset including
|
|
444
|
+
* registry-dependent rules) is `QodoAgentSpecRejectedError`, surfaced
|
|
445
|
+
* via the task iterator's `kind: 'error'` envelope.
|
|
446
|
+
*
|
|
447
|
+
* Distinct from `QodoSpecValidationError` (which is for
|
|
448
|
+
* `client.specs.validate` — the pre-flight wrapper around
|
|
449
|
+
* `POST /v1/specs/validate`); both exist because the pre-flight wrapper
|
|
450
|
+
* accepts intentionally-invalid shapes (the whole point is to ask the
|
|
451
|
+
* server "tell me which rule I broke"), while `startWithAgent` rejects
|
|
452
|
+
* at intake to avoid kicking off server-side work the spec can't possibly
|
|
453
|
+
* pass.
|
|
454
|
+
*/
|
|
455
|
+
export class QodoInlineAgentValidationError extends Error {
|
|
456
|
+
name = 'QodoInlineAgentValidationError';
|
|
457
|
+
/** Per-violation breakdown — at least one entry. */
|
|
458
|
+
issues;
|
|
459
|
+
constructor(issues) {
|
|
460
|
+
const head = issues[0];
|
|
461
|
+
const summary = head !== undefined
|
|
462
|
+
? `${head.rule_id} @ ${head.path || '<root>'}: ${head.message}`
|
|
463
|
+
: 'inline AgentSpec rejected (no issues reported)';
|
|
464
|
+
const tail = issues.length > 1 ? ` (+${issues.length - 1} more)` : '';
|
|
465
|
+
super(`Inline AgentSpec rejected at intake — ${summary}${tail}`);
|
|
466
|
+
this.issues = issues;
|
|
467
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Thrown / surfaced when QAR's `_handle_task_start` rejects the supplied
|
|
472
|
+
* inline `agent: InlineAgentSpec` (Pattern B) at wire-validation time via
|
|
473
|
+
* an `error { code: 'agent_spec_rejected' }` envelope. Mirror for the
|
|
474
|
+
* server-static path doesn't exist — there's no inline-spec to reject for
|
|
475
|
+
* Pattern A.
|
|
476
|
+
*
|
|
477
|
+
* Carries the full `issues` array so consumers can show per-rule messages
|
|
478
|
+
* in IDE / Studio surfaces. The first issue's `rule_id` is also exposed
|
|
479
|
+
* at `rule_id` / `path` for the common "just give me the primary failure"
|
|
480
|
+
* branch.
|
|
481
|
+
*
|
|
482
|
+
* Surfaced via the iterator returned by `tasks.startWithAgent`: when the
|
|
483
|
+
* first inbound envelope is an `error { code: 'agent_spec_rejected' }`,
|
|
484
|
+
* the iterator rejects with this error (instead of yielding the envelope)
|
|
485
|
+
* so consumers don't need to defensively type-narrow the error case out
|
|
486
|
+
* of `TaskEvent.kind`.
|
|
487
|
+
*/
|
|
488
|
+
export class QodoAgentSpecRejectedError extends Error {
|
|
489
|
+
name = 'QodoAgentSpecRejectedError';
|
|
490
|
+
/** Wire-aligned error code. */
|
|
491
|
+
code = 'agent_spec_rejected';
|
|
492
|
+
/** Per-violation breakdown — at least one entry. */
|
|
493
|
+
issues;
|
|
494
|
+
/** Convenience: first issue's `rule_id` (`'D10-R*'` or `'D10-UNSUPPORTED*'`). */
|
|
495
|
+
rule_id;
|
|
496
|
+
/** Convenience: first issue's `path` (RFC 6901 JSON Pointer; `""` = root). */
|
|
497
|
+
path;
|
|
498
|
+
constructor(issues, message) {
|
|
499
|
+
const primary = issues[0];
|
|
500
|
+
if (primary === undefined) {
|
|
501
|
+
throw new TypeError('QodoAgentSpecRejectedError requires at least one issue (got an empty array)');
|
|
502
|
+
}
|
|
503
|
+
const summary = `${primary.rule_id} @ ${primary.path || '<root>'}: ${primary.message}`;
|
|
504
|
+
const tail = issues.length > 1 ? ` (+${issues.length - 1} more)` : '';
|
|
505
|
+
super(message ?? `Inline AgentSpec rejected by server — ${summary}${tail}`);
|
|
506
|
+
this.issues = issues;
|
|
507
|
+
this.rule_id = primary.rule_id;
|
|
508
|
+
this.path = primary.path;
|
|
509
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Base class for every typed server-error class (cancel/resume/HITL/graph
|
|
514
|
+
* codes). Each concrete subclass pins its `code` to the documented QAR
|
|
515
|
+
* wire string so consumers can branch on
|
|
516
|
+
* `instanceof QodoCancelRoutingFailedError` instead of
|
|
517
|
+
* `err.code === 'cancel_routing_failed'`.
|
|
518
|
+
*
|
|
519
|
+
* `QodoAgentSpecRejectedError` predates this base and keeps its own
|
|
520
|
+
* shape; new error codes here use the unified `QodoServerError` surface
|
|
521
|
+
* for forward compatibility.
|
|
522
|
+
*/
|
|
523
|
+
export class QodoServerError extends Error {
|
|
524
|
+
/** Wire-level QAR error code. Pinned per subclass. */
|
|
525
|
+
code;
|
|
526
|
+
/**
|
|
527
|
+
* Structured per-rule breakdown, if QAR shipped one on the envelope. Empty
|
|
528
|
+
* array when the envelope only carried top-level `code` + `message`.
|
|
529
|
+
*/
|
|
530
|
+
errors;
|
|
531
|
+
/** `payload.offending_message_id` — useful for tracing the cause envelope. */
|
|
532
|
+
offendingMessageId;
|
|
533
|
+
/**
|
|
534
|
+
* @param name The concrete subclass name (matches `this.name`).
|
|
535
|
+
* @param code Wire-level error code.
|
|
536
|
+
* @param message Human-readable summary; mirrored to `Error.message`.
|
|
537
|
+
* @param errors Structured breakdown when QAR emitted one. Default `[]`.
|
|
538
|
+
* @param offendingMessageId `error.payload.offending_message_id` if present.
|
|
539
|
+
*/
|
|
540
|
+
constructor(name, code, message, errors = [], offendingMessageId) {
|
|
541
|
+
super(message);
|
|
542
|
+
this.name = name;
|
|
543
|
+
this.code = code;
|
|
544
|
+
this.errors = errors;
|
|
545
|
+
if (offendingMessageId !== undefined)
|
|
546
|
+
this.offendingMessageId = offendingMessageId;
|
|
547
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
/** Cancel routing lookup failed — see QAR `_handle_task_cancel`. */
|
|
551
|
+
export class QodoCancelRoutingFailedError extends QodoServerError {
|
|
552
|
+
name = 'QodoCancelRoutingFailedError';
|
|
553
|
+
constructor(message, errors, offendingMessageId) {
|
|
554
|
+
super('QodoCancelRoutingFailedError', 'cancel_routing_failed', message, errors, offendingMessageId);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
/** Cancel all-writes-fail — see QAR `_handle_task_cancel`. */
|
|
558
|
+
export class QodoCancelFailedError extends QodoServerError {
|
|
559
|
+
name = 'QodoCancelFailedError';
|
|
560
|
+
constructor(message, errors, offendingMessageId) {
|
|
561
|
+
super('QodoCancelFailedError', 'cancel_failed', message, errors, offendingMessageId);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
/** Session lookup miss — `cancel`/`continue` against an unknown task. */
|
|
565
|
+
export class QodoTaskNotFoundError extends QodoServerError {
|
|
566
|
+
name = 'QodoTaskNotFoundError';
|
|
567
|
+
constructor(message, errors, offendingMessageId) {
|
|
568
|
+
super('QodoTaskNotFoundError', 'task_not_found', message, errors, offendingMessageId);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
/** Cancel-on-non-waiting-task — see QAR `_handle_task_cancel` precondition. */
|
|
572
|
+
export class QodoTaskNotWaitingError extends QodoServerError {
|
|
573
|
+
name = 'QodoTaskNotWaitingError';
|
|
574
|
+
constructor(message, errors, offendingMessageId) {
|
|
575
|
+
super('QodoTaskNotWaitingError', 'task_not_waiting', message, errors, offendingMessageId);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
/** Pod failed to reconstruct the agent for a cross-pod task. */
|
|
579
|
+
export class QodoAgentReconstructionFailedError extends QodoServerError {
|
|
580
|
+
name = 'QodoAgentReconstructionFailedError';
|
|
581
|
+
constructor(message, errors, offendingMessageId) {
|
|
582
|
+
super('QodoAgentReconstructionFailedError', 'agent_reconstruction_failed', message, errors, offendingMessageId);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
/** Cross-pod resume hook aborted before delivering control. */
|
|
586
|
+
export class QodoCrossPodResumeAbortedError extends QodoServerError {
|
|
587
|
+
name = 'QodoCrossPodResumeAbortedError';
|
|
588
|
+
constructor(message, errors, offendingMessageId) {
|
|
589
|
+
super('QodoCrossPodResumeAbortedError', 'cross_pod_resume_aborted', message, errors, offendingMessageId);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
/** Deps construction failed during agent dispatch (Pattern A/B/C). */
|
|
593
|
+
export class QodoDepsConstructionFailedError extends QodoServerError {
|
|
594
|
+
name = 'QodoDepsConstructionFailedError';
|
|
595
|
+
constructor(message, errors, offendingMessageId) {
|
|
596
|
+
super('QodoDepsConstructionFailedError', 'deps_construction_failed', message, errors, offendingMessageId);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
/** Message history load failed during resume / continue. */
|
|
600
|
+
export class QodoMessageHistoryLoadFailedError extends QodoServerError {
|
|
601
|
+
name = 'QodoMessageHistoryLoadFailedError';
|
|
602
|
+
constructor(message, errors, offendingMessageId) {
|
|
603
|
+
super('QodoMessageHistoryLoadFailedError', 'message_history_load_failed', message, errors, offendingMessageId);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
/** HITL persistence failure — substrate accepted but the row didn't durable. */
|
|
607
|
+
export class QodoHitlPersistFailedError extends QodoServerError {
|
|
608
|
+
name = 'QodoHitlPersistFailedError';
|
|
609
|
+
constructor(message, errors, offendingMessageId) {
|
|
610
|
+
super('QodoHitlPersistFailedError', 'hitl_persist_failed', message, errors, offendingMessageId);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
/** HITL substrate unavailable — backing store offline / unconfigured. */
|
|
614
|
+
export class QodoHitlSubstrateUnavailableError extends QodoServerError {
|
|
615
|
+
name = 'QodoHitlSubstrateUnavailableError';
|
|
616
|
+
constructor(message, errors, offendingMessageId) {
|
|
617
|
+
super('QodoHitlSubstrateUnavailableError', 'hitl_substrate_unavailable', message, errors, offendingMessageId);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
/** Caller is not the authorized resolver for the HITL row. */
|
|
621
|
+
export class QodoUnauthorizedResolverError extends QodoServerError {
|
|
622
|
+
name = 'QodoUnauthorizedResolverError';
|
|
623
|
+
constructor(message, errors, offendingMessageId) {
|
|
624
|
+
super('QodoUnauthorizedResolverError', 'unauthorized_resolver', message, errors, offendingMessageId);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
/** HITL resolution payload failed validation against the prompt's schema. */
|
|
628
|
+
export class QodoInvalidResolutionError extends QodoServerError {
|
|
629
|
+
name = 'QodoInvalidResolutionError';
|
|
630
|
+
constructor(message, errors, offendingMessageId) {
|
|
631
|
+
super('QodoInvalidResolutionError', 'invalid_resolution', message, errors, offendingMessageId);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Pattern C (inline graph) validator rejection — GraphSpec rule failure
|
|
636
|
+
* surfaced AFTER the wire. Mirror of `QodoAgentSpecRejectedError` for the
|
|
637
|
+
* graph path; the `errors[]` array carries each `D11-R*` / `D13-R*`
|
|
638
|
+
* failure with `rule_id` + `path` + `message`.
|
|
639
|
+
*/
|
|
640
|
+
export class QodoGraphSpecRejectedError extends QodoServerError {
|
|
641
|
+
name = 'QodoGraphSpecRejectedError';
|
|
642
|
+
constructor(message, errors, offendingMessageId) {
|
|
643
|
+
super('QodoGraphSpecRejectedError', 'graph_spec_rejected', message, errors, offendingMessageId);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Typed error for QAR's `session_mismatch` wire rejection. Surfaces when
|
|
648
|
+
* an outbound ongoing envelope (`task.continue` / `task.cancel` /
|
|
649
|
+
* `task.resubscribe` / `tool.response`) carries a `session_id` that
|
|
650
|
+
* doesn't match the connection's bound session for the referenced task.
|
|
651
|
+
*
|
|
652
|
+
* The SDK no longer mints a zero-UUID sentinel for cold-address paths —
|
|
653
|
+
* the missing-session case is caught locally and raised as
|
|
654
|
+
* {@link QodoColdAddressError} before the wire write. This typed error
|
|
655
|
+
* fires only when the consumer-supplied `sessionId` override on the
|
|
656
|
+
* cold-address API doesn't actually match the server's bound session
|
|
657
|
+
* (stale durable-storage row, deliberate mismatch test).
|
|
658
|
+
*/
|
|
659
|
+
export class QodoSessionMismatchError extends QodoServerError {
|
|
660
|
+
name = 'QodoSessionMismatchError';
|
|
661
|
+
constructor(message, errors, offendingMessageId) {
|
|
662
|
+
super('QodoSessionMismatchError', 'session_mismatch', message, errors, offendingMessageId);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Admission has been pending past the operator timeout
|
|
667
|
+
* (`PENDING_ADMISSION_TIMEOUT`, server default 5 min). Terminal,
|
|
668
|
+
* non-retryable. Scoped to the derived `session_id` so the consumer can
|
|
669
|
+
* `task.resubscribe` if a recovery path exists, but the typical handling
|
|
670
|
+
* is to surface the failure to the operator — the server's sweeper will
|
|
671
|
+
* compensate the orphan row on its next sweep cycle.
|
|
672
|
+
*
|
|
673
|
+
* The wire envelope carries the derived `session_id` — exposed here as
|
|
674
|
+
* `sessionId` so consumers don't need to dig through the envelope to
|
|
675
|
+
* find it. `undefined` only on synthetic / spec-violating envelopes
|
|
676
|
+
* that omit the field.
|
|
677
|
+
*/
|
|
678
|
+
export class QodoAdmissionStalledError extends QodoServerError {
|
|
679
|
+
name = 'QodoAdmissionStalledError';
|
|
680
|
+
/**
|
|
681
|
+
* Derived `session_id` from the inbound `admission_stalled` envelope.
|
|
682
|
+
* Populated by {@link attachSessionId} (called by
|
|
683
|
+
* `errorFromServerErrorEnvelope` when it has the inherited envelope
|
|
684
|
+
* field in hand) — the constructor matches the unified server-error
|
|
685
|
+
* factory signature so the typed-error dispatcher (`classForServerErrorCode`)
|
|
686
|
+
* can build instances uniformly. `undefined` only on synthetic envelopes
|
|
687
|
+
* that omit the session_id field.
|
|
688
|
+
*/
|
|
689
|
+
sessionId;
|
|
690
|
+
constructor(message, errors, offendingMessageId) {
|
|
691
|
+
super('QodoAdmissionStalledError', 'admission_stalled', message, errors, offendingMessageId);
|
|
692
|
+
}
|
|
693
|
+
/** Internal — set by the envelope-to-error helper. Read-once-after-construct. */
|
|
694
|
+
attachSessionId(sessionId) {
|
|
695
|
+
if (this.sessionId === undefined)
|
|
696
|
+
this.sessionId = sessionId;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Client-side terminal when the consumer breaks the `TaskStartIterable`
|
|
701
|
+
* (via `iter.return()`, `break` inside a `for await`, or `iter.throw()`)
|
|
702
|
+
* BEFORE the server's `task.started` admission ack arrives.
|
|
703
|
+
*
|
|
704
|
+
* Surfaces on `await stream.sessionId` / `await stream.admittedTaskId` so
|
|
705
|
+
* the caller's pending awaits don't hang forever after they've abandoned
|
|
706
|
+
* the stream.
|
|
707
|
+
*
|
|
708
|
+
* Distinct from `QodoAdmissionTimeoutError` (SDK-side budget exhaustion)
|
|
709
|
+
* and `QodoAdmissionStalledError` (server-emitted terminal) so consumer
|
|
710
|
+
* code can branch on the reason — voluntary abort vs. genuine admission
|
|
711
|
+
* failure.
|
|
712
|
+
*/
|
|
713
|
+
export class QodoStreamAbortedError extends Error {
|
|
714
|
+
name = 'QodoStreamAbortedError';
|
|
715
|
+
constructor(message) {
|
|
716
|
+
super(message ??
|
|
717
|
+
'TaskStartIterable consumer broke the iterator before task.started arrived. ' +
|
|
718
|
+
'admittedTaskId / sessionId Promises were rejected to prevent indefinite hangs.');
|
|
719
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Client-side terminal after the SDK's `admission_in_progress` retry
|
|
724
|
+
* loop exhausts its budget without ever seeing a `task.started` ack.
|
|
725
|
+
*
|
|
726
|
+
* The SDK honours the server's `retry_after_ms` hint when present and
|
|
727
|
+
* falls back to exponential backoff with jitter (initial 100 ms, doubling,
|
|
728
|
+
* capped at `PENDING_ADMISSION_TIMEOUT = 5 min`). Reaching the cap means
|
|
729
|
+
* the deterministic-key admission contended for the full timeout window
|
|
730
|
+
* without resolving.
|
|
731
|
+
*
|
|
732
|
+
* `sessionId` carries the derived session UUID extracted from the final
|
|
733
|
+
* `admission_in_progress` envelope so a consumer that wants to
|
|
734
|
+
* `task.resubscribe` has the address; `undefined` only when no
|
|
735
|
+
* admission_in_progress envelope was ever observed (transport drop
|
|
736
|
+
* mid-retry).
|
|
737
|
+
*/
|
|
738
|
+
export class QodoAdmissionTimeoutError extends Error {
|
|
739
|
+
name = 'QodoAdmissionTimeoutError';
|
|
740
|
+
/** Total wall-clock milliseconds spent retrying before giving up. */
|
|
741
|
+
elapsedMs;
|
|
742
|
+
/** Number of `admission_in_progress` envelopes observed before timing out. */
|
|
743
|
+
attempts;
|
|
744
|
+
/** Derived `session_id` from the final envelope, if observed. */
|
|
745
|
+
sessionId;
|
|
746
|
+
constructor(elapsedMs, attempts, sessionId) {
|
|
747
|
+
super(`tasks.start admission stayed in 'admission_in_progress' for ${elapsedMs}ms ` +
|
|
748
|
+
`across ${attempts} retries — exceeded PENDING_ADMISSION_TIMEOUT. Surface to ` +
|
|
749
|
+
`operators or task.resubscribe against the derived session_id.`);
|
|
750
|
+
this.elapsedMs = elapsedMs;
|
|
751
|
+
this.attempts = attempts;
|
|
752
|
+
if (sessionId !== undefined)
|
|
753
|
+
this.sessionId = sessionId;
|
|
754
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Fallback for any unrecognized `error.code` value arriving from QAR.
|
|
759
|
+
*
|
|
760
|
+
* The SDK's typed-error catalog tracks the codes QAR's documented contract
|
|
761
|
+
* surfaces; a new code that hasn't landed in the SDK yet still surfaces
|
|
762
|
+
* as a typed throw (via this class) so consumers' `catch
|
|
763
|
+
* (err: QodoServerError)` blocks see structure rather than a yielded
|
|
764
|
+
* `kind: 'error'` event their type narrows can't account for. Branch on
|
|
765
|
+
* `err.code` (the raw wire string) until the SDK adds a typed subclass.
|
|
766
|
+
*/
|
|
767
|
+
export class QodoUnknownServerError extends QodoServerError {
|
|
768
|
+
name = 'QodoUnknownServerError';
|
|
769
|
+
constructor(code, message, errors, offendingMessageId) {
|
|
770
|
+
super('QodoUnknownServerError', code, message, errors, offendingMessageId);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Map a wire `error.code` to its typed `QodoServerError` subclass. Returns
|
|
775
|
+
* `undefined` for the SDK-side `agent_spec_rejected` code — that case is
|
|
776
|
+
* intentionally handled by `QodoAgentSpecRejectedError`'s own
|
|
777
|
+
* `errorFromAgentSpecRejection` parser (it carries an
|
|
778
|
+
* `InlineAgentSpecIssue[]` shape that predates the unified
|
|
779
|
+
* `ServerErrorEntry`). All other documented codes route through here.
|
|
780
|
+
*
|
|
781
|
+
* Callers needing to wrap an arbitrary error envelope: prefer the
|
|
782
|
+
* higher-level `errorFromServerErrorEnvelope` helper in `TaskClient.ts` —
|
|
783
|
+
* it handles the parse-`errors[]` step, the `agent_spec_rejected` carve-
|
|
784
|
+
* out, and the `QodoUnknownServerError` fallback uniformly.
|
|
785
|
+
*/
|
|
786
|
+
export function classForServerErrorCode(code) {
|
|
787
|
+
switch (code) {
|
|
788
|
+
case 'cancel_routing_failed':
|
|
789
|
+
return QodoCancelRoutingFailedError;
|
|
790
|
+
case 'cancel_failed':
|
|
791
|
+
return QodoCancelFailedError;
|
|
792
|
+
case 'task_not_found':
|
|
793
|
+
return QodoTaskNotFoundError;
|
|
794
|
+
case 'task_not_waiting':
|
|
795
|
+
return QodoTaskNotWaitingError;
|
|
796
|
+
case 'agent_reconstruction_failed':
|
|
797
|
+
return QodoAgentReconstructionFailedError;
|
|
798
|
+
case 'cross_pod_resume_aborted':
|
|
799
|
+
return QodoCrossPodResumeAbortedError;
|
|
800
|
+
case 'deps_construction_failed':
|
|
801
|
+
return QodoDepsConstructionFailedError;
|
|
802
|
+
case 'message_history_load_failed':
|
|
803
|
+
return QodoMessageHistoryLoadFailedError;
|
|
804
|
+
case 'hitl_persist_failed':
|
|
805
|
+
return QodoHitlPersistFailedError;
|
|
806
|
+
case 'hitl_substrate_unavailable':
|
|
807
|
+
return QodoHitlSubstrateUnavailableError;
|
|
808
|
+
case 'unauthorized_resolver':
|
|
809
|
+
return QodoUnauthorizedResolverError;
|
|
810
|
+
case 'invalid_resolution':
|
|
811
|
+
return QodoInvalidResolutionError;
|
|
812
|
+
case 'graph_spec_rejected':
|
|
813
|
+
return QodoGraphSpecRejectedError;
|
|
814
|
+
case 'admission_stalled':
|
|
815
|
+
// Terminal admission failure. The factory signature matches every
|
|
816
|
+
// other typed-error subclass; the SDK's wrap helpers can construct
|
|
817
|
+
// one even though `QodoAdmissionStalledError` additionally exposes
|
|
818
|
+
// `sessionId` — that field is populated separately by
|
|
819
|
+
// `errorFromServerErrorEnvelope` reading the envelope's inherited
|
|
820
|
+
// `session_id`.
|
|
821
|
+
return QodoAdmissionStalledError;
|
|
822
|
+
case 'session_mismatch':
|
|
823
|
+
// Server-side wire rejection when the outbound envelope's
|
|
824
|
+
// `session_id` doesn't match the connection's bound session for
|
|
825
|
+
// the referenced task. The SDK no longer mints a zero-UUID
|
|
826
|
+
// sentinel for cold-address calls — the typed `session_mismatch`
|
|
827
|
+
// now fires only when a consumer-supplied cold-address override
|
|
828
|
+
// is wrong (stale durable-storage row, deliberate mismatch test).
|
|
829
|
+
// The dispatch path prunes the polluted `taskSessions` entry on
|
|
830
|
+
// this code so the next no-override call correctly raises
|
|
831
|
+
// {@link QodoColdAddressError}.
|
|
832
|
+
return QodoSessionMismatchError;
|
|
833
|
+
default:
|
|
834
|
+
return undefined;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Thrown when the SDK's MCP client pool fails to connect to a registered
|
|
839
|
+
* remote / stdio MCP server.
|
|
840
|
+
*
|
|
841
|
+
* Carries the registered MCP `name` so callers can branch / log without
|
|
842
|
+
* parsing the message text. `cause` is the underlying transport / protocol
|
|
843
|
+
* error from `@modelcontextprotocol/sdk` (`McpError`, `StreamableHTTPError`,
|
|
844
|
+
* `SseError`, plain `Error` from `Client.connect`) — preserved on
|
|
845
|
+
* `Error.cause` per the standard idiom.
|
|
846
|
+
*
|
|
847
|
+
* Distinct from `QodoMcpToolError` so consumer code can branch on
|
|
848
|
+
* "connection failed" vs. "tool invocation failed" without inspecting
|
|
849
|
+
* the underlying cause.
|
|
850
|
+
*/
|
|
851
|
+
export class QodoMcpClientError extends Error {
|
|
852
|
+
name = 'QodoMcpClientError';
|
|
853
|
+
/** Registered MCP name (the `name` argument passed to `qar.registerMcp`). */
|
|
854
|
+
mcpName;
|
|
855
|
+
/** Transport discriminator from the failing config. */
|
|
856
|
+
transport;
|
|
857
|
+
constructor(mcpName, transport, message, cause) {
|
|
858
|
+
super(message, cause !== undefined ? { cause } : undefined);
|
|
859
|
+
this.mcpName = mcpName;
|
|
860
|
+
this.transport = transport;
|
|
861
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Thrown when a tool invocation against a registered remote / stdio MCP
|
|
866
|
+
* fails. Distinct from `QodoMcpClientError` (which is a connection
|
|
867
|
+
* failure) — this one fires AFTER the MCP `Client` is connected and is
|
|
868
|
+
* reporting an error from a `callTool` round-trip.
|
|
869
|
+
*
|
|
870
|
+
* Two failure shapes both route through this class:
|
|
871
|
+
* - **Transport error** — the wire layer (HTTP request, SSE stream, stdio
|
|
872
|
+
* pipe) failed during the call. `cause` is the underlying error.
|
|
873
|
+
* - **Tool-reported error** — the call succeeded at the transport level
|
|
874
|
+
* but the tool result has `isError: true`. The MCP envelope is preserved
|
|
875
|
+
* in `mcpResult` so consumers can inspect the per-tool content array.
|
|
876
|
+
*
|
|
877
|
+
* `mcpName` and `toolName` are populated so structured logging / metrics
|
|
878
|
+
* can branch on the exact dispatch coordinates without parsing the message.
|
|
879
|
+
*/
|
|
880
|
+
export class QodoMcpToolError extends Error {
|
|
881
|
+
name = 'QodoMcpToolError';
|
|
882
|
+
/** Registered MCP name (the `name` argument passed to `qar.registerMcp`). */
|
|
883
|
+
mcpName;
|
|
884
|
+
/** MCP tool name that failed (the `name` field of the `callTool` request). */
|
|
885
|
+
toolName;
|
|
886
|
+
/**
|
|
887
|
+
* MCP envelope when the tool returned `isError: true`. Absent for pure
|
|
888
|
+
* transport failures (those carry the underlying error on `cause`).
|
|
889
|
+
*/
|
|
890
|
+
mcpResult;
|
|
891
|
+
constructor(mcpName, toolName, message, opts) {
|
|
892
|
+
super(message, opts?.cause !== undefined ? { cause: opts.cause } : undefined);
|
|
893
|
+
this.mcpName = mcpName;
|
|
894
|
+
this.toolName = toolName;
|
|
895
|
+
if (opts?.mcpResult !== undefined)
|
|
896
|
+
this.mcpResult = opts.mcpResult;
|
|
897
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Typed escape path for a tool handler that wants to reject a `tool.request`.
|
|
902
|
+
*
|
|
903
|
+
* Throwing `new ToolDeniedError("not allowed")` from a handler registered via
|
|
904
|
+
* `client.tools.onRequest` maps to a `tool.response { outcome: "denied" }`
|
|
905
|
+
* envelope on the wire. The reason string is forwarded to QAR (truncated to
|
|
906
|
+
* keep error payloads bounded) so the model and observability traces see why
|
|
907
|
+
* the call was rejected.
|
|
908
|
+
*
|
|
909
|
+
* Plain `throw new Error(...)` from a handler still works — the SDK maps any
|
|
910
|
+
* other thrown value to `outcome: "error"`. Use `ToolDeniedError` only when
|
|
911
|
+
* the rejection is a deliberate policy decision (approval flow rejected the
|
|
912
|
+
* call, capability lookup denied the tool) rather than an unexpected failure.
|
|
913
|
+
*/
|
|
914
|
+
export class ToolDeniedError extends Error {
|
|
915
|
+
name = 'ToolDeniedError';
|
|
916
|
+
constructor(reason) {
|
|
917
|
+
super(reason);
|
|
918
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
//# sourceMappingURL=errors.js.map
|