@sylphx/flow 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/assets/agents/coder.md +72 -119
  3. package/assets/agents/orchestrator.md +26 -90
  4. package/assets/agents/reviewer.md +76 -47
  5. package/assets/agents/writer.md +82 -63
  6. package/assets/output-styles/silent.md +141 -8
  7. package/assets/rules/code-standards.md +9 -33
  8. package/assets/rules/core.md +67 -59
  9. package/package.json +2 -12
  10. package/src/commands/flow/execute.ts +470 -0
  11. package/src/commands/flow/index.ts +11 -0
  12. package/src/commands/flow/prompt.ts +35 -0
  13. package/src/commands/flow/setup.ts +312 -0
  14. package/src/commands/flow/targets.ts +18 -0
  15. package/src/commands/flow/types.ts +47 -0
  16. package/src/commands/flow-command.ts +18 -967
  17. package/src/commands/flow-orchestrator.ts +14 -5
  18. package/src/commands/hook-command.ts +1 -1
  19. package/src/commands/init-core.ts +12 -3
  20. package/src/commands/run-command.ts +1 -1
  21. package/src/config/rules.ts +1 -1
  22. package/src/core/error-handling.ts +1 -1
  23. package/src/core/loop-controller.ts +1 -1
  24. package/src/core/state-detector.ts +1 -1
  25. package/src/core/target-manager.ts +1 -1
  26. package/src/index.ts +1 -1
  27. package/src/shared/files/index.ts +1 -1
  28. package/src/shared/processing/index.ts +1 -1
  29. package/src/targets/claude-code.ts +3 -3
  30. package/src/targets/opencode.ts +3 -3
  31. package/src/utils/agent-enhancer.ts +2 -2
  32. package/src/utils/{mcp-config.ts → config/mcp-config.ts} +4 -4
  33. package/src/utils/{paths.ts → config/paths.ts} +1 -1
  34. package/src/utils/{settings.ts → config/settings.ts} +1 -1
  35. package/src/utils/{target-config.ts → config/target-config.ts} +5 -5
  36. package/src/utils/{target-utils.ts → config/target-utils.ts} +3 -3
  37. package/src/utils/display/banner.ts +25 -0
  38. package/src/utils/display/status.ts +55 -0
  39. package/src/utils/{file-operations.ts → files/file-operations.ts} +2 -2
  40. package/src/utils/files/jsonc.ts +36 -0
  41. package/src/utils/{sync-utils.ts → files/sync-utils.ts} +3 -3
  42. package/src/utils/index.ts +42 -61
  43. package/src/utils/version.ts +47 -0
  44. package/src/components/benchmark-monitor.tsx +0 -331
  45. package/src/components/reindex-progress.tsx +0 -261
  46. package/src/composables/functional/index.ts +0 -14
  47. package/src/composables/functional/useEnvironment.ts +0 -171
  48. package/src/composables/functional/useFileSystem.ts +0 -139
  49. package/src/composables/index.ts +0 -4
  50. package/src/composables/useEnv.ts +0 -13
  51. package/src/composables/useRuntimeConfig.ts +0 -27
  52. package/src/core/ai-sdk.ts +0 -603
  53. package/src/core/app-factory.ts +0 -381
  54. package/src/core/builtin-agents.ts +0 -9
  55. package/src/core/command-system.ts +0 -550
  56. package/src/core/config-system.ts +0 -550
  57. package/src/core/connection-pool.ts +0 -390
  58. package/src/core/di-container.ts +0 -155
  59. package/src/core/headless-display.ts +0 -96
  60. package/src/core/interfaces/index.ts +0 -22
  61. package/src/core/interfaces/repository.interface.ts +0 -91
  62. package/src/core/interfaces/service.interface.ts +0 -133
  63. package/src/core/interfaces.ts +0 -96
  64. package/src/core/result.ts +0 -351
  65. package/src/core/service-config.ts +0 -252
  66. package/src/core/session-service.ts +0 -121
  67. package/src/core/storage-factory.ts +0 -115
  68. package/src/core/stream-handler.ts +0 -288
  69. package/src/core/type-utils.ts +0 -427
  70. package/src/core/unified-storage.ts +0 -456
  71. package/src/core/validation/limit.ts +0 -46
  72. package/src/core/validation/query.ts +0 -20
  73. package/src/db/auto-migrate.ts +0 -322
  74. package/src/db/base-database-client.ts +0 -144
  75. package/src/db/cache-db.ts +0 -218
  76. package/src/db/cache-schema.ts +0 -75
  77. package/src/db/database.ts +0 -70
  78. package/src/db/index.ts +0 -252
  79. package/src/db/memory-db.ts +0 -153
  80. package/src/db/memory-schema.ts +0 -29
  81. package/src/db/schema.ts +0 -289
  82. package/src/db/session-repository.ts +0 -733
  83. package/src/domains/index.ts +0 -6
  84. package/src/domains/utilities/index.ts +0 -6
  85. package/src/domains/utilities/time/index.ts +0 -5
  86. package/src/domains/utilities/time/tools.ts +0 -291
  87. package/src/services/agent-service.ts +0 -273
  88. package/src/services/evaluation-service.ts +0 -271
  89. package/src/services/functional/evaluation-logic.ts +0 -296
  90. package/src/services/functional/file-processor.ts +0 -273
  91. package/src/services/functional/index.ts +0 -12
  92. package/src/services/memory.service.ts +0 -476
  93. package/src/types/api/batch.ts +0 -108
  94. package/src/types/api/errors.ts +0 -118
  95. package/src/types/api/index.ts +0 -55
  96. package/src/types/api/requests.ts +0 -76
  97. package/src/types/api/responses.ts +0 -180
  98. package/src/types/api/websockets.ts +0 -85
  99. package/src/types/benchmark.ts +0 -49
  100. package/src/types/database.types.ts +0 -510
  101. package/src/types/memory-types.ts +0 -63
  102. package/src/utils/advanced-tokenizer.ts +0 -191
  103. package/src/utils/ai-model-fetcher.ts +0 -19
  104. package/src/utils/async-file-operations.ts +0 -516
  105. package/src/utils/audio-player.ts +0 -345
  106. package/src/utils/codebase-helpers.ts +0 -211
  107. package/src/utils/console-ui.ts +0 -79
  108. package/src/utils/database-errors.ts +0 -140
  109. package/src/utils/debug-logger.ts +0 -49
  110. package/src/utils/file-scanner.ts +0 -259
  111. package/src/utils/help.ts +0 -20
  112. package/src/utils/immutable-cache.ts +0 -106
  113. package/src/utils/jsonc.ts +0 -158
  114. package/src/utils/memory-tui.ts +0 -414
  115. package/src/utils/models-dev.ts +0 -91
  116. package/src/utils/parallel-operations.ts +0 -487
  117. package/src/utils/process-manager.ts +0 -155
  118. package/src/utils/prompts.ts +0 -120
  119. package/src/utils/search-tool-builder.ts +0 -214
  120. package/src/utils/session-manager.ts +0 -168
  121. package/src/utils/session-title.ts +0 -87
  122. package/src/utils/simplified-errors.ts +0 -410
  123. package/src/utils/template-engine.ts +0 -94
  124. package/src/utils/test-audio.ts +0 -71
  125. package/src/utils/todo-context.ts +0 -46
  126. package/src/utils/token-counter.ts +0 -288
  127. /package/src/utils/{cli-output.ts → display/cli-output.ts} +0 -0
  128. /package/src/utils/{logger.ts → display/logger.ts} +0 -0
  129. /package/src/utils/{notifications.ts → display/notifications.ts} +0 -0
  130. /package/src/utils/{secret-utils.ts → security/secret-utils.ts} +0 -0
  131. /package/src/utils/{security.ts → security/security.ts} +0 -0
