@sjawhar/claude-envoy 5.19.2 → 5.20.0

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.
@@ -2,5 +2,5 @@
2
2
  "name": "claude-envoy",
3
3
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
4
4
  "mcpServers": "./.mcp.json",
5
- "version": "5.19.2"
5
+ "version": "5.20.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "5.19.2",
3
+ "version": "5.20.0",
4
4
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
5
5
  "mcpServers": {}
6
6
  }
@@ -13832,6 +13832,9 @@ var PriorityUpdatedEventPayloadSchema = strictObject({ id: string2(), change: _e
13832
13832
  // ../contracts/src/dispatch-api-limits.ts
13833
13833
  var MAX_ISSUE_BLOCKERS = 20;
13834
13834
  var MAX_ISSUE_ADVANCES = 20;
13835
+ var MAX_ISSUE_LABELS = 20;
13836
+ var ISSUE_LABEL_MAX = 40;
13837
+ var MAX_ISSUE_COMPONENTS = 50;
13835
13838
  var ISSUE_TITLE_MAX = 1000;
13836
13839
  var PROJECT_NAME_MAX = 80;
13837
13840
  var MAX_ISSUE_PAGE_LIMIT = 250;
@@ -14050,6 +14053,9 @@ var DecisionKeptEventPayloadSchema = strictObject({
14050
14053
  changed_version: number2().int()
14051
14054
  }).readonly();
14052
14055
 
14056
+ // ../contracts/src/go-blank.ts
14057
+ var goBlankPattern = /^[\t\n\v\f\r \u0085\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*$/u;
14058
+
14053
14059
  // ../contracts/src/dispatch-tools.ts
14054
14060
  function dispatchToolSchema(spec, z, opts) {
14055
14061
  const shape = spec.arguments(z);
@@ -14215,10 +14221,11 @@ var commentValidation = {
14215
14221
  message: COMMENT_RULE,
14216
14222
  refusal: (value) => commentProblem(value) ?? COMMENT_RULE
14217
14223
  };
14218
- var ISSUE_UPDATE_FIELDS_RULE = "Issue update requires at least one field besides issue: status, title, labels, priority, assignee, external_links, route, parent, blocked_by, advances, components, repo, before, or after.";
14224
+ var ISSUE_UPDATE_FIELDS_RULE = "Issue update requires at least one field besides issue: status, title, labels, labels_add, priority, assignee, external_links, route, parent, blocked_by, advances, components, repo, before, or after.";
14219
14225
  var ISSUE_UPDATE_DONE_RULE = "status done requires reason, a non-empty note saying why the issue is closing, posted on the issue before it closes so the close carries its note";
14220
14226
  var ISSUE_UPDATE_REASON_RULE = "reason goes only with status done";
14221
- var ISSUE_UPDATE_RULE = `${ISSUE_UPDATE_FIELDS_RULE} ${ISSUE_UPDATE_DONE_RULE}; ${ISSUE_UPDATE_REASON_RULE}.`;
14227
+ var ISSUE_UPDATE_LABELS_RULE = "labels_add goes without labels";
14228
+ var ISSUE_UPDATE_RULE = `${ISSUE_UPDATE_FIELDS_RULE} ${ISSUE_UPDATE_DONE_RULE}; ${ISSUE_UPDATE_REASON_RULE}; ${ISSUE_UPDATE_LABELS_RULE}.`;
14222
14229
  function issueUpdateProblem(value) {
14223
14230
  const input = value;
14224
14231
  if (input.status === "done") {
@@ -14229,7 +14236,10 @@ function issueUpdateProblem(value) {
14229
14236
  const status = typeof input.status === "string" ? `status ${input.status}` : "an update without status done";
14230
14237
  return `${ISSUE_UPDATE_REASON_RULE}: it is the note posted on the issue as it closes, and ${status} closes nothing. Drop reason, or set status done to close the issue.`;
14231
14238
  }
14232
- const changesAField = typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || typeof input.priority === "number" || input.priority === null || typeof input.assignee === "string" || input.assignee === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || Array.isArray(input.blocked_by) || Array.isArray(input.advances) || typeof input.components === "object" && input.components !== null || typeof input.repo === "string" || typeof input.before === "string" || typeof input.after === "string";
14239
+ if (input.labels !== undefined && input.labels_add !== undefined) {
14240
+ return `${ISSUE_UPDATE_LABELS_RULE}: labels replaces every label the issue holds and labels_add adds to them, so name the labels to add in labels_add alone, or the whole set in labels alone.`;
14241
+ }
14242
+ const changesAField = typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || Array.isArray(input.labels_add) || typeof input.priority === "number" || input.priority === null || typeof input.assignee === "string" || input.assignee === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || Array.isArray(input.blocked_by) || Array.isArray(input.advances) || typeof input.components === "object" && input.components !== null || typeof input.repo === "string" || typeof input.before === "string" || typeof input.after === "string";
14233
14243
  return changesAField ? undefined : ISSUE_UPDATE_FIELDS_RULE;
14234
14244
  }
14235
14245
  var messageValidation = {
@@ -14264,12 +14274,20 @@ var readValidation = {
14264
14274
  refusal: (value) => readProblem(value) ?? `${READ_OWNER_RULE} ${READ_MESSAGE_RULE} ${READ_HISTORY_RULE}`
14265
14275
  };
14266
14276
  var ISSUE_COMPONENTS_MODES = ["inherit", "explicit", "none"];
14277
+ var COMPONENTS_RULE = "components mode explicit names ids, and mode none names a reason.";
14267
14278
  function componentsArgument(z) {
14268
- return z.object({
14269
- mode: z.enum(ISSUE_COMPONENTS_MODES).describe("inherit: take the parent chain's attachment within the issue's own project (the default; deletes this issue's own). explicit: attach to ids. none: not architectural work, with reason."),
14270
- ids: z.array(z.string({ min: 1 }), { min: 1, max: 50 }).describe("For mode explicit: bare component ids from the project's architecture model (web, dispatch-server), not external ones.").optional(),
14271
- reason: z.string({ min: 1 }).describe("For mode none: why this issue is not architectural (process, hiring, ops).").optional()
14272
- }).describe("Attach the issue to architecture components. Attach the root before decomposing it; children inherit unless they choose.");
14279
+ return z.refineObject({
14280
+ mode: z.enum(ISSUE_COMPONENTS_MODES).describe("inherit: take the parent chain's attachment within the issue's own project (the default; deletes this issue's own). explicit: attach to ids, which it requires. none: not architectural work, with the reason it requires."),
14281
+ ids: z.array(z.string({ min: 1 }), { min: 1, max: MAX_ISSUE_COMPONENTS }).describe("Required for mode explicit: bare component ids from the project's architecture model (web, dispatch-server), not external ones.").optional(),
14282
+ reason: z.string({ min: 1 }).describe("Required for mode none: why this issue is not architectural (process, hiring, ops).").optional()
14283
+ }, (value) => {
14284
+ const input = value;
14285
+ if (input.mode === "explicit")
14286
+ return Array.isArray(input.ids) && input.ids.length > 0;
14287
+ if (input.mode === "none")
14288
+ return typeof input.reason === "string" && !goBlankPattern.test(input.reason);
14289
+ return true;
14290
+ }, COMPONENTS_RULE).describe(`Attach the issue to architecture components. Attach the root before decomposing it; children inherit unless they choose. ${COMPONENTS_RULE}`);
14273
14291
  }
14274
14292
  var SPEC_WRITING_POINTER = "Write a spec as skill://dispatch-writing-specs says.";
14275
14293
  var CI_CHECK_RULE = "A check block whose ci_check names the CI check run that proves it carries no run, keeps when " + "before_merge, names its negative_control, and holds no recorded result. A write that adds a " + "check block, or changes a check's ci_check, run, when or negative_control, so that it breaks " + "one of those rules is refused with 400 INVALID_CI_CHECK, which names the block and the rule. " + "A check that already holds a result never becomes CI's: write a new check block under a new id.";
@@ -14317,7 +14335,7 @@ var REVIEW_REASON_RULE = "verdict changes_requested requires reason, a non-empty
14317
14335
  var reviewValidation = {
14318
14336
  check: (value) => {
14319
14337
  const input = value;
14320
- return input.verdict !== "changes_requested" || typeof input.reason === "string" && input.reason.trim() !== "";
14338
+ return input.verdict !== "changes_requested" || typeof input.reason === "string" && !goBlankPattern.test(input.reason);
14321
14339
  },
14322
14340
  message: REVIEW_REASON_RULE
14323
14341
  };
@@ -14408,10 +14426,10 @@ var dispatchToolSpecs = [
14408
14426
  parent: z.string().describe("Optional parent issue, in any project.").optional(),
14409
14427
  blocked_by: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_BLOCKERS }).describe("Issue keys this issue waits on; a key of any project, so work tracked elsewhere can be named. Dispatch refuses a dependency cycle.").optional(),
14410
14428
  advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Ids of the deployment's priorities this issue advances, which dispatch priorities lists. A child inherits every priority the issues above it advance, so name here only what this issue adds.").optional(),
14411
- external: z.string().describe("Optional external issue reference.").optional(),
14429
+ external: z.string().describe("Optional external issue reference, owner/repo#n: the GitHub issue to import into the project this call names. A reference already imported into that project answers its issue and creates nothing; one already imported into another project is refused with 400 EXTERNAL_PROJECT_MISMATCH.").optional(),
14412
14430
  force: z.boolean().describe("Create even though POSSIBLE_DUPLICATE listed similar issues; pass it only after reading them.").optional(),
14413
14431
  spec: z.string().describe(`Optional initial primary-document markdown. ${SPEC_WRITING_POINTER}`).optional(),
14414
- labels: z.array(z.string({ min: 1, max: 40 }), { max: 20 }).describe("Optional initial labels, at most 20 labels of up to 40 characters.").optional(),
14432
+ labels: z.array(z.string({ min: 1, max: ISSUE_LABEL_MAX }), { max: MAX_ISSUE_LABELS }).describe(`Optional initial labels, at most ${MAX_ISSUE_LABELS} labels of up to ${ISSUE_LABEL_MAX} characters.`).optional(),
14415
14433
  priority: z.number({ int: true, min: 0, max: 3 }).describe("Optional coarse priority, a number from 0 to 3: 0 is highest and 3 is lowest.").optional(),
14416
14434
  assignee: z.string().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); defaults to your owner when you act for a person, else the parent's assignee, else the project's default assignee. Every project names a default assignee, so a new issue always has one. A parent in another project passes on no assignee. A question on it reaches the person it was handed to, else the issue's assignee, else the project's default assignee. Set it only when a person said who owns the issue.").optional(),
14417
14435
  components: componentsArgument(z).optional(),
@@ -14425,13 +14443,14 @@ var dispatchToolSpecs = [
14425
14443
  priority: 1,
14426
14444
  before: "DSP-2"
14427
14445
  },
14428
- description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, set or clear its assignee, link a URL (the pull request that delivers it, a " + "run, a document), set its " + "route, set or clear its parent, replace the issues it is blocked by, replace the " + "priorities it advances, attach it to " + "architecture components, set the repository it targets, or move it on its project's " + "board. Status is one of " + `${ISSUE_STATUSES.join(", ")}; outside Legion, move it yourself as the work advances; inside ` + "Legion the daemon moves it. A non-empty external_links is " + "merged into the issue's existing links by URL, so linking the pull request you just opened " + "keeps every earlier link; an empty external_links removes every link instead. components " + "replaces the issue's own attachment. Closing an issue " + "(status done) requires reason, the note that says why: it is posted on the issue as a " + "message, then the issue closes, so the close carries its note; closing an issue that is " + "already closed is refused (ISSUE_CLOSED) before anything is posted. Reason goes only " + "with status done. Closing an issue withdraws every open ask " + "it holds (resolution kind withdrawn, naming the closer), and reopening it brings exactly " + "those asks back. " + "A closed issue still takes messages and comments, though not asks or artifacts; of this " + "tool's fields it takes only a board move " + "(before, after), components, " + "a reopening status (any status but done), and an external_links write that adds no new " + "link (so a link can move to the issue that replaced it); everything else, priority " + "included, waits for the reopen. " + "priority is yours to set and a human overrides it. assignee is the person who answers " + "this issue's asks, and every ask on it waits on them until a person hands that ask on. " + "Passing null unassigns the issue, and every ask on it then waits on the project's default " + "assignee: a question reaches the person it was handed to, else the issue's assignee, else " + "the project's default assignee, so every question reaches a person. " + "Set the assignee when a person said who owns the work, as you " + "file the issue or hand it over. before and after move the issue on " + "its project's board: before puts it above that issue, after below, and both together " + "land it between them. A project's board order is one agent's to keep; in a Legion " + "deployment that is the controller. Never reassign an issue a person holds to get a " + "faster answer: who holds it is their call. At least one " + `field besides issue is required. ${ISSUE_REFERENCE}`,
14446
+ description: "Update an existing issue: move its lifecycle status, retitle it, add labels to it or " + "replace its labels, set " + "its priority, set or clear its assignee, link a URL (the pull request that delivers it, a " + "run, a document), set its " + "route, set or clear its parent, replace the issues it is blocked by, replace the " + "priorities it advances, attach it to " + "architecture components, set the repository it targets, or move it on its project's " + "board. Status is one of " + `${ISSUE_STATUSES.join(", ")}; outside Legion, move it yourself as the work advances; inside ` + "Legion the daemon moves it. labels_add adds labels and keeps every label the issue holds; " + "labels replaces the whole set, so a label it does not name is removed, and the two never " + "go together. A non-empty external_links is " + "merged into the issue's existing links by URL, so linking the pull request you just opened " + "keeps every earlier link; an empty external_links removes every link instead. components " + "replaces the issue's own attachment. Closing an issue " + "(status done) requires reason, the note that says why: it is posted on the issue as a " + "message, then the issue closes, so the close carries its note; closing an issue that is " + "already closed is refused (ISSUE_CLOSED) before anything is posted. Reason goes only " + "with status done. Closing an issue withdraws every open ask " + "it holds (resolution kind withdrawn, naming the closer), and reopening it brings exactly " + "those asks back. " + "A closed issue still takes messages and comments, though not asks or artifacts; of this " + "tool's fields it takes only a board move " + "(before, after), components, " + "a reopening status (any status but done), and an external_links write that adds no new " + "link (so a link can move to the issue that replaced it); everything else, priority " + "included, waits for the reopen. " + "priority is yours to set and a human overrides it. assignee is the person who answers " + "this issue's asks, and every ask on it waits on them until a person hands that ask on. " + "Passing null unassigns the issue, and every ask on it then waits on the project's default " + "assignee: a question reaches the person it was handed to, else the issue's assignee, else " + "the project's default assignee, so every question reaches a person. " + "Set the assignee when a person said who owns the work, as you " + "file the issue or hand it over. before and after move the issue on " + "its project's board: before puts it above that issue, after below, and both together " + "land it between them. A project's board order is one agent's to keep; in a Legion " + "deployment that is the controller. Never reassign an issue a person holds to get a " + "faster answer: who holds it is their call. At least one " + `field besides issue is required. ${ISSUE_REFERENCE}`,
14429
14447
  arguments: (z) => ({
14430
14448
  issue: z.string().describe(ISSUE_REFERENCE),
14431
14449
  status: z.enum(ISSUE_STATUSES).describe("New lifecycle status.").optional(),
14432
14450
  reason: z.string().describe(`Required with status done, and only with it: why the issue is closing. Posted on the issue as a message before it closes. ${BODY_BLOCK_RULE}`).optional(),
14433
14451
  title: z.string({ min: 1, max: ISSUE_TITLE_MAX }).describe("Replacement title, at most 1,000 characters.").optional(),
14434
- labels: z.array(z.string({ min: 1, max: 40 }), { max: 20 }).describe("Replacement label set, at most 20 labels of up to 40 characters; replaces every existing label.").optional(),
14452
+ labels: z.array(z.string({ min: 1, max: ISSUE_LABEL_MAX }), { max: MAX_ISSUE_LABELS }).describe(`Replacement label set, at most ${MAX_ISSUE_LABELS} labels of up to ${ISSUE_LABEL_MAX} characters; replaces every existing label, so a label it does not name is removed. To add labels and keep the others, use labels_add. Not with labels_add.`).optional(),
14453
+ labels_add: z.array(z.string({ min: 1, max: ISSUE_LABEL_MAX }), { max: MAX_ISSUE_LABELS }).describe(`Labels to add, at most ${MAX_ISSUE_LABELS} of up to ${ISSUE_LABEL_MAX} characters: each is added to the labels the issue holds when the write lands, and every label it holds stays; the issue holds at most ${MAX_ISSUE_LABELS} in all. Not with labels.`).optional(),
14435
14454
  priority: z.number({ int: true, min: 0, max: 3 }).nullable().optional().describe("Coarse priority: 0 is P0 (highest) through 3 is P3 (lowest); null clears it."),
14436
14455
  assignee: z.string().nullable().optional().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); null unassigns the issue, and every ask on it then waits on the project's default assignee. Set it only when a person said who owns the issue, never to move a question off the person holding it."),
14437
14456
  external_links: z.array(z.string({ min: 1 })).describe("URLs to link; a non-empty list merges into the issue's existing external links by URL, an empty list removes every link instead.").optional(),
@@ -14603,7 +14622,7 @@ var dispatchToolSpecs = [
14603
14622
  artifact: z.string().describe("Project document artifact id, slug, or filename containing the quoted text; optional when ref names it.").optional(),
14604
14623
  ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
14605
14624
  quote: z.string().describe("Exact document text to replace."),
14606
- replace_with: z.string().describe("Replacement text; a CR LF or a lone carriage return in it is written as a line feed."),
14625
+ replace_with: z.string().describe("Replacement markdown for the quoted text. Text alone stays in the quoted text's block; whole blocks " + "(paragraphs, lists, headings written with their #s) stand where the quoted text stood, and over a " + "heading's whole text they take the heading's place, so a heading that stays is written with its #s. " + "A table cell takes text alone. To move a section, write its blocks beside the whole text of the block " + "where it goes, and suggest each moved block's text replaced with nothing where it stood (an emptied " + "heading stays as its #s alone). A CR LF or a lone carriage return in it is written as a line feed."),
14607
14626
  body: z.string().describe(`Optional rationale. ${BODY_BLOCK_RULE}`).optional(),
14608
14627
  occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional()
14609
14628
  }),
@@ -14689,7 +14708,7 @@ var dispatchToolSpecs = [
14689
14708
  ops: [{ op: "delete_column", block: "table-123", index: 1 }],
14690
14709
  precondition: { blocks: [{ id: "table-123", token: "sha256:current-table-token" }] }
14691
14710
  },
14692
- 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. Work still to do is a task in the issue's plan, an issue, or an ask, never a separate document that lists it. ${OWNER_REFERENCE} ${SPEC_WRITING_POINTER}`,
14711
+ 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 whose whole text is the rest. 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. Work still to do is a task in the issue's plan, an issue, or an ask, never a separate document that lists it. ${OWNER_REFERENCE} ${SPEC_WRITING_POINTER}`,
14693
14712
  arguments: (z) => ({
14694
14713
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
14695
14714
  project: z.string().describe("Project key owning the document.").optional(),
@@ -14697,7 +14716,7 @@ var dispatchToolSpecs = [
14697
14716
  ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
14698
14717
  ops: z.array(z.object({
14699
14718
  op: z.enum(DOC_EDIT_OPS).describe("Edit operation."),
14700
- 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(),
14719
+ 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 at any level whose whole text is the rest. A delete of a block's entire text removes the block.").optional(),
14701
14720
  with: z.string().describe("Replacement text for replace, which every replace names: an empty value deletes the match on purpose. A replace takes op, find, with and occurrence alone, and one without with, or carrying any other key whatever it holds, is refused before it is sent, and by the server with 400 REPLACE_FIELDS, the document unchanged. Inside a code block, with is 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(),
14702
14721
  occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based match occurrence.").optional(),
14703
14722
  markdown: z.string().describe("Markdown to insert; a CR LF or a lone carriage return in it is written as a line feed.").optional(),
@@ -14831,12 +14850,12 @@ var dispatchToolSpecs = [
14831
14850
  {
14832
14851
  name: "dispatch_read",
14833
14852
  example: { issue: "DSP-1" },
14834
- description: "Read an issue or document summary, targeted ask, or targeted comment reply chain, or the conversation " + "a message belongs to. Do not use it for document contents; use dispatch doc-read instead. Supply ref, issue, " + "issue plus artifact (one of its documents), project plus artifact, or project alone, which lists the project's documents on no issue and nothing more; or message alone, which reads a human's direct message to this session and every " + "reply to it (they belong to no issue). A document summary names its issue, reference, versions and approval. " + "An issue read lists every document, picture and file the issue holds under `Documents:`, each by slug, filename and kind. " + "An anchored comment or ask also says where its quote sits, as `Position:`: the block's path from the top, " + "and in a table the row (0 is the header), the cells before the anchored one, and the column's header; " + "`Position: unavailable (<code>)` when Dispatch could not read the document: `DOC_SERVICE_UNAVAILABLE` " + "(try again shortly), `DOC_SCHEMA` (the document needs repair), `DOC_NEWER_CONTENT` (this Dispatch " + "build cannot read an element of the document; try again in one minute), `DOCUMENT_UNLOADABLE` (the " + "document's stored history cannot load; a person decides whether to rebuild it) or `INTERNAL`. " + "An issue read carries a `Progress:` line, `tasks 3/7, children 2/5`: its spec's task-list items " + "(`- [ ]` / `- [x]`, nested lists included) and its direct children, each done of total and each only " + "when it has any (`Progress: none` otherwise). " + "An issue whose spec marks requirements carries one `Coverage:` line per gap, `Coverage: R3 has no check` or " + "`Coverage: R3 has no plan task` (the second only once the issue has a plan document), counting the `check` and " + "`plan_task` blocks of every document of the issue and of its descendants; a spec that marks none reads " + "`Coverage: the spec marks no requirements`. Nothing is refused for a gap. " + `An issue read, and its dispatch://KEY/log, lists the issue's last ${DEFAULT_ISSUE_READ_EVENTS} events, oldest first; ` + "--events N lists the last N, and --all-events every one. " + "A comment reply chain names the comment each nested reply answers as `Answers: <comment id>`. " + "An edited post reads with the time of its edit, and a deleted one with who deleted it and when, in place of its body; " + "--history, with a ref naming that comment or message, lists the post's history newest first: each body an edit or the delete replaced, with the actor and the time, and of a deleted post each entry's actor and time with no body. " + "Every read ends with `Referenced by:` (what cites or hangs off this node, each with its dispatch:// address, " + "an excerpt, and when) and `Links:` (what it cites), so tracing provenance is one call. " + "A block read prints `Block:`, `Type:` for a block of a document, `Document:`, every attribute a typed block carries " + "(a `check`'s serves, surface, run, when, negative_control and ci_check; a `plan_task`'s serves and needs), `Changed in version:` " + "and `Text:`, then those two sections; a pinned one adds " + "the block's text at that version and whether it is unchanged, changed or removed since, and an absent block, unpinned, " + "reads `No block <id> in <document>.` " + "The pictures the shown messages, asks and comments embed come back as images you see, newest first, at most 8 " + "and 10 MiB of them per read, each a PNG, JPEG, GIF or WebP of at most 3,750,000 bytes (5 MB of base64); a `Pictures:` section names each " + "one shown, in order, and the rest by reference, for dispatch doc-read. A picture this session was already shown is named, not sent again " + "(every request carries the session's history, and the provider refuses one over 32 MB); dispatch doc-read shows it again. " + OWNER_REFERENCE,
14853
+ description: "Read an issue or document summary, targeted ask, or targeted comment reply chain, or the conversation " + "a message belongs to. Do not use it for document contents; use dispatch doc-read instead. Supply ref, issue, " + "issue plus artifact (one of its documents), project plus artifact, or project alone, which lists the project's documents on no issue and nothing more; or message alone, which reads a human's direct message to this session and every " + "reply to it (they belong to no issue). A document summary names its issue, reference, versions and approval. " + "An issue read lists every document, picture and file the issue holds under `Documents:`, each by slug, filename and kind. " + "An anchored comment or ask also says where its quote sits, as `Position:`: the block's path from the top, " + "and in a table the row (0 is the header), the cells before the anchored one, and the column's header; " + "`Position: unavailable (<code>)` when Dispatch could not read the document: `DOC_SERVICE_UNAVAILABLE` " + "(try again shortly), `DOC_SCHEMA` (the document needs repair), `DOC_NEWER_CONTENT` (this Dispatch " + "build cannot read an element of the document; try again in one minute), `DOCUMENT_UNLOADABLE` (the " + "document's stored history cannot load; a person decides whether to rebuild it) or `INTERNAL`. " + "An issue read carries a `Progress:` line, `tasks 3/7, children 2/5`: its spec's task-list items " + "(`- [ ]` / `- [x]`, nested lists included) and its direct children, each done of total and each only " + "when it has any (`Progress: none` otherwise). " + "An issue whose spec marks requirements carries one `Coverage:` line per gap, `Coverage: R3 has no check` or " + "`Coverage: R3 has no plan task` (the second only once the issue has a plan document), counting the `check` and " + "`plan_task` blocks of every document of the issue and of its descendants; a spec that marks none reads " + "`Coverage: the spec marks no requirements`. Nothing is refused for a gap. " + `An issue read, and its dispatch://KEY/log, lists the issue's last ${DEFAULT_ISSUE_READ_EVENTS} events, oldest first; ` + "--events N lists the last N, and --all-events every one. " + "An issue's dispatch://KEY/comments lists every comment on the issue. " + "A comment reply chain names the comment each nested reply answers as `Answers: <comment id>`. " + "An edited post reads with the time of its edit, and a deleted one with who deleted it and when, in place of its body; " + "--history, with a ref naming that comment or message, lists the post's history newest first: each body an edit or the delete replaced, with the actor and the time, and of a deleted post each entry's actor and time with no body. " + "Every read ends with `Referenced by:` (what cites or hangs off this node, each with its dispatch:// address, " + "an excerpt, and when) and `Links:` (what it cites), so tracing provenance is one call. " + "A block read prints `Block:`, `Type:` for a block of a document, `Document:`, every attribute a typed block carries " + "(a `check`'s serves, surface, run, when, negative_control and ci_check; a `plan_task`'s serves and needs), `Changed in version:` " + "and `Text:`, then those two sections; a pinned one adds " + "the block's text at that version and whether it is unchanged, changed or removed since, and an absent block, unpinned, " + "reads `No block <id> in <document>.` " + "The pictures the shown messages, asks and comments embed come back as images you see, newest first, at most 8 " + "and 10 MiB of them per read, each a PNG, JPEG, GIF or WebP of at most 3,750,000 bytes (5 MB of base64); a `Pictures:` section names each " + "one shown, in order, and the rest by reference, for dispatch doc-read. A picture this session was already shown is named, not sent again " + "(every request carries the session's history, and the provider refuses one over 32 MB); dispatch doc-read shows it again. " + OWNER_REFERENCE,
14835
14854
  arguments: (z) => ({
14836
14855
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
14837
14856
  project: z.string().describe("Project key owning the document.").optional(),
14838
14857
  artifact: z.string().describe("Document artifact id, slug, or filename: one of the issue's, or a project document.").optional(),
14839
- ref: z.string().describe("Optional dispatch:// reference: dispatch://KEY, dispatch://KEY/spec, " + "dispatch://KEY/artifact/<slug>[@vN], dispatch://KEY/ask/<id>, dispatch://KEY/comment/<id>, " + "dispatch://KEY/message/<id>, dispatch://PROJECT/artifact/<slug>[@vN], and its " + "/ask/<id> and /comment/<id>; or the dashboard URL of one. A block: " + "dispatch://KEY/spec#b-<block id>[@vN], dispatch://KEY/artifact/<slug>#b-<block id>[@vN] or " + "dispatch://PROJECT/artifact/<slug>#b-<block id>[@vN], the id percent-encoded except ASCII " + "letters, digits and -.").optional(),
14858
+ ref: z.string().describe("Optional dispatch:// reference: dispatch://KEY, dispatch://KEY/spec, dispatch://KEY/comments, " + "dispatch://KEY/artifact/<slug>[@vN], dispatch://KEY/ask/<id>, dispatch://KEY/comment/<id>, " + "dispatch://KEY/message/<id>, dispatch://PROJECT/artifact/<slug>[@vN], and its " + "/ask/<id> and /comment/<id>; or the dashboard URL of one. A block: " + "dispatch://KEY/spec#b-<block id>[@vN], dispatch://KEY/artifact/<slug>#b-<block id>[@vN] or " + "dispatch://PROJECT/artifact/<slug>#b-<block id>[@vN], the id percent-encoded except ASCII " + "letters, digits and -.").optional(),
14840
14859
  message: z.string().describe("A message id (uuid): reads the conversation it belongs to, the root message and every " + "reply. Name nothing else with it.").optional(),
14841
14860
  events: z.number({ int: true, min: 1 }).describe(`How many of the issue's newest events an issue read or its dispatch://KEY/log lists, oldest first; default ${DEFAULT_ISSUE_READ_EVENTS}. Name no --all-events with it.`).optional(),
14842
14861
  all_events: z.boolean().describe(`List every one of the issue's events, oldest first, on an issue read or its dispatch://KEY/log, in place of the last ${DEFAULT_ISSUE_READ_EVENTS}. Name no --events with it.`).optional(),
@@ -18203,10 +18222,10 @@ function parseDispatchRef(ref) {
18203
18222
  artifact
18204
18223
  };
18205
18224
  }
18206
- const issueReference = ref.match(/^dispatch:\/\/([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)(?:\/(spec)|\/(log|activity)|\/(children)|\/artifact\/([^/@]+)(?:@v(\d+))?|\/ask\/([^/]+)|\/comment\/([^/]+)|\/message\/([^/]+))?$/);
18225
+ const issueReference = ref.match(/^dispatch:\/\/([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)(?:\/(spec)|\/(log|activity)|\/(children)|\/(comments)|\/artifact\/([^/@]+)(?:@v(\d+))?|\/ask\/([^/]+)|\/comment\/([^/]+)|\/message\/([^/]+))?$/);
18207
18226
  if (!issueReference)
18208
18227
  return null;
18209
- const [, issue, spec, log, children, artifact, version, ask, comment, message] = issueReference;
18228
+ const [, issue, spec, log, children, comments, artifact, version, ask, comment, message] = issueReference;
18210
18229
  if (!issue || version !== undefined && Number(version) < 1)
18211
18230
  return null;
18212
18231
  const owner = { kind: "issue", issue };
@@ -18216,6 +18235,8 @@ function parseDispatchRef(ref) {
18216
18235
  return { owner, kind: "log", id: log };
18217
18236
  if (children)
18218
18237
  return { owner, kind: "children", id: children };
18238
+ if (comments)
18239
+ return { owner, kind: "comments", id: comments };
18219
18240
  if (artifact) {
18220
18241
  return {
18221
18242
  owner,
@@ -23025,6 +23046,19 @@ function parseDispatchFrame(rawPayload, wholeBody) {
23025
23046
  delivery: undefined
23026
23047
  };
23027
23048
  }
23049
+ var INBOUND_CARD_MAX_BYTES = 1 << 20;
23050
+ function encodeWithin(value, maxBytes) {
23051
+ const lines = [];
23052
+ let bytes = -1;
23053
+ for (const line of encodeLines(value)) {
23054
+ bytes += Buffer.byteLength(line) + 1;
23055
+ if (bytes > maxBytes)
23056
+ return;
23057
+ lines.push(line);
23058
+ }
23059
+ return lines.join(`
23060
+ `);
23061
+ }
23028
23062
  function inboundTimestamp(milliseconds) {
23029
23063
  if (milliseconds === undefined)
23030
23064
  return "unknown";
@@ -23260,17 +23294,22 @@ function renderInbound(raw, sessionID, subject, wholeBody) {
23260
23294
  },
23261
23295
  ...unrecognised === undefined ? {} : { unrecognised }
23262
23296
  };
23297
+ const payloadKey = dispatchRendered ? "dispatch" : "message";
23298
+ const payloadValue = dispatchRendered ? dispatchEvent : message;
23299
+ const cardBound = Math.max(INBOUND_CARD_MAX_BYTES, 2 * (Buffer.byteLength(raw) + (wholeBody === undefined ? 0 : Buffer.byteLength(escapeString(wholeBody)))));
23263
23300
  let card;
23264
23301
  let payloadShownAsText;
23265
23302
  try {
23266
- card = encode3({ envoy: rendered });
23303
+ card = typeof payloadValue === "object" && payloadValue !== null ? encodeWithin({ envoy: rendered }, cardBound) : encode3({ envoy: rendered });
23267
23304
  } catch (error) {
23268
- const payloadKey = dispatchRendered ? "dispatch" : "message";
23269
- if (envelope.payload === undefined || !(payloadKey in rendered))
23305
+ if (envelope.payload === undefined || payloadValue === undefined)
23270
23306
  throw error;
23271
- card = encode3({ envoy: { ...rendered, [payloadKey]: envelope.payload } });
23272
23307
  payloadShownAsText = messageFor(error);
23273
23308
  }
23309
+ if (card === undefined) {
23310
+ payloadShownAsText ??= `its layout is larger than the ${cardBound} bytes a card holds`;
23311
+ card = encode3({ envoy: { ...rendered, [payloadKey]: envelope.payload } });
23312
+ }
23274
23313
  return {
23275
23314
  skip: false,
23276
23315
  content: trailer === "" ? card : `${card}
@@ -23998,7 +24037,7 @@ function itemReplyTo(args, field) {
23998
24037
  return block === undefined ? { id: replyTo } : { id: block.item.id, block: block.block };
23999
24038
  }
24000
24039
  function innerRefProblem(tool, ref, refText) {
24001
- if (ref.kind !== "ask" && ref.kind !== "comment" && ref.kind !== "message" && ref.kind !== "log" && ref.kind !== "children" && ref.kind !== "block") {
24040
+ if (ref.kind !== "ask" && ref.kind !== "comment" && ref.kind !== "message" && ref.kind !== "log" && ref.kind !== "children" && ref.kind !== "comments" && ref.kind !== "block") {
24002
24041
  return;
24003
24042
  }
24004
24043
  if (tool === "dispatch_read" || tool === "dispatch_ask")
@@ -24009,7 +24048,7 @@ function innerRefProblem(tool, ref, refText) {
24009
24048
  const ownerArguments = ref.owner.kind === "issue" ? `issue ${ref.owner.issue}${documentArgument}` : `project ${ref.owner.project} and artifact ${ref.artifact}`;
24010
24049
  const partRef = ref.pin === undefined ? refText : refText.slice(0, -`@v${ref.pin}`.length);
24011
24050
  const fix = tool === "dispatch_comment" && itemKind === "ask" ? `reply under it with reply_to_ask ${ref.item === undefined ? ref.id : partRef} and ${ownerArguments}` : tool === "dispatch_comment" && itemKind === "comment" ? `reply in its thread with reply_to ${ref.id} and ${ownerArguments}` : `read it with dispatch read, or name ${owner} with ${ownerArguments}`;
24012
- const item = ref.kind === "ask" ? "an ask" : ref.kind === "log" ? "the event log" : ref.kind === "children" ? "the children" : ref.kind === "block" ? `block ${ref.block}${ref.item === undefined ? "" : ` of ${article(ref.item.kind)}`}` : `a ${ref.kind}`;
24051
+ const item = ref.kind === "ask" ? "an ask" : ref.kind === "log" ? "the event log" : ref.kind === "children" ? "the children" : ref.kind === "comments" ? "the comments" : ref.kind === "block" ? `block ${ref.block}${ref.item === undefined ? "" : ` of ${article(ref.item.kind)}`}` : `a ${ref.kind}`;
24013
24052
  return `ref ${refText} names ${item} on ${owner}; dispatch ${commandName(tool)} would act on ${owner} and drop the ${ref.kind}: ${fix}`;
24014
24053
  }
24015
24054
  var documentItemPattern = /^dispatch:\/\/([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)\/artifact\/[^/@]+(?:@v\d+)?\/(ask|comment)\/([^/]+)$/;
@@ -24190,6 +24229,8 @@ function readWithoutEvents(args) {
24190
24229
  return "a message's conversation";
24191
24230
  case "children":
24192
24231
  return "the issue's children";
24232
+ case "comments":
24233
+ return "the issue's comments";
24193
24234
  case "log":
24194
24235
  return;
24195
24236
  }
@@ -25943,6 +25984,7 @@ async function issueUpdateCommand(context) {
25943
25984
  const priority = optionalPriority(args, "priority");
25944
25985
  const assignee = optionalNullableString(args, "assignee");
25945
25986
  const labels = Array.isArray(args.labels) ? args.labels : undefined;
25987
+ const labelsAdd = optionalStringArray(args, "labels_add");
25946
25988
  const blockedBy = Array.isArray(args.blocked_by) ? args.blocked_by : undefined;
25947
25989
  const advances = optionalStringArray(args, "advances");
25948
25990
  const advancesRevision = optionalNumber(args, "advances_revision");
@@ -25989,6 +26031,7 @@ async function issueUpdateCommand(context) {
25989
26031
  ...status === undefined ? {} : { status },
25990
26032
  ...title === undefined ? {} : { title },
25991
26033
  ...labels === undefined ? {} : { labels },
26034
+ ...labelsAdd === undefined ? {} : { labels_add: labelsAdd },
25992
26035
  ...priority === undefined ? {} : { priority },
25993
26036
  ...assignee === undefined ? {} : { assignee },
25994
26037
  ...route === undefined ? {} : { route },
@@ -26027,8 +26070,8 @@ async function issueUpdateCommand(context) {
26027
26070
  ...closingNote === undefined ? [] : [`reason posted as message ${closingNote.id} (${closingNote.ref})`],
26028
26071
  ...status === undefined ? [] : [`status ${before.status} -> ${after.status}`],
26029
26072
  ...title === undefined ? [] : [`title "${after.title}"`],
26030
- ...labels === undefined ? [] : [
26031
- (after.labels ?? []).length === 0 ? "labels cleared" : `labels ${(after.labels ?? []).join(", ")}`
26073
+ ...labels === undefined && labelsAdd === undefined ? [] : [
26074
+ (after.labels ?? []).length > 0 ? `labels ${(after.labels ?? []).join(", ")}` : labels === undefined ? "labels none" : "labels cleared"
26032
26075
  ],
26033
26076
  ...priority === undefined ? [] : [after.priority === null ? "priority cleared" : `priority -> P${after.priority}`],
26034
26077
  ...assignee === undefined ? [] : [after.assignee === null ? "assignee cleared" : `assignee -> ${after.assignee}`],
@@ -26448,6 +26491,21 @@ function commentSummary({ comment, replies }, graph) {
26448
26491
  ].join(`
26449
26492
  `);
26450
26493
  }
26494
+ function commentsSummary(issueKey, comments) {
26495
+ return [
26496
+ `Comments: ${issueKey}`,
26497
+ ...comments.length === 0 ? ["- none"] : comments.flatMap((comment) => [
26498
+ `${comment.id} \xB7 ${actorText(comment.author)} \xB7 ${comment.created_at}`,
26499
+ ...anchorLines(comment),
26500
+ ...replyBlockLines(comment),
26501
+ ...comment.reply_to === null ? [] : [`Reply to: ${comment.reply_to}`],
26502
+ ...comment.answers != null && comment.answers !== comment.reply_to ? [`Answers: ${comment.answers}`] : [],
26503
+ ...comment.ask_id == null ? [] : [`Ask: ${comment.ask_id}`],
26504
+ ...postBodyLines(comment)
26505
+ ])
26506
+ ].join(`
26507
+ `);
26508
+ }
26451
26509
  function replyBlockLines(record) {
26452
26510
  const block = record.reply_block;
26453
26511
  if (block === undefined || block === null)
@@ -27118,9 +27176,6 @@ async function sendToAgentCommand(context) {
27118
27176
  // ../envoy-client/src/dispatch-commands/documents.ts
27119
27177
  import { resolve as resolvePath2 } from "path";
27120
27178
 
27121
- // ../contracts/src/go-blank.ts
27122
- var goBlankPattern = /^[\t\n\v\f\r \u0085\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*$/u;
27123
-
27124
27179
  // ../envoy-client/src/typed-block-opener.ts
27125
27180
  function runOf(text, index, char) {
27126
27181
  let end = index;
@@ -28438,6 +28493,19 @@ async function readCommand(context) {
28438
28493
  details: { issue: parent.key }
28439
28494
  };
28440
28495
  }
28496
+ if (ownerArguments.ref?.kind === "comments") {
28497
+ const [owner, comments] = await Promise.all([
28498
+ client.getIssue(issueKey),
28499
+ client.getComments(issueKey)
28500
+ ]);
28501
+ const pictures = await picturesOf(datedBodies(comments));
28502
+ return {
28503
+ text: [commentsSummary(owner.key, comments), ...pictures.lines].join(`
28504
+ `),
28505
+ details: { issue: owner.key },
28506
+ ...showImages(pictures)
28507
+ };
28508
+ }
28441
28509
  const readPromise = client.read(issueKey, readEvents);
28442
28510
  const referencesPromise = issueReferencesOrUnavailable(client, issueKey);
28443
28511
  const read = await readPromise;