opencode-swarm 7.164.12 → 7.164.13

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 (97) hide show
  1. package/.opencode/skills/loop/SKILL.md +1 -1
  2. package/.opencode/skills/{plan → swarm-plan}/SKILL.md +1 -1
  3. package/dist/cli/{coder-settlement-yh1q5fr3.js → coder-settlement-em2fgg4p.js} +11 -11
  4. package/dist/cli/{config-doctor-bd4yzmh7.js → config-doctor-1m4mrybp.js} +3 -3
  5. package/dist/cli/{core-y0s1vmyc.js → core-zbzdffha.js} +2 -2
  6. package/dist/cli/{curation-policy-gs1qakn7.js → curation-policy-bqpmry2n.js} +5 -5
  7. package/dist/cli/{curator-drift-1sg9yk2m.js → curator-drift-hbc3w5zj.js} +4 -4
  8. package/dist/cli/curator-llm-factory-j76c96t7.js +70 -0
  9. package/dist/cli/{curator-brqack0j.js → curator-tn3x5j02.js} +36 -36
  10. package/dist/cli/{evidence-summary-service-nqbcvp30.js → evidence-summary-service-7cn9z4sn.js} +16 -16
  11. package/dist/cli/{gate-evidence-9stdtpej.js → gate-evidence-deyzt3hz.js} +7 -7
  12. package/dist/cli/guardrail-explain-4k2pqj46.js +71 -0
  13. package/dist/cli/{guardrail-log-sf39x00b.js → guardrail-log-cnbv6vry.js} +8 -8
  14. package/dist/cli/{guardrail-reset-9wr6a60s.js → guardrail-reset-xhh61cax.js} +36 -36
  15. package/dist/cli/{hive-promoter-bqtj8261.js → hive-promoter-1m8zpz4d.js} +36 -36
  16. package/dist/cli/{index-vw66q1rw.js → index-0mwjamha.js} +1 -1
  17. package/dist/cli/{index-d7j3n5ra.js → index-3c0z1jnc.js} +41 -39
  18. package/dist/cli/{index-wasdrhev.js → index-4fhcbe14.js} +4 -4
  19. package/dist/cli/{index-r2p0pgst.js → index-5ebgzb5a.js} +3 -3
  20. package/dist/cli/{index-ebce775n.js → index-5h60rtaa.js} +2 -2
  21. package/dist/cli/{index-yvqg6kn5.js → index-6m24v15v.js} +2 -2
  22. package/dist/cli/{index-sphahrmq.js → index-6rx1rdaq.js} +1 -1
  23. package/dist/cli/{index-ad9064j9.js → index-74514zkh.js} +4 -4
  24. package/dist/cli/{index-hb7bh4r2.js → index-7f2r3ysr.js} +30 -6
  25. package/dist/cli/{index-hg09xemc.js → index-7z9zqxqt.js} +4 -4
  26. package/dist/cli/{index-xxfk62zd.js → index-8bdk7124.js} +2 -2
  27. package/dist/cli/{index-50j914b5.js → index-a0d4fp6r.js} +29 -7
  28. package/dist/cli/{index-4mjmnysc.js → index-ajknebrc.js} +1 -1
  29. package/dist/cli/{index-qqq04n70.js → index-anxs69ad.js} +1 -1
  30. package/dist/cli/{index-cgewrpw5.js → index-asey3tb3.js} +4 -3
  31. package/dist/cli/{index-03enxdaq.js → index-bvkd7at6.js} +1 -1
  32. package/dist/cli/{index-5wc5pbzc.js → index-c98rjgjq.js} +682 -349
  33. package/dist/cli/{index-qgajv9rd.js → index-d224mhr9.js} +3 -3
  34. package/dist/cli/{index-ztm0q26v.js → index-dh5th4jn.js} +1 -1
  35. package/dist/cli/{index-c45662wc.js → index-e45htt92.js} +1 -1
  36. package/dist/cli/{index-hvz4ad2t.js → index-f36hy1x4.js} +1 -1
  37. package/dist/cli/{index-m8xrbdmn.js → index-f8jdar6q.js} +2 -2
  38. package/dist/cli/{index-r69gzes2.js → index-fnyw5rzg.js} +7 -7
  39. package/dist/cli/{index-kxv193aq.js → index-g11h1qpk.js} +5 -5
  40. package/dist/cli/{index-40twgsyh.js → index-g9weyhq6.js} +2 -2
  41. package/dist/cli/{index-888pq4xx.js → index-grn6tkbt.js} +7 -7
  42. package/dist/cli/{index-ewv8qa8q.js → index-gy0nyfbw.js} +2 -2
  43. package/dist/cli/{index-8vw2pjgr.js → index-hhzzyjm3.js} +6 -6
  44. package/dist/cli/{index-eed0gkv6.js → index-j2svfhzk.js} +2 -2
  45. package/dist/cli/{index-2bhz5k91.js → index-jre6tm3v.js} +2 -2
  46. package/dist/cli/{index-k0s8n6m5.js → index-mpf1tvwf.js} +11 -11
  47. package/dist/cli/{index-4vb56w2k.js → index-ndjjvxzz.js} +4 -4
  48. package/dist/cli/{index-d3mpxsmy.js → index-ptsqnxwd.js} +7 -7
  49. package/dist/cli/{index-0byep4pe.js → index-qtxevgdx.js} +8 -8
  50. package/dist/cli/{index-wknpkfm8.js → index-s3k7xbqd.js} +7 -7
  51. package/dist/cli/{index-x39hjdf1.js → index-tqw8w2n5.js} +1 -1
  52. package/dist/cli/{index-es64amqt.js → index-w6988bbc.js} +1 -1
  53. package/dist/cli/{index-mee9maf5.js → index-xwbn7c8m.js} +2 -2
  54. package/dist/cli/{index-3fnym6ac.js → index-y5hfk7ya.js} +4 -4
  55. package/dist/cli/{index-b25t91a3.js → index-zb6gdym8.js} +2 -2
  56. package/dist/cli/index.js +146 -67
  57. package/dist/cli/{knowledge-escalator-01vva51d.js → knowledge-escalator-3fax9y3s.js} +13 -13
  58. package/dist/cli/{knowledge-events-dpfwh1hs.js → knowledge-events-9cpdyhmb.js} +11 -11
  59. package/dist/cli/{knowledge-link-2rvp966j.js → knowledge-link-dgvbqjqg.js} +4 -4
  60. package/dist/cli/{knowledge-store-aw58ae7b.js → knowledge-store-y35rka0p.js} +5 -5
  61. package/dist/cli/{knowledge-validator-yhd31ryf.js → knowledge-validator-fd761gpx.js} +7 -7
  62. package/dist/cli/{model-preflight-288nsgpw.js → model-preflight-3s1c0zpc.js} +1 -1
  63. package/dist/cli/{pending-delegations-fjetcz8e.js → pending-delegations-t3y19j3n.js} +11 -11
  64. package/dist/cli/{pr-subscriptions-cwwtfs8w.js → pr-subscriptions-00zp69mt.js} +11 -11
  65. package/dist/cli/{pr-workflow-gate-5xwtg1k2.js → pr-workflow-gate-2h0j8c92.js} +36 -36
  66. package/dist/cli/{runner-mb51twxt.js → runner-0e3bjeev.js} +5 -5
  67. package/dist/cli/{scan-cursor-j11qwf0v.js → scan-cursor-wppe2gxw.js} +6 -6
  68. package/dist/cli/{schema-0xp3bde3.js → schema-sec49ppy.js} +2 -2
  69. package/dist/cli/{scope-persistence-brrk806y.js → scope-persistence-59eyqaz4.js} +15 -15
  70. package/dist/cli/{skill-generator-j8qzmet9.js → skill-generator-56rbmpj7.js} +15 -15
  71. package/dist/cli/{snapshot-coordination-init-h0xmtftq.js → snapshot-coordination-init-dnkdc7gx.js} +36 -36
  72. package/dist/cli/{telemetry-m84ap0pp.js → telemetry-a1yvjerj.js} +1 -1
  73. package/dist/cli/{worktree-collision-ownership-j9zykj18.js → worktree-collision-ownership-fj9n4mhk.js} +12 -12
  74. package/dist/cli/{worktree-isolation-jd39xz6h.js → worktree-isolation-vd1s86ya.js} +36 -36
  75. package/dist/commands/benchmark.d.ts +5 -1
  76. package/dist/commands/registry.d.ts +34 -43
  77. package/dist/commands/turbo.d.ts +1 -1
  78. package/dist/config/bundled-skills.d.ts +4 -3
  79. package/dist/config/constants.d.ts +13 -0
  80. package/dist/hooks/extractors.d.ts +9 -0
  81. package/dist/hooks/non-architect-advisory.d.ts +18 -0
  82. package/dist/hooks/repo-graph-injection.d.ts +16 -0
  83. package/dist/index.js +73 -71
  84. package/dist/services/decision-drift-analyzer.d.ts +7 -0
  85. package/dist/services/handoff-service.d.ts +10 -0
  86. package/dist/services/status-service.d.ts +27 -0
  87. package/dist/state.d.ts +8 -0
  88. package/dist/tools/repo-graph/builder.d.ts +1 -25
  89. package/dist/tools/repo-graph/cache.d.ts +5 -1
  90. package/dist/tools/repo-graph/fallback-scanner.d.ts +71 -0
  91. package/dist/tools/repo-graph/indexed-storage.d.ts +11 -0
  92. package/dist/tools/repo-graph/storage.d.ts +7 -0
  93. package/dist/utils/context-decisions.d.ts +77 -0
  94. package/dist/utils/sanitize-display.d.ts +7 -0
  95. package/package.json +3 -2
  96. package/dist/cli/curator-llm-factory-dtsjc3zf.js +0 -70
  97. package/dist/cli/guardrail-explain-3ff1z3fm.js +0 -71
@@ -16,7 +16,7 @@ import {
16
16
  resolveExecutableFromPath,
17
17
  runEvaluation,
18
18
  runExternalTool
19
- } from "./index-hvz4ad2t.js";
19
+ } from "./index-f36hy1x4.js";
20
20
  import {
21
21
  finalizeShellAuditForClose,
22
22
  isPolicyProtectedPath,
@@ -25,13 +25,13 @@ import {
25
25
  protectedRoots,
26
26
  redactDecisionLineForArchive,
27
27
  stableCanonicalStringify
28
- } from "./index-wasdrhev.js";
28
+ } from "./index-4fhcbe14.js";
29
29
  import {
30
30
  detectStraySwarmDirs,
31
31
  readDoctorArtifact,
32
32
  removeStraySwarmDir,
33
33
  runConfigDoctor
34
- } from "./index-b25t91a3.js";
34
+ } from "./index-zb6gdym8.js";
35
35
  import {
36
36
  MAX_TRANSIENT_RETRIES,
37
37
  archiveEvidence,
@@ -71,7 +71,7 @@ import {
71
71
  updateTaskCheckpointReceipt,
72
72
  updateTaskStatus,
73
73
  validateProjectRoot
74
- } from "./index-k0s8n6m5.js";
74
+ } from "./index-mpf1tvwf.js";
75
75
  import {
76
76
  EvaluationTaskV1Schema,
77
77
  GateAuditManifestV1Schema,
@@ -88,7 +88,7 @@ import {
88
88
  saveGateAuditResult,
89
89
  savePromotionDecision,
90
90
  saveTaskSetSnapshot
91
- } from "./index-x39hjdf1.js";
91
+ } from "./index-tqw8w2n5.js";
92
92
  import {
93
93
  canonicalHash,
94
94
  canonicalJson,
@@ -127,15 +127,15 @@ import {
127
127
  retireSkill,
128
128
  selectCandidateEntries,
129
129
  syncBundledProjectSkillsIfMissingAsync
130
- } from "./index-hb7bh4r2.js";
130
+ } from "./index-7f2r3ysr.js";
131
131
  import {
132
132
  readRecentEscalations
133
- } from "./index-kxv193aq.js";
133
+ } from "./index-g11h1qpk.js";
134
134
  import {
135
135
  alreadyCuratedThisGeneration,
136
136
  claimNextScanBatch,
137
137
  resolveCohortId
138
- } from "./index-40twgsyh.js";
138
+ } from "./index-g9weyhq6.js";
139
139
  import {
140
140
  CURATOR_INIT_PROMPT,
141
141
  CURATOR_PHASE_PROMPT,
@@ -147,7 +147,7 @@ import {
147
147
  getGlobalEventBus,
148
148
  getGroupCommitWriter,
149
149
  importLegacyJsonl
150
- } from "./index-ztm0q26v.js";
150
+ } from "./index-dh5th4jn.js";
151
151
  import {
152
152
  buildOpenSpecProjectionSync,
153
153
  detectSpeckit,
@@ -163,7 +163,7 @@ import {
163
163
  listActive,
164
164
  subscribe,
165
165
  unsubscribe
166
- } from "./index-d3mpxsmy.js";
166
+ } from "./index-ptsqnxwd.js";
167
167
  import {
168
168
  clearWorktreeMergeStatus,
169
169
  getAllWorktreeMergeFailures,
@@ -175,7 +175,7 @@ import {
175
175
  listCoderSettlementWalStates,
176
176
  recoverCoderSettlement,
177
177
  recoverStaleCoderSettlements
178
- } from "./index-r69gzes2.js";
178
+ } from "./index-fnyw5rzg.js";
179
179
  import {
180
180
  parsePorcelainV2Snapshot,
181
181
  resolveCommitCountSince,
@@ -208,7 +208,7 @@ import {
208
208
  WORKTREE_LIFECYCLE_LOCK_FILE,
209
209
  recordWorktreeProvisioningOwner,
210
210
  removeWorktreeProvisioningOwner
211
- } from "./index-xxfk62zd.js";
211
+ } from "./index-8bdk7124.js";
212
212
  import {
213
213
  getLanguageForExtension
214
214
  } from "./index-b43rt5ph.js";
@@ -244,13 +244,13 @@ import {
244
244
  transitionTaskWorkflowEvidence,
245
245
  withTaskEvidenceTransaction,
246
246
  writeWorkflowWalFile
247
- } from "./index-ad9064j9.js";
247
+ } from "./index-74514zkh.js";
248
248
  import {
249
249
  isPathUnderSwarmWorktreeBase,
250
250
  makeWorktreeBranchName,
251
251
  provisionWorktree,
252
252
  removeWorktree
253
- } from "./index-ebce775n.js";
253
+ } from "./index-5h60rtaa.js";
254
254
  import {
255
255
  DEFAULT_STALE_DELEGATION_TIMEOUT_MS,
256
256
  DELEGATION_COMPACTION_HIGH_WATER_BYTES,
@@ -284,7 +284,7 @@ import {
284
284
  scanBackgroundCoderReservationsForAdmission,
285
285
  scanDelegationsForRecovery,
286
286
  sweepStaleDelegations
287
- } from "./index-8vw2pjgr.js";
287
+ } from "./index-hhzzyjm3.js";
288
288
  import {
289
289
  MAX_EVENT_LOG_ENTRIES,
290
290
  _internals,
@@ -300,13 +300,13 @@ import {
300
300
  recordKnowledgeEvent,
301
301
  recordPhaseCloseIntent,
302
302
  resolveKnowledgeEventsPath
303
- } from "./index-0byep4pe.js";
303
+ } from "./index-qtxevgdx.js";
304
304
  import {
305
305
  estimateTokens,
306
306
  readSwarmFileAsync,
307
307
  safeHook,
308
308
  validateSwarmPath
309
- } from "./index-qqq04n70.js";
309
+ } from "./index-anxs69ad.js";
310
310
  import {
311
311
  bunFile,
312
312
  bunSpawn,
@@ -326,17 +326,17 @@ import {
326
326
  validateActionableFields,
327
327
  validateLesson,
328
328
  validateSkillPath
329
- } from "./index-hg09xemc.js";
329
+ } from "./index-7z9zqxqt.js";
330
330
  import {
331
331
  authorizeCuration,
332
332
  buildConfigFingerprintInput
333
- } from "./index-4mjmnysc.js";
333
+ } from "./index-ajknebrc.js";
334
334
  import {
335
335
  cohortConfigFingerprint
336
336
  } from "./index-rtry5xyf.js";
337
337
  import {
338
338
  resolveWorktreeIsolationConfig
339
- } from "./index-qgajv9rd.js";
339
+ } from "./index-d224mhr9.js";
340
340
  import {
341
341
  RetrospectiveEvidenceSchema
342
342
  } from "./index-3qf1vxtb.js";
@@ -346,7 +346,7 @@ import {
346
346
  clearAllScopes,
347
347
  clearScopeBindingFromDisk,
348
348
  clearScopeBindings
349
- } from "./index-wknpkfm8.js";
349
+ } from "./index-s3k7xbqd.js";
350
350
  import {
351
351
  appendLedgerEvent,
352
352
  computePlanLedgerHash,
@@ -359,7 +359,7 @@ import {
359
359
  readPlanEpochIdentity,
360
360
  replayFromLedgerWithStatus,
361
361
  takeSnapshotEvent
362
- } from "./index-4vb56w2k.js";
362
+ } from "./index-ndjjvxzz.js";
363
363
  import {
364
364
  CORE_EVENT_LOCKED,
365
365
  appendCoreEventSync,
@@ -369,7 +369,7 @@ import {
369
369
  hasSpecDriftAuditEvent,
370
370
  hasTaskRepairAuditEvent,
371
371
  readCoreEvents
372
- } from "./index-mee9maf5.js";
372
+ } from "./index-xwbn7c8m.js";
373
373
  import {
374
374
  sanitizeDiagnosticText
375
375
  } from "./index-556ja8an.js";
