@sjawhar/claude-envoy 2.2.0 → 2.3.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.2.0"
5
+ "version": "2.3.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "2.2.0",
3
+ "version": "2.3.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
@@ -21364,6 +21364,17 @@ var triageAdviceShown = new Set;
21364
21364
  function adviceMemory() {
21365
21365
  return triageAdviceShown;
21366
21366
  }
21367
+ function handBackApprovalCommand(request) {
21368
+ const owner = request.owner.kind === "project" ? `--project ${request.owner.key} --artifact ${request.artifactID}` : request.primary ? `--issue ${request.owner.key}` : `--issue ${request.owner.key} --artifact ${request.artifactID}`;
21369
+ const verification = request.owner.kind === "issue" && request.primary && request.verification ? " --include-verification" : "";
21370
+ return `dispatch request-approval ${owner}${verification} ` + `--summary '<what changed since version ${request.summaryVersion}>'`;
21371
+ }
21372
+ function movedApprovalClauses(documents) {
21373
+ return documents.map((document) => `${document.name} asked about version ${document.requested_version} and is now version ${document.version}`).join("; ");
21374
+ }
21375
+ function movedApprovalDocuments(documents) {
21376
+ return documents.filter((document) => document.requested_version < document.version);
21377
+ }
21367
21378
  function renderAdvice(tool, key, advice, opts) {
21368
21379
  if (advice === undefined)
21369
21380
  return [];
@@ -21394,6 +21405,24 @@ function renderAdvice(tool, key, advice, opts) {
21394
21405
  lines.push(`You still have an open ask on ${key}: "${ask.question.slice(0, 80)}" (${ask.id}). Still needed? See the \`dispatch\` skill, "Close what you opened".`);
21395
21406
  }
21396
21407
  }
21408
+ const movedApproval = advice.moved_approval_request;
21409
+ if (movedApproval !== undefined && (tool === "dispatch_doc_edit" || tool === "dispatch_artifact")) {
21410
+ const documents = movedApproval.documents ?? [];
21411
+ const moved = movedApprovalDocuments(documents);
21412
+ const movedOwner = movedApproval.issue !== undefined && movedApproval.issue !== "" ? { kind: "issue", key: movedApproval.issue } : movedApproval.project !== undefined && movedApproval.project !== "" ? { kind: "project", key: movedApproval.project } : undefined;
21413
+ const first = documents[0];
21414
+ const firstMoved = moved[0];
21415
+ if (moved.length > 0 && movedOwner !== undefined && first !== undefined && firstMoved !== undefined) {
21416
+ const command = handBackApprovalCommand({
21417
+ owner: movedOwner,
21418
+ artifactID: first.artifact_id,
21419
+ primary: first.primary,
21420
+ verification: documents.slice(1).some((document) => document.role === "verification"),
21421
+ summaryVersion: firstMoved.requested_version
21422
+ });
21423
+ lines.push(`This write moved the open approval request (ask ${movedApproval.ask_id}): it waits on ` + "an agent now, not on the person, and nothing tells the person. " + `${movedApprovalClauses(moved)}. Once the human has agreed to every point in it, hand ` + `the same request back: ${command}. Not yours to hand back? Tell the issue's architect.`);
21424
+ }
21425
+ }
21397
21426
  const superseded = advice.superseded_approval;
