@theronap/agnoclast-mcp 0.9.223 → 0.9.224
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/series_render.mjs +30 -0
- package/lib/server.mjs +39 -0
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// update_series replies — pure, so every rendering has a test. The tool and its engine
|
|
2
|
+
// (web/lib/engine/series_update.ts) exist because a series' container type could only be changed with
|
|
3
|
+
// SQL until 2026-10-08 (Agnoclast page "Agent SQL gap").
|
|
4
|
+
|
|
5
|
+
const OWES = {
|
|
6
|
+
meeting: 'owes a transcript or a note; closes 15 minutes after it ends',
|
|
7
|
+
work_block: 'owes a session in the window; closes when it ends',
|
|
8
|
+
deadline: 'owes the artifact; closes when it is due',
|
|
9
|
+
appointment: 'owes nothing (a class, a visit); admits a transcript or a note',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const line = (s) => `• ${s.title} [${s.seriesKey}] ${s.containerType ?? 'no container (a marker)'}${s.brain ? ` · ${s.brain}` : ''}`
|
|
13
|
+
|
|
14
|
+
/** PATCH /api/series/<ref> 200 → text. */
|
|
15
|
+
export function formatSeriesUpdated(r) {
|
|
16
|
+
if (r.from === r.to) return `${r.series.title} is already ${r.to} — nothing changed.`
|
|
17
|
+
return [
|
|
18
|
+
`${r.series.title} is now ${r.to} (was ${r.from}): ${OWES[r.to] ?? ''}.`,
|
|
19
|
+
`${r.containersRetyped} instance container(s) retyped${r.openContainersRetimed ? `, ${r.openContainersRetimed} still open with their close time recomputed` : ''}; instances made later open as ${r.to}.`,
|
|
20
|
+
'Containers that already closed keep the time they closed at.',
|
|
21
|
+
].join('\n')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A refusal body (404 / 409 / 400) → text that lets the agent pick again. */
|
|
25
|
+
export function formatSeriesRefusal(j) {
|
|
26
|
+
const L = [j?.message ?? j?.error ?? 'Not changed.']
|
|
27
|
+
if (j?.candidates?.length) L.push(j.error === 'ambiguous' ? 'Which one? Pass its key:' : 'Your series:', ...j.candidates.map(line))
|
|
28
|
+
else if (j?.error === 'not_found') L.push('You own no series. (A series is a recurring class or meeting made in Agnoclast.)')
|
|
29
|
+
return L.join('\n')
|
|
30
|
+
}
|
package/lib/server.mjs
CHANGED
|
@@ -28,6 +28,7 @@ import { renderConversationOffer, renderMaterializeBatch } from './intake_batch_
|
|
|
28
28
|
import { obligationsForUnits, renderFilingObligations, filingObligationsBrief, OBLIGATIONS_UNANSWERED_TEXT } from './filing_obligations.mjs'
|
|
29
29
|
import { renderRecord, READ_RECORD_DEFAULT_CHARS, READ_RECORD_PARTS } from './record_render.mjs'
|
|
30
30
|
import { formatCreated, formatDryRun, formatSources, homeFromArgs, pickSource, renderHomeProblem } from './custom_sources.mjs'
|
|
31
|
+
import { formatSeriesRefusal, formatSeriesUpdated } from './series_render.mjs'
|
|
31
32
|
import { formatSends } from './sends_render.mjs'
|
|
32
33
|
|
|
33
34
|
// PAGE tiers (ADR-0071). Six for a PAGE; a RECORD keeps three (`privacy` on log_session and
|
|
@@ -4986,6 +4987,44 @@ function renderNudge(payload) {
|
|
|
4986
4987
|
},
|
|
4987
4988
|
)
|
|
4988
4989
|
|
|
4990
|
+
// update_series — the user-parity sweep, 2026-10-08 (Theron: "things I think are totally working …
|
|
4991
|
+
// that regular users can't do because all of my agents are querying the SQL directly"). A series'
|
|
4992
|
+
// container type could only be changed with owner-connection SQL (2026-09-03, ENT 425). The sweep's
|
|
4993
|
+
// other gap, editing a custom source's mapping, shipped in parallel as set_custom_source_mapping (#1438).
|
|
4994
|
+
// Agnoclast page "Agent SQL gap".
|
|
4995
|
+
server.registerTool(
|
|
4996
|
+
'update_series',
|
|
4997
|
+
{
|
|
4998
|
+
title: 'Change a recurring series\' container type',
|
|
4999
|
+
description: 'Change what a recurring class or meeting series (one made in Agnoclast) COLLECTS and OWES — its container type — for the whole series: the series itself and the container of every instance already made. meeting = owes a transcript or a note · work_block = owes a work session in the window · deadline = owes the artifact · appointment = owes nothing (a class, a visit) and still admits a transcript or a note. Use it when a series was typed wrong, e.g. a 3-hour lecture typed work_block, which flags every class as "nothing happened". Containers that already closed keep their close time. Name the series by its exact title, its key, or its id; an unknown or ambiguous name answers with your series to choose from.',
|
|
5000
|
+
inputSchema: {
|
|
5001
|
+
series: z.string().describe('the series — its exact title ("ENT 425"), its key (with or without "series:"), or its id'),
|
|
5002
|
+
container_type: z.enum(['meeting', 'work_block', 'deadline', 'appointment']).describe('what it should collect and owe'),
|
|
5003
|
+
},
|
|
5004
|
+
},
|
|
5005
|
+
async ({ series, container_type }) => {
|
|
5006
|
+
const ref = String(series).trim().replace(/^series:/i, '')
|
|
5007
|
+
let res
|
|
5008
|
+
try {
|
|
5009
|
+
res = await fetchCortex(`${BASE}/api/series/${encodeURIComponent(ref)}`, {
|
|
5010
|
+
method: 'PATCH',
|
|
5011
|
+
headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
|
|
5012
|
+
body: JSON.stringify({ containerType: container_type }),
|
|
5013
|
+
})
|
|
5014
|
+
} catch (e) {
|
|
5015
|
+
return toolError(`Not changed: ${e.message}`)
|
|
5016
|
+
}
|
|
5017
|
+
if (!res.ok) {
|
|
5018
|
+
const body = await res.text()
|
|
5019
|
+
let j = null
|
|
5020
|
+
try { j = JSON.parse(body) } catch { /* not JSON */ }
|
|
5021
|
+
if (j && [400, 404, 409].includes(res.status)) return toolError(formatSeriesRefusal(j))
|
|
5022
|
+
return toolError(`Not changed: ${classify(res.status, res.headers.get('content-type'), body, res.headers.get('x-vercel-id')).message}`)
|
|
5023
|
+
}
|
|
5024
|
+
return { content: [{ type: 'text', text: formatSeriesUpdated(await res.json()) }] }
|
|
5025
|
+
},
|
|
5026
|
+
)
|
|
5027
|
+
|
|
4989
5028
|
server.registerTool(
|
|
4990
5029
|
'my_day',
|
|
4991
5030
|
{
|
package/package.json
CHANGED