cognitive-modules-cli 2.2.0 → 2.2.5

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 (94) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +21 -0
  3. package/README.md +35 -29
  4. package/dist/cli.js +572 -28
  5. package/dist/commands/add.d.ts +33 -14
  6. package/dist/commands/add.js +222 -13
  7. package/dist/commands/compose.d.ts +31 -0
  8. package/dist/commands/compose.js +185 -0
  9. package/dist/commands/index.d.ts +5 -0
  10. package/dist/commands/index.js +5 -0
  11. package/dist/commands/init.js +23 -1
  12. package/dist/commands/migrate.d.ts +30 -0
  13. package/dist/commands/migrate.js +650 -0
  14. package/dist/commands/pipe.d.ts +1 -0
  15. package/dist/commands/pipe.js +31 -11
  16. package/dist/commands/remove.js +33 -2
  17. package/dist/commands/run.d.ts +1 -0
  18. package/dist/commands/run.js +37 -27
  19. package/dist/commands/search.d.ts +28 -0
  20. package/dist/commands/search.js +143 -0
  21. package/dist/commands/test.d.ts +65 -0
  22. package/dist/commands/test.js +454 -0
  23. package/dist/commands/update.d.ts +1 -0
  24. package/dist/commands/update.js +106 -14
  25. package/dist/commands/validate.d.ts +36 -0
  26. package/dist/commands/validate.js +97 -0
  27. package/dist/errors/index.d.ts +218 -0
  28. package/dist/errors/index.js +412 -0
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js +5 -1
  31. package/dist/mcp/server.js +84 -79
  32. package/dist/modules/composition.d.ts +251 -0
  33. package/dist/modules/composition.js +1330 -0
  34. package/dist/modules/index.d.ts +2 -0
  35. package/dist/modules/index.js +2 -0
  36. package/dist/modules/loader.d.ts +22 -2
  37. package/dist/modules/loader.js +171 -6
  38. package/dist/modules/runner.d.ts +422 -1
  39. package/dist/modules/runner.js +1472 -71
  40. package/dist/modules/subagent.d.ts +6 -1
  41. package/dist/modules/subagent.js +20 -13
  42. package/dist/modules/validator.d.ts +28 -0
  43. package/dist/modules/validator.js +637 -0
  44. package/dist/providers/anthropic.d.ts +15 -0
  45. package/dist/providers/anthropic.js +147 -5
  46. package/dist/providers/base.d.ts +11 -0
  47. package/dist/providers/base.js +18 -0
  48. package/dist/providers/gemini.d.ts +15 -0
  49. package/dist/providers/gemini.js +122 -5
  50. package/dist/providers/ollama.d.ts +15 -0
  51. package/dist/providers/ollama.js +111 -3
  52. package/dist/providers/openai.d.ts +11 -0
  53. package/dist/providers/openai.js +133 -0
  54. package/dist/registry/client.d.ts +204 -0
  55. package/dist/registry/client.js +356 -0
  56. package/dist/registry/index.d.ts +4 -0
  57. package/dist/registry/index.js +4 -0
  58. package/dist/server/http.js +173 -42
  59. package/dist/types.d.ts +123 -8
  60. package/dist/types.js +4 -1
  61. package/dist/version.d.ts +1 -0
  62. package/dist/version.js +4 -0
  63. package/package.json +32 -7
  64. package/src/cli.ts +0 -410
  65. package/src/commands/add.ts +0 -315
  66. package/src/commands/index.ts +0 -12
  67. package/src/commands/init.ts +0 -94
  68. package/src/commands/list.ts +0 -33
  69. package/src/commands/pipe.ts +0 -76
  70. package/src/commands/remove.ts +0 -57
  71. package/src/commands/run.ts +0 -80
  72. package/src/commands/update.ts +0 -130
  73. package/src/commands/versions.ts +0 -79
  74. package/src/index.ts +0 -55
  75. package/src/mcp/index.ts +0 -5
  76. package/src/mcp/server.ts +0 -403
  77. package/src/modules/index.ts +0 -7
  78. package/src/modules/loader.ts +0 -318
  79. package/src/modules/runner.ts +0 -495
  80. package/src/modules/subagent.ts +0 -275
  81. package/src/providers/anthropic.ts +0 -89
  82. package/src/providers/base.ts +0 -29
  83. package/src/providers/deepseek.ts +0 -83
  84. package/src/providers/gemini.ts +0 -117
  85. package/src/providers/index.ts +0 -78
  86. package/src/providers/minimax.ts +0 -81
  87. package/src/providers/moonshot.ts +0 -82
  88. package/src/providers/ollama.ts +0 -83
  89. package/src/providers/openai.ts +0 -84
  90. package/src/providers/qwen.ts +0 -82
  91. package/src/server/http.ts +0 -316
  92. package/src/server/index.ts +0 -6
  93. package/src/types.ts +0 -495
  94. package/tsconfig.json +0 -17
