opencode-swarm 7.143.0 → 7.143.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/.opencode/skills/loop/SKILL.md +4 -2
  2. package/dist/cli/ast-diff-ypptrcan.js +422 -0
  3. package/dist/cli/{config-doctor-t1r5qwxk.js → config-doctor-ajq3sts3.js} +4 -4
  4. package/dist/cli/{core-e30p4vz9.js → core-0jn7sk7t.js} +4 -4
  5. package/dist/cli/curation-policy-pkb2eeb1.js +1 -1
  6. package/dist/cli/{curator-drift-49p3jnte.js → curator-drift-2jbjv03a.js} +6 -6
  7. package/dist/cli/{curator-ctasdmmq.js → curator-ff53rwz5.js} +36 -35
  8. package/dist/cli/{curator-llm-factory-y9xg7k6k.js → curator-llm-factory-2mz7fgd1.js} +36 -35
  9. package/dist/cli/{dispatch-rd10kdk1.js → dispatch-1y1rnv1h.js} +3 -3
  10. package/dist/cli/{evidence-summary-service-7bmg5r8y.js → evidence-summary-service-08zcq836.js} +16 -16
  11. package/dist/cli/{gate-evidence-1v0cj4c6.js → gate-evidence-2r7n4qjv.js} +9 -9
  12. package/dist/cli/{guardrail-explain-6x9psbwz.js → guardrail-explain-cm5je07b.js} +37 -36
  13. package/dist/cli/{guardrail-log-pma4m8vr.js → guardrail-log-jf4430p5.js} +6 -6
  14. package/dist/cli/{hive-promoter-g16grej1.js → hive-promoter-738bf1fj.js} +36 -35
  15. package/dist/cli/{index-fhxh447f.js → index-0kqs2fbm.js} +15 -15
  16. package/dist/cli/{index-2n8y67b4.js → index-254xf5y6.js} +2 -2
  17. package/dist/cli/{index-9v53ez3a.js → index-3fg8kx7n.js} +4 -4
  18. package/dist/cli/{runtime-ykafcwc6.js → index-5n69863d.js} +2 -10
  19. package/dist/cli/{index-n96ay8w4.js → index-7317fvce.js} +5 -5
  20. package/dist/cli/index-7sy3aa9m.js +115 -0
  21. package/dist/cli/{index-7c4bxgdh.js → index-8aabbfhv.js} +5 -5
  22. package/dist/cli/{index-x6qq39e9.js → index-91dz0zct.js} +10 -10
  23. package/dist/cli/{index-s89y08tk.js → index-a5rky7fv.js} +2 -2
  24. package/dist/cli/{index-fprxtq3q.js → index-awzwmx8p.js} +32 -32
  25. package/dist/cli/{index-ebwznsfy.js → index-b6e016tv.js} +1 -1
  26. package/dist/cli/{index-kxpz3ncd.js → index-cfwdm1dx.js} +1 -1
  27. package/dist/cli/{index-6texwk9p.js → index-crt7xw29.js} +5 -5
  28. package/dist/cli/{index-15h4dpsn.js → index-cz9tc0h8.js} +5 -5
  29. package/dist/cli/{index-82m5kwtd.js → index-gdd4jt6b.js} +4 -4
  30. package/dist/cli/{index-qwm6vdyv.js → index-k3cxyk66.js} +1 -1
  31. package/dist/cli/{index-q8st0mtw.js → index-mpw32szm.js} +1 -1
  32. package/dist/cli/{index-96h1v2jw.js → index-n2jk8ajv.js} +1 -1
  33. package/dist/cli/{index-g0pbvfhw.js → index-n48cwf1a.js} +7 -7
  34. package/dist/cli/{index-sb16w4wj.js → index-q68a8h37.js} +6 -6
  35. package/dist/cli/{index-m4v9kab1.js → index-q7jv0c8e.js} +341 -355
  36. package/dist/cli/{index-28jr28fg.js → index-qmfzfh7m.js} +9 -9
  37. package/dist/cli/{index-k46me75h.js → index-rn0eq85g.js} +1 -1
  38. package/dist/cli/{index-keskta0w.js → index-srd87kxc.js} +8 -8
  39. package/dist/cli/{index-1g473508.js → index-wnj1d1es.js} +43 -42
  40. package/dist/cli/{index-htmsm37t.js → index-x10a9cz6.js} +5 -5
  41. package/dist/cli/{index-336ra397.js → index-zgq25ze6.js} +5 -5
  42. package/dist/cli/{index-r0tn9kpa.js → index-zky3vt90.js} +4 -4
  43. package/dist/cli/index.js +45 -41
  44. package/dist/cli/{knowledge-escalator-1b2hmcgn.js → knowledge-escalator-9mdajq4s.js} +15 -15
  45. package/dist/cli/{knowledge-events-vx4fqjzb.js → knowledge-events-pz58s2r1.js} +13 -13
  46. package/dist/cli/knowledge-link-fn5j3r4q.js +1 -1
  47. package/dist/cli/{knowledge-store-t2qyr4yr.js → knowledge-store-sz8vat89.js} +3 -3
  48. package/dist/cli/{knowledge-validator-c7871bjc.js → knowledge-validator-w5vmvf0a.js} +4 -4
  49. package/dist/cli/{pending-delegations-0hb97ps1.js → pending-delegations-b3pt3w5w.js} +5 -5
  50. package/dist/cli/{pr-subscriptions-b63t252j.js → pr-subscriptions-jyav582d.js} +5 -5
  51. package/dist/cli/{runner-hrg7h2h4.js → runner-pde6b5sx.js} +2 -2
  52. package/dist/cli/runtime-te94z1zb.js +23 -0
  53. package/dist/cli/{scan-cursor-pnbpfjjc.js → scan-cursor-p54xsx41.js} +4 -4
  54. package/dist/cli/{schema-47xpcghn.js → schema-p74hnrfz.js} +1 -1
  55. package/dist/cli/{scope-persistence-wxx1jpfw.js → scope-persistence-1fc2ncsk.js} +9 -9
  56. package/dist/cli/semantic-classifier-ygqk0me1.js +147 -0
  57. package/dist/cli/{skill-generator-s456hfta.js → skill-generator-yv46bt1a.js} +16 -16
  58. package/dist/cli/{worktree-collision-ownership-ymdxetnn.js → worktree-collision-ownership-bfz3drxm.js} +6 -6
  59. package/dist/cli/{worktree-isolation-d0xgp705.js → worktree-isolation-qfgc3vma.js} +38 -37
  60. package/dist/cli/{worktree-provisioning-owner-sjh7te1h.js → worktree-provisioning-owner-g24xd417.js} +4 -4
  61. package/dist/commands/registry.d.ts +1 -1
  62. package/dist/config/constants.d.ts +2 -2
  63. package/dist/hooks/delegation-gate.d.ts +19 -2
  64. package/dist/index.js +378 -369
  65. package/dist/parallel/review-router.d.ts +16 -0
  66. package/dist/parallel/tier3-classifier.d.ts +11 -0
  67. package/dist/utils/patch-dedent.d.ts +33 -0
  68. package/dist/workflow/coder-settlement.d.ts +30 -0
  69. package/dist/workflow/workflow-wal-schema.d.ts +2 -0
  70. package/package.json +1 -1
  71. package/dist/cli/{index-y9h2vqf6.js → index-4q9vfav6.js} +3 -3
  72. package/dist/cli/{index-ee3x66a5.js → index-z6xqpmqg.js} +3 -3
@@ -1,35 +1,13 @@
1
1
  // @bun
2
- import {
3
- withTimeout
4
- } from "./index-4905hd2m.js";
5
- import {
6
- _internals as _internals3,
7
- _internals1 as _internals4,
8
- buildNativeTargetCommand,
9
- getProfileForFile,
10
- isCommandAvailable,
11
- tool
12
- } from "./index-ebwznsfy.js";
13
- import {
14
- captureWorkingTreeFingerprint,
15
- createModelEvaluationExecutor,
16
- pLimit,
17
- resolveExecutableFromPath,
18
- runEvaluation,
19
- runExternalTool
20
- } from "./index-y9h2vqf6.js";
21
2
  import {
22
3
  stableCanonicalStringify
23
- } from "./index-n96ay8w4.js";
24
- import {
25
- getGlobalEventBus
26
- } from "./index-c8s9a3zh.js";
4
+ } from "./index-7317fvce.js";
27
5
  import {
28
6
  detectStraySwarmDirs,
29
7
  readDoctorArtifact,
30
8
  removeStraySwarmDir,
31
9
  runConfigDoctor
32
- } from "./index-r0tn9kpa.js";
10
+ } from "./index-zky3vt90.js";
33
11
  import {
34
12
  MAX_TRANSIENT_RETRIES,
35
13
  archiveEvidence,
@@ -76,10 +54,26 @@ import {
76
54
  updateTaskCheckpointReceipt,
77
55
  updateTaskStatus,
78
56
  validateProjectRoot
79
- } from "./index-fprxtq3q.js";
57
+ } from "./index-awzwmx8p.js";
80
58
  import {
81
59
  loadDatabaseCtor
82
60
  } from "./index-134d35c1.js";
