@theokit/sdk 4.17.1 → 4.18.1

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/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-gE8612p9.cjs';
2
2
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, 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-gE8612p9.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 Plugin$1, m as ProviderProfile, I as InlineSkill, B as BudgetTracker, n as MemoryProvider, o as MemoryId, p as PreToolCallDecision, q as StepResult, r as SDKProvider } from './cron-Dj8FAU5V.cjs';
4
- export { s as ActiveMemoryPassArgs, t as ActiveMemoryPassResult, u as AgentMemory, v as BudgetCheck, w as BudgetTotal, x as BudgetUsageEvent, y as CloudEnv, z as CloudRepo, D as ContextBudget, E as ContextManagerKind, F as ContextSnapshot, H as ContextSource, J as ContextSourceStatus, K as CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InvalidateCacheOptions, a3 as MemoryAdapter, a4 as MemoryAdapterCapabilities, a5 as MemoryContext, a6 as MemoryFact, a7 as MemoryProviderHandle, a8 as MemoryProviderInitOptions, a9 as MemoryRevision, aa as MemoryToolSchema, ab as MemoryTurnMessage, ac as PersonalityPreset, ad as PluginContext, ae as PostAssistantReplyContext, af as PreToolCallContext, ag as PreUserSendContext, ah as PreUserSendResult, ai as ProviderCapability, aj as ProviderRoute, ak as ProviderTransform, al as ProviderTransformContext, am as RecordSessionSummaryArgs, an as ResolvedProviderRoute, ao as RunUntilIterator, ap as SDKAgentPlugins, aq as SDKAgentSkillDetail, ar as SDKAgentSkills, as as SDKArtifact, at as SDKContextManager, au as SDKPluginMetadata, av as SDKProvidersManager, aw as SessionRecord, ax as SessionStore, ay as SettingSource, az as Skill, aA as SkillsResolver, aB as SkillsResolverContext, aC as SystemPromptContext, aD as SystemPromptMemoryFact, aE as SystemPromptSkillRef, aF as TelemetrySettings } from './cron-Dj8FAU5V.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 Plugin$1, m as ProviderProfile, I as InlineSkill, B as BudgetTracker, n as MemoryProvider, o as MemoryId, p as PreToolCallDecision, q as StepResult, r as SDKProvider } from './cron-DvP-E6Xx.cjs';
4
+ export { s as ActiveMemoryPassArgs, t as ActiveMemoryPassResult, u as AgentMemory, v as BudgetCheck, w as BudgetTotal, x as BudgetUsageEvent, y as CloudEnv, z as CloudRepo, D as ContextBudget, E as ContextManagerKind, F as ContextSnapshot, H as ContextSource, J as ContextSourceStatus, K as CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InvalidateCacheOptions, a3 as MemoryAdapter, a4 as MemoryAdapterCapabilities, a5 as MemoryContext, a6 as MemoryFact, a7 as MemoryProviderHandle, a8 as MemoryProviderInitOptions, a9 as MemoryRevision, aa as MemoryToolSchema, ab as MemoryTurnMessage, ac as PersonalityPreset, ad as PluginContext, ae as PostAssistantReplyContext, af as PreToolCallContext, ag as PreUserSendContext, ah as PreUserSendResult, ai as ProviderCapability, aj as ProviderRoute, ak as ProviderTransform, al as ProviderTransformContext, am as RecordSessionSummaryArgs, an as ResolvedProviderRoute, ao as RunUntilIterator, ap as SDKAgentPlugins, aq as SDKAgentSkillDetail, ar as SDKAgentSkills, as as SDKArtifact, at as SDKContextManager, au as SDKPluginMetadata, av as SDKProvidersManager, aw as SessionRecord, ax as SessionStore, ay as SettingSource, az as Skill, aA as SkillsResolver, aB as SkillsResolverContext, aC as SystemPromptContext, aD as SystemPromptMemoryFact, aE as SystemPromptSkillRef, aF as TelemetrySettings } from './cron-DvP-E6Xx.cjs';
5
5
  import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-DFM1H2jW.cjs';
6
6
  export { A as AgentConversationTurn, f as AssistantMessage, g as CompletionCheck, h as CompletionCheckResult, i as ConversationStep, j as ConversationTurn, k as CostBreakdown, l as CostSource, m as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, n as GenerateRunResult, I as ImageBlock, o as InputProcessorContext, p as InteractionUpdate, q as McpAuthConfig, r as McpHttpServerConfig, s as McpOAuthConfig, t as McpStdioServerConfig, u as MessageOrigin, v as ModelParameterValue, O as OutputProcessorContext, w as PartialToolCallUpdate, x as PermissionAction, y as PermissionEngineOptions, z as PermissionRule, B as ProcessorControls, E as ProcessorTripwire, F as ProcessorViolation, H as RunCompactBoundaryEvent, J as RunCompletionCheckEvent, K as RunErrorDetail, L as RunEvent, N as RunGitInfo, Q as RunOperation, U as RunPermissionDeniedEvent, V as RunRateLimitEvent, W as RunStatus, X as RunTaskCompletedEvent, Y as RunTaskStartedEvent, Z as RunTaskUpdatedEvent, _ as RunToCompletionOptions, $ as RunToCompletionResult, a0 as RunToolProgressEvent, a1 as RunTripwireEvent, a2 as SDKAssistantMessage, a3 as SDKImage, a4 as SDKImageDimension, a5 as SDKObjectDelta, a6 as SDKRequestMessage, a7 as SDKStatusMessage, a8 as SDKSystemMessage, a9 as SDKTaskMessage, aa as SDKThinkingMessage, ab as SDKToolUseMessage, ac as SDKUserMessage, ad as SDKUserMessageEvent, ae as SendOptions, af as ShellCommand, ag as ShellConversationTurn, ah as ShellOutput, ai as ShellOutputDeltaUpdate, aj as StepCompletedUpdate, ak as StepStartedUpdate, al as StreamToCompletionResult, am as SummaryCompletedUpdate, an as SummaryStartedUpdate, ao as SummaryUpdate, ap as TextBlock, aq as TextDeltaUpdate, ar as ThinkingCompletedUpdate, as as ThinkingDeltaUpdate, at as ThinkingMessage, au as TokenDeltaUpdate, av as TokenUsage, aw as ToolCall, ax as ToolCallCompletedUpdate, ay as ToolCallStartedUpdate, az as ToolContextMessage, aA as ToolResult, aB as ToolResultGuardOptions, aC as ToolUseBlock, aD as TurnEndedUpdate, aE as UserMessage, aF as UserMessageAppendedUpdate, aG as applyMode, aH as emitRunEvent } from './run-DFM1H2jW.cjs';
7
7
  import * as zod from 'zod';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-CG2RpeW-.js';
2
2
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, 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-CG2RpeW-.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 Plugin$1, m as ProviderProfile, I as InlineSkill, B as BudgetTracker, n as MemoryProvider, o as MemoryId, p as PreToolCallDecision, q as StepResult, r as SDKProvider } from './cron-B_vVYc-_.js';
4
- export { s as ActiveMemoryPassArgs, t as ActiveMemoryPassResult, u as AgentMemory, v as BudgetCheck, w as BudgetTotal, x as BudgetUsageEvent, y as CloudEnv, z as CloudRepo, D as ContextBudget, E as ContextManagerKind, F as ContextSnapshot, H as ContextSource, J as ContextSourceStatus, K as CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InvalidateCacheOptions, a3 as MemoryAdapter, a4 as MemoryAdapterCapabilities, a5 as MemoryContext, a6 as MemoryFact, a7 as MemoryProviderHandle, a8 as MemoryProviderInitOptions, a9 as MemoryRevision, aa as MemoryToolSchema, ab as MemoryTurnMessage, ac as PersonalityPreset, ad as PluginContext, ae as PostAssistantReplyContext, af as PreToolCallContext, ag as PreUserSendContext, ah as PreUserSendResult, ai as ProviderCapability, aj as ProviderRoute, ak as ProviderTransform, al as ProviderTransformContext, am as RecordSessionSummaryArgs, an as ResolvedProviderRoute, ao as RunUntilIterator, ap as SDKAgentPlugins, aq as SDKAgentSkillDetail, ar as SDKAgentSkills, as as SDKArtifact, at as SDKContextManager, au as SDKPluginMetadata, av as SDKProvidersManager, aw as SessionRecord, ax as SessionStore, ay as SettingSource, az as Skill, aA as SkillsResolver, aB as SkillsResolverContext, aC as SystemPromptContext, aD as SystemPromptMemoryFact, aE as SystemPromptSkillRef, aF as TelemetrySettings } from './cron-B_vVYc-_.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 Plugin$1, m as ProviderProfile, I as InlineSkill, B as BudgetTracker, n as MemoryProvider, o as MemoryId, p as PreToolCallDecision, q as StepResult, r as SDKProvider } from './cron-DOW3f-Xu.js';
4
+ export { s as ActiveMemoryPassArgs, t as ActiveMemoryPassResult, u as AgentMemory, v as BudgetCheck, w as BudgetTotal, x as BudgetUsageEvent, y as CloudEnv, z as CloudRepo, D as ContextBudget, E as ContextManagerKind, F as ContextSnapshot, H as ContextSource, J as ContextSourceStatus, K as CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InvalidateCacheOptions, a3 as MemoryAdapter, a4 as MemoryAdapterCapabilities, a5 as MemoryContext, a6 as MemoryFact, a7 as MemoryProviderHandle, a8 as MemoryProviderInitOptions, a9 as MemoryRevision, aa as MemoryToolSchema, ab as MemoryTurnMessage, ac as PersonalityPreset, ad as PluginContext, ae as PostAssistantReplyContext, af as PreToolCallContext, ag as PreUserSendContext, ah as PreUserSendResult, ai as ProviderCapability, aj as ProviderRoute, ak as ProviderTransform, al as ProviderTransformContext, am as RecordSessionSummaryArgs, an as ResolvedProviderRoute, ao as RunUntilIterator, ap as SDKAgentPlugins, aq as SDKAgentSkillDetail, ar as SDKAgentSkills, as as SDKArtifact, at as SDKContextManager, au as SDKPluginMetadata, av as SDKProvidersManager, aw as SessionRecord, ax as SessionStore, ay as SettingSource, az as Skill, aA as SkillsResolver, aB as SkillsResolverContext, aC as SystemPromptContext, aD as SystemPromptMemoryFact, aE as SystemPromptSkillRef, aF as TelemetrySettings } from './cron-DOW3f-Xu.js';
5
5
  import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-DFM1H2jW.js';
6
6
  export { A as AgentConversationTurn, f as AssistantMessage, g as CompletionCheck, h as CompletionCheckResult, i as ConversationStep, j as ConversationTurn, k as CostBreakdown, l as CostSource, m as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, n as GenerateRunResult, I as ImageBlock, o as InputProcessorContext, p as InteractionUpdate, q as McpAuthConfig, r as McpHttpServerConfig, s as McpOAuthConfig, t as McpStdioServerConfig, u as MessageOrigin, v as ModelParameterValue, O as OutputProcessorContext, w as PartialToolCallUpdate, x as PermissionAction, y as PermissionEngineOptions, z as PermissionRule, B as ProcessorControls, E as ProcessorTripwire, F as ProcessorViolation, H as RunCompactBoundaryEvent, J as RunCompletionCheckEvent, K as RunErrorDetail, L as RunEvent, N as RunGitInfo, Q as RunOperation, U as RunPermissionDeniedEvent, V as RunRateLimitEvent, W as RunStatus, X as RunTaskCompletedEvent, Y as RunTaskStartedEvent, Z as RunTaskUpdatedEvent, _ as RunToCompletionOptions, $ as RunToCompletionResult, a0 as RunToolProgressEvent, a1 as RunTripwireEvent, a2 as SDKAssistantMessage, a3 as SDKImage, a4 as SDKImageDimension, a5 as SDKObjectDelta, a6 as SDKRequestMessage, a7 as SDKStatusMessage, a8 as SDKSystemMessage, a9 as SDKTaskMessage, aa as SDKThinkingMessage, ab as SDKToolUseMessage, ac as SDKUserMessage, ad as SDKUserMessageEvent, ae as SendOptions, af as ShellCommand, ag as ShellConversationTurn, ah as ShellOutput, ai as ShellOutputDeltaUpdate, aj as StepCompletedUpdate, ak as StepStartedUpdate, al as StreamToCompletionResult, am as SummaryCompletedUpdate, an as SummaryStartedUpdate, ao as SummaryUpdate, ap as TextBlock, aq as TextDeltaUpdate, ar as ThinkingCompletedUpdate, as as ThinkingDeltaUpdate, at as ThinkingMessage, au as TokenDeltaUpdate, av as TokenUsage, aw as ToolCall, ax as ToolCallCompletedUpdate, ay as ToolCallStartedUpdate, az as ToolContextMessage, aA as ToolResult, aB as ToolResultGuardOptions, aC as ToolUseBlock, aD as TurnEndedUpdate, aE as UserMessage, aF as UserMessageAppendedUpdate, aG as applyMode, aH as emitRunEvent } from './run-DFM1H2jW.js';
