@lushly-dev/afd-server 1.0.0 → 2.0.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.
- package/README.md +297 -14
- package/dist/bootstrap/afd-context.d.ts +11 -2
- package/dist/bootstrap/afd-context.d.ts.map +1 -1
- package/dist/bootstrap/afd-context.js +56 -11
- package/dist/bootstrap/afd-context.js.map +1 -1
- package/dist/bootstrap/afd-docs.d.ts +6 -3
- package/dist/bootstrap/afd-docs.d.ts.map +1 -1
- package/dist/bootstrap/afd-docs.js +14 -9
- package/dist/bootstrap/afd-docs.js.map +1 -1
- package/dist/bootstrap/afd-help.d.ts +6 -3
- package/dist/bootstrap/afd-help.d.ts.map +1 -1
- package/dist/bootstrap/afd-help.js +10 -8
- package/dist/bootstrap/afd-help.js.map +1 -1
- package/dist/bootstrap/afd-schema.d.ts +8 -4
- package/dist/bootstrap/afd-schema.d.ts.map +1 -1
- package/dist/bootstrap/afd-schema.js +55 -42
- package/dist/bootstrap/afd-schema.js.map +1 -1
- package/dist/bootstrap/described-command.d.ts +32 -0
- package/dist/bootstrap/described-command.d.ts.map +1 -0
- package/dist/bootstrap/described-command.js +12 -0
- package/dist/bootstrap/described-command.js.map +1 -0
- package/dist/bootstrap/index.d.ts +1 -0
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/json-schema-to-ts.d.ts +27 -0
- package/dist/bootstrap/json-schema-to-ts.d.ts.map +1 -0
- package/dist/bootstrap/json-schema-to-ts.js +154 -0
- package/dist/bootstrap/json-schema-to-ts.js.map +1 -0
- package/dist/bootstrap/registry.d.ts +17 -6
- package/dist/bootstrap/registry.d.ts.map +1 -1
- package/dist/bootstrap/registry.js +32 -5
- package/dist/bootstrap/registry.js.map +1 -1
- package/dist/command-names.d.ts +19 -0
- package/dist/command-names.d.ts.map +1 -0
- package/dist/command-names.js +33 -0
- package/dist/command-names.js.map +1 -0
- package/dist/command-routing.d.ts +47 -0
- package/dist/command-routing.d.ts.map +1 -0
- package/dist/command-routing.js +75 -0
- package/dist/command-routing.js.map +1 -0
- package/dist/context-scope.d.ts +26 -0
- package/dist/context-scope.d.ts.map +1 -0
- package/dist/context-scope.js +31 -0
- package/dist/context-scope.js.map +1 -0
- package/dist/define.d.ts +42 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +41 -0
- package/dist/define.js.map +1 -0
- package/dist/direct-registry.d.ts +103 -0
- package/dist/direct-registry.d.ts.map +1 -0
- package/dist/direct-registry.js +102 -0
- package/dist/direct-registry.js.map +1 -0
- package/dist/execution.d.ts +9 -0
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +105 -321
- package/dist/execution.js.map +1 -1
- package/dist/http-handler.d.ts +24 -17
- package/dist/http-handler.d.ts.map +1 -1
- package/dist/http-handler.js +282 -253
- package/dist/http-handler.js.map +1 -1
- package/dist/http-security.d.ts +23 -0
- package/dist/http-security.d.ts.map +1 -0
- package/dist/http-security.js +101 -0
- package/dist/http-security.js.map +1 -0
- package/dist/http-sessions.d.ts +33 -0
- package/dist/http-sessions.d.ts.map +1 -0
- package/dist/http-sessions.js +65 -0
- package/dist/http-sessions.js.map +1 -0
- package/dist/http-sse.d.ts +30 -0
- package/dist/http-sse.d.ts.map +1 -0
- package/dist/http-sse.js +70 -0
- package/dist/http-sse.js.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/json-rpc.d.ts +56 -0
- package/dist/json-rpc.d.ts.map +1 -0
- package/dist/json-rpc.js +73 -0
- package/dist/json-rpc.js.map +1 -0
- package/dist/lazy-tools.d.ts +2 -12
- package/dist/lazy-tools.d.ts.map +1 -1
- package/dist/lazy-tools.js +9 -14
- package/dist/lazy-tools.js.map +1 -1
- package/dist/meta-tools.d.ts +122 -0
- package/dist/meta-tools.d.ts.map +1 -0
- package/dist/meta-tools.js +156 -0
- package/dist/meta-tools.js.map +1 -0
- package/dist/middleware.d.ts +34 -7
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +82 -40
- package/dist/middleware.js.map +1 -1
- package/dist/schema.d.ts +27 -6
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +17 -12
- package/dist/schema.js.map +1 -1
- package/dist/server-types.d.ts +90 -14
- package/dist/server-types.d.ts.map +1 -1
- package/dist/server-types.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +103 -21
- package/dist/server.js.map +1 -1
- package/dist/tool-router.d.ts +6 -5
- package/dist/tool-router.d.ts.map +1 -1
- package/dist/tool-router.js +104 -120
- package/dist/tool-router.js.map +1 -1
- package/dist/tools.d.ts +10 -420
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +99 -208
- package/dist/tools.js.map +1 -1
- package/package.json +13 -8
package/dist/execution.js
CHANGED
|
@@ -1,27 +1,79 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Command execution engine — single, batch, pipeline, and streaming execution.
|
|
3
|
+
*
|
|
4
|
+
* Single commands run here (validation, context, middleware, hooks). Batch,
|
|
5
|
+
* pipeline and stream execution delegate to the core executors
|
|
6
|
+
* (`executeBatch`, `executePipeline`, `executeStream`) with this engine's
|
|
7
|
+
* `executeCommand` as the callback, so their semantics are shared with the
|
|
8
|
+
* core registry and DirectClient.
|
|
3
9
|
*/
|
|
4
|
-
import {
|
|
10
|
+
import { executeBatch as executeCoreBatch, executePipeline as executeCorePipeline, executeStream as executeCoreStream, executionFailure, failure, truncateName, } from '@lushly-dev/afd-core';
|
|
11
|
+
import { filterByContext, isAccessibleInContext, notFoundSuggestion, notInContextError, } from './command-routing.js';
|
|
12
|
+
import { resolveContextState } from './context-scope.js';
|
|
5
13
|
import { formatEnhancedValidationError, validateInputEnhanced } from './validation.js';
|
|
6
14
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
7
15
|
// EXECUTION ENGINE FACTORY
|
|
8
16
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
17
|
+
function toError(error) {
|
|
18
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Run an observer hook so that a throw or a rejected promise from it can never
|
|
22
|
+
* change the command result or escape as an unhandled rejection.
|
|
23
|
+
*/
|
|
24
|
+
function runHook(hook, onHookError) {
|
|
25
|
+
try {
|
|
26
|
+
const returned = hook();
|
|
27
|
+
if (returned instanceof Promise)
|
|
28
|
+
returned.catch(onHookError);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
onHookError(error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
9
34
|
export function createExecutionEngine(deps) {
|
|
10
35
|
const { commandMap, middleware, devMode, onCommand, onError } = deps;
|
|
36
|
+
/** Report to `onError`. A failing `onError` has nowhere left to report, so it is ignored. */
|
|
37
|
+
function reportError(error) {
|
|
38
|
+
runHook(() => onError?.(toError(error)), () => { });
|
|
39
|
+
}
|
|
11
40
|
/**
|
|
12
41
|
* Execute a command with validation and middleware.
|
|
13
42
|
*/
|
|
14
43
|
async function executeCommand(commandName, input, context = {}) {
|
|
15
44
|
const command = commandMap.get(commandName);
|
|
45
|
+
const activeContext = resolveContextState(context, deps.contextState)?.getActive();
|
|
16
46
|
if (!command) {
|
|
47
|
+
// A few close matches, never the whole list: in lazy mode that would load
|
|
48
|
+
// every command name into the agent's context on a single typo.
|
|
49
|
+
const candidates = filterByContext([...commandMap.values()], activeContext);
|
|
17
50
|
return failure({
|
|
18
51
|
code: 'COMMAND_NOT_FOUND',
|
|
19
|
-
message: `Command '${commandName}' not found`,
|
|
20
|
-
suggestion:
|
|
52
|
+
message: `Command '${truncateName(commandName)}' not found`,
|
|
53
|
+
suggestion: notFoundSuggestion(commandName, candidates.map((candidate) => candidate.name)),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (activeContext && !isAccessibleInContext(command, activeContext)) {
|
|
57
|
+
return failure(notInContextError(commandName, activeContext));
|
|
58
|
+
}
|
|
59
|
+
// Validate input with enhanced error messages. Schema callbacks (.refine,
|
|
60
|
+
// .superRefine, .transform, .preprocess) run here, so an exception they throw
|
|
61
|
+
// becomes a VALIDATION_ERROR result instead of rejecting.
|
|
62
|
+
let validation;
|
|
63
|
+
try {
|
|
64
|
+
validation = validateInputEnhanced(command.inputSchema, input);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const err = toError(error);
|
|
68
|
+
reportError(err);
|
|
69
|
+
return failure({
|
|
70
|
+
code: 'VALIDATION_ERROR',
|
|
71
|
+
message: 'Input validation failed',
|
|
72
|
+
suggestion: devMode
|
|
73
|
+
? `Input validation threw: ${err.message}`
|
|
74
|
+
: `Check the input against the input schema of '${commandName}' (afd-detail returns it) and retry`,
|
|
21
75
|
});
|
|
22
76
|
}
|
|
23
|
-
// Validate input with enhanced error messages
|
|
24
|
-
const validation = validateInputEnhanced(command.inputSchema, input);
|
|
25
77
|
if (!validation.success) {
|
|
26
78
|
return failure({
|
|
27
79
|
code: 'VALIDATION_ERROR',
|
|
@@ -39,20 +91,21 @@ export function createExecutionEngine(deps) {
|
|
|
39
91
|
},
|
|
40
92
|
});
|
|
41
93
|
}
|
|
94
|
+
const data = validation.data;
|
|
42
95
|
// Build middleware chain
|
|
43
96
|
const runHandler = async () => {
|
|
44
97
|
const startTime = Date.now();
|
|
45
|
-
const result = await command.handler(
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
result
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
98
|
+
const result = await command.handler(data, context);
|
|
99
|
+
// Build a new result rather than mutating the handler's (possibly frozen) object.
|
|
100
|
+
return {
|
|
101
|
+
...result,
|
|
102
|
+
metadata: {
|
|
103
|
+
...result.metadata,
|
|
104
|
+
executionTimeMs: Date.now() - startTime,
|
|
105
|
+
commandVersion: command.version,
|
|
106
|
+
...(context.traceId ? { traceId: context.traceId } : {}),
|
|
107
|
+
},
|
|
108
|
+
};
|
|
56
109
|
};
|
|
57
110
|
// Apply middleware in reverse order
|
|
58
111
|
let next = runHandler;
|
|
@@ -61,328 +114,59 @@ export function createExecutionEngine(deps) {
|
|
|
61
114
|
if (!mw)
|
|
62
115
|
continue;
|
|
63
116
|
const currentNext = next;
|
|
64
|
-
next = () => mw(commandName,
|
|
117
|
+
next = () => mw(commandName, data, context, currentNext);
|
|
65
118
|
}
|
|
119
|
+
let result;
|
|
66
120
|
try {
|
|
67
|
-
|
|
68
|
-
onCommand?.(commandName, input, result);
|
|
69
|
-
return result;
|
|
121
|
+
result = await next();
|
|
70
122
|
}
|
|
71
123
|
catch (error) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return
|
|
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
|
-
});
|
|
124
|
+
reportError(error);
|
|
125
|
+
// The raw message and stack only in devMode, to prevent information leakage.
|
|
126
|
+
return executionFailure(error, devMode);
|
|
83
127
|
}
|
|
128
|
+
// Outside the try: a failing onCommand must not turn a completed command
|
|
129
|
+
// (possibly a committed write) into COMMAND_EXECUTION_ERROR.
|
|
130
|
+
runHook(() => onCommand?.(commandName, input, result), reportError);
|
|
131
|
+
return result;
|
|
84
132
|
}
|
|
85
133
|
/**
|
|
86
134
|
* Execute multiple commands in a batch with partial success semantics.
|
|
135
|
+
*
|
|
136
|
+
* Delegates to the core `executeBatch()` with {@link executeCommand} as the
|
|
137
|
+
* callback, so every entry gets the same validation, middleware, context and
|
|
138
|
+
* error handling as a single call.
|
|
87
139
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
});
|
|
140
|
+
function executeBatch(request, context = {}) {
|
|
141
|
+
return executeCoreBatch(request, executeCommand, context, { devMode });
|
|
174
142
|
}
|
|
175
143
|
/**
|
|
176
144
|
* Execute a pipeline of chained commands with variable resolution.
|
|
145
|
+
* `$input` resolves to `request.input`; `context` is passed to commands, never to references.
|
|
177
146
|
*/
|
|
178
147
|
async function executePipeline(request, context = {}) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
//
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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
|
-
};
|
|
148
|
+
// The core runner resolves `$input` against the context it is given, so it only gets the
|
|
149
|
+
// trace ID and signal. Request values (for example from `createContext`) must not be
|
|
150
|
+
// readable, or copyable into step inputs, by the pipeline author.
|
|
151
|
+
const runnerContext = {};
|
|
152
|
+
if (context.traceId !== undefined)
|
|
153
|
+
runnerContext.traceId = context.traceId;
|
|
154
|
+
if (context.signal !== undefined)
|
|
155
|
+
runnerContext.signal = context.signal;
|
|
156
|
+
return executeCorePipeline(request, (name, input, stepContext) => executeCommand(name, input, { ...context, ...stepContext }), runnerContext);
|
|
333
157
|
}
|
|
334
158
|
/**
|
|
335
|
-
* Execute a command
|
|
159
|
+
* Execute a command and stream its result.
|
|
160
|
+
*
|
|
161
|
+
* Delegates to the core `executeStream()` with {@link executeCommand} as the
|
|
162
|
+
* callback. This is not incremental streaming: the handler runs to
|
|
163
|
+
* completion first, then an array result is emitted as one data chunk per
|
|
164
|
+
* item, any other result as a single data chunk, followed by a complete
|
|
165
|
+
* chunk. `context.signal` cancels the stream with a `STREAM_ABORTED` error
|
|
166
|
+
* chunk.
|
|
336
167
|
*/
|
|
337
|
-
|
|
338
|
-
|
|
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
|
-
}
|
|
168
|
+
function executeStream(commandName, input, context = {}) {
|
|
169
|
+
return executeCoreStream(commandName, input, executeCommand, context, { devMode });
|
|
386
170
|
}
|
|
387
171
|
return { executeCommand, executeBatch, executePipeline, executeStream };
|
|
388
172
|
}
|
package/dist/execution.js.map
CHANGED
|
@@ -1 +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,EA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,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACH,KAAK,UAAU,eAAe,CAC7B,OAAwB,EACxB,UAA0B,EAAE;QAE5B,yFAAyF;QACzF,qFAAqF;QACrF,kEAAkE;QAClE,MAAM,aAAa,GAAmB,EAAE,CAAC;QACzC,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;YAAE,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC3E,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,aAAa,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACxE,OAAO,mBAAmB,CACzB,OAAO,EACP,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,WAAW,EAAE,CAAC,EACzF,aAAa,CACb,CAAC;IACH,CAAC;IAED;;;;;;;;;OASG;IACH,SAAS,aAAa,CACrB,WAAmB,EACnB,KAAc,EACd,UAA0B,EAAE;QAE5B,OAAO,iBAAiB,CAAC,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC;AACzE,CAAC"}
|
package/dist/http-handler.d.ts
CHANGED
|
@@ -1,28 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type {
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { BatchRequest, BatchResult, CommandContext, CommandResult, StreamChunk } from '@lushly-dev/afd-core';
|
|
3
|
+
import { type HttpSecurityOptions } from './http-security.js';
|
|
4
|
+
import type { SessionStore } from './http-sessions.js';
|
|
5
|
+
import type { CreateRequestContext } from './server-types.js';
|
|
5
6
|
import type { ToolCallResult } from './tool-router.js';
|
|
6
|
-
interface
|
|
7
|
-
id: string;
|
|
8
|
-
response: import('node:http').ServerResponse;
|
|
9
|
-
}
|
|
10
|
-
export interface HttpHandlerDeps {
|
|
7
|
+
export interface HttpHandlerDeps extends HttpSecurityOptions {
|
|
11
8
|
name: string;
|
|
12
9
|
version: string;
|
|
13
|
-
host: string;
|
|
14
10
|
port: number;
|
|
15
11
|
cors: boolean;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
routeToolCall: (toolName: string, args: unknown) => Promise<ToolCallResult>;
|
|
12
|
+
getToolsList: (context: CommandContext) => unknown[];
|
|
13
|
+
routeToolCall: (toolName: string, args: unknown, context: CommandContext) => Promise<ToolCallResult>;
|
|
19
14
|
executeCommand: (name: string, input: unknown, context?: CommandContext) => Promise<CommandResult>;
|
|
20
|
-
executeBatch: (request: BatchRequest, context?: CommandContext) => Promise<
|
|
15
|
+
executeBatch: (request: BatchRequest, context?: CommandContext) => Promise<BatchResult>;
|
|
21
16
|
executeStream: (name: string, input: unknown, context?: CommandContext) => AsyncGenerator<StreamChunk, void, unknown>;
|
|
17
|
+
/** True for an exposed command declared with `mutation: true`; GET streaming refuses those. */
|
|
18
|
+
isMutation?: (name: string) => boolean;
|
|
19
|
+
/** Per-session context state. Without it every request is stateless and `Mcp-Session-Id` is ignored. */
|
|
20
|
+
sessions?: SessionStore;
|
|
21
|
+
/** Per-request values merged into the `CommandContext` of every remotely executed command. */
|
|
22
|
+
createContext?: CreateRequestContext;
|
|
23
|
+
/** Receives unexpected errors (including a throwing `createContext`). */
|
|
24
|
+
onError?: (error: Error) => void;
|
|
25
|
+
/** Maximum concurrent `/sse` connections (default: 100). */
|
|
26
|
+
maxSseConnections?: number;
|
|
27
|
+
/** Interval between SSE heartbeat comments in milliseconds (default: 25000). */
|
|
28
|
+
sseHeartbeatMs?: number;
|
|
22
29
|
}
|
|
23
30
|
export declare function createHttpHandler(deps: HttpHandlerDeps): {
|
|
24
|
-
handler: (req:
|
|
25
|
-
sseClients: Map<string, SseClient>;
|
|
31
|
+
handler: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
32
|
+
sseClients: Map<string, import("./http-sse.js").SseClient>;
|
|
33
|
+
dispose: () => void;
|
|
26
34
|
};
|
|
27
|
-
export {};
|
|
28
35
|
//# sourceMappingURL=http-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-handler.d.ts","sourceRoot":"","sources":["../src/http-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-handler.d.ts","sourceRoot":"","sources":["../src/http-handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAEN,KAAK,mBAAmB,EAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQvD,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,EAAE,CAAC;IACrD,aAAa,EAAE,CACd,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,cAAc,KACnB,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7B,cAAc,EAAE,CACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO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