@lushly-dev/afd-server 0.4.0 → 0.5.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 (55) hide show
  1. package/README.md +110 -0
  2. package/dist/bootstrap/afd-context.d.ts +60 -0
  3. package/dist/bootstrap/afd-context.d.ts.map +1 -0
  4. package/dist/bootstrap/afd-context.js +132 -0
  5. package/dist/bootstrap/afd-context.js.map +1 -0
  6. package/dist/bootstrap/afd-help.d.ts +2 -1
  7. package/dist/bootstrap/afd-help.d.ts.map +1 -1
  8. package/dist/bootstrap/afd-help.js +4 -1
  9. package/dist/bootstrap/afd-help.js.map +1 -1
  10. package/dist/bootstrap/index.d.ts +1 -0
  11. package/dist/bootstrap/index.d.ts.map +1 -1
  12. package/dist/bootstrap/index.js +1 -0
  13. package/dist/bootstrap/index.js.map +1 -1
  14. package/dist/bootstrap/registry.d.ts +4 -0
  15. package/dist/bootstrap/registry.d.ts.map +1 -1
  16. package/dist/bootstrap/registry.js +8 -1
  17. package/dist/bootstrap/registry.js.map +1 -1
  18. package/dist/execution.d.ts +19 -0
  19. package/dist/execution.d.ts.map +1 -0
  20. package/dist/execution.js +389 -0
  21. package/dist/execution.js.map +1 -0
  22. package/dist/handoff-schema.d.ts +14 -14
  23. package/dist/http-handler.d.ts +28 -0
  24. package/dist/http-handler.d.ts.map +1 -0
  25. package/dist/http-handler.js +292 -0
  26. package/dist/http-handler.js.map +1 -0
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/lazy-tools.d.ts +64 -0
  32. package/dist/lazy-tools.d.ts.map +1 -0
  33. package/dist/lazy-tools.js +144 -0
  34. package/dist/lazy-tools.js.map +1 -0
  35. package/dist/schema.d.ts +25 -1
  36. package/dist/schema.d.ts.map +1 -1
  37. package/dist/schema.js +20 -1
  38. package/dist/schema.js.map +1 -1
  39. package/dist/server-types.d.ts +138 -0
  40. package/dist/server-types.d.ts.map +1 -0
  41. package/dist/server-types.js +13 -0
  42. package/dist/server-types.js.map +1 -0
  43. package/dist/server.d.ts +6 -121
  44. package/dist/server.d.ts.map +1 -1
  45. package/dist/server.js +67 -1125
  46. package/dist/server.js.map +1 -1
  47. package/dist/tool-router.d.ts +36 -0
  48. package/dist/tool-router.d.ts.map +1 -0
  49. package/dist/tool-router.js +246 -0
  50. package/dist/tool-router.js.map +1 -0
  51. package/dist/tools.d.ts +428 -0
  52. package/dist/tools.d.ts.map +1 -0
  53. package/dist/tools.js +244 -0
  54. package/dist/tools.js.map +1 -0
  55. package/package.json +3 -3
