@sjawhar/opencode-legion-envoy 5.6.4 → 5.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.
@@ -15449,6 +15449,32 @@ function renderAdvice(tool, key, advice, opts) {
15449
15449
  }
15450
15450
  return lines;
15451
15451
  }
15452
+ function renderSuggestions(suggestions, configUrl) {
15453
+ if (suggestions === undefined)
15454
+ return [];
15455
+ if (suggestions.missing !== undefined) {
15456
+ return [`Related-item search was skipped: ${suggestions.missing}.`];
15457
+ }
15458
+ const lines = [];
15459
+ if (suggestions.related.length > 0) {
15460
+ lines.push("Possibly related, found by search:");
15461
+ for (const item of suggestions.related) {
15462
+ lines.push(`- ${suggestionLabel(item)} \u2192 ${new URL(item.href, configUrl).toString()}`);
15463
+ }
15464
+ }
15465
+ if (suggestions.decision !== undefined) {
15466
+ const item = suggestions.decision;
15467
+ const when = item.answered_at === undefined ? "" : ` on ${item.answered_at}`;
15468
+ lines.push(`A past decision may already answer this: ${suggestionLabel(item)}, answered by ${item.answered_by}${when} \u2192 ${new URL(item.href, configUrl).toString()}`);
15469
+ }
15470
+ return lines;
15471
+ }
15472
+ function suggestionLabel(item) {
15473
+ if (item.owner.kind === "issue") {
15474
+ return `${item.owner.key} [${item.owner.status}] ${item.owner.title}`;
15475
+ }
15476
+ return `${item.owner.name} (${item.owner.project}/${item.owner.slug})`;
15477
+ }
15452
15478
  function documentResultDetails(artifact) {
15453
15479
  return {
15454
15480
  project: artifact.project,
@@ -16626,7 +16652,8 @@ async function executeDispatchTool(input) {
16626
16652
  ...renderAdvice(input.tool, created.key, created.advice, {
16627
16653
  isPrimarySpec: spec !== undefined
16628
16654
  }),
16629
- ...componentGuidance === undefined ? [] : [componentGuidance]
16655
+ ...componentGuidance === undefined ? [] : [componentGuidance],
16656
+ ...renderSuggestions(created.advice?.suggestions, configUrl)
16630
16657
  ];
16631
16658
  return {
16632
16659
  text: [
@@ -16906,7 +16933,10 @@ async function executeDispatchTool(input) {
16906
16933
  };
16907
16934
  const ask = resolved?.owner.kind === "project" ? await client.artifactAsk(resolved.artifact.id, askInput) : await client.ask(issue2(), askInput);
16908
16935
  const askOwner = ask.issue_key !== null ? issueTopic(ask.issue_key) : resolved === undefined ? issueTopic(issue2()) : documentTopic(resolved.artifact);
16909
- const adviceLines = renderAdvice(input.tool, askOwner.label, ask.advice, {});
16936
+ const adviceLines = [
16937
+ ...renderAdvice(input.tool, askOwner.label, ask.advice, {}),
16938
+ ...renderSuggestions(ask.advice?.suggestions, configUrl)
16939
+ ];
16910
16940
  return {
16911
16941
  text: [
16912
16942
  `Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency}): ${ask.question}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "5.6.4",
3
+ "version": "5.7.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/src/server.js",
@@ -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