@theokit/sdk 3.1.1 → 3.2.2
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 +36 -0
- package/dist/a2a/index.cjs +188 -49
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +188 -49
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-C2jWAvlQ.d.cts → cron-4u1UdmgC.d.cts} +1 -1
- package/dist/{cron-BLRe166v.d.ts → cron-DuhVPer6.d.ts} +1 -1
- package/dist/cron.cjs +188 -49
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +188 -49
- package/dist/cron.js.map +1 -1
- package/dist/{errors-D_Bfo30u.d.ts → errors-_fPS0X80.d.ts} +1 -1
- package/dist/{errors-DZpCGlYv.d.cts → errors-jxK4yfp5.d.cts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/eval.cjs +188 -64
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +188 -64
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +197 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +197 -50
- package/dist/index.js.map +1 -1
- package/dist/internal/runtime/context/context-discovery.d.ts +1 -1
- package/dist/internal/runtime/context/context-glob.d.ts +1 -0
- package/dist/internal/runtime/context/context-manager.d.ts +18 -1
- package/dist/internal/runtime/context/context-mdc-parser.d.ts +7 -6
- package/dist/internal/runtime/context/context-rules-frontmatter.d.ts +30 -0
- package/dist/internal/runtime/context/context-yaml-lite.d.ts +26 -0
- package/dist/project.cjs.map +1 -1
- package/dist/project.js.map +1 -1
- package/dist/{run-CLXKMRgq.d.cts → run-CrHz9BAP.d.cts} +9 -0
- package/dist/{run-CLXKMRgq.d.ts → run-CrHz9BAP.d.ts} +9 -0
- package/dist/sandbox/index.cjs +8 -9
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +8 -9
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/types.d.cts +0 -1
- package/dist/sandbox/types.d.ts +0 -1
- package/dist/types/run.d.ts +9 -0
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-
|
|
2
|
-
export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-
|
|
3
|
-
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, I as InlineSkill, n as ConversationStorageAdapter, o as StoredMessage, p as SessionMeta, q as SessionMetaPatch, O as ObjectiveRecord, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as StepResult, v as SDKProvider } from './cron-
|
|
4
|
-
export { w as ActiveMemoryPassArgs, x as ActiveMemoryPassResult, y as AgentGoalConfig, z as AgentMemory, D as BudgetCheck, E as BudgetTotal, F as BudgetUsageEvent, H as CloudEnv, J as CloudRepo, K as ContextBudget, N as ContextManagerKind, Q as ContextSnapshot, R as ContextSource, T as ContextSourceStatus, U as CreateSkillSpec, V as Cron, W as CronCreateOptions, X as CronGetOptions, Y as CronJob, Z as CronJobStatus, _ as CronListOptions, $ as CronOperationOptions, a0 as CronRunOptions, a1 as CronRuntime, a2 as CronSchedulerStatus, a3 as CronStartOptions, a4 as DurableGoalOptions, a5 as GoalEvent, a6 as GoalOptions, a7 as GoalResult, a8 as HookName, a9 as InvalidateCacheOptions, aa as MemoryAdapter, ab as MemoryAdapterCapabilities, ac as MemoryContext, ad as MemoryFact, ae as MemoryProviderHandle, af as MemoryProviderInitOptions, ag as MemoryRevision, ah as MemoryToolSchema, ai as MemoryTurnMessage, aj as ObjectiveStatus, ak as PersonalityPreset, al as PluginContext, am as PostAssistantReplyContext, an as PreToolCallContext, ao as PreUserSendContext, ap as PreUserSendResult, aq as ProviderCapability, ar as ProviderRoute, as as RecordSessionSummaryArgs, at as ResolvedProviderRoute, au as RunUntilIterator, av as SDKAgentPlugins, aw as SDKAgentSkillDetail, ax as SDKAgentSkills, ay as SDKArtifact, az as SDKContextManager, aA as SDKPluginMetadata, aB as SDKProvidersManager, aC as SettingSource, aD as Skill, aE as SkillsResolver, aF as SkillsResolverContext, aG as SystemPromptContext, aH as SystemPromptMemoryFact, aI as SystemPromptSkillRef, aJ as TelemetrySettings } from './cron-
|
|
5
|
-
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, S as SDKMessage } from './run-
|
|
6
|
-
export { A as AgentConversationTurn, c as AssistantMessage, d as CompletionCheck, e as CompletionCheckResult, f as ConversationStep, g as ConversationTurn, h as CostBreakdown, i as CostSource, j as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, k as GenerateRunResult, I as ImageBlock, l as InputProcessorContext, m as InteractionUpdate, n as McpAuthConfig, o as McpHttpServerConfig, p as McpOAuthConfig, q as McpStdioServerConfig, r as MessageOrigin, s as ModelParameterValue, O as OutputProcessorContext, t as PartialToolCallUpdate, u as ProcessorControls, v as ProcessorTripwire, w as ProcessorViolation, x as RunCompactBoundaryEvent, y as RunCompletionCheckEvent, z as RunErrorDetail, B as RunEvent, E as RunEventSink, F as RunGitInfo, H as RunOperation, J as RunPermissionDeniedEvent, K as RunRateLimitEvent, L as RunStatus, N as RunTaskCompletedEvent, Q as RunTaskStartedEvent, U as RunTaskUpdatedEvent, V as RunToCompletionOptions, W as RunToCompletionResult, X as RunToolProgressEvent, Y as RunTripwireEvent, Z as SDKAssistantMessage, _ as SDKImage, $ as SDKImageDimension, a0 as SDKObjectDelta, a1 as SDKRequestMessage, a2 as SDKStatusMessage, a3 as SDKSystemMessage, a4 as SDKTaskMessage, a5 as SDKThinkingMessage, a6 as SDKToolUseMessage, a7 as SDKUserMessage, a8 as SDKUserMessageEvent, a9 as SendOptions, aa as ShellCommand, ab as ShellConversationTurn, ac as ShellOutput, ad as ShellOutputDeltaUpdate, ae as StepCompletedUpdate, af as StepStartedUpdate, ag as StreamToCompletionResult, ah as SummaryCompletedUpdate, ai as SummaryStartedUpdate, aj as SummaryUpdate, ak as TextBlock, al as TextDeltaUpdate, am as ThinkingCompletedUpdate, an as ThinkingDeltaUpdate, ao as ThinkingMessage, ap as TokenDeltaUpdate, aq as TokenUsage, ar as ToolCall, as as ToolCallCompletedUpdate, at as ToolCallStartedUpdate, au as ToolContextMessage, av as ToolResult, aw as ToolResultGuardOptions, ax as ToolUseBlock, ay as TurnEndedUpdate, az as UserMessage, aA as UserMessageAppendedUpdate, aB as emitRunEvent } from './run-
|
|
1
|
+
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-jxK4yfp5.cjs';
|
|
2
|
+
export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-jxK4yfp5.cjs';
|
|
3
|
+
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, I as InlineSkill, n as ConversationStorageAdapter, o as StoredMessage, p as SessionMeta, q as SessionMetaPatch, O as ObjectiveRecord, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as StepResult, v as SDKProvider } from './cron-4u1UdmgC.cjs';
|
|
4
|
+
export { w as ActiveMemoryPassArgs, x as ActiveMemoryPassResult, y as AgentGoalConfig, z as AgentMemory, D as BudgetCheck, E as BudgetTotal, F as BudgetUsageEvent, H as CloudEnv, J as CloudRepo, K as ContextBudget, N as ContextManagerKind, Q as ContextSnapshot, R as ContextSource, T as ContextSourceStatus, U as CreateSkillSpec, V as Cron, W as CronCreateOptions, X as CronGetOptions, Y as CronJob, Z as CronJobStatus, _ as CronListOptions, $ as CronOperationOptions, a0 as CronRunOptions, a1 as CronRuntime, a2 as CronSchedulerStatus, a3 as CronStartOptions, a4 as DurableGoalOptions, a5 as GoalEvent, a6 as GoalOptions, a7 as GoalResult, a8 as HookName, a9 as InvalidateCacheOptions, aa as MemoryAdapter, ab as MemoryAdapterCapabilities, ac as MemoryContext, ad as MemoryFact, ae as MemoryProviderHandle, af as MemoryProviderInitOptions, ag as MemoryRevision, ah as MemoryToolSchema, ai as MemoryTurnMessage, aj as ObjectiveStatus, ak as PersonalityPreset, al as PluginContext, am as PostAssistantReplyContext, an as PreToolCallContext, ao as PreUserSendContext, ap as PreUserSendResult, aq as ProviderCapability, ar as ProviderRoute, as as RecordSessionSummaryArgs, at as ResolvedProviderRoute, au as RunUntilIterator, av as SDKAgentPlugins, aw as SDKAgentSkillDetail, ax as SDKAgentSkills, ay as SDKArtifact, az as SDKContextManager, aA as SDKPluginMetadata, aB as SDKProvidersManager, aC as SettingSource, aD as Skill, aE as SkillsResolver, aF as SkillsResolverContext, aG as SystemPromptContext, aH as SystemPromptMemoryFact, aI as SystemPromptSkillRef, aJ as TelemetrySettings } from './cron-4u1UdmgC.cjs';
|
|
5
|
+
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, S as SDKMessage } from './run-CrHz9BAP.cjs';
|
|
6
|
+
export { A as AgentConversationTurn, c as AssistantMessage, d as CompletionCheck, e as CompletionCheckResult, f as ConversationStep, g as ConversationTurn, h as CostBreakdown, i as CostSource, j as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, k as GenerateRunResult, I as ImageBlock, l as InputProcessorContext, m as InteractionUpdate, n as McpAuthConfig, o as McpHttpServerConfig, p as McpOAuthConfig, q as McpStdioServerConfig, r as MessageOrigin, s as ModelParameterValue, O as OutputProcessorContext, t as PartialToolCallUpdate, u as ProcessorControls, v as ProcessorTripwire, w as ProcessorViolation, x as RunCompactBoundaryEvent, y as RunCompletionCheckEvent, z as RunErrorDetail, B as RunEvent, E as RunEventSink, F as RunGitInfo, H as RunOperation, J as RunPermissionDeniedEvent, K as RunRateLimitEvent, L as RunStatus, N as RunTaskCompletedEvent, Q as RunTaskStartedEvent, U as RunTaskUpdatedEvent, V as RunToCompletionOptions, W as RunToCompletionResult, X as RunToolProgressEvent, Y as RunTripwireEvent, Z as SDKAssistantMessage, _ as SDKImage, $ as SDKImageDimension, a0 as SDKObjectDelta, a1 as SDKRequestMessage, a2 as SDKStatusMessage, a3 as SDKSystemMessage, a4 as SDKTaskMessage, a5 as SDKThinkingMessage, a6 as SDKToolUseMessage, a7 as SDKUserMessage, a8 as SDKUserMessageEvent, a9 as SendOptions, aa as ShellCommand, ab as ShellConversationTurn, ac as ShellOutput, ad as ShellOutputDeltaUpdate, ae as StepCompletedUpdate, af as StepStartedUpdate, ag as StreamToCompletionResult, ah as SummaryCompletedUpdate, ai as SummaryStartedUpdate, aj as SummaryUpdate, ak as TextBlock, al as TextDeltaUpdate, am as ThinkingCompletedUpdate, an as ThinkingDeltaUpdate, ao as ThinkingMessage, ap as TokenDeltaUpdate, aq as TokenUsage, ar as ToolCall, as as ToolCallCompletedUpdate, at as ToolCallStartedUpdate, au as ToolContextMessage, av as ToolResult, aw as ToolResultGuardOptions, ax as ToolUseBlock, ay as TurnEndedUpdate, az as UserMessage, aA as UserMessageAppendedUpdate, aB as emitRunEvent } from './run-CrHz9BAP.cjs';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
9
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-
|
|
2
|
-
export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-
|
|
3
|
-
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, I as InlineSkill, n as ConversationStorageAdapter, o as StoredMessage, p as SessionMeta, q as SessionMetaPatch, O as ObjectiveRecord, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as StepResult, v as SDKProvider } from './cron-
|
|
4
|
-
export { w as ActiveMemoryPassArgs, x as ActiveMemoryPassResult, y as AgentGoalConfig, z as AgentMemory, D as BudgetCheck, E as BudgetTotal, F as BudgetUsageEvent, H as CloudEnv, J as CloudRepo, K as ContextBudget, N as ContextManagerKind, Q as ContextSnapshot, R as ContextSource, T as ContextSourceStatus, U as CreateSkillSpec, V as Cron, W as CronCreateOptions, X as CronGetOptions, Y as CronJob, Z as CronJobStatus, _ as CronListOptions, $ as CronOperationOptions, a0 as CronRunOptions, a1 as CronRuntime, a2 as CronSchedulerStatus, a3 as CronStartOptions, a4 as DurableGoalOptions, a5 as GoalEvent, a6 as GoalOptions, a7 as GoalResult, a8 as HookName, a9 as InvalidateCacheOptions, aa as MemoryAdapter, ab as MemoryAdapterCapabilities, ac as MemoryContext, ad as MemoryFact, ae as MemoryProviderHandle, af as MemoryProviderInitOptions, ag as MemoryRevision, ah as MemoryToolSchema, ai as MemoryTurnMessage, aj as ObjectiveStatus, ak as PersonalityPreset, al as PluginContext, am as PostAssistantReplyContext, an as PreToolCallContext, ao as PreUserSendContext, ap as PreUserSendResult, aq as ProviderCapability, ar as ProviderRoute, as as RecordSessionSummaryArgs, at as ResolvedProviderRoute, au as RunUntilIterator, av as SDKAgentPlugins, aw as SDKAgentSkillDetail, ax as SDKAgentSkills, ay as SDKArtifact, az as SDKContextManager, aA as SDKPluginMetadata, aB as SDKProvidersManager, aC as SettingSource, aD as Skill, aE as SkillsResolver, aF as SkillsResolverContext, aG as SystemPromptContext, aH as SystemPromptMemoryFact, aI as SystemPromptSkillRef, aJ as TelemetrySettings } from './cron-
|
|
5
|
-
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, S as SDKMessage } from './run-
|
|
6
|
-
export { A as AgentConversationTurn, c as AssistantMessage, d as CompletionCheck, e as CompletionCheckResult, f as ConversationStep, g as ConversationTurn, h as CostBreakdown, i as CostSource, j as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, k as GenerateRunResult, I as ImageBlock, l as InputProcessorContext, m as InteractionUpdate, n as McpAuthConfig, o as McpHttpServerConfig, p as McpOAuthConfig, q as McpStdioServerConfig, r as MessageOrigin, s as ModelParameterValue, O as OutputProcessorContext, t as PartialToolCallUpdate, u as ProcessorControls, v as ProcessorTripwire, w as ProcessorViolation, x as RunCompactBoundaryEvent, y as RunCompletionCheckEvent, z as RunErrorDetail, B as RunEvent, E as RunEventSink, F as RunGitInfo, H as RunOperation, J as RunPermissionDeniedEvent, K as RunRateLimitEvent, L as RunStatus, N as RunTaskCompletedEvent, Q as RunTaskStartedEvent, U as RunTaskUpdatedEvent, V as RunToCompletionOptions, W as RunToCompletionResult, X as RunToolProgressEvent, Y as RunTripwireEvent, Z as SDKAssistantMessage, _ as SDKImage, $ as SDKImageDimension, a0 as SDKObjectDelta, a1 as SDKRequestMessage, a2 as SDKStatusMessage, a3 as SDKSystemMessage, a4 as SDKTaskMessage, a5 as SDKThinkingMessage, a6 as SDKToolUseMessage, a7 as SDKUserMessage, a8 as SDKUserMessageEvent, a9 as SendOptions, aa as ShellCommand, ab as ShellConversationTurn, ac as ShellOutput, ad as ShellOutputDeltaUpdate, ae as StepCompletedUpdate, af as StepStartedUpdate, ag as StreamToCompletionResult, ah as SummaryCompletedUpdate, ai as SummaryStartedUpdate, aj as SummaryUpdate, ak as TextBlock, al as TextDeltaUpdate, am as ThinkingCompletedUpdate, an as ThinkingDeltaUpdate, ao as ThinkingMessage, ap as TokenDeltaUpdate, aq as TokenUsage, ar as ToolCall, as as ToolCallCompletedUpdate, at as ToolCallStartedUpdate, au as ToolContextMessage, av as ToolResult, aw as ToolResultGuardOptions, ax as ToolUseBlock, ay as TurnEndedUpdate, az as UserMessage, aA as UserMessageAppendedUpdate, aB as emitRunEvent } from './run-
|
|
1
|
+
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-_fPS0X80.js';
|
|
2
|
+
export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-_fPS0X80.js';
|
|
3
|
+
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as ProviderProfile, m as Plugin, I as InlineSkill, n as ConversationStorageAdapter, o as StoredMessage, p as SessionMeta, q as SessionMetaPatch, O as ObjectiveRecord, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as StepResult, v as SDKProvider } from './cron-DuhVPer6.js';
|
|
4
|
+
export { w as ActiveMemoryPassArgs, x as ActiveMemoryPassResult, y as AgentGoalConfig, z as AgentMemory, D as BudgetCheck, E as BudgetTotal, F as BudgetUsageEvent, H as CloudEnv, J as CloudRepo, K as ContextBudget, N as ContextManagerKind, Q as ContextSnapshot, R as ContextSource, T as ContextSourceStatus, U as CreateSkillSpec, V as Cron, W as CronCreateOptions, X as CronGetOptions, Y as CronJob, Z as CronJobStatus, _ as CronListOptions, $ as CronOperationOptions, a0 as CronRunOptions, a1 as CronRuntime, a2 as CronSchedulerStatus, a3 as CronStartOptions, a4 as DurableGoalOptions, a5 as GoalEvent, a6 as GoalOptions, a7 as GoalResult, a8 as HookName, a9 as InvalidateCacheOptions, aa as MemoryAdapter, ab as MemoryAdapterCapabilities, ac as MemoryContext, ad as MemoryFact, ae as MemoryProviderHandle, af as MemoryProviderInitOptions, ag as MemoryRevision, ah as MemoryToolSchema, ai as MemoryTurnMessage, aj as ObjectiveStatus, ak as PersonalityPreset, al as PluginContext, am as PostAssistantReplyContext, an as PreToolCallContext, ao as PreUserSendContext, ap as PreUserSendResult, aq as ProviderCapability, ar as ProviderRoute, as as RecordSessionSummaryArgs, at as ResolvedProviderRoute, au as RunUntilIterator, av as SDKAgentPlugins, aw as SDKAgentSkillDetail, ax as SDKAgentSkills, ay as SDKArtifact, az as SDKContextManager, aA as SDKPluginMetadata, aB as SDKProvidersManager, aC as SettingSource, aD as Skill, aE as SkillsResolver, aF as SkillsResolverContext, aG as SystemPromptContext, aH as SystemPromptMemoryFact, aI as SystemPromptSkillRef, aJ as TelemetrySettings } from './cron-DuhVPer6.js';
|
|
5
|
+
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, S as SDKMessage } from './run-CrHz9BAP.js';
|
|
6
|
+
export { A as AgentConversationTurn, c as AssistantMessage, d as CompletionCheck, e as CompletionCheckResult, f as ConversationStep, g as ConversationTurn, h as CostBreakdown, i as CostSource, j as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, k as GenerateRunResult, I as ImageBlock, l as InputProcessorContext, m as InteractionUpdate, n as McpAuthConfig, o as McpHttpServerConfig, p as McpOAuthConfig, q as McpStdioServerConfig, r as MessageOrigin, s as ModelParameterValue, O as OutputProcessorContext, t as PartialToolCallUpdate, u as ProcessorControls, v as ProcessorTripwire, w as ProcessorViolation, x as RunCompactBoundaryEvent, y as RunCompletionCheckEvent, z as RunErrorDetail, B as RunEvent, E as RunEventSink, F as RunGitInfo, H as RunOperation, J as RunPermissionDeniedEvent, K as RunRateLimitEvent, L as RunStatus, N as RunTaskCompletedEvent, Q as RunTaskStartedEvent, U as RunTaskUpdatedEvent, V as RunToCompletionOptions, W as RunToCompletionResult, X as RunToolProgressEvent, Y as RunTripwireEvent, Z as SDKAssistantMessage, _ as SDKImage, $ as SDKImageDimension, a0 as SDKObjectDelta, a1 as SDKRequestMessage, a2 as SDKStatusMessage, a3 as SDKSystemMessage, a4 as SDKTaskMessage, a5 as SDKThinkingMessage, a6 as SDKToolUseMessage, a7 as SDKUserMessage, a8 as SDKUserMessageEvent, a9 as SendOptions, aa as ShellCommand, ab as ShellConversationTurn, ac as ShellOutput, ad as ShellOutputDeltaUpdate, ae as StepCompletedUpdate, af as StepStartedUpdate, ag as StreamToCompletionResult, ah as SummaryCompletedUpdate, ai as SummaryStartedUpdate, aj as SummaryUpdate, ak as TextBlock, al as TextDeltaUpdate, am as ThinkingCompletedUpdate, an as ThinkingDeltaUpdate, ao as ThinkingMessage, ap as TokenDeltaUpdate, aq as TokenUsage, ar as ToolCall, as as ToolCallCompletedUpdate, at as ToolCallStartedUpdate, au as ToolContextMessage, av as ToolResult, aw as ToolResultGuardOptions, ax as ToolUseBlock, ay as TurnEndedUpdate, az as UserMessage, aA as UserMessageAppendedUpdate, aB as emitRunEvent } from './run-CrHz9BAP.js';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
9
|
|
package/dist/index.js
CHANGED
|
@@ -973,10 +973,10 @@ function buildToolPrompt(prompt) {
|
|
|
973
973
|
Respond by calling the \`output\` tool with the structured answer that matches the schema.`;
|
|
974
974
|
}
|
|
975
975
|
function setupStructuredOutput(schema, maxRetries) {
|
|
976
|
-
const
|
|
976
|
+
const z11 = requireZod();
|
|
977
977
|
const jsonSchema = toJsonSchema(schema, { unrepresentable: "any" });
|
|
978
978
|
return {
|
|
979
|
-
z:
|
|
979
|
+
z: z11,
|
|
980
980
|
jsonSchema,
|
|
981
981
|
maxRetries: maxRetries ?? 1,
|
|
982
982
|
initialUsage: { inputTokens: 0, outputTokens: 0 }
|
|
@@ -4754,7 +4754,14 @@ var init_env_policy = __esm({
|
|
|
4754
4754
|
/[_-]PWD/i,
|
|
4755
4755
|
/CREDENTIAL/i,
|
|
4756
4756
|
/PRIVATE/i,
|
|
4757
|
-
/_AUTH/i
|
|
4757
|
+
/_AUTH/i,
|
|
4758
|
+
// #54-a — value-embedded-secret conventions (no generic `*_URL` — see keep-list test).
|
|
4759
|
+
/DSN/i,
|
|
4760
|
+
/WEBHOOK/i,
|
|
4761
|
+
/COOKIE/i,
|
|
4762
|
+
/CONNECTION[_-]?STRING/i,
|
|
4763
|
+
// Known DB / message-broker connection-string vars (carry `user:pass@`).
|
|
4764
|
+
/(?:^|[_-])(?:DATABASE|DB|REDIS|MONGO(?:DB)?|POSTGRES(?:QL)?|MYSQL|MARIADB|AMQP|RABBITMQ|CLICKHOUSE|ELASTIC(?:SEARCH)?|CASSANDRA|COUCHDB|MEMCACHED|NATS|KAFKA)[_-]?(?:URL|URI|DSN|CONNECTION)/i
|
|
4758
4765
|
];
|
|
4759
4766
|
CORE_VARS = [
|
|
4760
4767
|
"PATH",
|
|
@@ -6052,7 +6059,7 @@ async function buildSystemPromptContext(inputs, userText, memoryFacts, manager =
|
|
|
6052
6059
|
memory: memoryFacts.map((fact) => ({ text: fact.text }))
|
|
6053
6060
|
};
|
|
6054
6061
|
}
|
|
6055
|
-
async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary) {
|
|
6062
|
+
async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary, contextPaths) {
|
|
6056
6063
|
const resolved = await resolveSendSkills(inputs, userText, memoryFacts);
|
|
6057
6064
|
const baseCtx = await buildSystemPromptContext(inputs, userText, memoryFacts, resolved.manager);
|
|
6058
6065
|
const assemblyCtx = {
|
|
@@ -6065,19 +6072,21 @@ async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFa
|
|
|
6065
6072
|
assemblyCtx.activeMemorySummary = activeMemorySummary;
|
|
6066
6073
|
}
|
|
6067
6074
|
if (inputs.context !== void 0) {
|
|
6075
|
+
await inputs.context.applyScope(contextPaths);
|
|
6068
6076
|
const internal = inputs.context.internalAssemblySnapshot();
|
|
6069
6077
|
assemblyCtx.contextSnapshot = { sources: internal.sources };
|
|
6070
6078
|
if (internal.maxTokens !== void 0) assemblyCtx.contextMaxTokens = internal.maxTokens;
|
|
6071
6079
|
}
|
|
6072
6080
|
return assemblyCtx;
|
|
6073
6081
|
}
|
|
6074
|
-
async function assembleSystemPromptForSend(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary) {
|
|
6082
|
+
async function assembleSystemPromptForSend(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary, contextPaths) {
|
|
6075
6083
|
const ctx = await buildAssemblyContext(
|
|
6076
6084
|
inputs,
|
|
6077
6085
|
userText,
|
|
6078
6086
|
baseSystemPrompt,
|
|
6079
6087
|
memoryFacts,
|
|
6080
|
-
activeMemorySummary
|
|
6088
|
+
activeMemorySummary,
|
|
6089
|
+
contextPaths
|
|
6081
6090
|
);
|
|
6082
6091
|
return inputs.systemPromptPipeline.assemble(ctx);
|
|
6083
6092
|
}
|
|
@@ -6784,6 +6793,14 @@ var init_context_discovery = __esm({
|
|
|
6784
6793
|
followImports: false,
|
|
6785
6794
|
priority: 40
|
|
6786
6795
|
},
|
|
6796
|
+
{
|
|
6797
|
+
id: "theokit-rules",
|
|
6798
|
+
pattern: ".theokit/rules/*.md",
|
|
6799
|
+
scope: "globbed",
|
|
6800
|
+
parser: "rules-frontmatter",
|
|
6801
|
+
followImports: false,
|
|
6802
|
+
priority: 45
|
|
6803
|
+
},
|
|
6787
6804
|
{
|
|
6788
6805
|
id: "theokit-context",
|
|
6789
6806
|
pattern: ".theokit/context/*.md",
|
|
@@ -6867,32 +6884,27 @@ var init_context_import_resolver = __esm({
|
|
|
6867
6884
|
MAX_HOPS = 5;
|
|
6868
6885
|
}
|
|
6869
6886
|
});
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
}
|
|
6875
|
-
const yamlBody = m[1] ?? "";
|
|
6876
|
-
const body = m[2] ?? "";
|
|
6877
|
-
try {
|
|
6878
|
-
const parsed = parseSimpleYaml2(yamlBody);
|
|
6879
|
-
const validated = McdFrontmatterSchema.safeParse(parsed);
|
|
6880
|
-
if (!validated.success) return void 0;
|
|
6881
|
-
return { frontmatter: validated.data, body };
|
|
6882
|
-
} catch {
|
|
6883
|
-
return void 0;
|
|
6884
|
-
}
|
|
6887
|
+
|
|
6888
|
+
// src/internal/runtime/context/context-glob.ts
|
|
6889
|
+
function globToRegex(glob) {
|
|
6890
|
+
const compiled = glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*\//g, "::GLOBSTAR_SLASH::").replace(/\*\*/g, "::GLOBSTAR::").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(/::GLOBSTAR_SLASH::/g, "(?:.*/)?").replace(/::GLOBSTAR::/g, ".*");
|
|
6891
|
+
return new RegExp(`^${compiled}$`);
|
|
6885
6892
|
}
|
|
6886
|
-
function
|
|
6887
|
-
if (
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
const globRes = fm.globs.map(globToRegex);
|
|
6891
|
-
return touchedFiles.some((file) => globRes.some((re) => re.test(file)));
|
|
6893
|
+
function anyGlobMatches(patterns, paths) {
|
|
6894
|
+
if (patterns.length === 0 || paths.length === 0) return false;
|
|
6895
|
+
const res = patterns.map(globToRegex);
|
|
6896
|
+
return paths.some((p) => res.some((re) => re.test(p)));
|
|
6892
6897
|
}
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6898
|
+
var init_context_glob = __esm({
|
|
6899
|
+
"src/internal/runtime/context/context-glob.ts"() {
|
|
6900
|
+
}
|
|
6901
|
+
});
|
|
6902
|
+
|
|
6903
|
+
// src/internal/runtime/context/context-yaml-lite.ts
|
|
6904
|
+
function splitFrontmatter3(content) {
|
|
6905
|
+
const m = FRONTMATTER_RE.exec(content);
|
|
6906
|
+
if (m === null) return { yaml: void 0, body: content };
|
|
6907
|
+
return { yaml: m[1] ?? "", body: m[2] ?? "" };
|
|
6896
6908
|
}
|
|
6897
6909
|
function parseSimpleYaml2(yaml) {
|
|
6898
6910
|
const out = {};
|
|
@@ -6939,15 +6951,76 @@ function parseScalar(s) {
|
|
|
6939
6951
|
if (/^-?\d+$/.test(s)) return parseInt(s, 10);
|
|
6940
6952
|
return s.replace(/^["']|["']$/g, "");
|
|
6941
6953
|
}
|
|
6942
|
-
var
|
|
6954
|
+
var FRONTMATTER_RE;
|
|
6955
|
+
var init_context_yaml_lite = __esm({
|
|
6956
|
+
"src/internal/runtime/context/context-yaml-lite.ts"() {
|
|
6957
|
+
FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
|
|
6958
|
+
}
|
|
6959
|
+
});
|
|
6960
|
+
function parseMdc(content) {
|
|
6961
|
+
const { yaml, body } = splitFrontmatter3(content);
|
|
6962
|
+
if (yaml === void 0) {
|
|
6963
|
+
return { frontmatter: { alwaysApply: true }, body: content };
|
|
6964
|
+
}
|
|
6965
|
+
try {
|
|
6966
|
+
const parsed = parseSimpleYaml2(yaml);
|
|
6967
|
+
const validated = McdFrontmatterSchema.safeParse(parsed);
|
|
6968
|
+
if (!validated.success) return void 0;
|
|
6969
|
+
return { frontmatter: validated.data, body };
|
|
6970
|
+
} catch {
|
|
6971
|
+
return void 0;
|
|
6972
|
+
}
|
|
6973
|
+
}
|
|
6974
|
+
function shouldActivate(fm, touchedFiles) {
|
|
6975
|
+
if (fm.alwaysApply === true) return true;
|
|
6976
|
+
if (fm.globs === void 0 || fm.globs.length === 0) return false;
|
|
6977
|
+
return anyGlobMatches(fm.globs, touchedFiles);
|
|
6978
|
+
}
|
|
6979
|
+
var McdFrontmatterSchema;
|
|
6943
6980
|
var init_context_mdc_parser = __esm({
|
|
6944
6981
|
"src/internal/runtime/context/context-mdc-parser.ts"() {
|
|
6982
|
+
init_context_glob();
|
|
6983
|
+
init_context_yaml_lite();
|
|
6945
6984
|
McdFrontmatterSchema = z.object({
|
|
6946
6985
|
description: z.string().optional(),
|
|
6947
6986
|
globs: z.array(z.string()).optional(),
|
|
6948
6987
|
alwaysApply: z.boolean().optional()
|
|
6949
6988
|
});
|
|
6950
|
-
|
|
6989
|
+
}
|
|
6990
|
+
});
|
|
6991
|
+
function parseRules(content) {
|
|
6992
|
+
const { yaml, body } = splitFrontmatter3(content);
|
|
6993
|
+
if (yaml === void 0) {
|
|
6994
|
+
return { frontmatter: { alwaysApply: true }, body: content };
|
|
6995
|
+
}
|
|
6996
|
+
try {
|
|
6997
|
+
const parsed = parseSimpleYaml2(yaml);
|
|
6998
|
+
const validated = RulesFrontmatterSchema.safeParse(parsed);
|
|
6999
|
+
if (!validated.success) return void 0;
|
|
7000
|
+
return { frontmatter: validated.data, body };
|
|
7001
|
+
} catch {
|
|
7002
|
+
return void 0;
|
|
7003
|
+
}
|
|
7004
|
+
}
|
|
7005
|
+
function shouldActivateRule(fm, inScopePaths) {
|
|
7006
|
+
if (fm.enabled === false) return false;
|
|
7007
|
+
if (fm.alwaysApply === true) return true;
|
|
7008
|
+
const patterns = [...fm.paths ?? [], ...fm.globs ?? []];
|
|
7009
|
+
if (patterns.length === 0) return false;
|
|
7010
|
+
return anyGlobMatches(patterns, inScopePaths);
|
|
7011
|
+
}
|
|
7012
|
+
var RulesFrontmatterSchema;
|
|
7013
|
+
var init_context_rules_frontmatter = __esm({
|
|
7014
|
+
"src/internal/runtime/context/context-rules-frontmatter.ts"() {
|
|
7015
|
+
init_context_glob();
|
|
7016
|
+
init_context_yaml_lite();
|
|
7017
|
+
RulesFrontmatterSchema = z.object({
|
|
7018
|
+
description: z.string().optional(),
|
|
7019
|
+
paths: z.array(z.string()).optional(),
|
|
7020
|
+
globs: z.array(z.string()).optional(),
|
|
7021
|
+
alwaysApply: z.boolean().optional(),
|
|
7022
|
+
enabled: z.boolean().optional()
|
|
7023
|
+
});
|
|
6951
7024
|
}
|
|
6952
7025
|
});
|
|
6953
7026
|
async function runDiscovery(opts) {
|
|
@@ -6983,6 +7056,9 @@ async function loadOneSource(spec, path, opts, gitRoot) {
|
|
|
6983
7056
|
if (spec.parser === "mdc") {
|
|
6984
7057
|
return loadMdcSource(spec, path, id, opts);
|
|
6985
7058
|
}
|
|
7059
|
+
if (spec.parser === "rules-frontmatter") {
|
|
7060
|
+
return loadRulesSource(spec, path, id, opts);
|
|
7061
|
+
}
|
|
6986
7062
|
if (spec.parser === "frontmatter-zod") {
|
|
6987
7063
|
return void 0;
|
|
6988
7064
|
}
|
|
@@ -7006,6 +7082,24 @@ async function loadMdcSource(spec, path, id, opts) {
|
|
|
7006
7082
|
truncated: false
|
|
7007
7083
|
};
|
|
7008
7084
|
}
|
|
7085
|
+
async function loadRulesSource(spec, path, id, opts) {
|
|
7086
|
+
let raw;
|
|
7087
|
+
try {
|
|
7088
|
+
raw = await readFile(path, "utf8");
|
|
7089
|
+
} catch {
|
|
7090
|
+
return void 0;
|
|
7091
|
+
}
|
|
7092
|
+
const parsed = parseRules(raw);
|
|
7093
|
+
if (parsed === void 0) return void 0;
|
|
7094
|
+
if (!shouldActivateRule(parsed.frontmatter, opts.touchedFiles ?? [])) return void 0;
|
|
7095
|
+
return {
|
|
7096
|
+
id,
|
|
7097
|
+
source: path,
|
|
7098
|
+
content: parsed.body,
|
|
7099
|
+
priority: spec.priority,
|
|
7100
|
+
truncated: false
|
|
7101
|
+
};
|
|
7102
|
+
}
|
|
7009
7103
|
async function loadPlainMarkdownSource(spec, path, id, opts) {
|
|
7010
7104
|
const loaded = await loadPlainMarkdown(path, { maxBytesPerFile: opts.maxBytesPerFile });
|
|
7011
7105
|
if (loaded === void 0) return void 0;
|
|
@@ -7031,6 +7125,7 @@ var init_context_discovery_runner = __esm({
|
|
|
7031
7125
|
init_context_import_resolver();
|
|
7032
7126
|
init_context_loaders();
|
|
7033
7127
|
init_context_mdc_parser();
|
|
7128
|
+
init_context_rules_frontmatter();
|
|
7034
7129
|
}
|
|
7035
7130
|
});
|
|
7036
7131
|
var ContextSourceFrontmatterSchema;
|
|
@@ -7166,6 +7261,10 @@ function matchesGlob(pattern, path) {
|
|
|
7166
7261
|
function tokenizeContent(content) {
|
|
7167
7262
|
return content.split(/\s+/).filter((token) => token.length > 0);
|
|
7168
7263
|
}
|
|
7264
|
+
function sameScope(a, b) {
|
|
7265
|
+
if (a.length !== b.length) return false;
|
|
7266
|
+
return a.every((v, i) => v === b[i]);
|
|
7267
|
+
}
|
|
7169
7268
|
var FileContextManager;
|
|
7170
7269
|
var init_context_manager = __esm({
|
|
7171
7270
|
"src/internal/runtime/context/context-manager.ts"() {
|
|
@@ -7186,6 +7285,13 @@ var init_context_manager = __esm({
|
|
|
7186
7285
|
settings;
|
|
7187
7286
|
settingSourcesIncludeProject;
|
|
7188
7287
|
state;
|
|
7288
|
+
/**
|
|
7289
|
+
* The in-scope file set used by the most recent `refresh`. Tracked so
|
|
7290
|
+
* `applyScope` only touches state when the scope actually changes — a
|
|
7291
|
+
* caller that never scopes (the common case) keeps the create-time
|
|
7292
|
+
* snapshot untouched, at zero per-send cost.
|
|
7293
|
+
*/
|
|
7294
|
+
lastScope = [];
|
|
7189
7295
|
async initialize() {
|
|
7190
7296
|
if (!this.settingSourcesIncludeProject && this.settings.manager !== "file") {
|
|
7191
7297
|
this.state = { config: { sources: [] }, loadedSources: [] };
|
|
@@ -7193,14 +7299,31 @@ var init_context_manager = __esm({
|
|
|
7193
7299
|
}
|
|
7194
7300
|
await this.refresh();
|
|
7195
7301
|
}
|
|
7196
|
-
|
|
7302
|
+
/**
|
|
7303
|
+
* Re-run discovery for a specific per-send in-scope file set (T3). Path-scoped
|
|
7304
|
+
* rules (`.theokit/rules/*.md`, `.cursor/rules/*.mdc` globs) activate iff a
|
|
7305
|
+
* pattern matches one of `contextPaths`. Idempotent: unchanged scope is a
|
|
7306
|
+
* no-op, and `undefined` scope while never previously scoped never touches
|
|
7307
|
+
* state (preserves the create-time snapshot for non-users).
|
|
7308
|
+
*/
|
|
7309
|
+
async applyScope(contextPaths) {
|
|
7310
|
+
const scope = contextPaths ?? [];
|
|
7311
|
+
if (scope.length === 0 && this.lastScope.length === 0) return;
|
|
7312
|
+
if (sameScope(scope, this.lastScope)) return;
|
|
7313
|
+
await this.refresh({ touchedFiles: scope });
|
|
7314
|
+
}
|
|
7315
|
+
async refresh(opts) {
|
|
7316
|
+
const touchedFiles = opts?.touchedFiles ?? [];
|
|
7317
|
+
this.lastScope = [...touchedFiles];
|
|
7197
7318
|
const config = await loadContextConfig(this.cwd);
|
|
7198
7319
|
const legacy = await loadSources(config, this.cwd);
|
|
7199
7320
|
const maxBytesPerFile = this.settings.maxBytesPerFile ?? DEFAULT_MAX_BYTES_PER_FILE;
|
|
7200
7321
|
const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
|
|
7201
7322
|
const discovered = await runDiscovery({
|
|
7202
7323
|
cwd: this.cwd,
|
|
7203
|
-
maxBytesPerFile
|
|
7324
|
+
maxBytesPerFile,
|
|
7325
|
+
touchedFiles
|
|
7326
|
+
});
|
|
7204
7327
|
const legacyAsAggregator = legacy.map((src) => ({
|
|
7205
7328
|
id: src.name,
|
|
7206
7329
|
source: src.path,
|
|
@@ -7635,15 +7758,19 @@ async function collectChildToolResults(run) {
|
|
|
7635
7758
|
${lines.join("\n")}
|
|
7636
7759
|
</subagent-tool-results>`;
|
|
7637
7760
|
}
|
|
7638
|
-
|
|
7639
|
-
const { Agent: Agent2 } = await Promise.resolve().then(() => (init_agent(), agent_exports));
|
|
7761
|
+
function buildChildCreateOptions(spec, inherited) {
|
|
7640
7762
|
const model = spec.model ? { id: spec.model } : inherited?.model;
|
|
7641
|
-
|
|
7763
|
+
return {
|
|
7642
7764
|
...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
|
|
7643
7765
|
...model !== void 0 ? { model } : {},
|
|
7766
|
+
...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
|
|
7644
7767
|
systemPrompt: spec.instructions,
|
|
7645
7768
|
tools: spec.tools ?? []
|
|
7646
|
-
}
|
|
7769
|
+
};
|
|
7770
|
+
}
|
|
7771
|
+
async function runChildAgent(spec, input, signal, maxSteps, inherited) {
|
|
7772
|
+
const { Agent: Agent2 } = await Promise.resolve().then(() => (init_agent(), agent_exports));
|
|
7773
|
+
const agent = await Agent2.create(buildChildCreateOptions(spec, inherited));
|
|
7647
7774
|
try {
|
|
7648
7775
|
const sendOptions = {
|
|
7649
7776
|
...signal !== void 0 ? { signal } : {},
|
|
@@ -9546,7 +9673,10 @@ async function runAgentLoop(inputs) {
|
|
|
9546
9673
|
}
|
|
9547
9674
|
budget.consume();
|
|
9548
9675
|
inputs.budgetTracker?.nextIteration?.();
|
|
9549
|
-
if (inputs.signal?.aborted === true)
|
|
9676
|
+
if (inputs.signal?.aborted === true) {
|
|
9677
|
+
ctx.finalStatus = "cancelled";
|
|
9678
|
+
break;
|
|
9679
|
+
}
|
|
9550
9680
|
}
|
|
9551
9681
|
if (lastTurnDecision === "continue" && budget.shouldContinue() === false) {
|
|
9552
9682
|
ctx.stoppedAtIterationLimit = true;
|
|
@@ -9731,15 +9861,15 @@ async function guardAndTransformToolResults(inputs, raw, ctx) {
|
|
|
9731
9861
|
}
|
|
9732
9862
|
async function continueOrTerminate(inputs, ctx, llmOutput) {
|
|
9733
9863
|
if (llmOutput.errored) return "error";
|
|
9734
|
-
|
|
9735
|
-
|
|
9864
|
+
const tCtx = { agentId: inputs.agentId, runId: inputs.runId };
|
|
9865
|
+
const text = llmOutput.text.length > 0 ? await transformLlmOutputText(inputs, llmOutput.text, tCtx) : llmOutput.text;
|
|
9866
|
+
if (text.length > 0) {
|
|
9867
|
+
await emitAssistantTextStep(inputs, ctx, text);
|
|
9736
9868
|
}
|
|
9737
9869
|
if (llmOutput.stopReason !== "tool_use" || llmOutput.toolCalls.length === 0) {
|
|
9738
9870
|
return finishOrReflect(inputs, ctx, llmOutput);
|
|
9739
9871
|
}
|
|
9740
|
-
|
|
9741
|
-
const outText = await transformLlmOutputText(inputs, llmOutput.text, tCtx);
|
|
9742
|
-
ctx.messages.push(buildAssistantTurn(outText, llmOutput.toolCalls));
|
|
9872
|
+
ctx.messages.push(buildAssistantTurn(text, llmOutput.toolCalls));
|
|
9743
9873
|
const rawResults = await dispatchTools(
|
|
9744
9874
|
// SE12 — forward a read-only text projection of the transcript-so-far to tool
|
|
9745
9875
|
// handlers via `ctx.messages` (consumed by defineSubAgent's messageFilter).
|
|
@@ -13077,7 +13207,12 @@ var init_client = __esm({
|
|
|
13077
13207
|
code: "mcp_http_error"
|
|
13078
13208
|
});
|
|
13079
13209
|
}
|
|
13080
|
-
|
|
13210
|
+
try {
|
|
13211
|
+
return await response.json();
|
|
13212
|
+
} catch (cause) {
|
|
13213
|
+
if (isAbortLike(cause)) throw mcpTimeoutError(this.name, timeoutMs);
|
|
13214
|
+
throw cause;
|
|
13215
|
+
}
|
|
13081
13216
|
}
|
|
13082
13217
|
};
|
|
13083
13218
|
}
|
|
@@ -13317,9 +13452,11 @@ function declarativeSubagentTools(agentOptions, parentTools) {
|
|
|
13317
13452
|
return subAgentToolsFromDefinitions(agents2, parentTools);
|
|
13318
13453
|
}
|
|
13319
13454
|
function bindParentCredentials(tools, agentOptions) {
|
|
13455
|
+
const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
|
|
13320
13456
|
const credentials = {
|
|
13321
13457
|
...agentOptions.apiKey !== void 0 ? { apiKey: agentOptions.apiKey } : {},
|
|
13322
|
-
...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {}
|
|
13458
|
+
...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {},
|
|
13459
|
+
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {}
|
|
13323
13460
|
};
|
|
13324
13461
|
for (const tool of tools) inheritSubAgentCredentials(tool, credentials);
|
|
13325
13462
|
}
|
|
@@ -15853,10 +15990,11 @@ var init_local_agent_memory = __esm({
|
|
|
15853
15990
|
}
|
|
15854
15991
|
buildTelemetryRecallArgs(telemetry) {
|
|
15855
15992
|
const userId = typeof this.options.memoryContext?.userId === "string" ? this.options.memoryContext.userId : void 0;
|
|
15993
|
+
const tenantId = typeof this.options.memoryContext?.tenantId === "string" ? this.options.memoryContext.tenantId : void 0;
|
|
15856
15994
|
return {
|
|
15857
15995
|
...telemetry !== void 0 ? { telemetry } : {},
|
|
15858
15996
|
...userId !== void 0 ? { userId } : {},
|
|
15859
|
-
namespace: "default",
|
|
15997
|
+
namespace: tenantId ?? "default",
|
|
15860
15998
|
scope: "session"
|
|
15861
15999
|
};
|
|
15862
16000
|
}
|
|
@@ -17153,7 +17291,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
17153
17291
|
userText,
|
|
17154
17292
|
baseSystemPrompt,
|
|
17155
17293
|
memoryFacts,
|
|
17156
|
-
activeMemorySummary
|
|
17294
|
+
activeMemorySummary,
|
|
17295
|
+
options.contextPaths
|
|
17157
17296
|
);
|
|
17158
17297
|
const projectedSystemPrompt = await projectCurrentObjective(
|
|
17159
17298
|
inputs.storageHandle,
|
|
@@ -18226,7 +18365,7 @@ var init_local_agent = __esm({
|
|
|
18226
18365
|
runPreHook: (ut) => this.runPreHook(ut),
|
|
18227
18366
|
// biome-ignore format: G8 budget — callbacks wire to private methods.
|
|
18228
18367
|
resolveSystemPromptForSend: (ut, o, mf) => this.resolveSystemPrompt(ut, o, mf),
|
|
18229
|
-
assembleSystemPromptForSend: (ut, bp, mf, ams) => assembleSystemPromptForSend(this.assemblyInputs(), ut, bp, mf, ams),
|
|
18368
|
+
assembleSystemPromptForSend: (ut, bp, mf, ams, cp) => assembleSystemPromptForSend(this.assemblyInputs(), ut, bp, mf, ams, cp),
|
|
18230
18369
|
dispatchRun: (msg, o, sp, mf, pm, mt, mp) => this.dispatchRun(msg, o, sp, mf, pm, mt, mp)
|
|
18231
18370
|
},
|
|
18232
18371
|
message,
|
|
@@ -22125,8 +22264,10 @@ var JobQueue = class {
|
|
|
22125
22264
|
const job = this.jobs.get(id);
|
|
22126
22265
|
if (!job) return false;
|
|
22127
22266
|
if (job.status === "pending" || job.status === "running") {
|
|
22267
|
+
const wasRunning = job.status === "running";
|
|
22128
22268
|
job.status = "cancelled";
|
|
22129
22269
|
this.controllers.get(id)?.abort();
|
|
22270
|
+
if (wasRunning) this.#release(id);
|
|
22130
22271
|
return true;
|
|
22131
22272
|
}
|
|
22132
22273
|
return false;
|
|
@@ -22144,8 +22285,14 @@ var JobQueue = class {
|
|
|
22144
22285
|
});
|
|
22145
22286
|
});
|
|
22146
22287
|
}
|
|
22147
|
-
/**
|
|
22288
|
+
/**
|
|
22289
|
+
* Release a slot + clean up the controller; start the next waiting job.
|
|
22290
|
+
* Idempotent — keyed on the controller's presence, so a running job that was
|
|
22291
|
+
* cancelled (released early) does not double-decrement when its `.finally`
|
|
22292
|
+
* eventually fires.
|
|
22293
|
+
*/
|
|
22148
22294
|
#release(id) {
|
|
22295
|
+
if (!this.controllers.has(id)) return;
|
|
22149
22296
|
this.controllers.delete(id);
|
|
22150
22297
|
this.running -= 1;
|
|
22151
22298
|
const next = this.waiting.shift();
|