agentic-qe 3.7.21 → 3.8.0

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 (164) hide show
  1. package/.claude/helpers/brain-checkpoint.cjs +4 -1
  2. package/.claude/helpers/statusline-v3.cjs +3 -1
  3. package/.claude/skills/skills-manifest.json +1 -1
  4. package/CHANGELOG.md +45 -0
  5. package/README.md +2 -14
  6. package/assets/helpers/statusline-v3.cjs +3 -1
  7. package/dist/cli/brain-commands.js +6 -10
  8. package/dist/cli/bundle.js +7441 -4327
  9. package/dist/cli/commands/audit.d.ts +43 -0
  10. package/dist/cli/commands/audit.js +125 -0
  11. package/dist/cli/commands/hooks.js +29 -6
  12. package/dist/cli/commands/init.js +1 -73
  13. package/dist/cli/commands/learning.js +270 -13
  14. package/dist/cli/commands/ruvector-commands.d.ts +15 -0
  15. package/dist/cli/commands/ruvector-commands.js +271 -0
  16. package/dist/cli/handlers/init-handler.d.ts +0 -1
  17. package/dist/cli/handlers/init-handler.js +0 -6
  18. package/dist/cli/index.js +4 -2
  19. package/dist/context/sources/defect-source.js +2 -2
  20. package/dist/context/sources/memory-source.js +2 -2
  21. package/dist/context/sources/requirements-source.js +2 -2
  22. package/dist/coordination/behavior-tree/decorators.d.ts +108 -0
  23. package/dist/coordination/behavior-tree/decorators.js +251 -0
  24. package/dist/coordination/behavior-tree/index.d.ts +12 -0
  25. package/dist/coordination/behavior-tree/index.js +15 -0
  26. package/dist/coordination/behavior-tree/nodes.d.ts +165 -0
  27. package/dist/coordination/behavior-tree/nodes.js +338 -0
  28. package/dist/coordination/behavior-tree/qe-trees.d.ts +105 -0
  29. package/dist/coordination/behavior-tree/qe-trees.js +181 -0
  30. package/dist/coordination/coherence-action-gate.d.ts +284 -0
  31. package/dist/coordination/coherence-action-gate.js +512 -0
  32. package/dist/coordination/index.d.ts +4 -0
  33. package/dist/coordination/index.js +8 -0
  34. package/dist/coordination/reasoning-qec.d.ts +315 -0
  35. package/dist/coordination/reasoning-qec.js +585 -0
  36. package/dist/coordination/task-executor.d.ts +16 -0
  37. package/dist/coordination/task-executor.js +99 -0
  38. package/dist/coordination/workflow-orchestrator.d.ts +29 -0
  39. package/dist/coordination/workflow-orchestrator.js +42 -0
  40. package/dist/domains/visual-accessibility/cnn-visual-regression.d.ts +135 -0
  41. package/dist/domains/visual-accessibility/cnn-visual-regression.js +327 -0
  42. package/dist/domains/visual-accessibility/index.d.ts +1 -0
  43. package/dist/domains/visual-accessibility/index.js +4 -0
  44. package/dist/governance/coherence-validator.d.ts +112 -0
  45. package/dist/governance/coherence-validator.js +180 -0
  46. package/dist/governance/index.d.ts +1 -0
  47. package/dist/governance/index.js +2 -0
  48. package/dist/governance/witness-chain.d.ts +311 -0
  49. package/dist/governance/witness-chain.js +509 -0
  50. package/dist/init/index.d.ts +0 -2
  51. package/dist/init/index.js +0 -1
  52. package/dist/init/init-wizard-steps.d.ts +10 -0
  53. package/dist/init/init-wizard-steps.js +87 -1
  54. package/dist/init/init-wizard.d.ts +1 -9
  55. package/dist/init/init-wizard.js +3 -69
  56. package/dist/init/orchestrator.js +0 -1
  57. package/dist/init/phases/01-detection.js +0 -27
  58. package/dist/init/phases/07-hooks.js +6 -4
  59. package/dist/init/phases/phase-interface.d.ts +0 -1
  60. package/dist/init/settings-merge.js +1 -1
  61. package/dist/integrations/browser/qe-dashboard/clustering.d.ts +48 -0
  62. package/dist/integrations/browser/qe-dashboard/clustering.js +183 -0
  63. package/dist/integrations/browser/qe-dashboard/index.d.ts +12 -0
  64. package/dist/integrations/browser/qe-dashboard/index.js +15 -0
  65. package/dist/integrations/browser/qe-dashboard/pattern-explorer.d.ts +165 -0
  66. package/dist/integrations/browser/qe-dashboard/pattern-explorer.js +260 -0
  67. package/dist/integrations/browser/qe-dashboard/wasm-vector-store.d.ts +144 -0
  68. package/dist/integrations/browser/qe-dashboard/wasm-vector-store.js +277 -0
  69. package/dist/integrations/ruvector/cognitive-container-codec.d.ts +51 -0
  70. package/dist/integrations/ruvector/cognitive-container-codec.js +180 -0
  71. package/dist/integrations/ruvector/cognitive-container.d.ts +125 -0
  72. package/dist/integrations/ruvector/cognitive-container.js +306 -0
  73. package/dist/integrations/ruvector/coherence-gate.d.ts +309 -0
  74. package/dist/integrations/ruvector/coherence-gate.js +631 -0
  75. package/dist/integrations/ruvector/compressed-hnsw-integration.d.ts +176 -0
  76. package/dist/integrations/ruvector/compressed-hnsw-integration.js +301 -0
  77. package/dist/integrations/ruvector/dither-adapter.d.ts +122 -0
  78. package/dist/integrations/ruvector/dither-adapter.js +295 -0
  79. package/dist/integrations/ruvector/domain-transfer.d.ts +129 -0
  80. package/dist/integrations/ruvector/domain-transfer.js +220 -0
  81. package/dist/integrations/ruvector/feature-flags.d.ts +214 -2
  82. package/dist/integrations/ruvector/feature-flags.js +167 -2
  83. package/dist/integrations/ruvector/filter-adapter.d.ts +71 -0
  84. package/dist/integrations/ruvector/filter-adapter.js +285 -0
  85. package/dist/integrations/ruvector/gnn-wrapper.d.ts +20 -0
  86. package/dist/integrations/ruvector/gnn-wrapper.js +40 -0
  87. package/dist/integrations/ruvector/hnsw-health-monitor.d.ts +237 -0
  88. package/dist/integrations/ruvector/hnsw-health-monitor.js +394 -0
  89. package/dist/integrations/ruvector/index.d.ts +8 -2
  90. package/dist/integrations/ruvector/index.js +18 -2
  91. package/dist/integrations/ruvector/interfaces.d.ts +40 -0
  92. package/dist/integrations/ruvector/sona-persistence.d.ts +54 -0
  93. package/dist/integrations/ruvector/sona-persistence.js +162 -0
  94. package/dist/integrations/ruvector/sona-three-loop.d.ts +392 -0
  95. package/dist/integrations/ruvector/sona-three-loop.js +814 -0
  96. package/dist/integrations/ruvector/sona-wrapper.d.ts +97 -0
  97. package/dist/integrations/ruvector/sona-wrapper.js +147 -3
  98. package/dist/integrations/ruvector/spectral-math.d.ts +101 -0
  99. package/dist/integrations/ruvector/spectral-math.js +254 -0
  100. package/dist/integrations/ruvector/temporal-compression.d.ts +163 -0
  101. package/dist/integrations/ruvector/temporal-compression.js +318 -0
  102. package/dist/integrations/ruvector/thompson-sampler.d.ts +61 -0
  103. package/dist/integrations/ruvector/thompson-sampler.js +118 -0
  104. package/dist/integrations/ruvector/transfer-coherence-stub.d.ts +80 -0
  105. package/dist/integrations/ruvector/transfer-coherence-stub.js +63 -0
  106. package/dist/integrations/ruvector/transfer-verification.d.ts +119 -0
  107. package/dist/integrations/ruvector/transfer-verification.js +115 -0
  108. package/dist/kernel/hnsw-adapter.d.ts +52 -1
  109. package/dist/kernel/hnsw-adapter.js +139 -4
  110. package/dist/kernel/hnsw-index-provider.d.ts +5 -0
  111. package/dist/kernel/native-hnsw-backend.d.ts +110 -0
  112. package/dist/kernel/native-hnsw-backend.js +408 -0
  113. package/dist/kernel/unified-memory.js +5 -6
  114. package/dist/learning/aqe-learning-engine.d.ts +2 -0
  115. package/dist/learning/aqe-learning-engine.js +65 -0
  116. package/dist/learning/experience-capture-middleware.js +20 -0
  117. package/dist/learning/experience-capture.d.ts +10 -0
  118. package/dist/learning/experience-capture.js +34 -0
  119. package/dist/learning/index.d.ts +2 -2
  120. package/dist/learning/index.js +4 -4
  121. package/dist/learning/metrics-tracker.d.ts +11 -0
  122. package/dist/learning/metrics-tracker.js +29 -13
  123. package/dist/learning/pattern-lifecycle.d.ts +30 -1
  124. package/dist/learning/pattern-lifecycle.js +92 -20
  125. package/dist/learning/pattern-store.d.ts +8 -0
  126. package/dist/learning/pattern-store.js +8 -2
  127. package/dist/learning/qe-unified-memory.js +1 -28
  128. package/dist/learning/regret-tracker.d.ts +201 -0
  129. package/dist/learning/regret-tracker.js +361 -0
  130. package/dist/mcp/bundle.js +5915 -474
  131. package/dist/routing/index.d.ts +4 -2
  132. package/dist/routing/index.js +3 -1
  133. package/dist/routing/neural-tiny-dancer-router.d.ts +268 -0
  134. package/dist/routing/neural-tiny-dancer-router.js +514 -0
  135. package/dist/routing/queen-integration.js +5 -5
  136. package/dist/routing/routing-config.d.ts +6 -0
  137. package/dist/routing/routing-config.js +1 -0
  138. package/dist/routing/simple-neural-router.d.ts +76 -0
  139. package/dist/routing/simple-neural-router.js +202 -0
  140. package/dist/routing/tiny-dancer-router.d.ts +20 -1
  141. package/dist/routing/tiny-dancer-router.js +21 -2
  142. package/dist/test-scheduling/dag-attention-scheduler.d.ts +81 -0
  143. package/dist/test-scheduling/dag-attention-scheduler.js +358 -0
  144. package/dist/test-scheduling/dag-attention-types.d.ts +81 -0
  145. package/dist/test-scheduling/dag-attention-types.js +10 -0
  146. package/dist/test-scheduling/index.d.ts +1 -0
  147. package/dist/test-scheduling/index.js +4 -0
  148. package/dist/test-scheduling/pipeline.d.ts +8 -0
  149. package/dist/test-scheduling/pipeline.js +28 -0
  150. package/package.json +6 -2
  151. package/dist/cli/commands/migrate.d.ts +0 -9
  152. package/dist/cli/commands/migrate.js +0 -566
  153. package/dist/init/init-wizard-migration.d.ts +0 -52
  154. package/dist/init/init-wizard-migration.js +0 -345
  155. package/dist/init/migration/config-migrator.d.ts +0 -31
  156. package/dist/init/migration/config-migrator.js +0 -149
  157. package/dist/init/migration/data-migrator.d.ts +0 -72
  158. package/dist/init/migration/data-migrator.js +0 -232
  159. package/dist/init/migration/detector.d.ts +0 -44
  160. package/dist/init/migration/detector.js +0 -105
  161. package/dist/init/migration/index.d.ts +0 -8
  162. package/dist/init/migration/index.js +0 -8
  163. package/dist/learning/v2-to-v3-migration.d.ts +0 -86
  164. package/dist/learning/v2-to-v3-migration.js +0 -529
@@ -2,8 +2,8 @@
2
2
  * RuVector Feature Flags for V3 QE Integration
3
3
  *
4
4
  * Controls which @ruvector package features are enabled for QE operations.
5
- * All flags default to true but can be disabled for debugging, testing,
6
- * or gradual rollout scenarios.
5
+ * All flags default to true (enabled) and can be disabled for debugging,
6
+ * testing, or opt-out scenarios.
7
7
  *
8
8
  * Note: These are enable/disable flags for feature control, NOT error hiding.
9
9
  * If a dependency fails, it throws an error - we don't silently fall back.
@@ -52,6 +52,143 @@ export interface RuVectorFeatureFlags {
52
52
  * @default true
53
53
  */
54
54
  logMigrationMetrics: boolean;
55
+ /**
56
+ * Enable Native HNSW backend via @ruvector/router VectorDb
57
+ * Uses the Rust-based HNSW implementation for higher throughput
58
+ * and lower latency vector search. Falls back to ProgressiveHnswBackend
59
+ * when the native binary is unavailable or the database lock is held.
60
+ * @default true
61
+ */
62
+ useNativeHNSW: boolean;
63
+ /**
64
+ * Enable Temporal Tensor Compression (ADR-085)
65
+ * Compresses pattern embeddings based on access frequency using tiered
66
+ * quantization (8-bit hot, 5-bit warm, 3-bit cold). Reduces memory
67
+ * usage for infrequently accessed patterns.
68
+ * @default true
69
+ */
70
+ useTemporalCompression: boolean;
71
+ /**
72
+ * Enable metadata filtering on pattern search results (Task 1.2)
73
+ * Uses TypeScript in-memory filtering (no native package exists).
74
+ * Filtering is applied post-search to refine results by domain,
75
+ * severity, confidence range, tags, date range, etc.
76
+ * @default true
77
+ */
78
+ useMetadataFiltering: boolean;
79
+ /**
80
+ * Enable deterministic dithering for embedding quantization (Task 1.4)
81
+ * Uses golden-ratio quasi-random dithering to produce cross-platform
82
+ * reproducible quantization results. When enabled, tensor compression
83
+ * applies dithering as a post-processing step, improving reconstruction
84
+ * quality at low bit depths while guaranteeing identical outputs on
85
+ * x86, ARM, and WASM platforms.
86
+ * @default true
87
+ */
88
+ useDeterministicDither: boolean;
89
+ /**
90
+ * Enable Neural Model Routing via SimpleNeuralRouter (ADR-082, Task 2.1)
91
+ * Replaces rule-based TinyDancer complexity thresholds with a lightweight
92
+ * TypeScript neural network (Input(4)→Dense(32)→Dense(3)→Softmax).
93
+ * Starts in shadow mode (runs alongside rule-based for first 1000 decisions),
94
+ * then transitions to neural-primary when disagreement rate falls below 10%.
95
+ * Circuit breaker falls back to rule-based if error rate exceeds 20%.
96
+ * Note: `@ruvector/tiny-dancer` NAPI binary is missing from ARM64 package;
97
+ * the TS SimpleNeuralRouter is production-ready (4→32→3 network is too
98
+ * small to benefit from native acceleration).
99
+ * @default true
100
+ */
101
+ useNeuralRouting: boolean;
102
+ /**
103
+ * Enable SONA Three-Loop Engine (Task 2.2: EWC++ & MicroLoRA)
104
+ * Adds three-loop coordination to SONA:
105
+ * - Instant loop: per-request MicroLoRA adaptation (<100us)
106
+ * - Background loop: periodic EWC++ consolidation
107
+ * - Coordination loop: cross-agent state synchronization
108
+ * When disabled, SONA operates without the three-loop enhancement.
109
+ * @default true
110
+ */
111
+ useSONAThreeLoop: boolean;
112
+ /**
113
+ * Enable Cross-Domain Transfer Learning (ADR-084, Task 2.3)
114
+ * Enables knowledge transfer between QE domains using Thompson Sampling
115
+ * with Beta priors for exploration/exploitation, sqrt-dampening to prevent
116
+ * overly aggressive transfers, and a double verification gate (source must
117
+ * not regress, target must improve). Coherence gate integration uses a
118
+ * pass-through stub until Task 3.1 implements the real gate.
119
+ * @default true
120
+ */
121
+ useCrossDomainTransfer: boolean;
122
+ /**
123
+ * Enable HNSW Health Monitor (Task 3.4)
124
+ * Performs periodic spectral health checks on HNSW indexes computing
125
+ * Fiedler value, spectral gap, effective resistance, and coherence score.
126
+ * Generates alerts when thresholds are exceeded (FragileIndex, PoorExpansion,
127
+ * HighResistance, LowCoherence). Uses TypeScript power iteration
128
+ * approximations (no native package exists for spectral computation).
129
+ * @default true
130
+ */
131
+ useHnswHealthMonitor: boolean;
132
+ /**
133
+ * Enable Regret Tracking (Task 2.4: Regret Tracking & Learning Health)
134
+ * Tracks cumulative regret per domain to assess whether QE agents are
135
+ * learning over time. Classifies regret growth as sublinear (learning),
136
+ * linear (stagnating), or superlinear (degrading). Alerts on transitions.
137
+ * @default true
138
+ */
139
+ useRegretTracking: boolean;
140
+ /**
141
+ * Enable Sheaf-Gated Coherence Gate (ADR-083, Task 3.1)
142
+ * Validates AI-generated test artifacts using sheaf Laplacian coherence
143
+ * energy computation. Detects hallucinated or inconsistent test outputs.
144
+ * Uses a two-tier compute ladder (reflex <1ms, retrieval ~10ms).
145
+ * Implements ITransferCoherenceGate replacing the stub.
146
+ * @default true
147
+ */
148
+ useCoherenceGate: boolean;
149
+ /**
150
+ * Enable Blake3 hash-chained witness records (Task 3.1)
151
+ * Creates a tamper-evident audit trail of all coherence gate decisions.
152
+ * Each witness record is hash-chained to the previous one.
153
+ * Falls back to SHA-256 when Blake3 is unavailable.
154
+ * @default true
155
+ */
156
+ useWitnessChain: boolean;
157
+ /**
158
+ * Enable CNN Visual Regression (Task 4.3)
159
+ * Uses spatial pooling embeddings for visual regression testing
160
+ * instead of pixel-level diffing. TypeScript implementation with
161
+ * 8x8 grid spatial pooling (no native CNN package exists).
162
+ * @default true
163
+ */
164
+ useCNNVisualRegression: boolean;
165
+ /**
166
+ * Enable DAG Attention for Test Scheduling (Phase 4, Task 4.2)
167
+ * Uses DAG-based attention mechanisms for intelligent test execution ordering:
168
+ * critical path attention, parallel branch attention, and MinCut-gated pruning.
169
+ * TypeScript implementation (no native package exists for DAG attention).
170
+ * @default true
171
+ */
172
+ useDAGAttention: boolean;
173
+ /**
174
+ * Enable Coherence-Gated Agent Actions (ADR-083, Task 3.2)
175
+ * Evaluates agent actions through three stacked filters (structural, shift,
176
+ * evidence) before execution. Produces PERMIT/DEFER/DENY decisions.
177
+ * Advisory mode by default: logs decisions but does not block execution.
178
+ * TypeScript implementation (no native package exists).
179
+ * @default true
180
+ */
181
+ useCoherenceActionGate: boolean;
182
+ /**
183
+ * Enable Reasoning QEC (Task 4.5: Multi-Path Consensus)
184
+ * Applies error correction to AI reasoning using three independent paths.
185
+ * Syndrome extraction identifies disagreements between paths; majority-vote
186
+ * correction produces a high-confidence corrected reasoning chain.
187
+ * Applicable to test generation validation, security audit consensus,
188
+ * and defect triage. TypeScript implementation (no native package exists).
189
+ * @default true
190
+ */
191
+ useReasoningQEC: boolean;
55
192
  }
