import type { ConnectorContent, ConnectorEntry, ConnectorInfo, ListOptions, MountInfo, SearchOptions } from "@skaile/workspaces/types"; import type { ConnectorStatus, ResourceClientSnapshot, StoreTransport, SubscribableStore } from "./types.js"; /** * Lazy resource browser for agent connectors. * * Provides a reactive list of connected mounts and connectors, and * request/response methods for browsing connector contents. Shares * the same transport (`send` + `onEvent`) as `AgentStore`. * @docLink packages/store/concepts#resource-client */ export declare class ResourceClient implements SubscribableStore { private readonly _send; private _mounts; private _connectors; /** Live connection status per connector, keyed by connector ID. Updated by connector_status events. */ connectorStatus: Map; private _snapshot; private readonly _listeners; private readonly _pendingRequests; private readonly _unsubEvent; /** * @param transport - Shared transport (same instance as the AgentStore for this session). */ constructor(transport: StoreTransport); /** Mounts available in this session, populated from `resources_available` events. */ get mounts(): readonly MountInfo[]; /** Tool-based connectors available in this session, populated from `resources_available` events. */ get connectors(): readonly ConnectorInfo[]; /** * List directory entries at the given path within a connector. * * @param connectorId - ID of the connector to query. * @param path - Directory path to list. Omit for the connector root. * @param opts - Optional pagination and filter options. * @returns Array of entries (files, directories, etc.) at the given path. * @throws If the request times out or the connector returns an error. */ list(connectorId: string, path?: string, opts?: ListOptions): Promise; /** * Read the content of a single resource. * * @param connectorId - ID of the connector to query. * @param path - Full path to the resource within the connector. * @returns The resource content object. * @throws If the request times out or the connector returns an error. */ read(connectorId: string, path: string): Promise; /** * Write content to a resource, creating it if it does not exist. * * @param connectorId - ID of the connector to write to. * @param path - Full path to the resource within the connector. * @param content - Content to write. * @throws If the request times out or the connector returns an error. */ write(connectorId: string, path: string, content: ConnectorContent): Promise; /** * Delete a resource from a connector. * * @param connectorId - ID of the connector to delete from. * @param path - Full path to the resource within the connector. * @throws If the request times out or the connector returns an error. */ delete(connectorId: string, path: string): Promise; /** * Full-text search within a connector. * * @param connectorId - ID of the connector to search. * @param query - Search query string. * @param opts - Optional search options (e.g. path prefix, result limit). * @returns Matching entries, ordered by relevance as determined by the connector. * @throws If the request times out or the connector returns an error. */ search(connectorId: string, query: string, opts?: SearchOptions): Promise; /** * Register a change listener. Called after every resource availability change. * * Conforms to the `subscribe` parameter of React's `useSyncExternalStore`. * * @param listener - Callback invoked whenever mounts or connectors change. * @returns Unsubscribe function — call to stop receiving notifications. */ subscribe: (listener: () => void) => (() => void); /** * Return the current immutable resource snapshot. * * A new object is produced lazily after each `resources_available` event. * Conforms to the `getSnapshot` parameter of React's `useSyncExternalStore`. */ getSnapshot: () => ResourceClientSnapshot; /** * Send a `connector_config` add command to wire a new connector at runtime, * without restarting the session. The runner receives this command and * calls `ConnectorManager.connect()`, which fires a `connector_status` event * back to the store once the connector is live. * * @param declaration - Connector declaration (id, driver, access level, options). */ addConnector(declaration: { id: string; driver: string; access?: "read-only" | "read-write"; options?: Record; }): void; /** * Send a `connector_config` remove command to disconnect a connector by ID * without restarting the session. * * @param connectorId - ID of the connector to disconnect and remove. */ removeConnector(connectorId: string): void; /** * Send a `connector_config` refresh command to reconnect all configured * connectors (e.g. after a credentials change). */ refreshConnectors(): void; /** * Unsubscribe from transport events, reject all pending requests, and * clear all change listeners. * * All in-flight `list`/`read`/`write`/`delete`/`search` calls will reject * with `"ResourceClient disposed"`. */ dispose(): void; private _handleEvent; private _request; } //# sourceMappingURL=resource-client.d.ts.map