opencode-swarm 7.179.1 → 7.180.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 (115) hide show
  1. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  2. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  3. package/dist/agents/architect.d.ts +67 -0
  4. package/dist/agents/council-prompts.d.ts +3 -3
  5. package/dist/agents/index.d.ts +1 -1
  6. package/dist/background/pr-event-subscribers.d.ts +2 -0
  7. package/dist/background/pr-feedback-event-queue.d.ts +7 -0
  8. package/dist/background/pr-feedback-loop.d.ts +162 -0
  9. package/dist/cli/{coder-settlement-f1nmezzv.js → coder-settlement-b57917a3.js} +14 -14
  10. package/dist/cli/{config-doctor-ena2803f.js → config-doctor-ebat06eq.js} +2 -2
  11. package/dist/cli/{core-fcfzme3m.js → core-8k41qh0d.js} +4 -5
  12. package/dist/cli/{curation-policy-c7mdsf7m.js → curation-policy-m3x9mkj9.js} +7 -6
  13. package/dist/cli/{curator-q9s5q9v4.js → curator-8yb3qkxs.js} +45 -43
  14. package/dist/cli/{curator-drift-d93pwt8h.js → curator-drift-3av9hffm.js} +22 -12
  15. package/dist/cli/curator-llm-factory-htgqafq0.js +74 -0
  16. package/dist/cli/{evidence-summary-service-wtj8mkm6.js → evidence-summary-service-s258ea5t.js} +23 -21
  17. package/dist/cli/{gate-evidence-h83yb8nd.js → gate-evidence-fqxpf3xz.js} +9 -9
  18. package/dist/cli/guardrail-explain-r0qxa4zy.js +75 -0
  19. package/dist/cli/{guardrail-log-zf1htf1d.js → guardrail-log-j2wdmvmy.js} +7 -7
  20. package/dist/cli/{guardrail-reset-f2p198j3.js → guardrail-reset-wb2eqbvf.js} +45 -43
  21. package/dist/cli/hive-promoter-kxpc3r17.js +89 -0
  22. package/dist/cli/{index-wrt875kh.js → index-0725jpp7.js} +1 -1
  23. package/dist/cli/{index-34bwqcea.js → index-12ewkms0.js} +1 -1
  24. package/dist/cli/{index-epfjc1c1.js → index-2q5m4m2r.js} +11 -11
  25. package/dist/cli/{index-h59vsbch.js → index-38cfx8g8.js} +2 -2
  26. package/dist/cli/{index-xy7k7f3k.js → index-3bbjpbmn.js} +2 -2
  27. package/dist/cli/{index-vp9pn7sv.js → index-3zvp7t5d.js} +5 -5
  28. package/dist/cli/{index-dz12bshh.js → index-50v672wd.js} +8 -8
  29. package/dist/cli/{index-yfpswnjt.js → index-516j9vsk.js} +4 -4
  30. package/dist/cli/{index-w4c2repz.js → index-600aqfvm.js} +47 -43
  31. package/dist/cli/{index-0h3cr7pn.js → index-6gcxgx84.js} +1 -1
  32. package/dist/cli/{index-qt0793qm.js → index-6mwha20t.js} +3 -3
  33. package/dist/cli/{index-93nx95me.js → index-855qxtdm.js} +8 -7
  34. package/dist/cli/{index-cvg402ha.js → index-91dhg3wr.js} +2 -2
  35. package/dist/cli/{index-3pzwsesm.js → index-92m05mew.js} +2 -2
  36. package/dist/cli/{index-ne9zamcs.js → index-989v83pb.js} +1 -1
  37. package/dist/cli/{index-9fb01jk5.js → index-as4xaams.js} +1 -1
  38. package/dist/cli/{index-2b0ktpbf.js → index-bdpgfep1.js} +5 -5
  39. package/dist/cli/{index-q375xdcw.js → index-bhmrgbyv.js} +9 -1
  40. package/dist/cli/{index-nzekzzs2.js → index-bv4b8tpa.js} +5 -5
  41. package/dist/cli/{index-rb9jmj30.js → index-cj64vp08.js} +7 -7
  42. package/dist/cli/{index-549wxbe1.js → index-cjapb4hy.js} +1 -1
  43. package/dist/cli/{index-5d224akk.js → index-dzm5nfh7.js} +4 -4
  44. package/dist/cli/{index-f2v90gfc.js → index-ea9fk6v0.js} +25 -166
  45. package/dist/cli/index-ejhxgyvm.js +147 -0
  46. package/dist/cli/{index-n1tcj1q7.js → index-g062wnw1.js} +187 -47
  47. package/dist/cli/{index-s4bkey0q.js → index-gc6h1fmf.js} +4 -4
  48. package/dist/cli/{index-pn023bf9.js → index-gw5egd8j.js} +49 -47
  49. package/dist/cli/index-gx2vp8gx.js +100 -0
  50. package/dist/cli/{index-yp25bc9n.js → index-gy3tcmk4.js} +7 -7
  51. package/dist/cli/{index-n2wjrgcs.js → index-k5vwnnym.js} +7 -9
  52. package/dist/cli/{index-ajm7ebyd.js → index-k6f0nryj.js} +2 -2
  53. package/dist/cli/{index-zbhvr9st.js → index-n5carmk0.js} +8 -10
  54. package/dist/cli/{index-h4nh6s8b.js → index-nhxykfyy.js} +1 -1
  55. package/dist/cli/{index-pskba939.js → index-rejpbgxp.js} +1 -1
  56. package/dist/cli/{index-9s1xzvnn.js → index-rp4akjrm.js} +13 -3
  57. package/dist/cli/{index-g6nyk713.js → index-s0zgz4p1.js} +1 -1
  58. package/dist/cli/{index-aqpwm350.js → index-tnhk72rs.js} +3 -3
  59. package/dist/cli/{index-sj29n50e.js → index-v0par978.js} +7 -7
  60. package/dist/cli/index-v7fx8q3z.js +339 -0
  61. package/dist/cli/{index-a11ztzs5.js → index-vmthakz0.js} +1 -1
  62. package/dist/cli/{index-b567t0cr.js → index-wx3wz7ya.js} +10 -8
  63. package/dist/cli/{index-y98fvmb8.js → index-xd0e4amf.js} +33 -18
  64. package/dist/cli/{index-m1w40kfw.js → index-xj5z92qz.js} +4 -103
  65. package/dist/cli/{index-6r92fw88.js → index-y30y1rkg.js} +9 -9
  66. package/dist/cli/{index-pfg3jwe9.js → index-yf7tdhpz.js} +3 -3
  67. package/dist/cli/{index-y94vwx2q.js → index-z2xf153n.js} +13 -15
  68. package/dist/cli/{index-ky262b73.js → index-z2zrcecq.js} +1721 -902
  69. package/dist/cli/{index-zz7gzw57.js → index-zxdawwc7.js} +88 -4
  70. package/dist/cli/index.js +46 -44
  71. package/dist/cli/{knowledge-escalator-z6tkgrjq.js → knowledge-escalator-n30h6ran.js} +17 -16
  72. package/dist/cli/{knowledge-events-2bgefatz.js → knowledge-events-k2qqase2.js} +15 -14
  73. package/dist/cli/{knowledge-link-gfz47ves.js → knowledge-link-s2qs178z.js} +6 -5
  74. package/dist/cli/{knowledge-store-1fphg9sa.js → knowledge-store-zy226v5a.js} +7 -6
  75. package/dist/cli/{knowledge-validator-723h2vck.js → knowledge-validator-qgyxdpc9.js} +9 -8
  76. package/dist/cli/{mcp-xyswgya5.js → mcp-pj7acze3.js} +1 -1
  77. package/dist/cli/{pending-delegations-5zm19yvv.js → pending-delegations-sgnnyw55.js} +14 -13
  78. package/dist/cli/{pr-subscriptions-5hm6hzv6.js → pr-subscriptions-7fb7xm3q.js} +14 -13
  79. package/dist/cli/{pr-workflow-gate-48rzb2bh.js → pr-workflow-gate-5dqcrkz6.js} +47 -43
  80. package/dist/cli/{runner-16b691ba.js → runner-p9hstpxn.js} +7 -6
  81. package/dist/cli/{scan-cursor-m28tddrg.js → scan-cursor-jc7wwb7e.js} +9 -9
  82. package/dist/cli/{schema-jt9axyj6.js → schema-5k68crjb.js} +3 -1
  83. package/dist/cli/{scope-persistence-d0358pw7.js → scope-persistence-xeg4khwk.js} +19 -18
  84. package/dist/cli/{server-d5jxcbxz.js → server-ej6tzd7t.js} +53 -51
  85. package/dist/cli/{skill-generator-qanka67x.js → skill-generator-nspt9b3n.js} +19 -18
  86. package/dist/cli/{snapshot-coordination-init-mhrq11p8.js → snapshot-coordination-init-3rs3zpaa.js} +45 -43
  87. package/dist/cli/speckit-checkoff-dqf636ya.js +31 -0
  88. package/dist/cli/{telemetry-qxav5cdk.js → telemetry-zhcgfe70.js} +1 -1
  89. package/dist/cli/{workspace-snapshot-rfnn80dg.js → workspace-snapshot-4m2ex1ey.js} +4 -5
  90. package/dist/cli/{worktree-collision-ownership-ygdbpexh.js → worktree-collision-ownership-rbzgbvj4.js} +17 -17
  91. package/dist/cli/{worktree-isolation-4855f2az.js → worktree-isolation-6zpnzr70.js} +45 -43
  92. package/dist/commands/pr-feedback-loop.d.ts +1 -0
  93. package/dist/commands/registry.d.ts +10 -2
  94. package/dist/config/schema.d.ts +27 -0
  95. package/dist/council/disagreement-detector.d.ts +23 -1
  96. package/dist/council/general-council-service.d.ts +40 -3
  97. package/dist/failures/invocation-failure.d.ts +11 -0
  98. package/dist/hooks/delegation-tracker.d.ts +6 -1
  99. package/dist/hooks/pr-workflow-gate.d.ts +1 -1
  100. package/dist/hooks/system-enhancer.d.ts +4 -2
  101. package/dist/hooks/system-render-boundary.d.ts +68 -0
  102. package/dist/index.js +634 -606
  103. package/dist/sdd/effective-spec.d.ts +35 -22
  104. package/dist/sdd/speckit-checkoff.d.ts +113 -0
  105. package/dist/session/hydration-ownership.d.ts +83 -0
  106. package/dist/session/snapshot-coordination-init.d.ts +2 -1
  107. package/dist/session/snapshot-reader.d.ts +25 -7
  108. package/dist/state.d.ts +32 -2
  109. package/dist/utils/provider-error-classification.d.ts +11 -0
  110. package/opencode-swarm.schema.json +40 -0
  111. package/package.json +1 -1
  112. package/dist/cli/curator-llm-factory-dds2fnhj.js +0 -72
  113. package/dist/cli/guardrail-explain-qm5wej7v.js +0 -73
  114. package/dist/cli/hive-promoter-1mhx2jh0.js +0 -87
  115. package/dist/cli/index-4ddpvd5c.js +0 -94
