@sjawhar/pi-legion 9.1.1 → 9.2.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/legion.js +80 -18
  2. package/package.json +1 -1
package/dist/legion.js CHANGED
@@ -13704,6 +13704,7 @@ function activeDispatchConfig(env, options = {}) {
13704
13704
  }
13705
13705
 
13706
13706
  // ../contracts/src/dispatch-api.ts
13707
+ var MAX_ISSUE_BLOCKERS = 20;
13707
13708
  var ISSUE_TITLE_MAX = 1000;
13708
13709
  var MAX_ISSUE_PAGE_LIMIT = 250;
13709
13710
  var DEFAULT_ISSUE_PAGE_LIMIT = 50;
@@ -14032,6 +14033,7 @@ var dispatchToolSpecs = [
14032
14033
  project: z2.string().describe("Project key for the new issue."),
14033
14034
  title: z2.string({ max: ISSUE_TITLE_MAX }).describe("Concise issue title, at most 1,000 characters."),
14034
14035
  parent: z2.string().describe("Optional parent issue.").optional(),
14036
+ blocked_by: z2.array(z2.string({ min: 1 }), { max: MAX_ISSUE_BLOCKERS }).describe("Issue keys in the same project this issue waits on. Dispatch refuses a dependency cycle.").optional(),
14035
14037
  external: z2.string().describe("Optional external issue reference.").optional(),
14036
14038
  force: z2.boolean().describe("Create even though POSSIBLE_DUPLICATE listed similar issues; pass it only after reading them.").optional(),
14037
14039
  spec: z2.string().describe(`Optional initial primary-document markdown. ${SPEC_WRITING_POINTER}`).optional(),
@@ -14048,7 +14050,7 @@ var dispatchToolSpecs = [
14048
14050
  status: "done",
14049
14051
  reason: "Shipped in owner/repo#7; verified on the production dashboard."
14050
14052
  },
14051
- description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, link a URL (the pull request that delivers it, a run, a document), set its " + "route, set or clear its parent, or attach it to architecture components. Status is one of " + `${ISSUE_STATUSES.join(", ")}; outside Legion, move it yourself as the work advances; inside ` + "Legion the daemon moves it. external_links are " + "merged into the issue's existing links by URL, so linking the pull request you just opened " + "keeps every earlier link. components replaces the issue's own attachment. Closing an issue " + "(status done) requires reason, the note that says why: it is posted on the issue as a " + "message, then the issue closes, because a closed issue refuses messages, comments, and " + "artifacts; reason goes only with status done. A closed issue takes only rank, components, " + "and a reopening status (any status but done); everything else, priority included, waits " + "for the reopen. " + "priority is yours to set and a human overrides it; rank, the board's own order, is not " + "settable here. At least one " + `field besides issue is required. ${ISSUE_REFERENCE}`,
14053
+ description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, link a URL (the pull request that delivers it, a run, a document), set its " + "route, set or clear its parent, replace the issues it is blocked by, or attach it to " + "architecture components. Status is one of " + `${ISSUE_STATUSES.join(", ")}; outside Legion, move it yourself as the work advances; inside ` + "Legion the daemon moves it. external_links are " + "merged into the issue's existing links by URL, so linking the pull request you just opened " + "keeps every earlier link. components replaces the issue's own attachment. Closing an issue " + "(status done) requires reason, the note that says why: it is posted on the issue as a " + "message, then the issue closes, because a closed issue refuses messages, comments, and " + "artifacts; reason goes only with status done. A closed issue takes only rank, components, " + "and a reopening status (any status but done); everything else, priority included, waits " + "for the reopen. " + "priority is yours to set and a human overrides it; rank, the board's own order, is not " + "settable here. At least one " + `field besides issue is required. ${ISSUE_REFERENCE}`,
14052
14054
  arguments: (z2) => ({
14053
14055
  issue: z2.string().describe(ISSUE_REFERENCE),
14054
14056
  status: z2.enum(ISSUE_STATUSES).describe("New lifecycle status.").optional(),
@@ -14059,15 +14061,16 @@ var dispatchToolSpecs = [
14059
14061
  external_links: z2.array(z2.string({ min: 1 })).describe("URLs to link; merged into the issue's existing external links by URL.").optional(),
14060
14062
  route: z2.string().describe("Route the issue to role:<name> or session:<id>; an empty string clears it.").optional(),
14061
14063
  parent: z2.string().describe("Parent issue key in the same project; an empty string clears the parent.").optional(),
14064
+ blocked_by: z2.array(z2.string({ min: 1 }), { max: MAX_ISSUE_BLOCKERS }).describe("Replacement list of issue keys in the same project this issue waits on; [] clears it. Dispatch refuses a dependency cycle.").optional(),
14062
14065
  components: componentsArgument(z2).optional()
14063
14066
  }),
14064
14067
  validation: {
14065
14068
  check: (value) => {
14066
14069
  const input = value;
14067
14070
  const reasonFits = input.status === "done" ? typeof input.reason === "string" && input.reason.trim() !== "" : input.reason === undefined;
14068
- return reasonFits && (typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || typeof input.priority === "number" || input.priority === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || typeof input.components === "object" && input.components !== null);
14071
+ return reasonFits && (typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || typeof input.priority === "number" || input.priority === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || Array.isArray(input.blocked_by) || typeof input.components === "object" && input.components !== null);
14069
14072
  },
14070
- message: "Issue update requires at least one field besides issue: status, title, labels, priority, external_links, route, parent, or components. " + "status done requires reason, a non-empty note saying why the issue is closing, posted on the issue before it closes because a closed issue refuses messages, comments, and artifacts; reason goes only with status done."
14073
+ message: "Issue update requires at least one field besides issue: status, title, labels, priority, external_links, route, parent, blocked_by, or components. " + "status done requires reason, a non-empty note saying why the issue is closing, posted on the issue before it closes because a closed issue refuses messages, comments, and artifacts; reason goes only with status done."
14071
14074
  },
14072
14075
  strict: true
14073
14076
  },
@@ -15477,6 +15480,15 @@ var CHECKS = {
15477
15480
  };
15478
15481
  var MAX_DETAIL_BYTES = 1024;
15479
15482
  var HELD = "\uFFFF";
15483
+ var C1_INTRODUCER = "\uFFFE";
15484
+ var OPENER = "\uFDD0";
15485
+ var HELD_READINGS = [
15486
+ [/(?:\uffff\[|\ufffe)[0-?]*[!-)+,/-]*/g, OPENER],
15487
+ [/\ufdd0[@-~]?/g, HELD],
15488
+ [/\uffff/g, " "]
15489
+ ];
15490
+ var HELD_SEQUENCE = String.raw`\ufffe|\ufdd0|\uffff(?:\[[0-?]*[@-~])?`;
15491
+ var JWT_FIRST_HELD_SEQUENCE = String.raw`\ufffe|\uffff(?:\[[0-?]*[@-~])?`;
15480
15492
  function isSpace(code) {
15481
15493
  return code >= 9 && code <= 13 || code === 32 || code === 133 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288;
15482
15494
  }
@@ -15495,33 +15507,83 @@ function truncateUtf8(text, max) {
15495
15507
  var CREDENTIAL_RULES = [
15496
15508
  [/(?<![a-z0-9+.-])([0-9+.-]*[a-z][a-z0-9+.-]*:\/\/)[^ /?#]+@/gi, "$1***@"],
15497
15509
  [
15498
- /([?&](?:token|key|secret|password|access_token|refresh_token|id_token|api_key|apikey|client_secret|sig|x-amz-security-token|x-amz-signature)=)[^ &#"'<>]+/gi,
15510
+ /([?&](?:token|key|secret|password|access_token|accesstoken|refresh_token|id_token|auth_token|private_token|api_key|apikey|client_secret|sig|signature|x-amz-security-token|x-amz-signature|x-goog-signature)=)[^ &#"'<>]+/gi,
15511
+ "$1***"
15512
+ ],
15513
+ [
15514
+ /\b(password[ \ufffe\uffff]*=[ \ufffe\uffff]*)(?:(')(?:[^'\\]|\\.)*('?)|[^ &#"'<>]+)/gi,
15515
+ "$1$2***$3"
15516
+ ],
15517
+ [
15518
+ /(authorization\\?["']?[ \ufffe\uffff]*[:=][ \ufffe\uffff]*)(?:(\\["'](?:(?:bearer|basic|token|digest)[ \ufffe\uffff]+)?)[^"'\\]+|(["'](?:(?:bearer|basic|token|digest)[ \ufffe\uffff]+)?)(?:[^"'\\]|\\.)+|(\[?(?:(?:bearer|basic|token|digest)[ \ufffe\uffff]+)?)[^)\]}>]+)/gi,
15519
+ "$1$2$3$4***"
15520
+ ],
15521
+ [
15522
+ new RegExp(String.raw`((?:api-key|ocp-apim-subscription-key|x-subscription-token)\\?["']?[ \ufffe\uffff]*[:=][ \ufffe\uffff]*\\?["']?)(?:[A-Za-z0-9._~+/=*-]|${HELD_SEQUENCE})+`, "gi"),
15523
+ "$1***"
15524
+ ],
15525
+ [
15526
+ /(\\?["'](?:api_key|access_token)\\?["'][ \ufffe\uffff]*:[ \ufffe\uffff]*\\?["'])[^"'\\]+/gi,
15527
+ "$1***"
15528
+ ],
15529
+ [
15530
+ new RegExp(String.raw`\b(bearer[ \ufffe\uffff]+)(?:[A-Za-z0-9._~+/=*-]|${HELD_SEQUENCE})+`, "gi"),
15499
15531
  "$1***"
15500
15532
  ],
15501
15533
  [
15502
- /(authorization["']?[ \uffff]*[:=][ \uffff]*)(?:(["'])((?:bearer|basic|token|digest)[ \uffff]+)?[^"']+|(\[?)((?:bearer|basic|token|digest)[ \uffff]+)?[^)\]}>]+)/gi,
15503
- "$1$2$3$4$5***"
15534
+ new RegExp(String.raw`\b(gh[pousr]_|github_pat_)(?:[A-Za-z0-9._-]|${HELD_SEQUENCE}){20,}`, "g"),
15535
+ "$1***"
15504
15536
  ],
15505
- [/(x-api-key["']?[ \uffff]*[:=][ \uffff]*["']?)[A-Za-z0-9._~+/=*\uffff-]+/gi, "$1***"],
15506
- [/\b(bearer[ \uffff]+)[A-Za-z0-9._~+/=*\uffff-]+/gi, "$1***"],
15507
- [/\b(gh[pousr]_|github_pat_)[A-Za-z0-9._\uffff-]{20,}/g, "$1***"],
15508
15537
  [
15509
- /(?<![A-Za-z0-9_\uffff-])eyJ[A-Za-z0-9_\uffff-]{8,}\.[A-Za-z0-9_\uffff-]{8,}\.[A-Za-z0-9_\uffff-]*/g,
15538
+ new RegExp(String.raw`(?:(?=eyJ)(?<!\uffff\[[0-?]*(?:[@-~]?|\\u[0-9A-Fa-f]{4}))(?:(?<![A-Za-z0-9_\ufffe\uffff-])|(?<=%[0-9A-Fa-f]{2}|\\u[0-9A-Fa-f]{4}))eyJ(?:[A-Za-z0-9_-]|${JWT_FIRST_HELD_SEQUENCE}){8,}|(?<=\uffff)eyJ(?:[A-Za-z0-9_-]|\ufffe){8,}|(?=eyJ)(?<=\uffff\[[0-?]*(?:[@-~]|\\u[0-9A-Fa-f]{4})?)eyJ[A-Za-z0-9_-]*\ufffe(?:[A-Za-z0-9_-]|\ufffe)*)\.(?:[A-Za-z0-9_-]|${HELD_SEQUENCE}){8,}\.(?:[A-Za-z0-9_-]|${HELD_SEQUENCE})*`, "g"),
15510
15539
  "***"
15511
15540
  ],
15512
- [/\b(sk-|dsp_)[A-Za-z0-9_\uffff-]{20,}/g, "$1***"],
15513
- [/\b(AKIA|ASIA)[A-Z0-9]{16}\b/g, "$1***"]
15541
+ [
15542
+ new RegExp(String.raw`\b(sk-|dsp_|ya29\.|xox[a-z]-|glpat-|npm_)(?:[A-Za-z0-9_-]|${HELD_SEQUENCE}){20,}`, "g"),
15543
+ "$1***"
15544
+ ],
15545
+ [new RegExp(String.raw`\b(AIza)(?:[A-Za-z0-9_-]|${HELD_SEQUENCE}){35,}`, "g"), "$1***"],
15546
+ [new RegExp(String.raw`\b(AKIA|ASIA)(?:(?:${HELD_SEQUENCE})*[A-Z0-9]){16}\b`, "g"), "$1***"]
15514
15547
  ];
15548
+ var MAX_REDACTION_PASSES = 8;
15549
+ function redactCredentials(text) {
15550
+ let line = text;
15551
+ for (let pass = 0;pass < MAX_REDACTION_PASSES; pass++) {
15552
+ const next = CREDENTIAL_RULES.reduce((redacted, [pattern, replacement]) => redacted.replace(pattern, replacement), line);
15553
+ if (next === line)
15554
+ break;
15555
+ line = next;
15556
+ }
15557
+ return line;
15558
+ }
15559
+ function withoutLastCodePoint(text) {
15560
+ const last = text.charCodeAt(text.length - 1);
15561
+ return text.slice(0, last >= 56320 && last <= 57343 && text.length > 1 ? -2 : -1);
15562
+ }
15515
15563
  function cleanDetail(text) {
15516
15564
  let marked = "";
15517
15565
  for (const char of text) {
15518
15566
  const code = char.codePointAt(0) ?? 0;
15519
- const control = code < 32 || code >= 127 && code < 160;
15520
- marked += isSpace(code) ? " " : control ? HELD : char;
15567
+ const control = code < 32 || code >= 127 && code < 160 || code === 65534 || code === 64976 || code === 65533;
15568
+ marked += isSpace(code) ? " " : code === 155 ? C1_INTRODUCER : control ? HELD : char;
15569
+ }
15570
+ let redacted = redactCredentials(marked);
15571
+ if (marked.includes(HELD) || marked.includes(C1_INTRODUCER)) {
15572
+ for (const [pattern, replacement] of HELD_READINGS) {
15573
+ const read = redacted.replace(pattern, replacement);
15574
+ if (read !== redacted)
15575
+ redacted = redactCredentials(read);
15576
+ }
15577
+ }
15578
+ const line = redacted.split(" ").filter((field) => field !== "").join(" ");
15579
+ let cut = truncateUtf8(line, MAX_DETAIL_BYTES).replace(/ +$/, "");
15580
+ if (cut.length < line.length) {
15581
+ while (redactCredentials(cut) !== cut) {
15582
+ const space = cut.lastIndexOf(" ");
15583
+ cut = space > 0 ? cut.slice(0, space) : withoutLastCodePoint(cut);
15584
+ }
15521
15585
  }
15522
- const redacted = CREDENTIAL_RULES.reduce((line2, [pattern, replacement]) => line2.replace(pattern, replacement), marked);
15523
- const line = redacted.replaceAll(HELD, " ").split(" ").filter((field) => field !== "").join(" ");
15524
- return truncateUtf8(line, MAX_DETAIL_BYTES);
15586
+ return cut;
15525
15587
  }
15526
15588
  function budgetLabel(ms) {
15527
15589
  return ms % 1000 === 0 ? `${ms / 1000} s` : `${ms} ms`;
@@ -15641,7 +15703,7 @@ function onEnvoyRoleRegained(listener) {
15641
15703
  // package.json
15642
15704
  var package_default = {
15643
15705
  name: "@sjawhar/pi-legion",
15644
- version: "9.1.1",
15706
+ version: "9.2.0",
15645
15707
  license: "Apache-2.0",
15646
15708
  type: "module",
15647
15709
  omp: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "9.1.1",
3
+ "version": "9.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {