@sjawhar/opencode-legion-envoy 11.2.0 → 11.4.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
@@ -14895,6 +14895,45 @@ function dispatchIssueSubject(issueKey, type) {
14895
14895
  function dispatchDocumentSubject(project, slug, type) {
14896
14896
  return `${DISPATCH_DOCUMENT_TOPIC_PREFIX}${project}.${slug}.${type}`;
14897
14897
  }
14898
+ // ../contracts/src/related-forms.ts
14899
+ function relatedCheckFormOf(suggestions) {
14900
+ const { outcome, missing } = suggestions;
14901
+ const searchQuery = suggestions.search_query;
14902
+ if (outcome === "not_made" || outcome === undefined && missing !== undefined) {
14903
+ return { form: "not_made", reason: missing ?? "the server gave no reason", searchQuery };
14904
+ }
14905
+ const mode = relatedCheckModeWords(suggestions);
14906
+ if (suggestions.related.length > 0) {
14907
+ return { form: "items", mode, related: suggestions.related };
14908
+ }
14909
+ if (outcome === undefined) {
14910
+ return {
14911
+ form: "not_made",
14912
+ reason: "the server did not say whether it searched",
14913
+ searchQuery
14914
+ };
14915
+ }
14916
+ if (outcome === "found" || outcome === "none") {
14917
+ return { form: "nothing", mode };
14918
+ }
14919
+ return {
14920
+ form: "not_made",
14921
+ reason: `the server answered an outcome this client does not know (${String(outcome)})`,
14922
+ searchQuery
14923
+ };
14924
+ }
14925
+ function relatedCheckModeWords(suggestions) {
14926
+ const { search, search_note: note } = suggestions;
14927
+ if (search === undefined)
14928
+ return;
14929
+ if (search === "meaning_and_keywords")
14930
+ return "meaning and keywords";
14931
+ const words = search === "keywords_only" ? "keywords only" : String(search);
14932
+ return note === undefined || note === "" ? words : `${words}: ${note}`;
14933
+ }
14934
+ function relatedCheckSearchWords(text) {
14935
+ return (text.match(/[\p{L}\p{N}_]+/gu) ?? []).filter((word) => (word.match(/\p{L}/gu) ?? []).length >= 4).slice(0, 3).join(" ");
14936
+ }
14898
14937
  // ../contracts/src/repo.ts
14899
14938
  function canonicalRepo(owner, repo) {
14900
14939
  return `${owner.trim().toLowerCase()}/${repo.trim().toLowerCase().replace(/\.git$/, "")}`;
@@ -16109,13 +16148,7 @@ class DispatchClient {
16109
16148
  return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "comments"]);
16110
16149
  }
16111
16150
  async getIssueReferences(issue) {
16112
- return this.#json("GET", [
16113
- "api",
16114
- "v1",
16115
- "issues",
16116
- await this.#resolveIssue(issue),
16117
- "references"
16118
- ]);
16151
+ return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "references"], undefined, { versions: "latest" });
16119
16152
  }
16120
16153
  async getReferences(query) {
16121
16154
  return this.#json("GET", ["api", "v1", "references"], undefined, {
@@ -17110,39 +17143,18 @@ function decisionBlockLines(advice, context) {
17110
17143
  }
17111
17144
  }
17112
17145
  function relatedCheckForm(suggestions, context) {
17113
- const { outcome, missing } = suggestions;
17114
- if (outcome === "not_made" || outcome === undefined && missing !== undefined) {
17115
- return [notMadeLine(missing ?? "the server gave no reason", context, suggestions.search_query)];
17146
+ const form = relatedCheckFormOf(suggestions);
17147
+ if (form.form === "not_made") {
17148
+ return [notMadeLine(form.reason, context, form.searchQuery)];
17116
17149
  }
17117
- const related = suggestions.related ?? [];
17118
- const mode = searchModeWords(suggestions);
17119
- if (related.length > 0) {
17120
- const header = mode === undefined ? "Related items:" : `Related items (searched by ${mode}):`;
17121
- return [header, ...related.flatMap((item) => relatedItemLines(item, context.configUrl))];
17122
- }
17123
- if (outcome === undefined) {
17124
- return [
17125
- notMadeLine("the server did not say whether it searched", context, suggestions.search_query)
17126
- ];
17127
- }
17128
- if (outcome === "found" || outcome === "none") {
17129
- return [
17130
- mode === undefined ? "Related-item check searched and found nothing." : `Related-item check searched (${mode}) and found nothing.`
17131
- ];
17150
+ if (form.form === "items") {
17151
+ const header = form.mode === undefined ? "Related items:" : `Related items (searched by ${form.mode}):`;
17152
+ return [header, ...form.related.flatMap((item) => relatedItemLines(item, context.configUrl))];
17132
17153
  }
17133
17154
  return [
17134
- notMadeLine(`the server answered an outcome this client does not know (${String(outcome)})`, context, suggestions.search_query)
17155
+ form.mode === undefined ? "Related-item check searched and found nothing." : `Related-item check searched (${form.mode}) and found nothing.`
17135
17156
  ];
17136
17157
  }
17137
- function searchModeWords(suggestions) {
17138
- const { search, search_note: note } = suggestions;
17139
- if (search === undefined)
17140
- return;
17141
- if (search === "meaning_and_keywords")
17142
- return "meaning and keywords";
17143
- const words = search === "keywords_only" ? "keywords only" : String(search);
17144
- return note === undefined || note === "" ? words : `${words}: ${note}`;
17145
- }
17146
17158
  function relatedItemLines(item, configUrl) {
17147
17159
  try {
17148
17160
  const lines = [`- ${suggestionLabel(item)} \u2192 ${absoluteHref(item.href, configUrl)}`];
@@ -17179,13 +17191,10 @@ function absoluteHref(href, configUrl) {
17179
17191
  }
17180
17192
  }
17181
17193
  function notMadeLine(reason, context, searchQuery) {
17182
- const words = searchQuery?.trim() || searchWords(context.text);
17194
+ const words = searchQuery?.trim() || relatedCheckSearchWords(context.text);
17183
17195
  const query = words === "" ? " with two or three of its words as --query" : ` --query '${words.replaceAll("'", "'\\''")}'`;
17184
17196
  return `No related-item check was made: ${reason}. Search before you rely on this being new: dispatch search --project ${context.project}${query}`;
17185
17197
  }
17186
- function searchWords(text) {
17187
- return (text.match(/[\p{L}\p{N}_]+/gu) ?? []).filter((word) => (word.match(/\p{L}/gu) ?? []).length >= 4).slice(0, 3).join(" ");
17188
- }
17189
17198
 
17190
17199
  // ../envoy-client/src/dispatch-execute.ts
17191
17200
  function documentTopic(artifact) {
@@ -15610,7 +15610,7 @@ function sourceSession(sessionID) {
15610
15610
  // src/server.ts
15611
15611
  import { tool } from "@opencode-ai/plugin/tool";
15612
15612
  // package.json
15613
- var version2 = "11.2.0";
15613
+ var version2 = "11.4.0";
15614
15614
 
15615
15615
  // src/log.ts
15616
15616
  import { appendFile, mkdir } from "fs/promises";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "11.2.0",
3
+ "version": "11.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/src/server.js",