import { AgentAttachment } from '@multiplayer-app/ai-agent-types'; type BaseContextParams = { id?: string; /** * Human-friendly label used in the UI chip. */ name?: string; /** * Optional URL for the attachment (also used as a default source.url). */ url?: string; /** * Override capture time; otherwise set to now (ISO). */ capturedAt?: string; /** * Optional metadata hints for privacy / retention policy. */ security?: { containsPII?: boolean; redactionsApplied?: string[]; }; source?: { app?: string; url?: string; route?: string; domPath?: string; }; /** * Optional locator to re-find/highlight the original UI element later (e.g. on attachment click). */ target?: { type: 'text'; exact: string; prefix?: string; suffix?: string; domPath?: string; startOffset?: number; endOffset?: number; } | { type: 'dom'; domPath: string; } | { type: 'form'; formId?: string; fieldName?: string; domPath?: string; }; }; export type WebSnippetContextParams = BaseContextParams & { kind: 'webSnippet'; selectedText: string; title?: string; }; export type FormSnapshotContextParams = BaseContextParams & { kind: 'formSnapshot'; formId?: string; formName?: string; fields: Array<{ name: string; label?: string; value: string; inputType?: 'text' | 'textarea' | 'number' | 'select' | 'radio' | 'checkbox' | 'date' | 'email' | 'tel'; options?: Array<{ value: string; label: string; }>; domPath?: string; }>; }; export type FormFieldContextParams = BaseContextParams & { kind: 'formField'; formId?: string; fieldName: string; fieldLabel?: string; value: string; inputType?: 'text' | 'textarea' | 'number' | 'select' | 'radio' | 'checkbox' | 'date' | 'email' | 'tel'; options?: Array<{ value: string; label: string; }>; /** * Optional selector pointing at the actual input element in the DOM. */ domPath?: string; }; export type CustomContextParams = BaseContextParams & { /** * Any non-built-in kind. */ kind: string; title?: string; summary?: string; data?: Record; }; export type ContextAttachmentParams = WebSnippetContextParams | FormSnapshotContextParams | FormFieldContextParams | CustomContextParams; export type PageContextParams = BaseContextParams & { kind: 'pageContext'; /** * Optional short title shown in the UI / logs. * Defaults to `document.title` when available. */ title?: string; /** * Optional short summary string. */ summary?: string; /** * Arbitrary structured page context. */ data?: Record; }; /** * Build a `AgentAttachmentType.Context` attachment, filling required boilerplate: * `id`, `type`, `metadata.schemaVersion`, `metadata.capturedAt`, and default `source.url`. * * This intentionally keeps the API small and predictable; callers provide only the meaningful fields. */ export declare const createContextAttachment: (params: ContextAttachmentParams) => AgentAttachment; export type CreatePageContextAttachmentOptions = { /** * Override the URL; defaults to window.location.href. */ url?: string; /** * Include extra data fields in `metadata.data`. */ extra?: Record; /** * Include navigator.userAgent. Defaults to false (often noisy + fingerprinting). */ includeUserAgent?: boolean; /** * Include document.referrer. Defaults to true. */ includeReferrer?: boolean; /** * Include viewport info. Defaults to true. */ includeViewport?: boolean; /** * Include document.title. Defaults to true. */ includeTitle?: boolean; /** * Override the attachment chip label. */ name?: string; }; /** * Creates a stable "ambient" context attachment describing the current page. * Intended to be used as a default attachment and refreshed on route changes. */ export declare const createPageContextAttachment: (options?: CreatePageContextAttachmentOptions) => AgentAttachment | undefined; /** * Capture a robust-ish text selection descriptor (text quote selector). * This is not perfect, but is far more stable than raw Range offsets. */ export declare const captureTextSelectionTarget: () => { selectedText: string; target: BaseContextParams["target"]; } | undefined; export {}; //# sourceMappingURL=contextAttachments.d.ts.map