@sjawhar/claude-envoy 5.28.0 → 5.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": "5.28.0"
5
+ "version": "5.30.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "5.28.0",
3
+ "version": "5.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
  }
@@ -14576,8 +14576,8 @@ var dispatchToolSpecs = [
14576
14576
  route: z.string().describe("Route the issue to role:<name> or session:<id>; an empty string clears it.").optional(),
14577
14577
  parent: z.string().describe("Parent issue key, in any project; an empty string clears the parent. A parent in another project passes on no repository, components or legion label.").optional(),
14578
14578
  blocked_by: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_BLOCKERS }).describe("Replacement list of issue keys this issue waits on, of any project; [] clears it. Dispatch refuses a dependency cycle.").optional(),
14579
- advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Replacement list of priority ids this issue advances, which dispatch priorities lists; [] clears the issue's own, leaving every priority it inherits from the issues above it. A set that moves two or more relations is a whole-set write and carries advances_revision; the call reads the issue and sends the revision that read answered, so pass advances_revision only to answer a 409 ADVANCES_REVISION.").optional(),
14580
- advances_revision: z.number().describe("The advances_revision the read this set answers returned, sent with advances and alone changing nothing. Omit it and the call sends the revision of its own read; pass the revision a 409 ADVANCES_REVISION named to write the set you mean against it.").optional(),
14579
+ advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Replacement list of priority ids this issue advances, which dispatch priorities lists; [] clears the issue's own, leaving every priority it inherits from the issues above it. Without advances_revision, Dispatch takes a list that adds or removes one priority, and refuses a list that changes two or more with 409 ADVANCES_REVISION, which names the issue's revision.").optional(),
14580
+ advances_revision: z.number().describe("The issue's advances revision, which the Advances line of dispatch read --issue <KEY> prints and a 409 ADVANCES_REVISION names. To change two or more priorities, read the issue, then send this revision with the whole list you mean. Alone it changes nothing.").optional(),
14581
14581
  components: componentsArgument(z).optional(),
14582
14582
  repo: z.string().describe("The repository the issue targets, owner/name. An empty string clears it, so the issue takes the nearest ancestor's in its own project, or the project's default, again.").optional(),
14583
14583
  before: z.string().describe(`Move the issue above this issue on its project's board: an issue key in the same project. With after, the issue lands between the two. ${BOARD_NEIGHBOUR_REFUSAL}`).optional(),
@@ -15154,7 +15154,7 @@ var dispatchToolSpecs = [
15154
15154
  {
15155
15155
  name: "dispatch_steps",
15156
15156
  example: { issue: "DSP-1" },
15157
- description: "Print each step that ran on an issue, as the Legion daemon recorded it at the step's " + "start and at its end. The first line is `<KEY>: <n> steps in <m> tasks`. Then each run " + "of a step prints one line, task by task, in the order each task first ran: `<task> " + "<step> <kind> <role> <type> attempt <attempt> <agent> <model> <started_at> <ended_at> " + "<result>`. kind is step, retro or merge. step is the step's place in its task, from 1, " + "and 0 for a retro or a merge. attempt counts the runs of the same task, step and kind, " + "from 1. agent is the claim of the role that ran the step, and model is the model that " + "answered it, as provider/model. result is passed, failed or stopped. A field with no " + "value prints -, and a run that has not ended prints running for its end and its result. " + "A closed issue's steps read too. An issue that no step ran on prints 0 steps in 0 tasks, " + "and a key Dispatch does not hold fails as dispatch read fails for it, NOT_FOUND: not " + `found. ${ISSUE_REFERENCE}`,
15157
+ description: "Print each step that ran on an issue, as the Legion daemon recorded it at the step's " + "start and at its end, and the experiment and the variant the issue was drawn into, where " + "its records name one. The first line is `<KEY>: <n> steps in <m> tasks`. Where the " + "records of the issue's newest run name an experiment, the next line is `Experiment " + "<experiment>: variant <variant>.`, and an issue whose newest run's records name none " + "prints no such line. Then each run of a step prints one line, task by task, in the order " + "each task first ran: `<task> " + "<step> <kind> <role> <type> attempt <attempt> <agent> <model> <started_at> <ended_at> " + "<result>`. kind is step, retro or merge. step is the step's place in its task, from 1, " + "and 0 for a retro or a merge. attempt counts the runs of the same task, step and kind, " + "from 1. agent is the claim of the role that ran the step, and model is the model that " + "answered it, as provider/model. result is passed, failed or stopped. A field with no " + "value prints -, and a run that has not ended prints running for its end and its result. " + "A closed issue's steps read too. An issue that no step ran on prints 0 steps in 0 tasks, " + "and a key Dispatch does not hold fails as dispatch read fails for it, NOT_FOUND: not " + `found. ${ISSUE_REFERENCE}`,
15158
15158
  arguments: (z) => ({
15159
15159
  issue: z.string().describe(ISSUE_REFERENCE)
15160
15160
  }),
@@ -15163,7 +15163,7 @@ var dispatchToolSpecs = [
15163
15163
  {
15164
15164
  name: "dispatch_plans",
15165
15165
  example: { project: "INFRA" },
15166
- description: "Print each finished issue of a project, newest close first, with the plan Legion ran it " + "from, the rating each retro gave that plan with its reason, its time and its count of " + "failed steps. An issue is finished when its status is done and Dispatch closed it. The " + "first line is `<PROJECT>: <n> finished issues`. Then each issue prints one line: `<KEY> " + "closed <closed_at> plan <source> (<n> tasks: <steps of the first task>) ratings " + `<rating>/${LEGION_PLAN_RATING_MOST} "<reason>"[, <rating>/${LEGION_PLAN_RATING_MOST} "<reason>" ...] time <h>h<m>m failed steps <n>\`. ` + "source is default (Legion's default steps) or owner (the plan the issue's owner wrote), " + `and the plan is the one of the issue's newest run. A rating is ${LEGION_PLAN_RATING_LEAST} (the plan cost the ` + `work) to ${LEGION_PLAN_RATING_MOST} (the plan fit the work), one for each retro in the order the retros ran, and ` + "its reason prints as a JSON string. time runs from the first start of the issue's steps " + "to the last end, in whole hours and minutes rounded down. failed steps counts the runs " + "of a step that failed, retros and merges left out. An issue with no plan prints plan " + "none, one with no rating prints ratings none, and one whose time is not known prints " + "time -: an issue Legion never ran prints all three. since and until, each an RFC 3339 " + "time, keep the issues closed at or after since and before until.",
15166
+ description: "Print each finished issue of a project, newest close first, with the plan Legion ran it " + "from, the rating each retro gave that plan with its reason, its time, its count of " + "failed steps, and the experiment and the variant it was drawn into, where its records " + "name one. An issue is finished when its status is done and Dispatch closed it. The " + "first line is `<PROJECT>: <n> finished issues`. Then each issue prints one line: `<KEY> " + "closed <closed_at> plan <source> (<n> tasks: <steps of the first task>) ratings " + `<rating>/${LEGION_PLAN_RATING_MOST} "<reason>"[, <rating>/${LEGION_PLAN_RATING_MOST} "<reason>" ...] time <h>h<m>m failed steps <n>[ variant <experiment>/<variant>]\`. ` + "The line ends with variant <experiment>/<variant> where the records of the issue's " + "newest run name an experiment, and at failed steps <n> where they name none. " + "source is default (Legion's default steps) or owner (the plan the issue's owner wrote), " + `and the plan is the one of the issue's newest run. A rating is ${LEGION_PLAN_RATING_LEAST} (the plan cost the ` + `work) to ${LEGION_PLAN_RATING_MOST} (the plan fit the work), one for each retro in the order the retros ran, and ` + "its reason prints as a JSON string. time runs from the first start of the issue's steps " + "to the last end, in whole hours and minutes rounded down. failed steps counts the runs " + "of a step that failed, retros and merges left out. An issue with no plan prints plan " + "none, one with no rating prints ratings none, and one whose time is not known prints " + "time -: an issue Legion never ran prints all three. since and until, each an RFC 3339 " + "time, keep the issues closed at or after since and before until.",
15167
15167
  arguments: (z) => ({
15168
15168
  project: z.string().describe("Project key whose finished issues to list, such as INFRA."),
15169
15169
  since: z.string().describe("Optional RFC 3339 time; only issues closed at or after it.").optional(),
@@ -25616,9 +25616,9 @@ function advancesLine(issue) {
25616
25616
  return "Advances: unknown (this Dispatch server predates priorities; upgrade it)";
25617
25617
  }
25618
25618
  const advances = issue.advances ?? [];
25619
- if (advances.length === 0)
25620
- return "Advances: no priority";
25621
- return `Advances: ${advances.map(advanceText).join(", ")}`;
25619
+ const set = advances.length === 0 ? "no priority" : advances.map(advanceText).join(", ");
25620
+ const revision = issue.advances_revision === undefined ? "" : `; revision ${issue.advances_revision}`;
25621
+ return `Advances: ${set}${revision}`;
25622
25622
  }
25623
25623
  function claimText(claim, agents, read = {}) {
25624
25624
  const titles = agents?.titles;
@@ -26292,11 +26292,16 @@ function refuseUnsavedRepository(verb, issue, repo) {
26292
26292
  const lost = repo === "" ? "the repository was not cleared" : `${repo} was not saved`;
26293
26293
  throw new Error(`Dispatch ${verb} ${issue.key} without its repository: this Dispatch server predates repository fields, so ${lost}; upgrade the server`);
26294
26294
  }
26295
- function advancesRevisionToSend(issue, named) {
26296
- if (issue.advances_revision === undefined) {
26297
- throw new Error(`Dispatch read ${issue.key} without its advances: this Dispatch server predates priorities, so nothing was sent; upgrade the server`);
26298
- }
26299
- return named ?? issue.advances_revision;
26295
+ function refuseServerWithoutAdvances(issue) {
26296
+ if (issue.advances_revision !== undefined)
26297
+ return;
26298
+ throw new Error(`Dispatch read ${issue.key} without its advances: this Dispatch server predates priorities, so nothing was sent; upgrade the server`);
26299
+ }
26300
+ function advancesRevisionAnswer(issueKey, error) {
26301
+ if (!dispatchAnswered(error, 409) || error.code !== "ADVANCES_REVISION")
26302
+ return "";
26303
+ const held = /(\d+)\D*$/.exec(error.message)?.[1] ?? "<the revision named above>";
26304
+ return `read the issue with ${commandLine("dispatch_read", { issue: issueKey })}, then send the whole set you mean with ${fieldFlag("dispatch_issue_update", "advances_revision")} ${held}`;
26300
26305
  }
26301
26306
  async function issueCommand(context) {
26302
26307
  const { args, client, actor, input, linkBase } = context;
@@ -26407,7 +26412,9 @@ async function issueUpdateCommand(context) {
26407
26412
  } catch (error) {
26408
26413
  throw refusalWithCode(error);
26409
26414
  }
26410
- const advancesWrite = advances === undefined ? undefined : { advances, advances_revision: advancesRevisionToSend(before, advancesRevision) };
26415
+ if (advances !== undefined)
26416
+ refuseServerWithoutAdvances(before);
26417
+ const advancesWrite = advances === undefined ? undefined : { advances, ...defined("advances_revision", advancesRevision) };
26411
26418
  if (status === "done" && typeof before.closed_at === "string") {
26412
26419
  throw refusalWithCode(new DispatchServiceError("ISSUE_CLOSED", 409, "issue is closed"), `${issueKey} closed at ${before.closed_at}, so the reason was not posted and the close was not sent`);
26413
26420
  }
@@ -26465,15 +26472,17 @@ async function issueUpdateCommand(context) {
26465
26472
  throw error;
26466
26473
  const answered = error instanceof DispatchWriteUnsettledError ? error.last : error;
26467
26474
  const taken = dispatchAnswered(answered, 500) && newLinks.length > 0 ? `one of ${newLinks.join(", ")} may already be linked from another issue (a URL links exactly one issue)` : "";
26475
+ const revisionClause = advancesRevisionAnswer(issueKey, error);
26468
26476
  if (closingNote === undefined) {
26469
26477
  if (taken !== "" && !(error instanceof DispatchServiceError)) {
26470
26478
  throw withAccount(error, taken);
26471
26479
  }
26472
- throw refusalWithCode(error, taken);
26480
+ throw refusalWithCode(error, taken, revisionClause);
26473
26481
  }
26474
26482
  const landed = closeAccount(error, closingNote);
26475
- if (error instanceof DispatchServiceError)
26476
- throw refusalWithCode(error, taken, landed);
26483
+ if (error instanceof DispatchServiceError) {
26484
+ throw refusalWithCode(error, taken, revisionClause, landed);
26485
+ }
26477
26486
  throw withAccount(error, [taken, landed].filter((clause) => clause !== "").join("; "));
26478
26487
  }
26479
26488
  refuseUnsavedRepository("updated", after, repo);
@@ -28557,7 +28566,8 @@ function issueLine(issue) {
28557
28566
  ratingsText(issue.ratings),
28558
28567
  timeText(issue.duration_seconds),
28559
28568
  "failed steps",
28560
- issue.failed_steps
28569
+ issue.failed_steps,
28570
+ ...issue.experiment == null || issue.variant == null ? [] : [`variant ${issue.experiment}/${issue.variant}`]
28561
28571
  ].join(" ");
28562
28572
  }
28563
28573
  async function plansCommand(context) {
@@ -28592,7 +28602,7 @@ function priorityWorkLine(work) {
28592
28602
  }
28593
28603
  function priorityIssueLine(issue, agents) {
28594
28604
  const advances = issue.advances ?? [];
28595
- const moved = issue.moved_at === null ? "" : ` \xB7 parked ${issue.moved_at}${issue.moved_by === null ? "" : ` by ${actorLabel(issue.moved_by, agents?.titles)}`}`;
28605
+ const moved = issue.moved_at === null ? "" : ` \xB7 moved to ${issue.status} ${issue.moved_at}${issue.moved_by === null ? "" : ` by ${actorLabel(issue.moved_by, agents?.titles)}`}`;
28596
28606
  return `- ${issue.key} [${issue.status}] ${issue.title} \xB7 ${issue.project}` + (issue.assignee === null ? "" : ` \xB7 ${issue.assignee}`) + (issue.claim === null ? "" : ` \xB7 claimed by ${claimText(issue.claim, agents)}`) + (advances.length === 0 ? "" : ` \xB7 advances ${advances.map(advanceText).join(", ")}`) + moved + ` \xB7 changed ${issue.changed_at}`;
28597
28607
  }
28598
28608
  function priorityFaultLines(heading, fault, agents) {
@@ -28608,7 +28618,7 @@ function priorityFaultLines(heading, fault, agents) {
28608
28618
  }
28609
28619
  function formatPriorities(response, agents) {
28610
28620
  const priorities = response.priorities ?? [];
28611
- const parked = response.priority_work_parked;
28621
+ const backlog = response.priority_work_parked;
28612
28622
  const unplaced = response.work_under_no_priority;
28613
28623
  if (response.empty !== undefined)
28614
28624
  return response.empty;
@@ -28621,7 +28631,7 @@ function formatPriorities(response, agents) {
28621
28631
  "",
28622
28632
  ...priorityFaultLines("Work under no priority", { count: unplaced.count, issues: unplaced.issues, by: unplaced.by_project }, agents),
28623
28633
  "",
28624
- ...priorityFaultLines("Priority work parked", { count: parked.count, issues: parked.issues, by: parked.by_priority }, agents)
28634
+ ...priorityFaultLines("Priority work in backlog or icebox", { count: backlog.count, issues: backlog.issues, by: backlog.by_priority }, agents)
28625
28635
  ].join(`
28626
28636
  `);
28627
28637
  }
@@ -29586,6 +29596,11 @@ function stepLine(record) {
29586
29596
  ...record.ended_at === null ? ["running", "running"] : [record.ended_at, orDash(record.result)]
29587
29597
  ].join(" ");
29588
29598
  }
29599
+ function variantLines(records) {
29600
+ const newest = Math.max(...records.map((record) => record.generation));
29601
+ const named = records.find((record) => record.generation === newest && record.experiment != null && record.variant != null);
29602
+ return named === undefined ? [] : [`Experiment ${named.experiment}: variant ${named.variant}.`];
29603
+ }
29589
29604
  async function stepsCommand(context) {
29590
29605
  const { client, issue } = context;
29591
29606
  const read = await client.listSteps(issue());
@@ -29594,6 +29609,7 @@ async function stepsCommand(context) {
29594
29609
  return {
29595
29610
  text: [
29596
29611
  `${read.issue}: ${records.length} steps in ${tasks.length} tasks`,
29612
+ ...variantLines(records),
29597
29613
  ...records.map(stepLine)
29598
29614
  ].join(`
29599
29615
  `),
package/dist/dispatch.js CHANGED
@@ -15182,8 +15182,8 @@ var dispatchToolSpecs = [
15182
15182
  route: z.string().describe("Route the issue to role:<name> or session:<id>; an empty string clears it.").optional(),
15183
15183
  parent: z.string().describe("Parent issue key, in any project; an empty string clears the parent. A parent in another project passes on no repository, components or legion label.").optional(),
15184
15184
  blocked_by: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_BLOCKERS }).describe("Replacement list of issue keys this issue waits on, of any project; [] clears it. Dispatch refuses a dependency cycle.").optional(),
15185
- advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Replacement list of priority ids this issue advances, which dispatch priorities lists; [] clears the issue's own, leaving every priority it inherits from the issues above it. A set that moves two or more relations is a whole-set write and carries advances_revision; the call reads the issue and sends the revision that read answered, so pass advances_revision only to answer a 409 ADVANCES_REVISION.").optional(),
15186
- advances_revision: z.number().describe("The advances_revision the read this set answers returned, sent with advances and alone changing nothing. Omit it and the call sends the revision of its own read; pass the revision a 409 ADVANCES_REVISION named to write the set you mean against it.").optional(),
15185
+ advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Replacement list of priority ids this issue advances, which dispatch priorities lists; [] clears the issue's own, leaving every priority it inherits from the issues above it. Without advances_revision, Dispatch takes a list that adds or removes one priority, and refuses a list that changes two or more with 409 ADVANCES_REVISION, which names the issue's revision.").optional(),
15186
+ advances_revision: z.number().describe("The issue's advances revision, which the Advances line of dispatch read --issue <KEY> prints and a 409 ADVANCES_REVISION names. To change two or more priorities, read the issue, then send this revision with the whole list you mean. Alone it changes nothing.").optional(),
15187
15187
  components: componentsArgument(z).optional(),
15188
15188
  repo: z.string().describe("The repository the issue targets, owner/name. An empty string clears it, so the issue takes the nearest ancestor's in its own project, or the project's default, again.").optional(),
15189
15189
  before: z.string().describe(`Move the issue above this issue on its project's board: an issue key in the same project. With after, the issue lands between the two. ${BOARD_NEIGHBOUR_REFUSAL}`).optional(),
@@ -15760,7 +15760,7 @@ var dispatchToolSpecs = [
15760
15760
  {
15761
15761
  name: "dispatch_steps",
15762
15762
  example: { issue: "DSP-1" },
15763
- description: "Print each step that ran on an issue, as the Legion daemon recorded it at the step's " + "start and at its end. The first line is `<KEY>: <n> steps in <m> tasks`. Then each run " + "of a step prints one line, task by task, in the order each task first ran: `<task> " + "<step> <kind> <role> <type> attempt <attempt> <agent> <model> <started_at> <ended_at> " + "<result>`. kind is step, retro or merge. step is the step's place in its task, from 1, " + "and 0 for a retro or a merge. attempt counts the runs of the same task, step and kind, " + "from 1. agent is the claim of the role that ran the step, and model is the model that " + "answered it, as provider/model. result is passed, failed or stopped. A field with no " + "value prints -, and a run that has not ended prints running for its end and its result. " + "A closed issue's steps read too. An issue that no step ran on prints 0 steps in 0 tasks, " + "and a key Dispatch does not hold fails as dispatch read fails for it, NOT_FOUND: not " + `found. ${ISSUE_REFERENCE}`,
15763
+ description: "Print each step that ran on an issue, as the Legion daemon recorded it at the step's " + "start and at its end, and the experiment and the variant the issue was drawn into, where " + "its records name one. The first line is `<KEY>: <n> steps in <m> tasks`. Where the " + "records of the issue's newest run name an experiment, the next line is `Experiment " + "<experiment>: variant <variant>.`, and an issue whose newest run's records name none " + "prints no such line. Then each run of a step prints one line, task by task, in the order " + "each task first ran: `<task> " + "<step> <kind> <role> <type> attempt <attempt> <agent> <model> <started_at> <ended_at> " + "<result>`. kind is step, retro or merge. step is the step's place in its task, from 1, " + "and 0 for a retro or a merge. attempt counts the runs of the same task, step and kind, " + "from 1. agent is the claim of the role that ran the step, and model is the model that " + "answered it, as provider/model. result is passed, failed or stopped. A field with no " + "value prints -, and a run that has not ended prints running for its end and its result. " + "A closed issue's steps read too. An issue that no step ran on prints 0 steps in 0 tasks, " + "and a key Dispatch does not hold fails as dispatch read fails for it, NOT_FOUND: not " + `found. ${ISSUE_REFERENCE}`,
15764
15764
  arguments: (z) => ({
15765
15765
  issue: z.string().describe(ISSUE_REFERENCE)
15766
15766
  }),
@@ -15769,7 +15769,7 @@ var dispatchToolSpecs = [
15769
15769
  {
15770
15770
  name: "dispatch_plans",
15771
15771
  example: { project: "INFRA" },
15772
- description: "Print each finished issue of a project, newest close first, with the plan Legion ran it " + "from, the rating each retro gave that plan with its reason, its time and its count of " + "failed steps. An issue is finished when its status is done and Dispatch closed it. The " + "first line is `<PROJECT>: <n> finished issues`. Then each issue prints one line: `<KEY> " + "closed <closed_at> plan <source> (<n> tasks: <steps of the first task>) ratings " + `<rating>/${LEGION_PLAN_RATING_MOST} "<reason>"[, <rating>/${LEGION_PLAN_RATING_MOST} "<reason>" ...] time <h>h<m>m failed steps <n>\`. ` + "source is default (Legion's default steps) or owner (the plan the issue's owner wrote), " + `and the plan is the one of the issue's newest run. A rating is ${LEGION_PLAN_RATING_LEAST} (the plan cost the ` + `work) to ${LEGION_PLAN_RATING_MOST} (the plan fit the work), one for each retro in the order the retros ran, and ` + "its reason prints as a JSON string. time runs from the first start of the issue's steps " + "to the last end, in whole hours and minutes rounded down. failed steps counts the runs " + "of a step that failed, retros and merges left out. An issue with no plan prints plan " + "none, one with no rating prints ratings none, and one whose time is not known prints " + "time -: an issue Legion never ran prints all three. since and until, each an RFC 3339 " + "time, keep the issues closed at or after since and before until.",
15772
+ description: "Print each finished issue of a project, newest close first, with the plan Legion ran it " + "from, the rating each retro gave that plan with its reason, its time, its count of " + "failed steps, and the experiment and the variant it was drawn into, where its records " + "name one. An issue is finished when its status is done and Dispatch closed it. The " + "first line is `<PROJECT>: <n> finished issues`. Then each issue prints one line: `<KEY> " + "closed <closed_at> plan <source> (<n> tasks: <steps of the first task>) ratings " + `<rating>/${LEGION_PLAN_RATING_MOST} "<reason>"[, <rating>/${LEGION_PLAN_RATING_MOST} "<reason>" ...] time <h>h<m>m failed steps <n>[ variant <experiment>/<variant>]\`. ` + "The line ends with variant <experiment>/<variant> where the records of the issue's " + "newest run name an experiment, and at failed steps <n> where they name none. " + "source is default (Legion's default steps) or owner (the plan the issue's owner wrote), " + `and the plan is the one of the issue's newest run. A rating is ${LEGION_PLAN_RATING_LEAST} (the plan cost the ` + `work) to ${LEGION_PLAN_RATING_MOST} (the plan fit the work), one for each retro in the order the retros ran, and ` + "its reason prints as a JSON string. time runs from the first start of the issue's steps " + "to the last end, in whole hours and minutes rounded down. failed steps counts the runs " + "of a step that failed, retros and merges left out. An issue with no plan prints plan " + "none, one with no rating prints ratings none, and one whose time is not known prints " + "time -: an issue Legion never ran prints all three. since and until, each an RFC 3339 " + "time, keep the issues closed at or after since and before until.",
15773
15773
  arguments: (z) => ({
15774
15774
  project: z.string().describe("Project key whose finished issues to list, such as INFRA."),
15775
15775
  since: z.string().describe("Optional RFC 3339 time; only issues closed at or after it.").optional(),
@@ -26670,9 +26670,9 @@ function advancesLine(issue) {
26670
26670
  return "Advances: unknown (this Dispatch server predates priorities; upgrade it)";
26671
26671
  }
26672
26672
  const advances = issue.advances ?? [];
26673
- if (advances.length === 0)
26674
- return "Advances: no priority";
26675
- return `Advances: ${advances.map(advanceText).join(", ")}`;
26673
+ const set = advances.length === 0 ? "no priority" : advances.map(advanceText).join(", ");
26674
+ const revision = issue.advances_revision === undefined ? "" : `; revision ${issue.advances_revision}`;
26675
+ return `Advances: ${set}${revision}`;
26676
26676
  }
26677
26677
  function claimText(claim, agents, read = {}) {
26678
26678
  const titles = agents?.titles;
@@ -27346,11 +27346,16 @@ function refuseUnsavedRepository(verb, issue, repo) {
27346
27346
  const lost = repo === "" ? "the repository was not cleared" : `${repo} was not saved`;
27347
27347
  throw new Error(`Dispatch ${verb} ${issue.key} without its repository: this Dispatch server predates repository fields, so ${lost}; upgrade the server`);
27348
27348
  }
27349
- function advancesRevisionToSend(issue, named) {
27350
- if (issue.advances_revision === undefined) {
27351
- throw new Error(`Dispatch read ${issue.key} without its advances: this Dispatch server predates priorities, so nothing was sent; upgrade the server`);
27352
- }
27353
- return named ?? issue.advances_revision;
27349
+ function refuseServerWithoutAdvances(issue) {
27350
+ if (issue.advances_revision !== undefined)
27351
+ return;
27352
+ throw new Error(`Dispatch read ${issue.key} without its advances: this Dispatch server predates priorities, so nothing was sent; upgrade the server`);
27353
+ }
27354
+ function advancesRevisionAnswer(issueKey, error) {
27355
+ if (!dispatchAnswered(error, 409) || error.code !== "ADVANCES_REVISION")
27356
+ return "";
27357
+ const held = /(\d+)\D*$/.exec(error.message)?.[1] ?? "<the revision named above>";
27358
+ return `read the issue with ${commandLine("dispatch_read", { issue: issueKey })}, then send the whole set you mean with ${fieldFlag("dispatch_issue_update", "advances_revision")} ${held}`;
27354
27359
  }
27355
27360
  async function issueCommand(context) {
27356
27361
  const { args, client, actor, input, linkBase } = context;
@@ -27461,7 +27466,9 @@ async function issueUpdateCommand(context) {
27461
27466
  } catch (error) {
27462
27467
  throw refusalWithCode(error);
27463
27468
  }
27464
- const advancesWrite = advances === undefined ? undefined : { advances, advances_revision: advancesRevisionToSend(before, advancesRevision) };
27469
+ if (advances !== undefined)
27470
+ refuseServerWithoutAdvances(before);
27471
+ const advancesWrite = advances === undefined ? undefined : { advances, ...defined("advances_revision", advancesRevision) };
27465
27472
  if (status === "done" && typeof before.closed_at === "string") {
27466
27473
  throw refusalWithCode(new DispatchServiceError("ISSUE_CLOSED", 409, "issue is closed"), `${issueKey} closed at ${before.closed_at}, so the reason was not posted and the close was not sent`);
27467
27474
  }
@@ -27519,15 +27526,17 @@ async function issueUpdateCommand(context) {
27519
27526
  throw error;
27520
27527
  const answered = error instanceof DispatchWriteUnsettledError ? error.last : error;
27521
27528
  const taken = dispatchAnswered(answered, 500) && newLinks.length > 0 ? `one of ${newLinks.join(", ")} may already be linked from another issue (a URL links exactly one issue)` : "";
27529
+ const revisionClause = advancesRevisionAnswer(issueKey, error);
27522
27530
  if (closingNote === undefined) {
27523
27531
  if (taken !== "" && !(error instanceof DispatchServiceError)) {
27524
27532
  throw withAccount(error, taken);
27525
27533
  }
27526
- throw refusalWithCode(error, taken);
27534
+ throw refusalWithCode(error, taken, revisionClause);
27527
27535
  }
27528
27536
  const landed = closeAccount(error, closingNote);
27529
- if (error instanceof DispatchServiceError)
27530
- throw refusalWithCode(error, taken, landed);
27537
+ if (error instanceof DispatchServiceError) {
27538
+ throw refusalWithCode(error, taken, revisionClause, landed);
27539
+ }
27531
27540
  throw withAccount(error, [taken, landed].filter((clause) => clause !== "").join("; "));
27532
27541
  }
27533
27542
  refuseUnsavedRepository("updated", after, repo);
@@ -34044,7 +34053,8 @@ function issueLine(issue) {
34044
34053
  ratingsText(issue.ratings),
34045
34054
  timeText(issue.duration_seconds),
34046
34055
  "failed steps",
34047
- issue.failed_steps
34056
+ issue.failed_steps,
34057
+ ...issue.experiment == null || issue.variant == null ? [] : [`variant ${issue.experiment}/${issue.variant}`]
34048
34058
  ].join(" ");
34049
34059
  }
34050
34060
  async function plansCommand(context) {
@@ -34079,7 +34089,7 @@ function priorityWorkLine(work) {
34079
34089
  }
34080
34090
  function priorityIssueLine(issue, agents) {
34081
34091
  const advances = issue.advances ?? [];
34082
- const moved = issue.moved_at === null ? "" : ` \xB7 parked ${issue.moved_at}${issue.moved_by === null ? "" : ` by ${actorLabel(issue.moved_by, agents?.titles)}`}`;
34092
+ const moved = issue.moved_at === null ? "" : ` \xB7 moved to ${issue.status} ${issue.moved_at}${issue.moved_by === null ? "" : ` by ${actorLabel(issue.moved_by, agents?.titles)}`}`;
34083
34093
  return `- ${issue.key} [${issue.status}] ${issue.title} \xB7 ${issue.project}` + (issue.assignee === null ? "" : ` \xB7 ${issue.assignee}`) + (issue.claim === null ? "" : ` \xB7 claimed by ${claimText(issue.claim, agents)}`) + (advances.length === 0 ? "" : ` \xB7 advances ${advances.map(advanceText).join(", ")}`) + moved + ` \xB7 changed ${issue.changed_at}`;
34084
34094
  }
34085
34095
  function priorityFaultLines(heading, fault, agents) {
@@ -34095,7 +34105,7 @@ function priorityFaultLines(heading, fault, agents) {
34095
34105
  }
34096
34106
  function formatPriorities(response, agents) {
34097
34107
  const priorities = response.priorities ?? [];
34098
- const parked = response.priority_work_parked;
34108
+ const backlog = response.priority_work_parked;
34099
34109
  const unplaced = response.work_under_no_priority;
34100
34110
  if (response.empty !== undefined)
34101
34111
  return response.empty;
@@ -34108,7 +34118,7 @@ function formatPriorities(response, agents) {
34108
34118
  "",
34109
34119
  ...priorityFaultLines("Work under no priority", { count: unplaced.count, issues: unplaced.issues, by: unplaced.by_project }, agents),
34110
34120
  "",
34111
- ...priorityFaultLines("Priority work parked", { count: parked.count, issues: parked.issues, by: parked.by_priority }, agents)
34121
+ ...priorityFaultLines("Priority work in backlog or icebox", { count: backlog.count, issues: backlog.issues, by: backlog.by_priority }, agents)
34112
34122
  ].join(`
34113
34123
  `);
34114
34124
  }
@@ -35073,6 +35083,11 @@ function stepLine(record) {
35073
35083
  ...record.ended_at === null ? ["running", "running"] : [record.ended_at, orDash(record.result)]
35074
35084
  ].join(" ");
35075
35085
  }
35086
+ function variantLines(records) {
35087
+ const newest = Math.max(...records.map((record) => record.generation));
35088
+ const named = records.find((record) => record.generation === newest && record.experiment != null && record.variant != null);
35089
+ return named === undefined ? [] : [`Experiment ${named.experiment}: variant ${named.variant}.`];
35090
+ }
35076
35091
  async function stepsCommand(context) {
35077
35092
  const { client, issue } = context;
35078
35093
  const read = await client.listSteps(issue());
@@ -35081,6 +35096,7 @@ async function stepsCommand(context) {
35081
35096
  return {
35082
35097
  text: [
35083
35098
  `${read.issue}: ${records.length} steps in ${tasks.length} tasks`,
35099
+ ...variantLines(records),
35084
35100
  ...records.map(stepLine)
35085
35101
  ].join(`
35086
35102
  `),
@@ -37376,8 +37376,8 @@ var dispatchToolSpecs = [
37376
37376
  route: z.string().describe("Route the issue to role:<name> or session:<id>; an empty string clears it.").optional(),
37377
37377
  parent: z.string().describe("Parent issue key, in any project; an empty string clears the parent. A parent in another project passes on no repository, components or legion label.").optional(),
37378
37378
  blocked_by: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_BLOCKERS }).describe("Replacement list of issue keys this issue waits on, of any project; [] clears it. Dispatch refuses a dependency cycle.").optional(),
37379
- advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Replacement list of priority ids this issue advances, which dispatch priorities lists; [] clears the issue's own, leaving every priority it inherits from the issues above it. A set that moves two or more relations is a whole-set write and carries advances_revision; the call reads the issue and sends the revision that read answered, so pass advances_revision only to answer a 409 ADVANCES_REVISION.").optional(),
37380
- advances_revision: z.number().describe("The advances_revision the read this set answers returned, sent with advances and alone changing nothing. Omit it and the call sends the revision of its own read; pass the revision a 409 ADVANCES_REVISION named to write the set you mean against it.").optional(),
37379
+ advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Replacement list of priority ids this issue advances, which dispatch priorities lists; [] clears the issue's own, leaving every priority it inherits from the issues above it. Without advances_revision, Dispatch takes a list that adds or removes one priority, and refuses a list that changes two or more with 409 ADVANCES_REVISION, which names the issue's revision.").optional(),
37380
+ advances_revision: z.number().describe("The issue's advances revision, which the Advances line of dispatch read --issue <KEY> prints and a 409 ADVANCES_REVISION names. To change two or more priorities, read the issue, then send this revision with the whole list you mean. Alone it changes nothing.").optional(),
37381
37381
  components: componentsArgument(z).optional(),
37382
37382
  repo: z.string().describe("The repository the issue targets, owner/name. An empty string clears it, so the issue takes the nearest ancestor's in its own project, or the project's default, again.").optional(),
37383
37383
  before: z.string().describe(`Move the issue above this issue on its project's board: an issue key in the same project. With after, the issue lands between the two. ${BOARD_NEIGHBOUR_REFUSAL}`).optional(),
@@ -37954,7 +37954,7 @@ var dispatchToolSpecs = [
37954
37954
  {
37955
37955
  name: "dispatch_steps",
37956
37956
  example: { issue: "DSP-1" },
37957
- description: "Print each step that ran on an issue, as the Legion daemon recorded it at the step's " + "start and at its end. The first line is `<KEY>: <n> steps in <m> tasks`. Then each run " + "of a step prints one line, task by task, in the order each task first ran: `<task> " + "<step> <kind> <role> <type> attempt <attempt> <agent> <model> <started_at> <ended_at> " + "<result>`. kind is step, retro or merge. step is the step's place in its task, from 1, " + "and 0 for a retro or a merge. attempt counts the runs of the same task, step and kind, " + "from 1. agent is the claim of the role that ran the step, and model is the model that " + "answered it, as provider/model. result is passed, failed or stopped. A field with no " + "value prints -, and a run that has not ended prints running for its end and its result. " + "A closed issue's steps read too. An issue that no step ran on prints 0 steps in 0 tasks, " + "and a key Dispatch does not hold fails as dispatch read fails for it, NOT_FOUND: not " + `found. ${ISSUE_REFERENCE}`,
37957
+ description: "Print each step that ran on an issue, as the Legion daemon recorded it at the step's " + "start and at its end, and the experiment and the variant the issue was drawn into, where " + "its records name one. The first line is `<KEY>: <n> steps in <m> tasks`. Where the " + "records of the issue's newest run name an experiment, the next line is `Experiment " + "<experiment>: variant <variant>.`, and an issue whose newest run's records name none " + "prints no such line. Then each run of a step prints one line, task by task, in the order " + "each task first ran: `<task> " + "<step> <kind> <role> <type> attempt <attempt> <agent> <model> <started_at> <ended_at> " + "<result>`. kind is step, retro or merge. step is the step's place in its task, from 1, " + "and 0 for a retro or a merge. attempt counts the runs of the same task, step and kind, " + "from 1. agent is the claim of the role that ran the step, and model is the model that " + "answered it, as provider/model. result is passed, failed or stopped. A field with no " + "value prints -, and a run that has not ended prints running for its end and its result. " + "A closed issue's steps read too. An issue that no step ran on prints 0 steps in 0 tasks, " + "and a key Dispatch does not hold fails as dispatch read fails for it, NOT_FOUND: not " + `found. ${ISSUE_REFERENCE}`,
37958
37958
  arguments: (z) => ({
37959
37959
  issue: z.string().describe(ISSUE_REFERENCE)
37960
37960
  }),
@@ -37963,7 +37963,7 @@ var dispatchToolSpecs = [
37963
37963
  {
37964
37964
  name: "dispatch_plans",
37965
37965
  example: { project: "INFRA" },
37966
- description: "Print each finished issue of a project, newest close first, with the plan Legion ran it " + "from, the rating each retro gave that plan with its reason, its time and its count of " + "failed steps. An issue is finished when its status is done and Dispatch closed it. The " + "first line is `<PROJECT>: <n> finished issues`. Then each issue prints one line: `<KEY> " + "closed <closed_at> plan <source> (<n> tasks: <steps of the first task>) ratings " + `<rating>/${LEGION_PLAN_RATING_MOST} "<reason>"[, <rating>/${LEGION_PLAN_RATING_MOST} "<reason>" ...] time <h>h<m>m failed steps <n>\`. ` + "source is default (Legion's default steps) or owner (the plan the issue's owner wrote), " + `and the plan is the one of the issue's newest run. A rating is ${LEGION_PLAN_RATING_LEAST} (the plan cost the ` + `work) to ${LEGION_PLAN_RATING_MOST} (the plan fit the work), one for each retro in the order the retros ran, and ` + "its reason prints as a JSON string. time runs from the first start of the issue's steps " + "to the last end, in whole hours and minutes rounded down. failed steps counts the runs " + "of a step that failed, retros and merges left out. An issue with no plan prints plan " + "none, one with no rating prints ratings none, and one whose time is not known prints " + "time -: an issue Legion never ran prints all three. since and until, each an RFC 3339 " + "time, keep the issues closed at or after since and before until.",
37966
+ description: "Print each finished issue of a project, newest close first, with the plan Legion ran it " + "from, the rating each retro gave that plan with its reason, its time, its count of " + "failed steps, and the experiment and the variant it was drawn into, where its records " + "name one. An issue is finished when its status is done and Dispatch closed it. The " + "first line is `<PROJECT>: <n> finished issues`. Then each issue prints one line: `<KEY> " + "closed <closed_at> plan <source> (<n> tasks: <steps of the first task>) ratings " + `<rating>/${LEGION_PLAN_RATING_MOST} "<reason>"[, <rating>/${LEGION_PLAN_RATING_MOST} "<reason>" ...] time <h>h<m>m failed steps <n>[ variant <experiment>/<variant>]\`. ` + "The line ends with variant <experiment>/<variant> where the records of the issue's " + "newest run name an experiment, and at failed steps <n> where they name none. " + "source is default (Legion's default steps) or owner (the plan the issue's owner wrote), " + `and the plan is the one of the issue's newest run. A rating is ${LEGION_PLAN_RATING_LEAST} (the plan cost the ` + `work) to ${LEGION_PLAN_RATING_MOST} (the plan fit the work), one for each retro in the order the retros ran, and ` + "its reason prints as a JSON string. time runs from the first start of the issue's steps " + "to the last end, in whole hours and minutes rounded down. failed steps counts the runs " + "of a step that failed, retros and merges left out. An issue with no plan prints plan " + "none, one with no rating prints ratings none, and one whose time is not known prints " + "time -: an issue Legion never ran prints all three. since and until, each an RFC 3339 " + "time, keep the issues closed at or after since and before until.",
37967
37967
  arguments: (z) => ({
37968
37968
  project: z.string().describe("Project key whose finished issues to list, such as INFRA."),
37969
37969
  since: z.string().describe("Optional RFC 3339 time; only issues closed at or after it.").optional(),
@@ -53101,9 +53101,9 @@ function advancesLine(issue) {
53101
53101
  return "Advances: unknown (this Dispatch server predates priorities; upgrade it)";
53102
53102
  }
53103
53103
  const advances = issue.advances ?? [];
53104
- if (advances.length === 0)
53105
- return "Advances: no priority";
53106
- return `Advances: ${advances.map(advanceText).join(", ")}`;
53104
+ const set = advances.length === 0 ? "no priority" : advances.map(advanceText).join(", ");
53105
+ const revision = issue.advances_revision === undefined ? "" : `; revision ${issue.advances_revision}`;
53106
+ return `Advances: ${set}${revision}`;
53107
53107
  }
53108
53108
  function claimText(claim, agents, read = {}) {
53109
53109
  const titles = agents?.titles;
@@ -53777,11 +53777,16 @@ function refuseUnsavedRepository(verb, issue, repo) {
53777
53777
  const lost = repo === "" ? "the repository was not cleared" : `${repo} was not saved`;
53778
53778
  throw new Error(`Dispatch ${verb} ${issue.key} without its repository: this Dispatch server predates repository fields, so ${lost}; upgrade the server`);
53779
53779
  }
53780
- function advancesRevisionToSend(issue, named) {
53781
- if (issue.advances_revision === undefined) {
53782
- throw new Error(`Dispatch read ${issue.key} without its advances: this Dispatch server predates priorities, so nothing was sent; upgrade the server`);
53783
- }
53784
- return named ?? issue.advances_revision;
53780
+ function refuseServerWithoutAdvances(issue) {
53781
+ if (issue.advances_revision !== undefined)
53782
+ return;
53783
+ throw new Error(`Dispatch read ${issue.key} without its advances: this Dispatch server predates priorities, so nothing was sent; upgrade the server`);
53784
+ }
53785
+ function advancesRevisionAnswer(issueKey, error) {
53786
+ if (!dispatchAnswered(error, 409) || error.code !== "ADVANCES_REVISION")
53787
+ return "";
53788
+ const held = /(\d+)\D*$/.exec(error.message)?.[1] ?? "<the revision named above>";
53789
+ return `read the issue with ${commandLine("dispatch_read", { issue: issueKey })}, then send the whole set you mean with ${fieldFlag("dispatch_issue_update", "advances_revision")} ${held}`;
53785
53790
  }
53786
53791
  async function issueCommand(context) {
53787
53792
  const { args, client, actor, input, linkBase } = context;
@@ -53892,7 +53897,9 @@ async function issueUpdateCommand(context) {
53892
53897
  } catch (error) {
53893
53898
  throw refusalWithCode(error);
53894
53899
  }
53895
- const advancesWrite = advances === undefined ? undefined : { advances, advances_revision: advancesRevisionToSend(before, advancesRevision) };
53900
+ if (advances !== undefined)
53901
+ refuseServerWithoutAdvances(before);
53902
+ const advancesWrite = advances === undefined ? undefined : { advances, ...defined("advances_revision", advancesRevision) };
53896
53903
  if (status === "done" && typeof before.closed_at === "string") {
53897
53904
  throw refusalWithCode(new DispatchServiceError("ISSUE_CLOSED", 409, "issue is closed"), `${issueKey} closed at ${before.closed_at}, so the reason was not posted and the close was not sent`);
53898
53905
  }
@@ -53950,15 +53957,17 @@ async function issueUpdateCommand(context) {
53950
53957
  throw error;
53951
53958
  const answered = error instanceof DispatchWriteUnsettledError ? error.last : error;
53952
53959
  const taken = dispatchAnswered(answered, 500) && newLinks.length > 0 ? `one of ${newLinks.join(", ")} may already be linked from another issue (a URL links exactly one issue)` : "";
53960
+ const revisionClause = advancesRevisionAnswer(issueKey, error);
53953
53961
  if (closingNote === undefined) {
53954
53962
  if (taken !== "" && !(error instanceof DispatchServiceError)) {
53955
53963
  throw withAccount(error, taken);
53956
53964
  }
53957
- throw refusalWithCode(error, taken);
53965
+ throw refusalWithCode(error, taken, revisionClause);
53958
53966
  }
53959
53967
  const landed = closeAccount(error, closingNote);
53960
- if (error instanceof DispatchServiceError)
53961
- throw refusalWithCode(error, taken, landed);
53968
+ if (error instanceof DispatchServiceError) {
53969
+ throw refusalWithCode(error, taken, revisionClause, landed);
53970
+ }
53962
53971
  throw withAccount(error, [taken, landed].filter((clause) => clause !== "").join("; "));
53963
53972
  }
53964
53973
  refuseUnsavedRepository("updated", after, repo);
@@ -56042,7 +56051,8 @@ function issueLine(issue) {
56042
56051
  ratingsText(issue.ratings),
56043
56052
  timeText(issue.duration_seconds),
56044
56053
  "failed steps",
56045
- issue.failed_steps
56054
+ issue.failed_steps,
56055
+ ...issue.experiment == null || issue.variant == null ? [] : [`variant ${issue.experiment}/${issue.variant}`]
56046
56056
  ].join(" ");
56047
56057
  }
56048
56058
  async function plansCommand(context) {
@@ -56077,7 +56087,7 @@ function priorityWorkLine(work) {
56077
56087
  }
56078
56088
  function priorityIssueLine(issue, agents) {
56079
56089
  const advances = issue.advances ?? [];
56080
- const moved = issue.moved_at === null ? "" : ` \xB7 parked ${issue.moved_at}${issue.moved_by === null ? "" : ` by ${actorLabel(issue.moved_by, agents?.titles)}`}`;
56090
+ const moved = issue.moved_at === null ? "" : ` \xB7 moved to ${issue.status} ${issue.moved_at}${issue.moved_by === null ? "" : ` by ${actorLabel(issue.moved_by, agents?.titles)}`}`;
56081
56091
  return `- ${issue.key} [${issue.status}] ${issue.title} \xB7 ${issue.project}` + (issue.assignee === null ? "" : ` \xB7 ${issue.assignee}`) + (issue.claim === null ? "" : ` \xB7 claimed by ${claimText(issue.claim, agents)}`) + (advances.length === 0 ? "" : ` \xB7 advances ${advances.map(advanceText).join(", ")}`) + moved + ` \xB7 changed ${issue.changed_at}`;
56082
56092
  }
56083
56093
  function priorityFaultLines(heading, fault, agents) {
@@ -56093,7 +56103,7 @@ function priorityFaultLines(heading, fault, agents) {
56093
56103
  }
56094
56104
  function formatPriorities(response, agents) {
56095
56105
  const priorities = response.priorities ?? [];
56096
- const parked = response.priority_work_parked;
56106
+ const backlog = response.priority_work_parked;
56097
56107
  const unplaced = response.work_under_no_priority;
56098
56108
  if (response.empty !== undefined)
56099
56109
  return response.empty;
@@ -56106,7 +56116,7 @@ function formatPriorities(response, agents) {
56106
56116
  "",
56107
56117
  ...priorityFaultLines("Work under no priority", { count: unplaced.count, issues: unplaced.issues, by: unplaced.by_project }, agents),
56108
56118
  "",
56109
- ...priorityFaultLines("Priority work parked", { count: parked.count, issues: parked.issues, by: parked.by_priority }, agents)
56119
+ ...priorityFaultLines("Priority work in backlog or icebox", { count: backlog.count, issues: backlog.issues, by: backlog.by_priority }, agents)
56110
56120
  ].join(`
56111
56121
  `);
56112
56122
  }
@@ -57041,6 +57051,11 @@ function stepLine(record) {
57041
57051
  ...record.ended_at === null ? ["running", "running"] : [record.ended_at, orDash(record.result)]
57042
57052
  ].join(" ");
57043
57053
  }
57054
+ function variantLines(records) {
57055
+ const newest = Math.max(...records.map((record) => record.generation));
57056
+ const named = records.find((record) => record.generation === newest && record.experiment != null && record.variant != null);
57057
+ return named === undefined ? [] : [`Experiment ${named.experiment}: variant ${named.variant}.`];
57058
+ }
57044
57059
  async function stepsCommand(context) {
57045
57060
  const { client, issue } = context;
57046
57061
  const read = await client.listSteps(issue());
@@ -57049,6 +57064,7 @@ async function stepsCommand(context) {
57049
57064
  return {
57050
57065
  text: [
57051
57066
  `${read.issue}: ${records.length} steps in ${tasks.length} tasks`,
57067
+ ...variantLines(records),
57052
57068
  ...records.map(stepLine)
57053
57069
  ].join(`
57054
57070
  `),
@@ -63498,7 +63514,7 @@ var import_nats5 = __toESM(require_mod4(), 1);
63498
63514
 
63499
63515
  // package.json
63500
63516
  var name2 = "@sjawhar/claude-envoy";
63501
- var version2 = "5.28.0";
63517
+ var version2 = "5.30.0";
63502
63518
  var legion = {
63503
63519
  daemonApiVersion: 275
63504
63520
  };
@@ -18078,8 +18078,8 @@ var dispatchToolSpecs = [
18078
18078
  route: z.string().describe("Route the issue to role:<name> or session:<id>; an empty string clears it.").optional(),
18079
18079
  parent: z.string().describe("Parent issue key, in any project; an empty string clears the parent. A parent in another project passes on no repository, components or legion label.").optional(),
18080
18080
  blocked_by: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_BLOCKERS }).describe("Replacement list of issue keys this issue waits on, of any project; [] clears it. Dispatch refuses a dependency cycle.").optional(),
18081
- advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Replacement list of priority ids this issue advances, which dispatch priorities lists; [] clears the issue's own, leaving every priority it inherits from the issues above it. A set that moves two or more relations is a whole-set write and carries advances_revision; the call reads the issue and sends the revision that read answered, so pass advances_revision only to answer a 409 ADVANCES_REVISION.").optional(),
18082
- advances_revision: z.number().describe("The advances_revision the read this set answers returned, sent with advances and alone changing nothing. Omit it and the call sends the revision of its own read; pass the revision a 409 ADVANCES_REVISION named to write the set you mean against it.").optional(),
18081
+ advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Replacement list of priority ids this issue advances, which dispatch priorities lists; [] clears the issue's own, leaving every priority it inherits from the issues above it. Without advances_revision, Dispatch takes a list that adds or removes one priority, and refuses a list that changes two or more with 409 ADVANCES_REVISION, which names the issue's revision.").optional(),
18082
+ advances_revision: z.number().describe("The issue's advances revision, which the Advances line of dispatch read --issue <KEY> prints and a 409 ADVANCES_REVISION names. To change two or more priorities, read the issue, then send this revision with the whole list you mean. Alone it changes nothing.").optional(),
18083
18083
  components: componentsArgument(z).optional(),
18084
18084
  repo: z.string().describe("The repository the issue targets, owner/name. An empty string clears it, so the issue takes the nearest ancestor's in its own project, or the project's default, again.").optional(),
18085
18085
  before: z.string().describe(`Move the issue above this issue on its project's board: an issue key in the same project. With after, the issue lands between the two. ${BOARD_NEIGHBOUR_REFUSAL}`).optional(),
@@ -18656,7 +18656,7 @@ var dispatchToolSpecs = [
18656
18656
  {
18657
18657
  name: "dispatch_steps",
18658
18658
  example: { issue: "DSP-1" },
18659
- description: "Print each step that ran on an issue, as the Legion daemon recorded it at the step's " + "start and at its end. The first line is `<KEY>: <n> steps in <m> tasks`. Then each run " + "of a step prints one line, task by task, in the order each task first ran: `<task> " + "<step> <kind> <role> <type> attempt <attempt> <agent> <model> <started_at> <ended_at> " + "<result>`. kind is step, retro or merge. step is the step's place in its task, from 1, " + "and 0 for a retro or a merge. attempt counts the runs of the same task, step and kind, " + "from 1. agent is the claim of the role that ran the step, and model is the model that " + "answered it, as provider/model. result is passed, failed or stopped. A field with no " + "value prints -, and a run that has not ended prints running for its end and its result. " + "A closed issue's steps read too. An issue that no step ran on prints 0 steps in 0 tasks, " + "and a key Dispatch does not hold fails as dispatch read fails for it, NOT_FOUND: not " + `found. ${ISSUE_REFERENCE}`,
18659
+ description: "Print each step that ran on an issue, as the Legion daemon recorded it at the step's " + "start and at its end, and the experiment and the variant the issue was drawn into, where " + "its records name one. The first line is `<KEY>: <n> steps in <m> tasks`. Where the " + "records of the issue's newest run name an experiment, the next line is `Experiment " + "<experiment>: variant <variant>.`, and an issue whose newest run's records name none " + "prints no such line. Then each run of a step prints one line, task by task, in the order " + "each task first ran: `<task> " + "<step> <kind> <role> <type> attempt <attempt> <agent> <model> <started_at> <ended_at> " + "<result>`. kind is step, retro or merge. step is the step's place in its task, from 1, " + "and 0 for a retro or a merge. attempt counts the runs of the same task, step and kind, " + "from 1. agent is the claim of the role that ran the step, and model is the model that " + "answered it, as provider/model. result is passed, failed or stopped. A field with no " + "value prints -, and a run that has not ended prints running for its end and its result. " + "A closed issue's steps read too. An issue that no step ran on prints 0 steps in 0 tasks, " + "and a key Dispatch does not hold fails as dispatch read fails for it, NOT_FOUND: not " + `found. ${ISSUE_REFERENCE}`,
18660
18660
  arguments: (z) => ({
18661
18661
  issue: z.string().describe(ISSUE_REFERENCE)
18662
18662
  }),
@@ -18665,7 +18665,7 @@ var dispatchToolSpecs = [
18665
18665
  {
18666
18666
  name: "dispatch_plans",
18667
18667
  example: { project: "INFRA" },
18668
- description: "Print each finished issue of a project, newest close first, with the plan Legion ran it " + "from, the rating each retro gave that plan with its reason, its time and its count of " + "failed steps. An issue is finished when its status is done and Dispatch closed it. The " + "first line is `<PROJECT>: <n> finished issues`. Then each issue prints one line: `<KEY> " + "closed <closed_at> plan <source> (<n> tasks: <steps of the first task>) ratings " + `<rating>/${LEGION_PLAN_RATING_MOST} "<reason>"[, <rating>/${LEGION_PLAN_RATING_MOST} "<reason>" ...] time <h>h<m>m failed steps <n>\`. ` + "source is default (Legion's default steps) or owner (the plan the issue's owner wrote), " + `and the plan is the one of the issue's newest run. A rating is ${LEGION_PLAN_RATING_LEAST} (the plan cost the ` + `work) to ${LEGION_PLAN_RATING_MOST} (the plan fit the work), one for each retro in the order the retros ran, and ` + "its reason prints as a JSON string. time runs from the first start of the issue's steps " + "to the last end, in whole hours and minutes rounded down. failed steps counts the runs " + "of a step that failed, retros and merges left out. An issue with no plan prints plan " + "none, one with no rating prints ratings none, and one whose time is not known prints " + "time -: an issue Legion never ran prints all three. since and until, each an RFC 3339 " + "time, keep the issues closed at or after since and before until.",
18668
+ description: "Print each finished issue of a project, newest close first, with the plan Legion ran it " + "from, the rating each retro gave that plan with its reason, its time, its count of " + "failed steps, and the experiment and the variant it was drawn into, where its records " + "name one. An issue is finished when its status is done and Dispatch closed it. The " + "first line is `<PROJECT>: <n> finished issues`. Then each issue prints one line: `<KEY> " + "closed <closed_at> plan <source> (<n> tasks: <steps of the first task>) ratings " + `<rating>/${LEGION_PLAN_RATING_MOST} "<reason>"[, <rating>/${LEGION_PLAN_RATING_MOST} "<reason>" ...] time <h>h<m>m failed steps <n>[ variant <experiment>/<variant>]\`. ` + "The line ends with variant <experiment>/<variant> where the records of the issue's " + "newest run name an experiment, and at failed steps <n> where they name none. " + "source is default (Legion's default steps) or owner (the plan the issue's owner wrote), " + `and the plan is the one of the issue's newest run. A rating is ${LEGION_PLAN_RATING_LEAST} (the plan cost the ` + `work) to ${LEGION_PLAN_RATING_MOST} (the plan fit the work), one for each retro in the order the retros ran, and ` + "its reason prints as a JSON string. time runs from the first start of the issue's steps " + "to the last end, in whole hours and minutes rounded down. failed steps counts the runs " + "of a step that failed, retros and merges left out. An issue with no plan prints plan " + "none, one with no rating prints ratings none, and one whose time is not known prints " + "time -: an issue Legion never ran prints all three. since and until, each an RFC 3339 " + "time, keep the issues closed at or after since and before until.",
18669
18669
  arguments: (z) => ({
18670
18670
  project: z.string().describe("Project key whose finished issues to list, such as INFRA."),
18671
18671
  since: z.string().describe("Optional RFC 3339 time; only issues closed at or after it.").optional(),
@@ -28450,9 +28450,9 @@ function advancesLine(issue) {
28450
28450
  return "Advances: unknown (this Dispatch server predates priorities; upgrade it)";
28451
28451
  }
28452
28452
  const advances = issue.advances ?? [];
28453
- if (advances.length === 0)
28454
- return "Advances: no priority";
28455
- return `Advances: ${advances.map(advanceText).join(", ")}`;
28453
+ const set = advances.length === 0 ? "no priority" : advances.map(advanceText).join(", ");
28454
+ const revision = issue.advances_revision === undefined ? "" : `; revision ${issue.advances_revision}`;
28455
+ return `Advances: ${set}${revision}`;
28456
28456
  }
28457
28457
  function claimText(claim, agents, read = {}) {
28458
28458
  const titles = agents?.titles;
@@ -29126,11 +29126,16 @@ function refuseUnsavedRepository(verb, issue, repo) {
29126
29126
  const lost = repo === "" ? "the repository was not cleared" : `${repo} was not saved`;
29127
29127
  throw new Error(`Dispatch ${verb} ${issue.key} without its repository: this Dispatch server predates repository fields, so ${lost}; upgrade the server`);
29128
29128
  }
29129
- function advancesRevisionToSend(issue, named) {
29130
- if (issue.advances_revision === undefined) {
29131
- throw new Error(`Dispatch read ${issue.key} without its advances: this Dispatch server predates priorities, so nothing was sent; upgrade the server`);
29132
- }
29133
- return named ?? issue.advances_revision;
29129
+ function refuseServerWithoutAdvances(issue) {
29130
+ if (issue.advances_revision !== undefined)
29131
+ return;
29132
+ throw new Error(`Dispatch read ${issue.key} without its advances: this Dispatch server predates priorities, so nothing was sent; upgrade the server`);
29133
+ }
29134
+ function advancesRevisionAnswer(issueKey, error) {
29135
+ if (!dispatchAnswered(error, 409) || error.code !== "ADVANCES_REVISION")
29136
+ return "";
29137
+ const held = /(\d+)\D*$/.exec(error.message)?.[1] ?? "<the revision named above>";
29138
+ return `read the issue with ${commandLine("dispatch_read", { issue: issueKey })}, then send the whole set you mean with ${fieldFlag("dispatch_issue_update", "advances_revision")} ${held}`;
29134
29139
  }
29135
29140
  async function issueCommand(context) {
29136
29141
  const { args, client, actor, input, linkBase } = context;
@@ -29241,7 +29246,9 @@ async function issueUpdateCommand(context) {
29241
29246
  } catch (error) {
29242
29247
  throw refusalWithCode(error);
29243
29248
  }
29244
- const advancesWrite = advances === undefined ? undefined : { advances, advances_revision: advancesRevisionToSend(before, advancesRevision) };
29249
+ if (advances !== undefined)
29250
+ refuseServerWithoutAdvances(before);
29251
+ const advancesWrite = advances === undefined ? undefined : { advances, ...defined("advances_revision", advancesRevision) };
29245
29252
  if (status === "done" && typeof before.closed_at === "string") {
29246
29253
  throw refusalWithCode(new DispatchServiceError("ISSUE_CLOSED", 409, "issue is closed"), `${issueKey} closed at ${before.closed_at}, so the reason was not posted and the close was not sent`);
29247
29254
  }
@@ -29299,15 +29306,17 @@ async function issueUpdateCommand(context) {
29299
29306
  throw error;
29300
29307
  const answered = error instanceof DispatchWriteUnsettledError ? error.last : error;
29301
29308
  const taken = dispatchAnswered(answered, 500) && newLinks.length > 0 ? `one of ${newLinks.join(", ")} may already be linked from another issue (a URL links exactly one issue)` : "";
29309
+ const revisionClause = advancesRevisionAnswer(issueKey, error);
29302
29310
  if (closingNote === undefined) {
29303
29311
  if (taken !== "" && !(error instanceof DispatchServiceError)) {
29304
29312
  throw withAccount(error, taken);
29305
29313
  }
29306
- throw refusalWithCode(error, taken);
29314
+ throw refusalWithCode(error, taken, revisionClause);
29307
29315
  }
29308
29316
  const landed = closeAccount(error, closingNote);
29309
- if (error instanceof DispatchServiceError)
29310
- throw refusalWithCode(error, taken, landed);
29317
+ if (error instanceof DispatchServiceError) {
29318
+ throw refusalWithCode(error, taken, revisionClause, landed);
29319
+ }
29311
29320
  throw withAccount(error, [taken, landed].filter((clause) => clause !== "").join("; "));
29312
29321
  }
29313
29322
  refuseUnsavedRepository("updated", after, repo);
@@ -31391,7 +31400,8 @@ function issueLine(issue) {
31391
31400
  ratingsText(issue.ratings),
31392
31401
  timeText(issue.duration_seconds),
31393
31402
  "failed steps",
31394
- issue.failed_steps
31403
+ issue.failed_steps,
31404
+ ...issue.experiment == null || issue.variant == null ? [] : [`variant ${issue.experiment}/${issue.variant}`]
31395
31405
  ].join(" ");
31396
31406
  }
31397
31407
  async function plansCommand(context) {
@@ -31426,7 +31436,7 @@ function priorityWorkLine(work) {
31426
31436
  }
31427
31437
  function priorityIssueLine(issue, agents) {
31428
31438
  const advances = issue.advances ?? [];
31429
- const moved = issue.moved_at === null ? "" : ` \xB7 parked ${issue.moved_at}${issue.moved_by === null ? "" : ` by ${actorLabel(issue.moved_by, agents?.titles)}`}`;
31439
+ const moved = issue.moved_at === null ? "" : ` \xB7 moved to ${issue.status} ${issue.moved_at}${issue.moved_by === null ? "" : ` by ${actorLabel(issue.moved_by, agents?.titles)}`}`;
31430
31440
  return `- ${issue.key} [${issue.status}] ${issue.title} \xB7 ${issue.project}` + (issue.assignee === null ? "" : ` \xB7 ${issue.assignee}`) + (issue.claim === null ? "" : ` \xB7 claimed by ${claimText(issue.claim, agents)}`) + (advances.length === 0 ? "" : ` \xB7 advances ${advances.map(advanceText).join(", ")}`) + moved + ` \xB7 changed ${issue.changed_at}`;
31431
31441
  }
31432
31442
  function priorityFaultLines(heading, fault, agents) {
@@ -31442,7 +31452,7 @@ function priorityFaultLines(heading, fault, agents) {
31442
31452
  }
31443
31453
  function formatPriorities(response, agents) {
31444
31454
  const priorities = response.priorities ?? [];
31445
- const parked = response.priority_work_parked;
31455
+ const backlog = response.priority_work_parked;
31446
31456
  const unplaced = response.work_under_no_priority;
31447
31457
  if (response.empty !== undefined)
31448
31458
  return response.empty;
@@ -31455,7 +31465,7 @@ function formatPriorities(response, agents) {
31455
31465
  "",
31456
31466
  ...priorityFaultLines("Work under no priority", { count: unplaced.count, issues: unplaced.issues, by: unplaced.by_project }, agents),
31457
31467
  "",
31458
- ...priorityFaultLines("Priority work parked", { count: parked.count, issues: parked.issues, by: parked.by_priority }, agents)
31468
+ ...priorityFaultLines("Priority work in backlog or icebox", { count: backlog.count, issues: backlog.issues, by: backlog.by_priority }, agents)
31459
31469
  ].join(`
31460
31470
  `);
31461
31471
  }
@@ -32420,6 +32430,11 @@ function stepLine(record) {
32420
32430
  ...record.ended_at === null ? ["running", "running"] : [record.ended_at, orDash(record.result)]
32421
32431
  ].join(" ");
32422
32432
  }
32433
+ function variantLines(records) {
32434
+ const newest = Math.max(...records.map((record) => record.generation));
32435
+ const named = records.find((record) => record.generation === newest && record.experiment != null && record.variant != null);
32436
+ return named === undefined ? [] : [`Experiment ${named.experiment}: variant ${named.variant}.`];
32437
+ }
32423
32438
  async function stepsCommand(context) {
32424
32439
  const { client, issue } = context;
32425
32440
  const read = await client.listSteps(issue());
@@ -32428,6 +32443,7 @@ async function stepsCommand(context) {
32428
32443
  return {
32429
32444
  text: [
32430
32445
  `${read.issue}: ${records.length} steps in ${tasks.length} tasks`,
32446
+ ...variantLines(records),
32431
32447
  ...records.map(stepLine)
32432
32448
  ].join(`
32433
32449
  `),
@@ -74,5 +74,5 @@ The version you give replaces them with your own one block: delete theirs, and p
74
74
  ## Reading how plans went
75
75
 
76
76
  `dispatch steps --issue <KEY>` lists each run of each step of an issue and how it ended.
77
- Each finished issue of a project, with its plan's source and steps, its retro's ratings, its time and its count of failed steps, is `dispatch plans --project <KEY>`.
77
+ `dispatch plans --project <KEY>` lists each finished issue of a project with its plan and how that plan went.
78
78
  Read it before you choose the steps of an issue like one that finished.
@@ -31,6 +31,6 @@ dispatch issue-update --issue <KEY> --label '<each current label>' --label legio
31
31
 
32
32
  A label holding a `'` or a line break cannot be quoted and never goes in a command: tell the person (`<KEY>: label <label> cannot be quoted`), so they hand it over from the issue header.
33
33
 
34
- The daemon queues nothing for a label a session set, so admit a `triage` root in the same turn, from step 3. In any other status, `set_status` it to `todo` only when the person asked Legion to start it now. When you file or admit an issue, name each priority it advances (`--advance <id>`; `dispatch priorities` lists them). A child needs no label: it runs in its tree.
34
+ The daemon queues nothing for a label a session set, so admit a `triage` root in the same turn, from step 3. In any other status, `set_status` it to `todo` only when the person asked Legion to start it now. When you file or admit an issue, name each priority it advances (`--advance <id>`; `dispatch priorities` lists them). An issue in flight that advances none is named on the priorities page, in its `Active under no priority` tab (`/priorities?tab=none`), and by `dispatch priorities`. A child needs no label: it runs in its tree.
35
35
 
36
36
  Work that must start at a commit other than its base branch's head needs `legion/<KEY>` there before Legion starts the issue: a root before admission, a child before its first phase. You push nothing, so whoever gives you the root, or the architect that owns a child's parent, runs `gh api -X POST repos/<owner>/<name>/git/refs -f ref=refs/heads/legion/<KEY> -f sha=<commit>`. Read it back before `set_status` to `todo`: `gh api repos/<owner>/<name>/git/ref/heads/legion/<KEY>`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "5.28.0",
3
+ "version": "5.30.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
@@ -40,9 +40,9 @@ The question and the recommendation (`skill://dispatch-writing-specs`).
40
40
  - Move an issue to `backlog`, `icebox` or `triage` only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and cite that reason in a comment on the issue. An agent's directive citing no person's request is no reason.
41
41
  - When you stop work on an issue before it is done, release your claim and say why in a comment. Set its status to the one it had when you took it (`todo` for an issue from the queue). Change no priority or board rank.
42
42
  - Record each wait in that comment. A wait on any project's issue also goes in a `blocked_by` link.
43
- - `dispatch issue-update --blocked-by` replaces the issue's whole list, so read its links first. A one-project credential links only its own issues (`PROJECT_SCOPE`).
43
+ - `dispatch issue-update --blocked-by` replaces the issue's whole list, so read that list first. A one-project credential links only its own issues (`PROJECT_SCOPE`).
44
44
  - Never reorder the board: one agent keeps each project's order (`issue-update --before`/`--after`). If the top looks wrong, tell `notifications.role.legion-<project>-controller`.
45
- - Name an issue's priority: `--advance <id>`; `dispatch priorities` lists what advances no priority.
45
+ - Name an issue's priority: `--advance <id>`; the priorities page (`/priorities?tab=none`) and `dispatch priorities` list what advances no priority.
46
46
 
47
47
  ## Issue status is yours to move
48
48