@sjawhar/opencode-legion-envoy 0.23.2 → 0.24.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.
@@ -13594,7 +13594,7 @@ function dispatchToolSchema(spec, z, opts) {
13594
13594
  const shape = spec.arguments(z);
13595
13595
  return spec.validation === undefined ? z.object(shape, opts) : z.refineObject(shape, spec.validation.check, spec.validation.message, opts);
13596
13596
  }
13597
- var ISSUE_REFERENCE = "An issue is a native KEY or external owner/repo#n reference; an external reference creates its native issue on first use in the repository's mapped project (DISPATCH_REPO_PROJECTS) or, failing that, the default project (DISPATCH_DEFAULT_PROJECT).";
13597
+ var ISSUE_REFERENCE = "An issue is a native KEY or external owner/repo#n reference; an external reference creates its native issue in the repository's dashboard-configured project or, failing that, the default project (DISPATCH_DEFAULT_PROJECT).";
13598
13598
  var ASK_URGENCIES = ["low", "med", "high", "blocking"];
13599
13599
  var DOC_EDIT_OPS = ["replace", "delete", "insert"];
13600
13600
  var dispatchToolSpecs = [
@@ -14065,6 +14065,10 @@ var LegionDaemonApi = {
14065
14065
  response: object({ token: nonEmptyString, appLogin: string2().endsWith("[bot]") })
14066
14066
  }
14067
14067
  };
14068
+ // ../contracts/src/repo.ts
14069
+ function canonicalRepo(owner, repo) {
14070
+ return `${owner.trim().toLowerCase()}/${repo.trim().toLowerCase().replace(/\.git$/, "")}`;
14071
+ }
14068
14072
  // ../contracts/src/tool-schema.ts
14069
14073
  function zodSchemaApi(zod) {
14070
14074
  const api = zod;
@@ -14280,7 +14284,7 @@ function parseGitHubRemoteUrl(url) {
14280
14284
  for (const pattern of GITHUB_REMOTE_PATTERNS) {
14281
14285
  const match = trimmed.match(pattern);
14282
14286
  if (match)
14283
- return `${match[1]}/${match[2]}`;
14287
+ return canonicalRepo(match[1] ?? "", match[2] ?? "");
14284
14288
  }
14285
14289
  return null;
14286
14290
  }
@@ -14514,6 +14518,10 @@ class DispatchClient {
14514
14518
  var nativeIssueKeyPattern = /^[A-Z][A-Z0-9]{1,9}-[0-9]+$/;
14515
14519
  var externalIssueRefPattern = /^([^/\s]+)\/([^/\s#]+)#([1-9][0-9]*)$/;
14516
14520
  var bareIssueNumberPattern = /^[1-9][0-9]*$/;
14521
+ function canonicalExternalIssueRef(value) {
14522
+ const match = value.trim().match(externalIssueRefPattern);
14523
+ return match ? `${canonicalRepo(match[1] ?? "", match[2] ?? "")}#${match[3]}` : value;
14524
+ }
14517
14525
  function stringArg(args, name) {
14518
14526
  const value = args[name];
14519
14527
  if (typeof value !== "string")
@@ -14583,7 +14591,7 @@ async function resolveIssueArguments(tool, args, cwd, env, exec) {
14583
14591
  return {
14584
14592
  args: {
14585
14593
  ...args,
14586
- ...issueArgument === undefined && ref?.issue !== undefined ? { issue: ref.issue } : {},
14594
+ ...typeof issueArgument === "string" ? { issue: canonicalExternalIssueRef(issueArgument) } : issueArgument === undefined && ref?.issue !== undefined ? { issue: ref.issue } : {},
14587
14595
  ...artifactArgument === undefined && (ref?.kind === "spec" || ref?.kind === "artifact") ? { artifact: ref.id } : {},
14588
14596
  ...versionArgument === undefined && ref?.version !== undefined ? { version: ref.version } : {}
14589
14597
  },
@@ -14594,7 +14602,7 @@ async function resolveIssueArguments(tool, args, cwd, env, exec) {
14594
14602
  if (!legionIssue)
14595
14603
  throw new Error("issue is required; supply issue or set LEGION_ISSUE");
14596
14604
  if (nativeIssueKeyPattern.test(legionIssue) || externalIssueRefPattern.test(legionIssue)) {
14597
- return { args: { ...args, issue: legionIssue }, ref: null };
14605
+ return { args: { ...args, issue: canonicalExternalIssueRef(legionIssue) }, ref: null };
14598
14606
  }
14599
14607
  if (!bareIssueNumberPattern.test(legionIssue)) {
14600
14608
  throw new Error("LEGION_ISSUE must be a native issue key (e.g. LEGION-3), an external owner/repo#n reference, or a bare positive issue number");
@@ -14927,7 +14935,7 @@ async function ensureIssue(client, issueReference, actor) {
14927
14935
  } catch (error) {
14928
14936
  if (error instanceof DispatchServiceError && error.code === "PROJECT_UNMAPPED") {
14929
14937
  const repository = issueReference.slice(0, issueReference.lastIndexOf("#"));
14930
- throw new Error(`repository ${repository} is not mapped in DISPATCH_REPO_PROJECTS and no DISPATCH_DEFAULT_PROJECT is configured`);
14938
+ throw new Error(`repository ${repository} is not mapped in repository settings and no DISPATCH_DEFAULT_PROJECT is configured`);
14931
14939
  }
14932
14940
  throw error;
14933
14941
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "0.23.2",
3
+ "version": "0.24.0",
4
4
  "type": "module",
5
5
  "main": "dist/src/server.js",
6
6
  "exports": {
@@ -18,7 +18,7 @@ Every session works on an issue. Legion pre-fills `issue` from `LEGION_ISSUE`: u
18
18
  such as `LEGION-3`, an external `owner/repo#n` reference, or a bare positive number (resolved
19
19
  against the cwd repository). Otherwise pass the issue to every issue-scoped tool as its native key
20
20
  or an external `owner/repo#n` reference. On first use, an external reference creates its native issue in the
21
- project mapped by `DISPATCH_REPO_PROJECTS`.
21
+ project configured for that repository in Dispatch Settings, then falls back to `DISPATCH_DEFAULT_PROJECT`.
22
22
 
23
23
  Architects create newly tracked child work with:
24
24
  ```ts