@theokit/sdk 2.29.0 → 2.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-tP-8O-hR.cjs';
2
- export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-tP-8O-hR.cjs';
3
- import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, I as InlineSkill, n as ConversationStorageAdapter, o as StoredMessage, p as SessionMeta, q as SessionMetaPatch, O as ObjectiveRecord, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as SDKProvider } from './cron-yJoNUZxe.cjs';
4
- export { v as ActiveMemoryPassArgs, w as ActiveMemoryPassResult, x as AgentGoalConfig, y as AgentMemory, z as BudgetCheck, D as BudgetTotal, E as BudgetUsageEvent, F as CloudEnv, H as CloudRepo, J as ContextBudget, K as ContextManagerKind, N as ContextSnapshot, Q as ContextSource, R as ContextSourceStatus, T as CreateSkillSpec, U as Cron, V as CronCreateOptions, W as CronGetOptions, X as CronJob, Y as CronJobStatus, Z as CronListOptions, _ as CronOperationOptions, $ as CronRunOptions, a0 as CronRuntime, a1 as CronSchedulerStatus, a2 as CronStartOptions, a3 as DurableGoalOptions, a4 as GoalEvent, a5 as GoalOptions, a6 as GoalResult, a7 as HookName, a8 as InvalidateCacheOptions, a9 as MemoryAdapter, aa as MemoryAdapterCapabilities, ab as MemoryContext, ac as MemoryFact, ad as MemoryProviderHandle, ae as MemoryProviderInitOptions, af as MemoryRevision, ag as MemoryToolSchema, ah as MemoryTurnMessage, ai as ObjectiveStatus, aj as PersonalityPreset, ak as PluginContext, al as PostAssistantReplyContext, am as PreToolCallContext, an as PreUserSendContext, ao as PreUserSendResult, ap as ProviderCapability, aq as ProviderRoute, ar as RecordSessionSummaryArgs, as as ResolvedProviderRoute, at as RunUntilIterator, au as SDKAgentPlugins, av as SDKAgentSkillDetail, aw as SDKAgentSkills, ax as SDKArtifact, ay as SDKContextManager, az as SDKPluginMetadata, aA as SDKProvidersManager, aB as SettingSource, aC as SkillsResolver, aD as SkillsResolverContext, aE as SystemPromptContext, aF as SystemPromptMemoryFact, aG as SystemPromptSkillRef, aH as TelemetrySettings, aI as createSkill, aJ as definePlugin } from './cron-yJoNUZxe.cjs';
5
- import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, S as SDKMessage, c as MessageOrigin } from './run-q_P0vHlY.cjs';
6
- export { A as AgentConversationTurn, d as AssistantMessage, e as CompletionCheck, f as CompletionCheckResult, g as ConversationStep, h as ConversationTurn, i as CostBreakdown, j as CostSource, k as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, l as GenerateRunResult, I as ImageBlock, m as InputProcessorContext, n as InteractionUpdate, o as McpAuthConfig, p as McpHttpServerConfig, q as McpOAuthConfig, r as McpStdioServerConfig, s as ModelParameterValue, O as OutputProcessorContext, t as PartialToolCallUpdate, u as ProcessorControls, v as ProcessorTripwire, w as ProcessorViolation, x as RunCompactBoundaryEvent, y as RunCompletionCheckEvent, z as RunErrorDetail, B as RunEvent, E as RunEventSink, F as RunGitInfo, H as RunOperation, J as RunPermissionDeniedEvent, K as RunRateLimitEvent, L as RunStatus, N as RunTaskCompletedEvent, Q as RunTaskStartedEvent, U as RunTaskUpdatedEvent, V as RunToCompletionOptions, W as RunToCompletionResult, X as RunToolProgressEvent, Y as RunTripwireEvent, Z as SDKAssistantMessage, _ as SDKImage, $ as SDKImageDimension, a0 as SDKObjectDelta, a1 as SDKRequestMessage, a2 as SDKStatusMessage, a3 as SDKSystemMessage, a4 as SDKTaskMessage, a5 as SDKThinkingMessage, a6 as SDKToolUseMessage, a7 as SDKUserMessage, a8 as SDKUserMessageEvent, a9 as SendOptions, aa as ShellCommand, ab as ShellConversationTurn, ac as ShellOutput, ad as ShellOutputDeltaUpdate, ae as StepCompletedUpdate, af as StepStartedUpdate, ag as StreamToCompletionResult, ah as SummaryCompletedUpdate, ai as SummaryStartedUpdate, aj as SummaryUpdate, ak as TextBlock, al as TextDeltaUpdate, am as ThinkingCompletedUpdate, an as ThinkingDeltaUpdate, ao as ThinkingMessage, ap as TokenDeltaUpdate, aq as TokenUsage, ar as ToolCall, as as ToolCallCompletedUpdate, at as ToolCallStartedUpdate, au as ToolContextMessage, av as ToolResult, aw as ToolResultGuardOptions, ax as ToolUseBlock, ay as TurnEndedUpdate, az as UserMessage, aA as UserMessageAppendedUpdate, aB as emitRunEvent } from './run-q_P0vHlY.cjs';
1
+ import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-DZpCGlYv.cjs';
2
+ export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-DZpCGlYv.cjs';
3
+ import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, I as InlineSkill, n as ConversationStorageAdapter, o as StoredMessage, p as SessionMeta, q as SessionMetaPatch, O as ObjectiveRecord, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as StepResult, v as SDKProvider } from './cron-t4oKI2Is.cjs';
4
+ export { w as ActiveMemoryPassArgs, x as ActiveMemoryPassResult, y as AgentGoalConfig, z as AgentMemory, D as BudgetCheck, E as BudgetTotal, F as BudgetUsageEvent, H as CloudEnv, J as CloudRepo, K as ContextBudget, N as ContextManagerKind, Q as ContextSnapshot, R as ContextSource, T as ContextSourceStatus, U as CreateSkillSpec, V as Cron, W as CronCreateOptions, X as CronGetOptions, Y as CronJob, Z as CronJobStatus, _ as CronListOptions, $ as CronOperationOptions, a0 as CronRunOptions, a1 as CronRuntime, a2 as CronSchedulerStatus, a3 as CronStartOptions, a4 as DurableGoalOptions, a5 as GoalEvent, a6 as GoalOptions, a7 as GoalResult, a8 as HookName, a9 as InvalidateCacheOptions, aa as MemoryAdapter, ab as MemoryAdapterCapabilities, ac as MemoryContext, ad as MemoryFact, ae as MemoryProviderHandle, af as MemoryProviderInitOptions, ag as MemoryRevision, ah as MemoryToolSchema, ai as MemoryTurnMessage, aj as ObjectiveStatus, ak as PersonalityPreset, al as PluginContext, am as PostAssistantReplyContext, an as PreToolCallContext, ao as PreUserSendContext, ap as PreUserSendResult, aq as ProviderCapability, ar as ProviderRoute, as as RecordSessionSummaryArgs, at as ResolvedProviderRoute, au as RunUntilIterator, av as SDKAgentPlugins, aw as SDKAgentSkillDetail, ax as SDKAgentSkills, ay as SDKArtifact, az as SDKContextManager, aA as SDKPluginMetadata, aB as SDKProvidersManager, aC as SettingSource, aD as SkillsResolver, aE as SkillsResolverContext, aF as SystemPromptContext, aG as SystemPromptMemoryFact, aH as SystemPromptSkillRef, aI as TelemetrySettings, aJ as createSkill, aK as definePlugin } from './cron-t4oKI2Is.cjs';
5
+ import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, S as SDKMessage } from './run-CLXKMRgq.cjs';
6
+ export { A as AgentConversationTurn, c as AssistantMessage, d as CompletionCheck, e as CompletionCheckResult, f as ConversationStep, g as ConversationTurn, h as CostBreakdown, i as CostSource, j as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, k as GenerateRunResult, I as ImageBlock, l as InputProcessorContext, m as InteractionUpdate, n as McpAuthConfig, o as McpHttpServerConfig, p as McpOAuthConfig, q as McpStdioServerConfig, r as MessageOrigin, s as ModelParameterValue, O as OutputProcessorContext, t as PartialToolCallUpdate, u as ProcessorControls, v as ProcessorTripwire, w as ProcessorViolation, x as RunCompactBoundaryEvent, y as RunCompletionCheckEvent, z as RunErrorDetail, B as RunEvent, E as RunEventSink, F as RunGitInfo, H as RunOperation, J as RunPermissionDeniedEvent, K as RunRateLimitEvent, L as RunStatus, N as RunTaskCompletedEvent, Q as RunTaskStartedEvent, U as RunTaskUpdatedEvent, V as RunToCompletionOptions, W as RunToCompletionResult, X as RunToolProgressEvent, Y as RunTripwireEvent, Z as SDKAssistantMessage, _ as SDKImage, $ as SDKImageDimension, a0 as SDKObjectDelta, a1 as SDKRequestMessage, a2 as SDKStatusMessage, a3 as SDKSystemMessage, a4 as SDKTaskMessage, a5 as SDKThinkingMessage, a6 as SDKToolUseMessage, a7 as SDKUserMessage, a8 as SDKUserMessageEvent, a9 as SendOptions, aa as ShellCommand, ab as ShellConversationTurn, ac as ShellOutput, ad as ShellOutputDeltaUpdate, ae as StepCompletedUpdate, af as StepStartedUpdate, ag as StreamToCompletionResult, ah as SummaryCompletedUpdate, ai as SummaryStartedUpdate, aj as SummaryUpdate, ak as TextBlock, al as TextDeltaUpdate, am as ThinkingCompletedUpdate, an as ThinkingDeltaUpdate, ao as ThinkingMessage, ap as TokenDeltaUpdate, aq as TokenUsage, ar as ToolCall, as as ToolCallCompletedUpdate, at as ToolCallStartedUpdate, au as ToolContextMessage, av as ToolResult, aw as ToolResultGuardOptions, ax as ToolUseBlock, ay as TurnEndedUpdate, az as UserMessage, aA as UserMessageAppendedUpdate, aB as emitRunEvent } from './run-CLXKMRgq.cjs';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
9
 
