opencode-swarm 7.181.2 → 7.181.4

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 (89) 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/cli/{coder-settlement-993vdsd2.js → coder-settlement-vbs5rj3z.js} +10 -10
  4. package/dist/cli/{config-doctor-nr27vfv6.js → config-doctor-3cb51z08.js} +2 -2
  5. package/dist/cli/{core-t3tg4397.js → core-0h7y8z0s.js} +2 -2
  6. package/dist/cli/{curation-policy-m3x9mkj9.js → curation-policy-r4dkajw9.js} +4 -4
  7. package/dist/cli/{curator-gk392717.js → curator-9sn55eyk.js} +34 -34
  8. package/dist/cli/curator-drift-d4jkgrba.js +37 -0
  9. package/dist/cli/{curator-llm-factory-n01we8pa.js → curator-llm-factory-zwc2gpe7.js} +34 -34
  10. package/dist/cli/{evidence-summary-service-fkvj8ct1.js → evidence-summary-service-sb5seqs3.js} +14 -14
  11. package/dist/cli/{gate-evidence-1n6zffzb.js → gate-evidence-emq2y7kz.js} +5 -5
  12. package/dist/cli/{guardrail-explain-81jvm99e.js → guardrail-explain-a3hcrpwv.js} +35 -35
  13. package/dist/cli/{guardrail-log-mw9x5j8g.js → guardrail-log-ftv03v4x.js} +6 -6
  14. package/dist/cli/{guardrail-reset-6thsn6ad.js → guardrail-reset-d6qmnvff.js} +34 -34
  15. package/dist/cli/{hive-promoter-pym6se37.js → hive-promoter-pktjn46n.js} +34 -34
  16. package/dist/cli/{index-m65tnv4j.js → index-01r2wrwa.js} +1 -1
  17. package/dist/cli/{index-txx2mrsk.js → index-0ea0c676.js} +25 -11
  18. package/dist/cli/{index-gmqf6bjj.js → index-12fxtcce.js} +36 -36
  19. package/dist/cli/{index-cr61qv27.js → index-1epynxc4.js} +2 -2
  20. package/dist/cli/{index-1wpnt86a.js → index-1msszzg2.js} +5 -5
  21. package/dist/cli/{index-12ewkms0.js → index-23mdeh2a.js} +1 -1
  22. package/dist/cli/{index-5hxv1er2.js → index-3ga3ts3h.js} +56 -3
  23. package/dist/cli/{index-38cfx8g8.js → index-427x3j6p.js} +2 -2
  24. package/dist/cli/{index-wph45kyb.js → index-4qpz7mpn.js} +4 -4
  25. package/dist/cli/{index-7nr9p5bd.js → index-54sd9bbn.js} +5 -5
  26. package/dist/cli/{index-fmhd3zc8.js → index-68ben2q8.js} +2 -2
  27. package/dist/cli/{index-n5a9dq5s.js → index-6jrn46zy.js} +1 -1
  28. package/dist/cli/{index-ernt0wrg.js → index-9eg8f4zm.js} +4306 -1504
  29. package/dist/cli/{index-hbe56wtn.js → index-9s2rp2j5.js} +2 -2
  30. package/dist/cli/{index-gc6h1fmf.js → index-a2hvmc3a.js} +1 -1
  31. package/dist/cli/{index-ea9fk6v0.js → index-ap6hs8fj.js} +1 -1
  32. package/dist/cli/{index-92m05mew.js → index-by9wfeja.js} +1 -1
  33. package/dist/cli/{index-et28q7cp.js → index-dkprb20b.js} +1 -1
  34. package/dist/cli/{index-qw9aqays.js → index-dwc1wztn.js} +6 -6
  35. package/dist/cli/{index-0h39trak.js → index-enmvd9ap.js} +1 -1
  36. package/dist/cli/{index-kzmd4gs7.js → index-epq8am78.js} +1 -1
  37. package/dist/cli/{index-pqtmzee6.js → index-fsye9ygy.js} +4 -4
  38. package/dist/cli/{index-5q3xsqwm.js → index-gtpq64q7.js} +3 -3
  39. package/dist/cli/{index-5v8zws0s.js → index-hqa71xfm.js} +140 -9
  40. package/dist/cli/{index-5zy5k5w0.js → index-j97nc02q.js} +4 -4
  41. package/dist/cli/{index-bdpgfep1.js → index-jrxrjz89.js} +1 -1
  42. package/dist/cli/{index-516j9vsk.js → index-kkrbybgt.js} +27 -2
  43. package/dist/cli/{index-6mwha20t.js → index-mkpdcbye.js} +3 -3
  44. package/dist/cli/{index-6x36hhd3.js → index-myacmqmf.js} +34 -34
  45. package/dist/cli/{index-t93cp2tz.js → index-nw3z614g.js} +4 -4
  46. package/dist/cli/{index-ehvkz2zv.js → index-r4vve32m.js} +7 -7
  47. package/dist/cli/{index-m779twtf.js → index-rgfz80gt.js} +1 -1
  48. package/dist/cli/{index-6gcxgx84.js → index-s34y6gbh.js} +1 -1
  49. package/dist/cli/{index-s0zgz4p1.js → index-sf51gh68.js} +1 -1
  50. package/dist/cli/{index-2sqfrvxj.js → index-v4h99xhr.js} +2 -2
  51. package/dist/cli/{index-vmwmwahh.js → index-x4am0jxt.js} +3 -3
  52. package/dist/cli/{index-et7tg13p.js → index-y03jadcy.js} +269 -9
  53. package/dist/cli/{index-dpxg347z.js → index-y28np6j9.js} +3 -3
  54. package/dist/cli/{index-xz4q5vcg.js → index-zp6fss8c.js} +3 -3
  55. package/dist/cli/index.js +35 -35
  56. package/dist/cli/{knowledge-escalator-jmqbmfbf.js → knowledge-escalator-5q4y97e4.js} +11 -11
  57. package/dist/cli/{knowledge-events-5ksqpf4g.js → knowledge-events-x7q8yepd.js} +9 -9
  58. package/dist/cli/{knowledge-link-s2qs178z.js → knowledge-link-655xa3db.js} +3 -3
  59. package/dist/cli/{knowledge-store-q3yy56sc.js → knowledge-store-r7ng2nf8.js} +4 -4
  60. package/dist/cli/{knowledge-validator-r5kaz53f.js → knowledge-validator-e78m6cqe.js} +6 -6
  61. package/dist/cli/{mcp-h82hxnxr.js → mcp-208jwxps.js} +1 -1
  62. package/dist/cli/model-preflight-xakn1356.js +359 -0
  63. package/dist/cli/{pending-delegations-e4h6vjeb.js → pending-delegations-w4a5tg11.js} +7 -7
  64. package/dist/cli/{pr-subscriptions-j7hw3k6x.js → pr-subscriptions-8289esc9.js} +7 -7
  65. package/dist/cli/{pr-workflow-gate-js8dcry2.js → pr-workflow-gate-b7yx0x21.js} +34 -34
  66. package/dist/cli/{runner-tzgwvvn1.js → runner-b5vt1any.js} +4 -4
  67. package/dist/cli/{scan-cursor-yhf58mq2.js → scan-cursor-edpbzp72.js} +5 -5
  68. package/dist/cli/{schema-0k4st1qt.js → schema-dnsxhyr3.js} +1 -1
  69. package/dist/cli/{scope-persistence-bpptmh1e.js → scope-persistence-z1f7d4tw.js} +10 -10
  70. package/dist/cli/{server-axnran6h.js → server-t2edntv4.js} +69 -599
  71. package/dist/cli/{skill-generator-n2w032d1.js → skill-generator-5n7vf0s3.js} +13 -13
  72. package/dist/cli/{snapshot-coordination-init-kyf50x12.js → snapshot-coordination-init-t14dk9je.js} +34 -34
  73. package/dist/cli/{speckit-checkoff-m4184e1x.js → speckit-checkoff-4ws84g13.js} +3 -3
  74. package/dist/cli/{telemetry-zhcgfe70.js → telemetry-6k8t2mrw.js} +1 -1
  75. package/dist/cli/{workspace-snapshot-4m2ex1ey.js → workspace-snapshot-hsssm50w.js} +2 -2
  76. package/dist/cli/{worktree-collision-ownership-1g2414pf.js → worktree-collision-ownership-wj6337ec.js} +8 -8
  77. package/dist/cli/{worktree-isolation-x07f7cfp.js → worktree-isolation-9fyj85tc.js} +34 -34
  78. package/dist/commands/registry.d.ts +1 -1
  79. package/dist/config/agent-model.d.ts +14 -0
  80. package/dist/config/bundled-skill-dispositions.d.ts +29 -0
  81. package/dist/hooks/delegation-gate.d.ts +10 -8
  82. package/dist/hooks/task-id-resolver.d.ts +7 -0
  83. package/dist/index.js +285 -269
  84. package/dist/memory/index.d.ts +1 -0
  85. package/dist/memory/instruction-pairing.d.ts +112 -0
  86. package/dist/services/model-preflight.d.ts +103 -21
  87. package/package.json +1 -1
  88. package/dist/cli/curator-drift-hz3j3fad.js +0 -297
  89. package/dist/cli/model-preflight-5b81adsj.js +0 -170
