@theokit/sdk 2.19.0 → 2.20.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 +8 -0
- package/dist/a2a/index.cjs +42 -7
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +42 -7
- package/dist/a2a/index.js.map +1 -1
- package/dist/create-skill.d.ts +29 -0
- package/dist/{cron-D_wK1S-0.d.cts → cron-B8fqui49.d.cts} +58 -1
- package/dist/{cron-Cep07kTz.d.ts → cron-D2yLOrk2.d.ts} +58 -1
- package/dist/cron.cjs +42 -7
- 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 +42 -7
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +42 -7
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +42 -7
- package/dist/eval.js.map +1 -1
- package/dist/generate-object.d.ts +16 -2
- package/dist/index.cjs +105 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +104 -8
- package/dist/index.js.map +1 -1
- package/dist/types/agent.d.ts +10 -0
- package/package.json +14 -14
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-CE-lMBi2.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-CE-lMBi2.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, n as ConversationStorageAdapter, o as StoredMessage, B as BudgetTracker, p as MemoryProvider, q as MemoryId, r as PreToolCallDecision, s as SDKProvider } from './cron-
|
|
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
|
|
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-B8fqui49.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 CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InlineSkill, a3 as InvalidateCacheOptions, a4 as MemoryAdapter, a5 as MemoryAdapterCapabilities, a6 as MemoryContext, a7 as MemoryFact, a8 as MemoryProviderHandle, a9 as MemoryProviderInitOptions, aa as MemoryRevision, ab as MemoryToolSchema, ac as MemoryTurnMessage, ad as PersonalityPreset, ae as PluginContext, af as PostAssistantReplyContext, ag as PreToolCallContext, ah as PreUserSendContext, ai as PreUserSendResult, aj as ProviderCapability, ak as ProviderRoute, al as RecordSessionSummaryArgs, am as ResolvedProviderRoute, an as RunUntilIterator, ao as SDKAgentPlugins, ap as SDKAgentSkills, aq as SDKArtifact, ar as SDKContextManager, as as SDKPluginMetadata, at as SDKProvidersManager, au as SettingSource, av as SystemPromptContext, aw as SystemPromptMemoryFact, ax as SystemPromptSkillRef, ay as TelemetrySettings, az as createSkill, aA as definePlugin } from './cron-B8fqui49.cjs';
|
|
5
5
|
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, S as SDKMessage } from './run-BgfBWX-z.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, D as DoomLoopThresholds, 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, E as SDKThinkingMessage, F as SDKToolUseMessage, G as SDKUserMessage, H as SDKUserMessageEvent, J as SendOptions, K as ShellCommand, L as ShellConversationTurn, N as ShellOutput, O as ShellOutputDeltaUpdate, Q as StepCompletedUpdate, T as StepStartedUpdate, U as StreamToCompletionResult, V as SummaryCompletedUpdate, W as SummaryStartedUpdate, X as SummaryUpdate, Y as TextBlock, Z as TextDeltaUpdate, _ as ThinkingCompletedUpdate, $ as ThinkingDeltaUpdate, a0 as ThinkingMessage, a1 as TokenDeltaUpdate, a2 as TokenUsage, a3 as ToolCall, a4 as ToolCallCompletedUpdate, a5 as ToolCallStartedUpdate, a6 as ToolResult, a7 as ToolResultGuardOptions, a8 as ToolUseBlock, a9 as TurnEndedUpdate, aa as UserMessage, ab as UserMessageAppendedUpdate } from './run-BgfBWX-z.cjs';
|
|
7
7
|
import * as zod from 'zod';
|
|
@@ -205,6 +205,13 @@ interface GenerateObjectOptions<T extends ZodType> {
|
|
|
205
205
|
systemPrompt?: string;
|
|
206
206
|
/** Model selection. Required (transient agents need a model). */
|
|
207
207
|
model: ModelSelection;
|
|
208
|
+
/**
|
|
209
|
+
* M21 — optional separate model for the STRUCTURING step. When set, `model` first produces a
|
|
210
|
+
* free-text reasoned answer to the prompt (phase 1), then `structuringModel` extracts the
|
|
211
|
+
* schema-matched object by calling the `output` tool over that answer (phase 2). Lets a large
|
|
212
|
+
* model reason while a cheap fast model does the extraction. Absent ⇒ today's single-model flow.
|
|
213
|
+
*/
|
|
214
|
+
structuringModel?: ModelSelection;
|
|
208
215
|
/** API key. Falls back to env (THEOKIT_API_KEY etc). */
|
|
209
216
|
apiKey?: string;
|
|
210
217
|
/** Local runtime config (cwd, sandbox). Required to keep the transient agent local-only. */
|
|
@@ -1484,6 +1491,15 @@ interface PermissionPluginOptions {
|
|
|
1484
1491
|
*/
|
|
1485
1492
|
declare function createPermissionPlugin(engine: PermissionEngine, opts?: PermissionPluginOptions): Plugin;
|
|
1486
1493
|
|
|
1494
|
+
/** The internal JSON-Schema shape the synthetic `output` tool consumes. */
|
|
1495
|
+
type NormalizedJsonSchema = Record<string, unknown>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Normalize any supported schema to the internal JSON Schema. Async because the Valibot path
|
|
1498
|
+
* dynamically imports its optional converter. Throws a clear, typed-message error for an unsupported
|
|
1499
|
+
* schema or a missing Valibot peer (error-handling.md).
|
|
1500
|
+
*/
|
|
1501
|
+
declare function normalizeSchema(schema: unknown): Promise<NormalizedJsonSchema>;
|
|
1502
|
+
|
|
1487
1503
|
/**
|
|
1488
1504
|
* Public security namespace (T2.1, ADR D68).
|
|
1489
1505
|
*
|
|
@@ -2214,4 +2230,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2214
2230
|
model?: string;
|
|
2215
2231
|
}): ShareGptTrajectory | null;
|
|
2216
2232
|
|
|
2217
|
-
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, type JobQueueOptions, 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 SessionScope, 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, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
|
|
2233
|
+
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, type JobQueueOptions, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, type NormalizedJsonSchema, 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 SessionScope, 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, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, 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-5lj1EWgs.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-5lj1EWgs.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, n as ConversationStorageAdapter, o as StoredMessage, B as BudgetTracker, p as MemoryProvider, q as MemoryId, r as PreToolCallDecision, s as SDKProvider } from './cron-
|
|
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
|
|
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-D2yLOrk2.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 CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InlineSkill, a3 as InvalidateCacheOptions, a4 as MemoryAdapter, a5 as MemoryAdapterCapabilities, a6 as MemoryContext, a7 as MemoryFact, a8 as MemoryProviderHandle, a9 as MemoryProviderInitOptions, aa as MemoryRevision, ab as MemoryToolSchema, ac as MemoryTurnMessage, ad as PersonalityPreset, ae as PluginContext, af as PostAssistantReplyContext, ag as PreToolCallContext, ah as PreUserSendContext, ai as PreUserSendResult, aj as ProviderCapability, ak as ProviderRoute, al as RecordSessionSummaryArgs, am as ResolvedProviderRoute, an as RunUntilIterator, ao as SDKAgentPlugins, ap as SDKAgentSkills, aq as SDKArtifact, ar as SDKContextManager, as as SDKPluginMetadata, at as SDKProvidersManager, au as SettingSource, av as SystemPromptContext, aw as SystemPromptMemoryFact, ax as SystemPromptSkillRef, ay as TelemetrySettings, az as createSkill, aA as definePlugin } from './cron-D2yLOrk2.js';
|
|
5
5
|
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, S as SDKMessage } from './run-BgfBWX-z.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, D as DoomLoopThresholds, 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, E as SDKThinkingMessage, F as SDKToolUseMessage, G as SDKUserMessage, H as SDKUserMessageEvent, J as SendOptions, K as ShellCommand, L as ShellConversationTurn, N as ShellOutput, O as ShellOutputDeltaUpdate, Q as StepCompletedUpdate, T as StepStartedUpdate, U as StreamToCompletionResult, V as SummaryCompletedUpdate, W as SummaryStartedUpdate, X as SummaryUpdate, Y as TextBlock, Z as TextDeltaUpdate, _ as ThinkingCompletedUpdate, $ as ThinkingDeltaUpdate, a0 as ThinkingMessage, a1 as TokenDeltaUpdate, a2 as TokenUsage, a3 as ToolCall, a4 as ToolCallCompletedUpdate, a5 as ToolCallStartedUpdate, a6 as ToolResult, a7 as ToolResultGuardOptions, a8 as ToolUseBlock, a9 as TurnEndedUpdate, aa as UserMessage, ab as UserMessageAppendedUpdate } from './run-BgfBWX-z.js';
|
|
7
7
|
import * as zod from 'zod';
|
|
@@ -205,6 +205,13 @@ interface GenerateObjectOptions<T extends ZodType> {
|
|
|
205
205
|
systemPrompt?: string;
|
|
206
206
|
/** Model selection. Required (transient agents need a model). */
|
|
207
207
|
model: ModelSelection;
|
|
208
|
+
/**
|
|
209
|
+
* M21 — optional separate model for the STRUCTURING step. When set, `model` first produces a
|
|
210
|
+
* free-text reasoned answer to the prompt (phase 1), then `structuringModel` extracts the
|
|
211
|
+
* schema-matched object by calling the `output` tool over that answer (phase 2). Lets a large
|
|
212
|
+
* model reason while a cheap fast model does the extraction. Absent ⇒ today's single-model flow.
|
|
213
|
+
*/
|
|
214
|
+
structuringModel?: ModelSelection;
|
|
208
215
|
/** API key. Falls back to env (THEOKIT_API_KEY etc). */
|
|
209
216
|
apiKey?: string;
|
|
210
217
|
/** Local runtime config (cwd, sandbox). Required to keep the transient agent local-only. */
|
|
@@ -1484,6 +1491,15 @@ interface PermissionPluginOptions {
|
|
|
1484
1491
|
*/
|
|
1485
1492
|
declare function createPermissionPlugin(engine: PermissionEngine, opts?: PermissionPluginOptions): Plugin;
|
|
1486
1493
|
|
|
1494
|
+
/** The internal JSON-Schema shape the synthetic `output` tool consumes. */
|
|
1495
|
+
type NormalizedJsonSchema = Record<string, unknown>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Normalize any supported schema to the internal JSON Schema. Async because the Valibot path
|
|
1498
|
+
* dynamically imports its optional converter. Throws a clear, typed-message error for an unsupported
|
|
1499
|
+
* schema or a missing Valibot peer (error-handling.md).
|
|
1500
|
+
*/
|
|
1501
|
+
declare function normalizeSchema(schema: unknown): Promise<NormalizedJsonSchema>;
|
|
1502
|
+
|
|
1487
1503
|
/**
|
|
1488
1504
|
* Public security namespace (T2.1, ADR D68).
|
|
1489
1505
|
*
|
|
@@ -2214,4 +2230,4 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
|
|
|
2214
2230
|
model?: string;
|
|
2215
2231
|
}): ShareGptTrajectory | null;
|
|
2216
2232
|
|
|
2217
|
-
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, type JobQueueOptions, 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 SessionScope, 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, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
|
|
2233
|
+
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, type JobQueueOptions, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, type NormalizedJsonSchema, 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 SessionScope, 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, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
|
package/dist/index.js
CHANGED
|
@@ -3810,6 +3810,24 @@ function salvagePartial(schema, raw) {
|
|
|
3810
3810
|
}
|
|
3811
3811
|
return out;
|
|
3812
3812
|
}
|
|
3813
|
+
async function runReasoningPhase(options, deps) {
|
|
3814
|
+
const reasoningOptions = {
|
|
3815
|
+
model: options.model,
|
|
3816
|
+
local: options.local,
|
|
3817
|
+
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
3818
|
+
...options.apiKey !== void 0 ? { apiKey: options.apiKey } : {},
|
|
3819
|
+
...options.providers !== void 0 ? { providers: options.providers } : {}
|
|
3820
|
+
};
|
|
3821
|
+
const reasoningAgent = await deps.create(reasoningOptions);
|
|
3822
|
+
try {
|
|
3823
|
+
const run = await reasoningAgent.send(options.prompt);
|
|
3824
|
+
const result = await run.wait();
|
|
3825
|
+
const text = result.result;
|
|
3826
|
+
return typeof text === "string" ? text : options.prompt;
|
|
3827
|
+
} finally {
|
|
3828
|
+
await disposeAndDeleteTransient(reasoningAgent, deps.delete);
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3813
3831
|
async function generateObjectImpl(options, deps) {
|
|
3814
3832
|
const { jsonSchema, maxRetries, initialUsage } = setupStructuredOutput(
|
|
3815
3833
|
options.schema,
|
|
@@ -3832,8 +3850,11 @@ async function generateObjectImpl(options, deps) {
|
|
|
3832
3850
|
}
|
|
3833
3851
|
throw new CaptureSentinel(input);
|
|
3834
3852
|
});
|
|
3853
|
+
const reasoningText = options.structuringModel !== void 0 ? await runReasoningPhase(options, deps) : void 0;
|
|
3854
|
+
const structuringModel = options.structuringModel ?? options.model;
|
|
3855
|
+
const structuringPrompt = reasoningText ?? options.prompt;
|
|
3835
3856
|
const agentOptions = buildTransientAgentOptions({
|
|
3836
|
-
model:
|
|
3857
|
+
model: structuringModel,
|
|
3837
3858
|
local: options.local,
|
|
3838
3859
|
outputTool,
|
|
3839
3860
|
...options.systemPrompt !== void 0 ? { systemPrompt: options.systemPrompt } : {},
|
|
@@ -3842,7 +3863,7 @@ async function generateObjectImpl(options, deps) {
|
|
|
3842
3863
|
});
|
|
3843
3864
|
const agent = await deps.create(agentOptions);
|
|
3844
3865
|
try {
|
|
3845
|
-
const userMessage = buildToolPrompt(
|
|
3866
|
+
const userMessage = buildToolPrompt(structuringPrompt);
|
|
3846
3867
|
let lastParseError;
|
|
3847
3868
|
for (let attempt = 0; attempt <= maxRetries; attempt += 1) {
|
|
3848
3869
|
capturedRaw = void 0;
|
|
@@ -10800,23 +10821,27 @@ function tryParseSkill(raw, fallbackName, source, options) {
|
|
|
10800
10821
|
|
|
10801
10822
|
// src/internal/runtime/skills/skills-manager.ts
|
|
10802
10823
|
var SkillsManager = class {
|
|
10803
|
-
constructor(cwd, _enabled, settingSourcesIncludeProject) {
|
|
10824
|
+
constructor(cwd, _enabled, settingSourcesIncludeProject, skillsDir, inline) {
|
|
10804
10825
|
this.cwd = cwd;
|
|
10805
10826
|
this.settingSourcesIncludeProject = settingSourcesIncludeProject;
|
|
10827
|
+
this.skillsDir = skillsDir;
|
|
10828
|
+
this.inline = inline;
|
|
10806
10829
|
}
|
|
10807
10830
|
cwd;
|
|
10808
10831
|
settingSourcesIncludeProject;
|
|
10832
|
+
skillsDir;
|
|
10833
|
+
inline;
|
|
10809
10834
|
skills = [];
|
|
10810
10835
|
async initialize() {
|
|
10811
10836
|
if (!this.settingSourcesIncludeProject) {
|
|
10812
|
-
this.skills = [];
|
|
10837
|
+
this.skills = this.mergeInline([]);
|
|
10813
10838
|
return;
|
|
10814
10839
|
}
|
|
10815
10840
|
await this.refresh();
|
|
10816
10841
|
}
|
|
10817
10842
|
async refresh() {
|
|
10818
|
-
const skillsRoot = join(this.cwd, ".theokit", "skills");
|
|
10819
|
-
|
|
10843
|
+
const skillsRoot = this.skillsDir ?? join(this.cwd, ".theokit", "skills");
|
|
10844
|
+
const discovered = await discoverSkills(skillsRoot, {
|
|
10820
10845
|
onInvalidSkill: (info) => {
|
|
10821
10846
|
process.stderr.write(
|
|
10822
10847
|
`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
|
|
@@ -10824,6 +10849,13 @@ var SkillsManager = class {
|
|
|
10824
10849
|
);
|
|
10825
10850
|
}
|
|
10826
10851
|
});
|
|
10852
|
+
this.skills = this.mergeInline(discovered);
|
|
10853
|
+
}
|
|
10854
|
+
/** M22 — merge inline skills over discovered ones; inline wins on a name conflict. */
|
|
10855
|
+
mergeInline(discovered) {
|
|
10856
|
+
if (this.inline === void 0 || this.inline.length === 0) return discovered;
|
|
10857
|
+
const inlineNames = new Set(this.inline.map((s) => s.name));
|
|
10858
|
+
return [...discovered.filter((s) => !inlineNames.has(s.name)), ...this.inline];
|
|
10827
10859
|
}
|
|
10828
10860
|
list() {
|
|
10829
10861
|
return Promise.resolve(this.skills);
|
|
@@ -10868,7 +10900,10 @@ function bootstrapSubmanagers(args) {
|
|
|
10868
10900
|
out.skillsManager = new SkillsManager(
|
|
10869
10901
|
args.workspaceCwd,
|
|
10870
10902
|
args.options.skills?.enabled,
|
|
10871
|
-
args.settingSourcesIncludeProject
|
|
10903
|
+
args.settingSourcesIncludeProject,
|
|
10904
|
+
// M22 — custom skills directory + inline (code-defined) skills.
|
|
10905
|
+
args.options.skills?.skillsDir,
|
|
10906
|
+
args.options.skills?.inline
|
|
10872
10907
|
);
|
|
10873
10908
|
const localSkills = out.skillsManager;
|
|
10874
10909
|
out.skills = { list: () => localSkills.list() };
|
|
@@ -18770,6 +18805,20 @@ var Budget = class {
|
|
|
18770
18805
|
}
|
|
18771
18806
|
};
|
|
18772
18807
|
|
|
18808
|
+
// src/create-skill.ts
|
|
18809
|
+
function createSkill(spec) {
|
|
18810
|
+
if (!spec.name) throw new Error("createSkill: `name` is required.");
|
|
18811
|
+
if (!spec.description) throw new Error("createSkill: `description` is required.");
|
|
18812
|
+
return {
|
|
18813
|
+
name: spec.name,
|
|
18814
|
+
description: spec.description,
|
|
18815
|
+
source: `inline://${spec.name}`,
|
|
18816
|
+
instructions: spec.instructions,
|
|
18817
|
+
...spec.category !== void 0 ? { category: spec.category } : {},
|
|
18818
|
+
...spec.dependencies !== void 0 ? { dependencies: spec.dependencies } : {}
|
|
18819
|
+
};
|
|
18820
|
+
}
|
|
18821
|
+
|
|
18773
18822
|
// src/cron.ts
|
|
18774
18823
|
init_errors();
|
|
18775
18824
|
|
|
@@ -20124,6 +20173,53 @@ function createPermissionPlugin(engine, opts = {}) {
|
|
|
20124
20173
|
});
|
|
20125
20174
|
}
|
|
20126
20175
|
|
|
20176
|
+
// src/schema-normalizer.ts
|
|
20177
|
+
init_to_json_schema();
|
|
20178
|
+
function isJsonSchemaObject(s) {
|
|
20179
|
+
if (typeof s !== "object" || s === null) return false;
|
|
20180
|
+
const o = s;
|
|
20181
|
+
if ("$schema" in o) return true;
|
|
20182
|
+
return o.type === "object" && typeof o.properties === "object" && o.properties !== null;
|
|
20183
|
+
}
|
|
20184
|
+
function hasToJsonSchemaMethod(s) {
|
|
20185
|
+
return typeof s === "object" && s !== null && typeof s.toJsonSchema === "function";
|
|
20186
|
+
}
|
|
20187
|
+
function isZodSchema(s) {
|
|
20188
|
+
if (typeof s !== "object" || s === null) return false;
|
|
20189
|
+
const o = s;
|
|
20190
|
+
return typeof o.safeParse === "function" && ("_def" in o || "def" in o);
|
|
20191
|
+
}
|
|
20192
|
+
function isValibotSchema(s) {
|
|
20193
|
+
if (typeof s !== "object" || s === null) return false;
|
|
20194
|
+
const o = s;
|
|
20195
|
+
return o.kind === "schema" && "type" in o && typeof o.toJsonSchema !== "function";
|
|
20196
|
+
}
|
|
20197
|
+
async function normalizeSchema(schema) {
|
|
20198
|
+
if (isJsonSchemaObject(schema)) return schema;
|
|
20199
|
+
if (isValibotSchema(schema)) {
|
|
20200
|
+
const specifier = "@valibot/to-json-schema";
|
|
20201
|
+
try {
|
|
20202
|
+
const mod = await import(specifier);
|
|
20203
|
+
return mod.toJsonSchema(schema);
|
|
20204
|
+
} catch (err) {
|
|
20205
|
+
const missing = err instanceof Error && /Cannot find|Cannot resolve|ERR_MODULE_NOT_FOUND/.test(err.message);
|
|
20206
|
+
if (missing) {
|
|
20207
|
+
throw new Error(
|
|
20208
|
+
"normalizeSchema: a Valibot schema requires the optional '@valibot/to-json-schema' package. Install it, or use a Zod schema (the default recommendation)."
|
|
20209
|
+
);
|
|
20210
|
+
}
|
|
20211
|
+
throw err;
|
|
20212
|
+
}
|
|
20213
|
+
}
|
|
20214
|
+
if (isZodSchema(schema)) {
|
|
20215
|
+
return toJsonSchema(schema, { unrepresentable: "any" });
|
|
20216
|
+
}
|
|
20217
|
+
if (hasToJsonSchemaMethod(schema)) return schema.toJsonSchema();
|
|
20218
|
+
throw new Error(
|
|
20219
|
+
"normalizeSchema: unsupported schema. Supported: Zod (default), JSON Schema, ArkType (.toJsonSchema()), Valibot (with @valibot/to-json-schema)."
|
|
20220
|
+
);
|
|
20221
|
+
}
|
|
20222
|
+
|
|
20127
20223
|
// src/security.ts
|
|
20128
20224
|
init_security();
|
|
20129
20225
|
var Security = class {
|
|
@@ -20901,6 +20997,6 @@ function safeStringify2(v) {
|
|
|
20901
20997
|
}
|
|
20902
20998
|
}
|
|
20903
20999
|
|
|
20904
|
-
export { Agent, AgentBuilder, AgentDisposedError, AgentRunError, AuthenticationError, Budget, BudgetExceededError, ConfigurationError, Cron, EventBus, FileSystemConversationStorage, GenerateObjectError, InMemoryConversationStorage, IntegrationNotConnectedError, InvalidTaskIdError, JobQueue, Memory, MemoryAdapterError, NetworkError, PermissionEngine, RateLimitError, Security, StreamObjectError, Task, TaskNotFoundError, Theokit, TheokitAgentError, UnknownAgentError, UnsupportedBudgetOperationError, UnsupportedRunOperationError, UnsupportedTaskOperationError, UsageAccumulator, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSquad, definePlugin, defineProvider, defineTool, extractRawId, getPricingEntry, inferApiMode, isTransientError, migrateSqliteToLance2 as migrateSqliteToLance, mkMemoryId, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
|
|
21000
|
+
export { Agent, AgentBuilder, AgentDisposedError, AgentRunError, AuthenticationError, Budget, BudgetExceededError, ConfigurationError, Cron, EventBus, FileSystemConversationStorage, GenerateObjectError, InMemoryConversationStorage, IntegrationNotConnectedError, InvalidTaskIdError, JobQueue, Memory, MemoryAdapterError, NetworkError, PermissionEngine, RateLimitError, Security, StreamObjectError, Task, TaskNotFoundError, Theokit, TheokitAgentError, UnknownAgentError, UnsupportedBudgetOperationError, UnsupportedRunOperationError, UnsupportedTaskOperationError, UsageAccumulator, buildReplayHistory, chargeAndCheckThresholds, computeCost, createAgentFactory, createCounterBudgetTracker, createNoopMemoryProvider, createPermissionPlugin, createSkill, createSquad, definePlugin, defineProvider, defineTool, extractRawId, getPricingEntry, inferApiMode, isTransientError, migrateSqliteToLance2 as migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, preflightCheck, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, withCwdMutex };
|
|
20905
21001
|
//# sourceMappingURL=index.js.map
|
|
20906
21002
|
//# sourceMappingURL=index.js.map
|