@@ -1903,134 +1903,6 @@ declare function scopedConversationId(scope: SessionScope, id: string): string;
1903
1903
  /** M3 #62 — the id prefix (`"<scope>__"`) used to match a scope's conversations. */
1904
1904
  declare function sessionScopePrefix(scope: SessionScope): string;
1905
1905
 
1906
- /**
1907
- * Public type contract for `Workflow.create / .run / .resume` (Adoption
1908
- * Roadmap #5; ADRs D230-D248).
1909
- *
1910
- * Step types form a discriminated union by `kind`. Helper factory functions
1911
- * (`fn()`, `agentStep()`) live in `workflow.ts` and hide the discriminator
1912
- * from end users.
1913
- *
1914
- * @public
1915
- */
1916
-
1917
- type Step = FnStep | AgentStep | ParallelStep | BranchStep | ForeachStep | DowhileStep | SleepStep | SuspendStep;
1918
- /** A pure function step. */
1919
- interface FnStep {
1920
- readonly kind: "fn";
1921
- readonly id: string;
1922
- readonly fn: (input: unknown, ctx: StepContext) => Promise<unknown> | unknown;
1923
- readonly inputSchema?: ZodType;
1924
- readonly outputSchema?: ZodType;
1925
- readonly retry?: RetryPolicy;
1926
- /** D238 — slot reserved; runtime throws if engine not yet implemented. */
1927
- readonly compensate?: (input: unknown, output: unknown, error: Error) => Promise<void> | void;
1928
- }
1929
- /** An agent.send-driven step. */
1930
- interface AgentStep {
1931
- readonly kind: "agent";
1932
- readonly id: string;
1933
- readonly agent: SDKAgent;
1934
- readonly promptTemplate: string | ((input: unknown) => string);
1935
- readonly retry?: RetryPolicy;
1936
- /**
1937
- * SE3 — provenance stamped onto this step's `agent.send()` (forwarded to
1938
- * `RunResult.origin`). Squad sets `{ kind: "peer", from: "agent-<i-1>" }` on
1939
- * every step after the first so a peer-driven turn is attributable.
1940
- */
1941
- readonly origin?: MessageOrigin;
1942
- }
1943
- /** N concurrent branches, each its own mini-step-list. */
1944
- interface ParallelStep {
1945
- readonly kind: "parallel";
1946
- readonly id: string;
1947
- readonly branches: ReadonlyArray<ReadonlyArray<Step>>;
1948
- readonly concurrency?: number;
1949
- readonly errorPolicy?: "fail-fast" | "collect";
1950
- }
1951
- /** First-match-wins predicates + optional fallback. */
1952
- interface BranchStep {
1953
- readonly kind: "branch";
1954
- readonly id: string;
1955
- readonly predicates: ReadonlyArray<readonly [(input: unknown) => boolean | Promise<boolean>, ReadonlyArray<Step>]>;
1956
- readonly fallback?: ReadonlyArray<Step>;
1957
- }
1958
- /** Map a step over an upstream array output. */
1959
- interface ForeachStep {
1960
- readonly kind: "foreach";
1961
- readonly id: string;
1962
- /** ID of an upstream top-level step whose output is iterable. */
1963
- readonly iterableFrom: string;
1964
- readonly step: Step;
1965
- readonly concurrency?: number;
1966
- }
1967
- /** Loop a step until condFn returns false. */
1968
- interface DowhileStep {
1969
- readonly kind: "dowhile";
1970
- readonly id: string;
1971
- readonly step: Step;
1972
- readonly condFn: (output: unknown, iteration: number) => boolean | Promise<boolean>;
1973
- readonly maxIterations?: number;
1974
- }
1975
- /** Pause for a fixed duration. */
1976
- interface SleepStep {
1977
- readonly kind: "sleep";
1978
- readonly id: string;
1979
- readonly durationMs: number;
1980
- }
1981
- /** Standalone explicit suspend point. */
1982
- interface SuspendStep {
1983
- readonly kind: "suspend";
1984
- readonly id: string;
1985
- readonly payloadSchema?: ZodType;
1986
- }
1987
- /** D237 — retry policy applied per fn/agent step. */
1988
- interface RetryPolicy {
1989
- /** Total attempts (MIN 1, MAX 20). `1` = no retry. */
1990
- readonly maxAttempts: number;
1991
- readonly initialBackoffMs?: number;
1992
- readonly backoffCoefficient?: number;
1993
- readonly maximumBackoffMs?: number;
1994
- readonly nonRetryableErrors?: ReadonlyArray<string>;
1995
- }
1996
- /** D247 — context handed to every step.fn. */
1997
- interface StepContext {
1998
- readonly runId: string;
1999
- readonly signal: AbortSignal;
2000
- readonly log: {
2001
- debug: (msg: string, attrs?: Record<string, unknown>) => void;
2002
- info: (msg: string, attrs?: Record<string, unknown>) => void;
2003
- warn: (msg: string, attrs?: Record<string, unknown>) => void;
2004
- };
2005
- /** Pause the workflow; resume via `Workflow.resume({...})`. */
2006
- readonly suspend: (payload?: unknown) => Promise<never>;
2007
- /**
2008
- * SE29 — the workflow's shared state (from `WorkflowOptions.initialState`,
2009
- * mutated by {@link setState}), visible to every subsequent step in the run.
2010
- * `undefined` when no `initialState`/`setState` has run. Persisted across
2011
- * suspend/resume.
2012
- */
2013
- readonly state: unknown;
2014
- /**
2015
- * SE29 — update the shared state for subsequent steps. Validated against
2016
- * `WorkflowOptions.stateSchema` when set (a mismatch throws
2017
- * {@link WorkflowStateError}, which fails the step/run — Rule 8).
2018
- */
2019
- readonly setState: (next: unknown) => void;
2020
- }
2021
- interface StepResult {
2022
- readonly stepId: string;
2023
- readonly kind: Step["kind"];
2024
- readonly status: "completed" | "failed" | "skipped" | "suspended";
2025
- readonly attempts: number;
2026
- readonly durationMs: number;
2027
- readonly output?: unknown;
2028
- readonly error?: {
2029
- name: string;
2030
- message: string;
2031
- };
2032
- }
2033
-
2034
1906
  /**
2035
1907
  * `createSquad` — a sequential team of agents.
2036
1908
  *
@@ -2588,4 +2460,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
2588
2460
  model?: string;
2589
2461
  }): ShareGptTrajectory | null;
2590
2462
 
2591
- export { Agent, AgentBuilder, AgentDefinition, type AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, BudgetTracker, CloudOptions, ContextSettings, ConversationStorageAdapter, type CounterBudgetTrackerOptions, CustomTool, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DreamingSweepOptions, type DreamingSweepResult, ErrorMetadata, EventBus, type EvictReason, FileSystemConversationStorage, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, InMemoryConversationStorage, InlineSkill, JobQueue, type JobQueueOptions, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, MessageOrigin, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, type NormalizedJsonSchema, ObjectiveRecord, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, type PermissionMode, type PermissionPluginOptions, type PermissionRule, Plugin, PluginsSettings, PreToolCallDecision, Processor, ProviderProfile, ProviderRoutingSettings, type ReplayHistoryOptions, Run, RunResult, SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, Security, type SessionCapabilityResult, type SessionListOptions, type SessionManager, SessionMeta, SessionMetaPatch, type SessionScope, type SessionSummary, type ShareGptMessage, type ShareGptTrajectory, SkillsSettings, type Squad, type SquadOptions, type SquadRun, StoredMessage, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, Theokit, TheokitAgentError, type TheokitRequestOptions, type TokenLimiterOptions, ToolError, ToolResultContentBlock, type UnicodeNormalizerOptions, UsageAccumulator, applyMode, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSessionManager, createSquad, createTokenLimiter, createUnicodeNormalizer, defineProvider, defineSkillReadTool, defineTool, estimateTokens, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
2463
+ export { Agent, AgentBuilder, AgentDefinition, type AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, BudgetTracker, CloudOptions, ContextSettings, ConversationStorageAdapter, type CounterBudgetTrackerOptions, CustomTool, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DreamingSweepOptions, type DreamingSweepResult, ErrorMetadata, EventBus, type EvictReason, FileSystemConversationStorage, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, InMemoryConversationStorage, InlineSkill, JobQueue, type JobQueueOptions, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, type NormalizedJsonSchema, ObjectiveRecord, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, type PermissionMode, type PermissionPluginOptions, type PermissionRule, Plugin, PluginsSettings, PreToolCallDecision, Processor, ProviderProfile, ProviderRoutingSettings, type ReplayHistoryOptions, Run, RunResult, SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, Security, type SessionCapabilityResult, type SessionListOptions, type SessionManager, SessionMeta, SessionMetaPatch, type SessionScope, type SessionSummary, type ShareGptMessage, type ShareGptTrajectory, SkillsSettings, type Squad, type SquadOptions, type SquadRun, StoredMessage, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, Theokit, TheokitAgentError, type TheokitRequestOptions, type TokenLimiterOptions, ToolError, ToolResultContentBlock, type UnicodeNormalizerOptions, UsageAccumulator, applyMode, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSessionManager, createSquad, createTokenLimiter, createUnicodeNormalizer, defineProvider, defineSkillReadTool, defineTool, estimateTokens, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-BxMIlgLP.js';
2
- export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-BxMIlgLP.js';
3
- import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, I as InlineSkill, n as ConversationStorageAdapter, o as StoredMessage, p as SessionMeta, q as SessionMetaPatch, O as ObjectiveRecord, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as SDKProvider } from './cron-COSAehOL.js';
4
- export { v as ActiveMemoryPassArgs, w as ActiveMemoryPassResult, x as AgentGoalConfig, y as AgentMemory, z as BudgetCheck, D as BudgetTotal, E as BudgetUsageEvent, F as CloudEnv, H as CloudRepo, J as ContextBudget, K as ContextManagerKind, N as ContextSnapshot, Q as ContextSource, R as ContextSourceStatus, T as CreateSkillSpec, U as Cron, V as CronCreateOptions, W as CronGetOptions, X as CronJob, Y as CronJobStatus, Z as CronListOptions, _ as CronOperationOptions, $ as CronRunOptions, a0 as CronRuntime, a1 as CronSchedulerStatus, a2 as CronStartOptions, a3 as DurableGoalOptions, a4 as GoalEvent, a5 as GoalOptions, a6 as GoalResult, a7 as HookName, a8 as InvalidateCacheOptions, a9 as MemoryAdapter, aa as MemoryAdapterCapabilities, ab as MemoryContext, ac as MemoryFact, ad as MemoryProviderHandle, ae as MemoryProviderInitOptions, af as MemoryRevision, ag as MemoryToolSchema, ah as MemoryTurnMessage, ai as ObjectiveStatus, aj as PersonalityPreset, ak as PluginContext, al as PostAssistantReplyContext, am as PreToolCallContext, an as PreUserSendContext, ao as PreUserSendResult, ap as ProviderCapability, aq as ProviderRoute, ar as RecordSessionSummaryArgs, as as ResolvedProviderRoute, at as RunUntilIterator, au as SDKAgentPlugins, av as SDKAgentSkillDetail, aw as SDKAgentSkills, ax as SDKArtifact, ay as SDKContextManager, az as SDKPluginMetadata, aA as SDKProvidersManager, aB as SettingSource, aC as SkillsResolver, aD as SkillsResolverContext, aE as SystemPromptContext, aF as SystemPromptMemoryFact, aG as SystemPromptSkillRef, aH as TelemetrySettings, aI as createSkill, aJ as definePlugin } from './cron-COSAehOL.js';
5
- import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, S as SDKMessage, c as MessageOrigin } from './run-q_P0vHlY.js';
6
- export { A as AgentConversationTurn, d as AssistantMessage, e as CompletionCheck, f as CompletionCheckResult, g as ConversationStep, h as ConversationTurn, i as CostBreakdown, j as CostSource, k as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, l as GenerateRunResult, I as ImageBlock, m as InputProcessorContext, n as InteractionUpdate, o as McpAuthConfig, p as McpHttpServerConfig, q as McpOAuthConfig, r as McpStdioServerConfig, s as ModelParameterValue, O as OutputProcessorContext, t as PartialToolCallUpdate, u as ProcessorControls, v as ProcessorTripwire, w as ProcessorViolation, x as RunCompactBoundaryEvent, y as RunCompletionCheckEvent, z as RunErrorDetail, B as RunEvent, E as RunEventSink, F as RunGitInfo, H as RunOperation, J as RunPermissionDeniedEvent, K as RunRateLimitEvent, L as RunStatus, N as RunTaskCompletedEvent, Q as RunTaskStartedEvent, U as RunTaskUpdatedEvent, V as RunToCompletionOptions, W as RunToCompletionResult, X as RunToolProgressEvent, Y as RunTripwireEvent, Z as SDKAssistantMessage, _ as SDKImage, $ as SDKImageDimension, a0 as SDKObjectDelta, a1 as SDKRequestMessage, a2 as SDKStatusMessage, a3 as SDKSystemMessage, a4 as SDKTaskMessage, a5 as SDKThinkingMessage, a6 as SDKToolUseMessage, a7 as SDKUserMessage, a8 as SDKUserMessageEvent, a9 as SendOptions, aa as ShellCommand, ab as ShellConversationTurn, ac as ShellOutput, ad as ShellOutputDeltaUpdate, ae as StepCompletedUpdate, af as StepStartedUpdate, ag as StreamToCompletionResult, ah as SummaryCompletedUpdate, ai as SummaryStartedUpdate, aj as SummaryUpdate, ak as TextBlock, al as TextDeltaUpdate, am as ThinkingCompletedUpdate, an as ThinkingDeltaUpdate, ao as ThinkingMessage, ap as TokenDeltaUpdate, aq as TokenUsage, ar as ToolCall, as as ToolCallCompletedUpdate, at as ToolCallStartedUpdate, au as ToolContextMessage, av as ToolResult, aw as ToolResultGuardOptions, ax as ToolUseBlock, ay as TurnEndedUpdate, az as UserMessage, aA as UserMessageAppendedUpdate, aB as emitRunEvent } from './run-q_P0vHlY.js';
1
+ import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-D_Bfo30u.js';
2
+ export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-D_Bfo30u.js';
3
+ import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, I as InlineSkill, n as ConversationStorageAdapter, o as StoredMessage, p as SessionMeta, q as SessionMetaPatch, O as ObjectiveRecord, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as StepResult, v as SDKProvider } from './cron-BNHJywtl.js';
4
+ export { w as ActiveMemoryPassArgs, x as ActiveMemoryPassResult, y as AgentGoalConfig, z as AgentMemory, D as BudgetCheck, E as BudgetTotal, F as BudgetUsageEvent, H as CloudEnv, J as CloudRepo, K as ContextBudget, N as ContextManagerKind, Q as ContextSnapshot, R as ContextSource, T as ContextSourceStatus, U as CreateSkillSpec, V as Cron, W as CronCreateOptions, X as CronGetOptions, Y as CronJob, Z as CronJobStatus, _ as CronListOptions, $ as CronOperationOptions, a0 as CronRunOptions, a1 as CronRuntime, a2 as CronSchedulerStatus, a3 as CronStartOptions, a4 as DurableGoalOptions, a5 as GoalEvent, a6 as GoalOptions, a7 as GoalResult, a8 as HookName, a9 as InvalidateCacheOptions, aa as MemoryAdapter, ab as MemoryAdapterCapabilities, ac as MemoryContext, ad as MemoryFact, ae as MemoryProviderHandle, af as MemoryProviderInitOptions, ag as MemoryRevision, ah as MemoryToolSchema, ai as MemoryTurnMessage, aj as ObjectiveStatus, ak as PersonalityPreset, al as PluginContext, am as PostAssistantReplyContext, an as PreToolCallContext, ao as PreUserSendContext, ap as PreUserSendResult, aq as ProviderCapability, ar as ProviderRoute, as as RecordSessionSummaryArgs, at as ResolvedProviderRoute, au as RunUntilIterator, av as SDKAgentPlugins, aw as SDKAgentSkillDetail, ax as SDKAgentSkills, ay as SDKArtifact, az as SDKContextManager, aA as SDKPluginMetadata, aB as SDKProvidersManager, aC as SettingSource, aD as SkillsResolver, aE as SkillsResolverContext, aF as SystemPromptContext, aG as SystemPromptMemoryFact, aH as SystemPromptSkillRef, aI as TelemetrySettings, aJ as createSkill, aK as definePlugin } from './cron-BNHJywtl.js';
5
+ import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, S as SDKMessage } from './run-CLXKMRgq.js';
6
+ export { A as AgentConversationTurn, c as AssistantMessage, d as CompletionCheck, e as CompletionCheckResult, f as ConversationStep, g as ConversationTurn, h as CostBreakdown, i as CostSource, j as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, k as GenerateRunResult, I as ImageBlock, l as InputProcessorContext, m as InteractionUpdate, n as McpAuthConfig, o as McpHttpServerConfig, p as McpOAuthConfig, q as McpStdioServerConfig, r as MessageOrigin, s as ModelParameterValue, O as OutputProcessorContext, t as PartialToolCallUpdate, u as ProcessorControls, v as ProcessorTripwire, w as ProcessorViolation, x as RunCompactBoundaryEvent, y as RunCompletionCheckEvent, z as RunErrorDetail, B as RunEvent, E as RunEventSink, F as RunGitInfo, H as RunOperation, J as RunPermissionDeniedEvent, K as RunRateLimitEvent, L as RunStatus, N as RunTaskCompletedEvent, Q as RunTaskStartedEvent, U as RunTaskUpdatedEvent, V as RunToCompletionOptions, W as RunToCompletionResult, X as RunToolProgressEvent, Y as RunTripwireEvent, Z as SDKAssistantMessage, _ as SDKImage, $ as SDKImageDimension, a0 as SDKObjectDelta, a1 as SDKRequestMessage, a2 as SDKStatusMessage, a3 as SDKSystemMessage, a4 as SDKTaskMessage, a5 as SDKThinkingMessage, a6 as SDKToolUseMessage, a7 as SDKUserMessage, a8 as SDKUserMessageEvent, a9 as SendOptions, aa as ShellCommand, ab as ShellConversationTurn, ac as ShellOutput, ad as ShellOutputDeltaUpdate, ae as StepCompletedUpdate, af as StepStartedUpdate, ag as StreamToCompletionResult, ah as SummaryCompletedUpdate, ai as SummaryStartedUpdate, aj as SummaryUpdate, ak as TextBlock, al as TextDeltaUpdate, am as ThinkingCompletedUpdate, an as ThinkingDeltaUpdate, ao as ThinkingMessage, ap as TokenDeltaUpdate, aq as TokenUsage, ar as ToolCall, as as ToolCallCompletedUpdate, at as ToolCallStartedUpdate, au as ToolContextMessage, av as ToolResult, aw as ToolResultGuardOptions, ax as ToolUseBlock, ay as TurnEndedUpdate, az as UserMessage, aA as UserMessageAppendedUpdate, aB as emitRunEvent } from './run-CLXKMRgq.js';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
9
 
@@ -1903,134 +1903,6 @@ declare function scopedConversationId(scope: SessionScope, id: string): string;
1903
1903
  /** M3 #62 — the id prefix (`"<scope>__"`) used to match a scope's conversations. */
