opencode-swarm 7.138.3 → 7.139.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/.opencode/skills/execute/SKILL.md +11 -2
- package/.opencode/skills/swarm-implement/SKILL.md +1 -1
- package/dist/cli/{config-doctor-2mwgdbsn.js → config-doctor-aszp7z1h.js} +2 -2
- package/dist/cli/{core-v6bte964.js → core-3s832mxx.js} +1 -1
- package/dist/cli/{curation-policy-5dqexw5j.js → curation-policy-a3hs73f7.js} +6 -6
- package/dist/cli/{curator-llm-factory-wkjme59b.js → curator-llm-factory-e8ngwyjm.js} +26 -25
- package/dist/cli/{curator-jjtp9hn2.js → curator-zxjqcc8r.js} +26 -25
- package/dist/cli/{evidence-summary-service-6cttrkzw.js → evidence-summary-service-qfhjfxdz.js} +7 -7
- package/dist/cli/{gate-evidence-ecx4djaw.js → gate-evidence-m2grv70v.js} +4 -4
- package/dist/cli/{guardrail-explain-xppwfnxr.js → guardrail-explain-rqpmzxyy.js} +27 -26
- package/dist/cli/{guardrail-log-swet7rch.js → guardrail-log-vd4a0ng5.js} +4 -3
- package/dist/cli/{hive-promoter-xvq8jzbs.js → hive-promoter-jc5vym27.js} +26 -25
- package/dist/cli/{index-tc61fybd.js → index-0tsetsxs.js} +4 -4
- package/dist/cli/{index-jhb8kjc5.js → index-3nr2sn32.js} +3 -3
- package/dist/cli/{index-y06a43sk.js → index-4ft523nb.js} +323 -80
- package/dist/cli/index-556ja8an.js +62 -0
- package/dist/cli/{index-31vfewmn.js → index-5bkpyvdf.js} +271 -94
- package/dist/cli/{index-wqg74mwj.js → index-67yqywan.js} +2 -2
- package/dist/cli/{index-gda7cwqz.js → index-6q240xgm.js} +30 -68
- package/dist/cli/{index-adde7nm2.js → index-84s6x604.js} +5 -5
- package/dist/cli/{index-j0xx9wpj.js → index-85hstja2.js} +1 -1
- package/dist/cli/{index-xybtaph7.js → index-a614s16f.js} +1 -1
- package/dist/cli/{index-10mz5js6.js → index-chvqee1j.js} +2 -2
- package/dist/cli/{index-rrxcfxrd.js → index-ddmnhv4h.js} +1 -1
- package/dist/cli/{index-1v89yst3.js → index-gytyqv1d.js} +2 -2
- package/dist/cli/{index-93ky909v.js → index-kv36s0x0.js} +3 -3
- package/dist/cli/{index-z7jgvm9b.js → index-nbgw5dxa.js} +1 -1
- package/dist/cli/{index-tqshdzaw.js → index-nc544sfw.js} +1 -1
- package/dist/cli/{index-js7th5my.js → index-nsnfvckc.js} +1 -1
- package/dist/cli/{index-4fmztnrq.js → index-p2dz85tv.js} +2 -2
- package/dist/cli/{index-y6dvs5tt.js → index-q3qtgtd0.js} +1 -1
- package/dist/cli/{index-99af5gvd.js → index-r3pth9a7.js} +230 -118
- package/dist/cli/{index-ab57h0yq.js → index-rtetrxxq.js} +1 -1
- package/dist/cli/{index-rjratees.js → index-s428dmy6.js} +2 -2
- package/dist/cli/{index-q344kj84.js → index-t26nfmcs.js} +1 -1
- package/dist/cli/{index-1djv5684.js → index-t31cc7kv.js} +6 -6
- package/dist/cli/{index-39k6y018.js → index-tcdcj1g2.js} +2 -2
- package/dist/cli/{index-en4fb04r.js → index-tyh0p5e8.js} +1 -1
- package/dist/cli/{index-xgmx9had.js → index-y46anh5e.js} +28 -27
- package/dist/cli/index-ymszzvnr.js +1725 -0
- package/dist/cli/{index-ngqxzkqm.js → index-z1tkxzq4.js} +2 -2
- package/dist/cli/{index-btx8j39p.js → index-zd15ya1w.js} +1 -1
- package/dist/cli/index.js +26 -25
- package/dist/cli/{knowledge-escalator-7n384ys1.js → knowledge-escalator-6473ey4c.js} +7 -7
- package/dist/cli/{knowledge-events-yaj0yjd6.js → knowledge-events-wwzpz8m4.js} +5 -5
- package/dist/cli/{knowledge-link-xc6yhxmz.js → knowledge-link-trfydkzm.js} +4 -4
- package/dist/cli/{knowledge-store-d99k0z2d.js → knowledge-store-99gd42jy.js} +5 -5
- package/dist/cli/{knowledge-validator-e5fqy9h4.js → knowledge-validator-v2eevvdg.js} +8 -8
- package/dist/cli/{pending-delegations-7dbc0j2a.js → pending-delegations-p6n83x67.js} +3 -3
- package/dist/cli/{pr-subscriptions-m943zn6g.js → pr-subscriptions-xbrfr51c.js} +3 -3
- package/dist/cli/{runner-x1hy047y.js → runner-9an52tmz.js} +5 -5
- package/dist/cli/{scan-cursor-9y9msabt.js → scan-cursor-39zxpw34.js} +6 -6
- package/dist/cli/{schema-xg5f11md.js → schema-xhfwr6b2.js} +1 -1
- package/dist/cli/scope-persistence-nsa6ra9s.js +61 -0
- package/dist/cli/{skill-generator-arvwfdfh.js → skill-generator-5px81476.js} +9 -9
- package/dist/cli/{telemetry-0yqed3jv.js → telemetry-7nt7zhyp.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-hjrt5hx2.js → worktree-collision-ownership-9x4s4890.js} +3 -3
- 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 +533 -522
- package/dist/plan/manager.d.ts +2 -0
- 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/services/run-memory.d.ts +53 -5
- package/dist/tools/declare-scope.d.ts +3 -1
- package/dist/tools/save-plan.d.ts +2 -0
- package/dist/tools/update-task-status.d.ts +2 -0
- package/dist/turbo/lean/lane-scope.d.ts +1 -1
- package/dist/utils/path-security.d.ts +25 -1
- package/package.json +1 -1
- package/dist/cli/index-2y4jy0de.js +0 -642
- package/dist/cli/scope-persistence-n1bryhzf.js +0 -38
|
@@ -13,22 +13,24 @@ import {
|
|
|
13
13
|
resolveExecutableFromPath,
|
|
14
14
|
runEvaluation,
|
|
15
15
|
runExternalTool
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-ddmnhv4h.js";
|
|
17
17
|
import {
|
|
18
18
|
stableCanonicalStringify
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-5bkpyvdf.js";
|
|
20
20
|
import {
|
|
21
21
|
detectStraySwarmDirs,
|
|
22
22
|
readDoctorArtifact,
|
|
23
23
|
removeStraySwarmDir,
|
|
24
24
|
runConfigDoctor
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-zd15ya1w.js";
|
|
26
26
|
import {
|
|
27
27
|
MAX_TRANSIENT_RETRIES,
|
|
28
28
|
archiveEvidence,
|
|
29
29
|
checkRequirementCoverage,
|
|
30
30
|
closePlanTerminalState,
|
|
31
31
|
computeSpecHash,
|
|
32
|
+
containsControlChars,
|
|
33
|
+
containsPathTraversal,
|
|
32
34
|
derivePlanMarkdown,
|
|
33
35
|
disableEpicMode,
|
|
34
36
|
enableEpicMode,
|
|
@@ -59,7 +61,7 @@ import {
|
|
|
59
61
|
savePlan,
|
|
60
62
|
transientBackoff,
|
|
61
63
|
validateProjectRoot
|
|
62
|
-
} from "./index-
|
|
64
|
+
} from "./index-4ft523nb.js";
|
|
63
65
|
import {
|
|
64
66
|
EvaluationTaskV1Schema,
|
|
65
67
|
GateAuditManifestV1Schema,
|
|
@@ -76,7 +78,7 @@ import {
|
|
|
76
78
|
saveGateAuditResult,
|
|
77
79
|
savePromotionDecision,
|
|
78
80
|
saveTaskSetSnapshot
|
|
79
|
-
} from "./index-
|
|
81
|
+
} from "./index-z1tkxzq4.js";
|
|
80
82
|
import {
|
|
81
83
|
canonicalHash,
|
|
82
84
|
canonicalJson,
|
|
@@ -114,15 +116,15 @@ import {
|
|
|
114
116
|
retireSkill,
|
|
115
117
|
selectCandidateEntries,
|
|
116
118
|
syncBundledProjectSkillsIfMissingAsync
|
|
117
|
-
} from "./index-
|
|
119
|
+
} from "./index-3nr2sn32.js";
|
|
118
120
|
import {
|
|
119
121
|
readRecentEscalations
|
|
120
|
-
} from "./index-
|
|
122
|
+
} from "./index-84s6x604.js";
|
|
121
123
|
import {
|
|
122
124
|
alreadyCuratedThisGeneration,
|
|
123
125
|
claimNextScanBatch,
|
|
124
126
|
resolveCohortId
|
|
125
|
-
} from "./index-
|
|
127
|
+
} from "./index-s428dmy6.js";
|
|
126
128
|
import {
|
|
127
129
|
CURATOR_INIT_PROMPT,
|
|
128
130
|
CURATOR_PHASE_PROMPT,
|
|
@@ -175,11 +177,11 @@ import {
|
|
|
175
177
|
validateActionableFields,
|
|
176
178
|
validateLesson,
|
|
177
179
|
validateSkillPath
|
|
178
|
-
} from "./index-
|
|
180
|
+
} from "./index-0tsetsxs.js";
|
|
179
181
|
import {
|
|
180
182
|
authorizeCuration,
|
|
181
183
|
buildConfigFingerprintInput
|
|
182
|
-
} from "./index-
|
|
184
|
+
} from "./index-67yqywan.js";
|
|
183
185
|
import {
|
|
184
186
|
cohortConfigFingerprint
|
|
185
187
|
} from "./index-rtry5xyf.js";
|
|
@@ -212,7 +214,7 @@ import {
|
|
|
212
214
|
transactFile,
|
|
213
215
|
transactKnowledge,
|
|
214
216
|
wordBigrams
|
|
215
|
-
} from "./index-
|
|
217
|
+
} from "./index-t31cc7kv.js";
|
|
216
218
|
import {
|
|
217
219
|
MAX_EVENT_LOG_ENTRIES,
|
|
218
220
|
_internals,
|
|
@@ -222,7 +224,7 @@ import {
|
|
|
222
224
|
recordHiveKnowledgeEvent,
|
|
223
225
|
recordKnowledgeEvent,
|
|
224
226
|
resolveKnowledgeEventsPath
|
|
225
|
-
} from "./index-
|
|
227
|
+
} from "./index-kv36s0x0.js";
|
|
226
228
|
import {
|
|
227
229
|
resolveHiveDataDir,
|
|
228
230
|
resolveHiveEventsPath,
|
|
@@ -238,16 +240,16 @@ import {
|
|
|
238
240
|
resolveLinkDir,
|
|
239
241
|
sanitizeLinkId,
|
|
240
242
|
writeLinkPointer
|
|
241
|
-
} from "./index-
|
|
243
|
+
} from "./index-tyh0p5e8.js";
|
|
242
244
|
import {
|
|
243
245
|
atomicWriteFile
|
|
244
|
-
} from "./index-
|
|
246
|
+
} from "./index-nc544sfw.js";
|
|
245
247
|
import {
|
|
246
248
|
exports_loader,
|
|
247
249
|
init_loader,
|
|
248
250
|
loadPluginConfig,
|
|
249
251
|
loadPluginConfigWithMeta
|
|
250
|
-
} from "./index-
|
|
252
|
+
} from "./index-q3qtgtd0.js";
|
|
251
253
|
import {
|
|
252
254
|
RetrospectiveEvidenceSchema
|
|
253
255
|
} from "./index-gprxjmm7.js";
|
|
@@ -263,7 +265,7 @@ import {
|
|
|
263
265
|
package_default,
|
|
264
266
|
resolveAutoReviewConfig,
|
|
265
267
|
stripKnownSwarmPrefix
|
|
266
|
-
} from "./index-
|
|
268
|
+
} from "./index-rtetrxxq.js";
|
|
267
269
|
import {
|
|
268
270
|
KNOWLEDGE_SCHEMA_VERSION,
|
|
269
271
|
OUTCOME_BLOCK_THRESHOLD,
|
|
@@ -279,13 +281,13 @@ import {
|
|
|
279
281
|
listActive,
|
|
280
282
|
subscribe,
|
|
281
283
|
unsubscribe
|
|
282
|
-
} from "./index-
|
|
284
|
+
} from "./index-nbgw5dxa.js";
|
|
283
285
|
import {
|
|
284
286
|
MAX_PENDING_SCOPE_BINDINGS,
|
|
285
287
|
clearAllScopes,
|
|
286
288
|
clearScopeBindingFromDisk,
|
|
287
289
|
clearScopeBindings
|
|
288
|
-
} from "./index-
|
|
290
|
+
} from "./index-ymszzvnr.js";
|
|
289
291
|
import {
|
|
290
292
|
appendLedgerEvent,
|
|
291
293
|
computePlanHash,
|
|
@@ -293,7 +295,7 @@ import {
|
|
|
293
295
|
derivePlanId,
|
|
294
296
|
initLedger,
|
|
295
297
|
takeSnapshotEvent
|
|
296
|
-
} from "./index-
|
|
298
|
+
} from "./index-p2dz85tv.js";
|
|
297
299
|
import {
|
|
298
300
|
PlanSchema
|
|
299
301
|
} from "./index-1kz6da87.js";
|
|
@@ -320,7 +322,7 @@ import {
|
|
|
320
322
|
import {
|
|
321
323
|
findByBatchId,
|
|
322
324
|
readDelegations
|
|
323
|
-
} from "./index-
|
|
325
|
+
} from "./index-t26nfmcs.js";
|
|
324
326
|
import {
|
|
325
327
|
readSwarmFileAsync,
|
|
326
328
|
safeHook,
|
|
@@ -329,7 +331,7 @@ import {
|
|
|
329
331
|
import {
|
|
330
332
|
tryAcquireLock,
|
|
331
333
|
withEvidenceLock
|
|
332
|
-
} from "./index-
|
|
334
|
+
} from "./index-a614s16f.js";
|
|
333
335
|
import {
|
|
334
336
|
require_proper_lockfile
|
|
335
337
|
} from "./index-7g4c7s5r.js";
|
|
@@ -337,7 +339,7 @@ import {
|
|
|
337
339
|
emit,
|
|
338
340
|
getLastHeartbeat,
|
|
339
341
|
telemetry
|
|
340
|
-
} from "./index-
|
|
342
|
+
} from "./index-chvqee1j.js";
|
|
341
343
|
import {
|
|
342
344
|
exports_external,
|
|
343
345
|
init_zod
|
|
@@ -5714,8 +5716,7 @@ function resetSwarmState() {
|
|
|
5714
5716
|
for (const binding of clearScopeBindings()) {
|
|
5715
5717
|
clearScopeBindingFromDisk({
|
|
5716
5718
|
directory: binding.workspaceIdentity,
|
|
5717
|
-
|
|
5718
|
-
ownerSessionId: binding.ownerSessionId
|
|
5719
|
+
binding
|
|
5719
5720
|
});
|
|
5720
5721
|
}
|
|
5721
5722
|
resetStandardWorktreeIsolationState();
|
|
@@ -5907,8 +5908,7 @@ function endAgentSession(sessionId) {
|
|
|
5907
5908
|
for (const binding of removedBindings) {
|
|
5908
5909
|
clearScopeBindingFromDisk({
|
|
5909
5910
|
directory: binding.workspaceIdentity,
|
|
5910
|
-
|
|
5911
|
-
ownerSessionId: binding.ownerSessionId
|
|
5911
|
+
binding
|
|
5912
5912
|
});
|
|
5913
5913
|
}
|
|
5914
5914
|
swarmState.agentSessions.delete(sessionId);
|
|
@@ -6523,7 +6523,7 @@ function hasActiveEpicMode(sessionID) {
|
|
|
6523
6523
|
async function rehydratePrSubscriptions(sessionID, directory) {
|
|
6524
6524
|
const map = new Map;
|
|
6525
6525
|
try {
|
|
6526
|
-
const { listActive: listActive2 } = await import("./pr-subscriptions-
|
|
6526
|
+
const { listActive: listActive2 } = await import("./pr-subscriptions-xbrfr51c.js");
|
|
6527
6527
|
const records = await listActive2(directory);
|
|
6528
6528
|
for (const record of records) {
|
|
6529
6529
|
if (record.sessionID !== sessionID)
|
|
@@ -11396,6 +11396,14 @@ async function buildRetrievalRecency(provider, nowMs) {
|
|
|
11396
11396
|
// src/hooks/guardrails/index.ts
|
|
11397
11397
|
init_constants();
|
|
11398
11398
|
init_schema();
|
|
11399
|
+
init_executor();
|
|
11400
|
+
|
|
11401
|
+
// src/scope/scope-lease-renewal.ts
|
|
11402
|
+
var MAX_HASH_BYTES = 4 * 1024 * 1024;
|
|
11403
|
+
var MAX_AGGREGATE_HASH_BYTES = 8 * 1024 * 1024;
|
|
11404
|
+
var CANDIDATE_TTL_MS = 10 * 60 * 1000;
|
|
11405
|
+
|
|
11406
|
+
// src/hooks/guardrails/index.ts
|
|
11399
11407
|
init_logger();
|
|
11400
11408
|
|
|
11401
11409
|
// src/utils/provider-error-classification.ts
|
|
@@ -11497,7 +11505,6 @@ import * as path17 from "path";
|
|
|
11497
11505
|
var DC_MAX_UNWRAP_DEPTH = 5;
|
|
11498
11506
|
var DC_SAFE_TARGETS = new Set([
|
|
11499
11507
|
"node_modules",
|
|
11500
|
-
".git",
|
|
11501
11508
|
"dist",
|
|
11502
11509
|
"build",
|
|
11503
11510
|
"coverage",
|
|
@@ -11662,6 +11669,30 @@ function dcSplitSegments(cmd) {
|
|
|
11662
11669
|
segments.push(current.trim());
|
|
11663
11670
|
return segments.filter((s) => s.length > 0);
|
|
11664
11671
|
}
|
|
11672
|
+
function dcExtractRecursiveRmTargets(segment) {
|
|
11673
|
+
const tokens = segment.match(/"(?:[^"\\]|\\.)*"|'[^']*'|\S+/g) ?? [];
|
|
11674
|
+
if (tokens.length < 2 || tokens[0] !== "rm")
|
|
11675
|
+
return null;
|
|
11676
|
+
let destructive = false;
|
|
11677
|
+
let index = 1;
|
|
11678
|
+
for (;index < tokens.length; index++) {
|
|
11679
|
+
const token = tokens[index];
|
|
11680
|
+
if (token === "--") {
|
|
11681
|
+
index++;
|
|
11682
|
+
break;
|
|
11683
|
+
}
|
|
11684
|
+
if (!token.startsWith("-") || token === "-")
|
|
11685
|
+
break;
|
|
11686
|
+
if (token === "--recursive" || token === "--force")
|
|
11687
|
+
destructive = true;
|
|
11688
|
+
if (!token.startsWith("--") && /[rRfF]/.test(token.slice(1))) {
|
|
11689
|
+
destructive = true;
|
|
11690
|
+
}
|
|
11691
|
+
}
|
|
11692
|
+
if (!destructive)
|
|
11693
|
+
return null;
|
|
11694
|
+
return tokens.slice(index).map((target) => target.replace(/^(["'])|(["'])$/g, ""));
|
|
11695
|
+
}
|
|
11665
11696
|
function dcHasUnresolvableVars(p) {
|
|
11666
11697
|
return /(%[A-Za-z_][A-Za-z0-9_]*%|\$\{?[A-Za-z_]|\$env:)/i.test(p);
|
|
11667
11698
|
}
|
|
@@ -11674,13 +11705,15 @@ function dcLstatAncestorWalk(targetPath, cwd) {
|
|
|
11674
11705
|
const ancestors = [];
|
|
11675
11706
|
let current = normalizedTarget;
|
|
11676
11707
|
while (true) {
|
|
11708
|
+
const rel = path17.relative(normalizedCwd, current);
|
|
11709
|
+
if (rel === ".." || rel.startsWith(`..${path17.sep}`) || path17.isAbsolute(rel))
|
|
11710
|
+
break;
|
|
11677
11711
|
ancestors.push(current);
|
|
11712
|
+
if (rel === "")
|
|
11713
|
+
break;
|
|
11678
11714
|
const parent = path17.dirname(current);
|
|
11679
11715
|
if (parent === current)
|
|
11680
11716
|
break;
|
|
11681
|
-
const rel = path17.relative(normalizedCwd, current);
|
|
11682
|
-
if (rel === "" || rel.startsWith(".."))
|
|
11683
|
-
break;
|
|
11684
11717
|
current = parent;
|
|
11685
11718
|
}
|
|
11686
11719
|
for (const ancestor of ancestors) {
|
|
@@ -11690,7 +11723,7 @@ function dcLstatAncestorWalk(targetPath, cwd) {
|
|
|
11690
11723
|
} catch (err) {
|
|
11691
11724
|
const code = err.code;
|
|
11692
11725
|
if (code === "ENOENT") {
|
|
11693
|
-
|
|
11726
|
+
continue;
|
|
11694
11727
|
}
|
|
11695
11728
|
return `lstat failed on "${ancestor}": ${String(err)} \u2014 refusing to allow destructive operation on unverifiable path`;
|
|
11696
11729
|
}
|
|
@@ -11714,11 +11747,12 @@ function dcValidateTargets(targets, cwd) {
|
|
|
11714
11747
|
if (/^\\\\/.test(t)) {
|
|
11715
11748
|
return `BLOCKED: Destructive command targets UNC path "${t}" \u2014 UNC paths in destructive operations are not allowed.`;
|
|
11716
11749
|
}
|
|
11717
|
-
const
|
|
11750
|
+
const filesystemTarget = t.replace(/[\\/]+/g, path17.sep);
|
|
11751
|
+
const lstatBlock = dcLstatAncestorWalk(filesystemTarget, cwd);
|
|
11718
11752
|
if (lstatBlock)
|
|
11719
11753
|
return lstatBlock;
|
|
11720
|
-
const basename3 = path17.basename(
|
|
11721
|
-
if (t ===
|
|
11754
|
+
const basename3 = path17.basename(filesystemTarget);
|
|
11755
|
+
if (dcPathComponents(t).length === 1 && DC_SAFE_TARGETS.has(basename3)) {
|
|
11722
11756
|
continue;
|
|
11723
11757
|
}
|
|
11724
11758
|
if (DC_FS_ROOTS.has(t) || DC_FS_ROOTS.has(t.replace(/\//g, "\\"))) {
|
|
@@ -11734,6 +11768,111 @@ function dcValidateTargets(targets, cwd) {
|
|
|
11734
11768
|
}
|
|
11735
11769
|
return null;
|
|
11736
11770
|
}
|
|
11771
|
+
function dcIsUntrustedCodePoint(codePoint) {
|
|
11772
|
+
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297;
|
|
11773
|
+
}
|
|
11774
|
+
function dcHasUntrustedText(value) {
|
|
11775
|
+
return Array.from(value).some((character) => dcIsUntrustedCodePoint(character.codePointAt(0) ?? 0));
|
|
11776
|
+
}
|
|
11777
|
+
function dcSafeDiagnosticValue(value) {
|
|
11778
|
+
return value.split("").map((character) => dcIsUntrustedCodePoint(character.codePointAt(0) ?? 0) ? "?" : character).join("").slice(0, 512);
|
|
11779
|
+
}
|
|
11780
|
+
function dcPathComponents(value) {
|
|
11781
|
+
return value.replace(/\\/g, "/").split("/").filter(Boolean);
|
|
11782
|
+
}
|
|
11783
|
+
function dcComponentEquals(left, right) {
|
|
11784
|
+
return process.platform === "win32" ? left.toLowerCase() === right.toLowerCase() : left === right;
|
|
11785
|
+
}
|
|
11786
|
+
function dcScopeContains(scopeEntry, target) {
|
|
11787
|
+
const normalize3 = (value) => {
|
|
11788
|
+
const normalized = path17.posix.normalize(value.replace(/\\/g, "/")).replace(/^\.\//, "").replace(/\/$/, "");
|
|
11789
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
11790
|
+
};
|
|
11791
|
+
const scope = normalize3(scopeEntry);
|
|
11792
|
+
const candidate = normalize3(target);
|
|
11793
|
+
return candidate === scope || candidate.startsWith(`${scope}/`);
|
|
11794
|
+
}
|
|
11795
|
+
function dcEvaluateRecursiveDeleteTargets(input) {
|
|
11796
|
+
if (input.targets.length === 0) {
|
|
11797
|
+
return {
|
|
11798
|
+
allowed: false,
|
|
11799
|
+
code: "DESTRUCTIVE_TARGET_INVALID",
|
|
11800
|
+
reason: "BLOCKED: Recursive delete has no statically verifiable target."
|
|
11801
|
+
};
|
|
11802
|
+
}
|
|
11803
|
+
const commonBlock = dcValidateTargets(input.targets, input.cwd);
|
|
11804
|
+
if (commonBlock) {
|
|
11805
|
+
return {
|
|
11806
|
+
allowed: false,
|
|
11807
|
+
code: "DESTRUCTIVE_TARGET_INVALID",
|
|
11808
|
+
reason: commonBlock
|
|
11809
|
+
};
|
|
11810
|
+
}
|
|
11811
|
+
const normalizedTargets = [];
|
|
11812
|
+
let hasNested = false;
|
|
11813
|
+
for (const raw of input.targets) {
|
|
11814
|
+
const target = raw.trim().replace(/^['"]|['"]$/g, "");
|
|
11815
|
+
const safeTarget = dcSafeDiagnosticValue(target);
|
|
11816
|
+
if (!target || target === "." || dcHasUntrustedText(target) || dcPathComponents(target).includes("..")) {
|
|
11817
|
+
return {
|
|
11818
|
+
allowed: false,
|
|
11819
|
+
code: "DESTRUCTIVE_TARGET_INVALID",
|
|
11820
|
+
reason: `BLOCKED: Recursive delete target "${safeTarget}" is empty, the workspace root, contains traversal, or contains control characters.`
|
|
11821
|
+
};
|
|
11822
|
+
}
|
|
11823
|
+
const components = dcPathComponents(target);
|
|
11824
|
+
if (components.some((component) => dcComponentEquals(component, ".git") || dcComponentEquals(component, ".swarm"))) {
|
|
11825
|
+
return {
|
|
11826
|
+
allowed: false,
|
|
11827
|
+
code: "DESTRUCTIVE_TARGET_PROTECTED",
|
|
11828
|
+
reason: `BLOCKED: Recursive delete target "${safeTarget}" contains protected .git or .swarm state.`
|
|
11829
|
+
};
|
|
11830
|
+
}
|
|
11831
|
+
const filesystemTarget = target.replace(/[\\/]+/g, path17.sep);
|
|
11832
|
+
const resolved = path17.resolve(input.cwd, filesystemTarget);
|
|
11833
|
+
const relative3 = path17.relative(path17.resolve(input.cwd), resolved);
|
|
11834
|
+
if (relative3 === "" || relative3 === ".." || relative3.startsWith(`..${path17.sep}`) || path17.isAbsolute(relative3)) {
|
|
11835
|
+
return {
|
|
11836
|
+
allowed: false,
|
|
11837
|
+
code: "DESTRUCTIVE_TARGET_OUTSIDE_WORKSPACE",
|
|
11838
|
+
reason: `BLOCKED: Recursive delete target "${safeTarget}" is not strictly contained by the workspace.`
|
|
11839
|
+
};
|
|
11840
|
+
}
|
|
11841
|
+
const basename3 = path17.basename(resolved);
|
|
11842
|
+
if (!DC_SAFE_TARGETS.has(basename3)) {
|
|
11843
|
+
return {
|
|
11844
|
+
allowed: false,
|
|
11845
|
+
code: "DESTRUCTIVE_TARGET_NOT_SAFE_ARTIFACT",
|
|
11846
|
+
reason: `BLOCKED: Recursive delete target "${safeTarget}" is not an allowlisted build/cache artifact.`
|
|
11847
|
+
};
|
|
11848
|
+
}
|
|
11849
|
+
const normalizedRelative = relative3.replace(/\\/g, "/");
|
|
11850
|
+
const isBare = components.length === 1;
|
|
11851
|
+
if (!isBare) {
|
|
11852
|
+
hasNested = true;
|
|
11853
|
+
if (!input.verifiedScope?.bindingId || !input.verifiedScope.generationId) {
|
|
11854
|
+
return {
|
|
11855
|
+
allowed: false,
|
|
11856
|
+
code: "DESTRUCTIVE_TARGET_SCOPE_REQUIRED",
|
|
11857
|
+
reason: `BLOCKED: Nested safe artifact "${safeTarget}" requires a verified active coder scope binding.`
|
|
11858
|
+
};
|
|
11859
|
+
}
|
|
11860
|
+
if (!input.verifiedScope.files.some((entry) => dcScopeContains(entry, normalizedRelative))) {
|
|
11861
|
+
return {
|
|
11862
|
+
allowed: false,
|
|
11863
|
+
code: "DESTRUCTIVE_TARGET_OUT_OF_SCOPE",
|
|
11864
|
+
reason: `BLOCKED: Nested safe artifact "${safeTarget}" is outside the verified active coder scope.`
|
|
11865
|
+
};
|
|
11866
|
+
}
|
|
11867
|
+
}
|
|
11868
|
+
normalizedTargets.push(normalizedRelative);
|
|
11869
|
+
}
|
|
11870
|
+
return {
|
|
11871
|
+
allowed: true,
|
|
11872
|
+
kind: hasNested ? "scoped-nested-safe-artifact" : "bare-safe-artifact",
|
|
11873
|
+
targets: normalizedTargets
|
|
11874
|
+
};
|
|
11875
|
+
}
|
|
11737
11876
|
function dcCheckJunctionCreation(segment, cwd) {
|
|
11738
11877
|
const mklinkMatch = /^mklink(?:\.exe)?\s+\/[JjDd]\s+"?([^"\s]+)"?\s+"?([^"\s]+)"?/i.exec(segment);
|
|
11739
11878
|
if (mklinkMatch) {
|
|
@@ -13148,7 +13287,6 @@ function classifySwarmCommandChatFallbackUse(resolved) {
|
|
|
13148
13287
|
// src/hooks/guardrails/tool-before.ts
|
|
13149
13288
|
init_constants();
|
|
13150
13289
|
init_schema();
|
|
13151
|
-
init_executor();
|
|
13152
13290
|
|
|
13153
13291
|
// src/hooks/shell-write-detect.ts
|
|
13154
13292
|
import * as path19 from "path";
|
|
@@ -14509,47 +14647,6 @@ function resolveWriteTargets(command, writes, cwd) {
|
|
|
14509
14647
|
// src/hooks/write-target-resolver.ts
|
|
14510
14648
|
init_constants();
|
|
14511
14649
|
|
|
14512
|
-
// src/utils/path-security.ts
|
|
14513
|
-
function containsPathTraversal(str) {
|
|
14514
|
-
if (/\.\.[/\\]/.test(str))
|
|
14515
|
-
return true;
|
|
14516
|
-
if (/(?:^|[/\\])\.\.(?:[/\\]|$)/.test(str))
|
|
14517
|
-
return true;
|
|
14518
|
-
if (/%2e%2e/i.test(str))
|
|
14519
|
-
return true;
|
|
14520
|
-
if (/%2e\./i.test(str))
|
|
14521
|
-
return true;
|
|
14522
|
-
if (/%2e/i.test(str) && /\.\./.test(str))
|
|
14523
|
-
return true;
|
|
14524
|
-
if (/%252e%252e/i.test(str))
|
|
14525
|
-
return true;
|
|
14526
|
-
if (/\uff0e/.test(str))
|
|
14527
|
-
return true;
|
|
14528
|
-
if (/\u3002/.test(str))
|
|
14529
|
-
return true;
|
|
14530
|
-
if (/\uff65/.test(str))
|
|
14531
|
-
return true;
|
|
14532
|
-
if (/%2f/i.test(str))
|
|
14533
|
-
return true;
|
|
14534
|
-
if (/%5c/i.test(str))
|
|
14535
|
-
return true;
|
|
14536
|
-
return false;
|
|
14537
|
-
}
|
|
14538
|
-
function containsControlChars(str) {
|
|
14539
|
-
for (const ch of str) {
|
|
14540
|
-
const code = ch.codePointAt(0);
|
|
14541
|
-
if (code === undefined)
|
|
14542
|
-
continue;
|
|
14543
|
-
if (code <= 31 || code >= 127 && code <= 159)
|
|
14544
|
-
return true;
|
|
14545
|
-
if (code >= 8234 && code <= 8238)
|
|
14546
|
-
return true;
|
|
14547
|
-
if (code >= 8294 && code <= 8297)
|
|
14548
|
-
return true;
|
|
14549
|
-
}
|
|
14550
|
-
return false;
|
|
14551
|
-
}
|
|
14552
|
-
|
|
14553
14650
|
// src/tools/file-extractor-planner.ts
|
|
14554
14651
|
var cachedPlans = new WeakMap;
|
|
14555
14652
|
|
|
@@ -18881,7 +18978,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
18881
18978
|
};
|
|
18882
18979
|
}
|
|
18883
18980
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
18884
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
18981
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-gytyqv1d.js");
|
|
18885
18982
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
18886
18983
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
18887
18984
|
if (sweepConfig?.enabled === false)
|
|
@@ -20474,7 +20571,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
20474
20571
|
}
|
|
20475
20572
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
20476
20573
|
try {
|
|
20477
|
-
const skillModule = await import("./skill-generator-
|
|
20574
|
+
const skillModule = await import("./skill-generator-5px81476.js");
|
|
20478
20575
|
for (const cand of skillCandidates) {
|
|
20479
20576
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
20480
20577
|
continue;
|
|
@@ -20934,7 +21031,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
20934
21031
|
} catch {}
|
|
20935
21032
|
}
|
|
20936
21033
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
20937
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
21034
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-6473ey4c.js");
|
|
20938
21035
|
for (const { id } of contradictedEntries) {
|
|
20939
21036
|
try {
|
|
20940
21037
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -21753,7 +21850,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
21753
21850
|
warnings.push("Failed to collect knowledge summary.");
|
|
21754
21851
|
}
|
|
21755
21852
|
try {
|
|
21756
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
21853
|
+
const { getScanStatus } = await import("./scan-cursor-39zxpw34.js");
|
|
21757
21854
|
const scanStatus = await getScanStatus(directory);
|
|
21758
21855
|
if (scanStatus.remaining_estimate > 0) {
|
|
21759
21856
|
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.`);
|
|
@@ -21925,9 +22022,9 @@ var _internals24 = {
|
|
|
21925
22022
|
verifyPostMortemKnowledgeActions,
|
|
21926
22023
|
repairPostMortemActions,
|
|
21927
22024
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
21928
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
22025
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-xhfwr6b2.js");
|
|
21929
22026
|
try {
|
|
21930
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
22027
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-gytyqv1d.js");
|
|
21931
22028
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
21932
22029
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
21933
22030
|
} catch {
|
|
@@ -21935,11 +22032,11 @@ var _internals24 = {
|
|
|
21935
22032
|
}
|
|
21936
22033
|
},
|
|
21937
22034
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
21938
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
22035
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-zxjqcc8r.js");
|
|
21939
22036
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
21940
22037
|
},
|
|
21941
22038
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
21942
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
22039
|
+
const { checkHivePromotions } = await import("./hive-promoter-jc5vym27.js");
|
|
21943
22040
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
21944
22041
|
},
|
|
21945
22042
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -21948,7 +22045,7 @@ var _internals24 = {
|
|
|
21948
22045
|
activateProposal,
|
|
21949
22046
|
listSkills: listSkills2,
|
|
21950
22047
|
sanitizeSlug
|
|
21951
|
-
} = await import("./skill-generator-
|
|
22048
|
+
} = await import("./skill-generator-5px81476.js");
|
|
21952
22049
|
const result = {
|
|
21953
22050
|
approved: [],
|
|
21954
22051
|
rejected: [],
|
|
@@ -24575,9 +24672,9 @@ function hashContent(content) {
|
|
|
24575
24672
|
return createHash9("sha1").update(content).digest("hex");
|
|
24576
24673
|
}
|
|
24577
24674
|
async function loadConfigForPolicyCurator(directory) {
|
|
24578
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
24675
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-xhfwr6b2.js");
|
|
24579
24676
|
try {
|
|
24580
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
24677
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-gytyqv1d.js");
|
|
24581
24678
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
24582
24679
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
24583
24680
|
} catch {
|
|
@@ -27849,8 +27946,8 @@ function safeRemoveTemp(tempPath) {
|
|
|
27849
27946
|
} catch {}
|
|
27850
27947
|
}
|
|
27851
27948
|
function buildVacuumIntoSql(destPath) {
|
|
27852
|
-
const
|
|
27853
|
-
const escaped =
|
|
27949
|
+
const posix6 = destPath.replace(/\\/g, "/");
|
|
27950
|
+
const escaped = posix6.replace(/'/g, "''");
|
|
27854
27951
|
return `VACUUM INTO '${escaped}'`;
|
|
27855
27952
|
}
|
|
27856
27953
|
function rowString(row, col) {
|
|
@@ -28174,6 +28271,7 @@ var ARCHIVE_ARTIFACTS = [
|
|
|
28174
28271
|
"close-lessons.md",
|
|
28175
28272
|
"knowledge.jsonl",
|
|
28176
28273
|
"knowledge-rejected.jsonl",
|
|
28274
|
+
"run-memory.jsonl",
|
|
28177
28275
|
"repo-graph.json",
|
|
28178
28276
|
"doc-manifest.json",
|
|
28179
28277
|
"dark-matter.md",
|
|
@@ -28196,6 +28294,7 @@ var ACTIVE_STATE_TO_CLEAN = [
|
|
|
28196
28294
|
"handoff-consumed.md",
|
|
28197
28295
|
"escalation-report.md",
|
|
28198
28296
|
"knowledge-rejected.jsonl",
|
|
28297
|
+
"run-memory.jsonl",
|
|
28199
28298
|
"repo-graph.json",
|
|
28200
28299
|
"doc-manifest.json",
|
|
28201
28300
|
"dark-matter.md",
|
|
@@ -28537,7 +28636,7 @@ async function runFinalizeStage(ctx) {
|
|
|
28537
28636
|
}
|
|
28538
28637
|
}
|
|
28539
28638
|
try {
|
|
28540
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
28639
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-xhfwr6b2.js");
|
|
28541
28640
|
const { config: pmLoadedConfig } = _internals36.loadPluginConfigWithMeta(ctx.directory);
|
|
28542
28641
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
28543
28642
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -29392,7 +29491,7 @@ var _internals36 = {
|
|
|
29392
29491
|
closePlanTerminalState,
|
|
29393
29492
|
endAgentSession,
|
|
29394
29493
|
flushAndDrainTelemetry: async () => {
|
|
29395
|
-
const { flushAndDrainTelemetry } = await import("./telemetry-
|
|
29494
|
+
const { flushAndDrainTelemetry } = await import("./telemetry-7nt7zhyp.js");
|
|
29396
29495
|
return flushAndDrainTelemetry();
|
|
29397
29496
|
}
|
|
29398
29497
|
};
|
|
@@ -30808,9 +30907,9 @@ var _internals41 = {
|
|
|
30808
30907
|
loadPluginConfigWithMeta,
|
|
30809
30908
|
loadCuratorDeps: async () => {
|
|
30810
30909
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
30811
|
-
import("./schema-
|
|
30812
|
-
import("./curator-
|
|
30813
|
-
import("./curator-llm-factory-
|
|
30910
|
+
import("./schema-xhfwr6b2.js"),
|
|
30911
|
+
import("./curator-zxjqcc8r.js"),
|
|
30912
|
+
import("./curator-llm-factory-e8ngwyjm.js")
|
|
30814
30913
|
]);
|
|
30815
30914
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
30816
30915
|
}
|
|
@@ -31715,7 +31814,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
31715
31814
|
let scanCompleted = false;
|
|
31716
31815
|
let scanRemaining = 0;
|
|
31717
31816
|
try {
|
|
31718
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
31817
|
+
const { getScanStatus } = await import("./scan-cursor-39zxpw34.js");
|
|
31719
31818
|
const status = await getScanStatus(directory);
|
|
31720
31819
|
scanGeneration = status.generation;
|
|
31721
31820
|
scanCompleted = status.completed;
|
|
@@ -31723,19 +31822,19 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
31723
31822
|
} catch {}
|
|
31724
31823
|
let configMatch = null;
|
|
31725
31824
|
try {
|
|
31726
|
-
const { isLinked: isLinked2 } = await import("./knowledge-link-
|
|
31825
|
+
const { isLinked: isLinked2 } = await import("./knowledge-link-trfydkzm.js");
|
|
31727
31826
|
if (isLinked2(directory)) {
|
|
31728
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
31827
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-xhfwr6b2.js");
|
|
31729
31828
|
let config;
|
|
31730
31829
|
try {
|
|
31731
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
31830
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-gytyqv1d.js");
|
|
31732
31831
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
31733
31832
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
31734
31833
|
} catch {
|
|
31735
31834
|
config = KnowledgeConfigSchema2.parse({});
|
|
31736
31835
|
}
|
|
31737
31836
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
31738
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
31837
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-a3hs73f7.js");
|
|
31739
31838
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
31740
31839
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
31741
31840
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -32946,7 +33045,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
32946
33045
|
const result = runConfigDoctor(config, directory);
|
|
32947
33046
|
let output;
|
|
32948
33047
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
32949
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
33048
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-aszp7z1h.js");
|
|
32950
33049
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
32951
33050
|
applyLossy: true
|
|
32952
33051
|
});
|
|
@@ -33783,7 +33882,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
33783
33882
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
33784
33883
|
}
|
|
33785
33884
|
async function handleEvidenceSummaryCommand(directory) {
|
|
33786
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
33885
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-qfhjfxdz.js");
|
|
33787
33886
|
const artifact = await buildEvidenceSummary(directory);
|
|
33788
33887
|
if (!artifact) {
|
|
33789
33888
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -48908,7 +49007,8 @@ async function handleResetCommand(directory, args) {
|
|
|
48908
49007
|
"plan-export/SWARM_PLAN.md",
|
|
48909
49008
|
"plan-export/SWARM_PLAN.json",
|
|
48910
49009
|
"checkpoints.json",
|
|
48911
|
-
"events.jsonl"
|
|
49010
|
+
"events.jsonl",
|
|
49011
|
+
"run-memory.jsonl"
|
|
48912
49012
|
];
|
|
48913
49013
|
const results = [];
|
|
48914
49014
|
try {
|
|
@@ -54261,7 +54361,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
54261
54361
|
if (!input.dispatcher) {
|
|
54262
54362
|
throw new Error("no evaluation dispatcher available (cannot run validation)");
|
|
54263
54363
|
}
|
|
54264
|
-
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-
|
|
54364
|
+
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-9an52tmz.js");
|
|
54265
54365
|
const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
|
|
54266
54366
|
const result = await _internals83.evaluateCandidateV1({
|
|
54267
54367
|
projectRoot: input.directory,
|
|
@@ -56089,7 +56189,7 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
56089
56189
|
async function handleHelpCommand(ctx) {
|
|
56090
56190
|
const targetCommand = ctx.args.join(" ");
|
|
56091
56191
|
if (!targetCommand) {
|
|
56092
|
-
const { buildHelpText } = await import("./index-
|
|
56192
|
+
const { buildHelpText } = await import("./index-y46anh5e.js");
|
|
56093
56193
|
return buildHelpText();
|
|
56094
56194
|
}
|
|
56095
56195
|
const tokens = targetCommand.split(/\s+/);
|
|
@@ -56098,7 +56198,7 @@ async function handleHelpCommand(ctx) {
|
|
|
56098
56198
|
return _internals14.buildDetailedHelp(resolved.key, resolved.entry);
|
|
56099
56199
|
}
|
|
56100
56200
|
const similar = _internals14.findSimilarCommands(targetCommand);
|
|
56101
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
56201
|
+
const { buildHelpText: fullHelp } = await import("./index-y46anh5e.js");
|
|
56102
56202
|
if (similar.length > 0) {
|
|
56103
56203
|
return `Command '/swarm ${targetCommand}' not found.
|
|
56104
56204
|
|
|
@@ -56275,7 +56375,7 @@ var COMMAND_REGISTRY = {
|
|
|
56275
56375
|
},
|
|
56276
56376
|
"guardrail explain": {
|
|
56277
56377
|
handler: async (ctx) => {
|
|
56278
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
56378
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-rqpmzxyy.js");
|
|
56279
56379
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
56280
56380
|
},
|
|
56281
56381
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -56285,7 +56385,7 @@ var COMMAND_REGISTRY = {
|
|
|
56285
56385
|
},
|
|
56286
56386
|
"guardrail-explain": {
|
|
56287
56387
|
handler: async (ctx) => {
|
|
56288
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
56388
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-rqpmzxyy.js");
|
|
56289
56389
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
56290
56390
|
},
|
|
56291
56391
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -56295,7 +56395,7 @@ var COMMAND_REGISTRY = {
|
|
|
56295
56395
|
},
|
|
56296
56396
|
"guardrail-log": {
|
|
56297
56397
|
handler: async (ctx) => {
|
|
56298
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
56398
|
+
const { handleGuardrailLog } = await import("./guardrail-log-vd4a0ng5.js");
|
|
56299
56399
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
56300
56400
|
},
|
|
56301
56401
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -57430,12 +57530,16 @@ CODER'S TOOLS: write, edit, patch, apply_patch, swarm_apply_patch, create_file,
|
|
|
57430
57530
|
If a tool modifies a file, it is a CODER tool. Delegate.
|
|
57431
57531
|
<!-- BEHAVIORAL_GUIDANCE_START -->
|
|
57432
57532
|
1a. SCOPE DISCIPLINE \u2014 call declare_scope BEFORE every coder delegation AND before any test_engineer delegation that will write new test files.
|
|
57433
|
-
- 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/*).
|
|
57434
|
-
- 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.
|
|
57435
|
-
- If coder or test_engineer returns "WRITE BLOCKED" for a path outside the declared list: call declare_scope again with the missing path added
|
|
57533
|
+
- 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.
|
|
57534
|
+
- 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.
|
|
57535
|
+
- 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.
|
|
57436
57536
|
- 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.
|
|
57437
57537
|
- 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.
|
|
57438
57538
|
- 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.
|
|
57539
|
+
- 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.
|
|
57540
|
+
- 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.
|
|
57541
|
+
- \`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.
|
|
57542
|
+
- \`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.
|
|
57439
57543
|
- 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.
|
|
57440
57544
|
<!-- BEHAVIORAL_GUIDANCE_END -->
|
|
57441
57545
|
2. ONE agent per message. Send, STOP, wait for response.
|
|
@@ -57445,8 +57549,8 @@ If a tool modifies a file, it is a CODER tool. Delegate.
|
|
|
57445
57549
|
> **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\`.
|
|
57446
57550
|
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).
|
|
57447
57551
|
3. ONE task per {{AGENT_PREFIX}}coder call. Never batch.
|
|
57448
|
-
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.
|
|
57449
|
-
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.
|
|
57552
|
+
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.
|
|
57553
|
+
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.
|
|
57450
57554
|
<!-- BEHAVIORAL_GUIDANCE_START -->
|
|
57451
57555
|
BATCHING DETECTION \u2014 you are batching if your coder delegation contains ANY of:
|
|
57452
57556
|
- The word "and" connecting two actions ("update X AND add Y")
|
|
@@ -57845,7 +57949,7 @@ INPUT: Building a SwiftUI app with offline-first sync
|
|
|
57845
57949
|
OUTPUT: Recommended patterns, frameworks, gotchas
|
|
57846
57950
|
SKILLS: none
|
|
57847
57951
|
|
|
57848
|
-
PRE-STEP (required): call \`declare_scope({ taskId, files })\` BEFORE writing any {{AGENT_PREFIX}}coder delegation. See Rule 1a.
|
|
57952
|
+
PRE-STEP (required): call \`declare_scope({ taskId, files, replace_existing: true })\` BEFORE writing any {{AGENT_PREFIX}}coder delegation. See Rule 1a.
|
|
57849
57953
|
|
|
57850
57954
|
{{AGENT_PREFIX}}coder
|
|
57851
57955
|
TASK: Add input validation to login
|
|
@@ -58258,7 +58362,15 @@ ACTION: Load skill ${bundledProjectSkillFileReference("plan")} immediately. Foll
|
|
|
58258
58362
|
HARD CONSTRAINTS (apply regardless of skill load success):
|
|
58259
58363
|
- 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.
|
|
58260
58364
|
- Use the \`save_plan\` tool as the primary plan writer. Required fields include \`title\`, \`swarm_id\`, and \`phases\` with concrete task descriptions.
|
|
58261
|
-
-
|
|
58365
|
+
- Every coding task SHOULD include \`files_touched\` with the exact normalized project-relative files or directories it may modify; include generated outputs and lockfiles.
|
|
58366
|
+
- Example call:
|
|
58367
|
+
save_plan({
|
|
58368
|
+
title: "My Real Project",
|
|
58369
|
+
swarm_id: "mega",
|
|
58370
|
+
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"] }] }]
|
|
58371
|
+
})
|
|
58372
|
+
|
|
58373
|
+
- 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.
|
|
58262
58374
|
|
|
58263
58375
|
- If \`save_plan\` is unavailable, delegate plan writing only after \`declare_scope\` covers \`.swarm/plan.md\`; the delegated output must be exact plan content.
|
|
58264
58376
|
- A missing spec is a soft gate for external plan ingestion, but stale spec drift must be surfaced to the user before continuing.
|
|
@@ -58308,7 +58420,7 @@ ACTION: Load skill ${bundledProjectSkillFileReference("execute")} immediately. F
|
|
|
58308
58420
|
|
|
58309
58421
|
HARD CONSTRAINTS (apply regardless of skill load success):
|
|
58310
58422
|
- For each task, respect dependencies and delegate implementation to \`{{AGENT_PREFIX}}coder\`; do not self-fix ordinary gate failures.
|
|
58311
|
-
- Before coder implementation or retry, call \`declare_scope({ taskId, files })\` with the exact files the coder may touch.
|
|
58423
|
+
- Before coder implementation or retry, call \`declare_scope({ taskId, files, replace_existing: true })\` with the exact files the coder may touch.
|
|
58312
58424
|
- On any gate failure, return to \`{{AGENT_PREFIX}}coder\` with structured rejection: \`GATE FAILED: [gate name] | REASON: [details] | REQUIRED FIX: [specific action required]\`.
|
|
58313
58425
|
- 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.
|
|
58314
58426
|
- 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.
|
|
@@ -59872,4 +59984,4 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
|
|
|
59872
59984
|
};
|
|
59873
59985
|
}
|
|
59874
59986
|
|
|
59875
|
-
export { handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand,
|
|
59987
|
+
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 };
|