56
193
  /**
57
194
  * Default feature flags - all enabled by default
@@ -129,6 +266,81 @@ export declare function isGNNIndexEnabled(): boolean;
129
266
  * @returns true if logMigrationMetrics flag is set
130
267
  */
131
268
  export declare function shouldLogMigrationMetrics(): boolean;
269
+ /**
270
+ * Check if Native HNSW backend is enabled
271
+ * @returns true if useNativeHNSW flag is set
272
+ */
273
+ export declare function isNativeHNSWEnabled(): boolean;
274
+ /**
275
+ * Check if Temporal Tensor Compression is enabled (ADR-085)
276
+ * @returns true if useTemporalCompression flag is set
277
+ */
278
+ export declare function isTemporalCompressionEnabled(): boolean;
279
+ /**
280
+ * Check if metadata filtering is enabled (Task 1.2)
281
+ * @returns true if useMetadataFiltering flag is set
282
+ */
283
+ export declare function isMetadataFilteringEnabled(): boolean;
284
+ /**
285
+ * Check if deterministic dithering is enabled (Task 1.4)
286
+ * @returns true if useDeterministicDither flag is set
287
+ */
288
+ export declare function isDeterministicDitherEnabled(): boolean;
289
+ /**
290
+ * Check if Neural Model Routing is enabled (ADR-082, Task 2.1)
291
+ * @returns true if useNeuralRouting flag is set
292
+ */
293
+ export declare function isNeuralRoutingEnabled(): boolean;
294
+ /**
295
+ * Check if SONA Three-Loop Engine is enabled (Task 2.2)
296
+ * @returns true if useSONAThreeLoop flag is set
297
+ */
298
+ export declare function isSONAThreeLoopEnabled(): boolean;
299
+ /**
300
+ * Check if Cross-Domain Transfer Learning is enabled (ADR-084, Task 2.3)
301
+ * @returns true if useCrossDomainTransfer flag is set
302
+ */
303
+ export declare function isCrossDomainTransferEnabled(): boolean;
304
+ /**
305
+ * Check if HNSW Health Monitor is enabled (Task 3.4)
306
+ * @returns true if useHnswHealthMonitor flag is set
307
+ */
308
+ export declare function isHnswHealthMonitorEnabled(): boolean;
309
+ /**
310
+ * Check if Regret Tracking is enabled (Task 2.4)
311
+ * @returns true if useRegretTracking flag is set
312
+ */
313
+ export declare function isRegretTrackingEnabled(): boolean;
314
+ /**
315
+ * Check if Coherence Gate is enabled (ADR-083, Task 3.1)
316
+ * @returns true if useCoherenceGate flag is set
317
+ */
318
+ export declare function isCoherenceGateEnabled(): boolean;
319
+ /**
320
+ * Check if Witness Chain is enabled (Task 3.1)
321
+ * @returns true if useWitnessChain flag is set
322
+ */
323
+ export declare function isWitnessChainEnabled(): boolean;
324
+ /**
325
+ * Check if CNN Visual Regression is enabled (Task 4.3)
326
+ * @returns true if useCNNVisualRegression flag is set
327
+ */
328
+ export declare function isCNNVisualRegressionEnabled(): boolean;
329
+ /**
330
+ * Check if DAG Attention for Test Scheduling is enabled (Phase 4, Task 4.2)
331
+ * @returns true if useDAGAttention flag is set
332
+ */
333
+ export declare function isDAGAttentionEnabled(): boolean;
334
+ /**
335
+ * Check if Coherence-Gated Agent Actions is enabled (ADR-083, Task 3.2)
336
+ * @returns true if useCoherenceActionGate flag is set
337
+ */
338
+ export declare function isCoherenceActionGateEnabled(): boolean;
339
+ /**
340
+ * Check if Reasoning QEC is enabled (Task 4.5)
341
+ * @returns true if useReasoningQEC flag is set
342
+ */
343
+ export declare function isReasoningQECEnabled(): boolean;
132
344
  /**
133
345
  * Initialize feature flags from environment variables
134
346
  *
@@ -2,8 +2,8 @@
2
2
  * RuVector Feature Flags for V3 QE Integration
3
3
  *
4
4
  * Controls which @ruvector package features are enabled for QE operations.
5
- * All flags default to true but can be disabled for debugging, testing,
6
- * or gradual rollout scenarios.
5
+ * All flags default to true (enabled) and can be disabled for debugging,
6
+ * testing, or opt-out scenarios.
7
7
  *
8
8
  * Note: These are enable/disable flags for feature control, NOT error hiding.
9
9
  * If a dependency fails, it throws an error - we don't silently fall back.
@@ -21,6 +21,21 @@ const DEFAULT_FEATURE_FLAGS = {
21
21
  useQEFlashAttention: true,
22
22
  useQEGNNIndex: true,
23
23
  logMigrationMetrics: true,
24
+ useNativeHNSW: true,
25
+ useTemporalCompression: true,
26
+ useMetadataFiltering: true,
27
+ useDeterministicDither: true,
28
+ useNeuralRouting: true,
29
+ useSONAThreeLoop: true,
30
+ useCrossDomainTransfer: true,
31
+ useHnswHealthMonitor: true,
32
+ useRegretTracking: true,
33
+ useCoherenceGate: true,
34
+ useWitnessChain: true,
35
+ useCNNVisualRegression: true,
36
+ useDAGAttention: true,
37
+ useCoherenceActionGate: true,
38
+ useReasoningQEC: true,
24
39
  };
25
40
  // ============================================================================
26
41
  // Internal State
@@ -124,6 +139,111 @@ export function isGNNIndexEnabled() {
124
139
  export function shouldLogMigrationMetrics() {
125
140
  return currentFeatureFlags.logMigrationMetrics;
126
141
  }
142
+ /**
143
+ * Check if Native HNSW backend is enabled
144
+ * @returns true if useNativeHNSW flag is set
145
+ */
146
+ export function isNativeHNSWEnabled() {
147
+ return currentFeatureFlags.useNativeHNSW;
148
+ }
149
+ /**
150
+ * Check if Temporal Tensor Compression is enabled (ADR-085)
151
+ * @returns true if useTemporalCompression flag is set
152
+ */
153
+ export function isTemporalCompressionEnabled() {
154
+ return currentFeatureFlags.useTemporalCompression;
155
+ }
156
+ /**
157
+ * Check if metadata filtering is enabled (Task 1.2)
158
+ * @returns true if useMetadataFiltering flag is set
159
+ */
160
+ export function isMetadataFilteringEnabled() {
161
+ return currentFeatureFlags.useMetadataFiltering;
162
+ }
163
+ /**
164
+ * Check if deterministic dithering is enabled (Task 1.4)
165
+ * @returns true if useDeterministicDither flag is set
166
+ */
167
+ export function isDeterministicDitherEnabled() {
168
+ return currentFeatureFlags.useDeterministicDither;
169
+ }
170
+ /**
171
+ * Check if Neural Model Routing is enabled (ADR-082, Task 2.1)
172
+ * @returns true if useNeuralRouting flag is set
173
+ */
174
+ export function isNeuralRoutingEnabled() {
175
+ return currentFeatureFlags.useNeuralRouting;
176
+ }
177
+ /**
178
+ * Check if SONA Three-Loop Engine is enabled (Task 2.2)
179
+ * @returns true if useSONAThreeLoop flag is set
180
+ */
181
+ export function isSONAThreeLoopEnabled() {
182
+ return currentFeatureFlags.useSONAThreeLoop;
183
+ }
184
+ /**
185
+ * Check if Cross-Domain Transfer Learning is enabled (ADR-084, Task 2.3)
186
+ * @returns true if useCrossDomainTransfer flag is set
187
+ */
188
+ export function isCrossDomainTransferEnabled() {
189
+ return currentFeatureFlags.useCrossDomainTransfer;
190
+ }
191
+ /**
192
+ * Check if HNSW Health Monitor is enabled (Task 3.4)
193
+ * @returns true if useHnswHealthMonitor flag is set
194
+ */
195
+ export function isHnswHealthMonitorEnabled() {
196
+ return currentFeatureFlags.useHnswHealthMonitor;
197
+ }
198
+ /**
199
+ * Check if Regret Tracking is enabled (Task 2.4)
200
+ * @returns true if useRegretTracking flag is set
201
+ */
202
+ export function isRegretTrackingEnabled() {
203
+ return currentFeatureFlags.useRegretTracking;
204
+ }
205
+ /**
206
+ * Check if Coherence Gate is enabled (ADR-083, Task 3.1)
207
+ * @returns true if useCoherenceGate flag is set
208
+ */
209
+ export function isCoherenceGateEnabled() {
210
+ return currentFeatureFlags.useCoherenceGate;
211
+ }
212
+ /**
213
+ * Check if Witness Chain is enabled (Task 3.1)
214
+ * @returns true if useWitnessChain flag is set
215
+ */
216
+ export function isWitnessChainEnabled() {
217
+ return currentFeatureFlags.useWitnessChain;
218
+ }
219
+ /**
220
+ * Check if CNN Visual Regression is enabled (Task 4.3)
221
+ * @returns true if useCNNVisualRegression flag is set
222
+ */
223
+ export function isCNNVisualRegressionEnabled() {
224
+ return currentFeatureFlags.useCNNVisualRegression;
225
+ }
226
+ /**
227
+ * Check if DAG Attention for Test Scheduling is enabled (Phase 4, Task 4.2)
228
+ * @returns true if useDAGAttention flag is set
229
+ */
230
+ export function isDAGAttentionEnabled() {
231
+ return currentFeatureFlags.useDAGAttention;
232
+ }
233
+ /**
234
+ * Check if Coherence-Gated Agent Actions is enabled (ADR-083, Task 3.2)
235
+ * @returns true if useCoherenceActionGate flag is set
236
+ */
237
+ export function isCoherenceActionGateEnabled() {
238
+ return currentFeatureFlags.useCoherenceActionGate;
239
+ }
240
+ /**
241
+ * Check if Reasoning QEC is enabled (Task 4.5)
242
+ * @returns true if useReasoningQEC flag is set
243
+ */
244
+ export function isReasoningQECEnabled() {
245
+ return currentFeatureFlags.useReasoningQEC;
246
+ }
127
247
  // ============================================================================
