@sparkleideas/shared 3.0.0-alpha.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.
Files changed (96) hide show
  1. package/README.md +323 -0
  2. package/__tests__/hooks/bash-safety.test.ts +289 -0
  3. package/__tests__/hooks/file-organization.test.ts +335 -0
  4. package/__tests__/hooks/git-commit.test.ts +336 -0
  5. package/__tests__/hooks/index.ts +23 -0
  6. package/__tests__/hooks/session-hooks.test.ts +357 -0
  7. package/__tests__/hooks/task-hooks.test.ts +193 -0
  8. package/docs/EVENTS_IMPLEMENTATION_SUMMARY.md +388 -0
  9. package/docs/EVENTS_QUICK_REFERENCE.md +470 -0
  10. package/docs/EVENTS_README.md +352 -0
  11. package/package.json +39 -0
  12. package/src/core/config/defaults.ts +207 -0
  13. package/src/core/config/index.ts +15 -0
  14. package/src/core/config/loader.ts +271 -0
  15. package/src/core/config/schema.ts +188 -0
  16. package/src/core/config/validator.ts +209 -0
  17. package/src/core/event-bus.ts +236 -0
  18. package/src/core/index.ts +22 -0
  19. package/src/core/interfaces/agent.interface.ts +251 -0
  20. package/src/core/interfaces/coordinator.interface.ts +363 -0
  21. package/src/core/interfaces/event.interface.ts +267 -0
  22. package/src/core/interfaces/index.ts +19 -0
  23. package/src/core/interfaces/memory.interface.ts +332 -0
  24. package/src/core/interfaces/task.interface.ts +223 -0
  25. package/src/core/orchestrator/event-coordinator.ts +122 -0
  26. package/src/core/orchestrator/health-monitor.ts +214 -0
  27. package/src/core/orchestrator/index.ts +89 -0
  28. package/src/core/orchestrator/lifecycle-manager.ts +263 -0
  29. package/src/core/orchestrator/session-manager.ts +279 -0
  30. package/src/core/orchestrator/task-manager.ts +317 -0
  31. package/src/events/domain-events.ts +584 -0
  32. package/src/events/event-store.test.ts +387 -0
  33. package/src/events/event-store.ts +588 -0
  34. package/src/events/example-usage.ts +293 -0
  35. package/src/events/index.ts +90 -0
  36. package/src/events/projections.ts +561 -0
  37. package/src/events/state-reconstructor.ts +349 -0
  38. package/src/events.ts +367 -0
  39. package/src/hooks/INTEGRATION.md +658 -0
  40. package/src/hooks/README.md +532 -0
  41. package/src/hooks/example-usage.ts +499 -0
  42. package/src/hooks/executor.ts +379 -0
  43. package/src/hooks/hooks.test.ts +421 -0
  44. package/src/hooks/index.ts +131 -0
  45. package/src/hooks/registry.ts +333 -0
  46. package/src/hooks/safety/bash-safety.ts +604 -0
  47. package/src/hooks/safety/file-organization.ts +473 -0
  48. package/src/hooks/safety/git-commit.ts +623 -0
  49. package/src/hooks/safety/index.ts +46 -0
  50. package/src/hooks/session-hooks.ts +559 -0
  51. package/src/hooks/task-hooks.ts +513 -0
  52. package/src/hooks/types.ts +357 -0
  53. package/src/hooks/verify-exports.test.ts +125 -0
  54. package/src/index.ts +195 -0
  55. package/src/mcp/connection-pool.ts +438 -0
  56. package/src/mcp/index.ts +183 -0
  57. package/src/mcp/server.ts +774 -0
  58. package/src/mcp/session-manager.ts +428 -0
  59. package/src/mcp/tool-registry.ts +566 -0
  60. package/src/mcp/transport/http.ts +557 -0
  61. package/src/mcp/transport/index.ts +294 -0
  62. package/src/mcp/transport/stdio.ts +324 -0
  63. package/src/mcp/transport/websocket.ts +484 -0
  64. package/src/mcp/types.ts +565 -0
  65. package/src/plugin-interface.ts +663 -0
  66. package/src/plugin-loader.ts +638 -0
  67. package/src/plugin-registry.ts +604 -0
  68. package/src/plugins/index.ts +34 -0
  69. package/src/plugins/official/hive-mind-plugin.ts +330 -0
  70. package/src/plugins/official/index.ts +24 -0
  71. package/src/plugins/official/maestro-plugin.ts +508 -0
  72. package/src/plugins/types.ts +108 -0
  73. package/src/resilience/bulkhead.ts +277 -0
  74. package/src/resilience/circuit-breaker.ts +326 -0
  75. package/src/resilience/index.ts +26 -0
  76. package/src/resilience/rate-limiter.ts +420 -0
  77. package/src/resilience/retry.ts +224 -0
  78. package/src/security/index.ts +39 -0
  79. package/src/security/input-validation.ts +265 -0
  80. package/src/security/secure-random.ts +159 -0
  81. package/src/services/index.ts +16 -0
  82. package/src/services/v3-progress.service.ts +505 -0
  83. package/src/types/agent.types.ts +144 -0
  84. package/src/types/index.ts +22 -0
  85. package/src/types/mcp.types.ts +300 -0
  86. package/src/types/memory.types.ts +263 -0
  87. package/src/types/swarm.types.ts +255 -0
  88. package/src/types/task.types.ts +205 -0
  89. package/src/types.ts +367 -0
  90. package/src/utils/secure-logger.d.ts +69 -0
  91. package/src/utils/secure-logger.d.ts.map +1 -0
  92. package/src/utils/secure-logger.js +208 -0
  93. package/src/utils/secure-logger.js.map +1 -0
  94. package/src/utils/secure-logger.ts +257 -0
  95. package/tmp.json +0 -0
  96. package/tsconfig.json +9 -0
