@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,162 @@
|
|
|
1
|
+
import { AIError } from "../../errors/ai-error.mjs";
|
|
2
|
+
import { Usage } from "../result/usage.type.mjs";
|
|
3
|
+
import { Next } from "../supervisor/next.type.mjs";
|
|
4
|
+
import { IterationSnapshot } from "../supervisor/iteration-snapshot.type.mjs";
|
|
5
|
+
import { SupervisorInput } from "../supervisor/supervisor-input.type.mjs";
|
|
6
|
+
import { EvaluateResult } from "../supervisor/evaluate-context.type.mjs";
|
|
7
|
+
import { SupervisorResult } from "../result/supervisor-result.type.mjs";
|
|
8
|
+
//#region ../../@warlock.js/ai/src/contracts/events/supervisor-events.type.d.ts
|
|
9
|
+
/** Fires once at the start of every `supervisor.execute()` call. */
|
|
10
|
+
type SupervisorStartingPayload = {
|
|
11
|
+
supervisorName: string;
|
|
12
|
+
input: SupervisorInput;
|
|
13
|
+
};
|
|
14
|
+
/** Fires at the top of each iteration, before routing decides. */
|
|
15
|
+
type SupervisorIterationStartingPayload = {
|
|
16
|
+
iteration: number;
|
|
17
|
+
};
|
|
18
|
+
/** Router mode only — emitted just before the router agent is invoked. */
|
|
19
|
+
type SupervisorRouterDecidingPayload = {
|
|
20
|
+
iteration: number;
|
|
21
|
+
};
|
|
22
|
+
/** Emitted after the route callback or router agent resolves. */
|
|
23
|
+
type SupervisorRouterDecidedPayload = {
|
|
24
|
+
iteration: number;
|
|
25
|
+
next: Next;
|
|
26
|
+
reasoning?: string;
|
|
27
|
+
durationMs: number;
|
|
28
|
+
};
|
|
29
|
+
/** A dispatched agent/workflow is about to start this iteration. */
|
|
30
|
+
type SupervisorAgentStartingPayload = {
|
|
31
|
+
iteration: number;
|
|
32
|
+
intent: string;
|
|
33
|
+
input: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Child-agent streaming token bubbled up through the supervisor so UI
|
|
37
|
+
* consumers can render per-agent output in real time without wiring
|
|
38
|
+
* into every child agent individually.
|
|
39
|
+
*/
|
|
40
|
+
type SupervisorAgentStreamingPayload = {
|
|
41
|
+
iteration: number;
|
|
42
|
+
intent: string;
|
|
43
|
+
delta: string;
|
|
44
|
+
};
|
|
45
|
+
/** A dispatched branch completed successfully. */
|
|
46
|
+
type SupervisorAgentCompletedPayload = {
|
|
47
|
+
iteration: number;
|
|
48
|
+
intent: string;
|
|
49
|
+
output: unknown;
|
|
50
|
+
usage: {
|
|
51
|
+
input: number;
|
|
52
|
+
output: number;
|
|
53
|
+
total: number;
|
|
54
|
+
};
|
|
55
|
+
duration: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* A dispatched branch failed. Siblings continue — the supervisor
|
|
59
|
+
* captures the error on the branch snapshot and lets `evaluate`
|
|
60
|
+
* (or the default termination logic) decide the response.
|
|
61
|
+
*/
|
|
62
|
+
type SupervisorAgentFailedPayload = {
|
|
63
|
+
iteration: number;
|
|
64
|
+
intent: string;
|
|
65
|
+
error: AIError;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Classifier (Phase 7 / decisions §37) is about to run on iter 0.
|
|
69
|
+
* Fires once per fresh run when `SupervisorConfig.classifier` is
|
|
70
|
+
* configured.
|
|
71
|
+
*/
|
|
72
|
+
type SupervisorClassifierStartingPayload = {
|
|
73
|
+
iteration: 0;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Classifier streamed a token. Fires only when the classifier is
|
|
77
|
+
* an LLM agent AND the supervisor is being streamed at the top
|
|
78
|
+
* level. Distinct from `supervisor.agent.streaming` so UI consumers
|
|
79
|
+
* can render classifier tokens (or hide them) separately from
|
|
80
|
+
* dispatched specialist tokens.
|
|
81
|
+
*/
|
|
82
|
+
type SupervisorClassifierStreamingPayload = {
|
|
83
|
+
delta: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Classifier settled — `output` carries the final classifier output
|
|
87
|
+
* (post-refine if a refine hook was configured); `intent` is the
|
|
88
|
+
* dispatched intent name (absent when refine returned `END`);
|
|
89
|
+
* `refined` indicates whether the refine hook changed the output.
|
|
90
|
+
*/
|
|
91
|
+
type SupervisorClassifierCompletedPayload = {
|
|
92
|
+
output: {
|
|
93
|
+
intent?: string;
|
|
94
|
+
reasoning?: string;
|
|
95
|
+
confidence?: number;
|
|
96
|
+
};
|
|
97
|
+
intent?: string;
|
|
98
|
+
refined: boolean;
|
|
99
|
+
halted: boolean;
|
|
100
|
+
duration: number;
|
|
101
|
+
usage?: Usage;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Classifier failed (the agent / callback threw, or refine threw,
|
|
105
|
+
* or refine returned an invalid intent). Run aborts with this error
|
|
106
|
+
* surfaced on `result.error`.
|
|
107
|
+
*/
|
|
108
|
+
type SupervisorClassifierFailedPayload = {
|
|
109
|
+
error: AIError;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Receptionist agent emitted a token. Fires only when an `ackAgent`
|
|
113
|
+
* is configured AND iteration 0 is in progress. Semantically distinct
|
|
114
|
+
* from `supervisor.agent.streaming` so UIs can render ack tokens as
|
|
115
|
+
* the user-facing first reply without filtering by intent name.
|
|
116
|
+
*/
|
|
117
|
+
type SupervisorAckStreamingPayload = {
|
|
118
|
+
delta: string;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Receptionist agent settled. Fires once per run when an `ackAgent`
|
|
122
|
+
* is configured. `output` is the raw agent output (pre-strip-merge);
|
|
123
|
+
* `error` is set when the ack agent failed (run continues either way).
|
|
124
|
+
*/
|
|
125
|
+
type SupervisorAckCompletedPayload = {
|
|
126
|
+
output?: unknown;
|
|
127
|
+
usage?: Usage;
|
|
128
|
+
duration: number;
|
|
129
|
+
error?: AIError;
|
|
130
|
+
};
|
|
131
|
+
/** The `evaluate` callback returned — verdict may be `undefined`. */
|
|
132
|
+
type SupervisorEvaluateVerdictPayload = {
|
|
133
|
+
iteration: number;
|
|
134
|
+
verdict: EvaluateResult;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* An iteration settled — `snapshot` is the frozen forensic record
|
|
138
|
+
* written to history and (when `store` is set) the KV snapshot.
|
|
139
|
+
*/
|
|
140
|
+
type SupervisorIterationCompletedPayload = {
|
|
141
|
+
iteration: number;
|
|
142
|
+
snapshot: IterationSnapshot;
|
|
143
|
+
};
|
|
144
|
+
/** The run was aborted via `AbortSignal`. */
|
|
145
|
+
type SupervisorCancelledPayload = {
|
|
146
|
+
cancelledAt: string;
|
|
147
|
+
reason?: string;
|
|
148
|
+
};
|
|
149
|
+
/** The run terminated successfully — result is the final value. */
|
|
150
|
+
type SupervisorCompletedPayload<TOutput = unknown> = {
|
|
151
|
+
result: SupervisorResult<TOutput>;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* The run terminated with a typed error surfaced on `result.error`.
|
|
155
|
+
* Cancellation emits `supervisor.cancelled` instead.
|
|
156
|
+
*/
|
|
157
|
+
type SupervisorErrorPayload = {
|
|
158
|
+
error: AIError;
|
|
159
|
+
};
|
|
160
|
+
//#endregion
|
|
161
|
+
export { SupervisorAckCompletedPayload, SupervisorAckStreamingPayload, SupervisorAgentCompletedPayload, SupervisorAgentFailedPayload, SupervisorAgentStartingPayload, SupervisorAgentStreamingPayload, SupervisorCancelledPayload, SupervisorClassifierCompletedPayload, SupervisorClassifierFailedPayload, SupervisorClassifierStartingPayload, SupervisorClassifierStreamingPayload, SupervisorCompletedPayload, SupervisorErrorPayload, SupervisorEvaluateVerdictPayload, SupervisorIterationCompletedPayload, SupervisorIterationStartingPayload, SupervisorRouterDecidedPayload, SupervisorRouterDecidingPayload, SupervisorStartingPayload };
|
|
162
|
+
//# sourceMappingURL=supervisor-events.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-events.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/events/supervisor-events.type.ts"],"mappings":";;;;;;;;;KAWY,yBAAA;EACV,cAAA;EACA,KAAA,EAAO,eAAe;AAAA;;KAIZ,kCAAA;EAAuC,SAAS;AAAA;;KAGhD,+BAAA;EAAoC,SAAS;AAAA;;KAG7C,8BAAA;EACV,SAAA;EACA,IAAA,EAAM,IAAI;EACV,SAAA;EACA,UAAA;AAAA;AAV0D;AAAA,KAchD,8BAAA;EACV,SAAA;EACA,MAAA;EACA,KAAA;AAAA;AAXF;;;;;AAAA,KAmBY,+BAAA;EACV,SAAA;EACA,MAAA;EACA,KAAA;AAAA;AAlBU;AAAA,KAsBA,+BAAA;EACV,SAAA;EACA,MAAA;EACA,MAAA;EACA,KAAA;IAAS,KAAA;IAAe,MAAA;IAAgB,KAAA;EAAA;EACxC,QAAA;AAAA;;;;;;KAQU,4BAAA;EACV,SAAA;EACA,MAAA;EACA,KAAA,EAAO,OAAO;AAAA;;;;;;KAQJ,mCAAA;EAAwC,SAAS;AAAA;;;AAnBnD;AAQV;;;;KAoBY,oCAAA;EACV,KAAK;AAAA;;;AAlBS;AAQhB;;;KAmBY,oCAAA;EACV,MAAA;IAAU,MAAA;IAAiB,SAAA;IAAoB,UAAA;EAAA;EAC/C,MAAA;EACA,OAAA;EACA,MAAA;EACA,QAAA;EACA,KAAA,GAAQ,KAAK;AAAA;;;;;;KAQH,iCAAA;EACV,KAAA,EAAO,OAAO;AAAA;;;AATD;AAQf;;;KAUY,6BAAA;EACV,KAAK;AAAA;;;;AAAA;AAQP;KAAY,6BAAA;EACV,MAAA;EACA,KAAA,GAAQ,KAAA;EACR,QAAA;EACA,KAAA,GAAQ,OAAO;AAAA;;KAIL,gCAAA;EACV,SAAA;EACA,OAAA,EAAS,cAAc;AAAA;AAFzB;;;;AAAA,KASY,mCAAA;EACV,SAAA;EACA,QAAA,EAAU,iBAAiB;AAAA;AATJ;AAAA,KAab,0BAAA;EACV,WAAA;EACA,MAAM;AAAA;;KAII,0BAAA;EACV,MAAA,EAAQ,gBAAgB,CAAC,OAAA;AAAA;AAXE;AAI7B;;;AAJ6B,KAkBjB,sBAAA;EAA2B,KAAA,EAAO,OAAO;AAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Usage } from "../result/usage.type.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/contracts/events/usage-event.type.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Per-trip telemetry payload for the `onUsage` agent hook (T1 of the
|
|
6
|
+
* 2026-05-08 ai-usage/runs/state/cart plan).
|
|
7
|
+
*
|
|
8
|
+
* Fired once after every LLM round-trip — including the trip that
|
|
9
|
+
* caused a tool call, the continuation trip after the tool result,
|
|
10
|
+
* and any repair trips. Cost-ledger code subscribes here to write one
|
|
11
|
+
* row per trip with stable identity (`runId` + `tripIndex`) so usage
|
|
12
|
+
* rows can be joined back to a parent `ai_runs` row written by the
|
|
13
|
+
* `onComplete` hook.
|
|
14
|
+
*
|
|
15
|
+
* Provider identity is split: `model.name` is the upstream model
|
|
16
|
+
* identifier (e.g. `gpt-4o-mini`); `model.provider` is the SDK label
|
|
17
|
+
* (`openai`, `openrouter`, `anthropic`). Both are stable across the
|
|
18
|
+
* agent run — they reflect the model the agent was constructed with.
|
|
19
|
+
*
|
|
20
|
+
* `usage.cachedTokens`, when populated, is the subset of `usage.input`
|
|
21
|
+
* served from the provider's prompt cache. Costs price it separately
|
|
22
|
+
* from full-rate input tokens.
|
|
23
|
+
*
|
|
24
|
+
* Hook handlers may be sync or async. Errors thrown inside the hook
|
|
25
|
+
* are swallowed so consumer bugs cannot crash the agent loop.
|
|
26
|
+
*/
|
|
27
|
+
type UsageEvent = {
|
|
28
|
+
/** Run-scoped identifier (matches `AgentResult.report.runId`). */runId: string; /** 0-indexed position of this trip within the run. */
|
|
29
|
+
tripIndex: number; /** Model identity for this trip. */
|
|
30
|
+
model: {
|
|
31
|
+
name: string;
|
|
32
|
+
provider: string;
|
|
33
|
+
}; /** Token counts for this trip. */
|
|
34
|
+
usage: Usage; /** Wall-clock timestamp the trip ended (ISO 8601 string). */
|
|
35
|
+
timestamp: string;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { UsageEvent };
|
|
39
|
+
//# sourceMappingURL=usage-event.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage-event.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/events/usage-event.type.ts"],"mappings":";;;;;AAyBA;;;;;;;;;;;;;AAUW;;;;;;;;KAVC,UAAA;oEAEV,KAAA;EAEA,SAAA;EAEA,KAAA;IAAS,IAAA;IAAc,QAAA;EAAA;EAEvB,KAAA,EAAO,KAAK;EAEZ,SAAA;AAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { WorkflowResult } from "../result/workflow-result.type.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/contracts/events/workflow-events.type.d.ts
|
|
4
|
+
type WorkflowStartingPayload = {
|
|
5
|
+
workflowName: string;
|
|
6
|
+
input: unknown;
|
|
7
|
+
};
|
|
8
|
+
type WorkflowStepStartingPayload = {
|
|
9
|
+
step: string;
|
|
10
|
+
};
|
|
11
|
+
type WorkflowStepStreamingPayload = {
|
|
12
|
+
step: string;
|
|
13
|
+
delta: string;
|
|
14
|
+
};
|
|
15
|
+
type WorkflowStepCompletedPayload = {
|
|
16
|
+
step: string;
|
|
17
|
+
output: unknown;
|
|
18
|
+
duration: number;
|
|
19
|
+
};
|
|
20
|
+
type WorkflowStepSkippedPayload = {
|
|
21
|
+
step: string;
|
|
22
|
+
};
|
|
23
|
+
type WorkflowStepRetryingPayload = {
|
|
24
|
+
step: string;
|
|
25
|
+
attempt: number;
|
|
26
|
+
totalAttempts: number;
|
|
27
|
+
lastError: unknown;
|
|
28
|
+
};
|
|
29
|
+
type WorkflowStepFailedPayload = {
|
|
30
|
+
step: string;
|
|
31
|
+
error: unknown;
|
|
32
|
+
attempts: number;
|
|
33
|
+
};
|
|
34
|
+
type WorkflowLoopWarningPayload = {
|
|
35
|
+
step: string;
|
|
36
|
+
enteredCount: number;
|
|
37
|
+
lastGoto: string | null;
|
|
38
|
+
};
|
|
39
|
+
type WorkflowCancelledPayload = {
|
|
40
|
+
cancelledAt: string;
|
|
41
|
+
reason: string;
|
|
42
|
+
};
|
|
43
|
+
type WorkflowCompletedPayload = {
|
|
44
|
+
result: WorkflowResult<unknown>;
|
|
45
|
+
};
|
|
46
|
+
type WorkflowErrorPayload = {
|
|
47
|
+
error: unknown;
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { WorkflowCancelledPayload, WorkflowCompletedPayload, WorkflowErrorPayload, WorkflowLoopWarningPayload, WorkflowStartingPayload, WorkflowStepCompletedPayload, WorkflowStepFailedPayload, WorkflowStepRetryingPayload, WorkflowStepSkippedPayload, WorkflowStepStartingPayload, WorkflowStepStreamingPayload };
|
|
51
|
+
//# sourceMappingURL=workflow-events.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-events.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/events/workflow-events.type.ts"],"mappings":";;;KAEY,uBAAA;EACV,YAAA;EACA,KAAK;AAAA;AAAA,KAGK,2BAAA;EAAgC,IAAI;AAAA;AAAA,KAEpC,4BAAA;EAAiC,IAAA;EAAc,KAAK;AAAA;AAAA,KAEpD,4BAAA;EACV,IAAA;EACA,MAAA;EACA,QAAA;AAAA;AAAA,KAGU,0BAAA;EAA+B,IAAI;AAAA;AAAA,KAEnC,2BAAA;EACV,IAAA;EACA,OAAA;EACA,aAAA;EACA,SAAA;AAAA;AAAA,KAGU,yBAAA;EACV,IAAA;EACA,KAAA;EACA,QAAA;AAAA;AAAA,KAGU,0BAAA;EACV,IAAA;EACA,YAAA;EACA,QAAA;AAAA;AAAA,KAGU,wBAAA;EACV,WAAA;EACA,MAAM;AAAA;AAAA,KAGI,wBAAA;EAA6B,MAAA,EAAQ,cAAc;AAAA;AAAA,KAEnD,oBAAA;EAAyB,KAAK;AAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseResult } from "./result/base-result.type.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/ai/src/contracts/executable.contract.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Shared contract for all executable AI primitives (agent, workflow, supervisor).
|
|
6
|
+
* All three implement this interface with their specific result types.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // An agent implements ExecutableContract<string, AgentExecuteOptions, AgentResult<TOutput>>
|
|
10
|
+
* const result = await agent.execute("Summarize this document");
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // A workflow implements ExecutableContract<WorkflowInput, WorkflowOptions, WorkflowResult>
|
|
14
|
+
* const result = await workflow.execute({ topic: "AI trends" });
|
|
15
|
+
*/
|
|
16
|
+
interface ExecutableContract<TInput, TOptions, TResult extends BaseResult> {
|
|
17
|
+
/**
|
|
18
|
+
* Execute the primitive with the given input and options.
|
|
19
|
+
* Returns a promise that resolves to the typed result.
|
|
20
|
+
*/
|
|
21
|
+
execute(input: TInput, options?: TOptions): Promise<TResult>;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ExecutableContract };
|
|
25
|
+
//# sourceMappingURL=executable.contract.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable.contract.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/contracts/executable.contract.ts"],"mappings":";;;;;AAcA;;;;;;;;;;UAAiB,kBAAA,mCAGC,UAAA;EADhB;;;;EAOA,OAAA,CAAQ,KAAA,EAAO,MAAA,EAAQ,OAAA,GAAU,QAAA,GAAW,OAAA,CAAQ,OAAA;AAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../../@warlock.js/ai/src/contracts/finish-reason.type.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Reasons the LLM stopped generating. Shared across model responses,
|
|
4
|
+
* streaming chunks, and LLM trip records.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const reason: FinishReason = "stop";
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* if (response.finishReason === "tool_calls") {
|
|
11
|
+
* // Execute requested tools and continue the trip loop
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
type FinishReason = "stop" | "tool_calls" | "length" | "error";
|
|
15
|
+
//#endregion
|
|
16
|
+
export { FinishReason };
|
|
17
|
+
//# sourceMappingURL=finish-reason.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finish-reason.type.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/contracts/finish-reason.type.ts"],"mappings":";;AAYA;;;;AAAwB;;;;;;;KAAZ,YAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Attachment, AttachmentSource, ResolvedAttachment, StorageFileShape } from "./attachment.type.mjs";
|
|
2
|
+
import { ContentPart, ImageSource } from "./content-part.type.mjs";
|
|
3
|
+
import { ModelToolCallRequest } from "./model-tool-call-request.type.mjs";
|
|
4
|
+
import { Message } from "./conversation-message.type.mjs";
|
|
5
|
+
import { ModelPricing } from "./result/model-pricing.type.mjs";
|
|
6
|
+
import { Usage } from "./result/usage.type.mjs";
|
|
7
|
+
import { BaseResult } from "./result/base-result.type.mjs";
|
|
8
|
+
import { AttemptEntry } from "./result/attempt-entry.type.mjs";
|
|
9
|
+
import { BaseReport, REPORT_SCHEMA_VERSION, ReportStatus, ReportType } from "./result/base-report.type.mjs";
|
|
10
|
+
import { FinishReason } from "./finish-reason.type.mjs";
|
|
11
|
+
import { ToolCall } from "./result/tool-call.type.mjs";
|
|
12
|
+
import { LLMTrip } from "./result/llm-trip.type.mjs";
|
|
13
|
+
import { AgentReport, ExecutionReport, ExecutionStatus } from "./result/execution-report.type.mjs";
|
|
14
|
+
import { AgentResult } from "./result/agent-result.type.mjs";
|
|
15
|
+
import { AgentCompletedPayload, AgentErrorPayload, AgentStartingPayload, AgentStreamingPayload, AgentToolCalledPayload, AgentToolCallingFailedPayload, AgentToolCallingPayload, AgentTripCompletedPayload, AgentTripStartedPayload, ToolEventMeta } from "./events/agent-events.type.mjs";
|
|
16
|
+
import { EventIdentity, WithoutIdentity } from "./events/event-identity.type.mjs";
|
|
17
|
+
import { ExecuteResult } from "./result/execute-result.type.mjs";
|
|
18
|
+
import { ExecutableContract } from "./executable.contract.mjs";
|
|
19
|
+
import { StreamEvent, StreamEventBody } from "./stream/stream-event.type.mjs";
|
|
20
|
+
import { StreamContract } from "./stream/stream.contract.mjs";
|
|
21
|
+
import { AgentContract, AgentEventHandler } from "./agent/agent.contract.mjs";
|
|
22
|
+
import { END, EndSentinel } from "./end.type.mjs";
|
|
23
|
+
import { StepSnapshot } from "./result/step-result.type.mjs";
|
|
24
|
+
import { WorkflowReport, WorkflowResult } from "./result/workflow-result.type.mjs";
|
|
25
|
+
import { ToolConfig, ToolContext, ToolMeta, ToolMode } from "./tool.contract.mjs";
|
|
26
|
+
import { NextStepResult } from "./workflow/next-step-result.type.mjs";
|
|
27
|
+
import { RetryBackoff, RetryConfig } from "./workflow/retry-config.type.mjs";
|
|
28
|
+
import { WorkflowContext } from "./workflow/workflow-context.type.mjs";
|
|
29
|
+
import { StepAgentInput, StepDefinition, StepLocalEvents, StepOutputSpec } from "./workflow/step.contract.mjs";
|
|
30
|
+
import { WorkflowDefinition, WorkflowEventHandler, WorkflowEventHandlers, WorkflowExecuteOptions, WorkflowInstance, WorkflowResumeOptions, WorkflowRunOptions } from "./workflow/workflow.contract.mjs";
|
|
31
|
+
import { Placeholders } from "./placeholders.type.mjs";
|
|
32
|
+
import { InstructionContract, PersonaContract, SystemPromptBlockContract, SystemPromptContract } from "./system-prompt.contract.mjs";
|
|
33
|
+
import { Next } from "./supervisor/next.type.mjs";
|
|
34
|
+
import { AckSnapshot, AgentBranchSnapshot, DecisionSource, IterationDecision, IterationSnapshot } from "./supervisor/iteration-snapshot.type.mjs";
|
|
35
|
+
import { SupervisorInput } from "./supervisor/supervisor-input.type.mjs";
|
|
36
|
+
import { EvaluateBranchResult, EvaluateContext, EvaluateResult } from "./supervisor/evaluate-context.type.mjs";
|
|
37
|
+
import { RouteContext } from "./supervisor/route-context.type.mjs";
|
|
38
|
+
import { AckCallback, AckConfig, AckEntry, AckRunEntry } from "./supervisor/ack-entry.type.mjs";
|
|
39
|
+
import { DispatchRawResult, IntentCallback, IntentEntry, IntentRunEntry, SupervisorIntentValue } from "./supervisor/intent-entry.type.mjs";
|
|
40
|
+
import { RouterEntry } from "./supervisor/router-entry.type.mjs";
|
|
41
|
+
import { SupervisorConfig, SupervisorEventHandler, SupervisorEventHandlers } from "./supervisor/supervisor-config.type.mjs";
|
|
42
|
+
import { SupervisorExecuteOptions, SupervisorResumeOptions } from "./supervisor/supervisor-execute-options.type.mjs";
|
|
43
|
+
import { SupervisorStreamEvent } from "./supervisor/supervisor-stream-event.type.mjs";
|
|
44
|
+
import { SupervisorAsToolOptions, SupervisorContract } from "./supervisor/supervisor.contract.mjs";
|
|
45
|
+
import { DispatchContext, IntentRunner, IntentRunnerMap } from "./supervisor/dispatch-context.type.mjs";
|
|
46
|
+
import { ClassifierAgentEntry, ClassifierCallback, ClassifierConfig, ClassifierContext, ClassifierOutput, ClassifierRefineContext, ClassifierRefineResult, ClassifierRunEntry, ClassifierSnapshot } from "./supervisor/classifier-context.type.mjs";
|
|
47
|
+
import { SupervisorReport, SupervisorResult, SupervisorTerminatedBy } from "./result/supervisor-result.type.mjs";
|
|
48
|
+
import { SessionSendResult } from "./result/session-send-result.type.mjs";
|
|
49
|
+
import { SupervisorSnapshot, SupervisorSnapshotStatus } from "./supervisor/supervisor-snapshot.type.mjs";
|
|
50
|
+
import { SupervisorAgentCompletedPayload, SupervisorAgentFailedPayload, SupervisorAgentStartingPayload, SupervisorAgentStreamingPayload, SupervisorCancelledPayload, SupervisorCompletedPayload, SupervisorErrorPayload, SupervisorEvaluateVerdictPayload, SupervisorIterationCompletedPayload, SupervisorIterationStartingPayload, SupervisorRouterDecidedPayload, SupervisorRouterDecidingPayload, SupervisorStartingPayload } from "./events/supervisor-events.type.mjs";
|
|
51
|
+
import { WorkflowCancelledPayload, WorkflowCompletedPayload, WorkflowErrorPayload, WorkflowLoopWarningPayload, WorkflowStartingPayload, WorkflowStepCompletedPayload, WorkflowStepFailedPayload, WorkflowStepRetryingPayload, WorkflowStepSkippedPayload, WorkflowStepStartingPayload, WorkflowStepStreamingPayload } from "./events/workflow-events.type.mjs";
|
|
52
|
+
import { AgentEventMap, SupervisorEventMap, WorkflowEventMap } from "./events/event-map.type.mjs";
|
|
53
|
+
import { StreamingToolGuardConfig } from "./streaming-tool-guard-config.type.mjs";
|
|
54
|
+
import { AgentExecuteOptions } from "./agent/agent-options.type.mjs";
|
|
55
|
+
import { EmbedderConfig, EmbedderContract, EmbeddingBatchResult, EmbeddingResult, EmbeddingUsage } from "./embedder.contract.mjs";
|
|
56
|
+
import { MiddlewareState } from "./middleware/middleware-state.type.mjs";
|
|
57
|
+
import { MiddlewareAgentRef, MiddlewareExecuteContext, MiddlewareModelRef, MiddlewareToolContext, MiddlewareTripContext } from "./middleware/middleware-context.type.mjs";
|
|
58
|
+
import { ModelCallOptions, ModelCapabilities, ModelContract, ModelResponse, ModelStreamChunk } from "./model.contract.mjs";
|
|
59
|
+
import { AgentMiddleware, AgentMiddlewareExecuteHooks, AgentMiddlewareToolHooks, AgentMiddlewareTripHooks } from "./middleware/middleware.contract.mjs";
|
|
60
|
+
import { ModelConfig, SDKAdapterContract } from "./sdk-adapter.contract.mjs";
|
|
61
|
+
import { WorkflowSnapshot } from "./workflow/workflow-snapshot.type.mjs";
|
|
62
|
+
import { CompleteEvent } from "./events/complete-event.type.mjs";
|
|
63
|
+
import { UsageEvent } from "./events/usage-event.type.mjs";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { MiddlewareState } from "./middleware-state.type.mjs";
|
|
2
|
+
import { MiddlewareAgentRef, MiddlewareExecuteContext, MiddlewareModelRef, MiddlewareToolContext, MiddlewareTripContext } from "./middleware-context.type.mjs";
|
|
3
|
+
import { AgentMiddleware, AgentMiddlewareExecuteHooks, AgentMiddlewareToolHooks, AgentMiddlewareTripHooks } from "./middleware.contract.mjs";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ModelToolCallRequest } from "../model-tool-call-request.type.mjs";
|
|
2
|
+
import { Message } from "../conversation-message.type.mjs";
|
|
3
|
+
import { ToolMode } from "../tool.contract.mjs";
|
|
4
|
+
import { AgentExecuteOptions } from "../agent/agent-options.type.mjs";
|
|
5
|
+
import { MiddlewareState } from "./middleware-state.type.mjs";
|
|
6
|
+
|
|
7
|
+
//#region ../../@warlock.js/ai/src/contracts/middleware/middleware-context.type.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Minimal identity shape of the agent the middleware is wrapping.
|
|
10
|
+
* Middleware never mutates the agent itself, so it sees only the
|
|
11
|
+
* fields it can usefully branch on — name (for logs, per-agent
|
|
12
|
+
* allow-lists) and whether the name was auto-synthesized.
|
|
13
|
+
*/
|
|
14
|
+
type MiddlewareAgentRef = {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly isAnonymous: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Minimal identity shape of the model the agent is wrapping.
|
|
20
|
+
* Surface just enough for middleware to branch on (budget uses
|
|
21
|
+
* provider/model to look up pricing, semantic cache uses model name
|
|
22
|
+
* in its namespace key). Never includes the live adapter instance.
|
|
23
|
+
*/
|
|
24
|
+
type MiddlewareModelRef = {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly provider?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Context passed to the outermost (`execute`) middleware phase —
|
|
30
|
+
* fires once around the entire `agent.execute()` call.
|
|
31
|
+
*
|
|
32
|
+
* **Role.** Gives middleware the stable identity of the run (agent,
|
|
33
|
+
* input, options) and the shared-state bag all downstream hooks will
|
|
34
|
+
* see. Anything cumulative-across-trips lives here: total token
|
|
35
|
+
* count, wall-clock budget, per-session rate limit counters.
|
|
36
|
+
*
|
|
37
|
+
* All fields are `readonly` — middleware reads them freely but does
|
|
38
|
+
* not reassign. State mutations go through `ctx.state` so there is
|
|
39
|
+
* exactly one mutable surface and it is explicit at the call site.
|
|
40
|
+
*/
|
|
41
|
+
type MiddlewareExecuteContext = {
|
|
42
|
+
readonly agent: MiddlewareAgentRef;
|
|
43
|
+
readonly model: MiddlewareModelRef;
|
|
44
|
+
readonly input: string;
|
|
45
|
+
readonly options: AgentExecuteOptions<unknown> | undefined;
|
|
46
|
+
readonly state: MiddlewareState;
|
|
47
|
+
readonly signal?: AbortSignal;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Context passed to per-LLM-trip middleware hooks — fires once per
|
|
51
|
+
* round trip the agent makes to the model.
|
|
52
|
+
*
|
|
53
|
+
* **Role.** Lets middleware intercept individual model calls:
|
|
54
|
+
* guardrails inspect the outbound `messages` / inbound response,
|
|
55
|
+
* semantic cache short-circuits a trip entirely by returning a
|
|
56
|
+
* synthetic `ModelResponse` from `trip.before`.
|
|
57
|
+
*
|
|
58
|
+
* Extends `MiddlewareExecuteContext` so anything a `before(execute)`
|
|
59
|
+
* hook stashed in `state` is still visible here — the whole point of
|
|
60
|
+
* threading one `state` reference through all levels.
|
|
61
|
+
*/
|
|
62
|
+
type MiddlewareTripContext = MiddlewareExecuteContext & {
|
|
63
|
+
readonly tripIndex: number;
|
|
64
|
+
readonly messages: ReadonlyArray<Message>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Context passed to per-tool-call middleware hooks — fires once per
|
|
68
|
+
* tool the model asks the agent to invoke.
|
|
69
|
+
*
|
|
70
|
+
* **Role.** Lets middleware wrap individual tool dispatches:
|
|
71
|
+
* rate-limit a specific tool, validate inputs beyond the schema,
|
|
72
|
+
* short-circuit with a cached tool response. Exposes the originating
|
|
73
|
+
* `ModelToolCallRequest` so middleware can log/inspect the exact
|
|
74
|
+
* args the model produced.
|
|
75
|
+
*
|
|
76
|
+
* Extends `MiddlewareTripContext` so tool hooks can branch on the
|
|
77
|
+
* surrounding trip context when useful (e.g. "skip rate-limit on
|
|
78
|
+
* repair trips").
|
|
79
|
+
*/
|
|
80
|
+
type MiddlewareToolContext = MiddlewareTripContext & {
|
|
81
|
+
readonly tool: {
|
|
82
|
+
readonly name: string;
|
|
83
|
+
readonly description?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Result-feedback mode of the tool being dispatched. `"feedback"`
|
|
86
|
+
* (default) for standard round-trip tools; `"silent"` for
|
|
87
|
+
* fire-and-forget side-effect tools whose result is not fed back
|
|
88
|
+
* to the model. Exposed so middleware (cost accounting, logging,
|
|
89
|
+
* telemetry) can branch on tool semantics — e.g. skip the
|
|
90
|
+
* post-tool-call usage projection for silent terminal trips since
|
|
91
|
+
* the loop ends there.
|
|
92
|
+
*/
|
|
93
|
+
readonly mode?: ToolMode;
|
|
94
|
+
};
|
|
95
|
+
readonly request: ModelToolCallRequest;
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { MiddlewareAgentRef, MiddlewareExecuteContext, MiddlewareModelRef, MiddlewareToolContext, MiddlewareTripContext };
|
|
99
|
+
//# sourceMappingURL=middleware-context.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware-context.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/middleware/middleware-context.type.ts"],"mappings":";;;;;;;;;AAYA;;;;KAAY,kBAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAW;AAAA;;AAWH;AAgBnB;;;;KAlBY,kBAAA;EAAA,SACD,IAAA;EAAA,SACA,QAAQ;AAAA;;;;;;;;;;;;;;KAgBP,wBAAA;EAAA,SACD,KAAA,EAAO,kBAAA;EAAA,SACP,KAAA,EAAO,kBAAA;EAAA,SACP,KAAA;EAAA,SACA,OAAA,EAAS,mBAAA;EAAA,SACT,KAAA,EAAO,eAAA;EAAA,SACP,MAAA,GAAS,WAAA;AAAA;;;;;;;;;AAkBsB;AAiB1C;;;;KAnBY,qBAAA,GAAwB,wBAAA;EAAA,SACzB,SAAA;EAAA,SACA,QAAA,EAAU,aAAA,CAAc,OAAA;AAAA;;;;;;;;;;AAgCK;;;;;KAf5B,qBAAA,GAAwB,qBAAA;EAAA,SACzB,IAAA;IAAA,SACE,IAAA;IAAA,SACA,WAAA;;;;;;;;;;aAUA,IAAA,GAAO,QAAA;EAAA;EAAA,SAET,OAAA,EAAS,oBAAA;AAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region ../../@warlock.js/ai/src/contracts/middleware/middleware-state.type.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Per-execution shared-state bag threaded through every middleware
|
|
4
|
+
* hook of every level (`execute`, `trip`, `tool`) for a single
|
|
5
|
+
* `agent.execute()` call.
|
|
6
|
+
*
|
|
7
|
+
* **Role.** Lets a single middleware accumulate state across hooks
|
|
8
|
+
* and across levels without relying on closure capture (which would
|
|
9
|
+
* leak between concurrent `execute()` calls on the same agent). Each
|
|
10
|
+
* middleware namespaces its reads/writes by its own `name` — the
|
|
11
|
+
* pipeline never inspects values.
|
|
12
|
+
*
|
|
13
|
+
* A fresh `Map` is constructed at `execute.before`-time and the same
|
|
14
|
+
* reference flows through every nested `trip` and `tool` hook, then
|
|
15
|
+
* is discarded at `execute.after` / `execute.onError`. Two concurrent
|
|
16
|
+
* executions of the same agent therefore get isolated bags.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Inside a budget middleware:
|
|
20
|
+
* execute: {
|
|
21
|
+
* before(ctx) { ctx.state.set("budget.tokensUsed", 0); },
|
|
22
|
+
* },
|
|
23
|
+
* trip: {
|
|
24
|
+
* after(ctx, response) {
|
|
25
|
+
* const used = (ctx.state.get("budget.tokensUsed") as number) + response.usage.total;
|
|
26
|
+
* ctx.state.set("budget.tokensUsed", used);
|
|
27
|
+
* if (used > max) throw new BudgetExceededError(...);
|
|
28
|
+
* },
|
|
29
|
+
* },
|
|
30
|
+
*/
|
|
31
|
+
type MiddlewareState = Map<string, unknown>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { MiddlewareState };
|
|
34
|
+
//# sourceMappingURL=middleware-state.type.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware-state.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/contracts/middleware/middleware-state.type.ts"],"mappings":";;AA6BA;;;;AAAiC;;;;;;;;;;;;;;;;;;;;;;;;KAArB,eAAA,GAAkB,GAAG"}
|