agent-afk 5.187.0 → 5.189.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 @@
1
+ export declare function recoverDaemonQueues(queueDir: string): void;
@@ -1,9 +1,10 @@
1
- import { AgentSession } from '../session/agent-session.js';
2
1
  import type { TraceWriter } from '../trace/index.js';
2
+ import type { AgentSession } from '../session/agent-session.js';
3
3
  import type { AgentConfig } from '../types.js';
4
4
  import { ScheduledTask } from './triggers.js';
5
+ export { resolveWorktreePruneRoot } from './worktree-prune-task.js';
6
+ export { daemonTraceLabel } from './session-spawn.js';
5
7
  import { type SessionStartSkipReason } from './gates.js';
6
- export { resolveWorktreePruneRoot, daemonTraceLabel } from './scheduler.helpers.js';
7
8
  export interface SchedulerOptions {
8
9
  sessionConfig?: Partial<AgentConfig>;
9
10
  telemetryPath?: string;
@@ -0,0 +1,19 @@
1
+ import { MemoryStore } from '../memory/index.js';
2
+ import { McpManager } from '../mcp/index.js';
3
+ import { AgentSession } from '../session/agent-session.js';
4
+ import { StateStore } from '../state/state-store.js';
5
+ import type { TraceWriter } from '../trace/index.js';
6
+ import type { AgentConfig } from '../types.js';
7
+ export interface DaemonSpawnOptions {
8
+ sessionConfig?: Partial<AgentConfig>;
9
+ sessionFactory?: (config: AgentConfig, ownedTraceWriter?: TraceWriter) => AgentSession;
10
+ trigger?: 'cron' | 'sessionstart' | 'pull';
11
+ }
12
+ export declare function daemonTraceLabel(taskId: string): string;
13
+ export declare function spawnDaemonSession(taskId: string, options: DaemonSpawnOptions): Promise<{
14
+ session: AgentSession;
15
+ memoryStore: MemoryStore;
16
+ stateStore: StateStore;
17
+ mcpManager?: McpManager;
18
+ dispose: () => void;
19
+ }>;
@@ -0,0 +1,13 @@
1
+ import type { TelemetryRecord, TelemetryTrigger } from './scheduler.js';
2
+ import type { ExecFileFn } from '../worktree-sweep.js';
3
+ export declare function resolveWorktreePruneRoot(execFile: ExecFileFn, cwd: string, override: string | undefined): Promise<string | null>;
4
+ export interface WorktreePruneTaskOptions {
5
+ now: () => number;
6
+ telemetryPath: () => string;
7
+ writeTelemetry: (record: TelemetryRecord) => void;
8
+ }
9
+ export declare function runBuiltinWorktreePruneTask(task: {
10
+ taskId: string;
11
+ command: string;
12
+ cronExpression?: string;
13
+ }, trigger: TelemetryTrigger, options: WorktreePruneTaskOptions): Promise<TelemetryRecord>;
@@ -93,6 +93,7 @@ export type ProviderEvent = {
93
93
  content: string;
94
94
  isError?: boolean;
95
95
  truncated?: boolean;
96
+ capturePath?: string;
96
97
  sessionId?: string;
97
98
  toolName?: string;
98
99
  batchIndex?: number;
@@ -100,6 +101,8 @@ export type ProviderEvent = {
100
101
  incomplete?: boolean;
101
102
  incompleteReason?: string;
102
103
  failureClass?: ToolFailureClass;
104
+ durationMs?: number;
105
+ exitCode?: number;
103
106
  } | {
104
107
  type: 'tool.activity';
105
108
  activeCount: number;
@@ -11,6 +11,9 @@ export interface ToolResult {
11
11
  harnessUserMessage?: HarnessUserMessage;
12
12
  isError?: boolean;
13
13
  truncated?: boolean;
14
+ capturePath?: string;
15
+ durationMs?: number;
16
+ exitCode?: number;
14
17
  incomplete?: boolean;
15
18
  incompleteReason?: string;
16
19
  circuitBreaker?: boolean;
@@ -0,0 +1,9 @@
1
+ export declare function truncateContent(content: string): {
2
+ content: string;
3
+ truncated: boolean;
4
+ lineCount?: number;
5
+ sizeBytes: number;
6
+ sizeLabel: string;
7
+ tailPreview?: string[];
8
+ hiddenLineCount?: number;
9
+ };
@@ -0,0 +1,5 @@
1
+ import type { AgentConfig } from '../types.js';
2
+ import type { InputStreamRef } from '../types/permission-types.js';
3
+ import type { SubagentHandleImpl } from './handle.js';
4
+ export type BindProgressHandle = (handle: SubagentHandleImpl<unknown>) => void;
5
+ export declare function wireProgressEvents(config: AgentConfig, enabled: boolean | undefined, parentInputStreamRef: InputStreamRef | undefined, parentAbortSignal: AbortSignal | undefined): BindProgressHandle;
@@ -21,6 +21,7 @@ export interface ForkSubagentOptions<T = unknown> {
21
21
  parentId?: string;
22
22
  promptHead?: string;
23
23
  denyElicitations?: boolean;
24
+ progressEvents?: boolean;
24
25
  phaseRole?: PhaseRole;
25
26
  }
26
27
  export interface SubagentManagerOptions {
@@ -71,6 +71,8 @@ export declare class SubagentHandleImpl<T> implements SubagentHandle<T> {
71
71
  private _drainingMessages;
72
72
  sendMessage(text: string): void;
73
73
  readonly _steeringMessages: string[];
74
+ readonly _progressEvents: import('../tools/subagent/emit-progress.js').ProgressEventPayload[];
74
75
  steer(text: string): void;
76
+ emitProgress(payload: import('../tools/subagent/emit-progress.js').ProgressEventPayload): void;
75
77
  get _beforeNextRound(): () => string | undefined;
76
78
  }
@@ -0,0 +1,2 @@
1
+ export declare const PROGRESS_RING_CAPACITY = 20;
2
+ export declare const PROGRESS_MAX_PHASE_BYTES = 256;
@@ -5,9 +5,10 @@ import { type SubagentHandle } from './subagent/handle.js';
5
5
  import type { SubagentStatus, SubagentResult, SubagentTrace } from './subagent/result.js';
6
6
  import { CompletedCache } from './subagent/completed-cache.js';
7
7
  export type { SubagentStatus, SubagentResult, SubagentTrace, SubagentHandle };
8
- import { DENY_ELICITATION, SUBAGENT_DEFAULT_MAX_TOOL_USE_ITERATIONS, SUBAGENT_DEFAULT_TIMEOUT_MS, SUBAGENT_DEFAULT_IDLE_TIMEOUT_MS, SUBAGENT_BACKGROUND_TIMEOUT_MS, SUBAGENT_DRAIN_TIMEOUT_MS, resolveSubagentTimeoutMs, resolveSubagentIdleTimeoutMs } from './subagent/constants.js';
8
+ import { SUBAGENT_DEFAULT_IDLE_TIMEOUT_MS, SUBAGENT_DRAIN_TIMEOUT_MS, resolveSubagentIdleTimeoutMs } from './subagent/constants.js';
9
9
  import type { ForkParent, ForkSubagentOptions, SubagentManagerOptions } from './subagent/fork-types.js';
10
- export { DENY_ELICITATION, SUBAGENT_DEFAULT_MAX_TOOL_USE_ITERATIONS, SUBAGENT_DEFAULT_TIMEOUT_MS, SUBAGENT_DEFAULT_IDLE_TIMEOUT_MS, SUBAGENT_BACKGROUND_TIMEOUT_MS, SUBAGENT_DRAIN_TIMEOUT_MS, resolveSubagentTimeoutMs, resolveSubagentIdleTimeoutMs, };
10
+ export { DENY_ELICITATION, SUBAGENT_DEFAULT_MAX_TOOL_USE_ITERATIONS, SUBAGENT_DEFAULT_TIMEOUT_MS, SUBAGENT_BACKGROUND_TIMEOUT_MS, resolveSubagentTimeoutMs, } from './subagent/constants.js';
11
+ export { SUBAGENT_DEFAULT_IDLE_TIMEOUT_MS, SUBAGENT_DRAIN_TIMEOUT_MS, resolveSubagentIdleTimeoutMs, };
11
12
  export type { ForkParent, ForkSubagentOptions, SubagentManagerOptions };
12
13
  export declare class SubagentManager {
13
14
  private readonly active;
@@ -0,0 +1,2 @@
1
+ export declare const CAPTURE_MAX_BYTES = 8000000;
2
+ export declare function writeBashCapture(sessionId: string | undefined, toolUseId: string, fullOutput: string): string | undefined;
@@ -18,6 +18,7 @@ export interface ChildProviderFactoryArgs {
18
18
  model?: AgentModelInput;
19
19
  allowedTools?: string[];
20
20
  readOnlyBash?: boolean;
21
+ customTools?: import('../tools/custom-tool.js').CustomToolDef[];
21
22
  }
22
23
  export declare function createStubParentSession(signal: AbortSignal): Pick<IAgentSession, 'sessionId' | 'getInputStreamRef' | 'abortSignal'>;
23
24
  export declare const CHILD_ALLOWED_TOOLS: string[];
@@ -0,0 +1,11 @@
1
+ import type { SubagentHandleImpl } from '../../subagent/handle.js';
2
+ import type { ToolResult } from '../types.js';
3
+ export interface ProgressEventPayload {
4
+ message: string;
5
+ phase?: string;
6
+ metadata?: Record<string, unknown>;
7
+ }
8
+ export declare const PROGRESS_RING_CAPACITY = 20;
9
+ export declare const PROGRESS_MAX_MESSAGE_BYTES = 2048;
10
+ export declare function formatProgressEvent(payload: ProgressEventPayload, subagentId: string): string;
11
+ export declare function createEmitProgressHandler(handle: SubagentHandleImpl<unknown>, parentQueueFn: (text: string) => void, parentAbortSignal: AbortSignal | undefined): (input: unknown, _signal: AbortSignal) => Promise<ToolResult>;
@@ -14,5 +14,6 @@ export interface AgentInput {
14
14
  writeRoots?: string[];
15
15
  readRoots?: string[];
16
16
  isolation?: 'worktree';
17
+ progress_events?: boolean;
17
18
  }
18
19
  export declare function parseAgentInput(input: unknown): AgentInput;
@@ -54,9 +54,14 @@ export interface ToolResultChunk {
54
54
  isError?: boolean;
55
55
  truncated?: boolean;
56
56
  persistedPath?: string;
57
+ capturePath?: string;
58
+ tailPreview?: string[];
59
+ hiddenLineCount?: number;
60
+ exitCode?: number;
57
61
  sizeBytes?: number;
58
62
  sizeLabel?: string;
59
63
  lineCount?: number;
64
+ durationMs?: number;
60
65
  display?: string;
61
66
  batchIndex?: number;
62
67
  batchSize?: number;