import type { ContextAttemptReference, ContextSnapshotScope } from "../../llm/context-snapshot.js"; import type { SessionPlan } from "../../store/plan.js"; import type { ProviderId } from "../../types.js"; export type Brand = T & { readonly __brand: B; }; export type SessionId = Brand; export type TurnId = Brand; export type MessageId = Brand; export type ToolCallId = Brand; export type PlanId = Brand; export type TaskId = Brand; export declare const asSessionId: (value: string) => SessionId; export declare const asTurnId: (value: string) => TurnId; export declare const asMessageId: (value: string) => MessageId; export declare const asToolCallId: (value: string) => ToolCallId; export declare const asPlanId: (value: string) => PlanId; export declare const asTaskId: (value: string) => TaskId; export declare const APP_EVENT_VERSION: 1; export interface AppEvent { readonly id: string; readonly version: typeof APP_EVENT_VERSION; readonly sequence: number; readonly sessionId: SessionId; readonly turnId?: TurnId | undefined; readonly timestamp: number; readonly type: TType; readonly payload: TPayload; } export interface OutputChunkRef { readonly toolCallId: ToolCallId; readonly chunkBytes: number; readonly totalBytes: number; } export interface AppEventPayloads { "turn-started": { readonly prompt: string; readonly displayPrompt?: string | null | undefined; }; status: { readonly text: string; readonly step?: number | undefined; }; "thinking-delta": { readonly text: string; readonly reasoningId: string; }; "thinking-block": { readonly messageId: MessageId; readonly content: string; readonly reasoningId: string; }; "assistant-delta": { readonly text: string; }; "assistant-message": { readonly messageId: MessageId; readonly text: string; }; notice: { readonly level: "info" | "warn"; readonly text: string; }; "tool-call": { readonly toolCallId: ToolCallId; readonly name: string; readonly argsDisplay: string; }; "tool-started": { readonly toolCallId: ToolCallId; }; "tool-output": { readonly ref: OutputChunkRef; }; "tool-result": { readonly toolCallId: ToolCallId; readonly ok: boolean; readonly exitCode?: number | undefined; readonly runFailure?: boolean | undefined; readonly summary: string; readonly artifactPath?: string | undefined; readonly fileChanges?: import("../../tools/file-diff.js").FileChange[] | undefined; }; "tool-blocked": { readonly toolCallId: ToolCallId; readonly name: string; readonly reason: string; }; "plan-updated": { readonly planId: PlanId; readonly plan: SessionPlan; }; "plan-cleared": { readonly planId: PlanId; }; "confirm-requested": { readonly requestId: string; readonly kind: "tool" | "pentest" | "reset" | "continue" | "plan" | "switch"; readonly prompt: string; }; "compaction-started": { readonly compactionId: string; readonly beforeTokens: number; }; "compaction-delta": { readonly compactionId: string; readonly text: string; readonly replace?: boolean | undefined; }; "compaction-completed": { readonly compactionId: string; readonly summary: string; readonly beforeTokens: number; readonly afterTokens: number; readonly contextScope: Extract; }; "compaction-failed": { readonly compactionId: string; readonly message: string; readonly retainedTokens?: number | undefined; }; compacted: { readonly summary: string; readonly beforeTokens: number; readonly afterTokens: number; }; "token-usage": { readonly promptTokens: number; readonly completionTokens: number; readonly totalTokens: number; readonly exact: boolean; readonly promptTokensKnown?: false | undefined; readonly cachedPromptTokens?: number | undefined; readonly cacheCreationTokens?: number | undefined; readonly uncachedPromptTokens?: number | undefined; readonly reasoningTokens?: number | undefined; readonly model?: string | undefined; readonly provider?: ProviderId | undefined; readonly api?: string | undefined; readonly attempt?: ContextAttemptReference | undefined; }; "context-estimate": { readonly estimatedTokens: number; readonly model?: string | undefined; readonly promptUsageMissing?: boolean | undefined; }; "turn-ended": { readonly finalAnswer: string; readonly steps: number; }; "turn-aborted": { readonly reason?: string | undefined; }; "turn-error": { readonly message: string; }; } export type AppEventType = keyof AppEventPayloads; export type TypedAppEvent = K extends AppEventType ? AppEvent : never; export type AnyAppEvent = TypedAppEvent; export declare function isDeltaEvent(type: AppEventType): boolean; export declare function isStructuralEvent(type: AppEventType): boolean;