@sjawhar/pi-legion-envoy 7.6.4 → 7.7.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/envoy.js CHANGED
@@ -32756,6 +32756,32 @@ function renderAdvice(tool, key, advice, opts) {
32756
32756
  }
32757
32757
  return lines;
32758
32758
  }
32759
+ function renderSuggestions(suggestions, configUrl) {
32760
+ if (suggestions === undefined)
32761
+ return [];
32762
+ if (suggestions.missing !== undefined) {
32763
+ return [`Related-item search was skipped: ${suggestions.missing}.`];
32764
+ }
32765
+ const lines = [];
32766
+ if (suggestions.related.length > 0) {
32767
+ lines.push("Possibly related, found by search:");
32768
+ for (const item of suggestions.related) {
32769
+ lines.push(`- ${suggestionLabel(item)} \u2192 ${new URL(item.href, configUrl).toString()}`);
32770
+ }
32771
+ }
32772
+ if (suggestions.decision !== undefined) {
32773
+ const item = suggestions.decision;
32774
+ const when = item.answered_at === undefined ? "" : ` on ${item.answered_at}`;
32775
+ lines.push(`A past decision may already answer this: ${suggestionLabel(item)}, answered by ${item.answered_by}${when} \u2192 ${new URL(item.href, configUrl).toString()}`);
32776
+ }
32777
+ return lines;
32778
+ }
32779
+ function suggestionLabel(item) {
32780
+ if (item.owner.kind === "issue") {
32781
+ return `${item.owner.key} [${item.owner.status}] ${item.owner.title}`;
32782
+ }
32783
+ return `${item.owner.name} (${item.owner.project}/${item.owner.slug})`;
32784
+ }
32759
32785
  function documentResultDetails(artifact) {
32760
32786
  return {
32761
32787
  project: artifact.project,
@@ -33936,7 +33962,8 @@ async function executeDispatchTool(input) {
33936
33962
  ...renderAdvice(input.tool, created.key, created.advice, {
33937
33963
  isPrimarySpec: spec !== undefined
33938
33964
  }),
33939
- ...componentGuidance === undefined ? [] : [componentGuidance]
33965
+ ...componentGuidance === undefined ? [] : [componentGuidance],
33966
+ ...renderSuggestions(created.advice?.suggestions, configUrl)
33940
33967
  ];
33941
33968
  return {
33942
33969
  text: [
@@ -34216,7 +34243,10 @@ async function executeDispatchTool(input) {
34216
34243
  };
34217
34244
  const ask = resolved?.owner.kind === "project" ? await client.artifactAsk(resolved.artifact.id, askInput) : await client.ask(issue2(), askInput);
34218
34245
  const askOwner = ask.issue_key !== null ? issueTopic(ask.issue_key) : resolved === undefined ? issueTopic(issue2()) : documentTopic(resolved.artifact);
34219
- const adviceLines = renderAdvice(input.tool, askOwner.label, ask.advice, {});
34246
+ const adviceLines = [
34247
+ ...renderAdvice(input.tool, askOwner.label, ask.advice, {}),
34248
+ ...renderSuggestions(ask.advice?.suggestions, configUrl)
34249
+ ];
34220
34250
  return {
34221
34251
  text: [
34222
34252
  `Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency}): ${ask.question}
package/dist/legion.js CHANGED
@@ -15541,6 +15541,32 @@ function renderAdvice(tool, key, advice, opts) {
15541
15541
  }
15542
15542
  return lines;
15543
15543
  }
15544
+ function renderSuggestions(suggestions, configUrl) {
15545
+ if (suggestions === undefined)
15546
+ return [];
15547
+ if (suggestions.missing !== undefined) {
15548
+ return [`Related-item search was skipped: ${suggestions.missing}.`];
15549
+ }
15550
+ const lines = [];
15551
+ if (suggestions.related.length > 0) {
15552
+ lines.push("Possibly related, found by search:");
15553
+ for (const item of suggestions.related) {
15554
+ lines.push(`- ${suggestionLabel(item)} \u2192 ${new URL(item.href, configUrl).toString()}`);
15555
+ }
15556
+ }
15557
+ if (suggestions.decision !== undefined) {
15558
+ const item = suggestions.decision;
15559
+ const when = item.answered_at === undefined ? "" : ` on ${item.answered_at}`;
15560
+ lines.push(`A past decision may already answer this: ${suggestionLabel(item)}, answered by ${item.answered_by}${when} \u2192 ${new URL(item.href, configUrl).toString()}`);
15561
+ }
15562
+ return lines;
15563
+ }
15564
+ function suggestionLabel(item) {
15565
+ if (item.owner.kind === "issue") {
15566
+ return `${item.owner.key} [${item.owner.status}] ${item.owner.title}`;
15567
+ }
15568
+ return `${item.owner.name} (${item.owner.project}/${item.owner.slug})`;
15569
+ }
15544
15570
  function documentResultDetails(artifact) {
15545
15571
  return {
15546
15572
  project: artifact.project,
@@ -16721,7 +16747,8 @@ async function executeDispatchTool(input) {
16721
16747
  ...renderAdvice(input.tool, created.key, created.advice, {
16722
16748
  isPrimarySpec: spec !== undefined
16723
16749
  }),
16724
- ...componentGuidance === undefined ? [] : [componentGuidance]
16750
+ ...componentGuidance === undefined ? [] : [componentGuidance],
16751
+ ...renderSuggestions(created.advice?.suggestions, configUrl)
16725
16752
  ];
16726
16753
  return {
16727
16754
  text: [
@@ -17001,7 +17028,10 @@ async function executeDispatchTool(input) {
17001
17028
  };
17002
17029
  const ask = resolved?.owner.kind === "project" ? await client.artifactAsk(resolved.artifact.id, askInput) : await client.ask(issue2(), askInput);
17003
17030
  const askOwner = ask.issue_key !== null ? issueTopic(ask.issue_key) : resolved === undefined ? issueTopic(issue2()) : documentTopic(resolved.artifact);
17004
- const adviceLines = renderAdvice(input.tool, askOwner.label, ask.advice, {});
17031
+ const adviceLines = [
17032
+ ...renderAdvice(input.tool, askOwner.label, ask.advice, {}),
17033
+ ...renderSuggestions(ask.advice?.suggestions, configUrl)
17034
+ ];
17005
17035
  return {
17006
17036
  text: [
17007
17037
  `Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency}): ${ask.question}
@@ -17524,7 +17554,7 @@ function endInjectedUserTurns(sessionID) {
17524
17554
  // package.json
17525
17555
  var package_default = {
17526
17556
  name: "@sjawhar/pi-legion-envoy",
17527
- version: "7.6.4",
17557
+ version: "7.7.0",
17528
17558
  license: "Apache-2.0",
17529
17559
  type: "module",
17530
17560
  omp: {
@@ -27,6 +27,10 @@ parent's children and the issue's `Components:` line show where the rest of that
27
27
 
28
28
  ## What to do with what you find
29
29
 
30
+ Filing an issue or opening an ask also searches for you: the result's `advice.suggestions` names
31
+ likely duplicates or a decision that may already settle it. Treat a hit there the same as one you
32
+ found yourself.
33
+
30
34
  - **The work is already tracked: extend that issue.** Put the finding on it (a comment, a message,
31
35
  or an edit to its spec) instead of filing another. File a new issue only when no hit covers the
32
36
  work, and cite the nearest one you ruled out (`dispatch://KEY`).
@@ -341,7 +341,7 @@ active phase worker.
341
341
  | A reply on an ask you follow | Interpret the reply in the issue's design context. Answer in its thread (`dispatch_comment` with `reply_to`; under an open ask whose next move is yours, such as the approval request you must revise or hand back, `reply_to_ask` with `turn: "agent"`, since a default-turn reply hands that request back to the human and a corrected `summary` is then refused), then adjust the plan or relay it via `envoy_publish` to the responsible worker's role token; scope and product decisions remain with you. |
342
342
  | `worker-died` | Its `role` and `phase`. That role's claim failed: its launches or prompts ran out. For a phase worker the daemon holds the issue (phase `held`) and starts nothing more on it. Reassess the work, then decide with `retry_or_escalate`: `retry` when the failure looks agent-specific or transient, `escalate` to hand the held issue to the controller when it looks environmental. |
343
343
  | `held` | Its `role` and `phase` (the phase the issue left), or `phase` with `reason: "escalated"`. Without `reason`, that phase's worker ran out of launches or prompts: the issue is held (phase `held`), the `worker-died` that comes with it is yours to answer with `retry_or_escalate` as that row says, and the controller hears of the hold too. With `reason: "escalated"`, it records your own `escalate`: the controller has the issue now, and you start nothing for it. |
344
- | `ready-refused` | Its `version` and `reason`. The merger's READY was refused. A `reason` of `READY refused: approve design version <N> before requesting READY.` (or, with `version` 0, `no design version is approved`) means the design gate is closed: get that version approved (section 1), and the daemon advances the merge and posts the packet the merger sent once it is; nothing else is needed. A `reason` starting `READY_PACKET_MISSING` names a READY refused before the daemon kept packets: that READY is void and the issue stays in merging, so start it over (`park_child` then `rerun_child`, for a child) or end it. |
344
+ | `ready-refused` | Its `version` and `reason`. The merger's READY was refused, and its packet is kept with the completion so no second READY is ever needed. With `version` greater than 0, `reason` reads `READY refused: approve design version <N> before requesting READY.`: the root's spec is already registered at that version, so get it approved (section 1), and the daemon advances the merge and posts the kept packet the moment it is. With `version` 0, `reason` reads `READY refused: no design version is approved; register and approve the tree's spec before requesting READY.`: the root has no spec registered yet, so register it and get it approved (section 1) exactly as above; the daemon releases the kept packet the same way — at registration itself when that opens the gate (`gates.design: off`, or Dispatch already shows the version approved), otherwise the moment a human approves the version you registered. Either way, nothing else is needed once the gate opens. A `reason` starting `READY_PACKET_MISSING` names a READY refused before the daemon kept packets: that READY is void and the issue stays in merging, so start it over (`park_child` then `rerun_child`, for a child) or end it. |
345
345
 
346
346
  ## Escalation judgment
347
347
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion-envoy",
3
- "version": "7.6.4",
3
+ "version": "7.7.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {