@theronap/cortex-mcp 0.9.111 → 0.9.113

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 +30 -2
  2. package/package.json +1 -1
package/lib/server.mjs CHANGED
@@ -859,7 +859,35 @@ export async function runServer(version) {
859
859
  const body = await res.text()
860
860
  return toolError(body)
861
861
  }
862
- return { content: [{ type: 'text', text: JSON.stringify(await res.json(), null, 2) }] }
862
+ const body = await res.json()
863
+ // WHERE THE SESSION'S OWN WORK LANDED, in words rather than buried in the JSON dump.
864
+ //
865
+ // Three outcomes that look identical in raw JSON and mean completely different things:
866
+ // null the attach THREW — a real failure, and best-effort swallowed it
867
+ // attached: [] the session authored no page in this brain — the ~85% normal case
868
+ // attached: [...] filed under N pages
869
+ //
870
+ // Reporting only a count would make the first indistinguishable from the second, which is how
871
+ // a broken write hides inside a normal-looking result. `undefined` means the server has not
872
+ // shipped this field yet, so nothing is said rather than something wrong.
873
+ const lines = []
874
+ const sa = body?.sessionAttachments
875
+ if (sa === null) {
876
+ lines.push('⚠ Session-page attachment FAILED for this record — it was written, but not filed under the pages this session wrote. Re-run the reconciler.')
877
+ } else if (sa && Array.isArray(sa.attached)) {
878
+ if (sa.attached.length > 0) {
879
+ lines.push(`Filed under ${sa.attached.length} page(s) this session wrote.`)
880
+ } else {
881
+ lines.push('No pages filed: this session authored none in this brain (the normal case).')
882
+ }
883
+ if (sa.droppedCrossBrain > 0) {
884
+ lines.push(`${sa.droppedCrossBrain} page(s) this session wrote live in another brain and were skipped — a record belongs to one brain.`)
885
+ }
886
+ }
887
+ const text = lines.length
888
+ ? `${lines.join('\n')}\n\n${JSON.stringify(body, null, 2)}`
889
+ : JSON.stringify(body, null, 2)
890
+ return { content: [{ type: 'text', text }] }
863
891
  },
864
892
  )
865
893
 
@@ -2514,7 +2542,7 @@ export async function runServer(version) {
2514
2542
  description: 'Attach a pending record to the pages you judge correct — the point of the whole triage path. Use this when you have real context on what the work was; that judgment is better than any rule the webhook could run. Attachments are additive: existing deterministic homes (routing identifiers, your profile) stay. Pass park=true instead when you have looked and there is genuinely no good home — parking beats attaching to a page that merely shares a word.',
2515
2543
  inputSchema: {
2516
2544
  recordId: z.string().describe('record id from pending_records'),
2517
- documentIds: z.array(z.string()).optional().describe('page document ids to attach (from pending_records sweep, or read_page)'),
2545
+ documentIds: z.array(z.string()).optional().describe('pages to attach. Accepts EITHER a brain_documents id (from a pending_records sweep) OR the `ref:` that read_page prints for a page — they are different columns and read_page only ever gives you the second, which is why this used to fail as no_documents on ids that looked perfectly valid. A ref resolves to that node\'s current page, accessible copy first. Anything that resolves to no page in this brain is named back to you rather than silently dropped.'),
2518
2546
  reason: z.string().describe('why these pages — recorded with the attachment'),
2519
2547
  park: z.boolean().optional().describe('no good home exists; leave it alone rather than guessing'),
2520
2548
  tier: z.number().int().optional().describe('2 when this came from the cheap sweep rather than your own context'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.9.111",
3
+ "version": "0.9.113",
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": {