obsidian-mcp-server 3.8.0 → 3.9.0
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/AGENTS.md +12 -10
- package/CLAUDE.md +12 -10
- package/README.md +12 -8
- package/changelog/3.9.x/3.9.0.md +43 -0
- package/changelog/template.md +10 -3
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +6 -4
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +22 -15
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +4 -3
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +6 -9
- package/dist/instructions.js.map +1 -1
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts +7 -5
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js +11 -8
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +237 -217
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/index.js +6 -4
- package/dist/mcp-server/tools/definitions/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts +6 -0
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js +8 -1
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts +6 -0
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js +8 -1
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts +143 -27
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js +87 -79
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts +6 -0
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js +10 -3
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js.map +1 -1
- package/dist/services/obsidian/obsidian-service.d.ts +53 -15
- package/dist/services/obsidian/obsidian-service.d.ts.map +1 -1
- package/dist/services/obsidian/obsidian-service.js +461 -155
- package/dist/services/obsidian/obsidian-service.js.map +1 -1
- package/dist/services/obsidian/section-extractor.d.ts +62 -6
- package/dist/services/obsidian/section-extractor.d.ts.map +1 -1
- package/dist/services/obsidian/section-extractor.js +303 -62
- package/dist/services/obsidian/section-extractor.js.map +1 -1
- package/manifest.json +3 -3
- package/package.json +8 -8
- package/server.json +7 -7
- package/skills/obsidian-guide/SKILL.md +61 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview obsidian_search_notes — text/jsonlogic/omnisearch search with
|
|
3
|
-
* MCP-spec cursor pagination. The `omnisearch` mode is
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* multi-token query's per-token spans) and additionally clip
|
|
7
|
-
* `maxMatchesPerHit` so a single match-heavy note can't blow the
|
|
8
|
-
* budget — clipped hits carry `truncated: true` and `totalMatches`.
|
|
3
|
+
* MCP-spec cursor pagination. The `omnisearch` mode is offered only with reads
|
|
4
|
+
* unscoped and the Omnisearch plugin's HTTP server answering at startup
|
|
5
|
+
* (`omnisearchAvailability`). Text-mode hits carry match locations (the
|
|
6
|
+
* service merges a multi-token query's per-token spans) and additionally clip
|
|
7
|
+
* per file via `maxMatchesPerHit` so a single match-heavy note can't blow the
|
|
8
|
+
* response budget — clipped hits carry `truncated: true` and `totalMatches`.
|
|
9
9
|
* @module mcp-server/tools/definitions/obsidian-search-notes.tool
|
|
10
10
|
*/
|
|
11
11
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
@@ -22,12 +22,21 @@ const OMNISEARCH_UPSTREAM_CAP = 50;
|
|
|
22
22
|
const OMNISEARCH_TRUNCATIONS = {
|
|
23
23
|
cap_reached: `Omnisearch returned its ${OMNISEARCH_UPSTREAM_CAP}-hit cap, so more matches may exist. Narrow with \`path:\`, \`ext:\`, or more plain terms, which Omnisearch applies before the cap.`,
|
|
24
24
|
filtered_after_cap: `Omnisearch keeps its top ${OMNISEARCH_UPSTREAM_CAP} matches before it applies quoted terms and \`-exclusion\` terms, so matches past the cap were never checked. Narrow with \`path:\`, \`ext:\`, or more plain terms, which apply before the cap, or rerun without the quoted and excluded terms to see whether the cap was reached.`,
|
|
25
|
-
read_scope: `Omnisearch keeps its top ${OMNISEARCH_UPSTREAM_CAP} matches across the whole vault before the read scope filters them, so readable matches may be missing. Add a \`path:\` term naming a readable folder, which Omnisearch applies before the cap.`,
|
|
26
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Decide {@link OmnisearchAvailability} once, at startup. Under a read scope
|
|
28
|
+
* it is `withheld` with no request, the probe included; otherwise the probe
|
|
29
|
+
* decides.
|
|
30
|
+
*/
|
|
31
|
+
export async function omnisearchAvailability(svc) {
|
|
32
|
+
if (svc.policy.restrictsReads)
|
|
33
|
+
return 'withheld';
|
|
34
|
+
return (await svc.probeOmnisearch()) ? 'offered' : 'unreachable';
|
|
35
|
+
}
|
|
27
36
|
const CursorSchema = z
|
|
28
37
|
.string()
|
|
29
38
|
.optional()
|
|
30
|
-
.describe('Opaque cursor from a prior response. Omit for the first page. Page size is server-determined; do not assume a fixed value. Under OBSIDIAN_READ_PATHS or OBSIDIAN_DENY_PATHS, later `jsonlogic` pages come from the hit list the first page computed.');
|
|
39
|
+
.describe('Opaque cursor from a prior response. Omit for the first page. Page size is server-determined; do not assume a fixed value. Under OBSIDIAN_READ_PATHS or OBSIDIAN_DENY_PATHS, later `text` and `jsonlogic` pages come from the hit list the first page computed.');
|
|
31
40
|
const TextHitSchema = z
|
|
32
41
|
.object({
|
|
33
42
|
filename: z.string().describe('Vault-relative path of the matching note.'),
|
|
@@ -74,7 +83,7 @@ const OmnisearchHitSchema = z
|
|
|
74
83
|
basename: z.string().describe('Note basename without extension.'),
|
|
75
84
|
score: z
|
|
76
85
|
.number()
|
|
77
|
-
.describe('BM25 relevance score
|
|
86
|
+
.describe("Omnisearch's BM25 relevance score; higher is more relevant. `0` marks a note Omnisearch added because it embeds an earlier hit, which need not contain the query words."),
|
|
78
87
|
foundWords: z
|
|
79
88
|
.array(z.string())
|
|
80
89
|
.describe('Query words found in the note. Populated even when no body match exists (e.g. basename-only match), so empty `matches` paired with non-empty `foundWords` is valid.'),
|
|
@@ -85,23 +94,24 @@ const OmnisearchHitSchema = z
|
|
|
85
94
|
offset: z.number().describe('Offset of the match within the note body.'),
|
|
86
95
|
})
|
|
87
96
|
.describe('A single match span in the note body.'))
|
|
88
|
-
.describe('Match positions within the note body.
|
|
97
|
+
.describe('Match positions within the note body. Omnisearch locates them only for the first 10 hits it returns, so every later hit has none, and an earlier hit has none when the query words occur only in its basename.'),
|
|
89
98
|
excerpt: z
|
|
90
99
|
.string()
|
|
91
|
-
.describe(
|
|
100
|
+
.describe("Text from the note around its first match in `matches`; a hit with empty `matches` gets the note's opening instead. HTML entities are decoded and `<br>` becomes `\\n`."),
|
|
92
101
|
})
|
|
93
102
|
.describe('An Omnisearch BM25-ranked hit.');
|
|
94
103
|
/**
|
|
95
104
|
* Build the `obsidian_search_notes` tool. The `omnisearch` mode is included
|
|
96
|
-
* in the input/output schemas only when `
|
|
97
|
-
* LLM never sees it as an option on a deployment where it
|
|
98
|
-
* requires a server restart.
|
|
105
|
+
* in the input/output schemas and the description only when `omnisearch` is
|
|
106
|
+
* `offered`, so the LLM never sees it as an option on a deployment where it
|
|
107
|
+
* can't run or is withheld. Re-probe requires a server restart.
|
|
99
108
|
*/
|
|
100
|
-
export function buildSearchNotesTool({
|
|
101
|
-
const
|
|
109
|
+
export function buildSearchNotesTool({ omnisearch }) {
|
|
110
|
+
const omnisearchOffered = omnisearch === 'offered';
|
|
111
|
+
const modeEnum = omnisearchOffered
|
|
102
112
|
? ['text', 'jsonlogic', 'omnisearch']
|
|
103
113
|
: ['text', 'jsonlogic'];
|
|
104
|
-
const description =
|
|
114
|
+
const description = omnisearchOffered
|
|
105
115
|
? 'Search the vault by text tokens, JSONLogic predicate, or BM25-ranked Omnisearch query. Pick the mode that matches the query shape — `omnisearch` is best for ranked relevance, typo tolerance, and PDF/OCR coverage (via the Text Extractor plugin). Results paginate via opaque cursors: omit `cursor` for the first page, then pass `nextCursor` from the prior response. Text-mode hits additionally clip per file at `maxMatchesPerHit` match locations.'
|
|
106
116
|
: 'Search the vault by text tokens or JSONLogic predicate. Pick the mode that matches the query shape. Results paginate via opaque cursors: omit `cursor` for the first page, then pass `nextCursor` from the prior response. Text-mode hits additionally clip per file at `maxMatchesPerHit` match locations.';
|
|
107
117
|
const textModeDescription = '`text` splits `query` on spaces and requires every token, each matched case-insensitively as a substring of the filename or note body; a tab or line break stays part of its token. Quotes are literal characters, not a phrase operator. Each hit returns match locations with surrounding context windows; tokens that sit close together, such as the words of a phrase, share one location.';
|
|
@@ -109,17 +119,17 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
109
119
|
const inputSchema = z.object({
|
|
110
120
|
mode: z
|
|
111
121
|
.enum(modeEnum)
|
|
112
|
-
.describe(
|
|
122
|
+
.describe(omnisearchOffered
|
|
113
123
|
? `Which search algorithm to run. ${textModeDescription} ${jsonlogicModeDescription} \`omnisearch\` runs a BM25-ranked query via the Omnisearch plugin — supports quoted phrases, \`-exclusion\`, \`path:\` / \`ext:\` filters, typo tolerance, and PDF/OCR (with Text Extractor). Omnisearch keeps its top ${OMNISEARCH_UPSTREAM_CAP} matches, applying \`path:\` and \`ext:\` before that cap and quoted phrases and \`-exclusion\` after the cap (see \`truncated\`).`
|
|
114
124
|
: `Which search algorithm to run. ${textModeDescription} ${jsonlogicModeDescription}`),
|
|
115
125
|
query: z
|
|
116
126
|
.string()
|
|
117
127
|
.optional()
|
|
118
|
-
.describe('The query string. Required
|
|
128
|
+
.describe('The query string. Required in every mode but `jsonlogic`, which ignores it (use `logic` instead — this field must be a string, so passing a JSONLogic tree here is rejected). In `text` mode it is split on spaces and every token must appear; quotes stay part of the tokens, so a quoted phrase matches nothing unless the note contains the quote characters.'),
|
|
119
129
|
logic: z
|
|
120
130
|
.record(z.string(), z.unknown())
|
|
121
131
|
.optional()
|
|
122
|
-
.describe('JSONLogic tree. Required for `jsonlogic` mode
|
|
132
|
+
.describe('JSONLogic tree. Required for `jsonlogic` mode and ignored in every other (use `query` instead — this field must be an object, so passing a string here is rejected). `glob` and `regexp` take `[PATTERN, VALUE]` — pattern first: `{"glob": ["Projects/*.md", {"var": "path"}]}`. Backlinks ("what links here") have no dedicated tool; find them this way: `{"regexp": ["\\\\[\\\\[Target Note(\\\\\\\\?\\\\||#|\\\\]\\\\])", {"var": "content"}]}` finds every readable note whose body wikilinks or embeds `Target Note`, in plain, aliased (`|`, or the table-safe `\\|`), or section form. `obsidian_get_note` with `includeLinks: true` covers the outgoing direction.'),
|
|
123
133
|
contextLength: z
|
|
124
134
|
.number()
|
|
125
135
|
.int()
|
|
@@ -179,14 +189,14 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
179
189
|
.describe('Opaque cursor for the next page. Omitted on the last page (do not treat absent as null).'),
|
|
180
190
|
truncated: z
|
|
181
191
|
.boolean()
|
|
182
|
-
.describe(`True whenever Omnisearch's ${OMNISEARCH_UPSTREAM_CAP}-hit cap may have cut matches that are not retrievable: when it returned ${OMNISEARCH_UPSTREAM_CAP} or more
|
|
192
|
+
.describe(`True whenever Omnisearch's ${OMNISEARCH_UPSTREAM_CAP}-hit cap may have cut matches that are not retrievable: when it returned ${OMNISEARCH_UPSTREAM_CAP} or more, and when the query holds quoted terms or \`-exclusion\` terms, which Omnisearch applies after its cap. Narrow with \`path:\`, \`ext:\`, or more plain terms, which Omnisearch applies before its cap.`),
|
|
183
193
|
truncatedReason: z
|
|
184
|
-
.enum(['cap_reached', 'filtered_after_cap'
|
|
194
|
+
.enum(['cap_reached', 'filtered_after_cap'])
|
|
185
195
|
.optional()
|
|
186
|
-
.describe('Why `truncated` is true, present only then: `cap_reached` (Omnisearch returned its cap)
|
|
196
|
+
.describe('Why `truncated` is true, present only then: `cap_reached` (Omnisearch returned its cap) or `filtered_after_cap` (quoted or `-exclusion` terms filtered after the cap).'),
|
|
187
197
|
})
|
|
188
198
|
.describe('Omnisearch BM25 results.');
|
|
189
|
-
const branches =
|
|
199
|
+
const branches = omnisearchOffered
|
|
190
200
|
? [textBranch, jsonlogicBranch, omnisearchBranch]
|
|
191
201
|
: [textBranch, jsonlogicBranch];
|
|
192
202
|
const outputSchema = z.object({
|
|
@@ -194,14 +204,25 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
194
204
|
.discriminatedUnion('mode', [...branches])
|
|
195
205
|
.describe('Mode-discriminated search payload.'),
|
|
196
206
|
});
|
|
207
|
+
/**
|
|
208
|
+
* Thrown by the service on the omnisearch path alone, so declared only where
|
|
209
|
+
* the mode is offered: `tools/list` renders every entry, and a withheld or
|
|
210
|
+
* unreachable mode leaves nothing that names Omnisearch.
|
|
211
|
+
*/
|
|
212
|
+
const omnisearchErrors = [
|
|
213
|
+
{
|
|
214
|
+
reason: 'omnisearch_unreachable',
|
|
215
|
+
thrownBy: 'service',
|
|
216
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
217
|
+
when: 'Omnisearch was reachable at startup but did not answer: it is unreachable (Obsidian quit, plugin disabled, or mobile session), answered with a non-2xx status, or took longer than OBSIDIAN_REQUEST_TIMEOUT_MS. One attempt, never retried.',
|
|
218
|
+
retryable: true,
|
|
219
|
+
recovery: 'Confirm Obsidian is running with the Omnisearch plugin enabled and retry, or narrow the query if it was slow. If Omnisearch stays down, restart Obsidian, then restart this MCP server so it re-probes the plugin URL.',
|
|
220
|
+
},
|
|
221
|
+
];
|
|
197
222
|
/**
|
|
198
223
|
* Declared inline as a `const` tuple so `tool()`'s `const TErrors` generic
|
|
199
224
|
* captures the literal reason strings — that's what gives the handler its
|
|
200
|
-
* typed `ctx.fail<'reason'>(...)`.
|
|
201
|
-
* declared unconditionally even when `omnisearchReachable` is false; the
|
|
202
|
-
* branch that throws it only runs in the omnisearch handler path (which
|
|
203
|
-
* only runs when reachable), so the entry is harmless when unused and
|
|
204
|
-
* keeps the contract shape stable across deployments.
|
|
225
|
+
* typed `ctx.fail<'reason'>(...)`.
|
|
205
226
|
*/
|
|
206
227
|
const errors = [
|
|
207
228
|
{
|
|
@@ -213,8 +234,10 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
213
234
|
{
|
|
214
235
|
reason: 'query_required',
|
|
215
236
|
code: JsonRpcErrorCode.ValidationError,
|
|
216
|
-
when: '`query` is missing
|
|
217
|
-
recovery:
|
|
237
|
+
when: '`query` is missing in a mode that requires it: every mode but `jsonlogic`.',
|
|
238
|
+
recovery: omnisearchOffered
|
|
239
|
+
? 'Pass `query` — space-separated tokens, all required, for text mode, or BM25 query syntax (quoted phrases, `-exclusion`, `path:` / `ext:` filters) for omnisearch.'
|
|
240
|
+
: 'Pass `query` as space-separated tokens, all of which a note must contain.',
|
|
218
241
|
},
|
|
219
242
|
{
|
|
220
243
|
reason: 'context_length_too_large',
|
|
@@ -264,14 +287,7 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
264
287
|
when: 'With OBSIDIAN_READ_PATHS or OBSIDIAN_DENY_PATHS set, a readable note holds data, usually a frontmatter value, nested deeper than the server can hand to its evaluator (about 3,500 levels under Node, more under Bun).',
|
|
265
288
|
recovery: 'Flatten the deeply nested value, usually a frontmatter field, in the note the message names, or ask the operator to leave that note out of OBSIDIAN_READ_PATHS or add it to OBSIDIAN_DENY_PATHS; no scoped jsonlogic search runs while it is readable.',
|
|
266
289
|
},
|
|
267
|
-
|
|
268
|
-
reason: 'omnisearch_unreachable',
|
|
269
|
-
thrownBy: 'service',
|
|
270
|
-
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
271
|
-
when: 'Omnisearch was reachable at startup but is now unreachable (Obsidian quit, plugin disabled, or mobile session).',
|
|
272
|
-
retryable: true,
|
|
273
|
-
recovery: 'Restart Obsidian with the Omnisearch plugin enabled, then restart this MCP server so it re-probes the plugin URL.',
|
|
274
|
-
},
|
|
290
|
+
...(omnisearchOffered ? omnisearchErrors : []),
|
|
275
291
|
];
|
|
276
292
|
return tool('obsidian_search_notes', {
|
|
277
293
|
description,
|
|
@@ -284,7 +300,7 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
284
300
|
effectiveQuery: z
|
|
285
301
|
.string()
|
|
286
302
|
.optional()
|
|
287
|
-
.describe('The query string as submitted (
|
|
303
|
+
.describe('The query string as submitted (every mode but `jsonlogic`).'),
|
|
288
304
|
notice: z.string().optional().describe('Recovery guidance when the search returned no hits.'),
|
|
289
305
|
},
|
|
290
306
|
auth: ['tool:obsidian_search_notes:read'],
|
|
@@ -304,12 +320,15 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
304
320
|
});
|
|
305
321
|
}
|
|
306
322
|
ctx.enrich.echo(input.query);
|
|
307
|
-
const raw = await svc.searchText(ctx, input.query, input.contextLength);
|
|
308
323
|
const prefix = input.pathPrefix;
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
324
|
+
const searched = await svc.pageText(ctx, {
|
|
325
|
+
query: input.query,
|
|
326
|
+
contextLength: input.contextLength,
|
|
327
|
+
maxMatchesPerHit: input.maxMatchesPerHit,
|
|
328
|
+
pathPrefix: prefix,
|
|
329
|
+
}, ...cursorPage(input.cursor, ctx));
|
|
330
|
+
const allowed = policy.filterReadable(searched.hits);
|
|
331
|
+
const page = paginate(allowed, input.cursor, ctx, searched.walk);
|
|
313
332
|
if (page.hits.length === 0) {
|
|
314
333
|
ctx.enrich.notice(`No matches for ${inlineCode(input.query)}${prefix ? ` under prefix ${inlineCode(prefix)}` : ''}. Try broader terms, a different mode, or check that the path/filter is correct.`);
|
|
315
334
|
}
|
|
@@ -319,15 +338,7 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
319
338
|
if (!input.logic) {
|
|
320
339
|
throw ctx.fail('logic_required', '`logic` (JSONLogic tree) is required for jsonlogic mode.', { mode: input.mode });
|
|
321
340
|
}
|
|
322
|
-
|
|
323
|
-
* A scoped search's cursor names the walk its first page stored, so
|
|
324
|
-
* the later pages read that stored hit list instead of evaluating the
|
|
325
|
-
* tree again.
|
|
326
|
-
*/
|
|
327
|
-
const walk = input.cursor
|
|
328
|
-
? decodeCursor(input.cursor, requestContext(ctx)).walk
|
|
329
|
-
: undefined;
|
|
330
|
-
const searched = await svc.pageJsonLogic(ctx, input.logic, typeof walk === 'string' ? walk : undefined, DEFAULT_PAGE_SIZE);
|
|
341
|
+
const searched = await svc.pageJsonLogic(ctx, input.logic, ...cursorPage(input.cursor, ctx));
|
|
331
342
|
const allowed = policy.filterReadable(searched.hits);
|
|
332
343
|
const page = paginate(allowed, input.cursor, ctx, searched.walk);
|
|
333
344
|
if (page.hits.length === 0) {
|
|
@@ -335,7 +346,7 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
335
346
|
}
|
|
336
347
|
return { result: { mode: 'jsonlogic', ...page } };
|
|
337
348
|
}
|
|
338
|
-
// omnisearch — only
|
|
349
|
+
// omnisearch — in the schema only when the mode was offered at build time.
|
|
339
350
|
if (!input.query) {
|
|
340
351
|
throw ctx.fail('query_required', '`query` is required for omnisearch mode.', {
|
|
341
352
|
mode: input.mode,
|
|
@@ -343,7 +354,7 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
343
354
|
}
|
|
344
355
|
ctx.enrich.echo(input.query);
|
|
345
356
|
const raw = await svc.searchOmnisearch(ctx, input.query);
|
|
346
|
-
const truncatedReason = omnisearchTruncation(input.query, raw.length
|
|
357
|
+
const truncatedReason = omnisearchTruncation(input.query, raw.length);
|
|
347
358
|
const allowed = policy.filterReadable(raw);
|
|
348
359
|
const page = paginate(allowed, input.cursor, ctx);
|
|
349
360
|
if (page.hits.length === 0) {
|
|
@@ -409,15 +420,15 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
|
|
|
409
420
|
/**
|
|
410
421
|
* Static specimen for the MCP definition linter (which duck-types tool
|
|
411
422
|
* exports out of each `.tool.ts` file) and for existing tests that import
|
|
412
|
-
* the tool directly.
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
423
|
+
* the tool directly. Built without the `omnisearch` mode — the safe baseline
|
|
424
|
+
* that doesn't assume the optional plugin is installed. The entry point
|
|
425
|
+
* (`src/index.ts`) builds the live tool via `buildSearchNotesTool` with the
|
|
426
|
+
* startup `omnisearchAvailability`; this export is not the registered tool.
|
|
416
427
|
* The omnisearch-enabled variant is exercised by tests rather than the
|
|
417
428
|
* linter (two exports under the same tool name would collide on
|
|
418
429
|
* `name-unique`).
|
|
419
430
|
*/
|
|
420
|
-
export const obsidianSearchNotes = buildSearchNotesTool({
|
|
431
|
+
export const obsidianSearchNotes = buildSearchNotesTool({ omnisearch: 'unreachable' });
|
|
421
432
|
/**
|
|
422
433
|
* Apply MCP-spec cursor pagination to a fully assembled, post-filter result
|
|
423
434
|
* array. Returns the page's hits, the total pre-pagination count, and
|
|
@@ -434,6 +445,18 @@ function paginate(items, cursor, ctx, walk) {
|
|
|
434
445
|
...(nextCursor !== undefined ? { nextCursor } : {}),
|
|
435
446
|
};
|
|
436
447
|
}
|
|
448
|
+
/**
|
|
449
|
+
* The walk a cursor names, if any, and the index just past the page it asks
|
|
450
|
+
* for, as `paginate` will slice it. A scoped search's cursor names the walk its
|
|
451
|
+
* first page stored, so the later pages read that stored hit list instead of
|
|
452
|
+
* searching again.
|
|
453
|
+
*/
|
|
454
|
+
function cursorPage(cursor, ctx) {
|
|
455
|
+
if (!cursor)
|
|
456
|
+
return [undefined, DEFAULT_PAGE_SIZE];
|
|
457
|
+
const { offset, limit, walk } = decodeCursor(cursor, requestContext(ctx));
|
|
458
|
+
return [typeof walk === 'string' ? walk : undefined, offset + Math.min(limit, MAX_PAGE_SIZE)];
|
|
459
|
+
}
|
|
437
460
|
/**
|
|
438
461
|
* The `Context` → `RequestContext` cast the cursor helpers need — their
|
|
439
462
|
* signatures require the index-signature shape that handler-facing `Context`
|
|
@@ -444,15 +467,10 @@ function requestContext(ctx) {
|
|
|
444
467
|
}
|
|
445
468
|
/**
|
|
446
469
|
* Why Omnisearch's 50-hit cap may have cut matches from a result, or
|
|
447
|
-
* `undefined` when the result is complete
|
|
448
|
-
*
|
|
449
|
-
* could tell whether it cut a readable match: the result is never called
|
|
450
|
-
* complete there. Otherwise a full cap, or a query Omnisearch filters after
|
|
451
|
-
* the cap (`filteredAfterCap`), leaves it unknown.
|
|
470
|
+
* `undefined` when the result is complete: a full cap, or a query Omnisearch
|
|
471
|
+
* filters after the cap (`filteredAfterCap`), leaves it unknown.
|
|
452
472
|
*/
|
|
453
|
-
function omnisearchTruncation(query, upstreamHits
|
|
454
|
-
if (readScoped)
|
|
455
|
-
return 'read_scope';
|
|
473
|
+
function omnisearchTruncation(query, upstreamHits) {
|
|
456
474
|
if (upstreamHits >= OMNISEARCH_UPSTREAM_CAP)
|
|
457
475
|
return 'cap_reached';
|
|
458
476
|
if (filteredAfterCap(query))
|
|
@@ -475,16 +493,6 @@ function filteredAfterCap(query) {
|
|
|
475
493
|
.some((term) => term.startsWith("'") ||
|
|
476
494
|
(term.length > 1 && term.startsWith('-') && !/^-(?:path|ext):/i.test(term)));
|
|
477
495
|
}
|
|
478
|
-
function clipMatches(hit, cap) {
|
|
479
|
-
if (hit.matches.length <= cap)
|
|
480
|
-
return hit;
|
|
481
|
-
return {
|
|
482
|
-
...hit,
|
|
483
|
-
matches: hit.matches.slice(0, cap),
|
|
484
|
-
truncated: true,
|
|
485
|
-
totalMatches: hit.matches.length,
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
496
|
/**
|
|
489
497
|
* Wrap upstream-authored text in a code fence long enough that nothing inside
|
|
490
498
|
* it can close the block.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-search-notes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-search-notes.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,QAAQ,EACR,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,iFAAiF;AACjF,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,0EAA0E;AAC1E,MAAM,sBAAsB,GAAG;IAC7B,WAA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AAC,OAAO,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IAC1C,OAAO;QACL,GAAG,GAAG;QACN,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;QAClC,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM;KACjC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,MAAM,CAAC,IAAY,EAAE,IAAI,GAAG,MAAM;IACzC,OAAO,QAAQ,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;AAClD,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAU;IACnC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"obsidian-search-notes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-search-notes.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,QAAQ,EACR,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAwB,MAAM,yCAAyC,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,uBAAuB,GAAG,EAAE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CAAC,KAAK,CAAC;QAAE,OAAO,oBAAoB,CAAC;IACzD,OAAO;AACT,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,gBAAgB,CAAC,KAAa;IACrC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,KAAK;SACT,KAAK,CAAC,KAAK,CAAC;SACZ,IAAI,CACH,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QACpB,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAC9E,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,MAAM,CAAC,IAAY,EAAE,IAAI,GAAG,MAAM;IACzC,OAAO,QAAQ,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;AAClD,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAU;IACnC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -107,6 +107,12 @@ export declare const obsidianWriteNote: import("@cyanheads/mcp-ts-core").ToolDef
|
|
|
107
107
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
108
108
|
readonly when: "On Local REST API v5.0 and later, the new body of a heading section carries a heading at or above that section’s own level, which would have to sit outside the section.";
|
|
109
109
|
readonly recovery: "Append the heading at the parent section or at the end of the note with obsidian_append_to_note, or write it one level below the target section or deeper.";
|
|
110
|
+
}, {
|
|
111
|
+
readonly reason: "repeated_link_definition";
|
|
112
|
+
readonly thrownBy: "service";
|
|
113
|
+
readonly code: JsonRpcErrorCode.Conflict;
|
|
114
|
+
readonly when: "A link reference definition that repeats a label defined earlier in the note sits above where the target heading’s section ends (for the last section, above its heading); the Local REST API’s markdown parser drops it and misplaces every heading below it, so the replacement would land outside the section.";
|
|
115
|
+
readonly recovery: "Use obsidian_replace_in_note to place the new body directly, or to remove or rename the repeated definition at `line`, then retry the section write.";
|
|
110
116
|
}, {
|
|
111
117
|
readonly reason: "patch_rejected";
|
|
112
118
|
readonly thrownBy: "service";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-write-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-write-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAWjE,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"obsidian-write-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-write-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAWjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuP5B,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { scanHeadings } from '../../../services/obsidian/section-extractor.js';
|
|
|
11
11
|
import { ContentTypeSchema, SectionSchema, TargetSchema } from './_shared/schemas.js';
|
|
12
12
|
import { caseVariantError, findCaseVariants, withCaseVariantNamed, } from './_shared/suggest-paths.js';
|
|
13
13
|
export const obsidianWriteNote = tool('obsidian_write_note', {
|
|
14
|
-
description: 'Create or overwrite a note. With `section`, replaces just that heading/block/frontmatter section in place — use `obsidian_get_note` with `format: "document-map"` to discover available targets. Name a heading by its full `Parent::Child` path as the document map lists it, or by a bare leaf name matched at any depth. A leaf shared by several headings is rejected with `ambiguous_section`, unless one of them has no parent heading, in which case the write targets that one; a full path that occurs more than once in the note is rejected with `ambiguous_section` too. Whole-file writes fail with `file_exists` against an existing note unless `overwrite: true`, and with `case_variant_exists` when the path differs from an existing note only in letter case on a case-insensitive filesystem (`existingPath` names the note when the folder listing shows exactly one case match) — for in-place edits, prefer `obsidian_patch_note` (sections), `obsidian_append_to_note` (append), or `obsidian_replace_in_note` (find-and-replace). For heading sections, `content` is the new body; the heading line is preserved automatically.',
|
|
14
|
+
description: 'Create or overwrite a note. With `section`, replaces just that heading/block/frontmatter section in place — use `obsidian_get_note` with `format: "document-map"` to discover available targets. Name a heading by its full `Parent::Child` path as the document map lists it, or by a bare leaf name matched at any depth. A leaf shared by several headings is rejected with `ambiguous_section`, unless one of them has no parent heading, in which case the write targets that one; a full path that occurs more than once in the note is rejected with `ambiguous_section` too. A heading section is rejected with `repeated_link_definition` when a link reference definition that repeats an earlier label sits above where it ends (for the last section, above its heading), which makes the plugin misplace the headings below it. Whole-file writes fail with `file_exists` against an existing note unless `overwrite: true`, and with `case_variant_exists` when the path differs from an existing note only in letter case on a case-insensitive filesystem (`existingPath` names the note when the folder listing shows exactly one case match) — for in-place edits, prefer `obsidian_patch_note` (sections), `obsidian_append_to_note` (append), or `obsidian_replace_in_note` (find-and-replace). For heading sections, `content` is the new body; the heading line is preserved automatically.',
|
|
15
15
|
annotations: { idempotentHint: true, destructiveHint: true },
|
|
16
16
|
input: z.object({
|
|
17
17
|
target: TargetSchema.describe('Where the note lives.'),
|
|
@@ -121,6 +121,13 @@ export const obsidianWriteNote = tool('obsidian_write_note', {
|
|
|
121
121
|
when: 'On Local REST API v5.0 and later, the new body of a heading section carries a heading at or above that section’s own level, which would have to sit outside the section.',
|
|
122
122
|
recovery: 'Append the heading at the parent section or at the end of the note with obsidian_append_to_note, or write it one level below the target section or deeper.',
|
|
123
123
|
},
|
|
124
|
+
{
|
|
125
|
+
reason: 'repeated_link_definition',
|
|
126
|
+
thrownBy: 'service',
|
|
127
|
+
code: JsonRpcErrorCode.Conflict,
|
|
128
|
+
when: 'A link reference definition that repeats a label defined earlier in the note sits above where the target heading’s section ends (for the last section, above its heading); the Local REST API’s markdown parser drops it and misplaces every heading below it, so the replacement would land outside the section.',
|
|
129
|
+
recovery: 'Use obsidian_replace_in_note to place the new body directly, or to remove or rename the repeated definition at `line`, then retry the section write.',
|
|
130
|
+
},
|
|
124
131
|
{
|
|
125
132
|
reason: 'patch_rejected',
|
|
126
133
|
thrownBy: 'service',
|
|
@@ -183,8 +190,8 @@ export const obsidianWriteNote = tool('obsidian_write_note', {
|
|
|
183
190
|
*/
|
|
184
191
|
const { exact, variants } = await findCaseVariants(ctx, svc, path);
|
|
185
192
|
if (!exact && variants.length > 0) {
|
|
186
|
-
const { message, data } = caseVariantError(path, variants);
|
|
187
|
-
throw ctx.fail('case_variant_exists', message, data);
|
|
193
|
+
const { message, data, literals } = caseVariantError(path, variants);
|
|
194
|
+
throw ctx.fail('case_variant_exists', message, data, { literals });
|
|
188
195
|
}
|
|
189
196
|
throw ctx.fail('file_exists', `Note '${path}' already exists.`, {
|
|
190
197
|
path,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obsidian-write-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-write-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,qBAAqB,EAAE;IAC3D,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"obsidian-write-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-write-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,qBAAqB,EAAE;IAC3D,WAAW,EACT,m1CAAm1C;IACr1C,WAAW,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE;IAC5D,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACtD,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,QAAQ,CACP,0JAA0J,CAC3J;QACH,OAAO,E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AK,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,KAAK,EAAE,KAAK,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC;IAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -27,6 +27,11 @@ export type ObsidianFetch = (url: string, init: RequestInit & {
|
|
|
27
27
|
rejectUnauthorized: boolean;
|
|
28
28
|
};
|
|
29
29
|
}) => Promise<UndiciResponse>;
|
|
30
|
+
/** A text hit with its match locations capped at `maxMatchesPerHit`; a capped hit carries `truncated` and `totalMatches`. */
|
|
31
|
+
type ClippedTextHit = TextSearchHit & {
|
|
32
|
+
totalMatches?: number;
|
|
33
|
+
truncated?: boolean;
|
|
34
|
+
};
|
|
30
35
|
export declare class ObsidianService {
|
|
31
36
|
#private;
|
|
32
37
|
/**
|
|
@@ -97,6 +102,11 @@ export declare class ObsidianService {
|
|
|
97
102
|
* applied to — identical to `instruction.target` unless a bare heading leaf
|
|
98
103
|
* was expanded to its full `Parent::Child` path (see `#resolveHeadingTarget`),
|
|
99
104
|
* which callers echo back so an agent can see where the write landed.
|
|
105
|
+
*
|
|
106
|
+
* A heading write placed by a heading the note has is checked against the
|
|
107
|
+
* note's link definitions first (`#refuseDroppedDefinition`). Every step
|
|
108
|
+
* that needs the note's text shares one read of it: the one
|
|
109
|
+
* `#headingIndex` made, or else one made on first need.
|
|
100
110
|
*/
|
|
101
111
|
patchNote(ctx: Context, target: NoteTarget, content: string, instruction: PatchInstruction): Promise<string>;
|
|
102
112
|
deleteNote(ctx: Context, target: NoteTarget): Promise<void>;
|
|
@@ -113,8 +123,9 @@ export declare class ObsidianService {
|
|
|
113
123
|
* coddingtonbear/obsidian-local-rest-api#237). Always prefer delivered
|
|
114
124
|
* bytes or HEAD over the metadata field.
|
|
115
125
|
*
|
|
116
|
-
*
|
|
117
|
-
* gates readable on path targets
|
|
126
|
+
* One attempt, never retried (HEAD is not in `RETRY_SAFE_METHODS`; a 404 is
|
|
127
|
+
* the answer, not a transient failure), and gates readable on path targets
|
|
128
|
+
* before issuing the HEAD.
|
|
118
129
|
*/
|
|
119
130
|
tryGetSize(ctx: Context, target: NoteTarget): Promise<number | null>;
|
|
120
131
|
/**
|
|
@@ -170,28 +181,53 @@ export declare class ObsidianService {
|
|
|
170
181
|
*/
|
|
171
182
|
searchJsonLogic(ctx: Context, logic: Record<string, unknown>): Promise<StructuredSearchHit[]>;
|
|
172
183
|
/**
|
|
173
|
-
* A JSONLogic search for a caller paging through its hits
|
|
174
|
-
*
|
|
175
|
-
* without `walk` evaluates fresh and, when the
|
|
176
|
-
*
|
|
184
|
+
* A JSONLogic search for a caller paging through its hits, whose page this
|
|
185
|
+
* call serves ends at index `pageEnd`. Unscoped, it is `searchJsonLogic`.
|
|
186
|
+
* Under a read scope a call without `walk` evaluates fresh and, when the
|
|
187
|
+
* hits run past `pageEnd`, so a later page will read them, stores the full
|
|
188
|
+
* ordered hit list under a new walk id, returned as `walk`;
|
|
177
189
|
* a call naming that id with the same tree is served from the stored list
|
|
178
190
|
* without evaluating. The store belongs to this service, whose read scope
|
|
179
191
|
* is fixed at construction, so a list is only read under the scope that
|
|
180
|
-
* produced it. Anything else — an expired, evicted, or unknown id,
|
|
181
|
-
* different tree — evaluates fresh, and a call cancelled
|
|
182
|
-
* stores nothing.
|
|
192
|
+
* produced it. Anything else — an expired, evicted, or unknown id, a text
|
|
193
|
+
* walk's id, or a different tree — evaluates fresh, and a call cancelled
|
|
194
|
+
* before it answers stores nothing.
|
|
183
195
|
*/
|
|
184
|
-
pageJsonLogic(ctx: Context, logic: Record<string, unknown>, walk: string | undefined,
|
|
196
|
+
pageJsonLogic(ctx: Context, logic: Record<string, unknown>, walk: string | undefined, pageEnd: number): Promise<{
|
|
185
197
|
hits: StructuredSearchHit[];
|
|
186
198
|
walk?: string;
|
|
187
199
|
}>;
|
|
200
|
+
/**
|
|
201
|
+
* A text search for a caller paging through its hits, whose page this call
|
|
202
|
+
* serves ends at index `pageEnd`: each hit's match locations capped at
|
|
203
|
+
* `maxMatchesPerHit`, and only the hits whose filename starts with
|
|
204
|
+
* `pathPrefix` when one is given. Unscoped, every page runs `searchText`.
|
|
205
|
+
* Under a read scope a call without `walk` searches fresh and, when the
|
|
206
|
+
* prefixed hits run past `pageEnd`, so a later page will read them, stores
|
|
207
|
+
* the capped hits, unprefixed, under a new walk id, returned as
|
|
208
|
+
* `walk`. A call naming that id with the same `query`, `contextLength`, and
|
|
209
|
+
* `maxMatchesPerHit` is served from the stored hits with no request, its own
|
|
210
|
+
* `pathPrefix` applied to them; the scope is fixed for this service, so it
|
|
211
|
+
* is no part of the key. Anything else — an expired, evicted, or unknown
|
|
212
|
+
* id, a JSONLogic walk's id, or a changed input — searches fresh, and a
|
|
213
|
+
* call cancelled before it answers stores nothing.
|
|
214
|
+
*/
|
|
215
|
+
pageText(ctx: Context, search: {
|
|
216
|
+
contextLength: number;
|
|
217
|
+
maxMatchesPerHit: number;
|
|
218
|
+
pathPrefix?: string | undefined;
|
|
219
|
+
query: string;
|
|
220
|
+
}, walk: string | undefined, pageEnd: number): Promise<{
|
|
221
|
+
hits: ClippedTextHit[];
|
|
222
|
+
walk?: string;
|
|
223
|
+
}>;
|
|
188
224
|
/**
|
|
189
225
|
* One-shot startup probe for the Omnisearch plugin's HTTP endpoint. Returns
|
|
190
226
|
* `true` only when the response is `HTTP 200`, declares `application/json`,
|
|
191
227
|
* and the body parses as a JSON array — unrouted paths on the Omnisearch
|
|
192
228
|
* server also return `200` with an empty body, so status alone is
|
|
193
|
-
* insufficient.
|
|
194
|
-
*
|
|
229
|
+
* insufficient. `omnisearchAvailability` calls it, and only when reads are
|
|
230
|
+
* unscoped, to decide between the `offered` and `unreachable` states of the
|
|
195
231
|
* `omnisearch` mode.
|
|
196
232
|
*/
|
|
197
233
|
probeOmnisearch(signal?: AbortSignal): Promise<boolean>;
|
|
@@ -199,9 +235,11 @@ export declare class ObsidianService {
|
|
|
199
235
|
* Query the Omnisearch HTTP endpoint. Normalizes the response on the way
|
|
200
236
|
* out: decodes HTML entities + `<br>` → `\n` in `excerpt`, renames `path`
|
|
201
237
|
* to `filename`, and drops `vault`. Throws `omnisearch_unreachable`
|
|
202
|
-
* (ServiceUnavailable) on network failures
|
|
203
|
-
*
|
|
204
|
-
*
|
|
238
|
+
* (ServiceUnavailable) on network failures, on a query that outlasts
|
|
239
|
+
* `OBSIDIAN_REQUEST_TIMEOUT_MS`, and on non-2xx responses — the plugin can
|
|
240
|
+
* shut down mid-session (Obsidian quits, plugin disabled), and the tool
|
|
241
|
+
* needs a distinct signal from the upstream's success cases. One attempt,
|
|
242
|
+
* the body read under the same timer as the fetch.
|
|
205
243
|
*/
|
|
206
244
|
searchOmnisearch(ctx: Context, query: string): Promise<OmnisearchHit[]>;
|
|
207
245
|
executeCommand(ctx: Context, commandId: string): Promise<void>;
|