@smartergpt/lexrunner 2.0.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BRAND.md +14 -0
- package/CHANGELOG.md +49 -0
- package/GOVERNANCE.md +18 -0
- package/LICENSE.md +201 -110
- package/NOTICE.md +12 -1
- package/README.mcp.md +5 -1
- package/README.md +48 -35
- 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-7PX6YG55.js} +2 -2
- package/dist/{chunk-6PZDSWCG.js → chunk-37UC53OG.js} +2 -2
- package/dist/{chunk-ARDKZW7F.js → chunk-M6AAYMHH.js} +363 -293
- package/dist/{chunk-V3BU2VDU.js → chunk-PDDULIDL.js} +13 -1
- package/dist/cli.cjs +3672 -2774
- package/dist/cli.d.ts +201 -24
- package/dist/cli.js +1073 -275
- 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.d.ts +5 -5
- 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 +8 -6
- package/schemas/plan.schema.json +203 -73
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from "./chunk-AXOAVRTU.js";
|
|
32
32
|
import {
|
|
33
33
|
__require
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-PDDULIDL.js";
|
|
35
35
|
|
|
36
36
|
// src/autopilot/types.ts
|
|
37
37
|
import { z } from "zod";
|
|
@@ -1441,6 +1441,44 @@ function emitFailureReceipt(params, options = {}) {
|
|
|
1441
1441
|
return emitActionReceipt({ ...params, outcome: "failure" }, options);
|
|
1442
1442
|
}
|
|
1443
1443
|
|
|
1444
|
+
// src/git/input-schema.ts
|
|
1445
|
+
import { z as z3 } from "zod";
|
|
1446
|
+
function repositoryIdentity(value) {
|
|
1447
|
+
const scp = /^git@([^/:]+):(.+)$/.exec(value);
|
|
1448
|
+
const url = new URL(scp ? `ssh://git@${scp[1]}/${scp[2]}` : value);
|
|
1449
|
+
if (!["https:", "ssh:", "file:"].includes(url.protocol) || url.password || url.search || url.hash || url.username && !(url.protocol === "ssh:" && url.username === "git"))
|
|
1450
|
+
throw new Error("Repository must be an explicit HTTPS, SSH or file URL without credentials");
|
|
1451
|
+
if (url.protocol === "file:") return url.href.replace(/\/$/, "");
|
|
1452
|
+
if (!url.hostname || !/^\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/?$/.test(url.pathname)) {
|
|
1453
|
+
throw new Error("Repository URL must identify an owner and repository");
|
|
1454
|
+
}
|
|
1455
|
+
const path11 = url.pathname.replace(/\/$/, "").replace(/\.git$/, "");
|
|
1456
|
+
return `${url.hostname.toLowerCase()}${url.port ? `:${url.port}` : ""}${url.hostname.toLowerCase() === "github.com" ? path11.toLowerCase() : path11}`;
|
|
1457
|
+
}
|
|
1458
|
+
var GitCommitId = z3.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/);
|
|
1459
|
+
var GitRef = z3.string().max(512).regex(/^refs\/(?:heads\/.+|pull\/[1-9][0-9]*\/head)$/).refine(
|
|
1460
|
+
(ref) => !/[\x00-\x20\x7f~^:?*\[\\]/.test(ref) && !ref.includes("..") && !ref.includes("@{") && ref.split("/").every(
|
|
1461
|
+
(part) => !!part && !part.startsWith(".") && !part.endsWith(".") && !part.endsWith(".lock")
|
|
1462
|
+
),
|
|
1463
|
+
"Invalid fully qualified Git ref"
|
|
1464
|
+
);
|
|
1465
|
+
var GitInput = z3.object({ ref: GitRef, commit: GitCommitId }).strict();
|
|
1466
|
+
var FrozenGitInputs = z3.object({
|
|
1467
|
+
schemaVersion: z3.literal("1.0.0"),
|
|
1468
|
+
repository: z3.string().max(2048).refine((value) => {
|
|
1469
|
+
try {
|
|
1470
|
+
repositoryIdentity(value);
|
|
1471
|
+
return true;
|
|
1472
|
+
} catch {
|
|
1473
|
+
return false;
|
|
1474
|
+
}
|
|
1475
|
+
}, "An explicit repository URL without credentials is required"),
|
|
1476
|
+
checkoutRemote: z3.string().max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),
|
|
1477
|
+
acquisition: z3.enum(["local-only", "fetch"]),
|
|
1478
|
+
target: GitInput,
|
|
1479
|
+
sources: z3.array(GitInput.extend({ item: z3.string().min(1).max(512) }).strict()).max(256)
|
|
1480
|
+
}).strict();
|
|
1481
|
+
|
|
1444
1482
|
// src/git/operations.ts
|
|
1445
1483
|
var GitOperations = class {
|
|
1446
1484
|
constructor(workingDir = process.cwd()) {
|
|
@@ -1539,38 +1577,46 @@ var GitOperations = class {
|
|
|
1539
1577
|
const branchName = item.name;
|
|
1540
1578
|
const premergeLog = await this.git.log(["-1"]);
|
|
1541
1579
|
previousHead = premergeLog.latest?.hash || "HEAD";
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
(
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1580
|
+
let sourceRef = `origin/${branchName}`;
|
|
1581
|
+
if (operation.sourceCommit !== void 0) {
|
|
1582
|
+
sourceRef = GitCommitId.parse(operation.sourceCommit);
|
|
1583
|
+
if ((await this.git.raw(["cat-file", "-t", sourceRef])).trim() !== "commit") {
|
|
1584
|
+
throw new Error("Frozen merge source is not a commit object");
|
|
1585
|
+
}
|
|
1586
|
+
} else {
|
|
1587
|
+
const branches = await this.git.branch(["-a"]);
|
|
1588
|
+
const branchExists = branches.all.some(
|
|
1589
|
+
(branch) => branch === branchName || branch === `origin/${branchName}` || branch === `remotes/origin/${branchName}`
|
|
1590
|
+
);
|
|
1591
|
+
if (!branchExists) {
|
|
1592
|
+
profiler.end(operationId);
|
|
1593
|
+
metrics.incrementCounter(METRICS.MERGE_FAILURE_TOTAL, { reason: "branch_not_found" });
|
|
1594
|
+
return {
|
|
1595
|
+
success: false,
|
|
1596
|
+
item,
|
|
1597
|
+
message: `Branch ${branchName} not found`
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
await this.git.fetch("origin", branchName);
|
|
1554
1601
|
}
|
|
1555
|
-
await this.git.fetch("origin", branchName);
|
|
1556
1602
|
let gitMergeResult;
|
|
1557
1603
|
let sha;
|
|
1558
1604
|
let mergeError = null;
|
|
1559
1605
|
try {
|
|
1560
1606
|
switch (strategy) {
|
|
1561
1607
|
case "merge-weave":
|
|
1562
|
-
gitMergeResult = await this.git.merge([
|
|
1608
|
+
gitMergeResult = await this.git.merge([sourceRef, "--no-ff"]);
|
|
1563
1609
|
break;
|
|
1564
1610
|
case "squash-weave":
|
|
1565
|
-
gitMergeResult = await this.git.merge([
|
|
1611
|
+
gitMergeResult = await this.git.merge([sourceRef, "--squash"]);
|
|
1566
1612
|
if (gitMergeResult && !gitMergeResult.failed) {
|
|
1567
1613
|
await this.git.commit(`Squash merge: ${item.name}`);
|
|
1568
1614
|
}
|
|
1569
1615
|
break;
|
|
1570
1616
|
case "rebase-weave":
|
|
1571
1617
|
try {
|
|
1572
|
-
await this.git.rebase([
|
|
1573
|
-
gitMergeResult = await this.git.merge([
|
|
1618
|
+
await this.git.rebase([sourceRef]);
|
|
1619
|
+
gitMergeResult = await this.git.merge([sourceRef, "--ff-only"]);
|
|
1574
1620
|
} catch (rebaseError) {
|
|
1575
1621
|
const conflictedFiles2 = await this.getConflictedFiles();
|
|
1576
1622
|
profiler.end(operationId);
|
|
@@ -1690,6 +1736,9 @@ var GitOperations = class {
|
|
|
1690
1736
|
* Execute merge pyramid with dependency ordering
|
|
1691
1737
|
*/
|
|
1692
1738
|
async executeWeave(plan, levels, progressReporter) {
|
|
1739
|
+
if (plan.gitInputs) {
|
|
1740
|
+
throw new Error("Frozen Git inputs require the shared merge application/resume service");
|
|
1741
|
+
}
|
|
1693
1742
|
const results = [];
|
|
1694
1743
|
let successful = 0;
|
|
1695
1744
|
let failed = 0;
|
|
@@ -2115,7 +2164,7 @@ function validateGateInput(gateName, input) {
|
|
|
2115
2164
|
}
|
|
2116
2165
|
|
|
2117
2166
|
// src/runs/failures.ts
|
|
2118
|
-
import { z as
|
|
2167
|
+
import { z as z4 } from "zod";
|
|
2119
2168
|
|
|
2120
2169
|
// src/runs/storage.ts
|
|
2121
2170
|
import * as fs6 from "fs";
|
|
@@ -2280,57 +2329,57 @@ var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
2280
2329
|
FailureErrorCode.NETWORK_ERROR,
|
|
2281
2330
|
FailureErrorCode.RATE_LIMITED
|
|
2282
2331
|
]);
|
|
2283
|
-
var FailureErrorSchema =
|
|
2332
|
+
var FailureErrorSchema = z4.object({
|
|
2284
2333
|
/** Error code for classification */
|
|
2285
|
-
code:
|
|
2334
|
+
code: z4.string(),
|
|
2286
2335
|
/** Human-readable error message */
|
|
2287
|
-
message:
|
|
2336
|
+
message: z4.string(),
|
|
2288
2337
|
/** Whether the error is retryable */
|
|
2289
|
-
retryable:
|
|
2338
|
+
retryable: z4.boolean(),
|
|
2290
2339
|
/** Optional hint for recovery */
|
|
2291
|
-
hint:
|
|
2340
|
+
hint: z4.string().optional()
|
|
2292
2341
|
});
|
|
2293
|
-
var RecommendedActionSchema =
|
|
2342
|
+
var RecommendedActionSchema = z4.object({
|
|
2294
2343
|
/** Action identifier */
|
|
2295
|
-
action:
|
|
2344
|
+
action: z4.string(),
|
|
2296
2345
|
/** Action description */
|
|
2297
|
-
description:
|
|
2346
|
+
description: z4.string(),
|
|
2298
2347
|
/** Whether this action requires LLM decision */
|
|
2299
|
-
requiresLLMDecision:
|
|
2348
|
+
requiresLLMDecision: z4.boolean().optional(),
|
|
2300
2349
|
/** Prompt for LLM decision */
|
|
2301
|
-
prompt:
|
|
2350
|
+
prompt: z4.string().optional(),
|
|
2302
2351
|
/** JSON schema for response */
|
|
2303
|
-
responseSchema:
|
|
2352
|
+
responseSchema: z4.record(z4.string(), z4.unknown()).optional(),
|
|
2304
2353
|
/** Risk level assessment */
|
|
2305
|
-
riskLevel:
|
|
2354
|
+
riskLevel: z4.enum(["low", "medium", "high"]).optional()
|
|
2306
2355
|
});
|
|
2307
|
-
var FailureRecordSchema =
|
|
2356
|
+
var FailureRecordSchema = z4.object({
|
|
2308
2357
|
/** ISO 8601 timestamp */
|
|
2309
|
-
timestamp:
|
|
2358
|
+
timestamp: z4.string(),
|
|
2310
2359
|
/** Run identifier */
|
|
2311
|
-
runId:
|
|
2360
|
+
runId: z4.string(),
|
|
2312
2361
|
/** Gate name that failed */
|
|
2313
|
-
gate:
|
|
2362
|
+
gate: z4.string(),
|
|
2314
2363
|
/** Structured error information */
|
|
2315
2364
|
error: FailureErrorSchema,
|
|
2316
2365
|
/** Whether the error was retryable */
|
|
2317
|
-
retryable:
|
|
2366
|
+
retryable: z4.boolean(),
|
|
2318
2367
|
/** Action taken to handle the failure */
|
|
2319
|
-
actionTaken:
|
|
2368
|
+
actionTaken: z4.string().optional(),
|
|
2320
2369
|
/** Rationale for the action taken */
|
|
2321
|
-
rationale:
|
|
2370
|
+
rationale: z4.string().optional(),
|
|
2322
2371
|
/** Exit code from gate execution */
|
|
2323
|
-
exitCode:
|
|
2372
|
+
exitCode: z4.number().optional(),
|
|
2324
2373
|
/** Duration in milliseconds */
|
|
2325
|
-
duration_ms:
|
|
2374
|
+
duration_ms: z4.number().optional()
|
|
2326
2375
|
});
|
|
2327
|
-
var FailureHandlingPayloadSchema =
|
|
2376
|
+
var FailureHandlingPayloadSchema = z4.object({
|
|
2328
2377
|
/** Structured error information */
|
|
2329
2378
|
error: FailureErrorSchema,
|
|
2330
2379
|
/** Recommended actions for recovery */
|
|
2331
|
-
recommendedActions:
|
|
2380
|
+
recommendedActions: z4.array(RecommendedActionSchema),
|
|
2332
2381
|
/** Schema for failure record logging */
|
|
2333
|
-
failureRecordSchema:
|
|
2382
|
+
failureRecordSchema: z4.record(z4.string(), z4.unknown()).optional()
|
|
2334
2383
|
});
|
|
2335
2384
|
function classifyGateError(gateName, stderr, exitCode, isFlaky) {
|
|
2336
2385
|
const errorMessage = stderr.toLowerCase();
|
|
@@ -2565,17 +2614,17 @@ function emitGateReceipt(gateName, itemName, passed, duration, runId, options =
|
|
|
2565
2614
|
}
|
|
2566
2615
|
|
|
2567
2616
|
// src/hostility/score.ts
|
|
2568
|
-
import { z as
|
|
2569
|
-
var HostilityComponentSchema =
|
|
2570
|
-
score:
|
|
2571
|
-
status:
|
|
2572
|
-
details:
|
|
2573
|
-
recommendation:
|
|
2617
|
+
import { z as z5 } from "zod";
|
|
2618
|
+
var HostilityComponentSchema = z5.object({
|
|
2619
|
+
score: z5.number().min(0).max(1),
|
|
2620
|
+
status: z5.enum(["good", "warning", "critical"]),
|
|
2621
|
+
details: z5.string(),
|
|
2622
|
+
recommendation: z5.string().optional()
|
|
2574
2623
|
});
|
|
2575
|
-
var HostilityScoreSchema =
|
|
2576
|
-
total:
|
|
2577
|
-
status:
|
|
2578
|
-
components:
|
|
2624
|
+
var HostilityScoreSchema = z5.object({
|
|
2625
|
+
total: z5.number().min(0).max(1),
|
|
2626
|
+
status: z5.enum(["low", "medium", "high"]),
|
|
2627
|
+
components: z5.object({
|
|
2579
2628
|
constraintClarity: HostilityComponentSchema,
|
|
2580
2629
|
requirementExplicitness: HostilityComponentSchema,
|
|
2581
2630
|
problemBoundedness: HostilityComponentSchema,
|
|
@@ -2584,7 +2633,7 @@ var HostilityScoreSchema = z4.object({
|
|
|
2584
2633
|
stateCoherence: HostilityComponentSchema,
|
|
2585
2634
|
modelContinuity: HostilityComponentSchema
|
|
2586
2635
|
}),
|
|
2587
|
-
recommendations:
|
|
2636
|
+
recommendations: z5.array(z5.string())
|
|
2588
2637
|
});
|
|
2589
2638
|
var COMPONENT_LABELS = {
|
|
2590
2639
|
constraintClarity: "Constraint Clarity",
|
|
@@ -3220,29 +3269,29 @@ import {
|
|
|
3220
3269
|
writeFileSync as writeFileSync5
|
|
3221
3270
|
} from "fs";
|
|
3222
3271
|
import { basename as basename2, delimiter, dirname, extname, isAbsolute as isAbsolute2, join as join9, resolve as resolve5 } from "path";
|
|
3223
|
-
import { z as
|
|
3272
|
+
import { z as z9 } from "zod";
|
|
3224
3273
|
|
|
3225
3274
|
// src/schema.ts
|
|
3226
|
-
import { z as
|
|
3275
|
+
import { z as z7 } from "zod";
|
|
3227
3276
|
|
|
3228
3277
|
// src/tiers/schema.ts
|
|
3229
|
-
import { z as
|
|
3230
|
-
var CapabilityTier =
|
|
3231
|
-
var TierAssignment =
|
|
3278
|
+
import { z as z6 } from "zod";
|
|
3279
|
+
var CapabilityTier = z6.enum(["senior", "mid", "junior"]);
|
|
3280
|
+
var TierAssignment = z6.object({
|
|
3232
3281
|
/** Suggested tier based on heuristics */
|
|
3233
3282
|
suggested: CapabilityTier,
|
|
3234
3283
|
/** Actual tier used during execution (may differ due to override) */
|
|
3235
3284
|
actual: CapabilityTier.optional(),
|
|
3236
3285
|
/** Whether the task was escalated to a higher tier */
|
|
3237
|
-
escalated:
|
|
3286
|
+
escalated: z6.boolean().default(false),
|
|
3238
3287
|
/** Reason for escalation if applicable */
|
|
3239
|
-
escalationReason:
|
|
3288
|
+
escalationReason: z6.string().optional(),
|
|
3240
3289
|
/** Whether actual tier differs from suggested tier */
|
|
3241
|
-
mismatch:
|
|
3290
|
+
mismatch: z6.boolean().optional()
|
|
3242
3291
|
});
|
|
3243
|
-
var TierOverride =
|
|
3292
|
+
var TierOverride = z6.object({
|
|
3244
3293
|
/** Item name to override */
|
|
3245
|
-
itemName:
|
|
3294
|
+
itemName: z6.string(),
|
|
3246
3295
|
/** Tier to assign */
|
|
3247
3296
|
tier: CapabilityTier
|
|
3248
3297
|
});
|
|
@@ -3274,38 +3323,38 @@ function parseTierOverrides(overrides) {
|
|
|
3274
3323
|
}
|
|
3275
3324
|
|
|
3276
3325
|
// src/schema.ts
|
|
3277
|
-
var GateStatus =
|
|
3278
|
-
var NodeStatus =
|
|
3279
|
-
var GateResult =
|
|
3280
|
-
gate:
|
|
3326
|
+
var GateStatus = z7.enum(["pass", "fail", "blocked", "skipped", "retrying"]);
|
|
3327
|
+
var NodeStatus = z7.enum(["pass", "fail", "blocked", "skipped", "retrying"]);
|
|
3328
|
+
var GateResult = z7.object({
|
|
3329
|
+
gate: z7.string(),
|
|
3281
3330
|
status: GateStatus,
|
|
3282
|
-
exitCode:
|
|
3283
|
-
duration:
|
|
3331
|
+
exitCode: z7.number().optional(),
|
|
3332
|
+
duration: z7.number().optional(),
|
|
3284
3333
|
// milliseconds
|
|
3285
|
-
timeoutMs:
|
|
3334
|
+
timeoutMs: z7.number().int().positive().optional(),
|
|
3286
3335
|
// effective timeout used for this gate
|
|
3287
|
-
stdout:
|
|
3288
|
-
stderr:
|
|
3289
|
-
failureKind:
|
|
3290
|
-
timeoutCleanup:
|
|
3291
|
-
method:
|
|
3292
|
-
forceKilled:
|
|
3293
|
-
descendantsReaped:
|
|
3336
|
+
stdout: z7.string().optional(),
|
|
3337
|
+
stderr: z7.string().optional(),
|
|
3338
|
+
failureKind: z7.enum(["nonzero_exit", "spawn_error", "timeout", "evidence_error"]).optional(),
|
|
3339
|
+
timeoutCleanup: z7.object({
|
|
3340
|
+
method: z7.enum(["process-group", "taskkill", "direct-child"]),
|
|
3341
|
+
forceKilled: z7.boolean(),
|
|
3342
|
+
descendantsReaped: z7.boolean()
|
|
3294
3343
|
}).optional(),
|
|
3295
|
-
artifacts:
|
|
3296
|
-
attempts:
|
|
3297
|
-
lastAttempt:
|
|
3344
|
+
artifacts: z7.array(z7.string()).optional(),
|
|
3345
|
+
attempts: z7.number().default(1),
|
|
3346
|
+
lastAttempt: z7.string().optional()
|
|
3298
3347
|
// ISO timestamp
|
|
3299
3348
|
});
|
|
3300
|
-
var NodeResult =
|
|
3301
|
-
name:
|
|
3349
|
+
var NodeResult = z7.object({
|
|
3350
|
+
name: z7.string(),
|
|
3302
3351
|
status: NodeStatus,
|
|
3303
|
-
gates:
|
|
3304
|
-
blockedBy:
|
|
3352
|
+
gates: z7.array(GateResult).default([]),
|
|
3353
|
+
blockedBy: z7.array(z7.string()).optional(),
|
|
3305
3354
|
// names of nodes that blocked this one
|
|
3306
|
-
eligibleForMerge:
|
|
3355
|
+
eligibleForMerge: z7.boolean().default(false)
|
|
3307
3356
|
});
|
|
3308
|
-
var SchemaVersion =
|
|
3357
|
+
var SchemaVersion = z7.string().regex(/^1\.\d+\.\d+$/, "Schema version must be 1.x.y format");
|
|
3309
3358
|
function validateSchemaVersion(version) {
|
|
3310
3359
|
const parsed = SchemaVersion.safeParse(version);
|
|
3311
3360
|
if (!parsed.success) {
|
|
@@ -3324,30 +3373,30 @@ function validateSchemaVersion(version) {
|
|
|
3324
3373
|
throw new AXErrorException(axError.code, axError.message, axError.nextActions, axError.context);
|
|
3325
3374
|
}
|
|
3326
3375
|
}
|
|
3327
|
-
var RetryConfig =
|
|
3328
|
-
maxAttempts:
|
|
3329
|
-
backoffSeconds:
|
|
3376
|
+
var RetryConfig = z7.object({
|
|
3377
|
+
maxAttempts: z7.number().int().min(1).default(1),
|
|
3378
|
+
backoffSeconds: z7.number().min(0).default(0)
|
|
3330
3379
|
});
|
|
3331
|
-
var AdminOverride =
|
|
3332
|
-
allowedUsers:
|
|
3333
|
-
requireReason:
|
|
3380
|
+
var AdminOverride = z7.object({
|
|
3381
|
+
allowedUsers: z7.array(z7.string()).optional(),
|
|
3382
|
+
requireReason: z7.boolean().default(false)
|
|
3334
3383
|
});
|
|
3335
|
-
var MergeRule =
|
|
3336
|
-
type:
|
|
3384
|
+
var MergeRule = z7.object({
|
|
3385
|
+
type: z7.enum(["strict-required"]).default("strict-required")
|
|
3337
3386
|
// Future: could add "best-effort", "admin-override-allowed", etc.
|
|
3338
3387
|
});
|
|
3339
|
-
var PerformanceConfig =
|
|
3340
|
-
maxMemoryMB:
|
|
3388
|
+
var PerformanceConfig = z7.object({
|
|
3389
|
+
maxMemoryMB: z7.number().int().min(128).optional(),
|
|
3341
3390
|
// Memory limit in MB
|
|
3342
|
-
batchSize:
|
|
3391
|
+
batchSize: z7.number().int().min(1).default(50),
|
|
3343
3392
|
// Batch size for large plans
|
|
3344
|
-
cacheTTLSeconds:
|
|
3393
|
+
cacheTTLSeconds: z7.number().int().min(0).default(3600),
|
|
3345
3394
|
// Cache TTL in seconds
|
|
3346
|
-
enableCaching:
|
|
3395
|
+
enableCaching: z7.boolean().default(true),
|
|
3347
3396
|
// Enable operation caching
|
|
3348
|
-
throttleOnMemory:
|
|
3397
|
+
throttleOnMemory: z7.boolean().default(true),
|
|
3349
3398
|
// Throttle workers when memory high
|
|
3350
|
-
memoryThresholdPercent:
|
|
3399
|
+
memoryThresholdPercent: z7.number().min(0).max(100).default(80)
|
|
3351
3400
|
// Memory threshold %
|
|
3352
3401
|
}).default(() => ({
|
|
3353
3402
|
batchSize: 50,
|
|
@@ -3356,73 +3405,84 @@ var PerformanceConfig = z6.object({
|
|
|
3356
3405
|
throttleOnMemory: true,
|
|
3357
3406
|
memoryThresholdPercent: 80
|
|
3358
3407
|
}));
|
|
3359
|
-
var VulnPolicy =
|
|
3360
|
-
blockCritical:
|
|
3361
|
-
blockHigh:
|
|
3362
|
-
maxMedium:
|
|
3363
|
-
maxLow:
|
|
3408
|
+
var VulnPolicy = z7.object({
|
|
3409
|
+
blockCritical: z7.boolean().default(true),
|
|
3410
|
+
blockHigh: z7.boolean().default(true),
|
|
3411
|
+
maxMedium: z7.number().int().min(0).default(5),
|
|
3412
|
+
maxLow: z7.number().int().min(0).default(10)
|
|
3364
3413
|
}).default(() => ({
|
|
3365
3414
|
blockCritical: true,
|
|
3366
3415
|
blockHigh: true,
|
|
3367
3416
|
maxMedium: 5,
|
|
3368
3417
|
maxLow: 10
|
|
3369
3418
|
}));
|
|
3370
|
-
var Policy =
|
|
3371
|
-
requiredGates:
|
|
3372
|
-
optionalGates:
|
|
3373
|
-
maxWorkers:
|
|
3374
|
-
retries:
|
|
3375
|
-
overrides:
|
|
3419
|
+
var Policy = z7.object({
|
|
3420
|
+
requiredGates: z7.array(z7.string()).default([]),
|
|
3421
|
+
optionalGates: z7.array(z7.string()).default([]),
|
|
3422
|
+
maxWorkers: z7.number().int().min(1).default(1),
|
|
3423
|
+
retries: z7.record(z7.string(), RetryConfig).default(() => ({})),
|
|
3424
|
+
overrides: z7.object({
|
|
3376
3425
|
adminGreen: AdminOverride.optional()
|
|
3377
3426
|
}).default(() => ({})),
|
|
3378
|
-
blockOn:
|
|
3427
|
+
blockOn: z7.array(z7.string()).default([]),
|
|
3379
3428
|
mergeRule: MergeRule.default({ type: "strict-required" }),
|
|
3380
3429
|
performance: PerformanceConfig.optional(),
|
|
3381
3430
|
// Performance tuning options
|
|
3382
3431
|
security: VulnPolicy.optional()
|
|
3383
3432
|
// Security/vulnerability thresholds for vuln gate
|
|
3384
3433
|
});
|
|
3385
|
-
var ContainerMount =
|
|
3386
|
-
source:
|
|
3387
|
-
target:
|
|
3388
|
-
type:
|
|
3434
|
+
var ContainerMount = z7.object({
|
|
3435
|
+
source: z7.string(),
|
|
3436
|
+
target: z7.string(),
|
|
3437
|
+
type: z7.enum(["bind", "volume"]).default("bind")
|
|
3389
3438
|
});
|
|
3390
|
-
var ContainerSpec =
|
|
3391
|
-
image:
|
|
3392
|
-
entrypoint:
|
|
3393
|
-
mounts:
|
|
3439
|
+
var ContainerSpec = z7.object({
|
|
3440
|
+
image: z7.string(),
|
|
3441
|
+
entrypoint: z7.array(z7.string()).optional(),
|
|
3442
|
+
mounts: z7.array(ContainerMount).optional()
|
|
3394
3443
|
});
|
|
3395
|
-
var Gate =
|
|
3396
|
-
name:
|
|
3397
|
-
run:
|
|
3398
|
-
cwd:
|
|
3399
|
-
env:
|
|
3444
|
+
var Gate = z7.object({
|
|
3445
|
+
name: z7.string(),
|
|
3446
|
+
run: z7.string(),
|
|
3447
|
+
cwd: z7.string().optional(),
|
|
3448
|
+
env: z7.record(z7.string(), z7.string()).default(() => ({})),
|
|
3400
3449
|
// Runtime configuration
|
|
3401
|
-
runtime:
|
|
3450
|
+
runtime: z7.enum(["local", "container", "ci-service"]).default("local"),
|
|
3402
3451
|
// Container spec (only used when runtime is "container")
|
|
3403
3452
|
container: ContainerSpec.optional(),
|
|
3404
3453
|
// Expected artifact paths (for output collection)
|
|
3405
|
-
artifacts:
|
|
3454
|
+
artifacts: z7.array(z7.string()).default([]),
|
|
3406
3455
|
// Optional input data for gates that require structured inputs (validated against gate-specific schemas)
|
|
3407
|
-
input:
|
|
3456
|
+
input: z7.record(z7.string(), z7.unknown()).optional(),
|
|
3408
3457
|
// Exact per-gate timeout. Overrides the operation default after hostility adjustment.
|
|
3409
|
-
timeoutMs:
|
|
3458
|
+
timeoutMs: z7.number().int().positive().max(24 * 60 * 60 * 1e3).optional()
|
|
3410
3459
|
}).strict();
|
|
3411
|
-
var PlanItem =
|
|
3412
|
-
name:
|
|
3413
|
-
deps:
|
|
3460
|
+
var PlanItem = z7.object({
|
|
3461
|
+
name: z7.string(),
|
|
3462
|
+
deps: z7.string().array().default([]),
|
|
3414
3463
|
// Dependency references by item name
|
|
3415
|
-
gates:
|
|
3464
|
+
gates: z7.array(Gate).default([]),
|
|
3416
3465
|
// Tier routing for governance (optional - added during plan generation or execution)
|
|
3417
3466
|
tier: TierAssignment.optional()
|
|
3418
3467
|
}).strict();
|
|
3419
|
-
var Plan =
|
|
3468
|
+
var Plan = z7.object({
|
|
3420
3469
|
schemaVersion: SchemaVersion,
|
|
3421
|
-
target:
|
|
3470
|
+
target: z7.string().default("main"),
|
|
3422
3471
|
policy: Policy.optional(),
|
|
3423
|
-
items:
|
|
3472
|
+
items: z7.array(PlanItem).default([]),
|
|
3473
|
+
gitInputs: FrozenGitInputs.optional()
|
|
3424
3474
|
}).strict().superRefine((plan, context) => {
|
|
3425
3475
|
const itemNames = /* @__PURE__ */ new Set();
|
|
3476
|
+
if (plan.gitInputs) {
|
|
3477
|
+
const sources = plan.gitInputs.sources.map((source) => source.item);
|
|
3478
|
+
if (plan.gitInputs.target.ref !== `refs/heads/${plan.target}` || new Set(sources).size !== sources.length || sources.length !== plan.items.length || plan.items.some((item) => !sources.includes(item.name))) {
|
|
3479
|
+
context.addIssue({
|
|
3480
|
+
code: "custom",
|
|
3481
|
+
path: ["gitInputs"],
|
|
3482
|
+
message: "Git inputs must bind the target and every plan item exactly once"
|
|
3483
|
+
});
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3426
3486
|
let duplicateItemNameFound = false;
|
|
3427
3487
|
const duplicateGateNameItemIndexes = [];
|
|
3428
3488
|
for (const [itemIndex, item] of plan.items.entries()) {
|
|
@@ -3647,7 +3707,7 @@ function loadPlan(planContent) {
|
|
|
3647
3707
|
|
|
3648
3708
|
// src/schemas/task-contract.ts
|
|
3649
3709
|
import { createHash } from "crypto";
|
|
3650
|
-
import { z as
|
|
3710
|
+
import { z as z8 } from "zod";
|
|
3651
3711
|
var TASK_CONTRACT_VERSION = "1.0.0";
|
|
3652
3712
|
function computeCanonicalHash(obj) {
|
|
3653
3713
|
const canonical = JSON.stringify(obj, sortedReplacer);
|
|
@@ -3669,111 +3729,111 @@ function sortedReplacer(_key, value) {
|
|
|
3669
3729
|
}
|
|
3670
3730
|
return value;
|
|
3671
3731
|
}
|
|
3672
|
-
var DeterminismLevel =
|
|
3673
|
-
var ConfidenceLevel2 =
|
|
3674
|
-
var SourceOfTruthKind =
|
|
3675
|
-
var AssumptionType =
|
|
3676
|
-
var RepoRelativePath =
|
|
3732
|
+
var DeterminismLevel = z8.enum(["D1", "D2", "D3"]);
|
|
3733
|
+
var ConfidenceLevel2 = z8.enum(["high", "medium", "low"]);
|
|
3734
|
+
var SourceOfTruthKind = z8.enum(["symbol", "file", "registry"]);
|
|
3735
|
+
var AssumptionType = z8.enum(["scope", "codebase", "env", "intent", "dependency", "test"]);
|
|
3736
|
+
var RepoRelativePath = z8.string().refine((p) => !p.startsWith("/"), {
|
|
3677
3737
|
message: "Path must be repo-relative (no leading slash)"
|
|
3678
3738
|
}).refine((p) => !p.includes(":\\") && !p.includes(":/"), {
|
|
3679
3739
|
message: "Path must not be absolute (no drive letters)"
|
|
3680
3740
|
}).refine((p) => !p.startsWith(".."), {
|
|
3681
3741
|
message: "Path must not escape repo root"
|
|
3682
3742
|
});
|
|
3683
|
-
var GlobPattern =
|
|
3684
|
-
var SHA256Hash =
|
|
3685
|
-
var SHA256HashOrPlaceholder =
|
|
3743
|
+
var GlobPattern = z8.string().min(1);
|
|
3744
|
+
var SHA256Hash = z8.string().regex(/^sha256:[a-f0-9]{64}$/, "Must be sha256:<64-hex-chars>");
|
|
3745
|
+
var SHA256HashOrPlaceholder = z8.string().refine((h) => h.startsWith("sha256:"), {
|
|
3686
3746
|
message: "Must start with sha256:"
|
|
3687
3747
|
});
|
|
3688
|
-
var RepoProvenance =
|
|
3748
|
+
var RepoProvenance = z8.object({
|
|
3689
3749
|
/** Repository identifier (owner/name) */
|
|
3690
|
-
id:
|
|
3750
|
+
id: z8.string().regex(/^[^/]+\/[^/]+$/, "Must be owner/repo format"),
|
|
3691
3751
|
/** Absolute path to repo root (engine-local, for resolution) */
|
|
3692
|
-
root:
|
|
3752
|
+
root: z8.string(),
|
|
3693
3753
|
/** Pinned commit SHA */
|
|
3694
|
-
commit_sha:
|
|
3754
|
+
commit_sha: z8.string().min(7)
|
|
3695
3755
|
});
|
|
3696
|
-
var ScopeBoundary =
|
|
3756
|
+
var ScopeBoundary = z8.object({
|
|
3697
3757
|
/** Globs for files agent can read */
|
|
3698
|
-
read_globs:
|
|
3758
|
+
read_globs: z8.array(GlobPattern),
|
|
3699
3759
|
/** Globs for files agent can modify */
|
|
3700
|
-
write_globs:
|
|
3760
|
+
write_globs: z8.array(GlobPattern),
|
|
3701
3761
|
/** Globs for files explicitly denied (always applied) */
|
|
3702
|
-
deny_globs:
|
|
3762
|
+
deny_globs: z8.array(GlobPattern),
|
|
3703
3763
|
/** Whether cross-repo operations are permitted */
|
|
3704
|
-
cross_repo_allowed:
|
|
3764
|
+
cross_repo_allowed: z8.boolean()
|
|
3705
3765
|
});
|
|
3706
|
-
var FailureEvidence =
|
|
3766
|
+
var FailureEvidence = z8.object({
|
|
3707
3767
|
/** Short error description */
|
|
3708
|
-
message:
|
|
3768
|
+
message: z8.string(),
|
|
3709
3769
|
/** Repo-relative path to failed file */
|
|
3710
3770
|
file_rel: RepoRelativePath,
|
|
3711
3771
|
/** Line number if available */
|
|
3712
|
-
line:
|
|
3772
|
+
line: z8.number().int().positive().optional(),
|
|
3713
3773
|
/** Actual test runner output snippet */
|
|
3714
|
-
runner_output_snip:
|
|
3774
|
+
runner_output_snip: z8.string(),
|
|
3715
3775
|
/** Code context around failure */
|
|
3716
|
-
excerpt:
|
|
3776
|
+
excerpt: z8.string().optional()
|
|
3717
3777
|
});
|
|
3718
|
-
var HintEdit =
|
|
3719
|
-
find:
|
|
3720
|
-
replace:
|
|
3778
|
+
var HintEdit = z8.object({
|
|
3779
|
+
find: z8.string(),
|
|
3780
|
+
replace: z8.string()
|
|
3721
3781
|
});
|
|
3722
|
-
var Target =
|
|
3782
|
+
var Target = z8.object({
|
|
3723
3783
|
/** Repo-relative file path */
|
|
3724
3784
|
path_rel: RepoRelativePath,
|
|
3725
3785
|
/** Anchored code context (±N lines) */
|
|
3726
|
-
hunk:
|
|
3786
|
+
hunk: z8.string(),
|
|
3727
3787
|
/** SHA256 of hunk for drift detection */
|
|
3728
3788
|
hunk_sha256: SHA256HashOrPlaceholder,
|
|
3729
3789
|
/** Optional find/replace suggestion */
|
|
3730
3790
|
hint_edit: HintEdit.optional()
|
|
3731
3791
|
});
|
|
3732
|
-
var IntroducingChange =
|
|
3733
|
-
commit_sha:
|
|
3734
|
-
diff_hunk:
|
|
3792
|
+
var IntroducingChange = z8.object({
|
|
3793
|
+
commit_sha: z8.string().min(7),
|
|
3794
|
+
diff_hunk: z8.string()
|
|
3735
3795
|
});
|
|
3736
|
-
var SourceOfTruth =
|
|
3796
|
+
var SourceOfTruth = z8.object({
|
|
3737
3797
|
/** Kind of source */
|
|
3738
3798
|
kind: SourceOfTruthKind,
|
|
3739
3799
|
/** Repo-relative path */
|
|
3740
3800
|
path_rel: RepoRelativePath,
|
|
3741
3801
|
/** Repository ID (defaults to snapshot repo if omitted) */
|
|
3742
|
-
repo_id:
|
|
3802
|
+
repo_id: z8.string().optional(),
|
|
3743
3803
|
/** Commit SHA (defaults to snapshot commit if omitted) */
|
|
3744
|
-
commit_sha:
|
|
3804
|
+
commit_sha: z8.string().optional(),
|
|
3745
3805
|
/** Canonical excerpt */
|
|
3746
|
-
excerpt:
|
|
3806
|
+
excerpt: z8.string(),
|
|
3747
3807
|
/** Lexmap module ID if applicable */
|
|
3748
|
-
lexmap_module_id:
|
|
3808
|
+
lexmap_module_id: z8.string().optional(),
|
|
3749
3809
|
/** Change that introduced this */
|
|
3750
3810
|
introducing_change: IntroducingChange.optional()
|
|
3751
3811
|
});
|
|
3752
|
-
var VerificationExpectations =
|
|
3812
|
+
var VerificationExpectations = z8.object({
|
|
3753
3813
|
/** Command to run */
|
|
3754
|
-
cmd:
|
|
3814
|
+
cmd: z8.string(),
|
|
3755
3815
|
/** Expected results */
|
|
3756
|
-
expect:
|
|
3816
|
+
expect: z8.object({
|
|
3757
3817
|
/** Expected exit code (usually 0) */
|
|
3758
|
-
exit_code:
|
|
3818
|
+
exit_code: z8.number().int(),
|
|
3759
3819
|
/** Strings that must appear in output */
|
|
3760
|
-
must_include:
|
|
3820
|
+
must_include: z8.array(z8.string()).optional(),
|
|
3761
3821
|
/** Strings that must not appear */
|
|
3762
|
-
must_not_include:
|
|
3822
|
+
must_not_include: z8.array(z8.string()).optional()
|
|
3763
3823
|
})
|
|
3764
3824
|
});
|
|
3765
|
-
var Budget =
|
|
3825
|
+
var Budget = z8.object({
|
|
3766
3826
|
/** Token budget hint in bytes */
|
|
3767
|
-
max_bytes:
|
|
3827
|
+
max_bytes: z8.number().int().positive().optional(),
|
|
3768
3828
|
/** Fields that were truncated (empty if none) */
|
|
3769
|
-
truncated_fields:
|
|
3829
|
+
truncated_fields: z8.array(z8.string())
|
|
3770
3830
|
});
|
|
3771
|
-
var TaskSnapshot_v1 =
|
|
3831
|
+
var TaskSnapshot_v1 = z8.object({
|
|
3772
3832
|
// Schema version
|
|
3773
|
-
schema_version:
|
|
3833
|
+
schema_version: z8.literal(TASK_CONTRACT_VERSION),
|
|
3774
3834
|
// Identity
|
|
3775
|
-
task_id:
|
|
3776
|
-
procedure:
|
|
3835
|
+
task_id: z8.string().min(1),
|
|
3836
|
+
procedure: z8.string().min(1),
|
|
3777
3837
|
determinism: DeterminismLevel,
|
|
3778
3838
|
snapshot_hash: SHA256HashOrPlaceholder,
|
|
3779
3839
|
// Provenance (MUST)
|
|
@@ -3783,9 +3843,9 @@ var TaskSnapshot_v1 = z7.object({
|
|
|
3783
3843
|
// Failure evidence (MUST)
|
|
3784
3844
|
failure: FailureEvidence,
|
|
3785
3845
|
// Invariants (SHOULD) - anti-brittleness constraints
|
|
3786
|
-
invariants:
|
|
3846
|
+
invariants: z8.array(z8.string()).optional(),
|
|
3787
3847
|
// Targets (MUST, array)
|
|
3788
|
-
targets:
|
|
3848
|
+
targets: z8.array(Target).min(1),
|
|
3789
3849
|
// Source of truth (SHOULD)
|
|
3790
3850
|
source_of_truth: SourceOfTruth.optional(),
|
|
3791
3851
|
// Verification expectations (MUST)
|
|
@@ -3793,183 +3853,183 @@ var TaskSnapshot_v1 = z7.object({
|
|
|
3793
3853
|
// Budget/truncation (MUST)
|
|
3794
3854
|
budget: Budget,
|
|
3795
3855
|
// Output contract
|
|
3796
|
-
receipt_schema_id:
|
|
3856
|
+
receipt_schema_id: z8.string()
|
|
3797
3857
|
});
|
|
3798
|
-
var StructuredAssumption =
|
|
3858
|
+
var StructuredAssumption = z8.object({
|
|
3799
3859
|
/** Type of assumption */
|
|
3800
3860
|
type: AssumptionType,
|
|
3801
3861
|
/** Assumption text */
|
|
3802
|
-
text:
|
|
3862
|
+
text: z8.string(),
|
|
3803
3863
|
/** Whether it was validated */
|
|
3804
|
-
validated:
|
|
3864
|
+
validated: z8.boolean().optional(),
|
|
3805
3865
|
/** Evidence supporting validation */
|
|
3806
|
-
evidence:
|
|
3866
|
+
evidence: z8.string().optional()
|
|
3807
3867
|
});
|
|
3808
|
-
var AgentClaims =
|
|
3868
|
+
var AgentClaims = z8.object({
|
|
3809
3869
|
/** Whether the task succeeded */
|
|
3810
|
-
success:
|
|
3870
|
+
success: z8.boolean(),
|
|
3811
3871
|
/** Unified diff patch */
|
|
3812
|
-
patch:
|
|
3872
|
+
patch: z8.string().optional(),
|
|
3813
3873
|
/** Files touched (repo-relative) */
|
|
3814
|
-
files_touched:
|
|
3874
|
+
files_touched: z8.array(RepoRelativePath),
|
|
3815
3875
|
/** Rationale for the fix */
|
|
3816
|
-
rationale:
|
|
3876
|
+
rationale: z8.string(),
|
|
3817
3877
|
/** Confidence level */
|
|
3818
3878
|
confidence: ConfidenceLevel2,
|
|
3819
3879
|
/** Which invariants were respected */
|
|
3820
|
-
invariants_respected:
|
|
3880
|
+
invariants_respected: z8.array(z8.string()).optional(),
|
|
3821
3881
|
/** Structured assumptions made */
|
|
3822
|
-
assumptions_made:
|
|
3882
|
+
assumptions_made: z8.array(StructuredAssumption)
|
|
3823
3883
|
});
|
|
3824
|
-
var SearchActivity =
|
|
3884
|
+
var SearchActivity = z8.object({
|
|
3825
3885
|
/** Search query */
|
|
3826
|
-
query:
|
|
3886
|
+
query: z8.string(),
|
|
3827
3887
|
/** Search method used */
|
|
3828
|
-
method:
|
|
3888
|
+
method: z8.string().optional(),
|
|
3829
3889
|
/** Roots searched (repo-relative) */
|
|
3830
|
-
roots:
|
|
3890
|
+
roots: z8.array(z8.string()),
|
|
3831
3891
|
/** Number of results found */
|
|
3832
|
-
results_count:
|
|
3892
|
+
results_count: z8.number().int().nonnegative().optional(),
|
|
3833
3893
|
/** Time taken in milliseconds */
|
|
3834
|
-
time_ms:
|
|
3894
|
+
time_ms: z8.number().nonnegative().optional()
|
|
3835
3895
|
});
|
|
3836
|
-
var TokenUsage =
|
|
3837
|
-
input:
|
|
3838
|
-
output:
|
|
3839
|
-
total:
|
|
3896
|
+
var TokenUsage = z8.object({
|
|
3897
|
+
input: z8.number().int().nonnegative(),
|
|
3898
|
+
output: z8.number().int().nonnegative(),
|
|
3899
|
+
total: z8.number().int().nonnegative()
|
|
3840
3900
|
});
|
|
3841
|
-
var CostTracking =
|
|
3901
|
+
var CostTracking = z8.object({
|
|
3842
3902
|
/** Token usage breakdown */
|
|
3843
3903
|
token_usage: TokenUsage.optional(),
|
|
3844
3904
|
/** Number of tool calls made */
|
|
3845
|
-
tool_calls_count:
|
|
3905
|
+
tool_calls_count: z8.number().int().nonnegative().optional(),
|
|
3846
3906
|
/** Elapsed time in milliseconds */
|
|
3847
|
-
elapsed_ms:
|
|
3907
|
+
elapsed_ms: z8.number().nonnegative().optional()
|
|
3848
3908
|
});
|
|
3849
|
-
var AgentVerification =
|
|
3909
|
+
var AgentVerification = z8.object({
|
|
3850
3910
|
/** Whether verification command was run */
|
|
3851
|
-
cmd_ran:
|
|
3911
|
+
cmd_ran: z8.boolean(),
|
|
3852
3912
|
/** Exit code if run */
|
|
3853
|
-
exit_code:
|
|
3913
|
+
exit_code: z8.number().int().optional(),
|
|
3854
3914
|
/** Output snippet */
|
|
3855
|
-
output_snip:
|
|
3915
|
+
output_snip: z8.string().optional()
|
|
3856
3916
|
});
|
|
3857
|
-
var TaskReceipt_v1 =
|
|
3917
|
+
var TaskReceipt_v1 = z8.object({
|
|
3858
3918
|
// Schema version
|
|
3859
|
-
schema_version:
|
|
3919
|
+
schema_version: z8.literal(TASK_CONTRACT_VERSION),
|
|
3860
3920
|
// Identity (echo from snapshot)
|
|
3861
|
-
task_id:
|
|
3921
|
+
task_id: z8.string().min(1),
|
|
3862
3922
|
snapshot_hash: SHA256HashOrPlaceholder,
|
|
3863
3923
|
// Claims (what agent says it did)
|
|
3864
3924
|
claims: AgentClaims,
|
|
3865
3925
|
// Search activity (if agent searched)
|
|
3866
|
-
search_activity:
|
|
3926
|
+
search_activity: z8.array(SearchActivity),
|
|
3867
3927
|
// Cost tracking
|
|
3868
3928
|
cost: CostTracking,
|
|
3869
3929
|
// Agent's verification attempt (still a claim)
|
|
3870
3930
|
agent_verification: AgentVerification.optional(),
|
|
3871
3931
|
// Blockers (if not successful)
|
|
3872
|
-
blockers:
|
|
3932
|
+
blockers: z8.array(z8.string())
|
|
3873
3933
|
});
|
|
3874
|
-
var DetectedFailure =
|
|
3875
|
-
type:
|
|
3876
|
-
message:
|
|
3877
|
-
file:
|
|
3878
|
-
line:
|
|
3934
|
+
var DetectedFailure = z8.object({
|
|
3935
|
+
type: z8.string(),
|
|
3936
|
+
message: z8.string(),
|
|
3937
|
+
file: z8.string().optional(),
|
|
3938
|
+
line: z8.number().int().positive().optional()
|
|
3879
3939
|
});
|
|
3880
|
-
var EngineVerification_v1 =
|
|
3940
|
+
var EngineVerification_v1 = z8.object({
|
|
3881
3941
|
// Identity
|
|
3882
|
-
task_id:
|
|
3883
|
-
timestamp:
|
|
3942
|
+
task_id: z8.string().min(1),
|
|
3943
|
+
timestamp: z8.string().datetime(),
|
|
3884
3944
|
// Hash binding (audit trail)
|
|
3885
3945
|
snapshot_hash: SHA256HashOrPlaceholder,
|
|
3886
3946
|
receipt_hash: SHA256HashOrPlaceholder,
|
|
3887
3947
|
// Verification result
|
|
3888
|
-
verified:
|
|
3948
|
+
verified: z8.boolean(),
|
|
3889
3949
|
// What engine ran
|
|
3890
|
-
cmd_ran:
|
|
3891
|
-
exit_code:
|
|
3892
|
-
stdout_snip:
|
|
3893
|
-
stderr_snip:
|
|
3950
|
+
cmd_ran: z8.string(),
|
|
3951
|
+
exit_code: z8.number().int(),
|
|
3952
|
+
stdout_snip: z8.string(),
|
|
3953
|
+
stderr_snip: z8.string(),
|
|
3894
3954
|
// Patch verification
|
|
3895
3955
|
patch_hash: SHA256HashOrPlaceholder.optional(),
|
|
3896
|
-
patch_applied:
|
|
3956
|
+
patch_applied: z8.boolean(),
|
|
3897
3957
|
// Comparison with agent claim
|
|
3898
|
-
agent_claimed:
|
|
3899
|
-
trust_gap:
|
|
3958
|
+
agent_claimed: z8.boolean(),
|
|
3959
|
+
trust_gap: z8.boolean(),
|
|
3900
3960
|
// Failures detected
|
|
3901
|
-
failures:
|
|
3961
|
+
failures: z8.array(DetectedFailure)
|
|
3902
3962
|
});
|
|
3903
3963
|
|
|
3904
3964
|
// src/gates/execution-receipt.ts
|
|
3905
3965
|
var GATE_EXECUTION_RECEIPT_SCHEMA_VERSION = "lexrunner-gate-execution-receipt/v2";
|
|
3906
3966
|
var MAX_GATE_RECEIPT_OUTPUT_BYTES = 64 * 1024;
|
|
3907
|
-
var FileIdentitySchema =
|
|
3908
|
-
path:
|
|
3909
|
-
realPath:
|
|
3910
|
-
bytes:
|
|
3911
|
-
mtimeMs:
|
|
3912
|
-
sha256:
|
|
3967
|
+
var FileIdentitySchema = z9.object({
|
|
3968
|
+
path: z9.string(),
|
|
3969
|
+
realPath: z9.string(),
|
|
3970
|
+
bytes: z9.number().int().nonnegative(),
|
|
3971
|
+
mtimeMs: z9.number().nonnegative(),
|
|
3972
|
+
sha256: z9.string().regex(/^sha256:[a-f0-9]{64}$/u)
|
|
3913
3973
|
}).strict();
|
|
3914
|
-
var OutputEvidenceSchema =
|
|
3915
|
-
bytes:
|
|
3916
|
-
sha256:
|
|
3917
|
-
truncated:
|
|
3918
|
-
content:
|
|
3974
|
+
var OutputEvidenceSchema = z9.object({
|
|
3975
|
+
bytes: z9.number().int().nonnegative(),
|
|
3976
|
+
sha256: z9.string().regex(/^sha256:[a-f0-9]{64}$/u),
|
|
3977
|
+
truncated: z9.boolean(),
|
|
3978
|
+
content: z9.string().max(MAX_GATE_RECEIPT_OUTPUT_BYTES)
|
|
3919
3979
|
}).strict();
|
|
3920
|
-
var ArtifactIdentitySchema =
|
|
3921
|
-
declaredPath:
|
|
3922
|
-
resolvedPath:
|
|
3923
|
-
status:
|
|
3980
|
+
var ArtifactIdentitySchema = z9.object({
|
|
3981
|
+
declaredPath: z9.string(),
|
|
3982
|
+
resolvedPath: z9.string(),
|
|
3983
|
+
status: z9.enum(["collected", "missing", "stale", "unsupported", "collection_error"]),
|
|
3924
3984
|
before: FileIdentitySchema.nullable(),
|
|
3925
3985
|
source: FileIdentitySchema.nullable(),
|
|
3926
|
-
retainedPath:
|
|
3986
|
+
retainedPath: z9.string().optional(),
|
|
3927
3987
|
retained: FileIdentitySchema.optional(),
|
|
3928
|
-
error:
|
|
3988
|
+
error: z9.string().optional()
|
|
3929
3989
|
}).strict();
|
|
3930
|
-
var LocalGateExecutionReceiptSchema =
|
|
3931
|
-
schemaVersion:
|
|
3932
|
-
attempt:
|
|
3933
|
-
binding:
|
|
3934
|
-
item:
|
|
3935
|
-
declaredGateDigest:
|
|
3936
|
-
candidateDigest:
|
|
3937
|
-
timeoutMs:
|
|
3990
|
+
var LocalGateExecutionReceiptSchema = z9.object({
|
|
3991
|
+
schemaVersion: z9.literal(GATE_EXECUTION_RECEIPT_SCHEMA_VERSION),
|
|
3992
|
+
attempt: z9.number().int().positive(),
|
|
3993
|
+
binding: z9.object({
|
|
3994
|
+
item: z9.string().min(1).nullable(),
|
|
3995
|
+
declaredGateDigest: z9.string().regex(/^sha256:[a-f0-9]{64}$/u),
|
|
3996
|
+
candidateDigest: z9.string().regex(/^sha256:[a-f0-9]{64}$/u).nullable(),
|
|
3997
|
+
timeoutMs: z9.number().int().positive()
|
|
3938
3998
|
}).strict(),
|
|
3939
|
-
declaredGate:
|
|
3940
|
-
name:
|
|
3941
|
-
run:
|
|
3942
|
-
cwd:
|
|
3943
|
-
runtime:
|
|
3944
|
-
artifacts:
|
|
3999
|
+
declaredGate: z9.object({
|
|
4000
|
+
name: z9.string(),
|
|
4001
|
+
run: z9.string(),
|
|
4002
|
+
cwd: z9.string().nullable(),
|
|
4003
|
+
runtime: z9.enum(["local", "container", "ci-service"]),
|
|
4004
|
+
artifacts: z9.array(z9.string())
|
|
3945
4005
|
}).strict(),
|
|
3946
|
-
execution:
|
|
3947
|
-
cwd:
|
|
3948
|
-
startedAt:
|
|
3949
|
-
finishedAt:
|
|
3950
|
-
durationMs:
|
|
3951
|
-
shell:
|
|
3952
|
-
command:
|
|
4006
|
+
execution: z9.object({
|
|
4007
|
+
cwd: z9.string(),
|
|
4008
|
+
startedAt: z9.string(),
|
|
4009
|
+
finishedAt: z9.string(),
|
|
4010
|
+
durationMs: z9.number().nonnegative(),
|
|
4011
|
+
shell: z9.object({
|
|
4012
|
+
command: z9.enum(["bash", "pwsh"]),
|
|
3953
4013
|
executable: FileIdentitySchema.nullable(),
|
|
3954
|
-
argv:
|
|
4014
|
+
argv: z9.array(z9.string()),
|
|
3955
4015
|
identityAfter: FileIdentitySchema.nullable(),
|
|
3956
|
-
unchanged:
|
|
3957
|
-
spawned:
|
|
4016
|
+
unchanged: z9.boolean(),
|
|
4017
|
+
spawned: z9.boolean()
|
|
3958
4018
|
}).strict()
|
|
3959
4019
|
}).strict(),
|
|
3960
|
-
outcome:
|
|
3961
|
-
status:
|
|
3962
|
-
exitCode:
|
|
3963
|
-
failureKind:
|
|
3964
|
-
timeoutCleanup:
|
|
3965
|
-
method:
|
|
3966
|
-
forceKilled:
|
|
3967
|
-
descendantsReaped:
|
|
4020
|
+
outcome: z9.object({
|
|
4021
|
+
status: z9.enum(["pass", "fail", "blocked", "skipped", "retrying"]),
|
|
4022
|
+
exitCode: z9.number().int().nullable(),
|
|
4023
|
+
failureKind: z9.enum(["nonzero_exit", "spawn_error", "timeout", "evidence_error"]).nullable(),
|
|
4024
|
+
timeoutCleanup: z9.object({
|
|
4025
|
+
method: z9.enum(["process-group", "taskkill", "direct-child"]),
|
|
4026
|
+
forceKilled: z9.boolean(),
|
|
4027
|
+
descendantsReaped: z9.boolean()
|
|
3968
4028
|
}).strict().nullable(),
|
|
3969
|
-
evidenceComplete:
|
|
4029
|
+
evidenceComplete: z9.boolean()
|
|
3970
4030
|
}).strict(),
|
|
3971
|
-
output:
|
|
3972
|
-
artifacts:
|
|
4031
|
+
output: z9.object({ stdout: OutputEvidenceSchema, stderr: OutputEvidenceSchema }).strict(),
|
|
4032
|
+
artifacts: z9.array(ArtifactIdentitySchema)
|
|
3973
4033
|
}).strict();
|
|
3974
4034
|
function parseLocalGateExecutionReceipt(value) {
|
|
3975
4035
|
return LocalGateExecutionReceiptSchema.parse(value);
|
|
@@ -4377,7 +4437,7 @@ async function executeLocalGate(gate, artifactDir, attempt, startedAt, startTime
|
|
|
4377
4437
|
});
|
|
4378
4438
|
}
|
|
4379
4439
|
try {
|
|
4380
|
-
const { getCommandValidator } = await import("./commandValidator-
|
|
4440
|
+
const { getCommandValidator } = await import("./commandValidator-XFVNCZXX.js");
|
|
4381
4441
|
const validator = getCommandValidator();
|
|
4382
4442
|
validator.validate(gate.run);
|
|
4383
4443
|
} catch (validationError) {
|
|
@@ -6038,6 +6098,14 @@ var GitHubClientImpl = class {
|
|
|
6038
6098
|
}
|
|
6039
6099
|
return void 0;
|
|
6040
6100
|
}
|
|
6101
|
+
async getBranchHead(branch) {
|
|
6102
|
+
const response = await this.octokit.rest.repos.getBranch({
|
|
6103
|
+
owner: this.owner,
|
|
6104
|
+
repo: this.repo,
|
|
6105
|
+
branch
|
|
6106
|
+
});
|
|
6107
|
+
return response.data.commit.sha;
|
|
6108
|
+
}
|
|
6041
6109
|
async validateRepository() {
|
|
6042
6110
|
try {
|
|
6043
6111
|
const response = await this.octokit.rest.repos.get({
|
|
@@ -6704,6 +6772,8 @@ var AutopilotLevel4 = class extends AutopilotLevel3 {
|
|
|
6704
6772
|
|
|
6705
6773
|
export {
|
|
6706
6774
|
parseTierOverrides,
|
|
6775
|
+
repositoryIdentity,
|
|
6776
|
+
FrozenGitInputs,
|
|
6707
6777
|
Policy,
|
|
6708
6778
|
Plan,
|
|
6709
6779
|
SchemaValidationError,
|