@theronap/agnoclast-mcp 0.9.325 → 0.9.327

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/closeout.mjs CHANGED
@@ -499,7 +499,7 @@ const SERVER_BIN = join(dirname(fileURLToPath(import.meta.url)), '..', 'bin', 'c
499
499
  export async function openTools(sessionId, env = process.env, home = homedir()) {
500
500
  const { token } = resolveTokenSource(env, home)
501
501
  if (!token) throw new Error('no Agnoclast token on this machine')
502
- const transport = new StdioClientTransport({ command: process.execPath, args: [SERVER_BIN], env: { ...edgeSafeEnv(env), CORTEX_TOKEN: token, CLAUDE_CODE_SESSION_ID: sessionId, CORTEX_SUMMARIZING: '1' }, stderr: 'ignore' })
502
+ const transport = new StdioClientTransport({ command: process.execPath, args: [SERVER_BIN], env: { ...edgeSafeEnv(env), CORTEX_TOKEN: token, CLAUDE_CODE_SESSION_ID: sessionId, CORTEX_SUMMARIZING: '1', CORTEX_CLIENT_ROLE: 'closeout' }, stderr: 'ignore' })
503
503
  const client = new Client({ name: 'agnoclast-closeout', version: '1' })
504
504
  await client.connect(transport)
505
505
  return {
package/lib/diagnose.mjs CHANGED
@@ -303,8 +303,12 @@ export function setAiAccount(v) { AI_ACCOUNT = v || null }
303
303
  // say so, and be visible as one, not disguise itself as a script.
304
304
  let CLIENT_ID = 'cortex-mcp/unknown'
305
305
  let CLIENT_VERSION = null
306
+ // The background close-out (closeout.mjs) runs this same server AS the closed session, so its calls carry that
307
+ // session's key on purpose (its log attaches there). It says what it is in the client instead: `+closeout`, a semver
308
+ // build suffix, so every `^cortex-mcp/x.y.z` reader still parses it, and /ops leaves it out of people's usage.
309
+ export const closeoutClientSuffix = (env = process.env) => (env.CORTEX_CLIENT_ROLE === 'closeout' ? '+closeout' : '')
306
310
  export function setClientVersion(version) {
307
- CLIENT_ID = `cortex-mcp/${version || 'unknown'}`
311
+ CLIENT_ID = `cortex-mcp/${version || 'unknown'}${closeoutClientSuffix()}`
308
312
  CLIENT_VERSION = version || null
309
313
  }
310
314
  export const clientVersion = () => CLIENT_VERSION
@@ -6,13 +6,26 @@
6
6
  //
7
7
  // Claim first, as every filer must: a materialize resolves whatever claim is on a unit, so filing an unclaimed one
8
8
  // could close a session's lease. fetchCortex already sends this process's x-cortex-session-key.
9
+ //
10
+ // NOTES. This package's default source is 'handoff', a TRANSCRIPT source, and the materialize route files a
11
+ // transcript only with notes (`notes_required`; two layers on every transcript, Theron 2026-10-08). The caller's
12
+ // `summary` IS the notes. A short note with none is its own gist, so its text is passed as its notes; a long one
13
+ // with none stays sealed and the reply asks for a summary (first live run, Hermes, 2026-11-07).
14
+ export const SHORT_NOTE_CHARS = 2000
15
+
16
+ /** PURE. The notes to file a capture with: the caller's summary, else a short note's own text, else null. */
17
+ export function notesFor({ summary, text }) {
18
+ if (typeof summary === 'string' && summary.trim()) return summary.trim()
19
+ if (typeof text === 'string' && text.trim() && text.trim().length <= SHORT_NOTE_CHARS) return text.trim()
20
+ return null
21
+ }
9
22
 
10
23
  /**
11
24
  * File one sealed capture as a record in `orgId`. `fetchJson(path, body)` POSTs and resolves to
12
25
  * `{ ok: boolean, status: number, body: object|null }`; it must not throw (callers wrap the network).
13
26
  * @returns {Promise<{ ok: true, recordId: string|null } | { ok: false, why: string }>}
14
27
  */
15
- export async function fileSealedCapture(fetchJson, { intakeItemId, orgId, title }) {
28
+ export async function fileSealedCapture(fetchJson, { intakeItemId, orgId, title, summary, text }) {
16
29
  if (!intakeItemId || !orgId) return { ok: false, why: 'the save came back without its unit or brain' }
17
30
  const c = await fetchJson('/api/intake/claim', { claimKind: 'relevance', intakeItemIds: [intakeItemId] })
18
31
  if (!c.ok) return { ok: false, why: `could not hold it to file (${c.body?.error ?? `HTTP ${c.status}`})` }
@@ -23,7 +36,7 @@ export async function fileSealedCapture(fetchJson, { intakeItemId, orgId, title
23
36
  orgId,
24
37
  documentIds: [],
25
38
  // NESTED under `record`: the route ignores a top-level title (see log_session's materialize in server.mjs).
26
- record: title ? { title } : {},
39
+ record: { ...(title ? { title } : {}), ...(notesFor({ summary, text }) ? { summary: notesFor({ summary, text }) } : {}) },
27
40
  attachmentMeta: [],
28
41
  origin: 'session',
29
42
  })
package/lib/server.mjs CHANGED
@@ -4447,7 +4447,7 @@ function renderNudge(payload) {
4447
4447
  } catch (e) {
4448
4448
  return { ok: false, status: 0, body: { error: e.message } }
4449
4449
  }
4450
- }, { intakeItemId: body.intakeItemId, orgId: body.orgId, title })
4450
+ }, { intakeItemId: body.intakeItemId, orgId: body.orgId, title, summary, text })
4451
4451
  if (filed.ok) {
4452
4452
  const lines = [`Captured "${title}" as record ${filed.recordId ?? '(id not returned)'}.`]
4453
4453
  if (body.identifiers?.length || body.routed_by?.length) lines.push(`Routes via: ${(body.routed_by ?? body.identifiers).join(', ')} — it reaches whatever page claims those.`)
@@ -4461,7 +4461,7 @@ function renderNudge(payload) {
4461
4461
  }
4462
4462
  if (body.sealed) {
4463
4463
  const l = [`Stored "${title}" as a SEALED private-intake unit (${body.intakeItemId}).`]
4464
- if (fileFailed) l.push(`Filing it in the same call failed (${fileFailed}). File it with intake_materialize, naming the page it is about.`)
4464
+ if (fileFailed) l.push(`Filing it in the same call failed (${fileFailed}). ${/notes_required/.test(fileFailed) ? 'Capture it again with `summary` (the notes: the gist, decisions, action items), or ' : ''}File it with intake_materialize, naming the page it is about.`)
4465
4465
  l.push('It is NOT a record yet — it becomes one when you materialise it, and only then can it be routed or placed in a container.')
4466
4466
  if (body.duplicate) l.push('This matched an existing unit rather than creating a new one.')
4467
4467
  if (body.routed_by?.length) l.push(`Carries: ${body.routed_by.join(', ')} — it will route on those once materialised.`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/agnoclast-mcp",
3
- "version": "0.9.325",
3
+ "version": "0.9.327",
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": {