agentic-qe 3.7.22 → 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.
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +31 -0
- package/README.md +2 -2
- package/dist/cli/bundle.js +5688 -1243
- package/dist/cli/commands/audit.d.ts +43 -0
- package/dist/cli/commands/audit.js +125 -0
- package/dist/cli/commands/learning.js +106 -1
- package/dist/cli/commands/ruvector-commands.d.ts +15 -0
- package/dist/cli/commands/ruvector-commands.js +271 -0
- package/dist/cli/index.js +4 -0
- package/dist/coordination/behavior-tree/decorators.d.ts +108 -0
- package/dist/coordination/behavior-tree/decorators.js +251 -0
- package/dist/coordination/behavior-tree/index.d.ts +12 -0
- package/dist/coordination/behavior-tree/index.js +15 -0
- package/dist/coordination/behavior-tree/nodes.d.ts +165 -0
- package/dist/coordination/behavior-tree/nodes.js +338 -0
- package/dist/coordination/behavior-tree/qe-trees.d.ts +105 -0
- package/dist/coordination/behavior-tree/qe-trees.js +181 -0
- package/dist/coordination/coherence-action-gate.d.ts +284 -0
- package/dist/coordination/coherence-action-gate.js +512 -0
- package/dist/coordination/index.d.ts +4 -0
- package/dist/coordination/index.js +8 -0
- package/dist/coordination/reasoning-qec.d.ts +315 -0
- package/dist/coordination/reasoning-qec.js +585 -0
- package/dist/coordination/task-executor.d.ts +16 -0
- package/dist/coordination/task-executor.js +99 -0
- package/dist/coordination/workflow-orchestrator.d.ts +29 -0
- package/dist/coordination/workflow-orchestrator.js +42 -0
- package/dist/domains/visual-accessibility/cnn-visual-regression.d.ts +135 -0
- package/dist/domains/visual-accessibility/cnn-visual-regression.js +327 -0
- package/dist/domains/visual-accessibility/index.d.ts +1 -0
- package/dist/domains/visual-accessibility/index.js +4 -0
- package/dist/governance/coherence-validator.d.ts +112 -0
- package/dist/governance/coherence-validator.js +180 -0
- package/dist/governance/index.d.ts +1 -0
- package/dist/governance/index.js +2 -0
- package/dist/governance/witness-chain.d.ts +311 -0
- package/dist/governance/witness-chain.js +509 -0
- package/dist/integrations/browser/qe-dashboard/clustering.d.ts +48 -0
- package/dist/integrations/browser/qe-dashboard/clustering.js +183 -0
- package/dist/integrations/browser/qe-dashboard/index.d.ts +12 -0
- package/dist/integrations/browser/qe-dashboard/index.js +15 -0
- package/dist/integrations/browser/qe-dashboard/pattern-explorer.d.ts +165 -0
- package/dist/integrations/browser/qe-dashboard/pattern-explorer.js +260 -0
- package/dist/integrations/browser/qe-dashboard/wasm-vector-store.d.ts +144 -0
- package/dist/integrations/browser/qe-dashboard/wasm-vector-store.js +277 -0
- package/dist/integrations/ruvector/cognitive-container-codec.d.ts +51 -0
- package/dist/integrations/ruvector/cognitive-container-codec.js +180 -0
- package/dist/integrations/ruvector/cognitive-container.d.ts +125 -0
- package/dist/integrations/ruvector/cognitive-container.js +306 -0
- package/dist/integrations/ruvector/coherence-gate.d.ts +309 -0
- package/dist/integrations/ruvector/coherence-gate.js +631 -0
- package/dist/integrations/ruvector/compressed-hnsw-integration.d.ts +176 -0
- package/dist/integrations/ruvector/compressed-hnsw-integration.js +301 -0
- package/dist/integrations/ruvector/dither-adapter.d.ts +122 -0
- package/dist/integrations/ruvector/dither-adapter.js +295 -0
- package/dist/integrations/ruvector/domain-transfer.d.ts +129 -0
- package/dist/integrations/ruvector/domain-transfer.js +220 -0
- package/dist/integrations/ruvector/feature-flags.d.ts +214 -2
- package/dist/integrations/ruvector/feature-flags.js +167 -2
- package/dist/integrations/ruvector/filter-adapter.d.ts +71 -0
- package/dist/integrations/ruvector/filter-adapter.js +285 -0
- package/dist/integrations/ruvector/gnn-wrapper.d.ts +20 -0
- package/dist/integrations/ruvector/gnn-wrapper.js +40 -0
- package/dist/integrations/ruvector/hnsw-health-monitor.d.ts +237 -0
- package/dist/integrations/ruvector/hnsw-health-monitor.js +394 -0
- package/dist/integrations/ruvector/index.d.ts +8 -2
- package/dist/integrations/ruvector/index.js +18 -2
- package/dist/integrations/ruvector/interfaces.d.ts +40 -0
- package/dist/integrations/ruvector/sona-persistence.d.ts +54 -0
- package/dist/integrations/ruvector/sona-persistence.js +162 -0
- package/dist/integrations/ruvector/sona-three-loop.d.ts +392 -0
- package/dist/integrations/ruvector/sona-three-loop.js +814 -0
- package/dist/integrations/ruvector/sona-wrapper.d.ts +97 -0
- package/dist/integrations/ruvector/sona-wrapper.js +147 -3
- package/dist/integrations/ruvector/spectral-math.d.ts +101 -0
- package/dist/integrations/ruvector/spectral-math.js +254 -0
- package/dist/integrations/ruvector/temporal-compression.d.ts +163 -0
- package/dist/integrations/ruvector/temporal-compression.js +318 -0
- package/dist/integrations/ruvector/thompson-sampler.d.ts +61 -0
- package/dist/integrations/ruvector/thompson-sampler.js +118 -0
- package/dist/integrations/ruvector/transfer-coherence-stub.d.ts +80 -0
- package/dist/integrations/ruvector/transfer-coherence-stub.js +63 -0
- package/dist/integrations/ruvector/transfer-verification.d.ts +119 -0
- package/dist/integrations/ruvector/transfer-verification.js +115 -0
- package/dist/kernel/hnsw-adapter.d.ts +52 -1
- package/dist/kernel/hnsw-adapter.js +139 -4
- package/dist/kernel/hnsw-index-provider.d.ts +5 -0
- package/dist/kernel/native-hnsw-backend.d.ts +110 -0
- package/dist/kernel/native-hnsw-backend.js +408 -0
- package/dist/learning/aqe-learning-engine.d.ts +2 -0
- package/dist/learning/aqe-learning-engine.js +65 -0
- package/dist/learning/experience-capture.d.ts +10 -0
- package/dist/learning/experience-capture.js +34 -0
- package/dist/learning/index.d.ts +2 -0
- package/dist/learning/index.js +4 -0
- package/dist/learning/metrics-tracker.d.ts +11 -0
- package/dist/learning/metrics-tracker.js +14 -0
- package/dist/learning/pattern-lifecycle.d.ts +29 -0
- package/dist/learning/pattern-lifecycle.js +74 -0
- package/dist/learning/pattern-store.d.ts +8 -0
- package/dist/learning/pattern-store.js +8 -2
- package/dist/learning/regret-tracker.d.ts +201 -0
- package/dist/learning/regret-tracker.js +361 -0
- package/dist/mcp/bundle.js +5834 -398
- package/dist/routing/index.d.ts +4 -2
- package/dist/routing/index.js +3 -1
- package/dist/routing/neural-tiny-dancer-router.d.ts +268 -0
- package/dist/routing/neural-tiny-dancer-router.js +514 -0
- package/dist/routing/queen-integration.js +5 -5
- package/dist/routing/routing-config.d.ts +6 -0
- package/dist/routing/routing-config.js +1 -0
- package/dist/routing/simple-neural-router.d.ts +76 -0
- package/dist/routing/simple-neural-router.js +202 -0
- package/dist/routing/tiny-dancer-router.d.ts +20 -1
- package/dist/routing/tiny-dancer-router.js +21 -2
- package/dist/test-scheduling/dag-attention-scheduler.d.ts +81 -0
- package/dist/test-scheduling/dag-attention-scheduler.js +358 -0
- package/dist/test-scheduling/dag-attention-types.d.ts +81 -0
- package/dist/test-scheduling/dag-attention-types.js +10 -0
- package/dist/test-scheduling/index.d.ts +1 -0
- package/dist/test-scheduling/index.js +4 -0
- package/dist/test-scheduling/pipeline.d.ts +8 -0
- package/dist/test-scheduling/pipeline.js +28 -0
- package/package.json +6 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Audit Command
|
|
3
|
+
*
|
|
4
|
+
* Verifies the witness chain audit trail integrity.
|
|
5
|
+
* Shows chain length, integrity status, and last receipt hash.
|
|
6
|
+
*
|
|
7
|
+
* Usage: aqe audit verify [--format json|text]
|
|
8
|
+
*
|
|
9
|
+
* @module cli/commands/audit
|
|
10
|
+
* @see ADR-083-coherence-gated-agent-actions.md
|
|
11
|
+
*/
|
|
12
|
+
import { Command } from 'commander';
|
|
13
|
+
import { type ChainVerificationResult } from '../../governance/witness-chain.js';
|
|
14
|
+
import type { CLIContext } from '../handlers/interfaces.js';
|
|
15
|
+
/**
|
|
16
|
+
* Verification output for JSON format.
|
|
17
|
+
*/
|
|
18
|
+
export interface AuditVerifyOutput {
|
|
19
|
+
featureEnabled: boolean;
|
|
20
|
+
chainLength: number;
|
|
21
|
+
integrity: boolean;
|
|
22
|
+
brokenAt: number;
|
|
23
|
+
lastHash: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Format verification result as human-readable text.
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatVerificationText(result: ChainVerificationResult, featureEnabled: boolean): string;
|
|
30
|
+
/**
|
|
31
|
+
* Handle the audit verify command.
|
|
32
|
+
*
|
|
33
|
+
* Loads the witness chain from SQLite if available, otherwise creates
|
|
34
|
+
* a fresh in-memory chain.
|
|
35
|
+
*/
|
|
36
|
+
export declare function handleAuditVerify(options: {
|
|
37
|
+
format?: 'json' | 'text';
|
|
38
|
+
}): Promise<AuditVerifyOutput>;
|
|
39
|
+
/**
|
|
40
|
+
* Create the audit command group following the project convention.
|
|
41
|
+
*/
|
|
42
|
+
export declare function createAuditCommand(_context: CLIContext, cleanupAndExit: (code: number) => Promise<never>, _ensureInitialized: () => Promise<boolean>): Command;
|
|
43
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Audit Command
|
|
3
|
+
*
|
|
4
|
+
* Verifies the witness chain audit trail integrity.
|
|
5
|
+
* Shows chain length, integrity status, and last receipt hash.
|
|
6
|
+
*
|
|
7
|
+
* Usage: aqe audit verify [--format json|text]
|
|
8
|
+
*
|
|
9
|
+
* @module cli/commands/audit
|
|
10
|
+
* @see ADR-083-coherence-gated-agent-actions.md
|
|
11
|
+
*/
|
|
12
|
+
import { Command } from 'commander';
|
|
13
|
+
import chalk from 'chalk';
|
|
14
|
+
import { createWitnessChain, createPersistentWitnessChain, createWitnessChainSQLitePersistence, isWitnessChainFeatureEnabled, } from '../../governance/witness-chain.js';
|
|
15
|
+
import { findProjectRoot } from '../../kernel/unified-memory.js';
|
|
16
|
+
import { existsSync } from 'node:fs';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
/**
|
|
19
|
+
* Format verification result as human-readable text.
|
|
20
|
+
*/
|
|
21
|
+
export function formatVerificationText(result, featureEnabled) {
|
|
22
|
+
const lines = [];
|
|
23
|
+
lines.push(chalk.bold('Witness Chain Audit Verification'));
|
|
24
|
+
lines.push('');
|
|
25
|
+
// Feature flag status
|
|
26
|
+
const flagStatus = featureEnabled
|
|
27
|
+
? chalk.green('ENABLED')
|
|
28
|
+
: chalk.yellow('DISABLED');
|
|
29
|
+
lines.push(` Feature Flag: ${flagStatus}`);
|
|
30
|
+
// Chain length
|
|
31
|
+
lines.push(` Chain Length: ${result.length} receipts`);
|
|
32
|
+
// Integrity status
|
|
33
|
+
const integrityStatus = result.valid
|
|
34
|
+
? chalk.green('VALID')
|
|
35
|
+
: chalk.red('BROKEN');
|
|
36
|
+
lines.push(` Integrity: ${integrityStatus}`);
|
|
37
|
+
// Last hash
|
|
38
|
+
if (result.length > 0) {
|
|
39
|
+
lines.push(` Last Hash: ${result.lastHash.slice(0, 16)}...`);
|
|
40
|
+
}
|
|
41
|
+
// Details
|
|
42
|
+
if (!result.valid && result.brokenAt >= 0) {
|
|
43
|
+
lines.push('');
|
|
44
|
+
lines.push(chalk.red(` Break detected at index ${result.brokenAt}`));
|
|
45
|
+
lines.push(chalk.red(` ${result.message}`));
|
|
46
|
+
}
|
|
47
|
+
lines.push('');
|
|
48
|
+
return lines.join('\n');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Try to load a SQLite-backed witness chain from the project's unified database.
|
|
52
|
+
* Returns null if the database is unavailable.
|
|
53
|
+
*/
|
|
54
|
+
function tryLoadPersistentChain() {
|
|
55
|
+
try {
|
|
56
|
+
const root = findProjectRoot();
|
|
57
|
+
const dbPath = path.join(root, '.agentic-qe', 'memory.db');
|
|
58
|
+
if (!existsSync(dbPath))
|
|
59
|
+
return null;
|
|
60
|
+
// Dynamic import to avoid hard dependency on better-sqlite3 at CLI load time
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
62
|
+
const Database = require('better-sqlite3');
|
|
63
|
+
const db = new Database(dbPath);
|
|
64
|
+
const persistence = createWitnessChainSQLitePersistence(db);
|
|
65
|
+
const chain = createPersistentWitnessChain(persistence);
|
|
66
|
+
// Close the DB handle; chain data is now loaded into memory
|
|
67
|
+
db.close();
|
|
68
|
+
return chain;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Handle the audit verify command.
|
|
76
|
+
*
|
|
77
|
+
* Loads the witness chain from SQLite if available, otherwise creates
|
|
78
|
+
* a fresh in-memory chain.
|
|
79
|
+
*/
|
|
80
|
+
export async function handleAuditVerify(options) {
|
|
81
|
+
const featureEnabled = isWitnessChainFeatureEnabled();
|
|
82
|
+
// Load persisted chain from SQLite if available, else in-memory
|
|
83
|
+
const chain = tryLoadPersistentChain() ?? createWitnessChain();
|
|
84
|
+
const result = chain.verifyChain();
|
|
85
|
+
const output = {
|
|
86
|
+
featureEnabled,
|
|
87
|
+
chainLength: result.length,
|
|
88
|
+
integrity: result.valid,
|
|
89
|
+
brokenAt: result.brokenAt,
|
|
90
|
+
lastHash: result.lastHash,
|
|
91
|
+
message: result.message,
|
|
92
|
+
};
|
|
93
|
+
if (options.format === 'json') {
|
|
94
|
+
console.log(JSON.stringify(output, null, 2));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
console.log(formatVerificationText(result, featureEnabled));
|
|
98
|
+
}
|
|
99
|
+
return output;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create the audit command group following the project convention.
|
|
103
|
+
*/
|
|
104
|
+
export function createAuditCommand(_context, cleanupAndExit, _ensureInitialized) {
|
|
105
|
+
const audit = new Command('audit')
|
|
106
|
+
.description('Witness chain audit trail management');
|
|
107
|
+
audit
|
|
108
|
+
.command('verify')
|
|
109
|
+
.description('Verify witness chain integrity')
|
|
110
|
+
.option('-F, --format <format>', 'Output format (json|text)', 'text')
|
|
111
|
+
.action(async (options) => {
|
|
112
|
+
try {
|
|
113
|
+
await handleAuditVerify({
|
|
114
|
+
format: options.format,
|
|
115
|
+
});
|
|
116
|
+
await cleanupAndExit(0);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
console.error('Failed to verify witness chain:', error);
|
|
120
|
+
await cleanupAndExit(1);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
return audit;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -18,9 +18,10 @@ import { safeJsonParse } from '../../shared/safe-json.js';
|
|
|
18
18
|
import { stat, unlink } from 'node:fs/promises';
|
|
19
19
|
import { QE_DOMAIN_LIST } from '../../learning/qe-patterns.js';
|
|
20
20
|
import { createLearningMetricsTracker, } from '../../learning/metrics-tracker.js';
|
|
21
|
+
import { createRegretTracker, } from '../../learning/regret-tracker.js';
|
|
21
22
|
import { openDatabase } from '../../shared/safe-db.js';
|
|
22
23
|
// Extracted helpers
|
|
23
|
-
import { initializeLearningSystem, printJson, printSuccess, printError, printInfo, displayDashboard, getDbPath, compressFile, decompressFile, verifyDatabaseIntegrity, getSchemaVersion, EXPORT_FORMAT_VERSION, DOMAIN_MAPPING, PATTERN_TYPE_MAPPING, } from './learning-helpers.js';
|
|
24
|
+
import { initializeLearningSystem, printJson, printSuccess, printError, printInfo, displayDashboard, getDbPath, compressFile, decompressFile, verifyDatabaseIntegrity, getSchemaVersion, padRight, EXPORT_FORMAT_VERSION, DOMAIN_MAPPING, PATTERN_TYPE_MAPPING, } from './learning-helpers.js';
|
|
24
25
|
// ============================================================================
|
|
25
26
|
// Learning Command
|
|
26
27
|
// ============================================================================
|
|
@@ -63,6 +64,7 @@ Examples:
|
|
|
63
64
|
registerImportMergeCommand(learning);
|
|
64
65
|
registerDreamCommand(learning);
|
|
65
66
|
registerRepairCommand(learning);
|
|
67
|
+
registerHealthCommand(learning);
|
|
66
68
|
return learning;
|
|
67
69
|
}
|
|
68
70
|
// ============================================================================
|
|
@@ -1288,6 +1290,109 @@ function registerRepairCommand(learning) {
|
|
|
1288
1290
|
});
|
|
1289
1291
|
}
|
|
1290
1292
|
// ============================================================================
|
|
1293
|
+
// Subcommand: health (Task 2.4 - Regret Tracking & Learning Health)
|
|
1294
|
+
// ============================================================================
|
|
1295
|
+
/**
|
|
1296
|
+
* Get trend arrow and label for a growth rate classification
|
|
1297
|
+
*/
|
|
1298
|
+
function growthRateDisplay(rate) {
|
|
1299
|
+
switch (rate) {
|
|
1300
|
+
case 'sublinear':
|
|
1301
|
+
return { arrow: '\u25B2', label: 'Sublinear (learning)', color: chalk.green };
|
|
1302
|
+
case 'linear':
|
|
1303
|
+
return { arrow: '\u2192', label: 'Linear (stagnating)', color: chalk.yellow };
|
|
1304
|
+
case 'superlinear':
|
|
1305
|
+
return { arrow: '\u25BC', label: 'Superlinear (degrading)', color: chalk.red };
|
|
1306
|
+
case 'insufficient_data':
|
|
1307
|
+
default:
|
|
1308
|
+
return { arrow: '?', label: 'Insufficient data', color: chalk.dim };
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
function registerHealthCommand(learning) {
|
|
1312
|
+
learning
|
|
1313
|
+
.command('health')
|
|
1314
|
+
.description('Display per-domain learning health based on regret tracking')
|
|
1315
|
+
.option('--json', 'Output as JSON')
|
|
1316
|
+
.option('--domain <domain>', 'Filter to a specific domain')
|
|
1317
|
+
.action(async (options) => {
|
|
1318
|
+
try {
|
|
1319
|
+
const projectRoot = findProjectRoot();
|
|
1320
|
+
const dbPath = path.join(projectRoot, '.agentic-qe', 'memory.db');
|
|
1321
|
+
if (!existsSync(dbPath)) {
|
|
1322
|
+
printError('Database not found. Run "aqe init --auto" first.');
|
|
1323
|
+
process.exit(1);
|
|
1324
|
+
}
|
|
1325
|
+
// Build regret data from captured experiences per domain
|
|
1326
|
+
const tracker = createRegretTracker();
|
|
1327
|
+
const db = openDatabase(dbPath, { readonly: true });
|
|
1328
|
+
// Check for captured_experiences table
|
|
1329
|
+
const tableExists = db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='captured_experiences'`).get();
|
|
1330
|
+
if (tableExists) {
|
|
1331
|
+
// Query experiences grouped by domain, ordered by time
|
|
1332
|
+
const domainFilter = options.domain
|
|
1333
|
+
? `AND domain = ?` : '';
|
|
1334
|
+
const params = [];
|
|
1335
|
+
if (options.domain)
|
|
1336
|
+
params.push(options.domain);
|
|
1337
|
+
const rows = db.prepare(`
|
|
1338
|
+
SELECT domain, quality, success, started_at
|
|
1339
|
+
FROM captured_experiences
|
|
1340
|
+
WHERE agent != 'cli-hook'
|
|
1341
|
+
AND domain IS NOT NULL
|
|
1342
|
+
AND domain != ''
|
|
1343
|
+
${domainFilter}
|
|
1344
|
+
ORDER BY started_at ASC
|
|
1345
|
+
`).all(...params);
|
|
1346
|
+
for (const row of rows) {
|
|
1347
|
+
const reward = row.quality ?? (row.success ? 1.0 : 0.0);
|
|
1348
|
+
const optimalReward = 1.0;
|
|
1349
|
+
tracker.recordDecision(row.domain, reward, optimalReward);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
db.close();
|
|
1353
|
+
const healthSummary = tracker.getHealthSummary();
|
|
1354
|
+
if (options.json) {
|
|
1355
|
+
printJson(healthSummary);
|
|
1356
|
+
process.exit(0);
|
|
1357
|
+
}
|
|
1358
|
+
// Display health dashboard
|
|
1359
|
+
console.log('');
|
|
1360
|
+
console.log(chalk.bold('Learning Health Dashboard:'));
|
|
1361
|
+
if (healthSummary.length === 0) {
|
|
1362
|
+
console.log(chalk.dim(' No domain data available. Run some QE tasks to generate learning data.'));
|
|
1363
|
+
console.log('');
|
|
1364
|
+
process.exit(0);
|
|
1365
|
+
}
|
|
1366
|
+
// Find the longest domain name for alignment
|
|
1367
|
+
const maxDomainLen = Math.max(...healthSummary.map(s => s.domain.length), 20);
|
|
1368
|
+
for (const summary of healthSummary) {
|
|
1369
|
+
const { arrow, label, color } = growthRateDisplay(summary.growthRate);
|
|
1370
|
+
const domainName = padRight(summary.domain + ':', maxDomainLen + 1);
|
|
1371
|
+
const statusStr = color(`${arrow} ${padRight(label, 26)}`);
|
|
1372
|
+
const regretStr = `regret: ${summary.cumulativeRegret.toFixed(1)}`;
|
|
1373
|
+
const decisionsStr = `decisions: ${summary.totalDecisions}`;
|
|
1374
|
+
console.log(` ${domainName} ${statusStr} ${regretStr} ${decisionsStr}`);
|
|
1375
|
+
}
|
|
1376
|
+
// Show summary line
|
|
1377
|
+
const stagnating = healthSummary.filter(s => s.stagnating);
|
|
1378
|
+
if (stagnating.length > 0) {
|
|
1379
|
+
console.log('');
|
|
1380
|
+
console.log(chalk.yellow(` Warning: ${stagnating.length} domain(s) showing stagnation: ${stagnating.map(s => s.domain).join(', ')}`));
|
|
1381
|
+
}
|
|
1382
|
+
const learning = healthSummary.filter(s => s.growthRate === 'sublinear');
|
|
1383
|
+
if (learning.length > 0) {
|
|
1384
|
+
console.log(chalk.green(` ${learning.length} domain(s) actively learning`));
|
|
1385
|
+
}
|
|
1386
|
+
console.log('');
|
|
1387
|
+
process.exit(0);
|
|
1388
|
+
}
|
|
1389
|
+
catch (error) {
|
|
1390
|
+
printError(`health check failed: ${error instanceof Error ? error.message : 'unknown'}`);
|
|
1391
|
+
process.exit(1);
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
// ============================================================================
|
|
1291
1396
|
// Exports
|
|
1292
1397
|
// ============================================================================
|
|
1293
1398
|
export { initializeLearningSystem } from './learning-helpers.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - RuVector CLI Commands
|
|
3
|
+
* Manage RuVector feature flags and native package status.
|
|
4
|
+
*
|
|
5
|
+
* Subcommands:
|
|
6
|
+
* status - Show native package availability and flag status
|
|
7
|
+
* flags - List, set, or apply profiles to feature flags
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from 'commander';
|
|
10
|
+
/**
|
|
11
|
+
* Create the ruvector command group
|
|
12
|
+
*/
|
|
13
|
+
export declare function createRuVectorCommand(): Command;
|
|
14
|
+
export default createRuVectorCommand;
|
|
15
|
+
//# sourceMappingURL=ruvector-commands.d.ts.map
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - RuVector CLI Commands
|
|
3
|
+
* Manage RuVector feature flags and native package status.
|
|
4
|
+
*
|
|
5
|
+
* Subcommands:
|
|
6
|
+
* status - Show native package availability and flag status
|
|
7
|
+
* flags - List, set, or apply profiles to feature flags
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from 'commander';
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import { getRuVectorFeatureFlags, setRuVectorFeatureFlags, DEFAULT_FEATURE_FLAGS, } from '../../integrations/ruvector/feature-flags.js';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Constants
|
|
14
|
+
// ============================================================================
|
|
15
|
+
const NATIVE_PACKAGES = [
|
|
16
|
+
{
|
|
17
|
+
name: '@ruvector/router',
|
|
18
|
+
flag: 'useNativeHNSW',
|
|
19
|
+
fallback: 'ProgressiveHnswBackend',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'prime-radiant-advanced-wasm',
|
|
23
|
+
flag: 'useCoherenceGate',
|
|
24
|
+
fallback: 'Word-frequency heuristics',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: '@ruvector/sona',
|
|
28
|
+
flag: 'useSONAThreeLoop',
|
|
29
|
+
fallback: 'TypeScript MicroLoRA/EWC++',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
const FLAG_DESCRIPTIONS = {
|
|
33
|
+
useQESONA: 'Self-Optimizing Neural Architecture',
|
|
34
|
+
useQEFlashAttention: 'SIMD-accelerated attention computation',
|
|
35
|
+
useQEGNNIndex: 'Differentiable search and HNSW indexing',
|
|
36
|
+
logMigrationMetrics: 'Log migration metrics during rollout',
|
|
37
|
+
useNativeHNSW: 'Rust-based HNSW backend (@ruvector/router VectorDb)',
|
|
38
|
+
useTemporalCompression: 'Temporal tensor compression (ADR-085)',
|
|
39
|
+
useMetadataFiltering: 'SIMD-accelerated metadata filtering',
|
|
40
|
+
useDeterministicDither: 'Cross-platform deterministic dithering',
|
|
41
|
+
useNeuralRouting: 'Neural model routing via FastGRNN (ADR-082)',
|
|
42
|
+
useSONAThreeLoop: 'SONA Three-Loop Engine (Task 2.2)',
|
|
43
|
+
useCrossDomainTransfer: 'Cross-domain transfer learning (ADR-084)',
|
|
44
|
+
useHnswHealthMonitor: 'HNSW health monitor (Task 3.4)',
|
|
45
|
+
useRegretTracking: 'Regret tracking & learning health (Task 2.4)',
|
|
46
|
+
useCoherenceGate: 'Sheaf-gated coherence validation (ADR-083, Task 3.1)',
|
|
47
|
+
useWitnessChain: 'Blake3 hash-chained witness records (Task 3.1)',
|
|
48
|
+
useCNNVisualRegression: 'CNN visual regression testing (Task 4.3)',
|
|
49
|
+
useDAGAttention: 'DAG attention for test scheduling (Task 4.2)',
|
|
50
|
+
useCoherenceActionGate: 'Coherence-gated agent actions (ADR-083, Task 3.2)',
|
|
51
|
+
useReasoningQEC: 'Reasoning QEC error correction (Task 4.5)',
|
|
52
|
+
};
|
|
53
|
+
const PROFILES = {
|
|
54
|
+
performance: {
|
|
55
|
+
useNativeHNSW: true,
|
|
56
|
+
useTemporalCompression: true,
|
|
57
|
+
useDeterministicDither: true,
|
|
58
|
+
},
|
|
59
|
+
experimental: {
|
|
60
|
+
useQESONA: true,
|
|
61
|
+
useQEFlashAttention: true,
|
|
62
|
+
useQEGNNIndex: true,
|
|
63
|
+
logMigrationMetrics: true,
|
|
64
|
+
useNativeHNSW: true,
|
|
65
|
+
useTemporalCompression: true,
|
|
66
|
+
useMetadataFiltering: true,
|
|
67
|
+
useDeterministicDither: true,
|
|
68
|
+
useNeuralRouting: true,
|
|
69
|
+
},
|
|
70
|
+
safe: {
|
|
71
|
+
useQESONA: true,
|
|
72
|
+
useQEFlashAttention: true,
|
|
73
|
+
useQEGNNIndex: true,
|
|
74
|
+
logMigrationMetrics: true,
|
|
75
|
+
useNativeHNSW: false,
|
|
76
|
+
useTemporalCompression: false,
|
|
77
|
+
useMetadataFiltering: false,
|
|
78
|
+
useDeterministicDither: false,
|
|
79
|
+
useNeuralRouting: false,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
const VALID_FLAG_NAMES = Object.keys(DEFAULT_FEATURE_FLAGS);
|
|
83
|
+
// ============================================================================
|
|
84
|
+
// Helpers
|
|
85
|
+
// ============================================================================
|
|
86
|
+
/**
|
|
87
|
+
* Check whether a native package is installed.
|
|
88
|
+
* Returns true if the package can be resolved, false otherwise.
|
|
89
|
+
*/
|
|
90
|
+
function isNativePackageInstalled(packageName) {
|
|
91
|
+
try {
|
|
92
|
+
require.resolve(packageName);
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function isDefaultValue(flag, value) {
|
|
100
|
+
return DEFAULT_FEATURE_FLAGS[flag] === value;
|
|
101
|
+
}
|
|
102
|
+
function padRight(str, length) {
|
|
103
|
+
return str.padEnd(length);
|
|
104
|
+
}
|
|
105
|
+
function isValidFlagName(name) {
|
|
106
|
+
return VALID_FLAG_NAMES.includes(name);
|
|
107
|
+
}
|
|
108
|
+
function isValidProfile(name) {
|
|
109
|
+
return name in PROFILES;
|
|
110
|
+
}
|
|
111
|
+
// ============================================================================
|
|
112
|
+
// Command: ruvector status
|
|
113
|
+
// ============================================================================
|
|
114
|
+
function executeStatus() {
|
|
115
|
+
const flags = getRuVectorFeatureFlags();
|
|
116
|
+
console.log('');
|
|
117
|
+
console.log(chalk.bold.blue('RuVector Integration Status:'));
|
|
118
|
+
// Native packages section
|
|
119
|
+
console.log(chalk.cyan(' Native Packages:'));
|
|
120
|
+
for (const pkg of NATIVE_PACKAGES) {
|
|
121
|
+
const installed = isNativePackageInstalled(pkg.name);
|
|
122
|
+
const statusText = installed
|
|
123
|
+
? chalk.green('installed')
|
|
124
|
+
: chalk.gray(`not installed (fallback: ${pkg.fallback})`);
|
|
125
|
+
console.log(` ${padRight(pkg.name + ':', 30)} ${statusText}`);
|
|
126
|
+
}
|
|
127
|
+
// Feature flags section
|
|
128
|
+
console.log('');
|
|
129
|
+
console.log(chalk.cyan(' Feature Flags:'));
|
|
130
|
+
for (const flagName of VALID_FLAG_NAMES) {
|
|
131
|
+
const value = flags[flagName];
|
|
132
|
+
const isDefault = isDefaultValue(flagName, value);
|
|
133
|
+
const valueText = value ? chalk.green('true') : chalk.gray('false');
|
|
134
|
+
const suffix = isDefault ? chalk.gray(' (default)') : chalk.yellow(' (modified)');
|
|
135
|
+
console.log(` ${padRight(flagName + ':', 30)} ${valueText}${suffix}`);
|
|
136
|
+
}
|
|
137
|
+
// Memory info when compression is enabled
|
|
138
|
+
if (flags.useTemporalCompression) {
|
|
139
|
+
console.log('');
|
|
140
|
+
console.log(chalk.cyan(' Temporal Compression:'));
|
|
141
|
+
console.log(chalk.gray(' Hot tier: 8-bit quantization (frequently accessed patterns)'));
|
|
142
|
+
console.log(chalk.gray(' Warm tier: 5-bit quantization (moderately accessed patterns)'));
|
|
143
|
+
console.log(chalk.gray(' Cold tier: 3-bit quantization (rarely accessed patterns)'));
|
|
144
|
+
console.log(chalk.gray(' Estimated memory savings: 40-60% for cold patterns'));
|
|
145
|
+
}
|
|
146
|
+
console.log('');
|
|
147
|
+
}
|
|
148
|
+
// ============================================================================
|
|
149
|
+
// Command: ruvector flags
|
|
150
|
+
// ============================================================================
|
|
151
|
+
function executeFlags(options) {
|
|
152
|
+
// Handle --profile
|
|
153
|
+
if (options.profile) {
|
|
154
|
+
if (!isValidProfile(options.profile)) {
|
|
155
|
+
console.log('');
|
|
156
|
+
console.log(chalk.red(` Unknown profile: ${options.profile}`));
|
|
157
|
+
console.log(chalk.gray(` Valid profiles: ${Object.keys(PROFILES).join(', ')}`));
|
|
158
|
+
console.log('');
|
|
159
|
+
process.exit(1);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const profileFlags = PROFILES[options.profile];
|
|
163
|
+
setRuVectorFeatureFlags(profileFlags);
|
|
164
|
+
console.log('');
|
|
165
|
+
console.log(chalk.bold.blue(`Setting ${options.profile} profile:`));
|
|
166
|
+
for (const [key, value] of Object.entries(profileFlags)) {
|
|
167
|
+
const valueText = value ? chalk.green('true') : chalk.gray('false');
|
|
168
|
+
console.log(` ${padRight(key + ':', 30)} ${valueText}`);
|
|
169
|
+
}
|
|
170
|
+
console.log('');
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
// Handle --set
|
|
174
|
+
if (options.set) {
|
|
175
|
+
const eqIdx = options.set.indexOf('=');
|
|
176
|
+
if (eqIdx <= 0) {
|
|
177
|
+
console.log('');
|
|
178
|
+
console.log(chalk.red(' Invalid format. Use: --set flagName=true|false'));
|
|
179
|
+
console.log('');
|
|
180
|
+
process.exit(1);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const flagName = options.set.substring(0, eqIdx);
|
|
184
|
+
const flagValue = options.set.substring(eqIdx + 1);
|
|
185
|
+
if (!isValidFlagName(flagName)) {
|
|
186
|
+
console.log('');
|
|
187
|
+
console.log(chalk.red(` Unknown flag: ${flagName}`));
|
|
188
|
+
console.log(chalk.gray(` Valid flags: ${VALID_FLAG_NAMES.join(', ')}`));
|
|
189
|
+
console.log('');
|
|
190
|
+
process.exit(1);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (flagValue !== 'true' && flagValue !== 'false') {
|
|
194
|
+
console.log('');
|
|
195
|
+
console.log(chalk.red(` Invalid value: ${flagValue}. Use true or false.`));
|
|
196
|
+
console.log('');
|
|
197
|
+
process.exit(1);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const boolValue = flagValue === 'true';
|
|
201
|
+
setRuVectorFeatureFlags({ [flagName]: boolValue });
|
|
202
|
+
const valueText = boolValue ? chalk.green('true') : chalk.gray('false');
|
|
203
|
+
console.log('');
|
|
204
|
+
console.log(chalk.green(` Set ${flagName} = ${valueText}`));
|
|
205
|
+
console.log('');
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
// Default: list all flags
|
|
209
|
+
const flags = getRuVectorFeatureFlags();
|
|
210
|
+
console.log('');
|
|
211
|
+
console.log(chalk.bold.blue('RuVector Feature Flags:'));
|
|
212
|
+
console.log('');
|
|
213
|
+
console.log(chalk.bold(' ' + padRight('Flag', 28) + padRight('Value', 10) + 'Description'));
|
|
214
|
+
console.log(chalk.gray(' ' + '-'.repeat(78)));
|
|
215
|
+
for (const flagName of VALID_FLAG_NAMES) {
|
|
216
|
+
const value = flags[flagName];
|
|
217
|
+
const isDefault = isDefaultValue(flagName, value);
|
|
218
|
+
const valueText = value ? chalk.green('true') : chalk.gray('false');
|
|
219
|
+
const suffix = isDefault ? '' : chalk.yellow(' *');
|
|
220
|
+
const description = FLAG_DESCRIPTIONS[flagName];
|
|
221
|
+
console.log(' ' +
|
|
222
|
+
padRight(flagName, 28) +
|
|
223
|
+
padRight(String(value), 10) +
|
|
224
|
+
chalk.gray(description) +
|
|
225
|
+
suffix);
|
|
226
|
+
}
|
|
227
|
+
console.log('');
|
|
228
|
+
console.log(chalk.gray(' * = modified from default'));
|
|
229
|
+
console.log('');
|
|
230
|
+
console.log(chalk.gray(' Profiles: performance, experimental, safe'));
|
|
231
|
+
console.log(chalk.gray(' Usage:'));
|
|
232
|
+
console.log(chalk.gray(' aqe ruvector flags --set useNativeHNSW=true'));
|
|
233
|
+
console.log(chalk.gray(' aqe ruvector flags --profile=performance'));
|
|
234
|
+
console.log('');
|
|
235
|
+
}
|
|
236
|
+
// ============================================================================
|
|
237
|
+
// Command Factory
|
|
238
|
+
// ============================================================================
|
|
239
|
+
/**
|
|
240
|
+
* Create the ruvector command group
|
|
241
|
+
*/
|
|
242
|
+
export function createRuVectorCommand() {
|
|
243
|
+
const ruvectorCmd = new Command('ruvector')
|
|
244
|
+
.description('RuVector integration management')
|
|
245
|
+
.addHelpText('after', `
|
|
246
|
+
Examples:
|
|
247
|
+
$ aqe ruvector status Show native packages and flags
|
|
248
|
+
$ aqe ruvector flags List all feature flags
|
|
249
|
+
$ aqe ruvector flags --set useNativeHNSW=true Toggle a flag
|
|
250
|
+
$ aqe ruvector flags --profile=performance Apply a preset profile
|
|
251
|
+
`);
|
|
252
|
+
// ruvector status
|
|
253
|
+
ruvectorCmd
|
|
254
|
+
.command('status')
|
|
255
|
+
.description('Show native package availability and feature flag status')
|
|
256
|
+
.action(() => {
|
|
257
|
+
executeStatus();
|
|
258
|
+
});
|
|
259
|
+
// ruvector flags
|
|
260
|
+
ruvectorCmd
|
|
261
|
+
.command('flags')
|
|
262
|
+
.description('List, set, or apply profiles to feature flags')
|
|
263
|
+
.option('-s, --set <flag=value>', 'Set a feature flag (e.g., useNativeHNSW=true)')
|
|
264
|
+
.option('-p, --profile <name>', 'Apply a preset profile (performance|experimental|safe)')
|
|
265
|
+
.action((options) => {
|
|
266
|
+
executeFlags(options);
|
|
267
|
+
});
|
|
268
|
+
return ruvectorCmd;
|
|
269
|
+
}
|
|
270
|
+
export default createRuVectorCommand;
|
|
271
|
+
//# sourceMappingURL=ruvector-commands.js.map
|
package/dist/cli/index.js
CHANGED
|
@@ -819,6 +819,8 @@ import { createLearningCommand } from './commands/learning.js';
|
|
|
819
819
|
import { createMcpCommand } from './commands/mcp.js';
|
|
820
820
|
import { createPlatformCommand } from './commands/platform.js';
|
|
821
821
|
import { createProveCommand } from './commands/prove.js';
|
|
822
|
+
import { createRuVectorCommand } from './commands/ruvector-commands.js';
|
|
823
|
+
import { createAuditCommand } from './commands/audit.js';
|
|
822
824
|
program.addCommand(createTokenUsageCommand());
|
|
823
825
|
program.addCommand(createLLMRouterCommand());
|
|
824
826
|
program.addCommand(createSyncCommands());
|
|
@@ -827,6 +829,8 @@ program.addCommand(createLearningCommand());
|
|
|
827
829
|
program.addCommand(createMcpCommand());
|
|
828
830
|
program.addCommand(createPlatformCommand());
|
|
829
831
|
program.addCommand(createProveCommand(context, cleanupAndExit, ensureInitialized));
|
|
832
|
+
program.addCommand(createRuVectorCommand());
|
|
833
|
+
program.addCommand(createAuditCommand(context, cleanupAndExit, ensureInitialized));
|
|
830
834
|
// ============================================================================
|
|
831
835
|
// Shutdown Handlers
|
|
832
836
|
// ============================================================================
|