21398
21427
  if (superseded !== undefined && (tool === "dispatch_doc_edit" || tool === "dispatch_artifact")) {
21399
21428
  const gates = Array.isArray(superseded.design_gates) ? superseded.design_gates : [];
@@ -22344,10 +22373,28 @@ async function movedApprovalLine(client, askID) {
22344
22373
  const approval = ask?.approval;
22345
22374
  if (ask?.kind !== "approval" || approval === undefined)
22346
22375
  return;
22347
- if (approval.requested_version >= approval.version)
22376
+ const listed = approval.documents ?? [];
22377
+ const documents = listed.length > 0 ? listed : [
22378
+ {
22379
+ name: approval.name,
22380
+ requested_version: approval.requested_version,
22381
+ version: approval.version
22382
+ }
22383
+ ];
22384
+ const moved = movedApprovalDocuments(documents);
22385
+ if (moved.length === 0)
22348
22386
  return;
22349
- const owner = ask.issue_key === null ? `--project ${ask.approval_artifact?.project ?? "<project>"} --artifact ${approval.artifact_id}` : ask.approval_artifact?.primary === true ? `--issue ${ask.issue_key}` : `--issue ${ask.issue_key} --artifact ${approval.artifact_id}`;
22350
- return `The reply did not hand the ask to the human: it is the approval request for ${approval.name} ` + `at version ${approval.requested_version}, and ${approval.name} is now version ${approval.version}. ` + "No reply hands a moved approval request back. Once the human has agreed to every point in " + `version ${approval.version}, run: dispatch request-approval ${owner} --summary ` + `'<what changed since version ${approval.requested_version}>'`;
22387
+ const firstMoved = moved[0];
22388
+ if (firstMoved === undefined)
22389
+ return;
22390
+ const command = handBackApprovalCommand({
22391
+ owner: ask.issue_key === null ? { kind: "project", key: ask.approval_artifact?.project ?? "<project>" } : { kind: "issue", key: ask.issue_key },
22392
+ artifactID: approval.artifact_id,
22393
+ primary: ask.approval_artifact?.primary === true,
22394
+ verification: documents.length > 1 && ask.approval_artifact?.primary === true,
22395
+ summaryVersion: firstMoved.requested_version
22396
+ });
22397
+ return "The reply did not hand the ask to the human: it is an open approval request, and " + `${movedApprovalClauses(moved)}. No reply hands a moved approval request back. Once the ` + `human has agreed to every point in it, run: ${command}`;
22351
22398
  }
22352
22399
  async function replyToAskCandidates(client, owner, resolved) {
22353
22400
  if (owner.kind === "issue") {
@@ -48154,6 +48154,17 @@ var triageAdviceShown = new Set;
48154
48154
  function adviceMemory() {
48155
48155
  return triageAdviceShown;
48156
48156
  }
48157
+ function handBackApprovalCommand(request) {
48158
+ const owner = request.owner.kind === "project" ? `--project ${request.owner.key} --artifact ${request.artifactID}` : request.primary ? `--issue ${request.owner.key}` : `--issue ${request.owner.key} --artifact ${request.artifactID}`;
48159
+ const verification = request.owner.kind === "issue" && request.primary && request.verification ? " --include-verification" : "";
48160
+ return `dispatch request-approval ${owner}${verification} ` + `--summary '<what changed since version ${request.summaryVersion}>'`;
48161
+ }
48162
+ function movedApprovalClauses(documents) {
48163
+ return documents.map((document) => `${document.name} asked about version ${document.requested_version} and is now version ${document.version}`).join("; ");
48164
+ }
48165
+ function movedApprovalDocuments(documents) {
48166
+ return documents.filter((document) => document.requested_version < document.version);
48167
+ }
48157
48168
  function renderAdvice(tool, key, advice, opts) {
48158
48169
  if (advice === undefined)
48159
48170
  return [];
@@ -48184,6 +48195,24 @@ function renderAdvice(tool, key, advice, opts) {
48184
48195
  lines.push(`You still have an open ask on ${key}: "${ask.question.slice(0, 80)}" (${ask.id}). Still needed? See the \`dispatch\` skill, "Close what you opened".`);
48185
48196
  }
48186
48197
  }
48198
+ const movedApproval = advice.moved_approval_request;
48199
+ if (movedApproval !== undefined && (tool === "dispatch_doc_edit" || tool === "dispatch_artifact")) {
48200
+ const documents = movedApproval.documents ?? [];
48201
+ const moved = movedApprovalDocuments(documents);
48202
+ const movedOwner = movedApproval.issue !== undefined && movedApproval.issue !== "" ? { kind: "issue", key: movedApproval.issue } : movedApproval.project !== undefined && movedApproval.project !== "" ? { kind: "project", key: movedApproval.project } : undefined;
48203
+ const first = documents[0];
48204
+ const firstMoved = moved[0];
48205
+ if (moved.length > 0 && movedOwner !== undefined && first !== undefined && firstMoved !== undefined) {
48206
+ const command = handBackApprovalCommand({
48207
+ owner: movedOwner,
48208
+ artifactID: first.artifact_id,
48209
+ primary: first.primary,
48210
+ verification: documents.slice(1).some((document) => document.role === "verification"),
48211
+ summaryVersion: firstMoved.requested_version
48212
+ });
48213
+ lines.push(`This write moved the open approval request (ask ${movedApproval.ask_id}): it waits on ` + "an agent now, not on the person, and nothing tells the person. " + `${movedApprovalClauses(moved)}. Once the human has agreed to every point in it, hand ` + `the same request back: ${command}. Not yours to hand back? Tell the issue's architect.`);
48214
+ }
48215
+ }
48187
48216
  const superseded = advice.superseded_approval;
48188
48217
  if (superseded !== undefined && (tool === "dispatch_doc_edit" || tool === "dispatch_artifact")) {
48189
48218
  const gates = Array.isArray(superseded.design_gates) ? superseded.design_gates : [];
@@ -49134,10 +49163,28 @@ async function movedApprovalLine(client, askID) {
49134
49163
  const approval = ask?.approval;
49135
49164
  if (ask?.kind !== "approval" || approval === undefined)
49136
49165
  return;
49137
- if (approval.requested_version >= approval.version)
49166
+ const listed = approval.documents ?? [];
49167
+ const documents = listed.length > 0 ? listed : [
49168
+ {
49169
+ name: approval.name,
49170
+ requested_version: approval.requested_version,
49171
+ version: approval.version
49172
+ }
49173
+ ];
49174
+ const moved = movedApprovalDocuments(documents);
49175
+ if (moved.length === 0)
49138
49176
  return;
49139
- const owner = ask.issue_key === null ? `--project ${ask.approval_artifact?.project ?? "<project>"} --artifact ${approval.artifact_id}` : ask.approval_artifact?.primary === true ? `--issue ${ask.issue_key}` : `--issue ${ask.issue_key} --artifact ${approval.artifact_id}`;
49140
- return `The reply did not hand the ask to the human: it is the approval request for ${approval.name} ` + `at version ${approval.requested_version}, and ${approval.name} is now version ${approval.version}. ` + "No reply hands a moved approval request back. Once the human has agreed to every point in " + `version ${approval.version}, run: dispatch request-approval ${owner} --summary ` + `'<what changed since version ${approval.requested_version}>'`;
49177
+ const firstMoved = moved[0];
49178
+ if (firstMoved === undefined)
49179
+ return;
49180
+ const command = handBackApprovalCommand({
49181
+ owner: ask.issue_key === null ? { kind: "project", key: ask.approval_artifact?.project ?? "<project>" } : { kind: "issue", key: ask.issue_key },
49182
+ artifactID: approval.artifact_id,
49183
+ primary: ask.approval_artifact?.primary === true,
49184
+ verification: documents.length > 1 && ask.approval_artifact?.primary === true,
49185
+ summaryVersion: firstMoved.requested_version
49186
+ });
49187
+ return "The reply did not hand the ask to the human: it is an open approval request, and " + `${movedApprovalClauses(moved)}. No reply hands a moved approval request back. Once the ` + `human has agreed to every point in it, run: ${command}`;
49141
49188
  }
49142
49189
  async function replyToAskCandidates(client, owner, resolved) {
49143
49190
  if (owner.kind === "issue") {
@@ -55813,7 +55860,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
55813
55860
 
55814
55861
  // package.json
55815
55862
  var name = "@sjawhar/claude-envoy";
55816
- var version2 = "2.2.0";
55863
+ var version2 = "2.3.0";
55817
55864
  var legion = {
55818
55865
  daemonApiVersion: 73
55819
55866
  };
@@ -20368,6 +20368,17 @@ var triageAdviceShown = new Set;
20368
20368
  function adviceMemory() {
20369
20369
  return triageAdviceShown;
20370
20370
  }
20371
+ function handBackApprovalCommand(request) {
20372
+ const owner = request.owner.kind === "project" ? `--project ${request.owner.key} --artifact ${request.artifactID}` : request.primary ? `--issue ${request.owner.key}` : `--issue ${request.owner.key} --artifact ${request.artifactID}`;
20373
+ const verification = request.owner.kind === "issue" && request.primary && request.verification ? " --include-verification" : "";
20374
+ return `dispatch request-approval ${owner}${verification} ` + `--summary '<what changed since version ${request.summaryVersion}>'`;
20375
+ }
20376
+ function movedApprovalClauses(documents) {
20377
+ return documents.map((document) => `${document.name} asked about version ${document.requested_version} and is now version ${document.version}`).join("; ");
20378
+ }
20379
+ function movedApprovalDocuments(documents) {
20380
+ return documents.filter((document) => document.requested_version < document.version);
20381
+ }
20371
20382
  function renderAdvice(tool, key, advice, opts) {
20372
20383
  if (advice === undefined)
20373
20384
  return [];
@@ -20398,6 +20409,24 @@ function renderAdvice(tool, key, advice, opts) {
20398
20409
  lines.push(`You still have an open ask on ${key}: "${ask.question.slice(0, 80)}" (${ask.id}). Still needed? See the \`dispatch\` skill, "Close what you opened".`);
20399
20410
  }
20400
20411
  }
20412
+ const movedApproval = advice.moved_approval_request;
20413
+ if (movedApproval !== undefined && (tool === "dispatch_doc_edit" || tool === "dispatch_artifact")) {
20414
+ const documents = movedApproval.documents ?? [];
20415
+ const moved = movedApprovalDocuments(documents);
20416
+ const movedOwner = movedApproval.issue !== undefined && movedApproval.issue !== "" ? { kind: "issue", key: movedApproval.issue } : movedApproval.project !== undefined && movedApproval.project !== "" ? { kind: "project", key: movedApproval.project } : undefined;
20417
+ const first = documents[0];
20418
+ const firstMoved = moved[0];
20419
+ if (moved.length > 0 && movedOwner !== undefined && first !== undefined && firstMoved !== undefined) {
20420
+ const command = handBackApprovalCommand({
20421
+ owner: movedOwner,
20422
+ artifactID: first.artifact_id,
20423
+ primary: first.primary,
20424
+ verification: documents.slice(1).some((document) => document.role === "verification"),
20425
+ summaryVersion: firstMoved.requested_version
20426
+ });
20427
+ lines.push(`This write moved the open approval request (ask ${movedApproval.ask_id}): it waits on ` + "an agent now, not on the person, and nothing tells the person. " + `${movedApprovalClauses(moved)}. Once the human has agreed to every point in it, hand ` + `the same request back: ${command}. Not yours to hand back? Tell the issue's architect.`);
20428
+ }
20429
+ }
20401
20430
  const superseded = advice.superseded_approval;
20402
20431
  if (superseded !== undefined && (tool === "dispatch_doc_edit" || tool === "dispatch_artifact")) {
20403
20432
  const gates = Array.isArray(superseded.design_gates) ? superseded.design_gates : [];
@@ -21348,10 +21377,28 @@ async function movedApprovalLine(client, askID) {
21348
21377
  const approval = ask?.approval;
21349
21378
  if (ask?.kind !== "approval" || approval === undefined)
21350
21379
  return;
21351
- if (approval.requested_version >= approval.version)
21380
+ const listed = approval.documents ?? [];
21381
+ const documents = listed.length > 0 ? listed : [
21382
+ {
21383
+ name: approval.name,
21384
+ requested_version: approval.requested_version,
21385
+ version: approval.version
21386
+ }
21387
+ ];
21388
+ const moved = movedApprovalDocuments(documents);
21389
+ if (moved.length === 0)
21352
21390
  return;
21353
- const owner = ask.issue_key === null ? `--project ${ask.approval_artifact?.project ?? "<project>"} --artifact ${approval.artifact_id}` : ask.approval_artifact?.primary === true ? `--issue ${ask.issue_key}` : `--issue ${ask.issue_key} --artifact ${approval.artifact_id}`;
21354
- return `The reply did not hand the ask to the human: it is the approval request for ${approval.name} ` + `at version ${approval.requested_version}, and ${approval.name} is now version ${approval.version}. ` + "No reply hands a moved approval request back. Once the human has agreed to every point in " + `version ${approval.version}, run: dispatch request-approval ${owner} --summary ` + `'<what changed since version ${approval.requested_version}>'`;
21391
+ const firstMoved = moved[0];
21392
+ if (firstMoved === undefined)
21393
+ return;
21394
+ const command = handBackApprovalCommand({
21395
+ owner: ask.issue_key === null ? { kind: "project", key: ask.approval_artifact?.project ?? "<project>" } : { kind: "issue", key: ask.issue_key },
21396
+ artifactID: approval.artifact_id,
21397
+ primary: ask.approval_artifact?.primary === true,
21398
+ verification: documents.length > 1 && ask.approval_artifact?.primary === true,
21399
+ summaryVersion: firstMoved.requested_version
21400
+ });
21401
+ return "The reply did not hand the ask to the human: it is an open approval request, and " + `${movedApprovalClauses(moved)}. No reply hands a moved approval request back. Once the ` + `human has agreed to every point in it, run: ${command}`;
21355
21402
  }
21356
21403
  async function replyToAskCandidates(client, owner, resolved) {
21357
21404
  if (owner.kind === "issue") {
@@ -220,9 +220,13 @@ Facts about the request:
220
220
  Never open a `dispatch ask` with an `Approve` option yourself: the daemon ignores its answer.
221
221
  - Repeating the request while it waits on the human, with the same `--summary`, changes nothing and
222
222
  returns it ("already waits on the human"); a different `--summary` is refused then.
223
- - A newer version of the spec moves the open request to that version and leaves it waiting on you.
224
- No wake tells you when the edit was yours. Once the human has agreed to every point in it, call
225
- again to hand the same request back at the latest version.
223
+ - A newer version of a document moves an open approval request of it to that version and leaves it
224
+ waiting on you: the human stops seeing it in their "Waiting on you" band, and nothing tells them.
225
+ The write itself reports it. `dispatch doc-edit` and `dispatch artifact` print the request, each
226
+ document that stands above the version the request asks about with both versions, and the call
227
+ that hands it back. Once the human has agreed to every point in that version, run that call to
228
+ hand the same request back. Run it whether or not your write printed the line: a pane prints it
229
+ only once its Dispatch client carries that report.
226
230
  - If the output reads `spec.md (document id <UUID>) is already approved at version <N>`, still call
227
231
  `register_gate` with that id and version: the daemon reads the approval from Dispatch as it
228
232
  registers, opens the gate and delivers `design-approved` at once, and only once even when the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",