@warlock.js/ai 4.14.0 → 4.15.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.
@@ -25,7 +25,7 @@ import { END, EndSentinel } from "./end.type.mjs";
25
25
  import { SupervisorReport, SupervisorResult, SupervisorTerminatedBy } from "./result/supervisor-result.type.mjs";
26
26
  import { StepSnapshot } from "./result/step-result.type.mjs";
27
27
  import { WorkflowReport, WorkflowResult } from "./result/workflow-result.type.mjs";
28
- import { ToolConfig, ToolContext, ToolMeta, ToolMode } from "./tool.contract.mjs";
28
+ import { ToolActionResolver, ToolConfig, ToolContext, ToolMeta, ToolMode } from "./tool.contract.mjs";
29
29
  import { SupervisorInput } from "./supervisor/supervisor-input.type.mjs";
30
30
  import { SupervisorSnapshot, SupervisorSnapshotStatus } from "./supervisor/supervisor-snapshot.type.mjs";
31
31
  import { PgClientLike, RedisClientLike, SnapshotStore } from "./orchestrator/snapshot-store.contract.mjs";
@@ -3,6 +3,7 @@ import { FlowObserveOption } from "../../observe/resolve-observers.mjs";
3
3
  import { SnapshotStore } from "../orchestrator/snapshot-store.contract.mjs";
4
4
  import { WorkflowInstance } from "../workflow/workflow.contract.mjs";
5
5
  import { SystemPromptContract } from "../system-prompt.contract.mjs";
6
+ import { IntentCallback } from "../supervisor/intent-entry.type.mjs";
6
7
  import { RouterEntry } from "../supervisor/router-entry.type.mjs";
7
8
  import { SupervisorConfig, SupervisorEventHandlers } from "../supervisor/supervisor-config.type.mjs";
8
9
  import { EvaluateContext, EvaluateResult } from "../supervisor/evaluate-context.type.mjs";
@@ -10,13 +11,15 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
10
11
 
11
12
  //#region ../ai/src/contracts/team/team-config.type.d.ts
12
13
  /**
13
- * A role member — an agent or a workflow. The same shorthand the
14
- * supervisor accepts on each `intents` value, narrowed to the two
15
- * dispatchable unit shapes `team()` forwards verbatim. (Callback /
16
- * full-entry intent shapes still work when forwarded this alias is
17
- * the documented, autocomplete-friendly subset for the common case.)
14
+ * A role member — an agent, a workflow, or an inline callback. Every
15
+ * `members` value is forwarded verbatim as a supervisor `intents`
16
+ * value, so the callback form dispatches exactly like a callback
17
+ * intent; it is listed here because the runtime has always accepted
18
+ * it. The richer `IntentEntry` / `IntentRunEntry` object forms are
19
+ * deliberately left out — `team()` names its roles by key, and the
20
+ * per-entry overrides belong to `supervisor()`.
18
21
  */
19
- type TeamMemberValue = AgentContract<unknown> | WorkflowInstance<unknown, unknown>;
22
+ type TeamMemberValue = AgentContract<unknown> | WorkflowInstance<unknown, unknown> | IntentCallback;
20
23
  /**
21
24
  * The built-in quality-gate strategies. Each desugars to a concrete
22
25
  * {@link SupervisorConfig.evaluate} callback — no new loop or
@@ -1 +1 @@
1
- {"version":3,"file":"team-config.type.d.mts","names":[],"sources":["../../../../../../../../ai/src/contracts/team/team-config.type.ts"],"mappings":";;;;;;;;;;;;;AAiBA;;;;AAEoB;KAFR,eAAA,GACR,aAAA,YACA,gBAAgB;;;;AAiBA;AASpB;;;;;;;;;;;KATY,QAAA;;;;;;;AAWgC;KAFhC,UAAA,YACV,GAAA,EAAK,eAAA,CAAgB,MAAA,MAClB,cAAA,GAAiB,OAAA,CAAQ,cAAA;;;;;;;;;;;;;;;;;;;;KAqBlB,UAAA,6BAED,OAAA,mBACQ,MAAA,SAAe,eAAA,IAAmB,MAAA,SAAe,eAAA;EA+CjD,yEA5CjB,IAAA,UA6D0B;EA1D1B,OAAA;EA6DQ;;;;;;;;EAnDR,OAAA,EACI,aAAA,YACA,WAAA,CAAY,MAAA;IACV,KAAA,EAAO,WAAA,CAAY,gBAAA,CAAiB,OAAA,EAAS,MAAA;EAAA;EAnBnB;;;;;;EA2BhC,OAAA,EAAS,QAAA;EATL;;;;;;EAiBJ,IAAA,EAAM,QAAA,GAAW,UAAA,CAAW,MAAA;EAR5B;;;;;;;EAiBA,KAAA;IACE,QAAA,SAAiB,QAAA;IACjB,KAAA,SAAc,QAAA;IACd,MAAA,SAAe,QAAA;EAAA;EAAA;;;;;;EASjB,OAAA,WAWA;EANA,IAAA,YAAgB,oBAAA,EAShB;EANA,MAAA,GAAS,gBAAA,CAAiB,OAAA,GASV;EANhB,KAAA,GAAQ,MAAA,EASH;EANL,aAAA,WAeU;EAZV,aAAA,GAAgB,aAAA,EAYW;EAT3B,EAAA,GAAK,uBAAA;;;;;;;;EASL,OAAA,GAAU,iBAAA;AAAA"}
1
+ {"version":3,"file":"team-config.type.d.mts","names":[],"sources":["../../../../../../../../ai/src/contracts/team/team-config.type.ts"],"mappings":";;;;;;;;;;;;;;AAoBA;;;;;;;KAAY,eAAA,GACR,aAAA,YACA,gBAAA,qBACA,cAAA;;;;;AAAc;AAiBlB;;;;AAAoB;AASpB;;;;;KATY,QAAA;;;;;;;;KASA,UAAA,YACV,GAAA,EAAK,eAAA,CAAgB,MAAA,MAClB,cAAA,GAAiB,OAAA,CAAQ,cAAA;;;;;AAAc;AAqB5C;;;;;;;;;;;;;;KAAY,UAAA,6BAED,OAAA,mBACQ,MAAA,SAAe,eAAA,IAAmB,MAAA,SAAe,eAAA;EA2BzD,yEAxBT,IAAA,UAgC4B;EA7B5B,OAAA;EAuCmB;;;;;;;;EA7BnB,OAAA,EACI,aAAA,YACA,WAAA,CAAY,MAAA;IACV,KAAA,EAAO,WAAA,CAAY,gBAAA,CAAiB,OAAA,EAAS,MAAA;EAAA;EAkExB;;;;;;EA1D3B,OAAA,EAAS,QAAA;EA3B0C;;;;;;EAmCnD,IAAA,EAAM,QAAA,GAAW,UAAA,CAAW,MAAA;EAjBZ;;;;;;;EA0BhB,KAAA;IACE,QAAA,SAAiB,QAAA;IACjB,KAAA,SAAc,QAAA;IACd,MAAA,SAAe,QAAA;EAAA;EAHjB;;;;;;EAYA,OAAA;EAKA,IAAA,YAAgB,oBAAA,EAAA;EAGhB,MAAA,GAAS,gBAAA,CAAiB,OAAA,GAAjB;EAGT,KAAA,GAAQ,MAAA,EAAR;EAGA,aAAA;EAGA,aAAA,GAAgB,aAAA,EAAA;EAGhB,EAAA,GAAK,uBAAA;EAAA;;;;AASsB;;;EAA3B,OAAA,GAAU,iBAAA;AAAA"}
@@ -4,10 +4,18 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
4
4
  /**
5
5
  * Optional metadata attached to a tool for documentation and tooling.
6
6
  *
7
+ * Free-form: any key is accepted. `label` and `actionLabel` are named
8
+ * explicitly only so editors suggest them — both are optional, like
9
+ * every other key.
10
+ *
7
11
  * @example
8
12
  * const meta: ToolMeta = { category: "search", version: "1.0" };
9
13
  */
10
- type ToolMeta = Record<"label" | "actionLabel" | (string & {}), unknown>;
14
+ type ToolMeta = {
15
+ /** Human-readable name for the tool in documentation and tooling UIs. */label?: unknown; /** Human-readable name for the action the tool performs. */
16
+ actionLabel?: unknown;
17
+ [key: string]: unknown;
18
+ };
11
19
  /**
12
20
  * Discriminated mode controlling whether the tool's result feeds back
13
21
  * to the model.
@@ -43,6 +51,30 @@ type ToolMeta = Record<"label" | "actionLabel" | (string & {}), unknown>;
43
51
  * → terminate" rule only kicks in when EVERY tool call is silent.
44
52
  */