@@ -0,0 +1,389 @@
1
+ /**
2
+ * @fileoverview Command execution engine — single, batch, pipeline, and streaming execution.
3
+ */
4
+ import { aggregatePipelineAlternatives, aggregatePipelineConfidence, aggregatePipelineReasoning, aggregatePipelineSources, aggregatePipelineWarnings, buildConfidenceBreakdown, createBatchResult, createCompleteChunk, createErrorChunk, createFailedBatchResult, evaluateCondition, failure, resolveVariables, } from '@lushly-dev/afd-core';
5
+ import { formatEnhancedValidationError, validateInputEnhanced } from './validation.js';
6
+ // ═══════════════════════════════════════════════════════════════════════════════
7
+ // EXECUTION ENGINE FACTORY
8
+ // ═══════════════════════════════════════════════════════════════════════════════
9
+ export function createExecutionEngine(deps) {
10
+ const { commandMap, middleware, devMode, onCommand, onError } = deps;
11
+ /**
12
+ * Execute a command with validation and middleware.
13
+ */
14
+ async function executeCommand(commandName, input, context = {}) {
15
+ const command = commandMap.get(commandName);
16
+ if (!command) {
17
+ return failure({
18
+ code: 'COMMAND_NOT_FOUND',
19
+ message: `Command '${commandName}' not found`,
20
+ suggestion: `Available commands: ${Array.from(commandMap.keys()).join(', ')}`,
21
+ });
22
+ }
23
+ // Validate input with enhanced error messages
24
+ const validation = validateInputEnhanced(command.inputSchema, input);
25
+ if (!validation.success) {
26
+ return failure({
27
+ code: 'VALIDATION_ERROR',
28
+ message: 'Input validation failed',
29
+ suggestion: formatEnhancedValidationError(validation.errors, {
30
+ expectedFields: validation.expectedFields,
31
+ unexpectedFields: validation.unexpectedFields,
32
+ missingFields: validation.missingFields,
33
+ }),
34
+ details: {
35
+ errors: validation.errors,
36
+ expectedFields: validation.expectedFields,
37
+ unexpectedFields: validation.unexpectedFields,
38
+ missingFields: validation.missingFields,
39
+ },
40
+ });
41
+ }
42
+ // Build middleware chain
43
+ const runHandler = async () => {
44
+ const startTime = Date.now();
45
+ const result = await command.handler(validation.data, context);
46
+ // Add metadata if not present
47
+ if (!result.metadata) {
48
+ result.metadata = {};
49
+ }
50
+ result.metadata.executionTimeMs = Date.now() - startTime;
51
+ result.metadata.commandVersion = command.version;
52
+ if (context.traceId) {
53
+ result.metadata.traceId = context.traceId;
54
+ }
55
+ return result;
56
+ };
57
+ // Apply middleware in reverse order
58
+ let next = runHandler;
59
+ for (let i = middleware.length - 1; i >= 0; i--) {
60
+ const mw = middleware[i];
61
+ if (!mw)
62
+ continue;
63
+ const currentNext = next;
64
+ next = () => mw(commandName, validation.data, context, currentNext);
65
+ }
66
+ try {
67
+ const result = await next();
68
+ onCommand?.(commandName, input, result);
69
+ return result;
70
+ }
71
+ catch (error) {
72
+ const err = error instanceof Error ? error : new Error(String(error));
73
+ onError?.(err);
74
+ return failure({
75
+ code: 'COMMAND_EXECUTION_ERROR',
76
+ message: devMode ? err.message : 'An internal error occurred',
77
+ suggestion: devMode
78
+ ? 'Check the command implementation'
79
+ : 'Contact support if this persists',
80
+ // Only include stack traces in dev mode to prevent information leakage
81
+ ...(devMode ? { details: { stack: err.stack } } : {}),
82
+ });
83
+ }
84
+ }
85
+ /**
86
+ * Execute multiple commands in a batch with partial success semantics.
87
+ */
88
+ async function executeBatch(request, context = {}) {
89
+ const startedAt = new Date().toISOString();
90
+ const startTime = performance.now();
91
+ // Validate request
92
+ if (!request.commands || request.commands.length === 0) {
93
+ return createFailedBatchResult({
94
+ code: 'INVALID_BATCH_REQUEST',
95
+ message: 'Batch request must contain at least one command',
96
+ suggestion: 'Provide an array of commands to execute',
97
+ }, { startedAt });
98
+ }
99
+ const options = request.options ?? {};
100
+ const results = [];
101
+ let stopped = false;
102
+ // Execute commands sequentially
103
+ for (let i = 0; i < request.commands.length; i++) {
104
+ const cmd = request.commands[i];
105
+ if (!cmd)
106
+ continue;
107
+ if (stopped) {
108
+ results.push({
109
+ id: cmd.id ?? `cmd-${i}`,
110
+ index: i,
111
+ command: cmd.command,
112
+ result: {
113
+ success: false,
114
+ error: {
115
+ code: 'COMMAND_SKIPPED',
116
+ message: 'Command skipped due to previous error (stopOnError enabled)',
117
+ },
118
+ },
119
+ durationMs: 0,
120
+ });
121
+ continue;
122
+ }
123
+ const cmdStartTime = performance.now();
124
+ const result = await executeCommand(cmd.command, cmd.input, {
125
+ ...context,
126
+ traceId: context.traceId ?? `batch-${Date.now()}-${i}`,
127
+ });
128
+ const cmdDuration = performance.now() - cmdStartTime;
129
+ results.push({
130
+ id: cmd.id ?? `cmd-${i}`,
131
+ index: i,
132
+ command: cmd.command,
133
+ result,
134
+ durationMs: Math.round(cmdDuration * 100) / 100,
135
+ });
136
+ if (!result.success && options.stopOnError) {
137
+ stopped = true;
138
+ }
139
+ // Check timeout
140
+ if (options.timeout && performance.now() - startTime > options.timeout) {
141
+ for (let j = i + 1; j < request.commands.length; j++) {
142
+ const remainingCmd = request.commands[j];
143
+ if (!remainingCmd)
144
+ continue;
145
+ results.push({
146
+ id: remainingCmd.id ?? `cmd-${j}`,
147
+ index: j,
148
+ command: remainingCmd.command,
149
+ result: {
150
+ success: false,
151
+ error: {
152
+ code: 'BATCH_TIMEOUT',
153
+ message: `Batch timeout exceeded (${options.timeout}ms)`,
154
+ retryable: true,
155
+ },
156
+ },
157
+ durationMs: 0,
158
+ });
159
+ }
160
+ break;
161
+ }
162
+ }
163
+ const completedAt = new Date().toISOString();
164
+ const totalMs = performance.now() - startTime;
165
+ const timing = {
166
+ totalMs: Math.round(totalMs * 100) / 100,
167
+ averageMs: results.length > 0 ? Math.round((totalMs / results.length) * 100) / 100 : 0,
168
+ startedAt,
169
+ completedAt,
170
+ };
171
+ return createBatchResult(results, timing, {
172
+ traceId: context.traceId ?? `batch-${Date.now()}`,
173
+ });
174
+ }
175
+ /**
176
+ * Execute a pipeline of chained commands with variable resolution.
177
+ */
178
+ async function executePipeline(request, context = {}) {
179
+ const startTime = performance.now();
180
+ const pipelineId = request.id ?? `pipeline-${Date.now()}-${Math.random().toString(36).slice(2)}`;
181
+ // Validate request
182
+ if (!request.steps || request.steps.length === 0) {
183
+ return {
184
+ data: undefined,
185
+ metadata: {
186
+ confidence: 0,
187
+ confidenceBreakdown: [],
188
+ reasoning: [],
189
+ warnings: [],
190
+ sources: [],
191
+ alternatives: [],
192
+ executionTimeMs: 0,
193
+ completedSteps: 0,
194
+ totalSteps: 0,
195
+ },
196
+ steps: [],
197
+ };
198
+ }
199
+ const pipelineContext = {
200
+ pipelineInput: context,
201
+ previousResult: undefined,
202
+ steps: [],
203
+ };
204
+ const stepResults = [];
205
+ const options = request.options ?? {};
206
+ let stopped = false;
207
+ for (let i = 0; i < request.steps.length; i++) {
208
+ const step = request.steps[i];
209
+ if (!step)
210
+ continue;
211
+ const stepStartTime = performance.now();
212
+ // Check if pipeline was stopped by a previous failure
213
+ if (stopped) {
214
+ stepResults.push({
215
+ index: i,
216
+ alias: step.as,
217
+ command: step.command,
218
+ status: 'skipped',
219
+ executionTimeMs: 0,
220
+ });
221
+ continue;
222
+ }
223
+ // Evaluate when condition if present
224
+ if (step.when && !evaluateCondition(step.when, pipelineContext)) {
225
+ stepResults.push({
226
+ index: i,
227
+ alias: step.as,
228
+ command: step.command,
229
+ status: 'skipped',
230
+ executionTimeMs: 0,
231
+ });
232
+ continue;
233
+ }
234
+ // Resolve variables in step input
235
+ const resolvedInput = step.input ? resolveVariables(step.input, pipelineContext) : {};
236
+ // Execute the command
237
+ const result = await executeCommand(step.command, resolvedInput, {
238
+ ...context,
239
+ traceId: context.traceId ?? `${pipelineId}-step-${i}`,
240
+ });
241
+ const stepExecutionTimeMs = performance.now() - stepStartTime;
242
+ if (result.success) {
243
+ const stepResult = {
244
+ index: i,
245
+ alias: step.as,
246
+ command: step.command,
247
+ status: 'success',
248
+ data: result.data,
249
+ executionTimeMs: Math.round(stepExecutionTimeMs * 100) / 100,
250
+ metadata: {
251
+ confidence: result.confidence,
252
+ reasoning: result.reasoning,
253
+ warnings: result.warnings,
254
+ sources: result.sources,
255
+ alternatives: result.alternatives,
256
+ },
257
+ };
258
+ stepResults.push(stepResult);
259
+ pipelineContext.steps.push(stepResult);
260
+ pipelineContext.previousResult = stepResult;
261
+ }
262
+ else {
263
+ const stepResult = {
264
+ index: i,
265
+ alias: step.as,
266
+ command: step.command,
267
+ status: 'failure',
268
+ error: result.error,
269
+ executionTimeMs: Math.round(stepExecutionTimeMs * 100) / 100,
270
+ };
271
+ stepResults.push(stepResult);
272
+ if (!options.continueOnFailure) {
273
+ stopped = true;
274
+ // Mark remaining steps as skipped
275
+ for (let j = i + 1; j < request.steps.length; j++) {
276
+ const remainingStep = request.steps[j];
277
+ if (!remainingStep)
278
+ continue;
279
+ stepResults.push({
280
+ index: j,
281
+ alias: remainingStep.as,
282
+ command: remainingStep.command,
283
+ status: 'skipped',
284
+ executionTimeMs: 0,
285
+ });
286
+ }
287
+ break;
288
+ }
289
+ }
290
+ // Check timeout
291
+ if (options.timeoutMs && performance.now() - startTime > options.timeoutMs) {
292
+ for (let j = i + 1; j < request.steps.length; j++) {
293
+ const remainingStep = request.steps[j];
294
+ if (!remainingStep)
295
+ continue;
296
+ stepResults.push({
297
+ index: j,
298
+ alias: remainingStep.as,
299
+ command: remainingStep.command,
300
+ status: 'skipped',
301
+ error: {
302
+ code: 'PIPELINE_TIMEOUT',
303
+ message: `Pipeline timeout exceeded (${options.timeoutMs}ms)`,
304
+ retryable: true,
305
+ },
306
+ executionTimeMs: 0,
307
+ });
308
+ }
309
+ break;
310
+ }
311
+ }
312
+ const totalExecutionTimeMs = performance.now() - startTime;
313
+ // Get the last successful step's data as the pipeline output
314
+ const lastSuccessfulStep = [...stepResults].reverse().find((s) => s.status === 'success');
315
+ const finalData = lastSuccessfulStep?.data;
316
+ // Build metadata using helper functions
317
+ const metadata = {
318
+ confidence: aggregatePipelineConfidence(stepResults),
319
+ confidenceBreakdown: buildConfidenceBreakdown(stepResults, request.steps),
320
+ reasoning: aggregatePipelineReasoning(stepResults),
321
+ warnings: aggregatePipelineWarnings(stepResults),
322
+ sources: aggregatePipelineSources(stepResults),
323
+ alternatives: aggregatePipelineAlternatives(stepResults),
324
+ executionTimeMs: Math.round(totalExecutionTimeMs * 100) / 100,
325
+ completedSteps: stepResults.filter((s) => s.status === 'success').length,
326
+ totalSteps: request.steps.length,
327
+ };
328
+ return {
329
+ data: finalData,
330
+ metadata,
331
+ steps: stepResults,
332
+ };
333
+ }
334
+ /**
335
+ * Execute a command as a stream, yielding chunks.
336
+ */
337
+ async function* executeStream(commandName, input, context = {}) {
338
+ const startTime = performance.now();
339
+ let chunksEmitted = 0;
340
+ try {
341
+ const result = await executeCommand(commandName, input, context);
342
+ if (!result.success) {
343
+ yield createErrorChunk(result.error ?? {
344
+ code: 'COMMAND_FAILED',
345
+ message: 'Command execution failed',
346
+ }, chunksEmitted, result.error?.retryable ?? false);
347
+ return;
348
+ }
349
+ const data = result.data;
350
+ // If result is an array, emit each item as a chunk
351
+ if (Array.isArray(data)) {
352
+ for (let i = 0; i < data.length; i++) {
353
+ yield {
354
+ type: 'data',
355
+ data: data[i],
356
+ index: i,
357
+ isLast: i === data.length - 1,
358
+ };
359
+ chunksEmitted++;
360
+ }
361
+ }
362
+ else {
363
+ yield {
364
+ type: 'data',
365
+ data: data,
366
+ index: 0,
367
+ isLast: true,
368
+ };
369
+ chunksEmitted++;
370
+ }
371
+ // Emit completion
372
+ const totalDurationMs = performance.now() - startTime;
373
+ yield createCompleteChunk(chunksEmitted, totalDurationMs, {
374
+ confidence: result.confidence,
375
+ reasoning: result.reasoning,
376
+ metadata: result.metadata,
377
+ });
378
+ }
379
+ catch (error) {
380
+ yield createErrorChunk({
381
+ code: 'STREAM_ERROR',
382
+ message: error instanceof Error ? error.message : String(error),
383
+ retryable: true,
384
+ }, chunksEmitted, true);
385
+ }
386
+ }
387
+ return { executeCommand, executeBatch, executePipeline, executeStream };
388
+ }
389
+ //# sourceMappingURL=execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.js","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAAA;;GAEG;AAoBH,OAAO,EACN,6BAA6B,EAC7B,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,OAAO,EACP,gBAAgB,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAcvF,kFAAkF;AAClF,2BAA2B;AAC3B,kFAAkF;AAElF,MAAM,UAAU,qBAAqB,CAAC,IAAmB;IACxD,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAErE;;OAEG;IACH,KAAK,UAAU,cAAc,CAC5B,WAAmB,EACnB,KAAc,EACd,UAA0B,EAAE;QAE5B,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAE5C,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO,OAAO,CAAC;gBACd,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,YAAY,WAAW,aAAa;gBAC7C,UAAU,EAAE,uBAAuB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aAC7E,CAAC,CAAC;QACJ,CAAC;QAED,8CAA8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BACR,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC;qBAC7B,CAAC;oBACF,aAAa,EAAE,CAAC;gBACjB,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,MAAM;oBACL,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,CAAC;oBACR,MAAM,EAAE,IAAI;iBACZ,CAAC;gBACF,aAAa,EAAE,CAAC;YACjB,CAAC;YAED,kBAAkB;YAClB,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YACtD,MAAM,mBAAmB,CAAC,aAAa,EAAE,eAAe,EAAE;gBACzD,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;aACzB,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,gBAAgB,CACrB;gBACC,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC/D,SAAS,EAAE,IAAI;aACf,EACD,aAAa,EACb,IAAI,CACJ,CAAC;QACH,CAAC;IACF,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC;AACzE,CAAC"}
@@ -70,6 +70,7 @@ export declare const HandoffMetadataSchema: z.ZodObject<{
70
70
  /** Human-readable description of the handoff */
71
71
  description: z.ZodOptional<z.ZodString>;
72
72
  }, "strip", z.ZodTypeAny, {
73
+ description?: string | undefined;
73
74
  expectedLatency?: number | undefined;
74
75
  capabilities?: string[] | undefined;
75
76
  expiresAt?: string | undefined;
@@ -78,8 +79,8 @@ export declare const HandoffMetadataSchema: z.ZodObject<{
78
79
  maxAttempts?: number | undefined;
79
80
  backoffMs?: number | undefined;
80
81
  } | undefined;
81
- description?: string | undefined;
82
82
  }, {
83
+ description?: string | undefined;
83
84
  expectedLatency?: number | undefined;
84
85
  capabilities?: string[] | undefined;
85
86
  expiresAt?: string | undefined;
@@ -88,7 +89,6 @@ export declare const HandoffMetadataSchema: z.ZodObject<{
88
89
  maxAttempts?: number | undefined;
89
90
  backoffMs?: number | undefined;
90
91
  } | undefined;
91
- description?: string | undefined;
92
92
  }>;
