@sjawhar/pi-envoy 16.24.0 → 16.25.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.
package/dist/dispatch.js CHANGED
@@ -14629,7 +14629,8 @@ var IssueEventPayloadSchema = object({
14629
14629
  route: string2().nullish(),
14630
14630
  changed: array(string2()).optional(),
14631
14631
  ancestors: array(string2()).optional(),
14632
- thread_logins: array(string2()).optional()
14632
+ thread_logins: array(string2()).optional(),
14633
+ forced: object({ past: array(string2()) }).optional()
14633
14634
  });
14634
14635
  var ArtifactCreatedEventPayloadSchema = object({
14635
14636
  artifact: object({ id: string2().optional(), slug: string2().optional(), name: string2().optional() }).optional()
@@ -15582,12 +15583,12 @@ var dispatchToolSpecs = [
15582
15583
  {
15583
15584
  name: "dispatch_related",
15584
15585
  example: { project: "CORE", title: "Retry failed webhook deliveries" },
15585
- description: "Run the related-item check that dispatch issue, dispatch ask and a new decision block in " + "dispatch doc-edit run on their own write, and write nothing: it lists the three items of " + "one project most like a title and a text (at most one per issue or document, open ones " + "first), each ask with whether it is answered, and a past decision that already answers " + "the same question. Use it to check a draft before filing it. It searches by meaning and by " + "the text's rarest words, and says how it searched; when meaning search cannot run it " + "searches by keywords only and says why. When it could not search at all it says why and " + "names the dispatch search to run instead. exclude_issue leaves that issue's own items out, " + "as a check on that issue's own write does; keywords_only skips meaning search.",
15586
+ description: "Run the related-item check that dispatch issue, dispatch ask and a new decision block in " + "dispatch doc-edit run on their own write, and write nothing: it lists the three items of " + "one project most like a title and a text (at most one per issue or document, open ones " + "first), each ask with whether it is answered, and a past decision that already answers " + "the same question. Use it to check a draft before filing it. It searches by meaning and by " + "the text's rarest words, and says how it searched; when meaning search cannot run it " + "searches by keywords only and says why. When it could not search at all it says why and " + "names the dispatch search to run instead. exclude_issues leaves each named issue's own " + "items out of the results, at most 50 of them, so a draft under a parent can leave out " + "that parent and its children without changing how rare the text's words are; " + "keywords_only skips meaning search.",
15586
15587
  arguments: (z) => ({
15587
15588
  project: z.string().describe("Project key to search within, such as CORE."),
15588
15589
  title: z.string({ max: ISSUE_TITLE_MAX }).describe("Optional title to check, as an issue title; at most 1,000 characters.").optional(),
15589
15590
  text: z.string().describe("Optional text to check, such as a draft spec or a question.").optional(),
15590
- exclude_issue: z.string().describe("Optional issue key in the project whose own items are left out.").optional(),
15591
+ exclude_issues: z.array(z.string()).describe("Optional issue keys in the project whose own items are left out of the results; at most 50.").optional(),
15591
15592
  keywords_only: z.boolean().describe("Search by keywords only, skipping meaning search.").optional()
15592
15593
  }),
15593
15594
  validation: {
@@ -19167,11 +19168,19 @@ function relatedCheckLines(suggestions, context) {
19167
19168
  lines.push(`A past decision may already answer this: ${suggestionLabel(decision)}, answered by ${decision.answered_by}${when} \u2192 ${absoluteHref(decision.href, context.configUrl)}`);
19168
19169
  lines.push(...askLines(decision.ask));
19169
19170
  }
19171
+ const likely = suggestions.likely_duplicate;
19172
+ if (likely !== undefined && likely !== null) {
19173
+ lines.push(`Likely duplicate: ${likely.key} [${likely.status}] ${likely.title} \u2192 ${absoluteHref(likely.href, context.configUrl)}`);
19174
+ lines.push("Read it. If it is the same work, fold this issue into it by the duplicate rule of skill://dispatch-first.");
19175
+ }
19176
+ if (suggestions.near_copy_check !== undefined && suggestions.near_copy_check !== "") {
19177
+ lines.push(`No near-copy check was made: ${suggestions.near_copy_check}.`);
19178
+ }
19170
19179
  for (const match of suggestions.title_matches ?? []) {
19171
- lines.push(`Title overlaps you forced past: ${match.key} [${match.status}] ${match.title} \u2192 ${absoluteHref(match.href, context.configUrl)}`);
19180
+ lines.push(`Near copy you forced past: ${match.key} [${match.status}] ${match.title} \u2192 ${absoluteHref(match.href, context.configUrl)}`);
19172
19181
  }
19173
19182
  } catch (error) {
19174
- lines.push(`The check's past decision or title overlaps could not be shown: ${messageFor(error)}`);
19183
+ lines.push(`The check's past decision or near copies could not be shown: ${messageFor(error)}`);
19175
19184
  }
19176
19185
  return lines;
19177
19186
  }
@@ -20829,7 +20838,13 @@ function eventHead(event) {
20829
20838
  return textHead(`${event.payload.name} v${event.payload.version.number}${event.payload.version.summary ? `: ${event.payload.version.summary}` : ""}`);
20830
20839
  case "artifact.human_edited":
20831
20840
  return textHead(humanEditHead(event.payload));
20832
- case "issue.created":
20841
+ case "issue.created": {
20842
+ const forced = event.payload.forced;
20843
+ const head = `status ${event.payload.status}`;
20844
+ if (forced === undefined)
20845
+ return head;
20846
+ return forced.past.length === 0 ? `${head} \xB7 forced, the near-copy check did not answer` : `${head} \xB7 forced past ${forced.past.join(", ")}`;
20847
+ }
20833
20848
  case "issue.updated":
20834
20849
  case "issue.closed":
20835
20850
  return `status ${event.payload.status}`;
@@ -20845,10 +20860,14 @@ function eventRef(event) {
20845
20860
  const kind = event.type.startsWith("message.") ? "message" : event.type.startsWith("comment.") || event.type.startsWith("suggestion.") ? "comment" : event.type.startsWith("ask.") ? "ask" : undefined;
20846
20861
  return kind === undefined ? undefined : `dispatch://${event.issue_key}/${kind}/${id}`;
20847
20862
  }
20863
+ function eventActorText(actor) {
20864
+ const title = actor.kind === "session" ? actor.origin?.session_title : undefined;
20865
+ return title === undefined || title === "" ? actorText(actor) : `${actorText(actor)} (${title})`;
20866
+ }
20848
20867
  function eventLine(event) {
20849
20868
  const head = eventHead(event);
20850
20869
  const ref = eventRef(event);
20851
- return `- #${event.seq} ${event.type}${ref === undefined ? "" : ` ${ref}`} \xB7 ${actorText(event.actor)} \xB7 ${event.created_at}${head === undefined || head === "" ? "" : ` \xB7 ${head}`}`;
20870
+ return `- #${event.seq} ${event.type}${ref === undefined ? "" : ` ${ref}`} \xB7 ${eventActorText(event.actor)} \xB7 ${event.created_at}${head === undefined || head === "" ? "" : ` \xB7 ${head}`}`;
20852
20871
  }
20853
20872
  function childrenSummary(issue) {
20854
20873
  return [
@@ -21665,15 +21684,17 @@ async function executeDispatchTool(input) {
21665
21684
  const candidates = duplicateCandidates(error);
21666
21685
  return {
21667
21686
  text: [
21668
- `Not created: "${title}" looks like a duplicate.`,
21687
+ `Not created: "${title}" is a near copy of an open issue.`,
21669
21688
  ...candidates.map((candidate) => {
21670
21689
  const href = new URL(candidate.href, linkBase).toString();
21671
21690
  return `${candidate.key} [${candidate.status}] ${candidate.title} \u2192 ${href}`;
21672
21691
  }),
21673
- "Reference the existing issue, or run dispatch issue again with --force after reading it."
21692
+ "Read each issue above. If one is the same work, fold this into it by the duplicate rule of skill://dispatch-first.",
21693
+ "If none is, run dispatch issue again with --force, and write in the new issue's spec why it is not each issue named here."
21674
21694
  ].join(`
21675
21695
  `),
21676
- details: { duplicates: candidates }
21696
+ details: { duplicates: candidates },
21697
+ refused: true
21677
21698
  };
21678
21699
  }
21679
21700
  }
@@ -21841,12 +21862,12 @@ async function executeDispatchTool(input) {
21841
21862
  const project = stringArg(args, "project");
21842
21863
  const title = optionalString(args, "title");
21843
21864
  const text = optionalString(args, "text");
21844
- const excludeIssue = optionalString(args, "exclude_issue");
21865
+ const excludeIssues = optionalStringArray(args, "exclude_issues");
21845
21866
  const keywordsOnly = optionalBoolean(args, "keywords_only");
21846
21867
  const suggestions = await client.related(project, {
21847
21868
  ...title === undefined ? {} : { title },
21848
21869
  ...text === undefined ? {} : { text },
21849
- ...excludeIssue === undefined ? {} : { exclude_issue: excludeIssue },
21870
+ ...excludeIssues === undefined ? {} : { exclude_issues: excludeIssues },
21850
21871
  ...keywordsOnly === undefined ? {} : { keywords_only: keywordsOnly }
21851
21872
  });
21852
21873
  return {
@@ -26595,7 +26616,7 @@ async function runDispatchCli(argv, rawEnv, io) {
26595
26616
  if (parsed.kind === "refused") {
26596
26617
  return parsed.tool === undefined ? refuse([`dispatch: ${parsed.problems.join(`
26597
26618
  `)}`, "Run dispatch --help."].join(`
26598
- `), USAGE) : refuse(new ToolInputError(parsed.tool, parsed.problems).message, REFUSED, parsed.tool);
26619
+ `), USAGE) : refuse(new ToolInputError(parsed.tool, parsed.problems).message, USAGE, parsed.tool);
26599
26620
  }
26600
26621
  const hostName = env.DISPATCH_HOST ?? (env.CLAUDE_CODE_CHILD_SESSION === "1" ? "claude" : undefined);
26601
26622
  const host = HOSTS.find((name) => name === hostName);
@@ -26623,7 +26644,7 @@ async function runDispatchCli(argv, rawEnv, io) {
26623
26644
  serverUrls: settings?.enabled === true ? dispatchServerUrls(settings) : []
26624
26645
  });
26625
26646
  if (problems.length > 0) {
26626
- return refuse(new ToolInputError(parsed.tool, problems).message, REFUSED, parsed.tool);
26647
+ return refuse(new ToolInputError(parsed.tool, problems).message, USAGE, parsed.tool);
26627
26648
  }
26628
26649
  print(JSON.stringify(parsed.args, null, 2));
26629
26650
  return OK;
@@ -26760,7 +26781,7 @@ async function runDispatchCli(argv, rawEnv, io) {
26760
26781
  notes.push(followNoticeText(followed, await subscriptions()));
26761
26782
  }
26762
26783
  entry = { tool, details: result.details };
26763
- code = OK;
26784
+ code = result.refused === true ? REFUSED : OK;
26764
26785
  } catch (error) {
26765
26786
  text = messageFor(error);
26766
26787
  if (error instanceof DispatchWriteLandedError) {
@@ -26768,7 +26789,7 @@ async function runDispatchCli(argv, rawEnv, io) {
26768
26789
  code = OK;
26769
26790
  } else {
26770
26791
  entry = { tool, error: text };
26771
- code = REFUSED;
26792
+ code = error instanceof ToolInputError ? USAGE : REFUSED;
26772
26793
  }
26773
26794
  }
26774
26795
  try {
package/dist/envoy.js CHANGED
@@ -29721,7 +29721,8 @@ var IssueEventPayloadSchema = object({
29721
29721
  route: string2().nullish(),
29722
29722
  changed: array(string2()).optional(),
29723
29723
  ancestors: array(string2()).optional(),
29724
- thread_logins: array(string2()).optional()
29724
+ thread_logins: array(string2()).optional(),
29725
+ forced: object({ past: array(string2()) }).optional()
29725
29726
  });
29726
29727
  var ArtifactCreatedEventPayloadSchema = object({
29727
29728
  artifact: object({ id: string2().optional(), slug: string2().optional(), name: string2().optional() }).optional()
@@ -30627,12 +30628,12 @@ var dispatchToolSpecs = [
30627
30628
  {
30628
30629
  name: "dispatch_related",
30629
30630
  example: { project: "CORE", title: "Retry failed webhook deliveries" },
30630
- description: "Run the related-item check that dispatch issue, dispatch ask and a new decision block in " + "dispatch doc-edit run on their own write, and write nothing: it lists the three items of " + "one project most like a title and a text (at most one per issue or document, open ones " + "first), each ask with whether it is answered, and a past decision that already answers " + "the same question. Use it to check a draft before filing it. It searches by meaning and by " + "the text's rarest words, and says how it searched; when meaning search cannot run it " + "searches by keywords only and says why. When it could not search at all it says why and " + "names the dispatch search to run instead. exclude_issue leaves that issue's own items out, " + "as a check on that issue's own write does; keywords_only skips meaning search.",
30631
+ description: "Run the related-item check that dispatch issue, dispatch ask and a new decision block in " + "dispatch doc-edit run on their own write, and write nothing: it lists the three items of " + "one project most like a title and a text (at most one per issue or document, open ones " + "first), each ask with whether it is answered, and a past decision that already answers " + "the same question. Use it to check a draft before filing it. It searches by meaning and by " + "the text's rarest words, and says how it searched; when meaning search cannot run it " + "searches by keywords only and says why. When it could not search at all it says why and " + "names the dispatch search to run instead. exclude_issues leaves each named issue's own " + "items out of the results, at most 50 of them, so a draft under a parent can leave out " + "that parent and its children without changing how rare the text's words are; " + "keywords_only skips meaning search.",
30631
30632
  arguments: (z) => ({
30632
30633
  project: z.string().describe("Project key to search within, such as CORE."),
30633
30634
  title: z.string({ max: ISSUE_TITLE_MAX }).describe("Optional title to check, as an issue title; at most 1,000 characters.").optional(),
30634
30635
  text: z.string().describe("Optional text to check, such as a draft spec or a question.").optional(),
30635
- exclude_issue: z.string().describe("Optional issue key in the project whose own items are left out.").optional(),
30636
+ exclude_issues: z.array(z.string()).describe("Optional issue keys in the project whose own items are left out of the results; at most 50.").optional(),
30636
30637
  keywords_only: z.boolean().describe("Search by keywords only, skipping meaning search.").optional()
30637
30638
  }),
30638
30639
  validation: {
@@ -42123,7 +42124,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
42123
42124
 
42124
42125
  // package.json
42125
42126
  var name = "@sjawhar/pi-envoy";
42126
- var version2 = "16.24.0";
42127
+ var version2 = "16.25.0";
42127
42128
  var package_default = {
42128
42129
  name,
42129
42130
  version: version2,
@@ -9,7 +9,7 @@ Dispatch is a record for the people who decide, never a log of your work.
9
9
 
10
10
  - Use the `dispatch` command; the HTTP API only for what no command does. `dispatch <command> --help` gives its rules and an example.
11
11
  - Put long text on stdin: `--<field>-file -` with a quoted here-document (`<<'EOF'`); give object and list fields as JSON.
12
- - Exit 1 is a refusal, 2 a usage error. A refusal lists each problem: fix them all, then call once.
12
+ - Exit 1 is a refusal, 2 a usage error. A refusal lists every problem: fix all, call once.
13
13
  - A Dispatch command hard to use, or storing or losing something wrongly, is a defect to report, not work around: open an issue in the owning project's code and tell that project's controller; a Legion role tells its architect (`skill://legion-worker/references/findings.md`).
14
14
 
15
15
  ## Asks and ask blocks
@@ -35,7 +35,7 @@ The question and the recommendation, as `skill://dispatch-writing-specs` writes
35
35
 
36
36
  ## Choosing what to work on
37
37
 
38
- - When you finish an issue, take the top ready one: `todo`, by priority then board rank, per project.
38
+ - Finishing an issue, take the top `todo` one by priority then board rank, per project.
39
39
  - `todo` means specced and waiting on nothing; one that waits goes in `backlog`, saying on what.
40
40
  - Hold at most three issues in flight; move the rest to `backlog`, saying where each is.
41
41
  - 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`.
@@ -5,19 +5,17 @@ description: "Use when a session has the dispatch command, before you plan, file
5
5
 
6
6
  # Dispatch first
7
7
 
8
- Dispatch holds the open issues, their specs and people's answers.
9
-
10
8
  ## Search before you act
11
9
 
12
10
  - Before you plan, file an issue, ask, post a finding or start work, run `dispatch search`.
13
- - Each query word must match. Use two or three words: the thing and what is wrong with it. Never paste a draft.
11
+ - Each query word must match. Use two or three: the thing and what is wrong. Never paste a draft.
14
12
 
15
13
  ```bash
16
14
  dispatch search --query 'broadcast send order'
17
15
  dispatch search --query 'reviewer threads OR review comments'
18
16
  ```
19
17
 
20
- - No hits: remove a word before you add one. Try two or three wordings before you decide nothing exists.
18
+ - No hits: remove a word before adding one. Try two or three wordings before deciding nothing exists.
21
19
  - Open each hit that can be yours with `dispatch read --issue KEY`, then its parent (`child_of` under `Links:`, or a document's `Issue:`), with its status and recent events.
22
20
 
23
21
  ## What to do with what you find
@@ -26,7 +24,7 @@ dispatch search --query 'reviewer threads OR review comments'
26
24
 
27
25
  - **Work already tracked:** put the finding on that issue. File a new issue only when no hit covers the work, and cite the nearest one you ruled out (`dispatch://KEY`).
28
26
  - **Question already decided:** the answered ask is the record. Cite it (`dispatch://KEY/ask/<id>`). Do not ask again.
29
- - **Duplicate found:** keep the issue with the spec, copy to it what only the duplicate has, and close the duplicate (`--status done --reason 'Duplicate of dispatch://KEY.'`). When it has the `legion` label or another holder's claim, comment the kept issue's name on it instead.
27
+ - **Duplicate found, or a likely duplicate a create names:** read it; fold only when it is the same work. Keep the issue with the spec, copy to it what only the duplicate has, and close the duplicate (`--status done --reason 'Duplicate of dispatch://KEY.'`). When it has the `legion` label or another holder's claim, comment the kept issue's name on it instead.
30
28
 
31
29
  ## Research before you ask
32
30
 
@@ -36,8 +34,6 @@ dispatch search --query 'reviewer threads OR review comments'
36
34
 
37
35
  ## Reach a person only through Dispatch
38
36
 
39
- Reach a person through an ask, an ask block or an approval request.
40
-
41
37
  - The moment a person blocks your work, open an ask: an ask block for a design question its document records, else `dispatch ask`. A blocker that is not an open ask does not exist for them. A Legion phase worker sends decisions to its architect instead. Before you say you wait on a person, run `dispatch open-asks`.
42
38
  - A result a person asked for is the same: a document or artifact notifies nobody. End that document with an ask block asking their next step, else `dispatch ask`.
43
39
  - Record every request you accept in Dispatch before you start it: an issue, or a line in your issue's `open-items.md` artifact. Before you end a turn, read that record. Each item is done, in progress, or an open ask. Never drop one.
@@ -28,7 +28,7 @@ Part | Content
28
28
  `Design` | How it meets them; a value and its reason for each limit, size and time
29
29
  `Decisions` | One line: `The decisions are in dispatch://KEY/artifact/decisions-md.`
30
30
 
31
- `serves` and `needs` name a block of this issue or an ancestor. Another agent can build and check the work from these alone. A small change gets a few sentences per part, no matrix; split a large design into child issues.
31
+ `serves` and `needs` name a block of this issue or an ancestor. Another agent can build and check the work from these alone. A small change gets a few sentences per part, no matrix; split a large design into children.
32
32
 
33
33
  ## Rules for the text
34
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-envoy",
3
- "version": "16.24.0",
3
+ "version": "16.25.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {