opencode-swarm 7.143.6 → 7.144.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.
Files changed (51) hide show
  1. package/dist/background/delegation-health.d.ts +213 -0
  2. package/dist/background/pending-delegations.d.ts +122 -15
  3. package/dist/cli/{config-doctor-72zp0k4x.js → config-doctor-7gy47evn.js} +2 -2
  4. package/dist/cli/{core-aj0wmbg8.js → core-cpcspaw5.js} +1 -1
  5. package/dist/cli/{curator-llm-factory-x1vjhrnc.js → curator-llm-factory-fyjmgxyp.js} +18 -18
  6. package/dist/cli/{curator-2gt2835v.js → curator-v97jnwn2.js} +18 -18
  7. package/dist/cli/{evidence-summary-service-yjr0662r.js → evidence-summary-service-79mtxzhd.js} +6 -6
  8. package/dist/cli/{gate-evidence-r3c7eqpz.js → gate-evidence-kgyqz1g1.js} +2 -2
  9. package/dist/cli/{guardrail-explain-f3zysesy.js → guardrail-explain-9ry66z5g.js} +19 -19
  10. package/dist/cli/{guardrail-log-eat71fnh.js → guardrail-log-fe6smme1.js} +3 -3
  11. package/dist/cli/{hive-promoter-fyb40am9.js → hive-promoter-vwq1dbh1.js} +18 -18
  12. package/dist/cli/{index-hjy4txgr.js → index-0ck3e366.js} +1 -1
  13. package/dist/cli/{index-peqmw3wr.js → index-1pr8x10a.js} +2 -2
  14. package/dist/cli/{index-02nm8qhk.js → index-269b52r3.js} +3 -3
  15. package/dist/cli/{index-7bs015gm.js → index-3q9w6e6v.js} +1 -1
  16. package/dist/cli/{index-w1q9yy1e.js → index-3v3dxf75.js} +3 -3
  17. package/dist/cli/{index-6vmazy9f.js → index-4fda8kkw.js} +1050 -88
  18. package/dist/cli/{index-fn0k0vsa.js → index-6p09gyra.js} +1 -1
  19. package/dist/cli/{index-kc2x117y.js → index-8xertnqz.js} +3 -3
  20. package/dist/cli/{index-36vry26a.js → index-d45d4zyq.js} +1 -1
  21. package/dist/cli/{index-nd1j9wkw.js → index-d45yrzkg.js} +1 -1
  22. package/dist/cli/{index-dtf2va28.js → index-e70d3xr7.js} +20 -20
  23. package/dist/cli/{index-whyrhjsk.js → index-evvbmbbv.js} +1 -1
  24. package/dist/cli/{index-gzxz0s50.js → index-ewzmjm7m.js} +1 -1
  25. package/dist/cli/{index-0adcjpyx.js → index-ez18gjk2.js} +3 -3
  26. package/dist/cli/{index-5d8ydxae.js → index-j1scj25g.js} +129 -50
  27. package/dist/cli/{index-wjk00vwk.js → index-jqabjy7t.js} +4 -4
  28. package/dist/cli/{index-bbv64s17.js → index-jvbfrwt2.js} +1 -1
  29. package/dist/cli/{index-92bm9ys3.js → index-mw6p3nt6.js} +1 -1
  30. package/dist/cli/{index-72zhsqgy.js → index-rd2082y4.js} +2 -2
  31. package/dist/cli/{index-s7nb33pc.js → index-tfkfyshg.js} +1 -1
  32. package/dist/cli/{index-scj2asek.js → index-vb9cpaz4.js} +5 -5
  33. package/dist/cli/{index-z4cv77tq.js → index-zv4pwyas.js} +2 -2
  34. package/dist/cli/index.js +18 -18
  35. package/dist/cli/{knowledge-escalator-ejpyrby0.js → knowledge-escalator-rmy3jcx4.js} +6 -6
  36. package/dist/cli/{knowledge-events-yw2kydyy.js → knowledge-events-1tqpbwvj.js} +4 -4
  37. package/dist/cli/{knowledge-store-j6gkk62e.js → knowledge-store-389ck792.js} +1 -1
  38. package/dist/cli/{knowledge-validator-xervpe5k.js → knowledge-validator-kvtk6633.js} +2 -2
  39. package/dist/cli/{pending-delegations-19wg9j08.js → pending-delegations-thy8g30k.js} +23 -1
  40. package/dist/cli/{scan-cursor-x7a99wmq.js → scan-cursor-ahgm4f5p.js} +2 -2
  41. package/dist/cli/{schema-z141arx9.js → schema-epdq7ykx.js} +1 -1
  42. package/dist/cli/{scope-persistence-js90c1f4.js → scope-persistence-37s9n40v.js} +4 -4
  43. package/dist/cli/{skill-generator-t202jza0.js → skill-generator-4d2t5gem.js} +7 -7
  44. package/dist/cli/{worktree-collision-ownership-42bb3gcb.js → worktree-collision-ownership-j6d33p49.js} +1 -1
  45. package/dist/cli/{worktree-isolation-fbfvxw9a.js → worktree-isolation-4628yaka.js} +18 -18
  46. package/dist/evaluation/contracts.d.ts +4 -4
  47. package/dist/evaluation/gate-ground-truth.d.ts +1 -1
  48. package/dist/hooks/init-orphan-recovery.d.ts +2 -0
  49. package/dist/index.js +439 -436
  50. package/dist/services/status-service.d.ts +9 -0
  51. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  stableCanonicalStringify
4
- } from "./index-nd1j9wkw.js";
4
+ } from "./index-d45yrzkg.js";
5
5
  import {
6
6
  detectStraySwarmDirs,
7
7
  readDoctorArtifact,
8
8
  removeStraySwarmDir,
9
9
  runConfigDoctor
10
- } from "./index-whyrhjsk.js";
10
+ } from "./index-evvbmbbv.js";
11
11
  import {
12
12
  MAX_TRANSIENT_RETRIES,
13
13
  archiveEvidence,
@@ -54,7 +54,7 @@ import {
54
54
  updateTaskCheckpointReceipt,
55
55
  updateTaskStatus,
56
56
  validateProjectRoot
57
- } from "./index-w1q9yy1e.js";
57
+ } from "./index-3v3dxf75.js";
58
58
  import {
59
59
  loadDatabaseCtor
60
60
  } from "./index-134d35c1.js";
@@ -106,7 +106,7 @@ import {
106
106
  alreadyCuratedThisGeneration,
107
107
  claimNextScanBatch,
108
108
  resolveCohortId
109
- } from "./index-92bm9ys3.js";
109
+ } from "./index-mw6p3nt6.js";
110
110
  import {
111
111
  CURATOR_INIT_PROMPT,
112
112
  CURATOR_PHASE_PROMPT,
@@ -141,7 +141,7 @@ import {
141
141
  startupOrphanRecovery,
142
142
  withTaskEvidenceTransaction,
143
143
  writeWorkflowWalFile
144
- } from "./index-bbv64s17.js";
144
+ } from "./index-jvbfrwt2.js";
145
145
  import {
146
146
  changedFilesSinceSnapshot,
147
147
  parsePorcelainV2Snapshot,
@@ -188,16 +188,16 @@ import {
188
188
  retireSkill,
189
189
  selectCandidateEntries,
190
190
  syncBundledProjectSkillsIfMissingAsync
191
- } from "./index-02nm8qhk.js";
191
+ } from "./index-269b52r3.js";
192
192
  import {
193
193
  readRecentEscalations
194
- } from "./index-scj2asek.js";
194
+ } from "./index-vb9cpaz4.js";
195
195
  import {
196
196
  MAX_PENDING_SCOPE_BINDINGS,
197
197
  clearAllScopes,
198
198
  clearScopeBindingFromDisk,
199
199
  clearScopeBindings
200
- } from "./index-z4cv77tq.js";
200
+ } from "./index-zv4pwyas.js";
201
201
  import {
202
202
  appendLedgerEvent,
203
203
  computePlanHash,
@@ -210,7 +210,7 @@ import {
210
210
  readPlanEpochIdentity,
211
211
  replayFromLedgerWithStatus,
212
212
  takeSnapshotEvent
213
- } from "./index-hjy4txgr.js";
213
+ } from "./index-0ck3e366.js";
214
214
  import {
215
215
  isPathWithinDeclaredScope
216
216
  } from "./index-556ja8an.js";
@@ -233,14 +233,18 @@ import {
233
233
  } from "./index-k3cxyk66.js";
234
234
  import {
235
235
  DEFAULT_STALE_DELEGATION_TIMEOUT_MS,
236
+ DELEGATION_COMPACTION_HIGH_WATER_BYTES,
237
+ DELEGATION_COMPACTION_LOW_WATER_BYTES,
238
+ MAX_RECOVERY_LEDGER_BYTES,
239
+ collectDelegationLedgerHealth,
236
240
  findByBatchId,
237
241
  readDelegations,
238
242
  sweepStaleDelegations
239
- } from "./index-6vmazy9f.js";
243
+ } from "./index-4fda8kkw.js";
240
244
  import {
241
245
  provisionWorktree,
242
246
  removeWorktree
243
- } from "./index-s7nb33pc.js";
247
+ } from "./index-tfkfyshg.js";
244
248
  import {
245
249
  SandboxCapabilityProbe,
246
250
  init_capability_probe
@@ -264,10 +268,10 @@ import {
264
268
  recordKnowledgeEvent,
265
269
  recordPhaseCloseIntent,
266
270
  resolveKnowledgeEventsPath
267
- } from "./index-0adcjpyx.js";
271
+ } from "./index-ez18gjk2.js";
268
272
  import {
269
273
  resolveWorktreeIsolationConfig
270
- } from "./index-peqmw3wr.js";
274
+ } from "./index-1pr8x10a.js";
271
275
  import {
272
276
  RetrospectiveEvidenceSchema
273
277
  } from "./index-gprxjmm7.js";