@@ -11,7 +11,7 @@ import {
11
11
  assertProjectRoot,
12
12
  atomicWriteFile,
13
13
  withEvidenceLock
14
- } from "./index-ea9fk6v0.js";
14
+ } from "./index-ap6hs8fj.js";
15
15
  import {
16
16
  exports_external,
17
17
  init_zod
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-gc6h1fmf.js";
4
+ } from "./index-a2hvmc3a.js";
5
5
  import {
6
6
  bunSpawn
7
7
  } from "./index-2s7dvzff.js";
@@ -242,7 +242,7 @@ var _internals2 = {
242
242
  symlinkSync: fs2.symlinkSync
243
243
  },
244
244
  writeScopeToDisk: async (directory, taskId, files) => {
245
- const { writeScopeToDisk: realWrite } = await import("./scope-persistence-bpptmh1e.js");
245
+ const { writeScopeToDisk: realWrite } = await import("./scope-persistence-z1f7d4tw.js");
246
246
  return realWrite(directory, taskId, files);
247
247
  },
248
248
  writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
@@ -5,18 +5,18 @@ import {
5
5
  import {
6
6
  effectiveRetrievalOutcomes,
7
7
  readAuthoritativeKnowledgeCounterRollups
8
- } from "./index-5v8zws0s.js";
8
+ } from "./index-hqa71xfm.js";
9
9
  import {
10
10
  ALLOWED_SKILL_PATH_PREFIXES,
11
11
  validateSkillPath
12
- } from "./index-wph45kyb.js";
12
+ } from "./index-4qpz7mpn.js";
13
13
  import {
14
14
  computeOutcomeSignal,
15
15
  readKnowledge,
16
16
  resolveHiveKnowledgePath,
17
17
  resolveSwarmKnowledgePath,
18
18
  transactKnowledge
19
- } from "./index-qw9aqays.js";
19
+ } from "./index-dwc1wztn.js";
20
20
  import {
21
21
  appendCappedJsonl,
22
22
  resolveRetentionCap
@@ -1,10 +1,18 @@
1
1
  // @bun
2
2
  import {
3
+ readEffectiveSpecSync
4
+ } from "./index-rgfz80gt.js";
5
+ import {
6
+ readSwarmFileAsync
7
+ } from "./index-a2hvmc3a.js";
8
+ import {
9
+ DURABILITY_CLASSES,
3
10
  DbWriteError,
4
11
  applySynchronousForClass,
5
12
  batchDurabilityClass,
6
13
  classifyDbWriteError,
7
- getProjectDb
14
+ getProjectDb,
15
+ projectDbExists
8
16
  } from "./index-vvgpgcyn.js";
9
17
  import {
10
18
  _internals,
@@ -16,13 +24,6 @@ import {
16
24
  warn
17
25
  } from "./index-zgwm4ryv.js";
18
26
 
19
- // src/db/canonical-project.ts
20
- var defaultCanonicalRootRealpath = _internals.realpathSync;
21
- var defaultCanonicalRootNativeRealpath = _internals.realpathSyncNative;
22
- function canonicalProjectKey(directory) {
23
- return canonicalRootKeyFresh(directory);
24
- }
25
-
26
27
  // src/background/event-bus.ts
27
28
  class AutomationEventBus {
28
29
  listeners = new Map;
@@ -90,6 +91,17 @@ function getGlobalEventBus() {
90
91
  return globalEventBus;
91
92
  }
92
93
 
94
+ // src/db/phase-report-store.ts
95
+ import { readdirSync as readdirSync2 } from "fs";
96
+ import { join as join2 } from "path";
97
+
98
+ // src/db/canonical-project.ts
99
+ var defaultCanonicalRootRealpath = _internals.realpathSync;
100
+ var defaultCanonicalRootNativeRealpath = _internals.realpathSyncNative;
101
+ function canonicalProjectKey(directory) {
102
+ return canonicalRootKeyFresh(directory);
103
+ }
104
+
93
105
  // src/db/group-commit-writer.ts
94
106
  init_logger();
95
107
  function isClosedHandleError(err) {
@@ -410,4 +422,252 @@ function importLegacyJsonFiles(directory, opts) {
410
422
  return { imported: 0, skipped, archived: false };
411
423
  }
412
424
 
413
- export { canonicalProjectKey, getGroupCommitWriter, closeGroupCommitWriter, importLegacyJsonl, importLegacyJsonFiles, getGlobalEventBus };
425
+ // src/db/phase-report-store.ts
426
+ var PHASE_REPORT_LEGACY_PREFIXES = {
427
+ curator_drift: "drift-report-phase-",
428
+ design_doc_drift: "doc-drift-phase-"
429
+ };
430
+ var importedRoots = new Set;
431
+ function hasAnyPhaseReportState(directory) {
432
+ if (projectDbExists(directory))
433
+ return true;
434
+ const root = canonicalProjectKey(directory);
435
+ let entries;
436
+ try {
437
+ entries = readdirSync2(join2(root, ".swarm"));
438
+ } catch {
439
+ return false;
440
+ }
441
+ for (const prefix of Object.values(PHASE_REPORT_LEGACY_PREFIXES)) {
442
+ if (entries.some((name) => name.startsWith(prefix) && name.endsWith(".json") && !name.includes(".imported"))) {
443
+ return true;
444
+ }
445
+ }
446
+ return false;
447
+ }
448
+ function kindCount(db, kind) {
449
+ return db.query("SELECT COUNT(*) as count FROM phase_report WHERE kind = ?").get(kind)?.count ?? 0;
450
+ }
451
+ function ensurePhaseReportsImported(directory) {
452
+ const root = canonicalProjectKey(directory);
453
+ if (importedRoots.has(root))
454
+ return;
455
+ for (const kind of Object.keys(PHASE_REPORT_LEGACY_PREFIXES)) {
456
+ importLegacyJsonFiles(directory, {
457
+ filePrefix: PHASE_REPORT_LEGACY_PREFIXES[kind],
458
+ kind,
459
+ kindCount: (db) => kindCount(db, kind),
460
+ upsertRow: (db, phase, payload) => {
461
+ db.run(`INSERT INTO phase_report (kind, phase, payload, updated_at)
462
+ VALUES (?, ?, ?, datetime('now'))
463
+ ON CONFLICT(kind, phase) DO UPDATE SET
464
+ payload = excluded.payload,
465
+ updated_at = datetime('now')`, [kind, phase, payload]);
466
+ }
467
+ });
468
+ }
469
+ importedRoots.add(root);
470
+ }
471
+ async function upsertPhaseReportDb(directory, kind, phase, payload) {
472
+ ensurePhaseReportsImported(directory);
473
+ const writer = getGroupCommitWriter(directory);
474
+ writer.enqueue({
475
+ durability: DURABILITY_CLASSES.phase_report,
476
+ run: (db) => {
477
+ db.run(`INSERT INTO phase_report (kind, phase, payload, updated_at)
478
+ VALUES (?, ?, ?, datetime('now'))
479
+ ON CONFLICT(kind, phase) DO UPDATE SET
480
+ payload = excluded.payload,
481
+ updated_at = datetime('now')`, [kind, phase, payload]);
482
+ }
483
+ });
484
+ await writer.flush();
485
+ }
486
+ function readPhaseReportsDb(directory, kind) {
487
+ if (!hasAnyPhaseReportState(directory))
488
+ return [];
489
+ ensurePhaseReportsImported(directory);
490
+ const db = getProjectDb(directory);
491
+ return db.query("SELECT phase, payload FROM phase_report WHERE kind = ? ORDER BY phase").all(kind).map((row) => ({ phase: row.phase, payload: row.payload }));
492
+ }
493
+ function phaseReportLocator(kind, phase) {
494
+ return `swarm.db:phase_report(${kind},${phase})`;
495
+ }
496
+
497
+ // src/hooks/curator-drift.ts
498
+ init_logger();
499
+ async function readPriorDriftReports(directory) {
500
+ const reports = [];
501
+ try {
502
+ for (const row of readPhaseReportsDb(directory, "curator_drift")) {
503
+ try {
504
+ const report = JSON.parse(row.payload);
505
+ if (typeof report.phase !== "number" || typeof report.alignment !== "string" || typeof report.timestamp !== "string" || typeof report.drift_score !== "number" || typeof report.schema_version !== "number" || !Array.isArray(report.compounding_effects)) {
506
+ warn(`[curator-drift] Skipping corrupt drift report: phase ${row.phase}`);
507
+ continue;
508
+ }
509
+ reports.push(report);
510
+ } catch {
511
+ warn(`[curator-drift] Skipping unreadable drift report: phase ${row.phase}`);
512
+ }
513
+ }
514
+ } catch {
515
+ return [];
516
+ }
517
+ reports.sort((a, b) => a.phase - b.phase);
518
+ return reports;
519
+ }
520
+ async function writeDriftReport(directory, report) {
521
+ const locator = phaseReportLocator("curator_drift", report.phase);
522
+ try {
523
+ await upsertPhaseReportDb(directory, "curator_drift", report.phase, JSON.stringify(report, null, 2));
524
+ } catch (err) {
525
+ throw new Error(`[curator-drift] Failed to write drift report to ${locator}: ${String(err)}`);
526
+ }
527
+ return locator;
528
+ }
529
+ var _internals4 = {
530
+ readPriorDriftReports,
531
+ writeDriftReport,
532
+ runDeterministicDriftCheck,
533
+ buildDriftInjectionText
534
+ };
535
+ function extractRequirementIds(text) {
536
+ const matches = text.match(/(?:[A-Za-z0-9][A-Za-z0-9._-]*\/)?FR-\d{3}/g);
537
+ return matches ? [...new Set(matches)] : [];
538
+ }
539
+ function bareSuffixCovers(specId, refId) {
540
+ return refId === specId || !refId.includes("/") && specId.endsWith(`/${refId}`);
541
+ }
542
+ async function runDeterministicDriftCheck(directory, phase, curatorResult, config, injectAdvisory) {
543
+ try {
544
+ const planMd = await readSwarmFileAsync(directory, "plan.md");
545
+ const specMd = readEffectiveSpecSync(directory)?.content ?? null;
546
+ const priorReports = await _internals4.readPriorDriftReports(directory);
547
+ const complianceCount = curatorResult.compliance.length;
548
+ const warningCompliance = curatorResult.compliance.filter((obs) => obs.severity === "warning");
549
+ let alignment = "ALIGNED";
550
+ let driftScore = 0;
551
+ const specRequirements = specMd ? extractRequirementIds(specMd) : [];
552
+ const planRequirements = planMd ? extractRequirementIds(planMd) : [];
553
+ const digestRequirements = extractRequirementIds(JSON.stringify(curatorResult.digest) + JSON.stringify(curatorResult.compliance) + JSON.stringify(curatorResult.knowledge_recommendations ?? []));
554
+ if (!planMd) {
555
+ alignment = "MINOR_DRIFT";
556
+ driftScore = 0.3;
557
+ } else if (specRequirements.length > 0) {
558
+ const coveredInPlan = specRequirements.filter((fr) => planRequirements.some((ref) => bareSuffixCovers(fr, ref)));
559
+ const coveredInDigest = specRequirements.filter((fr) => digestRequirements.some((ref) => bareSuffixCovers(fr, ref)));
560
+ const specCoverageRatio = coveredInPlan.length / specRequirements.length;
561
+ const implementationRatio = coveredInDigest.length / specRequirements.length;
562
+ if (specCoverageRatio < 0.5) {
563
+ alignment = "MAJOR_DRIFT";
564
+ driftScore = Math.min(0.9, 0.6 + (1 - specCoverageRatio) * 0.3);
565
+ } else if (warningCompliance.length >= 3) {
566
+ alignment = "MAJOR_DRIFT";
567
+ driftScore = Math.min(0.9, 0.5 + warningCompliance.length * 0.1);
568
+ } else if (warningCompliance.length >= 1 || complianceCount >= 3) {
569
+ alignment = "MINOR_DRIFT";
570
+ driftScore = Math.min(0.49, 0.2 + complianceCount * 0.05);
571
+ } else if (implementationRatio < 0.5) {
572
+ alignment = "MINOR_DRIFT";
573
+ driftScore = Math.min(0.6, 0.2 + (1 - implementationRatio) * 0.3);
574
+ }
575
+ } else {
576
+ if (warningCompliance.length >= 3) {
577
+ alignment = "MAJOR_DRIFT";
578
+ driftScore = Math.min(0.9, 0.5 + warningCompliance.length * 0.1);
579
+ } else if (warningCompliance.length >= 1 || complianceCount >= 3) {
580
+ alignment = "MINOR_DRIFT";
581
+ driftScore = Math.min(0.49, 0.2 + complianceCount * 0.05);
582
+ }
583
+ }
584
+ const keyCorrections = warningCompliance.map((obs) => obs.description);
585
+ const firstDeviation = warningCompliance.length > 0 ? {
586
+ phase,
587
+ task: "unknown",
588
+ description: warningCompliance[0]?.description ?? ""
589
+ } : null;
590
+ const requirementsChecked = curatorResult.digest.tasks_total;
591
+ const requirementsSatisfied = curatorResult.digest.tasks_completed;
592
+ const coverageNote = specRequirements.length > 0 ? ` [${digestRequirements.filter((ref) => specRequirements.some((fr) => bareSuffixCovers(fr, ref))).length}/${specRequirements.length} FRs covered]` : "";
593
+ const injectionSummaryRaw = `Phase ${phase}: ${alignment} (${driftScore.toFixed(2)})${coverageNote} \u2014 ${firstDeviation ? firstDeviation.description : "all requirements on track"}.${keyCorrections.length > 0 ? `Correction: ${keyCorrections[0] ?? ""}.` : ""}`;
594
+ const injectionSummary = injectionSummaryRaw.slice(0, config.drift_inject_max_chars);
595
+ const report = {
596
+ schema_version: 1,
597
+ phase,
598
+ timestamp: new Date().toISOString(),
599
+ alignment,
600
+ drift_score: driftScore,
601
+ first_deviation: firstDeviation,
602
+ compounding_effects: priorReports.filter((r) => r.alignment !== "ALIGNED").map((r) => `Phase ${r.phase}: ${r.alignment}`).slice(0, 5),
603
+ corrections: keyCorrections.slice(0, 5),
604
+ requirements_checked: requirementsChecked,
605
+ requirements_satisfied: requirementsSatisfied,
606
+ scope_additions: [],
607
+ injection_summary: injectionSummary
608
+ };
609
+ const reportPath = await _internals4.writeDriftReport(directory, report);
610
+ getGlobalEventBus().publish("curator.drift.completed", {
611
+ phase,
612
+ alignment,
613
+ drift_score: driftScore,
614
+ report_path: reportPath
615
+ });
616
+ if (injectAdvisory && alignment !== "ALIGNED" && driftScore > 0) {
617
+ try {
618
+ const advisoryText = `CURATOR DRIFT DETECTED (phase ${phase}, score ${driftScore.toFixed(2)}): ${injectionSummary.slice(0, 300)}. Review the phase-${phase} drift report stored in .swarm/swarm.db (${phaseReportLocator("curator_drift", phase)}) and address spec alignment before proceeding. Consider running critic_drift_verifier before phase completion to get a proper drift review.`;
619
+ injectAdvisory(advisoryText);
620
+ } catch {}
621
+ }
622
+ const injectionText = injectionSummary;
623
+ return {
624
+ phase,
625
+ report,
626
+ report_path: reportPath,
627
+ injection_text: injectionText
628
+ };
629
+ } catch (err) {
630
+ getGlobalEventBus().publish("curator.error", {
631
+ operation: "drift",
632
+ phase,
633
+ error: String(err)
634
+ });
635
+ const defaultReport = {
636
+ schema_version: 1,
637
+ phase,
638
+ timestamp: new Date().toISOString(),
639
+ alignment: "ALIGNED",
640
+ drift_score: 0,
641
+ first_deviation: null,
642
+ compounding_effects: [],
643
+ corrections: [],
644
+ requirements_checked: 0,
645
+ requirements_satisfied: 0,
646
+ scope_additions: [],
647
+ injection_summary: `Phase ${phase}: drift analysis unavailable (${String(err)})`
648
+ };
649
+ return {
650
+ phase,
651
+ report: defaultReport,
652
+ report_path: "",
653
+ injection_text: ""
654
+ };
655
+ }
656
+ }
657
+ function buildDriftInjectionText(report, maxChars) {
658
+ if (maxChars <= 0) {
659
+ return "";
660
+ }
661
+ let text;
662
+ if (report.alignment === "ALIGNED" && report.drift_score < 0.1) {
663
+ text = `<drift_report>Phase ${report.phase}: ALIGNED, all requirements on track.</drift_report>`;
664
+ } else {
665
+ const keyFinding = report.first_deviation?.description ?? "no deviation recorded";
666
+ const score = report.drift_score ?? 0;
667
+ const correctionClause = report.corrections?.[0] ? `Correction: ${report.corrections[0]}.` : "";
668
+ text = `<drift_report>Phase ${report.phase}: ${report.alignment} (${score.toFixed(2)}) \u2014 ${keyFinding}. ${correctionClause}</drift_report>`;
669
+ }
670
+ return text.slice(0, maxChars);
671
+ }
672
+
673
+ export { canonicalProjectKey, getGroupCommitWriter, closeGroupCommitWriter, importLegacyJsonl, getGlobalEventBus, readPriorDriftReports, writeDriftReport, _internals4 as _internals, runDeterministicDriftCheck, buildDriftInjectionText };
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  computePlanStructureHash
4
- } from "./index-pqtmzee6.js";
4
+ } from "./index-fsye9ygy.js";
5
5
  import {
6
6
  appendCoreEventSync
7
- } from "./index-38cfx8g8.js";
7
+ } from "./index-427x3j6p.js";
8
8
  import {
9
9
  deleteCoordinationState,
10
10
  derivePlanId,
@@ -23,7 +23,7 @@ import {
23
23
  } from "./index-ry16d01s.js";
24
24
  import {
25
25
  assertProjectRoot
26
- } from "./index-ea9fk6v0.js";
26
+ } from "./index-ap6hs8fj.js";
27
27
  import {
28
28
  require_proper_lockfile
29
29
  } from "./index-7g4c7s5r.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  _internals,
4
4
  resolveWorktreeIsolationConfig
5
- } from "./index-hbe56wtn.js";
5
+ } from "./index-9s2rp2j5.js";
6
6
  import {
7
7
  ApprovalEvidenceSchema,
8
8
  BaseEvidenceSchema,
@@ -46,7 +46,7 @@ import {
46
46
  loadPluginConfigWithMeta,
47
47
  loadPluginConfigWithMetaAsync,
48
48
  resetConfigAdvisoryDedup
49
- } from "./index-n5a9dq5s.js";
49
+ } from "./index-6jrn46zy.js";
50
50
  import"./index-zxdawwc7.js";
