@warlock.js/ai 4.1.1
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/README.md +72 -0
- package/cjs/index.cjs +8625 -0
- package/cjs/index.cjs.map +1 -0
- package/esm/agent/agent-config.type.d.mts +160 -0
- package/esm/agent/agent-config.type.d.mts.map +1 -0
- package/esm/agent/agent-input-builder.mjs +111 -0
- package/esm/agent/agent-input-builder.mjs.map +1 -0
- package/esm/agent/agent-log-event.mjs +101 -0
- package/esm/agent/agent-log-event.mjs.map +1 -0
- package/esm/agent/agent-stream.d.mts +47 -0
- package/esm/agent/agent-stream.d.mts.map +1 -0
- package/esm/agent/agent-stream.mjs +82 -0
- package/esm/agent/agent-stream.mjs.map +1 -0
- package/esm/agent/agent-to-stream-event.mjs +86 -0
- package/esm/agent/agent-to-stream-event.mjs.map +1 -0
- package/esm/agent/agent.d.mts +38 -0
- package/esm/agent/agent.d.mts.map +1 -0
- package/esm/agent/agent.mjs +974 -0
- package/esm/agent/agent.mjs.map +1 -0
- package/esm/agent/index.d.mts +3 -0
- package/esm/agent/index.mjs +4 -0
- package/esm/agent/json-stream-guard.mjs +400 -0
- package/esm/agent/json-stream-guard.mjs.map +1 -0
- package/esm/ai.d.mts +64 -0
- package/esm/ai.d.mts.map +1 -0
- package/esm/ai.mjs +65 -0
- package/esm/ai.mjs.map +1 -0
- package/esm/config.d.mts +79 -0
- package/esm/config.d.mts.map +1 -0
- package/esm/config.mjs +43 -0
- package/esm/config.mjs.map +1 -0
- package/esm/contracts/agent/agent-options.type.d.mts +132 -0
- package/esm/contracts/agent/agent-options.type.d.mts.map +1 -0
- package/esm/contracts/agent/agent.contract.d.mts +92 -0
- package/esm/contracts/agent/agent.contract.d.mts.map +1 -0
- package/esm/contracts/agent/index.d.mts +2 -0
- package/esm/contracts/attachment.type.d.mts +100 -0
- package/esm/contracts/attachment.type.d.mts.map +1 -0
- package/esm/contracts/content-part.type.d.mts +55 -0
- package/esm/contracts/content-part.type.d.mts.map +1 -0
- package/esm/contracts/conversation-message.type.d.mts +51 -0
- package/esm/contracts/conversation-message.type.d.mts.map +1 -0
- package/esm/contracts/embedder.contract.d.mts +69 -0
- package/esm/contracts/embedder.contract.d.mts.map +1 -0
- package/esm/contracts/end.type.d.mts +53 -0
- package/esm/contracts/end.type.d.mts.map +1 -0
- package/esm/contracts/end.type.mjs +47 -0
- package/esm/contracts/end.type.mjs.map +1 -0
- package/esm/contracts/events/agent-events.type.d.mts +71 -0
- package/esm/contracts/events/agent-events.type.d.mts.map +1 -0
- package/esm/contracts/events/complete-event.type.d.mts +33 -0
- package/esm/contracts/events/complete-event.type.d.mts.map +1 -0
- package/esm/contracts/events/event-identity.type.d.mts +30 -0
- package/esm/contracts/events/event-identity.type.d.mts.map +1 -0
- package/esm/contracts/events/event-map.type.d.mts +80 -0
- package/esm/contracts/events/event-map.type.d.mts.map +1 -0
- package/esm/contracts/events/index.d.mts +7 -0
- package/esm/contracts/events/supervisor-events.type.d.mts +162 -0
- package/esm/contracts/events/supervisor-events.type.d.mts.map +1 -0
- package/esm/contracts/events/usage-event.type.d.mts +39 -0
- package/esm/contracts/events/usage-event.type.d.mts.map +1 -0
- package/esm/contracts/events/workflow-events.type.d.mts +51 -0
- package/esm/contracts/events/workflow-events.type.d.mts.map +1 -0
- package/esm/contracts/executable.contract.d.mts +25 -0
- package/esm/contracts/executable.contract.d.mts.map +1 -0
- package/esm/contracts/finish-reason.type.d.mts +17 -0
- package/esm/contracts/finish-reason.type.d.mts.map +1 -0
- package/esm/contracts/index.d.mts +63 -0
- package/esm/contracts/middleware/index.d.mts +3 -0
- package/esm/contracts/middleware/middleware-context.type.d.mts +99 -0
- package/esm/contracts/middleware/middleware-context.type.d.mts.map +1 -0
- package/esm/contracts/middleware/middleware-state.type.d.mts +34 -0
- package/esm/contracts/middleware/middleware-state.type.d.mts.map +1 -0
- package/esm/contracts/middleware/middleware.contract.d.mts +140 -0
- package/esm/contracts/middleware/middleware.contract.d.mts.map +1 -0
- package/esm/contracts/model-tool-call-request.type.d.mts +58 -0
- package/esm/contracts/model-tool-call-request.type.d.mts.map +1 -0
- package/esm/contracts/model.contract.d.mts +164 -0
- package/esm/contracts/model.contract.d.mts.map +1 -0
- package/esm/contracts/placeholders.type.d.mts +23 -0
- package/esm/contracts/placeholders.type.d.mts.map +1 -0
- package/esm/contracts/result/agent-result.type.d.mts +33 -0
- package/esm/contracts/result/agent-result.type.d.mts.map +1 -0
- package/esm/contracts/result/attempt-entry.type.d.mts +40 -0
- package/esm/contracts/result/attempt-entry.type.d.mts.map +1 -0
- package/esm/contracts/result/base-report.type.d.mts +137 -0
- package/esm/contracts/result/base-report.type.d.mts.map +1 -0
- package/esm/contracts/result/base-report.type.mjs +17 -0
- package/esm/contracts/result/base-report.type.mjs.map +1 -0
- package/esm/contracts/result/base-result.type.d.mts +26 -0
- package/esm/contracts/result/base-result.type.d.mts.map +1 -0
- package/esm/contracts/result/execute-result.type.d.mts +40 -0
- package/esm/contracts/result/execute-result.type.d.mts.map +1 -0
- package/esm/contracts/result/execution-report.type.d.mts +50 -0
- package/esm/contracts/result/execution-report.type.d.mts.map +1 -0
- package/esm/contracts/result/index.d.mts +14 -0
- package/esm/contracts/result/llm-trip.type.d.mts +36 -0
- package/esm/contracts/result/llm-trip.type.d.mts.map +1 -0
- package/esm/contracts/result/model-pricing.type.d.mts +51 -0
- package/esm/contracts/result/model-pricing.type.d.mts.map +1 -0
- package/esm/contracts/result/session-send-result.type.d.mts +29 -0
- package/esm/contracts/result/session-send-result.type.d.mts.map +1 -0
- package/esm/contracts/result/step-result.type.d.mts +43 -0
- package/esm/contracts/result/step-result.type.d.mts.map +1 -0
- package/esm/contracts/result/supervisor-result.type.d.mts +86 -0
- package/esm/contracts/result/supervisor-result.type.d.mts.map +1 -0
- package/esm/contracts/result/tool-call.type.d.mts +44 -0
- package/esm/contracts/result/tool-call.type.d.mts.map +1 -0
- package/esm/contracts/result/usage.type.d.mts +57 -0
- package/esm/contracts/result/usage.type.d.mts.map +1 -0
- package/esm/contracts/result/workflow-result.type.d.mts +45 -0
- package/esm/contracts/result/workflow-result.type.d.mts.map +1 -0
- package/esm/contracts/sdk-adapter.contract.d.mts +77 -0
- package/esm/contracts/sdk-adapter.contract.d.mts.map +1 -0
- package/esm/contracts/stream/stream-event.type.d.mts +68 -0
- package/esm/contracts/stream/stream-event.type.d.mts.map +1 -0
- package/esm/contracts/stream/stream.contract.d.mts +61 -0
- package/esm/contracts/stream/stream.contract.d.mts.map +1 -0
- package/esm/contracts/streaming-tool-guard-config.type.d.mts +78 -0
- package/esm/contracts/streaming-tool-guard-config.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/ack-entry.type.d.mts +97 -0
- package/esm/contracts/supervisor/ack-entry.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/classifier-context.type.d.mts +189 -0
- package/esm/contracts/supervisor/classifier-context.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/dispatch-context.type.d.mts +235 -0
- package/esm/contracts/supervisor/dispatch-context.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/evaluate-context.type.d.mts +124 -0
- package/esm/contracts/supervisor/evaluate-context.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/index.d.mts +16 -0
- package/esm/contracts/supervisor/intent-entry.type.d.mts +254 -0
- package/esm/contracts/supervisor/intent-entry.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/iteration-snapshot.type.d.mts +117 -0
- package/esm/contracts/supervisor/iteration-snapshot.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/next.type.d.mts +25 -0
- package/esm/contracts/supervisor/next.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/route-context.type.d.mts +91 -0
- package/esm/contracts/supervisor/route-context.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/router-entry.type.d.mts +67 -0
- package/esm/contracts/supervisor/router-entry.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/supervisor-config.type.d.mts +356 -0
- package/esm/contracts/supervisor/supervisor-config.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/supervisor-execute-options.type.d.mts +90 -0
- package/esm/contracts/supervisor/supervisor-execute-options.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/supervisor-input.type.d.mts +24 -0
- package/esm/contracts/supervisor/supervisor-input.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/supervisor-snapshot.type.d.mts +49 -0
- package/esm/contracts/supervisor/supervisor-snapshot.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/supervisor-stream-event.type.d.mts +16 -0
- package/esm/contracts/supervisor/supervisor-stream-event.type.d.mts.map +1 -0
- package/esm/contracts/supervisor/supervisor.contract.d.mts +126 -0
- package/esm/contracts/supervisor/supervisor.contract.d.mts.map +1 -0
- package/esm/contracts/system-prompt.contract.d.mts +118 -0
- package/esm/contracts/system-prompt.contract.d.mts.map +1 -0
- package/esm/contracts/tool.contract.d.mts +161 -0
- package/esm/contracts/tool.contract.d.mts.map +1 -0
- package/esm/contracts/workflow/index.d.mts +6 -0
- package/esm/contracts/workflow/next-step-result.type.d.mts +17 -0
- package/esm/contracts/workflow/next-step-result.type.d.mts.map +1 -0
- package/esm/contracts/workflow/retry-config.type.d.mts +19 -0
- package/esm/contracts/workflow/retry-config.type.d.mts.map +1 -0
- package/esm/contracts/workflow/step.contract.d.mts +189 -0
- package/esm/contracts/workflow/step.contract.d.mts.map +1 -0
- package/esm/contracts/workflow/workflow-context.type.d.mts +45 -0
- package/esm/contracts/workflow/workflow-context.type.d.mts.map +1 -0
- package/esm/contracts/workflow/workflow-snapshot.type.d.mts +24 -0
- package/esm/contracts/workflow/workflow-snapshot.type.d.mts.map +1 -0
- package/esm/contracts/workflow/workflow.contract.d.mts +142 -0
- package/esm/contracts/workflow/workflow.contract.d.mts.map +1 -0
- package/esm/errors/agent-cancelled-error.d.mts +49 -0
- package/esm/errors/agent-cancelled-error.d.mts.map +1 -0
- package/esm/errors/agent-cancelled-error.mjs +43 -0
- package/esm/errors/agent-cancelled-error.mjs.map +1 -0
- package/esm/errors/agent-execution-error.d.mts +32 -0
- package/esm/errors/agent-execution-error.d.mts.map +1 -0
- package/esm/errors/agent-execution-error.mjs +35 -0
- package/esm/errors/agent-execution-error.mjs.map +1 -0
- package/esm/errors/agent-max-trips-error.d.mts +45 -0
- package/esm/errors/agent-max-trips-error.d.mts.map +1 -0
- package/esm/errors/agent-max-trips-error.mjs +41 -0
- package/esm/errors/agent-max-trips-error.mjs.map +1 -0
- package/esm/errors/ai-error.d.mts +94 -0
- package/esm/errors/ai-error.d.mts.map +1 -0
- package/esm/errors/ai-error.mjs +68 -0
- package/esm/errors/ai-error.mjs.map +1 -0
- package/esm/errors/budget-exceeded-error.d.mts +41 -0
- package/esm/errors/budget-exceeded-error.d.mts.map +1 -0
- package/esm/errors/budget-exceeded-error.mjs +31 -0
- package/esm/errors/budget-exceeded-error.mjs.map +1 -0
- package/esm/errors/content-filter-error.d.mts +33 -0
- package/esm/errors/content-filter-error.d.mts.map +1 -0
- package/esm/errors/content-filter-error.mjs +28 -0
- package/esm/errors/content-filter-error.mjs.map +1 -0
- package/esm/errors/context-length-exceeded-error.d.mts +38 -0
- package/esm/errors/context-length-exceeded-error.d.mts.map +1 -0
- package/esm/errors/context-length-exceeded-error.mjs +31 -0
- package/esm/errors/context-length-exceeded-error.mjs.map +1 -0
- package/esm/errors/error-category.type.d.mts +30 -0
- package/esm/errors/error-category.type.d.mts.map +1 -0
- package/esm/errors/error-code.type.d.mts +19 -0
- package/esm/errors/error-code.type.d.mts.map +1 -0
- package/esm/errors/guardrail-violation-error.d.mts +55 -0
- package/esm/errors/guardrail-violation-error.d.mts.map +1 -0
- package/esm/errors/guardrail-violation-error.mjs +41 -0
- package/esm/errors/guardrail-violation-error.mjs.map +1 -0
- package/esm/errors/index.d.mts +29 -0
- package/esm/errors/index.mjs +29 -0
- package/esm/errors/invalid-request-error.d.mts +27 -0
- package/esm/errors/invalid-request-error.d.mts.map +1 -0
- package/esm/errors/invalid-request-error.mjs +31 -0
- package/esm/errors/invalid-request-error.mjs.map +1 -0
- package/esm/errors/max-iterations-error.d.mts +31 -0
- package/esm/errors/max-iterations-error.d.mts.map +1 -0
- package/esm/errors/max-iterations-error.mjs +32 -0
- package/esm/errors/max-iterations-error.mjs.map +1 -0
- package/esm/errors/max-steps-exceeded-error.d.mts +20 -0
- package/esm/errors/max-steps-exceeded-error.d.mts.map +1 -0
- package/esm/errors/max-steps-exceeded-error.mjs +21 -0
- package/esm/errors/max-steps-exceeded-error.mjs.map +1 -0
- package/esm/errors/provider-auth-error.d.mts +22 -0
- package/esm/errors/provider-auth-error.d.mts.map +1 -0
- package/esm/errors/provider-auth-error.mjs +26 -0
- package/esm/errors/provider-auth-error.mjs.map +1 -0
- package/esm/errors/provider-error.d.mts +38 -0
- package/esm/errors/provider-error.d.mts.map +1 -0
- package/esm/errors/provider-error.mjs +42 -0
- package/esm/errors/provider-error.mjs.map +1 -0
- package/esm/errors/provider-rate-limit-error.d.mts +34 -0
- package/esm/errors/provider-rate-limit-error.d.mts.map +1 -0
- package/esm/errors/provider-rate-limit-error.mjs +31 -0
- package/esm/errors/provider-rate-limit-error.mjs.map +1 -0
- package/esm/errors/provider-timeout-error.d.mts +22 -0
- package/esm/errors/provider-timeout-error.d.mts.map +1 -0
- package/esm/errors/provider-timeout-error.mjs +26 -0
- package/esm/errors/provider-timeout-error.mjs.map +1 -0
- package/esm/errors/quota-exceeded-error.d.mts +36 -0
- package/esm/errors/quota-exceeded-error.d.mts.map +1 -0
- package/esm/errors/quota-exceeded-error.mjs +40 -0
- package/esm/errors/quota-exceeded-error.mjs.map +1 -0
- package/esm/errors/routing-error.d.mts +23 -0
- package/esm/errors/routing-error.d.mts.map +1 -0
- package/esm/errors/routing-error.mjs +23 -0
- package/esm/errors/routing-error.mjs.map +1 -0
- package/esm/errors/schema-validation-error.d.mts +40 -0
- package/esm/errors/schema-validation-error.d.mts.map +1 -0
- package/esm/errors/schema-validation-error.mjs +37 -0
- package/esm/errors/schema-validation-error.mjs.map +1 -0
- package/esm/errors/step-failed-error.d.mts +20 -0
- package/esm/errors/step-failed-error.d.mts.map +1 -0
- package/esm/errors/step-failed-error.mjs +19 -0
- package/esm/errors/step-failed-error.mjs.map +1 -0
- package/esm/errors/supervisor-cancelled-error.d.mts +29 -0
- package/esm/errors/supervisor-cancelled-error.d.mts.map +1 -0
- package/esm/errors/supervisor-cancelled-error.mjs +29 -0
- package/esm/errors/supervisor-cancelled-error.mjs.map +1 -0
- package/esm/errors/supervisor-drift-error.d.mts +31 -0
- package/esm/errors/supervisor-drift-error.d.mts.map +1 -0
- package/esm/errors/supervisor-drift-error.mjs +30 -0
- package/esm/errors/supervisor-drift-error.mjs.map +1 -0
- package/esm/errors/supervisor-failed-error.d.mts +40 -0
- package/esm/errors/supervisor-failed-error.d.mts.map +1 -0
- package/esm/errors/supervisor-failed-error.mjs +43 -0
- package/esm/errors/supervisor-failed-error.mjs.map +1 -0
- package/esm/errors/supervisor-routing-error.d.mts +44 -0
- package/esm/errors/supervisor-routing-error.d.mts.map +1 -0
- package/esm/errors/supervisor-routing-error.mjs +39 -0
- package/esm/errors/supervisor-routing-error.mjs.map +1 -0
- package/esm/errors/tool-execution-error.d.mts +35 -0
- package/esm/errors/tool-execution-error.d.mts.map +1 -0
- package/esm/errors/tool-execution-error.mjs +32 -0
- package/esm/errors/tool-execution-error.mjs.map +1 -0
- package/esm/errors/workflow-cancelled-error.d.mts +23 -0
- package/esm/errors/workflow-cancelled-error.d.mts.map +1 -0
- package/esm/errors/workflow-cancelled-error.mjs +23 -0
- package/esm/errors/workflow-cancelled-error.mjs.map +1 -0
- package/esm/errors/workflow-drift-error.d.mts +25 -0
- package/esm/errors/workflow-drift-error.d.mts.map +1 -0
- package/esm/errors/workflow-drift-error.mjs +24 -0
- package/esm/errors/workflow-drift-error.mjs.map +1 -0
- package/esm/errors/workflow-error.d.mts +15 -0
- package/esm/errors/workflow-error.d.mts.map +1 -0
- package/esm/errors/workflow-error.mjs +18 -0
- package/esm/errors/workflow-error.mjs.map +1 -0
- package/esm/index.d.mts +137 -0
- package/esm/index.mjs +81 -0
- package/esm/middleware/builtins/budget.d.mts +103 -0
- package/esm/middleware/builtins/budget.d.mts.map +1 -0
- package/esm/middleware/builtins/budget.mjs +100 -0
- package/esm/middleware/builtins/budget.mjs.map +1 -0
- package/esm/middleware/builtins/guardrail.d.mts +92 -0
- package/esm/middleware/builtins/guardrail.d.mts.map +1 -0
- package/esm/middleware/builtins/guardrail.mjs +76 -0
- package/esm/middleware/builtins/guardrail.mjs.map +1 -0
- package/esm/middleware/builtins/semantic-cache.d.mts +106 -0
- package/esm/middleware/builtins/semantic-cache.d.mts.map +1 -0
- package/esm/middleware/builtins/semantic-cache.mjs +149 -0
- package/esm/middleware/builtins/semantic-cache.mjs.map +1 -0
- package/esm/middleware/helpers/compose.d.mts +42 -0
- package/esm/middleware/helpers/compose.d.mts.map +1 -0
- package/esm/middleware/helpers/compose.mjs +52 -0
- package/esm/middleware/helpers/compose.mjs.map +1 -0
- package/esm/middleware/helpers/for-tool.d.mts +55 -0
- package/esm/middleware/helpers/for-tool.d.mts.map +1 -0
- package/esm/middleware/helpers/for-tool.mjs +80 -0
- package/esm/middleware/helpers/for-tool.mjs.map +1 -0
- package/esm/middleware/helpers/index.d.mts +2 -0
- package/esm/middleware/index.d.mts +8 -0
- package/esm/middleware/index.mjs +10 -0
- package/esm/middleware/pipeline.d.mts +70 -0
- package/esm/middleware/pipeline.d.mts.map +1 -0
- package/esm/middleware/pipeline.mjs +100 -0
- package/esm/middleware/pipeline.mjs.map +1 -0
- package/esm/middleware/utils/extract-user-text.d.mts +33 -0
- package/esm/middleware/utils/extract-user-text.d.mts.map +1 -0
- package/esm/middleware/utils/extract-user-text.mjs +40 -0
- package/esm/middleware/utils/extract-user-text.mjs.map +1 -0
- package/esm/middleware/utils/index.d.mts +2 -0
- package/esm/middleware/utils/namespaced-state.d.mts +60 -0
- package/esm/middleware/utils/namespaced-state.d.mts.map +1 -0
- package/esm/middleware/utils/namespaced-state.mjs +60 -0
- package/esm/middleware/utils/namespaced-state.mjs.map +1 -0
- package/esm/mock/index.d.mts +4 -0
- package/esm/mock/index.mjs +5 -0
- package/esm/mock/mock-agent.d.mts +41 -0
- package/esm/mock/mock-agent.d.mts.map +1 -0
- package/esm/mock/mock-agent.mjs +39 -0
- package/esm/mock/mock-agent.mjs.map +1 -0
- package/esm/mock/mock-config.type.d.mts +31 -0
- package/esm/mock/mock-config.type.d.mts.map +1 -0
- package/esm/mock/mock-model.d.mts +94 -0
- package/esm/mock/mock-model.d.mts.map +1 -0
- package/esm/mock/mock-model.mjs +150 -0
- package/esm/mock/mock-model.mjs.map +1 -0
- package/esm/mock/mock-sdk.d.mts +25 -0
- package/esm/mock/mock-sdk.d.mts.map +1 -0
- package/esm/mock/mock-sdk.mjs +37 -0
- package/esm/mock/mock-sdk.mjs.map +1 -0
- package/esm/supervisor/as-tool.d.mts +45 -0
- package/esm/supervisor/as-tool.d.mts.map +1 -0
- package/esm/supervisor/as-tool.mjs +80 -0
- package/esm/supervisor/as-tool.mjs.map +1 -0
- package/esm/supervisor/cancellation.d.mts +12 -0
- package/esm/supervisor/cancellation.d.mts.map +1 -0
- package/esm/supervisor/cancellation.mjs +22 -0
- package/esm/supervisor/cancellation.mjs.map +1 -0
- package/esm/supervisor/decide.mjs +272 -0
- package/esm/supervisor/decide.mjs.map +1 -0
- package/esm/supervisor/emitter.d.mts +27 -0
- package/esm/supervisor/emitter.d.mts.map +1 -0
- package/esm/supervisor/emitter.mjs +47 -0
- package/esm/supervisor/emitter.mjs.map +1 -0
- package/esm/supervisor/entries.d.mts +141 -0
- package/esm/supervisor/entries.d.mts.map +1 -0
- package/esm/supervisor/entries.mjs +206 -0
- package/esm/supervisor/entries.mjs.map +1 -0
- package/esm/supervisor/execution.d.mts +637 -0
- package/esm/supervisor/execution.d.mts.map +1 -0
- package/esm/supervisor/execution.mjs +1868 -0
- package/esm/supervisor/execution.mjs.map +1 -0
- package/esm/supervisor/index.d.mts +11 -0
- package/esm/supervisor/index.mjs +12 -0
- package/esm/supervisor/router-prompt.d.mts +56 -0
- package/esm/supervisor/router-prompt.d.mts.map +1 -0
- package/esm/supervisor/router-prompt.mjs +52 -0
- package/esm/supervisor/router-prompt.mjs.map +1 -0
- package/esm/supervisor/signature.d.mts +28 -0
- package/esm/supervisor/signature.d.mts.map +1 -0
- package/esm/supervisor/signature.mjs +89 -0
- package/esm/supervisor/signature.mjs.map +1 -0
- package/esm/supervisor/snapshot.d.mts +54 -0
- package/esm/supervisor/snapshot.d.mts.map +1 -0
- package/esm/supervisor/snapshot.mjs +77 -0
- package/esm/supervisor/snapshot.mjs.map +1 -0
- package/esm/supervisor/supervisor-stream.d.mts +29 -0
- package/esm/supervisor/supervisor-stream.d.mts.map +1 -0
- package/esm/supervisor/supervisor-stream.mjs +89 -0
- package/esm/supervisor/supervisor-stream.mjs.map +1 -0
- package/esm/supervisor/supervisor.d.mts +27 -0
- package/esm/supervisor/supervisor.d.mts.map +1 -0
- package/esm/supervisor/supervisor.mjs +138 -0
- package/esm/supervisor/supervisor.mjs.map +1 -0
- package/esm/system-prompt/instruction.d.mts +52 -0
- package/esm/system-prompt/instruction.d.mts.map +1 -0
- package/esm/system-prompt/instruction.mjs +57 -0
- package/esm/system-prompt/instruction.mjs.map +1 -0
- package/esm/system-prompt/persona.d.mts +52 -0
- package/esm/system-prompt/persona.d.mts.map +1 -0
- package/esm/system-prompt/persona.mjs +57 -0
- package/esm/system-prompt/persona.mjs.map +1 -0
- package/esm/system-prompt/render-placeholders.d.mts +31 -0
- package/esm/system-prompt/render-placeholders.d.mts.map +1 -0
- package/esm/system-prompt/render-placeholders.mjs +58 -0
- package/esm/system-prompt/render-placeholders.mjs.map +1 -0
- package/esm/system-prompt/system-prompt.d.mts +117 -0
- package/esm/system-prompt/system-prompt.d.mts.map +1 -0
- package/esm/system-prompt/system-prompt.mjs +137 -0
- package/esm/system-prompt/system-prompt.mjs.map +1 -0
- package/esm/tool/index.d.mts +1 -0
- package/esm/tool/index.mjs +3 -0
- package/esm/tool/tool.d.mts +64 -0
- package/esm/tool/tool.d.mts.map +1 -0
- package/esm/tool/tool.mjs +184 -0
- package/esm/tool/tool.mjs.map +1 -0
- package/esm/utils/compute-cost.d.mts +58 -0
- package/esm/utils/compute-cost.d.mts.map +1 -0
- package/esm/utils/compute-cost.mjs +87 -0
- package/esm/utils/compute-cost.mjs.map +1 -0
- package/esm/utils/extract-json-payload.d.mts +33 -0
- package/esm/utils/extract-json-payload.d.mts.map +1 -0
- package/esm/utils/extract-json-payload.mjs +39 -0
- package/esm/utils/extract-json-payload.mjs.map +1 -0
- package/esm/utils/generate-run-id.d.mts +20 -0
- package/esm/utils/generate-run-id.d.mts.map +1 -0
- package/esm/utils/generate-run-id.mjs +23 -0
- package/esm/utils/generate-run-id.mjs.map +1 -0
- package/esm/utils/index.d.mts +9 -0
- package/esm/utils/index.mjs +11 -0
- package/esm/utils/json-schema.d.mts +57 -0
- package/esm/utils/json-schema.d.mts.map +1 -0
- package/esm/utils/json-schema.mjs +89 -0
- package/esm/utils/json-schema.mjs.map +1 -0
- package/esm/utils/prepare-attachment-part.d.mts +36 -0
- package/esm/utils/prepare-attachment-part.d.mts.map +1 -0
- package/esm/utils/prepare-attachment-part.mjs +140 -0
- package/esm/utils/prepare-attachment-part.mjs.map +1 -0
- package/esm/utils/resolve-attachment.d.mts +33 -0
- package/esm/utils/resolve-attachment.d.mts.map +1 -0
- package/esm/utils/resolve-attachment.mjs +73 -0
- package/esm/utils/resolve-attachment.mjs.map +1 -0
- package/esm/utils/safe-json-parse.d.mts +14 -0
- package/esm/utils/safe-json-parse.d.mts.map +1 -0
- package/esm/utils/safe-json-parse.mjs +22 -0
- package/esm/utils/safe-json-parse.mjs.map +1 -0
- package/esm/utils/stamp-report-lineage.d.mts +61 -0
- package/esm/utils/stamp-report-lineage.d.mts.map +1 -0
- package/esm/utils/stamp-report-lineage.mjs +47 -0
- package/esm/utils/stamp-report-lineage.mjs.map +1 -0
- package/esm/utils/token-count.d.mts +15 -0
- package/esm/utils/token-count.d.mts.map +1 -0
- package/esm/utils/token-count.mjs +18 -0
- package/esm/utils/token-count.mjs.map +1 -0
- package/esm/workflow/as-tool.mjs +55 -0
- package/esm/workflow/as-tool.mjs.map +1 -0
- package/esm/workflow/cancellation.mjs +44 -0
- package/esm/workflow/cancellation.mjs.map +1 -0
- package/esm/workflow/emitter.mjs +40 -0
- package/esm/workflow/emitter.mjs.map +1 -0
- package/esm/workflow/engine.mjs +362 -0
- package/esm/workflow/engine.mjs.map +1 -0
- package/esm/workflow/index.d.mts +3 -0
- package/esm/workflow/index.mjs +5 -0
- package/esm/workflow/retry.mjs +32 -0
- package/esm/workflow/retry.mjs.map +1 -0
- package/esm/workflow/router.mjs +56 -0
- package/esm/workflow/router.mjs.map +1 -0
- package/esm/workflow/run-scoped-emitter.mjs +32 -0
- package/esm/workflow/run-scoped-emitter.mjs.map +1 -0
- package/esm/workflow/signature.d.mts +7 -0
- package/esm/workflow/signature.d.mts.map +1 -0
- package/esm/workflow/signature.mjs +34 -0
- package/esm/workflow/signature.mjs.map +1 -0
- package/esm/workflow/snapshot.mjs +71 -0
- package/esm/workflow/snapshot.mjs.map +1 -0
- package/esm/workflow/state.mjs +37 -0
- package/esm/workflow/state.mjs.map +1 -0
- package/esm/workflow/step-runner.mjs +371 -0
- package/esm/workflow/step-runner.mjs.map +1 -0
- package/esm/workflow/step.d.mts +19 -0
- package/esm/workflow/step.d.mts.map +1 -0
- package/esm/workflow/step.mjs +37 -0
- package/esm/workflow/step.mjs.map +1 -0
- package/esm/workflow/workflow.d.mts +12 -0
- package/esm/workflow/workflow.d.mts.map +1 -0
- package/esm/workflow/workflow.mjs +116 -0
- package/esm/workflow/workflow.mjs.map +1 -0
- package/llms-full.txt +2293 -0
- package/llms.txt +20 -0
- package/package.json +37 -0
- package/skills/README.md +53 -0
- package/skills/ai-basics/SKILL.md +95 -0
- package/skills/attach-ai-middleware/SKILL.md +184 -0
- package/skills/define-ai-tool/SKILL.md +186 -0
- package/skills/embed-text/SKILL.md +105 -0
- package/skills/handle-ai-errors/SKILL.md +194 -0
- package/skills/log-ai-calls/SKILL.md +141 -0
- package/skills/persist-ai-data/SKILL.md +207 -0
- package/skills/pick-ai-provider/SKILL.md +164 -0
- package/skills/run-ai-agent/SKILL.md +267 -0
- package/skills/run-ai-workflow/SKILL.md +258 -0
- package/skills/run-supervisor/SKILL.md +309 -0
- package/skills/write-system-prompt/SKILL.md +129 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-exceeded-error.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/quota-exceeded-error.ts"],"mappings":";;;;;;;AA4BA;;;;;;;;;;;;;;;;AAG8D;;;;;;cAHjD,kBAAA,SAA2B,aAAA;EAAA,gBACf,eAAA,EAAiB,aAAA;cAErB,OAAA,UAAiB,OAAA,GAAU,cAAA;AAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ProviderError } from "./provider-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/errors/quota-exceeded-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* Provider refused the call because the account has exhausted its
|
|
6
|
+
* paid quota (monthly credit, billing cap, subscription tier limit).
|
|
7
|
+
*
|
|
8
|
+
* **Not retryable.** Unlike `ProviderRateLimitError` — where the
|
|
9
|
+
* bucket refills after `retryAfter` milliseconds — this one needs
|
|
10
|
+
* human intervention: top up the account, upgrade the plan, or
|
|
11
|
+
* switch to a different key. Consumers who blindly back-off-and-retry
|
|
12
|
+
* on rate-limit errors would loop forever here, which is why the two
|
|
13
|
+
* are split.
|
|
14
|
+
*
|
|
15
|
+
* Typically surfaced as OpenAI `code: "insufficient_quota"`.
|
|
16
|
+
*
|
|
17
|
+
* **Distinct from `BudgetExceededError`.** `QuotaExceededError` is
|
|
18
|
+
* the *provider* telling us their billing cap is hit.
|
|
19
|
+
* `BudgetExceededError` is our *own* middleware enforcing a
|
|
20
|
+
* user-configured ceiling client-side.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* if (result.error instanceof QuotaExceededError) {
|
|
24
|
+
* await pagerDuty.trigger("openai quota exhausted");
|
|
25
|
+
* return fallbackResponse();
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
var QuotaExceededError = class extends ProviderError {
|
|
29
|
+
static {
|
|
30
|
+
this.defaultCategory = "quota";
|
|
31
|
+
}
|
|
32
|
+
constructor(message, options) {
|
|
33
|
+
super(message, options, "PROVIDER_QUOTA_EXCEEDED");
|
|
34
|
+
this.name = "QuotaExceededError";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { QuotaExceededError };
|
|
40
|
+
//# sourceMappingURL=quota-exceeded-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-exceeded-error.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/quota-exceeded-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { ProviderError } from \"./provider-error\";\n\n/**\n * Provider refused the call because the account has exhausted its\n * paid quota (monthly credit, billing cap, subscription tier limit).\n *\n * **Not retryable.** Unlike `ProviderRateLimitError` — where the\n * bucket refills after `retryAfter` milliseconds — this one needs\n * human intervention: top up the account, upgrade the plan, or\n * switch to a different key. Consumers who blindly back-off-and-retry\n * on rate-limit errors would loop forever here, which is why the two\n * are split.\n *\n * Typically surfaced as OpenAI `code: \"insufficient_quota\"`.\n *\n * **Distinct from `BudgetExceededError`.** `QuotaExceededError` is\n * the *provider* telling us their billing cap is hit.\n * `BudgetExceededError` is our *own* middleware enforcing a\n * user-configured ceiling client-side.\n *\n * @example\n * if (result.error instanceof QuotaExceededError) {\n * await pagerDuty.trigger(\"openai quota exhausted\");\n * return fallbackResponse();\n * }\n */\nexport class QuotaExceededError extends ProviderError {\n public static readonly defaultCategory: ErrorCategory = \"quota\";\n\n public constructor(message: string, options?: AIErrorOptions) {\n super(message, options, \"PROVIDER_QUOTA_EXCEEDED\");\n this.name = \"QuotaExceededError\";\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,qBAAb,cAAwC,cAAc;;yBACI;;CAExD,AAAO,YAAY,SAAiB,SAA0B;EAC5D,MAAM,SAAS,SAAS,yBAAyB;EACjD,KAAK,OAAO;CACd;AACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ErrorCategory } from "./error-category.type.mjs";
|
|
2
|
+
import { AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
import { WorkflowError } from "./workflow-error.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../../@warlock.js/ai/src/errors/routing-error.d.ts
|
|
6
|
+
type RoutingErrorOptions = AIErrorOptions & {
|
|
7
|
+
stepName: string;
|
|
8
|
+
targetName?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* `nextStep` returned an invalid `goto`, or the `nextStep` callback
|
|
12
|
+
* itself threw. Routing is authoritative and has no recovery path —
|
|
13
|
+
* the workflow terminates immediately.
|
|
14
|
+
*/
|
|
15
|
+
declare class RoutingError extends WorkflowError {
|
|
16
|
+
static readonly defaultCategory: ErrorCategory;
|
|
17
|
+
readonly stepName: string;
|
|
18
|
+
readonly targetName?: string;
|
|
19
|
+
constructor(message: string, options: RoutingErrorOptions);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { RoutingError, RoutingErrorOptions };
|
|
23
|
+
//# sourceMappingURL=routing-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-error.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/routing-error.ts"],"mappings":";;;;;KAIY,mBAAA,GAAsB,cAAc;EAC9C,QAAA;EACA,UAAA;AAAA;;;;;;cAQW,YAAA,SAAqB,aAAA;EAAA,gBACT,eAAA,EAAiB,aAAA;EAAA,SAExB,QAAA;EAAA,SACA,UAAA;cAEG,OAAA,UAAiB,OAAA,EAAS,mBAAA;AAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WorkflowError } from "./workflow-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/errors/routing-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* `nextStep` returned an invalid `goto`, or the `nextStep` callback
|
|
6
|
+
* itself threw. Routing is authoritative and has no recovery path —
|
|
7
|
+
* the workflow terminates immediately.
|
|
8
|
+
*/
|
|
9
|
+
var RoutingError = class extends WorkflowError {
|
|
10
|
+
static {
|
|
11
|
+
this.defaultCategory = "routing";
|
|
12
|
+
}
|
|
13
|
+
constructor(message, options) {
|
|
14
|
+
super(message, options, "WORKFLOW_INVALID_GOTO");
|
|
15
|
+
this.name = "RoutingError";
|
|
16
|
+
this.stepName = options.stepName;
|
|
17
|
+
this.targetName = options.targetName;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { RoutingError };
|
|
23
|
+
//# sourceMappingURL=routing-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-error.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/routing-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { WorkflowError } from \"./workflow-error\";\n\nexport type RoutingErrorOptions = AIErrorOptions & {\n stepName: string;\n targetName?: string;\n};\n\n/**\n * `nextStep` returned an invalid `goto`, or the `nextStep` callback\n * itself threw. Routing is authoritative and has no recovery path —\n * the workflow terminates immediately.\n */\nexport class RoutingError extends WorkflowError {\n public static readonly defaultCategory: ErrorCategory = \"routing\";\n\n public readonly stepName: string;\n public readonly targetName?: string;\n\n public constructor(message: string, options: RoutingErrorOptions) {\n super(message, options, \"WORKFLOW_INVALID_GOTO\");\n this.name = \"RoutingError\";\n this.stepName = options.stepName;\n this.targetName = options.targetName;\n }\n}\n"],"mappings":";;;;;;;;AAcA,IAAa,eAAb,cAAkC,cAAc;;yBACU;;CAKxD,AAAO,YAAY,SAAiB,SAA8B;EAChE,MAAM,SAAS,SAAS,uBAAuB;EAC/C,KAAK,OAAO;EACZ,KAAK,WAAW,QAAQ;EACxB,KAAK,aAAa,QAAQ;CAC5B;AACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ErrorCategory } from "./error-category.type.mjs";
|
|
2
|
+
import { AIError, AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
|
+
|
|
5
|
+
//#region ../../@warlock.js/ai/src/errors/schema-validation-error.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Payload passed to `SchemaValidationError`. Subset of
|
|
8
|
+
* `AIErrorOptions` plus the machine-readable validation issues list.
|
|
9
|
+
*/
|
|
10
|
+
type SchemaValidationErrorOptions = AIErrorOptions & {
|
|
11
|
+
issues?: readonly StandardSchemaV1.Issue[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A `StandardSchemaV1` validation call returned issues, or the input
|
|
15
|
+
* was not valid JSON before validation could even run.
|
|
16
|
+
*
|
|
17
|
+
* Produced in two places today:
|
|
18
|
+
* - Agent output parsing — the final trip text failed `JSON.parse` or
|
|
19
|
+
* the parsed value failed `~standard.validate`.
|
|
20
|
+
* - Tool input validation — the model's raw arguments for a tool call
|
|
21
|
+
* didn't match the tool's `input` schema.
|
|
22
|
+
*
|
|
23
|
+
* `issues` carries the structured validation result when available so
|
|
24
|
+
* consumers can present per-field feedback.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* if (result.error instanceof SchemaValidationError) {
|
|
28
|
+
* for (const issue of result.error.issues ?? []) {
|
|
29
|
+
* console.warn(issue.path, issue.message);
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
*/
|
|
33
|
+
declare class SchemaValidationError extends AIError {
|
|
34
|
+
static readonly defaultCategory: ErrorCategory;
|
|
35
|
+
readonly issues?: readonly StandardSchemaV1.Issue[];
|
|
36
|
+
constructor(message: string, options?: SchemaValidationErrorOptions);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SchemaValidationError, SchemaValidationErrorOptions };
|
|
40
|
+
//# sourceMappingURL=schema-validation-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-validation-error.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/schema-validation-error.ts"],"mappings":";;;;;;;AAQA;;KAAY,4BAAA,GAA+B,cAAA;EACzC,MAAA,YAAkB,gBAAA,CAAiB,KAAK;AAAA;;;;;AAAA;AAuB1C;;;;;;;;;;;;;;;cAAa,qBAAA,SAA8B,OAAA;EAAA,gBAClB,eAAA,EAAiB,aAAA;EAAA,SAExB,MAAA,YAAkB,gBAAA,CAAiB,KAAA;cAEhC,OAAA,UAAiB,OAAA,GAAU,4BAAA;AAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AIError } from "./ai-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/errors/schema-validation-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* A `StandardSchemaV1` validation call returned issues, or the input
|
|
6
|
+
* was not valid JSON before validation could even run.
|
|
7
|
+
*
|
|
8
|
+
* Produced in two places today:
|
|
9
|
+
* - Agent output parsing — the final trip text failed `JSON.parse` or
|
|
10
|
+
* the parsed value failed `~standard.validate`.
|
|
11
|
+
* - Tool input validation — the model's raw arguments for a tool call
|
|
12
|
+
* didn't match the tool's `input` schema.
|
|
13
|
+
*
|
|
14
|
+
* `issues` carries the structured validation result when available so
|
|
15
|
+
* consumers can present per-field feedback.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* if (result.error instanceof SchemaValidationError) {
|
|
19
|
+
* for (const issue of result.error.issues ?? []) {
|
|
20
|
+
* console.warn(issue.path, issue.message);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
var SchemaValidationError = class extends AIError {
|
|
25
|
+
static {
|
|
26
|
+
this.defaultCategory = "schema";
|
|
27
|
+
}
|
|
28
|
+
constructor(message, options) {
|
|
29
|
+
super("SCHEMA_VALIDATION_FAILED", message, options);
|
|
30
|
+
this.name = "SchemaValidationError";
|
|
31
|
+
this.issues = options?.issues;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { SchemaValidationError };
|
|
37
|
+
//# sourceMappingURL=schema-validation-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-validation-error.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/schema-validation-error.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport { AIError, type AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\n\n/**\n * Payload passed to `SchemaValidationError`. Subset of\n * `AIErrorOptions` plus the machine-readable validation issues list.\n */\nexport type SchemaValidationErrorOptions = AIErrorOptions & {\n issues?: readonly StandardSchemaV1.Issue[];\n};\n\n/**\n * A `StandardSchemaV1` validation call returned issues, or the input\n * was not valid JSON before validation could even run.\n *\n * Produced in two places today:\n * - Agent output parsing — the final trip text failed `JSON.parse` or\n * the parsed value failed `~standard.validate`.\n * - Tool input validation — the model's raw arguments for a tool call\n * didn't match the tool's `input` schema.\n *\n * `issues` carries the structured validation result when available so\n * consumers can present per-field feedback.\n *\n * @example\n * if (result.error instanceof SchemaValidationError) {\n * for (const issue of result.error.issues ?? []) {\n * console.warn(issue.path, issue.message);\n * }\n * }\n */\nexport class SchemaValidationError extends AIError {\n public static readonly defaultCategory: ErrorCategory = \"schema\";\n\n public readonly issues?: readonly StandardSchemaV1.Issue[];\n\n public constructor(message: string, options?: SchemaValidationErrorOptions) {\n super(\"SCHEMA_VALIDATION_FAILED\", message, options);\n this.name = \"SchemaValidationError\";\n this.issues = options?.issues;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,wBAAb,cAA2C,QAAQ;;yBACO;;CAIxD,AAAO,YAAY,SAAiB,SAAwC;EAC1E,MAAM,4BAA4B,SAAS,OAAO;EAClD,KAAK,OAAO;EACZ,KAAK,SAAS,SAAS;CACzB;AACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AIErrorOptions } from "./ai-error.mjs";
|
|
2
|
+
import { WorkflowError } from "./workflow-error.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../@warlock.js/ai/src/errors/step-failed-error.d.ts
|
|
5
|
+
type StepFailedErrorOptions = AIErrorOptions & {
|
|
6
|
+
stepName: string;
|
|
7
|
+
attempts: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A workflow step exhausted its retries (or was not retried) and
|
|
11
|
+
* terminated with an error. `cause` carries the last underlying error.
|
|
12
|
+
*/
|
|
13
|
+
declare class StepFailedError extends WorkflowError {
|
|
14
|
+
readonly stepName: string;
|
|
15
|
+
readonly attempts: number;
|
|
16
|
+
constructor(message: string, options: StepFailedErrorOptions);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { StepFailedError, StepFailedErrorOptions };
|
|
20
|
+
//# sourceMappingURL=step-failed-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-failed-error.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/step-failed-error.ts"],"mappings":";;;;KAGY,sBAAA,GAAyB,cAAc;EACjD,QAAA;EACA,QAAA;AAAA;;;;;cAOW,eAAA,SAAwB,aAAa;EAAA,SAChC,QAAA;EAAA,SACA,QAAA;cAEG,OAAA,UAAiB,OAAA,EAAS,sBAAA;AAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { WorkflowError } from "./workflow-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/errors/step-failed-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* A workflow step exhausted its retries (or was not retried) and
|
|
6
|
+
* terminated with an error. `cause` carries the last underlying error.
|
|
7
|
+
*/
|
|
8
|
+
var StepFailedError = class extends WorkflowError {
|
|
9
|
+
constructor(message, options) {
|
|
10
|
+
super(message, options, "STEP_FAILED");
|
|
11
|
+
this.name = "StepFailedError";
|
|
12
|
+
this.stepName = options.stepName;
|
|
13
|
+
this.attempts = options.attempts;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { StepFailedError };
|
|
19
|
+
//# sourceMappingURL=step-failed-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-failed-error.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/step-failed-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport { WorkflowError } from \"./workflow-error\";\n\nexport type StepFailedErrorOptions = AIErrorOptions & {\n stepName: string;\n attempts: number;\n};\n\n/**\n * A workflow step exhausted its retries (or was not retried) and\n * terminated with an error. `cause` carries the last underlying error.\n */\nexport class StepFailedError extends WorkflowError {\n public readonly stepName: string;\n public readonly attempts: number;\n\n public constructor(message: string, options: StepFailedErrorOptions) {\n super(message, options, \"STEP_FAILED\");\n this.name = \"StepFailedError\";\n this.stepName = options.stepName;\n this.attempts = options.attempts;\n }\n}\n"],"mappings":";;;;;;;AAYA,IAAa,kBAAb,cAAqC,cAAc;CAIjD,AAAO,YAAY,SAAiB,SAAiC;EACnE,MAAM,SAAS,SAAS,aAAa;EACrC,KAAK,OAAO;EACZ,KAAK,WAAW,QAAQ;EACxB,KAAK,WAAW,QAAQ;CAC1B;AACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ErrorCategory } from "./error-category.type.mjs";
|
|
2
|
+
import { AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
import { SupervisorFailedError } from "./supervisor-failed-error.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../../@warlock.js/ai/src/errors/supervisor-cancelled-error.d.ts
|
|
6
|
+
type SupervisorCancelledErrorOptions = AIErrorOptions & {
|
|
7
|
+
/** ISO-8601 timestamp at which the abort was observed by the supervisor. */cancelledAt: string; /** `controller.abort(reason)` payload when the caller supplied one. */
|
|
8
|
+
reason?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Supervisor run was cancelled via `AbortSignal` before it could
|
|
12
|
+
* finish. Between-iteration cancellation is guaranteed; mid-iteration
|
|
13
|
+
* cancellation is best-effort (the signal is also threaded into every
|
|
14
|
+
* in-flight child `execute()` call, but effectiveness depends on the
|
|
15
|
+
* child primitive respecting it).
|
|
16
|
+
*
|
|
17
|
+
* On cancellation the supervisor returns normally with `status:
|
|
18
|
+
* "cancelled"` and partial `report.snapshots` — the error is placed
|
|
19
|
+
* on `result.error` rather than thrown.
|
|
20
|
+
*/
|
|
21
|
+
declare class SupervisorCancelledError extends SupervisorFailedError {
|
|
22
|
+
static readonly defaultCategory: ErrorCategory;
|
|
23
|
+
readonly cancelledAt: string;
|
|
24
|
+
readonly reason?: string;
|
|
25
|
+
constructor(message: string, options: SupervisorCancelledErrorOptions);
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { SupervisorCancelledError, SupervisorCancelledErrorOptions };
|
|
29
|
+
//# sourceMappingURL=supervisor-cancelled-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-cancelled-error.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/supervisor-cancelled-error.ts"],"mappings":";;;;;KAIY,+BAAA,GAAkC,cAAc;8EAE1D,WAAA,UAFyC;EAIzC,MAAA;AAAA;;;;;AAAM;AAcR;;;;;;cAAa,wBAAA,SAAiC,qBAAA;EAAA,gBACrB,eAAA,EAAiB,aAAA;EAAA,SAExB,WAAA;EAAA,SACA,MAAA;cAGd,OAAA,UACA,OAAA,EAAS,+BAAA;AAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SupervisorFailedError } from "./supervisor-failed-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/errors/supervisor-cancelled-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* Supervisor run was cancelled via `AbortSignal` before it could
|
|
6
|
+
* finish. Between-iteration cancellation is guaranteed; mid-iteration
|
|
7
|
+
* cancellation is best-effort (the signal is also threaded into every
|
|
8
|
+
* in-flight child `execute()` call, but effectiveness depends on the
|
|
9
|
+
* child primitive respecting it).
|
|
10
|
+
*
|
|
11
|
+
* On cancellation the supervisor returns normally with `status:
|
|
12
|
+
* "cancelled"` and partial `report.snapshots` — the error is placed
|
|
13
|
+
* on `result.error` rather than thrown.
|
|
14
|
+
*/
|
|
15
|
+
var SupervisorCancelledError = class extends SupervisorFailedError {
|
|
16
|
+
static {
|
|
17
|
+
this.defaultCategory = "cancelled";
|
|
18
|
+
}
|
|
19
|
+
constructor(message, options) {
|
|
20
|
+
super(message, options, "SUPERVISOR_CANCELLED");
|
|
21
|
+
this.name = "SupervisorCancelledError";
|
|
22
|
+
this.cancelledAt = options.cancelledAt;
|
|
23
|
+
this.reason = options.reason;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { SupervisorCancelledError };
|
|
29
|
+
//# sourceMappingURL=supervisor-cancelled-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-cancelled-error.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/supervisor-cancelled-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { SupervisorFailedError } from \"./supervisor-failed-error\";\n\nexport type SupervisorCancelledErrorOptions = AIErrorOptions & {\n /** ISO-8601 timestamp at which the abort was observed by the supervisor. */\n cancelledAt: string;\n /** `controller.abort(reason)` payload when the caller supplied one. */\n reason?: string;\n};\n\n/**\n * Supervisor run was cancelled via `AbortSignal` before it could\n * finish. Between-iteration cancellation is guaranteed; mid-iteration\n * cancellation is best-effort (the signal is also threaded into every\n * in-flight child `execute()` call, but effectiveness depends on the\n * child primitive respecting it).\n *\n * On cancellation the supervisor returns normally with `status:\n * \"cancelled\"` and partial `report.snapshots` — the error is placed\n * on `result.error` rather than thrown.\n */\nexport class SupervisorCancelledError extends SupervisorFailedError {\n public static readonly defaultCategory: ErrorCategory = \"cancelled\";\n\n public readonly cancelledAt: string;\n public readonly reason?: string;\n\n public constructor(\n message: string,\n options: SupervisorCancelledErrorOptions,\n ) {\n super(message, options, \"SUPERVISOR_CANCELLED\");\n this.name = \"SupervisorCancelledError\";\n this.cancelledAt = options.cancelledAt;\n this.reason = options.reason;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,IAAa,2BAAb,cAA8C,sBAAsB;;yBACV;;CAKxD,AAAO,YACL,SACA,SACA;EACA,MAAM,SAAS,SAAS,sBAAsB;EAC9C,KAAK,OAAO;EACZ,KAAK,cAAc,QAAQ;EAC3B,KAAK,SAAS,QAAQ;CACxB;AACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ErrorCategory } from "./error-category.type.mjs";
|
|
2
|
+
import { AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
import { SupervisorFailedError } from "./supervisor-failed-error.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../../@warlock.js/ai/src/errors/supervisor-drift-error.d.ts
|
|
6
|
+
type SupervisorDriftErrorOptions = AIErrorOptions & {
|
|
7
|
+
/** Signature recorded on the snapshot being resumed. */savedSignature: string; /** Signature computed from the current supervisor definition. */
|
|
8
|
+
currentSignature: string;
|
|
9
|
+
runId: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* `supervisor.resume(runId)` loaded a snapshot whose structural
|
|
13
|
+
* fingerprint does not match the current supervisor definition
|
|
14
|
+
* (agent keys + descriptions + router identity + route presence).
|
|
15
|
+
* The resume is refused — no iteration runs — and the user decides
|
|
16
|
+
* how to recover: discard the snapshot, migrate manually, or call
|
|
17
|
+
* `resume(runId, { force: true })` to bypass the check.
|
|
18
|
+
*
|
|
19
|
+
* Mirrors `WorkflowDriftError` for workflow resume — same rationale,
|
|
20
|
+
* different primitive.
|
|
21
|
+
*/
|
|
22
|
+
declare class SupervisorDriftError extends SupervisorFailedError {
|
|
23
|
+
static readonly defaultCategory: ErrorCategory;
|
|
24
|
+
readonly savedSignature: string;
|
|
25
|
+
readonly currentSignature: string;
|
|
26
|
+
readonly runId: string;
|
|
27
|
+
constructor(message: string, options: SupervisorDriftErrorOptions);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { SupervisorDriftError, SupervisorDriftErrorOptions };
|
|
31
|
+
//# sourceMappingURL=supervisor-drift-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-drift-error.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/supervisor-drift-error.ts"],"mappings":";;;;;KAIY,2BAAA,GAA8B,cAAc;0DAEtD,cAAA,UAFqC;EAIrC,gBAAA;EACA,KAAA;AAAA;;;;;AAAK;AAcP;;;;;;cAAa,oBAAA,SAA6B,qBAAA;EAAA,gBACjB,eAAA,EAAiB,aAAA;EAAA,SAExB,cAAA;EAAA,SACA,gBAAA;EAAA,SACA,KAAA;cAEG,OAAA,UAAiB,OAAA,EAAS,2BAAA;AAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SupervisorFailedError } from "./supervisor-failed-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/errors/supervisor-drift-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* `supervisor.resume(runId)` loaded a snapshot whose structural
|
|
6
|
+
* fingerprint does not match the current supervisor definition
|
|
7
|
+
* (agent keys + descriptions + router identity + route presence).
|
|
8
|
+
* The resume is refused — no iteration runs — and the user decides
|
|
9
|
+
* how to recover: discard the snapshot, migrate manually, or call
|
|
10
|
+
* `resume(runId, { force: true })` to bypass the check.
|
|
11
|
+
*
|
|
12
|
+
* Mirrors `WorkflowDriftError` for workflow resume — same rationale,
|
|
13
|
+
* different primitive.
|
|
14
|
+
*/
|
|
15
|
+
var SupervisorDriftError = class extends SupervisorFailedError {
|
|
16
|
+
static {
|
|
17
|
+
this.defaultCategory = "drift";
|
|
18
|
+
}
|
|
19
|
+
constructor(message, options) {
|
|
20
|
+
super(message, options, "SUPERVISOR_DRIFT");
|
|
21
|
+
this.name = "SupervisorDriftError";
|
|
22
|
+
this.savedSignature = options.savedSignature;
|
|
23
|
+
this.currentSignature = options.currentSignature;
|
|
24
|
+
this.runId = options.runId;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { SupervisorDriftError };
|
|
30
|
+
//# sourceMappingURL=supervisor-drift-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-drift-error.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/supervisor-drift-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { SupervisorFailedError } from \"./supervisor-failed-error\";\n\nexport type SupervisorDriftErrorOptions = AIErrorOptions & {\n /** Signature recorded on the snapshot being resumed. */\n savedSignature: string;\n /** Signature computed from the current supervisor definition. */\n currentSignature: string;\n runId: string;\n};\n\n/**\n * `supervisor.resume(runId)` loaded a snapshot whose structural\n * fingerprint does not match the current supervisor definition\n * (agent keys + descriptions + router identity + route presence).\n * The resume is refused — no iteration runs — and the user decides\n * how to recover: discard the snapshot, migrate manually, or call\n * `resume(runId, { force: true })` to bypass the check.\n *\n * Mirrors `WorkflowDriftError` for workflow resume — same rationale,\n * different primitive.\n */\nexport class SupervisorDriftError extends SupervisorFailedError {\n public static readonly defaultCategory: ErrorCategory = \"drift\";\n\n public readonly savedSignature: string;\n public readonly currentSignature: string;\n public readonly runId: string;\n\n public constructor(message: string, options: SupervisorDriftErrorOptions) {\n super(message, options, \"SUPERVISOR_DRIFT\");\n this.name = \"SupervisorDriftError\";\n this.savedSignature = options.savedSignature;\n this.currentSignature = options.currentSignature;\n this.runId = options.runId;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IAAa,uBAAb,cAA0C,sBAAsB;;yBACN;;CAMxD,AAAO,YAAY,SAAiB,SAAsC;EACxE,MAAM,SAAS,SAAS,kBAAkB;EAC1C,KAAK,OAAO;EACZ,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,mBAAmB,QAAQ;EAChC,KAAK,QAAQ,QAAQ;CACvB;AACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AIErrorCode } from "./error-code.type.mjs";
|
|
2
|
+
import { AIError, AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../@warlock.js/ai/src/errors/supervisor-failed-error.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Base class for every supervisor-specific failure surfaced from
|
|
7
|
+
* `supervisor.execute()` / `supervisor.resume()` / authoring-time
|
|
8
|
+
* `ai.supervisor()` validation.
|
|
9
|
+
*
|
|
10
|
+
* **Role.** Anchor for the `SUPERVISOR_*` code family. Subclasses
|
|
11
|
+
* carry precise codes (`SUPERVISOR_MAX_ITERATIONS`,
|
|
12
|
+
* `SUPERVISOR_INVALID_ROUTE`, …); this base catches everything a
|
|
13
|
+
* supervisor run can produce that isn't already an agent / tool /
|
|
14
|
+
* provider / workflow error bubbling up from a child execution.
|
|
15
|
+
*
|
|
16
|
+
* Child-execution errors (agent, tool, provider, workflow) flow
|
|
17
|
+
* through the supervisor unchanged — they are captured on the
|
|
18
|
+
* relevant branch snapshot and, if fatal, wrapped as the `cause` of a
|
|
19
|
+
* `SupervisorFailedError` only when the supervisor itself has no
|
|
20
|
+
* narrower subclass to throw.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* try {
|
|
24
|
+
* ai.supervisor({
|
|
25
|
+
* route: () => "triage",
|
|
26
|
+
* router: routerAgent,
|
|
27
|
+
* intents: { triage },
|
|
28
|
+
* });
|
|
29
|
+
* } catch (error) {
|
|
30
|
+
* if (error instanceof SupervisorFailedError) {
|
|
31
|
+
* console.error(error.code, error.message);
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
*/
|
|
35
|
+
declare class SupervisorFailedError extends AIError {
|
|
36
|
+
constructor(message: string, options?: AIErrorOptions, code?: AIErrorCode);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SupervisorFailedError };
|
|
40
|
+
//# sourceMappingURL=supervisor-failed-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-failed-error.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/supervisor-failed-error.ts"],"mappings":";;;;;;AAiCA;;;;;;;;;;;;;;;;AAI2C;;;;;;;;;;;;cAJ9B,qBAAA,SAA8B,OAAA;cAEvC,OAAA,UACA,OAAA,GAAU,cAAA,EACV,IAAA,GAAM,WAAA;AAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AIError } from "./ai-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/errors/supervisor-failed-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* Base class for every supervisor-specific failure surfaced from
|
|
6
|
+
* `supervisor.execute()` / `supervisor.resume()` / authoring-time
|
|
7
|
+
* `ai.supervisor()` validation.
|
|
8
|
+
*
|
|
9
|
+
* **Role.** Anchor for the `SUPERVISOR_*` code family. Subclasses
|
|
10
|
+
* carry precise codes (`SUPERVISOR_MAX_ITERATIONS`,
|
|
11
|
+
* `SUPERVISOR_INVALID_ROUTE`, …); this base catches everything a
|
|
12
|
+
* supervisor run can produce that isn't already an agent / tool /
|
|
13
|
+
* provider / workflow error bubbling up from a child execution.
|
|
14
|
+
*
|
|
15
|
+
* Child-execution errors (agent, tool, provider, workflow) flow
|
|
16
|
+
* through the supervisor unchanged — they are captured on the
|
|
17
|
+
* relevant branch snapshot and, if fatal, wrapped as the `cause` of a
|
|
18
|
+
* `SupervisorFailedError` only when the supervisor itself has no
|
|
19
|
+
* narrower subclass to throw.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* try {
|
|
23
|
+
* ai.supervisor({
|
|
24
|
+
* route: () => "triage",
|
|
25
|
+
* router: routerAgent,
|
|
26
|
+
* intents: { triage },
|
|
27
|
+
* });
|
|
28
|
+
* } catch (error) {
|
|
29
|
+
* if (error instanceof SupervisorFailedError) {
|
|
30
|
+
* console.error(error.code, error.message);
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
*/
|
|
34
|
+
var SupervisorFailedError = class extends AIError {
|
|
35
|
+
constructor(message, options, code = "SUPERVISOR_FAILED") {
|
|
36
|
+
super(code, message, options);
|
|
37
|
+
this.name = "SupervisorFailedError";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { SupervisorFailedError };
|
|
43
|
+
//# sourceMappingURL=supervisor-failed-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-failed-error.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/supervisor-failed-error.ts"],"sourcesContent":["import { AIError, type AIErrorOptions } from \"./ai-error\";\nimport type { AIErrorCode } from \"./error-code.type\";\n\n/**\n * Base class for every supervisor-specific failure surfaced from\n * `supervisor.execute()` / `supervisor.resume()` / authoring-time\n * `ai.supervisor()` validation.\n *\n * **Role.** Anchor for the `SUPERVISOR_*` code family. Subclasses\n * carry precise codes (`SUPERVISOR_MAX_ITERATIONS`,\n * `SUPERVISOR_INVALID_ROUTE`, …); this base catches everything a\n * supervisor run can produce that isn't already an agent / tool /\n * provider / workflow error bubbling up from a child execution.\n *\n * Child-execution errors (agent, tool, provider, workflow) flow\n * through the supervisor unchanged — they are captured on the\n * relevant branch snapshot and, if fatal, wrapped as the `cause` of a\n * `SupervisorFailedError` only when the supervisor itself has no\n * narrower subclass to throw.\n *\n * @example\n * try {\n * ai.supervisor({\n * route: () => \"triage\",\n * router: routerAgent,\n * intents: { triage },\n * });\n * } catch (error) {\n * if (error instanceof SupervisorFailedError) {\n * console.error(error.code, error.message);\n * }\n * }\n */\nexport class SupervisorFailedError extends AIError {\n public constructor(\n message: string,\n options?: AIErrorOptions,\n code: AIErrorCode = \"SUPERVISOR_FAILED\",\n ) {\n super(code, message, options);\n this.name = \"SupervisorFailedError\";\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,wBAAb,cAA2C,QAAQ;CACjD,AAAO,YACL,SACA,SACA,OAAoB,qBACpB;EACA,MAAM,MAAM,SAAS,OAAO;EAC5B,KAAK,OAAO;CACd;AACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ErrorCategory } from "./error-category.type.mjs";
|
|
2
|
+
import { AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
import { SupervisorFailedError } from "./supervisor-failed-error.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../../@warlock.js/ai/src/errors/supervisor-routing-error.d.ts
|
|
6
|
+
type SupervisorRoutingErrorOptions = AIErrorOptions & {
|
|
7
|
+
/**
|
|
8
|
+
* The raw value the `route` callback or router agent returned. Keyed
|
|
9
|
+
* `unknown` because a misbehaving router can emit any JSON value —
|
|
10
|
+
* consumers should format it for display, not trust its shape.
|
|
11
|
+
*/
|
|
12
|
+
returned: unknown; /** Every legal intent key configured on the supervisor at run time. */
|
|
13
|
+
availableKeys: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A `route` callback or router agent returned a value that doesn't
|
|
17
|
+
* resolve to a configured agent key, a `string[]` of configured keys,
|
|
18
|
+
* or the `END` sentinel. Routing is authoritative — there is no
|
|
19
|
+
* recovery path, so the supervisor terminates the run immediately.
|
|
20
|
+
*
|
|
21
|
+
* Named `SupervisorRoutingError` (not `RoutingError`) to avoid
|
|
22
|
+
* colliding with `@warlock.js/ai`'s existing workflow `RoutingError`
|
|
23
|
+
* (`WORKFLOW_INVALID_GOTO`). Both carry the same semantic weight —
|
|
24
|
+
* "routing asked for something I can't dispatch" — in their
|
|
25
|
+
* respective primitives.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const { error } = await supervisor.execute(input);
|
|
29
|
+
* if (error?.code === "SUPERVISOR_INVALID_ROUTE") {
|
|
30
|
+
* logger.error("bad router decision", {
|
|
31
|
+
* returned: (error as SupervisorRoutingError).returned,
|
|
32
|
+
* available: (error as SupervisorRoutingError).availableKeys,
|
|
33
|
+
* });
|
|
34
|
+
* }
|
|
35
|
+
*/
|
|
36
|
+
declare class SupervisorRoutingError extends SupervisorFailedError {
|
|
37
|
+
static readonly defaultCategory: ErrorCategory;
|
|
38
|
+
readonly returned: unknown;
|
|
39
|
+
readonly availableKeys: string[];
|
|
40
|
+
constructor(message: string, options: SupervisorRoutingErrorOptions);
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { SupervisorRoutingError, SupervisorRoutingErrorOptions };
|
|
44
|
+
//# sourceMappingURL=supervisor-routing-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-routing-error.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/supervisor-routing-error.ts"],"mappings":";;;;;KAIY,6BAAA,GAAgC,cAAc;;AAA1D;;;;EAME,QAAA;EAEA,aAAA;AAAA;AAAa;AAwBf;;;;;;;;;;;;;;;;;;AAM4E;;AA9B7D,cAwBF,sBAAA,SAA+B,qBAAA;EAAA,gBACnB,eAAA,EAAiB,aAAA;EAAA,SAExB,QAAA;EAAA,SACA,aAAA;cAEG,OAAA,UAAiB,OAAA,EAAS,6BAAA;AAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SupervisorFailedError } from "./supervisor-failed-error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/errors/supervisor-routing-error.ts
|
|
4
|
+
/**
|
|
5
|
+
* A `route` callback or router agent returned a value that doesn't
|
|
6
|
+
* resolve to a configured agent key, a `string[]` of configured keys,
|
|
7
|
+
* or the `END` sentinel. Routing is authoritative — there is no
|
|
8
|
+
* recovery path, so the supervisor terminates the run immediately.
|
|
9
|
+
*
|
|
10
|
+
* Named `SupervisorRoutingError` (not `RoutingError`) to avoid
|
|
11
|
+
* colliding with `@warlock.js/ai`'s existing workflow `RoutingError`
|
|
12
|
+
* (`WORKFLOW_INVALID_GOTO`). Both carry the same semantic weight —
|
|
13
|
+
* "routing asked for something I can't dispatch" — in their
|
|
14
|
+
* respective primitives.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const { error } = await supervisor.execute(input);
|
|
18
|
+
* if (error?.code === "SUPERVISOR_INVALID_ROUTE") {
|
|
19
|
+
* logger.error("bad router decision", {
|
|
20
|
+
* returned: (error as SupervisorRoutingError).returned,
|
|
21
|
+
* available: (error as SupervisorRoutingError).availableKeys,
|
|
22
|
+
* });
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
25
|
+
var SupervisorRoutingError = class extends SupervisorFailedError {
|
|
26
|
+
static {
|
|
27
|
+
this.defaultCategory = "routing";
|
|
28
|
+
}
|
|
29
|
+
constructor(message, options) {
|
|
30
|
+
super(message, options, "SUPERVISOR_INVALID_ROUTE");
|
|
31
|
+
this.name = "SupervisorRoutingError";
|
|
32
|
+
this.returned = options.returned;
|
|
33
|
+
this.availableKeys = options.availableKeys;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { SupervisorRoutingError };
|
|
39
|
+
//# sourceMappingURL=supervisor-routing-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-routing-error.mjs","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/supervisor-routing-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { SupervisorFailedError } from \"./supervisor-failed-error\";\n\nexport type SupervisorRoutingErrorOptions = AIErrorOptions & {\n /**\n * The raw value the `route` callback or router agent returned. Keyed\n * `unknown` because a misbehaving router can emit any JSON value —\n * consumers should format it for display, not trust its shape.\n */\n returned: unknown;\n /** Every legal intent key configured on the supervisor at run time. */\n availableKeys: string[];\n};\n\n/**\n * A `route` callback or router agent returned a value that doesn't\n * resolve to a configured agent key, a `string[]` of configured keys,\n * or the `END` sentinel. Routing is authoritative — there is no\n * recovery path, so the supervisor terminates the run immediately.\n *\n * Named `SupervisorRoutingError` (not `RoutingError`) to avoid\n * colliding with `@warlock.js/ai`'s existing workflow `RoutingError`\n * (`WORKFLOW_INVALID_GOTO`). Both carry the same semantic weight —\n * \"routing asked for something I can't dispatch\" — in their\n * respective primitives.\n *\n * @example\n * const { error } = await supervisor.execute(input);\n * if (error?.code === \"SUPERVISOR_INVALID_ROUTE\") {\n * logger.error(\"bad router decision\", {\n * returned: (error as SupervisorRoutingError).returned,\n * available: (error as SupervisorRoutingError).availableKeys,\n * });\n * }\n */\nexport class SupervisorRoutingError extends SupervisorFailedError {\n public static readonly defaultCategory: ErrorCategory = \"routing\";\n\n public readonly returned: unknown;\n public readonly availableKeys: string[];\n\n public constructor(message: string, options: SupervisorRoutingErrorOptions) {\n super(message, options, \"SUPERVISOR_INVALID_ROUTE\");\n this.name = \"SupervisorRoutingError\";\n this.returned = options.returned;\n this.availableKeys = options.availableKeys;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAa,yBAAb,cAA4C,sBAAsB;;yBACR;;CAKxD,AAAO,YAAY,SAAiB,SAAwC;EAC1E,MAAM,SAAS,SAAS,0BAA0B;EAClD,KAAK,OAAO;EACZ,KAAK,WAAW,QAAQ;EACxB,KAAK,gBAAgB,QAAQ;CAC/B;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ErrorCategory } from "./error-category.type.mjs";
|
|
2
|
+
import { AIError, AIErrorOptions } from "./ai-error.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../@warlock.js/ai/src/errors/tool-execution-error.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Payload passed to `ToolExecutionError` — identifies which tool
|
|
7
|
+
* failed and, when applicable, which trip it was dispatched from.
|
|
8
|
+
*/
|
|
9
|
+
type ToolExecutionErrorOptions = AIErrorOptions & {
|
|
10
|
+
toolName: string;
|
|
11
|
+
tripIndex?: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A registered tool's `execute()` threw during dispatch — the tool
|
|
15
|
+
* code itself failed (not its input schema). The model's request was
|
|
16
|
+
* valid; the implementation crashed.
|
|
17
|
+
*
|
|
18
|
+
* Carries `toolName` so consumers can branch on which tool failed
|
|
19
|
+
* without regex-parsing the message, and `tripIndex` to correlate
|
|
20
|
+
* with the `LLMTrip` entry in `result.report.trips`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* if (result.error instanceof ToolExecutionError) {
|
|
24
|
+
* metrics.increment("tool.failure", { tool: result.error.toolName });
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
27
|
+
declare class ToolExecutionError extends AIError {
|
|
28
|
+
static readonly defaultCategory: ErrorCategory;
|
|
29
|
+
readonly toolName: string;
|
|
30
|
+
readonly tripIndex?: number;
|
|
31
|
+
constructor(message: string, options: ToolExecutionErrorOptions);
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { ToolExecutionError, ToolExecutionErrorOptions };
|
|
35
|
+
//# sourceMappingURL=tool-execution-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-execution-error.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/errors/tool-execution-error.ts"],"mappings":";;;;;;AAOA;;KAAY,yBAAA,GAA4B,cAAc;EACpD,QAAA;EACA,SAAA;AAAA;;;AAAS;AAiBX;;;;;;;;;;;cAAa,kBAAA,SAA2B,OAAA;EAAA,gBACf,eAAA,EAAiB,aAAA;EAAA,SAExB,QAAA;EAAA,SACA,SAAA;cAEG,OAAA,UAAiB,OAAA,EAAS,yBAAA;AAAA"}
|