agent-afk 5.321.3 → 5.321.5

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.
@@ -7,11 +7,12 @@ export interface ExpireHandoffOpts {
7
7
  queueDir?: string;
8
8
  ttlMs?: number;
9
9
  now?: number;
10
+ isInFlight?: (taskId: string) => boolean;
10
11
  }
11
12
  export declare function isHandoffStale(record: Pick<HandoffRecord, 'createdAt'>, now: number, ttlMs?: number): boolean;
12
13
  export declare function expireHandoff(taskId: string, opts?: ExpireHandoffOpts): Promise<boolean>;
13
14
  export declare function expireStaleHandoffs(opts?: ExpireHandoffOpts): Promise<number>;
14
- export declare function sweepExpiredHandoffs(queueDir: string, now?: number, handoffsDir?: string): void;
15
+ export declare function sweepExpiredHandoffs(queueDir: string, now?: number, handoffsDir?: string, isInFlight?: (taskId: string) => boolean): void;
15
16
  export declare function resetExpirySweepThrottleForTests(): void;
16
17
  export declare function expiryNoticeRoute(route: unknown): {
17
18
  target: number;
@@ -8,6 +8,8 @@ export interface HandoffMaintenanceOpts {
8
8
  handoffsDir?: string;
9
9
  bot?: Telegraf;
10
10
  drainResumeQueue: (resumeDir: string) => Promise<void>;
11
+ recoverMainQueue?: () => void;
12
+ isInFlight?: (taskId: string) => boolean;
11
13
  intervalMs?: number;
12
14
  }
13
15
  export interface HandoffMaintenanceHandle {
@@ -0,0 +1,2 @@
1
+ import { type TaskRecord } from './task-lifecycle.js';
2
+ export declare function reclaimSingleLease(taskId: string, queueDir?: string, isInFlight?: (taskId: string) => boolean): TaskRecord | null;
@@ -7,3 +7,4 @@ export declare function completeTask(taskId: string, status: 'succeeded' | 'fail
7
7
  export declare function recoverExpiredLeases(queueDir?: string): TaskRecord[];
8
8
  export declare function getTaskRecord(taskId: string, queueDir?: string): TaskRecord | null;
9
9
  export declare function listActiveTasks(queueDir?: string): TaskRecord[];
10
+ export declare function reEnqueueRecord(record: TaskRecord, queueDir: string): void;
@@ -44,6 +44,7 @@ export declare class SubagentManager {
44
44
  get(id: string): SubagentHandle | undefined;
45
45
  onChildAborted(listener: ChildAbortedListener): () => void;
46
46
  setOnSubagentSucceeded(cb: (usage: import('./subagent/result.js').SubagentTrace['usage'], costUsd: number | undefined) => void): void;
47
+ reportSubagentCompletion(...args: Parameters<NonNullable<SubagentManagerOptions['onSubagentSucceeded']>>): void;
47
48
  setOutputEventSink(sink: (event: OutputEvent) => void): void;
48
49
  setCwd(cwd: string): void;
49
50
  setTraceWriter(writer: TraceSink | undefined): void;
@@ -43,7 +43,7 @@ export interface BuildComposeNodeProviderOpts {
43
43
  namedAgentAllowedTools?: string[];
44
44
  }
45
45
  export declare function buildComposeNodeProvider(model: AgentModelInput | undefined, workspaceStore: WorkspaceStore | undefined, opts?: BuildComposeNodeProviderOpts): ModelProvider;
46
- export declare function createChildSkillExecutorFactory(defaultModel: AgentModelInput, apiKey: string | undefined, childProviderFactory: (args: ChildProviderFactoryArgs) => ModelProvider, baseUrl?: string, traceWriter?: TraceSink, backgroundRegistry?: BackgroundAgentRegistry, cwd?: string, resolveApiKeyForModel?: (model: string) => string | undefined, surface?: Surface, defaultSubagentModel?: AgentModelInput, agentRegistry?: AgentRegistry, openaiBaseUrl?: string, xaiBaseUrl?: string, workspaceStore?: WorkspaceStore, delegationBudget?: import('./delegation-budget.js').DelegationBudget, pluginConfigs?: SdkPluginConfig[], skillAllowlist?: readonly string[], hookRegistry?: HookRegistry): (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent, rootSessionId?: string) => SkillExecutor;
46
+ export declare function createChildSkillExecutorFactory(defaultModel: AgentModelInput, apiKey: string | undefined, childProviderFactory: (args: ChildProviderFactoryArgs) => ModelProvider, baseUrl?: string, traceWriter?: TraceSink, backgroundRegistry?: BackgroundAgentRegistry, cwd?: string, resolveApiKeyForModel?: (model: string) => string | undefined, surface?: Surface, defaultSubagentModel?: AgentModelInput, agentRegistry?: AgentRegistry, openaiBaseUrl?: string, xaiBaseUrl?: string, workspaceStore?: WorkspaceStore, delegationBudget?: import('./delegation-budget.js').DelegationBudget, pluginConfigs?: SdkPluginConfig[], skillAllowlist?: readonly string[], hookRegistry?: HookRegistry, onSubagentSucceeded?: import('../subagent/fork-types.js').SubagentManagerOptions['onSubagentSucceeded']): (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent, rootSessionId?: string) => SkillExecutor;
47
47
  export type PhaseRole = 'read-only' | 'read-write';
48
48
  export declare function buildSkillRestrictedProvider(allowedTools: string[], model: AgentModelInput | undefined, readOnlyBash?: boolean, openaiBaseUrl?: string, workspaceStore?: WorkspaceStore): ModelProvider;
49
49
  export declare function buildPhaseRestrictedProvider(_role: 'read-only', model: AgentModelInput | undefined): ModelProvider;
@@ -22,6 +22,7 @@ export interface SkillExecutorContext {
22
22
  pluginConfigs?: SdkPluginConfig[];
23
23
  skillAllowlist?: readonly string[];
24
24
  hookRegistry?: HookRegistry;
25
+ onSubagentSucceeded?: import('../../subagent/fork-types.js').SubagentManagerOptions['onSubagentSucceeded'];
25
26
  depth?: number;
26
27
  maxDepth?: number;
27
28
  childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
@@ -37,6 +37,7 @@ export interface BuildChildConfigArgs {
37
37
  agentRegistry?: AgentRegistry;
38
38
  parentModel?: AgentModelInput;
39
39
  traceWriter?: TraceSink;
40
+ onSubagentSucceeded?: import('../../subagent/fork-types.js').SubagentManagerOptions['onSubagentSucceeded'];
40
41
  workspaceStore?: import('../../workspace/index.js').WorkspaceStore;
41
42
  delegationBudget?: import('../../tools/delegation-budget.js').DelegationBudget;
42
43
  hookRegistry?: import('../../hooks.js').HookRegistry;
@@ -43,6 +43,6 @@ interface WireChildNestingArgs {
43
43
  createChildExecutor: (ctx: SubagentExecutorContext) => SubagentExecutor;
44
44
  }
45
45
  export declare function wireChildNesting(w: WireChildNestingArgs): WireChildNestingResult;
46
- export declare function buildNestedChildManager(args: Pick<BuildChildConfigArgs, 'childInheritedReadRoots' | 'traceWriter' | 'surface' | 'workspaceStore' | 'parentRootSessionId' | 'hookRegistry'>, signal: AbortSignal, currentCwd: string | undefined): SubagentManager;
46
+ export declare function buildNestedChildManager(args: Pick<BuildChildConfigArgs, 'childInheritedReadRoots' | 'traceWriter' | 'surface' | 'workspaceStore' | 'parentRootSessionId' | 'hookRegistry' | 'onSubagentSucceeded'>, signal: AbortSignal, currentCwd: string | undefined): SubagentManager;
47
47
  export declare function nestedExecutorInherits(args: Pick<BuildChildConfigArgs, 'traceWriter' | 'workspaceStore' | 'hookRegistry'>): Pick<SubagentExecutorContext, 'traceWriter' | 'workspaceStore' | 'hookRegistry'>;
48
48
  export {};