61
+ import {
62
+ _internals as _internals3,
63
+ _internals1 as _internals4,
64
+ buildNativeTargetCommand,
65
+ getProfileForFile,
66
+ isCommandAvailable,
67
+ tool
68
+ } from "./index-b6e016tv.js";
69
+ import {
70
+ captureWorkingTreeFingerprint,
71
+ createModelEvaluationExecutor,
72
+ pLimit,
73
+ resolveExecutableFromPath,
74
+ runEvaluation,
75
+ runExternalTool
76
+ } from "./index-4q9vfav6.js";
83
77
  import {
84
78
  EvaluationTaskV1Schema,
85
79
  GateAuditManifestV1Schema,
@@ -108,6 +102,19 @@ import {
108
102
  resolveContainedExistingPath,
109
103
  sha256
110
104
  } from "./index-y8552snf.js";
105
+ import {
106
+ alreadyCuratedThisGeneration,
107
+ claimNextScanBatch,
108
+ resolveCohortId
109
+ } from "./index-crt7xw29.js";
110
+ import {
111
+ CURATOR_INIT_PROMPT,
112
+ CURATOR_PHASE_PROMPT,
113
+ READ_ONLY_LANE_GUIDANCE
114
+ } from "./index-xmzmeknp.js";
115
+ import {
116
+ getGlobalEventBus
117
+ } from "./index-c8s9a3zh.js";
111
118
  import {
112
119
  buildOpenSpecProjectionSync,
113
120
  detectSpeckit,
@@ -117,6 +124,24 @@ import {
117
124
  validateSpeckit,
118
125
  writeProjectedSpecSync
119
126
  } from "./index-9ss2m4rs.js";
127
+ import {
128
+ TASK_WORKFLOW_SCHEMA_MARKER,
129
+ _internals as _internals2,
130
+ attemptMergeBackFromDirty,
131
+ cleanupOrphanedBranches,
132
+ compareTaskWorkflowStateRank,
133
+ getMergeStrategy,
134
+ getTaskWorkflowSnapshot,
135
+ listRecoveryRecords,
136
+ parseTaskEvidence,
137
+ postMergeCleanup,
138
+ pruneStaleWorktreeMetadata,
139
+ readWorkflowWalFile,
140
+ reconcileLandedMerge,
141
+ startupOrphanRecovery,
142
+ withTaskEvidenceTransaction,
143
+ writeWorkflowWalFile
144
+ } from "./index-0kqs2fbm.js";
120
145
  import {
121
146
  changedFilesSinceSnapshot,
122
147
  parsePorcelainV2Snapshot,
@@ -163,26 +188,38 @@ import {
163
188
  retireSkill,
164
189
  selectCandidateEntries,
165
190
  syncBundledProjectSkillsIfMissingAsync
166
- } from "./index-x6qq39e9.js";
191
+ } from "./index-91dz0zct.js";
167
192
  import {
168
193
  readRecentEscalations
169
- } from "./index-htmsm37t.js";
194
+ } from "./index-x10a9cz6.js";
170
195
  import {
171
- alreadyCuratedThisGeneration,
172
- claimNextScanBatch,
173
- resolveCohortId
174
- } from "./index-6texwk9p.js";
196
+ MAX_PENDING_SCOPE_BINDINGS,
197
+ clearAllScopes,
198
+ clearScopeBindingFromDisk,
199
+ clearScopeBindings
200
+ } from "./index-3fg8kx7n.js";
175
201
  import {
176
- CURATOR_INIT_PROMPT,
177
- CURATOR_PHASE_PROMPT,
178
- READ_ONLY_LANE_GUIDANCE
179
- } from "./index-xmzmeknp.js";
202
+ appendLedgerEvent,
203
+ computePlanHash,
204
+ computePlanStructureHash,
205
+ derivePlanId,
206
+ derivePlanIdentityHash,
207
+ getOrAdoptPlanEpochUnderLock,
208
+ initLedger,
209
+ readLedgerEvents,
210
+ readPlanEpochIdentity,
211
+ replayFromLedgerWithStatus,
212
+ takeSnapshotEvent
213
+ } from "./index-q68a8h37.js";
214
+ import {
215
+ isPathWithinDeclaredScope
216
+ } from "./index-556ja8an.js";
180
217
  import {
181
218
  buildCorrelationId,
182
219
  listActive,
183
220
  subscribe,
184
221
  unsubscribe
185
- } from "./index-82m5kwtd.js";
222
+ } from "./index-gdd4jt6b.js";
186
223
  import {
187
224
  clearWorktreeMergeStatus,
188
225
  getAllWorktreeMergeFailures,
@@ -193,37 +230,25 @@ import {
193
230
  WORKTREE_LIFECYCLE_LOCK_FILE,
194
231
  recordWorktreeProvisioningOwner,
195
232
  removeWorktreeProvisioningOwner
196
- } from "./index-qwm6vdyv.js";
233
+ } from "./index-k3cxyk66.js";
197
234
  import {
198
- TASK_WORKFLOW_SCHEMA_MARKER,
199
- _internals as _internals2,
200
- attemptMergeBackFromDirty,
201
- cleanupOrphanedBranches,
202
- compareTaskWorkflowStateRank,
203
- getMergeStrategy,
204
- getTaskWorkflowSnapshot,
205
- listRecoveryRecords,
206
- parseTaskEvidence,
207
- postMergeCleanup,
208
- pruneStaleWorktreeMetadata,
209
- readWorkflowWalFile,
210
- reconcileLandedMerge,
211
- startupOrphanRecovery,
212
- withTaskEvidenceTransaction,
213
- writeWorkflowWalFile
214
- } from "./index-fhxh447f.js";
235
+ findByBatchId,
236
+ readDelegations
237
+ } from "./index-8aabbfhv.js";
215
238
  import {
216
239
  provisionWorktree,
217
240
  removeWorktree
218
- } from "./index-g0pbvfhw.js";
219
- import {
220
- findByBatchId,
221
- readDelegations
222
- } from "./index-7c4bxgdh.js";
241
+ } from "./index-n48cwf1a.js";
223
242
  import {
224
243
  SandboxCapabilityProbe,
225
244
  init_capability_probe
226
245
  } from "./index-8fwhhayc.js";