@@ -277,7 +281,7 @@ import {
277
281
  init_loader,
278
282
  loadPluginConfig,
279
283
  loadPluginConfigWithMeta
280
- } from "./index-36vry26a.js";
284
+ } from "./index-d45d4zyq.js";
281
285
  import {
282
286
  DEFAULT_SKILL_OPT_CONFIG,
283
287
  FALLBACK_MODELS_MAX,
@@ -291,7 +295,7 @@ import {
291
295
  package_default,
292
296
  resolveAutoReviewConfig,
293
297
  stripKnownSwarmPrefix
294
- } from "./index-7bs015gm.js";
298
+ } from "./index-3q9w6e6v.js";
295
299
  import {
296
300
  readSwarmFileAsync,
297
301
  safeHook,
@@ -326,7 +330,7 @@ import {
326
330
  validateActionableFields,
327
331
  validateLesson,
328
332
  validateSkillPath
329
- } from "./index-gzxz0s50.js";
333
+ } from "./index-ewzmjm7m.js";
330
334
  import {
331
335
  authorizeCuration,
332
336
  buildConfigFingerprintInput
@@ -363,7 +367,7 @@ import {
363
367
  transactFile,
364
368
  transactKnowledge,
365
369
  wordBigrams
366
- } from "./index-wjk00vwk.js";
370
+ } from "./index-jqabjy7t.js";
367
371
  import {
368
372
  resolveHiveDataDir,
369
373
  resolveHiveEventsPath,
@@ -4155,7 +4159,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
4155
4159
  awaitingMergeByCallID,
4156
4160
  cleanupStandardWorktreeForCallId,
4157
4161
  standardWorktreeByCallID
4158
- } = await import("./worktree-isolation-fbfvxw9a.js");
4162
+ } = await import("./worktree-isolation-4628yaka.js");
4159
4163
  standardWorktreeByCallID.delete(descriptor.callID);
4160
4164
  if (hasResidue)
4161
4165
  awaitingMergeByCallID.set(descriptor.callID, {
@@ -4234,7 +4238,7 @@ async function recoverCoderSettlement(directory, taskId) {
4234
4238
  awaitingMergeByCallID,
4235
4239
  finishStandardWorktreeDispatch,
4236
4240
  standardWorktreeByCallID
4237
- } = await import("./worktree-isolation-fbfvxw9a.js");
4241
+ } = await import("./worktree-isolation-4628yaka.js");
4238
4242
  const descriptor = wal.worktree;
4239
4243
  const reconstructedDispatch = {
4240
4244
  callID: descriptor.callID,
@@ -15106,7 +15110,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
15106
15110
  };
15107
15111
  }
15108
15112
  async function sweepActiveNearDuplicates(directory, options = {}) {
15109
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-kc2x117y.js");
15113
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-8xertnqz.js");
15110
15114
  const { config } = loadPluginConfigWithMeta2(directory);
15111
15115
  const sweepConfig = config.learning?.dedup_sweep;
15112
15116
  if (sweepConfig?.enabled === false)
@@ -16190,7 +16194,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
16190
16194
  }
16191
16195
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
16192
16196
  try {
16193
- const skillModule = await import("./skill-generator-t202jza0.js");
16197
+ const skillModule = await import("./skill-generator-4d2t5gem.js");
16194
16198
  for (const cand of skillCandidates) {
16195
16199
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
16196
16200
  continue;
@@ -16650,7 +16654,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
16650
16654
  } catch {}
16651
16655
  }
