@sowonai/crewx-sdk 0.1.0-dev.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.
Files changed (102) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +558 -0
  3. package/dist/config/index.d.ts +1 -0
  4. package/dist/config/index.js +18 -0
  5. package/dist/config/index.js.map +1 -0
  6. package/dist/config/timeout.config.d.ts +14 -0
  7. package/dist/config/timeout.config.js +34 -0
  8. package/dist/config/timeout.config.js.map +1 -0
  9. package/dist/constants/index.d.ts +4 -0
  10. package/dist/constants/index.js +8 -0
  11. package/dist/constants/index.js.map +1 -0
  12. package/dist/constants.d.ts +1 -0
  13. package/dist/constants.js +18 -0
  14. package/dist/constants.js.map +1 -0
  15. package/dist/conversation/conversation-config.d.ts +9 -0
  16. package/dist/conversation/conversation-config.js +22 -0
  17. package/dist/conversation/conversation-config.js.map +1 -0
  18. package/dist/conversation/conversation-history.interface.d.ts +25 -0
  19. package/dist/conversation/conversation-history.interface.js +3 -0
  20. package/dist/conversation/conversation-history.interface.js.map +1 -0
  21. package/dist/conversation/conversation-storage.service.d.ts +16 -0
  22. package/dist/conversation/conversation-storage.service.js +213 -0
  23. package/dist/conversation/conversation-storage.service.js.map +1 -0
  24. package/dist/conversation/index.d.ts +3 -0
  25. package/dist/conversation/index.js +20 -0
  26. package/dist/conversation/index.js.map +1 -0
  27. package/dist/core/agent/agent-factory.d.ts +30 -0
  28. package/dist/core/agent/agent-factory.js +31 -0
  29. package/dist/core/agent/agent-factory.js.map +1 -0
  30. package/dist/core/agent/agent-runtime.d.ts +36 -0
  31. package/dist/core/agent/agent-runtime.js +96 -0
  32. package/dist/core/agent/agent-runtime.js.map +1 -0
  33. package/dist/core/agent/event-bus.d.ts +44 -0
  34. package/dist/core/agent/event-bus.js +43 -0
  35. package/dist/core/agent/event-bus.js.map +1 -0
  36. package/dist/core/agent/index.d.ts +3 -0
  37. package/dist/core/agent/index.js +11 -0
  38. package/dist/core/agent/index.js.map +1 -0
  39. package/dist/core/providers/ai-provider.interface.d.ts +50 -0
  40. package/dist/core/providers/ai-provider.interface.js +23 -0
  41. package/dist/core/providers/ai-provider.interface.js.map +1 -0
  42. package/dist/core/providers/base-ai.provider.d.ts +67 -0
  43. package/dist/core/providers/base-ai.provider.js +624 -0
  44. package/dist/core/providers/base-ai.provider.js.map +1 -0
  45. package/dist/core/providers/claude.provider.d.ts +24 -0
  46. package/dist/core/providers/claude.provider.js +361 -0
  47. package/dist/core/providers/claude.provider.js.map +1 -0
  48. package/dist/core/providers/codex.provider.d.ts +17 -0
  49. package/dist/core/providers/codex.provider.js +99 -0
  50. package/dist/core/providers/codex.provider.js.map +1 -0
  51. package/dist/core/providers/copilot.provider.d.ts +24 -0
  52. package/dist/core/providers/copilot.provider.js +266 -0
  53. package/dist/core/providers/copilot.provider.js.map +1 -0
  54. package/dist/core/providers/dynamic-provider.factory.d.ts +55 -0
  55. package/dist/core/providers/dynamic-provider.factory.js +587 -0
  56. package/dist/core/providers/dynamic-provider.factory.js.map +1 -0
  57. package/dist/core/providers/gemini.provider.d.ts +21 -0
  58. package/dist/core/providers/gemini.provider.js +147 -0
  59. package/dist/core/providers/gemini.provider.js.map +1 -0
  60. package/dist/index.d.ts +15 -0
  61. package/dist/index.js +34 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/internal/index.d.ts +1 -0
  64. package/dist/internal/index.js +6 -0
  65. package/dist/internal/index.js.map +1 -0
  66. package/dist/knowledge/DocumentManager.d.ts +4 -0
  67. package/dist/knowledge/DocumentManager.js +119 -0
  68. package/dist/knowledge/DocumentManager.js.map +1 -0
  69. package/dist/knowledge/index.d.ts +1 -0
  70. package/dist/knowledge/index.js +18 -0
  71. package/dist/knowledge/index.js.map +1 -0
  72. package/dist/types/agent.types.d.ts +117 -0
  73. package/dist/types/agent.types.js +16 -0
  74. package/dist/types/agent.types.js.map +1 -0
  75. package/dist/types/index.d.ts +1 -0
  76. package/dist/types/index.js +18 -0
  77. package/dist/types/index.js.map +1 -0
  78. package/dist/types.d.ts +1 -0
  79. package/dist/types.js +18 -0
  80. package/dist/types.js.map +1 -0
  81. package/dist/utils/error-utils.d.ts +3 -0
  82. package/dist/utils/error-utils.js +27 -0
  83. package/dist/utils/error-utils.js.map +1 -0
  84. package/dist/utils/index.d.ts +4 -0
  85. package/dist/utils/index.js +21 -0
  86. package/dist/utils/index.js.map +1 -0
  87. package/dist/utils/math-utils.d.ts +3 -0
  88. package/dist/utils/math-utils.js +10 -0
  89. package/dist/utils/math-utils.js.map +1 -0
  90. package/dist/utils/mention-parser.d.ts +18 -0
  91. package/dist/utils/mention-parser.js +136 -0
  92. package/dist/utils/mention-parser.js.map +1 -0
  93. package/dist/utils/string-utils.d.ts +1 -0
  94. package/dist/utils/string-utils.js +10 -0
  95. package/dist/utils/string-utils.js.map +1 -0
  96. package/dist/utils.d.ts +3 -0
  97. package/dist/utils.js +20 -0
  98. package/dist/utils.js.map +1 -0
  99. package/dist/version.d.ts +1 -0
  100. package/dist/version.js +17 -0
  101. package/dist/version.js.map +1 -0
  102. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,558 @@