7
7
  import * as zod from 'zod';
package/dist/index.js CHANGED
@@ -7510,10 +7510,12 @@ __export(run_until_exports, {
7510
7510
  async function* runUntilImpl(agent, goal, options, deps) {
7511
7511
  const maxTurns = options?.maxTurns ?? 20;
7512
7512
  const maxFails = options?.maxConsecutiveJudgeFailures ?? 3;
7513
+ const tokenBudget = options?.tokenBudget;
7513
7514
  const signal = options?.signal;
7514
7515
  const isAborted = () => signal !== void 0 && signal.aborted;
7515
7516
  let turn = 0;
7516
7517
  let consecutiveFailures = 0;
7518
+ let tokensUsed = 0;
7517
7519
  let lastResponse = "";
7518
7520
  if (isAborted()) {
7519
7521
  yield {
@@ -7521,20 +7523,44 @@ async function* runUntilImpl(agent, goal, options, deps) {
7521
7523
  status: "paused",
7522
7524
  reason: "aborted via AbortSignal before first turn"
7523
7525
  };
7524
- return { status: "paused", turnsUsed: 0, finalResponse: void 0 };
7526
+ return { status: "paused", turnsUsed: 0, tokensUsed, finalResponse: void 0 };
7525
7527
  }
7526
7528
  yield { type: "status_change", status: "active", reason: "Goal started" };
7527
7529
  while (turn < maxTurns) {
7528
7530
  if (isAborted()) {
7529
7531
  yield { type: "status_change", status: "paused", reason: "aborted via AbortSignal" };
7530
- return { status: "paused", turnsUsed: turn, finalResponse: lastResponse || void 0 };
7532
+ return {
7533
+ status: "paused",
7534
+ turnsUsed: turn,
7535
+ tokensUsed,
7536
+ finalResponse: lastResponse || void 0
7537
+ };
7531
7538
  }
7532
7539
  turn += 1;
7533
7540
  yield { type: "turn_start", turn, goal };
7534
7541
  const continuationPrompt = turn === 1 ? goal : composeContinuation(goal, lastResponse);
7535
7542
  const run = await agent.send(continuationPrompt);
7543
+ const cancelOnAbort = () => {
7544
+ void run.cancel?.();
7545
+ };
7546
+ if (signal !== void 0) {
7547
+ if (signal.aborted) cancelOnAbort();
7548
+ else signal.addEventListener("abort", cancelOnAbort, { once: true });
7549
+ }
7536
7550
  const result = await run.wait();
7551
+ if (signal !== void 0) signal.removeEventListener("abort", cancelOnAbort);
7537
7552
  lastResponse = result.result ?? "";
7553
+ const turnTokens = result.usage?.totalTokens;
7554
+ if (typeof turnTokens === "number") tokensUsed += turnTokens;
7555
+ if (isAborted()) {
7556
+ yield { type: "status_change", status: "paused", reason: "aborted via AbortSignal" };
7557
+ return {
7558
+ status: "paused",
7559
+ turnsUsed: turn,
7560
+ tokensUsed,
7561
+ finalResponse: lastResponse || void 0
7562
+ };
7563
+ }
7538
7564
  yield { type: "agent_response", turn, content: lastResponse };
7539
7565
  const judgeOpts = {};
7540
7566
  if (options?.judgeModel !== void 0) judgeOpts.judgeModel = options.judgeModel;
@@ -7560,6 +7586,7 @@ async function* runUntilImpl(agent, goal, options, deps) {
7560
7586
  return {
7561
7587
  status: "failed",
7562
7588
  turnsUsed: turn,
7589
+ tokensUsed,
7563
7590
  finalResponse: lastResponse || void 0
7564
7591
  };
7565
7592
  }
@@ -7568,7 +7595,12 @@ async function* runUntilImpl(agent, goal, options, deps) {
7568
7595
  }
7569
7596
  if (judgment.verdict === "done") {
7570
7597
  yield { type: "status_change", status: "completed", reason: judgment.reason };
7571
- return { status: "completed", turnsUsed: turn, finalResponse: lastResponse || void 0 };
7598
+ return {
7599
+ status: "completed",
7600
+ turnsUsed: turn,
7601
+ tokensUsed,
7602
+ finalResponse: lastResponse || void 0
7603
+ };
7572
7604
  }
7573
7605
  if (judgment.verdict === "skipped") {
7574
7606
  yield {
@@ -7576,7 +7608,25 @@ async function* runUntilImpl(agent, goal, options, deps) {
7576
7608
  status: "completed",
7577
7609
  reason: `skipped: ${judgment.reason}`
7578
7610
  };
7579
- return { status: "completed", turnsUsed: turn, finalResponse: lastResponse || void 0 };
7611
+ return {
7612
+ status: "completed",
7613
+ turnsUsed: turn,
7614
+ tokensUsed,
7615
+ finalResponse: lastResponse || void 0
7616
+ };
7617
+ }
7618
+ if (tokenBudget !== void 0 && tokensUsed >= tokenBudget) {
7619
+ yield {
7620
+ type: "status_change",
7621
+ status: "budget_limited",
7622
+ reason: `token budget (${tokenBudget}) reached: ${tokensUsed} used`
7623
+ };
7624
+ return {
7625
+ status: "budget_limited",
7626
+ turnsUsed: turn,
7627
+ tokensUsed,
7628
+ finalResponse: lastResponse || void 0
7629
+ };
7580
7630
  }
7581
7631
  yield { type: "continuation", turn, prompt: continuationPrompt };
7582
7632
  }
@@ -7585,13 +7635,37 @@ async function* runUntilImpl(agent, goal, options, deps) {
7585
7635
  status: "failed",
7586
7636
  reason: `max turns (${maxTurns}) exhausted`
7587
7637
  };
7588
- return { status: "failed", turnsUsed: turn, finalResponse: lastResponse || void 0 };
7638
+ return {
7639
+ status: "failed",
7640
+ turnsUsed: turn,
7641
+ tokensUsed,
7642
+ finalResponse: lastResponse || void 0
7643
+ };
7589
7644
  }
7590
7645
  function composeContinuation(goal, lastResponse) {
7591
- return `Continue working toward the goal: ${goal}
7592
-
7593
- Your last response was:
7594
- ${lastResponse.slice(0, 1e3)}`;
7646
+ return [
7647
+ "Continue working toward the active goal.",
7648
+ "",
7649
+ `<objective>
7650
+ ${goal}
7651
+ </objective>`,
7652
+ "",
7653
+ "Continuation behavior:",
7654
+ "- This goal persists across turns. Keep the full objective intact; if it cannot be finished now,",
7655
+ " make concrete progress toward the real requested end state and do not redefine success around a",
7656
+ " smaller or easier task.",
7657
+ "",
7658
+ "Work from evidence:",
7659
+ "- Use the current worktree and external state as authoritative. Inspect the current state before",
7660
+ " relying on it. Improve, replace, or remove existing work as needed to satisfy the actual objective.",
7661
+ "",
7662
+ "Completion audit:",
7663
+ "- Before deciding the goal is achieved, treat completion as unproven and verify it against the actual",
7664
+ " current state, requirement by requirement. Treat uncertain or indirect evidence as not achieved.",
7665
+ "",
7666
+ `Your last response was:
7667
+ ${lastResponse.slice(0, 1e3)}`
7668
+ ].join("\n");
7595
7669
  }
7596
7670
  var init_run_until = __esm({
7597
7671
  "src/internal/runtime/lifecycle/run-until.ts"() {
@@ -20205,7 +20279,7 @@ function localAgentRunUntil(agent, goal, options) {
20205
20279
  status: "paused",
20206
20280
  reason: "runUntil() requires an explicit goal (durable objectives removed in v4.0)"
20207
20281
  };
20208
- return { status: "paused", turnsUsed: 0, finalResponse: void 0 };
20282
+ return { status: "paused", turnsUsed: 0, tokensUsed: 0, finalResponse: void 0 };
20209
20283
  }
20210
20284
  return yield* runUntilImpl2(agent, goal, options, await buildDeps());
20211
20285
  }