93
93
  /**
94
94
  * Zod schema for HandoffResult.
@@ -165,6 +165,7 @@ export declare const HandoffResultSchema: z.ZodObject<{
165
165
  /** Human-readable description of the handoff */
166
166
  description: z.ZodOptional<z.ZodString>;
167
167
  }, "strip", z.ZodTypeAny, {
168
+ description?: string | undefined;
168
169
  expectedLatency?: number | undefined;
169
170
  capabilities?: string[] | undefined;
170
171
  expiresAt?: string | undefined;
@@ -173,8 +174,8 @@ export declare const HandoffResultSchema: z.ZodObject<{
173
174
  maxAttempts?: number | undefined;
174
175
  backoffMs?: number | undefined;
175
176
  } | undefined;
176
- description?: string | undefined;
177
177
  }, {
178
+ description?: string | undefined;
178
179
  expectedLatency?: number | undefined;
179
180
  capabilities?: string[] | undefined;
180
181
  expiresAt?: string | undefined;
@@ -183,17 +184,12 @@ export declare const HandoffResultSchema: z.ZodObject<{
183
184
  maxAttempts?: number | undefined;
184
185
  backoffMs?: number | undefined;
185
186
  } | undefined;
186
- description?: string | undefined;
187
187
  }>>;
188
188
  }, "strip", z.ZodTypeAny, {
189
189
  protocol: string;
190
190
  endpoint: string;
191
- credentials?: {
192
- token?: string | undefined;
193
- headers?: Record<string, string> | undefined;
194
- sessionId?: string | undefined;
195
- } | undefined;
196
191
  metadata?: {
192
+ description?: string | undefined;
197
193
  expectedLatency?: number | undefined;
198
194
  capabilities?: string[] | undefined;
199
195
  expiresAt?: string | undefined;
@@ -202,17 +198,17 @@ export declare const HandoffResultSchema: z.ZodObject<{
202
198
  maxAttempts?: number | undefined;
203
199
  backoffMs?: number | undefined;
204
200
  } | undefined;
205
- description?: string | undefined;
206
201
  } | undefined;
207
- }, {
208
- protocol: string;
209
- endpoint: string;
210
202
  credentials?: {
211
203
  token?: string | undefined;
212
204
  headers?: Record<string, string> | undefined;
213
205
  sessionId?: string | undefined;
214
206
  } | undefined;
207
+ }, {
208
+ protocol: string;
209
+ endpoint: string;
215
210
  metadata?: {
211
+ description?: string | undefined;
216
212
  expectedLatency?: number | undefined;
217
213
  capabilities?: string[] | undefined;
218
214
  expiresAt?: string | undefined;
@@ -221,7 +217,11 @@ export declare const HandoffResultSchema: z.ZodObject<{
221
217
  maxAttempts?: number | undefined;
222
218
  backoffMs?: number | undefined;
223
219
  } | undefined;
224
- description?: string | undefined;
220
+ } | undefined;
221
+ credentials?: {
222
+ token?: string | undefined;
223
+ headers?: Record<string, string> | undefined;
224
+ sessionId?: string | undefined;
225
225
  } | undefined;
226
226
  }>;
