@sjawhar/claude-envoy 2.29.1 → 2.30.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": "2.29.1"
5
+ "version": "2.30.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "2.29.1",
3
+ "version": "2.30.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
@@ -22266,22 +22266,35 @@ function anchor(artifact, args) {
22266
22266
  const occurrence = optionalNumber(args, "occurrence");
22267
22267
  return { artifact: artifact.id, quote, ...occurrence === undefined ? {} : { occurrence } };
22268
22268
  }
22269
- function approvalLine(artifact) {
22269
+ function documentPlaysPlan(artifact) {
22270
+ return artifact.role === "plan" || (artifact.role ?? "") === "" && typeof artifact.issue_key === "string" && artifact.slug === "plan-md";
22271
+ }
22272
+ function approvalLine(artifact, issueClosed) {
22270
22273
  const approval = artifact.approval;
22271
22274
  if (approval === undefined || approval.state === "draft")
22272
22275
  return;
22273
22276
  const content = approval.content_sha256 === undefined ? "" : `, content sha256:${approval.content_sha256}${approval.content_sha256_source === "backfill" ? " (hashed after approval)" : ""}`;
22277
+ const by = approval.by?.id ?? "unknown";
22278
+ const approver = approval.kind === "plan_review" ? `plan review (${by})` : by;
22274
22279
  switch (approval.state) {
22275
22280
  case "awaiting": {
22276
22281
  const turn = approval.waiting_on === undefined ? "" : `, waiting on ${approval.waiting_on}`;
22277
22282
  return `Approval: awaiting${turn} (requested by ${approval.requested_by?.id ?? "unknown"}, ask ${approval.ask_id ?? "?"})`;
22278
22283
  }
22279
22284
  case "approved":
22280
- return `Approval: approved v${approval.version} by ${approval.by?.id ?? "unknown"}${content}`;
22281
- case "stale":
22282
- return `Approval: approved v${approval.version} by ${approval.by?.id ?? "unknown"}, changed since (now v${approval.latest_version}) - the human's own answer to a decision block carries the approval when that answer is the whole change since v${approval.version}; for any other change, request approval again once the human has agreed to every point in this version, with a --summary naming what changed since v${approval.version}${content}`;
22285
+ return `Approval: approved v${approval.version} by ${approver}${content}`;
22286
+ case "stale": {
22287
+ const changed = `Approval: approved v${approval.version} by ${approver}, changed since (now v${approval.latest_version})`;
22288
+ if (issueClosed) {
22289
+ return `${changed} - its issue is closed, and Dispatch records no approval of a closed issue's document${content}`;
22290
+ }
22291
+ if (documentPlaysPlan(artifact)) {
22292
+ return `${changed} - a plan review of this version records a new approval with dispatch plan-approve${content}`;
22293
+ }
22294
+ return `${changed} - the human's own answer to a decision block carries the approval when that answer is the whole change since v${approval.version}; for any other change, request approval again once the human has agreed to every point in this version, with a --summary naming what changed since v${approval.version}${content}`;
22295
+ }
22283
22296
  case "changes_requested":
22284
- return `Approval: changes requested on v${approval.version} by ${approval.by?.id ?? "unknown"}: ${approval.reason ?? ""}${content}`;
22297
+ return `Approval: changes requested on v${approval.version} by ${by}: ${approval.reason ?? ""}${content}`;
22285
22298
  default:
22286
22299
  return;
22287
22300
  }
@@ -22719,7 +22732,7 @@ function renderAdvice(tool, key, advice, opts) {
22719
22732
  const named = gates.map((gate) => `${gate.issue}, step ${gate.step}`).join("; ");
22720
22733
  parts.push(`A Legion design gate records this document, so every READY in ${gates.length === 1 ? "its" : "each"} tree is refused until that approval comes back: ${named}.`);
22721
22734
  }
22722
- parts.push("Meant to change the approved design? Request approval with `dispatch request-approval`. Meant a correction beside it? Tell the tree's architect, and keep the next one in a comment or in the plan.");
22735
+ parts.push(opts.isPlan === true ? `A plan is approved by its plan review, and Dispatch refuses a request for a person's approval of a plan. Once a plan review approves version ${superseded.version}, record it with \`dispatch plan-approve --issue ${key} --version ${superseded.version}\`.` : "Meant to change the approved design? Request approval with `dispatch request-approval`. Meant a correction beside it? Tell the tree's architect, and keep the next one in a comment or in the plan.");
22723
22736
  lines.push(parts.join(" "));
22724
22737
  }
22725
22738
  if (hasIssueAdvice && writesSinceHuman !== undefined && writesSinceHuman >= 3 && (tool === "dispatch_message" || tool === "dispatch_ask" || tool === "dispatch_comment" && opts.isAskReply !== true)) {
@@ -23896,7 +23909,9 @@ async function docEditCommand(context) {
23896
23909
  configUrl: linkBase
23897
23910
  });
23898
23911
  const declinedLines = resolved.issue === undefined ? [] : declinedAskLines(edited.advice, resolved.issue.key, linkBase);
23899
- const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {}));
23912
+ const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {
23913
+ isPlan: documentPlaysPlan(resolved.artifact)
23914
+ }));
23900
23915
  const written = edited.written;
