@theronap/agnoclast-mcp 0.9.337 → 0.9.339

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/diagnose.mjs CHANGED
@@ -442,7 +442,10 @@ async function fetchCortexOnce(url, opts = {}, policy = {}) {
442
442
  const { timeoutMs: optTimeout, signal: callerSignal, ...rest } = opts
443
443
  // x-cortex-tool: the tool this request is for (the running one, else the path map) — the server
444
444
  // counts calls per tool for staff usage stats (api_requests). A name only; arguments never travel.
445
- const baseHeaders = { ...(rest.headers ?? {}), 'x-cortex-client': CLIENT_ID, 'x-cortex-tool': toolForUrl(url), ...(AI_ACCOUNT ? { 'x-cortex-ai-account': AI_ACCOUNT } : {}) }
445
+ // x-cortex-host: running inside Claude Code (CLAUDECODE is set in every process it starts). Claude Code's sessions are
446
+ // logged by the close-out, so setup_status leaves out the agent's "Log its own work" step. A hint only: it can only
447
+ // hide a setup step, never grant anything.
448
+ const baseHeaders = { ...(rest.headers ?? {}), 'x-cortex-client': CLIENT_ID, 'x-cortex-tool': toolForUrl(url), ...(AI_ACCOUNT ? { 'x-cortex-ai-account': AI_ACCOUNT } : {}), ...(process.env.CLAUDECODE ? { 'x-cortex-host': 'claude-code' } : {}) }
446
449
  const fetchOpts = SESSION_KEY
447
450
  ? { ...rest, headers: { ...baseHeaders, 'x-cortex-session-key': SESSION_KEY } }
448
451
  : { ...rest, headers: baseHeaders }
@@ -63,6 +63,11 @@ export function textRequestReply(status, body, recipient) {
63
63
  `Text request created to ${recipient}. It is NOT sent yet` + (why ? ` — your approval in chat could not skip the queue: ${why}` : '') + '. ' +
64
64
  `For the person, word for word: It's waiting for your OK: ${reviewUrl}` }
65
65
  }
66
+ if (body?.request?.autoRule === 'always_seat') {
67
+ return { isError: false, text:
68
+ `Approved with no review: the user set this connection to Always send. Their Mac sends it to ${recipient} through ` +
69
+ `Messages the next time it checks in, usually within a minute. Do not send it again.` }
70
+ }
66
71
  if (body?.request?.autoRule === 'trusted_seat') {
67
72
  return { isError: false, text:
68
73
  `Sent on the user's approval in this conversation — nothing to approve. Their Mac sends it to ${recipient} through ` +
@@ -81,11 +81,25 @@ export function applyLock(handles, lock) {
81
81
  return checked
82
82
  }
83
83
 
84
+ /** How long to wait before asking once more when the check could not be made (Muse, 2026-11-11 1:12 AM: three
85
+ * tasks_waiting calls in 26 s all refused because one slow moment on the server made every check fail). */
86
+ export const LOCK_RETRY_DELAY_MS = 1500
87
+
84
88
  /**
85
89
  * POST /api/lite/locked { tool, args } → { run: true } to run the tool as usual, or { run: false, text } to
86
- * answer instead. A check that cannot be made answers LOCK_CHECK_FAILED: nothing runs. Never throws.
90
+ * answer instead. A check that cannot be made is asked ONCE more after LOCK_RETRY_DELAY_MS, and only then answers
91
+ * LOCK_CHECK_FAILED: nothing runs. Still fail-closed, since a Lite account must never run a Regular tool by a timeout.
92
+ * Never throws.
87
93
  */
88
- export async function lockedAnswerFor(base, token, tool, args, fetchImpl) {
94
+ export async function lockedAnswerFor(base, token, tool, args, fetchImpl, retryDelayMs = LOCK_RETRY_DELAY_MS) {
95
+ const first = await lockedAnswerOnce(base, token, tool, args, fetchImpl)
96
+ if (first !== null) return first
97
+ await new Promise((r) => setTimeout(r, retryDelayMs))
98
+ return (await lockedAnswerOnce(base, token, tool, args, fetchImpl)) ?? { run: false, text: LOCK_CHECK_FAILED }
99
+ }
100
+
101
+ /** One ask. Null when the check could not be made (offline, a 5xx, an answer we cannot read). */
102
+ async function lockedAnswerOnce(base, token, tool, args, fetchImpl) {
89
103
  try {
90
104
  const res = await fetchImpl(`${base}/api/lite/locked`, {
91
105
  method: 'POST',
@@ -93,12 +107,12 @@ export async function lockedAnswerFor(base, token, tool, args, fetchImpl) {
93
107
  body: JSON.stringify({ tool, args: args && typeof args === 'object' && !Array.isArray(args) ? args : {} }),
94
108
  }, { skipAutofile: true })
95
109
  if (res.status === 404) return { run: true } // a server that predates locked tools locks nothing
96
- if (!res.ok) return { run: false, text: LOCK_CHECK_FAILED }
110
+ if (!res.ok) return null
97
111
  const j = await res.json()
98
112
  if (j?.locked === false) return { run: true }
99
113
  if (j?.locked === true && typeof j.text === 'string') return { run: false, text: j.text }
100
- return { run: false, text: LOCK_CHECK_FAILED }
114
+ return null
101
115
  } catch {
102
- return { run: false, text: LOCK_CHECK_FAILED }
116
+ return null
103
117
  }
104
118
  }
package/lib/server.mjs CHANGED
@@ -2333,6 +2333,11 @@ function renderNudge(payload) {
2333
2333
  (why ? `(The approval quoted from this conversation could not skip the wait: ${why}.) ` : '') +
2334
2334
  `For the person, word for word: It's waiting for your OK: ${reviewUrl}` }] }
2335
2335
  }
2336
+ if (body?.request?.autoRule === 'always_seat') {
2337
+ return { content: [{ type: 'text', text:
2338
+ `Sent from ${acct} to ${n} recipient${n === 1 ? '' : 's'} with no approval: the user set this connection to Always send. ` +
2339
+ `It has already gone; do not send it again.` }] }
2340
+ }
2336
2341
  if (body?.request?.autoRule === 'trusted_seat') {
2337
2342
  return { content: [{ type: 'text', text:
2338
2343
  `Sent from ${acct} to ${n} recipient${n === 1 ? '' : 's'} on the user's approval in this conversation — there is ` +
@@ -4546,6 +4551,7 @@ function renderNudge(payload) {
4546
4551
  return { content: [{ type: 'text', text: l.join('\n') }] }
4547
4552
  }
4548
4553
  const lines = [`Captured "${title}" as record ${body.id}.`]
4554
+ if (body.note) lines.push(`Note: ${body.note}`)
4549
4555
  // ⚠ AN UNROUTED RECORD IS REPORTED AS SUCH. It was stored, but nothing will find it — reporting
4550
4556
  // that as a plain success is how a record becomes invisible while looking filed.
4551
4557
  if (body.routed_by?.length) lines.push(`Routes via: ${body.routed_by.join(', ')} — it reaches whatever page claims those.`)
@@ -6751,9 +6757,10 @@ function renderNudge(payload) {
6751
6757
  },
6752
6758
  async () => {
6753
6759
  try {
6754
- const { waiting, newest, hours_changed } = await tasksCall('?box=count')
6755
- const hours = hours_changed ? '\nhours: your person changed your working hours. Call setup_status with runs_unattended true to see them.' : ''
6756
- return { content: [{ type: 'text', text: `waiting: ${waiting}\nnewest: ${newest ?? 'none'}${hours}` }] }
6760
+ const { waiting, newest, hours_changed, arrivals } = await tasksCall('?box=count')
6761
+ const hours = hours_changed ? '\nhours: your person set working hours you have not confirmed yet. Call setup_status with runs_unattended true to see them and confirm.' : ''
6762
+ const arr = arrivals ? `\narrivals: ${arrivals} (mail on threads you sent; read and file them with your Agnoclast arrivals tools)` : ''
6763
+ return { content: [{ type: 'text', text: `waiting: ${waiting}\nnewest: ${newest ?? 'none'}${arr}${hours}` }] }
6757
6764
  } catch (e) { return toolError(`Could not count your tasks: ${e.message}`) }
6758
6765
  },
6759
6766
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/agnoclast-mcp",
3
- "version": "0.9.337",
3
+ "version": "0.9.339",
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": {