@sjawhar/pi-legion-envoy 0.21.2 → 0.22.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/envoy.js CHANGED
@@ -29691,7 +29691,7 @@ function dispatchToolSchema(spec, z, opts) {
29691
29691
  const shape = spec.arguments(z);
29692
29692
  return spec.validation === undefined ? z.object(shape, opts) : z.refineObject(shape, spec.validation.check, spec.validation.message, opts);
29693
29693
  }
29694
- 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).";
29694
+ 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).";
29695
29695
  var ASK_URGENCIES = ["low", "med", "high", "blocking"];
29696
29696
  var DOC_EDIT_OPS = ["replace", "delete", "insert"];
29697
29697
  var dispatchToolSpecs = [
@@ -30182,6 +30182,10 @@ var LegionDaemonApi = {
30182
30182
  response: object({ token: nonEmptyString, appLogin: string2().endsWith("[bot]") })
30183
30183
  }
30184
30184
  };
30185
+ // ../contracts/src/repo.ts
30186
+ function canonicalRepo(owner, repo) {
30187
+ return `${owner.trim().toLowerCase()}/${repo.trim().toLowerCase().replace(/\.git$/, "")}`;
30188
+ }
30185
30189
  // ../contracts/src/tool-schema.ts
30186
30190
  function zodSchemaApi(zod) {
30187
30191
  const api = zod;
@@ -31112,7 +31116,7 @@ function parseGitHubRemoteUrl(url) {
31112
31116
  for (const pattern of GITHUB_REMOTE_PATTERNS) {
31113
31117
  const match = trimmed.match(pattern);
31114
31118
  if (match)
31115
- return `${match[1]}/${match[2]}`;
31119
+ return canonicalRepo(match[1] ?? "", match[2] ?? "");
31116
31120
  }
31117
31121
  return null;
31118
31122
  }
@@ -31346,6 +31350,10 @@ class DispatchClient {
31346
31350
  var nativeIssueKeyPattern = /^[A-Z][A-Z0-9]{1,9}-[0-9]+$/;
31347
31351
  var externalIssueRefPattern = /^([^/\s]+)\/([^/\s#]+)#([1-9][0-9]*)$/;
31348
31352
  var bareIssueNumberPattern = /^[1-9][0-9]*$/;
31353
+ function canonicalExternalIssueRef(value) {
31354
+ const match = value.trim().match(externalIssueRefPattern);
31355
+ return match ? `${canonicalRepo(match[1] ?? "", match[2] ?? "")}#${match[3]}` : value;
31356
+ }
31349
31357
  function stringArg(args, name) {
31350
31358
  const value = args[name];
31351
31359
  if (typeof value !== "string")
@@ -31415,7 +31423,7 @@ async function resolveIssueArguments(tool, args, cwd, env, exec) {
31415
31423
  return {
31416
31424
  args: {
31417
31425
  ...args,
31418
- ...issueArgument === undefined && ref?.issue !== undefined ? { issue: ref.issue } : {},
31426
+ ...typeof issueArgument === "string" ? { issue: canonicalExternalIssueRef(issueArgument) } : issueArgument === undefined && ref?.issue !== undefined ? { issue: ref.issue } : {},
31419
31427
  ...artifactArgument === undefined && (ref?.kind === "spec" || ref?.kind === "artifact") ? { artifact: ref.id } : {},
31420
31428
  ...versionArgument === undefined && ref?.version !== undefined ? { version: ref.version } : {}
31421
31429
  },
@@ -31426,7 +31434,7 @@ async function resolveIssueArguments(tool, args, cwd, env, exec) {
31426
31434
  if (!legionIssue)
31427
31435
  throw new Error("issue is required; supply issue or set LEGION_ISSUE");
31428
31436
  if (nativeIssueKeyPattern.test(legionIssue) || externalIssueRefPattern.test(legionIssue)) {
31429
- return { args: { ...args, issue: legionIssue }, ref: null };
31437
+ return { args: { ...args, issue: canonicalExternalIssueRef(legionIssue) }, ref: null };
31430
31438
  }
31431
31439
  if (!bareIssueNumberPattern.test(legionIssue)) {
31432
31440
  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");
@@ -31759,7 +31767,7 @@ async function ensureIssue(client, issueReference, actor) {
31759
31767
  } catch (error) {
31760
31768
  if (error instanceof DispatchServiceError && error.code === "PROJECT_UNMAPPED") {
31761
31769
  const repository = issueReference.slice(0, issueReference.lastIndexOf("#"));
31762
- throw new Error(`repository ${repository} is not mapped in DISPATCH_REPO_PROJECTS and no DISPATCH_DEFAULT_PROJECT is configured`);
31770
+ throw new Error(`repository ${repository} is not mapped in repository settings and no DISPATCH_DEFAULT_PROJECT is configured`);
31763
31771
  }
31764
31772
  throw error;
31765
31773
  }
package/dist/legion.js CHANGED
@@ -29689,7 +29689,7 @@ function dispatchToolSchema(spec, z, opts) {
29689
29689
  const shape = spec.arguments(z);
29690
29690
  return spec.validation === undefined ? z.object(shape, opts) : z.refineObject(shape, spec.validation.check, spec.validation.message, opts);
29691
29691
  }
29692
- 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).";
29692
+ 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).";
29693
29693
  var ASK_URGENCIES = ["low", "med", "high", "blocking"];
29694
29694
  var DOC_EDIT_OPS = ["replace", "delete", "insert"];
29695
29695
  var dispatchToolSpecs = [
@@ -30180,6 +30180,10 @@ var LegionDaemonApi = {
30180
30180
  response: object({ token: nonEmptyString, appLogin: string2().endsWith("[bot]") })
30181
30181
  }
30182
30182
  };
30183
+ // ../contracts/src/repo.ts
30184
+ function canonicalRepo(owner, repo) {
30185
+ return `${owner.trim().toLowerCase()}/${repo.trim().toLowerCase().replace(/\.git$/, "")}`;
30186
+ }
30183
30187
  // ../contracts/src/tool-schema.ts
30184
30188
  function zodSchemaApi(zod) {
30185
30189
  const api = zod;
@@ -31597,7 +31601,7 @@ function parseGitHubRemoteUrl(url) {
31597
31601
  for (const pattern of GITHUB_REMOTE_PATTERNS) {
31598
31602
  const match = trimmed.match(pattern);
31599
31603
  if (match)
31600
- return `${match[1]}/${match[2]}`;
31604
+ return canonicalRepo(match[1] ?? "", match[2] ?? "");
31601
31605
  }
31602
31606
  return null;
31603
31607
  }
@@ -31831,6 +31835,10 @@ class DispatchClient {
31831
31835
  var nativeIssueKeyPattern = /^[A-Z][A-Z0-9]{1,9}-[0-9]+$/;
31832
31836
  var externalIssueRefPattern = /^([^/\s]+)\/([^/\s#]+)#([1-9][0-9]*)$/;
31833
31837
  var bareIssueNumberPattern = /^[1-9][0-9]*$/;
31838
+ function canonicalExternalIssueRef(value) {
31839
+ const match = value.trim().match(externalIssueRefPattern);
31840
+ return match ? `${canonicalRepo(match[1] ?? "", match[2] ?? "")}#${match[3]}` : value;
31841
+ }
31834
31842
  function stringArg(args, name) {
31835
31843
  const value = args[name];
31836
31844
  if (typeof value !== "string")
@@ -31900,7 +31908,7 @@ async function resolveIssueArguments(tool, args, cwd, env, exec) {
31900
31908
  return {
31901
31909
  args: {
31902
31910
  ...args,
31903
- ...issueArgument === undefined && ref?.issue !== undefined ? { issue: ref.issue } : {},
31911
+ ...typeof issueArgument === "string" ? { issue: canonicalExternalIssueRef(issueArgument) } : issueArgument === undefined && ref?.issue !== undefined ? { issue: ref.issue } : {},
31904
31912
  ...artifactArgument === undefined && (ref?.kind === "spec" || ref?.kind === "artifact") ? { artifact: ref.id } : {},
31905
31913
  ...versionArgument === undefined && ref?.version !== undefined ? { version: ref.version } : {}
31906
31914
  },
@@ -31911,7 +31919,7 @@ async function resolveIssueArguments(tool, args, cwd, env, exec) {
31911
31919
  if (!legionIssue)
31912
31920
  throw new Error("issue is required; supply issue or set LEGION_ISSUE");
31913
31921
  if (nativeIssueKeyPattern.test(legionIssue) || externalIssueRefPattern.test(legionIssue)) {
31914
- return { args: { ...args, issue: legionIssue }, ref: null };
31922
+ return { args: { ...args, issue: canonicalExternalIssueRef(legionIssue) }, ref: null };
31915
31923
  }
31916
31924
  if (!bareIssueNumberPattern.test(legionIssue)) {
31917
31925
  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");
@@ -32244,7 +32252,7 @@ async function ensureIssue(client, issueReference, actor) {
32244
32252
  } catch (error) {
32245
32253
  if (error instanceof DispatchServiceError && error.code === "PROJECT_UNMAPPED") {
32246
32254
  const repository = issueReference.slice(0, issueReference.lastIndexOf("#"));
32247
- throw new Error(`repository ${repository} is not mapped in DISPATCH_REPO_PROJECTS and no DISPATCH_DEFAULT_PROJECT is configured`);
32255
+ throw new Error(`repository ${repository} is not mapped in repository settings and no DISPATCH_DEFAULT_PROJECT is configured`);
32248
32256
  }
32249
32257
  throw error;
32250
32258
  }
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion-envoy",
3
- "version": "0.21.2",
3
+ "version": "0.22.0",
4
4
  "type": "module",
5
5
  "omp": {
6
6
  "extensions": [