@@ -0,0 +1,412 @@
1
+ /**
2
+ * Cognitive Modules - Unified Error Handling
3
+ *
4
+ * Provides consistent error structures across HTTP, MCP, and CLI layers.
5
+ * Based on ERROR-CODES.md specification.
6
+ */
7
+ // =============================================================================
8
+ // Error Codes
9
+ // =============================================================================
10
+ /**
11
+ * Standard error codes per ERROR-CODES.md specification.
12
+ *
13
+ * Format: E{category}{sequence}
14
+ * - Category 1: Input errors
15
+ * - Category 2: Processing errors
16
+ * - Category 3: Output errors
17
+ * - Category 4: Runtime errors
18
+ * - Category 5-9: Module-specific (reserved)
19
+ */
20
+ export const ErrorCodes = {
21
+ // E1xxx: Input Errors
22
+ PARSE_ERROR: 'E1000',
23
+ INVALID_INPUT: 'E1001',
24
+ MISSING_REQUIRED_FIELD: 'E1002',
25
+ TYPE_MISMATCH: 'E1003',
26
+ UNSUPPORTED_VALUE: 'E1004',
27
+ INPUT_TOO_LARGE: 'E1005',
28
+ INVALID_REFERENCE: 'E1006',
29
+ // E2xxx: Processing Errors
30
+ LOW_CONFIDENCE: 'E2001',
31
+ TIMEOUT: 'E2002',
32
+ TOKEN_LIMIT: 'E2003',
33
+ NO_ACTION_POSSIBLE: 'E2004',
34
+ SEMANTIC_CONFLICT: 'E2005',
35
+ AMBIGUOUS_INPUT: 'E2006',
36
+ INSUFFICIENT_CONTEXT: 'E2007',
37
+ // E3xxx: Output Errors
38
+ OUTPUT_SCHEMA_VIOLATION: 'E3001',
39
+ PARTIAL_RESULT: 'E3002',
40
+ MISSING_RATIONALE: 'E3003',
41
+ OVERFLOW_LIMIT: 'E3004',
42
+ INVALID_ENUM: 'E3005',
43
+ CONSTRAINT_VIOLATION: 'E3006',
44
+ // E4xxx: Runtime Errors
45
+ INTERNAL_ERROR: 'E4000',
46
+ PROVIDER_UNAVAILABLE: 'E4001',
47
+ RATE_LIMITED: 'E4002',
48
+ CONTEXT_OVERFLOW: 'E4003',
49
+ CIRCULAR_DEPENDENCY: 'E4004',
50
+ MAX_DEPTH_EXCEEDED: 'E4005',
51
+ MODULE_NOT_FOUND: 'E4006',
52
+ PERMISSION_DENIED: 'E4007',
53
+ ENDPOINT_NOT_FOUND: 'E4008',
54
+ RESOURCE_NOT_FOUND: 'E4009',
55
+ };
56
+ // =============================================================================
57
+ // Legacy Code Mapping
58
+ // =============================================================================
59
+ const LEGACY_CODE_MAP = {
60
+ // Input errors
61
+ 'PARSE_ERROR': ErrorCodes.PARSE_ERROR,
62
+ 'INVALID_INPUT': ErrorCodes.INVALID_INPUT,
63
+ 'MISSING_REQUIRED_FIELD': ErrorCodes.MISSING_REQUIRED_FIELD,
64
+ 'TYPE_MISMATCH': ErrorCodes.TYPE_MISMATCH,
65
+ 'UNSUPPORTED_VALUE': ErrorCodes.UNSUPPORTED_VALUE,
66
+ 'UNSUPPORTED_LANGUAGE': ErrorCodes.UNSUPPORTED_VALUE,
67
+ 'INPUT_TOO_LARGE': ErrorCodes.INPUT_TOO_LARGE,
68
+ 'INVALID_REFERENCE': ErrorCodes.INVALID_REFERENCE,
69
+ // Processing errors
70
+ 'LOW_CONFIDENCE': ErrorCodes.LOW_CONFIDENCE,
71
+ 'TIMEOUT': ErrorCodes.TIMEOUT,
72
+ 'TOKEN_LIMIT': ErrorCodes.TOKEN_LIMIT,
73
+ 'NO_ACTION_POSSIBLE': ErrorCodes.NO_ACTION_POSSIBLE,
74
+ 'NO_SIMPLIFICATION_POSSIBLE': ErrorCodes.NO_ACTION_POSSIBLE,
75
+ 'SEMANTIC_CONFLICT': ErrorCodes.SEMANTIC_CONFLICT,
76
+ 'BEHAVIOR_CHANGE_REQUIRED': ErrorCodes.SEMANTIC_CONFLICT,
77
+ 'AMBIGUOUS_INPUT': ErrorCodes.AMBIGUOUS_INPUT,
78
+ 'INSUFFICIENT_CONTEXT': ErrorCodes.INSUFFICIENT_CONTEXT,
79
+ // Output errors
80
+ 'SCHEMA_VALIDATION_FAILED': ErrorCodes.OUTPUT_SCHEMA_VIOLATION,
81
+ 'OUTPUT_SCHEMA_VIOLATION': ErrorCodes.OUTPUT_SCHEMA_VIOLATION,
82
+ 'PARTIAL_RESULT': ErrorCodes.PARTIAL_RESULT,
83
+ // Runtime errors
84
+ 'INTERNAL_ERROR': ErrorCodes.INTERNAL_ERROR,
85
+ 'PROVIDER_UNAVAILABLE': ErrorCodes.PROVIDER_UNAVAILABLE,
86
+ 'RATE_LIMITED': ErrorCodes.RATE_LIMITED,
87
+ 'MODULE_NOT_FOUND': ErrorCodes.MODULE_NOT_FOUND,
88
+ 'PERMISSION_DENIED': ErrorCodes.PERMISSION_DENIED,
89
+ 'ENDPOINT_NOT_FOUND': ErrorCodes.ENDPOINT_NOT_FOUND,
90
+ 'RESOURCE_NOT_FOUND': ErrorCodes.RESOURCE_NOT_FOUND,
91
+ 'NOT_FOUND': ErrorCodes.RESOURCE_NOT_FOUND,
92
+ };
93
+ /**
94
+ * Normalize error code to E-format.
95
+ * Accepts both legacy string codes and E-format codes.
96
+ */
97
+ export function normalizeErrorCode(code) {
98
+ // Already E-format
99
+ if (/^E\d{4}$/.test(code)) {
100
+ return code;
101
+ }
102
+ // Legacy format
103
+ return LEGACY_CODE_MAP[code] || ErrorCodes.INTERNAL_ERROR;
104
+ }
105
+ // =============================================================================
106
+ // Error Envelope Factory
107
+ // =============================================================================
108
+ /**
109
+ * Default recoverability by error category.
110
+ */
111
+ function getDefaultRecoverable(code) {
112
+ const category = code.charAt(1);
113
+ switch (category) {
114
+ case '1': return true; // Input errors are usually recoverable
115
+ case '2': return true; // Processing errors may be recoverable
116
+ case '3': return false; // Output errors are not recoverable
117
+ case '4': {
118
+ // Runtime errors: some are recoverable
119
+ const recoverable4xxx = [
120
+ ErrorCodes.PROVIDER_UNAVAILABLE,
121
+ ErrorCodes.RATE_LIMITED,
122
+ ErrorCodes.MODULE_NOT_FOUND,
123
+ ];
124
+ return recoverable4xxx.includes(code);
125
+ }
126
+ default: return false;
127
+ }
128
+ }
129
+ /**
130
+ * Create a standardized error envelope.
131
+ *
132
+ * @example
133
+ * // Simple error
134
+ * makeErrorEnvelope({
135
+ * code: ErrorCodes.MODULE_NOT_FOUND,
136
+ * message: "Module 'code-reviewer' not found",
137
+ * suggestion: "Use 'cog list' to see available modules"
138
+ * });
139
+ *
140
+ * @example
141
+ * // Error with retry info
142
+ * makeErrorEnvelope({
143
+ * code: ErrorCodes.RATE_LIMITED,
144
+ * message: "Rate limit exceeded",
145
+ * retry_after_ms: 60000
146
+ * });
147
+ */
148
+ export function makeErrorEnvelope(options) {
149
+ const code = normalizeErrorCode(options.code);
150
+ const recoverable = options.recoverable ?? getDefaultRecoverable(code);
151
+ const error = {
152
+ code,
153
+ message: options.message,
154
+ recoverable,
155
+ };
156
+ if (options.suggestion) {
157
+ error.suggestion = options.suggestion;
158
+ }
159
+ if (options.retry_after_ms !== undefined) {
160
+ error.retry_after_ms = options.retry_after_ms;
161
+ }
162
+ if (options.details) {
163
+ error.details = options.details;
164
+ }
165
+ return {
166
+ ok: false,
167
+ version: options.version || '2.2',
168
+ meta: {
169
+ confidence: options.confidence ?? 0.0,
170
+ risk: options.risk ?? 'high',
171
+ explain: (options.explain || options.message).slice(0, 280),
172
+ trace_id: options.trace_id,
173
+ },
174
+ error,
175
+ partial_data: options.partial_data,
176
+ };
177
+ }
178
+ // =============================================================================
179
+ // Layer-Specific Helpers
180
+ // =============================================================================
181
+ export function attachContext(envelope, context) {
182
+ if (!context)
183
+ return envelope;
184
+ const { module, provider } = context;
185
+ if (!module && !provider)
186
+ return envelope;
187
+ return {
188
+ ...envelope,
189
+ ...(module ? { module } : {}),
190
+ ...(provider ? { provider } : {}),
191
+ };
192
+ }
193
+ /**
194
+ * Create error envelope for HTTP API responses.
195
+ *
196
+ * @returns Tuple of [statusCode, body]
197
+ */
198
+ export function makeHttpError(options) {
199
+ const envelope = attachContext(makeErrorEnvelope(options), options);
200
+ const code = normalizeErrorCode(options.code);
201
+ // Determine HTTP status code
202
+ let statusCode;
203
+ const category = code.charAt(1);
204
+ switch (category) {
205
+ case '1': {
206
+ // Input errors -> Bad Request (with specific overrides)
207
+ if (code === ErrorCodes.INPUT_TOO_LARGE) {
208
+ statusCode = 413; // Payload Too Large
209
+ }
210
+ else {
211
+ statusCode = 400;
212
+ }
213
+ break;
214
+ }
215
+ case '2':
216
+ statusCode = 422;
217
+ break; // Processing errors -> Unprocessable Entity
218
+ case '3':
219
+ statusCode = 500;
220
+ break; // Output errors -> Internal Server Error
221
+ case '4': {
222
+ // Runtime errors - map to appropriate HTTP status
223
+ if (code === ErrorCodes.MODULE_NOT_FOUND ||
224
+ code === ErrorCodes.ENDPOINT_NOT_FOUND ||
225
+ code === ErrorCodes.RESOURCE_NOT_FOUND) {
226
+ statusCode = 404; // Not Found
227
+ }
228
+ else if (code === ErrorCodes.PERMISSION_DENIED) {
229
+ statusCode = 403; // Forbidden
230
+ }
231
+ else if (code === ErrorCodes.RATE_LIMITED) {
232
+ statusCode = 429; // Too Many Requests
233
+ }
234
+ else {
235
+ statusCode = 500; // Internal Server Error
236
+ }
237
+ break;
238
+ }
239
+ default: statusCode = 500;
240
+ }
241
+ // Add HTTP-specific fields
242
+ return [statusCode, envelope];
243
+ }
244
+ /**
245
+ * Create error envelope for MCP tool responses.
246
+ */
247
+ export function makeMcpError(options) {
248
+ const envelope = attachContext(makeErrorEnvelope(options), {
249
+ module: options.module ?? 'unknown',
250
+ provider: options.provider ?? 'unknown',
251
+ });
252
+ return {
253
+ content: [
254
+ {
255
+ type: 'text',
256
+ text: JSON.stringify(envelope, null, 2),
257
+ },
258
+ ],
259
+ };
260
+ }
261
+ /**
262
+ * Convert error envelope to CLI-friendly error message.
263
+ */
264
+ export function toCliError(envelope) {
265
+ const { error } = envelope;
266
+ let message = `Error [${error.code}]: ${error.message}`;
267
+ if (error.suggestion) {
268
+ message += `\n Suggestion: ${error.suggestion}`;
269
+ }
270
+ if (error.retry_after_ms) {
271
+ const seconds = Math.ceil(error.retry_after_ms / 1000);
272
+ message += `\n Retry after: ${seconds}s`;
273
+ }
274
+ return message;
275
+ }
276
+ /**
277
+ * Convert CLI CommandResult-style error to standard envelope.
278
+ * Used for backward compatibility during migration.
279
+ */
280
+ export function fromCliError(errorMessage, code = ErrorCodes.INTERNAL_ERROR) {
281
+ return makeErrorEnvelope({
282
+ code,
283
+ message: errorMessage,
284
+ });
285
+ }
286
+ // =============================================================================
287
+ // Error Type Guards
288
+ // =============================================================================
289
+ /**
290
+ * Check if an error envelope indicates a recoverable error.
291
+ */
292
+ export function isRecoverable(envelope) {
293
+ return envelope.error.recoverable === true;
294
+ }
295
+ /**
296
+ * Check if an error envelope has partial data.
297
+ */
298
+ export function hasPartialData(envelope) {
299
+ return envelope.partial_data !== undefined;
300
+ }
301
+ /**
302
+ * Check if an error envelope suggests retrying.
303
+ */
304
+ export function shouldRetry(envelope) {
305
+ const retryableCodes = [
306
+ ErrorCodes.RATE_LIMITED,
307
+ ErrorCodes.PROVIDER_UNAVAILABLE,
308
+ ErrorCodes.TIMEOUT,
309
+ ];
310
+ return (envelope.error.recoverable === true &&
311
+ (envelope.error.retry_after_ms !== undefined ||
312
+ retryableCodes.includes(envelope.error.code)));
313
+ }
314
+ /**
315
+ * Create a standardized success envelope.
316
+ * Use this for consistent success responses across HTTP and MCP layers.
317
+ */
318
+ export function makeSuccessEnvelope(options) {
319
+ return {
320
+ ok: true,
321
+ version: options.version || '2.2',
322
+ meta: {
323
+ confidence: options.confidence ?? 1.0,
324
+ risk: options.risk ?? 'none',
325
+ explain: (options.explain || 'Operation completed successfully').slice(0, 280),
326
+ trace_id: options.trace_id,
327
+ },
328
+ data: options.data,
329
+ };
330
+ }
331
+ /**
332
+ * Create success envelope for MCP tool responses.
333
+ */
334
+ export function makeMcpSuccess(options) {
335
+ const envelope = makeSuccessEnvelope(options);
336
+ return {
337
+ content: [
338
+ {
339
+ type: 'text',
340
+ text: JSON.stringify(envelope, null, 2),
341
+ },
342
+ ],
343
+ };
344
+ }
345
+ // =============================================================================
346
+ // Common Error Factories
347
+ // =============================================================================
348
+ /**
349
+ * Create MODULE_NOT_FOUND error.
350
+ */
351
+ export function moduleNotFoundError(moduleName, options) {
352
+ return makeErrorEnvelope({
353
+ code: ErrorCodes.MODULE_NOT_FOUND,
354
+ message: `Module '${moduleName}' not found`,
355
+ suggestion: options?.suggestion || "Use 'cog list' to see available modules, or 'cog search' to find modules in registry",
356
+ trace_id: options?.trace_id,
357
+ });
358
+ }
359
+ /**
360
+ * Create PARSE_ERROR error.
361
+ */
362
+ export function parseError(details, options) {
363
+ return makeErrorEnvelope({
364
+ code: ErrorCodes.PARSE_ERROR,
365
+ message: details ? `JSON parsing failed: ${details}` : 'Invalid JSON body',
366
+ recoverable: false,
367
+ trace_id: options?.trace_id,
368
+ });
369
+ }
370
+ /**
371
+ * Create RATE_LIMITED error.
372
+ */
373
+ export function rateLimitedError(retryAfterMs, provider) {
374
+ return makeErrorEnvelope({
375
+ code: ErrorCodes.RATE_LIMITED,
376
+ message: `Rate limit exceeded${provider ? ` for provider '${provider}'` : ''}`,
377
+ retry_after_ms: retryAfterMs,
378
+ suggestion: `Wait ${Math.ceil(retryAfterMs / 1000)} seconds before retrying`,
379
+ });
380
+ }
381
+ /**
382
+ * Create INTERNAL_ERROR error.
383
+ */
384
+ export function internalError(message, options) {
385
+ return makeErrorEnvelope({
386
+ code: ErrorCodes.INTERNAL_ERROR,
387
+ message,
388
+ recoverable: false,
389
+ details: options?.details,
390
+ trace_id: options?.trace_id,
391
+ });
392
+ }
393
+ /**
394
+ * Create MISSING_REQUIRED_FIELD error.
395
+ */
396
+ export function missingFieldError(fieldName, options) {
397
+ return makeErrorEnvelope({
398
+ code: ErrorCodes.MISSING_REQUIRED_FIELD,
399
+ message: `Missing required field: ${fieldName}`,
400
+ suggestion: options?.suggestion || `Provide the '${fieldName}' field in your request`,
401
+ });
402
+ }
403
+ /**
404
+ * Create PERMISSION_DENIED error.
405
+ */
406
+ export function permissionDeniedError(reason) {
407
+ return makeErrorEnvelope({
408
+ code: ErrorCodes.PERMISSION_DENIED,
409
+ message: reason,
410
+ recoverable: false,
411
+ });
412
+ }
package/dist/index.d.ts CHANGED
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * Exports all public APIs for programmatic use.
5
5
  */
