agent-afk 5.111.2 → 5.112.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.
@@ -11,6 +11,7 @@ export declare class AbortGraph {
11
11
  constructor(traceWriter?: TraceWriter);
12
12
  setTraceWriter(writer: TraceWriter | undefined): void;
13
13
  register(id: string, controller: AbortController): void;
14
+ rearm(id: string, controller: AbortController): void;
14
15
  has(id: string): boolean;
15
16
  getController(id: string): AbortController | undefined;
16
17
  childrenOf(id: string): string[];
@@ -6,3 +6,4 @@ export declare function resolveSubagentTimeoutMs(): number;
6
6
  export declare const SUBAGENT_DEFAULT_IDLE_TIMEOUT_MS: number;
7
7
  export declare function resolveSubagentIdleTimeoutMs(): number;
8
8
  export declare const SUBAGENT_BACKGROUND_TIMEOUT_MS: number;
9
+ export declare const SUBAGENT_DRAIN_TIMEOUT_MS = 5000;
@@ -22,9 +22,10 @@ export declare class SubagentManager {
22
22
  private readonly worktreeMainRootCache;
23
23
  private parentTraceWriter;
24
24
  private readonly parentSurface;
25
+ private readonly parentAbortSignal;
25
26
  private readonly abortGraph;
26
27
  private readonly rootId;
27
- private readonly rootController;
28
+ private rootController;
28
29
  private counter;
29
30
  private onSubagentSucceededCb;
30
31
  constructor(options?: SubagentManagerOptions);
@@ -40,5 +41,10 @@ export declare class SubagentManager {
40
41
  forkSubagent<T = unknown>(options: ForkSubagentOptions<T>): Promise<SubagentHandle<T>>;
41
42
  kill(id: string): Promise<boolean>;
42
43
  killAll(): Promise<void>;
44
+ abortAllAndDrain(reason?: unknown, origin?: AbortOrigin, timeoutMs?: number, rearm?: boolean): Promise<{
45
+ drained: number;
46
+ timedOut: boolean;
47
+ }>;
48
+ private rearmRoot;
43
49
  teardownAll(): Promise<void>;
44
50
  }
@@ -69,6 +69,7 @@ export interface AgentConfig {
69
69
  hookRegistry?: HookRegistry;
70
70
  planExitControls?: PlanExitControls;
71
71
  traceWriter?: TraceWriter;
72
+ drainSubagents?: (reason: string) => Promise<unknown>;
72
73
  isSubagentFork?: true;
73
74
  provider?: ModelProvider;
74
75
  providerFactory?: (model: string | undefined) => ModelProvider;
@@ -0,0 +1,20 @@
1
+ export declare const WITNESS_MAX_AGE_DAYS_DEFAULT = 30;
2
+ export declare const WITNESS_MAX_BYTES_DEFAULT: number;
3
+ export declare const WITNESS_EVICTION_GRACE_MS: number;
4
+ export declare const WITNESS_SWEEP_MIN_INTERVAL_MS: number;
5
+ export interface WitnessSweepOptions {
6
+ root?: string;
7
+ activeLabel?: string | undefined;
8
+ maxAgeDays?: number;
9
+ maxBytes?: number;
10
+ force?: boolean;
11
+ }
12
+ export interface WitnessSweepResult {
13
+ skipped: boolean;
14
+ scanned: number;
15
+ evicted: number;
16
+ freedBytes: number;
17
+ evictedLabels: string[];
18
+ }
19
+ export declare function sweepWitnessTree(options?: WitnessSweepOptions): Promise<WitnessSweepResult>;
20
+ export declare const WITNESS_SWEEP_START_DELAY_MS = 5000;
@@ -18,6 +18,7 @@ export interface BuildAgentSessionDeps {
18
18
  providerFactory: (model: string | undefined) => ModelProvider;
19
19
  hookRegistry: HookRegistry;
20
20
  traceWriter: TraceWriter | undefined;
21
+ drainSubagents?: ((reason: string) => Promise<unknown>) | undefined;
21
22
  cwd: string | undefined;
22
23
  maxTurns: number;
23
24
  autoResumeOnUsageLimit: boolean | undefined;
@@ -38,6 +39,7 @@ export declare function buildSharedDeps(a: {
38
39
  providerFactory: (m: string | undefined) => ModelProvider;
39
40
  hookRegistry: HookRegistry;
40
41
  traceWriter: TraceWriter | undefined;
42
+ drainSubagents?: ((reason: string) => Promise<unknown>) | undefined;
41
43
  effectiveCwd: string | undefined;
42
44
  maxTurns: string;
43
45
  initialPermissionMode: PermissionMode | undefined;