@oomkapwn/enquire-mcp 3.7.18 → 3.7.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -0
- package/dist/embed-db.d.ts.map +1 -1
- package/dist/embed-db.js +56 -44
- package/dist/embed-db.js.map +1 -1
- package/dist/fts5.d.ts.map +1 -1
- package/dist/fts5.js +63 -39
- package/dist/fts5.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/tool-registry.d.ts.map +1 -1
- package/dist/tool-registry.js +16 -0
- package/dist/tool-registry.js.map +1 -1
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +7 -1
- package/dist/vault.js.map +1 -1
- package/package.json +1 -1
- package/dist/tools.d.ts +0 -980
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -3132
- package/dist/tools.js.map +0 -1
- package/docs/api-reference/.nojekyll +0 -1
- package/docs/api-reference/assets/hierarchy.js +0 -1
- package/docs/api-reference/assets/highlight.css +0 -71
- package/docs/api-reference/assets/icons.js +0 -18
- package/docs/api-reference/assets/icons.svg +0 -1
- package/docs/api-reference/assets/main.js +0 -60
- package/docs/api-reference/assets/navigation.js +0 -1
- package/docs/api-reference/assets/search.js +0 -1
- package/docs/api-reference/assets/style.css +0 -1633
- package/docs/api-reference/functions/index.buildEmbedText.html +0 -15
- package/docs/api-reference/functions/index.buildMcpServer.html +0 -4
- package/docs/api-reference/functions/index.formatReadyBanner.html +0 -4
- package/docs/api-reference/functions/index.main.html +0 -1
- package/docs/api-reference/functions/index.parsePositiveInt.html +0 -1
- package/docs/api-reference/functions/index.parseQuantizationMode.html +0 -5
- package/docs/api-reference/functions/index.prepareServerDeps.html +0 -5
- package/docs/api-reference/functions/index.startServer.html +0 -1
- package/docs/api-reference/functions/tools.appendToNote.html +0 -17
- package/docs/api-reference/functions/tools.archiveNote.html +0 -15
- package/docs/api-reference/functions/tools.assertHnswModelMatchesEmbedder.html +0 -13
- package/docs/api-reference/functions/tools.chatThreadAppend.html +0 -22
- package/docs/api-reference/functions/tools.chatThreadRead.html +0 -16
- package/docs/api-reference/functions/tools.contextPack.html +0 -21
- package/docs/api-reference/functions/tools.createNote.html +0 -19
- package/docs/api-reference/functions/tools.dataviewQuery.html +0 -16
- package/docs/api-reference/functions/tools.embeddingsSearch.html +0 -40
- package/docs/api-reference/functions/tools.findPath.html +0 -23
- package/docs/api-reference/functions/tools.findSimilar.html +0 -21
- package/docs/api-reference/functions/tools.frontmatterGet.html +0 -15
- package/docs/api-reference/functions/tools.frontmatterSearch.html +0 -16
- package/docs/api-reference/functions/tools.frontmatterSet.html +0 -19
- package/docs/api-reference/functions/tools.getBacklinks.html +0 -15
- package/docs/api-reference/functions/tools.getNoteNeighbors.html +0 -16
- package/docs/api-reference/functions/tools.getOpenQuestions.html +0 -19
- package/docs/api-reference/functions/tools.getOutboundLinks.html +0 -16
- package/docs/api-reference/functions/tools.getRecentEdits.html +0 -14
- package/docs/api-reference/functions/tools.getUnresolvedWikilinks.html +0 -14
- package/docs/api-reference/functions/tools.getVaultStats.html +0 -13
- package/docs/api-reference/functions/tools.lintWiki.html +0 -20
- package/docs/api-reference/functions/tools.listCanvases.html +0 -16
- package/docs/api-reference/functions/tools.listNotes.html +0 -19
- package/docs/api-reference/functions/tools.listPdfs.html +0 -15
- package/docs/api-reference/functions/tools.listTags.html +0 -14
- package/docs/api-reference/functions/tools.ocrPdf.html +0 -18
- package/docs/api-reference/functions/tools.openInUi.html +0 -17
- package/docs/api-reference/functions/tools.paperAudit.html +0 -16
- package/docs/api-reference/functions/tools.pickEmbedTextForHyde.html +0 -8
- package/docs/api-reference/functions/tools.readCanvas.html +0 -19
- package/docs/api-reference/functions/tools.readNote.html +0 -20
- package/docs/api-reference/functions/tools.readPdf.html +0 -18
- package/docs/api-reference/functions/tools.renameNote.html +0 -30
- package/docs/api-reference/functions/tools.replaceInNotes.html +0 -20
- package/docs/api-reference/functions/tools.resolveTarget.html +0 -24
- package/docs/api-reference/functions/tools.resolveWikilink.html +0 -20
- package/docs/api-reference/functions/tools.searchHybrid.html +0 -62
- package/docs/api-reference/functions/tools.searchText.html +0 -19
- package/docs/api-reference/functions/tools.semanticSearch.html +0 -19
- package/docs/api-reference/functions/tools.validateNoteProposal.html +0 -19
- package/docs/api-reference/hierarchy.html +0 -1
- package/docs/api-reference/index.html +0 -1
- package/docs/api-reference/interfaces/index.ServeOptions.html +0 -74
- package/docs/api-reference/interfaces/index.ServerDeps.html +0 -27
- package/docs/api-reference/interfaces/tool-manifest.ToolManifestEntry.html +0 -33
- package/docs/api-reference/interfaces/tools.ArchiveNoteArgs.html +0 -12
- package/docs/api-reference/interfaces/tools.BacklinkHit.html +0 -15
- package/docs/api-reference/interfaces/tools.CanvasEdge.html +0 -19
- package/docs/api-reference/interfaces/tools.CanvasSummary.html +0 -16
- package/docs/api-reference/interfaces/tools.ChatThreadAppendArgs.html +0 -10
- package/docs/api-reference/interfaces/tools.ChatThreadMessage.html +0 -14
- package/docs/api-reference/interfaces/tools.ChatThreadReadResult.html +0 -10
- package/docs/api-reference/interfaces/tools.ContextPackArgs.html +0 -12
- package/docs/api-reference/interfaces/tools.ContextPackResult.html +0 -20
- package/docs/api-reference/interfaces/tools.EmbedHit.html +0 -21
- package/docs/api-reference/interfaces/tools.EmbedSearchResponse.html +0 -14
- package/docs/api-reference/interfaces/tools.FindPathResult.html +0 -17
- package/docs/api-reference/interfaces/tools.FrontmatterSearchArgs.html +0 -20
- package/docs/api-reference/interfaces/tools.FrontmatterSetArgs.html +0 -13
- package/docs/api-reference/interfaces/tools.HnswSearchContext.html +0 -21
- package/docs/api-reference/interfaces/tools.LintWikiArgs.html +0 -14
- package/docs/api-reference/interfaces/tools.LintWikiFinding.html +0 -14
- package/docs/api-reference/interfaces/tools.LintWikiResult.html +0 -9
- package/docs/api-reference/interfaces/tools.NoteNeighbors.html +0 -17
- package/docs/api-reference/interfaces/tools.NoteReadFull.html +0 -20
- package/docs/api-reference/interfaces/tools.NoteReadMap.html +0 -25
- package/docs/api-reference/interfaces/tools.NoteSummary.html +0 -14
- package/docs/api-reference/interfaces/tools.OcrPdfArgs.html +0 -16
- package/docs/api-reference/interfaces/tools.OcrPdfPage.html +0 -15
- package/docs/api-reference/interfaces/tools.OcrPdfResult.html +0 -18
- package/docs/api-reference/interfaces/tools.OpenInUiResult.html +0 -11
- package/docs/api-reference/interfaces/tools.OpenQuestion.html +0 -20
- package/docs/api-reference/interfaces/tools.OutboundLink.html +0 -20
- package/docs/api-reference/interfaces/tools.PaperAuditFinding.html +0 -17
- package/docs/api-reference/interfaces/tools.PathStep.html +0 -9
- package/docs/api-reference/interfaces/tools.PdfSummary.html +0 -9
- package/docs/api-reference/interfaces/tools.ReadCanvasResult.html +0 -15
- package/docs/api-reference/interfaces/tools.ReadPdfArgs.html +0 -8
- package/docs/api-reference/interfaces/tools.ReadPdfPage.html +0 -13
- package/docs/api-reference/interfaces/tools.ReadPdfResult.html +0 -18
- package/docs/api-reference/interfaces/tools.RenameNoteResult.html +0 -14
- package/docs/api-reference/interfaces/tools.RenameProposal.html +0 -13
- package/docs/api-reference/interfaces/tools.ReplaceInNotesArgs.html +0 -15
- package/docs/api-reference/interfaces/tools.ReplaceInNotesFileResult.html +0 -6
- package/docs/api-reference/interfaces/tools.ReplaceInNotesResult.html +0 -21
- package/docs/api-reference/interfaces/tools.SearchHit.html +0 -16
- package/docs/api-reference/interfaces/tools.SearchHybridHit.html +0 -30
- package/docs/api-reference/interfaces/tools.SearchHybridResponse.html +0 -23
- package/docs/api-reference/interfaces/tools.SearchResponse.html +0 -13
- package/docs/api-reference/interfaces/tools.SemanticHit.html +0 -15
- package/docs/api-reference/interfaces/tools.SimilarNote.html +0 -15
- package/docs/api-reference/interfaces/tools.TagSummary.html +0 -13
- package/docs/api-reference/interfaces/tools.UnresolvedWikilink.html +0 -22
- package/docs/api-reference/interfaces/tools.ValidateProposalArgs.html +0 -10
- package/docs/api-reference/interfaces/tools.ValidateProposalResult.html +0 -14
- package/docs/api-reference/interfaces/tools.VaultStats.html +0 -26
- package/docs/api-reference/modules/index.html +0 -1
- package/docs/api-reference/modules/tool-manifest.html +0 -1
- package/docs/api-reference/modules/tools.html +0 -1
- package/docs/api-reference/types/tools.CanvasNode.html +0 -7
- package/docs/api-reference/types/tools.SearchMode.html +0 -7
- package/docs/api-reference/variables/index.VERSION.html +0 -9
- package/docs/api-reference/variables/tool-manifest.TOOL_MANIFEST.html +0 -1
package/dist/tools.d.ts
DELETED
|
@@ -1,980 +0,0 @@
|
|
|
1
|
-
import type { Embed, Wikilink } from "./parser.js";
|
|
2
|
-
import type { Vault } from "./vault.js";
|
|
3
|
-
export interface NoteSummary {
|
|
4
|
-
title: string;
|
|
5
|
-
path: string;
|
|
6
|
-
frontmatter: Record<string, unknown>;
|
|
7
|
-
tags: string[];
|
|
8
|
-
mtime: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function listNotes(vault: Vault, args: {
|
|
11
|
-
tag?: string;
|
|
12
|
-
folder?: string;
|
|
13
|
-
since_date?: string;
|
|
14
|
-
limit?: number;
|
|
15
|
-
}): Promise<NoteSummary[]>;
|
|
16
|
-
export interface NoteReadFull {
|
|
17
|
-
path: string;
|
|
18
|
-
title: string;
|
|
19
|
-
content: string;
|
|
20
|
-
frontmatter: Record<string, unknown>;
|
|
21
|
-
wikilinks: Wikilink[];
|
|
22
|
-
embeds: Embed[];
|
|
23
|
-
tags: string[];
|
|
24
|
-
mtime: string;
|
|
25
|
-
}
|
|
26
|
-
export interface NoteReadMap {
|
|
27
|
-
path: string;
|
|
28
|
-
title: string;
|
|
29
|
-
format: "map";
|
|
30
|
-
frontmatter_keys: string[];
|
|
31
|
-
headings: Array<{
|
|
32
|
-
level: number;
|
|
33
|
-
text: string;
|
|
34
|
-
line: number;
|
|
35
|
-
}>;
|
|
36
|
-
wikilinks_count: number;
|
|
37
|
-
embeds_count: number;
|
|
38
|
-
tags: string[];
|
|
39
|
-
mtime: string;
|
|
40
|
-
byte_size: number;
|
|
41
|
-
}
|
|
42
|
-
export declare function readNote(vault: Vault, args: {
|
|
43
|
-
path?: string;
|
|
44
|
-
title?: string;
|
|
45
|
-
format?: "full" | "map";
|
|
46
|
-
}): Promise<NoteReadFull | NoteReadMap>;
|
|
47
|
-
export declare function resolveWikilink(vault: Vault, args: {
|
|
48
|
-
wikilink: string;
|
|
49
|
-
from_note?: string;
|
|
50
|
-
include_content?: boolean;
|
|
51
|
-
}): Promise<{
|
|
52
|
-
found: boolean;
|
|
53
|
-
path: string | null;
|
|
54
|
-
title: string | null;
|
|
55
|
-
content: string | null;
|
|
56
|
-
section: string | null;
|
|
57
|
-
block: string | null;
|
|
58
|
-
alias: string | null;
|
|
59
|
-
}>;
|
|
60
|
-
export type SearchMode = "all" | "any" | "phrase";
|
|
61
|
-
export interface SearchHit {
|
|
62
|
-
path: string;
|
|
63
|
-
snippet: string;
|
|
64
|
-
score: number;
|
|
65
|
-
line: number;
|
|
66
|
-
matched_terms: string[];
|
|
67
|
-
}
|
|
68
|
-
export interface SearchResponse {
|
|
69
|
-
query: string;
|
|
70
|
-
mode: SearchMode;
|
|
71
|
-
scanned_notes: number;
|
|
72
|
-
matches: SearchHit[];
|
|
73
|
-
}
|
|
74
|
-
export declare function searchText(vault: Vault, args: {
|
|
75
|
-
query: string;
|
|
76
|
-
folder?: string;
|
|
77
|
-
limit?: number;
|
|
78
|
-
mode?: SearchMode;
|
|
79
|
-
}): Promise<SearchResponse>;
|
|
80
|
-
export declare function getRecentEdits(vault: Vault, args: {
|
|
81
|
-
since_minutes?: number;
|
|
82
|
-
limit?: number;
|
|
83
|
-
folder?: string;
|
|
84
|
-
}): Promise<NoteSummary[]>;
|
|
85
|
-
export interface BacklinkHit {
|
|
86
|
-
path: string;
|
|
87
|
-
title: string;
|
|
88
|
-
count: number;
|
|
89
|
-
snippets: string[];
|
|
90
|
-
link_kind: "wikilink" | "embed" | "mixed";
|
|
91
|
-
}
|
|
92
|
-
export declare function getBacklinks(vault: Vault, args: {
|
|
93
|
-
path?: string;
|
|
94
|
-
title?: string;
|
|
95
|
-
limit?: number;
|
|
96
|
-
include_embeds?: boolean;
|
|
97
|
-
}): Promise<BacklinkHit[]>;
|
|
98
|
-
export declare function dataviewQuery(vault: Vault, args: {
|
|
99
|
-
query: string;
|
|
100
|
-
}): Promise<{
|
|
101
|
-
query: string;
|
|
102
|
-
rows: Array<Record<string, unknown>>;
|
|
103
|
-
}>;
|
|
104
|
-
export interface UnresolvedWikilink {
|
|
105
|
-
from_path: string;
|
|
106
|
-
target: string;
|
|
107
|
-
raw: string;
|
|
108
|
-
kind: "wikilink" | "embed";
|
|
109
|
-
alias: string | null;
|
|
110
|
-
section: string | null;
|
|
111
|
-
block: string | null;
|
|
112
|
-
line: number;
|
|
113
|
-
snippet: string;
|
|
114
|
-
}
|
|
115
|
-
export declare function getUnresolvedWikilinks(vault: Vault, args: {
|
|
116
|
-
folder?: string;
|
|
117
|
-
include_embeds?: boolean;
|
|
118
|
-
limit?: number;
|
|
119
|
-
}): Promise<UnresolvedWikilink[]>;
|
|
120
|
-
export interface OutboundLink {
|
|
121
|
-
raw: string;
|
|
122
|
-
target: string;
|
|
123
|
-
kind: "wikilink" | "embed";
|
|
124
|
-
alias: string | null;
|
|
125
|
-
section: string | null;
|
|
126
|
-
block: string | null;
|
|
127
|
-
resolved_path: string | null;
|
|
128
|
-
resolved_title: string | null;
|
|
129
|
-
}
|
|
130
|
-
export declare function getOutboundLinks(vault: Vault, args: {
|
|
131
|
-
path?: string;
|
|
132
|
-
title?: string;
|
|
133
|
-
include_embeds?: boolean;
|
|
134
|
-
include_unresolved?: boolean;
|
|
135
|
-
}): Promise<{
|
|
136
|
-
from_path: string;
|
|
137
|
-
from_title: string;
|
|
138
|
-
links: OutboundLink[];
|
|
139
|
-
}>;
|
|
140
|
-
export interface TagSummary {
|
|
141
|
-
tag: string;
|
|
142
|
-
count: number;
|
|
143
|
-
frontmatter_count: number;
|
|
144
|
-
inline_count: number;
|
|
145
|
-
}
|
|
146
|
-
export declare function listTags(vault: Vault, args: {
|
|
147
|
-
folder?: string;
|
|
148
|
-
min_count?: number;
|
|
149
|
-
limit?: number;
|
|
150
|
-
}): Promise<TagSummary[]>;
|
|
151
|
-
export declare function createNote(vault: Vault, args: {
|
|
152
|
-
path: string;
|
|
153
|
-
content: string;
|
|
154
|
-
frontmatter?: Record<string, unknown>;
|
|
155
|
-
overwrite?: boolean;
|
|
156
|
-
}): Promise<{
|
|
157
|
-
path: string;
|
|
158
|
-
mtime: string;
|
|
159
|
-
bytes: number;
|
|
160
|
-
}>;
|
|
161
|
-
export declare function appendToNote(vault: Vault, args: {
|
|
162
|
-
path?: string;
|
|
163
|
-
title?: string;
|
|
164
|
-
content: string;
|
|
165
|
-
separator?: string;
|
|
166
|
-
}): Promise<{
|
|
167
|
-
path: string;
|
|
168
|
-
mtime: string;
|
|
169
|
-
appended_bytes: number;
|
|
170
|
-
}>;
|
|
171
|
-
export interface RenameProposal {
|
|
172
|
-
path: string;
|
|
173
|
-
rewrites: number;
|
|
174
|
-
before: string;
|
|
175
|
-
after: string;
|
|
176
|
-
}
|
|
177
|
-
export interface RenameNoteResult {
|
|
178
|
-
from: string;
|
|
179
|
-
to: string;
|
|
180
|
-
dry_run: boolean;
|
|
181
|
-
files_updated: RenameProposal[];
|
|
182
|
-
total_links_rewritten: number;
|
|
183
|
-
}
|
|
184
|
-
export declare function renameNote(vault: Vault, args: {
|
|
185
|
-
from: string;
|
|
186
|
-
to: string;
|
|
187
|
-
dry_run?: boolean;
|
|
188
|
-
overwrite?: boolean;
|
|
189
|
-
}): Promise<RenameNoteResult>;
|
|
190
|
-
export interface ArchiveNoteArgs {
|
|
191
|
-
/** Vault-relative path of the note to archive (with or without `.md`). */
|
|
192
|
-
path: string;
|
|
193
|
-
/** Archive folder. Defaults to `Archive/`. Trailing slash optional. */
|
|
194
|
-
archive_folder?: string;
|
|
195
|
-
/** Preview the rewrite plan without writing. Default false. */
|
|
196
|
-
dry_run?: boolean;
|
|
197
|
-
/** Allow overwriting an existing file at the archive destination. Default false. */
|
|
198
|
-
overwrite?: boolean;
|
|
199
|
-
}
|
|
200
|
-
export interface ChatThreadAppendArgs {
|
|
201
|
-
/** Vault-relative path to the note hosting the thread. Created if absent. */
|
|
202
|
-
note_path: string;
|
|
203
|
-
/** Role of the message being appended. */
|
|
204
|
-
role: "user" | "assistant" | "system";
|
|
205
|
-
/** Message body (markdown allowed). */
|
|
206
|
-
content: string;
|
|
207
|
-
/** Optional thread title — used when the note is created from scratch. */
|
|
208
|
-
thread_title?: string;
|
|
209
|
-
}
|
|
210
|
-
export interface ChatThreadMessage {
|
|
211
|
-
role: "user" | "assistant" | "system";
|
|
212
|
-
timestamp: string;
|
|
213
|
-
content: string;
|
|
214
|
-
/** 1-based start line in the source note (for jumping to that point). */
|
|
215
|
-
line_start: number;
|
|
216
|
-
line_end: number;
|
|
217
|
-
}
|
|
218
|
-
export interface ChatThreadReadResult {
|
|
219
|
-
note_path: string;
|
|
220
|
-
thread_title: string | null;
|
|
221
|
-
messages: ChatThreadMessage[];
|
|
222
|
-
message_count: number;
|
|
223
|
-
}
|
|
224
|
-
/** Append a message to a note's chat thread. Creates the note (and the
|
|
225
|
-
* `## Chat: <title>` heading) if absent. Idempotent in the sense that
|
|
226
|
-
* appending always creates a fresh `### <role> · <timestamp>` block — no
|
|
227
|
-
* silent overwrites. */
|
|
228
|
-
export declare function chatThreadAppend(vault: Vault, args: ChatThreadAppendArgs): Promise<{
|
|
229
|
-
note_path: string;
|
|
230
|
-
line_start: number;
|
|
231
|
-
line_end: number;
|
|
232
|
-
}>;
|
|
233
|
-
/** Parse a note's chat thread into structured messages. Non-chat content
|
|
234
|
-
* (anything outside the `## Chat: <title>` block) is ignored. */
|
|
235
|
-
export declare function chatThreadRead(vault: Vault, args: {
|
|
236
|
-
note_path: string;
|
|
237
|
-
}): Promise<ChatThreadReadResult>;
|
|
238
|
-
export declare function frontmatterGet(vault: Vault, args: {
|
|
239
|
-
path?: string;
|
|
240
|
-
title?: string;
|
|
241
|
-
key?: string;
|
|
242
|
-
}): Promise<{
|
|
243
|
-
path: string;
|
|
244
|
-
frontmatter: Record<string, unknown>;
|
|
245
|
-
value?: unknown;
|
|
246
|
-
}>;
|
|
247
|
-
export interface FrontmatterSetArgs {
|
|
248
|
-
path?: string;
|
|
249
|
-
title?: string;
|
|
250
|
-
/** Keys to set. Setting a key to `null` deletes it. */
|
|
251
|
-
set: Record<string, unknown>;
|
|
252
|
-
/** Optional: dry_run shows the diff without writing. */
|
|
253
|
-
dry_run?: boolean;
|
|
254
|
-
}
|
|
255
|
-
export declare function frontmatterSet(vault: Vault, args: FrontmatterSetArgs): Promise<{
|
|
256
|
-
path: string;
|
|
257
|
-
changed_keys: string[];
|
|
258
|
-
before: Record<string, unknown>;
|
|
259
|
-
after: Record<string, unknown>;
|
|
260
|
-
dry_run: boolean;
|
|
261
|
-
}>;
|
|
262
|
-
/** Find every note where frontmatter.<key> matches a predicate. Useful as
|
|
263
|
-
* a precursor to bulk frontmatter_set: "find all notes with status:draft
|
|
264
|
-
* and set their status to published".
|
|
265
|
-
*
|
|
266
|
-
* Predicate semantics:
|
|
267
|
-
* - `equals: <value>` — strict equality (JSON.stringify comparison)
|
|
268
|
-
* - `exists: true` — key must exist (any value)
|
|
269
|
-
* - `contains: <value>` — for array values, value must be a member
|
|
270
|
-
* Exactly one predicate must be set. */
|
|
271
|
-
export interface FrontmatterSearchArgs {
|
|
272
|
-
key: string;
|
|
273
|
-
equals?: unknown;
|
|
274
|
-
exists?: boolean;
|
|
275
|
-
contains?: unknown;
|
|
276
|
-
folder?: string;
|
|
277
|
-
limit?: number;
|
|
278
|
-
}
|
|
279
|
-
export declare function frontmatterSearch(vault: Vault, args: FrontmatterSearchArgs): Promise<{
|
|
280
|
-
key: string;
|
|
281
|
-
total_matches: number;
|
|
282
|
-
matches: Array<{
|
|
283
|
-
path: string;
|
|
284
|
-
value: unknown;
|
|
285
|
-
mtime: string;
|
|
286
|
-
}>;
|
|
287
|
-
}>;
|
|
288
|
-
export declare function archiveNote(vault: Vault, args: ArchiveNoteArgs): Promise<RenameNoteResult>;
|
|
289
|
-
export interface ReplaceInNotesArgs {
|
|
290
|
-
/** Literal substring to find. Empty string is rejected. */
|
|
291
|
-
search: string;
|
|
292
|
-
/** Replacement text. May be empty (= delete every occurrence). */
|
|
293
|
-
replace: string;
|
|
294
|
-
/** Restrict to a subfolder (vault-relative). Default: whole vault. */
|
|
295
|
-
folder?: string;
|
|
296
|
-
/** Preview the rewrite plan without touching disk. Default false. */
|
|
297
|
-
dry_run?: boolean;
|
|
298
|
-
/** Case-sensitive match (default true). False = case-insensitive substring. */
|
|
299
|
-
case_sensitive?: boolean;
|
|
300
|
-
}
|
|
301
|
-
export interface ReplaceInNotesFileResult {
|
|
302
|
-
path: string;
|
|
303
|
-
occurrences: number;
|
|
304
|
-
}
|
|
305
|
-
export interface ReplaceInNotesResult {
|
|
306
|
-
search: string;
|
|
307
|
-
replace: string;
|
|
308
|
-
case_sensitive: boolean;
|
|
309
|
-
dry_run: boolean;
|
|
310
|
-
scope: string;
|
|
311
|
-
files_scanned: number;
|
|
312
|
-
files_updated: ReplaceInNotesFileResult[];
|
|
313
|
-
total_replacements: number;
|
|
314
|
-
/** v2.0.0-beta.2 P1: when true, the apply pass aborted partway through.
|
|
315
|
-
* `files_updated` only contains files that DID write successfully. Files
|
|
316
|
-
* in `errors` (if present) failed mid-write — caller should retry just
|
|
317
|
-
* those and verify state. Always false on dry_run. */
|
|
318
|
-
partial: boolean;
|
|
319
|
-
/** v2.0.0-beta.2 P1: per-file write errors collected during apply. Only
|
|
320
|
-
* populated when the apply phase encountered errors (so happy-path
|
|
321
|
-
* responses stay narrow). */
|
|
322
|
-
errors?: Array<{
|
|
323
|
-
path: string;
|
|
324
|
-
message: string;
|
|
325
|
-
}>;
|
|
326
|
-
}
|
|
327
|
-
export declare function replaceInNotes(vault: Vault, args: ReplaceInNotesArgs): Promise<ReplaceInNotesResult>;
|
|
328
|
-
export interface ValidateProposalArgs {
|
|
329
|
-
/** Vault-relative path the LLM intends to write to (e.g. "Inbox/idea.md"). */
|
|
330
|
-
path: string;
|
|
331
|
-
/** Full proposed markdown content including any frontmatter block. */
|
|
332
|
-
content: string;
|
|
333
|
-
/** "create" (default) → fail if path exists. "overwrite" / "append" → ok if exists. */
|
|
334
|
-
mode?: "create" | "overwrite" | "append";
|
|
335
|
-
}
|
|
336
|
-
export interface ValidateProposalResult {
|
|
337
|
-
ok: boolean;
|
|
338
|
-
proposed_path: string;
|
|
339
|
-
mode: "create" | "overwrite" | "append";
|
|
340
|
-
errors: Array<{
|
|
341
|
-
kind: string;
|
|
342
|
-
message: string;
|
|
343
|
-
}>;
|
|
344
|
-
warnings: Array<{
|
|
345
|
-
kind: string;
|
|
346
|
-
message: string;
|
|
347
|
-
suggestion?: string;
|
|
348
|
-
}>;
|
|
349
|
-
yaml: {
|
|
350
|
-
parsed: boolean;
|
|
351
|
-
error: string | null;
|
|
352
|
-
keys: string[];
|
|
353
|
-
};
|
|
354
|
-
wikilinks: Array<{
|
|
355
|
-
raw: string;
|
|
356
|
-
target: string;
|
|
357
|
-
status: "resolved" | "broken" | "ambiguous";
|
|
358
|
-
resolved_path: string | null;
|
|
359
|
-
suggestions: string[];
|
|
360
|
-
}>;
|
|
361
|
-
tags: Array<{
|
|
362
|
-
name: string;
|
|
363
|
-
status: "existing" | "new";
|
|
364
|
-
}>;
|
|
365
|
-
collision: {
|
|
366
|
-
kind: "none" | "path-exists" | "title-exists-elsewhere";
|
|
367
|
-
existing_path?: string;
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
export declare function validateNoteProposal(vault: Vault, args: ValidateProposalArgs): Promise<ValidateProposalResult>;
|
|
371
|
-
export interface SimilarNote {
|
|
372
|
-
path: string;
|
|
373
|
-
title: string;
|
|
374
|
-
score: number;
|
|
375
|
-
signals: {
|
|
376
|
-
tag_jaccard: number;
|
|
377
|
-
title_3gram: number;
|
|
378
|
-
shared_outbound: number;
|
|
379
|
-
co_backlink: number;
|
|
380
|
-
};
|
|
381
|
-
shared_tags: string[];
|
|
382
|
-
mtime: string;
|
|
383
|
-
}
|
|
384
|
-
export declare function findSimilar(vault: Vault, args: {
|
|
385
|
-
path?: string;
|
|
386
|
-
title?: string;
|
|
387
|
-
limit?: number;
|
|
388
|
-
min_score?: number;
|
|
389
|
-
}): Promise<SimilarNote[]>;
|
|
390
|
-
export interface NoteNeighbors {
|
|
391
|
-
center: {
|
|
392
|
-
path: string;
|
|
393
|
-
title: string;
|
|
394
|
-
tags: string[];
|
|
395
|
-
mtime: string;
|
|
396
|
-
};
|
|
397
|
-
outbound: Array<{
|
|
398
|
-
path: string;
|
|
399
|
-
title: string;
|
|
400
|
-
tags: string[];
|
|
401
|
-
}>;
|
|
402
|
-
inbound: Array<{
|
|
403
|
-
path: string;
|
|
404
|
-
title: string;
|
|
405
|
-
tags: string[];
|
|
406
|
-
count: number;
|
|
407
|
-
}>;
|
|
408
|
-
tag_siblings: Array<{
|
|
409
|
-
path: string;
|
|
410
|
-
title: string;
|
|
411
|
-
shared_tags: string[];
|
|
412
|
-
}>;
|
|
413
|
-
}
|
|
414
|
-
export declare function getNoteNeighbors(vault: Vault, args: {
|
|
415
|
-
path?: string;
|
|
416
|
-
title?: string;
|
|
417
|
-
max_per_bucket?: number;
|
|
418
|
-
}): Promise<NoteNeighbors>;
|
|
419
|
-
export interface VaultStats {
|
|
420
|
-
total_notes: number;
|
|
421
|
-
total_size_bytes: number;
|
|
422
|
-
avg_note_words: number;
|
|
423
|
-
recently_modified_7d: number;
|
|
424
|
-
orphans: number;
|
|
425
|
-
broken_wikilinks: number;
|
|
426
|
-
total_tags: number;
|
|
427
|
-
top_tags: Array<{
|
|
428
|
-
tag: string;
|
|
429
|
-
count: number;
|
|
430
|
-
}>;
|
|
431
|
-
notes_with_frontmatter: number;
|
|
432
|
-
generated_at: string;
|
|
433
|
-
}
|
|
434
|
-
export declare function getVaultStats(vault: Vault, args: {
|
|
435
|
-
top_tags?: number;
|
|
436
|
-
}): Promise<VaultStats>;
|
|
437
|
-
export interface LintWikiArgs {
|
|
438
|
-
/** Folder to restrict the lint to (default: whole vault). */
|
|
439
|
-
folder?: string;
|
|
440
|
-
/** Word count below which a note is considered a "stub". Default 100. */
|
|
441
|
-
stub_word_threshold?: number;
|
|
442
|
-
/** A note is "stale" if its frontmatter `last_reviewed` (or mtime if missing)
|
|
443
|
-
* is older than this many days. Default 365. */
|
|
444
|
-
stale_days?: number;
|
|
445
|
-
/** A capitalised n-gram mentioned by ≥ N distinct notes but not having its
|
|
446
|
-
* own page is flagged as a concept candidate. Default 3. */
|
|
447
|
-
concept_min_mentions?: number;
|
|
448
|
-
/** Cap on each finding-bucket so the response stays bounded. Default 50. */
|
|
449
|
-
max_per_bucket?: number;
|
|
450
|
-
}
|
|
451
|
-
export interface LintWikiFinding {
|
|
452
|
-
kind: "orphan" | "broken-link" | "stub" | "stale" | "concept-without-page";
|
|
453
|
-
path?: string;
|
|
454
|
-
message: string;
|
|
455
|
-
suggestion?: string;
|
|
456
|
-
details?: Record<string, unknown>;
|
|
457
|
-
}
|
|
458
|
-
export interface LintWikiResult {
|
|
459
|
-
scope: string;
|
|
460
|
-
scanned: number;
|
|
461
|
-
generated_at: string;
|
|
462
|
-
summary: {
|
|
463
|
-
orphans: number;
|
|
464
|
-
broken_links: number;
|
|
465
|
-
stubs: number;
|
|
466
|
-
stale: number;
|
|
467
|
-
concept_candidates: number;
|
|
468
|
-
};
|
|
469
|
-
findings: {
|
|
470
|
-
orphans: LintWikiFinding[];
|
|
471
|
-
broken_links: LintWikiFinding[];
|
|
472
|
-
stubs: LintWikiFinding[];
|
|
473
|
-
stale: LintWikiFinding[];
|
|
474
|
-
concept_candidates: LintWikiFinding[];
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
export declare function lintWiki(vault: Vault, args: LintWikiArgs): Promise<LintWikiResult>;
|
|
478
|
-
export interface OpenQuestion {
|
|
479
|
-
question: string;
|
|
480
|
-
source_path: string;
|
|
481
|
-
source_title: string;
|
|
482
|
-
context_heading: string | null;
|
|
483
|
-
line: number;
|
|
484
|
-
age_days: number;
|
|
485
|
-
mtime: string;
|
|
486
|
-
}
|
|
487
|
-
export declare function getOpenQuestions(vault: Vault, args: {
|
|
488
|
-
folder?: string;
|
|
489
|
-
limit?: number;
|
|
490
|
-
pattern?: string;
|
|
491
|
-
}): Promise<OpenQuestion[]>;
|
|
492
|
-
export interface PaperAuditFinding {
|
|
493
|
-
path: string;
|
|
494
|
-
title: string;
|
|
495
|
-
has_frontmatter_citation: boolean;
|
|
496
|
-
found_in_body: {
|
|
497
|
-
arxiv: string[];
|
|
498
|
-
doi: string[];
|
|
499
|
-
url: string[];
|
|
500
|
-
};
|
|
501
|
-
proposed_frontmatter_patch: Record<string, string> | null;
|
|
502
|
-
message: string;
|
|
503
|
-
}
|
|
504
|
-
export declare function paperAudit(vault: Vault, args: {
|
|
505
|
-
tag?: string;
|
|
506
|
-
folder?: string;
|
|
507
|
-
limit?: number;
|
|
508
|
-
}): Promise<{
|
|
509
|
-
scanned: number;
|
|
510
|
-
flagged: PaperAuditFinding[];
|
|
511
|
-
}>;
|
|
512
|
-
export interface PathStep {
|
|
513
|
-
path: string;
|
|
514
|
-
title: string;
|
|
515
|
-
/** Wikilink raw text (`[[…]]` content) used to traverse FROM the previous
|
|
516
|
-
* step to this one. Empty on the source step. */
|
|
517
|
-
via: string;
|
|
518
|
-
}
|
|
519
|
-
export interface FindPathResult {
|
|
520
|
-
from: string;
|
|
521
|
-
to: string;
|
|
522
|
-
found: boolean;
|
|
523
|
-
path: PathStep[];
|
|
524
|
-
hops: number;
|
|
525
|
-
/** Up to 10 same-length alternatives, only when include_alternatives=true. */
|
|
526
|
-
alternatives?: PathStep[][];
|
|
527
|
-
}
|
|
528
|
-
export declare function findPath(vault: Vault, args: {
|
|
529
|
-
from?: string;
|
|
530
|
-
from_title?: string;
|
|
531
|
-
to?: string;
|
|
532
|
-
to_title?: string;
|
|
533
|
-
max_depth?: number;
|
|
534
|
-
include_alternatives?: boolean;
|
|
535
|
-
follow_embeds?: boolean;
|
|
536
|
-
}): Promise<FindPathResult>;
|
|
537
|
-
export interface OpenInUiResult {
|
|
538
|
-
uri: string;
|
|
539
|
-
vault_name: string;
|
|
540
|
-
path: string;
|
|
541
|
-
title: string;
|
|
542
|
-
}
|
|
543
|
-
export declare function openInUi(vault: Vault, args: {
|
|
544
|
-
path?: string;
|
|
545
|
-
title?: string;
|
|
546
|
-
new_pane?: boolean;
|
|
547
|
-
}): Promise<OpenInUiResult>;
|
|
548
|
-
export interface CanvasSummary {
|
|
549
|
-
path: string;
|
|
550
|
-
name: string;
|
|
551
|
-
size_bytes: number;
|
|
552
|
-
mtime: string;
|
|
553
|
-
node_count: number;
|
|
554
|
-
edge_count: number;
|
|
555
|
-
}
|
|
556
|
-
export declare function listCanvases(vault: Vault, args: {
|
|
557
|
-
folder?: string;
|
|
558
|
-
limit?: number;
|
|
559
|
-
}): Promise<CanvasSummary[]>;
|
|
560
|
-
export type CanvasNode = {
|
|
561
|
-
kind: "text";
|
|
562
|
-
id: string;
|
|
563
|
-
x: number;
|
|
564
|
-
y: number;
|
|
565
|
-
width: number;
|
|
566
|
-
height: number;
|
|
567
|
-
text: string;
|
|
568
|
-
color?: string;
|
|
569
|
-
} | {
|
|
570
|
-
kind: "file";
|
|
571
|
-
id: string;
|
|
572
|
-
x: number;
|
|
573
|
-
y: number;
|
|
574
|
-
width: number;
|
|
575
|
-
height: number;
|
|
576
|
-
file: string;
|
|
577
|
-
file_resolved: string | null;
|
|
578
|
-
subpath?: string;
|
|
579
|
-
color?: string;
|
|
580
|
-
} | {
|
|
581
|
-
kind: "link";
|
|
582
|
-
id: string;
|
|
583
|
-
x: number;
|
|
584
|
-
y: number;
|
|
585
|
-
width: number;
|
|
586
|
-
height: number;
|
|
587
|
-
url: string;
|
|
588
|
-
color?: string;
|
|
589
|
-
} | {
|
|
590
|
-
kind: "group";
|
|
591
|
-
id: string;
|
|
592
|
-
x: number;
|
|
593
|
-
y: number;
|
|
594
|
-
width: number;
|
|
595
|
-
height: number;
|
|
596
|
-
label?: string;
|
|
597
|
-
color?: string;
|
|
598
|
-
} | {
|
|
599
|
-
kind: "unknown";
|
|
600
|
-
id: string;
|
|
601
|
-
raw_type: string;
|
|
602
|
-
raw: Record<string, unknown>;
|
|
603
|
-
};
|
|
604
|
-
export interface CanvasEdge {
|
|
605
|
-
id: string;
|
|
606
|
-
from_node: string;
|
|
607
|
-
from_side?: string;
|
|
608
|
-
to_node: string;
|
|
609
|
-
to_side?: string;
|
|
610
|
-
label?: string;
|
|
611
|
-
color?: string;
|
|
612
|
-
}
|
|
613
|
-
export interface ReadCanvasResult {
|
|
614
|
-
path: string;
|
|
615
|
-
name: string;
|
|
616
|
-
size_bytes: number;
|
|
617
|
-
mtime: string;
|
|
618
|
-
nodes: CanvasNode[];
|
|
619
|
-
edges: CanvasEdge[];
|
|
620
|
-
/** Convenience summary: # of each node kind. */
|
|
621
|
-
summary: {
|
|
622
|
-
text: number;
|
|
623
|
-
file: number;
|
|
624
|
-
link: number;
|
|
625
|
-
group: number;
|
|
626
|
-
unknown: number;
|
|
627
|
-
};
|
|
628
|
-
/** Embedded files that didn't resolve to anything in the vault — broken
|
|
629
|
-
* canvas references. Empty when all files resolve cleanly. */
|
|
630
|
-
broken_file_refs: string[];
|
|
631
|
-
}
|
|
632
|
-
export declare function readCanvas(vault: Vault, args: {
|
|
633
|
-
path: string;
|
|
634
|
-
}): Promise<ReadCanvasResult>;
|
|
635
|
-
export interface SemanticHit {
|
|
636
|
-
path: string;
|
|
637
|
-
title: string;
|
|
638
|
-
score: number;
|
|
639
|
-
snippet: string;
|
|
640
|
-
matched_terms: string[];
|
|
641
|
-
mtime: string;
|
|
642
|
-
}
|
|
643
|
-
export declare function semanticSearch(vault: Vault, args: {
|
|
644
|
-
query: string;
|
|
645
|
-
folder?: string;
|
|
646
|
-
limit?: number;
|
|
647
|
-
min_score?: number;
|
|
648
|
-
}): Promise<{
|
|
649
|
-
query: string;
|
|
650
|
-
total_docs: number;
|
|
651
|
-
method: "tfidf-cosine";
|
|
652
|
-
matches: SemanticHit[];
|
|
653
|
-
}>;
|
|
654
|
-
export interface EmbedHit {
|
|
655
|
-
path: string;
|
|
656
|
-
title: string;
|
|
657
|
-
score: number;
|
|
658
|
-
snippet: string;
|
|
659
|
-
chunk_index: number;
|
|
660
|
-
line_start: number;
|
|
661
|
-
line_end: number;
|
|
662
|
-
/** v2.8.0 — content-source kind ("md" | "pdf"). */
|
|
663
|
-
kind: "md" | "pdf";
|
|
664
|
-
}
|
|
665
|
-
export interface EmbedSearchResponse {
|
|
666
|
-
query: string;
|
|
667
|
-
method: "embeddings-cosine";
|
|
668
|
-
model: string;
|
|
669
|
-
total_chunks: number;
|
|
670
|
-
matches: EmbedHit[];
|
|
671
|
-
/**
|
|
672
|
-
* v3.1.0 — present + true when retrieval used the agent-supplied
|
|
673
|
-
* `hypothetical_answer` as the embedding seed (HyDE). Lets clients
|
|
674
|
-
* audit whether they're seeing raw-query or HyDE-augmented results.
|
|
675
|
-
*/
|
|
676
|
-
hyde?: boolean;
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* v2.13.0 — optional HNSW context. When passed, embeddingsSearch routes
|
|
680
|
-
* the k-NN lookup through the in-memory HNSW index (sub-10ms at any
|
|
681
|
-
* scale) instead of the O(n) brute-force cosine in EmbedDb.search().
|
|
682
|
-
* `rowByLabel` is the label → source-row mapping established at HNSW
|
|
683
|
-
* build time (typically labels are `embeddings.id`, set in
|
|
684
|
-
* `EmbedDb.getAllVectors()`).
|
|
685
|
-
*/
|
|
686
|
-
export interface HnswSearchContext {
|
|
687
|
-
index: {
|
|
688
|
-
searchKnn(q: Float32Array, k: number, opts?: {
|
|
689
|
-
ef?: number;
|
|
690
|
-
}): {
|
|
691
|
-
labels: number[];
|
|
692
|
-
distances: number[];
|
|
693
|
-
};
|
|
694
|
-
};
|
|
695
|
-
rowByLabel: ReadonlyMap<number, {
|
|
696
|
-
rel_path: string;
|
|
697
|
-
chunk_index: number;
|
|
698
|
-
line_start: number;
|
|
699
|
-
line_end: number;
|
|
700
|
-
text_preview: string;
|
|
701
|
-
kind: "md" | "pdf";
|
|
702
|
-
}>;
|
|
703
|
-
ef?: number;
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* v3.1.0 — pick the text that should be embedded for an embeddings-search
|
|
707
|
-
* call. HyDE-augmented retrieval prefers the agent-supplied
|
|
708
|
-
* `hypothetical_answer` (Gao et al 2023); falls back to the raw query
|
|
709
|
-
* when that's absent / empty / whitespace-only.
|
|
710
|
-
*
|
|
711
|
-
* Pure helper so we can unit-test the decision in isolation (the real
|
|
712
|
-
* `embeddingsSearch` function loads the @huggingface/transformers
|
|
713
|
-
* embedder, which is out of scope for unit tests).
|
|
714
|
-
*/
|
|
715
|
-
export declare function pickEmbedTextForHyde(args: {
|
|
716
|
-
query: string;
|
|
717
|
-
hypothetical_answer?: string;
|
|
718
|
-
}): {
|
|
719
|
-
text: string;
|
|
720
|
-
usedHyde: boolean;
|
|
721
|
-
};
|
|
722
|
-
export declare function embeddingsSearch(vault: Vault, args: {
|
|
723
|
-
query: string;
|
|
724
|
-
folder?: string;
|
|
725
|
-
limit?: number;
|
|
726
|
-
min_score?: number;
|
|
727
|
-
model?: string;
|
|
728
|
-
/**
|
|
729
|
-
* v3.1.0 — HyDE (Hypothetical Document Embeddings) augmentation.
|
|
730
|
-
* When set, this string is embedded instead of `query`. The agent
|
|
731
|
-
* generates a synthetic answer to its own question, embeds *that*,
|
|
732
|
-
* and retrieves against the answer-shaped vector — typically beats
|
|
733
|
-
* raw-query retrieval on under-specified queries by +2-5 NDCG@10.
|
|
734
|
-
* The `query` string is still echoed in the response for caller
|
|
735
|
-
* audit-trail; it does NOT influence retrieval when `hypothetical_answer`
|
|
736
|
-
* is present.
|
|
737
|
-
*/
|
|
738
|
-
hypothetical_answer?: string;
|
|
739
|
-
}, embedFile: string, hnsw?: HnswSearchContext | null): Promise<EmbedSearchResponse>;
|
|
740
|
-
import type { FtsIndex } from "./fts5.js";
|
|
741
|
-
export interface SearchHybridHit {
|
|
742
|
-
path: string;
|
|
743
|
-
title: string;
|
|
744
|
-
/** Fused RRF score (sum of 1/(k+rank) terms across signals). */
|
|
745
|
-
score: number;
|
|
746
|
-
/** Snippet from whichever signal produced the best chunk hit. */
|
|
747
|
-
snippet: string;
|
|
748
|
-
chunk_index?: number;
|
|
749
|
-
line_start?: number;
|
|
750
|
-
line_end?: number;
|
|
751
|
-
/**
|
|
752
|
-
* v2.8.0 — content-source kind. Lets agents distinguish markdown notes
|
|
753
|
-
* from PDF chunks when both are indexed. Defaults to "md" for backward
|
|
754
|
-
* compatibility (legacy DBs and TF-IDF hits have no kind metadata).
|
|
755
|
-
*/
|
|
756
|
-
kind: "md" | "pdf";
|
|
757
|
-
/** Per-signal observability — which signals contributed at what rank/score. */
|
|
758
|
-
per_signal: {
|
|
759
|
-
bm25?: {
|
|
760
|
-
rank: number;
|
|
761
|
-
score: number;
|
|
762
|
-
};
|
|
763
|
-
tfidf?: {
|
|
764
|
-
rank: number;
|
|
765
|
-
score: number;
|
|
766
|
-
};
|
|
767
|
-
embeddings?: {
|
|
768
|
-
rank: number;
|
|
769
|
-
score: number;
|
|
770
|
-
};
|
|
771
|
-
};
|
|
772
|
-
/**
|
|
773
|
-
* v2.9.0 — cross-encoder reranker score in [0, 1] (sigmoid of the model's
|
|
774
|
-
* relevance logit). Present only when the server was started with
|
|
775
|
-
* `--enable-reranker` AND this hit was within the reranker's top-N
|
|
776
|
-
* candidate set (default 50). Higher = more relevant. Compare across
|
|
777
|
-
* results within the same response, NOT across queries (the absolute
|
|
778
|
-
* value depends on the query).
|
|
779
|
-
*/
|
|
780
|
-
reranker_score?: number;
|
|
781
|
-
}
|
|
782
|
-
export interface SearchHybridResponse {
|
|
783
|
-
query: string;
|
|
784
|
-
method: "rrf";
|
|
785
|
-
k: number;
|
|
786
|
-
signals_used: ("bm25" | "tfidf" | "embeddings")[];
|
|
787
|
-
/** v2.0.0-beta.2: per-signal failure reasons. Pre-fix, ranker exceptions
|
|
788
|
-
* were silently swallowed (only stderr-logged). The MCP response just
|
|
789
|
-
* showed `signals_used: []` with `matches: []` — caller couldn't tell
|
|
790
|
-
* "no hits" from "all rankers crashed". Now any catch'ed exception
|
|
791
|
-
* surfaces here as a string so agents can reason about reliability.
|
|
792
|
-
* v2.9.0 added `reranker` for cross-encoder failure surfacing. */
|
|
793
|
-
signal_errors?: {
|
|
794
|
-
bm25?: string;
|
|
795
|
-
tfidf?: string;
|
|
796
|
-
embeddings?: string;
|
|
797
|
-
reranker?: string;
|
|
798
|
-
};
|
|
799
|
-
total_candidates: number;
|
|
800
|
-
matches: SearchHybridHit[];
|
|
801
|
-
}
|
|
802
|
-
export declare function searchHybrid(vault: Vault, args: {
|
|
803
|
-
query: string;
|
|
804
|
-
folder?: string;
|
|
805
|
-
limit?: number;
|
|
806
|
-
min_signals?: number;
|
|
807
|
-
embedding_model?: string;
|
|
808
|
-
/** v2.2.0: "note" (default) returns 1 hit per note, picking the best
|
|
809
|
-
* chunk; "block" returns each chunk as a distinct hit so you see the
|
|
810
|
-
* multiple-paragraph case where one note covers a topic in two places. */
|
|
811
|
-
granularity?: "note" | "block";
|
|
812
|
-
/** v2.3.0: post-RRF graph boost — rerank by counting how many other
|
|
813
|
-
* top-K hits link to each one. Default true; set false to disable for
|
|
814
|
-
* diagnostic comparison (e.g. measuring whether boost helped). */
|
|
815
|
-
graph_boost?: boolean;
|
|
816
|
-
}, ctx: {
|
|
817
|
-
/** FTS5 index, if `--persistent-index` is enabled at server start. */
|
|
818
|
-
ftsIndex: FtsIndex | null;
|
|
819
|
-
/** Path to the `.embed.db` (file may or may not exist — checked at call time). */
|
|
820
|
-
embedFile: string;
|
|
821
|
-
/**
|
|
822
|
-
* v2.9.0 — optional cross-encoder reranker config. When set, the top-N
|
|
823
|
-
* hits from RRF (default 50) are re-scored by a BGE-style cross-encoder
|
|
824
|
-
* and re-sorted before truncation. Adds ~30-50ms per query on M1 CPU
|
|
825
|
-
* for a 50-candidate set.
|
|
826
|
-
*
|
|
827
|
-
* `alias` resolves to a `RERANKER_MODELS` entry. `topN` defaults to 50.
|
|
828
|
-
* Lazy-loaded — first call downloads the model from HuggingFace
|
|
829
|
-
* (~25-110 MB depending on alias). Failures are swallowed and surface
|
|
830
|
-
* via `signal_errors.reranker` so the whole search doesn't break on a
|
|
831
|
-
* model load issue.
|
|
832
|
-
*/
|
|
833
|
-
reranker?: {
|
|
834
|
-
alias?: string;
|
|
835
|
-
topN?: number;
|
|
836
|
-
};
|
|
837
|
-
/**
|
|
838
|
-
* v2.9.0 — test-only injection point. When set, this pre-loaded
|
|
839
|
-
* reranker is used instead of lazy-loading via `loadReranker(alias)`.
|
|
840
|
-
* Lets unit tests validate the rerank-and-resort plumbing without
|
|
841
|
-
* pulling in the real ML model. Unused in production callers.
|
|
842
|
-
*/
|
|
843
|
-
rerankerOverride?: {
|
|
844
|
-
score(query: string, passages: readonly string[]): Promise<number[]>;
|
|
845
|
-
};
|
|
846
|
-
/**
|
|
847
|
-
* v2.13.0 — optional HNSW context for the embeddings-search arm.
|
|
848
|
-
* When passed, the embedding-side k-NN goes through the in-memory
|
|
849
|
-
* HNSW index (sub-10ms at any scale) instead of the O(n) brute-force
|
|
850
|
-
* cosine in EmbedDb.search(). Built on serve start; lives in
|
|
851
|
-
* ServerDeps.hnswContext. Null/undefined → brute-force fallback.
|
|
852
|
-
*/
|
|
853
|
-
hnsw?: HnswSearchContext | null;
|
|
854
|
-
}): Promise<SearchHybridResponse>;
|
|
855
|
-
export interface ContextPackArgs {
|
|
856
|
-
/** Topic / question to gather context for. */
|
|
857
|
-
query: string;
|
|
858
|
-
/** Approximate token budget for the bundle. ~4 chars/token assumption. Default 4000. */
|
|
859
|
-
budget_tokens?: number;
|
|
860
|
-
/** Restrict retrieval to this folder. */
|
|
861
|
-
folder?: string;
|
|
862
|
-
/** Include backlinks of top-K notes (1-line each)? Default true. */
|
|
863
|
-
include_backlinks?: boolean;
|
|
864
|
-
/** Include the last N daily notes? Default 0 (off). Set to 3 for "what was I doing recently". */
|
|
865
|
-
recent_dailies?: number;
|
|
866
|
-
}
|
|
867
|
-
export interface ContextPackResult {
|
|
868
|
-
query: string;
|
|
869
|
-
/** The packed markdown bundle ready to paste into an AI chat. */
|
|
870
|
-
bundle: string;
|
|
871
|
-
/** Approximate token count (chars / 4). */
|
|
872
|
-
estimated_tokens: number;
|
|
873
|
-
budget_tokens: number;
|
|
874
|
-
/** Per-section byte counts for observability. */
|
|
875
|
-
sections: {
|
|
876
|
-
notes: number;
|
|
877
|
-
backlinks: number;
|
|
878
|
-
dailies: number;
|
|
879
|
-
};
|
|
880
|
-
/** Top-K hit paths included in the bundle. */
|
|
881
|
-
included_notes: string[];
|
|
882
|
-
}
|
|
883
|
-
export declare function contextPack(vault: Vault, args: ContextPackArgs, ctx: {
|
|
884
|
-
ftsIndex: FtsIndex | null;
|
|
885
|
-
embedFile: string;
|
|
886
|
-
}): Promise<ContextPackResult>;
|
|
887
|
-
export interface PdfSummary {
|
|
888
|
-
/** Vault-relative path. */
|
|
889
|
-
path: string;
|
|
890
|
-
/** Filename minus the `.pdf` extension. */
|
|
891
|
-
name: string;
|
|
892
|
-
/** File size in bytes. */
|
|
893
|
-
size_bytes: number;
|
|
894
|
-
/** Last-modified ISO timestamp. */
|
|
895
|
-
mtime: string;
|
|
896
|
-
}
|
|
897
|
-
export declare function listPdfs(vault: Vault, args: {
|
|
898
|
-
folder?: string;
|
|
899
|
-
limit?: number;
|
|
900
|
-
}): Promise<PdfSummary[]>;
|
|
901
|
-
export interface ReadPdfArgs {
|
|
902
|
-
/** Vault-relative path to the .pdf file. */
|
|
903
|
-
path: string;
|
|
904
|
-
/** Optional 1-indexed inclusive page range: `[2, 5]` reads pages 2..5. */
|
|
905
|
-
pages?: [number, number];
|
|
906
|
-
/** When true, include doc-level metadata (title/author/etc) in the result. Default true. */
|
|
907
|
-
include_metadata?: boolean;
|
|
908
|
-
}
|
|
909
|
-
export interface ReadPdfPage {
|
|
910
|
-
page_number: number;
|
|
911
|
-
text: string;
|
|
912
|
-
is_empty: boolean;
|
|
913
|
-
char_count: number;
|
|
914
|
-
}
|
|
915
|
-
export interface ReadPdfResult {
|
|
916
|
-
path: string;
|
|
917
|
-
name: string;
|
|
918
|
-
size_bytes: number;
|
|
919
|
-
mtime: string;
|
|
920
|
-
page_count: number;
|
|
921
|
-
has_text: boolean;
|
|
922
|
-
pages: ReadPdfPage[];
|
|
923
|
-
full_text: string;
|
|
924
|
-
metadata?: {
|
|
925
|
-
title?: string;
|
|
926
|
-
author?: string;
|
|
927
|
-
subject?: string;
|
|
928
|
-
keywords?: string;
|
|
929
|
-
creator?: string;
|
|
930
|
-
producer?: string;
|
|
931
|
-
creation_date?: string;
|
|
932
|
-
mod_date?: string;
|
|
933
|
-
};
|
|
934
|
-
/** When `pages` slicing was applied, this carries the original page count
|
|
935
|
-
* for callers that need to know how much they didn't read. */
|
|
936
|
-
total_page_count: number;
|
|
937
|
-
}
|
|
938
|
-
export declare function readPdf(vault: Vault, args: ReadPdfArgs): Promise<ReadPdfResult>;
|
|
939
|
-
export interface OcrPdfArgs {
|
|
940
|
-
/** Vault-relative path to the .pdf file. */
|
|
941
|
-
path: string;
|
|
942
|
-
/**
|
|
943
|
-
* Tesseract language pack(s). Default `'eng'`. Multi-lang via `'+'`,
|
|
944
|
-
* e.g. `'eng+rus'` for English+Russian mixed scans.
|
|
945
|
-
*/
|
|
946
|
-
lang?: string;
|
|
947
|
-
/** Optional 1-indexed inclusive page range, e.g. [2, 5] runs OCR on pages 2..5. */
|
|
948
|
-
pages?: [number, number];
|
|
949
|
-
/**
|
|
950
|
-
* Render scale (DPI multiplier). Higher = better OCR accuracy on small
|
|
951
|
-
* text but more memory + slower render. Default 2 (~150 DPI). Capped at
|
|
952
|
-
* 4 server-side.
|
|
953
|
-
*/
|
|
954
|
-
scale?: number;
|
|
955
|
-
}
|
|
956
|
-
export interface OcrPdfPage {
|
|
957
|
-
page_number: number;
|
|
958
|
-
text: string;
|
|
959
|
-
is_empty: boolean;
|
|
960
|
-
char_count: number;
|
|
961
|
-
/** Tesseract's mean confidence for this page, 0-100. */
|
|
962
|
-
confidence: number;
|
|
963
|
-
}
|
|
964
|
-
export interface OcrPdfResult {
|
|
965
|
-
path: string;
|
|
966
|
-
name: string;
|
|
967
|
-
size_bytes: number;
|
|
968
|
-
mtime: string;
|
|
969
|
-
page_count: number;
|
|
970
|
-
total_page_count: number;
|
|
971
|
-
has_text: boolean;
|
|
972
|
-
pages: OcrPdfPage[];
|
|
973
|
-
full_text: string;
|
|
974
|
-
/** Mean confidence across pages with text. NaN if all pages empty. */
|
|
975
|
-
mean_confidence: number;
|
|
976
|
-
/** Languages used for OCR (whatever the caller passed). */
|
|
977
|
-
langs: string;
|
|
978
|
-
}
|
|
979
|
-
export declare function ocrPdf(vault: Vault, args: OcrPdfArgs): Promise<OcrPdfResult>;
|
|
980
|
-
//# sourceMappingURL=tools.d.ts.map
|