harnessed 4.25.0 → 4.26.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/dist/cli.mjs +68 -13
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -38,7 +38,7 @@ var init_package = __esm({
|
|
|
38
38
|
"package.json"() {
|
|
39
39
|
package_default = {
|
|
40
40
|
name: "harnessed",
|
|
41
|
-
version: "4.
|
|
41
|
+
version: "4.26.0",
|
|
42
42
|
description: "AI coding harness package manager + composition orchestrator",
|
|
43
43
|
type: "module",
|
|
44
44
|
license: "Apache-2.0",
|
|
@@ -448,7 +448,13 @@ var init_currentWorkflow_v1 = __esm({
|
|
|
448
448
|
evidence: Type.Optional(Type.Array(EvidenceRef)),
|
|
449
449
|
// G6 — failure counter; incremented only on each ->failed transition (drives
|
|
450
450
|
// breakLoop detection). 'rejected' is terminal and does NOT increment it.
|
|
451
|
-
fail_count: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
451
|
+
fail_count: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
452
|
+
// 4.26.0 (A3 serial-order guard) — seeding-time serial/parallel semantics
|
|
453
|
+
// carried over from the gates plan (fire[].mode/order). Optional: pre-4.26.0
|
|
454
|
+
// envelopes lack them, and the guard no-ops on entries without `mode`
|
|
455
|
+
// (back-compat fail-soft; comet 0.3.9 phase-skip lesson).
|
|
456
|
+
mode: Type.Optional(Type.Union([Type.Literal("serial"), Type.Literal("parallel")])),
|
|
457
|
+
order: Type.Optional(Type.Integer())
|
|
452
458
|
},
|
|
453
459
|
{ additionalProperties: false }
|
|
454
460
|
);
|
|
@@ -829,19 +835,25 @@ var init_planningScan = __esm({
|
|
|
829
835
|
// src/checkpoint/ledger.ts
|
|
830
836
|
var ledger_exports = {};
|
|
831
837
|
__export(ledger_exports, {
|
|
838
|
+
findSerialBlockers: () => findSerialBlockers,
|
|
832
839
|
markSub: () => markSub,
|
|
833
840
|
nextPending: () => nextPending,
|
|
834
841
|
seedLedger: () => seedLedger
|
|
835
842
|
});
|
|
836
843
|
function seedLedger(plan) {
|
|
837
844
|
const fireEntries = plan.fire.map(
|
|
838
|
-
(f, i) =>
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
+
(f, i) => {
|
|
846
|
+
const entry = { sub: f.sub, status: "pending", gate_fired: true };
|
|
847
|
+
if (f.mode === "serial" || f.mode === "parallel") entry.mode = f.mode;
|
|
848
|
+
if (f.order !== void 0) entry.order = f.order;
|
|
849
|
+
return {
|
|
850
|
+
// missing order → Infinity so explicitly-ordered subs sort ahead while
|
|
851
|
+
// unordered ones retain relative input order (stabilized by idx).
|
|
852
|
+
order: f.order ?? Number.POSITIVE_INFINITY,
|
|
853
|
+
idx: i,
|
|
854
|
+
entry
|
|
855
|
+
};
|
|
856
|
+
}
|
|
845
857
|
);
|
|
846
858
|
fireEntries.sort((a, b) => a.order - b.order || a.idx - b.idx);
|
|
847
859
|
const skipEntries = plan.skip.map(
|
|
@@ -873,8 +885,17 @@ function markSub(entries, sub, status, opts) {
|
|
|
873
885
|
function nextPending(entries) {
|
|
874
886
|
return entries.find((e) => e.status === "pending")?.sub ?? null;
|
|
875
887
|
}
|
|
888
|
+
function findSerialBlockers(entries, sub) {
|
|
889
|
+
const target = entries.find((e) => e.sub === sub);
|
|
890
|
+
if (!target) return [];
|
|
891
|
+
const eff = (e) => e.order ?? PARALLEL_MID_ANCHOR;
|
|
892
|
+
const counts = target.mode === "serial" ? (e) => e.mode === "serial" || e.mode === "parallel" : (e) => e.mode === "serial";
|
|
893
|
+
return entries.filter((e) => e.sub !== sub && e.status === "pending" && counts(e) && eff(e) < eff(target)).map((e) => e.sub);
|
|
894
|
+
}
|
|
895
|
+
var PARALLEL_MID_ANCHOR;
|
|
876
896
|
var init_ledger = __esm({
|
|
877
897
|
"src/checkpoint/ledger.ts"() {
|
|
898
|
+
PARALLEL_MID_ANCHOR = 50;
|
|
878
899
|
}
|
|
879
900
|
});
|
|
880
901
|
|
|
@@ -4101,10 +4122,10 @@ async function runMasterOrchestrator(masterName, context, packageRoot, spawnDriv
|
|
|
4101
4122
|
(m) => console.warn(m)
|
|
4102
4123
|
);
|
|
4103
4124
|
emitGateTransparency(masterName, master.delegates_to.length, gateEvalled);
|
|
4104
|
-
const
|
|
4125
|
+
const PARALLEL_MID_ANCHOR2 = 50;
|
|
4105
4126
|
const firedClauses = gateEvalled.filter((g) => g.passes).map((g) => g.clause);
|
|
4106
|
-
const serialLeading = firedClauses.filter((c) => c.mode === "serial" && (c.order ?? 0) <
|
|
4107
|
-
const serialTrailing = firedClauses.filter((c) => c.mode === "serial" && (c.order ?? 0) >=
|
|
4127
|
+
const serialLeading = firedClauses.filter((c) => c.mode === "serial" && (c.order ?? 0) < PARALLEL_MID_ANCHOR2).sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
4128
|
+
const serialTrailing = firedClauses.filter((c) => c.mode === "serial" && (c.order ?? 0) >= PARALLEL_MID_ANCHOR2).sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
4108
4129
|
const parallelClauses = firedClauses.filter((c) => (c.mode ?? "parallel") === "parallel");
|
|
4109
4130
|
const serialN = serialLeading.length + serialTrailing.length;
|
|
4110
4131
|
const parallelN = parallelClauses.length;
|
|
@@ -9710,12 +9731,38 @@ async function absorbIntentFor(sub) {
|
|
|
9710
9731
|
} catch {
|
|
9711
9732
|
}
|
|
9712
9733
|
}
|
|
9734
|
+
async function serialOrderBlockers(sub) {
|
|
9735
|
+
try {
|
|
9736
|
+
const { readCurrentWorkflow: readCurrentWorkflow2 } = await Promise.resolve().then(() => (init_state(), state_exports));
|
|
9737
|
+
const { findSerialBlockers: findSerialBlockers2 } = await Promise.resolve().then(() => (init_ledger(), ledger_exports));
|
|
9738
|
+
const wf = await readCurrentWorkflow2();
|
|
9739
|
+
return findSerialBlockers2(wf?.sub_progress ?? [], sub);
|
|
9740
|
+
} catch (e) {
|
|
9741
|
+
console.warn(`[harnessed] serial-order guard skipped (fail-soft): ${e.message}`);
|
|
9742
|
+
return [];
|
|
9743
|
+
}
|
|
9744
|
+
}
|
|
9745
|
+
function enforceSerialOrder(action, sub, blockers, force) {
|
|
9746
|
+
if (blockers.length === 0) return true;
|
|
9747
|
+
if (!force) {
|
|
9748
|
+
console.error(
|
|
9749
|
+
`[harnessed] checkpoint ${action} BLOCKED: ${sub} \u2014 ${blockers.length} earlier serial-sequence sub(s) still pending (serial-order guard, fail-closed):`
|
|
9750
|
+
);
|
|
9751
|
+
for (const b of blockers) console.error(` - ${b} (complete or fail it first)`);
|
|
9752
|
+
console.error(" (re-run with --force to jump the sequence deliberately)");
|
|
9753
|
+
return false;
|
|
9754
|
+
}
|
|
9755
|
+
console.warn(
|
|
9756
|
+
`[harnessed] serial-order guard overridden (--force): ${action} ${sub} ahead of pending sub(s) ${blockers.join(", ")}`
|
|
9757
|
+
);
|
|
9758
|
+
return true;
|
|
9759
|
+
}
|
|
9713
9760
|
function registerCheckpoint(program2) {
|
|
9714
9761
|
program2.command("checkpoint <action> <sub>").description(
|
|
9715
9762
|
"Record workflow progress: intent | start | complete | fail <sub-workflow> (writes to ~/.claude/harnessed/checkpoints/)"
|
|
9716
9763
|
).option("--summary <text>", "short summary stored as the checkpoint lastTask").option("--plan <json>", "gates plan JSON (start only) \u2014 seeds the sub-progress ledger").option(
|
|
9717
9764
|
"--force",
|
|
9718
|
-
"complete
|
|
9765
|
+
"complete/fail \u2014 override a fail-closed guard: the missing-artifact evidence block (complete; records overridden) or the serial-order guard"
|
|
9719
9766
|
).option(
|
|
9720
9767
|
"--tokens <n>",
|
|
9721
9768
|
"complete only \u2014 conversation token count; auto-compacts the ledger when >= the shouldCompact threshold (Phase 14)"
|
|
@@ -9835,6 +9882,10 @@ function registerCheckpoint(program2) {
|
|
|
9835
9882
|
return;
|
|
9836
9883
|
}
|
|
9837
9884
|
if (action === "complete") {
|
|
9885
|
+
if (!enforceSerialOrder("complete", sub, await serialOrderBlockers(sub), opts.force)) {
|
|
9886
|
+
process.exit(1);
|
|
9887
|
+
return;
|
|
9888
|
+
}
|
|
9838
9889
|
const { checkArtifacts: checkArtifacts2 } = await Promise.resolve().then(() => (init_evidence(), evidence_exports));
|
|
9839
9890
|
const { mutateSubProgress: mutateSubProgress3 } = await Promise.resolve().then(() => (init_state(), state_exports));
|
|
9840
9891
|
const { getAssetsRoot: getAssetsRoot2 } = await Promise.resolve().then(() => (init_assetsRoot(), assetsRoot_exports));
|
|
@@ -9924,6 +9975,10 @@ function registerCheckpoint(program2) {
|
|
|
9924
9975
|
process.exit(0);
|
|
9925
9976
|
return;
|
|
9926
9977
|
}
|
|
9978
|
+
if (!enforceSerialOrder("fail", sub, await serialOrderBlockers(sub), opts.force)) {
|
|
9979
|
+
process.exit(1);
|
|
9980
|
+
return;
|
|
9981
|
+
}
|
|
9927
9982
|
const { mutateSubProgress: mutateSubProgress2 } = await Promise.resolve().then(() => (init_state(), state_exports));
|
|
9928
9983
|
await mutateSubProgress2((e) => markIfSeeded(e, sub, "failed"));
|
|
9929
9984
|
await absorbIntentFor(sub);
|