1904
1904
  declare function sessionScopePrefix(scope: SessionScope): string;
1905
1905
 
1906
- /**
1907
- * Public type contract for `Workflow.create / .run / .resume` (Adoption
1908
- * Roadmap #5; ADRs D230-D248).
1909
- *
1910
- * Step types form a discriminated union by `kind`. Helper factory functions
1911
- * (`fn()`, `agentStep()`) live in `workflow.ts` and hide the discriminator
1912
- * from end users.
1913
- *
1914
- * @public
1915
- */
1916
-
1917
- type Step = FnStep | AgentStep | ParallelStep | BranchStep | ForeachStep | DowhileStep | SleepStep | SuspendStep;
1918
- /** A pure function step. */
1919
- interface FnStep {
1920
- readonly kind: "fn";
1921
- readonly id: string;
1922
- readonly fn: (input: unknown, ctx: StepContext) => Promise<unknown> | unknown;
1923
- readonly inputSchema?: ZodType;
1924
- readonly outputSchema?: ZodType;
1925
- readonly retry?: RetryPolicy;
1926
- /** D238 — slot reserved; runtime throws if engine not yet implemented. */
1927
- readonly compensate?: (input: unknown, output: unknown, error: Error) => Promise<void> | void;
1928
- }
1929
- /** An agent.send-driven step. */
1930
- interface AgentStep {
1931
- readonly kind: "agent";
1932
- readonly id: string;
1933
- readonly agent: SDKAgent;
1934
- readonly promptTemplate: string | ((input: unknown) => string);
1935
- readonly retry?: RetryPolicy;
1936
- /**
1937
- * SE3 — provenance stamped onto this step's `agent.send()` (forwarded to
1938
- * `RunResult.origin`). Squad sets `{ kind: "peer", from: "agent-<i-1>" }` on
1939
- * every step after the first so a peer-driven turn is attributable.
1940
- */
1941
- readonly origin?: MessageOrigin;
1942
- }
1943
- /** N concurrent branches, each its own mini-step-list. */
1944
- interface ParallelStep {
1945
- readonly kind: "parallel";
1946
- readonly id: string;
1947
- readonly branches: ReadonlyArray<ReadonlyArray<Step>>;
1948
- readonly concurrency?: number;
1949
- readonly errorPolicy?: "fail-fast" | "collect";
1950
- }
1951
- /** First-match-wins predicates + optional fallback. */
1952
- interface BranchStep {
1953
- readonly kind: "branch";
1954
- readonly id: string;
1955
- readonly predicates: ReadonlyArray<readonly [(input: unknown) => boolean | Promise<boolean>, ReadonlyArray<Step>]>;
1956
- readonly fallback?: ReadonlyArray<Step>;
1957
- }
1958
- /** Map a step over an upstream array output. */
1959
- interface ForeachStep {
1960
- readonly kind: "foreach";
1961
- readonly id: string;
1962
- /** ID of an upstream top-level step whose output is iterable. */
1963
- readonly iterableFrom: string;
1964
- readonly step: Step;
1965
- readonly concurrency?: number;
1966
- }
1967
- /** Loop a step until condFn returns false. */
1968
- interface DowhileStep {
1969
- readonly kind: "dowhile";
1970
- readonly id: string;
1971
- readonly step: Step;
1972
- readonly condFn: (output: unknown, iteration: number) => boolean | Promise<boolean>;
1973
- readonly maxIterations?: number;
1974
- }
1975
- /** Pause for a fixed duration. */
1976
- interface SleepStep {
1977
- readonly kind: "sleep";
1978
- readonly id: string;
1979
- readonly durationMs: number;
1980
- }
1981
- /** Standalone explicit suspend point. */
1982
- interface SuspendStep {
1983
- readonly kind: "suspend";
1984
- readonly id: string;
1985
- readonly payloadSchema?: ZodType;
1986
- }
1987
- /** D237 — retry policy applied per fn/agent step. */
1988
- interface RetryPolicy {
1989
- /** Total attempts (MIN 1, MAX 20). `1` = no retry. */
1990
- readonly maxAttempts: number;
1991
- readonly initialBackoffMs?: number;
1992
- readonly backoffCoefficient?: number;
1993
- readonly maximumBackoffMs?: number;
1994
- readonly nonRetryableErrors?: ReadonlyArray<string>;
1995
- }
1996
- /** D247 — context handed to every step.fn. */
1997
- interface StepContext {
1998
- readonly runId: string;
1999
- readonly signal: AbortSignal;
2000
- readonly log: {
2001
- debug: (msg: string, attrs?: Record<string, unknown>) => void;
2002
- info: (msg: string, attrs?: Record<string, unknown>) => void;
2003
- warn: (msg: string, attrs?: Record<string, unknown>) => void;
2004
- };
2005
- /** Pause the workflow; resume via `Workflow.resume({...})`. */
2006
- readonly suspend: (payload?: unknown) => Promise<never>;
2007
- /**
2008
- * SE29 — the workflow's shared state (from `WorkflowOptions.initialState`,
2009
- * mutated by {@link setState}), visible to every subsequent step in the run.
2010
- * `undefined` when no `initialState`/`setState` has run. Persisted across
2011
- * suspend/resume.
2012
- */
2013
- readonly state: unknown;
2014
- /**
2015
- * SE29 — update the shared state for subsequent steps. Validated against
2016
- * `WorkflowOptions.stateSchema` when set (a mismatch throws
2017
- * {@link WorkflowStateError}, which fails the step/run — Rule 8).
2018
- */
2019
- readonly setState: (next: unknown) => void;
2020
- }
2021
- interface StepResult {
2022
- readonly stepId: string;
2023
- readonly kind: Step["kind"];
2024
- readonly status: "completed" | "failed" | "skipped" | "suspended";
2025
- readonly attempts: number;
2026
- readonly durationMs: number;
2027
- readonly output?: unknown;
2028
- readonly error?: {
2029
- name: string;
2030
- message: string;
2031
- };
2032
- }
2033
-
2034
1906
  /**
2035
1907
  * `createSquad` — a sequential team of agents.
2036
1908
  *
@@ -2588,4 +2460,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
2588
2460
  model?: string;
2589
2461
  }): ShareGptTrajectory | null;
2590
2462
 
2591
- export { Agent, AgentBuilder, AgentDefinition, type AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, BudgetTracker, CloudOptions, ContextSettings, ConversationStorageAdapter, type CounterBudgetTrackerOptions, CustomTool, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DreamingSweepOptions, type DreamingSweepResult, ErrorMetadata, EventBus, type EvictReason, FileSystemConversationStorage, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, InMemoryConversationStorage, InlineSkill, JobQueue, type JobQueueOptions, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, MessageOrigin, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, type NormalizedJsonSchema, ObjectiveRecord, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, type PermissionMode, type PermissionPluginOptions, type PermissionRule, Plugin, PluginsSettings, PreToolCallDecision, Processor, ProviderProfile, ProviderRoutingSettings, type ReplayHistoryOptions, Run, RunResult, SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, Security, type SessionCapabilityResult, type SessionListOptions, type SessionManager, SessionMeta, SessionMetaPatch, type SessionScope, type SessionSummary, type ShareGptMessage, type ShareGptTrajectory, SkillsSettings, type Squad, type SquadOptions, type SquadRun, StoredMessage, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, Theokit, TheokitAgentError, type TheokitRequestOptions, type TokenLimiterOptions, ToolError, ToolResultContentBlock, type UnicodeNormalizerOptions, UsageAccumulator, applyMode, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSessionManager, createSquad, createTokenLimiter, createUnicodeNormalizer, defineProvider, defineSkillReadTool, defineTool, estimateTokens, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
2463
+ export { Agent, AgentBuilder, AgentDefinition, type AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, BudgetTracker, CloudOptions, ContextSettings, ConversationStorageAdapter, type CounterBudgetTrackerOptions, CustomTool, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DreamingSweepOptions, type DreamingSweepResult, ErrorMetadata, EventBus, type EvictReason, FileSystemConversationStorage, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, InMemoryConversationStorage, InlineSkill, JobQueue, type JobQueueOptions, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, type NormalizedJsonSchema, ObjectiveRecord, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, type PermissionMode, type PermissionPluginOptions, type PermissionRule, Plugin, PluginsSettings, PreToolCallDecision, Processor, ProviderProfile, ProviderRoutingSettings, type ReplayHistoryOptions, Run, RunResult, SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, Security, type SessionCapabilityResult, type SessionListOptions, type SessionManager, SessionMeta, SessionMetaPatch, type SessionScope, type SessionSummary, type ShareGptMessage, type ShareGptTrajectory, SkillsSettings, type Squad, type SquadOptions, type SquadRun, StoredMessage, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, Theokit, TheokitAgentError, type TheokitRequestOptions, type TokenLimiterOptions, ToolError, ToolResultContentBlock, type UnicodeNormalizerOptions, UsageAccumulator, applyMode, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSessionManager, createSquad, createTokenLimiter, createUnicodeNormalizer, defineProvider, defineSkillReadTool, defineTool, estimateTokens, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
package/dist/index.js CHANGED
@@ -19889,15 +19889,31 @@ function createSkill(spec) {
19889
19889
  // src/cron.ts
19890
19890
  init_errors();
19891
19891
 
19892
+ // src/internal/cron/fire-handler.ts
19893
+ init_registry();
19894
+
19892
19895
  // src/internal/cron/run-job.ts
19893
19896
  init_errors();
19894
19897
  init_agent_factory_registry();
19895
19898
  async function runCronJob(job) {
19896
- if (job.agent !== void 0) return runWithEphemeralAgent(job.agent, job.message);
19897
- if (job.agentId !== void 0) return runWithExistingAgent(job.agentId, job.message);
19898
- throw new ConfigurationError(`Cron job ${job.id} has neither agent nor agentId \u2014 cannot run.`, {
19899
- code: "cron_no_target"
19900
- });
19899
+ if (job.workflow !== void 0) return job.workflow.run(job.inputData);
19900
+ if (job.agent !== void 0) return runWithEphemeralAgent(job.agent, requireMessage(job));
19901
+ if (job.agentId !== void 0) return runWithExistingAgent(job.agentId, requireMessage(job));
19902
+ throw new ConfigurationError(
19903
+ `Cron job ${job.id} has no target (agent, agentId, or workflow) \u2014 cannot run.`,
19904
+ { code: "cron_no_target" }
19905
+ );
19906
+ }
19907
+ function isAgentRun(outcome) {
19908
+ return typeof outcome.wait === "function";
19909
+ }
19910
+ function requireMessage(job) {
19911
+ if (job.message === void 0) {
19912
+ throw new ConfigurationError(`Cron job ${job.id} is an agent target but has no message.`, {
19913
+ code: "cron_missing_message"
19914
+ });
19915
+ }
19916
+ return job.message;
19901
19917
  }
19902
19918
  async function runWithExistingAgent(agentId, message) {
19903
19919
  const info = await getAgentFacade().get(agentId).catch(() => void 0);
@@ -19915,6 +19931,37 @@ async function runWithEphemeralAgent(baseOptions, message) {
19915
19931
  return agent.send(message);
19916
19932
  }
19917
19933
 
19934
+ // src/internal/cron/fire-handler.ts
19935
+ async function fireCronJobAsTask(job) {
19936
+ const fireTs = Date.now();
19937
+ const taskId = `cron-${job.id}-${fireTs}`;
19938
+ try {
19939
+ await submit({
19940
+ kind: "cron",
19941
+ id: taskId,
19942
+ allowReservedPrefix: true,
19943
+ meta: { jobId: job.id, jobName: job.name, schedule: job.cron, firedAt: fireTs },
19944
+ work: async (ctx) => {
19945
+ const outcome = await runCronJob(job);
19946
+ if (isAgentRun(outcome)) {
19947
+ ctx.signal.addEventListener("abort", () => void outcome.cancel().catch(() => {
19948
+ }), {
19949
+ once: true
19950
+ });
19951
+ const result = await outcome.wait();
19952
+ ctx.emit({ status: result.status, runId: outcome.id });
19953
+ return { status: result.status, runId: outcome.id };
19954
+ }
19955
+ ctx.emit({ status: outcome.status, runId: outcome.id });
19956
+ return { status: outcome.status, runId: outcome.id };
19957
+ }
19958
+ });
19959
+ } catch {
19960
+ const outcome = await runCronJob(job);
19961
+ if (isAgentRun(outcome)) await outcome.wait();
19962
+ }
19963
+ }
19964
+
19918
19965
  // src/internal/cron/store.ts
19919
19966
  var jobs = /* @__PURE__ */ new Map();
