@warlock.js/ai 4.5.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 +14 -0
- package/cjs/index.cjs +20 -1
- package/cjs/{src-DFibP2FQ.cjs → src-Bmajk4Qg.cjs} +1 -1
- package/cjs/{src-C02yzsLs.cjs → src-OZyDYHxm.cjs} +2789 -691
- package/cjs/src-OZyDYHxm.cjs.map +1 -0
- package/esm/agent/agent-config.type.d.mts +29 -0
- package/esm/agent/agent-config.type.d.mts.map +1 -1
- package/esm/agent/agent.d.mts.map +1 -1
- package/esm/agent/agent.mjs +126 -7
- package/esm/agent/agent.mjs.map +1 -1
- 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/image.mjs +5 -0
- package/esm/ai-openai/src/index.mjs +3 -0
- package/esm/ai-openai/src/sdk.mjs +3 -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 +1 -0
- package/esm/ai-openai/src/utils/to-openai-messages.mjs +3 -0
- package/esm/ai.d.mts +45 -0
- package/esm/ai.d.mts.map +1 -1
- package/esm/ai.mjs +37 -1
- package/esm/ai.mjs.map +1 -1
- package/esm/contracts/agent/agent-options.type.d.mts +22 -2
- 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/index.d.mts +2 -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 +8 -3
- package/esm/contracts/planner/index.d.mts +3 -2
- package/esm/contracts/planner/planner-config.type.d.mts +30 -0
- package/esm/contracts/planner/planner-config.type.d.mts.map +1 -1
- package/esm/contracts/planner/planner-execute-options.type.d.mts +13 -1
- package/esm/contracts/planner/planner-execute-options.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/base-report.type.d.mts +1 -1
- 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/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/transcription-model.contract.d.mts +101 -0
- package/esm/contracts/transcription-model.contract.d.mts.map +1 -0
- 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 +2 -0
- package/esm/errors/index.mjs +2 -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/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 +26 -4
- package/esm/index.mjs +20 -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/planner/planner-run.d.mts +8 -0
- package/esm/planner/planner-run.d.mts.map +1 -1
- package/esm/planner/planner-run.mjs +161 -6
- package/esm/planner/planner-run.mjs.map +1 -1
- package/esm/planner/planner.d.mts.map +1 -1
- package/esm/planner/planner.mjs +25 -1
- 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/rag/index.d.mts +7 -0
- package/esm/rag/index.mjs +7 -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/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/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/entries.mjs +2 -2
- package/esm/supervisor/entries.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/llms-full.txt +753 -0
- package/llms.txt +5 -0
- package/package.json +3 -3
- package/skills/README.md +4 -0
- package/skills/durable-agent-runs/SKILL.md +135 -0
- package/skills/generate-images/SKILL.md +138 -0
- package/skills/generate-speech/SKILL.md +139 -0
- package/skills/rag-loaders-and-stores/SKILL.md +164 -0
- package/skills/transcribe-audio/SKILL.md +157 -0
- package/cjs/src-C02yzsLs.cjs.map +0 -1
package/esm/index.d.mts
CHANGED
|
@@ -33,6 +33,7 @@ import { WorkflowReport, WorkflowResult } from "./contracts/result/workflow-resu
|
|
|
33
33
|
import { ToolConfig, ToolContext, ToolMeta, ToolMode } from "./contracts/tool.contract.mjs";
|
|
34
34
|
import { AgentExecutionError } from "./errors/agent-execution-error.mjs";
|
|
35
35
|
import { AgentCancelledError, AgentCancelledErrorOptions } from "./errors/agent-cancelled-error.mjs";
|
|
36
|
+
import { AgentDriftError, AgentDriftErrorOptions } from "./errors/agent-drift-error.mjs";
|
|
36
37
|
import { AgentMaxTripsError, AgentMaxTripsErrorOptions } from "./errors/agent-max-trips-error.mjs";
|
|
37
38
|
import { BudgetExceededError, BudgetExceededErrorOptions, BudgetUnit } from "./errors/budget-exceeded-error.mjs";
|
|
38
39
|
import { ProviderError } from "./errors/provider-error.mjs";
|
|
@@ -51,6 +52,7 @@ import { OrchestratorDriftError, OrchestratorDriftErrorOptions } from "./errors/
|
|
|
51
52
|
import { OutboundPolicyError } from "./errors/outbound-policy-error.mjs";
|
|
52
53
|
import { PlannerFailedError } from "./errors/planner-failed-error.mjs";
|
|
53
54
|
import { PlannerCancelledError, PlannerCancelledErrorOptions } from "./errors/planner-cancelled-error.mjs";
|
|
55
|
+
import { PlannerDriftError, PlannerDriftErrorOptions } from "./errors/planner-drift-error.mjs";
|
|
54
56
|
import { PlannerPlanInvalidError } from "./errors/planner-plan-invalid-error.mjs";
|
|
55
57
|
import { ProviderAuthError } from "./errors/provider-auth-error.mjs";
|
|
56
58
|
import { ProviderRateLimitError, ProviderRateLimitErrorOptions } from "./errors/provider-rate-limit-error.mjs";
|
|
@@ -104,8 +106,10 @@ import { SupervisorAgentCompletedPayload, SupervisorAgentFailedPayload, Supervis
|
|
|
104
106
|
import { WorkflowCancelledPayload, WorkflowCompletedPayload, WorkflowErrorPayload, WorkflowLoopWarningPayload, WorkflowStartingPayload, WorkflowStepCompletedPayload, WorkflowStepFailedPayload, WorkflowStepRetryingPayload, WorkflowStepSkippedPayload, WorkflowStepStartingPayload, WorkflowStepStreamingPayload } from "./contracts/events/workflow-events.type.mjs";
|
|
105
107
|
import { AgentEventMap, SupervisorEventMap, WorkflowEventMap } from "./contracts/events/event-map.type.mjs";
|
|
106
108
|
import { StreamingToolGuardConfig } from "./contracts/streaming-tool-guard-config.type.mjs";
|
|
107
|
-
import { AgentExecuteOptions } from "./contracts/agent/agent-options.type.mjs";
|
|
109
|
+
import { AgentExecuteOptions, AgentResumeOptions } from "./contracts/agent/agent-options.type.mjs";
|
|
110
|
+
import { AgentSnapshot, AgentSnapshotStatus } from "./contracts/agent/agent-snapshot.type.mjs";
|
|
108
111
|
import { EmbedderConfig, EmbedderContract, EmbeddingBatchResult, EmbeddingResult, EmbeddingUsage } from "./contracts/embedder.contract.mjs";
|
|
112
|
+
import { GeneratedImage, ImageGenerationOptions, ImageGenerationResponse, ImageModelConfig, ImageModelContract, ImageModelPricing } from "./contracts/image-model.contract.mjs";
|
|
109
113
|
import { MemoryItem, MemoryTier, RecalledMemory } from "./contracts/memory/memory-item.type.mjs";
|
|
110
114
|
import { RecallOptions } from "./contracts/memory/recall-options.type.mjs";
|
|
111
115
|
import { MemoryContract } from "./contracts/memory/memory.contract.mjs";
|
|
@@ -119,11 +123,14 @@ import { OrchestratorAsToolOptions, OrchestratorContract, OrchestratorSessionSco
|
|
|
119
123
|
import { OrchestratorConfig, OrchestratorMemoryConfig, SummarizeCallback, SummarizeConfig } from "./contracts/orchestrator/orchestrator-config.type.mjs";
|
|
120
124
|
import { SessionContract } from "./contracts/orchestrator/session.contract.mjs";
|
|
121
125
|
import { PlannerCapability } from "./contracts/planner/planner-capability.type.mjs";
|
|
122
|
-
import { PlannerConfig } from "./contracts/planner/planner-config.type.mjs";
|
|
123
126
|
import { PlannerPlan, PlannerStep } from "./contracts/planner/planner-plan.type.mjs";
|
|
124
127
|
import { PlannerReport, PlannerReportType, PlannerResult, PlannerStepSnapshot } from "./contracts/planner/planner-result.type.mjs";
|
|
125
|
-
import {
|
|
128
|
+
import { PlannerSnapshot, PlannerSnapshotStatus } from "./contracts/planner/planner-snapshot.type.mjs";
|
|
129
|
+
import { PlannerConfig } from "./contracts/planner/planner-config.type.mjs";
|
|
130
|
+
import { PlannerExecuteOptions, PlannerResumeOptions, PlannerStepDirective } from "./contracts/planner/planner-execute-options.type.mjs";
|
|
126
131
|
import { PlannerContract } from "./contracts/planner/planner.contract.mjs";
|
|
132
|
+
import { GeneratedAudio, SpeechGenerationResponse, SpeechModelConfig, SpeechModelContract, SpeechModelPricing, SpeechOptions } from "./contracts/speech-model.contract.mjs";
|
|
133
|
+
import { AudioInput, TranscribeOptions, TranscriptionModelConfig, TranscriptionModelContract, TranscriptionModelPricing, TranscriptionResponse, TranscriptionSegment } from "./contracts/transcription-model.contract.mjs";
|
|
127
134
|
import { ModelConfig, SDKAdapterContract } from "./contracts/sdk-adapter.contract.mjs";
|
|
128
135
|
import { CompleteEvent } from "./contracts/events/complete-event.type.mjs";
|
|
129
136
|
import { UsageEvent } from "./contracts/events/usage-event.type.mjs";
|
|
@@ -162,6 +169,11 @@ import { InterruptStore, PendingInterrupt, PendingInterruptStatus, PgClientLike,
|
|
|
162
169
|
import { HumanApprovalOptions } from "./human/contracts/human-approval.type.mjs";
|
|
163
170
|
import { ResumeOptions, ResumeResult } from "./human/contracts/resume.type.mjs";
|
|
164
171
|
import { humanApproval } from "./human/human-approval.mjs";
|
|
172
|
+
import { ImageData, ImageParams, ImageReport, ImageResult, image } from "./image/image.mjs";
|
|
173
|
+
import { computeImageCost } from "./image/image-cost.mjs";
|
|
174
|
+
import { SpeechData, SpeechParams, SpeechReport, SpeechResult, speech } from "./speech/speech.mjs";
|
|
175
|
+
import { audioFromBuffer, audioFromFile, audioMediaTypeForFilename } from "./transcribe/audio-input.mjs";
|
|
176
|
+
import { TranscribeParams, TranscriptionData, TranscriptionReport, TranscriptionResult, transcribe } from "./transcribe/transcribe.mjs";
|
|
165
177
|
import { resume } from "./human/resume.mjs";
|
|
166
178
|
import { memory as memory$1 } from "./human/stores/memory.mjs";
|
|
167
179
|
import { PgInterruptOptions, pg as pg$1 } from "./human/stores/pg.mjs";
|
|
@@ -176,6 +188,9 @@ import { GuardrailCheck, GuardrailCheckResult, GuardrailOptions } from "./middle
|
|
|
176
188
|
import { SemanticCacheOptions, semanticCache } from "./middleware/builtins/semantic-cache.mjs";
|
|
177
189
|
import { composeMiddleware } from "./middleware/helpers/compose.mjs";
|
|
178
190
|
import { forTool } from "./middleware/helpers/for-tool.mjs";
|
|
191
|
+
import { MockImageCall, MockImageModel, MockImageResponse } from "./mock/mock-image-model.mjs";
|
|
192
|
+
import { MockSpeechCall, MockSpeechModel, MockSpeechResponse } from "./mock/mock-speech-model.mjs";
|
|
193
|
+
import { MockTranscriptionCall, MockTranscriptionModel, MockTranscriptionResponse } from "./mock/mock-transcription-model.mjs";
|
|
179
194
|
import { MockModelResponse, MockSDKConfig } from "./mock/mock-config.type.mjs";
|
|
180
195
|
import { mockAgent } from "./mock/mock-agent.mjs";
|
|
181
196
|
import { MockModel } from "./mock/mock-model.mjs";
|
|
@@ -209,6 +224,13 @@ import { rag } from "./rag/rag.mjs";
|
|
|
209
224
|
import { chunk } from "./rag/chunk/chunk.mjs";
|
|
210
225
|
import { VectorStore } from "./rag/store/vector-store.contract.mjs";
|
|
211
226
|
import { cacheVectorStore } from "./rag/store/cache-vector-store.mjs";
|
|
227
|
+
import { PgVectorStoreInstance, PgVectorStoreOptions, pgVectorStore, vectorLiteral } from "./rag/store/pg-vector-store.mjs";
|
|
228
|
+
import { LoadHtmlOptions, LoadPdfOptions, LoadTextOptions, LoadWebOptions, RagLoaderMetadata, RagLoaderOptions, RagLoaderResult, RagLoaderType } from "./rag/loaders/loader.type.mjs";
|
|
229
|
+
import { TextInput, loadText } from "./rag/loaders/load-text.mjs";
|
|
230
|
+
import { loadHtml } from "./rag/loaders/load-html.mjs";
|
|
231
|
+
import { loadWeb } from "./rag/loaders/load-web.mjs";
|
|
232
|
+
import { loadPdf } from "./rag/loaders/load-pdf.mjs";
|
|
233
|
+
import { PDF_PARSE_INSTALL_INSTRUCTIONS } from "./rag/loaders/errors.mjs";
|
|
212
234
|
import { KeywordRerankerOptions, keywordReranker } from "./rag/rerank/keyword-reranker.mjs";
|
|
213
235
|
import { LlmRerankerOptions, llmReranker } from "./rag/rerank/llm-reranker.mjs";
|
|
214
236
|
import { RankedItem, reciprocalRankFusion } from "./rag/hybrid/rrf.mjs";
|
|
@@ -287,7 +309,7 @@ import { computeSignature as computeSignature$1 } from "./workflow/signature.mjs
|
|
|
287
309
|
import { MatcherVerdict, matchConverge, matchOutputShape, matchPassStep, matchRouteTo } from "./testing/matcher-logic.mjs";
|
|
288
310
|
import { AiMatchers } from "./testing/matchers.mjs";
|
|
289
311
|
import { registerAiMatchers } from "./testing/register-lazy.mjs";
|
|
290
|
-
export { AIConfig, AIError, type AIErrorCode, type AIErrorOptions, type AckCallback, type AckConfig, type AckEntry, type AckRunEntry, type AckSnapshot, type AgentBranchSnapshot, AgentCancelledError, type AgentCancelledErrorOptions, type AgentCompletedPayload, type AgentConfig, type AgentContract, type AgentErrorPayload, type AgentEventHandler, type AgentEventMap, type AgentExecuteOptions, AgentExecutionError, AgentMaxTripsError, type AgentMaxTripsErrorOptions, type AgentMiddleware, type AgentMiddlewareExecuteHooks, type AgentMiddlewareSupervisorHooks, type AgentMiddlewareToolHooks, type AgentMiddlewareTripHooks, type AgentReport, type AgentResult, type AgentStartingPayload, type AgentStreamingPayload, type AgentToolCalledPayload, type AgentToolCallingFailedPayload, type AgentToolCallingPayload, type AgentToolEntry, type AgentTripCompletedPayload, type AgentTripStartedPayload, type Ai, type AiMatchers, type ApprovalDecision, type ApprovalDecisionType, type ApprovalHandler, ApprovalRejectedError, type ApprovalRejectedErrorOptions, type ApprovalRequest, type ApprovalRequestContext, Attachment, AttachmentPolicy, AttachmentSource, type AttemptEntry, type BaseReport, type BaseResult, type BatchItemHandler, type BatchItemResult, type BatchItemStatus, type BatchOptions, type BatchReport, type BatchResult, BinarySource, type BudgetContract, type BudgetContractDimension, type BudgetContractFallback, type BudgetContractViolation, type BudgetContractViolationMode, BudgetExceededError, type BudgetExceededErrorOptions, type BudgetFallbackSignal, type BudgetOptions, type BudgetPricing, type BudgetUnit, type CapturedMessage, type Cassette, type CassetteEntry, type CheckpointRecord, type CheckpointStore, type Chunk, type ChunkOptions, type ChunkType, type Citation, type ClassifierAgentEntry, type ClassifierCallback, type ClassifierConfig, type ClassifierContext, type ClassifierOutput, type ClassifierRefineContext, type ClassifierRefineResult, type ClassifierRunEntry, type ClassifierSnapshot, type CompactionResult, type CompleteEvent, ContentFilterError, type ContentFilterErrorOptions, ContentPart, ContextLengthExceededError, type ContextLengthExceededErrorOptions, DEFAULT_HASH_OPTIONS, DEFAULT_SENSITIVE_KEYS, type DatasetContract, type DatasetEntry, type DatasetOptions, type DecisionSource, type DispatchContext, type DispatchRawResult, END, EmbedderConfig, EmbedderContract, EmbeddingBatchResult, EmbeddingResult, EmbeddingUsage, EndSentinel, type EpisodicMemoryConfig, type ErrorCategory, type EvalCase, type EvalCaseResult, type EvalJudge, type EvalOptions, type EvalPredicate, type EvalReport, type EvalScore, type EvalScorer, type EvalScorerContext, type EvaluateBranchResult, type EvaluateContext, type EvaluateResult, type EventIdentity, ExecutableContract, type ExecutableTool, type ExecuteResult, type ExecutionReport, type ExecutionStatus, type ExportedPrompt, type ExportedPromptVersion, type ExportedRegistry, type ExtractJsonSchemaOptions, type FallbackAttempt, type FallbackModelContract, type FallbackModelOptions, type FallbackRetryPredicate, type FanOutOptions, type FanOutUnit, FinishReason, type FlagRecord, type FlowObserveOption, type GuardOptions, type GuardrailAction, type GuardrailBlockEvent, type GuardrailCheck, type GuardrailCheckResult, type GuardrailDetector, type GuardrailDetectorContext, type GuardrailEscalation, type GuardrailFactory, type GuardrailMatch, type GuardrailOptions, type GuardrailPhase, type GuardrailVerdict, GuardrailViolationError, type GuardrailViolationErrorOptions, type HumanApprovalOptions, type HumanErrorCode, ImageSource, type InjectionDetectorOptions, Instruction, InstructionContract, type IntentCallback, type IntentEntry, type IntentRunEntry, type IntentRunner, type IntentRunnerMap, type InterruptPolicy, type InterruptStore, InterruptSuspendedError, type InterruptSuspendedErrorOptions, InvalidRequestError, type IterationDecision, type IterationSnapshot, JUDGE_DEFAULT_REPAIR_ATTEMPTS, type JsonSchemaTarget, type JudgeAgentConfig, type JudgeConfig, type KeywordRerankerOptions, type LLMTrip, type LexicalDoc, type LineageStamp, type LlmRerankerOptions, type LoadSkillInput, type LoadSkillResult, type LoadSkillToolDeps, type MatcherVerdict, MaxIterationsError, type MaxIterationsErrorOptions, MaxStepsExceededError, type MaxStepsExceededErrorOptions, type MemoryConfig, type MemoryContract, type MemoryItem, type MemoryTier, Message, type MiddlewareAgentRef, type MiddlewareContextByLevel, type MiddlewareExecuteContext, type MiddlewareLevel, type MiddlewareModelRef, type MiddlewareState, type MiddlewareSupervisorContext, type MiddlewareSupervisorRef, type MiddlewareToolContext, type MiddlewareTripContext, MockModel, type MockModelResponse, type MockRouterDecision, type MockRouterExhaustion, type MockRouterOptions, MockSDK, type MockSDKConfig, MockSkillsStore, ModelCallOptions, ModelCapabilities, ModelConfig, ModelContract, type ModelPricing, ModelResponse, ModelStreamChunk, ModelToolCallRequest, type MultiQueryOptions, type NamespacedStateAccessor, type Next, type NextStepResult, OPENAI_INSTALL_INSTRUCTIONS, type ObjectStreamEvent, type Observer, type OpenAiClientLike, type OpenAiModerationCreateBody, type OpenAiModerationOptions, type OpenAiModerationResponse, type OpenAiModerationResult, type OrchestratorAsToolOptions, type OrchestratorAwaitingStatus, OrchestratorCancelledError, type OrchestratorCancelledErrorOptions, type OrchestratorCommandHandlers, type OrchestratorCommands, type OrchestratorConfig, OrchestratorConfigError, type OrchestratorContract, OrchestratorDriftError, type OrchestratorDriftErrorOptions, OrchestratorEmitter, type OrchestratorEvent, type OrchestratorEventHandler, type OrchestratorEventHandlers, type OrchestratorEventMap, type OrchestratorEventName, type OrchestratorExecuteOptions, OrchestratorExecution, type OrchestratorExecutionParams, OrchestratorFailedError, type OrchestratorMemoryConfig, type OrchestratorReport, type OrchestratorReportStatus, type OrchestratorReportType, type OrchestratorResult, type OrchestratorResumeOptions, type OrchestratorSessionScope, type OrchestratorStreamController, type OutboundPolicy, OutboundPolicyError, type ParsedFrontmatter, type PendingInterrupt, type PendingInterruptStatus, Persona, PersonaContract, type PgCheckpointOptions, type PgClientLike, type PgInterruptOptions, type PgSnapshotStoreOptions, type PiiCategory, type PiiDetectorOptions, Placeholders, PlannerCancelledError, type PlannerCancelledErrorOptions, type PlannerCapability, type PlannerConfig, type PlannerContract, type PlannerExecuteOptions, PlannerFailedError, type PlannerPlan, PlannerPlanInvalidError, type PlannerReport, type PlannerReportType, type PlannerResult, type PlannerRunArgs, type PlannerStep, type PlannerStepDirective, type PlannerStepSnapshot, type PolicyContext, type PolicyVerdict, type ProceduralMemoryConfig, type PromptDiff, type PromptDiffBlock, type PromptEntry, type PromptJudgeCacheLike, type PromptLangfuseSyncOptions, PromptNotFoundError, type PromptRegistryContract, type PromptRegistryOptions, type PromptResolveOptions, type PromptTemplateVersion, type PromptValidateOptions, type PromptValidateTarget, PromptValidationError, type PromptValidationNote, type PromptValidationReport, type PromptValidationResult, type PromptValidationSeverity, type PromptVersion, type PromptsManagerContract, type PromptsManagerEntry, type PromptsManagerOptions, type PromptsManagerRegisterOptions, type PromptsValidateOptions, ProviderAuthError, ProviderError, ProviderRateLimitError, type ProviderRateLimitErrorOptions, ProviderTimeoutError, QuotaExceededError, REPORT_SCHEMA_VERSION, type Rag, type RagAsToolOptions, type RagConfig, type RagDocument, type RagReranker, type RankedItem, ReasoningEffort, type RecallOptions, type RecalledMemory, type RedactOptions, type RedactedError, type RedisCheckpointOptions, type RedisClientLike, type RedisInterruptOptions, type RedisSnapshotStoreOptions, type ReportStatus, type ReportType, ResolvedAttachment, type ResolvedIntentEntry, type ResolvedOrchestratorMemory, type ResolvedOutboundPolicy, type ResolvedPrompt, type ResumeOptions, type ResumeResult, type RetrieveOptions, type RetrieveResult, type RetrievedChunk, type RetryBackoff, type RetryConfig, type ReviewOutcome, type RouteContext, type RouterConfig, type RouterEntry, type RouterIntents, type RouterOutput, RoutingError, type RoutingErrorOptions, type RunFrame, SDKAdapterContract, SENSITIVE_HEADERS, SSE_DONE, type SaveSkillInput, type SaveSkillResult, type SaveSkillToolDeps, SchemaValidationError, type SchemaValidationErrorOptions, type SemanticCacheOptions, type SemanticMemoryConfig, type ServableExecutable, type ServeOptions, type SessionContextOverrides, type SessionContract, type SessionLock, type SessionSendResult, type SkillAnalyticsEvent, type SkillCatalogEntry, type SkillInjectMode, type SkillRecord, type SkillReviewGate, type SkillSource, type SkillsConfig, type SkillsContract, type SkillsStoreContract, type SnapshotStore, type SpawnSubAgentSpec, type StepAgentInput, type StepDefinition, StepFailedError, type StepFailedErrorOptions, type StepLocalEvents, type StepOutputSpec, type StepSnapshot, StorageFileShape, type StreamContract, type StreamController, type StreamEvent, type StreamEventBody, type StreamLike, type StreamObjectParams, StreamingToolGuardConfig, type SummarizeCallback, type SummarizeConfig, type SupervisorAgentCompletedPayload, type SupervisorAgentFailedPayload, type SupervisorAgentStartingPayload, type SupervisorAgentStreamingPayload, type SupervisorAsToolOptions, SupervisorCancelledError, type SupervisorCancelledErrorOptions, type SupervisorCancelledPayload, type SupervisorCompletedPayload, type SupervisorConfig, type SupervisorContract, SupervisorDriftError, type SupervisorDriftErrorOptions, SupervisorEmitter, type SupervisorErrorPayload, type SupervisorEvaluateVerdictPayload, type SupervisorEventHandler, type SupervisorEventHandlers, type SupervisorEventMap, type SupervisorExecuteOptions, SupervisorExecution, SupervisorFailedError, type SupervisorInput, type SupervisorIntentValue, type SupervisorIterationCompletedPayload, type SupervisorIterationStartingPayload, type SupervisorReport, type SupervisorResult, type SupervisorResumeOptions, type SupervisorRouterDecidedPayload, type SupervisorRouterDecidingPayload, SupervisorRoutingError, type SupervisorRoutingErrorOptions, type SupervisorSnapshot, type SupervisorSnapshotStatus, type SupervisorStartingPayload, type SupervisorStreamController, type SupervisorStreamEvent, type SupervisorTerminatedBy, type SyncGuardrailDetector, SystemPrompt, SystemPromptBlockContract, SystemPromptContract, SystemPromptMergeOptions, SystemPromptMergeSource, SystemPromptMeta, type TeamConfig, type TeamGate, type TeamGateFn, type TeamMemberValue, type ToolCall, ToolConfig, ToolContext, type ToolContract, type ToolEventMeta, ToolExecutionError, type ToolExecutionErrorOptions, type ToolInvokeResult, ToolMeta, ToolMode, type TopicFilterOptions, type TurnSnapshot, type Usage, type UsageEvent, VcrCassetteMissError, type VcrCassetteMissErrorOptions, type VcrMode, type VcrModel, type VcrOptions, type VectorStore, type WithoutIdentity, WorkflowCancelledError, type WorkflowCancelledErrorOptions, type WorkflowCancelledPayload, type WorkflowCompletedPayload, type WorkflowContext, type WorkflowDefinition, WorkflowDriftError, type WorkflowDriftErrorOptions, WorkflowError, type WorkflowErrorPayload, type WorkflowEventHandler, type WorkflowEventHandlers, type WorkflowEventMap, type WorkflowExecuteOptions, type WorkflowInstance, type WorkflowLoopWarningPayload, type WorkflowReport, type WorkflowResult, type WorkflowResumeOptions, type WorkflowRunOptions, type WorkflowSnapshot, type WorkflowStartingPayload, type WorkflowStepCompletedPayload, type WorkflowStepFailedPayload, type WorkflowStepRetryingPayload, type WorkflowStepSkippedPayload, type WorkflowStepStartingPayload, type WorkflowStepStreamingPayload, accumulateCost, agent, ai, approximateTokenCount, assertUrlAllowed, batch, bm25Rank, budget, buildCatalog, buildPlanSystemPrompt, buildRouterContextMessage, cacheVectorStore, captureChildReport, memory as checkpointMemory, pg as checkpointPg, redis as checkpointRedis, chunk, collectStreamObject, composeMiddleware, computeCost, computeOrchestratorSignature, computeSignature as computePlannerSignature, computeSignature$1 as computeSignature, computeSignature$2 as computeSupervisorSignature, contains, createAgentStream, createCommandDispatcher as createOrchestratorCommandDispatcher, createOrchestratorStream, createCancelledError as createSupervisorCancelledError, createSupervisorStream, currentRunFrame, dataset, defaultPromptsManager, diff, directorySource, encodeSSE, evalScorers, evaluatePolicy, exact, executableToTool, extractJsonLenient, extractJsonPayload, extractJsonSchema, extractUserText, fallbackModel, fanOut, fetchTextWithPolicy, forTool, fromJSON, generateRunId, getAIConfig, getObservers, guard, guardedFetch, guardrail, hashRequest, humanApproval, hybridRank, inProcessSessionLock, injectMemories as injectOrchestratorMemories, injection, instruction, memory$1 as interruptMemory, pg$1 as interruptPg, redis$1 as interruptRedis, isExecutableTool, isObserveAll, isPrivateOrReservedIp, judge, keywordReranker, llmReranker, loadRecord, loadSkillTool, loadSnapshotForResume as loadSupervisorSnapshotForResume, matchConverge, matchOutputShape, matchPassStep, matchRouteTo, memory$2 as memory, mergeUsage, mockAgent, mockRouter, moderation, multiQuery, namespacedState, noopSessionLock, normalizeAgentTools, onConfigApplied, orchestrator, asTool as orchestratorAsTool, memoryQueryFromInput as orchestratorMemoryQueryFromInput, outcomeTextFromTurn as orchestratorOutcomeTextFromTurn, parseFrontmatter, parsePartialJson, parseTags, persistSupervisorSnapshot, persona, pii, planSchema, planner, predicate, prepareAttachmentPart, proceduralSkillStore, prompt, promptKey, prompts, rag, readBudgetFallbackSignal, readTextCapped, recallForTurn as recallOrchestratorMemory, reciprocalRankFusion, redact, redactError, redactHeaders, registerAiMatchers, registerObserver, rememberTurnOutcome as rememberOrchestratorTurnOutcome, renderCatalogPrompt, renderPlaceholders, resolveAttachment, resolveDefaultCheckpointStore, resolveDefaultSnapshotStore, resolveDefaultStore, resolveIntentEntries, resolveObservers, resolveOrchestratorMemory, resolveOutboundPolicy, resolveSource, resume, router, runEval, runResume as runOrchestratorResume, runTurn as runOrchestratorTurn, runPipeline, runReviewGate, safeJsonParse, saveSkillTool, scrubSecrets, semanticCache, semanticPreselect, serve, setAIConfig, setObserveAll, skills, memory$3 as snapshotMemory, pg$2 as snapshotPg, redis$2 as snapshotRedis, spawnSubAgent, stampReportLineage, step, storeSource, streamObject, streamTurn as streamOrchestratorTurn, streamToSSE, supervisor, asTool$1 as supervisorAsTool, systemPrompt, team, toJSON, toJUnit, tool, topic, urlSource, vcr, withRunFrame, withoutRunFrame, workflow };
|
|
312
|
+
export { AIConfig, AIError, type AIErrorCode, type AIErrorOptions, type AckCallback, type AckConfig, type AckEntry, type AckRunEntry, type AckSnapshot, type AgentBranchSnapshot, AgentCancelledError, type AgentCancelledErrorOptions, type AgentCompletedPayload, type AgentConfig, type AgentContract, AgentDriftError, type AgentDriftErrorOptions, type AgentErrorPayload, type AgentEventHandler, type AgentEventMap, type AgentExecuteOptions, AgentExecutionError, AgentMaxTripsError, type AgentMaxTripsErrorOptions, type AgentMiddleware, type AgentMiddlewareExecuteHooks, type AgentMiddlewareSupervisorHooks, type AgentMiddlewareToolHooks, type AgentMiddlewareTripHooks, type AgentReport, type AgentResult, type AgentResumeOptions, type AgentSnapshot, type AgentSnapshotStatus, type AgentStartingPayload, type AgentStreamingPayload, type AgentToolCalledPayload, type AgentToolCallingFailedPayload, type AgentToolCallingPayload, type AgentToolEntry, type AgentTripCompletedPayload, type AgentTripStartedPayload, type Ai, type AiMatchers, type ApprovalDecision, type ApprovalDecisionType, type ApprovalHandler, ApprovalRejectedError, type ApprovalRejectedErrorOptions, type ApprovalRequest, type ApprovalRequestContext, Attachment, AttachmentPolicy, AttachmentSource, type AttemptEntry, AudioInput, type BaseReport, type BaseResult, type BatchItemHandler, type BatchItemResult, type BatchItemStatus, type BatchOptions, type BatchReport, type BatchResult, BinarySource, type BudgetContract, type BudgetContractDimension, type BudgetContractFallback, type BudgetContractViolation, type BudgetContractViolationMode, BudgetExceededError, type BudgetExceededErrorOptions, type BudgetFallbackSignal, type BudgetOptions, type BudgetPricing, type BudgetUnit, type CapturedMessage, type Cassette, type CassetteEntry, type CheckpointRecord, type CheckpointStore, type Chunk, type ChunkOptions, type ChunkType, type Citation, type ClassifierAgentEntry, type ClassifierCallback, type ClassifierConfig, type ClassifierContext, type ClassifierOutput, type ClassifierRefineContext, type ClassifierRefineResult, type ClassifierRunEntry, type ClassifierSnapshot, type CompactionResult, type CompleteEvent, ContentFilterError, type ContentFilterErrorOptions, ContentPart, ContextLengthExceededError, type ContextLengthExceededErrorOptions, DEFAULT_HASH_OPTIONS, DEFAULT_SENSITIVE_KEYS, type DatasetContract, type DatasetEntry, type DatasetOptions, type DecisionSource, type DispatchContext, type DispatchRawResult, END, EmbedderConfig, EmbedderContract, EmbeddingBatchResult, EmbeddingResult, EmbeddingUsage, EndSentinel, type EpisodicMemoryConfig, type ErrorCategory, type EvalCase, type EvalCaseResult, type EvalJudge, type EvalOptions, type EvalPredicate, type EvalReport, type EvalScore, type EvalScorer, type EvalScorerContext, type EvaluateBranchResult, type EvaluateContext, type EvaluateResult, type EventIdentity, ExecutableContract, type ExecutableTool, type ExecuteResult, type ExecutionReport, type ExecutionStatus, type ExportedPrompt, type ExportedPromptVersion, type ExportedRegistry, type ExtractJsonSchemaOptions, type FallbackAttempt, type FallbackModelContract, type FallbackModelOptions, type FallbackRetryPredicate, type FanOutOptions, type FanOutUnit, FinishReason, type FlagRecord, type FlowObserveOption, GeneratedAudio, GeneratedImage, type GuardOptions, type GuardrailAction, type GuardrailBlockEvent, type GuardrailCheck, type GuardrailCheckResult, type GuardrailDetector, type GuardrailDetectorContext, type GuardrailEscalation, type GuardrailFactory, type GuardrailMatch, type GuardrailOptions, type GuardrailPhase, type GuardrailVerdict, GuardrailViolationError, type GuardrailViolationErrorOptions, type HumanApprovalOptions, type HumanErrorCode, type ImageData, ImageGenerationOptions, ImageGenerationResponse, ImageModelConfig, ImageModelContract, ImageModelPricing, type ImageParams, type ImageReport, type ImageResult, ImageSource, type InjectionDetectorOptions, Instruction, InstructionContract, type IntentCallback, type IntentEntry, type IntentRunEntry, type IntentRunner, type IntentRunnerMap, type InterruptPolicy, type InterruptStore, InterruptSuspendedError, type InterruptSuspendedErrorOptions, InvalidRequestError, type IterationDecision, type IterationSnapshot, JUDGE_DEFAULT_REPAIR_ATTEMPTS, type JsonSchemaTarget, type JudgeAgentConfig, type JudgeConfig, type KeywordRerankerOptions, type LLMTrip, type LexicalDoc, type LineageStamp, type LlmRerankerOptions, type LoadHtmlOptions, type LoadPdfOptions, type LoadSkillInput, type LoadSkillResult, type LoadSkillToolDeps, type LoadTextOptions, type LoadWebOptions, type MatcherVerdict, MaxIterationsError, type MaxIterationsErrorOptions, MaxStepsExceededError, type MaxStepsExceededErrorOptions, type MemoryConfig, type MemoryContract, type MemoryItem, type MemoryTier, Message, type MiddlewareAgentRef, type MiddlewareContextByLevel, type MiddlewareExecuteContext, type MiddlewareLevel, type MiddlewareModelRef, type MiddlewareState, type MiddlewareSupervisorContext, type MiddlewareSupervisorRef, type MiddlewareToolContext, type MiddlewareTripContext, type MockImageCall, MockImageModel, type MockImageResponse, MockModel, type MockModelResponse, type MockRouterDecision, type MockRouterExhaustion, type MockRouterOptions, MockSDK, type MockSDKConfig, MockSkillsStore, type MockSpeechCall, MockSpeechModel, type MockSpeechResponse, type MockTranscriptionCall, MockTranscriptionModel, type MockTranscriptionResponse, ModelCallOptions, ModelCapabilities, ModelConfig, ModelContract, type ModelPricing, ModelResponse, ModelStreamChunk, ModelToolCallRequest, type MultiQueryOptions, type NamespacedStateAccessor, type Next, type NextStepResult, OPENAI_INSTALL_INSTRUCTIONS, type ObjectStreamEvent, type Observer, type OpenAiClientLike, type OpenAiModerationCreateBody, type OpenAiModerationOptions, type OpenAiModerationResponse, type OpenAiModerationResult, type OrchestratorAsToolOptions, type OrchestratorAwaitingStatus, OrchestratorCancelledError, type OrchestratorCancelledErrorOptions, type OrchestratorCommandHandlers, type OrchestratorCommands, type OrchestratorConfig, OrchestratorConfigError, type OrchestratorContract, OrchestratorDriftError, type OrchestratorDriftErrorOptions, OrchestratorEmitter, type OrchestratorEvent, type OrchestratorEventHandler, type OrchestratorEventHandlers, type OrchestratorEventMap, type OrchestratorEventName, type OrchestratorExecuteOptions, OrchestratorExecution, type OrchestratorExecutionParams, OrchestratorFailedError, type OrchestratorMemoryConfig, type OrchestratorReport, type OrchestratorReportStatus, type OrchestratorReportType, type OrchestratorResult, type OrchestratorResumeOptions, type OrchestratorSessionScope, type OrchestratorStreamController, type OutboundPolicy, OutboundPolicyError, PDF_PARSE_INSTALL_INSTRUCTIONS, type ParsedFrontmatter, type PendingInterrupt, type PendingInterruptStatus, Persona, PersonaContract, type PgCheckpointOptions, type PgClientLike, type PgInterruptOptions, type PgSnapshotStoreOptions, type PgVectorStoreInstance, type PgVectorStoreOptions, type PiiCategory, type PiiDetectorOptions, Placeholders, PlannerCancelledError, type PlannerCancelledErrorOptions, type PlannerCapability, type PlannerConfig, type PlannerContract, PlannerDriftError, type PlannerDriftErrorOptions, type PlannerExecuteOptions, PlannerFailedError, type PlannerPlan, PlannerPlanInvalidError, type PlannerReport, type PlannerReportType, type PlannerResult, type PlannerResumeOptions, type PlannerRunArgs, type PlannerSnapshot, type PlannerSnapshotStatus, type PlannerStep, type PlannerStepDirective, type PlannerStepSnapshot, type PolicyContext, type PolicyVerdict, type ProceduralMemoryConfig, type PromptDiff, type PromptDiffBlock, type PromptEntry, type PromptJudgeCacheLike, type PromptLangfuseSyncOptions, PromptNotFoundError, type PromptRegistryContract, type PromptRegistryOptions, type PromptResolveOptions, type PromptTemplateVersion, type PromptValidateOptions, type PromptValidateTarget, PromptValidationError, type PromptValidationNote, type PromptValidationReport, type PromptValidationResult, type PromptValidationSeverity, type PromptVersion, type PromptsManagerContract, type PromptsManagerEntry, type PromptsManagerOptions, type PromptsManagerRegisterOptions, type PromptsValidateOptions, ProviderAuthError, ProviderError, ProviderRateLimitError, type ProviderRateLimitErrorOptions, ProviderTimeoutError, QuotaExceededError, REPORT_SCHEMA_VERSION, type Rag, type RagAsToolOptions, type RagConfig, type RagDocument, type RagLoaderMetadata, type RagLoaderOptions, type RagLoaderResult, type RagLoaderType, type RagReranker, type RankedItem, ReasoningEffort, type RecallOptions, type RecalledMemory, type RedactOptions, type RedactedError, type RedisCheckpointOptions, type RedisClientLike, type RedisInterruptOptions, type RedisSnapshotStoreOptions, type ReportStatus, type ReportType, ResolvedAttachment, type ResolvedIntentEntry, type ResolvedOrchestratorMemory, type ResolvedOutboundPolicy, type ResolvedPrompt, type ResumeOptions, type ResumeResult, type RetrieveOptions, type RetrieveResult, type RetrievedChunk, type RetryBackoff, type RetryConfig, type ReviewOutcome, type RouteContext, type RouterConfig, type RouterEntry, type RouterIntents, type RouterOutput, RoutingError, type RoutingErrorOptions, type RunFrame, SDKAdapterContract, SENSITIVE_HEADERS, SSE_DONE, type SaveSkillInput, type SaveSkillResult, type SaveSkillToolDeps, SchemaValidationError, type SchemaValidationErrorOptions, type SemanticCacheOptions, type SemanticMemoryConfig, type ServableExecutable, type ServeOptions, type SessionContextOverrides, type SessionContract, type SessionLock, type SessionSendResult, type SkillAnalyticsEvent, type SkillCatalogEntry, type SkillInjectMode, type SkillRecord, type SkillReviewGate, type SkillSource, type SkillsConfig, type SkillsContract, type SkillsStoreContract, type SnapshotStore, type SpawnSubAgentSpec, type SpeechData, SpeechGenerationResponse, SpeechModelConfig, SpeechModelContract, SpeechModelPricing, SpeechOptions, type SpeechParams, type SpeechReport, type SpeechResult, type StepAgentInput, type StepDefinition, StepFailedError, type StepFailedErrorOptions, type StepLocalEvents, type StepOutputSpec, type StepSnapshot, StorageFileShape, type StreamContract, type StreamController, type StreamEvent, type StreamEventBody, type StreamLike, type StreamObjectParams, StreamingToolGuardConfig, type SummarizeCallback, type SummarizeConfig, type SupervisorAgentCompletedPayload, type SupervisorAgentFailedPayload, type SupervisorAgentStartingPayload, type SupervisorAgentStreamingPayload, type SupervisorAsToolOptions, SupervisorCancelledError, type SupervisorCancelledErrorOptions, type SupervisorCancelledPayload, type SupervisorCompletedPayload, type SupervisorConfig, type SupervisorContract, SupervisorDriftError, type SupervisorDriftErrorOptions, SupervisorEmitter, type SupervisorErrorPayload, type SupervisorEvaluateVerdictPayload, type SupervisorEventHandler, type SupervisorEventHandlers, type SupervisorEventMap, type SupervisorExecuteOptions, SupervisorExecution, SupervisorFailedError, type SupervisorInput, type SupervisorIntentValue, type SupervisorIterationCompletedPayload, type SupervisorIterationStartingPayload, type SupervisorReport, type SupervisorResult, type SupervisorResumeOptions, type SupervisorRouterDecidedPayload, type SupervisorRouterDecidingPayload, SupervisorRoutingError, type SupervisorRoutingErrorOptions, type SupervisorSnapshot, type SupervisorSnapshotStatus, type SupervisorStartingPayload, type SupervisorStreamController, type SupervisorStreamEvent, type SupervisorTerminatedBy, type SyncGuardrailDetector, SystemPrompt, SystemPromptBlockContract, SystemPromptContract, SystemPromptMergeOptions, SystemPromptMergeSource, SystemPromptMeta, type TeamConfig, type TeamGate, type TeamGateFn, type TeamMemberValue, type TextInput, type ToolCall, ToolConfig, ToolContext, type ToolContract, type ToolEventMeta, ToolExecutionError, type ToolExecutionErrorOptions, type ToolInvokeResult, ToolMeta, ToolMode, type TopicFilterOptions, TranscribeOptions, type TranscribeParams, type TranscriptionData, TranscriptionModelConfig, TranscriptionModelContract, TranscriptionModelPricing, type TranscriptionReport, TranscriptionResponse, type TranscriptionResult, TranscriptionSegment, type TurnSnapshot, type Usage, type UsageEvent, VcrCassetteMissError, type VcrCassetteMissErrorOptions, type VcrMode, type VcrModel, type VcrOptions, type VectorStore, type WithoutIdentity, WorkflowCancelledError, type WorkflowCancelledErrorOptions, type WorkflowCancelledPayload, type WorkflowCompletedPayload, type WorkflowContext, type WorkflowDefinition, WorkflowDriftError, type WorkflowDriftErrorOptions, WorkflowError, type WorkflowErrorPayload, type WorkflowEventHandler, type WorkflowEventHandlers, type WorkflowEventMap, type WorkflowExecuteOptions, type WorkflowInstance, type WorkflowLoopWarningPayload, type WorkflowReport, type WorkflowResult, type WorkflowResumeOptions, type WorkflowRunOptions, type WorkflowSnapshot, type WorkflowStartingPayload, type WorkflowStepCompletedPayload, type WorkflowStepFailedPayload, type WorkflowStepRetryingPayload, type WorkflowStepSkippedPayload, type WorkflowStepStartingPayload, type WorkflowStepStreamingPayload, accumulateCost, agent, ai, approximateTokenCount, assertUrlAllowed, audioFromBuffer, audioFromFile, audioMediaTypeForFilename, batch, bm25Rank, budget, buildCatalog, buildPlanSystemPrompt, buildRouterContextMessage, cacheVectorStore, captureChildReport, memory as checkpointMemory, pg as checkpointPg, redis as checkpointRedis, chunk, collectStreamObject, composeMiddleware, computeCost, computeImageCost, computeOrchestratorSignature, computeSignature as computePlannerSignature, computeSignature$1 as computeSignature, computeSignature$2 as computeSupervisorSignature, contains, createAgentStream, createCommandDispatcher as createOrchestratorCommandDispatcher, createOrchestratorStream, createCancelledError as createSupervisorCancelledError, createSupervisorStream, currentRunFrame, dataset, defaultPromptsManager, diff, directorySource, encodeSSE, evalScorers, evaluatePolicy, exact, executableToTool, extractJsonLenient, extractJsonPayload, extractJsonSchema, extractUserText, fallbackModel, fanOut, fetchTextWithPolicy, forTool, fromJSON, generateRunId, getAIConfig, getObservers, guard, guardedFetch, guardrail, hashRequest, humanApproval, hybridRank, image, inProcessSessionLock, injectMemories as injectOrchestratorMemories, injection, instruction, memory$1 as interruptMemory, pg$1 as interruptPg, redis$1 as interruptRedis, isExecutableTool, isObserveAll, isPrivateOrReservedIp, judge, keywordReranker, llmReranker, loadHtml, loadPdf, loadRecord, loadSkillTool, loadSnapshotForResume as loadSupervisorSnapshotForResume, loadText, loadWeb, matchConverge, matchOutputShape, matchPassStep, matchRouteTo, memory$2 as memory, mergeUsage, mockAgent, mockRouter, moderation, multiQuery, namespacedState, noopSessionLock, normalizeAgentTools, onConfigApplied, orchestrator, asTool as orchestratorAsTool, memoryQueryFromInput as orchestratorMemoryQueryFromInput, outcomeTextFromTurn as orchestratorOutcomeTextFromTurn, parseFrontmatter, parsePartialJson, parseTags, persistSupervisorSnapshot, persona, pgVectorStore, pii, planSchema, planner, predicate, prepareAttachmentPart, proceduralSkillStore, prompt, promptKey, prompts, rag, readBudgetFallbackSignal, readTextCapped, recallForTurn as recallOrchestratorMemory, reciprocalRankFusion, redact, redactError, redactHeaders, registerAiMatchers, registerObserver, rememberTurnOutcome as rememberOrchestratorTurnOutcome, renderCatalogPrompt, renderPlaceholders, resolveAttachment, resolveDefaultCheckpointStore, resolveDefaultSnapshotStore, resolveDefaultStore, resolveIntentEntries, resolveObservers, resolveOrchestratorMemory, resolveOutboundPolicy, resolveSource, resume, router, runEval, runResume as runOrchestratorResume, runTurn as runOrchestratorTurn, runPipeline, runReviewGate, safeJsonParse, saveSkillTool, scrubSecrets, semanticCache, semanticPreselect, serve, setAIConfig, setObserveAll, skills, memory$3 as snapshotMemory, pg$2 as snapshotPg, redis$2 as snapshotRedis, spawnSubAgent, speech, stampReportLineage, step, storeSource, streamObject, streamTurn as streamOrchestratorTurn, streamToSSE, supervisor, asTool$1 as supervisorAsTool, systemPrompt, team, toJSON, toJUnit, tool, topic, transcribe, urlSource, vcr, vectorLiteral, withRunFrame, withoutRunFrame, workflow };
|
|
291
313
|
import "./ai.mjs";
|
|
292
314
|
import "./config.mjs";
|
|
293
315
|
import "./testing/matchers.mjs";
|
package/esm/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AIError } from "./errors/ai-error.mjs";
|
|
2
2
|
import { AgentExecutionError } from "./errors/agent-execution-error.mjs";
|
|
3
3
|
import { AgentCancelledError } from "./errors/agent-cancelled-error.mjs";
|
|
4
|
+
import { AgentDriftError } from "./errors/agent-drift-error.mjs";
|
|
4
5
|
import { AgentMaxTripsError } from "./errors/agent-max-trips-error.mjs";
|
|
5
6
|
import { BudgetExceededError } from "./errors/budget-exceeded-error.mjs";
|
|
6
7
|
import { ProviderError } from "./errors/provider-error.mjs";
|
|
@@ -19,6 +20,7 @@ import { OrchestratorDriftError } from "./errors/orchestrator-drift-error.mjs";
|
|
|
19
20
|
import { OutboundPolicyError } from "./errors/outbound-policy-error.mjs";
|
|
20
21
|
import { PlannerFailedError } from "./errors/planner-failed-error.mjs";
|
|
21
22
|
import { PlannerCancelledError } from "./errors/planner-cancelled-error.mjs";
|
|
23
|
+
import { PlannerDriftError } from "./errors/planner-drift-error.mjs";
|
|
22
24
|
import { PlannerPlanInvalidError } from "./errors/planner-plan-invalid-error.mjs";
|
|
23
25
|
import { ProviderAuthError } from "./errors/provider-auth-error.mjs";
|
|
24
26
|
import { ProviderRateLimitError } from "./errors/provider-rate-limit-error.mjs";
|
|
@@ -108,6 +110,14 @@ import { memory as memory$1 } from "./human/stores/memory.mjs";
|
|
|
108
110
|
import { pg as pg$1 } from "./human/stores/pg.mjs";
|
|
109
111
|
import { redis as redis$1 } from "./human/stores/redis.mjs";
|
|
110
112
|
import "./human/stores/index.mjs";
|
|
113
|
+
import { computeImageCost } from "./image/image-cost.mjs";
|
|
114
|
+
import { image } from "./image/image.mjs";
|
|
115
|
+
import "./image/index.mjs";
|
|
116
|
+
import { speech } from "./speech/speech.mjs";
|
|
117
|
+
import "./speech/index.mjs";
|
|
118
|
+
import { audioFromBuffer, audioFromFile, audioMediaTypeForFilename } from "./transcribe/audio-input.mjs";
|
|
119
|
+
import { transcribe } from "./transcribe/transcribe.mjs";
|
|
120
|
+
import "./transcribe/index.mjs";
|
|
111
121
|
import { injection } from "./guard/detectors/injection.mjs";
|
|
112
122
|
import { pii } from "./guard/detectors/pii.mjs";
|
|
113
123
|
import { topic } from "./guard/detectors/topic.mjs";
|
|
@@ -116,7 +126,10 @@ import { moderation } from "./guard/detectors/moderation.mjs";
|
|
|
116
126
|
import "./guard/detectors/index.mjs";
|
|
117
127
|
import { guard } from "./guard/guard.mjs";
|
|
118
128
|
import { guardrail } from "./guard/guardrail.mjs";
|
|
129
|
+
import { MockImageModel } from "./mock/mock-image-model.mjs";
|
|
119
130
|
import { MockModel } from "./mock/mock-model.mjs";
|
|
131
|
+
import { MockSpeechModel } from "./mock/mock-speech-model.mjs";
|
|
132
|
+
import { MockTranscriptionModel } from "./mock/mock-transcription-model.mjs";
|
|
120
133
|
import { MockSDK } from "./mock/mock-sdk.mjs";
|
|
121
134
|
import { mockAgent } from "./mock/mock-agent.mjs";
|
|
122
135
|
import { END } from "./contracts/end.type.mjs";
|
|
@@ -157,6 +170,12 @@ import { defaultPromptsManager, promptKey, prompts } from "./prompts/prompts-man
|
|
|
157
170
|
import { chunk } from "./rag/chunk/chunk.mjs";
|
|
158
171
|
import { cacheVectorStore } from "./rag/store/cache-vector-store.mjs";
|
|
159
172
|
import { rag } from "./rag/rag.mjs";
|
|
173
|
+
import { pgVectorStore, vectorLiteral } from "./rag/store/pg-vector-store.mjs";
|
|
174
|
+
import { loadText } from "./rag/loaders/load-text.mjs";
|
|
175
|
+
import { loadHtml } from "./rag/loaders/load-html.mjs";
|
|
176
|
+
import { loadWeb } from "./rag/loaders/load-web.mjs";
|
|
177
|
+
import { PDF_PARSE_INSTALL_INSTRUCTIONS } from "./rag/loaders/errors.mjs";
|
|
178
|
+
import { loadPdf } from "./rag/loaders/load-pdf.mjs";
|
|
160
179
|
import { keywordReranker } from "./rag/rerank/keyword-reranker.mjs";
|
|
161
180
|
import { llmReranker } from "./rag/rerank/llm-reranker.mjs";
|
|
162
181
|
import { reciprocalRankFusion } from "./rag/hybrid/rrf.mjs";
|
|
@@ -193,4 +212,4 @@ import "./workflow/index.mjs";
|
|
|
193
212
|
import { matchConverge, matchOutputShape, matchPassStep, matchRouteTo } from "./testing/matcher-logic.mjs";
|
|
194
213
|
import { registerAiMatchers } from "./testing/register-lazy.mjs";
|
|
195
214
|
|
|
196
|
-
export { AIError, AgentCancelledError, AgentExecutionError, AgentMaxTripsError, ApprovalRejectedError, BudgetExceededError, ContentFilterError, ContextLengthExceededError, DEFAULT_HASH_OPTIONS, DEFAULT_SENSITIVE_KEYS, END, GuardrailViolationError, Instruction, InterruptSuspendedError, InvalidRequestError, JUDGE_DEFAULT_REPAIR_ATTEMPTS, MaxIterationsError, MaxStepsExceededError, MockModel, MockSDK, MockSkillsStore, OPENAI_INSTALL_INSTRUCTIONS, OrchestratorCancelledError, OrchestratorConfigError, OrchestratorDriftError, OrchestratorEmitter, OrchestratorExecution, OrchestratorFailedError, OutboundPolicyError, Persona, PlannerCancelledError, PlannerFailedError, PlannerPlanInvalidError, PromptNotFoundError, PromptValidationError, ProviderAuthError, ProviderError, ProviderRateLimitError, ProviderTimeoutError, QuotaExceededError, REPORT_SCHEMA_VERSION, RoutingError, SENSITIVE_HEADERS, SSE_DONE, SchemaValidationError, StepFailedError, SupervisorCancelledError, SupervisorDriftError, SupervisorEmitter, SupervisorExecution, SupervisorFailedError, SupervisorRoutingError, SystemPrompt, ToolExecutionError, VcrCassetteMissError, WorkflowCancelledError, WorkflowDriftError, WorkflowError, accumulateCost, agent, ai, approximateTokenCount, assertUrlAllowed, batch, bm25Rank, budget, buildCatalog, buildPlanSystemPrompt, buildRouterContextMessage, cacheVectorStore, captureChildReport, memory as checkpointMemory, pg as checkpointPg, redis as checkpointRedis, chunk, collectStreamObject, composeMiddleware, computeCost, computeOrchestratorSignature, computeSignature as computePlannerSignature, computeSignature$1 as computeSignature, computeSignature$2 as computeSupervisorSignature, contains, createAgentStream, createCommandDispatcher as createOrchestratorCommandDispatcher, createOrchestratorStream, createCancelledError as createSupervisorCancelledError, createSupervisorStream, currentRunFrame, dataset, defaultPromptsManager, diff, directorySource, encodeSSE, evalScorers, evaluatePolicy, exact, executableToTool, extractJsonLenient, extractJsonPayload, extractJsonSchema, extractUserText, fallbackModel, fanOut, fetchTextWithPolicy, forTool, fromJSON, generateRunId, getAIConfig, getObservers, guard, guardedFetch, guardrail, hashRequest, humanApproval, hybridRank, inProcessSessionLock, injectMemories as injectOrchestratorMemories, injection, instruction, memory$1 as interruptMemory, pg$1 as interruptPg, redis$1 as interruptRedis, isExecutableTool, isObserveAll, isPrivateOrReservedIp, judge, keywordReranker, llmReranker, loadRecord, loadSkillTool, loadSnapshotForResume as loadSupervisorSnapshotForResume, matchConverge, matchOutputShape, matchPassStep, matchRouteTo, memory$2 as memory, mergeUsage, mockAgent, mockRouter, moderation, multiQuery, namespacedState, noopSessionLock, normalizeAgentTools, onConfigApplied, orchestrator, asTool as orchestratorAsTool, memoryQueryFromInput as orchestratorMemoryQueryFromInput, outcomeTextFromTurn as orchestratorOutcomeTextFromTurn, parseFrontmatter, parsePartialJson, parseTags, persistSupervisorSnapshot, persona, pii, planSchema, planner, predicate, prepareAttachmentPart, proceduralSkillStore, prompt, promptKey, prompts, rag, readBudgetFallbackSignal, readTextCapped, recallForTurn as recallOrchestratorMemory, reciprocalRankFusion, redact, redactError, redactHeaders, registerAiMatchers, registerObserver, rememberTurnOutcome as rememberOrchestratorTurnOutcome, renderCatalogPrompt, renderPlaceholders, resolveAttachment, resolveDefaultCheckpointStore, resolveDefaultSnapshotStore, resolveDefaultStore, resolveIntentEntries, resolveObservers, resolveOrchestratorMemory, resolveOutboundPolicy, resolveSource, resume, router, runEval, runResume as runOrchestratorResume, runTurn as runOrchestratorTurn, runPipeline, runReviewGate, safeJsonParse, saveSkillTool, scrubSecrets, semanticCache, semanticPreselect, serve, setAIConfig, setObserveAll, skills, memory$3 as snapshotMemory, pg$2 as snapshotPg, redis$2 as snapshotRedis, spawnSubAgent, stampReportLineage, step, storeSource, streamObject, streamTurn as streamOrchestratorTurn, streamToSSE, supervisor, asTool$1 as supervisorAsTool, systemPrompt, team, toJSON, toJUnit, tool, topic, urlSource, vcr, withRunFrame, withoutRunFrame, workflow };
|
|
215
|
+
export { AIError, AgentCancelledError, AgentDriftError, AgentExecutionError, AgentMaxTripsError, ApprovalRejectedError, BudgetExceededError, ContentFilterError, ContextLengthExceededError, DEFAULT_HASH_OPTIONS, DEFAULT_SENSITIVE_KEYS, END, GuardrailViolationError, Instruction, InterruptSuspendedError, InvalidRequestError, JUDGE_DEFAULT_REPAIR_ATTEMPTS, MaxIterationsError, MaxStepsExceededError, MockImageModel, MockModel, MockSDK, MockSkillsStore, MockSpeechModel, MockTranscriptionModel, OPENAI_INSTALL_INSTRUCTIONS, OrchestratorCancelledError, OrchestratorConfigError, OrchestratorDriftError, OrchestratorEmitter, OrchestratorExecution, OrchestratorFailedError, OutboundPolicyError, PDF_PARSE_INSTALL_INSTRUCTIONS, Persona, PlannerCancelledError, PlannerDriftError, PlannerFailedError, PlannerPlanInvalidError, PromptNotFoundError, PromptValidationError, ProviderAuthError, ProviderError, ProviderRateLimitError, ProviderTimeoutError, QuotaExceededError, REPORT_SCHEMA_VERSION, RoutingError, SENSITIVE_HEADERS, SSE_DONE, SchemaValidationError, StepFailedError, SupervisorCancelledError, SupervisorDriftError, SupervisorEmitter, SupervisorExecution, SupervisorFailedError, SupervisorRoutingError, SystemPrompt, ToolExecutionError, VcrCassetteMissError, WorkflowCancelledError, WorkflowDriftError, WorkflowError, accumulateCost, agent, ai, approximateTokenCount, assertUrlAllowed, audioFromBuffer, audioFromFile, audioMediaTypeForFilename, batch, bm25Rank, budget, buildCatalog, buildPlanSystemPrompt, buildRouterContextMessage, cacheVectorStore, captureChildReport, memory as checkpointMemory, pg as checkpointPg, redis as checkpointRedis, chunk, collectStreamObject, composeMiddleware, computeCost, computeImageCost, computeOrchestratorSignature, computeSignature as computePlannerSignature, computeSignature$1 as computeSignature, computeSignature$2 as computeSupervisorSignature, contains, createAgentStream, createCommandDispatcher as createOrchestratorCommandDispatcher, createOrchestratorStream, createCancelledError as createSupervisorCancelledError, createSupervisorStream, currentRunFrame, dataset, defaultPromptsManager, diff, directorySource, encodeSSE, evalScorers, evaluatePolicy, exact, executableToTool, extractJsonLenient, extractJsonPayload, extractJsonSchema, extractUserText, fallbackModel, fanOut, fetchTextWithPolicy, forTool, fromJSON, generateRunId, getAIConfig, getObservers, guard, guardedFetch, guardrail, hashRequest, humanApproval, hybridRank, image, inProcessSessionLock, injectMemories as injectOrchestratorMemories, injection, instruction, memory$1 as interruptMemory, pg$1 as interruptPg, redis$1 as interruptRedis, isExecutableTool, isObserveAll, isPrivateOrReservedIp, judge, keywordReranker, llmReranker, loadHtml, loadPdf, loadRecord, loadSkillTool, loadSnapshotForResume as loadSupervisorSnapshotForResume, loadText, loadWeb, matchConverge, matchOutputShape, matchPassStep, matchRouteTo, memory$2 as memory, mergeUsage, mockAgent, mockRouter, moderation, multiQuery, namespacedState, noopSessionLock, normalizeAgentTools, onConfigApplied, orchestrator, asTool as orchestratorAsTool, memoryQueryFromInput as orchestratorMemoryQueryFromInput, outcomeTextFromTurn as orchestratorOutcomeTextFromTurn, parseFrontmatter, parsePartialJson, parseTags, persistSupervisorSnapshot, persona, pgVectorStore, pii, planSchema, planner, predicate, prepareAttachmentPart, proceduralSkillStore, prompt, promptKey, prompts, rag, readBudgetFallbackSignal, readTextCapped, recallForTurn as recallOrchestratorMemory, reciprocalRankFusion, redact, redactError, redactHeaders, registerAiMatchers, registerObserver, rememberTurnOutcome as rememberOrchestratorTurnOutcome, renderCatalogPrompt, renderPlaceholders, resolveAttachment, resolveDefaultCheckpointStore, resolveDefaultSnapshotStore, resolveDefaultStore, resolveIntentEntries, resolveObservers, resolveOrchestratorMemory, resolveOutboundPolicy, resolveSource, resume, router, runEval, runResume as runOrchestratorResume, runTurn as runOrchestratorTurn, runPipeline, runReviewGate, safeJsonParse, saveSkillTool, scrubSecrets, semanticCache, semanticPreselect, serve, setAIConfig, setObserveAll, skills, memory$3 as snapshotMemory, pg$2 as snapshotPg, redis$2 as snapshotRedis, spawnSubAgent, speech, stampReportLineage, step, storeSource, streamObject, streamTurn as streamOrchestratorTurn, streamToSSE, supervisor, asTool$1 as supervisorAsTool, systemPrompt, team, toJSON, toJUnit, tool, topic, transcribe, urlSource, vcr, vectorLiteral, withRunFrame, withoutRunFrame, workflow };
|
package/esm/mock/index.d.mts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { MockImageCall, MockImageModel, MockImageResponse } from "./mock-image-model.mjs";
|
|
2
|
+
import { MockSpeechCall, MockSpeechModel, MockSpeechResponse } from "./mock-speech-model.mjs";
|
|
3
|
+
import { MockTranscriptionCall, MockTranscriptionModel, MockTranscriptionResponse } from "./mock-transcription-model.mjs";
|
|
1
4
|
import { MockModelResponse, MockSDKConfig } from "./mock-config.type.mjs";
|
|
2
5
|
import { mockAgent } from "./mock-agent.mjs";
|
|
3
6
|
import { MockModel } from "./mock-model.mjs";
|
package/esm/mock/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { MockImageModel } from "./mock-image-model.mjs";
|
|
1
2
|
import { MockModel } from "./mock-model.mjs";
|
|
3
|
+
import { MockSpeechModel } from "./mock-speech-model.mjs";
|
|
4
|
+
import { MockTranscriptionModel } from "./mock-transcription-model.mjs";
|
|
2
5
|
import { MockSDK } from "./mock-sdk.mjs";
|
|
3
6
|
import { mockAgent } from "./mock-agent.mjs";
|
|
4
7
|
import { mockRouter } from "./mock-router.mjs";
|
|
@@ -2,6 +2,13 @@ import { ModelToolCallRequest } from "../contracts/model-tool-call-request.type.
|
|
|
2
2
|
import { Usage } from "../contracts/result/usage.type.mjs";
|
|
3
3
|
import { FinishReason } from "../contracts/finish-reason.type.mjs";
|
|
4
4
|
import { ModelCapabilities } from "../contracts/model.contract.mjs";
|
|
5
|
+
import { ImageModelPricing } from "../contracts/image-model.contract.mjs";
|
|
6
|
+
import { SpeechModelPricing } from "../contracts/speech-model.contract.mjs";
|
|
7
|
+
import { TranscriptionModelPricing } from "../contracts/transcription-model.contract.mjs";
|
|
8
|
+
import { MockImageResponse } from "./mock-image-model.mjs";
|
|
9
|
+
import { MockSpeechResponse } from "./mock-speech-model.mjs";
|
|
10
|
+
import { MockTranscriptionResponse } from "./mock-transcription-model.mjs";
|
|
11
|
+
|
|
5
12
|
//#region ../@warlock.js/ai/src/mock/mock-config.type.d.ts
|
|
6
13
|
/**
|
|
7
14
|
* Configuration for a single mock model response.
|
|
@@ -25,6 +32,21 @@ type MockSDKConfig = {
|
|
|
25
32
|
* a real provider.
|
|
26
33
|
*/
|
|
27
34
|
capabilities?: ModelCapabilities;
|
|
35
|
+
/**
|
|
36
|
+
* Scripted responses for `image()` models this mock SDK creates,
|
|
37
|
+
* consumed in sequence (last repeats when exhausted). Omitted = a
|
|
38
|
+
* single default 1×1 PNG.
|
|
39
|
+
*/
|
|
40
|
+
imageResponses?: MockImageResponse[];
|
|
41
|
+
/**
|
|
42
|
+
* Pricing stamped on every `image()` model this mock SDK creates, so
|
|
43
|
+
* tests can exercise the per-image / per-token cost rollup.
|
|
44
|
+
*/
|
|
45
|
+
imagePricing?: ImageModelPricing; /** Scripted responses for `speech()` (TTS) models. Omitted = a default audio blob. */
|
|
46
|
+
speechResponses?: MockSpeechResponse[]; /** Pricing stamped on every `speech()` model — exercise the per-character / per-token rollup. */
|
|
47
|
+
speechPricing?: SpeechModelPricing; /** Scripted responses for `transcribe()` (STT) models. Omitted = a default transcript. */
|
|
48
|
+
transcriptionResponses?: MockTranscriptionResponse[]; /** Pricing stamped on every `transcribe()` model — exercise the per-minute / per-token rollup. */
|
|
49
|
+
transcriptionPricing?: TranscriptionModelPricing;
|
|
28
50
|
};
|
|
29
51
|
//#endregion
|
|
30
52
|
export { MockModelResponse, MockSDKConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-config.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-config.type.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock-config.type.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-config.type.ts"],"mappings":";;;;;;;;;;;;;;;AAeA;KAAY,iBAAA;EACV,OAAA;EACA,YAAA,GAAe,YAAA;EACf,KAAA,GAAQ,KAAA;EACR,SAAA,GAAY,oBAAA,IAIJ;EAFR,KAAA,WAEa;EAAb,KAAA,GAAQ,KAAA;AAAA;AAAA,KAGE,aAAA;EARV,wEAUA,SAAA,GAAY,iBAAA,IATZ;EAWA,gBAAA;EATA;;;;AAEa;AAGf;EAWE,YAAA,GAAe,iBAAA;;;;;;EAMf,cAAA,GAAiB,iBAAA;EASD;;;;EAJhB,YAAA,GAAe,iBAAA,EApBf;EAsBA,eAAA,GAAkB,kBAAA,IApBlB;EAsBA,aAAA,GAAgB,kBAAA,EAfD;EAiBf,sBAAA,GAAyB,yBAAA,IAXR;EAajB,oBAAA,GAAuB,yBAAA;AAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Usage } from "../contracts/result/usage.type.mjs";
|
|
2
|
+
import { GeneratedImage, ImageGenerationOptions, ImageGenerationResponse, ImageModelContract, ImageModelPricing } from "../contracts/image-model.contract.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../@warlock.js/ai/src/mock/mock-image-model.d.ts
|
|
5
|
+
/** One scripted response for a {@link MockImageModel}. */
|
|
6
|
+
type MockImageResponse = {
|
|
7
|
+
/** Images to return; defaults to a single 1×1 transparent PNG. */images?: GeneratedImage[]; /** Token usage to report; defaults to all-zero (per-image-metered). */
|
|
8
|
+
usage?: Usage; /** Throw this instead of returning — drives the never-throws/error path. */
|
|
9
|
+
error?: Error; /** Simulate latency before resolving/rejecting (ms). */
|
|
10
|
+
delay?: number;
|
|
11
|
+
};
|
|
12
|
+
/** One recorded `generate()` invocation, for test assertions. */
|
|
13
|
+
type MockImageCall = {
|
|
14
|
+
prompt: string;
|
|
15
|
+
options: ImageGenerationOptions | undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Deterministic {@link ImageModelContract} double for tests — no HTTP.
|
|
19
|
+
* Scripts responses in sequence (the last repeats once exhausted),
|
|
20
|
+
* records every call, and can be primed with pricing to exercise the
|
|
21
|
+
* cost rollup. Mirrors {@link MockModel} for the image path.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const model = new MockImageModel("mock-image", [{ usage: { input: 0, output: 0, total: 0 } }], {
|
|
25
|
+
* perImage: 0.04,
|
|
26
|
+
* });
|
|
27
|
+
* const { data, usage } = await ai.image({ model, prompt: "a cat" });
|
|
28
|
+
*/
|
|
29
|
+
declare class MockImageModel implements ImageModelContract {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
private readonly responses;
|
|
32
|
+
readonly pricing?: ImageModelPricing | undefined;
|
|
33
|
+
readonly provider = "mock";
|
|
34
|
+
readonly calls: MockImageCall[];
|
|
35
|
+
private callIndex;
|
|
36
|
+
constructor(name: string, responses: MockImageResponse[], pricing?: ImageModelPricing | undefined);
|
|
37
|
+
generate(prompt: string, options?: ImageGenerationOptions): Promise<ImageGenerationResponse>;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { MockImageCall, MockImageModel, MockImageResponse };
|
|
41
|
+
//# sourceMappingURL=mock-image-model.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-image-model.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-image-model.ts"],"mappings":";;;;;KAUY,iBAAA;EAAA,kEAEV,MAAA,GAAS,cAAA;EAET,KAAA,GAAQ,KAAA,EAAA;EAER,KAAA,GAAQ,KAAA,EAAK;EAEb,KAAA;AAAA;;KAIU,aAAA;EACV,MAAA;EACA,OAAA,EAAS,sBAAsB;AAAA;;;AAN1B;AAIP;;;;;;;;AAEiC;cAmBpB,cAAA,YAA0B,kBAAA;EAAA,SAOnB,IAAA;EAAA,iBACC,SAAA;EAAA,SACD,OAAA,GAAU,iBAAA;EAAA,SARZ,QAAA;EAAA,SACA,KAAA,EAAO,aAAA;EAAA,QAEf,SAAA;cAGU,IAAA,UACC,SAAA,EAAW,iBAAA,IACZ,OAAA,GAAU,iBAAA;EAGf,QAAA,CACX,MAAA,UACA,OAAA,GAAU,sBAAA,GACT,OAAA,CAAQ,uBAAA;AAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region ../@warlock.js/ai/src/mock/mock-image-model.ts
|
|
2
|
+
/** A 1×1 transparent PNG — the default mock image payload. */
|
|
3
|
+
const TRANSPARENT_PNG_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";
|
|
4
|
+
/**
|
|
5
|
+
* Deterministic {@link ImageModelContract} double for tests — no HTTP.
|
|
6
|
+
* Scripts responses in sequence (the last repeats once exhausted),
|
|
7
|
+
* records every call, and can be primed with pricing to exercise the
|
|
8
|
+
* cost rollup. Mirrors {@link MockModel} for the image path.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const model = new MockImageModel("mock-image", [{ usage: { input: 0, output: 0, total: 0 } }], {
|
|
12
|
+
* perImage: 0.04,
|
|
13
|
+
* });
|
|
14
|
+
* const { data, usage } = await ai.image({ model, prompt: "a cat" });
|
|
15
|
+
*/
|
|
16
|
+
var MockImageModel = class {
|
|
17
|
+
constructor(name, responses, pricing) {
|
|
18
|
+
this.name = name;
|
|
19
|
+
this.responses = responses;
|
|
20
|
+
this.pricing = pricing;
|
|
21
|
+
this.provider = "mock";
|
|
22
|
+
this.calls = [];
|
|
23
|
+
this.callIndex = 0;
|
|
24
|
+
}
|
|
25
|
+
async generate(prompt, options) {
|
|
26
|
+
this.calls.push({
|
|
27
|
+
prompt,
|
|
28
|
+
options
|
|
29
|
+
});
|
|
30
|
+
const response = this.responses[Math.min(this.callIndex, this.responses.length - 1)] ?? {};
|
|
31
|
+
this.callIndex += 1;
|
|
32
|
+
if (response.delay) await new Promise((resolve) => setTimeout(resolve, response.delay));
|
|
33
|
+
if (response.error) throw response.error;
|
|
34
|
+
const count = options?.count ?? 1;
|
|
35
|
+
return {
|
|
36
|
+
images: response.images ?? Array.from({ length: count }, () => ({
|
|
37
|
+
type: "base64",
|
|
38
|
+
base64: TRANSPARENT_PNG_BASE64,
|
|
39
|
+
mediaType: "image/png"
|
|
40
|
+
})),
|
|
41
|
+
usage: response.usage ?? {
|
|
42
|
+
input: 0,
|
|
43
|
+
output: 0,
|
|
44
|
+
total: 0
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { MockImageModel };
|
|
52
|
+
//# sourceMappingURL=mock-image-model.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-image-model.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-image-model.ts"],"sourcesContent":["import type {\n GeneratedImage,\n ImageGenerationOptions,\n ImageGenerationResponse,\n ImageModelContract,\n ImageModelPricing,\n} from \"../contracts/image-model.contract\";\nimport type { Usage } from \"../contracts/result/usage.type\";\n\n/** One scripted response for a {@link MockImageModel}. */\nexport type MockImageResponse = {\n /** Images to return; defaults to a single 1×1 transparent PNG. */\n images?: GeneratedImage[];\n /** Token usage to report; defaults to all-zero (per-image-metered). */\n usage?: Usage;\n /** Throw this instead of returning — drives the never-throws/error path. */\n error?: Error;\n /** Simulate latency before resolving/rejecting (ms). */\n delay?: number;\n};\n\n/** One recorded `generate()` invocation, for test assertions. */\nexport type MockImageCall = {\n prompt: string;\n options: ImageGenerationOptions | undefined;\n};\n\n/** A 1×1 transparent PNG — the default mock image payload. */\nconst TRANSPARENT_PNG_BASE64 =\n \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==\";\n\n/**\n * Deterministic {@link ImageModelContract} double for tests — no HTTP.\n * Scripts responses in sequence (the last repeats once exhausted),\n * records every call, and can be primed with pricing to exercise the\n * cost rollup. Mirrors {@link MockModel} for the image path.\n *\n * @example\n * const model = new MockImageModel(\"mock-image\", [{ usage: { input: 0, output: 0, total: 0 } }], {\n * perImage: 0.04,\n * });\n * const { data, usage } = await ai.image({ model, prompt: \"a cat\" });\n */\nexport class MockImageModel implements ImageModelContract {\n public readonly provider = \"mock\";\n public readonly calls: MockImageCall[] = [];\n\n private callIndex = 0;\n\n public constructor(\n public readonly name: string,\n private readonly responses: MockImageResponse[],\n public readonly pricing?: ImageModelPricing,\n ) {}\n\n public async generate(\n prompt: string,\n options?: ImageGenerationOptions,\n ): Promise<ImageGenerationResponse> {\n this.calls.push({ prompt, options });\n\n const response = this.responses[Math.min(this.callIndex, this.responses.length - 1)] ?? {};\n this.callIndex += 1;\n\n if (response.delay) {\n await new Promise((resolve) => setTimeout(resolve, response.delay));\n }\n\n if (response.error) {\n throw response.error;\n }\n\n const count = options?.count ?? 1;\n const images: GeneratedImage[] =\n response.images ??\n Array.from({ length: count }, () => ({\n type: \"base64\" as const,\n base64: TRANSPARENT_PNG_BASE64,\n mediaType: \"image/png\",\n }));\n\n return {\n images,\n usage: response.usage ?? { input: 0, output: 0, total: 0 },\n };\n }\n}\n"],"mappings":";;AA4BA,MAAM,yBACJ;;;;;;;;;;;;;AAcF,IAAa,iBAAb,MAA0D;CAMxD,AAAO,YACL,AAAgB,MAChB,AAAiB,WACjB,AAAgB,SAChB;EAHgB;EACC;EACD;kBARS;eACc,CAAC;mBAEtB;CAMjB;CAEH,MAAa,SACX,QACA,SACkC;EAClC,KAAK,MAAM,KAAK;GAAE;GAAQ;EAAQ,CAAC;EAEnC,MAAM,WAAW,KAAK,UAAU,KAAK,IAAI,KAAK,WAAW,KAAK,UAAU,SAAS,CAAC,MAAM,CAAC;EACzF,KAAK,aAAa;EAElB,IAAI,SAAS,OACX,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,SAAS,KAAK,CAAC;EAGpE,IAAI,SAAS,OACX,MAAM,SAAS;EAGjB,MAAM,QAAQ,SAAS,SAAS;EAShC,OAAO;GACL,QARA,SAAS,UACT,MAAM,KAAK,EAAE,QAAQ,MAAM,UAAU;IACnC,MAAM;IACN,QAAQ;IACR,WAAW;GACb,EAAE;GAIF,OAAO,SAAS,SAAS;IAAE,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAC3D;CACF;AACF"}
|
package/esm/mock/mock-sdk.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { SDKAdapterContract } from "../contracts/sdk-adapter.contract.mjs";
|
|
2
|
+
import { MockImageModel } from "./mock-image-model.mjs";
|
|
3
|
+
import { MockSpeechModel } from "./mock-speech-model.mjs";
|
|
4
|
+
import { MockTranscriptionModel } from "./mock-transcription-model.mjs";
|
|
2
5
|
import { MockSDKConfig } from "./mock-config.type.mjs";
|
|
3
6
|
import { MockModel } from "./mock-model.mjs";
|
|
4
7
|
|
|
@@ -18,7 +21,10 @@ import { MockModel } from "./mock-model.mjs";
|
|
|
18
21
|
* console.log(result.content); // "Hello from mock!"
|
|
19
22
|
*/
|
|
20
23
|
declare function MockSDK(config?: MockSDKConfig): SDKAdapterContract & {
|
|
21
|
-
/** All model instances created by this SDK — for inspecting calls in tests */models: MockModel[];
|
|
24
|
+
/** All model instances created by this SDK — for inspecting calls in tests */models: MockModel[]; /** All image-model instances created by this SDK — for inspecting calls in tests */
|
|
25
|
+
imageModels: MockImageModel[]; /** All speech-model instances created by this SDK — for inspecting calls in tests */
|
|
26
|
+
speechModels: MockSpeechModel[]; /** All transcription-model instances created by this SDK — for inspecting calls in tests */
|
|
27
|
+
transcriptionModels: MockTranscriptionModel[];
|
|
22
28
|
};
|
|
23
29
|
//#endregion
|
|
24
30
|
export { MockSDK };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-sdk.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-sdk.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock-sdk.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-sdk.ts"],"mappings":";;;;;;;;;;AA4BA;;;;;;;;;;;;iBAAgB,OAAA,CAAQ,MAAA,GAAQ,aAAA,GAAqB,kBAAA;EAAA,8EAEnD,MAAA,EAAQ,SAAA,IAAA;EAER,WAAA,EAAa,cAAA,IAAA;EAEb,YAAA,EAAc,eAAA,IAAA;EAEd,mBAAA,EAAqB,sBAAA;AAAA"}
|
package/esm/mock/mock-sdk.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { approximateTokenCount } from "../utils/token-count.mjs";
|
|
2
|
+
import { MockImageModel } from "./mock-image-model.mjs";
|
|
2
3
|
import { MockModel } from "./mock-model.mjs";
|
|
4
|
+
import { MockSpeechModel } from "./mock-speech-model.mjs";
|
|
5
|
+
import { MockTranscriptionModel } from "./mock-transcription-model.mjs";
|
|
3
6
|
|
|
4
7
|
//#region ../@warlock.js/ai/src/mock/mock-sdk.ts
|
|
5
8
|
/**
|
|
@@ -18,14 +21,38 @@ import { MockModel } from "./mock-model.mjs";
|
|
|
18
21
|
*/
|
|
19
22
|
function MockSDK(config = {}) {
|
|
20
23
|
const models = [];
|
|
24
|
+
const imageModels = [];
|
|
25
|
+
const speechModels = [];
|
|
26
|
+
const transcriptionModels = [];
|
|
21
27
|
const responses = config.responses ?? [{ content: "Mock response" }];
|
|
28
|
+
const imageResponses = config.imageResponses ?? [{}];
|
|
29
|
+
const speechResponses = config.speechResponses ?? [{}];
|
|
30
|
+
const transcriptionResponses = config.transcriptionResponses ?? [{}];
|
|
22
31
|
return {
|
|
23
32
|
models,
|
|
33
|
+
imageModels,
|
|
34
|
+
speechModels,
|
|
35
|
+
transcriptionModels,
|
|
24
36
|
model(modelConfig) {
|
|
25
37
|
const model = new MockModel(modelConfig.name ?? config.defaultModelName ?? "mock-model", responses, config.capabilities);
|
|
26
38
|
models.push(model);
|
|
27
39
|
return model;
|
|
28
40
|
},
|
|
41
|
+
image(imageConfig) {
|
|
42
|
+
const model = new MockImageModel(imageConfig.name ?? config.defaultModelName ?? "mock-image-model", imageResponses, imageConfig.pricing ?? config.imagePricing);
|
|
43
|
+
imageModels.push(model);
|
|
44
|
+
return model;
|
|
45
|
+
},
|
|
46
|
+
speech(speechConfig) {
|
|
47
|
+
const model = new MockSpeechModel(speechConfig.name ?? config.defaultModelName ?? "mock-speech-model", speechResponses, speechConfig.pricing ?? config.speechPricing);
|
|
48
|
+
speechModels.push(model);
|
|
49
|
+
return model;
|
|
50
|
+
},
|
|
51
|
+
transcribe(transcribeConfig) {
|
|
52
|
+
const model = new MockTranscriptionModel(transcribeConfig.name ?? config.defaultModelName ?? "mock-transcription-model", transcriptionResponses, transcribeConfig.pricing ?? config.transcriptionPricing);
|
|
53
|
+
transcriptionModels.push(model);
|
|
54
|
+
return model;
|
|
55
|
+
},
|
|
29
56
|
async count(text, _model) {
|
|
30
57
|
return approximateTokenCount(text);
|
|
31
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-sdk.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-sdk.ts"],"sourcesContent":["import type {\n ModelConfig,\n SDKAdapterContract,\n} from \"../contracts/sdk-adapter.contract\";\nimport { approximateTokenCount } from \"../utils/token-count\";\nimport type { MockSDKConfig } from \"./mock-config.type\";\nimport { MockModel } from \"./mock-model\";\n\n/**\n * Creates a mock SDK adapter for testing — no HTTP calls, fully configurable.\n *\n * @example\n * const mock = MockSDK({\n * responses: [\n * { content: \"Hello from mock!\" },\n * { content: \"Second response\" },\n * ],\n * });\n * const model = mock.model({ name: \"gpt-4o\" });\n * const result = await model.complete([{ role: \"user\", content: \"Hi\" }]);\n * console.log(result.content); // \"Hello from mock!\"\n */\nexport function MockSDK(config: MockSDKConfig = {}): SDKAdapterContract & {\n /** All model instances created by this SDK — for inspecting calls in tests */\n models: MockModel[];\n} {\n const models: MockModel[] = [];\n const responses = config.responses ?? [{ content: \"Mock response\" }];\n\n return {\n models,\n model(modelConfig: ModelConfig) {\n const model = new MockModel(\n modelConfig.name ?? config.defaultModelName ?? \"mock-model\",\n responses,\n config.capabilities,\n );\n models.push(model);\n return model;\n },\n async count(text: string, _model?: string): Promise<number> {\n return approximateTokenCount(text);\n },\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock-sdk.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-sdk.ts"],"sourcesContent":["import type { ImageModelConfig } from \"../contracts/image-model.contract\";\nimport type {\n ModelConfig,\n SDKAdapterContract,\n} from \"../contracts/sdk-adapter.contract\";\nimport type { SpeechModelConfig } from \"../contracts/speech-model.contract\";\nimport type { TranscriptionModelConfig } from \"../contracts/transcription-model.contract\";\nimport { approximateTokenCount } from \"../utils/token-count\";\nimport type { MockSDKConfig } from \"./mock-config.type\";\nimport { MockImageModel } from \"./mock-image-model\";\nimport { MockModel } from \"./mock-model\";\nimport { MockSpeechModel } from \"./mock-speech-model\";\nimport { MockTranscriptionModel } from \"./mock-transcription-model\";\n\n/**\n * Creates a mock SDK adapter for testing — no HTTP calls, fully configurable.\n *\n * @example\n * const mock = MockSDK({\n * responses: [\n * { content: \"Hello from mock!\" },\n * { content: \"Second response\" },\n * ],\n * });\n * const model = mock.model({ name: \"gpt-4o\" });\n * const result = await model.complete([{ role: \"user\", content: \"Hi\" }]);\n * console.log(result.content); // \"Hello from mock!\"\n */\nexport function MockSDK(config: MockSDKConfig = {}): SDKAdapterContract & {\n /** All model instances created by this SDK — for inspecting calls in tests */\n models: MockModel[];\n /** All image-model instances created by this SDK — for inspecting calls in tests */\n imageModels: MockImageModel[];\n /** All speech-model instances created by this SDK — for inspecting calls in tests */\n speechModels: MockSpeechModel[];\n /** All transcription-model instances created by this SDK — for inspecting calls in tests */\n transcriptionModels: MockTranscriptionModel[];\n} {\n const models: MockModel[] = [];\n const imageModels: MockImageModel[] = [];\n const speechModels: MockSpeechModel[] = [];\n const transcriptionModels: MockTranscriptionModel[] = [];\n const responses = config.responses ?? [{ content: \"Mock response\" }];\n const imageResponses = config.imageResponses ?? [{}];\n const speechResponses = config.speechResponses ?? [{}];\n const transcriptionResponses = config.transcriptionResponses ?? [{}];\n\n return {\n models,\n imageModels,\n speechModels,\n transcriptionModels,\n model(modelConfig: ModelConfig) {\n const model = new MockModel(\n modelConfig.name ?? config.defaultModelName ?? \"mock-model\",\n responses,\n config.capabilities,\n );\n models.push(model);\n return model;\n },\n image(imageConfig: ImageModelConfig) {\n const model = new MockImageModel(\n imageConfig.name ?? config.defaultModelName ?? \"mock-image-model\",\n imageResponses,\n imageConfig.pricing ?? config.imagePricing,\n );\n imageModels.push(model);\n return model;\n },\n speech(speechConfig: SpeechModelConfig) {\n const model = new MockSpeechModel(\n speechConfig.name ?? config.defaultModelName ?? \"mock-speech-model\",\n speechResponses,\n speechConfig.pricing ?? config.speechPricing,\n );\n speechModels.push(model);\n return model;\n },\n transcribe(transcribeConfig: TranscriptionModelConfig) {\n const model = new MockTranscriptionModel(\n transcribeConfig.name ?? config.defaultModelName ?? \"mock-transcription-model\",\n transcriptionResponses,\n transcribeConfig.pricing ?? config.transcriptionPricing,\n );\n transcriptionModels.push(model);\n return model;\n },\n async count(text: string, _model?: string): Promise<number> {\n return approximateTokenCount(text);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,QAAQ,SAAwB,CAAC,GAS/C;CACA,MAAM,SAAsB,CAAC;CAC7B,MAAM,cAAgC,CAAC;CACvC,MAAM,eAAkC,CAAC;CACzC,MAAM,sBAAgD,CAAC;CACvD,MAAM,YAAY,OAAO,aAAa,CAAC,EAAE,SAAS,gBAAgB,CAAC;CACnE,MAAM,iBAAiB,OAAO,kBAAkB,CAAC,CAAC,CAAC;CACnD,MAAM,kBAAkB,OAAO,mBAAmB,CAAC,CAAC,CAAC;CACrD,MAAM,yBAAyB,OAAO,0BAA0B,CAAC,CAAC,CAAC;CAEnE,OAAO;EACL;EACA;EACA;EACA;EACA,MAAM,aAA0B;GAC9B,MAAM,QAAQ,IAAI,UAChB,YAAY,QAAQ,OAAO,oBAAoB,cAC/C,WACA,OAAO,YACT;GACA,OAAO,KAAK,KAAK;GACjB,OAAO;EACT;EACA,MAAM,aAA+B;GACnC,MAAM,QAAQ,IAAI,eAChB,YAAY,QAAQ,OAAO,oBAAoB,oBAC/C,gBACA,YAAY,WAAW,OAAO,YAChC;GACA,YAAY,KAAK,KAAK;GACtB,OAAO;EACT;EACA,OAAO,cAAiC;GACtC,MAAM,QAAQ,IAAI,gBAChB,aAAa,QAAQ,OAAO,oBAAoB,qBAChD,iBACA,aAAa,WAAW,OAAO,aACjC;GACA,aAAa,KAAK,KAAK;GACvB,OAAO;EACT;EACA,WAAW,kBAA4C;GACrD,MAAM,QAAQ,IAAI,uBAChB,iBAAiB,QAAQ,OAAO,oBAAoB,4BACpD,wBACA,iBAAiB,WAAW,OAAO,oBACrC;GACA,oBAAoB,KAAK,KAAK;GAC9B,OAAO;EACT;EACA,MAAM,MAAM,MAAc,QAAkC;GAC1D,OAAO,sBAAsB,IAAI;EACnC;CACF;AACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Usage } from "../contracts/result/usage.type.mjs";
|
|
2
|
+
import { GeneratedAudio, SpeechGenerationResponse, SpeechModelContract, SpeechModelPricing, SpeechOptions } from "../contracts/speech-model.contract.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../@warlock.js/ai/src/mock/mock-speech-model.d.ts
|
|
5
|
+
/** One scripted response for a {@link MockSpeechModel}. */
|
|
6
|
+
type MockSpeechResponse = {
|
|
7
|
+
audio?: GeneratedAudio;
|
|
8
|
+
usage?: Usage; /** Characters synthesized; defaults to the input text length. */
|
|
9
|
+
characters?: number;
|
|
10
|
+
error?: Error;
|
|
11
|
+
delay?: number;
|
|
12
|
+
};
|
|
13
|
+
/** One recorded `generate()` invocation, for test assertions. */
|
|
14
|
+
type MockSpeechCall = {
|
|
15
|
+
text: string;
|
|
16
|
+
options: SpeechOptions | undefined;
|
|
17
|
+
};
|
|
18
|
+
/** Deterministic {@link SpeechModelContract} double for tests — no HTTP. */
|
|
19
|
+
declare class MockSpeechModel implements SpeechModelContract {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
private readonly responses;
|
|
22
|
+
readonly pricing?: SpeechModelPricing | undefined;
|
|
23
|
+
readonly provider = "mock";
|
|
24
|
+
readonly calls: MockSpeechCall[];
|
|
25
|
+
private callIndex;
|
|
26
|
+
constructor(name: string, responses: MockSpeechResponse[], pricing?: SpeechModelPricing | undefined);
|
|
27
|
+
generate(text: string, options?: SpeechOptions): Promise<SpeechGenerationResponse>;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { MockSpeechCall, MockSpeechModel, MockSpeechResponse };
|
|
31
|
+
//# sourceMappingURL=mock-speech-model.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-speech-model.d.mts","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-speech-model.ts"],"mappings":";;;;;KAUY,kBAAA;EACV,KAAA,GAAQ,cAAA;EACR,KAAA,GAAQ,KAAA;EAER,UAAA;EACA,KAAA,GAAQ,KAAA;EACR,KAAA;AAAA;;KAIU,cAAA;EAAmB,IAAA;EAAc,OAAA,EAAS,aAAa;AAAA;;cAGtD,eAAA,YAA2B,mBAAA;EAAA,SAOpB,IAAA;EAAA,iBACC,SAAA;EAAA,SACD,OAAA,GAAU,kBAAA;EAAA,SARZ,QAAA;EAAA,SACA,KAAA,EAAO,cAAA;EAAA,QAEf,SAAA;cAGU,IAAA,UACC,SAAA,EAAW,kBAAA,IACZ,OAAA,GAAU,kBAAA;EAGf,QAAA,CAAS,IAAA,UAAc,OAAA,GAAU,aAAA,GAAgB,OAAA,CAAQ,wBAAA;AAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region ../@warlock.js/ai/src/mock/mock-speech-model.ts
|
|
2
|
+
/** Deterministic {@link SpeechModelContract} double for tests — no HTTP. */
|
|
3
|
+
var MockSpeechModel = class {
|
|
4
|
+
constructor(name, responses, pricing) {
|
|
5
|
+
this.name = name;
|
|
6
|
+
this.responses = responses;
|
|
7
|
+
this.pricing = pricing;
|
|
8
|
+
this.provider = "mock";
|
|
9
|
+
this.calls = [];
|
|
10
|
+
this.callIndex = 0;
|
|
11
|
+
}
|
|
12
|
+
async generate(text, options) {
|
|
13
|
+
this.calls.push({
|
|
14
|
+
text,
|
|
15
|
+
options
|
|
16
|
+
});
|
|
17
|
+
const response = this.responses[Math.min(this.callIndex, this.responses.length - 1)] ?? {};
|
|
18
|
+
this.callIndex += 1;
|
|
19
|
+
if (response.delay) await new Promise((resolve) => setTimeout(resolve, response.delay));
|
|
20
|
+
if (response.error) throw response.error;
|
|
21
|
+
return {
|
|
22
|
+
audio: response.audio ?? {
|
|
23
|
+
type: "base64",
|
|
24
|
+
base64: "AAAA",
|
|
25
|
+
mediaType: "audio/mpeg"
|
|
26
|
+
},
|
|
27
|
+
usage: response.usage ?? {
|
|
28
|
+
input: 0,
|
|
29
|
+
output: 0,
|
|
30
|
+
total: 0
|
|
31
|
+
},
|
|
32
|
+
characters: response.characters ?? text.length
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { MockSpeechModel };
|
|
39
|
+
//# sourceMappingURL=mock-speech-model.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-speech-model.mjs","names":[],"sources":["../../../../../../../@warlock.js/ai/src/mock/mock-speech-model.ts"],"sourcesContent":["import type {\n GeneratedAudio,\n SpeechGenerationResponse,\n SpeechModelContract,\n SpeechModelPricing,\n SpeechOptions,\n} from \"../contracts/speech-model.contract\";\nimport type { Usage } from \"../contracts/result/usage.type\";\n\n/** One scripted response for a {@link MockSpeechModel}. */\nexport type MockSpeechResponse = {\n audio?: GeneratedAudio;\n usage?: Usage;\n /** Characters synthesized; defaults to the input text length. */\n characters?: number;\n error?: Error;\n delay?: number;\n};\n\n/** One recorded `generate()` invocation, for test assertions. */\nexport type MockSpeechCall = { text: string; options: SpeechOptions | undefined };\n\n/** Deterministic {@link SpeechModelContract} double for tests — no HTTP. */\nexport class MockSpeechModel implements SpeechModelContract {\n public readonly provider = \"mock\";\n public readonly calls: MockSpeechCall[] = [];\n\n private callIndex = 0;\n\n public constructor(\n public readonly name: string,\n private readonly responses: MockSpeechResponse[],\n public readonly pricing?: SpeechModelPricing,\n ) {}\n\n public async generate(text: string, options?: SpeechOptions): Promise<SpeechGenerationResponse> {\n this.calls.push({ text, options });\n\n const response = this.responses[Math.min(this.callIndex, this.responses.length - 1)] ?? {};\n this.callIndex += 1;\n\n if (response.delay) {\n await new Promise((resolve) => setTimeout(resolve, response.delay));\n }\n if (response.error) {\n throw response.error;\n }\n\n return {\n audio: response.audio ?? { type: \"base64\", base64: \"AAAA\", mediaType: \"audio/mpeg\" },\n usage: response.usage ?? { input: 0, output: 0, total: 0 },\n characters: response.characters ?? text.length,\n };\n }\n}\n"],"mappings":";;AAuBA,IAAa,kBAAb,MAA4D;CAM1D,AAAO,YACL,AAAgB,MAChB,AAAiB,WACjB,AAAgB,SAChB;EAHgB;EACC;EACD;kBARS;eACe,CAAC;mBAEvB;CAMjB;CAEH,MAAa,SAAS,MAAc,SAA4D;EAC9F,KAAK,MAAM,KAAK;GAAE;GAAM;EAAQ,CAAC;EAEjC,MAAM,WAAW,KAAK,UAAU,KAAK,IAAI,KAAK,WAAW,KAAK,UAAU,SAAS,CAAC,MAAM,CAAC;EACzF,KAAK,aAAa;EAElB,IAAI,SAAS,OACX,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,SAAS,KAAK,CAAC;EAEpE,IAAI,SAAS,OACX,MAAM,SAAS;EAGjB,OAAO;GACL,OAAO,SAAS,SAAS;IAAE,MAAM;IAAU,QAAQ;IAAQ,WAAW;GAAa;GACnF,OAAO,SAAS,SAAS;IAAE,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;GACzD,YAAY,SAAS,cAAc,KAAK;EAC1C;CACF;AACF"}
|