agentic-qe 3.8.5 → 3.8.7

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 (67) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +26 -0
  3. package/assets/governance/constitution.md +1 -1
  4. package/assets/governance/shards/chaos-resilience.shard.md +1 -1
  5. package/assets/governance/shards/code-intelligence.shard.md +1 -1
  6. package/assets/governance/shards/contract-testing.shard.md +1 -1
  7. package/assets/governance/shards/coverage-analysis.shard.md +1 -1
  8. package/assets/governance/shards/defect-intelligence.shard.md +1 -1
  9. package/assets/governance/shards/learning-optimization.shard.md +1 -1
  10. package/assets/governance/shards/quality-assessment.shard.md +1 -1
  11. package/assets/governance/shards/requirements-validation.shard.md +1 -1
  12. package/assets/governance/shards/security-compliance.shard.md +1 -1
  13. package/assets/governance/shards/test-execution.shard.md +1 -1
  14. package/assets/governance/shards/test-generation.shard.md +1 -1
  15. package/assets/governance/shards/visual-accessibility.shard.md +1 -1
  16. package/dist/cli/bundle.js +715 -643
  17. package/dist/cli/command-registry.js +3 -1
  18. package/dist/cli/completions/index.d.ts +17 -0
  19. package/dist/cli/completions/index.js +49 -1
  20. package/dist/cli/handlers/hypergraph-handler.d.ts +27 -0
  21. package/dist/cli/handlers/hypergraph-handler.js +248 -0
  22. package/dist/cli/handlers/index.d.ts +1 -0
  23. package/dist/cli/handlers/index.js +1 -0
  24. package/dist/coordination/mincut/phase-executor.d.ts +27 -0
  25. package/dist/coordination/mincut/phase-executor.js +70 -0
  26. package/dist/coordination/mincut/time-crystal-analysis.d.ts +35 -0
  27. package/dist/coordination/mincut/time-crystal-analysis.js +237 -0
  28. package/dist/coordination/mincut/time-crystal-persistence.d.ts +35 -0
  29. package/dist/coordination/mincut/time-crystal-persistence.js +81 -0
  30. package/dist/coordination/mincut/time-crystal-scheduling.d.ts +34 -0
  31. package/dist/coordination/mincut/time-crystal-scheduling.js +213 -0
  32. package/dist/coordination/mincut/time-crystal-types.d.ts +278 -0
  33. package/dist/coordination/mincut/time-crystal-types.js +67 -0
  34. package/dist/coordination/mincut/time-crystal.d.ts +8 -438
  35. package/dist/coordination/mincut/time-crystal.js +87 -905
  36. package/dist/coordination/protocols/code-intelligence-index.js +2 -11
  37. package/dist/domains/code-intelligence/coordinator-hypergraph.js +1 -1
  38. package/dist/domains/code-intelligence/coordinator.d.ts +5 -0
  39. package/dist/domains/code-intelligence/coordinator.js +35 -3
  40. package/dist/init/phases/06-code-intelligence.d.ts +8 -3
  41. package/dist/init/phases/06-code-intelligence.js +70 -32
  42. package/dist/learning/agent-routing.d.ts +53 -0
  43. package/dist/learning/agent-routing.js +142 -0
  44. package/dist/learning/embedding-utils.d.ts +34 -0
  45. package/dist/learning/embedding-utils.js +95 -0
  46. package/dist/learning/pattern-promotion.d.ts +63 -0
  47. package/dist/learning/pattern-promotion.js +187 -0
  48. package/dist/learning/pretrained-patterns.d.ts +14 -0
  49. package/dist/learning/pretrained-patterns.js +726 -0
  50. package/dist/learning/qe-reasoning-bank-types.d.ts +174 -0
  51. package/dist/learning/qe-reasoning-bank-types.js +24 -0
  52. package/dist/learning/qe-reasoning-bank.d.ts +9 -192
  53. package/dist/learning/qe-reasoning-bank.js +48 -1093
  54. package/dist/mcp/bundle.js +1084 -1083
  55. package/dist/mcp/handlers/hypergraph-handler.d.ts +27 -0
  56. package/dist/mcp/handlers/hypergraph-handler.js +140 -0
  57. package/dist/mcp/handlers/index.d.ts +1 -0
  58. package/dist/mcp/handlers/index.js +2 -0
  59. package/dist/mcp/server.js +19 -0
  60. package/dist/mcp/tool-scoping.js +5 -0
  61. package/dist/shared/code-index-extractor.d.ts +23 -0
  62. package/dist/shared/code-index-extractor.js +101 -0
  63. package/dist/shared/security/command-validator.js +2 -2
  64. package/dist/shared/security/input-sanitizer.js +1 -1
  65. package/dist/shared/security/path-traversal-validator.js +1 -1
  66. package/dist/shared/security/regex-safety-validator.js +7 -7
  67. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  * Central registry for all CLI command handlers.
