@theokit/sdk 4.17.0 → 4.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/{cron-B_vVYc-_.d.ts → cron-DOW3f-Xu.d.ts} +11 -3
- package/dist/{cron-Dj8FAU5V.d.cts → cron-DvP-E6Xx.d.cts} +11 -3
- package/dist/cron.cjs +43 -13
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +43 -13
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +43 -13
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +43 -13
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +43 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +43 -13
- package/dist/index.js.map +1 -1
- package/dist/types/goal-events.d.ts +11 -3
- package/package.json +12 -13
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
@@ -6118,9 +6118,7 @@ async function hydrateSession(agentId, loc) {
|
|
|
6118
6118
|
hydratedKeys.add(key2);
|
|
6119
6119
|
const persisted = await readSessionMessages(loc.store, agentId);
|
|
6120
6120
|
if (persisted.length === 0) return;
|
|
6121
|
-
|
|
6122
|
-
sessions.set(agentId, persisted);
|
|
6123
|
-
}
|
|
6121
|
+
sessions.set(agentId, persisted);
|
|
6124
6122
|
}
|
|
6125
6123
|
async function flushSessionWrites() {
|
|
6126
6124
|
while (pendingWrites.size > 0) {
|
|
@@ -7512,10 +7510,12 @@ __export(run_until_exports, {
|
|
|
7512
7510
|
async function* runUntilImpl(agent, goal, options, deps) {
|
|
7513
7511
|
const maxTurns = options?.maxTurns ?? 20;
|
|
7514
7512
|
const maxFails = options?.maxConsecutiveJudgeFailures ?? 3;
|
|
7513
|
+
const tokenBudget = options?.tokenBudget;
|
|
7515
7514
|
const signal = options?.signal;
|
|
7516
7515
|
const isAborted = () => signal !== void 0 && signal.aborted;
|
|
7517
7516
|
let turn = 0;
|
|
7518
7517
|
let consecutiveFailures = 0;
|
|
7518
|
+
let tokensUsed = 0;
|
|
7519
7519
|
let lastResponse = "";
|
|
7520
7520
|
if (isAborted()) {
|
|
7521
7521
|
yield {
|
|
@@ -7523,13 +7523,13 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
7523
7523
|
status: "paused",
|
|
7524
7524
|
reason: "aborted via AbortSignal before first turn"
|
|
7525
7525
|
};
|
|
7526
|
-
return { status: "paused", turnsUsed: 0, finalResponse: void 0 };
|
|
7526
|
+
return { status: "paused", turnsUsed: 0, tokensUsed, finalResponse: void 0 };
|
|
7527
7527
|
}
|
|
7528
7528
|
yield { type: "status_change", status: "active", reason: "Goal started" };
|
|
7529
7529
|
while (turn < maxTurns) {
|
|
7530
7530
|
if (isAborted()) {
|
|
7531
7531
|
yield { type: "status_change", status: "paused", reason: "aborted via AbortSignal" };
|
|
7532
|
-
return { status: "paused", turnsUsed: turn, finalResponse: lastResponse || void 0 };
|
|
7532
|
+
return { status: "paused", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
|
|
7533
7533
|
}
|
|
7534
7534
|
turn += 1;
|
|
7535
7535
|
yield { type: "turn_start", turn, goal };
|
|
@@ -7537,6 +7537,8 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
7537
7537
|
const run = await agent.send(continuationPrompt);
|
|
7538
7538
|
const result = await run.wait();
|
|
7539
7539
|
lastResponse = result.result ?? "";
|
|
7540
|
+
const turnTokens = result.usage?.totalTokens;
|
|
7541
|
+
if (typeof turnTokens === "number") tokensUsed += turnTokens;
|
|
7540
7542
|
yield { type: "agent_response", turn, content: lastResponse };
|
|
7541
7543
|
const judgeOpts = {};
|
|
7542
7544
|
if (options?.judgeModel !== void 0) judgeOpts.judgeModel = options.judgeModel;
|
|
@@ -7562,6 +7564,7 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
7562
7564
|
return {
|
|
7563
7565
|
status: "failed",
|
|
7564
7566
|
turnsUsed: turn,
|
|
7567
|
+
tokensUsed,
|
|
7565
7568
|
finalResponse: lastResponse || void 0
|
|
7566
7569
|
};
|
|
7567
7570
|
}
|
|
@@ -7570,7 +7573,7 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
7570
7573
|
}
|
|
7571
7574
|
if (judgment.verdict === "done") {
|
|
7572
7575
|
yield { type: "status_change", status: "completed", reason: judgment.reason };
|
|
7573
|
-
return { status: "completed", turnsUsed: turn, finalResponse: lastResponse || void 0 };
|
|
7576
|
+
return { status: "completed", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
|
|
7574
7577
|
}
|
|
7575
7578
|
if (judgment.verdict === "skipped") {
|
|
7576
7579
|
yield {
|
|
@@ -7578,7 +7581,15 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
7578
7581
|
status: "completed",
|
|
7579
7582
|
reason: `skipped: ${judgment.reason}`
|
|
7580
7583
|
};
|
|
7581
|
-
return { status: "completed", turnsUsed: turn, finalResponse: lastResponse || void 0 };
|
|
7584
|
+
return { status: "completed", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
|
|
7585
|
+
}
|
|
7586
|
+
if (tokenBudget !== void 0 && tokensUsed >= tokenBudget) {
|
|
7587
|
+
yield {
|
|
7588
|
+
type: "status_change",
|
|
7589
|
+
status: "budget_limited",
|
|
7590
|
+
reason: `token budget (${tokenBudget}) reached: ${tokensUsed} used`
|
|
7591
|
+
};
|
|
7592
|
+
return { status: "budget_limited", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
|
|
7582
7593
|
}
|
|
7583
7594
|
yield { type: "continuation", turn, prompt: continuationPrompt };
|
|
7584
7595
|
}
|
|
@@ -7587,13 +7598,32 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
7587
7598
|
status: "failed",
|
|
7588
7599
|
reason: `max turns (${maxTurns}) exhausted`
|
|
7589
7600
|
};
|
|
7590
|
-
return { status: "failed", turnsUsed: turn, finalResponse: lastResponse || void 0 };
|
|
7601
|
+
return { status: "failed", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
|
|
7591
7602
|
}
|
|
7592
7603
|
function composeContinuation(goal, lastResponse) {
|
|
7593
|
-
return
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7604
|
+
return [
|
|
7605
|
+
"Continue working toward the active goal.",
|
|
7606
|
+
"",
|
|
7607
|
+
`<objective>
|
|
7608
|
+
${goal}
|
|
7609
|
+
</objective>`,
|
|
7610
|
+
"",
|
|
7611
|
+
"Continuation behavior:",
|
|
7612
|
+
"- This goal persists across turns. Keep the full objective intact; if it cannot be finished now,",
|
|
7613
|
+
" make concrete progress toward the real requested end state and do not redefine success around a",
|
|
7614
|
+
" smaller or easier task.",
|
|
7615
|
+
"",
|
|
7616
|
+
"Work from evidence:",
|
|
7617
|
+
"- Use the current worktree and external state as authoritative. Inspect the current state before",
|
|
7618
|
+
" relying on it. Improve, replace, or remove existing work as needed to satisfy the actual objective.",
|
|
7619
|
+
"",
|
|
7620
|
+
"Completion audit:",
|
|
7621
|
+
"- Before deciding the goal is achieved, treat completion as unproven and verify it against the actual",
|
|
7622
|
+
" current state, requirement by requirement. Treat uncertain or indirect evidence as not achieved.",
|
|
7623
|
+
"",
|
|
7624
|
+
`Your last response was:
|
|
7625
|
+
${lastResponse.slice(0, 1e3)}`
|
|
7626
|
+
].join("\n");
|
|
7597
7627
|
}
|
|
7598
7628
|
var init_run_until = __esm({
|
|
7599
7629
|
"src/internal/runtime/lifecycle/run-until.ts"() {
|
|
@@ -20207,7 +20237,7 @@ function localAgentRunUntil(agent, goal, options) {
|
|
|
20207
20237
|
status: "paused",
|
|
20208
20238
|
reason: "runUntil() requires an explicit goal (durable objectives removed in v4.0)"
|
|
20209
20239
|
};
|
|
20210
|
-
return { status: "paused", turnsUsed: 0, finalResponse: void 0 };
|
|
20240
|
+
return { status: "paused", turnsUsed: 0, tokensUsed: 0, finalResponse: void 0 };
|
|
20211
20241
|
}
|
|
20212
20242
|
return yield* runUntilImpl2(agent, goal, options, await buildDeps());
|
|
20213
20243
|
}
|