@theronap/cortex-mcp 0.9.24 → 0.9.25

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.
Files changed (2) hide show
  1. package/lib/server.mjs +5 -4
  2. package/package.json +1 -1
package/lib/server.mjs CHANGED
@@ -276,10 +276,10 @@ export async function runServer(version) {
276
276
  const day = (d) => (d ? String(d).slice(0, 10) : '')
277
277
  const blocks = page.tiers.map((t) => {
278
278
  const secs = (t.sections ?? []).map((s) => `### ${s.heading}\n${s.body}`).join('\n\n')
279
- const head = `[${t.tier}${day(t.updated_at) ? ` · authored ${day(t.updated_at)}` : ''}${t.validity && t.validity !== 'current' ? ` · ${t.validity}` : ''}]`
279
+ const head = `[${t.tier}${day(t.updated_at) ? ` · authored ${day(t.updated_at)}` : ''}${t.validity && t.validity !== 'current' ? ` · ${t.validity}` : ''}${t.version ? `\nversion: ${t.version}` : ''}]`
280
280
  return [head, t.summary, secs].filter(Boolean).join('\n')
281
281
  })
282
- const footer = `— Follow any [[links]] above with read_page to go deeper.\n— If you hold fresher FIRST-HAND truth than this page — something you established THIS session (ran the command, made the change, hold the artifact) that a section here gets concretely wrong — re-author just those sections now with \`author\` (your own nodes; concise; a material contradiction, not merely extra detail). Reading a stale page you can fix IS the trigger to fix it.`
282
+ const footer = `— Follow any [[links]] above with read_page to go deeper.\n— If you hold fresher FIRST-HAND truth than this page — something you established THIS session (ran the command, made the change, hold the artifact) that a section here gets concretely wrong — re-author just those sections now with \`author\` (any node you are permitted to edit; concise; a material contradiction, not merely extra detail). Pass this page's \`version\` as base_version when you re-author — if the save comes back stale, the page changed under you: re-read, then re-author. Reading a stale page you can fix IS the trigger to fix it.`
283
283
  return { content: [{ type: 'text', text: `# ${page.title ?? name} (full authored page)\n\n${blocks.join('\n\n---\n\n')}\n\n${footer}` }] }
284
284
  },
285
285
  )
@@ -627,10 +627,11 @@ export async function runServer(version) {
627
627
  body: z.string().describe('dense markdown WITH inline [[links]] where the prose references another node'),
628
628
  })).describe('3-5 sections; the page body'),
629
629
  tier: z.enum(['accessible', 'scoped', 'confidential']).optional().describe('visibility tier (default accessible — the shareable page)'),
630
+ base_version: z.string().optional().describe('the `version` hash shown when you read this page (read_page) — REQUIRED when updating an existing page, so a concurrent edit is caught instead of clobbered. Omit only for a brand-new node. If the save returns "stale" or "read first", read_page again and retry with the fresh version.'),
630
631
  },
631
632
  },
632
- async ({ kind, name, summary, sections, tier }) => {
633
- const pages = [{ tier: tier ?? 'accessible', summary, sections: Array.isArray(sections) ? sections : [] }]
633
+ async ({ kind, name, summary, sections, tier, base_version }) => {
634
+ const pages = [{ tier: tier ?? 'accessible', summary, base_version, sections: Array.isArray(sections) ? sections : [] }]
634
635
  let res
635
636
  try {
636
637
  res = await fetchCortex(`${BASE}/api/brain/author`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.9.24",
3
+ "version": "0.9.25",
4
4
  "description": "Connect your AI assistant to Cortex — your org's projects, activity, gaps, and directives, scoped to you.",
5
5
  "type": "module",
6
6
  "bin": {