6
- export type { Provider, InvokeParams, InvokeResult, Message, CognitiveModule, ModuleResult, ModuleInput, ModuleConstraints, ToolsPolicy, OutputContract, FailureContract, CommandContext, CommandResult, } from './types.js';
6
+ export type { Provider, InvokeParams, InvokeResult, Message, CognitiveModule, ModuleResult, ModuleInput, ModuleConstraints, ToolsPolicy, OutputContract, FailureContract, CommandContext, CommandResult, CompositionConfig, CompositionPattern, DependencyDeclaration, DataflowStep, DataflowMapping, RoutingRule, AggregationStrategy, IterationConfig, } from './types.js';
7
7
  export { getProvider, listProviders, GeminiProvider, OpenAIProvider, AnthropicProvider, BaseProvider, } from './providers/index.js';
8
- export { loadModule, findModule, listModules, getDefaultSearchPaths, runModule, SubagentOrchestrator, runWithSubagents, parseCalls, createContext, } from './modules/index.js';
8
+ export { loadModule, findModule, listModules, getDefaultSearchPaths, runModule, SubagentOrchestrator, runWithSubagents, parseCalls, createContext, CompositionOrchestrator, executeComposition, validateCompositionConfig, evaluateJsonPath, evaluateCondition, applyMapping, aggregateResults, versionMatches, resolveDependency, COMPOSITION_ERRORS, checkToolPolicy, checkPolicy, checkToolAllowed, validateToolsAllowed, getDeniedActions, getDeniedTools, getAllowedTools, ToolCallInterceptor, createPolicyAwareExecutor, type PolicyAction, type PolicyCheckResult, type ToolCallRequest, type ToolCallResult, type ToolExecutor, } from './modules/index.js';
9
9
  export { serve as serveHttp, createServer } from './server/index.js';