128
248
  // Environment Variable Support
129
249
  // ============================================================================
@@ -156,6 +276,51 @@ export function initFeatureFlagsFromEnv() {
156
276
  if (process.env.RUVECTOR_LOG_MIGRATION_METRICS !== undefined) {
157
277
  envFlags.logMigrationMetrics = process.env.RUVECTOR_LOG_MIGRATION_METRICS === 'true';
158
278
  }
279
+ if (process.env.RUVECTOR_USE_NATIVE_HNSW !== undefined) {
280
+ envFlags.useNativeHNSW = process.env.RUVECTOR_USE_NATIVE_HNSW === 'true';
281
+ }
282
+ if (process.env.RUVECTOR_USE_TEMPORAL_COMPRESSION !== undefined) {
283
+ envFlags.useTemporalCompression = process.env.RUVECTOR_USE_TEMPORAL_COMPRESSION === 'true';
284
+ }
285
+ if (process.env.RUVECTOR_USE_METADATA_FILTERING !== undefined) {
286
+ envFlags.useMetadataFiltering = process.env.RUVECTOR_USE_METADATA_FILTERING === 'true';
287
+ }
288
+ if (process.env.RUVECTOR_USE_DETERMINISTIC_DITHER !== undefined) {
289
+ envFlags.useDeterministicDither = process.env.RUVECTOR_USE_DETERMINISTIC_DITHER === 'true';
290
+ }
291
+ if (process.env.RUVECTOR_USE_NEURAL_ROUTING !== undefined) {
292
+ envFlags.useNeuralRouting = process.env.RUVECTOR_USE_NEURAL_ROUTING === 'true';
293
+ }
294
+ if (process.env.RUVECTOR_USE_SONA_THREE_LOOP !== undefined) {
295
+ envFlags.useSONAThreeLoop = process.env.RUVECTOR_USE_SONA_THREE_LOOP === 'true';
296
+ }
297
+ if (process.env.RUVECTOR_USE_CROSS_DOMAIN_TRANSFER !== undefined) {
298
+ envFlags.useCrossDomainTransfer = process.env.RUVECTOR_USE_CROSS_DOMAIN_TRANSFER === 'true';
299
+ }
300
+ if (process.env.RUVECTOR_USE_HNSW_HEALTH_MONITOR !== undefined) {
301
+ envFlags.useHnswHealthMonitor = process.env.RUVECTOR_USE_HNSW_HEALTH_MONITOR === 'true';
302
+ }
303
+ if (process.env.RUVECTOR_USE_REGRET_TRACKING !== undefined) {
304
+ envFlags.useRegretTracking = process.env.RUVECTOR_USE_REGRET_TRACKING === 'true';
305
+ }
306
+ if (process.env.RUVECTOR_USE_COHERENCE_GATE !== undefined) {
307
+ envFlags.useCoherenceGate = process.env.RUVECTOR_USE_COHERENCE_GATE === 'true';
308
+ }
309
+ if (process.env.RUVECTOR_USE_WITNESS_CHAIN !== undefined) {
310
+ envFlags.useWitnessChain = process.env.RUVECTOR_USE_WITNESS_CHAIN === 'true';
311
+ }
312
+ if (process.env.RUVECTOR_USE_CNN_VISUAL_REGRESSION !== undefined) {
313
+ envFlags.useCNNVisualRegression = process.env.RUVECTOR_USE_CNN_VISUAL_REGRESSION === 'true';
314
+ }
315
+ if (process.env.RUVECTOR_USE_DAG_ATTENTION !== undefined) {
316
+ envFlags.useDAGAttention = process.env.RUVECTOR_USE_DAG_ATTENTION === 'true';
317
+ }
318
+ if (process.env.RUVECTOR_USE_COHERENCE_ACTION_GATE !== undefined) {
319
+ envFlags.useCoherenceActionGate = process.env.RUVECTOR_USE_COHERENCE_ACTION_GATE === 'true';
320
+ }
321
+ if (process.env.RUVECTOR_USE_REASONING_QEC !== undefined) {
322
+ envFlags.useReasoningQEC = process.env.RUVECTOR_USE_REASONING_QEC === 'true';
323
+ }
159
324
  setRuVectorFeatureFlags(envFlags);
160
325
  }
