@theronap/agnoclast-mcp 0.9.272 → 0.9.273
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/arrivals_notice.mjs +6 -1
- package/lib/editors/claude.mjs +3 -0
- package/lib/obligations_render.mjs +28 -0
- package/lib/server.mjs +106 -2
- package/package.json +1 -1
package/lib/arrivals_notice.mjs
CHANGED
|
@@ -132,6 +132,11 @@ export function formatPressing(pressing) {
|
|
|
132
132
|
} else if (p?.kind === 'declined') {
|
|
133
133
|
lines.push(`↩ ${who(p.by)} DECLINED ${named(p.text)}: ${named(p.reason)}. It is still yours. (${p.obligationId})`)
|
|
134
134
|
}
|
|
135
|
+
// ADR-0100 — another of the person's own sessions asks THIS session to hand over an obligation it holds.
|
|
136
|
+
// Session business: answer it yourself; mention it to the user only if you cannot tell which is right.
|
|
137
|
+
else if (p?.kind === 'hold_request') {
|
|
138
|
+
lines.push(`🤝 Another of your sessions asks THIS session to hand over ${named(p.text)}${p.note ? ` — its note: ${named(p.note)}` : ''}. If you are not actively on it, hand it over: \`answer_hold_request\` hand_over: true; otherwise hand_over: false and keep it. (${p.obligationId})`)
|
|
139
|
+
}
|
|
135
140
|
// 2026-10-12 — recordings. Nothing arrived for an in-person recording (fix 4), or a meeting unit
|
|
136
141
|
// with a fully deterministic home has waited in intake (fix 5 — a notice; nothing is auto-filed).
|
|
137
142
|
else if (p?.kind === 'meeting_missing') {
|
|
@@ -168,7 +173,7 @@ export function pressingAcks(pressing) {
|
|
|
168
173
|
const out = []
|
|
169
174
|
for (const p of Array.isArray(pressing) ? pressing : []) {
|
|
170
175
|
if (typeof p?.subject !== 'string' || typeof p?.bucket !== 'string') continue
|
|
171
|
-
const handoff = p.kind === 'asked' || p.kind === 'given' || p.kind === 'declined' || p.kind === 'lapsed'
|
|
176
|
+
const handoff = p.kind === 'asked' || p.kind === 'given' || p.kind === 'declined' || p.kind === 'lapsed' || p.kind === 'hold_request'
|
|
172
177
|
|| p.kind === 'meeting_missing' || p.kind === 'meeting_waiting'
|
|
173
178
|
const rollup = (p.kind === 'due_today' || p.kind === 'work_now') && Number(p.count) > 0
|
|
174
179
|
if (p.kind === 'event' || p.kind === 'record_offer' || p.kind === 'due_soon' || handoff || rollup) {
|
package/lib/editors/claude.mjs
CHANGED
|
@@ -51,6 +51,9 @@ export const ALLOWED_TOOL_NAMES = [
|
|
|
51
51
|
'set_page_validity', 'snooze_red_link', 'attribute_thread',
|
|
52
52
|
// clears only the caller's OWN notice that a page was handed to them; the page is already theirs
|
|
53
53
|
'confirm_page_ownership',
|
|
54
|
+
// ADR-0100: which of the caller's OWN sessions is working on one of their obligations. Changes no owner, tier
|
|
55
|
+
// or page, and a prompt on each would make sessions skip the step that stops two of them doing the same work
|
|
56
|
+
'take_obligation', 'release_obligation', 'request_obligation', 'answer_hold_request',
|
|
54
57
|
]
|
|
55
58
|
|
|
56
59
|
// ⚠ DELIBERATELY ABSENT, and not an oversight to be tidied up later: `grant_page_access`,
|
|
@@ -129,6 +129,8 @@ export function renderObligations(obs, now = Date.now(), extras = null) {
|
|
|
129
129
|
// Whose idea it was, and whether it is on its way to someone else. Both change what to DO with it.
|
|
130
130
|
if (o.askedBy) lines.push(` asked for by ${who(o.askedBy)}`)
|
|
131
131
|
if (o.offeredTo) lines.push(` offered to ${who(o.offeredTo)} — waiting for their answer; still yours until they accept`)
|
|
132
|
+
const hold = holdLine(o.hold, o.holdRequest, now)
|
|
133
|
+
if (hold) lines.push(hold)
|
|
132
134
|
// ⚠ EVIDENCE IS RENDERED AS A QUESTION, NEVER AS A VERDICT. The phrasing is the feature:
|
|
133
135
|
// "is this done?" costs the reader a second, "you still owe this" about finished work costs
|
|
134
136
|
// the channel its credibility.
|
|
@@ -162,3 +164,29 @@ function windowNote(workFrom, now) {
|
|
|
162
164
|
if (!workFrom) return ''
|
|
163
165
|
return new Date(workFrom).getTime() <= now ? ` · IN ITS WORK WINDOW since ${String(workFrom).slice(0, 10)}` : ` · work from ${String(workFrom).slice(0, 10)}`
|
|
164
166
|
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* ADR-0100 — which of the person's sessions is working on it. PURE. `now` is ms.
|
|
170
|
+
* A hold is not ownership: it is one of the SAME person's sessions saying "I'm on this".
|
|
171
|
+
*/
|
|
172
|
+
export function holdLine(hold, request, now) {
|
|
173
|
+
if (!hold || typeof hold !== 'object') return null
|
|
174
|
+
const ago = (iso) => {
|
|
175
|
+
const m = Math.max(0, Math.round((now - new Date(iso).getTime()) / 60000))
|
|
176
|
+
return m < 60 ? `${m} min ago` : m < 2880 ? `${Math.round(m / 60)} h ago` : `${Math.round(m / 1440)} days ago`
|
|
177
|
+
}
|
|
178
|
+
const clean = (s, n) => String(s ?? '').replace(/\s+/g, ' ').trim().slice(0, n)
|
|
179
|
+
const note = hold.note ? ` · “${clean(hold.note, 100)}”` : ''
|
|
180
|
+
const where = hold.cwd ? clean(hold.cwd, 80) : 'a session'
|
|
181
|
+
const seen = hold.lastSeen ? `active ${ago(hold.lastSeen)}` : `taken ${ago(hold.heldAt)}`
|
|
182
|
+
let line
|
|
183
|
+
if (hold.mine) line = ` ⛳ held by THIS session${note}`
|
|
184
|
+
else if (hold.status === 'lapsed') line = ` ⛳ last held by ${where}${note}, quiet since ${ago(hold.lastSeen ?? hold.heldAt)} — LAPSED: take_obligation to pick it up`
|
|
185
|
+
else line = ` ⛳ held by another session (${where}${note}), ${seen}${hold.status === 'away' ? ', not running now' : ''} — leave it, or request_obligation`
|
|
186
|
+
if (request) {
|
|
187
|
+
line += request.mine
|
|
188
|
+
? '\n ⏳ you asked for it — waiting on the holding session'
|
|
189
|
+
: `\n 🤝 another session asks for it${request.note ? `: “${clean(request.note, 100)}”` : ''} — answer_hold_request`
|
|
190
|
+
}
|
|
191
|
+
return line
|
|
192
|
+
}
|
package/lib/server.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { runCodeGraphQuery } from './code_graph_cli.mjs'
|
|
|
22
22
|
import { repoFullNameFrom, workingFilesFrom } from './capture.mjs'
|
|
23
23
|
import { findTranscript, createWorkedFilesTracker } from './working_files.mjs'
|
|
24
24
|
import { spawnObligationWorker } from './obligations_worker.mjs'
|
|
25
|
-
import { renderObligations, renderPageObligations, tierReads, who } from './obligations_render.mjs'
|
|
25
|
+
import { renderObligations, renderPageObligations, tierReads, who, holdLine } from './obligations_render.mjs'
|
|
26
26
|
import { renderLeaveQuestion, renderLeft, renderRemovalQuestion, renderRemoved } from './member_remove_render.mjs'
|
|
27
27
|
import { renderSettings } from './settings_render.mjs'
|
|
28
28
|
import { renderConversationOffer, renderMaterializeBatch, renderPreviewBatch } from './intake_batch_render.mjs'
|
|
@@ -3279,9 +3279,10 @@ function renderNudge(payload) {
|
|
|
3279
3279
|
limit: z.number().optional().describe('default 50'),
|
|
3280
3280
|
page: z.string().optional().describe("a page's `ref:` as read_page prints it. Lists EVERYONE's open obligations on that page that the person may see — theirs first, then other people's under each owner's name. Use it when a page read says other people have obligations there and the person asks to see them; seeing one does not make it theirs."),
|
|
3281
3281
|
owed_to: z.string().optional().describe("a person's page `ref:` — only what the person owes THEM (\"what do I owe Tanner?\"), across every page"),
|
|
3282
|
+
unheld: z.boolean().optional().describe('true = leave out what ANOTHER of the person\'s sessions is working on (holds it with take_obligation). "What is nobody on?"'),
|
|
3282
3283
|
},
|
|
3283
3284
|
},
|
|
3284
|
-
async ({ closed, limit, page, owed_to }) => {
|
|
3285
|
+
async ({ closed, limit, page, owed_to, unheld }) => {
|
|
3285
3286
|
let res
|
|
3286
3287
|
if (page) {
|
|
3287
3288
|
try {
|
|
@@ -3296,6 +3297,7 @@ function renderNudge(payload) {
|
|
|
3296
3297
|
if (closed) qs.set('closed', 'true')
|
|
3297
3298
|
if (limit) qs.set('limit', String(limit))
|
|
3298
3299
|
if (owed_to) qs.set('owedTo', owed_to.trim())
|
|
3300
|
+
if (unheld) qs.set('unheld', 'true')
|
|
3299
3301
|
res = await fetchCortex(`${BASE}/api/obligations?${qs}`, { headers: { Authorization: `Bearer ${TOKEN}` } })
|
|
3300
3302
|
} catch (e) { return toolError(`Could not reach obligations: ${e.message}`) }
|
|
3301
3303
|
const out = await res.json().catch(() => null)
|
|
@@ -3305,6 +3307,108 @@ function renderNudge(payload) {
|
|
|
3305
3307
|
},
|
|
3306
3308
|
)
|
|
3307
3309
|
|
|
3310
|
+
// ADR-0100 — one of the person's sessions says "I'm on this". Not ownership: the obligation stays the person's.
|
|
3311
|
+
const holdCall = async (action, body) => {
|
|
3312
|
+
let res
|
|
3313
|
+
try {
|
|
3314
|
+
res = await fetchCortex(`${BASE}/api/obligations/hold`, {
|
|
3315
|
+
method: 'POST',
|
|
3316
|
+
headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
|
|
3317
|
+
body: JSON.stringify({ action, ...body }),
|
|
3318
|
+
})
|
|
3319
|
+
} catch (e) { return { error: `Could not reach obligations: ${e.message}` } }
|
|
3320
|
+
return { status: res.status, out: await res.json().catch(() => null) }
|
|
3321
|
+
}
|
|
3322
|
+
const holdError = (r) => {
|
|
3323
|
+
if (r.error) return toolError(r.error)
|
|
3324
|
+
const e = r.out?.error
|
|
3325
|
+
const by = r.out?.hold ? holdLine(r.out.hold, r.out.request ?? null, Date.now())?.trim() : ''
|
|
3326
|
+
const say = {
|
|
3327
|
+
no_session: 'This client has no session key, so it cannot hold anything. Only a local cortex-mcp session can.',
|
|
3328
|
+
bad_id: 'That is not an obligation id. Use the full id my_obligations prints.',
|
|
3329
|
+
not_found: 'No obligation of yours has that id. List them with my_obligations.',
|
|
3330
|
+
closed: 'It is already discharged or cancelled.',
|
|
3331
|
+
held: `Another session holds it. ${by}\nAsk it with request_obligation; take it with force only if the person says to.`,
|
|
3332
|
+
not_holder: `This session does not hold it. ${by}`,
|
|
3333
|
+
not_held: 'No session holds it.',
|
|
3334
|
+
no_request: 'Nobody has asked for it.',
|
|
3335
|
+
}
|
|
3336
|
+
return toolError(say[e] ?? `Could not do that: ${e ?? r.status}`)
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
server.registerTool(
|
|
3340
|
+
'take_obligation',
|
|
3341
|
+
{
|
|
3342
|
+
title: 'Work on an obligation in this session',
|
|
3343
|
+
description: "Say THIS session is working on one of the person's obligations, so their other sessions see it in my_obligations and leave it alone. Do it when you START work on something the person owes. It is not ownership: the obligation stays theirs, and nothing about who owes it changes. Refused while another session holds it: ask that session with request_obligation instead. A hold lasts while this session runs and while no session runs; it lapses once this session has been gone for 2 hours while another is running. Give it up with release_obligation when you stop; resolve_obligation ends it too.",
|
|
3344
|
+
inputSchema: {
|
|
3345
|
+
obligation_id: z.string().describe('the full id from my_obligations'),
|
|
3346
|
+
note: z.string().optional().describe('what this session is doing about it, in a few words — other sessions see it'),
|
|
3347
|
+
force: z.boolean().optional().describe('take it even though another session holds it. ONLY when the person tells you to.'),
|
|
3348
|
+
},
|
|
3349
|
+
},
|
|
3350
|
+
async ({ obligation_id, note, force }) => {
|
|
3351
|
+
const r = await holdCall('take', { obligationId: obligation_id.trim(), note, force })
|
|
3352
|
+
if (r.error || !r.out?.ok) return holdError(r)
|
|
3353
|
+
const o = r.out
|
|
3354
|
+
const said = {
|
|
3355
|
+
taken: 'This session now holds it.',
|
|
3356
|
+
already_yours: 'This session already holds it.' + (note ? ' Note updated.' : ''),
|
|
3357
|
+
replaced: `This session now holds it, replacing another session's hold.${o.replaced ? ` That was: ${holdLine(o.replaced, null, Date.now())?.trim()}` : ''}`,
|
|
3358
|
+
}
|
|
3359
|
+
return { content: [{ type: 'text', text: `${said[o.outcome] ?? o.outcome} Other sessions now see it as in progress. release_obligation when you stop.` }] }
|
|
3360
|
+
},
|
|
3361
|
+
)
|
|
3362
|
+
|
|
3363
|
+
server.registerTool(
|
|
3364
|
+
'release_obligation',
|
|
3365
|
+
{
|
|
3366
|
+
title: 'Stop working on an obligation in this session',
|
|
3367
|
+
description: "Give up THIS session's hold on an obligation, so another session can pick it up. Use it when you stop working on something without finishing it. It changes nothing else: the obligation stays open and stays the person's. A hold that has lapsed can be released by any session.",
|
|
3368
|
+
inputSchema: { obligation_id: z.string().describe('the full id from my_obligations') },
|
|
3369
|
+
},
|
|
3370
|
+
async ({ obligation_id }) => {
|
|
3371
|
+
const r = await holdCall('release', { obligationId: obligation_id.trim() })
|
|
3372
|
+
if (r.error || !r.out?.ok) return holdError(r)
|
|
3373
|
+
return { content: [{ type: 'text', text: 'Released. No session holds it now; it is still open.' }] }
|
|
3374
|
+
},
|
|
3375
|
+
)
|
|
3376
|
+
|
|
3377
|
+
server.registerTool(
|
|
3378
|
+
'request_obligation',
|
|
3379
|
+
{
|
|
3380
|
+
title: "Ask another session for an obligation it holds",
|
|
3381
|
+
description: "Ask the session holding one of the person's obligations to hand it to THIS session. That session is told on its next prompt and answers with answer_hold_request; see the answer in my_obligations. If nobody holds it, or the hold has lapsed, this simply takes it.",
|
|
3382
|
+
inputSchema: {
|
|
3383
|
+
obligation_id: z.string().describe('the full id from my_obligations'),
|
|
3384
|
+
note: z.string().optional().describe('why this session wants it, in a few words — the holder reads it'),
|
|
3385
|
+
},
|
|
3386
|
+
},
|
|
3387
|
+
async ({ obligation_id, note }) => {
|
|
3388
|
+
const r = await holdCall('request', { obligationId: obligation_id.trim(), note })
|
|
3389
|
+
if (r.error || !r.out?.ok) return holdError(r)
|
|
3390
|
+
if (r.out.outcome !== 'requested') return { content: [{ type: 'text', text: 'Nobody was holding it, so this session now holds it.' }] }
|
|
3391
|
+
return { content: [{ type: 'text', text: `Asked. ${holdLine(r.out.hold, null, Date.now())?.trim() ?? ''}\nIt is still theirs until they answer; my_obligations shows the answer.` }] }
|
|
3392
|
+
},
|
|
3393
|
+
)
|
|
3394
|
+
|
|
3395
|
+
server.registerTool(
|
|
3396
|
+
'answer_hold_request',
|
|
3397
|
+
{
|
|
3398
|
+
title: 'Answer another session asking for an obligation',
|
|
3399
|
+
description: "Another of the person's sessions asked THIS session to hand over an obligation it holds. hand_over true gives the hold to that session; false keeps it here. Hand it over unless this session is actively working on it.",
|
|
3400
|
+
inputSchema: {
|
|
3401
|
+
obligation_id: z.string().describe('the full id from the notice or my_obligations'),
|
|
3402
|
+
hand_over: z.boolean().describe('true = give it to the asking session · false = keep it'),
|
|
3403
|
+
},
|
|
3404
|
+
},
|
|
3405
|
+
async ({ obligation_id, hand_over }) => {
|
|
3406
|
+
const r = await holdCall('answer', { obligationId: obligation_id.trim(), handOver: hand_over })
|
|
3407
|
+
if (r.error || !r.out?.ok) return holdError(r)
|
|
3408
|
+
return { content: [{ type: 'text', text: r.out.outcome === 'handed_over' ? 'Handed over. The asking session holds it now.' : 'Kept. This session still holds it; the request is cleared.' }] }
|
|
3409
|
+
},
|
|
3410
|
+
)
|
|
3411
|
+
|
|
3308
3412
|
server.registerTool(
|
|
3309
3413
|
'track_obligation',
|
|
3310
3414
|
{
|
package/package.json
CHANGED