51
51
  import {
52
52
  AUTO_REVIEW_V8_BURN_IN_DECISION,
@@ -72,7 +72,7 @@ import {
72
72
  TurboConfigSchema,
73
73
  WorktreeIsolationConfigSchema,
74
74
  resolveAutoReviewConfig
75
- } from "./index-5hxv1er2.js";
75
+ } from "./index-3ga3ts3h.js";
76
76
  import {
77
77
  ALL_AGENT_NAMES,
78
78
  ALL_SUBAGENT_NAMES,
package/dist/cli/index.js CHANGED
@@ -14,69 +14,69 @@ import {
14
14
  readCachePackageVersion,
15
15
  resolveCommand,
16
16
  safeRealpathSync
17
- } from "./index-ernt0wrg.js";
18
- import"./index-5q3xsqwm.js";
17
+ } from "./index-9eg8f4zm.js";
18
+ import"./index-gtpq64q7.js";
19
19
  import"./index-hamqvzqn.js";
20
- import"./index-m65tnv4j.js";
21
- import"./index-et7tg13p.js";
22
- import"./index-et28q7cp.js";
23
- import"./index-txx2mrsk.js";
24
- import"./index-s0zgz4p1.js";
20
+ import"./index-01r2wrwa.js";
21
+ import"./index-y03jadcy.js";
22
+ import"./index-dkprb20b.js";
23
+ import"./index-0ea0c676.js";
24
+ import"./index-sf51gh68.js";
25
25
  import"./index-txdagbh7.js";
