@theokit/sdk 4.18.0 → 4.19.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.
@@ -2579,4 +2579,4 @@ declare class Cron {
2579
2579
  static status(_options?: CronStartOptions): Promise<CronSchedulerStatus>;
2580
2580
  }
2581
2581
 
2582
- export { type GoalOptions as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type ContextBudget as D, type ContextManagerKind as E, type ContextSnapshot as F, type GetAgentOptions as G, type ContextSource as H, type InlineSkill as I, type ContextSourceStatus as J, type CreateSkillSpec as K, type LocalOptions as L, type MemorySettings as M, Cron as N, type CronCreateOptions as O, type ProviderRoutingSettings as P, type CronGetOptions as Q, type CronJob as R, type SystemPromptResolver as S, type CronJobStatus as T, type CronListOptions as U, type CronOperationOptions as V, type CronRunOptions as W, type CronRuntime as X, type CronSchedulerStatus as Y, type CronStartOptions as Z, type GoalEvent as _, type AgentDefinition as a, type GoalResult as a0, type HookName as a1, type InvalidateCacheOptions as a2, type MemoryAdapter as a3, type MemoryAdapterCapabilities as a4, type MemoryContext as a5, type MemoryFact as a6, type MemoryProviderHandle as a7, type MemoryProviderInitOptions as a8, type MemoryRevision as a9, type SkillsResolver as aA, type SkillsResolverContext as aB, type SystemPromptContext as aC, type SystemPromptMemoryFact as aD, type SystemPromptSkillRef as aE, type TelemetrySettings as aF, type MemoryToolSchema as aa, type MemoryTurnMessage as ab, type PersonalityPreset as ac, type PluginContext as ad, type PostAssistantReplyContext as ae, type PreToolCallContext as af, type PreUserSendContext as ag, type PreUserSendResult as ah, type ProviderCapability as ai, type ProviderRoute as aj, type ProviderTransform as ak, type ProviderTransformContext as al, type RecordSessionSummaryArgs as am, type ResolvedProviderRoute as an, type RunUntilIterator as ao, type SDKAgentPlugins as ap, type SDKAgentSkillDetail as aq, type SDKAgentSkills as ar, type SDKArtifact as as, type SDKContextManager as at, type SDKPluginMetadata as au, type SDKProvidersManager as av, type SessionRecord as aw, type SessionStore as ax, type SettingSource as ay, Skill as az, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type Plugin as l, type ProviderProfile as m, type MemoryProvider as n, type MemoryId as o, type PreToolCallDecision as p, type StepResult as q, type SDKProvider as r, type ActiveMemoryPassArgs as s, type ActiveMemoryPassResult as t, type AgentMemory as u, type BudgetCheck as v, type BudgetTotal as w, type BudgetUsageEvent as x, type CloudEnv as y, type CloudRepo as z };
2582
+ export { type CronSchedulerStatus as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type BudgetUsageEvent as D, type CloudEnv as E, type CloudRepo as F, type GetAgentOptions as G, type ContextBudget as H, type InlineSkill as I, type ContextManagerKind as J, type ContextSnapshot as K, type LocalOptions as L, type MemorySettings as M, type ContextSource as N, type ContextSourceStatus as O, type ProviderRoutingSettings as P, type CreateSkillSpec as Q, Cron as R, type SystemPromptResolver as S, type CronCreateOptions as T, type CronGetOptions as U, type CronJob as V, type CronJobStatus as W, type CronListOptions as X, type CronOperationOptions as Y, type CronRunOptions as Z, type CronRuntime as _, type AgentDefinition as a, type CronStartOptions as a0, type HookName as a1, type InvalidateCacheOptions as a2, type MemoryAdapter as a3, type MemoryAdapterCapabilities as a4, type MemoryContext as a5, type MemoryFact as a6, type MemoryProviderHandle as a7, type MemoryProviderInitOptions as a8, type MemoryRevision as a9, type SkillsResolver as aA, type SkillsResolverContext as aB, type SystemPromptContext as aC, type SystemPromptMemoryFact as aD, type SystemPromptSkillRef as aE, type TelemetrySettings as aF, type MemoryToolSchema as aa, type MemoryTurnMessage as ab, type PersonalityPreset as ac, type PluginContext as ad, type PostAssistantReplyContext as ae, type PreToolCallContext as af, type PreUserSendContext as ag, type PreUserSendResult as ah, type ProviderCapability as ai, type ProviderRoute as aj, type ProviderTransform as ak, type ProviderTransformContext as al, type RecordSessionSummaryArgs as am, type ResolvedProviderRoute as an, type RunUntilIterator as ao, type SDKAgentPlugins as ap, type SDKAgentSkillDetail as aq, type SDKAgentSkills as ar, type SDKArtifact as as, type SDKContextManager as at, type SDKPluginMetadata as au, type SDKProvidersManager as av, type SessionRecord as aw, type SessionStore as ax, type SettingSource as ay, Skill as az, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type GoalOptions as l, type GoalEvent as m, type GoalResult as n, type Plugin as o, type ProviderProfile as p, type MemoryProvider as q, type MemoryId as r, type PreToolCallDecision as s, type StepResult as t, type SDKProvider as u, type ActiveMemoryPassArgs as v, type ActiveMemoryPassResult as w, type AgentMemory as x, type BudgetCheck as y, type BudgetTotal as z };
@@ -2579,4 +2579,4 @@ declare class Cron {
2579
2579
  static status(_options?: CronStartOptions): Promise<CronSchedulerStatus>;
2580
2580
  }