5
5
  * Provides command routing and management.
6
6
  */
7
- import { createInitHandler, createStatusHandler, createHealthHandler, createTaskHandler, createAgentHandler, createDomainHandler, createProtocolHandler, createBrainHandler, } from './handlers/index.js';
7
+ import { createInitHandler, createStatusHandler, createHealthHandler, createTaskHandler, createAgentHandler, createDomainHandler, createProtocolHandler, createBrainHandler, createHypergraphHandler, } from './handlers/index.js';
8
8
  // ============================================================================
9
9
  // Command Registry
10
10
  // ============================================================================
@@ -80,6 +80,8 @@ export class CommandRegistry {
80
80
  this.register(createProtocolHandler(this.cleanupAndExit, this.ensureInitialized));
81
81
  // Brain export/import
82
82
  this.register(createBrainHandler(this.cleanupAndExit, this.ensureInitialized));
83
+ // Hypergraph queries
84
+ this.register(createHypergraphHandler(this.cleanupAndExit, this.ensureInitialized));
83
85
  }
84
86
  /**
85
87
  * Get help for all commands
@@ -115,6 +115,23 @@ export declare const COMMANDS: {
115
115
  readonly description: "V2 to V3 migration";
116
116
  readonly options: readonly ["--dry-run", "--backup", "--skip-memory", "--skip-patterns", "--skip-config", "--force"];
117
117
  };
118
+ readonly hypergraph: {
119
+ readonly description: "Query the code knowledge hypergraph";
120
+ readonly subcommands: {
121
+ readonly stats: {
122
+ readonly options: readonly ["--db"];
123
+ };
124
+ readonly untested: {
125
+ readonly options: readonly ["--db", "--limit"];
126
+ };
127
+ readonly impacted: {
128
+ readonly options: readonly ["--db"];
129
+ };
130
+ readonly gaps: {
131
+ readonly options: readonly ["--db", "--max-coverage", "--limit"];
132
+ };
133
+ };
134
+ };
118
135
  readonly completions: {
119
136
  readonly description: "Generate shell completions";
120
137
  readonly subcommands: {
@@ -210,6 +210,16 @@ export const COMMANDS = {
210
210
  description: 'V2 to V3 migration',
211
211
  options: ['--dry-run', '--backup', '--skip-memory', '--skip-patterns', '--skip-config', '--force'],
212
212
  },
213
+ // Hypergraph queries
214
+ hypergraph: {
215
+ description: 'Query the code knowledge hypergraph',
216
+ subcommands: {
217
+ stats: { options: ['--db'] },
218
+ untested: { options: ['--db', '--limit'] },
219
+ impacted: { options: ['--db'] },
220
+ gaps: { options: ['--db', '--max-coverage', '--limit'] },
221
+ },
222
+ },
213
223
  // Completions command (meta)
214
224
  completions: {
215
225
  description: 'Generate shell completions',
@@ -315,7 +325,7 @@ _aqe_completions() {
315
325
  local cur prev words cword
316
326
  _init_completion || return
317
327
 
318
- local commands="init status health task agent domain protocol test coverage quality security code migrate completions"
328
+ local commands="init status health task agent domain protocol test coverage quality security code migrate hypergraph completions"
319
329
  local task_subcmds="submit list cancel status"
320
330
  local agent_subcmds="list spawn"
321
331
  local domain_subcmds="list health"
@@ -614,6 +624,23 @@ _aqe_completions() {
614
624
  ;;
615
625
  esac
616
626
  ;;
627
+ hypergraph)
628
+ local hg_subcmds="stats untested impacted gaps"
629
+ case "\${words[2]}" in
630
+ stats|untested|gaps)
631
+ COMPREPLY=( $(compgen -W "--db --limit --max-coverage" -- "$cur") )
632
+ return
633
+ ;;
634
+ impacted)
635
+ COMPREPLY=( $(compgen -f -- "$cur") )
636
+ return
637
+ ;;
638
+ *)
639
+ COMPREPLY=( $(compgen -W "$hg_subcmds" -- "$cur") )
640
+ return
641
+ ;;
642
+ esac
643
+ ;;
617
644
  migrate)
618
645
  COMPREPLY=( $(compgen -W "--dry-run --backup --skip-memory --skip-patterns --skip-config --force" -- "$cur") )
619
646
  return
@@ -692,6 +719,7 @@ _aqe() {
692
719
  'quality:Quality assessment'
693
720
  'security:Security scanning'
694
721
  'code:Code intelligence'
722
+ 'hypergraph:Query the code knowledge hypergraph'
695
723
  'migrate:V2 to V3 migration'
696
724
  'completions:Generate shell completions'
697
725
  )
@@ -939,6 +967,20 @@ _aqe() {
939
967
  '--depth[Analysis depth]:depth:(1 2 3 4 5)' \\
940
968
  '--include-tests[Include test files]'
941
969
  ;;
970
+ hypergraph)
971
+ local -a hg_commands
972
+ hg_commands=(
973
+ 'stats:Show hypergraph statistics'
974
+ 'untested:Find untested functions'
975
+ 'impacted:Find impacted tests'
976
+ 'gaps:Find coverage gaps'
977
+ )
978
+ _arguments -C \\
979
+ '1:command:_describe command hg_commands' \\
980
+ '--db[Database path]:path:_files' \\
981
+ '--limit[Max results]:number:' \\
982
+ '--max-coverage[Coverage threshold]:number:'
983
+ ;;
942
984
  migrate)
943
985
  _arguments \\
944
986
  '--dry-run[Preview migration without changes]' \\
@@ -1015,6 +1057,11 @@ complete -c aqe -n "__fish_use_subcommand" -a "coverage" -d "Coverage analysis"
1015
1057
  complete -c aqe -n "__fish_use_subcommand" -a "quality" -d "Quality assessment"
1016
1058
  complete -c aqe -n "__fish_use_subcommand" -a "security" -d "Security scanning"
1017
1059
  complete -c aqe -n "__fish_use_subcommand" -a "code" -d "Code intelligence"
1060
+ complete -c aqe -n "__fish_use_subcommand" -a "hypergraph" -d "Query the code knowledge hypergraph"
1061
+ complete -c aqe -n "__fish_seen_subcommand_from hypergraph; and not __fish_seen_subcommand_from stats untested impacted gaps" -a "stats" -d "Show hypergraph statistics"
1062
+ complete -c aqe -n "__fish_seen_subcommand_from hypergraph; and not __fish_seen_subcommand_from stats untested impacted gaps" -a "untested" -d "Find untested functions"
1063
+ complete -c aqe -n "__fish_seen_subcommand_from hypergraph; and not __fish_seen_subcommand_from stats untested impacted gaps" -a "impacted" -d "Find impacted tests"
1064
+ complete -c aqe -n "__fish_seen_subcommand_from hypergraph; and not __fish_seen_subcommand_from stats untested impacted gaps" -a "gaps" -d "Find coverage gaps"
1018
1065
  complete -c aqe -n "__fish_use_subcommand" -a "migrate" -d "V2 to V3 migration"
1019
1066
  complete -c aqe -n "__fish_use_subcommand" -a "completions" -d "Generate shell completions"
1020
1067
 
@@ -1217,6 +1264,7 @@ $script:AQE_COMMANDS = @{
1217
1264
  'quality' = 'Quality assessment'
1218
1265
  'security' = 'Security scanning'
1219
1266
  'code' = 'Code intelligence'
1267
+ 'hypergraph' = 'Query the code knowledge hypergraph'
1220
1268
  'migrate' = 'V2 to V3 migration'
1221
1269
  'completions' = 'Generate shell completions'
1222
1270
  }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Agentic QE v3 - Hypergraph Command Handler
3
+ *
4
+ * Exposes hypergraph queries to users via CLI:
5
+ * aqe hypergraph stats - Show node/edge counts by type
6
+ * aqe hypergraph untested - Find functions with no test coverage
7
+ * aqe hypergraph impacted - Find tests impacted by changed files
8
+ * aqe hypergraph gaps - Find functions with low coverage
9
+ */
10
+ import { Command } from 'commander';
11
+ import { ICommandHandler, CLIContext } from './interfaces.js';
12
+ export declare class HypergraphHandler implements ICommandHandler {
13
+ readonly name = "hypergraph";
14
+ readonly description = "Query the code knowledge hypergraph";
15
+ private cleanupAndExit;
16
+ private ensureInitialized;
17
+ constructor(cleanupAndExit: (code: number) => Promise<never>, ensureInitialized: () => Promise<boolean>);
18
+ register(program: Command, _context: CLIContext): void;
19
+ private executeStats;
20
+ private executeUntested;
21
+ private executeImpacted;
22
+ private executeGaps;
23
+ private openEngine;
24
+ getHelp(): string;
25
+ }
26
+ export declare function createHypergraphHandler(cleanupAndExit: (code: number) => Promise<never>, ensureInitialized: () => Promise<boolean>): HypergraphHandler;
27
+ //# sourceMappingURL=hypergraph-handler.d.ts.map
@@ -0,0 +1,248 @@
1
+ /**
2
+ * Agentic QE v3 - Hypergraph Command Handler
3
+ *
4
+ * Exposes hypergraph queries to users via CLI:
5
+ * aqe hypergraph stats - Show node/edge counts by type
6
+ * aqe hypergraph untested - Find functions with no test coverage
7
+ * aqe hypergraph impacted - Find tests impacted by changed files
8
+ * aqe hypergraph gaps - Find functions with low coverage
9
+ */
10
+ import chalk from 'chalk';
11
+ import { join, resolve } from 'path';
12
+ import { existsSync } from 'fs';
13
+ import { findProjectRoot } from '../../kernel/unified-memory.js';
14
+ import { openDatabase } from '../../shared/safe-db.js';
15
+ import { createHypergraphEngine } from '../../integrations/ruvector/hypergraph-engine.js';
16
+ // ============================================================================
17
+ // Hypergraph Handler
18
+ // ============================================================================
19
+ export class HypergraphHandler {
20
+ name = 'hypergraph';
21
+ description = 'Query the code knowledge hypergraph';
22
+ cleanupAndExit;
23
+ ensureInitialized;
24
+ constructor(cleanupAndExit, ensureInitialized) {
25
+ this.cleanupAndExit = cleanupAndExit;
26
+ this.ensureInitialized = ensureInitialized;
27
+ }
28
+ register(program, _context) {
29
+ const hg = program
30
+ .command('hypergraph')
31
+ .alias('hg')
32
+ .description(this.description);
33
+ hg
34
+ .command('stats')
35
+ .description('Show hypergraph statistics (node/edge counts by type)')
36
+ .option('--db <path>', 'Database path')
37
+ .action(async (options) => {
38
+ await this.executeStats(options);
39
+ });
40
+ hg
41
+ .command('untested')
42
+ .description('Find functions with no test coverage')
43
+ .option('--db <path>', 'Database path')
44
+ .option('--limit <number>', 'Max results', '20')
45
+ .action(async (options) => {
46
+ await this.executeUntested(options);
47
+ });
48
+ hg
49
+ .command('impacted <files...>')
50
+ .description('Find tests impacted by changed files')
51
+ .option('--db <path>', 'Database path')
52
+ .action(async (files, options) => {
53
+ await this.executeImpacted(files, options);
54
+ });
55
+ hg
56
+ .command('gaps')
57
+ .description('Find functions with low coverage')
58
+ .option('--db <path>', 'Database path')
59
+ .option('--max-coverage <number>', 'Coverage threshold (%)', '50')
60
+ .option('--limit <number>', 'Max results', '20')
61
+ .action(async (options) => {
62
+ await this.executeGaps(options);
63
+ });
64
+ }
65
+ // --------------------------------------------------------------------------
66
+ // Subcommands
67
+ // --------------------------------------------------------------------------
68
+ async executeStats(options) {
69
+ if (!await this.ensureInitialized())
70
+ return;
71
+ const { engine, close } = await this.openEngine(options.db);
72
+ try {
73
+ const stats = await engine.getStats();
74
+ console.log(chalk.blue('\n Hypergraph Statistics\n'));
75
+ console.log(chalk.white(` Total nodes: ${stats.totalNodes}`));
76
+ console.log(chalk.white(` Total edges: ${stats.totalEdges}`));
77
+ if (stats.totalNodes > 0) {
78
+ console.log(chalk.gray('\n Nodes by type:'));
79
+ for (const [type, count] of Object.entries(stats.nodesByType)) {
80
+ if (count > 0) {
81
+ console.log(chalk.gray(` ${type}: ${count}`));
82
+ }
83
+ }
84
+ console.log(chalk.gray('\n Edges by type:'));
85
+ for (const [type, count] of Object.entries(stats.edgesByType)) {
86
+ if (count > 0) {
87
+ console.log(chalk.gray(` ${type}: ${count}`));
88
+ }
89
+ }
90
+ console.log(chalk.gray(`\n Avg complexity: ${stats.avgComplexity.toFixed(1)}`));
91
+ console.log(chalk.gray(` Avg coverage: ${stats.avgCoverage.toFixed(1)}%`));
92
+ console.log(chalk.gray(` Nodes with embeddings: ${stats.nodesWithEmbeddings}`));
93
+ }
94
+ else {
95
+ console.log(chalk.yellow('\n Hypergraph is empty. Run "aqe init --auto" to populate it.'));
96
+ }
97
+ console.log('');
98
+ }
99
+ finally {
100
+ close();
101
+ }
102
+ await this.cleanupAndExit(0);
103
+ }
104
+ async executeUntested(options) {
105
+ if (!await this.ensureInitialized())
106
+ return;
107
+ const { engine, close } = await this.openEngine(options.db);
108
+ try {
109
+ const limit = parseInt(options.limit, 10) || 20;
110
+ const untested = await engine.findUntestedFunctions();
111
+ const results = untested.slice(0, limit);
112
+ console.log(chalk.blue(`\n Untested Functions (${untested.length} total)\n`));
113
+ if (results.length === 0) {
114
+ console.log(chalk.green(' All functions have test coverage!'));
115
+ }
116
+ else {
117
+ for (const fn of results) {
118
+ const complexity = fn.complexity ? chalk.yellow(` complexity=${fn.complexity}`) : '';
119
+ console.log(chalk.white(` ${fn.name}`) + chalk.gray(` ${fn.filePath || ''}:${fn.lineStart || '?'}`) + complexity);
120
+ }
121
+ if (untested.length > limit) {
122
+ console.log(chalk.gray(`\n ... and ${untested.length - limit} more (use --limit to show more)`));
123
+ }
124
+ }
125
+ console.log('');
126
+ }
127
+ finally {
128
+ close();
129
+ }
130
+ await this.cleanupAndExit(0);
131
+ }
132
+ async executeImpacted(files, options) {
133
+ if (!await this.ensureInitialized())
134
+ return;
135
+ // Resolve relative paths to absolute so they match hypergraph entries
136
+ const absoluteFiles = files.map(f => resolve(f));
137
+ const { engine, close } = await this.openEngine(options.db);
138
+ try {
139
+ const tests = await engine.findImpactedTests(absoluteFiles);
140
+ console.log(chalk.blue(`\n Impacted Tests for ${files.length} file(s)\n`));
141
+ if (tests.length === 0) {
142
+ console.log(chalk.gray(' No impacted tests found. The hypergraph may need rebuilding.'));
143
+ }
144
+ else {
145
+ for (const test of tests) {
146
+ console.log(chalk.white(` ${test.name}`) + chalk.gray(` ${test.filePath || ''}`));
147
+ }
148
+ }
149
+ console.log(chalk.gray(`\n Total: ${tests.length} test(s)\n`));
150
+ }
151
+ finally {
152
+ close();
153
+ }
154
+ await this.cleanupAndExit(0);
155
+ }
156
+ async executeGaps(options) {
157
+ if (!await this.ensureInitialized())
158
+ return;
159
+ const { engine, close } = await this.openEngine(options.db);
160
+ try {
161
+ const maxCoverage = parseInt(options.maxCoverage, 10) || 50;
162
+ const limit = parseInt(options.limit, 10) || 20;
163
+ const gaps = await engine.findCoverageGaps(maxCoverage);
164
+ const results = gaps.slice(0, limit);
165
+ console.log(chalk.blue(`\n Coverage Gaps (<= ${maxCoverage}%) — ${gaps.length} total\n`));
166
+ if (results.length === 0) {
167
+ console.log(chalk.green(' No coverage gaps found!'));
168
+ }
169
+ else {
170
+ for (const fn of results) {
171
+ const cov = fn.coverage !== undefined ? chalk.red(` ${fn.coverage}%`) : '';
172
+ const complexity = fn.complexity ? chalk.yellow(` complexity=${fn.complexity}`) : '';
173
+ console.log(chalk.white(` ${fn.name}`) + cov + chalk.gray(` ${fn.filePath || ''}`) + complexity);
174
+ }
175
+ if (gaps.length > limit) {
176
+ console.log(chalk.gray(`\n ... and ${gaps.length - limit} more (use --limit to show more)`));
177
+ }
178
+ }
179
+ console.log('');
180
+ }
181
+ finally {
182
+ close();
183
+ }
184
+ await this.cleanupAndExit(0);
185
+ }
186
+ // --------------------------------------------------------------------------
187
+ // Helpers
188
+ // --------------------------------------------------------------------------
189
+ async openEngine(dbPathOverride) {
190
+ const projectRoot = findProjectRoot();
191
+ const dbPath = dbPathOverride || join(projectRoot, '.agentic-qe', 'memory.db');
192
+ if (!existsSync(dbPath)) {
193
+ throw new Error(`Database not found: ${dbPath}\nRun "aqe init --auto" first.`);
194
+ }
195
+ const db = openDatabase(dbPath);
196
+ try {
197
+ const engine = await createHypergraphEngine({
198
+ db,
199
+ maxTraversalDepth: 10,
200
+ maxQueryResults: 1000,
201
+ enableVectorSearch: false,
202
+ });
203
+ return {
204
+ engine,
205
+ close: () => {
206
+ try {
207
+ db.close();
208
+ }
209
+ catch { /* ignore */ }
210
+ },
211
+ };
212
+ }
213
+ catch (error) {
214
+ // Close db if engine creation fails to prevent connection leak
215
+ try {
216
+ db.close();
217
+ }
218
+ catch { /* ignore */ }
219
+ throw error;
220
+ }
221
+ }
222
+ getHelp() {
223
+ return `
224
+ Query the code knowledge hypergraph for untested functions,
225
+ impacted tests, and coverage gaps.
226
+
227
+ Usage:
228
+ aqe hypergraph stats Show node/edge counts by type
229
+ aqe hypergraph untested [--limit N] Find functions with no test coverage
230
+ aqe hypergraph impacted <files...> Find tests impacted by changed files
231
+ aqe hypergraph gaps [--max-coverage N] Find functions with low coverage
232
+
233
+ Options:
234
+ --db <path> Override database path (default: .agentic-qe/memory.db)
235
+ --limit <number> Max results (default: 20)
236
+ --max-coverage <n> Coverage threshold for gaps (default: 50)
237
+
238
+ Alias: aqe hg stats
239
+ `;
240
+ }
241
+ }
242
+ // ============================================================================
243
+ // Factory
244
+ // ============================================================================
245
+ export function createHypergraphHandler(cleanupAndExit, ensureInitialized) {
246
+ return new HypergraphHandler(cleanupAndExit, ensureInitialized);
247
+ }
248
+ //# sourceMappingURL=hypergraph-handler.js.map
@@ -11,4 +11,5 @@ export { AgentHandler, createAgentHandler } from './agent-handler.js';
11
11
  export { DomainHandler, createDomainHandler } from './domain-handler.js';
