@bonginkan/maria 2.1.5 → 2.1.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.
@@ -0,0 +1,1408 @@
1
+ export { createCLI } from './cli.js';
2
+ import { EventEmitter } from 'events';
3
+ import 'commander';
4
+
5
+ /**
6
+ * Slash Command Type Definitions
7
+ * Core types for the microservice-based command architecture
8
+ */
9
+ type CommandCategory = 'core' | 'auth' | 'config' | 'configuration' | 'project' | 'development' | 'generation' | 'analysis' | 'media' | 'conversation' | 'utilities' | 'integration' | 'advanced' | 'system';
10
+ interface CommandArgs {
11
+ raw: string[];
12
+ parsed: Record<string, unknown>;
13
+ flags: Record<string, boolean>;
14
+ options: Record<string, string>;
15
+ }
16
+ interface CommandContext {
17
+ user?: {
18
+ id: string;
19
+ email?: string;
20
+ role?: string;
21
+ } | null;
22
+ session: {
23
+ id: string;
24
+ commandHistory: string[];
25
+ };
26
+ conversation?: {
27
+ history: any[];
28
+ };
29
+ environment: {
30
+ cwd: string;
31
+ };
32
+ }
33
+ interface CommandResult {
34
+ success: boolean;
35
+ message: string;
36
+ data?: unknown;
37
+ component?: ComponentType;
38
+ requiresInput?: boolean;
39
+ metadata?: {
40
+ executionTime: number;
41
+ memoryUsed?: number;
42
+ commandVersion?: string;
43
+ };
44
+ }
45
+ type ComponentType = 'config-panel' | 'auth-flow' | 'help-dialog' | 'status-display' | 'system-diagnostics' | 'cost-display' | 'agents-display' | 'mcp-display' | 'model-selector' | 'image-generator' | 'video-generator' | 'avatar-generator' | 'voice-assistant';
46
+ interface ValidationResult {
47
+ success: boolean;
48
+ error?: string;
49
+ suggestions?: string[];
50
+ }
51
+ interface CommandMetadata {
52
+ version: string;
53
+ author: string;
54
+ deprecated?: boolean;
55
+ experimental?: boolean;
56
+ since?: string;
57
+ replacedBy?: string;
58
+ }
59
+ interface CommandPermission {
60
+ role?: string;
61
+ scope?: string[];
62
+ requiresAuth?: boolean;
63
+ requiresPremium?: boolean;
64
+ }
65
+ interface CommandExample {
66
+ input: string;
67
+ description: string;
68
+ output?: string;
69
+ }
70
+ interface ISlashCommand {
71
+ name: string;
72
+ aliases?: string[];
73
+ category: CommandCategory;
74
+ description: string;
75
+ usage: string;
76
+ examples: CommandExample[];
77
+ permissions?: CommandPermission;
78
+ middleware?: string[];
79
+ rateLimit?: {
80
+ requests: number;
81
+ window: string;
82
+ };
83
+ initialize?(): Promise<void>;
84
+ validate?(args: CommandArgs): Promise<ValidationResult>;
85
+ execute(args: CommandArgs, context: CommandContext): Promise<CommandResult>;
86
+ cleanup?(): Promise<void>;
87
+ rollback?(context: CommandContext, error: Error): Promise<void>;
88
+ metadata: CommandMetadata;
89
+ }
90
+ type MiddlewareNext = () => Promise<CommandResult>;
91
+ interface IMiddleware {
92
+ name: string;
93
+ priority?: number;
94
+ execute(command: ISlashCommand, args: CommandArgs, context: CommandContext, next: MiddlewareNext): Promise<CommandResult>;
95
+ }
96
+
97
+ /**
98
+ * Base Command Class
99
+ * Abstract base class for all slash commands
100
+ */
101
+
102
+ declare abstract class BaseCommand implements ISlashCommand {
103
+ abstract name: string;
104
+ abstract category: CommandCategory;
105
+ abstract description: string;
106
+ aliases?: string[];
107
+ usage: string;
108
+ examples: CommandExample[];
109
+ permissions?: CommandPermission;
110
+ middleware?: string[];
111
+ rateLimit?: {
112
+ requests: number;
113
+ window: string;
114
+ };
115
+ metadata: CommandMetadata;
116
+ private cache;
117
+ /**
118
+ * Initialize the command (called once when registered)
119
+ */
120
+ initialize(): Promise<void>;
121
+ /**
122
+ * Validate command arguments
123
+ */
124
+ validate(_args: CommandArgs): Promise<ValidationResult>;
125
+ /**
126
+ * Execute the command - must be implemented by subclasses
127
+ */
128
+ abstract execute(args: CommandArgs, context: CommandContext): Promise<CommandResult>;
129
+ /**
130
+ * Cleanup resources (called when command is unregistered)
131
+ */
132
+ cleanup(): Promise<void>;
133
+ /**
134
+ * Rollback on error - override for custom rollback logic
135
+ */
136
+ rollback(_context: CommandContext, error: Error): Promise<void>;
137
+ /**
138
+ * Parse command arguments into structured format
139
+ */
140
+ protected parseArgs(raw: string[]): CommandArgs;
141
+ /**
142
+ * Create a success response
143
+ */
144
+ protected success(message: string, data?: unknown, metadata?: Partial<CommandResult['metadata']>): CommandResult;
145
+ /**
146
+ * Create an error response
147
+ */
148
+ protected error(message: string, code?: string, details?: unknown): CommandResult;
149
+ /**
150
+ * Cache data with TTL
151
+ */
152
+ protected setCache(key: string, data: unknown, ttlSeconds?: number): void;
153
+ /**
154
+ * Get cached data
155
+ */
156
+ protected getCache<T = unknown>(key: string): T | null;
157
+ /**
158
+ * Check if user has required permissions
159
+ */
160
+ protected checkPermissions(context: CommandContext): Promise<ValidationResult>;
161
+ /**
162
+ * Format help text for this command
163
+ */
164
+ formatHelp(): string;
165
+ /**
166
+ * Log command execution
167
+ */
168
+ protected logExecution(args: CommandArgs, context: CommandContext, result: CommandResult): void;
169
+ }
170
+
171
+ /**
172
+ * Command Registry System
173
+ * Central registry for all slash commands with auto-discovery
174
+ */
175
+
176
+ declare class CommandRegistry {
177
+ private commands;
178
+ private aliases;
179
+ private middlewares;
180
+ private rateLimits;
181
+ private _initialized;
182
+ private get initialized();
183
+ private set initialized(value);
184
+ constructor();
185
+ /**
186
+ * Register a command
187
+ */
188
+ register(command: ISlashCommand): void;
189
+ /**
190
+ * Unregister a command
191
+ */
192
+ unregister(name: string): boolean;
193
+ /**
194
+ * Get a command by name or alias
195
+ */
196
+ get(nameOrAlias: string): ISlashCommand | undefined;
197
+ /**
198
+ * Check if a command exists
199
+ */
200
+ has(nameOrAlias: string): boolean;
201
+ /**
202
+ * Get all registered commands
203
+ */
204
+ getAll(): ISlashCommand[];
205
+ /**
206
+ * Get commands by category
207
+ */
208
+ getByCategory(category: string): ISlashCommand[];
209
+ /**
210
+ * Execute a command
211
+ */
212
+ execute(commandName: string, args: string[], context: CommandContext): Promise<CommandResult>;
213
+ /**
214
+ * Auto-register commands from directory
215
+ */
216
+ autoRegister(directory: string): Promise<void>;
217
+ /**
218
+ * Register a middleware
219
+ */
220
+ registerMiddleware(middleware: IMiddleware): void;
221
+ private setupDefaultMiddlewares;
222
+ private parseArguments;
223
+ private checkPermissions;
224
+ private checkRateLimit;
225
+ private parseWindow;
226
+ private runMiddlewareChain;
227
+ private getSuggestions;
228
+ private isValidCommand;
229
+ private logExecution;
230
+ }
231
+ declare const commandRegistry: CommandRegistry;
232
+
233
+ /**
234
+ * Slash Commands Module
235
+ * Export all command system components
236
+ */
237
+
238
+ /**
239
+ * Initialize the slash command system
240
+ */
241
+ declare function initializeSlashCommands(): Promise<void>;
242
+ /**
243
+ * Get command suggestions for auto-complete
244
+ */
245
+ declare function getCommandSuggestions(input: string): string[];
246
+ /**
247
+ * Get all commands grouped by category
248
+ */
249
+ declare function getCommandsByCategory(): Record<string, ISlashCommand[]>;
250
+
251
+ /**
252
+ * MARIA Memory System - Core Type Definitions
253
+ *
254
+ * Comprehensive memory interfaces based on Cipher's dual-layer architecture
255
+ * System 1: Fast, intuitive memory patterns
256
+ * System 2: Deliberate reasoning and quality traces
257
+ */
258
+ interface MemoryEvent {
259
+ id: string;
260
+ type: MemoryEventType;
261
+ timestamp: Date;
262
+ userId: string;
263
+ sessionId: string;
264
+ data: unknown;
265
+ reasoning?: ReasoningTrace;
266
+ metadata: EventMetadata;
267
+ }
268
+ type MemoryEventType = 'code_generation' | 'bug_fix' | 'quality_improvement' | 'team_interaction' | 'learning_update' | 'pattern_recognition' | 'mode_change';
269
+ interface EventMetadata {
270
+ confidence: number;
271
+ source: 'user_input' | 'ai_generated' | 'system_inferred';
272
+ priority: 'low' | 'medium' | 'high' | 'critical';
273
+ tags: string[];
274
+ projectId?: string;
275
+ teamId?: string;
276
+ }
277
+ interface System1Memory {
278
+ programmingConcepts: KnowledgeNode[];
279
+ businessLogic: ConceptGraph;
280
+ pastInteractions: InteractionHistory;
281
+ codePatterns: PatternLibrary;
282
+ userPreferences: UserPreferenceSet;
283
+ }
284
+ interface KnowledgeNode {
285
+ id: string;
286
+ type: 'function' | 'class' | 'module' | 'concept' | 'pattern';
287
+ name: string;
288
+ content: string;
289
+ embedding: number[];
290
+ confidence: number;
291
+ lastAccessed: Date;
292
+ accessCount: number;
293
+ metadata: NodeMetadata;
294
+ }
295
+ interface NodeMetadata {
296
+ language?: string;
297
+ framework?: string;
298
+ domain?: string;
299
+ complexity: 'low' | 'medium' | 'high';
300
+ quality: number;
301
+ relevance: number;
302
+ }
303
+ interface ConceptGraph {
304
+ nodes: Map<string, KnowledgeNode>;
305
+ edges: Map<string, ConceptEdge>;
306
+ clusters: ConceptCluster[];
307
+ }
308
+ interface ConceptEdge {
309
+ id: string;
310
+ sourceId: string;
311
+ targetId: string;
312
+ type: 'depends_on' | 'implements' | 'uses' | 'similar_to' | 'extends';
313
+ weight: number;
314
+ confidence: number;
315
+ }
316
+ interface ConceptCluster {
317
+ id: string;
318
+ name: string;
319
+ nodeIds: string[];
320
+ centroid: number[];
321
+ coherence: number;
322
+ }
323
+ interface InteractionHistory {
324
+ sessions: SessionRecord[];
325
+ commands: CommandHistory[];
326
+ patterns: UsagePattern[];
327
+ }
328
+ interface SessionRecord {
329
+ id: string;
330
+ startTime: Date;
331
+ endTime?: Date;
332
+ userId: string;
333
+ commands: string[];
334
+ outcomes: SessionOutcome[];
335
+ satisfaction?: number;
336
+ }
337
+ interface CommandHistory {
338
+ command: string;
339
+ frequency: number;
340
+ lastUsed: Date;
341
+ successRate: number;
342
+ averageExecutionTime: number;
343
+ userSatisfaction: number;
344
+ }
345
+ interface UsagePattern {
346
+ id: string;
347
+ type: 'temporal' | 'sequential' | 'contextual';
348
+ pattern: string;
349
+ frequency: number;
350
+ confidence: number;
351
+ conditions: PatternCondition[];
352
+ }
353
+ interface PatternCondition {
354
+ type: 'time_of_day' | 'project_type' | 'team_size' | 'complexity';
355
+ value: string | number;
356
+ operator: 'equals' | 'greater_than' | 'less_than' | 'contains';
357
+ }
358
+ interface PatternLibrary {
359
+ codePatterns: CodePattern[];
360
+ antiPatterns: AntiPattern[];
361
+ bestPractices: BestPractice[];
362
+ templates: CodeTemplate[];
363
+ }
364
+ interface CodePattern {
365
+ id: string;
366
+ name: string;
367
+ description: string;
368
+ code: string;
369
+ language: string;
370
+ framework?: string;
371
+ useCase: string;
372
+ complexity: 'beginner' | 'intermediate' | 'advanced';
373
+ performance: PerformanceMetrics;
374
+ examples: CodeExample[];
375
+ }
376
+ interface AntiPattern {
377
+ id: string;
378
+ name: string;
379
+ description: string;
380
+ problem: string;
381
+ solution: string;
382
+ severity: 'low' | 'medium' | 'high' | 'critical';
383
+ detectionRules: DetectionRule[];
384
+ }
385
+ interface DetectionRule {
386
+ type: 'syntax' | 'semantic' | 'performance' | 'security';
387
+ pattern: string;
388
+ confidence: number;
389
+ }
390
+ interface BestPractice {
391
+ id: string;
392
+ name: string;
393
+ description: string;
394
+ category: string;
395
+ applicability: ApplicabilityRule[];
396
+ benefits: string[];
397
+ implementation: ImplementationGuide;
398
+ }
399
+ interface ApplicabilityRule {
400
+ condition: string;
401
+ context: string[];
402
+ priority: number;
403
+ }
404
+ interface ImplementationGuide {
405
+ steps: string[];
406
+ examples: CodeExample[];
407
+ tools: string[];
408
+ estimatedTime: number;
409
+ }
410
+ interface CodeTemplate {
411
+ id: string;
412
+ name: string;
413
+ description: string;
414
+ template: string;
415
+ variables: TemplateVariable[];
416
+ language: string;
417
+ framework?: string;
418
+ category: string;
419
+ }
420
+ interface TemplateVariable {
421
+ name: string;
422
+ type: 'string' | 'number' | 'boolean' | 'object';
423
+ default?: unknown;
424
+ description: string;
425
+ required: boolean;
426
+ }
427
+ interface CodeExample {
428
+ id: string;
429
+ title: string;
430
+ code: string;
431
+ language: string;
432
+ explanation: string;
433
+ difficulty: 'beginner' | 'intermediate' | 'advanced';
434
+ }
435
+ interface PerformanceMetrics {
436
+ timeComplexity: string;
437
+ spaceComplexity: string;
438
+ benchmarks?: BenchmarkResult[];
439
+ }
440
+ interface BenchmarkResult {
441
+ environment: string;
442
+ executionTime: number;
443
+ memoryUsage: number;
444
+ throughput?: number;
445
+ }
446
+ interface System2Memory {
447
+ reasoningSteps: ReasoningTrace[];
448
+ qualityEvaluation: QualityMetrics;
449
+ decisionContext: DecisionTree;
450
+ improvementSuggestions: Enhancement[];
451
+ reflectionData: ReflectionEntry[];
452
+ }
453
+ interface ReasoningTrace {
454
+ id: string;
455
+ timestamp: Date;
456
+ context: ReasoningContext;
457
+ steps: ReasoningStep[];
458
+ conclusion: string;
459
+ confidence: number;
460
+ alternatives: AlternativeReasoning[];
461
+ metadata: ReasoningMetadata;
462
+ }
463
+ interface ReasoningContext {
464
+ problem: string;
465
+ goals: string[];
466
+ constraints: string[];
467
+ assumptions: string[];
468
+ availableResources: string[];
469
+ }
470
+ interface ReasoningStep {
471
+ id: string;
472
+ type: 'analysis' | 'synthesis' | 'evaluation' | 'inference';
473
+ description: string;
474
+ input: string;
475
+ output: string;
476
+ confidence: number;
477
+ duration: number;
478
+ dependencies: string[];
479
+ }
480
+ interface AlternativeReasoning {
481
+ id: string;
482
+ description: string;
483
+ steps: ReasoningStep[];
484
+ pros: string[];
485
+ cons: string[];
486
+ confidence: number;
487
+ rejected: boolean;
488
+ rejectionReason?: string;
489
+ }
490
+ interface ReasoningMetadata {
491
+ complexity: 'simple' | 'moderate' | 'complex' | 'very_complex';
492
+ domain: string;
493
+ techniques: string[];
494
+ qualityScore: number;
495
+ reviewRequired: boolean;
496
+ }
497
+ interface QualityMetrics {
498
+ codeQuality: CodeQualityMetrics;
499
+ reasoningQuality: ReasoningQualityMetrics;
500
+ userSatisfaction: SatisfactionMetrics;
501
+ systemPerformance: PerformanceMetrics;
502
+ }
503
+ interface CodeQualityMetrics {
504
+ maintainability: number;
505
+ readability: number;
506
+ testability: number;
507
+ performance: number;
508
+ security: number;
509
+ bugDensity: number;
510
+ complexity: number;
511
+ }
512
+ interface ReasoningQualityMetrics {
513
+ coherence: number;
514
+ completeness: number;
515
+ accuracy: number;
516
+ efficiency: number;
517
+ creativity: number;
518
+ }
519
+ interface SatisfactionMetrics {
520
+ userRating: number;
521
+ taskCompletion: number;
522
+ timeToSolution: number;
523
+ iterationCount: number;
524
+ userFeedback: string[];
525
+ }
526
+ interface DecisionTree {
527
+ id: string;
528
+ rootNode: DecisionNode;
529
+ metadata: DecisionTreeMetadata;
530
+ }
531
+ interface DecisionNode {
532
+ id: string;
533
+ type: 'condition' | 'action' | 'outcome';
534
+ description: string;
535
+ children: DecisionNode[];
536
+ confidence: number;
537
+ evidence: Evidence[];
538
+ alternatives: DecisionNode[];
539
+ }
540
+ interface Evidence {
541
+ type: 'empirical' | 'theoretical' | 'heuristic' | 'user_feedback';
542
+ description: string;
543
+ strength: number;
544
+ source: string;
545
+ timestamp: Date;
546
+ }
547
+ interface DecisionTreeMetadata {
548
+ domain: string;
549
+ complexity: number;
550
+ accuracy: number;
551
+ lastUpdated: Date;
552
+ usageCount: number;
553
+ }
554
+ interface Enhancement {
555
+ id: string;
556
+ type: 'performance' | 'quality' | 'usability' | 'feature';
557
+ description: string;
558
+ impact: ImpactAssessment;
559
+ implementation: ImplementationPlan;
560
+ priority: number;
561
+ status: 'proposed' | 'approved' | 'in_progress' | 'completed' | 'rejected';
562
+ }
563
+ interface ImpactAssessment {
564
+ benefitScore: number;
565
+ effortScore: number;
566
+ riskScore: number;
567
+ affectedUsers: number;
568
+ affectedComponents: string[];
569
+ }
570
+ interface ImplementationPlan {
571
+ phases: ImplementationPhase[];
572
+ timeline: number;
573
+ resources: RequiredResource[];
574
+ dependencies: string[];
575
+ risks: Risk[];
576
+ }
577
+ interface ImplementationPhase {
578
+ id: string;
579
+ name: string;
580
+ description: string;
581
+ duration: number;
582
+ deliverables: string[];
583
+ dependencies: string[];
584
+ }
585
+ interface RequiredResource {
586
+ type: 'developer' | 'designer' | 'infrastructure' | 'tool';
587
+ quantity: number;
588
+ duration: number;
589
+ cost?: number;
590
+ }
591
+ interface Risk {
592
+ id: string;
593
+ description: string;
594
+ probability: number;
595
+ impact: number;
596
+ mitigation: string;
597
+ contingency: string;
598
+ }
599
+ interface ReflectionEntry {
600
+ id: string;
601
+ timestamp: Date;
602
+ trigger: string;
603
+ observation: string;
604
+ analysis: string;
605
+ insight: string;
606
+ actionItems: ActionItem[];
607
+ confidence: number;
608
+ }
609
+ interface ActionItem {
610
+ id: string;
611
+ description: string;
612
+ priority: number;
613
+ dueDate?: Date;
614
+ assignee?: string;
615
+ status: 'open' | 'in_progress' | 'completed' | 'cancelled';
616
+ }
617
+ interface UserPreferenceSet {
618
+ developmentStyle: DevelopmentStyle;
619
+ communicationPreferences: CommunicationPreferences;
620
+ toolPreferences: ToolPreferences;
621
+ learningStyle: LearningStyle;
622
+ qualityStandards: QualityStandards;
623
+ }
624
+ interface DevelopmentStyle {
625
+ approach: 'test-driven' | 'prototype-first' | 'documentation-heavy' | 'iterative';
626
+ preferredLanguages: LanguagePreference[];
627
+ architecturalPatterns: ArchitecturalPattern[];
628
+ problemSolvingStyle: 'systematic' | 'intuitive' | 'collaborative' | 'experimental';
629
+ workPace: 'fast' | 'moderate' | 'thorough';
630
+ }
631
+ interface LanguagePreference {
632
+ language: string;
633
+ proficiency: 'beginner' | 'intermediate' | 'advanced' | 'expert';
634
+ frequency: number;
635
+ preference: number;
636
+ }
637
+ interface ArchitecturalPattern {
638
+ name: string;
639
+ familiarity: number;
640
+ preference: number;
641
+ usageFrequency: number;
642
+ }
643
+ interface CommunicationPreferences {
644
+ verbosity: 'minimal' | 'moderate' | 'detailed' | 'comprehensive';
645
+ explanationDepth: 'surface' | 'intermediate' | 'deep';
646
+ codeCommentStyle: 'none' | 'inline' | 'docstring' | 'comprehensive';
647
+ feedbackStyle: 'direct' | 'constructive' | 'encouraging' | 'detailed';
648
+ }
649
+ interface ToolPreferences {
650
+ ide: string[];
651
+ frameworks: FrameworkPreference[];
652
+ libraries: LibraryPreference[];
653
+ buildTools: string[];
654
+ testingTools: string[];
655
+ }
656
+ interface FrameworkPreference {
657
+ name: string;
658
+ category: string;
659
+ proficiency: number;
660
+ preference: number;
661
+ }
662
+ interface LibraryPreference {
663
+ name: string;
664
+ category: string;
665
+ proficiency: number;
666
+ preference: number;
667
+ }
668
+ interface LearningStyle {
669
+ preferredMethods: LearningMethod[];
670
+ pace: 'slow' | 'moderate' | 'fast';
671
+ complexity: 'simple_to_complex' | 'complex_first' | 'example_driven';
672
+ feedback: 'immediate' | 'milestone' | 'completion';
673
+ }
674
+ interface LearningMethod {
675
+ type: 'visual' | 'auditory' | 'kinesthetic' | 'reading' | 'hands_on';
676
+ effectiveness: number;
677
+ preference: number;
678
+ }
679
+ interface QualityStandards {
680
+ codeQuality: QualityThreshold[];
681
+ testCoverage: number;
682
+ documentation: DocumentationStandard;
683
+ performance: PerformanceStandard;
684
+ security: SecurityStandard;
685
+ }
686
+ interface QualityThreshold {
687
+ metric: string;
688
+ threshold: number;
689
+ priority: 'low' | 'medium' | 'high' | 'critical';
690
+ }
691
+ interface DocumentationStandard {
692
+ required: boolean;
693
+ style: 'minimal' | 'standard' | 'comprehensive';
694
+ formats: string[];
695
+ }
696
+ interface PerformanceStandard {
697
+ responseTime: number;
698
+ throughput: number;
699
+ memoryUsage: number;
700
+ cpuUsage: number;
701
+ }
702
+ interface SecurityStandard {
703
+ requirements: SecurityRequirement[];
704
+ compliance: ComplianceStandard[];
705
+ scanningEnabled: boolean;
706
+ }
707
+ interface SecurityRequirement {
708
+ type: string;
709
+ description: string;
710
+ severity: 'low' | 'medium' | 'high' | 'critical';
711
+ mandatory: boolean;
712
+ }
713
+ interface ComplianceStandard {
714
+ name: string;
715
+ version: string;
716
+ requirements: string[];
717
+ }
718
+ interface SessionOutcome {
719
+ type: 'success' | 'partial_success' | 'failure' | 'cancelled';
720
+ description: string;
721
+ metrics: SessionMetrics;
722
+ feedback: UserFeedback[];
723
+ }
724
+ interface SessionMetrics {
725
+ duration: number;
726
+ commandsExecuted: number;
727
+ errorsEncountered: number;
728
+ linesOfCodeGenerated: number;
729
+ bugsFixed: number;
730
+ qualityImprovements: number;
731
+ }
732
+ interface UserFeedback {
733
+ type: 'rating' | 'comment' | 'suggestion' | 'complaint';
734
+ content: string;
735
+ timestamp: Date;
736
+ sentiment: 'positive' | 'neutral' | 'negative';
737
+ actionable: boolean;
738
+ }
739
+ interface System1Config {
740
+ maxKnowledgeNodes: number;
741
+ embeddingDimension: number;
742
+ cacheSize: number;
743
+ compressionThreshold: number;
744
+ accessDecayRate: number;
745
+ }
746
+ interface System2Config {
747
+ maxReasoningTraces: number;
748
+ qualityThreshold: number;
749
+ reflectionFrequency: number;
750
+ enhancementEvaluationInterval: number;
751
+ }
752
+ interface CoordinatorConfig {
753
+ syncInterval: number;
754
+ conflictResolutionStrategy: 'system1_priority' | 'system2_priority' | 'balanced';
755
+ learningRate: number;
756
+ adaptationThreshold: number;
757
+ }
758
+ interface PerformanceConfig {
759
+ lazyLoadingEnabled: boolean;
760
+ cacheStrategy: 'lru' | 'lfu' | 'adaptive';
761
+ batchSize: number;
762
+ timeout: number;
763
+ memoryLimit: number;
764
+ targetLatency?: number;
765
+ }
766
+
767
+ /**
768
+ * MARIA Memory System - System 1 Memory Implementation
769
+ *
770
+ * Fast, intuitive memory patterns for immediate responses
771
+ * Handles programming concepts, code patterns, and user preferences
772
+ */
773
+
774
+ declare class System1MemoryManager implements System1Memory {
775
+ private knowledgeNodes;
776
+ userPreferences: UserPreferenceSet;
777
+ private conceptGraph;
778
+ private interactionHistory;
779
+ private patternLibrary;
780
+ private config;
781
+ private cache;
782
+ private lastAccessTimes;
783
+ constructor(config: System1Config);
784
+ get programmingConcepts(): KnowledgeNode[];
785
+ get businessLogic(): ConceptGraph;
786
+ get pastInteractions(): InteractionHistory;
787
+ get codePatterns(): PatternLibrary;
788
+ addKnowledgeNode(type: KnowledgeNode['type'], name: string, content: string, embedding: number[], metadata?: Partial<NodeMetadata>): Promise<KnowledgeNode>;
789
+ getKnowledgeNode(id: string): Promise<KnowledgeNode | null>;
790
+ searchKnowledgeNodes(query: string, queryEmbedding: number[], limit?: number): Promise<KnowledgeNode[]>;
791
+ updateKnowledgeNode(id: string, updates: Partial<KnowledgeNode>): Promise<boolean>;
792
+ addConceptEdge(sourceId: string, targetId: string, type: ConceptEdge['type'], weight?: number, confidence?: number): Promise<ConceptEdge>;
793
+ getRelatedConcepts(nodeId: string, maxDepth?: number): Promise<KnowledgeNode[]>;
794
+ addCodePattern(pattern: Omit<CodePattern, 'id'>): Promise<CodePattern>;
795
+ findCodePatterns(language?: string, framework?: string, useCase?: string, limit?: number): Promise<CodePattern[]>;
796
+ addAntiPattern(antiPattern: Omit<AntiPattern, 'id'>): Promise<AntiPattern>;
797
+ detectAntiPatterns(code: string): Promise<AntiPattern[]>;
798
+ recordSession(session: SessionRecord): Promise<void>;
799
+ updateCommandHistory(command: string): Promise<void>;
800
+ getFrequentCommands(limit?: number): Promise<CommandHistory[]>;
801
+ getRecentCommands(limit?: number): Promise<CommandHistory[]>;
802
+ updateUserPreferences(updates: Partial<UserPreferenceSet>): Promise<void>;
803
+ getUserPreference<K extends keyof UserPreferenceSet>(key: K): Promise<UserPreferenceSet[K]>;
804
+ processMemoryEvent(event: MemoryEvent): Promise<void>;
805
+ cleanupLeastUsedNodes(): Promise<void>;
806
+ compressMemory(): Promise<void>;
807
+ private generateNodeId;
808
+ private generatePatternId;
809
+ private calculateCosineSimilarity;
810
+ private applyAccessDecay;
811
+ private calculateUsageScore;
812
+ private invalidateCache;
813
+ private detectUsagePatterns;
814
+ private processCodeGenerationEvent;
815
+ private processPatternRecognitionEvent;
816
+ private processLearningUpdateEvent;
817
+ private extractCodePatterns;
818
+ private adaptUserPreferences;
819
+ private mergeimilarPatterns;
820
+ private calculatePatternSimilarity;
821
+ private mergePatterns;
822
+ private initializeDefaultPreferences;
823
+ }
824
+
825
+ /**
826
+ * MARIA Memory System - System 2 Memory Implementation
827
+ *
828
+ * Deliberate reasoning and quality traces for complex decision making
829
+ * Handles reasoning steps, quality evaluation, and improvement suggestions
830
+ */
831
+
832
+ declare class System2MemoryManager implements System2Memory {
833
+ private reasoningTraces;
834
+ private qualityMetrics;
835
+ private decisionTrees;
836
+ private enhancements;
837
+ private reflectionEntries;
838
+ private config;
839
+ private analysisCache;
840
+ constructor(config: System2Config);
841
+ get reasoningSteps(): ReasoningTrace[];
842
+ get qualityEvaluation(): QualityMetrics;
843
+ get decisionContext(): DecisionTree;
844
+ get improvementSuggestions(): Enhancement[];
845
+ get reflectionData(): ReflectionEntry[];
846
+ startReasoningTrace(context: ReasoningContext, initialStep?: string): Promise<ReasoningTrace>;
847
+ addReasoningStep(traceId: string, stepData: Omit<ReasoningStep, 'id' | 'confidence' | 'duration' | 'dependencies'>): Promise<ReasoningStep>;
848
+ completeReasoningTrace(traceId: string, conclusion: string, confidence: number): Promise<ReasoningTrace>;
849
+ addAlternativeReasoning(traceId: string, alternative: Omit<AlternativeReasoning, 'id'>): Promise<AlternativeReasoning>;
850
+ getReasoningTrace(traceId: string): Promise<ReasoningTrace | null>;
851
+ searchReasoningTraces(query: {
852
+ domain?: string;
853
+ complexity?: string;
854
+ minQuality?: number;
855
+ timeframe?: {
856
+ start: Date;
857
+ end: Date;
858
+ };
859
+ }, limit?: number): Promise<ReasoningTrace[]>;
860
+ createDecisionTree(domain: string, initialCondition: string): Promise<DecisionTree>;
861
+ addDecisionNode(treeId: string, parentNodeId: string, node: Omit<DecisionNode, 'id'>): Promise<DecisionNode>;
862
+ addEvidence(treeId: string, nodeId: string, evidence: Evidence): Promise<void>;
863
+ queryDecisionTree(treeId: string, context: Record<string, unknown>): Promise<DecisionNode[]>;
864
+ proposeEnhancement(enhancement: Omit<Enhancement, 'id' | 'status'>): Promise<Enhancement>;
865
+ updateEnhancementStatus(enhancementId: string, status: Enhancement['status'], feedback?: string): Promise<boolean>;
866
+ getEnhancementsByType(type: Enhancement['type']): Promise<Enhancement[]>;
867
+ addReflectionEntry(trigger: string, observation: string, analysis: string, insight: string, confidence?: number): Promise<ReflectionEntry>;
868
+ addActionItem(reflectionId: string, actionItem: Omit<ActionItem, 'id' | 'status'>): Promise<ActionItem>;
869
+ getReflectionInsights(timeframe?: {
870
+ start: Date;
871
+ end: Date;
872
+ }, minConfidence?: number): Promise<ReflectionEntry[]>;
873
+ processMemoryEvent(event: MemoryEvent): Promise<void>;
874
+ assessCodeQuality(code: string, _language: string, context?: Record<string, unknown>): Promise<CodeQualityMetrics>;
875
+ updateQualityMetrics(metrics: Partial<QualityMetrics>): Promise<void>;
876
+ private generateTraceId;
877
+ private generateStepId;
878
+ private generateAlternativeId;
879
+ private generateDecisionTreeId;
880
+ private generateNodeId;
881
+ private generateEnhancementId;
882
+ private generateReflectionId;
883
+ private generateActionItemId;
884
+ private assessComplexity;
885
+ private identifyDomain;
886
+ private calculateStepConfidence;
887
+ private identifyDependencies;
888
+ private updateTraceQuality;
889
+ private calculateReasoningQuality;
890
+ private calculateCoherence;
891
+ private calculateCompleteness;
892
+ private calculateAccuracy;
893
+ private calculateEfficiency;
894
+ private calculateCreativity;
895
+ private generateImprovementSuggestions;
896
+ private updateGlobalQualityMetrics;
897
+ private createEmptyDecisionTree;
898
+ private findDecisionNode;
899
+ private calculateTreeComplexity;
900
+ private calculateNodeConfidence;
901
+ private traverseDecisionTree;
902
+ private evaluateCondition;
903
+ private shouldAutoApprove;
904
+ private evaluateEnhancementImpact;
905
+ private generateActionItems;
906
+ private processCodeGenerationEvent;
907
+ private processBugFixEvent;
908
+ private processQualityImprovementEvent;
909
+ private processGenericEvent;
910
+ private manageTraceLimit;
911
+ private calculateMaintainability;
912
+ private calculateReadability;
913
+ private calculateTestability;
914
+ private calculatePerformance;
915
+ private calculateSecurity;
916
+ private calculateBugDensity;
917
+ private calculateCyclomaticComplexity;
918
+ private calculateBasicComplexity;
919
+ private hashCode;
920
+ private initializeQualityMetrics;
921
+ }
922
+
923
+ /**
924
+ * MARIA Memory System - Dual Memory Engine
925
+ *
926
+ * Core integration logic for System 1 (fast, intuitive) and System 2 (deliberate, analytical) memory
927
+ * Orchestrates memory operations, layer selection, and cross-system optimization
928
+ */
929
+
930
+ interface DualMemoryEngineConfig {
931
+ system1: System1Config;
932
+ system2: System2Config;
933
+ coordinator: CoordinatorConfig;
934
+ performance: PerformanceConfig;
935
+ }
936
+ interface MemoryQuery {
937
+ type: 'knowledge' | 'pattern' | 'reasoning' | 'quality' | 'preference';
938
+ query: string;
939
+ context?: Record<string, unknown>;
940
+ urgency?: 'low' | 'medium' | 'high' | 'critical';
941
+ embedding?: number[];
942
+ limit?: number;
943
+ }
944
+ interface MemoryResponse<T = unknown> {
945
+ data: T;
946
+ source: 'system1' | 'system2' | 'both';
947
+ confidence: number;
948
+ latency: number;
949
+ cached: boolean;
950
+ suggestions?: Enhancement[];
951
+ }
952
+ interface MemoryOperationMetrics {
953
+ totalOperations: number;
954
+ system1Operations: number;
955
+ system2Operations: number;
956
+ averageLatency: number;
957
+ cacheHitRate: number;
958
+ errorRate: number;
959
+ lastReset: Date;
960
+ }
961
+ declare class DualMemoryEngine {
962
+ private system1;
963
+ private system2;
964
+ private config;
965
+ private operationMetrics;
966
+ private eventQueue;
967
+ private processingLock;
968
+ private performanceCache;
969
+ constructor(config: DualMemoryEngineConfig);
970
+ query<T = unknown>(memoryQuery: MemoryQuery): Promise<MemoryResponse<T>>;
971
+ store(event: MemoryEvent): Promise<void>;
972
+ learn(input: string, output: string, context: Record<string, unknown>, success: boolean): Promise<void>;
973
+ findKnowledge(query: string, embedding?: number[], limit?: number): Promise<MemoryResponse<KnowledgeNode[]>>;
974
+ findPatterns(language?: string, framework?: string, useCase?: string, limit?: number): Promise<MemoryResponse<CodePattern[]>>;
975
+ getReasoning(domain?: string, complexity?: string, minQuality?: number): Promise<MemoryResponse<ReasoningTrace[]>>;
976
+ getQualityInsights(): Promise<MemoryResponse<QualityMetrics>>;
977
+ getUserPreferences(): Promise<MemoryResponse<UserPreferenceSet>>;
978
+ recall(options: {
979
+ query: string;
980
+ type: string;
981
+ limit?: number;
982
+ }): Promise<unknown[]>;
983
+ clearMemory(): Promise<void>;
984
+ private selectMemoryStrategy;
985
+ private getUrgencyScore;
986
+ private assessQueryComplexity;
987
+ private getTypePreference;
988
+ private getCacheStatus;
989
+ private calculateSystem1Score;
990
+ private calculateSystem2Score;
991
+ private executeMemoryOperation;
992
+ private executeSystem1Operation;
993
+ private executeSystem2Operation;
994
+ private executeCombinedOperation;
995
+ private combineResults;
996
+ private generateCombinedSuggestions;
997
+ processEvent(event: MemoryEvent): Promise<void>;
998
+ private determineEventRouting;
999
+ private adaptFromEvent;
1000
+ private startBackgroundProcessing;
1001
+ private processEventQueue;
1002
+ private cleanupCache;
1003
+ private optimizeMemory;
1004
+ /**
1005
+ * Get System 1 memory manager instance
1006
+ * @returns System1MemoryManager instance
1007
+ */
1008
+ getSystem1(): System1MemoryManager;
1009
+ /**
1010
+ * Get System 2 memory manager instance
1011
+ * @returns System2MemoryManager instance
1012
+ */
1013
+ getSystem2(): System2MemoryManager;
1014
+ private generateCacheKey;
1015
+ private isCacheValid;
1016
+ private updateOperationMetrics;
1017
+ private initializeMetrics;
1018
+ getMetrics(): MemoryOperationMetrics;
1019
+ resetMetrics(): void;
1020
+ getCacheSize(): number;
1021
+ getQueueSize(): number;
1022
+ initialize(): Promise<void>;
1023
+ updateConfig(newConfig: Partial<DualMemoryEngineConfig>): void;
1024
+ getConfig(): DualMemoryEngineConfig;
1025
+ getStatistics(): Promise<{
1026
+ system1: {
1027
+ totalNodes: number;
1028
+ patterns: number;
1029
+ preferences: number;
1030
+ cacheHitRate: number;
1031
+ };
1032
+ system2: {
1033
+ reasoningTraces: number;
1034
+ decisionTrees: number;
1035
+ activeSessions: number;
1036
+ memoryUsage: number;
1037
+ };
1038
+ }>;
1039
+ }
1040
+
1041
+ /**
1042
+ * MARIA Memory System - Memory Coordinator
1043
+ *
1044
+ * Cross-layer coordination and optimization between System 1 and System 2 memory
1045
+ * Manages synchronization, performance optimization, and adaptive learning
1046
+ */
1047
+
1048
+ interface CoordinationMetrics {
1049
+ syncOperations: number;
1050
+ optimizationRuns: number;
1051
+ adaptationEvents: number;
1052
+ crossLayerTransfers: number;
1053
+ performanceImprovements: number;
1054
+ lastOptimization: Date;
1055
+ averageSyncTime: number;
1056
+ systemHealth: 'excellent' | 'good' | 'fair' | 'poor';
1057
+ }
1058
+ interface OptimizationRecommendation {
1059
+ id: string;
1060
+ type: 'performance' | 'memory' | 'learning' | 'synchronization';
1061
+ priority: number;
1062
+ description: string;
1063
+ impact: {
1064
+ performance: number;
1065
+ memory: number;
1066
+ latency: number;
1067
+ };
1068
+ implementation: {
1069
+ effort: 'low' | 'medium' | 'high';
1070
+ risk: 'low' | 'medium' | 'high';
1071
+ timeline: number;
1072
+ };
1073
+ automated: boolean;
1074
+ }
1075
+ interface SynchronizationReport {
1076
+ system1State: {
1077
+ knowledgeNodes: number;
1078
+ patterns: number;
1079
+ interactions: number;
1080
+ cacheHitRate: number;
1081
+ };
1082
+ system2State: {
1083
+ reasoningTraces: number;
1084
+ qualityMetrics: QualityMetrics;
1085
+ enhancements: number;
1086
+ reflections: number;
1087
+ };
1088
+ synchronizationPoints: SyncPoint[];
1089
+ conflictResolutions: ConflictResolution[];
1090
+ recommendations: OptimizationRecommendation[];
1091
+ }
1092
+ interface SyncPoint {
1093
+ id: string;
1094
+ timestamp: Date;
1095
+ type: 'knowledge_transfer' | 'pattern_learning' | 'quality_feedback' | 'user_adaptation';
1096
+ source: 'system1' | 'system2';
1097
+ target: 'system1' | 'system2';
1098
+ data: unknown;
1099
+ success: boolean;
1100
+ latency: number;
1101
+ }
1102
+ interface ConflictResolution {
1103
+ id: string;
1104
+ timestamp: Date;
1105
+ conflictType: 'data_inconsistency' | 'preference_mismatch' | 'quality_threshold' | 'performance_tradeoff';
1106
+ description: string;
1107
+ resolution: string;
1108
+ confidence: number;
1109
+ impact: 'low' | 'medium' | 'high';
1110
+ }
1111
+ declare class MemoryCoordinator {
1112
+ private system1;
1113
+ private system2;
1114
+ private dualEngine;
1115
+ private config;
1116
+ private metrics;
1117
+ private syncPoints;
1118
+ private conflicts;
1119
+ private recommendations;
1120
+ private optimizationTimer?;
1121
+ private syncTimer?;
1122
+ constructor(dualEngine: DualMemoryEngine, config?: CoordinatorConfig);
1123
+ synchronizeSystems(): Promise<SynchronizationReport>;
1124
+ optimizePerformance(): Promise<OptimizationRecommendation[]>;
1125
+ adaptToUserBehavior(event: MemoryEvent): Promise<void>;
1126
+ resolveConflicts(): Promise<ConflictResolution[]>;
1127
+ private performCrossLayerSync;
1128
+ private syncKnowledgeToReasoning;
1129
+ private syncQualityToPatterns;
1130
+ private syncUserPreferences;
1131
+ private syncLearningData;
1132
+ private analyzePerformance;
1133
+ private generateOptimizationRecommendations;
1134
+ private applyAutomatedOptimizations;
1135
+ private applyOptimization;
1136
+ private detectConflicts;
1137
+ private resolveConflict;
1138
+ private analyzeBehaviorPattern;
1139
+ private determineAdaptation;
1140
+ private performCrossLayerAdaptation;
1141
+ private getSystem1State;
1142
+ private getSystem2State;
1143
+ private getRecentSyncPoints;
1144
+ private getRecentConflicts;
1145
+ private recordSyncPoint;
1146
+ private getDefaultConfig;
1147
+ private startCoordination;
1148
+ private initializeMetrics;
1149
+ private transferKnowledgeToReasoning;
1150
+ private updatePatternsForMaintainability;
1151
+ private updatePatternsForSecurity;
1152
+ private adaptReasoningForTDD;
1153
+ private adaptReasoningForSystematicApproach;
1154
+ private integratePatternLearning;
1155
+ private identifyBottlenecks;
1156
+ private identifyOptimizationOpportunities;
1157
+ private optimizePerformanceSettings;
1158
+ private optimizeMemoryUsage;
1159
+ private optimizeLearningSettings;
1160
+ private optimizeSynchronizationSettings;
1161
+ private adjustQualityThresholds;
1162
+ private optimizeSystem2Performance;
1163
+ private adaptSystem1ForCodeGeneration;
1164
+ private adaptSystem2ForQuality;
1165
+ private updateAdaptiveLearning;
1166
+ getMetrics(): CoordinationMetrics;
1167
+ getRecommendations(): OptimizationRecommendation[];
1168
+ forceOptimization(): Promise<OptimizationRecommendation[]>;
1169
+ forceSynchronization(): Promise<SynchronizationReport>;
1170
+ updateConfig(newConfig: Partial<CoordinatorConfig>): void;
1171
+ destroy(): void;
1172
+ }
1173
+
1174
+ /**
1175
+ * Internal Mode System - Type Definitions
1176
+ *
1177
+ * Comprehensive type system for MARIA CODE's internal mode functionality.
1178
+ * Integrates with existing Intelligent Router Service for real-time mode switching.
1179
+ */
1180
+ type ModeCategory = 'reasoning' | 'creative' | 'analytical' | 'structural' | 'validation' | 'contemplative' | 'intensive' | 'learning' | 'collaborative';
1181
+ type ModeIntensity = 'light' | 'normal' | 'deep' | 'ultra';
1182
+ type ModeTriggerType = 'intent' | 'context' | 'situation' | 'pattern' | 'manual';
1183
+ interface ModeDefinition {
1184
+ id: string;
1185
+ name: string;
1186
+ symbol: string;
1187
+ category: ModeCategory;
1188
+ intensity: ModeIntensity;
1189
+ description: string;
1190
+ purpose: string;
1191
+ useCases: string[];
1192
+ triggers: ModeTrigger[];
1193
+ display: ModeDisplay;
1194
+ i18n: Record<string, ModeI18n>;
1195
+ metadata: ModeMetadata;
1196
+ }
1197
+ interface ModeTrigger {
1198
+ type: ModeTriggerType;
1199
+ conditions: TriggerCondition[];
1200
+ weight: number;
1201
+ confidence: number;
1202
+ }
1203
+ interface TriggerCondition {
1204
+ field: string;
1205
+ operator: 'contains' | 'equals' | 'matches' | 'startsWith' | 'endsWith';
1206
+ value: string | string[] | RegExp;
1207
+ weight: number;
1208
+ }
1209
+ interface ModeDisplay {
1210
+ color: string;
1211
+ animation: boolean;
1212
+ duration: number;
1213
+ prefix: string;
1214
+ suffix: string;
1215
+ }
1216
+ interface ModeI18n {
1217
+ name: string;
1218
+ description: string;
1219
+ purpose: string;
1220
+ useCases: string[];
1221
+ }
1222
+ interface ModeMetadata {
1223
+ version: string;
1224
+ author: string;
1225
+ created: Date;
1226
+ updated: Date;
1227
+ tags: string[];
1228
+ experimental: boolean;
1229
+ deprecated: boolean;
1230
+ }
1231
+ interface ModeRecognitionResult {
1232
+ mode: ModeDefinition;
1233
+ confidence: number;
1234
+ reasoning: string;
1235
+ alternatives: Array<{
1236
+ mode: ModeDefinition;
1237
+ confidence: number;
1238
+ }>;
1239
+ triggers: Array<{
1240
+ type: ModeTriggerType;
1241
+ score: number;
1242
+ details: string;
1243
+ }>;
1244
+ }
1245
+ interface ModeContext {
1246
+ currentMode?: ModeDefinition;
1247
+ previousModes: ModeHistoryEntry[];
1248
+ userInput: string;
1249
+ language: string;
1250
+ commandHistory: string[];
1251
+ projectContext?: ProjectContext;
1252
+ errorState?: ErrorContext;
1253
+ userPatterns: UserPattern[];
1254
+ timestamp: Date;
1255
+ }
1256
+ interface ModeHistoryEntry {
1257
+ mode: ModeDefinition;
1258
+ startTime: Date;
1259
+ endTime?: Date;
1260
+ duration?: number;
1261
+ trigger: ModeTriggerType;
1262
+ userFeedback?: 'positive' | 'negative' | 'neutral';
1263
+ }
1264
+ interface ProjectContext {
1265
+ type: 'code' | 'documentation' | 'configuration' | 'media' | 'other';
1266
+ files: string[];
1267
+ languages: string[];
1268
+ frameworks: string[];
1269
+ hasErrors: boolean;
1270
+ hasTests: boolean;
1271
+ }
1272
+ interface ErrorContext {
1273
+ type: 'syntax' | 'runtime' | 'build' | 'lint' | 'test' | 'network';
1274
+ message: string;
1275
+ location?: string;
1276
+ severity: 'low' | 'medium' | 'high' | 'critical';
1277
+ }
1278
+ interface UserPattern {
1279
+ sequence: string[];
1280
+ frequency: number;
1281
+ lastUsed: Date;
1282
+ success: number;
1283
+ }
1284
+ interface ModeConfig {
1285
+ confidenceThreshold: number;
1286
+ autoSwitchEnabled: boolean;
1287
+ confirmationRequired: boolean;
1288
+ showTransitions: boolean;
1289
+ animationEnabled: boolean;
1290
+ colorEnabled: boolean;
1291
+ learningEnabled: boolean;
1292
+ patternTrackingEnabled: boolean;
1293
+ feedbackEnabled: boolean;
1294
+ defaultLanguage: string;
1295
+ supportedLanguages: string[];
1296
+ maxHistoryEntries: number;
1297
+ maxPatterns: number;
1298
+ recognitionTimeout: number;
1299
+ }
1300
+
1301
+ /**
1302
+ * Internal Mode Service - Main Orchestrator
1303
+ *
1304
+ * Central service for managing MARIA CODE's internal mode system.
1305
+ * Integrates with Intelligent Router for real-time mode recognition and switching.
1306
+ */
1307
+
1308
+ declare class InternalModeService extends EventEmitter {
1309
+ private modeRegistry;
1310
+ private recognitionEngine;
1311
+ private displayManager;
1312
+ private historyTracker;
1313
+ private currentMode;
1314
+ private config;
1315
+ private initialized;
1316
+ private recognitionInProgress;
1317
+ constructor(config?: Partial<ModeConfig>);
1318
+ initialize(): Promise<void>;
1319
+ /**
1320
+ * Recognize and potentially switch mode based on user input
1321
+ */
1322
+ recognizeMode(userInput: string, context?: Partial<ModeContext>): Promise<ModeRecognitionResult | null>;
1323
+ /**
1324
+ * Manually set a specific mode
1325
+ */
1326
+ setMode(mode: ModeDefinition | string, trigger?: 'manual' | 'intent' | 'context', isInitial?: boolean): Promise<boolean>;
1327
+ /**
1328
+ * Get current mode
1329
+ */
1330
+ getCurrentMode(): ModeDefinition | null;
1331
+ /**
1332
+ * Get all available modes
1333
+ */
1334
+ getAllModes(): ModeDefinition[];
1335
+ /**
1336
+ * Search modes by query
1337
+ */
1338
+ searchModes(query: string, language?: string): ModeDefinition[];
1339
+ /**
1340
+ * Get mode by ID
1341
+ */
1342
+ getModeById(id: string): ModeDefinition | undefined;
1343
+ /**
1344
+ * Get mode history
1345
+ */
1346
+ getModeHistory(): ModeHistoryEntry[];
1347
+ /**
1348
+ * Update configuration
1349
+ */
1350
+ updateConfig(newConfig: Partial<ModeConfig>): void;
1351
+ /**
1352
+ * Get current configuration
1353
+ */
1354
+ getConfig(): ModeConfig;
1355
+ /**
1356
+ * Provide feedback on mode accuracy
1357
+ */
1358
+ provideFeedback(modeId: string, wasCorrect: boolean, userInput?: string): Promise<void>;
1359
+ /**
1360
+ * Get mode statistics
1361
+ */
1362
+ getStatistics(): {
1363
+ totalModes: number;
1364
+ currentMode: string | null;
1365
+ modeChanges: number;
1366
+ averageConfidence: number;
1367
+ mostUsedModes: Array<{
1368
+ mode: string;
1369
+ count: number;
1370
+ }>;
1371
+ };
1372
+ /**
1373
+ * Export mode data for backup/transfer
1374
+ */
1375
+ exportData(): Promise<{
1376
+ config: ModeConfig;
1377
+ history: ModeHistoryEntry[];
1378
+ patterns: unknown[];
1379
+ }>;
1380
+ /**
1381
+ * Import mode data from backup
1382
+ */
1383
+ importData(data: {
1384
+ config?: Partial<ModeConfig>;
1385
+ history?: ModeHistoryEntry[];
1386
+ patterns?: unknown[];
1387
+ }): Promise<void>;
1388
+ /**
1389
+ * Reset to default state
1390
+ */
1391
+ reset(): Promise<void>;
1392
+ /**
1393
+ * Dispose and cleanup
1394
+ */
1395
+ dispose(): void;
1396
+ private switchToMode;
1397
+ private setupEventListeners;
1398
+ }
1399
+ declare function getInternalModeService(config?: Partial<ModeConfig>): InternalModeService;
1400
+
1401
+ /**
1402
+ * MARIA - Intelligent CLI Assistant
1403
+ * Entry point for the library
1404
+ */
1405
+
1406
+ declare const VERSION = "1.1.0";
1407
+
1408
+ export { BaseCommand, type CommandArgs, type CommandContext, type CommandResult, DualMemoryEngine, type IMiddleware, type ISlashCommand, InternalModeService, MemoryCoordinator, type MemoryEvent, type MemoryResponse, type ModeConfig, type ModeContext, type ModeDefinition, type ModeRecognitionResult, type QualityMetrics, type ReasoningTrace, System1MemoryManager as System1Memory, System2MemoryManager as System2Memory, type UserPreferenceSet, VERSION, commandRegistry, getCommandSuggestions, getCommandsByCategory, getInternalModeService, initializeSlashCommands };