19920
19967
  function listJobs() {
@@ -20105,7 +20152,6 @@ function estimateNextRunAt(_cron, _timezone) {
20105
20152
  }
20106
20153
 
20107
20154
  // src/cron.ts
20108
- init_registry();
20109
20155
  var Cron = class {
20110
20156
  constructor() {
20111
20157
  }
@@ -20172,7 +20218,8 @@ var Cron = class {
20172
20218
  return updateJobStatus(jobId, false);
20173
20219
  }
20174
20220
  /**
20175
- * Manually trigger a cron job off-schedule. Returns the resulting `Run`.
20221
+ * Manually trigger a cron job off-schedule. Returns the resulting `Run`
20222
+ * (agent target) or `WorkflowRun` (workflow target — SE35).
20176
20223
  *
20177
20224
  * @public
20178
20225
  */
@@ -20189,30 +20236,7 @@ var Cron = class {
20189
20236
  * @public
20190
20237
  */
20191
20238
  static start(options = {}) {
20192
- setCronFireHandler(async (job) => {
20193
- const fireTs = Date.now();
20194
- const taskId = `cron-${job.id}-${fireTs}`;
20195
- try {
20196
- await submit({
20197
- kind: "cron",
20198
- id: taskId,
20199
- allowReservedPrefix: true,
20200
- meta: { jobId: job.id, jobName: job.name, schedule: job.cron, firedAt: fireTs },
20201
- work: async (ctx) => {
20202
- const run = await runCronJob(job);
20203
- ctx.signal.addEventListener("abort", () => void run.cancel().catch(() => {
20204
- }), {
20205
- once: true
20206
- });
20207
- const result = await run.wait();
20208
- ctx.emit({ status: result.status, runId: run.id });
20209
- return { status: result.status, runId: run.id };
20210
- }
20211
- });
20212
- } catch {
20213
- await runCronJob(job).then((run) => run.wait());
20214
- }
20215
- });
20239
+ setCronFireHandler(fireCronJobAsTask);
20216
20240
  startScheduler(options.cwd);
20217
20241
  return Promise.resolve();
20218
20242
  }
@@ -20236,17 +20260,7 @@ var Cron = class {
20236
20260
  }
20237
20261
  };
20238
20262
  async function createCronJob(options) {
20239
- if (options.agent !== void 0 && options.agentId !== void 0) {
20240
- throw new ConfigurationError(
20241
- "agent and agentId are mutually exclusive \u2014 pass either agent (ephemeral) or agentId (reuse).",
20242
- { code: "cron_agent_exclusive" }
20243
- );
20244
- }
20245
- if (options.agent === void 0 && options.agentId === void 0) {
20246
- throw new ConfigurationError("Cron job requires either agent or agentId", {
20247
- code: "cron_missing_agent"
20248
- });
20249
- }
20263
+ validateCronTarget(options);
20250
20264
  validateCronExpression(options.cron);
20251
20265
  const timezone = options.timezone ?? "UTC";
20252
20266
  validateTimezone(timezone);
@@ -20257,20 +20271,51 @@ async function createCronJob(options) {
20257
20271
  id: generateCronId(),
20258
20272
  cron: options.cron,
20259
20273
  timezone,
20260
- message: options.message,
20261
20274
  enabled: options.enabled ?? true,
20262
20275
  status: options.enabled === false ? "paused" : "scheduled",
20263
20276
  runtime,
20264
20277
  createdAt: now,
20265
20278
  nextRunAt: estimateNextRunAt(options.cron),
20266
20279
  ...options.name !== void 0 ? { name: options.name } : {},
20280
+ ...options.message !== void 0 ? { message: options.message } : {},
20267
20281
  ...options.agent !== void 0 ? { agent: options.agent } : {},
20268
- ...options.agentId !== void 0 ? { agentId: options.agentId } : {}
20282
+ ...options.agentId !== void 0 ? { agentId: options.agentId } : {},
20283
+ ...options.workflow !== void 0 ? { workflow: options.workflow } : {},
20284
+ ...options.inputData !== void 0 ? { inputData: options.inputData } : {}
20269
20285
  };
20270
20286
  upsertJob(job);
20271
20287
  return job;
20272
20288
  }
20289
+ function validateCronTarget(options) {
20290
+ const targets = [options.agent, options.agentId, options.workflow].filter(
20291
+ (t) => t !== void 0
20292
+ ).length;
20293
+ if (targets > 1) {
20294
+ throw new ConfigurationError(
20295
+ "agent, agentId, and workflow are mutually exclusive \u2014 pass exactly one target.",
20296
+ { code: "cron_ambiguous_target" }
20297
+ );
20298
+ }
20299
+ if (targets === 0) {
20300
+ throw new ConfigurationError(
20301
+ "Cron job requires exactly one target: agent, agentId, or workflow.",
20302
+ { code: "cron_no_target" }
20303
+ );
20304
+ }
20305
+ if (options.workflow !== void 0 && options.message !== void 0) {
20306
+ throw new ConfigurationError(
20307
+ "A workflow cron target takes inputData, not a message \u2014 remove `message`.",
20308
+ { code: "cron_workflow_message" }
20309
+ );
20310
+ }
20311
+ if (options.workflow === void 0 && options.message === void 0) {
20312
+ throw new ConfigurationError("An agent cron target requires a message.", {
20313
+ code: "cron_missing_message"
20314
+ });
20315
+ }
20316
+ }
20273
20317
  function detectRuntime(options) {
20318
+ if (options.workflow !== void 0) return "local";
20274
20319
  if (options.agentId !== void 0) {
20275
20320
  return options.agentId.startsWith("bc-") ? "cloud" : "local";
20276
20321
  }