@@ -1,17 +1,25 @@
1
1
  // @bun
2
+ import {
3
+ writeSpeckitCheckoffLedger
4
+ } from "./index-v7fx8q3z.js";
2
5
  import {
3
6
  validateSpecContent
4
- } from "./index-wrt875kh.js";
7
+ } from "./index-0725jpp7.js";
5
8
  import {
6
9
  advisoryWarn,
7
10
  init_warning_buffer
8
- } from "./index-4ddpvd5c.js";
11
+ } from "./index-zxdawwc7.js";
12
+ import {
13
+ init_logger,
14
+ log
15
+ } from "./index-zgwm4ryv.js";
9
16
 
10
17
  // src/sdd/effective-spec.ts
11
18
  import { createHash } from "crypto";
12
19
  import * as fs from "fs";
13
20
  import * as path from "path";
14
21
  init_warning_buffer();
22
+ init_logger();
15
23
  var SWARM_SPEC_REL = path.join(".swarm", "spec.md");
16
24
  var OPENSPEC_ROOT = "openspec";
17
25
  var SPECKIT_MARKER = ".specify";
@@ -297,12 +305,14 @@ function parseSpeckitRequirements(content, sourceRel) {
297
305
  if (!/\b(MUST|SHALL|SHOULD|MAY)\b/i.test(line))
298
306
  continue;
299
307
  const text = line.trim().replace(/^\s*[-*]\s+/, "");
300
- const explicit = line.match(/\b(FR-(?!000)\d{3})\b/);
308
+ const explicit = line.match(/\b((?:[A-Za-z0-9][A-Za-z0-9._-]*\/)?FR-(?!000)\d{3})\b/);
301
309
  if (explicit) {
310
+ const raw = explicit[1];
311
+ const id = raw.includes("/") ? raw : raw.toUpperCase();
302
312
  requirements.push({
303
- id: explicit[1].toUpperCase(),
313
+ id,
304
314
  kind: "CURRENT",
305
- title: explicit[1].toUpperCase(),
315
+ title: id,
306
316
  text,
307
317
  sourceRel
308
318
  });
@@ -327,7 +337,7 @@ function resolveSpeckitProjection(directory, options = {}) {
327
337
  if (detection.features.length === 0) {
328
338
  return { kind: "empty" };
329
339
  }
330
- let selectedFeature;
340
+ let selectedFeatures;
331
341
  if (options.feature) {
332
342
  const found = detection.features.find((f) => f.featureId === options.feature);
333
343
  if (!found) {
@@ -337,15 +347,14 @@ function resolveSpeckitProjection(directory, options = {}) {
337
347
  available: detection.features.map((f) => f.featureId)
338
348
  };
339
349
  }
340
- selectedFeature = found;
341
- } else if (detection.features.length === 1) {
342
- selectedFeature = detection.features[0];
350
+ selectedFeatures = [found];
343
351
  } else {
344
- return {
345
- kind: "ambiguous",
346
- features: detection.features.map((f) => f.featureId)
347
- };
352
+ selectedFeatures = detection.features;
353
+ }
354
+ if (selectedFeatures.length > 1) {
355
+ return buildMultiFeatureProjection(root, selectedFeatures);
348
356
  }
357
+ const selectedFeature = selectedFeatures[0];
349
358
  const specAbs = path.join(root, selectedFeature.specRelPath);
350
359
  const content = readTextBounded(specAbs);
351
360
  if (content === null) {
@@ -379,6 +388,7 @@ function resolveSpeckitProjection(directory, options = {}) {
379
388
  for (const req of requirements) {
380
389
  lines.push(renderRequirement(req, usedIds, warnings, reservedIds));
381
390
  }
391
+ const featureRequirementIds = [...usedIds];
382
392
  lines.push(...renderSuccessCriteriaScaffold(selectedFeature.featureId, usedIds));
383
393
  const projected = `${lines.join(`
384
394
  `)}
@@ -402,7 +412,111 @@ function resolveSpeckitProjection(directory, options = {}) {
402
412
  sourcePaths: [selectedFeature.specRelPath],
403
413
  warnings
404
414
  };
405
- return { kind: "ok", spec, feature: selectedFeature.featureId };
415
+ return {
416
+ kind: "ok",
417
+ spec,
418
+ features: [selectedFeature.featureId],
419
+ namespaced: false,
420
+ featureRequirementIds: [featureRequirementIds]
421
+ };
422
+ }
423
+ function bareFrPart(id) {
424
+ const idx = id.lastIndexOf("/");
425
+ return idx === -1 ? id : id.slice(idx + 1);
426
+ }
427
+ function renderNamespacedRequirement(featureId, req, usedNs, usedBare, reservedBare, warnings) {
428
+ const explicitBare = req.id ? bareFrPart(req.id) : null;
429
+ const explicitNs = explicitBare ? `${featureId}/${explicitBare}` : null;
430
+ let id;
431
+ if (explicitNs && !usedNs.has(explicitNs)) {
432
+ id = explicitNs;
433
+ usedBare.add(explicitBare);
434
+ } else {
435
+ id = `${featureId}/${nextFrId(usedBare, warnings, reservedBare)}`;
436
+ }
437
+ if (explicitNs && explicitNs !== id) {
438
+ warnings.push(`Duplicate requirement id ${explicitNs} in ${req.sourceRel}; generated ${id}.`);
439
+ }
440
+ usedNs.add(id);
441
+ let text = req.text;
442
+ if (req.id && text.includes(req.id)) {
443
+ text = text.replace(req.id, id);
444
+ } else if (!text.includes(id)) {
445
+ text = `${id}: ${text}`;
446
+ }
447
+ return `- ${text} _(source: ${req.sourceRel})_`;
448
+ }
449
+ function buildMultiFeatureProjection(root, features) {
450
+ const warnings = [];
451
+ const lines = [
452
+ "# Specification: Effective SDD Projection",
453
+ "",
454
+ "Generated from Spec-Kit feature artifacts. Update the source artifacts, then run `/swarm sdd project` to refresh this projection.",
455
+ "",
456
+ "## Source Artifacts",
457
+ ...features.map((f) => `- ${f.specRelPath}`),
458
+ "",
459
+ "## Functional Requirements"
460
+ ];
461
+ const scUsedIds = new Set;
462
+ const featureRequirementIds = [];
463
+ let mtimeMs = 0;
464
+ for (const feature of features) {
465
+ const specAbs = path.join(root, feature.specRelPath);
466
+ const content = readTextBounded(specAbs);
467
+ if (content === null) {
468
+ return { kind: "zero_requirements", feature: feature.featureId };
469
+ }
470
+ const requirements = parseSpeckitRequirements(content, feature.specRelPath);
471
+ if (requirements.length === 0) {
472
+ return { kind: "zero_requirements", feature: feature.featureId };
473
+ }
474
+ const usedNs = new Set;
475
+ const usedBare = new Set;
476
+ const reservedBare = new Set;
477
+ for (const req of requirements) {
478
+ if (req.id)
479
+ reservedBare.add(bareFrPart(req.id));
480
+ }
481
+ try {
482
+ mtimeMs = Math.max(mtimeMs, fs.lstatSync(specAbs).mtimeMs);
483
+ } catch {}
484
+ lines.push("", `### ${feature.featureId}`);
485
+ for (const req of requirements) {
486
+ lines.push(renderNamespacedRequirement(feature.featureId, req, usedNs, usedBare, reservedBare, warnings));
487
+ }
488
+ featureRequirementIds.push([...usedNs]);
489
+ lines.push(...renderSuccessCriteriaScaffold(feature.featureId, scUsedIds));
490
+ }
491
+ const projected = `${lines.join(`
492
+ `)}
493
+ `;
494
+ if (projected.length > MAX_SPEC_BYTES) {
495
+ return {
496
+ kind: "too_large",
497
+ feature: features[features.length - 1].featureId,
498
+ bytes: projected.length
499
+ };
500
+ }
501
+ const validation = validateSpecContent(projected);
502
+ if (!validation.valid) {
503
+ warnings.push(...validation.issues.map((issue) => `Projection line ${issue.line}: ${issue.message}`));
504
+ }
505
+ const spec = {
506
+ source: "speckit_projection",
507
+ content: projected,
508
+ hash: hash(projected),
509
+ mtime: mtimeMs > 0 ? new Date(mtimeMs).toISOString() : null,
510
+ sourcePaths: features.map((f) => f.specRelPath),
511
+ warnings
512
+ };
513
+ return {
514
+ kind: "ok",
515
+ spec,
516
+ features: features.map((f) => f.featureId),
517
+ namespaced: true,
518
+ featureRequirementIds
519
+ };
406
520
  }
407
521
  function buildSpeckitProjectionSync(directory, options = {}) {
408
522
  const resolution = resolveSpeckitProjection(directory, options);
@@ -599,12 +713,32 @@ function readEffectiveSpecSync(directory, opts) {
599
713
  }
600
714
  function writeProjectedSpecSync(directory, options = {}) {
601
715
  const root = path.resolve(directory);
602
- const projection = options.source === "speckit" ? buildSpeckitProjectionSync(root, { feature: options.feature }) : buildOpenSpecProjectionSync(root, { changeId: options.changeId });
716
+ let speckitResolution = null;
717
+ let projection;
718
+ if (options.source === "speckit") {
719
+ speckitResolution = resolveSpeckitProjection(root, {
720
+ feature: options.feature
721
+ });
722
+ projection = speckitResolution.kind === "ok" ? speckitResolution.spec : null;
723
+ } else {
724
+ projection = buildOpenSpecProjectionSync(root, {
725
+ changeId: options.changeId
726
+ });
727
+ }
603
728
  const target = path.join(root, SWARM_SPEC_REL);
604
729
  if (!projection || options.dryRun) {
605
730
  return { written: false, projection, path: target };
606
731
  }
607
732
  fs.mkdirSync(path.dirname(target), { recursive: true });
733
+ const buildLedgerAfterWrite = () => {
734
+ if (!speckitResolution || speckitResolution.kind !== "ok")
735
+ return;
736
+ try {
737
+ writeSpeckitCheckoffLedger(root, speckitResolution);
738
+ } catch (err) {
739
+ log(`[sdd] check-off ledger build failed after projection write: ${err instanceof Error ? err.message : String(err)}`);
740
+ }
741
+ };
608
742
  if (!options.overwrite) {
609
743
  try {
610
744
  fs.writeFileSync(target, projection.content, { flag: "wx" });
@@ -619,6 +753,7 @@ function writeProjectedSpecSync(directory, options = {}) {
619
753
  }
620
754
  throw err;
621
755
  }
756
+ buildLedgerAfterWrite();
622
757
  return { written: true, projection, path: target };
623
758
  }
624
759
  let archivePath;
@@ -635,6 +770,7 @@ function writeProjectedSpecSync(directory, options = {}) {
635
770
  const tmp = `${target}.tmp-${process.pid}-${Date.now()}`;
636
771
  fs.writeFileSync(tmp, projection.content, "utf-8");
637
772
  fs.renameSync(tmp, target);
773
+ buildLedgerAfterWrite();
638
774
  return { written: true, projection, archivePath, path: target };
639
775
  }
640
776
  function validateSpeckit(directory, options = {}) {
@@ -647,44 +783,48 @@ function validateSpeckit(directory, options = {}) {
647
783
  if (resolution.kind === "zero_requirements") {
648
784
  problems.push(`Feature '${resolution.feature}' contains no parsable functional requirements.`);
649
785
  }
650
- const detection = detectSpeckit(root);
651
- const featureEntry = detection.features.find((f) => f.featureId === resolution.feature);
652
- if (!featureEntry) {
653
- return { resolution, problems };
654
- }
655
- const specAbs = path.join(root, featureEntry.specRelPath);
656
- let specContent = null;
657
- try {
658
- specContent = readTextBounded(specAbs);
659
- } catch {}
660
- if (specContent !== null) {
661
- const specLines = specContent.replace(/\r\n/g, `
786
+ const featureIds = resolution.kind === "ok" ? resolution.features : [resolution.feature];
787
+ const prefix = featureIds.length > 1 ? (id, p) => `[${id}] ${p}` : (_id, p) => p;
788
+ for (const featureId of featureIds) {
789
+ const detection = detectSpeckit(root);
790
+ const featureEntry = detection.features.find((f) => f.featureId === featureId);
791
+ if (!featureEntry) {
792
+ continue;
793
+ }
794
+ const specAbs = path.join(root, featureEntry.specRelPath);
795
+ let specContent = null;
796
+ try {
797
+ specContent = readTextBounded(specAbs);
798
+ } catch {}
799
+ if (specContent !== null) {
800
+ const specLines = specContent.replace(/\r\n/g, `
662
801
  `).split(`
663
802
  `);
664
- for (const requiredHeader of SPECKIT_REQUIRED_SECTIONS) {
665
- if (!specLines.some((line) => line.trimEnd() === requiredHeader)) {
666
- problems.push(`Missing required spec.md section: ${requiredHeader}`);
803
+ for (const requiredHeader of SPECKIT_REQUIRED_SECTIONS) {
804
+ if (!specLines.some((line) => line.trimEnd() === requiredHeader)) {
805
+ problems.push(prefix(featureId, `Missing required spec.md section: ${requiredHeader}`));
806
+ }
667
807
  }
668
808
  }
669
- }
670
- const tasksAbs = path.join(path.dirname(specAbs), "tasks.md");
671
- let tasksContent = null;
672
- try {
673
- tasksContent = readTextBounded(tasksAbs);
674
- } catch {}
675
- if (tasksContent !== null) {
676
- const tasksLines = tasksContent.replace(/\r\n/g, `
809
+ const tasksAbs = path.join(path.dirname(specAbs), "tasks.md");
810
+ let tasksContent = null;
811
+ try {
812
+ tasksContent = readTextBounded(tasksAbs);
813
+ } catch {}
814
+ if (tasksContent !== null) {
815
+ const tasksLines = tasksContent.replace(/\r\n/g, `
677
816
  `).split(`
678
817
  `);
679
- for (const line of tasksLines) {
680
- const taskMatch = line.match(/^\s*-\s+\[[ xX]\]\s+(T\d+)/);
681
- if (!taskMatch)
682
- continue;
683
- const taskId = taskMatch[1];
684
- const hasStoryRef = /\[US\d+\]/i.test(line);
685
- const hasReqRef = /\bFR-(?!000)\d{3}\b/i.test(line);
686
- if (!hasStoryRef && !hasReqRef) {
687
- problems.push(`Task ${taskId} has no spec/requirement reference.`);
818
+ for (const line of tasksLines) {
819
+ const taskMatch = line.match(/^\s*-\s+\[[ xX]\]\s+(T\d+)/);
820
+ if (!taskMatch)
821
+ continue;
822
+ const taskId = taskMatch[1];
823
+ const hasStoryRef = /\[US\d+\]/i.test(line);
824
+ const hasReqRef = /\bFR-(?!000)\d{3}\b/i.test(line);
825
+ if (!hasStoryRef && !hasReqRef) {
826
+ problems.push(prefix(featureId, `Task ${taskId} has no spec/requirement reference.`));
827
+ }
688
828
  }
689
829
  }
690
830
  }
@@ -2,15 +2,15 @@
2
2
  import {
3
3
  bunFile
4
4
  } from "./index-2s7dvzff.js";
5
+ import {
6
+ SwarmError
7
+ } from "./index-c1ggtmpm.js";
5
8
  import {
6
9
  RECENT_WRITE_WINDOW_MS,
7
10
  readCachedTextFile,
8
11
  wasObservedToExist,
9
12
  wasRecentlyWrittenByThisProcess
10
- } from "./index-ne9zamcs.js";
11
- import {
12
- SwarmError
13
- } from "./index-c1ggtmpm.js";
13
+ } from "./index-989v83pb.js";
14
14
  import {
15
15
  warn
16
16
  } from "./index-zgwm4ryv.js";
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import {
3
- handleGuardrailExplain
4
- } from "./index-xy7k7f3k.js";
5
2
  import {
6
3
  handleGuardrailLog
7
- } from "./index-9fb01jk5.js";
4
+ } from "./index-as4xaams.js";
5
+ import {
6
+ handleGuardrailExplain
7
+ } from "./index-3bbjpbmn.js";
8
8
  import {
9
9
  COMMAND_REGISTRY,
10
10
  DEFAULT_CI_DEADLINE_MS,
@@ -97,67 +97,69 @@ import {
97
97
  handleWriteRetroCommand,
98
98
  normalizeSwarmCommandInput,
99
99
  resolveCommand
100
- } from "./index-ky262b73.js";
100
+ } from "./index-z2zrcecq.js";
101
+ import"./index-tnhk72rs.js";
101
102
  import"./index-hamqvzqn.js";
102
- import"./index-pskba939.js";
103
- import"./index-aqpwm350.js";
104
- import"./index-h4nh6s8b.js";
105
- import"./index-q375xdcw.js";
106
- import"./index-y98fvmb8.js";
107
- import"./index-g6nyk713.js";
103
+ import"./index-rejpbgxp.js";
104
+ import"./index-nhxykfyy.js";
105
+ import"./index-bhmrgbyv.js";
106
+ import"./index-xd0e4amf.js";
107
+ import"./index-s0zgz4p1.js";
108
108
  import"./index-txdagbh7.js";
109
- import"./index-n1tcj1q7.js";
109
+ import"./index-g062wnw1.js";
110
110
  import"./index-6b295cas.js";
111
- import"./index-dz12bshh.js";
112
- import"./index-vp9pn7sv.js";
113
- import"./index-pfg3jwe9.js";
111
+ import"./index-50v672wd.js";
112
+ import"./index-3zvp7t5d.js";
113
+ import"./index-yf7tdhpz.js";
114
114
  import"./index-rdec0y3z.js";
115
- import"./index-6r92fw88.js";
116
- import"./index-549wxbe1.js";
115
+ import"./index-y30y1rkg.js";
116
+ import"./index-cjapb4hy.js";
117
117
  import"./index-zsrtt42s.js";
118
- import"./index-y94vwx2q.js";
119
- import"./index-2b0ktpbf.js";
120
- import"./index-3pzwsesm.js";
118
+ import"./index-z2xf153n.js";
119
+ import"./index-bdpgfep1.js";
120
+ import"./index-92m05mew.js";
121
121
  import"./index-pt7h91zc.js";
122
122
  import"./index-q7sjgr1y.js";
123
- import"./index-n2wjrgcs.js";
124
- import"./index-zbhvr9st.js";
125
- import"./index-sj29n50e.js";
126
- import"./index-epfjc1c1.js";
127
- import"./index-s4bkey0q.js";
123
+ import"./index-v7fx8q3z.js";
124
+ import"./index-k5vwnnym.js";
125
+ import"./index-n5carmk0.js";
126
+ import"./index-v0par978.js";
127
+ import"./index-2q5m4m2r.js";
128
+ import"./index-gc6h1fmf.js";
128
129
  import"./index-2s7dvzff.js";
129
- import"./index-5d224akk.js";
130
- import"./index-0h3cr7pn.js";
130
+ import"./index-dzm5nfh7.js";
131
+ import"./index-6gcxgx84.js";
131
132
  import"./index-rtry5xyf.js";
132
- import"./index-ajm7ebyd.js";
133
+ import"./index-k6f0nryj.js";
133
134
  import"./index-frcemc0b.js";
134
- import"./index-wrt875kh.js";
135
- import"./index-rb9jmj30.js";
136
- import"./index-b567t0cr.js";
137
- import"./index-h59vsbch.js";
138
- import"./index-cvg402ha.js";
139
- import"./index-a11ztzs5.js";
140
- import"./index-nzekzzs2.js";
141
- import"./index-ry16d01s.js";
135
+ import"./index-0725jpp7.js";
136
+ import"./index-cj64vp08.js";
137
+ import"./index-wx3wz7ya.js";
138
+ import"./index-38cfx8g8.js";
139
+ import"./index-91dhg3wr.js";
140
+ import"./index-vmthakz0.js";
141
+ import"./index-bv4b8tpa.js";
142
142
  import"./index-rdm3px0g.js";
143
- import"./index-yfpswnjt.js";
144
- import"./index-yp25bc9n.js";
143
+ import"./index-ry16d01s.js";
144
+ import"./index-516j9vsk.js";
145
+ import"./index-gy3tcmk4.js";
145
146
  import"./index-vzm6zre7.js";
146
147
  import"./index-ae75rja9.js";
147
- import"./index-34bwqcea.js";
148
- import"./index-f2v90gfc.js";
149
- import"./index-7g4c7s5r.js";
150
- import"./index-qt0793qm.js";
151
- import"./index-ne9zamcs.js";
148
+ import"./index-12ewkms0.js";
149
+ import"./index-ea9fk6v0.js";
150
+ import"./index-6mwha20t.js";
152
151
  import"./index-1xnse449.js";
153
152
  import"./index-c1ggtmpm.js";
154
- import"./index-m1w40kfw.js";
155
- import"./index-zz7gzw57.js";
156
- import"./index-4ddpvd5c.js";
153
+ import"./index-ejhxgyvm.js";
154
+ import"./index-7g4c7s5r.js";
155
+ import"./index-989v83pb.js";
156
+ import"./index-gx2vp8gx.js";
157
+ import"./index-xj5z92qz.js";
158
+ import"./index-zxdawwc7.js";
157
159
  import {
158
160
  init_schema,
159
161
  stripKnownSwarmPrefix
160
- } from "./index-9s1xzvnn.js";
162
+ } from "./index-rp4akjrm.js";
161
163
  import {
162
164
  AGENT_TOOL_MAP,
163
165
  ORCHESTRATOR_NAME,
@@ -0,0 +1,100 @@
1
+ // @bun
2
+ import {
3
+ exports_external,
4
+ init_zod
5
+ } from "./index-gknz3bv1.js";
6
+
7
+ // src/config/plan-schema.ts
8
+ init_zod();
9
+ var ExecutionProfileSchema = exports_external.object({
10
+ parallelization_enabled: exports_external.boolean().default(false),
11
+ max_concurrent_tasks: exports_external.number().int().min(1).max(64).default(10),
12
+ council_parallel: exports_external.boolean().default(true),
13
+ locked: exports_external.boolean().default(false),
14
+ auto_proceed: exports_external.boolean().default(false),
15
+ commit_after_each_completed_task: exports_external.boolean().default(false),
16
+ planning_profile: exports_external.enum(["balanced", "strict"]).optional()
17
+ });
18
+ var TaskStatusSchema = exports_external.enum([
19
+ "pending",
20
+ "in_progress",
21
+ "completed",
22
+ "blocked",
23
+ "closed"
24
+ ]);
25
+ var TaskSizeSchema = exports_external.enum(["small", "medium", "large"]);
26
+ var PhaseStatusSchema = exports_external.enum([
27
+ "pending",
28
+ "in_progress",
29
+ "complete",
30
+ "completed",
31
+ "blocked",
32
+ "closed"
33
+ ]);
34
+ var MigrationStatusSchema = exports_external.enum([
35
+ "native",
36
+ "migrated",
37
+ "migration_failed"
38
+ ]);
39
+ var TaskSchema = exports_external.object({
40
+ id: exports_external.string(),
41
+ phase: exports_external.number().int().min(1),
42
+ status: TaskStatusSchema.default("pending"),
43
+ size: TaskSizeSchema.default("small"),
44
+ description: exports_external.string().min(1),
45
+ depends: exports_external.array(exports_external.string()).default([]),
46
+ acceptance: exports_external.string().optional(),
47
+ files_touched: exports_external.array(exports_external.string()).default([]),
48
+ evidence_path: exports_external.string().optional(),
49
+ blocked_reason: exports_external.string().optional(),
50
+ fr_refs: exports_external.array(exports_external.string()).optional()
51
+ });
52
+ var PhaseSchema = exports_external.object({
53
+ id: exports_external.number().int().min(1),
54
+ name: exports_external.string().min(1),
55
+ status: PhaseStatusSchema.default("pending"),
56
+ tasks: exports_external.array(TaskSchema).default([]),
57
+ type: exports_external.enum(["code", "non-code"]).optional(),
58
+ required_agents: exports_external.array(exports_external.string()).optional()
59
+ });
60
+ var PlanSchema = exports_external.object({
61
+ schema_version: exports_external.literal("1.0.0"),
62
+ title: exports_external.string().min(1),
63
+ swarm: exports_external.string().min(1),
64
+ current_phase: exports_external.number().int().min(1).optional(),
65
+ phases: exports_external.array(PhaseSchema).min(1),
66
+ migration_status: MigrationStatusSchema.optional(),
67
+ specMtime: exports_external.string().optional(),
68
+ specHash: exports_external.string().optional(),
69
+ execution_profile: ExecutionProfileSchema.optional()
70
+ });
71
+ function isPhaseStatusTerminal(status) {
72
+ return status === "complete" || status === "completed" || status === "closed";
73
+ }
74
+ function isPhaseEffectivelyTerminal(phase) {
75
+ if (isPhaseStatusTerminal(phase.status))
76
+ return true;
77
+ const tasks = phase.tasks ?? [];
78
+ return tasks.length > 0 && tasks.every((task) => task.status === "completed" || task.status === "closed");
79
+ }
80
+ function resolveActivePhaseId(plan) {
81
+ const cursor = plan.current_phase;
82
+ if (cursor !== undefined) {
83
+ const cursorPhase = plan.phases.find((phase) => phase.id === cursor);
84
+ if (cursorPhase && !isPhaseEffectivelyTerminal(cursorPhase)) {
85
+ return cursorPhase.id;
86
+ }
87
+ }
88
+ const firstNonTerminal = plan.phases.find((phase) => !isPhaseEffectivelyTerminal(phase));
89
+ if (firstNonTerminal)
90
+ return firstNonTerminal.id;
91
+ return plan.phases[plan.phases.length - 1]?.id ?? 1;
92
+ }
93
+ function normalizeCurrentPhaseInPlace(plan) {
94
+ plan.current_phase = resolveActivePhaseId(plan);
95
+ }
96
+ function getCurrentPhase(plan) {
97
+ return resolveActivePhaseId(plan);
98
+ }
99
+
100
+ export { ExecutionProfileSchema, TaskStatusSchema, TaskSizeSchema, PhaseStatusSchema, MigrationStatusSchema, TaskSchema, PhaseSchema, PlanSchema, resolveActivePhaseId, normalizeCurrentPhaseInPlace, getCurrentPhase };
@@ -11,16 +11,16 @@ import {
11
11
  } from "./index-ae75rja9.js";
12
12
  import {
13
13
  resolveKnowledgeStoreDir
14
- } from "./index-34bwqcea.js";
14
+ } from "./index-12ewkms0.js";
15
15
  import {
16
16
  atomicWriteFile
17
- } from "./index-f2v90gfc.js";
17
+ } from "./index-ea9fk6v0.js";
18
18
  import {
19
19
  require_proper_lockfile
20
20
  } from "./index-7g4c7s5r.js";
21
21
  import {
22
22
  readCachedParsedFile
23
- } from "./index-ne9zamcs.js";
23
+ } from "./index-989v83pb.js";
24
24
  import {
25
25
  init_knowledge_types,
26
26
  isActiveStatus
@@ -739,7 +739,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
739
739
  const {
740
740
  readAuthoritativeKnowledgeCounterRollups,
741
741
  effectiveRetrievalOutcomes
742
- } = await import("./knowledge-events-2bgefatz.js");
742
+ } = await import("./knowledge-events-k2qqase2.js");
743
743
  const rollups = await readAuthoritativeKnowledgeCounterRollups(directory);
744
744
  const flagIds = new Set;
745
745
  for (const e of atFloor) {
@@ -806,11 +806,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
806
806
  });
807
807
  }
808
808
  if (action === "quarantine" && toQuarantine.length > 0) {
809
- const { quarantineEntry } = await import("./knowledge-validator-723h2vck.js");
810
- const { KnowledgeConfigSchema } = await import("./schema-jt9axyj6.js");
809
+ const { quarantineEntry } = await import("./knowledge-validator-qgyxdpc9.js");
810
+ const { KnowledgeConfigSchema } = await import("./schema-5k68crjb.js");
811
811
  let config;
812
812
  try {
813
- const { loadPluginConfigWithMeta } = await import("./index-93nx95me.js");
813
+ const { loadPluginConfigWithMeta } = await import("./index-855qxtdm.js");
814
814
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
815
815
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
816
816
  } catch {
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  autoCommitDirty,
4
4
  cleanUntrackedFiles
5
- } from "./index-zbhvr9st.js";
5
+ } from "./index-n5carmk0.js";
6
6
  import {
7
7
  validateSwarmPath
8
- } from "./index-s4bkey0q.js";
8
+ } from "./index-gc6h1fmf.js";
9
9
  import {
10
10
  bunSpawn,
11
11
  classifySpawnFailure
@@ -15,18 +15,16 @@ import {
15
15
  atomicWriteFile,
16
16
  taskEvidencePath,
17
17
  withTaskEvidenceLock
18
- } from "./index-f2v90gfc.js";
18
+ } from "./index-ea9fk6v0.js";
19
19
  import {
20
20
  telemetry
21
- } from "./index-qt0793qm.js";
21
+ } from "./index-6mwha20t.js";
22
22
  import {
23
+ advisoryWarn,
23
24
  init_git_executable,
25
+ init_warning_buffer,
24
26
  resolveGitExecutable
25
- } from "./index-zz7gzw57.js";
26
- import {
27
- advisoryWarn,
28
- init_warning_buffer
29
- } from "./index-4ddpvd5c.js";
27
+ } from "./index-zxdawwc7.js";
30
28
  import {
31
29
  exports_external,
32
30
  init_zod
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  init_loader,
4
4
  loadPluginConfigWithMeta
5
- } from "./index-m1w40kfw.js";
5
+ } from "./index-xj5z92qz.js";
6
6
  import {
7
7
  init_schema
8
- } from "./index-9s1xzvnn.js";
8
+ } from "./index-rp4akjrm.js";
9
9
  import {
10
10
  DEFAULT_WORKTREE_ISOLATION_CONFIG,
11
11
  init_constants