opencode-swarm 7.138.2 → 7.138.4
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/execute/SKILL.md +11 -2
- package/.opencode/skills/swarm-implement/SKILL.md +1 -1
- package/.opencode/skills/swarm-pr-review/SKILL.md +5 -1
- package/dist/background/pr-review-trigger-contract.d.ts +38 -1
- package/dist/cli/{config-doctor-hzb0bck9.js → config-doctor-31yppse4.js} +2 -2
- package/dist/cli/{core-v6bte964.js → core-65c7rvqf.js} +1 -1
- package/dist/cli/{curation-policy-aj37yvz8.js → curation-policy-hs9pc1rp.js} +2 -2
- package/dist/cli/{curator-jt6dza8y.js → curator-54n1y4j8.js} +16 -15
- package/dist/cli/{curator-llm-factory-m9f4h8t4.js → curator-llm-factory-wm27ra25.js} +16 -15
- package/dist/cli/{evidence-summary-service-6cttrkzw.js → evidence-summary-service-hrxcf29a.js} +1 -1
- package/dist/cli/{guardrail-explain-rks41rpx.js → guardrail-explain-1729nse8.js} +17 -16
- package/dist/cli/{guardrail-log-h39jxftx.js → guardrail-log-yjj5srkw.js} +4 -3
- package/dist/cli/{hive-promoter-34y2x4vt.js → hive-promoter-es2x2b0e.js} +16 -15
- package/dist/cli/{index-49ygvqvm.js → index-1g6xpjk3.js} +4 -4
- package/dist/cli/{index-bakfqtye.js → index-33q2gmgd.js} +1 -1
- package/dist/cli/{index-xm07cqy2.js → index-50mwt8fx.js} +5 -5
- package/dist/cli/index-556ja8an.js +62 -0
- package/dist/cli/{index-r9pn41rj.js → index-57stye65.js} +1 -1
- package/dist/cli/{index-exq36v6w.js → index-5q009kc4.js} +1 -1
- package/dist/cli/{index-89dwrz8n.js → index-a18hk2fw.js} +225 -63
- package/dist/cli/{index-8emf08eb.js → index-a9xny52r.js} +2 -2
- package/dist/cli/{index-yxswbd1t.js → index-c60whfgh.js} +1 -1
- package/dist/cli/{index-gpxg7wx8.js → index-e1kgxchq.js} +30 -68
- package/dist/cli/{index-qt3jjjw9.js → index-gm3pjfhb.js} +271 -94
- package/dist/cli/{index-qg5smxv9.js → index-jbge0dyh.js} +3 -3
- package/dist/cli/{index-s7ac0xrf.js → index-k27a4e5g.js} +18 -17
- package/dist/cli/{index-k6cq9wwh.js → index-m1pwkwfe.js} +1 -1
- package/dist/cli/{index-ze4we97d.js → index-m40ea3zk.js} +1 -1
- package/dist/cli/{index-da98750t.js → index-m8txs2a9.js} +1 -1
- package/dist/cli/{index-y06a43sk.js → index-mycqmsz5.js} +4 -0
- package/dist/cli/index-smsy2p8n.js +1725 -0
- package/dist/cli/{index-d01d4102.js → index-tjwz5tct.js} +2 -2
- package/dist/cli/{index-j0xx9wpj.js → index-y28n2wmq.js} +1 -1
- package/dist/cli/index.js +16 -15
- package/dist/cli/{knowledge-escalator-qmpfh5yz.js → knowledge-escalator-s6z1x65b.js} +3 -3
- package/dist/cli/{knowledge-events-7neg8x0p.js → knowledge-events-nnyn6hst.js} +1 -1
- package/dist/cli/{knowledge-store-a6d4625r.js → knowledge-store-x4yfc7v3.js} +1 -1
- package/dist/cli/{knowledge-validator-q1qrdyvx.js → knowledge-validator-1v047gsa.js} +4 -4
- package/dist/cli/{scan-cursor-3tqshkb2.js → scan-cursor-jxajj6s7.js} +2 -2
- package/dist/cli/{schema-mtyaeh18.js → schema-fj32eyae.js} +1 -1
- package/dist/cli/{scope-persistence-n1bryhzf.js → scope-persistence-w7zen2wz.js} +25 -2
- package/dist/cli/{skill-generator-t3m5qajm.js → skill-generator-rt0jqcsa.js} +5 -5
- package/dist/hooks/guardrails/destructive-command.d.ts +35 -0
- package/dist/hooks/guardrails/file-authority.d.ts +71 -26
- package/dist/hooks/guardrails/index.d.ts +2 -0
- package/dist/hooks/guardrails/tool-before.d.ts +5 -0
- package/dist/hooks/scope-guard.d.ts +3 -1
- package/dist/index.js +408 -396
- package/dist/scope/path-identity.d.ts +27 -0
- package/dist/scope/scope-binding.d.ts +90 -2
- package/dist/scope/scope-lease-renewal.d.ts +28 -0
- package/dist/scope/scope-persistence.d.ts +102 -19
- package/dist/scope/scope-resolution-diagnostic.d.ts +7 -0
- package/dist/tools/declare-scope.d.ts +3 -1
- package/dist/tools/save-plan.d.ts +2 -0
- package/dist/tools/write-pr-review-trigger-eval.d.ts +2 -2
- package/dist/turbo/lean/lane-scope.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cli/index-2y4jy0de.js +0 -642
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
} from "./index-rrxcfxrd.js";
|
|
17
17
|
import {
|
|
18
18
|
stableCanonicalStringify
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-gm3pjfhb.js";
|
|
20
20
|
import {
|
|
21
21
|
detectStraySwarmDirs,
|
|
22
22
|
readDoctorArtifact,
|
|
23
23
|
removeStraySwarmDir,
|
|
24
24
|
runConfigDoctor
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-m8txs2a9.js";
|
|
26
26
|
import {
|
|
27
27
|
MAX_TRANSIENT_RETRIES,
|
|
28
28
|
archiveEvidence,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
savePlan,
|
|
60
60
|
transientBackoff,
|
|
61
61
|
validateProjectRoot
|
|
62
|
-
} from "./index-
|
|
62
|
+
} from "./index-mycqmsz5.js";
|
|
63
63
|
import {
|
|
64
64
|
EvaluationTaskV1Schema,
|
|
65
65
|
GateAuditManifestV1Schema,
|
|
@@ -114,15 +114,15 @@ import {
|
|
|
114
114
|
retireSkill,
|
|
115
115
|
selectCandidateEntries,
|
|
116
116
|
syncBundledProjectSkillsIfMissingAsync
|
|
117
|
-
} from "./index-
|
|
117
|
+
} from "./index-jbge0dyh.js";
|
|
118
118
|
import {
|
|
119
119
|
readRecentEscalations
|
|
120
|
-
} from "./index-
|
|
120
|
+
} from "./index-50mwt8fx.js";
|
|
121
121
|
import {
|
|
122
122
|
alreadyCuratedThisGeneration,
|
|
123
123
|
claimNextScanBatch,
|
|
124
124
|
resolveCohortId
|
|
125
|
-
} from "./index-
|
|
125
|
+
} from "./index-c60whfgh.js";
|
|
126
126
|
import {
|
|
127
127
|
CURATOR_INIT_PROMPT,
|
|
128
128
|
CURATOR_PHASE_PROMPT,
|
|
@@ -175,11 +175,11 @@ import {
|
|
|
175
175
|
validateActionableFields,
|
|
176
176
|
validateLesson,
|
|
177
177
|
validateSkillPath
|
|
178
|
-
} from "./index-
|
|
178
|
+
} from "./index-tjwz5tct.js";
|
|
179
179
|
import {
|
|
180
180
|
authorizeCuration,
|
|
181
181
|
buildConfigFingerprintInput
|
|
182
|
-
} from "./index-
|
|
182
|
+
} from "./index-m40ea3zk.js";
|
|
183
183
|
import {
|
|
184
184
|
cohortConfigFingerprint
|
|
185
185
|
} from "./index-rtry5xyf.js";
|
|
@@ -212,7 +212,7 @@ import {
|
|
|
212
212
|
transactFile,
|
|
213
213
|
transactKnowledge,
|
|
214
214
|
wordBigrams
|
|
215
|
-
} from "./index-
|
|
215
|
+
} from "./index-1g6xpjk3.js";
|
|
216
216
|
import {
|
|
217
217
|
MAX_EVENT_LOG_ENTRIES,
|
|
218
218
|
_internals,
|
|
@@ -222,7 +222,7 @@ import {
|
|
|
222
222
|
recordHiveKnowledgeEvent,
|
|
223
223
|
recordKnowledgeEvent,
|
|
224
224
|
resolveKnowledgeEventsPath
|
|
225
|
-
} from "./index-
|
|
225
|
+
} from "./index-57stye65.js";
|
|
226
226
|
import {
|
|
227
227
|
resolveHiveDataDir,
|
|
228
228
|
resolveHiveEventsPath,
|
|
@@ -247,7 +247,7 @@ import {
|
|
|
247
247
|
init_loader,
|
|
248
248
|
loadPluginConfig,
|
|
249
249
|
loadPluginConfigWithMeta
|
|
250
|
-
} from "./index-
|
|
250
|
+
} from "./index-m1pwkwfe.js";
|
|
251
251
|
import {
|
|
252
252
|
RetrospectiveEvidenceSchema
|
|
253
253
|
} from "./index-gprxjmm7.js";
|
|
@@ -263,7 +263,7 @@ import {
|
|
|
263
263
|
package_default,
|
|
264
264
|
resolveAutoReviewConfig,
|
|
265
265
|
stripKnownSwarmPrefix
|
|
266
|
-
} from "./index-
|
|
266
|
+
} from "./index-5q009kc4.js";
|
|
267
267
|
import {
|
|
268
268
|
KNOWLEDGE_SCHEMA_VERSION,
|
|
269
269
|
OUTCOME_BLOCK_THRESHOLD,
|
|
@@ -285,7 +285,7 @@ import {
|
|
|
285
285
|
clearAllScopes,
|
|
286
286
|
clearScopeBindingFromDisk,
|
|
287
287
|
clearScopeBindings
|
|
288
|
-
} from "./index-
|
|
288
|
+
} from "./index-smsy2p8n.js";
|
|
289
289
|
import {
|
|
290
290
|
appendLedgerEvent,
|
|
291
291
|
computePlanHash,
|
|
@@ -1540,6 +1540,20 @@ var PrReviewPersistedInputRowSchema = exports_external.discriminatedUnion("resul
|
|
|
1540
1540
|
evidence: TriggerEvidenceSchema
|
|
1541
1541
|
}).strict()
|
|
1542
1542
|
]);
|
|
1543
|
+
var PrReviewWriterInputRowSchema = exports_external.discriminatedUnion("result", [
|
|
1544
|
+
exports_external.object({
|
|
1545
|
+
trigger_id: TriggerIdSchema,
|
|
1546
|
+
result: exports_external.literal("MATCHED"),
|
|
1547
|
+
evidence: TriggerEvidenceSchema.optional(),
|
|
1548
|
+
source_batch_id: exports_external.string().trim().min(1),
|
|
1549
|
+
source_lane_id: exports_external.string().trim().min(1)
|
|
1550
|
+
}).strict(),
|
|
1551
|
+
exports_external.object({
|
|
1552
|
+
trigger_id: TriggerIdSchema,
|
|
1553
|
+
result: exports_external.literal("NOT_TRIGGERED"),
|
|
1554
|
+
evidence: TriggerEvidenceSchema.optional()
|
|
1555
|
+
}).strict()
|
|
1556
|
+
]);
|
|
1543
1557
|
function rawTriggerIds(input) {
|
|
1544
1558
|
if (!Array.isArray(input))
|
|
1545
1559
|
return null;
|
|
@@ -5700,8 +5714,7 @@ function resetSwarmState() {
|
|
|
5700
5714
|
for (const binding of clearScopeBindings()) {
|
|
5701
5715
|
clearScopeBindingFromDisk({
|
|
5702
5716
|
directory: binding.workspaceIdentity,
|
|
5703
|
-
|
|
5704
|
-
ownerSessionId: binding.ownerSessionId
|
|
5717
|
+
binding
|
|
5705
5718
|
});
|
|
5706
5719
|
}
|
|
5707
5720
|
resetStandardWorktreeIsolationState();
|
|
@@ -5893,8 +5906,7 @@ function endAgentSession(sessionId) {
|
|
|
5893
5906
|
for (const binding of removedBindings) {
|
|
5894
5907
|
clearScopeBindingFromDisk({
|
|
5895
5908
|
directory: binding.workspaceIdentity,
|
|
5896
|
-
|
|
5897
|
-
ownerSessionId: binding.ownerSessionId
|
|
5909
|
+
binding
|
|
5898
5910
|
});
|
|
5899
5911
|
}
|
|
5900
5912
|
swarmState.agentSessions.delete(sessionId);
|
|
@@ -11382,6 +11394,14 @@ async function buildRetrievalRecency(provider, nowMs) {
|
|
|
11382
11394
|
// src/hooks/guardrails/index.ts
|
|
11383
11395
|
init_constants();
|
|
11384
11396
|
init_schema();
|
|
11397
|
+
init_executor();
|
|
11398
|
+
|
|
11399
|
+
// src/scope/scope-lease-renewal.ts
|
|
11400
|
+
var MAX_HASH_BYTES = 4 * 1024 * 1024;
|
|
11401
|
+
var MAX_AGGREGATE_HASH_BYTES = 8 * 1024 * 1024;
|
|
11402
|
+
var CANDIDATE_TTL_MS = 10 * 60 * 1000;
|
|
11403
|
+
|
|
11404
|
+
// src/hooks/guardrails/index.ts
|
|
11385
11405
|
init_logger();
|
|
11386
11406
|
|
|
11387
11407
|
// src/utils/provider-error-classification.ts
|
|
@@ -11483,7 +11503,6 @@ import * as path17 from "path";
|
|
|
11483
11503
|
var DC_MAX_UNWRAP_DEPTH = 5;
|
|
11484
11504
|
var DC_SAFE_TARGETS = new Set([
|
|
11485
11505
|
"node_modules",
|
|
11486
|
-
".git",
|
|
11487
11506
|
"dist",
|
|
11488
11507
|
"build",
|
|
11489
11508
|
"coverage",
|
|
@@ -11648,6 +11667,30 @@ function dcSplitSegments(cmd) {
|
|
|
11648
11667
|
segments.push(current.trim());
|
|
11649
11668
|
return segments.filter((s) => s.length > 0);
|
|
11650
11669
|
}
|
|
11670
|
+
function dcExtractRecursiveRmTargets(segment) {
|
|
11671
|
+
const tokens = segment.match(/"(?:[^"\\]|\\.)*"|'[^']*'|\S+/g) ?? [];
|
|
11672
|
+
if (tokens.length < 2 || tokens[0] !== "rm")
|
|
11673
|
+
return null;
|
|
11674
|
+
let destructive = false;
|
|
11675
|
+
let index = 1;
|
|
11676
|
+
for (;index < tokens.length; index++) {
|
|
11677
|
+
const token = tokens[index];
|
|
11678
|
+
if (token === "--") {
|
|
11679
|
+
index++;
|
|
11680
|
+
break;
|
|
11681
|
+
}
|
|
11682
|
+
if (!token.startsWith("-") || token === "-")
|
|
11683
|
+
break;
|
|
11684
|
+
if (token === "--recursive" || token === "--force")
|
|
11685
|
+
destructive = true;
|
|
11686
|
+
if (!token.startsWith("--") && /[rRfF]/.test(token.slice(1))) {
|
|
11687
|
+
destructive = true;
|
|
11688
|
+
}
|
|
11689
|
+
}
|
|
11690
|
+
if (!destructive)
|
|
11691
|
+
return null;
|
|
11692
|
+
return tokens.slice(index).map((target) => target.replace(/^(["'])|(["'])$/g, ""));
|
|
11693
|
+
}
|
|
11651
11694
|
function dcHasUnresolvableVars(p) {
|
|
11652
11695
|
return /(%[A-Za-z_][A-Za-z0-9_]*%|\$\{?[A-Za-z_]|\$env:)/i.test(p);
|
|
11653
11696
|
}
|
|
@@ -11660,13 +11703,15 @@ function dcLstatAncestorWalk(targetPath, cwd) {
|
|
|
11660
11703
|
const ancestors = [];
|
|
11661
11704
|
let current = normalizedTarget;
|
|
11662
11705
|
while (true) {
|
|
11706
|
+
const rel = path17.relative(normalizedCwd, current);
|
|
11707
|
+
if (rel === ".." || rel.startsWith(`..${path17.sep}`) || path17.isAbsolute(rel))
|
|
11708
|
+
break;
|
|
11663
11709
|
ancestors.push(current);
|
|
11710
|
+
if (rel === "")
|
|
11711
|
+
break;
|
|
11664
11712
|
const parent = path17.dirname(current);
|
|
11665
11713
|
if (parent === current)
|
|
11666
11714
|
break;
|
|
11667
|
-
const rel = path17.relative(normalizedCwd, current);
|
|
11668
|
-
if (rel === "" || rel.startsWith(".."))
|
|
11669
|
-
break;
|
|
11670
11715
|
current = parent;
|
|
11671
11716
|
}
|
|
11672
11717
|
for (const ancestor of ancestors) {
|
|
@@ -11676,7 +11721,7 @@ function dcLstatAncestorWalk(targetPath, cwd) {
|
|
|
11676
11721
|
} catch (err) {
|
|
11677
11722
|
const code = err.code;
|
|
11678
11723
|
if (code === "ENOENT") {
|
|
11679
|
-
|
|
11724
|
+
continue;
|
|
11680
11725
|
}
|
|
11681
11726
|
return `lstat failed on "${ancestor}": ${String(err)} \u2014 refusing to allow destructive operation on unverifiable path`;
|
|
11682
11727
|
}
|
|
@@ -11700,11 +11745,12 @@ function dcValidateTargets(targets, cwd) {
|
|
|
11700
11745
|
if (/^\\\\/.test(t)) {
|
|
11701
11746
|
return `BLOCKED: Destructive command targets UNC path "${t}" \u2014 UNC paths in destructive operations are not allowed.`;
|
|
11702
11747
|
}
|
|
11703
|
-
const
|
|
11748
|
+
const filesystemTarget = t.replace(/[\\/]+/g, path17.sep);
|
|
11749
|
+
const lstatBlock = dcLstatAncestorWalk(filesystemTarget, cwd);
|
|
11704
11750
|
if (lstatBlock)
|
|
11705
11751
|
return lstatBlock;
|
|
11706
|
-
const basename3 = path17.basename(
|
|
11707
|
-
if (t ===
|
|
11752
|
+
const basename3 = path17.basename(filesystemTarget);
|
|
11753
|
+
if (dcPathComponents(t).length === 1 && DC_SAFE_TARGETS.has(basename3)) {
|
|
11708
11754
|
continue;
|
|
11709
11755
|
}
|
|
11710
11756
|
if (DC_FS_ROOTS.has(t) || DC_FS_ROOTS.has(t.replace(/\//g, "\\"))) {
|
|
@@ -11720,6 +11766,111 @@ function dcValidateTargets(targets, cwd) {
|
|
|
11720
11766
|
}
|
|
11721
11767
|
return null;
|
|
11722
11768
|
}
|
|
11769
|
+
function dcIsUntrustedCodePoint(codePoint) {
|
|
11770
|
+
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297;
|
|
11771
|
+
}
|
|
11772
|
+
function dcHasUntrustedText(value) {
|
|
11773
|
+
return Array.from(value).some((character) => dcIsUntrustedCodePoint(character.codePointAt(0) ?? 0));
|
|
11774
|
+
}
|
|
11775
|
+
function dcSafeDiagnosticValue(value) {
|
|
11776
|
+
return value.split("").map((character) => dcIsUntrustedCodePoint(character.codePointAt(0) ?? 0) ? "?" : character).join("").slice(0, 512);
|
|
11777
|
+
}
|
|
11778
|
+
function dcPathComponents(value) {
|
|
11779
|
+
return value.replace(/\\/g, "/").split("/").filter(Boolean);
|
|
11780
|
+
}
|
|
11781
|
+
function dcComponentEquals(left, right) {
|
|
11782
|
+
return process.platform === "win32" ? left.toLowerCase() === right.toLowerCase() : left === right;
|
|
11783
|
+
}
|
|
11784
|
+
function dcScopeContains(scopeEntry, target) {
|
|
11785
|
+
const normalize3 = (value) => {
|
|
11786
|
+
const normalized = path17.posix.normalize(value.replace(/\\/g, "/")).replace(/^\.\//, "").replace(/\/$/, "");
|
|
11787
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
11788
|
+
};
|
|
11789
|
+
const scope = normalize3(scopeEntry);
|
|
11790
|
+
const candidate = normalize3(target);
|
|
11791
|
+
return candidate === scope || candidate.startsWith(`${scope}/`);
|
|
11792
|
+
}
|
|
11793
|
+
function dcEvaluateRecursiveDeleteTargets(input) {
|
|
11794
|
+
if (input.targets.length === 0) {
|
|
11795
|
+
return {
|
|
11796
|
+
allowed: false,
|
|
11797
|
+
code: "DESTRUCTIVE_TARGET_INVALID",
|
|
11798
|
+
reason: "BLOCKED: Recursive delete has no statically verifiable target."
|
|
11799
|
+
};
|
|
11800
|
+
}
|
|
11801
|
+
const commonBlock = dcValidateTargets(input.targets, input.cwd);
|
|
11802
|
+
if (commonBlock) {
|
|
11803
|
+
return {
|
|
11804
|
+
allowed: false,
|
|
11805
|
+
code: "DESTRUCTIVE_TARGET_INVALID",
|
|
11806
|
+
reason: commonBlock
|
|
11807
|
+
};
|
|
11808
|
+
}
|
|
11809
|
+
const normalizedTargets = [];
|
|
11810
|
+
let hasNested = false;
|
|
11811
|
+
for (const raw of input.targets) {
|
|
11812
|
+
const target = raw.trim().replace(/^['"]|['"]$/g, "");
|
|
11813
|
+
const safeTarget = dcSafeDiagnosticValue(target);
|
|
11814
|
+
if (!target || target === "." || dcHasUntrustedText(target) || dcPathComponents(target).includes("..")) {
|
|
11815
|
+
return {
|
|
11816
|
+
allowed: false,
|
|
11817
|
+
code: "DESTRUCTIVE_TARGET_INVALID",
|
|
11818
|
+
reason: `BLOCKED: Recursive delete target "${safeTarget}" is empty, the workspace root, contains traversal, or contains control characters.`
|
|
11819
|
+
};
|
|
11820
|
+
}
|
|
11821
|
+
const components = dcPathComponents(target);
|
|
11822
|
+
if (components.some((component) => dcComponentEquals(component, ".git") || dcComponentEquals(component, ".swarm"))) {
|
|
11823
|
+
return {
|
|
11824
|
+
allowed: false,
|
|
11825
|
+
code: "DESTRUCTIVE_TARGET_PROTECTED",
|
|
11826
|
+
reason: `BLOCKED: Recursive delete target "${safeTarget}" contains protected .git or .swarm state.`
|
|
11827
|
+
};
|
|
11828
|
+
}
|
|
11829
|
+
const filesystemTarget = target.replace(/[\\/]+/g, path17.sep);
|
|
11830
|
+
const resolved = path17.resolve(input.cwd, filesystemTarget);
|
|
11831
|
+
const relative3 = path17.relative(path17.resolve(input.cwd), resolved);
|
|
11832
|
+
if (relative3 === "" || relative3 === ".." || relative3.startsWith(`..${path17.sep}`) || path17.isAbsolute(relative3)) {
|
|
11833
|
+
return {
|
|
11834
|
+
allowed: false,
|
|
11835
|
+
code: "DESTRUCTIVE_TARGET_OUTSIDE_WORKSPACE",
|
|
11836
|
+
reason: `BLOCKED: Recursive delete target "${safeTarget}" is not strictly contained by the workspace.`
|
|
11837
|
+
};
|
|
11838
|
+
}
|
|
11839
|
+
const basename3 = path17.basename(resolved);
|
|
11840
|
+
if (!DC_SAFE_TARGETS.has(basename3)) {
|
|
11841
|
+
return {
|
|
11842
|
+
allowed: false,
|
|
11843
|
+
code: "DESTRUCTIVE_TARGET_NOT_SAFE_ARTIFACT",
|
|
11844
|
+
reason: `BLOCKED: Recursive delete target "${safeTarget}" is not an allowlisted build/cache artifact.`
|
|
11845
|
+
};
|
|
11846
|
+
}
|
|
11847
|
+
const normalizedRelative = relative3.replace(/\\/g, "/");
|
|
11848
|
+
const isBare = components.length === 1;
|
|
11849
|
+
if (!isBare) {
|
|
11850
|
+
hasNested = true;
|
|
11851
|
+
if (!input.verifiedScope?.bindingId || !input.verifiedScope.generationId) {
|
|
11852
|
+
return {
|
|
11853
|
+
allowed: false,
|
|
11854
|
+
code: "DESTRUCTIVE_TARGET_SCOPE_REQUIRED",
|
|
11855
|
+
reason: `BLOCKED: Nested safe artifact "${safeTarget}" requires a verified active coder scope binding.`
|
|
11856
|
+
};
|
|
11857
|
+
}
|
|
11858
|
+
if (!input.verifiedScope.files.some((entry) => dcScopeContains(entry, normalizedRelative))) {
|
|
11859
|
+
return {
|
|
11860
|
+
allowed: false,
|
|
11861
|
+
code: "DESTRUCTIVE_TARGET_OUT_OF_SCOPE",
|
|
11862
|
+
reason: `BLOCKED: Nested safe artifact "${safeTarget}" is outside the verified active coder scope.`
|
|
11863
|
+
};
|
|
11864
|
+
}
|
|
11865
|
+
}
|
|
11866
|
+
normalizedTargets.push(normalizedRelative);
|
|
11867
|
+
}
|
|
11868
|
+
return {
|
|
11869
|
+
allowed: true,
|
|
11870
|
+
kind: hasNested ? "scoped-nested-safe-artifact" : "bare-safe-artifact",
|
|
11871
|
+
targets: normalizedTargets
|
|
11872
|
+
};
|
|
11873
|
+
}
|
|
11723
11874
|
function dcCheckJunctionCreation(segment, cwd) {
|
|
11724
11875
|
const mklinkMatch = /^mklink(?:\.exe)?\s+\/[JjDd]\s+"?([^"\s]+)"?\s+"?([^"\s]+)"?/i.exec(segment);
|
|
11725
11876
|
if (mklinkMatch) {
|
|
@@ -13134,7 +13285,6 @@ function classifySwarmCommandChatFallbackUse(resolved) {
|
|
|
13134
13285
|
// src/hooks/guardrails/tool-before.ts
|
|
13135
13286
|
init_constants();
|
|
13136
13287
|
init_schema();
|
|
13137
|
-
init_executor();
|
|
13138
13288
|
|
|
13139
13289
|
// src/hooks/shell-write-detect.ts
|
|
13140
13290
|
import * as path19 from "path";
|
|
@@ -18867,7 +19017,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
18867
19017
|
};
|
|
18868
19018
|
}
|
|
18869
19019
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
18870
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
19020
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-a9xny52r.js");
|
|
18871
19021
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
18872
19022
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
18873
19023
|
if (sweepConfig?.enabled === false)
|
|
@@ -20460,7 +20610,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
20460
20610
|
}
|
|
20461
20611
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
20462
20612
|
try {
|
|
20463
|
-
const skillModule = await import("./skill-generator-
|
|
20613
|
+
const skillModule = await import("./skill-generator-rt0jqcsa.js");
|
|
20464
20614
|
for (const cand of skillCandidates) {
|
|
20465
20615
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
20466
20616
|
continue;
|
|
@@ -20920,7 +21070,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
20920
21070
|
} catch {}
|
|
20921
21071
|
}
|
|
20922
21072
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
20923
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
21073
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-s6z1x65b.js");
|
|
20924
21074
|
for (const { id } of contradictedEntries) {
|
|
20925
21075
|
try {
|
|
20926
21076
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -21739,7 +21889,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
21739
21889
|
warnings.push("Failed to collect knowledge summary.");
|
|
21740
21890
|
}
|
|
21741
21891
|
try {
|
|
21742
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
21892
|
+
const { getScanStatus } = await import("./scan-cursor-jxajj6s7.js");
|
|
21743
21893
|
const scanStatus = await getScanStatus(directory);
|
|
21744
21894
|
if (scanStatus.remaining_estimate > 0) {
|
|
21745
21895
|
warnings.push(`Fair scan: reviewed ${knowledgeSummary.length} entries this sweep (generation ${scanStatus.generation}); ${scanStatus.remaining_estimate} more eligible entries will be visited in future curation sweeps.`);
|
|
@@ -21911,9 +22061,9 @@ var _internals24 = {
|
|
|
21911
22061
|
verifyPostMortemKnowledgeActions,
|
|
21912
22062
|
repairPostMortemActions,
|
|
21913
22063
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
21914
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
22064
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-fj32eyae.js");
|
|
21915
22065
|
try {
|
|
21916
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
22066
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-a9xny52r.js");
|
|
21917
22067
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
21918
22068
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
21919
22069
|
} catch {
|
|
@@ -21921,11 +22071,11 @@ var _internals24 = {
|
|
|
21921
22071
|
}
|
|
21922
22072
|
},
|
|
21923
22073
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
21924
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
22074
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-54n1y4j8.js");
|
|
21925
22075
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
21926
22076
|
},
|
|
21927
22077
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
21928
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
22078
|
+
const { checkHivePromotions } = await import("./hive-promoter-es2x2b0e.js");
|
|
21929
22079
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
21930
22080
|
},
|
|
21931
22081
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -21934,7 +22084,7 @@ var _internals24 = {
|
|
|
21934
22084
|
activateProposal,
|
|
21935
22085
|
listSkills: listSkills2,
|
|
21936
22086
|
sanitizeSlug
|
|
21937
|
-
} = await import("./skill-generator-
|
|
22087
|
+
} = await import("./skill-generator-rt0jqcsa.js");
|
|
21938
22088
|
const result = {
|
|
21939
22089
|
approved: [],
|
|
21940
22090
|
rejected: [],
|
|
@@ -24561,9 +24711,9 @@ function hashContent(content) {
|
|
|
24561
24711
|
return createHash9("sha1").update(content).digest("hex");
|
|
24562
24712
|
}
|
|
24563
24713
|
async function loadConfigForPolicyCurator(directory) {
|
|
24564
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
24714
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-fj32eyae.js");
|
|
24565
24715
|
try {
|
|
24566
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
24716
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-a9xny52r.js");
|
|
24567
24717
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
24568
24718
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
24569
24719
|
} catch {
|
|
@@ -27835,8 +27985,8 @@ function safeRemoveTemp(tempPath) {
|
|
|
27835
27985
|
} catch {}
|
|
27836
27986
|
}
|
|
27837
27987
|
function buildVacuumIntoSql(destPath) {
|
|
27838
|
-
const
|
|
27839
|
-
const escaped =
|
|
27988
|
+
const posix6 = destPath.replace(/\\/g, "/");
|
|
27989
|
+
const escaped = posix6.replace(/'/g, "''");
|
|
27840
27990
|
return `VACUUM INTO '${escaped}'`;
|
|
27841
27991
|
}
|
|
27842
27992
|
function rowString(row, col) {
|
|
@@ -28523,7 +28673,7 @@ async function runFinalizeStage(ctx) {
|
|
|
28523
28673
|
}
|
|
28524
28674
|
}
|
|
28525
28675
|
try {
|
|
28526
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
28676
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-fj32eyae.js");
|
|
28527
28677
|
const { config: pmLoadedConfig } = _internals36.loadPluginConfigWithMeta(ctx.directory);
|
|
28528
28678
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
28529
28679
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -30794,9 +30944,9 @@ var _internals41 = {
|
|
|
30794
30944
|
loadPluginConfigWithMeta,
|
|
30795
30945
|
loadCuratorDeps: async () => {
|
|
30796
30946
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
30797
|
-
import("./schema-
|
|
30798
|
-
import("./curator-
|
|
30799
|
-
import("./curator-llm-factory-
|
|
30947
|
+
import("./schema-fj32eyae.js"),
|
|
30948
|
+
import("./curator-54n1y4j8.js"),
|
|
30949
|
+
import("./curator-llm-factory-wm27ra25.js")
|
|
30800
30950
|
]);
|
|
30801
30951
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
30802
30952
|
}
|
|
@@ -31701,7 +31851,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
31701
31851
|
let scanCompleted = false;
|
|
31702
31852
|
let scanRemaining = 0;
|
|
31703
31853
|
try {
|
|
31704
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
31854
|
+
const { getScanStatus } = await import("./scan-cursor-jxajj6s7.js");
|
|
31705
31855
|
const status = await getScanStatus(directory);
|
|
31706
31856
|
scanGeneration = status.generation;
|
|
31707
31857
|
scanCompleted = status.completed;
|
|
@@ -31711,17 +31861,17 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
31711
31861
|
try {
|
|
31712
31862
|
const { isLinked: isLinked2 } = await import("./knowledge-link-xc6yhxmz.js");
|
|
31713
31863
|
if (isLinked2(directory)) {
|
|
31714
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
31864
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-fj32eyae.js");
|
|
31715
31865
|
let config;
|
|
31716
31866
|
try {
|
|
31717
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
31867
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-a9xny52r.js");
|
|
31718
31868
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
31719
31869
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
31720
31870
|
} catch {
|
|
31721
31871
|
config = KnowledgeConfigSchema2.parse({});
|
|
31722
31872
|
}
|
|
31723
31873
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
31724
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
31874
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-hs9pc1rp.js");
|
|
31725
31875
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
31726
31876
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
31727
31877
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -32932,7 +33082,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
32932
33082
|
const result = runConfigDoctor(config, directory);
|
|
32933
33083
|
let output;
|
|
32934
33084
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
32935
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
33085
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-31yppse4.js");
|
|
32936
33086
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
32937
33087
|
applyLossy: true
|
|
32938
33088
|
});
|
|
@@ -33769,7 +33919,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
33769
33919
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
33770
33920
|
}
|
|
33771
33921
|
async function handleEvidenceSummaryCommand(directory) {
|
|
33772
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
33922
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-hrxcf29a.js");
|
|
33773
33923
|
const artifact = await buildEvidenceSummary(directory);
|
|
33774
33924
|
if (!artifact) {
|
|
33775
33925
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -56075,7 +56225,7 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
56075
56225
|
async function handleHelpCommand(ctx) {
|
|
56076
56226
|
const targetCommand = ctx.args.join(" ");
|
|
56077
56227
|
if (!targetCommand) {
|
|
56078
|
-
const { buildHelpText } = await import("./index-
|
|
56228
|
+
const { buildHelpText } = await import("./index-k27a4e5g.js");
|
|
56079
56229
|
return buildHelpText();
|
|
56080
56230
|
}
|
|
56081
56231
|
const tokens = targetCommand.split(/\s+/);
|
|
@@ -56084,7 +56234,7 @@ async function handleHelpCommand(ctx) {
|
|
|
56084
56234
|
return _internals14.buildDetailedHelp(resolved.key, resolved.entry);
|
|
56085
56235
|
}
|
|
56086
56236
|
const similar = _internals14.findSimilarCommands(targetCommand);
|
|
56087
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
56237
|
+
const { buildHelpText: fullHelp } = await import("./index-k27a4e5g.js");
|
|
56088
56238
|
if (similar.length > 0) {
|
|
56089
56239
|
return `Command '/swarm ${targetCommand}' not found.
|
|
56090
56240
|
|
|
@@ -56261,7 +56411,7 @@ var COMMAND_REGISTRY = {
|
|
|
56261
56411
|
},
|
|
56262
56412
|
"guardrail explain": {
|
|
56263
56413
|
handler: async (ctx) => {
|
|
56264
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
56414
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-1729nse8.js");
|
|
56265
56415
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
56266
56416
|
},
|
|
56267
56417
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -56271,7 +56421,7 @@ var COMMAND_REGISTRY = {
|
|
|
56271
56421
|
},
|
|
56272
56422
|
"guardrail-explain": {
|
|
56273
56423
|
handler: async (ctx) => {
|
|
56274
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
56424
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-1729nse8.js");
|
|
56275
56425
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
56276
56426
|
},
|
|
56277
56427
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -56281,7 +56431,7 @@ var COMMAND_REGISTRY = {
|
|
|
56281
56431
|
},
|
|
56282
56432
|
"guardrail-log": {
|
|
56283
56433
|
handler: async (ctx) => {
|
|
56284
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
56434
|
+
const { handleGuardrailLog } = await import("./guardrail-log-yjj5srkw.js");
|
|
56285
56435
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
56286
56436
|
},
|
|
56287
56437
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -57416,12 +57566,16 @@ CODER'S TOOLS: write, edit, patch, apply_patch, swarm_apply_patch, create_file,
|
|
|
57416
57566
|
If a tool modifies a file, it is a CODER tool. Delegate.
|
|
57417
57567
|
<!-- BEHAVIORAL_GUIDANCE_START -->
|
|
57418
57568
|
1a. SCOPE DISCIPLINE \u2014 call declare_scope BEFORE every coder delegation AND before any test_engineer delegation that will write new test files.
|
|
57419
|
-
- Before you delegate a coding task, call declare_scope with { taskId, files } where \`files\` is the exact list of paths the coder is allowed to write. Bundle any generated/lockfile paths that the change will produce (e.g. package-lock.json, Cargo.lock, dist/*).
|
|
57420
|
-
- Before you delegate to test_engineer with an instruction to CREATE or MODIFY test files, call declare_scope with { taskId, files } listing the exact test file path(s) (e.g. src/auth/login.test.ts, tests/unit/foo.spec.ts) the test_engineer is expected to write.
|
|
57421
|
-
- If coder or test_engineer returns "WRITE BLOCKED" for a path outside the declared list: call declare_scope again with the missing path added
|
|
57569
|
+
- Before you delegate a coding task, call declare_scope with { taskId, files, replace_existing: true } where \`files\` is the exact list of paths the coder is allowed to write. Bundle any generated/lockfile paths that the change will produce (e.g. package-lock.json, Cargo.lock, dist/*). Replacement is safe for the first declaration and required for every retry/re-dispatch.
|
|
57570
|
+
- Before you delegate to test_engineer with an instruction to CREATE or MODIFY test files, call declare_scope with { taskId, files, replace_existing: true } listing the exact test file path(s) (e.g. src/auth/login.test.ts, tests/unit/foo.spec.ts) the test_engineer is expected to write.
|
|
57571
|
+
- If coder or test_engineer returns "WRITE BLOCKED" for a path outside the declared list: call declare_scope again with the missing path added and \`replace_existing: true\`. Do NOT instruct the coder to use bash, sed, echo, cat, tee, dd, or any interpreter eval (python -c, node -e, bun -e, ruby -e) to bypass the block. Alternate mechanisms cannot create write authority and violate scope discipline.
|
|
57422
57572
|
- Never wrap a file write in eval, bash -c, sh -c, a subshell, or a heredoc-to-file redirect as a workaround. Shell and interpreter targets are scope-checked when they can be proven, and unverifiable write payloads fail closed.
|
|
57423
57573
|
- Do NOT use mv, Move-Item, move, ren, Rename-Item, or cp-then-rm chains to relocate, rename, or delete files under \`.swarm/\` as a workaround for blocked destructive commands. Those are file-move shell bypasses and are banned. Use the tool's dedicated tools (\`.swarm/\` file management or evidence manager tools) instead.
|
|
57424
57574
|
- If you cannot enumerate files up front (e.g. a broad refactor), declare the containing directories \u2014 declare_scope accepts directory entries and grants containment.
|
|
57575
|
+
- Author task scope durably: every coding task passed to save_plan SHOULD include a non-empty \`files_touched\` list of normalized project-relative paths. On plan revision, omitting \`files_touched\` preserves that task's prior scope; passing \`[]\` clears it intentionally.
|
|
57576
|
+
- Scope-source precedence is exact and fail-closed: the active \`declare_scope\` binding is authoritative, otherwise plan \`files_touched\`, otherwise complete \`FILE:\` directives. Every lower-precedence source that is present must be a subset of the authoritative source.
|
|
57577
|
+
- \`SCOPE_CONFLICT\` recovery: inspect the named source lists, correct stale plan scope with save_plan and/or correct the delegation's \`FILE:\` lines, then call \`declare_scope({ taskId, files: <the reconciled list>, replace_existing: true, working_directory: <active lane root> })\` before retrying. Do not widen scope merely to silence the conflict.
|
|
57578
|
+
- \`SCOPE_BINDING_EXPIRED\` or \`SCOPE_BINDING_AMBIGUOUS\` recovery: re-read the current task scope, then call \`declare_scope\` with the intended exact files and \`replace_existing: true\` before retrying. \`SCOPE_WORKSPACE_MISMATCH\` recovery: use the diagnostic's active lane/worktree root as \`working_directory\` and keep every declared path relative to that root. \`SCOPE_ROOT_ESCAPE\` recovery: retry the intended operation relative to the active root only when the diagnostic supplies a safe relative path; never authorize the outside absolute path.
|
|
57425
57579
|
- Rationale: coder Task preflight binds scope to the exact workspace, plan generation, task, parent session, and Task call. Missing or malformed scope blocks delegation with SCOPE_NOT_DECLARED; conflicting lower-precedence FILE:/plan paths block with SCOPE_CONFLICT before the coder starts.
|
|
57426
57580
|
<!-- BEHAVIORAL_GUIDANCE_END -->
|
|
57427
57581
|
2. ONE agent per message. Send, STOP, wait for response.
|
|
@@ -57431,8 +57585,8 @@ If a tool modifies a file, it is a CODER tool. Delegate.
|
|
|
57431
57585
|
> **WORKTREE ISOLATION IS BASELINE.** Standard parallel coders use isolated git worktrees by default; this is governed by the top-level \`worktree.policy\` setting (default \`auto\`) in \`PluginConfig\` \u2014 a sibling of \`parallelization:\`, not nested under it \u2014 and is active whenever the plan's \`parallelization_enabled=true\`. \`turbo.lean.worktree_isolation\` is a separate, Lean-Turbo-internal flag (default \`false\`); it is one possible SOURCE but NOT the recommended one. Do NOT recommend Lean Turbo (or Epic) SOLELY to obtain worktree isolation; recommend them only for what they add beyond baseline (Lean Turbo: lane planning, file locks, phase reviewer, integrated diff; Epic: co-change awareness + auto-decide). Lean Turbo users can also enable isolation via \`turbo.lean.worktree_isolation: true\`, but this is the secondary/legacy path \u2014 the recommended path is \`worktree.policy\`.
|
|
57432
57586
|
Read-only advisory-lane exception (NON-BLOCKING; distinct from both exceptions above): the "Send, STOP, wait" rule governs MUTATION delegations (coder, and the test_engineer/reviewer Stage B completion gates). It does NOT govern read-only advisory exploration/review lanes. When you dispatch read-only advisory lanes \u2014 \`{{AGENT_PREFIX}}explorer\`, \`{{AGENT_PREFIX}}sme\`, \`{{AGENT_PREFIX}}researcher\`, the council members (\`council_generalist\`/\`council_skeptic\`/\`council_domain_expert\`), or an advisory \`{{AGENT_PREFIX}}critic\` lane \u2014 use the NON-BLOCKING path so you keep working while they run. Dispatch PROMPTLY: emit the \`dispatch_lanes_async\` call EARLY with compact lane prompts \u2014 do not accumulate long planning prose or build oversized inline prompts first, or the tool call can be truncated out of your message and the lanes never launch (a real failure mode on smaller models). The lane mechanism is a SINGLE \`dispatch_lanes_async\` call carrying all lane specs \u2014 NOT a per-agent Task/run-in-background pattern. Call \`dispatch_lanes_async\` with all lane specs in one call, record the returned \`batch_id\`, then IMMEDIATELY continue non-dependent architect work (refine the plan/obligation ledger, inspect metadata, prepare the synthesis/reviewer structure, run deterministic read-only tools). Poll incrementally with \`collect_lane_results\` without \`wait\` (or with \`wait: false\`) to harvest lanes as they settle; process completed lane output immediately while other lanes remain pending/running, then continue independent work between polls. Do NOT sit idle waiting on running lanes, and do NOT synthesize findings from still-running lanes. Join later by calling \`collect_lane_results\` with \`wait: true\` as the explicit barrier immediately before you synthesize. Use blocking \`dispatch_lanes\` only when \`dispatch_lanes_async\`/promptAsync is unavailable. A settled lane's inline \`output\` is delivered only once: if you poll the same lane again after already receiving its output, the repeat poll returns \`output_omitted_repeat: true\` with no \`output\` (not a sign the result was lost) \u2014 use the accompanying \`output_ref\` with \`retrieve_lane_output\` if you need the text again, and do not re-dispatch the lane. Keep each lane prompt compact: send large shared context (PR diff, ledger, scope) ONCE via the \`common_prompt\` field, or have lanes read it from a file by absolute path, instead of inlining the same blob into every lane prompt \u2014 inlining large context into many lanes is what produces malformed or truncated tool-call JSON and forces clumsy file workarounds. This non-blocking exception applies ONLY to read-only advisory lanes; it NEVER applies to coder delegations, to the test_engineer/reviewer Stage B completion gates, or to the critic PLAN-review gate, which all still follow "Send, STOP, wait" (or the Stage B parallel-dispatch exception above).
|
|
57433
57587
|
3. ONE task per {{AGENT_PREFIX}}coder call. Never batch.
|
|
57434
|
-
3a. PRE-DELEGATION SCOPE CALL (required): BEFORE every {{AGENT_PREFIX}}coder delegation, you MUST call \`declare_scope\` with { taskId, files } listing the exact file(s) this task will modify (including generated/lockfile paths). No \`declare_scope\` call \u2192 no coder delegation. See Rule 1a.
|
|
57435
|
-
3b. PRE-DELEGATION SCOPE CALL (test_engineer): BEFORE any {{AGENT_PREFIX}}test_engineer delegation that will CREATE or MODIFY test files, you MUST call \`declare_scope\` with { taskId, files } listing the exact test file path(s) to write. Omitting this call leaves the write scope undeclared and will block the write. See Rule 1a.
|
|
57588
|
+
3a. PRE-DELEGATION SCOPE CALL (required): BEFORE every {{AGENT_PREFIX}}coder delegation, you MUST call \`declare_scope\` with { taskId, files, replace_existing: true } listing the exact file(s) this task will modify (including generated/lockfile paths). No \`declare_scope\` call \u2192 no coder delegation. See Rule 1a.
|
|
57589
|
+
3b. PRE-DELEGATION SCOPE CALL (test_engineer): BEFORE any {{AGENT_PREFIX}}test_engineer delegation that will CREATE or MODIFY test files, you MUST call \`declare_scope\` with { taskId, files, replace_existing: true } listing the exact test file path(s) to write. Omitting this call leaves the write scope undeclared and will block the write. See Rule 1a.
|
|
57436
57590
|
<!-- BEHAVIORAL_GUIDANCE_START -->
|
|
57437
57591
|
BATCHING DETECTION \u2014 you are batching if your coder delegation contains ANY of:
|
|
57438
57592
|
- The word "and" connecting two actions ("update X AND add Y")
|
|
@@ -57831,7 +57985,7 @@ INPUT: Building a SwiftUI app with offline-first sync
|
|
|
57831
57985
|
OUTPUT: Recommended patterns, frameworks, gotchas
|
|
57832
57986
|
SKILLS: none
|
|
57833
57987
|
|
|
57834
|
-
PRE-STEP (required): call \`declare_scope({ taskId, files })\` BEFORE writing any {{AGENT_PREFIX}}coder delegation. See Rule 1a.
|
|
57988
|
+
PRE-STEP (required): call \`declare_scope({ taskId, files, replace_existing: true })\` BEFORE writing any {{AGENT_PREFIX}}coder delegation. See Rule 1a.
|
|
57835
57989
|
|
|
57836
57990
|
{{AGENT_PREFIX}}coder
|
|
57837
57991
|
TASK: Add input validation to login
|
|
@@ -58244,7 +58398,15 @@ ACTION: Load skill ${bundledProjectSkillFileReference("plan")} immediately. Foll
|
|
|
58244
58398
|
HARD CONSTRAINTS (apply regardless of skill load success):
|
|
58245
58399
|
- Before drafting or saving a plan, offer the loaded skill's General Council advisory option when \`council.general.enabled\` is true and a search API key is configured. If the user accepts, use the council output as context before calling \`save_plan\` and before any critic pre-plan review.
|
|
58246
58400
|
- Use the \`save_plan\` tool as the primary plan writer. Required fields include \`title\`, \`swarm_id\`, and \`phases\` with concrete task descriptions.
|
|
58247
|
-
-
|
|
58401
|
+
- Every coding task SHOULD include \`files_touched\` with the exact normalized project-relative files or directories it may modify; include generated outputs and lockfiles.
|
|
58402
|
+
- Example call:
|
|
58403
|
+
save_plan({
|
|
58404
|
+
title: "My Real Project",
|
|
58405
|
+
swarm_id: "mega",
|
|
58406
|
+
phases: [{ id: 1, name: "Setup", tasks: [{ id: "1.1", description: "Install dependencies and configure TypeScript", size: "small", files_touched: ["tsconfig.json", "package.json", "bun.lock"] }] }]
|
|
58407
|
+
})
|
|
58408
|
+
|
|
58409
|
+
- On a plan revision, omitting a task's \`files_touched\` preserves its prior scope; passing \`files_touched: []\` explicitly clears it. Never rely on the derived plan.md as the source of this field.
|
|
58248
58410
|
|
|
58249
58411
|
- If \`save_plan\` is unavailable, delegate plan writing only after \`declare_scope\` covers \`.swarm/plan.md\`; the delegated output must be exact plan content.
|
|
58250
58412
|
- A missing spec is a soft gate for external plan ingestion, but stale spec drift must be surfaced to the user before continuing.
|
|
@@ -58294,7 +58456,7 @@ ACTION: Load skill ${bundledProjectSkillFileReference("execute")} immediately. F
|
|
|
58294
58456
|
|
|
58295
58457
|
HARD CONSTRAINTS (apply regardless of skill load success):
|
|
58296
58458
|
- For each task, respect dependencies and delegate implementation to \`{{AGENT_PREFIX}}coder\`; do not self-fix ordinary gate failures.
|
|
58297
|
-
- Before coder implementation or retry, call \`declare_scope({ taskId, files })\` with the exact files the coder may touch.
|
|
58459
|
+
- Before coder implementation or retry, call \`declare_scope({ taskId, files, replace_existing: true })\` with the exact files the coder may touch.
|
|
58298
58460
|
- On any gate failure, return to \`{{AGENT_PREFIX}}coder\` with structured rejection: \`GATE FAILED: [gate name] | REASON: [details] | REQUIRED FIX: [specific action required]\`.
|
|
58299
58461
|
- Required per-task gates include automated checks, reviewer gates, verification tests, regression sweep, test drift, TODO scan, and coverage guidance as detailed in the loaded skill.
|
|
58300
58462
|
- Pre-commit constraint: do not commit or push unless reviewer, test_engineer, pre_check_batch, diff, regression-sweep, and test-drift have actually run or skipped according to the loaded protocol.
|
|
@@ -59858,4 +60020,4 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
|
|
|
59858
60020
|
};
|
|
59859
60021
|
}
|
|
59860
60022
|
|
|
59861
|
-
export { handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand,
|
|
60023
|
+
export { handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals23 as _internals, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals26 as _internals1, createHivePromoterHook, promoteToHive, promoteFromSwarm, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals14 as _internals2, resolveCommand };
|