@sjawhar/claude-envoy 1.36.0 → 1.38.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": "1.36.0"
5
+ "version": "1.38.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "1.36.0",
3
+ "version": "1.38.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
  }
package/dist/dispatch.js CHANGED
@@ -14738,8 +14738,9 @@ var askEventPayloadFields = {
14738
14738
  primary: boolean2().optional()
14739
14739
  }).optional(),
14740
14740
  resolution: object({
14741
- kind: _enum2(["retracted", "resolved", "withdrawn"]).optional(),
14741
+ kind: string2().optional(),
14742
14742
  reason: string2().optional(),
14743
+ dispatch_words: string2().optional(),
14743
14744
  actor: object({ kind: string2().optional(), id: string2().optional() }).passthrough().optional(),
14744
14745
  at: string2().optional()
14745
14746
  }).nullish(),
@@ -15431,7 +15432,7 @@ var dispatchToolSpecs = [
15431
15432
  kind: "retracted",
15432
15433
  reason: "A newer question supersedes this one."
15433
15434
  },
15434
- description: "Retract an open question that is moot or resolve one after finding the answer. This closes " + "the question without answering it. An ask that lives as an `ask` block in a document is " + 'closed in the document too. A reason beginning "removed from the document in version" is ' + "refused: that marks a retraction the document's own settlement wrote. Use retracted for an ask " + "a newer one replaces or the design made moot, resolved for one whose answer you found; an " + "answered ask cannot be resolved, and resolving records no decision by a person. An issue's " + "close withdrew its open asks (kind withdrawn, which only Dispatch writes, never this tool); " + "an ask on a closed issue is refused (409 ISSUE_CLOSED): reopen the issue first.",
15435
+ description: "Retract an open question that is moot or resolve one after finding the answer. This closes " + "the question without answering it. An ask that lives as an `ask` block in a document is " + 'closed in the document too. A reason beginning "removed from the document in version" is ' + "refused: that marks a retraction the document's own settlement wrote. Use retracted for an ask " + "a newer one replaces or the design made moot, resolved for one whose answer you found; an " + "answered ask cannot be resolved, and resolving records no decision by a person. An issue's " + "close withdrew its open asks (kind withdrawn, which only Dispatch writes, never this tool); " + "a person who chose not to answer declined the ask on a route of their own (kind declined, " + "which only they write, never this tool); " + "an ask on a closed issue is refused (409 ISSUE_CLOSED): reopen the issue first.",
15435
15436
  arguments: (z) => ({
15436
15437
  ask: z.string().describe("Ask id (uuid) to close; an 8+ hex prefix unique among this session's own open asks " + "works too."),
15437
15438
  kind: z.enum(["retracted", "resolved"]).describe("Whether the ask is retracted or self-resolved."),
@@ -17607,6 +17608,13 @@ function textHead(text, length = HEAD_LENGTH) {
17607
17608
  const flat = text.replace(/\s+/g, " ").trim();
17608
17609
  return flat.length > length ? `${flat.slice(0, length)}\u2026` : flat;
17609
17610
  }
17611
+ var QUESTION_HEAD = 200;
17612
+ var DISPATCH_WORDS_LABEL = "Dispatch's words:";
17613
+ function dispatchWordsText(words, render) {
17614
+ if (words === null || words === undefined || words === "")
17615
+ return;
17616
+ return `${DISPATCH_WORDS_LABEL} ${render === undefined ? words : render(words)}`;
17617
+ }
17610
17618
  function askAnswerText(answer) {
17611
17619
  if (answer === null || answer === undefined)
17612
17620
  return "";
@@ -19799,7 +19807,9 @@ function askResolutionText(resolution) {
19799
19807
  return;
19800
19808
  const kind = resolution.kind ?? "resolved";
19801
19809
  const reason = resolution.reason ?? "";
19802
- return reason === "" ? kind : `${kind}: ${reason}`;
19810
+ const closed = reason === "" ? kind : `${kind}: ${reason}`;
19811
+ const words = dispatchWordsText(resolution.dispatch_words);
19812
+ return words === undefined ? closed : `${closed} \xB7 ${words}`;
19803
19813
  }
19804
19814
  function dispatchCompact(event, comment) {
19805
19815
  if (event.type === "artifact.human_edited") {
@@ -20563,7 +20573,14 @@ function answerLines(lead, answer) {
20563
20573
  ];
20564
20574
  }
20565
20575
  function resolutionText(resolution) {
20566
- return `${resolution.kind} by ${actorText(resolution.actor)} at ${resolution.at}: ${indentedText(resolution.reason)}`;
20576
+ const closed = `${resolution.kind} by ${actorText(resolution.actor)} at ${resolution.at}`;
20577
+ const parts = [
20578
+ resolution.reason === "" ? closed : `${closed}: ${indentedText(resolution.reason)}`
20579
+ ];
20580
+ const words = dispatchWordsText(resolution.dispatch_words, indentedText);
20581
+ if (words !== undefined)
20582
+ parts.push(words);
20583
+ return parts.join(" \xB7 ");
20567
20584
  }
20568
20585
  function askStateLines(ask) {
20569
20586
  if (ask === undefined) {
@@ -20709,6 +20726,26 @@ function decisionBlockLines(advice, context) {
20709
20726
  ];
20710
20727
  }
20711
20728
  }
20729
+ function declinedAskLines(advice, issueKey, configUrl) {
20730
+ try {
20731
+ const declined = advice?.declined_asks;
20732
+ if (declined === undefined || declined === null || declined.length === 0)
20733
+ return [];
20734
+ const count = declined.length;
20735
+ const lines = [
20736
+ count === 1 ? "This issue holds a question a person declined to answer. Ask it again only if the facts have changed:" : `This issue holds ${count} questions a person declined to answer. Ask one again only if the facts have changed:`
20737
+ ];
20738
+ for (const ask of declined) {
20739
+ const href = absoluteHref(`/issues/${encodeURIComponent(issueKey)}/asks/${encodeURIComponent(ask.id)}`, configUrl);
20740
+ lines.push(`- Declined: ${ask.question} \u2192 ${href}`);
20741
+ if (ask.note !== "")
20742
+ lines.push(` Their note: ${ask.note}`);
20743
+ }
20744
+ return lines;
20745
+ } catch (error) {
20746
+ return [`The issue's declined asks could not be shown: ${messageFor(error)}`];
20747
+ }
20748
+ }
20712
20749
  function relatedCheckForm(suggestions, context) {
20713
20750
  const form = relatedCheckFormOf(suggestions);
20714
20751
  if (form.form === "not_made") {
@@ -20803,12 +20840,12 @@ var SESSION_ANSWERS_MAX_CHARS = 8000;
20803
20840
  var SESSION_ANSWERS_DEADLINE_MS = 800;
20804
20841
  var READ_TIMEOUT_MS = 1e4;
20805
20842
  var NO_ROUTE_BACKOFF_MS = 5 * 60000;
20806
- var QUESTION_MAX = 200;
20807
20843
  var SESSION_ANSWERS_MARKER = "[Dispatch: what people wrote to this session in the last 72 hours, newest first, word for word. Reference, not a new request.]";
20808
20844
  var FAILURE_MARKER = "[Dispatch: people's answers from the last 72 hours could not be read (";
20809
20845
  var NO_ANSWERS_ROUTE_REASON = "this Dispatch build has no answers route";
20810
20846
  var RELATION_PHRASES = {
20811
20847
  answered_your_ask: "answered your ask",
20848
+ declined_your_ask: "declined to answer your ask",
20812
20849
  replied_on_your_ask: "replied on your ask",
20813
20850
  replied_in_a_comment_thread: "replied in a comment thread",
20814
20851
  commented_on_a_document: "commented on a document",
@@ -20833,13 +20870,15 @@ function renderSessionAnswerItem(item) {
20833
20870
  const where = item.ref === null ? `Direct message ${item.id}, on no issue` : owner === undefined ? item.ref : `${item.ref} \xB7 ${owner}`;
20834
20871
  const lines = [head.join(" \xB7 "), where];
20835
20872
  if (item.ask !== undefined) {
20836
- const question = item.ask.question.replace(/\s+/g, " ").trim();
20837
- lines.push(`Question: ${question.length > QUESTION_MAX ? `${question.slice(0, QUESTION_MAX)}\u2026` : question}`);
20873
+ lines.push(`Question: ${textHead(item.ask.question, QUESTION_HEAD)}`);
20838
20874
  }
20839
20875
  if (item.kind === "answer") {
20840
20876
  const selected = item.selected ?? [];
20841
20877
  lines.push(`Selected: ${selected.length === 0 ? "none" : selected.join(", ")}`);
20842
20878
  }
20879
+ const words = dispatchWordsText(item.dispatch_words);
20880
+ if (words !== undefined)
20881
+ lines.push(words);
20843
20882
  if (item.text !== "")
20844
20883
  lines.push(item.text);
20845
20884
  return lines.join(`
@@ -22648,6 +22687,7 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
22648
22687
  `${reply.id} \xB7 ${actorText(reply.author)}`,
22649
22688
  `Body: ${reply.body}`
22650
22689
  ]);
22690
+ const resolutionWords = dispatchWordsText(ask.resolution?.dispatch_words);
22651
22691
  return [
22652
22692
  `Question: ${ask.question}`,
22653
22693
  ...anchorLines(ask),
@@ -22674,7 +22714,8 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
22674
22714
  "Resolution:",
22675
22715
  `- By: ${ask.resolution.actor.id}`,
22676
22716
  `- Kind: ${ask.resolution.kind}`,
22677
- `- Reason: ${ask.resolution.reason}`
22717
+ ...ask.resolution.reason === "" ? [] : [`- Reason: ${ask.resolution.reason}`],
22718
+ ...resolutionWords === undefined ? [] : [`- ${resolutionWords}`]
22678
22719
  ],
22679
22720
  "Replies:",
22680
22721
  ...chain.length === 0 ? ["- none"] : chain,
@@ -23818,16 +23859,19 @@ async function executeDispatchTool(input) {
23818
23859
  };
23819
23860
  const ask = resolved?.owner.kind === "project" ? await client.artifactAsk(resolved.artifact.id, askInput) : await client.ask(issue(), askInput);
23820
23861
  const askOwner = ask.issue_key !== null ? issueTopic(ask.issue_key) : resolved === undefined ? issueTopic(issue()) : documentTopic(resolved.artifact);
23821
- const checkLines = relatedCheckLines(ask.advice?.suggestions, {
23862
+ const checkContext = {
23822
23863
  project: resolved?.artifact.project ?? (ask.issue_key ?? "").replace(/-[0-9]+$/, ""),
23823
23864
  text: stringArg(args, "question"),
23824
23865
  configUrl: linkBase
23825
- });
23866
+ };
23867
+ const checkLines = relatedCheckLines(ask.advice?.suggestions, checkContext);
23868
+ const declinedLines = ask.issue_key === null ? [] : declinedAskLines(ask.advice, ask.issue_key, linkBase);
23826
23869
  const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, askOwner.label, ask.advice, {}));
23827
23870
  return {
23828
23871
  text: [
23829
23872
  `Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency}): ${ask.question}`,
23830
23873
  ...checkLines,
23874
+ ...declinedLines,
23831
23875
  await followsAsk(askOwner, input.subscriptions),
23832
23876
  ...adviceLines
23833
23877
  ].join(`
@@ -24044,17 +24088,20 @@ async function executeDispatchTool(input) {
24044
24088
  const lostText = lostOps === undefined || lostOps !== null && lostOps.length === 0 ? "" : lostOps === null ? "; could not confirm this edit survived, because the live document is being reloaded or holds a tree too deep to read \u2014 re-read it" : `; ${versionText} carries text the live document no longer has: a concurrent change removed what ${lostOps.length === 1 ? "operation" : "operations"} ${lostOps.join(", ")} wrote \u2014 re-read the document`;
24045
24089
  const applied = `${head}${unchangedText}${lostText}`;
24046
24090
  const editAskText = ops.map((operation) => /^:{3,}ask\{.*\n([\s\S]*)/mu.exec(operation.markdown ?? operation.with ?? "")?.[1]).find((text) => text !== undefined) ?? resolved.issue?.title ?? "";
24047
- const checkLines = decisionBlockLines(edited.advice, {
24091
+ const checkContext = {
24048
24092
  project: resolved.artifact.project,
24049
24093
  text: editAskText,
24050
24094
  configUrl: linkBase
24051
- });
24095
+ };
24096
+ const checkLines = decisionBlockLines(edited.advice, checkContext);
24097
+ const declinedLines = resolved.issue === undefined ? [] : declinedAskLines(edited.advice, resolved.issue.key, linkBase);
24052
24098
  const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {}));
24053
24099
  const tokenTrailer = edited.token === undefined ? [] : [`Document token: ${edited.token}`];
24054
24100
  return {
24055
24101
  text: [
24056
24102
  `${applied}${await notSubscribed(resolvedTopic(resolved), input.subscriptions)}`,
24057
24103
  ...checkLines,
24104
+ ...declinedLines,
24058
24105
  ...tokenTrailer,
24059
24106
  ...adviceLines
24060
24107
  ].join(`
@@ -36387,8 +36387,9 @@ var askEventPayloadFields = {
36387
36387
  primary: boolean2().optional()
36388
36388
  }).optional(),
36389
36389
  resolution: object({
36390
- kind: _enum2(["retracted", "resolved", "withdrawn"]).optional(),
36390
+ kind: string2().optional(),
36391
36391
  reason: string2().optional(),
36392
+ dispatch_words: string2().optional(),
36392
36393
  actor: object({ kind: string2().optional(), id: string2().optional() }).passthrough().optional(),
36393
36394
  at: string2().optional()
36394
36395
  }).nullish(),
@@ -37080,7 +37081,7 @@ var dispatchToolSpecs = [
37080
37081
  kind: "retracted",
37081
37082
  reason: "A newer question supersedes this one."
37082
37083
  },
37083
- description: "Retract an open question that is moot or resolve one after finding the answer. This closes " + "the question without answering it. An ask that lives as an `ask` block in a document is " + 'closed in the document too. A reason beginning "removed from the document in version" is ' + "refused: that marks a retraction the document's own settlement wrote. Use retracted for an ask " + "a newer one replaces or the design made moot, resolved for one whose answer you found; an " + "answered ask cannot be resolved, and resolving records no decision by a person. An issue's " + "close withdrew its open asks (kind withdrawn, which only Dispatch writes, never this tool); " + "an ask on a closed issue is refused (409 ISSUE_CLOSED): reopen the issue first.",
37084
+ description: "Retract an open question that is moot or resolve one after finding the answer. This closes " + "the question without answering it. An ask that lives as an `ask` block in a document is " + 'closed in the document too. A reason beginning "removed from the document in version" is ' + "refused: that marks a retraction the document's own settlement wrote. Use retracted for an ask " + "a newer one replaces or the design made moot, resolved for one whose answer you found; an " + "answered ask cannot be resolved, and resolving records no decision by a person. An issue's " + "close withdrew its open asks (kind withdrawn, which only Dispatch writes, never this tool); " + "a person who chose not to answer declined the ask on a route of their own (kind declined, " + "which only they write, never this tool); " + "an ask on a closed issue is refused (409 ISSUE_CLOSED): reopen the issue first.",
37084
37085
  arguments: (z) => ({
37085
37086
  ask: z.string().describe("Ask id (uuid) to close; an 8+ hex prefix unique among this session's own open asks " + "works too."),
37086
37087
  kind: z.enum(["retracted", "resolved"]).describe("Whether the ask is retracted or self-resolved."),
@@ -41682,6 +41683,13 @@ function textHead(text, length = HEAD_LENGTH) {
41682
41683
  const flat = text.replace(/\s+/g, " ").trim();
41683
41684
  return flat.length > length ? `${flat.slice(0, length)}\u2026` : flat;
41684
41685
  }
41686
+ var QUESTION_HEAD = 200;
41687
+ var DISPATCH_WORDS_LABEL = "Dispatch's words:";
41688
+ function dispatchWordsText(words, render) {
41689
+ if (words === null || words === undefined || words === "")
41690
+ return;
41691
+ return `${DISPATCH_WORDS_LABEL} ${render === undefined ? words : render(words)}`;
41692
+ }
41685
41693
  function askAnswerText(answer) {
41686
41694
  if (answer === null || answer === undefined)
41687
41695
  return "";
@@ -43752,7 +43760,9 @@ function askResolutionText(resolution) {
43752
43760
  return;
43753
43761
  const kind = resolution.kind ?? "resolved";
43754
43762
  const reason = resolution.reason ?? "";
43755
- return reason === "" ? kind : `${kind}: ${reason}`;
43763
+ const closed = reason === "" ? kind : `${kind}: ${reason}`;
43764
+ const words = dispatchWordsText(resolution.dispatch_words);
43765
+ return words === undefined ? closed : `${closed} \xB7 ${words}`;
43756
43766
  }
43757
43767
  function dispatchCompact(event, comment) {
43758
43768
  if (event.type === "artifact.human_edited") {
@@ -47377,7 +47387,14 @@ function answerLines(lead, answer) {
47377
47387
  ];
47378
47388
  }
47379
47389
  function resolutionText(resolution) {
47380
- return `${resolution.kind} by ${actorText(resolution.actor)} at ${resolution.at}: ${indentedText(resolution.reason)}`;
47390
+ const closed = `${resolution.kind} by ${actorText(resolution.actor)} at ${resolution.at}`;
47391
+ const parts = [
47392
+ resolution.reason === "" ? closed : `${closed}: ${indentedText(resolution.reason)}`
47393
+ ];
47394
+ const words = dispatchWordsText(resolution.dispatch_words, indentedText);
47395
+ if (words !== undefined)
47396
+ parts.push(words);
47397
+ return parts.join(" \xB7 ");
47381
47398
  }
47382
47399
  function askStateLines(ask) {
47383
47400
  if (ask === undefined) {
@@ -47523,6 +47540,26 @@ function decisionBlockLines(advice, context) {
47523
47540
  ];
47524
47541
  }
47525
47542
  }
47543
+ function declinedAskLines(advice, issueKey, configUrl) {
47544
+ try {
47545
+ const declined = advice?.declined_asks;
47546
+ if (declined === undefined || declined === null || declined.length === 0)
47547
+ return [];
47548
+ const count = declined.length;
47549
+ const lines = [
47550
+ count === 1 ? "This issue holds a question a person declined to answer. Ask it again only if the facts have changed:" : `This issue holds ${count} questions a person declined to answer. Ask one again only if the facts have changed:`
47551
+ ];
47552
+ for (const ask of declined) {
47553
+ const href = absoluteHref(`/issues/${encodeURIComponent(issueKey)}/asks/${encodeURIComponent(ask.id)}`, configUrl);
47554
+ lines.push(`- Declined: ${ask.question} \u2192 ${href}`);
47555
+ if (ask.note !== "")
47556
+ lines.push(` Their note: ${ask.note}`);
47557
+ }
47558
+ return lines;
47559
+ } catch (error) {
47560
+ return [`The issue's declined asks could not be shown: ${messageFor(error)}`];
47561
+ }
47562
+ }
47526
47563
  function relatedCheckForm(suggestions, context) {
47527
47564
  const form = relatedCheckFormOf(suggestions);
47528
47565
  if (form.form === "not_made") {
@@ -47585,12 +47622,12 @@ var SESSION_ANSWERS_MAX_CHARS = 8000;
47585
47622
  var SESSION_ANSWERS_DEADLINE_MS = 800;
47586
47623
  var READ_TIMEOUT_MS = 1e4;
47587
47624
  var NO_ROUTE_BACKOFF_MS = 5 * 60000;
47588
- var QUESTION_MAX = 200;
47589
47625
  var SESSION_ANSWERS_MARKER = "[Dispatch: what people wrote to this session in the last 72 hours, newest first, word for word. Reference, not a new request.]";
47590
47626
  var FAILURE_MARKER = "[Dispatch: people's answers from the last 72 hours could not be read (";
47591
47627
  var NO_ANSWERS_ROUTE_REASON = "this Dispatch build has no answers route";
47592
47628
  var RELATION_PHRASES = {
47593
47629
  answered_your_ask: "answered your ask",
47630
+ declined_your_ask: "declined to answer your ask",
47594
47631
  replied_on_your_ask: "replied on your ask",
47595
47632
  replied_in_a_comment_thread: "replied in a comment thread",
47596
47633
  commented_on_a_document: "commented on a document",
@@ -47615,13 +47652,15 @@ function renderSessionAnswerItem(item) {
47615
47652
  const where = item.ref === null ? `Direct message ${item.id}, on no issue` : owner === undefined ? item.ref : `${item.ref} \xB7 ${owner}`;
47616
47653
  const lines = [head.join(" \xB7 "), where];
47617
47654
  if (item.ask !== undefined) {
47618
- const question = item.ask.question.replace(/\s+/g, " ").trim();
47619
- lines.push(`Question: ${question.length > QUESTION_MAX ? `${question.slice(0, QUESTION_MAX)}\u2026` : question}`);
47655
+ lines.push(`Question: ${textHead(item.ask.question, QUESTION_HEAD)}`);
47620
47656
  }
47621
47657
  if (item.kind === "answer") {
47622
47658
  const selected = item.selected ?? [];
47623
47659
  lines.push(`Selected: ${selected.length === 0 ? "none" : selected.join(", ")}`);
47624
47660
  }
47661
+ const words = dispatchWordsText(item.dispatch_words);
47662
+ if (words !== undefined)
47663
+ lines.push(words);
47625
47664
  if (item.text !== "")
47626
47665
  lines.push(item.text);
47627
47666
  return lines.join(`
@@ -49430,6 +49469,7 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
49430
49469
  `${reply.id} \xB7 ${actorText(reply.author)}`,
49431
49470
  `Body: ${reply.body}`
49432
49471
  ]);
49472
+ const resolutionWords = dispatchWordsText(ask.resolution?.dispatch_words);
49433
49473
  return [
49434
49474
  `Question: ${ask.question}`,
49435
49475
  ...anchorLines(ask),
@@ -49456,7 +49496,8 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
49456
49496
  "Resolution:",
49457
49497
  `- By: ${ask.resolution.actor.id}`,
49458
49498
  `- Kind: ${ask.resolution.kind}`,
49459
- `- Reason: ${ask.resolution.reason}`
49499
+ ...ask.resolution.reason === "" ? [] : [`- Reason: ${ask.resolution.reason}`],
49500
+ ...resolutionWords === undefined ? [] : [`- ${resolutionWords}`]
49460
49501
  ],
49461
49502
  "Replies:",
49462
49503
  ...chain.length === 0 ? ["- none"] : chain,
@@ -50600,16 +50641,19 @@ async function executeDispatchTool(input) {
50600
50641
  };
50601
50642
  const ask = resolved?.owner.kind === "project" ? await client.artifactAsk(resolved.artifact.id, askInput) : await client.ask(issue(), askInput);
50602
50643
  const askOwner = ask.issue_key !== null ? issueTopic(ask.issue_key) : resolved === undefined ? issueTopic(issue()) : documentTopic(resolved.artifact);
50603
- const checkLines = relatedCheckLines(ask.advice?.suggestions, {
50644
+ const checkContext = {
50604
50645
  project: resolved?.artifact.project ?? (ask.issue_key ?? "").replace(/-[0-9]+$/, ""),
50605
50646
  text: stringArg(args, "question"),
50606
50647
  configUrl: linkBase
50607
- });
50648
+ };
50649
+ const checkLines = relatedCheckLines(ask.advice?.suggestions, checkContext);
50650
+ const declinedLines = ask.issue_key === null ? [] : declinedAskLines(ask.advice, ask.issue_key, linkBase);
50608
50651
  const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, askOwner.label, ask.advice, {}));
50609
50652
  return {
50610
50653
  text: [
50611
50654
  `Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency}): ${ask.question}`,
50612
50655
  ...checkLines,
50656
+ ...declinedLines,
50613
50657
  await followsAsk(askOwner, input.subscriptions),
50614
50658
  ...adviceLines
50615
50659
  ].join(`
@@ -50826,17 +50870,20 @@ async function executeDispatchTool(input) {
50826
50870
  const lostText = lostOps === undefined || lostOps !== null && lostOps.length === 0 ? "" : lostOps === null ? "; could not confirm this edit survived, because the live document is being reloaded or holds a tree too deep to read \u2014 re-read it" : `; ${versionText} carries text the live document no longer has: a concurrent change removed what ${lostOps.length === 1 ? "operation" : "operations"} ${lostOps.join(", ")} wrote \u2014 re-read the document`;
50827
50871
  const applied = `${head}${unchangedText}${lostText}`;
50828
50872
  const editAskText = ops.map((operation) => /^:{3,}ask\{.*\n([\s\S]*)/mu.exec(operation.markdown ?? operation.with ?? "")?.[1]).find((text) => text !== undefined) ?? resolved.issue?.title ?? "";
50829
- const checkLines = decisionBlockLines(edited.advice, {
50873
+ const checkContext = {
50830
50874
  project: resolved.artifact.project,
50831
50875
  text: editAskText,
50832
50876
  configUrl: linkBase
50833
- });
50877
+ };
50878
+ const checkLines = decisionBlockLines(edited.advice, checkContext);
50879
+ const declinedLines = resolved.issue === undefined ? [] : declinedAskLines(edited.advice, resolved.issue.key, linkBase);
50834
50880
  const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {}));
50835
50881
  const tokenTrailer = edited.token === undefined ? [] : [`Document token: ${edited.token}`];
50836
50882
  return {
50837
50883
  text: [
50838
50884
  `${applied}${await notSubscribed(resolvedTopic(resolved), input.subscriptions)}`,
50839
50885
  ...checkLines,
50886
+ ...declinedLines,
50840
50887
  ...tokenTrailer,
50841
50888
  ...adviceLines
50842
50889
  ].join(`
@@ -52350,6 +52397,7 @@ var LEGION_WAIT_ANSWERS = [
52350
52397
  "retracted",
52351
52398
  "closed",
52352
52399
  "reply",
52400
+ "declined",
52353
52401
  "turn",
52354
52402
  "approved",
52355
52403
  "changes_requested",
@@ -55433,9 +55481,9 @@ var import_nats2 = __toESM(require_mod4(), 1);
55433
55481
 
55434
55482
  // package.json
55435
55483
  var name = "@sjawhar/claude-envoy";
55436
- var version2 = "1.36.0";
55484
+ var version2 = "1.38.0";
55437
55485
  var legion = {
55438
- daemonApiVersion: 62
55486
+ daemonApiVersion: 68
55439
55487
  };
55440
55488
 
55441
55489
  // ../pi-shared/src/agent-stream.ts
@@ -13737,8 +13737,9 @@ var askEventPayloadFields = {
13737
13737
  primary: boolean2().optional()
13738
13738
  }).optional(),
13739
13739
  resolution: object({
13740
- kind: _enum2(["retracted", "resolved", "withdrawn"]).optional(),
13740
+ kind: string2().optional(),
13741
13741
  reason: string2().optional(),
13742
+ dispatch_words: string2().optional(),
13742
13743
  actor: object({ kind: string2().optional(), id: string2().optional() }).passthrough().optional(),
13743
13744
  at: string2().optional()
13744
13745
  }).nullish(),
@@ -14430,7 +14431,7 @@ var dispatchToolSpecs = [
14430
14431
  kind: "retracted",
14431
14432
  reason: "A newer question supersedes this one."
14432
14433
  },
14433
- description: "Retract an open question that is moot or resolve one after finding the answer. This closes " + "the question without answering it. An ask that lives as an `ask` block in a document is " + 'closed in the document too. A reason beginning "removed from the document in version" is ' + "refused: that marks a retraction the document's own settlement wrote. Use retracted for an ask " + "a newer one replaces or the design made moot, resolved for one whose answer you found; an " + "answered ask cannot be resolved, and resolving records no decision by a person. An issue's " + "close withdrew its open asks (kind withdrawn, which only Dispatch writes, never this tool); " + "an ask on a closed issue is refused (409 ISSUE_CLOSED): reopen the issue first.",
14434
+ description: "Retract an open question that is moot or resolve one after finding the answer. This closes " + "the question without answering it. An ask that lives as an `ask` block in a document is " + 'closed in the document too. A reason beginning "removed from the document in version" is ' + "refused: that marks a retraction the document's own settlement wrote. Use retracted for an ask " + "a newer one replaces or the design made moot, resolved for one whose answer you found; an " + "answered ask cannot be resolved, and resolving records no decision by a person. An issue's " + "close withdrew its open asks (kind withdrawn, which only Dispatch writes, never this tool); " + "a person who chose not to answer declined the ask on a route of their own (kind declined, " + "which only they write, never this tool); " + "an ask on a closed issue is refused (409 ISSUE_CLOSED): reopen the issue first.",
14434
14435
  arguments: (z) => ({
14435
14436
  ask: z.string().describe("Ask id (uuid) to close; an 8+ hex prefix unique among this session's own open asks " + "works too."),
14436
14437
  kind: z.enum(["retracted", "resolved"]).describe("Whether the ask is retracted or self-resolved."),
@@ -16093,6 +16094,13 @@ function textHead(text, length = HEAD_LENGTH) {
16093
16094
  const flat = text.replace(/\s+/g, " ").trim();
16094
16095
  return flat.length > length ? `${flat.slice(0, length)}\u2026` : flat;
16095
16096
  }
16097
+ var QUESTION_HEAD = 200;
16098
+ var DISPATCH_WORDS_LABEL = "Dispatch's words:";
16099
+ function dispatchWordsText(words, render) {
16100
+ if (words === null || words === undefined || words === "")
16101
+ return;
16102
+ return `${DISPATCH_WORDS_LABEL} ${render === undefined ? words : render(words)}`;
16103
+ }
16096
16104
  function askAnswerText(answer) {
16097
16105
  if (answer === null || answer === undefined)
16098
16106
  return "";
@@ -18803,7 +18811,9 @@ function askResolutionText(resolution) {
18803
18811
  return;
18804
18812
  const kind = resolution.kind ?? "resolved";
18805
18813
  const reason = resolution.reason ?? "";
18806
- return reason === "" ? kind : `${kind}: ${reason}`;
18814
+ const closed = reason === "" ? kind : `${kind}: ${reason}`;
18815
+ const words = dispatchWordsText(resolution.dispatch_words);
18816
+ return words === undefined ? closed : `${closed} \xB7 ${words}`;
18807
18817
  }
18808
18818
  function dispatchCompact(event, comment) {
18809
18819
  if (event.type === "artifact.human_edited") {
@@ -19567,7 +19577,14 @@ function answerLines(lead, answer) {
19567
19577
  ];
19568
19578
  }
19569
19579
  function resolutionText(resolution) {
19570
- return `${resolution.kind} by ${actorText(resolution.actor)} at ${resolution.at}: ${indentedText(resolution.reason)}`;
19580
+ const closed = `${resolution.kind} by ${actorText(resolution.actor)} at ${resolution.at}`;
19581
+ const parts = [
19582
+ resolution.reason === "" ? closed : `${closed}: ${indentedText(resolution.reason)}`
19583
+ ];
19584
+ const words = dispatchWordsText(resolution.dispatch_words, indentedText);
19585
+ if (words !== undefined)
19586
+ parts.push(words);
19587
+ return parts.join(" \xB7 ");
19571
19588
  }
19572
19589
  function askStateLines(ask) {
19573
19590
  if (ask === undefined) {
@@ -19713,6 +19730,26 @@ function decisionBlockLines(advice, context) {
19713
19730
  ];
19714
19731
  }
19715
19732
  }
19733
+ function declinedAskLines(advice, issueKey, configUrl) {
19734
+ try {
19735
+ const declined = advice?.declined_asks;
19736
+ if (declined === undefined || declined === null || declined.length === 0)
19737
+ return [];
19738
+ const count = declined.length;
19739
+ const lines = [
19740
+ count === 1 ? "This issue holds a question a person declined to answer. Ask it again only if the facts have changed:" : `This issue holds ${count} questions a person declined to answer. Ask one again only if the facts have changed:`
19741
+ ];
19742
+ for (const ask of declined) {
19743
+ const href = absoluteHref(`/issues/${encodeURIComponent(issueKey)}/asks/${encodeURIComponent(ask.id)}`, configUrl);
19744
+ lines.push(`- Declined: ${ask.question} \u2192 ${href}`);
19745
+ if (ask.note !== "")
19746
+ lines.push(` Their note: ${ask.note}`);
19747
+ }
19748
+ return lines;
19749
+ } catch (error) {
19750
+ return [`The issue's declined asks could not be shown: ${messageFor(error)}`];
19751
+ }
19752
+ }
19716
19753
  function relatedCheckForm(suggestions, context) {
19717
19754
  const form = relatedCheckFormOf(suggestions);
19718
19755
  if (form.form === "not_made") {
@@ -19807,12 +19844,12 @@ var SESSION_ANSWERS_MAX_CHARS = 8000;
19807
19844
  var SESSION_ANSWERS_DEADLINE_MS = 800;
19808
19845
  var READ_TIMEOUT_MS = 1e4;
19809
19846
  var NO_ROUTE_BACKOFF_MS = 5 * 60000;
19810
- var QUESTION_MAX = 200;
19811
19847
  var SESSION_ANSWERS_MARKER = "[Dispatch: what people wrote to this session in the last 72 hours, newest first, word for word. Reference, not a new request.]";
19812
19848
  var FAILURE_MARKER = "[Dispatch: people's answers from the last 72 hours could not be read (";
19813
19849
  var NO_ANSWERS_ROUTE_REASON = "this Dispatch build has no answers route";
19814
19850
  var RELATION_PHRASES = {
19815
19851
  answered_your_ask: "answered your ask",
19852
+ declined_your_ask: "declined to answer your ask",
19816
19853
  replied_on_your_ask: "replied on your ask",
19817
19854
  replied_in_a_comment_thread: "replied in a comment thread",
19818
19855
  commented_on_a_document: "commented on a document",
@@ -19837,13 +19874,15 @@ function renderSessionAnswerItem(item) {
19837
19874
  const where = item.ref === null ? `Direct message ${item.id}, on no issue` : owner === undefined ? item.ref : `${item.ref} \xB7 ${owner}`;
19838
19875
  const lines = [head.join(" \xB7 "), where];
19839
19876
  if (item.ask !== undefined) {
19840
- const question = item.ask.question.replace(/\s+/g, " ").trim();
19841
- lines.push(`Question: ${question.length > QUESTION_MAX ? `${question.slice(0, QUESTION_MAX)}\u2026` : question}`);
19877
+ lines.push(`Question: ${textHead(item.ask.question, QUESTION_HEAD)}`);
19842
19878
  }
19843
19879
  if (item.kind === "answer") {
19844
19880
  const selected = item.selected ?? [];
19845
19881
  lines.push(`Selected: ${selected.length === 0 ? "none" : selected.join(", ")}`);
19846
19882
  }
19883
+ const words = dispatchWordsText(item.dispatch_words);
19884
+ if (words !== undefined)
19885
+ lines.push(words);
19847
19886
  if (item.text !== "")
19848
19887
  lines.push(item.text);
19849
19888
  return lines.join(`
@@ -21652,6 +21691,7 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
21652
21691
  `${reply.id} \xB7 ${actorText(reply.author)}`,
21653
21692
  `Body: ${reply.body}`
21654
21693
  ]);
21694
+ const resolutionWords = dispatchWordsText(ask.resolution?.dispatch_words);
21655
21695
  return [
21656
21696
  `Question: ${ask.question}`,
21657
21697
  ...anchorLines(ask),
@@ -21678,7 +21718,8 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
21678
21718
  "Resolution:",
21679
21719
  `- By: ${ask.resolution.actor.id}`,
21680
21720
  `- Kind: ${ask.resolution.kind}`,
21681
- `- Reason: ${ask.resolution.reason}`
21721
+ ...ask.resolution.reason === "" ? [] : [`- Reason: ${ask.resolution.reason}`],
21722
+ ...resolutionWords === undefined ? [] : [`- ${resolutionWords}`]
21682
21723
  ],
21683
21724
  "Replies:",
21684
21725
  ...chain.length === 0 ? ["- none"] : chain,
@@ -22822,16 +22863,19 @@ async function executeDispatchTool(input) {
22822
22863
  };
22823
22864
  const ask = resolved?.owner.kind === "project" ? await client.artifactAsk(resolved.artifact.id, askInput) : await client.ask(issue(), askInput);
22824
22865
  const askOwner = ask.issue_key !== null ? issueTopic(ask.issue_key) : resolved === undefined ? issueTopic(issue()) : documentTopic(resolved.artifact);
22825
- const checkLines = relatedCheckLines(ask.advice?.suggestions, {
22866
+ const checkContext = {
22826
22867
  project: resolved?.artifact.project ?? (ask.issue_key ?? "").replace(/-[0-9]+$/, ""),
22827
22868
  text: stringArg(args, "question"),
22828
22869
  configUrl: linkBase
22829
- });
22870
+ };
22871
+ const checkLines = relatedCheckLines(ask.advice?.suggestions, checkContext);
22872
+ const declinedLines = ask.issue_key === null ? [] : declinedAskLines(ask.advice, ask.issue_key, linkBase);
22830
22873
  const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, askOwner.label, ask.advice, {}));
22831
22874
  return {
22832
22875
  text: [
22833
22876
  `Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency}): ${ask.question}`,
22834
22877
  ...checkLines,
22878
+ ...declinedLines,
22835
22879
  await followsAsk(askOwner, input.subscriptions),
22836
22880
  ...adviceLines
22837
22881
  ].join(`
@@ -23048,17 +23092,20 @@ async function executeDispatchTool(input) {
23048
23092
  const lostText = lostOps === undefined || lostOps !== null && lostOps.length === 0 ? "" : lostOps === null ? "; could not confirm this edit survived, because the live document is being reloaded or holds a tree too deep to read \u2014 re-read it" : `; ${versionText} carries text the live document no longer has: a concurrent change removed what ${lostOps.length === 1 ? "operation" : "operations"} ${lostOps.join(", ")} wrote \u2014 re-read the document`;
23049
23093
  const applied = `${head}${unchangedText}${lostText}`;
23050
23094
  const editAskText = ops.map((operation) => /^:{3,}ask\{.*\n([\s\S]*)/mu.exec(operation.markdown ?? operation.with ?? "")?.[1]).find((text) => text !== undefined) ?? resolved.issue?.title ?? "";
23051
- const checkLines = decisionBlockLines(edited.advice, {
23095
+ const checkContext = {
23052
23096
  project: resolved.artifact.project,
23053
23097
  text: editAskText,
23054
23098
  configUrl: linkBase
23055
- });
23099
+ };
23100
+ const checkLines = decisionBlockLines(edited.advice, checkContext);
23101
+ const declinedLines = resolved.issue === undefined ? [] : declinedAskLines(edited.advice, resolved.issue.key, linkBase);
23056
23102
  const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {}));
23057
23103
  const tokenTrailer = edited.token === undefined ? [] : [`Document token: ${edited.token}`];
23058
23104
  return {
23059
23105
  text: [
23060
23106
  `${applied}${await notSubscribed(resolvedTopic(resolved), input.subscriptions)}`,
23061
23107
  ...checkLines,
23108
+ ...declinedLines,
23062
23109
  ...tokenTrailer,
23063
23110
  ...adviceLines
23064
23111
  ].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "1.36.0",
3
+ "version": "1.38.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "AGENTS.md"
20
20
  ],
21
21
  "legion": {
22
- "daemonApiVersion": 62
22
+ "daemonApiVersion": 68
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",