26
- import"./index-m779twtf.js";
26
+ import"./index-rgfz80gt.js";
27
27
  import"./index-6b295cas.js";
28
- import"./index-vmwmwahh.js";
29
- import"./index-7nr9p5bd.js";
30
- import"./index-cr61qv27.js";
28
+ import"./index-x4am0jxt.js";
29
+ import"./index-54sd9bbn.js";
30
+ import"./index-1epynxc4.js";
31
31
  import"./index-rdec0y3z.js";
32
- import"./index-t93cp2tz.js";
32
+ import"./index-nw3z614g.js";
33
33
  import"./index-cjapb4hy.js";
34
34
  import"./index-zsrtt42s.js";
35
- import"./index-ehvkz2zv.js";
36
- import"./index-bdpgfep1.js";
37
- import"./index-92m05mew.js";
35
+ import"./index-r4vve32m.js";
36
+ import"./index-jrxrjz89.js";
37
+ import"./index-by9wfeja.js";
38
38
  import"./index-pt7h91zc.js";
39
39
  import"./index-q7sjgr1y.js";
40
- import"./index-kzmd4gs7.js";
41
- import"./index-5zy5k5w0.js";
42
- import"./index-2sqfrvxj.js";
43
- import"./index-1wpnt86a.js";
44
- import"./index-5v8zws0s.js";
45
- import"./index-gc6h1fmf.js";
40
+ import"./index-epq8am78.js";
41
+ import"./index-j97nc02q.js";
42
+ import"./index-v4h99xhr.js";
43
+ import"./index-1msszzg2.js";
44
+ import"./index-hqa71xfm.js";
45
+ import"./index-a2hvmc3a.js";
46
46
  import"./index-2s7dvzff.js";
