@theronap/agnoclast-mcp 0.9.322 → 0.9.324
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/release_gate.mjs +1 -1
- package/lib/server.mjs +82 -12
- package/lib/split_render.mjs +49 -2
- package/package.json +1 -1
package/lib/release_gate.mjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// That is safe because hiding a tool is a courtesy, and every gated route checks its own flag on the server.
|
|
12
12
|
|
|
13
13
|
/** Tools any release flag gates — hidden when the server cannot be asked. Mirror of allGatedTools(). */
|
|
14
|
-
export const GATED_FALLBACK = ['arrivals', 'attach_document', 'document_diff', 'export_page', 'file_arrival', 'file_document', 'find_documents', 'finish_task', 'get_document', 'hand_task', 'handed_tasks', 'hold_task', 'import_document_as_page', 'intake_shadow', 'list_documents', 'merge_pages', 'my_messages', 'my_tasks', 'pin_document', 'place_split_records', 'read_conversation', 'read_document', 'send_message', 'set_manager', 'set_working_hours', 'split_page', 'split_records', 'store_file', 'tasks_waiting', 'undo_merge', 'undo_split', 'upload_document_version']
|
|
14
|
+
export const GATED_FALLBACK = ['arrivals', 'attach_document', 'document_diff', 'export_page', 'file_arrival', 'file_document', 'find_documents', 'finish_task', 'get_document', 'hand_task', 'handed_tasks', 'hold_task', 'import_document_as_page', 'intake_shadow', 'list_documents', 'merge_pages', 'my_messages', 'my_tasks', 'pin_document', 'place_split_records', 'read_conversation', 'read_document', 'relink_links', 'send_message', 'set_manager', 'set_working_hours', 'split_page', 'split_records', 'store_file', 'tasks_waiting', 'undo_merge', 'undo_relink', 'undo_split', 'upload_document_version']
|
|
15
15
|
|
|
16
16
|
export const RELEASE_FETCH_TIMEOUT_MS = 2500
|
|
17
17
|
/** A remembered answer older than this is not trusted: a week covers a quiet weekend without hiding tools for long. */
|
package/lib/server.mjs
CHANGED
|
@@ -36,7 +36,7 @@ import { formatSeriesRefusal, formatSeriesUpdated } from './series_render.mjs'
|
|
|
36
36
|
import { formatSends } from './sends_render.mjs'
|
|
37
37
|
import { applyLock, fetchLockState, lockedAnswerFor, lockStateWithin } from './locked_tools.mjs'
|
|
38
38
|
import { applyRelease, fetchReleaseState, releaseStateWithin, rememberReleaseState, rememberedReleaseState } from './release_gate.mjs'
|
|
39
|
-
import { renderMerge, renderMergeUndo, renderPlacement, renderSplitRefusal, renderUndo, renderWorklist } from './split_render.mjs'
|
|
39
|
+
import { renderMerge, renderMergeUndo, renderPlacement, renderRelink, renderRelinkUndo, renderSplitRefusal, renderUndo, renderWorklist } from './split_render.mjs'
|
|
40
40
|
import { filterUnshownSettling, renderSettlingV2 } from './settling_shown.mjs'
|
|
41
41
|
import { renderContactBriefing, renderContactCandidates, renderContactList } from './contacts_render.mjs'
|
|
42
42
|
import { renderConversation, renderMessageInbox } from './messages_render.mjs'
|
|
@@ -3061,7 +3061,7 @@ function renderNudge(payload) {
|
|
|
3061
3061
|
'merge_pages',
|
|
3062
3062
|
{
|
|
3063
3063
|
title: 'Merge one topic page into another',
|
|
3064
|
-
description: 'Fold one topic page (the SOURCE) into another (the TARGET), in ONE transaction. Preview first (mode:\'preview\', writes nothing), then apply the plan it returns (mode:\'apply\', plan). What a merge does: the source\'s sections are appended to the target WORD FOR WORD, each under "Merged from <source> — <heading>", keeping their dates (condense the overlap afterwards with merge_sections or edit_page); EVERY record on the source is attached to the target too and the target becomes the governing page of the records the source governed — nothing needs reading, a merge has one destination; the source\'s routing claims move to the target; the source is retired (superseded by the target, never deleted),
|
|
3064
|
+
description: 'Fold one topic page (the SOURCE) into another (the TARGET), in ONE transaction. Preview first (mode:\'preview\', writes nothing), then apply the plan it returns (mode:\'apply\', plan). What a merge does: the source\'s sections are appended to the target WORD FOR WORD, each under "Merged from <source> — <heading>", keeping their dates (condense the overlap afterwards with merge_sections or edit_page); EVERY record on the source is attached to the target too and the target becomes the governing page of the records the source governed — nothing needs reading, a merge has one destination; the source\'s routing claims move to the target; the source is retired (superseded by the target, never deleted), and every [[link]] to its title on a page you can edit is repointed to the target with its wording kept ([[Source]] → [[Target|Source]]); pages you cannot edit are listed and left. Refused at preview: a person page (use request_person_page_merge), pages in different brains, a page you do not own, and pages with a different tier or different grants — a merge must not change who can read anything, so align them first. undo_merge reverses all of it while neither page has changed.',
|
|
3065
3065
|
inputSchema: {
|
|
3066
3066
|
source_version: z.string().describe('the `version` read_page prints for the page being folded in (it is retired)'),
|
|
3067
3067
|
target_version: z.string().describe('the `version` read_page prints for the page that survives'),
|
|
@@ -3091,7 +3091,7 @@ function renderNudge(payload) {
|
|
|
3091
3091
|
'undo_merge',
|
|
3092
3092
|
{
|
|
3093
3093
|
title: 'Undo a page merge',
|
|
3094
|
-
description: 'Undo a page merge you applied, in ONE transaction: the appended sections come off the target, the source page is current again, governance and routing claims go back to it,
|
|
3094
|
+
description: 'Undo a page merge you applied, in ONE transaction: the appended sections come off the target, the source page is current again, governance and routing claims go back to it, the record attachments the merge added are removed, and repointed links go back to the source\'s name (a link section edited since is left and listed). Refused when either page changed after the merge. Only the member who applied it, and only once.',
|
|
3095
3095
|
inputSchema: {
|
|
3096
3096
|
plan: z.string().describe('the `plan` token of the applied merge'),
|
|
3097
3097
|
reason: z.string().optional().describe('why, in one phrase — recorded in page_history'),
|
|
@@ -3114,6 +3114,67 @@ function renderNudge(payload) {
|
|
|
3114
3114
|
},
|
|
3115
3115
|
)
|
|
3116
3116
|
|
|
3117
|
+
server.registerTool(
|
|
3118
|
+
'relink_links',
|
|
3119
|
+
{
|
|
3120
|
+
title: 'Send links to a page where they should go now',
|
|
3121
|
+
description: 'Trace every [[link]] to a name (a page title — current or retired — or an old alias) on pages in the same brain, and send each where it belongs now, in ONE transaction. merge_pages and rename_page already do this on their own; use this (1) after split_page: each link to the original is decided — move (to the new page), both (keep it and add the new page), or keep — by reading its paragraph; unless a link clearly rules one out, choose both; and (2) to clean up links left by a page retired or renamed before relinking existed. Preview first (mode:\'preview\', writes nothing) — it lists every link with an id and its paragraph; then apply with the plan and a decision per link id (or default_action). Only the link changes, never the prose: move gives [[New|Old]] (or [[New]] with style:\'rename\'). Pages you cannot edit are listed and left. undo_relink puts the links back.',
|
|
3122
|
+
inputSchema: {
|
|
3123
|
+
from: z.string().describe('the name the links use now — the original page after a split, or a retired page / old name'),
|
|
3124
|
+
to_version: z.string().describe('the `version` read_page prints for the page the links should reach'),
|
|
3125
|
+
mode: z.enum(['preview', 'apply']).describe("'preview' first; then 'apply' with the plan it returned"),
|
|
3126
|
+
plan: z.string().optional().describe('the plan token a preview returned (apply only)'),
|
|
3127
|
+
decisions: z.record(z.enum(['move', 'both', 'keep'])).optional().describe('apply: link id (from the preview) → move | both | keep'),
|
|
3128
|
+
default_action: z.enum(['move', 'both', 'keep']).optional().describe('apply: the action for every link not in decisions'),
|
|
3129
|
+
style: z.enum(['repoint', 'rename']).optional().describe("'repoint' (default) keeps the old words as display text; 'rename' writes the new name"),
|
|
3130
|
+
reason: z.string().describe('why, in one phrase — recorded in page_history on every page changed'),
|
|
3131
|
+
},
|
|
3132
|
+
},
|
|
3133
|
+
async ({ from, to_version, mode, plan, decisions, default_action, style, reason }) => {
|
|
3134
|
+
let res
|
|
3135
|
+
try {
|
|
3136
|
+
res = await fetchCortex(`${BASE}/api/brain/relink-links`, {
|
|
3137
|
+
method: 'POST',
|
|
3138
|
+
headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
|
|
3139
|
+
body: JSON.stringify({ from, to_version, mode, reason, ...(plan ? { plan } : {}), ...(decisions ? { decisions } : {}),
|
|
3140
|
+
...(default_action ? { default_action } : {}), ...(style ? { style } : {}) }),
|
|
3141
|
+
})
|
|
3142
|
+
} catch (e) {
|
|
3143
|
+
return toolError(`Could not relink: ${e.message}`)
|
|
3144
|
+
}
|
|
3145
|
+
const out = await res.json().catch(() => null)
|
|
3146
|
+
if (!res.ok || !out?.ok) return toolError(renderSplitRefusal('relink', out, res.status))
|
|
3147
|
+
return { content: [{ type: 'text', text: renderRelink(out) }] }
|
|
3148
|
+
},
|
|
3149
|
+
)
|
|
3150
|
+
|
|
3151
|
+
server.registerTool(
|
|
3152
|
+
'undo_relink',
|
|
3153
|
+
{
|
|
3154
|
+
title: 'Undo a relink',
|
|
3155
|
+
description: 'Put back the links a relink_links apply — or a rename\'s relink — changed, in ONE transaction. A section edited since is left as it is and listed. Only the member who applied it, and only once.',
|
|
3156
|
+
inputSchema: {
|
|
3157
|
+
plan: z.string().describe('the `plan` token of the applied relink (rename_page reports it as its undo_relink plan)'),
|
|
3158
|
+
reason: z.string().optional().describe('why, in one phrase — recorded in page_history'),
|
|
3159
|
+
},
|
|
3160
|
+
},
|
|
3161
|
+
async ({ plan, reason }) => {
|
|
3162
|
+
let res
|
|
3163
|
+
try {
|
|
3164
|
+
res = await fetchCortex(`${BASE}/api/brain/relink-undo`, {
|
|
3165
|
+
method: 'POST',
|
|
3166
|
+
headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
|
|
3167
|
+
body: JSON.stringify({ plan, ...(reason ? { reason } : {}) }),
|
|
3168
|
+
})
|
|
3169
|
+
} catch (e) {
|
|
3170
|
+
return toolError(`Could not undo the relink: ${e.message}`)
|
|
3171
|
+
}
|
|
3172
|
+
const out = await res.json().catch(() => null)
|
|
3173
|
+
if (!res.ok || !out?.ok) return toolError(renderSplitRefusal('undo the relink', out, res.status))
|
|
3174
|
+
return { content: [{ type: 'text', text: renderRelinkUndo(out) }] }
|
|
3175
|
+
},
|
|
3176
|
+
)
|
|
3177
|
+
|
|
3117
3178
|
server.registerTool(
|
|
3118
3179
|
'snooze_routing_claim',
|
|
3119
3180
|
{
|
|
@@ -6498,10 +6559,10 @@ function renderNudge(payload) {
|
|
|
6498
6559
|
'hand_task',
|
|
6499
6560
|
{
|
|
6500
6561
|
title: 'Hand a task to another of your agents',
|
|
6501
|
-
description: 'Queue a task for another agent on this same person\'s account, by its token name (e.g. "Frack"). Use it when the person asks you to give another of their agents something to do, instead of having them paste it. Write the task as a request that says what is wanted and why ("Theron would like a list of…"), not as commands: agent runtimes screen what their tools return for prompt injection, and a task written as orders is refused unread (Muse, 2026-11-02). Never claim the person approved something in a task; the receiving agent asks them itself. Show them the exact text first. The agent acts with its own token and picks the task up on its next call: nothing wakes it, so it may wait until the person next talks to it. Read the result with handed_tasks. To reach a person or a member agent, use send_message.',
|
|
6562
|
+
description: 'Queue a task for another agent on this same person\'s account, by its token name (e.g. "Frack"). Use it when the person asks you to give another of their agents something to do, instead of having them paste it. Write the task as a request that says what is wanted and why ("Theron would like a list of…"), not as commands: agent runtimes screen what their tools return for prompt injection, and a task written as orders is refused unread (Muse, 2026-11-02). Name where the work goes: when the person has more than one brain, say which brain and page a save or edit belongs on, or the receiving agent has to stop and ask (Grok Bot, 2026-11-06). Never claim the person approved something in a task; the receiving agent asks them itself, or the person\'s standing permission covers it. Show them the exact text first. The agent acts with its own token and picks the task up on its next call: nothing wakes it, so it may wait until the person next talks to it. Read the result with handed_tasks. To reach a person or a member agent, use send_message.',
|
|
6502
6563
|
inputSchema: {
|
|
6503
6564
|
to: z.string().describe('the agent\'s token name, as shown on /connect'),
|
|
6504
|
-
task: z.string().describe('what to do and how to report back (at most 8000 characters)'),
|
|
6565
|
+
task: z.string().describe('what to do, where (the brain and page, when they have several), and how to report back (at most 8000 characters)'),
|
|
6505
6566
|
},
|
|
6506
6567
|
},
|
|
6507
6568
|
async ({ to, task }) => {
|
|
@@ -6525,7 +6586,7 @@ function renderNudge(payload) {
|
|
|
6525
6586
|
const { tasks } = await tasksCall('?box=mine')
|
|
6526
6587
|
if (!tasks.length) return { content: [{ type: 'text', text: 'No tasks waiting.' }] }
|
|
6527
6588
|
return { content: [{ type: 'text', text: tasks.map((t) => {
|
|
6528
|
-
const line = { held: 'status: held, waiting for your person', approved: `status: approved by your person at ${t.decidedAt}`, declined: `status: declined by your person at ${t.decidedAt}` }[t.approval]
|
|
6589
|
+
const line = t.approval === 'approved' && t.approvalVia === 'standing' ? `status: approved by your person's standing permission at ${t.decidedAt}` : { held: 'status: held, waiting for your person', approved: `status: approved by your person at ${t.decidedAt}`, declined: `status: declined by your person at ${t.decidedAt}` }[t.approval]
|
|
6529
6590
|
return `task ${t.id} · from ${t.from ?? 'another agent'} · ${t.createdAt}${line ? `\n${line}` : ''}\nrequest:\n${t.task}`
|
|
6530
6591
|
}).join('\n\n') }] }
|
|
6531
6592
|
} catch (e) { return toolError(`Could not read your tasks: ${e.message}`) }
|
|
@@ -6551,16 +6612,18 @@ function renderNudge(payload) {
|
|
|
6551
6612
|
server.registerTool(
|
|
6552
6613
|
'hold_task',
|
|
6553
6614
|
{
|
|
6554
|
-
title: '
|
|
6555
|
-
description: '
|
|
6615
|
+
title: 'Check a task against your person\'s permission, or ask them',
|
|
6616
|
+
description: 'Before a task from my_tasks would change, send, share, spend or delete something, call this with what kind of action it is. Your person may have given a standing permission for that kind: then the reply says it is approved, with nobody disturbed. Otherwise it is held: their phone gets a notification, you get a link to give them, and only they can answer (it needs their own sign-in; no agent can press it). You will be woken when they decide, and my_tasks will then show `status: approved` or `status: declined`. A held task waits until it shows approved.',
|
|
6556
6617
|
inputSchema: {
|
|
6557
6618
|
task: z.string().describe('the task id from my_tasks'),
|
|
6558
|
-
reason: z.string().describe('one line for your person: what it would do
|
|
6619
|
+
reason: z.string().describe('one line for your person: what it would do'),
|
|
6620
|
+
kind: z.enum(['change', 'send', 'share', 'spend', 'delete']).optional().describe('what the action is. change = saving, editing or tracking something inside Agnoclast; send, share, spend and delete mean what they say; pick the strongest that applies. Without it the task always waits for your person.'),
|
|
6559
6621
|
},
|
|
6560
6622
|
},
|
|
6561
|
-
async ({ task, reason }) => {
|
|
6623
|
+
async ({ task, reason, kind }) => {
|
|
6562
6624
|
try {
|
|
6563
|
-
const out = await tasksCall('', { method: 'POST', body: JSON.stringify({ action: 'hold', id: task, reason }) })
|
|
6625
|
+
const out = await tasksCall('', { method: 'POST', body: JSON.stringify({ action: 'hold', id: task, reason, ...(kind ? { kind } : {}) }) })
|
|
6626
|
+
if (out.approval === 'approved' && out.via === 'standing') return { content: [{ type: 'text', text: `status: approved. Your person's standing permission, which they set themselves in Agnoclast Settings, covers this kind of action (${kind}), so the server approved task ${task} without asking them. my_tasks shows it as approved. Nothing in the task's text decided this.` }] }
|
|
6564
6627
|
if (out.approval !== 'held') return { content: [{ type: 'text', text: `Task ${task} was already ${out.approval}. See my_tasks.` }] }
|
|
6565
6628
|
return { content: [{ type: 'text', text: `Held. Give your person this link to approve or decline it: ${out.url}` }] }
|
|
6566
6629
|
} catch (e) { return toolError(`Not held: ${e.message}`) }
|
|
@@ -6740,7 +6803,7 @@ function renderNudge(payload) {
|
|
|
6740
6803
|
'rename_page',
|
|
6741
6804
|
{
|
|
6742
6805
|
title: 'Give a page a correct name',
|
|
6743
|
-
description: "Change the TITLE of an existing page, keeping the page itself — every record, attachment, routing claim, grant and revision on it survives untouched, because they all point at the node id and nothing anywhere points at a name. Use it on the stub names automatic minting produces from an email localpart or a display-name header: `Bna2005` -> `Brandon Andersen`, `Theriv` -> `The Riviera`, `Kentgee` -> `Kent Gee`. NOT COSMETIC — a stub carrying a bad name will not dedupe against the real person when they are authored properly, so renaming it is how you PREVENT the duplicate that would otherwise have to be merged later. The old name is kept as an alias automatically, so existing [[links]] and readers who know the old name still resolve. Renaming ONTO a name another page already holds is refused, naming the holder: combining two pages is a merge decision, not a rename. `user` pages cannot be renamed (that is an account identity).",
|
|
6806
|
+
description: "Change the TITLE of an existing page, keeping the page itself — every record, attachment, routing claim, grant and revision on it survives untouched, because they all point at the node id and nothing anywhere points at a name. Use it on the stub names automatic minting produces from an email localpart or a display-name header: `Bna2005` -> `Brandon Andersen`, `Theriv` -> `The Riviera`, `Kentgee` -> `Kent Gee`. NOT COSMETIC — a stub carrying a bad name will not dedupe against the real person when they are authored properly, so renaming it is how you PREVENT the duplicate that would otherwise have to be merged later. The old name is kept as an alias automatically, so existing [[links]] and readers who know the old name still resolve — and, where relinking is on, every [[Old]] link on a page you can edit is rewritten to the new name (undo_relink reverses that alone). Renaming ONTO a name another page already holds is refused, naming the holder: combining two pages is a merge decision, not a rename. `user` pages cannot be renamed (that is an account identity).",
|
|
6744
6807
|
inputSchema: {
|
|
6745
6808
|
kind: z.enum(['project', 'person', 'org']).describe('the page kind'),
|
|
6746
6809
|
name: z.string().optional().describe('current page title (or pass ref)'),
|
|
@@ -6783,6 +6846,13 @@ function renderNudge(payload) {
|
|
|
6783
6846
|
const lines = [`Renamed "${out.from}" -> "${out.to}" in ${out.brain} (${out.kind}, ref ${out.ref}).`]
|
|
6784
6847
|
lines.push(`${out.recordsCarried} record(s) came along; ${out.documentsRetitled} tier-doc(s) retitled.`)
|
|
6785
6848
|
lines.push(`"${out.aliasWritten}" still resolves to this page, so existing [[links]] are not broken.`)
|
|
6849
|
+
// Relinking (page_splitting brains): the server rewrote inbound [[Old]] links to the new name.
|
|
6850
|
+
if (out.linksRewritten != null) {
|
|
6851
|
+
lines.push(out.linksRewritten
|
|
6852
|
+
? `${out.linksRewritten} inbound link(s) now read [[${out.to}]]${out.linkPages?.length ? ` on ${out.linkPages.map((p) => `"${p}"`).join(', ')}` : ''}${out.relinkPlan ? ` (undo_relink plan ${out.relinkPlan} puts them back)` : ''}.`
|
|
6853
|
+
: 'No other page you can edit linked to the old name.')
|
|
6854
|
+
if (out.linksSkipped?.length) lines.push(`Not yours to edit, left on the old name (it still resolves): ${out.linksSkipped.map((p) => `"${p.page}"`).join(', ')}.`)
|
|
6855
|
+
}
|
|
6786
6856
|
return { content: [{ type: 'text', text: lines.join(' ') }] }
|
|
6787
6857
|
},
|
|
6788
6858
|
)
|
package/lib/split_render.mjs
CHANGED
|
@@ -65,7 +65,7 @@ export function renderPlacement(out) {
|
|
|
65
65
|
if (yes.length) lines.push(`The new page now claims too: ${yes.join(', ')} — future records with ${yes.length > 1 ? 'these' : 'it'} land on both pages.`)
|
|
66
66
|
if (no.length) lines.push(`Claims kept by the source alone: ${no.join(', ')}.`)
|
|
67
67
|
}
|
|
68
|
-
lines.push('Next: inbound [[links]]
|
|
68
|
+
lines.push('Next: send inbound [[links]] where they belong now — relink_links from the original page to the new one (preview lists every link with its paragraph; decide move / both / keep each). undo_split reverses the whole split.')
|
|
69
69
|
return lines.join('\n')
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -89,6 +89,20 @@ export function renderSplitRefusal(what, out, status) {
|
|
|
89
89
|
|
|
90
90
|
// ── Page merge (ADR-0036 phase 3) ──────────────────────────────────────────────────────────────────
|
|
91
91
|
|
|
92
|
+
// Inbound links (relink.ts): what a merge repoints, and the pages it may not touch. Absent on an older server.
|
|
93
|
+
function linkLines(out, preview) {
|
|
94
|
+
if (out.linksRepointed == null) return []
|
|
95
|
+
const pages = out.linkPages?.length ? ` on ${out.linkPages.map((p) => `"${p}"`).join(', ')}` : ''
|
|
96
|
+
const lines = [preview
|
|
97
|
+
? `Inbound links: ${out.linksRepointed} link(s) to "${out.source}"${pages} will point to "${out.target}", their wording kept.`
|
|
98
|
+
: `Inbound links repointed to "${out.target}": ${out.linksRepointed}${pages}.`]
|
|
99
|
+
if (out.linksSkipped?.length) {
|
|
100
|
+
lines.push(`Not yours to edit, left as they are (the old name still leads to "${out.target}" there): ${out.linksSkipped.map((p) => `"${p.page}" (${p.links})`).join(', ')}.`)
|
|
101
|
+
}
|
|
102
|
+
if (out.linksChangedSince?.length) lines.push(`Changed since the preview, left alone: ${out.linksChangedSince.join('; ')}.`)
|
|
103
|
+
return lines
|
|
104
|
+
}
|
|
105
|
+
|
|
92
106
|
export function renderMerge(out) {
|
|
93
107
|
const lines = []
|
|
94
108
|
const verb = out.preview ? 'PREVIEW — nothing written' : out.replayed ? 'already applied (this is its first result)' : 'APPLIED'
|
|
@@ -97,7 +111,8 @@ export function renderMerge(out) {
|
|
|
97
111
|
if (out.preview) {
|
|
98
112
|
lines.push(`Records: all ${out.records} on "${out.source}" will also attach to "${out.target}"${out.governed ? `; "${out.target}" becomes the governing page of ${out.governed}` : ''}. No reading needed — a merge has one destination.`)
|
|
99
113
|
lines.push(`Routing claims moving to "${out.target}": ${out.claims.length ? out.claims.join(', ') : 'none'}.`)
|
|
100
|
-
lines.push(`"${out.source}" will be retired (superseded by "${out.target}", never deleted)
|
|
114
|
+
lines.push(`"${out.source}" will be retired (superseded by "${out.target}", never deleted).`)
|
|
115
|
+
lines.push(...linkLines(out, true))
|
|
101
116
|
lines.push(`Audience unchanged: same tier, same ${out.grants} grant(s).`)
|
|
102
117
|
lines.push(`plan: ${out.plan}`)
|
|
103
118
|
lines.push(`Next: merge_pages with mode:'apply' and plan:'${out.plan}'. Afterwards, condense overlapping sections with merge_sections.`)
|
|
@@ -105,6 +120,7 @@ export function renderMerge(out) {
|
|
|
105
120
|
lines.push(`Records newly attached to "${out.target}": ${out.records}${out.recordsAlreadyOnTarget ? ` (${out.recordsAlreadyOnTarget} were already there)` : ''}; governance moved: ${out.governed}.`)
|
|
106
121
|
lines.push(`Routing claims moved: ${out.claims.length ? out.claims.join(', ') : 'none'}.`)
|
|
107
122
|
lines.push(`"${out.source}" is retired, superseded by "${out.target}".`)
|
|
123
|
+
lines.push(...linkLines(out, false))
|
|
108
124
|
lines.push(`"${out.target}" is now version ${out.targetVersion}.`)
|
|
109
125
|
lines.push(`plan: ${out.plan} — undo_merge with this plan reverses all of it while neither page has changed.`)
|
|
110
126
|
lines.push(`Next: read "${out.target}" and condense the "Merged from" sections into the page with merge_sections or edit_page.`)
|
|
@@ -117,6 +133,37 @@ export function renderMergeUndo(out) {
|
|
|
117
133
|
`Merge undone (${out.brain}): "${out.source}" is current again; "${out.target}" lost the ${out.sectionsRemoved} appended section(s).`,
|
|
118
134
|
`Record attachments the merge added, removed: ${out.recordsDetached}. Governance returned: ${out.governanceRestored}. Routing claims returned: ${out.claimsRestored}.`,
|
|
119
135
|
...(out.laterTargetRecords ? [`${out.laterTargetRecords} record(s) reached "${out.target}" after the merge and stay there.`] : []),
|
|
136
|
+
...(out.linksRestored != null ? [`Links put back to "${out.source}": ${out.linksRestored}.`] : []),
|
|
137
|
+
...(out.linksChangedSince?.length ? [`Left as they are (edited after the merge): ${out.linksChangedSince.join('; ')}.`] : []),
|
|
120
138
|
`Versions now: "${out.source}" ${out.sourceVersion} · "${out.target}" ${out.targetVersion}.`,
|
|
121
139
|
].join('\n')
|
|
122
140
|
}
|
|
141
|
+
|
|
142
|
+
export function renderRelink(out) {
|
|
143
|
+
const lines = []
|
|
144
|
+
const verb = out.preview ? 'PREVIEW — nothing written' : out.replayed ? 'already applied (this is its first result)' : 'APPLIED'
|
|
145
|
+
lines.push(`Relink "${out.from}" → "${out.to}" (${out.brain}) — ${verb}.`)
|
|
146
|
+
lines.push(`Names traced: ${out.names.map((n) => `"${n}"`).join(', ')}.`)
|
|
147
|
+
if (out.preview) {
|
|
148
|
+
if (!out.links.length) lines.push('No page you can edit links to it.')
|
|
149
|
+
for (const l of out.links) {
|
|
150
|
+
lines.push('', `[${l.id}] "${l.page}" — ${l.heading}`, ` link: ${l.text}`, ` context: ${l.context.replace(/\n+/g, ' ')}`)
|
|
151
|
+
}
|
|
152
|
+
if (out.skipped?.length) lines.push('', `Not yours to edit, left alone: ${out.skipped.map((p) => `"${p.page}" (${p.links})`).join(', ')}.`)
|
|
153
|
+
lines.push('', `plan: ${out.plan}`)
|
|
154
|
+
lines.push(`Next: decide EVERY link — move (point it at "${out.to}"), both (keep it and add "${out.to}"), or keep. Read each link's paragraph: does it mean what moved, what stayed, or both? Unless it clearly rules one out, choose both. Then relink_links with mode:'apply', plan:'${out.plan}', decisions:{ "<id>": "move"|"both"|"keep" } (or default_action for all).`)
|
|
155
|
+
} else {
|
|
156
|
+
lines.push(`Moved: ${out.moved ?? 0} · both: ${out.both ?? 0} · kept: ${out.kept ?? 0}. Pages changed: ${out.pagesChanged?.length ? out.pagesChanged.map((p) => `"${p}"`).join(', ') : 'none'}.`)
|
|
157
|
+
if (out.changedSince?.length) lines.push(`Changed since the preview, left alone: ${out.changedSince.join('; ')}.`)
|
|
158
|
+
if (out.skipped?.length) lines.push(`Not yours to edit, left alone: ${out.skipped.map((p) => `"${p.page}" (${p.links})`).join(', ')}.`)
|
|
159
|
+
lines.push(`plan: ${out.plan} — undo_relink with this plan puts the links back.`)
|
|
160
|
+
}
|
|
161
|
+
return lines.join('\n')
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function renderRelinkUndo(out) {
|
|
165
|
+
return [
|
|
166
|
+
`Relink undone (${out.brain}): ${out.restored} section(s) put back${out.pages?.length ? ` on ${out.pages.map((p) => `"${p}"`).join(', ')}` : ''}.`,
|
|
167
|
+
...(out.changedSince?.length ? [`Left as they are (edited after the relink): ${out.changedSince.join('; ')}.`] : []),
|
|
168
|
+
].join('\n')
|
|
169
|
+
}
|
package/package.json
CHANGED