agent-afk 5.292.2 → 5.293.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.
@@ -0,0 +1,8 @@
1
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
2
+ export declare function registerStdioChild(pid: number): void;
3
+ export declare function unregisterStdioChild(pid: number): void;
4
+ export declare function trackedStdioChildren(): number[];
5
+ export declare function terminateTrackedChildren(): void;
6
+ export declare class TrackedStdioClientTransport extends StdioClientTransport {
7
+ start(): Promise<void>;
8
+ }
@@ -30,6 +30,7 @@ export interface BuildDispatcherOptions {
30
30
  planExitControls?: PlanExitControls;
31
31
  spawnedPidRegistry?: SpawnedPidRegistry;
32
32
  bashOutputTailReporter?: (toolUseId: string) => (tail: string | undefined) => void;
33
+ detachRegistry?: import('../../tools/detach-registry.js').DetachableToolRegistry;
33
34
  }
34
35
  export interface BuildDispatcherDeps {
35
36
  memoryStore: MemoryStore;
@@ -0,0 +1,27 @@
1
+ import type { AgentConfig } from '../types.js';
2
+ type Env = Record<string, string>;
3
+ export declare const TMP_ENV_KEYS: readonly ["TMPDIR", "TMP", "TEMP"];
4
+ export declare function setSessionTmpdirRootForTests(root: string | undefined): void;
5
+ export declare function sessionTmpdirRoot(): string;
6
+ export declare class SessionTmpdir {
7
+ readonly dir: string;
8
+ readonly root: string;
9
+ private readonly parent;
10
+ private owned;
11
+ constructor(dir: string, root: string, parent: SessionTmpdir | undefined);
12
+ get isOwned(): boolean;
13
+ ensure(): boolean;
14
+ cleanup(): Promise<void>;
15
+ }
16
+ export declare function isSessionTmpdirDisabled(): boolean;
17
+ export declare function withTmpEnv(base: Env | undefined, dir: string): Env;
18
+ export declare function lookupSessionTmpdir(e: Env | undefined): SessionTmpdir | undefined;
19
+ export declare function withSessionTmpdir(config: AgentConfig): AgentConfig;
20
+ export declare function childTmpEnvPatch(base: Env | undefined, subagentId: string): {
21
+ env?: Env;
22
+ };
23
+ export declare function ensureSessionTmpdir(e: Env | undefined): boolean;
24
+ export declare function resolveSpawnTmpEnv(e: Env | undefined): Env | undefined;
25
+ export declare function runInTmpdirScope<R>(dir: string | undefined, fn: () => R): R;
26
+ export declare function cleanupSessionTmpdir(e: Env | undefined): Promise<void>;
27
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { DetachableToolRegistry, DetachToken, DetachedToolResult } from './detach-registry.js';
2
+ export declare const SETTLE_AFTER_KILL_MS = 5000;
2
3
  export declare function bashDetachLabel(command: string): string;
3
4
  export declare function buildBashDelivery(toolUseId: string, label: string, output: string, closeCode: number | null, closeSignal: string | null, startedAt: number): DetachedToolResult;
4
5
  export declare function applyBashDetach(registry: DetachableToolRegistry, toolUseId: string, command: string, onDetach: (token: DetachToken, label: string) => void): DetachToken;
@@ -22,6 +22,7 @@ export interface CoreExecDeps {
22
22
  callHandlerContext: (call: ToolCall) => ToolHandlerContext;
23
23
  gateDeps: () => PreDispatchGateDeps;
24
24
  toolDefs: readonly AnthropicToolDef[];
25
+ tmpdirScope?: string | undefined;
25
26
  }
26
27
  export declare function isRegisteredTool(toolName: string, deps: CoreExecDeps): boolean;
27
28
  export declare function unknownToolMessage(toolName: string, deps: CoreExecDeps): string;
@@ -1 +1,2 @@
1
1
  export declare function scrubBashEnv(env: Record<string, string | undefined> | undefined): Record<string, string | undefined>;
2
+ export declare function buildChildEnv(contextEnv: Record<string, string> | undefined): Record<string, string | undefined>;
@@ -83,6 +83,7 @@ export interface AgentConfig {
83
83
  planExitControls?: PlanExitControls;
84
84
  traceWriter?: TraceSink;
85
85
  bashOutputTailReporter?: (toolUseId: string) => (tail: string | undefined) => void;
86
+ detachRegistry?: import('../tools/detach-registry.js').DetachableToolRegistry;
86
87
  drainSubagents?: (reason: string) => Promise<unknown>;
87
88
  isSubagentFork?: true;
88
89
  provider?: ModelProvider;
@@ -6,6 +6,7 @@ import type { ComposeExecutor } from '../../../agent/tools/compose-executor.js';
6
6
  import type { SubagentManager } from '../../../agent/subagent.js';
7
7
  import { BackgroundAgentRegistry } from '../../../agent/background-registry.js';
8
8
  import { BackgroundSummarizer } from '../../../agent/background-summarizer.js';
9
+ import { DetachableToolRegistry } from '../../../agent/tools/detach-registry.js';
9
10
  import { createDefaultTraceWriter } from '../../../agent/trace/factory.js';
10
11
  import type { ResolvedResumeTarget } from '../../resume-session.js';
11
12
  import type { CliOptions } from './shared.js';
@@ -13,6 +14,7 @@ export interface BootstrapInfra {
13
14
  trace: ReturnType<typeof createDefaultTraceWriter>;
14
15
  apiKey: string | undefined;
15
16
  backgroundRegistry: BackgroundAgentRegistry;
17
+ detachRegistry: DetachableToolRegistry;
16
18
  bgSummarizer: BackgroundSummarizer | undefined;
17
19
  rootManager: SubagentManager;
18
20
  subagentExecutor: SubagentExecutor;
@@ -20,6 +20,7 @@ export interface BuildAgentSessionDeps {
20
20
  traceWriter: TraceWriter | undefined;
21
21
  drainSubagents?: ((reason: string) => Promise<unknown>) | undefined;
22
22
  bashOutputTailReporter?: (toolUseId: string) => (tail: string | undefined) => void;
23
+ detachRegistry?: import('../../../agent/tools/detach-registry.js').DetachableToolRegistry;
23
24
  cwd: string | undefined;
24
25
  maxTurns: number;
25
26
  autoResumeOnUsageLimit: boolean | undefined;
@@ -44,6 +45,7 @@ export declare function buildSharedDeps(a: {
44
45
  traceWriter: TraceWriter | undefined;
45
46
  drainSubagents?: ((reason: string) => Promise<unknown>) | undefined;
46
47
  bashOutputTailReporter?: (toolUseId: string) => (tail: string | undefined) => void;
48
+ detachRegistry?: import('../../../agent/tools/detach-registry.js').DetachableToolRegistry;
47
49
  effectiveCwd: string | undefined;
48
50
  maxTurns: string;
49
51
  initialPermissionMode: PermissionMode | undefined;
@@ -71,6 +71,7 @@ export interface InteractiveCtx {
71
71
  backgroundRegistry: BackgroundAgentRegistry;
72
72
  subagentManager: SubagentManager;
73
73
  subagentControl?: SubagentControl;
74
+ detachRegistry?: DetachableToolRegistry;
74
75
  bgSummarizer?: BackgroundSummarizer;
75
76
  firstTurnHook?: (firstMessage: string) => Promise<void>;
76
77
  initialInput?: string;