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.
- package/.claude/helpers/brain-checkpoint.cjs +4 -1
- package/.claude/helpers/statusline-v3.cjs +3 -1
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +45 -0
- package/README.md +2 -14
- package/assets/helpers/statusline-v3.cjs +3 -1
- package/dist/cli/brain-commands.js +6 -10
- package/dist/cli/bundle.js +7441 -4327
- package/dist/cli/commands/audit.d.ts +43 -0
- package/dist/cli/commands/audit.js +125 -0
- package/dist/cli/commands/hooks.js +29 -6
- package/dist/cli/commands/init.js +1 -73
- package/dist/cli/commands/learning.js +270 -13
- package/dist/cli/commands/ruvector-commands.d.ts +15 -0
- package/dist/cli/commands/ruvector-commands.js +271 -0
- package/dist/cli/handlers/init-handler.d.ts +0 -1
- package/dist/cli/handlers/init-handler.js +0 -6
- package/dist/cli/index.js +4 -2
- package/dist/context/sources/defect-source.js +2 -2
- package/dist/context/sources/memory-source.js +2 -2
- package/dist/context/sources/requirements-source.js +2 -2
- 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/init/index.d.ts +0 -2
- package/dist/init/index.js +0 -1
- package/dist/init/init-wizard-steps.d.ts +10 -0
- package/dist/init/init-wizard-steps.js +87 -1
- package/dist/init/init-wizard.d.ts +1 -9
- package/dist/init/init-wizard.js +3 -69
- package/dist/init/orchestrator.js +0 -1
- package/dist/init/phases/01-detection.js +0 -27
- package/dist/init/phases/07-hooks.js +6 -4
- package/dist/init/phases/phase-interface.d.ts +0 -1
- package/dist/init/settings-merge.js +1 -1
- 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/kernel/unified-memory.js +5 -6
- package/dist/learning/aqe-learning-engine.d.ts +2 -0
- package/dist/learning/aqe-learning-engine.js +65 -0
- package/dist/learning/experience-capture-middleware.js +20 -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 -2
- package/dist/learning/index.js +4 -4
- package/dist/learning/metrics-tracker.d.ts +11 -0
- package/dist/learning/metrics-tracker.js +29 -13
- package/dist/learning/pattern-lifecycle.d.ts +30 -1
- package/dist/learning/pattern-lifecycle.js +92 -20
- package/dist/learning/pattern-store.d.ts +8 -0
- package/dist/learning/pattern-store.js +8 -2
- package/dist/learning/qe-unified-memory.js +1 -28
- package/dist/learning/regret-tracker.d.ts +201 -0
- package/dist/learning/regret-tracker.js +361 -0
- package/dist/mcp/bundle.js +5915 -474
- 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
- package/dist/cli/commands/migrate.d.ts +0 -9
- package/dist/cli/commands/migrate.js +0 -566
- package/dist/init/init-wizard-migration.d.ts +0 -52
- package/dist/init/init-wizard-migration.js +0 -345
- package/dist/init/migration/config-migrator.d.ts +0 -31
- package/dist/init/migration/config-migrator.js +0 -149
- package/dist/init/migration/data-migrator.d.ts +0 -72
- package/dist/init/migration/data-migrator.js +0 -232
- package/dist/init/migration/detector.d.ts +0 -44
- package/dist/init/migration/detector.js +0 -105
- package/dist/init/migration/index.d.ts +0 -8
- package/dist/init/migration/index.js +0 -8
- package/dist/learning/v2-to-v3-migration.d.ts +0 -86
- package/dist/learning/v2-to-v3-migration.js +0 -529
package/dist/routing/index.d.ts
CHANGED
|
@@ -18,8 +18,10 @@ export type { SignalSource, RoutingSignal, MergedAgentScore, SignalMergerConfig,
|
|
|
18
18
|
export { RoutingFeedbackCollector, createRoutingFeedbackCollector, } from './routing-feedback.js';
|
|
19
19
|
export { classifyTask, isSimpleTask, requiresOpus, getRecommendedModel, getComplexityScore, COMPLEX_DOMAINS, MODERATE_DOMAINS, COMPLEX_CAPABILITIES, COMPLEXITY_THRESHOLDS, COMPLEXITY_TO_MODEL, } from './task-classifier.js';
|
|
20
20
|
export type { TaskComplexity, ClaudeModel, ComplexityFactor, ClassificationResult, ClassifiableTask, } from './task-classifier.js';
|
|
21
|
-
export { TinyDancerRouter, createTinyDancerRouter, } from './tiny-dancer-router.js';
|
|
22
|
-
export type { RouteResult, TinyDancerConfig, RoutingOutcome as TinyDancerRoutingOutcome, RouterStats, } from './tiny-dancer-router.js';
|
|
21
|
+
export { TinyDancerRouter, createTinyDancerRouter, createSmartTinyDancerRouter, } from './tiny-dancer-router.js';
|
|
22
|
+
export type { ITaskRouter, RouteResult, TinyDancerConfig, RoutingOutcome as TinyDancerRoutingOutcome, RouterStats, } from './tiny-dancer-router.js';
|
|
23
|
+
export { NeuralTinyDancerRouter, SimpleNeuralRouter, createNeuralTinyDancerRouter, } from './neural-tiny-dancer-router.js';
|
|
24
|
+
export type { NeuralTinyDancerConfig, ShadowDecisionLog, NeuralRouterStats, EmpiricalConfidenceBounds, ConformalBounds, } from './neural-tiny-dancer-router.js';
|
|
23
25
|
export { DEFAULT_ROUTING_CONFIG, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_TIER_MAPPING, DEFAULT_COST_OPTIMIZATION, DEFAULT_FALLBACK_CONFIG, loadRoutingConfigFromEnv, mapComplexityToTier, getNextFallbackTier, tierToModel, estimateTaskCost, validateRoutingConfig, } from './routing-config.js';
|
|
24
26
|
export type { AgentTier, ConfidenceThresholds, ComplexityTierMapping, CostOptimizationConfig, FallbackConfig, RoutingConfig, } from './routing-config.js';
|
|
25
27
|
export { parseDependenciesFromFrontmatter, buildDependencyGraph, createSpawnPlan, getAgentDependencies, } from './agent-dependency-graph.js';
|
package/dist/routing/index.js
CHANGED
|
@@ -21,7 +21,9 @@ export { RoutingFeedbackCollector, createRoutingFeedbackCollector, } from './rou
|
|
|
21
21
|
// Task Classifier (TD-002)
|
|
22
22
|
export { classifyTask, isSimpleTask, requiresOpus, getRecommendedModel, getComplexityScore, COMPLEX_DOMAINS, MODERATE_DOMAINS, COMPLEX_CAPABILITIES, COMPLEXITY_THRESHOLDS, COMPLEXITY_TO_MODEL, } from './task-classifier.js';
|
|
23
23
|
// TinyDancer Router (TD-003)
|
|
24
|
-
export { TinyDancerRouter, createTinyDancerRouter, } from './tiny-dancer-router.js';
|
|
24
|
+
export { TinyDancerRouter, createTinyDancerRouter, createSmartTinyDancerRouter, } from './tiny-dancer-router.js';
|
|
25
|
+
// Neural TinyDancer Router (ADR-082)
|
|
26
|
+
export { NeuralTinyDancerRouter, SimpleNeuralRouter, createNeuralTinyDancerRouter, } from './neural-tiny-dancer-router.js';
|
|
25
27
|
// Routing Configuration (TD-004)
|
|
26
28
|
export { DEFAULT_ROUTING_CONFIG, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_TIER_MAPPING, DEFAULT_COST_OPTIMIZATION, DEFAULT_FALLBACK_CONFIG, loadRoutingConfigFromEnv, mapComplexityToTier, getNextFallbackTier, tierToModel, estimateTaskCost, validateRoutingConfig, } from './routing-config.js';
|
|
27
29
|
// Agent Dependency Graph (Issue #342 Item 2)
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Neural TinyDancer Router - ADR-082
|
|
3
|
+
* Neural Model Routing via FastGRNN-style Network
|
|
4
|
+
*
|
|
5
|
+
* Replaces rule-based complexity thresholds with a lightweight neural network
|
|
6
|
+
* for routing decisions. Implements shadow mode for safe rollout, circuit
|
|
7
|
+
* breaker for reliability, and online learning from outcome feedback.
|
|
8
|
+
*
|
|
9
|
+
* Design:
|
|
10
|
+
* - Input features: [complexityScore, tokenEstimate, domainIndex, historicalSuccessRate]
|
|
11
|
+
* - Hidden layer: 32 units with ReLU activation
|
|
12
|
+
* - Output: softmax probability distribution over [Tier1/haiku, Tier2/sonnet, Tier3/opus]
|
|
13
|
+
* - Shadow mode: first 1000 decisions run both routers, tracks disagreement
|
|
14
|
+
* - Circuit breaker: falls back to rule-based if error rate exceeds threshold
|
|
15
|
+
*
|
|
16
|
+
* @module routing/neural-tiny-dancer-router
|
|
17
|
+
*/
|
|
18
|
+
import type { QETask } from './types.js';
|
|
19
|
+
import { type ClassifiableTask, type ClaudeModel, type ClassificationResult } from './task-classifier.js';
|
|
20
|
+
import { TinyDancerRouter, type RouteResult, type TinyDancerConfig } from './tiny-dancer-router.js';
|
|
21
|
+
export { SimpleNeuralRouter } from './simple-neural-router.js';
|
|
22
|
+
import { SimpleNeuralRouter } from './simple-neural-router.js';
|
|
23
|
+
/**
|
|
24
|
+
* Neural router configuration extending TinyDancerConfig
|
|
25
|
+
*/
|
|
26
|
+
export interface NeuralTinyDancerConfig extends TinyDancerConfig {
|
|
27
|
+
/** Circuit breaker error rate threshold (default: 0.20) */
|
|
28
|
+
circuitBreakerThreshold?: number;
|
|
29
|
+
/** Learning rate for weight updates (default: 0.01) */
|
|
30
|
+
learningRate?: number;
|
|
31
|
+
/** Force shadow mode on/off (undefined = auto) */
|
|
32
|
+
forceShadowMode?: boolean;
|
|
33
|
+
/** Number of decisions for shadow mode (default: 1000) */
|
|
34
|
+
shadowModeDecisions?: number;
|
|
35
|
+
/** Max disagreement rate to exit shadow mode (default: 0.10) */
|
|
36
|
+
shadowModeMaxDisagreement?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Shadow mode decision log entry
|
|
40
|
+
*/
|
|
41
|
+
export interface ShadowDecisionLog {
|
|
42
|
+
/** Task description (truncated) */
|
|
43
|
+
readonly taskDescription: string;
|
|
44
|
+
/** Rule-based router decision */
|
|
45
|
+
readonly ruleDecision: ClaudeModel;
|
|
46
|
+
/** Neural router decision */
|
|
47
|
+
readonly neuralDecision: ClaudeModel;
|
|
48
|
+
/** Whether both routers agreed */
|
|
49
|
+
readonly agreed: boolean;
|
|
50
|
+
/** Neural network confidence for chosen tier */
|
|
51
|
+
readonly neuralConfidence: number;
|
|
52
|
+
/** Timestamp */
|
|
53
|
+
readonly timestamp: Date;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Neural router statistics
|
|
57
|
+
*/
|
|
58
|
+
export interface NeuralRouterStats {
|
|
59
|
+
/** Whether shadow mode is active */
|
|
60
|
+
readonly shadowModeActive: boolean;
|
|
61
|
+
/** Total shadow mode decisions made */
|
|
62
|
+
readonly shadowDecisions: number;
|
|
63
|
+
/** Disagreement rate in shadow mode */
|
|
64
|
+
readonly disagreementRate: number;
|
|
65
|
+
/** Whether circuit breaker is tripped */
|
|
66
|
+
readonly circuitBreakerTripped: boolean;
|
|
67
|
+
/** Recent error rate (last N decisions) */
|
|
68
|
+
readonly recentErrorRate: number;
|
|
69
|
+
/** Total neural routing decisions */
|
|
70
|
+
readonly totalNeuralDecisions: number;
|
|
71
|
+
/** Total weight updates from feedback */
|
|
72
|
+
readonly totalWeightUpdates: number;
|
|
73
|
+
/** Whether neural routing is primary */
|
|
74
|
+
readonly neuralPrimary: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Empirical confidence bounds from historical calibration scores.
|
|
78
|
+
*
|
|
79
|
+
* Note: This is NOT proper conformal prediction (which requires exchangeability
|
|
80
|
+
* guarantees and per-class nonconformity scoring). These are quantile-based
|
|
81
|
+
* intervals from historical routing outcomes.
|
|
82
|
+
*/
|
|
83
|
+
export interface EmpiricalConfidenceBounds {
|
|
84
|
+
/** Lower bound of prediction interval */
|
|
85
|
+
readonly lower: number;
|
|
86
|
+
/** Upper bound of prediction interval */
|
|
87
|
+
readonly upper: number;
|
|
88
|
+
/** Coverage level (e.g. 0.90 = 90% prediction interval) */
|
|
89
|
+
readonly coverageLevel: number;
|
|
90
|
+
/** Calibration score (1 - max probability) */
|
|
91
|
+
readonly calibrationScore: number;
|
|
92
|
+
}
|
|
93
|
+
/** Backward-compatible alias */
|
|
94
|
+
export type ConformalBounds = EmpiricalConfidenceBounds;
|
|
95
|
+
/**
|
|
96
|
+
* Neural-enhanced TinyDancer Router
|
|
97
|
+
*
|
|
98
|
+
* Wraps the rule-based TinyDancerRouter with a lightweight neural network
|
|
99
|
+
* that learns optimal routing decisions from outcomes. Operates in shadow
|
|
100
|
+
* mode initially, then transitions to neural-primary when proven reliable.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const router = new NeuralTinyDancerRouter({ learningRate: 0.01 });
|
|
105
|
+
* const result = await router.route(task);
|
|
106
|
+
* // Later, record outcome for learning
|
|
107
|
+
* router.recordNeuralOutcome(task, result, true, 0.95);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare class NeuralTinyDancerRouter {
|
|
111
|
+
/** Rule-based fallback router (always available) */
|
|
112
|
+
private readonly ruleRouter;
|
|
113
|
+
/** Neural network for routing decisions */
|
|
114
|
+
private readonly neuralNet;
|
|
115
|
+
/** Configuration */
|
|
116
|
+
private readonly circuitBreakerThreshold;
|
|
117
|
+
private readonly shadowModeDecisionLimit;
|
|
118
|
+
private readonly shadowModeMaxDisagreement;
|
|
119
|
+
/** Shadow mode state */
|
|
120
|
+
private shadowModeActive;
|
|
121
|
+
private shadowDecisions;
|
|
122
|
+
private shadowDisagreements;
|
|
123
|
+
/** Circuit breaker state */
|
|
124
|
+
private circuitBreakerTripped;
|
|
125
|
+
private recentOutcomes;
|
|
126
|
+
/** Tracking */
|
|
127
|
+
private totalNeuralDecisions;
|
|
128
|
+
private totalWeightUpdates;
|
|
129
|
+
private neuralPrimary;
|
|
130
|
+
/** Calibration scores for empirical confidence bounds */
|
|
131
|
+
private calibrationScores;
|
|
132
|
+
private readonly maxCalibrationScores;
|
|
133
|
+
/** Historical success rates by domain for feature extraction */
|
|
134
|
+
private domainSuccessRates;
|
|
135
|
+
/** Config passthrough */
|
|
136
|
+
private readonly config;
|
|
137
|
+
/** Whether native ruvector module is available */
|
|
138
|
+
private nativeRouterAvailable;
|
|
139
|
+
constructor(config?: NeuralTinyDancerConfig);
|
|
140
|
+
/**
|
|
141
|
+
* Check for native router availability.
|
|
142
|
+
*
|
|
143
|
+
* The `@ruvector/tiny-dancer` NAPI package exists but the ARM64 binary
|
|
144
|
+
* is missing from the published package (packaging bug upstream).
|
|
145
|
+
* The TypeScript `SimpleNeuralRouter` IS the production implementation —
|
|
146
|
+
* its 4→32→3 network is too small to benefit from native acceleration.
|
|
147
|
+
*/
|
|
148
|
+
private tryLoadNativeRouter;
|
|
149
|
+
/**
|
|
150
|
+
* Route a task to the optimal Claude model.
|
|
151
|
+
*
|
|
152
|
+
* Behavior depends on current mode:
|
|
153
|
+
* - Shadow mode: uses rule-based result, logs neural decision alongside
|
|
154
|
+
* - Neural primary: uses neural decision with rule-based as validation
|
|
155
|
+
* - Circuit breaker tripped: uses rule-based only
|
|
156
|
+
*
|
|
157
|
+
* @param task - The task to route
|
|
158
|
+
* @returns Routing result with model recommendation and confidence
|
|
159
|
+
*/
|
|
160
|
+
route(task: QETask | ClassifiableTask): Promise<RouteResult>;
|
|
161
|
+
/**
|
|
162
|
+
* Extract feature vector from a task for neural network input.
|
|
163
|
+
*
|
|
164
|
+
* Features:
|
|
165
|
+
* [0] complexityScore: normalized classification score (0-1)
|
|
166
|
+
* [1] tokenEstimate: estimated token count, normalized (0-1)
|
|
167
|
+
* [2] domainIndex: domain-based complexity signal (0-1)
|
|
168
|
+
* [3] historicalSuccessRate: domain success rate (0-1)
|
|
169
|
+
*/
|
|
170
|
+
extractFeatures(task: QETask | ClassifiableTask, classification: ClassificationResult): number[];
|
|
171
|
+
/**
|
|
172
|
+
* Record the outcome of a routing decision for neural learning.
|
|
173
|
+
*
|
|
174
|
+
* Updates both the rule-based router (for stats) and the neural network
|
|
175
|
+
* weights (via policy gradient).
|
|
176
|
+
*/
|
|
177
|
+
recordNeuralOutcome(task: QETask | ClassifiableTask, routeResult: RouteResult, success: boolean, qualityScore?: number, actualModelUsed?: ClaudeModel, durationMs?: number): void;
|
|
178
|
+
/**
|
|
179
|
+
* Compute empirical confidence bounds from historical calibration scores.
|
|
180
|
+
*
|
|
181
|
+
* Note: This is NOT proper conformal prediction (which requires exchangeability
|
|
182
|
+
* guarantees and per-class nonconformity scoring). These are quantile-based
|
|
183
|
+
* intervals from historical routing outcomes.
|
|
184
|
+
*/
|
|
185
|
+
computeEmpiricalConfidenceBounds(probs: number[]): EmpiricalConfidenceBounds;
|
|
186
|
+
/**
|
|
187
|
+
* Backward-compatible alias for computeEmpiricalConfidenceBounds.
|
|
188
|
+
* @deprecated Use computeEmpiricalConfidenceBounds instead.
|
|
189
|
+
*/
|
|
190
|
+
computeConformalBounds(probs: number[]): EmpiricalConfidenceBounds;
|
|
191
|
+
/**
|
|
192
|
+
* Check whether shadow mode should end.
|
|
193
|
+
* Exits when enough decisions made AND disagreement rate is acceptable.
|
|
194
|
+
*/
|
|
195
|
+
private evaluateShadowModeExit;
|
|
196
|
+
/**
|
|
197
|
+
* Check circuit breaker and trip if error rate exceeds threshold.
|
|
198
|
+
*/
|
|
199
|
+
private checkCircuitBreaker;
|
|
200
|
+
/**
|
|
201
|
+
* Trip the circuit breaker, falling back to rule-based routing.
|
|
202
|
+
*/
|
|
203
|
+
private tripCircuitBreaker;
|
|
204
|
+
/**
|
|
205
|
+
* Build reasoning string for neural routing decision
|
|
206
|
+
*/
|
|
207
|
+
private buildNeuralReasoning;
|
|
208
|
+
/**
|
|
209
|
+
* Get the index of the maximum value in an array.
|
|
210
|
+
*/
|
|
211
|
+
private argmax;
|
|
212
|
+
/**
|
|
213
|
+
* Get neural router statistics
|
|
214
|
+
*/
|
|
215
|
+
getNeuralStats(): NeuralRouterStats;
|
|
216
|
+
/**
|
|
217
|
+
* Get shadow mode decision logs
|
|
218
|
+
*/
|
|
219
|
+
getShadowDecisionLogs(): readonly ShadowDecisionLog[];
|
|
220
|
+
/**
|
|
221
|
+
* Get the underlying rule-based router (for direct access if needed)
|
|
222
|
+
*/
|
|
223
|
+
getRuleRouter(): TinyDancerRouter;
|
|
224
|
+
/**
|
|
225
|
+
* Get the underlying neural network (for serialization/deserialization)
|
|
226
|
+
*/
|
|
227
|
+
getNeuralNet(): SimpleNeuralRouter;
|
|
228
|
+
/**
|
|
229
|
+
* Check if native ruvector router is available
|
|
230
|
+
*/
|
|
231
|
+
isNativeRouterAvailable(): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Check if shadow mode is active
|
|
234
|
+
*/
|
|
235
|
+
isShadowModeActive(): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Check if neural routing is primary
|
|
238
|
+
*/
|
|
239
|
+
isNeuralPrimary(): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Check if circuit breaker is tripped
|
|
242
|
+
*/
|
|
243
|
+
isCircuitBreakerTripped(): boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Manually reset the circuit breaker
|
|
246
|
+
*/
|
|
247
|
+
resetCircuitBreaker(): void;
|
|
248
|
+
/**
|
|
249
|
+
* Get the rule-based router's stats (delegates)
|
|
250
|
+
*/
|
|
251
|
+
getStats(): import("./tiny-dancer-router.js").RouterStats;
|
|
252
|
+
/**
|
|
253
|
+
* Get the rule-based router's config (delegates)
|
|
254
|
+
*/
|
|
255
|
+
getConfig(): TinyDancerConfig;
|
|
256
|
+
/**
|
|
257
|
+
* Reset all state (both rule-based and neural)
|
|
258
|
+
*/
|
|
259
|
+
reset(): void;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Create a new Neural TinyDancer router instance
|
|
263
|
+
*
|
|
264
|
+
* @param config - Neural router configuration
|
|
265
|
+
* @returns Configured Neural TinyDancer router
|
|
266
|
+
*/
|
|
267
|
+
export declare function createNeuralTinyDancerRouter(config?: NeuralTinyDancerConfig): NeuralTinyDancerRouter;
|
|
268
|
+
//# sourceMappingURL=neural-tiny-dancer-router.d.ts.map
|