agent-afk 5.237.1 → 5.237.3

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,9 @@
1
+ import type { TurnHandles, CompletionWriter } from './shared.js';
2
+ import { type QueuedFlushCompositor } from './queued-flush.js';
3
+ export interface SubagentPromotionContext {
4
+ h: TurnHandles;
5
+ borrowedCompositor: QueuedFlushCompositor | null;
6
+ completionWriter: CompletionWriter | undefined;
7
+ }
8
+ export declare function makeHandleBackgroundKey(ctx: SubagentPromotionContext): () => void;
9
+ export declare function installSubagentPromotion(ctx: SubagentPromotionContext): void;
@@ -0,0 +1,22 @@
1
+ import type { SessionStats, ToolEvent } from '../../slash/types.js';
2
+ import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
3
+ import type { CompletionWriter, TurnHandles } from './shared.js';
4
+ import type { StreamEventState } from './turn-handler.stream-events.js';
5
+ import type { TerminalCompositor } from '../../terminal-compositor.js';
6
+ import type { StreamRenderer } from '../../_lib/stream-renderer.js';
7
+ export declare function buildAssistantContentBlocks(responseText: string, toolEvents: ToolEvent[]): ContentBlockParam[] | undefined;
8
+ export declare function buildUserContentBlocks(userText: string, toolEvents: ToolEvent[]): ContentBlockParam[] | undefined;
9
+ export interface TurnCompletionContext {
10
+ state: StreamEventState;
11
+ stats: SessionStats;
12
+ h: TurnHandles;
13
+ toolEvents: ToolEvent[];
14
+ historyText: string;
15
+ assistantBlocks: ContentBlockParam[] | undefined;
16
+ userBlocks: ContentBlockParam[] | undefined;
17
+ completionWriter: CompletionWriter | undefined;
18
+ borrowedCompositor: TerminalCompositor | null;
19
+ renderer: StreamRenderer;
20
+ disposeRendererOnce: () => Promise<void>;
21
+ }
22
+ export declare function handleTurnCompletion(ctx: TurnCompletionContext): Promise<void>;
@@ -1,12 +1,10 @@
1
1
  import type { AgentSession } from '../../../agent/session.js';
2
- import type { SessionStats, ToolEvent } from '../../slash/types.js';
3
- import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
2
+ import type { SessionStats } from '../../slash/types.js';
4
3
  import { type ImageAttachment } from '../../input/attachments.js';
5
4
  import type { InputSurfaceRefs } from '../../input/input-surface.js';
6
5
  import { type CompletionWriter, type ThinkingUiMode, type TurnHandles } from './shared.js';
7
6
  export { formatToolLine, formatToolResultLine, ToolLane } from './tool-lane.js';
8
- export declare function buildAssistantContentBlocks(responseText: string, toolEvents: ToolEvent[]): ContentBlockParam[] | undefined;
9
- export declare function buildUserContentBlocks(userText: string, toolEvents: ToolEvent[]): ContentBlockParam[] | undefined;
7
+ export { buildAssistantContentBlocks, buildUserContentBlocks } from './turn-handler.completion.js';
10
8
  export type { InputSurfaceRefs } from '../../input/input-surface.js';
11
9
  export declare function runTurn(input: {
12
10
  text: string;
@@ -0,0 +1,39 @@
1
+ import type { OutputEvent } from '../../../agent/types.js';
2
+ import type { AgentSession } from '../../../agent/session.js';
3
+ import type { ResponseMetadata } from '../../../agent/types/message-types.js';
4
+ import type { CompletionWriter, TurnHandles } from './shared.js';
5
+ import type { TerminalCompositor } from '../../terminal-compositor.js';
6
+ import type { ToolEvent } from '../../slash/types.js';
7
+ import { StreamRenderer } from '../../_lib/stream-renderer.js';
8
+ import { type TurnTtfbState } from './turn-handler.ttfb.js';
9
+ import { type PausedPickerRef } from './turn-handler.paused.js';
10
+ export interface StreamEventState {
11
+ responseText: string;
12
+ roundStartResponseLen: number;
13
+ pendingRoundSeam: boolean;
14
+ streamingStarted: boolean;
15
+ streamErrorRendered: boolean;
16
+ doneFired: boolean;
17
+ doneMeta: ResponseMetadata | undefined;
18
+ softStopRequested: boolean;
19
+ pauseInterruptRequested: boolean;
20
+ lastContextProgressMs: number;
21
+ rendererDisposed: boolean;
22
+ }
23
+ export interface StreamEventContext {
24
+ state: StreamEventState;
25
+ pickerRef: PausedPickerRef;
26
+ toolEvents: ToolEvent[];
27
+ pendingTools: Map<string, ToolEvent>;
28
+ getRenderer: () => StreamRenderer;
29
+ setRenderer: (r: StreamRenderer) => void;
30
+ turnTtfb: TurnTtfbState;
31
+ h: TurnHandles;
32
+ session: AgentSession;
33
+ completionWriter: CompletionWriter | undefined;
34
+ borrowedCompositor: TerminalCompositor | null;
35
+ disposeRendererOnce: () => Promise<void>;
36
+ armAndWire: () => Promise<void>;
37
+ buildRenderer: () => StreamRenderer;
38
+ }
39
+ export declare function processStreamEvent(event: OutputEvent, ctx: StreamEventContext): Promise<'continue' | 'normal'>;