227
227
  /**
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @fileoverview HTTP transport handler — MCP protocol, SSE, and REST endpoints.
3
+ */
4
+ import type { BatchRequest, CommandContext, CommandResult, StreamChunk } from '@lushly-dev/afd-core';
5
+ import type { ToolCallResult } from './tool-router.js';
6
+ interface SseClient {
7
+ id: string;
8
+ response: import('node:http').ServerResponse;
9
+ }
10
+ export interface HttpHandlerDeps {
11
+ name: string;
12
+ version: string;
13
+ host: string;
14
+ port: number;
15
+ cors: boolean;
16
+ devMode: boolean;
17
+ getToolsList: () => unknown[];
18
+ routeToolCall: (toolName: string, args: unknown) => Promise<ToolCallResult>;
19
+ executeCommand: (name: string, input: unknown, context?: CommandContext) => Promise<CommandResult>;
20
+ executeBatch: (request: BatchRequest, context?: CommandContext) => Promise<import('@lushly-dev/afd-core').BatchResult>;
21
+ executeStream: (name: string, input: unknown, context?: CommandContext) => AsyncGenerator<StreamChunk, void, unknown>;
22
+ }
23
+ export declare function createHttpHandler(deps: HttpHandlerDeps): {
24
+ handler: (req: import("node:http").IncomingMessage, res: import("node:http").ServerResponse) => Promise<void>;
25
+ sseClients: Map<string, SseClient>;
26
+ };
27
+ export {};
28
+ //# sourceMappingURL=http-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-handler.d.ts","sourceRoot":"","sources":["../src/http-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,cAAc,EACd,aAAa,EACb,WAAW,EACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD,UAAU,SAAS;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,OAAO,WAAW,EAAE,cAAc,CAAC;CAC7C;AAoBD,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,OAAO,EAAE,CAAC;IAC9B,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5E,cAAc,EAAE,CACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,cAAc,KACpB,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5B,YAAY,EAAE,CACb,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,cAAc,KACpB,OAAO,CAAC,OAAO,sBAAsB,EAAE,WAAW,CAAC,CAAC;IACzD,aAAa,EAAE,CACd,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,cAAc,KACpB,cAAc,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;CAChD;AAMD,wBAA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