47
- import"./index-wph45kyb.js";
48
- import"./index-6gcxgx84.js";
47
+ import"./index-4qpz7mpn.js";
48
+ import"./index-s34y6gbh.js";
49
49
  import"./index-rtry5xyf.js";
50
- import"./index-hbe56wtn.js";
50
+ import"./index-9s2rp2j5.js";
51
51
  import"./index-frcemc0b.js";
52
52
  import"./index-0725jpp7.js";
53
- import"./index-dpxg347z.js";
54
- import"./index-pqtmzee6.js";
55
- import"./index-38cfx8g8.js";
53
+ import"./index-y28np6j9.js";
54
+ import"./index-fsye9ygy.js";
55
+ import"./index-427x3j6p.js";
56
56
  import"./index-ved1325w.js";
57
57
  import"./index-w1ydvzef.js";
58
58
  import"./index-vvgpgcyn.js";
59
59
  import"./index-rdm3px0g.js";
60
60
  import"./index-ry16d01s.js";
61
- import"./index-516j9vsk.js";
62
- import"./index-qw9aqays.js";
61
+ import"./index-kkrbybgt.js";
62
+ import"./index-dwc1wztn.js";
63
63
  import"./index-vzm6zre7.js";
64
64
  import"./index-ae75rja9.js";