@@ -380,7 +380,7 @@ import {
380
380
  getEffectiveGates,
381
381
  getProfileLookupForIdentity,
382
382
  setGatesForIdentity
383
- } from "./index-yvqg6kn5.js";
383
+ } from "./index-6m24v15v.js";
384
384
  import {
385
385
  MAX_COORDINATION_STATE_LIST_ROWS,
386
386
  deleteCoordinationImports,
@@ -392,7 +392,7 @@ import {
392
392
  listCoordinationStates,
393
393
  transitionCoordinationState,
394
394
  withCoordinationTransaction
395
- } from "./index-c45662wc.js";
395
+ } from "./index-e45htt92.js";
396
396
  import {
397
397
  DURABILITY_CLASSES,
398
398
  closeAllProjectDbs,
@@ -400,7 +400,7 @@ import {
400
400
  getProjectDb,
401
401
  projectDbExists,
402
402
  projectDbPath
403
- } from "./index-es64amqt.js";
403
+ } from "./index-w6988bbc.js";
404
404
  import {
405
405
  canonicalExistingFilesystemPath,
406
406
  canonicalPathForFutureIo,
@@ -415,7 +415,7 @@ import {
415
415
  observeCuratorCompliance,
416
416
  observeStoreHealth,
417
417
  readLearningHealth
418
- } from "./index-eed0gkv6.js";
418
+ } from "./index-j2svfhzk.js";
419
419
  import {
420
420
  appendKnowledge,
421
421
  appendRejectedLesson,
@@ -445,7 +445,7 @@ import {
445
445
  transactFile,
446
446
  transactKnowledge,
447
447
  wordBigrams
448
- } from "./index-888pq4xx.js";
448
+ } from "./index-grn6tkbt.js";
449
449
  import {
450
450
  resolveHiveDataDir,
451
451
  resolveHiveEventsPath,
@@ -461,7 +461,7 @@ import {
461
461
  resolveLinkDir,
462
462
  sanitizeLinkId,
463
463
  writeLinkPointer
464
- } from "./index-sphahrmq.js";
464
+ } from "./index-6rx1rdaq.js";
465
465
  import {
466
466
  canonicalRootKeyFresh,
467
467
  compositeSessionKey,
@@ -477,7 +477,7 @@ import {
477
477
  listActiveLocks,
478
478
  tryAcquireLock,
479
479
  withEvidenceLock
480
- } from "./index-2bhz5k91.js";
480
+ } from "./index-jre6tm3v.js";
481
481
  import {
482
482
  atomicWriteSwarmFile,
483
483
  atomicWriteSwarmFileSync,
@@ -485,12 +485,12 @@ import {
485
485
  matchTempGrammar,
486
486
  parseTargetBasename,
487
487
  resetSwarmArtifactCache
488
- } from "./index-ewv8qa8q.js";
488
+ } from "./index-gy0nyfbw.js";
489
489
  import {
490
490
  emit,
491
491
  getLastHeartbeat,
492
492
  telemetry
493
- } from "./index-r2p0pgst.js";
493
+ } from "./index-5ebgzb5a.js";
494
494
  import {
495
495
  require_proper_lockfile
496
496
  } from "./index-7g4c7s5r.js";
@@ -501,7 +501,7 @@ import {
501
501
  loadGateOverrides,
502
502
  loadPluginConfig,
503
503
  loadPluginConfigWithMeta
504
- } from "./index-vw66q1rw.js";
504
+ } from "./index-0mwjamha.js";
505
505
  import {
506
506
  init_git_executable,
507
507
  resolveGitExecutable,
@@ -528,7 +528,7 @@ import {
528
528
  resolveAutoReviewConfig,
529
529
  resolveGeneratedAgentRole,
530
530
  stripKnownSwarmPrefix
531
- } from "./index-cgewrpw5.js";
531
+ } from "./index-asey3tb3.js";
532
532
  import {
533
533
  AGENT_TOOL_MAP,
534
534
  ALL_AGENT_NAMES,
@@ -543,7 +543,7 @@ import {
543
543
  init_agent_names,
544
544
  init_constants,
545
545
  init_tool_metadata
546
- } from "./index-50j914b5.js";
546
+ } from "./index-a0d4fp6r.js";
547
547
  import {
548
548
  KNOWLEDGE_SCHEMA_VERSION,
549
549
  OUTCOME_BLOCK_THRESHOLD,
@@ -578,16 +578,16 @@ import {
578
578
  // src/hooks/delegation-gate/worktree-isolation.ts
579
579
  init_constants();
580
580
  import { createHash as createHash38 } from "crypto";
581
- import * as fs55 from "fs/promises";
582
- import * as path122 from "path";
581
+ import * as fs56 from "fs/promises";
582
+ import * as path123 from "path";
583
583
  init_executor();
584
584
 
585
585
  // src/state.ts
586
586
  init_constants();
587
587
  init_loader();
588
588
  import { randomUUID as randomUUID18 } from "crypto";
589
- import * as fs54 from "fs/promises";
590
- import * as path121 from "path";
589
+ import * as fs55 from "fs/promises";
590
+ import * as path122 from "path";
591
591
  init_schema();
592
592
 
593
593
  // src/council/council-review-identity.ts
@@ -838,8 +838,8 @@ var _test_exports = {
838
838
 
839
839
  // src/hooks/delegation-gate.ts
840
840
  init_zod();
841
- import * as fs53 from "fs";
842
- import * as path120 from "path";
841
+ import * as fs54 from "fs";
842
+ import * as path121 from "path";
843
843
 
844
844
  // src/config/agent-model.ts
845
845
  init_agent_names();
@@ -9415,7 +9415,7 @@ async function importLegacyPrWorkflowGateStateIfNeeded(directory, sessionID, all
9415
9415
  return null;
9416
9416
  throw error2;
9417
9417
  }
9418
- const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-5xwtg1k2.js")).readPrWorkflowGateStateForRecovery(directory, sessionID))?.state ?? null : await readPrWorkflowGateStateFileFromDisk(filePath, sessionID);
9418
+ const legacy = allowSalvagedImport ? (await (await import("./pr-workflow-gate-2h0j8c92.js")).readPrWorkflowGateStateForRecovery(directory, sessionID))?.state ?? null : await readPrWorkflowGateStateFileFromDisk(filePath, sessionID);
9419
9419
  if (!legacy)
9420
9420
  return null;
9421
9421
  const namespace = workflowGateStateCoordinationNamespace(sessionID);
@@ -9485,7 +9485,7 @@ async function deleteStateWhileLocked(directory, sessionID, options = {}) {
9485
9485
  let recoveryState = null;
9486
9486
  if (!currentAuthoritative) {
9487
9487
  if (options.allowSalvagedRead) {
9488
- const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-5xwtg1k2.js");
9488
+ const { readPrWorkflowGateStateForRecovery } = await import("./pr-workflow-gate-2h0j8c92.js");
9489
9489
  recoveryState = (await readPrWorkflowGateStateForRecovery(directory, normalizedSessionID))?.state ?? null;
9490
9490
  }
9491
9491
  if (!recoveryState) {
@@ -21531,8 +21531,12 @@ async function handleBenchmarkCommand(directory, args) {
21531
21531
  }))
21532
21532
  };
21533
21533
  lines.push("[BENCHMARK_JSON]", JSON.stringify(json, null, 2), "[/BENCHMARK_JSON]");
21534
- return lines.join(`
21534
+ const output = lines.join(`
21535
21535
  `);
21536
+ if (ciGate && !ciGate.passed) {
21537
+ return { text: output, ok: false, exitCode: 1 };
21538
+ }
21539
+ return output;
21536
21540
  }
21537
21541
  function parseMaxCostUsd(args) {
21538
21542
  const index = args.indexOf("--max-cost-usd");
@@ -25796,6 +25800,50 @@ var _internals25 = {
25796
25800
  MAX_REVISION_CALLS_PER_PHASE
25797
25801
  };
25798
25802
 
25803
+ // src/utils/context-decisions.ts
25804
+ function extractContextDecisions(content) {
25805
+ const decisions = [];
25806
+ const MAX_CONTENT_CHARS = 1e6;
25807
+ const bounded = content.length > MAX_CONTENT_CHARS ? content.slice(0, MAX_CONTENT_CHARS) : content;
25808
+ const lines = bounded.split(`
25809
+ `);
25810
+ let inDecisionsSection = false;
25811
+ let currentPhase = null;
25812
+ let lineNumber = 0;
25813
+ for (let i = 0;i < lines.length; i++) {
25814
+ const line = lines[i];
25815
+ lineNumber = i + 1;
25816
+ const phaseMatch = line.match(/^## Phase (\d+)/);
25817
+ if (phaseMatch) {
25818
+ currentPhase = parseInt(phaseMatch[1], 10);
25819
+ }
25820
+ if (line.trim() === "## Decisions") {
25821
+ inDecisionsSection = true;
25822
+ continue;
25823
+ }
25824
+ if (inDecisionsSection && line.startsWith("## ")) {
25825
+ break;
25826
+ }
25827
+ if (inDecisionsSection && line.trim().startsWith("- ")) {
25828
+ const text = line.trim().substring(2);
25829
+ const confirmed = text.includes("\u2705") || text.includes("[confirmed]");
25830
+ const timestampMatch = text.match(/\[(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\]/);
25831
+ const timestamp = timestampMatch ? timestampMatch[1] : null;
25832
+ const decisionPhaseMatch = text.match(/Phase (\d+)/);
25833
+ const decisionPhase = decisionPhaseMatch ? parseInt(decisionPhaseMatch[1], 10) : currentPhase;
25834
+ decisions.push({
25835
+ raw: line,
25836
+ text: text.replace(/\s*\[.*?\]\s*/g, "").trim(),
25837
+ phase: decisionPhase,
25838
+ confirmed,
25839
+ timestamp,
25840
+ line: lineNumber
25841
+ });
25842
+ }
25843
+ }
25844
+ return decisions;
25845
+ }
25846
+
25799
25847
  // src/hooks/curator.ts
25800
25848
  init_logger();
25801
25849
 
@@ -26164,7 +26212,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
26164
26212
  };
26165
26213
  }
26166
26214
  async function sweepActiveNearDuplicates(directory, options = {}) {
26167
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-3fnym6ac.js");
26215
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-y5hfk7ya.js");
26168
26216
  const { config } = loadPluginConfigWithMeta2(directory);
26169
26217
  const sweepConfig = config.learning?.dedup_sweep;
26170
26218
  if (sweepConfig?.enabled === false)
@@ -27146,20 +27194,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
27146
27194
  const phaseData = plan?.phases.find((p) => p.id === phase);
27147
27195
  const tasksCompleted = phaseData ? phaseData.tasks.filter((t) => t.status === "completed").length : 0;
27148
27196
  const tasksTotal = phaseData ? phaseData.tasks.length : 0;
27149
- const keyDecisions = [];
27150
- if (contextMd) {
27151
- const decisionSection = contextMd.match(/## Decisions\r?\n([\s\S]*?)(?:\r?\n##|$)/);
27152
- if (decisionSection) {
27153
- const lines = decisionSection[1].split(`
27154
- `);
27155
- for (const line of lines) {
27156
- const trimmed = line.trim();
27157
- if (trimmed.startsWith("- ")) {
27158
- keyDecisions.push(trimmed.slice(2));
27159
- }
27160
- }
27161
- }
27162
- }
27197
+ const keyDecisions = contextMd ? extractContextDecisions(contextMd).map((decision) => decision.raw.trim().slice(2)) : [];
27163
27198
  const phaseDigest = {
27164
27199
  phase,
27165
27200
  timestamp: new Date().toISOString(),
@@ -27301,7 +27336,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
27301
27336
  }
27302
27337
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
27303
27338
  try {
27304
- const skillModule = await import("./skill-generator-j8qzmet9.js");
27339
+ const skillModule = await import("./skill-generator-56rbmpj7.js");
27305
27340
  for (const cand of skillCandidates) {
27306
27341
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
27307
27342
  continue;
@@ -27773,7 +27808,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
27773
27808
  } catch {}
27774
27809
  }
27775
27810
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
27776
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-01vva51d.js");
27811
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-3fax9y3s.js");
27777
27812
  for (const { id } of contradictedEntries) {
27778
27813
  try {
27779
27814
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -28605,7 +28640,7 @@ async function runCuratorPostMortem(directory, options = {}) {
28605
28640
  warnings.push("Failed to collect knowledge summary.");
28606
28641
  }
28607
28642
  try {
28608
- const { getScanStatus } = await import("./scan-cursor-j11qwf0v.js");
28643
+ const { getScanStatus } = await import("./scan-cursor-wppe2gxw.js");
28609
28644
  const scanStatus = await getScanStatus(directory);
28610
28645
  if (scanStatus.remaining_estimate > 0) {
28611
28646
  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.`);
@@ -28777,9 +28812,9 @@ var _internals27 = {
28777
28812
  verifyPostMortemKnowledgeActions,
28778
28813
  repairPostMortemActions,
28779
28814
  loadDefaultKnowledgeConfig: async (directory) => {
28780
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-0xp3bde3.js");
28815
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-sec49ppy.js");
28781
28816
  try {
28782
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-3fnym6ac.js");
28817
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-y5hfk7ya.js");
28783
28818
  const loaded = loadPluginConfigWithMeta2(directory);
28784
28819
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
28785
28820
  } catch {
@@ -28787,11 +28822,11 @@ var _internals27 = {
28787
28822
  }
28788
28823
  },
28789
28824
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
28790
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-brqack0j.js");
28825
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-tn3x5j02.js");
28791
28826
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
28792
28827
  },
28793
28828
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
28794
- const { checkHivePromotions } = await import("./hive-promoter-bqtj8261.js");
28829
+ const { checkHivePromotions } = await import("./hive-promoter-1m8zpz4d.js");
28795
28830
  return checkHivePromotions(entries, knowledgeConfig, directory);
28796
28831
  },
28797
28832
  applyProposalTriage: async (directory, triage) => {
@@ -28800,7 +28835,7 @@ var _internals27 = {
28800
28835
  activateProposal,
28801
28836
  listSkills: listSkills2,
28802
28837
  sanitizeSlug
28803
- } = await import("./skill-generator-j8qzmet9.js");
28838
+ } = await import("./skill-generator-56rbmpj7.js");
28804
28839
  const result = {
28805
28840
  approved: [],
28806
28841
  rejected: [],
@@ -28842,7 +28877,7 @@ var _internals27 = {
28842
28877
  return result;
28843
28878
  },
28844
28879
  readPriorDriftReports: async (directory) => {
28845
- const { readPriorDriftReports } = await import("./curator-drift-1sg9yk2m.js");
28880
+ const { readPriorDriftReports } = await import("./curator-drift-hbc3w5zj.js");
28846
28881
  return readPriorDriftReports(directory);
28847
28882
  },
28848
28883
  readSwarmKnowledge: (directory) => readKnowledge(resolveSwarmKnowledgePath(directory))
@@ -30129,9 +30164,9 @@ function hashContent(content) {
30129
30164
  return createHash17("sha1").update(content).digest("hex");
30130
30165
  }
30131
30166
  async function loadConfigForPolicyCurator(directory) {
30132
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-0xp3bde3.js");
30167
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-sec49ppy.js");
30133
30168
  try {
30134
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-3fnym6ac.js");
30169
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-y5hfk7ya.js");
30135
30170
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
30136
30171
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
30137
30172
  } catch {
@@ -31614,7 +31649,7 @@ function serializeAgentSession(s) {
31614
31649
  }
31615
31650
  async function writeSnapshot(directory, state) {
31616
31651
  try {
31617
- const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-h0xmtftq.js");
31652
+ const { ensureSnapshotCoordinationReady } = await import("./snapshot-coordination-init-dnkdc7gx.js");
31618
31653
  await ensureSnapshotCoordinationReady(directory);
31619
31654
  const snapshot = {
31620
31655
  version: 3,
@@ -43840,7 +43875,7 @@ async function runFinalizeStage(ctx) {
43840
43875
  }
43841
43876
  }
43842
43877
  try {
43843
- const { CuratorConfigSchema: CCS } = await import("./schema-0xp3bde3.js");
43878
+ const { CuratorConfigSchema: CCS } = await import("./schema-sec49ppy.js");
43844
43879
  const { config: pmLoadedConfig } = _internals42.loadPluginConfigWithMeta(ctx.directory);
43845
43880
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
43846
43881
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -44760,7 +44795,7 @@ var _internals42 = {
44760
44795
  closePlanTerminalState: reconcileCloseTerminalStateForPlan,
44761
44796
  endAgentSession,
44762
44797
  flushAndDrainTelemetry: async () => {
44763
- const { flushAndDrainTelemetry } = await import("./telemetry-m84ap0pp.js");
44798
+ const { flushAndDrainTelemetry } = await import("./telemetry-a1yvjerj.js");
44764
44799
  return flushAndDrainTelemetry();
44765
44800
  },
44766
44801
  finalizeContextTelemetry: (directory) => {
@@ -46099,9 +46134,9 @@ var _internals46 = {
46099
46134
  loadPluginConfigWithMeta,
46100
46135
  loadCuratorDeps: async () => {
46101
46136
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
46102
- import("./schema-0xp3bde3.js"),
46103
- import("./curator-brqack0j.js"),
46104
- import("./curator-llm-factory-dtsjc3zf.js")
46137
+ import("./schema-sec49ppy.js"),
46138
+ import("./curator-tn3x5j02.js"),
46139
+ import("./curator-llm-factory-j76c96t7.js")
46105
46140
  ]);
46106
46141
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
46107
46142
  }
@@ -46612,6 +46647,12 @@ import * as path56 from "path";
46612
46647
  function getPluginConfigDir() {
46613
46648
  return path56.join(process.env.XDG_CONFIG_HOME || path56.join(os7.homedir(), ".config"), "opencode");
46614
46649
  }
46650
+ function getHostConfigDir() {
46651
+ const override = process.env.OPENCODE_CONFIG_DIR;
46652
+ if (override && override.trim() !== "")
46653
+ return override;
46654
+ return getPluginConfigDir();
46655
+ }
46615
46656
  function getPluginCachePaths() {
46616
46657
  const cacheBase = process.env.XDG_CACHE_HOME || path56.join(os7.homedir(), ".cache");
46617
46658
  const configDir = getPluginConfigDir();
@@ -47144,7 +47185,7 @@ async function computeCurationDiagnostics(directory, entries2) {
47144
47185
  let scanCompleted = false;
47145
47186
  let scanRemaining = 0;
47146
47187
  try {
47147
- const { getScanStatus } = await import("./scan-cursor-j11qwf0v.js");
47188
+ const { getScanStatus } = await import("./scan-cursor-wppe2gxw.js");
47148
47189
  const status = await getScanStatus(directory);
47149
47190
  scanGeneration = status.generation;
47150
47191
  scanCompleted = status.completed;
@@ -47152,19 +47193,19 @@ async function computeCurationDiagnostics(directory, entries2) {
47152
47193
  } catch {}
47153
47194
  let configMatch = null;
47154
47195
  try {
47155
- const { isLinked: isLinked2 } = await import("./knowledge-link-2rvp966j.js");
47196
+ const { isLinked: isLinked2 } = await import("./knowledge-link-dgvbqjqg.js");
47156
47197
  if (isLinked2(directory)) {
47157
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-0xp3bde3.js");
47198
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-sec49ppy.js");
47158
47199
  let config;
47159
47200
  try {
47160
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-3fnym6ac.js");
47201
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-y5hfk7ya.js");
47161
47202
  const loaded = loadPluginConfigWithMeta2(directory);
47162
47203
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
47163
47204
  } catch {
47164
47205
  config = KnowledgeConfigSchema2.parse({});
47165
47206
  }
47166
47207
  const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
47167
- const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-gs1qakn7.js");
47208
+ const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-bqpmry2n.js");
47168
47209
  const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
47169
47210
  const cohortFp = await readCohortConfigFingerprint(directory);
47170
47211
  configMatch = cohortFp === null ? null : currentFp === cohortFp;
@@ -48553,7 +48594,7 @@ async function handleDoctorCommand(directory, args) {
48553
48594
  const result = runConfigDoctor(config, directory);
48554
48595
  let output;
48555
48596
  if (enableAutoFix && result.hasAutoFixableIssues) {
48556
- const { runConfigDoctorWithFixes } = await import("./config-doctor-bd4yzmh7.js");
48597
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-1m4mrybp.js");
48557
48598
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
48558
48599
  applyLossy: true
48559
48600
  });
@@ -48591,7 +48632,7 @@ async function handleDoctorCommand(directory, args) {
48591
48632
  `;
48592
48633
  }
48593
48634
  try {
48594
- const { runModelPreflight } = await import("./model-preflight-288nsgpw.js");
48635
+ const { runModelPreflight } = await import("./model-preflight-3s1c0zpc.js");
48595
48636
  const preflight = await runModelPreflight(config, swarmState.opencodeClient);
48596
48637
  if (preflight.catalogAvailable) {
48597
48638
  const unresolved = preflight.resolutions.filter((resolution) => resolution.status === "unresolved");
@@ -49496,7 +49537,7 @@ async function handleEvidenceCommand(directory, args) {
49496
49537
  return formatTaskEvidenceMarkdown(evidenceData);
49497
49538
  }
49498
49539
  async function handleEvidenceSummaryCommand(directory) {
49499
- const { buildEvidenceSummary } = await import("./evidence-summary-service-nqbcvp30.js");
49540
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-7cn9z4sn.js");
49500
49541
  const artifact = await buildEvidenceSummary(directory);
49501
49542
  if (!artifact) {
49502
49543
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -56378,25 +56419,12 @@ function extractDecisions(content) {
56378
56419
  if (!content)
56379
56420
  return [];
56380
56421
  const decisions = [];
56381
- const lines = content.split(`
56382
- `);
56383
- let inDecisionsSection = false;
56384
- for (const line of lines) {
56385
- if (line.trim() === "## Decisions") {
56386
- inDecisionsSection = true;
56387
- continue;
56388
- }
56389
- if (inDecisionsSection && line.startsWith("## ") && line.trim() !== "## Decisions") {
56390
- break;
56391
- }
56392
- if (inDecisionsSection && line.trim().startsWith("- ")) {
56393
- const text = line.trim().substring(2);
56394
- const cleaned = text.replace(/\s*\[.*?\]\s*/g, "").replace(/\u2705/g, "").replace(/\[confirmed\]/g, "").trim();
56395
- if (cleaned) {
56396
- const sanitized = sanitizeString2(cleaned, MAX_DECISION_LENGTH);
56397
- if (sanitized) {
56398
- decisions.push(sanitized);
56399
- }
56422
+ for (const decision of extractContextDecisions(content)) {
56423
+ const cleaned = decision.text.replace(/\u2705/g, "").trim();
56424
+ if (cleaned) {
56425
+ const sanitized = sanitizeString2(cleaned, MAX_DECISION_LENGTH);
56426
+ if (sanitized) {
56427
+ decisions.push(sanitized);
56400
56428
  }
56401
56429
  }
56402
56430
  }
@@ -68458,8 +68486,17 @@ var _internals70 = {
68458
68486
  safeRealpathSync,
68459
68487
  fsRename: fsPromises4.rename.bind(fsPromises4),
68460
68488
  retryDelayMs: WINDOWS_RENAME_RETRY_DELAY_MS2,
68461
- writeFingerprint
68489
+ writeFingerprint,
68490
+ cacheArtifactMatches
68462
68491
  };
68492
+ function cacheArtifactMatches(cachedMtime, cachedIno, cachedSize, stats) {
68493
+ if (cachedMtime !== undefined && stats.mtimeMs !== cachedMtime)
68494
+ return false;
68495
+ if (cachedSize !== undefined && stats.size !== cachedSize)
68496
+ return false;
68497
+ const liveIno = String(stats.ino ?? 0);
68498
+ return cachedIno === undefined || cachedIno === "0" || liveIno === "0" || cachedIno === liveIno;
68499
+ }
68463
68500
 
68464
68501
  // src/memory/reflection.ts
68465
68502
  var DAY_MS = 24 * 60 * 60 * 1000;
@@ -75373,7 +75410,7 @@ var test_runner = createSwarmTool({
75373
75410
  targets: exports_external.array(exports_external.string()).optional().describe("Framework-native test names or patterns to filter which tests run. Supported by cargo, go-test, maven, gradle, dotnet-test, ctest, and swift-test. Each entry is passed as-is to the framework's native filter flag."),
75374
75411
  coverage: exports_external.boolean().optional().describe("Enable coverage reporting if supported"),
75375
75412
  bail: exports_external.boolean().optional().describe("Stop running tests after the first failure. Default false. Note: coverage may be incomplete when bail=true with coverage=true."),
75376
- timeout_ms: exports_external.number().optional().describe("Timeout in milliseconds (default 60000, max 300000)"),
75413
+ timeout_ms: exports_external.number().int().min(1).default(DEFAULT_TIMEOUT_MS2).describe("Timeout in milliseconds (default 60000, max 300000)"),
75377
75414
  working_directory: exports_external.string().optional().describe("Explicit project root directory. When provided, tests run relative to this path instead of the plugin context directory. Use this when CWD differs from the actual project root.")
75378
75415
  },
75379
75416
  async execute(args, directory) {
@@ -84853,7 +84890,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
84853
84890
  if (!input.dispatcher) {
84854
84891
  throw new Error("no evaluation dispatcher available (cannot run validation)");
84855
84892
  }
84856
- const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-mb51twxt.js");
84893
+ const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-0e3bjeev.js");
84857
84894
  const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
84858
84895
  const result = await withProtectedSetIntegrity([evalInputRoot, ...protectedRoots(input.directory)], () => _internals99.evaluateCandidateV1({
84859
84896
  projectRoot: input.directory,
@@ -85370,7 +85407,7 @@ async function handleSpecifyCommand(_directory, args) {
85370
85407
  // src/services/status-service.ts
85371
85408
  import * as fsSync4 from "fs";
85372
85409
  import { readFile as readFile26 } from "fs/promises";
85373
- import * as path117 from "path";
85410
+ import * as path118 from "path";
85374
85411
  init_loader();
85375
85412
  init_schema();
85376
85413
 
@@ -85930,6 +85967,239 @@ function getCompactionMetrics(sessionId) {
85930
85967
  return { compactionCount: total, lastSnapshotAt: lastSnapshot };
85931
85968
  }
85932
85969
 
85970
+ // src/services/decision-drift-analyzer.ts
85971
+ import * as fs53 from "fs";
85972
+ import * as path117 from "path";
85973
+ var DEFAULT_DRIFT_CONFIG = {
85974
+ staleThresholdPhases: 1,
85975
+ detectContradictions: true,
85976
+ maxSignals: 5
85977
+ };
85978
+ function extractDecisionsFromContext(contextContent) {
85979
+ return extractContextDecisions(contextContent);
85980
+ }
85981
+ function isDecisionStale(decision, currentPhase, threshold) {
85982
+ if (decision.phase === null) {
85983
+ return !decision.confirmed;
85984
+ }
85985
+ const phaseDiff = currentPhase - decision.phase;
85986
+ if (phaseDiff >= threshold) {
85987
+ return true;
85988
+ }
85989
+ if (phaseDiff === 0 && !decision.confirmed) {
85990
+ return true;
85991
+ }
85992
+ return false;
85993
+ }
85994
+ function classifyPolarity(textLower, positiveKeywords, negativeKeywords) {
85995
+ if (negativeKeywords.some((k) => textLower.includes(k))) {
85996
+ return "negative";
85997
+ }
85998
+ if (positiveKeywords.some((k) => textLower.includes(k))) {
85999
+ return "positive";
86000
+ }
86001
+ return null;
86002
+ }
86003
+ function findContradictions(decisions) {
86004
+ const signals = [];
86005
+ const contradictionPairs = [
86006
+ [
86007
+ ["use", "using", "use ", "adopt", "implement", "enable"],
86008
+ ["not use", "don't use", "do not use", "avoid", "disable", "remove"]
86009
+ ],
86010
+ [
86011
+ ["keep", "retain", "preserve"],
86012
+ ["remove", "delete", "drop", "eliminate"]
86013
+ ],
86014
+ [
86015
+ ["include", "add", "incorporate"],
86016
+ ["exclude", "skip", "omit"]
86017
+ ],
86018
+ [
86019
+ ["require", "mandatory", "must"],
86020
+ ["optional", "skip", "can skip"]
86021
+ ],
86022
+ [
86023
+ ["background", "async"],
86024
+ ["foreground", "sync", "synchronous"]
86025
+ ]
86026
+ ];
86027
+ for (let i = 0;i < decisions.length; i++) {
86028
+ const decisionA = decisions[i];
86029
+ const textLower = decisionA.text.toLowerCase();
86030
+ for (let j = i + 1;j < decisions.length; j++) {
86031
+ const decisionB = decisions[j];
86032
+ const textBLower = decisionB.text.toLowerCase();
86033
+ for (const [positiveKeywords, negativeKeywords] of contradictionPairs) {
86034
+ const polarityA = classifyPolarity(textLower, positiveKeywords, negativeKeywords);
86035
+ const polarityB = classifyPolarity(textBLower, positiveKeywords, negativeKeywords);
86036
+ const isOpposite = polarityA === "positive" && polarityB === "negative" || polarityA === "negative" && polarityB === "positive";
86037
+ if (isOpposite) {
86038
+ const wordsA = textLower.split(/\s+/).slice(0, 4).join(" ");
86039
+ const wordsB = textBLower.split(/\s+/).slice(0, 4).join(" ");
86040
+ const commonWords = wordsA.split(/\s+/).filter((w) => w.length > 2 && wordsB.includes(w));
86041
+ if (commonWords.length > 0 || wordsA.includes("file")) {
86042
+ signals.push({
86043
+ id: `contradiction-${i}-${j}`,
86044
+ severity: "error",
86045
+ type: "contradiction",
86046
+ message: `Contradictory decisions detected`,
86047
+ source: {
86048
+ file: "context.md",
86049
+ line: decisionA.line
86050
+ },
86051
+ relatedDecisions: [decisionA.text, decisionB.text],
86052
+ hint: "Review both decisions and clarify the intended approach."
86053
+ });
86054
+ }
86055
+ }
86056
+ }
86057
+ }
86058
+ }
86059
+ return signals;
86060
+ }
86061
+ function extractCurrentPhaseFromLegacy(planContent) {
86062
+ if (!planContent)
86063
+ return null;
86064
+ const lines = planContent.split(`
86065
+ `);
86066
+ for (let i = 0;i < Math.min(30, lines.length); i++) {
86067
+ const line = lines[i].trim();
86068
+ const progressMatch = line.match(/^## Phase (\d+):?\s*(.*?)\s*\[IN PROGRESS\]/i);
86069
+ if (progressMatch) {
86070
+ return parseInt(progressMatch[1], 10);
86071
+ }
86072
+ }
86073
+ for (let i = 0;i < Math.min(5, lines.length); i++) {
86074
+ const line = lines[i].trim();
86075
+ const phaseMatch = line.match(/Phase:\s*(\d+)/i);
86076
+ if (phaseMatch) {
86077
+ return parseInt(phaseMatch[1], 10);
86078
+ }
86079
+ }
86080
+ return null;
86081
+ }
86082
+ async function analyzeDecisionDrift(directory, config = {}) {
86083
+ const effectiveConfig = {
86084
+ ...DEFAULT_DRIFT_CONFIG,
86085
+ ...config
86086
+ };
86087
+ const signals = [];
86088
+ const analyzedAt = new Date().toISOString();
86089
+ try {
86090
+ const plan = await loadPlan(directory);
86091
+ let currentPhase = plan?.current_phase ?? 1;
86092
+ if (!plan) {
86093
+ const legacyPhase = extractCurrentPhaseFromLegacy(await readSwarmFileAsync(directory, "plan.md") ?? "");
86094
+ if (legacyPhase !== null) {
86095
+ currentPhase = legacyPhase;
86096
+ }
86097
+ }
86098
+ const contextPath = path117.join(directory, ".swarm", "context.md");
86099
+ let contextContent = "";
86100
+ try {
86101
+ if (fs53.existsSync(contextPath)) {
86102
+ contextContent = fs53.readFileSync(contextPath, "utf-8");
86103
+ }
86104
+ } catch (error2) {
86105
+ log("[DecisionDriftAnalyzer] context file read failed", {
86106
+ error: error2 instanceof Error ? error2.message : String(error2)
86107
+ });
86108
+ return {
86109
+ hasDrift: false,
86110
+ signals: [],
86111
+ summary: "",
86112
+ analyzedAt
86113
+ };
86114
+ }
86115
+ if (!contextContent) {
86116
+ return {
86117
+ hasDrift: false,
86118
+ signals: [],
86119
+ summary: "",
86120
+ analyzedAt
86121
+ };
86122
+ }
86123
+ const decisions = extractDecisionsFromContext(contextContent);
86124
+ if (decisions.length === 0) {
86125
+ return {
86126
+ hasDrift: false,
86127
+ signals: [],
86128
+ summary: "",
86129
+ analyzedAt
86130
+ };
86131
+ }
86132
+ for (const decision of decisions) {
86133
+ if (isDecisionStale(decision, currentPhase, effectiveConfig.staleThresholdPhases)) {
86134
+ let hint;
86135
+ if (decision.phase !== null && decision.phase < currentPhase) {
86136
+ hint = `Decision was from Phase ${decision.phase}, current is Phase ${currentPhase}.`;
86137
+ } else if (!decision.confirmed) {
86138
+ hint = "Decision has not been confirmed. Consider confirming or revisiting.";
86139
+ }
86140
+ signals.push({
86141
+ id: `stale-${decision.line}`,
86142
+ severity: decision.phase !== null && decision.phase < currentPhase ? "warning" : "warning",
86143
+ type: "stale",
86144
+ message: `Stale decision: "${decision.text.substring(0, 50)}${decision.text.length > 50 ? "..." : ""}"`,
86145
+ source: {
86146
+ file: "context.md",
86147
+ line: decision.line
86148
+ },
86149
+ hint
86150
+ });
86151
+ }
86152
+ }
86153
+ if (effectiveConfig.detectContradictions) {
86154
+ const contradictions = findContradictions(decisions);
86155
+ signals.push(...contradictions);
86156
+ }
86157
+ const limitedSignals = signals.slice(0, effectiveConfig.maxSignals);
86158
+ const summary = buildDriftSummary(limitedSignals);
86159
+ return {
86160
+ hasDrift: limitedSignals.length > 0,
86161
+ signals: limitedSignals,
86162
+ summary,
86163
+ analyzedAt
86164
+ };
86165
+ } catch (error2) {
86166
+ log("[DecisionDriftAnalyzer] drift analysis failed", {
86167
+ error: error2 instanceof Error ? error2.message : String(error2)
86168
+ });
86169
+ return {
86170
+ hasDrift: false,
86171
+ signals: [],
86172
+ summary: "",
86173
+ analyzedAt
86174
+ };
86175
+ }
86176
+ }
86177
+ function buildDriftSummary(signals) {
86178
+ if (signals.length === 0) {
86179
+ return "";
86180
+ }
86181
+ const warnings = signals.filter((s) => s.severity === "warning");
86182
+ const errors = signals.filter((s) => s.severity === "error");
86183
+ const lines = ["[SWARM DECISION DRIFT]"];
86184
+ if (errors.length > 0) {
86185
+ lines.push(`\u26A0\uFE0F ${errors.length} contradiction(s) detected:`);
86186
+ for (const err of errors.slice(0, 2)) {
86187
+ const related = err.relatedDecisions ? ` (${err.relatedDecisions[0].substring(0, 30)}... vs ${err.relatedDecisions[1].substring(0, 30)}...)` : "";
86188
+ lines.push(` - ${err.type}: ${err.message}${related}`);
86189
+ }
86190
+ }
86191
+ if (warnings.length > 0) {
86192
+ lines.push(`\uD83D\uDCA1 ${warnings.length} stale decision(s) found:`);
86193
+ for (const warn2 of warnings.slice(0, 3)) {
86194
+ const hint = warn2.hint ? ` - ${warn2.hint}` : "";
86195
+ lines.push(` - ${warn2.message.substring(0, 60)}${hint}`);
86196
+ }
86197
+ }
86198
+ lines.push("See .swarm/context.md for details.");
86199
+ return lines.join(`
86200
+ `);
86201
+ }
86202
+
85933
86203
  // src/services/status-service.ts
85934
86204
  var _internals100 = {
85935
86205
  loadLeanTurboRunState,
@@ -85937,7 +86207,8 @@ var _internals100 = {
85937
86207
  hasActiveFullAuto,
85938
86208
  getActiveFullAutoSessionID,
85939
86209
  loadFullAutoRunState,
85940
- summarizeTelemetryCosts
86210
+ summarizeTelemetryCosts,
86211
+ renderNoActivePlanStatusTail
85941
86212
  };
85942
86213
  var MAX_TRACKED_TELEMETRY_COST_SUMMARIES = 32;
85943
86214
  var telemetryCostSummaryCache = new Map;
@@ -85958,10 +86229,10 @@ function getTelemetryCostSummary(directory) {
85958
86229
  return summary;
85959
86230
  }
85960
86231
  function readTelemetryCostStamp(directory) {
85961
- const swarmDir = path117.join(directory, ".swarm");
86232
+ const swarmDir = path118.join(directory, ".swarm");
85962
86233
  const files = [
85963
- path117.join(swarmDir, "telemetry.jsonl.1"),
85964
- path117.join(swarmDir, "telemetry.jsonl")
86234
+ path118.join(swarmDir, "telemetry.jsonl.1"),
86235
+ path118.join(swarmDir, "telemetry.jsonl")
85965
86236
  ];
85966
86237
  return files.map((file) => {
85967
86238
  try {
@@ -86051,7 +86322,7 @@ function formatLedgerBytes(bytes) {
86051
86322
  }
86052
86323
  function readSpecStalenessSnapshot(directory) {
86053
86324
  try {
86054
- const p = path117.join(directory, ".swarm", "spec-staleness.json");
86325
+ const p = path118.join(directory, ".swarm", "spec-staleness.json");
86055
86326
  if (!fsSync4.existsSync(p))
86056
86327
  return { stale: false };
86057
86328
  const raw = fsSync4.readFileSync(p, "utf-8");
@@ -86079,6 +86350,53 @@ function formatAgo(ms) {
86079
86350
  const days = Math.floor(hours / 24);
86080
86351
  return `${days}d ago`;
86081
86352
  }
86353
+ async function collectDecisionDriftSnapshot(directory) {
86354
+ try {
86355
+ const config = loadPluginConfig(directory);
86356
+ if (config.automation?.capabilities?.decision_drift_detection === false) {
86357
+ return;
86358
+ }
86359
+ const result = await analyzeDecisionDrift(directory);
86360
+ const staleCount = result.signals.filter((s) => s.type === "stale").length;
86361
+ const contradictionCount = result.signals.filter((s) => s.type === "contradiction").length;
86362
+ if (staleCount === 0 && contradictionCount === 0) {
86363
+ return;
86364
+ }
86365
+ const contextContent = await readSwarmFileAsync(directory, "context.md");
86366
+ const lastDecisionAt = latestDecisionTimestamp(contextContent);
86367
+ return lastDecisionAt ? { staleCount, contradictionCount, lastDecisionAt } : { staleCount, contradictionCount };
86368
+ } catch {
86369
+ return;
86370
+ }
86371
+ }
86372
+ function latestDecisionTimestamp(contextContent) {
86373
+ if (!contextContent)
86374
+ return null;
86375
+ let latest = null;
86376
+ for (const decision of extractContextDecisions(contextContent)) {
86377
+ if (decision.timestamp && (!latest || decision.timestamp > latest)) {
86378
+ latest = decision.timestamp;
86379
+ }
86380
+ }
86381
+ return latest;
86382
+ }
86383
+ function formatDecisionDriftLines(drift) {
86384
+ if (!drift)
86385
+ return null;
86386
+ if (drift.staleCount <= 0 && drift.contradictionCount <= 0)
86387
+ return null;
86388
+ const parts = [];
86389
+ if (drift.staleCount > 0)
86390
+ parts.push(`${drift.staleCount} stale`);
86391
+ if (drift.contradictionCount > 0) {
86392
+ parts.push(`${drift.contradictionCount} contradictory`);
86393
+ }
86394
+ const lastSuffix = drift.lastDecisionAt ? ` (last decision ${drift.lastDecisionAt})` : "";
86395
+ const total = drift.staleCount + drift.contradictionCount;
86396
+ return [
86397
+ `**Decision drift detected**: ${parts.join(", ")} decision${total > 1 ? "s" : ""}${lastSuffix}. See .swarm/context.md.`
86398
+ ];
86399
+ }
86082
86400
  async function getStatusData(directory, agents, sessionId, options) {
86083
86401
  const plan = await loadPlan(directory);
86084
86402
  let status;
@@ -86157,6 +86475,7 @@ async function getStatusData(directory, agents, sessionId, options) {
86157
86475
  status.specStale = true;
86158
86476
  status.specStaleReason = plan._specStaleReason;
86159
86477
  }
86478
+ status.decisionDrift = await collectDecisionDriftSnapshot(directory);
86160
86479
  status.recentEscalations = await readRecentEscalations(directory);
86161
86480
  status.pendingProposals = await countProposals(directory);
86162
86481
  status.unactionableQueueDepth = await safeLineCount(resolveUnactionablePath(directory));
@@ -86228,7 +86547,7 @@ async function getStatusData(directory, agents, sessionId, options) {
86228
86547
  const memoryConfig = MemoryConfigSchema.parse(loadPluginConfig(directory).memory ?? {});
86229
86548
  provider = memoryConfig.provider;
86230
86549
  if (memoryPointer) {
86231
- const cohortConfigPath = path117.join(resolveLinkDir(memoryPointer.linkId), "memory", "memory-cohort-config.json");
86550
+ const cohortConfigPath = path118.join(resolveLinkDir(memoryPointer.linkId), "memory", "memory-cohort-config.json");
86232
86551
  if (fsSync4.existsSync(cohortConfigPath)) {
86233
86552
  const stored = JSON.parse(fsSync4.readFileSync(cohortConfigPath, "utf-8"));
86234
86553
  const versionCheck = classifyStoredFingerprintAlgorithmVersion(stored.algorithm_version);
@@ -86411,6 +86730,10 @@ function formatStatusMarkdown(status) {
86411
86730
  const current = status.specStaleCurrentHash ?? "(spec.md missing)";
86412
86731
  lines.push("", `**Spec drift detected**: ${reason} (stored: ${stored}, current: ${current})`, "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.");
86413
86732
  }
86733
+ const decisionDriftLines = formatDecisionDriftLines(status.decisionDrift);
86734
+ if (decisionDriftLines) {
86735
+ lines.push("", ...decisionDriftLines);
86736
+ }
86414
86737
  if (status.turboStrategy && status.turboStrategy !== "off") {
86415
86738
  lines.push("");
86416
86739
  if (status.turboStrategy === "lean") {
@@ -86623,6 +86946,55 @@ function renderBackgroundWorkLines(backgroundWork) {
86623
86946
  }
86624
86947
  return lines;
86625
86948
  }
86949
+ function renderNoActivePlanStatusTail(statusData) {
86950
+ const decisionDriftLines = formatDecisionDriftLines(statusData.decisionDrift);
86951
+ if (statusData.specStale) {
86952
+ const reason = statusData.specStaleReason ?? "spec.md changed since plan saved";
86953
+ const stored = statusData.specStaleStoredHash ?? "unknown";
86954
+ const current = statusData.specStaleCurrentHash ?? "(spec.md missing)";
86955
+ return [
86956
+ "No active swarm plan found.",
86957
+ "",
86958
+ `**Spec drift detected**: ${reason} (stored: ${stored}, current: ${current})`,
86959
+ "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.",
86960
+ ...decisionDriftLines ?? []
86961
+ ].join(`
86962
+ `);
86963
+ }
86964
+ const delegationHealth = statusData.delegationLedgerHealth;
86965
+ 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)) {
86966
+ const lines = [
86967
+ "No active swarm plan found.",
86968
+ "",
86969
+ "**Background Delegations**:"
86970
+ ];
86971
+ lines.push(` - Ledger tail: ${formatLedgerBytes(delegationHealth.ledger.bytes)} / ${formatLedgerBytes(delegationHealth.ledger.limitBytes)} recovery bound (${delegationHealth.ledger.pressurePct}% \u2014 ${delegationHealth.ledger.band})`);
86972
+ if (delegationHealth.checkpoint) {
86973
+ lines.push(` - Checkpoint #${delegationHealth.checkpoint.sequence} (${delegationHealth.checkpoint.liveRecords} live, ${delegationHealth.checkpoint.closedSummaries} archived)`);
86974
+ }
86975
+ if (delegationHealth.recovery) {
86976
+ lines.push(` - Recovery: ${delegationHealth.recovery.source} (${delegationHealth.recovery.ok ? "ok" : `FAILED: ${delegationHealth.recovery.reason ?? "uncertain"}`})`);
86977
+ }
86978
+ const compactCounts = delegationHealth.counts;
86979
+ if (compactCounts.activeOwners > 0 || compactCounts.pendingAdvisories > 0 || compactCounts.lateTerminals > 0 || compactCounts.orphanWorktreeOwners > 0) {
86980
+ lines.push(` - Live set: ${compactCounts.activeOwners} active owners, ${compactCounts.pendingAdvisories} pending advisories, ${compactCounts.lateTerminals} late terminals, ${compactCounts.orphanWorktreeOwners} unsettled worktree owners`);
86981
+ }
86982
+ if (delegationHealth.lastUncertainty) {
86983
+ lines.push(` - \u26A0 Last uncertainty (${new Date(delegationHealth.lastUncertainty.at).toISOString()}): ${delegationHealth.lastUncertainty.reason}`);
86984
+ if (delegationHealth.lastUncertainty.repairHint) {
86985
+ lines.push(` repair: ${delegationHealth.lastUncertainty.repairHint}`);
86986
+ }
86987
+ }
86988
+ lines.push(...decisionDriftLines ?? []);
86989
+ return lines.join(`
86990
+ `);
86991
+ }
86992
+ if (decisionDriftLines) {
86993
+ return ["No active swarm plan found.", "", ...decisionDriftLines].join(`
86994
+ `);
86995
+ }
86996
+ return "No active swarm plan found.";
86997
+ }
86626
86998
  async function handleStatusCommand(directory, agents, sessionId, options) {
86627
86999
  const statusData = await getStatusData(directory, agents, sessionId, options);
86628
87000
  if (!statusData.hasPlan) {
@@ -86639,46 +87011,7 @@ async function handleStatusCommand(directory, agents, sessionId, options) {
86639
87011
  return lines.join(`
86640
87012
  `);
86641
87013
  }
86642
- if (statusData.specStale) {
86643
- const reason = statusData.specStaleReason ?? "spec.md changed since plan saved";
86644
- const stored = statusData.specStaleStoredHash ?? "unknown";
86645
- const current = statusData.specStaleCurrentHash ?? "(spec.md missing)";
86646
- return [
86647
- "No active swarm plan found.",
86648
- "",
86649
- `**Spec drift detected**: ${reason} (stored: ${stored}, current: ${current})`,
86650
- "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."
86651
- ].join(`
86652
- `);
86653
- }
86654
- const delegationHealth = statusData.delegationLedgerHealth;
86655
- 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)) {
86656
- const lines = [
86657
- "No active swarm plan found.",
86658
- "",
86659
- "**Background Delegations**:"
86660
- ];
86661
- lines.push(` - Ledger tail: ${formatLedgerBytes(delegationHealth.ledger.bytes)} / ${formatLedgerBytes(delegationHealth.ledger.limitBytes)} recovery bound (${delegationHealth.ledger.pressurePct}% \u2014 ${delegationHealth.ledger.band})`);
86662
- if (delegationHealth.checkpoint) {
86663
- lines.push(` - Checkpoint #${delegationHealth.checkpoint.sequence} (${delegationHealth.checkpoint.liveRecords} live, ${delegationHealth.checkpoint.closedSummaries} archived)`);
86664
- }
86665
- if (delegationHealth.recovery) {
86666
- lines.push(` - Recovery: ${delegationHealth.recovery.source} (${delegationHealth.recovery.ok ? "ok" : `FAILED: ${delegationHealth.recovery.reason ?? "uncertain"}`})`);
86667
- }
86668
- const compactCounts = delegationHealth.counts;
86669
- if (compactCounts.activeOwners > 0 || compactCounts.pendingAdvisories > 0 || compactCounts.lateTerminals > 0 || compactCounts.orphanWorktreeOwners > 0) {
86670
- lines.push(` - Live set: ${compactCounts.activeOwners} active owners, ${compactCounts.pendingAdvisories} pending advisories, ${compactCounts.lateTerminals} late terminals, ${compactCounts.orphanWorktreeOwners} unsettled worktree owners`);
86671
- }
86672
- if (delegationHealth.lastUncertainty) {
86673
- lines.push(` - \u26A0 Last uncertainty (${new Date(delegationHealth.lastUncertainty.at).toISOString()}): ${delegationHealth.lastUncertainty.reason}`);
86674
- if (delegationHealth.lastUncertainty.repairHint) {
86675
- lines.push(` repair: ${delegationHealth.lastUncertainty.repairHint}`);
86676
- }
86677
- }
86678
- return lines.join(`
86679
- `);
86680
- }
86681
- return "No active swarm plan found.";
87014
+ return _internals100.renderNoActivePlanStatusTail(statusData);
86682
87015
  }
86683
87016
  return formatStatusMarkdown(statusData);
86684
87017
  }
@@ -86747,6 +87080,18 @@ No active swarm plan found. Nothing to sync.`;
86747
87080
  // src/commands/turbo.ts
86748
87081
  init_logger();
86749
87082
 
87083
+ // src/utils/sanitize-display.ts
87084
+ function stripControlCharacters(input) {
87085
+ let out = "";
87086
+ for (const ch of input) {
87087
+ const code = ch.codePointAt(0) ?? 0;
87088
+ if (code < 32 || code === 127)
87089
+ continue;
87090
+ out += ch;
87091
+ }
87092
+ return out;
87093
+ }
87094
+
86750
87095
  // src/commands/turbo-constants.ts
86751
87096
  var TURBO_BYPASS_DISCLOSURE = "Bypassed: Stage B (reviewer + test_engineer) for Tier 0-2 tasks; phase_complete Gates 1-5 " + "(completion-verify, drift-verifier, hallucination-guard, mutation-gate, phase-council). " + "Still enforced: Stage A (lint, imports, pre_check_batch); Tier 3 Stage B; Gate 5b " + "(architecture-supervisor); Gate 6 (final-council); Gate 7 (full-auto).";
86752
87097
 
@@ -86762,8 +87107,9 @@ async function handleTurboCommand(directory, args, sessionID) {
86762
87107
  if (!session) {
86763
87108
  return "Error: No active session. Turbo Mode requires an active session to operate.";
86764
87109
  }
86765
- const arg0 = args[0]?.toLowerCase();
86766
- const arg1 = args[1]?.toLowerCase();
87110
+ const tokens = args.filter((a) => a !== undefined && a.trim() !== "");
87111
+ const arg0 = tokens[0]?.toLowerCase();
87112
+ const arg1 = tokens[1]?.toLowerCase();
86767
87113
  if (arg0 === "status") {
86768
87114
  return buildStatusMessage2(session, directory, sessionID);
86769
87115
  }
@@ -86840,6 +87186,21 @@ async function handleTurboCommand(directory, args, sessionID) {
86840
87186
  session.leanTurboCurrentPhase = undefined;
86841
87187
  return `Turbo Mode enabled (standard). ${TURBO_BYPASS_DISCLOSURE}`;
86842
87188
  }
87189
+ if (arg0 === "standard" && arg1 === undefined) {
87190
+ const isStandardActive = session.turboMode === true && session.turboStrategy === "standard";
87191
+ if (isStandardActive) {
87192
+ disableTurbo("/swarm turbo standard (toggle off)");
87193
+ return "Turbo Mode disabled";
87194
+ }
87195
+ if (isLeanActive) {
87196
+ disableTurbo("/swarm turbo standard (switching from lean)");
87197
+ }
87198
+ session.turboMode = true;
87199
+ session.turboStrategy = "standard";
87200
+ session.leanTurboActive = false;
87201
+ session.leanTurboCurrentPhase = undefined;
87202
+ return `Turbo Mode enabled (standard). ${TURBO_BYPASS_DISCLOSURE}`;
87203
+ }
86843
87204
  if (arg0 === "lean" && arg1 === "on") {
86844
87205
  return enableLeanTurbo(session, directory, sessionID);
86845
87206
  }
@@ -86893,16 +87254,11 @@ Epic Mode could not be enabled: ${error2 instanceof Error ? error2.message : Str
86893
87254
  return `${leanMsg}
86894
87255
  Epic Mode enabled \u2014 the architect will use the transparent decide-then-dispatch wave flow: declare_scope (per pending task) \u2192 epic_decide_phase \u2192 epic_plan_waves \u2192 Task (per task in current wave, all in one message) \u2192 epic_record_divergence.`;
86895
87256
  }
86896
- if (isTurboOn) {
86897
- disableTurbo("/swarm turbo (toggle off via unknown arg)");
86898
- return "Turbo Mode disabled";
86899
- } else {
86900
- session.turboMode = true;
86901
- session.turboStrategy = "standard";
86902
- session.leanTurboActive = false;
86903
- session.leanTurboCurrentPhase = undefined;
86904
- return `Turbo Mode enabled. ${TURBO_BYPASS_DISCLOSURE}`;
86905
- }
87257
+ const MODE_SUBCOMMANDS = new Set(["lean", "standard", "epic"]);
87258
+ const attempted = stripControlCharacters(arg0 !== undefined && MODE_SUBCOMMANDS.has(arg0) && arg1 !== undefined ? arg1 : arg0 ?? "").slice(0, 100);
87259
+ return `Unknown turbo argument "${attempted}". Turbo state is unchanged.
87260
+ ` + `Valid arguments: (none) | on | off | status | lean [on|off] | standard [on|off] | epic [on|off].
87261
+ ` + "Run `/swarm help` for details.";
86906
87262
  }
86907
87263
  function enableLeanTurbo(session, directory, sessionID) {
86908
87264
  let maxParallelCoders = 4;
@@ -86980,7 +87336,7 @@ function buildStatusMessage2(session, directory, sessionID) {
86980
87336
  }
86981
87337
 
86982
87338
  // src/commands/unlink.ts
86983
- import * as path118 from "path";
87339
+ import * as path119 from "path";
86984
87340
  async function handleUnlinkCommand(directory, args) {
86985
87341
  const pointer = readLinkPointer(directory);
86986
87342
  if (!pointer) {
@@ -86993,7 +87349,7 @@ async function handleUnlinkCommand(directory, args) {
86993
87349
  let familySummary = "";
86994
87350
  if (copyBack) {
86995
87351
  try {
86996
- const result = await migrateKnowledgeFamily(path118.join(directory, ".swarm"), linkDir);
87352
+ const result = await migrateKnowledgeFamily(path119.join(directory, ".swarm"), linkDir);
86997
87353
  for (const m of result.perMember) {
86998
87354
  totalMerged += m.merged;
86999
87355
  totalSkipped += m.skipped;
@@ -87144,7 +87500,8 @@ function findSimilarCommands(query) {
87144
87500
  return { cmd, score };
87145
87501
  });
87146
87502
  scored.sort((a, b) => a.score - b.score);
87147
- return scored.slice(0, 3).map((s) => s.cmd);
87503
+ const cutoff = Math.max(2, Math.ceil(q.length / 3));
87504
+ return scored.filter((s) => s.score <= cutoff).slice(0, 3).map((s) => s.cmd);
87148
87505
  }
87149
87506
  function emitValidationWarnings(prefix, warnings) {
87150
87507
  if (warnings.length === 0)
@@ -87174,16 +87531,21 @@ function buildDetailedHelp(commandName, entry) {
87174
87531
  async function handleHelpCommand(ctx) {
87175
87532
  const targetCommand = ctx.args.join(" ");
87176
87533
  if (!targetCommand) {
87177
- const { buildHelpText } = await import("./index-d7j3n5ra.js");
87534
+ const { buildHelpText } = await import("./index-3c0z1jnc.js");
87178
87535
  return buildHelpText();
87179
87536
  }
87180
87537
  const tokens = targetCommand.split(/\s+/);
87181
87538
  const resolved = _internals102.resolveCommand(tokens);
87182
87539
  if (resolved) {
87183
- return _internals102.buildDetailedHelp(resolved.key, resolved.entry);
87540
+ const detailed = _internals102.buildDetailedHelp(resolved.key, resolved.entry);
87541
+ const originalEntry = COMMAND_REGISTRY[resolved.key];
87542
+ const aliasTarget = originalEntry?.handler ? undefined : originalEntry?.aliasOf;
87543
+ return aliasTarget ? `${detailed}
87544
+
87545
+ > Note: \`/swarm ${resolved.key}\` is a deprecated alias for \`/swarm ${aliasTarget}\`.` : detailed;
87184
87546
  }
87185
87547
  const similar = _internals102.findSimilarCommands(targetCommand);
87186
- const { buildHelpText: fullHelp } = await import("./index-d7j3n5ra.js");
87548
+ const { buildHelpText: fullHelp } = await import("./index-3c0z1jnc.js");
87187
87549
  if (similar.length > 0) {
87188
87550
  return `Command '/swarm ${targetCommand}' not found.
87189
87551
 
@@ -87201,12 +87563,15 @@ Showing full help:
87201
87563
 
87202
87564
  ` + fullHelp();
87203
87565
  }
87566
+ function isCommandFailure(value) {
87567
+ return typeof value === "object" && value !== null && value.ok === false;
87568
+ }
87204
87569
  async function handleModeCommandWithBundledSkills(ctx, handler, mechanicalMode) {
87205
87570
  if (ctx.packageRoot) {
87206
87571
  await syncBundledProjectSkillsIfMissingAsync(ctx.directory, ctx.packageRoot, true);
87207
87572
  }
87208
87573
  const result = await Promise.resolve(handler(ctx.directory, ctx.args));
87209
- if (/^\s*\[MODE:\s*[A-Z][A-Z0-9_-]*\b/.test(result)) {
87574
+ if (typeof result === "string" && /^\s*\[MODE:\s*[A-Z][A-Z0-9_-]*\b/.test(result)) {
87210
87575
  if (mechanicalMode) {
87211
87576
  await activatePrWorkflow(ctx.directory, ctx.sessionID, mechanicalMode, {
87212
87577
  requireCheckoutPreflight: true
@@ -87314,72 +87679,48 @@ var COMMAND_REGISTRY = {
87314
87679
  toolPolicy: "none"
87315
87680
  },
87316
87681
  "blueprint-validate": {
87317
- handler: (ctx) => handleBlueprintValidateCommand(ctx.directory, ctx.args, {
87318
- config: ctx.config
87319
- }),
87320
87682
  description: "TUI shortcut alias for blueprint validate",
87321
87683
  category: "utility",
87322
87684
  aliasOf: "blueprint validate",
87323
87685
  deprecated: true
87324
87686
  },
87325
87687
  "blueprint-current": {
87326
- handler: (ctx) => handleBlueprintCurrentCommand(ctx.directory, ctx.agents, {
87327
- config: ctx.config
87328
- }),
87329
87688
  description: "TUI shortcut alias for blueprint current",
87330
87689
  category: "utility",
87331
87690
  aliasOf: "blueprint current",
87332
87691
  deprecated: true
87333
87692
  },
87334
87693
  "blueprint-history": {
87335
- handler: (ctx) => handleBlueprintHistoryCommand(ctx.directory, ctx.args, {
87336
- config: ctx.config
87337
- }),
87338
87694
  description: "TUI shortcut alias for blueprint history",
87339
87695
  category: "utility",
87340
87696
  aliasOf: "blueprint history",
87341
87697
  deprecated: true
87342
87698
  },
87343
87699
  "blueprint-diff": {
87344
- handler: (ctx) => handleBlueprintDiffCommand(ctx.directory, ctx.args, {
87345
- config: ctx.config
87346
- }),
87347
87700
  description: "TUI shortcut alias for blueprint diff",
87348
87701
  category: "utility",
87349
87702
  aliasOf: "blueprint diff",
87350
87703
  deprecated: true
87351
87704
  },
87352
87705
  "blueprint-export": {
87353
- handler: (ctx) => handleBlueprintExportCommand(ctx.directory, ctx.args, {
87354
- config: ctx.config
87355
- }),
87356
87706
  description: "TUI shortcut alias for blueprint export",
87357
87707
  category: "utility",
87358
87708
  aliasOf: "blueprint export",
87359
87709
  deprecated: true
87360
87710
  },
87361
87711
  "harness-candidate-validate": {
87362
- handler: (ctx) => handleHarnessCandidateValidateCommand(ctx.directory, ctx.args, {
87363
- config: ctx.config
87364
- }),
87365
87712
  description: "TUI shortcut alias for harness candidate validate",
87366
87713
  category: "utility",
87367
87714
  aliasOf: "harness candidate validate",
87368
87715
  deprecated: true
87369
87716
  },
87370
87717
  "harness-candidate-show": {
87371
- handler: (ctx) => handleHarnessCandidateShowCommand(ctx.directory, ctx.args, {
87372
- config: ctx.config
87373
- }),
87374
87718
  description: "TUI shortcut alias for harness candidate show",
87375
87719
  category: "utility",
87376
87720
  aliasOf: "harness candidate show",
87377
87721
  deprecated: true
87378
87722
  },
87379
87723
  "harness-candidate-diff": {
87380
- handler: (ctx) => handleHarnessCandidateDiffCommand(ctx.directory, ctx.args, {
87381
- config: ctx.config
87382
- }),
87383
87724
  description: "TUI shortcut alias for harness candidate diff",
87384
87725
  category: "utility",
87385
87726
  aliasOf: "harness candidate diff",
@@ -87415,7 +87756,6 @@ var COMMAND_REGISTRY = {
87415
87756
  toolNoArgs: true
87416
87757
  },
87417
87758
  "context-map-stats": {
87418
- handler: async (ctx) => handleContextMapStatsCommand(ctx.directory),
87419
87759
  description: "Show aggregated context-capsule telemetry stats",
87420
87760
  category: "diagnostics",
87421
87761
  aliasOf: "context-map stats",
@@ -87429,7 +87769,6 @@ var COMMAND_REGISTRY = {
87429
87769
  toolPolicy: "agent"
87430
87770
  },
87431
87771
  plan: {
87432
- handler: (ctx) => handlePlanCommand(ctx.directory, ctx.args),
87433
87772
  description: "Show current plan (deprecated alias for /swarm show-plan)",
87434
87773
  category: "core",
87435
87774
  clashesWithNativeCcCommand: "/plan",
@@ -87477,7 +87816,6 @@ var COMMAND_REGISTRY = {
87477
87816
  toolNoArgs: true
87478
87817
  },
87479
87818
  "config-doctor": {
87480
- handler: (ctx) => handleDoctorCommand(ctx.directory, ctx.args),
87481
87819
  description: "Run config doctor checks",
87482
87820
  subcommandOf: "config",
87483
87821
  category: "diagnostics",
@@ -87492,7 +87830,6 @@ var COMMAND_REGISTRY = {
87492
87830
  toolNoArgs: true
87493
87831
  },
87494
87832
  "doctor-tools": {
87495
- handler: (ctx) => handleDoctorToolsCommand(ctx.directory, ctx.args),
87496
87833
  description: "Run tool registration coherence check",
87497
87834
  category: "diagnostics",
87498
87835
  aliasOf: "doctor tools",
@@ -87506,7 +87843,6 @@ var COMMAND_REGISTRY = {
87506
87843
  toolNoArgs: true
87507
87844
  },
87508
87845
  diagnosis: {
87509
- handler: (ctx) => handleDiagnoseCommand(ctx.directory, ctx.args, ctx.sessionID),
87510
87846
  description: "Run health check on swarm state",
87511
87847
  category: "diagnostics",
87512
87848
  aliasOf: "diagnose",
@@ -87514,7 +87850,7 @@ var COMMAND_REGISTRY = {
87514
87850
  },
87515
87851
  "guardrail explain": {
87516
87852
  handler: async (ctx) => {
87517
- const { handleGuardrailExplain } = await import("./guardrail-explain-3ff1z3fm.js");
87853
+ const { handleGuardrailExplain } = await import("./guardrail-explain-4k2pqj46.js");
87518
87854
  return handleGuardrailExplain(ctx.directory, ctx.args);
87519
87855
  },
87520
87856
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -87524,7 +87860,7 @@ var COMMAND_REGISTRY = {
87524
87860
  },
87525
87861
  "guardrail reset": {
87526
87862
  handler: async (ctx) => {
87527
- const { handleGuardrailReset } = await import("./guardrail-reset-9wr6a60s.js");
87863
+ const { handleGuardrailReset } = await import("./guardrail-reset-xhh61cax.js");
87528
87864
  return handleGuardrailReset(ctx.args, ctx.sessionID);
87529
87865
  },
87530
87866
  description: "Reset one exact active invocation/action circuit after repair",
@@ -87532,20 +87868,12 @@ var COMMAND_REGISTRY = {
87532
87868
  toolPolicy: "agent"
87533
87869
  },
87534
87870
  "guardrail-explain": {
87535
- handler: async (ctx) => {
87536
- const { handleGuardrailExplain } = await import("./guardrail-explain-3ff1z3fm.js");
87537
- return handleGuardrailExplain(ctx.directory, ctx.args);
87538
- },
87539
87871
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
87540
87872
  category: "diagnostics",
87541
87873
  aliasOf: "guardrail explain",
87542
87874
  deprecated: true
87543
87875
  },
87544
87876
  "guardrail-reset": {
87545
- handler: async (ctx) => {
87546
- const { handleGuardrailReset } = await import("./guardrail-reset-9wr6a60s.js");
87547
- return handleGuardrailReset(ctx.args, ctx.sessionID);
87548
- },
87549
87877
  description: "Reset one exact active invocation/action circuit after repair",
87550
87878
  category: "diagnostics",
87551
87879
  aliasOf: "guardrail reset",
@@ -87553,7 +87881,7 @@ var COMMAND_REGISTRY = {
87553
87881
  },
87554
87882
  "guardrail-log": {
87555
87883
  handler: async (ctx) => {
87556
- const { handleGuardrailLog } = await import("./guardrail-log-sf39x00b.js");
87884
+ const { handleGuardrailLog } = await import("./guardrail-log-cnbv6vry.js");
87557
87885
  return handleGuardrailLog(ctx.directory, ctx.args);
87558
87886
  },
87559
87887
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -87587,6 +87915,7 @@ var COMMAND_REGISTRY = {
87587
87915
  handler: (ctx) => handleBenchmarkCommand(ctx.directory, ctx.args),
87588
87916
  description: "Show performance metrics [--cumulative] [--ci-gate] [--max-cost-usd <n>] [--gate-audit-run <id>]",
87589
87917
  args: "--cumulative, --ci-gate, --max-cost-usd <n>, --gate-audit-run <id>",
87918
+ details: "Exit codes (#2493 review F-14): with --ci-gate, the process exits 0 only when every quality check passes and 1 on any failure, budget breach, or missing evidence \u2014 CI-safe by construction. Without --ci-gate the command is informational and always exits 0.",
87590
87919
  category: "diagnostics",
87591
87920
  toolPolicy: "agent"
87592
87921
  },
@@ -87742,7 +88071,6 @@ var COMMAND_REGISTRY = {
87742
88071
  toolNoArgs: true
87743
88072
  },
87744
88073
  "evidence-summary": {
87745
- handler: (ctx) => handleEvidenceSummaryCommand(ctx.directory),
87746
88074
  description: "Generate evidence summary with completion ratio and blockers",
87747
88075
  subcommandOf: "evidence",
87748
88076
  args: "",
@@ -87752,7 +88080,6 @@ var COMMAND_REGISTRY = {
87752
88080
  deprecated: true
87753
88081
  },
87754
88082
  doctor: {
87755
- handler: (ctx) => handleDoctorCommand(ctx.directory, ctx.args),
87756
88083
  description: "Run config doctor checks",
87757
88084
  category: "diagnostics",
87758
88085
  aliasOf: "config doctor",
@@ -87760,35 +88087,30 @@ var COMMAND_REGISTRY = {
87760
88087
  clashesWithNativeCcCommand: "/doctor"
87761
88088
  },
87762
88089
  info: {
87763
- handler: async (ctx) => handleStatusCommand(ctx.directory, ctx.agents, ctx.sessionID),
87764
88090
  description: "Show current swarm state (plus background-work health when hooks.background_subagents is enabled)",
87765
88091
  category: "core",
87766
88092
  aliasOf: "status",
87767
88093
  deprecated: true
87768
88094
  },
87769
88095
  "list-agents": {
87770
- handler: (ctx) => Promise.resolve(handleAgentsCommand(ctx.agents, undefined)),
87771
88096
  description: "List registered agents",
87772
88097
  category: "core",
87773
88098
  aliasOf: "agents",
87774
88099
  deprecated: true
87775
88100
  },
87776
88101
  health: {
87777
- handler: (ctx) => handleDiagnoseCommand(ctx.directory, ctx.args, ctx.sessionID),
87778
88102
  description: "Run health check on swarm state",
87779
88103
  category: "diagnostics",
87780
88104
  aliasOf: "diagnose",
87781
88105
  deprecated: true
87782
88106
  },
87783
88107
  check: {
87784
- handler: (ctx) => handlePreflightCommand(ctx.directory, ctx.args),
87785
88108
  description: "Run preflight automation checks",
87786
88109
  category: "diagnostics",
87787
88110
  aliasOf: "preflight",
87788
88111
  deprecated: true
87789
88112
  },
87790
88113
  clear: {
87791
- handler: (ctx) => handleResetSessionCommand(ctx.directory, ctx.args, ctx.sessionID),
87792
88114
  description: "Clear session state while preserving plan, evidence, and knowledge",
87793
88115
  category: "utility",
87794
88116
  aliasOf: "reset-session",
@@ -87849,15 +88171,12 @@ var COMMAND_REGISTRY = {
87849
88171
  sessionID: ctx.sessionID
87850
88172
  }),
87851
88173
  description: "Use /swarm finalize to finalize the swarm project and archive evidence",
87852
- details: "Idempotent 4-stage terminal finalization: (1) finalize writes retrospectives for in-progress phases, (2) archive creates timestamped bundle of swarm artifacts and evidence, (3) clean removes active-state files for a clean slate, (4) align performs aggressive git reset --hard to the default remote branch, discarding uncommitted changes and gitignored build artifacts (user-created untracked files are preserved); falls back to a cautious reset that preserves uncommitted changes when the aggressive path cannot proceed. WARNING: alignment discards local changes and gitignored files. Resets agent sessions, delegation chains, and active-agent mappings. Reads .swarm/close-lessons.md for explicit lessons and runs curation. Use --skill-review to run the quota-bounded skill_improver in proposal mode. Use --dry-run to preview what finalize would archive, clean, and align without taking the lock or changing anything.",
88174
+ details: "Idempotent 4-stage terminal finalization: (1) finalize writes retrospectives for in-progress phases, (2) archive creates timestamped bundle of swarm artifacts and evidence, (3) clean removes active-state files for a clean slate, (4) align performs aggressive git reset --hard to the default remote branch, discarding uncommitted changes and gitignored build artifacts (user-created untracked files are preserved); falls back to a cautious reset that preserves uncommitted changes when the aggressive path cannot proceed. WARNING: alignment discards local changes and gitignored files. Resets agent sessions, delegation chains, and active-agent mappings. Reads .swarm/close-lessons.md for explicit lessons and runs curation. Cleanup: knowledge.jsonl is preserved; plan.json, plan.md, events.jsonl, handoff.*, run-memory.jsonl, and summaries/ are removed. Use --skill-review to run the quota-bounded skill_improver in proposal mode. Use --dry-run to preview what finalize would archive, clean, and align without taking the lock or changing anything.",
87853
88175
  args: "--prune-branches, --skill-review, --dry-run",
87854
88176
  category: "core",
87855
88177
  toolPolicy: "none"
87856
88178
  },
87857
88179
  close: {
87858
- handler: (ctx) => handleCloseCommand(ctx.directory, ctx.args, {
87859
- sessionID: ctx.sessionID
87860
- }),
87861
88180
  description: "Use /swarm close (deprecated alias) to finalize and archive swarm state",
87862
88181
  details: "Deprecated alias for /swarm finalize. Preserved for backward compatibility. Supports the same flags, including --dry-run.",
87863
88182
  args: "--prune-branches, --skill-review, --dry-run",
@@ -87933,19 +88252,16 @@ Subcommands:
87933
88252
  toolPolicy: "agent"
87934
88253
  },
87935
88254
  "sdd-status": {
87936
- handler: (ctx) => handleSddStatusCommand(ctx.directory, ctx.args),
87937
88255
  description: "Show OpenSpec-compatible SDD status and effective spec source",
87938
88256
  aliasOf: "sdd status",
87939
88257
  deprecated: true
87940
88258
  },
87941
88259
  "sdd-validate": {
87942
- handler: (ctx) => handleSddValidateCommand(ctx.directory, ctx.args),
87943
88260
  description: "Validate OpenSpec-compatible artifacts and effective spec projection",
87944
88261
  aliasOf: "sdd validate",
87945
88262
  deprecated: true
87946
88263
  },
87947
88264
  "sdd-project": {
87948
- handler: (ctx) => handleSddProjectCommand(ctx.directory, ctx.args),
87949
88265
  description: "Materialize the OpenSpec-compatible effective spec into .swarm/spec.md",
87950
88266
  aliasOf: "sdd project",
87951
88267
  deprecated: true
@@ -88044,7 +88360,6 @@ Subcommands:
88044
88360
  toolPolicy: "agent"
88045
88361
  },
88046
88362
  "pr-subscribe": {
88047
- handler: (ctx) => handlePrSubscribeCommand(ctx.directory, ctx.args, ctx.sessionID),
88048
88363
  description: "Subscribe the current session to PR state-change notifications",
88049
88364
  aliasOf: "pr subscribe",
88050
88365
  deprecated: true
@@ -88058,7 +88373,6 @@ Subcommands:
88058
88373
  toolPolicy: "agent"
88059
88374
  },
88060
88375
  "pr-unsubscribe": {
88061
- handler: (ctx) => handlePrUnsubscribeCommand(ctx.directory, ctx.args, ctx.sessionID),
88062
88376
  description: "Unsubscribe the current session from PR state-change notifications",
88063
88377
  aliasOf: "pr unsubscribe",
88064
88378
  deprecated: true
@@ -88073,7 +88387,6 @@ Subcommands:
88073
88387
  toolNoArgs: true
88074
88388
  },
88075
88389
  "pr-status": {
88076
- handler: (ctx) => handlePrMonitorStatusCommand(ctx.directory, ctx.args, ctx.sessionID, ctx.source),
88077
88390
  description: "Show PR monitor subscription status for the current session",
88078
88391
  aliasOf: "pr status",
88079
88392
  deprecated: true
@@ -88095,7 +88408,6 @@ Subcommands:
88095
88408
  toolPolicy: "none"
88096
88409
  },
88097
88410
  "deep dive": {
88098
- handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleDeepDiveCommand),
88099
88411
  description: "Alias for /swarm deep-dive \u2014 launch deep codebase audit",
88100
88412
  args: "<scope> [--profile standard|security|ux|architecture|full] [--max-explorers 1..8] [--json] [--skip-update] [--allow-dirty]",
88101
88413
  category: "agent",
@@ -88110,7 +88422,6 @@ Subcommands:
88110
88422
  toolPolicy: "none"
88111
88423
  },
88112
88424
  "deep research": {
88113
- handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleDeepResearchCommand),
88114
88425
  description: "Alias for /swarm deep-research \u2014 launch a cited deep research pass",
88115
88426
  args: "<question> [--depth standard|exhaustive] [--max-researchers 1..6] [--rounds 1..4] [--brief]",
88116
88427
  category: "agent",
@@ -88125,7 +88436,6 @@ Subcommands:
88125
88436
  toolPolicy: "none"
88126
88437
  },
88127
88438
  "codebase review": {
88128
- handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleCodebaseReviewCommand),
88129
88439
  description: "Alias for /swarm codebase-review - launch codebase-review-swarm",
88130
88440
  args: "[scope] [--mode phase0|complete|defect|security|correctness|testing|ui|performance|ai-slop|enhancements|custom] [--tracks <list>] [--continue <run-id>] [--json] [--skip-update] [--allow-dirty]",
88131
88441
  category: "agent",
@@ -88140,7 +88450,6 @@ Subcommands:
88140
88450
  toolPolicy: "none"
88141
88451
  },
88142
88452
  "design docs": {
88143
- handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleDesignDocsCommand),
88144
88453
  description: "Alias for /swarm design-docs \u2014 generate or sync design docs",
88145
88454
  args: "<description> [--out <dir>] [--lang <name>] [--update]",
88146
88455
  category: "agent",
@@ -88196,7 +88505,7 @@ Subcommands:
88196
88505
  reset: {
88197
88506
  handler: (ctx) => handleResetCommand(ctx.directory, ctx.args),
88198
88507
  description: "Clear swarm state files [--confirm]",
88199
- details: "DELETES plan.md, context.md, and summaries/ directory from .swarm/. Stops background automation and clears in-memory queues. SAFETY: requires --confirm flag \u2014 without it, displays a warning and tips to export first. Before deleting, auto-backs up the state it removes to .swarm/reset-backups/<timestamp>/ (newest 5 kept) so it can be restored by copying the files back.",
88508
+ details: "DELETES plan.md, plan.json, context.md, events.jsonl, run-memory.jsonl, and summaries/ from .swarm/. Stops background automation and clears in-memory queues. SAFETY: requires --confirm flag \u2014 without it, displays a warning and tips to export first. Before deleting, auto-backs up the state it removes to .swarm/reset-backups/<timestamp>/ (newest 5 kept) so it can be restored by copying the files back.",
88200
88509
  args: "--confirm (required)",
88201
88510
  category: "utility",
88202
88511
  clashesWithNativeCcCommand: "/reset",
@@ -88477,25 +88786,21 @@ Subcommands:
88477
88786
  toolPolicy: "agent"
88478
88787
  },
88479
88788
  "memory-status": {
88480
- handler: (ctx) => handleMemoryStatusCommand(ctx.directory, ctx.args),
88481
88789
  description: "Show Swarm memory provider, JSONL, and migration status",
88482
88790
  aliasOf: "memory status",
88483
88791
  deprecated: true
88484
88792
  },
88485
88793
  "memory-export": {
88486
- handler: (ctx) => handleMemoryExportCommand(ctx.directory, ctx.args),
88487
88794
  description: "Export current Swarm memory to JSONL files",
88488
88795
  aliasOf: "memory export",
88489
88796
  deprecated: true
88490
88797
  },
88491
88798
  "memory-import": {
88492
- handler: (ctx) => handleMemoryImportCommand(ctx.directory, ctx.args),
88493
88799
  description: "Import legacy JSONL memory into SQLite",
88494
88800
  aliasOf: "memory import",
88495
88801
  deprecated: true
88496
88802
  },
88497
88803
  "memory-migrate": {
88498
- handler: (ctx) => handleMemoryMigrateCommand(ctx.directory, ctx.args),
88499
88804
  description: "Run the one-time legacy JSONL to SQLite migration",
88500
88805
  aliasOf: "memory migrate",
88501
88806
  deprecated: true
@@ -88516,6 +88821,10 @@ function validateAliases() {
88516
88821
  const warnings = [];
88517
88822
  for (const [name, entry] of Object.entries(COMMAND_REGISTRY)) {
88518
88823
  const cmdEntry = entry;
88824
+ if (!cmdEntry.handler && !cmdEntry.aliasOf) {
88825
+ errors.push(`Command '${name}' has no handler and no aliasOf \u2014 pure aliases must dereference to a canonical entry`);
88826
+ continue;
88827
+ }
88519
88828
  if (cmdEntry.aliasOf) {
88520
88829
  const target = cmdEntry.aliasOf;
88521
88830
  if (!Object.hasOwn(COMMAND_REGISTRY, target)) {
@@ -88523,24 +88832,24 @@ function validateAliases() {
88523
88832
  continue;
88524
88833
  }
88525
88834
  const visited = new Set;
88526
- const path119 = [];
88835
+ const path120 = [];
88527
88836
  let current = target;
88528
88837
  while (current) {
88529
88838
  const currentEntry = COMMAND_REGISTRY[current];
88530
88839
  if (!currentEntry)
88531
88840
  break;
88532
88841
  if (visited.has(current)) {
88533
- const cycleStart = path119.indexOf(current);
88842
+ const cycleStart = path120.indexOf(current);
88534
88843
  const fullChain = [
88535
88844
  name,
88536
- ...path119.slice(0, cycleStart > 0 ? cycleStart : path119.length),
88845
+ ...path120.slice(0, cycleStart > 0 ? cycleStart : path120.length),
88537
88846
  current
88538
88847
  ].join(" \u2192 ");
88539
88848
  errors.push(`Circular alias detected: ${fullChain}`);
88540
88849
  break;
88541
88850
  }
88542
88851
  visited.add(current);
88543
- path119.push(current);
88852
+ path120.push(current);
88544
88853
  current = currentEntry.aliasOf || "";
88545
88854
  }
88546
88855
  }
@@ -88589,38 +88898,48 @@ function resolveCommand(tokens) {
88589
88898
  const compound = `${tokens[0]} ${tokens[1]} ${tokens[2]}`;
88590
88899
  if (Object.hasOwn(COMMAND_REGISTRY, compound)) {
88591
88900
  return {
88592
- entry: COMMAND_REGISTRY[compound],
88593
- remainingArgs: tokens.slice(3),
88594
- key: compound
88901
+ ...resolveRegistryEntry(compound),
88902
+ remainingArgs: tokens.slice(3)
88595
88903
  };
88596
88904
  }
88597
88905
  }
88598
88906
  if (tokens.length >= 2) {
88599
88907
  const compound = `${tokens[0]} ${tokens[1]}`;
88600
88908
  if (Object.hasOwn(COMMAND_REGISTRY, compound)) {
88601
- const entry = COMMAND_REGISTRY[compound];
88602
- const warning = entry.deprecated ? `\u26A0\uFE0F "/swarm ${compound}" is deprecated. Use "/swarm ${entry.aliasOf}" instead.` : undefined;
88603
88909
  return {
88604
- entry,
88605
- remainingArgs: tokens.slice(2),
88606
- key: compound,
88607
- warning
88910
+ ...resolveRegistryEntry(compound),
88911
+ remainingArgs: tokens.slice(2)
88608
88912
  };
88609
88913
  }
88610
88914
  }
88611
88915
  const key = tokens[0];
88612
88916
  if (Object.hasOwn(COMMAND_REGISTRY, key)) {
88613
- const entry = COMMAND_REGISTRY[key];
88614
- const warning = entry.deprecated ? `\u26A0\uFE0F "/swarm ${key}" is deprecated. Use "/swarm ${entry.aliasOf}" instead.` : undefined;
88615
88917
  return {
88616
- entry,
88617
- remainingArgs: tokens.slice(1),
88618
- key,
88619
- warning
88918
+ ...resolveRegistryEntry(key),
88919
+ remainingArgs: tokens.slice(1)
88620
88920
  };
88621
88921
  }
88622
88922
  return null;
88623
88923
  }
88924
+ function resolveRegistryEntry(key) {
88925
+ let entry = COMMAND_REGISTRY[key];
88926
+ const warning = entry.deprecated ? `\u26A0\uFE0F "/swarm ${key}" is deprecated. Use "/swarm ${entry.aliasOf}" instead.` : undefined;
88927
+ while (!entry.handler && entry.aliasOf) {
88928
+ const target = COMMAND_REGISTRY[entry.aliasOf];
88929
+ if (!target)
88930
+ break;
88931
+ entry = target;
88932
+ }
88933
+ const handler = entry.handler;
88934
+ if (!handler) {
88935
+ throw new Error(`Command '${key}' resolves to no handler`);
88936
+ }
88937
+ return {
88938
+ entry,
88939
+ key,
88940
+ warning
88941
+ };
88942
+ }
88624
88943
 
88625
88944
  // src/agents/architect.ts
88626
88945
  init_constants();
@@ -89576,7 +89895,7 @@ Purpose: Create or ingest the implementation plan, persist QA gates against its
89576
89895
 
89577
89896
  {{PLANNING_PROFILE_DIRECTIVE}}
89578
89897
 
89579
- ACTION: Load skill ${bundledProjectSkillFileReference("plan")} immediately. Follow the protocol defined there.
89898
+ ACTION: Load skill ${bundledProjectSkillFileReference("swarm-plan")} immediately. Follow the protocol defined there.
89580
89899
 
89581
89900
  HARD CONSTRAINTS (apply regardless of skill load success):
89582
89901
  - Before drafting or saving a plan, offer the loaded skill's General Council advisory option when \`council.general.enabled\` is true and a search API key is configured. If the user accepts, use the council output as context before calling \`save_plan\` and before any critic pre-plan review.
@@ -90510,13 +90829,26 @@ function normalizeSwarmCommandInput(command, argumentText) {
90510
90829
  };
90511
90830
  }
90512
90831
  function canonicalCommandKey(resolved) {
90513
- return resolved.entry.aliasOf ?? resolved.key;
90832
+ if (resolved.entry.aliasOf) {
90833
+ return resolved.entry.aliasOf;
90834
+ }
90835
+ let entry = COMMAND_REGISTRY[resolved.key];
90836
+ while (entry && !entry.handler && entry.aliasOf) {
90837
+ const target = COMMAND_REGISTRY[entry.aliasOf];
90838
+ if (!target)
90839
+ break;
90840
+ if (target.handler)
90841
+ return entry.aliasOf;
90842
+ entry = target;
90843
+ }
90844
+ return resolved.key;
90514
90845
  }
90515
90846
  function formatCommandNotFound(tokens) {
90516
- const attemptedCommand = tokens[0] || "";
90847
+ const attemptedCommand = String(tokens[0]);
90848
+ const sanitized = stripControlCharacters(attemptedCommand);
90517
90849
  const MAX_DISPLAY = 100;
90518
- const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
90519
- const similar = _internals102.findSimilarCommands(attemptedCommand);
90850
+ const displayCommand = sanitized.length > MAX_DISPLAY ? `${sanitized.slice(0, MAX_DISPLAY)}...` : sanitized;
90851
+ const similar = _internals102.findSimilarCommands(displayCommand);
90520
90852
  const header = `Command \`/swarm ${displayCommand}\` not found.`;
90521
90853
  const suggestions = similar.length > 0 ? `Did you mean:
90522
90854
  ${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
@@ -90552,7 +90884,7 @@ async function executeSwarmCommand(args) {
90552
90884
  text = policyResult.message;
90553
90885
  } else {
90554
90886
  try {
90555
- text = await resolved.entry.handler({
90887
+ const raw = await resolved.entry.handler({
90556
90888
  directory,
90557
90889
  args: resolved.remainingArgs,
90558
90890
  sessionID,
@@ -90566,6 +90898,7 @@ async function executeSwarmCommand(args) {
90566
90898
  activeAgentName,
90567
90899
  reviewAgentModelRegistry
90568
90900
  });
90901
+ text = isCommandFailure(raw) ? raw.text : raw;
90569
90902
  } catch (_err) {
90570
90903
  const cmdName = tokens[0] || "unknown";
90571
90904
  const errMsg = _err instanceof Error ? _err.message : String(_err);
@@ -90878,10 +91211,10 @@ var childBindings = new Map;
90878
91211
  init_executor();
90879
91212
 
90880
91213
  // src/hooks/shell-write-detect.ts
90881
- import * as path119 from "path";
91214
+ import * as path120 from "path";
90882
91215
  import parse from "bash-parser";
90883
- function buildDedupeKey(category, operator, path120) {
90884
- return `${category}|${operator}|${path120 ?? "null"}`;
91216
+ function buildDedupeKey(category, operator, path121) {
91217
+ return `${category}|${operator}|${path121 ?? "null"}`;
90885
91218
  }
90886
91219
  var REDIRECT_WRITE_TOKENS = new Set([
90887
91220
  "GREAT",
@@ -90941,16 +91274,16 @@ function detectProcessSubstitutionWrites(command) {
90941
91274
  results.push(builtinResult);
90942
91275
  const appendMatch = stage.match(/^\s*(.*?)\s*>>(\s*)(\S+)\s*$/);
90943
91276
  if (appendMatch) {
90944
- const path120 = appendMatch[3];
90945
- if (path120 && !isNullDevice(path120)) {
90946
- results.push({ category: "redirect", operator: ">>", path: path120 });
91277
+ const path121 = appendMatch[3];
91278
+ if (path121 && !isNullDevice(path121)) {
91279
+ results.push({ category: "redirect", operator: ">>", path: path121 });
90947
91280
  }
90948
91281
  } else {
90949
91282
  const writeMatch = stage.match(/^\s*(.*?)\s*>(?!>)(\s*)(\S+)\s*$/);
90950
91283
  if (writeMatch) {
90951
- const path120 = writeMatch[3];
90952
- if (path120 && !isNullDevice(path120)) {
90953
- results.push({ category: "redirect", operator: ">", path: path120 });
91284
+ const path121 = writeMatch[3];
91285
+ if (path121 && !isNullDevice(path121)) {
91286
+ results.push({ category: "redirect", operator: ">", path: path121 });
90954
91287
  }
90955
91288
  }
90956
91289
  }
@@ -91124,8 +91457,8 @@ function extractRedirectPath(fileNode) {
91124
91457
  return null;
91125
91458
  return text;
91126
91459
  }
91127
- function isNullDevice(path120) {
91128
- return path120 === "/dev/null" || path120 === "/dev/zero" || path120 === "/dev/urandom";
91460
+ function isNullDevice(path121) {
91461
+ return path121 === "/dev/null" || path121 === "/dev/zero" || path121 === "/dev/urandom";
91129
91462
  }
91130
91463
  function isNumeric(s) {
91131
91464
  return /^\d+$/.test(s);
@@ -91145,12 +91478,12 @@ function detectRedirects(cmd) {
91145
91478
  if (!opType || !REDIRECT_ALL_WRITE_TOKENS.has(opType))
91146
91479
  continue;
91147
91480
  const fileNode = r.file;
91148
- const path120 = extractRedirectPath(fileNode);
91481
+ const path121 = extractRedirectPath(fileNode);
91149
91482
  const opLabel = operatorLabel(opNode);
91150
91483
  if (REDIRECT_WRITE_TOKENS.has(opType)) {
91151
- results.push({ category: "redirect", operator: opLabel, path: path120 });
91484
+ results.push({ category: "redirect", operator: opLabel, path: path121 });
91152
91485
  } else if (REDIRECT_HERE_TOKENS.has(opType)) {
91153
- results.push({ category: "here_doc", operator: opLabel, path: path120 });
91486
+ results.push({ category: "here_doc", operator: opLabel, path: path121 });
91154
91487
  }
91155
91488
  }
91156
91489
  return results;
@@ -91193,9 +91526,9 @@ function detectBuiltinWrites(cmd) {
91193
91526
  const suffixWords2 = getSuffixWords(cmd);
91194
91527
  for (const word of suffixWords2) {
91195
91528
  if (word.startsWith("of=")) {
91196
- const path120 = word.slice(3);
91197
- if (path120 && !isNullDevice(path120)) {
91198
- results.push({ category: "builtin_write", operator: "dd of=", path: path120 });
91529
+ const path121 = word.slice(3);
91530
+ if (path121 && !isNullDevice(path121)) {
91531
+ results.push({ category: "builtin_write", operator: "dd of=", path: path121 });
91199
91532
  }
91200
91533
  }
91201
91534
  }
@@ -91334,12 +91667,12 @@ function detectNetworkDownloaders(cmd) {
91334
91667
  for (let i = 0;i < suffixWords.length; i++) {
91335
91668
  const word = suffixWords[i];
91336
91669
  if (word === "-o" && i + 1 < suffixWords.length) {
91337
- const path120 = suffixWords[i + 1];
91338
- if (!path120.startsWith("-")) {
91670
+ const path121 = suffixWords[i + 1];
91671
+ if (!path121.startsWith("-")) {
91339
91672
  results.push({
91340
91673
  category: "network_download",
91341
91674
  operator: "curl -o",
91342
- path: path120
91675
+ path: path121
91343
91676
  });
91344
91677
  }
91345
91678
  } else if (word.startsWith("-o") && word.length > 2) {
@@ -91354,12 +91687,12 @@ function detectNetworkDownloaders(cmd) {
91354
91687
  for (let i = 0;i < suffixWords.length; i++) {
91355
91688
  const word = suffixWords[i];
91356
91689
  if (word === "-O" && i + 1 < suffixWords.length) {
91357
- const path120 = suffixWords[i + 1];
91358
- if (!path120.startsWith("-")) {
91690
+ const path121 = suffixWords[i + 1];
91691
+ if (!path121.startsWith("-")) {
91359
91692
  results.push({
91360
91693
  category: "network_download",
91361
91694
  operator: "wget -O",
91362
- path: path120
91695
+ path: path121
91363
91696
  });
91364
91697
  }
91365
91698
  } else if (word.startsWith("-O") && word.length > 2) {
@@ -91468,9 +91801,9 @@ function detectGitDestructive(cmd) {
91468
91801
  if (first === "checkout") {
91469
91802
  const dashDashIdx = suffixWords.indexOf("--");
91470
91803
  if (dashDashIdx !== -1 && dashDashIdx + 1 < suffixWords.length) {
91471
- const path120 = suffixWords[dashDashIdx + 1];
91472
- const op = path120 === "." ? "git checkout -- ." : "git checkout --";
91473
- results.push({ category: "git_destructive", operator: op, path: path120 });
91804
+ const path121 = suffixWords[dashDashIdx + 1];
91805
+ const op = path121 === "." ? "git checkout -- ." : "git checkout --";
91806
+ results.push({ category: "git_destructive", operator: op, path: path121 });
91474
91807
  }
91475
91808
  } else if (first === "restore") {
91476
91809
  const hasHard = suffixWords.some((w) => w === "--hard" || w === "-H" || w.startsWith("-") && w.includes("H"));
@@ -91590,10 +91923,10 @@ function detectPowerShellWrites(command) {
91590
91923
  if (redirectMatch) {
91591
91924
  const beforeRedirect = redirectMatch[1];
91592
91925
  const op = redirectMatch[2];
91593
- const path120 = redirectMatch[3];
91926
+ const path121 = redirectMatch[3];
91594
91927
  const fdRedirectPattern = /\d>\s*$|\s\d>&$/;
91595
91928
  if (!fdRedirectPattern.test(`${beforeRedirect} ${op}`)) {
91596
- results.push({ category: "redirect", operator: op, path: path120 });
91929
+ results.push({ category: "redirect", operator: op, path: path121 });
91597
91930
  }
91598
91931
  }
91599
91932
  const leadingRedirect = innerCommand.match(/^((?:>){1,2})\s+(\S+)$/);
@@ -91606,12 +91939,12 @@ function detectPowerShellWrites(command) {
91606
91939
  }
91607
91940
  const iwrMatch = trimmed.match(/^(?:Invoke-WebRequest|curl)\s.*?(?:-OutFile\s+(\S+)|-o\s+(\S+))/i);
91608
91941
  if (iwrMatch) {
91609
- const path120 = iwrMatch[1] || iwrMatch[2];
91610
- if (path120) {
91942
+ const path121 = iwrMatch[1] || iwrMatch[2];
91943
+ if (path121) {
91611
91944
  results.push({
91612
91945
  category: "network_download",
91613
91946
  operator: "Invoke-WebRequest -OutFile",
91614
- path: path120
91947
+ path: path121
91615
91948
  });
91616
91949
  }
91617
91950
  }
@@ -91623,15 +91956,15 @@ function detectPowerShellWrites(command) {
91623
91956
  const rest = cmd.slice(cmdletMatch[0].length).trim();
91624
91957
  const pathFlagMatch = rest.match(/(?:-Path|-FilePath|-LiteralPath)\s+("([^"]+)"|'([^']+)'|(\S+))/i);
91625
91958
  if (pathFlagMatch) {
91626
- const path120 = pathFlagMatch[2] ?? pathFlagMatch[3] ?? pathFlagMatch[4] ?? "";
91627
- return { category: "redirect", operator: cmdletName, path: path120 };
91959
+ const path121 = pathFlagMatch[2] ?? pathFlagMatch[3] ?? pathFlagMatch[4] ?? "";
91960
+ return { category: "redirect", operator: cmdletName, path: path121 };
91628
91961
  }
91629
91962
  const tokens = rest.match(/(?:[^\s"-]+|"[^"]*"|'[^']*'|-[^\s]+)/g) ?? [];
91630
91963
  for (const token of tokens) {
91631
91964
  if (token.startsWith("-"))
91632
91965
  continue;
91633
- const path120 = token.replace(/^["']|["']$/g, "");
91634
- return { category: "redirect", operator: cmdletName, path: path120 };
91966
+ const path121 = token.replace(/^["']|["']$/g, "");
91967
+ return { category: "redirect", operator: cmdletName, path: path121 };
91635
91968
  }
91636
91969
  return null;
91637
91970
  }
@@ -91647,9 +91980,9 @@ function detectPowerShellWrites(command) {
91647
91980
  for (const token of tokens) {
91648
91981
  if (token.startsWith("-"))
91649
91982
  continue;
91650
- const path120 = token.replace(/^["']|["']$/g, "");
91651
- if (path120) {
91652
- results.push({ category: "redirect", operator: cmdletName, path: path120 });
91983
+ const path121 = token.replace(/^["']|["']$/g, "");
91984
+ if (path121) {
91985
+ results.push({ category: "redirect", operator: cmdletName, path: path121 });
91653
91986
  break;
91654
91987
  }
91655
91988
  }
@@ -91662,8 +91995,8 @@ function detectPowerShellWrites(command) {
91662
91995
  const rest = cmd.slice(opMatch[0].length).trim();
91663
91996
  const destFlagMatch = rest.match(/-Destination\s+(\S+|"[^"]+"|'[^']+')/i);
91664
91997
  if (destFlagMatch) {
91665
- const path120 = destFlagMatch[1].replace(/^["']|["']$/g, "");
91666
- return { category: "builtin_write", operator: cmdletName, path: path120 };
91998
+ const path121 = destFlagMatch[1].replace(/^["']|["']$/g, "");
91999
+ return { category: "builtin_write", operator: cmdletName, path: path121 };
91667
92000
  }
91668
92001
  const tokens = [];
91669
92002
  const flagTakingValue = new Set([
@@ -91702,11 +92035,11 @@ function detectPowerShellWrites(command) {
91702
92035
  }
91703
92036
  }
91704
92037
  if (tokens.length >= 2) {
91705
- const path120 = tokens[tokens.length - 1].replace(/^["']|["']$/g, "");
91706
- return { category: "builtin_write", operator: cmdletName, path: path120 };
92038
+ const path121 = tokens[tokens.length - 1].replace(/^["']|["']$/g, "");
92039
+ return { category: "builtin_write", operator: cmdletName, path: path121 };
91707
92040
  } else if (tokens.length === 1) {
91708
- const path120 = tokens[0].replace(/^["']|["']$/g, "");
91709
- return { category: "builtin_write", operator: cmdletName, path: path120 };
92041
+ const path121 = tokens[0].replace(/^["']|["']$/g, "");
92042
+ return { category: "builtin_write", operator: cmdletName, path: path121 };
91710
92043
  }
91711
92044
  return null;
91712
92045
  }
@@ -91720,14 +92053,14 @@ function detectPowerShellWrites(command) {
91720
92053
  const afterCmdlet = pipeFileOpMatch[2].trim();
91721
92054
  const destFlagMatch = afterCmdlet.match(/-Destination\s+(\S+|"[^"]+"|'[^']+')/i);
91722
92055
  if (destFlagMatch) {
91723
- const path120 = destFlagMatch[1].replace(/^["']|["']$/g, "");
91724
- results.push({ category: "builtin_write", operator: cmdletName, path: path120 });
92056
+ const path121 = destFlagMatch[1].replace(/^["']|["']$/g, "");
92057
+ results.push({ category: "builtin_write", operator: cmdletName, path: path121 });
91725
92058
  } else {
91726
92059
  const tokens = afterCmdlet.match(/(?:[^\s"-]+|"[^"]*"|'[^']*'|-[^\s]+)/g) ?? [];
91727
92060
  const nonFlagTokens = tokens.filter((t) => !t.startsWith("-") && t.length > 0);
91728
92061
  if (nonFlagTokens.length > 0) {
91729
- const path120 = nonFlagTokens[nonFlagTokens.length - 1].replace(/^["']|["']$/g, "");
91730
- results.push({ category: "builtin_write", operator: cmdletName, path: path120 });
92062
+ const path121 = nonFlagTokens[nonFlagTokens.length - 1].replace(/^["']|["']$/g, "");
92063
+ results.push({ category: "builtin_write", operator: cmdletName, path: path121 });
91731
92064
  }
91732
92065
  }
91733
92066
  }
@@ -91780,10 +92113,10 @@ function detectCmdWrites(command) {
91780
92113
  if (redirectMatch) {
91781
92114
  const beforeRedirect = redirectMatch[1];
91782
92115
  const op = redirectMatch[2];
91783
- const path120 = redirectMatch[3];
92116
+ const path121 = redirectMatch[3];
91784
92117
  const fdRedirectPattern = /\d>&?$/;
91785
92118
  if (!fdRedirectPattern.test(beforeRedirect)) {
91786
- results.push({ category: "redirect", operator: op, path: path120 });
92119
+ results.push({ category: "redirect", operator: op, path: path121 });
91787
92120
  }
91788
92121
  }
91789
92122
  const leadingRedirect = innerCommand.match(/^((?:>){1,2})\s+(\S+)$/);
@@ -91841,8 +92174,8 @@ function detectCmdWrites(command) {
91841
92174
  const rawTokens = rest.match(/(\/?[^\s]+|"[^"]*"|'[^']*')/g) ?? [];
91842
92175
  const tokens = rawTokens.filter((t) => !t.startsWith("/"));
91843
92176
  if (tokens.length > 0) {
91844
- const path120 = tokens[0].replace(/^["']|["']$/g, "");
91845
- return { category: "builtin_write", operator: "del", path: path120 };
92177
+ const path121 = tokens[0].replace(/^["']|["']$/g, "");
92178
+ return { category: "builtin_write", operator: "del", path: path121 };
91846
92179
  }
91847
92180
  return null;
91848
92181
  }
@@ -91852,16 +92185,16 @@ function detectCmdWrites(command) {
91852
92185
  }
91853
92186
  const rdMatch = innerCommand.match(/^rd\s+(?:\/s\s+|\/q\s+)*(\S+)/i);
91854
92187
  if (rdMatch) {
91855
- const path120 = rdMatch[1].replace(/^["']|["']$/g, "");
91856
- if (!path120.startsWith("/")) {
91857
- results.push({ category: "builtin_write", operator: "rd", path: path120 });
92188
+ const path121 = rdMatch[1].replace(/^["']|["']$/g, "");
92189
+ if (!path121.startsWith("/")) {
92190
+ results.push({ category: "builtin_write", operator: "rd", path: path121 });
91858
92191
  }
91859
92192
  }
91860
92193
  const mdMatch = trimmed.match(/^md\s+(\S+)/i);
91861
92194
  if (mdMatch) {
91862
- const path120 = mdMatch[1].replace(/^["']|["']$/g, "");
91863
- if (!path120.startsWith("/")) {
91864
- results.push({ category: "builtin_write", operator: "md", path: path120 });
92195
+ const path121 = mdMatch[1].replace(/^["']|["']$/g, "");
92196
+ if (!path121.startsWith("/")) {
92197
+ results.push({ category: "builtin_write", operator: "md", path: path121 });
91865
92198
  }
91866
92199
  }
91867
92200
  const echoMatch = trimmed.match(/^echo\s+(\S+.*?)\s+((?:>){1,2})\s*(\S+)$/i);
@@ -91977,10 +92310,10 @@ function resolvePath(pathText, cwd) {
91977
92310
  return null;
91978
92311
  const isWindowsPath = /^[a-zA-Z]:[\\\\/]/.test(cwd) || cwd.includes("\\");
91979
92312
  if (isWindowsPath) {
91980
- return path119.win32.resolve(cwd, pathText);
92313
+ return path120.win32.resolve(cwd, pathText);
91981
92314
  }
91982
- const normalizedRelativeWindowsPath = !path119.posix.isAbsolute(pathText) && !/^[a-zA-Z]:[\\/]/.test(pathText) ? pathText.replace(/\\/g, "/") : pathText;
91983
- return path119.posix.resolve(cwd, normalizedRelativeWindowsPath);
92315
+ const normalizedRelativeWindowsPath = !path120.posix.isAbsolute(pathText) && !/^[a-zA-Z]:[\\/]/.test(pathText) ? pathText.replace(/\\/g, "/") : pathText;
92316
+ return path120.posix.resolve(cwd, normalizedRelativeWindowsPath);
91984
92317
  }
91985
92318
  function getCdTarget(cmd) {
91986
92319
  if (!cmd || typeof cmd !== "object")
@@ -92047,7 +92380,7 @@ function collectWritesWithNodes(node, out, cwdStack) {
92047
92380
  for (const cmd of node.commands) {
92048
92381
  const cdTarget = getCdTarget(cmd);
92049
92382
  if (cdTarget) {
92050
- currentStack[0] = path119.posix.resolve(currentStack[0] ?? "/", cdTarget);
92383
+ currentStack[0] = path120.posix.resolve(currentStack[0] ?? "/", cdTarget);
92051
92384
  collectWritesWithNodes(cmd, out, currentStack);
92052
92385
  } else {
92053
92386
  collectWritesWithNodes(cmd, out, currentStack);
@@ -92093,7 +92426,7 @@ function collectWritesWithNodes(node, out, cwdStack) {
92093
92426
  const effectiveCwd = cwdStack[0] ?? "/";
92094
92427
  const cdTarget = getCdTarget(node);
92095
92428
  if (cdTarget) {
92096
- cwdStack[0] = path119.posix.resolve(cwdStack[0] ?? "/", cdTarget);
92429
+ cwdStack[0] = path120.posix.resolve(cwdStack[0] ?? "/", cdTarget);
92097
92430
  return;
92098
92431
  }
92099
92432
  const writesFromRedirs = getWritesFromCommandRedirs(node, effectiveCwd);
@@ -92139,12 +92472,12 @@ function getWritesFromRedirectNode(redirect, _context) {
92139
92472
  if (!opType || !REDIRECT_ALL_WRITE_TOKENS.has(opType))
92140
92473
  return [];
92141
92474
  const fileNode = r.file;
92142
- const path120 = extractRedirectPath(fileNode);
92475
+ const path121 = extractRedirectPath(fileNode);
92143
92476
  const opLabel = operatorLabel(opNode);
92144
92477
  if (REDIRECT_WRITE_TOKENS.has(opType)) {
92145
- return [{ category: "redirect", operator: opLabel, path: path120 }];
92478
+ return [{ category: "redirect", operator: opLabel, path: path121 }];
92146
92479
  } else if (REDIRECT_HERE_TOKENS.has(opType)) {
92147
- return [{ category: "here_doc", operator: opLabel, path: path120 }];
92480
+ return [{ category: "here_doc", operator: opLabel, path: path121 }];
92148
92481
  }
92149
92482
  return [];
92150
92483
  }
@@ -92324,8 +92657,8 @@ async function forceRecordPlanCriticApproval(directory, sessionID, options = {})
92324
92657
  }
92325
92658
  const plan = await loadPlanJsonOnly(directory);
92326
92659
  if (!plan) {
92327
- const planPath = path120.join(directory, ".swarm", "plan.json");
92328
- if (fs53.existsSync(planPath)) {
92660
+ const planPath = path121.join(directory, ".swarm", "plan.json");
92661
+ if (fs54.existsSync(planPath)) {
92329
92662
  throw new Error("PLAN_CORRUPT: .swarm/plan.json exists but could not be parsed " + "(corrupt or schema-invalid). Repair or re-save the plan before " + "recording a plan-critic approval.");
92330
92663
  }
92331
92664
  throw new Error("PLAN_NOT_FOUND: no .swarm/plan.json \u2014 cannot record a plan-critic " + "approval for a non-existent plan. Save a plan first.");
@@ -93340,8 +93673,8 @@ function evidenceToWorkflowState(evidence2) {
93340
93673
  }
93341
93674
  async function readPlanFromDisk(directory) {
93342
93675
  try {
93343
- const planPath = path121.join(directory, ".swarm", "plan.json");
93344
- const content = await fs54.readFile(planPath, "utf-8");
93676
+ const planPath = path122.join(directory, ".swarm", "plan.json");
93677
+ const content = await fs55.readFile(planPath, "utf-8");
93345
93678
  const parsed = JSON.parse(content);
93346
93679
  return PlanSchema.parse(parsed);
93347
93680
  } catch {
@@ -93351,8 +93684,8 @@ async function readPlanFromDisk(directory) {
93351
93684
  async function readGateEvidenceFromDisk(directory) {
93352
93685
  const evidenceMap = new Map;
93353
93686
  try {
93354
- const evidenceDir = path121.join(directory, ".swarm", "evidence");
93355
- const entries2 = await fs54.readdir(evidenceDir, { withFileTypes: true });
93687
+ const evidenceDir = path122.join(directory, ".swarm", "evidence");
93688
+ const entries2 = await fs55.readdir(evidenceDir, { withFileTypes: true });
93356
93689
  for (const entry of entries2) {
93357
93690
  if (!entry.isFile() || !entry.name.endsWith(".json")) {
93358
93691
  continue;
@@ -93362,8 +93695,8 @@ async function readGateEvidenceFromDisk(directory) {
93362
93695
  continue;
93363
93696
  }
93364
93697
  try {
93365
- const filePath = path121.join(evidenceDir, entry.name);
93366
- const content = await fs54.readFile(filePath, "utf-8");
93698
+ const filePath = path122.join(evidenceDir, entry.name);
93699
+ const content = await fs55.readFile(filePath, "utf-8");
93367
93700
  const parsed = parseTaskEvidence(content, taskId);
93368
93701
  evidenceMap.set(taskId, parsed);
93369
93702
  } catch {}
@@ -93574,7 +93907,7 @@ function getDisplayFinalPromptPressure() {
93574
93907
  async function rehydratePrSubscriptions(sessionID, directory) {
93575
93908
  const map = new Map;
93576
93909
  try {
93577
- const { listActive: listActive2 } = await import("./pr-subscriptions-cwwtfs8w.js");
93910
+ const { listActive: listActive2 } = await import("./pr-subscriptions-00zp69mt.js");
93578
93911
  const records = await listActive2(directory);
93579
93912
  for (const record of records) {
93580
93913
  if (record.sessionID !== sessionID)
@@ -93747,7 +94080,7 @@ function computeLaneRuntimeProfile(runtime, laneIndex, worktreePath) {
93747
94080
  }
93748
94081
  if (runtime.cache_redirects) {
93749
94082
  for (const [envName, basePath] of Object.entries(runtime.cache_redirects)) {
93750
- const laneSuffix = path122.join(basePath, `lane-${laneIndex}`);
94083
+ const laneSuffix = path123.join(basePath, `lane-${laneIndex}`);
93751
94084
  envOverrides[envName] = laneSuffix;
93752
94085
  }
93753
94086
  }
@@ -94020,7 +94353,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
94020
94353
  return extracted === expectedSessionId;
94021
94354
  }
94022
94355
  async function inspectStandardWorktreeCollisionOwnership(identity) {
94023
- const collisionOwnership = await import("./worktree-collision-ownership-j9zykj18.js");
94356
+ const collisionOwnership = await import("./worktree-collision-ownership-fj9n4mhk.js");
94024
94357
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
94025
94358
  }
94026
94359
  async function runRecoveryGit(directory, args, timeoutMs = 15000) {
@@ -94051,7 +94384,7 @@ async function runRecoveryGit(directory, args, timeoutMs = 15000) {
94051
94384
  }
94052
94385
  async function pathExists(targetPath) {
94053
94386
  try {
94054
- await fs55.stat(targetPath);
94387
+ await fs56.stat(targetPath);
94055
94388
  return true;
94056
94389
  } catch {
94057
94390
  return false;
@@ -94243,7 +94576,7 @@ async function precreateStandardWorktreeSession(args) {
94243
94576
  };
94244
94577
  }
94245
94578
  try {
94246
- await fs55.stat(authority.immutable.lanePath);
94579
+ await fs56.stat(authority.immutable.lanePath);
94247
94580
  } catch {
94248
94581
  return {
94249
94582
  ok: false,
@@ -94316,7 +94649,7 @@ async function precreateStandardWorktreeSession(args) {
94316
94649
  }
94317
94650
  let collisionPathExists = true;
94318
94651
  try {
94319
- await fs55.stat(collision.worktreePath);
94652
+ await fs56.stat(collision.worktreePath);
94320
94653
  } catch (error2) {
94321
94654
  const code = error2.code;
94322
94655
  if (code === "ENOENT" || code === "ENOTDIR") {
@@ -94433,7 +94766,7 @@ async function precreateStandardWorktreeSession(args) {
94433
94766
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, handle.worktreePath);
94434
94767
  if (laneProfile) {
94435
94768
  try {
94436
- const { writeLaneProfileToDiskReal } = await import("./core-y0s1vmyc.js");
94769
+ const { writeLaneProfileToDiskReal } = await import("./core-zbzdffha.js");
94437
94770
  await writeLaneProfileToDiskReal(handle.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
94438
94771
  } catch {}
94439
94772
  }
@@ -95122,7 +95455,7 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
95122
95455
  removedWorktree = true;
95123
95456
  } else if (result.error.includes("is not a working tree") && await pathExists(worktreePath) && isPathUnderSwarmWorktreeBase(worktreePath, directory, worktree_dir ? [worktree_dir] : [])) {
95124
95457
  try {
95125
- await fs55.rm(worktreePath, { recursive: true, force: true });
95458
+ await fs56.rm(worktreePath, { recursive: true, force: true });
95126
95459
  removedWorktree = !await pathExists(worktreePath);
95127
95460
  } catch (err) {
95128
95461
  log(`[swarm] cleanupStandardWorktreeForCallId: residual directory cleanup failed for ${callID}: ${err}`);
@@ -95367,7 +95700,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
95367
95700
  }
95368
95701
  clearWorktreeMergeStatus(statusKey);
95369
95702
  try {
95370
- const { removeLaneProfileFromDiskReal } = await import("./core-y0s1vmyc.js");
95703
+ const { removeLaneProfileFromDiskReal } = await import("./core-zbzdffha.js");
95371
95704
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
95372
95705
  } catch {}
95373
95706
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);
@@ -95502,10 +95835,10 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
95502
95835
  return result;
95503
95836
  }
95504
95837
  async function readLaneEnvFileFromDisk(worktreePath, laneIndex) {
95505
- const envPath = path122.join(worktreePath, ".swarm", "lanes", `${laneIndex}.env`);
95838
+ const envPath = path123.join(worktreePath, ".swarm", "lanes", `${laneIndex}.env`);
95506
95839
  let content;
95507
95840
  try {
95508
- content = await fs55.readFile(envPath, "utf-8");
95841
+ content = await fs56.readFile(envPath, "utf-8");
95509
95842
  } catch (err) {
95510
95843
  if (err.code === "ENOENT") {
95511
95844
  return {};
@@ -95570,4 +95903,4 @@ var _internals104 = {
95570
95903
  resolveGitExecutable
95571
95904
  };
95572
95905
 
95573
- export { resetActionCircuitExternally, getBlockingActionCircuit, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, getAgentSession, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals104 as _internals, prWorkflowSessionFileStem, ensurePrWorkflowSafeParentDirectory, writePrWorkflowAtomicJson, PrWorkflowCheckoutMutationTimeoutError, withPrWorkflowCheckoutMutationLock, PR_REVIEW_REPORT_VERDICTS, allowedPrReviewReportVerdicts, normalizePrReviewPartialBaseCoverageRecord, rollbackPrReviewPartialBaseCoverageAdmission, readPrReviewTerminalCoverageForReport, PR_REVIEW_REQUIRED_MICRO_LANE_IDS, PR_REVIEW_DEPTH_TIER_THRESHOLDS, PR_REVIEW_BASE_LANE_FLOORS, PR_REVIEW_TIER_L_CONSOLIDATED_LANE_FLOOR, PR_REVIEW_MICRO_LANE_FLOORS, computePrReviewDepthTier, MAX_PR_FEEDBACK_INVENTORY_AMENDMENTS, activatePrWorkflow, readPrWorkflowGateState, submitPrReviewResult, withPrWorkflowCheckoutPreparationLock, withInactivePrWorkflowCheckoutRestoreLock, clearPrWorkflowGateState, collectPrWorkflowPendingLaneLiveness, settlePresumedStalePrWorkflowLanes, abortPrWorkflow, recoverArmedPrWorkflow, bindPrWorkflowHead, rebindPrFeedbackHead, bindPrReviewBase, assertCurrentCheckoutHead, assertPrReviewCleanCheckout, enforcePrWorkflowDispatchLanesAsync, PrReviewResilienceCircuitOpenError, PrReviewResilienceRetryExhaustedError, enforcePrReviewBaseDimensions, rollbackPrReviewBaseAdmissionIfUnlaunched, admitPrReviewPartialBaseCoverage2 as admitPrReviewPartialBaseCoverage, assertPrReviewBaseCoverageSettled2 as assertPrReviewBaseCoverageSettled, recordPrReviewValidationBatch, assertPrReviewValidationSettled, declarePrFeedbackInventory, enforcePrFeedbackVerificationOwnership, assertPrFeedbackVerificationSettled, recordPrFeedbackStageA, recordPrFeedbackGateBatch, assertPrFeedbackGatePhaseSettled, assertPrFeedbackReadyToPublish, invalidatePrFeedbackPublication, describePrWorkflowPublicationSection, findDanglingLivePublicationGeneration, recordPrFeedbackPushAttemptResult, resolvePrReviewWriterRunId, markPrReviewTriggerEvaluationComplete, bindPrReviewTriggerLedger, assertPrReviewArtifactBoundary, assertPrReviewArtifactRecordsMatchAuthoritativeVerdicts, markPrReviewArtifactBoundary, markPrReviewHandoffComplete, transitionPrReviewToFeedback, declarePrFeedbackScope, resolvePrFeedbackScopeDeclaration, consumePrFeedbackScopeDeclaration, validatePrFeedbackScopeBinding, enforcePrWorkflowToolBefore, readPrReviewReentryBindingContext, hasActivePrReviewReentryAuthorization, reserveActivePrReviewReentryAuthorization, completePrWorkflow, _test_exports2 as _test_exports, normalizePrWorkflowShellCommand, describePrWorkflowRevisionDigestFailure, formatPrReviewLaneValidationFailure, validatePrReviewDiscoveryLaneCompletion2 as validatePrReviewDiscoveryLaneCompletion, validatePrWorkflowTransportRecovery, prReviewDiscoveryArtifactCoversLane, MAX_SALVAGED_SCHEMA_ERROR_CHARS, readPrWorkflowGateStateForRecovery, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals26 as _internals1, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals30 as _internals2, createHivePromoterHook, promoteToHive, promoteFromSwarm, startSnapshotCoordinationInitialization, ensureSnapshotCoordinationReady, retrySnapshotCoordinationInitialization, getSnapshotCoordinationStatus, beginSnapshotCoordinationReset, closeSnapshotCoordinationInitialization, markSnapshotCoordinationClosing, _snapshotCoordinationInternals, safeRealpathSync, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals102 as _internals3, resolveCommand };
95906
+ export { resetActionCircuitExternally, getBlockingActionCircuit, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, getSharedClassifierGuardrailBlock, classifyCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, getAgentSession, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals104 as _internals, prWorkflowSessionFileStem, ensurePrWorkflowSafeParentDirectory, writePrWorkflowAtomicJson, PrWorkflowCheckoutMutationTimeoutError, withPrWorkflowCheckoutMutationLock, PR_REVIEW_REPORT_VERDICTS, allowedPrReviewReportVerdicts, normalizePrReviewPartialBaseCoverageRecord, rollbackPrReviewPartialBaseCoverageAdmission, readPrReviewTerminalCoverageForReport, PR_REVIEW_REQUIRED_MICRO_LANE_IDS, PR_REVIEW_DEPTH_TIER_THRESHOLDS, PR_REVIEW_BASE_LANE_FLOORS, PR_REVIEW_TIER_L_CONSOLIDATED_LANE_FLOOR, PR_REVIEW_MICRO_LANE_FLOORS, computePrReviewDepthTier, MAX_PR_FEEDBACK_INVENTORY_AMENDMENTS, activatePrWorkflow, readPrWorkflowGateState, submitPrReviewResult, withPrWorkflowCheckoutPreparationLock, withInactivePrWorkflowCheckoutRestoreLock, clearPrWorkflowGateState, collectPrWorkflowPendingLaneLiveness, settlePresumedStalePrWorkflowLanes, abortPrWorkflow, recoverArmedPrWorkflow, bindPrWorkflowHead, rebindPrFeedbackHead, bindPrReviewBase, assertCurrentCheckoutHead, assertPrReviewCleanCheckout, enforcePrWorkflowDispatchLanesAsync, PrReviewResilienceCircuitOpenError, PrReviewResilienceRetryExhaustedError, enforcePrReviewBaseDimensions, rollbackPrReviewBaseAdmissionIfUnlaunched, admitPrReviewPartialBaseCoverage2 as admitPrReviewPartialBaseCoverage, assertPrReviewBaseCoverageSettled2 as assertPrReviewBaseCoverageSettled, recordPrReviewValidationBatch, assertPrReviewValidationSettled, declarePrFeedbackInventory, enforcePrFeedbackVerificationOwnership, assertPrFeedbackVerificationSettled, recordPrFeedbackStageA, recordPrFeedbackGateBatch, assertPrFeedbackGatePhaseSettled, assertPrFeedbackReadyToPublish, invalidatePrFeedbackPublication, describePrWorkflowPublicationSection, findDanglingLivePublicationGeneration, recordPrFeedbackPushAttemptResult, resolvePrReviewWriterRunId, markPrReviewTriggerEvaluationComplete, bindPrReviewTriggerLedger, assertPrReviewArtifactBoundary, assertPrReviewArtifactRecordsMatchAuthoritativeVerdicts, markPrReviewArtifactBoundary, markPrReviewHandoffComplete, transitionPrReviewToFeedback, declarePrFeedbackScope, resolvePrFeedbackScopeDeclaration, consumePrFeedbackScopeDeclaration, validatePrFeedbackScopeBinding, enforcePrWorkflowToolBefore, readPrReviewReentryBindingContext, hasActivePrReviewReentryAuthorization, reserveActivePrReviewReentryAuthorization, completePrWorkflow, _test_exports2 as _test_exports, normalizePrWorkflowShellCommand, describePrWorkflowRevisionDigestFailure, formatPrReviewLaneValidationFailure, validatePrReviewDiscoveryLaneCompletion2 as validatePrReviewDiscoveryLaneCompletion, validatePrWorkflowTransportRecovery, prReviewDiscoveryArtifactCoversLane, MAX_SALVAGED_SCHEMA_ERROR_CHARS, readPrWorkflowGateStateForRecovery, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleApproveWriteCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals26 as _internals1, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals30 as _internals2, createHivePromoterHook, promoteToHive, promoteFromSwarm, startSnapshotCoordinationInitialization, ensureSnapshotCoordinationReady, retrySnapshotCoordinationInitialization, getSnapshotCoordinationStatus, beginSnapshotCoordinationReset, closeSnapshotCoordinationInitialization, markSnapshotCoordinationClosing, _snapshotCoordinationInternals, safeRealpathSync, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getHostConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleBlueprintValidateCommand, handleBlueprintCurrentCommand, handleBlueprintHistoryCommand, handleBlueprintDiffCommand, handleBlueprintExportCommand, handleHarnessCandidateValidateCommand, handleHarnessCandidateShowCommand, handleHarnessCandidateDiffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, isCommandFailure, COMMAND_REGISTRY, VALID_COMMANDS, _internals102 as _internals3, resolveCommand, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand };