@theokit/sdk 5.3.3 → 5.5.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.
Files changed (87) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/dist/{agent-CTbU0O1R.d.ts → agent-CjMVbhhY.d.ts} +95 -2
  3. package/dist/{agent-QLwxhXY3.d.cts → agent-DyB_lzrx.d.cts} +95 -2
  4. package/dist/{agent-PNYJ5S2Y.js → agent-G3T7Q3SQ.js} +8 -8
  5. package/dist/{agent-PNYJ5S2Y.js.map → agent-G3T7Q3SQ.js.map} +1 -1
  6. package/dist/{agent-KJLAWKZB.cjs → agent-YWSIHHFM.cjs} +9 -9
  7. package/dist/{agent-KJLAWKZB.cjs.map → agent-YWSIHHFM.cjs.map} +1 -1
  8. package/dist/{chunk-AWINL3ZC.js → chunk-2QKV4CGK.js} +3 -3
  9. package/dist/{chunk-AWINL3ZC.js.map → chunk-2QKV4CGK.js.map} +1 -1
  10. package/dist/{chunk-L4XENLQO.cjs → chunk-2ZLQZHZC.cjs} +4 -4
  11. package/dist/{chunk-L4XENLQO.cjs.map → chunk-2ZLQZHZC.cjs.map} +1 -1
  12. package/dist/{chunk-DWB3CN46.cjs → chunk-43YXGD3P.cjs} +14 -4
  13. package/dist/chunk-43YXGD3P.cjs.map +1 -0
  14. package/dist/{chunk-IQBDR5YZ.cjs → chunk-AYA65JA5.cjs} +5 -5
  15. package/dist/{chunk-IQBDR5YZ.cjs.map → chunk-AYA65JA5.cjs.map} +1 -1
  16. package/dist/{chunk-2HPNT6HH.cjs → chunk-C4ZQPWXJ.cjs} +9 -9
  17. package/dist/chunk-C4ZQPWXJ.cjs.map +1 -0
  18. package/dist/{chunk-Y2KYR2ED.cjs → chunk-DZG77WU7.cjs} +3 -3
  19. package/dist/{chunk-Y2KYR2ED.cjs.map → chunk-DZG77WU7.cjs.map} +1 -1
  20. package/dist/{chunk-K3NH62DG.js → chunk-KZSKIUXZ.js} +7 -7
  21. package/dist/chunk-KZSKIUXZ.js.map +1 -0
  22. package/dist/{chunk-ZITYGJOD.js → chunk-M3ZGRGOG.js} +3 -3
  23. package/dist/{chunk-ZITYGJOD.js.map → chunk-M3ZGRGOG.js.map} +1 -1
  24. package/dist/{chunk-RP3VXJMA.js → chunk-NSLHPAC7.js} +14 -4
  25. package/dist/chunk-NSLHPAC7.js.map +1 -0
  26. package/dist/{chunk-DLFWMJE3.js → chunk-O7L7M42F.js} +3 -3
  27. package/dist/{chunk-DLFWMJE3.js.map → chunk-O7L7M42F.js.map} +1 -1
  28. package/dist/{chunk-363RBGIR.js → chunk-ODBID5TG.js} +63 -27
  29. package/dist/chunk-ODBID5TG.js.map +1 -0
  30. package/dist/{chunk-7L3MIW2F.js → chunk-S6B5XYC3.js} +4 -4
  31. package/dist/chunk-S6B5XYC3.js.map +1 -0
  32. package/dist/{chunk-Y46VI73J.cjs → chunk-UKJJRU7C.cjs} +132 -96
  33. package/dist/chunk-UKJJRU7C.cjs.map +1 -0
  34. package/dist/{chunk-65UMH5V3.cjs → chunk-VY6NKMOA.cjs} +6 -6
  35. package/dist/chunk-VY6NKMOA.cjs.map +1 -0
  36. package/dist/{compact-session-BHTPCIHA.cjs → compact-session-7FMYJXQ7.cjs} +11 -11
  37. package/dist/{compact-session-BHTPCIHA.cjs.map → compact-session-7FMYJXQ7.cjs.map} +1 -1
  38. package/dist/{compact-session-W4WLJTHA.js → compact-session-YSEK7NQF.js} +3 -3
  39. package/dist/{compact-session-W4WLJTHA.js.map → compact-session-YSEK7NQF.js.map} +1 -1
  40. package/dist/context-3HPU754C.js +6 -0
  41. package/dist/{context-BUIE52VH.js.map → context-3HPU754C.js.map} +1 -1
  42. package/dist/{context-FCCJQ3FN.cjs → context-JTGSBJT6.cjs} +7 -7
  43. package/dist/{context-FCCJQ3FN.cjs.map → context-JTGSBJT6.cjs.map} +1 -1
  44. package/dist/{cron-Dz8AOpy3.d.cts → cron-Bgivg88c.d.cts} +1 -1
  45. package/dist/{cron-Cl8FrK3D.d.ts → cron-CNUa7PDo.d.ts} +1 -1
  46. package/dist/cron.cjs +8 -8
  47. package/dist/cron.d.cts +2 -2
  48. package/dist/cron.d.ts +2 -2
  49. package/dist/cron.js +7 -7
  50. package/dist/eval.cjs +7 -7
  51. package/dist/eval.js +6 -6
  52. package/dist/index.cjs +30 -30
  53. package/dist/index.d.cts +3 -3
  54. package/dist/index.d.ts +3 -3
  55. package/dist/index.js +9 -9
  56. package/dist/{inject-session-SUM6TDJF.js → inject-session-J4LBWAPH.js} +3 -3
  57. package/dist/{inject-session-SUM6TDJF.js.map → inject-session-J4LBWAPH.js.map} +1 -1
  58. package/dist/{inject-session-W6A46J3E.cjs → inject-session-PC73TMP2.cjs} +4 -4
  59. package/dist/{inject-session-W6A46J3E.cjs.map → inject-session-PC73TMP2.cjs.map} +1 -1
  60. package/dist/internal/llm/tool-result-content.d.ts +1 -1
  61. package/dist/internal/persistence/index.cjs +4 -4
  62. package/dist/internal/persistence/index.js +1 -1
  63. package/dist/internal/runtime/hooks/hooks-executor.d.ts +35 -1
  64. package/dist/internal/runtime/hooks/hooks-source.d.ts +10 -0
  65. package/dist/subagents-loader-AIVDQ2D5.js +7 -0
  66. package/dist/{subagents-loader-PAZVOZHI.js.map → subagents-loader-AIVDQ2D5.js.map} +1 -1
  67. package/dist/subagents-loader-DN4LETGL.cjs +16 -0
  68. package/dist/{subagents-loader-7G76XOZU.cjs.map → subagents-loader-DN4LETGL.cjs.map} +1 -1
  69. package/dist/subagents-loader.cjs +3 -3
  70. package/dist/subagents-loader.d.cts +1 -1
  71. package/dist/subagents-loader.d.ts +1 -1
  72. package/dist/subagents-loader.js +2 -2
  73. package/dist/types/agent.d.ts +25 -2
  74. package/dist/types/hooks.d.ts +70 -0
  75. package/docs/error-codes.md +4 -4
  76. package/package.json +1 -1
  77. package/dist/chunk-2HPNT6HH.cjs.map +0 -1
  78. package/dist/chunk-363RBGIR.js.map +0 -1
  79. package/dist/chunk-65UMH5V3.cjs.map +0 -1
  80. package/dist/chunk-7L3MIW2F.js.map +0 -1
  81. package/dist/chunk-DWB3CN46.cjs.map +0 -1
  82. package/dist/chunk-K3NH62DG.js.map +0 -1
  83. package/dist/chunk-RP3VXJMA.js.map +0 -1
  84. package/dist/chunk-Y46VI73J.cjs.map +0 -1
  85. package/dist/context-BUIE52VH.js +0 -6
  86. package/dist/subagents-loader-7G76XOZU.cjs +0 -16
  87. package/dist/subagents-loader-PAZVOZHI.js +0 -7
