import type { ImageContent } from '@earendil-works/pi-ai'; import type { AppContextEnvelope } from '@xopcai/gateway-contract'; import type { GatewayPrincipal } from '../../gateway/security/gateway-principal.js'; export interface AppContextGrant { principal: GatewayPrincipal; authRevision: string; } export interface SessionSourceBinding { kind: 'note'; sourceId: string; version: string; attachedAt: number; } export interface TurnContextRef { refId?: string; kind: 'note' | 'task' | 'file' | 'session' | 'browser_tab' | 'mcp_resource' | 'user_assertion'; sourceId: string; expectedVersion?: string; } export interface SourceContextRefSummary { refId?: string; kind: AgentSourceContext['kind']; sourceId: string; version: string; title: string; tokenEstimate?: number; truncated?: boolean; url?: string; capturedAt?: number; documentId?: string; fileKind?: 'file' | 'directory'; } export interface AgentSourceContext { refId?: string; kind: SessionSourceBinding['kind'] | 'task' | 'file' | 'session' | 'mcp_resource' | 'browser_tab' | 'browser_page' | 'app_context' | 'user_assertion'; sourceId: string; version: string; title: string; text: string; images?: ImageContent[]; tokenEstimate?: number; truncated?: boolean; url?: string; capturedAt?: number; documentId?: string; fileKind?: 'file' | 'directory'; appContext?: AppContextEnvelope; appContextGrant?: AppContextGrant; } export declare function summarizeSourceContext(context: AgentSourceContext): SourceContextRefSummary; export declare function isTurnContextRef(value: unknown): value is TurnContextRef; export declare function parseTurnContextRefs(value: unknown, max?: number): TurnContextRef[] | null; export type AgentSourceContextResolver = (binding: SessionSourceBinding, conversationId: string) => Promise; export declare function isSessionSourceBinding(value: unknown): value is SessionSourceBinding;