65
- import"./index-12ewkms0.js";
66
- import"./index-ea9fk6v0.js";
67
- import"./index-6mwha20t.js";
65
+ import"./index-23mdeh2a.js";
66
+ import"./index-ap6hs8fj.js";
67
+ import"./index-mkpdcbye.js";
68
68
  import"./index-1xnse449.js";
69
69
  import"./index-c1ggtmpm.js";
70
70
  import"./index-ejhxgyvm.js";
71
71
  import"./index-7g4c7s5r.js";
72
72
  import"./index-989v83pb.js";
73
73
  import"./index-gx2vp8gx.js";
74
- import"./index-n5a9dq5s.js";
74
+ import"./index-6jrn46zy.js";
75
75
  import"./index-zxdawwc7.js";
76
76
  import {
77
77
  init_package,
78
78
  package_default
79
- } from "./index-5hxv1er2.js";
79
+ } from "./index-3ga3ts3h.js";
80
80
  import {
81
81
  DEFAULT_AGENT_CONFIGS,
82
82
  init_constants
@@ -644,7 +644,7 @@ async function main() {
644
644
  const exitCode = await run(["ci", ...args.slice(1)]);
645
645
  process.exit(exitCode);
646
646
  } else if (command === "mcp") {
647
- const { handleMcpCommand } = await import("./mcp-h82hxnxr.js");
647
+ const { handleMcpCommand } = await import("./mcp-208jwxps.js");
648
648
  const exitCode = await handleMcpCommand(args.slice(1));
649
649
  process.exit(exitCode);
650
650
  } else {
@@ -9,29 +9,29 @@ import {
9
9
  maybeEscalateOnViolation,
10
10
  maybeQuarantineOnContradiction,
11
11
  readRecentEscalations
12
- } from "./index-7nr9p5bd.js";
13
- import"./index-5v8zws0s.js";
14
- import"./index-gc6h1fmf.js";
12
+ } from "./index-54sd9bbn.js";
13
+ import"./index-hqa71xfm.js";
14
+ import"./index-a2hvmc3a.js";
15
15
  import"./index-2s7dvzff.js";
16
- import"./index-hbe56wtn.js";
16
+ import"./index-9s2rp2j5.js";
17
17
  import"./index-frcemc0b.js";
18
18
  import"./index-0725jpp7.js";
19
- import"./index-516j9vsk.js";
20
- import"./index-qw9aqays.js";
19
+ import"./index-kkrbybgt.js";
20
+ import"./index-dwc1wztn.js";
21
21
  import"./index-vzm6zre7.js";
22
22
  import"./index-ae75rja9.js";
23
- import"./index-12ewkms0.js";
24
- import"./index-ea9fk6v0.js";
25
- import"./index-6mwha20t.js";
23
+ import"./index-23mdeh2a.js";
24
+ import"./index-ap6hs8fj.js";
25
+ import"./index-mkpdcbye.js";
26
26
  import"./index-1xnse449.js";
27
27
  import"./index-c1ggtmpm.js";
28
28
  import"./index-ejhxgyvm.js";
29
29
  import"./index-7g4c7s5r.js";
30
30
  import"./index-989v83pb.js";
31
31
  import"./index-gx2vp8gx.js";
32
- import"./index-n5a9dq5s.js";
32
+ import"./index-6jrn46zy.js";
33
33
  import"./index-zxdawwc7.js";
34
- import"./index-5hxv1er2.js";
34
+ import"./index-3ga3ts3h.js";
35
35
  import"./index-2t21pv2v.js";
36
36
  import"./index-bk5tah7q.js";
37
37
  import"./index-gknz3bv1.js";
@@ -29,26 +29,26 @@ import {
29
29
  resolveKnowledgeCounterBaselinePath,
30
30
  resolveKnowledgeEventsPath,
31
31
  resolveLegacyApplicationLogPath
32
- } from "./index-5v8zws0s.js";
33
- import"./index-gc6h1fmf.js";
32
+ } from "./index-hqa71xfm.js";
33
+ import"./index-a2hvmc3a.js";
34
34
  import"./index-2s7dvzff.js";
35
- import"./index-hbe56wtn.js";
35
+ import"./index-9s2rp2j5.js";
36
36
  import"./index-frcemc0b.js";
37
37
  import"./index-0725jpp7.js";
38
- import"./index-516j9vsk.js";
38
+ import"./index-kkrbybgt.js";
39
39
  import"./index-ae75rja9.js";
40
- import"./index-12ewkms0.js";
41
- import"./index-ea9fk6v0.js";
42
- import"./index-6mwha20t.js";
40
+ import"./index-23mdeh2a.js";
41
+ import"./index-ap6hs8fj.js";
42
+ import"./index-mkpdcbye.js";
43
43
  import"./index-1xnse449.js";
44
44
  import"./index-c1ggtmpm.js";
45
45
  import"./index-ejhxgyvm.js";
46
46
  import"./index-7g4c7s5r.js";
47
47
  import"./index-989v83pb.js";
48
48
  import"./index-gx2vp8gx.js";
49
- import"./index-n5a9dq5s.js";
49
+ import"./index-6jrn46zy.js";
50
50
  import"./index-zxdawwc7.js";
51
- import"./index-5hxv1er2.js";
51
+ import"./index-3ga3ts3h.js";
52
52
  import"./index-2t21pv2v.js";
53
53
  import"./index-bk5tah7q.js";
