opencode-swarm 7.178.0 → 7.178.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
- package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
- package/dist/cli/{coder-settlement-d2bfb25j.js → coder-settlement-m03dfyec.js} +11 -11
- package/dist/cli/{config-doctor-905x2s1c.js → config-doctor-x8b260sh.js} +2 -2
- package/dist/cli/{core-k7wfx1wx.js → core-2d0xcyby.js} +3 -3
- package/dist/cli/{curation-policy-n4hd2wsa.js → curation-policy-7am15ht9.js} +5 -5
- package/dist/cli/{curator-wyadq69k.js → curator-5kfkqzc9.js} +37 -37
- package/dist/cli/{curator-drift-smqmej5v.js → curator-drift-d93pwt8h.js} +5 -5
- package/dist/cli/curator-llm-factory-rgdb2ee5.js +72 -0
- package/dist/cli/{evidence-summary-service-r3wcprfk.js → evidence-summary-service-959pwbwb.js} +16 -16
- package/dist/cli/{gate-evidence-tq9rb2aj.js → gate-evidence-66kjx6zj.js} +6 -6
- package/dist/cli/guardrail-explain-rre9ntq3.js +73 -0
- package/dist/cli/{guardrail-log-m6twga6x.js → guardrail-log-t0ydqz5s.js} +7 -7
- package/dist/cli/{guardrail-reset-86esv8cr.js → guardrail-reset-6gad352a.js} +37 -37
- package/dist/cli/{hive-promoter-s87hkb40.js → hive-promoter-zgnagx67.js} +37 -37
- package/dist/cli/{index-yeh78c1g.js → index-0pmh1kks.js} +2 -2
- package/dist/cli/{index-kfk403mc.js → index-1hgqs8j8.js} +4 -4
- package/dist/cli/{index-swxaa0zs.js → index-1jcy4gc6.js} +37 -37
- package/dist/cli/{index-qk29b7s4.js → index-1qnykdaw.js} +39 -39
- package/dist/cli/{index-zex7644g.js → index-1zrrerev.js} +2 -2
- package/dist/cli/{index-pm7c6f66.js → index-2b0ktpbf.js} +2 -2
- package/dist/cli/{index-2vhkwy6v.js → index-2e6txjp7.js} +2 -2
- package/dist/cli/{index-2mdk6nt9.js → index-2pyba37z.js} +7 -7
- package/dist/cli/{index-2b1whj28.js → index-3pzwsesm.js} +2 -2
- package/dist/cli/{index-rp0jk48x.js → index-4e4zsj2g.js} +7 -7
- package/dist/cli/{index-vfc7d22n.js → index-6e8fpjdg.js} +1 -1
- package/dist/cli/{index-wkde35ej.js → index-7kty6f59.js} +8 -8
- package/dist/cli/{index-mpcp6rmj.js → index-7n4dtzk4.js} +1 -1
- package/dist/cli/{index-d5dexrv1.js → index-b50qevsm.js} +4 -4
- package/dist/cli/{index-y6a2bkp1.js → index-bb148vht.js} +2 -2
- package/dist/cli/{index-2bmhe2jn.js → index-byfrearz.js} +3 -3
- package/dist/cli/{index-sqngtwyq.js → index-eq1n57tg.js} +1 -1
- package/dist/cli/{index-jzxeymr0.js → index-h0kyy9rd.js} +93 -227
- package/dist/cli/{index-bfz1jvcn.js → index-h4nh6s8b.js} +1 -1
- package/dist/cli/{index-p27az2hc.js → index-j7w16s92.js} +3 -3
- package/dist/cli/{index-azy3tw6c.js → index-kj599831.js} +2 -2
- package/dist/cli/{index-ke3m026z.js → index-ksq6cqg0.js} +14 -7
- package/dist/cli/{index-j3rkh9mp.js → index-kz9pcqn9.js} +2 -2
- package/dist/cli/{index-zsp9de3k.js → index-ne9zamcs.js} +7 -7
- package/dist/cli/{index-q9vb5e7n.js → index-nrfjjqm4.js} +1 -1
- package/dist/cli/{index-tnjmn0dn.js → index-nzekzzs2.js} +4 -4
- package/dist/cli/{index-wfbh1bx8.js → index-pk97v7b8.js} +3 -3
- package/dist/cli/{index-gg44hytk.js → index-pyxs697r.js} +33 -8
- package/dist/cli/{index-18hjycr1.js → index-qbs49vge.js} +30 -2
- package/dist/cli/{index-zsm8h8y1.js → index-r78kphsr.js} +4 -4
- package/dist/cli/{index-zmb8fjp5.js → index-s4bkey0q.js} +1 -1
- package/dist/cli/{index-yj1kr0ft.js → index-t8dqe4ns.js} +1 -1
- package/dist/cli/{index-j1v54ahd.js → index-w1b5qqnp.js} +2 -2
- package/dist/cli/{index-heg4em8j.js → index-wajcx84s.js} +2917 -2722
- package/dist/cli/{index-w4yjy3vp.js → index-whjrhatw.js} +1 -1
- package/dist/cli/{index-qs8eth8h.js → index-x1m1nnry.js} +3 -3
- package/dist/cli/{index-at0ygwwp.js → index-x54339yd.js} +5 -5
- package/dist/cli/{index-29begjkp.js → index-xr3eye3f.js} +8 -8
- package/dist/cli/{index-ffqy30e5.js → index-xr9n0vjv.js} +1 -1
- package/dist/cli/{index-y74n1sy8.js → index-yew23624.js} +7 -7
- package/dist/cli/{index-wbkxbgk8.js → index-zv3j0v08.js} +1 -1
- package/dist/cli/index.js +38 -38
- package/dist/cli/{knowledge-escalator-rgz471df.js → knowledge-escalator-5r6mww64.js} +12 -12
- package/dist/cli/{knowledge-events-4mq0ypx9.js → knowledge-events-typjw0sd.js} +10 -10
- package/dist/cli/{knowledge-link-npk50523.js → knowledge-link-mvykydxg.js} +4 -4
- package/dist/cli/{knowledge-store-gft25s5t.js → knowledge-store-9qcf3emn.js} +5 -5
- package/dist/cli/{knowledge-validator-ejqacbx4.js → knowledge-validator-k6ydsxzy.js} +7 -7
- package/dist/cli/{mcp-emaeeq4s.js → mcp-tedxsgey.js} +1 -1
- package/dist/cli/{pending-delegations-4bhkcykk.js → pending-delegations-d20fnrzv.js} +12 -12
- package/dist/cli/{pr-subscriptions-h1n6dbds.js → pr-subscriptions-awwhg139.js} +12 -12
- package/dist/cli/{pr-workflow-gate-wn6v5za8.js → pr-workflow-gate-ke79bb9c.js} +37 -37
- package/dist/cli/{runner-ffy5ahhz.js → runner-y3sydwtj.js} +5 -5
- package/dist/cli/{scan-cursor-e63t0g5b.js → scan-cursor-16s6dp7f.js} +6 -6
- package/dist/cli/{schema-4k4hr33y.js → schema-nqjp43vq.js} +1 -1
- package/dist/cli/{scope-persistence-qcw3rtxq.js → scope-persistence-8z1hwdr2.js} +19 -15
- package/dist/cli/{server-58s1wwap.js → server-x16hp9aq.js} +44 -42
- package/dist/cli/{skill-generator-fhj13jmq.js → skill-generator-xadg43ph.js} +14 -14
- package/dist/cli/{snapshot-coordination-init-5fawrj35.js → snapshot-coordination-init-3yyzb2c4.js} +37 -37
- package/dist/cli/{telemetry-ca8dmn26.js → telemetry-c9wv2cfw.js} +1 -1
- package/dist/cli/{workspace-snapshot-v5qyjxg0.js → workspace-snapshot-rfnn80dg.js} +3 -3
- package/dist/cli/{worktree-collision-ownership-hjk0jx19.js → worktree-collision-ownership-drqhmmtd.js} +13 -13
- package/dist/cli/{worktree-isolation-aj20bs6q.js → worktree-isolation-aebdyb1m.js} +37 -37
- package/dist/config/plan-schema.d.ts +23 -0
- package/dist/evidence/phase-participation.d.ts +3 -2
- package/dist/hooks/delegation-gate.d.ts +1 -1
- package/dist/hooks/extractors.d.ts +5 -1
- package/dist/index.js +506 -504
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/memory-family-migration.d.ts +35 -3
- package/dist/plan/ledger.d.ts +14 -0
- package/dist/plan/manager.d.ts +0 -2
- package/dist/plan/parallel-verdict.d.ts +28 -14
- package/dist/scope/scope-persistence.d.ts +41 -0
- package/dist/tools/plan-conflict-check.d.ts +7 -6
- package/package.json +1 -1
- package/dist/cli/curator-llm-factory-qhhxev17.js +0 -72
- package/dist/cli/guardrail-explain-kvgejh24.js +0 -73
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
EvaluationRunV1Schema,
|
|
4
4
|
GateAuditResultV1Schema,
|
|
5
5
|
getProtectedEvaluationRunIds
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-7n4dtzk4.js";
|
|
7
7
|
import {
|
|
8
8
|
readEffectiveSpecSync
|
|
9
9
|
} from "./index-n1tcj1q7.js";
|
|
@@ -23,13 +23,13 @@ import {
|
|
|
23
23
|
readTaskEvidence,
|
|
24
24
|
readTaskEvidenceRaw,
|
|
25
25
|
sanitizeTaskId
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-1hgqs8j8.js";
|
|
27
27
|
import {
|
|
28
28
|
estimateCharsForTokens,
|
|
29
29
|
estimateTokens,
|
|
30
30
|
readSwarmFileAsync,
|
|
31
31
|
validateSwarmPath
|
|
32
|
-
} from "./index-
|
|
32
|
+
} from "./index-s4bkey0q.js";
|
|
33
33
|
import {
|
|
34
34
|
bunHash,
|
|
35
35
|
bunWrite,
|
|
@@ -58,10 +58,10 @@ import {
|
|
|
58
58
|
replayFromLedgerWithStatus,
|
|
59
59
|
takeSnapshotEvent,
|
|
60
60
|
takeSnapshotWithRetry
|
|
61
|
-
} from "./index-
|
|
61
|
+
} from "./index-ksq6cqg0.js";
|
|
62
62
|
import {
|
|
63
63
|
appendCoreEventSync
|
|
64
|
-
} from "./index-
|
|
64
|
+
} from "./index-w1b5qqnp.js";
|
|
65
65
|
import {
|
|
66
66
|
derivePlanId,
|
|
67
67
|
derivePlanIdentityHash,
|
|
@@ -69,32 +69,34 @@ import {
|
|
|
69
69
|
importCoordinationOnce,
|
|
70
70
|
listCoordinationStates,
|
|
71
71
|
transitionCoordinationState
|
|
72
|
-
} from "./index-
|
|
72
|
+
} from "./index-whjrhatw.js";
|
|
73
73
|
import {
|
|
74
74
|
DURABILITY_CLASSES,
|
|
75
75
|
getProjectDb,
|
|
76
76
|
projectDbExists,
|
|
77
77
|
withDurabilityClass
|
|
78
|
-
} from "./index-
|
|
78
|
+
} from "./index-nzekzzs2.js";
|
|
79
79
|
import {
|
|
80
80
|
assertProjectRoot,
|
|
81
81
|
tryAcquireLock,
|
|
82
82
|
withEvidenceLock
|
|
83
|
-
} from "./index-
|
|
83
|
+
} from "./index-kz9pcqn9.js";
|
|
84
84
|
import {
|
|
85
85
|
emit
|
|
86
|
-
} from "./index-
|
|
86
|
+
} from "./index-pk97v7b8.js";
|
|
87
87
|
import {
|
|
88
88
|
atomicWriteSwarmFileSync,
|
|
89
89
|
invalidateCachedArtifact,
|
|
90
90
|
readCachedParsedFile
|
|
91
|
-
} from "./index-
|
|
91
|
+
} from "./index-ne9zamcs.js";
|
|
92
92
|
import {
|
|
93
93
|
canonicalRootKeyFresh
|
|
94
94
|
} from "./index-1xnse449.js";
|
|
95
95
|
import {
|
|
96
|
-
PlanSchema
|
|
97
|
-
|
|
96
|
+
PlanSchema,
|
|
97
|
+
normalizeCurrentPhaseInPlace,
|
|
98
|
+
resolveActivePhaseId
|
|
99
|
+
} from "./index-qbs49vge.js";
|
|
98
100
|
import {
|
|
99
101
|
GIT_BINARY_ENV_VAR,
|
|
100
102
|
describeGitResolution,
|
|
@@ -116,6 +118,9 @@ import {
|
|
|
116
118
|
init_logger,
|
|
117
119
|
warn
|
|
118
120
|
} from "./index-zgwm4ryv.js";
|
|
121
|
+
import {
|
|
122
|
+
__require
|
|
123
|
+
} from "./index-a76rekgs.js";
|
|
119
124
|
|
|
120
125
|
// src/plan/manager.ts
|
|
121
126
|
import {
|
|
@@ -128,7 +133,7 @@ import {
|
|
|
128
133
|
writeFileSync
|
|
129
134
|
} from "fs";
|
|
130
135
|
import * as fsPromises from "fs/promises";
|
|
131
|
-
import * as
|
|
136
|
+
import * as path3 from "path";
|
|
132
137
|
|
|
133
138
|
// src/db/task-checkpoint-receipt.ts
|
|
134
139
|
import { createHash } from "crypto";
|
|
@@ -1545,156 +1550,10 @@ var _internals3 = {
|
|
|
1545
1550
|
}
|
|
1546
1551
|
};
|
|
1547
1552
|
|
|
1548
|
-
// src/turbo/lean/conflicts.ts
|
|
1549
|
-
import * as fs3 from "fs";
|
|
1550
|
-
import * as path3 from "path";
|
|
1551
|
-
|
|
1552
|
-
// src/utils/path.ts
|
|
1553
|
-
function normalizePath(p) {
|
|
1554
|
-
if (!p)
|
|
1555
|
-
return "";
|
|
1556
|
-
let result = p.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\.\//, "").replace(/(?:^|\/)\.\//g, "/");
|
|
1557
|
-
result = result.replace(/\/$/, "");
|
|
1558
|
-
result = result.replace(/\/\.$/, "");
|
|
1559
|
-
if (process.platform === "win32")
|
|
1560
|
-
result = result.toLowerCase();
|
|
1561
|
-
if (!result) {
|
|
1562
|
-
const norm = p.replace(/\\/g, "/");
|
|
1563
|
-
if (norm === "." || norm === "./")
|
|
1564
|
-
return ".";
|
|
1565
|
-
return "";
|
|
1566
|
-
}
|
|
1567
|
-
return result;
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
// src/turbo/lean/conflicts.ts
|
|
1571
|
-
var DEFAULT_GLOBAL_FILES = [
|
|
1572
|
-
"package.json",
|
|
1573
|
-
"package-lock.json",
|
|
1574
|
-
"bun.lock",
|
|
1575
|
-
"bun.lockb",
|
|
1576
|
-
"pnpm-lock.yaml",
|
|
1577
|
-
"yarn.lock",
|
|
1578
|
-
"Cargo.lock",
|
|
1579
|
-
"Gemfile.lock",
|
|
1580
|
-
"composer.lock",
|
|
1581
|
-
"poetry.lock",
|
|
1582
|
-
"go.mod",
|
|
1583
|
-
"go.sum",
|
|
1584
|
-
"tsconfig.json",
|
|
1585
|
-
"bunfig.toml",
|
|
1586
|
-
"CHANGELOG.md",
|
|
1587
|
-
".release-please-manifest.json",
|
|
1588
|
-
"src/index.ts",
|
|
1589
|
-
"src/tools/index.ts",
|
|
1590
|
-
"src/agents/index.ts",
|
|
1591
|
-
"src/config/index.ts",
|
|
1592
|
-
"src/hooks/index.ts",
|
|
1593
|
-
"turbo.json",
|
|
1594
|
-
"nx.json",
|
|
1595
|
-
"packageManager",
|
|
1596
|
-
".npmrc",
|
|
1597
|
-
".nvmrc",
|
|
1598
|
-
".node-version"
|
|
1599
|
-
];
|
|
1600
|
-
var DEFAULT_PROTECTED_PATTERNS = [
|
|
1601
|
-
"guardrail",
|
|
1602
|
-
"delegation",
|
|
1603
|
-
"authority",
|
|
1604
|
-
"permission",
|
|
1605
|
-
"crypto",
|
|
1606
|
-
"secret",
|
|
1607
|
-
"security",
|
|
1608
|
-
"auth",
|
|
1609
|
-
"/auth/",
|
|
1610
|
-
"/auth.",
|
|
1611
|
-
"auth.",
|
|
1612
|
-
".env",
|
|
1613
|
-
"credentials",
|
|
1614
|
-
"secrets",
|
|
1615
|
-
"private",
|
|
1616
|
-
"/security/",
|
|
1617
|
-
"/security.",
|
|
1618
|
-
"/protect/",
|
|
1619
|
-
"/protect."
|
|
1620
|
-
];
|
|
1621
|
-
var BARREL_FILE_PATTERNS = [
|
|
1622
|
-
/\/index\.ts$/,
|
|
1623
|
-
/\/index\.tsx$/,
|
|
1624
|
-
/\/index\.js$/,
|
|
1625
|
-
/\/index\.mjs$/,
|
|
1626
|
-
/\/exports\.ts$/,
|
|
1627
|
-
/\/types\.ts$/
|
|
1628
|
-
];
|
|
1629
|
-
function pathsConflict(path1, path22) {
|
|
1630
|
-
if (process.platform === "win32") {
|
|
1631
|
-
path1 = path1.toLowerCase();
|
|
1632
|
-
path22 = path22.toLowerCase();
|
|
1633
|
-
}
|
|
1634
|
-
if (path1 === path22) {
|
|
1635
|
-
return true;
|
|
1636
|
-
}
|
|
1637
|
-
const [shorter, longer] = path1.length <= path22.length ? [path1, path22] : [path22, path1];
|
|
1638
|
-
if (longer.startsWith(`${shorter}/`)) {
|
|
1639
|
-
return true;
|
|
1640
|
-
}
|
|
1641
|
-
return false;
|
|
1642
|
-
}
|
|
1643
|
-
function isGlobalFile(normalizedPath) {
|
|
1644
|
-
if (DEFAULT_GLOBAL_FILES.some((gf) => normalizedPath.endsWith(gf))) {
|
|
1645
|
-
return true;
|
|
1646
|
-
}
|
|
1647
|
-
for (const pattern of BARREL_FILE_PATTERNS) {
|
|
1648
|
-
if (pattern.test(normalizedPath)) {
|
|
1649
|
-
return true;
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
return false;
|
|
1653
|
-
}
|
|
1654
|
-
function isProtectedPath(normalizedPath) {
|
|
1655
|
-
const lowerPath = normalizedPath.toLowerCase();
|
|
1656
|
-
for (const pattern of DEFAULT_PROTECTED_PATTERNS) {
|
|
1657
|
-
if (lowerPath.includes(pattern.toLowerCase())) {
|
|
1658
|
-
if (pattern === "auth" || pattern === "/auth/") {
|
|
1659
|
-
if (lowerPath === "auth" || lowerPath.endsWith("/auth") || lowerPath.includes("/auth/")) {
|
|
1660
|
-
return true;
|
|
1661
|
-
}
|
|
1662
|
-
} else if (pattern === "auth.") {
|
|
1663
|
-
const idx = lowerPath.indexOf("auth.");
|
|
1664
|
-
if (idx !== -1) {
|
|
1665
|
-
const before = idx === 0 || lowerPath[idx - 1] === "/";
|
|
1666
|
-
if (before) {
|
|
1667
|
-
return true;
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
} else {
|
|
1671
|
-
return true;
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
}
|
|
1675
|
-
return false;
|
|
1676
|
-
}
|
|
1677
|
-
function readTaskScopes(directory, taskId) {
|
|
1678
|
-
const scopePath = path3.join(directory, ".swarm", "scopes", `scope-${taskId}.json`);
|
|
1679
|
-
try {
|
|
1680
|
-
if (!fs3.existsSync(scopePath)) {
|
|
1681
|
-
return null;
|
|
1682
|
-
}
|
|
1683
|
-
const raw = fs3.readFileSync(scopePath, "utf-8");
|
|
1684
|
-
const parsed = JSON.parse(raw);
|
|
1685
|
-
if (!parsed || !Array.isArray(parsed.files)) {
|
|
1686
|
-
return null;
|
|
1687
|
-
}
|
|
1688
|
-
return parsed.files;
|
|
1689
|
-
} catch {
|
|
1690
|
-
return null;
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
1553
|
// src/utils/spec-hash.ts
|
|
1695
1554
|
import { createHash as createHash4 } from "crypto";
|
|
1696
1555
|
import * as fsSync2 from "fs";
|
|
1697
|
-
import { join as
|
|
1556
|
+
import { join as join2 } from "path";
|
|
1698
1557
|
async function computeSpecHash(directory) {
|
|
1699
1558
|
const spec = _internals4.readEffectiveSpecSync(directory);
|
|
1700
1559
|
if (!spec)
|
|
@@ -1723,7 +1582,7 @@ async function isSpecStale(directory, plan) {
|
|
|
1723
1582
|
return { stale: false };
|
|
1724
1583
|
}
|
|
1725
1584
|
function isObligationPreserving(directory) {
|
|
1726
|
-
const snapshotPath =
|
|
1585
|
+
const snapshotPath = join2(directory, ".swarm", "spec-snapshot.md");
|
|
1727
1586
|
try {
|
|
1728
1587
|
let recordedContent;
|
|
1729
1588
|
try {
|
|
@@ -1769,7 +1628,7 @@ var _internals4 = {
|
|
|
1769
1628
|
readEffectiveSpecSync
|
|
1770
1629
|
};
|
|
1771
1630
|
function computeSpecDiff(directory) {
|
|
1772
|
-
const snapshotPath =
|
|
1631
|
+
const snapshotPath = join2(directory, ".swarm", "spec-snapshot.md");
|
|
1773
1632
|
let recordedContent;
|
|
1774
1633
|
try {
|
|
1775
1634
|
const snapshotSize = fsSync2.statSync(snapshotPath).size;
|
|
@@ -1888,7 +1747,6 @@ var _internals5 = {
|
|
|
1888
1747
|
regeneratePlanMarkdown,
|
|
1889
1748
|
isGitRepo,
|
|
1890
1749
|
isEpicModeActiveForProject,
|
|
1891
|
-
readTaskScopes,
|
|
1892
1750
|
commitTaskCompletion,
|
|
1893
1751
|
getWorktreeMergeFailure,
|
|
1894
1752
|
recordTaskAttempt
|
|
@@ -2042,7 +1900,7 @@ async function surfaceLedgerStaleIfPersisted(directory, plan) {
|
|
|
2042
1900
|
return plan;
|
|
2043
1901
|
}
|
|
2044
1902
|
async function parsePlanJsonCached(directory) {
|
|
2045
|
-
const planJsonPath =
|
|
1903
|
+
const planJsonPath = path3.resolve(directory, ".swarm", "plan.json");
|
|
2046
1904
|
return readCachedParsedFile(planJsonPath, PLAN_JSON_CACHE_NAMESPACE, () => _internals5.readPlanJsonUtf8(directory), (planJsonContent) => {
|
|
2047
1905
|
if (planJsonContent.includes("\x00")) {
|
|
2048
1906
|
throw new Error("Plan rejected: .swarm/plan.json contains null bytes");
|
|
@@ -2110,13 +1968,13 @@ async function isPlanMdInSync(directory, plan, cache) {
|
|
|
2110
1968
|
}
|
|
2111
1969
|
async function regeneratePlanMarkdown(directory, plan) {
|
|
2112
1970
|
assertProjectRoot(directory);
|
|
2113
|
-
const swarmDir =
|
|
1971
|
+
const swarmDir = path3.resolve(directory, ".swarm");
|
|
2114
1972
|
const contentHash = computePlanContentHash(plan);
|
|
2115
1973
|
const markdown = derivePlanMarkdown(plan);
|
|
2116
1974
|
const markdownWithHash = `<!-- PLAN_HASH: ${contentHash} -->
|
|
2117
1975
|
${markdown}`;
|
|
2118
|
-
const mdPath =
|
|
2119
|
-
const mdTempPath =
|
|
1976
|
+
const mdPath = path3.join(swarmDir, "plan.md");
|
|
1977
|
+
const mdTempPath = path3.join(swarmDir, `plan.md.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
|
|
2120
1978
|
try {
|
|
2121
1979
|
await bunWrite(mdTempPath, markdownWithHash);
|
|
2122
1980
|
renameSync2(mdTempPath, mdPath);
|
|
@@ -2229,7 +2087,7 @@ async function loadPlan(directory, cache) {
|
|
|
2229
2087
|
try {
|
|
2230
2088
|
assertProjectRoot(directory);
|
|
2231
2089
|
const diffInfo = computeSpecDiff(directory);
|
|
2232
|
-
const specStalenessPath =
|
|
2090
|
+
const specStalenessPath = path3.join(directory, ".swarm", "spec-staleness.json");
|
|
2233
2091
|
await fsPromises.writeFile(specStalenessPath, JSON.stringify({
|
|
2234
2092
|
type: "spec_stale_detected",
|
|
2235
2093
|
timestamp: new Date().toISOString(),
|
|
@@ -2553,6 +2411,7 @@ async function savePlan(directory, plan, options) {
|
|
|
2553
2411
|
} catch {}
|
|
2554
2412
|
}
|
|
2555
2413
|
derivePhaseStatusesInPlace(validated);
|
|
2414
|
+
normalizeCurrentPhaseInPlace(validated);
|
|
2556
2415
|
const currentPlan = await _internals5.loadPlanJsonOnly(directory);
|
|
2557
2416
|
const planId = derivePlanId(validated);
|
|
2558
2417
|
const planHashForInit = computePlanLedgerHash(validated);
|
|
@@ -2750,9 +2609,9 @@ async function savePlan(directory, plan, options) {
|
|
|
2750
2609
|
source: "savePlan_manager"
|
|
2751
2610
|
});
|
|
2752
2611
|
}
|
|
2753
|
-
const swarmDir =
|
|
2754
|
-
const planPath =
|
|
2755
|
-
const tempPath =
|
|
2612
|
+
const swarmDir = path3.resolve(directory, ".swarm");
|
|
2613
|
+
const planPath = path3.join(swarmDir, "plan.json");
|
|
2614
|
+
const tempPath = path3.join(swarmDir, `plan.json.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
|
|
2756
2615
|
try {
|
|
2757
2616
|
await bunWrite(tempPath, JSON.stringify(projectedPlan, null, 2));
|
|
2758
2617
|
options?.preCommitCheck?.();
|
|
@@ -2765,7 +2624,7 @@ async function savePlan(directory, plan, options) {
|
|
|
2765
2624
|
invalidateCachedArtifact(planPath);
|
|
2766
2625
|
await _internals5.verifyWrittenPlanJson(directory, projectedPlan);
|
|
2767
2626
|
try {
|
|
2768
|
-
const markerPath =
|
|
2627
|
+
const markerPath = path3.join(swarmDir, ".plan-write-marker");
|
|
2769
2628
|
const inProgressMarker = JSON.stringify({
|
|
2770
2629
|
source: "plan_manager",
|
|
2771
2630
|
timestamp: new Date().toISOString(),
|
|
@@ -2781,8 +2640,8 @@ async function savePlan(directory, plan, options) {
|
|
|
2781
2640
|
const markdown = derivePlanMarkdown(projectedPlan);
|
|
2782
2641
|
const markdownWithHash = `<!-- PLAN_HASH: ${contentHash} -->
|
|
2783
2642
|
${markdown}`;
|
|
2784
|
-
const mdPath =
|
|
2785
|
-
const mdTempPath =
|
|
2643
|
+
const mdPath = path3.join(swarmDir, "plan.md");
|
|
2644
|
+
const mdTempPath = path3.join(swarmDir, `plan.md.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
|
|
2786
2645
|
try {
|
|
2787
2646
|
await bunWrite(mdTempPath, markdownWithHash);
|
|
2788
2647
|
renameSync2(mdTempPath, mdPath);
|
|
@@ -2805,7 +2664,7 @@ ${markdown}`;
|
|
|
2805
2664
|
} catch {}
|
|
2806
2665
|
}
|
|
2807
2666
|
try {
|
|
2808
|
-
const markerPath =
|
|
2667
|
+
const markerPath = path3.join(swarmDir, ".plan-write-marker");
|
|
2809
2668
|
const tasksCount = projectedPlan.phases.reduce((sum, phase) => sum + phase.tasks.length, 0);
|
|
2810
2669
|
const marker = JSON.stringify({
|
|
2811
2670
|
source: "plan_manager",
|
|
@@ -2861,11 +2720,11 @@ async function rebuildPlan(directory, plan, options) {
|
|
|
2861
2720
|
const targetPlan = plan ?? await replayFromLedger(directory);
|
|
2862
2721
|
if (!targetPlan)
|
|
2863
2722
|
return null;
|
|
2864
|
-
const swarmDir =
|
|
2865
|
-
const planPath =
|
|
2866
|
-
const mdPath =
|
|
2723
|
+
const swarmDir = path3.join(directory, ".swarm");
|
|
2724
|
+
const planPath = path3.join(swarmDir, "plan.json");
|
|
2725
|
+
const mdPath = path3.join(swarmDir, "plan.md");
|
|
2867
2726
|
mkdirSync2(swarmDir, { recursive: true });
|
|
2868
|
-
const tempPlanPath =
|
|
2727
|
+
const tempPlanPath = path3.join(swarmDir, `plan.json.rebuild.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
|
|
2869
2728
|
{
|
|
2870
2729
|
const fd = openSync(tempPlanPath, "w");
|
|
2871
2730
|
try {
|
|
@@ -2878,7 +2737,7 @@ async function rebuildPlan(directory, plan, options) {
|
|
|
2878
2737
|
renameSync2(tempPlanPath, planPath);
|
|
2879
2738
|
invalidateCachedArtifact(planPath);
|
|
2880
2739
|
try {
|
|
2881
|
-
const markerPath =
|
|
2740
|
+
const markerPath = path3.join(swarmDir, ".plan-write-marker");
|
|
2882
2741
|
const inProgressMarker = JSON.stringify({
|
|
2883
2742
|
source: "plan_manager",
|
|
2884
2743
|
timestamp: new Date().toISOString(),
|
|
@@ -2893,13 +2752,13 @@ async function rebuildPlan(directory, plan, options) {
|
|
|
2893
2752
|
const markdown = derivePlanMarkdown(targetPlan);
|
|
2894
2753
|
const markdownWithHash = `<!-- PLAN_HASH: ${contentHash} -->
|
|
2895
2754
|
${markdown}`;
|
|
2896
|
-
const tempMdPath =
|
|
2755
|
+
const tempMdPath = path3.join(swarmDir, `plan.md.rebuild.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
|
|
2897
2756
|
await bunWrite(tempMdPath, markdownWithHash);
|
|
2898
2757
|
renameSync2(tempMdPath, mdPath);
|
|
2899
2758
|
invalidateCachedArtifact(mdPath);
|
|
2900
2759
|
} finally {
|
|
2901
2760
|
try {
|
|
2902
|
-
const markerPath =
|
|
2761
|
+
const markerPath = path3.join(swarmDir, ".plan-write-marker");
|
|
2903
2762
|
const tasksCount = targetPlan.phases.reduce((sum, phase) => sum + phase.tasks.length, 0);
|
|
2904
2763
|
const marker = JSON.stringify({
|
|
2905
2764
|
source: "plan_manager",
|
|
@@ -2931,6 +2790,7 @@ async function closePlanTerminalState(directory, plan, options) {
|
|
|
2931
2790
|
assertProjectRoot(directory);
|
|
2932
2791
|
const planId = derivePlanId(plan);
|
|
2933
2792
|
const validated = PlanSchema.parse(plan);
|
|
2793
|
+
normalizeCurrentPhaseInPlace(validated);
|
|
2934
2794
|
const hashAfter = computePlanLedgerHash(validated);
|
|
2935
2795
|
for (const taskId of options.closedTaskIds) {
|
|
2936
2796
|
let taskPhaseId;
|
|
@@ -2963,14 +2823,14 @@ async function closePlanTerminalState(directory, plan, options) {
|
|
|
2963
2823
|
planHashAfter: hashAfter,
|
|
2964
2824
|
source: "close_terminal"
|
|
2965
2825
|
});
|
|
2966
|
-
const swarmDir =
|
|
2967
|
-
const planPath =
|
|
2968
|
-
const tempPlanPath =
|
|
2826
|
+
const swarmDir = path3.join(directory, ".swarm");
|
|
2827
|
+
const planPath = path3.join(swarmDir, "plan.json");
|
|
2828
|
+
const tempPlanPath = path3.join(swarmDir, `plan.json.close.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
|
|
2969
2829
|
await bunWrite(tempPlanPath, JSON.stringify(validated, null, 2));
|
|
2970
2830
|
renameSync2(tempPlanPath, planPath);
|
|
2971
2831
|
invalidateCachedArtifact(planPath);
|
|
2972
2832
|
try {
|
|
2973
|
-
const markerPath =
|
|
2833
|
+
const markerPath = path3.join(swarmDir, ".plan-write-marker");
|
|
2974
2834
|
const inProgressMarker = JSON.stringify({
|
|
2975
2835
|
source: "plan_manager_close",
|
|
2976
2836
|
timestamp: new Date().toISOString(),
|
|
@@ -2981,18 +2841,18 @@ async function closePlanTerminalState(directory, plan, options) {
|
|
|
2981
2841
|
await bunWrite(markerPath, inProgressMarker);
|
|
2982
2842
|
} catch {}
|
|
2983
2843
|
try {
|
|
2984
|
-
const mdPath =
|
|
2844
|
+
const mdPath = path3.join(swarmDir, "plan.md");
|
|
2985
2845
|
const contentHash = computePlanContentHash(validated);
|
|
2986
2846
|
const markdown = derivePlanMarkdown(validated);
|
|
2987
2847
|
const markdownWithHash = `<!-- PLAN_HASH: ${contentHash} -->
|
|
2988
2848
|
${markdown}`;
|
|
2989
|
-
const mdTempPath =
|
|
2849
|
+
const mdTempPath = path3.join(swarmDir, `plan.md.close.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
|
|
2990
2850
|
await bunWrite(mdTempPath, markdownWithHash);
|
|
2991
2851
|
renameSync2(mdTempPath, mdPath);
|
|
2992
2852
|
invalidateCachedArtifact(mdPath);
|
|
2993
2853
|
} finally {
|
|
2994
2854
|
try {
|
|
2995
|
-
const markerPath =
|
|
2855
|
+
const markerPath = path3.join(swarmDir, ".plan-write-marker");
|
|
2996
2856
|
const tasksCount = validated.phases.reduce((sum, phase) => sum + phase.tasks.length, 0);
|
|
2997
2857
|
const marker = JSON.stringify({
|
|
2998
2858
|
source: "plan_manager_close",
|
|
@@ -3090,7 +2950,12 @@ async function updateTaskStatus(directory, taskId, status, options) {
|
|
|
3090
2950
|
break;
|
|
3091
2951
|
}
|
|
3092
2952
|
}
|
|
3093
|
-
const
|
|
2953
|
+
const { readDeclaredScopeFilesFromBindings } = await import("./scope-persistence-8z1hwdr2.js");
|
|
2954
|
+
const canonicalScope = readDeclaredScopeFilesFromBindings({
|
|
2955
|
+
directory,
|
|
2956
|
+
taskId,
|
|
2957
|
+
plan: updatedPlan
|
|
2958
|
+
});
|
|
3094
2959
|
await _internals5.commitTaskCompletion(directory, taskId, taskDescription, canonicalScope ?? undefined);
|
|
3095
2960
|
} catch (commitErr) {
|
|
3096
2961
|
criticalWarn(`[plan/manager] Rule 2 auto-commit for ${taskId} threw (non-fatal): ${commitErr instanceof Error ? commitErr.message : String(commitErr)}`);
|
|
@@ -3116,8 +2981,9 @@ function derivePlanMarkdown(plan) {
|
|
|
3116
2981
|
closed: "CLOSED"
|
|
3117
2982
|
};
|
|
3118
2983
|
const now = new Date().toISOString();
|
|
3119
|
-
const currentPhase = plan
|
|
3120
|
-
const
|
|
2984
|
+
const currentPhase = resolveActivePhaseId(plan);
|
|
2985
|
+
const currentPhaseObject = plan.phases.find((phase) => phase.id === currentPhase);
|
|
2986
|
+
const phaseStatus = statusMap[currentPhaseObject?.status ?? "pending"] || "PENDING";
|
|
3121
2987
|
let markdown = `# ${plan.title}
|
|
3122
2988
|
Swarm: ${plan.swarm}
|
|
3123
2989
|
Phase: ${currentPhase} [${phaseStatus}] | Updated: ${now}
|
|
@@ -3174,7 +3040,7 @@ Phase: ${currentPhase} [${phaseStatus}] | Updated: ${now}
|
|
|
3174
3040
|
const sortedFiles = [...task.files_touched].sort();
|
|
3175
3041
|
suffix += ` (files_touched: ${JSON.stringify(sortedFiles)})`;
|
|
3176
3042
|
}
|
|
3177
|
-
if (phase.id ===
|
|
3043
|
+
if (phase.id === currentPhase && task.status === "in_progress" && !currentTaskMarked) {
|
|
3178
3044
|
suffix += " \u2190 CURRENT";
|
|
3179
3045
|
currentTaskMarked = true;
|
|
3180
3046
|
}
|
|
@@ -3411,12 +3277,12 @@ import {
|
|
|
3411
3277
|
rmSync,
|
|
3412
3278
|
statSync as statSync2
|
|
3413
3279
|
} from "fs";
|
|
3414
|
-
import * as
|
|
3415
|
-
import * as
|
|
3280
|
+
import * as fs5 from "fs/promises";
|
|
3281
|
+
import * as path5 from "path";
|
|
3416
3282
|
|
|
3417
3283
|
// src/evaluation/retention.ts
|
|
3418
|
-
import * as
|
|
3419
|
-
import * as
|
|
3284
|
+
import * as fs3 from "fs/promises";
|
|
3285
|
+
import * as path4 from "path";
|
|
3420
3286
|
function artifactKey(artifact) {
|
|
3421
3287
|
return `${artifact.namespace}/${artifact.id}`;
|
|
3422
3288
|
}
|
|
@@ -3424,10 +3290,10 @@ function validId(value) {
|
|
|
3424
3290
|
return /^[A-Za-z0-9][A-Za-z0-9._-]{0,159}$/.test(value);
|
|
3425
3291
|
}
|
|
3426
3292
|
async function evaluationRunCandidates(directory) {
|
|
3427
|
-
const root =
|
|
3293
|
+
const root = path4.join(directory, ".swarm", "evolution", "runs");
|
|
3428
3294
|
let entries = [];
|
|
3429
3295
|
try {
|
|
3430
|
-
entries = await
|
|
3296
|
+
entries = await fs3.readdir(root, { withFileTypes: true });
|
|
3431
3297
|
} catch (error2) {
|
|
3432
3298
|
if (error2.code === "ENOENT") {
|
|
3433
3299
|
return { candidates: [], corrupt: [] };
|
|
@@ -3443,9 +3309,9 @@ async function evaluationRunCandidates(directory) {
|
|
|
3443
3309
|
if (!validId(id))
|
|
3444
3310
|
continue;
|
|
3445
3311
|
const artifact = { namespace: "evaluation-run", id };
|
|
3446
|
-
const target =
|
|
3312
|
+
const target = path4.join(root, entry.name);
|
|
3447
3313
|
try {
|
|
3448
|
-
const run = EvaluationRunV1Schema.parse(JSON.parse(await
|
|
3314
|
+
const run = EvaluationRunV1Schema.parse(JSON.parse(await fs3.readFile(target, "utf8")));
|
|
3449
3315
|
if (run.runId !== id)
|
|
3450
3316
|
throw new Error("run id/path mismatch");
|
|
3451
3317
|
candidates.push({
|
|
@@ -3461,10 +3327,10 @@ async function evaluationRunCandidates(directory) {
|
|
|
3461
3327
|
return { candidates, corrupt };
|
|
3462
3328
|
}
|
|
3463
3329
|
async function gateAuditCandidates(directory) {
|
|
3464
|
-
const root =
|
|
3330
|
+
const root = path4.join(directory, ".swarm", "evidence", "gate-audit");
|
|
3465
3331
|
let entries = [];
|
|
3466
3332
|
try {
|
|
3467
|
-
entries = await
|
|
3333
|
+
entries = await fs3.readdir(root, { withFileTypes: true });
|
|
3468
3334
|
} catch (error2) {
|
|
3469
3335
|
if (error2.code === "ENOENT") {
|
|
3470
3336
|
return { candidates: [], corrupt: [] };
|
|
@@ -3477,9 +3343,9 @@ async function gateAuditCandidates(directory) {
|
|
|
3477
3343
|
if (!entry.isDirectory() || !validId(entry.name))
|
|
3478
3344
|
continue;
|
|
3479
3345
|
const artifact = { namespace: "gate-audit", id: entry.name };
|
|
3480
|
-
const target =
|
|
3346
|
+
const target = path4.join(root, entry.name);
|
|
3481
3347
|
try {
|
|
3482
|
-
const result = GateAuditResultV1Schema.parse(JSON.parse(await
|
|
3348
|
+
const result = GateAuditResultV1Schema.parse(JSON.parse(await fs3.readFile(path4.join(target, "results.json"), "utf8")));
|
|
3483
3349
|
if (result.runId !== entry.name)
|
|
3484
3350
|
throw new Error("run id/path mismatch");
|
|
3485
3351
|
candidates.push({
|
|
@@ -3510,10 +3376,10 @@ async function protectedArtifacts(directory) {
|
|
|
3510
3376
|
}
|
|
3511
3377
|
async function removeCandidate(candidate) {
|
|
3512
3378
|
if (candidate.kind === "directory") {
|
|
3513
|
-
await
|
|
3379
|
+
await fs3.rm(candidate.target, { recursive: true, force: true });
|
|
3514
3380
|
return;
|
|
3515
3381
|
}
|
|
3516
|
-
await
|
|
3382
|
+
await fs3.unlink(candidate.target);
|
|
3517
3383
|
}
|
|
3518
3384
|
var _retentionInternals = {
|
|
3519
3385
|
protectedArtifacts,
|
|
@@ -3521,7 +3387,7 @@ var _retentionInternals = {
|
|
|
3521
3387
|
};
|
|
3522
3388
|
async function archiveEvaluationArtifacts(args) {
|
|
3523
3389
|
assertProjectRoot(args.directory);
|
|
3524
|
-
return withEvidenceLock(args.directory,
|
|
3390
|
+
return withEvidenceLock(args.directory, path4.join("evolution", "retention-index"), "evaluation-retention", "archive", async () => {
|
|
3525
3391
|
const inventory = await retentionCandidates(args.directory);
|
|
3526
3392
|
let protectedKeys = await _retentionInternals.protectedArtifacts(args.directory);
|
|
3527
3393
|
const protectedRefs = inventory.candidates.filter((candidate) => protectedKeys.has(artifactKey(candidate.artifact))).map((candidate) => candidate.artifact);
|
|
@@ -3570,7 +3436,7 @@ async function archiveEvaluationArtifacts(args) {
|
|
|
3570
3436
|
}
|
|
3571
3437
|
|
|
3572
3438
|
// src/evidence/documents-retention.ts
|
|
3573
|
-
import * as
|
|
3439
|
+
import * as fs4 from "fs";
|
|
3574
3440
|
import * as fsp from "fs/promises";
|
|
3575
3441
|
import * as readline from "readline";
|
|
3576
3442
|
var EVIDENCE_CACHE_FILE = "evidence-cache/documents.jsonl";
|
|
@@ -3580,11 +3446,11 @@ var RENAME_BACKOFF_MS = 10;
|
|
|
3580
3446
|
var RENAME_RETRY_CODES = new Set(["EPERM", "EBUSY", "ENOTEMPTY", "EACCES"]);
|
|
3581
3447
|
var _internals6 = {
|
|
3582
3448
|
stat: (p) => fsp.stat(p),
|
|
3583
|
-
createReadStream: (p, options) =>
|
|
3584
|
-
openSync: (p, flags) =>
|
|
3585
|
-
writeSync: (fd, data, position) =>
|
|
3586
|
-
fsyncSync: (fd) =>
|
|
3587
|
-
closeSync: (fd) =>
|
|
3449
|
+
createReadStream: (p, options) => fs4.createReadStream(p, options),
|
|
3450
|
+
openSync: (p, flags) => fs4.openSync(p, flags),
|
|
3451
|
+
writeSync: (fd, data, position) => fs4.writeSync(fd, data, position),
|
|
3452
|
+
fsyncSync: (fd) => fs4.fsyncSync(fd),
|
|
3453
|
+
closeSync: (fd) => fs4.closeSync(fd),
|
|
3588
3454
|
renameWithRetry: atomicRenameWithRetry,
|
|
3589
3455
|
unlink: (p) => fsp.unlink(p)
|
|
3590
3456
|
};
|
|
@@ -3839,13 +3705,13 @@ async function saveEvidence(directory, taskId, evidence, abortSignal) {
|
|
|
3839
3705
|
abortSignal?.throwIfAborted();
|
|
3840
3706
|
_internals7.validateProjectRoot(directory);
|
|
3841
3707
|
const sanitizedTaskId = sanitizeTaskId2(taskId);
|
|
3842
|
-
const relativePath =
|
|
3708
|
+
const relativePath = path5.join("evidence", sanitizedTaskId, "evidence.json");
|
|
3843
3709
|
validateSwarmPath(directory, relativePath);
|
|
3844
3710
|
_internals7.validateEvidence(evidence);
|
|
3845
3711
|
return withEvidenceLock(directory, relativePath, "evidence-manager", sanitizedTaskId, async () => {
|
|
3846
3712
|
abortSignal?.throwIfAborted();
|
|
3847
3713
|
const evidencePath = validateSwarmPath(directory, relativePath);
|
|
3848
|
-
const evidenceDir =
|
|
3714
|
+
const evidenceDir = path5.dirname(evidencePath);
|
|
3849
3715
|
let bundle;
|
|
3850
3716
|
const existingContent = await readSwarmFileAsync(directory, relativePath);
|
|
3851
3717
|
abortSignal?.throwIfAborted();
|
|
@@ -3889,7 +3755,7 @@ async function saveEvidence(directory, taskId, evidence, abortSignal) {
|
|
|
3889
3755
|
throw new Error(`Evidence bundle size (${bundleJson.length} bytes) exceeds maximum (${EVIDENCE_MAX_JSON_BYTES} bytes)`);
|
|
3890
3756
|
}
|
|
3891
3757
|
mkdirSync3(evidenceDir, { recursive: true });
|
|
3892
|
-
const tempPath =
|
|
3758
|
+
const tempPath = path5.join(evidenceDir, `evidence.json.tmp.${Date.now()}.${process.pid}`);
|
|
3893
3759
|
try {
|
|
3894
3760
|
await bunWrite(tempPath, bundleJson);
|
|
3895
3761
|
abortSignal?.throwIfAborted();
|
|
@@ -3935,7 +3801,7 @@ function wrapFlatRetrospective(flatEntry, taskId) {
|
|
|
3935
3801
|
}
|
|
3936
3802
|
async function loadEvidence(directory, taskId, options) {
|
|
3937
3803
|
const sanitizedTaskId = sanitizeTaskId2(taskId);
|
|
3938
|
-
const relativePath =
|
|
3804
|
+
const relativePath = path5.join("evidence", sanitizedTaskId, "evidence.json");
|
|
3939
3805
|
if (relativePath.length > 4096) {
|
|
3940
3806
|
return { status: "not_found" };
|
|
3941
3807
|
}
|
|
@@ -3960,12 +3826,12 @@ async function loadEvidence(directory, taskId, options) {
|
|
|
3960
3826
|
try {
|
|
3961
3827
|
validateProjectRoot(directory);
|
|
3962
3828
|
await withEvidenceLock(directory, relativePath, "evidence-loader", sanitizedTaskId, async () => {
|
|
3963
|
-
const evidenceDir =
|
|
3829
|
+
const evidenceDir = path5.dirname(evidencePath);
|
|
3964
3830
|
const bundleJson = JSON.stringify(validated);
|
|
3965
|
-
const tempPath =
|
|
3831
|
+
const tempPath = path5.join(evidenceDir, `evidence.json.tmp.${Date.now()}.${process.pid}`);
|
|
3966
3832
|
try {
|
|
3967
3833
|
await bunWrite(tempPath, bundleJson);
|
|
3968
|
-
await
|
|
3834
|
+
await fs5.rename(tempPath, evidencePath);
|
|
3969
3835
|
invalidateCachedArtifact(evidencePath);
|
|
3970
3836
|
} catch (writeError) {
|
|
3971
3837
|
try {
|
|
@@ -4008,7 +3874,7 @@ async function listEvidenceTaskIds(directory) {
|
|
|
4008
3874
|
}
|
|
4009
3875
|
const taskIds = [];
|
|
4010
3876
|
for (const entry of entries) {
|
|
4011
|
-
const entryPath =
|
|
3877
|
+
const entryPath = path5.join(evidenceBasePath, entry);
|
|
4012
3878
|
try {
|
|
4013
3879
|
const stats = statSync2(entryPath);
|
|
4014
3880
|
if (!stats.isDirectory()) {
|
|
@@ -4031,7 +3897,7 @@ async function deleteEvidence(directory, taskId) {
|
|
|
4031
3897
|
} catch {
|
|
4032
3898
|
return false;
|
|
4033
3899
|
}
|
|
4034
|
-
const relativePath =
|
|
3900
|
+
const relativePath = path5.join("evidence", sanitizedTaskId);
|
|
4035
3901
|
const evidenceDir = validateSwarmPath(directory, relativePath);
|
|
4036
3902
|
try {
|
|
4037
3903
|
statSync2(evidenceDir);
|
|
@@ -4047,10 +3913,10 @@ async function deleteEvidence(directory, taskId) {
|
|
|
4047
3913
|
}
|
|
4048
3914
|
}
|
|
4049
3915
|
async function checkRequirementCoverage(phase, directory) {
|
|
4050
|
-
const relativePath =
|
|
4051
|
-
const absolutePath =
|
|
3916
|
+
const relativePath = path5.join("evidence", `req-coverage-phase-${phase}.json`);
|
|
3917
|
+
const absolutePath = path5.resolve(directory, ".swarm", relativePath);
|
|
4052
3918
|
try {
|
|
4053
|
-
await
|
|
3919
|
+
await fs5.access(absolutePath);
|
|
4054
3920
|
return { exists: true, path: absolutePath };
|
|
4055
3921
|
} catch {
|
|
4056
3922
|
return { exists: false, path: absolutePath };
|
|
@@ -4276,4 +4142,4 @@ function mergeDurableGateEntriesFromEvidence(taskId, entries, evidence) {
|
|
|
4276
4142
|
return merged;
|
|
4277
4143
|
}
|
|
4278
4144
|
|
|
4279
|
-
export {
|
|
4145
|
+
export { buildTaskCompletionDescriptor, ensureTaskCheckpointReceipt, updateTaskCheckpointReceipt, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, readLaneEnvFileFromDiskSync, getGitRepositoryStatus, isGitRepo, getDefaultBaseBranch, detectDefaultRemoteBranch, resetToRemoteBranch, resetToMainAfterMerge, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, loadPlanJsonOnly, loadPlan, withPlanLifecycleLock, savePlan, closePlanTerminalState, updateTaskStatus, derivePlanMarkdown, isValidEvidenceType, isSecretscanEvidence, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, _internals7 as _internals, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
|