/** * Thin client for a separately operated agent-data/v1 node. * * The data node is a distinct security boundary from api.agenttool.dev. * This client therefore owns its base URL, timeout, and optional bearer; * callers must never pass the AgentTool project bearer to it implicitly. * * Protocol: agent-data/v1 */ export declare const AGENT_DATA_PROTOCOL: "agent-data/v1"; export declare const AGENT_DATA_SYNC_PROTOCOL: "agent-data-sync/v1"; export declare const AGENT_DATA_DISCOVERY_PATH: "/.well-known/agent-data"; /** Connection settings for an independently configured data node. */ export interface DataNodeOptions { baseUrl: string; /** Optional data-node bearer. This is not the AgentTool API bearer. */ token?: string; /** Request timeout in seconds. Defaults to 30. */ timeout?: number; } /** Forward-compatible manifest returned by `GET /v1/data/manifest`. */ export interface DataManifest { protocol?: string; [key: string]: unknown; } /** Forward-compatible collection descriptor. */ export interface DataCollection { id?: string; collection_id?: string; [key: string]: unknown; } /** Forward-compatible collection-list response. */ export interface DataCollectionsResult { collections?: DataCollection[]; [key: string]: unknown; } /** Input for one collector run. Wire keys intentionally stay snake_case. */ export interface DataCollectRequest { collection_id: string; collector_id: string; input: Record; cursor?: string; } /** Forward-compatible collection result. */ export interface DataCollectResult { records?: DataRecord[]; inserted?: number; existing?: number; cursor?: string; [key: string]: unknown; } /** Query a node-local index. Wire keys intentionally stay snake_case. */ export interface DataQueryRequest { collections?: string[]; text?: string; where?: Record; limit?: number; consistency?: "local"; } /** Forward-compatible query response. */ export interface DataQueryResult { records?: DataQueryHit[]; consistency?: "local"; [key: string]: unknown; } /** One node-local query hit. Scores are node-specific relevance values. */ export interface DataQueryHit { record?: DataRecord; score?: number; [key: string]: unknown; } /** Forward-compatible record returned by the node. */ export interface DataRecord { id?: string; collection_id?: string; [key: string]: unknown; } /** Resolved content returned beside an immutable record envelope. */ export interface DataRecordContent { encoding?: "utf8" | "base64"; data?: string; [key: string]: unknown; } /** Response from `GET /v1/data/records/:id`. */ export interface DataRecordResult { record?: DataRecord; content?: DataRecordContent; [key: string]: unknown; } /** Cursor options for the append-only changes feed. */ export interface DataChangesOptions { collection_id?: string; cursor?: string; limit?: number; } /** Forward-compatible changes response. */ export interface DataChangesResult { changes?: DataChange[]; cursor?: string; has_more?: boolean; [key: string]: unknown; } /** Forward-compatible append-only record or tombstone event. */ export interface DataChange { id?: string; type?: "record.created" | "record.tombstoned"; sequence?: number; collection_id?: string; record_id?: string; occurred_at?: string; record?: DataRecord; tombstone?: Record; [key: string]: unknown; } export interface DataTombstoneOptions { reason?: string; } /** Forward-compatible tombstone response. */ export interface DataTombstoneResult { record_id?: string; tombstoned?: boolean; [key: string]: unknown; } /** One bounded pull from a peer already configured on the local data node. */ export interface DataSyncPullRequest { peer_id: string; collection_id: string; limit?: number; max_pages?: number; max_plaintext_bytes?: number; } /** Select one locally configured peer/collection checkpoint. */ export interface DataSyncStatusRequest { peer_id: string; collection_id: string; } /** Sanitized local checkpoint metadata. Raw peer cursors are never exposed. */ export interface DataSyncStatus { protocol: typeof AGENT_DATA_SYNC_PROTOCOL; peer_id: string; collection_id: string; cursor_present: boolean; last_applied_at?: string; records_inserted: number; records_existing: number; tombstones_applied: number; } export type DataSyncStatusResult = DataSyncStatus; /** Exact public result of a bounded agent-data-sync/v1 pull. */ export interface DataSyncPullResult { protocol: typeof AGENT_DATA_SYNC_PROTOCOL; peer_id: string; origin_node_id: string; collection_id: string; pages_applied: number; changes_applied: number; records_inserted: number; records_existing: number; tombstones_applied: number; has_more: boolean; status: DataSyncStatus; } type DataNodeRequest = (method: string, path: string, body?: unknown) => Promise; /** * Client for an agent-data/v1 node. * * It deliberately does not accept AgentTool's shared `HttpConfig`: doing so * would make it too easy to leak the project bearer across this boundary. */ export declare class DataClient { /** Explicit peer synchronization through this local node's authority. */ readonly sync: DataSyncClient; private readonly baseUrl; private readonly headers; private readonly timeoutMs; constructor(options: DataNodeOptions); /** Read the node's agent-data/v1 capability manifest. */ manifest(): Promise; /** List collections visible to the configured data-node authority. */ collections(): Promise; /** Run a configured collector against a collection. */ collect(input: DataCollectRequest): Promise; /** Query local materialized indexes on the data node. */ query(input?: DataQueryRequest): Promise; /** Fetch one record by its stable ID. */ get(recordId: string): Promise; /** Read the cursor-based changes feed. */ changes(options?: DataChangesOptions): Promise; /** Append a tombstone; records remain addressable through change history. */ tombstone(recordId: string, options?: DataTombstoneOptions): Promise; private request; } /** * Narrow agent-data-sync/v1 façade. * * `peer_id` names a peer configured by the local node operator. This client * never accepts a peer bearer and never contacts that peer directly. */ export declare class DataSyncClient { private readonly requestLocalNode; /** @internal */ constructor(requestLocalNode: DataNodeRequest); /** Pull and apply a bounded number of remote changes into the local node. */ pull(input: DataSyncPullRequest): Promise; /** Read sanitized local checkpoint state without revealing the raw cursor. */ status(input: DataSyncStatusRequest): Promise; private request; } export {};