@theronap/cortex-mcp 0.9.111 → 0.9.112

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 +29 -1
  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
 
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.112",
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": {