agent-afk 5.313.2 → 5.313.4
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.
- package/dist/agent/subagent/fork-wiring.d.ts +48 -0
- package/dist/agent/subagent/handle.d.ts +2 -2
- package/dist/agent/subagent/handle.run-success.d.ts +4 -0
- package/dist/agent/tools/handlers/bash.close.d.ts +21 -0
- package/dist/agent/tools/handlers/bash.error.d.ts +14 -0
- package/dist/agent/tools/handlers/bash.overflow.d.ts +27 -0
- package/dist/agent/tools/handlers/bash.spawn.d.ts +3 -0
- package/dist/cli.mjs +389 -389
- package/dist/index.mjs +177 -177
- package/dist/telegram.mjs +209 -209
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AbortGraph } from '../abort-graph.js';
|
|
2
|
+
import type { HookRegistry } from '../hooks.js';
|
|
3
|
+
import type { AgentConfig } from '../types.js';
|
|
4
|
+
import type { SubagentProgressSink, OutputEvent } from '../types/session-types.js';
|
|
5
|
+
import type { TraceSink } from '../trace/index.js';
|
|
6
|
+
import type { WorkspaceStore } from '../workspace/workspace-store.js';
|
|
7
|
+
import { type SpawnReceipt } from './fork-budget.js';
|
|
8
|
+
import { SubagentHandleImpl } from './handle.js';
|
|
9
|
+
import { type ForkTerminalDeps } from './fork-terminal-hook.js';
|
|
10
|
+
import type { ForkSubagentOptions } from './fork-types.js';
|
|
11
|
+
import type { SubagentTrace } from './result.js';
|
|
12
|
+
export declare function armForkOccupancy(cwd: string | undefined): () => void;
|
|
13
|
+
export interface ConstructForkHandleArgs<T> {
|
|
14
|
+
options: ForkSubagentOptions<T>;
|
|
15
|
+
id: string;
|
|
16
|
+
childConfig: AgentConfig;
|
|
17
|
+
childController: AbortController;
|
|
18
|
+
effectiveTimeoutMs: number;
|
|
19
|
+
registry: HookRegistry | undefined;
|
|
20
|
+
effectiveTraceWriter: TraceSink | undefined;
|
|
21
|
+
budgetReceipt: SpawnReceipt | undefined;
|
|
22
|
+
stopOccupancyHeartbeat: () => void;
|
|
23
|
+
workspaceStore: WorkspaceStore | undefined;
|
|
24
|
+
progressSink: SubagentProgressSink | undefined;
|
|
25
|
+
sessionLabel: string | undefined;
|
|
26
|
+
getOutputEventSink: () => ((event: OutputEvent) => void) | undefined;
|
|
27
|
+
activeMap: Map<string, SubagentHandleImpl<unknown>>;
|
|
28
|
+
abortGraph: AbortGraph;
|
|
29
|
+
completedCache: ForkTerminalDeps['completedCache'];
|
|
30
|
+
onSubagentSucceeded: ((usage: SubagentTrace['usage'], costUsd: number | undefined) => void) | undefined;
|
|
31
|
+
}
|
|
32
|
+
export interface ConstructedFork<T> {
|
|
33
|
+
handle: SubagentHandleImpl<T>;
|
|
34
|
+
effectiveAgentType: string | undefined;
|
|
35
|
+
effectiveResolvedAgentType: string | undefined;
|
|
36
|
+
}
|
|
37
|
+
export declare function constructForkHandle<T>(args: ConstructForkHandleArgs<T>): ConstructedFork<T>;
|
|
38
|
+
export interface RollbackFailedForkArgs {
|
|
39
|
+
err: unknown;
|
|
40
|
+
id: string;
|
|
41
|
+
stopOccupancyHeartbeat: () => void;
|
|
42
|
+
budgetReceipt: SpawnReceipt | undefined;
|
|
43
|
+
abortGraph: AbortGraph;
|
|
44
|
+
registry: HookRegistry | undefined;
|
|
45
|
+
rootSignal: AbortSignal;
|
|
46
|
+
effectiveTraceWriter: TraceSink | undefined;
|
|
47
|
+
}
|
|
48
|
+
export declare function rollbackFailedFork(args: RollbackFailedForkArgs): void;
|
|
@@ -38,7 +38,7 @@ export declare class SubagentHandleImpl<T> implements SubagentHandle<T> {
|
|
|
38
38
|
readonly _parentAbortSignal?: AbortSignal | undefined;
|
|
39
39
|
readonly _agentType?: string | undefined;
|
|
40
40
|
readonly _traceWriter?: TraceSink | undefined;
|
|
41
|
-
|
|
41
|
+
readonly onSubagentSucceeded?: ((usage: SubagentTrace["usage"], costUsd: number | undefined) => void) | undefined;
|
|
42
42
|
readonly _idleTimeoutMs: number;
|
|
43
43
|
_currentStatus: SubagentStatus;
|
|
44
44
|
private inFlight;
|
|
@@ -69,7 +69,7 @@ export declare class SubagentHandleImpl<T> implements SubagentHandle<T> {
|
|
|
69
69
|
}): Promise<void>;
|
|
70
70
|
getLastStopInjectContext(): string | undefined;
|
|
71
71
|
readonly _pendingUserMessages: string[];
|
|
72
|
-
|
|
72
|
+
_drainingMessages: boolean;
|
|
73
73
|
sendMessage(text: string): void;
|
|
74
74
|
readonly _steeringMessages: string[];
|
|
75
75
|
readonly _progressEvents: import('../tools/subagent/emit-progress.js').ProgressEventPayload[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SubagentProgressSink } from '../types/session-types.js';
|
|
2
|
+
import type { Message } from '../types.js';
|
|
3
|
+
import type { SubagentHandleImpl } from './handle.js';
|
|
4
|
+
export declare function drainAndEmitSuccess<T>(handle: SubagentHandleImpl<T>, firstMsg: Message, startTime: number, sinkOverride: SubagentProgressSink | undefined): Promise<Message>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ToolHandlerContext } from '../types.js';
|
|
2
|
+
import type { OverflowState } from './bash.overflow.js';
|
|
3
|
+
export interface HandleCloseParams {
|
|
4
|
+
code: number | null;
|
|
5
|
+
state: OverflowState;
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
context: ToolHandlerContext | undefined;
|
|
8
|
+
startedAt: number;
|
|
9
|
+
timeout_ms: number;
|
|
10
|
+
deregisterOnClose: (() => void) | undefined;
|
|
11
|
+
settle: (result: {
|
|
12
|
+
content: string;
|
|
13
|
+
isError?: boolean;
|
|
14
|
+
truncated?: boolean;
|
|
15
|
+
capturePath?: string;
|
|
16
|
+
durationMs?: number;
|
|
17
|
+
exitCode?: number;
|
|
18
|
+
testResult?: import('./test-runner-detector.js').TestResult;
|
|
19
|
+
}) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function handleClose(params: HandleCloseParams): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { ToolHandlerContext } from '../types.js';
|
|
3
|
+
export interface AttachErrorHandlerParams {
|
|
4
|
+
proc: ChildProcess;
|
|
5
|
+
context: ToolHandlerContext | undefined;
|
|
6
|
+
cwd: string | undefined;
|
|
7
|
+
startedAt: number;
|
|
8
|
+
settle: (result: {
|
|
9
|
+
content: string;
|
|
10
|
+
isError?: boolean;
|
|
11
|
+
durationMs?: number;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function attachErrorHandler(params: AttachErrorHandlerParams): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { RollingTailBuffer } from './_rolling-tail.js';
|
|
3
|
+
export interface OverflowState {
|
|
4
|
+
stdout: string;
|
|
5
|
+
stderr: string;
|
|
6
|
+
totalBytes: number;
|
|
7
|
+
overflowKilled: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface AttachStreamHandlersParams {
|
|
10
|
+
proc: ChildProcess;
|
|
11
|
+
state: OverflowState;
|
|
12
|
+
tailBuffer: RollingTailBuffer | undefined;
|
|
13
|
+
resolved: () => boolean;
|
|
14
|
+
deregisterOnClose: () => (() => void) | undefined;
|
|
15
|
+
settle: (result: {
|
|
16
|
+
content: string;
|
|
17
|
+
isError?: boolean;
|
|
18
|
+
truncated?: boolean;
|
|
19
|
+
capturePath?: string;
|
|
20
|
+
durationMs?: number;
|
|
21
|
+
exitCode?: number;
|
|
22
|
+
testResult?: import('./test-runner-detector.js').TestResult;
|
|
23
|
+
}) => void;
|
|
24
|
+
startedAt: number;
|
|
25
|
+
command: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function attachStreamHandlers(params: AttachStreamHandlersParams): void;
|