@theokit/sdk 2.25.0 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/dist/a2a/index.cjs +208 -4
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +208 -4
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-B44D-678.d.ts → cron-BR1NCSk1.d.cts} +11 -1
- package/dist/{cron-qI-dbG7c.d.cts → cron-DgEQCJ2i.d.ts} +11 -1
- package/dist/cron.cjs +187 -4
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +187 -4
- package/dist/cron.js.map +1 -1
- package/dist/{errors-DRS-kqOK.d.ts → errors-CbY3pxY7.d.ts} +1 -1
- package/dist/{errors-DIKBXffg.d.cts → errors-DLMNb4Ka.d.cts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +187 -4
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +187 -4
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +483 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -7
- package/dist/index.d.ts +69 -7
- package/dist/index.js +481 -52
- package/dist/index.js.map +1 -1
- package/dist/internal/runtime/processors/run-processors.d.ts +10 -0
- package/dist/internal/runtime/processors/tripwire-run.d.ts +16 -0
- package/dist/internal/runtime/processors/wrap-output-run.d.ts +18 -0
- package/dist/internal/workflow/ctx.d.ts +6 -1
- package/dist/internal/workflow/event-stream.d.ts +13 -0
- package/dist/internal/workflow/executor-helpers.d.ts +30 -0
- package/dist/{run-Cr0C6cOM.d.cts → run-CdWiihyU.d.cts} +109 -2
- package/dist/{run-Cr0C6cOM.d.ts → run-CdWiihyU.d.ts} +109 -2
- package/dist/types/agent.d.ts +10 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/processors.d.ts +84 -0
- package/dist/types/run-events.d.ts +11 -1
- package/dist/types/run.d.ts +12 -0
- package/dist/types/workflow.d.ts +134 -1
- package/dist/workflow.cjs +289 -45
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +42 -2
- package/dist/workflow.d.ts +42 -2
- package/dist/workflow.js +288 -46
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
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-
|
|
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-
|
|
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, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as SDKProvider } from './cron-
|
|
4
|
-
export { v as ActiveMemoryPassArgs, w as ActiveMemoryPassResult, x as AgentMemory, y as BudgetCheck, z as BudgetTotal, D as BudgetUsageEvent, E as CloudEnv, F as CloudRepo, H as ContextBudget, J as ContextManagerKind, K as ContextSnapshot, N as ContextSource, O as ContextSourceStatus, Q as CreateSkillSpec, R as Cron, T as CronCreateOptions, U as CronGetOptions, V as CronJob, W as CronJobStatus, X as CronListOptions, Y as CronOperationOptions, Z as CronRunOptions, _ as CronRuntime, $ as CronSchedulerStatus, a0 as CronStartOptions, a1 as GoalEvent, a2 as GoalOptions, a3 as GoalResult, a4 as HookName, a5 as InvalidateCacheOptions, a6 as MemoryAdapter, a7 as MemoryAdapterCapabilities, a8 as MemoryContext, a9 as MemoryFact, aa as MemoryProviderHandle, ab as MemoryProviderInitOptions, ac as MemoryRevision, ad as MemoryToolSchema, ae as MemoryTurnMessage, af as PersonalityPreset, ag as PluginContext, ah as PostAssistantReplyContext, ai as PreToolCallContext, aj as PreUserSendContext, ak as PreUserSendResult, al as ProviderCapability, am as ProviderRoute, an as RecordSessionSummaryArgs, ao as ResolvedProviderRoute, ap as RunUntilIterator, aq as SDKAgentPlugins, ar as SDKAgentSkillDetail, as as SDKAgentSkills, at as SDKArtifact, au as SDKContextManager, av as SDKPluginMetadata, aw as SDKProvidersManager, ax as SettingSource, ay as SkillsResolver, az as SkillsResolverContext, aA as SystemPromptContext, aB as SystemPromptMemoryFact, aC as SystemPromptSkillRef, aD as TelemetrySettings, aE as createSkill, aF as definePlugin } from './cron-
|
|
5
|
-
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, T as ToolResultContentBlock, S as SDKMessage, c as MessageOrigin } from './run-
|
|
6
|
-
export { A as AgentConversationTurn, d as AssistantMessage, e as ConversationStep, f as ConversationTurn, g as CostBreakdown, h as CostSource, i as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, j as GenerateRunResult, I as ImageBlock, k as
|
|
1
|
+
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-DLMNb4Ka.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-DLMNb4Ka.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, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as SDKProvider } from './cron-BR1NCSk1.cjs';
|
|
4
|
+
export { v as ActiveMemoryPassArgs, w as ActiveMemoryPassResult, x as AgentMemory, y as BudgetCheck, z as BudgetTotal, D as BudgetUsageEvent, E as CloudEnv, F as CloudRepo, H as ContextBudget, J as ContextManagerKind, K as ContextSnapshot, N as ContextSource, O as ContextSourceStatus, Q as CreateSkillSpec, R as Cron, T as CronCreateOptions, U as CronGetOptions, V as CronJob, W as CronJobStatus, X as CronListOptions, Y as CronOperationOptions, Z as CronRunOptions, _ as CronRuntime, $ as CronSchedulerStatus, a0 as CronStartOptions, a1 as GoalEvent, a2 as GoalOptions, a3 as GoalResult, a4 as HookName, a5 as InvalidateCacheOptions, a6 as MemoryAdapter, a7 as MemoryAdapterCapabilities, a8 as MemoryContext, a9 as MemoryFact, aa as MemoryProviderHandle, ab as MemoryProviderInitOptions, ac as MemoryRevision, ad as MemoryToolSchema, ae as MemoryTurnMessage, af as PersonalityPreset, ag as PluginContext, ah as PostAssistantReplyContext, ai as PreToolCallContext, aj as PreUserSendContext, ak as PreUserSendResult, al as ProviderCapability, am as ProviderRoute, an as RecordSessionSummaryArgs, ao as ResolvedProviderRoute, ap as RunUntilIterator, aq as SDKAgentPlugins, ar as SDKAgentSkillDetail, as as SDKAgentSkills, at as SDKArtifact, au as SDKContextManager, av as SDKPluginMetadata, aw as SDKProvidersManager, ax as SettingSource, ay as SkillsResolver, az as SkillsResolverContext, aA as SystemPromptContext, aB as SystemPromptMemoryFact, aC as SystemPromptSkillRef, aD as TelemetrySettings, aE as createSkill, aF as definePlugin } from './cron-BR1NCSk1.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-CdWiihyU.cjs';
|
|
6
|
+
export { A as AgentConversationTurn, d as AssistantMessage, e as ConversationStep, f as ConversationTurn, g as CostBreakdown, h as CostSource, i as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, j as GenerateRunResult, I as ImageBlock, k as InputProcessorContext, l as InteractionUpdate, m as McpAuthConfig, n as McpHttpServerConfig, o as McpOAuthConfig, p as McpStdioServerConfig, q as ModelParameterValue, O as OutputProcessorContext, r as PartialToolCallUpdate, s as ProcessorControls, t as ProcessorTripwire, u as ProcessorViolation, v as RunCompactBoundaryEvent, w as RunErrorDetail, x as RunEvent, y as RunEventSink, z as RunGitInfo, B as RunOperation, E as RunPermissionDeniedEvent, F as RunRateLimitEvent, H as RunStatus, J as RunTaskCompletedEvent, K as RunTaskStartedEvent, L as RunTaskUpdatedEvent, N as RunToCompletionOptions, Q as RunToCompletionResult, U as RunToolProgressEvent, V as RunTripwireEvent, W as SDKAssistantMessage, X as SDKImage, Y as SDKImageDimension, Z as SDKObjectDelta, _ as SDKRequestMessage, $ as SDKStatusMessage, a0 as SDKSystemMessage, a1 as SDKTaskMessage, a2 as SDKThinkingMessage, a3 as SDKToolUseMessage, a4 as SDKUserMessage, a5 as SDKUserMessageEvent, a6 as SendOptions, a7 as ShellCommand, a8 as ShellConversationTurn, a9 as ShellOutput, aa as ShellOutputDeltaUpdate, ab as StepCompletedUpdate, ac as StepStartedUpdate, ad as StreamToCompletionResult, ae as SummaryCompletedUpdate, af as SummaryStartedUpdate, ag as SummaryUpdate, ah as TextBlock, ai as TextDeltaUpdate, aj as ThinkingCompletedUpdate, ak as ThinkingDeltaUpdate, al as ThinkingMessage, am as TokenDeltaUpdate, an as TokenUsage, ao as ToolCall, ap as ToolCallCompletedUpdate, aq as ToolCallStartedUpdate, ar as ToolContextMessage, as as ToolResult, at as ToolResultGuardOptions, au as ToolUseBlock, av as TurnEndedUpdate, aw as UserMessage, ax as UserMessageAppendedUpdate, ay as emitRunEvent } from './run-CdWiihyU.cjs';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
9
|
|
|
@@ -842,6 +842,55 @@ declare class Budget {
|
|
|
842
842
|
static snapshot(): readonly BudgetSnapshot[];
|
|
843
843
|
}
|
|
844
844
|
|
|
845
|
+
/**
|
|
846
|
+
* SE25 — deterministic, no-LLM guardrail processors built on the SE24
|
|
847
|
+
* {@link Processor} seam. Cheap and churn-free (no provider/model deltas), so
|
|
848
|
+
* they are safe to own in-core — unlike the LLM-classifier processors, which are
|
|
849
|
+
* delegated (see the guardrails ADR). All are OPT-IN: add them to
|
|
850
|
+
* `AgentOptions.inputProcessors` / `outputProcessors`.
|
|
851
|
+
*
|
|
852
|
+
* @public
|
|
853
|
+
*/
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Approximate token count from string length. This is an ESTIMATE
|
|
857
|
+
* (≈ UTF-16-code-units / 4, NOT Unicode code points, NOT an exact per-model
|
|
858
|
+
* tokenizer count) — good enough for a coarse cap, and dependency-free.
|
|
859
|
+
*/
|
|
860
|
+
declare function estimateTokens(text: string): number;
|
|
861
|
+
/** Options for {@link createUnicodeNormalizer}. @public */
|
|
862
|
+
interface UnicodeNormalizerOptions {
|
|
863
|
+
/** Remove C0 + C1 control chars + DEL (keeps tab / newline / carriage-return). Default `false`. */
|
|
864
|
+
stripControlChars?: boolean;
|
|
865
|
+
/** Collapse runs of intra-line whitespace to one space, 3+ blank lines to one, and trim. Default `false`. Uses legacy `\s`; Unicode-only whitespace (U+00A0 NBSP, U+FEFF BOM, U+2000–U+200A) is NOT collapsed. */
|
|
866
|
+
collapseWhitespace?: boolean;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* SE25 — an input processor that normalizes user text: Unicode NFC (so
|
|
870
|
+
* canonically-equivalent sequences compare equal) plus optional control-char
|
|
871
|
+
* stripping and whitespace collapsing. Pure + deterministic; no LLM. Mirrors
|
|
872
|
+
* Mastra's `UnicodeNormalizer`.
|
|
873
|
+
*
|
|
874
|
+
* @public
|
|
875
|
+
*/
|
|
876
|
+
declare function createUnicodeNormalizer(opts?: UnicodeNormalizerOptions): Processor;
|
|
877
|
+
/** Options for {@link createTokenLimiter}. @public */
|
|
878
|
+
interface TokenLimiterOptions {
|
|
879
|
+
/** Positive integer token budget (estimate — see {@link estimateTokens}). */
|
|
880
|
+
limit: number;
|
|
881
|
+
/** Over the limit: `"truncate"` (default, cut to fit) or `"block"` (abort with a tripwire). */
|
|
882
|
+
strategy?: "truncate" | "block";
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* SE25 — a processor that caps text to a token budget. Placed in
|
|
886
|
+
* `inputProcessors` it limits the prompt; in `outputProcessors` it limits the
|
|
887
|
+
* response. Uses a char-based estimate (no tokenizer dep). `truncate` cuts to
|
|
888
|
+
* fit; `block` aborts (tripwire). Mirrors Mastra's `TokenLimiterProcessor`.
|
|
889
|
+
*
|
|
890
|
+
* @public
|
|
891
|
+
*/
|
|
892
|
+
declare function createTokenLimiter(opts: TokenLimiterOptions): Processor;
|
|
893
|
+
|
|
845
894
|
/**
|
|
846
895
|
* Options for {@link defineProvider}.
|
|
847
896
|
*
|
|
@@ -1949,6 +1998,19 @@ interface StepContext {
|
|
|
1949
1998
|
};
|
|
1950
1999
|
/** Pause the workflow; resume via `Workflow.resume({...})`. */
|
|
1951
2000
|
readonly suspend: (payload?: unknown) => Promise<never>;
|
|
2001
|
+
/**
|
|
2002
|
+
* SE29 — the workflow's shared state (from `WorkflowOptions.initialState`,
|
|
2003
|
+
* mutated by {@link setState}), visible to every subsequent step in the run.
|
|
2004
|
+
* `undefined` when no `initialState`/`setState` has run. Persisted across
|
|
2005
|
+
* suspend/resume.
|
|
2006
|
+
*/
|
|
2007
|
+
readonly state: unknown;
|
|
2008
|
+
/**
|
|
2009
|
+
* SE29 — update the shared state for subsequent steps. Validated against
|
|
2010
|
+
* `WorkflowOptions.stateSchema` when set (a mismatch throws
|
|
2011
|
+
* {@link WorkflowStateError}, which fails the step/run — Rule 8).
|
|
2012
|
+
*/
|
|
2013
|
+
readonly setState: (next: unknown) => void;
|
|
1952
2014
|
}
|
|
1953
2015
|
interface StepResult {
|
|
1954
2016
|
readonly stepId: string;
|
|
@@ -2520,4 +2582,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2520
2582
|
model?: string;
|
|
2521
2583
|
}): ShareGptTrajectory | null;
|
|
2522
2584
|
|
|
2523
|
-
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, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, type PermissionMode, type PermissionPluginOptions, type PermissionRule, Plugin, PluginsSettings, PreToolCallDecision, 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, ToolError, ToolResultContentBlock, UsageAccumulator, applyMode, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSessionManager, createSquad, defineProvider, defineSkillReadTool, defineTool, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
|
|
2585
|
+
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, 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-
|
|
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-
|
|
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, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as SDKProvider } from './cron-
|
|
4
|
-
export { v as ActiveMemoryPassArgs, w as ActiveMemoryPassResult, x as AgentMemory, y as BudgetCheck, z as BudgetTotal, D as BudgetUsageEvent, E as CloudEnv, F as CloudRepo, H as ContextBudget, J as ContextManagerKind, K as ContextSnapshot, N as ContextSource, O as ContextSourceStatus, Q as CreateSkillSpec, R as Cron, T as CronCreateOptions, U as CronGetOptions, V as CronJob, W as CronJobStatus, X as CronListOptions, Y as CronOperationOptions, Z as CronRunOptions, _ as CronRuntime, $ as CronSchedulerStatus, a0 as CronStartOptions, a1 as GoalEvent, a2 as GoalOptions, a3 as GoalResult, a4 as HookName, a5 as InvalidateCacheOptions, a6 as MemoryAdapter, a7 as MemoryAdapterCapabilities, a8 as MemoryContext, a9 as MemoryFact, aa as MemoryProviderHandle, ab as MemoryProviderInitOptions, ac as MemoryRevision, ad as MemoryToolSchema, ae as MemoryTurnMessage, af as PersonalityPreset, ag as PluginContext, ah as PostAssistantReplyContext, ai as PreToolCallContext, aj as PreUserSendContext, ak as PreUserSendResult, al as ProviderCapability, am as ProviderRoute, an as RecordSessionSummaryArgs, ao as ResolvedProviderRoute, ap as RunUntilIterator, aq as SDKAgentPlugins, ar as SDKAgentSkillDetail, as as SDKAgentSkills, at as SDKArtifact, au as SDKContextManager, av as SDKPluginMetadata, aw as SDKProvidersManager, ax as SettingSource, ay as SkillsResolver, az as SkillsResolverContext, aA as SystemPromptContext, aB as SystemPromptMemoryFact, aC as SystemPromptSkillRef, aD as TelemetrySettings, aE as createSkill, aF as definePlugin } from './cron-
|
|
5
|
-
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, T as ToolResultContentBlock, S as SDKMessage, c as MessageOrigin } from './run-
|
|
6
|
-
export { A as AgentConversationTurn, d as AssistantMessage, e as ConversationStep, f as ConversationTurn, g as CostBreakdown, h as CostSource, i as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, j as GenerateRunResult, I as ImageBlock, k as
|
|
1
|
+
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-CbY3pxY7.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-CbY3pxY7.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, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as SDKProvider } from './cron-DgEQCJ2i.js';
|
|
4
|
+
export { v as ActiveMemoryPassArgs, w as ActiveMemoryPassResult, x as AgentMemory, y as BudgetCheck, z as BudgetTotal, D as BudgetUsageEvent, E as CloudEnv, F as CloudRepo, H as ContextBudget, J as ContextManagerKind, K as ContextSnapshot, N as ContextSource, O as ContextSourceStatus, Q as CreateSkillSpec, R as Cron, T as CronCreateOptions, U as CronGetOptions, V as CronJob, W as CronJobStatus, X as CronListOptions, Y as CronOperationOptions, Z as CronRunOptions, _ as CronRuntime, $ as CronSchedulerStatus, a0 as CronStartOptions, a1 as GoalEvent, a2 as GoalOptions, a3 as GoalResult, a4 as HookName, a5 as InvalidateCacheOptions, a6 as MemoryAdapter, a7 as MemoryAdapterCapabilities, a8 as MemoryContext, a9 as MemoryFact, aa as MemoryProviderHandle, ab as MemoryProviderInitOptions, ac as MemoryRevision, ad as MemoryToolSchema, ae as MemoryTurnMessage, af as PersonalityPreset, ag as PluginContext, ah as PostAssistantReplyContext, ai as PreToolCallContext, aj as PreUserSendContext, ak as PreUserSendResult, al as ProviderCapability, am as ProviderRoute, an as RecordSessionSummaryArgs, ao as ResolvedProviderRoute, ap as RunUntilIterator, aq as SDKAgentPlugins, ar as SDKAgentSkillDetail, as as SDKAgentSkills, at as SDKArtifact, au as SDKContextManager, av as SDKPluginMetadata, aw as SDKProvidersManager, ax as SettingSource, ay as SkillsResolver, az as SkillsResolverContext, aA as SystemPromptContext, aB as SystemPromptMemoryFact, aC as SystemPromptSkillRef, aD as TelemetrySettings, aE as createSkill, aF as definePlugin } from './cron-DgEQCJ2i.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-CdWiihyU.js';
|
|
6
|
+
export { A as AgentConversationTurn, d as AssistantMessage, e as ConversationStep, f as ConversationTurn, g as CostBreakdown, h as CostSource, i as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, j as GenerateRunResult, I as ImageBlock, k as InputProcessorContext, l as InteractionUpdate, m as McpAuthConfig, n as McpHttpServerConfig, o as McpOAuthConfig, p as McpStdioServerConfig, q as ModelParameterValue, O as OutputProcessorContext, r as PartialToolCallUpdate, s as ProcessorControls, t as ProcessorTripwire, u as ProcessorViolation, v as RunCompactBoundaryEvent, w as RunErrorDetail, x as RunEvent, y as RunEventSink, z as RunGitInfo, B as RunOperation, E as RunPermissionDeniedEvent, F as RunRateLimitEvent, H as RunStatus, J as RunTaskCompletedEvent, K as RunTaskStartedEvent, L as RunTaskUpdatedEvent, N as RunToCompletionOptions, Q as RunToCompletionResult, U as RunToolProgressEvent, V as RunTripwireEvent, W as SDKAssistantMessage, X as SDKImage, Y as SDKImageDimension, Z as SDKObjectDelta, _ as SDKRequestMessage, $ as SDKStatusMessage, a0 as SDKSystemMessage, a1 as SDKTaskMessage, a2 as SDKThinkingMessage, a3 as SDKToolUseMessage, a4 as SDKUserMessage, a5 as SDKUserMessageEvent, a6 as SendOptions, a7 as ShellCommand, a8 as ShellConversationTurn, a9 as ShellOutput, aa as ShellOutputDeltaUpdate, ab as StepCompletedUpdate, ac as StepStartedUpdate, ad as StreamToCompletionResult, ae as SummaryCompletedUpdate, af as SummaryStartedUpdate, ag as SummaryUpdate, ah as TextBlock, ai as TextDeltaUpdate, aj as ThinkingCompletedUpdate, ak as ThinkingDeltaUpdate, al as ThinkingMessage, am as TokenDeltaUpdate, an as TokenUsage, ao as ToolCall, ap as ToolCallCompletedUpdate, aq as ToolCallStartedUpdate, ar as ToolContextMessage, as as ToolResult, at as ToolResultGuardOptions, au as ToolUseBlock, av as TurnEndedUpdate, aw as UserMessage, ax as UserMessageAppendedUpdate, ay as emitRunEvent } from './run-CdWiihyU.js';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
9
|
|
|
@@ -842,6 +842,55 @@ declare class Budget {
|
|
|
842
842
|
static snapshot(): readonly BudgetSnapshot[];
|
|
843
843
|
}
|
|
844
844
|
|
|
845
|
+
/**
|
|
846
|
+
* SE25 — deterministic, no-LLM guardrail processors built on the SE24
|
|
847
|
+
* {@link Processor} seam. Cheap and churn-free (no provider/model deltas), so
|
|
848
|
+
* they are safe to own in-core — unlike the LLM-classifier processors, which are
|
|
849
|
+
* delegated (see the guardrails ADR). All are OPT-IN: add them to
|
|
850
|
+
* `AgentOptions.inputProcessors` / `outputProcessors`.
|
|
851
|
+
*
|
|
852
|
+
* @public
|
|
853
|
+
*/
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Approximate token count from string length. This is an ESTIMATE
|
|
857
|
+
* (≈ UTF-16-code-units / 4, NOT Unicode code points, NOT an exact per-model
|
|
858
|
+
* tokenizer count) — good enough for a coarse cap, and dependency-free.
|
|
859
|
+
*/
|
|
860
|
+
declare function estimateTokens(text: string): number;
|
|
861
|
+
/** Options for {@link createUnicodeNormalizer}. @public */
|
|
862
|
+
interface UnicodeNormalizerOptions {
|
|
863
|
+
/** Remove C0 + C1 control chars + DEL (keeps tab / newline / carriage-return). Default `false`. */
|
|
864
|
+
stripControlChars?: boolean;
|
|
865
|
+
/** Collapse runs of intra-line whitespace to one space, 3+ blank lines to one, and trim. Default `false`. Uses legacy `\s`; Unicode-only whitespace (U+00A0 NBSP, U+FEFF BOM, U+2000–U+200A) is NOT collapsed. */
|
|
866
|
+
collapseWhitespace?: boolean;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* SE25 — an input processor that normalizes user text: Unicode NFC (so
|
|
870
|
+
* canonically-equivalent sequences compare equal) plus optional control-char
|
|
871
|
+
* stripping and whitespace collapsing. Pure + deterministic; no LLM. Mirrors
|
|
872
|
+
* Mastra's `UnicodeNormalizer`.
|
|
873
|
+
*
|
|
874
|
+
* @public
|
|
875
|
+
*/
|
|
876
|
+
declare function createUnicodeNormalizer(opts?: UnicodeNormalizerOptions): Processor;
|
|
877
|
+
/** Options for {@link createTokenLimiter}. @public */
|
|
878
|
+
interface TokenLimiterOptions {
|
|
879
|
+
/** Positive integer token budget (estimate — see {@link estimateTokens}). */
|
|
880
|
+
limit: number;
|
|
881
|
+
/** Over the limit: `"truncate"` (default, cut to fit) or `"block"` (abort with a tripwire). */
|
|
882
|
+
strategy?: "truncate" | "block";
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* SE25 — a processor that caps text to a token budget. Placed in
|
|
886
|
+
* `inputProcessors` it limits the prompt; in `outputProcessors` it limits the
|
|
887
|
+
* response. Uses a char-based estimate (no tokenizer dep). `truncate` cuts to
|
|
888
|
+
* fit; `block` aborts (tripwire). Mirrors Mastra's `TokenLimiterProcessor`.
|
|
889
|
+
*
|
|
890
|
+
* @public
|
|
891
|
+
*/
|
|
892
|
+
declare function createTokenLimiter(opts: TokenLimiterOptions): Processor;
|
|
893
|
+
|
|
845
894
|
/**
|
|
846
895
|
* Options for {@link defineProvider}.
|
|
847
896
|
*
|
|
@@ -1949,6 +1998,19 @@ interface StepContext {
|
|
|
1949
1998
|
};
|
|
1950
1999
|
/** Pause the workflow; resume via `Workflow.resume({...})`. */
|
|
1951
2000
|
readonly suspend: (payload?: unknown) => Promise<never>;
|
|
2001
|
+
/**
|
|
2002
|
+
* SE29 — the workflow's shared state (from `WorkflowOptions.initialState`,
|
|
2003
|
+
* mutated by {@link setState}), visible to every subsequent step in the run.
|
|
2004
|
+
* `undefined` when no `initialState`/`setState` has run. Persisted across
|
|
2005
|
+
* suspend/resume.
|
|
2006
|
+
*/
|
|
2007
|
+
readonly state: unknown;
|
|
2008
|
+
/**
|
|
2009
|
+
* SE29 — update the shared state for subsequent steps. Validated against
|
|
2010
|
+
* `WorkflowOptions.stateSchema` when set (a mismatch throws
|
|
2011
|
+
* {@link WorkflowStateError}, which fails the step/run — Rule 8).
|
|
2012
|
+
*/
|
|
2013
|
+
readonly setState: (next: unknown) => void;
|
|
1952
2014
|
}
|
|
1953
2015
|
interface StepResult {
|
|
1954
2016
|
readonly stepId: string;
|
|
@@ -2520,4 +2582,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2520
2582
|
model?: string;
|
|
2521
2583
|
}): ShareGptTrajectory | null;
|
|
2522
2584
|
|
|
2523
|
-
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, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, type PermissionMode, type PermissionPluginOptions, type PermissionRule, Plugin, PluginsSettings, PreToolCallDecision, 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, ToolError, ToolResultContentBlock, UsageAccumulator, applyMode, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSessionManager, createSquad, defineProvider, defineSkillReadTool, defineTool, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
|
|
2585
|
+
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, 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 };
|