opencode-swarm 7.132.2 → 7.134.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/README.md +4 -1
- package/dist/agents/agent-output-schema.d.ts +74 -0
- package/dist/agents/critic.d.ts +2 -1
- package/dist/agents/reviewer.d.ts +1 -1
- package/dist/background/completion-observer.d.ts +17 -5
- package/dist/background/pending-delegations.d.ts +315 -2
- package/dist/background/stage-b-gates.d.ts +2 -0
- package/dist/cli/{config-doctor-bp5spb79.js → config-doctor-t5r92674.js} +3 -3
- package/dist/cli/{core-wg3re04e.js → core-d6yd2jzv.js} +2 -2
- package/dist/cli/{curation-policy-7zp2m9gv.js → curation-policy-3smfn2a3.js} +7 -7
- package/dist/cli/{curator-drift-y1wm4atk.js → curator-drift-tsyyf4b4.js} +4 -4
- package/dist/cli/{curator-h067mrcc.js → curator-hva8f3nf.js} +31 -29
- package/dist/cli/{curator-llm-factory-605d08hf.js → curator-llm-factory-p3aqev12.js} +31 -29
- package/dist/cli/{dispatch-3mhgqj2x.js → dispatch-gxbeb2ps.js} +2 -2
- package/dist/cli/{evidence-summary-service-jfagmvrh.js → evidence-summary-service-mrzsjpg4.js} +12 -11
- package/dist/cli/{gate-evidence-cy2te3x8.js → gate-evidence-b5v1xvxp.js} +4 -4
- package/dist/cli/guardrail-explain-k8mcvk61.js +57 -0
- package/dist/cli/{guardrail-log-aa112fxv.js → guardrail-log-absma1rv.js} +5 -5
- package/dist/cli/{hive-promoter-nv0m5rzk.js → hive-promoter-jwd51gzk.js} +31 -29
- package/dist/cli/{index-g4mnf3p5.js → index-1j3682j8.js} +5 -5
- package/dist/cli/{index-6ccynjv3.js → index-2njes601.js} +8 -8
- package/dist/cli/{index-w9cb5zwh.js → index-2t1n9k7b.js} +4 -4
- package/dist/cli/{index-f6480ee6.js → index-3dtjhr26.js} +5259 -1759
- package/dist/cli/{index-2tn5h2zp.js → index-4p02dp92.js} +6 -6
- package/dist/cli/index-b4z7s917.js +80 -0
- package/dist/cli/{index-bvp2v7k1.js → index-b5ek2cge.js} +266 -19
- package/dist/cli/index-b8zgtz81.js +123 -0
- package/dist/cli/{index-3s9rfnqq.js → index-baawkm48.js} +12 -12
- package/dist/cli/{index-fgcmxjp7.js → index-c3e0ymrg.js} +1 -1
- package/dist/cli/{index-q27bajqb.js → index-cfkvc5q9.js} +3 -3
- package/dist/cli/{index-7mkpsw6g.js → index-dd7ttx8x.js} +1 -1
- package/dist/cli/{index-jgfcp9bh.js → index-dgxgvzab.js} +7 -7
- package/dist/cli/{index-8d3m0ge3.js → index-eedq2y40.js} +48 -34
- package/dist/cli/{index-630badhp.js → index-g87ty4wp.js} +149 -6
- package/dist/cli/{index-yvv1wt2h.js → index-hgh01f6h.js} +25 -3
- package/dist/cli/{index-9cf1yr67.js → index-j6ywarjp.js} +3 -3
- package/dist/cli/{index-mwkwyej1.js → index-jpkxjmfw.js} +5 -5
- package/dist/cli/{index-03zyn94g.js → index-k742ecbm.js} +178 -222
- package/dist/cli/{index-y5qp59rc.js → index-kapharv7.js} +10 -4
- package/dist/cli/{index-djwemsjn.js → index-m2s0gbzt.js} +2 -2
- package/dist/cli/{index-4ff0x4cg.js → index-p8hezdtz.js} +1 -1
- package/dist/cli/{index-k4tmx21m.js → index-rkyhv4p5.js} +2 -2
- package/dist/cli/{index-3x761jqv.js → index-wk1h5ec2.js} +1 -1
- package/dist/cli/{index-jj4earrh.js → index-xfejq1p9.js} +1 -1
- package/dist/cli/{index-rt5jgktq.js → index-y0kk3rtv.js} +2 -2
- package/dist/cli/index-y3v1404y.js +1625 -0
- package/dist/cli/index.js +35 -31
- package/dist/cli/{knowledge-escalator-j0nceas7.js → knowledge-escalator-mkdac2m7.js} +8 -8
- package/dist/cli/{knowledge-events-gpqc62jr.js → knowledge-events-jjc9qbe0.js} +6 -6
- package/dist/cli/{knowledge-link-4yd2z8ev.js → knowledge-link-nc4y2zkq.js} +5 -5
- package/dist/cli/{knowledge-store-ggxr3ww5.js → knowledge-store-9e0w1kxm.js} +6 -6
- package/dist/cli/{knowledge-validator-007smap6.js → knowledge-validator-h1nrn2pk.js} +9 -9
- package/dist/cli/pending-delegations-v9e40hfk.js +96 -0
- package/dist/cli/{pr-subscriptions-zqbmctwz.js → pr-subscriptions-ztq40hrt.js} +7 -7
- package/dist/cli/{scan-cursor-wz4bff7a.js → scan-cursor-mk3tq3sf.js} +7 -7
- package/dist/cli/{schema-023gwne7.js → schema-bjb0yzsq.js} +7 -3
- package/dist/cli/{scope-persistence-dm5bab50.js → scope-persistence-hz3zmmsv.js} +5 -5
- package/dist/cli/{skill-generator-rtsg1m7x.js → skill-generator-p1de0wkr.js} +10 -10
- package/dist/cli/worktree-collision-ownership-c4bdnjtx.js +221 -0
- package/dist/commands/command-dispatch.d.ts +7 -0
- package/dist/commands/index.d.ts +7 -0
- package/dist/commands/registry.d.ts +16 -0
- package/dist/commands/review.d.ts +21 -0
- package/dist/config/agent-names.d.ts +3 -3
- package/dist/config/evidence-schema.d.ts +47 -47
- package/dist/config/index.d.ts +2 -2
- package/dist/config/schema.d.ts +58 -6
- package/dist/consensus/contracts.d.ts +3 -3
- package/dist/evaluation/ephemeral-agent-dispatcher.d.ts +64 -0
- package/dist/evaluation/model-dispatcher.d.ts +11 -5
- package/dist/hooks/auto-review.d.ts +30 -65
- package/dist/hooks/delegation-gate/worktree-collision-ownership.d.ts +28 -0
- package/dist/hooks/delegation-gate/worktree-isolation.d.ts +63 -1
- package/dist/hooks/delegation-gate/worktree-merge-status.d.ts +14 -0
- package/dist/hooks/delegation-gate/worktree-ownership-tag.d.ts +19 -0
- package/dist/hooks/delegation-gate/worktree-provisioning-owner.d.ts +30 -0
- package/dist/hooks/delegation-gate.d.ts +15 -6
- package/dist/hooks/guardrails/tool-before.d.ts +8 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/init-orphan-recovery.d.ts +17 -0
- package/dist/hooks/review-receipt-collector.d.ts +53 -10
- package/dist/hooks/review-receipt-scope.d.ts +74 -0
- package/dist/hooks/review-receipt.d.ts +104 -10
- package/dist/hooks/reviewer-scope-file-fingerprint.d.ts +21 -0
- package/dist/hooks/reviewer-scope-lifecycle.d.ts +19 -0
- package/dist/hooks/task-result-classifier.d.ts +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +583 -524
- package/dist/memory/schema.d.ts +1 -1
- package/dist/review/contracts.d.ts +29 -0
- package/dist/review/diff-source.d.ts +134 -0
- package/dist/review/engine.d.ts +60 -0
- package/dist/review/evidence.d.ts +88 -0
- package/dist/review/finding-validator.d.ts +77 -0
- package/dist/review/phase-runner.d.ts +37 -0
- package/dist/review/runtime.d.ts +32 -0
- package/dist/scope/scope-binding.d.ts +9 -0
- package/dist/services/config-doctor.d.ts +12 -0
- package/dist/session/snapshot-writer.d.ts +2 -0
- package/dist/state.d.ts +222 -1
- package/dist/tools/dispatch-lanes.d.ts +3 -1
- package/dist/tools/epic-record-divergence.d.ts +5 -5
- package/dist/tools/lean-turbo-review.d.ts +4 -1
- package/dist/tools/lean-turbo-run-phase.d.ts +3 -1
- package/dist/tools/phase-complete/gates/final-review-gate.d.ts +18 -0
- package/dist/tools/phase-complete/gates/index.d.ts +1 -0
- package/dist/tools/phase-complete/gates/types.d.ts +10 -0
- package/dist/tools/phase-complete.d.ts +13 -1
- package/dist/tools/plugin-registration.d.ts +3 -1
- package/dist/tools/swarm-command.d.ts +4 -1
- package/dist/tools/tool-metadata.d.ts +22 -22
- package/dist/turbo/lean/integration.d.ts +18 -2
- package/dist/turbo/lean/reviewer.d.ts +19 -3
- package/dist/turbo/lean/runner.d.ts +1 -1
- package/dist/worktree/merge.d.ts +47 -1
- package/package.json +1 -1
- package/dist/cli/guardrail-explain-s7vzm6z7.js +0 -55
- package/dist/cli/index-y2pfmd0z.js +0 -259
- package/dist/cli/pending-delegations-37t4xecr.js +0 -34
- package/dist/cli/{index-9f71ye47.js → index-13xxjfhn.js} +3 -3
- package/dist/cli/{index-s80bsjkj.js → index-2ghkk9ve.js} +6 -6
- package/dist/cli/{index-76kvm9z5.js → index-5nybajn9.js} +3 -3
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/hooks/delegation-gate/worktree-merge-status.ts
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
var failuresByTask = new Map;
|
|
6
|
+
var durableStatusPath;
|
|
7
|
+
var MAX_RECOVERY_STATUS_BYTES = 2 * 1024 * 1024;
|
|
8
|
+
var MAX_RECOVERY_STATUS_ENTRIES = 512;
|
|
9
|
+
var hasLoaded = false;
|
|
10
|
+
function loadDurableStatus(statusPath) {
|
|
11
|
+
try {
|
|
12
|
+
hasLoaded = true;
|
|
13
|
+
if (!fs.existsSync(statusPath)) {
|
|
14
|
+
failuresByTask.clear();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const data = JSON.parse(fs.readFileSync(statusPath, "utf-8"));
|
|
18
|
+
if (data && typeof data === "object") {
|
|
19
|
+
failuresByTask.clear();
|
|
20
|
+
for (const [taskId, failure] of Object.entries(data)) {
|
|
21
|
+
failuresByTask.set(taskId, failure);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
} catch {
|
|
25
|
+
failuresByTask.clear();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function isRecoveryFailure(value) {
|
|
29
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
30
|
+
return false;
|
|
31
|
+
const candidate = value;
|
|
32
|
+
if (candidate.outcome !== "partial" && candidate.outcome !== "failed" || typeof candidate.stage !== "string" || !candidate.stage || typeof candidate.message !== "string" || !candidate.message) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
for (const key of ["worktreePath", "branch"]) {
|
|
36
|
+
if (candidate[key] !== undefined && (typeof candidate[key] !== "string" || candidate[key].length === 0)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (const key of ["queuedAt", "completedAt"]) {
|
|
41
|
+
if (candidate[key] !== undefined && (typeof candidate[key] !== "number" || !Number.isFinite(candidate[key]) || candidate[key] < 0)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
function scanWorktreeMergeFailuresForRecovery(projectDir) {
|
|
48
|
+
const statusPath = path.join(projectDir, ".swarm", "worktree-merge-status.json");
|
|
49
|
+
try {
|
|
50
|
+
const stat = fs.statSync(statusPath);
|
|
51
|
+
if (stat.size > MAX_RECOVERY_STATUS_BYTES) {
|
|
52
|
+
return {
|
|
53
|
+
status: "uncertain",
|
|
54
|
+
reason: `worktree merge-status file exceeds the ${MAX_RECOVERY_STATUS_BYTES}-byte recovery bound`
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const raw = fs.readFileSync(statusPath, "utf-8");
|
|
58
|
+
if (Buffer.byteLength(raw, "utf8") > MAX_RECOVERY_STATUS_BYTES) {
|
|
59
|
+
return {
|
|
60
|
+
status: "uncertain",
|
|
61
|
+
reason: `worktree merge-status file changed beyond the ${MAX_RECOVERY_STATUS_BYTES}-byte recovery bound`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const parsed = JSON.parse(raw);
|
|
65
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
66
|
+
return {
|
|
67
|
+
status: "uncertain",
|
|
68
|
+
reason: "worktree merge-status file does not contain an object"
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const entries = Object.entries(parsed);
|
|
72
|
+
if (entries.length > MAX_RECOVERY_STATUS_ENTRIES) {
|
|
73
|
+
return {
|
|
74
|
+
status: "uncertain",
|
|
75
|
+
reason: `worktree merge-status owner count exceeds the ${MAX_RECOVERY_STATUS_ENTRIES}-entry safety bound`
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
for (const [taskId, failure] of entries) {
|
|
79
|
+
if (!taskId || !isRecoveryFailure(failure)) {
|
|
80
|
+
return {
|
|
81
|
+
status: "uncertain",
|
|
82
|
+
reason: `worktree merge-status has an invalid owner record for task "${taskId}"`
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
status: "ok",
|
|
88
|
+
failures: entries
|
|
89
|
+
};
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (error.code === "ENOENT") {
|
|
92
|
+
return { status: "ok", failures: [] };
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
status: "uncertain",
|
|
96
|
+
reason: `worktree merge-status is unreadable or malformed: ${error instanceof Error ? error.message : String(error)}`
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function initDurableStatusPath(projectDir) {
|
|
101
|
+
if (typeof projectDir !== "string" || projectDir.length === 0)
|
|
102
|
+
return;
|
|
103
|
+
const nextPath = path.join(projectDir, ".swarm", "worktree-merge-status.json");
|
|
104
|
+
if (durableStatusPath === nextPath && hasLoaded)
|
|
105
|
+
return;
|
|
106
|
+
durableStatusPath = nextPath;
|
|
107
|
+
hasLoaded = false;
|
|
108
|
+
loadDurableStatus(durableStatusPath);
|
|
109
|
+
}
|
|
110
|
+
function getWorktreeMergeFailure(taskId) {
|
|
111
|
+
if (!hasLoaded && durableStatusPath) {
|
|
112
|
+
loadDurableStatus(durableStatusPath);
|
|
113
|
+
}
|
|
114
|
+
return failuresByTask.get(taskId);
|
|
115
|
+
}
|
|
116
|
+
function getAllWorktreeMergeFailures() {
|
|
117
|
+
if (!hasLoaded && durableStatusPath) {
|
|
118
|
+
loadDurableStatus(durableStatusPath);
|
|
119
|
+
}
|
|
120
|
+
return failuresByTask.entries();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export { scanWorktreeMergeFailuresForRecovery, initDurableStatusPath, getWorktreeMergeFailure, getAllWorktreeMergeFailures };
|
|
@@ -6,24 +6,24 @@ import {
|
|
|
6
6
|
} from "./index-ae75rja9.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveKnowledgeStoreDir
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-cfkvc5q9.js";
|
|
10
|
+
import {
|
|
11
|
+
atomicWriteFile
|
|
12
|
+
} from "./index-dd7ttx8x.js";
|
|
10
13
|
import {
|
|
11
14
|
init_knowledge_types,
|
|
12
15
|
isActiveStatus
|
|
13
16
|
} from "./index-bk5tah7q.js";
|
|
14
|
-
import {
|
|
15
|
-
init_logger,
|
|
16
|
-
log
|
|
17
|
-
} from "./index-zgwm4ryv.js";
|
|
18
|
-
import {
|
|
19
|
-
atomicWriteFile
|
|
20
|
-
} from "./index-7mkpsw6g.js";
|
|
21
17
|
import {
|
|
22
18
|
readCachedParsedFile
|
|
23
19
|
} from "./index-fsrp8wp3.js";
|
|
24
20
|
import {
|
|
25
21
|
require_proper_lockfile
|
|
26
22
|
} from "./index-7g4c7s5r.js";
|
|
23
|
+
import {
|
|
24
|
+
init_logger,
|
|
25
|
+
log
|
|
26
|
+
} from "./index-zgwm4ryv.js";
|
|
27
27
|
import {
|
|
28
28
|
__require,
|
|
29
29
|
__toESM
|
|
@@ -702,7 +702,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
702
702
|
const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
|
|
703
703
|
if (atFloor.length === 0 && recovered.length === 0)
|
|
704
704
|
return;
|
|
705
|
-
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-
|
|
705
|
+
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-jjc9qbe0.js");
|
|
706
706
|
const rollups = await readKnowledgeCounterRollups(directory);
|
|
707
707
|
const flagIds = new Set;
|
|
708
708
|
for (const e of atFloor) {
|
|
@@ -769,11 +769,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
if (action === "quarantine" && toQuarantine.length > 0) {
|
|
772
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
773
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
772
|
+
const { quarantineEntry } = await import("./knowledge-validator-h1nrn2pk.js");
|
|
773
|
+
const { KnowledgeConfigSchema } = await import("./schema-bjb0yzsq.js");
|
|
774
774
|
let config;
|
|
775
775
|
try {
|
|
776
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
776
|
+
const { loadPluginConfigWithMeta } = await import("./index-kapharv7.js");
|
|
777
777
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
778
778
|
config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
779
779
|
} catch {
|
|
@@ -4,17 +4,17 @@ import {
|
|
|
4
4
|
} from "./index-ae75rja9.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveKnowledgeStoreDir
|
|
7
|
-
} from "./index-
|
|
8
|
-
import {
|
|
9
|
-
init_logger,
|
|
10
|
-
warn
|
|
11
|
-
} from "./index-zgwm4ryv.js";
|
|
7
|
+
} from "./index-cfkvc5q9.js";
|
|
12
8
|
import {
|
|
13
9
|
atomicWriteFile
|
|
14
|
-
} from "./index-
|
|
10
|
+
} from "./index-dd7ttx8x.js";
|
|
15
11
|
import {
|
|
16
12
|
require_proper_lockfile
|
|
17
13
|
} from "./index-7g4c7s5r.js";
|
|
14
|
+
import {
|
|
15
|
+
init_logger,
|
|
16
|
+
warn
|
|
17
|
+
} from "./index-zgwm4ryv.js";
|
|
18
18
|
import {
|
|
19
19
|
__require,
|
|
20
20
|
__toESM
|
|
@@ -608,7 +608,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
|
|
|
608
608
|
deltas.push({ id, delta });
|
|
609
609
|
}
|
|
610
610
|
if (deltas.length > 0) {
|
|
611
|
-
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-
|
|
611
|
+
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-9e0w1kxm.js");
|
|
612
612
|
await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
|
|
613
613
|
}
|
|
614
614
|
return {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-rkyhv4p5.js";
|
|
5
5
|
import {
|
|
6
6
|
handleGuardrailLog
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-c3e0ymrg.js";
|
|
8
8
|
import {
|
|
9
9
|
COMMAND_REGISTRY,
|
|
10
10
|
SWARM_COMMAND_TOOL_ALLOWLIST,
|
|
@@ -69,6 +69,7 @@ import {
|
|
|
69
69
|
handleResetCommand,
|
|
70
70
|
handleResetSessionCommand,
|
|
71
71
|
handleRetrieveCommand,
|
|
72
|
+
handleReviewCommand,
|
|
72
73
|
handleRollbackCommand,
|
|
73
74
|
handleSddCommand,
|
|
74
75
|
handleSddProjectCommand,
|
|
@@ -83,28 +84,30 @@ import {
|
|
|
83
84
|
handleWriteRetroCommand,
|
|
84
85
|
normalizeSwarmCommandInput,
|
|
85
86
|
resolveCommand
|
|
86
|
-
} from "./index-
|
|
87
|
-
import"./index-
|
|
88
|
-
import"./index-
|
|
89
|
-
import"./index-
|
|
87
|
+
} from "./index-3dtjhr26.js";
|
|
88
|
+
import"./index-13xxjfhn.js";
|
|
89
|
+
import"./index-hgh01f6h.js";
|
|
90
|
+
import"./index-g87ty4wp.js";
|
|
91
|
+
import"./index-k742ecbm.js";
|
|
90
92
|
import"./index-4905hd2m.js";
|
|
91
93
|
import"./index-134d35c1.js";
|
|
92
|
-
import"./index-
|
|
93
|
-
import"./index-
|
|
94
|
-
import"./index-
|
|
95
|
-
import"./index-djwemsjn.js";
|
|
94
|
+
import"./index-j6ywarjp.js";
|
|
95
|
+
import"./index-jpkxjmfw.js";
|
|
96
|
+
import"./index-m2s0gbzt.js";
|
|
96
97
|
import"./index-vxv732ex.js";
|
|
97
98
|
import"./index-c8s9a3zh.js";
|
|
98
99
|
import"./index-9ss2m4rs.js";
|
|
99
|
-
import"./index-
|
|
100
|
-
import"./index-
|
|
101
|
-
import"./index-
|
|
100
|
+
import"./index-wk1h5ec2.js";
|
|
101
|
+
import"./index-1j3682j8.js";
|
|
102
|
+
import"./index-2njes601.js";
|
|
103
|
+
import"./index-y0kk3rtv.js";
|
|
102
104
|
import"./index-rtry5xyf.js";
|
|
103
|
-
import"./index-
|
|
104
|
-
import"./index-
|
|
105
|
+
import"./index-baawkm48.js";
|
|
106
|
+
import"./index-dgxgvzab.js";
|
|
105
107
|
import"./index-ae75rja9.js";
|
|
106
|
-
import"./index-
|
|
107
|
-
import"./index-
|
|
108
|
+
import"./index-cfkvc5q9.js";
|
|
109
|
+
import"./index-dd7ttx8x.js";
|
|
110
|
+
import"./index-xfejq1p9.js";
|
|
108
111
|
import"./index-k5jrywpr.js";
|
|
109
112
|
import"./index-n832052r.js";
|
|
110
113
|
import {
|
|
@@ -113,29 +116,29 @@ import {
|
|
|
113
116
|
init_constants,
|
|
114
117
|
init_schema,
|
|
115
118
|
stripKnownSwarmPrefix
|
|
116
|
-
} from "./index-
|
|
119
|
+
} from "./index-b5ek2cge.js";
|
|
117
120
|
import"./index-bk5tah7q.js";
|
|
118
121
|
import"./index-8fwhhayc.js";
|
|
119
122
|
import"./index-q1exe2b3.js";
|
|
120
|
-
import"./index-
|
|
121
|
-
import"./index-
|
|
123
|
+
import"./index-p8hezdtz.js";
|
|
124
|
+
import"./index-4p02dp92.js";
|
|
122
125
|
import"./index-1kz6da87.js";
|
|
123
|
-
import"./index-
|
|
126
|
+
import"./index-b4z7s917.js";
|
|
127
|
+
import"./index-b8zgtz81.js";
|
|
128
|
+
import"./index-2t1n9k7b.js";
|
|
124
129
|
import"./index-4rhhvd1a.js";
|
|
125
|
-
import"./index-
|
|
126
|
-
import"./index-
|
|
127
|
-
import"./index-z6xqpmqg.js";
|
|
128
|
-
import"./index-zjygnfay.js";
|
|
129
|
-
import"./index-zgwm4ryv.js";
|
|
130
|
-
import"./index-h3k62043.js";
|
|
131
|
-
import"./index-3x761jqv.js";
|
|
132
|
-
import"./index-7mkpsw6g.js";
|
|
130
|
+
import"./index-y3v1404y.js";
|
|
131
|
+
import"./index-2ghkk9ve.js";
|
|
133
132
|
import"./index-fsrp8wp3.js";
|
|
134
|
-
import"./index-
|
|
133
|
+
import"./index-5nybajn9.js";
|
|
134
|
+
import"./index-7g4c7s5r.js";
|
|
135
135
|
import"./index-q2rrv0cy.js";
|
|
136
136
|
import"./index-bpmtbmy9.js";
|
|
137
|
-
import"./index-
|
|
137
|
+
import"./index-z6xqpmqg.js";
|
|
138
|
+
import"./index-zjygnfay.js";
|
|
138
139
|
import"./index-qe3v54nb.js";
|
|
140
|
+
import"./index-zgwm4ryv.js";
|
|
141
|
+
import"./index-h3k62043.js";
|
|
139
142
|
import"./index-a76rekgs.js";
|
|
140
143
|
|
|
141
144
|
// src/commands/index.ts
|
|
@@ -263,7 +266,10 @@ function createSwarmCommandHandler(directory, agents, options = {}) {
|
|
|
263
266
|
activeAgentName: options.getActiveAgentName?.(input.sessionID),
|
|
264
267
|
packageRoot: options.packageRoot,
|
|
265
268
|
registeredAgents: options.registeredAgents,
|
|
266
|
-
evaluationModelDispatcher: options.evaluationModelDispatcher
|
|
269
|
+
evaluationModelDispatcher: options.evaluationModelDispatcher,
|
|
270
|
+
reviewModelDispatcher: options.reviewModelDispatcher,
|
|
271
|
+
autoReviewConfig: options.autoReviewConfig,
|
|
272
|
+
reviewAgentModelRegistry: options.reviewAgentModelRegistry
|
|
267
273
|
})
|
|
268
274
|
});
|
|
269
275
|
return;
|
|
@@ -278,7 +284,10 @@ async function buildSwarmCommandPrompt(args) {
|
|
|
278
284
|
activeAgentName,
|
|
279
285
|
packageRoot,
|
|
280
286
|
registeredAgents,
|
|
281
|
-
evaluationModelDispatcher
|
|
287
|
+
evaluationModelDispatcher,
|
|
288
|
+
reviewModelDispatcher,
|
|
289
|
+
autoReviewConfig,
|
|
290
|
+
reviewAgentModelRegistry
|
|
282
291
|
} = args;
|
|
283
292
|
const resolved = _internals.resolveCommand(tokens);
|
|
284
293
|
if (!resolved) {
|
|
@@ -322,7 +331,11 @@ async function buildSwarmCommandPrompt(args) {
|
|
|
322
331
|
sessionID,
|
|
323
332
|
tokens,
|
|
324
333
|
packageRoot,
|
|
325
|
-
evaluationModelDispatcher
|
|
334
|
+
evaluationModelDispatcher,
|
|
335
|
+
reviewModelDispatcher,
|
|
336
|
+
autoReviewConfig,
|
|
337
|
+
activeAgentName,
|
|
338
|
+
reviewAgentModelRegistry
|
|
326
339
|
});
|
|
327
340
|
return formatCanonicalPromptFallback({
|
|
328
341
|
original: `/swarm ${tokens.join(" ")}`.trim(),
|
|
@@ -389,6 +402,7 @@ export {
|
|
|
389
402
|
handleSddProjectCommand,
|
|
390
403
|
handleSddCommand,
|
|
391
404
|
handleRollbackCommand,
|
|
405
|
+
handleReviewCommand,
|
|
392
406
|
handleRetrieveCommand,
|
|
393
407
|
handleResetSessionCommand,
|
|
394
408
|
handleResetCommand,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
init_constants,
|
|
9
9
|
init_schema,
|
|
10
10
|
stripKnownSwarmPrefix
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-b5ek2cge.js";
|
|
12
12
|
import {
|
|
13
13
|
log
|
|
14
14
|
} from "./index-zgwm4ryv.js";
|
|
@@ -28,7 +28,9 @@ var DEPRECATED_FIELDS = new Map([
|
|
|
28
28
|
{
|
|
29
29
|
message: "deprecated",
|
|
30
30
|
replacement: "agents.skill_improver.model",
|
|
31
|
-
isDefaultValue: (v) => v === null
|
|
31
|
+
isDefaultValue: (v) => v === null,
|
|
32
|
+
deprecatedIn: 2,
|
|
33
|
+
sinceVersion: 1
|
|
32
34
|
}
|
|
33
35
|
],
|
|
34
36
|
[
|
|
@@ -36,7 +38,9 @@ var DEPRECATED_FIELDS = new Map([
|
|
|
36
38
|
{
|
|
37
39
|
message: "deprecated",
|
|
38
40
|
replacement: "agents.skill_improver.fallback_models",
|
|
39
|
-
isDefaultValue: (v) => Array.isArray(v) && v.length === 0
|
|
41
|
+
isDefaultValue: (v) => Array.isArray(v) && v.length === 0,
|
|
42
|
+
deprecatedIn: 2,
|
|
43
|
+
sinceVersion: 1
|
|
40
44
|
}
|
|
41
45
|
],
|
|
42
46
|
[
|
|
@@ -44,7 +48,9 @@ var DEPRECATED_FIELDS = new Map([
|
|
|
44
48
|
{
|
|
45
49
|
message: "deprecated",
|
|
46
50
|
replacement: "agents.spec_writer.model",
|
|
47
|
-
isDefaultValue: (v) => v === null
|
|
51
|
+
isDefaultValue: (v) => v === null,
|
|
52
|
+
deprecatedIn: 2,
|
|
53
|
+
sinceVersion: 1
|
|
48
54
|
}
|
|
49
55
|
],
|
|
50
56
|
[
|
|
@@ -52,7 +58,9 @@ var DEPRECATED_FIELDS = new Map([
|
|
|
52
58
|
{
|
|
53
59
|
message: "deprecated",
|
|
54
60
|
replacement: "agents.spec_writer.fallback_models",
|
|
55
|
-
isDefaultValue: (v) => Array.isArray(v) && v.length === 0
|
|
61
|
+
isDefaultValue: (v) => Array.isArray(v) && v.length === 0,
|
|
62
|
+
deprecatedIn: 2,
|
|
63
|
+
sinceVersion: 1
|
|
56
64
|
}
|
|
57
65
|
]
|
|
58
66
|
]);
|
|
@@ -283,6 +291,36 @@ function collectRawValueConstraintFindings(directory) {
|
|
|
283
291
|
}
|
|
284
292
|
return findings;
|
|
285
293
|
}
|
|
294
|
+
function collectRawAutoReviewCompatibilityFindings(directory) {
|
|
295
|
+
const findings = [];
|
|
296
|
+
const { userConfigPath, projectConfigPath } = getConfigPaths(directory);
|
|
297
|
+
for (const configPath of [userConfigPath, projectConfigPath]) {
|
|
298
|
+
if (!fs.existsSync(configPath))
|
|
299
|
+
continue;
|
|
300
|
+
try {
|
|
301
|
+
const stats = fs.statSync(configPath);
|
|
302
|
+
if (stats.size > CONFIG_DOCTOR_MAX_CONFIG_FILE_BYTES)
|
|
303
|
+
continue;
|
|
304
|
+
const raw = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
305
|
+
if (!isPlainObject(raw) || !isPlainObject(raw.auto_review))
|
|
306
|
+
continue;
|
|
307
|
+
const autoReview = raw.auto_review;
|
|
308
|
+
if (autoReview.structured_findings === false && isPlainObject(autoReview.final_review) && autoReview.final_review.mode === "gate") {
|
|
309
|
+
findings.push({
|
|
310
|
+
id: "invalid-auto-review-gate-compatibility",
|
|
311
|
+
title: "Invalid auto-review gate configuration",
|
|
312
|
+
description: 'auto_review.final_review.mode="gate" requires auto_review.structured_findings=true so gate evidence is machine-verifiable.',
|
|
313
|
+
severity: "error",
|
|
314
|
+
path: "auto_review.structured_findings",
|
|
315
|
+
currentValue: false,
|
|
316
|
+
autoFixable: false
|
|
317
|
+
});
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
} catch {}
|
|
321
|
+
}
|
|
322
|
+
return findings;
|
|
323
|
+
}
|
|
286
324
|
function emitWorktreeIsolationLayeringAdvisory(config, findings) {
|
|
287
325
|
const parallelization = config.parallelization;
|
|
288
326
|
const worktreePolicy = config.worktree?.policy ?? "auto";
|
|
@@ -497,6 +535,20 @@ function validateConfigKey(path2, value) {
|
|
|
497
535
|
}
|
|
498
536
|
break;
|
|
499
537
|
}
|
|
538
|
+
case "config_format_version": {
|
|
539
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value) || value < 0) {
|
|
540
|
+
findings.push({
|
|
541
|
+
id: "type-mismatch",
|
|
542
|
+
title: `Config field "${path2}" has wrong type`,
|
|
543
|
+
description: `Expected non-negative integer, got ${typeof value === "number" ? Number.isInteger(value) ? value : `${value} (non-integer)` : typeof value}`,
|
|
544
|
+
severity: "error",
|
|
545
|
+
path: path2,
|
|
546
|
+
currentValue: value,
|
|
547
|
+
autoFixable: false
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
500
552
|
case "guardrails.enabled": {
|
|
501
553
|
if (value === false) {
|
|
502
554
|
findings.push({
|
|
@@ -1146,6 +1198,7 @@ function runConfigDoctor(config, directory) {
|
|
|
1146
1198
|
findings.push(...collectRawGatesConfigFindings(directory));
|
|
1147
1199
|
findings.push(...collectRawStrictSectionFindings(directory));
|
|
1148
1200
|
findings.push(...collectRawValueConstraintFindings(directory));
|
|
1201
|
+
findings.push(...collectRawAutoReviewCompatibilityFindings(directory));
|
|
1149
1202
|
emitWorktreeIsolationLayeringAdvisory(config, findings);
|
|
1150
1203
|
const summary = {
|
|
1151
1204
|
info: findings.filter((f) => f.severity === "info").length,
|
|
@@ -1160,12 +1213,27 @@ function runConfigDoctor(config, directory) {
|
|
|
1160
1213
|
} else if (fs.existsSync(userConfigPath)) {
|
|
1161
1214
|
configSource = userConfigPath;
|
|
1162
1215
|
}
|
|
1216
|
+
const rawConfigVersion = config.config_format_version;
|
|
1217
|
+
const configVersion = typeof rawConfigVersion === "number" && Number.isFinite(rawConfigVersion) && Number.isInteger(rawConfigVersion) && rawConfigVersion >= 0 ? rawConfigVersion : 1;
|
|
1218
|
+
const availableMigrations = [];
|
|
1219
|
+
for (const [depPath, depInfo] of DEPRECATED_FIELDS) {
|
|
1220
|
+
if (configVersion < depInfo.deprecatedIn) {
|
|
1221
|
+
availableMigrations.push({
|
|
1222
|
+
field: depPath,
|
|
1223
|
+
replacement: depInfo.replacement,
|
|
1224
|
+
deprecatedIn: depInfo.deprecatedIn,
|
|
1225
|
+
sinceVersion: depInfo.sinceVersion,
|
|
1226
|
+
currentFormatVersion: configVersion
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1163
1230
|
return {
|
|
1164
1231
|
findings,
|
|
1165
1232
|
summary,
|
|
1166
1233
|
hasAutoFixableIssues,
|
|
1167
1234
|
timestamp: Date.now(),
|
|
1168
|
-
configSource
|
|
1235
|
+
configSource,
|
|
1236
|
+
...availableMigrations.length > 0 ? { availableMigrations } : {}
|
|
1169
1237
|
};
|
|
1170
1238
|
}
|
|
1171
1239
|
var DANGEROUS_PATH_SEGMENTS = new Set([
|
|
@@ -1265,6 +1333,81 @@ function applySafeAutoFixes(directory, result, options = {}) {
|
|
|
1265
1333
|
break;
|
|
1266
1334
|
}
|
|
1267
1335
|
}
|
|
1336
|
+
if (applyLossy && result.availableMigrations && result.availableMigrations.length > 0) {
|
|
1337
|
+
for (const migration of result.availableMigrations) {
|
|
1338
|
+
if (!isPathSafe(migration.field) || !isPathSafe(migration.replacement)) {
|
|
1339
|
+
continue;
|
|
1340
|
+
}
|
|
1341
|
+
const legacyParts = migration.field.split(".");
|
|
1342
|
+
let legacyParent = config;
|
|
1343
|
+
let legacyNavigated = true;
|
|
1344
|
+
for (let i = 0;i < legacyParts.length - 1; i++) {
|
|
1345
|
+
const part = legacyParts[i];
|
|
1346
|
+
if (legacyParent === null || legacyParent === undefined || typeof legacyParent !== "object" || Array.isArray(legacyParent)) {
|
|
1347
|
+
legacyNavigated = false;
|
|
1348
|
+
break;
|
|
1349
|
+
}
|
|
1350
|
+
const obj = legacyParent;
|
|
1351
|
+
if (obj[part] === undefined || obj[part] === null) {
|
|
1352
|
+
legacyNavigated = false;
|
|
1353
|
+
break;
|
|
1354
|
+
}
|
|
1355
|
+
legacyParent = obj[part];
|
|
1356
|
+
}
|
|
1357
|
+
if (!legacyNavigated) {
|
|
1358
|
+
continue;
|
|
1359
|
+
}
|
|
1360
|
+
const legacyKey = legacyParts[legacyParts.length - 1];
|
|
1361
|
+
const legacyHolder = legacyParent;
|
|
1362
|
+
if (!(legacyKey in legacyHolder)) {
|
|
1363
|
+
continue;
|
|
1364
|
+
}
|
|
1365
|
+
const legacyValue = legacyHolder[legacyKey];
|
|
1366
|
+
const depInfo = DEPRECATED_FIELDS.get(migration.field);
|
|
1367
|
+
if (!depInfo || depInfo.isDefaultValue(legacyValue)) {
|
|
1368
|
+
continue;
|
|
1369
|
+
}
|
|
1370
|
+
const replParts = migration.replacement.split(".");
|
|
1371
|
+
let replParent = config;
|
|
1372
|
+
let replNavigated = true;
|
|
1373
|
+
for (let i = 0;i < replParts.length - 1; i++) {
|
|
1374
|
+
const part = replParts[i];
|
|
1375
|
+
if (replParent === null || replParent === undefined || typeof replParent !== "object" || Array.isArray(replParent)) {
|
|
1376
|
+
replNavigated = false;
|
|
1377
|
+
break;
|
|
1378
|
+
}
|
|
1379
|
+
const obj = replParent;
|
|
1380
|
+
if (obj[part] === undefined) {
|
|
1381
|
+
obj[part] = {};
|
|
1382
|
+
} else if (obj[part] === null || typeof obj[part] !== "object") {
|
|
1383
|
+
replNavigated = false;
|
|
1384
|
+
break;
|
|
1385
|
+
}
|
|
1386
|
+
replParent = obj[part];
|
|
1387
|
+
}
|
|
1388
|
+
if (!replNavigated) {
|
|
1389
|
+
continue;
|
|
1390
|
+
}
|
|
1391
|
+
const replKey = replParts[replParts.length - 1];
|
|
1392
|
+
replParent[replKey] = legacyValue;
|
|
1393
|
+
delete legacyHolder[legacyKey];
|
|
1394
|
+
appliedFixes.push({
|
|
1395
|
+
type: "update",
|
|
1396
|
+
path: migration.replacement,
|
|
1397
|
+
value: legacyValue,
|
|
1398
|
+
description: `Migrate deprecated field \`${migration.field}\` \u2192 \`${migration.replacement}\``,
|
|
1399
|
+
risk: "low",
|
|
1400
|
+
lossy: true
|
|
1401
|
+
});
|
|
1402
|
+
appliedFixes.push({
|
|
1403
|
+
type: "remove",
|
|
1404
|
+
path: migration.field,
|
|
1405
|
+
description: `Remove deprecated field \`${migration.field}\` (migrated to \`${migration.replacement}\`)`,
|
|
1406
|
+
risk: "low",
|
|
1407
|
+
lossy: true
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1268
1411
|
if (appliedFixes.length > 0) {
|
|
1269
1412
|
const configDir = path.dirname(configPath);
|
|
1270
1413
|
if (!fs.existsSync(configDir)) {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
init_constants,
|
|
4
4
|
init_schema,
|
|
5
5
|
stripKnownSwarmPrefix
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-b5ek2cge.js";
|
|
7
7
|
import {
|
|
8
8
|
init_logger,
|
|
9
9
|
warn
|
|
@@ -2212,6 +2212,28 @@ function isInDeclaredScope(filePath, scopeEntries, cwd) {
|
|
|
2212
2212
|
return rel.length > 0 && !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
2213
2213
|
});
|
|
2214
2214
|
}
|
|
2215
|
+
var MAX_ALLOWED_HINT_ENTRIES = 20;
|
|
2216
|
+
function formatAllowedHints(rules) {
|
|
2217
|
+
const fmt = (items) => {
|
|
2218
|
+
if (!items || items.length === 0)
|
|
2219
|
+
return "(none)";
|
|
2220
|
+
if (items.length <= MAX_ALLOWED_HINT_ENTRIES)
|
|
2221
|
+
return items.join(", ");
|
|
2222
|
+
const omitted = items.length - MAX_ALLOWED_HINT_ENTRIES;
|
|
2223
|
+
return `${items.slice(0, MAX_ALLOWED_HINT_ENTRIES).join(", ")}, \u2026 (+${omitted} more)`;
|
|
2224
|
+
};
|
|
2225
|
+
const parts = [];
|
|
2226
|
+
if (rules.allowedExact && rules.allowedExact.length > 0) {
|
|
2227
|
+
parts.push(`Allowed exact paths: ${fmt(rules.allowedExact)}`);
|
|
2228
|
+
}
|
|
2229
|
+
parts.push(`Allowed prefixes: ${fmt(rules.allowedPrefix)}`);
|
|
2230
|
+
parts.push(`Allowed globs: ${fmt(rules.allowedGlobs)}`);
|
|
2231
|
+
if (rules.allowedCaseSensitiveGlobs && rules.allowedCaseSensitiveGlobs.length > 0) {
|
|
2232
|
+
parts.push(`Allowed case-sensitive globs: ${fmt(rules.allowedCaseSensitiveGlobs)}`);
|
|
2233
|
+
}
|
|
2234
|
+
parts.push("Block rules (blocked zones/prefixes/globs/exact) and universal deny paths still apply.");
|
|
2235
|
+
return parts.join(" ");
|
|
2236
|
+
}
|
|
2215
2237
|
function checkFileAuthorityWithRules(agentName, filePath, cwd, effectiveRules, options) {
|
|
2216
2238
|
const normalizedAgent = agentName.toLowerCase();
|
|
2217
2239
|
const strippedAgent = stripKnownSwarmPrefix(agentName).toLowerCase();
|
|
@@ -2321,13 +2343,13 @@ function checkFileAuthorityWithRules(agentName, filePath, cwd, effectiveRules, o
|
|
|
2321
2343
|
if (!isAllowed) {
|
|
2322
2344
|
return {
|
|
2323
2345
|
allowed: false,
|
|
2324
|
-
reason: `Path ${normalizedPath} not in allowed list for ${normalizedAgent}`
|
|
2346
|
+
reason: `Path ${normalizedPath} not in allowed list for ${normalizedAgent}. ${formatAllowedHints(rules)}`
|
|
2325
2347
|
};
|
|
2326
2348
|
}
|
|
2327
2349
|
} else if (rules.allowedPrefix != null && rules.allowedPrefix.length === 0) {
|
|
2328
2350
|
return {
|
|
2329
2351
|
allowed: false,
|
|
2330
|
-
reason: `Path ${normalizedPath} not in allowed list for ${normalizedAgent}`
|
|
2352
|
+
reason: `Path ${normalizedPath} not in allowed list for ${normalizedAgent}. ${formatAllowedHints(rules)}`
|
|
2331
2353
|
};
|
|
2332
2354
|
}
|
|
2333
2355
|
}
|