@smartergpt/lexrunner 2.0.2 → 2.1.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/BRAND.md +14 -0
- package/CHANGELOG.md +21 -0
- package/GOVERNANCE.md +18 -0
- package/LICENSE.md +201 -110
- package/NOTICE.md +12 -1
- package/README.md +12 -6
- package/dist/{api-QBPBKYOC.js → api-UIWVFU7M.js} +1 -1
- package/dist/{audit-SKMMC2U4.js → audit-HVB2HJPU.js} +2 -2
- package/dist/{autopilot-3OHEUTHD.js → autopilot-JWIOXBCZ.js} +2 -2
- package/dist/{chunk-6PZDSWCG.js → chunk-37UC53OG.js} +2 -2
- package/dist/{chunk-V3BU2VDU.js → chunk-PDDULIDL.js} +13 -1
- package/dist/{chunk-ARDKZW7F.js → chunk-SHSL643G.js} +2 -2
- package/dist/cli.cjs +979 -328
- package/dist/cli.d.ts +161 -7
- package/dist/cli.js +803 -171
- package/dist/{commandValidator-LVEMJTZP.js → commandValidator-XFVNCZXX.js} +1 -1
- package/dist/{constraints-2ZK5FJFA.js → constraints-LE2MW5NS.js} +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/frames/index.js +1 -1
- package/dist/{gateMapping-R3RJYKMS.js → gateMapping-V4DTL5WD.js} +1 -1
- package/dist/hooks/events.js +1 -1
- package/dist/{jsonEnvelope-K2U5CWKU.js → jsonEnvelope-MXJM5ZQH.js} +1 -1
- package/dist/{mergeTreeSimulator-QCFSOU25.js → mergeTreeSimulator-GWZ77NF2.js} +1 -1
- package/dist/package-schemas/behavior-rule.js +1 -1
- package/dist/package-schemas/execution-plan-v1.js +1 -1
- package/dist/package-schemas/gates.js +1 -1
- package/dist/package-schemas/runner-scope.js +1 -1
- package/dist/package-schemas/runner-stack.js +1 -1
- package/dist/{planDiff-IHLFNZUT.js → planDiff-4D3AERAW.js} +1 -1
- package/dist/{planHistory-GLRI356L.js → planHistory-VPV4WDPW.js} +1 -1
- package/dist/{planReview-UUMCGZJ6.js → planReview-FV6INFLQ.js} +1 -1
- package/dist/{planViewer-TRSQVMH4.js → planViewer-WOV6A2HZ.js} +1 -1
- package/dist/{sarif-2C6RKOUX.js → sarif-QXVE3LYD.js} +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/{security-OE4VLUFK.js → security-W7TOUXSB.js} +1 -1
- package/dist/{signing-KLZYZZMP.js → signing-WGVPHJGG.js} +1 -1
- package/dist/{verify-3UVMA62I.js → verify-Y34CJAKB.js} +1 -1
- package/package.json +6 -4
package/dist/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
finalizeAudit,
|
|
25
25
|
initAuditEmitter,
|
|
26
26
|
redactSecrets
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-37UC53OG.js";
|
|
28
28
|
import "./chunk-6KK5JFFE.js";
|
|
29
29
|
import {
|
|
30
30
|
simulateBatchMerges
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
validateWriteOperation,
|
|
84
84
|
verifyToolchainPins,
|
|
85
85
|
writeRunState
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-SHSL643G.js";
|
|
87
87
|
import {
|
|
88
88
|
ExecutionState,
|
|
89
89
|
generateMarkdownSummary,
|
|
@@ -135,9 +135,13 @@ import "./chunk-AXOAVRTU.js";
|
|
|
135
135
|
import {
|
|
136
136
|
__esm,
|
|
137
137
|
__export,
|
|
138
|
+
__privateAdd,
|
|
139
|
+
__privateGet,
|
|
140
|
+
__privateMethod,
|
|
141
|
+
__privateSet,
|
|
138
142
|
__require,
|
|
139
143
|
__toCommonJS
|
|
140
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-PDDULIDL.js";
|
|
141
145
|
|
|
142
146
|
// src/metrics/export.ts
|
|
143
147
|
var export_exports = {};
|
|
@@ -470,7 +474,7 @@ import "dotenv/config";
|
|
|
470
474
|
// package.json
|
|
471
475
|
var package_default = {
|
|
472
476
|
name: "@smartergpt/lexrunner",
|
|
473
|
-
version: "2.0
|
|
477
|
+
version: "2.1.0",
|
|
474
478
|
type: "module",
|
|
475
479
|
engines: {
|
|
476
480
|
node: ">=24"
|
|
@@ -483,10 +487,10 @@ var package_default = {
|
|
|
483
487
|
url: "git+https://github.com/Guffawaffle/lexrunner.git"
|
|
484
488
|
},
|
|
485
489
|
publishConfig: {
|
|
486
|
-
access: "
|
|
490
|
+
access: "public",
|
|
487
491
|
registry: "https://registry.npmjs.org/"
|
|
488
492
|
},
|
|
489
|
-
license: "
|
|
493
|
+
license: "Apache-2.0",
|
|
490
494
|
files: [
|
|
491
495
|
"dist/",
|
|
492
496
|
"schemas/",
|
|
@@ -495,7 +499,9 @@ var package_default = {
|
|
|
495
499
|
"README.mcp.md",
|
|
496
500
|
"CHANGELOG.md",
|
|
497
501
|
"NOTICE.md",
|
|
498
|
-
"LICENSE.md"
|
|
502
|
+
"LICENSE.md",
|
|
503
|
+
"GOVERNANCE.md",
|
|
504
|
+
"BRAND.md"
|
|
499
505
|
],
|
|
500
506
|
bin: {
|
|
501
507
|
lexrunner: "dist/cli.js",
|
|
@@ -649,7 +655,7 @@ var package_default = {
|
|
|
649
655
|
// src/cli.ts
|
|
650
656
|
import { Command as Command6, CommanderError } from "commander";
|
|
651
657
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
652
|
-
import { resolve as
|
|
658
|
+
import { resolve as resolve15 } from "path";
|
|
653
659
|
import chalk11 from "chalk";
|
|
654
660
|
|
|
655
661
|
// src/core/inputs.ts
|
|
@@ -1106,8 +1112,8 @@ function generateSnapshot(plan, inputs) {
|
|
|
1106
1112
|
}
|
|
1107
1113
|
function getPackageVersion() {
|
|
1108
1114
|
try {
|
|
1109
|
-
const
|
|
1110
|
-
const packageJson = JSON.parse(
|
|
1115
|
+
const fs51 = __require("fs");
|
|
1116
|
+
const packageJson = JSON.parse(fs51.readFileSync("package.json", "utf8"));
|
|
1111
1117
|
return packageJson.version || "unknown";
|
|
1112
1118
|
} catch {
|
|
1113
1119
|
return "unknown";
|
|
@@ -2432,10 +2438,10 @@ async function promptGitHubToken() {
|
|
|
2432
2438
|
input: process.stdin,
|
|
2433
2439
|
output: process.stdout
|
|
2434
2440
|
});
|
|
2435
|
-
return new Promise((
|
|
2441
|
+
return new Promise((resolve16) => {
|
|
2436
2442
|
rl.question("GitHub token (optional, press Enter to skip): ", (answer) => {
|
|
2437
2443
|
rl.close();
|
|
2438
|
-
|
|
2444
|
+
resolve16(answer.trim());
|
|
2439
2445
|
});
|
|
2440
2446
|
});
|
|
2441
2447
|
}
|
|
@@ -3404,8 +3410,8 @@ function containedRegularFile(root, candidate) {
|
|
|
3404
3410
|
}
|
|
3405
3411
|
}
|
|
3406
3412
|
function isContained(root, candidate) {
|
|
3407
|
-
const
|
|
3408
|
-
return
|
|
3413
|
+
const relative5 = path8.relative(path8.resolve(root), path8.resolve(candidate));
|
|
3414
|
+
return relative5 !== ".." && !relative5.startsWith(`..${path8.sep}`) && !path8.isAbsolute(relative5);
|
|
3409
3415
|
}
|
|
3410
3416
|
function evidenceError(code, message) {
|
|
3411
3417
|
return new GateEvidenceServiceError(code, message);
|
|
@@ -4528,7 +4534,7 @@ function registerGateImportChecksCommand(program2) {
|
|
|
4528
4534
|
version: "1.0.0",
|
|
4529
4535
|
mappings: []
|
|
4530
4536
|
};
|
|
4531
|
-
const { DEFAULT_GATE_MAPPINGS } = await import("./gateMapping-
|
|
4537
|
+
const { DEFAULT_GATE_MAPPINGS } = await import("./gateMapping-V4DTL5WD.js");
|
|
4532
4538
|
mappingConfig.mappings = DEFAULT_GATE_MAPPINGS;
|
|
4533
4539
|
}
|
|
4534
4540
|
let githubClient;
|
|
@@ -4841,11 +4847,11 @@ function isTestFile(file) {
|
|
|
4841
4847
|
}
|
|
4842
4848
|
function directOwnerCandidates(file) {
|
|
4843
4849
|
if (!file.startsWith("src/") || !/\.[cm]?tsx?$/.test(file)) return [];
|
|
4844
|
-
const
|
|
4845
|
-
const basename4 = path12.posix.basename(
|
|
4850
|
+
const relative5 = file.replace(/^src\//, "").replace(/\.[cm]?tsx?$/, "");
|
|
4851
|
+
const basename4 = path12.posix.basename(relative5);
|
|
4846
4852
|
return [
|
|
4847
|
-
`tests/${
|
|
4848
|
-
`tests/${
|
|
4853
|
+
`tests/${relative5}.spec.ts`,
|
|
4854
|
+
`tests/${relative5}.test.ts`,
|
|
4849
4855
|
`tests/${basename4}.spec.ts`,
|
|
4850
4856
|
`tests/${basename4}.test.ts`
|
|
4851
4857
|
];
|
|
@@ -6071,10 +6077,10 @@ async function readInput(inputPath) {
|
|
|
6071
6077
|
}
|
|
6072
6078
|
return fs17.readFileSync(inputPath, "utf-8");
|
|
6073
6079
|
} else {
|
|
6074
|
-
return new Promise((
|
|
6080
|
+
return new Promise((resolve16, reject) => {
|
|
6075
6081
|
const chunks = [];
|
|
6076
6082
|
process.stdin.on("data", (chunk) => chunks.push(chunk));
|
|
6077
|
-
process.stdin.on("end", () =>
|
|
6083
|
+
process.stdin.on("end", () => resolve16(Buffer.concat(chunks).toString("utf-8")));
|
|
6078
6084
|
process.stdin.on("error", reject);
|
|
6079
6085
|
});
|
|
6080
6086
|
}
|
|
@@ -6711,20 +6717,20 @@ async function registerSecurityCommands(program2) {
|
|
|
6711
6717
|
program2.command("security").description("Security operations: token rotation, secrets scanning, validation").addCommand(
|
|
6712
6718
|
new Command3("check-rotation").description("Check if secrets need rotation based on age").argument("[secrets...]", "Secret IDs to check (without LEX_PR_ prefix)", ["GITHUB_TOKEN"]).option("--max-age <days>", "Maximum age in days before rotation needed", "90").option("--format <format>", "Output format: text or json", "text").option("--no-color", "Disable ANSI colors in text output").action(
|
|
6713
6719
|
async (secretIds, opts) => {
|
|
6714
|
-
const { checkRotation } = await import("./security-
|
|
6720
|
+
const { checkRotation } = await import("./security-W7TOUXSB.js");
|
|
6715
6721
|
const result = await checkRotation(secretIds, parseInt(opts.maxAge));
|
|
6716
6722
|
outputSecurityResult("check-rotation", result, opts.format, opts.color !== false);
|
|
6717
6723
|
}
|
|
6718
6724
|
)
|
|
6719
6725
|
).addCommand(
|
|
6720
6726
|
new Command3("scan-plan").description("Scan plan file for accidentally exposed secrets").argument("[plan-file]", "Path to plan file", "plan.json").option("--format <format>", "Output format: text or json", "text").option("--no-color", "Disable ANSI colors in text output").action(async (planFile, opts) => {
|
|
6721
|
-
const { scanPlan } = await import("./security-
|
|
6727
|
+
const { scanPlan } = await import("./security-W7TOUXSB.js");
|
|
6722
6728
|
const result = await scanPlan(planFile);
|
|
6723
6729
|
outputSecurityResult("scan-plan", result, opts.format, opts.color !== false);
|
|
6724
6730
|
})
|
|
6725
6731
|
).addCommand(
|
|
6726
6732
|
new Command3("validate-secrets").description("Validate that required secrets are present").argument("<secrets...>", "Required secret IDs (without LEX_PR_ prefix)").option("--format <format>", "Output format: text or json", "text").option("--no-color", "Disable ANSI colors in text output").action(async (secretIds, opts) => {
|
|
6727
|
-
const { validateSecrets } = await import("./security-
|
|
6733
|
+
const { validateSecrets } = await import("./security-W7TOUXSB.js");
|
|
6728
6734
|
const result = await validateSecrets(secretIds);
|
|
6729
6735
|
outputSecurityResult("validate-secrets", result, opts.format, opts.color !== false);
|
|
6730
6736
|
})
|
|
@@ -6765,7 +6771,7 @@ function outputAuditResult(command, result, format, color) {
|
|
|
6765
6771
|
async function registerAuditCommands(program2) {
|
|
6766
6772
|
program2.command("audit").description("Audit operations: signature verification, manifest validation").addCommand(
|
|
6767
6773
|
new Command4("verify").description("Verify audit manifest signature").argument("[manifest-file]", "Path to audit manifest file", "audit-manifest.json").option("--format <format>", "Output format: text or json", "text").option("--no-color", "Disable ANSI colors in text output").action(async (manifestFile, opts) => {
|
|
6768
|
-
const { verifyCommand } = await import("./verify-
|
|
6774
|
+
const { verifyCommand } = await import("./verify-Y34CJAKB.js");
|
|
6769
6775
|
const result = await verifyCommand(manifestFile);
|
|
6770
6776
|
outputAuditResult("verify", result, opts.format, opts.color !== false);
|
|
6771
6777
|
})
|
|
@@ -8387,8 +8393,8 @@ Details:`);
|
|
|
8387
8393
|
if (opts.json || deps.jsonModeActive()) {
|
|
8388
8394
|
const output = JSON.stringify(plan, null, 2);
|
|
8389
8395
|
if (opts.output) {
|
|
8390
|
-
const
|
|
8391
|
-
await
|
|
8396
|
+
const fs51 = await import("fs/promises");
|
|
8397
|
+
await fs51.writeFile(opts.output, output, "utf-8");
|
|
8392
8398
|
console.log(`Plan written to: ${opts.output}`);
|
|
8393
8399
|
} else {
|
|
8394
8400
|
console.log(output);
|
|
@@ -8411,8 +8417,8 @@ Details:`);
|
|
|
8411
8417
|
console.log(` ${phase}: ${count}`);
|
|
8412
8418
|
}
|
|
8413
8419
|
if (opts.output) {
|
|
8414
|
-
const
|
|
8415
|
-
await
|
|
8420
|
+
const fs51 = await import("fs/promises");
|
|
8421
|
+
await fs51.writeFile(opts.output, JSON.stringify(plan, null, 2), "utf-8");
|
|
8416
8422
|
console.log(`
|
|
8417
8423
|
Plan written to: ${opts.output}`);
|
|
8418
8424
|
}
|
|
@@ -8664,8 +8670,8 @@ function registerHarvestCommand(fanoutCommand) {
|
|
|
8664
8670
|
});
|
|
8665
8671
|
const output = JSON.stringify(harvestBundle, null, 2);
|
|
8666
8672
|
if (opts.output) {
|
|
8667
|
-
const
|
|
8668
|
-
await
|
|
8673
|
+
const fs51 = await import("fs/promises");
|
|
8674
|
+
await fs51.writeFile(opts.output, output, "utf-8");
|
|
8669
8675
|
console.error(`\u2713 Harvest bundle written to ${opts.output}`);
|
|
8670
8676
|
console.error(` ${harvestBundle.bundle.pullRequests.length} PRs`);
|
|
8671
8677
|
console.error(` ${harvestBundle.bundle.issues.length} issues`);
|
|
@@ -9054,10 +9060,10 @@ function analyzeBundle(harvest) {
|
|
|
9054
9060
|
function registerAnalyzeCommand(fanoutCommand) {
|
|
9055
9061
|
fanoutCommand.command("analyze").description("D1: Analyze harvest bundle into facts pool (deterministic)").option("--input <file>", "Path to harvest bundle JSON file (default: stdin)").option("--json", "Output JSON format (default)").option("--output <file>", "Write output to file").action(async (opts) => {
|
|
9056
9062
|
try {
|
|
9057
|
-
const
|
|
9063
|
+
const fs51 = await import("fs/promises");
|
|
9058
9064
|
let content;
|
|
9059
9065
|
if (opts.input) {
|
|
9060
|
-
content = await
|
|
9066
|
+
content = await fs51.readFile(opts.input, "utf-8");
|
|
9061
9067
|
} else {
|
|
9062
9068
|
const chunks = [];
|
|
9063
9069
|
for await (const chunk of process.stdin) {
|
|
@@ -9099,7 +9105,7 @@ function registerAnalyzeCommand(fanoutCommand) {
|
|
|
9099
9105
|
const analysisPool = analyzeBundle(harvest);
|
|
9100
9106
|
const output = JSON.stringify(analysisPool, null, 2);
|
|
9101
9107
|
if (opts.output) {
|
|
9102
|
-
await
|
|
9108
|
+
await fs51.writeFile(opts.output, output, "utf-8");
|
|
9103
9109
|
console.error(`\u2713 Analysis pool written to ${opts.output}`);
|
|
9104
9110
|
console.error(` ${analysisPool.pool.entities.length} entities`);
|
|
9105
9111
|
console.error(` ${analysisPool.pool.relations.length} relations`);
|
|
@@ -9196,9 +9202,9 @@ var DEFAULT_FANOUT_TEMPLATES_PATHS = [
|
|
|
9196
9202
|
"fanout-templates.yml"
|
|
9197
9203
|
];
|
|
9198
9204
|
var FanoutTemplatesLoadError = class extends Error {
|
|
9199
|
-
constructor(message,
|
|
9205
|
+
constructor(message, path60, cause) {
|
|
9200
9206
|
super(message);
|
|
9201
|
-
this.path =
|
|
9207
|
+
this.path = path60;
|
|
9202
9208
|
this.cause = cause;
|
|
9203
9209
|
this.name = "FanoutTemplatesLoadError";
|
|
9204
9210
|
}
|
|
@@ -9529,7 +9535,7 @@ function registerFanoutCommands(weaveCommand) {
|
|
|
9529
9535
|
}
|
|
9530
9536
|
});
|
|
9531
9537
|
fanout.command("validate").description("Validate fanout templates file").option("-f, --file <path>", "Path to templates file").action(async (options) => {
|
|
9532
|
-
const
|
|
9538
|
+
const fs51 = await import("fs/promises");
|
|
9533
9539
|
try {
|
|
9534
9540
|
let filePath;
|
|
9535
9541
|
if (options.file) {
|
|
@@ -9542,7 +9548,7 @@ function registerFanoutCommands(weaveCommand) {
|
|
|
9542
9548
|
}
|
|
9543
9549
|
filePath = result2.path;
|
|
9544
9550
|
}
|
|
9545
|
-
const content = await
|
|
9551
|
+
const content = await fs51.readFile(filePath, "utf-8");
|
|
9546
9552
|
const result = validateFanoutTemplatesContent(content);
|
|
9547
9553
|
if (result.valid) {
|
|
9548
9554
|
console.log(`\u2713 Valid: ${filePath}`);
|
|
@@ -10523,8 +10529,8 @@ function lastCompletedMergeSha(operations) {
|
|
|
10523
10529
|
(operation) => operation.phase === "merge" && operation.status === "completed" && operation.result?.externalId
|
|
10524
10530
|
)?.result?.externalId;
|
|
10525
10531
|
}
|
|
10526
|
-
function isRunnerStatePath(
|
|
10527
|
-
return
|
|
10532
|
+
function isRunnerStatePath(path60) {
|
|
10533
|
+
return path60 === ".lexrunner" || path60.startsWith(".lexrunner/") || path60 === "weave-lock.json" || path60.endsWith("/weave-lock.json");
|
|
10528
10534
|
}
|
|
10529
10535
|
|
|
10530
10536
|
// src/commands/weave.ts
|
|
@@ -10936,7 +10942,7 @@ async function runWeaveApply(opts, deps) {
|
|
|
10936
10942
|
if (json2) {
|
|
10937
10943
|
const output = { ...preview.summary };
|
|
10938
10944
|
if (showConstraints) {
|
|
10939
|
-
const { previewConstraints: previewConstraints2 } = await import("./constraints-
|
|
10945
|
+
const { previewConstraints: previewConstraints2 } = await import("./constraints-LE2MW5NS.js");
|
|
10940
10946
|
output.constraints = await previewConstraints2(plan);
|
|
10941
10947
|
}
|
|
10942
10948
|
console.log(canonicalJSONStringify(output));
|
|
@@ -10946,7 +10952,7 @@ async function runWeaveApply(opts, deps) {
|
|
|
10946
10952
|
\u{1F50D} Merge-Weave Dry Run
|
|
10947
10953
|
`);
|
|
10948
10954
|
if (showConstraints) {
|
|
10949
|
-
const { previewConstraints: previewConstraints2, formatConstraintPreview: formatConstraintPreview2 } = await import("./constraints-
|
|
10955
|
+
const { previewConstraints: previewConstraints2, formatConstraintPreview: formatConstraintPreview2 } = await import("./constraints-LE2MW5NS.js");
|
|
10950
10956
|
console.log(formatConstraintPreview2(await previewConstraints2(plan)));
|
|
10951
10957
|
}
|
|
10952
10958
|
console.log(`Plan: ${opts.plan}`);
|
|
@@ -11142,7 +11148,7 @@ function registerPlanDiffCommand(program2, deps) {
|
|
|
11142
11148
|
const plan2Content = fs24.readFileSync(plan2Path, "utf-8");
|
|
11143
11149
|
const plan1 = loadPlan(plan1Content);
|
|
11144
11150
|
const plan2 = loadPlan(plan2Content);
|
|
11145
|
-
const { comparePlans, formatPlanDiff } = await import("./planDiff-
|
|
11151
|
+
const { comparePlans, formatPlanDiff } = await import("./planDiff-4D3AERAW.js");
|
|
11146
11152
|
const diff = comparePlans(plan1, plan2);
|
|
11147
11153
|
if (opts.json || deps.jsonModeActive()) {
|
|
11148
11154
|
writeJsonOutput(diff);
|
|
@@ -11626,12 +11632,12 @@ ${prefix} Plan validation failed: ${error.message}`);
|
|
|
11626
11632
|
}
|
|
11627
11633
|
fs25.mkdirSync(outDir, { recursive: true });
|
|
11628
11634
|
const planPath = path16.join(outDir, "plan.json");
|
|
11629
|
-
const
|
|
11635
|
+
const snapshotPath2 = path16.join(outDir, "snapshot.md");
|
|
11630
11636
|
fs25.writeFileSync(planPath, planJSON);
|
|
11631
|
-
fs25.writeFileSync(
|
|
11637
|
+
fs25.writeFileSync(snapshotPath2, snapshot);
|
|
11632
11638
|
console.log(`\u2713 Generated plan artifacts:`);
|
|
11633
11639
|
console.log(` \u{1F4C1} ${planPath}`);
|
|
11634
|
-
console.log(` \u{1F4C1} ${
|
|
11640
|
+
console.log(` \u{1F4C1} ${snapshotPath2}`);
|
|
11635
11641
|
console.log("");
|
|
11636
11642
|
console.log(generatePlanSummary(validatedPlan));
|
|
11637
11643
|
return;
|
|
@@ -11772,7 +11778,7 @@ function registerAutopilotCommand(program2, deps) {
|
|
|
11772
11778
|
argv: process.argv.slice(2)
|
|
11773
11779
|
});
|
|
11774
11780
|
}
|
|
11775
|
-
const { AutopilotLevel0, AutopilotLevel1, AutopilotLevel2: AutopilotLevel22 } = await import("./autopilot-
|
|
11781
|
+
const { AutopilotLevel0, AutopilotLevel1, AutopilotLevel2: AutopilotLevel22 } = await import("./autopilot-JWIOXBCZ.js");
|
|
11776
11782
|
const context = {
|
|
11777
11783
|
plan,
|
|
11778
11784
|
profilePath: profile.path,
|
|
@@ -12797,7 +12803,7 @@ import * as fs28 from "fs";
|
|
|
12797
12803
|
import * as path18 from "path";
|
|
12798
12804
|
async function finalizeAuditGuard(emitter, status) {
|
|
12799
12805
|
try {
|
|
12800
|
-
const { finalizeAudit: finalizeAudit2 } = await import("./audit-
|
|
12806
|
+
const { finalizeAudit: finalizeAudit2 } = await import("./audit-HVB2HJPU.js");
|
|
12801
12807
|
await finalizeAudit2(emitter, status);
|
|
12802
12808
|
} catch (e) {
|
|
12803
12809
|
if (e instanceof Error && typeof e.message === "string" && e.message.startsWith("HIPAA:")) {
|
|
@@ -13363,8 +13369,8 @@ function registerPlanReviewCommand(program2, deps) {
|
|
|
13363
13369
|
}
|
|
13364
13370
|
const planContent = fs29.readFileSync(planFile, "utf-8");
|
|
13365
13371
|
const plan = loadPlan(planContent);
|
|
13366
|
-
const { reviewPlan } = await import("./planReview-
|
|
13367
|
-
const { savePlanVersion, getPlanHistoryPath } = await import("./planHistory-
|
|
13372
|
+
const { reviewPlan } = await import("./planReview-FV6INFLQ.js");
|
|
13373
|
+
const { savePlanVersion, getPlanHistoryPath } = await import("./planHistory-VPV4WDPW.js");
|
|
13368
13374
|
const result = await reviewPlan({
|
|
13369
13375
|
plan,
|
|
13370
13376
|
interactive: !opts.nonInteractive,
|
|
@@ -14064,7 +14070,7 @@ async function predictConflicts(options) {
|
|
|
14064
14070
|
const pr2Head = prHeads.get(edge.to);
|
|
14065
14071
|
if (pr1Head && pr2Head) {
|
|
14066
14072
|
const key = `${edge.from}-${edge.to}`;
|
|
14067
|
-
const result = await import("./mergeTreeSimulator-
|
|
14073
|
+
const result = await import("./mergeTreeSimulator-GWZ77NF2.js").then(
|
|
14068
14074
|
(m) => m.simulateMerge(baseBranch, pr1Head, pr2Head, workingDir)
|
|
14069
14075
|
);
|
|
14070
14076
|
mergeTreeSimulation[key] = result;
|
|
@@ -14140,7 +14146,7 @@ function generateRecommendations(misBatches, mergeTreeSimulation) {
|
|
|
14140
14146
|
|
|
14141
14147
|
// src/orchestration/agentAssigner.ts
|
|
14142
14148
|
function sleep(ms) {
|
|
14143
|
-
return new Promise((
|
|
14149
|
+
return new Promise((resolve16) => setTimeout(resolve16, ms));
|
|
14144
14150
|
}
|
|
14145
14151
|
async function assignAgentWithRetry(issueNumber, repo, assignFn, maxRetries = 4) {
|
|
14146
14152
|
let retries = 0;
|
|
@@ -14759,8 +14765,8 @@ function registerGenerateDeliverablesCommand(program2) {
|
|
|
14759
14765
|
console.log(`\u2705 Created: ${path23.join(outputDir, "GATE5_cleanup.md")}`);
|
|
14760
14766
|
console.log(`\u2705 Created: ${path23.join(outputDir, "SUMMARY.md")}`);
|
|
14761
14767
|
console.log("");
|
|
14762
|
-
const
|
|
14763
|
-
const planHashContent =
|
|
14768
|
+
const fs51 = await import("fs");
|
|
14769
|
+
const planHashContent = fs51.readFileSync(path23.join(outputDir, "plan-hash.txt"), "utf-8");
|
|
14764
14770
|
const planHashMatch = planHashContent.match(/SHA256: ([a-f0-9]+)/);
|
|
14765
14771
|
if (planHashMatch) {
|
|
14766
14772
|
console.log(`Plan hash: ${planHashMatch[1]}`);
|
|
@@ -15551,7 +15557,7 @@ function formatMonitor(monitor) {
|
|
|
15551
15557
|
async function runCheck(opts) {
|
|
15552
15558
|
let githubAPI = await createGitHubAPI();
|
|
15553
15559
|
if (opts.owner && opts.repo) {
|
|
15554
|
-
const { GitHubAPI: GitHubAPI2 } = await import("./api-
|
|
15560
|
+
const { GitHubAPI: GitHubAPI2 } = await import("./api-UIWVFU7M.js");
|
|
15555
15561
|
githubAPI = new GitHubAPI2({
|
|
15556
15562
|
owner: opts.owner,
|
|
15557
15563
|
repo: opts.repo,
|
|
@@ -16762,9 +16768,9 @@ async function promptInteractive(defaults) {
|
|
|
16762
16768
|
output: process.stdout
|
|
16763
16769
|
});
|
|
16764
16770
|
const question = (prompt) => {
|
|
16765
|
-
return new Promise((
|
|
16771
|
+
return new Promise((resolve16) => {
|
|
16766
16772
|
rl.question(prompt, (answer) => {
|
|
16767
|
-
|
|
16773
|
+
resolve16(answer.trim());
|
|
16768
16774
|
});
|
|
16769
16775
|
});
|
|
16770
16776
|
};
|
|
@@ -18621,8 +18627,8 @@ Total: ${entries.length} counter-examples (${entries.filter((e) => e.shouldLearn
|
|
|
18621
18627
|
counterExamples.command("export").description("Export counter-examples for analysis").option("--format <format>", "Export format (json|csv)", "json").option("--base-dir <dir>", "Base directory for lexrunner", process.cwd()).option("--output <file>", "Output file (prints to stdout if not specified)").action(async (options) => {
|
|
18622
18628
|
const output = exportCounterExamples(options.format, options.baseDir);
|
|
18623
18629
|
if (options.output) {
|
|
18624
|
-
const
|
|
18625
|
-
|
|
18630
|
+
const fs51 = await import("fs");
|
|
18631
|
+
fs51.writeFileSync(options.output, output, "utf-8");
|
|
18626
18632
|
console.log(chalk9.green(`\u2713 Exported counter-examples to ${options.output}`));
|
|
18627
18633
|
} else {
|
|
18628
18634
|
console.log(output);
|
|
@@ -19202,7 +19208,7 @@ function nativePathsOverlap(runtimePlatform, left, right, comparison) {
|
|
|
19202
19208
|
if (api.parse(normalizedLeft).root !== api.parse(normalizedRight).root) return false;
|
|
19203
19209
|
const relativeLeft = api.relative(normalizedLeft, normalizedRight);
|
|
19204
19210
|
const relativeRight = api.relative(normalizedRight, normalizedLeft);
|
|
19205
|
-
const isDescendant = (
|
|
19211
|
+
const isDescendant = (relative5) => relative5.length > 0 && relative5 !== ".." && !relative5.startsWith(`..${api.sep}`);
|
|
19206
19212
|
return isDescendant(relativeLeft) || isDescendant(relativeRight);
|
|
19207
19213
|
}
|
|
19208
19214
|
function digestBinding(runtime) {
|
|
@@ -20547,8 +20553,8 @@ function parseGitStatusPorcelainV1Z(input) {
|
|
|
20547
20553
|
}
|
|
20548
20554
|
const indexStatus = field[0];
|
|
20549
20555
|
const worktreeStatus = field[1];
|
|
20550
|
-
const
|
|
20551
|
-
if (
|
|
20556
|
+
const path60 = field.slice(3);
|
|
20557
|
+
if (path60.length === 0) {
|
|
20552
20558
|
throw new Error("Malformed git status porcelain: path is empty");
|
|
20553
20559
|
}
|
|
20554
20560
|
const renameOrCopy = [indexStatus, worktreeStatus].find(
|
|
@@ -20566,7 +20572,7 @@ function parseGitStatusPorcelainV1Z(input) {
|
|
|
20566
20572
|
records.push({
|
|
20567
20573
|
indexStatus,
|
|
20568
20574
|
worktreeStatus,
|
|
20569
|
-
path:
|
|
20575
|
+
path: path60,
|
|
20570
20576
|
...originalPath === void 0 ? {} : { originalPath },
|
|
20571
20577
|
kind
|
|
20572
20578
|
});
|
|
@@ -21018,8 +21024,8 @@ function copyIssues(result, context) {
|
|
|
21018
21024
|
context.addIssue({ code: "custom", path: issue.path, message: issue.message });
|
|
21019
21025
|
}
|
|
21020
21026
|
}
|
|
21021
|
-
function addIssue(context,
|
|
21022
|
-
context.addIssue({ code: "custom", path:
|
|
21027
|
+
function addIssue(context, path60, message) {
|
|
21028
|
+
context.addIssue({ code: "custom", path: path60, message });
|
|
21023
21029
|
}
|
|
21024
21030
|
|
|
21025
21031
|
// src/workspaces/linux-workspace-boundary.ts
|
|
@@ -22060,8 +22066,8 @@ var NodeGitWorktreeBroker = class {
|
|
|
22060
22066
|
"The worktree root was replaced after broker initialization"
|
|
22061
22067
|
);
|
|
22062
22068
|
}
|
|
22063
|
-
const
|
|
22064
|
-
const components =
|
|
22069
|
+
const relative5 = path34.relative(this.worktreeRoot, path34.resolve(target.worktreePath));
|
|
22070
|
+
const components = relative5.split(path34.sep);
|
|
22065
22071
|
const targetName = components.pop();
|
|
22066
22072
|
if (!targetName) {
|
|
22067
22073
|
throw new DirectoryBoundaryError("invalid_path", "The worktree target has no basename");
|
|
@@ -22265,8 +22271,8 @@ var NodeGitWorktreeBroker = class {
|
|
|
22265
22271
|
);
|
|
22266
22272
|
}
|
|
22267
22273
|
const normalized = path34.resolve(gitDirectoryPath);
|
|
22268
|
-
const
|
|
22269
|
-
if (!
|
|
22274
|
+
const relative5 = path34.relative(this.repositoryGitIdentity.path, normalized);
|
|
22275
|
+
if (!relative5 || relative5 === ".." || relative5.startsWith(`..${path34.sep}`)) {
|
|
22270
22276
|
return this.failure(
|
|
22271
22277
|
operation,
|
|
22272
22278
|
"containment_violation",
|
|
@@ -22275,7 +22281,7 @@ var NodeGitWorktreeBroker = class {
|
|
|
22275
22281
|
}
|
|
22276
22282
|
let current = null;
|
|
22277
22283
|
try {
|
|
22278
|
-
for (const component of
|
|
22284
|
+
for (const component of relative5.split(path34.sep)) {
|
|
22279
22285
|
const child = await boundary.lease.openChild(
|
|
22280
22286
|
current ?? boundary.repositoryGit,
|
|
22281
22287
|
component,
|
|
@@ -22329,8 +22335,8 @@ var NodeGitWorktreeBroker = class {
|
|
|
22329
22335
|
const normalizedRoot = path34.resolve(root);
|
|
22330
22336
|
const comparedCandidate = this.pathComparison === "case-insensitive" ? normalizedCandidate.toLocaleLowerCase("en-US") : normalizedCandidate;
|
|
22331
22337
|
const comparedRoot = this.pathComparison === "case-insensitive" ? normalizedRoot.toLocaleLowerCase("en-US") : normalizedRoot;
|
|
22332
|
-
const
|
|
22333
|
-
return
|
|
22338
|
+
const relative5 = path34.relative(comparedRoot, comparedCandidate);
|
|
22339
|
+
return relative5.length > 0 && relative5 !== ".." && !relative5.startsWith(`..${path34.sep}`);
|
|
22334
22340
|
}
|
|
22335
22341
|
async git(boundary, operation, args, cwd, options, allowedNonzeroExitCodes = [], evidence) {
|
|
22336
22342
|
const result = await boundary.lease.runProcess({
|
|
@@ -22435,7 +22441,7 @@ function nativePathsOverlap2(left, right, comparison) {
|
|
|
22435
22441
|
if (normalizedLeft === normalizedRight) return true;
|
|
22436
22442
|
const relativeLeft = path34.relative(normalizedLeft, normalizedRight);
|
|
22437
22443
|
const relativeRight = path34.relative(normalizedRight, normalizedLeft);
|
|
22438
|
-
const isDescendant = (
|
|
22444
|
+
const isDescendant = (relative5) => relative5.length > 0 && relative5 !== ".." && !relative5.startsWith(`..${path34.sep}`);
|
|
22439
22445
|
return isDescendant(relativeLeft) || isDescendant(relativeRight);
|
|
22440
22446
|
}
|
|
22441
22447
|
function branchName(ref) {
|
|
@@ -24975,24 +24981,24 @@ var AcceptanceCriterion = z19.object({
|
|
|
24975
24981
|
function isMachineLocalAbsolutePath(value) {
|
|
24976
24982
|
return /(?:^|\s)\/(?!\/)[^\s]*/.test(value) || /(?:^|\s)~\/[^\s]*/.test(value) || /(?:^|\s)\\\\[^\s]*/.test(value) || /(?:^|\s)[a-z]:[\\/][^\s]*/i.test(value) || /(?:^|\s)file:/i.test(value);
|
|
24977
24983
|
}
|
|
24978
|
-
function rejectMachineLocalPaths(value, ctx,
|
|
24984
|
+
function rejectMachineLocalPaths(value, ctx, path60 = []) {
|
|
24979
24985
|
if (typeof value === "string") {
|
|
24980
24986
|
if (isMachineLocalAbsolutePath(value)) {
|
|
24981
24987
|
ctx.addIssue({
|
|
24982
24988
|
code: "custom",
|
|
24983
|
-
path:
|
|
24989
|
+
path: path60,
|
|
24984
24990
|
message: "AgentTaskPacket_v1 must not contain machine-local absolute paths"
|
|
24985
24991
|
});
|
|
24986
24992
|
}
|
|
24987
24993
|
return;
|
|
24988
24994
|
}
|
|
24989
24995
|
if (Array.isArray(value)) {
|
|
24990
|
-
value.forEach((item, index) => rejectMachineLocalPaths(item, ctx, [...
|
|
24996
|
+
value.forEach((item, index) => rejectMachineLocalPaths(item, ctx, [...path60, index]));
|
|
24991
24997
|
return;
|
|
24992
24998
|
}
|
|
24993
24999
|
if (value !== null && typeof value === "object") {
|
|
24994
25000
|
for (const [key, item] of Object.entries(value)) {
|
|
24995
|
-
rejectMachineLocalPaths(item, ctx, [...
|
|
25001
|
+
rejectMachineLocalPaths(item, ctx, [...path60, key]);
|
|
24996
25002
|
}
|
|
24997
25003
|
}
|
|
24998
25004
|
}
|
|
@@ -27166,10 +27172,10 @@ function captureBoundIdentities(input) {
|
|
|
27166
27172
|
worktree: captureDirectoryIdentity(input.worktreePath, "execution mapping worktree")
|
|
27167
27173
|
};
|
|
27168
27174
|
}
|
|
27169
|
-
function verifiedRoot(runtimeId,
|
|
27175
|
+
function verifiedRoot(runtimeId, path60, identity) {
|
|
27170
27176
|
return {
|
|
27171
27177
|
runtime_id: runtimeId,
|
|
27172
|
-
path:
|
|
27178
|
+
path: path60,
|
|
27173
27179
|
verification: "directory_identity",
|
|
27174
27180
|
directory_identity: identityClaim2(identity)
|
|
27175
27181
|
};
|
|
@@ -27288,8 +27294,8 @@ async function requireDirectoryWithin(directory, root, field) {
|
|
|
27288
27294
|
realpath(directory),
|
|
27289
27295
|
realpath(root)
|
|
27290
27296
|
]);
|
|
27291
|
-
const
|
|
27292
|
-
if (
|
|
27297
|
+
const relative5 = path36.relative(resolvedRoot, resolvedDirectory);
|
|
27298
|
+
if (relative5 === ".." || relative5.startsWith(`..${path36.sep}`) || path36.isAbsolute(relative5)) {
|
|
27293
27299
|
throw new Error(`${field} must resolve within its authorized root`);
|
|
27294
27300
|
}
|
|
27295
27301
|
}
|
|
@@ -32481,8 +32487,8 @@ async function requireDirectoryWithin2(directory, root, field) {
|
|
|
32481
32487
|
realpath2(directory),
|
|
32482
32488
|
realpath2(root)
|
|
32483
32489
|
]);
|
|
32484
|
-
const
|
|
32485
|
-
if (
|
|
32490
|
+
const relative5 = path37.relative(resolvedRoot, resolvedDirectory);
|
|
32491
|
+
if (relative5 === ".." || relative5.startsWith(`..${path37.sep}`) || path37.isAbsolute(relative5)) {
|
|
32486
32492
|
throw new Error(`${field} must resolve within the authorized worktree`);
|
|
32487
32493
|
}
|
|
32488
32494
|
}
|
|
@@ -35259,10 +35265,10 @@ var WorkerSessionDelegationBinding_v1 = z29.object({
|
|
|
35259
35265
|
function decisionReceiptMatchesOffer(receipt, offer, offerHash) {
|
|
35260
35266
|
return receipt.delegation_id === offer.delegation_id && receipt.attempt_id === offer.attempt_id && receipt.offer_hash === offerHash && receipt.worker_thread_id === offer.worker.thread_id && receipt.transcript_start_hash === offer.transcript_start_hash && Date.parse(receipt.decided_at) >= Date.parse(offer.offered_at);
|
|
35261
35267
|
}
|
|
35262
|
-
function requireTimeOrder(earlier, later,
|
|
35268
|
+
function requireTimeOrder(earlier, later, path60, context, equalAllowed = true) {
|
|
35263
35269
|
const ordered = equalAllowed ? Date.parse(earlier) <= Date.parse(later) : Date.parse(earlier) < Date.parse(later);
|
|
35264
35270
|
if (!ordered) {
|
|
35265
|
-
context.addIssue({ code: "custom", path: [
|
|
35271
|
+
context.addIssue({ code: "custom", path: [path60], message: `${path60} is out of order` });
|
|
35266
35272
|
}
|
|
35267
35273
|
}
|
|
35268
35274
|
|
|
@@ -36372,12 +36378,12 @@ function grantWithinRequirements(grant, requirements) {
|
|
|
36372
36378
|
);
|
|
36373
36379
|
return grant.authorized_model_provider === requirements.authorized_model_provider && grant.source_disclosure_allowed === requirements.source_disclosure_allowed && grant.max_duration_ms <= requirements.max_duration_ms && grant.max_output_bytes <= requirements.max_output_bytes && grant.controls.every((control) => required2.get(control.control) === control.minimum_strength) && grant.tools.length <= 1;
|
|
36374
36380
|
}
|
|
36375
|
-
function requireExactControls(controls, context,
|
|
36381
|
+
function requireExactControls(controls, context, path60) {
|
|
36376
36382
|
const actual = new Set(controls.map((control) => control.control));
|
|
36377
36383
|
if (actual.size !== GovernedControlId.options.length || GovernedControlId.options.some((control) => !actual.has(control))) {
|
|
36378
36384
|
context.addIssue({
|
|
36379
36385
|
code: "custom",
|
|
36380
|
-
path:
|
|
36386
|
+
path: path60,
|
|
36381
36387
|
message: "every governed denial control must appear exactly once"
|
|
36382
36388
|
});
|
|
36383
36389
|
}
|
|
@@ -37327,10 +37333,10 @@ function requireAbsent(value, fields, context) {
|
|
|
37327
37333
|
function addStateIssue(message, context) {
|
|
37328
37334
|
context.addIssue({ code: "custom", path: ["status"], message });
|
|
37329
37335
|
}
|
|
37330
|
-
function requireOrdered(earlier, later,
|
|
37336
|
+
function requireOrdered(earlier, later, path60, context, equalAllowed = true) {
|
|
37331
37337
|
const ordered = equalAllowed ? Date.parse(earlier) <= Date.parse(later) : Date.parse(earlier) < Date.parse(later);
|
|
37332
37338
|
if (!ordered) {
|
|
37333
|
-
context.addIssue({ code: "custom", path: [
|
|
37339
|
+
context.addIssue({ code: "custom", path: [path60], message: `${path60} is out of order` });
|
|
37334
37340
|
}
|
|
37335
37341
|
}
|
|
37336
37342
|
|
|
@@ -39050,8 +39056,8 @@ function normalizeInstant4(value) {
|
|
|
39050
39056
|
return new Date(timestamp).toISOString();
|
|
39051
39057
|
}
|
|
39052
39058
|
function assertDescendant(parent, candidate) {
|
|
39053
|
-
const
|
|
39054
|
-
if (
|
|
39059
|
+
const relative5 = path46.relative(path46.resolve(parent), path46.resolve(candidate));
|
|
39060
|
+
if (relative5.startsWith("..") || path46.isAbsolute(relative5)) {
|
|
39055
39061
|
throw new LocalProtectedEvidenceVerificationError("container_invalid");
|
|
39056
39062
|
}
|
|
39057
39063
|
}
|
|
@@ -39206,14 +39212,14 @@ var WindowsProtectedEvidenceAuthority = class {
|
|
|
39206
39212
|
this.child = null;
|
|
39207
39213
|
child?.stdin.end();
|
|
39208
39214
|
if (child && child.exitCode === null) {
|
|
39209
|
-
await new Promise((
|
|
39215
|
+
await new Promise((resolve16) => {
|
|
39210
39216
|
const timeout = setTimeout(() => {
|
|
39211
39217
|
child.kill();
|
|
39212
|
-
|
|
39218
|
+
resolve16();
|
|
39213
39219
|
}, 5e3);
|
|
39214
39220
|
child.once("close", () => {
|
|
39215
39221
|
clearTimeout(timeout);
|
|
39216
|
-
|
|
39222
|
+
resolve16();
|
|
39217
39223
|
});
|
|
39218
39224
|
});
|
|
39219
39225
|
}
|
|
@@ -39224,8 +39230,8 @@ var WindowsProtectedEvidenceAuthority = class {
|
|
|
39224
39230
|
const child = this.ensureChild();
|
|
39225
39231
|
const id = this.nextId;
|
|
39226
39232
|
this.nextId += 1;
|
|
39227
|
-
return new Promise((
|
|
39228
|
-
this.pending.set(id, { resolve:
|
|
39233
|
+
return new Promise((resolve16, reject) => {
|
|
39234
|
+
this.pending.set(id, { resolve: resolve16, reject });
|
|
39229
39235
|
child.stdin.write(`${JSON.stringify({ id, op: operation, path: target })}
|
|
39230
39236
|
`, (error) => {
|
|
39231
39237
|
if (!error) return;
|
|
@@ -39877,7 +39883,7 @@ var repositoryCorpusHeaderBody = z41.object({
|
|
|
39877
39883
|
var GovernedRepositoryCorpusHeader_v1 = repositoryCorpusHeaderBody.superRefine(
|
|
39878
39884
|
(value, context) => {
|
|
39879
39885
|
const paths = value.entries.map((entry) => entry.path);
|
|
39880
|
-
if (new Set(paths).size !== paths.length || paths.some((
|
|
39886
|
+
if (new Set(paths).size !== paths.length || paths.some((path60, index) => index > 0 && path60 <= paths[index - 1])) {
|
|
39881
39887
|
context.addIssue({
|
|
39882
39888
|
code: "custom",
|
|
39883
39889
|
path: ["entries"],
|
|
@@ -40304,7 +40310,7 @@ function sanitizedWslEnvironment() {
|
|
|
40304
40310
|
return environment;
|
|
40305
40311
|
}
|
|
40306
40312
|
function waitForExit(child, timeoutMs) {
|
|
40307
|
-
return new Promise((
|
|
40313
|
+
return new Promise((resolve16, reject) => {
|
|
40308
40314
|
const timeout = setTimeout(() => {
|
|
40309
40315
|
child.kill();
|
|
40310
40316
|
reject(new Error("WSL2 provider control request timed out"));
|
|
@@ -40315,7 +40321,7 @@ function waitForExit(child, timeoutMs) {
|
|
|
40315
40321
|
});
|
|
40316
40322
|
child.once("close", (code) => {
|
|
40317
40323
|
clearTimeout(timeout);
|
|
40318
|
-
|
|
40324
|
+
resolve16(code);
|
|
40319
40325
|
});
|
|
40320
40326
|
});
|
|
40321
40327
|
}
|
|
@@ -41430,8 +41436,8 @@ var LocalProtectedEvidenceStore = class {
|
|
|
41430
41436
|
exclusive(operation) {
|
|
41431
41437
|
const previous = this.queue;
|
|
41432
41438
|
let release;
|
|
41433
|
-
this.queue = new Promise((
|
|
41434
|
-
release =
|
|
41439
|
+
this.queue = new Promise((resolve16) => {
|
|
41440
|
+
release = resolve16;
|
|
41435
41441
|
});
|
|
41436
41442
|
return previous.then(operation).finally(release);
|
|
41437
41443
|
}
|
|
@@ -41594,8 +41600,8 @@ function sameToken(expected, candidate) {
|
|
|
41594
41600
|
return left.length === right.length && timingSafeEqual(left, right);
|
|
41595
41601
|
}
|
|
41596
41602
|
function assertDescendant2(root, candidate) {
|
|
41597
|
-
const
|
|
41598
|
-
if (!
|
|
41603
|
+
const relative5 = path50.relative(root, candidate);
|
|
41604
|
+
if (!relative5 || relative5.startsWith("..") || path50.isAbsolute(relative5)) {
|
|
41599
41605
|
throw new Error("protected evidence deletion target escaped its root");
|
|
41600
41606
|
}
|
|
41601
41607
|
}
|
|
@@ -42443,11 +42449,11 @@ async function launchDetachedSupervisor(input) {
|
|
|
42443
42449
|
env: sanitizedSupervisorEnvironment()
|
|
42444
42450
|
}
|
|
42445
42451
|
);
|
|
42446
|
-
return await new Promise((
|
|
42447
|
-
child.once("error", () =>
|
|
42452
|
+
return await new Promise((resolve16) => {
|
|
42453
|
+
child.once("error", () => resolve16(false));
|
|
42448
42454
|
child.once("spawn", () => {
|
|
42449
42455
|
child.unref();
|
|
42450
|
-
|
|
42456
|
+
resolve16(true);
|
|
42451
42457
|
});
|
|
42452
42458
|
});
|
|
42453
42459
|
} catch {
|
|
@@ -43193,10 +43199,10 @@ function commandPath(command) {
|
|
|
43193
43199
|
}
|
|
43194
43200
|
return components.join(" ");
|
|
43195
43201
|
}
|
|
43196
|
-
function aliasWarning(
|
|
43197
|
-
const policy = POLICY_BY_PATH.get(
|
|
43202
|
+
function aliasWarning(path60) {
|
|
43203
|
+
const policy = POLICY_BY_PATH.get(path60);
|
|
43198
43204
|
if (!policy) return null;
|
|
43199
|
-
return policy.disposition === "deprecated" ? `[lexrunner] deprecated alias "${
|
|
43205
|
+
return policy.disposition === "deprecated" ? `[lexrunner] deprecated alias "${path60}"; use "${policy.replacement}"; removal: ${policy.removeIn}.` : `[lexrunner] compatibility alias "${path60}"; use "${policy.replacement}"; supported through 2.x and reviewed at 3.0.0.`;
|
|
43200
43206
|
}
|
|
43201
43207
|
function emitAliasWarning(command, write = (message) => process.stderr.write(message)) {
|
|
43202
43208
|
const warning = aliasWarning(commandPath(command));
|
|
@@ -43302,8 +43308,8 @@ async function searchAttributions(query, runId) {
|
|
|
43302
43308
|
}
|
|
43303
43309
|
|
|
43304
43310
|
// src/cli.ts
|
|
43305
|
-
import * as
|
|
43306
|
-
import * as
|
|
43311
|
+
import * as fs50 from "fs";
|
|
43312
|
+
import * as path59 from "path";
|
|
43307
43313
|
|
|
43308
43314
|
// src/runs/enforcement.ts
|
|
43309
43315
|
import { z as z45 } from "zod";
|
|
@@ -44725,8 +44731,8 @@ async function executeAgentWorkPreparation(input) {
|
|
|
44725
44731
|
function passed(results, id) {
|
|
44726
44732
|
return results.some((result) => result.id === id && result.outcome === "passed");
|
|
44727
44733
|
}
|
|
44728
|
-
async function containedExistingDirectory(root,
|
|
44729
|
-
const candidate =
|
|
44734
|
+
async function containedExistingDirectory(root, relative5) {
|
|
44735
|
+
const candidate = relative5 ? path55.resolve(root, relative5) : root;
|
|
44730
44736
|
const resolved = await realpath6(candidate);
|
|
44731
44737
|
const relation = path55.relative(root, resolved);
|
|
44732
44738
|
if (relation === ".." || relation.startsWith(`..${path55.sep}`) || path55.isAbsolute(relation)) {
|
|
@@ -44809,7 +44815,7 @@ var workspaceFilesystemEntry = z49.discriminatedUnion("kind", [
|
|
|
44809
44815
|
}).strict()
|
|
44810
44816
|
]);
|
|
44811
44817
|
function requireStrictlyOrderedPaths(values, context, field) {
|
|
44812
|
-
if (values.some(({ path:
|
|
44818
|
+
if (values.some(({ path: path60 }, index) => index > 0 && path60 <= values[index - 1].path)) {
|
|
44813
44819
|
context.addIssue({
|
|
44814
44820
|
code: "custom",
|
|
44815
44821
|
path: [field],
|
|
@@ -44829,7 +44835,7 @@ var completeGitIdentity = z49.object({
|
|
|
44829
44835
|
kind: z49.enum(["absent", "present"]),
|
|
44830
44836
|
paths: z49.array(boundedRelativePath).max(4096)
|
|
44831
44837
|
}).strict().superRefine((identity, context) => {
|
|
44832
|
-
if (identity.paths.some((
|
|
44838
|
+
if (identity.paths.some((path60, index) => index > 0 && path60 <= identity.paths[index - 1]) || identity.kind === "absent" && identity.paths.length !== 0 || identity.kind === "present" && identity.paths.length === 0) {
|
|
44833
44839
|
context.addIssue({
|
|
44834
44840
|
code: "custom",
|
|
44835
44841
|
path: ["paths"],
|
|
@@ -45139,7 +45145,7 @@ var GovernedWorkspaceMutationRecoveryReceipt_v1 = z49.object({
|
|
|
45139
45145
|
});
|
|
45140
45146
|
}
|
|
45141
45147
|
if (receipt.changed_paths.some(
|
|
45142
|
-
(
|
|
45148
|
+
(path60, index) => index > 0 && path60 <= receipt.changed_paths[index - 1]
|
|
45143
45149
|
)) {
|
|
45144
45150
|
context.addIssue({
|
|
45145
45151
|
code: "custom",
|
|
@@ -45974,15 +45980,15 @@ var AttemptAwaitableSupervisor = class {
|
|
|
45974
45980
|
0,
|
|
45975
45981
|
Date.parse(record.observer_lease.expires_at) - Date.parse(this.now()) + 1
|
|
45976
45982
|
);
|
|
45977
|
-
let
|
|
45983
|
+
let resolve16;
|
|
45978
45984
|
const completion = new Promise((resolvePromise) => {
|
|
45979
|
-
|
|
45985
|
+
resolve16 = resolvePromise;
|
|
45980
45986
|
});
|
|
45981
45987
|
const timer = setTimeout(() => {
|
|
45982
45988
|
this.leaseExpiryWakeups.delete(record.awaitable_id);
|
|
45983
|
-
void this.attach(record.awaitable_id).finally(
|
|
45989
|
+
void this.attach(record.awaitable_id).finally(resolve16);
|
|
45984
45990
|
}, delayMs);
|
|
45985
|
-
this.leaseExpiryWakeups.set(record.awaitable_id, { timer, completion, resolve:
|
|
45991
|
+
this.leaseExpiryWakeups.set(record.awaitable_id, { timer, completion, resolve: resolve16 });
|
|
45986
45992
|
}
|
|
45987
45993
|
clearLeaseExpiryWakeup(awaitableId) {
|
|
45988
45994
|
const wakeup = this.leaseExpiryWakeups.get(awaitableId);
|
|
@@ -46087,14 +46093,14 @@ function normalizeRetryDelay(value, name) {
|
|
|
46087
46093
|
}
|
|
46088
46094
|
function waitForRetry(delayMs, signal) {
|
|
46089
46095
|
if (signal.aborted) return Promise.resolve(false);
|
|
46090
|
-
return new Promise((
|
|
46096
|
+
return new Promise((resolve16) => {
|
|
46091
46097
|
const timer = setTimeout(() => {
|
|
46092
46098
|
signal.removeEventListener("abort", onAbort);
|
|
46093
|
-
|
|
46099
|
+
resolve16(true);
|
|
46094
46100
|
}, delayMs);
|
|
46095
46101
|
const onAbort = () => {
|
|
46096
46102
|
clearTimeout(timer);
|
|
46097
|
-
|
|
46103
|
+
resolve16(false);
|
|
46098
46104
|
};
|
|
46099
46105
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
46100
46106
|
});
|
|
@@ -49611,8 +49617,135 @@ function normalizeInstant8(value) {
|
|
|
49611
49617
|
// src/application/plan-artifact-service.ts
|
|
49612
49618
|
import * as fs48 from "fs";
|
|
49613
49619
|
import * as path57 from "path";
|
|
49614
|
-
|
|
49615
|
-
|
|
49620
|
+
import { isDeepStrictEqual } from "util";
|
|
49621
|
+
|
|
49622
|
+
// src/application/execution-plan-artifact.ts
|
|
49623
|
+
import { createHash as createHash13 } from "crypto";
|
|
49624
|
+
import { z as z54 } from "zod";
|
|
49625
|
+
var EXECUTION_PLAN_ARTIFACT_CONTRACT = "lexrunner.execution-plan-artifact.v1";
|
|
49626
|
+
var PLAN_ARTIFACT_REFERENCE_CONTRACT = "lexrunner.plan-artifact-reference.v1";
|
|
49627
|
+
var EXECUTION_PLAN_CANONICALIZATION_PROFILE = "lexrunner.execution-plan.canonical-json.v1";
|
|
49628
|
+
var EXECUTION_PLAN_HASH_PROFILE = "lexrunner.execution-plan-artifact.sha256.v1";
|
|
49629
|
+
var EXECUTION_PLAN_HASH_DOMAIN = "lexrunner:execution-plan-artifact:v1\0";
|
|
49630
|
+
var MAX_PLAN_ARTIFACT_BYTES = 4 * 1024 * 1024;
|
|
49631
|
+
var MAX_PLAN_RETRIEVAL_REFERENCE_BYTES = 4096;
|
|
49632
|
+
var MAX_SCOPE_LABEL_BYTES = 512;
|
|
49633
|
+
var Sha256Digest = z54.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
49634
|
+
var BoundedScopeLabel = z54.string().min(1).refine((value) => Buffer.byteLength(value, "utf8") <= MAX_SCOPE_LABEL_BYTES, {
|
|
49635
|
+
message: "Scope label exceeds the transport limit"
|
|
49636
|
+
});
|
|
49637
|
+
var BoundedIdentityLabel = z54.string().min(1).refine((value) => Buffer.byteLength(value, "utf8") <= MAX_SCOPE_LABEL_BYTES, {
|
|
49638
|
+
message: "Identity label exceeds the transport limit"
|
|
49639
|
+
});
|
|
49640
|
+
var PlanArtifactScope_v1Schema = z54.object({
|
|
49641
|
+
tenant: BoundedScopeLabel,
|
|
49642
|
+
workspace: BoundedScopeLabel,
|
|
49643
|
+
repository: BoundedScopeLabel,
|
|
49644
|
+
refNamespace: BoundedScopeLabel,
|
|
49645
|
+
policy: BoundedScopeLabel
|
|
49646
|
+
}).strict();
|
|
49647
|
+
var ExecutionPlanArtifactIdentity_v1Schema = z54.object({
|
|
49648
|
+
contract: z54.literal(EXECUTION_PLAN_ARTIFACT_CONTRACT),
|
|
49649
|
+
kind: z54.literal("execution-plan"),
|
|
49650
|
+
planSchema: z54.literal("lexrunner.execution-plan"),
|
|
49651
|
+
planSchemaVersion: BoundedIdentityLabel,
|
|
49652
|
+
canonicalizationProfile: z54.literal(EXECUTION_PLAN_CANONICALIZATION_PROFILE),
|
|
49653
|
+
hashProfile: z54.literal(EXECUTION_PLAN_HASH_PROFILE),
|
|
49654
|
+
digestAlgorithm: z54.literal("sha256"),
|
|
49655
|
+
digest: Sha256Digest,
|
|
49656
|
+
canonicalByteLength: z54.number().int().nonnegative().max(MAX_PLAN_ARTIFACT_BYTES),
|
|
49657
|
+
target: BoundedIdentityLabel,
|
|
49658
|
+
summary: z54.object({
|
|
49659
|
+
itemCount: z54.number().int().nonnegative().max(256),
|
|
49660
|
+
gateCount: z54.number().int().nonnegative().max(256 * 64)
|
|
49661
|
+
}).strict()
|
|
49662
|
+
}).strict();
|
|
49663
|
+
var ExecutionPlanArtifact_v1Schema = z54.object({
|
|
49664
|
+
identity: ExecutionPlanArtifactIdentity_v1Schema,
|
|
49665
|
+
canonicalBytes: z54.string()
|
|
49666
|
+
}).strict().superRefine((artifact, context) => {
|
|
49667
|
+
const byteLength = Buffer.byteLength(artifact.canonicalBytes, "utf8");
|
|
49668
|
+
if (byteLength > MAX_PLAN_ARTIFACT_BYTES) {
|
|
49669
|
+
context.addIssue({
|
|
49670
|
+
code: "custom",
|
|
49671
|
+
path: ["canonicalBytes"],
|
|
49672
|
+
message: "Canonical plan bytes exceed the artifact limit"
|
|
49673
|
+
});
|
|
49674
|
+
}
|
|
49675
|
+
if (byteLength !== artifact.identity.canonicalByteLength) {
|
|
49676
|
+
context.addIssue({
|
|
49677
|
+
code: "custom",
|
|
49678
|
+
path: ["identity", "canonicalByteLength"],
|
|
49679
|
+
message: "Canonical plan byte length does not match the artifact identity"
|
|
49680
|
+
});
|
|
49681
|
+
}
|
|
49682
|
+
if (computeExecutionPlanArtifactDigest(artifact.canonicalBytes) !== artifact.identity.digest) {
|
|
49683
|
+
context.addIssue({
|
|
49684
|
+
code: "custom",
|
|
49685
|
+
path: ["identity", "digest"],
|
|
49686
|
+
message: "Canonical plan digest does not match the artifact identity"
|
|
49687
|
+
});
|
|
49688
|
+
}
|
|
49689
|
+
try {
|
|
49690
|
+
const plan = loadPlan(artifact.canonicalBytes);
|
|
49691
|
+
if (canonicalJSONStringify(plan) !== artifact.canonicalBytes) {
|
|
49692
|
+
context.addIssue({
|
|
49693
|
+
code: "custom",
|
|
49694
|
+
path: ["canonicalBytes"],
|
|
49695
|
+
message: "Plan bytes are not in the declared canonical form"
|
|
49696
|
+
});
|
|
49697
|
+
}
|
|
49698
|
+
const gateCount = plan.items.reduce((count, item) => count + item.gates.length, 0);
|
|
49699
|
+
if (artifact.identity.planSchemaVersion !== plan.schemaVersion || artifact.identity.target !== plan.target || artifact.identity.summary.itemCount !== plan.items.length || artifact.identity.summary.gateCount !== gateCount) {
|
|
49700
|
+
context.addIssue({
|
|
49701
|
+
code: "custom",
|
|
49702
|
+
path: ["identity"],
|
|
49703
|
+
message: "Plan semantics do not match the artifact identity"
|
|
49704
|
+
});
|
|
49705
|
+
}
|
|
49706
|
+
} catch {
|
|
49707
|
+
context.addIssue({
|
|
49708
|
+
code: "custom",
|
|
49709
|
+
path: ["canonicalBytes"],
|
|
49710
|
+
message: "Canonical bytes do not contain a valid execution plan"
|
|
49711
|
+
});
|
|
49712
|
+
}
|
|
49713
|
+
});
|
|
49714
|
+
var PlanArtifactReference_v1Schema = z54.object({
|
|
49715
|
+
contract: z54.literal(PLAN_ARTIFACT_REFERENCE_CONTRACT),
|
|
49716
|
+
artifact: ExecutionPlanArtifactIdentity_v1Schema,
|
|
49717
|
+
expectedDigest: Sha256Digest,
|
|
49718
|
+
expectedCanonicalByteLength: z54.number().int().nonnegative().max(MAX_PLAN_ARTIFACT_BYTES),
|
|
49719
|
+
retrieval: z54.object({
|
|
49720
|
+
kind: z54.enum(["file", "registered"]),
|
|
49721
|
+
reference: z54.string().min(1).refine(
|
|
49722
|
+
(value) => !value.includes("\0") && Buffer.byteLength(value, "utf8") <= MAX_PLAN_RETRIEVAL_REFERENCE_BYTES,
|
|
49723
|
+
{ message: "Retrieval reference is invalid or exceeds the transport limit" }
|
|
49724
|
+
)
|
|
49725
|
+
}).strict(),
|
|
49726
|
+
scope: PlanArtifactScope_v1Schema.optional()
|
|
49727
|
+
}).strict().superRefine((reference, context) => {
|
|
49728
|
+
if (reference.expectedDigest !== reference.artifact.digest) {
|
|
49729
|
+
context.addIssue({
|
|
49730
|
+
code: "custom",
|
|
49731
|
+
path: ["expectedDigest"],
|
|
49732
|
+
message: "Expected digest does not match the embedded artifact identity"
|
|
49733
|
+
});
|
|
49734
|
+
}
|
|
49735
|
+
if (reference.expectedCanonicalByteLength !== reference.artifact.canonicalByteLength) {
|
|
49736
|
+
context.addIssue({
|
|
49737
|
+
code: "custom",
|
|
49738
|
+
path: ["expectedCanonicalByteLength"],
|
|
49739
|
+
message: "Expected byte length does not match the embedded artifact identity"
|
|
49740
|
+
});
|
|
49741
|
+
}
|
|
49742
|
+
});
|
|
49743
|
+
function computeExecutionPlanArtifactDigest(canonicalBytes2) {
|
|
49744
|
+
const digest = createHash13("sha256").update(EXECUTION_PLAN_HASH_DOMAIN, "utf8").update(canonicalBytes2, "utf8").digest("hex");
|
|
49745
|
+
return `sha256:${digest}`;
|
|
49746
|
+
}
|
|
49747
|
+
|
|
49748
|
+
// src/application/plan-artifact-service.ts
|
|
49616
49749
|
var MAX_PLAN_ITEMS = 256;
|
|
49617
49750
|
var MAX_GATES_PER_ITEM2 = 64;
|
|
49618
49751
|
var MAX_IDENTITY_LABEL_BYTES = 512;
|
|
@@ -49624,16 +49757,41 @@ var PlanArtifactServiceError = class extends Error {
|
|
|
49624
49757
|
this.name = "PlanArtifactServiceError";
|
|
49625
49758
|
}
|
|
49626
49759
|
};
|
|
49760
|
+
var _hooks;
|
|
49627
49761
|
var PlanArtifactService = class {
|
|
49762
|
+
constructor(options = {}) {
|
|
49763
|
+
__privateAdd(this, _hooks);
|
|
49764
|
+
__privateSet(this, _hooks, options.importHooks ?? {});
|
|
49765
|
+
}
|
|
49628
49766
|
resolve(input = {}) {
|
|
49629
49767
|
const workingDir = path57.resolve(input.workingDir ?? process.cwd());
|
|
49768
|
+
const scope = parseScope(input.scope);
|
|
49769
|
+
if (input.planReference !== void 0 && input.planFile !== void 0) {
|
|
49770
|
+
throw new PlanArtifactServiceError(
|
|
49771
|
+
"PLAN_REFERENCE_INVALID",
|
|
49772
|
+
"Provide either an immutable plan reference or an explicit plan path, not both",
|
|
49773
|
+
"explicit"
|
|
49774
|
+
);
|
|
49775
|
+
}
|
|
49776
|
+
if (input.planReference !== void 0 && input.scope !== void 0) {
|
|
49777
|
+
throw new PlanArtifactServiceError(
|
|
49778
|
+
"PLAN_REFERENCE_INVALID",
|
|
49779
|
+
"A separately supplied scope cannot override an immutable plan reference",
|
|
49780
|
+
"explicit"
|
|
49781
|
+
);
|
|
49782
|
+
}
|
|
49783
|
+
if (input.planReference !== void 0) {
|
|
49784
|
+
const reference = parseReference(input.planReference);
|
|
49785
|
+
const explicitPath = resolveExplicitReference(reference.retrieval.reference, workingDir);
|
|
49786
|
+
return readArtifact(explicitPath, "explicit", __privateGet(this, _hooks), reference);
|
|
49787
|
+
}
|
|
49630
49788
|
if (input.planFile !== void 0) {
|
|
49631
49789
|
const explicitPath = resolveExplicitReference(input.planFile, workingDir);
|
|
49632
|
-
return readArtifact(explicitPath, "explicit");
|
|
49790
|
+
return readArtifact(explicitPath, "explicit", __privateGet(this, _hooks), void 0, scope);
|
|
49633
49791
|
}
|
|
49634
49792
|
const repositoryPlan = path57.join(workingDir, "plan.json");
|
|
49635
|
-
if (
|
|
49636
|
-
return readArtifact(repositoryPlan, "repository-root");
|
|
49793
|
+
if (pathEntryExists(repositoryPlan)) {
|
|
49794
|
+
return readArtifact(repositoryPlan, "repository-root", __privateGet(this, _hooks), void 0, scope);
|
|
49637
49795
|
}
|
|
49638
49796
|
let profilePlan;
|
|
49639
49797
|
try {
|
|
@@ -49641,8 +49799,8 @@ var PlanArtifactService = class {
|
|
|
49641
49799
|
profilePlan = path57.join(profile.path, "runner", "plan.json");
|
|
49642
49800
|
} catch {
|
|
49643
49801
|
}
|
|
49644
|
-
if (profilePlan &&
|
|
49645
|
-
return readArtifact(profilePlan, "profile-runner");
|
|
49802
|
+
if (profilePlan && pathEntryExists(profilePlan)) {
|
|
49803
|
+
return readArtifact(profilePlan, "profile-runner", __privateGet(this, _hooks), void 0, scope);
|
|
49646
49804
|
}
|
|
49647
49805
|
throw new PlanArtifactServiceError(
|
|
49648
49806
|
"PLAN_NOT_FOUND",
|
|
@@ -49650,46 +49808,85 @@ var PlanArtifactService = class {
|
|
|
49650
49808
|
);
|
|
49651
49809
|
}
|
|
49652
49810
|
};
|
|
49653
|
-
|
|
49654
|
-
|
|
49811
|
+
_hooks = new WeakMap();
|
|
49812
|
+
function parseReference(reference) {
|
|
49813
|
+
const parsed = PlanArtifactReference_v1Schema.safeParse(reference);
|
|
49814
|
+
if (!parsed.success) {
|
|
49655
49815
|
throw new PlanArtifactServiceError(
|
|
49656
49816
|
"PLAN_REFERENCE_INVALID",
|
|
49657
|
-
"The
|
|
49817
|
+
"The immutable plan reference does not satisfy the bounded transport contract",
|
|
49658
49818
|
"explicit"
|
|
49659
49819
|
);
|
|
49660
49820
|
}
|
|
49661
|
-
return
|
|
49821
|
+
return parsed.data;
|
|
49662
49822
|
}
|
|
49663
|
-
function
|
|
49664
|
-
|
|
49665
|
-
|
|
49666
|
-
|
|
49667
|
-
} catch {
|
|
49823
|
+
function parseScope(scope) {
|
|
49824
|
+
if (scope === void 0) return void 0;
|
|
49825
|
+
const parsed = PlanArtifactScope_v1Schema.safeParse(scope);
|
|
49826
|
+
if (!parsed.success) {
|
|
49668
49827
|
throw new PlanArtifactServiceError(
|
|
49669
|
-
"
|
|
49670
|
-
"The
|
|
49671
|
-
|
|
49828
|
+
"PLAN_REFERENCE_INVALID",
|
|
49829
|
+
"The plan scope does not satisfy the bounded transport contract",
|
|
49830
|
+
"explicit"
|
|
49672
49831
|
);
|
|
49673
49832
|
}
|
|
49674
|
-
|
|
49833
|
+
return parsed.data;
|
|
49834
|
+
}
|
|
49835
|
+
function resolveExplicitReference(reference, workingDir) {
|
|
49836
|
+
if (reference.length === 0 || reference.includes("\0") || Buffer.byteLength(reference, "utf8") > MAX_PLAN_RETRIEVAL_REFERENCE_BYTES) {
|
|
49675
49837
|
throw new PlanArtifactServiceError(
|
|
49676
|
-
"
|
|
49677
|
-
"The
|
|
49838
|
+
"PLAN_REFERENCE_INVALID",
|
|
49839
|
+
"The explicit plan reference is empty, overlong, or contains an invalid character",
|
|
49840
|
+
"explicit"
|
|
49841
|
+
);
|
|
49842
|
+
}
|
|
49843
|
+
return path57.isAbsolute(reference) ? path57.normalize(reference) : path57.resolve(workingDir, reference);
|
|
49844
|
+
}
|
|
49845
|
+
function readArtifact(filePath, source, hooks, expected, scope) {
|
|
49846
|
+
const content = readPortableRaceDetectedFile(filePath, source, hooks);
|
|
49847
|
+
const plan = loadPlan(content);
|
|
49848
|
+
assertBoundedArtifact(plan, source);
|
|
49849
|
+
const canonicalBytes2 = canonicalJSONStringify(plan);
|
|
49850
|
+
const canonicalByteLength = Buffer.byteLength(canonicalBytes2, "utf8");
|
|
49851
|
+
if (canonicalByteLength > MAX_PLAN_ARTIFACT_BYTES) {
|
|
49852
|
+
throw new PlanArtifactServiceError(
|
|
49853
|
+
"PLAN_ARTIFACT_LIMIT_EXCEEDED",
|
|
49854
|
+
"The canonical integration plan exceeds the artifact byte limit",
|
|
49678
49855
|
source
|
|
49679
49856
|
);
|
|
49680
49857
|
}
|
|
49681
|
-
|
|
49682
|
-
|
|
49683
|
-
|
|
49684
|
-
|
|
49858
|
+
const artifactIdentity = {
|
|
49859
|
+
contract: EXECUTION_PLAN_ARTIFACT_CONTRACT,
|
|
49860
|
+
kind: "execution-plan",
|
|
49861
|
+
planSchema: "lexrunner.execution-plan",
|
|
49862
|
+
planSchemaVersion: plan.schemaVersion,
|
|
49863
|
+
canonicalizationProfile: EXECUTION_PLAN_CANONICALIZATION_PROFILE,
|
|
49864
|
+
hashProfile: EXECUTION_PLAN_HASH_PROFILE,
|
|
49865
|
+
digestAlgorithm: "sha256",
|
|
49866
|
+
digest: computeExecutionPlanArtifactDigest(canonicalBytes2),
|
|
49867
|
+
canonicalByteLength,
|
|
49868
|
+
target: plan.target,
|
|
49869
|
+
summary: {
|
|
49870
|
+
itemCount: plan.items.length,
|
|
49871
|
+
gateCount: plan.items.reduce((count, item) => count + item.gates.length, 0)
|
|
49872
|
+
}
|
|
49873
|
+
};
|
|
49874
|
+
const artifact = { identity: artifactIdentity, canonicalBytes: canonicalBytes2 };
|
|
49875
|
+
if (expected && !isDeepStrictEqual(expected.artifact, artifactIdentity)) {
|
|
49685
49876
|
throw new PlanArtifactServiceError(
|
|
49686
|
-
"
|
|
49687
|
-
"The
|
|
49877
|
+
"PLAN_REFERENCE_MISMATCH",
|
|
49878
|
+
"The retrieved integration plan does not match the immutable reference",
|
|
49688
49879
|
source
|
|
49689
49880
|
);
|
|
49690
49881
|
}
|
|
49691
|
-
const
|
|
49692
|
-
|
|
49882
|
+
const reference = expected ?? parseReference({
|
|
49883
|
+
contract: PLAN_ARTIFACT_REFERENCE_CONTRACT,
|
|
49884
|
+
artifact: artifactIdentity,
|
|
49885
|
+
expectedDigest: artifactIdentity.digest,
|
|
49886
|
+
expectedCanonicalByteLength: artifactIdentity.canonicalByteLength,
|
|
49887
|
+
retrieval: { kind: "file", reference: filePath },
|
|
49888
|
+
...scope ? { scope } : {}
|
|
49889
|
+
});
|
|
49693
49890
|
return {
|
|
49694
49891
|
plan,
|
|
49695
49892
|
identity: {
|
|
@@ -49701,10 +49898,167 @@ function readArtifact(filePath, source) {
|
|
|
49701
49898
|
target: plan.target,
|
|
49702
49899
|
itemCount: plan.items.length
|
|
49703
49900
|
},
|
|
49901
|
+
artifact,
|
|
49902
|
+
reference,
|
|
49903
|
+
acquisition: {
|
|
49904
|
+
contract: "lexrunner.plan-artifact-acquisition.v1",
|
|
49905
|
+
assurance: "portable-race-detection",
|
|
49906
|
+
authority: "unverified"
|
|
49907
|
+
},
|
|
49704
49908
|
source,
|
|
49705
49909
|
filePath
|
|
49706
49910
|
};
|
|
49707
49911
|
}
|
|
49912
|
+
function readPortableRaceDetectedFile(filePath, source, hooks) {
|
|
49913
|
+
const initialPath = snapshotPath(filePath, source);
|
|
49914
|
+
hooks.afterInitialPathSnapshot?.();
|
|
49915
|
+
const noFollow = typeof fs48.constants.O_NOFOLLOW === "number" ? fs48.constants.O_NOFOLLOW : 0;
|
|
49916
|
+
let descriptor;
|
|
49917
|
+
try {
|
|
49918
|
+
descriptor = fs48.openSync(filePath, fs48.constants.O_RDONLY | noFollow);
|
|
49919
|
+
} catch (error) {
|
|
49920
|
+
throw importError(error, source);
|
|
49921
|
+
}
|
|
49922
|
+
let bytes;
|
|
49923
|
+
try {
|
|
49924
|
+
const before = fs48.fstatSync(descriptor, { bigint: true });
|
|
49925
|
+
assertOpenedIdentity(initialPath[initialPath.length - 1].stats, before, source);
|
|
49926
|
+
hooks.afterOpen?.();
|
|
49927
|
+
if (before.size > BigInt(MAX_PLAN_ARTIFACT_BYTES)) {
|
|
49928
|
+
throw new PlanArtifactServiceError(
|
|
49929
|
+
"PLAN_ARTIFACT_LIMIT_EXCEEDED",
|
|
49930
|
+
"The referenced integration plan exceeds the artifact byte limit",
|
|
49931
|
+
source
|
|
49932
|
+
);
|
|
49933
|
+
}
|
|
49934
|
+
bytes = readAtMost(descriptor, MAX_PLAN_ARTIFACT_BYTES + 1);
|
|
49935
|
+
hooks.afterRead?.();
|
|
49936
|
+
const after = fs48.fstatSync(descriptor, { bigint: true });
|
|
49937
|
+
assertStableOpenedFile(before, after, bytes.length, source);
|
|
49938
|
+
} finally {
|
|
49939
|
+
fs48.closeSync(descriptor);
|
|
49940
|
+
}
|
|
49941
|
+
hooks.beforeFinalPathSnapshot?.();
|
|
49942
|
+
const finalPath = snapshotPath(filePath, source);
|
|
49943
|
+
assertStablePath(initialPath, finalPath, source);
|
|
49944
|
+
try {
|
|
49945
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
49946
|
+
} catch {
|
|
49947
|
+
throw new PlanArtifactServiceError(
|
|
49948
|
+
"PLAN_UNREADABLE",
|
|
49949
|
+
"The referenced integration plan is not valid UTF-8",
|
|
49950
|
+
source
|
|
49951
|
+
);
|
|
49952
|
+
}
|
|
49953
|
+
}
|
|
49954
|
+
function snapshotPath(filePath, source) {
|
|
49955
|
+
const absolute = path57.resolve(filePath);
|
|
49956
|
+
const root = path57.parse(absolute).root;
|
|
49957
|
+
const relative5 = path57.relative(root, absolute);
|
|
49958
|
+
const segments = relative5.length === 0 ? [] : relative5.split(path57.sep);
|
|
49959
|
+
const candidates = [root];
|
|
49960
|
+
let current = root;
|
|
49961
|
+
for (const segment of segments) {
|
|
49962
|
+
current = path57.join(current, segment);
|
|
49963
|
+
candidates.push(current);
|
|
49964
|
+
}
|
|
49965
|
+
return candidates.map((candidate, index) => {
|
|
49966
|
+
let stats;
|
|
49967
|
+
try {
|
|
49968
|
+
stats = fs48.lstatSync(candidate, { bigint: true });
|
|
49969
|
+
} catch (error) {
|
|
49970
|
+
throw importError(error, source);
|
|
49971
|
+
}
|
|
49972
|
+
const leaf = index === candidates.length - 1;
|
|
49973
|
+
if (stats.isSymbolicLink()) {
|
|
49974
|
+
throw new PlanArtifactServiceError(
|
|
49975
|
+
"PLAN_FILESYSTEM_UNSAFE",
|
|
49976
|
+
"The integration plan path contains an unsafe filesystem object",
|
|
49977
|
+
source
|
|
49978
|
+
);
|
|
49979
|
+
}
|
|
49980
|
+
if (leaf ? !stats.isFile() : !stats.isDirectory()) {
|
|
49981
|
+
throw new PlanArtifactServiceError(
|
|
49982
|
+
"PLAN_UNREADABLE",
|
|
49983
|
+
"The referenced integration plan is not a readable bounded file",
|
|
49984
|
+
source
|
|
49985
|
+
);
|
|
49986
|
+
}
|
|
49987
|
+
if (leaf && stats.nlink !== 1n) {
|
|
49988
|
+
throw new PlanArtifactServiceError(
|
|
49989
|
+
"PLAN_FILESYSTEM_UNSAFE",
|
|
49990
|
+
"The integration plan file has an ambiguous filesystem identity",
|
|
49991
|
+
source
|
|
49992
|
+
);
|
|
49993
|
+
}
|
|
49994
|
+
return { stats, leaf };
|
|
49995
|
+
});
|
|
49996
|
+
}
|
|
49997
|
+
function assertOpenedIdentity(pathStats, openedStats, source) {
|
|
49998
|
+
if (!openedStats.isFile() || openedStats.nlink !== 1n || !sameObject(pathStats, openedStats) || pathStats.size !== openedStats.size || pathStats.mtimeNs !== openedStats.mtimeNs || pathStats.ctimeNs !== openedStats.ctimeNs) {
|
|
49999
|
+
throw new PlanArtifactServiceError(
|
|
50000
|
+
"PLAN_FILESYSTEM_UNSAFE",
|
|
50001
|
+
"The integration plan filesystem identity changed during acquisition",
|
|
50002
|
+
source
|
|
50003
|
+
);
|
|
50004
|
+
}
|
|
50005
|
+
}
|
|
50006
|
+
function assertStableOpenedFile(before, after, bytesRead, source) {
|
|
50007
|
+
if (bytesRead > MAX_PLAN_ARTIFACT_BYTES) {
|
|
50008
|
+
throw new PlanArtifactServiceError(
|
|
50009
|
+
"PLAN_ARTIFACT_LIMIT_EXCEEDED",
|
|
50010
|
+
"The referenced integration plan exceeds the artifact byte limit",
|
|
50011
|
+
source
|
|
50012
|
+
);
|
|
50013
|
+
}
|
|
50014
|
+
if (!after.isFile() || after.nlink !== 1n || !sameObject(before, after) || before.size !== after.size || before.mtimeNs !== after.mtimeNs || before.ctimeNs !== after.ctimeNs || BigInt(bytesRead) !== before.size) {
|
|
50015
|
+
throw new PlanArtifactServiceError(
|
|
50016
|
+
"PLAN_FILESYSTEM_UNSAFE",
|
|
50017
|
+
"The integration plan changed while its bytes were being acquired",
|
|
50018
|
+
source
|
|
50019
|
+
);
|
|
50020
|
+
}
|
|
50021
|
+
}
|
|
50022
|
+
function assertStablePath(before, after, source) {
|
|
50023
|
+
if (before.length !== after.length || before.some((entry, index) => {
|
|
50024
|
+
const current = after[index];
|
|
50025
|
+
return !current || entry.leaf !== current.leaf || !sameObject(entry.stats, current.stats) || entry.leaf && (entry.stats.size !== current.stats.size || entry.stats.mtimeNs !== current.stats.mtimeNs || entry.stats.ctimeNs !== current.stats.ctimeNs || current.stats.nlink !== 1n);
|
|
50026
|
+
})) {
|
|
50027
|
+
throw new PlanArtifactServiceError(
|
|
50028
|
+
"PLAN_FILESYSTEM_UNSAFE",
|
|
50029
|
+
"The integration plan path changed while its bytes were being acquired",
|
|
50030
|
+
source
|
|
50031
|
+
);
|
|
50032
|
+
}
|
|
50033
|
+
}
|
|
50034
|
+
function sameObject(left, right) {
|
|
50035
|
+
return left.dev === right.dev && left.ino === right.ino && left.mode === right.mode;
|
|
50036
|
+
}
|
|
50037
|
+
function readAtMost(descriptor, maximumBytes) {
|
|
50038
|
+
const buffer = Buffer.allocUnsafe(maximumBytes);
|
|
50039
|
+
let offset = 0;
|
|
50040
|
+
while (offset < maximumBytes) {
|
|
50041
|
+
const count = fs48.readSync(descriptor, buffer, offset, maximumBytes - offset, null);
|
|
50042
|
+
if (count === 0) break;
|
|
50043
|
+
offset += count;
|
|
50044
|
+
}
|
|
50045
|
+
return buffer.subarray(0, offset);
|
|
50046
|
+
}
|
|
50047
|
+
function importError(error, source) {
|
|
50048
|
+
const code = error?.code;
|
|
50049
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
50050
|
+
return new PlanArtifactServiceError(
|
|
50051
|
+
"PLAN_NOT_FOUND",
|
|
50052
|
+
"The referenced integration plan does not exist",
|
|
50053
|
+
source
|
|
50054
|
+
);
|
|
50055
|
+
}
|
|
50056
|
+
return new PlanArtifactServiceError(
|
|
50057
|
+
"PLAN_UNREADABLE",
|
|
50058
|
+
"The referenced integration plan could not be safely read",
|
|
50059
|
+
source
|
|
50060
|
+
);
|
|
50061
|
+
}
|
|
49708
50062
|
function assertBoundedArtifact(plan, source) {
|
|
49709
50063
|
const labels = [
|
|
49710
50064
|
plan.schemaVersion,
|
|
@@ -49719,11 +50073,277 @@ function assertBoundedArtifact(plan, source) {
|
|
|
49719
50073
|
);
|
|
49720
50074
|
}
|
|
49721
50075
|
}
|
|
49722
|
-
function
|
|
50076
|
+
function pathEntryExists(filePath) {
|
|
49723
50077
|
try {
|
|
49724
|
-
|
|
49725
|
-
|
|
49726
|
-
|
|
50078
|
+
fs48.lstatSync(filePath);
|
|
50079
|
+
return true;
|
|
50080
|
+
} catch (error) {
|
|
50081
|
+
const code = error?.code;
|
|
50082
|
+
if (code === "ENOENT" || code === "ENOTDIR") return false;
|
|
50083
|
+
return true;
|
|
50084
|
+
}
|
|
50085
|
+
}
|
|
50086
|
+
|
|
50087
|
+
// src/application/plan-artifact-registration-service.ts
|
|
50088
|
+
import * as fs49 from "fs";
|
|
50089
|
+
import * as path58 from "path";
|
|
50090
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
50091
|
+
var PlanArtifactRegistrationError = class extends Error {
|
|
50092
|
+
constructor(code, message) {
|
|
50093
|
+
super(message);
|
|
50094
|
+
this.code = code;
|
|
50095
|
+
this.name = "PlanArtifactRegistrationError";
|
|
50096
|
+
}
|
|
50097
|
+
};
|
|
50098
|
+
var _PlanArtifactRegistrationService_instances, verifyExisting_fn;
|
|
50099
|
+
var PlanArtifactRegistrationService = class {
|
|
50100
|
+
constructor() {
|
|
50101
|
+
__privateAdd(this, _PlanArtifactRegistrationService_instances);
|
|
50102
|
+
}
|
|
50103
|
+
register(input) {
|
|
50104
|
+
const parsed = ExecutionPlanArtifact_v1Schema.safeParse(input.artifact);
|
|
50105
|
+
if (!parsed.success) {
|
|
50106
|
+
throw new PlanArtifactRegistrationError(
|
|
50107
|
+
"PLAN_REGISTRATION_INVALID",
|
|
50108
|
+
"The plan artifact does not satisfy the immutable artifact contract"
|
|
50109
|
+
);
|
|
50110
|
+
}
|
|
50111
|
+
const artifact = parsed.data;
|
|
50112
|
+
const scope = parseScope2(input.scope);
|
|
50113
|
+
const storeDirectory = validateStoreReference(input.storeDirectory);
|
|
50114
|
+
prepareControlledStore(storeDirectory);
|
|
50115
|
+
const digestName = `${artifact.identity.digest.slice("sha256:".length)}.json`;
|
|
50116
|
+
const artifactPath = path58.join(storeDirectory, digestName);
|
|
50117
|
+
const reference = createRegisteredReference(artifact, artifactPath, scope);
|
|
50118
|
+
if (pathEntryExists2(artifactPath)) {
|
|
50119
|
+
return __privateMethod(this, _PlanArtifactRegistrationService_instances, verifyExisting_fn).call(this, artifact, reference, false);
|
|
50120
|
+
}
|
|
50121
|
+
const temporaryPath = path58.join(storeDirectory, `.plan-${randomUUID9()}.tmp`);
|
|
50122
|
+
let temporaryCreated = false;
|
|
50123
|
+
try {
|
|
50124
|
+
const descriptor = fs49.openSync(
|
|
50125
|
+
temporaryPath,
|
|
50126
|
+
fs49.constants.O_WRONLY | fs49.constants.O_CREAT | fs49.constants.O_EXCL,
|
|
50127
|
+
384
|
|
50128
|
+
);
|
|
50129
|
+
temporaryCreated = true;
|
|
50130
|
+
try {
|
|
50131
|
+
writeAll(descriptor, Buffer.from(artifact.canonicalBytes, "utf8"));
|
|
50132
|
+
fs49.fsyncSync(descriptor);
|
|
50133
|
+
} finally {
|
|
50134
|
+
fs49.closeSync(descriptor);
|
|
50135
|
+
}
|
|
50136
|
+
try {
|
|
50137
|
+
fs49.linkSync(temporaryPath, artifactPath);
|
|
50138
|
+
} catch (error) {
|
|
50139
|
+
if (!pathEntryExists2(artifactPath)) throw error;
|
|
50140
|
+
return __privateMethod(this, _PlanArtifactRegistrationService_instances, verifyExisting_fn).call(this, artifact, reference, false);
|
|
50141
|
+
}
|
|
50142
|
+
try {
|
|
50143
|
+
fs49.unlinkSync(temporaryPath);
|
|
50144
|
+
} catch (error) {
|
|
50145
|
+
if (error.code !== "ENOENT") throw error;
|
|
50146
|
+
}
|
|
50147
|
+
temporaryCreated = false;
|
|
50148
|
+
flushDirectoryWhenSupported(storeDirectory);
|
|
50149
|
+
assertStoreDirectory(storeDirectory);
|
|
50150
|
+
return __privateMethod(this, _PlanArtifactRegistrationService_instances, verifyExisting_fn).call(this, artifact, reference, true);
|
|
50151
|
+
} catch (error) {
|
|
50152
|
+
if (error instanceof PlanArtifactRegistrationError) throw error;
|
|
50153
|
+
throw new PlanArtifactRegistrationError(
|
|
50154
|
+
"PLAN_REGISTRATION_UNSAFE",
|
|
50155
|
+
"The plan artifact could not be published without replacing existing bytes"
|
|
50156
|
+
);
|
|
50157
|
+
} finally {
|
|
50158
|
+
if (temporaryCreated) {
|
|
50159
|
+
try {
|
|
50160
|
+
fs49.unlinkSync(temporaryPath);
|
|
50161
|
+
} catch {
|
|
50162
|
+
}
|
|
50163
|
+
}
|
|
50164
|
+
}
|
|
50165
|
+
}
|
|
50166
|
+
};
|
|
50167
|
+
_PlanArtifactRegistrationService_instances = new WeakSet();
|
|
50168
|
+
verifyExisting_fn = function(artifact, reference, created) {
|
|
50169
|
+
try {
|
|
50170
|
+
waitForConcurrentPublisher(reference.retrieval.reference);
|
|
50171
|
+
const resolved = new PlanArtifactService().resolve({ planReference: reference });
|
|
50172
|
+
if (resolved.artifact.canonicalBytes !== artifact.canonicalBytes) {
|
|
50173
|
+
throw new PlanArtifactRegistrationError(
|
|
50174
|
+
"PLAN_REGISTRATION_CONFLICT",
|
|
50175
|
+
"The content-addressed plan object conflicts with the requested artifact"
|
|
50176
|
+
);
|
|
50177
|
+
}
|
|
50178
|
+
return {
|
|
50179
|
+
artifact: resolved.artifact,
|
|
50180
|
+
reference,
|
|
50181
|
+
created,
|
|
50182
|
+
storage: { assurance: "service-no-replace-verified", authority: "unverified" }
|
|
50183
|
+
};
|
|
50184
|
+
} catch (error) {
|
|
50185
|
+
if (error instanceof PlanArtifactRegistrationError) throw error;
|
|
50186
|
+
if (error instanceof PlanArtifactServiceError && error.code === "PLAN_REFERENCE_MISMATCH") {
|
|
50187
|
+
throw new PlanArtifactRegistrationError(
|
|
50188
|
+
"PLAN_REGISTRATION_CONFLICT",
|
|
50189
|
+
"The content-addressed plan object conflicts with the requested artifact"
|
|
50190
|
+
);
|
|
50191
|
+
}
|
|
50192
|
+
throw new PlanArtifactRegistrationError(
|
|
50193
|
+
"PLAN_REGISTRATION_VERIFY_FAILED",
|
|
50194
|
+
"The persisted plan artifact could not be reread and verified"
|
|
50195
|
+
);
|
|
50196
|
+
}
|
|
50197
|
+
};
|
|
50198
|
+
function createRegisteredReference(artifact, artifactPath, scope) {
|
|
50199
|
+
if (Buffer.byteLength(artifactPath, "utf8") > 4096) {
|
|
50200
|
+
throw new PlanArtifactRegistrationError(
|
|
50201
|
+
"PLAN_REGISTRATION_INVALID",
|
|
50202
|
+
"The artifact store cannot produce a bounded retrieval reference"
|
|
50203
|
+
);
|
|
50204
|
+
}
|
|
50205
|
+
const reference = {
|
|
50206
|
+
contract: PLAN_ARTIFACT_REFERENCE_CONTRACT,
|
|
50207
|
+
artifact: artifact.identity,
|
|
50208
|
+
expectedDigest: artifact.identity.digest,
|
|
50209
|
+
expectedCanonicalByteLength: artifact.identity.canonicalByteLength,
|
|
50210
|
+
retrieval: { kind: "registered", reference: artifactPath },
|
|
50211
|
+
...scope ? { scope } : {}
|
|
50212
|
+
};
|
|
50213
|
+
const parsed = PlanArtifactReference_v1Schema.safeParse(reference);
|
|
50214
|
+
if (!parsed.success) {
|
|
50215
|
+
throw new PlanArtifactRegistrationError(
|
|
50216
|
+
"PLAN_REGISTRATION_INVALID",
|
|
50217
|
+
"The registered artifact reference does not satisfy the bounded transport contract"
|
|
50218
|
+
);
|
|
50219
|
+
}
|
|
50220
|
+
return parsed.data;
|
|
50221
|
+
}
|
|
50222
|
+
function parseScope2(scope) {
|
|
50223
|
+
if (scope === void 0) return void 0;
|
|
50224
|
+
const parsed = PlanArtifactScope_v1Schema.safeParse(scope);
|
|
50225
|
+
if (!parsed.success) {
|
|
50226
|
+
throw new PlanArtifactRegistrationError(
|
|
50227
|
+
"PLAN_REGISTRATION_INVALID",
|
|
50228
|
+
"The plan scope does not satisfy the bounded transport contract"
|
|
50229
|
+
);
|
|
50230
|
+
}
|
|
50231
|
+
return parsed.data;
|
|
50232
|
+
}
|
|
50233
|
+
function validateStoreReference(reference) {
|
|
50234
|
+
if (reference.length === 0 || reference.includes("\0") || Buffer.byteLength(reference, "utf8") > 4096) {
|
|
50235
|
+
throw new PlanArtifactRegistrationError(
|
|
50236
|
+
"PLAN_REGISTRATION_INVALID",
|
|
50237
|
+
"The artifact store reference is invalid or exceeds its bound"
|
|
50238
|
+
);
|
|
50239
|
+
}
|
|
50240
|
+
return path58.resolve(reference);
|
|
50241
|
+
}
|
|
50242
|
+
function prepareControlledStore(storeDirectory) {
|
|
50243
|
+
const root = path58.parse(storeDirectory).root;
|
|
50244
|
+
const segments = path58.relative(root, storeDirectory).split(path58.sep).filter(Boolean);
|
|
50245
|
+
let current = root;
|
|
50246
|
+
for (const segment of segments) {
|
|
50247
|
+
current = path58.join(current, segment);
|
|
50248
|
+
try {
|
|
50249
|
+
const stats = fs49.lstatSync(current);
|
|
50250
|
+
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
50251
|
+
throw new PlanArtifactRegistrationError(
|
|
50252
|
+
"PLAN_REGISTRATION_UNSAFE",
|
|
50253
|
+
"The artifact store contains an unsafe filesystem object"
|
|
50254
|
+
);
|
|
50255
|
+
}
|
|
50256
|
+
} catch (error) {
|
|
50257
|
+
if (error instanceof PlanArtifactRegistrationError) throw error;
|
|
50258
|
+
if (error.code !== "ENOENT") {
|
|
50259
|
+
throw new PlanArtifactRegistrationError(
|
|
50260
|
+
"PLAN_REGISTRATION_UNSAFE",
|
|
50261
|
+
"The artifact store identity is unavailable"
|
|
50262
|
+
);
|
|
50263
|
+
}
|
|
50264
|
+
try {
|
|
50265
|
+
fs49.mkdirSync(current, { mode: 448 });
|
|
50266
|
+
} catch (mkdirError) {
|
|
50267
|
+
if (mkdirError.code !== "EEXIST") {
|
|
50268
|
+
throw new PlanArtifactRegistrationError(
|
|
50269
|
+
"PLAN_REGISTRATION_UNSAFE",
|
|
50270
|
+
"The artifact store could not be prepared"
|
|
50271
|
+
);
|
|
50272
|
+
}
|
|
50273
|
+
}
|
|
50274
|
+
const created = fs49.lstatSync(current);
|
|
50275
|
+
if (created.isSymbolicLink() || !created.isDirectory()) {
|
|
50276
|
+
throw new PlanArtifactRegistrationError(
|
|
50277
|
+
"PLAN_REGISTRATION_UNSAFE",
|
|
50278
|
+
"The artifact store contains an unsafe filesystem object"
|
|
50279
|
+
);
|
|
50280
|
+
}
|
|
50281
|
+
}
|
|
50282
|
+
}
|
|
50283
|
+
assertStoreDirectory(storeDirectory);
|
|
50284
|
+
}
|
|
50285
|
+
function assertStoreDirectory(storeDirectory) {
|
|
50286
|
+
const root = path58.parse(storeDirectory).root;
|
|
50287
|
+
const segments = path58.relative(root, storeDirectory).split(path58.sep).filter(Boolean);
|
|
50288
|
+
let current = root;
|
|
50289
|
+
for (const segment of segments) {
|
|
50290
|
+
current = path58.join(current, segment);
|
|
50291
|
+
let stats;
|
|
50292
|
+
try {
|
|
50293
|
+
stats = fs49.lstatSync(current);
|
|
50294
|
+
} catch {
|
|
50295
|
+
throw new PlanArtifactRegistrationError(
|
|
50296
|
+
"PLAN_REGISTRATION_UNSAFE",
|
|
50297
|
+
"The artifact store identity is unavailable"
|
|
50298
|
+
);
|
|
50299
|
+
}
|
|
50300
|
+
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
50301
|
+
throw new PlanArtifactRegistrationError(
|
|
50302
|
+
"PLAN_REGISTRATION_UNSAFE",
|
|
50303
|
+
"The artifact store contains an unsafe filesystem object"
|
|
50304
|
+
);
|
|
50305
|
+
}
|
|
50306
|
+
}
|
|
50307
|
+
}
|
|
50308
|
+
function writeAll(descriptor, bytes) {
|
|
50309
|
+
let offset = 0;
|
|
50310
|
+
while (offset < bytes.length) {
|
|
50311
|
+
offset += fs49.writeSync(descriptor, bytes, offset, bytes.length - offset, null);
|
|
50312
|
+
}
|
|
50313
|
+
}
|
|
50314
|
+
function flushDirectoryWhenSupported(directory) {
|
|
50315
|
+
let descriptor;
|
|
50316
|
+
try {
|
|
50317
|
+
descriptor = fs49.openSync(directory, fs49.constants.O_RDONLY);
|
|
50318
|
+
fs49.fsyncSync(descriptor);
|
|
50319
|
+
} catch (error) {
|
|
50320
|
+
const code = error?.code;
|
|
50321
|
+
if (process.platform !== "win32" || code !== "EISDIR" && code !== "EPERM") throw error;
|
|
50322
|
+
} finally {
|
|
50323
|
+
if (descriptor !== void 0) fs49.closeSync(descriptor);
|
|
50324
|
+
}
|
|
50325
|
+
}
|
|
50326
|
+
function pathEntryExists2(filePath) {
|
|
50327
|
+
try {
|
|
50328
|
+
fs49.lstatSync(filePath);
|
|
50329
|
+
return true;
|
|
50330
|
+
} catch (error) {
|
|
50331
|
+
const code = error?.code;
|
|
50332
|
+
return code !== "ENOENT" && code !== "ENOTDIR";
|
|
50333
|
+
}
|
|
50334
|
+
}
|
|
50335
|
+
function waitForConcurrentPublisher(artifactPath) {
|
|
50336
|
+
const deadline = Date.now() + 500;
|
|
50337
|
+
const signal = new Int32Array(new SharedArrayBuffer(4));
|
|
50338
|
+
while (Date.now() < deadline) {
|
|
50339
|
+
let stats;
|
|
50340
|
+
try {
|
|
50341
|
+
stats = fs49.lstatSync(artifactPath);
|
|
50342
|
+
} catch {
|
|
50343
|
+
return;
|
|
50344
|
+
}
|
|
50345
|
+
if (!stats.isFile() || stats.isSymbolicLink() || stats.nlink <= 1) return;
|
|
50346
|
+
Atomics.wait(signal, 0, 0, 10);
|
|
49727
50347
|
}
|
|
49728
50348
|
}
|
|
49729
50349
|
|
|
@@ -50282,7 +50902,7 @@ workspaceCmd.command("init").description("Initialize lexrunner workspace with in
|
|
|
50282
50902
|
force: opts.force
|
|
50283
50903
|
});
|
|
50284
50904
|
if (isJsonMode) {
|
|
50285
|
-
const { writeSuccessEnvelope } = await import("./jsonEnvelope-
|
|
50905
|
+
const { writeSuccessEnvelope } = await import("./jsonEnvelope-MXJM5ZQH.js");
|
|
50286
50906
|
writeSuccessEnvelope("lex-pr workspace init", initialized);
|
|
50287
50907
|
} else {
|
|
50288
50908
|
console.log(
|
|
@@ -50302,7 +50922,7 @@ workspaceCmd.command("init").description("Initialize lexrunner workspace with in
|
|
|
50302
50922
|
policyTemplate: opts.policyTemplate
|
|
50303
50923
|
});
|
|
50304
50924
|
if (isJsonMode) {
|
|
50305
|
-
const { writeSuccessEnvelope, writeErrorEnvelope } = await import("./jsonEnvelope-
|
|
50925
|
+
const { writeSuccessEnvelope, writeErrorEnvelope } = await import("./jsonEnvelope-MXJM5ZQH.js");
|
|
50306
50926
|
if (result.success) {
|
|
50307
50927
|
writeSuccessEnvelope("lex-pr workspace init", {
|
|
50308
50928
|
profileDir: result.profileDir,
|
|
@@ -50330,7 +50950,7 @@ workspaceCmd.command("init").description("Initialize lexrunner workspace with in
|
|
|
50330
50950
|
throw error;
|
|
50331
50951
|
}
|
|
50332
50952
|
if (isJsonMode) {
|
|
50333
|
-
const { writeErrorEnvelope, errorToJsonError } = await import("./jsonEnvelope-
|
|
50953
|
+
const { writeErrorEnvelope, errorToJsonError } = await import("./jsonEnvelope-MXJM5ZQH.js");
|
|
50334
50954
|
if (error instanceof WorkspaceConfigServiceError) {
|
|
50335
50955
|
writeErrorEnvelope("lex-pr workspace init", {
|
|
50336
50956
|
code: error.code,
|
|
@@ -50427,7 +51047,7 @@ program.command("init").description("Initialize lexrunner workspace with interac
|
|
|
50427
51047
|
jsonMode: isJsonMode
|
|
50428
51048
|
});
|
|
50429
51049
|
if (isJsonMode) {
|
|
50430
|
-
const { writeSuccessEnvelope, writeErrorEnvelope, errorToJsonError } = await import("./jsonEnvelope-
|
|
51050
|
+
const { writeSuccessEnvelope, writeErrorEnvelope, errorToJsonError } = await import("./jsonEnvelope-MXJM5ZQH.js");
|
|
50431
51051
|
if (result.success) {
|
|
50432
51052
|
writeSuccessEnvelope("lex-pr init", {
|
|
50433
51053
|
profileDir: result.profileDir,
|
|
@@ -50455,7 +51075,7 @@ program.command("init").description("Initialize lexrunner workspace with interac
|
|
|
50455
51075
|
throw error;
|
|
50456
51076
|
}
|
|
50457
51077
|
if (isJsonMode) {
|
|
50458
|
-
const { writeErrorEnvelope, errorToJsonError } = await import("./jsonEnvelope-
|
|
51078
|
+
const { writeErrorEnvelope, errorToJsonError } = await import("./jsonEnvelope-MXJM5ZQH.js");
|
|
50459
51079
|
if (error instanceof WriteProtectionError) {
|
|
50460
51080
|
writeErrorEnvelope("lex-pr init", {
|
|
50461
51081
|
code: "EWRITE_PROTECTED",
|
|
@@ -50651,8 +51271,8 @@ program.command("view").description("Interactive plan viewer with navigation and
|
|
|
50651
51271
|
throwExit(1);
|
|
50652
51272
|
}
|
|
50653
51273
|
try {
|
|
50654
|
-
const { InteractivePlanViewer } = await import("./planViewer-
|
|
50655
|
-
const planContent =
|
|
51274
|
+
const { InteractivePlanViewer } = await import("./planViewer-WOV6A2HZ.js");
|
|
51275
|
+
const planContent = fs50.readFileSync(planFile, "utf-8");
|
|
50656
51276
|
const plan = loadPlan(planContent);
|
|
50657
51277
|
const viewer = new InteractivePlanViewer(plan, {
|
|
50658
51278
|
filter: opts.filter,
|
|
@@ -50668,7 +51288,7 @@ program.command("view").description("Interactive plan viewer with navigation and
|
|
|
50668
51288
|
program.command("deliverables:list").description("List all autopilot deliverables with metadata").option("--profile-dir <dir>", "Profile directory (default: .smartergpt)").option("--json", "Output JSON format").action(async (opts) => {
|
|
50669
51289
|
try {
|
|
50670
51290
|
const profile = resolveProfile(opts.profileDir);
|
|
50671
|
-
const { DeliverablesManager } = await import("./autopilot-
|
|
51291
|
+
const { DeliverablesManager } = await import("./autopilot-JWIOXBCZ.js");
|
|
50672
51292
|
const manager = new DeliverablesManager(profile.path);
|
|
50673
51293
|
const deliverables = await manager.listDeliverables();
|
|
50674
51294
|
if (opts.json) {
|
|
@@ -50694,7 +51314,7 @@ program.command("deliverables:list").description("List all autopilot deliverable
|
|
|
50694
51314
|
});
|
|
50695
51315
|
const latest = manager.getLatestPath();
|
|
50696
51316
|
if (latest) {
|
|
50697
|
-
console.log(`\u{1F4CD} Latest: ${
|
|
51317
|
+
console.log(`\u{1F4CD} Latest: ${path59.basename(latest)}`);
|
|
50698
51318
|
}
|
|
50699
51319
|
}
|
|
50700
51320
|
} catch (error) {
|
|
@@ -50707,7 +51327,7 @@ program.command("deliverables:list").description("List all autopilot deliverable
|
|
|
50707
51327
|
program.command("deliverables:cleanup").description("Clean up old deliverables based on retention policy").option("--profile-dir <dir>", "Profile directory (default: .smartergpt)").option("--max-age <days>", "Maximum age in days (deletes older deliverables)").option("--max-count <count>", "Maximum number of deliverables to keep").option("--keep-latest", "Always keep the latest deliverables (default: true)", true).option("--dry-run", "Preview cleanup without deleting").option("--json", "Output JSON format").action(async (opts) => {
|
|
50708
51328
|
try {
|
|
50709
51329
|
const profile = resolveProfile(opts.profileDir);
|
|
50710
|
-
const { DeliverablesManager } = await import("./autopilot-
|
|
51330
|
+
const { DeliverablesManager } = await import("./autopilot-JWIOXBCZ.js");
|
|
50711
51331
|
const manager = new DeliverablesManager(profile.path);
|
|
50712
51332
|
const policy = {
|
|
50713
51333
|
maxAge: opts.maxAge ? parseInt(opts.maxAge) : void 0,
|
|
@@ -50768,8 +51388,8 @@ program.command("deliverables:cleanup").description("Clean up old deliverables b
|
|
|
50768
51388
|
console.log(`Freed space: ${(result.freedSpace / 1024).toFixed(2)} KB`);
|
|
50769
51389
|
if (result.removed.length > 0) {
|
|
50770
51390
|
console.log("\nRemoved:");
|
|
50771
|
-
result.removed.forEach((
|
|
50772
|
-
console.log(` - ${
|
|
51391
|
+
result.removed.forEach((path60) => {
|
|
51392
|
+
console.log(` - ${path60}`);
|
|
50773
51393
|
});
|
|
50774
51394
|
}
|
|
50775
51395
|
}
|
|
@@ -50840,8 +51460,8 @@ var isDirectExec = (() => {
|
|
|
50840
51460
|
try {
|
|
50841
51461
|
if (typeof import.meta === "undefined") return false;
|
|
50842
51462
|
if (!process.argv[1] || !import.meta.url) return false;
|
|
50843
|
-
const invokedPath =
|
|
50844
|
-
const modulePath =
|
|
51463
|
+
const invokedPath = fs50.realpathSync(resolve15(process.argv[1]));
|
|
51464
|
+
const modulePath = fs50.realpathSync(fileURLToPath6(import.meta.url));
|
|
50845
51465
|
return invokedPath === modulePath;
|
|
50846
51466
|
} catch {
|
|
50847
51467
|
return false;
|
|
@@ -50911,11 +51531,17 @@ export {
|
|
|
50911
51531
|
ConfigurationQueryService,
|
|
50912
51532
|
ControllerLease_v1,
|
|
50913
51533
|
DiscoveryQueryService,
|
|
51534
|
+
EXECUTION_PLAN_ARTIFACT_CONTRACT,
|
|
51535
|
+
EXECUTION_PLAN_CANONICALIZATION_PROFILE,
|
|
51536
|
+
EXECUTION_PLAN_HASH_DOMAIN,
|
|
51537
|
+
EXECUTION_PLAN_HASH_PROFILE,
|
|
50914
51538
|
EngineVerificationCheckSource_v2,
|
|
50915
51539
|
EngineVerificationDeterminism_v2,
|
|
50916
51540
|
EngineVerificationTrustGapReason_v2,
|
|
50917
51541
|
ExecutionEnvelope_v1,
|
|
50918
51542
|
ExecutionEnvironmentOS,
|
|
51543
|
+
ExecutionPlanArtifactIdentity_v1Schema,
|
|
51544
|
+
ExecutionPlanArtifact_v1Schema,
|
|
50919
51545
|
ExecutionState,
|
|
50920
51546
|
ExternalAwaitOutcome_v1,
|
|
50921
51547
|
ExternalAwaitableDescriptor_v1,
|
|
@@ -50971,6 +51597,11 @@ export {
|
|
|
50971
51597
|
NativeWslProjectionSelection_v1,
|
|
50972
51598
|
NativeWslProjectionStatusRequestJsonSchema,
|
|
50973
51599
|
NativeWslSourceObservation_v1,
|
|
51600
|
+
PLAN_ARTIFACT_REFERENCE_CONTRACT,
|
|
51601
|
+
PlanArtifactReference_v1Schema,
|
|
51602
|
+
PlanArtifactRegistrationError,
|
|
51603
|
+
PlanArtifactRegistrationService,
|
|
51604
|
+
PlanArtifactScope_v1Schema,
|
|
50974
51605
|
PlanArtifactService,
|
|
50975
51606
|
PlanArtifactServiceError,
|
|
50976
51607
|
PlanCreationService,
|
|
@@ -51000,6 +51631,7 @@ export {
|
|
|
51000
51631
|
completionForAttemptAwaitable,
|
|
51001
51632
|
computeAgentEngineVerificationV2Hash,
|
|
51002
51633
|
computeAgentTaskPacketHash,
|
|
51634
|
+
computeExecutionPlanArtifactDigest,
|
|
51003
51635
|
computeFanInEvidenceSetHash,
|
|
51004
51636
|
computeMergeOrder,
|
|
51005
51637
|
containsAttemptAwaitableCredentialValue,
|