2581
2581
 
2582
- export { type GoalOptions as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type ContextBudget as D, type ContextManagerKind as E, type ContextSnapshot as F, type GetAgentOptions as G, type ContextSource as H, type InlineSkill as I, type ContextSourceStatus as J, type CreateSkillSpec as K, type LocalOptions as L, type MemorySettings as M, Cron as N, type CronCreateOptions as O, type ProviderRoutingSettings as P, type CronGetOptions as Q, type CronJob as R, type SystemPromptResolver as S, type CronJobStatus as T, type CronListOptions as U, type CronOperationOptions as V, type CronRunOptions as W, type CronRuntime as X, type CronSchedulerStatus as Y, type CronStartOptions as Z, type GoalEvent as _, type AgentDefinition as a, type GoalResult as a0, type HookName as a1, type InvalidateCacheOptions as a2, type MemoryAdapter as a3, type MemoryAdapterCapabilities as a4, type MemoryContext as a5, type MemoryFact as a6, type MemoryProviderHandle as a7, type MemoryProviderInitOptions as a8, type MemoryRevision as a9, type SkillsResolver as aA, type SkillsResolverContext as aB, type SystemPromptContext as aC, type SystemPromptMemoryFact as aD, type SystemPromptSkillRef as aE, type TelemetrySettings as aF, type MemoryToolSchema as aa, type MemoryTurnMessage as ab, type PersonalityPreset as ac, type PluginContext as ad, type PostAssistantReplyContext as ae, type PreToolCallContext as af, type PreUserSendContext as ag, type PreUserSendResult as ah, type ProviderCapability as ai, type ProviderRoute as aj, type ProviderTransform as ak, type ProviderTransformContext as al, type RecordSessionSummaryArgs as am, type ResolvedProviderRoute as an, type RunUntilIterator as ao, type SDKAgentPlugins as ap, type SDKAgentSkillDetail as aq, type SDKAgentSkills as ar, type SDKArtifact as as, type SDKContextManager as at, type SDKPluginMetadata as au, type SDKProvidersManager as av, type SessionRecord as aw, type SessionStore as ax, type SettingSource as ay, Skill as az, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type Plugin as l, type ProviderProfile as m, type MemoryProvider as n, type MemoryId as o, type PreToolCallDecision as p, type StepResult as q, type SDKProvider as r, type ActiveMemoryPassArgs as s, type ActiveMemoryPassResult as t, type AgentMemory as u, type BudgetCheck as v, type BudgetTotal as w, type BudgetUsageEvent as x, type CloudEnv as y, type CloudRepo as z };
2582
+ export { type CronSchedulerStatus as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type BudgetUsageEvent as D, type CloudEnv as E, type CloudRepo as F, type GetAgentOptions as G, type ContextBudget as H, type InlineSkill as I, type ContextManagerKind as J, type ContextSnapshot as K, type LocalOptions as L, type MemorySettings as M, type ContextSource as N, type ContextSourceStatus as O, type ProviderRoutingSettings as P, type CreateSkillSpec as Q, Cron as R, type SystemPromptResolver as S, type CronCreateOptions as T, type CronGetOptions as U, type CronJob as V, type CronJobStatus as W, type CronListOptions as X, type CronOperationOptions as Y, type CronRunOptions as Z, type CronRuntime as _, type AgentDefinition as a, type CronStartOptions as a0, type HookName as a1, type InvalidateCacheOptions as a2, type MemoryAdapter as a3, type MemoryAdapterCapabilities as a4, type MemoryContext as a5, type MemoryFact as a6, type MemoryProviderHandle as a7, type MemoryProviderInitOptions as a8, type MemoryRevision as a9, type SkillsResolver as aA, type SkillsResolverContext as aB, type SystemPromptContext as aC, type SystemPromptMemoryFact as aD, type SystemPromptSkillRef as aE, type TelemetrySettings as aF, type MemoryToolSchema as aa, type MemoryTurnMessage as ab, type PersonalityPreset as ac, type PluginContext as ad, type PostAssistantReplyContext as ae, type PreToolCallContext as af, type PreUserSendContext as ag, type PreUserSendResult as ah, type ProviderCapability as ai, type ProviderRoute as aj, type ProviderTransform as ak, type ProviderTransformContext as al, type RecordSessionSummaryArgs as am, type ResolvedProviderRoute as an, type RunUntilIterator as ao, type SDKAgentPlugins as ap, type SDKAgentSkillDetail as aq, type SDKAgentSkills as ar, type SDKArtifact as as, type SDKContextManager as at, type SDKPluginMetadata as au, type SDKProvidersManager as av, type SessionRecord as aw, type SessionStore as ax, type SettingSource as ay, Skill as az, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type GoalOptions as l, type GoalEvent as m, type GoalResult as n, type Plugin as o, type ProviderProfile as p, type MemoryProvider as q, type MemoryId as r, type PreToolCallDecision as s, type StepResult as t, type SDKProvider as u, type ActiveMemoryPassArgs as v, type ActiveMemoryPassResult as w, type AgentMemory as x, type BudgetCheck as y, type BudgetTotal as z };
package/dist/cron.cjs CHANGED
@@ -6275,16 +6275,38 @@ async function* runUntilImpl(agent, goal, options, deps) {
6275
6275
  while (turn < maxTurns) {
6276
6276
  if (isAborted()) {
6277
6277
  yield { type: "status_change", status: "paused", reason: "aborted via AbortSignal" };
6278
- return { status: "paused", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
6278
+ return {
6279
+ status: "paused",
6280
+ turnsUsed: turn,
6281
+ tokensUsed,
6282
+ finalResponse: lastResponse || void 0
6283
+ };
6279
6284
  }
6280
6285
  turn += 1;
6281
6286
  yield { type: "turn_start", turn, goal };
6282
6287
  const continuationPrompt = turn === 1 ? goal : composeContinuation(goal, lastResponse);
6283
6288
  const run = await agent.send(continuationPrompt);
6289
+ const cancelOnAbort = () => {
6290
+ void run.cancel?.();
6291
+ };
6292
+ if (signal !== void 0) {
6293
+ if (signal.aborted) cancelOnAbort();
6294
+ else signal.addEventListener("abort", cancelOnAbort, { once: true });
6295
+ }
6284
6296
  const result = await run.wait();
6297
+ if (signal !== void 0) signal.removeEventListener("abort", cancelOnAbort);
6285
6298
  lastResponse = result.result ?? "";
6286
6299
  const turnTokens = result.usage?.totalTokens;
6287
6300
  if (typeof turnTokens === "number") tokensUsed += turnTokens;
6301
+ if (isAborted()) {
6302
+ yield { type: "status_change", status: "paused", reason: "aborted via AbortSignal" };
6303
+ return {
6304
+ status: "paused",
6305
+ turnsUsed: turn,
6306
+ tokensUsed,
6307
+ finalResponse: lastResponse || void 0
6308
+ };
6309
+ }
6288
6310
  yield { type: "agent_response", turn, content: lastResponse };
6289
6311
  const judgeOpts = {};
6290
6312
  if (options?.judgeModel !== void 0) judgeOpts.judgeModel = options.judgeModel;
@@ -6319,7 +6341,12 @@ async function* runUntilImpl(agent, goal, options, deps) {
6319
6341
  }
6320
6342
  if (judgment.verdict === "done") {
6321
6343
  yield { type: "status_change", status: "completed", reason: judgment.reason };
6322
- return { status: "completed", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
6344
+ return {
6345
+ status: "completed",
6346
+ turnsUsed: turn,
6347
+ tokensUsed,
6348
+ finalResponse: lastResponse || void 0
6349
+ };
6323
6350
  }
6324
6351
  if (judgment.verdict === "skipped") {
6325
6352
  yield {
@@ -6327,7 +6354,12 @@ async function* runUntilImpl(agent, goal, options, deps) {
6327
6354
  status: "completed",
6328
6355
  reason: `skipped: ${judgment.reason}`
6329
6356
  };
6330
- return { status: "completed", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
6357
+ return {
6358
+ status: "completed",
6359
+ turnsUsed: turn,
6360
+ tokensUsed,
6361
+ finalResponse: lastResponse || void 0
6362
+ };
6331
6363
  }
6332
6364
  if (tokenBudget !== void 0 && tokensUsed >= tokenBudget) {
6333
6365
  yield {
@@ -6335,7 +6367,12 @@ async function* runUntilImpl(agent, goal, options, deps) {
6335
6367
  status: "budget_limited",
6336
6368
  reason: `token budget (${tokenBudget}) reached: ${tokensUsed} used`
6337
6369
  };
6338
- return { status: "budget_limited", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
6370
+ return {
6371
+ status: "budget_limited",
6372
+ turnsUsed: turn,
6373
+ tokensUsed,
6374
+ finalResponse: lastResponse || void 0
6375
+ };
6339
6376
  }
6340
6377
  yield { type: "continuation", turn, prompt: continuationPrompt };
6341
6378
  }
@@ -6344,7 +6381,12 @@ async function* runUntilImpl(agent, goal, options, deps) {
6344
6381
  status: "failed",
6345
6382
  reason: `max turns (${maxTurns}) exhausted`
6346
6383
  };
6347
- return { status: "failed", turnsUsed: turn, tokensUsed, finalResponse: lastResponse || void 0 };
6384
+ return {
6385
+ status: "failed",
6386
+ turnsUsed: turn,
6387
+ tokensUsed,
6388
+ finalResponse: lastResponse || void 0
6389
+ };
6348
6390
  }
6349
6391
  function composeContinuation(goal, lastResponse) {
6350
6392
  return [