161
326
  // ============================================================================
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Agentic QE v3 - RuVector Metadata Filtering Adapter
3
+ * Task 1.2: Metadata Filtering Layer (ruvector-filter)
4
+ *
5
+ * Provides composable filter expressions (AND/OR/NOT/FIELD) that can be
6
+ * applied to pattern search results for rich post-search filtering.
7
+ *
8
+ * TypeScript in-memory implementation (no native package exists).
9
+ * Backward compatible: no filter = no change to search results.
10
+ *
11
+ * @module integrations/ruvector/filter-adapter
12
+ */
13
+ import type { PatternSearchResult } from '../../learning/pattern-store.js';
14
+ import type { FilterExpression, FilterOperator, FieldFilterExpression } from './interfaces.js';
15
+ /**
16
+ * Create an AND filter combining multiple sub-expressions
17
+ */
18
+ export declare function and(...children: FilterExpression[]): FilterExpression;
19
+ /**
20
+ * Create an OR filter combining multiple sub-expressions
21
+ */
22
+ export declare function or(...children: FilterExpression[]): FilterExpression;
23
+ /**
24
+ * Create a NOT filter inverting a sub-expression
25
+ */
26
+ export declare function not(child: FilterExpression): FilterExpression;
27
+ /**
28
+ * Create a field-level filter expression
29
+ */
30
+ export declare function field(fieldName: string, operator: FilterOperator, value: unknown): FieldFilterExpression;
31
+ /**
32
+ * Evaluate a filter expression against a single search result.
33
+ * Returns true if the result passes the filter.
34
+ */
35
+ export declare function evaluateFilter(result: PatternSearchResult, filter: FilterExpression): boolean;
36
+ /**
37
+ * Apply a filter expression to pattern search results.
38
+ *
39
+ * If the `useMetadataFiltering` feature flag is disabled, returns results unchanged.
40
+ * If the native `ruvector-filter` engine is available, delegates to it.
41
+ * Otherwise, applies the TypeScript fallback engine.
42
+ *
43
+ * @param results - Pattern search results to filter
44
+ * @param filter - Composable filter expression
45
+ * @returns Filtered results (subset of input, order preserved)
46
+ */
47
+ export declare function applyFilter(results: PatternSearchResult[], filter: FilterExpression | undefined | null): Promise<PatternSearchResult[]>;
48
+ /**
49
+ * Synchronous version of applyFilter using the TypeScript fallback engine.
50
+ * Useful when native engine availability is already known to be absent.
51
+ *
52
+ * @param results - Pattern search results to filter
53
+ * @param filter - Composable filter expression
54
+ * @returns Filtered results (subset of input, order preserved)
55
+ */
56
+ export declare function applyFilterSync(results: PatternSearchResult[], filter: FilterExpression | undefined | null): PatternSearchResult[];
57
+ /**
58
+ * Validate a filter expression for structural correctness.
59
+ *
60
+ * @param filter - Filter expression to validate
61
+ * @returns Validation result with error messages
62
+ */
63
+ export declare function validateFilter(filter: FilterExpression): {
64
+ valid: boolean;
65
+ errors: string[];
66
+ };
67
+ /**
68
+ * Reset native engine state (for testing only)
69
+ */
70
+ export declare function resetNativeEngine(): void;
71
+ //# sourceMappingURL=filter-adapter.d.ts.map