@theronap/agnoclast-mcp 0.9.269 → 0.9.271
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/lib/found_documents.mjs +17 -0
- package/lib/release_gate.mjs +1 -1
- package/lib/server.mjs +35 -2
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// find_documents' answer (file browser, Theron 2026-10-27): every stored file the caller can see, one block
|
|
2
|
+
// per file — its page (a file's page is its folder) and brain, and why it matched a search.
|
|
3
|
+
|
|
4
|
+
const TYPE_NAMES = { sheet: 'spreadsheet', doc: 'Word', text: 'text', other: 'other' }
|
|
5
|
+
|
|
6
|
+
export function formatFoundDocuments(out, query) {
|
|
7
|
+
const files = out?.files ?? []
|
|
8
|
+
if (!files.length) return query ? `No stored file you can see matches "${query}".` : 'There are no stored files you can see yet.'
|
|
9
|
+
const lines = [`${files.length} stored file${files.length === 1 ? '' : 's'}${query ? ` matching "${query}"` : ''}${out.truncated ? ' (more not shown — narrow the search or raise limit)' : ''}, newest first:`]
|
|
10
|
+
for (const f of files) {
|
|
11
|
+
lines.push(`${f.pinned ? '📌' : '-'} "${f.title}" — id ${f.id} · ${TYPE_NAMES[f.type] ?? f.type} · v${f.version} · ${Math.round(f.sizeBytes / 1024)} KB · ${String(f.updatedAt).slice(0, 10)}${f.updatedBy ? ` by ${f.updatedBy}` : ''}${f.readable === 'ok' ? '' : ' · not readable as text'}`)
|
|
12
|
+
lines.push(` on ${f.page ? `"${f.page.title ?? 'untitled page'}"` : 'no page (its page was deleted)'} · ${f.brain.name}`)
|
|
13
|
+
if (f.match?.in === 'text' && f.match.snippet) lines.push(` matched inside: "${f.match.snippet}"`)
|
|
14
|
+
else if (f.match?.in === 'page') lines.push(' matched its page\'s title')
|
|
15
|
+
}
|
|
16
|
+
return lines.join('\n')
|
|
17
|
+
}
|
package/lib/release_gate.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// that web/lib/engine/release.test.ts pins to the server's registry.
|
|
6
6
|
|
|
7
7
|
/** Tools any release flag gates — hidden when the server cannot be asked. Mirror of allGatedTools(). */
|
|
8
|
-
export const GATED_FALLBACK = ['attach_document', 'document_diff', 'export_page', 'get_document', 'import_document_as_page', 'intake_shadow', 'list_documents', 'my_messages', 'pin_document', 'read_conversation', 'read_document', 'send_message', 'set_manager', 'upload_document_version']
|
|
8
|
+
export const GATED_FALLBACK = ['attach_document', 'document_diff', 'export_page', 'find_documents', 'get_document', 'import_document_as_page', 'intake_shadow', 'list_documents', 'my_messages', 'pin_document', 'read_conversation', 'read_document', 'send_message', 'set_manager', 'upload_document_version']
|
|
9
9
|
|
|
10
10
|
export const RELEASE_FETCH_TIMEOUT_MS = 2500
|
|
11
11
|
|
package/lib/server.mjs
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
renderSeriesCreated, renderUpcoming, resolveEventTimes, resolveSeriesPlacement, seriesRequestBody, updateEventBody,
|
|
43
43
|
UPDATE_EVENT_DESCRIPTION, UPDATE_SERIES_DESCRIPTION, renderEventCancelled, renderSeriesRevised, seriesPatchBody,
|
|
44
44
|
} from './calendar_events.mjs'
|
|
45
|
+
import { formatFoundDocuments } from './found_documents.mjs'
|
|
45
46
|
|
|
46
47
|
// PAGE tiers (ADR-0071). Six for a PAGE; a RECORD keeps three (`privacy` on log_session and
|
|
47
48
|
// set_record_privacy below) — an owner-relative tier is applied to a page's records when they are read
|
|
@@ -7328,6 +7329,37 @@ function renderNudge(payload) {
|
|
|
7328
7329
|
},
|
|
7329
7330
|
)
|
|
7330
7331
|
|
|
7332
|
+
server.registerTool(
|
|
7333
|
+
'find_documents',
|
|
7334
|
+
{
|
|
7335
|
+
title: 'Find stored files you can see',
|
|
7336
|
+
description: 'Search every file kept in Agnoclast that you can see, across all pages and brains — no page needed. Matches the file name, the page it lives on, or the words inside it (a match inside the file shows the words around it). Newest first; filter by type, brain, page, pinned, or changed since. Each file names its page (a file\'s page is its folder) and brain. Then read_document to read one, document_diff to see what changed, get_document to download it. list_documents is the one-page view.',
|
|
7337
|
+
inputSchema: {
|
|
7338
|
+
query: z.string().optional().describe('words to find in the file name, its page\'s title, or the text inside the file'),
|
|
7339
|
+
type: z.enum(['sheet', 'doc', 'text', 'other']).optional().describe('sheet = Excel/spreadsheet, doc = Word, text = CSV/plain text'),
|
|
7340
|
+
brain: z.string().optional().describe('only this brain (its name or id)'),
|
|
7341
|
+
page: z.string().optional().describe('only files on this page (a document id)'),
|
|
7342
|
+
pinned: z.boolean().optional().describe('true = pinned files only'),
|
|
7343
|
+
changed_since: z.string().optional().describe('ISO date: only files with a version at or after it'),
|
|
7344
|
+
limit: z.number().int().min(1).max(500).optional().describe('default 50'),
|
|
7345
|
+
},
|
|
7346
|
+
},
|
|
7347
|
+
async ({ query, type, brain, page, pinned, changed_since, limit }) => {
|
|
7348
|
+
const q = new URLSearchParams({ limit: String(limit ?? 50) })
|
|
7349
|
+
if (query) q.set('q', query)
|
|
7350
|
+
if (type) q.set('type', type)
|
|
7351
|
+
if (brain) q.set('brain', brain)
|
|
7352
|
+
if (page) q.set('page', page)
|
|
7353
|
+
if (pinned !== undefined) q.set('pinned', String(pinned))
|
|
7354
|
+
if (changed_since) q.set('since', changed_since)
|
|
7355
|
+
let res
|
|
7356
|
+
try { res = await fetchCortex(`${BASE}/api/stored-files/browse?${q}`, { headers: { Authorization: `Bearer ${TOKEN}` } }) }
|
|
7357
|
+
catch (e) { return toolError(`Could not search files: ${e.message}`) }
|
|
7358
|
+
if (!res.ok) return docFail('search files', res)
|
|
7359
|
+
return { content: [{ type: 'text', text: formatFoundDocuments(await res.json(), query) }] }
|
|
7360
|
+
},
|
|
7361
|
+
)
|
|
7362
|
+
|
|
7331
7363
|
server.registerTool(
|
|
7332
7364
|
'read_document',
|
|
7333
7365
|
{
|
|
@@ -7450,7 +7482,7 @@ function renderNudge(payload) {
|
|
|
7450
7482
|
'import_document_as_page',
|
|
7451
7483
|
{
|
|
7452
7484
|
title: 'Turn a stored Word document into a page',
|
|
7453
|
-
description: 'Convert a stored .docx into an editable wiki page — headings become sections, lists/tables/bold/links survive, images are left out (the original keeps them). The new page is created at the same visibility as the file\'s current page, the .docx moves onto
|
|
7485
|
+
description: 'Convert a stored .docx into an editable wiki page — headings become sections, lists/tables/bold/links survive, images are left out (the original keeps them). The new page is created at the same visibility as the file\'s current page, links back to it, and the old page gets one line linking forward. The .docx moves onto the new page, pinned, and the two are KEPT IN STEP: a save of the Word file rewrites the page, and a page edit rebuilds the Word file the next time it is opened (never overwriting when both changed — the page then says so). Needs edit access to the file\'s page. Afterwards, link the new page to the people, classes or projects it is about with edit_page.',
|
|
7454
7486
|
inputSchema: {
|
|
7455
7487
|
file_id: z.string().describe('the stored file\'s id (from list_documents or read_page\'s 📌/📎 lines)'),
|
|
7456
7488
|
title: z.string().optional().describe('the new page\'s name; default the file\'s title'),
|
|
@@ -7471,7 +7503,8 @@ function renderNudge(payload) {
|
|
|
7471
7503
|
if (o.shortenedHeadings) lines.push(`${o.shortenedHeadings} heading${o.shortenedHeadings === 1 ? ' was' : 's were'} over 80 characters and shortened.`)
|
|
7472
7504
|
if (o.splitSections) lines.push(`${o.splitSections} very long section${o.splitSections === 1 ? ' was' : 's were'} split into parts.`)
|
|
7473
7505
|
lines.push(o.linkedFromOldPage ? 'The old page now links to it.' : 'The old page could not be given a link line; add one with edit_page if it matters.')
|
|
7474
|
-
lines.push(
|
|
7506
|
+
lines.push('The page and the Word file are now kept in step — a save of either updates the other.')
|
|
7507
|
+
lines.push(`Next: read_page "${o.title}" and link it to the people, classes or projects it is about with edit_page.`)
|
|
7475
7508
|
return { content: [{ type: 'text', text: lines.join('\n') }] }
|
|
7476
7509
|
},
|
|
7477
7510
|
)
|
package/package.json
CHANGED