package/dist/index.d.cts CHANGED
@@ -2,15 +2,15 @@ import { T as TheokitAgentError, E as ErrorMetadata } from './errors-base-B5g01n
2
2
  export { a as ErrorCode } from './errors-base-B5g01neU.cjs';
3
3
  import { F as RunEvent, j as CostBreakdown, at as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as RunEventSink$1, S as SDKMessage } from './run-CTAdRU3U.cjs';
4
4
  export { A as AgentConversationTurn, e as AssistantMessage, f as CompletionCheck, g as CompletionCheckResult, h as ConversationStep, i as ConversationTurn, j as CostBreakdown, k as CostSource, l as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, m as GenerateRunResult, I as ImageBlock, n as InputProcessorContext, o as InteractionUpdate, p as McpAuthConfig, q as McpHttpServerConfig, r as McpOAuthConfig, s as McpStdioServerConfig, t as MessageOrigin, u as ModelParameterValue, O as OutputProcessorContext, v as PartialToolCallUpdate, w as ProcessorControls, x as ProcessorTripwire, y as ProcessorViolation, z as RunCompactBoundaryEvent, B as RunCompletionCheckEvent, E as RunErrorDetail, F as RunEvent, H as RunGitInfo, J as RunMemoryDegradedEvent, K as RunOperation, L as RunPermissionDeniedEvent, N as RunRateLimitEvent, Q as RunStatus, U as RunTaskCompletedEvent, V as RunTaskStartedEvent, W as RunTaskUpdatedEvent, X as RunTimelineEvent, Y as RunToCompletionOptions, Z as RunToCompletionResult, _ as RunToolProgressEvent, $ as RunTripwireEvent, a0 as SDKAssistantMessage, a1 as SDKImage, a2 as SDKImageDimension, a3 as SDKObjectDelta, a4 as SDKRequestMessage, a5 as SDKStatusMessage, a6 as SDKSystemMessage, a7 as SDKTaskMessage, a8 as SDKThinkingMessage, a9 as SDKToolUseMessage, aa as SDKUserMessage, ab as SDKUserMessageEvent, ac as SendOptions, ad as ShellCommand, ae as ShellConversationTurn, af as ShellOutput, ag as ShellOutputDeltaUpdate, ah as StepCompletedUpdate, ai as StepStartedUpdate, aj as StreamToCompletionResult, ak as SummaryCompletedUpdate, al as SummaryStartedUpdate, am as SummaryUpdate, an as TextBlock, ao as TextDeltaUpdate, ap as ThinkingCompletedUpdate, aq as ThinkingDeltaUpdate, ar as ThinkingMessage, as as TokenDeltaUpdate, at as TokenUsage, au as ToolCall, av as ToolCallCompletedUpdate, aw as ToolCallStartedUpdate, ax as ToolContextMessage, ay as ToolResult, az as ToolResultGuardOptions, aA as ToolUseBlock, aB as TurnEndedUpdate, aC as UserMessage, aD as UserMessageAppendedUpdate } from './run-CTAdRU3U.cjs';
