@theokit/sdk 2.9.0 → 2.11.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 +12 -0
- package/dist/a2a/index.cjs +36 -12
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +36 -12
- package/dist/a2a/index.js.map +1 -1
- package/dist/compaction.cjs +1 -1
- package/dist/compaction.cjs.map +1 -1
- package/dist/compaction.d.cts +6 -0
- package/dist/compaction.d.ts +6 -0
- package/dist/compaction.js +1 -1
- package/dist/compaction.js.map +1 -1
- package/dist/{cron-CRPY-aKq.d.cts → cron-BNI8pyn_.d.cts} +128 -3
- package/dist/{cron-Bhp8rP8i.d.ts → cron-CZlMLA1K.d.ts} +128 -3
- package/dist/cron.cjs +26 -12
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +26 -12
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +26 -12
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +26 -12
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +26 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -120
- package/dist/index.d.ts +6 -120
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/dist/internal/plugins/enabled-names.d.cts +1 -0
- package/dist/internal/plugins/enabled-names.d.ts +1 -0
- package/dist/models.cjs +117 -0
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +117 -0
- package/dist/models.js.map +1 -1
- package/dist/types/agent.d.ts +14 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-FKoM44Mj.cjs';
|
|
2
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, E as ErrorCode, m as ErrorMetadata, 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-FKoM44Mj.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
|
|
4
|
-
export {
|
|
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, B as BudgetTracker, p as MemoryProvider, q as MemoryId, r as PreToolCallDecision, s as SDKProvider } from './cron-BNI8pyn_.cjs';
|
|
4
|
+
export { t as ActiveMemoryPassArgs, u as ActiveMemoryPassResult, v as AgentMemory, w as BudgetCheck, x as BudgetTotal, y as BudgetUsageEvent, z as CloudEnv, D as CloudRepo, E as ContextBudget, F as ContextManagerKind, H as ContextSnapshot, I as ContextSource, J as ContextSourceStatus, K as Cron, N as CronCreateOptions, O as CronGetOptions, Q as CronJob, R as CronJobStatus, T as CronListOptions, U as CronOperationOptions, V as CronRunOptions, W as CronRuntime, X as CronSchedulerStatus, Y as CronStartOptions, Z as GoalEvent, _ as GoalOptions, $ as GoalResult, a0 as HookName, a1 as InvalidateCacheOptions, a2 as MemoryAdapter, a3 as MemoryAdapterCapabilities, a4 as MemoryContext, a5 as MemoryFact, a6 as MemoryProviderHandle, a7 as MemoryProviderInitOptions, a8 as MemoryRevision, a9 as MemoryToolSchema, aa as MemoryTurnMessage, ab as PersonalityPreset, ac as PluginContext, ad as PostAssistantReplyContext, ae as PreToolCallContext, af as PreUserSendContext, ag as PreUserSendResult, ah as ProviderCapability, ai as ProviderRoute, aj as RecordSessionSummaryArgs, ak as ResolvedProviderRoute, al as RunUntilIterator, am as SDKAgentPlugins, an as SDKAgentSkills, ao as SDKArtifact, ap as SDKContextManager, aq as SDKPluginMetadata, ar as SDKProvidersManager, as as SettingSource, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as definePlugin } from './cron-BNI8pyn_.cjs';
|
|
5
5
|
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, S as SDKMessage } from './run-D22b53SU.cjs';
|
|
6
6
|
export { A as AgentConversationTurn, c as AssistantMessage, d as ConversationStep, e as ConversationTurn, f as CostBreakdown, g as CostSource, h as CostStatus, I as InteractionUpdate, i as McpAuthConfig, j as McpHttpServerConfig, k as McpOAuthConfig, l as McpStdioServerConfig, m as ModelParameterValue, P as PartialToolCallUpdate, n as RunErrorDetail, o as RunGitInfo, p as RunOperation, q as RunStatus, r as RunToCompletionOptions, s as RunToCompletionResult, t as SDKAssistantMessage, u as SDKImage, v as SDKImageDimension, w as SDKObjectDelta, x as SDKRequestMessage, y as SDKStatusMessage, z as SDKSystemMessage, B as SDKTaskMessage, D as SDKThinkingMessage, E as SDKToolUseMessage, F as SDKUserMessage, G as SDKUserMessageEvent, H as SendOptions, J as ShellCommand, K as ShellConversationTurn, L as ShellOutput, N as ShellOutputDeltaUpdate, O as StepCompletedUpdate, Q as StepStartedUpdate, T as StreamToCompletionResult, U as SummaryCompletedUpdate, V as SummaryStartedUpdate, W as SummaryUpdate, X as TextBlock, Y as TextDeltaUpdate, Z as ThinkingCompletedUpdate, _ as ThinkingDeltaUpdate, $ as ThinkingMessage, a0 as TokenDeltaUpdate, a1 as TokenUsage, a2 as ToolCall, a3 as ToolCallCompletedUpdate, a4 as ToolCallStartedUpdate, a5 as ToolResult, a6 as ToolUseBlock, a7 as TurnEndedUpdate, a8 as UserMessage, a9 as UserMessageAppendedUpdate } from './run-D22b53SU.cjs';
|
|
7
7
|
import * as zod from 'zod';
|
|
@@ -683,11 +683,11 @@ declare function chargeAndCheckThresholds(name: string, actualUsd: number): Prom
|
|
|
683
683
|
*
|
|
684
684
|
* @internal
|
|
685
685
|
*/
|
|
686
|
-
type ApiMode
|
|
687
|
-
declare function inferApiMode(provider: string): ApiMode
|
|
686
|
+
type ApiMode = "anthropic_messages" | "openai_chat_completions" | "openai_responses";
|
|
687
|
+
declare function inferApiMode(provider: string): ApiMode;
|
|
688
688
|
declare function normalizeUsage(rawUsage: unknown, opts: {
|
|
689
689
|
provider: string;
|
|
690
|
-
apiMode?: ApiMode
|
|
690
|
+
apiMode?: ApiMode;
|
|
691
691
|
}): TokenUsage;
|
|
692
692
|
|
|
693
693
|
/**
|
|
@@ -821,120 +821,6 @@ declare class Budget {
|
|
|
821
821
|
static snapshot(): readonly BudgetSnapshot[];
|
|
822
822
|
}
|
|
823
823
|
|
|
824
|
-
/**
|
|
825
|
-
* ProviderProfile + ApiMode types (T3.1, ADR D105).
|
|
826
|
-
*
|
|
827
|
-
* Profile is **data-only** — no methods. Adding a provider is declaring an
|
|
828
|
-
* object literal; the Transport layer (D106) consumes `apiMode` to pick
|
|
829
|
-
* the HTTP dialect.
|
|
830
|
-
*
|
|
831
|
-
* @public
|
|
832
|
-
*/
|
|
833
|
-
type ApiMode = "chat_completions" | "anthropic_messages" | "responses_api" | "bedrock" | "bedrock_anthropic";
|
|
834
|
-
type AuthType = "api_key" | "oauth_device_code" | "oauth_external" | "aws_sdk" | "aws_bearer" | "gcp_oauth" | "none";
|
|
835
|
-
interface ProviderProfile {
|
|
836
|
-
name: string;
|
|
837
|
-
apiMode: ApiMode;
|
|
838
|
-
aliases?: ReadonlyArray<string>;
|
|
839
|
-
displayName?: string;
|
|
840
|
-
description?: string;
|
|
841
|
-
signupUrl?: string;
|
|
842
|
-
envVars: ReadonlyArray<string>;
|
|
843
|
-
authType: AuthType;
|
|
844
|
-
baseUrl: string;
|
|
845
|
-
modelsUrl?: string;
|
|
846
|
-
hostname?: string;
|
|
847
|
-
fallbackModels: ReadonlyArray<string>;
|
|
848
|
-
extraHeaders?: Record<string, string>;
|
|
849
|
-
bodyOverrides?: Record<string, unknown>;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
type HookName = "pre_tool_call" | "post_tool_call" | "pre_llm_call" | "post_llm_call" | "on_session_start" | "on_session_end" | "transform_tool_result" | "transform_llm_output" | "pre_user_send" | "post_assistant_reply";
|
|
853
|
-
interface PreToolCallContext {
|
|
854
|
-
name: string;
|
|
855
|
-
args: Record<string, unknown>;
|
|
856
|
-
agentId: string;
|
|
857
|
-
runId: string;
|
|
858
|
-
}
|
|
859
|
-
interface PreToolCallDecision {
|
|
860
|
-
block: true;
|
|
861
|
-
message: string;
|
|
862
|
-
}
|
|
863
|
-
/**
|
|
864
|
-
* Context passed to `pre_user_send` hook handlers (ADR D145).
|
|
865
|
-
*
|
|
866
|
-
* @public
|
|
867
|
-
*/
|
|
868
|
-
interface PreUserSendContext {
|
|
869
|
-
prompt: string;
|
|
870
|
-
agentId: string;
|
|
871
|
-
runId: string;
|
|
872
|
-
/** Caller-supplied memory context, flowing through from `AgentOptions.memoryContext`. */
|
|
873
|
-
memoryContext?: MemoryContext;
|
|
874
|
-
/** Forwarded `AbortSignal` so adapter recall HTTP can be cancelled mid-flight (EC-H). */
|
|
875
|
-
signal?: AbortSignal;
|
|
876
|
-
}
|
|
877
|
-
/**
|
|
878
|
-
* Optional result returned by `pre_user_send` handlers. The agent loop
|
|
879
|
-
* concatenates `recalledContext` from all handlers and injects it as a
|
|
880
|
-
* `<memory-context>...</memory-context>` block before the user prompt.
|
|
881
|
-
*
|
|
882
|
-
* @public
|
|
883
|
-
*/
|
|
884
|
-
interface PreUserSendResult {
|
|
885
|
-
recalledContext?: string;
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* Context passed to `post_assistant_reply` hook handlers (ADR D145).
|
|
889
|
-
* Fire-and-forget — exceptions are caught and surfaced to stderr; the
|
|
890
|
-
* caller's `wait()` never blocks on this dispatch.
|
|
891
|
-
*
|
|
892
|
-
* @public
|
|
893
|
-
*/
|
|
894
|
-
interface PostAssistantReplyContext {
|
|
895
|
-
prompt: string;
|
|
896
|
-
reply: string;
|
|
897
|
-
agentId: string;
|
|
898
|
-
runId: string;
|
|
899
|
-
memoryContext?: MemoryContext;
|
|
900
|
-
}
|
|
901
|
-
type HookHandler = (ctx: unknown) => unknown | Promise<unknown>;
|
|
902
|
-
type CommandHandler = (args: Record<string, unknown>) => Promise<string> | string;
|
|
903
|
-
interface CommandOptions {
|
|
904
|
-
description?: string;
|
|
905
|
-
}
|
|
906
|
-
interface PluginContext {
|
|
907
|
-
/** Register a custom tool. Equivalent to passing in `AgentOptions.tools`. */
|
|
908
|
-
registerTool(tool: CustomTool): void;
|
|
909
|
-
/** Register a slash-command-style handler. Consumed by CLI/bot wrappers; NOT used by the agent loop. */
|
|
910
|
-
registerCommand(name: string, handler: CommandHandler, opts?: CommandOptions): void;
|
|
911
|
-
/** Attach a hook handler. `pre_tool_call` supports veto via `PreToolCallDecision`. */
|
|
912
|
-
on(hook: HookName, handler: HookHandler): void;
|
|
913
|
-
/** Inject a user/system message into the next agent turn. v1 supports only `on_session_start` context. */
|
|
914
|
-
injectMessage(content: string, role?: "user" | "system"): void;
|
|
915
|
-
}
|
|
916
|
-
interface BasePlugin {
|
|
917
|
-
name: string;
|
|
918
|
-
version: string;
|
|
919
|
-
}
|
|
920
|
-
type Plugin = (BasePlugin & {
|
|
921
|
-
kind: "general";
|
|
922
|
-
register: (ctx: PluginContext) => void | Promise<void>;
|
|
923
|
-
}) | (BasePlugin & {
|
|
924
|
-
kind: "model-provider";
|
|
925
|
-
profile: ProviderProfile;
|
|
926
|
-
}) | (BasePlugin & {
|
|
927
|
-
kind: "memory";
|
|
928
|
-
createProvider: MemoryProviderFactory;
|
|
929
|
-
});
|
|
930
|
-
/**
|
|
931
|
-
* Identity helper for plugin authors. TS-only convenience — preserves
|
|
932
|
-
* inferred type without forcing manual `Plugin` annotation.
|
|
933
|
-
*
|
|
934
|
-
* @public
|
|
935
|
-
*/
|
|
936
|
-
declare function definePlugin<P extends Plugin>(p: P): P;
|
|
937
|
-
|
|
938
824
|
/**
|
|
939
825
|
* Options for {@link defineProvider}.
|
|
940
826
|
*
|
|
@@ -2186,4 +2072,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2186
2072
|
model?: string;
|
|
2187
2073
|
}): ShareGptTrajectory | null;
|
|
2188
2074
|
|
|
2189
|
-
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, EventBus, type EvictReason, FileSystemConversationStorage, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions,
|
|
2075
|
+
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, EventBus, type EvictReason, FileSystemConversationStorage, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, InMemoryConversationStorage, JobQueue, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, type PermissionAction, PermissionEngine, type PermissionEngineOptions, 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 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, UsageAccumulator, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSquad, defineProvider, defineTool, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeUsage, preflightCheck, toShareGptTrajectory, withCwdMutex };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-C8EVGqje.js';
|
|
2
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, E as ErrorCode, m as ErrorMetadata, 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-C8EVGqje.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
|
|
4
|
-
export {
|
|
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, B as BudgetTracker, p as MemoryProvider, q as MemoryId, r as PreToolCallDecision, s as SDKProvider } from './cron-CZlMLA1K.js';
|
|
4
|
+
export { t as ActiveMemoryPassArgs, u as ActiveMemoryPassResult, v as AgentMemory, w as BudgetCheck, x as BudgetTotal, y as BudgetUsageEvent, z as CloudEnv, D as CloudRepo, E as ContextBudget, F as ContextManagerKind, H as ContextSnapshot, I as ContextSource, J as ContextSourceStatus, K as Cron, N as CronCreateOptions, O as CronGetOptions, Q as CronJob, R as CronJobStatus, T as CronListOptions, U as CronOperationOptions, V as CronRunOptions, W as CronRuntime, X as CronSchedulerStatus, Y as CronStartOptions, Z as GoalEvent, _ as GoalOptions, $ as GoalResult, a0 as HookName, a1 as InvalidateCacheOptions, a2 as MemoryAdapter, a3 as MemoryAdapterCapabilities, a4 as MemoryContext, a5 as MemoryFact, a6 as MemoryProviderHandle, a7 as MemoryProviderInitOptions, a8 as MemoryRevision, a9 as MemoryToolSchema, aa as MemoryTurnMessage, ab as PersonalityPreset, ac as PluginContext, ad as PostAssistantReplyContext, ae as PreToolCallContext, af as PreUserSendContext, ag as PreUserSendResult, ah as ProviderCapability, ai as ProviderRoute, aj as RecordSessionSummaryArgs, ak as ResolvedProviderRoute, al as RunUntilIterator, am as SDKAgentPlugins, an as SDKAgentSkills, ao as SDKArtifact, ap as SDKContextManager, aq as SDKPluginMetadata, ar as SDKProvidersManager, as as SettingSource, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as definePlugin } from './cron-CZlMLA1K.js';
|
|
5
5
|
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, S as SDKMessage } from './run-D22b53SU.js';
|
|
6
6
|
export { A as AgentConversationTurn, c as AssistantMessage, d as ConversationStep, e as ConversationTurn, f as CostBreakdown, g as CostSource, h as CostStatus, I as InteractionUpdate, i as McpAuthConfig, j as McpHttpServerConfig, k as McpOAuthConfig, l as McpStdioServerConfig, m as ModelParameterValue, P as PartialToolCallUpdate, n as RunErrorDetail, o as RunGitInfo, p as RunOperation, q as RunStatus, r as RunToCompletionOptions, s as RunToCompletionResult, t as SDKAssistantMessage, u as SDKImage, v as SDKImageDimension, w as SDKObjectDelta, x as SDKRequestMessage, y as SDKStatusMessage, z as SDKSystemMessage, B as SDKTaskMessage, D as SDKThinkingMessage, E as SDKToolUseMessage, F as SDKUserMessage, G as SDKUserMessageEvent, H as SendOptions, J as ShellCommand, K as ShellConversationTurn, L as ShellOutput, N as ShellOutputDeltaUpdate, O as StepCompletedUpdate, Q as StepStartedUpdate, T as StreamToCompletionResult, U as SummaryCompletedUpdate, V as SummaryStartedUpdate, W as SummaryUpdate, X as TextBlock, Y as TextDeltaUpdate, Z as ThinkingCompletedUpdate, _ as ThinkingDeltaUpdate, $ as ThinkingMessage, a0 as TokenDeltaUpdate, a1 as TokenUsage, a2 as ToolCall, a3 as ToolCallCompletedUpdate, a4 as ToolCallStartedUpdate, a5 as ToolResult, a6 as ToolUseBlock, a7 as TurnEndedUpdate, a8 as UserMessage, a9 as UserMessageAppendedUpdate } from './run-D22b53SU.js';
|
|
7
7
|
import * as zod from 'zod';
|
|
@@ -683,11 +683,11 @@ declare function chargeAndCheckThresholds(name: string, actualUsd: number): Prom
|
|
|
683
683
|
*
|
|
684
684
|
* @internal
|
|
685
685
|
*/
|
|
686
|
-
type ApiMode
|
|
687
|
-
declare function inferApiMode(provider: string): ApiMode
|
|
686
|
+
type ApiMode = "anthropic_messages" | "openai_chat_completions" | "openai_responses";
|
|
687
|
+
declare function inferApiMode(provider: string): ApiMode;
|
|
688
688
|
declare function normalizeUsage(rawUsage: unknown, opts: {
|
|
689
689
|
provider: string;
|
|
690
|
-
apiMode?: ApiMode
|
|
690
|
+
apiMode?: ApiMode;
|
|
691
691
|
}): TokenUsage;
|
|
692
692
|
|
|
693
693
|
/**
|
|
@@ -821,120 +821,6 @@ declare class Budget {
|
|
|
821
821
|
static snapshot(): readonly BudgetSnapshot[];
|
|
822
822
|
}
|
|
823
823
|
|
|
824
|
-
/**
|
|
825
|
-
* ProviderProfile + ApiMode types (T3.1, ADR D105).
|
|
826
|
-
*
|
|
827
|
-
* Profile is **data-only** — no methods. Adding a provider is declaring an
|
|
828
|
-
* object literal; the Transport layer (D106) consumes `apiMode` to pick
|
|
829
|
-
* the HTTP dialect.
|
|
830
|
-
*
|
|
831
|
-
* @public
|
|
832
|
-
*/
|
|
833
|
-
type ApiMode = "chat_completions" | "anthropic_messages" | "responses_api" | "bedrock" | "bedrock_anthropic";
|
|
834
|
-
type AuthType = "api_key" | "oauth_device_code" | "oauth_external" | "aws_sdk" | "aws_bearer" | "gcp_oauth" | "none";
|
|
835
|
-
interface ProviderProfile {
|
|
836
|
-
name: string;
|
|
837
|
-
apiMode: ApiMode;
|
|
838
|
-
aliases?: ReadonlyArray<string>;
|
|
839
|
-
displayName?: string;
|
|
840
|
-
description?: string;
|
|
841
|
-
signupUrl?: string;
|
|
842
|
-
envVars: ReadonlyArray<string>;
|
|
843
|
-
authType: AuthType;
|
|
844
|
-
baseUrl: string;
|
|
845
|
-
modelsUrl?: string;
|
|
846
|
-
hostname?: string;
|
|
847
|
-
fallbackModels: ReadonlyArray<string>;
|
|
848
|
-
extraHeaders?: Record<string, string>;
|
|
849
|
-
bodyOverrides?: Record<string, unknown>;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
type HookName = "pre_tool_call" | "post_tool_call" | "pre_llm_call" | "post_llm_call" | "on_session_start" | "on_session_end" | "transform_tool_result" | "transform_llm_output" | "pre_user_send" | "post_assistant_reply";
|
|
853
|
-
interface PreToolCallContext {
|
|
854
|
-
name: string;
|
|
855
|
-
args: Record<string, unknown>;
|
|
856
|
-
agentId: string;
|
|
857
|
-
runId: string;
|
|
858
|
-
}
|
|
859
|
-
interface PreToolCallDecision {
|
|
860
|
-
block: true;
|
|
861
|
-
message: string;
|
|
862
|
-
}
|
|
863
|
-
/**
|
|
864
|
-
* Context passed to `pre_user_send` hook handlers (ADR D145).
|
|
865
|
-
*
|
|
866
|
-
* @public
|
|
867
|
-
*/
|
|
868
|
-
interface PreUserSendContext {
|
|
869
|
-
prompt: string;
|
|
870
|
-
agentId: string;
|
|
871
|
-
runId: string;
|
|
872
|
-
/** Caller-supplied memory context, flowing through from `AgentOptions.memoryContext`. */
|
|
873
|
-
memoryContext?: MemoryContext;
|
|
874
|
-
/** Forwarded `AbortSignal` so adapter recall HTTP can be cancelled mid-flight (EC-H). */
|
|
875
|
-
signal?: AbortSignal;
|
|
876
|
-
}
|
|
877
|
-
/**
|
|
878
|
-
* Optional result returned by `pre_user_send` handlers. The agent loop
|
|
879
|
-
* concatenates `recalledContext` from all handlers and injects it as a
|
|
880
|
-
* `<memory-context>...</memory-context>` block before the user prompt.
|
|
881
|
-
*
|
|
882
|
-
* @public
|
|
883
|
-
*/
|
|
884
|
-
interface PreUserSendResult {
|
|
885
|
-
recalledContext?: string;
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* Context passed to `post_assistant_reply` hook handlers (ADR D145).
|
|
889
|
-
* Fire-and-forget — exceptions are caught and surfaced to stderr; the
|
|
890
|
-
* caller's `wait()` never blocks on this dispatch.
|
|
891
|
-
*
|
|
892
|
-
* @public
|
|
893
|
-
*/
|
|
894
|
-
interface PostAssistantReplyContext {
|
|
895
|
-
prompt: string;
|
|
896
|
-
reply: string;
|
|
897
|
-
agentId: string;
|
|
898
|
-
runId: string;
|
|
899
|
-
memoryContext?: MemoryContext;
|
|
900
|
-
}
|
|
901
|
-
type HookHandler = (ctx: unknown) => unknown | Promise<unknown>;
|
|
902
|
-
type CommandHandler = (args: Record<string, unknown>) => Promise<string> | string;
|
|
903
|
-
interface CommandOptions {
|
|
904
|
-
description?: string;
|
|
905
|
-
}
|
|
906
|
-
interface PluginContext {
|
|
907
|
-
/** Register a custom tool. Equivalent to passing in `AgentOptions.tools`. */
|
|
908
|
-
registerTool(tool: CustomTool): void;
|
|
909
|
-
/** Register a slash-command-style handler. Consumed by CLI/bot wrappers; NOT used by the agent loop. */
|
|
910
|
-
registerCommand(name: string, handler: CommandHandler, opts?: CommandOptions): void;
|
|
911
|
-
/** Attach a hook handler. `pre_tool_call` supports veto via `PreToolCallDecision`. */
|
|
912
|
-
on(hook: HookName, handler: HookHandler): void;
|
|
913
|
-
/** Inject a user/system message into the next agent turn. v1 supports only `on_session_start` context. */
|
|
914
|
-
injectMessage(content: string, role?: "user" | "system"): void;
|
|
915
|
-
}
|
|
916
|
-
interface BasePlugin {
|
|
917
|
-
name: string;
|
|
918
|
-
version: string;
|
|
919
|
-
}
|
|
920
|
-
type Plugin = (BasePlugin & {
|
|
921
|
-
kind: "general";
|
|
922
|
-
register: (ctx: PluginContext) => void | Promise<void>;
|
|
923
|
-
}) | (BasePlugin & {
|
|
924
|
-
kind: "model-provider";
|
|
925
|
-
profile: ProviderProfile;
|
|
926
|
-
}) | (BasePlugin & {
|
|
927
|
-
kind: "memory";
|
|
928
|
-
createProvider: MemoryProviderFactory;
|
|
929
|
-
});
|
|
930
|
-
/**
|
|
931
|
-
* Identity helper for plugin authors. TS-only convenience — preserves
|
|
932
|
-
* inferred type without forcing manual `Plugin` annotation.
|
|
933
|
-
*
|
|
934
|
-
* @public
|
|
935
|
-
*/
|
|
936
|
-
declare function definePlugin<P extends Plugin>(p: P): P;
|
|
937
|
-
|
|
938
824
|
/**
|
|
939
825
|
* Options for {@link defineProvider}.
|
|
940
826
|
*
|
|
@@ -2186,4 +2072,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2186
2072
|
model?: string;
|
|
2187
2073
|
}): ShareGptTrajectory | null;
|
|
2188
2074
|
|
|
2189
|
-
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, EventBus, type EvictReason, FileSystemConversationStorage, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions,
|
|
2075
|
+
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, EventBus, type EvictReason, FileSystemConversationStorage, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, InMemoryConversationStorage, JobQueue, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, type PermissionAction, PermissionEngine, type PermissionEngineOptions, 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 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, UsageAccumulator, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSquad, defineProvider, defineTool, extractRawId, getPricingEntry, inferApiMode, isValidTaskId, migrateSqliteToLance, mkMemoryId, normalizeUsage, preflightCheck, toShareGptTrajectory, withCwdMutex };
|
package/dist/index.js
CHANGED
|
@@ -5871,6 +5871,18 @@ async function writeVersionedJson(path, data2, currentVersion) {
|
|
|
5871
5871
|
await atomicWriteJson(path, file);
|
|
5872
5872
|
}
|
|
5873
5873
|
|
|
5874
|
+
// src/internal/plugins/enabled-names.ts
|
|
5875
|
+
function isPluginArray(plugins) {
|
|
5876
|
+
return Array.isArray(plugins);
|
|
5877
|
+
}
|
|
5878
|
+
function asPluginsSettings(plugins) {
|
|
5879
|
+
if (plugins === void 0) return void 0;
|
|
5880
|
+
return isPluginArray(plugins) ? void 0 : plugins;
|
|
5881
|
+
}
|
|
5882
|
+
function enabledPluginNames(plugins) {
|
|
5883
|
+
return asPluginsSettings(plugins)?.enabled ?? [];
|
|
5884
|
+
}
|
|
5885
|
+
|
|
5874
5886
|
// src/internal/runtime/registry/agent-registry-store.ts
|
|
5875
5887
|
var SCHEMA_VERSION = 1;
|
|
5876
5888
|
var LEGACY_SCHEMA_VERSION_STRING = "1.0";
|
|
@@ -5884,7 +5896,9 @@ function stripSecretsFromOptions(options) {
|
|
|
5884
5896
|
cloud: serializeCloud(options.cloud),
|
|
5885
5897
|
memory: serializeMemory(options.memory),
|
|
5886
5898
|
skills: serializeEnabledList(options.skills),
|
|
5887
|
-
|
|
5899
|
+
// Code-`Plugin` objects are closures and cannot be persisted (like custom
|
|
5900
|
+
// tools); only the named-enable settings form is serialized.
|
|
5901
|
+
plugins: serializeEnabledList(asPluginsSettings(options.plugins)),
|
|
5888
5902
|
context: serializeContext(options.context),
|
|
5889
5903
|
providers: serializeProviders(options.providers),
|
|
5890
5904
|
agents: serializeAgents(options.agents)
|
|
@@ -6192,8 +6206,9 @@ function serializeSkills(skills) {
|
|
|
6192
6206
|
return { enabled: [...skills.enabled] };
|
|
6193
6207
|
}
|
|
6194
6208
|
function serializePlugins(plugins) {
|
|
6195
|
-
|
|
6196
|
-
|
|
6209
|
+
const enabled = enabledPluginNames(plugins);
|
|
6210
|
+
if (enabled.length === 0) return void 0;
|
|
6211
|
+
return { enabled: [...enabled] };
|
|
6197
6212
|
}
|
|
6198
6213
|
function serializeMcp(mcpServers) {
|
|
6199
6214
|
if (mcpServers === void 0) return void 0;
|
|
@@ -6376,11 +6391,8 @@ function defaultLocalTools(request) {
|
|
|
6376
6391
|
tools.push(`mcp_${sanitizeMcpName(name)}_call`);
|
|
6377
6392
|
}
|
|
6378
6393
|
}
|
|
6379
|
-
const
|
|
6380
|
-
|
|
6381
|
-
for (const _pluginName of plugins.enabled) {
|
|
6382
|
-
tools.push("mcp_search_provider_web_search");
|
|
6383
|
-
}
|
|
6394
|
+
for (const _pluginName of enabledPluginNames(request.agentOptions.plugins)) {
|
|
6395
|
+
tools.push("mcp_search_provider_web_search");
|
|
6384
6396
|
}
|
|
6385
6397
|
return tools;
|
|
6386
6398
|
}
|
|
@@ -9500,7 +9512,7 @@ function resolveRoute(route, modelProvider, plugins) {
|
|
|
9500
9512
|
if (modelName !== void 0) base.model = modelName;
|
|
9501
9513
|
return base;
|
|
9502
9514
|
}
|
|
9503
|
-
if (plugins
|
|
9515
|
+
if (enabledPluginNames(plugins).length > 0) {
|
|
9504
9516
|
return {
|
|
9505
9517
|
capability: route.capability,
|
|
9506
9518
|
provider: route.provider,
|
|
@@ -10505,7 +10517,7 @@ function bootstrapSubmanagers(args) {
|
|
|
10505
10517
|
args.settingSourcesIncludeProject
|
|
10506
10518
|
);
|
|
10507
10519
|
}
|
|
10508
|
-
const providerCount = (args.options.providers?.routes?.length ?? 0) + (args.options.plugins
|
|
10520
|
+
const providerCount = (args.options.providers?.routes?.length ?? 0) + enabledPluginNames(args.options.plugins).length;
|
|
10509
10521
|
if (providerCount > 0 || args.options.providers !== void 0) {
|
|
10510
10522
|
out.providers = new ProvidersManagerImpl(
|
|
10511
10523
|
args.options.model,
|
|
@@ -10525,7 +10537,9 @@ function bootstrapSubmanagers(args) {
|
|
|
10525
10537
|
if (args.options.plugins !== void 0 || args.settingSourcesIncludePlugins) {
|
|
10526
10538
|
out.pluginsManager = new PluginsManager(
|
|
10527
10539
|
args.workspaceCwd,
|
|
10528
|
-
|
|
10540
|
+
// The array (code-`Plugin`) form has no named-enable list; `undefined`
|
|
10541
|
+
// here preserves "no filter / load all file-discovered plugins".
|
|
10542
|
+
asPluginsSettings(args.options.plugins)?.enabled,
|
|
10529
10543
|
args.settingSourcesIncludePlugins,
|
|
10530
10544
|
false,
|
|
10531
10545
|
void 0
|
|
@@ -16885,7 +16899,7 @@ var Agent = class _Agent {
|
|
|
16885
16899
|
const runtime = options.cloud !== void 0 ? "cloud" : "local";
|
|
16886
16900
|
const span = telemetry.startSpan(SPAN_NAMES.AGENT_CREATE, {
|
|
16887
16901
|
runtime,
|
|
16888
|
-
pluginCount: options.plugins
|
|
16902
|
+
pluginCount: enabledPluginNames(options.plugins).length
|
|
16889
16903
|
});
|
|
16890
16904
|
try {
|
|
16891
16905
|
const agent = await runCreateUnderSpan(options, span);
|