@@ -0,0 +1,352 @@
1
+ # Event Store Persistence (ADR-007)
2
+
3
+ Complete event sourcing implementation for V3 Claude Flow with persistent storage, projections, and event replay.
4
+
5
+ ## Overview
6
+
7
+ The Event Store provides a robust foundation for tracking all state changes in the V3 system through domain events. This enables:
8
+
9
+ - **Complete Audit Trail**: Every state change is recorded
10
+ - **Time Travel**: Replay events to reconstruct state at any point
11
+ - **Projections**: Build multiple read models from the same events
12
+ - **Debugging**: Understand exactly what happened and when
13
+ - **Event-Driven Architecture**: Decouple components through events
14
+
15
+ ## Architecture
16
+
17
+ ```
18
+ ┌─────────────────────────────────────────────────────────────┐
19
+ │ Event Store │
20
+ │ ┌───────────────────────────────────────────────────────┐ │
21
+ │ │ SQLite Database (sql.js for cross-platform) │ │
22
+ │ │ - events table (append-only log) │ │
23
+ │ │ - snapshots table (performance optimization) │ │
24
+ │ └───────────────────────────────────────────────────────┘ │
25
+ └─────────────────────────────────────────────────────────────┘
26
+ │ │ │
27
+ ▼ ▼ ▼
28
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
29
+ │ Agent │ │ Task │ │ Memory │
30
+ │ Projection │ │ Projection │ │ Projection │
31
+ └──────────────┘ └──────────────┘ └──────────────┘
32
+ ```
33
+
34
+ ## Features
35
+
36
+ ### 1. Event Store
37
+ - **Persistent Storage**: SQLite with sql.js fallback for Windows compatibility
38
+ - **Versioning**: Automatic version tracking per aggregate
39
+ - **Filtering**: Query events by type, aggregate, timestamp
40
+ - **Replay**: Iterate through all events for rebuilding state
41
+ - **Snapshots**: Performance optimization for large event streams
42
+ - **Auto-Persist**: Configurable auto-save to disk
43
+
44
+ ### 2. Domain Events
45
+ Comprehensive event types for all aggregates:
46
+
47
+ **Agent Events**:
48
+ - `agent:spawned` - Agent created
49
+ - `agent:started` - Agent began working
50
+ - `agent:stopped` - Agent finished
51
+ - `agent:failed` - Agent encountered error
52
+ - `agent:status-changed` - Agent status updated
53
+ - `agent:task-assigned` - Task assigned to agent
54
+ - `agent:task-completed` - Agent completed task
55
+
56
+ **Task Events**:
57
+ - `task:created` - New task created
58
+ - `task:started` - Task execution began
59
+ - `task:completed` - Task finished successfully
60
+ - `task:failed` - Task failed
61
+ - `task:blocked` - Task blocked by dependencies
62
+ - `task:queued` - Task added to queue
63
+
64
+ **Memory Events**:
65
+ - `memory:stored` - Memory entry saved
66
+ - `memory:retrieved` - Memory entry accessed
67
+ - `memory:deleted` - Memory entry removed
68
+ - `memory:expired` - Memory entry expired
69
+
70
+ **Swarm Events**:
71
+ - `swarm:initialized` - Swarm started
72
+ - `swarm:scaled` - Agent count changed
73
+ - `swarm:terminated` - Swarm shut down
74
+ - `swarm:phase-changed` - Execution phase changed
75
+ - `swarm:milestone-reached` - Milestone achieved
76
+ - `swarm:error` - Swarm-level error
77
+
78
+ ### 3. Projections
79
+ Build queryable read models from events:
80
+
81
+ **AgentStateProjection**:
82
+ - Current state of all agents
83
+ - Filter by status, domain, role
84
+ - Track task completion metrics
85
+ - Monitor agent health
86
+
87
+ **TaskHistoryProjection**:
88
+ - Complete task execution history
89
+ - Filter by status, agent, type
90
+ - Calculate average durations
91
+ - Track success/failure rates
92
+
93
+ **MemoryIndexProjection**:
94
+ - Memory access patterns
95
+ - Track usage by namespace
96
+ - Identify hot/cold data
97
+ - Monitor memory consumption
98
+
99
+ ## Usage
100
+
101
+ ### Basic Event Storage
102
+
103
+ ```typescript
104
+ import { EventStore, createAgentSpawnedEvent } from '@claude-flow/shared/events';
105
+
106
+ // Initialize
107
+ const eventStore = new EventStore({
108
+ databasePath: './events.db',
109
+ verbose: true,
110
+ });
111
+ await eventStore.initialize();
112
+
113
+ // Record events
114
+ const event = createAgentSpawnedEvent(
115
+ 'agent-1',
116
+ 'coder',
117
+ 'core',
118
+ ['coding', 'testing']
119
+ );
120
+ await eventStore.append(event);
121
+
122
+ // Query events
123
+ const agentEvents = await eventStore.getEvents('agent-1');
124
+ const allTaskEvents = await eventStore.query({
125
+ aggregateTypes: ['task']
126
+ });
127
+
128
+ // Cleanup
129
+ await eventStore.shutdown();
130
+ ```
131
+
132
+ ### Using Projections
133
+
134
+ ```typescript
135
+ import {
136
+ EventStore,
137
+ AgentStateProjection,
138
+ TaskHistoryProjection
139
+ } from '@claude-flow/shared/events';
140
+
141
+ const eventStore = new EventStore({ databasePath: './events.db' });
142
+ await eventStore.initialize();
143
+
144
+ // Build agent state projection
145
+ const agentProjection = new AgentStateProjection(eventStore);
146
+ await agentProjection.initialize();
147
+
148
+ // Query agent state
149
+ const activeAgents = agentProjection.getAgentsByStatus('active');
150
+ const agent1 = agentProjection.getAgent('agent-1');
151
+
152
+ console.log(`Active agents: ${activeAgents.length}`);
153
+ console.log(`Agent 1 completed ${agent1.completedTasks.length} tasks`);
154
+
155
+ // Build task history projection
156
+ const taskProjection = new TaskHistoryProjection(eventStore);
157
+ await taskProjection.initialize();
158
+
159
+ // Query task history
160
+ const completedTasks = taskProjection.getTasksByStatus('completed');
161
+ const avgDuration = taskProjection.getAverageTaskDuration();
162
+
163
+ console.log(`Completed: ${completedTasks.length} tasks`);
164
+ console.log(`Average duration: ${avgDuration}ms`);
165
+ ```
166
+
167
+ ### Event Replay
168
+
169
+ ```typescript
170
+ // Replay all events
171
+ for await (const event of eventStore.replay()) {
172
+ console.log(`${event.type} at ${new Date(event.timestamp)}`);
173
+ }
174
+
175
+ // Replay from specific version
176
+ for await (const event of eventStore.replay(100)) {
177
+ // Process events starting from version 100
178
+ }
179
+ ```
180
+
181
+ ### Snapshots
182
+
183
+ ```typescript
184
+ // Save snapshot for performance
185
+ await eventStore.saveSnapshot({
186
+ aggregateId: 'agent-1',
187
+ aggregateType: 'agent',
188
+ version: 500,
189
+ state: { status: 'active', tasks: ['task-1', 'task-2'] },
190
+ timestamp: Date.now(),
191
+ });
192
+
193
+ // Load snapshot
194
+ const snapshot = await eventStore.getSnapshot('agent-1');
195
+ if (snapshot) {
196
+ // Resume from snapshot version
197
+ const events = await eventStore.getEvents('agent-1', snapshot.version);
198
+ }
199
+ ```
200
+
201
+ ## Configuration
202
+
203
+ ```typescript
204
+ const eventStore = new EventStore({
205
+ // Database path (:memory: for in-memory only)
206
+ databasePath: './v3-events.db',
207
+
208
+ // Enable verbose logging
209
+ verbose: true,
210
+
211
+ // Auto-persist interval (0 = manual only)
212
+ autoPersistInterval: 5000, // 5 seconds
213
+
214
+ // Recommend snapshots every N events
215
+ snapshotThreshold: 100,
216
+
217
+ // Custom sql.js WASM path (optional)
218
+ wasmPath: './sql-wasm.wasm',
219
+ });
220
+ ```
221
+
222
+ ## Performance
223
+
224
+ ### Indexing
225
+ The Event Store automatically creates indexes for:
226
+ - Aggregate ID + Version (unique)
227
+ - Aggregate Type
228
+ - Event Type
229
+ - Timestamp
230
+ - Version
231
+
232
+ ### Snapshots
233
+ Recommended usage:
234
+ - Save snapshot every 100-500 events
235
+ - Use snapshots for long-running aggregates
236
+ - Snapshots reduce replay time from O(n) to O(1)
237
+
238
+ ### Auto-Persist
239
+ - Default: 5 seconds
240
+ - In-memory mode: No persistence
241
+ - Disk mode: Periodic writes to SQLite file
242
+
243
+ ## Testing
244
+
245
+ Run comprehensive tests:
246
+
247
+ ```bash
248
+ # Run all event store tests
249
+ npm test -- event-store.test.ts
250
+
251
+ # Run specific test suite
252
+ npm test -- event-store.test.ts -t "Event Appending"
253
+ ```
254
+
255
+ ## Example
256
+
257
+ See `example-usage.ts` for a complete demonstration:
258
+
259
+ ```bash
260
+ npx tsx v3/@claude-flow/shared/src/events/example-usage.ts
261
+ ```
262
+
263
+ Output includes:
264
+ - Event recording
265
+ - Query examples
266
+ - Projection building
267
+ - Event replay
268
+ - Snapshots
269
+ - Statistics
270
+
271
+ ## Integration with V3
272
+
273
+ ### Agent Lifecycle
274
+ ```typescript
275
+ // Queen coordinator spawns agents
276
+ await eventStore.append(
277
+ createAgentSpawnedEvent('agent-2', 'security-architect', 'security', ['auditing'])
278
+ );
279
+
280
+ // Track agent execution
281
+ await eventStore.append(createAgentStartedEvent('agent-2'));
282
+ await eventStore.append(createAgentTaskAssignedEvent('agent-2', 'task-1', Date.now()));
283
+ ```
284
+
285
+ ### Task Execution
286
+ ```typescript
287
+ // Create task
288
+ await eventStore.append(
289
+ createTaskCreatedEvent('task-1', 'security-audit', 'CVE-1 Fix', 'Fix injection', 'critical', [])
290
+ );
291
+
292
+ // Track progress
293
+ await eventStore.append(createTaskStartedEvent('task-1', 'agent-2'));
294
+ await eventStore.append(createTaskCompletedEvent('task-1', { fixed: true }, 5000));
295
+ ```
296
+
297
+ ### Memory Operations
298
+ ```typescript
299
+ // Track memory usage
300
+ await eventStore.append(
301
+ createMemoryStoredEvent('mem-1', 'agent-context', 'agent-2-state', 'episodic', 2048)
302
+ );
303
+
304
+ await eventStore.append(
305
+ createMemoryRetrievedEvent('mem-1', 'agent-context', 'agent-2-state', 1)
306
+ );
307
+ ```
308
+
309
+ ## Cross-Platform Compatibility
310
+
311
+ The Event Store uses **sql.js** for cross-platform SQLite support:
312
+
313
+ - **Windows**: Pure JavaScript/WASM (no native compilation)
314
+ - **macOS**: Works with standard Node.js
315
+ - **Linux**: Full compatibility
316
+
317
+ Database files are portable across platforms.
318
+
319
+ ## Migration Path
320
+
321
+ To integrate Event Store into existing V3 code:
322
+
323
+ 1. **Initialize Event Store**: Add to swarm initialization
324
+ 2. **Record Events**: Emit events on state changes
325
+ 3. **Build Projections**: Replace direct state queries
326
+ 4. **Event Replay**: Use for debugging and analytics
327
+ 5. **Snapshots**: Add for performance optimization
328
+
329
+ ## ADR Compliance
330
+
331
+ This implementation fulfills **ADR-007** requirements:
332
+
333
+ ✅ Event Store with `append()`, `getEvents()`, `getEventsByType()`, `replay()`
334
+ ✅ Domain events for agent, task, memory, swarm
335
+ ✅ Projections for AgentState, TaskHistory, MemoryIndex
336
+ ✅ SQLite persistence with cross-platform support
337
+ ✅ Event versioning and snapshots
338
+ ✅ Comprehensive test coverage
339
+
340
+ ## Contributing
341
+
342
+ When adding new domain events:
343
+
344
+ 1. Define event interface in `domain-events.ts`
345
+ 2. Add factory function
346
+ 3. Update projections to handle new event
347
+ 4. Add tests
348
+ 5. Update this README
349
+
350
+ ## License
351
+
352
+ Part of claude-flow V3 - See root LICENSE file.
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@sparkleideas/shared",
3
+ "version": "3.0.0-alpha.7",
4
+ "type": "module",
5
+ "description": "Shared module - common types, events, utilities, core interfaces",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js",
10
+ "./types": "./dist/types/index.js",
11
+ "./core": "./dist/core/index.js",
12
+ "./events": "./dist/events/index.js",
13
+ "./hooks": "./dist/hooks/index.js",
14
+ "./mcp": "./dist/mcp/index.js",
15
+ "./security": "./dist/security/index.js",
16
+ "./resilience": "./dist/resilience/index.js"
17
+ },
18
+ "scripts": {
19
+ "test": "vitest run",
20
+ "build": "tsc"
21
+ },
22
+ "dependencies": {
23
+ "sql.js": "^1.10.3"
24
+ },
25
+ "devDependencies": {
26
+ "@types/cors": "^2.8.17",
27
+ "@types/express": "^4.17.21",
28
+ "@types/helmet": "^4.0.0",
29
+ "@types/node": "^20.0.0",
30
+ "@types/sql.js": "^1.4.9",
31
+ "@types/ws": "^8.5.10",
32
+ "vitest": "^4.0.16",
33
+ "zod": "^3.22.4"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public",
37
+ "tag": "v3alpha"
38
+ }
39
+ }
@@ -0,0 +1,207 @@
1
+ /**
2
+ * V3 Default Configuration Values
3
+ */
4
+
5
+ import type {
6
+ AgentConfig,
7
+ TaskConfig,
8
+ SwarmConfig,
9
+ MemoryConfig,
10
+ MCPServerConfig,
11
+ OrchestratorConfig,
12
+ SystemConfig,
13
+ } from './schema.js';
14
+
15
+ /**
16
+ * Default agent configuration
17
+ */
18
+ export const defaultAgentConfig: Partial<AgentConfig> = {
19
+ capabilities: [],
20
+ maxConcurrentTasks: 5,
21
+ priority: 50,
22
+ retryPolicy: {
23
+ maxRetries: 3,
24
+ backoffMs: 1000,
25
+ backoffMultiplier: 2,
26
+ },
27
+ };
28
+
29
+ /**
30
+ * Default task configuration
31
+ */
32
+ export const defaultTaskConfig: Partial<TaskConfig> = {
33
+ priority: 50,
34
+ metadata: {
35
+ maxRetries: 3,
36
+ },
37
+ };
38
+
39
+ /**
40
+ * Default swarm configuration (core version)
41
+ */
42
+ export const defaultSwarmConfigCore: SwarmConfig = {
43
+ topology: 'hierarchical-mesh',
44
+ maxAgents: 20,
45
+ autoScale: {
46
+ enabled: false,
47
+ minAgents: 1,
48
+ maxAgents: 20,
49
+ scaleUpThreshold: 0.8,
50
+ scaleDownThreshold: 0.3,
51
+ },
52
+ coordination: {
53
+ consensusRequired: false,
54
+ timeoutMs: 10000,
55
+ retryPolicy: {
56
+ maxRetries: 3,
57
+ backoffMs: 500,
58
+ },
59
+ },
60
+ communication: {
61
+ protocol: 'events',
62
+ batchSize: 10,
63
+ flushIntervalMs: 100,
64
+ },
65
+ };
66
+
67
+ /**
68
+ * Default memory configuration (hybrid backend - ADR-009)
69
+ */
70
+ export const defaultMemoryConfig: MemoryConfig = {
71
+ type: 'hybrid',
72
+ path: './data/memory',
73
+ sqlite: {
74
+ inMemory: false,
75
+ wal: true,
76
+ },
77
+ @sparkleideas/agentdb: {
78
+ dimensions: 1536,
79
+ indexType: 'hnsw',
80
+ efConstruction: 200,
81
+ m: 16,
82
+ quantization: 'none',
83
+ },
84
+ hybrid: {
85
+ vectorThreshold: 100,
86
+ },
87
+ };
88
+
89
+ /**
90
+ * Default MCP server configuration
91
+ */
92
+ export const defaultMCPServerConfig: MCPServerConfig = {
93
+ name: '@sparkleideas/claude-flow',
94
+ version: '3.0.0',
95
+ transport: {
96
+ type: 'stdio',
97
+ },
98
+ capabilities: {
99
+ tools: true,
100
+ resources: true,
101
+ prompts: true,
102
+ logging: true,
103
+ },
104
+ };
105
+
106
+ /**
107
+ * Default orchestrator configuration
108
+ */
109
+ export const defaultOrchestratorConfig: OrchestratorConfig = {
110
+ session: {
111
+ persistSessions: true,
112
+ dataDir: './data',
113
+ sessionRetentionMs: 3600000, // 1 hour
114
+ },
115
+ health: {
116
+ checkInterval: 30000, // 30 seconds
117
+ historyLimit: 100,
118
+ degradedThreshold: 1,
119
+ unhealthyThreshold: 2,
120
+ },
121
+ lifecycle: {
122
+ maxConcurrentAgents: 20,
123
+ spawnTimeout: 30000, // 30 seconds
124
+ terminateTimeout: 10000, // 10 seconds
125
+ maxSpawnRetries: 3,
126
+ },
127
+ };
128
+
129
+ /**
130
+ * Default full system configuration
131
+ */
132
+ export const defaultSystemConfig: SystemConfig = {
133
+ orchestrator: defaultOrchestratorConfig,
134
+ memory: defaultMemoryConfig,
135
+ mcp: defaultMCPServerConfig,
136
+ swarm: defaultSwarmConfigCore,
137
+ };
138
+
139
+ /**
140
+ * Agent type presets
141
+ */
142
+ export const agentTypePresets: Record<string, Partial<AgentConfig>> = {
143
+ coder: {
144
+ type: 'coder',
145
+ capabilities: ['code', 'debug', 'refactor', 'test'],
146
+ maxConcurrentTasks: 3,
147
+ priority: 70,
148
+ },
149
+ reviewer: {
150
+ type: 'reviewer',
151
+ capabilities: ['review', 'analyze', 'suggest'],
152
+ maxConcurrentTasks: 5,
153
+ priority: 60,
154
+ },
155
+ tester: {
156
+ type: 'tester',
157
+ capabilities: ['test', 'validate', 'benchmark'],
158
+ maxConcurrentTasks: 4,
159
+ priority: 65,
160
+ },
161
+ researcher: {
162
+ type: 'researcher',
163
+ capabilities: ['research', 'analyze', 'summarize'],
164
+ maxConcurrentTasks: 3,
165
+ priority: 50,
166
+ },
167
+ planner: {
168
+ type: 'planner',
169
+ capabilities: ['plan', 'organize', 'decompose'],
170
+ maxConcurrentTasks: 2,
171
+ priority: 80,
172
+ },
173
+ architect: {
174
+ type: 'architect',
175
+ capabilities: ['design', 'architecture', 'patterns'],
176
+ maxConcurrentTasks: 2,
177
+ priority: 85,
178
+ },
179
+ coordinator: {
180
+ type: 'coordinator',
181
+ capabilities: ['coordinate', 'delegate', 'monitor'],
182
+ maxConcurrentTasks: 10,
183
+ priority: 90,
184
+ },
185
+ security: {
186
+ type: 'security',
187
+ capabilities: ['audit', 'scan', 'validate', 'secure'],
188
+ maxConcurrentTasks: 3,
189
+ priority: 95,
190
+ },
191
+ performance: {
192
+ type: 'performance',
193
+ capabilities: ['benchmark', 'optimize', 'profile'],
194
+ maxConcurrentTasks: 2,
195
+ priority: 70,
196
+ },
197
+ };
198
+
199
+ /**
200
+ * Get merged configuration with defaults
201
+ */
202
+ export function mergeWithDefaults<T extends Record<string, unknown>>(
203
+ config: Partial<T>,
204
+ defaults: T,
205
+ ): T {
206
+ return { ...defaults, ...config } as T;
207
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * V3 Configuration - Public API
3
+ */
4
+
5
+ // Schemas
6
+ export * from './schema.js';
7
+
8
+ // Validation
9
+ export * from './validator.js';
10
+
11
+ // Defaults
12
+ export * from './defaults.js';
13
+
14
+ // Loader
15
+ export * from './loader.js';