5
- import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-QLwxhXY3.cjs';
6
- export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-QLwxhXY3.cjs';
5
+ import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-DyB_lzrx.cjs';
6
+ export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-DyB_lzrx.cjs';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
9
  import { S as StructuredOutputError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-DrDEgyz1.cjs';
10
10
  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, I as IntegrationNotConnectedError, m as InvalidTaskIdError, M as MemoryAdapterError, n as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, T as TaskNotFoundError, U as UnknownAgentError, o as UnsupportedBudgetOperationError, p as UnsupportedRunOperationError, q as UnsupportedTaskOperationError, r as isTransientError } from './errors-DrDEgyz1.cjs';
11
11
  import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-BOiKqOgL.cjs';
12
12
  export { A as AgentMemory, e as AgentOperation, f as ContextBudget, g as ContextManagerKind, h as ContextSnapshot, i as ContextSource, j as ContextSourceStatus, I as InvalidateCacheOptions, k as MemoryAdapter, l as MemoryAdapterCapabilities, m as MemoryContext, n as MemoryFact, o as MemoryRevision, p as MemoryToolSchema, q as MemoryTurnMessage, r as PersonalityPreset, s as ProviderCapability, t as ProviderRoute, R as ResolvedProviderRoute, u as RunUntilIterator, v as SDKAgentPlugins, w as SDKAgentSkillDetail, x as SDKAgentSkills, y as SDKArtifact, z as SDKContextManager, B as SDKPluginMetadata, D as SDKProvidersManager, E as SystemPromptSkillRef, V as Verdict } from './sdk-agent-BOiKqOgL.cjs';
13
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-Dz8AOpy3.cjs';
13
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-Bgivg88c.cjs';
14
14
  import { StepResult } from './workflow.cjs';
15
15
  export { Workflow, agentStep, fn } from './workflow.cjs';
16
16
 
package/dist/index.d.ts CHANGED
@@ -2,15 +2,15 @@ import { T as TheokitAgentError, E as ErrorMetadata } from './errors-base-B5g01n
2
2
  export { a as ErrorCode } from './errors-base-B5g01neU.js';
3
3
  import { F as RunEvent, j as CostBreakdown, at as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as RunEventSink$1, S as SDKMessage } from './run-CTAdRU3U.js';
4
4
  export { A as AgentConversationTurn, e as AssistantMessage, f as CompletionCheck, g as CompletionCheckResult, h as ConversationStep, i as ConversationTurn, j as CostBreakdown, k as CostSource, l as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, m as GenerateRunResult, I as ImageBlock, n as InputProcessorContext, o as InteractionUpdate, p as McpAuthConfig, q as McpHttpServerConfig, r as McpOAuthConfig, s as McpStdioServerConfig, t as MessageOrigin, u as ModelParameterValue, O as OutputProcessorContext, v as PartialToolCallUpdate, w as ProcessorControls, x as ProcessorTripwire, y as ProcessorViolation, z as RunCompactBoundaryEvent, B as RunCompletionCheckEvent, E as RunErrorDetail, F as RunEvent, H as RunGitInfo, J as RunMemoryDegradedEvent, K as RunOperation, L as RunPermissionDeniedEvent, N as RunRateLimitEvent, Q as RunStatus, U as RunTaskCompletedEvent, V as RunTaskStartedEvent, W as RunTaskUpdatedEvent, X as RunTimelineEvent, Y as RunToCompletionOptions, Z as RunToCompletionResult, _ as RunToolProgressEvent, $ as RunTripwireEvent, a0 as SDKAssistantMessage, a1 as SDKImage, a2 as SDKImageDimension, a3 as SDKObjectDelta, a4 as SDKRequestMessage, a5 as SDKStatusMessage, a6 as SDKSystemMessage, a7 as SDKTaskMessage, a8 as SDKThinkingMessage, a9 as SDKToolUseMessage, aa as SDKUserMessage, ab as SDKUserMessageEvent, ac as SendOptions, ad as ShellCommand, ae as ShellConversationTurn, af as ShellOutput, ag as ShellOutputDeltaUpdate, ah as StepCompletedUpdate, ai as StepStartedUpdate, aj as StreamToCompletionResult, ak as SummaryCompletedUpdate, al as SummaryStartedUpdate, am as SummaryUpdate, an as TextBlock, ao as TextDeltaUpdate, ap as ThinkingCompletedUpdate, aq as ThinkingDeltaUpdate, ar as ThinkingMessage, as as TokenDeltaUpdate, at as TokenUsage, au as ToolCall, av as ToolCallCompletedUpdate, aw as ToolCallStartedUpdate, ax as ToolContextMessage, ay as ToolResult, az as ToolResultGuardOptions, aA as ToolUseBlock, aB as TurnEndedUpdate, aC as UserMessage, aD as UserMessageAppendedUpdate } from './run-CTAdRU3U.js';
