voidmachine 5.0.8 → 6.0.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/core-assets/.claude-plugin/plugin.json +12 -1
- package/core-assets/PHILOSOPHY.md +11 -1
- package/core-assets/data/catalog.v3.json +35 -35
- package/core-assets/data/certification.json +1 -1
- package/core-assets/data/model.json +34 -34
- package/core-assets/hooks/_void-hook.mjs +722 -509
- package/core-assets/hooks/outcome-meter.sh +2 -1
- package/core-assets/skills/void-autopilot/SKILL.md +3 -3
- package/core-assets/skills/void-brainstorm/SKILL.md +40 -61
- package/core-assets/skills/void-code-review/SKILL.md +23 -10
- package/core-assets/skills/void-commit-discipline/SKILL.md +8 -9
- package/core-assets/skills/void-debug/SKILL.md +9 -10
- package/core-assets/skills/void-domain-driven-design/SKILL.md +1 -1
- package/core-assets/skills/void-frontend-design/SKILL.md +1 -1
- package/core-assets/skills/void-implement/SKILL.md +60 -23
- package/core-assets/skills/void-llm-cost-discipline/SKILL.md +3 -0
- package/core-assets/skills/void-orchestrate/SKILL.md +42 -0
- package/core-assets/skills/void-plan/SKILL.md +12 -17
- package/core-assets/skills/void-qa/SKILL.md +15 -14
- package/core-assets/skills/void-tdd/SKILL.md +33 -84
- package/core-assets/skills/void-testing/SKILL.md +1 -1
- package/core-assets/skills/void-ticket/SKILL.md +2 -0
- package/core-assets/skills/void-typescript-strict/SKILL.md +5 -5
- package/core-assets/skills/void-verify/SKILL.md +57 -159
- package/dist/main.js +925 -333
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -5605,8 +5605,8 @@ var require_cst_visit = __commonJS({
|
|
|
5605
5605
|
visit3.REMOVE = REMOVE;
|
|
5606
5606
|
visit3.itemAtPath = (cst, path3) => {
|
|
5607
5607
|
let item = cst;
|
|
5608
|
-
for (const [
|
|
5609
|
-
const tok = item?.[
|
|
5608
|
+
for (const [field11, index] of path3) {
|
|
5609
|
+
const tok = item?.[field11];
|
|
5610
5610
|
if (tok && "items" in tok) {
|
|
5611
5611
|
item = tok.items[index];
|
|
5612
5612
|
} else
|
|
@@ -5616,8 +5616,8 @@ var require_cst_visit = __commonJS({
|
|
|
5616
5616
|
};
|
|
5617
5617
|
visit3.parentCollection = (cst, path3) => {
|
|
5618
5618
|
const parent = visit3.itemAtPath(cst, path3.slice(0, -1));
|
|
5619
|
-
const
|
|
5620
|
-
const coll = parent?.[
|
|
5619
|
+
const field11 = path3[path3.length - 1][0];
|
|
5620
|
+
const coll = parent?.[field11];
|
|
5621
5621
|
if (coll && "items" in coll)
|
|
5622
5622
|
return coll;
|
|
5623
5623
|
throw new Error("Parent collection not found");
|
|
@@ -5626,11 +5626,11 @@ var require_cst_visit = __commonJS({
|
|
|
5626
5626
|
let ctrl = visitor(item, path3);
|
|
5627
5627
|
if (typeof ctrl === "symbol")
|
|
5628
5628
|
return ctrl;
|
|
5629
|
-
for (const
|
|
5630
|
-
const token = item[
|
|
5629
|
+
for (const field11 of ["key", "value"]) {
|
|
5630
|
+
const token = item[field11];
|
|
5631
5631
|
if (token && "items" in token) {
|
|
5632
5632
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5633
|
-
const ci = _visit(Object.freeze(path3.concat([[
|
|
5633
|
+
const ci = _visit(Object.freeze(path3.concat([[field11, i]])), token.items[i], visitor);
|
|
5634
5634
|
if (typeof ci === "number")
|
|
5635
5635
|
i = ci - 1;
|
|
5636
5636
|
else if (ci === BREAK)
|
|
@@ -5640,7 +5640,7 @@ var require_cst_visit = __commonJS({
|
|
|
5640
5640
|
i -= 1;
|
|
5641
5641
|
}
|
|
5642
5642
|
}
|
|
5643
|
-
if (typeof ctrl === "function" &&
|
|
5643
|
+
if (typeof ctrl === "function" && field11 === "key")
|
|
5644
5644
|
ctrl = ctrl(item, path3);
|
|
5645
5645
|
}
|
|
5646
5646
|
}
|
|
@@ -16438,14 +16438,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
16438
16438
|
const shape = zod.def.shape;
|
|
16439
16439
|
const propValues = {};
|
|
16440
16440
|
for (const key in shape) {
|
|
16441
|
-
const
|
|
16442
|
-
if (
|
|
16441
|
+
const field11 = shape[key]._zod;
|
|
16442
|
+
if (field11.values) {
|
|
16443
16443
|
if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
|
|
16444
16444
|
assignProp(propValues, key, /* @__PURE__ */ new Set());
|
|
16445
16445
|
}
|
|
16446
|
-
for (const v2 of
|
|
16446
|
+
for (const v2 of field11.values)
|
|
16447
16447
|
propValues[key].add(v2);
|
|
16448
|
-
if (
|
|
16448
|
+
if (field11.optin !== void 0)
|
|
16449
16449
|
propValues[key].add(void 0);
|
|
16450
16450
|
}
|
|
16451
16451
|
}
|
|
@@ -29437,8 +29437,8 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
29437
29437
|
}
|
|
29438
29438
|
const requiredKeys = [];
|
|
29439
29439
|
for (const key of Object.keys(shape)) {
|
|
29440
|
-
const
|
|
29441
|
-
if (ctx.io === "input" ? inputOptin(
|
|
29440
|
+
const field11 = def.shape[key];
|
|
29441
|
+
if (ctx.io === "input" ? inputOptin(field11) === void 0 : field11._zod.optout === void 0) {
|
|
29442
29442
|
requiredKeys.push(key);
|
|
29443
29443
|
}
|
|
29444
29444
|
}
|
|
@@ -32864,7 +32864,7 @@ var COMMAND_CATALOG = {
|
|
|
32864
32864
|
"help": [
|
|
32865
32865
|
{
|
|
32866
32866
|
"signature": "mission <sub>",
|
|
32867
|
-
"description": "Plan a deterministic DAG, then start, resume, verify, inspect, archive, or explicitly prune an auditable local mission run."
|
|
32867
|
+
"description": "Plan a deterministic DAG, then start, resume, verify, inspect, archive, or explicitly prune an auditable local mission run. Inspect --usage adds local skill, hook and specialist counts."
|
|
32868
32868
|
}
|
|
32869
32869
|
]
|
|
32870
32870
|
},
|
|
@@ -32996,15 +32996,15 @@ var SEGMENT = /^[a-z0-9][a-z0-9._-]*$/;
|
|
|
32996
32996
|
function isRecord(value) {
|
|
32997
32997
|
return typeof value === "object" && value !== void 0 && value !== null && !Array.isArray(value);
|
|
32998
32998
|
}
|
|
32999
|
-
function segment(value,
|
|
32999
|
+
function segment(value, field11) {
|
|
33000
33000
|
if (typeof value !== "string" || !SEGMENT.test(value)) {
|
|
33001
|
-
throw new Error(`product identity: ${
|
|
33001
|
+
throw new Error(`product identity: ${field11} must be a lowercase name without separators`);
|
|
33002
33002
|
}
|
|
33003
33003
|
return value;
|
|
33004
33004
|
}
|
|
33005
|
-
function segments(value,
|
|
33006
|
-
if (!Array.isArray(value)) throw new Error(`product identity: ${
|
|
33007
|
-
return value.map((entry, index) => segment(entry, `${
|
|
33005
|
+
function segments(value, field11) {
|
|
33006
|
+
if (!Array.isArray(value)) throw new Error(`product identity: ${field11} must be a list`);
|
|
33007
|
+
return value.map((entry, index) => segment(entry, `${field11}[${index}]`));
|
|
33008
33008
|
}
|
|
33009
33009
|
function formerPackages(value) {
|
|
33010
33010
|
if (value === void 0) return [];
|
|
@@ -33020,16 +33020,16 @@ function formerPackages(value) {
|
|
|
33020
33020
|
}
|
|
33021
33021
|
var NAMESPACE = SEGMENT;
|
|
33022
33022
|
var PREFIX = /^[A-Z][A-Z0-9_]*_$/;
|
|
33023
|
-
function exclusive(current, deprecated,
|
|
33024
|
-
if (deprecated.includes(current)) throw new Error(`product identity: ${current} is both current and deprecated (${
|
|
33023
|
+
function exclusive(current, deprecated, field11) {
|
|
33024
|
+
if (deprecated.includes(current)) throw new Error(`product identity: ${current} is both current and deprecated (${field11})`);
|
|
33025
33025
|
}
|
|
33026
|
-
function pattern(value, shape,
|
|
33027
|
-
if (typeof value !== "string" || !shape.test(value)) throw new Error(`product identity: ${
|
|
33026
|
+
function pattern(value, shape, field11, rule) {
|
|
33027
|
+
if (typeof value !== "string" || !shape.test(value)) throw new Error(`product identity: ${field11} must be ${rule}`);
|
|
33028
33028
|
return value;
|
|
33029
33029
|
}
|
|
33030
|
-
function patterns(value, shape,
|
|
33031
|
-
if (!Array.isArray(value)) throw new Error(`product identity: ${
|
|
33032
|
-
return value.map((entry, index) => pattern(entry, shape, `${
|
|
33030
|
+
function patterns(value, shape, field11, rule) {
|
|
33031
|
+
if (!Array.isArray(value)) throw new Error(`product identity: ${field11} must be a list`);
|
|
33032
|
+
return value.map((entry, index) => pattern(entry, shape, `${field11}[${index}]`, rule));
|
|
33033
33033
|
}
|
|
33034
33034
|
function managed(namespaces, pair) {
|
|
33035
33035
|
const recognized = namespaces.map(pair);
|
|
@@ -36468,9 +36468,9 @@ function sameInvocation(left, right) {
|
|
|
36468
36468
|
return left.subject === right.subject && ["stage", "reviewRound", "inputHash"].every((key) => field3(left, key) === field3(right, key));
|
|
36469
36469
|
}
|
|
36470
36470
|
function admit(input2) {
|
|
36471
|
-
const { request, observation:
|
|
36471
|
+
const { request, observation: observation3, stream: journal } = input2;
|
|
36472
36472
|
const events = journal.events;
|
|
36473
|
-
if (!requestValue(request) || !observationValue(
|
|
36473
|
+
if (!requestValue(request) || !observationValue(observation3))
|
|
36474
36474
|
return refuse("invalid-migration", "Use the declared bounded migration request and observed inputs");
|
|
36475
36475
|
const lifecycle = projectMissionLifecycle(events);
|
|
36476
36476
|
if (journal.continuity !== "complete" || journal.invalidLines > 0 || journal.duplicateEventIds > 0 || lifecycle.status === "invalid")
|
|
@@ -36489,9 +36489,9 @@ function admit(input2) {
|
|
|
36489
36489
|
const recovered = validatedRecoveredReviewEvents(events);
|
|
36490
36490
|
if (!recovered.ok)
|
|
36491
36491
|
return refuse("invalid-recovery", recovered.reasons.join("; "));
|
|
36492
|
-
const declaration =
|
|
36493
|
-
const selected =
|
|
36494
|
-
if (request.migrationId !== declaration.id || selected?.contractVersion !== 2 || selected.state !== "applicable" || !selected.stages.includes("post-implementation") ||
|
|
36492
|
+
const declaration = observation3.declaration;
|
|
36493
|
+
const selected = observation3.plan.specialists.find((x3) => x3.specialistId === VISUAL);
|
|
36494
|
+
if (request.migrationId !== declaration.id || selected?.contractVersion !== 2 || selected.state !== "applicable" || !selected.stages.includes("post-implementation") || observation3.plan.context.status !== "complete" || observation3.plan.specialists.some((x3) => x3.state === "degraded") || field3(events[0], "planHash") !== observation3.plan.planHash || `runtime:${String(field3(events[0], "runtime"))}` !== observation3.expectedSource || observation3.observedFromContractSha256 !== declaration.fromContractSha256 || observation3.observedToContractSha256 !== declaration.toContractSha256 || observation3.nativeContractVersion !== 3)
|
|
36495
36495
|
return refuse("migration-contract-mismatch", "Observe the original v2 plan and declared v3 assets/native specialist");
|
|
36496
36496
|
const requested = events.filter((x3) => x3.kind === "specialist.requested" && x3.subject === VISUAL);
|
|
36497
36497
|
const episodeStart = events.find((x3) => x3.eventId === lifecycle.episodeId);
|
|
@@ -36505,23 +36505,23 @@ function admit(input2) {
|
|
|
36505
36505
|
const last = writers.at(-1);
|
|
36506
36506
|
if (!first || !last)
|
|
36507
36507
|
return refuse("missing-implementation", "Migration applies only to an implemented post-review subject");
|
|
36508
|
-
const contracts = Object.fromEntries(
|
|
36508
|
+
const contracts = Object.fromEntries(observation3.plan.specialists.map((x3) => [x3.specialistId, x3.contractVersion]));
|
|
36509
36509
|
const review = reduceReviewLoop({
|
|
36510
36510
|
events: recovered.events,
|
|
36511
36511
|
stage: "post-implementation",
|
|
36512
|
-
expectedSource:
|
|
36512
|
+
expectedSource: observation3.expectedSource,
|
|
36513
36513
|
stageStartSeqExclusive: first.seq,
|
|
36514
36514
|
afterSeqExclusive: last.seq,
|
|
36515
|
-
requiredSpecialists:
|
|
36515
|
+
requiredSpecialists: observation3.plan.specialists.filter((x3) => x3.state === "applicable" && x3.stages.includes("post-implementation")).map((x3) => x3.specialistId),
|
|
36516
36516
|
contractVersions: contracts,
|
|
36517
|
-
currentInputHashes:
|
|
36518
|
-
maxRounds:
|
|
36517
|
+
currentInputHashes: observation3.currentInputHashes,
|
|
36518
|
+
maxRounds: observation3.maxRounds
|
|
36519
36519
|
});
|
|
36520
36520
|
if (review.issues.length > 0)
|
|
36521
36521
|
return refuse("invalid-review", review.issues.map((x3) => x3.detail).join("; "));
|
|
36522
36522
|
const previous = recovered.events.filter((x3) => x3.subject === VISUAL && x3.kind === "specialist.completed" && field3(x3, "stage") === "post-implementation");
|
|
36523
36523
|
const reviewRound = review.reviewRound + (previous.some((x3) => x3.seq > last.seq) ? 1 : 0);
|
|
36524
|
-
if (reviewRound >
|
|
36524
|
+
if (reviewRound > observation3.maxRounds)
|
|
36525
36525
|
return refuse("review-budget-exhausted", "Migration grants no additional review round");
|
|
36526
36526
|
const proofs = events.flatMap((event) => {
|
|
36527
36527
|
if (event.kind !== "evidence.recorded")
|
|
@@ -36531,10 +36531,10 @@ function admit(input2) {
|
|
|
36531
36531
|
});
|
|
36532
36532
|
const obligations = reduceEvidenceObligations({
|
|
36533
36533
|
events,
|
|
36534
|
-
expectedSource:
|
|
36534
|
+
expectedSource: observation3.expectedSource,
|
|
36535
36535
|
phase: "post-implementation",
|
|
36536
36536
|
proofs,
|
|
36537
|
-
evidenceContext: { dependencies:
|
|
36537
|
+
evidenceContext: { dependencies: observation3.evidenceDependencies ?? {} }
|
|
36538
36538
|
});
|
|
36539
36539
|
if (obligations.issues.length > 0)
|
|
36540
36540
|
return refuse("invalid-evidence", obligations.issues.map((x3) => x3.detail).join("; "));
|
|
@@ -36542,7 +36542,7 @@ function admit(input2) {
|
|
|
36542
36542
|
schemaVersion: 1,
|
|
36543
36543
|
request,
|
|
36544
36544
|
requestHash: canonicalJsonHash(request),
|
|
36545
|
-
observation:
|
|
36545
|
+
observation: observation3,
|
|
36546
36546
|
...lifecycle.status === "closed" ? { recovery: {
|
|
36547
36547
|
closureEventId: lifecycle.closure.eventId,
|
|
36548
36548
|
previousEpisodeId: lifecycle.episodeId
|
|
@@ -36557,11 +36557,11 @@ function admit(input2) {
|
|
|
36557
36557
|
toVersion: 3,
|
|
36558
36558
|
fromContractSha256: declaration.fromContractSha256,
|
|
36559
36559
|
toContractSha256: declaration.toContractSha256,
|
|
36560
|
-
reviewSubjectHash:
|
|
36561
|
-
targetInputHash:
|
|
36562
|
-
nativeAgentSha256:
|
|
36560
|
+
reviewSubjectHash: observation3.reviewSubjectHash,
|
|
36561
|
+
targetInputHash: observation3.targetInputHash,
|
|
36562
|
+
nativeAgentSha256: observation3.nativeAgentSha256,
|
|
36563
36563
|
reviewRound,
|
|
36564
|
-
remainingRounds:
|
|
36564
|
+
remainingRounds: observation3.maxRounds - reviewRound + 1,
|
|
36565
36565
|
supersededRequestEventIds: requested.filter((x3) => !starts.some((start) => sameInvocation(start, x3))).map((x3) => x3.eventId),
|
|
36566
36566
|
supersededCompletionEventIds: events.filter((x3) => x3.kind === "specialist.completed" && x3.subject === VISUAL).map((x3) => x3.eventId),
|
|
36567
36567
|
pendingAuthorObligationIds: obligations.obligations.filter((x3) => x3.specialistId === VISUAL && x3.due === "current-review" && !x3.discharged).map((x3) => x3.obligationId),
|
|
@@ -36577,10 +36577,10 @@ function validatedSpecialistContractMigrations(events, plan2) {
|
|
|
36577
36577
|
return { ok: true, plan: plan2, events };
|
|
36578
36578
|
const migration = migrations[0];
|
|
36579
36579
|
const request = field3(migration, "request");
|
|
36580
|
-
const
|
|
36581
|
-
if (migrations.length !== 1 || projectMissionLifecycle(events).status === "invalid" || migration.source !== "void-harness:mission.migrate-specialist" || migration.subject !== VISUAL || !requestValue(request) || !observationValue(
|
|
36580
|
+
const observation3 = field3(migration, "observation");
|
|
36581
|
+
if (migrations.length !== 1 || projectMissionLifecycle(events).status === "invalid" || migration.source !== "void-harness:mission.migrate-specialist" || migration.subject !== VISUAL || !requestValue(request) || !observationValue(observation3) || canonicalJsonHash(observation3.plan) !== canonicalJsonHash(plan2))
|
|
36582
36582
|
return { ok: false, reasons: ["Migration receipt does not match its original plan or producer"] };
|
|
36583
|
-
const decision = admit({ stream: stream(events.slice(0, migration.seq - 1)), request, observation:
|
|
36583
|
+
const decision = admit({ stream: stream(events.slice(0, migration.seq - 1)), request, observation: observation3 });
|
|
36584
36584
|
if (decision.kind !== "migrate" || canonicalJsonHash(decision.receipt) !== canonicalJsonHash(migration.payload)) {
|
|
36585
36585
|
return { ok: false, reasons: ["Migration receipt does not reproduce admission from its journal prefix"] };
|
|
36586
36586
|
}
|
|
@@ -36616,10 +36616,10 @@ function validatedSpecialistContractMigrationBoundary(events) {
|
|
|
36616
36616
|
const migration = events.find((event) => event.kind === "specialist.contract-migrated");
|
|
36617
36617
|
if (migration === void 0)
|
|
36618
36618
|
return { ok: true };
|
|
36619
|
-
const
|
|
36620
|
-
if (!observationValue(
|
|
36619
|
+
const observation3 = field3(migration, "observation");
|
|
36620
|
+
if (!observationValue(observation3))
|
|
36621
36621
|
return { ok: false, reasons: ["Migration observation is invalid"] };
|
|
36622
|
-
const validated = validatedSpecialistContractMigrations(events,
|
|
36622
|
+
const validated = validatedSpecialistContractMigrations(events, observation3.plan);
|
|
36623
36623
|
if (!validated.ok)
|
|
36624
36624
|
return validated;
|
|
36625
36625
|
return { ok: true, ...validated.migration === void 0 ? {} : { migration: validated.migration } };
|
|
@@ -36648,10 +36648,10 @@ function matchesRequest(completion, request) {
|
|
|
36648
36648
|
}
|
|
36649
36649
|
function opaqueNativeContextDefect(input2) {
|
|
36650
36650
|
const { events } = input2.stream;
|
|
36651
|
-
const { observation:
|
|
36651
|
+
const { observation: observation3 } = input2;
|
|
36652
36652
|
const start = events[0];
|
|
36653
36653
|
const closure = events.at(-1);
|
|
36654
|
-
if (start === void 0 || closure?.kind !== "mission.closed" || closure.source !== "void-harness:mission.dispatch" || start.source !== "void-harness:mission" || field4(start, "mode") !== "team" || field4(start, "runtime") !== "codex" || field4(start, "runtimeAttested") !== true ||
|
|
36654
|
+
if (start === void 0 || closure?.kind !== "mission.closed" || closure.source !== "void-harness:mission.dispatch" || start.source !== "void-harness:mission" || field4(start, "mode") !== "team" || field4(start, "runtime") !== "codex" || field4(start, "runtimeAttested") !== true || observation3.expectedSource !== "runtime:codex" || observation3.stage !== "pre-implementation" || !/^sha256:[a-f0-9]{64}$/.test(String(field4(start, "planHash"))))
|
|
36655
36655
|
return false;
|
|
36656
36656
|
const panel = events.slice(1, -1);
|
|
36657
36657
|
if (panel.some((event) => !["specialist.requested", "specialist.started", "specialist.completed"].includes(event.kind) || field4(event, "stage") !== "pre-implementation" || field4(event, "reviewRound") !== 1))
|
|
@@ -36665,7 +36665,7 @@ function opaqueNativeContextDefect(input2) {
|
|
|
36665
36665
|
return false;
|
|
36666
36666
|
return completed.every(({ event, completion }) => {
|
|
36667
36667
|
const context2 = field4(event, "contextId");
|
|
36668
|
-
if (!validNativeContextId(context2) || event.source !==
|
|
36668
|
+
if (!validNativeContextId(context2) || event.source !== observation3.expectedSource || completion.verdict !== "pass" || completion.findings.length > 0 || completion.evidenceRequests.length > 0 || completion.limitations.length > 0 || completion.specialistId !== event.subject || completion.contractVersion !== observation3.contractVersions[event.subject] || field4(event, "contractVersion") !== completion.contractVersion || field4(event, "inputHash") !== observation3.currentInputHashes[event.subject])
|
|
36669
36669
|
return false;
|
|
36670
36670
|
const requested = requests.find((request) => matchesRequest(event, request) && request.seq < event.seq && field4(request, "planHash") === field4(start, "planHash") && field4(request, "runtime") === "codex" && field4(request, "contractVersion") === completion.contractVersion);
|
|
36671
36671
|
if (requested === void 0)
|
|
@@ -36677,18 +36677,18 @@ function opaqueNativeContextDefect(input2) {
|
|
|
36677
36677
|
}
|
|
36678
36678
|
function targetedReviewContextDefect(input2) {
|
|
36679
36679
|
const { events } = input2.stream;
|
|
36680
|
-
const { observation:
|
|
36680
|
+
const { observation: observation3 } = input2;
|
|
36681
36681
|
const start = events[0];
|
|
36682
36682
|
const closure = events.at(-1);
|
|
36683
36683
|
const current = completions(events).filter((item) => field4(item.event, "stage") === "post-implementation").at(-1);
|
|
36684
36684
|
const receipt2 = current?.completion.review;
|
|
36685
|
-
if (!start || closure?.kind !== "mission.closed" || closure.source !== "void-harness:mission.dispatch" || start.kind !== "mission.started" || start.source !== "void-harness:mission" || field4(start, "runtimeAttested") !== true ||
|
|
36685
|
+
if (!start || closure?.kind !== "mission.closed" || closure.source !== "void-harness:mission.dispatch" || start.kind !== "mission.started" || start.source !== "void-harness:mission" || field4(start, "runtimeAttested") !== true || observation3.stage !== "post-implementation" || observation3.reviewPolicy !== "bounded-corrections-v1" || !observation3.reviewSubject || !current || !receipt2 || !sameReviewSubject(receipt2, observation3.reviewSubject) || current.completion.verdict !== "pass" || current.event.source !== observation3.expectedSource || field4(current.event, "inputHash") !== observation3.currentInputHashes[current.event.subject] || current.completion.contractVersion !== observation3.contractVersions[current.event.subject])
|
|
36686
36686
|
return false;
|
|
36687
36687
|
return validNativeReviewContinuation(events, current.event);
|
|
36688
36688
|
}
|
|
36689
36689
|
function preparationInvocationReplacement(input2) {
|
|
36690
36690
|
const { events } = input2.stream;
|
|
36691
|
-
const { observation:
|
|
36691
|
+
const { observation: observation3, request } = input2;
|
|
36692
36692
|
if (request.disposition.kind !== "preparation-invocation")
|
|
36693
36693
|
return false;
|
|
36694
36694
|
const start = events[0];
|
|
@@ -36697,7 +36697,7 @@ function preparationInvocationReplacement(input2) {
|
|
|
36697
36697
|
const writers = events.filter((event) => event.kind === "lead-writer.completed");
|
|
36698
36698
|
const writer = writers[0];
|
|
36699
36699
|
const writerRequest = writerRequests[0];
|
|
36700
|
-
if (start === void 0 || start.kind !== "mission.started" || start.source !== "void-harness:mission" || !["team", "fortress"].includes(String(field4(start, "mode"))) || field4(start, "runtimeAttested") !== true || `runtime:${String(field4(start, "runtime"))}` !==
|
|
36700
|
+
if (start === void 0 || start.kind !== "mission.started" || start.source !== "void-harness:mission" || !["team", "fortress"].includes(String(field4(start, "mode"))) || field4(start, "runtimeAttested") !== true || `runtime:${String(field4(start, "runtime"))}` !== observation3.expectedSource || !/^sha256:[a-f0-9]{64}$/.test(String(field4(start, "planHash"))) || observation3.stage !== "pre-implementation" || observation3.maxRounds !== 2 || closure?.source !== "void-harness:mission.dispatch" || writer === void 0 || writerRequest === void 0 || writers.length !== 1 || writerRequests.length !== 1 || writerRequest.seq >= writer.seq || writerRequest.source !== "void-harness:mission.dispatch" || writer.subject !== field4(start, "leadWriterId") || writer.source !== writer.subject || writerRequest.subject !== writer.subject || writer.causationId !== writerRequest.eventId || field4(writer, "requestEventId") !== writerRequest.eventId || field4(writer, "actionKind") !== "run-preparation-correction" || field4(writer, "planHash") !== field4(start, "planHash") || field4(writer, "writerId") !== writer.subject || field4(writer, "implementationRound") !== 1 || !["actionKind", "planHash", "writerId", "implementationRound"].every((key) => field4(writer, key) === field4(writerRequest, key)))
|
|
36701
36701
|
return false;
|
|
36702
36702
|
const allowed = [
|
|
36703
36703
|
"mission.started",
|
|
@@ -36716,7 +36716,7 @@ function preparationInvocationReplacement(input2) {
|
|
|
36716
36716
|
];
|
|
36717
36717
|
if (events.some((event) => !allowed.includes(event.kind)))
|
|
36718
36718
|
return false;
|
|
36719
|
-
const required2 = Object.keys(
|
|
36719
|
+
const required2 = Object.keys(observation3.contractVersions);
|
|
36720
36720
|
const panel = completions(events);
|
|
36721
36721
|
const invocations = events.filter((event) => ["specialist.requested", "specialist.started", "specialist.completed"].includes(event.kind));
|
|
36722
36722
|
if (required2.length === 0 || panel.length !== required2.length * 2 || invocations.length !== panel.length * 3)
|
|
@@ -36731,13 +36731,13 @@ function preparationInvocationReplacement(input2) {
|
|
|
36731
36731
|
if (matching.length !== 1 || item === void 0)
|
|
36732
36732
|
return false;
|
|
36733
36733
|
const { event, completion } = item;
|
|
36734
|
-
if (event.source !==
|
|
36734
|
+
if (event.source !== observation3.expectedSource || field4(event, "stage") !== "pre-implementation" || completion.specialistId !== specialist || completion.contractVersion !== observation3.contractVersions[specialist] || field4(event, "contractVersion") !== completion.contractVersion || !validNativeContextId(field4(event, "contextId")) || completion.verdict !== "pass" || completion.findings.length > 0 || round === 2 && (event.seq <= writer.seq || completion.evidenceRequests.length > 0 || field4(event, "inputHash") !== observation3.currentInputHashes[specialist]) || round === 1 && event.seq >= writerRequest.seq)
|
|
36735
36735
|
return false;
|
|
36736
36736
|
const requests = invocations.filter((candidate) => matchesRequest(event, candidate));
|
|
36737
36737
|
const requested = requests[0];
|
|
36738
36738
|
const starts = invocations.filter((candidate) => candidate.kind === "specialist.started" && candidate.subject === specialist && field4(candidate, "reviewRound") === round);
|
|
36739
36739
|
const started = starts[0];
|
|
36740
|
-
if (requests.length !== 1 || starts.length !== 1 || requested === void 0 || started === void 0 || requested.seq >= started.seq || started.seq >= event.seq || round === 2 && requested.seq <= writer.seq || started.source !==
|
|
36740
|
+
if (requests.length !== 1 || starts.length !== 1 || requested === void 0 || started === void 0 || requested.seq >= started.seq || started.seq >= event.seq || round === 2 && requested.seq <= writer.seq || started.source !== observation3.expectedSource || field4(requested, "planHash") !== field4(start, "planHash") || field4(requested, "runtime") !== field4(start, "runtime") || field4(requested, "contractVersion") !== completion.contractVersion || !["stage", "reviewRound", "inputHash", "contractVersion", "contextId"].every((key) => field4(started, key) === field4(event, key)))
|
|
36741
36741
|
return false;
|
|
36742
36742
|
}
|
|
36743
36743
|
}
|
|
@@ -36749,12 +36749,12 @@ function preparationInvocationReplacement(input2) {
|
|
|
36749
36749
|
});
|
|
36750
36750
|
const obligations = reduceEvidenceObligations({
|
|
36751
36751
|
events,
|
|
36752
|
-
expectedSource:
|
|
36752
|
+
expectedSource: observation3.expectedSource,
|
|
36753
36753
|
phase: "pre-implementation",
|
|
36754
36754
|
proofs,
|
|
36755
36755
|
evidenceContext: {
|
|
36756
36756
|
missionId: start.missionId,
|
|
36757
|
-
dependencies:
|
|
36757
|
+
dependencies: observation3.evidenceDependencies ?? {}
|
|
36758
36758
|
}
|
|
36759
36759
|
});
|
|
36760
36760
|
if (obligations.issues.length > 0 || obligations.blockingObligationIds.length > 0)
|
|
@@ -36762,13 +36762,13 @@ function preparationInvocationReplacement(input2) {
|
|
|
36762
36762
|
const review = reduceReviewLoop({
|
|
36763
36763
|
events,
|
|
36764
36764
|
stage: "pre-implementation",
|
|
36765
|
-
expectedSource:
|
|
36765
|
+
expectedSource: observation3.expectedSource,
|
|
36766
36766
|
stageStartSeqExclusive: start.seq,
|
|
36767
36767
|
afterSeqExclusive: writer.seq,
|
|
36768
36768
|
requiredSpecialists: required2.filter(specialistId2),
|
|
36769
|
-
contractVersions:
|
|
36770
|
-
currentInputHashes:
|
|
36771
|
-
maxRounds:
|
|
36769
|
+
contractVersions: observation3.contractVersions,
|
|
36770
|
+
currentInputHashes: observation3.currentInputHashes,
|
|
36771
|
+
maxRounds: observation3.maxRounds
|
|
36772
36772
|
});
|
|
36773
36773
|
return review.issues.length === ids.length && review.issues.every((issue4) => issue4.code === "reused-context" && ids.includes(issue4.eventId) && events.some((event) => event.eventId === issue4.eventId && event.seq > writer.seq));
|
|
36774
36774
|
}
|
|
@@ -36836,33 +36836,33 @@ function specialistId2(value) {
|
|
|
36836
36836
|
}
|
|
36837
36837
|
function validProvenanceRecovery(input2, existing, afterSeqExclusive = 0) {
|
|
36838
36838
|
const disposition = input2.request.disposition;
|
|
36839
|
-
const
|
|
36840
|
-
const bindings =
|
|
36841
|
-
if (disposition.kind !== "review-provenance" ||
|
|
36839
|
+
const observation3 = input2.observation;
|
|
36840
|
+
const bindings = observation3.reviewBindings;
|
|
36841
|
+
if (disposition.kind !== "review-provenance" || observation3.stage !== "post-implementation" || observation3.reviewSubject === void 0 || bindings === void 0 || bindings.length === 0 || bindings.length !== disposition.completionEventIds.length || new Set(disposition.completionEventIds).size !== bindings.length || observation3.resolutionArtifact?.path !== disposition.resolutionArtifact.path || observation3.resolutionArtifact.sha256 !== disposition.resolutionArtifact.sha256)
|
|
36842
36842
|
return false;
|
|
36843
36843
|
const events = input2.stream.events;
|
|
36844
36844
|
const start = events[0];
|
|
36845
36845
|
if (start === void 0)
|
|
36846
36846
|
return false;
|
|
36847
36847
|
const writerId = field4(start, "leadWriterId");
|
|
36848
|
-
const observedSubject =
|
|
36848
|
+
const observedSubject = observation3.reviewSubject;
|
|
36849
36849
|
return bindings.every((binding3) => {
|
|
36850
36850
|
const original = existing.find((item) => item.event.eventId === binding3.completionEventId);
|
|
36851
|
-
if (parseReviewReceipt(binding3.review) === void 0 || original === void 0 || original.event.seq <= afterSeqExclusive || !disposition.completionEventIds.includes(binding3.completionEventId) || original.event.subject !== "core:independent-code-reviewer" || original.event.source !==
|
|
36851
|
+
if (parseReviewReceipt(binding3.review) === void 0 || original === void 0 || original.event.seq <= afterSeqExclusive || !disposition.completionEventIds.includes(binding3.completionEventId) || original.event.subject !== "core:independent-code-reviewer" || original.event.source !== observation3.expectedSource || original.completion.verdict !== "pass" || original.completion.findings.some((finding) => finding.classification !== "advisory") || original.completion.contractVersion !== observation3.contractVersions[original.event.subject] || field4(original.event, "inputHash") !== observation3.currentInputHashes[original.event.subject] || canonicalJsonHash(original.completion) !== binding3.completionHash || !sameReviewSubject(binding3.review, observedSubject) || binding3.review.taskId !== original.event.missionId || binding3.review.writerId !== writerId || binding3.review.provenance.kind !== "native-context" || binding3.review.provenance.contextId !== field4(original.event, "contextId"))
|
|
36852
36852
|
return false;
|
|
36853
|
-
const requested = events.find((event) => event.seq > afterSeqExclusive && event.seq < original.event.seq && matchesRequest(original.event, event) && field4(event, "contractVersion") === original.completion.contractVersion && `runtime:${String(field4(event, "runtime"))}` ===
|
|
36854
|
-
return requested !== void 0 && events.some((event) => event.kind === "specialist.started" && event.source ===
|
|
36853
|
+
const requested = events.find((event) => event.seq > afterSeqExclusive && event.seq < original.event.seq && matchesRequest(original.event, event) && field4(event, "contractVersion") === original.completion.contractVersion && `runtime:${String(field4(event, "runtime"))}` === observation3.expectedSource);
|
|
36854
|
+
return requested !== void 0 && events.some((event) => event.kind === "specialist.started" && event.source === observation3.expectedSource && event.subject === original.event.subject && event.seq > requested.seq && event.seq < original.event.seq && ["stage", "reviewRound", "inputHash", "contractVersion", "contextId"].every((key) => field4(event, key) === field4(original.event, key)));
|
|
36855
36855
|
});
|
|
36856
36856
|
}
|
|
36857
36857
|
function pendingPreparationClarification(input2, previousRecovery) {
|
|
36858
|
-
const { stream: stream2, request, observation:
|
|
36858
|
+
const { stream: stream2, request, observation: observation3 } = input2;
|
|
36859
36859
|
const precedingRecovery = stream2.events.filter((event) => event.kind === "mission.recovered" && event.seq < previousRecovery.seq).at(-1);
|
|
36860
36860
|
if (precedingRecovery !== void 0 && !stream2.events.some((event) => event.kind === "lead-writer.completed" && event.seq > precedingRecovery.seq && event.seq < previousRecovery.seq))
|
|
36861
36861
|
return false;
|
|
36862
36862
|
const priorRequest = field4(previousRecovery, "request");
|
|
36863
36863
|
const priorDisposition = priorRequest !== void 0 && record10(priorRequest) ? priorRequest["disposition"] : void 0;
|
|
36864
36864
|
const priorObservation = field4(previousRecovery, "observation");
|
|
36865
|
-
if (
|
|
36865
|
+
if (observation3.stage !== "pre-implementation" || request.disposition.kind !== "review-blocker" || field4(previousRecovery, "nextAction") !== "clarification" || priorObservation === void 0 || !record10(priorObservation) || priorObservation["stage"] !== "pre-implementation" || priorDisposition === void 0 || !record10(priorDisposition) || priorDisposition["kind"] !== "review-blocker" || canonicalJsonHash(priorDisposition["completionEventIds"]) !== canonicalJsonHash(request.disposition.completionEventIds))
|
|
36866
36866
|
return false;
|
|
36867
36867
|
const intervening = stream2.events.filter((event) => event.seq > previousRecovery.seq);
|
|
36868
36868
|
if (intervening.length !== 1 || intervening[0]?.kind !== "mission.closed" || intervening[0].source !== "void-harness:mission.dispatch")
|
|
@@ -36875,10 +36875,10 @@ function pendingPreparationClarification(input2, previousRecovery) {
|
|
|
36875
36875
|
});
|
|
36876
36876
|
const obligations = reduceEvidenceObligations({
|
|
36877
36877
|
events: stream2.events,
|
|
36878
|
-
expectedSource:
|
|
36878
|
+
expectedSource: observation3.expectedSource,
|
|
36879
36879
|
phase: "pre-implementation",
|
|
36880
36880
|
proofs,
|
|
36881
|
-
evidenceContext: { dependencies:
|
|
36881
|
+
evidenceContext: { dependencies: observation3.evidenceDependencies ?? {} }
|
|
36882
36882
|
});
|
|
36883
36883
|
const blocking = new Set(obligations.blockingObligationIds);
|
|
36884
36884
|
const completionEventIds = request.disposition.completionEventIds;
|
|
@@ -36934,7 +36934,7 @@ function validEvidenceDispositionRecovery(input2) {
|
|
|
36934
36934
|
});
|
|
36935
36935
|
}
|
|
36936
36936
|
function admitStoppedMission(input2, projectedHistory = input2.stream.events) {
|
|
36937
|
-
const { stream: stream2, request, observation:
|
|
36937
|
+
const { stream: stream2, request, observation: observation3 } = input2;
|
|
36938
36938
|
const events = stream2.events;
|
|
36939
36939
|
if (stream2.continuity !== "complete" || stream2.duplicateEventIds > 0 || stream2.invalidLines > 0) {
|
|
36940
36940
|
return refuse2("invalid-journal", "Restore a complete unambiguous original journal before recovery");
|
|
@@ -36954,7 +36954,7 @@ function admitStoppedMission(input2, projectedHistory = input2.stream.events) {
|
|
|
36954
36954
|
if (request.disposition.kind === "evidence-disposition" && !validEvidenceDispositionRecovery(input2)) {
|
|
36955
36955
|
return refuse2("invalid-evidence-disposition", "Complete a pending pre-stop author invocation with fresh canonical proofs; an old or unstarted response cannot reopen this episode");
|
|
36956
36956
|
}
|
|
36957
|
-
const existing = completions(events).filter((item) => field4(item.event, "stage") ===
|
|
36957
|
+
const existing = completions(events).filter((item) => field4(item.event, "stage") === observation3.stage);
|
|
36958
36958
|
const previousRecovery = events.filter((event) => event.kind === "mission.recovered").at(-1);
|
|
36959
36959
|
if (previousRecovery !== void 0 && !events.some((event) => event.seq > previousRecovery.seq && event.kind === "lead-writer.completed") && !pendingPreparationClarification(input2, previousRecovery) && !validEvidenceDispositionRecovery(input2) && !validProvenanceRecovery(input2, existing, previousRecovery.seq)) {
|
|
36960
36960
|
return refuse2("no-recovery-progress", "Record actual corrective progress before reopening another stopped episode");
|
|
@@ -36974,16 +36974,16 @@ function admitStoppedMission(input2, projectedHistory = input2.stream.events) {
|
|
|
36974
36974
|
return refuse2("invalid-review-provenance", "Preserve the actual independent invocation, exact subject, original passing result and contract; provenance cannot upgrade degraded evidence");
|
|
36975
36975
|
}
|
|
36976
36976
|
if (disposition.kind === "command-correction") {
|
|
36977
|
-
if (
|
|
36977
|
+
if (observation3.resolutionArtifact?.path !== disposition.resolutionArtifact.path || observation3.resolutionArtifact.sha256 !== disposition.resolutionArtifact.sha256) {
|
|
36978
36978
|
return refuse2("stale-resolution-artifact", "Read and hash the command correction artifact again before recovery");
|
|
36979
36979
|
}
|
|
36980
|
-
if (!validCommandEvidenceCorrections(events, disposition.pairs,
|
|
36980
|
+
if (!validCommandEvidenceCorrections(events, disposition.pairs, observation3.evidenceDependencies ?? {})) {
|
|
36981
36981
|
return refuse2("invalid-command-correction", "Name intact fresh command proofs with exact argv correspondence; exit 127 or a matching basename cannot authorize replacement");
|
|
36982
36982
|
}
|
|
36983
36983
|
}
|
|
36984
36984
|
if (disposition.kind === "review-blocker") {
|
|
36985
36985
|
let eligible = existing;
|
|
36986
|
-
if (
|
|
36986
|
+
if (observation3.stage === "post-implementation" && disposition.completionEventIds.some((id3) => !existing.some((item) => item.event.eventId === id3))) {
|
|
36987
36987
|
const proofs = events.flatMap((event) => {
|
|
36988
36988
|
if (event.kind !== "evidence.recorded")
|
|
36989
36989
|
return [];
|
|
@@ -36992,43 +36992,43 @@ function admitStoppedMission(input2, projectedHistory = input2.stream.events) {
|
|
|
36992
36992
|
});
|
|
36993
36993
|
const obligations = reduceEvidenceObligations({
|
|
36994
36994
|
events,
|
|
36995
|
-
expectedSource:
|
|
36996
|
-
phase:
|
|
36995
|
+
expectedSource: observation3.expectedSource,
|
|
36996
|
+
phase: observation3.stage,
|
|
36997
36997
|
proofs,
|
|
36998
36998
|
evidenceContext: {
|
|
36999
36999
|
missionId: events[0].missionId,
|
|
37000
|
-
dependencies:
|
|
37000
|
+
dependencies: observation3.evidenceDependencies ?? {}
|
|
37001
37001
|
}
|
|
37002
37002
|
});
|
|
37003
37003
|
if (obligations.issues.length > 0)
|
|
37004
37004
|
return refuse2("invalid-evidence", "Resolve invalid author dispositions before requesting recovery");
|
|
37005
37005
|
const blocking = new Set(obligations.blockingObligationIds);
|
|
37006
37006
|
const owners = new Set(obligations.obligations.filter((item) => blocking.has(item.obligationId)).map((item) => item.completionEventId));
|
|
37007
|
-
eligible = [...existing, ...completions(events).filter((item) => field4(item.event, "stage") === "pre-implementation" && owners.has(item.event.eventId) &&
|
|
37007
|
+
eligible = [...existing, ...completions(events).filter((item) => field4(item.event, "stage") === "pre-implementation" && owners.has(item.event.eventId) && observation3.contractVersions[item.event.subject] !== void 0)];
|
|
37008
37008
|
}
|
|
37009
37009
|
const blockers = eligible.filter(({ event, completion }) => disposition.completionEventIds.includes(event.eventId) && (completion.verdict !== "pass" || completion.findings.length > 0 || completion.evidenceRequests.length > 0 || completion.limitations.length > 0));
|
|
37010
37010
|
if (blockers.length !== disposition.completionEventIds.length || blockers.length === 0 || new Set(disposition.completionEventIds).size !== blockers.length) {
|
|
37011
37011
|
return refuse2("missing-review-blocker", "Name existing unresolved review completions before requesting clarification");
|
|
37012
37012
|
}
|
|
37013
|
-
if (
|
|
37013
|
+
if (observation3.resolutionArtifact?.path !== disposition.resolutionArtifact.path || observation3.resolutionArtifact.sha256 !== disposition.resolutionArtifact.sha256) {
|
|
37014
37014
|
return refuse2("stale-resolution-artifact", "Read and hash the resolution artifact again before recovery");
|
|
37015
37015
|
}
|
|
37016
37016
|
}
|
|
37017
37017
|
const projected = applyRoundCorrections(projectedHistory, roundCorrections).filter((event) => !inadmissible.includes(event.eventId));
|
|
37018
|
-
const required2 = Object.keys(
|
|
37018
|
+
const required2 = Object.keys(observation3.contractVersions).filter(specialistId2);
|
|
37019
37019
|
const writers = projected.filter((event) => event.kind === "lead-writer.completed");
|
|
37020
|
-
const stageStart =
|
|
37021
|
-
const lastWriter =
|
|
37020
|
+
const stageStart = observation3.stage === "post-implementation" ? writers.find((event) => field4(event, "actionKind") !== "run-preparation-correction")?.seq : replacement ? events[0]?.seq : void 0;
|
|
37021
|
+
const lastWriter = observation3.stage === "post-implementation" || replacement ? writers.at(-1)?.seq : void 0;
|
|
37022
37022
|
const migration = validatedSpecialistContractMigrationBoundary(events);
|
|
37023
37023
|
if (!migration.ok)
|
|
37024
37024
|
return refuse2("invalid-migration-receipt", migration.reasons.join("; "));
|
|
37025
|
-
const boundary =
|
|
37026
|
-
if (boundary !== void 0 &&
|
|
37025
|
+
const boundary = observation3.stage === "post-implementation" ? migration.migration : void 0;
|
|
37026
|
+
if (boundary !== void 0 && observation3.contractVersions[boundary.receipt.specialistId] !== boundary.receipt.toVersion) {
|
|
37027
37027
|
return refuse2("inconsistent-review", "Recovery must observe the authenticated effective specialist contract");
|
|
37028
37028
|
}
|
|
37029
37029
|
const reviewInput = {
|
|
37030
|
-
stage:
|
|
37031
|
-
expectedSource:
|
|
37030
|
+
stage: observation3.stage,
|
|
37031
|
+
expectedSource: observation3.expectedSource,
|
|
37032
37032
|
...boundary === void 0 ? {} : { contractMigration: {
|
|
37033
37033
|
specialistId: boundary.receipt.specialistId,
|
|
37034
37034
|
afterSeq: boundary.seq,
|
|
@@ -37037,12 +37037,12 @@ function admitStoppedMission(input2, projectedHistory = input2.stream.events) {
|
|
|
37037
37037
|
...stageStart === void 0 ? {} : { stageStartSeqExclusive: stageStart },
|
|
37038
37038
|
...lastWriter === void 0 ? {} : { afterSeqExclusive: lastWriter },
|
|
37039
37039
|
requiredSpecialists: required2,
|
|
37040
|
-
contractVersions:
|
|
37041
|
-
currentInputHashes:
|
|
37040
|
+
contractVersions: observation3.contractVersions,
|
|
37041
|
+
currentInputHashes: observation3.currentInputHashes,
|
|
37042
37042
|
...targetedContext ? { validProofIds: freshReviewProofIds(projected, {
|
|
37043
|
-
dependencies:
|
|
37043
|
+
dependencies: observation3.evidenceDependencies ?? {}
|
|
37044
37044
|
}) } : {},
|
|
37045
|
-
...
|
|
37045
|
+
...observation3.reviewPolicy === "bounded-corrections-v1" ? BOUNDED_REVIEW_BUDGET : { maxRounds: observation3.maxRounds }
|
|
37046
37046
|
};
|
|
37047
37047
|
const originalReview = reduceReviewLoop({ ...reviewInput, events: projectedHistory });
|
|
37048
37048
|
if (originalReview.issues.some((issue4) => replacement ? issue4.code !== "reused-context" || !inadmissible.includes(issue4.eventId) : issue4.code !== "wrong-review-round")) {
|
|
@@ -37058,14 +37058,14 @@ function admitStoppedMission(input2, projectedHistory = input2.stream.events) {
|
|
|
37058
37058
|
if (targetedContext && !review.readyForVerdict) {
|
|
37059
37059
|
return refuse2("unproven-controller-defect", "The retained targeted review must resolve every blocking finding with current evidence before verification");
|
|
37060
37060
|
}
|
|
37061
|
-
const consumedRounds = Math.max(0, ...(replacement ? projectedHistory : projected).filter((event) => ["specialist.completed", "specialist.failed"].includes(event.kind) && field4(event, "stage") ===
|
|
37061
|
+
const consumedRounds = Math.max(0, ...(replacement ? projectedHistory : projected).filter((event) => ["specialist.completed", "specialist.failed"].includes(event.kind) && field4(event, "stage") === observation3.stage).map((event) => Number(field4(event, "reviewRound"))));
|
|
37062
37062
|
if (!replacement && !targetedContext && disposition.kind !== "review-provenance" && consumedRounds >= reviewInput.maxRounds)
|
|
37063
37063
|
return refuse2("review-budget-exhausted", "The real review budget is exhausted; recovery cannot reset it");
|
|
37064
37064
|
const consumedCorrectionBatches = projected.filter((event) => event.kind === "lead-writer.completed" && field4(event, "actionKind") === "run-correction").length;
|
|
37065
37065
|
if ((targetedContext || disposition.kind === "review-provenance") && consumedCorrectionBatches > 2) {
|
|
37066
37066
|
return refuse2("review-budget-exhausted", "The real correction budget is exhausted; recovery cannot reset it");
|
|
37067
37067
|
}
|
|
37068
|
-
const preserved = targetedContext ? existing : existing.filter((item) => !inadmissible.includes(item.event.eventId) && item.completion.contractVersion ===
|
|
37068
|
+
const preserved = targetedContext ? existing : existing.filter((item) => !inadmissible.includes(item.event.eventId) && item.completion.contractVersion === observation3.contractVersions[item.event.subject] && field4(item.event, "inputHash") === observation3.currentInputHashes[item.event.subject]);
|
|
37069
37069
|
const preservedIds = new Set(preserved.map((item) => item.event.eventId));
|
|
37070
37070
|
const receipt2 = {
|
|
37071
37071
|
schemaVersion: 1,
|
|
@@ -37075,7 +37075,7 @@ function admitStoppedMission(input2, projectedHistory = input2.stream.events) {
|
|
|
37075
37075
|
priorJournalLastSeq: stream2.lastSeq,
|
|
37076
37076
|
requestHash: canonicalJsonHash(request),
|
|
37077
37077
|
request,
|
|
37078
|
-
observation:
|
|
37078
|
+
observation: observation3,
|
|
37079
37079
|
preservedCompletionEventIds: [...preservedIds],
|
|
37080
37080
|
invalidatedCompletionEventIds: existing.filter((item) => !preservedIds.has(item.event.eventId)).map((item) => item.event.eventId),
|
|
37081
37081
|
inadmissibleCompletionEventIds: inadmissible,
|
|
@@ -37163,11 +37163,11 @@ function validateRecoveries(events) {
|
|
|
37163
37163
|
if (event.kind !== "mission.recovered")
|
|
37164
37164
|
continue;
|
|
37165
37165
|
const request = field4(event, "request");
|
|
37166
|
-
const
|
|
37167
|
-
if (event.source !== "void-harness:mission.recover" || !recoveryRequest(request) || !recoveryObservation(
|
|
37166
|
+
const observation3 = field4(event, "observation");
|
|
37167
|
+
if (event.source !== "void-harness:mission.recover" || !recoveryRequest(request) || !recoveryObservation(observation3))
|
|
37168
37168
|
return void 0;
|
|
37169
37169
|
const prefix = events.slice(0, index);
|
|
37170
|
-
const decision = admitStoppedMission({ stream: streamFrom(prefix), request, observation:
|
|
37170
|
+
const decision = admitStoppedMission({ stream: streamFrom(prefix), request, observation: observation3 }, projectRecoveries(prefix, validated));
|
|
37171
37171
|
if (decision.kind !== "recover" || canonicalJsonHash(decision.receipt) !== canonicalJsonHash(event.payload))
|
|
37172
37172
|
return void 0;
|
|
37173
37173
|
validated.push({ event, receipt: decision.receipt });
|
|
@@ -37451,18 +37451,18 @@ function label3(value, min, max) {
|
|
|
37451
37451
|
}
|
|
37452
37452
|
return true;
|
|
37453
37453
|
}
|
|
37454
|
-
function stringList2(value,
|
|
37454
|
+
function stringList2(value, field11) {
|
|
37455
37455
|
if (value === void 0)
|
|
37456
37456
|
return Object.freeze([]);
|
|
37457
37457
|
if (!Array.isArray(value) || value.length > MAX_POLICY_SIGNALS) {
|
|
37458
|
-
return `${
|
|
37458
|
+
return `${field11} must be an array of at most ${MAX_POLICY_SIGNALS} signals`;
|
|
37459
37459
|
}
|
|
37460
37460
|
if (!value.every((item) => label3(item, 1, 64) && SIGNAL_ID.test(item))) {
|
|
37461
|
-
return `${
|
|
37461
|
+
return `${field11} contains an invalid signal`;
|
|
37462
37462
|
}
|
|
37463
37463
|
const values = [...value].sort();
|
|
37464
37464
|
if (new Set(values).size !== values.length) {
|
|
37465
|
-
return `${
|
|
37465
|
+
return `${field11} contains duplicate signals`;
|
|
37466
37466
|
}
|
|
37467
37467
|
return Object.freeze(values);
|
|
37468
37468
|
}
|
|
@@ -37566,9 +37566,9 @@ function parseWaiver(value, index) {
|
|
|
37566
37566
|
expiresAt: raw["expiresAt"]
|
|
37567
37567
|
});
|
|
37568
37568
|
}
|
|
37569
|
-
function parseItems(value, maximum,
|
|
37569
|
+
function parseItems(value, maximum, field11, parser) {
|
|
37570
37570
|
if (!Array.isArray(value) || value.length === 0 || value.length > maximum) {
|
|
37571
|
-
return `${
|
|
37571
|
+
return `${field11} must contain 1 to ${maximum} entries`;
|
|
37572
37572
|
}
|
|
37573
37573
|
const parsed = [];
|
|
37574
37574
|
for (const [index, item] of value.entries()) {
|
|
@@ -37965,12 +37965,12 @@ var MAX_RISK_STACK_ITEMS = 64;
|
|
|
37965
37965
|
function utf8Bytes3(value) {
|
|
37966
37966
|
return new TextEncoder().encode(value).byteLength;
|
|
37967
37967
|
}
|
|
37968
|
-
function assertBoundedList(values, maximum,
|
|
37968
|
+
function assertBoundedList(values, maximum, field11) {
|
|
37969
37969
|
if (values.length > maximum) {
|
|
37970
|
-
throw new Error(`RISK_INPUT_TOO_LARGE: ${
|
|
37970
|
+
throw new Error(`RISK_INPUT_TOO_LARGE: ${field11} exceeds ${maximum} entries`);
|
|
37971
37971
|
}
|
|
37972
37972
|
if (values.some((value) => utf8Bytes3(value) > 512)) {
|
|
37973
|
-
throw new Error(`RISK_INPUT_TOO_LARGE: ${
|
|
37973
|
+
throw new Error(`RISK_INPUT_TOO_LARGE: ${field11} contains an entry over 512 bytes`);
|
|
37974
37974
|
}
|
|
37975
37975
|
}
|
|
37976
37976
|
function assertBounded(input2) {
|
|
@@ -38570,9 +38570,9 @@ function bounded(value, minimum, maximum) {
|
|
|
38570
38570
|
}
|
|
38571
38571
|
return true;
|
|
38572
38572
|
}
|
|
38573
|
-
function normalizeList(values, maximum,
|
|
38573
|
+
function normalizeList(values, maximum, field11) {
|
|
38574
38574
|
if (values.length > maximum || values.some((value) => !bounded(value, 1, 512))) {
|
|
38575
|
-
throw new Error(`MISSION_INPUT_INVALID: ${
|
|
38575
|
+
throw new Error(`MISSION_INPUT_INVALID: ${field11} is not bounded`);
|
|
38576
38576
|
}
|
|
38577
38577
|
return Object.freeze([...new Set(values)].sort());
|
|
38578
38578
|
}
|
|
@@ -38985,17 +38985,17 @@ function recoveredPreparationTargets(events) {
|
|
|
38985
38985
|
if (recovery === void 0)
|
|
38986
38986
|
return void 0;
|
|
38987
38987
|
const payload = record15(recovery.payload);
|
|
38988
|
-
const
|
|
38988
|
+
const observation3 = record15(payload?.["observation"] ?? null);
|
|
38989
38989
|
const request = record15(payload?.["request"] ?? null);
|
|
38990
38990
|
const disposition = record15(request?.["disposition"] ?? null);
|
|
38991
38991
|
const ids = disposition?.["completionEventIds"];
|
|
38992
|
-
if (
|
|
38992
|
+
if (observation3?.["stage"] !== "pre-implementation" || !["review-blocker", "preparation-invocation"].includes(String(disposition?.["kind"])) || !Array.isArray(ids))
|
|
38993
38993
|
return void 0;
|
|
38994
38994
|
return {
|
|
38995
38995
|
recoverySeq: recovery.seq,
|
|
38996
38996
|
replacement: disposition?.["kind"] === "preparation-invocation",
|
|
38997
|
-
inputHashes: record15(
|
|
38998
|
-
contractVersions: record15(
|
|
38997
|
+
inputHashes: record15(observation3["currentInputHashes"] ?? {}) ?? {},
|
|
38998
|
+
contractVersions: record15(observation3["contractVersions"] ?? {}) ?? {},
|
|
38999
38999
|
specialistIds: events.filter((item) => item.kind === "specialist.completed" && ids.includes(item.eventId)).map((item) => item.subject)
|
|
39000
39000
|
};
|
|
39001
39001
|
}
|
|
@@ -39015,10 +39015,10 @@ function pendingRecoveredCorrectionFindingIds(events) {
|
|
|
39015
39015
|
if (recovery === void 0 || events.some((event) => event.seq > recovery.seq && event.kind === "lead-writer.completed"))
|
|
39016
39016
|
return [];
|
|
39017
39017
|
const payload = record15(recovery.payload);
|
|
39018
|
-
const
|
|
39018
|
+
const observation3 = record15(payload?.["observation"] ?? null);
|
|
39019
39019
|
const invalidated = payload?.["invalidatedCompletionEventIds"];
|
|
39020
39020
|
const remaining = payload?.["remainingRounds"];
|
|
39021
|
-
if (payload?.["nextAction"] !== "correction" ||
|
|
39021
|
+
if (payload?.["nextAction"] !== "correction" || observation3?.["stage"] !== "post-implementation" || typeof remaining !== "number" || remaining < 1 || !Array.isArray(invalidated))
|
|
39022
39022
|
return [];
|
|
39023
39023
|
return [...new Set(events.flatMap((event) => {
|
|
39024
39024
|
if (event.kind !== "specialist.completed" || event.seq >= recovery.seq || !invalidated.includes(event.eventId) || lifecycleField(event, "stage") !== "post-implementation")
|
|
@@ -40369,9 +40369,9 @@ var LOGICAL = /^[A-Za-z0-9._~:/-]{1,256}$/;
|
|
|
40369
40369
|
function isGraphRelationKind(value) {
|
|
40370
40370
|
return SEGMENT2.test(value) || value === "decided_by" || value === "constrained_by" || value === "verified_by";
|
|
40371
40371
|
}
|
|
40372
|
-
function segment2(value,
|
|
40372
|
+
function segment2(value, field11) {
|
|
40373
40373
|
if (!SEGMENT2.test(value)) {
|
|
40374
|
-
throw new Error(`GRAPH_ID_INVALID: ${
|
|
40374
|
+
throw new Error(`GRAPH_ID_INVALID: ${field11} must be a lower-case namespace segment`);
|
|
40375
40375
|
}
|
|
40376
40376
|
return value;
|
|
40377
40377
|
}
|
|
@@ -42685,8 +42685,11 @@ var manifestSchema = external_exports.object({ hooks: external_exports.record(ex
|
|
|
42685
42685
|
matcher: external_exports.string().max(500).optional(),
|
|
42686
42686
|
hooks: external_exports.array(external_exports.object({ type: external_exports.string(), command: external_exports.string().max(2e3) })).max(100)
|
|
42687
42687
|
})).max(100)) });
|
|
42688
|
+
function hookRunnerCommand(wrapper) {
|
|
42689
|
+
return /^\s*(?:exec "\$NODE_BIN"|node) "(?:\$HOOK_DIR\/_void-hook\.mjs|\$RUNNER)" ((?:enforce|lifecycle) [a-z-]+|activation|outcome)(?:\s|$)/m.exec(wrapper)?.[1];
|
|
42690
|
+
}
|
|
42688
42691
|
function hookWiring(name, wrapper, manifests) {
|
|
42689
|
-
const runner2 =
|
|
42692
|
+
const runner2 = hookRunnerCommand(wrapper);
|
|
42690
42693
|
return manifests.flatMap(({ runtime: runtime2, value }) => Object.entries(manifestSchema.parse(value).hooks).flatMap(([event, groups]) => groups.filter((group) => group.hooks.some((hook) => {
|
|
42691
42694
|
if (hook.type !== "command") return false;
|
|
42692
42695
|
const nodeCall = /^node "\$\{(?:CLAUDE_PLUGIN_ROOT|VOID_HOOKS_DIR)\}\/(?:hooks\/)?_void-hook\.mjs" ([a-z-]+(?: [a-z-]+)*)$/.exec(hook.command)?.[1];
|
|
@@ -42695,7 +42698,7 @@ function hookWiring(name, wrapper, manifests) {
|
|
|
42695
42698
|
})).map((group) => ({ name, runtime: runtime2, trigger: `${event} (${group.matcher ?? "*"})` }))));
|
|
42696
42699
|
}
|
|
42697
42700
|
async function loadCatalog(sourceRoot) {
|
|
42698
|
-
const core = await findCoreSource();
|
|
42701
|
+
const core = sourceRoot ?? await findCoreSource();
|
|
42699
42702
|
const input2 = JSON.parse(await requireData(core, "data/model.json", 4 * 1024 * 1024));
|
|
42700
42703
|
const specialistDirectory = await lstat(join(core, "specialists"));
|
|
42701
42704
|
if (!specialistDirectory.isDirectory() || specialistDirectory.isSymbolicLink()) throw new Error("SPECIALIST_SOURCE_INVALID");
|
|
@@ -43263,8 +43266,8 @@ init_esm_shims();
|
|
|
43263
43266
|
function remedyPrefix(roots) {
|
|
43264
43267
|
return roots.workRoot === roots.installRoot ? "" : `in ${roots.installRoot}: `;
|
|
43265
43268
|
}
|
|
43266
|
-
function installedPath(roots,
|
|
43267
|
-
return roots.workRoot === roots.installRoot ?
|
|
43269
|
+
function installedPath(roots, relative31) {
|
|
43270
|
+
return roots.workRoot === roots.installRoot ? relative31 : join(roots.installRoot, relative31);
|
|
43268
43271
|
}
|
|
43269
43272
|
|
|
43270
43273
|
// src/lib/cheatsheet/render.ts
|
|
@@ -43642,8 +43645,8 @@ function keptTrackedCandidates() {
|
|
|
43642
43645
|
}
|
|
43643
43646
|
var FIX = "a project rule wins over the managed block; run git check-ignore -v <path> to see which, then narrow it so these paths stay visible and git add them";
|
|
43644
43647
|
function judgeKeptTracked(observations) {
|
|
43645
|
-
const reportable = observations.filter((
|
|
43646
|
-
const hidden = reportable.filter((
|
|
43648
|
+
const reportable = observations.filter((observation3) => observation3.present);
|
|
43649
|
+
const hidden = reportable.filter((observation3) => observation3.ignored === true).map((observation3) => `${observation3.path} (${observation3.rule ?? "rule unknown"})`).sort();
|
|
43647
43650
|
if (hidden.length > 0) {
|
|
43648
43651
|
return {
|
|
43649
43652
|
name: CHECK_NAME,
|
|
@@ -43653,7 +43656,7 @@ function judgeKeptTracked(observations) {
|
|
|
43653
43656
|
fix: FIX
|
|
43654
43657
|
};
|
|
43655
43658
|
}
|
|
43656
|
-
const unmeasured = reportable.filter((
|
|
43659
|
+
const unmeasured = reportable.filter((observation3) => observation3.ignored === void 0).map((observation3) => observation3.path).sort();
|
|
43657
43660
|
if (unmeasured.length > 0) {
|
|
43658
43661
|
return {
|
|
43659
43662
|
name: CHECK_NAME,
|
|
@@ -47671,12 +47674,12 @@ init_esm_shims();
|
|
|
47671
47674
|
|
|
47672
47675
|
// src/lib/autopilot/preflight.ts
|
|
47673
47676
|
init_esm_shims();
|
|
47674
|
-
function malformedProgram(
|
|
47675
|
-
const program =
|
|
47677
|
+
function malformedProgram(observation3) {
|
|
47678
|
+
const program = observation3.program;
|
|
47676
47679
|
return program !== void 0 && "malformed" in program ? program.malformed : void 0;
|
|
47677
47680
|
}
|
|
47678
|
-
function parsedProgram(
|
|
47679
|
-
const program =
|
|
47681
|
+
function parsedProgram(observation3) {
|
|
47682
|
+
const program = observation3.program;
|
|
47680
47683
|
return program === void 0 || "malformed" in program ? void 0 : program;
|
|
47681
47684
|
}
|
|
47682
47685
|
var RUNTIME_ADAPTERS = ["claude", "codex"];
|
|
@@ -47692,13 +47695,13 @@ function unknown2(name, message2, fix) {
|
|
|
47692
47695
|
function unprobed(name, message2) {
|
|
47693
47696
|
return { name, ok: false, status: "unprobed", message: message2 };
|
|
47694
47697
|
}
|
|
47695
|
-
function programCheck(
|
|
47698
|
+
function programCheck(observation3) {
|
|
47696
47699
|
const name = "autopilot program";
|
|
47697
|
-
const broken = malformedProgram(
|
|
47700
|
+
const broken = malformedProgram(observation3);
|
|
47698
47701
|
if (broken !== void 0) {
|
|
47699
47702
|
return fail2(name, `.void/program.md could not be parsed: ${broken.problem}`, broken.fix);
|
|
47700
47703
|
}
|
|
47701
|
-
const program = parsedProgram(
|
|
47704
|
+
const program = parsedProgram(observation3);
|
|
47702
47705
|
if (program === void 0) {
|
|
47703
47706
|
return unknown2(
|
|
47704
47707
|
name,
|
|
@@ -47731,10 +47734,10 @@ function programCheck(observation2) {
|
|
|
47731
47734
|
}
|
|
47732
47735
|
var UNPARSED = "not judged: .void/program.md could not be parsed";
|
|
47733
47736
|
var UNPARSED_FIX = "fix the frontmatter reported by the program check above, then run doctor again";
|
|
47734
|
-
function mergeModeCheck(
|
|
47737
|
+
function mergeModeCheck(observation3) {
|
|
47735
47738
|
const name = "autopilot merge";
|
|
47736
|
-
if (malformedProgram(
|
|
47737
|
-
const block2 = parsedProgram(
|
|
47739
|
+
if (malformedProgram(observation3) !== void 0) return unknown2(name, UNPARSED, UNPARSED_FIX);
|
|
47740
|
+
const block2 = parsedProgram(observation3)?.autopilot;
|
|
47738
47741
|
const gate = block2?.legacyMergeGate;
|
|
47739
47742
|
if (gate !== void 0) {
|
|
47740
47743
|
return fail2(
|
|
@@ -47750,10 +47753,10 @@ function mergeModeCheck(observation2) {
|
|
|
47750
47753
|
`the loop merges into ${base} on a clean local verdict, never into ${deploying}; \`${PRODUCT_COMMAND} autopilot merges --by-human\` hands every reviewed pull request to a person`
|
|
47751
47754
|
);
|
|
47752
47755
|
}
|
|
47753
|
-
function verifyCommandsCheck(
|
|
47756
|
+
function verifyCommandsCheck(observation3) {
|
|
47754
47757
|
const name = "autopilot verify";
|
|
47755
|
-
if (malformedProgram(
|
|
47756
|
-
const commands = parsedProgram(
|
|
47758
|
+
if (malformedProgram(observation3) !== void 0) return unknown2(name, UNPARSED, UNPARSED_FIX);
|
|
47759
|
+
const commands = parsedProgram(observation3)?.autopilot?.verifyCommands ?? [];
|
|
47757
47760
|
if (commands.length === 0) {
|
|
47758
47761
|
return fail2(
|
|
47759
47762
|
name,
|
|
@@ -47773,9 +47776,9 @@ function verifyCommandsCheck(observation2) {
|
|
|
47773
47776
|
}
|
|
47774
47777
|
return pass(name, `${commands.length} verify command(s)`);
|
|
47775
47778
|
}
|
|
47776
|
-
function adapterCheck(
|
|
47779
|
+
function adapterCheck(observation3) {
|
|
47777
47780
|
const name = "autopilot runtime";
|
|
47778
|
-
const usable =
|
|
47781
|
+
const usable = observation3.adapters.filter((adapter) => RUNTIME_ADAPTERS.includes(adapter));
|
|
47779
47782
|
if (usable.length === 0) {
|
|
47780
47783
|
return fail2(
|
|
47781
47784
|
name,
|
|
@@ -47785,24 +47788,24 @@ function adapterCheck(observation2) {
|
|
|
47785
47788
|
}
|
|
47786
47789
|
return pass(name, `${usable.join(", ")} adapter(s)`);
|
|
47787
47790
|
}
|
|
47788
|
-
function connectorCheck(
|
|
47791
|
+
function connectorCheck(observation3) {
|
|
47789
47792
|
const name = "autopilot tracker";
|
|
47790
47793
|
{
|
|
47791
47794
|
return unprobed(name, "not probed here; autopilot proves the connector at preflight, before it claims a lease");
|
|
47792
47795
|
}
|
|
47793
47796
|
}
|
|
47794
|
-
function worktreeCheck(
|
|
47797
|
+
function worktreeCheck(observation3) {
|
|
47795
47798
|
const name = "autopilot worktrees";
|
|
47796
|
-
if (
|
|
47799
|
+
if (observation3.worktreesUsable === null) {
|
|
47797
47800
|
return unknown2(name, "worktree support could not be determined", "run this inside the git repository autopilot would work in");
|
|
47798
47801
|
}
|
|
47799
|
-
return
|
|
47802
|
+
return observation3.worktreesUsable ? pass(name, "worktrees usable") : fail2(
|
|
47800
47803
|
name,
|
|
47801
47804
|
"worktrees cannot be created here, and a worker never works in the main checkout",
|
|
47802
47805
|
"run autopilot from a git repository where `git worktree add` succeeds"
|
|
47803
47806
|
);
|
|
47804
47807
|
}
|
|
47805
|
-
function protectionCheck(
|
|
47808
|
+
function protectionCheck(observation3) {
|
|
47806
47809
|
const name = "autopilot base";
|
|
47807
47810
|
{
|
|
47808
47811
|
return unprobed(
|
|
@@ -47811,14 +47814,14 @@ function protectionCheck(observation2) {
|
|
|
47811
47814
|
);
|
|
47812
47815
|
}
|
|
47813
47816
|
}
|
|
47814
|
-
function autopilotPreflight(
|
|
47817
|
+
function autopilotPreflight(observation3) {
|
|
47815
47818
|
return Object.freeze([
|
|
47816
|
-
programCheck(
|
|
47817
|
-
mergeModeCheck(
|
|
47818
|
-
verifyCommandsCheck(
|
|
47819
|
-
adapterCheck(
|
|
47819
|
+
programCheck(observation3),
|
|
47820
|
+
mergeModeCheck(observation3),
|
|
47821
|
+
verifyCommandsCheck(observation3),
|
|
47822
|
+
adapterCheck(observation3),
|
|
47820
47823
|
connectorCheck(),
|
|
47821
|
-
worktreeCheck(
|
|
47824
|
+
worktreeCheck(observation3),
|
|
47822
47825
|
protectionCheck()
|
|
47823
47826
|
]);
|
|
47824
47827
|
}
|
|
@@ -47893,57 +47896,57 @@ function frontmatterOf(text7) {
|
|
|
47893
47896
|
}
|
|
47894
47897
|
return match[1];
|
|
47895
47898
|
}
|
|
47896
|
-
function record19(value,
|
|
47899
|
+
function record19(value, field11) {
|
|
47897
47900
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
47898
47901
|
invalid8(
|
|
47899
|
-
`the program descriptor has no usable \`${
|
|
47900
|
-
`\`${
|
|
47901
|
-
`declare \`${
|
|
47902
|
+
`the program descriptor has no usable \`${field11}\` block`,
|
|
47903
|
+
`\`${field11}\` is ${Array.isArray(value) ? "a list" : String(value)}, not a mapping`,
|
|
47904
|
+
`declare \`${field11}:\` as a mapping of its documented fields`
|
|
47902
47905
|
);
|
|
47903
47906
|
}
|
|
47904
47907
|
return value;
|
|
47905
47908
|
}
|
|
47906
|
-
function requiredString(source2,
|
|
47907
|
-
const value = source2[
|
|
47909
|
+
function requiredString(source2, field11, context2) {
|
|
47910
|
+
const value = source2[field11];
|
|
47908
47911
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
47909
47912
|
invalid8(
|
|
47910
|
-
`the program descriptor is missing \`${context2}.${
|
|
47911
|
-
value === void 0 ? `\`${
|
|
47912
|
-
`set \`${
|
|
47913
|
+
`the program descriptor is missing \`${context2}.${field11}\``,
|
|
47914
|
+
value === void 0 ? `\`${field11}\` is absent` : `\`${field11}\` is not a non-empty string`,
|
|
47915
|
+
`set \`${field11}\` in the \`${context2}\` block to the value it names`
|
|
47913
47916
|
);
|
|
47914
47917
|
}
|
|
47915
47918
|
return value;
|
|
47916
47919
|
}
|
|
47917
|
-
function nonEmptyStringList(value,
|
|
47920
|
+
function nonEmptyStringList(value, field11) {
|
|
47918
47921
|
if (!Array.isArray(value) || value.length === 0 || value.some((entry) => typeof entry !== "string" || entry.trim().length === 0)) {
|
|
47919
47922
|
invalid8(
|
|
47920
|
-
`the program descriptor has no usable \`${
|
|
47921
|
-
`\`${
|
|
47922
|
-
`declare \`${
|
|
47923
|
+
`the program descriptor has no usable \`${field11}\``,
|
|
47924
|
+
`\`${field11}\` must be a non-empty list of non-empty strings`,
|
|
47925
|
+
`declare \`${field11}\` as a YAML list naming the provider values actually used`
|
|
47923
47926
|
);
|
|
47924
47927
|
}
|
|
47925
47928
|
return value;
|
|
47926
47929
|
}
|
|
47927
|
-
function confinedPath(value,
|
|
47930
|
+
function confinedPath(value, field11) {
|
|
47928
47931
|
if (isAbsolute(value) || value.split(/[\\/]/).includes("..")) {
|
|
47929
47932
|
invalid8(
|
|
47930
|
-
`the program descriptor \`${
|
|
47933
|
+
`the program descriptor \`${field11}\` leaves the repository`,
|
|
47931
47934
|
`\`${value}\` is absolute or walks up out of the project root`,
|
|
47932
|
-
`set \`${
|
|
47935
|
+
`set \`${field11}\` to a path relative to the repository root, without \`..\``
|
|
47933
47936
|
);
|
|
47934
47937
|
}
|
|
47935
47938
|
return value;
|
|
47936
47939
|
}
|
|
47937
|
-
function pathList2(value,
|
|
47940
|
+
function pathList2(value, field11) {
|
|
47938
47941
|
if (value === void 0) return [];
|
|
47939
47942
|
if (!Array.isArray(value) || value.some((entry) => typeof entry !== "string" || entry.trim().length === 0)) {
|
|
47940
47943
|
invalid8(
|
|
47941
|
-
`the program descriptor \`${
|
|
47942
|
-
`\`${
|
|
47943
|
-
`declare \`${
|
|
47944
|
+
`the program descriptor \`${field11}\` is not a list of paths`,
|
|
47945
|
+
`\`${field11}\` must be a list of non-empty strings`,
|
|
47946
|
+
`declare \`${field11}\` as a YAML list of repo-relative path patterns`
|
|
47944
47947
|
);
|
|
47945
47948
|
}
|
|
47946
|
-
return value.map((entry) => confinedPath(entry,
|
|
47949
|
+
return value.map((entry) => confinedPath(entry, field11));
|
|
47947
47950
|
}
|
|
47948
47951
|
function verifyCommands(value) {
|
|
47949
47952
|
if (value === void 0) return [];
|
|
@@ -48578,37 +48581,37 @@ function settledRenames(resolution) {
|
|
|
48578
48581
|
if (settled2.length === 0) return "";
|
|
48579
48582
|
return `; ${String(settled2.length)} settled rename(s): ${settled2.map(withSuccessor).join(", ")}`;
|
|
48580
48583
|
}
|
|
48581
|
-
function evidence(
|
|
48582
|
-
const { liveness } =
|
|
48584
|
+
function evidence(observation3) {
|
|
48585
|
+
const { liveness } = observation3;
|
|
48583
48586
|
const unseen = liveness.unobservable.map(
|
|
48584
48587
|
({ source: source2, toolCalls }) => `skill usage not observable for ${source2} (${toolCalls} tool calls); activation count unknown`
|
|
48585
48588
|
).join("; ");
|
|
48586
48589
|
if (liveness.missions === 0 && unseen !== "") {
|
|
48587
|
-
return `${
|
|
48590
|
+
return `${observation3.installedSkills} skill(s) installed; ${unseen}`;
|
|
48588
48591
|
}
|
|
48589
48592
|
if (liveness.missions === 0) {
|
|
48590
|
-
return `${
|
|
48593
|
+
return `${observation3.installedSkills} skill(s) installed, no working mission recorded yet`;
|
|
48591
48594
|
}
|
|
48592
|
-
return `${
|
|
48595
|
+
return `${observation3.installedSkills} skill(s) installed, ${liveness.skillCalls} activation(s) across ${liveness.toolCalls} tool calls (${ratio2(liveness)}) over ${liveness.missions} observable Claude working mission(s)` + (unseen === "" ? "" : `; ${unseen}`);
|
|
48593
48596
|
}
|
|
48594
|
-
function judgeInvocation(
|
|
48597
|
+
function judgeInvocation(observation3) {
|
|
48595
48598
|
const faults = [];
|
|
48596
|
-
if (!
|
|
48599
|
+
if (!observation3.resolution.ok) {
|
|
48597
48600
|
faults.push(
|
|
48598
|
-
`${
|
|
48601
|
+
`${observation3.resolution.unresolved.length} retired name(s) recorded: ` + observation3.resolution.unresolved.map(withSuccessor).join(", ")
|
|
48599
48602
|
);
|
|
48600
48603
|
}
|
|
48601
|
-
if (!
|
|
48604
|
+
if (!observation3.liveness.ok) {
|
|
48602
48605
|
faults.push(
|
|
48603
|
-
`no skill fired across ${
|
|
48606
|
+
`no skill fired across ${observation3.liveness.missions} working mission(s) and ${observation3.liveness.toolCalls} tool calls (runtime:claude)`
|
|
48604
48607
|
);
|
|
48605
48608
|
}
|
|
48606
48609
|
if (faults.length === 0) {
|
|
48607
48610
|
return {
|
|
48608
48611
|
name: NAME3,
|
|
48609
|
-
ok:
|
|
48610
|
-
status:
|
|
48611
|
-
message: `${evidence(
|
|
48612
|
+
ok: observation3.liveness.unobservable.length === 0,
|
|
48613
|
+
status: observation3.liveness.unobservable.length === 0 ? "pass" : "unknown",
|
|
48614
|
+
message: `${evidence(observation3)}${settledRenames(observation3.resolution)}`
|
|
48612
48615
|
};
|
|
48613
48616
|
}
|
|
48614
48617
|
return {
|
|
@@ -48617,11 +48620,11 @@ function judgeInvocation(observation2) {
|
|
|
48617
48620
|
status: "fail",
|
|
48618
48621
|
// Both faults, never the first alone: they have different causes, and fixing
|
|
48619
48622
|
// one would otherwise reveal the other only on the next run.
|
|
48620
|
-
message: `${faults.join("; ")}; ${evidence(
|
|
48623
|
+
message: `${faults.join("; ")}; ${evidence(observation3)}`,
|
|
48621
48624
|
// Never "reinstall": the file is not missing, the name moved. What the reader
|
|
48622
48625
|
// has to change is whatever still calls the old name -- a saved command, a
|
|
48623
48626
|
// habit, another skill's text.
|
|
48624
|
-
fix: !
|
|
48627
|
+
fix: !observation3.resolution.ok ? "invoke each successor named above instead, and update whatever still calls the old name" : "inspect the Claude Skill invocation path and activation collector for the silent missions"
|
|
48625
48628
|
};
|
|
48626
48629
|
}
|
|
48627
48630
|
|
|
@@ -48650,9 +48653,9 @@ var CHECK_NAME2 = "void observed";
|
|
|
48650
48653
|
var FIX2 = `${PRODUCT_COMMAND} update \u2014 it moves observed state under .void/machine/, which the managed block ignores; a path that must stay where it is needs its own .gitignore line`;
|
|
48651
48654
|
function judgeObservedIgnore(observations) {
|
|
48652
48655
|
const reportable = observations.filter(
|
|
48653
|
-
(
|
|
48656
|
+
(observation3) => observation3.present && !isDeliberatelyTracked(observation3.path)
|
|
48654
48657
|
);
|
|
48655
|
-
const leaking = reportable.filter((
|
|
48658
|
+
const leaking = reportable.filter((observation3) => observation3.ignored === false).map((observation3) => observation3.path).sort();
|
|
48656
48659
|
if (leaking.length > 0) {
|
|
48657
48660
|
return {
|
|
48658
48661
|
name: CHECK_NAME2,
|
|
@@ -48662,7 +48665,7 @@ function judgeObservedIgnore(observations) {
|
|
|
48662
48665
|
fix: FIX2
|
|
48663
48666
|
};
|
|
48664
48667
|
}
|
|
48665
|
-
const unmeasured = reportable.filter((
|
|
48668
|
+
const unmeasured = reportable.filter((observation3) => observation3.ignored === void 0).map((observation3) => observation3.path).sort();
|
|
48666
48669
|
if (unmeasured.length > 0) {
|
|
48667
48670
|
return {
|
|
48668
48671
|
name: CHECK_NAME2,
|
|
@@ -48750,38 +48753,38 @@ function fail3(name, message2, fix) {
|
|
|
48750
48753
|
function unknown3(name, message2, fix) {
|
|
48751
48754
|
return { name, ok: false, status: "unknown", message: message2, fix };
|
|
48752
48755
|
}
|
|
48753
|
-
function layoutCheck(
|
|
48756
|
+
function layoutCheck(observation3) {
|
|
48754
48757
|
const name = "void layout";
|
|
48755
|
-
if (
|
|
48758
|
+
if (observation3.pending.length === 0) return pass2(name, "observed state is under .void/machine/");
|
|
48756
48759
|
return fail3(
|
|
48757
48760
|
name,
|
|
48758
|
-
`${
|
|
48761
|
+
`${observation3.pending.length} observed path(s) still at the old location: ${observation3.pending.join(", ")}`,
|
|
48759
48762
|
`${PRODUCT_COMMAND} update \u2014 it moves them under .void/machine/ and never overwrites`
|
|
48760
48763
|
);
|
|
48761
48764
|
}
|
|
48762
|
-
function ignoreCheck(
|
|
48765
|
+
function ignoreCheck(observation3) {
|
|
48763
48766
|
const name = "void ignore";
|
|
48764
|
-
if (
|
|
48767
|
+
if (observation3.localIgnored === null) {
|
|
48765
48768
|
return unknown3(name, "not a git repository, so nothing ignores anything here", "run this inside the repository the project ships from");
|
|
48766
48769
|
}
|
|
48767
|
-
return
|
|
48770
|
+
return observation3.localIgnored ? pass2(name, ".void/machine/ is ignored") : fail3(
|
|
48768
48771
|
name,
|
|
48769
48772
|
".void/machine/ is NOT ignored, so telemetry and run journals would be committed",
|
|
48770
48773
|
`${PRODUCT_COMMAND} update \u2014 it writes the managed block; check no later rule re-includes .void/`
|
|
48771
48774
|
);
|
|
48772
48775
|
}
|
|
48773
|
-
function trackedCheck(
|
|
48776
|
+
function trackedCheck(observation3) {
|
|
48774
48777
|
const name = "void tracked";
|
|
48775
|
-
if (
|
|
48778
|
+
if (observation3.trackedObserved.length === 0) return pass2(name, "no observed state in the index");
|
|
48776
48779
|
return fail3(
|
|
48777
48780
|
name,
|
|
48778
|
-
`git tracks ${
|
|
48779
|
-
`git rm --cached -r ${
|
|
48781
|
+
`git tracks ${observation3.trackedObserved.length} observed path(s): ${observation3.trackedObserved.join(", ")}`,
|
|
48782
|
+
`git rm --cached -r ${observation3.trackedObserved.join(" ")} \u2014 the ignore rule cannot untrack what is already in the index`
|
|
48780
48783
|
);
|
|
48781
48784
|
}
|
|
48782
|
-
function orphanCheck(
|
|
48785
|
+
function orphanCheck(observation3) {
|
|
48783
48786
|
const name = "void orphans";
|
|
48784
|
-
const orphans2 =
|
|
48787
|
+
const orphans2 = observation3.orphanedAssets;
|
|
48785
48788
|
if (orphans2.length === 0) {
|
|
48786
48789
|
return { name, ok: true, message: "no harness asset on disk that the manifest lost track of" };
|
|
48787
48790
|
}
|
|
@@ -48793,9 +48796,9 @@ function orphanCheck(observation2) {
|
|
|
48793
48796
|
fix: "they were edited locally, so update kept them; delete them to stop loading two versions"
|
|
48794
48797
|
};
|
|
48795
48798
|
}
|
|
48796
|
-
function manifestCheck(
|
|
48799
|
+
function manifestCheck(observation3) {
|
|
48797
48800
|
const name = "void manifest";
|
|
48798
|
-
const manifest =
|
|
48801
|
+
const manifest = observation3.manifest;
|
|
48799
48802
|
if (manifest.kind === "absent") {
|
|
48800
48803
|
return {
|
|
48801
48804
|
name,
|
|
@@ -48824,9 +48827,9 @@ function manifestCheck(observation2) {
|
|
|
48824
48827
|
coEdited === 0 ? `assets match manifest ${version3}` : `assets match manifest ${version3}; ${String(coEdited)} co-owned file(s) carry project edits`
|
|
48825
48828
|
);
|
|
48826
48829
|
}
|
|
48827
|
-
function receiptCheck(
|
|
48830
|
+
function receiptCheck(observation3) {
|
|
48828
48831
|
const name = "void receipt";
|
|
48829
|
-
const receipt2 =
|
|
48832
|
+
const receipt2 = observation3.receipt;
|
|
48830
48833
|
if (receipt2.kind === "absent") {
|
|
48831
48834
|
return {
|
|
48832
48835
|
name,
|
|
@@ -48845,7 +48848,7 @@ function receiptCheck(observation2) {
|
|
|
48845
48848
|
if (missingTotal === 0) return pass2(name, `every file receipt ${version3} recorded is on disk`);
|
|
48846
48849
|
const example2 = receipt2.missing?.[0];
|
|
48847
48850
|
const shown = example2 === void 0 ? "" : `, for example ${example2}`;
|
|
48848
|
-
const manifest =
|
|
48851
|
+
const manifest = observation3.manifest;
|
|
48849
48852
|
const rolledBack = manifest.kind === "present" && manifest.version !== void 0 && manifest.version !== version3;
|
|
48850
48853
|
if (rolledBack) {
|
|
48851
48854
|
return fail3(
|
|
@@ -48856,14 +48859,14 @@ function receiptCheck(observation2) {
|
|
|
48856
48859
|
}
|
|
48857
48860
|
return fail3(name, `receipt ${version3} records ${String(missingTotal)} file(s) that are not on disk${shown}`, fix);
|
|
48858
48861
|
}
|
|
48859
|
-
function derivedCheck(
|
|
48862
|
+
function derivedCheck(observation3) {
|
|
48860
48863
|
const name = "void derived";
|
|
48861
|
-
if (
|
|
48864
|
+
if (observation3.trackedDerivedCount === 0) return pass2(name, "no regenerated content in the index");
|
|
48862
48865
|
return {
|
|
48863
48866
|
name,
|
|
48864
48867
|
ok: true,
|
|
48865
48868
|
status: "advisory",
|
|
48866
|
-
message: `git tracks ${
|
|
48869
|
+
message: `git tracks ${observation3.trackedDerivedCount} file(s) that \`hydrate\` restores from the manifest`,
|
|
48867
48870
|
fix: `${PRODUCT_COMMAND} update --untrack-derived (keeps the files on disk, drops them from the index)`
|
|
48868
48871
|
};
|
|
48869
48872
|
}
|
|
@@ -48881,24 +48884,24 @@ function judgeProjectSkills(ignored) {
|
|
|
48881
48884
|
fix
|
|
48882
48885
|
};
|
|
48883
48886
|
}
|
|
48884
|
-
function judgeLayout(
|
|
48887
|
+
function judgeLayout(observation3) {
|
|
48885
48888
|
return Object.freeze([
|
|
48886
|
-
layoutCheck(
|
|
48887
|
-
ignoreCheck(
|
|
48889
|
+
layoutCheck(observation3),
|
|
48890
|
+
ignoreCheck(observation3),
|
|
48888
48891
|
// Generalizes the check above from the one declared path to every path the
|
|
48889
48892
|
// harness can write observed state to, legacy locations included.
|
|
48890
|
-
judgeObservedIgnore(
|
|
48893
|
+
judgeObservedIgnore(observation3.observedPaths),
|
|
48891
48894
|
// The same question the other way round: a declaration that a path stays
|
|
48892
48895
|
// TRACKED is no more a proof than one that a path is ignored.
|
|
48893
|
-
judgeKeptTracked(
|
|
48894
|
-
orphanCheck(
|
|
48895
|
-
trackedCheck(
|
|
48896
|
-
manifestCheck(
|
|
48896
|
+
judgeKeptTracked(observation3.keptTracked),
|
|
48897
|
+
orphanCheck(observation3),
|
|
48898
|
+
trackedCheck(observation3),
|
|
48899
|
+
manifestCheck(observation3),
|
|
48897
48900
|
// After the manifest, deliberately: when the assets were rolled back the
|
|
48898
48901
|
// manifest reads green, and the reader needs the two lines side by side to
|
|
48899
48902
|
// see that the green one is answering about the wrong version.
|
|
48900
|
-
receiptCheck(
|
|
48901
|
-
derivedCheck(
|
|
48903
|
+
receiptCheck(observation3),
|
|
48904
|
+
derivedCheck(observation3)
|
|
48902
48905
|
]);
|
|
48903
48906
|
}
|
|
48904
48907
|
|
|
@@ -50216,9 +50219,9 @@ async function observeLayout(root) {
|
|
|
50216
50219
|
const listed = git4(["ls-files", "-z", "--", ".void"]) ?? "";
|
|
50217
50220
|
const tracked = listed.split("\0").filter((path3) => path3 !== "");
|
|
50218
50221
|
const trackedObserved = tracked.filter((path3) => {
|
|
50219
|
-
const
|
|
50220
|
-
if (
|
|
50221
|
-
return isMachineEntry(
|
|
50222
|
+
const relative31 = path3.startsWith(".void/") ? path3.slice(".void/".length) : path3;
|
|
50223
|
+
if (relative31.startsWith(`${VOID_MACHINE_DIR}/`)) return true;
|
|
50224
|
+
return isMachineEntry(relative31.split("/")[0] ?? "");
|
|
50222
50225
|
});
|
|
50223
50226
|
const materialized = git4(["ls-files", "-z", "--", ".void", ".claude", ".agents", ".codex"]) ?? "";
|
|
50224
50227
|
const trackedDerivedCount = owned === void 0 ? 0 : materialized.split("\0").filter((path3) => path3 !== "" && owned.has(path3.split("\\").join("/"))).length;
|
|
@@ -50255,15 +50258,15 @@ function observeOrphanedAssets(root) {
|
|
|
50255
50258
|
return [];
|
|
50256
50259
|
}
|
|
50257
50260
|
const discovered = [];
|
|
50258
|
-
const walk = (
|
|
50261
|
+
const walk = (relative31) => {
|
|
50259
50262
|
let entries;
|
|
50260
50263
|
try {
|
|
50261
|
-
entries = readdirSync(join(root,
|
|
50264
|
+
entries = readdirSync(join(root, relative31));
|
|
50262
50265
|
} catch {
|
|
50263
50266
|
return;
|
|
50264
50267
|
}
|
|
50265
50268
|
for (const entry of entries) {
|
|
50266
|
-
const child = `${
|
|
50269
|
+
const child = `${relative31}/${entry}`;
|
|
50267
50270
|
const absolute2 = join(root, child);
|
|
50268
50271
|
let isDirectory = false;
|
|
50269
50272
|
try {
|
|
@@ -50358,14 +50361,14 @@ function observeIgnoredProjectSkills(root) {
|
|
|
50358
50361
|
}
|
|
50359
50362
|
for (const entry of entries) {
|
|
50360
50363
|
if (!entry.isDirectory()) continue;
|
|
50361
|
-
const
|
|
50362
|
-
if ([...owned].some((path3) => path3.startsWith(`${
|
|
50364
|
+
const relative31 = `${home}/${entry.name}`;
|
|
50365
|
+
if ([...owned].some((path3) => path3.startsWith(`${relative31}/`))) continue;
|
|
50363
50366
|
try {
|
|
50364
|
-
execFileSync("git", ["check-ignore", "-q", `${
|
|
50367
|
+
execFileSync("git", ["check-ignore", "-q", `${relative31}/`], {
|
|
50365
50368
|
cwd: root,
|
|
50366
50369
|
stdio: ["ignore", "ignore", "ignore"]
|
|
50367
50370
|
});
|
|
50368
|
-
ignored.push(
|
|
50371
|
+
ignored.push(relative31);
|
|
50369
50372
|
} catch {
|
|
50370
50373
|
}
|
|
50371
50374
|
}
|
|
@@ -51455,32 +51458,32 @@ function observedDone(view, input2) {
|
|
|
51455
51458
|
return { transition: next(view, input2.now, "turn-ended", "result-missing", "the agent ended its turn but the delegation-result hook recorded no final message", "send a message asking for the final result: void-machine agents send <runId>") };
|
|
51456
51459
|
}
|
|
51457
51460
|
function endedByResult(view, input2) {
|
|
51458
|
-
const { observation:
|
|
51459
|
-
if (
|
|
51461
|
+
const { observation: observation3, result, now } = input2;
|
|
51462
|
+
if (observation3.kind !== "present" || observation3.status === "busy")
|
|
51460
51463
|
return void 0;
|
|
51461
|
-
if (
|
|
51464
|
+
if (observation3.state === "failed" || observation3.state === "stopped")
|
|
51462
51465
|
return void 0;
|
|
51463
51466
|
if (result === void 0 || result.recordedAt < view.turnStartedAt || result.pendingWork > 0)
|
|
51464
51467
|
return void 0;
|
|
51465
51468
|
if (view.state === "turn-ended")
|
|
51466
51469
|
return {};
|
|
51467
|
-
const question =
|
|
51470
|
+
const question = observation3.state === "blocked";
|
|
51468
51471
|
return { transition: next(view, now, "turn-ended", "turn-ended", question ? "the agent ended its turn with a question; its final message is collected" : "the agent ended its turn and its final message is collected", question ? "answer with void-machine agents send <runId>, or accept the result" : "read it with void-machine agents status <runId>, then accept or send") };
|
|
51469
51472
|
}
|
|
51470
51473
|
function observeRun(view, input2) {
|
|
51471
|
-
const { observation:
|
|
51472
|
-
if (!isOpen(view.state) ||
|
|
51474
|
+
const { observation: observation3, now } = input2;
|
|
51475
|
+
if (!isOpen(view.state) || observation3.kind === "unreadable")
|
|
51473
51476
|
return {};
|
|
51474
|
-
if (
|
|
51477
|
+
if (observation3.kind === "absent")
|
|
51475
51478
|
return observedAbsent(view, now);
|
|
51476
51479
|
const ended = endedByResult(view, input2);
|
|
51477
51480
|
if (ended !== void 0)
|
|
51478
51481
|
return ended;
|
|
51479
|
-
switch (
|
|
51482
|
+
switch (observation3.state) {
|
|
51480
51483
|
case "working":
|
|
51481
51484
|
return view.state === "working" ? {} : { transition: next(view, now, "working", "observed", "the agent is working", "wait with void-machine agents wait <runId>") };
|
|
51482
51485
|
case "blocked": {
|
|
51483
|
-
const waitingFor =
|
|
51486
|
+
const waitingFor = observation3.waitingFor ?? "input needed";
|
|
51484
51487
|
if (view.state === "waiting-human" && view.last.waitingFor === waitingFor)
|
|
51485
51488
|
return {};
|
|
51486
51489
|
return { transition: next(view, now, "waiting-human", "observed", `the agent waits for a person: ${waitingFor}`, "decide in the agent session: void-machine agents attach <runId>", waitingFor) };
|
|
@@ -51492,7 +51495,7 @@ function observeRun(view, input2) {
|
|
|
51492
51495
|
case "stopped":
|
|
51493
51496
|
return { transition: next(view, now, "stopped", "observed", "the session was stopped", "dispatch a new run if the work is still needed") };
|
|
51494
51497
|
default: {
|
|
51495
|
-
const unknown4 =
|
|
51498
|
+
const unknown4 = observation3.state;
|
|
51496
51499
|
return unknown4;
|
|
51497
51500
|
}
|
|
51498
51501
|
}
|
|
@@ -51555,9 +51558,9 @@ function remoteReference(value, depth = 0) {
|
|
|
51555
51558
|
}
|
|
51556
51559
|
if (!isObject3(value))
|
|
51557
51560
|
return void 0;
|
|
51558
|
-
const
|
|
51559
|
-
if (typeof
|
|
51560
|
-
return `the schema names a $ref outside itself (${
|
|
51561
|
+
const reference2 = value["$ref"];
|
|
51562
|
+
if (typeof reference2 === "string" && !reference2.startsWith("#")) {
|
|
51563
|
+
return `the schema names a $ref outside itself (${reference2.slice(0, 100)})`;
|
|
51561
51564
|
}
|
|
51562
51565
|
for (const child of Object.values(value)) {
|
|
51563
51566
|
const found = remoteReference(child, depth + 1);
|
|
@@ -54382,8 +54385,8 @@ var localReviewSchema = external_exports.strictObject({
|
|
|
54382
54385
|
}
|
|
54383
54386
|
});
|
|
54384
54387
|
function describeIssue(issue4) {
|
|
54385
|
-
const
|
|
54386
|
-
return `${
|
|
54388
|
+
const field11 = issue4.path.length === 0 ? "(root)" : issue4.path.map(String).join(".");
|
|
54389
|
+
return `${field11}: ${issue4.message}`;
|
|
54387
54390
|
}
|
|
54388
54391
|
function admit2(what, schema, value) {
|
|
54389
54392
|
const parsed = schema.safeParse(value);
|
|
@@ -54623,13 +54626,10 @@ var TRACKED_TICKETS_MAX = 256;
|
|
|
54623
54626
|
var HUMAN_WAIT_LABEL = "void:human-wait";
|
|
54624
54627
|
var PROTECTED_PATHS_FLOOR = [
|
|
54625
54628
|
".github/**",
|
|
54626
|
-
|
|
54627
|
-
|
|
54628
|
-
// What a judging workflow runs from outside `.github`: the promotion audit
|
|
54629
|
-
// runs develop's own copy, void-enforce replays the auto-merge contract and
|
|
54629
|
+
// What a judging workflow runs from outside `.github`: void-enforce
|
|
54630
|
+
// replays the auto-merge contract and
|
|
54630
54631
|
// the enforcement floor from the pull request, and ci.yml's required verdict
|
|
54631
54632
|
// is aggregated by verify.mjs.
|
|
54632
|
-
"scripts/promotion-authority.mjs",
|
|
54633
54633
|
"scripts/auto-merge-contract.mjs",
|
|
54634
54634
|
"scripts/verify.mjs",
|
|
54635
54635
|
"packages/core/enforce/**",
|
|
@@ -54778,8 +54778,8 @@ function admitLoopTracker(value) {
|
|
|
54778
54778
|
const parsed = loopTrackerSchema.safeParse(value);
|
|
54779
54779
|
if (parsed.success) return { ok: true, value: parsed.data };
|
|
54780
54780
|
const issues = parsed.error.issues.map((issue4) => {
|
|
54781
|
-
const
|
|
54782
|
-
return `${
|
|
54781
|
+
const field11 = issue4.path.length === 0 ? "(root)" : issue4.path.join(".");
|
|
54782
|
+
return `${field11}: ${issue4.message}`;
|
|
54783
54783
|
}).join("; ");
|
|
54784
54784
|
return { ok: false, reason: `tracker observation refused: ${issues}` };
|
|
54785
54785
|
}
|
|
@@ -55266,8 +55266,8 @@ var COMMIT_SHA = /^[0-9a-f]{40}$/;
|
|
|
55266
55266
|
function blocked(reason2, detail) {
|
|
55267
55267
|
return { kind: "blocked", reason: reason2, detail };
|
|
55268
55268
|
}
|
|
55269
|
-
function selectBase(
|
|
55270
|
-
const branches =
|
|
55269
|
+
function selectBase(observation3) {
|
|
55270
|
+
const branches = observation3.branches;
|
|
55271
55271
|
if (!Array.isArray(branches) || branches.length === 0) {
|
|
55272
55272
|
return blocked("no-conventional-base", "the observation lists no branch on the remote");
|
|
55273
55273
|
}
|
|
@@ -55284,7 +55284,7 @@ function selectBase(observation2) {
|
|
|
55284
55284
|
}
|
|
55285
55285
|
names.add(branch.name);
|
|
55286
55286
|
}
|
|
55287
|
-
const requested =
|
|
55287
|
+
const requested = observation3.requested;
|
|
55288
55288
|
if (typeof requested !== "string" || requested.trim().length === 0) {
|
|
55289
55289
|
return blocked(
|
|
55290
55290
|
"requested-base-missing",
|
|
@@ -56252,7 +56252,7 @@ async function inspectMission(root, missionId, context2, options2 = {}) {
|
|
|
56252
56252
|
}
|
|
56253
56253
|
const text7 = await readFile(log, "utf8");
|
|
56254
56254
|
const stream2 = replayEventLog(text7);
|
|
56255
|
-
const quarantineFiles = await quarantineInvalidLines(
|
|
56255
|
+
const quarantineFiles = options2.quarantine === false ? [] : await quarantineInvalidLines(
|
|
56256
56256
|
run2,
|
|
56257
56257
|
text7,
|
|
56258
56258
|
options2.secrets ?? collectKnownSecrets()
|
|
@@ -58269,29 +58269,29 @@ init_esm_shims();
|
|
|
58269
58269
|
var import_yaml8 = __toESM(require_dist());
|
|
58270
58270
|
var import_yaml9 = __toESM(require_dist());
|
|
58271
58271
|
var import_picomatch4 = __toESM(require_picomatch2());
|
|
58272
|
-
function invalid9(
|
|
58273
|
-
throw new Error(`invalid declaration field: ${
|
|
58272
|
+
function invalid9(field11) {
|
|
58273
|
+
throw new Error(`invalid declaration field: ${field11}`);
|
|
58274
58274
|
}
|
|
58275
|
-
function text4(value,
|
|
58275
|
+
function text4(value, field11, max = 512) {
|
|
58276
58276
|
if (typeof value !== "string" || value.length === 0 || value.length > max)
|
|
58277
|
-
invalid9(
|
|
58277
|
+
invalid9(field11);
|
|
58278
58278
|
if ([...value].some((c2) => {
|
|
58279
58279
|
const n = c2.codePointAt(0) ?? 0;
|
|
58280
58280
|
return n < 32 || n >= 127 && n <= 159;
|
|
58281
58281
|
}))
|
|
58282
|
-
invalid9(
|
|
58282
|
+
invalid9(field11);
|
|
58283
58283
|
return value;
|
|
58284
58284
|
}
|
|
58285
|
-
function list3(value,
|
|
58285
|
+
function list3(value, field11, optional2 = false) {
|
|
58286
58286
|
if (optional2 && value === void 0) return Object.freeze([]);
|
|
58287
|
-
if (!Array.isArray(value) || value.length > 256) invalid9(
|
|
58287
|
+
if (!Array.isArray(value) || value.length > 256) invalid9(field11);
|
|
58288
58288
|
return Object.freeze(
|
|
58289
|
-
[...new Set(value.map((v2) => text4(v2,
|
|
58289
|
+
[...new Set(value.map((v2) => text4(v2, field11, 1024)))].sort()
|
|
58290
58290
|
);
|
|
58291
58291
|
}
|
|
58292
|
-
function choice(value,
|
|
58293
|
-
const parsed = text4(value,
|
|
58294
|
-
if (!choices.includes(parsed)) invalid9(
|
|
58292
|
+
function choice(value, field11, choices) {
|
|
58293
|
+
const parsed = text4(value, field11, 32);
|
|
58294
|
+
if (!choices.includes(parsed)) invalid9(field11);
|
|
58295
58295
|
return parsed;
|
|
58296
58296
|
}
|
|
58297
58297
|
function validateProjectDeclaration(value, kind2) {
|
|
@@ -59228,9 +59228,9 @@ function createTypeScriptExtractor(api) {
|
|
|
59228
59228
|
function configError(message2) {
|
|
59229
59229
|
throw new Error(`PROJECT_TYPESCRIPT_CONFIG_INVALID: ${message2}`);
|
|
59230
59230
|
}
|
|
59231
|
-
function jsonRecord2(value,
|
|
59231
|
+
function jsonRecord2(value, field11) {
|
|
59232
59232
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
59233
|
-
return configError(`${
|
|
59233
|
+
return configError(`${field11} must be an object`);
|
|
59234
59234
|
}
|
|
59235
59235
|
return value;
|
|
59236
59236
|
}
|
|
@@ -59437,9 +59437,9 @@ function resolveTypeScriptConfigInheritance(api, configs, caseSensitive) {
|
|
|
59437
59437
|
function workspaceError(message2) {
|
|
59438
59438
|
throw new Error(`PROJECT_WORKSPACE_INVALID: ${message2}`);
|
|
59439
59439
|
}
|
|
59440
|
-
function record21(value,
|
|
59440
|
+
function record21(value, field11) {
|
|
59441
59441
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
59442
|
-
return workspaceError(`${
|
|
59442
|
+
return workspaceError(`${field11} must be an object`);
|
|
59443
59443
|
}
|
|
59444
59444
|
return value;
|
|
59445
59445
|
}
|
|
@@ -59452,13 +59452,13 @@ function containsControl(value) {
|
|
|
59452
59452
|
function dependencyNames(input2) {
|
|
59453
59453
|
const names = /* @__PURE__ */ new Set();
|
|
59454
59454
|
const fields = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
|
|
59455
|
-
for (const
|
|
59456
|
-
const value = input2[
|
|
59455
|
+
for (const field11 of fields) {
|
|
59456
|
+
const value = input2[field11];
|
|
59457
59457
|
if (value === void 0) continue;
|
|
59458
|
-
for (const name of Object.keys(record21(value,
|
|
59458
|
+
for (const name of Object.keys(record21(value, field11))) {
|
|
59459
59459
|
if (names.size >= 1e4) workspaceError("dependency declarations exceed their limit");
|
|
59460
59460
|
if (name.length === 0 || name.length > 214 || containsControl(name)) {
|
|
59461
|
-
workspaceError(`${
|
|
59461
|
+
workspaceError(`${field11} contains an invalid package name`);
|
|
59462
59462
|
}
|
|
59463
59463
|
names.add(name);
|
|
59464
59464
|
}
|
|
@@ -59562,8 +59562,8 @@ function workspaceExports(input2, workspacePath) {
|
|
|
59562
59562
|
}
|
|
59563
59563
|
function workspaceEntrypoints(input2, workspacePath, exports) {
|
|
59564
59564
|
const raw = [];
|
|
59565
|
-
for (const
|
|
59566
|
-
entrypointStrings(input2[
|
|
59565
|
+
for (const field11 of ["source", "main", "module", "types", "typings"]) {
|
|
59566
|
+
entrypointStrings(input2[field11], raw);
|
|
59567
59567
|
}
|
|
59568
59568
|
const exported2 = exports["."] ?? [];
|
|
59569
59569
|
if (exported2.length === 0 && raw.length === 0) {
|
|
@@ -60713,6 +60713,9 @@ function executableCandidates() {
|
|
|
60713
60713
|
join(programFiles, "Git", "bin", "git.exe")
|
|
60714
60714
|
];
|
|
60715
60715
|
}
|
|
60716
|
+
if (process.platform === "darwin") {
|
|
60717
|
+
return ["/opt/homebrew/bin/git", "/usr/local/bin/git", "/usr/bin/git", "/bin/git"];
|
|
60718
|
+
}
|
|
60716
60719
|
return ["/usr/bin/git", "/bin/git", "/usr/local/bin/git", "/opt/homebrew/bin/git"];
|
|
60717
60720
|
}
|
|
60718
60721
|
async function trustedGitPath(explicit) {
|
|
@@ -63455,15 +63458,15 @@ function ownersOf(snapshot2, id3) {
|
|
|
63455
63458
|
function testsFor(snapshot2, id3) {
|
|
63456
63459
|
return relatedThrough(snapshot2, id3, TEST_KINDS, true, `no test coverage was extracted for ${id3}`);
|
|
63457
63460
|
}
|
|
63458
|
-
function stalenessOf(snapshot2,
|
|
63459
|
-
if (snapshot2.source.rootHash !==
|
|
63461
|
+
function stalenessOf(snapshot2, observation22) {
|
|
63462
|
+
if (snapshot2.source.rootHash !== observation22.rootHash) {
|
|
63460
63463
|
return {
|
|
63461
63464
|
stale: true,
|
|
63462
63465
|
fallback: "source",
|
|
63463
|
-
reason: `the root hash moved (${snapshot2.source.rootHash} -> ${
|
|
63466
|
+
reason: `the root hash moved (${snapshot2.source.rootHash} -> ${observation22.rootHash}); read source instead`
|
|
63464
63467
|
};
|
|
63465
63468
|
}
|
|
63466
|
-
if (!
|
|
63469
|
+
if (!observation22.complete) {
|
|
63467
63470
|
return {
|
|
63468
63471
|
stale: false,
|
|
63469
63472
|
fallback: "source",
|
|
@@ -66040,8 +66043,8 @@ function enclosingProject2(from) {
|
|
|
66040
66043
|
}
|
|
66041
66044
|
}
|
|
66042
66045
|
function readCheckpointFile(root) {
|
|
66043
|
-
for (const
|
|
66044
|
-
const path3 = join(root,
|
|
66046
|
+
for (const relative31 of CHECKPOINT_PATHS) {
|
|
66047
|
+
const path3 = join(root, relative31);
|
|
66045
66048
|
try {
|
|
66046
66049
|
if (!existsSync(path3)) continue;
|
|
66047
66050
|
return {
|
|
@@ -67259,16 +67262,588 @@ async function pruneMissions(root, olderThanDays, apply, now = /* @__PURE__ */ n
|
|
|
67259
67262
|
return candidates;
|
|
67260
67263
|
}
|
|
67261
67264
|
|
|
67265
|
+
// src/commands/mission-usage.ts
|
|
67266
|
+
init_esm_shims();
|
|
67267
|
+
|
|
67268
|
+
// src/lib/runs/usage-sessions.ts
|
|
67269
|
+
init_esm_shims();
|
|
67270
|
+
|
|
67271
|
+
// src/lib/runs/usage-session-contract.ts
|
|
67272
|
+
init_esm_shims();
|
|
67273
|
+
var usageMissionId = external_exports.string().regex(/^mis_[A-Za-z0-9_-]{8,100}$/);
|
|
67274
|
+
var anchorSchema = external_exports.strictObject({
|
|
67275
|
+
seq: external_exports.number().int().nonnegative(),
|
|
67276
|
+
eventId: external_exports.string().regex(/^(?:origin|evt_[A-Za-z0-9_-]{8,100})$/),
|
|
67277
|
+
digest: external_exports.string().regex(/^sha256:[a-f0-9]{64}$/)
|
|
67278
|
+
});
|
|
67279
|
+
var openingSchema = external_exports.strictObject({ targetMissionId: usageMissionId, previous: anchorSchema });
|
|
67280
|
+
var closingSchema2 = openingSchema.extend({ opening: anchorSchema });
|
|
67281
|
+
var usageReferenceSchema = external_exports.strictObject({ sourceMissionId: usageMissionId, opening: anchorSchema });
|
|
67282
|
+
var USAGE_SOURCE = `${PRODUCT_COMMAND}:usage`;
|
|
67283
|
+
var isUsageSource = (source2) => [PRODUCT_COMMAND, ...PRODUCT_IDENTITY.commands.deprecated].some((command2) => source2 === `${command2}:usage`);
|
|
67284
|
+
var MAX_USAGE_LINKS = 32;
|
|
67285
|
+
var usageEventId = (...parts) => `evt_usage_${canonicalJsonHash(parts).slice(7)}`;
|
|
67286
|
+
var sameUsageAnchor = (left, right) => left.seq === right.seq && left.eventId === right.eventId && left.digest === right.digest;
|
|
67287
|
+
function scanUsageSource(events, sourceMissionId) {
|
|
67288
|
+
let prefix = { seq: 0, eventId: "origin", digest: canonicalJsonHash([]) };
|
|
67289
|
+
let active;
|
|
67290
|
+
const intervals = /* @__PURE__ */ new Map();
|
|
67291
|
+
const seen = /* @__PURE__ */ new Set();
|
|
67292
|
+
for (const event of events) {
|
|
67293
|
+
if (event.seq !== prefix.seq + 1 || event.missionId !== sourceMissionId || event.correlationId !== sourceMissionId || seen.has(event.eventId)) {
|
|
67294
|
+
throw new Error("USAGE_SOURCE_INTEGRITY: inconsistent source journal");
|
|
67295
|
+
}
|
|
67296
|
+
seen.add(event.eventId);
|
|
67297
|
+
const next2 = {
|
|
67298
|
+
seq: event.seq,
|
|
67299
|
+
eventId: event.eventId,
|
|
67300
|
+
digest: canonicalJsonHash([prefix.digest, event])
|
|
67301
|
+
};
|
|
67302
|
+
if (event.kind === "usage.session.opened" || event.kind === "usage.session.closed") {
|
|
67303
|
+
const parsed = (event.kind === "usage.session.opened" ? openingSchema : closingSchema2).safeParse(event.payload);
|
|
67304
|
+
if (!parsed.success || !isUsageSource(event.source) || event.subject !== parsed.data.targetMissionId || !sameUsageAnchor(parsed.data.previous, prefix)) {
|
|
67305
|
+
throw new Error("USAGE_BOUNDARY_INVALID: source prefix or receipt changed");
|
|
67306
|
+
}
|
|
67307
|
+
if (event.kind === "usage.session.opened") {
|
|
67308
|
+
if (active !== void 0 || intervals.has(parsed.data.targetMissionId)) {
|
|
67309
|
+
throw new Error("USAGE_BOUNDARY_INVALID: overlapping or reopened interval");
|
|
67310
|
+
}
|
|
67311
|
+
active = { targetMissionId: parsed.data.targetMissionId, opening: next2 };
|
|
67312
|
+
intervals.set(active.targetMissionId, active);
|
|
67313
|
+
} else {
|
|
67314
|
+
const closed = closingSchema2.parse(event.payload);
|
|
67315
|
+
if (active === void 0 || active.targetMissionId !== closed.targetMissionId || !sameUsageAnchor(active.opening, closed.opening)) {
|
|
67316
|
+
throw new Error("USAGE_BOUNDARY_INVALID: closure does not match the active interval");
|
|
67317
|
+
}
|
|
67318
|
+
intervals.set(active.targetMissionId, { ...active, closing: next2 });
|
|
67319
|
+
active = void 0;
|
|
67320
|
+
}
|
|
67321
|
+
}
|
|
67322
|
+
prefix = next2;
|
|
67323
|
+
}
|
|
67324
|
+
return { prefix, intervals, ...active === void 0 ? {} : { active } };
|
|
67325
|
+
}
|
|
67326
|
+
|
|
67327
|
+
// src/lib/runs/usage-sessions.ts
|
|
67328
|
+
var requestSchema = external_exports.strictObject({
|
|
67329
|
+
root: external_exports.string().min(1),
|
|
67330
|
+
missionId: usageMissionId,
|
|
67331
|
+
sourceMissionId: usageMissionId,
|
|
67332
|
+
action: external_exports.enum(["bind", "unbind"])
|
|
67333
|
+
});
|
|
67334
|
+
async function readUsageJournal(root, missionId) {
|
|
67335
|
+
const path3 = await eventLogPath(root, usageMissionId.parse(missionId));
|
|
67336
|
+
const stream2 = replayEventLog(await requireData(root, relative(root, path3), MAX_EVENT_LOG_BYTES));
|
|
67337
|
+
if (stream2.continuity !== "complete" || stream2.duplicateEventIds > 0 || stream2.events.some((event) => event.missionId !== missionId || event.correlationId !== missionId)) {
|
|
67338
|
+
throw new Error("USAGE_SOURCE_INTEGRITY: unreadable, duplicate or mixed journal; no usage attributed");
|
|
67339
|
+
}
|
|
67340
|
+
return stream2.events;
|
|
67341
|
+
}
|
|
67342
|
+
async function reference(root, target, source2, interval, write3) {
|
|
67343
|
+
try {
|
|
67344
|
+
const eventId3 = usageEventId("reference", target, source2);
|
|
67345
|
+
const existing = (await readUsageJournal(root, target)).find((event) => event.eventId === eventId3);
|
|
67346
|
+
const persistedSource = existing !== void 0 && isUsageSource(existing.source) ? existing.source : USAGE_SOURCE;
|
|
67347
|
+
await write3({
|
|
67348
|
+
root,
|
|
67349
|
+
missionId: target,
|
|
67350
|
+
eventId: eventId3,
|
|
67351
|
+
draft: {
|
|
67352
|
+
source: persistedSource,
|
|
67353
|
+
kind: "usage.session.linked",
|
|
67354
|
+
subject: source2,
|
|
67355
|
+
correlationId: target,
|
|
67356
|
+
payload: { sourceMissionId: source2, opening: interval.opening }
|
|
67357
|
+
},
|
|
67358
|
+
validate: (events) => {
|
|
67359
|
+
observedMissionLifecycle(events);
|
|
67360
|
+
if (events.filter((event) => event.kind === "usage.session.linked").length >= MAX_USAGE_LINKS) {
|
|
67361
|
+
throw new Error("USAGE_LINK_LIMIT: at most 32 source journals per mission");
|
|
67362
|
+
}
|
|
67363
|
+
}
|
|
67364
|
+
});
|
|
67365
|
+
} catch (error62) {
|
|
67366
|
+
if (error62 instanceof Error && error62.message.startsWith("USAGE_LINK_LIMIT:")) throw error62;
|
|
67367
|
+
throw new Error("USAGE_REFERENCE_PENDING: source receipt is durable; retry the same command to repair the target reference");
|
|
67368
|
+
}
|
|
67369
|
+
}
|
|
67370
|
+
async function changeUsageSession(input2, write3 = writeSequencedEventOnce) {
|
|
67371
|
+
const request = requestSchema.parse(input2);
|
|
67372
|
+
const { root, missionId, sourceMissionId } = request;
|
|
67373
|
+
if (sourceMissionId === missionId) throw new Error("USAGE_SELF_LINK: source and target must differ");
|
|
67374
|
+
const targetEvents = await readUsageJournal(root, missionId);
|
|
67375
|
+
observedMissionLifecycle(targetEvents);
|
|
67376
|
+
const interval = await changeSourceInterval(request, targetEvents, write3);
|
|
67377
|
+
try {
|
|
67378
|
+
await reference(root, missionId, sourceMissionId, interval, write3);
|
|
67379
|
+
} catch (error62) {
|
|
67380
|
+
if (!(error62 instanceof Error) || !error62.message.startsWith("USAGE_LINK_LIMIT:")) throw error62;
|
|
67381
|
+
try {
|
|
67382
|
+
await changeSourceInterval({ ...request, action: "unbind" }, targetEvents, write3);
|
|
67383
|
+
} catch {
|
|
67384
|
+
throw new Error(`USAGE_CAPACITY_CLEANUP_PENDING: target is full; source closure is unconfirmed. Restore source access and run mission usage-unbind --id ${missionId} --source ${sourceMissionId}; the full target cannot accept this reference`);
|
|
67385
|
+
}
|
|
67386
|
+
throw new Error("USAGE_LINK_LIMIT: target is full; excess source interval is closed; no reference can be added");
|
|
67387
|
+
}
|
|
67388
|
+
return { sourceMissionId, status: interval.closing === void 0 ? "open" : "closed", interval };
|
|
67389
|
+
}
|
|
67390
|
+
async function changeSourceInterval(request, targetEvents, write3) {
|
|
67391
|
+
const { root, missionId, sourceMissionId, action } = request;
|
|
67392
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
67393
|
+
const scanned = scanUsageSource(await readUsageJournal(root, sourceMissionId), sourceMissionId);
|
|
67394
|
+
const interval = scanned.intervals.get(missionId);
|
|
67395
|
+
if (interval !== void 0 && (action === "bind" || interval.closing !== void 0)) {
|
|
67396
|
+
return interval;
|
|
67397
|
+
}
|
|
67398
|
+
if (action === "unbind" && interval === void 0) throw new Error("USAGE_NOT_BOUND: no prospective interval exists");
|
|
67399
|
+
if (action === "bind") {
|
|
67400
|
+
requireOpenMission(targetEvents);
|
|
67401
|
+
if (scanned.active !== void 0) throw new Error("USAGE_SOURCE_BUSY: close the active target before binding another");
|
|
67402
|
+
if (targetEvents.filter((event) => event.kind === "usage.session.linked").length >= MAX_USAGE_LINKS) {
|
|
67403
|
+
throw new Error("USAGE_LINK_LIMIT: at most 32 source journals per mission");
|
|
67404
|
+
}
|
|
67405
|
+
}
|
|
67406
|
+
try {
|
|
67407
|
+
await write3({
|
|
67408
|
+
root,
|
|
67409
|
+
missionId: sourceMissionId,
|
|
67410
|
+
eventId: usageEventId(action, missionId, sourceMissionId),
|
|
67411
|
+
draft: {
|
|
67412
|
+
source: USAGE_SOURCE,
|
|
67413
|
+
kind: action === "bind" ? "usage.session.opened" : "usage.session.closed",
|
|
67414
|
+
subject: missionId,
|
|
67415
|
+
correlationId: sourceMissionId,
|
|
67416
|
+
payload: {
|
|
67417
|
+
targetMissionId: missionId,
|
|
67418
|
+
previous: scanned.prefix,
|
|
67419
|
+
...interval === void 0 ? {} : { opening: interval.opening }
|
|
67420
|
+
}
|
|
67421
|
+
},
|
|
67422
|
+
validate: (events) => {
|
|
67423
|
+
if (!sameUsageAnchor(scanUsageSource(events, sourceMissionId).prefix, scanned.prefix)) {
|
|
67424
|
+
throw new Error("USAGE_SOURCE_CHANGED: source appended during binding; retry");
|
|
67425
|
+
}
|
|
67426
|
+
}
|
|
67427
|
+
});
|
|
67428
|
+
} catch (error62) {
|
|
67429
|
+
if (error62 instanceof Error && (error62.message.startsWith("USAGE_SOURCE_CHANGED:") || error62.message.startsWith("HOOK_EVENT_ID_CONFLICT:"))) continue;
|
|
67430
|
+
throw error62;
|
|
67431
|
+
}
|
|
67432
|
+
const updated = scanUsageSource(await readUsageJournal(root, sourceMissionId), sourceMissionId).intervals.get(missionId);
|
|
67433
|
+
if (updated === void 0) throw new Error("USAGE_BOUNDARY_INVALID: written interval is missing");
|
|
67434
|
+
return updated;
|
|
67435
|
+
}
|
|
67436
|
+
throw new Error("USAGE_SOURCE_CHANGED: concurrent writes prevented a stable boundary; retry the same command");
|
|
67437
|
+
}
|
|
67438
|
+
async function readUsageSessions(root, missionId, events) {
|
|
67439
|
+
const references = events.filter((event) => event.missionId === missionId && event.kind === "usage.session.linked");
|
|
67440
|
+
const scopes = [];
|
|
67441
|
+
const links = [];
|
|
67442
|
+
const notes = [];
|
|
67443
|
+
if (references.length > MAX_USAGE_LINKS) return {
|
|
67444
|
+
scopes,
|
|
67445
|
+
links,
|
|
67446
|
+
notes: ["Linked usage unavailable: source reference limit exceeded."]
|
|
67447
|
+
};
|
|
67448
|
+
const seen = /* @__PURE__ */ new Set();
|
|
67449
|
+
const sourceCounts = /* @__PURE__ */ new Map();
|
|
67450
|
+
for (const event of references) {
|
|
67451
|
+
const parsed = usageReferenceSchema.safeParse(event.payload);
|
|
67452
|
+
if (parsed.success) sourceCounts.set(
|
|
67453
|
+
parsed.data.sourceMissionId,
|
|
67454
|
+
(sourceCounts.get(parsed.data.sourceMissionId) ?? 0) + 1
|
|
67455
|
+
);
|
|
67456
|
+
}
|
|
67457
|
+
for (const event of references) {
|
|
67458
|
+
const parsed = usageReferenceSchema.safeParse(event.payload);
|
|
67459
|
+
const source2 = parsed.success ? parsed.data.sourceMissionId : "unknown";
|
|
67460
|
+
if (seen.has(source2)) continue;
|
|
67461
|
+
seen.add(source2);
|
|
67462
|
+
try {
|
|
67463
|
+
if (!parsed.success || !isUsageSource(event.source) || event.subject !== source2 || event.correlationId !== missionId || source2 === missionId || sourceCounts.get(source2) !== 1) {
|
|
67464
|
+
throw new Error("USAGE_REFERENCE_INVALID");
|
|
67465
|
+
}
|
|
67466
|
+
const sourceEvents = await readUsageJournal(root, source2);
|
|
67467
|
+
const interval = scanUsageSource(sourceEvents, source2).intervals.get(missionId);
|
|
67468
|
+
if (interval === void 0 || !sameUsageAnchor(interval.opening, parsed.data.opening)) {
|
|
67469
|
+
throw new Error("USAGE_BOUNDARY_INVALID");
|
|
67470
|
+
}
|
|
67471
|
+
scopes.push({ missionId: source2, events: sourceEvents.filter((candidate) => candidate.seq > interval.opening.seq && (interval.closing === void 0 || candidate.seq < interval.closing.seq)) });
|
|
67472
|
+
links.push({ sourceMissionId: source2, status: interval.closing === void 0 ? "open" : "closed", interval });
|
|
67473
|
+
notes.push(`${source2}: ${interval.closing === void 0 ? "provisional/shared-session" : "closed shared-session interval"}; explicit attribution, not worker isolation or authentication.`);
|
|
67474
|
+
} catch {
|
|
67475
|
+
links.push({ sourceMissionId: source2, status: "unavailable" });
|
|
67476
|
+
notes.push(`${source2}: linked usage unavailable; no counts attributed from this source.`);
|
|
67477
|
+
}
|
|
67478
|
+
}
|
|
67479
|
+
return { scopes, links, notes };
|
|
67480
|
+
}
|
|
67481
|
+
|
|
67482
|
+
// src/lib/runs/usage-advisory.ts
|
|
67483
|
+
init_esm_shims();
|
|
67484
|
+
var advisorySchema = external_exports.strictObject({
|
|
67485
|
+
root: external_exports.string().min(1),
|
|
67486
|
+
missionId: usageMissionId,
|
|
67487
|
+
specialistId: external_exports.string().regex(/^core:[a-z0-9]+(?:-[a-z0-9]+)*$/),
|
|
67488
|
+
runtime: external_exports.enum(["claude", "codex"]),
|
|
67489
|
+
contextId: external_exports.string().refine(validNativeContextId)
|
|
67490
|
+
});
|
|
67491
|
+
async function recordUsageAdvisory(input2) {
|
|
67492
|
+
const request = advisorySchema.parse(input2);
|
|
67493
|
+
const specialists = await loadSpecialists(await findCoreSource());
|
|
67494
|
+
if (!specialists.some((specialist) => specialist.id === request.specialistId)) {
|
|
67495
|
+
throw new Error("USAGE_SPECIALIST_UNKNOWN: use a canonical specialist role from the catalogue");
|
|
67496
|
+
}
|
|
67497
|
+
await readUsageJournal(request.root, request.missionId);
|
|
67498
|
+
const recorded = await writeSequencedEventOnce({
|
|
67499
|
+
root: request.root,
|
|
67500
|
+
missionId: request.missionId,
|
|
67501
|
+
eventId: usageEventId("advisory", request.missionId, request.runtime, request.contextId),
|
|
67502
|
+
draft: {
|
|
67503
|
+
source: "coordinator-observed",
|
|
67504
|
+
kind: "usage.advisory.started",
|
|
67505
|
+
subject: request.specialistId,
|
|
67506
|
+
correlationId: request.missionId,
|
|
67507
|
+
payload: { runtime: request.runtime, contextId: request.contextId }
|
|
67508
|
+
},
|
|
67509
|
+
validate: requireOpenMission
|
|
67510
|
+
});
|
|
67511
|
+
return { eventId: recorded.event.eventId, provenance: "coordinator-observed" };
|
|
67512
|
+
}
|
|
67513
|
+
|
|
67514
|
+
// src/commands/mission-usage.ts
|
|
67515
|
+
var MISSION_ID10 = /^mis_[A-Za-z0-9_-]{8,100}$/;
|
|
67516
|
+
function parseUsageCommand(input2, helpers) {
|
|
67517
|
+
const { subcommand, options: options2, divider: divider2 } = input2;
|
|
67518
|
+
const { invalid: invalid17, valueAfter: valueAfter4, missionIdFrom: missionIdFrom2, validateOptions: validateOptions3 } = helpers;
|
|
67519
|
+
if (subcommand === "usage-bind" || subcommand === "usage-unbind" || subcommand === "advisory-start") {
|
|
67520
|
+
if (divider2 !== -1) return invalid17("usage commands do not accept a command", "remove --");
|
|
67521
|
+
const names = options2.filter((value) => value.startsWith("--"));
|
|
67522
|
+
if (new Set(names).size !== names.length) return invalid17("duplicate usage option", "provide each option once");
|
|
67523
|
+
const error62 = validateOptions3(options2, subcommand === "advisory-start" ? ["--id", "--specialist", "--runtime", "--context"] : ["--id", "--source"], ["--json"]);
|
|
67524
|
+
if (error62 !== void 0) return invalid17(error62, `${PRODUCT_COMMAND} mission --help`);
|
|
67525
|
+
const missionId = missionIdFrom2(options2);
|
|
67526
|
+
if (typeof missionId !== "string") return missionId;
|
|
67527
|
+
if (subcommand !== "advisory-start") {
|
|
67528
|
+
const sourceMissionId = valueAfter4(options2, "--source");
|
|
67529
|
+
if (sourceMissionId === void 0 || !MISSION_ID10.test(sourceMissionId)) return invalid17("invalid source ID", "pass --source mis_<exact-session-journal>");
|
|
67530
|
+
return { kind: subcommand, missionId, sourceMissionId, json: options2.includes("--json") };
|
|
67531
|
+
}
|
|
67532
|
+
const specialistId3 = valueAfter4(options2, "--specialist");
|
|
67533
|
+
const runtime2 = valueAfter4(options2, "--runtime");
|
|
67534
|
+
const contextId = valueAfter4(options2, "--context");
|
|
67535
|
+
if (specialistId3 === void 0 || !/^core:[a-z0-9]+(?:-[a-z0-9]+)*$/.test(specialistId3) || runtime2 !== "claude" && runtime2 !== "codex" || contextId === void 0 || contextId.trim() === "") {
|
|
67536
|
+
return invalid17("advisory start needs a role, runtime and actual native context", "pass --specialist core:<role> --runtime claude|codex --context <successful-native-context>");
|
|
67537
|
+
}
|
|
67538
|
+
return { kind: "advisory-start", missionId, specialistId: specialistId3, runtime: runtime2, contextId, json: options2.includes("--json") };
|
|
67539
|
+
}
|
|
67540
|
+
return void 0;
|
|
67541
|
+
}
|
|
67542
|
+
async function runUsageCommand(parsed, journal) {
|
|
67543
|
+
if (parsed.kind === "usage-bind" || parsed.kind === "usage-unbind") {
|
|
67544
|
+
const result2 = await changeUsageSession({
|
|
67545
|
+
root: journal,
|
|
67546
|
+
missionId: parsed.missionId,
|
|
67547
|
+
sourceMissionId: parsed.sourceMissionId,
|
|
67548
|
+
action: parsed.kind === "usage-bind" ? "bind" : "unbind"
|
|
67549
|
+
});
|
|
67550
|
+
return parsed.json ? `${JSON.stringify(result2)}
|
|
67551
|
+
` : `${result2.sourceMissionId}: ${result2.status}
|
|
67552
|
+
`;
|
|
67553
|
+
}
|
|
67554
|
+
const result = await recordUsageAdvisory({
|
|
67555
|
+
root: journal,
|
|
67556
|
+
missionId: parsed.missionId,
|
|
67557
|
+
specialistId: parsed.specialistId,
|
|
67558
|
+
runtime: parsed.runtime,
|
|
67559
|
+
contextId: parsed.contextId
|
|
67560
|
+
});
|
|
67561
|
+
return parsed.json ? `${JSON.stringify(result)}
|
|
67562
|
+
` : `${result.eventId}: coordinator-observed advisory start
|
|
67563
|
+
`;
|
|
67564
|
+
}
|
|
67565
|
+
|
|
67566
|
+
// src/lib/runs/usage-report.ts
|
|
67567
|
+
init_esm_shims();
|
|
67568
|
+
|
|
67569
|
+
// src/lib/runs/usage.ts
|
|
67570
|
+
init_esm_shims();
|
|
67571
|
+
|
|
67572
|
+
// src/lib/runs/usage-activity.ts
|
|
67573
|
+
init_esm_shims();
|
|
67574
|
+
var MAX_ACTIVITY_ROWS = 200;
|
|
67575
|
+
var MAX_TEXT_ROWS = 20;
|
|
67576
|
+
function field7(event, name) {
|
|
67577
|
+
const value = event.payload;
|
|
67578
|
+
return value && typeof value === "object" && !Array.isArray(value) ? Object.entries(value).find(([key]) => key === name)?.[1] : void 0;
|
|
67579
|
+
}
|
|
67580
|
+
function dispatchIdentity(event) {
|
|
67581
|
+
const stage = field7(event, "stage");
|
|
67582
|
+
const round = field7(event, "reviewRound");
|
|
67583
|
+
const version3 = field7(event, "contractVersion");
|
|
67584
|
+
const hash7 = field7(event, "inputHash");
|
|
67585
|
+
if (!["pre-implementation", "post-implementation"].includes(String(stage)) || typeof round !== "number" || !Number.isSafeInteger(round) || round < 1 || typeof version3 !== "number" || !Number.isSafeInteger(version3) || version3 < 1 || typeof hash7 !== "string" || !/^sha256:[a-f0-9]{64}$/.test(hash7)) return void 0;
|
|
67586
|
+
return canonicalJsonHash([
|
|
67587
|
+
event.missionId,
|
|
67588
|
+
event.source,
|
|
67589
|
+
event.subject,
|
|
67590
|
+
event.causationId ?? "",
|
|
67591
|
+
stage ?? "",
|
|
67592
|
+
round,
|
|
67593
|
+
version3,
|
|
67594
|
+
hash7,
|
|
67595
|
+
field7(event, "reviewSubject") ?? "",
|
|
67596
|
+
field7(event, "reviewScope") ?? ""
|
|
67597
|
+
]);
|
|
67598
|
+
}
|
|
67599
|
+
function task(event, advisory) {
|
|
67600
|
+
if (advisory) return "advisory";
|
|
67601
|
+
const stage = field7(event, "stage");
|
|
67602
|
+
const round = field7(event, "reviewRound");
|
|
67603
|
+
return ["pre-implementation", "post-implementation"].includes(String(stage)) && typeof round === "number" && Number.isSafeInteger(round) && round > 0 ? `${stage} / round ${round}` : "specialist work (task unknown)";
|
|
67604
|
+
}
|
|
67605
|
+
function projectSpecialistActivity(input2) {
|
|
67606
|
+
const observations = [];
|
|
67607
|
+
const starts = /* @__PURE__ */ new Map();
|
|
67608
|
+
const invocationEvents = /* @__PURE__ */ new Map();
|
|
67609
|
+
const ended = new Set(input2.endedScopes ?? []);
|
|
67610
|
+
for (const event of input2.events) {
|
|
67611
|
+
if (event.kind === "mission.closed") ended.add(event.missionId);
|
|
67612
|
+
const advisory = event.kind === "usage.advisory.started" && event.source === "coordinator-observed";
|
|
67613
|
+
if (!advisory && !["specialist.started", "specialist.completed", "specialist.failed"].includes(event.kind)) continue;
|
|
67614
|
+
const specialist = /^core:([a-z0-9]+(?:-[a-z0-9]+)*)$/.exec(event.subject)?.[1];
|
|
67615
|
+
if (specialist === void 0) continue;
|
|
67616
|
+
const rawRuntime = advisory ? field7(event, "runtime") : /^runtime:(claude|codex)$/.exec(event.source)?.[1];
|
|
67617
|
+
const runtime2 = rawRuntime === "claude" || rawRuntime === "codex" ? rawRuntime : "unknown";
|
|
67618
|
+
if (advisory && runtime2 === "unknown") continue;
|
|
67619
|
+
const context2 = field7(event, "contextId");
|
|
67620
|
+
const nativeContextId = validNativeContextId(context2) ? context2 : "unknown";
|
|
67621
|
+
const dispatch2 = advisory ? void 0 : dispatchIdentity(event);
|
|
67622
|
+
const key = dispatch2 !== void 0 && nativeContextId !== "unknown" ? canonicalJsonHash([dispatch2, nativeContextId]) : void 0;
|
|
67623
|
+
const reference2 = field7(event, "reviewInvocationEventId");
|
|
67624
|
+
const referenced = typeof reference2 === "string" ? invocationEvents.get(`${event.missionId}:${reference2}`) : void 0;
|
|
67625
|
+
const previous = reference2 !== void 0 ? referenced !== void 0 && referenced.dispatch === dispatch2 && (nativeContextId === "unknown" || referenced.row.nativeContextId === nativeContextId) ? referenced : void 0 : key === void 0 ? void 0 : starts.get(key);
|
|
67626
|
+
const terminal = event.kind === "specialist.completed" ? "completed" : event.kind === "specialist.failed" ? "failed" : void 0;
|
|
67627
|
+
if (terminal !== void 0 && previous?.started && dispatch2 !== void 0 && runtime2 !== "unknown") {
|
|
67628
|
+
previous.row = {
|
|
67629
|
+
...previous.row,
|
|
67630
|
+
observedState: terminal,
|
|
67631
|
+
outcome: terminal,
|
|
67632
|
+
lastEventId: event.eventId,
|
|
67633
|
+
lastObservedAt: event.ts
|
|
67634
|
+
};
|
|
67635
|
+
continue;
|
|
67636
|
+
}
|
|
67637
|
+
const started = !advisory && event.kind === "specialist.started";
|
|
67638
|
+
const reason2 = advisory ? "start observed; no advisory completion telemetry" : terminal !== void 0 ? "terminal without matching start" : dispatch2 === void 0 || runtime2 === "unknown" ? "dispatch metadata unavailable" : void 0;
|
|
67639
|
+
const observation3 = { started, ...dispatch2 === void 0 ? {} : { dispatch: dispatch2 }, row: {
|
|
67640
|
+
kind: advisory ? "advisory" : "specialist",
|
|
67641
|
+
specialist,
|
|
67642
|
+
sourceMissionId: event.missionId,
|
|
67643
|
+
attribution: event.missionId === input2.missionId ? "mission" : "shared-session",
|
|
67644
|
+
runtime: runtime2,
|
|
67645
|
+
nativeContextId,
|
|
67646
|
+
task: task(event, advisory),
|
|
67647
|
+
observedState: reason2 === void 0 ? "running" : "unknown",
|
|
67648
|
+
provenance: advisory ? "coordinator-observed" : "runtime-receipt",
|
|
67649
|
+
lastEventId: event.eventId,
|
|
67650
|
+
lastObservedAt: event.ts,
|
|
67651
|
+
...terminal === void 0 ? {} : { outcome: terminal },
|
|
67652
|
+
...reason2 === void 0 ? {} : { reason: reason2 }
|
|
67653
|
+
} };
|
|
67654
|
+
observations.push(observation3);
|
|
67655
|
+
if (started) {
|
|
67656
|
+
invocationEvents.set(`${event.missionId}:${event.eventId}`, observation3);
|
|
67657
|
+
if (key !== void 0) starts.set(key, observation3);
|
|
67658
|
+
}
|
|
67659
|
+
}
|
|
67660
|
+
const activity = observations.slice(0, MAX_ACTIVITY_ROWS).map(({ row: row2 }) => {
|
|
67661
|
+
if (row2.observedState !== "running") return row2;
|
|
67662
|
+
const reason2 = input2.incomplete ? "journal incomplete" : ended.has(input2.missionId) || ended.has(row2.sourceMissionId) ? "observation ended without a terminal receipt" : void 0;
|
|
67663
|
+
return reason2 === void 0 ? row2 : { ...row2, observedState: "unknown", reason: reason2 };
|
|
67664
|
+
});
|
|
67665
|
+
return { activity, activityOmitted: Math.max(0, observations.length - activity.length) };
|
|
67666
|
+
}
|
|
67667
|
+
var cell = (value) => value.replace(/[\\|[\]`<>]/g, "\\$&");
|
|
67668
|
+
function renderSpecialistActivity(report) {
|
|
67669
|
+
if (report.activity.length === 0) return ["Specialist activity unknown: no linked execution observations."];
|
|
67670
|
+
const visible = report.activity.slice(0, MAX_TEXT_ROWS);
|
|
67671
|
+
const omitted = report.activityOmitted + report.activity.length - visible.length;
|
|
67672
|
+
return [
|
|
67673
|
+
"Specialist activity (last recorded observation, not live presence)",
|
|
67674
|
+
"| Kind / provenance | Specialist | Task | Observed state | Native identity | Source scope |",
|
|
67675
|
+
"| --- | --- | --- | --- | --- | --- |",
|
|
67676
|
+
...visible.map((row2) => `| ${row2.kind} / ${row2.provenance} | ${row2.specialist} | ${cell(row2.task)} | ${row2.observedState}${row2.reason === void 0 ? "" : ` (${row2.reason})`} | ${row2.runtime}:${cell(row2.nativeContextId)} | ${row2.attribution}:${cell(row2.sourceMissionId)} |`),
|
|
67677
|
+
...omitted > 0 ? [`${omitted} activity observation(s) omitted; JSON includes up to ${MAX_ACTIVITY_ROWS} rows.`] : []
|
|
67678
|
+
];
|
|
67679
|
+
}
|
|
67680
|
+
|
|
67681
|
+
// src/lib/runs/usage.ts
|
|
67682
|
+
function field8(payload, key) {
|
|
67683
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) return void 0;
|
|
67684
|
+
const value = Object.entries(payload).find(([name]) => name === key)?.[1];
|
|
67685
|
+
return typeof value === "string" ? value : void 0;
|
|
67686
|
+
}
|
|
67687
|
+
function observation2(event) {
|
|
67688
|
+
if (event.subject.startsWith("skill:") && event.source === "runtime:claude") {
|
|
67689
|
+
if (event.kind === "runtime.tool.started" && field8(event.payload, "category") === "skill") {
|
|
67690
|
+
return { type: "skill", hit: true };
|
|
67691
|
+
}
|
|
67692
|
+
if (event.kind === "runtime.tool.completed") {
|
|
67693
|
+
return { type: "skill", hit: false, outcome: field8(event.payload, "status") ?? "unknown" };
|
|
67694
|
+
}
|
|
67695
|
+
}
|
|
67696
|
+
if (event.subject.startsWith("hook:") && event.kind === "hook.completed") {
|
|
67697
|
+
return { type: "hook", hit: true, outcome: field8(event.payload, "status") ?? "unknown" };
|
|
67698
|
+
}
|
|
67699
|
+
if (event.kind === "usage.advisory.started" && event.source === "coordinator-observed" && event.subject.startsWith("core:") && ["claude", "codex"].includes(field8(event.payload, "runtime") ?? "")) {
|
|
67700
|
+
return { type: "advisory", hit: true };
|
|
67701
|
+
}
|
|
67702
|
+
if (event.subject.startsWith("core:") && event.kind === "specialist.started") {
|
|
67703
|
+
return { type: "specialist", hit: true };
|
|
67704
|
+
}
|
|
67705
|
+
if (event.subject.startsWith("core:") && ["specialist.completed", "specialist.failed"].includes(event.kind)) {
|
|
67706
|
+
return { type: "specialist", hit: false, outcome: event.kind.slice("specialist.".length) };
|
|
67707
|
+
}
|
|
67708
|
+
return void 0;
|
|
67709
|
+
}
|
|
67710
|
+
function projectMissionUsage(input2) {
|
|
67711
|
+
const rows = /* @__PURE__ */ new Map();
|
|
67712
|
+
for (const entry of input2.catalog) {
|
|
67713
|
+
if (entry.type !== "skill" && entry.type !== "hook" && entry.type !== "specialist") continue;
|
|
67714
|
+
rows.set(`${entry.type}:${entry.name}`, {
|
|
67715
|
+
type: entry.type,
|
|
67716
|
+
name: entry.name,
|
|
67717
|
+
catalogued: true,
|
|
67718
|
+
observedHits: 0,
|
|
67719
|
+
outcomes: {},
|
|
67720
|
+
runtimeHits: {}
|
|
67721
|
+
});
|
|
67722
|
+
}
|
|
67723
|
+
const channels = /* @__PURE__ */ new Set();
|
|
67724
|
+
const seen = /* @__PURE__ */ new Set();
|
|
67725
|
+
const runtimeChannels = /* @__PURE__ */ new Set();
|
|
67726
|
+
const scopes = [{ missionId: input2.missionId, events: input2.events }, ...input2.linkedScopes ?? []];
|
|
67727
|
+
const events = scopes.flatMap((scope) => scope.events.filter((item) => item.missionId === scope.missionId)).filter((event) => {
|
|
67728
|
+
const identity2 = `${event.missionId}:${event.eventId}`;
|
|
67729
|
+
if (seen.has(identity2)) return false;
|
|
67730
|
+
seen.add(identity2);
|
|
67731
|
+
return true;
|
|
67732
|
+
});
|
|
67733
|
+
for (const event of events) {
|
|
67734
|
+
const observed2 = observation2(event);
|
|
67735
|
+
if (observed2 === void 0) continue;
|
|
67736
|
+
const rawName = event.subject.slice(event.subject.indexOf(":") + 1);
|
|
67737
|
+
const name = observed2.type === "skill" ? activationName("skill", rawName.startsWith("core/") ? rawName.slice(5) : rawName) : input2.hookSubjects[event.subject] ?? rawName;
|
|
67738
|
+
if (!/^[a-zA-Z0-9]+(?:[-:/][a-zA-Z0-9]+)*$/.test(name)) continue;
|
|
67739
|
+
const runtime2 = observed2.type === "advisory" ? field8(event.payload, "runtime") ?? "unknown" : /^runtime:(claude|codex|unknown)$/.test(event.source) ? event.source.slice("runtime:".length) : "unattributed";
|
|
67740
|
+
runtimeChannels.add(`${observed2.type}:${runtime2}`);
|
|
67741
|
+
channels.add(observed2.type);
|
|
67742
|
+
const key = `${observed2.type}:${name}`;
|
|
67743
|
+
const row2 = rows.get(key) ?? {
|
|
67744
|
+
type: observed2.type,
|
|
67745
|
+
name,
|
|
67746
|
+
catalogued: observed2.type === "advisory" && input2.catalog.some((entry) => entry.type === "specialist" && entry.name === name),
|
|
67747
|
+
observedHits: 0,
|
|
67748
|
+
outcomes: {},
|
|
67749
|
+
runtimeHits: {}
|
|
67750
|
+
};
|
|
67751
|
+
if (observed2.hit) {
|
|
67752
|
+
row2.observedHits += 1;
|
|
67753
|
+
row2.runtimeHits[runtime2] = (row2.runtimeHits[runtime2] ?? 0) + 1;
|
|
67754
|
+
}
|
|
67755
|
+
if (observed2.outcome !== void 0) {
|
|
67756
|
+
const outcome = ["ok", "error", "skipped", "degraded", "blocked", "completed", "failed"].includes(observed2.outcome) ? observed2.outcome : "unknown";
|
|
67757
|
+
row2.outcomes[outcome] = (row2.outcomes[outcome] ?? 0) + 1;
|
|
67758
|
+
}
|
|
67759
|
+
rows.set(key, row2);
|
|
67760
|
+
}
|
|
67761
|
+
return {
|
|
67762
|
+
missionId: input2.missionId,
|
|
67763
|
+
...projectSpecialistActivity({
|
|
67764
|
+
missionId: input2.missionId,
|
|
67765
|
+
events,
|
|
67766
|
+
...input2.endedScopes === void 0 ? {} : { endedScopes: input2.endedScopes },
|
|
67767
|
+
...input2.incomplete === void 0 ? {} : { incomplete: input2.incomplete }
|
|
67768
|
+
}),
|
|
67769
|
+
rows: [...rows.values()].map((row2) => ({
|
|
67770
|
+
...row2,
|
|
67771
|
+
observedHits: channels.has(row2.type) ? row2.observedHits : "unknown",
|
|
67772
|
+
runtimeHits: Object.fromEntries([.../* @__PURE__ */ new Set(["claude", "codex", ...Object.keys(row2.runtimeHits)])].map((runtime2) => [runtime2, runtimeChannels.has(`${row2.type}:${runtime2}`) ? row2.runtimeHits[runtime2] ?? 0 : "unknown"]))
|
|
67773
|
+
})).sort((a, b2) => `${a.type}:${a.name}`.localeCompare(`${b2.type}:${b2.name}`, "en")),
|
|
67774
|
+
notes: [
|
|
67775
|
+
...!channels.has("hook") && !channels.has("skill") ? ["hook/skill telemetry not linked to this mission."] : [],
|
|
67776
|
+
...["skill", "hook", "specialist", "advisory"].filter((kind2) => !channels.has(kind2)).map((kind2) => `${kind2}: unknown; no linked execution telemetry.`),
|
|
67777
|
+
"Hits are observed lower bounds. Zero means no recorded hit, not proof of non-use; gaps remain possible.",
|
|
67778
|
+
"Codex SKILL.md reads are loads, not observable native skill invocations; no skill hits are inferred from them.",
|
|
67779
|
+
...channels.has("advisory") ? ["Advisory starts are coordinator-observed declarations, separate from formal specialist dispatch; no completion or verdict claimed."] : [],
|
|
67780
|
+
"Counts do not prove applicability, instruction compliance, TDD or code quality. Missing telemetry is not a delivery gate."
|
|
67781
|
+
]
|
|
67782
|
+
};
|
|
67783
|
+
}
|
|
67784
|
+
function renderMissionUsage(report) {
|
|
67785
|
+
const observed2 = report.rows.filter((row2) => typeof row2.observedHits === "number" && row2.observedHits > 0 || Object.keys(row2.outcomes).length > 0);
|
|
67786
|
+
return [
|
|
67787
|
+
...renderSpecialistActivity(report),
|
|
67788
|
+
"",
|
|
67789
|
+
"Usage recap (explicit mission linkage only)",
|
|
67790
|
+
...report.notes.map((note) => `- ${note}`),
|
|
67791
|
+
...["skill", "hook", "specialist", "advisory"].map((kind2) => {
|
|
67792
|
+
const rows = report.rows.filter((row2) => row2.type === kind2);
|
|
67793
|
+
return `${kind2}: ${rows.filter((row2) => row2.observedHits === 0).length} zero observed, ${rows.filter((row2) => row2.observedHits === "unknown").length} unknown catalogue entries.`;
|
|
67794
|
+
}),
|
|
67795
|
+
...observed2.length === 0 ? ["No linked execution observations. Full inventory: void-machine cheatsheet --format markdown."] : [
|
|
67796
|
+
"| Kind | Name | Observed hits | Outcomes | Telemetry |",
|
|
67797
|
+
"| --- | --- | --- | --- | --- |",
|
|
67798
|
+
...observed2.map((row2) => `| ${row2.type} | ${row2.name} | ${row2.observedHits} | ${Object.entries(row2.outcomes).map(([status3, count]) => `${status3}=${count}`).join(", ") || "-"} | ${Object.entries(row2.runtimeHits).map(([runtime2, hits]) => `${runtime2}=${hits}`).join(", ")}${row2.catalogued ? "" : "; outside current catalogue"} |`)
|
|
67799
|
+
]
|
|
67800
|
+
].join("\n");
|
|
67801
|
+
}
|
|
67802
|
+
|
|
67803
|
+
// src/lib/runs/usage-report.ts
|
|
67804
|
+
async function loadMissionUsage(root, missionId, stream2) {
|
|
67805
|
+
const core = await findCoreSource();
|
|
67806
|
+
const catalog = await loadCatalog(core);
|
|
67807
|
+
const hookSubjects = {};
|
|
67808
|
+
for (const entry of catalog.filter((item) => item.type === "hook")) {
|
|
67809
|
+
const command2 = hookRunnerCommand(await requireData(core, `hooks/${entry.name}.sh`, 64 * 1024));
|
|
67810
|
+
if (command2 !== void 0) hookSubjects[`hook:${command2.split(" ").at(-1)}`] = entry.name;
|
|
67811
|
+
}
|
|
67812
|
+
const linked = await readUsageSessions(root, missionId, stream2.events);
|
|
67813
|
+
const incomplete = stream2.continuity !== "complete" || stream2.events.some((event) => event.missionId !== missionId);
|
|
67814
|
+
const report = projectMissionUsage({
|
|
67815
|
+
missionId,
|
|
67816
|
+
events: stream2.events,
|
|
67817
|
+
catalog,
|
|
67818
|
+
hookSubjects,
|
|
67819
|
+
linkedScopes: linked.scopes,
|
|
67820
|
+
incomplete,
|
|
67821
|
+
endedScopes: linked.links.filter((link3) => link3.status !== "open").map((link3) => link3.sourceMissionId)
|
|
67822
|
+
});
|
|
67823
|
+
const notes = [...linked.notes, ...report.notes];
|
|
67824
|
+
if (incomplete) {
|
|
67825
|
+
notes.unshift("Journal incomplete or mixed: counts cover readable linked events only, never complete usage.");
|
|
67826
|
+
}
|
|
67827
|
+
try {
|
|
67828
|
+
const stored = await loadMissionControllerPlan(root, missionId);
|
|
67829
|
+
const bound = stream2.events.some((event) => event.missionId === missionId && event.kind === "mission.started" && event.payload && typeof event.payload === "object" && !Array.isArray(event.payload) && Object.entries(event.payload).some(([key, value]) => key === "routingHash" && value === stored.routingHash));
|
|
67830
|
+
notes.unshift(bound ? `Ticket binding: ${JSON.stringify(stored.ticket.path)} (${stored.ticket.contentHash}).` : "Ticket binding unverified; scope is this mission journal, not a proven ticket.");
|
|
67831
|
+
} catch {
|
|
67832
|
+
notes.unshift("Ticket binding unavailable; scope is this mission/session journal, not a proven ticket.");
|
|
67833
|
+
}
|
|
67834
|
+
return { ...report, notes, links: linked.links };
|
|
67835
|
+
}
|
|
67836
|
+
|
|
67262
67837
|
// src/lib/runs/inspect-current.ts
|
|
67263
67838
|
init_esm_shims();
|
|
67264
|
-
async function inspectCurrentMission(roots, missionId, secrets) {
|
|
67839
|
+
async function inspectCurrentMission(roots, missionId, secrets, options2 = {}) {
|
|
67265
67840
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
67266
67841
|
const before = await computeProjectState2(roots.workRoot);
|
|
67267
67842
|
const inspected = await inspectMission(
|
|
67268
67843
|
roots.installRoot,
|
|
67269
67844
|
missionId,
|
|
67270
67845
|
{ dependencies: { "git:working-tree": before.diffHash } },
|
|
67271
|
-
{ secrets }
|
|
67846
|
+
{ secrets, ...options2 }
|
|
67272
67847
|
);
|
|
67273
67848
|
const after = await computeProjectState2(roots.workRoot);
|
|
67274
67849
|
if (before.diffHash === after.diffHash) {
|
|
@@ -67282,9 +67857,9 @@ async function inspectCurrentMission(roots, missionId, secrets) {
|
|
|
67282
67857
|
|
|
67283
67858
|
// src/lib/runs/mission-recovery.ts
|
|
67284
67859
|
init_esm_shims();
|
|
67285
|
-
async function recordStoppedMissionRecovery(root, missionId, request,
|
|
67860
|
+
async function recordStoppedMissionRecovery(root, missionId, request, observation3) {
|
|
67286
67861
|
const inspected = await inspectMission(root, missionId, { dependencies: {} });
|
|
67287
|
-
const decision = planStoppedMissionRecovery({ stream: inspected.stream, request, observation:
|
|
67862
|
+
const decision = planStoppedMissionRecovery({ stream: inspected.stream, request, observation: observation3 });
|
|
67288
67863
|
if (decision.kind === "refused") {
|
|
67289
67864
|
throw new Error(`MISSION_RECOVERY_REFUSED: ${decision.code}: ${decision.reasons.join("; ")}`);
|
|
67290
67865
|
}
|
|
@@ -67480,15 +68055,15 @@ async function observeSpecialistMigrationAssets(coreRoot, installRoot, runtime2)
|
|
|
67480
68055
|
nativeContractVersion: target.version
|
|
67481
68056
|
};
|
|
67482
68057
|
}
|
|
67483
|
-
async function recordSpecialistContractMigration(root, missionId, request,
|
|
68058
|
+
async function recordSpecialistContractMigration(root, missionId, request, observation3) {
|
|
67484
68059
|
const [inspected, stored] = await Promise.all([
|
|
67485
68060
|
inspectMission(root, missionId, { dependencies: {} }),
|
|
67486
68061
|
loadMissionControllerPlan(root, missionId)
|
|
67487
68062
|
]);
|
|
67488
|
-
if (canonicalJsonHash(stored.plan) !== canonicalJsonHash(
|
|
68063
|
+
if (canonicalJsonHash(stored.plan) !== canonicalJsonHash(observation3.plan)) {
|
|
67489
68064
|
invalid12("migration observation does not match the immutable controller plan");
|
|
67490
68065
|
}
|
|
67491
|
-
const decision = planSpecialistContractMigration({ stream: inspected.stream, request, observation:
|
|
68066
|
+
const decision = planSpecialistContractMigration({ stream: inspected.stream, request, observation: observation3 });
|
|
67492
68067
|
if (decision.kind === "refused") {
|
|
67493
68068
|
const code2 = decision.code === "stale-migration" && canonicalJsonHash(inspected.stream.events) !== request.expectedJournalHash ? "stale-journal" : decision.code;
|
|
67494
68069
|
throw new Error(`SPECIALIST_CONTRACT_MIGRATION_REFUSED: ${code2}: ${decision.reasons.join("; ")}`);
|
|
@@ -67548,7 +68123,7 @@ init_esm_shims();
|
|
|
67548
68123
|
function record25(value) {
|
|
67549
68124
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
67550
68125
|
}
|
|
67551
|
-
function
|
|
68126
|
+
function field9(value, key) {
|
|
67552
68127
|
return record25(value) ? value[key] : void 0;
|
|
67553
68128
|
}
|
|
67554
68129
|
function invalid13(detail) {
|
|
@@ -67556,12 +68131,12 @@ function invalid13(detail) {
|
|
|
67556
68131
|
}
|
|
67557
68132
|
function identity(events) {
|
|
67558
68133
|
const start = events.find((event) => event.kind === "mission.started");
|
|
67559
|
-
const runtime2 = start ?
|
|
67560
|
-
if (!start ||
|
|
68134
|
+
const runtime2 = start ? field9(start.payload, "runtime") : void 0;
|
|
68135
|
+
if (!start || field9(start.payload, "runtimeAttested") !== true || runtime2 !== "codex" && runtime2 !== "claude") invalid13("native mission runtime is not attested");
|
|
67561
68136
|
return runtime2 === "codex" ? "runtime:codex" : "runtime:claude";
|
|
67562
68137
|
}
|
|
67563
68138
|
function freshContext(events, contextId) {
|
|
67564
|
-
if (!validNativeContextId(contextId) || events.some((event) =>
|
|
68139
|
+
if (!validNativeContextId(contextId) || events.some((event) => field9(event.payload, "contextId") === contextId || field9(event.payload, "nativeContextId") === contextId)) invalid13("provide a fresh native author context");
|
|
67565
68140
|
}
|
|
67566
68141
|
function eventId2(value) {
|
|
67567
68142
|
return `evt_${createHash("sha256").update(canonicalJsonHash(value)).digest("hex")}`;
|
|
@@ -67581,9 +68156,9 @@ async function requestSpecialistEvidence(roots, missionId, input2) {
|
|
|
67581
68156
|
requireOpenMission(events);
|
|
67582
68157
|
const source2 = identity(events);
|
|
67583
68158
|
const original = events.find((event) => event.eventId === input2.completionEventId);
|
|
67584
|
-
const completion = original ? parseSpecialistCompletionValue(
|
|
68159
|
+
const completion = original ? parseSpecialistCompletionValue(field9(original.payload, "completion")) : void 0;
|
|
67585
68160
|
if (!original || original.kind !== "specialist.completed" || !completion || original.source !== source2 || original.subject !== completion.specialistId || completion.evidenceRequests.length === 0) invalid13("original author completion with evidence requests is required");
|
|
67586
|
-
const requestId = eventId2({ missionId, ...input2, completionHash: canonicalJsonHash(
|
|
68161
|
+
const requestId = eventId2({ missionId, ...input2, completionHash: canonicalJsonHash(field9(original.payload, "completion")) });
|
|
67587
68162
|
const existing = events.find((event) => event.eventId === requestId);
|
|
67588
68163
|
if (existing) return existing;
|
|
67589
68164
|
freshContext(events, input2.contextId);
|
|
@@ -67599,7 +68174,7 @@ async function requestSpecialistEvidence(roots, missionId, input2) {
|
|
|
67599
68174
|
correlationId: missionId,
|
|
67600
68175
|
payload: {
|
|
67601
68176
|
completionEventId: original.eventId,
|
|
67602
|
-
completionHash: canonicalJsonHash(
|
|
68177
|
+
completionHash: canonicalJsonHash(field9(original.payload, "completion")),
|
|
67603
68178
|
specialistId: completion.specialistId,
|
|
67604
68179
|
nativeContextId: input2.contextId,
|
|
67605
68180
|
requestId,
|
|
@@ -67621,7 +68196,7 @@ async function requestSpecialistEvidence(roots, missionId, input2) {
|
|
|
67621
68196
|
}
|
|
67622
68197
|
function exactRequest(events, input2) {
|
|
67623
68198
|
const request = events.find((event) => event.eventId === input2.requestEventId);
|
|
67624
|
-
if (!request || request.source !== "void-harness:mission.dispatch" || !["specialist.evidence-classification-requested", "specialist.evidence-discharge-requested"].includes(request.kind) ||
|
|
68199
|
+
if (!request || request.source !== "void-harness:mission.dispatch" || !["specialist.evidence-classification-requested", "specialist.evidence-discharge-requested"].includes(request.kind) || field9(request.payload, "nativeContextId") !== input2.contextId || !record25(request.payload)) {
|
|
67625
68200
|
invalid13("response must match its controller request and native context");
|
|
67626
68201
|
}
|
|
67627
68202
|
return request;
|
|
@@ -67629,7 +68204,7 @@ function exactRequest(events, input2) {
|
|
|
67629
68204
|
async function validateCompletion(events, candidate, roots, expectedSource) {
|
|
67630
68205
|
const proofs = events.flatMap((event) => {
|
|
67631
68206
|
if (event.kind !== "evidence.recorded") return [];
|
|
67632
|
-
const parsed = parseEvidence(
|
|
68207
|
+
const parsed = parseEvidence(field9(event.payload, "evidence"));
|
|
67633
68208
|
return parsed.ok ? [{ eventId: event.eventId, evidence: parsed.value }] : [];
|
|
67634
68209
|
});
|
|
67635
68210
|
const discharge2 = candidate.kind === "specialist.evidence-discharged";
|
|
@@ -67643,7 +68218,7 @@ async function validateCompletion(events, candidate, roots, expectedSource) {
|
|
|
67643
68218
|
});
|
|
67644
68219
|
if (state.issues.length > 0) invalid13(state.issues.map((value) => value.detail).join("; "));
|
|
67645
68220
|
if (discharge2) {
|
|
67646
|
-
const items =
|
|
68221
|
+
const items = field9(candidate.payload, "items");
|
|
67647
68222
|
if (!Array.isArray(items) || items.some((item) => !record25(item) || !state.obligations.some((value) => value.obligationId === item["obligationId"] && value.discharged))) {
|
|
67648
68223
|
invalid13(`requested obligations need fresh successful canonical proofs; observed git:working-tree ${dependencies["git:working-tree"]} at ${roots.workRoot}; run from the proof worktree and inspect its commit/diff binding`);
|
|
67649
68224
|
}
|
|
@@ -67687,7 +68262,7 @@ async function recordSpecialistEvidence(roots, missionId, status3, input2) {
|
|
|
67687
68262
|
requireResponseAdmission(current, status3, input2);
|
|
67688
68263
|
exactRequest(current, input2);
|
|
67689
68264
|
if (status3 === "completed") {
|
|
67690
|
-
const started = current.find((event) => event.kind === "specialist.evidence-started" && event.source === source2 && event.subject === request.subject && event.causationId === request.eventId &&
|
|
68265
|
+
const started = current.find((event) => event.kind === "specialist.evidence-started" && event.source === source2 && event.subject === request.subject && event.causationId === request.eventId && field9(event.payload, "nativeContextId") === input2.contextId);
|
|
67691
68266
|
if (!started) invalid13("author response needs its observed native started receipt");
|
|
67692
68267
|
await validateCompletion(current, {
|
|
67693
68268
|
schemaVersion: 1,
|
|
@@ -67759,7 +68334,7 @@ function parseSpecialistEvidenceResponse(status3, value) {
|
|
|
67759
68334
|
|
|
67760
68335
|
// src/lib/runs/specialist-lifecycle.ts
|
|
67761
68336
|
init_esm_shims();
|
|
67762
|
-
var
|
|
68337
|
+
var MISSION_ID11 = /^mis_[A-Za-z0-9_-]{8,100}$/;
|
|
67763
68338
|
var SPECIALIST_ID4 = /^core:[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
67764
68339
|
var AGENT_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
67765
68340
|
var HASH7 = /^sha256:[a-f0-9]{64}$/;
|
|
@@ -67795,7 +68370,7 @@ function parseEnvelope2(value) {
|
|
|
67795
68370
|
...ENVELOPE_KEYS,
|
|
67796
68371
|
...value["reviewSubject"] === void 0 ? [] : ["reviewSubject"],
|
|
67797
68372
|
...value["reviewScope"] === void 0 ? [] : ["reviewScope"]
|
|
67798
|
-
]) || value["reviewSubject"] !== void 0 && !isReviewSubject(value["reviewSubject"]) || value["reviewScope"] !== void 0 && !isReviewScope(value["reviewScope"]) || value.schemaVersion !== 1 || typeof value.missionId !== "string" || !
|
|
68373
|
+
]) || value["reviewSubject"] !== void 0 && !isReviewSubject(value["reviewSubject"]) || value["reviewScope"] !== void 0 && !isReviewScope(value["reviewScope"]) || value.schemaVersion !== 1 || typeof value.missionId !== "string" || !MISSION_ID11.test(value.missionId) || value.runtime !== "claude" && value.runtime !== "codex" || !isSpecialistId(value.specialistId) || typeof value.agentName !== "string" || !AGENT_NAME.test(value.agentName) || value.agentName !== value.specialistId.slice("core:".length) || !Number.isSafeInteger(value.contractVersion) || Number(value.contractVersion) < 1 || Number(value.contractVersion) > 1e4 || value.stage !== "pre-implementation" && value.stage !== "post-implementation" || !Number.isSafeInteger(value.reviewRound) || Number(value.reviewRound) < 1 || Number(value.reviewRound) > 8 || typeof value.inputHash !== "string" || !HASH7.test(value.inputHash)) {
|
|
67799
68374
|
invalid14("dispatch envelope is malformed");
|
|
67800
68375
|
}
|
|
67801
68376
|
const contextPack = parseContextPackValue(value.contextPack, {
|
|
@@ -67941,7 +68516,7 @@ async function recordSpecialistLifecycle(root, missionId, input2, artifactRoot =
|
|
|
67941
68516
|
if (lifecycle.status === "closed") invalid14("mission is closed");
|
|
67942
68517
|
await rejectSupersededSpecialistContract(root, missionId, events, input2.envelope, input2.contextId);
|
|
67943
68518
|
const recovery = events.filter((event) => event.kind === "mission.recovered").at(-1);
|
|
67944
|
-
const requested = events.filter((event) => event.kind === "specialist.requested" && (recovery === void 0 || event.seq > recovery.seq) && sameDispatch(event, input2.envelope) &&
|
|
68519
|
+
const requested = events.filter((event) => event.kind === "specialist.requested" && (recovery === void 0 || event.seq > recovery.seq) && sameDispatch(event, input2.envelope) && field10(event.payload, "runtime") === input2.envelope.runtime).at(-1);
|
|
67945
68520
|
if (requested === void 0) invalid14("no matching specialist.requested event exists");
|
|
67946
68521
|
const invocationId = await checkedReviewArtifact(artifactRoot, input2, events, requested);
|
|
67947
68522
|
if (invocationId !== void 0 && input2.status === "completed") {
|
|
@@ -67965,17 +68540,17 @@ async function recordSpecialistLifecycle(root, missionId, input2, artifactRoot =
|
|
|
67965
68540
|
if (input2.status === "started") {
|
|
67966
68541
|
const existing = starts.at(-1);
|
|
67967
68542
|
if (existing !== void 0) {
|
|
67968
|
-
if (
|
|
67969
|
-
const failed2 = input2.envelope.reviewSubject !== void 0 && dispatchEvents.some((event) => event.kind === "specialist.failed" && event.seq > existing.seq && sameDispatch(event, input2.envelope) &&
|
|
68543
|
+
if (field10(existing.payload, "contextId") === input2.contextId && field10(existing.payload, "reviewerId") === input2.reviewerId) return;
|
|
68544
|
+
const failed2 = input2.envelope.reviewSubject !== void 0 && dispatchEvents.some((event) => event.kind === "specialist.failed" && event.seq > existing.seq && sameDispatch(event, input2.envelope) && field10(event.payload, "contextId") === field10(existing.payload, "contextId"));
|
|
67970
68545
|
if (!failed2) invalid14("dispatch already started with another contextId");
|
|
67971
68546
|
}
|
|
67972
|
-
if (recovery !== void 0 && input2.contextId !== void 0 && events.some((event) => event.kind === "specialist.started" &&
|
|
68547
|
+
if (recovery !== void 0 && input2.contextId !== void 0 && events.some((event) => event.kind === "specialist.started" && field10(event.payload, "contextId") === input2.contextId) && !canContinueNativeReview(events, requested, input2.contextId)) {
|
|
67973
68548
|
invalid14("contextId was already used by a previous dispatch");
|
|
67974
68549
|
}
|
|
67975
68550
|
} else {
|
|
67976
|
-
const started = starts.find((event) => input2.contextId === void 0 ? event.eventId === invocationId :
|
|
68551
|
+
const started = starts.find((event) => input2.contextId === void 0 ? event.eventId === invocationId : field10(event.payload, "contextId") === input2.contextId);
|
|
67977
68552
|
if (started === void 0) invalid14("no matching independent invocation specialist.started event exists");
|
|
67978
|
-
const terminal = dispatchEvents.find((event) => sameDispatch(event, input2.envelope) && (event.kind === "specialist.completed" || event.kind === "specialist.failed" && (input2.envelope.reviewSubject === void 0 ||
|
|
68553
|
+
const terminal = dispatchEvents.find((event) => sameDispatch(event, input2.envelope) && (event.kind === "specialist.completed" || event.kind === "specialist.failed" && (input2.envelope.reviewSubject === void 0 || field10(event.payload, "contextId") === input2.contextId)));
|
|
67979
68554
|
if (terminal !== void 0) {
|
|
67980
68555
|
if (sameDraft2(terminal, draft)) return;
|
|
67981
68556
|
if (input2.envelope.reviewSubject === void 0 || terminal.kind === "specialist.completed" || input2.status !== "completed") invalid14("dispatch already has a different terminal event");
|
|
@@ -68001,7 +68576,7 @@ async function recordSpecialistLifecycle(root, missionId, input2, artifactRoot =
|
|
|
68001
68576
|
if (observedMissionLifecycle(current).episodeId !== lifecycle.episodeId) {
|
|
68002
68577
|
invalid14("mission episode changed before recording lifecycle");
|
|
68003
68578
|
}
|
|
68004
|
-
if (recovery !== void 0 && input2.status === "started" && input2.contextId !== void 0 && current.some((event) => event.kind === "specialist.started" &&
|
|
68579
|
+
if (recovery !== void 0 && input2.status === "started" && input2.contextId !== void 0 && current.some((event) => event.kind === "specialist.started" && field10(event.payload, "contextId") === input2.contextId && event.eventId !== eventId3) && !canContinueNativeReview(current, requested, input2.contextId)) {
|
|
68005
68580
|
invalid14("contextId was already used by a previous dispatch");
|
|
68006
68581
|
}
|
|
68007
68582
|
}
|
|
@@ -68015,7 +68590,7 @@ async function checkedReviewArtifact(root, input2, events, requested) {
|
|
|
68015
68590
|
const review = input2.completion.review;
|
|
68016
68591
|
const provenance4 = review.provenance;
|
|
68017
68592
|
if (provenance4.kind !== "review-artifact") return void 0;
|
|
68018
|
-
const invocation = events.find((event) => event.kind === "specialist.started" && event.source === `runtime:${input2.envelope.runtime}` && event.seq > requested.seq && sameDispatch(event, input2.envelope) && (
|
|
68593
|
+
const invocation = events.find((event) => event.kind === "specialist.started" && event.source === `runtime:${input2.envelope.runtime}` && event.seq > requested.seq && sameDispatch(event, input2.envelope) && (field10(event.payload, "reviewerId") === review.reviewerId || input2.contextId !== void 0 && field10(event.payload, "contextId") === input2.contextId));
|
|
68019
68594
|
if (invocation === void 0) invalid14("review artifact has no matching independent invocation");
|
|
68020
68595
|
const loaded = await readBoundedProjectFile({
|
|
68021
68596
|
root,
|
|
@@ -68050,15 +68625,15 @@ async function rejectSupersededSpecialistContract(root, missionId, events, envel
|
|
|
68050
68625
|
if (envelope.contractVersion !== migration.receipt.toVersion || envelope.stage !== "post-implementation" || envelope.reviewRound !== migration.receipt.reviewRound || envelope.inputHash !== migration.receipt.targetInputHash) {
|
|
68051
68626
|
invalid14("dispatch is superseded by the authenticated specialist contract migration");
|
|
68052
68627
|
}
|
|
68053
|
-
if (contextId !== void 0 && events.some((event) => event.seq < migration.seq &&
|
|
68628
|
+
if (contextId !== void 0 && events.some((event) => event.seq < migration.seq && field10(event.payload, "contextId") === contextId)) {
|
|
68054
68629
|
invalid14("migrated specialist requires a fresh native context");
|
|
68055
68630
|
}
|
|
68056
68631
|
}
|
|
68057
|
-
function
|
|
68632
|
+
function field10(value, key) {
|
|
68058
68633
|
return isRecord11(value) ? value[key] : void 0;
|
|
68059
68634
|
}
|
|
68060
68635
|
function sameDispatch(event, envelope) {
|
|
68061
|
-
return event.missionId === envelope.missionId && event.subject === envelope.specialistId &&
|
|
68636
|
+
return event.missionId === envelope.missionId && event.subject === envelope.specialistId && field10(event.payload, "stage") === envelope.stage && field10(event.payload, "reviewRound") === envelope.reviewRound && field10(event.payload, "inputHash") === envelope.inputHash && field10(event.payload, "contractVersion") === envelope.contractVersion && (envelope.reviewSubject === void 0 || field10(event.payload, "reviewSubject") !== void 0 && canonicalJsonHash(field10(event.payload, "reviewSubject")) === canonicalJsonHash(envelope.reviewSubject)) && (envelope.reviewScope === void 0 || field10(event.payload, "reviewScope") !== void 0 && canonicalJsonHash(field10(event.payload, "reviewScope")) === canonicalJsonHash(envelope.reviewScope));
|
|
68062
68637
|
}
|
|
68063
68638
|
function sameDraft2(event, draft) {
|
|
68064
68639
|
return event.source === draft.source && event.kind === draft.kind && event.subject === draft.subject && event.correlationId === draft.correlationId && event.causationId === draft.causationId && JSON.stringify(event.payload) === JSON.stringify(draft.payload);
|
|
@@ -68159,7 +68734,7 @@ async function recordSpecialistRequests(root, missionId, envelopes, planHash) {
|
|
|
68159
68734
|
init_esm_shims();
|
|
68160
68735
|
|
|
68161
68736
|
// package.json
|
|
68162
|
-
var version2 = "
|
|
68737
|
+
var version2 = "6.0.0";
|
|
68163
68738
|
|
|
68164
68739
|
// src/lib/runs/verify.ts
|
|
68165
68740
|
var MAX_CAPTURE_BYTES = 64 * 1024;
|
|
@@ -68286,7 +68861,7 @@ async function verifyMissionCommand(options2) {
|
|
|
68286
68861
|
}
|
|
68287
68862
|
|
|
68288
68863
|
// src/commands/mission.ts
|
|
68289
|
-
var
|
|
68864
|
+
var MISSION_ID12 = /^mis_[A-Za-z0-9_-]{8,100}$/;
|
|
68290
68865
|
var MAX_TICKET_BYTES2 = 1e5;
|
|
68291
68866
|
function coordinatorRuntimeIdentity(environment2) {
|
|
68292
68867
|
const codex = [
|
|
@@ -68338,7 +68913,7 @@ function missionIdFrom(options2) {
|
|
|
68338
68913
|
if (missionId === void 0) {
|
|
68339
68914
|
return invalid15("missing required option --id", "pass --id mis_<opaque-id>");
|
|
68340
68915
|
}
|
|
68341
|
-
if (!
|
|
68916
|
+
if (!MISSION_ID12.test(missionId)) {
|
|
68342
68917
|
return invalid15("invalid mission ID", "pass the ID returned by mission start");
|
|
68343
68918
|
}
|
|
68344
68919
|
return missionId;
|
|
@@ -68351,6 +68926,11 @@ function parseMissionArgs(args) {
|
|
|
68351
68926
|
return { kind: "help" };
|
|
68352
68927
|
}
|
|
68353
68928
|
const command2 = divider2 === -1 ? [] : args.slice(divider2 + 1);
|
|
68929
|
+
const usageCommand = parseUsageCommand(
|
|
68930
|
+
{ subcommand, options: options2, divider: divider2 },
|
|
68931
|
+
{ invalid: invalid15, valueAfter: valueAfter2, missionIdFrom, validateOptions: validateOptions2 }
|
|
68932
|
+
);
|
|
68933
|
+
if (usageCommand !== void 0) return usageCommand;
|
|
68354
68934
|
if (subcommand === "evidence-request" || subcommand === "evidence-event") {
|
|
68355
68935
|
if (divider2 !== -1) return invalid15("evidence commands do not accept a command", "remove --");
|
|
68356
68936
|
const names = options2.filter((value) => value.startsWith("--"));
|
|
@@ -68590,7 +69170,7 @@ function parseMissionArgs(args) {
|
|
|
68590
69170
|
`${PRODUCT_COMMAND} mission ${subcommand} --id <id>`
|
|
68591
69171
|
);
|
|
68592
69172
|
}
|
|
68593
|
-
const optionError = validateOptions2(options2, ["--id"], ["--json"]);
|
|
69173
|
+
const optionError = validateOptions2(options2, ["--id"], subcommand === "inspect" ? ["--json", "--usage"] : ["--json"]);
|
|
68594
69174
|
if (optionError !== void 0) {
|
|
68595
69175
|
return invalid15(optionError, `${PRODUCT_COMMAND} mission ${subcommand} --help`);
|
|
68596
69176
|
}
|
|
@@ -68598,6 +69178,7 @@ function parseMissionArgs(args) {
|
|
|
68598
69178
|
if (typeof missionId !== "string") return missionId;
|
|
68599
69179
|
return {
|
|
68600
69180
|
kind: subcommand,
|
|
69181
|
+
...subcommand === "inspect" && options2.includes("--usage") ? { usage: true } : {},
|
|
68601
69182
|
missionId,
|
|
68602
69183
|
json: options2.includes("--json")
|
|
68603
69184
|
};
|
|
@@ -68785,7 +69366,7 @@ async function recoverStoppedMission(roots, missionId, request) {
|
|
|
68785
69366
|
const resolutionArtifact = provenance4?.artifact ?? (request.disposition.kind === "review-blocker" || request.disposition.kind === "command-correction" ? await recoveryResolutionArtifact(workRoot, request.disposition.resolutionArtifact.path) : void 0);
|
|
68786
69367
|
const opaqueContextRecovery = request.disposition.kind === "controller-defect" && request.disposition.defect === "opaque-native-context";
|
|
68787
69368
|
const recoverySpecialists = targetedContextRecovery ? migration.plan.specialists.filter((value) => value.specialistId === "core:independent-code-reviewer") : opaqueContextRecovery || request.disposition.kind === "preparation-invocation" ? migration.plan.specialists.filter((value) => value.state === "applicable" && value.stages?.includes("pre-implementation")) : migration.plan.specialists;
|
|
68788
|
-
const
|
|
69369
|
+
const observation3 = {
|
|
68789
69370
|
...provenance4 === void 0 && !targetedContextRecovery || subject?.baseCommit === void 0 || subject.reviewedCommit === void 0 ? {} : {
|
|
68790
69371
|
...provenance4 === void 0 ? {} : { reviewBindings: provenance4.bindings },
|
|
68791
69372
|
reviewSubject: {
|
|
@@ -68804,7 +69385,7 @@ async function recoverStoppedMission(roots, missionId, request) {
|
|
|
68804
69385
|
contractVersions: Object.fromEntries(recoverySpecialists.map((value) => [value.specialistId, value.contractVersion])),
|
|
68805
69386
|
...resolutionArtifact === void 0 ? {} : { resolutionArtifact }
|
|
68806
69387
|
};
|
|
68807
|
-
const result = await recordStoppedMissionRecovery(installRoot, missionId, request,
|
|
69388
|
+
const result = await recordStoppedMissionRecovery(installRoot, missionId, request, observation3);
|
|
68808
69389
|
return { ...result, provenance: {
|
|
68809
69390
|
coreRoot,
|
|
68810
69391
|
catalogHash: canonicalJsonHash(catalog),
|
|
@@ -69199,7 +69780,10 @@ function usage() {
|
|
|
69199
69780
|
mission close --id <id> --reason interrupted|abandoned [--json]
|
|
69200
69781
|
mission verify --id <id> [--shell] [--json] -- <command...>
|
|
69201
69782
|
mission resume --id <id> [--json]
|
|
69202
|
-
mission inspect --id <id> [--json]
|
|
69783
|
+
mission inspect --id <id> [--usage] [--json]
|
|
69784
|
+
mission usage-bind --id <id> --source <session-journal-id> [--json]
|
|
69785
|
+
mission usage-unbind --id <id> --source <session-journal-id> [--json]
|
|
69786
|
+
mission advisory-start --id <id> --specialist core:<role> --runtime claude|codex --context <native-id> [--json]
|
|
69203
69787
|
mission archive --id <id> [--json]
|
|
69204
69788
|
mission prune --older-than <days> [--apply] [--json]
|
|
69205
69789
|
|
|
@@ -69257,6 +69841,10 @@ Fix: ${parsed.fix}
|
|
|
69257
69841
|
const root = roots.workRoot;
|
|
69258
69842
|
const journal = roots.installRoot;
|
|
69259
69843
|
try {
|
|
69844
|
+
if (parsed.kind === "usage-bind" || parsed.kind === "usage-unbind" || parsed.kind === "advisory-start") {
|
|
69845
|
+
process.stdout.write(await runUsageCommand(parsed, journal));
|
|
69846
|
+
return;
|
|
69847
|
+
}
|
|
69260
69848
|
if (parsed.kind === "plan") {
|
|
69261
69849
|
const plan2 = await planMission(root, parsed.ticketPath, void 0, "project-v1");
|
|
69262
69850
|
process.stdout.write(parsed.json ? `${JSON.stringify(plan2)}
|
|
@@ -69435,11 +70023,15 @@ ${selection.promotion === void 0 ? "" : `mode ${selection.requestedMode} -> ${se
|
|
|
69435
70023
|
const { inspected } = await inspectCurrentMission(
|
|
69436
70024
|
roots,
|
|
69437
70025
|
parsed.missionId,
|
|
69438
|
-
collectKnownSecrets()
|
|
70026
|
+
collectKnownSecrets(),
|
|
70027
|
+
parsed.usage ? { quarantine: false } : {}
|
|
69439
70028
|
);
|
|
70029
|
+
const usageReport = parsed.usage ? await loadMissionUsage(roots.installRoot, parsed.missionId, inspected.stream) : void 0;
|
|
69440
70030
|
process.stdout.write(
|
|
69441
|
-
parsed.json ? `${JSON.stringify(inspected.verdict)}
|
|
69442
|
-
` : `${renderInspection(inspected)}
|
|
70031
|
+
parsed.json ? `${JSON.stringify(usageReport === void 0 ? inspected.verdict : { ...inspected.verdict, usage: usageReport })}
|
|
70032
|
+
` : `${renderInspection(inspected)}${usageReport === void 0 ? "" : `
|
|
70033
|
+
|
|
70034
|
+
${renderMissionUsage(usageReport)}`}
|
|
69443
70035
|
`
|
|
69444
70036
|
);
|
|
69445
70037
|
process.exitCode = missionVerdictExitCode(inspected.verdict.status);
|
|
@@ -69952,14 +70544,14 @@ function fromZap(payload) {
|
|
|
69952
70544
|
const alerts = Array.isArray(site["alerts"]) ? site["alerts"] : [];
|
|
69953
70545
|
for (const alert of alerts) {
|
|
69954
70546
|
const name = text6(alert["name"], "unnamed alert");
|
|
69955
|
-
const
|
|
70547
|
+
const reference2 = text6(alert["alertRef"], "unknown");
|
|
69956
70548
|
findings.push({
|
|
69957
70549
|
adapter: "zap-baseline",
|
|
69958
70550
|
securityClass: "misconfiguration",
|
|
69959
70551
|
reportedSeverity: ZAP_SEVERITY[text6(alert["riskcode"], "0")] ?? "info",
|
|
69960
|
-
rule:
|
|
70552
|
+
rule: reference2,
|
|
69961
70553
|
summary: `${name}${host === "" ? "" : ` on ${host}`}`,
|
|
69962
|
-
reproduction: `zap-baseline raised alert ${
|
|
70554
|
+
reproduction: `zap-baseline raised alert ${reference2} (${name})${host === "" ? "" : ` against ${host}`}`,
|
|
69963
70555
|
remediation: text6(alert["solution"], "Read the ZAP alert reference and fix the response the scan describes.")
|
|
69964
70556
|
});
|
|
69965
70557
|
}
|