@theronap/agnoclast-mcp 0.9.337 → 0.9.338
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/imessage_send.mjs +5 -0
- package/lib/locked_tools.mjs +19 -5
- package/lib/server.mjs +8 -2
- package/package.json +1 -1
package/lib/imessage_send.mjs
CHANGED
|
@@ -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 ` +
|
package/lib/locked_tools.mjs
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
114
|
+
return null
|
|
101
115
|
} catch {
|
|
102
|
-
return
|
|
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 ` +
|
|
@@ -6751,9 +6756,10 @@ function renderNudge(payload) {
|
|
|
6751
6756
|
},
|
|
6752
6757
|
async () => {
|
|
6753
6758
|
try {
|
|
6754
|
-
const { waiting, newest, hours_changed } = await tasksCall('?box=count')
|
|
6759
|
+
const { waiting, newest, hours_changed, arrivals } = await tasksCall('?box=count')
|
|
6755
6760
|
const hours = hours_changed ? '\nhours: your person changed your working hours. Call setup_status with runs_unattended true to see them.' : ''
|
|
6756
|
-
|
|
6761
|
+
const arr = arrivals ? `\narrivals: ${arrivals} (mail on threads you sent; read and file them with your Agnoclast arrivals tools)` : ''
|
|
6762
|
+
return { content: [{ type: 'text', text: `waiting: ${waiting}\nnewest: ${newest ?? 'none'}${arr}${hours}` }] }
|
|
6757
6763
|
} catch (e) { return toolError(`Could not count your tasks: ${e.message}`) }
|
|
6758
6764
|
},
|
|
6759
6765
|
)
|
package/package.json
CHANGED