@foresthubai/workflow-core 0.4.6 → 0.4.8
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/api/camera.d.ts +254 -0
- package/dist/api/camera.d.ts.map +1 -0
- package/dist/api/camera.js +6 -0
- package/dist/api/camera.js.map +1 -0
- package/dist/api/engine.d.ts +89 -10
- package/dist/api/engine.d.ts.map +1 -1
- package/dist/api/index.d.ts +0 -4
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/workflow.d.ts +61 -4
- package/dist/api/workflow.d.ts.map +1 -1
- package/dist/channel/Channel.d.ts +1 -1
- package/dist/channel/Channel.d.ts.map +1 -1
- package/dist/channel/Channel.js +1 -1
- package/dist/channel/Channel.js.map +1 -1
- package/dist/channel/ChannelDefinition.d.ts.map +1 -1
- package/dist/channel/ChannelDefinition.js +16 -0
- package/dist/channel/ChannelDefinition.js.map +1 -1
- package/dist/channel/serialization.d.ts.map +1 -1
- package/dist/channel/serialization.js +6 -0
- package/dist/channel/serialization.js.map +1 -1
- package/dist/deploy/bindingRequirements.d.ts +4 -0
- package/dist/deploy/bindingRequirements.d.ts.map +1 -0
- package/dist/deploy/bindingRequirements.js +59 -0
- package/dist/deploy/bindingRequirements.js.map +1 -0
- package/dist/deploy/constants.d.ts +8 -0
- package/dist/deploy/constants.d.ts.map +1 -0
- package/dist/deploy/constants.js +26 -0
- package/dist/deploy/constants.js.map +1 -0
- package/dist/deploy/index.d.ts +3 -5
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/index.js +10 -2
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/inputs.d.ts +30 -3
- package/dist/deploy/inputs.d.ts.map +1 -1
- package/dist/deploy/requirements.d.ts +4 -36
- package/dist/deploy/requirements.d.ts.map +1 -1
- package/dist/deploy/requirements.js +64 -76
- package/dist/deploy/requirements.js.map +1 -1
- package/dist/deploy/spec.d.ts +10 -4
- package/dist/deploy/spec.d.ts.map +1 -1
- package/dist/deploy/spec.js +233 -63
- package/dist/deploy/spec.js.map +1 -1
- package/dist/expression/parser.js +10 -1
- package/dist/expression/parser.js.map +1 -1
- package/dist/model/MLModelDefinition.d.ts +8 -0
- package/dist/model/MLModelDefinition.d.ts.map +1 -0
- package/dist/model/MLModelDefinition.js +14 -0
- package/dist/model/MLModelDefinition.js.map +1 -0
- package/dist/model/Model.d.ts +2 -1
- package/dist/model/Model.d.ts.map +1 -1
- package/dist/model/Model.js +1 -1
- package/dist/model/Model.js.map +1 -1
- package/dist/model/ModelRegistry.d.ts.map +1 -1
- package/dist/model/ModelRegistry.js +2 -0
- package/dist/model/ModelRegistry.js.map +1 -1
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +1 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/serialization.d.ts.map +1 -1
- package/dist/model/serialization.js +5 -0
- package/dist/model/serialization.js.map +1 -1
- package/dist/node/AINode.d.ts +31 -0
- package/dist/node/AINode.d.ts.map +1 -0
- package/dist/node/AINode.js +85 -0
- package/dist/node/AINode.js.map +1 -0
- package/dist/node/InputNode.d.ts +10 -2
- package/dist/node/InputNode.d.ts.map +1 -1
- package/dist/node/InputNode.js +16 -0
- package/dist/node/InputNode.js.map +1 -1
- package/dist/node/MLInferenceNode.d.ts +15 -0
- package/dist/node/MLInferenceNode.d.ts.map +1 -0
- package/dist/node/MLInferenceNode.js +26 -0
- package/dist/node/MLInferenceNode.js.map +1 -0
- package/dist/node/Node.d.ts +3 -3
- package/dist/node/Node.d.ts.map +1 -1
- package/dist/node/NodeRegistry.d.ts.map +1 -1
- package/dist/node/NodeRegistry.js +4 -2
- package/dist/node/NodeRegistry.js.map +1 -1
- package/dist/node/methods.d.ts.map +1 -1
- package/dist/node/methods.js +6 -0
- package/dist/node/methods.js.map +1 -1
- package/dist/node/serialization.d.ts.map +1 -1
- package/dist/node/serialization.js +42 -0
- package/dist/node/serialization.js.map +1 -1
- package/package.json +2 -2
- package/src/api/index.ts +0 -15
- package/src/api/workflow.ts +61 -4
- package/src/channel/Channel.ts +2 -2
- package/src/channel/ChannelDefinition.ts +16 -0
- package/src/channel/serialization.ts +6 -0
- package/src/deploy/constants.ts +30 -0
- package/src/deploy/index.ts +14 -17
- package/src/deploy/requirements.test.ts +165 -64
- package/src/deploy/requirements.ts +122 -159
- package/src/diagnostics/diagnostics.test.ts +41 -23
- package/src/expression/parser.ts +9 -1
- package/src/model/MLModelDefinition.ts +16 -0
- package/src/model/Model.ts +6 -2
- package/src/model/ModelRegistry.ts +2 -0
- package/src/model/index.ts +1 -0
- package/src/model/serialization.ts +5 -0
- package/src/node/{AgentNode.ts → AINode.ts} +124 -85
- package/src/node/InputNode.ts +28 -2
- package/src/node/Node.ts +3 -3
- package/src/node/NodeRegistry.ts +4 -2
- package/src/node/methods.ts +6 -0
- package/src/node/serialization.ts +44 -2
- package/src/workflow/serialization.test.ts +53 -0
- package/src/api/deployment.ts +0 -74
- package/src/api/engine.ts +0 -744
- package/src/deploy/inputs.ts +0 -44
- package/src/deploy/spec.test.ts +0 -227
- package/src/deploy/spec.ts +0 -397
|
@@ -247,6 +247,27 @@ function serializeNodeData(data: NodeData, position: { x: number; y: number }, i
|
|
|
247
247
|
output: data.arguments.output,
|
|
248
248
|
},
|
|
249
249
|
};
|
|
250
|
+
case "MLInference":
|
|
251
|
+
return {
|
|
252
|
+
id: data.id,
|
|
253
|
+
type: data.type,
|
|
254
|
+
position: position,
|
|
255
|
+
arguments: {
|
|
256
|
+
model: data.arguments.model,
|
|
257
|
+
input: data.arguments.input!,
|
|
258
|
+
output: data.arguments.output,
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
case "CameraCapture":
|
|
262
|
+
return {
|
|
263
|
+
id: data.id,
|
|
264
|
+
type: data.type,
|
|
265
|
+
position: position,
|
|
266
|
+
arguments: {
|
|
267
|
+
cameraReference: data.arguments.cameraReference!,
|
|
268
|
+
output: data.arguments.output,
|
|
269
|
+
},
|
|
270
|
+
};
|
|
250
271
|
case "FunctionCall": {
|
|
251
272
|
// Frontend stores FunctionCall args flat (unified with every other node), but
|
|
252
273
|
// the API schema keeps the nested { inputBindings, outputBindings } shape.
|
|
@@ -496,6 +517,27 @@ function deserializeNodeData(apiNode: Schemas["Node"], resolveFunctionInfo?: Res
|
|
|
496
517
|
output: apiNode.arguments.output as OutputBinding,
|
|
497
518
|
},
|
|
498
519
|
};
|
|
520
|
+
case "MLInference":
|
|
521
|
+
return {
|
|
522
|
+
id: apiNode.id,
|
|
523
|
+
type: apiNode.type,
|
|
524
|
+
label: apiNode.label,
|
|
525
|
+
arguments: {
|
|
526
|
+
model: apiNode.arguments.model ?? "",
|
|
527
|
+
input: apiNode.arguments.input,
|
|
528
|
+
output: apiNode.arguments.output as OutputBinding,
|
|
529
|
+
},
|
|
530
|
+
};
|
|
531
|
+
case "CameraCapture":
|
|
532
|
+
return {
|
|
533
|
+
id: apiNode.id,
|
|
534
|
+
type: apiNode.type,
|
|
535
|
+
label: apiNode.label,
|
|
536
|
+
arguments: {
|
|
537
|
+
cameraReference: apiNode.arguments.cameraReference ?? "",
|
|
538
|
+
output: apiNode.arguments.output as OutputBinding,
|
|
539
|
+
},
|
|
540
|
+
};
|
|
499
541
|
case "SetVariable":
|
|
500
542
|
return {
|
|
501
543
|
id: apiNode.id,
|
|
@@ -544,7 +586,7 @@ function deserializeNodeData(apiNode: Schemas["Node"], resolveFunctionInfo?: Res
|
|
|
544
586
|
label: apiNode.label,
|
|
545
587
|
arguments: {
|
|
546
588
|
channelReference: apiNode.arguments.channelReference ?? "",
|
|
547
|
-
dataType: apiNode.arguments.dataType,
|
|
589
|
+
dataType: apiNode.arguments.dataType as "int" | "float" | "bool" | "string",
|
|
548
590
|
value: apiNode.arguments.value,
|
|
549
591
|
qos: String(apiNode.arguments.qos) as "0" | "1" | "2",
|
|
550
592
|
retain: apiNode.arguments.retain,
|
|
@@ -557,7 +599,7 @@ function deserializeNodeData(apiNode: Schemas["Node"], resolveFunctionInfo?: Res
|
|
|
557
599
|
label: apiNode.label,
|
|
558
600
|
arguments: {
|
|
559
601
|
channelReference: apiNode.arguments.channelReference ?? "",
|
|
560
|
-
dataType: apiNode.arguments.dataType,
|
|
602
|
+
dataType: apiNode.arguments.dataType as "int" | "float" | "bool" | "string",
|
|
561
603
|
output: apiNode.arguments.output as OutputBinding,
|
|
562
604
|
},
|
|
563
605
|
};
|
|
@@ -163,6 +163,59 @@ describe("workflowSerialization — reverse roundtrip (JSON → deserialize →
|
|
|
163
163
|
const out = serialize(deserialize(withFunctionCanvas));
|
|
164
164
|
expect(out).toEqual(withFunctionCanvas);
|
|
165
165
|
});
|
|
166
|
+
|
|
167
|
+
it("preserves a CAMERA channel's width and height", () => {
|
|
168
|
+
const wf: Schemas["Workflow"] = {
|
|
169
|
+
schemaVersion: 1,
|
|
170
|
+
nodes: [],
|
|
171
|
+
edges: [],
|
|
172
|
+
functions: [],
|
|
173
|
+
declaredVariables: [],
|
|
174
|
+
channels: [{ type: "CAMERA", id: "cam1", label: "Front", width: 640, height: 480 }],
|
|
175
|
+
memory: [],
|
|
176
|
+
models: [],
|
|
177
|
+
};
|
|
178
|
+
expect(serialize(deserialize(wf))).toEqual(wf);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it("roundtrips a CAMERA channel that sets neither width nor height", () => {
|
|
182
|
+
const wf: Schemas["Workflow"] = {
|
|
183
|
+
schemaVersion: 1,
|
|
184
|
+
nodes: [],
|
|
185
|
+
edges: [],
|
|
186
|
+
functions: [],
|
|
187
|
+
declaredVariables: [],
|
|
188
|
+
channels: [{ type: "CAMERA", id: "cam1", label: "Front" }],
|
|
189
|
+
memory: [],
|
|
190
|
+
models: [],
|
|
191
|
+
};
|
|
192
|
+
expect(serialize(deserialize(wf))).toEqual(wf);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it("roundtrips an MLInference node whose input is a variable reference", () => {
|
|
196
|
+
const wf: Schemas["Workflow"] = {
|
|
197
|
+
schemaVersion: 1,
|
|
198
|
+
nodes: [
|
|
199
|
+
{
|
|
200
|
+
id: "ml1",
|
|
201
|
+
type: "MLInference",
|
|
202
|
+
position: { x: 0, y: 0 },
|
|
203
|
+
arguments: {
|
|
204
|
+
model: "detector",
|
|
205
|
+
input: { srcId: "cam1", varId: "frame" },
|
|
206
|
+
output: { active: true, mode: "emit", name: "result" },
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
edges: [],
|
|
211
|
+
functions: [],
|
|
212
|
+
declaredVariables: [],
|
|
213
|
+
channels: [],
|
|
214
|
+
memory: [],
|
|
215
|
+
models: [],
|
|
216
|
+
};
|
|
217
|
+
expect(serialize(deserialize(wf))).toEqual(wf);
|
|
218
|
+
});
|
|
166
219
|
});
|
|
167
220
|
|
|
168
221
|
// ============================================================================
|
package/src/api/deployment.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by openapi-typescript.
|
|
3
|
-
* Do not make direct changes to the file.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export type paths = Record<string, never>;
|
|
7
|
-
export type webhooks = Record<string, never>;
|
|
8
|
-
export interface components {
|
|
9
|
-
schemas: {
|
|
10
|
-
/** @description The resolved set of components to run on one device for one deployment, plus its identity. Every decision is frozen at packaging time. */
|
|
11
|
-
DeploymentSpec: {
|
|
12
|
-
/** @description Spec format version. Bumped when the spec shape changes incompatibly. */
|
|
13
|
-
schemaVersion: number;
|
|
14
|
-
/** @description Stable identifier for this deployment, used as the rollback/history key. */
|
|
15
|
-
id: string;
|
|
16
|
-
/**
|
|
17
|
-
* Format: date-time
|
|
18
|
-
* @description When this spec was produced, stamped by the producer.
|
|
19
|
-
*/
|
|
20
|
-
createdAt?: string;
|
|
21
|
-
/** @description The components to run for this deployment, each a fully resolved container. Unordered — components declare no dependencies on one another. */
|
|
22
|
-
components: components["schemas"]["DeployComponent"][];
|
|
23
|
-
};
|
|
24
|
-
/** @description One resolved container to run as part of a deployment. Generic by design: carries only runtime-neutral container knobs, never a component-typed config schema. */
|
|
25
|
-
DeployComponent: {
|
|
26
|
-
/** @description Unique component name within the deployment. */
|
|
27
|
-
name: string;
|
|
28
|
-
/** @description OCI image reference, frozen at packaging time. OSS: a locally-built convention tag, e.g. "foresthub/engine:local". Paid: a registry-qualified, digest-pinned ref, e.g. "ghcr.io/foresthubai/engine:1.2.0@sha256:...". */
|
|
29
|
-
image: string;
|
|
30
|
-
/**
|
|
31
|
-
* @description Image pull policy. Omit to default to "missing" (pull only if absent locally); "never" for a locally-built image in no registry; "always" re-pulls on every start.
|
|
32
|
-
* @enum {string}
|
|
33
|
-
*/
|
|
34
|
-
pull?: "always" | "missing" | "never";
|
|
35
|
-
/** @description Overrides the image's default command/entrypoint arguments, in exec form — one token per element, e.g. ["--model", "/path/x.gguf", "--ctx-size", "4096"]. Omit to use the image's default command. */
|
|
36
|
-
command?: string[];
|
|
37
|
-
/** @description Structured config for the component, frozen at packaging time. Omit for a component configured only by its image defaults and its device-local env. Never contains secrets. */
|
|
38
|
-
config?: {
|
|
39
|
-
[key: string]: unknown;
|
|
40
|
-
};
|
|
41
|
-
/** @description Persistent or host volume mounts in compose short form, e.g. "./workspaces/engine:/var/lib/foresthub/workspace" or "./data:/data:ro". Empty when the component is stateless and mounts nothing beyond its config files. */
|
|
42
|
-
volumes?: string[];
|
|
43
|
-
/** @description Resolved host device nodes to pass into the container, e.g. "/dev/gpiochip0", "/dev/ttyUSB0". Empty when the component binds no cdev hardware. */
|
|
44
|
-
devices?: string[];
|
|
45
|
-
/** @description Host port publishings in compose short form, e.g. "1883:1883". Empty when the component is reached only over the internal container network (the common case: components address each other by name, no host exposure needed). */
|
|
46
|
-
ports?: string[];
|
|
47
|
-
/** @description Run the container privileged. Required for hardware with no single device node to grant (ADC/DAC/PWM use sysfs paths like /sys/class/pwm, /sys/bus/iio). False when the component uses only cdev hardware (use devices) or none. */
|
|
48
|
-
privileged?: boolean;
|
|
49
|
-
/** @description Container user as "UID[:GID]", e.g. "0:0" for root. Set when a nonroot image must reach root-owned resources. Omit to use the image's default user. */
|
|
50
|
-
user?: string;
|
|
51
|
-
healthcheck?: components["schemas"]["HealthCheck"];
|
|
52
|
-
};
|
|
53
|
-
/** @description In-container readiness/liveness probe. Present only when the image ships a probe tool; omit otherwise. */
|
|
54
|
-
HealthCheck: {
|
|
55
|
-
/** @description The probe command in compose exec form. The first token is the probe kind: "CMD" runs the remaining tokens as an argv, "CMD-SHELL" runs the single following string in a shell, "NONE" disables a healthcheck the image baked in. Point it at a tool present in the image, e.g. ["CMD", "curl", "-f", "http://localhost:8080/health"]. A component reachable only by liveness (no readiness endpoint) probes a cheaper signal; one with no in-image probe at all omits the enclosing healthcheck entirely. */
|
|
56
|
-
test: string[];
|
|
57
|
-
/** @description How often to run the probe once the container is up, as a compose/Go duration, e.g. "30s". Omit to use the renderer default. */
|
|
58
|
-
interval?: string;
|
|
59
|
-
/** @description How long one probe may run before it counts as a failure, e.g. "10s". Omit to use the renderer default. */
|
|
60
|
-
timeout?: string;
|
|
61
|
-
/** @description Consecutive probe failures before the container is marked unhealthy. Omit to use the renderer default. */
|
|
62
|
-
retries?: number;
|
|
63
|
-
/** @description Grace window after container start during which probe failures neither count against retries nor mark the container unhealthy, sized to the component's worst-case warmup, e.g. a llama-server loading a multi-GB model. A container still not healthy when this elapses is the universal failure backstop. e.g. "40s". */
|
|
64
|
-
startPeriod?: string;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
responses: never;
|
|
68
|
-
parameters: never;
|
|
69
|
-
requestBodies: never;
|
|
70
|
-
headers: never;
|
|
71
|
-
pathItems: never;
|
|
72
|
-
}
|
|
73
|
-
export type $defs = Record<string, never>;
|
|
74
|
-
export type operations = Record<string, never>;
|