agent-afk 5.111.1 → 5.111.3

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,9 +7,11 @@ export interface ChildAbortedEvent {
7
7
  export type ChildAbortedListener = (event: ChildAbortedEvent) => void;
8
8
  export declare class AbortGraph {
9
9
  private readonly nodes;
10
- private readonly traceWriter;
10
+ private traceWriter;
11
11
  constructor(traceWriter?: TraceWriter);
12
+ setTraceWriter(writer: TraceWriter | undefined): void;
12
13
  register(id: string, controller: AbortController): void;
14
+ rearm(id: string, controller: AbortController): void;
13
15
  has(id: string): boolean;
14
16
  getController(id: string): AbortController | undefined;
15
17
  childrenOf(id: string): string[];
@@ -34,9 +34,10 @@ export interface BackgroundRegistryEvents {
34
34
  export declare class BackgroundAgentRegistry extends EventEmitter<BackgroundRegistryEvents> {
35
35
  private readonly jobs;
36
36
  private counter;
37
- private readonly traceWriter;
37
+ private traceWriter;
38
38
  private readonly maxConcurrentJobs;
39
39
  constructor(options?: BackgroundRegistryOptions);
40
+ setTraceWriter(writer: TraceWriter | undefined): void;
40
41
  register(args: RegisterArgs): BackgroundJob;
41
42
  adoptRunning(args: RegisterArgs & {
42
43
  runPromise: Promise<SubagentResult>;
@@ -1 +1,2 @@
1
1
  export declare function redactSecrets(text: string): string;
2
+ export declare function looksLikeFilesystemPath(run: string): boolean;
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import { type ChildAbortedListener } from './abort-graph.js';
2
- import type { AbortOrigin } from './trace/index.js';
2
+ import type { AbortOrigin, TraceWriter } from './trace/index.js';
3
3
  import { type ReadScopeInputs } from './subagent-read-scope.js';
4
4
  import { type SubagentHandle } from './subagent/handle.js';
5
5
  import type { SubagentStatus, SubagentResult, SubagentTrace } from './subagent/result.js';
@@ -20,11 +20,12 @@ export declare class SubagentManager {
20
20
  private parentCwd;
21
21
  private readonly parentReadRoots;
22
22
  private readonly worktreeMainRootCache;
23
- private readonly parentTraceWriter;
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);
@@ -33,11 +34,17 @@ export declare class SubagentManager {
33
34
  onChildAborted(listener: ChildAbortedListener): () => void;
34
35
  setOnSubagentSucceeded(cb: (usage: import('./subagent/result.js').SubagentTrace['usage'], costUsd: number | undefined) => void): void;
35
36
  setCwd(cwd: string): void;
37
+ setTraceWriter(writer: TraceWriter | undefined): void;
36
38
  getReadScopeInputs(): ReadScopeInputs;
37
39
  private resolveMainRootForCwd;
38
40
  abortAll(reason?: unknown, origin?: AbortOrigin): void;
39
41
  forkSubagent<T = unknown>(options: ForkSubagentOptions<T>): Promise<SubagentHandle<T>>;
40
42
  kill(id: string): Promise<boolean>;
41
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;
42
49
  teardownAll(): Promise<void>;
43
50
  }
@@ -30,5 +30,6 @@ export declare class ComposeExecutor {
30
30
  private currentCwd;
31
31
  constructor(ctx: ComposeExecutorContext);
32
32
  setCwd(cwd: string): void;
33
+ setTraceWriter(writer: TraceWriter | undefined): void;
33
34
  execute(call: ToolCall): Promise<ToolResult>;
34
35
  }
@@ -1,4 +1,5 @@
1
1
  import type { ToolCall, ToolResult } from './types.js';
2
+ import type { TraceWriter } from '../trace/writer.js';
2
3
  import type { SkillExecutorContext } from './skill-executor/types.js';
3
4
  export type { SkillExecutorContext } from './skill-executor/types.js';
4
5
  export declare class SkillExecutor {
@@ -7,6 +8,7 @@ export declare class SkillExecutor {
7
8
  private currentCwd;
8
9
  constructor(ctx: SkillExecutorContext);
9
10
  setCwd(cwd: string): void;
11
+ setTraceWriter(writer: TraceWriter | undefined): void;
10
12
  private internals;
11
13
  execute(call: ToolCall): Promise<ToolResult>;
12
14
  private executeRegistrySkill;
@@ -52,6 +52,7 @@ export declare class SubagentExecutor implements SubagentControl {
52
52
  private isolationCounter;
53
53
  constructor(ctx: SubagentExecutorContext);
54
54
  setCwd(cwd: string): void;
55
+ setTraceWriter(writer: TraceWriter | undefined): void;
55
56
  describeAgentTool(): AnthropicToolDef;
56
57
  private readonly promotionTriggers;
57
58
  private readonly activeForegroundHandles;
@@ -7,6 +7,7 @@ export interface TraceWriter {
7
7
  }
8
8
  export interface NdjsonTraceWriterOptions {
9
9
  traceDir: string;
10
+ startSeq?: number;
10
11
  }
11
12
  export declare class NdjsonTraceWriter implements TraceWriter {
12
13
  private readonly traceDir;
@@ -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;
@@ -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;