5
- import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-CTbU0O1R.js';
6
- export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-CTbU0O1R.js';
5
+ import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-CjMVbhhY.js';
6
+ export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-CjMVbhhY.js';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
9
  import { S as StructuredOutputError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-CLOAyuiv.js';
10
10
  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, I as IntegrationNotConnectedError, m as InvalidTaskIdError, M as MemoryAdapterError, n as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, T as TaskNotFoundError, U as UnknownAgentError, o as UnsupportedBudgetOperationError, p as UnsupportedRunOperationError, q as UnsupportedTaskOperationError, r as isTransientError } from './errors-CLOAyuiv.js';
11
11
  import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-D4a_BR_6.js';
12
12
  export { A as AgentMemory, e as AgentOperation, f as ContextBudget, g as ContextManagerKind, h as ContextSnapshot, i as ContextSource, j as ContextSourceStatus, I as InvalidateCacheOptions, k as MemoryAdapter, l as MemoryAdapterCapabilities, m as MemoryContext, n as MemoryFact, o as MemoryRevision, p as MemoryToolSchema, q as MemoryTurnMessage, r as PersonalityPreset, s as ProviderCapability, t as ProviderRoute, R as ResolvedProviderRoute, u as RunUntilIterator, v as SDKAgentPlugins, w as SDKAgentSkillDetail, x as SDKAgentSkills, y as SDKArtifact, z as SDKContextManager, B as SDKPluginMetadata, D as SDKProvidersManager, E as SystemPromptSkillRef, V as Verdict } from './sdk-agent-D4a_BR_6.js';
13
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-Cl8FrK3D.js';
13
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-CNUa7PDo.js';
14
14
  import { StepResult } from './workflow.js';
15
15
  export { Workflow, agentStep, fn } from './workflow.js';
16
16
 
package/dist/index.js CHANGED
@@ -8,22 +8,22 @@ import { Workflow, agentStep } from './chunk-HFEJE7AC.js';
8
8
  export { Workflow, agentStep, fn } from './chunk-HFEJE7AC.js';
9
9
  import './chunk-GBCVPKHE.js';
10
10
  import './chunk-HY66GLM6.js';
11
- export { Cron } from './chunk-ZITYGJOD.js';
12
- import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-363RBGIR.js';
13
- export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-363RBGIR.js';
11
+ export { Cron } from './chunk-M3ZGRGOG.js';
12
+ import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-ODBID5TG.js';
13
+ export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-ODBID5TG.js';
14
14
  import { configure, submit, list, get, cancel, subscribe } from './chunk-K2VMFZQ5.js';
15
15
  export { emitRunEvent } from './chunk-K2VMFZQ5.js';
16
- import './chunk-AWINL3ZC.js';
16
+ import './chunk-2QKV4CGK.js';
17
17
  import './chunk-K2BQQ445.js';
18
18
  import './chunk-7SZAV6QG.js';
19
- import './chunk-7L3MIW2F.js';
19
+ import './chunk-S6B5XYC3.js';
20
20
  import './chunk-2SFBB54R.js';
21
21
  import './chunk-55GB6JYQ.js';
22
22
  import './chunk-H73MEMQB.js';
23
23
  import './chunk-OR6XIWLB.js';
24
24
  import { resolveMemoryRoot, readFactsFromMarkdown } from './chunk-SADXXGWU.js';
25
25
  import { FsSessionStore } from './chunk-AAEZSPTC.js';
26
- import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-K3NH62DG.js';
26
+ import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-KZSKIUXZ.js';
27
27
  import './chunk-UBR5PWD7.js';
28
28
  import './chunk-2XC6KDJM.js';
29
29
  import './chunk-XB4GI5RZ.js';
@@ -55,8 +55,8 @@ import { withCwdMutex } from './chunk-Q5EWJPRY.js';
55
55
  export { withCwdMutex } from './chunk-Q5EWJPRY.js';
56
56
  export { TASK_RESERVED_PREFIXES, isValidTaskId } from './chunk-EIQFAOFD.js';
57
57
  import { replaceFileAtomic } from './chunk-3JHIFQ4I.js';
58
- import './chunk-DLFWMJE3.js';
59
- import './chunk-RP3VXJMA.js';
58
+ import './chunk-O7L7M42F.js';
59
+ import './chunk-NSLHPAC7.js';
60
60
  import './chunk-JNAA4G4H.js';
61
61
  import { estimateTokens, CHARS_PER_TOKEN } from './chunk-6M2OIS4Y.js';
62
62
  export { estimateTokens } from './chunk-6M2OIS4Y.js';
@@ -1792,7 +1792,7 @@ function isBuiltAgent(m) {
1792
1792
  return typeof m.send === "function";
1793
1793
  }