@@ -1,410 +0,0 @@
1
- /**
2
- * Simplified Error Handling System
3
- * Reduces complexity from 11+ error types to 3 core types
4
- */
5
-
6
- import { logger } from './logger.js';
7
-
8
- /**
9
- * Error severity levels
10
- */
11
- export enum ErrorSeverity {
12
- LOW = 'LOW',
13
- MEDIUM = 'MEDIUM',
14
- HIGH = 'HIGH',
15
- CRITICAL = 'CRITICAL',
16
- }
17
-
18
- /**
19
- * Error categories for classification
20
- */
21
- export enum ErrorCategory {
22
- VALIDATION = 'VALIDATION',
23
- CONFIGURATION = 'CONFIGURATION',
24
- DATABASE = 'DATABASE',
25
- NETWORK = 'NETWORK',
26
- FILESYSTEM = 'FILESYSTEM',
27
- AUTHENTICATION = 'AUTHENTICATION',
28
- RUNTIME = 'RUNTIME',
29
- EXTERNAL = 'EXTERNAL',
30
- INTERNAL = 'INTERNAL',
31
- }
32
-
33
- /**
34
- * Core error interface
35
- */
36
- export interface ErrorInfo {
37
- code: string;
38
- message: string;
39
- category: ErrorCategory;
40
- severity: ErrorSeverity;
41
- context?: Record<string, unknown>;
42
- cause?: Error;
43
- timestamp: string;
44
- id: string;
45
- }
46
-
47
- /**
48
- * Simplified Error Class - The main error type for most use cases
49
- */
50
- export class AppError extends Error implements ErrorInfo {
51
- public readonly code: string;
52
- public readonly category: ErrorCategory;
53
- public readonly severity: ErrorSeverity;
54
- public readonly context?: Record<string, unknown>;
55
- public readonly timestamp: string;
56
- public readonly id: string;
57
-
58
- constructor(
59
- message: string,
60
- code: string,
61
- category: ErrorCategory = ErrorCategory.RUNTIME,
62
- severity: ErrorSeverity = ErrorSeverity.MEDIUM,
63
- context?: Record<string, unknown>,
64
- cause?: Error
65
- ) {
66
- super(message, { cause });
67
- this.name = 'AppError';
68
- this.code = code;
69
- this.category = category;
70
- this.severity = severity;
71
- this.context = context;
72
- this.timestamp = new Date().toISOString();
73
- this.id = this.generateErrorId();
74
-
75
- // Log the error
76
- this.logError();
77
- }
78
-
79
- private generateErrorId(): string {
80
- return `err_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
81
- }
82
-
83
- private logError(): void {
84
- const logLevel = this.getLogLevel();
85
- logger[logLevel]('AppError occurred', {
86
- id: this.id,
87
- code: this.code,
88
- message: this.message,
89
- category: this.category,
90
- severity: this.severity,
91
- context: this.context,
92
- stack: this.stack,
93
- });
94
- }
95
-
96
- private getLogLevel(): 'error' | 'warn' | 'info' | 'debug' {
97
- switch (this.severity) {
98
- case ErrorSeverity.CRITICAL:
99
- case ErrorSeverity.HIGH:
100
- return 'error';
101
- case ErrorSeverity.MEDIUM:
102
- return 'warn';
103
- case ErrorSeverity.LOW:
104
- return 'info';
105
- default:
106
- return 'debug';
107
- }
108
- }
109
-
110
- /**
111
- * Convert to JSON for serialization
112
- */
113
- toJSON(): ErrorInfo {
114
- return {
115
- code: this.code,
116
- message: this.message,
117
- category: this.category,
118
- severity: this.severity,
119
- context: this.context,
120
- cause: this.cause?.message,
121
- timestamp: this.timestamp,
122
- id: this.id,
123
- };
124
- }
125
-
126
- /**
127
- * Get user-friendly message
128
- */
129
- getUserMessage(): string {
130
- // For validation errors, be more specific
131
- if (this.category === ErrorCategory.VALIDATION) {
132
- return `Validation failed: ${this.message}`;
133
- }
134
-
135
- // For configuration errors, provide actionable guidance
136
- if (this.category === ErrorCategory.CONFIGURATION) {
137
- return `Configuration error: ${this.message}. Please check your settings.`;
138
- }
139
-
140
- // For database errors, be more generic
141
- if (this.category === ErrorCategory.DATABASE) {
142
- return 'Database operation failed. Please try again later.';
143
- }
144
-
145
- // For network/external errors
146
- if (this.category === ErrorCategory.NETWORK || this.category === ErrorCategory.EXTERNAL) {
147
- return 'External service unavailable. Please try again later.';
148
- }
149
-
150
- // Default message
151
- return this.message;
152
- }
153
- }
154
-
155
- /**
156
- * Validation Error - For input validation failures
157
- */
158
- export class ValidationError extends AppError {
159
- constructor(message: string, field?: string, value?: unknown) {
160
- const context = field ? { field, value } : undefined;
161
- super(message, 'VALIDATION_ERROR', ErrorCategory.VALIDATION, ErrorSeverity.LOW, context);
162
- this.name = 'ValidationError';
163
- }
164
- }
165
-
166
- /**
167
- * Configuration Error - For configuration issues
168
- */
169
- export class ConfigurationError extends AppError {
170
- constructor(message: string, configKey?: string) {
171
- const context = configKey ? { configKey } : undefined;
172
- super(message, 'CONFIG_ERROR', ErrorCategory.CONFIGURATION, ErrorSeverity.HIGH, context);
173
- this.name = 'ConfigurationError';
174
- }
175
- }
176
-
177
- /**
178
- * Database Error - For database operation failures
179
- */
180
- export class DatabaseError extends AppError {
181
- constructor(message: string, operation?: string, query?: string) {
182
- const context = operation ? { operation, query } : undefined;
183
- super(message, 'DATABASE_ERROR', ErrorCategory.DATABASE, ErrorSeverity.HIGH, context);
184
- this.name = 'DatabaseError';
185
- }
186
- }
187
-
188
- /**
189
- * Network Error - For network-related failures
190
- */
191
- export class NetworkError extends AppError {
192
- constructor(message: string, url?: string, statusCode?: number) {
193
- const context = url ? { url, statusCode } : undefined;
194
- super(message, 'NETWORK_ERROR', ErrorCategory.NETWORK, ErrorSeverity.MEDIUM, context);
195
- this.name = 'NetworkError';
196
- }
197
- }
198
-
199
- /**
200
- * Filesystem Error - For file system operations
201
- */
202
- export class FilesystemError extends AppError {
203
- constructor(message: string, path?: string, operation?: string) {
204
- const context = path ? { path, operation } : undefined;
205
- super(message, 'FILESYSTEM_ERROR', ErrorCategory.FILESYSTEM, ErrorSeverity.MEDIUM, context);
206
- this.name = 'FilesystemError';
207
- }
208
- }
209
-
210
- /**
211
- * Authentication Error - For auth failures
212
- */
213
- export class AuthenticationError extends AppError {
214
- constructor(message = 'Authentication failed') {
215
- super(message, 'AUTH_ERROR', ErrorCategory.AUTHENTICATION, ErrorSeverity.HIGH);
216
- this.name = 'AuthenticationError';
217
- }
218
- }
219
-
220
- /**
221
- * Error factory for convenient error creation
222
- */
223
- export class ErrorFactory {
224
- /**
225
- * Create validation error
226
- */
227
- static validation(message: string, field?: string, value?: unknown): ValidationError {
228
- return new ValidationError(message, field, value);
229
- }
230
-
231
- /**
232
- * Create configuration error
233
- */
234
- static configuration(message: string, configKey?: string): ConfigurationError {
235
- return new ConfigurationError(message, configKey);
236
- }
237
-
238
- /**
239
- * Create database error
240
- */
241
- static database(message: string, operation?: string, query?: string): DatabaseError {
242
- return new DatabaseError(message, operation, query);
243
- }
244
-
245
- /**
246
- * Create network error
247
- */
248
- static network(message: string, url?: string, statusCode?: number): NetworkError {
249
- return new NetworkError(message, url, statusCode);
250
- }
251
-
252
- /**
253
- * Create filesystem error
254
- */
255
- static filesystem(message: string, path?: string, operation?: string): FilesystemError {
256
- return new FilesystemError(message, path, operation);
257
- }
258
-
259
- /**
260
- * Create authentication error
261
- */
262
- static authentication(message?: string): AuthenticationError {
263
- return new AuthenticationError(message);
264
- }
265
-
266
- /**
267
- * Create generic app error
268
- */
269
- static app(
270
- message: string,
271
- code: string,
272
- category: ErrorCategory = ErrorCategory.RUNTIME,
273
- severity: ErrorSeverity = ErrorSeverity.MEDIUM,
274
- context?: Record<string, unknown>
275
- ): AppError {
276
- return new AppError(message, code, category, severity, context);
277
- }
278
-
279
- /**
280
- * Create error from unknown error type
281
- */
282
- static fromUnknown(error: unknown, defaultMessage = 'Unknown error occurred'): AppError {
283
- if (error instanceof AppError) {
284
- return error;
285
- }
286
-
287
- if (error instanceof Error) {
288
- return new AppError(
289
- error.message,
290
- 'UNKNOWN_ERROR',
291
- ErrorCategory.INTERNAL,
292
- ErrorSeverity.MEDIUM,
293
- { originalError: error.name },
294
- error
295
- );
296
- }
297
-
298
- if (typeof error === 'string') {
299
- return new AppError(error, 'STRING_ERROR', ErrorCategory.INTERNAL, ErrorSeverity.LOW);
300
- }
301
-
302
- return new AppError(
303
- defaultMessage,
304
- 'UNKNOWN_ERROR',
305
- ErrorCategory.INTERNAL,
306
- ErrorSeverity.MEDIUM,
307
- { originalError: error }
308
- );
309
- }
310
- }
311
-
312
- /**
313
- * Error handler utility class
314
- */
315
- export class ErrorHandler {
316
- /**
317
- * Handle error and convert to user-friendly response
318
- */
319
- static handle(error: unknown): { message: string; code: string; severity: ErrorSeverity } {
320
- const appError = ErrorFactory.fromUnknown(error);
321
-
322
- return {
323
- message: appError.getUserMessage(),
324
- code: appError.code,
325
- severity: appError.severity,
326
- };
327
- }
328
-
329
- /**
330
- * Execute operation with error handling
331
- */
332
- static async execute<T>(
333
- operation: () => Promise<T>,
334
- errorContext?: Record<string, unknown>
335
- ): Promise<{ success: true; data: T } | { success: false; error: AppError }> {
336
- try {
337
- const data = await operation();
338
- return { success: true, data };
339
- } catch (error) {
340
- const appError = ErrorFactory.fromUnknown(error);
341
-
342
- // Add context if provided
343
- if (errorContext) {
344
- appError.context = { ...appError.context, ...errorContext };
345
- }
346
-
347
- return { success: false, error: appError };
348
- }
349
- }
350
-
351
- /**
352
- * Check if error is recoverable
353
- */
354
- static isRecoverable(error: Error): boolean {
355
- if (error instanceof AppError) {
356
- return error.severity !== ErrorSeverity.CRITICAL;
357
- }
358
- return true; // Assume unknown errors are recoverable
359
- }
360
-
361
- /**
362
- * Get retry delay for error
363
- */
364
- static getRetryDelay(error: Error, attempt: number): number {
365
- if (error instanceof AppError) {
366
- switch (error.category) {
367
- case ErrorCategory.NETWORK:
368
- case ErrorCategory.EXTERNAL:
369
- return Math.min(1000 * 2 ** attempt, 30000); // Exponential backoff
370
- case ErrorCategory.DATABASE:
371
- return Math.min(500 * 2 ** attempt, 5000);
372
- default:
373
- return 1000;
374
- }
375
- }
376
- return 1000;
377
- }
378
- }
379
-
380
- /**
381
- * Convenience functions
382
- */
383
- export const createValidationError = (message: string, field?: string, value?: unknown) =>
384
- ErrorFactory.validation(message, field, value);
385
-
386
- export const createConfigurationError = (message: string, configKey?: string) =>
387
- ErrorFactory.configuration(message, configKey);
388
-
389
- export const createDatabaseError = (message: string, operation?: string, query?: string) =>
390
- ErrorFactory.database(message, operation, query);
391
-
392
- export const createNetworkError = (message: string, url?: string, statusCode?: number) =>
393
- ErrorFactory.network(message, url, statusCode);
394
-
395
- export const createFilesystemError = (message: string, path?: string, operation?: string) =>
396
- ErrorFactory.filesystem(message, path, operation);
397
-
398
- export const createAuthenticationError = (message?: string) => ErrorFactory.authentication(message);
399
-
400
- export const createError = (
401
- message: string,
402
- code: string,
403
- category: ErrorCategory = ErrorCategory.RUNTIME,
404
- severity: ErrorSeverity = ErrorSeverity.MEDIUM,
405
- context?: Record<string, unknown>
406
- ) => ErrorFactory.app(message, code, category, severity, context);
407
-
408
- // Legacy exports for backward compatibility
409
- export { AppError as BaseError };
410
- export type { ErrorInfo };
@@ -1,94 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
-
4
- // Simple template data interface
5
- export interface TemplateData {
6
- [key: string]: string | number | boolean | string[];
7
- }
8
-
9
- /**
10
- * Simple template engine for basic variable replacement
11
- * For complex templates, consider using Handlebars or Mustache
12
- */
13
- export class TemplateEngine {
14
- private templatesDir: string;
15
- private mode: 'coordinator' | 'implementer';
16
-
17
- constructor(templatesDir: string, mode: 'coordinator' | 'implementer' = 'coordinator') {
18
- this.templatesDir = templatesDir;
19
- this.mode = mode;
20
- }
21
-
22
- /**
23
- * Load template from file system
24
- */
25
- private loadTemplate(templateName: string): string {
26
- // Shared templates are in shared folder
27
- const sharedTemplates = ['spec', 'plan', 'validation', 'reviews'];
28
-
29
- if (sharedTemplates.includes(templateName)) {
30
- const templatePath = join(this.templatesDir, 'shared', `${templateName}-template.md`);
31
- return readFileSync(templatePath, 'utf8');
32
- }
33
-
34
- // Mode-specific templates are in mode folder
35
- const templatePath = join(this.templatesDir, this.mode, `${templateName}-template.md`);
36
- return readFileSync(templatePath, 'utf8');
37
- }
38
-
39
- /**
40
- * Render template with data - simple variable replacement only
41
- */
42
- render(templateName: string, data: TemplateData): string {
43
- const template = this.loadTemplate(templateName);
44
- return this.replaceVariables(template, data);
45
- }
46
-
47
- /**
48
- * Replace simple variables {{VARIABLE}}
49
- */
50
- private replaceVariables(template: string, data: TemplateData): string {
51
- let result = template;
52
-
53
- // Replace simple variables {{VARIABLE}}
54
- for (const [key, value] of Object.entries(data)) {
55
- const regex = new RegExp(`{{${key}}}`, 'g');
56
- result = result.replace(regex, String(value));
57
- }
58
-
59
- // Handle simple conditionals {{#if CONDITION}} ... {{/if}}
60
- result = result.replace(/{{#if (\w+)}}([\s\S]*?){{\/if}}/g, (_, condition, content) => {
61
- const value = data[condition];
62
- return value && value !== 'false' && value !== '0' && value !== '' ? content : '';
63
- });
64
-
65
- // Handle simple loops {{#each ARRAY}} ... {{/each}}
66
- result = result.replace(/{{#each (\w+)}}([\s\S]*?){{\/each}}/g, (_, arrayName, content) => {
67
- const array = data[arrayName];
68
- if (!Array.isArray(array)) {
69
- return '';
70
- }
71
-
72
- return array
73
- .map((item) => {
74
- const itemData = { item: String(item) };
75
- let itemResult = content;
76
- for (const [key, value] of Object.entries(itemData)) {
77
- const regex = new RegExp(`{{${key}}}`, 'g');
78
- itemResult = itemResult.replace(regex, value);
79
- }
80
- return itemResult;
81
- })
82
- .join('\n');
83
- });
84
-
85
- return result;
86
- }
87
-
88
- /**
89
- * Render template string directly (without loading from file)
90
- */
91
- renderString(template: string, data: TemplateData): string {
92
- return this.replaceVariables(template, data);
93
- }
94
- }
@@ -1,71 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Audio Player Test Utility
4
- * Test cross-platform audio playback capabilities
5
- */
6
-
7
- import { detectAudioPlayer, getAudioPlayerInfo, playNotificationSound, SYSTEM_SOUNDS, getDefaultSystemSound } from './audio-player.js';
8
-
9
- async function testAudioPlayer() {
10
- console.log('🔊 Testing Cross-Platform Audio Player\n');
11
- console.log('━'.repeat(50));
12
-
13
- // Get player info
14
- const info = await getAudioPlayerInfo();
15
- console.log('\n📊 System Information:');
16
- console.log(` Platform: ${info.platform}`);
17
- console.log(` Audio Player Available: ${info.available ? '✅' : '❌'}`);
18
- console.log(` Detected Player: ${info.player || 'None'}`);
19
-
20
- if (!info.available) {
21
- console.log('\n❌ No audio player available on this system');
22
- console.log(' Install one of the following:');
23
- if (info.platform === 'darwin') {
24
- console.log(' - afplay (built-in on macOS)');
25
- } else if (info.platform === 'linux') {
26
- console.log(' - mpg123: sudo apt-get install mpg123');
27
- console.log(' - mpg321: sudo apt-get install mpg321');
28
- console.log(' - sox: sudo apt-get install sox');
29
- } else if (info.platform === 'win32') {
30
- console.log(' - PowerShell (built-in)');
31
- console.log(' - cmdmp3');
32
- }
33
- process.exit(1);
34
- }
35
-
36
- // Get default system sound
37
- const defaultSound = getDefaultSystemSound();
38
- console.log('\n🎵 Default System Sound:');
39
- console.log(` ${defaultSound || 'None available'}`);
40
-
41
- // List available system sounds
42
- console.log('\n🎼 Available System Sounds:');
43
- const platformSounds = SYSTEM_SOUNDS[info.platform as keyof typeof SYSTEM_SOUNDS];
44
- if (platformSounds) {
45
- Object.entries(platformSounds).forEach(([name, path]) => {
46
- console.log(` ${name}: ${path}`);
47
- });
48
- } else {
49
- console.log(' No predefined sounds for this platform');
50
- }
51
-
52
- // Test playback
53
- console.log('\n▶️ Testing Playback...');
54
- console.log(' Playing notification sound...');
55
-
56
- try {
57
- await playNotificationSound();
58
- console.log(' ✅ Playback successful!');
59
- } catch (error) {
60
- console.error(' ❌ Playback failed:', error);
61
- process.exit(1);
62
- }
63
-
64
- console.log('\n━'.repeat(50));
65
- console.log('✨ Audio player test complete!\n');
66
- }
67
-
68
- testAudioPlayer().catch((error) => {
69
- console.error('\n❌ Test failed:', error);
70
- process.exit(1);
71
- });
@@ -1,46 +0,0 @@
1
- /**
2
- * Todo Context Builder
3
- * Builds todo reminder context for LLM messages
4
- */
5
-
6
- import type { Todo } from '../types/todo.types.js';
7
-
8
- /**
9
- * Build todo context string from todos
10
- */
11
- export function buildTodoContext(todos: Todo[]): string {
12
- // Filter active todos (exclude completed and removed)
13
- const activeTodos = todos.filter((t) => t.status !== 'completed' && t.status !== 'removed');
14
-
15
- // If no active todos, return minimal reminder
16
- if (activeTodos.length === 0) {
17
- return '<todo_reminder>For multi-step tasks, use updateTodos tool</todo_reminder>';
18
- }
19
-
20
- // Sort by ordering ASC, id ASC (first added = first to do)
21
- const sortedTodos = [...activeTodos].sort((a, b) => {
22
- if (a.ordering !== b.ordering) {
23
- return a.ordering - b.ordering;
24
- }
25
- return a.id - b.id;
26
- });
27
-
28
- const pendingTodos = sortedTodos.filter((t) => t.status === 'pending');
29
- const inProgressTodos = sortedTodos.filter((t) => t.status === 'in_progress');
30
-
31
- const todoLines: string[] = ['<pending_tasks>'];
32
-
33
- if (inProgressTodos.length > 0) {
34
- todoLines.push('In Progress:');
35
- inProgressTodos.forEach((t) => todoLines.push(` - [${t.id}] ${t.activeForm}`));
36
- }
37
-
38
- if (pendingTodos.length > 0) {
39
- todoLines.push('Pending:');
40
- pendingTodos.forEach((t) => todoLines.push(` - [${t.id}] ${t.content}`));
41
- }
42
-
43
- todoLines.push('</pending_tasks>');
44
-
45
- return todoLines.join('\n');
46
- }