@sjawhar/opencode-legion-envoy 11.3.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$/, "")}`;
@@ -17104,39 +17143,18 @@ function decisionBlockLines(advice, context) {
17104
17143
  }
17105
17144
  }
17106
17145
  function relatedCheckForm(suggestions, context) {
17107
- const { outcome, missing } = suggestions;
17108
- if (outcome === "not_made" || outcome === undefined && missing !== undefined) {
17109
- 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)];
17110
17149
  }
17111
- const related = suggestions.related ?? [];
17112
- const mode = searchModeWords(suggestions);
17113
- if (related.length > 0) {
17114
- const header = mode === undefined ? "Related items:" : `Related items (searched by ${mode}):`;
17115
- return [header, ...related.flatMap((item) => relatedItemLines(item, context.configUrl))];
17116
- }
17117
- if (outcome === undefined) {
17118
- return [
17119
- notMadeLine("the server did not say whether it searched", context, suggestions.search_query)
17120
- ];
17121
- }
17122
- if (outcome === "found" || outcome === "none") {
17123
- return [
17124
- mode === undefined ? "Related-item check searched and found nothing." : `Related-item check searched (${mode}) and found nothing.`
17125
- ];
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))];
17126
17153
  }
17127
17154
  return [
17128
- 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.`
17129
17156
  ];
17130
17157
  }
17131
- function searchModeWords(suggestions) {
17132
- const { search, search_note: note } = suggestions;
17133
- if (search === undefined)
17134
- return;
17135
- if (search === "meaning_and_keywords")
17136
- return "meaning and keywords";
17137
- const words = search === "keywords_only" ? "keywords only" : String(search);
17138
- return note === undefined || note === "" ? words : `${words}: ${note}`;
17139
- }
17140
17158
  function relatedItemLines(item, configUrl) {
17141
17159
  try {
17142
17160
  const lines = [`- ${suggestionLabel(item)} \u2192 ${absoluteHref(item.href, configUrl)}`];
@@ -17173,13 +17191,10 @@ function absoluteHref(href, configUrl) {
17173
17191
  }
17174
17192
  }
17175
17193
  function notMadeLine(reason, context, searchQuery) {
17176
- const words = searchQuery?.trim() || searchWords(context.text);
17194
+ const words = searchQuery?.trim() || relatedCheckSearchWords(context.text);
17177
17195
  const query = words === "" ? " with two or three of its words as --query" : ` --query '${words.replaceAll("'", "'\\''")}'`;
17178
17196
  return `No related-item check was made: ${reason}. Search before you rely on this being new: dispatch search --project ${context.project}${query}`;
17179
17197
  }
17180
- function searchWords(text) {
17181
- return (text.match(/[\p{L}\p{N}_]+/gu) ?? []).filter((word) => (word.match(/\p{L}/gu) ?? []).length >= 4).slice(0, 3).join(" ");
17182
- }
17183
17198
 
17184
17199
  // ../envoy-client/src/dispatch-execute.ts
17185
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.3.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.3.0",
3
+ "version": "11.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/src/server.js",