246
+ import {
247
+ getLanguageForExtension
248
+ } from "./index-7sy3aa9m.js";
249
+ import {
250
+ withTimeout
251
+ } from "./index-4905hd2m.js";
227
252
  import {
228
253
  MAX_EVENT_LOG_ENTRIES,
229
254
  _internals,
@@ -237,12 +262,58 @@ import {
237
262
  recordKnowledgeEvent,
238
263
  recordPhaseCloseIntent,
239
264
  resolveKnowledgeEventsPath
240
- } from "./index-28jr28fg.js";
265
+ } from "./index-qmfzfh7m.js";
266
+ import {
267
+ resolveWorktreeIsolationConfig
268
+ } from "./index-254xf5y6.js";
269
+ import {
270
+ RetrospectiveEvidenceSchema
271
+ } from "./index-gprxjmm7.js";
272
+ import {
273
+ PlanSchema,
274
+ exports_loader,
275
+ init_loader,
276
+ loadPluginConfig,
277
+ loadPluginConfigWithMeta
278
+ } from "./index-zgq25ze6.js";
279
+ import {
280
+ DEFAULT_SKILL_OPT_CONFIG,
281
+ FALLBACK_MODELS_MAX,
282
+ KnowledgeConfigSchema,
283
+ MemoryConfigSchema,
284
+ SkillImproverConfigSchema,
285
+ getCanonicalAgentRole,
286
+ init_context_window,
287
+ init_package,
288
+ init_schema,
289
+ package_default,
290
+ resolveAutoReviewConfig,
291
+ stripKnownSwarmPrefix
292
+ } from "./index-mpw32szm.js";
241
293
  import {
242
294
  readSwarmFileAsync,
243
295
  safeHook,
244
296
  validateSwarmPath
245
- } from "./index-k46me75h.js";
297
+ } from "./index-rn0eq85g.js";
298
+ import {
299
+ advisoryWarn,
300
+ getDeferredWarnings,
301
+ init_warning_buffer
302
+ } from "./index-4rhhvd1a.js";
303
+ import {
304
+ AGENT_TOOL_MAP,
305
+ ALL_AGENT_NAMES,
306
+ ALL_SUBAGENT_NAMES,
307
+ DEFAULT_WORKTREE_ISOLATION_CONFIG,
308
+ ORCHESTRATOR_NAME,
309
+ SWARM_WORKTREE_DIR_NAME,
310
+ TOOL_NAMES,
311
+ TOOL_NAME_SET,
312
+ WRITE_TOOL_NAMES,
313
+ init_agent_names,
314
+ init_constants,
315
+ init_tool_metadata
316
+ } from "./index-jqsfsqbx.js";
246
317
  import {
247
318
  appendUnactionable,
248
319
  quarantineEntry,
@@ -253,7 +324,7 @@ import {
253
324
  validateActionableFields,
254
325
  validateLesson,
255
326
  validateSkillPath
256
- } from "./index-kxpz3ncd.js";
327
+ } from "./index-cfwdm1dx.js";
257
328
  import {
258
329
  authorizeCuration,
259
330
  buildConfigFingerprintInput
@@ -290,7 +361,7 @@ import {
290
361
  transactFile,
291
362
  transactKnowledge,
292
363
  wordBigrams
293
- } from "./index-keskta0w.js";
364
+ } from "./index-srd87kxc.js";
294
365
  import {
295
366
  resolveHiveDataDir,
296
367
  resolveHiveEventsPath,
@@ -310,38 +381,16 @@ import {
310
381
  import {
311
382
  atomicWriteFile
312
383
  } from "./index-erfnw81g.js";
384
+ import {
385
+ KNOWLEDGE_SCHEMA_VERSION,
386
+ OUTCOME_BLOCK_THRESHOLD,
387
+ init_knowledge_types,
388
+ isActiveStatus
389
+ } from "./index-bk5tah7q.js";
313
390
  import {
314
391
  invalidateCachedArtifact,
315
392
  resetSwarmArtifactCache
316
393
  } from "./index-ed5ykebp.js";
317
- import {
318
- resolveWorktreeIsolationConfig
319
- } from "./index-2n8y67b4.js";
320
- import {
321
- RetrospectiveEvidenceSchema
322
- } from "./index-gprxjmm7.js";
323
- import {
324
- MAX_PENDING_SCOPE_BINDINGS,
325
- clearAllScopes,
326
- clearScopeBindingFromDisk,
327
- clearScopeBindings
328
- } from "./index-9v53ez3a.js";
329
- import {
330
- appendLedgerEvent,
331
- computePlanHash,
332
- computePlanStructureHash,
333
- derivePlanId,
334
- derivePlanIdentityHash,
335
- getOrAdoptPlanEpochUnderLock,
336
- initLedger,
337
- readLedgerEvents,
338
- readPlanEpochIdentity,
339
- replayFromLedgerWithStatus,
340
- takeSnapshotEvent
341
- } from "./index-sb16w4wj.js";
342
- import {
343
- isPathWithinDeclaredScope
344
- } from "./index-556ja8an.js";
345
394
  import {
346
395
  assertProjectRoot,
347
396
  hasExplicitProjectBoundary,
@@ -357,23 +406,15 @@ import {
357
406
  getLastHeartbeat,
358
407
  telemetry
359
408
  } from "./index-s2rcz51a.js";
409
+ import {
410
+ exports_external,
411
+ init_zod
412
+ } from "./index-bpmtbmy9.js";
360
413
  import {
361
414
  bunSpawn,
362
415
  bunWrite,
363
416
  mergeEnvForChild
364
417
  } from "./index-4nt52yr9.js";
365
- import {
366
- PlanSchema,
367
- exports_loader,
368
- init_loader,
369
- loadPluginConfig,
370
- loadPluginConfigWithMeta
371
- } from "./index-336ra397.js";
372
- import {
373
- advisoryWarn,
374
- getDeferredWarnings,
375
- init_warning_buffer
376
- } from "./index-4rhhvd1a.js";
377
418
  import {
378
419
  criticalWarn,
379
420
  error,
@@ -381,44 +422,6 @@ import {
381
422
  log,
382
423
  warn
383
424
  } from "./index-zgwm4ryv.js";
384
- import {
385
- DEFAULT_SKILL_OPT_CONFIG,
386
- FALLBACK_MODELS_MAX,
387
- KnowledgeConfigSchema,
388
- MemoryConfigSchema,
389
- SkillImproverConfigSchema,
390
- getCanonicalAgentRole,
391
- init_context_window,
392
- init_package,
393
- init_schema,
394
- package_default,
395
- resolveAutoReviewConfig,
396
- stripKnownSwarmPrefix
397
- } from "./index-q8st0mtw.js";
398
- import {
399
- AGENT_TOOL_MAP,
400
- ALL_AGENT_NAMES,
401
- ALL_SUBAGENT_NAMES,
402
- DEFAULT_WORKTREE_ISOLATION_CONFIG,
403
- ORCHESTRATOR_NAME,
404
- SWARM_WORKTREE_DIR_NAME,
405
- TOOL_NAMES,
406
- TOOL_NAME_SET,
407
- WRITE_TOOL_NAMES,
408
- init_agent_names,
409
- init_constants,
410
- init_tool_metadata
411
- } from "./index-jqsfsqbx.js";
412
- import {
413
- KNOWLEDGE_SCHEMA_VERSION,
414
- OUTCOME_BLOCK_THRESHOLD,
415
- init_knowledge_types,
416
- isActiveStatus
417
- } from "./index-bk5tah7q.js";
418
- import {
419
- exports_external,
420
- init_zod
421
- } from "./index-bpmtbmy9.js";
422
425
  import {
423
426
  __require,
424
427
  __toCommonJS,
@@ -1035,6 +1038,14 @@ function isMarkdownOnlyTaskChange(declaredFiles, observedFiles) {
1035
1038
  });
1036
1039
  }
1037
1040
 
1041
+ // src/parallel/review-router.ts
1042
+ var HIGH_RISK_CATEGORIES = new Set([
1043
+ "GUARD_REMOVED",
1044
+ "SIGNATURE_CHANGE",
1045
+ "API_CHANGE",
1046
+ "DELETED_FUNCTION"
1047
+ ]);
1048
+
1038
1049
  // src/turbo/epic/cochange-conflict.ts
1039
1050
  function pathMatches(scopePath, cochangePath) {
1040
1051
  if (scopePath === cochangePath)
@@ -3938,6 +3949,9 @@ init_logger();
3938
3949
  import { spawnSync } from "child_process";
3939
3950
  import { randomUUID as randomUUID2 } from "crypto";
3940
3951
  import { existsSync as existsSync5 } from "fs";
3952
+ import { appendFile as appendFile2, mkdir as mkdir3 } from "fs/promises";
3953
+ import { dirname as dirname6 } from "path";
3954
+ init_logger();
3941
3955
  var LIVE_DISPATCHES_SYMBOL = Symbol.for("opencode-swarm.workflow.coder-settlement.live-dispatches");
3942
3956
  var globalRegistry = globalThis;
3943
3957
  if (!globalRegistry[LIVE_DISPATCHES_SYMBOL]) {
@@ -3971,6 +3985,46 @@ async function withSettlementLock(directory, taskId, actor, operation) {
3971
3985
  async function writeWal(filePath, wal) {
3972
3986
  await writeWorkflowWalFile("coder-settlement", filePath, wal);
3973
3987
  }
3988
+ async function appendSettlementEvent(directory, action, wal, extra) {
3989
+ const line = `${JSON.stringify({
3990
+ type: "coder_settlement",
3991
+ action,
3992
+ timestamp: new Date().toISOString(),
3993
+ taskId: wal.taskId,
3994
+ transitionId: wal.transitionId,
3995
+ actor: wal.actor,
3996
+ ...extra ?? {}
3997
+ })}
3998
+ `;
3999
+ try {
4000
+ const eventsPath = validateSwarmPath(directory, "events.jsonl");
4001
+ await mkdir3(dirname6(eventsPath), { recursive: true });
4002
+ await appendFile2(eventsPath, line, "utf-8");
4003
+ } catch (error2) {
4004
+ const code = error2.code;
4005
+ if (code === "EBUSY" || code === "EPERM") {
4006
+ try {
4007
+ const eventsPath = validateSwarmPath(directory, "events.jsonl");
4008
+ await appendFile2(eventsPath, line, "utf-8");
4009
+ return;
4010
+ } catch (retryError) {
4011
+ criticalWarn(`[coder-settlement] lifecycle event write failed after retry (${action} ${wal.taskId}): ${retryError instanceof Error ? retryError.message : String(retryError)}`);
4012
+ return;
4013
+ }
4014
+ }
4015
+ criticalWarn(`[coder-settlement] lifecycle event write failed (${action} ${wal.taskId}): ${error2 instanceof Error ? error2.message : String(error2)}`);
4016
+ }
4017
+ }
4018
+ function baselineAttributionDoomed(baseline) {
4019
+ if (baseline.gitHead === null)
4020
+ return true;
4021
+ return Array.isArray(baseline.changedFiles) && baseline.changedFiles.length > 0;
4022
+ }
4023
+ function doomedReason(baseline) {
4024
+ if (baseline.gitHead === null)
4025
+ return "launch workspace has no git baseline (not a git repository, or git unavailable at dispatch)";
4026
+ return `launch baseline was dirty with ${String(baseline.changedFiles?.length ?? 0)} pre-existing uncommitted/untracked change(s)`;
4027
+ }
3974
4028
  function isProcessAlive(processId) {
3975
4029
  if (processId === process.pid)
3976
4030
  return true;
@@ -4006,6 +4060,9 @@ async function commitPrepared(directory, wal) {
4006
4060
  cleanupComplete: lockedWal.worktree === undefined
4007
4061
  };
4008
4062
  await writeWal(walPath(directory, wal.taskId), lockedWal);
4063
+ await appendSettlementEvent(directory, "settled", lockedWal, {
4064
+ resumed: true
4065
+ });
4009
4066
  }
4010
4067
  return {
4011
4068
  evidence: transaction.read(),
@@ -4037,6 +4094,7 @@ async function commitPrepared(directory, wal) {
4037
4094
  cleanupComplete: lockedWal.worktree === undefined
4038
4095
  };
4039
4096
  await writeWal(walPath(directory, wal.taskId), lockedWal);
4097
+ await appendSettlementEvent(directory, "settled", lockedWal);
4040
4098
  return {
4041
4099
  evidence,
4042
4100
  accepted: lockedWal.accepted === true,
@@ -4044,6 +4102,29 @@ async function commitPrepared(directory, wal) {
4044
4102
  };
4045
4103
  });
4046
4104
  }
4105
+ async function abortDispatchedWalUnderLock(directory, taskId, transitionId, reason) {
4106
+ const filePath = walPath(directory, taskId);
4107
+ const wal = await readWal(filePath, taskId);
4108
+ if (wal === null)
4109
+ throw new Error("CODER_SETTLEMENT_WAL_MISSING");
4110
+ if (wal.transitionId !== transitionId) {
4111
+ throw new Error("CODER_SETTLEMENT_WAL_REPLACED");
4112
+ }
4113
+ if (wal.state === "ABORTED") {
4114
+ return { outcome: "already-aborted", worktree: wal.worktree !== undefined };
4115
+ }
4116
+ if (wal.state !== "DISPATCHED") {
4117
+ return { outcome: "not-dispatched", worktree: false };
4118
+ }
4119
+ await writeWal(filePath, {
4120
+ ...wal,
4121
+ state: "ABORTED",
4122
+ abortReason: reason
4123
+ });
4124
+ liveDispatches.delete(dispatchKey(directory, taskId, transitionId));
4125
+ await appendSettlementEvent(directory, "aborted", wal, { reason });
4126
+ return { outcome: "aborted", worktree: wal.worktree !== undefined };
4127
+ }
4047
4128
  async function cleanupRecoveredWorktree(directory, descriptor) {
4048
4129
  const branchExists = () => {
4049
4130
  const result = spawnSync("git", [
@@ -4072,7 +4153,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
4072
4153
  awaitingMergeByCallID,
4073
4154
  cleanupStandardWorktreeForCallId,
4074
4155
  standardWorktreeByCallID
4075
- } = await import("./worktree-isolation-d0xgp705.js");
4156
+ } = await import("./worktree-isolation-qfgc3vma.js");
4076
4157
  standardWorktreeByCallID.delete(descriptor.callID);
4077
4158
  if (hasResidue)
4078
4159
  awaitingMergeByCallID.set(descriptor.callID, {
@@ -4091,7 +4172,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
4091
4172
  if (existsSync5(descriptor.worktreePath) || branchExists()) {
4092
4173
  throw new Error("CODER_SETTLEMENT_WORKTREE_CLEANUP_UNVERIFIED");
4093
4174
  }
4094
- const { removeWorktreeProvisioningOwner: removeWorktreeProvisioningOwner2 } = await import("./worktree-provisioning-owner-sjh7te1h.js");
4175
+ const { removeWorktreeProvisioningOwner: removeWorktreeProvisioningOwner2 } = await import("./worktree-provisioning-owner-g24xd417.js");
4095
4176
  if (!removeWorktreeProvisioningOwner2(directory, descriptor.callID)) {
4096
4177
  throw new Error("CODER_SETTLEMENT_OWNER_CLEANUP_FAILED");
4097
4178
  }
@@ -4151,7 +4232,7 @@ async function recoverCoderSettlement(directory, taskId) {
4151
4232
  awaitingMergeByCallID,
4152
4233
  finishStandardWorktreeDispatch,
4153
4234
  standardWorktreeByCallID
4154
- } = await import("./worktree-isolation-d0xgp705.js");
4235
+ } = await import("./worktree-isolation-qfgc3vma.js");
4155
4236
  const descriptor = wal.worktree;
4156
4237
  const reconstructedDispatch = {
4157
4238
  callID: descriptor.callID,
@@ -4217,7 +4298,21 @@ async function recoverCoderSettlement(directory, taskId) {
4217
4298
  });
4218
4299
  return recovered;
4219
4300
  }
4220
- const observed = scopedObservedFiles(directory, wal.context);
4301
+ const rawObserved = changedFilesSinceSnapshot(directory, wal.context.baseline);
4302
+ let observed;
4303
+ if (rawObserved === null) {
4304
+ if (baselineAttributionDoomed(wal.context.baseline)) {
4305
+ const aborted = await abortDispatchedWalUnderLock(directory, taskId, wal.transitionId, doomedReason(wal.context.baseline));
4306
+ if (aborted.outcome === "aborted" || aborted.outcome === "already-aborted") {
4307
+ return null;
4308
+ }
4309
+ }
4310
+ observed = null;
4311
+ } else if (wal.context.declaredFiles === null) {
4312
+ observed = [];
4313
+ } else {
4314
+ observed = rawObserved.filter((filePath2) => isPathWithinDeclaredScope(filePath2, wal.context.declaredFiles ?? [], directory));
4315
+ }
4221
4316
  if (observed === null) {
4222
4317
  throw new Error(`CODER_SETTLEMENT_RECOVERY_UNCERTAIN: task ${taskId} workspace changes could not be attributed safely`);
4223
4318
  }
@@ -4252,7 +4347,7 @@ async function assertNoUnsettledCoderDispatch(directory, taskId) {
4252
4347
  }
4253
4348
 
4254
4349
  // src/workflow/task-repair.ts
4255
- import { appendFile as appendFile2, readFile as readFile4 } from "fs/promises";
4350
+ import { appendFile as appendFile3, readFile as readFile4 } from "fs/promises";
4256
4351
  async function recoverPreparedTaskRepairWithPlanLock(directory, taskId, actor, currentPlan) {
4257
4352
  const walPath2 = validateSwarmPath(directory, `task-repairs/${taskId}.json`);
4258
4353
  const eventsPath = validateSwarmPath(directory, "events.jsonl");
@@ -4352,7 +4447,7 @@ async function ensureAuditEvent(directory, eventsPath, wal) {
4352
4447
  const existing = await readText(eventsPath);
4353
4448
  if (findRepairEvent(existing, wal.taskId, wal.transitionId))
4354
4449
  return;
4355
- await appendFile2(eventsPath, `${JSON.stringify({
4450
+ await appendFile3(eventsPath, `${JSON.stringify({
4356
4451
  type: "task_workflow_repaired",
4357
4452
  timestamp: new Date().toISOString(),
4358
4453
  taskId: wal.taskId,
@@ -9406,8 +9501,8 @@ ${USAGE}`;
9406
9501
 
9407
9502
  // src/services/spec-drift-recovery.ts
9408
9503
  import { createHash as createHash5 } from "crypto";
9409
- import { appendFile as appendFile4, mkdir as mkdir4, readFile as readFile6, unlink as unlink2 } from "fs/promises";
9410
- import { dirname as dirname8 } from "path";
9504
+ import { appendFile as appendFile5, mkdir as mkdir5, readFile as readFile6, unlink as unlink2 } from "fs/promises";
9505
+ import { dirname as dirname9 } from "path";
9411
9506
  var SPEC_DRIFT_RECOVERY_AGENT = "spec-drift-recovery";
9412
9507
  var _internals14 = {
9413
9508
  appendEvent,
@@ -9487,7 +9582,7 @@ async function unlinkIfExists(filePath) {
9487
9582
  }
9488
9583
  }
9489
9584
  async function writeWal4(walPath2, wal) {
9490
- await mkdir4(dirname8(walPath2), { recursive: true });
9585
+ await mkdir5(dirname9(walPath2), { recursive: true });
9491
9586
  await atomicWriteFile(walPath2, `${JSON.stringify(wal, null, 2)}
9492
9587
  `);
9493
9588
  }
@@ -9537,7 +9632,7 @@ async function appendEvent(eventsPath, event) {
9537
9632
  const existing = await _internals14.verifyEventPresence(eventsPath, event.type, event.transitionId);
9538
9633
  if (existing)
9539
9634
  return;
9540
- await appendFile4(eventsPath, `${JSON.stringify(event)}
9635
+ await appendFile5(eventsPath, `${JSON.stringify(event)}
9541
9636
  `, "utf-8");
9542
9637
  const verified = await _internals14.verifyEventPresence(eventsPath, event.type, event.transitionId);
9543
9638
  if (!verified) {
@@ -10178,7 +10273,7 @@ import * as path13 from "path";
10178
10273
 
10179
10274
  // src/evaluation/gate-ground-truth.ts
10180
10275
  init_zod();
10181
- import { mkdir as mkdir5, readFile as readFile7 } from "fs/promises";
10276
+ import { mkdir as mkdir6, readFile as readFile7 } from "fs/promises";
10182
10277
  import * as path12 from "path";
10183
10278
  var GateGroundTruthV1Schema = exports_external.object({
10184
10279
  v: exports_external.literal(1),
@@ -10231,7 +10326,7 @@ async function saveGateGroundTruth(directory, runId, input) {
10231
10326
  }
10232
10327
  const target = absolutePath(directory, runId);
10233
10328
  assertProjectRoot(directory);
10234
- await mkdir5(path12.dirname(target), { recursive: true });
10329
+ await mkdir6(path12.dirname(target), { recursive: true });
10235
10330
  return withEvidenceLock(directory, relativePath(runId), "gate-ground-truth", runId, async () => {
10236
10331
  let existingEvents = [];
10237
10332
  try {
@@ -14836,7 +14931,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
14836
14931
  };
14837
14932
  }
14838
14933
  async function sweepActiveNearDuplicates(directory, options = {}) {
14839
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-15h4dpsn.js");
14934
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-cz9tc0h8.js");
14840
14935
  const { config } = loadPluginConfigWithMeta2(directory);
14841
14936
  const sweepConfig = config.learning?.dedup_sweep;
14842
14937
  if (sweepConfig?.enabled === false)
@@ -15920,7 +16015,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
15920
16015
  }
15921
16016
  if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
15922
16017
  try {
15923
- const skillModule = await import("./skill-generator-s456hfta.js");
16018
+ const skillModule = await import("./skill-generator-yv46bt1a.js");
15924
16019
  for (const cand of skillCandidates) {
15925
16020
  if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
15926
16021
  continue;
@@ -16380,7 +16475,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
16380
16475
  } catch {}
16381
16476
  }
16382
16477
  if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
16383
- const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-1b2hmcgn.js");
16478
+ const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-9mdajq4s.js");
16384
16479
  for (const { id } of contradictedEntries) {
16385
16480
  try {
16386
16481
  await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
@@ -17199,7 +17294,7 @@ async function runCuratorPostMortem(directory, options = {}) {
17199
17294
  warnings.push("Failed to collect knowledge summary.");
17200
17295
  }
17201
17296
  try {
17202
- const { getScanStatus } = await import("./scan-cursor-pnbpfjjc.js");
17297
+ const { getScanStatus } = await import("./scan-cursor-p54xsx41.js");
17203
17298
  const scanStatus = await getScanStatus(directory);
17204
17299
  if (scanStatus.remaining_estimate > 0) {
17205
17300
  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.`);
@@ -17371,9 +17466,9 @@ var _internals23 = {
17371
17466
  verifyPostMortemKnowledgeActions,
17372
17467
  repairPostMortemActions,
17373
17468
  loadDefaultKnowledgeConfig: async (directory) => {
17374
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-47xpcghn.js");
17469
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-p74hnrfz.js");
17375
17470
  try {
17376
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-15h4dpsn.js");
17471
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-cz9tc0h8.js");
17377
17472
  const loaded = loadPluginConfigWithMeta2(directory);
17378
17473
  return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
17379
17474
  } catch {
@@ -17381,11 +17476,11 @@ var _internals23 = {
17381
17476
  }
17382
17477
  },
17383
17478
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
17384
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-ctasdmmq.js");
17479
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-ff53rwz5.js");
17385
17480
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
17386
17481
  },
17387
17482
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
17388
- const { checkHivePromotions } = await import("./hive-promoter-g16grej1.js");
17483
+ const { checkHivePromotions } = await import("./hive-promoter-738bf1fj.js");
17389
17484
  return checkHivePromotions(entries, knowledgeConfig, directory);
17390
17485
  },
17391
17486
  applyProposalTriage: async (directory, triage) => {
@@ -17394,7 +17489,7 @@ var _internals23 = {
17394
17489
  activateProposal,
17395
17490
  listSkills: listSkills2,
17396
17491
  sanitizeSlug
17397
- } = await import("./skill-generator-s456hfta.js");
17492
+ } = await import("./skill-generator-yv46bt1a.js");
17398
17493
  const result = {
17399
17494
  approved: [],
17400
17495
  rejected: [],
@@ -17436,7 +17531,7 @@ var _internals23 = {
17436
17531
  return result;
17437
17532
  },
17438
17533
  readPriorDriftReports: async (directory) => {
17439
- const { readPriorDriftReports } = await import("./curator-drift-49p3jnte.js");
17534
+ const { readPriorDriftReports } = await import("./curator-drift-2jbjv03a.js");
17440
17535
  return readPriorDriftReports(directory);
17441
17536
  },
17442
17537
  readSwarmKnowledge: (directory) => readKnowledge(resolveSwarmKnowledgePath(directory))
@@ -17576,7 +17671,7 @@ function failedGateNames(decision) {
17576
17671
 
17577
17672
  // src/hooks/hive-transaction.ts
17578
17673
  var import_proper_lockfile4 = __toESM(require_proper_lockfile(), 1);
17579
- import { appendFile as appendFile5, mkdir as mkdir7, realpath as realpath2 } from "fs/promises";
17674
+ import { appendFile as appendFile6, mkdir as mkdir8, realpath as realpath2 } from "fs/promises";
17580
17675
  import * as path24 from "path";
17581
17676
  init_logger();
17582
17677
  var HIVE_LOCK_STALE_MS = 5000;
@@ -17601,7 +17696,7 @@ async function transactHiveStore(mutate) {
17601
17696
  const eventsPath = _internals24.resolveHiveEventsPath();
17602
17697
  const diagnostics = [];
17603
17698
  try {
17604
- await mkdir7(dataDir, { recursive: true });
17699
+ await mkdir8(dataDir, { recursive: true });
17605
17700
  } catch (err) {
17606
17701
  diagnostics.push(`hive data dir create failed: ${err instanceof Error ? err.message : String(err)}`);
17607
17702
  return { committed: false, return: undefined, diagnostics };
@@ -17654,13 +17749,13 @@ async function transactHiveStore(mutate) {
17654
17749
  const rejectBlock = `${outcome.rejects.map((r) => JSON.stringify(r)).join(`
17655
17750
  `)}
17656
17751
  `;
17657
- await appendFile5(rejectedPath, rejectBlock, "utf-8");
17752
+ await appendFile6(rejectedPath, rejectBlock, "utf-8");
17658
17753
  }
17659
17754
  if (outcome.audit && outcome.audit.length > 0) {
17660
17755
  const auditBlock = `${outcome.audit.map((a) => a.line).join(`
17661
17756
  `)}
17662
17757
  `;
17663
- await appendFile5(eventsPath, auditBlock, "utf-8");
17758
+ await appendFile6(eventsPath, auditBlock, "utf-8");
17664
17759
  try {
17665
17760
  await trimHiveEventsUnderLock(eventsPath);
17666
17761
  } catch (err) {
@@ -17743,7 +17838,7 @@ var _internals24 = {
17743
17838
  resolveHiveKnowledgePath,
17744
17839
  resolveHiveRejectedPath,
17745
17840
  resolveHiveEventsPath,
17746
- appendFile: appendFile5,
17841
+ appendFile: appendFile6,
17747
17842
  path: path24
17748
17843
  };
17749
17844
 
@@ -18492,8 +18587,8 @@ async function promoteFromSwarm(directory, lessonId, options, config) {
18492
18587
  import { createHash as createHash7 } from "crypto";
18493
18588
  import { existsSync as existsSync14 } from "fs";
18494
18589
  import {
18495
- appendFile as appendFile6,
18496
- mkdir as mkdir9,
18590
+ appendFile as appendFile7,
18591
+ mkdir as mkdir10,
18497
18592
  readFile as readFile11,
18498
18593
  realpath as realpath3,
18499
18594
  writeFile as writeFile6
@@ -18503,7 +18598,7 @@ import * as path27 from "path";
18503
18598
  // src/services/synonym-map.ts
18504
18599
  var import_proper_lockfile5 = __toESM(require_proper_lockfile(), 1);
18505
18600
  import {
18506
- mkdir as mkdir8,
18601
+ mkdir as mkdir9,
18507
18602
  readFile as readFile10,
18508
18603
  rename as rename4,
18509
18604
  stat as stat3,
@@ -18665,7 +18760,7 @@ async function readSynonymMap(directory, maxPairs = DEFAULT_MAX_PAIRS) {
18665
18760
  }
18666
18761
  }
18667
18762
  async function writeSynonymMapAtomic(filePath, map) {
18668
- await mkdir8(path26.dirname(filePath), { recursive: true });
18763
+ await mkdir9(path26.dirname(filePath), { recursive: true });
18669
18764
  const tmp = `${filePath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
18670
18765
  try {
18671
18766
  await writeFile5(tmp, JSON.stringify(map, null, 2), "utf-8");
@@ -18679,7 +18774,7 @@ async function writeSynonymMapAtomic(filePath, map) {
18679
18774
  async function rebuildSynonymMap(directory, entries, maxPairs = DEFAULT_MAX_PAIRS) {
18680
18775
  const filePath = resolveSynonymMapPath(directory);
18681
18776
  const dir = path26.dirname(filePath);
18682
- await mkdir8(dir, { recursive: true });
18777
+ await mkdir9(dir, { recursive: true });
18683
18778
  let release = null;
18684
18779
  try {
18685
18780
  release = await import_proper_lockfile5.default.lock(dir, {
@@ -18730,9 +18825,9 @@ function hashContent(content) {
18730
18825
  return createHash7("sha1").update(content).digest("hex");
18731
18826
  }
18732
18827
  async function loadConfigForPolicyCurator(directory) {
18733
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-47xpcghn.js");
18828
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-p74hnrfz.js");
18734
18829
  try {
18735
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-15h4dpsn.js");
18830
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-cz9tc0h8.js");
18736
18831
  const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
18737
18832
  return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
18738
18833
  } catch {
@@ -19211,8 +19306,8 @@ RETRY: your last output was missing ${result.missing.join("; ")}; produce valid
19211
19306
  async function appendCuratorSkippedEvent(directory, record) {
19212
19307
  try {
19213
19308
  const filePath = path27.join(directory, ".swarm", "events.jsonl");
19214
- await mkdir9(path27.dirname(filePath), { recursive: true });
19215
- await appendFile6(filePath, `${JSON.stringify({
19309
+ await mkdir10(path27.dirname(filePath), { recursive: true });
19310
+ await appendFile7(filePath, `${JSON.stringify({
19216
19311
  timestamp: new Date().toISOString(),
19217
19312
  event: "curator_skipped",
19218
19313
  entry_id: record.entry_id,
@@ -19970,8 +20065,8 @@ class MemoryValidationError extends Error {
19970
20065
  import { randomUUID as randomUUID5 } from "crypto";
19971
20066
  import { existsSync as existsSync15, readFileSync as readFileSync12, writeFileSync as writeFileSync6 } from "fs";
19972
20067
  import {
19973
- appendFile as appendFile7,
19974
- mkdir as mkdir10,
20068
+ appendFile as appendFile8,
20069
+ mkdir as mkdir11,
19975
20070
  readFile as readFile12,
19976
20071
  rename as rename5,
19977
20072
  writeFile as writeFile7
@@ -21475,12 +21570,12 @@ function parseRewardEvent(value) {
21475
21570
  };
21476
21571
  }
21477
21572
  async function appendJsonl(filePath, value) {
21478
- await mkdir10(path28.dirname(filePath), { recursive: true });
21479
- await appendFile7(filePath, `${JSON.stringify(value)}
21573
+ await mkdir11(path28.dirname(filePath), { recursive: true });
21574
+ await appendFile8(filePath, `${JSON.stringify(value)}
21480
21575
  `, "utf-8");
21481
21576
  }
21482
21577
  async function writeJsonlAtomic(filePath, values) {
21483
- await mkdir10(path28.dirname(filePath), { recursive: true });
21578
+ await mkdir11(path28.dirname(filePath), { recursive: true });
21484
21579
  const tmp = `${filePath}.tmp.${randomUUID5()}`;
21485
21580
  const content = values.map((value) => JSON.stringify(value)).join(`
21486
21581
  `) + (values.length > 0 ? `
@@ -21861,7 +21956,7 @@ function resolveRerankerCacheDir() {
21861
21956
 
21862
21957
  // src/memory/jsonl-migration.ts
21863
21958
  import { existsSync as existsSync16, renameSync as renameSync5, unlinkSync as unlinkSync3 } from "fs";
21864
- import { copyFile, mkdir as mkdir11, readFile as readFile13, stat as stat4, writeFile as writeFile8 } from "fs/promises";
21959
+ import { copyFile, mkdir as mkdir12, readFile as readFile13, stat as stat4, writeFile as writeFile8 } from "fs/promises";
21865
21960
  import * as path31 from "path";
21866
21961
  var LEGACY_JSONL_MIGRATION_VERSION = 2;
21867
21962
  var LEGACY_JSONL_MIGRATION_NAME = "legacy_jsonl_import_complete";
@@ -21890,7 +21985,7 @@ async function readLegacyJsonl(rootDirectory, config = {}) {
21890
21985
  async function backupLegacyJsonl(rootDirectory, config = {}) {
21891
21986
  const storageDir = resolveMemoryStorageDir(rootDirectory, config);
21892
21987
  const backupDir = path31.join(storageDir, "backups");
21893
- await mkdir11(backupDir, { recursive: true });
21988
+ await mkdir12(backupDir, { recursive: true });
21894
21989
  const results = [];
21895
21990
  for (const filename of ["memories.jsonl", "proposals.jsonl"]) {
21896
21991
  const source = path31.join(storageDir, filename);
@@ -21908,7 +22003,7 @@ async function backupLegacyJsonl(rootDirectory, config = {}) {
21908
22003
  }
21909
22004
  async function writeJsonlExport(rootDirectory, config, memories, proposals) {
21910
22005
  const exportDir = path31.join(resolveMemoryStorageDir(rootDirectory, config), "export");
21911
- await mkdir11(exportDir, { recursive: true });
22006
+ await mkdir12(exportDir, { recursive: true });
21912
22007
  const memoriesPath = path31.join(exportDir, "memories.jsonl");
21913
22008
  const proposalsPath = path31.join(exportDir, "proposals.jsonl");
21914
22009
  const memoriesTempPath = path31.join(path31.dirname(memoriesPath), `${path31.basename(memoriesPath)}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
@@ -21935,7 +22030,7 @@ async function writeJsonlExport(rootDirectory, config, memories, proposals) {
21935
22030
  }
21936
22031
  async function writeMigrationReport(rootDirectory, report, config = {}) {
21937
22032
  const reportPath = path31.join(resolveMemoryStorageDir(rootDirectory, config), "migration-report.json");
21938
- await mkdir11(path31.dirname(reportPath), { recursive: true });
22033
+ await mkdir12(path31.dirname(reportPath), { recursive: true });
21939
22034
  const reportTempPath = path31.join(path31.dirname(reportPath), `${path31.basename(reportPath)}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
21940
22035
  try {
21941
22036
  await writeFile8(reportTempPath, `${JSON.stringify(report, null, 2)}
@@ -25184,12 +25279,12 @@ var _internals31 = {
25184
25279
 
25185
25280
  // src/services/skill-improver.ts
25186
25281
  import { existsSync as existsSync20 } from "fs";
25187
- import { mkdir as mkdir13, readFile as readFile14, rename as rename6, writeFile as writeFile10 } from "fs/promises";
25282
+ import { mkdir as mkdir14, readFile as readFile14, rename as rename6, writeFile as writeFile10 } from "fs/promises";
25188
25283
  import * as path38 from "path";
25189
25284
  init_logger();
25190
25285
 
25191
25286
  // src/services/trajectory-cluster.ts
25192
- import { mkdir as mkdir12, writeFile as writeFile9 } from "fs/promises";
25287
+ import { mkdir as mkdir13, writeFile as writeFile9 } from "fs/promises";
25193
25288
  import * as path37 from "path";
25194
25289
  init_logger();
25195
25290
  var MACRO_TRAJECTORY_WINDOW = 200;
@@ -25358,7 +25453,7 @@ async function writeMotifProposals(directory, opts = {}) {
25358
25453
  if (emitted.length === 0)
25359
25454
  return result;
25360
25455
  const proposalsDir = validateSwarmPath(directory, path37.join("skills", "proposals"));
25361
- await mkdir12(proposalsDir, { recursive: true });
25456
+ await mkdir13(proposalsDir, { recursive: true });
25362
25457
  const written = [];
25363
25458
  for (const decision of emitted) {
25364
25459
  const motif = selected[decision.index];
@@ -25548,7 +25643,7 @@ async function writeSuccessMotifProposals(directory, opts = {}) {
25548
25643
  if (emitted.length === 0)
25549
25644
  return result;
25550
25645
  const proposalsDir = validateSwarmPath(directory, path37.join("skills", "proposals"));
25551
- await mkdir12(proposalsDir, { recursive: true });
25646
+ await mkdir13(proposalsDir, { recursive: true });
25552
25647
  const written = [];
25553
25648
  for (const decision of emitted) {
25554
25649
  const motif = selected[decision.index];
@@ -25691,7 +25786,7 @@ function timestampSlug(d) {
25691
25786
  return d.toISOString().replace(/[:.]/g, "-");
25692
25787
  }
25693
25788
  async function atomicWrite(p, content) {
25694
- await mkdir13(path38.dirname(p), { recursive: true });
25789
+ await mkdir14(path38.dirname(p), { recursive: true });
25695
25790
  const tmp = `${p}.tmp-${process.pid}-${Date.now()}`;
25696
25791
  await writeFile10(tmp, content, "utf-8");
25697
25792
  await rename6(tmp, p);
@@ -27574,7 +27669,7 @@ async function runFinalizeStage(ctx) {
27574
27669
  }
27575
27670
  }
27576
27671
  try {
27577
- const { CuratorConfigSchema: CCS } = await import("./schema-47xpcghn.js");
27672
+ const { CuratorConfigSchema: CCS } = await import("./schema-p74hnrfz.js");
27578
27673
  const { config: pmLoadedConfig } = _internals36.loadPluginConfigWithMeta(ctx.directory);
27579
27674
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
27580
27675
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -28702,7 +28797,7 @@ init_schema();
28702
28797
 
28703
28798
  // src/services/skill-consolidation.ts
28704
28799
  import { existsSync as existsSync25 } from "fs";
28705
- import { mkdir as mkdir14, readFile as readFile15, rename as rename7, writeFile as writeFile11 } from "fs/promises";
28800
+ import { mkdir as mkdir15, readFile as readFile15, rename as rename7, writeFile as writeFile11 } from "fs/promises";
28706
28801
  import * as path44 from "path";
28707
28802
  var DEFAULT_CONSOLIDATION_INTERVAL_HOURS = 24;
28708
28803
  var DEFAULT_CONSOLIDATION_MAX_CALLS_PER_RUN = 1;
@@ -28725,7 +28820,7 @@ async function readState2(directory) {
28725
28820
  }
28726
28821
  }
28727
28822
  async function atomicWrite2(filePath, content) {
28728
- await mkdir14(path44.dirname(filePath), { recursive: true });
28823
+ await mkdir15(path44.dirname(filePath), { recursive: true });
28729
28824
  const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
28730
28825
  await writeFile11(tmp, content, "utf-8");
28731
28826
  await rename7(tmp, filePath);
@@ -29852,9 +29947,9 @@ var _internals41 = {
29852
29947
  loadPluginConfigWithMeta,
29853
29948
  loadCuratorDeps: async () => {
29854
29949
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
29855
- import("./schema-47xpcghn.js"),
29856
- import("./curator-ctasdmmq.js"),
29857
- import("./curator-llm-factory-y9xg7k6k.js")
29950
+ import("./schema-p74hnrfz.js"),
29951
+ import("./curator-ff53rwz5.js"),
29952
+ import("./curator-llm-factory-2mz7fgd1.js")
29858
29953
  ]);
29859
29954
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
29860
29955
  }
@@ -30759,7 +30854,7 @@ async function computeCurationDiagnostics(directory, entries) {
30759
30854
  let scanCompleted = false;
30760
30855
  let scanRemaining = 0;
30761
30856
  try {
30762
- const { getScanStatus } = await import("./scan-cursor-pnbpfjjc.js");
30857
+ const { getScanStatus } = await import("./scan-cursor-p54xsx41.js");
30763
30858
  const status = await getScanStatus(directory);
30764
30859
  scanGeneration = status.generation;
30765
30860
  scanCompleted = status.completed;
@@ -30769,10 +30864,10 @@ async function computeCurationDiagnostics(directory, entries) {
30769
30864
  try {
30770
30865
  const { isLinked: isLinked2 } = await import("./knowledge-link-fn5j3r4q.js");
30771
30866
  if (isLinked2(directory)) {
30772
- const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-47xpcghn.js");
30867
+ const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-p74hnrfz.js");
30773
30868
  let config;
30774
30869
  try {
30775
- const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-15h4dpsn.js");
30870
+ const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-cz9tc0h8.js");
30776
30871
  const loaded = loadPluginConfigWithMeta2(directory);
30777
30872
  config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
30778
30873
  } catch {
@@ -31990,7 +32085,7 @@ async function handleDoctorCommand(directory, args) {
31990
32085
  const result = runConfigDoctor(config, directory);
31991
32086
  let output;
31992
32087
  if (enableAutoFix && result.hasAutoFixableIssues) {
31993
- const { runConfigDoctorWithFixes } = await import("./config-doctor-t1r5qwxk.js");
32088
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-ajq3sts3.js");
31994
32089
  const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
31995
32090
  applyLossy: true
31996
32091
  });
@@ -32827,7 +32922,7 @@ async function handleEvidenceCommand(directory, args) {
32827
32922
  return formatTaskEvidenceMarkdown(evidenceData);
32828
32923
  }
32829
32924
  async function handleEvidenceSummaryCommand(directory) {
32830
- const { buildEvidenceSummary } = await import("./evidence-summary-service-7bmg5r8y.js");
32925
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-08zcq836.js");
32831
32926
  const artifact = await buildEvidenceSummary(directory);
32832
32927
  if (!artifact) {
32833
32928
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -34621,119 +34716,6 @@ import * as fs24 from "fs";
34621
34716
  import * as path59 from "path";
34622
34717
  import { extname as extname5 } from "path";
34623
34718
 
34624
- // src/lang/registry.ts
34625
- var languageDefinitions = [
34626
- {
34627
- id: "javascript",
34628
- extensions: [".js", ".jsx", ".mjs", ".cjs"],
34629
- commentNodes: ["comment", "line_comment", "block_comment"]
34630
- },
34631
- {
34632
- id: "typescript",
34633
- extensions: [".ts"],
34634
- commentNodes: ["comment", "line_comment", "block_comment"]
34635
- },
34636
- {
34637
- id: "python",
34638
- extensions: [".py"],
34639
- commentNodes: ["comment"]
34640
- },
34641
- {
34642
- id: "go",
34643
- extensions: [".go"],
34644
- commentNodes: ["comment"]
34645
- },
34646
- {
34647
- id: "rust",
34648
- extensions: [".rs"],
34649
- commentNodes: ["line_comment", "block_comment"]
34650
- },
34651
- {
34652
- id: "php",
34653
- extensions: [".php", ".phtml"],
34654
- commentNodes: ["comment"]
34655
- },
34656
- {
34657
- id: "java",
34658
- extensions: [".java"],
34659
- commentNodes: ["line_comment", "block_comment"]
34660
- },
34661
- {
34662
- id: "c",
34663
- extensions: [".c", ".h"],
34664
- commentNodes: ["comment"]
34665
- },
34666
- {
34667
- id: "cpp",
34668
- extensions: [".cpp", ".cxx", ".cc", ".hpp", ".hxx", ".hh"],
34669
- commentNodes: ["comment"]
34670
- },
34671
- {
34672
- id: "csharp",
34673
- extensions: [".cs"],
34674
- commentNodes: ["comment"]
34675
- },
34676
- {
34677
- id: "ruby",
34678
- extensions: [".rb"],
34679
- commentNodes: ["comment"]
34680
- },
34681
- {
34682
- id: "swift",
34683
- extensions: [".swift"],
34684
- commentNodes: ["comment", "multiline_comment"]
34685
- },
34686
- {
34687
- id: "kotlin",
34688
- extensions: [".kt", ".kts"],
34689
- commentNodes: ["line_comment", "multiline_comment"]
34690
- },
34691
- {
34692
- id: "dart",
34693
- extensions: [".dart"],
34694
- commentNodes: ["comment", "documentation_comment"]
34695
- },
34696
- {
34697
- id: "css",
34698
- extensions: [".css"],
34699
- commentNodes: ["comment"]
34700
- },
34701
- {
34702
- id: "bash",
34703
- extensions: [".sh", ".bash"],
34704
- commentNodes: ["comment"]
34705
- },
34706
- {
34707
- id: "powershell",
34708
- extensions: [".ps1", ".psm1"],
34709
- commentNodes: ["comment"]
34710
- },
34711
- {
34712
- id: "ini",
34713
- extensions: [".ini", ".cfg", ".conf"],
34714
- commentNodes: ["comment"]
34715
- },
34716
- {
34717
- id: "regex",
34718
- extensions: [".regex"],
34719
- commentNodes: []
34720
- },
34721
- {
34722
- id: "tsx",
34723
- extensions: [".tsx"],
34724
- commentNodes: ["comment"]
34725
- }
34726
- ];
34727
- var extensionMap = new Map;
34728
- for (const definition of languageDefinitions) {
34729
- for (const extension of definition.extensions) {
34730
- extensionMap.set(extension, definition);
34731
- }
34732
- }
34733
- function getLanguageForExtension(extension) {
34734
- return extensionMap.get(extension.toLowerCase());
34735
- }
34736
-
34737
34719
  // src/sast/rules/c.ts
34738
34720
  var cRules = [
34739
34721
  {
@@ -38206,7 +38188,7 @@ import { createHash as createHash13, createHmac, randomBytes as randomBytes2, ra
38206
38188
  import {
38207
38189
  chmod,
38208
38190
  copyFile as copyFile2,
38209
- mkdir as mkdir15,
38191
+ mkdir as mkdir16,
38210
38192
  readdir as readdir3,
38211
38193
  readFile as readFile18,
38212
38194
  realpath as realpath4,
@@ -39006,7 +38988,7 @@ var _internals54 = {
39006
38988
  readFile: readFile18,
39007
38989
  writeFile: writeFile12,
39008
38990
  copyFile: copyFile2,
39009
- mkdir: mkdir15,
38991
+ mkdir: mkdir16,
39010
38992
  stat: stat6,
39011
38993
  readdir: readdir3,
39012
38994
  resolveHiveDataDir,
@@ -39345,7 +39327,7 @@ init_schema();
39345
39327
  init_logger();
39346
39328
  import { randomUUID as randomUUID9 } from "crypto";
39347
39329
  import { existsSync as existsSync37, readFileSync as readFileSync29 } from "fs";
39348
- import { mkdir as mkdir16, readFile as readFile19, writeFile as writeFile13 } from "fs/promises";
39330
+ import { mkdir as mkdir17, readFile as readFile19, writeFile as writeFile13 } from "fs/promises";
39349
39331
  import * as os8 from "os";
39350
39332
  import * as path65 from "path";
39351
39333
  init_knowledge_types();
@@ -39412,7 +39394,7 @@ var _internals56 = {
39412
39394
  existsSync: existsSync37,
39413
39395
  readFileSync: readFileSync29,
39414
39396
  readFile: readFile19,
39415
- mkdir: mkdir16,
39397
+ mkdir: mkdir17,
39416
39398
  writeFile: writeFile13
39417
39399
  };
39418
39400
  async function migrateContextToKnowledge(directory, config) {
@@ -40226,14 +40208,14 @@ var _internals57 = {
40226
40208
  };
40227
40209
 
40228
40210
  // src/commands/link.ts
40229
- import { mkdir as mkdir18, writeFile as writeFile14 } from "fs/promises";
40211
+ import { mkdir as mkdir19, writeFile as writeFile14 } from "fs/promises";
40230
40212
  import * as path67 from "path";
40231
40213
  init_schema();
40232
40214
 
40233
40215
  // src/knowledge/family-migration.ts
40234
40216
  var import_proper_lockfile6 = __toESM(require_proper_lockfile(), 1);
40235
40217
  import { existsSync as existsSync38, readFileSync as readFileSync30 } from "fs";
40236
- import { mkdir as mkdir17 } from "fs/promises";
40218
+ import { mkdir as mkdir18 } from "fs/promises";
40237
40219
  import * as path66 from "path";
40238
40220
 
40239
40221
  // src/knowledge/family-manifest.ts
@@ -40516,7 +40498,7 @@ async function snapshotSourceFamily(storeDir) {
40516
40498
  const snapshot = {};
40517
40499
  let release = null;
40518
40500
  try {
40519
- await mkdir17(storeDir, { recursive: true });
40501
+ await mkdir18(storeDir, { recursive: true });
40520
40502
  } catch {}
40521
40503
  try {
40522
40504
  release = await import_proper_lockfile6.default.lock(storeDir, {
@@ -40535,7 +40517,7 @@ async function snapshotSourceFamily(storeDir) {
40535
40517
  return snapshot;
40536
40518
  }
40537
40519
  async function migrateKnowledgeFamily(destinationDir, sourceDir) {
40538
- await mkdir17(destinationDir, { recursive: true });
40520
+ await mkdir18(destinationDir, { recursive: true });
40539
40521
  let destRelease = null;
40540
40522
  try {
40541
40523
  destRelease = await import_proper_lockfile6.default.lock(destinationDir, {
@@ -40685,7 +40667,7 @@ ${formatStatus(directory)}`;
40685
40667
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
40686
40668
  const config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
40687
40669
  const fingerprint = cohortConfigFingerprint(buildConfigFingerprintInput(config));
40688
- await mkdir18(linkDir, { recursive: true });
40670
+ await mkdir19(linkDir, { recursive: true });
40689
40671
  await writeFile14(path67.join(linkDir, "cohort-config.json"), JSON.stringify({ fingerprint, updated_at: new Date().toISOString() }, null, 2), "utf-8");
40690
40672
  } catch {}
40691
40673
  const relinkNote = existing ? `
@@ -41345,7 +41327,7 @@ function parseJsonObject(candidate) {
41345
41327
  // src/memory/injector.ts
41346
41328
  init_schema();
41347
41329
  // src/memory/consolidation-log.ts
41348
- import { appendFile as appendFile8, mkdir as mkdir19, readFile as readFile21 } from "fs/promises";
41330
+ import { appendFile as appendFile9, mkdir as mkdir20, readFile as readFile21 } from "fs/promises";
41349
41331
  import * as path69 from "path";
41350
41332
  var LOG_RELATIVE_PATH = path69.join("memory", "consolidation-log.jsonl");
41351
41333
  var LOG_BASENAME = "consolidation-log.jsonl";
@@ -41922,14 +41904,14 @@ function truncate(value, maxLength) {
41922
41904
  }
41923
41905
 
41924
41906
  // src/commands/memory-link.ts
41925
- import { mkdir as mkdir21, writeFile as writeFile15 } from "fs/promises";
41907
+ import { mkdir as mkdir22, writeFile as writeFile15 } from "fs/promises";
41926
41908
  import * as path72 from "path";
41927
41909
  init_schema();
41928
41910
 
41929
41911
  // src/memory/memory-family-migration.ts
41930
41912
  var import_proper_lockfile7 = __toESM(require_proper_lockfile(), 1);
41931
41913
  import { copyFileSync as copyFileSync4, existsSync as existsSync40, readFileSync as readFileSync31, unlinkSync as unlinkSync11 } from "fs";
41932
- import { mkdir as mkdir20, rename as rename8 } from "fs/promises";
41914
+ import { mkdir as mkdir21, rename as rename8 } from "fs/promises";
41933
41915
  import * as path71 from "path";
41934
41916
  init_logger();
41935
41917
 
@@ -42149,7 +42131,7 @@ async function countRowsSafe(dbPath) {
42149
42131
  async function migrateMemoryFamily(destRoot, sourceRoot) {
42150
42132
  const destStoragePath = rootStoragePath(destRoot);
42151
42133
  const sourceStoragePath = rootStoragePath(sourceRoot);
42152
- await mkdir20(destStoragePath, { recursive: true });
42134
+ await mkdir21(destStoragePath, { recursive: true });
42153
42135
  let destRelease = null;
42154
42136
  try {
42155
42137
  destRelease = await import_proper_lockfile7.default.lock(destStoragePath, {
@@ -42196,7 +42178,7 @@ async function migrateMemoryFamily(destRoot, sourceRoot) {
42196
42178
  }
42197
42179
  if (isCohortRoot(sourceRoot)) {
42198
42180
  const backupDir = path71.join(destStoragePath, "backups");
42199
- await mkdir20(backupDir, { recursive: true });
42181
+ await mkdir21(backupDir, { recursive: true });
42200
42182
  const stamp = new Date().toISOString().replace(/[:.]/g, "-");
42201
42183
  const sourceDbPath = path71.join(sourceStoragePath, "memory.db");
42202
42184
  if (existsSync40(sourceDbPath)) {
@@ -42332,7 +42314,7 @@ ${formatStatus2(directory)}`;
42332
42314
  return `\u274C Failed to migrate the memory family into the cohort store: ${error2 instanceof Error ? error2.message : String(error2)}`;
42333
42315
  }
42334
42316
  try {
42335
- await mkdir21(cohortRoot.cohortRoot, { recursive: true });
42317
+ await mkdir22(cohortRoot.cohortRoot, { recursive: true });
42336
42318
  const fingerprintInput = buildMemoryCohortFingerprintInput(memoryConfig);
42337
42319
  const fingerprint = computeMemoryCohortFingerprint(fingerprintInput);
42338
42320
  await writeFile15(path72.join(cohortRoot.cohortRoot, "memory-cohort-config.json"), JSON.stringify({
@@ -46231,7 +46213,7 @@ var DISPATCH_FRAMEWORK_MAP = {
46231
46213
  };
46232
46214
  async function detectTestFrameworkViaDispatch(cwd) {
46233
46215
  try {
46234
- const { pickBackend } = await import("./dispatch-rd10kdk1.js");
46216
+ const { pickBackend } = await import("./dispatch-1y1rnv1h.js");
46235
46217
  const backend = await pickBackend(cwd);
46236
46218
  if (!backend?.selectTestFramework)
46237
46219
  return "none";
@@ -46247,7 +46229,7 @@ async function buildTestCommandViaDispatch(framework, scope, files, coverage, ba
46247
46229
  if (framework === "none")
46248
46230
  return null;
46249
46231
  try {
46250
- const { pickBackend } = await import("./dispatch-rd10kdk1.js");
46232
+ const { pickBackend } = await import("./dispatch-1y1rnv1h.js");
46251
46233
  const backend = await pickBackend(baseDir);
46252
46234
  if (backend?.buildTestCommand) {
46253
46235
  const cmd = backend.buildTestCommand(framework, files, baseDir, {
@@ -46269,7 +46251,7 @@ async function parseTestOutputViaDispatch(framework, output, baseDir) {
46269
46251
  if (framework === "none")
46270
46252
  return null;
46271
46253
  try {
46272
- const { pickBackend } = await import("./dispatch-rd10kdk1.js");
46254
+ const { pickBackend } = await import("./dispatch-1y1rnv1h.js");
46273
46255
  const backend = await pickBackend(baseDir);
46274
46256
  if (!backend?.parseTestOutput)
46275
46257
  return null;
@@ -46510,7 +46492,7 @@ function getTestFilesFromConvention(sourceFiles, workingDir = process.cwd()) {
46510
46492
  const absoluteFile = resolveWorkspacePath(file, workingDir);
46511
46493
  const relativeFile = path77.relative(workingDir, absoluteFile);
46512
46494
  const basename17 = path77.basename(absoluteFile);
46513
- const dirname32 = path77.dirname(absoluteFile);
46495
+ const dirname33 = path77.dirname(absoluteFile);
46514
46496
  const preferRelativeOutput = !path77.isAbsolute(file);
46515
46497
  if (isConventionTestFilePath(relativeFile) || isConventionTestFilePath(file)) {
46516
46498
  dedupePush(testFiles, toWorkspaceOutputPath(absoluteFile, workingDir, preferRelativeOutput));
@@ -46526,7 +46508,7 @@ function getTestFilesFromConvention(sourceFiles, workingDir = process.cwd()) {
46526
46508
  const colocatedCandidates = [
46527
46509
  ...genericTestNames,
46528
46510
  ...languageSpecificTestNames
46529
- ].map((candidateName) => path77.join(dirname32, candidateName));
46511
+ ].map((candidateName) => path77.join(dirname33, candidateName));
46530
46512
  const testDirectoryNames = [
46531
46513
  basename17,
46532
46514
  ...genericTestNames,
@@ -46535,7 +46517,7 @@ function getTestFilesFromConvention(sourceFiles, workingDir = process.cwd()) {
46535
46517
  const repoLevelDirectories = getRepoLevelCandidateDirectories(workingDir, relativeFile, ext);
46536
46518
  const possibleTestFiles = [
46537
46519
  ...colocatedCandidates,
46538
- ...TEST_DIRECTORY_NAMES.flatMap((dirName) => testDirectoryNames.map((candidateName) => path77.join(dirname32, dirName, candidateName))),
46520
+ ...TEST_DIRECTORY_NAMES.flatMap((dirName) => testDirectoryNames.map((candidateName) => path77.join(dirname33, dirName, candidateName))),
46539
46521
  ...repoLevelDirectories.flatMap((candidateDir) => testDirectoryNames.map((candidateName) => path77.join(candidateDir, candidateName)))
46540
46522
  ];
46541
46523
  for (const testFile of possibleTestFiles) {
@@ -55612,7 +55594,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
55612
55594
  if (!input.dispatcher) {
55613
55595
  throw new Error("no evaluation dispatcher available (cannot run validation)");
55614
55596
  }
55615
- const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-hrg7h2h4.js");
55597
+ const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-pde6b5sx.js");
55616
55598
  const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
55617
55599
  const result = await _internals84.evaluateCandidateV1({
55618
55600
  projectRoot: input.directory,
@@ -57444,7 +57426,7 @@ function buildDetailedHelp(commandName, entry) {
57444
57426
  async function handleHelpCommand(ctx) {
57445
57427
  const targetCommand = ctx.args.join(" ");
57446
57428
  if (!targetCommand) {
57447
- const { buildHelpText } = await import("./index-1g473508.js");
57429
+ const { buildHelpText } = await import("./index-wnj1d1es.js");
57448
57430
  return buildHelpText();
57449
57431
  }
57450
57432
  const tokens = targetCommand.split(/\s+/);
@@ -57453,7 +57435,7 @@ async function handleHelpCommand(ctx) {
57453
57435
  return _internals87.buildDetailedHelp(resolved.key, resolved.entry);
57454
57436
  }
57455
57437
  const similar = _internals87.findSimilarCommands(targetCommand);
57456
- const { buildHelpText: fullHelp } = await import("./index-1g473508.js");
57438
+ const { buildHelpText: fullHelp } = await import("./index-wnj1d1es.js");
57457
57439
  if (similar.length > 0) {
57458
57440
  return `Command '/swarm ${targetCommand}' not found.
57459
57441
 
@@ -57630,7 +57612,7 @@ var COMMAND_REGISTRY = {
57630
57612
  },
57631
57613
  "guardrail explain": {
57632
57614
  handler: async (ctx) => {
57633
- const { handleGuardrailExplain } = await import("./guardrail-explain-6x9psbwz.js");
57615
+ const { handleGuardrailExplain } = await import("./guardrail-explain-cm5je07b.js");
57634
57616
  return handleGuardrailExplain(ctx.directory, ctx.args);
57635
57617
  },
57636
57618
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -57640,7 +57622,7 @@ var COMMAND_REGISTRY = {
57640
57622
  },
57641
57623
  "guardrail-explain": {
57642
57624
  handler: async (ctx) => {
57643
- const { handleGuardrailExplain } = await import("./guardrail-explain-6x9psbwz.js");
57625
+ const { handleGuardrailExplain } = await import("./guardrail-explain-cm5je07b.js");
57644
57626
  return handleGuardrailExplain(ctx.directory, ctx.args);
57645
57627
  },
57646
57628
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -57650,7 +57632,7 @@ var COMMAND_REGISTRY = {
57650
57632
  },
57651
57633
  "guardrail-log": {
57652
57634
  handler: async (ctx) => {
57653
- const { handleGuardrailLog } = await import("./guardrail-log-pma4m8vr.js");
57635
+ const { handleGuardrailLog } = await import("./guardrail-log-jf4430p5.js");
57654
57636
  return handleGuardrailLog(ctx.directory, ctx.args);
57655
57637
  },
57656
57638
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -58080,7 +58062,7 @@ Subcommands:
58080
58062
  handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleLoopCommand),
58081
58063
  description: "Enter architect MODE: LOOP \u2014 compound-engineering loop: brainstorm \u2192 plan \u2192 build \u2192 review \u2192 improve, iterating until done [objective]",
58082
58064
  args: "<objective> [--max-cycles 1..5] [--autonomy checkpoint|auto] [--depth standard|exhaustive] [--resume]",
58083
- details: `Triggers the architect to run the compound-engineering loop defined in ${BUNDLED_PROJECT_SKILL_ROOT}/loop/SKILL.md: BRAINSTORM (requirements) \u2192 PLAN (+ critic gate) \u2192 BUILD (execute) \u2192 REVIEW (independent reviewer + critic on the diff, report-only) \u2192 IMPROVE (phase-wrap retrospective + compounding learning capture), then evaluate stop conditions and loop for another improvement cycle if the objective is unmet and budget remains. Generator and reviewer/critic run in separate contexts; failing assertions must be fixed at the root cause, never weakened, mocked, or skipped. Defense-in-depth stop conditions: objective met, --max-cycles budget (default 3), no-progress/plateau, oscillation, unrecoverable error, or explicit user stop. --autonomy auto (default) runs unattended with hard stops still enforced; --autonomy checkpoint pauses at phase gates for user approval. --depth exhaustive widens exploration. --resume continues an existing loop run from durable .swarm/loop/ state. Distinct from full-auto (autonomous cross-phase oversight) and turbo (parallel lanes within a phase): loop is a user-initiated, gated, compounding workflow.`,
58065
+ details: `Triggers the architect to run the compound-engineering loop defined in ${BUNDLED_PROJECT_SKILL_ROOT}/loop/SKILL.md: BRAINSTORM (requirements) \u2192 PLAN (+ critic gate) \u2192 BUILD (execute) \u2192 REVIEW (independent reviewer + critic on the diff, report-only) \u2192 IMPROVE (phase-wrap retrospective + compounding learning capture), then evaluate stop conditions and loop for another improvement cycle if the objective is unmet and budget remains. Generator and reviewer/critic run in separate contexts; failing assertions must be fixed at the root cause, never weakened, mocked, or skipped. Defense-in-depth stop conditions: objective met, --max-cycles budget (default 3), no-progress/plateau, oscillation, unrecoverable error, or explicit user stop. --autonomy auto (default) runs unattended with hard stops still enforced; --autonomy checkpoint pauses at phase gates for user approval. --depth exhaustive widens exploration. --resume continues an existing loop run from durable .swarm/loop/ state. Distinct from full-auto (a critic gate that intercepts phase completions and high-risk actions for review \u2014 it never plans, delegates, or executes; the architect retains all delegation duty) and turbo (parallel lanes within a phase): loop is a user-initiated, gated, compounding workflow.`,
58084
58066
  category: "agent",
58085
58067
  toolPolicy: "none"
58086
58068
  },
@@ -58361,7 +58343,7 @@ Subcommands:
58361
58343
  handler: (ctx) => handleFullAutoCommand(ctx.directory, ctx.args, ctx.sessionID),
58362
58344
  description: "Toggle Full-Auto Mode for the active session [on [mode]|off|status]",
58363
58345
  args: "on [assisted|supervised|strict], off, status",
58364
- details: 'First-class toggle for Full-Auto Mode \u2014 autonomous execution with the critic reviewing escalations on your behalf. No config-level enablement is required: "on" activates immediately (unless full_auto.locked is true in config), "off" disarms the run and returns the session to normal interactive operation, "status" reports the durable run state. ' + 'An optional mode after "on" overrides full_auto.mode for this run: assisted (critic consulted only on policy escalations), supervised (default \u2014 risky/high-impact actions reviewed by the critic), strict (ALL plan mutations reviewed by the critic). ' + "While active, the critic answers architect questions and reviews phase boundaries, delegations, and risky actions on your behalf; only ESCALATE_TO_HUMAN verdicts halt the run for your input. The run state is durable (.swarm/full-auto-state.json) and survives restarts; toggle with no argument flips the current state.",
58346
+ details: 'First-class toggle for Full-Auto Mode \u2014 a critic gate reviewing escalations on your behalf (the architect still plans and delegates; full-auto never executes tasks itself). No config-level enablement is required: "on" activates immediately (unless full_auto.locked is true in config), "off" disarms the run and returns the session to normal interactive operation, "status" reports the durable run state. ' + 'An optional mode after "on" overrides full_auto.mode for this run: assisted (critic consulted only on policy escalations), supervised (default \u2014 risky/high-impact actions reviewed by the critic), strict (ALL plan mutations reviewed by the critic). ' + "While active, the critic answers architect questions and reviews phase boundaries, delegations, and risky actions on your behalf; only ESCALATE_TO_HUMAN verdicts halt the run for your input. The run state is durable (.swarm/full-auto-state.json) and survives restarts; toggle with no argument flips the current state.",
58365
58347
  category: "utility",
58366
58348
  toolPolicy: "none"
58367
58349
  },
@@ -59473,7 +59455,7 @@ HARD CONSTRAINTS (apply regardless of skill load success):
59473
59455
  ### MODE: LOOP
59474
59456
  Activates when: architect receives \`[MODE: LOOP max_cycles=N autonomy=checkpoint|auto depth=standard|exhaustive resume=true|false] <objective>\` signal from the loop command handler.
59475
59457
 
59476
- Purpose: Run the compound-engineering loop \u2014 BRAINSTORM \u2192 PLAN \u2192 BUILD \u2192 REVIEW \u2192 IMPROVE \u2014 iterating until the objective is met or a stop condition fires. Each cycle reuses the existing mode skills (brainstorm, plan, critic-gate, execute, phase-wrap) and then captures learnings so the next cycle is cheaper (compounding). This is a real implementation workflow: it DOES delegate to coder, DOES declare scope, and DOES mutate source code through the normal EXECUTE path. It is distinct from full-auto (autonomous cross-phase oversight) and turbo (parallel lanes within a phase): LOOP is a user-initiated, gated, compounding workflow.
59458
+ Purpose: Run the compound-engineering loop \u2014 BRAINSTORM \u2192 PLAN \u2192 BUILD \u2192 REVIEW \u2192 IMPROVE \u2014 iterating until the objective is met or a stop condition fires. Each cycle reuses the existing mode skills (brainstorm, plan, critic-gate, execute, phase-wrap) and then captures learnings so the next cycle is cheaper (compounding). This is a real implementation workflow: it DOES delegate to coder, DOES declare scope, and DOES mutate source code through the normal EXECUTE path. It is distinct from full-auto (a critic gate that intercepts phase completions and high-risk actions for review \u2014 full-auto never plans, delegates, or executes; the architect retains ALL delegation duty in every mode) and turbo (parallel lanes within a phase): LOOP is a user-initiated, gated, compounding workflow.
59477
59459
 
59478
59460
  ACTION: Load skill ${bundledProjectSkillFileReference("loop")} immediately and follow its protocol. Parse the header to get \`max_cycles\`, \`autonomy\`, \`depth\`, and \`resume\`.
59479
59461
 
@@ -59733,11 +59715,11 @@ HARD CONSTRAINTS:
59733
59715
  - On NO: call \`swarm_command({ command: "auto-proceed", args: ["off"] })\` \u2014 this sets override=false and nudge-done=true
59734
59716
  - If auto-proceed is OFF AND nudge flag is true: just ask "Ready for Phase [N+1]?" as before.
59735
59717
  - SC-001: auto-proceed only skips the phase-transition confirmation. The architect MUST still stop for blocked tasks, user questions, clarification needs, and any decision requiring human input. This behavior is NOT affected by the auto_proceed setting.
59736
- - Full-auto mode (critic oversight) is independent \u2014 its existing "Do NOT ask Ready for Phase N+1?" override continues to work. auto_proceed has no additional effect under full-auto.
59718
+ - Full-auto mode (critic oversight) is independent \u2014 it only intercepts phase completions and escalations for critic review; it does NOT delegate tasks or run phases for you. When told to proceed under full-auto (e.g. "Proceed with phase 4"), you MUST immediately dispatch that phase's tasks to coder yourself, exactly as in every other mode. Its existing "Do NOT ask Ready for Phase N+1?" override continues to work. auto_proceed has no additional effect under full-auto.
59737
59719
 
59738
59720
  RECOVERY: Read .swarm/issue-reference.json for retrospective context and commit-pr Closes #N population.
59739
59721
 
59740
- > **NOTE**: The \`critic_oversight\` agent (\`AUTONOMOUS_OVERSIGHT_PROMPT\`) is dispatched only via full-auto mode (\`src/full-auto/oversight.ts\`). It has no architect MODE dispatch path \u2014 it is **NOT** reachable from \`MODE: CRITIC-GATE\`, \`MODE: EXECUTE\`, or \`MODE: PHASE-WRAP\`. This is intentional: it serves as the sole quality gate in autonomous oversight mode.
59722
+ > **NOTE**: The \`critic_oversight\` agent (\`AUTONOMOUS_OVERSIGHT_PROMPT\`) is dispatched only via full-auto mode (\`src/full-auto/oversight.ts\`). It has no architect MODE dispatch path \u2014 it is **NOT** reachable from \`MODE: CRITIC-GATE\`, \`MODE: EXECUTE\`, or \`MODE: PHASE-WRAP\`. This is intentional: it serves as the sole quality gate in full-auto mode \u2014 it gates quality; it never replaces architect delegation.
59741
59723
 
59742
59724
  ## FILES
59743
59725
 
@@ -60912,17 +60894,21 @@ If no DIRECTIVES TO VERIFY block was provided, output "DIRECTIVE_COMPLIANCE: non
60912
60894
  FIXES: required changes if rejected
60913
60895
  Use INFO only inside ISSUES for non-blocking suggestions. RISK reflects the highest blocking severity, so it never uses INFO.
60914
60896
 
60915
- ## MULTI-TASK COVERAGE (FR-007)
60916
- When you are asked to review multiple tasks in a single dispatch (set-dispatch), emit one structured verdict line PER TASK at the END of your output (after all other output fields). This enables per-task attribution in the gate tracker:
60897
+ ## STRUCTURED VERDICT LINE (MANDATORY)
60898
+ You MUST emit exactly one structured verdict line PER TASK at the END of your output (after all other output fields). This is required for both single-task and multi-task (set-dispatch) reviews. The gate tracker uses this line for per-task attribution \u2014 omitting it blocks task completion.
60917
60899
 
60918
60900
  [REVIEWED] | task-<taskId> | APPROVED | <brief summary>
60919
60901
  [REVIEWED] | task-<taskId> | REJECTED | <brief summary>
60902
+ [REVIEWED] | task-<taskId> | CONCERNS | <brief summary>
60903
+
60904
+ Example (single task):
60905
+ [REVIEWED] | task-2.1 | APPROVED | No issues found in src/foo.ts
60920
60906
 
60921
- Example:
60907
+ Example (multi-task set-dispatch):
60922
60908
  [REVIEWED] | task-2.1 | APPROVED | No issues found in src/foo.ts
60923
60909
  [REVIEWED] | task-2.2 | REJECTED | Missing null check in bar() at line 42
60924
60910
 
60925
- If covering a single task only, you do not need to emit the structured verdict line.
60911
+ Never omit this line. The task ID must match the TASK field exactly.
60926
60912
 
60927
60913
  ## OUTPUT ORDER FOR SKILL COMPLIANCE (when applicable)
60928
60914
  When SKILLS_USED_BY_CODER is provided, output TASK: immediately followed by SKILL_COMPLIANCE to ensure proper attribution:
@@ -64564,7 +64550,7 @@ function getDisplayBudget() {
64564
64550
  async function rehydratePrSubscriptions(sessionID, directory) {
64565
64551
  const map = new Map;
64566
64552
  try {
64567
- const { listActive: listActive2 } = await import("./pr-subscriptions-b63t252j.js");
64553
+ const { listActive: listActive2 } = await import("./pr-subscriptions-jyav582d.js");
64568
64554
  const records = await listActive2(directory);
64569
64555
  for (const record of records) {
64570
64556
  if (record.sessionID !== sessionID)
@@ -64837,7 +64823,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
64837
64823
  return extracted === expectedSessionId;
64838
64824
  }
64839
64825
  async function inspectStandardWorktreeCollisionOwnership(identity) {
64840
- const collisionOwnership = await import("./worktree-collision-ownership-ymdxetnn.js");
64826
+ const collisionOwnership = await import("./worktree-collision-ownership-bfz3drxm.js");
64841
64827
  return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
64842
64828
  }
64843
64829
  async function precreateStandardWorktreeSession(args) {
@@ -64985,7 +64971,7 @@ async function precreateStandardWorktreeSession(args) {
64985
64971
  const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, provisionResult.worktreePath);
64986
64972
  if (laneProfile) {
64987
64973
  try {
64988
- const { writeLaneProfileToDiskReal } = await import("./core-e30p4vz9.js");
64974
+ const { writeLaneProfileToDiskReal } = await import("./core-0jn7sk7t.js");
64989
64975
  await writeLaneProfileToDiskReal(provisionResult.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
64990
64976
  } catch {}
64991
64977
  }
@@ -65484,7 +65470,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
65484
65470
  }
65485
65471
  clearWorktreeMergeStatus(statusKey);
65486
65472
  try {
65487
- const { removeLaneProfileFromDiskReal } = await import("./core-e30p4vz9.js");
65473
+ const { removeLaneProfileFromDiskReal } = await import("./core-0jn7sk7t.js");
65488
65474
  await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
65489
65475
  } catch {}
65490
65476
  const state = serializationStateBySessionID.get(dispatch.parentSessionID);