23901
23916
  const writtenLines = written === undefined || written === "" ? [] : [written];
23902
23917
  const tokenTrailer = edited.token === undefined ? [] : [`Document token: ${edited.token}`];
@@ -23968,7 +23983,7 @@ ${trailer.join(`
23968
23983
  if (threadsResult.status === "rejected")
23969
23984
  throw threadsResult.reason;
23970
23985
  const threads = threadsResult.value;
23971
- const approval = approvalLine(resolved.artifact);
23986
+ const approval = approvalLine(resolved.artifact, typeof resolved.issue?.closed_at === "string");
23972
23987
  const trailer = [
23973
23988
  ..."token" in document && document.token !== undefined ? [`Document token: ${document.token}`] : [],
23974
23989
  ..."sha256" in document && document.sha256 !== undefined ? [`Content: sha256:${document.sha256}`] : [],
@@ -24173,7 +24188,8 @@ async function artifactCommand(context) {
24173
24188
  const artifactRef = dispatchDocumentRef(artifactOwner.kind === "project" ? artifactOwner.project : issue(), result.artifact.slug);
24174
24189
  const uploadOwner = artifactOwner.kind === "project" ? documentTopic(result.artifact) : issueTopic(issue());
24175
24190
  const adviceLines = renderAdvice(input.tool, uploadOwner.label, result.advice, {
24176
- isPrimarySpec: result.artifact.primary || result.artifact.name === "spec.md"
24191
+ isPrimarySpec: result.artifact.primary || result.artifact.name === "spec.md",
24192
+ isPlan: documentPlaysPlan(result.artifact)
24177
24193
  });
24178
24194
  return {
24179
24195
  text: [
@@ -24386,7 +24402,7 @@ function issueSummary(issue, events, references, graph, linkBase, coverage, agen
24386
24402
  const links = issue.external_links ?? [];
24387
24403
  const members = typeof references === "string" ? [] : references.members ?? [];
24388
24404
  const spec = issue.artifacts?.find((artifact) => artifact.primary);
24389
- const specApproval = spec === undefined ? undefined : approvalLine(spec);
24405
+ const specApproval = spec === undefined ? undefined : approvalLine(spec, typeof issue.closed_at === "string");
24390
24406
  if (issue.priority === undefined)
24391
24407
  throw new Error("Dispatch issue is missing priority");
24392
24408
  if (issue.assignee === undefined)
@@ -24464,6 +24480,13 @@ function eventHead(event) {
24464
24480
  return textHead(event.payload.body);
24465
24481
  case "artifact.version":
24466
24482
  return textHead(`${event.payload.name} v${event.payload.version.number}${event.payload.version.summary ? `: ${event.payload.version.summary}` : ""}`);
24483
+ case "artifact.approved":
24484
+ case "artifact.changes_requested": {
24485
+ const { name, version, kind, reason } = event.payload;
24486
+ const verb = event.type === "artifact.approved" ? "approved" : "changes requested";
24487
+ const reviewer = kind === "plan_review" ? " by plan review" : kind === "person" ? " by a person" : "";
24488
+ return textHead(`${name} v${version} ${verb}${reviewer}${reason ? `: ${reason}` : ""}`);
24489
+ }
24467
24490
  case "artifact.human_edited":
24468
24491
  return textHead(humanEditHead(event.payload));
24469
24492
  case "issue.created": {
@@ -25382,7 +25405,7 @@ async function readCommand(context) {
25382
25405
  const { artifact } = resolved;
25383
25406
  const ownerKey = resolved.issue?.key ?? artifact.project;
25384
25407
  const documentRef = dispatchDocumentRef(ownerKey, artifact.slug);
25385
- const approval = approvalLine(artifact);
25408
+ const approval = approvalLine(artifact, typeof resolved.issue?.closed_at === "string");
25386
25409
  return {
25387
25410
  text: [
25388
25411
  `Document: ${ownerKey} / ${artifact.name}`,
@@ -49395,22 +49395,35 @@ function anchor(artifact, args) {
49395
49395
  const occurrence = optionalNumber(args, "occurrence");
49396
49396
  return { artifact: artifact.id, quote, ...occurrence === undefined ? {} : { occurrence } };
49397
49397
  }
49398
- function approvalLine(artifact) {
49398
+ function documentPlaysPlan(artifact) {
49399
+ return artifact.role === "plan" || (artifact.role ?? "") === "" && typeof artifact.issue_key === "string" && artifact.slug === "plan-md";
49400
+ }
49401
+ function approvalLine(artifact, issueClosed) {
49399
49402
  const approval = artifact.approval;
49400
49403
  if (approval === undefined || approval.state === "draft")
49401
49404
  return;
49402
49405
  const content = approval.content_sha256 === undefined ? "" : `, content sha256:${approval.content_sha256}${approval.content_sha256_source === "backfill" ? " (hashed after approval)" : ""}`;
49406
+ const by = approval.by?.id ?? "unknown";
49407
+ const approver = approval.kind === "plan_review" ? `plan review (${by})` : by;
49403
49408
  switch (approval.state) {
49404
49409
  case "awaiting": {
49405
49410
  const turn = approval.waiting_on === undefined ? "" : `, waiting on ${approval.waiting_on}`;
49406
49411
  return `Approval: awaiting${turn} (requested by ${approval.requested_by?.id ?? "unknown"}, ask ${approval.ask_id ?? "?"})`;
49407
49412
  }
49408
49413
  case "approved":
49409
- return `Approval: approved v${approval.version} by ${approval.by?.id ?? "unknown"}${content}`;
49410
- case "stale":
49411
- return `Approval: approved v${approval.version} by ${approval.by?.id ?? "unknown"}, changed since (now v${approval.latest_version}) - the human's own answer to a decision block carries the approval when that answer is the whole change since v${approval.version}; for any other change, request approval again once the human has agreed to every point in this version, with a --summary naming what changed since v${approval.version}${content}`;
49414
+ return `Approval: approved v${approval.version} by ${approver}${content}`;
49415
+ case "stale": {
49416
+ const changed = `Approval: approved v${approval.version} by ${approver}, changed since (now v${approval.latest_version})`;
49417
+ if (issueClosed) {
49418
+ return `${changed} - its issue is closed, and Dispatch records no approval of a closed issue's document${content}`;
49419
+ }
49420
+ if (documentPlaysPlan(artifact)) {
49421
+ return `${changed} - a plan review of this version records a new approval with dispatch plan-approve${content}`;
49422
+ }
49423
+ return `${changed} - the human's own answer to a decision block carries the approval when that answer is the whole change since v${approval.version}; for any other change, request approval again once the human has agreed to every point in this version, with a --summary naming what changed since v${approval.version}${content}`;
49424
+ }
49412
49425
  case "changes_requested":
49413
- return `Approval: changes requested on v${approval.version} by ${approval.by?.id ?? "unknown"}: ${approval.reason ?? ""}${content}`;
49426
+ return `Approval: changes requested on v${approval.version} by ${by}: ${approval.reason ?? ""}${content}`;
49414
49427
  default:
49415
49428
  return;
49416
49429
  }
@@ -49848,7 +49861,7 @@ function renderAdvice(tool, key, advice, opts) {
49848
49861
  const named = gates.map((gate) => `${gate.issue}, step ${gate.step}`).join("; ");
49849
49862
  parts.push(`A Legion design gate records this document, so every READY in ${gates.length === 1 ? "its" : "each"} tree is refused until that approval comes back: ${named}.`);
49850
49863
  }
49851
- parts.push("Meant to change the approved design? Request approval with `dispatch request-approval`. Meant a correction beside it? Tell the tree's architect, and keep the next one in a comment or in the plan.");
49864
+ parts.push(opts.isPlan === true ? `A plan is approved by its plan review, and Dispatch refuses a request for a person's approval of a plan. Once a plan review approves version ${superseded.version}, record it with \`dispatch plan-approve --issue ${key} --version ${superseded.version}\`.` : "Meant to change the approved design? Request approval with `dispatch request-approval`. Meant a correction beside it? Tell the tree's architect, and keep the next one in a comment or in the plan.");
49852
49865
  lines.push(parts.join(" "));
49853
49866
  }
49854
49867
  if (hasIssueAdvice && writesSinceHuman !== undefined && writesSinceHuman >= 3 && (tool === "dispatch_message" || tool === "dispatch_ask" || tool === "dispatch_comment" && opts.isAskReply !== true)) {
@@ -50960,7 +50973,9 @@ async function docEditCommand(context) {
50960
50973
  configUrl: linkBase
50961
50974
  });
50962
50975
  const declinedLines = resolved.issue === undefined ? [] : declinedAskLines(edited.advice, resolved.issue.key, linkBase);
50963
- const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {}));
50976
+ const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {
50977
+ isPlan: documentPlaysPlan(resolved.artifact)
50978
+ }));
50964
50979
  const written = edited.written;
50965
50980
  const writtenLines = written === undefined || written === "" ? [] : [written];
50966
50981
  const tokenTrailer = edited.token === undefined ? [] : [`Document token: ${edited.token}`];
@@ -51032,7 +51047,7 @@ ${trailer.join(`
51032
51047
  if (threadsResult.status === "rejected")
51033
51048
  throw threadsResult.reason;
51034
51049
  const threads = threadsResult.value;
51035
- const approval = approvalLine(resolved.artifact);
51050
+ const approval = approvalLine(resolved.artifact, typeof resolved.issue?.closed_at === "string");
51036
51051
  const trailer = [
51037
51052
  ..."token" in document && document.token !== undefined ? [`Document token: ${document.token}`] : [],
51038
51053
  ..."sha256" in document && document.sha256 !== undefined ? [`Content: sha256:${document.sha256}`] : [],
@@ -51237,7 +51252,8 @@ async function artifactCommand(context) {
51237
51252
  const artifactRef = dispatchDocumentRef(artifactOwner.kind === "project" ? artifactOwner.project : issue(), result.artifact.slug);
51238
51253
  const uploadOwner = artifactOwner.kind === "project" ? documentTopic(result.artifact) : issueTopic(issue());
51239
51254
  const adviceLines = renderAdvice(input.tool, uploadOwner.label, result.advice, {
51240
- isPrimarySpec: result.artifact.primary || result.artifact.name === "spec.md"
51255
+ isPrimarySpec: result.artifact.primary || result.artifact.name === "spec.md",
51256
+ isPlan: documentPlaysPlan(result.artifact)
51241
51257
  });
51242
51258
  return {
51243
51259
  text: [
@@ -51450,7 +51466,7 @@ function issueSummary(issue, events, references, graph, linkBase, coverage, agen
51450
51466
  const links = issue.external_links ?? [];
51451
51467
  const members = typeof references === "string" ? [] : references.members ?? [];
51452
51468
  const spec = issue.artifacts?.find((artifact) => artifact.primary);
51453
- const specApproval = spec === undefined ? undefined : approvalLine(spec);
51469
+ const specApproval = spec === undefined ? undefined : approvalLine(spec, typeof issue.closed_at === "string");
51454
51470
  if (issue.priority === undefined)
51455
51471
  throw new Error("Dispatch issue is missing priority");
51456
51472
  if (issue.assignee === undefined)
@@ -51528,6 +51544,13 @@ function eventHead(event) {
51528
51544
  return textHead(event.payload.body);
51529
51545
  case "artifact.version":
51530
51546
  return textHead(`${event.payload.name} v${event.payload.version.number}${event.payload.version.summary ? `: ${event.payload.version.summary}` : ""}`);
51547
+ case "artifact.approved":
51548
+ case "artifact.changes_requested": {
51549
+ const { name, version, kind, reason } = event.payload;
51550
+ const verb = event.type === "artifact.approved" ? "approved" : "changes requested";
51551
+ const reviewer = kind === "plan_review" ? " by plan review" : kind === "person" ? " by a person" : "";
51552
+ return textHead(`${name} v${version} ${verb}${reviewer}${reason ? `: ${reason}` : ""}`);
51553
+ }
51531
51554
  case "artifact.human_edited":
51532
51555
  return textHead(humanEditHead(event.payload));
51533
51556
  case "issue.created": {
@@ -52446,7 +52469,7 @@ async function readCommand(context) {
52446
52469
  const { artifact } = resolved;
52447
52470
  const ownerKey = resolved.issue?.key ?? artifact.project;
52448
52471
  const documentRef = dispatchDocumentRef(ownerKey, artifact.slug);
52449
- const approval = approvalLine(artifact);
52472
+ const approval = approvalLine(artifact, typeof resolved.issue?.closed_at === "string");
52450
52473
  return {
52451
52474
  text: [
52452
52475
  `Document: ${ownerKey} / ${artifact.name}`,
@@ -57402,7 +57425,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
57402
57425
 
57403
57426
  // package.json
57404
57427
  var name = "@sjawhar/claude-envoy";
57405
- var version2 = "2.29.1";
57428
+ var version2 = "2.30.0";
57406
57429
  var legion = {
57407
57430
  daemonApiVersion: 144
57408
57431
  };
@@ -21234,22 +21234,35 @@ function anchor(artifact, args) {
21234
21234
  const occurrence = optionalNumber(args, "occurrence");
21235
21235
  return { artifact: artifact.id, quote, ...occurrence === undefined ? {} : { occurrence } };
21236
21236
  }
21237
- function approvalLine(artifact) {
21237
+ function documentPlaysPlan(artifact) {
21238
+ return artifact.role === "plan" || (artifact.role ?? "") === "" && typeof artifact.issue_key === "string" && artifact.slug === "plan-md";
21239
+ }
21240
+ function approvalLine(artifact, issueClosed) {
21238
21241
  const approval = artifact.approval;
21239
21242
  if (approval === undefined || approval.state === "draft")
21240
21243
  return;
21241
21244
  const content = approval.content_sha256 === undefined ? "" : `, content sha256:${approval.content_sha256}${approval.content_sha256_source === "backfill" ? " (hashed after approval)" : ""}`;
21245
+ const by = approval.by?.id ?? "unknown";
21246
+ const approver = approval.kind === "plan_review" ? `plan review (${by})` : by;
21242
21247
  switch (approval.state) {
21243
21248
  case "awaiting": {
21244
21249
  const turn = approval.waiting_on === undefined ? "" : `, waiting on ${approval.waiting_on}`;
21245
21250
  return `Approval: awaiting${turn} (requested by ${approval.requested_by?.id ?? "unknown"}, ask ${approval.ask_id ?? "?"})`;
21246
21251
  }
21247
21252
  case "approved":
21248
- return `Approval: approved v${approval.version} by ${approval.by?.id ?? "unknown"}${content}`;
21249
- case "stale":
21250
- return `Approval: approved v${approval.version} by ${approval.by?.id ?? "unknown"}, changed since (now v${approval.latest_version}) - the human's own answer to a decision block carries the approval when that answer is the whole change since v${approval.version}; for any other change, request approval again once the human has agreed to every point in this version, with a --summary naming what changed since v${approval.version}${content}`;
21253
+ return `Approval: approved v${approval.version} by ${approver}${content}`;
21254
+ case "stale": {
21255
+ const changed = `Approval: approved v${approval.version} by ${approver}, changed since (now v${approval.latest_version})`;
21256
+ if (issueClosed) {
21257
+ return `${changed} - its issue is closed, and Dispatch records no approval of a closed issue's document${content}`;
21258
+ }
21259
+ if (documentPlaysPlan(artifact)) {
21260
+ return `${changed} - a plan review of this version records a new approval with dispatch plan-approve${content}`;
21261
+ }
21262
+ return `${changed} - the human's own answer to a decision block carries the approval when that answer is the whole change since v${approval.version}; for any other change, request approval again once the human has agreed to every point in this version, with a --summary naming what changed since v${approval.version}${content}`;
21263
+ }
21251
21264
  case "changes_requested":
21252
- return `Approval: changes requested on v${approval.version} by ${approval.by?.id ?? "unknown"}: ${approval.reason ?? ""}${content}`;
21265
+ return `Approval: changes requested on v${approval.version} by ${by}: ${approval.reason ?? ""}${content}`;
21253
21266
  default:
21254
21267
  return;
21255
21268
  }
@@ -21687,7 +21700,7 @@ function renderAdvice(tool, key, advice, opts) {
21687
21700
  const named = gates.map((gate) => `${gate.issue}, step ${gate.step}`).join("; ");
21688
21701
  parts.push(`A Legion design gate records this document, so every READY in ${gates.length === 1 ? "its" : "each"} tree is refused until that approval comes back: ${named}.`);
21689
21702
  }
21690
- parts.push("Meant to change the approved design? Request approval with `dispatch request-approval`. Meant a correction beside it? Tell the tree's architect, and keep the next one in a comment or in the plan.");
21703
+ parts.push(opts.isPlan === true ? `A plan is approved by its plan review, and Dispatch refuses a request for a person's approval of a plan. Once a plan review approves version ${superseded.version}, record it with \`dispatch plan-approve --issue ${key} --version ${superseded.version}\`.` : "Meant to change the approved design? Request approval with `dispatch request-approval`. Meant a correction beside it? Tell the tree's architect, and keep the next one in a comment or in the plan.");
21691
21704
  lines.push(parts.join(" "));
21692
21705
  }
