@sjawhar/pi-legion 10.19.5 → 10.19.6

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 +22 -8
  2. package/package.json +1 -1
package/dist/legion.js CHANGED
@@ -14388,6 +14388,23 @@ var commentValidation = {
14388
14388
  },
14389
14389
  message: `${commentOwner.message} turn requires reply_to_ask.`
14390
14390
  };
14391
+ var ISSUE_UPDATE_FIELDS_RULE = "Issue update requires at least one field besides issue: status, title, labels, priority, external_links, route, parent, blocked_by, components, or repo.";
14392
+ var ISSUE_UPDATE_DONE_RULE = "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";
14393
+ var ISSUE_UPDATE_REASON_RULE = "reason goes only with status done";
14394
+ var ISSUE_UPDATE_RULE = `${ISSUE_UPDATE_FIELDS_RULE} ${ISSUE_UPDATE_DONE_RULE}; ${ISSUE_UPDATE_REASON_RULE}.`;
14395
+ function issueUpdateProblem(value) {
14396
+ const input = value;
14397
+ if (input.status === "done") {
14398
+ if (typeof input.reason !== "string" || input.reason.trim() === "") {
14399
+ return `${ISSUE_UPDATE_DONE_RULE}.`;
14400
+ }
14401
+ } else if (input.reason !== undefined) {
14402
+ const status = typeof input.status === "string" ? `status ${input.status}` : "an update without status done";
14403
+ return `${ISSUE_UPDATE_REASON_RULE}: it is the note posted on the issue as it closes, and ${status} closes nothing. Drop reason, or set status done to close the issue.`;
14404
+ }
14405
+ const changesAField = 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 || typeof input.repo === "string";
14406
+ return changesAField ? undefined : ISSUE_UPDATE_FIELDS_RULE;
14407
+ }
14391
14408
  var messageValidation = {
14392
14409
  check: (value) => {
14393
14410
  const input = value;
@@ -14489,12 +14506,9 @@ var dispatchToolSpecs = [
14489
14506
  repo: z2.string().describe("The repository the issue targets, owner/name, mapped to the issue's project in Settings; an empty string clears it, so the issue inherits its parent's or the project's default again.").optional()
14490
14507
  }),
14491
14508
  validation: {
14492
- check: (value) => {
14493
- const input = value;
14494
- const reasonFits = input.status === "done" ? typeof input.reason === "string" && input.reason.trim() !== "" : input.reason === undefined;
14495
- 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 || typeof input.repo === "string");
14496
- },
14497
- message: "Issue update requires at least one field besides issue: status, title, labels, priority, external_links, route, parent, blocked_by, components, or repo. " + "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."
14509
+ check: (value) => issueUpdateProblem(value) === undefined,
14510
+ message: ISSUE_UPDATE_RULE,
14511
+ refusal: (value) => issueUpdateProblem(value) ?? ISSUE_UPDATE_RULE
14498
14512
  },
14499
14513
  strict: true
14500
14514
  },
@@ -14980,7 +14994,7 @@ function zodSchemaApi(zod) {
14980
14994
  let schema = api2.object(shape);
14981
14995
  if (opts.strict)
14982
14996
  schema = schema.strict();
14983
- return schema.refine(check2, message);
14997
+ return schema.refine(check2, typeof message === "string" ? message : { error: (issue2) => message(issue2.input) });
14984
14998
  }
14985
14999
  };
14986
15000
  }
@@ -16918,7 +16932,7 @@ async function bootLegionClaim(host2) {
16918
16932
  // package.json
16919
16933
  var package_default = {
16920
16934
  name: "@sjawhar/pi-legion",
16921
- version: "10.19.5",
16935
+ version: "10.19.6",
16922
16936
  license: "Apache-2.0",
16923
16937
  type: "module",
16924
16938
  omp: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "10.19.5",
3
+ "version": "10.19.6",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {