agentic-qe 3.6.11 → 3.6.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 (105) hide show
  1. package/.claude/helpers/learning-service.mjs +2 -0
  2. package/.claude/helpers/statusline-v3.cjs +2 -0
  3. package/.claude/skills/skills-manifest.json +1 -1
  4. package/package.json +1 -1
  5. package/scripts/migrate-v2-to-v3-memory.js +2 -0
  6. package/scripts/sync-claude-flow.cjs +1 -0
  7. package/v3/CHANGELOG.md +14 -0
  8. package/v3/dist/adapters/claude-flow/trajectory-bridge.js +2 -2
  9. package/v3/dist/adapters/claude-flow/trajectory-bridge.js.map +1 -1
  10. package/v3/dist/benchmarks/performance-benchmarks.js +1 -1
  11. package/v3/dist/cli/bundle.js +198 -91
  12. package/v3/dist/cli/commands/learning-helpers.d.ts.map +1 -1
  13. package/v3/dist/cli/commands/learning-helpers.js +3 -4
  14. package/v3/dist/cli/commands/learning-helpers.js.map +1 -1
  15. package/v3/dist/cli/commands/learning.d.ts.map +1 -1
  16. package/v3/dist/cli/commands/learning.js +5 -8
  17. package/v3/dist/cli/commands/learning.js.map +1 -1
  18. package/v3/dist/cli/commands/migrate.js +2 -2
  19. package/v3/dist/coordination/constants.d.ts +1 -1
  20. package/v3/dist/coordination/constants.js +1 -1
  21. package/v3/dist/coordination/task-executor.d.ts.map +1 -1
  22. package/v3/dist/coordination/task-executor.js +322 -74
  23. package/v3/dist/coordination/task-executor.js.map +1 -1
  24. package/v3/dist/domains/code-intelligence/coordinator-hypergraph.js +2 -2
  25. package/v3/dist/domains/code-intelligence/coordinator-hypergraph.js.map +1 -1
  26. package/v3/dist/domains/code-intelligence/coordinator.js +2 -2
  27. package/v3/dist/domains/code-intelligence/coordinator.js.map +1 -1
  28. package/v3/dist/domains/coverage-analysis/coordinator.js +1 -1
  29. package/v3/dist/domains/coverage-analysis/services/coverage-analyzer.js +1 -1
  30. package/v3/dist/domains/coverage-analysis/services/coverage-embedder.d.ts +1 -1
  31. package/v3/dist/domains/coverage-analysis/services/coverage-embedder.js +1 -1
  32. package/v3/dist/domains/coverage-analysis/services/gap-detector.js +1 -1
  33. package/v3/dist/domains/coverage-analysis/services/ghost-coverage-analyzer.js +1 -1
  34. package/v3/dist/domains/coverage-analysis/services/hnsw-index.d.ts +2 -2
  35. package/v3/dist/domains/coverage-analysis/services/hnsw-index.js +3 -3
  36. package/v3/dist/domains/coverage-analysis/services/sublinear-analyzer.d.ts +1 -1
  37. package/v3/dist/domains/coverage-analysis/services/sublinear-analyzer.js +1 -1
  38. package/v3/dist/init/fleet-integration.d.ts.map +1 -1
  39. package/v3/dist/init/fleet-integration.js +3 -4
  40. package/v3/dist/init/fleet-integration.js.map +1 -1
  41. package/v3/dist/init/init-wizard-migration.d.ts.map +1 -1
  42. package/v3/dist/init/init-wizard-migration.js +3 -7
  43. package/v3/dist/init/init-wizard-migration.js.map +1 -1
  44. package/v3/dist/init/init-wizard-steps.d.ts.map +1 -1
  45. package/v3/dist/init/init-wizard-steps.js +3 -4
  46. package/v3/dist/init/init-wizard-steps.js.map +1 -1
  47. package/v3/dist/init/migration/data-migrator.d.ts.map +1 -1
  48. package/v3/dist/init/migration/data-migrator.js +6 -10
  49. package/v3/dist/init/migration/data-migrator.js.map +1 -1
  50. package/v3/dist/init/migration/detector.d.ts.map +1 -1
  51. package/v3/dist/init/migration/detector.js +2 -4
  52. package/v3/dist/init/migration/detector.js.map +1 -1
  53. package/v3/dist/init/phases/01-detection.d.ts.map +1 -1
  54. package/v3/dist/init/phases/01-detection.js +2 -4
  55. package/v3/dist/init/phases/01-detection.js.map +1 -1
  56. package/v3/dist/init/phases/06-code-intelligence.d.ts.map +1 -1
  57. package/v3/dist/init/phases/06-code-intelligence.js +4 -6
  58. package/v3/dist/init/phases/06-code-intelligence.js.map +1 -1
  59. package/v3/dist/init/phases/07-hooks.d.ts +11 -0
  60. package/v3/dist/init/phases/07-hooks.d.ts.map +1 -1
  61. package/v3/dist/init/phases/07-hooks.js +91 -1
  62. package/v3/dist/init/phases/07-hooks.js.map +1 -1
  63. package/v3/dist/init/phases/12-verification.d.ts.map +1 -1
  64. package/v3/dist/init/phases/12-verification.js +2 -4
  65. package/v3/dist/init/phases/12-verification.js.map +1 -1
  66. package/v3/dist/integrations/embeddings/cache/EmbeddingCache.d.ts.map +1 -1
  67. package/v3/dist/integrations/embeddings/cache/EmbeddingCache.js +2 -2
  68. package/v3/dist/integrations/embeddings/cache/EmbeddingCache.js.map +1 -1
  69. package/v3/dist/kernel/constants.d.ts +1 -1
  70. package/v3/dist/kernel/constants.js +1 -1
  71. package/v3/dist/kernel/unified-memory-hnsw.d.ts.map +1 -1
  72. package/v3/dist/kernel/unified-memory-hnsw.js +25 -6
  73. package/v3/dist/kernel/unified-memory-hnsw.js.map +1 -1
  74. package/v3/dist/kernel/unified-memory-migration.d.ts.map +1 -1
  75. package/v3/dist/kernel/unified-memory-migration.js +3 -3
  76. package/v3/dist/kernel/unified-memory-migration.js.map +1 -1
  77. package/v3/dist/learning/metrics-tracker.d.ts.map +1 -1
  78. package/v3/dist/learning/metrics-tracker.js +2 -2
  79. package/v3/dist/learning/metrics-tracker.js.map +1 -1
  80. package/v3/dist/learning/sqlite-persistence.d.ts.map +1 -1
  81. package/v3/dist/learning/sqlite-persistence.js +3 -6
  82. package/v3/dist/learning/sqlite-persistence.js.map +1 -1
  83. package/v3/dist/learning/v2-to-v3-migration.d.ts.map +1 -1
  84. package/v3/dist/learning/v2-to-v3-migration.js +4 -5
  85. package/v3/dist/learning/v2-to-v3-migration.js.map +1 -1
  86. package/v3/dist/mcp/bundle.js +733 -162
  87. package/v3/dist/mcp/tools/security-compliance/scan.d.ts +3 -1
  88. package/v3/dist/mcp/tools/security-compliance/scan.d.ts.map +1 -1
  89. package/v3/dist/mcp/tools/security-compliance/scan.js +417 -72
  90. package/v3/dist/mcp/tools/security-compliance/scan.js.map +1 -1
  91. package/v3/dist/planning/plan-executor.d.ts.map +1 -1
  92. package/v3/dist/planning/plan-executor.js +2 -2
  93. package/v3/dist/planning/plan-executor.js.map +1 -1
  94. package/v3/dist/shared/safe-db.d.ts +32 -0
  95. package/v3/dist/shared/safe-db.d.ts.map +1 -0
  96. package/v3/dist/shared/safe-db.js +41 -0
  97. package/v3/dist/shared/safe-db.js.map +1 -0
  98. package/v3/dist/sync/claude-flow-bridge.js +5 -5
  99. package/v3/dist/sync/claude-flow-bridge.js.map +1 -1
  100. package/v3/dist/sync/embeddings/sync-embedding-generator.js +3 -3
  101. package/v3/dist/sync/embeddings/sync-embedding-generator.js.map +1 -1
  102. package/v3/dist/sync/readers/sqlite-reader.d.ts.map +1 -1
  103. package/v3/dist/sync/readers/sqlite-reader.js +2 -2
  104. package/v3/dist/sync/readers/sqlite-reader.js.map +1 -1
  105. package/v3/package.json +1 -1
@@ -149,7 +149,7 @@ var init_constants = __esm({
149
149
  /**
150
150
  * Vector dimension for coverage analysis embeddings.
151
151
  */
152
- COVERAGE_VECTOR_DIMENSION: 128
152
+ COVERAGE_VECTOR_DIMENSION: 768
153
153
  };
154
154
  AGENT_CONSTANTS = {
155
155
  /**
@@ -1595,7 +1595,10 @@ var init_unified_memory_hnsw = __esm({
1595
1595
  search(query, k68) {
1596
1596
  if (this.ids.length === 0) return [];
1597
1597
  const actualK = Math.min(k68, this.ids.length);
1598
- if (ruvectorDifferentiableSearch && this.vectors.length > 0) {
1598
+ const storedDim = this.vectors.length > 0 ? this.vectors[0].length : 0;
1599
+ const queryDim = query.length;
1600
+ const dimensionsMatch = storedDim === queryDim;
1601
+ if (ruvectorDifferentiableSearch && this.vectors.length > 0 && dimensionsMatch) {
1599
1602
  const queryF322 = new Float32Array(query);
1600
1603
  const queryNorm2 = computeNorm(queryF322);
1601
1604
  const result = ruvectorDifferentiableSearch(
@@ -1613,10 +1616,20 @@ var init_unified_memory_hnsw = __esm({
1613
1616
  const queryNorm = computeNorm(queryF32);
1614
1617
  const scored = [];
1615
1618
  for (let i58 = 0; i58 < this.ids.length; i58++) {
1616
- scored.push({
1617
- id: this.ids[i58],
1618
- score: fastCosine(queryF32, this.vectors[i58], queryNorm, this.norms[i58])
1619
- });
1619
+ const vec = this.vectors[i58];
1620
+ if (vec.length !== queryF32.length) {
1621
+ if (i58 === 0) {
1622
+ console.warn(
1623
+ `[RuvectorFlatIndex] Dimension mismatch: query=${queryF32.length}, stored=${vec.length}. Skipping ${this.ids.length} mismatched vectors. Re-index with correct dimensions.`
1624
+ );
1625
+ }
1626
+ continue;
1627
+ } else {
1628
+ scored.push({
1629
+ id: this.ids[i58],
1630
+ score: fastCosine(queryF32, vec, queryNorm, this.norms[i58])
1631
+ });
1632
+ }
1620
1633
  }
1621
1634
  scored.sort((a37, b68) => b68.score - a37.score);
1622
1635
  return scored.slice(0, actualK);
@@ -8717,7 +8730,7 @@ function createHNSWIndex(memory, config) {
8717
8730
  return new HNSWIndex(memory, config);
8718
8731
  }
8719
8732
  async function benchmarkHNSW(index, vectorCount = 1e4, searchCount = 1e3) {
8720
- const dimensions = 128;
8733
+ const dimensions = 768;
8721
8734
  const startInsert = performance.now();
8722
8735
  for (let i58 = 0; i58 < vectorCount; i58++) {
8723
8736
  const vector = Array.from({ length: dimensions }, () => Math.random());
@@ -8746,7 +8759,7 @@ var init_hnsw_index = __esm({
8746
8759
  QEGNNEmbeddingIndexClass = null;
8747
8760
  ruvectorLoaded = false;
8748
8761
  DEFAULT_HNSW_CONFIG = {
8749
- dimensions: 128,
8762
+ dimensions: 768,
8750
8763
  M: 16,
8751
8764
  efConstruction: 200,
8752
8765
  efSearch: 100,
@@ -8998,7 +9011,7 @@ var init_hnsw_index = __esm({
8998
9011
  /**
8999
9012
  * Validate and auto-resize vectors to match HNSW configured dimensions.
9000
9013
  * Fix #279: Prevents Rust WASM panic when RealEmbeddings (768-dim) are
9001
- * passed to a 128-dim HNSW index.
9014
+ * passed to a mismatched-dim HNSW index.
9002
9015
  */
9003
9016
  validateVector(vector) {
9004
9017
  if (vector.length !== this.config.dimensions) {
@@ -11598,6 +11611,33 @@ ${JSON.stringify(results.map((n61) => ({ id: n61.id, label: n61.label, propertie
11598
11611
  }
11599
11612
  });
11600
11613
 
11614
+ // src/shared/safe-db.ts
11615
+ var safe_db_exports = {};
11616
+ __export(safe_db_exports, {
11617
+ openDatabase: () => openDatabase
11618
+ });
11619
+ function openDatabase(dbPath, opts) {
11620
+ const readonly = opts?.readonly ?? false;
11621
+ const fileMustExist = opts?.fileMustExist ?? false;
11622
+ const busyTimeout = opts?.busyTimeout ?? 5e3;
11623
+ const walMode = opts?.walMode ?? !readonly;
11624
+ const db = new better_sqlite3_default(dbPath, {
11625
+ readonly,
11626
+ fileMustExist
11627
+ });
11628
+ db.pragma(`busy_timeout = ${busyTimeout}`);
11629
+ if (walMode) {
11630
+ db.pragma("journal_mode = WAL");
11631
+ }
11632
+ return db;
11633
+ }
11634
+ var init_safe_db = __esm({
11635
+ "src/shared/safe-db.ts"() {
11636
+ "use strict";
11637
+ init_better_sqlite3();
11638
+ }
11639
+ });
11640
+
11601
11641
  // src/integrations/vibium/types.ts
11602
11642
  var init_types3 = __esm({
11603
11643
  "src/integrations/vibium/types.ts"() {
@@ -15066,7 +15106,7 @@ var logger9, V2ToV3Migrator;
15066
15106
  var init_v2_to_v3_migration = __esm({
15067
15107
  "src/learning/v2-to-v3-migration.ts"() {
15068
15108
  "use strict";
15069
- init_better_sqlite3();
15109
+ init_safe_db();
15070
15110
  init_error_utils();
15071
15111
  init_safe_json();
15072
15112
  init_logging();
@@ -15168,9 +15208,8 @@ var init_v2_to_v3_migration = __esm({
15168
15208
  }
15169
15209
  }
15170
15210
  async connect() {
15171
- this.v2Db = new better_sqlite3_default(this.config.v2DbPath, { readonly: true });
15172
- this.v3Db = new better_sqlite3_default(this.config.v3PatternsDbPath);
15173
- this.v3Db.pragma("journal_mode = WAL");
15211
+ this.v2Db = openDatabase(this.config.v2DbPath, { readonly: true });
15212
+ this.v3Db = openDatabase(this.config.v3PatternsDbPath);
15174
15213
  this.createV3Schema();
15175
15214
  }
15176
15215
  async disconnect() {
@@ -15560,7 +15599,7 @@ var DEFAULT_SQLITE_CONFIG, SQLitePatternStore;
15560
15599
  var init_sqlite_persistence = __esm({
15561
15600
  "src/learning/sqlite-persistence.ts"() {
15562
15601
  "use strict";
15563
- init_better_sqlite3();
15602
+ init_safe_db();
15564
15603
  init_esm_node();
15565
15604
  init_safe_json();
15566
15605
  init_error_utils();
@@ -15604,10 +15643,7 @@ var init_sqlite_persistence = __esm({
15604
15643
  if (!fs23.existsSync(dir)) {
15605
15644
  fs23.mkdirSync(dir, { recursive: true });
15606
15645
  }
15607
- this.db = new better_sqlite3_default(this.config.dbPath);
15608
- if (this.config.walMode) {
15609
- this.db.pragma("journal_mode = WAL");
15610
- }
15646
+ this.db = openDatabase(this.config.dbPath);
15611
15647
  this.db.pragma(`mmap_size = ${this.config.mmapSize}`);
15612
15648
  this.db.pragma(`cache_size = ${this.config.cacheSize}`);
15613
15649
  if (this.config.foreignKeys) {
@@ -16782,11 +16818,11 @@ __export(hnswlib_node_exports, {
16782
16818
  init: () => init6,
16783
16819
  pipeline: () => pipeline7
16784
16820
  });
16785
- import { createRequire as createRequire9 } from "module";
16821
+ import { createRequire as createRequire6 } from "module";
16786
16822
  var __require7, __mod6, hnswlib_node_default, RuvectorLayer6, TensorCompress6, differentiableSearch6, hierarchicalForward6, getCompressionLevel6, init6, FlashAttention6, DotProductAttention6, MultiHeadAttention6, HyperbolicAttention6, LinearAttention6, MoEAttention6, SonaEngine6, pipeline7;
16787
16823
  var init_hnswlib_node = __esm({
16788
16824
  "native-require:hnswlib-node"() {
16789
- __require7 = createRequire9(import.meta.url);
16825
+ __require7 = createRequire6(import.meta.url);
16790
16826
  __mod6 = __require7("hnswlib-node");
16791
16827
  hnswlib_node_default = __mod6;
16792
16828
  ({
@@ -16839,11 +16875,11 @@ __export(pg_exports, {
16839
16875
  init: () => init7,
16840
16876
  pipeline: () => pipeline8
16841
16877
  });
16842
- import { createRequire as createRequire10 } from "module";
16878
+ import { createRequire as createRequire7 } from "module";
16843
16879
  var __require8, __mod7, pg_default, RuvectorLayer7, TensorCompress7, differentiableSearch7, hierarchicalForward7, getCompressionLevel7, init7, FlashAttention7, DotProductAttention7, MultiHeadAttention7, HyperbolicAttention7, LinearAttention7, MoEAttention7, SonaEngine7, pipeline8;
16844
16880
  var init_pg = __esm({
16845
16881
  "native-require:pg"() {
16846
- __require8 = createRequire10(import.meta.url);
16882
+ __require8 = createRequire7(import.meta.url);
16847
16883
  __mod7 = __require8("pg");
16848
16884
  pg_default = __mod7;
16849
16885
  ({
@@ -18294,11 +18330,11 @@ __export(prime_radiant_advanced_wasm_exports, {
18294
18330
  init: () => init8,
18295
18331
  pipeline: () => pipeline9
18296
18332
  });
18297
- import { createRequire as createRequire11 } from "module";
18333
+ import { createRequire as createRequire8 } from "module";
18298
18334
  var __require9, __mod8, prime_radiant_advanced_wasm_default, RuvectorLayer8, TensorCompress8, differentiableSearch8, hierarchicalForward8, getCompressionLevel8, init8, FlashAttention8, DotProductAttention8, MultiHeadAttention8, HyperbolicAttention8, LinearAttention8, MoEAttention8, SonaEngine8, pipeline9;
18299
18335
  var init_prime_radiant_advanced_wasm = __esm({
18300
18336
  "native-require:prime-radiant-advanced-wasm"() {
18301
- __require9 = createRequire11(import.meta.url);
18337
+ __require9 = createRequire8(import.meta.url);
18302
18338
  __mod8 = __require9("prime-radiant-advanced-wasm");
18303
18339
  prime_radiant_advanced_wasm_default = __mod8;
18304
18340
  ({
@@ -51734,7 +51770,7 @@ var DEFAULT_CONFIG11 = {
51734
51770
  };
51735
51771
  var CoverageAnalyzerService = class _CoverageAnalyzerService {
51736
51772
  static DEFAULT_THRESHOLD = 80;
51737
- static VECTOR_DIMENSION = 128;
51773
+ static VECTOR_DIMENSION = 768;
51738
51774
  memory;
51739
51775
  config;
51740
51776
  llmRouter;
@@ -52268,7 +52304,7 @@ var DEFAULT_CONFIG12 = {
52268
52304
  };
52269
52305
  var GapDetectorService = class _GapDetectorService {
52270
52306
  static DEFAULT_MIN_COVERAGE = 80;
52271
- static VECTOR_DIMENSION = 128;
52307
+ static VECTOR_DIMENSION = 768;
52272
52308
  memory;
52273
52309
  config;
52274
52310
  llmRouter;
@@ -53266,7 +53302,7 @@ init_hnsw_index();
53266
53302
 
53267
53303
  // src/domains/coverage-analysis/services/coverage-embedder.ts
53268
53304
  var DEFAULT_EMBEDDER_CONFIG = {
53269
- dimensions: 128,
53305
+ dimensions: 768,
53270
53306
  includePathFeatures: true,
53271
53307
  includeTemporalFeatures: true,
53272
53308
  normalization: "l2"
@@ -53698,7 +53734,7 @@ var ALL_CATEGORIES = [
53698
53734
  "missing-security-check"
53699
53735
  ];
53700
53736
  var DEFAULT_CONFIG13 = {
53701
- dimensions: 128,
53737
+ dimensions: 768,
53702
53738
  minConfidence: 0.3,
53703
53739
  maxGaps: 50,
53704
53740
  riskWeight: 0.6,
@@ -55407,7 +55443,7 @@ var CoverageAnalysisCoordinator = class extends BaseDomainCoordinator {
55407
55443
  return forecast;
55408
55444
  }
55409
55445
  createGapEmbedding(gap) {
55410
- const VECTOR_DIMENSION = 128;
55446
+ const VECTOR_DIMENSION = 768;
55411
55447
  const embedding = new Array(VECTOR_DIMENSION).fill(0);
55412
55448
  embedding[0] = gap.riskScore;
55413
55449
  embedding[1] = Math.min(1, gap.lines.length / 100);
@@ -73262,7 +73298,7 @@ var CodeIntelligenceCoordinator = class extends BaseDomainCoordinator {
73262
73298
  */
73263
73299
  async initializeHypergraph() {
73264
73300
  try {
73265
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
73301
+ const { openDatabase: openDatabase2 } = await Promise.resolve().then(() => (init_safe_db(), safe_db_exports));
73266
73302
  const fs23 = await import("fs");
73267
73303
  const path26 = await import("path");
73268
73304
  const { findProjectRoot: findProjectRoot2 } = await Promise.resolve().then(() => (init_unified_memory(), unified_memory_exports));
@@ -73272,7 +73308,7 @@ var CodeIntelligenceCoordinator = class extends BaseDomainCoordinator {
73272
73308
  if (!fs23.existsSync(dir)) {
73273
73309
  fs23.mkdirSync(dir, { recursive: true });
73274
73310
  }
73275
- this.hypergraphDb = new Database(dbPath);
73311
+ this.hypergraphDb = openDatabase2(dbPath);
73276
73312
  this.hypergraph = await createHypergraphEngine({
73277
73313
  db: this.hypergraphDb,
73278
73314
  maxTraversalDepth: 10,
@@ -115401,7 +115437,7 @@ var ALL_DOMAINS2 = [
115401
115437
  "enterprise-integration"
115402
115438
  ];
115403
115439
  function getAQEVersion() {
115404
- return true ? "3.6.11" : "3.0.0";
115440
+ return true ? "3.6.12" : "3.0.0";
115405
115441
  }
115406
115442
  function createDefaultConfig(projectName, projectRoot) {
115407
115443
  return {
@@ -116307,14 +116343,12 @@ function createSelfConfigurator(options) {
116307
116343
  // src/init/init-wizard-migration.ts
116308
116344
  import { existsSync as existsSync15, mkdirSync as mkdirSync5, writeFileSync as writeFileSync2, readFileSync as readFileSync12, readdirSync as readdirSync5, statSync as statSync5, unlinkSync as unlinkSync2, copyFileSync as copyFileSync2 } from "fs";
116309
116345
  import { join as join17, dirname as dirname4 } from "path";
116310
- import { createRequire as createRequire6 } from "module";
116311
116346
  init_error_utils();
116312
116347
  init_safe_json();
116313
- var require2 = createRequire6(import.meta.url);
116348
+ init_safe_db();
116314
116349
  function readVersionFromDb(dbPath) {
116315
116350
  try {
116316
- const Database = require2("better-sqlite3");
116317
- const db = new Database(dbPath, { readonly: true, fileMustExist: true });
116351
+ const db = openDatabase(dbPath, { readonly: true, fileMustExist: true });
116318
116352
  try {
116319
116353
  const tableExists = db.prepare(`
116320
116354
  SELECT name FROM sqlite_master
@@ -116348,8 +116382,7 @@ async function writeVersionToDb(projectRoot, version) {
116348
116382
  if (!existsSync15(dir)) {
116349
116383
  mkdirSync5(dir, { recursive: true });
116350
116384
  }
116351
- const Database = require2("better-sqlite3");
116352
- const db = new Database(memoryDbPath);
116385
+ const db = openDatabase(memoryDbPath);
116353
116386
  try {
116354
116387
  db.exec(`
116355
116388
  CREATE TABLE IF NOT EXISTS kv_store (
@@ -118477,6 +118510,7 @@ function createN8nInstaller(options) {
118477
118510
 
118478
118511
  // src/init/init-wizard-steps.ts
118479
118512
  init_error_utils();
118513
+ init_safe_db();
118480
118514
  async function initializePersistenceDatabase(projectRoot) {
118481
118515
  let Database = null;
118482
118516
  try {
@@ -118536,8 +118570,7 @@ async function checkCodeIntelligenceIndex(projectRoot) {
118536
118570
  return false;
118537
118571
  }
118538
118572
  try {
118539
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
118540
- const db = new Database(dbPath);
118573
+ const db = openDatabase(dbPath);
118541
118574
  const result = db.prepare(`
118542
118575
  SELECT COUNT(*) as count FROM kv_store
118543
118576
  WHERE namespace = 'code-intelligence:kg'
@@ -118590,8 +118623,7 @@ async function runCodeIntelligenceScan(projectPath) {
118590
118623
  async function getKGEntryCount(projectRoot) {
118591
118624
  const dbPath = join22(projectRoot, ".agentic-qe", "memory.db");
118592
118625
  try {
118593
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
118594
- const db = new Database(dbPath);
118626
+ const db = openDatabase(dbPath);
118595
118627
  const result = db.prepare(`
118596
118628
  SELECT COUNT(*) as count FROM kv_store
118597
118629
  WHERE namespace LIKE 'code-intelligence:kg%'
@@ -119266,10 +119298,9 @@ var BasePhase = class {
119266
119298
 
119267
119299
  // src/init/phases/01-detection.ts
119268
119300
  init_safe_json();
119301
+ init_safe_db();
119269
119302
  import { existsSync as existsSync21 } from "fs";
119270
119303
  import { join as join23 } from "path";
119271
- import { createRequire as createRequire7 } from "module";
119272
- var require3 = createRequire7(import.meta.url);
119273
119304
  var DetectionPhase = class extends BasePhase {
119274
119305
  name = "detection";
119275
119306
  description = "Detect existing installations";
@@ -119358,8 +119389,7 @@ var DetectionPhase = class extends BasePhase {
119358
119389
  */
119359
119390
  readVersionFromDb(dbPath) {
119360
119391
  try {
119361
- const Database = require3("better-sqlite3");
119362
- const db = new Database(dbPath, { readonly: true, fileMustExist: true });
119392
+ const db = openDatabase(dbPath, { readonly: true, fileMustExist: true });
119363
119393
  try {
119364
119394
  const tableExists = db.prepare(`
119365
119395
  SELECT name FROM sqlite_master
@@ -119629,6 +119659,7 @@ var LearningPhase = class extends BasePhase {
119629
119659
 
119630
119660
  // src/init/phases/06-code-intelligence.ts
119631
119661
  init_safe_json();
119662
+ init_safe_db();
119632
119663
  import { existsSync as existsSync24, statSync as statSync8 } from "fs";
119633
119664
  import { join as join26 } from "path";
119634
119665
  var SCAN_IGNORE_PATTERNS = [
@@ -119698,8 +119729,7 @@ var CodeIntelligencePhase = class extends BasePhase {
119698
119729
  return false;
119699
119730
  }
119700
119731
  try {
119701
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
119702
- const db = new Database(dbPath);
119732
+ const db = openDatabase(dbPath);
119703
119733
  const result = db.prepare(`
119704
119734
  SELECT COUNT(*) as count FROM kv_store
119705
119735
  WHERE namespace = 'code-intelligence:kg'
@@ -119716,8 +119746,7 @@ var CodeIntelligencePhase = class extends BasePhase {
119716
119746
  async getKGEntryCount(projectRoot) {
119717
119747
  const dbPath = join26(projectRoot, ".agentic-qe", "memory.db");
119718
119748
  try {
119719
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
119720
- const db = new Database(dbPath);
119749
+ const db = openDatabase(dbPath);
119721
119750
  const result = db.prepare(`
119722
119751
  SELECT COUNT(*) as count FROM kv_store
119723
119752
  WHERE namespace LIKE 'code-intelligence:kg%'
@@ -119796,8 +119825,7 @@ var CodeIntelligencePhase = class extends BasePhase {
119796
119825
  async getLastIndexedAt(projectRoot) {
119797
119826
  const dbPath = join26(projectRoot, ".agentic-qe", "memory.db");
119798
119827
  try {
119799
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
119800
- const db = new Database(dbPath);
119828
+ const db = openDatabase(dbPath);
119801
119829
  const row = db.prepare(`
119802
119830
  SELECT value FROM kv_store
119803
119831
  WHERE namespace = 'code-intelligence:kg'
@@ -119872,6 +119900,10 @@ var HooksPhase = class extends BasePhase {
119872
119900
  if (!existsSync25(claudeDir)) {
119873
119901
  mkdirSync13(claudeDir, { recursive: true });
119874
119902
  }
119903
+ const hooksDir = join27(claudeDir, "hooks");
119904
+ if (!existsSync25(hooksDir)) {
119905
+ mkdirSync13(hooksDir, { recursive: true });
119906
+ }
119875
119907
  const settingsPath = join27(claudeDir, "settings.json");
119876
119908
  let settings = {};
119877
119909
  if (existsSync25(settingsPath)) {
@@ -119906,7 +119938,10 @@ var HooksPhase = class extends BasePhase {
119906
119938
  }
119907
119939
  settings.enabledMcpjsonServers = existingMcp;
119908
119940
  writeFileSync9(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
119941
+ this.writeHooksReadme(hooksDir, hookTypes);
119942
+ this.installHookAssets(hooksDir, context2);
119909
119943
  context2.services.log(` Settings: ${settingsPath}`);
119944
+ context2.services.log(` Hooks dir: ${hooksDir}`);
119910
119945
  context2.services.log(` Hook types: ${hookTypes.join(", ")}`);
119911
119946
  return {
119912
119947
  configured: true,
@@ -119915,6 +119950,83 @@ var HooksPhase = class extends BasePhase {
119915
119950
  existingAqeDetected
119916
119951
  };
119917
119952
  }
119953
+ /**
119954
+ * Write a README to .claude/hooks/ explaining the hook setup.
119955
+ * Actual hook config lives in .claude/settings.json (Claude Code reads it from there).
119956
+ * The hooks dir contains supporting infrastructure (bridge script, workers config).
119957
+ */
119958
+ writeHooksReadme(hooksDir, hookTypes) {
119959
+ const readmePath = join27(hooksDir, "README.txt");
119960
+ if (existsSync25(readmePath)) return;
119961
+ const content = [
119962
+ "AQE Hooks Directory",
119963
+ "====================",
119964
+ "",
119965
+ "Claude Code hooks are configured in .claude/settings.json (not as files here).",
119966
+ "This directory contains supporting infrastructure for the learning system.",
119967
+ "",
119968
+ "Configured hook types: " + hookTypes.join(", "),
119969
+ "",
119970
+ "Files:",
119971
+ " settings.json \u2014 Hook definitions (in parent .claude/ directory)",
119972
+ " v3-qe-bridge.sh \u2014 Bridge script connecting Claude Code events to QE learning",
119973
+ " v3-domain-workers.json \u2014 Domain worker configuration",
119974
+ " cross-phase-memory.yaml \u2014 QCSD feedback loop configuration",
119975
+ "",
119976
+ "Manual testing:",
119977
+ " npx agentic-qe hooks session-start --session-id test --json",
119978
+ ' npx agentic-qe hooks route --task "generate tests" --json',
119979
+ " npx agentic-qe hooks post-edit --file src/example.ts --success --json",
119980
+ ""
119981
+ ].join("\n");
119982
+ writeFileSync9(readmePath, content, "utf-8");
119983
+ }
119984
+ /**
119985
+ * Install hook assets (cross-phase memory config, domain workers).
119986
+ * Copies from v3/assets/hooks/ if available, otherwise creates minimal defaults.
119987
+ */
119988
+ installHookAssets(hooksDir, context2) {
119989
+ const { projectRoot } = context2;
119990
+ const crossPhasePath = join27(hooksDir, "cross-phase-memory.yaml");
119991
+ if (!existsSync25(crossPhasePath)) {
119992
+ const assetPaths = [
119993
+ join27(projectRoot, "v3", "assets", "hooks", "cross-phase-memory.yaml"),
119994
+ join27(projectRoot, "assets", "hooks", "cross-phase-memory.yaml"),
119995
+ join27(projectRoot, "node_modules", "agentic-qe", "v3", "assets", "hooks", "cross-phase-memory.yaml")
119996
+ ];
119997
+ let installed = false;
119998
+ for (const src of assetPaths) {
119999
+ if (existsSync25(src)) {
120000
+ const { copyFileSync: copyFileSync9 } = __require("fs");
120001
+ copyFileSync9(src, crossPhasePath);
120002
+ context2.services.log(" Installed cross-phase memory config");
120003
+ installed = true;
120004
+ break;
120005
+ }
120006
+ }
120007
+ if (!installed) {
120008
+ writeFileSync9(crossPhasePath, [
120009
+ "# Cross-Phase Memory Hooks Configuration",
120010
+ "# Generated by aqe init",
120011
+ 'version: "1.0"',
120012
+ "enabled: true",
120013
+ ""
120014
+ ].join("\n"), "utf-8");
120015
+ }
120016
+ }
120017
+ const workersPath = join27(hooksDir, "v3-domain-workers.json");
120018
+ if (!existsSync25(workersPath)) {
120019
+ writeFileSync9(workersPath, JSON.stringify({
120020
+ version: "3.0",
120021
+ workers: [
120022
+ { name: "pattern-consolidator", interval: "5m", enabled: true },
120023
+ { name: "routing-accuracy-monitor", interval: "10m", enabled: true },
120024
+ { name: "coverage-gap-scanner", interval: "15m", enabled: true },
120025
+ { name: "flaky-test-detector", interval: "30m", enabled: true }
120026
+ ]
120027
+ }, null, 2), "utf-8");
120028
+ }
120029
+ }
119918
120030
  /**
119919
120031
  * Check if existing hooks contain any AQE/agentic-qe entries
119920
120032
  */
@@ -120770,8 +120882,7 @@ Task({ prompt: "Security audit", subagent_type: "qe-security-scanner", run_in_ba
120770
120882
  import { existsSync as existsSync30, readFileSync as readFileSync22 } from "fs";
120771
120883
  import { join as join32, dirname as dirname9 } from "path";
120772
120884
  import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync13 } from "fs";
120773
- import { createRequire as createRequire8 } from "module";
120774
- var require4 = createRequire8(import.meta.url);
120885
+ init_safe_db();
120775
120886
  var VerificationPhase = class extends BasePhase {
120776
120887
  name = "verification";
120777
120888
  description = "Verify installation";
@@ -120828,8 +120939,7 @@ var VerificationPhase = class extends BasePhase {
120828
120939
  if (!existsSync30(dir)) {
120829
120940
  mkdirSync16(dir, { recursive: true });
120830
120941
  }
120831
- const Database = require4("better-sqlite3");
120832
- const db = new Database(memoryDbPath);
120942
+ const db = openDatabase(memoryDbPath);
120833
120943
  try {
120834
120944
  db.exec(`
120835
120945
  CREATE TABLE IF NOT EXISTS kv_store (
@@ -125002,7 +125112,7 @@ function createMigrateCommand(context2, cleanupAndExit2, ensureInitialized2) {
125002
125112
  migratedFrom: "v2",
125003
125113
  migratedAt: (/* @__PURE__ */ new Date()).toISOString(),
125004
125114
  hnswEnabled: true,
125005
- vectorDimensions: 128
125115
+ vectorDimensions: 768
125006
125116
  }, null, 2));
125007
125117
  const stats = fs23.statSync(v2Files.memoryDb);
125008
125118
  console.log(chalk17.green(` * Memory database migrated (${(stats.size / 1024).toFixed(1)} KB)
@@ -125031,7 +125141,7 @@ function createMigrateCommand(context2, cleanupAndExit2, ensureInitialized2) {
125031
125141
  domains: {
125032
125142
  "test-generation": { enabled: true },
125033
125143
  "test-execution": { enabled: true },
125034
- "coverage-analysis": { enabled: true, algorithm: "hnsw", dimensions: 128 },
125144
+ "coverage-analysis": { enabled: true, algorithm: "hnsw", dimensions: 768 },
125035
125145
  "quality-assessment": { enabled: true },
125036
125146
  "defect-intelligence": { enabled: true },
125037
125147
  "requirements-validation": { enabled: true },
@@ -126972,6 +127082,7 @@ import chalk20 from "chalk";
126972
127082
 
126973
127083
  // src/init/fleet-integration.ts
126974
127084
  init_error_utils();
127085
+ init_safe_db();
126975
127086
  import chalk19 from "chalk";
126976
127087
  import { existsSync as existsSync38 } from "fs";
126977
127088
  import { join as join40 } from "path";
@@ -127126,8 +127237,7 @@ var FleetInitEnhancer = class {
127126
127237
  return false;
127127
127238
  }
127128
127239
  try {
127129
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
127130
- const db = new Database(dbPath);
127240
+ const db = openDatabase(dbPath);
127131
127241
  const result = db.prepare(`
127132
127242
  SELECT COUNT(*) as count FROM kv_store
127133
127243
  WHERE namespace = 'code-intelligence:kg'
@@ -127144,8 +127254,7 @@ var FleetInitEnhancer = class {
127144
127254
  async getKGEntryCount() {
127145
127255
  const dbPath = join40(this.projectRoot, ".agentic-qe", "memory.db");
127146
127256
  try {
127147
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
127148
- const db = new Database(dbPath);
127257
+ const db = openDatabase(dbPath);
127149
127258
  const result = db.prepare(`
127150
127259
  SELECT COUNT(*) as count FROM kv_store
127151
127260
  WHERE namespace LIKE 'code-intelligence:kg%'
@@ -132580,7 +132689,7 @@ var DEFAULT_SYNC_CONFIG = {
132580
132689
  };
132581
132690
 
132582
132691
  // src/sync/readers/sqlite-reader.ts
132583
- init_better_sqlite3();
132692
+ init_safe_db();
132584
132693
  init_sql_safety();
132585
132694
  init_safe_json();
132586
132695
  init_error_utils();
@@ -132608,7 +132717,7 @@ var SQLiteReader = class {
132608
132717
  throw new Error(`SQLite database not found: ${this.dbPath}`);
132609
132718
  }
132610
132719
  try {
132611
- this.db = new better_sqlite3_default(this.dbPath, { readonly: true });
132720
+ this.db = openDatabase(this.dbPath, { readonly: true });
132612
132721
  this.db.pragma("journal_mode = WAL");
132613
132722
  this.db.pragma("synchronous = NORMAL");
132614
132723
  console.log(`[SQLiteReader:${this.name}] Initialized: ${this.dbPath}`);
@@ -133974,7 +134083,7 @@ async function syncIncrementalToCloud(since, config) {
133974
134083
  }
133975
134084
 
133976
134085
  // src/integrations/embeddings/cache/EmbeddingCache.ts
133977
- init_better_sqlite3();
134086
+ init_safe_db();
133978
134087
  init_unified_memory();
133979
134088
  init_safe_json();
133980
134089
 
@@ -133983,7 +134092,7 @@ init_transformers();
133983
134092
  init_vector_math();
133984
134093
 
133985
134094
  // src/sync/embeddings/sync-embedding-generator.ts
133986
- init_better_sqlite3();
134095
+ init_safe_db();
133987
134096
  init_sql_safety();
133988
134097
  init_error_utils();
133989
134098
  init_safe_json();
@@ -136938,7 +137047,7 @@ async function createCoherenceService(wasmLoader2, config, logger19) {
136938
137047
 
136939
137048
  // src/integrations/coherence/wasm-loader.ts
136940
137049
  init_error_utils();
136941
- import { createRequire as createRequire12 } from "node:module";
137050
+ import { createRequire as createRequire9 } from "node:module";
136942
137051
  import { fileURLToPath as fileURLToPath6 } from "node:url";
136943
137052
  import { dirname as dirname13, join as join44 } from "node:path";
136944
137053
  import { readFileSync as readFileSync32, existsSync as existsSync44 } from "node:fs";
@@ -137194,11 +137303,11 @@ var WasmLoader = class {
137194
137303
  return false;
137195
137304
  }
137196
137305
  try {
137197
- const require5 = createRequire12(import.meta.url);
137306
+ const require2 = createRequire9(import.meta.url);
137198
137307
  const wasmPaths = [
137199
137308
  (() => {
137200
137309
  try {
137201
- const modulePath = require5.resolve("prime-radiant-advanced-wasm");
137310
+ const modulePath = require2.resolve("prime-radiant-advanced-wasm");
137202
137311
  return join44(dirname13(modulePath), "prime_radiant_advanced_wasm_bg.wasm");
137203
137312
  } catch {
137204
137313
  return null;
@@ -137400,18 +137509,18 @@ var WasmLoader = class {
137400
137509
  * - Browser: Uses default() async init with fetch
137401
137510
  */
137402
137511
  async attemptLoad() {
137403
- let require5;
137512
+ let require2;
137404
137513
  try {
137405
- require5 = createRequire12(import.meta.url);
137514
+ require2 = createRequire9(import.meta.url);
137406
137515
  } catch {
137407
- require5 = globalThis.require || (await import("module")).createRequire(__filename);
137516
+ require2 = globalThis.require || (await import("module")).createRequire(__filename);
137408
137517
  }
137409
137518
  let wasmModule;
137410
137519
  try {
137411
137520
  wasmModule = await Promise.resolve().then(() => (init_prime_radiant_advanced_wasm(), prime_radiant_advanced_wasm_exports));
137412
137521
  } catch (importError) {
137413
137522
  try {
137414
- wasmModule = require5("prime-radiant-advanced-wasm");
137523
+ wasmModule = require2("prime-radiant-advanced-wasm");
137415
137524
  } catch (requireError) {
137416
137525
  throw new Error(
137417
137526
  `Failed to import prime-radiant-advanced-wasm: ${toErrorMessage(importError)}`
@@ -137420,7 +137529,7 @@ var WasmLoader = class {
137420
137529
  }
137421
137530
  const isNodeJs = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
137422
137531
  if (isNodeJs) {
137423
- await this.initializeForNodeJs(wasmModule, require5);
137532
+ await this.initializeForNodeJs(wasmModule, require2);
137424
137533
  } else {
137425
137534
  if (wasmModule.default && typeof wasmModule.default === "function") {
137426
137535
  await wasmModule.default();
@@ -137452,12 +137561,12 @@ var WasmLoader = class {
137452
137561
  * In Node.js, the default async init uses fetch() which isn't available.
137453
137562
  * Instead, we read the WASM binary from disk and use initSync().
137454
137563
  */
137455
- async initializeForNodeJs(wasmModule, require5) {
137564
+ async initializeForNodeJs(wasmModule, require2) {
137456
137565
  const wasmPaths = [
137457
137566
  // Resolve from require - most reliable
137458
137567
  (() => {
137459
137568
  try {
137460
- const modulePath = require5.resolve("prime-radiant-advanced-wasm");
137569
+ const modulePath = require2.resolve("prime-radiant-advanced-wasm");
137461
137570
  return join44(dirname13(modulePath), "prime_radiant_advanced_wasm_bg.wasm");
137462
137571
  } catch {
137463
137572
  return null;
@@ -138684,7 +138793,7 @@ import { existsSync as existsSync46, writeFileSync as writeFileSync22, readFileS
138684
138793
  import { stat as stat3, unlink } from "node:fs/promises";
138685
138794
 
138686
138795
  // src/learning/metrics-tracker.ts
138687
- init_better_sqlite3();
138796
+ init_safe_db();
138688
138797
  init_qe_patterns();
138689
138798
  init_safe_json();
138690
138799
  init_logging();
@@ -138706,7 +138815,7 @@ var LearningMetricsTracker = class {
138706
138815
  if (!existsSync45(this.dbPath)) {
138707
138816
  throw new Error(`Database not found: ${this.dbPath}. Run "aqe init --auto" first.`);
138708
138817
  }
138709
- this.db = new better_sqlite3_default(this.dbPath, { readonly: false });
138818
+ this.db = openDatabase(this.dbPath);
138710
138819
  this.ensureMetricsTable();
138711
138820
  this.initialized = true;
138712
138821
  }
@@ -139054,9 +139163,13 @@ function createLearningMetricsTracker(projectRoot) {
139054
139163
  return new LearningMetricsTracker(projectRoot);
139055
139164
  }
139056
139165
 
139166
+ // src/cli/commands/learning.ts
139167
+ init_safe_db();
139168
+
139057
139169
  // src/cli/commands/learning-helpers.ts
139058
139170
  init_unified_memory();
139059
139171
  init_qe_reasoning_bank();
139172
+ init_safe_db();
139060
139173
  import chalk28 from "chalk";
139061
139174
  import path24 from "node:path";
139062
139175
  import { createReadStream, createWriteStream } from "node:fs";
@@ -139205,8 +139318,7 @@ async function decompressFile(gzPath, outputPath) {
139205
139318
  }
139206
139319
  async function verifyDatabaseIntegrity(dbPath) {
139207
139320
  try {
139208
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
139209
- const db = new Database(dbPath, { readonly: true });
139321
+ const db = openDatabase(dbPath, { readonly: true });
139210
139322
  const result = db.prepare("PRAGMA integrity_check").get();
139211
139323
  db.close();
139212
139324
  if (result.integrity_check === "ok") {
@@ -139223,8 +139335,7 @@ async function verifyDatabaseIntegrity(dbPath) {
139223
139335
  }
139224
139336
  async function getSchemaVersion(dbPath) {
139225
139337
  try {
139226
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
139227
- const db = new Database(dbPath, { readonly: true });
139338
+ const db = openDatabase(dbPath, { readonly: true });
139228
139339
  const tableExists = db.prepare(
139229
139340
  "SELECT name FROM sqlite_master WHERE type='table' AND name='schema_version'"
139230
139341
  ).get();
@@ -139583,8 +139694,7 @@ function registerExtractCommand(learning) {
139583
139694
  console.log(` Min reward threshold: ${minReward}`);
139584
139695
  console.log(` Min occurrences: ${minCount}
139585
139696
  `);
139586
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
139587
- const db = new Database(dbPath, { readonly: true });
139697
+ const db = openDatabase(dbPath, { readonly: true });
139588
139698
  const experiences = db.prepare(`
139589
139699
  SELECT task_type, COUNT(*) as count, AVG(reward) as avg_reward, MAX(reward) as max_reward,
139590
139700
  MIN(reward) as min_reward, GROUP_CONCAT(DISTINCT action) as actions
@@ -139840,8 +139950,7 @@ function registerVerifyCommand(learning) {
139840
139950
  const fileStats = await stat3(dbPath);
139841
139951
  let tableCounts = {};
139842
139952
  try {
139843
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
139844
- const db = new Database(dbPath, { readonly: true });
139953
+ const db = openDatabase(dbPath, { readonly: true });
139845
139954
  for (const table of ["qe_patterns", "qe_trajectories", "learning_experiences", "kv_store", "vectors"]) {
139846
139955
  try {
139847
139956
  const r54 = db.prepare(`SELECT COUNT(*) as count FROM ${table}`).get();
@@ -139908,8 +140017,7 @@ function registerExportFullCommand(learning) {
139908
140017
  };
139909
140018
  if (options.includeTrajectories) {
139910
140019
  try {
139911
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
139912
- const db = new Database(dbPath, { readonly: true });
140020
+ const db = openDatabase(dbPath, { readonly: true });
139913
140021
  const trajectories = db.prepare(`SELECT id, task, agent, domain, success, steps_json FROM qe_trajectories ORDER BY started_at DESC LIMIT 1000`).all();
139914
140022
  exportData.trajectories = trajectories.map((t50) => ({ id: t50.id, task: t50.task, agent: t50.agent, domain: t50.domain, success: t50.success, stepsJson: t50.steps_json }));
139915
140023
  db.close();
@@ -139918,8 +140026,7 @@ function registerExportFullCommand(learning) {
139918
140026
  }
139919
140027
  if (options.includeExperiences) {
139920
140028
  try {
139921
- const Database = (await Promise.resolve().then(() => (init_better_sqlite3(), better_sqlite3_exports))).default;
139922
- const db = new Database(dbPath, { readonly: true });
140029
+ const db = openDatabase(dbPath, { readonly: true });
139923
140030
  const experiences = db.prepare(`SELECT task_type, action, AVG(reward) as avg_reward, COUNT(*) as count FROM learning_experiences GROUP BY task_type, action ORDER BY count DESC LIMIT 500`).all();
139924
140031
  exportData.experiences = experiences.map((e20) => ({ taskType: e20.task_type, action: e20.action, reward: e20.avg_reward, count: e20.count }));
139925
140032
  const metaRow = db.prepare(`SELECT COUNT(*) as total, AVG(reward) as avg_reward FROM learning_experiences`).get();
@@ -140415,7 +140522,7 @@ async function cleanupAndExit(code = 0) {
140415
140522
  process.exit(code);
140416
140523
  }
140417
140524
  var program = new Command18();
140418
- var VERSION = true ? "3.6.11" : "0.0.0-dev";
140525
+ var VERSION = true ? "3.6.12" : "0.0.0-dev";
140419
140526
  program.name("aqe").description("Agentic QE - Domain-Driven Quality Engineering").version(VERSION);
140420
140527
  var registry = createCommandRegistry(context, cleanupAndExit, ensureInitialized);
140421
140528
  registry.registerAll(program);