21693
21706
  if (hasIssueAdvice && writesSinceHuman !== undefined && writesSinceHuman >= 3 && (tool === "dispatch_message" || tool === "dispatch_ask" || tool === "dispatch_comment" && opts.isAskReply !== true)) {
@@ -22864,7 +22877,9 @@ async function docEditCommand(context) {
22864
22877
  configUrl: linkBase
22865
22878
  });
22866
22879
  const declinedLines = resolved.issue === undefined ? [] : declinedAskLines(edited.advice, resolved.issue.key, linkBase);
22867
- const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {}));
22880
+ const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, resolvedTopic(resolved).label, edited.advice, {
22881
+ isPlan: documentPlaysPlan(resolved.artifact)
22882
+ }));
22868
22883
  const written = edited.written;
22869
22884
  const writtenLines = written === undefined || written === "" ? [] : [written];
22870
22885
  const tokenTrailer = edited.token === undefined ? [] : [`Document token: ${edited.token}`];
@@ -22936,7 +22951,7 @@ ${trailer.join(`
22936
22951
  if (threadsResult.status === "rejected")
22937
22952
  throw threadsResult.reason;
22938
22953
  const threads = threadsResult.value;
22939
- const approval = approvalLine(resolved.artifact);
22954
+ const approval = approvalLine(resolved.artifact, typeof resolved.issue?.closed_at === "string");
22940
22955
  const trailer = [
22941
22956
  ..."token" in document && document.token !== undefined ? [`Document token: ${document.token}`] : [],
22942
22957
  ..."sha256" in document && document.sha256 !== undefined ? [`Content: sha256:${document.sha256}`] : [],
@@ -23141,7 +23156,8 @@ async function artifactCommand(context) {
23141
23156
  const artifactRef = dispatchDocumentRef(artifactOwner.kind === "project" ? artifactOwner.project : issue(), result.artifact.slug);
23142
23157
  const uploadOwner = artifactOwner.kind === "project" ? documentTopic(result.artifact) : issueTopic(issue());
23143
23158
  const adviceLines = renderAdvice(input.tool, uploadOwner.label, result.advice, {
23144
- isPrimarySpec: result.artifact.primary || result.artifact.name === "spec.md"
23159
+ isPrimarySpec: result.artifact.primary || result.artifact.name === "spec.md",
23160
+ isPlan: documentPlaysPlan(result.artifact)
23145
23161
  });
23146
23162
  return {
23147
23163
  text: [
@@ -23354,7 +23370,7 @@ function issueSummary(issue, events, references, graph, linkBase, coverage, agen
23354
23370
  const links = issue.external_links ?? [];
23355
23371
  const members = typeof references === "string" ? [] : references.members ?? [];
23356
23372
  const spec = issue.artifacts?.find((artifact) => artifact.primary);
23357
- const specApproval = spec === undefined ? undefined : approvalLine(spec);
23373
+ const specApproval = spec === undefined ? undefined : approvalLine(spec, typeof issue.closed_at === "string");
23358
23374
  if (issue.priority === undefined)
23359
23375
  throw new Error("Dispatch issue is missing priority");
23360
23376
  if (issue.assignee === undefined)
@@ -23432,6 +23448,13 @@ function eventHead(event) {
23432
23448
  return textHead(event.payload.body);
23433
23449
  case "artifact.version":
23434
23450
  return textHead(`${event.payload.name} v${event.payload.version.number}${event.payload.version.summary ? `: ${event.payload.version.summary}` : ""}`);
23451
+ case "artifact.approved":
23452
+ case "artifact.changes_requested": {
23453
+ const { name, version, kind, reason } = event.payload;
23454
+ const verb = event.type === "artifact.approved" ? "approved" : "changes requested";
23455
+ const reviewer = kind === "plan_review" ? " by plan review" : kind === "person" ? " by a person" : "";
23456
+ return textHead(`${name} v${version} ${verb}${reviewer}${reason ? `: ${reason}` : ""}`);
23457
+ }
23435
23458
  case "artifact.human_edited":
23436
23459
  return textHead(humanEditHead(event.payload));
23437
23460
  case "issue.created": {
@@ -24350,7 +24373,7 @@ async function readCommand(context) {
24350
24373
  const { artifact } = resolved;
24351
24374
  const ownerKey = resolved.issue?.key ?? artifact.project;
24352
24375
  const documentRef = dispatchDocumentRef(ownerKey, artifact.slug);
24353
- const approval = approvalLine(artifact);
24376
+ const approval = approvalLine(artifact, typeof resolved.issue?.closed_at === "string");
24354
24377
  return {
24355
24378
  text: [
24356
24379
  `Document: ${ownerKey} / ${artifact.name}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "2.29.1",
3
+ "version": "2.30.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",