@theronap/cortex-mcp 0.9.118 → 0.9.119
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/server.mjs +36 -0
- package/package.json +1 -1
package/lib/server.mjs
CHANGED
|
@@ -1820,6 +1820,42 @@ export async function runServer(version) {
|
|
|
1820
1820
|
},
|
|
1821
1821
|
)
|
|
1822
1822
|
|
|
1823
|
+
server.registerTool(
|
|
1824
|
+
'place_staged_record',
|
|
1825
|
+
{
|
|
1826
|
+
title: 'Place a staged arrival onto pages — the pages decide its brain',
|
|
1827
|
+
description: "Place a STAGED arrival — one that is in no brain at all — onto the pages it belongs to, which is also what decides its brain. Session-start lists these separately as `[staged]`, and they are the only rows route_record CANNOT take, because there is no record yet to route: nothing upstream chose a brain for them, deliberately. That is the point (ADR-0038) — the connector used to pick the brain from which mailbox the message arrived through, which is a fact about your email plumbing rather than about the message, and it decided WHO COULD READ IT before anyone had read it. Here the pages decide instead. ⚠ PLACING IS A DISCLOSURE DECISION, not just filing: a brain is the confidentiality boundary, so putting a staged message into a shared brain makes it readable by every member of that brain. Say so when you offer, and never place a personal message into a shared brain without the owner\'s explicit answer. All the pages must live in ONE brain — a record exists in exactly one — and pages spanning two brains are refused by name rather than resolved by picking. On success the content is replayed through the real ingest pipeline into that brain, so the record it produces is identical to one that had landed there directly, and then it is attached.",
|
|
1828
|
+
inputSchema: {
|
|
1829
|
+
staged_id: z.string().describe('the staged id, as the [staged] rows at session start show it'),
|
|
1830
|
+
pages: z.array(z.string()).describe("pages to place it on — a brain_documents id or the `ref:` read_page prints. They must all be in ONE brain; that brain is where the record lands."),
|
|
1831
|
+
reason: z.string().describe('WHY these pages — recorded with the attachment, and the one thing that cannot be inferred later'),
|
|
1832
|
+
},
|
|
1833
|
+
},
|
|
1834
|
+
async ({ staged_id, pages, reason }) => {
|
|
1835
|
+
let res
|
|
1836
|
+
try {
|
|
1837
|
+
res = await fetchCortex(`${BASE}/api/staged/place`, {
|
|
1838
|
+
method: 'POST',
|
|
1839
|
+
headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
|
|
1840
|
+
body: JSON.stringify({ stagedId: staged_id, documentIds: pages, reason }),
|
|
1841
|
+
})
|
|
1842
|
+
} catch (e) {
|
|
1843
|
+
return toolError(`Could not place the staged record: ${e.message}`)
|
|
1844
|
+
}
|
|
1845
|
+
const out = await res.json().catch(() => null)
|
|
1846
|
+
if (!res.ok && res.status !== 207) {
|
|
1847
|
+
const detail = out?.detail ? `\n${out.detail}` : ''
|
|
1848
|
+
return toolError(`Could not place ${staged_id}: ${out?.error ?? res.status}${detail}`)
|
|
1849
|
+
}
|
|
1850
|
+
// 207 and the no-record branch both mean the content LANDED and the attach did not. Report
|
|
1851
|
+
// that precisely rather than as success or failure — the follow-up differs for each.
|
|
1852
|
+
if (out?.placed === false) {
|
|
1853
|
+
return { content: [{ type: 'text', text: `Promoted into the target brain but NOT attached.\n${out.detail ?? ''}` }] }
|
|
1854
|
+
}
|
|
1855
|
+
return { content: [{ type: 'text', text: `Placed — promoted into its brain and attached to ${out.attached?.length ?? 0} page(s). The pages decided the brain; recorded as a session judgment.` }] }
|
|
1856
|
+
},
|
|
1857
|
+
)
|
|
1858
|
+
|
|
1823
1859
|
server.registerTool(
|
|
1824
1860
|
'set_summary',
|
|
1825
1861
|
{
|
package/package.json
CHANGED