10
10
  export { serve as serveMcp } from './mcp/index.js';
11
11
  export { run, list, pipe } from './commands/index.js';
package/dist/index.js CHANGED
@@ -8,7 +8,11 @@ export { getProvider, listProviders, GeminiProvider, OpenAIProvider, AnthropicPr
8
8
  // Modules
9
9
  export { loadModule, findModule, listModules, getDefaultSearchPaths, runModule,
10
10
  // Subagent
11
- SubagentOrchestrator, runWithSubagents, parseCalls, createContext, } from './modules/index.js';
11
+ SubagentOrchestrator, runWithSubagents, parseCalls, createContext,
12
+ // Composition
13
+ CompositionOrchestrator, executeComposition, validateCompositionConfig, evaluateJsonPath, evaluateCondition, applyMapping, aggregateResults, versionMatches, resolveDependency, COMPOSITION_ERRORS,
14
+ // Policy Enforcement
15
+ checkToolPolicy, checkPolicy, checkToolAllowed, validateToolsAllowed, getDeniedActions, getDeniedTools, getAllowedTools, ToolCallInterceptor, createPolicyAwareExecutor, } from './modules/index.js';
12
16
  // Server
13
17
  export { serve as serveHttp, createServer } from './server/index.js';
14
18
  // MCP