opencode-swarm 7.140.3 → 7.140.5
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/.opencode/skills/brainstorm/SKILL.md +1 -1
- package/.opencode/skills/ci-failure-batching/SKILL.md +11 -1
- package/.opencode/skills/ci-fix-monitor/SKILL.md +6 -4
- package/.opencode/skills/discover/SKILL.md +1 -1
- package/.opencode/skills/durable-session-state/SKILL.md +82 -0
- package/.opencode/skills/engineering-conventions/SKILL.md +1 -1
- package/.opencode/skills/issue-ingest/SKILL.md +13 -7
- package/.opencode/skills/issue-tracer/SKILL.md +1 -1
- package/.opencode/skills/orchestrating-subagents/SKILL.md +113 -0
- package/.opencode/skills/parallel-work-check/SKILL.md +1 -1
- package/.opencode/skills/plan/SKILL.md +40 -12
- package/.opencode/skills/swarm-ci-monitor/SKILL.md +5 -3
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +30 -4
- package/.opencode/skills/writing-tests/SKILL.md +1 -1
- package/dist/agents/architect.d.ts +2 -1
- package/dist/agents/reviewer-directive-compliance.d.ts +19 -5
- package/dist/background/pending-delegations.d.ts +5 -0
- package/dist/cli/{config-doctor-fnmfd35x.js → config-doctor-5vzpq4qa.js} +3 -3
- package/dist/cli/{core-p5cyej3r.js → core-xjzdc56e.js} +2 -2
- package/dist/cli/{curation-policy-d52h4g8t.js → curation-policy-avvb56x2.js} +6 -8
- package/dist/cli/{curator-3zpdqt9r.js → curator-5nytvg7p.js} +38 -38
- package/dist/cli/curator-llm-factory-rds75zhj.js +61 -0
- package/dist/cli/{evidence-summary-service-nfdc1ht9.js → evidence-summary-service-zq4gyx6g.js} +15 -12
- package/dist/cli/gate-evidence-smn2wqft.js +51 -0
- package/dist/cli/guardrail-explain-an7jvam1.js +62 -0
- package/dist/cli/{guardrail-log-82da8y5a.js → guardrail-log-0hnd2k9v.js} +4 -4
- package/dist/cli/{hive-promoter-af5yaxvt.js → hive-promoter-qe8pqg79.js} +38 -38
- package/dist/cli/{index-qksjaxpd.js → index-01ggt2mj.js} +49 -18
- package/dist/cli/{index-j1xmren9.js → index-0r2m0vbq.js} +12 -10
- package/dist/cli/{index-pg7n141e.js → index-0rx9t9w8.js} +1 -1
- package/dist/cli/{index-brh827g0.js → index-2bg901qt.js} +73 -32
- package/dist/cli/{index-8n4c3vec.js → index-386ts4tm.js} +4 -4
- package/dist/cli/{index-898f16j9.js → index-8rp1y4ab.js} +2 -2
- package/dist/cli/{index-hfvxhk4z.js → index-912qz4y0.js} +88 -88
- package/dist/cli/index-affh1gtg.js +2554 -0
- package/dist/cli/{index-1m1ksyqt.js → index-c432knmy.js} +1 -1
- package/dist/cli/{index-jvk119ck.js → index-e0mpz2j3.js} +54 -19
- package/dist/cli/{index-ry0hgg3m.js → index-epvhf50h.js} +37 -3
- package/dist/cli/{index-95bj4kaw.js → index-ex7r16gc.js} +2 -2
- package/dist/cli/{index-7d5jseea.js → index-jm4cpp4n.js} +5 -2
- package/dist/cli/{index-n408rw7n.js → index-jqsfsqbx.js} +27 -2
- package/dist/cli/{index-7kdd75se.js → index-kb5q9v34.js} +11 -9
- package/dist/cli/{index-jfjnn408.js → index-m9xrdjn0.js} +1 -1
- package/dist/cli/{index-pj9h75cc.js → index-mm2egvdt.js} +40 -40
- package/dist/cli/{index-8bnzzv3b.js → index-nwrwy8eb.js} +70 -34
- package/dist/cli/index-nyjtzmsj.js +43 -0
- package/dist/cli/{index-h2waehqq.js → index-p8kk34am.js} +3 -3
- package/dist/cli/{index-wf35ka4z.js → index-ptn13xjn.js} +3 -3
- package/dist/cli/{index-1kyex7z2.js → index-qwm6vdyv.js} +32 -1
- package/dist/cli/{index-p9dsb0tw.js → index-qy1nq52t.js} +2 -19
- package/dist/cli/{index-b9rd29ge.js → index-s1v0wza5.js} +6 -2
- package/dist/cli/{index-yyyk63kk.js → index-t5pytnca.js} +2 -2
- package/dist/cli/index-tjqzr3jc.js +623 -0
- package/dist/cli/{index-rs1f1bh0.js → index-vh05t3w5.js} +1 -1
- package/dist/cli/{index-adyxbmt5.js → index-wkt9fj06.js} +4 -4
- package/dist/cli/{index-kbfsp07d.js → index-wrb0gykj.js} +217 -15
- package/dist/cli/{index-xz8f1n1a.js → index-z7h37d63.js} +2 -2
- package/dist/cli/{index-q1q8b85k.js → index-z90nvqj3.js} +49315 -47331
- package/dist/cli/{index-b8zgtz81.js → index-zsrtt42s.js} +34 -1
- package/dist/cli/{index-gtbmabws.js → index-ztgn70jz.js} +2 -2
- package/dist/cli/index.js +37 -37
- package/dist/cli/{knowledge-escalator-7q59skqg.js → knowledge-escalator-4pfrc902.js} +20 -8
- package/dist/cli/{knowledge-events-3nwfdpq7.js → knowledge-events-3zkfnksk.js} +19 -6
- package/dist/cli/{knowledge-link-q46k9adx.js → knowledge-link-m9p80f4r.js} +5 -5
- package/dist/cli/{knowledge-store-0d83rhh3.js → knowledge-store-dpqgvvjt.js} +6 -6
- package/dist/cli/{knowledge-validator-6mfx91a2.js → knowledge-validator-2c7w87dk.js} +8 -9
- package/dist/cli/{pending-delegations-qzrx38y9.js → pending-delegations-cxx9tezp.js} +4 -4
- package/dist/cli/{pr-subscriptions-5s59h4dd.js → pr-subscriptions-2sfnb599.js} +4 -4
- package/dist/cli/{runner-y78d7ryb.js → runner-mky3vvht.js} +6 -6
- package/dist/cli/{scan-cursor-rc8q12ss.js → scan-cursor-1z60gwrw.js} +7 -7
- package/dist/cli/{schema-n9eaxp3a.js → schema-vpnkwvez.js} +2 -2
- package/dist/cli/{scope-persistence-dr1msqxw.js → scope-persistence-p9dmprry.js} +10 -5
- package/dist/cli/{skill-generator-q7c6vadg.js → skill-generator-yx7ka1cj.js} +19 -10
- package/dist/cli/{telemetry-sc57xtb0.js → telemetry-0x6kszvk.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-7a8e6gr9.js → worktree-collision-ownership-wm5pse49.js} +8 -8
- package/dist/cli/worktree-isolation-bwc6ra8e.js +102 -0
- package/dist/cli/worktree-provisioning-owner-sjh7te1h.js +22 -0
- package/dist/commands/acknowledge-spec-drift.d.ts +4 -5
- package/dist/commands/ci-simulate.d.ts +7 -3
- package/dist/commands/close.d.ts +8 -0
- package/dist/commands/registry.d.ts +2 -2
- package/dist/commands/sdd.d.ts +15 -0
- package/dist/config/bundled-skills.d.ts +1 -1
- package/dist/config/evidence-schema.d.ts +3 -3
- package/dist/config/index.d.ts +2 -2
- package/dist/config/plan-schema.d.ts +8 -0
- package/dist/config/schema.d.ts +4 -2
- package/dist/council/council-evidence-writer.d.ts +1 -1
- package/dist/gate-evidence.d.ts +117 -4
- package/dist/git/branch.d.ts +1 -1
- package/dist/hooks/delegate-ack-collector.d.ts +5 -0
- package/dist/hooks/delegation-gate.d.ts +21 -0
- package/dist/hooks/hive-promoter.d.ts +4 -4
- package/dist/hooks/issue-trace-reducer.d.ts +7 -1
- package/dist/hooks/issue-trace-state.d.ts +18 -0
- package/dist/hooks/issue-trace.d.ts +3 -1
- package/dist/hooks/knowledge-application-gate.d.ts +8 -3
- package/dist/hooks/knowledge-application.d.ts +8 -5
- package/dist/hooks/knowledge-escalator.d.ts +9 -5
- package/dist/hooks/knowledge-events.d.ts +21 -8
- package/dist/hooks/knowledge-injector.d.ts +9 -0
- package/dist/hooks/knowledge-receipt-ledger-storage.d.ts +49 -0
- package/dist/hooks/knowledge-receipt-ledger.d.ts +305 -0
- package/dist/hooks/knowledge-receipt-observability.d.ts +28 -0
- package/dist/hooks/knowledge-receipt-validator.d.ts +13 -50
- package/dist/hooks/knowledge-store.d.ts +6 -1
- package/dist/hooks/knowledge-types.d.ts +12 -0
- package/dist/hooks/phase-complete-directive-gate.d.ts +3 -1
- package/dist/hooks/phase-directives.d.ts +4 -4
- package/dist/hooks/pr-workflow-gate.d.ts +34 -1
- package/dist/hooks/promotion-evidence-store.d.ts +14 -8
- package/dist/hooks/reviewer-verdict-parser.d.ts +34 -10
- package/dist/index.js +823 -779
- package/dist/knowledge/curation-policy.d.ts +0 -2
- package/dist/observability/catalog.d.ts +5 -3
- package/dist/observability/legacy.d.ts +4 -3
- package/dist/plan/ledger.d.ts +55 -0
- package/dist/plan/manager.d.ts +9 -0
- package/dist/plan/planning-profile.d.ts +27 -0
- package/dist/services/spec-drift-recovery.d.ts +84 -0
- package/dist/session/snapshot-writer.d.ts +3 -1
- package/dist/state.d.ts +19 -17
- package/dist/summaries/schema.d.ts +2 -2
- package/dist/telemetry.d.ts +1 -1
- package/dist/tools/convene-council.d.ts +6 -6
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/manifest.d.ts +3 -0
- package/dist/tools/phase-complete.d.ts +9 -0
- package/dist/tools/rebind-pr-feedback-head.d.ts +17 -0
- package/dist/tools/record-implementation-review.d.ts +19 -0
- package/dist/tools/record-recurrence-sweep.d.ts +17 -0
- package/dist/tools/run-pr-feedback-stage-a.d.ts +8 -0
- package/dist/tools/save-plan.d.ts +8 -0
- package/dist/tools/submit-phase-council-verdicts.d.ts +6 -6
- package/dist/tools/tool-metadata.d.ts +40 -28
- package/dist/tools/update-task-status.d.ts +13 -0
- package/dist/tools/write-final-council-evidence.d.ts +6 -6
- package/dist/types/events.d.ts +29 -1
- package/dist/workflow/coder-settlement.d.ts +62 -0
- package/dist/workflow/task-repair.d.ts +30 -0
- package/dist/workflow/task-terminal.d.ts +52 -0
- package/package.json +3 -1
- package/dist/cli/curator-llm-factory-2h0xb62t.js +0 -61
- package/dist/cli/gate-evidence-46qeyfc1.js +0 -32
- package/dist/cli/guardrail-explain-yktan15c.js +0 -62
- package/dist/cli/index-d181x9zr.js +0 -71
- package/dist/cli/index-n0pja0qs.js +0 -239
- package/dist/cli/index-n8jncheh.js +0 -666
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
} from "./index-ae75rja9.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveKnowledgeStoreDir
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-vh05t3w5.js";
|
|
10
10
|
import {
|
|
11
11
|
atomicWriteFile
|
|
12
|
-
} from "./index-
|
|
13
|
-
import {
|
|
14
|
-
readCachedParsedFile
|
|
15
|
-
} from "./index-ed5ykebp.js";
|
|
12
|
+
} from "./index-p8kk34am.js";
|
|
16
13
|
import {
|
|
17
14
|
require_proper_lockfile
|
|
18
15
|
} from "./index-7g4c7s5r.js";
|
|
16
|
+
import {
|
|
17
|
+
readCachedParsedFile
|
|
18
|
+
} from "./index-ed5ykebp.js";
|
|
19
19
|
import {
|
|
20
20
|
init_logger,
|
|
21
21
|
log
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
// src/hooks/knowledge-store.ts
|
|
33
33
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
34
34
|
import { createHash } from "crypto";
|
|
35
|
-
import { existsSync } from "fs";
|
|
35
|
+
import { existsSync, realpathSync } from "fs";
|
|
36
36
|
import { appendFile, mkdir, readFile } from "fs/promises";
|
|
37
37
|
import * as os from "os";
|
|
38
38
|
import * as path from "path";
|
|
@@ -672,23 +672,27 @@ var CONFIDENCE_FLOOR = 0.1;
|
|
|
672
672
|
var CONFIDENCE_CEILING = 1;
|
|
673
673
|
async function bumpKnowledgeConfidenceBatch(directory, deltas, options) {
|
|
674
674
|
if (deltas.length === 0)
|
|
675
|
-
return;
|
|
675
|
+
return 0;
|
|
676
676
|
const swarmPath = resolveSwarmKnowledgePath(directory);
|
|
677
677
|
const hivePath = resolveHiveKnowledgePath2();
|
|
678
678
|
const touchedSwarm = [];
|
|
679
679
|
const touchedHive = [];
|
|
680
680
|
try {
|
|
681
|
-
|
|
681
|
+
const canonicalDirectory = realpathSync.native(directory);
|
|
682
|
+
const feedbackScope = createHash("sha256").update(process.platform === "win32" ? canonicalDirectory.toLowerCase() : canonicalDirectory).digest("hex").slice(0, 16);
|
|
683
|
+
touchedSwarm.push(...await applyConfidenceDeltas(swarmPath, deltas, feedbackScope));
|
|
682
684
|
const swarmIds = new Set(touchedSwarm.map((e) => e.id));
|
|
683
685
|
const hiveOnly = deltas.filter((d) => !swarmIds.has(d.id));
|
|
684
686
|
if (hiveOnly.length > 0) {
|
|
685
|
-
touchedHive.push(...await applyConfidenceDeltas(hivePath, hiveOnly));
|
|
687
|
+
touchedHive.push(...await applyConfidenceDeltas(hivePath, hiveOnly, feedbackScope));
|
|
686
688
|
}
|
|
687
689
|
await applyConfidenceFloorAction(directory, [...touchedSwarm, ...touchedHive], options).catch((err) => {
|
|
688
690
|
log("[knowledge-store] confidence-floor action sweep failed (best-effort):", err instanceof Error ? err.message : String(err));
|
|
689
691
|
});
|
|
692
|
+
return touchedSwarm.length + touchedHive.length;
|
|
690
693
|
} catch (err) {
|
|
691
694
|
log("[knowledge-store] bumpKnowledgeConfidenceBatch failed (fail-open):", err instanceof Error ? err.message : String(err));
|
|
695
|
+
return 0;
|
|
692
696
|
}
|
|
693
697
|
}
|
|
694
698
|
async function applyConfidenceFloorAction(directory, touched, options) {
|
|
@@ -702,8 +706,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
702
706
|
const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
|
|
703
707
|
if (atFloor.length === 0 && recovered.length === 0)
|
|
704
708
|
return;
|
|
705
|
-
const {
|
|
706
|
-
|
|
709
|
+
const {
|
|
710
|
+
readAuthoritativeKnowledgeCounterRollups,
|
|
711
|
+
effectiveRetrievalOutcomes
|
|
712
|
+
} = await import("./knowledge-events-3zkfnksk.js");
|
|
713
|
+
const rollups = await readAuthoritativeKnowledgeCounterRollups(directory);
|
|
707
714
|
const flagIds = new Set;
|
|
708
715
|
for (const e of atFloor) {
|
|
709
716
|
const outcomes = effectiveRetrievalOutcomes(e.retrieval_outcomes, rollups?.get(e.id));
|
|
@@ -769,11 +776,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
769
776
|
});
|
|
770
777
|
}
|
|
771
778
|
if (action === "quarantine" && toQuarantine.length > 0) {
|
|
772
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
773
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
779
|
+
const { quarantineEntry } = await import("./knowledge-validator-2c7w87dk.js");
|
|
780
|
+
const { KnowledgeConfigSchema } = await import("./schema-vpnkwvez.js");
|
|
774
781
|
let config;
|
|
775
782
|
try {
|
|
776
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
783
|
+
const { loadPluginConfigWithMeta } = await import("./index-0r2m0vbq.js");
|
|
777
784
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
778
785
|
config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
779
786
|
} catch {
|
|
@@ -795,11 +802,17 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
795
802
|
}
|
|
796
803
|
}
|
|
797
804
|
}
|
|
798
|
-
async function applyConfidenceDeltas(filePath, deltas) {
|
|
805
|
+
async function applyConfidenceDeltas(filePath, deltas, feedbackScope) {
|
|
799
806
|
const idDeltaMap = new Map;
|
|
800
807
|
for (const d of deltas) {
|
|
801
808
|
const existing = idDeltaMap.get(d.id);
|
|
802
|
-
idDeltaMap.set(d.id,
|
|
809
|
+
idDeltaMap.set(d.id, {
|
|
810
|
+
delta: (existing?.delta ?? 0) + d.delta,
|
|
811
|
+
receipt_events: [
|
|
812
|
+
...existing?.receipt_events ?? [],
|
|
813
|
+
...d.receipt_events ?? []
|
|
814
|
+
]
|
|
815
|
+
});
|
|
803
816
|
}
|
|
804
817
|
const touched = [];
|
|
805
818
|
let release = null;
|
|
@@ -816,9 +829,27 @@ async function applyConfidenceDeltas(filePath, deltas) {
|
|
|
816
829
|
const now = new Date().toISOString();
|
|
817
830
|
let mutated = false;
|
|
818
831
|
for (const entry of entries) {
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
832
|
+
const pending = idDeltaMap.get(entry.id);
|
|
833
|
+
if (!pending)
|
|
821
834
|
continue;
|
|
835
|
+
let delta = pending.delta;
|
|
836
|
+
if (pending.receipt_events.length > 0) {
|
|
837
|
+
const cursor = entry.receipt_feedback_cursors?.[feedbackScope];
|
|
838
|
+
const afterCursor = pending.receipt_events.filter((event) => !cursor || event.timestamp > cursor.timestamp || event.timestamp === cursor.timestamp && event.event_id > cursor.event_id).sort((a, b) => a.timestamp === b.timestamp ? a.event_id.localeCompare(b.event_id) : a.timestamp.localeCompare(b.timestamp));
|
|
839
|
+
if (afterCursor.length === 0)
|
|
840
|
+
continue;
|
|
841
|
+
const positives = afterCursor.filter((event) => event.outcome === "applied").length;
|
|
842
|
+
const negatives = afterCursor.length - positives;
|
|
843
|
+
delta = positives > negatives ? 0.03 : -0.05;
|
|
844
|
+
const last = afterCursor[afterCursor.length - 1];
|
|
845
|
+
entry.receipt_feedback_cursors = {
|
|
846
|
+
...entry.receipt_feedback_cursors ?? {},
|
|
847
|
+
[feedbackScope]: {
|
|
848
|
+
timestamp: last.timestamp,
|
|
849
|
+
event_id: last.event_id
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
}
|
|
822
853
|
entry.confidence = Math.max(CONFIDENCE_FLOOR, Math.min(CONFIDENCE_CEILING, entry.confidence + delta));
|
|
823
854
|
entry.updated_at = now;
|
|
824
855
|
mutated = true;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
_internals,
|
|
4
|
-
getSafeDefaultConfigLoadResult,
|
|
5
|
-
loadAgentPrompt,
|
|
6
|
-
loadPluginConfig,
|
|
7
|
-
loadPluginConfigWithMeta,
|
|
8
|
-
loadPluginConfigWithMetaAsync,
|
|
9
4
|
resolveWorktreeIsolationConfig
|
|
10
|
-
} from "./index-
|
|
5
|
+
} from "./index-nyjtzmsj.js";
|
|
11
6
|
import {
|
|
12
7
|
ApprovalEvidenceSchema,
|
|
13
8
|
BaseEvidenceSchema,
|
|
@@ -34,14 +29,20 @@ import {
|
|
|
34
29
|
validateSpecContent
|
|
35
30
|
} from "./index-n832052r.js";
|
|
36
31
|
import {
|
|
32
|
+
ExecutionProfileSchema,
|
|
37
33
|
MigrationStatusSchema,
|
|
38
34
|
PhaseSchema,
|
|
39
35
|
PhaseStatusSchema,
|
|
40
36
|
PlanSchema,
|
|
41
37
|
TaskSchema,
|
|
42
38
|
TaskSizeSchema,
|
|
43
|
-
TaskStatusSchema
|
|
44
|
-
|
|
39
|
+
TaskStatusSchema,
|
|
40
|
+
getSafeDefaultConfigLoadResult,
|
|
41
|
+
loadAgentPrompt,
|
|
42
|
+
loadPluginConfig,
|
|
43
|
+
loadPluginConfigWithMeta,
|
|
44
|
+
loadPluginConfigWithMetaAsync
|
|
45
|
+
} from "./index-nwrwy8eb.js";
|
|
45
46
|
import"./index-4rhhvd1a.js";
|
|
46
47
|
import"./index-zgwm4ryv.js";
|
|
47
48
|
import {
|
|
@@ -65,7 +66,7 @@ import {
|
|
|
65
66
|
TurboConfigSchema,
|
|
66
67
|
WorktreeIsolationConfigSchema,
|
|
67
68
|
resolveAutoReviewConfig
|
|
68
|
-
} from "./index-
|
|
69
|
+
} from "./index-jm4cpp4n.js";
|
|
69
70
|
import {
|
|
70
71
|
ALL_AGENT_NAMES,
|
|
71
72
|
ALL_SUBAGENT_NAMES,
|
|
@@ -75,7 +76,7 @@ import {
|
|
|
75
76
|
QA_AGENTS,
|
|
76
77
|
isQAAgent,
|
|
77
78
|
isSubagent
|
|
78
|
-
} from "./index-
|
|
79
|
+
} from "./index-jqsfsqbx.js";
|
|
79
80
|
import"./index-zjygnfay.js";
|
|
80
81
|
import"./index-bk5tah7q.js";
|
|
81
82
|
import"./index-bpmtbmy9.js";
|
|
@@ -123,6 +124,7 @@ export {
|
|
|
123
124
|
MigrationStatusSchema,
|
|
124
125
|
MemoryConfigSchema,
|
|
125
126
|
LeanTurboConfigSchema,
|
|
127
|
+
ExecutionProfileSchema,
|
|
126
128
|
EvidenceVerdictSchema,
|
|
127
129
|
EvidenceTypeSchema,
|
|
128
130
|
EvidenceSchema,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
loadDatabaseCtor
|
|
4
|
+
} from "./index-134d35c1.js";
|
|
2
5
|
import {
|
|
3
6
|
EvaluationRunV1Schema,
|
|
4
7
|
GateAuditResultV1Schema,
|
|
5
8
|
getProtectedEvaluationRunIds
|
|
6
|
-
} from "./index-
|
|
7
|
-
import {
|
|
8
|
-
loadDatabaseCtor
|
|
9
|
-
} from "./index-134d35c1.js";
|
|
9
|
+
} from "./index-t5pytnca.js";
|
|
10
10
|
import {
|
|
11
11
|
readEffectiveSpecSync
|
|
12
12
|
} from "./index-9ss2m4rs.js";
|
|
@@ -21,25 +21,24 @@ import {
|
|
|
21
21
|
initLedger,
|
|
22
22
|
ledgerExists,
|
|
23
23
|
loadLastApprovedPlan,
|
|
24
|
+
normalizeExecutionProfileForHash,
|
|
24
25
|
readLedgerEvents,
|
|
26
|
+
readLedgerEventsWithIntegrity,
|
|
27
|
+
replaceTruncatedLedgerWithRecoveryRoot,
|
|
25
28
|
replayFromLedger,
|
|
26
29
|
replayFromLedgerWithStatus,
|
|
27
30
|
takeSnapshotEvent,
|
|
28
31
|
takeSnapshotWithRetry
|
|
29
|
-
} from "./index-
|
|
32
|
+
} from "./index-wrb0gykj.js";
|
|
30
33
|
import {
|
|
31
34
|
getWorktreeMergeFailure
|
|
32
|
-
} from "./index-
|
|
33
|
-
import {
|
|
34
|
-
readSwarmFileAsync,
|
|
35
|
-
validateSwarmPath
|
|
36
|
-
} from "./index-k46me75h.js";
|
|
35
|
+
} from "./index-zsrtt42s.js";
|
|
37
36
|
import {
|
|
38
37
|
isValidTaskId,
|
|
39
38
|
readTaskEvidence,
|
|
40
39
|
readTaskEvidenceRaw,
|
|
41
40
|
sanitizeTaskId
|
|
42
|
-
} from "./index-
|
|
41
|
+
} from "./index-tjqzr3jc.js";
|
|
43
42
|
import {
|
|
44
43
|
_internals,
|
|
45
44
|
buildDefaultPolicy,
|
|
@@ -48,14 +47,18 @@ import {
|
|
|
48
47
|
probe
|
|
49
48
|
} from "./index-q1exe2b3.js";
|
|
50
49
|
import {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} from "./index-
|
|
50
|
+
readSwarmFileAsync,
|
|
51
|
+
validateSwarmPath
|
|
52
|
+
} from "./index-k46me75h.js";
|
|
54
53
|
import {
|
|
55
54
|
assertProjectRoot,
|
|
56
55
|
tryAcquireLock,
|
|
57
56
|
withEvidenceLock
|
|
58
|
-
} from "./index-
|
|
57
|
+
} from "./index-912qz4y0.js";
|
|
58
|
+
import {
|
|
59
|
+
invalidateCachedArtifact,
|
|
60
|
+
readCachedParsedFile
|
|
61
|
+
} from "./index-ed5ykebp.js";
|
|
59
62
|
import {
|
|
60
63
|
bunHash,
|
|
61
64
|
bunWrite,
|
|
@@ -68,7 +71,7 @@ import {
|
|
|
68
71
|
} from "./index-gprxjmm7.js";
|
|
69
72
|
import {
|
|
70
73
|
PlanSchema
|
|
71
|
-
} from "./index-
|
|
74
|
+
} from "./index-nwrwy8eb.js";
|
|
72
75
|
import {
|
|
73
76
|
criticalWarn,
|
|
74
77
|
error,
|
|
@@ -77,7 +80,7 @@ import {
|
|
|
77
80
|
} from "./index-zgwm4ryv.js";
|
|
78
81
|
import {
|
|
79
82
|
emit
|
|
80
|
-
} from "./index-
|
|
83
|
+
} from "./index-epvhf50h.js";
|
|
81
84
|
import {
|
|
82
85
|
ZodError,
|
|
83
86
|
init_zod
|
|
@@ -993,8 +996,8 @@ import * as path8 from "path";
|
|
|
993
996
|
import { createHash } from "crypto";
|
|
994
997
|
|
|
995
998
|
// src/db/project-db.ts
|
|
996
|
-
import { existsSync, mkdirSync } from "fs";
|
|
997
|
-
import { join, resolve } from "path";
|
|
999
|
+
import { existsSync, mkdirSync as mkdirSync2 } from "fs";
|
|
1000
|
+
import { join as join3, resolve } from "path";
|
|
998
1001
|
var MIGRATIONS = [
|
|
999
1002
|
{
|
|
1000
1003
|
version: 1,
|
|
@@ -1148,7 +1151,7 @@ function runProjectMigrations(db) {
|
|
|
1148
1151
|
}
|
|
1149
1152
|
}
|
|
1150
1153
|
function projectDbPath(directory) {
|
|
1151
|
-
return
|
|
1154
|
+
return join3(resolve(directory), ".swarm", "swarm.db");
|
|
1152
1155
|
}
|
|
1153
1156
|
function projectDbExists(directory) {
|
|
1154
1157
|
return existsSync(projectDbPath(directory));
|
|
@@ -1158,10 +1161,10 @@ function getProjectDb(directory) {
|
|
|
1158
1161
|
const existing = _projectDbs.get(key);
|
|
1159
1162
|
if (existing)
|
|
1160
1163
|
return existing;
|
|
1161
|
-
const swarmDir =
|
|
1162
|
-
|
|
1164
|
+
const swarmDir = join3(key, ".swarm");
|
|
1165
|
+
mkdirSync2(swarmDir, { recursive: true });
|
|
1163
1166
|
const Db = loadDatabaseCtor();
|
|
1164
|
-
const db = new Db(
|
|
1167
|
+
const db = new Db(join3(swarmDir, "swarm.db"));
|
|
1165
1168
|
db.run("PRAGMA journal_mode = WAL;");
|
|
1166
1169
|
db.run("PRAGMA synchronous = NORMAL;");
|
|
1167
1170
|
db.run("PRAGMA busy_timeout = 5000;");
|
|
@@ -2957,14 +2960,7 @@ function computePlanContentHash(plan) {
|
|
|
2957
2960
|
swarm: plan.swarm,
|
|
2958
2961
|
current_phase: plan.current_phase,
|
|
2959
2962
|
migration_status: plan.migration_status,
|
|
2960
|
-
execution_profile: plan.execution_profile
|
|
2961
|
-
parallelization_enabled: plan.execution_profile.parallelization_enabled,
|
|
2962
|
-
max_concurrent_tasks: plan.execution_profile.max_concurrent_tasks,
|
|
2963
|
-
council_parallel: plan.execution_profile.council_parallel,
|
|
2964
|
-
locked: plan.execution_profile.locked,
|
|
2965
|
-
auto_proceed: plan.execution_profile.auto_proceed,
|
|
2966
|
-
commit_after_each_completed_task: plan.execution_profile.commit_after_each_completed_task === true ? true : undefined
|
|
2967
|
-
} : undefined,
|
|
2963
|
+
execution_profile: normalizeExecutionProfileForHash(plan.execution_profile),
|
|
2968
2964
|
phases: plan.phases.map((phase) => ({
|
|
2969
2965
|
id: phase.id,
|
|
2970
2966
|
name: phase.name,
|
|
@@ -3314,6 +3310,10 @@ async function savePlan(directory, plan, options) {
|
|
|
3314
3310
|
}
|
|
3315
3311
|
}
|
|
3316
3312
|
const validated = PlanSchema.parse(plan);
|
|
3313
|
+
const requestedForStaleProjectionReconcile = options?.staleProjectionReconcile !== undefined ? PlanSchema.parse(plan) : null;
|
|
3314
|
+
if (requestedForStaleProjectionReconcile) {
|
|
3315
|
+
derivePhaseStatusesInPlace(requestedForStaleProjectionReconcile);
|
|
3316
|
+
}
|
|
3317
3317
|
if (options?.preserveCompletedStatuses !== false) {
|
|
3318
3318
|
try {
|
|
3319
3319
|
const currentPlan2 = await _internals9.loadPlanJsonOnly(directory);
|
|
@@ -3425,6 +3425,43 @@ async function savePlan(directory, plan, options) {
|
|
|
3425
3425
|
} catch {}
|
|
3426
3426
|
}
|
|
3427
3427
|
}
|
|
3428
|
+
if (options?.staleProjectionReconcile) {
|
|
3429
|
+
if (!currentPlan) {
|
|
3430
|
+
throw new Error("RECONCILE_LEDGER_PROJECTION_MISMATCH: no current plan.json projection exists.");
|
|
3431
|
+
}
|
|
3432
|
+
const comparableCurrent = PlanSchema.parse(currentPlan);
|
|
3433
|
+
derivePhaseStatusesInPlace(comparableCurrent);
|
|
3434
|
+
if (JSON.stringify(comparableCurrent) !== JSON.stringify(requestedForStaleProjectionReconcile)) {
|
|
3435
|
+
throw new Error("RECONCILE_LEDGER_PROJECTION_MISMATCH: manager rejected content that is not the exact unchanged plan.json projection.");
|
|
3436
|
+
}
|
|
3437
|
+
const events = await readLedgerEvents(directory);
|
|
3438
|
+
const tail = events[events.length - 1];
|
|
3439
|
+
const expected = options.staleProjectionReconcile;
|
|
3440
|
+
if (!tail || tail.seq !== expected.expectedSeq || tail.plan_hash_after !== expected.expectedLedgerHash || events[0]?.plan_id !== planId) {
|
|
3441
|
+
throw new PlanConcurrentModificationError("RECONCILE_LEDGER_PROJECTION_STALE: the ledger identity or tail changed before the recovery snapshot could be appended.");
|
|
3442
|
+
}
|
|
3443
|
+
try {
|
|
3444
|
+
const integrity = await readLedgerEventsWithIntegrity(directory);
|
|
3445
|
+
if (integrity.truncated) {
|
|
3446
|
+
await replaceTruncatedLedgerWithRecoveryRoot(directory, validated, {
|
|
3447
|
+
seq: expected.expectedSeq,
|
|
3448
|
+
ledgerHash: expected.expectedLedgerHash
|
|
3449
|
+
});
|
|
3450
|
+
} else {
|
|
3451
|
+
await takeSnapshotEvent(directory, validated, {
|
|
3452
|
+
planHashAfter: computePlanHash(validated),
|
|
3453
|
+
source: "save_plan_stale_projection_reconcile",
|
|
3454
|
+
expectedSeq: expected.expectedSeq,
|
|
3455
|
+
expectedLedgerHash: expected.expectedLedgerHash
|
|
3456
|
+
});
|
|
3457
|
+
}
|
|
3458
|
+
} catch (error2) {
|
|
3459
|
+
if (error2 instanceof LedgerStaleWriterError) {
|
|
3460
|
+
throw new PlanConcurrentModificationError(`RECONCILE_LEDGER_PROJECTION_STALE: ${error2.message}`);
|
|
3461
|
+
}
|
|
3462
|
+
throw error2;
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3428
3465
|
const currentHash = computeCurrentPlanHash(directory);
|
|
3429
3466
|
const hashAfter = computePlanHash(validated);
|
|
3430
3467
|
if (currentPlan) {
|
|
@@ -3837,6 +3874,10 @@ Phase: ${currentPhase} [${phaseStatus}] | Updated: ${now}
|
|
|
3837
3874
|
`;
|
|
3838
3875
|
markdown += `- Commit After Each Completed Task: ${profile.commit_after_each_completed_task ? "yes" : "no"}
|
|
3839
3876
|
`;
|
|
3877
|
+
if (profile.planning_profile) {
|
|
3878
|
+
markdown += `- Planning Profile: ${profile.planning_profile}
|
|
3879
|
+
`;
|
|
3880
|
+
}
|
|
3840
3881
|
}
|
|
3841
3882
|
const sortedPhases = [...plan.phases].sort((a, b) => a.id - b.id);
|
|
3842
3883
|
for (const phase of sortedPhases) {
|
|
@@ -4967,4 +5008,4 @@ function mergeDurableGateEntriesFromEvidence(taskId, entries, evidence) {
|
|
|
4967
5008
|
return merged;
|
|
4968
5009
|
}
|
|
4969
5010
|
|
|
4970
|
-
export { projectDbExists, getProjectDb, closeProjectDb, buildTaskCompletionDescriptor, ensureTaskCheckpointReceipt, updateTaskCheckpointReceipt, getExecutor, init_executor, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, getGitRepositoryStatus, isGitRepo, getDefaultBaseBranch, resetToRemoteBranch, resetToMainAfterMerge, containsPathTraversal, containsControlChars, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, normalizePath, pathsConflict, isGlobalFile, isProtectedPath, readTaskScopes,
|
|
5011
|
+
export { projectDbExists, getProjectDb, closeProjectDb, buildTaskCompletionDescriptor, ensureTaskCheckpointReceipt, updateTaskCheckpointReceipt, isValidEnvKey, getExecutor, init_executor, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, getGitRepositoryStatus, isGitRepo, getDefaultBaseBranch, detectDefaultRemoteBranch, resetToRemoteBranch, resetToMainAfterMerge, containsPathTraversal, containsControlChars, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, normalizePath, pathsConflict, isGlobalFile, isProtectedPath, readTaskScopes, loadPlanJsonOnly, loadPlan, savePlan, closePlanTerminalState, derivePlanMarkdown, isValidEvidenceType, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
authorizeCuration
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-qy1nq52t.js";
|
|
5
5
|
import {
|
|
6
6
|
findNearDuplicate,
|
|
7
7
|
inferTags,
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
resolveSwarmKnowledgePath,
|
|
10
10
|
resolveSwarmRejectedPath,
|
|
11
11
|
transactKnowledge
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-01ggt2mj.js";
|
|
13
13
|
import {
|
|
14
14
|
resolveKnowledgeStoreDir
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-vh05t3w5.js";
|
|
16
16
|
import {
|
|
17
17
|
atomicWriteFile
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-p8kk34am.js";
|
|
19
19
|
import {
|
|
20
20
|
require_proper_lockfile
|
|
21
21
|
} from "./index-7g4c7s5r.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
SWARM_WORKTREE_DIR_NAME,
|
|
14
14
|
init_constants
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-jqsfsqbx.js";
|
|
16
16
|
import {
|
|
17
17
|
__require
|
|
18
18
|
} from "./index-a76rekgs.js";
|
|
@@ -86,7 +86,7 @@ var _internals = {
|
|
|
86
86
|
symlinkSync: fs.symlinkSync
|
|
87
87
|
},
|
|
88
88
|
writeScopeToDisk: async (directory, taskId, files) => {
|
|
89
|
-
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-
|
|
89
|
+
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-p9dmprry.js");
|
|
90
90
|
return realWrite(directory, taskId, files);
|
|
91
91
|
},
|
|
92
92
|
writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
|