@bonginkan/maria 2.0.5 → 2.0.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.
package/dist/index.d.ts CHANGED
@@ -2,6 +2,312 @@ export { createCLI } from './cli.js';
2
2
  import { EventEmitter } from 'events';
3
3
  import 'commander';
4
4
 
5
+ interface ConversationMessage {
6
+ id: string;
7
+ role: 'user' | 'assistant' | 'system';
8
+ content: string;
9
+ timestamp: Date;
10
+ model?: string;
11
+ tokensUsed?: number;
12
+ metadata?: Record<string, unknown>;
13
+ }
14
+ interface ConversationContext {
15
+ id: string;
16
+ messages: ConversationMessage[];
17
+ sessionId: string;
18
+ userId?: string;
19
+ startTime: Date;
20
+ lastActivity: Date;
21
+ config: ConversationConfig;
22
+ preferences?: UserPreferences;
23
+ history?: ConversationHistory[];
24
+ currentTask?: string;
25
+ hasErrors?: boolean;
26
+ isUrgent?: boolean;
27
+ isInteractive?: boolean;
28
+ metadata?: Record<string, unknown>;
29
+ }
30
+ interface ConversationHistory {
31
+ timestamp: Date;
32
+ action: string;
33
+ data?: Record<string, unknown>;
34
+ }
35
+ interface UserPreferences {
36
+ mode?: 'chat' | 'research' | 'command' | 'creative';
37
+ defaultModel?: string;
38
+ temperature?: number;
39
+ maxTokens?: number;
40
+ autoSave?: boolean;
41
+ language?: string;
42
+ theme?: 'light' | 'dark' | 'auto';
43
+ verbosity?: 'normal' | 'verbose' | 'quiet';
44
+ autoMode?: boolean;
45
+ }
46
+ interface ConversationConfig {
47
+ model: string;
48
+ maxTokens?: number;
49
+ temperature?: number;
50
+ stream?: boolean;
51
+ systemPrompt?: string;
52
+ tools?: string[];
53
+ safetySettings?: SafetySettings;
54
+ }
55
+ interface SafetySettings {
56
+ enableContentFilter: boolean;
57
+ restrictedTopics: string[];
58
+ maxPromptLength: number;
59
+ allowFileAccess: boolean;
60
+ allowNetworkAccess: boolean;
61
+ }
62
+
63
+ /**
64
+ * Slash Command Type Definitions
65
+ * Core types for the microservice-based command architecture
66
+ */
67
+
68
+ type CommandCategory = 'auth' | 'config' | 'project' | 'development' | 'media' | 'conversation' | 'advanced' | 'system';
69
+ interface CommandArgs {
70
+ raw: string[];
71
+ parsed: Record<string, unknown>;
72
+ flags: Record<string, boolean>;
73
+ options: Record<string, string>;
74
+ }
75
+ interface CommandContext {
76
+ conversation: ConversationContext;
77
+ user?: {
78
+ id: string;
79
+ email?: string;
80
+ role?: string;
81
+ };
82
+ session: {
83
+ id: string;
84
+ startTime: Date;
85
+ commandHistory: string[];
86
+ };
87
+ environment: {
88
+ cwd: string;
89
+ platform: string;
90
+ nodeVersion: string;
91
+ };
92
+ }
93
+ interface CommandResult {
94
+ success: boolean;
95
+ message: string;
96
+ data?: unknown;
97
+ component?: ComponentType;
98
+ requiresInput?: boolean;
99
+ metadata?: {
100
+ executionTime: number;
101
+ memoryUsed?: number;
102
+ commandVersion?: string;
103
+ };
104
+ }
105
+ 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';
106
+ interface ValidationResult {
107
+ success: boolean;
108
+ error?: string;
109
+ suggestions?: string[];
110
+ }
111
+ interface CommandMetadata {
112
+ version: string;
113
+ author: string;
114
+ deprecated?: boolean;
115
+ experimental?: boolean;
116
+ since?: string;
117
+ replacedBy?: string;
118
+ }
119
+ interface CommandPermission {
120
+ role?: string;
121
+ scope?: string[];
122
+ requiresAuth?: boolean;
123
+ requiresPremium?: boolean;
124
+ }
125
+ interface CommandExample {
126
+ input: string;
127
+ description: string;
128
+ output?: string;
129
+ }
130
+ interface ISlashCommand {
131
+ name: string;
132
+ aliases?: string[];
133
+ category: CommandCategory;
134
+ description: string;
135
+ usage: string;
136
+ examples: CommandExample[];
137
+ permissions?: CommandPermission;
138
+ middleware?: string[];
139
+ rateLimit?: {
140
+ requests: number;
141
+ window: string;
142
+ };
143
+ initialize?(): Promise<void>;
144
+ validate?(args: CommandArgs): Promise<ValidationResult>;
145
+ execute(args: CommandArgs, context: CommandContext): Promise<CommandResult>;
146
+ cleanup?(): Promise<void>;
147
+ rollback?(context: CommandContext, error: Error): Promise<void>;
148
+ metadata: CommandMetadata;
149
+ }
150
+ type MiddlewareNext = () => Promise<CommandResult>;
151
+ interface IMiddleware {
152
+ name: string;
153
+ priority?: number;
154
+ execute(command: ISlashCommand, args: CommandArgs, context: CommandContext, next: MiddlewareNext): Promise<CommandResult>;
155
+ }
156
+
157
+ /**
158
+ * Base Command Class
159
+ * Abstract base class for all slash commands
160
+ */
161
+
162
+ declare abstract class BaseCommand implements ISlashCommand {
163
+ abstract name: string;
164
+ abstract category: CommandCategory;
165
+ abstract description: string;
166
+ aliases?: string[];
167
+ usage: string;
168
+ examples: CommandExample[];
169
+ permissions?: CommandPermission;
170
+ middleware?: string[];
171
+ rateLimit?: {
172
+ requests: number;
173
+ window: string;
174
+ };
175
+ metadata: CommandMetadata;
176
+ private cache;
177
+ /**
178
+ * Initialize the command (called once when registered)
179
+ */
180
+ initialize(): Promise<void>;
181
+ /**
182
+ * Validate command arguments
183
+ */
184
+ validate(args: CommandArgs): Promise<ValidationResult>;
185
+ /**
186
+ * Execute the command - must be implemented by subclasses
187
+ */
188
+ abstract execute(args: CommandArgs, context: CommandContext): Promise<CommandResult>;
189
+ /**
190
+ * Cleanup resources (called when command is unregistered)
191
+ */
192
+ cleanup(): Promise<void>;
193
+ /**
194
+ * Rollback on error - override for custom rollback logic
195
+ */
196
+ rollback(_context: CommandContext, error: Error): Promise<void>;
197
+ /**
198
+ * Parse command arguments into structured format
199
+ */
200
+ protected parseArgs(raw: string[]): CommandArgs;
201
+ /**
202
+ * Create a success response
203
+ */
204
+ protected success(message: string, data?: unknown, metadata?: Partial<CommandResult['metadata']>): CommandResult;
205
+ /**
206
+ * Create an error response
207
+ */
208
+ protected error(message: string, code?: string, details?: unknown): CommandResult;
209
+ /**
210
+ * Cache data with TTL
211
+ */
212
+ protected setCache(key: string, data: unknown, ttlSeconds?: number): void;
213
+ /**
214
+ * Get cached data
215
+ */
216
+ protected getCache<T = unknown>(key: string): T | null;
217
+ /**
218
+ * Check if user has required permissions
219
+ */
220
+ protected checkPermissions(context: CommandContext): Promise<ValidationResult>;
221
+ /**
222
+ * Format help text for this command
223
+ */
224
+ formatHelp(): string;
225
+ /**
226
+ * Log command execution
227
+ */
228
+ protected logExecution(args: CommandArgs, context: CommandContext, result: CommandResult): void;
229
+ }
230
+
231
+ /**
232
+ * Command Registry System
233
+ * Central registry for all slash commands with auto-discovery
234
+ */
235
+
236
+ declare class CommandRegistry {
237
+ private commands;
238
+ private aliases;
239
+ private middlewares;
240
+ private rateLimits;
241
+ private _initialized;
242
+ private get initialized();
243
+ private set initialized(value);
244
+ constructor();
245
+ /**
246
+ * Register a command
247
+ */
248
+ register(command: ISlashCommand): void;
249
+ /**
250
+ * Unregister a command
251
+ */
252
+ unregister(name: string): boolean;
253
+ /**
254
+ * Get a command by name or alias
255
+ */
256
+ get(nameOrAlias: string): ISlashCommand | undefined;
257
+ /**
258
+ * Check if a command exists
259
+ */
260
+ has(nameOrAlias: string): boolean;
261
+ /**
262
+ * Get all registered commands
263
+ */
264
+ getAll(): ISlashCommand[];
265
+ /**
266
+ * Get commands by category
267
+ */
268
+ getByCategory(category: string): ISlashCommand[];
269
+ /**
270
+ * Execute a command
271
+ */
272
+ execute(commandName: string, args: string[], context: CommandContext): Promise<CommandResult>;
273
+ /**
274
+ * Auto-register commands from directory
275
+ */
276
+ autoRegister(directory: string): Promise<void>;
277
+ /**
278
+ * Register a middleware
279
+ */
280
+ registerMiddleware(middleware: IMiddleware): void;
281
+ private setupDefaultMiddlewares;
282
+ private parseArguments;
283
+ private checkPermissions;
284
+ private checkRateLimit;
285
+ private parseWindow;
286
+ private runMiddlewareChain;
287
+ private getSuggestions;
288
+ private isValidCommand;
289
+ private logExecution;
290
+ }
291
+ declare const commandRegistry: CommandRegistry;
292
+
293
+ /**
294
+ * Slash Commands Module
295
+ * Export all command system components
296
+ */
297
+
298
+ /**
299
+ * Initialize the slash command system
300
+ */
301
+ declare function initializeSlashCommands(): Promise<void>;
302
+ /**
303
+ * Get command suggestions for auto-complete with fuzzy matching
304
+ */
305
+ declare function getCommandSuggestions(input: string): string[];
306
+ /**
307
+ * Get all commands grouped by category
308
+ */
309
+ declare function getCommandsByCategory(): Record<string, ISlashCommand[]>;
310
+
5
311
  /**
6
312
  * MARIA Memory System - Core Type Definitions
7
313
  *
@@ -1148,4 +1454,4 @@ declare function getInternalModeService(config?: Partial<ModeConfig>): InternalM
1148
1454
 
1149
1455
  declare const VERSION = "1.1.0";
1150
1456
 
1151
- export { DualMemoryEngine, 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, getInternalModeService };
1457
+ 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 };