agent-afk 5.296.4 → 5.296.6

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.
@@ -23,6 +23,10 @@ export interface DAGRunResult {
23
23
  error: Error;
24
24
  }>;
25
25
  skipped: string[];
26
+ partial: Array<{
27
+ id: string;
28
+ stopReason: string;
29
+ }>;
26
30
  }
27
31
  export declare function validateDAG(graph: DAGGraph): void;
28
32
  export declare function runDAG(graph: DAGGraph, signal: AbortSignal, options?: DAGRunOptions): Promise<DAGRunResult>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export declare const FACET_VERSION = 7;
2
+ export declare const FACET_VERSION = 8;
3
3
  export declare const ToolEventInputSchema: z.ZodObject<{
4
4
  toolName: z.ZodString;
5
5
  toolUseId: z.ZodOptional<z.ZodString>;
@@ -7,6 +7,7 @@ export declare const ToolEventInputSchema: z.ZodObject<{
7
7
  inputRaw: z.ZodOptional<z.ZodString>;
8
8
  result: z.ZodOptional<z.ZodString>;
9
9
  isError: z.ZodOptional<z.ZodBoolean>;
10
+ incomplete: z.ZodOptional<z.ZodBoolean>;
10
11
  }, z.core.$loose>;
11
12
  export declare const TurnInputSchema: z.ZodObject<{
12
13
  user: z.ZodDefault<z.ZodString>;
@@ -19,6 +20,7 @@ export declare const TurnInputSchema: z.ZodObject<{
19
20
  inputRaw: z.ZodOptional<z.ZodString>;
20
21
  result: z.ZodOptional<z.ZodString>;
21
22
  isError: z.ZodOptional<z.ZodBoolean>;
23
+ incomplete: z.ZodOptional<z.ZodBoolean>;
22
24
  }, z.core.$loose>>>;
23
25
  }, z.core.$loose>;
24
26
  export declare const StoredSessionInputSchema: z.ZodObject<{
@@ -57,6 +59,7 @@ export declare const StoredSessionInputSchema: z.ZodObject<{
57
59
  inputRaw: z.ZodOptional<z.ZodString>;
58
60
  result: z.ZodOptional<z.ZodString>;
59
61
  isError: z.ZodOptional<z.ZodBoolean>;
62
+ incomplete: z.ZodOptional<z.ZodBoolean>;
60
63
  }, z.core.$loose>>>;
61
64
  }, z.core.$loose>>>;
62
65
  forkedFrom: z.ZodOptional<z.ZodString>;
@@ -168,6 +171,7 @@ export declare const SessionFacetSchema: z.ZodObject<{
168
171
  tool_error_categories: z.ZodRecord<z.ZodString, z.ZodNumber>;
169
172
  friction_counts: z.ZodRecord<z.ZodString, z.ZodNumber>;
170
173
  friction_detail: z.ZodString;
174
+ compose_partial_nodes: z.ZodOptional<z.ZodNumber>;
171
175
  outcome: z.ZodEnum<{
172
176
  unknown: "unknown";
173
177
  aborted: "aborted";
@@ -56,6 +56,7 @@ export type JournalBlock = {
56
56
  type: 'tool_result';
57
57
  toolUseId: string;
58
58
  isError?: boolean;
59
+ incomplete?: boolean;
59
60
  content: JournalResultPart[];
60
61
  } | {
61
62
  type: 'image';
@@ -0,0 +1,5 @@
1
+ import type { DAGRunResult } from '../dag.js';
2
+ export declare function partialNodeFlag(partial: DAGRunResult['partial'] | undefined): {
3
+ incomplete: true;
4
+ incompleteReason: string;
5
+ } | Record<string, never>;
@@ -6,6 +6,8 @@ export interface DetachedToolResult {
6
6
  readonly output: string;
7
7
  readonly exitCode?: number;
8
8
  readonly durationMs: number;
9
+ readonly incomplete?: boolean;
10
+ readonly incompleteReason?: string;
9
11
  }
10
12
  export interface DetachToken {
11
13
  readonly toolUseId: string;
@@ -1,9 +1,21 @@
1
- import type { HookHandler } from '../../hooks.js';
1
+ import type { GrantManager } from '../grant-manager.js';
2
+ import type { HookDecision, HookHandler } from '../../hooks.js';
3
+ export { extractCandidatePath, extractAllPaths } from './path-approval-hook.prompt.js';
2
4
  export type PathApprovalSurface = 'repl' | 'telegram' | 'web' | 'unknown';
3
5
  export interface PathApprovalHookOptions {
4
6
  getCwd: () => string | undefined;
5
7
  surface: PathApprovalSurface;
6
8
  }
9
+ export interface PathApprovalState {
10
+ sessionApproved: Set<string>;
11
+ onceApproved: Map<string, {
12
+ resolvedPath: string;
13
+ mode: 'read' | 'write';
14
+ capturedCwd: string | undefined;
15
+ }>;
16
+ inFlight: Map<string, Promise<HookDecision>>;
17
+ lastSeenGrantManager: GrantManager | undefined;
18
+ }
7
19
  export interface PathApprovalHookHandlers {
8
20
  preToolUse: HookHandler;
9
21
  postToolUse: HookHandler;
@@ -0,0 +1,18 @@
1
+ import type { GrantManager } from '../grant-manager.js';
2
+ import type { HookDecision } from '../../hooks.js';
3
+ import type { PathApprovalState, PathApprovalSurface } from './path-approval-hook.js';
4
+ export declare function extractCandidatePath(toolName: string, input: Record<string, unknown>): string | undefined;
5
+ export declare function extractAllPaths(toolName: string, input: Record<string, unknown>): string[];
6
+ export declare function pathApprovalKey(mode: 'read' | 'write', resolvedPath: string): string;
7
+ export declare function promptForApproval(args: {
8
+ toolName: string;
9
+ resolvedPath: string;
10
+ allPaths?: string[];
11
+ capturedCwd: string | undefined;
12
+ mode: 'read' | 'write';
13
+ grantManager: GrantManager;
14
+ state: PathApprovalState;
15
+ surface: PathApprovalSurface;
16
+ signal?: AbortSignal;
17
+ sessionId?: string;
18
+ }): Promise<HookDecision>;
@@ -1,3 +1,4 @@
1
+ export { tokenizedSegmentReason } from './readonly-bash.tokenizer.js';
1
2
  export declare function classifyBashCommand(command: string): {
2
3
  mutating: boolean;
3
4
  reason?: string;
@@ -0,0 +1,10 @@
1
+ export interface CmdSegment {
2
+ readonly command: string;
3
+ readonly argv: readonly string[];
4
+ }
5
+ export declare function baseName(cmd: string): string;
6
+ export declare function tokenizeSegments(command: string): string[][];
7
+ export declare function resolveSegment(rawTokens: readonly string[], vars: Map<string, string>): CmdSegment | null;
8
+ export declare function gitSegmentReason(argv: readonly string[]): string | null;
9
+ export declare function curlSegmentMutating(seg: CmdSegment): boolean;
10
+ export declare function tokenizedSegmentReason(command: string): string | null;
@@ -1,3 +1,4 @@
1
+ export { renderReceiptMarkdown } from './receipt.render.js';
1
2
  import type { HookHandler } from '../hooks.js';
2
3
  import { type ClosureReason, type ToolFailureClass, type TraceEvent, type TraceEventKind } from './types.js';
3
4
  export declare const RECEIPT_SCHEMA_VERSION: 1;
@@ -78,7 +79,6 @@ export declare function receiptPathsFor(tracePath: string): {
78
79
  mdPath: string;
79
80
  };
80
81
  export declare function generateReceipt(events: TraceEvent[], meta: ReceiptMeta): RunReceipt;
81
- export declare function renderReceiptMarkdown(r: RunReceipt): string;
82
82
  export interface WriteRunReceiptOptions {
83
83
  tracePath: string;
84
84
  sessionId?: string;
@@ -0,0 +1,2 @@
1
+ import type { RunReceipt } from './receipt.js';
2
+ export declare function renderReceiptMarkdown(r: RunReceipt): string;
@@ -51,6 +51,8 @@ export interface ToolResultChunk {
51
51
  toolUseId: string;
52
52
  content: string;
53
53
  isError?: boolean;
54
+ incomplete?: boolean;
55
+ incompleteReason?: string;
54
56
  truncated?: boolean;
55
57
  persistedPath?: string;
56
58
  capturePath?: string;
@@ -0,0 +1,43 @@
1
+ export declare const MIN_EMPTY_AGE_MS = 3600000;
2
+ export type DirtyReason = 'clean' | 'uncommitted changes' | 'git status failed' | `non-rebuildable ignored files: ${string}` | 'ignored-file probe failed';
3
+ export interface WorktreeMeta {
4
+ owner: 'interactive' | 'diagnose' | string;
5
+ pid?: number;
6
+ createdAt: string;
7
+ baseSha?: string;
8
+ baseBranch?: string;
9
+ preservedReason?: 'dirty' | 'commits-ahead' | 'ignored-local-state';
10
+ preservedAt?: string;
11
+ commitsAheadAtPreserve?: number;
12
+ }
13
+ export interface WorktreeCandidate {
14
+ path: string;
15
+ head?: string;
16
+ branch?: string;
17
+ locked: boolean;
18
+ prunable: boolean;
19
+ meta?: WorktreeMeta;
20
+ ageMs: number;
21
+ isDirty: boolean;
22
+ dirtyReason: DirtyReason;
23
+ commitsAhead: number;
24
+ commitsUnpushed: number;
25
+ ownerLiveness: 'alive' | 'dead' | 'unknown';
26
+ }
27
+ export type WorktreeVerdict = 'empty' | 'stale-clean' | 'stale-dirty' | 'locked' | 'active' | 'orphaned-dir' | 'orphaned-dir-preserved' | 'orphaned-registration' | 'dead-owner';
28
+ export declare const MAX_TRUSTED_PID_AGE_MS: number;
29
+ export { isProcessAlive } from '../process-liveness.js';
30
+ export declare function realpathSafe(p: string): string;
31
+ export declare function isPathWithin(child: string, parent: string): boolean;
32
+ export declare function shortBranchName(branch: string): string;
33
+ export interface ParsedWorktree {
34
+ path: string;
35
+ head: string;
36
+ branch: string;
37
+ locked: boolean;
38
+ lockReason?: string;
39
+ prunable: boolean;
40
+ isBare: boolean;
41
+ }
42
+ export declare function parseWorktreeList(stdout: string): ParsedWorktree[];
43
+ export declare function classifyCandidate(candidate: WorktreeCandidate, maxAgeDaysClean: number, maxAgeDaysDirty: number): WorktreeVerdict;
@@ -1,4 +1,6 @@
1
1
  import { type PresenceRecord } from '../awareness/presence.js';
2
+ import { type WorktreeVerdict } from './worktree-sweep.classify.js';
3
+ export { MIN_EMPTY_AGE_MS } from './worktree-sweep.classify.js';
2
4
  export type ExecFileFn = (file: string, args: string[], opts?: {
3
5
  cwd?: string;
4
6
  maxBuffer?: number;
@@ -7,7 +9,6 @@ export type ExecFileFn = (file: string, args: string[], opts?: {
7
9
  stdout: string;
8
10
  stderr: string;
9
11
  }>;
10
- type WorktreeVerdict = 'empty' | 'stale-clean' | 'stale-dirty' | 'locked' | 'active' | 'orphaned-dir' | 'orphaned-dir-preserved' | 'orphaned-registration' | 'dead-owner';
11
12
  export interface SweepOptions {
12
13
  execFile: ExecFileFn;
13
14
  repoRoot: string;
@@ -33,6 +34,4 @@ export interface SweepResult {
33
34
  candidates: SweepCandidateSummary[];
34
35
  contested?: boolean;
35
36
  }
36
- export declare const MIN_EMPTY_AGE_MS = 3600000;
37
37
  export declare function runSweep(options: SweepOptions): Promise<SweepResult>;
38
- export {};
@@ -0,0 +1,5 @@
1
+ export declare function countPriorSuccessfulRuns(telemetryPath: string): Promise<number>;
2
+ export declare class LockContestedError extends Error {
3
+ constructor(lockPath: string);
4
+ }
5
+ export declare function acquireLock(lockPath: string): Promise<() => Promise<void>>;
@@ -0,0 +1,25 @@
1
+ export interface CsiHost {
2
+ readonly cols: number;
3
+ readonly rows: number;
4
+ readonly grid: string[][];
5
+ cursorRow: number;
6
+ cursorCol: number;
7
+ pendingWrap: boolean;
8
+ scrollTop: number;
9
+ scrollBottom: number;
10
+ cursorHidden: boolean;
11
+ readonly oscSequences: string[];
12
+ scrollback: string[];
13
+ clampRow(r: number): number;
14
+ clampCol(c: number): number;
15
+ lineAt(row: number): string;
16
+ scrollRegionUp(): void;
17
+ }
18
+ export declare function normalizeCsiParams(raw: number[]): number[];
19
+ export declare function eraseCursorToEndOfLine(host: CsiHost): void;
20
+ export declare function eraseStartOfLineToCursor(host: CsiHost): void;
21
+ export declare function eraseEntireLine(host: CsiHost): void;
22
+ export declare function eraseCursorToEndOfScreen(host: CsiHost): void;
23
+ export declare function eraseStartOfScreenToCursor(host: CsiHost): void;
24
+ export declare function eraseEntireScreen(host: CsiHost): void;
25
+ export declare function dispatchCsi(host: CsiHost, final: number, rawParams: number[], privatePrefix: boolean): void;
@@ -26,18 +26,11 @@ export declare class VirtualScreen {
26
26
  private processEscByte;
27
27
  private processCsiByte;
28
28
  private dispatchCsi;
29
- private normalizeCsiParams;
30
29
  private processOscByte;
31
30
  private processUtf8Byte;
32
31
  private putChar;
33
32
  private lineFeed;
34
33
  private scrollRegionUp;
35
- private eraseCursorToEndOfLine;
36
- private eraseStartOfLineToCursor;
37
- private eraseEntireLine;
38
- private eraseCursorToEndOfScreen;
39
- private eraseStartOfScreenToCursor;
40
- private eraseEntireScreen;
41
34
  visibleLines(): string[];
42
35
  lineAt(row: number): string;
43
36
  scrollbackLines(): string[];
@@ -39,7 +39,6 @@ export declare class ToolLane {
39
39
  findLastSkillEntryId(): string | undefined;
40
40
  peekTrailingCompletedRootToolName(): string | undefined;
41
41
  getOverlay(): string;
42
- private ancestorDepthOf;
43
42
  flushSource(parentId: string, homeDir?: string): string[];
44
43
  flushCompletedRoots(homeDir?: string): string[];
45
44
  flush(homeDir?: string): string[];
@@ -0,0 +1,8 @@
1
+ import { type Entry } from './tool-lane-render.js';
2
+ export interface ToolLaneFlushHost {
3
+ readonly entries: Map<string, Entry>;
4
+ order: string[];
5
+ readonly compactScrollback: boolean;
6
+ }
7
+ export declare function flushSource(host: ToolLaneFlushHost, parentId: string, homeDir?: string): string[];
8
+ export declare function flushCompletedRoots(host: ToolLaneFlushHost, homeDir?: string): string[];
@@ -1,4 +1,5 @@
1
1
  import type { ElicitationRequest, ElicitationResult } from '../../agent/types/sdk-types.js';
2
2
  import type { ReplElicitationDeps } from './repl-shared.js';
3
- export declare const SKIP: ElicitationResult;
3
+ import { SKIP } from './agent-question.fallback.js';
4
+ export { SKIP };
4
5
  export declare function renderAgentQuestion(request: ElicitationRequest, deps: ReplElicitationDeps, signal: AbortSignal): Promise<ElicitationResult>;
@@ -0,0 +1,11 @@
1
+ import type { ElicitationRequest, ElicitationResult } from '../../agent/types/sdk-types.js';
2
+ import type { ReplElicitationDeps } from './repl-shared.js';
3
+ export declare const SKIP: ElicitationResult;
4
+ type Writer = ReplElicitationDeps['writer'];
5
+ type ReadLine = ReplElicitationDeps['readLine'];
6
+ export declare function renderConfirmFallback(request: ElicitationRequest, readLine: ReadLine, writer: Writer, signal: AbortSignal): Promise<ElicitationResult>;
7
+ export declare function renderChoiceFallback(request: ElicitationRequest, readLine: ReadLine, writer: Writer, signal: AbortSignal): Promise<ElicitationResult>;
8
+ export declare function renderMultiChoiceFallback(request: ElicitationRequest, readLine: ReadLine, writer: Writer, signal: AbortSignal): Promise<ElicitationResult>;
9
+ export declare function renderNumberFallback(request: ElicitationRequest, readLine: ReadLine, writer: Writer, signal: AbortSignal): Promise<ElicitationResult>;
10
+ export declare function renderTextFallback(request: ElicitationRequest, readLine: ReadLine, writer: Writer, signal: AbortSignal): Promise<ElicitationResult>;
11
+ export {};
@@ -22,6 +22,7 @@ export interface ToolEvent {
22
22
  inputRaw?: string;
23
23
  result?: string;
24
24
  isError?: boolean;
25
+ incomplete?: boolean;
25
26
  resultTail?: string;
26
27
  }
27
28
  export interface TurnRecord {
@@ -0,0 +1,3 @@
1
+ import type { KeyInfo } from './terminal-compositor.types.js';
2
+ import type { KeyDispatchHost } from './terminal-compositor.input-dispatch.js';
3
+ export declare function handleCursorAndEdit(self: KeyDispatchHost, key: KeyInfo): boolean;
@@ -0,0 +1,8 @@
1
+ import { InputCore } from './input-core.js';
2
+ import type { KeyInfo, SubmissionPayload } from './terminal-compositor.types.js';
3
+ import type { KeyDispatchHost } from './terminal-compositor.input-dispatch.js';
4
+ export declare function mergeSubmissionPayloads(payloads: readonly SubmissionPayload[]): SubmissionPayload;
5
+ export declare function commitIfChanged(self: KeyDispatchHost, next: ReturnType<typeof InputCore.seed>): true;
6
+ export declare function applyAtomicPlaceholderDelete(self: KeyDispatchHost, direction: 'backward' | 'forward'): boolean;
7
+ export declare function handleBackspace(self: KeyDispatchHost, key: KeyInfo): boolean;
8
+ export declare function handleEnter(self: KeyDispatchHost, key: KeyInfo, sequence: string): boolean;