1
+ # SowonAI CrewX SDK
2
+
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
+ [![npm version](https://badge.fury.io/js/%40sowonai%2Fcrewx-sdk.svg)](https://www.npmjs.com/package/@sowonai/crewx-sdk)
5
+
6
+ Core SDK for building custom AI agent integrations and tools on top of SowonAI CrewX.
7
+
8
+ ## Overview
9
+
10
+ The CrewX SDK provides the foundational interfaces, types, and utilities for building AI agent systems. It's designed to be framework-agnostic and extensible, allowing you to:
11
+
12
+ - Build custom AI provider integrations
13
+ - Implement conversation history management
14
+ - Create knowledge base utilities
15
+ - Develop agent orchestration systems
16
+ - Integrate with existing applications
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install @sowonai/crewx-sdk
22
+ ```
23
+
24
+ For peer dependencies (if using NestJS):
25
+
26
+ ```bash
27
+ npm install @nestjs/common @nestjs/core reflect-metadata rxjs
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ ### Basic Usage with createCrewxAgent (NEW)
33
+
34
+ The SDK provides a high-level `createCrewxAgent` factory function for simplified agent creation:
35
+
36
+ ```typescript
37
+ import { createCrewxAgent } from '@sowonai/crewx-sdk';
38
+
39
+ // Create an agent with configuration
40
+ const { agent, onEvent } = await createCrewxAgent({
41
+ provider: {
42
+ namespace: 'cli',
43
+ id: 'codex',
44
+ apiKey: process.env.CODEX_TOKEN,
45
+ },
46
+ enableCallStack: true,
47
+ defaultAgentId: 'my-agent',
48
+ });
49
+
50
+ // Subscribe to agent events
51
+ onEvent('callStackUpdated', (stack) => {
52
+ console.log('Call stack:', stack.map(f => `${f.depth}: ${f.agentId}`));
53
+ });
54
+
55
+ onEvent('agentStarted', ({ agentId, mode }) => {
56
+ console.log(`Agent ${agentId} started in ${mode} mode`);
57
+ });
58
+
59
+ // Execute a query (read-only)
60
+ const queryResult = await agent.query({
61
+ prompt: 'What is the current status?',
62
+ context: 'Project: CrewX',
63
+ messages: [
64
+ {
65
+ id: 'msg-1',
66
+ text: 'Previous message',
67
+ timestamp: new Date().toISOString(),
68
+ isAssistant: false,
69
+ },
70
+ ],
71
+ });
72
+
73
+ console.log(queryResult.content);
74
+
75
+ // Execute an action (write mode)
76
+ const executeResult = await agent.execute({
77
+ prompt: 'Create a summary document',
78
+ context: 'Project root: /path/to/project',
79
+ });
80
+
81
+ console.log(executeResult.content);
82
+ ```
83
+
84
+ ### Using Utilities
85
+
86
+ ```typescript
87
+ import {
88
+ MentionParser,
89
+ loadAvailableAgents,
90
+ type AgentConfig,
91
+ type AIProvider
92
+ } from '@sowonai/crewx-sdk';
93
+
94
+ // Parse agent mentions from user input
95
+ const parser = new MentionParser();
96
+ const parsed = parser.parse('@claude analyze this code');
97
+
98
+ console.log(parsed.mentions); // ['claude']
99
+ console.log(parsed.cleanedPrompt); // 'analyze this code'
100
+ ```
101
+
102
+ ### Working with Conversation History
103
+
104
+ ```typescript
105
+ import {
106
+ type ConversationMessage,
107
+ type ConversationThread,
108
+ type IConversationHistoryProvider,
109
+ getConversationConfig
110
+ } from '@sowonai/crewx-sdk';
111
+
112
+ // Implement custom conversation storage
113
+ class MyConversationProvider implements IConversationHistoryProvider {
114
+ async fetchHistory(options) {
115
+ // Fetch from your database
116
+ return {
117
+ messages: [],
118
+ metadata: { platform: 'my-platform' }
119
+ };
120
+ }
121
+
122
+ async saveMessage(message, threadId) {
123
+ // Save to your database
124
+ }
125
+
126
+ // ... other methods
127
+ }
128
+ ```
129
+
130
+ ### Using Document Manager
131
+
132
+ ```typescript
133
+ import { DocumentManager } from '@sowonai/crewx-sdk';
134
+
135
+ const docManager = new DocumentManager();
136
+
137
+ // Load markdown documents
138
+ await docManager.loadDocument('./docs/api.md', 'markdown');
139
+
140
+ // Get document content
141
+ const content = docManager.getDocument('./docs/api.md');
142
+ console.log(content);
143
+ ```
144
+
145
+ ## API Reference
146
+
147
+ ### Core Interfaces
148
+
149
+ #### AIProvider
150
+
151
+ The fundamental interface for all AI providers:
152
+
153
+ ```typescript
154
+ interface AIProvider {
155
+ respond(
156
+ prompt: string,
157
+ options?: AIQueryOptions
158
+ ): Promise<AIResponse>;
159
+ }
160
+
161
+ interface AIQueryOptions {
162
+ messages?: ConversationMessage[];
163
+ pipedContext?: string;
164
+ model?: string;
165
+ // ... other options
166
+ }
167
+
168
+ interface AIResponse {
169
+ content: string;
170
+ metadata?: Record<string, unknown>;
171
+ }
172
+ ```
173
+
174
+ #### IConversationHistoryProvider
175
+
176
+ Interface for conversation storage implementations:
177
+
178
+ ```typescript
179
+ interface IConversationHistoryProvider {
180
+ fetchHistory(options: FetchHistoryOptions): Promise<ConversationThread>;
181
+ saveMessage(message: ConversationMessage, threadId: string): Promise<void>;
182
+ createThread(threadId: string, metadata?: Record<string, unknown>): Promise<void>;
183
+ listThreads(): Promise<Array<{ id: string; updatedAt: Date }>>;
184
+ }
185
+ ```
186
+
187
+ ### Configuration
188
+
189
+ #### TimeoutConfig
190
+
191
+ Manage timeout settings for AI operations:
192
+
193
+ ```typescript
194
+ import { getTimeoutConfig, getDefaultTimeoutConfig } from '@sowonai/crewx-sdk';
195
+
196
+ // Get timeout configuration
197
+ const timeout = getTimeoutConfig();
198
+
199
+ // Use default timeouts
200
+ const defaults = getDefaultTimeoutConfig();
201
+ console.log(defaults.default); // 120000ms
202
+ console.log(defaults.query); // 60000ms
203
+ console.log(defaults.execute); // 300000ms
204
+ ```
205
+
206
+ #### ConversationConfig
207
+
208
+ Configure conversation behavior:
209
+
210
+ ```typescript
211
+ import { getConversationConfig, DEFAULT_CONVERSATION_CONFIG } from '@sowonai/crewx-sdk';
212
+
213
+ const config = getConversationConfig();
214
+ // Or use defaults
215
+ console.log(DEFAULT_CONVERSATION_CONFIG);
216
+ ```
217
+
218
+ ### Utilities
219
+
220
+ #### MentionParser
221
+
222
+ Parse agent mentions from text:
223
+
224
+ ```typescript
225
+ import { MentionParser, type ParsedMentions } from '@sowonai/crewx-sdk';
226
+
227
+ const parser = new MentionParser();
228
+
229
+ // Parse single mention
230
+ const result = parser.parse('@claude help me');
231
+ // result.mentions: ['claude']
232
+ // result.cleanedPrompt: 'help me'
233
+
234
+ // Parse multiple mentions
235
+ const multi = parser.parse('@claude @gemini compare approaches');
236
+ // multi.mentions: ['claude', 'gemini']
237
+
238
+ // Override model
239
+ const withModel = parser.parse('@claude:opus analyze');
240
+ // Model override detected
241
+ ```
242
+
243
+ #### Error Utilities
244
+
245
+ Handle errors consistently:
246
+
247
+ ```typescript
248
+ import { getErrorMessage, getErrorStack, isError } from '@sowonai/crewx-sdk';
249
+
250
+ try {
251
+ // ... operation
252
+ } catch (err) {
253
+ if (isError(err)) {
254
+ console.error(getErrorMessage(err));
255
+ console.error(getErrorStack(err));
256
+ }
257
+ }
258
+ ```
259
+
260
+ ### Agent Factory API (NEW in WBS-8)
261
+
262
+ #### createCrewxAgent
263
+
264
+ Create and configure an agent with event support:
265
+
266
+ ```typescript
267
+ import {
268
+ createCrewxAgent,
269
+ type CrewxAgentConfig,
270
+ type CrewxAgent,
271
+ type AgentQueryRequest,
272
+ type AgentExecuteRequest,
273
+ type CallStackFrame
274
+ } from '@sowonai/crewx-sdk';
275
+
276
+ // Configuration interface
277
+ interface CrewxAgentConfig {
278
+ provider?: {
279
+ namespace: string;
280
+ id: string;
281
+ apiKey?: string;
282
+ model?: string;
283
+ };
284
+ knowledgeBase?: {
285
+ path?: string;
286
+ sources?: string[];
287
+ };
288
+ enableCallStack?: boolean;
289
+ defaultAgentId?: string;
290
+ }
291
+
292
+ // Create agent
293
+ const { agent, onEvent, eventBus } = await createCrewxAgent({
294
+ provider: { namespace: 'cli', id: 'codex' },
295
+ enableCallStack: true,
296
+ });
297
+
298
+ // Agent interface
299
+ agent.query(request: AgentQueryRequest): Promise<AgentResult>
300
+ agent.execute(request: AgentExecuteRequest): Promise<AgentResult>
301
+ agent.getCallStack(): CallStackFrame[]
302
+ ```
303
+
304
+ #### Event System
305
+
306
+ The event system supports lifecycle and call stack tracking:
307
+
308
+ ```typescript
309
+ // Subscribe to events
310
+ const unsubscribe = onEvent('eventName', (payload) => {
311
+ console.log('Event:', payload);
312
+ });
313
+
314
+ // Supported events:
315
+ // - 'callStackUpdated': CallStackFrame[]
316
+ // - 'agentStarted': { agentId: string, mode: 'query' | 'execute' }
317
+ // - 'agentCompleted': { agentId: string, success: boolean }
318
+ // - 'toolCallStarted': { toolName: string, args: any }
319
+ // - 'toolCallCompleted': { toolName: string, result: any }
320
+
321
+ // Unsubscribe when done
322
+ unsubscribe();
323
+
324
+ // Direct event bus access for advanced usage
325
+ eventBus.emit('customEvent', { data: 'value' });
326
+ eventBus.listenerCount('eventName');
327
+ eventBus.clear(); // Remove all listeners
328
+ ```
329
+
330
+ ### Types
331
+
332
+ #### Agent Types
333
+
334
+ ```typescript
335
+ import type {
336
+ AgentConfig,
337
+ AgentsConfig,
338
+ AgentInfo,
339
+ AgentQueryOptions,
340
+ AgentResponse,
341
+ RemoteAgentConfigInput,
342
+ RemoteAgentInfo
343
+ } from '@sowonai/crewx-sdk';
344
+
345
+ import { ExecutionMode, SecurityLevel } from '@sowonai/crewx-sdk';
346
+ ```
347
+
348
+ ## Provider Development
349
+
350
+ ### Creating a Custom Provider
351
+
352
+ ```typescript
353
+ import { AIProvider, AIQueryOptions, AIResponse } from '@sowonai/crewx-sdk';
354
+
355
+ export class MyCustomProvider implements AIProvider {
356
+ async respond(
357
+ prompt: string,
358
+ options?: AIQueryOptions
359
+ ): Promise<AIResponse> {
360
+ // Implement your AI provider logic
361
+ const result = await this.callMyAI(prompt, options);
362
+
363
+ return {
364
+ content: result.text,
365
+ metadata: {
366
+ model: result.model,
367
+ tokens: result.usage
368
+ }
369
+ };
370
+ }
371
+
372
+ private async callMyAI(prompt: string, options?: AIQueryOptions) {
373
+ // Your implementation
374
+ return {
375
+ text: 'Response from my AI',
376
+ model: 'my-model-v1',
377
+ usage: { total: 100 }
378
+ };
379
+ }
380
+ }
381
+ ```
382
+
383
+ ### Implementing Conversation Storage
384
+
385
+ ```typescript
386
+ import {
387
+ IConversationHistoryProvider,
388
+ ConversationMessage,
389
+ ConversationThread,
390
+ FetchHistoryOptions
391
+ } from '@sowonai/crewx-sdk';
392
+
393
+ export class DatabaseConversationProvider implements IConversationHistoryProvider {
394
+ constructor(private db: MyDatabase) {}
395
+
396
+ async fetchHistory(options: FetchHistoryOptions): Promise<ConversationThread> {
397
+ const messages = await this.db.query(
398
+ 'SELECT * FROM messages WHERE thread_id = ?',
399
+ [options.threadId]
400
+ );
401
+
402
+ return {
403
+ messages: messages.map(this.toMessage),
404
+ metadata: { platform: 'database' }
405
+ };
406
+ }
407
+
408
+ async saveMessage(message: ConversationMessage, threadId: string): Promise<void> {
409
+ await this.db.insert('messages', {
410
+ thread_id: threadId,
411
+ ...message
412
+ });
413
+ }
414
+
415
+ async createThread(threadId: string, metadata?: Record<string, unknown>): Promise<void> {
416
+ await this.db.insert('threads', { id: threadId, metadata });
417
+ }
418
+
419
+ async listThreads() {
420
+ return await this.db.query('SELECT id, updated_at FROM threads');
421
+ }
422
+
423
+ private toMessage(row: any): ConversationMessage {
424
+ return {
425
+ id: row.id,
426
+ userId: row.user_id,
427
+ text: row.text,
428
+ timestamp: row.created_at,
429
+ isAssistant: row.is_assistant,
430
+ metadata: row.metadata
431
+ };
432
+ }
433
+ }
434
+ ```
435
+
436
+ ## Advanced Usage
437
+
438
+ ### Using Internal APIs
439
+
440
+ Some internal APIs are available for advanced use cases:
441
+
442
+ ```typescript
443
+ import { /* internal exports */ } from '@sowonai/crewx-sdk/internal';
444
+
445
+ // Note: Internal APIs may change between minor versions
446
+ // Use at your own risk
447
+ ```
448
+
449
+ ### Integration with NestJS
450
+
451
+ The SDK works seamlessly with NestJS:
452
+
453
+ ```typescript
454
+ import { Injectable } from '@nestjs/common';
455
+ import { DocumentManager } from '@sowonai/crewx-sdk';
456
+
457
+ @Injectable()
458
+ export class MyService {
459
+ constructor(private readonly docManager: DocumentManager) {}
460
+
461
+ async loadDocs() {
462
+ await this.docManager.loadDocument('./docs/api.md', 'markdown');
463
+ }
464
+ }
465
+ ```
466
+
467
+ ## Constants
468
+
469
+ ```typescript
470
+ import {
471
+ SERVER_NAME,
472
+ PREFIX_TOOL_NAME,
473
+ DEFAULT_MAX_FILE_SIZE,
474
+ DEFAULT_MAX_FILES
475
+ } from '@sowonai/crewx-sdk';
476
+
477
+ console.log(SERVER_NAME); // 'crewx'
478
+ console.log(PREFIX_TOOL_NAME); // 'crewx_'
479
+ ```
480
+
481
+ ## Package Exports
482
+
483
+ The SDK provides the following export paths:
484
+
485
+ - `@sowonai/crewx-sdk` - Main public API
486
+ - `@sowonai/crewx-sdk/internal` - Internal utilities (use with caution)
487
+ - `@sowonai/crewx-sdk/package.json` - Package metadata
488
+
489
+ ## TypeScript
490
+
491
+ The SDK is written in TypeScript and includes full type definitions. No additional `@types` packages are needed.
492
+
493
+ ```typescript
494
+ import type { AIProvider, AgentConfig } from '@sowonai/crewx-sdk';
495
+
496
+ // Full type safety
497
+ const config: AgentConfig = {
498
+ id: 'my-agent',
499
+ provider: 'cli/claude',
500
+ // ... TypeScript will guide you
501
+ };
502
+ ```
503
+
504
+ ## Testing
505
+
506
+ ```bash
507
+ # Run unit tests
508
+ npm test
509
+
510
+ # Run tests in watch mode
511
+ npm run test:watch
512
+
513
+ # Run tests with UI
514
+ npm run test:ui
515
+
516
+ # Run tests with coverage
517
+ npm run test:coverage
518
+ ```
519
+
520
+ ## Building
521
+
522
+ ```bash
523
+ # Build the package
524
+ npm run build
525
+
526
+ # Output: dist/
527
+ ```
528
+
529
+ ## Contributing
530
+
531
+ Contributions to the SDK require signing our [Contributor License Agreement (CLA)](../../docs/CLA.md).
532
+
533
+ Please follow these steps:
534
+
535
+ 1. Fork the repository
536
+ 2. Create a feature branch
537
+ 3. Make your changes
538
+ 4. Add tests for new functionality
539
+ 5. Run `npm test` and `npm run build`
540
+ 6. Submit a pull request
541
+
542
+ ## License
543
+
544
+ Apache-2.0 License - See [LICENSE](./LICENSE) for details.
545
+
546
+ ## Support
547
+
548
+ - [GitHub Issues](https://github.com/sowonlabs/crewx/issues)
549
+ - [Documentation](../../docs/)
550
+ - [Main README](../../README.md)
551
+
552
+ ## Related Packages
553
+
554
+ - [`crewx`](../cli/README.md) - Full-featured CLI tool built on this SDK
555
+
556
+ ---
557
+
558
+ Built by [SowonLabs](https://github.com/sowonlabs)
@@ -0,0 +1 @@
1
+ export * from './timeout.config';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./timeout.config"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
@@ -0,0 +1,14 @@
1
+ export interface TimeoutConfig {
2
+ claudeQuery: number;
3
+ claudeExecute: number;
4
+ geminiQuery: number;
5
+ geminiExecute: number;
6
+ copilotQuery: number;
7
+ copilotExecute: number;
8
+ parallel: number;
9
+ stdinInitial: number;
10
+ stdinChunk: number;
11
+ stdinComplete: number;
12
+ }
13
+ export declare function getTimeoutConfig(env?: NodeJS.ProcessEnv): TimeoutConfig;
14
+ export declare function getDefaultTimeoutConfig(): TimeoutConfig;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTimeoutConfig = getTimeoutConfig;
4
+ exports.getDefaultTimeoutConfig = getDefaultTimeoutConfig;
5
+ const DEFAULT_TIMEOUTS = {
6
+ claudeQuery: 1800000,
7
+ claudeExecute: 1800000,
8
+ geminiQuery: 1800000,
9
+ geminiExecute: 1800000,
10
+ copilotQuery: 1800000,
11
+ copilotExecute: 1800000,
12
+ parallel: 1800000,
13
+ stdinInitial: 30000,
14
+ stdinChunk: 1800000,
15
+ stdinComplete: 100,
16
+ };
17
+ function getTimeoutConfig(env = process.env) {
18
+ return {
19
+ claudeQuery: parseInt(env.CREWCODE_TIMEOUT_CLAUDE_QUERY ?? '') || DEFAULT_TIMEOUTS.claudeQuery,
20
+ claudeExecute: parseInt(env.CREWCODE_TIMEOUT_CLAUDE_EXECUTE ?? '') || DEFAULT_TIMEOUTS.claudeExecute,
21
+ geminiQuery: parseInt(env.CREWCODE_TIMEOUT_GEMINI_QUERY ?? '') || DEFAULT_TIMEOUTS.geminiQuery,
22
+ geminiExecute: parseInt(env.CREWCODE_TIMEOUT_GEMINI_EXECUTE ?? '') || DEFAULT_TIMEOUTS.geminiExecute,
23
+ copilotQuery: parseInt(env.CREWCODE_TIMEOUT_COPILOT_QUERY ?? '') || DEFAULT_TIMEOUTS.copilotQuery,
24
+ copilotExecute: parseInt(env.CREWCODE_TIMEOUT_COPILOT_EXECUTE ?? '') || DEFAULT_TIMEOUTS.copilotExecute,
25
+ parallel: parseInt(env.CREWCODE_TIMEOUT_PARALLEL ?? '') || DEFAULT_TIMEOUTS.parallel,
26
+ stdinInitial: parseInt(env.CREWCODE_TIMEOUT_STDIN_INITIAL ?? '') || DEFAULT_TIMEOUTS.stdinInitial,
27
+ stdinChunk: parseInt(env.CREWCODE_TIMEOUT_STDIN_CHUNK ?? '') || DEFAULT_TIMEOUTS.stdinChunk,
28
+ stdinComplete: parseInt(env.CREWCODE_TIMEOUT_STDIN_COMPLETE ?? '') || DEFAULT_TIMEOUTS.stdinComplete,
29
+ };
30
+ }
31
+ function getDefaultTimeoutConfig() {
32
+ return { ...DEFAULT_TIMEOUTS };
33
+ }
34
+ //# sourceMappingURL=timeout.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeout.config.js","sourceRoot":"","sources":["../../src/config/timeout.config.ts"],"names":[],"mappings":";;AA6BA,4CAaC;AAED,0DAEC;AA9BD,MAAM,gBAAgB,GAAkB;IACtC,WAAW,EAAE,OAAS;IACtB,aAAa,EAAE,OAAS;IACxB,WAAW,EAAE,OAAS;IACtB,aAAa,EAAE,OAAS;IACxB,YAAY,EAAE,OAAS;IACvB,cAAc,EAAE,OAAS;IACzB,QAAQ,EAAE,OAAS;IACnB,YAAY,EAAE,KAAM;IACpB,UAAU,EAAE,OAAS;IACrB,aAAa,EAAE,GAAG;CACnB,CAAC;AAEF,SAAgB,gBAAgB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACnE,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,6BAA6B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,WAAW;QAC9F,aAAa,EAAE,QAAQ,CAAC,GAAG,CAAC,+BAA+B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,aAAa;QACpG,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,6BAA6B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,WAAW;QAC9F,aAAa,EAAE,QAAQ,CAAC,GAAG,CAAC,+BAA+B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,aAAa;QACpG,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,8BAA8B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,YAAY;QACjG,cAAc,EAAE,QAAQ,CAAC,GAAG,CAAC,gCAAgC,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,cAAc;QACvG,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,QAAQ;QACpF,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,8BAA8B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,YAAY;QACjG,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,4BAA4B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,UAAU;QAC3F,aAAa,EAAE,QAAQ,CAAC,GAAG,CAAC,+BAA+B,IAAI,EAAE,CAAC,IAAI,gBAAgB,CAAC,aAAa;KACrG,CAAC;AACJ,CAAC;AAED,SAAgB,uBAAuB;IACrC,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const SERVER_NAME = "crewx";
2
+ export declare const PREFIX_TOOL_NAME = "crewx_";
3
+ export declare const DEFAULT_MAX_FILE_SIZE: number;
4
+ export declare const DEFAULT_MAX_FILES = 100;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_MAX_FILES = exports.DEFAULT_MAX_FILE_SIZE = exports.PREFIX_TOOL_NAME = exports.SERVER_NAME = void 0;
4
+ exports.SERVER_NAME = 'crewx';
5
+ exports.PREFIX_TOOL_NAME = 'crewx_';
6
+ exports.DEFAULT_MAX_FILE_SIZE = 1024 * 1024;
7
+ exports.DEFAULT_MAX_FILES = 100;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAC5B,QAAA,qBAAqB,GAAG,IAAI,GAAG,IAAI,CAAC;AACpC,QAAA,iBAAiB,GAAG,GAAG,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './constants/index';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./constants/index"), exports);
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
@@ -0,0 +1,9 @@
1
+ export interface ConversationConfig {
2
+ maxMessages: number;
3
+ maxContextLength: number;
4
+ cacheTTL: number;
5
+ maxCacheSize: number;
6
+ enabled: boolean;
7
+ }
8
+ export declare const DEFAULT_CONVERSATION_CONFIG: ConversationConfig;
9
+ export declare function getConversationConfig(env?: NodeJS.ProcessEnv): ConversationConfig;