1794
1794
  async function materialize(def, index) {
1795
- const { Agent: Agent2 } = await import('./agent-PNYJ5S2Y.js');
1795
+ const { Agent: Agent2 } = await import('./agent-G3T7Q3SQ.js');
1796
1796
  return Agent2.create({
1797
1797
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1798
1798
  // here means "declare nothing and let the default apply" — forwarding the literal would create
@@ -1,4 +1,4 @@
1
- import { enqueueSessionWrite } from './chunk-AWINL3ZC.js';
1
+ import { enqueueSessionWrite } from './chunk-2QKV4CGK.js';
2
2
  import { invalidateSessionCache } from './chunk-2XC6KDJM.js';
3
3
  import './chunk-2WXHA33T.js';
4
4
  import { SessionTranscript } from './chunk-JOFVLOFY.js';
@@ -23,5 +23,5 @@ async function injectSessionTurn(opts) {
23
23
  }
24
24
 
25
25
  export { injectSessionTurn };
26
- //# sourceMappingURL=inject-session-SUM6TDJF.js.map
27
- //# sourceMappingURL=inject-session-SUM6TDJF.js.map
26
+ //# sourceMappingURL=inject-session-J4LBWAPH.js.map
27
+ //# sourceMappingURL=inject-session-J4LBWAPH.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-SUM6TDJF.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-J4LBWAPH.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkY2KYR2ED_cjs = require('./chunk-Y2KYR2ED.cjs');
3
+ var chunkDZG77WU7_cjs = require('./chunk-DZG77WU7.cjs');
4
4
  var chunkYJNYDJ2T_cjs = require('./chunk-YJNYDJ2T.cjs');
5
5
  require('./chunk-YIFFF23U.cjs');
6
6
  var chunkGZV6AVRL_cjs = require('./chunk-GZV6AVRL.cjs');
@@ -10,7 +10,7 @@ require('./chunk-6LHQPOMI.cjs');
10
10
 
11
11
  // src/internal/session/inject-session.ts
12
12
  async function injectSessionTurn(opts) {
13
- await chunkY2KYR2ED_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
13
+ await chunkDZG77WU7_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
14
14
  const prior = await opts.store.readRecords(opts.loc.agentId);
15
15
  const transcript = chunkGZV6AVRL_cjs.SessionTranscript.fromRecords(prior, {
16
16
  cwd: opts.loc.cwd,
@@ -25,5 +25,5 @@ async function injectSessionTurn(opts) {
25
25
  }
26
26
 
27
27
  exports.injectSessionTurn = injectSessionTurn;
28
- //# sourceMappingURL=inject-session-W6A46J3E.cjs.map
29
- //# sourceMappingURL=inject-session-W6A46J3E.cjs.map
28
+ //# sourceMappingURL=inject-session-PC73TMP2.cjs.map
29
+ //# sourceMappingURL=inject-session-PC73TMP2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-W6A46J3E.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-PC73TMP2.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
@@ -31,7 +31,7 @@ export declare function toBlockToolResultContent(content: string | ToolResultCon
31
31
  * cannot carry an image in a tool result, and silently dropping it would hand
32
32
  * the model a lie (per error-handling policy).
33
33
  */
34
- export declare function toStringToolResultContent(content: string | ToolResultContentBlock[], providerName: string): string;
34
+ export declare function toStringToolResultContent(content: string | ToolResultContentBlock[], providerName: string, toolUseId?: string): string;
35
35
  /**
36
36
  * Apply `fn` to the text of a tool-result content (both the string form and the
37
37
  * text blocks of the structured form); image blocks pass through untouched.
@@ -7,7 +7,7 @@ var chunkDQZU7JK6_cjs = require('../../chunk-DQZU7JK6.cjs');
7
7
  var chunkBJUJT5ED_cjs = require('../../chunk-BJUJT5ED.cjs');
8
8
  var chunkZF2LDKQQ_cjs = require('../../chunk-ZF2LDKQQ.cjs');
9
9
  var chunkJLRLCBJ4_cjs = require('../../chunk-JLRLCBJ4.cjs');
10
- var chunkDWB3CN46_cjs = require('../../chunk-DWB3CN46.cjs');
10
+ var chunk43YXGD3P_cjs = require('../../chunk-43YXGD3P.cjs');
11
11
  require('../../chunk-J7J7J2GN.cjs');
12
12
  require('../../chunk-6LHQPOMI.cjs');
13
13
  var promises = require('fs/promises');
@@ -111,15 +111,15 @@ Object.defineProperty(exports, "replaceFileAtomic", {
111
111
  });
112
112
  Object.defineProperty(exports, "displayTheokitHome", {
113
113
  enumerable: true,
114
- get: function () { return chunkDWB3CN46_cjs.displayTheokitHome; }
114
+ get: function () { return chunk43YXGD3P_cjs.displayTheokitHome; }
115
115
  });
116
116
  Object.defineProperty(exports, "getProfilesRoot", {
117
117
  enumerable: true,
118
- get: function () { return chunkDWB3CN46_cjs.getProfilesRoot; }
118
+ get: function () { return chunk43YXGD3P_cjs.getProfilesRoot; }
119
119
  });
120
120
  Object.defineProperty(exports, "getTheokitHome", {
121
121
  enumerable: true,
122
- get: function () { return chunkDWB3CN46_cjs.getTheokitHome; }
122
+ get: function () { return chunk43YXGD3P_cjs.getTheokitHome; }
123
123
  });
124
124
  exports.casUpdate = casUpdate;
125
125
  exports.createExclusive = createExclusive;
@@ -5,7 +5,7 @@ export { applyWalWithFallback, isCorruptionError, openSqliteResilient } from '..
5
5
  export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds, withFileLock } from '../../chunk-TA3K7SBK.js';
6
6
  export { withCwdMutex } from '../../chunk-Q5EWJPRY.js';
7
7
  export { atomicWriteJson, atomicWriteText, replaceFileAtomic } from '../../chunk-3JHIFQ4I.js';
8
- export { displayTheokitHome, getProfilesRoot, getTheokitHome } from '../../chunk-RP3VXJMA.js';
8
+ export { displayTheokitHome, getProfilesRoot, getTheokitHome } from '../../chunk-NSLHPAC7.js';
9
9
  import '../../chunk-ALUN2B4W.js';
10
10
  import '../../chunk-CZJ6Q7CW.js';
11
11
  import { open } from 'fs/promises';
@@ -1,10 +1,21 @@
1
1
  import type { CompatSourceDeclaration } from "../compat/foreign-config-sources.js";
2
+ import type { HookApprovalGate, HookEvent } from "../../../types/hooks.js";
2
3
  export interface HookCommand {
3
4
  command: string;
4
5
  /** Optional matcher restricting the hook to specific tools (regex). */
5
6
  matcher?: string;
6
7
  /** Optional timeout in ms; defaults to 30s. */
7
8
  timeoutMs?: number;
9
+ /**
10
+ * #637 — the event key as the config file spelled it (`PreToolUse`), for the approval gate.
11
+ *
12
+ * Declared here AND in `hooks-source.ts`, because this interface has two independent copies —
13
+ * the same duplication `types/hooks.ts` records for `HookEvent`. Adding the field to one only
14
+ * would break at the assignment boundary in one direction and pass silently in the other.
15
+ * Consolidating the pair is a separate change with its own blast radius, per the decision
16
+ * recorded at the head of `types/hooks.ts`.
17
+ */
18
+ sourceEvent: string;
8
19
  /**
9
20
  * The config file this command was declared in.
10
21
  *
@@ -37,13 +48,36 @@ export declare class HooksExecutor {
37
48
  private readonly cwd;
38
49
  /** Declared foreign dialects (#524). Empty reads `.theokit/` only. */
39
50
  private readonly compatSources;
51
+ /** #631 — the consumer's chance to refuse a command before it is spawned. */
52
+ private readonly gate;
40
53
  private config;
41
54
  constructor(cwd: string,
42
55
  /** Declared foreign dialects (#524). Empty reads `.theokit/` only. */
43
- compatSources?: readonly CompatSourceDeclaration[]);
56
+ compatSources?: readonly CompatSourceDeclaration[],
57
+ /** #631 — the consumer's chance to refuse a command before it is spawned. */
58
+ gate?: HookApprovalGate | undefined);
44
59
  initialize(settingSourcesIncludeProject: boolean): Promise<void>;
45
60
  /** Fire every hook registered for `event` and aggregate the decisions. */
46
61
  run(payload: HookPayload): Promise<HookExecutionResult>;
47
62
  private commandsFor;
63
+ /**
64
+ * #631 — the consumer's gate, consulted at the ONLY point a hook is spawned.
65
+ *
66
+ * Here and not at the caller on purpose: a check anywhere else could be reached around by a
67
+ * second execution path later, and this one cannot — `spawnAndCollect` is called for a hook from
68
+ * exactly one place.
69
+ *
70
+ * No gate means no refusal, which is what every consumer gets today.
71
+ */
72
+ private refusedByConsumer;
48
73
  private executeOne;
74
+ /**
75
+ * A run that did not succeed, turned into a decision. `undefined` when it did.
76
+ *
77
+ * Extracted from `executeOne` when the approval gate pushed that function past the complexity
78
+ * gate. The seam is not arbitrary — every branch here answers one question, "the command did not
79
+ * run cleanly, so what does this hook decide?", and none of them knows how the command was
80
+ * spawned.
81
+ */
82
+ private decisionFromFailure;
49
83
  }
@@ -20,6 +20,16 @@ export interface HookCommand {
20
20
  command: string;
21
21
  matcher?: string;
22
22
  timeoutMs?: number;
23
+ /**
24
+ * #637 — the event key as written in the config file (`PreToolUse`), carried so the approval
25
+ * gate can report the vocabulary the consumer's stored fingerprint was taken against.
26
+ *
27
+ * REQUIRED, not optional: `parseClaudeCodeCommand` is the only producer of a `HookCommand` in
28
+ * this package, so every command has one. An optional field would hand every reader a fallback
29
+ * branch for a case that cannot occur — and if an in-memory producer is added later, required is
30
+ * what forces it to supply a value instead of inheriting a silent `undefined`.
31
+ */
32
+ sourceEvent: string;
23
33
  /**
24
34
  * The config file this command was declared in.
25
35
  *
@@ -0,0 +1,7 @@
1
+ export { loadSubagents } from './chunk-O7L7M42F.js';
2
+ import './chunk-NSLHPAC7.js';
3
+ import './chunk-JNAA4G4H.js';
4
+ import './chunk-ALUN2B4W.js';
5
+ import './chunk-CZJ6Q7CW.js';
6
+ //# sourceMappingURL=subagents-loader-AIVDQ2D5.js.map
7
+ //# sourceMappingURL=subagents-loader-AIVDQ2D5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-PAZVOZHI.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-AIVDQ2D5.js"}
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var chunkAYA65JA5_cjs = require('./chunk-AYA65JA5.cjs');
4
+ require('./chunk-43YXGD3P.cjs');
5
+ require('./chunk-HW7SEELD.cjs');
6
+ require('./chunk-J7J7J2GN.cjs');
7
+ require('./chunk-6LHQPOMI.cjs');
8
+
9
+
10
+
11
+ Object.defineProperty(exports, "loadSubagents", {
12
+ enumerable: true,
13
+ get: function () { return chunkAYA65JA5_cjs.loadSubagents; }
14
+ });
15
+ //# sourceMappingURL=subagents-loader-DN4LETGL.cjs.map
16
+ //# sourceMappingURL=subagents-loader-DN4LETGL.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-7G76XOZU.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-DN4LETGL.cjs"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkIQBDR5YZ_cjs = require('./chunk-IQBDR5YZ.cjs');
4
- require('./chunk-DWB3CN46.cjs');
3
+ var chunkAYA65JA5_cjs = require('./chunk-AYA65JA5.cjs');
4
+ require('./chunk-43YXGD3P.cjs');
5
5
  require('./chunk-HW7SEELD.cjs');
6
6
  var chunkJ7J7J2GN_cjs = require('./chunk-J7J7J2GN.cjs');
7
7
  require('./chunk-6LHQPOMI.cjs');
@@ -23,7 +23,7 @@ function resolveSources(options) {
23
23
  }
24
24
  async function discoverSubagents(cwd, options) {
25
25
  const sources = resolveSources(options);
26
- return chunkIQBDR5YZ_cjs.loadSubagents(cwd, sources.includes("project"), void 0, options?.compatSources ?? []);
26
+ return chunkAYA65JA5_cjs.loadSubagents(cwd, sources.includes("project"), void 0, options?.compatSources ?? []);
27
27
  }
28
28
  async function loadSubagentDefinition(name, cwd, options) {
29
29
  return (await discoverSubagents(cwd, options))[name];
@@ -1,4 +1,4 @@
1
- import { a as AgentDefinition } from './agent-QLwxhXY3.cjs';
1
+ import { a as AgentDefinition } from './agent-DyB_lzrx.cjs';
2
2
  import './sdk-agent-BOiKqOgL.cjs';
3
3
  import './run-CTAdRU3U.cjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- import { a as AgentDefinition } from './agent-CTbU0O1R.js';
1
+ import { a as AgentDefinition } from './agent-CjMVbhhY.js';
2
2
  import './sdk-agent-D4a_BR_6.js';
3
3
  import './run-CTAdRU3U.js';
4
4
  import 'zod';
@@ -1,5 +1,5 @@
1
- import { loadSubagents } from './chunk-DLFWMJE3.js';
2
- import './chunk-RP3VXJMA.js';
1
+ import { loadSubagents } from './chunk-O7L7M42F.js';
2
+ import './chunk-NSLHPAC7.js';
3
3
  import './chunk-JNAA4G4H.js';
4
4
  import { ConfigurationError } from './chunk-ALUN2B4W.js';
5
5
  import './chunk-CZJ6Q7CW.js';
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { BudgetTracker } from "./budget-tracker.js";
7
7
  import type { ContextSettings } from "./context.js";
8
+ import type { HookApprovalGate } from "./hooks.js";
8
9
  import type { McpServerConfig } from "./mcp.js";
9
10
  import type { MemoryProvider } from "./memory-provider.js";
10
11
  import type { PluginsSettings, ProviderRoutingSettings } from "./providers.js";
@@ -30,7 +31,7 @@ export type SettingSource = "project" | "user" | "team" | "mdm" | "plugins" | "a
30
31
  *
31
32
  * @public
32
33
  */
33
- export type CompatSource = "claude-code" | CompatSourceAdapter;
34
+ export type CompatSource = "claude-code" | "theokit" | CompatSourceAdapter;
34
35
  /**
35
36
  * A surface a foreign configuration source may be admitted to.
36
37
  *
@@ -60,7 +61,17 @@ export type CompatSurface = "hooks" | "plugins" | "skills" | "subagents";
60
61
  * @public
61
62
  */
62
63
  export interface CompatSourceAdapter {
63
- readonly kind: "claude-code";
64
+ /**
65
+ * `"theokit"` names THIS package's own root (#631), in the same vocabulary a foreign dialect
66
+ * uses. Until it was accepted here, `.theokit/` contributed every surface unconditionally while a
67
+ * foreign one could declare which surfaces it wanted — an asymmetry with a measured cost: a
68
+ * consumer keeping its own configuration in `.theokit/settings.json` had that file's `hooks` key
69
+ * executed by this package, and `settingSources` gave it no way to decline, because it grants per
70
+ * SOURCE and not per surface.
71
+ *
72
+ * Declaring nothing keeps today's behaviour exactly: the native root contributes everything.
73
+ */
74
+ readonly kind: "claude-code" | "theokit";
64
75
  readonly import?: readonly CompatSurface[];
65
76
  }
66
77
  /**
@@ -128,6 +139,18 @@ export interface LocalOptions {
128
139
  * wrote for this runtime.
129
140
  */
130
141
  compatSources?: CompatSource[];
142
+ /**
143
+ * #631 — the consumer's chance to refuse a hook command before this package spawns it.
144
+ *
145
+ * Absent means run, which is what every consumer gets today. It is consulted at the single point
146
+ * a hook is executed, for every root — including a foreign dialect's, which is the case
147
+ * {@link CompatSourceAdapter} cannot reach: a consumer that wants `.claude/`'s skills, agents and
148
+ * rules cannot decline only its hooks, because `settingSources` grants per source.
149
+ *
150
+ * A refused hook resolves as if it were not configured. It does NOT deny the operation the hook
151
+ * attached to — the consumer asked for the command not to run, not for the work to stop.
152
+ */
153
+ hooks?: HookApprovalGate;
131
154
  sandboxOptions?: {
132
155
  enabled: boolean;
133
156
  };
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Hook contract types.
3
+ *
4
+ * Owner: `internal/runtime/hooks/` (2 of 3 importers). Derived from the import graph, not declared —
5
+ * `hooks-executor.ts` re-exports every name here, and `types/agent.ts` reads only the gate.
6
+ *
7
+ * A LEAF: it imports nothing, so anything may depend on it without closing a cycle. That is the
8
+ * whole reason it exists as its own file. The first version of #631 put
9
+ * `import("../internal/runtime/hooks/hooks-executor.js").HookApprovalGate` inline in
10
+ * `types/agent.ts`, which made the public contract depend on an internal module and produced
11
+ * thirteen failing cycle assertions — the exact defect `types/plugin.ts` documents at its own head
12
+ * ("the public contract sits above the DIP boundary").
13
+ *
14
+ * `HookEvent` is DECLARED here and re-exported by `internal/runtime/hooks/hooks-executor.ts`, so
15
+ * that pair has one definition. `internal/runtime/hooks/hooks-source.ts` still carries its own copy;
16
+ * consolidating that third one is the same class of problem as #586 and is deliberately not folded
17
+ * into this change.
18
+ *
19
+ * @public
20
+ */
21
+ /** The five lifecycle events the runtime actually fires. */
22
+ export type HookEvent = "preRun" | "postRun" | "preToolUse" | "postToolUse" | "stop";
23
+ /**
24
+ * #631 — what the consumer is shown when asked to approve a hook.
25
+ *
26
+ * The command TEXT and the file it was declared in, because neither alone answers the question. A
27
+ * consumer's fingerprint is over the command; which file it came from is what separates its own
28
+ * configuration from a foreign dialect it merely imported, and those deserve different answers.
29
+ *
30
+ * @public
31
+ */
32
+ export interface HookApprovalRequest {
33
+ readonly command: string;
34
+ readonly event: HookEvent;
35
+ readonly sourcePath?: string;
36
+ readonly matcher?: string;
37
+ /**
38
+ * #637 — the timeout the runtime WILL apply, in milliseconds, default already resolved.
39
+ *
40
+ * A config that omits `timeout` still runs under one (30s). Reporting `undefined` there would
41
+ * make a consumer reimplement this package's default in order to compute the same fingerprint,
42
+ * and a default duplicated across a boundary is a default that drifts.
43
+ */
44
+ readonly timeoutMs: number;
45
+ /**
46
+ * #637 — the event key exactly as the config file spelled it (`PreToolUse`), which is NOT
47
+ * `event` (`preToolUse`).
48
+ *
49
+ * A consumer's approval is taken against the file it showed the user, so its stored fingerprint
50
+ * is over the file's vocabulary. Without this the two sides hash different strings and no hook
51
+ * can ever be approved — only refused. The literal key rather than a published mapping table,
52
+ * because a mapping is a second thing to keep in step with the first.
53
+ *
54
+ * `string` and not a union of the keys this SDK currently recognises: the vocabulary belongs to
55
+ * whichever dialect declared the hook, so narrowing it would make adding a dialect a breaking
56
+ * change to this public type. A consumer hashes it; it does not need to switch on it.
57
+ */
58
+ readonly sourceEvent: string;
59
+ }
60
+ /**
61
+ * #631 — a consumer's decision point before this package spawns a hook.
62
+ *
63
+ * Absent means run, which is what every consumer gets today: a gate that defaulted to refusing
64
+ * would disable every hook in the ecosystem on an upgrade.
65
+ *
66
+ * @public
67
+ */
68
+ export interface HookApprovalGate {
69
+ readonly approve?: (request: HookApprovalRequest) => boolean | Promise<boolean>;
70
+ }
@@ -79,10 +79,10 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
79
79
  | `handoff_target_required` | domain | ConfigurationError | `packages/sdk-handoff/src/handoff.ts:111` |
80
80
  | `hitl_timeout` | domain | HitlTimeoutError | `packages/sdk/src/internal/runtime/tools/hitl-middleware.ts:42` +1 |
81
81
  | `hook_denied` | domain | ConfigurationError | `packages/sdk/src/internal/local-agent/local-agent.ts:454` |
82
- | `hooks_invalid_command` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:295` |
83
- | `hooks_json_invalid` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:190` +2 |
84
- | `hooks_read_error` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:181` |
85
- | `hooks_unsupported_type` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:289` |
82
+ | `hooks_invalid_command` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:305` |
83
+ | `hooks_json_invalid` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:200` +2 |
84
+ | `hooks_read_error` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:191` |
85
+ | `hooks_unsupported_type` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:299` |
86
86
  | `interactive_unavailable` | domain | InteractiveUnavailableError | `packages/sdk/src/interactive/types.ts:28` +1 |
87
87
  | `INTERNAL_SERVER_ERROR` | domain | — | `packages/sdk/src/server/errors-envelope.ts:100` |
88
88
  | `invalid_argument` | domain | TheokitAgentError | `packages/sdk/src/compaction.ts:79` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "5.3.3",
3
+ "version": "5.5.0",
4
4
  "description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/usetheokit/theokit-sdk#readme",