16652
16656
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
16653
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-ejpyrby0.js");
16657
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-rmy3jcx4.js");
16654
16658
  for (const { id } of contradictedEntries) {
16655
16659
  try {
16656
16660
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -17469,7 +17473,7 @@ async function runCuratorPostMortem(directory, options = {}) {
17469
17473
  warnings.push("Failed to collect knowledge summary.");
17470
17474
  }
17471
17475
  try {
17472
- const { getScanStatus } = await import("./scan-cursor-x7a99wmq.js");
17476
+ const { getScanStatus } = await import("./scan-cursor-ahgm4f5p.js");
17473
17477
  const scanStatus = await getScanStatus(directory);
17474
17478
  if (scanStatus.remaining_estimate > 0) {
17475
17479
  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.`);
@@ -17641,9 +17645,9 @@ var _internals23 = {
17641
17645
  verifyPostMortemKnowledgeActions,
17642
17646
  repairPostMortemActions,
17643
17647
  loadDefaultKnowledgeConfig: async (directory) => {
17644
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-z141arx9.js");
17648
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-epdq7ykx.js");
17645
17649
  try {
17646
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-kc2x117y.js");
17650
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-8xertnqz.js");
17647
17651
  const loaded = loadPluginConfigWithMeta2(directory);
17648
17652
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
17649
17653
  } catch {
@@ -17651,11 +17655,11 @@ var _internals23 = {
17651
17655
  }
17652
17656
  },
17653
17657
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
17654
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-2gt2835v.js");
17658
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-v97jnwn2.js");
17655
17659
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
17656
17660
  },
17657
17661
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
17658
- const { checkHivePromotions } = await import("./hive-promoter-fyb40am9.js");
17662
+ const { checkHivePromotions } = await import("./hive-promoter-vwq1dbh1.js");
17659
17663
  return checkHivePromotions(entries, knowledgeConfig, directory);
17660
17664
  },
17661
17665
  applyProposalTriage: async (directory, triage) => {
@@ -17664,7 +17668,7 @@ var _internals23 = {
17664
17668
  activateProposal,
17665
17669
  listSkills: listSkills2,
17666
17670
  sanitizeSlug
17667
- } = await import("./skill-generator-t202jza0.js");
17671
+ } = await import("./skill-generator-4d2t5gem.js");
17668
17672
  const result = {
17669
17673
  approved: [],
17670
17674
  rejected: [],
@@ -19000,9 +19004,9 @@ function hashContent(content) {
19000
19004
  return createHash7("sha1").update(content).digest("hex");
19001
19005
  }
19002
19006
  async function loadConfigForPolicyCurator(directory) {
19003
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-z141arx9.js");
19007
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-epdq7ykx.js");
19004
19008
  try {
19005
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-kc2x117y.js");
19009
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-8xertnqz.js");
19006
19010
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
19007
19011
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
19008
19012
  } catch {
@@ -27442,7 +27446,11 @@ var ARCHIVE_ARTIFACTS = [
27442
27446
  "session-reflection.md",
27443
27447
  "spec.md",
27444
27448
  "spec-staleness.json",
27445
- "spec-snapshot.md"
27449
+ "spec-snapshot.md",
27450
+ "background-delegations.jsonl",
27451
+ "background-delegations.checkpoint.json",
27452
+ "background-delegations.manifest.json",
27453
+ "background-delegations-health.json"
27446
27454
  ];
27447
27455
  var ACTIVE_STATE_TO_CLEAN = [
27448
27456
  "plan.json",
@@ -27844,7 +27852,7 @@ async function runFinalizeStage(ctx) {
27844
27852
  }
27845
27853
  }
27846
27854
  try {
27847
- const { CuratorConfigSchema: CCS } = await import("./schema-z141arx9.js");
27855
+ const { CuratorConfigSchema: CCS } = await import("./schema-epdq7ykx.js");
27848
27856
  const { config: pmLoadedConfig } = _internals36.loadPluginConfigWithMeta(ctx.directory);
27849
27857
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
27850
27858
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -30122,9 +30130,9 @@ var _internals41 = {
30122
30130
  loadPluginConfigWithMeta,
30123
30131
  loadCuratorDeps: async () => {
30124
30132
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
30125
- import("./schema-z141arx9.js"),
30126
- import("./curator-2gt2835v.js"),
30127
- import("./curator-llm-factory-x1vjhrnc.js")
30133
+ import("./schema-epdq7ykx.js"),
30134
+ import("./curator-v97jnwn2.js"),
30135
+ import("./curator-llm-factory-fyjmgxyp.js")
30128
30136
  ]);
30129
30137
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
30130
30138
  }
@@ -31029,7 +31037,7 @@ async function computeCurationDiagnostics(directory, entries) {
31029
31037
  let scanCompleted = false;
31030
31038
  let scanRemaining = 0;
31031
31039
  try {
31032
- const { getScanStatus } = await import("./scan-cursor-x7a99wmq.js");
31040
+ const { getScanStatus } = await import("./scan-cursor-ahgm4f5p.js");
31033
31041
  const status = await getScanStatus(directory);
31034
31042
  scanGeneration = status.generation;
31035
31043
  scanCompleted = status.completed;
@@ -31039,10 +31047,10 @@ async function computeCurationDiagnostics(directory, entries) {
31039
31047
  try {
31040
31048
  const { isLinked: isLinked2 } = await import("./knowledge-link-fn5j3r4q.js");
31041
31049
  if (isLinked2(directory)) {
31042
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-z141arx9.js");
31050
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-epdq7ykx.js");
31043
31051
  let config;
31044
31052
  try {
31045
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-kc2x117y.js");
31053
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-8xertnqz.js");
31046
31054
  const loaded = loadPluginConfigWithMeta2(directory);
31047
31055
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
31048
31056
  } catch {
@@ -32260,7 +32268,7 @@ async function handleDoctorCommand(directory, args) {
32260
32268
  const result = runConfigDoctor(config, directory);
32261
32269
  let output;
32262
32270
  if (enableAutoFix && result.hasAutoFixableIssues) {
32263
- const { runConfigDoctorWithFixes } = await import("./config-doctor-72zp0k4x.js");
32271
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-7gy47evn.js");
32264
32272
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
32265
32273
  applyLossy: true
32266
32274
  });
@@ -33097,7 +33105,7 @@ async function handleEvidenceCommand(directory, args) {
33097
33105
  return formatTaskEvidenceMarkdown(evidenceData);
33098
33106
  }
33099
33107
  async function handleEvidenceSummaryCommand(directory) {
33100
- const { buildEvidenceSummary } = await import("./evidence-summary-service-yjr0662r.js");
33108
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-79mtxzhd.js");
33101
33109
  const artifact = await buildEvidenceSummary(directory);
33102
33110
  if (!artifact) {
33103
33111
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -56479,11 +56487,11 @@ async function handleSpecifyCommand(_directory, args) {
56479
56487
  }
56480
56488
 
56481
56489
  // src/services/status-service.ts
56482
- init_loader();
56483
- init_schema();
56484
56490
  import * as fsSync3 from "fs";
56485
56491
  import { readFile as readFile23 } from "fs/promises";
56486
56492
  import * as path100 from "path";
56493
+ init_loader();
56494
+ init_schema();
56487
56495
 
56488
56496
  // src/consensus/store.ts
56489
56497
  import { readdir as readdir5, unlink as unlink4 } from "fs/promises";
@@ -56880,6 +56888,15 @@ var _internals85 = {
56880
56888
  getActiveFullAutoSessionID,
56881
56889
  loadFullAutoRunState
56882
56890
  };
56891
+ function formatLedgerBytes(bytes) {
56892
+ if (bytes >= 1024 * 1024) {
56893
+ return `${Math.round(bytes / (1024 * 1024) * 10) / 10} MiB`;
56894
+ }
56895
+ if (bytes >= 1024) {
56896
+ return `${Math.round(bytes / 1024 * 10) / 10} KiB`;
56897
+ }
56898
+ return `${bytes} B`;
56899
+ }
56883
56900
  function readSpecStalenessSnapshot(directory) {
56884
56901
  try {
56885
56902
  const p = path100.join(directory, ".swarm", "spec-staleness.json");
@@ -56997,6 +57014,15 @@ async function getStatusData(directory, agents, sessionId) {
56997
57014
  } catch {
56998
57015
  status.consensusReports = 0;
56999
57016
  }
57017
+ try {
57018
+ status.delegationLedgerHealth = collectDelegationLedgerHealth(directory, {
57019
+ ledgerLimitBytes: MAX_RECOVERY_LEDGER_BYTES,
57020
+ lowWaterBytes: DELEGATION_COMPACTION_LOW_WATER_BYTES,
57021
+ highWaterBytes: DELEGATION_COMPACTION_HIGH_WATER_BYTES
57022
+ }) ?? undefined;
57023
+ } catch {
57024
+ status.delegationLedgerHealth = undefined;
57025
+ }
57000
57026
  try {
57001
57027
  const pointer = readLinkPointer(directory);
57002
57028
  if (pointer) {
@@ -57295,6 +57321,32 @@ function formatStatusMarkdown(status) {
57295
57321
  } else {
57296
57322
  lines.push("", "**Memory Cohort**: local (not linked \u2014 run `/swarm memory link` to share memory across worktrees; requires `memory.link.enabled: true`)");
57297
57323
  }
57324
+ const delegationHealth = status.delegationLedgerHealth;
57325
+ if (delegationHealth) {
57326
+ lines.push("", "**Background Delegations**:");
57327
+ lines.push(` - Ledger tail: ${formatLedgerBytes(delegationHealth.ledger.bytes)} / ${formatLedgerBytes(delegationHealth.ledger.limitBytes)} recovery bound (${delegationHealth.ledger.pressurePct}% \u2014 ${delegationHealth.ledger.band})`);
57328
+ if (delegationHealth.checkpoint) {
57329
+ const checkpoint2 = delegationHealth.checkpoint;
57330
+ lines.push(` - Checkpoint #${checkpoint2.sequence}: ${checkpoint2.liveRecords} live records, ${checkpoint2.closedSummaries} archived summaries (${formatLedgerBytes(checkpoint2.bytes)}, ${new Date(checkpoint2.createdAt).toISOString()})`);
57331
+ } else {
57332
+ lines.push(" - Checkpoint: none (full-history recovery)");
57333
+ }
57334
+ if (delegationHealth.recovery) {
57335
+ const recovery = delegationHealth.recovery;
57336
+ lines.push(` - Recovery: ${recovery.source} (${recovery.ok ? "ok" : `FAILED: ${recovery.reason ?? "uncertain"}`})`);
57337
+ }
57338
+ if (delegationHealth.lastUncertainty) {
57339
+ const uncertainty = delegationHealth.lastUncertainty;
57340
+ lines.push(` - \u26A0 Last uncertainty (${new Date(uncertainty.at).toISOString()}, ${uncertainty.source}): ${uncertainty.reason}`);
57341
+ if (uncertainty.repairHint) {
57342
+ lines.push(` repair: ${uncertainty.repairHint}`);
57343
+ }
57344
+ }
57345
+ const counts = delegationHealth.counts;
57346
+ if (counts.activeOwners > 0 || counts.pendingAdvisories > 0 || counts.lateTerminals > 0 || counts.orphanWorktreeOwners > 0) {
57347
+ lines.push(` - Live set: ${counts.activeOwners} active owners, ${counts.pendingAdvisories} pending advisories, ${counts.lateTerminals} late terminals, ${counts.orphanWorktreeOwners} unsettled worktree owners`);
57348
+ }
57349
+ }
57298
57350
  return lines.join(`
57299
57351
  `);
57300
57352
  }
@@ -57311,6 +57363,33 @@ async function handleStatusCommand(directory, agents, sessionId) {
57311
57363
  `**Spec drift detected**: ${reason} (stored: ${stored}, current: ${current})`,
57312
57364
  "Run `/swarm clarify` to enter spec repair mode. Clarify alone does not clear drift: rewrite the spec so recovery can reconcile it, or run `/swarm acknowledge-spec-drift` to dismiss."
57313
57365
  ].join(`
57366
+ `);
57367
+ }
57368
+ const delegationHealth = statusData.delegationLedgerHealth;
57369
+ if (delegationHealth && (delegationHealth.checkpoint || delegationHealth.recovery || delegationHealth.lastUncertainty || delegationHealth.ledger.band !== "ok" || delegationHealth.counts.activeOwners > 0 || delegationHealth.counts.pendingAdvisories > 0 || delegationHealth.counts.lateTerminals > 0 || delegationHealth.counts.orphanWorktreeOwners > 0)) {
57370
+ const lines = [
57371
+ "No active swarm plan found.",
57372
+ "",
57373
+ "**Background Delegations**:"
57374
+ ];
57375
+ lines.push(` - Ledger tail: ${formatLedgerBytes(delegationHealth.ledger.bytes)} / ${formatLedgerBytes(delegationHealth.ledger.limitBytes)} recovery bound (${delegationHealth.ledger.pressurePct}% \u2014 ${delegationHealth.ledger.band})`);
57376
+ if (delegationHealth.checkpoint) {
57377
+ lines.push(` - Checkpoint #${delegationHealth.checkpoint.sequence} (${delegationHealth.checkpoint.liveRecords} live, ${delegationHealth.checkpoint.closedSummaries} archived)`);
57378
+ }
57379
+ if (delegationHealth.recovery) {
57380
+ lines.push(` - Recovery: ${delegationHealth.recovery.source} (${delegationHealth.recovery.ok ? "ok" : `FAILED: ${delegationHealth.recovery.reason ?? "uncertain"}`})`);
57381
+ }
57382
+ const compactCounts = delegationHealth.counts;
57383
+ if (compactCounts.activeOwners > 0 || compactCounts.pendingAdvisories > 0 || compactCounts.lateTerminals > 0 || compactCounts.orphanWorktreeOwners > 0) {
57384
+ lines.push(` - Live set: ${compactCounts.activeOwners} active owners, ${compactCounts.pendingAdvisories} pending advisories, ${compactCounts.lateTerminals} late terminals, ${compactCounts.orphanWorktreeOwners} unsettled worktree owners`);
57385
+ }
57386
+ if (delegationHealth.lastUncertainty) {
57387
+ lines.push(` - \u26A0 Last uncertainty (${new Date(delegationHealth.lastUncertainty.at).toISOString()}): ${delegationHealth.lastUncertainty.reason}`);
57388
+ if (delegationHealth.lastUncertainty.repairHint) {
57389
+ lines.push(` repair: ${delegationHealth.lastUncertainty.repairHint}`);
57390
+ }
57391
+ }
57392
+ return lines.join(`
57314
57393
  `);
57315
57394
  }
57316
57395
  return "No active swarm plan found.";
@@ -57796,7 +57875,7 @@ function buildDetailedHelp(commandName, entry) {
57796
57875
  async function handleHelpCommand(ctx) {
57797
57876
  const targetCommand = ctx.args.join(" ");
57798
57877
  if (!targetCommand) {
57799
- const { buildHelpText } = await import("./index-dtf2va28.js");
57878
+ const { buildHelpText } = await import("./index-e70d3xr7.js");
57800
57879
  return buildHelpText();
57801
57880
  }
57802
57881
  const tokens = targetCommand.split(/\s+/);
@@ -57805,7 +57884,7 @@ async function handleHelpCommand(ctx) {
57805
57884
  return _internals87.buildDetailedHelp(resolved.key, resolved.entry);
57806
57885
  }
57807
57886
  const similar = _internals87.findSimilarCommands(targetCommand);
57808
- const { buildHelpText: fullHelp } = await import("./index-dtf2va28.js");
57887
+ const { buildHelpText: fullHelp } = await import("./index-e70d3xr7.js");
57809
57888
  if (similar.length > 0) {
57810
57889
  return `Command '/swarm ${targetCommand}' not found.
57811
57890
 
@@ -57982,7 +58061,7 @@ var COMMAND_REGISTRY = {
57982
58061
  },
57983
58062
  "guardrail explain": {
57984
58063
  handler: async (ctx) => {
57985
- const { handleGuardrailExplain } = await import("./guardrail-explain-f3zysesy.js");
58064
+ const { handleGuardrailExplain } = await import("./guardrail-explain-9ry66z5g.js");
57986
58065
  return handleGuardrailExplain(ctx.directory, ctx.args);
57987
58066
  },
57988
58067
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -57992,7 +58071,7 @@ var COMMAND_REGISTRY = {
57992
58071
  },
57993
58072
  "guardrail-explain": {
57994
58073
  handler: async (ctx) => {
57995
- const { handleGuardrailExplain } = await import("./guardrail-explain-f3zysesy.js");
58074
+ const { handleGuardrailExplain } = await import("./guardrail-explain-9ry66z5g.js");
57996
58075
  return handleGuardrailExplain(ctx.directory, ctx.args);
57997
58076
  },
57998
58077
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -58002,7 +58081,7 @@ var COMMAND_REGISTRY = {
58002
58081
  },
58003
58082
  "guardrail-log": {
58004
58083
  handler: async (ctx) => {
58005
- const { handleGuardrailLog } = await import("./guardrail-log-eat71fnh.js");
58084
+ const { handleGuardrailLog } = await import("./guardrail-log-fe6smme1.js");
58006
58085
  return handleGuardrailLog(ctx.directory, ctx.args);
58007
58086
  },
58008
58087
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -65214,7 +65293,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
65214
65293
  return extracted === expectedSessionId;
65215
65294
  }
65216
65295
  async function inspectStandardWorktreeCollisionOwnership(identity) {
65217
- const collisionOwnership = await import("./worktree-collision-ownership-42bb3gcb.js");
65296
+ const collisionOwnership = await import("./worktree-collision-ownership-j6d33p49.js");
65218
65297
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
65219
65298
  }
65220
65299
  async function precreateStandardWorktreeSession(args) {
@@ -65362,7 +65441,7 @@ async function precreateStandardWorktreeSession(args) {
65362
65441
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, provisionResult.worktreePath);
65363
65442
  if (laneProfile) {
65364
65443
  try {
65365
- const { writeLaneProfileToDiskReal } = await import("./core-aj0wmbg8.js");
65444
+ const { writeLaneProfileToDiskReal } = await import("./core-cpcspaw5.js");
65366
65445
  await writeLaneProfileToDiskReal(provisionResult.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
65367
65446
  } catch {}
65368
65447
  }
@@ -65861,7 +65940,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
65861
65940
  }
65862
65941
  clearWorktreeMergeStatus(statusKey);
65863
65942
  try {
65864
- const { removeLaneProfileFromDiskReal } = await import("./core-aj0wmbg8.js");
65943
+ const { removeLaneProfileFromDiskReal } = await import("./core-cpcspaw5.js");
65865
65944
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
65866
65945
  } catch {}
65867
65946
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);
@@ -709,7 +709,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
709
709
  const {
710
710
  readAuthoritativeKnowledgeCounterRollups,
711
711
  effectiveRetrievalOutcomes
712
- } = await import("./knowledge-events-yw2kydyy.js");
712
+ } = await import("./knowledge-events-1tqpbwvj.js");
713
713
  const rollups = await readAuthoritativeKnowledgeCounterRollups(directory);
714
714
  const flagIds = new Set;
715
715
  for (const e of atFloor) {
@@ -776,11 +776,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
776
776
  });
777
777
  }
778
778
  if (action === "quarantine" && toQuarantine.length > 0) {
779
- const { quarantineEntry } = await import("./knowledge-validator-xervpe5k.js");
780
- const { KnowledgeConfigSchema } = await import("./schema-z141arx9.js");
779
+ const { quarantineEntry } = await import("./knowledge-validator-kvtk6633.js");
780
+ const { KnowledgeConfigSchema } = await import("./schema-epdq7ykx.js");
781
781
  let config;
782
782
  try {
783
- const { loadPluginConfigWithMeta } = await import("./index-kc2x117y.js");
783
+ const { loadPluginConfigWithMeta } = await import("./index-8xertnqz.js");
784
784
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
785
785
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
786
786
  } catch {
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  autoCommitDirty,
8
8
  cleanUntrackedFiles
9
- } from "./index-s7nb33pc.js";
9
+ } from "./index-tfkfyshg.js";
10
10
  import {
11
11
  validateSwarmPath
12
12
  } from "./index-rn0eq85g.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  readKnowledge,
4
4
  transactKnowledge
5
- } from "./index-wjk00vwk.js";
5
+ } from "./index-jqabjy7t.js";
6
6
  import {
7
7
  resolveKnowledgeStoreDir
8
8
  } from "./index-w7x7qxz2.js";
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-5d8ydxae.js";
15
+ } from "./index-j1scj25g.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-nd1j9wkw.js";
22
+ } from "./index-d45yrzkg.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
@@ -86,7 +86,7 @@ var _internals = {
86
86
  symlinkSync: fs.symlinkSync
87
87
  },
88
88
  writeScopeToDisk: async (directory, taskId, files) => {
89
- const { writeScopeToDisk: realWrite } = await import("./scope-persistence-js90c1f4.js");
89
+ const { writeScopeToDisk: realWrite } = await import("./scope-persistence-37s9n40v.js");
90
90
  return realWrite(directory, taskId, files);
91
91
  },
92
92
  writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
@@ -3,7 +3,7 @@ import {
3
3
  queryHistoricalOutcomes,
4
4
  readKnowledgeEvents,
5
5
  recordKnowledgeEvent
6
- } from "./index-0adcjpyx.js";
6
+ } from "./index-ez18gjk2.js";
7
7
  import {
8
8
  jaccardBigram,
9
9
  readKnowledge,
@@ -11,7 +11,7 @@ import {
11
11
  resolveSwarmKnowledgePath,
12
12
  transactKnowledge,
13
13
  wordBigrams
14
- } from "./index-wjk00vwk.js";
14
+ } from "./index-jqabjy7t.js";
15
15
  import {
16
16
  init_knowledge_types,
17
17
  isActiveStatus
@@ -224,11 +224,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
224
224
  alreadyInactive: true
225
225
  };
226
226
  }
227
- const { quarantineEntry } = await import("./knowledge-validator-xervpe5k.js");
227
+ const { quarantineEntry } = await import("./knowledge-validator-kvtk6633.js");
228
228
  let policyConfig;
229
229
  try {
230
- const { KnowledgeConfigSchema } = await import("./schema-z141arx9.js");
231
- const { loadPluginConfigWithMeta } = await import("./index-kc2x117y.js");
230
+ const { KnowledgeConfigSchema } = await import("./schema-epdq7ykx.js");
231
+ const { loadPluginConfigWithMeta } = await import("./index-8xertnqz.js");
232
232
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
233
233
  policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
234
234
  } catch {
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  computePlanStructureHash,
4
4
  derivePlanId
5
- } from "./index-hjy4txgr.js";
5
+ } from "./index-0ck3e366.js";
6
6
  import {
7
7
  unsafePathTextReason
8
8
  } from "./index-556ja8an.js";
9
9
  import {
10
10
  PlanSchema
11
- } from "./index-36vry26a.js";
11
+ } from "./index-d45d4zyq.js";
12
12
  import {
13
13
  assertProjectRoot
14
14
  } from "./index-k31en0ja.js";