54
54
  import"./index-gknz3bv1.js";
@@ -12,9 +12,9 @@ import {
12
12
  resolveLinkDir,
13
13
  sanitizeLinkId,
14
14
  writeLinkPointer
15
- } from "./index-12ewkms0.js";
16
- import"./index-ea9fk6v0.js";
17
- import"./index-6mwha20t.js";
15
+ } from "./index-23mdeh2a.js";
16
+ import"./index-ap6hs8fj.js";
17
+ import"./index-mkpdcbye.js";
18
18
  import"./index-1xnse449.js";
19
19
  import"./index-c1ggtmpm.js";
20
20
  import"./index-ejhxgyvm.js";
@@ -43,14 +43,14 @@ import {
43
43
  transactKnowledge,
44
44
  transactKnowledgeWithCas,
45
45
  wordBigrams
46
- } from "./index-qw9aqays.js";
46
+ } from "./index-dwc1wztn.js";
47
47
  import"./index-vzm6zre7.js";
48
48
  import {
49
49
  resolveHiveDataDir
50
50
  } from "./index-ae75rja9.js";
51
- import"./index-12ewkms0.js";
52
- import"./index-ea9fk6v0.js";
53
- import"./index-6mwha20t.js";
51
+ import"./index-23mdeh2a.js";
52
+ import"./index-ap6hs8fj.js";
53
+ import"./index-mkpdcbye.js";
54
54
  import"./index-1xnse449.js";
55
55
  import"./index-c1ggtmpm.js";
56
56
  import"./index-ejhxgyvm.js";
@@ -23,15 +23,15 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-wph45kyb.js";
27
- import"./index-6gcxgx84.js";
26
+ } from "./index-4qpz7mpn.js";
27
+ import"./index-s34y6gbh.js";
28
28
  import"./index-rtry5xyf.js";
29
- import"./index-qw9aqays.js";
29
+ import"./index-dwc1wztn.js";
30
30
  import"./index-vzm6zre7.js";
31
31
  import"./index-ae75rja9.js";
32
- import"./index-12ewkms0.js";
33
- import"./index-ea9fk6v0.js";
34
- import"./index-6mwha20t.js";
32
+ import"./index-23mdeh2a.js";
33
+ import"./index-ap6hs8fj.js";
34
+ import"./index-mkpdcbye.js";
35
35
  import"./index-1xnse449.js";
36
36
  import"./index-c1ggtmpm.js";
37
37
  import"./index-ejhxgyvm.js";
@@ -81,7 +81,7 @@ function resolveMcpRoot(input) {
81
81
  }
82
82
  var _internals = {
83
83
  runMcpServer: async (options) => {
84
- const { runMcpServer } = await import("./server-axnran6h.js");
84
+ const { runMcpServer } = await import("./server-t2edntv4.js");
85
85
  return runMcpServer(options);
86
86
  }
87
87
  };