@theokit/sdk 2.24.0 → 2.26.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 +464 -195
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +464 -195
- package/dist/a2a/index.js.map +1 -1
- package/dist/create-skill.d.ts +8 -0
- package/dist/{cron-vjod0qVQ.d.ts → cron-BR1NCSk1.d.cts} +77 -4
- package/dist/{cron-Bd2oRD7A.d.cts → cron-DgEQCJ2i.d.ts} +77 -4
- package/dist/cron.cjs +430 -184
- 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 +430 -184
- 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 +430 -184
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +430 -184
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +523 -190
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -7
- package/dist/index.d.ts +93 -7
- package/dist/index.js +520 -191
- package/dist/index.js.map +1 -1
- package/dist/internal/runtime/local-agent/local-agent-bootstrap.d.ts +2 -4
- 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/runtime/skills/skill-frontmatter.d.ts +6 -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/skills.cjs.map +1 -1
- package/dist/skills.js.map +1 -1
- package/dist/types/agent.d.ts +67 -2
- 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/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, 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,
|
|
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
|
*
|
|
@@ -884,6 +933,43 @@ interface DefineProviderOptions {
|
|
|
884
933
|
*/
|
|
885
934
|
declare function defineProvider(profile: ProviderProfile, opts?: DefineProviderOptions): Plugin;
|
|
886
935
|
|
|
936
|
+
/**
|
|
937
|
+
* SE23 — `defineSkillReadTool`: an OPT-IN factory that gives the MODEL on-demand
|
|
938
|
+
* access to a skill's full body + references via a `skill_read` tool.
|
|
939
|
+
*
|
|
940
|
+
* TheoKit discloses skills eagerly through the `<skills>` system-prompt block
|
|
941
|
+
* (name + description only). This factory is the LAZY read path: the consumer
|
|
942
|
+
* explicitly adds the returned {@link CustomTool} to `tools`, and when the model
|
|
943
|
+
* calls it with a skill name, it gets that skill's `instructions` (+ SE21
|
|
944
|
+
* `references`). The SDK NEVER auto-injects it — bring-your-own-tools stays
|
|
945
|
+
* intact (sibling of `defineSubAgent` / `workflowAsTool`). See ADR 0007.
|
|
946
|
+
*
|
|
947
|
+
* import { Agent, createSkill, defineSkillReadTool } from "@theokit/sdk";
|
|
948
|
+
*
|
|
949
|
+
* const skills = [createSkill({ name: "release", description: "…", instructions: "…" })];
|
|
950
|
+
* const agent = await Agent.create({
|
|
951
|
+
* model: { id: "openai/gpt-4o-mini" },
|
|
952
|
+
* skills: { inline: skills },
|
|
953
|
+
* tools: [defineSkillReadTool(skills)],
|
|
954
|
+
* });
|
|
955
|
+
*
|
|
956
|
+
* @public
|
|
957
|
+
*/
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* SE23 — build an OPT-IN `skill_read` {@link CustomTool} over the given inline
|
|
961
|
+
* skills. When the model calls it with `{ name }`, the handler returns that
|
|
962
|
+
* skill's body + references. An UNKNOWN (but well-formed) name returns a typed
|
|
963
|
+
* "not found" string the model can act on — NOT a throw that kills the run.
|
|
964
|
+
* Malformed input (missing `name`) fails at the trust boundary via the schema.
|
|
965
|
+
*
|
|
966
|
+
* The consumer controls exposure by choosing which skills to pass; the SDK
|
|
967
|
+
* never auto-injects this tool.
|
|
968
|
+
*
|
|
969
|
+
* @public
|
|
970
|
+
*/
|
|
971
|
+
declare function defineSkillReadTool(skills: ReadonlyArray<InlineSkill>): CustomTool;
|
|
972
|
+
|
|
887
973
|
/**
|
|
888
974
|
* Options for {@link sanitizeToolInput}. Trim is the only default-on rung — coercion and JSON
|
|
889
975
|
* repair change a value's representation, so they are opt-in (the SDK's "values are strings; Zod
|
|
@@ -2483,4 +2569,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2483
2569
|
model?: string;
|
|
2484
2570
|
}): ShareGptTrajectory | null;
|
|
2485
2571
|
|
|
2486
|
-
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, 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, defineTool, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
|
|
2572
|
+
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, 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,
|
|
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
|
*
|
|
@@ -884,6 +933,43 @@ interface DefineProviderOptions {
|
|
|
884
933
|
*/
|
|
885
934
|
declare function defineProvider(profile: ProviderProfile, opts?: DefineProviderOptions): Plugin;
|
|
886
935
|
|
|
936
|
+
/**
|
|
937
|
+
* SE23 — `defineSkillReadTool`: an OPT-IN factory that gives the MODEL on-demand
|
|
938
|
+
* access to a skill's full body + references via a `skill_read` tool.
|
|
939
|
+
*
|
|
940
|
+
* TheoKit discloses skills eagerly through the `<skills>` system-prompt block
|
|
941
|
+
* (name + description only). This factory is the LAZY read path: the consumer
|
|
942
|
+
* explicitly adds the returned {@link CustomTool} to `tools`, and when the model
|
|
943
|
+
* calls it with a skill name, it gets that skill's `instructions` (+ SE21
|
|
944
|
+
* `references`). The SDK NEVER auto-injects it — bring-your-own-tools stays
|
|
945
|
+
* intact (sibling of `defineSubAgent` / `workflowAsTool`). See ADR 0007.
|
|
946
|
+
*
|
|
947
|
+
* import { Agent, createSkill, defineSkillReadTool } from "@theokit/sdk";
|
|
948
|
+
*
|
|
949
|
+
* const skills = [createSkill({ name: "release", description: "…", instructions: "…" })];
|
|
950
|
+
* const agent = await Agent.create({
|
|
951
|
+
* model: { id: "openai/gpt-4o-mini" },
|
|
952
|
+
* skills: { inline: skills },
|
|
953
|
+
* tools: [defineSkillReadTool(skills)],
|
|
954
|
+
* });
|
|
955
|
+
*
|
|
956
|
+
* @public
|
|
957
|
+
*/
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* SE23 — build an OPT-IN `skill_read` {@link CustomTool} over the given inline
|
|
961
|
+
* skills. When the model calls it with `{ name }`, the handler returns that
|
|
962
|
+
* skill's body + references. An UNKNOWN (but well-formed) name returns a typed
|
|
963
|
+
* "not found" string the model can act on — NOT a throw that kills the run.
|
|
964
|
+
* Malformed input (missing `name`) fails at the trust boundary via the schema.
|
|
965
|
+
*
|
|
966
|
+
* The consumer controls exposure by choosing which skills to pass; the SDK
|
|
967
|
+
* never auto-injects this tool.
|
|
968
|
+
*
|
|
969
|
+
* @public
|
|
970
|
+
*/
|
|
971
|
+
declare function defineSkillReadTool(skills: ReadonlyArray<InlineSkill>): CustomTool;
|
|
972
|
+
|
|
887
973
|
/**
|
|
888
974
|
* Options for {@link sanitizeToolInput}. Trim is the only default-on rung — coercion and JSON
|
|
889
975
|
* repair change a value's representation, so they are opt-in (the SDK's "values are strings; Zod
|
|
@@ -2483,4 +2569,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2483
2569
|
model?: string;
|
|
2484
2570
|
}): ShareGptTrajectory | null;
|
|
2485
2571
|
|
|
2486
|
-
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, 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, defineTool, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
|
|
2572
|
+
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 };
|