@theronap/agnoclast-mcp 0.9.280 → 0.9.281

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 +14 -1
  2. package/package.json +1 -1
package/lib/server.mjs CHANGED
@@ -492,6 +492,13 @@ export async function runServer(version) {
492
492
  const takesArgs = !!config?.inputSchema
493
493
  const handle = registerTool(name, config, (...args) => runWithTool(name, async () => {
494
494
  // A tool naming a confidential brain opens it first (the first-touch lock, above).
495
+ // Any call waits for a late lookup: a call naming a brain needs the list, and every call needs the AI-account
496
+ // header and, for a dedicated account, the brain already opened.
497
+ if (!confidentialSettled) await Promise.race([confidentialP, new Promise((r) => setTimeout(r, 20000).unref())])
498
+ if (confidential.dedicatedTo && !lockedInto) {
499
+ const refused = await openConfidential(confidential.dedicatedTo)
500
+ if (refused) return { content: [{ type: 'text', text: refused }], isError: true }
501
+ }
495
502
  const named = confidential.brains.length && takesArgs ? confidentialBrainNamed(confidential.brains, args[0]?.brain) : null
496
503
  if (named) {
497
504
  const refused = await openConfidential(named.name)
@@ -8019,7 +8026,13 @@ function renderNudge(payload) {
8019
8026
 
8020
8027
  applyRelease(toolHandles, await releaseStateWithin(releaseP))
8021
8028
  lockedTools = applyLock(toolHandles, await lockStateWithin(lockP))
8022
- confidential = await Promise.race([confidentialP, new Promise((r) => setTimeout(() => r({ brains: [], dedicatedTo: null }), 5000).unref())])
8029
+ // Bounded so a slow lookup never holds up the handshake — but a lookup that is merely LATE still lands: until it
8030
+ // does, a tool naming a brain waits for it (the wrapper), so a cold start cannot make the confidential brains
8031
+ // look absent and send a request for one on the person's own token, which would lock the session OUT.
8032
+ // (Live 2026-10-29: a cold npx start missed the 5 s window, and the session locked out instead of in.)
8033
+ let confidentialSettled = false
8034
+ confidentialP.then((v) => { confidential = v; confidentialSettled = true })
8035
+ confidential = await Promise.race([confidentialP, new Promise((r) => setTimeout(() => r(confidential), 5000).unref())])
8023
8036
  if (confidential.dedicatedTo) {
8024
8037
  // An AI account dedicated to a confidential brain opens it before any tool runs. If it cannot, it reaches
8025
8038
  // nothing: the server refuses its ordinary token too.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/agnoclast-mcp",
3
- "version": "0.9.280",
3
+ "version": "0.9.281",
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": {