@warlock.js/ai 4.4.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -52
- package/cjs/index.cjs +240 -14147
- package/cjs/src-Bmajk4Qg.cjs +30 -0
- package/cjs/src-OZyDYHxm.cjs +25089 -0
- package/cjs/src-OZyDYHxm.cjs.map +1 -0
- package/esm/agent/agent-config.type.d.mts +119 -1
- package/esm/agent/agent-config.type.d.mts.map +1 -1
- package/esm/agent/agent-input-builder.mjs +27 -6
- package/esm/agent/agent-input-builder.mjs.map +1 -1
- package/esm/agent/agent.d.mts +40 -1
- package/esm/agent/agent.d.mts.map +1 -1
- package/esm/agent/agent.mjs +328 -36
- package/esm/agent/agent.mjs.map +1 -1
- package/esm/agent/index.d.mts +2 -1
- package/esm/agent/index.mjs +1 -0
- package/esm/agent/judge-config.type.d.mts +33 -0
- package/esm/agent/judge-config.type.d.mts.map +1 -0
- package/esm/agent/judge-config.type.mjs +13 -0
- package/esm/agent/judge-config.type.mjs.map +1 -0
- package/esm/agent/signature.mjs +57 -0
- package/esm/agent/signature.mjs.map +1 -0
- package/esm/agent/snapshot.mjs +101 -0
- package/esm/agent/snapshot.mjs.map +1 -0
- package/esm/ai-openai/src/embedder.mjs +4 -0
- package/esm/ai-openai/src/image.mjs +5 -0
- package/esm/ai-openai/src/index.mjs +7 -0
- package/esm/ai-openai/src/model.mjs +5 -0
- package/esm/ai-openai/src/sdk.mjs +9 -0
- package/esm/ai-openai/src/speech.mjs +5 -0
- package/esm/ai-openai/src/transcription.mjs +6 -0
- package/esm/ai-openai/src/utils/index.mjs +5 -0
- package/esm/ai-openai/src/utils/to-openai-messages.mjs +3 -0
- package/esm/ai-openai/src/utils/to-openai-tools.mjs +3 -0
- package/esm/ai-openai/src/utils/wrap-openai-error.mjs +4 -0
- package/esm/ai.d.mts +164 -53
- package/esm/ai.d.mts.map +1 -1
- package/esm/ai.mjs +79 -8
- package/esm/ai.mjs.map +1 -1
- package/esm/batch/batch.d.mts.map +1 -1
- package/esm/batch/batch.mjs +21 -1
- package/esm/batch/batch.mjs.map +1 -1
- package/esm/batch/batch.type.d.mts +11 -4
- package/esm/batch/batch.type.d.mts.map +1 -1
- package/esm/config.d.mts +39 -3
- package/esm/config.d.mts.map +1 -1
- package/esm/config.mjs +26 -2
- package/esm/config.mjs.map +1 -1
- package/esm/contracts/agent/agent-options.type.d.mts +33 -5
- package/esm/contracts/agent/agent-options.type.d.mts.map +1 -1
- package/esm/contracts/agent/agent-snapshot.type.d.mts +90 -0
- package/esm/contracts/agent/agent-snapshot.type.d.mts.map +1 -0
- package/esm/contracts/agent/agent.contract.d.mts +29 -1
- package/esm/contracts/agent/agent.contract.d.mts.map +1 -1
- package/esm/contracts/agent/eval.type.d.mts +43 -2
- package/esm/contracts/agent/eval.type.d.mts.map +1 -1
- package/esm/contracts/agent/index.d.mts +2 -1
- package/esm/contracts/attachment-policy.type.d.mts +51 -0
- package/esm/contracts/attachment-policy.type.d.mts.map +1 -0
- package/esm/contracts/attachment.type.d.mts +16 -7
- package/esm/contracts/attachment.type.d.mts.map +1 -1
- package/esm/contracts/content-part.type.d.mts +14 -5
- package/esm/contracts/content-part.type.d.mts.map +1 -1
- package/esm/contracts/events/supervisor-events.type.d.mts.map +1 -1
- package/esm/contracts/image-model.contract.d.mts +156 -0
- package/esm/contracts/image-model.contract.d.mts.map +1 -0
- package/esm/contracts/index.d.mts +13 -6
- package/esm/contracts/model.contract.d.mts +11 -8
- package/esm/contracts/model.contract.d.mts.map +1 -1
- package/esm/contracts/orchestrator/index.d.mts +1 -0
- package/esm/contracts/orchestrator/orchestrator-config.type.d.mts +31 -2
- package/esm/contracts/orchestrator/orchestrator-config.type.d.mts.map +1 -1
- package/esm/contracts/orchestrator/session-lock.contract.d.mts +47 -0
- package/esm/contracts/orchestrator/session-lock.contract.d.mts.map +1 -0
- package/esm/contracts/planner/index.d.mts +3 -2
- package/esm/contracts/planner/planner-config.type.d.mts +61 -0
- package/esm/contracts/planner/planner-config.type.d.mts.map +1 -1
- package/esm/contracts/planner/planner-execute-options.type.d.mts +60 -1
- package/esm/contracts/planner/planner-execute-options.type.d.mts.map +1 -1
- package/esm/contracts/planner/planner-result.type.d.mts +8 -0
- package/esm/contracts/planner/planner-result.type.d.mts.map +1 -1
- package/esm/contracts/planner/planner-snapshot.type.d.mts +77 -0
- package/esm/contracts/planner/planner-snapshot.type.d.mts.map +1 -0
- package/esm/contracts/planner/planner.contract.d.mts +21 -1
- package/esm/contracts/planner/planner.contract.d.mts.map +1 -1
- package/esm/contracts/result/agent-result.type.d.mts +6 -4
- package/esm/contracts/result/agent-result.type.d.mts.map +1 -1
- package/esm/contracts/result/base-report.type.d.mts +21 -3
- package/esm/contracts/result/base-report.type.d.mts.map +1 -1
- package/esm/contracts/result/base-report.type.mjs.map +1 -1
- package/esm/contracts/result/execution-report.type.d.mts +53 -1
- package/esm/contracts/result/execution-report.type.d.mts.map +1 -1
- package/esm/contracts/result/supervisor-result.type.d.mts +14 -2
- package/esm/contracts/result/supervisor-result.type.d.mts.map +1 -1
- package/esm/contracts/result/workflow-result.type.d.mts +2 -1
- package/esm/contracts/result/workflow-result.type.d.mts.map +1 -1
- package/esm/contracts/sdk-adapter.contract.d.mts +37 -0
- package/esm/contracts/sdk-adapter.contract.d.mts.map +1 -1
- package/esm/contracts/speech-model.contract.d.mts +97 -0
- package/esm/contracts/speech-model.contract.d.mts.map +1 -0
- package/esm/contracts/supervisor/supervisor-config.type.d.mts +29 -0
- package/esm/contracts/supervisor/supervisor-config.type.d.mts.map +1 -1
- package/esm/contracts/system-prompt.contract.d.mts +103 -1
- package/esm/contracts/system-prompt.contract.d.mts.map +1 -1
- package/esm/contracts/team/index.d.mts +1 -0
- package/esm/contracts/team/team-config.type.d.mts +127 -0
- package/esm/contracts/team/team-config.type.d.mts.map +1 -0
- package/esm/contracts/tool.contract.d.mts +4 -2
- package/esm/contracts/tool.contract.d.mts.map +1 -1
- package/esm/contracts/transcription-model.contract.d.mts +101 -0
- package/esm/contracts/transcription-model.contract.d.mts.map +1 -0
- package/esm/contracts/workflow/step.contract.d.mts +30 -5
- package/esm/contracts/workflow/step.contract.d.mts.map +1 -1
- package/esm/contracts/workflow/workflow.contract.d.mts +16 -0
- package/esm/contracts/workflow/workflow.contract.d.mts.map +1 -1
- package/esm/errors/agent-drift-error.d.mts +32 -0
- package/esm/errors/agent-drift-error.d.mts.map +1 -0
- package/esm/errors/agent-drift-error.mjs +31 -0
- package/esm/errors/agent-drift-error.mjs.map +1 -0
- package/esm/errors/error-code.type.d.mts +1 -1
- package/esm/errors/index.d.mts +3 -0
- package/esm/errors/index.mjs +3 -0
- package/esm/errors/outbound-policy-error.d.mts +27 -0
- package/esm/errors/outbound-policy-error.d.mts.map +1 -0
- package/esm/errors/outbound-policy-error.mjs +32 -0
- package/esm/errors/outbound-policy-error.mjs.map +1 -0
- package/esm/errors/planner-drift-error.d.mts +34 -0
- package/esm/errors/planner-drift-error.d.mts.map +1 -0
- package/esm/errors/planner-drift-error.mjs +33 -0
- package/esm/errors/planner-drift-error.mjs.map +1 -0
- package/esm/eval/dataset.d.mts +28 -0
- package/esm/eval/dataset.d.mts.map +1 -0
- package/esm/eval/dataset.mjs +112 -0
- package/esm/eval/dataset.mjs.map +1 -0
- package/esm/eval/dataset.type.d.mts +53 -0
- package/esm/eval/dataset.type.d.mts.map +1 -0
- package/esm/eval/eval-runner.d.mts.map +1 -1
- package/esm/eval/eval-runner.mjs +16 -2
- package/esm/eval/eval-runner.mjs.map +1 -1
- package/esm/eval/index.d.mts +20 -1
- package/esm/eval/index.d.mts.map +1 -1
- package/esm/eval/index.mjs +20 -2
- package/esm/eval/index.mjs.map +1 -1
- package/esm/eval/regression.d.mts +30 -0
- package/esm/eval/regression.d.mts.map +1 -0
- package/esm/eval/regression.mjs +51 -0
- package/esm/eval/regression.mjs.map +1 -0
- package/esm/eval/report-json.d.mts +30 -0
- package/esm/eval/report-json.d.mts.map +1 -0
- package/esm/eval/report-json.mjs +33 -0
- package/esm/eval/report-json.mjs.map +1 -0
- package/esm/eval/report-junit.d.mts +22 -0
- package/esm/eval/report-junit.d.mts.map +1 -0
- package/esm/eval/report-junit.mjs +60 -0
- package/esm/eval/report-junit.mjs.map +1 -0
- package/esm/guard/contracts/guard-options.type.d.mts +165 -0
- package/esm/guard/contracts/guard-options.type.d.mts.map +1 -0
- package/esm/guard/contracts/guardrail.contract.d.mts +78 -0
- package/esm/guard/contracts/guardrail.contract.d.mts.map +1 -0
- package/esm/guard/contracts/index.d.mts +4 -0
- package/esm/guard/contracts/openai-client.contract.d.mts +51 -0
- package/esm/guard/contracts/openai-client.contract.d.mts.map +1 -0
- package/esm/guard/contracts/verdict.type.d.mts +76 -0
- package/esm/guard/contracts/verdict.type.d.mts.map +1 -0
- package/esm/guard/detectors/index.d.mts +4 -0
- package/esm/guard/detectors/index.mjs +6 -0
- package/esm/guard/detectors/injection.d.mts +34 -0
- package/esm/guard/detectors/injection.d.mts.map +1 -0
- package/esm/guard/detectors/injection.mjs +254 -0
- package/esm/guard/detectors/injection.mjs.map +1 -0
- package/esm/guard/detectors/moderation.d.mts +32 -0
- package/esm/guard/detectors/moderation.d.mts.map +1 -0
- package/esm/guard/detectors/moderation.mjs +134 -0
- package/esm/guard/detectors/moderation.mjs.map +1 -0
- package/esm/guard/detectors/pii.d.mts +41 -0
- package/esm/guard/detectors/pii.d.mts.map +1 -0
- package/esm/guard/detectors/pii.mjs +199 -0
- package/esm/guard/detectors/pii.mjs.map +1 -0
- package/esm/guard/detectors/topic.d.mts +29 -0
- package/esm/guard/detectors/topic.d.mts.map +1 -0
- package/esm/guard/detectors/topic.mjs +99 -0
- package/esm/guard/detectors/topic.mjs.map +1 -0
- package/esm/guard/errors.d.mts +12 -0
- package/esm/guard/errors.d.mts.map +1 -0
- package/esm/guard/errors.mjs +18 -0
- package/esm/guard/errors.mjs.map +1 -0
- package/esm/guard/guard.d.mts +67 -0
- package/esm/guard/guard.d.mts.map +1 -0
- package/esm/guard/guard.mjs +209 -0
- package/esm/guard/guard.mjs.map +1 -0
- package/esm/guard/guardrail.d.mts +39 -0
- package/esm/guard/guardrail.d.mts.map +1 -0
- package/esm/guard/guardrail.mjs +22 -0
- package/esm/guard/guardrail.mjs.map +1 -0
- package/esm/human/contracts/approval.type.d.mts +154 -0
- package/esm/human/contracts/approval.type.d.mts.map +1 -0
- package/esm/human/contracts/human-approval.type.d.mts +38 -0
- package/esm/human/contracts/human-approval.type.d.mts.map +1 -0
- package/esm/human/contracts/index.d.mts +4 -0
- package/esm/human/contracts/interrupt-store.contract.d.mts +112 -0
- package/esm/human/contracts/interrupt-store.contract.d.mts.map +1 -0
- package/esm/human/contracts/resume.type.d.mts +77 -0
- package/esm/human/contracts/resume.type.d.mts.map +1 -0
- package/esm/human/errors.d.mts +84 -0
- package/esm/human/errors.d.mts.map +1 -0
- package/esm/human/errors.mjs +60 -0
- package/esm/human/errors.mjs.map +1 -0
- package/esm/human/human-approval.d.mts +57 -0
- package/esm/human/human-approval.d.mts.map +1 -0
- package/esm/human/human-approval.mjs +170 -0
- package/esm/human/human-approval.mjs.map +1 -0
- package/esm/human/policy.d.mts +55 -0
- package/esm/human/policy.d.mts.map +1 -0
- package/esm/human/policy.mjs +67 -0
- package/esm/human/policy.mjs.map +1 -0
- package/esm/human/register.mjs +37 -0
- package/esm/human/register.mjs.map +1 -0
- package/esm/human/resume-seed.mjs +53 -0
- package/esm/human/resume-seed.mjs.map +1 -0
- package/esm/human/resume.d.mts +54 -0
- package/esm/human/resume.d.mts.map +1 -0
- package/esm/human/resume.mjs +121 -0
- package/esm/human/resume.mjs.map +1 -0
- package/esm/human/stores/index.mjs +5 -0
- package/esm/human/stores/memory.d.mts +30 -0
- package/esm/human/stores/memory.d.mts.map +1 -0
- package/esm/human/stores/memory.mjs +91 -0
- package/esm/human/stores/memory.mjs.map +1 -0
- package/esm/human/stores/pg.d.mts +59 -0
- package/esm/human/stores/pg.d.mts.map +1 -0
- package/esm/human/stores/pg.mjs +220 -0
- package/esm/human/stores/pg.mjs.map +1 -0
- package/esm/human/stores/redis.d.mts +56 -0
- package/esm/human/stores/redis.d.mts.map +1 -0
- package/esm/human/stores/redis.mjs +201 -0
- package/esm/human/stores/redis.mjs.map +1 -0
- package/esm/image/image-cost.d.mts +32 -0
- package/esm/image/image-cost.d.mts.map +1 -0
- package/esm/image/image-cost.mjs +55 -0
- package/esm/image/image-cost.mjs.map +1 -0
- package/esm/image/image.d.mts +92 -0
- package/esm/image/image.d.mts.map +1 -0
- package/esm/image/image.mjs +113 -0
- package/esm/image/image.mjs.map +1 -0
- package/esm/image/index.mjs +4 -0
- package/esm/index.d.mts +137 -24
- package/esm/index.mjs +101 -11
- package/esm/middleware/builtins/budget.mjs +6 -2
- package/esm/middleware/builtins/budget.mjs.map +1 -1
- package/esm/middleware/utils/extract-user-text.d.mts +8 -1
- package/esm/middleware/utils/extract-user-text.d.mts.map +1 -1
- package/esm/middleware/utils/extract-user-text.mjs +8 -1
- package/esm/middleware/utils/extract-user-text.mjs.map +1 -1
- package/esm/mock/index.d.mts +3 -0
- package/esm/mock/index.mjs +3 -0
- package/esm/mock/mock-config.type.d.mts +22 -0
- package/esm/mock/mock-config.type.d.mts.map +1 -1
- package/esm/mock/mock-image-model.d.mts +41 -0
- package/esm/mock/mock-image-model.d.mts.map +1 -0
- package/esm/mock/mock-image-model.mjs +52 -0
- package/esm/mock/mock-image-model.mjs.map +1 -0
- package/esm/mock/mock-sdk.d.mts +7 -1
- package/esm/mock/mock-sdk.d.mts.map +1 -1
- package/esm/mock/mock-sdk.mjs +27 -0
- package/esm/mock/mock-sdk.mjs.map +1 -1
- package/esm/mock/mock-speech-model.d.mts +31 -0
- package/esm/mock/mock-speech-model.d.mts.map +1 -0
- package/esm/mock/mock-speech-model.mjs +39 -0
- package/esm/mock/mock-speech-model.mjs.map +1 -0
- package/esm/mock/mock-transcription-model.d.mts +32 -0
- package/esm/mock/mock-transcription-model.d.mts.map +1 -0
- package/esm/mock/mock-transcription-model.mjs +36 -0
- package/esm/mock/mock-transcription-model.mjs.map +1 -0
- package/esm/object-stream/index.d.mts +2 -0
- package/esm/object-stream/index.mjs +4 -0
- package/esm/object-stream/parse-partial-json.d.mts +22 -0
- package/esm/object-stream/parse-partial-json.d.mts.map +1 -0
- package/esm/object-stream/parse-partial-json.mjs +78 -0
- package/esm/object-stream/parse-partial-json.mjs.map +1 -0
- package/esm/object-stream/stream-object.d.mts +68 -0
- package/esm/object-stream/stream-object.d.mts.map +1 -0
- package/esm/object-stream/stream-object.mjs +104 -0
- package/esm/object-stream/stream-object.mjs.map +1 -0
- package/esm/observe/index.mjs +4 -0
- package/esm/observe/observer-registry.d.mts +30 -0
- package/esm/observe/observer-registry.d.mts.map +1 -0
- package/esm/observe/observer-registry.mjs +51 -0
- package/esm/observe/observer-registry.mjs.map +1 -0
- package/esm/observe/observer.contract.d.mts +40 -0
- package/esm/observe/observer.contract.d.mts.map +1 -0
- package/esm/observe/resolve-observers.d.mts +40 -0
- package/esm/observe/resolve-observers.d.mts.map +1 -0
- package/esm/observe/resolve-observers.mjs +73 -0
- package/esm/observe/resolve-observers.mjs.map +1 -0
- package/esm/orchestrator/execution.d.mts.map +1 -1
- package/esm/orchestrator/execution.mjs +5 -2
- package/esm/orchestrator/execution.mjs.map +1 -1
- package/esm/orchestrator/index.d.mts +1 -0
- package/esm/orchestrator/index.mjs +1 -0
- package/esm/orchestrator/orchestrator.d.mts.map +1 -1
- package/esm/orchestrator/orchestrator.mjs +39 -6
- package/esm/orchestrator/orchestrator.mjs.map +1 -1
- package/esm/orchestrator/session-lock.d.mts +25 -0
- package/esm/orchestrator/session-lock.d.mts.map +1 -0
- package/esm/orchestrator/session-lock.mjs +83 -0
- package/esm/orchestrator/session-lock.mjs.map +1 -0
- package/esm/planner/dag-scheduler.mjs +97 -0
- package/esm/planner/dag-scheduler.mjs.map +1 -0
- package/esm/planner/plan-prompt.d.mts +1 -1
- package/esm/planner/plan-prompt.d.mts.map +1 -1
- package/esm/planner/plan-prompt.mjs +2 -1
- package/esm/planner/plan-prompt.mjs.map +1 -1
- package/esm/planner/planner-run.d.mts +8 -0
- package/esm/planner/planner-run.d.mts.map +1 -1
- package/esm/planner/planner-run.mjs +457 -31
- package/esm/planner/planner-run.mjs.map +1 -1
- package/esm/planner/planner.d.mts.map +1 -1
- package/esm/planner/planner.mjs +26 -2
- package/esm/planner/planner.mjs.map +1 -1
- package/esm/planner/snapshot.mjs +95 -0
- package/esm/planner/snapshot.mjs.map +1 -0
- package/esm/prompt/errors.d.mts +57 -0
- package/esm/prompt/errors.d.mts.map +1 -0
- package/esm/prompt/errors.mjs +73 -0
- package/esm/prompt/errors.mjs.map +1 -0
- package/esm/prompt/index.d.mts +3 -0
- package/esm/prompt/index.mjs +4 -0
- package/esm/prompt/prompt-langfuse-sync.mjs +104 -0
- package/esm/prompt/prompt-langfuse-sync.mjs.map +1 -0
- package/esm/prompt/prompt-langfuse-sync.type.d.mts +32 -0
- package/esm/prompt/prompt-langfuse-sync.type.d.mts.map +1 -0
- package/esm/prompt/prompt-validate.mjs +170 -0
- package/esm/prompt/prompt-validate.mjs.map +1 -0
- package/esm/prompt/prompt.d.mts +54 -0
- package/esm/prompt/prompt.d.mts.map +1 -0
- package/esm/prompt/prompt.mjs +218 -0
- package/esm/prompt/prompt.mjs.map +1 -0
- package/esm/prompt/prompt.type.d.mts +174 -0
- package/esm/prompt/prompt.type.d.mts.map +1 -0
- package/esm/prompts/index.d.mts +3 -0
- package/esm/prompts/index.mjs +3 -0
- package/esm/prompts/prompts-manager.contract.d.mts +154 -0
- package/esm/prompts/prompts-manager.contract.d.mts.map +1 -0
- package/esm/prompts/prompts-manager.d.mts +38 -0
- package/esm/prompts/prompts-manager.d.mts.map +1 -0
- package/esm/prompts/prompts-manager.mjs +410 -0
- package/esm/prompts/prompts-manager.mjs.map +1 -0
- package/esm/prompts/prompts-manager.type.d.mts +172 -0
- package/esm/prompts/prompts-manager.type.d.mts.map +1 -0
- package/esm/prompts/prompts-validate.mjs +200 -0
- package/esm/prompts/prompts-validate.mjs.map +1 -0
- package/esm/rag/as-tool.mjs +48 -0
- package/esm/rag/as-tool.mjs.map +1 -0
- package/esm/rag/chunk/chunk.d.mts +24 -0
- package/esm/rag/chunk/chunk.d.mts.map +1 -0
- package/esm/rag/chunk/chunk.mjs +44 -0
- package/esm/rag/chunk/chunk.mjs.map +1 -0
- package/esm/rag/chunk/fixed.mjs +32 -0
- package/esm/rag/chunk/fixed.mjs.map +1 -0
- package/esm/rag/chunk/markdown.mjs +75 -0
- package/esm/rag/chunk/markdown.mjs.map +1 -0
- package/esm/rag/chunk/recursive.mjs +132 -0
- package/esm/rag/chunk/recursive.mjs.map +1 -0
- package/esm/rag/chunk/sentence.mjs +73 -0
- package/esm/rag/chunk/sentence.mjs.map +1 -0
- package/esm/rag/contracts/chunk-options.type.d.mts +35 -0
- package/esm/rag/contracts/chunk-options.type.d.mts.map +1 -0
- package/esm/rag/contracts/citation.type.d.mts +35 -0
- package/esm/rag/contracts/citation.type.d.mts.map +1 -0
- package/esm/rag/contracts/index.d.mts +4 -0
- package/esm/rag/contracts/rag-config.type.d.mts +68 -0
- package/esm/rag/contracts/rag-config.type.d.mts.map +1 -0
- package/esm/rag/contracts/rag-document.type.d.mts +21 -0
- package/esm/rag/contracts/rag-document.type.d.mts.map +1 -0
- package/esm/rag/hybrid/bm25.d.mts +23 -0
- package/esm/rag/hybrid/bm25.d.mts.map +1 -0
- package/esm/rag/hybrid/bm25.mjs +51 -0
- package/esm/rag/hybrid/bm25.mjs.map +1 -0
- package/esm/rag/hybrid/hybrid-rank.d.mts +33 -0
- package/esm/rag/hybrid/hybrid-rank.d.mts.map +1 -0
- package/esm/rag/hybrid/hybrid-rank.mjs +29 -0
- package/esm/rag/hybrid/hybrid-rank.mjs.map +1 -0
- package/esm/rag/hybrid/rrf.d.mts +25 -0
- package/esm/rag/hybrid/rrf.d.mts.map +1 -0
- package/esm/rag/hybrid/rrf.mjs +30 -0
- package/esm/rag/hybrid/rrf.mjs.map +1 -0
- package/esm/rag/index.d.mts +22 -0
- package/esm/rag/index.mjs +18 -0
- package/esm/rag/loaders/errors.d.mts +19 -0
- package/esm/rag/loaders/errors.d.mts.map +1 -0
- package/esm/rag/loaders/errors.mjs +25 -0
- package/esm/rag/loaders/errors.mjs.map +1 -0
- package/esm/rag/loaders/index.mjs +7 -0
- package/esm/rag/loaders/load-html.d.mts +26 -0
- package/esm/rag/loaders/load-html.d.mts.map +1 -0
- package/esm/rag/loaders/load-html.mjs +138 -0
- package/esm/rag/loaders/load-html.mjs.map +1 -0
- package/esm/rag/loaders/load-pdf.d.mts +38 -0
- package/esm/rag/loaders/load-pdf.d.mts.map +1 -0
- package/esm/rag/loaders/load-pdf.mjs +150 -0
- package/esm/rag/loaders/load-pdf.mjs.map +1 -0
- package/esm/rag/loaders/load-text.d.mts +47 -0
- package/esm/rag/loaders/load-text.d.mts.map +1 -0
- package/esm/rag/loaders/load-text.mjs +60 -0
- package/esm/rag/loaders/load-text.mjs.map +1 -0
- package/esm/rag/loaders/load-web.d.mts +42 -0
- package/esm/rag/loaders/load-web.d.mts.map +1 -0
- package/esm/rag/loaders/load-web.mjs +89 -0
- package/esm/rag/loaders/load-web.mjs.map +1 -0
- package/esm/rag/loaders/loader.type.d.mts +89 -0
- package/esm/rag/loaders/loader.type.d.mts.map +1 -0
- package/esm/rag/rag.d.mts +38 -0
- package/esm/rag/rag.d.mts.map +1 -0
- package/esm/rag/rag.mjs +126 -0
- package/esm/rag/rag.mjs.map +1 -0
- package/esm/rag/rerank/keyword-reranker.d.mts +32 -0
- package/esm/rag/rerank/keyword-reranker.d.mts.map +1 -0
- package/esm/rag/rerank/keyword-reranker.mjs +58 -0
- package/esm/rag/rerank/keyword-reranker.mjs.map +1 -0
- package/esm/rag/rerank/llm-reranker.d.mts +36 -0
- package/esm/rag/rerank/llm-reranker.d.mts.map +1 -0
- package/esm/rag/rerank/llm-reranker.mjs +85 -0
- package/esm/rag/rerank/llm-reranker.mjs.map +1 -0
- package/esm/rag/rerank/reranker.contract.d.mts +28 -0
- package/esm/rag/rerank/reranker.contract.d.mts.map +1 -0
- package/esm/rag/retrieve.mjs +68 -0
- package/esm/rag/retrieve.mjs.map +1 -0
- package/esm/rag/store/cache-vector-store.d.mts +27 -0
- package/esm/rag/store/cache-vector-store.d.mts.map +1 -0
- package/esm/rag/store/cache-vector-store.mjs +48 -0
- package/esm/rag/store/cache-vector-store.mjs.map +1 -0
- package/esm/rag/store/pg-vector-store.d.mts +139 -0
- package/esm/rag/store/pg-vector-store.d.mts.map +1 -0
- package/esm/rag/store/pg-vector-store.mjs +328 -0
- package/esm/rag/store/pg-vector-store.mjs.map +1 -0
- package/esm/rag/store/vector-store.contract.d.mts +38 -0
- package/esm/rag/store/vector-store.contract.d.mts.map +1 -0
- package/esm/rag/transforms/multi-query.d.mts +27 -0
- package/esm/rag/transforms/multi-query.d.mts.map +1 -0
- package/esm/rag/transforms/multi-query.mjs +41 -0
- package/esm/rag/transforms/multi-query.mjs.map +1 -0
- package/esm/security/index.mjs +5 -0
- package/esm/security/outbound-policy.d.mts +46 -0
- package/esm/security/outbound-policy.d.mts.map +1 -0
- package/esm/security/outbound-policy.mjs +187 -0
- package/esm/security/outbound-policy.mjs.map +1 -0
- package/esm/security/outbound-policy.type.d.mts +74 -0
- package/esm/security/outbound-policy.type.d.mts.map +1 -0
- package/esm/security/private-ip.d.mts +15 -0
- package/esm/security/private-ip.d.mts.map +1 -0
- package/esm/security/private-ip.mjs +48 -0
- package/esm/security/private-ip.mjs.map +1 -0
- package/esm/security/redact.d.mts +59 -0
- package/esm/security/redact.d.mts.map +1 -0
- package/esm/security/redact.mjs +122 -0
- package/esm/security/redact.mjs.map +1 -0
- package/esm/serve/serve.d.mts +50 -0
- package/esm/serve/serve.d.mts.map +1 -0
- package/esm/serve/serve.mjs +90 -0
- package/esm/serve/serve.mjs.map +1 -0
- package/esm/serve/sse.d.mts +20 -0
- package/esm/serve/sse.d.mts.map +1 -0
- package/esm/serve/sse.mjs +25 -0
- package/esm/serve/sse.mjs.map +1 -0
- package/esm/serve/stream-to-sse.d.mts +29 -0
- package/esm/serve/stream-to-sse.d.mts.map +1 -0
- package/esm/serve/stream-to-sse.mjs +37 -0
- package/esm/serve/stream-to-sse.mjs.map +1 -0
- package/esm/skills/catalog.d.mts +49 -0
- package/esm/skills/catalog.d.mts.map +1 -0
- package/esm/skills/catalog.mjs +140 -0
- package/esm/skills/catalog.mjs.map +1 -0
- package/esm/skills/contracts/skill-record.type.d.mts +37 -0
- package/esm/skills/contracts/skill-record.type.d.mts.map +1 -0
- package/esm/skills/contracts/skills-config.type.d.mts +108 -0
- package/esm/skills/contracts/skills-config.type.d.mts.map +1 -0
- package/esm/skills/contracts/skills-store.contract.d.mts +28 -0
- package/esm/skills/contracts/skills-store.contract.d.mts.map +1 -0
- package/esm/skills/contracts/skills.contract.d.mts +43 -0
- package/esm/skills/contracts/skills.contract.d.mts.map +1 -0
- package/esm/skills/index.d.mts +16 -0
- package/esm/skills/index.mjs +14 -0
- package/esm/skills/load-skill-tool.d.mts +38 -0
- package/esm/skills/load-skill-tool.d.mts.map +1 -0
- package/esm/skills/load-skill-tool.mjs +65 -0
- package/esm/skills/load-skill-tool.mjs.map +1 -0
- package/esm/skills/review-gate.d.mts +33 -0
- package/esm/skills/review-gate.d.mts.map +1 -0
- package/esm/skills/review-gate.mjs +60 -0
- package/esm/skills/review-gate.mjs.map +1 -0
- package/esm/skills/save-skill-tool.d.mts +39 -0
- package/esm/skills/save-skill-tool.d.mts.map +1 -0
- package/esm/skills/save-skill-tool.mjs +65 -0
- package/esm/skills/save-skill-tool.mjs.map +1 -0
- package/esm/skills/skills.d.mts +33 -0
- package/esm/skills/skills.d.mts.map +1 -0
- package/esm/skills/skills.mjs +109 -0
- package/esm/skills/skills.mjs.map +1 -0
- package/esm/skills/sources/directory-source.d.mts +19 -0
- package/esm/skills/sources/directory-source.d.mts.map +1 -0
- package/esm/skills/sources/directory-source.mjs +108 -0
- package/esm/skills/sources/directory-source.mjs.map +1 -0
- package/esm/skills/sources/index.d.mts +18 -0
- package/esm/skills/sources/index.d.mts.map +1 -0
- package/esm/skills/sources/index.mjs +27 -0
- package/esm/skills/sources/index.mjs.map +1 -0
- package/esm/skills/sources/parse-frontmatter.d.mts +27 -0
- package/esm/skills/sources/parse-frontmatter.d.mts.map +1 -0
- package/esm/skills/sources/parse-frontmatter.mjs +46 -0
- package/esm/skills/sources/parse-frontmatter.mjs.map +1 -0
- package/esm/skills/sources/store-source.d.mts +14 -0
- package/esm/skills/sources/store-source.d.mts.map +1 -0
- package/esm/skills/sources/store-source.mjs +15 -0
- package/esm/skills/sources/store-source.mjs.map +1 -0
- package/esm/skills/sources/url-source.d.mts +29 -0
- package/esm/skills/sources/url-source.d.mts.map +1 -0
- package/esm/skills/sources/url-source.mjs +117 -0
- package/esm/skills/sources/url-source.mjs.map +1 -0
- package/esm/skills/store/mock-skills-store.d.mts +57 -0
- package/esm/skills/store/mock-skills-store.d.mts.map +1 -0
- package/esm/skills/store/mock-skills-store.mjs +100 -0
- package/esm/skills/store/mock-skills-store.mjs.map +1 -0
- package/esm/skills/store/procedural-skill-store.d.mts +30 -0
- package/esm/skills/store/procedural-skill-store.d.mts.map +1 -0
- package/esm/skills/store/procedural-skill-store.mjs +125 -0
- package/esm/skills/store/procedural-skill-store.mjs.map +1 -0
- package/esm/speech/index.mjs +3 -0
- package/esm/speech/speech.d.mts +65 -0
- package/esm/speech/speech.d.mts.map +1 -0
- package/esm/speech/speech.mjs +123 -0
- package/esm/speech/speech.mjs.map +1 -0
- package/esm/supervisor/as-tool.mjs +2 -2
- package/esm/supervisor/as-tool.mjs.map +1 -1
- package/esm/supervisor/entries.mjs +2 -2
- package/esm/supervisor/entries.mjs.map +1 -1
- package/esm/supervisor/execution.d.mts.map +1 -1
- package/esm/supervisor/execution.mjs +31 -28
- package/esm/supervisor/execution.mjs.map +1 -1
- package/esm/supervisor/supervisor.d.mts.map +1 -1
- package/esm/supervisor/supervisor.mjs +8 -3
- package/esm/supervisor/supervisor.mjs.map +1 -1
- package/esm/system-prompt/index.d.mts +4 -0
- package/esm/system-prompt/system-prompt.d.mts +68 -4
- package/esm/system-prompt/system-prompt.d.mts.map +1 -1
- package/esm/system-prompt/system-prompt.mjs +89 -5
- package/esm/system-prompt/system-prompt.mjs.map +1 -1
- package/esm/team/gates.mjs +48 -0
- package/esm/team/gates.mjs.map +1 -0
- package/esm/team/index.d.mts +1 -0
- package/esm/team/index.mjs +3 -0
- package/esm/team/team.d.mts +42 -0
- package/esm/team/team.d.mts.map +1 -0
- package/esm/team/team.mjs +94 -0
- package/esm/team/team.mjs.map +1 -0
- package/esm/tool/executable-as-tool.d.mts.map +1 -1
- package/esm/tool/executable-as-tool.mjs +2 -2
- package/esm/tool/executable-as-tool.mjs.map +1 -1
- package/esm/tool/tool.d.mts.map +1 -1
- package/esm/tool/tool.mjs +2 -2
- package/esm/tool/tool.mjs.map +1 -1
- package/esm/transcribe/audio-input.d.mts +47 -0
- package/esm/transcribe/audio-input.d.mts.map +1 -0
- package/esm/transcribe/audio-input.mjs +84 -0
- package/esm/transcribe/audio-input.mjs.map +1 -0
- package/esm/transcribe/index.mjs +4 -0
- package/esm/transcribe/transcribe.d.mts +64 -0
- package/esm/transcribe/transcribe.d.mts.map +1 -0
- package/esm/transcribe/transcribe.mjs +128 -0
- package/esm/transcribe/transcribe.mjs.map +1 -0
- package/esm/utils/compute-cost.d.mts +17 -1
- package/esm/utils/compute-cost.d.mts.map +1 -1
- package/esm/utils/compute-cost.mjs +26 -1
- package/esm/utils/compute-cost.mjs.map +1 -1
- package/esm/utils/extract-json-lenient.d.mts +42 -0
- package/esm/utils/extract-json-lenient.d.mts.map +1 -0
- package/esm/utils/extract-json-lenient.mjs +97 -0
- package/esm/utils/extract-json-lenient.mjs.map +1 -0
- package/esm/utils/index.d.mts +4 -2
- package/esm/utils/index.mjs +3 -1
- package/esm/utils/json-schema.d.mts +1 -1
- package/esm/utils/prepare-attachment-part.d.mts +10 -1
- package/esm/utils/prepare-attachment-part.d.mts.map +1 -1
- package/esm/utils/prepare-attachment-part.mjs +103 -11
- package/esm/utils/prepare-attachment-part.mjs.map +1 -1
- package/esm/utils/resolve-attachment.d.mts +4 -3
- package/esm/utils/resolve-attachment.d.mts.map +1 -1
- package/esm/utils/resolve-attachment.mjs +4 -3
- package/esm/utils/resolve-attachment.mjs.map +1 -1
- package/esm/utils/run-context.d.mts +94 -0
- package/esm/utils/run-context.d.mts.map +1 -0
- package/esm/utils/run-context.mjs +98 -0
- package/esm/utils/run-context.mjs.map +1 -0
- package/esm/vcr/cassette-io.mjs +57 -0
- package/esm/vcr/cassette-io.mjs.map +1 -0
- package/esm/vcr/errors.d.mts +42 -0
- package/esm/vcr/errors.d.mts.map +1 -0
- package/esm/vcr/errors.mjs +37 -0
- package/esm/vcr/errors.mjs.map +1 -0
- package/esm/vcr/hash-request.d.mts +28 -0
- package/esm/vcr/hash-request.d.mts.map +1 -0
- package/esm/vcr/hash-request.mjs +118 -0
- package/esm/vcr/hash-request.mjs.map +1 -0
- package/esm/vcr/index.d.mts +4 -0
- package/esm/vcr/index.mjs +5 -0
- package/esm/vcr/vcr.d.mts +32 -0
- package/esm/vcr/vcr.d.mts.map +1 -0
- package/esm/vcr/vcr.mjs +248 -0
- package/esm/vcr/vcr.mjs.map +1 -0
- package/esm/vcr/vcr.type.d.mts +118 -0
- package/esm/vcr/vcr.type.d.mts.map +1 -0
- package/esm/workflow/as-tool.mjs +2 -2
- package/esm/workflow/as-tool.mjs.map +1 -1
- package/esm/workflow/engine.mjs +1 -0
- package/esm/workflow/engine.mjs.map +1 -1
- package/esm/workflow/step-runner.mjs +19 -20
- package/esm/workflow/step-runner.mjs.map +1 -1
- package/esm/workflow/workflow.d.mts.map +1 -1
- package/esm/workflow/workflow.mjs +8 -3
- package/esm/workflow/workflow.mjs.map +1 -1
- package/llms-full.txt +2572 -204
- package/llms.txt +21 -4
- package/package.json +7 -3
- package/skills/README.md +44 -4
- package/skills/ai-dx-helpers/SKILL.md +2 -2
- package/skills/approve-tool-calls/SKILL.md +134 -0
- package/skills/attach-ai-middleware/SKILL.md +1 -1
- package/skills/detect-and-redact-pii/SKILL.md +104 -0
- package/skills/durable-agent-runs/SKILL.md +135 -0
- package/skills/durable-resume/SKILL.md +128 -0
- package/skills/escalate-block-to-human/SKILL.md +85 -0
- package/skills/eval-datasets-and-ci/SKILL.md +117 -0
- package/skills/generate-images/SKILL.md +138 -0
- package/skills/generate-speech/SKILL.md +139 -0
- package/skills/guard-input-output/SKILL.md +117 -0
- package/skills/manage-prompts/SKILL.md +186 -0
- package/skills/observe-ai-flows/SKILL.md +94 -0
- package/skills/rag-loaders-and-stores/SKILL.md +164 -0
- package/skills/record-replay-llm/SKILL.md +92 -0
- package/skills/run-ai-agent/SKILL.md +26 -1
- package/skills/run-ai-rag/SKILL.md +139 -0
- package/skills/run-ai-team/SKILL.md +107 -0
- package/skills/run-orchestrator/SKILL.md +2 -0
- package/skills/run-planner/SKILL.md +73 -8
- package/skills/run-supervisor/SKILL.md +20 -1
- package/skills/transcribe-audio/SKILL.md +157 -0
- package/skills/use-runtime-skills/SKILL.md +106 -0
- package/skills/write-system-prompt/SKILL.md +30 -1
- package/cjs/index.cjs.map +0 -1
- package/esm/contracts/result/index.d.mts +0 -15
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { AgentExecutionError } from "../errors/agent-execution-error.mjs";
|
|
2
|
+
import { AgentDriftError } from "../errors/agent-drift-error.mjs";
|
|
3
|
+
import "../errors/index.mjs";
|
|
4
|
+
import { resolveDefaultSnapshotStore } from "../config.mjs";
|
|
5
|
+
|
|
6
|
+
//#region ../@warlock.js/ai/src/agent/snapshot.ts
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the effective {@link SnapshotStore}: the agent's own
|
|
9
|
+
* `durable.store` wins; absent that, fall back to the global default
|
|
10
|
+
* set via `ai.config({ defaultSnapshotStore })`.
|
|
11
|
+
*
|
|
12
|
+
* The global default is typed for the supervisor snapshot shape, but
|
|
13
|
+
* every store impl keys purely by `runId` and round-trips whatever
|
|
14
|
+
* envelope it is handed — so it serves an `AgentSnapshot` just as well.
|
|
15
|
+
* The cast re-tags the shape at this single boundary (Option B); the
|
|
16
|
+
* agent only ever hands it an `AgentSnapshot`.
|
|
17
|
+
*/
|
|
18
|
+
function resolveSnapshotStore(durable) {
|
|
19
|
+
return durable?.store ?? resolveDefaultSnapshotStore();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Write the current run state to the resolved snapshot store. No-op
|
|
23
|
+
* (returns `{ ok: true }`) when neither `durable.store` nor the global
|
|
24
|
+
* `defaultSnapshotStore` is configured — the common non-durable path.
|
|
25
|
+
* Failures are returned as `{ ok: false }` rather than thrown so the
|
|
26
|
+
* engine can surface them via logs without aborting the run — a failed
|
|
27
|
+
* checkpoint loses resume-ability from that point but never breaks an
|
|
28
|
+
* otherwise-healthy run.
|
|
29
|
+
*/
|
|
30
|
+
async function persistAgentSnapshot(params) {
|
|
31
|
+
const store = resolveSnapshotStore(params.durable);
|
|
32
|
+
if (!store) return { ok: true };
|
|
33
|
+
const snapshot = {
|
|
34
|
+
runId: params.runId,
|
|
35
|
+
agentName: params.agentName,
|
|
36
|
+
signature: params.signature,
|
|
37
|
+
version: params.version,
|
|
38
|
+
input: params.input,
|
|
39
|
+
systemPrompt: params.systemPrompt,
|
|
40
|
+
responseSchema: params.responseSchema,
|
|
41
|
+
promptName: params.promptName,
|
|
42
|
+
promptVersion: params.promptVersion,
|
|
43
|
+
messages: params.messages,
|
|
44
|
+
trips: params.trips,
|
|
45
|
+
toolCalls: params.toolCalls,
|
|
46
|
+
usage: params.usage,
|
|
47
|
+
status: params.status,
|
|
48
|
+
startedAt: params.startedAt,
|
|
49
|
+
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
await store.save(snapshot);
|
|
53
|
+
return { ok: true };
|
|
54
|
+
} catch (error) {
|
|
55
|
+
return {
|
|
56
|
+
ok: false,
|
|
57
|
+
error
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Delete a persisted snapshot — used after a successful run when
|
|
63
|
+
* `durable.deleteOnComplete` is set. Never throws: a failed delete is
|
|
64
|
+
* surfaced as `{ ok: false }` and the engine logs it. No-op (ok) when no
|
|
65
|
+
* store is configured.
|
|
66
|
+
*/
|
|
67
|
+
async function deleteAgentSnapshot(params) {
|
|
68
|
+
const store = resolveSnapshotStore(params.durable);
|
|
69
|
+
if (!store) return { ok: true };
|
|
70
|
+
try {
|
|
71
|
+
await store.delete(params.runId);
|
|
72
|
+
return { ok: true };
|
|
73
|
+
} catch (error) {
|
|
74
|
+
return {
|
|
75
|
+
ok: false,
|
|
76
|
+
error
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Load a persisted snapshot for `resume()` and run the drift check.
|
|
82
|
+
* Throws `AgentExecutionError` when no store is configured or when the
|
|
83
|
+
* run is missing; throws `AgentDriftError` when the stored signature
|
|
84
|
+
* doesn't match the current definition (unless `force` is set).
|
|
85
|
+
*/
|
|
86
|
+
async function loadAgentSnapshotForResume(params) {
|
|
87
|
+
const store = resolveSnapshotStore(params.durable);
|
|
88
|
+
if (!store) throw new AgentExecutionError(`agent "${params.agentName}" has no durable store configured — set \`durable: { store }\` on the config or call \`ai.config({ defaultSnapshotStore })\` at boot before calling resume()`, { context: { runId: params.runId } });
|
|
89
|
+
const snapshot = await store.load(params.runId) ?? null;
|
|
90
|
+
if (!snapshot) throw new AgentExecutionError(`agent "${params.agentName}": no snapshot for runId "${params.runId}"`, { context: { runId: params.runId } });
|
|
91
|
+
if (!params.options?.force && snapshot.signature !== params.signature) throw new AgentDriftError(`agent "${params.agentName}" signature drift on resume`, {
|
|
92
|
+
savedSignature: snapshot.signature,
|
|
93
|
+
currentSignature: params.signature,
|
|
94
|
+
runId: params.runId
|
|
95
|
+
});
|
|
96
|
+
return snapshot;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { deleteAgentSnapshot, loadAgentSnapshotForResume, persistAgentSnapshot };
|
|
101
|
+
//# sourceMappingURL=snapshot.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/agent/snapshot.ts"],"sourcesContent":["import { resolveDefaultSnapshotStore } from \"../config\";\nimport type {\n AgentResumeOptions,\n} from \"../contracts/agent/agent-options.type\";\nimport type {\n AgentSnapshot,\n AgentSnapshotStatus,\n} from \"../contracts/agent/agent-snapshot.type\";\nimport type { SnapshotStore } from \"../contracts/orchestrator/snapshot-store.contract\";\nimport type { Message } from \"../contracts/conversation-message.type\";\nimport type { LLMTrip } from \"../contracts/result/llm-trip.type\";\nimport type { ToolCall } from \"../contracts/result/tool-call.type\";\nimport type { Usage } from \"../contracts/result/usage.type\";\nimport { AgentDriftError, AgentExecutionError } from \"../errors\";\n\n/**\n * The agent's `durable` config, narrowed to the fields the snapshot\n * helpers read. Kept minimal so this module doesn't depend on the full\n * resolved-config shape.\n */\nexport type AgentDurableConfig = {\n store?: SnapshotStore<AgentSnapshot>;\n deleteOnComplete?: boolean;\n};\n\n/**\n * Resolve the effective {@link SnapshotStore}: the agent's own\n * `durable.store` wins; absent that, fall back to the global default\n * set via `ai.config({ defaultSnapshotStore })`.\n *\n * The global default is typed for the supervisor snapshot shape, but\n * every store impl keys purely by `runId` and round-trips whatever\n * envelope it is handed — so it serves an `AgentSnapshot` just as well.\n * The cast re-tags the shape at this single boundary (Option B); the\n * agent only ever hands it an `AgentSnapshot`.\n */\nfunction resolveSnapshotStore(\n durable: AgentDurableConfig | undefined,\n): SnapshotStore<AgentSnapshot> | undefined {\n return (\n durable?.store ??\n (resolveDefaultSnapshotStore() as SnapshotStore<AgentSnapshot> | undefined)\n );\n}\n\nexport type PersistAgentParams = {\n durable: AgentDurableConfig | undefined;\n runId: string;\n agentName: string;\n signature: string;\n version?: string;\n input: string;\n systemPrompt?: string;\n responseSchema?: Record<string, unknown>;\n promptName?: string;\n promptVersion?: string;\n messages: Message[];\n trips: LLMTrip[];\n toolCalls: ToolCall[];\n usage: Usage;\n status: AgentSnapshotStatus;\n startedAt: string;\n};\n\nexport type PersistOutcome = { ok: true } | { ok: false; error: unknown };\n\n/**\n * Write the current run state to the resolved snapshot store. No-op\n * (returns `{ ok: true }`) when neither `durable.store` nor the global\n * `defaultSnapshotStore` is configured — the common non-durable path.\n * Failures are returned as `{ ok: false }` rather than thrown so the\n * engine can surface them via logs without aborting the run — a failed\n * checkpoint loses resume-ability from that point but never breaks an\n * otherwise-healthy run.\n */\nexport async function persistAgentSnapshot(\n params: PersistAgentParams,\n): Promise<PersistOutcome> {\n const store = resolveSnapshotStore(params.durable);\n\n if (!store) {\n return { ok: true };\n }\n\n const snapshot: AgentSnapshot = {\n runId: params.runId,\n agentName: params.agentName,\n signature: params.signature,\n version: params.version,\n input: params.input,\n systemPrompt: params.systemPrompt,\n responseSchema: params.responseSchema,\n promptName: params.promptName,\n promptVersion: params.promptVersion,\n messages: params.messages,\n trips: params.trips,\n toolCalls: params.toolCalls,\n usage: params.usage,\n status: params.status,\n startedAt: params.startedAt,\n savedAt: new Date().toISOString(),\n };\n\n try {\n await store.save(snapshot);\n\n return { ok: true };\n } catch (error) {\n return { ok: false, error };\n }\n}\n\n/**\n * Delete a persisted snapshot — used after a successful run when\n * `durable.deleteOnComplete` is set. Never throws: a failed delete is\n * surfaced as `{ ok: false }` and the engine logs it. No-op (ok) when no\n * store is configured.\n */\nexport async function deleteAgentSnapshot(params: {\n durable: AgentDurableConfig | undefined;\n runId: string;\n}): Promise<PersistOutcome> {\n const store = resolveSnapshotStore(params.durable);\n\n if (!store) {\n return { ok: true };\n }\n\n try {\n await store.delete(params.runId);\n\n return { ok: true };\n } catch (error) {\n return { ok: false, error };\n }\n}\n\n/**\n * Load a persisted snapshot for `resume()` and run the drift check.\n * Throws `AgentExecutionError` when no store is configured or when the\n * run is missing; throws `AgentDriftError` when the stored signature\n * doesn't match the current definition (unless `force` is set).\n */\nexport async function loadAgentSnapshotForResume(params: {\n durable: AgentDurableConfig | undefined;\n agentName: string;\n signature: string;\n runId: string;\n options?: AgentResumeOptions<unknown>;\n}): Promise<AgentSnapshot> {\n const store = resolveSnapshotStore(params.durable);\n\n if (!store) {\n throw new AgentExecutionError(\n `agent \"${params.agentName}\" has no durable store configured — set \\`durable: { store }\\` on the config or call \\`ai.config({ defaultSnapshotStore })\\` at boot before calling resume()`,\n { context: { runId: params.runId } },\n );\n }\n\n const snapshot = (await store.load(params.runId)) ?? null;\n\n if (!snapshot) {\n throw new AgentExecutionError(\n `agent \"${params.agentName}\": no snapshot for runId \"${params.runId}\"`,\n { context: { runId: params.runId } },\n );\n }\n\n if (!params.options?.force && snapshot.signature !== params.signature) {\n throw new AgentDriftError(\n `agent \"${params.agentName}\" signature drift on resume`,\n {\n savedSignature: snapshot.signature,\n currentSignature: params.signature,\n runId: params.runId,\n },\n );\n }\n\n return snapshot;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,SAAS,qBACP,SAC0C;CAC1C,OACE,SAAS,SACR,4BAA4B;AAEjC;;;;;;;;;;AAgCA,eAAsB,qBACpB,QACyB;CACzB,MAAM,QAAQ,qBAAqB,OAAO,OAAO;CAEjD,IAAI,CAAC,OACH,OAAO,EAAE,IAAI,KAAK;CAGpB,MAAM,WAA0B;EAC9B,OAAO,OAAO;EACd,WAAW,OAAO;EAClB,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,OAAO,OAAO;EACd,cAAc,OAAO;EACrB,gBAAgB,OAAO;EACvB,YAAY,OAAO;EACnB,eAAe,OAAO;EACtB,UAAU,OAAO;EACjB,OAAO,OAAO;EACd,WAAW,OAAO;EAClB,OAAO,OAAO;EACd,QAAQ,OAAO;EACf,WAAW,OAAO;EAClB,0BAAS,IAAI,KAAK,EAAC,CAAC,YAAY;CAClC;CAEA,IAAI;EACF,MAAM,MAAM,KAAK,QAAQ;EAEzB,OAAO,EAAE,IAAI,KAAK;CACpB,SAAS,OAAO;EACd,OAAO;GAAE,IAAI;GAAO;EAAM;CAC5B;AACF;;;;;;;AAQA,eAAsB,oBAAoB,QAGd;CAC1B,MAAM,QAAQ,qBAAqB,OAAO,OAAO;CAEjD,IAAI,CAAC,OACH,OAAO,EAAE,IAAI,KAAK;CAGpB,IAAI;EACF,MAAM,MAAM,OAAO,OAAO,KAAK;EAE/B,OAAO,EAAE,IAAI,KAAK;CACpB,SAAS,OAAO;EACd,OAAO;GAAE,IAAI;GAAO;EAAM;CAC5B;AACF;;;;;;;AAQA,eAAsB,2BAA2B,QAMtB;CACzB,MAAM,QAAQ,qBAAqB,OAAO,OAAO;CAEjD,IAAI,CAAC,OACH,MAAM,IAAI,oBACR,UAAU,OAAO,UAAU,+JAC3B,EAAE,SAAS,EAAE,OAAO,OAAO,MAAM,EAAE,CACrC;CAGF,MAAM,WAAY,MAAM,MAAM,KAAK,OAAO,KAAK,KAAM;CAErD,IAAI,CAAC,UACH,MAAM,IAAI,oBACR,UAAU,OAAO,UAAU,4BAA4B,OAAO,MAAM,IACpE,EAAE,SAAS,EAAE,OAAO,OAAO,MAAM,EAAE,CACrC;CAGF,IAAI,CAAC,OAAO,SAAS,SAAS,SAAS,cAAc,OAAO,WAC1D,MAAM,IAAI,gBACR,UAAU,OAAO,UAAU,8BAC3B;EACE,gBAAgB,SAAS;EACzB,kBAAkB,OAAO;EACzB,OAAO,OAAO;CAChB,CACF;CAGF,OAAO;AACT"}
|
package/esm/ai.d.mts
CHANGED
|
@@ -2,16 +2,27 @@ import { tool } from "./tool/tool.mjs";
|
|
|
2
2
|
import { agent } from "./agent/agent.mjs";
|
|
3
3
|
import { budget, readBudgetFallbackSignal } from "./middleware/builtins/budget.mjs";
|
|
4
4
|
import { spawnSubAgent } from "./agent/spawn-sub-agent.mjs";
|
|
5
|
-
import { SystemPromptFactory } from "./system-prompt/system-prompt.mjs";
|
|
6
|
-
import { judge } from "./eval/judge-scorer.mjs";
|
|
7
|
-
import { contains, exact, predicate } from "./eval/scorers.mjs";
|
|
8
5
|
import { batch } from "./batch/batch.mjs";
|
|
6
|
+
import { streamObject } from "./object-stream/stream-object.mjs";
|
|
7
|
+
import { serve } from "./serve/serve.mjs";
|
|
9
8
|
import { memory } from "./checkpoint/memory.mjs";
|
|
10
9
|
import { pg } from "./checkpoint/pg.mjs";
|
|
11
10
|
import { redis } from "./checkpoint/redis.mjs";
|
|
12
11
|
import { setAIConfig } from "./config.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { dataset } from "./eval/dataset.mjs";
|
|
13
|
+
import { evalScorers } from "./eval/index.mjs";
|
|
14
|
+
import { humanApproval } from "./human/human-approval.mjs";
|
|
15
|
+
import { image } from "./image/image.mjs";
|
|
16
|
+
import { speech } from "./speech/speech.mjs";
|
|
17
|
+
import { audioFromBuffer, audioFromFile, audioMediaTypeForFilename } from "./transcribe/audio-input.mjs";
|
|
18
|
+
import { transcribe } from "./transcribe/transcribe.mjs";
|
|
19
|
+
import { resume } from "./human/resume.mjs";
|
|
20
|
+
import { memory as memory$1 } from "./human/stores/memory.mjs";
|
|
21
|
+
import { pg as pg$1 } from "./human/stores/pg.mjs";
|
|
22
|
+
import { redis as redis$1 } from "./human/stores/redis.mjs";
|
|
23
|
+
import { guardrail } from "./guard/guardrail.mjs";
|
|
24
|
+
import { memory as memory$2 } from "./memory/memory.mjs";
|
|
25
|
+
import { guardrail as guardrail$1 } from "./middleware/builtins/guardrail.mjs";
|
|
15
26
|
import { semanticCache } from "./middleware/builtins/semantic-cache.mjs";
|
|
16
27
|
import { composeMiddleware } from "./middleware/helpers/compose.mjs";
|
|
17
28
|
import { forTool } from "./middleware/helpers/for-tool.mjs";
|
|
@@ -19,18 +30,158 @@ import { mockRouter } from "./mock/mock-router.mjs";
|
|
|
19
30
|
import { fallbackModel } from "./model/fallback-model.mjs";
|
|
20
31
|
import { orchestrator } from "./orchestrator/orchestrator.mjs";
|
|
21
32
|
import { planner } from "./planner/planner.mjs";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
33
|
+
import { defaultPromptsManager } from "./prompts/prompts-manager.mjs";
|
|
34
|
+
import { rag } from "./rag/rag.mjs";
|
|
35
|
+
import { chunk } from "./rag/chunk/chunk.mjs";
|
|
36
|
+
import { cacheVectorStore } from "./rag/store/cache-vector-store.mjs";
|
|
37
|
+
import { pgVectorStore, vectorLiteral } from "./rag/store/pg-vector-store.mjs";
|
|
38
|
+
import { loadText } from "./rag/loaders/load-text.mjs";
|
|
39
|
+
import { loadHtml } from "./rag/loaders/load-html.mjs";
|
|
40
|
+
import { loadWeb } from "./rag/loaders/load-web.mjs";
|
|
41
|
+
import { loadPdf } from "./rag/loaders/load-pdf.mjs";
|
|
42
|
+
import { keywordReranker } from "./rag/rerank/keyword-reranker.mjs";
|
|
43
|
+
import { llmReranker } from "./rag/rerank/llm-reranker.mjs";
|
|
44
|
+
import { reciprocalRankFusion } from "./rag/hybrid/rrf.mjs";
|
|
45
|
+
import { bm25Rank } from "./rag/hybrid/bm25.mjs";
|
|
46
|
+
import { hybridRank } from "./rag/hybrid/hybrid-rank.mjs";
|
|
47
|
+
import { multiQuery } from "./rag/transforms/multi-query.mjs";
|
|
48
|
+
import { skills } from "./skills/skills.mjs";
|
|
49
|
+
import { systemPrompt } from "./system-prompt/system-prompt.mjs";
|
|
50
|
+
import { prompt } from "./prompt/prompt.mjs";
|
|
51
|
+
import { vcr } from "./vcr/vcr.mjs";
|
|
52
|
+
import { memory as memory$3 } from "./snapshot/memory.mjs";
|
|
53
|
+
import { pg as pg$2 } from "./snapshot/pg.mjs";
|
|
54
|
+
import { redis as redis$2 } from "./snapshot/redis.mjs";
|
|
25
55
|
import { fanOut } from "./supervisor/fan-out.mjs";
|
|
26
56
|
import { router } from "./supervisor/router-factory.mjs";
|
|
27
57
|
import { supervisor } from "./supervisor/supervisor.mjs";
|
|
58
|
+
import { team } from "./team/team.mjs";
|
|
28
59
|
import { instruction } from "./system-prompt/instruction.mjs";
|
|
29
60
|
import { persona } from "./system-prompt/persona.mjs";
|
|
30
61
|
import { step } from "./workflow/step.mjs";
|
|
31
62
|
import { workflow } from "./workflow/workflow.mjs";
|
|
32
63
|
|
|
33
64
|
//#region ../@warlock.js/ai/src/ai.d.ts
|
|
65
|
+
/**
|
|
66
|
+
* The shape of the top-level `ai` namespace. Declared as an `interface` (not an
|
|
67
|
+
* inferred `const` type) so satellite packages can attach their verb via
|
|
68
|
+
* `declare module "@warlock.js/ai" { interface Ai { … } }` — e.g. `ai.workspace`,
|
|
69
|
+
* `ai.tools`, `ai.mcp`, `ai.human`. The runtime object below is asserted to this
|
|
70
|
+
* type; a satellite assigns its member on import.
|
|
71
|
+
*/
|
|
72
|
+
interface Ai {
|
|
73
|
+
config: typeof setAIConfig;
|
|
74
|
+
tool: typeof tool;
|
|
75
|
+
agent: typeof agent;
|
|
76
|
+
systemPrompt: typeof systemPrompt;
|
|
77
|
+
persona: typeof persona;
|
|
78
|
+
instruction: typeof instruction;
|
|
79
|
+
workflow: typeof workflow;
|
|
80
|
+
step: typeof step;
|
|
81
|
+
supervisor: typeof supervisor;
|
|
82
|
+
team: typeof team;
|
|
83
|
+
orchestrator: typeof orchestrator;
|
|
84
|
+
memory: typeof memory$2;
|
|
85
|
+
skills: typeof skills;
|
|
86
|
+
planner: typeof planner;
|
|
87
|
+
rag: typeof rag & {
|
|
88
|
+
keywordReranker: typeof keywordReranker;
|
|
89
|
+
llmReranker: typeof llmReranker;
|
|
90
|
+
chunk: typeof chunk;
|
|
91
|
+
cacheVectorStore: typeof cacheVectorStore;
|
|
92
|
+
pgVectorStore: typeof pgVectorStore;
|
|
93
|
+
vectorLiteral: typeof vectorLiteral;
|
|
94
|
+
loadText: typeof loadText;
|
|
95
|
+
loadHtml: typeof loadHtml;
|
|
96
|
+
loadWeb: typeof loadWeb;
|
|
97
|
+
loadPdf: typeof loadPdf;
|
|
98
|
+
bm25Rank: typeof bm25Rank;
|
|
99
|
+
reciprocalRankFusion: typeof reciprocalRankFusion;
|
|
100
|
+
hybridRank: typeof hybridRank;
|
|
101
|
+
multiQuery: typeof multiQuery;
|
|
102
|
+
};
|
|
103
|
+
spawnSubAgent: typeof spawnSubAgent;
|
|
104
|
+
router: typeof router;
|
|
105
|
+
fanOut: typeof fanOut;
|
|
106
|
+
batch: typeof batch;
|
|
107
|
+
/** Structured-output streaming — partial-object snapshots + a strict final parse (A1). */
|
|
108
|
+
streamObject: typeof streamObject;
|
|
109
|
+
/** Serve an executable as an SSE HTTP endpoint — production serving primitive (A3). */
|
|
110
|
+
serve: typeof serve;
|
|
111
|
+
/**
|
|
112
|
+
* Generate images from a text prompt — the image-output verb of the
|
|
113
|
+
* output-modality track (Theme I). Wraps an `ImageModelContract` (from
|
|
114
|
+
* `openai.image(...)` / `google.image(...)`) in the uniform
|
|
115
|
+
* never-throws `{ data, error, usage, report }` envelope with cost-truth
|
|
116
|
+
* and observability.
|
|
117
|
+
*/
|
|
118
|
+
image: typeof image;
|
|
119
|
+
/** Text-to-speech (TTS) — the audio-output verb of the modality track (Theme I). */
|
|
120
|
+
speech: typeof speech;
|
|
121
|
+
/** Speech-to-text (STT / transcription) — the audio-input verb of the modality track (Theme I). */
|
|
122
|
+
transcribe: typeof transcribe;
|
|
123
|
+
/** Read an audio file from disk → `AudioInput` for `ai.transcribe` (non-AI file plumbing). */
|
|
124
|
+
audioFromFile: typeof audioFromFile;
|
|
125
|
+
/** Package raw audio bytes → `AudioInput` for `ai.transcribe`. */
|
|
126
|
+
audioFromBuffer: typeof audioFromBuffer;
|
|
127
|
+
/** Resolve the audio media type from a filename's extension. */
|
|
128
|
+
audioMediaTypeForFilename: typeof audioMediaTypeForFilename;
|
|
129
|
+
fallbackModel: typeof fallbackModel;
|
|
130
|
+
eval: typeof evalScorers;
|
|
131
|
+
dataset: typeof dataset;
|
|
132
|
+
prompt: typeof prompt;
|
|
133
|
+
/**
|
|
134
|
+
* Process-wide registry of named, versioned `systemPrompt(...)` builders,
|
|
135
|
+
* keyed by `name@version`. A `systemPrompt(input, { name })` (or any
|
|
136
|
+
* `.meta({ name })` rename) auto-registers here; `ai.prompts.get(name)` /
|
|
137
|
+
* `.resolve(name)` reads them back, and `systemPrompt().merge(name)` folds a
|
|
138
|
+
* registered prompt into a new one.
|
|
139
|
+
*/
|
|
140
|
+
prompts: ReturnType<typeof defaultPromptsManager>;
|
|
141
|
+
vcr: typeof vcr;
|
|
142
|
+
mockRouter: typeof mockRouter;
|
|
143
|
+
middleware: {
|
|
144
|
+
budget: typeof budget;
|
|
145
|
+
guardrail: typeof guardrail$1;
|
|
146
|
+
semanticCache: typeof semanticCache;
|
|
147
|
+
compose: typeof composeMiddleware;
|
|
148
|
+
forTool: typeof forTool;
|
|
149
|
+
readBudgetFallbackSignal: typeof readBudgetFallbackSignal;
|
|
150
|
+
};
|
|
151
|
+
checkpoint: {
|
|
152
|
+
memory: typeof memory;
|
|
153
|
+
pg: typeof pg;
|
|
154
|
+
redis: typeof redis;
|
|
155
|
+
};
|
|
156
|
+
snapshot: {
|
|
157
|
+
memory: typeof memory$3;
|
|
158
|
+
pg: typeof pg$2;
|
|
159
|
+
redis: typeof redis$2;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Human-in-the-loop tool approval (interrupt / resume).
|
|
163
|
+
*
|
|
164
|
+
* - `human.approval(options)` — the `tool.before` approval-gate middleware.
|
|
165
|
+
* - `human.resume(id, decision, options)` — out-of-process durable resume.
|
|
166
|
+
* - `human.interrupt.{memory,pg,redis}()` — durable {@link InterruptStore}
|
|
167
|
+
* factories (memory ships real; pg/redis are lazy optional peers).
|
|
168
|
+
*/
|
|
169
|
+
human: {
|
|
170
|
+
approval: typeof humanApproval;
|
|
171
|
+
resume: typeof resume;
|
|
172
|
+
interrupt: {
|
|
173
|
+
memory: typeof memory$1;
|
|
174
|
+
pg: typeof pg$1;
|
|
175
|
+
redis: typeof redis$1;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Content-intelligence guardrail. `ai.guardrail(options)` builds a composed
|
|
180
|
+
* input / output / tool middleware; `ai.guardrail.{pii,topic,injection,moderation}`
|
|
181
|
+
* are the built-in detector factories.
|
|
182
|
+
*/
|
|
183
|
+
guardrail: typeof guardrail;
|
|
184
|
+
}
|
|
34
185
|
/**
|
|
35
186
|
* Top-level `ai` namespace — holds built-in factories and user-registered SDK adapters.
|
|
36
187
|
*
|
|
@@ -42,6 +193,7 @@ import { workflow } from "./workflow/workflow.mjs";
|
|
|
42
193
|
* - `ai.instruction(text)` — reusable instruction block (can be passed to `systemPrompt`).
|
|
43
194
|
* - `ai.orchestrator(...)` — session-state manager wrapped around a supervisor (durable session, drift detection, resume, commands).
|
|
44
195
|
* - `ai.memory(...)` — build an agent-memory store with WORKING (in-run scratch) and SEMANTIC (cache-driver `.similar()` recall) tiers.
|
|
196
|
+
* - `ai.skills(...)` — build a runtime skills library (always-injected metadata catalog + on-demand loadSkill tool).
|
|
45
197
|
* - `ai.planner(...)` — build an executable that generates an ordered plan over registered capabilities, then runs it step-by-step.
|
|
46
198
|
* - `ai.spawnSubAgent(spec)` — thin wrapper that builds a fresh one-shot `agent()` with an optional per-task `budget` and runs the task once. A general primitive (not planner-specific).
|
|
47
199
|
* - `ai.router(...)` — build a supervisor-compatible routing agent from named intents.
|
|
@@ -52,6 +204,8 @@ import { workflow } from "./workflow/workflow.mjs";
|
|
|
52
204
|
* - `ai.mockRouter(decisions, opts?)` — deterministic supervisor `route` callback for tests.
|
|
53
205
|
* - `ai.checkpoint.{memory,pg,redis}()` — durable orchestrator session checkpoint stores.
|
|
54
206
|
* - `ai.snapshot.{memory,pg,redis}()` — supervisor-run snapshot stores for `iterate: true` resume.
|
|
207
|
+
* - `ai.human.approval(...)` / `ai.human.resume(...)` / `ai.human.interrupt.{memory,pg,redis}()` — human-in-the-loop tool approval (interrupt / resume).
|
|
208
|
+
* - `ai.guardrail(options)` + `ai.guardrail.{pii,topic,injection,moderation}(...)` — content-intelligence guardrails (moderation / PII / injection / topic).
|
|
55
209
|
* - `ai.openai.model(...)` / `ai.anthropic.model(...)` / ... once the adapter SDK is registered.
|
|
56
210
|
*
|
|
57
211
|
* @example
|
|
@@ -70,50 +224,7 @@ import { workflow } from "./workflow/workflow.mjs";
|
|
|
70
224
|
* placeholders: { language: "Arabic" },
|
|
71
225
|
* });
|
|
72
226
|
*/
|
|
73
|
-
declare const ai:
|
|
74
|
-
config: typeof setAIConfig;
|
|
75
|
-
tool: typeof tool;
|
|
76
|
-
agent: typeof agent;
|
|
77
|
-
systemPrompt: SystemPromptFactory;
|
|
78
|
-
persona: typeof persona;
|
|
79
|
-
instruction: typeof instruction;
|
|
80
|
-
workflow: typeof workflow;
|
|
81
|
-
step: typeof step;
|
|
82
|
-
supervisor: typeof supervisor;
|
|
83
|
-
orchestrator: typeof orchestrator;
|
|
84
|
-
memory: typeof memory$1;
|
|
85
|
-
planner: typeof planner;
|
|
86
|
-
spawnSubAgent: typeof spawnSubAgent;
|
|
87
|
-
router: typeof router;
|
|
88
|
-
fanOut: typeof fanOut;
|
|
89
|
-
batch: typeof batch;
|
|
90
|
-
fallbackModel: typeof fallbackModel;
|
|
91
|
-
eval: {
|
|
92
|
-
exact: typeof exact;
|
|
93
|
-
contains: typeof contains;
|
|
94
|
-
predicate: typeof predicate;
|
|
95
|
-
judge: typeof judge;
|
|
96
|
-
};
|
|
97
|
-
mockRouter: typeof mockRouter;
|
|
98
|
-
middleware: {
|
|
99
|
-
budget: typeof budget;
|
|
100
|
-
guardrail: typeof guardrail;
|
|
101
|
-
semanticCache: typeof semanticCache;
|
|
102
|
-
compose: typeof composeMiddleware;
|
|
103
|
-
forTool: typeof forTool;
|
|
104
|
-
readBudgetFallbackSignal: typeof readBudgetFallbackSignal;
|
|
105
|
-
};
|
|
106
|
-
checkpoint: {
|
|
107
|
-
memory: typeof memory;
|
|
108
|
-
pg: typeof pg;
|
|
109
|
-
redis: typeof redis;
|
|
110
|
-
};
|
|
111
|
-
snapshot: {
|
|
112
|
-
memory: typeof memory$2;
|
|
113
|
-
pg: typeof pg$1;
|
|
114
|
-
redis: typeof redis$1;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
227
|
+
declare const ai: Ai;
|
|
117
228
|
//#endregion
|
|
118
|
-
export { ai };
|
|
229
|
+
export { Ai, ai };
|
|
119
230
|
//# sourceMappingURL=ai.d.mts.map
|
package/esm/ai.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/ai.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ai.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai/src/ai.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6EiB,EAAA;EACf,MAAA,SAAe,WAAA;EACf,IAAA,SAAa,IAAA;EACb,KAAA,SAAc,KAAA;EACd,YAAA,SAAqB,YAAA;EACrB,OAAA,SAAgB,OAAA;EAChB,WAAA,SAAoB,WAAA;EACpB,QAAA,SAAiB,QAAA;EACjB,IAAA,SAAa,IAAA;EACb,UAAA,SAAmB,UAAA;EACnB,IAAA,SAAa,IAAA;EACb,YAAA,SAAqB,YAAA;EACrB,MAAA,SAAe,QAAA;EACf,MAAA,SAAe,MAAA;EACf,OAAA,SAAgB,OAAA;EAChB,GAAA,SAAY,GAAA;IACV,eAAA,SAAwB,eAAA;IACxB,WAAA,SAAoB,WAAA;IACpB,KAAA,SAAc,KAAA;IACd,gBAAA,SAAyB,gBAAA;IACzB,aAAA,SAAsB,aAAA;IACtB,aAAA,SAAsB,aAAA;IACtB,QAAA,SAAiB,QAAA;IACjB,QAAA,SAAiB,QAAA;IACjB,OAAA,SAAgB,OAAA;IAChB,OAAA,SAAgB,OAAA;IAChB,QAAA,SAAiB,QAAA;IACjB,oBAAA,SAA6B,oBAAA;IAC7B,UAAA,SAAmB,UAAA;IACnB,UAAA,SAAmB,UAAA;EAAA;EAErB,aAAA,SAAsB,aAAA;EACtB,MAAA,SAAe,MAAA;EACf,MAAA,SAAe,MAAA;EACf,KAAA,SAAc,KAAA;EAjCC;EAmCf,YAAA,SAAqB,YAAA;EAjCP;EAmCd,KAAA,SAAc,KAAA;EAjCE;;;;;;;EAyChB,KAAA,SAAc,KAAA;EAjCC;EAmCf,MAAA,SAAe,MAAA;EAjCH;EAmCZ,UAAA,SAAmB,UAAA;EAjCG;EAmCtB,aAAA,SAAsB,aAAA;EAjCK;EAmC3B,eAAA,SAAwB,eAAA;EAjCA;EAmCxB,yBAAA,SAAkC,yBAAA;EAClC,aAAA,SAAsB,aAAA;EACtB,IAAA,SAAa,WAAA;EACb,OAAA,SAAgB,OAAA;EAChB,MAAA,SAAe,MAAA;EAjCgB;;;;;;;EAyC/B,OAAA,EAAS,UAAA,QAAkB,qBAAA;EAC3B,GAAA,SAAY,GAAA;EACZ,UAAA,SAAmB,UAAA;EACnB,UAAA;IACE,MAAA,SAAe,MAAA;IACf,SAAA,SAAkB,WAAA;IAClB,aAAA,SAAsB,aAAA;IACtB,OAAA,SAAgB,iBAAA;IAChB,OAAA,SAAgB,OAAA;IAChB,wBAAA,SAAiC,wBAAA;EAAA;EAEnC,UAAA;IACE,MAAA,SAAe,MAAA;IACf,EAAA,SAAW,EAAA;IACX,KAAA,SAAc,KAAA;EAAA;EAEhB,QAAA;IACE,MAAA,SAAe,QAAA;IACf,EAAA,SAAW,IAAA;IACX,KAAA,SAAc,OAAA;EAAA;EAVmB;;;;;;;;EAoBnC,KAAA;IACE,QAAA,SAAiB,aAAA;IACjB,MAAA,SAAe,MAAA;IACf,SAAA;MACE,MAAA,SAAe,QAAA;MACf,EAAA,SAAW,IAAA;MACX,KAAA,SAAc,OAAA;IAAA;EAAA;EArGlB;;;;;EA6GA,SAAA,SAAkB,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6CP,EAAA,EAwER,EAAE"}
|
package/esm/ai.mjs
CHANGED
|
@@ -5,15 +5,30 @@ import { semanticCache } from "./middleware/builtins/semantic-cache.mjs";
|
|
|
5
5
|
import { composeMiddleware } from "./middleware/helpers/compose.mjs";
|
|
6
6
|
import { forTool } from "./middleware/helpers/for-tool.mjs";
|
|
7
7
|
import { tool } from "./tool/tool.mjs";
|
|
8
|
+
import { skills } from "./skills/skills.mjs";
|
|
9
|
+
import { memory } from "./memory/memory.mjs";
|
|
10
|
+
import "./skills/index.mjs";
|
|
8
11
|
import { agent } from "./agent/agent.mjs";
|
|
9
12
|
import { spawnSubAgent } from "./agent/spawn-sub-agent.mjs";
|
|
10
13
|
import { batch } from "./batch/batch.mjs";
|
|
11
14
|
import "./batch/index.mjs";
|
|
12
|
-
import {
|
|
15
|
+
import { streamObject } from "./object-stream/stream-object.mjs";
|
|
16
|
+
import "./object-stream/index.mjs";
|
|
17
|
+
import { serve } from "./serve/serve.mjs";
|
|
18
|
+
import { memory as memory$1 } from "./checkpoint/memory.mjs";
|
|
13
19
|
import { pg } from "./checkpoint/pg.mjs";
|
|
14
20
|
import { redis } from "./checkpoint/redis.mjs";
|
|
21
|
+
import { dataset } from "./eval/dataset.mjs";
|
|
15
22
|
import { evalScorers } from "./eval/index.mjs";
|
|
16
|
-
import {
|
|
23
|
+
import { human } from "./human/register.mjs";
|
|
24
|
+
import { image } from "./image/image.mjs";
|
|
25
|
+
import "./image/index.mjs";
|
|
26
|
+
import { speech } from "./speech/speech.mjs";
|
|
27
|
+
import "./speech/index.mjs";
|
|
28
|
+
import { audioFromBuffer, audioFromFile, audioMediaTypeForFilename } from "./transcribe/audio-input.mjs";
|
|
29
|
+
import { transcribe } from "./transcribe/transcribe.mjs";
|
|
30
|
+
import "./transcribe/index.mjs";
|
|
31
|
+
import { guardrail as guardrail$1 } from "./guard/guardrail.mjs";
|
|
17
32
|
import { mockRouter } from "./mock/mock-router.mjs";
|
|
18
33
|
import "./mock/index.mjs";
|
|
19
34
|
import { fallbackModel } from "./model/fallback-model.mjs";
|
|
@@ -23,15 +38,36 @@ import { orchestrator } from "./orchestrator/orchestrator.mjs";
|
|
|
23
38
|
import "./orchestrator/index.mjs";
|
|
24
39
|
import { planner } from "./planner/planner.mjs";
|
|
25
40
|
import "./planner/index.mjs";
|
|
41
|
+
import { instruction } from "./system-prompt/instruction.mjs";
|
|
42
|
+
import { persona } from "./system-prompt/persona.mjs";
|
|
43
|
+
import { systemPrompt } from "./system-prompt/system-prompt.mjs";
|
|
44
|
+
import { defaultPromptsManager } from "./prompts/prompts-manager.mjs";
|
|
45
|
+
import { chunk } from "./rag/chunk/chunk.mjs";
|
|
46
|
+
import { cacheVectorStore } from "./rag/store/cache-vector-store.mjs";
|
|
47
|
+
import { rag } from "./rag/rag.mjs";
|
|
48
|
+
import { pgVectorStore, vectorLiteral } from "./rag/store/pg-vector-store.mjs";
|
|
49
|
+
import { loadText } from "./rag/loaders/load-text.mjs";
|
|
50
|
+
import { loadHtml } from "./rag/loaders/load-html.mjs";
|
|
51
|
+
import { loadWeb } from "./rag/loaders/load-web.mjs";
|
|
52
|
+
import { loadPdf } from "./rag/loaders/load-pdf.mjs";
|
|
53
|
+
import { keywordReranker } from "./rag/rerank/keyword-reranker.mjs";
|
|
54
|
+
import { llmReranker } from "./rag/rerank/llm-reranker.mjs";
|
|
55
|
+
import { reciprocalRankFusion } from "./rag/hybrid/rrf.mjs";
|
|
56
|
+
import { bm25Rank } from "./rag/hybrid/bm25.mjs";
|
|
57
|
+
import { hybridRank } from "./rag/hybrid/hybrid-rank.mjs";
|
|
58
|
+
import { multiQuery } from "./rag/transforms/multi-query.mjs";
|
|
59
|
+
import "./rag/index.mjs";
|
|
60
|
+
import { prompt } from "./prompt/prompt.mjs";
|
|
61
|
+
import "./prompt/index.mjs";
|
|
62
|
+
import { vcr } from "./vcr/vcr.mjs";
|
|
63
|
+
import "./vcr/index.mjs";
|
|
26
64
|
import { memory as memory$2 } from "./snapshot/memory.mjs";
|
|
27
65
|
import { pg as pg$1 } from "./snapshot/pg.mjs";
|
|
28
66
|
import { redis as redis$1 } from "./snapshot/redis.mjs";
|
|
29
67
|
import { fanOut } from "./supervisor/fan-out.mjs";
|
|
30
68
|
import { router } from "./supervisor/router-factory.mjs";
|
|
31
69
|
import "./supervisor/index.mjs";
|
|
32
|
-
import {
|
|
33
|
-
import { persona } from "./system-prompt/persona.mjs";
|
|
34
|
-
import { systemPrompt } from "./system-prompt/system-prompt.mjs";
|
|
70
|
+
import { team } from "./team/team.mjs";
|
|
35
71
|
import { step } from "./workflow/step.mjs";
|
|
36
72
|
import { workflow } from "./workflow/workflow.mjs";
|
|
37
73
|
|
|
@@ -47,6 +83,7 @@ import { workflow } from "./workflow/workflow.mjs";
|
|
|
47
83
|
* - `ai.instruction(text)` — reusable instruction block (can be passed to `systemPrompt`).
|
|
48
84
|
* - `ai.orchestrator(...)` — session-state manager wrapped around a supervisor (durable session, drift detection, resume, commands).
|
|
49
85
|
* - `ai.memory(...)` — build an agent-memory store with WORKING (in-run scratch) and SEMANTIC (cache-driver `.similar()` recall) tiers.
|
|
86
|
+
* - `ai.skills(...)` — build a runtime skills library (always-injected metadata catalog + on-demand loadSkill tool).
|
|
50
87
|
* - `ai.planner(...)` — build an executable that generates an ordered plan over registered capabilities, then runs it step-by-step.
|
|
51
88
|
* - `ai.spawnSubAgent(spec)` — thin wrapper that builds a fresh one-shot `agent()` with an optional per-task `budget` and runs the task once. A general primitive (not planner-specific).
|
|
52
89
|
* - `ai.router(...)` — build a supervisor-compatible routing agent from named intents.
|
|
@@ -57,6 +94,8 @@ import { workflow } from "./workflow/workflow.mjs";
|
|
|
57
94
|
* - `ai.mockRouter(decisions, opts?)` — deterministic supervisor `route` callback for tests.
|
|
58
95
|
* - `ai.checkpoint.{memory,pg,redis}()` — durable orchestrator session checkpoint stores.
|
|
59
96
|
* - `ai.snapshot.{memory,pg,redis}()` — supervisor-run snapshot stores for `iterate: true` resume.
|
|
97
|
+
* - `ai.human.approval(...)` / `ai.human.resume(...)` / `ai.human.interrupt.{memory,pg,redis}()` — human-in-the-loop tool approval (interrupt / resume).
|
|
98
|
+
* - `ai.guardrail(options)` + `ai.guardrail.{pii,topic,injection,moderation}(...)` — content-intelligence guardrails (moderation / PII / injection / topic).
|
|
60
99
|
* - `ai.openai.model(...)` / `ai.anthropic.model(...)` / ... once the adapter SDK is registered.
|
|
61
100
|
*
|
|
62
101
|
* @example
|
|
@@ -85,15 +124,45 @@ const ai = {
|
|
|
85
124
|
workflow,
|
|
86
125
|
step,
|
|
87
126
|
supervisor,
|
|
127
|
+
team,
|
|
88
128
|
orchestrator,
|
|
89
|
-
memory
|
|
129
|
+
memory,
|
|
130
|
+
skills,
|
|
90
131
|
planner,
|
|
132
|
+
rag: Object.assign(rag, {
|
|
133
|
+
keywordReranker,
|
|
134
|
+
llmReranker,
|
|
135
|
+
chunk,
|
|
136
|
+
cacheVectorStore,
|
|
137
|
+
pgVectorStore,
|
|
138
|
+
vectorLiteral,
|
|
139
|
+
loadText,
|
|
140
|
+
loadHtml,
|
|
141
|
+
loadWeb,
|
|
142
|
+
loadPdf,
|
|
143
|
+
bm25Rank,
|
|
144
|
+
reciprocalRankFusion,
|
|
145
|
+
hybridRank,
|
|
146
|
+
multiQuery
|
|
147
|
+
}),
|
|
91
148
|
spawnSubAgent,
|
|
92
149
|
router,
|
|
93
150
|
fanOut,
|
|
94
151
|
batch,
|
|
152
|
+
streamObject,
|
|
153
|
+
serve,
|
|
154
|
+
image,
|
|
155
|
+
speech,
|
|
156
|
+
transcribe,
|
|
157
|
+
audioFromFile,
|
|
158
|
+
audioFromBuffer,
|
|
159
|
+
audioMediaTypeForFilename,
|
|
95
160
|
fallbackModel,
|
|
96
161
|
eval: evalScorers,
|
|
162
|
+
dataset,
|
|
163
|
+
prompt,
|
|
164
|
+
prompts: defaultPromptsManager(),
|
|
165
|
+
vcr,
|
|
97
166
|
mockRouter,
|
|
98
167
|
middleware: {
|
|
99
168
|
budget,
|
|
@@ -104,7 +173,7 @@ const ai = {
|
|
|
104
173
|
readBudgetFallbackSignal
|
|
105
174
|
},
|
|
106
175
|
checkpoint: {
|
|
107
|
-
memory,
|
|
176
|
+
memory: memory$1,
|
|
108
177
|
pg,
|
|
109
178
|
redis
|
|
110
179
|
},
|
|
@@ -112,7 +181,9 @@ const ai = {
|
|
|
112
181
|
memory: memory$2,
|
|
113
182
|
pg: pg$1,
|
|
114
183
|
redis: redis$1
|
|
115
|
-
}
|
|
184
|
+
},
|
|
185
|
+
human,
|
|
186
|
+
guardrail: guardrail$1
|
|
116
187
|
};
|
|
117
188
|
|
|
118
189
|
//#endregion
|