opencode-swarm 7.164.11 → 7.164.12

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 (107) hide show
  1. package/.opencode/skills/engineering-conventions/SKILL.md +1 -1
  2. package/dist/background/pending-delegations.d.ts +7 -2
  3. package/dist/background/pr-subscriptions.d.ts +3 -3
  4. package/dist/cli/{coder-settlement-0rfk8y11.js → coder-settlement-yh1q5fr3.js} +15 -16
  5. package/dist/cli/{config-doctor-j17b7qq2.js → config-doctor-bd4yzmh7.js} +3 -3
  6. package/dist/cli/{core-evhjjrtt.js → core-y0s1vmyc.js} +2 -2
  7. package/dist/cli/{curation-policy-vj6z5hvr.js → curation-policy-gs1qakn7.js} +5 -6
  8. package/dist/cli/{curator-vqd5yeck.js → curator-brqack0j.js} +48 -46
  9. package/dist/cli/{curator-drift-ez81vg2t.js → curator-drift-1sg9yk2m.js} +14 -12
  10. package/dist/cli/curator-llm-factory-dtsjc3zf.js +70 -0
  11. package/dist/cli/{dispatch-dqybvj8v.js → dispatch-c7xjt7js.js} +3 -3
  12. package/dist/cli/{evidence-summary-service-937x7rbg.js → evidence-summary-service-nqbcvp30.js} +24 -23
  13. package/dist/cli/{gate-evidence-q1cehr4k.js → gate-evidence-9stdtpej.js} +9 -10
  14. package/dist/cli/guardrail-explain-3ff1z3fm.js +71 -0
  15. package/dist/cli/{guardrail-log-3g93f3g2.js → guardrail-log-sf39x00b.js} +10 -10
  16. package/dist/cli/{guardrail-reset-qe2r5qzq.js → guardrail-reset-9wr6a60s.js} +48 -46
  17. package/dist/cli/hive-promoter-bqtj8261.js +85 -0
  18. package/dist/cli/{index-kv2tdkk5.js → index-03enxdaq.js} +1 -1
  19. package/dist/cli/{index-ggrp3v00.js → index-0byep4pe.js} +15 -17
  20. package/dist/cli/{index-2bgr671r.js → index-2bhz5k91.js} +20 -2
  21. package/dist/cli/{index-mmjamc9b.js → index-3fnym6ac.js} +5 -5
  22. package/dist/cli/{index-d9entpn3.js → index-40twgsyh.js} +4 -4
  23. package/dist/cli/{index-ggtmsm84.js → index-4mjmnysc.js} +1 -1
  24. package/dist/cli/{index-e90em0x4.js → index-4vb56w2k.js} +12 -17
  25. package/dist/cli/{index-r656jh9j.js → index-5wc5pbzc.js} +3700 -2609
  26. package/dist/cli/{index-w3gtqey0.js → index-6chhqq2n.js} +4 -4
  27. package/dist/cli/{index-qbw3yw2d.js → index-888pq4xx.js} +11 -11
  28. package/dist/cli/{index-3146wmgv.js → index-8d90gzaz.js} +1 -1
  29. package/dist/cli/{index-5jx22kwc.js → index-8vw2pjgr.js} +544 -15
  30. package/dist/cli/{index-b2nj04q6.js → index-9ss2m4rs.js} +1 -434
  31. package/dist/cli/{index-x43debgx.js → index-ad9064j9.js} +15 -17
  32. package/dist/cli/{index-5kcvrpkt.js → index-b25t91a3.js} +1 -1
  33. package/dist/cli/index-c45662wc.js +361 -0
  34. package/dist/cli/{index-aqppaaqx.js → index-cgewrpw5.js} +3 -2
  35. package/dist/cli/{index-zfs3zqeq.js → index-d3mpxsmy.js} +771 -21
  36. package/dist/cli/{index-y1yqmkv7.js → index-d7j3n5ra.js} +52 -50
  37. package/dist/cli/{index-4vb6qa73.js → index-ebce775n.js} +36 -2
  38. package/dist/cli/{index-dsg9dw3b.js → index-eed0gkv6.js} +2 -2
  39. package/dist/cli/index-es64amqt.js +675 -0
  40. package/dist/cli/{index-9gxbjkts.js → index-ewv8qa8q.js} +22 -19
  41. package/dist/cli/{index-1ww7wj8d.js → index-hb7bh4r2.js} +15 -15
  42. package/dist/cli/{index-kc2tgcm7.js → index-hg09xemc.js} +4 -4
  43. package/dist/cli/{index-w95vxjde.js → index-hvz4ad2t.js} +39 -8
  44. package/dist/cli/{index-77z98j76.js → index-k0s8n6m5.js} +314 -130
  45. package/dist/cli/{index-7m32fjb4.js → index-kxv193aq.js} +9 -9
  46. package/dist/cli/{index-hp22pzn5.js → index-m8xrbdmn.js} +2 -2
  47. package/dist/cli/{index-4gqxppcx.js → index-mee9maf5.js} +2 -2
  48. package/dist/cli/{index-r3mvsbtq.js → index-p612v1mv.js} +7 -1
  49. package/dist/cli/{index-r5q5gd2a.js → index-qgajv9rd.js} +2 -2
  50. package/dist/cli/{index-zjg4chy2.js → index-qqq04n70.js} +2 -2
  51. package/dist/cli/{index-ww6zm5hr.js → index-r2p0pgst.js} +3 -3
  52. package/dist/cli/{index-47kh2103.js → index-r69gzes2.js} +14 -14
  53. package/dist/cli/{index-vdn32nws.js → index-sphahrmq.js} +3 -3
  54. package/dist/cli/{index-rhqdsc1x.js → index-vw66q1rw.js} +9 -9
  55. package/dist/cli/{index-kch6yenm.js → index-wasdrhev.js} +7 -7
  56. package/dist/cli/{index-c5v1w13g.js → index-wknpkfm8.js} +807 -629
  57. package/dist/cli/{index-pp2nya9v.js → index-x39hjdf1.js} +2 -4
  58. package/dist/cli/{index-n8688d12.js → index-xxfk62zd.js} +2 -2
  59. package/dist/cli/index-yvqg6kn5.js +429 -0
  60. package/dist/cli/{index-nqsj0g5y.js → index-ztm0q26v.js} +8 -8
  61. package/dist/cli/index.js +50 -48
  62. package/dist/cli/{knowledge-escalator-j04g450p.js → knowledge-escalator-01vva51d.js} +17 -18
  63. package/dist/cli/{knowledge-events-53z45rs0.js → knowledge-events-dpfwh1hs.js} +15 -16
  64. package/dist/cli/{knowledge-link-a6kfg3qm.js → knowledge-link-2rvp966j.js} +4 -5
  65. package/dist/cli/{knowledge-store-whm0gagt.js → knowledge-store-aw58ae7b.js} +6 -7
  66. package/dist/cli/{knowledge-validator-h8m7065g.js → knowledge-validator-yhd31ryf.js} +8 -9
  67. package/dist/cli/{pending-delegations-6hkpe5ze.js → pending-delegations-fjetcz8e.js} +17 -8
  68. package/dist/cli/{pr-subscriptions-11zca1mh.js → pr-subscriptions-cwwtfs8w.js} +17 -8
  69. package/dist/cli/{pr-workflow-gate-6g29rkg7.js → pr-workflow-gate-5xwtg1k2.js} +50 -48
  70. package/dist/cli/{runner-5abw3t35.js → runner-mb51twxt.js} +6 -7
  71. package/dist/cli/{scan-cursor-mkfx410t.js → scan-cursor-j11qwf0v.js} +9 -10
  72. package/dist/cli/{schema-jbbam3ev.js → schema-0xp3bde3.js} +1 -1
  73. package/dist/cli/{scope-persistence-q1ct4k42.js → scope-persistence-brrk806y.js} +19 -12
  74. package/dist/cli/{skill-generator-cv8fg96x.js → skill-generator-j8qzmet9.js} +20 -21
  75. package/dist/cli/snapshot-coordination-init-h0xmtftq.js +84 -0
  76. package/dist/cli/{telemetry-mbqqamsj.js → telemetry-m84ap0pp.js} +1 -1
  77. package/dist/cli/{workspace-snapshot-eh18vgkn.js → workspace-snapshot-6z9rk7xw.js} +3 -3
  78. package/dist/cli/{worktree-collision-ownership-xgnn8dsq.js → worktree-collision-ownership-j9zykj18.js} +21 -12
  79. package/dist/cli/{worktree-isolation-k2dgfmeg.js → worktree-isolation-jd39xz6h.js} +48 -46
  80. package/dist/commands/close.d.ts +13 -6
  81. package/dist/commands/reset-session.d.ts +4 -0
  82. package/dist/db/coordination-store.d.ts +85 -0
  83. package/dist/db/durability.d.ts +22 -5
  84. package/dist/db/index.d.ts +1 -0
  85. package/dist/db/project-db.d.ts +12 -0
  86. package/dist/index.js +810 -705
  87. package/dist/memory/schema.d.ts +3 -3
  88. package/dist/pr-review/authorization.d.ts +5 -4
  89. package/dist/pr-review/persistence.d.ts +10 -1
  90. package/dist/scope/scope-binding.d.ts +10 -0
  91. package/dist/scope/scope-persistence.d.ts +10 -0
  92. package/dist/services/handoff-service.d.ts +2 -0
  93. package/dist/services/status-service.d.ts +4 -0
  94. package/dist/session/snapshot-coordination-init.d.ts +49 -0
  95. package/dist/session/snapshot-reader.d.ts +2 -0
  96. package/dist/session/snapshot-store.d.ts +42 -0
  97. package/dist/session/snapshot-writer.d.ts +4 -1
  98. package/dist/state.d.ts +6 -3
  99. package/dist/turbo/epic/state.d.ts +4 -20
  100. package/dist/utils/bun-compat.d.ts +10 -0
  101. package/dist/utils/external-tool-runner.d.ts +2 -0
  102. package/package.json +3 -2
  103. package/dist/cli/curator-llm-factory-sxcpmcqq.js +0 -68
  104. package/dist/cli/guardrail-explain-xv9aw1bf.js +0 -69
  105. package/dist/cli/hive-promoter-09yc9mp5.js +0 -83
  106. package/dist/cli/index-xnb3tk7x.js +0 -24
  107. package/dist/cli/{ast-diff-ekd9v10f.js → ast-diff-b0esr2kf.js} +3 -3
@@ -1,10 +1,4 @@
1
1
  // @bun
2
- import {
3
- loadDatabaseCtor
4
- } from "./index-n4fzmqz8.js";
5
- import {
6
- canonicalExistingFilesystemPath
7
- } from "./index-ry16d01s.js";
8
2
  import {
9
3
  validateSpecContent
10
4
  } from "./index-n832052r.js";
@@ -12,13 +6,6 @@ import {
12
6
  advisoryWarn,
13
7
  init_warning_buffer
14
8
  } from "./index-4rhhvd1a.js";
15
- import {
16
- canonicalRootKeyFresh,
17
- lexicalRootAliasKey
18
- } from "./index-7qefgq4j.js";
19
- import {
20
- atomicWriteSwarmFileSync
21
- } from "./index-9gxbjkts.js";
22
9
 
23
10
  // src/sdd/effective-spec.ts
24
11
  import { createHash } from "crypto";
@@ -704,424 +691,4 @@ function validateSpeckit(directory, options = {}) {
704
691
  return { resolution, problems };
705
692
  }
706
693
 
707
- // src/db/durability.ts
708
- var DURABILITY_CLASSES = {
709
- qa_gate_profile: "full",
710
- qa_gate_profile_identity: "full",
711
- task_checkpoint_receipt: "full",
712
- insight_candidate: "normal",
713
- phase_report: "normal",
714
- project_constraints: "normal",
715
- migration_failures: "normal",
716
- schema_migrations: "normal"
717
- };
718
- function batchDurabilityClass(classes) {
719
- for (const cls of classes) {
720
- if (cls === "full")
721
- return "full";
722
- }
723
- return "normal";
724
- }
725
- function applySynchronousForClass(db, cls) {
726
- db.run(cls === "full" ? "PRAGMA synchronous = FULL;" : "PRAGMA synchronous = NORMAL;");
727
- }
728
- function withDurabilityClass(db, cls, fn) {
729
- applySynchronousForClass(db, cls);
730
- try {
731
- return fn();
732
- } finally {
733
- applySynchronousForClass(db, "normal");
734
- }
735
- }
736
-
737
- // src/db/project-db.ts
738
- import { existsSync as existsSync2, mkdirSync as mkdirSync2, unlinkSync } from "fs";
739
- import { join as join2 } from "path";
740
-
741
- // src/db/db-errors.ts
742
- class ProjectDbError extends Error {
743
- category;
744
- constructor(category, message) {
745
- super(message);
746
- this.name = "ProjectDbError";
747
- this.category = category;
748
- }
749
- }
750
-
751
- class DbWriteError extends Error {
752
- category;
753
- constructor(category, message) {
754
- super(message);
755
- this.name = "DbWriteError";
756
- this.category = category;
757
- }
758
- }
759
- function classifyDbWriteError(err) {
760
- const errno = err?.code;
761
- if (errno === "ENOSPC")
762
- return "disk_full";
763
- if (errno === "EACCES" || errno === "EROFS" || errno === "EPERM")
764
- return "read_only";
765
- const message = err instanceof Error ? err.message : String(err);
766
- const upper = message.toUpperCase();
767
- if (upper.includes("SQLITE_FULL") || upper.includes("DATABASE OR DISK IS FULL")) {
768
- return "disk_full";
769
- }
770
- if (upper.includes("SQLITE_READONLY") || upper.includes("ATTEMPT TO WRITE A READONLY")) {
771
- return "read_only";
772
- }
773
- if (upper.includes("SQLITE_CORRUPT") || upper.includes("DATABASE DISK IMAGE IS MALFORMED") || upper.includes("NOT A DATABASE")) {
774
- return "corrupt";
775
- }
776
- if (upper.includes("SQLITE_BUSY") || upper.includes("DATABASE IS LOCKED")) {
777
- return "busy";
778
- }
779
- return "unknown";
780
- }
781
-
782
- // src/db/project-db.ts
783
- var MIGRATION_FAILURE_ERROR_MAX_CHARS = 500;
784
- var MIGRATION_FAILURE_MARKER = "db-migration-failure.json";
785
- var MIGRATIONS = [
786
- {
787
- version: 1,
788
- name: "create_project_constraints",
789
- sql: `CREATE TABLE project_constraints (
790
- id INTEGER PRIMARY KEY AUTOINCREMENT,
791
- constraint_type TEXT NOT NULL,
792
- content TEXT NOT NULL,
793
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
794
- )`
795
- },
796
- {
797
- version: 2,
798
- name: "create_qa_gate_profile",
799
- sql: `CREATE TABLE qa_gate_profile (
800
- id INTEGER PRIMARY KEY AUTOINCREMENT,
801
- plan_id TEXT NOT NULL UNIQUE,
802
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
803
- project_type TEXT,
804
- gates TEXT NOT NULL DEFAULT '{}',
805
- locked_at TEXT,
806
- locked_by_snapshot_seq INTEGER
807
- )`
808
- },
809
- {
810
- version: 3,
811
- name: "create_qa_gate_profile_immutability_trigger",
812
- sql: `CREATE TRIGGER IF NOT EXISTS trg_qa_gate_profile_no_update_after_lock
813
- BEFORE UPDATE ON qa_gate_profile
814
- WHEN OLD.locked_at IS NOT NULL
815
- BEGIN
816
- SELECT RAISE(ABORT, 'qa_gate_profile row is locked and cannot be modified after critic approval');
817
- END`
818
- },
819
- {
820
- version: 4,
821
- name: "add_qa_gate_profile_raw_swarm",
822
- sql: "ALTER TABLE qa_gate_profile ADD COLUMN raw_swarm TEXT"
823
- },
824
- {
825
- version: 5,
826
- name: "add_qa_gate_profile_raw_title",
827
- sql: "ALTER TABLE qa_gate_profile ADD COLUMN raw_title TEXT"
828
- },
829
- {
830
- version: 6,
831
- name: "add_qa_gate_profile_identity_hash",
832
- sql: "ALTER TABLE qa_gate_profile ADD COLUMN identity_hash TEXT"
833
- },
834
- {
835
- version: 7,
836
- name: "create_qa_gate_profile_identity_hash_index",
837
- sql: `CREATE UNIQUE INDEX IF NOT EXISTS idx_qa_gate_profile_identity_hash
838
- ON qa_gate_profile(identity_hash)
839
- WHERE identity_hash IS NOT NULL`
840
- },
841
- {
842
- version: 8,
843
- name: "create_qa_gate_profile_identity",
844
- sql: `CREATE TABLE qa_gate_profile_identity (
845
- identity_hash TEXT PRIMARY KEY,
846
- profile_id INTEGER NOT NULL UNIQUE REFERENCES qa_gate_profile(id) ON DELETE CASCADE,
847
- raw_swarm TEXT NOT NULL,
848
- raw_title TEXT NOT NULL,
849
- readable_plan_id TEXT NOT NULL
850
- )`
851
- },
852
- {
853
- version: 9,
854
- name: "create_qa_gate_profile_identity_readable_plan_index",
855
- sql: `CREATE INDEX idx_qa_gate_profile_identity_readable_plan_id
856
- ON qa_gate_profile_identity(readable_plan_id)`
857
- },
858
- {
859
- version: 10,
860
- name: "backfill_qa_gate_profile_identity_from_legacy_columns",
861
- sql: `INSERT INTO qa_gate_profile_identity (
862
- identity_hash,
863
- profile_id,
864
- raw_swarm,
865
- raw_title,
866
- readable_plan_id
867
- )
868
- SELECT
869
- identity_hash,
870
- id,
871
- raw_swarm,
872
- raw_title,
873
- plan_id
874
- FROM qa_gate_profile
875
- WHERE identity_hash IS NOT NULL
876
- AND raw_swarm IS NOT NULL
877
- AND raw_title IS NOT NULL
878
- AND NOT EXISTS (
879
- SELECT 1
880
- FROM qa_gate_profile_identity AS qi
881
- WHERE qi.profile_id = qa_gate_profile.id
882
- )`
883
- },
884
- {
885
- version: 11,
886
- name: "create_task_checkpoint_receipt",
887
- sql: `CREATE TABLE task_checkpoint_receipt (
888
- plan_identity_hash TEXT NOT NULL,
889
- task_id TEXT NOT NULL,
890
- label TEXT NOT NULL,
891
- state TEXT NOT NULL CHECK(state IN ('pending', 'committed', 'logged')),
892
- sha TEXT,
893
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
894
- updated_at TEXT NOT NULL DEFAULT (datetime('now')),
895
- PRIMARY KEY(plan_identity_hash, task_id)
896
- )`
897
- },
898
- {
899
- version: 12,
900
- name: "add_task_checkpoint_receipt_completion_generation",
901
- sql: `ALTER TABLE task_checkpoint_receipt
902
- ADD COLUMN generation INTEGER NOT NULL DEFAULT 1;
903
- ALTER TABLE task_checkpoint_receipt
904
- ADD COLUMN completion_active INTEGER NOT NULL DEFAULT 1
905
- CHECK(completion_active IN (0, 1))`
906
- },
907
- {
908
- version: 13,
909
- name: "bind_task_checkpoint_receipt_to_completion_ledger_seq",
910
- sql: `ALTER TABLE task_checkpoint_receipt
911
- ADD COLUMN completion_ledger_seq INTEGER
912
- CHECK(completion_ledger_seq IS NULL OR completion_ledger_seq >= 0)`
913
- },
914
- {
915
- version: 14,
916
- name: "create_migration_failures",
917
- sql: `CREATE TABLE IF NOT EXISTS migration_failures (
918
- id INTEGER PRIMARY KEY AUTOINCREMENT,
919
- version INTEGER NOT NULL,
920
- name TEXT NOT NULL,
921
- error TEXT NOT NULL,
922
- failed_at TEXT NOT NULL DEFAULT (datetime('now'))
923
- )`
924
- },
925
- {
926
- version: 15,
927
- name: "create_insight_candidate_stream",
928
- sql: `CREATE TABLE IF NOT EXISTS insight_candidate (
929
- stream_id TEXT NOT NULL,
930
- version INTEGER NOT NULL,
931
- payload TEXT NOT NULL,
932
- created_at TEXT NOT NULL,
933
- consumed_at TEXT,
934
- PRIMARY KEY(stream_id, version)
935
- )`
936
- },
937
- {
938
- version: 16,
939
- name: "create_insight_candidate_pending_index",
940
- sql: `CREATE INDEX IF NOT EXISTS idx_insight_candidate_pending
941
- ON insight_candidate(stream_id, version)
942
- WHERE consumed_at IS NULL`
943
- },
944
- {
945
- version: 17,
946
- name: "create_phase_report",
947
- sql: `CREATE TABLE IF NOT EXISTS phase_report (
948
- kind TEXT NOT NULL CHECK(kind IN ('curator_drift', 'design_doc_drift')),
949
- phase INTEGER NOT NULL,
950
- payload TEXT NOT NULL,
951
- updated_at TEXT NOT NULL DEFAULT (datetime('now')),
952
- PRIMARY KEY(kind, phase)
953
- )`
954
- }
955
- ];
956
- var _projectDbs = new Map;
957
- var _projectDbAliases = new Map;
958
- var MAX_ALIASES_PER_PROJECT_DB = 128;
959
- function lexicalAliasKey(directory) {
960
- return lexicalRootAliasKey(directory);
961
- }
962
- function unbindAlias(alias, physicalKey) {
963
- if (_projectDbAliases.get(alias) === physicalKey) {
964
- _projectDbAliases.delete(alias);
965
- }
966
- _projectDbs.get(physicalKey)?.aliases.delete(alias);
967
- }
968
- function bindAlias(record, physicalKey, alias) {
969
- const previousKey = _projectDbAliases.get(alias);
970
- if (previousKey !== undefined && previousKey !== physicalKey) {
971
- unbindAlias(alias, previousKey);
972
- }
973
- record.aliases.delete(alias);
974
- record.aliases.add(alias);
975
- _projectDbAliases.set(alias, physicalKey);
976
- while (record.aliases.size > MAX_ALIASES_PER_PROJECT_DB) {
977
- const evicted = [...record.aliases].find((candidate) => candidate !== record.primaryAlias && candidate !== alias);
978
- if (evicted === undefined)
979
- break;
980
- unbindAlias(evicted, physicalKey);
981
- }
982
- }
983
- function closeRecord(physicalKey, record) {
984
- record.db.close();
985
- _projectDbs.delete(physicalKey);
986
- for (const alias of [...record.aliases])
987
- unbindAlias(alias, physicalKey);
988
- }
989
- function recordMigrationFailure(db, migration, err, markerDir) {
990
- const errorText = String(err instanceof Error ? err.message : err).slice(0, MIGRATION_FAILURE_ERROR_MAX_CHARS);
991
- try {
992
- db.run("INSERT INTO migration_failures (version, name, error) VALUES (?, ?, ?)", [migration.version, migration.name, errorText]);
993
- return;
994
- } catch {}
995
- if (!markerDir)
996
- return;
997
- try {
998
- atomicWriteSwarmFileSync(join2(markerDir, MIGRATION_FAILURE_MARKER), JSON.stringify({
999
- schema_version: 1,
1000
- version: migration.version,
1001
- name: migration.name,
1002
- error: errorText,
1003
- failed_at: new Date().toISOString()
1004
- }, null, 2));
1005
- } catch {}
1006
- }
1007
- function removeMigrationFailureMarker(markerDir) {
1008
- const marker = join2(markerDir, MIGRATION_FAILURE_MARKER);
1009
- if (!existsSync2(marker))
1010
- return;
1011
- try {
1012
- unlinkSync(marker);
1013
- } catch {}
1014
- }
1015
- function isConcurrentMigrationApply(err) {
1016
- const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();
1017
- if (msg.includes("unique constraint failed: schema_migrations"))
1018
- return true;
1019
- return msg.includes("already exists") && (msg.includes("table") || msg.includes("index") || msg.includes("trigger"));
1020
- }
1021
- function currentVersionNowCovers(db, version) {
1022
- const row = db.query("SELECT MAX(version) as version FROM schema_migrations").get();
1023
- return (row?.version ?? 0) >= version;
1024
- }
1025
- function runProjectMigrations(db, markerDir) {
1026
- db.run(`CREATE TABLE IF NOT EXISTS schema_migrations (
1027
- version INTEGER PRIMARY KEY,
1028
- name TEXT NOT NULL,
1029
- applied_at TEXT NOT NULL DEFAULT (datetime('now'))
1030
- )`);
1031
- const row = db.query("SELECT MAX(version) as version FROM schema_migrations").get();
1032
- const currentVersion = row?.version ?? 0;
1033
- for (const migration of MIGRATIONS) {
1034
- if (migration.version <= currentVersion)
1035
- continue;
1036
- const apply = db.transaction(() => {
1037
- db.run(migration.sql);
1038
- db.run("INSERT INTO schema_migrations (version, name) VALUES (?, ?)", [
1039
- migration.version,
1040
- migration.name
1041
- ]);
1042
- });
1043
- try {
1044
- apply();
1045
- } catch (err) {
1046
- if (isConcurrentMigrationApply(err) && currentVersionNowCovers(db, migration.version)) {
1047
- continue;
1048
- }
1049
- recordMigrationFailure(db, migration, err, markerDir);
1050
- throw new ProjectDbError("migration_failed", `swarm.db migration v${migration.version} (${migration.name}) failed: ${err instanceof Error ? err.message : String(err)}`);
1051
- }
1052
- }
1053
- if (markerDir)
1054
- removeMigrationFailureMarker(markerDir);
1055
- }
1056
- function projectDbPath(directory) {
1057
- return join2(canonicalRootKeyFresh(directory), ".swarm", "swarm.db");
1058
- }
1059
- function projectDbExists(directory) {
1060
- return existsSync2(projectDbPath(directory));
1061
- }
1062
- function getProjectDb(directory) {
1063
- mkdirSync2(directory, { recursive: true });
1064
- const key = canonicalRootKeyFresh(directory);
1065
- const alias = lexicalAliasKey(directory);
1066
- const existing = _projectDbs.get(key);
1067
- if (existing) {
1068
- bindAlias(existing, key, alias);
1069
- return existing.db;
1070
- }
1071
- const swarmDir = join2(key, ".swarm");
1072
- try {
1073
- mkdirSync2(swarmDir, { recursive: true });
1074
- } catch (err) {
1075
- throw new ProjectDbError("mkdir_failed", `Failed to create .swarm/ for project ${key}: ${err instanceof Error ? err.message : String(err)}`);
1076
- }
1077
- let db;
1078
- try {
1079
- let Db;
1080
- try {
1081
- Db = loadDatabaseCtor();
1082
- } catch (err) {
1083
- throw new ProjectDbError("driver_unavailable", `Failed to resolve a SQLite driver for project ${key}: ${err instanceof Error ? err.message : String(err)}`);
1084
- }
1085
- db = new Db(join2(swarmDir, "swarm.db"));
1086
- db.run("PRAGMA journal_mode = WAL;");
1087
- db.run("PRAGMA synchronous = NORMAL;");
1088
- db.run("PRAGMA busy_timeout = 5000;");
1089
- db.run("PRAGMA foreign_keys = ON;");
1090
- runProjectMigrations(db, swarmDir);
1091
- } catch (err) {
1092
- if (db) {
1093
- try {
1094
- db.close();
1095
- } catch {}
1096
- }
1097
- if (err instanceof ProjectDbError)
1098
- throw err;
1099
- throw new ProjectDbError("open_failed", `Failed to open .swarm/swarm.db for project ${key}: ${err instanceof Error ? err.message : String(err)}`);
1100
- }
1101
- const record = {
1102
- db,
1103
- primaryAlias: alias,
1104
- aliases: new Set
1105
- };
1106
- _projectDbs.set(key, record);
1107
- bindAlias(record, key, alias);
1108
- return db;
1109
- }
1110
- function closeProjectDb(directory) {
1111
- const alias = lexicalAliasKey(directory);
1112
- const currentPath = canonicalExistingFilesystemPath(directory);
1113
- if (currentPath !== null) {
1114
- const currentKey = canonicalRootKeyFresh(directory);
1115
- const currentRecord = _projectDbs.get(currentKey);
1116
- if (currentRecord)
1117
- closeRecord(currentKey, currentRecord);
1118
- return;
1119
- }
1120
- const previousKey = _projectDbAliases.get(alias);
1121
- const previousRecord = previousKey === undefined ? undefined : _projectDbs.get(previousKey);
1122
- if (previousKey !== undefined && previousRecord) {
1123
- closeRecord(previousKey, previousRecord);
1124
- }
1125
- }
1126
-
1127
- export { DURABILITY_CLASSES, batchDurabilityClass, applySynchronousForClass, withDurabilityClass, DbWriteError, classifyDbWriteError, projectDbPath, projectDbExists, getProjectDb, closeProjectDb, detectSpeckit, resolveSpeckitProjection, loadSddStatusSync, buildOpenSpecProjectionSync, readEffectiveSpecSync, writeProjectedSpecSync, validateSpeckit };
694
+ export { detectSpeckit, resolveSpeckitProjection, loadSddStatusSync, buildOpenSpecProjectionSync, readEffectiveSpecSync, writeProjectedSpecSync, validateSpeckit };
@@ -2,18 +2,27 @@
2
2
  import {
3
3
  autoCommitDirty,
4
4
  cleanUntrackedFiles
5
- } from "./index-4vb6qa73.js";
5
+ } from "./index-ebce775n.js";
6
+ import {
7
+ validateSwarmPath
8
+ } from "./index-qqq04n70.js";
9
+ import {
10
+ bunSpawn,
11
+ classifySpawnFailure
12
+ } from "./index-p612v1mv.js";
6
13
  import {
7
14
  isPathWithinDeclaredScope,
8
15
  unsafePathTextReason
9
16
  } from "./index-556ja8an.js";
10
17
  import {
11
- validateSwarmPath
12
- } from "./index-zjg4chy2.js";
18
+ assertProjectRoot,
19
+ atomicWriteFile,
20
+ taskEvidencePath,
21
+ withTaskEvidenceLock
22
+ } from "./index-2bhz5k91.js";
13
23
  import {
14
- bunSpawn,
15
- classifySpawnFailure
16
- } from "./index-r3mvsbtq.js";
24
+ telemetry
25
+ } from "./index-r2p0pgst.js";
17
26
  import {
18
27
  init_git_executable,
19
28
  resolveGitExecutable
@@ -22,17 +31,6 @@ import {
22
31
  advisoryWarn,
23
32
  init_warning_buffer
24
33
  } from "./index-4rhhvd1a.js";
25
- import {
26
- atomicWriteFile,
27
- taskEvidencePath,
28
- withTaskEvidenceLock
29
- } from "./index-xnb3tk7x.js";
30
- import {
31
- assertProjectRoot
32
- } from "./index-2bgr671r.js";
33
- import {
34
- telemetry
35
- } from "./index-ww6zm5hr.js";
36
34
  import {
37
35
  exports_external,
38
36
  init_zod
@@ -12,7 +12,7 @@ import {
12
12
  PluginConfigSchema,
13
13
  init_schema,
14
14
  stripKnownSwarmPrefix
15
- } from "./index-aqppaaqx.js";
15
+ } from "./index-cgewrpw5.js";
16
16
  import {
17
17
  ALL_AGENT_NAMES,
18
18
  TOOL_NAME_SET,