12
12
  export { ProtocolHandler, createProtocolHandler } from './protocol-handler.js';
13
13
  export { BrainHandler, createBrainHandler } from './brain-handler.js';
14
+ export { HypergraphHandler, createHypergraphHandler } from './hypergraph-handler.js';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -13,4 +13,5 @@ export { AgentHandler, createAgentHandler } from './agent-handler.js';
13
13
  export { DomainHandler, createDomainHandler } from './domain-handler.js';
14
14
  export { ProtocolHandler, createProtocolHandler } from './protocol-handler.js';
15
15
  export { BrainHandler, createBrainHandler } from './brain-handler.js';
16
+ export { HypergraphHandler, createHypergraphHandler } from './hypergraph-handler.js';
16
17
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Agentic QE v3 - Default Phase Executor
3
+ * ADR-032: Kuramoto CPG oscillators for self-sustaining scheduling
4
+ *
5
+ * Default implementation of the PhaseExecutor interface that simulates
6
+ * test execution. Replace with real test runner integration in production.
7
+ */
8
+ import type { CPGTestPhase, CPGPhaseResult } from './kuramoto-cpg';
9
+ import type { PhaseExecutor } from './time-crystal-types';
10
+ /**
11
+ * Default phase executor that simulates test execution
12
+ * Replace with real test runner integration in production
13
+ */
14
+ export declare class DefaultPhaseExecutor implements PhaseExecutor {
15
+ private readonly name;
16
+ private ready;
17
+ constructor(name?: string);
18
+ execute(phase: CPGTestPhase): Promise<CPGPhaseResult>;
19
+ isReady(): boolean;
20
+ getName(): string;
21
+ setReady(ready: boolean): void;
22
+ }
23
+ /**
24
+ * Create a default phase executor
25
+ */
26
+ export declare function createDefaultPhaseExecutor(name?: string): DefaultPhaseExecutor;
27
+ //# sourceMappingURL=phase-executor.d.ts.map
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Agentic QE v3 - Default Phase Executor
3
+ * ADR-032: Kuramoto CPG oscillators for self-sustaining scheduling
4
+ *
5
+ * Default implementation of the PhaseExecutor interface that simulates
6
+ * test execution. Replace with real test runner integration in production.
7
+ */
8
+ import { secureRandom, secureRandomInt, secureRandomFloat } from '../../shared/utils/crypto-random.js';
9
+ /**
10
+ * Default phase executor that simulates test execution
11
+ * Replace with real test runner integration in production
12
+ */
13
+ export class DefaultPhaseExecutor {
14
+ name;
15
+ ready = true;
16
+ constructor(name = 'default-executor') {
17
+ this.name = name;
18
+ }
19
+ async execute(phase) {
20
+ const startTime = Date.now();
21
+ // Simulate test execution with some variance
22
+ const basePassRate = phase.qualityThresholds.minPassRate;
23
+ const variance = (secureRandom() - 0.5) * 0.1; // ±5% variance
24
+ const actualPassRate = Math.min(1, Math.max(0, basePassRate + variance));
25
+ const testsRun = secureRandomInt(50, 150);
26
+ const testsPassed = Math.floor(testsRun * actualPassRate);
27
+ const testsFailed = testsRun - testsPassed;
28
+ // Simulate execution time with variance
29
+ const expectedDuration = phase.expectedDuration;
30
+ const durationVariance = (secureRandom() - 0.5) * 0.3; // ±15% variance
31
+ const actualDuration = Math.floor(expectedDuration * (1 + durationVariance));
32
+ // Simulate wait (scaled down for testing - use 1% of expected duration)
33
+ const simulatedWait = Math.min(100, actualDuration * 0.01);
34
+ await new Promise((resolve) => setTimeout(resolve, simulatedWait));
35
+ const flakyRatio = secureRandom() * phase.qualityThresholds.maxFlakyRatio;
36
+ const coverage = secureRandomFloat(phase.qualityThresholds.minCoverage, phase.qualityThresholds.minCoverage + 0.1);
37
+ const qualityMet = actualPassRate >= phase.qualityThresholds.minPassRate &&
38
+ flakyRatio <= phase.qualityThresholds.maxFlakyRatio &&
39
+ coverage >= phase.qualityThresholds.minCoverage;
40
+ return {
41
+ phaseId: phase.id,
42
+ phaseName: phase.name,
43
+ passRate: actualPassRate,
44
+ flakyRatio,
45
+ coverage: Math.min(1, coverage),
46
+ duration: Date.now() - startTime,
47
+ testsRun,
48
+ testsPassed,
49
+ testsFailed,
50
+ testsSkipped: 0,
51
+ qualityMet,
52
+ };
53
+ }
54
+ isReady() {
55
+ return this.ready;
56
+ }
57
+ getName() {
58
+ return this.name;
59
+ }
60
+ setReady(ready) {
61
+ this.ready = ready;
62
+ }
63
+ }
64
+ /**
65
+ * Create a default phase executor
66
+ */
67
+ export function createDefaultPhaseExecutor(name) {
68
+ return new DefaultPhaseExecutor(name);
69
+ }
70
+ //# sourceMappingURL=phase-executor.js.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Agentic QE v3 - Time Crystal Analysis & Observation
3
+ * ADR-047: MinCut Self-Organizing QE Integration - Phase 4
4
+ *
5
+ * Pure functions for metrics collection, attractor detection,
6
+ * anomaly detection, phase prediction, and stabilization decisions.
7
+ */
8
+ import type { ExecutionMetrics, TimeCrystalPhase, CrystalAnomaly, CrystalObservation, TemporalAttractor, StabilizationAction, TimeCrystalConfig } from './time-crystal-types';
9
+ import type { StrangeLoopController } from './strange-loop';
10
+ import type { MinCutHealthMonitor } from './mincut-health-monitor';
11
+ import type { TestFailureCausalGraph } from './causal-discovery';
12
+ /**
13
+ * Collect current execution metrics from available monitors
14
+ */
15
+ export declare function collectMetrics(observations: CrystalObservation[], config: TimeCrystalConfig, healthMonitor?: MinCutHealthMonitor, strangeLoop?: StrangeLoopController): ExecutionMetrics;
16
+ /**
17
+ * Detect the current attractor state from metrics
18
+ */
19
+ export declare function detectAttractor(metrics: ExecutionMetrics, config: TimeCrystalConfig, healthMonitor?: MinCutHealthMonitor): TemporalAttractor;
20
+ /**
21
+ * Detect anomalies in the metrics
22
+ */
23
+ export declare function detectAnomalies(metrics: ExecutionMetrics, metricsHistory: ExecutionMetrics[], phases: Map<string, TimeCrystalPhase>, config: TimeCrystalConfig, causalGraph?: TestFailureCausalGraph): CrystalAnomaly[];
24
+ /**
25
+ * Predict the next phase based on observation history
26
+ */
27
+ export declare function predictPhase(observations: CrystalObservation[], minObservationsForPattern: number): {
28
+ phase: string | undefined;
29
+ confidence: number;
30
+ };
31
+ /**
32
+ * Determine the stabilization action to move toward stable attractor
33
+ */
34
+ export declare function determineStabilization(observations: CrystalObservation[], causalGraph?: TestFailureCausalGraph): StabilizationAction;
35
+ //# sourceMappingURL=time-crystal-analysis.d.ts.map