@sjawhar/pi-legion 18.51.0 → 18.52.1
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/legion.js +28 -16
- package/package.json +1 -1
package/dist/legion.js
CHANGED
|
@@ -14337,7 +14337,7 @@ import { logger as logger3 } from "@oh-my-pi/pi-utils";
|
|
|
14337
14337
|
// package.json
|
|
14338
14338
|
var package_default = {
|
|
14339
14339
|
name: "@sjawhar/pi-legion",
|
|
14340
|
-
version: "18.
|
|
14340
|
+
version: "18.52.1",
|
|
14341
14341
|
license: "Apache-2.0",
|
|
14342
14342
|
type: "module",
|
|
14343
14343
|
omp: {
|
|
@@ -15799,17 +15799,23 @@ var requiredString = (op, field) => {
|
|
|
15799
15799
|
var rfc3339String = (op, field, message) => requiredString(op, field).refine((value) => value.trim() === "" || LegionInstant.safeParse(value).success, { error: message });
|
|
15800
15800
|
var windowStart = rfc3339String("read_release_records", "since", "read_release_records' since is an RFC 3339 time, as 2026-11-02T09:00:00Z is");
|
|
15801
15801
|
var nextLook = rfc3339String("handoff_complete", "wake_at", "handoff_complete's wake_at is an RFC 3339 time, as 2026-11-02T09:00:00Z is");
|
|
15802
|
+
var unknownFieldsRefusal = (op, refused, takes) => [
|
|
15803
|
+
...refused.map((field) => `${op} does not accept field "${field}"`),
|
|
15804
|
+
`it takes ${takes.length === 0 ? "none" : takes.join(", ")}`
|
|
15805
|
+
].join("; ");
|
|
15802
15806
|
var operation = (op, shape) => strictObject({ op: literal(op), ...shape }, {
|
|
15803
|
-
error: (issue) => issue.code === "unrecognized_keys" ? issue.keys.
|
|
15807
|
+
error: (issue) => issue.code === "unrecognized_keys" ? unknownFieldsRefusal(op, issue.keys, Object.keys(shape)) : undefined
|
|
15804
15808
|
});
|
|
15805
15809
|
var PhaseOpArguments = discriminatedUnion("op", [
|
|
15806
|
-
operation("read_record", {
|
|
15810
|
+
operation("read_record", {
|
|
15811
|
+
issue: string2({ error: "read_record's issue is an issue key, as LEGION-208 is" }).optional()
|
|
15812
|
+
}),
|
|
15807
15813
|
operation("read_release_records", {
|
|
15808
15814
|
since: windowStart
|
|
15809
15815
|
}),
|
|
15810
15816
|
operation("handoff_complete", {
|
|
15811
15817
|
summary: requiredString("handoff_complete", "summary"),
|
|
15812
|
-
issue: string2().optional(),
|
|
15818
|
+
issue: string2({ error: "handoff_complete's issue is an issue key, as LEGION-208 is" }).optional(),
|
|
15813
15819
|
verdict: _enum(["pass", "pending", "fail"], {
|
|
15814
15820
|
error: "handoff_complete's verdict is pass, pending or fail"
|
|
15815
15821
|
}).optional(),
|
|
@@ -15817,7 +15823,7 @@ var PhaseOpArguments = discriminatedUnion("op", [
|
|
|
15817
15823
|
wake_at: nextLook.optional()
|
|
15818
15824
|
}),
|
|
15819
15825
|
operation("request_backward_move", {
|
|
15820
|
-
issue: string2().optional(),
|
|
15826
|
+
issue: string2({ error: "request_backward_move's issue is an issue key, as LEGION-208 is" }).optional(),
|
|
15821
15827
|
to: _enum(LEGION_PHASE_BACKWARD_TARGETS, {
|
|
15822
15828
|
error: (issue) => typeof issue.input === "string" && issue.input.trim() !== "" ? `request_backward_move's to is one of ${LEGION_PHASE_BACKWARD_TARGETS.join(", ")}` : "request_backward_move requires to"
|
|
15823
15829
|
}),
|
|
@@ -15891,7 +15897,8 @@ async function executePhaseOp(runtime, input) {
|
|
|
15891
15897
|
const args = parsed.data;
|
|
15892
15898
|
switch (args.op) {
|
|
15893
15899
|
case "read_record": {
|
|
15894
|
-
const
|
|
15900
|
+
const named = args.issue?.trim() ?? "";
|
|
15901
|
+
const issue = named !== "" ? named : claim.issue;
|
|
15895
15902
|
return { record: recordFrom(await daemon.state(), issue) };
|
|
15896
15903
|
}
|
|
15897
15904
|
case "read_release_records":
|
|
@@ -15906,12 +15913,16 @@ async function executePhaseOp(runtime, input) {
|
|
|
15906
15913
|
case "request_backward_move": {
|
|
15907
15914
|
let issue;
|
|
15908
15915
|
if (claim.role === "architect") {
|
|
15909
|
-
|
|
15916
|
+
const named = args.issue?.trim() ?? "";
|
|
15917
|
+
if (named === "") {
|
|
15910
15918
|
throw new Error("request_backward_move requires issue");
|
|
15911
15919
|
}
|
|
15912
|
-
issue =
|
|
15913
|
-
} else
|
|
15914
|
-
|
|
15920
|
+
issue = named;
|
|
15921
|
+
} else {
|
|
15922
|
+
const named = args.issue?.trim() ?? "";
|
|
15923
|
+
if (named !== "" && named !== claim.issue) {
|
|
15924
|
+
throw new Error(`a phase worker moves only its own issue ${claim.issue}, not ${named}`);
|
|
15925
|
+
}
|
|
15915
15926
|
}
|
|
15916
15927
|
await daemon.phaseBackward({
|
|
15917
15928
|
grantId: await mintClaimGrant(daemon, claim),
|
|
@@ -16120,7 +16131,7 @@ function toolSchema(pi) {
|
|
|
16120
16131
|
step: z.enum(GATED_STEPS).describe("register_gate's design-gate step: decisions for the issue's decisions document, criteria for its Verification document, spec for its primary document. A deployment that gates one step takes the registration without it").optional(),
|
|
16121
16132
|
issues: z.array(z.string()).optional(),
|
|
16122
16133
|
to: phase.to,
|
|
16123
|
-
reason:
|
|
16134
|
+
reason: z.string().describe("close_root's and request_backward_move's why; no other operation takes it. park_child and rerun_child take only issue: say why you park a child in a dispatch comment on it").optional(),
|
|
16124
16135
|
decision: z.enum(["retry", "escalate"]).optional(),
|
|
16125
16136
|
summary: phase.summary,
|
|
16126
16137
|
verdict: phase.verdict,
|
|
@@ -16141,11 +16152,12 @@ function assertOperationInput(parameters, operation) {
|
|
|
16141
16152
|
const fields = OPERATION_FIELDS[operation];
|
|
16142
16153
|
if (fields === undefined)
|
|
16143
16154
|
throw new Error(`Unsupported legion operation: ${operation}`);
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16155
|
+
const refused = Object.keys(parameters).filter((name) => name !== "op" && !fields.includes(name));
|
|
16156
|
+
if (refused.length === 0)
|
|
16157
|
+
return;
|
|
16158
|
+
const refusal = unknownFieldsRefusal(operation, refused, fields);
|
|
16159
|
+
const childOperation = operation === "park_child" || operation === "rerun_child";
|
|
16160
|
+
throw new Error(childOperation && refused.includes("reason") ? `${refusal}. Say why in a dispatch comment on the child` : refusal);
|
|
16149
16161
|
}
|
|
16150
16162
|
function createLegionTool(deps) {
|
|
16151
16163
|
const {
|