45
53
  type ToolMode = "feedback" | "silent";
54
+ /**
55
+ * Callback form of {@link ToolConfig.action} — turns the model's
56
+ * arguments into a present-progressive UI string.
57
+ *
58
+ * Written as a method inside a wrapper object (then indexed back out)
59
+ * so TypeScript checks `input` **bivariantly** instead of
60
+ * contravariantly. That is deliberate, and it is what the runtime
61
+ * actually does: the dispatch boundary resolves the label from the
62
+ * model's *raw, pre-validation* arguments, so it hands the callback an
63
+ * `unknown` while the author declares the shape they expect. Under the
64
+ * default strict (contravariant) function check a
65
+ * `ToolContract<{ query: string }, …>` would not be assignable to
66
+ * `ToolContract<unknown, unknown>`, which is the type every
67
+ * heterogeneous tool list — `AgentConfig.tools`, supervisor tool
68
+ * registries — has to use.
69
+ *
70
+ * The bivariance is not free: `input` is whatever the model emitted,
71
+ * not a validated `TInput`. Resolution is wrapped in a try/catch at
72
+ * the boundary precisely because this callback can throw on malformed
73
+ * arguments; a throw costs the label, never the dispatch.
74
+ */
75
+ type ToolActionResolver<TInput> = {
76
+ resolveAction(input: TInput): string;
77
+ }["resolveAction"];
46
78
  /**
47
79
  * Per-call context threaded into a tool handler as the optional second
48
80
  * argument (Phase 5 / decisions §35).
@@ -130,7 +162,7 @@ interface ToolConfig<TInput = unknown, TOutput = unknown> {
130
162
  * Resolved at the framework boundary; consumers receive a
131
163
  * pre-resolved string in `ToolEventMeta.action`.
132
164
  */
133
- action?: string | ((input: TInput) => string);
165
+ action?: string | ToolActionResolver<TInput>;
134
166
  /** Optional metadata for documentation or tooling */
135
167
  meta?: ToolMeta;
136
168
  /**
@@ -159,5 +191,5 @@ interface ToolConfig<TInput = unknown, TOutput = unknown> {
159
191
  execute(input: TInput, ctx?: ToolContext): Promise<TOutput>;
160
192
  }
161
193
  //#endregion
162
- export { ToolConfig, ToolContext, ToolMeta, ToolMode };
194
+ export { ToolActionResolver, ToolConfig, ToolContext, ToolMeta, ToolMode };
163
195
  //# sourceMappingURL=tool.contract.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool.contract.d.mts","names":[],"sources":["../../../../../../../ai/src/contracts/tool.contract.ts"],"mappings":";;;;;AAQA;;;;KAAY,QAAA,GAAW,MAAM;AAoC7B;;;;AAAoB;AAmCpB;;;;;;;;;;;;;;;AASsB;AAiBtB;;;;;;;;;;;;;AA7DA,KAAY,QAAA;;;;;;;;;;;;;;;;;;;;;;;;AAqHgD;;;;;;;;;;KAlFhD,WAAA,cAAyB,MAAA;;;;;;;EAOnC,SAAA,EAAW,UAAA;EAEX,MAAA,GAAS,WAAA;AAAA;;;;;;;;;;;;;;;UAiBM,UAAA;;EAEf,IAAA;;EAEA,WAAA;;;;;;;;EAQA,OAAA;;;;;;;;;;;;;;;;;;EAkBA,MAAA,cAAoB,KAAA,EAAO,MAAA;;EAE3B,IAAA,GAAO,QAAA;;;;;;;EAOP,IAAA,GAAO,QAAA;;;;;;EAMP,KAAA,GAAQ,gBAAA,CAAiB,MAAA;;;;;;;;;;;EAWzB,OAAA,CAAQ,KAAA,EAAO,MAAA,EAAQ,GAAA,GAAM,WAAA,GAAc,OAAA,CAAQ,OAAA;AAAA"}
1
+ {"version":3,"file":"tool.contract.d.mts","names":[],"sources":["../../../../../../../ai/src/contracts/tool.contract.ts"],"mappings":";;;;;AAYA;;;;;;;;KAAY,QAAA;EA0CA,yEAxCV,KAAA;EAEA,WAAA;EAAA,CACC,GAAA;AAAA;;;;;;;;;AA6D0B;AAoC7B;;;;;;;;;;;;;;;AASsB;AAiBtB;;;;;;;;;KAtFY,QAAA;;;;;;;;;;;;;;;;;;;;;;KAuBA,kBAAA;EACV,aAAA,CAAc,KAAA,EAAO,MAAM;AAAA;;;;;AAsH+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAlFhD,WAAA,cAAyB,MAAA;;;;;;;EAOnC,SAAA,EAAW,UAAA;EAEX,MAAA,GAAS,WAAA;AAAA;;;;;;;;;;;;;;;UAiBM,UAAA;;EAEf,IAAA;;EAEA,WAAA;;;;;;;;EAQA,OAAA;;;;;;;;;;;;;;;;;;EAkBA,MAAA,YAAkB,kBAAA,CAAmB,MAAA;;EAErC,IAAA,GAAO,QAAA;;;;;;;EAOP,IAAA,GAAO,QAAA;;;;;;EAMP,KAAA,GAAQ,gBAAA,CAAiB,MAAA;;;;;;;;;;;EAWzB,OAAA,CAAQ,KAAA,EAAO,MAAA,EAAQ,GAAA,GAAM,WAAA,GAAc,OAAA,CAAQ,OAAA;AAAA"}
package/esm/index.d.mts CHANGED
@@ -30,7 +30,7 @@ import { END, EndSentinel } from "./contracts/end.type.mjs";
30
30
  import { SupervisorReport, SupervisorResult, SupervisorTerminatedBy } from "./contracts/result/supervisor-result.type.mjs";
31
31
  import { StepSnapshot } from "./contracts/result/step-result.type.mjs";
32
32
  import { WorkflowReport, WorkflowResult } from "./contracts/result/workflow-result.type.mjs";
33
- import { ToolConfig, ToolContext, ToolMeta, ToolMode } from "./contracts/tool.contract.mjs";
33
+ import { ToolActionResolver, 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
36
  import { AgentDriftError, AgentDriftErrorOptions } from "./errors/agent-drift-error.mjs";
@@ -192,7 +192,7 @@ import { forTool } from "./middleware/helpers/for-tool.mjs";
192
192
  import { MockImageCall, MockImageModel, MockImageResponse } from "./mock/mock-image-model.mjs";
193
193
  import { MockSpeechCall, MockSpeechModel, MockSpeechResponse } from "./mock/mock-speech-model.mjs";
194
194
  import { MockTranscriptionCall, MockTranscriptionModel, MockTranscriptionResponse } from "./mock/mock-transcription-model.mjs";
195
- import { MockModelResponse, MockSDKConfig } from "./mock/mock-config.type.mjs";
195
+ import { MockModelResponse, MockSDKConfig, MockUsage } from "./mock/mock-config.type.mjs";
196
196
  import { mockAgent } from "./mock/mock-agent.mjs";
197
197
  import { MockModel } from "./mock/mock-model.mjs";
198
198
  import { MockRouterDecision, MockRouterExhaustion, MockRouterOptions, mockRouter } from "./mock/mock-router.mjs";
@@ -312,7 +312,7 @@ import { computeSignature as computeSignature$1 } from "./workflow/signature.mjs
312
312
  import { MatcherVerdict, matchConverge, matchOutputShape, matchPassStep, matchRouteTo } from "./testing/matcher-logic.mjs";
313
313
  import { AiMatchers } from "./testing/matchers.mjs";
314
314
  import { registerAiMatchers } from "./testing/register-lazy.mjs";
315
- 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 JudgeOutcome, 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, PromptRefineOptions, PromptRefinementError, type PromptRefinementErrorOptions, type PromptRefinementFailureReason, 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, RefinedPromptStoreLike, RefinedSystemPrompt, RefinedSystemPromptContract, RefinedSystemPromptOptions, 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, formatCriteria, 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, judgePromptBody, 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 };
315
+ 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 JudgeOutcome, 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, type MockUsage, 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, PromptRefineOptions, PromptRefinementError, type PromptRefinementErrorOptions, type PromptRefinementFailureReason, 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, RefinedPromptStoreLike, RefinedSystemPrompt, RefinedSystemPromptContract, RefinedSystemPromptOptions, 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, ToolActionResolver, 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, formatCriteria, 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, judgePromptBody, 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 };
316
316
  import "./ai.mjs";
317
317
  import "./config.mjs";
318
318
  import "./testing/matchers.mjs";
@@ -1,7 +1,7 @@
1
1
  import { MockImageCall, MockImageModel, MockImageResponse } from "./mock-image-model.mjs";
2
2
  import { MockSpeechCall, MockSpeechModel, MockSpeechResponse } from "./mock-speech-model.mjs";
3
3
  import { MockTranscriptionCall, MockTranscriptionModel, MockTranscriptionResponse } from "./mock-transcription-model.mjs";
4
- import { MockModelResponse, MockSDKConfig } from "./mock-config.type.mjs";
4
+ import { MockModelResponse, MockSDKConfig, MockUsage } from "./mock-config.type.mjs";
5
5
  import { mockAgent } from "./mock-agent.mjs";
6
6
  import { MockModel } from "./mock-model.mjs";
7
7
  import { MockRouterDecision, MockRouterExhaustion, MockRouterOptions, mockRouter } from "./mock-router.mjs";
@@ -1,5 +1,4 @@
1
1
  import { ModelToolCallRequest } from "../contracts/model-tool-call-request.type.mjs";
2
- import { Usage } from "../contracts/result/usage.type.mjs";
3
2
  import { FinishReason } from "../contracts/finish-reason.type.mjs";
4
3
  import { ModelCapabilities } from "../contracts/model.contract.mjs";
5
4
  import { ImageModelPricing } from "../contracts/image-model.contract.mjs";
@@ -10,6 +9,29 @@ import { MockSpeechResponse } from "./mock-speech-model.mjs";
10
9
  import { MockTranscriptionResponse } from "./mock-transcription-model.mjs";
11
10
 
12
11
  //#region ../ai/src/mock/mock-config.type.d.ts
12
+ /**
13
+ * Token counts a scripted `MockModelResponse` may declare.
14
+ *
15
+ * Deliberately NOT `Usage`. `Usage` is an emitted result — every field
16
+ * on it is authoritative and `total` is always present. This is script
17
+ * *input*, and `MockModel.buildResponse()` only honors `input`,
18
+ * `output` and `cachedTokens`; it always recomputes `total` as
19
+ * `input + output`, so a scripted `total` can never disagree with the
20
+ * numbers it is derived from. `reasoningTokens`, `cacheWriteTokens`
21
+ * and `cost` are omitted because the mock does not forward them —
22
+ * declaring one here would be silently dropped.
23
+ */
24
+ type MockUsage = {
25
+ /** Prompt tokens the scripted response reports. */input: number; /** Completion tokens the scripted response reports. */
26
+ output: number;
27
+ /**
28
+ * Ignored — `MockModel` always recomputes `total` as
29
+ * `input + output`. Accepted so existing fixtures that spell it out
30
+ * still compile.
31
+ */
32
+ total?: number; /** Subset of `input` served from the provider's prompt cache. */
33
+ cachedTokens?: number;
34
+ };
13
35
  /**
14
36
  * Configuration for a single mock model response.
15
37
  * Responses are consumed in order — last one repeats if list is exhausted.
@@ -17,8 +39,15 @@ import { MockTranscriptionResponse } from "./mock-transcription-model.mjs";
17
39
  type MockModelResponse = {
18
40
  content: string;
19
41
  finishReason?: FinishReason;
20
- usage?: Usage;
21
- toolCalls?: ModelToolCallRequest[]; /** Simulate a delay in ms before resolving */
42
+ usage?: MockUsage;
43
+ toolCalls?: ModelToolCallRequest[];
44
+ /**
45
+ * Exact chunk boundaries `stream()` should emit for `content`.
46
+ * Omitted = the mock splits `content` on whitespace. Use this when a
47
+ * test asserts on delta boundaries themselves (partial JSON, prose
48
+ * fragments) rather than on the assembled text.
49
+ */
50
+ deltas?: string[]; /** Simulate a delay in ms before resolving */
22
51
  delay?: number; /** Throw this error instead of returning a response */
23
52
  error?: Error;
24
53
  };
@@ -49,5 +78,5 @@ type MockSDKConfig = {
49
78
  transcriptionPricing?: TranscriptionModelPricing;
50
79
  };
51
80
  //#endregion
52
- export { MockModelResponse, MockSDKConfig };
81
+ export { MockModelResponse, MockSDKConfig, MockUsage };
53
82
  //# sourceMappingURL=mock-config.type.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock-config.type.d.mts","names":[],"sources":["../../../../../../../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"}
1
+ {"version":3,"file":"mock-config.type.d.mts","names":[],"sources":["../../../../../../../ai/src/mock/mock-config.type.ts"],"mappings":";;;;;;;;;;;;;AAsBA;;;;;;;;;AAYc;KAZF,SAAA;EAmBiB,mDAjB3B,KAAA,UAmBe;EAjBf,MAAA;EAmBY;;;;;EAbZ,KAAA,WAWe;EATf,YAAA;AAAA;;;;;KAOU,iBAAA;EACV,OAAA;EACA,YAAA,GAAe,YAAA;EACf,KAAA,GAAQ,SAAA;EACR,SAAA,GAAY,oBAAA;EAcW;;;;;;EAPvB,MAAA,aAiCgB;EA/BhB,KAAA,WAmCuB;EAjCvB,KAAA,GAAQ,KAAA;AAAA;AAAA,KAGE,aAAA;EAEE,wEAAZ,SAAA,GAAY,iBAAA,IASZ;EAPA,gBAAA;EAaA;;;;;;EANA,YAAA,GAAe,iBAAA;EAeC;;;;;EAThB,cAAA,GAAiB,iBAAA;EAa+B;;;;EARhD,YAAA,GAAe,iBAAA;EAEf,eAAA,GAAkB,kBAAA;EAElB,aAAA,GAAgB,kBAAA;EAEhB,sBAAA,GAAyB,yBAAA;EAEzB,oBAAA,GAAuB,yBAAA;AAAA"}
@@ -76,7 +76,8 @@ declare class MockModel implements ModelContract {
76
76
  complete(messages: Message[], options?: ModelCallOptions): Promise<ModelResponse>;
77
77
  /**
78
78
  * Record the call, optionally delay, then emit the scripted response as a
79
- * sequence of stream chunks: content split word-by-word as `delta`
79
+ * sequence of stream chunks: the scripted `deltas` when the entry
80
+ * supplies them, otherwise content split word-by-word, as `delta`
80
81
  * chunks, each scripted tool call as a `tool-call` chunk, and finally a
81
82
  * `done` chunk with finish reason + usage. Throws eagerly if the scripted
82
83
  * entry carries an `error`.
@@ -1 +1 @@
1
- {"version":3,"file":"mock-model.d.mts","names":[],"sources":["../../../../../../../ai/src/mock/mock-model.ts"],"mappings":";;;;;KAUK,YAAA;EACH,QAAA,EAAU,OAAA;EACV,OAAA,GAAU,gBAAgB;AAAA;;;;;;;;AAAA;AA+B5B;;;;;;;;;;;;;;;;;;;;cAAa,SAAA,YAAqB,aAAA;EAAA,SAQd,IAAA;EAAA,iBACC,SAAA;EAAA,SARH,QAAA;EAAA,SACA,YA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AA"}
@@ -103,7 +103,8 @@ var MockModel = class {
103
103
  }
104
104
  /**
105
105
  * Record the call, optionally delay, then emit the scripted response as a
106
- * sequence of stream chunks: content split word-by-word as `delta`
106
+ * sequence of stream chunks: the scripted `deltas` when the entry
107
+ * supplies them, otherwise content split word-by-word, as `delta`
107
108
  * chunks, each scripted tool call as a `tool-call` chunk, and finally a
108
109
  * `done` chunk with finish reason + usage. Throws eagerly if the scripted
109
110
  * entry carries an `error`.
@@ -116,10 +117,10 @@ var MockModel = class {
116
117
  const mock = this.nextResponse();
117
118
  if (mock.delay) await new Promise((resolve) => setTimeout(resolve, mock.delay));
118
119
  if (mock.error) throw mock.error;
119
- const words = mock.content.split(" ");
120
- for (const word of words) yield {
120
+ const chunks = mock.deltas ?? mock.content.split(" ").map((word) => word + " ");
121
+ for (const chunk of chunks) yield {
121
122
  type: "delta",
122
- content: word + " "
123
+ content: chunk
123
124
  };
124
125
  if (mock.toolCalls) for (const toolCall of mock.toolCalls) yield {
125
126
  type: "tool-call",
@@ -1 +1 @@
1
- {"version":3,"file":"mock-model.mjs","names":[],"sources":["../../../../../../../ai/src/mock/mock-model.ts"],"sourcesContent":["import type { Message } from \"../contracts/conversation-message.type\";\nimport type {\n ModelCallOptions,\n ModelCapabilities,\n ModelContract,\n ModelResponse,\n ModelStreamChunk,\n} from \"../contracts/model.contract\";\nimport type { MockModelResponse } from \"./mock-config.type\";\n\ntype RecordedCall = {\n messages: Message[];\n options?: ModelCallOptions;\n};\n\n/**\n * Deterministic in-memory `ModelContract` implementation for tests.\n *\n * **Role.** Stands in for a real provider model so agent/workflow/supervisor\n * tests can assert behavior without hitting the network, spending tokens, or\n * depending on non-deterministic LLM output.\n *\n * **Responsibility.**\n * - Owns: a scripted queue of `MockModelResponse` entries, a call-history\n * log for assertions, and the index pointer that advances through the\n * queue on each `complete()` / `stream()` call.\n * - Does NOT own: any real inference, tokenization, or network I/O — when\n * the queue is exhausted, the final entry is reused so tests never crash\n * on accidental over-consumption.\n *\n * Every AI-related test in this repo uses `MockSDK` / `MockModel` — real\n * provider APIs are never hit from the test suite (see §6 of code-style.md).\n *\n * @example\n * const model = new MockModel(\"mock-gpt\", [\n * { content: \"Hello!\", finishReason: \"stop\" },\n * { content: \"Second turn.\", finishReason: \"stop\" },\n * ]);\n *\n * const first = await model.complete([{ role: \"user\", content: \"hi\" }]);\n * expect(first.content).toBe(\"Hello!\");\n * expect(model.callCount).toBe(1);\n */\nexport class MockModel implements ModelContract {\n public readonly provider = \"mock\";\n public readonly capabilities?: ModelCapabilities;\n\n private responseIndex = 0;\n private calls: RecordedCall[] = [];\n\n public constructor(\n public readonly name: string,\n private readonly responses: MockModelResponse[],\n capabilities?: ModelCapabilities,\n ) {\n this.capabilities = capabilities;\n }\n\n /**\n * Full history of calls made to this model. Each entry is the exact\n * `{ messages, options }` pair that was passed — useful for asserting\n * that an agent built the right prompt or forwarded the right tool list.\n */\n public get callHistory(): RecordedCall[] {\n return this.calls;\n }\n\n /**\n * Number of times `complete()` or `stream()` has been invoked. Convenient\n * shorthand for `callHistory.length` in assertions.\n */\n public get callCount(): number {\n return this.calls.length;\n }\n\n /**\n * Advance the scripted response queue by one and return the entry at the\n * current pointer. If the queue is exhausted, the final scripted entry is\n * returned repeatedly so over-consumption in tests produces predictable\n * output instead of `undefined`.\n */\n private nextResponse(): MockModelResponse {\n const response = this.responses[Math.min(this.responseIndex, this.responses.length - 1)];\n\n this.responseIndex++;\n\n return response ?? { content: \"Mock response\", finishReason: \"stop\" };\n }\n\n /**\n * Convert a scripted `MockModelResponse` into a full `ModelResponse` with\n * synthesized usage numbers when the script didn't supply them. Input\n * usage is a fixed estimate; output usage is derived from content length.\n */\n private buildResponse(mock: MockModelResponse): ModelResponse {\n const estimatedInput = 10;\n const estimatedOutput = Math.ceil(mock.content.length / 4);\n\n return {\n content: mock.content,\n finishReason: mock.finishReason ?? \"stop\",\n usage: {\n input: mock.usage?.input ?? estimatedInput,\n output: mock.usage?.output ?? estimatedOutput,\n total: (mock.usage?.input ?? estimatedInput) + (mock.usage?.output ?? estimatedOutput),\n ...(mock.usage?.cachedTokens !== undefined ? { cachedTokens: mock.usage.cachedTokens } : {}),\n },\n toolCalls: mock.toolCalls,\n };\n }\n\n /**\n * Record the call, optionally delay (to simulate latency), and either\n * throw the scripted error or return the scripted response. Mirrors the\n * real provider's `complete()` contract so agents cannot tell the\n * difference at runtime.\n */\n public async complete(messages: Message[], options?: ModelCallOptions): Promise<ModelResponse> {\n this.calls.push({ messages, options });\n\n const mock = this.nextResponse();\n\n if (mock.delay) {\n await new Promise((resolve) => setTimeout(resolve, mock.delay));\n }\n\n if (mock.error) {\n throw mock.error;\n }\n\n return this.buildResponse(mock);\n }\n\n /**\n * Record the call, optionally delay, then emit the scripted response as a\n * sequence of stream chunks: content split word-by-word as `delta`\n * chunks, each scripted tool call as a `tool-call` chunk, and finally a\n * `done` chunk with finish reason + usage. Throws eagerly if the scripted\n * entry carries an `error`.\n */\n public async *stream(\n messages: Message[],\n options?: ModelCallOptions,\n ): AsyncIterable<ModelStreamChunk> {\n this.calls.push({ messages, options });\n\n const mock = this.nextResponse();\n\n if (mock.delay) {\n await new Promise((resolve) => setTimeout(resolve, mock.delay));\n }\n\n if (mock.error) {\n throw mock.error;\n }\n\n const words = mock.content.split(\" \");\n\n for (const word of words) {\n yield { type: \"delta\", content: word + \" \" };\n }\n\n if (mock.toolCalls) {\n for (const toolCall of mock.toolCalls) {\n yield {\n type: \"tool-call\",\n id: toolCall.id,\n name: toolCall.name,\n input: toolCall.input,\n };\n }\n }\n\n const response = this.buildResponse(mock);\n\n yield {\n type: \"done\",\n finishReason: response.finishReason,\n usage: response.usage,\n };\n }\n\n /**\n * Reset call history and response pointer back to their initial state.\n * Intended for test-suite `beforeEach` hooks so a single `MockModel`\n * instance can be reused across cases without cross-test leakage.\n */\n public reset(): void {\n this.calls = [];\n this.responseIndex = 0;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,IAA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MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,KAAK,KAAK,CAAC;EAGhE,IAAI,KAAK,OACP,MAAM,KAAK;EAGb,MAAM,QAAQ,KAAK,QAAQ,MAAM,GAAG;EAEpC,KAAK,MAAM,QAAQ,OACjB,MAAM;GAAE,MAAM;GAAS,SAAS,OAAO;EAAI;EAG7C,IAAI,KAAK,WACP,KAAK,MAAM,YAAY,KAAK,WAC1B,MAAM;GACJ,MAAM;GACN,IAAI,SAAS;GACb,MAAM,SAAS;GACf,OAAO,SAAS;EAClB;EAIJ,MAAM,WAAW,KAAK,cAAc,IAAI;EAExC,MAAM;GACJ,MAAM;GACN,cAAc,SAAS;GACvB,OAAO,SAAS;EAClB;CACF;;;;;;CAOA,AAAO,QAAc;EACnB,KAAK,QAAQ,CAAC;EACd,KAAK,gBAAgB;CACvB;AACF"}
1
+ {"version":3,"file":"mock-model.mjs","names":[],"sources":["../../../../../../../ai/src/mock/mock-model.ts"],"sourcesContent":["import type { Message } from \"../contracts/conversation-message.type\";\nimport type {\n ModelCallOptions,\n ModelCapabilities,\n ModelContract,\n ModelResponse,\n ModelStreamChunk,\n} from \"../contracts/model.contract\";\nimport type { MockModelResponse } from \"./mock-config.type\";\n\ntype RecordedCall = {\n messages: Message[];\n options?: ModelCallOptions;\n};\n\n/**\n * Deterministic in-memory `ModelContract` implementation for tests.\n *\n * **Role.** Stands in for a real provider model so agent/workflow/supervisor\n * tests can assert behavior without hitting the network, spending tokens, or\n * depending on non-deterministic LLM output.\n *\n * **Responsibility.**\n * - Owns: a scripted queue of `MockModelResponse` entries, a call-history\n * log for assertions, and the index pointer that advances through the\n * queue on each `complete()` / `stream()` call.\n * - Does NOT own: any real inference, tokenization, or network I/O — when\n * the queue is exhausted, the final entry is reused so tests never crash\n * on accidental over-consumption.\n *\n * Every AI-related test in this repo uses `MockSDK` / `MockModel` — real\n * provider APIs are never hit from the test suite (see §6 of code-style.md).\n *\n * @example\n * const model = new MockModel(\"mock-gpt\", [\n * { content: \"Hello!\", finishReason: \"stop\" },\n * { content: \"Second turn.\", finishReason: \"stop\" },\n * ]);\n *\n * const first = await model.complete([{ role: \"user\", content: \"hi\" }]);\n * expect(first.content).toBe(\"Hello!\");\n * expect(model.callCount).toBe(1);\n */\nexport class MockModel implements ModelContract {\n public readonly provider = \"mock\";\n public readonly capabilities?: ModelCapabilities;\n\n private responseIndex = 0;\n private calls: RecordedCall[] = [];\n\n public constructor(\n public readonly name: string,\n private readonly responses: MockModelResponse[],\n capabilities?: ModelCapabilities,\n ) {\n this.capabilities = capabilities;\n }\n\n /**\n * Full history of calls made to this model. Each entry is the exact\n * `{ messages, options }` pair that was passed — useful for asserting\n * that an agent built the right prompt or forwarded the right tool list.\n */\n public get callHistory(): RecordedCall[] {\n return this.calls;\n }\n\n /**\n * Number of times `complete()` or `stream()` has been invoked. Convenient\n * shorthand for `callHistory.length` in assertions.\n */\n public get callCount(): number {\n return this.calls.length;\n }\n\n /**\n * Advance the scripted response queue by one and return the entry at the\n * current pointer. If the queue is exhausted, the final scripted entry is\n * returned repeatedly so over-consumption in tests produces predictable\n * output instead of `undefined`.\n */\n private nextResponse(): MockModelResponse {\n const response = this.responses[Math.min(this.responseIndex, this.responses.length - 1)];\n\n this.responseIndex++;\n\n return response ?? { content: \"Mock response\", finishReason: \"stop\" };\n }\n\n /**\n * Convert a scripted `MockModelResponse` into a full `ModelResponse` with\n * synthesized usage numbers when the script didn't supply them. Input\n * usage is a fixed estimate; output usage is derived from content length.\n */\n private buildResponse(mock: MockModelResponse): ModelResponse {\n const estimatedInput = 10;\n const estimatedOutput = Math.ceil(mock.content.length / 4);\n\n return {\n content: mock.content,\n finishReason: mock.finishReason ?? \"stop\",\n usage: {\n input: mock.usage?.input ?? estimatedInput,\n output: mock.usage?.output ?? estimatedOutput,\n total: (mock.usage?.input ?? estimatedInput) + (mock.usage?.output ?? estimatedOutput),\n ...(mock.usage?.cachedTokens !== undefined ? { cachedTokens: mock.usage.cachedTokens } : {}),\n },\n toolCalls: mock.toolCalls,\n };\n }\n\n /**\n * Record the call, optionally delay (to simulate latency), and either\n * throw the scripted error or return the scripted response. Mirrors the\n * real provider's `complete()` contract so agents cannot tell the\n * difference at runtime.\n */\n public async complete(messages: Message[], options?: ModelCallOptions): Promise<ModelResponse> {\n this.calls.push({ messages, options });\n\n const mock = this.nextResponse();\n\n if (mock.delay) {\n await new Promise((resolve) => setTimeout(resolve, mock.delay));\n }\n\n if (mock.error) {\n throw mock.error;\n }\n\n return this.buildResponse(mock);\n }\n\n /**\n * Record the call, optionally delay, then emit the scripted response as a\n * sequence of stream chunks: the scripted `deltas` when the entry\n * supplies them, otherwise content split word-by-word, as `delta`\n * chunks, each scripted tool call as a `tool-call` chunk, and finally a\n * `done` chunk with finish reason + usage. Throws eagerly if the scripted\n * entry carries an `error`.\n */\n public async *stream(\n messages: Message[],\n options?: ModelCallOptions,\n ): AsyncIterable<ModelStreamChunk> {\n this.calls.push({ messages, options });\n\n const mock = this.nextResponse();\n\n if (mock.delay) {\n await new Promise((resolve) => setTimeout(resolve, mock.delay));\n }\n\n if (mock.error) {\n throw mock.error;\n }\n\n const chunks = mock.deltas ?? mock.content.split(\" \").map((word) => word + \" \");\n\n for (const chunk of chunks) {\n yield { type: \"delta\", content: chunk };\n }\n\n if (mock.toolCalls) {\n for (const toolCall of mock.toolCalls) {\n yield {\n type: \"tool-call\",\n id: toolCall.id,\n name: toolCall.name,\n input: toolCall.input,\n };\n }\n }\n\n const response = this.buildResponse(mock);\n\n yield {\n type: \"done\",\n finishReason: response.finishReason,\n usage: response.usage,\n };\n }\n\n /**\n * Reset call history and response pointer back to their initial state.\n * Intended for test-suite `beforeEach` hooks so a single `MockModel`\n * instance can be reused across cases without cross-test leakage.\n */\n public reset(): void {\n this.calls = [];\n this.responseIndex = 0;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAa,YAAb,MAAgD;CAO9C,AAAO,YACL,AAAgB,MAChB,AAAiB,WAC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EAGhE,IAAI,KAAK,OACP,MAAM,KAAK;EAGb,MAAM,SAAS,KAAK,UAAU,KAAK,QAAQ,MAAM,GAAG,CAAC,CAAC,KAAK,SAAS,OAAO,GAAG;EAE9E,KAAK,MAAM,SAAS,QAClB,MAAM;GAAE,MAAM;GAAS,SAAS;EAAM;EAGxC,IAAI,KAAK,WACP,KAAK,MAAM,YAAY,KAAK,WAC1B,MAAM;GACJ,MAAM;GACN,IAAI,SAAS;GACb,MAAM,SAAS;GACf,OAAO,SAAS;EAClB;EAIJ,MAAM,WAAW,KAAK,cAAc,IAAI;EAExC,MAAM;GACJ,MAAM;GACN,cAAc,SAAS;GACvB,OAAO,SAAS;EAClB;CACF;;;;;;CAOA,AAAO,QAAc;EACnB,KAAK,QAAQ,CAAC;EACd,KAAK,gBAAgB;CACvB;AACF"}
@@ -1,4 +1,4 @@
1
- import { SDKAdapterContract } from "../contracts/sdk-adapter.contract.mjs";
1
+ import { ModelConfig, SDKAdapterContract } from "../contracts/sdk-adapter.contract.mjs";
2
2
  import { MockImageModel } from "./mock-image-model.mjs";
3
3
  import { MockSpeechModel } from "./mock-speech-model.mjs";
4
4
  import { MockTranscriptionModel } from "./mock-transcription-model.mjs";
@@ -20,8 +20,16 @@ import { MockModel } from "./mock-model.mjs";
20
20
  * const result = await model.complete([{ role: "user", content: "Hi" }]);
21
21
  * console.log(result.content); // "Hello from mock!"
22
22
  */
23
- declare function MockSDK(config?: MockSDKConfig): SDKAdapterContract & {
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 */
23
+ declare function MockSDK(config?: MockSDKConfig): Omit<SDKAdapterContract, "model"> & {
24
+ /**
25
+ * Narrower than `SDKAdapterContract.model()` on purpose — the
26
+ * instance really is a `MockModel`, so tests can reach `.calls` /
27
+ * `.reset()` straight off the returned model instead of digging it
28
+ * back out of `models`. Still satisfies the adapter contract:
29
+ * `MockModel` implements `ModelContract`.
30
+ */
31
+ model(modelConfig: ModelConfig): MockModel; /** All model instances created by this SDK — for inspecting calls in tests */
32
+ models: MockModel[]; /** All image-model instances created by this SDK — for inspecting calls in tests */
25
33
  imageModels: MockImageModel[]; /** All speech-model instances created by this SDK — for inspecting calls in tests */
26
34
  speechModels: MockSpeechModel[]; /** All transcription-model instances created by this SDK — for inspecting calls in tests */
27
35
  transcriptionModels: MockTranscriptionModel[];
@@ -1 +1 @@
1
- {"version":3,"file":"mock-sdk.d.mts","names":[],"sources":["../../../../../../../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"}
1
+ {"version":3,"file":"mock-sdk.d.mts","names":[],"sources":["../../../../../../../ai/src/mock/mock-sdk.ts"],"mappings":";;;;;;;;;;AA4BA;;;;;;;;;;;;iBAAgB,OAAA,CAAQ,MAAA,GAAQ,aAAA,GAAqB,IAAA,CAAK,kBAAA;EAgBb;;;;;;;EAR3C,KAAA,CAAM,WAAA,EAAa,WAAA,GAAc,SAAA,EAAA;EAEjC,MAAA,EAAQ,SAAA,IAAA;EAER,WAAA,EAAa,cAAA,IAAA;EAEb,YAAA,EAAc,eAAA,IAAA;EAEd,mBAAA,EAAqB,sBAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-sdk.mjs","names":[],"sources":["../../../../../../../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"}
1
+ {"version":3,"file":"mock-sdk.mjs","names":[],"sources":["../../../../../../../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 = {}): Omit<SDKAdapterContract, \"model\"> & {\n /**\n * Narrower than `SDKAdapterContract.model()` on purpose — the\n * instance really is a `MockModel`, so tests can reach `.calls` /\n * `.reset()` straight off the returned model instead of digging it\n * back out of `models`. Still satisfies the adapter contract:\n * `MockModel` implements `ModelContract`.\n */\n model(modelConfig: ModelConfig): MockModel;\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,GAiB/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"}
@@ -21,7 +21,18 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
21
21
  * `maxItems` so capable providers refuse to over-produce up front
22
22
  * (the planner still truncates the tail to `skipped` defensively).
23
23
  */
24
- declare function planSchema(capabilityNames: string[], maxSteps?: number): StandardSchemaV1<PlannerPlan>;
24
+ type PlanSchema = StandardSchemaV1<PlannerPlan> & {
25
+ "~standard": {
26
+ /**
27
+ * JSON Schema extension read by the native structured-output path.
28
+ * Part of the declared type so callers don't have to re-assert it.
29
+ */
30
+ jsonSchema: {
31
+ input: () => Record<string, unknown>;
32
+ };
33
+ };
34
+ };
35
+ declare function planSchema(capabilityNames: string[], maxSteps?: number): PlanSchema;
25
36
  //#endregion
26
37
  export { planSchema };
27
38
  //# sourceMappingURL=plan-schema.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plan-schema.d.mts","names":[],"sources":["../../../../../../../ai/src/planner/plan-schema.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;AAG+B;;;;;;;;iBAHf,UAAA,CACd,eAAA,YACA,QAAA,YACC,gBAAgB,CAAC,WAAA"}
1
+ {"version":3,"file":"plan-schema.d.mts","names":[],"sources":["../../../../../../../ai/src/planner/plan-schema.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;AAMqC;AAIrC;KAVY,UAAA,GAAa,gBAAA,CAAiB,WAAA;EACxC,WAAA;IASkF;;;;IAJhF,UAAA;MAAc,KAAA,QAAa,MAAA;IAAA;EAAA;AAAA;AAAA,iBAIf,UAAA,CAAW,eAAA,YAA2B,QAAA,YAAoB,UAAU"}
@@ -1,23 +1,4 @@
1
1
  //#region ../ai/src/planner/plan-schema.ts
2
- /**
3
- * Build the Standard Schema the planning agent emits — an ordered
4
- * `{ steps: [...], summary? }` plan whose every step references one of
5
- * `capabilityNames` via the `capability` field.
6
- *
7
- * Mirrors the router's hand-built schema approach
8
- * (`supervisor/router-factory.ts`): the JSON Schema extension carries
9
- * the capability names as an `enum` so capable providers enforce the
10
- * choice natively, while `validate()` still accepts the shape softly so
11
- * providers without native structured output can pass a parsed object
12
- * through. Validation is intentionally lenient on `capability` — an
13
- * unknown name is surfaced later by the planner as a typed
14
- * `PlannerPlanInvalidError`, with the full forensic context, rather
15
- * than as an opaque schema issue here.
16
- *
17
- * `maxSteps`, when provided, is emitted as the `steps` array's
18
- * `maxItems` so capable providers refuse to over-produce up front
19
- * (the planner still truncates the tail to `skipped` defensively).
20
- */
21
2
  function planSchema(capabilityNames, maxSteps) {
22
3
  const jsonSchema = {
23
4
  type: "object",
@@ -1 +1 @@
1
- {"version":3,"file":"plan-schema.mjs","names":[],"sources":["../../../../../../../ai/src/planner/plan-schema.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { PlannerPlan, PlannerStep } from \"../contracts/planner/planner-plan.type\";\n\n/**\n * Build the Standard Schema the planning agent emits — an ordered\n * `{ steps: [...], summary? }` plan whose every step references one of\n * `capabilityNames` via the `capability` field.\n *\n * Mirrors the router's hand-built schema approach\n * (`supervisor/router-factory.ts`): the JSON Schema extension carries\n * the capability names as an `enum` so capable providers enforce the\n * choice natively, while `validate()` still accepts the shape softly so\n * providers without native structured output can pass a parsed object\n * through. Validation is intentionally lenient on `capability` — an\n * unknown name is surfaced later by the planner as a typed\n * `PlannerPlanInvalidError`, with the full forensic context, rather\n * than as an opaque schema issue here.\n *\n * `maxSteps`, when provided, is emitted as the `steps` array's\n * `maxItems` so capable providers refuse to over-produce up front\n * (the planner still truncates the tail to `skipped` defensively).\n */\nexport function planSchema(\n capabilityNames: string[],\n maxSteps?: number,\n): StandardSchemaV1<PlannerPlan> {\n // OpenAI strict `json_schema` mode (and other native structured-output\n // providers) require EVERY property to appear in `required` — with truly\n // optional fields expressed as nullable — and reject array `minItems` /\n // `maxItems`. So the schema is strict-shaped: all keys required, the\n // optional ones nullable, no item-count bounds. A non-empty plan is\n // enforced in `validate()`, and `maxSteps` by the runtime's tail\n // truncation, so neither bound is needed on the wire.\n void maxSteps;\n\n const jsonSchema = {\n type: \"object\",\n properties: {\n summary: {\n type: [\"string\", \"null\"],\n description: \"One-line summary of the overall strategy.\",\n },\n steps: {\n type: \"array\",\n description: \"Ordered steps to execute, one capability dispatch each.\",\n items: stepItemsSchema(capabilityNames),\n },\n },\n required: [\"summary\", \"steps\"],\n additionalProperties: false,\n };\n\n return {\n \"~standard\": {\n version: 1,\n vendor: \"warlock-planner\",\n jsonSchema: {\n input: () => jsonSchema,\n },\n validate(value: unknown): StandardSchemaV1.Result<PlannerPlan> {\n if (!value || typeof value !== \"object\") {\n return { issues: [{ message: \"plan must be an object\" }] };\n }\n\n const record = value as { steps?: unknown; summary?: unknown };\n\n if (!Array.isArray(record.steps) || record.steps.length === 0) {\n return { issues: [{ message: \"plan `steps` must be a non-empty array\" }] };\n }\n\n const steps: PlannerStep[] = [];\n\n for (const raw of record.steps) {\n const normalized = normalizeStep(raw);\n\n if (!normalized) {\n return {\n issues: [{ message: \"each plan step must carry a string `capability` and `input`\" }],\n };\n }\n\n steps.push(normalized);\n }\n\n const summary = typeof record.summary === \"string\" ? record.summary : undefined;\n\n return { value: summary !== undefined ? { steps, summary } : { steps } };\n },\n } as StandardSchemaV1<PlannerPlan>[\"~standard\"] & {\n jsonSchema: { input: () => Record<string, unknown> };\n },\n };\n}\n\n/** Per-step JSON Schema object — one capability dispatch. */\nfunction stepItemsSchema(capabilityNames: string[]): Record<string, unknown> {\n return {\n type: \"object\",\n properties: {\n id: {\n type: [\"string\", \"null\"],\n description: \"Stable step id, referenced by dependsOn.\",\n },\n capability: {\n type: \"string\",\n enum: capabilityNames,\n description: \"Name of the capability to dispatch for this step.\",\n },\n input: {\n type: \"string\",\n description: \"Concrete input passed to the capability's execute().\",\n },\n reason: { type: [\"string\", \"null\"], description: \"Why this step exists.\" },\n dependsOn: {\n type: [\"array\", \"null\"],\n items: { type: \"string\" },\n description: \"Ids of steps this one conceptually follows.\",\n },\n },\n // Strict mode: every property required; the genuinely-optional ones\n // (id / reason / dependsOn) are nullable. `validate()` treats null and\n // missing identically, so a model emitting `null` round-trips fine.\n required: [\"id\", \"capability\", \"input\", \"reason\", \"dependsOn\"],\n additionalProperties: false,\n };\n}\n\n/**\n * Coerce one raw step object into a {@link PlannerStep}, returning\n * `undefined` when the mandatory `capability` / `input` strings are\n * missing. Optional fields are copied only when well-typed.\n */\nfunction normalizeStep(raw: unknown): PlannerStep | undefined {\n if (!raw || typeof raw !== \"object\") {\n return undefined;\n }\n\n const record = raw as {\n id?: unknown;\n capability?: unknown;\n input?: unknown;\n reason?: unknown;\n dependsOn?: unknown;\n };\n\n if (typeof record.capability !== \"string\" || record.capability.length === 0) {\n return undefined;\n }\n\n if (typeof record.input !== \"string\") {\n return undefined;\n }\n\n const step: PlannerStep = {\n capability: record.capability,\n input: record.input,\n };\n\n if (typeof record.id === \"string\") {\n step.id = record.id;\n }\n\n if (typeof record.reason === \"string\") {\n step.reason = record.reason;\n }\n\n if (Array.isArray(record.dependsOn) && record.dependsOn.every((entry) => typeof entry === \"string\")) {\n step.dependsOn = record.dependsOn as string[];\n }\n\n return step;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,WACd,iBACA,UAC+B;CAU/B,MAAM,aAAa;EACjB,MAAM;EACN,YAAY;GACV,SAAS;IACP,MAAM,CAAC,UAAU,MAAM;IACvB,aAAa;GACf;GACA,OAAO;IACL,MAAM;IACN,aAAa;IACb,OAAO,gBAAgB,eAAe;GACxC;EACF;EACA,UAAU,CAAC,WAAW,OAAO;EAC7B,sBAAsB;CACxB;CAEA,OAAO,EACL,aAAa;EACX,SAAS;EACT,QAAQ;EACR,YAAY,EACV,aAAa,WACf;EACA,SAAS,OAAsD;GAC7D,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,yBAAyB,CAAC,EAAE;GAG3D,MAAM,SAAS;GAEf,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,WAAW,GAC1D,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,yCAAyC,CAAC,EAAE;GAG3E,MAAM,QAAuB,CAAC;GAE9B,KAAK,MAAM,OAAO,OAAO,OAAO;IAC9B,MAAM,aAAa,cAAc,GAAG;IAEpC,IAAI,CAAC,YACH,OAAO,EACL,QAAQ,CAAC,EAAE,SAAS,8DAA8D,CAAC,EACrF;IAGF,MAAM,KAAK,UAAU;GACvB;GAEA,MAAM,UAAU,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU;GAEtE,OAAO,EAAE,OAAO,YAAY,SAAY;IAAE;IAAO;GAAQ,IAAI,EAAE,MAAM,EAAE;EACzE;CACF,EAGF;AACF;;AAGA,SAAS,gBAAgB,iBAAoD;CAC3E,OAAO;EACL,MAAM;EACN,YAAY;GACV,IAAI;IACF,MAAM,CAAC,UAAU,MAAM;IACvB,aAAa;GACf;GACA,YAAY;IACV,MAAM;IACN,MAAM;IACN,aAAa;GACf;GACA,OAAO;IACL,MAAM;IACN,aAAa;GACf;GACA,QAAQ;IAAE,MAAM,CAAC,UAAU,MAAM;IAAG,aAAa;GAAwB;GACzE,WAAW;IACT,MAAM,CAAC,SAAS,MAAM;IACtB,OAAO,EAAE,MAAM,SAAS;IACxB,aAAa;GACf;EACF;EAIA,UAAU;GAAC;GAAM;GAAc;GAAS;GAAU;EAAW;EAC7D,sBAAsB;CACxB;AACF;;;;;;AAOA,SAAS,cAAc,KAAuC;CAC5D,IAAI,CAAC,OAAO,OAAO,QAAQ,UACzB;CAGF,MAAM,SAAS;CAQf,IAAI,OAAO,OAAO,eAAe,YAAY,OAAO,WAAW,WAAW,GACxE;CAGF,IAAI,OAAO,OAAO,UAAU,UAC1B;CAGF,MAAM,OAAoB;EACxB,YAAY,OAAO;EACnB,OAAO,OAAO;CAChB;CAEA,IAAI,OAAO,OAAO,OAAO,UACvB,KAAK,KAAK,OAAO;CAGnB,IAAI,OAAO,OAAO,WAAW,UAC3B,KAAK,SAAS,OAAO;CAGvB,IAAI,MAAM,QAAQ,OAAO,SAAS,KAAK,OAAO,UAAU,OAAO,UAAU,OAAO,UAAU,QAAQ,GAChG,KAAK,YAAY,OAAO;CAG1B,OAAO;AACT"}
1
+ {"version":3,"file":"plan-schema.mjs","names":[],"sources":["../../../../../../../ai/src/planner/plan-schema.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { PlannerPlan, PlannerStep } from \"../contracts/planner/planner-plan.type\";\n\n/**\n * Build the Standard Schema the planning agent emits — an ordered\n * `{ steps: [...], summary? }` plan whose every step references one of\n * `capabilityNames` via the `capability` field.\n *\n * Mirrors the router's hand-built schema approach\n * (`supervisor/router-factory.ts`): the JSON Schema extension carries\n * the capability names as an `enum` so capable providers enforce the\n * choice natively, while `validate()` still accepts the shape softly so\n * providers without native structured output can pass a parsed object\n * through. Validation is intentionally lenient on `capability` — an\n * unknown name is surfaced later by the planner as a typed\n * `PlannerPlanInvalidError`, with the full forensic context, rather\n * than as an opaque schema issue here.\n *\n * `maxSteps`, when provided, is emitted as the `steps` array's\n * `maxItems` so capable providers refuse to over-produce up front\n * (the planner still truncates the tail to `skipped` defensively).\n */\nexport type PlanSchema = StandardSchemaV1<PlannerPlan> & {\n \"~standard\": {\n /**\n * JSON Schema extension read by the native structured-output path.\n * Part of the declared type so callers don't have to re-assert it.\n */\n jsonSchema: { input: () => Record<string, unknown> };\n };\n};\n\nexport function planSchema(capabilityNames: string[], maxSteps?: number): PlanSchema {\n // OpenAI strict `json_schema` mode (and other native structured-output\n // providers) require EVERY property to appear in `required` — with truly\n // optional fields expressed as nullable — and reject array `minItems` /\n // `maxItems`. So the schema is strict-shaped: all keys required, the\n // optional ones nullable, no item-count bounds. A non-empty plan is\n // enforced in `validate()`, and `maxSteps` by the runtime's tail\n // truncation, so neither bound is needed on the wire.\n void maxSteps;\n\n const jsonSchema = {\n type: \"object\",\n properties: {\n summary: {\n type: [\"string\", \"null\"],\n description: \"One-line summary of the overall strategy.\",\n },\n steps: {\n type: \"array\",\n description: \"Ordered steps to execute, one capability dispatch each.\",\n items: stepItemsSchema(capabilityNames),\n },\n },\n required: [\"summary\", \"steps\"],\n additionalProperties: false,\n };\n\n return {\n \"~standard\": {\n version: 1,\n vendor: \"warlock-planner\",\n jsonSchema: {\n input: () => jsonSchema,\n },\n validate(value: unknown): StandardSchemaV1.Result<PlannerPlan> {\n if (!value || typeof value !== \"object\") {\n return { issues: [{ message: \"plan must be an object\" }] };\n }\n\n const record = value as { steps?: unknown; summary?: unknown };\n\n if (!Array.isArray(record.steps) || record.steps.length === 0) {\n return { issues: [{ message: \"plan `steps` must be a non-empty array\" }] };\n }\n\n const steps: PlannerStep[] = [];\n\n for (const raw of record.steps) {\n const normalized = normalizeStep(raw);\n\n if (!normalized) {\n return {\n issues: [{ message: \"each plan step must carry a string `capability` and `input`\" }],\n };\n }\n\n steps.push(normalized);\n }\n\n const summary = typeof record.summary === \"string\" ? record.summary : undefined;\n\n return { value: summary !== undefined ? { steps, summary } : { steps } };\n },\n } as StandardSchemaV1<PlannerPlan>[\"~standard\"] & {\n jsonSchema: { input: () => Record<string, unknown> };\n },\n };\n}\n\n/** Per-step JSON Schema object — one capability dispatch. */\nfunction stepItemsSchema(capabilityNames: string[]): Record<string, unknown> {\n return {\n type: \"object\",\n properties: {\n id: {\n type: [\"string\", \"null\"],\n description: \"Stable step id, referenced by dependsOn.\",\n },\n capability: {\n type: \"string\",\n enum: capabilityNames,\n description: \"Name of the capability to dispatch for this step.\",\n },\n input: {\n type: \"string\",\n description: \"Concrete input passed to the capability's execute().\",\n },\n reason: { type: [\"string\", \"null\"], description: \"Why this step exists.\" },\n dependsOn: {\n type: [\"array\", \"null\"],\n items: { type: \"string\" },\n description: \"Ids of steps this one conceptually follows.\",\n },\n },\n // Strict mode: every property required; the genuinely-optional ones\n // (id / reason / dependsOn) are nullable. `validate()` treats null and\n // missing identically, so a model emitting `null` round-trips fine.\n required: [\"id\", \"capability\", \"input\", \"reason\", \"dependsOn\"],\n additionalProperties: false,\n };\n}\n\n/**\n * Coerce one raw step object into a {@link PlannerStep}, returning\n * `undefined` when the mandatory `capability` / `input` strings are\n * missing. Optional fields are copied only when well-typed.\n */\nfunction normalizeStep(raw: unknown): PlannerStep | undefined {\n if (!raw || typeof raw !== \"object\") {\n return undefined;\n }\n\n const record = raw as {\n id?: unknown;\n capability?: unknown;\n input?: unknown;\n reason?: unknown;\n dependsOn?: unknown;\n };\n\n if (typeof record.capability !== \"string\" || record.capability.length === 0) {\n return undefined;\n }\n\n if (typeof record.input !== \"string\") {\n return undefined;\n }\n\n const step: PlannerStep = {\n capability: record.capability,\n input: record.input,\n };\n\n if (typeof record.id === \"string\") {\n step.id = record.id;\n }\n\n if (typeof record.reason === \"string\") {\n step.reason = record.reason;\n }\n\n if (Array.isArray(record.dependsOn) && record.dependsOn.every((entry) => typeof entry === \"string\")) {\n step.dependsOn = record.dependsOn as string[];\n }\n\n return step;\n}\n"],"mappings":";AAgCA,SAAgB,WAAW,iBAA2B,UAA+B;CAUnF,MAAM,aAAa;EACjB,MAAM;EACN,YAAY;GACV,SAAS;IACP,MAAM,CAAC,UAAU,MAAM;IACvB,aAAa;GACf;GACA,OAAO;IACL,MAAM;IACN,aAAa;IACb,OAAO,gBAAgB,eAAe;GACxC;EACF;EACA,UAAU,CAAC,WAAW,OAAO;EAC7B,sBAAsB;CACxB;CAEA,OAAO,EACL,aAAa;EACX,SAAS;EACT,QAAQ;EACR,YAAY,EACV,aAAa,WACf;EACA,SAAS,OAAsD;GAC7D,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,yBAAyB,CAAC,EAAE;GAG3D,MAAM,SAAS;GAEf,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,WAAW,GAC1D,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,yCAAyC,CAAC,EAAE;GAG3E,MAAM,QAAuB,CAAC;GAE9B,KAAK,MAAM,OAAO,OAAO,OAAO;IAC9B,MAAM,aAAa,cAAc,GAAG;IAEpC,IAAI,CAAC,YACH,OAAO,EACL,QAAQ,CAAC,EAAE,SAAS,8DAA8D,CAAC,EACrF;IAGF,MAAM,KAAK,UAAU;GACvB;GAEA,MAAM,UAAU,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU;GAEtE,OAAO,EAAE,OAAO,YAAY,SAAY;IAAE;IAAO;GAAQ,IAAI,EAAE,MAAM,EAAE;EACzE;CACF,EAGF;AACF;;AAGA,SAAS,gBAAgB,iBAAoD;CAC3E,OAAO;EACL,MAAM;EACN,YAAY;GACV,IAAI;IACF,MAAM,CAAC,UAAU,MAAM;IACvB,aAAa;GACf;GACA,YAAY;IACV,MAAM;IACN,MAAM;IACN,aAAa;GACf;GACA,OAAO;IACL,MAAM;IACN,aAAa;GACf;GACA,QAAQ;IAAE,MAAM,CAAC,UAAU,MAAM;IAAG,aAAa;GAAwB;GACzE,WAAW;IACT,MAAM,CAAC,SAAS,MAAM;IACtB,OAAO,EAAE,MAAM,SAAS;IACxB,aAAa;GACf;EACF;EAIA,UAAU;GAAC;GAAM;GAAc;GAAS;GAAU;EAAW;EAC7D,sBAAsB;CACxB;AACF;;;;;;AAOA,SAAS,cAAc,KAAuC;CAC5D,IAAI,CAAC,OAAO,OAAO,QAAQ,UACzB;CAGF,MAAM,SAAS;CAQf,IAAI,OAAO,OAAO,eAAe,YAAY,OAAO,WAAW,WAAW,GACxE;CAGF,IAAI,OAAO,OAAO,UAAU,UAC1B;CAGF,MAAM,OAAoB;EACxB,YAAY,OAAO;EACnB,OAAO,OAAO;CAChB;CAEA,IAAI,OAAO,OAAO,OAAO,UACvB,KAAK,KAAK,OAAO;CAGnB,IAAI,OAAO,OAAO,WAAW,UAC3B,KAAK,SAAS,OAAO;CAGvB,IAAI,MAAM,QAAQ,OAAO,SAAS,KAAK,OAAO,UAAU,OAAO,UAAU,OAAO,UAAU,QAAQ,GAChG,KAAK,YAAY,OAAO;CAG1B,OAAO;AACT"}
@@ -373,18 +373,6 @@ declare class SupervisorExecution<TOutput> {
373
373
  * through unchanged so structured inputs work.
374
374
  */
375
375
  private coerceInlineInput;
376
- /**
377
- * Heuristic detection of `SupervisorContract` — the contract carries
378
- * a `signature` getter same as workflows, but supervisors expose
379
- * `resume()` while workflows expose `resume(runId, options)` too.
380
- * Cleanest distinguisher in the public surface: supervisors carry
381
- * the `asTool` method name `as` … unfortunately so do workflows.
382
- * Use the `streamableType` brand if we add one in v2; for now lean
383
- * on a duck-typed check that's good enough for the ctx.run path
384
- * (incorrect routing for workflows would still produce a runnable
385
- * call — workflow.execute accepts the same args either way).
386
- */
387
- private isSupervisor;
388
376
  /**
389
377
  * Invoke the underlying dispatchable unit. Agents and workflows
390
378
  * both satisfy `ExecutableContract<string, …>` so the call shape
@@ -1 +1 @@
1
- {"version":3,"file":"execution.d.mts","names":[],"sources":["../../../../../../../ai/src/supervisor/execution.ts"],"mappings":";;;;;;;;;;KA0EY,yBAAA;EACV,MAAA,EAAQ,gBAAA,CAAiB,OAAA;EACzB,OAAA,EAAS,GAAA,SAAY,mBAAA;EACrB,SAAA;EACA,OAAA,EAAS,iBAAA;EACT,KAAA,EAAO,eAAA;EACP,KAAA;EACA,OAAA,GAAU,wBAAA;EACV,gBAAA,GAAmB,0BAAA,CAA2B,gBAAA,CAAiB,OAAA;EAC/D,UAAA,GAAa,kBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8BF,mBAAA;EAAA,iBACM,MAAA;EAAA,iBACA,OAAA;EAAA,iBACA,SAAA;EAAA,iBACA,OAAA;EAAA,iBACA,KAAA;EAAA,iBACA,KAAA;EAAA,iBACA,OAAA;EAAA,iBACA,gBAAA;EAAA,iBACA,UAAA;EAAA,iBAEA,aAAA;EAAA,iBACA,MAAA;EAAA,iBACA,SAAA;EAbc;;;;;;;EAAA,iBAsBd,UAAA;EAdA;;;;;;EAAA,iBAqBA,eAAA;EAAA,iBAEA,SAAA;EAAA,iBACA,YAAA;EAAA,iBACA,KAAA;EAAA,iBAEA,YAAA;EAAA,iBACA,SAAA;EAAA,QAET,SAAA;EAAA,QACA,eAAA;EAUA;;;;;;;;;EAAA,QAAA,mBAAA;EAAA,QACA,YAAA;EAAA,QACA,MAAA;EAAA,QACA,cAAA;EAAA,QACA,KAAA;EAAA,QACA,IAAA;EAAA,QACA,mBAAA;EA6ES;;;;;;EAAA,QAtET,KAAA;EAgNK;;;;;;;;;;EAAA,QArML,gBAAA;EAqzBM;;;;;;;;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