@sjawhar/claude-envoy 2.24.0 → 2.25.1
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/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/dist/dispatch.js +48 -9
- package/dist/envoy-channel.js +6 -3
- package/dist/session-hook.js +5 -2
- package/package.json +1 -1
package/.omp-plugin/plugin.json
CHANGED
package/dist/dispatch.js
CHANGED
|
@@ -1346,13 +1346,13 @@ function newAsks(toolName, input) {
|
|
|
1346
1346
|
case "dispatch_artifact":
|
|
1347
1347
|
return typeof input.content === "string" ? askBlocks(input.content) : [];
|
|
1348
1348
|
case "dispatch_doc_edit":
|
|
1349
|
-
return (
|
|
1350
|
-
|
|
1351
|
-
return [];
|
|
1352
|
-
const { op: kind, markdown, type, block } = op;
|
|
1349
|
+
return editOps(input).flatMap((op) => {
|
|
1350
|
+
const { op: kind, markdown, with: replacement, type, block } = op;
|
|
1353
1351
|
if (kind === "insert" && typeof markdown === "string") {
|
|
1354
|
-
|
|
1355
|
-
|
|
1352
|
+
return scanAsks(markdown, op.before === "start" || op.after === "start");
|
|
1353
|
+
}
|
|
1354
|
+
if (kind === "replace" && typeof replacement === "string") {
|
|
1355
|
+
return replacementAsks(replacement);
|
|
1356
1356
|
}
|
|
1357
1357
|
if (kind === "retype" && type === "ask" && typeof block === "string") {
|
|
1358
1358
|
return [{ kind: "retype", id: block, text: "", opening: "" }];
|
|
@@ -1363,6 +1363,18 @@ function newAsks(toolName, input) {
|
|
|
1363
1363
|
return [];
|
|
1364
1364
|
}
|
|
1365
1365
|
}
|
|
1366
|
+
function newAskCount(toolName, input) {
|
|
1367
|
+
if (toolName !== "dispatch_doc_edit")
|
|
1368
|
+
return newAsks(toolName, input).length;
|
|
1369
|
+
let count = 0;
|
|
1370
|
+
for (const op of editOps(input)) {
|
|
1371
|
+
count += op.op === "replace" && typeof op.with === "string" ? Math.max(...replacementReadings(op.with).map((text) => scanAsks(text, false).length)) : newAsks(toolName, { ops: [op] }).length;
|
|
1372
|
+
}
|
|
1373
|
+
return count;
|
|
1374
|
+
}
|
|
1375
|
+
function editOps(input) {
|
|
1376
|
+
return (Array.isArray(input.ops) ? input.ops : []).filter((op) => typeof op === "object" && op !== null);
|
|
1377
|
+
}
|
|
1366
1378
|
function questionAsk(input) {
|
|
1367
1379
|
const question = typeof input.question === "string" ? input.question.trim() : "";
|
|
1368
1380
|
const options = (Array.isArray(input.options) ? input.options : []).flatMap((option) => {
|
|
@@ -1427,6 +1439,30 @@ function scanAsks(markdown, frontMatter) {
|
|
|
1427
1439
|
return { kind: "block", ...id === undefined ? {} : { id }, text, opening: openingOf(text) };
|
|
1428
1440
|
});
|
|
1429
1441
|
}
|
|
1442
|
+
function replacementAsks(replacement) {
|
|
1443
|
+
const variants = new Map;
|
|
1444
|
+
for (const reading of replacementReadings(replacement)) {
|
|
1445
|
+
for (const ask of scanAsks(reading, false)) {
|
|
1446
|
+
const key = JSON.stringify([ask.id ?? null, ask.text]);
|
|
1447
|
+
if (!variants.has(key))
|
|
1448
|
+
variants.set(key, ask);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
const found = [...variants.values()];
|
|
1452
|
+
const idsWithText = new Set(found.flatMap((ask) => ask.text !== "" && ask.id !== undefined ? [ask.id] : []));
|
|
1453
|
+
const anyText = found.some((ask) => ask.text !== "");
|
|
1454
|
+
return found.filter((ask) => ask.text !== "" || (ask.id === undefined ? !anyText : !idsWithText.has(ask.id)));
|
|
1455
|
+
}
|
|
1456
|
+
function replacementReadings(replacement) {
|
|
1457
|
+
const readings = [replacement];
|
|
1458
|
+
let text = replacement;
|
|
1459
|
+
for (let strip = LEADING_STRIP.exec(text);strip !== null; strip = LEADING_STRIP.exec(text)) {
|
|
1460
|
+
text = text.slice(strip[0].length);
|
|
1461
|
+
readings.push(text);
|
|
1462
|
+
}
|
|
1463
|
+
return readings;
|
|
1464
|
+
}
|
|
1465
|
+
var LEADING_STRIP = /^(?:[ \t]*(?:#{1,6}|[0-9]{1,9}[.)]|[-*+])[ \t]+|\[[ xX]\][ \t]+)/u;
|
|
1430
1466
|
|
|
1431
1467
|
class Line {
|
|
1432
1468
|
text;
|
|
@@ -15529,7 +15565,7 @@ var dispatchToolSpecs = [
|
|
|
15529
15565
|
ops: [{ op: "delete_column", block: "table-123", index: 1 }],
|
|
15530
15566
|
precondition: { blocks: [{ id: "table-123", token: "sha256:current-table-token" }] }
|
|
15531
15567
|
},
|
|
15532
|
-
description: "Apply deterministic document edits: replace or delete quoted text, insert markdown at an anchor, retype an identified paragraph or typed block into a schema-declared typed block, delete or move a whole block by its id, or delete a table row or column in place. " + "Do not use it for review feedback or for reading; use dispatch comment, dispatch suggest, or dispatch doc-read instead. " + "For replace, delete, and quote anchors, find text as rendered: inline Markdown (**bold**, `code`) is tolerated and must be balanced; a leading '# ' matches a heading at any level. A find that opens with a list marker ('- ', '5. ', with an optional '[ ] ' or '[x] ' after it) and matches no text as written selects an item of that kind of list whose text starts with the rest, its number not matched and a box matching only a task item in that state. A find or quote anchor stays inside one block, and in a table inside one cell: ' | ' is the boundary markdown writes between two cells, not text a cell holds, so a quote that runs across cells is refused, naming the cells; change several cells with one operation per cell in the same batch, and anchor on one cell's text. replace
|
|
15568
|
+
description: "Apply deterministic document edits: replace or delete quoted text, insert markdown at an anchor, retype an identified paragraph or typed block into a schema-declared typed block, delete or move a whole block by its id, or delete a table row or column in place. " + "Do not use it for review feedback or for reading; use dispatch comment, dispatch suggest, or dispatch doc-read instead. " + "For replace, delete, and quote anchors, find text as rendered: inline Markdown (**bold**, `code`) is tolerated and must be balanced; a leading '# ' matches a heading at any level. A find that opens with a list marker ('- ', '5. ', with an optional '[ ] ' or '[x] ' after it) and matches no text as written selects an item of that kind of list whose text starts with the rest, its number not matched and a box matching only a task item in that state. A find or quote anchor stays inside one block, and in a table inside one cell: ' | ' is the boundary markdown writes between two cells, not text a cell holds, so a quote that runs across cells is refused, naming the cells; change several cells with one operation per cell in the same batch, and anchor on one cell's text. replace parses with as markdown, as insert parses its markdown: a with that parses to one paragraph is the new text of the matched span, and one that parses to blocks ('---' over a paragraph, a list, a table, two paragraphs) writes those blocks where the match sits, so a marker of a different kind from the block's own opens the block it names ('4. Design' is an ordered list, which a heading cannot hold) unless you escape it ('4\\. Design'). A with that opens with a marker of the same kind as the matched block's own would write it twice and is INVALID_OP - including prose that merely looks like one ('1999. was a year' into an ordered item), which you write as text by escaping it ('1999\\. was a year'). The exceptions are an item a find's list marker selected (it matched no text as written): replace(find=\"5. Old\", with=\"5. New\") gives the item the text 'New' under its own number, and a with that is the marker alone is INVALID_OP; and a heading rename whose find carried a heading marker: replace(find=\"## Old\", with=\"## New\") gives '## New', where a different level applies only when find named the heading's actual level (find \"## Old\" with \"### New\" makes it an h3), since '# ' selects a heading without naming its level. A task item (`- [ ]` / `- [x]`) is ticked the same way: when find matches from the start of the item's text and with opens with '[x] ' or '[ ] ', the opening sets the item's box and the rest is its new text (replace(find=\"Write it\", with=\"[x] Write it\") ticks it); the same opening over a plain list item or a paragraph stays literal text. Any non-empty with that renders to no text - whitespace alone - is INVALID_OP rather than a silent deletion; pass an empty with to delete the matched text on purpose - a list item, quote, typed block or footnote definition left holding only the emptied paragraph keeps it. " + "The blocks a with writes are refused, with the document unchanged, where the block holding the match cannot hold them: a heading and any cell of a table, which hold one line of text, and a typed block whose content rule they break - write that block's new text alone, and insert the blocks beside it. A hard break in with is INVALID_OP when the matched text is in a heading or a table cell, which are written on one line. In a table cell, with is the cell's text: write a | in it bare, in code too, since code whose text has an odd run of backslashes right before a | cannot be stored in a cell and is INVALID_OP, naming the cell. " + "A delete whose find is a block's entire text removes the block (a list emptied of its items goes too); delete with block removes any block by id, and move with block relocates one. A delete or retype that would take an ask block out of the document while its ask is open is refused, with nothing sent. delete_row and delete_column take a table block and a zero-based index, preserving the table block id and refusing to remove cells with open asks or unresolved comments. " + `Insert and move anchors also accept "start", "end", "heading:<exact heading text>", and "block:<id>"; dispatch doc-read --blocks lists every block's id, type, opening words and token, and each table's rows and cells with the indexes delete_row and delete_column take (GET /api/v1/artifacts/{artifact UUID}/blocks serves the same list). ` + "Optionally require the state just read: precondition selects exactly one of a document token from dispatch doc-read, or block {id, token} values from dispatch doc-read --blocks. A block guard must include every block the batch changes; Dispatch resolves quote targets and rejects an uncovered batch rather than applying it. Use a document token for insert or move, which depend on document order. Prefer block tokens when the covered content blocks are independent sections. Tokens include inline marks, so a fresh human comment also makes a stale edit fail. PRECONDITION_FAILED means re-read; EDIT_QUEUE_FULL means back off before retrying. " + `${CI_CHECK_RULE} ` + "The result carries the document token this edit produced, so a chain of guarded edits passes each result's token as the next edit's precondition with no dispatch doc-read between them. " + "A batch that leaves the document exactly as it was mints no version, named or not, and the result says nothing changed and names each operation that did nothing. " + "A change a browser removes while the edit is in flight is never reported as applied: EDIT_LOST_TO_CONCURRENT_CHANGE means the write was refused and nothing was written, so re-read the document and decide again, as with PRECONDITION_FAILED; lost_ops on a successful result names operations whose text the live document no longer has, because the deletion landed after the version was written. " + "Several paragraphs, or a list, go in one replace, since with writes the blocks its markdown names; blocks beside a block go in one insert, since two inserts at one anchor come out reversed. The result prints the markdown of each block the edit wrote, so read that rather than the document again. " + "Each decision block the edit adds gets the related-item check dispatch ask gets, waiting at most five seconds for all of them together: the result prints, after its first line, `Decision block <id>:` and what that check found, that it found nothing, or that it was not made and why. " + "A block id written as {#id} longer than 256 bytes is stored, but its block is no graph node, so no reference reaches it. " + `The spec holds requirements, design, and decisions - never progress, status, or timestamps; a record of open items or progress is a document of its own. ${OWNER_REFERENCE} ${SPEC_WRITING_POINTER}`,
|
|
15533
15569
|
arguments: (z) => ({
|
|
15534
15570
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
15535
15571
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
@@ -15538,7 +15574,7 @@ var dispatchToolSpecs = [
|
|
|
15538
15574
|
ops: z.array(z.object({
|
|
15539
15575
|
op: z.enum(DOC_EDIT_OPS).describe("Edit operation."),
|
|
15540
15576
|
find: z.string().describe("Text of the target as rendered, for replace or delete; inline markdown (**bold**, `code`) is tolerated and must be balanced; a leading '# ' matches a heading. A delete of a block's entire text removes the block.").optional(),
|
|
15541
|
-
with: z.string().describe("Replacement text for replace: inside a code block, the code's literal text as sent (line breaks at its end do not survive a read);
|
|
15577
|
+
with: z.string().describe("Replacement text for replace: inside a code block, the code's literal text as sent (line breaks at its end do not survive a read); elsewhere parsed as markdown, as insert's markdown is. Text that parses to one paragraph is written inside the matched block, where a backslash escape keeps prose that merely looks like a marker, a leading '[x] ' or '[ ] ' over a task item's text matched from its start sets the item's checkbox, and any non-empty value that renders to no text is refused - only an empty value deletes the match. Text that parses to blocks ('---' over a paragraph, a list, a table, two paragraphs) writes those blocks where the match sits, fitted as the editor fits them, and is refused, with the document unchanged, where the block holding the match cannot hold them: a heading, any cell of a table, and a typed block whose content rule they break. A leading marker of the same kind as the matched block's own is refused either way, since the block renders it already, unless it is a heading rename (where a level named by find is what lets with change it) or an item find's own marker selected. A CR LF or a lone carriage return in it is written as a line feed.").optional(),
|
|
15542
15578
|
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based match occurrence.").optional(),
|
|
15543
15579
|
markdown: z.string().describe("Markdown to insert; a CR LF or a lone carriage return in it is written as a line feed.").optional(),
|
|
15544
15580
|
after: z.string().describe(`Insert or move after this anchor: a quote of the neighbouring block's text, or one of "start", "end", "heading:<exact heading text>", "block:<id>".`).optional(),
|
|
@@ -23786,12 +23822,15 @@ async function docEditCommand(context) {
|
|
|
23786
23822
|
});
|
|
23787
23823
|
const declinedLines = resolved.issue === undefined ? [] : declinedAskLines(edited.advice, resolved.issue.key, linkBase);
|
|
23788
23824
|
const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {}));
|
|
23825
|
+
const written = edited.written;
|
|
23826
|
+
const writtenLines = written === undefined || written === "" ? [] : [written];
|
|
23789
23827
|
const tokenTrailer = edited.token === undefined ? [] : [`Document token: ${edited.token}`];
|
|
23790
23828
|
return {
|
|
23791
23829
|
text: [
|
|
23792
23830
|
`${applied}${await notSubscribed(resolvedTopic(resolved), input.subscriptions)}`,
|
|
23793
23831
|
...checkLines,
|
|
23794
23832
|
...declinedLines,
|
|
23833
|
+
...writtenLines,
|
|
23795
23834
|
...tokenTrailer,
|
|
23796
23835
|
...adviceLines
|
|
23797
23836
|
].join(`
|
|
@@ -30002,7 +30041,7 @@ async function runDispatchCli(argv, rawEnv, io) {
|
|
|
30002
30041
|
uploadBytes = bytes;
|
|
30003
30042
|
}
|
|
30004
30043
|
const spent = consumeMarker(gate.stores, argv, parsed.args, files, Date.now());
|
|
30005
|
-
const asksCarried = spent.ok ? 0 :
|
|
30044
|
+
const asksCarried = spent.ok ? 0 : newAskCount(parsed.tool, uploadBytes === undefined ? parsed.args : { ...parsed.args, content: new TextDecoder().decode(uploadBytes) });
|
|
30006
30045
|
if (!spent.ok && gate.mode === "block") {
|
|
30007
30046
|
return refuse(spent.changed === undefined ? `${notCalled} AskGate is on for this session, and ${spent.why}. ${LITERAL_FORM} Send the write again in that form, as a bash call of its own.` : `${notCalled} AskGate is on for this session, and ${spent.why}. ${SAME_MESSAGE} Send the call again in a later message than the one that changes the file.`, REFUSED, parsed.tool, { mode: "block", why: spent.why, asksCarried });
|
|
30008
30047
|
}
|
package/dist/envoy-channel.js
CHANGED
|
@@ -37169,7 +37169,7 @@ var dispatchToolSpecs = [
|
|
|
37169
37169
|
ops: [{ op: "delete_column", block: "table-123", index: 1 }],
|
|
37170
37170
|
precondition: { blocks: [{ id: "table-123", token: "sha256:current-table-token" }] }
|
|
37171
37171
|
},
|
|
37172
|
-
description: "Apply deterministic document edits: replace or delete quoted text, insert markdown at an anchor, retype an identified paragraph or typed block into a schema-declared typed block, delete or move a whole block by its id, or delete a table row or column in place. " + "Do not use it for review feedback or for reading; use dispatch comment, dispatch suggest, or dispatch doc-read instead. " + "For replace, delete, and quote anchors, find text as rendered: inline Markdown (**bold**, `code`) is tolerated and must be balanced; a leading '# ' matches a heading at any level. A find that opens with a list marker ('- ', '5. ', with an optional '[ ] ' or '[x] ' after it) and matches no text as written selects an item of that kind of list whose text starts with the rest, its number not matched and a box matching only a task item in that state. A find or quote anchor stays inside one block, and in a table inside one cell: ' | ' is the boundary markdown writes between two cells, not text a cell holds, so a quote that runs across cells is refused, naming the cells; change several cells with one operation per cell in the same batch, and anchor on one cell's text. replace
|
|
37172
|
+
description: "Apply deterministic document edits: replace or delete quoted text, insert markdown at an anchor, retype an identified paragraph or typed block into a schema-declared typed block, delete or move a whole block by its id, or delete a table row or column in place. " + "Do not use it for review feedback or for reading; use dispatch comment, dispatch suggest, or dispatch doc-read instead. " + "For replace, delete, and quote anchors, find text as rendered: inline Markdown (**bold**, `code`) is tolerated and must be balanced; a leading '# ' matches a heading at any level. A find that opens with a list marker ('- ', '5. ', with an optional '[ ] ' or '[x] ' after it) and matches no text as written selects an item of that kind of list whose text starts with the rest, its number not matched and a box matching only a task item in that state. A find or quote anchor stays inside one block, and in a table inside one cell: ' | ' is the boundary markdown writes between two cells, not text a cell holds, so a quote that runs across cells is refused, naming the cells; change several cells with one operation per cell in the same batch, and anchor on one cell's text. replace parses with as markdown, as insert parses its markdown: a with that parses to one paragraph is the new text of the matched span, and one that parses to blocks ('---' over a paragraph, a list, a table, two paragraphs) writes those blocks where the match sits, so a marker of a different kind from the block's own opens the block it names ('4. Design' is an ordered list, which a heading cannot hold) unless you escape it ('4\\. Design'). A with that opens with a marker of the same kind as the matched block's own would write it twice and is INVALID_OP - including prose that merely looks like one ('1999. was a year' into an ordered item), which you write as text by escaping it ('1999\\. was a year'). The exceptions are an item a find's list marker selected (it matched no text as written): replace(find=\"5. Old\", with=\"5. New\") gives the item the text 'New' under its own number, and a with that is the marker alone is INVALID_OP; and a heading rename whose find carried a heading marker: replace(find=\"## Old\", with=\"## New\") gives '## New', where a different level applies only when find named the heading's actual level (find \"## Old\" with \"### New\" makes it an h3), since '# ' selects a heading without naming its level. A task item (`- [ ]` / `- [x]`) is ticked the same way: when find matches from the start of the item's text and with opens with '[x] ' or '[ ] ', the opening sets the item's box and the rest is its new text (replace(find=\"Write it\", with=\"[x] Write it\") ticks it); the same opening over a plain list item or a paragraph stays literal text. Any non-empty with that renders to no text - whitespace alone - is INVALID_OP rather than a silent deletion; pass an empty with to delete the matched text on purpose - a list item, quote, typed block or footnote definition left holding only the emptied paragraph keeps it. " + "The blocks a with writes are refused, with the document unchanged, where the block holding the match cannot hold them: a heading and any cell of a table, which hold one line of text, and a typed block whose content rule they break - write that block's new text alone, and insert the blocks beside it. A hard break in with is INVALID_OP when the matched text is in a heading or a table cell, which are written on one line. In a table cell, with is the cell's text: write a | in it bare, in code too, since code whose text has an odd run of backslashes right before a | cannot be stored in a cell and is INVALID_OP, naming the cell. " + "A delete whose find is a block's entire text removes the block (a list emptied of its items goes too); delete with block removes any block by id, and move with block relocates one. A delete or retype that would take an ask block out of the document while its ask is open is refused, with nothing sent. delete_row and delete_column take a table block and a zero-based index, preserving the table block id and refusing to remove cells with open asks or unresolved comments. " + `Insert and move anchors also accept "start", "end", "heading:<exact heading text>", and "block:<id>"; dispatch doc-read --blocks lists every block's id, type, opening words and token, and each table's rows and cells with the indexes delete_row and delete_column take (GET /api/v1/artifacts/{artifact UUID}/blocks serves the same list). ` + "Optionally require the state just read: precondition selects exactly one of a document token from dispatch doc-read, or block {id, token} values from dispatch doc-read --blocks. A block guard must include every block the batch changes; Dispatch resolves quote targets and rejects an uncovered batch rather than applying it. Use a document token for insert or move, which depend on document order. Prefer block tokens when the covered content blocks are independent sections. Tokens include inline marks, so a fresh human comment also makes a stale edit fail. PRECONDITION_FAILED means re-read; EDIT_QUEUE_FULL means back off before retrying. " + `${CI_CHECK_RULE} ` + "The result carries the document token this edit produced, so a chain of guarded edits passes each result's token as the next edit's precondition with no dispatch doc-read between them. " + "A batch that leaves the document exactly as it was mints no version, named or not, and the result says nothing changed and names each operation that did nothing. " + "A change a browser removes while the edit is in flight is never reported as applied: EDIT_LOST_TO_CONCURRENT_CHANGE means the write was refused and nothing was written, so re-read the document and decide again, as with PRECONDITION_FAILED; lost_ops on a successful result names operations whose text the live document no longer has, because the deletion landed after the version was written. " + "Several paragraphs, or a list, go in one replace, since with writes the blocks its markdown names; blocks beside a block go in one insert, since two inserts at one anchor come out reversed. The result prints the markdown of each block the edit wrote, so read that rather than the document again. " + "Each decision block the edit adds gets the related-item check dispatch ask gets, waiting at most five seconds for all of them together: the result prints, after its first line, `Decision block <id>:` and what that check found, that it found nothing, or that it was not made and why. " + "A block id written as {#id} longer than 256 bytes is stored, but its block is no graph node, so no reference reaches it. " + `The spec holds requirements, design, and decisions - never progress, status, or timestamps; a record of open items or progress is a document of its own. ${OWNER_REFERENCE} ${SPEC_WRITING_POINTER}`,
|
|
37173
37173
|
arguments: (z) => ({
|
|
37174
37174
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
37175
37175
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
@@ -37178,7 +37178,7 @@ var dispatchToolSpecs = [
|
|
|
37178
37178
|
ops: z.array(z.object({
|
|
37179
37179
|
op: z.enum(DOC_EDIT_OPS).describe("Edit operation."),
|
|
37180
37180
|
find: z.string().describe("Text of the target as rendered, for replace or delete; inline markdown (**bold**, `code`) is tolerated and must be balanced; a leading '# ' matches a heading. A delete of a block's entire text removes the block.").optional(),
|
|
37181
|
-
with: z.string().describe("Replacement text for replace: inside a code block, the code's literal text as sent (line breaks at its end do not survive a read);
|
|
37181
|
+
with: z.string().describe("Replacement text for replace: inside a code block, the code's literal text as sent (line breaks at its end do not survive a read); elsewhere parsed as markdown, as insert's markdown is. Text that parses to one paragraph is written inside the matched block, where a backslash escape keeps prose that merely looks like a marker, a leading '[x] ' or '[ ] ' over a task item's text matched from its start sets the item's checkbox, and any non-empty value that renders to no text is refused - only an empty value deletes the match. Text that parses to blocks ('---' over a paragraph, a list, a table, two paragraphs) writes those blocks where the match sits, fitted as the editor fits them, and is refused, with the document unchanged, where the block holding the match cannot hold them: a heading, any cell of a table, and a typed block whose content rule they break. A leading marker of the same kind as the matched block's own is refused either way, since the block renders it already, unless it is a heading rename (where a level named by find is what lets with change it) or an item find's own marker selected. A CR LF or a lone carriage return in it is written as a line feed.").optional(),
|
|
37182
37182
|
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based match occurrence.").optional(),
|
|
37183
37183
|
markdown: z.string().describe("Markdown to insert; a CR LF or a lone carriage return in it is written as a line feed.").optional(),
|
|
37184
37184
|
after: z.string().describe(`Insert or move after this anchor: a quote of the neighbouring block's text, or one of "start", "end", "heading:<exact heading text>", "block:<id>".`).optional(),
|
|
@@ -50123,12 +50123,15 @@ async function docEditCommand(context) {
|
|
|
50123
50123
|
});
|
|
50124
50124
|
const declinedLines = resolved.issue === undefined ? [] : declinedAskLines(edited.advice, resolved.issue.key, linkBase);
|
|
50125
50125
|
const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {}));
|
|
50126
|
+
const written = edited.written;
|
|
50127
|
+
const writtenLines = written === undefined || written === "" ? [] : [written];
|
|
50126
50128
|
const tokenTrailer = edited.token === undefined ? [] : [`Document token: ${edited.token}`];
|
|
50127
50129
|
return {
|
|
50128
50130
|
text: [
|
|
50129
50131
|
`${applied}${await notSubscribed(resolvedTopic(resolved), input.subscriptions)}`,
|
|
50130
50132
|
...checkLines,
|
|
50131
50133
|
...declinedLines,
|
|
50134
|
+
...writtenLines,
|
|
50132
50135
|
...tokenTrailer,
|
|
50133
50136
|
...adviceLines
|
|
50134
50137
|
].join(`
|
|
@@ -56496,7 +56499,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
56496
56499
|
|
|
56497
56500
|
// package.json
|
|
56498
56501
|
var name = "@sjawhar/claude-envoy";
|
|
56499
|
-
var version2 = "2.
|
|
56502
|
+
var version2 = "2.25.1";
|
|
56500
56503
|
var legion = {
|
|
56501
56504
|
daemonApiVersion: 137
|
|
56502
56505
|
};
|
package/dist/session-hook.js
CHANGED
|
@@ -14516,7 +14516,7 @@ var dispatchToolSpecs = [
|
|
|
14516
14516
|
ops: [{ op: "delete_column", block: "table-123", index: 1 }],
|
|
14517
14517
|
precondition: { blocks: [{ id: "table-123", token: "sha256:current-table-token" }] }
|
|
14518
14518
|
},
|
|
14519
|
-
description: "Apply deterministic document edits: replace or delete quoted text, insert markdown at an anchor, retype an identified paragraph or typed block into a schema-declared typed block, delete or move a whole block by its id, or delete a table row or column in place. " + "Do not use it for review feedback or for reading; use dispatch comment, dispatch suggest, or dispatch doc-read instead. " + "For replace, delete, and quote anchors, find text as rendered: inline Markdown (**bold**, `code`) is tolerated and must be balanced; a leading '# ' matches a heading at any level. A find that opens with a list marker ('- ', '5. ', with an optional '[ ] ' or '[x] ' after it) and matches no text as written selects an item of that kind of list whose text starts with the rest, its number not matched and a box matching only a task item in that state. A find or quote anchor stays inside one block, and in a table inside one cell: ' | ' is the boundary markdown writes between two cells, not text a cell holds, so a quote that runs across cells is refused, naming the cells; change several cells with one operation per cell in the same batch, and anchor on one cell's text. replace
|
|
14519
|
+
description: "Apply deterministic document edits: replace or delete quoted text, insert markdown at an anchor, retype an identified paragraph or typed block into a schema-declared typed block, delete or move a whole block by its id, or delete a table row or column in place. " + "Do not use it for review feedback or for reading; use dispatch comment, dispatch suggest, or dispatch doc-read instead. " + "For replace, delete, and quote anchors, find text as rendered: inline Markdown (**bold**, `code`) is tolerated and must be balanced; a leading '# ' matches a heading at any level. A find that opens with a list marker ('- ', '5. ', with an optional '[ ] ' or '[x] ' after it) and matches no text as written selects an item of that kind of list whose text starts with the rest, its number not matched and a box matching only a task item in that state. A find or quote anchor stays inside one block, and in a table inside one cell: ' | ' is the boundary markdown writes between two cells, not text a cell holds, so a quote that runs across cells is refused, naming the cells; change several cells with one operation per cell in the same batch, and anchor on one cell's text. replace parses with as markdown, as insert parses its markdown: a with that parses to one paragraph is the new text of the matched span, and one that parses to blocks ('---' over a paragraph, a list, a table, two paragraphs) writes those blocks where the match sits, so a marker of a different kind from the block's own opens the block it names ('4. Design' is an ordered list, which a heading cannot hold) unless you escape it ('4\\. Design'). A with that opens with a marker of the same kind as the matched block's own would write it twice and is INVALID_OP - including prose that merely looks like one ('1999. was a year' into an ordered item), which you write as text by escaping it ('1999\\. was a year'). The exceptions are an item a find's list marker selected (it matched no text as written): replace(find=\"5. Old\", with=\"5. New\") gives the item the text 'New' under its own number, and a with that is the marker alone is INVALID_OP; and a heading rename whose find carried a heading marker: replace(find=\"## Old\", with=\"## New\") gives '## New', where a different level applies only when find named the heading's actual level (find \"## Old\" with \"### New\" makes it an h3), since '# ' selects a heading without naming its level. A task item (`- [ ]` / `- [x]`) is ticked the same way: when find matches from the start of the item's text and with opens with '[x] ' or '[ ] ', the opening sets the item's box and the rest is its new text (replace(find=\"Write it\", with=\"[x] Write it\") ticks it); the same opening over a plain list item or a paragraph stays literal text. Any non-empty with that renders to no text - whitespace alone - is INVALID_OP rather than a silent deletion; pass an empty with to delete the matched text on purpose - a list item, quote, typed block or footnote definition left holding only the emptied paragraph keeps it. " + "The blocks a with writes are refused, with the document unchanged, where the block holding the match cannot hold them: a heading and any cell of a table, which hold one line of text, and a typed block whose content rule they break - write that block's new text alone, and insert the blocks beside it. A hard break in with is INVALID_OP when the matched text is in a heading or a table cell, which are written on one line. In a table cell, with is the cell's text: write a | in it bare, in code too, since code whose text has an odd run of backslashes right before a | cannot be stored in a cell and is INVALID_OP, naming the cell. " + "A delete whose find is a block's entire text removes the block (a list emptied of its items goes too); delete with block removes any block by id, and move with block relocates one. A delete or retype that would take an ask block out of the document while its ask is open is refused, with nothing sent. delete_row and delete_column take a table block and a zero-based index, preserving the table block id and refusing to remove cells with open asks or unresolved comments. " + `Insert and move anchors also accept "start", "end", "heading:<exact heading text>", and "block:<id>"; dispatch doc-read --blocks lists every block's id, type, opening words and token, and each table's rows and cells with the indexes delete_row and delete_column take (GET /api/v1/artifacts/{artifact UUID}/blocks serves the same list). ` + "Optionally require the state just read: precondition selects exactly one of a document token from dispatch doc-read, or block {id, token} values from dispatch doc-read --blocks. A block guard must include every block the batch changes; Dispatch resolves quote targets and rejects an uncovered batch rather than applying it. Use a document token for insert or move, which depend on document order. Prefer block tokens when the covered content blocks are independent sections. Tokens include inline marks, so a fresh human comment also makes a stale edit fail. PRECONDITION_FAILED means re-read; EDIT_QUEUE_FULL means back off before retrying. " + `${CI_CHECK_RULE} ` + "The result carries the document token this edit produced, so a chain of guarded edits passes each result's token as the next edit's precondition with no dispatch doc-read between them. " + "A batch that leaves the document exactly as it was mints no version, named or not, and the result says nothing changed and names each operation that did nothing. " + "A change a browser removes while the edit is in flight is never reported as applied: EDIT_LOST_TO_CONCURRENT_CHANGE means the write was refused and nothing was written, so re-read the document and decide again, as with PRECONDITION_FAILED; lost_ops on a successful result names operations whose text the live document no longer has, because the deletion landed after the version was written. " + "Several paragraphs, or a list, go in one replace, since with writes the blocks its markdown names; blocks beside a block go in one insert, since two inserts at one anchor come out reversed. The result prints the markdown of each block the edit wrote, so read that rather than the document again. " + "Each decision block the edit adds gets the related-item check dispatch ask gets, waiting at most five seconds for all of them together: the result prints, after its first line, `Decision block <id>:` and what that check found, that it found nothing, or that it was not made and why. " + "A block id written as {#id} longer than 256 bytes is stored, but its block is no graph node, so no reference reaches it. " + `The spec holds requirements, design, and decisions - never progress, status, or timestamps; a record of open items or progress is a document of its own. ${OWNER_REFERENCE} ${SPEC_WRITING_POINTER}`,
|
|
14520
14520
|
arguments: (z) => ({
|
|
14521
14521
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
14522
14522
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
@@ -14525,7 +14525,7 @@ var dispatchToolSpecs = [
|
|
|
14525
14525
|
ops: z.array(z.object({
|
|
14526
14526
|
op: z.enum(DOC_EDIT_OPS).describe("Edit operation."),
|
|
14527
14527
|
find: z.string().describe("Text of the target as rendered, for replace or delete; inline markdown (**bold**, `code`) is tolerated and must be balanced; a leading '# ' matches a heading. A delete of a block's entire text removes the block.").optional(),
|
|
14528
|
-
with: z.string().describe("Replacement text for replace: inside a code block, the code's literal text as sent (line breaks at its end do not survive a read);
|
|
14528
|
+
with: z.string().describe("Replacement text for replace: inside a code block, the code's literal text as sent (line breaks at its end do not survive a read); elsewhere parsed as markdown, as insert's markdown is. Text that parses to one paragraph is written inside the matched block, where a backslash escape keeps prose that merely looks like a marker, a leading '[x] ' or '[ ] ' over a task item's text matched from its start sets the item's checkbox, and any non-empty value that renders to no text is refused - only an empty value deletes the match. Text that parses to blocks ('---' over a paragraph, a list, a table, two paragraphs) writes those blocks where the match sits, fitted as the editor fits them, and is refused, with the document unchanged, where the block holding the match cannot hold them: a heading, any cell of a table, and a typed block whose content rule they break. A leading marker of the same kind as the matched block's own is refused either way, since the block renders it already, unless it is a heading rename (where a level named by find is what lets with change it) or an item find's own marker selected. A CR LF or a lone carriage return in it is written as a line feed.").optional(),
|
|
14529
14529
|
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based match occurrence.").optional(),
|
|
14530
14530
|
markdown: z.string().describe("Markdown to insert; a CR LF or a lone carriage return in it is written as a line feed.").optional(),
|
|
14531
14531
|
after: z.string().describe(`Insert or move after this anchor: a quote of the neighbouring block's text, or one of "start", "end", "heading:<exact heading text>", "block:<id>".`).optional(),
|
|
@@ -22790,12 +22790,15 @@ async function docEditCommand(context) {
|
|
|
22790
22790
|
});
|
|
22791
22791
|
const declinedLines = resolved.issue === undefined ? [] : declinedAskLines(edited.advice, resolved.issue.key, linkBase);
|
|
22792
22792
|
const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {}));
|
|
22793
|
+
const written = edited.written;
|
|
22794
|
+
const writtenLines = written === undefined || written === "" ? [] : [written];
|
|
22793
22795
|
const tokenTrailer = edited.token === undefined ? [] : [`Document token: ${edited.token}`];
|
|
22794
22796
|
return {
|
|
22795
22797
|
text: [
|
|
22796
22798
|
`${applied}${await notSubscribed(resolvedTopic(resolved), input.subscriptions)}`,
|
|
22797
22799
|
...checkLines,
|
|
22798
22800
|
...declinedLines,
|
|
22801
|
+
...writtenLines,
|
|
22799
22802
|
...tokenTrailer,
|
|
22800
22803
|
...adviceLines
|
|
22801
22804
|
].join(`
|