export interface StatusResponse { ok: boolean; pluginId: string; pluginVersion: string; vaultName: string; readyAt: number; } export interface ActiveNotePayload { path: string; basename: string; extension: string; cursor?: { line: number; ch: number; }; selection?: { from: { line: number; ch: number; }; to: { line: number; ch: number; }; } | null; } export interface ActiveResponse { active: ActiveNotePayload | null; } /** * Normalized Dataview result wire shape (matches the plugin's * `src/dataview/normalize.ts`). Discriminated on `kind`. */ export type DataviewValue = string | number | boolean | null | DataviewValue[] | { [k: string]: DataviewValue; }; export interface DataviewListItem { task: boolean; text: string; path: string; line: number; section?: string; blockId?: string; tags: string[]; annotated?: boolean; children: DataviewListItem[]; status?: string; checked?: boolean; completed?: boolean; fullyCompleted?: boolean; due?: string | null; completion?: string | null; scheduled?: string | null; start?: string | null; created?: string | null; } export interface DataviewEvent { date: string | null; link: string; value?: DataviewValue[]; } export type DataviewResult = { kind: 'table'; headers: string[]; rows: DataviewValue[][]; } | { kind: 'list'; values: DataviewValue[]; } | { kind: 'task'; items: DataviewListItem[]; } | { kind: 'calendar'; events: DataviewEvent[]; }; /** * Arguments accepted by the plugin's POST /base endpoint. Either `file` * (vault-relative path to a `.base` YAML file) or `yaml` (inline source) is * required — both may be sent but the plugin prefers `file` when present. */ export interface BaseRequest { file?: string; yaml?: string; view: string; } /** * Row shape returned by the plugin's POST /base endpoint. The `file` field is * always populated with at minimum `{name, path}`; other columns are pulled * from the view's `columns:` list, flattened to primitives on the plugin side. */ export interface BaseRow { file: { name: string; path: string; [k: string]: unknown; }; [column: string]: unknown; } export interface BaseResult { view: string; rows: BaseRow[]; total: number; executedAt: string; } /** * HTTP client for the obsidian-brain-companion Obsidian plugin. Reads the * discovery file at construction-time (lazily) and re-reads it when requests * fail with 401 (rotated token) or ECONNREFUSED (plugin restarted on a new * port). Throws PluginUnavailableError with a user-facing message when the * plugin is absent or unreachable. */ export declare class ObsidianClient { private readonly vaultPath; private cache; private cachedAt; constructor(vaultPath: string); status(): Promise; active(): Promise; /** * Returns true if the plugin advertises the given capability in its * discovery file. Used by capability-gated tools (e.g. dataview_query) * to fail fast with an upgrade prompt before the HTTP call. * * Throws PluginUnavailableError if the plugin is not reachable at all. */ has(capability: string): Promise; /** * Runs a Dataview DQL query against the vault via the companion plugin. * Returns the plugin's normalized `{ kind, ... }` shape. * * `timeoutMs` aborts the HTTP wait only — the Dataview query itself has no * cancellation API, so on timeout the query keeps running inside Obsidian * to completion. Prefer `LIMIT N` in DQL for open-ended queries. */ dataview(query: string, source?: string, timeoutMs?: number): Promise; /** * Evaluates an Obsidian Bases `.base` YAML file against the vault via the * companion plugin. The plugin runs a Path B evaluator (own YAML parser + * whitelisted expression subset) because Obsidian 1.12.x does not expose * a public read-access API for Bases (only a view-factory hook via * `Plugin.registerBasesView()`). See `docs/plugin.md` for the supported * subset; arithmetic, formulas, summaries, regex, method calls other than * `file.hasTag`/`file.inFolder`, and function calls all surface as * `unsupported_construct` errors and ship in subsequent v1.4.x patches. */ base(args: BaseRequest, opts?: { timeoutMs?: number; }): Promise; private getDiscovery; private request; }