agent-afk 5.165.2 → 5.166.1

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.
@@ -1,5 +1,6 @@
1
1
  import { type HookRegistry } from './hooks.js';
2
2
  import { MemoryStore } from './memory/index.js';
3
+ import { type PreviewDiffRef } from './tools/hooks/edit-preview-hook.js';
3
4
  import type { PermissionMode } from './types/sdk-types.js';
4
5
  import type { TraceSink } from './trace/index.js';
5
6
  import type { LoadedHooksConfig } from './hooks/config-loader.js';
@@ -12,6 +13,7 @@ export interface SubagentCompleteInfo {
12
13
  export interface DefaultHookRegistryResult {
13
14
  registry: HookRegistry;
14
15
  memoryStore: MemoryStore;
16
+ addPreviewDiffRef: PreviewDiffRef;
15
17
  }
16
18
  export declare function _resetWarningForTests(): void;
17
19
  export declare function createDefaultHookRegistry(onSubagentComplete?: (info: SubagentCompleteInfo) => void, surface?: string, memoryStore?: MemoryStore, getPermissionMode?: () => PermissionMode, hookConfig?: LoadedHooksConfig, agentOptions?: {
@@ -44,6 +44,7 @@ export interface PreToolUseContext {
44
44
  toolName: string;
45
45
  input?: unknown;
46
46
  grantManager?: GrantManager;
47
+ toolUseId?: string;
47
48
  }
48
49
  export interface PostToolUseContext {
49
50
  event: 'PostToolUse';
@@ -0,0 +1,9 @@
1
+ import type { HookHandler } from '../../hooks.js';
2
+ import type { DiffPayload } from '../../../utils/diff.js';
3
+ export type PreviewDiffRef = {
4
+ current: (toolUseId: string, diff: DiffPayload) => void;
5
+ };
6
+ export interface EditPreviewHookOptions {
7
+ addPreviewDiffRef: PreviewDiffRef;
8
+ }
9
+ export declare function createEditPreviewHook(opts: EditPreviewHookOptions): HookHandler;
@@ -2,6 +2,7 @@ import type { Writer } from '../slash/types.js';
2
2
  import type { IHistoryRing } from '../input/types.js';
3
3
  import type { AutocompleteState } from '../input/autocomplete-state.js';
4
4
  import type { TerminalCompositor } from '../terminal-compositor.js';
5
+ import type { PreviewDiffRef } from '../../agent/tools/hooks/edit-preview-hook.js';
5
6
  export interface StreamRendererOptions {
6
7
  out: Writer;
7
8
  thinkingMode?: 'off' | 'summary' | 'live' | 'digest';
@@ -22,4 +23,5 @@ export interface StreamRendererOptions {
22
23
  compositor?: TerminalCompositor;
23
24
  onStageChange?: (stage: import('../commands/interactive/loop-stage.js').LoopStage, signals?: import('../commands/interactive/loop-stage.js').StageSignals) => void;
24
25
  turnStartedAt?: number;
26
+ addPreviewDiffRef?: PreviewDiffRef;
25
27
  }
@@ -44,6 +44,7 @@ export declare class StreamRenderer {
44
44
  private readonly ttfbStartedAt;
45
45
  private ttfbDone;
46
46
  private lastTtfbAnnotation;
47
+ private readonly addPreviewDiffRef;
47
48
  readonly sink: (event: OutputEvent, meta?: SubagentProgressMeta) => void;
48
49
  constructor(opts: StreamRendererOptions);
49
50
  arm(): Promise<void>;
@@ -3,6 +3,7 @@ import type { MemoryStore } from '../../../agent/memory/index.js';
3
3
  import type { TraceSink } from '../../../agent/trace/index.js';
4
4
  import type { SessionStats } from '../../slash/types.js';
5
5
  import type { CompletionWriter } from './shared.js';
6
+ import type { PreviewDiffRef } from '../../../agent/tools/hooks/edit-preview-hook.js';
6
7
  export declare function createReplHookRegistry(a: {
7
8
  completionWriter: CompletionWriter;
8
9
  memoryStore: MemoryStore;
@@ -11,4 +12,5 @@ export declare function createReplHookRegistry(a: {
11
12
  traceWriter: TraceSink | undefined;
12
13
  }): {
13
14
  hookRegistry: HookRegistry;
15
+ addPreviewDiffRef: PreviewDiffRef;
14
16
  };
@@ -1,5 +1,6 @@
1
1
  import * as readline from 'node:readline';
2
2
  import type { HookRegistry } from '../../../agent/hooks.js';
3
+ import type { PreviewDiffRef } from '../../../agent/tools/hooks/edit-preview-hook.js';
3
4
  import type { SessionRef } from '../../../agent/session-ref.js';
4
5
  import type { MemoryStore } from '../../../agent/memory/index.js';
5
6
  import type { AgentModelInput } from '../../../agent/types.js';
@@ -76,6 +77,7 @@ export interface InteractiveCtx {
76
77
  suggestGhostConfig?: boolean;
77
78
  viewingTaskId?: string;
78
79
  hookRegistry?: HookRegistry;
80
+ addPreviewDiffRef?: PreviewDiffRef;
79
81
  }
80
82
  export interface CompletionWriter {
81
83
  fn: (line: string) => void;
@@ -106,6 +108,7 @@ export interface TurnHandles {
106
108
  setPauseInterruptHandler?(handler: (() => void) | null): void;
107
109
  onContextProgress?(): void | Promise<void>;
108
110
  onStageChange?(stage: import('./loop-stage.js').LoopStage, signals?: import('./loop-stage.js').StageSignals): void;
111
+ addPreviewDiffRef?: PreviewDiffRef;
109
112
  }
110
113
  export declare const REPL_SPINNER_OPTIONS: {
111
114
  readonly stream: NodeJS.WriteStream & {
@@ -1,4 +1,6 @@
1
1
  import type { DiffPayload } from '../../../utils/diff.js';
2
2
  export declare const MAX_OVERLAY_DIFF_LINES = 8;
3
3
  export declare const FLUSH_DIFF_LINES_DEFAULT = 30;
4
+ export declare function diffsDisabled(): boolean;
4
5
  export declare function formatDiffBlock(diff: DiffPayload, mode: 'overlay' | 'flush', indent: string): string[];
6
+ export declare function formatPreviewDiffBlock(diff: DiffPayload, indent: string): string[];
@@ -3,7 +3,7 @@ import type { ToolFailureClass } from '../../../agent/trace/types.js';
3
3
  import { sanitizeLabel, sanitizeTextParagraph } from './tool-lane-format-sanitize.js';
4
4
  export { sanitizeLabel, sanitizeTextParagraph };
5
5
  export { shortenPaths, summarizeToolArgs, bracketPairAwareTruncate, formatToolLine, } from './tool-lane-format-args.js';
6
- export { MAX_OVERLAY_DIFF_LINES, FLUSH_DIFF_LINES_DEFAULT, formatDiffBlock, } from './tool-lane-format-diff.js';
6
+ export { MAX_OVERLAY_DIFF_LINES, FLUSH_DIFF_LINES_DEFAULT, formatDiffBlock, diffsDisabled, formatPreviewDiffBlock, } from './tool-lane-format-diff.js';
7
7
  export declare function doneGlyph(isError: boolean | undefined, failureClass?: ToolFailureClass): string;
8
8
  export declare function isBenignFailure(failureClass: ToolFailureClass | undefined): boolean;
9
9
  export declare const MAX_VISIBLE_CHILDREN = 3;
@@ -12,6 +12,7 @@ interface ToolEntryFields {
12
12
  agentResultSummary?: string;
13
13
  thinkingTail?: string;
14
14
  diff?: DiffPayload;
15
+ previewDiff?: DiffPayload;
15
16
  headerEmitted?: boolean;
16
17
  startedAt: number;
17
18
  }
@@ -17,6 +17,7 @@ export declare class ToolLane {
17
17
  setThinkingTail(toolUseId: string, tail: string | undefined): void;
18
18
  addResult(toolUseId: string, chunk: ToolResultChunk): void;
19
19
  addDiff(toolUseId: string, diff: DiffPayload): void;
20
+ addPreviewDiff(toolUseId: string, diff: DiffPayload): void;
20
21
  upsertTextChild(toolUseId: string, agentContext: string, text: string): void;
21
22
  removeTextChildrenUnder(agentContext: string): void;
22
23
  checkElapsedDisplayNeedsUpdate(): boolean;
@@ -14,3 +14,4 @@ export * from './utils.js';
14
14
  export * from './tool-card.js';
15
15
  export * from './interrupt-peek.js';
16
16
  export * from './compact-diff-view.js';
17
+ export * from './preview-diff.js';
@@ -0,0 +1,7 @@
1
+ import type { DiffPayload } from '../../utils/diff.js';
2
+ export interface PreviewDiffOptions {
3
+ filePath?: string;
4
+ maxLines?: number;
5
+ width?: number;
6
+ }
7
+ export declare function previewDiff(payload: DiffPayload, opts?: PreviewDiffOptions): string;