agent-afk 5.280.0 → 5.282.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,26 @@
1
+ import type { DetachableToolRegistry, DetachToken, DetachedToolResult } from './detach-registry.js';
2
+ export declare function bashDetachLabel(command: string): string;
3
+ export declare function buildBashDelivery(toolUseId: string, label: string, output: string, closeCode: number | null, closeSignal: string | null, startedAt: number): DetachedToolResult;
4
+ export declare function applyBashDetach(registry: DetachableToolRegistry, toolUseId: string, command: string, onDetach: (token: DetachToken, label: string) => void): DetachToken;
5
+ export interface OnDetachParams {
6
+ resolvedRef: {
7
+ value: boolean;
8
+ };
9
+ timeoutHandle: ReturnType<typeof setTimeout>;
10
+ signal: AbortSignal;
11
+ abortHandler: () => void;
12
+ deregisterOnCloseRef: {
13
+ value: (() => void) | undefined;
14
+ };
15
+ clearTail: (() => void) | undefined;
16
+ getOutput: () => string;
17
+ proc: import('child_process').ChildProcess;
18
+ startedAt: number;
19
+ resolve: (result: {
20
+ content: string;
21
+ }) => void;
22
+ }
23
+ export declare function execOnDetach(token: DetachToken, label: string, toolUseId: string, p: OnDetachParams): void;
24
+ export declare const DETACHABLE_TOOLS: ReadonlySet<string>;
25
+ export declare function isDetachableTool(name: string): boolean;
26
+ export type { DetachableToolRegistry };
@@ -0,0 +1,28 @@
1
+ import { EventEmitter } from 'node:events';
2
+ export interface DetachedToolResult {
3
+ readonly toolUseId: string;
4
+ readonly label: string;
5
+ readonly status: 'completed' | 'failed';
6
+ readonly output: string;
7
+ readonly exitCode?: number;
8
+ readonly durationMs: number;
9
+ }
10
+ export interface DetachToken {
11
+ readonly toolUseId: string;
12
+ readonly detachSignal: AbortSignal;
13
+ shouldDetach(): boolean;
14
+ detachResult(label: string): {
15
+ content: string;
16
+ };
17
+ notifyDetached(): void;
18
+ deliver(result: DetachedToolResult): void;
19
+ }
20
+ export declare class DetachableToolRegistry extends EventEmitter {
21
+ private readonly tokens;
22
+ register(toolUseId: string): DetachToken;
23
+ hasDetachable(): boolean;
24
+ deregister(toolUseId: string): void;
25
+ detachAll(): void;
26
+ cancelAll(): void;
27
+ listRunning(): string[];
28
+ }
@@ -14,6 +14,7 @@ import type { CanUseTool } from '../types/sdk-types.js';
14
14
  import { type GrantSnapshot, type GrantManager } from './grant-manager.js';
15
15
  import type { TraceSink } from '../trace/index.js';
16
16
  import { type UserAttention } from './user-yield.js';
17
+ import { type DetachableToolRegistry } from './detach-bash.js';
17
18
  export { defaultConcurrencyClassifier } from './dispatch-batching.js';
18
19
  export declare const REPEAT_CIRCUIT_BREAKER_THRESHOLD = 8;
19
20
  export { DEFAULT_MAX_CONCURRENT_SAFE_TOOL_CALLS, resolveMaxConcurrentSafeToolCalls };
@@ -43,6 +44,7 @@ export interface SessionToolDispatcherOptions {
43
44
  spawnedPidRegistry?: SpawnedPidRegistry;
44
45
  userAttention?: UserAttention;
45
46
  bashOutputTailReporter?: (toolUseId: string) => (tail: string | undefined) => void;
47
+ detachRegistry?: DetachableToolRegistry;
46
48
  }
47
49
  export declare class SessionToolDispatcher implements ToolDispatcher {
48
50
  private readonly handlers;
@@ -69,6 +71,7 @@ export declare class SessionToolDispatcher implements ToolDispatcher {
69
71
  private readonly maxOutputBytes;
70
72
  private readonly spawnedPidRegistry;
71
73
  private readonly userAttention;
74
+ private readonly detachRegistry;
72
75
  private readonly bashOutputTailReporter;
73
76
  private readonly gateState;
74
77
  private readonly repeatFailureGuard;
@@ -6,6 +6,7 @@ import type { ToolResult } from '../providers/shared/tool-result.js';
6
6
  import type { TraceSink } from '../trace/index.js';
7
7
  import type { SpawnedPidRegistry } from './handlers/pid-registry.js';
8
8
  import type { UserAttention } from './user-yield.js';
9
+ import type { DetachableToolRegistry } from './detach-registry.js';
9
10
  export interface ToolHandlerContext {
10
11
  cwd?: string;
11
12
  resolveBase?: string;
@@ -19,6 +20,7 @@ export interface ToolHandlerContext {
19
20
  spawnedPidRegistry?: SpawnedPidRegistry;
20
21
  onBashOutputTail?: (tail: string | undefined) => void;
21
22
  userAttention?: UserAttention;
23
+ detachRegistry?: DetachableToolRegistry;
22
24
  }
23
25
  export type ToolHandler = (input: unknown, signal: AbortSignal, context?: ToolHandlerContext) => Promise<ToolResult>;
24
26
  export type ConcurrencyClassifier = (toolName: string, input?: unknown) => boolean;
@@ -52,6 +52,7 @@ export declare class StreamRenderer {
52
52
  setSoftStopping(active: boolean): void;
53
53
  stripPendingTerminalState(headingOffset: number): boolean;
54
54
  getPendingBuffer(): string;
55
+ getLastCapturePath(): string | undefined;
55
56
  setBashOutputTail(toolUseId: string, tail: string | undefined): void;
56
57
  notifyFirstContent(): void;
57
58
  private buildOrchestratorCtx;
@@ -0,0 +1,31 @@
1
+ export declare function _setConfinementRootForTest(root: string | null): void;
2
+ export declare const VIEWER_MAX_LINES = 20000;
3
+ export interface ViewerState {
4
+ lines: readonly string[];
5
+ truncated: boolean;
6
+ totalLines: number;
7
+ scrollTop: number;
8
+ viewportRows: number;
9
+ searchQuery: string;
10
+ matchIndices: readonly number[];
11
+ matchCursor: number;
12
+ }
13
+ export type ViewerLoadResult = {
14
+ ok: true;
15
+ state: ViewerState;
16
+ } | {
17
+ ok: false;
18
+ error: ViewerLoadError;
19
+ };
20
+ export type ViewerLoadError = 'missing' | 'expired' | 'read_error';
21
+ export declare function loadViewer(capturePath: string | undefined, viewportRows: number): ViewerLoadResult;
22
+ export declare function maxScrollTop(state: ViewerState): number;
23
+ export declare function scrollUp(state: ViewerState, delta: number): ViewerState;
24
+ export declare function scrollDown(state: ViewerState, delta: number): ViewerState;
25
+ export declare function scrollHome(state: ViewerState): ViewerState;
26
+ export declare function scrollEnd(state: ViewerState): ViewerState;
27
+ export declare function applySearch(state: ViewerState, query: string): ViewerState;
28
+ export declare function nextMatch(state: ViewerState): ViewerState;
29
+ export declare function prevMatch(state: ViewerState): ViewerState;
30
+ export declare function clearSearch(state: ViewerState): ViewerState;
31
+ export declare function resize(state: ViewerState, viewportRows: number): ViewerState;
@@ -0,0 +1,2 @@
1
+ import type { PickerHost } from '../../render/picker.js';
2
+ export declare function runBashOutputViewer(host: PickerHost, capturePath: string | undefined, signal?: AbortSignal): Promise<void>;
@@ -5,6 +5,14 @@ import { TrustedSkillLedger } from '../../trusted-skill-ledger.js';
5
5
  import type { InputSurface } from '../../input/input-surface.js';
6
6
  export declare function wireTrustedSkillEvents(completionWriter: CompletionWriter, ledger: TrustedSkillLedger): () => void;
7
7
  export declare function wireProviderGrants(startupProvider: ModelProvider): void;
8
+ export declare function createTurnBridgeRefs(): {
9
+ bashTailSetter: {
10
+ current: ((toolUseId: string, tail: string | undefined) => void) | undefined;
11
+ };
12
+ capturePathRef: {
13
+ current: string | undefined;
14
+ };
15
+ };
8
16
  export declare function createReplInput(): {
9
17
  rl: readline.Interface;
10
18
  inputSurfaceRef: {
@@ -8,6 +8,7 @@ import type { AgentModelInput } from '../../../agent/types.js';
8
8
  import type { BackgroundAgentRegistry } from '../../../agent/background-registry.js';
9
9
  import type { BackgroundSummarizer } from '../../../agent/background-summarizer.js';
10
10
  import type { SubagentControl } from '../../../agent/tools/subagent-executor.js';
11
+ import type { DetachableToolRegistry } from '../../../agent/tools/detach-registry.js';
11
12
  import type { SubagentManager } from '../../../agent/subagent.js';
12
13
  import type { SlashContext, SessionStats, ResumeSwapResult, ThinkingUiMode } from '../../slash/types.js';
13
14
  import type { StoredSession } from '../../session-store.js';
@@ -62,6 +63,9 @@ export interface InteractiveCtx {
62
63
  bashTailSetter: {
63
64
  current: ((toolUseId: string, tail: string | undefined) => void) | undefined;
64
65
  };
66
+ capturePathRef: {
67
+ current: string | undefined;
68
+ };
65
69
  mcpManager?: import('../../../agent/mcp/index.js').McpManager;
66
70
  backgroundRegistry: BackgroundAgentRegistry;
67
71
  subagentManager: SubagentManager;
@@ -114,6 +118,7 @@ export interface TurnHandles {
114
118
  getCompositor?(): import('../../terminal-compositor.js').TerminalCompositor | null;
115
119
  setBackgroundHandler?(handler: (() => void) | null): void;
116
120
  subagentControl?: SubagentControl;
121
+ detachRegistry?: DetachableToolRegistry;
117
122
  setSoftStopHandler?(handler: (() => void) | null): void;
118
123
  setTaskViewHandler?(handler: (() => boolean) | null): void;
119
124
  setPausedState?(paused: boolean): void;
@@ -124,6 +129,9 @@ export interface TurnHandles {
124
129
  bashTailSetter?: {
125
130
  current: ((toolUseId: string, tail: string | undefined) => void) | undefined;
126
131
  };
132
+ capturePathRef?: {
133
+ current: string | undefined;
134
+ };
127
135
  onTextDelta?(charCount: number): void;
128
136
  }
129
137
  export declare const REPL_SPINNER_OPTIONS: {
@@ -0,0 +1,4 @@
1
+ import type { TerminalCompositor } from '../../terminal-compositor.js';
2
+ export declare function buildOutputViewerCallback(capturePathRef: {
3
+ current: string | undefined;
4
+ }, getCompositor: () => TerminalCompositor | null): () => void;
@@ -13,6 +13,8 @@ export declare class ToolLane {
13
13
  private lastElapsedSecond;
14
14
  private activeTools;
15
15
  flash: ToolLaneFlash | null;
16
+ private lastCapturePath;
17
+ getLastCapturePath(): string | undefined;
16
18
  fade: ElementFade | null;
17
19
  compactScrollback: boolean;
18
20
  addStart(toolUseId: string, toolName: string, toolInput: string): void;
@@ -0,0 +1,2 @@
1
+ import type { Entry } from './tool-lane-render.js';
2
+ export declare function elapsedDisplayNeedsUpdate(entries: ReadonlyMap<string, Entry>, order: readonly string[], lastElapsedSecond: Map<string, number>): boolean;
@@ -0,0 +1,4 @@
1
+ import type { StreamRenderer } from '../../_lib/stream-renderer.js';
2
+ export declare function syncCapturePathRef(capturePathRef: {
3
+ current: string | undefined;
4
+ }, renderer: StreamRenderer): void;
@@ -31,6 +31,7 @@ export interface InputSurfaceArmOpts {
31
31
  onCancel: () => void;
32
32
  onShiftTab?: () => void;
33
33
  onOpenEditor?: () => void;
34
+ onOpenOutputViewer?: () => void;
34
35
  scrollRegion?: CompositorScrollRegionGuard;
35
36
  stdout?: NodeJS.WriteStream;
36
37
  stdin?: NodeJS.ReadStream;
@@ -12,6 +12,7 @@ export type ApiHost = InputModeHost & RenderHost & AutocompleteHost & KeyDispatc
12
12
  onRewindRequest?: () => void;
13
13
  onIdleEscape?: () => void;
14
14
  onOpenEditor?: () => void;
15
+ onInputModeTransition?: () => void;
15
16
  flushPendingRepaint(): void;
16
17
  };
17
18
  export declare function setOnSubmit(self: ApiHost, handler: ((payload: SubmissionPayload) => void) | null): void;
@@ -19,6 +20,7 @@ export declare function setOnCancel(self: ApiHost, handler: (() => void) | null)
19
20
  export declare function getOnCancel(self: ApiHost): (() => void) | undefined;
20
21
  export declare function setOnRewindRequest(self: ApiHost, handler: (() => void) | null): void;
21
22
  export declare function setOnIdleEscape(self: ApiHost, handler: (() => void) | null): void;
23
+ export declare function setOnInputModeTransition(self: ApiHost, handler: (() => void) | null): void;
22
24
  export declare function setOnOpenEditor(self: ApiHost, handler: (() => void) | null): void;
23
25
  export declare function enterPickerMode(self: ApiHost, controller: PickerController): void;
24
26
  export declare function exitPickerMode(self: ApiHost): void;
@@ -20,11 +20,13 @@ export declare class TerminalCompositor {
20
20
  onBackground?: () => void;
21
21
  onRewindRequest?: () => void;
22
22
  onIdleEscape?: () => void;
23
+ onInputModeTransition?: () => void;
23
24
  lastIdleEscAt: number;
24
25
  onPauseInterrupt?: () => void;
25
26
  onShiftTab?: () => void;
26
27
  onTaskView?: () => boolean;
27
28
  onOpenEditor?: () => void;
29
+ onOpenOutputViewer?: () => void;
28
30
  readonly promptTextFn: (buffer: string) => string;
29
31
  readonly history?: IHistoryRing;
30
32
  readonly autocompleteState?: AutocompleteState;
@@ -106,6 +108,7 @@ export declare class TerminalCompositor {
106
108
  getOnCancel(): (() => void) | undefined;
107
109
  setOnRewindRequest(handler: (() => void) | null): void;
108
110
  setOnIdleEscape(handler: (() => void) | null): void;
111
+ setOnInputModeTransition(handler: (() => void) | null): void;
109
112
  setOnOpenEditor(handler: (() => void) | null): void;
110
113
  enterPickerMode(controller: PickerController): void;
111
114
  exitPickerMode(): void;
@@ -46,6 +46,7 @@ export interface KeyDispatchHost {
46
46
  readonly onShiftTab?: () => void;
47
47
  readonly onTaskView?: () => boolean;
48
48
  readonly onOpenEditor?: () => void;
49
+ readonly onOpenOutputViewer?: () => void;
49
50
  readonly onSubmit?: (payload: SubmissionPayload) => void;
50
51
  }
51
52
  export declare function applyEdit(self: KeyDispatchHost, next: InputCoreState): boolean;
@@ -0,0 +1,3 @@
1
+ import type { KeyDispatchHost } from './terminal-compositor.input-dispatch.js';
2
+ import type { KeyInfo } from './terminal-compositor.types.js';
3
+ export declare function handleOpenEditor(self: KeyDispatchHost, key: KeyInfo): boolean;
@@ -0,0 +1,3 @@
1
+ import type { KeyDispatchHost } from './terminal-compositor.input-dispatch.js';
2
+ import type { KeyInfo } from './terminal-compositor.types.js';
3
+ export declare function handleOpenOutputViewer(self: KeyDispatchHost, key: KeyInfo): boolean;
@@ -21,6 +21,7 @@ export interface InputModeHost {
21
21
  readonly pasteRegistry: Map<string, string>;
22
22
  readonly pasteStartCursor: number;
23
23
  readonly onSubmit?: (payload: SubmissionPayload) => void;
24
+ onInputModeTransition?: () => void;
24
25
  }
25
26
  export declare function enterPickerMode(self: InputModeHost, controller: PickerController): void;
26
27
  export declare function exitPickerMode(self: InputModeHost): void;
@@ -67,6 +67,7 @@ export interface TerminalCompositorOptions {
67
67
  onShiftTab?: () => void;
68
68
  onTaskView?: () => boolean;
69
69
  onOpenEditor?: () => void;
70
+ onOpenOutputViewer?: () => void;
70
71
  onSubmit?: (payload: SubmissionPayload) => void;
71
72
  promptText?: string | ((buffer: string) => string);
72
73
  history?: IHistoryRing;