opencode-swarm 7.121.4 → 7.122.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{config-doctor-404c8mf8.js → config-doctor-3ksh1534.js} +2 -2
- package/dist/cli/{core-xnwasfpc.js → core-cwgb7ev8.js} +1 -1
- package/dist/cli/{curation-policy-10wnhpwn.js → curation-policy-4j4qce5a.js} +5 -5
- package/dist/cli/{curator-llm-factory-6rafny5e.js → curator-llm-factory-x769hn66.js} +22 -20
- package/dist/cli/{curator-3azybqrw.js → curator-qfh07497.js} +22 -20
- package/dist/cli/{evidence-summary-service-k14ykm03.js → evidence-summary-service-96ndczbk.js} +7 -5
- package/dist/cli/{gate-evidence-tbpezk28.js → gate-evidence-xqks3kk2.js} +3 -3
- package/dist/cli/{guardrail-explain-d1m747g5.js → guardrail-explain-kj0e9r25.js} +23 -21
- package/dist/cli/{guardrail-log-dhpp0kmn.js → guardrail-log-z291m4gw.js} +3 -3
- package/dist/cli/{hive-promoter-4xnj3fdk.js → hive-promoter-00mktxkk.js} +22 -20
- package/dist/cli/{index-zvae4m8g.js → index-17eybc3z.js} +1 -1
- package/dist/cli/{index-kyvg2cmp.js → index-19zn67q6.js} +1 -1
- package/dist/cli/{index-rbfq77sz.js → index-2j25br0p.js} +12 -10
- package/dist/cli/{index-9xpgytj9.js → index-3rr0ese8.js} +1 -1
- package/dist/cli/{index-x4fwtd59.js → index-5he0kwnx.js} +3 -3
- package/dist/cli/{index-982hhpcm.js → index-6srk9a5q.js} +2 -2
- package/dist/cli/{index-qg11yf8q.js → index-6xnxz6z0.js} +1 -1
- package/dist/cli/{index-emkb0bbe.js → index-7cspygmb.js} +277 -673
- package/dist/cli/{index-5a3xsnzg.js → index-cqsak7bf.js} +2 -2
- package/dist/cli/index-ctpgsj84.js +547 -0
- package/dist/cli/index-d6h5hq91.js +564 -0
- package/dist/cli/{index-vqcgmy4y.js → index-det5jwfk.js} +1 -1
- package/dist/cli/{index-35xyj7gn.js → index-dywekeen.js} +28 -5
- package/dist/cli/{index-wtn8wf7h.js → index-gw3m5fw0.js} +1 -1
- package/dist/cli/{index-j8349ac0.js → index-hns7xjm7.js} +2 -2
- package/dist/cli/{index-ft6jw816.js → index-j9kxwshw.js} +5 -5
- package/dist/cli/{index-2k6z335c.js → index-jm81nhks.js} +24 -22
- package/dist/cli/{index-q0fv0xec.js → index-kanrv3sv.js} +280 -119
- package/dist/cli/{index-db82jxt7.js → index-m0bmh3w0.js} +4 -4
- package/dist/cli/index-m1abzg93.js +68 -0
- package/dist/cli/{index-0f800qg7.js → index-n2712byd.js} +6 -6
- package/dist/cli/{index-3jvqw5hy.js → index-q27bajqb.js} +1 -1
- package/dist/cli/{index-qt2yaghg.js → index-vcgfqd8f.js} +1 -63
- package/dist/cli/{index-tftv9xh9.js → index-wr8qgpz5.js} +1 -1
- package/dist/cli/index.js +22 -20
- package/dist/cli/{knowledge-escalator-8ajq1fhb.js → knowledge-escalator-dyxsm78k.js} +6 -6
- package/dist/cli/{knowledge-events-2sjy3aa7.js → knowledge-events-36q6nvae.js} +6 -4
- package/dist/cli/{knowledge-link-sy85fw3w.js → knowledge-link-4yd2z8ev.js} +3 -3
- package/dist/cli/{knowledge-store-27cesthc.js → knowledge-store-e07b4s54.js} +4 -4
- package/dist/cli/{knowledge-validator-9keh3p8j.js → knowledge-validator-sfyf7wn2.js} +7 -7
- package/dist/cli/pr-subscriptions-x653151h.js +1 -1
- package/dist/cli/{scan-cursor-qmsmmg1b.js → scan-cursor-hm0aqqae.js} +5 -5
- package/dist/cli/{schema-vwxpsk6j.js → schema-13bnng2n.js} +1 -1
- package/dist/cli/scope-persistence-d9erwnvb.js +36 -0
- package/dist/cli/{skill-generator-hkyxdc3j.js → skill-generator-g6r52x94.js} +8 -8
- package/dist/config/constants.d.ts +3 -2
- package/dist/hooks/cohort-cache.d.ts +44 -0
- package/dist/hooks/delegation-gate.d.ts +19 -1
- package/dist/hooks/guardrails/nontransient-circuit.d.ts +47 -0
- package/dist/hooks/hive-promoter.d.ts +4 -3
- package/dist/hooks/host-boundary.d.ts +147 -0
- package/dist/hooks/incremental-verify.d.ts +3 -0
- package/dist/hooks/knowledge-events.d.ts +25 -2
- package/dist/hooks/knowledge-injector.d.ts +9 -1
- package/dist/hooks/knowledge-receipt-validator.d.ts +98 -0
- package/dist/hooks/micro-reflector.d.ts +3 -0
- package/dist/hooks/pr-auto-subscribe.d.ts +3 -0
- package/dist/hooks/promotion-evidence-store.d.ts +33 -0
- package/dist/hooks/scope-guard.d.ts +9 -2
- package/dist/hooks/write-target-resolver.d.ts +30 -0
- package/dist/index.js +423 -380
- package/dist/sandbox/win32/restricted-environment-executor.d.ts +3 -2
- package/dist/scope/scope-binding.d.ts +89 -0
- package/dist/scope/scope-persistence.d.ts +53 -12
- package/dist/services/knowledge-diagnostics.d.ts +12 -0
- package/dist/session/snapshot-writer.d.ts +5 -0
- package/dist/state.d.ts +36 -1
- package/dist/tools/declare-scope.d.ts +5 -1
- package/dist/tools/file-extractor-planner.d.ts +31 -0
- package/dist/tools/file-extractor.d.ts +2 -7
- package/package.json +1 -1
- package/dist/cli/index-51gg9947.js +0 -254
- package/dist/cli/scope-persistence-mfr36yc9.js +0 -20
- package/dist/cli/{index-h07wn84h.js → index-7mkpsw6g.js} +3 -3
- package/dist/cli/{pending-delegations-0z3znsec.js → pending-delegations-68cbaqv2.js} +1 -1
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
readDoctorArtifact,
|
|
5
5
|
removeStraySwarmDir,
|
|
6
6
|
runConfigDoctor
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-det5jwfk.js";
|
|
8
8
|
import {
|
|
9
9
|
EvaluationTaskV1Schema,
|
|
10
10
|
GateAuditManifestV1Schema,
|
|
@@ -13,18 +13,15 @@ import {
|
|
|
13
13
|
IdentifierSchema,
|
|
14
14
|
MAX_TRANSIENT_RETRIES,
|
|
15
15
|
admitEvaluationTask,
|
|
16
|
-
appendLedgerEvent,
|
|
17
16
|
archiveEvidence,
|
|
18
17
|
canonicalHash,
|
|
19
18
|
canonicalJson,
|
|
20
19
|
checkRequirementCoverage,
|
|
21
20
|
closePlanTerminalState,
|
|
22
21
|
computeManifestContentHash,
|
|
23
|
-
computePlanHash,
|
|
24
22
|
computeSpecHash,
|
|
25
23
|
computeTaskInputContentHash,
|
|
26
24
|
computeTaskSetContentHash,
|
|
27
|
-
derivePlanId,
|
|
28
25
|
derivePlanMarkdown,
|
|
29
26
|
disableEpicMode,
|
|
30
27
|
enableEpicMode,
|
|
@@ -34,7 +31,6 @@ import {
|
|
|
34
31
|
getExecutor,
|
|
35
32
|
getGitRepositoryStatus,
|
|
36
33
|
initDurableStatusPath,
|
|
37
|
-
initLedger,
|
|
38
34
|
init_executor,
|
|
39
35
|
isEpicModeActive,
|
|
40
36
|
isGitRepo,
|
|
@@ -65,7 +61,7 @@ import {
|
|
|
65
61
|
saveTaskSetSnapshot,
|
|
66
62
|
transientBackoff,
|
|
67
63
|
validateProjectRoot
|
|
68
|
-
} from "./index-
|
|
64
|
+
} from "./index-7cspygmb.js";
|
|
69
65
|
import {
|
|
70
66
|
withTimeout
|
|
71
67
|
} from "./index-4905hd2m.js";
|
|
@@ -95,15 +91,15 @@ import {
|
|
|
95
91
|
retireSkill,
|
|
96
92
|
selectCandidateEntries,
|
|
97
93
|
syncBundledProjectSkillsIfMissingAsync
|
|
98
|
-
} from "./index-
|
|
94
|
+
} from "./index-5he0kwnx.js";
|
|
99
95
|
import {
|
|
100
96
|
readRecentEscalations
|
|
101
|
-
} from "./index-
|
|
97
|
+
} from "./index-j9kxwshw.js";
|
|
102
98
|
import {
|
|
103
99
|
alreadyCuratedThisGeneration,
|
|
104
100
|
claimNextScanBatch,
|
|
105
101
|
resolveCohortId
|
|
106
|
-
} from "./index-
|
|
102
|
+
} from "./index-hns7xjm7.js";
|
|
107
103
|
import {
|
|
108
104
|
CURATOR_INIT_PROMPT,
|
|
109
105
|
CURATOR_PHASE_PROMPT,
|
|
@@ -136,11 +132,11 @@ import {
|
|
|
136
132
|
validateActionability,
|
|
137
133
|
validateActionableFields,
|
|
138
134
|
validateLesson
|
|
139
|
-
} from "./index-
|
|
135
|
+
} from "./index-m0bmh3w0.js";
|
|
140
136
|
import {
|
|
141
137
|
authorizeCuration,
|
|
142
138
|
buildConfigFingerprintInput
|
|
143
|
-
} from "./index-
|
|
139
|
+
} from "./index-cqsak7bf.js";
|
|
144
140
|
import {
|
|
145
141
|
cohortConfigFingerprint
|
|
146
142
|
} from "./index-rtry5xyf.js";
|
|
@@ -170,7 +166,7 @@ import {
|
|
|
170
166
|
transactFile,
|
|
171
167
|
transactKnowledge,
|
|
172
168
|
wordBigrams
|
|
173
|
-
} from "./index-
|
|
169
|
+
} from "./index-n2712byd.js";
|
|
174
170
|
import {
|
|
175
171
|
MAX_EVENT_LOG_ENTRIES,
|
|
176
172
|
_internals,
|
|
@@ -180,7 +176,7 @@ import {
|
|
|
180
176
|
recordHiveKnowledgeEvent,
|
|
181
177
|
recordKnowledgeEvent,
|
|
182
178
|
resolveKnowledgeEventsPath
|
|
183
|
-
} from "./index-
|
|
179
|
+
} from "./index-dywekeen.js";
|
|
184
180
|
import {
|
|
185
181
|
resolveHiveDataDir,
|
|
186
182
|
resolveHiveEventsPath,
|
|
@@ -196,15 +192,14 @@ import {
|
|
|
196
192
|
resolveLinkDir,
|
|
197
193
|
sanitizeLinkId,
|
|
198
194
|
writeLinkPointer
|
|
199
|
-
} from "./index-
|
|
195
|
+
} from "./index-q27bajqb.js";
|
|
200
196
|
import {
|
|
201
197
|
loadPluginConfig,
|
|
202
198
|
loadPluginConfigWithMeta
|
|
203
|
-
} from "./index-
|
|
199
|
+
} from "./index-3rr0ese8.js";
|
|
204
200
|
import {
|
|
205
|
-
PlanSchema,
|
|
206
201
|
RetrospectiveEvidenceSchema
|
|
207
|
-
} from "./index-
|
|
202
|
+
} from "./index-vcgfqd8f.js";
|
|
208
203
|
import {
|
|
209
204
|
AGENT_TOOL_MAP,
|
|
210
205
|
ALL_SUBAGENT_NAMES,
|
|
@@ -215,7 +210,7 @@ import {
|
|
|
215
210
|
TOOL_NAME_SET,
|
|
216
211
|
getCanonicalAgentRole,
|
|
217
212
|
stripKnownSwarmPrefix
|
|
218
|
-
} from "./index-
|
|
213
|
+
} from "./index-wr8qgpz5.js";
|
|
219
214
|
import {
|
|
220
215
|
KNOWLEDGE_SCHEMA_VERSION,
|
|
221
216
|
OUTCOME_BLOCK_THRESHOLD,
|
|
@@ -226,8 +221,20 @@ import {
|
|
|
226
221
|
init_capability_probe
|
|
227
222
|
} from "./index-8fwhhayc.js";
|
|
228
223
|
import {
|
|
229
|
-
|
|
230
|
-
|
|
224
|
+
MAX_PENDING_SCOPE_BINDINGS,
|
|
225
|
+
clearAllScopes,
|
|
226
|
+
clearScopeBindingFromDisk,
|
|
227
|
+
clearScopeBindings
|
|
228
|
+
} from "./index-d6h5hq91.js";
|
|
229
|
+
import {
|
|
230
|
+
appendLedgerEvent,
|
|
231
|
+
computePlanHash,
|
|
232
|
+
derivePlanId,
|
|
233
|
+
initLedger
|
|
234
|
+
} from "./index-ctpgsj84.js";
|
|
235
|
+
import {
|
|
236
|
+
PlanSchema
|
|
237
|
+
} from "./index-m1abzg93.js";
|
|
231
238
|
import {
|
|
232
239
|
advisoryWarn,
|
|
233
240
|
getDeferredWarnings
|
|
@@ -246,7 +253,7 @@ import {
|
|
|
246
253
|
} from "./index-zgwm4ryv.js";
|
|
247
254
|
import {
|
|
248
255
|
atomicWriteFile
|
|
249
|
-
} from "./index-
|
|
256
|
+
} from "./index-7mkpsw6g.js";
|
|
250
257
|
import {
|
|
251
258
|
tryAcquireLock,
|
|
252
259
|
withEvidenceLock
|
|
@@ -9858,7 +9865,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
9858
9865
|
}
|
|
9859
9866
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
9860
9867
|
try {
|
|
9861
|
-
const skillModule = await import("./skill-generator-
|
|
9868
|
+
const skillModule = await import("./skill-generator-g6r52x94.js");
|
|
9862
9869
|
for (const cand of skillCandidates) {
|
|
9863
9870
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
9864
9871
|
continue;
|
|
@@ -10195,7 +10202,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
10195
10202
|
} catch {}
|
|
10196
10203
|
}
|
|
10197
10204
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
10198
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
10205
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-dyxsm78k.js");
|
|
10199
10206
|
for (const { id } of contradictedEntries) {
|
|
10200
10207
|
try {
|
|
10201
10208
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -10993,7 +11000,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
10993
11000
|
warnings.push("Failed to collect knowledge summary.");
|
|
10994
11001
|
}
|
|
10995
11002
|
try {
|
|
10996
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
11003
|
+
const { getScanStatus } = await import("./scan-cursor-hm0aqqae.js");
|
|
10997
11004
|
const scanStatus = await getScanStatus(directory);
|
|
10998
11005
|
if (scanStatus.remaining_estimate > 0) {
|
|
10999
11006
|
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.`);
|
|
@@ -11165,9 +11172,9 @@ var _internals16 = {
|
|
|
11165
11172
|
verifyPostMortemKnowledgeActions,
|
|
11166
11173
|
repairPostMortemActions,
|
|
11167
11174
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
11168
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
11175
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-13bnng2n.js");
|
|
11169
11176
|
try {
|
|
11170
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
11177
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-2j25br0p.js");
|
|
11171
11178
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
11172
11179
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
11173
11180
|
} catch {
|
|
@@ -11175,11 +11182,11 @@ var _internals16 = {
|
|
|
11175
11182
|
}
|
|
11176
11183
|
},
|
|
11177
11184
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
11178
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
11185
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-qfh07497.js");
|
|
11179
11186
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
11180
11187
|
},
|
|
11181
11188
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
11182
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
11189
|
+
const { checkHivePromotions } = await import("./hive-promoter-00mktxkk.js");
|
|
11183
11190
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
11184
11191
|
},
|
|
11185
11192
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -11188,7 +11195,7 @@ var _internals16 = {
|
|
|
11188
11195
|
activateProposal,
|
|
11189
11196
|
listSkills: listSkills2,
|
|
11190
11197
|
sanitizeSlug
|
|
11191
|
-
} = await import("./skill-generator-
|
|
11198
|
+
} = await import("./skill-generator-g6r52x94.js");
|
|
11192
11199
|
const result = {
|
|
11193
11200
|
approved: [],
|
|
11194
11201
|
rejected: [],
|
|
@@ -11429,6 +11436,54 @@ var _internals17 = {
|
|
|
11429
11436
|
path: path19
|
|
11430
11437
|
};
|
|
11431
11438
|
|
|
11439
|
+
// src/hooks/promotion-evidence-store.ts
|
|
11440
|
+
import {
|
|
11441
|
+
appendFile as appendFile3,
|
|
11442
|
+
mkdir as mkdir7,
|
|
11443
|
+
readFile as readFile6,
|
|
11444
|
+
rename as rename4,
|
|
11445
|
+
writeFile as writeFile5
|
|
11446
|
+
} from "fs/promises";
|
|
11447
|
+
init_logger();
|
|
11448
|
+
function resolvePromotionEvidencePath(directory) {
|
|
11449
|
+
return validateSwarmPath(directory, "knowledge-promotion-evidence.jsonl");
|
|
11450
|
+
}
|
|
11451
|
+
function parseRecord(line) {
|
|
11452
|
+
try {
|
|
11453
|
+
const o = JSON.parse(line);
|
|
11454
|
+
if (typeof o.cohort_id === "string" && typeof o.entry_id === "string" && typeof o.retrieval_trace_id === "string" && (o.receipt_outcome === "applied" || o.receipt_outcome === "violated" || o.receipt_outcome === "contradicted") && typeof o.receipt_event_id === "string" && typeof o.timestamp === "string") {
|
|
11455
|
+
return o;
|
|
11456
|
+
}
|
|
11457
|
+
} catch {}
|
|
11458
|
+
return null;
|
|
11459
|
+
}
|
|
11460
|
+
async function loadPromotionEvidenceByEntry(directory) {
|
|
11461
|
+
const filePath = resolvePromotionEvidencePath(directory);
|
|
11462
|
+
let content;
|
|
11463
|
+
try {
|
|
11464
|
+
content = await readFile6(filePath, "utf-8");
|
|
11465
|
+
} catch {
|
|
11466
|
+
return {};
|
|
11467
|
+
}
|
|
11468
|
+
const out = {};
|
|
11469
|
+
for (const line of content.split(`
|
|
11470
|
+
`)) {
|
|
11471
|
+
const trimmed = line.trim();
|
|
11472
|
+
if (!trimmed)
|
|
11473
|
+
continue;
|
|
11474
|
+
const rec = parseRecord(trimmed);
|
|
11475
|
+
if (!rec)
|
|
11476
|
+
continue;
|
|
11477
|
+
const bucket = out[rec.entry_id];
|
|
11478
|
+
if (bucket) {
|
|
11479
|
+
bucket.push(rec);
|
|
11480
|
+
} else {
|
|
11481
|
+
out[rec.entry_id] = [rec];
|
|
11482
|
+
}
|
|
11483
|
+
}
|
|
11484
|
+
return out;
|
|
11485
|
+
}
|
|
11486
|
+
|
|
11432
11487
|
// src/hooks/hive-promoter.ts
|
|
11433
11488
|
function carryActionableFields(source) {
|
|
11434
11489
|
const out = {};
|
|
@@ -11537,7 +11592,7 @@ async function checkHivePromotions(swarmEntries, config, directory) {
|
|
|
11537
11592
|
return empty;
|
|
11538
11593
|
}
|
|
11539
11594
|
const sourceCohort = await _internals18.resolveCohortId(directory);
|
|
11540
|
-
const evidence = await _internals18.loadPromotionEvidence(
|
|
11595
|
+
const evidence = await _internals18.loadPromotionEvidence(directory);
|
|
11541
11596
|
const diagnostics = [];
|
|
11542
11597
|
const activeSwarm = swarmEntries.filter((e) => isActiveStatus(e.status));
|
|
11543
11598
|
const activeSwarmBigrams = activeSwarm.map((e) => typeof e.lesson === "string" ? wordBigrams(e.lesson) : new Set);
|
|
@@ -11844,7 +11899,7 @@ var _internals18 = {
|
|
|
11844
11899
|
transactHiveStore,
|
|
11845
11900
|
validateLesson,
|
|
11846
11901
|
authorizeCuration,
|
|
11847
|
-
loadPromotionEvidence: async (
|
|
11902
|
+
loadPromotionEvidence: async (directory) => loadPromotionEvidenceByEntry(directory),
|
|
11848
11903
|
loadDefaultKnowledgeConfig: () => KnowledgeConfigSchema.parse({})
|
|
11849
11904
|
};
|
|
11850
11905
|
function createHivePromoterHook(directory, config) {
|
|
@@ -12091,23 +12146,23 @@ async function promoteFromSwarm(directory, lessonId, options, config) {
|
|
|
12091
12146
|
import { createHash as createHash5 } from "crypto";
|
|
12092
12147
|
import { existsSync as existsSync13 } from "fs";
|
|
12093
12148
|
import {
|
|
12094
|
-
appendFile as
|
|
12095
|
-
mkdir as
|
|
12096
|
-
readFile as
|
|
12149
|
+
appendFile as appendFile4,
|
|
12150
|
+
mkdir as mkdir9,
|
|
12151
|
+
readFile as readFile9,
|
|
12097
12152
|
realpath,
|
|
12098
|
-
writeFile as
|
|
12153
|
+
writeFile as writeFile8
|
|
12099
12154
|
} from "fs/promises";
|
|
12100
12155
|
import * as path25 from "path";
|
|
12101
12156
|
|
|
12102
12157
|
// src/services/synonym-map.ts
|
|
12103
12158
|
var import_proper_lockfile3 = __toESM(require_proper_lockfile(), 1);
|
|
12104
12159
|
import {
|
|
12105
|
-
mkdir as
|
|
12106
|
-
readFile as
|
|
12107
|
-
rename as
|
|
12160
|
+
mkdir as mkdir8,
|
|
12161
|
+
readFile as readFile7,
|
|
12162
|
+
rename as rename5,
|
|
12108
12163
|
stat as stat2,
|
|
12109
12164
|
unlink,
|
|
12110
|
-
writeFile as
|
|
12165
|
+
writeFile as writeFile6
|
|
12111
12166
|
} from "fs/promises";
|
|
12112
12167
|
import * as path21 from "path";
|
|
12113
12168
|
var SYNONYM_MAP_FILENAME = "synonym-map.json";
|
|
@@ -12257,18 +12312,18 @@ async function readSynonymMap(directory, maxPairs = DEFAULT_MAX_PAIRS) {
|
|
|
12257
12312
|
const st = await stat2(filePath);
|
|
12258
12313
|
if (st.size > ceiling)
|
|
12259
12314
|
return emptySynonymMap();
|
|
12260
|
-
const raw = await
|
|
12315
|
+
const raw = await readFile7(filePath, "utf-8");
|
|
12261
12316
|
return coerceSynonymMap(JSON.parse(raw), maxPairs);
|
|
12262
12317
|
} catch {
|
|
12263
12318
|
return emptySynonymMap();
|
|
12264
12319
|
}
|
|
12265
12320
|
}
|
|
12266
12321
|
async function writeSynonymMapAtomic(filePath, map) {
|
|
12267
|
-
await
|
|
12322
|
+
await mkdir8(path21.dirname(filePath), { recursive: true });
|
|
12268
12323
|
const tmp = `${filePath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
12269
12324
|
try {
|
|
12270
|
-
await
|
|
12271
|
-
await
|
|
12325
|
+
await writeFile6(tmp, JSON.stringify(map, null, 2), "utf-8");
|
|
12326
|
+
await rename5(tmp, filePath);
|
|
12272
12327
|
} finally {
|
|
12273
12328
|
try {
|
|
12274
12329
|
await unlink(tmp);
|
|
@@ -12278,7 +12333,7 @@ async function writeSynonymMapAtomic(filePath, map) {
|
|
|
12278
12333
|
async function rebuildSynonymMap(directory, entries, maxPairs = DEFAULT_MAX_PAIRS) {
|
|
12279
12334
|
const filePath = resolveSynonymMapPath(directory);
|
|
12280
12335
|
const dir = path21.dirname(filePath);
|
|
12281
|
-
await
|
|
12336
|
+
await mkdir8(dir, { recursive: true });
|
|
12282
12337
|
let release = null;
|
|
12283
12338
|
try {
|
|
12284
12339
|
release = await import_proper_lockfile3.default.lock(dir, {
|
|
@@ -12302,10 +12357,13 @@ init_logger();
|
|
|
12302
12357
|
|
|
12303
12358
|
// src/hooks/micro-reflector.ts
|
|
12304
12359
|
import { existsSync as existsSync12 } from "fs";
|
|
12305
|
-
import { readFile as
|
|
12360
|
+
import { readFile as readFile8, writeFile as writeFile7 } from "fs/promises";
|
|
12306
12361
|
import * as path24 from "path";
|
|
12307
12362
|
init_logger();
|
|
12308
12363
|
|
|
12364
|
+
// src/hooks/guardrails/stored-input-args.ts
|
|
12365
|
+
var storedInputArgs = new Map;
|
|
12366
|
+
|
|
12309
12367
|
// src/hooks/skill-propagation-gate.ts
|
|
12310
12368
|
import * as fs9 from "fs";
|
|
12311
12369
|
import * as path23 from "path";
|
|
@@ -13607,7 +13665,7 @@ async function readTaskTrajectory(directory, taskId) {
|
|
|
13607
13665
|
const filePath = validateSwarmPath(directory, rel);
|
|
13608
13666
|
if (!existsSync12(filePath))
|
|
13609
13667
|
return [];
|
|
13610
|
-
const content = await
|
|
13668
|
+
const content = await readFile8(filePath, "utf-8");
|
|
13611
13669
|
const out = [];
|
|
13612
13670
|
for (const line of content.split(`
|
|
13613
13671
|
`)) {
|
|
@@ -13654,9 +13712,9 @@ function hashContent(content) {
|
|
|
13654
13712
|
return createHash5("sha1").update(content).digest("hex");
|
|
13655
13713
|
}
|
|
13656
13714
|
async function loadConfigForPolicyCurator(directory) {
|
|
13657
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
13715
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-13bnng2n.js");
|
|
13658
13716
|
try {
|
|
13659
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
13717
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-2j25br0p.js");
|
|
13660
13718
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
13661
13719
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
13662
13720
|
} catch {
|
|
@@ -14135,8 +14193,8 @@ RETRY: your last output was missing ${result.missing.join("; ")}; produce valid
|
|
|
14135
14193
|
async function appendCuratorSkippedEvent(directory, record) {
|
|
14136
14194
|
try {
|
|
14137
14195
|
const filePath = path25.join(directory, ".swarm", "events.jsonl");
|
|
14138
|
-
await
|
|
14139
|
-
await
|
|
14196
|
+
await mkdir9(path25.dirname(filePath), { recursive: true });
|
|
14197
|
+
await appendFile4(filePath, `${JSON.stringify({
|
|
14140
14198
|
timestamp: new Date().toISOString(),
|
|
14141
14199
|
event: "curator_skipped",
|
|
14142
14200
|
entry_id: record.entry_id,
|
|
@@ -14178,11 +14236,11 @@ async function consumeInsightCandidates(directory, batchLimit = MESO_INSIGHT_BAT
|
|
|
14178
14236
|
if (!existsSync13(filePath))
|
|
14179
14237
|
return [];
|
|
14180
14238
|
const consumed = [];
|
|
14181
|
-
await transactFile(filePath, async (p) => readInsightJsonl(await
|
|
14239
|
+
await transactFile(filePath, async (p) => readInsightJsonl(await readFile9(p, "utf-8").catch(() => "")), async (p, data) => {
|
|
14182
14240
|
const body = data.length === 0 ? "" : `${data.map((c) => JSON.stringify(c)).join(`
|
|
14183
14241
|
`)}
|
|
14184
14242
|
`;
|
|
14185
|
-
await
|
|
14243
|
+
await writeFile8(p, body, "utf-8");
|
|
14186
14244
|
}, (all) => {
|
|
14187
14245
|
if (all.length === 0)
|
|
14188
14246
|
return null;
|
|
@@ -15108,12 +15166,12 @@ async function writeSessionReflection(directory, result) {
|
|
|
15108
15166
|
|
|
15109
15167
|
// src/services/skill-improver.ts
|
|
15110
15168
|
import { existsSync as existsSync15 } from "fs";
|
|
15111
|
-
import { mkdir as
|
|
15169
|
+
import { mkdir as mkdir11, readFile as readFile10, rename as rename6, writeFile as writeFile10 } from "fs/promises";
|
|
15112
15170
|
import * as path28 from "path";
|
|
15113
15171
|
init_logger();
|
|
15114
15172
|
|
|
15115
15173
|
// src/services/trajectory-cluster.ts
|
|
15116
|
-
import { mkdir as
|
|
15174
|
+
import { mkdir as mkdir10, writeFile as writeFile9 } from "fs/promises";
|
|
15117
15175
|
import * as path27 from "path";
|
|
15118
15176
|
init_logger();
|
|
15119
15177
|
var MACRO_TRAJECTORY_WINDOW = 200;
|
|
@@ -15247,11 +15305,11 @@ async function writeMotifProposals(directory, opts = {}) {
|
|
|
15247
15305
|
return result;
|
|
15248
15306
|
const max = opts.maxProposals ?? 10;
|
|
15249
15307
|
const proposalsDir = validateSwarmPath(directory, path27.join("skills", "proposals"));
|
|
15250
|
-
await
|
|
15308
|
+
await mkdir10(proposalsDir, { recursive: true });
|
|
15251
15309
|
for (const motif of motifs.slice(0, max)) {
|
|
15252
15310
|
const slug = `motif-${slugify(motif.signature)}`;
|
|
15253
15311
|
const filePath = path27.join(proposalsDir, `${slug}.md`);
|
|
15254
|
-
await
|
|
15312
|
+
await writeFile9(filePath, buildMotifProposal(motif), "utf-8");
|
|
15255
15313
|
result.proposalsWritten.push(filePath);
|
|
15256
15314
|
}
|
|
15257
15315
|
return result;
|
|
@@ -15392,11 +15450,11 @@ async function writeSuccessMotifProposals(directory, opts = {}) {
|
|
|
15392
15450
|
return result;
|
|
15393
15451
|
const max = opts.maxProposals ?? 10;
|
|
15394
15452
|
const proposalsDir = validateSwarmPath(directory, path27.join("skills", "proposals"));
|
|
15395
|
-
await
|
|
15453
|
+
await mkdir10(proposalsDir, { recursive: true });
|
|
15396
15454
|
for (const motif of motifs.slice(0, max)) {
|
|
15397
15455
|
const slug = workflowSlug(motif.signature);
|
|
15398
15456
|
const filePath = path27.join(proposalsDir, `${slug}.md`);
|
|
15399
|
-
await
|
|
15457
|
+
await writeFile9(filePath, buildWorkflowProposal(motif), "utf-8");
|
|
15400
15458
|
result.proposalsWritten.push(filePath);
|
|
15401
15459
|
}
|
|
15402
15460
|
return result;
|
|
@@ -15518,10 +15576,10 @@ function timestampSlug(d) {
|
|
|
15518
15576
|
return d.toISOString().replace(/[:.]/g, "-");
|
|
15519
15577
|
}
|
|
15520
15578
|
async function atomicWrite(p, content) {
|
|
15521
|
-
await
|
|
15579
|
+
await mkdir11(path28.dirname(p), { recursive: true });
|
|
15522
15580
|
const tmp = `${p}.tmp-${process.pid}-${Date.now()}`;
|
|
15523
|
-
await
|
|
15524
|
-
await
|
|
15581
|
+
await writeFile10(tmp, content, "utf-8");
|
|
15582
|
+
await rename6(tmp, p);
|
|
15525
15583
|
}
|
|
15526
15584
|
async function gatherInventory(directory) {
|
|
15527
15585
|
const swarm = await readKnowledge(resolveSwarmKnowledgePath(directory));
|
|
@@ -15535,7 +15593,7 @@ async function gatherInventory(directory) {
|
|
|
15535
15593
|
for (const skill of skills.active) {
|
|
15536
15594
|
let content;
|
|
15537
15595
|
try {
|
|
15538
|
-
content = await
|
|
15596
|
+
content = await readFile10(skill.path, "utf-8");
|
|
15539
15597
|
} catch {
|
|
15540
15598
|
continue;
|
|
15541
15599
|
}
|
|
@@ -15711,7 +15769,7 @@ async function reconcileStaleActiveSkills(directory, options = {}) {
|
|
|
15711
15769
|
for (const skill of skills.active) {
|
|
15712
15770
|
let content;
|
|
15713
15771
|
try {
|
|
15714
|
-
content = await
|
|
15772
|
+
content = await readFile10(skill.path, "utf-8");
|
|
15715
15773
|
} catch {
|
|
15716
15774
|
continue;
|
|
15717
15775
|
}
|
|
@@ -16814,7 +16872,7 @@ async function runFinalizeStage(ctx) {
|
|
|
16814
16872
|
}
|
|
16815
16873
|
}
|
|
16816
16874
|
try {
|
|
16817
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
16875
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-13bnng2n.js");
|
|
16818
16876
|
const { config: pmLoadedConfig } = _internals25.loadPluginConfigWithMeta(ctx.directory);
|
|
16819
16877
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
16820
16878
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -17878,7 +17936,7 @@ async function handleConfigCommand(directory, _args) {
|
|
|
17878
17936
|
|
|
17879
17937
|
// src/services/skill-consolidation.ts
|
|
17880
17938
|
import { existsSync as existsSync19 } from "fs";
|
|
17881
|
-
import { mkdir as
|
|
17939
|
+
import { mkdir as mkdir12, readFile as readFile11, rename as rename7, writeFile as writeFile11 } from "fs/promises";
|
|
17882
17940
|
import * as path33 from "path";
|
|
17883
17941
|
var DEFAULT_CONSOLIDATION_INTERVAL_HOURS = 24;
|
|
17884
17942
|
var DEFAULT_CONSOLIDATION_MAX_CALLS_PER_RUN = 1;
|
|
@@ -17892,7 +17950,7 @@ async function readState2(directory) {
|
|
|
17892
17950
|
if (!existsSync19(filePath))
|
|
17893
17951
|
return {};
|
|
17894
17952
|
try {
|
|
17895
|
-
const parsed = JSON.parse(await
|
|
17953
|
+
const parsed = JSON.parse(await readFile11(filePath, "utf-8"));
|
|
17896
17954
|
if (!parsed || typeof parsed !== "object")
|
|
17897
17955
|
return {};
|
|
17898
17956
|
return parsed;
|
|
@@ -17901,10 +17959,10 @@ async function readState2(directory) {
|
|
|
17901
17959
|
}
|
|
17902
17960
|
}
|
|
17903
17961
|
async function atomicWrite2(filePath, content) {
|
|
17904
|
-
await
|
|
17962
|
+
await mkdir12(path33.dirname(filePath), { recursive: true });
|
|
17905
17963
|
const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
17906
|
-
await
|
|
17907
|
-
await
|
|
17964
|
+
await writeFile11(tmp, content, "utf-8");
|
|
17965
|
+
await rename7(tmp, filePath);
|
|
17908
17966
|
}
|
|
17909
17967
|
async function writeState2(directory, state) {
|
|
17910
17968
|
await atomicWrite2(consolidationStatePath(directory), `${JSON.stringify(state, null, 2)}
|
|
@@ -18191,7 +18249,7 @@ import { promisify as promisify2 } from "util";
|
|
|
18191
18249
|
// src/tools/co-change-analyzer.ts
|
|
18192
18250
|
import * as child_process4 from "child_process";
|
|
18193
18251
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
18194
|
-
import { readdir, readFile as
|
|
18252
|
+
import { readdir, readFile as readFile12, stat as stat3 } from "fs/promises";
|
|
18195
18253
|
import * as path34 from "path";
|
|
18196
18254
|
import { promisify } from "util";
|
|
18197
18255
|
function getExecFileAsync() {
|
|
@@ -18318,7 +18376,7 @@ async function getStaticEdges(directory) {
|
|
|
18318
18376
|
const sourceFiles = await scanSourceFiles(directory);
|
|
18319
18377
|
for (const sourceFile of sourceFiles) {
|
|
18320
18378
|
try {
|
|
18321
|
-
const content = await
|
|
18379
|
+
const content = await readFile12(sourceFile, "utf-8");
|
|
18322
18380
|
const importRegex = /(?:import|require)\s*(?:\(?\s*['"`]|.*?from\s+['"`])([^'"`]+)['"`]/g;
|
|
18323
18381
|
for (let match = importRegex.exec(content);match !== null; match = importRegex.exec(content)) {
|
|
18324
18382
|
const importPath = match[1].trim();
|
|
@@ -18965,9 +19023,9 @@ var _internals29 = {
|
|
|
18965
19023
|
readSwarmFileAsync,
|
|
18966
19024
|
loadCuratorDeps: async () => {
|
|
18967
19025
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
18968
|
-
import("./schema-
|
|
18969
|
-
import("./curator-
|
|
18970
|
-
import("./curator-llm-factory-
|
|
19026
|
+
import("./schema-13bnng2n.js"),
|
|
19027
|
+
import("./curator-qfh07497.js"),
|
|
19028
|
+
import("./curator-llm-factory-x769hn66.js")
|
|
18971
19029
|
]);
|
|
18972
19030
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
18973
19031
|
}
|
|
@@ -19465,7 +19523,7 @@ import { fileURLToPath } from "url";
|
|
|
19465
19523
|
// package.json
|
|
19466
19524
|
var package_default = {
|
|
19467
19525
|
name: "opencode-swarm",
|
|
19468
|
-
version: "7.
|
|
19526
|
+
version: "7.122.1",
|
|
19469
19527
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
19470
19528
|
main: "dist/index.js",
|
|
19471
19529
|
types: "dist/index.d.ts",
|
|
@@ -19639,7 +19697,7 @@ init_executor();
|
|
|
19639
19697
|
|
|
19640
19698
|
// src/services/knowledge-diagnostics.ts
|
|
19641
19699
|
import { existsSync as existsSync21 } from "fs";
|
|
19642
|
-
import { readFile as
|
|
19700
|
+
import { readFile as readFile13 } from "fs/promises";
|
|
19643
19701
|
import { join as join32 } from "path";
|
|
19644
19702
|
|
|
19645
19703
|
// src/services/version-check.ts
|
|
@@ -19716,7 +19774,7 @@ var INSIGHT_BACKLOG_WARN = 50;
|
|
|
19716
19774
|
async function readRawLines(filePath) {
|
|
19717
19775
|
if (!existsSync21(filePath))
|
|
19718
19776
|
return { entries: [], corrupt: 0 };
|
|
19719
|
-
const content = await
|
|
19777
|
+
const content = await readFile13(filePath, "utf-8");
|
|
19720
19778
|
const entries = [];
|
|
19721
19779
|
let corrupt = 0;
|
|
19722
19780
|
for (const line of content.split(`
|
|
@@ -19880,7 +19938,15 @@ async function computeKnowledgeDebug(directory) {
|
|
|
19880
19938
|
synonym_pairs: synonymPairs,
|
|
19881
19939
|
enforced_directives: enforcedDirectives,
|
|
19882
19940
|
escalated_directives: escalatedDirectives,
|
|
19883
|
-
events_by_type: eventsByType
|
|
19941
|
+
events_by_type: eventsByType,
|
|
19942
|
+
shown_vs_applied: {
|
|
19943
|
+
shown: eventsByType.retrieved ?? 0,
|
|
19944
|
+
applied_explicit: eventsByType.applied ?? 0,
|
|
19945
|
+
ignored: eventsByType.ignored ?? 0,
|
|
19946
|
+
contradicted: eventsByType.contradicted ?? 0,
|
|
19947
|
+
violated: eventsByType.violated ?? 0,
|
|
19948
|
+
no_relevant: eventsByType.no_relevant ?? 0
|
|
19949
|
+
}
|
|
19884
19950
|
},
|
|
19885
19951
|
cohort: {
|
|
19886
19952
|
linked: cohortLinked,
|
|
@@ -19906,7 +19972,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
19906
19972
|
let scanCompleted = false;
|
|
19907
19973
|
let scanRemaining = 0;
|
|
19908
19974
|
try {
|
|
19909
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
19975
|
+
const { getScanStatus } = await import("./scan-cursor-hm0aqqae.js");
|
|
19910
19976
|
const status = await getScanStatus(directory);
|
|
19911
19977
|
scanGeneration = status.generation;
|
|
19912
19978
|
scanCompleted = status.completed;
|
|
@@ -19914,19 +19980,19 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
19914
19980
|
} catch {}
|
|
19915
19981
|
let configMatch = null;
|
|
19916
19982
|
try {
|
|
19917
|
-
const { isLinked: isLinked2 } = await import("./knowledge-link-
|
|
19983
|
+
const { isLinked: isLinked2 } = await import("./knowledge-link-4yd2z8ev.js");
|
|
19918
19984
|
if (isLinked2(directory)) {
|
|
19919
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
19985
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-13bnng2n.js");
|
|
19920
19986
|
let config;
|
|
19921
19987
|
try {
|
|
19922
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
19988
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-2j25br0p.js");
|
|
19923
19989
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
19924
19990
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
19925
19991
|
} catch {
|
|
19926
19992
|
config = KnowledgeConfigSchema2.parse({});
|
|
19927
19993
|
}
|
|
19928
19994
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
19929
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
19995
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-4j4qce5a.js");
|
|
19930
19996
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
19931
19997
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
19932
19998
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -19961,7 +20027,7 @@ async function countPendingProposals(directory) {
|
|
|
19961
20027
|
if (!existsSync21(proposalsPath))
|
|
19962
20028
|
return 0;
|
|
19963
20029
|
try {
|
|
19964
|
-
const content = await
|
|
20030
|
+
const content = await readFile13(proposalsPath, "utf-8");
|
|
19965
20031
|
let n = 0;
|
|
19966
20032
|
for (const line of content.split(`
|
|
19967
20033
|
`)) {
|
|
@@ -19983,7 +20049,7 @@ async function safeJsonlCount(filePath) {
|
|
|
19983
20049
|
if (!filePath || !existsSync21(filePath))
|
|
19984
20050
|
return 0;
|
|
19985
20051
|
try {
|
|
19986
|
-
const content = await
|
|
20052
|
+
const content = await readFile13(filePath, "utf-8");
|
|
19987
20053
|
let n = 0;
|
|
19988
20054
|
for (const line of content.split(`
|
|
19989
20055
|
`)) {
|
|
@@ -21104,7 +21170,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
21104
21170
|
const result = runConfigDoctor(config, directory);
|
|
21105
21171
|
let output;
|
|
21106
21172
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
21107
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
21173
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-3ksh1534.js");
|
|
21108
21174
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true);
|
|
21109
21175
|
output = formatDoctorMarkdown(fixResult.result);
|
|
21110
21176
|
} else {
|
|
@@ -21917,7 +21983,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
21917
21983
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
21918
21984
|
}
|
|
21919
21985
|
async function handleEvidenceSummaryCommand(directory) {
|
|
21920
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
21986
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-96ndczbk.js");
|
|
21921
21987
|
const artifact = await buildEvidenceSummary(directory);
|
|
21922
21988
|
if (!artifact) {
|
|
21923
21989
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -27433,6 +27499,9 @@ function serializeAgentSession(s) {
|
|
|
27433
27499
|
},
|
|
27434
27500
|
...s.autoProceedNudgeDone !== undefined && {
|
|
27435
27501
|
autoProceedNudgeDone: s.autoProceedNudgeDone
|
|
27502
|
+
},
|
|
27503
|
+
...s.cachedCohortId !== undefined && {
|
|
27504
|
+
cachedCohortId: s.cachedCohortId
|
|
27436
27505
|
}
|
|
27437
27506
|
};
|
|
27438
27507
|
}
|
|
@@ -27882,7 +27951,7 @@ import { join as join45 } from "path";
|
|
|
27882
27951
|
init_logger();
|
|
27883
27952
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
27884
27953
|
import { existsSync as existsSync32, readFileSync as readFileSync21 } from "fs";
|
|
27885
|
-
import { mkdir as
|
|
27954
|
+
import { mkdir as mkdir13, readFile as readFile14, writeFile as writeFile12 } from "fs/promises";
|
|
27886
27955
|
import * as os9 from "os";
|
|
27887
27956
|
import * as path54 from "path";
|
|
27888
27957
|
async function migrateKnowledgeToExternal(_directory, _config) {
|
|
@@ -27947,9 +28016,9 @@ var _internals44 = {
|
|
|
27947
28016
|
resolveLegacyHiveKnowledgePath,
|
|
27948
28017
|
existsSync: existsSync32,
|
|
27949
28018
|
readFileSync: readFileSync21,
|
|
27950
|
-
readFile:
|
|
27951
|
-
mkdir:
|
|
27952
|
-
writeFile:
|
|
28019
|
+
readFile: readFile14,
|
|
28020
|
+
mkdir: mkdir13,
|
|
28021
|
+
writeFile: writeFile12
|
|
27953
28022
|
};
|
|
27954
28023
|
async function migrateContextToKnowledge(directory, config) {
|
|
27955
28024
|
const sentinelPath = path54.join(directory, ".swarm", ".knowledge-migrated");
|
|
@@ -27973,7 +28042,7 @@ async function migrateContextToKnowledge(directory, config) {
|
|
|
27973
28042
|
skippedReason: "no-context-file"
|
|
27974
28043
|
};
|
|
27975
28044
|
}
|
|
27976
|
-
const contextContent = await
|
|
28045
|
+
const contextContent = await readFile14(contextPath, "utf-8");
|
|
27977
28046
|
if (contextContent.trim().length === 0) {
|
|
27978
28047
|
return {
|
|
27979
28048
|
migrated: false,
|
|
@@ -28762,13 +28831,13 @@ var _internals45 = {
|
|
|
28762
28831
|
};
|
|
28763
28832
|
|
|
28764
28833
|
// src/commands/link.ts
|
|
28765
|
-
import { mkdir as
|
|
28834
|
+
import { mkdir as mkdir15, writeFile as writeFile13 } from "fs/promises";
|
|
28766
28835
|
import * as path56 from "path";
|
|
28767
28836
|
|
|
28768
28837
|
// src/knowledge/family-migration.ts
|
|
28769
28838
|
var import_proper_lockfile5 = __toESM(require_proper_lockfile(), 1);
|
|
28770
28839
|
import { existsSync as existsSync33, readFileSync as readFileSync22 } from "fs";
|
|
28771
|
-
import { mkdir as
|
|
28840
|
+
import { mkdir as mkdir14 } from "fs/promises";
|
|
28772
28841
|
import * as path55 from "path";
|
|
28773
28842
|
|
|
28774
28843
|
// src/knowledge/family-manifest.ts
|
|
@@ -29153,7 +29222,7 @@ async function snapshotSourceFamily(storeDir) {
|
|
|
29153
29222
|
const snapshot = {};
|
|
29154
29223
|
let release = null;
|
|
29155
29224
|
try {
|
|
29156
|
-
await
|
|
29225
|
+
await mkdir14(storeDir, { recursive: true });
|
|
29157
29226
|
} catch {}
|
|
29158
29227
|
try {
|
|
29159
29228
|
release = await import_proper_lockfile5.default.lock(storeDir, {
|
|
@@ -29172,7 +29241,7 @@ async function snapshotSourceFamily(storeDir) {
|
|
|
29172
29241
|
return snapshot;
|
|
29173
29242
|
}
|
|
29174
29243
|
async function migrateKnowledgeFamily(destinationDir, sourceDir) {
|
|
29175
|
-
await
|
|
29244
|
+
await mkdir14(destinationDir, { recursive: true });
|
|
29176
29245
|
let destRelease = null;
|
|
29177
29246
|
try {
|
|
29178
29247
|
destRelease = await import_proper_lockfile5.default.lock(destinationDir, {
|
|
@@ -29322,8 +29391,8 @@ ${formatStatus(directory)}`;
|
|
|
29322
29391
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
29323
29392
|
const config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
29324
29393
|
const fingerprint = cohortConfigFingerprint(buildConfigFingerprintInput(config));
|
|
29325
|
-
await
|
|
29326
|
-
await
|
|
29394
|
+
await mkdir15(linkDir, { recursive: true });
|
|
29395
|
+
await writeFile13(path56.join(linkDir, "cohort-config.json"), JSON.stringify({ fingerprint, updated_at: new Date().toISOString() }, null, 2), "utf-8");
|
|
29327
29396
|
} catch {}
|
|
29328
29397
|
const relinkNote = existing ? `
|
|
29329
29398
|
(Re-linked from previous link "${existing.linkId}".)` : "";
|
|
@@ -29865,14 +29934,14 @@ var CuratorOutputMemoryDecisionSchema = exports_external.object({
|
|
|
29865
29934
|
curatorMemoryDecisions: exports_external.array(CuratorMemoryDecisionSchema).max(20).optional()
|
|
29866
29935
|
}).passthrough();
|
|
29867
29936
|
// src/memory/consolidation-log.ts
|
|
29868
|
-
import { appendFile as
|
|
29937
|
+
import { appendFile as appendFile5, mkdir as mkdir16, readFile as readFile16 } from "fs/promises";
|
|
29869
29938
|
import * as path58 from "path";
|
|
29870
29939
|
var LOG_RELATIVE_PATH = path58.join("memory", "consolidation-log.jsonl");
|
|
29871
29940
|
async function readConsolidationLog(directory) {
|
|
29872
29941
|
const filePath = validateSwarmPath(directory, LOG_RELATIVE_PATH);
|
|
29873
29942
|
let raw;
|
|
29874
29943
|
try {
|
|
29875
|
-
raw = await
|
|
29944
|
+
raw = await readFile16(filePath, "utf-8");
|
|
29876
29945
|
} catch {
|
|
29877
29946
|
return [];
|
|
29878
29947
|
}
|
|
@@ -38263,7 +38332,7 @@ async function handleSpecifyCommand(_directory, args) {
|
|
|
38263
38332
|
|
|
38264
38333
|
// src/services/status-service.ts
|
|
38265
38334
|
import * as fsSync2 from "fs";
|
|
38266
|
-
import { readFile as
|
|
38335
|
+
import { readFile as readFile18 } from "fs/promises";
|
|
38267
38336
|
import * as path76 from "path";
|
|
38268
38337
|
|
|
38269
38338
|
// src/hooks/extractors.ts
|
|
@@ -38824,7 +38893,7 @@ async function safeLineCount(filePath) {
|
|
|
38824
38893
|
try {
|
|
38825
38894
|
if (!fsSync2.existsSync(filePath))
|
|
38826
38895
|
return 0;
|
|
38827
|
-
const content = await
|
|
38896
|
+
const content = await readFile18(filePath, "utf-8");
|
|
38828
38897
|
let n = 0;
|
|
38829
38898
|
for (const line of content.split(`
|
|
38830
38899
|
`)) {
|
|
@@ -39294,7 +39363,7 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
39294
39363
|
async function handleHelpCommand(ctx) {
|
|
39295
39364
|
const targetCommand = ctx.args.join(" ");
|
|
39296
39365
|
if (!targetCommand) {
|
|
39297
|
-
const { buildHelpText } = await import("./index-
|
|
39366
|
+
const { buildHelpText } = await import("./index-jm81nhks.js");
|
|
39298
39367
|
return buildHelpText();
|
|
39299
39368
|
}
|
|
39300
39369
|
const tokens = targetCommand.split(/\s+/);
|
|
@@ -39303,7 +39372,7 @@ async function handleHelpCommand(ctx) {
|
|
|
39303
39372
|
return _internals63.buildDetailedHelp(resolved.key, resolved.entry);
|
|
39304
39373
|
}
|
|
39305
39374
|
const similar = _internals63.findSimilarCommands(targetCommand);
|
|
39306
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
39375
|
+
const { buildHelpText: fullHelp } = await import("./index-jm81nhks.js");
|
|
39307
39376
|
if (similar.length > 0) {
|
|
39308
39377
|
return `Command '/swarm ${targetCommand}' not found.
|
|
39309
39378
|
|
|
@@ -39436,7 +39505,7 @@ var COMMAND_REGISTRY = {
|
|
|
39436
39505
|
},
|
|
39437
39506
|
"guardrail explain": {
|
|
39438
39507
|
handler: async (ctx) => {
|
|
39439
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
39508
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-kj0e9r25.js");
|
|
39440
39509
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
39441
39510
|
},
|
|
39442
39511
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -39446,7 +39515,7 @@ var COMMAND_REGISTRY = {
|
|
|
39446
39515
|
},
|
|
39447
39516
|
"guardrail-explain": {
|
|
39448
39517
|
handler: async (ctx) => {
|
|
39449
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
39518
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-kj0e9r25.js");
|
|
39450
39519
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
39451
39520
|
},
|
|
39452
39521
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -39456,7 +39525,7 @@ var COMMAND_REGISTRY = {
|
|
|
39456
39525
|
},
|
|
39457
39526
|
"guardrail-log": {
|
|
39458
39527
|
handler: async (ctx) => {
|
|
39459
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
39528
|
+
const { handleGuardrailLog } = await import("./guardrail-log-z291m4gw.js");
|
|
39460
39529
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
39461
39530
|
},
|
|
39462
39531
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -40461,11 +40530,11 @@ If a tool modifies a file, it is a CODER tool. Delegate.
|
|
|
40461
40530
|
1a. SCOPE DISCIPLINE \u2014 call declare_scope BEFORE every coder delegation AND before any test_engineer delegation that will write new test files.
|
|
40462
40531
|
- 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/*).
|
|
40463
40532
|
- 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.
|
|
40464
|
-
- If coder or test_engineer returns "WRITE BLOCKED" for a path outside the declared list: call declare_scope again with the missing path added. 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.
|
|
40465
|
-
- Never wrap a file write in eval, bash -c, sh -c, a subshell, or a heredoc-to-file redirect
|
|
40533
|
+
- If coder or test_engineer returns "WRITE BLOCKED" for a path outside the declared list: call declare_scope again with the missing path added. 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.
|
|
40534
|
+
- 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.
|
|
40466
40535
|
- 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.
|
|
40467
40536
|
- 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.
|
|
40468
|
-
- Rationale:
|
|
40537
|
+
- 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.
|
|
40469
40538
|
<!-- BEHAVIORAL_GUIDANCE_END -->
|
|
40470
40539
|
2. ONE agent per message. Send, STOP, wait for response.
|
|
40471
40540
|
Exception: Stage B reviewer/test_engineer gate agents for the SAME completed coder task may be dispatched together before waiting when both gates are required. This exception NEVER applies to coder delegations. Preserve ONE task per coder call.
|
|
@@ -40479,7 +40548,7 @@ If a tool modifies a file, it is a CODER tool. Delegate.
|
|
|
40479
40548
|
<!-- BEHAVIORAL_GUIDANCE_START -->
|
|
40480
40549
|
BATCHING DETECTION \u2014 you are batching if your coder delegation contains ANY of:
|
|
40481
40550
|
- The word "and" connecting two actions ("update X AND add Y")
|
|
40482
|
-
- Multiple FILE
|
|
40551
|
+
- Multiple objectives hidden behind a comma-separated FILE value (use one complete relative path per FILE: line)
|
|
40483
40552
|
- Multiple TASK objectives ("TASK: Refactor the processor and update the config")
|
|
40484
40553
|
- Phrases like "also", "while you're at it", "additionally", "as well"
|
|
40485
40554
|
|
|
@@ -41246,7 +41315,7 @@ Purpose: Ingest issue evidence, trace impact, and transition to the full fix wor
|
|
|
41246
41315
|
ACTION: Load skill ${bundledProjectSkillFileReference("issue-ingest")} immediately. Follow the protocol defined there.
|
|
41247
41316
|
|
|
41248
41317
|
HARD CONSTRAINTS:
|
|
41249
|
-
- Preserve issue evidence, flag missing repro details, and route
|
|
41318
|
+
- Preserve issue evidence, flag missing repro details, and route every delegation through the current session's active-swarm role mapping; no swarm ID receives special behavior.
|
|
41250
41319
|
|
|
41251
41320
|
RECOVERY: At mode entry, read .swarm/issue-reference.json to recover the source issue URL, number, and flags (plan/trace/noRepro) if the mode signal has been lost or context was compacted.
|
|
41252
41321
|
|
|
@@ -42319,7 +42388,7 @@ DO NOT:
|
|
|
42319
42388
|
- Use the semantic diff as a substitute for your own reasoning about correctness
|
|
42320
42389
|
|
|
42321
42390
|
## EXPLORER FINDINGS \u2014 VALIDATE BEFORE REPORTING
|
|
42322
|
-
Explorer agent outputs
|
|
42391
|
+
Explorer agent outputs may contain observations labeled as REVIEW NEEDED, RISKS, VERDICT, BREAKING, COMPATIBLE, or similar judgment language. Treat these as CANDIDATE OBSERVATIONS, not established facts, regardless of the active swarm's user-defined ID.
|
|
42323
42392
|
- BEFORE including any issue-like finding from explorer input in your final report: READ the relevant code yourself and verify the issue independently
|
|
42324
42393
|
- Do NOT adopt the explorer's VERDICT, BREAKING, or COMPATIBLE labels as your own \u2014 you must reach your own conclusion
|
|
42325
42394
|
- Explorer's RISKS section names potential concerns \u2014 you determine if they are actual issues through your own review
|
|
@@ -42665,6 +42734,17 @@ SME is read-only. Cache persistence is Architect's responsibility \u2014 save th
|
|
|
42665
42734
|
|
|
42666
42735
|
// src/agents/index.ts
|
|
42667
42736
|
var warnedAgents = new Set;
|
|
42737
|
+
var NONTRANSIENT_STOP_PROTOCOL = [
|
|
42738
|
+
"",
|
|
42739
|
+
"## NON-TRANSIENT TOOL FAILURE PROTOCOL \u2014 MANDATORY",
|
|
42740
|
+
"Apply this protocol when a tool reports ParserError, ParseError, MissingEndCurlyBrace, CommandNotFoundException, a command-not-found/not-recognized error, or [sandbox] BLOCKED.",
|
|
42741
|
+
"It also applies when guardrails report NON-TRANSIENT STOP or NON-TRANSIENT CIRCUIT BREAKER \u2014 including the third same-category permanent failure:",
|
|
42742
|
+
"1. STOP. Do not retry the same operation with a different command, shell, tool, quoting style, or wrapper.",
|
|
42743
|
+
"2. Treat the failure as structural, not transient. Do not spend retry budget on it.",
|
|
42744
|
+
"3. Report BLOCKED with the exact error category and the command/tool that failed.",
|
|
42745
|
+
"4. Wait for corrected input, environment, scope, or a verified new invocation before continuing."
|
|
42746
|
+
].join(`
|
|
42747
|
+
`);
|
|
42668
42748
|
var _swarmAgentsMap = new Map;
|
|
42669
42749
|
var KNOWN_VARIANT_VALUES = new Set([
|
|
42670
42750
|
"low",
|
|
@@ -43018,8 +43098,12 @@ var loggedFirstCalls = new Set;
|
|
|
43018
43098
|
// src/hooks/guardrails/messages-transform.ts
|
|
43019
43099
|
var TRANSIENT_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504, 529]);
|
|
43020
43100
|
|
|
43021
|
-
// src/hooks/guardrails/
|
|
43022
|
-
var
|
|
43101
|
+
// src/hooks/guardrails/nontransient-circuit.ts
|
|
43102
|
+
var IMMEDIATE_HARD_STOP_CATEGORIES = new Set([
|
|
43103
|
+
"shell_parse_error",
|
|
43104
|
+
"command_not_found",
|
|
43105
|
+
"sandbox_wrapper_failure"
|
|
43106
|
+
]);
|
|
43023
43107
|
|
|
43024
43108
|
// src/commands/command-dispatch.ts
|
|
43025
43109
|
function normalizeSwarmCommandInput(command, argumentText) {
|
|
@@ -44703,6 +44787,9 @@ function resolveWriteTargets(command, writes, cwd) {
|
|
|
44703
44787
|
};
|
|
44704
44788
|
});
|
|
44705
44789
|
}
|
|
44790
|
+
|
|
44791
|
+
// src/tools/file-extractor-planner.ts
|
|
44792
|
+
var cachedPlans = new WeakMap;
|
|
44706
44793
|
// src/hooks/guardrails/index.ts
|
|
44707
44794
|
var SPEC_DRIFT_BLOCKED_TOOLS = new Set([
|
|
44708
44795
|
"save_plan",
|
|
@@ -44723,7 +44810,46 @@ var EvidenceTaskIdPlanSchema = exports_external.object({
|
|
|
44723
44810
|
}).passthrough()).optional()
|
|
44724
44811
|
}).passthrough()).optional()
|
|
44725
44812
|
}).passthrough();
|
|
44726
|
-
|
|
44813
|
+
|
|
44814
|
+
class BoundedPendingScopeMap extends Map {
|
|
44815
|
+
expiresAtByKey = new Map;
|
|
44816
|
+
sweepExpired(now = Date.now()) {
|
|
44817
|
+
for (const [key, expiresAt] of this.expiresAtByKey) {
|
|
44818
|
+
if (expiresAt <= now)
|
|
44819
|
+
this.delete(key);
|
|
44820
|
+
}
|
|
44821
|
+
}
|
|
44822
|
+
set(key, value) {
|
|
44823
|
+
this.sweepExpired();
|
|
44824
|
+
this.delete(key);
|
|
44825
|
+
super.set(key, value);
|
|
44826
|
+
this.expiresAtByKey.set(key, Date.now() + 5 * 60000);
|
|
44827
|
+
while (this.size > MAX_PENDING_SCOPE_BINDINGS) {
|
|
44828
|
+
const oldest = this.keys().next().value;
|
|
44829
|
+
if (!oldest)
|
|
44830
|
+
break;
|
|
44831
|
+
this.delete(oldest);
|
|
44832
|
+
}
|
|
44833
|
+
return this;
|
|
44834
|
+
}
|
|
44835
|
+
get(key) {
|
|
44836
|
+
this.sweepExpired();
|
|
44837
|
+
return super.get(key);
|
|
44838
|
+
}
|
|
44839
|
+
has(key) {
|
|
44840
|
+
this.sweepExpired();
|
|
44841
|
+
return super.has(key);
|
|
44842
|
+
}
|
|
44843
|
+
delete(key) {
|
|
44844
|
+
this.expiresAtByKey.delete(key);
|
|
44845
|
+
return super.delete(key);
|
|
44846
|
+
}
|
|
44847
|
+
clear() {
|
|
44848
|
+
this.expiresAtByKey.clear();
|
|
44849
|
+
super.clear();
|
|
44850
|
+
}
|
|
44851
|
+
}
|
|
44852
|
+
var pendingCoderScopeByTaskId = new BoundedPendingScopeMap;
|
|
44727
44853
|
function clearPendingCoderScope() {
|
|
44728
44854
|
pendingCoderScopeByTaskId.clear();
|
|
44729
44855
|
}
|
|
@@ -44834,6 +44960,16 @@ var STATE_ORDER2 = [
|
|
|
44834
44960
|
"tests_run",
|
|
44835
44961
|
"complete"
|
|
44836
44962
|
];
|
|
44963
|
+
function createNonTransientCircuitState(agentName, invocationId) {
|
|
44964
|
+
return {
|
|
44965
|
+
ownerAgent: stripKnownSwarmPrefix(agentName),
|
|
44966
|
+
ownerInvocationId: invocationId,
|
|
44967
|
+
category: null,
|
|
44968
|
+
sameCategoryCount: 0,
|
|
44969
|
+
hardStop: false,
|
|
44970
|
+
lastSignal: null
|
|
44971
|
+
};
|
|
44972
|
+
}
|
|
44837
44973
|
var _toolAggregates = new Map;
|
|
44838
44974
|
var defaultRunContext = new AgentRunContext("default", _toolAggregates);
|
|
44839
44975
|
var _runContexts = new Map;
|
|
@@ -44885,6 +45021,13 @@ function resetSwarmState() {
|
|
|
44885
45021
|
swarmState.fullAutoEnabledInConfig = false;
|
|
44886
45022
|
swarmState.environmentProfiles.clear();
|
|
44887
45023
|
clearPendingCoderScope();
|
|
45024
|
+
for (const binding of clearScopeBindings()) {
|
|
45025
|
+
clearScopeBindingFromDisk({
|
|
45026
|
+
directory: binding.workspaceIdentity,
|
|
45027
|
+
taskId: binding.taskId,
|
|
45028
|
+
ownerSessionId: binding.ownerSessionId
|
|
45029
|
+
});
|
|
45030
|
+
}
|
|
44888
45031
|
resetStandardWorktreeIsolationState();
|
|
44889
45032
|
resetRealtimeLearningNudgeState();
|
|
44890
45033
|
_councilDisagreementWarned.clear();
|
|
@@ -44944,6 +45087,8 @@ function startAgentSession(sessionId, agentName, staleDurationMs = STALE_SESSION
|
|
|
44944
45087
|
activeInvocationId: 0,
|
|
44945
45088
|
lastInvocationIdByAgent: {},
|
|
44946
45089
|
windows: {},
|
|
45090
|
+
nonTransientCircuit: createNonTransientCircuitState(agentName, 0),
|
|
45091
|
+
pendingToolExecutions: new Map,
|
|
44947
45092
|
lastCompactionHint: 0,
|
|
44948
45093
|
architectWriteCount: 0,
|
|
44949
45094
|
lastCoderDelegationTaskId: null,
|
|
@@ -45024,6 +45169,14 @@ function startAgentSession(sessionId, agentName, staleDurationMs = STALE_SESSION
|
|
|
45024
45169
|
}
|
|
45025
45170
|
}
|
|
45026
45171
|
function endAgentSession(sessionId) {
|
|
45172
|
+
const removedBindings = clearScopeBindings((binding) => binding.ownerSessionId === sessionId || binding.parentOwnerSessionId === sessionId);
|
|
45173
|
+
for (const binding of removedBindings) {
|
|
45174
|
+
clearScopeBindingFromDisk({
|
|
45175
|
+
directory: binding.workspaceIdentity,
|
|
45176
|
+
taskId: binding.taskId,
|
|
45177
|
+
ownerSessionId: binding.ownerSessionId
|
|
45178
|
+
});
|
|
45179
|
+
}
|
|
45027
45180
|
swarmState.agentSessions.delete(sessionId);
|
|
45028
45181
|
clearRealtimeLearningNudgeSession(sessionId);
|
|
45029
45182
|
}
|
|
@@ -45040,6 +45193,7 @@ function ensureAgentSession(sessionId, agentName, directory) {
|
|
|
45040
45193
|
telemetry.agentActivated(sessionId, agentName, oldName);
|
|
45041
45194
|
session.delegationActive = false;
|
|
45042
45195
|
session.lastAgentEventTime = now;
|
|
45196
|
+
session.nonTransientCircuit = createNonTransientCircuitState(agentName, 0);
|
|
45043
45197
|
if (!session.windows) {
|
|
45044
45198
|
session.activeInvocationId = 0;
|
|
45045
45199
|
session.lastInvocationIdByAgent = {};
|
|
@@ -45051,6 +45205,12 @@ function ensureAgentSession(sessionId, agentName, directory) {
|
|
|
45051
45205
|
session.lastInvocationIdByAgent = {};
|
|
45052
45206
|
session.windows = {};
|
|
45053
45207
|
}
|
|
45208
|
+
if (session.nonTransientCircuit === undefined) {
|
|
45209
|
+
session.nonTransientCircuit = createNonTransientCircuitState(session.agentName, session.activeInvocationId ?? 0);
|
|
45210
|
+
}
|
|
45211
|
+
if (session.pendingToolExecutions === undefined) {
|
|
45212
|
+
session.pendingToolExecutions = new Map;
|
|
45213
|
+
}
|
|
45054
45214
|
if (session.lastCompactionHint === undefined) {
|
|
45055
45215
|
session.lastCompactionHint = 0;
|
|
45056
45216
|
}
|
|
@@ -45203,13 +45363,14 @@ function beginInvocation(sessionId, agentName) {
|
|
|
45203
45363
|
throw new Error(`Cannot begin invocation: session ${sessionId} does not exist`);
|
|
45204
45364
|
}
|
|
45205
45365
|
const stripped = stripKnownSwarmPrefix(agentName);
|
|
45206
|
-
if (stripped === ORCHESTRATOR_NAME) {
|
|
45207
|
-
return null;
|
|
45208
|
-
}
|
|
45209
45366
|
const lastId = session.lastInvocationIdByAgent[stripped] || 0;
|
|
45210
45367
|
const newId = lastId + 1;
|
|
45211
45368
|
session.lastInvocationIdByAgent[stripped] = newId;
|
|
45212
45369
|
session.activeInvocationId = newId;
|
|
45370
|
+
session.nonTransientCircuit = createNonTransientCircuitState(stripped, newId);
|
|
45371
|
+
if (stripped === ORCHESTRATOR_NAME) {
|
|
45372
|
+
return null;
|
|
45373
|
+
}
|
|
45213
45374
|
const now = Date.now();
|
|
45214
45375
|
const window = {
|
|
45215
45376
|
id: newId,
|