@theronap/cortex-mcp 0.9.54 → 0.9.55
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 +19 -4
- package/package.json +1 -1
package/lib/server.mjs
CHANGED
|
@@ -499,7 +499,15 @@ export async function runServer(version) {
|
|
|
499
499
|
const day = (d) => (d ? String(d).slice(0, 10) : '')
|
|
500
500
|
const renderMatch = (m, tagBrain) => {
|
|
501
501
|
const blocks = m.tiers.map((t) => {
|
|
502
|
-
const secs = (t.sections ?? []).map((s) =>
|
|
502
|
+
const secs = (t.sections ?? []).map((s) => {
|
|
503
|
+
// Undefined is an older-server response during a rolling deploy: do
|
|
504
|
+
// not invent a currency verdict until this server has computed one.
|
|
505
|
+
const currency = s.hasExplicitDate === false
|
|
506
|
+
? '\n⚠ **Undated section — verify before relying on its claims.**\n'
|
|
507
|
+
: ''
|
|
508
|
+
const asOf = s.asOf ? ` · as of ${day(s.asOf)}` : ''
|
|
509
|
+
return `### ${s.heading}${asOf}${currency}${s.body}`
|
|
510
|
+
}).join('\n\n')
|
|
503
511
|
// ADR-0018: a null version isn't "nothing to show" — it means this variant predates content-
|
|
504
512
|
// hash tracking (a 2026-06-29 import scar) and CANNOT be re-authored via base_version until an
|
|
505
513
|
// admin backfills it. Silently omitting the line here is exactly what sent callers into an
|
|
@@ -1375,7 +1383,7 @@ export async function runServer(version) {
|
|
|
1375
1383
|
{
|
|
1376
1384
|
title: 'Authoring context (call before author)',
|
|
1377
1385
|
description:
|
|
1378
|
-
'Fetch the scaffolding to author a Cortex wiki node: the canonical NAMESPACE (
|
|
1386
|
+
'Fetch the scaffolding to author a Cortex wiki node: the canonical NAMESPACE (current node names — link to these with the EXACT name inside [[ ]]), any deliberately RETIRED page names and their successors, and the node-type CONNECTION RULES. ALWAYS call this BEFORE `author` so the page links to current knowledge rather than minting synonyms or reviving a retired page. Reference a node in the namespace as [[Name]]; if you reference something real that is NOT in the namespace, still write [[Name]] — that is a red-link marking a node worth creating. If the page IS about a specific code repo or chat channel, also stamp it once — [[repo:owner/name]] or [[channel:name]] (lowercase, no #) — identifier join keys, not page links.',
|
|
1379
1387
|
inputSchema: {
|
|
1380
1388
|
kind: z.enum(['project', 'person', 'org', 'user']).optional().describe('the node type you are about to author (default project)'),
|
|
1381
1389
|
},
|
|
@@ -1392,12 +1400,17 @@ export async function runServer(version) {
|
|
|
1392
1400
|
const d = classify(res.status, res.headers.get('content-type'), await res.text(), res.headers.get('x-vercel-id'))
|
|
1393
1401
|
return { content: [{ type: 'text', text: `Could not fetch authoring context: ${d.message}` }] }
|
|
1394
1402
|
}
|
|
1395
|
-
const { connectionRules, namespace } = await res.json()
|
|
1403
|
+
const { connectionRules, namespace, retiredLinks } = await res.json()
|
|
1396
1404
|
const ns = Array.isArray(namespace) ? namespace : []
|
|
1397
1405
|
const nsList = ns.map((n) => `[[${n}]]`).join(', ')
|
|
1406
|
+
const retired = Array.isArray(retiredLinks) ? retiredLinks : []
|
|
1407
|
+
const retiredList = retired.length
|
|
1408
|
+
? `\n\nRETIRED PAGES — do not treat these as current or author over them: ${retired.map((r) => `[[${r.name}]] (${r.validity}${r.supersededBy ? ` → [[${r.supersededBy}]]` : ''})`).join(', ')}`
|
|
1409
|
+
: ''
|
|
1398
1410
|
const text =
|
|
1399
1411
|
`Authoring a "${k}" node. Connection rules (kinds of links to look for):\n${connectionRules}\n\n` +
|
|
1400
1412
|
`NAMESPACE — ${ns.length} existing nodes; link with the EXACT name inside [[ ]]:\n${nsList}\n\n` +
|
|
1413
|
+
retiredList +
|
|
1401
1414
|
`Now author the page (summary + sections) with inline [[links]] woven into the prose. Link, do not restate. ` +
|
|
1402
1415
|
`For something real that is not in this namespace, still write [[Name]] (a red-link). Then call \`author\`.`
|
|
1403
1416
|
return { content: [{ type: 'text', text }] }
|
|
@@ -1444,11 +1457,13 @@ export async function runServer(version) {
|
|
|
1444
1457
|
}
|
|
1445
1458
|
const out = await res.json()
|
|
1446
1459
|
const blue = out?.links?.blue ?? 0
|
|
1460
|
+
const retired = out?.links?.retired ?? 0
|
|
1447
1461
|
const red = out?.links?.red ?? 0
|
|
1448
1462
|
const redList = Array.isArray(out?.redLinks) && out.redLinks.length ? `\nRed-links (wanted nodes): ${out.redLinks.map((r) => `[[${r}]]`).join(', ')}` : ''
|
|
1463
|
+
const retiredList = Array.isArray(out?.retiredLinks) && out.retiredLinks.length ? `\nRetired links (not current or wanted): ${out.retiredLinks.map((r) => `[[${r}]]`).join(', ')}` : ''
|
|
1449
1464
|
const stamps = Array.isArray(out?.identifiers) && out.identifiers.length ? `\nIdentifier stamps (join keys): ${out.identifiers.map((i) => `[[${i}]]`).join(', ')}` : ''
|
|
1450
1465
|
const verb = out?.created ? 'Created + authored' : 'Authored'
|
|
1451
|
-
const note = out?.built ? `${verb} "${name}" (${out.built} tier${out.built === 1 ? '' : 's'}). Links: ${blue} resolved, ${red} red.${redList}${stamps}`
|
|
1466
|
+
const note = out?.built ? `${verb} "${name}" (${out.built} tier${out.built === 1 ? '' : 's'}). Links: ${blue} resolved, ${retired} retired, ${red} red.${retiredList}${redList}${stamps}`
|
|
1452
1467
|
: `No change to "${name}"${out?.skipped?.length ? ` (${out.skipped.join(', ')})` : ''}.`
|
|
1453
1468
|
return { content: [{ type: 'text', text: note }] }
|
|
1454
1469
|
},
|