@qaick/executor 0.2.2 → 0.2.4
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/dist/declared-inputs.js +1 -2
- package/dist/executor.js +13 -6
- package/package.json +2 -2
package/dist/declared-inputs.js
CHANGED
|
@@ -12,8 +12,7 @@ export function resolveDeclaredInputs(declarations = [], arguments_ = {}) {
|
|
|
12
12
|
continue;
|
|
13
13
|
}
|
|
14
14
|
seen.add(declaration.name);
|
|
15
|
-
const
|
|
16
|
-
const value = isDeclaredInputNoValue(supplied) ? declaration.defaultValue : supplied;
|
|
15
|
+
const value = Object.hasOwn(arguments_, declaration.name) ? arguments_[declaration.name] : declaration.defaultValue;
|
|
17
16
|
if (isDeclaredInputNoValue(value)) {
|
|
18
17
|
delete inputs[declaration.name];
|
|
19
18
|
if (declaration.required)
|
package/dist/executor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveDeclaredInputs } from './declared-inputs.js';
|
|
2
|
-
import { executionOccurrences, executionOperandDependencyIssues, hierarchyAddressIssues } from '@qaick/contract';
|
|
2
|
+
import { isDeclaredInputNoValue, executionOccurrences, executionOperandDependencyIssues, hierarchyAddressIssues } from '@qaick/contract';
|
|
3
3
|
const addressKey = (address) => JSON.stringify([address.scope, address.segments.map(s => s.kind === 'body' ? ['body'] : [s.kind, s.position])]);
|
|
4
4
|
const invocationKey = (address, iterations) => JSON.stringify([addressKey(address), iterations.map(i => [addressKey(i.loopAddress), i.iteration])]);
|
|
5
5
|
function freezePlan(value) {
|
|
@@ -41,7 +41,7 @@ export class DefaultExecutor {
|
|
|
41
41
|
let resolve;
|
|
42
42
|
const result = new Promise(promiseResolve => { resolve = promiseResolve; });
|
|
43
43
|
const run = {
|
|
44
|
-
debugSeed, debugProvenance, request: requestSnapshot, plan, journal: new Map(), replayCaptures: new Map(), resolve, events: [], listeners: [], abort: new AbortController(), cancelled: false,
|
|
44
|
+
debugSeed, debugProvenance, request: requestSnapshot, inputSelections: structuredClone(requestSnapshot.inputs), plan, journal: new Map(), replayCaptures: new Map(), resolve, events: [], listeners: [], abort: new AbortController(), cancelled: false,
|
|
45
45
|
timedOut: false, controlState: 'idle', pauseRequested: false, stepRequested: false,
|
|
46
46
|
controlWaiters: [], hitBreakpoints: new Set(), stopAfter: request.debugSession?.stopAfterStepId,
|
|
47
47
|
startedMs: Date.now(), pausedDurationMs: 0,
|
|
@@ -262,7 +262,7 @@ export class DefaultExecutor {
|
|
|
262
262
|
// Separate structural state, not a new Run: no registration, root result, resolver,
|
|
263
263
|
// historical journal, controls, captures or original event stream are reused.
|
|
264
264
|
const context = {
|
|
265
|
-
request: session.request, plan: parent.plan, journal: new Map(), replayCaptures: new Map(),
|
|
265
|
+
request: session.request, inputSelections: structuredClone(parent.inputSelections), plan: parent.plan, journal: new Map(), replayCaptures: new Map(),
|
|
266
266
|
replay: { session, capture, root: capture.structuralAddress },
|
|
267
267
|
events: [], listeners: [], abort: session.abort,
|
|
268
268
|
get cancelled() { return session.cancelled; }, get timedOut() { return session.timedOut; },
|
|
@@ -390,7 +390,7 @@ export class DefaultExecutor {
|
|
|
390
390
|
freezePlan(seed);
|
|
391
391
|
freezePlan(provenance);
|
|
392
392
|
// Normal Run creation is independent of replay admission and has no external evidence view.
|
|
393
|
-
return this.startRun({ ...structuredClone(parent.request), requestId: crypto.randomUUID(), executionPackage: package_ }, seed, provenance);
|
|
393
|
+
return this.startRun({ ...structuredClone(parent.request), requestId: crypto.randomUUID(), executionPackage: package_, inputs: structuredClone(parent.inputSelections) }, seed, provenance);
|
|
394
394
|
}
|
|
395
395
|
async run(run, validation) {
|
|
396
396
|
const startedAt = new Date().toISOString();
|
|
@@ -442,7 +442,13 @@ export class DefaultExecutor {
|
|
|
442
442
|
for (const flow of pkg.flows ?? []) {
|
|
443
443
|
if (run.cancelled || run.abort.signal.aborted)
|
|
444
444
|
throw new Error('Execution cancelled.');
|
|
445
|
-
const
|
|
445
|
+
const selections = { ...inputs };
|
|
446
|
+
for (const declaration of flow.inputDeclarations ?? []) {
|
|
447
|
+
if (Object.hasOwn(run.inputSelections, declaration.name) && isDeclaredInputNoValue(run.inputSelections[declaration.name])) {
|
|
448
|
+
selections[declaration.name] = null;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
const arguments_ = resolveDeclaredInputs(flow.inputDeclarations, selections);
|
|
446
452
|
const issues = [...arguments_.issues, ...preflight({ ...pkg, target: { kind: 'flow', id: flow.id, name: flow.name }, requiredInputs: flow.requiredInputs }, arguments_.inputs, run.request.runtimeValues ?? {})];
|
|
447
453
|
if (issues.length)
|
|
448
454
|
return this.baseResult(run, startedAt, 'failed', undefined, issues, children);
|
|
@@ -509,7 +515,8 @@ export class DefaultExecutor {
|
|
|
509
515
|
if (step.kind === 'operation' && step.children) {
|
|
510
516
|
const arguments_ = rootCapture ? { inputs: structuredClone(rootCapture.inputs), issues: [] } : resolveDeclaredInputs(step.inputDeclarations, inputs);
|
|
511
517
|
if (arguments_.issues.length)
|
|
512
|
-
throw failure(
|
|
518
|
+
throw failure(arguments_.issues[0].code, arguments_.issues.map(issue => issue.message).join(' '));
|
|
519
|
+
inputs = arguments_.inputs;
|
|
513
520
|
const childScope = rootCapture ? structuredClone(rootCapture.lexicalScope) : { ...scope, ...arguments_.inputs };
|
|
514
521
|
for (const declaration of step.inputDeclarations ?? [])
|
|
515
522
|
if (!Object.hasOwn(arguments_.inputs, declaration.name))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qaick/executor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Host-neutral QAick action execution primitives.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@qaick/contract": "0.
|
|
37
|
+
"@qaick/contract": "0.4.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^24.13.3",
|