@sjawhar/opencode-legion-envoy 1.49.1 → 1.50.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.
Files changed (2) hide show
  1. package/dist/src/server.js +34 -7
  2. package/package.json +1 -1
@@ -13752,6 +13752,29 @@ var AskFollowerEventPayloadSchema = object({
13752
13752
  session_id: string2().optional(),
13753
13753
  by: object({ kind: string2(), id: string2().optional() }).passthrough().optional()
13754
13754
  });
13755
+ // ../contracts/src/dispatch-href.ts
13756
+ function itemFromSearch(search) {
13757
+ const params = new URLSearchParams(search);
13758
+ const ask = params.get("ask");
13759
+ const comment = params.get("comment");
13760
+ if (ask === null && comment === null) {
13761
+ return;
13762
+ }
13763
+ if (ask !== null && comment !== null) {
13764
+ return null;
13765
+ }
13766
+ const raw = ask ?? comment ?? "";
13767
+ if (raw === "" || raw.includes("/")) {
13768
+ return null;
13769
+ }
13770
+ let id;
13771
+ try {
13772
+ id = decodeURIComponent(raw);
13773
+ } catch {
13774
+ return null;
13775
+ }
13776
+ return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
13777
+ }
13755
13778
  // ../contracts/src/dispatch-snippet.ts
13756
13779
  var HTML_ENTITIES = [
13757
13780
  ["&lt;", "<"],
@@ -15829,6 +15852,13 @@ function dispatchRefFromUrl(value, serverUrl) {
15829
15852
  if (issuePage) {
15830
15853
  const [, key, page, artifact, ask, comment, message] = issuePage;
15831
15854
  const version = versionOf("v");
15855
+ if (page === "spec" || artifact !== undefined) {
15856
+ const item = itemFromSearch(url.search);
15857
+ if (item === null)
15858
+ return;
15859
+ if (item !== undefined)
15860
+ return `dispatch://${key}/${item.kind}/${item.id}`;
15861
+ }
15832
15862
  if (page === "spec" && version !== "")
15833
15863
  return `dispatch://${key}/artifact/spec${version}`;
15834
15864
  if (page !== undefined)
@@ -15849,13 +15879,10 @@ function dispatchRefFromUrl(value, serverUrl) {
15849
15879
  return;
15850
15880
  const [, project, slug] = documentPage;
15851
15881
  const document = `dispatch://${project}/artifact/${decodeURIComponent(slug ?? "")}${versionOf("version")}`;
15852
- const ask = url.searchParams.get("ask");
15853
- if (ask !== null)
15854
- return `${document}/ask/${ask}`;
15855
- const comment = url.searchParams.get("comment");
15856
- if (comment !== null)
15857
- return `${document}/comment/${comment}`;
15858
- return document;
15882
+ const item = itemFromSearch(url.search);
15883
+ if (item === null)
15884
+ return;
15885
+ return item === undefined ? document : `${document}/${item.kind}/${item.id}`;
15859
15886
  }
15860
15887
  var refGrammarProblem = "ref must be a valid dispatch:// reference such as dispatch://KEY-1, " + "dispatch://KEY-1/ask/<uuid>, dispatch://KEY-1/comment/<uuid>, " + "dispatch://KEY-1/message/<uuid>, dispatch://KEY-1/artifact/<slug>, or " + "dispatch://PROJECT/artifact/<document-ref> (an artifact id, slug, or filename); " + "a dashboard URL on this Dispatch server is accepted too";
15861
15888
  var ownerRequiredProblem = "issue is required; supply issue or set LEGION_ISSUE";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "1.49.1",
3
+ "version": "1.50.0",
4
4
  "type": "module",
5
5
  "main": "dist/src/server.js",
6
6
  "exports": {