@bian-womp/spark-graph 0.3.90 → 0.3.92

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 (165) hide show
  1. package/lib/cjs/index.cjs +25 -0
  2. package/lib/cjs/index.cjs.map +1 -1
  3. package/lib/cjs/src/runtime/GraphRuntime.d.ts +19 -0
  4. package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
  5. package/lib/esm/index.js +25 -0
  6. package/lib/esm/index.js.map +1 -1
  7. package/lib/esm/src/runtime/GraphRuntime.d.ts +19 -0
  8. package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
  9. package/package.json +2 -2
  10. package/lib/src/builder/GraphBuilder.d.ts +0 -43
  11. package/lib/src/builder/GraphBuilder.d.ts.map +0 -1
  12. package/lib/src/builder/GraphBuilder.js +0 -279
  13. package/lib/src/builder/GraphBuilder.js.map +0 -1
  14. package/lib/src/builder/Registry.d.ts +0 -87
  15. package/lib/src/builder/Registry.d.ts.map +0 -1
  16. package/lib/src/builder/Registry.js +0 -390
  17. package/lib/src/builder/Registry.js.map +0 -1
  18. package/lib/src/core/categories.d.ts +0 -22
  19. package/lib/src/core/categories.d.ts.map +0 -1
  20. package/lib/src/core/categories.js +0 -2
  21. package/lib/src/core/categories.js.map +0 -1
  22. package/lib/src/core/order.d.ts +0 -7
  23. package/lib/src/core/order.d.ts.map +0 -1
  24. package/lib/src/core/order.js +0 -66
  25. package/lib/src/core/order.js.map +0 -1
  26. package/lib/src/core/type-utils.d.ts +0 -29
  27. package/lib/src/core/type-utils.d.ts.map +0 -1
  28. package/lib/src/core/type-utils.js +0 -92
  29. package/lib/src/core/type-utils.js.map +0 -1
  30. package/lib/src/core/types.d.ts +0 -95
  31. package/lib/src/core/types.d.ts.map +0 -1
  32. package/lib/src/core/types.js +0 -2
  33. package/lib/src/core/types.js.map +0 -1
  34. package/lib/src/examples/arrays.d.ts +0 -5
  35. package/lib/src/examples/arrays.d.ts.map +0 -1
  36. package/lib/src/examples/arrays.js +0 -49
  37. package/lib/src/examples/arrays.js.map +0 -1
  38. package/lib/src/examples/async.d.ts +0 -5
  39. package/lib/src/examples/async.d.ts.map +0 -1
  40. package/lib/src/examples/async.js +0 -91
  41. package/lib/src/examples/async.js.map +0 -1
  42. package/lib/src/examples/progress.d.ts +0 -5
  43. package/lib/src/examples/progress.d.ts.map +0 -1
  44. package/lib/src/examples/progress.js +0 -51
  45. package/lib/src/examples/progress.js.map +0 -1
  46. package/lib/src/examples/run.d.ts +0 -2
  47. package/lib/src/examples/run.d.ts.map +0 -1
  48. package/lib/src/examples/run.js +0 -32
  49. package/lib/src/examples/run.js.map +0 -1
  50. package/lib/src/examples/runMode.d.ts +0 -2
  51. package/lib/src/examples/runMode.d.ts.map +0 -1
  52. package/lib/src/examples/runMode.js +0 -223
  53. package/lib/src/examples/runMode.js.map +0 -1
  54. package/lib/src/examples/shared.d.ts +0 -5
  55. package/lib/src/examples/shared.d.ts.map +0 -1
  56. package/lib/src/examples/shared.js +0 -47
  57. package/lib/src/examples/shared.js.map +0 -1
  58. package/lib/src/examples/simple.d.ts +0 -5
  59. package/lib/src/examples/simple.d.ts.map +0 -1
  60. package/lib/src/examples/simple.js +0 -79
  61. package/lib/src/examples/simple.js.map +0 -1
  62. package/lib/src/examples/snapshot.d.ts +0 -4
  63. package/lib/src/examples/snapshot.d.ts.map +0 -1
  64. package/lib/src/examples/snapshot.js +0 -58
  65. package/lib/src/examples/snapshot.js.map +0 -1
  66. package/lib/src/examples/validation.d.ts +0 -5
  67. package/lib/src/examples/validation.d.ts.map +0 -1
  68. package/lib/src/examples/validation.js +0 -105
  69. package/lib/src/examples/validation.js.map +0 -1
  70. package/lib/src/index.d.ts +0 -27
  71. package/lib/src/index.d.ts.map +0 -1
  72. package/lib/src/index.js +0 -19
  73. package/lib/src/index.js.map +0 -1
  74. package/lib/src/misc/base.d.ts +0 -51
  75. package/lib/src/misc/base.d.ts.map +0 -1
  76. package/lib/src/misc/base.js +0 -1091
  77. package/lib/src/misc/base.js.map +0 -1
  78. package/lib/src/misc/utils/LevelLogger.d.ts +0 -150
  79. package/lib/src/misc/utils/LevelLogger.d.ts.map +0 -1
  80. package/lib/src/misc/utils/LevelLogger.js +0 -420
  81. package/lib/src/misc/utils/LevelLogger.js.map +0 -1
  82. package/lib/src/misc/utils/LevelLogger.test.d.ts +0 -2
  83. package/lib/src/misc/utils/LevelLogger.test.d.ts.map +0 -1
  84. package/lib/src/misc/utils/LevelLogger.test.js +0 -283
  85. package/lib/src/misc/utils/LevelLogger.test.js.map +0 -1
  86. package/lib/src/misc/utils/json.d.ts +0 -34
  87. package/lib/src/misc/utils/json.d.ts.map +0 -1
  88. package/lib/src/misc/utils/json.js +0 -471
  89. package/lib/src/misc/utils/json.js.map +0 -1
  90. package/lib/src/misc/utils/merge.d.ts +0 -51
  91. package/lib/src/misc/utils/merge.d.ts.map +0 -1
  92. package/lib/src/misc/utils/merge.js +0 -591
  93. package/lib/src/misc/utils/merge.js.map +0 -1
  94. package/lib/src/misc/utils/test-logger-output.d.ts +0 -7
  95. package/lib/src/misc/utils/test-logger-output.d.ts.map +0 -1
  96. package/lib/src/misc/utils/test-logger-output.js +0 -48
  97. package/lib/src/misc/utils/test-logger-output.js.map +0 -1
  98. package/lib/src/plugins/composite.d.ts +0 -22
  99. package/lib/src/plugins/composite.d.ts.map +0 -1
  100. package/lib/src/plugins/composite.js +0 -59
  101. package/lib/src/plugins/composite.js.map +0 -1
  102. package/lib/src/plugins/compute.d.ts +0 -5
  103. package/lib/src/plugins/compute.d.ts.map +0 -1
  104. package/lib/src/plugins/compute.js +0 -39
  105. package/lib/src/plugins/compute.js.map +0 -1
  106. package/lib/src/runtime/Engine.d.ts +0 -26
  107. package/lib/src/runtime/Engine.d.ts.map +0 -1
  108. package/lib/src/runtime/Engine.js +0 -2
  109. package/lib/src/runtime/Engine.js.map +0 -1
  110. package/lib/src/runtime/GraphLifecycleApi.d.ts +0 -46
  111. package/lib/src/runtime/GraphLifecycleApi.d.ts.map +0 -1
  112. package/lib/src/runtime/GraphLifecycleApi.js +0 -2
  113. package/lib/src/runtime/GraphLifecycleApi.js.map +0 -1
  114. package/lib/src/runtime/GraphRuntime.d.ts +0 -111
  115. package/lib/src/runtime/GraphRuntime.d.ts.map +0 -1
  116. package/lib/src/runtime/GraphRuntime.js +0 -791
  117. package/lib/src/runtime/GraphRuntime.js.map +0 -1
  118. package/lib/src/runtime/LocalEngine.d.ts +0 -41
  119. package/lib/src/runtime/LocalEngine.d.ts.map +0 -1
  120. package/lib/src/runtime/LocalEngine.js +0 -89
  121. package/lib/src/runtime/LocalEngine.js.map +0 -1
  122. package/lib/src/runtime/components/EdgePropagator.d.ts +0 -93
  123. package/lib/src/runtime/components/EdgePropagator.d.ts.map +0 -1
  124. package/lib/src/runtime/components/EdgePropagator.js +0 -378
  125. package/lib/src/runtime/components/EdgePropagator.js.map +0 -1
  126. package/lib/src/runtime/components/EventEmitter.d.ts +0 -12
  127. package/lib/src/runtime/components/EventEmitter.d.ts.map +0 -1
  128. package/lib/src/runtime/components/EventEmitter.js +0 -33
  129. package/lib/src/runtime/components/EventEmitter.js.map +0 -1
  130. package/lib/src/runtime/components/Graph.d.ts +0 -208
  131. package/lib/src/runtime/components/Graph.d.ts.map +0 -1
  132. package/lib/src/runtime/components/Graph.js +0 -452
  133. package/lib/src/runtime/components/Graph.js.map +0 -1
  134. package/lib/src/runtime/components/HandleResolver.d.ts +0 -36
  135. package/lib/src/runtime/components/HandleResolver.d.ts.map +0 -1
  136. package/lib/src/runtime/components/HandleResolver.js +0 -229
  137. package/lib/src/runtime/components/HandleResolver.js.map +0 -1
  138. package/lib/src/runtime/components/NodeExecutor.d.ts +0 -116
  139. package/lib/src/runtime/components/NodeExecutor.d.ts.map +0 -1
  140. package/lib/src/runtime/components/NodeExecutor.js +0 -648
  141. package/lib/src/runtime/components/NodeExecutor.js.map +0 -1
  142. package/lib/src/runtime/components/RunContextManager.d.ts +0 -90
  143. package/lib/src/runtime/components/RunContextManager.d.ts.map +0 -1
  144. package/lib/src/runtime/components/RunContextManager.js +0 -329
  145. package/lib/src/runtime/components/RunContextManager.js.map +0 -1
  146. package/lib/src/runtime/components/RuntimeValidatorManager.d.ts +0 -31
  147. package/lib/src/runtime/components/RuntimeValidatorManager.d.ts.map +0 -1
  148. package/lib/src/runtime/components/RuntimeValidatorManager.js +0 -56
  149. package/lib/src/runtime/components/RuntimeValidatorManager.js.map +0 -1
  150. package/lib/src/runtime/components/graph-utils.d.ts +0 -33
  151. package/lib/src/runtime/components/graph-utils.d.ts.map +0 -1
  152. package/lib/src/runtime/components/graph-utils.js +0 -300
  153. package/lib/src/runtime/components/graph-utils.js.map +0 -1
  154. package/lib/src/runtime/components/interfaces.d.ts +0 -59
  155. package/lib/src/runtime/components/interfaces.d.ts.map +0 -1
  156. package/lib/src/runtime/components/interfaces.js +0 -2
  157. package/lib/src/runtime/components/interfaces.js.map +0 -1
  158. package/lib/src/runtime/components/types.d.ts +0 -57
  159. package/lib/src/runtime/components/types.d.ts.map +0 -1
  160. package/lib/src/runtime/components/types.js +0 -2
  161. package/lib/src/runtime/components/types.js.map +0 -1
  162. package/lib/src/runtime/utils.d.ts +0 -21
  163. package/lib/src/runtime/utils.d.ts.map +0 -1
  164. package/lib/src/runtime/utils.js +0 -41
  165. package/lib/src/runtime/utils.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-utils.js","sourceRoot":"","sources":["../../../src/core/type-utils.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,KAAK,CAAc,MAAkB,EAAE,KAAQ;IAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,CAAU;IAChC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,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AAI,SAAS,CAAC,aAAa;KACnE,CAAC;IAEF,kCAAkC;IAClC,IAAI,SAAS,CAAC,QAAQ,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC9C,MAAM,CAAC,QAAQ,GAAG;YAChB,GAAG,SAAS,CAAC,QAAQ;YACrB,GAAG,UAAU,CAAC,QAAQ,EAAE,oCAAoC;SAC7D,CAAC;IACJ,CAAC;IAED,8DAA8D;IAC9D,OAAO,MAA+B,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAyD,EACzD,MAAgB;IAEhB,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9C,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACtE,OAAO,CAAC,CAAC,QAAsC,CAAC;AAClD,CAAC"}
@@ -1,95 +0,0 @@
1
- import type { DataTypeId, NodeTypeId, HandleId, InputHandleDescriptor, NodeCategoryId, ResolvedHandles, ExecutionPolicy, LogLevel } from "@bian-womp/spark-protocol";
2
- export interface DataTypeDescriptor<T = unknown> {
3
- id: DataTypeId;
4
- displayName?: string;
5
- validate(value: T): boolean;
6
- helpers?: Record<string, unknown>;
7
- bakeTarget?: {
8
- nodeTypeId: NodeTypeId;
9
- inputHandle: HandleId;
10
- };
11
- }
12
- export type InvalidateReason = "input-changed" | "dependency-changed" | "manual" | "disposed";
13
- export type NodeDisposeReason = "node-removed" | "runtime-dispose" | "runtime-rebuild" | "adapter-dispose";
14
- export interface NodeContext<State> {
15
- state: State;
16
- setState(next: Partial<State>): void;
17
- disposeReason?: NodeDisposeReason;
18
- }
19
- export interface ExecutionContext<State> extends NodeContext<State> {
20
- nodeId: string;
21
- environment: Record<string, unknown>;
22
- customNodeData?: Record<string, unknown>;
23
- runId: string;
24
- abortSignal: AbortSignal;
25
- emit: (handle: HandleId, value: unknown) => void;
26
- invalidateDownstream: () => void;
27
- execute: (opts?: {
28
- propagate?: boolean;
29
- resolve?: () => void;
30
- reason?: string;
31
- }) => void;
32
- getInput: (handle: HandleId) => unknown;
33
- reportProgress?: (value: number) => void;
34
- setCustomData?: (data: Record<string, unknown>) => void;
35
- log: (level: LogLevel, message: string, context?: Record<string, unknown>) => void;
36
- }
37
- /**
38
- * Extract State type from ExecutionContext<State>
39
- */
40
- export type ExtractStateFromContext<T> = T extends ExecutionContext<infer S> ? S : never;
41
- /**
42
- * Extract State type from impl function signature
43
- */
44
- export type ExtractStateFromImpl<Impl> = Impl extends (inputs: any, ctx: ExecutionContext<infer State>) => any ? State : never;
45
- /**
46
- * Extract Inputs type from impl function signature
47
- */
48
- export type ExtractInputsFromImpl<Impl> = Impl extends (inputs: infer I, ctx: any) => any ? I : never;
49
- export interface RuntimeNodeStats {
50
- runs: number;
51
- active: number;
52
- queued: number;
53
- lastStartAt?: number;
54
- lastEndAt?: number;
55
- lastDurationMs?: number;
56
- progress: number;
57
- lastError?: unknown;
58
- }
59
- export interface RuntimeEdgeStats {
60
- runs: number;
61
- inFlight: boolean;
62
- lastStartAt?: number;
63
- lastEndAt?: number;
64
- lastDurationMs?: number;
65
- progress: number;
66
- lastError?: unknown;
67
- }
68
- export type TypedValue<T = unknown> = {
69
- __spark_type: DataTypeId;
70
- __spark_value: T;
71
- };
72
- type InferState<Impl, State> = ExtractStateFromImpl<Impl> extends never ? State : ExtractStateFromImpl<Impl>;
73
- export interface NodeTypeDescriptor<I extends Record<string, InputHandleDescriptor> = Record<string, InputHandleDescriptor>, O extends Record<string, DataTypeId | DataTypeId[]> = Record<string, DataTypeId | DataTypeId[]>, State = unknown, Impl extends (inputs: any, ctx: ExecutionContext<any>) => any = (inputs: Record<string, unknown>, ctx: ExecutionContext<State>) => void | Record<string, unknown> | Promise<void | Record<string, unknown>>> {
74
- id: NodeTypeId;
75
- categoryId: NodeCategoryId;
76
- displayName?: string;
77
- inputs: I;
78
- outputs: O;
79
- impl: Impl;
80
- policy?: Partial<ExecutionPolicy>;
81
- logLevel?: LogLevel;
82
- resolveHandles?: (ctx: {
83
- nodeId: string;
84
- environment: Record<string, unknown>;
85
- params?: Record<string, unknown>;
86
- inputs?: Record<string, unknown>;
87
- }) => Partial<ResolvedHandles> | Promise<Partial<ResolvedHandles>>;
88
- inputDefaults?: Record<string, unknown>;
89
- lifecycle?: {
90
- prepare?: (params: Record<string, unknown>, ctx: ExecutionContext<InferState<Impl, State>>) => void | Promise<void>;
91
- dispose?: (ctx: NodeContext<InferState<Impl, State>>) => void;
92
- };
93
- }
94
- export {};
95
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,eAAe,EACf,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO;IAC7C,EAAE,EAAE,UAAU,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC,UAAU,CAAC,EAAE;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,QAAQ,CAAA;KAAE,CAAC;CAChE;AAED,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,oBAAoB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE9F,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAE3G,MAAM,WAAW,WAAW,CAAC,KA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AAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE;QACV,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,gBAAgB,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACpH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;KAC/D,CAAC;CACH"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import type { GraphDefinition } from "@bian-womp/spark-protocol";
2
- export declare function createArrayComposeDecomposeDef(): GraphDefinition;
3
- export declare function createArrayComposeDecomposeRegistry(): import("..").Registry;
4
- export declare function main(): Promise<void>;
5
- //# sourceMappingURL=arrays.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["../../../src/examples/arrays.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAKjE,wBAAgB,8BAA8B,IAAI,eAAe,CAchE;AAED,wBAAgB,mCAAmC,0BAElD;AAED,wBAAsB,IAAI,kBA6CzB"}
@@ -1,49 +0,0 @@
1
- import { setupBasicGraphRegistry, createRuntime } from "../misc/base";
2
- import { LocalEngine } from "../runtime/LocalEngine";
3
- import { installLogging } from "./shared";
4
- export function createArrayComposeDecomposeDef() {
5
- return {
6
- nodes: [
7
- { nodeId: "compose", typeId: "base.array.compose" },
8
- { nodeId: "decompose", typeId: "base.array.decompose" },
9
- ],
10
- edges: [
11
- {
12
- id: "e_compose_items_to_decompose_items",
13
- source: { nodeId: "compose", handle: "Items" },
14
- target: { nodeId: "decompose", handle: "Items" },
15
- },
16
- ],
17
- };
18
- }
19
- export function createArrayComposeDecomposeRegistry() {
20
- return setupBasicGraphRegistry();
21
- }
22
- export async function main() {
23
- console.log("Array compose/decompose example: dynamic handle resolution");
24
- console.log("- compose(base.array.compose) -> decompose(base.array.decompose)");
25
- console.log("- Setting compose.Length will dynamically add inputs compose.Item0..ItemN and drive decompose.Item0..ItemN outputs via Items array");
26
- const runtime = createRuntime(createArrayComposeDecomposeRegistry(), createArrayComposeDecomposeDef());
27
- const engine = new LocalEngine(runtime, "auto");
28
- installLogging(engine);
29
- engine.launch();
30
- // Compose 3 items and observe decompose dynamic outputs
31
- engine.setInputs("compose", {
32
- Length: 3,
33
- Item0: "alpha",
34
- Item1: "beta",
35
- Item2: "gamma",
36
- });
37
- await engine.whenIdle();
38
- console.log("d.Item0..2 =>", engine.getOutput("decompose", "Item0"), engine.getOutput("decompose", "Item1"), engine.getOutput("decompose", "Item2"));
39
- // Grow to 5 items; dynamic inputs/outputs should expand automatically
40
- engine.setInputs("compose", { Length: 5, Item3: "delta", Item4: "epsilon" });
41
- await engine.whenIdle();
42
- console.log("d.Item0..4 =>", engine.getOutput("decompose", "Item0"), engine.getOutput("decompose", "Item1"), engine.getOutput("decompose", "Item2"), engine.getOutput("decompose", "Item3"), engine.getOutput("decompose", "Item4"));
43
- // Shrink to 2 items; dynamic outputs should shrink
44
- engine.setInputs("compose", { Length: 2 });
45
- await engine.whenIdle();
46
- console.log("d.Item0..1 =>", engine.getOutput("decompose", "Item0"), engine.getOutput("decompose", "Item1"));
47
- engine.dispose();
48
- }
49
- //# sourceMappingURL=arrays.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrays.js","sourceRoot":"","sources":["../../../src/examples/arrays.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACt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ACT,eAAe,EACf,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,EACtC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,EACtC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CACvC,CAAC;IAEF,sEAAsE;IACtE,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7E,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IACxB,OAAO,CAAC,GAAG,CACT,eAAe,EACf,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,EACtC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,EACtC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,EACtC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,EACtC,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CACvC,CAAC;IAEF,mDAAmD;IACnD,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3C,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7G,MAAM,CAAC,OAAO,EAAE,CAAC;AACnB,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { GraphDefinition } from "@bian-womp/spark-protocol";
2
- export declare function createAsyncGraphDef(): GraphDefinition;
3
- export declare function createAsyncGraphRegistry(id?: string): import("..").Registry;
4
- export declare function main(): Promise<void>;
5
- //# sourceMappingURL=async.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../../src/examples/async.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAKjE,wBAAgB,mBAAmB,oBAoDlC;AAED,wBAAgB,wBAAwB,CAAC,EAAE,CAAC,EAAE,MAAM,yBAInD;AAED,wBAAsB,IAAI,kBAgCzB"}
@@ -1,91 +0,0 @@
1
- import { setupBasicGraphRegistry, registerDelayNode, createRuntime, BaseMathOperation } from "../misc/base";
2
- import { LocalEngine } from "../runtime/LocalEngine";
3
- import { installLogging } from "./shared";
4
- export function createAsyncGraphDef() {
5
- const def = {
6
- nodes: [
7
- {
8
- nodeId: "n1",
9
- typeId: "base.math",
10
- },
11
- {
12
- nodeId: "n2",
13
- typeId: "async.delay",
14
- params: { policy: { asyncConcurrency: "queue", maxQueue: 4 } },
15
- },
16
- {
17
- nodeId: "n3",
18
- typeId: "base.separateXYZ",
19
- },
20
- {
21
- nodeId: "n4",
22
- typeId: "base.compareXYZ",
23
- },
24
- ],
25
- edges: [
26
- {
27
- id: "e1",
28
- source: { nodeId: "n1", handle: "Result" },
29
- target: { nodeId: "n2", handle: "Value" },
30
- },
31
- // Demonstrate async edge conversion: vec3[] -> float[] using coercion
32
- {
33
- id: "e2",
34
- source: { nodeId: "n4", handle: "XYZ" },
35
- target: { nodeId: "n1", handle: "A" },
36
- typeId: "base.vec3[]",
37
- },
38
- {
39
- id: "e3",
40
- source: { nodeId: "n3", handle: "X" },
41
- target: { nodeId: "n4", handle: "X" },
42
- },
43
- {
44
- id: "e4",
45
- source: { nodeId: "n3", handle: "Y" },
46
- target: { nodeId: "n4", handle: "Y" },
47
- },
48
- {
49
- id: "e5",
50
- source: { nodeId: "n3", handle: "Z" },
51
- target: { nodeId: "n4", handle: "Z" },
52
- },
53
- ],
54
- };
55
- return def;
56
- }
57
- export function createAsyncGraphRegistry(id) {
58
- const registry = setupBasicGraphRegistry(id);
59
- registerDelayNode(registry);
60
- return registry;
61
- }
62
- export async function main() {
63
- const runtime = createRuntime(createAsyncGraphRegistry(), createAsyncGraphDef());
64
- const engine = new LocalEngine(runtime, "auto");
65
- installLogging(engine);
66
- engine.launch();
67
- // Set base ms
68
- engine.setInputs("n1", { Operation: BaseMathOperation.Add, A: [1], B: [2] });
69
- engine.setInputs("n2", { DelayMs: 250 });
70
- // Provide XYZ and route through async conversion edge
71
- engine.setInputs("n3", {
72
- XYZ: [
73
- [1, 2, 3],
74
- [4, 5, 6],
75
- [7, 8, 9],
76
- ],
77
- });
78
- // Rapid inputs to n1.B should cancel prior runs (switch)
79
- // Note: n1.A is edge-driven from n4.XYZ, so we change n1.B instead
80
- engine.setInputs("n1", { B: [3] });
81
- engine.setInputs("n1", { B: [4] });
82
- engine.setInputs("n1", { B: [5] });
83
- await new Promise((r) => setTimeout(r, 1000));
84
- engine.setInputs("n1", { B: [10] });
85
- engine.setInputs("n1", { B: [11] });
86
- engine.setInputs("n1", { B: [12] });
87
- await new Promise((r) => setTimeout(r, 1500));
88
- await engine.whenIdle();
89
- engine.dispose();
90
- }
91
- //# sourceMappingURL=async.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"async.js","sourceRoot":"","sources":["../../../src/examples/async.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,UAAU,mBAAmB;IACjC,MAAM,GAAG,GAAoB;QAC3B,KAAK,EAAE;YACL;gBACE,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,WAAW;aACpB;YACD;gBACE,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,aAAa;gBACrB,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,gBAAgB,EAAE,OA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,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACpC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACpC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAEpC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IACxB,MAAM,CAAC,OAAO,EAAE,CAAC;AACnB,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { GraphDefinition } from "@bian-womp/spark-protocol";
2
- export declare function createProgressGraphDef(): GraphDefinition;
3
- export declare function createProgressGraphRegistry(id?: string): import("..").Registry;
4
- export declare function main(): Promise<void>;
5
- //# sourceMappingURL=progress.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/examples/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAKjE,wBAAgB,sBAAsB,oBAsBrC;AAED,wBAAgB,2BAA2B,CAAC,EAAE,CAAC,EAAE,MAAM,yBAItD;AAED,wBAAsB,IAAI,kBAsBzB"}
@@ -1,51 +0,0 @@
1
- import { registerProgressNodes, setupBasicGraphRegistry, createRuntime } from "../misc/base";
2
- import { LocalEngine } from "../runtime/LocalEngine";
3
- import { installLogging } from "./shared";
4
- export function createProgressGraphDef() {
5
- const def = {
6
- nodes: [
7
- { nodeId: "steps", typeId: "base.input.number" },
8
- { nodeId: "delay", typeId: "base.input.number" },
9
- { nodeId: "work", typeId: "async.progress" },
10
- ],
11
- edges: [
12
- {
13
- id: "e1",
14
- source: { nodeId: "steps", handle: "Result" },
15
- target: { nodeId: "work", handle: "Steps" },
16
- },
17
- {
18
- id: "e2",
19
- source: { nodeId: "delay", handle: "Result" },
20
- target: { nodeId: "work", handle: "DelayMs" },
21
- },
22
- // not wiring ShouldError to show manual input driven error later
23
- ],
24
- };
25
- return def;
26
- }
27
- export function createProgressGraphRegistry(id) {
28
- const registry = setupBasicGraphRegistry(id);
29
- registerProgressNodes(registry);
30
- return registry;
31
- }
32
- export async function main() {
33
- const runtime = createRuntime(createProgressGraphRegistry(), createProgressGraphDef());
34
- const engine = new LocalEngine(runtime, "auto");
35
- installLogging(engine);
36
- engine.launch();
37
- // Seed initial values
38
- engine.setInputs("steps", { Value: 12 });
39
- engine.setInputs("delay", { Value: 80 });
40
- // Manually set ShouldError on the worker (unwired input)
41
- engine.setInputs("work", { ShouldError: false });
42
- // After 2s, trigger an error run
43
- await new Promise((r) => setTimeout(r, 2000));
44
- console.log("-- triggering error run --");
45
- engine.setInputs("work", { ShouldError: true });
46
- // After 5s, stop and exit
47
- await new Promise((r) => setTimeout(r, 5000));
48
- await engine.whenIdle();
49
- engine.dispose();
50
- }
51
- //# sourceMappingURL=progress.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../src/examples/progress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,UAAU,sBAAsB;IACpC,MAAM,GAAG,GAAoB;QAC3B,KAAK,EAAE;YACL,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE;YA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SAAS,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IAEjD,iCAAiC;IACjC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhD,0BAA0B;IAC1B,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IACxB,MAAM,CAAC,OAAO,EAAE,CAAC;AACnB,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function run(example: string): Promise<void>;
2
- //# sourceMappingURL=run.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/examples/run.ts"],"names":[],"mappings":"AAAA,wBAAsB,GAAG,CAAC,OAAO,EAAE,MAAM,iBA0BxC"}
@@ -1,32 +0,0 @@
1
- export async function run(example) {
2
- switch (example) {
3
- case "simple":
4
- await import("./simple").then((m) => m.main());
5
- break;
6
- case "runMode":
7
- await import("./runMode").then((m) => m.main());
8
- break;
9
- case "async":
10
- await import("./async").then((m) => m.main());
11
- break;
12
- case "progress":
13
- await import("./progress").then((m) => m.main());
14
- break;
15
- case "validation":
16
- await import("./validation").then((m) => m.main());
17
- break;
18
- case "snapshot":
19
- await import("./snapshot").then((m) => m.main());
20
- break;
21
- case "arrays":
22
- await import("./arrays").then((m) => m.main());
23
- break;
24
- default:
25
- throw new Error(`Unknown example: ${example}`);
26
- }
27
- }
28
- const exampleArg = (process.argv && process.argv[2]) || "simple";
29
- console.log(`Running example: ${exampleArg}`);
30
- // top-level await is supported by tsx
31
- run(exampleArg);
32
- //# sourceMappingURL=run.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/examples/run.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAe;IACvC,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,QAAQ;YACX,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAC/C,MAAM;QACR,KAAK,SAAS;YACZ,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAChD,MAAM;QACR,KAAK,OAAO;YACV,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAC9C,MAAM;QACR,KAAK,UAAU;YACb,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACjD,MAAM;QACR,KAAK,YAAY;YACf,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACnD,MAAM;QACR,KAAK,UAAU;YACb,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACjD,MAAM;QACR,KAAK,QAAQ;YACX,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAC/C,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC;AACjE,OAAO,CAAC,GAAG,CAAC,oBAAoB,UAAU,EAAE,CAAC,CAAC;AAE9C,sCAAsC;AACtC,GAAG,CAAC,UAAU,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function main(): Promise<void>;
2
- //# sourceMappingURL=runMode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runMode.d.ts","sourceRoot":"","sources":["../../../src/examples/runMode.ts"],"names":[],"mappings":"AA8OA,wBAAsB,IAAI,kBAmBzB"}
@@ -1,223 +0,0 @@
1
- import { GraphBuilder } from "../builder/GraphBuilder";
2
- import { setupBasicGraphRegistry, registerDelayNode, BaseMathOperation } from "../misc/base";
3
- import { LocalEngine } from "../runtime/LocalEngine";
4
- import { installLogging } from "./shared";
5
- function buildDef() {
6
- return {
7
- nodes: [
8
- { nodeId: "input1", typeId: "base.input.number" },
9
- { nodeId: "input2", typeId: "base.input.number" },
10
- { nodeId: "math1", typeId: "base.math" },
11
- { nodeId: "math2", typeId: "base.math" },
12
- {
13
- nodeId: "delay1",
14
- typeId: "async.delay",
15
- params: { policy: { asyncConcurrency: "queue", maxQueue: 4 } },
16
- },
17
- {
18
- nodeId: "delay2",
19
- typeId: "async.delay",
20
- params: { policy: { asyncConcurrency: "queue", maxQueue: 4 } },
21
- },
22
- ],
23
- edges: [
24
- {
25
- id: "e1",
26
- source: { nodeId: "input1", handle: "Result" },
27
- target: { nodeId: "math1", handle: "A" },
28
- },
29
- {
30
- id: "e2",
31
- source: { nodeId: "input2", handle: "Result" },
32
- target: { nodeId: "math1", handle: "B" },
33
- },
34
- {
35
- id: "e3",
36
- source: { nodeId: "math1", handle: "Result" },
37
- target: { nodeId: "math2", handle: "A" },
38
- },
39
- {
40
- id: "e4",
41
- source: { nodeId: "math2", handle: "Result" },
42
- target: { nodeId: "delay1", handle: "Value" },
43
- },
44
- {
45
- id: "e5",
46
- source: { nodeId: "delay1", handle: "Result" },
47
- target: { nodeId: "delay2", handle: "Value" },
48
- },
49
- ],
50
- };
51
- }
52
- async function demoAutoMode() {
53
- console.log("\n" + "=".repeat(60));
54
- console.log("AUTO MODE DEMONSTRATION");
55
- console.log("=".repeat(60));
56
- console.log("In auto mode, nodes automatically execute when inputs change.\n");
57
- const registry = setupBasicGraphRegistry();
58
- registerDelayNode(registry);
59
- const builder = new GraphBuilder(registry);
60
- const def = buildDef();
61
- const runtime = builder.build(def);
62
- const engine = new LocalEngine(runtime, "auto");
63
- installLogging(engine);
64
- engine.launch();
65
- // Configure nodes
66
- engine.setInputs("math1", { Operation: BaseMathOperation.Add });
67
- engine.setInputs("math2", { Operation: BaseMathOperation.Multiply, B: [2] });
68
- engine.setInputs("delay1", { DelayMs: 100 });
69
- engine.setInputs("delay2", { DelayMs: 100 });
70
- console.log("Step 1: Set input1 = 5");
71
- console.log(" → input1 runs and outputs 5");
72
- console.log(" → math1.A gets set to 5, but math1 waits for input2 (B)\n");
73
- engine.setInputs("input1", { Value: 5 });
74
- await new Promise((r) => setTimeout(r, 200));
75
- console.log("Step 2: Set input2 = 3");
76
- console.log(" → input2 runs and outputs 3");
77
- console.log(" → math1 automatically runs (A=5, B=3) → Result=8");
78
- console.log(" → math2 automatically runs (A=8, B=2) → Result=16");
79
- console.log(" → delay1 automatically runs → delay2 automatically runs\n");
80
- engine.setInputs("input2", { Value: 3 });
81
- await new Promise((r) => setTimeout(r, 500));
82
- console.log("Step 3: Set input1 = 10");
83
- console.log(" → math1 automatically runs (A=10, B=3) → Result=13");
84
- console.log(" → math2 automatically runs (A=13, B=2) → Result=26");
85
- console.log(" → delay1 automatically runs → delay2 automatically runs\n");
86
- engine.setInputs("input1", { Value: 10 });
87
- await engine.whenIdle();
88
- engine.dispose();
89
- }
90
- async function demoManualMode() {
91
- console.log("\n" + "=".repeat(60));
92
- console.log("MANUAL MODE DEMONSTRATION");
93
- console.log("=".repeat(60));
94
- console.log("In manual mode, nodes only execute when explicitly called.\n");
95
- const registry = setupBasicGraphRegistry();
96
- registerDelayNode(registry);
97
- const builder = new GraphBuilder(registry);
98
- const def = buildDef();
99
- const runtime = builder.build(def);
100
- const engine = new LocalEngine(runtime, "manual");
101
- installLogging(engine);
102
- engine.launch();
103
- // Configure nodes
104
- engine.setInputs("math1", { Operation: BaseMathOperation.Add });
105
- engine.setInputs("math2", { Operation: BaseMathOperation.Multiply, B: [2] });
106
- engine.setInputs("delay1", { DelayMs: 100 });
107
- engine.setInputs("delay2", { DelayMs: 100 });
108
- console.log("Step 1: Set input1 = 5");
109
- console.log(" → input1 runs immediately (input nodes run when Value is set, even in manual mode)");
110
- console.log(" → math1 does NOT run automatically (waits for explicit call)\n");
111
- engine.setInputs("input1", { Value: 5 });
112
- await new Promise((r) => setTimeout(r, 100));
113
- console.log("Step 2: computeNode('math1') - runs math1 and upstream nodes");
114
- console.log(" → math1 runs using input1's output (A=5, B=undefined) → Result=5 (uses defaults for B)");
115
- console.log(" → math2 does NOT run (no propagation)\n");
116
- await engine.computeNode("math1");
117
- await new Promise((r) => setTimeout(r, 200));
118
- console.log("Step 3: Set input1=7, then computeNode('math1')");
119
- console.log(" → input1 runs immediately when Value is set");
120
- console.log(" → math1 runs as an isolated compute (no downstream propagation)");
121
- console.log(" → Note: math1 may use previous B value if input2 hasn't run yet\n");
122
- engine.setInputs("input1", { Value: 7 });
123
- await new Promise((r) => setTimeout(r, 100));
124
- await engine.computeNode("math1");
125
- await new Promise((r) => setTimeout(r, 200));
126
- console.log("Step 4: Set input1=7, then runFromHere('math1') - runs math1 AND all downstream");
127
- console.log(" → input1 runs immediately when Value is set");
128
- console.log(" → math1 runs (A=7, B=undefined) → Result=7 (uses defaults for B)");
129
- console.log(" → math2 runs → delay1 runs → delay2 runs\n");
130
- engine.setInputs("input1", { Value: 7 });
131
- await new Promise((r) => setTimeout(r, 100));
132
- await engine.runFromHere("math1");
133
- await new Promise((r) => setTimeout(r, 500));
134
- console.log("Step 5: Set input2 = 4, then runFromHere('math1') - runs upstream and downstream");
135
- console.log(" → input2 runs immediately when Value is set");
136
- console.log(" → math1 runs (A=7, B=4) → Result=11");
137
- console.log(" → math2 runs (A=11, B=2) → Result=22");
138
- console.log(" → delay1 runs (delay2 may run after delay1 completes)\n");
139
- engine.setInputs("input2", { Value: 4 });
140
- await new Promise((r) => setTimeout(r, 100));
141
- await engine.runFromHere("math1");
142
- await new Promise((r) => setTimeout(r, 500));
143
- console.log("Step 6: computeNode('math2') - runs ONLY math2");
144
- console.log(" → math2 runs with current inputs (A=11, B=2) → Result=22");
145
- console.log(" → delay1 does NOT run (no propagation)\n");
146
- await engine.computeNode("math2");
147
- await new Promise((r) => setTimeout(r, 200));
148
- await engine.whenIdle();
149
- engine.dispose();
150
- }
151
- async function demoModeSwitching() {
152
- console.log("\n" + "=".repeat(60));
153
- console.log("MODE SWITCHING DEMONSTRATION");
154
- console.log("=".repeat(60));
155
- console.log("You can switch between modes at runtime.\n");
156
- const registry = setupBasicGraphRegistry();
157
- registerDelayNode(registry);
158
- const builder = new GraphBuilder(registry);
159
- const def = buildDef();
160
- const runtime = builder.build(def);
161
- const engine = new LocalEngine(runtime, "manual");
162
- installLogging(engine);
163
- engine.launch();
164
- // Configure nodes
165
- engine.setInputs("math1", { Operation: BaseMathOperation.Add });
166
- engine.setInputs("math2", { Operation: BaseMathOperation.Multiply, B: [2] });
167
- engine.setInputs("delay1", { DelayMs: 100 });
168
- engine.setInputs("delay2", { DelayMs: 100 });
169
- console.log("Starting in MANUAL mode");
170
- console.log("Step 1: Set input1 = 5");
171
- console.log(" → input1 runs immediately (input nodes run when Value is set)\n");
172
- engine.setInputs("input1", { Value: 5 });
173
- await new Promise((r) => setTimeout(r, 100));
174
- console.log("Step 2: Set input2 = 0, then switch to AUTO mode");
175
- engine.setInputs("input2", { Value: 0 });
176
- engine.setRunMode("auto");
177
- console.log(" → input2 runs and outputs 0");
178
- console.log(" → math1 automatically runs (A=5, B=0) → Result=5");
179
- console.log(" → math2 automatically runs (A=5, B=2) → Result=10");
180
- console.log(" → delay1 automatically runs → delay2 automatically runs\n");
181
- await new Promise((r) => setTimeout(r, 500));
182
- console.log("Step 3: Switch back to MANUAL mode");
183
- engine.setRunMode("manual");
184
- console.log("Step 4: Set input2 = 8");
185
- console.log(" → input2.Value is set to 8");
186
- console.log(" → In manual mode, input nodes run when Value is set, but after mode switching they may need explicit trigger");
187
- console.log(" → math1 does NOT run automatically (waits for explicit call)\n");
188
- engine.setInputs("input2", { Value: 8 });
189
- await new Promise((r) => setTimeout(r, 100));
190
- console.log("Step 5a: runFromHere('math1') - may use old input2 value");
191
- console.log(" → math1 runs, but input2 may not have run yet, so uses old B=0 → Result=5");
192
- console.log(" → math2 does NOT run (math1 output didn't change)\n");
193
- await engine.runFromHere("math1");
194
- await new Promise((r) => setTimeout(r, 200));
195
- console.log("Step 5b: Explicitly run input2, then runFromHere('math1') - uses new value");
196
- console.log(" → input2 runs and outputs 8");
197
- console.log(" → math1 runs with current inputs (A=5, B=8) → Result=13");
198
- console.log(" → math2 runs (A=13, B=2) → Result=26");
199
- console.log(" → delay1 runs → delay2 runs\n");
200
- await engine.computeNode("input2");
201
- await engine.runFromHere("math1");
202
- await new Promise((r) => setTimeout(r, 500));
203
- await engine.whenIdle();
204
- engine.dispose();
205
- }
206
- export async function main() {
207
- await demoAutoMode();
208
- await demoManualMode();
209
- await demoModeSwitching();
210
- console.log("\n" + "=".repeat(60));
211
- console.log("SUMMARY");
212
- console.log("=".repeat(60));
213
- console.log("AUTO MODE:");
214
- console.log(" • Nodes automatically execute when inputs change");
215
- console.log(" • Changes propagate through the entire graph automatically");
216
- console.log(" • Use setInputs() and nodes run themselves\n");
217
- console.log("MANUAL MODE:");
218
- console.log(" • Nodes only execute when explicitly called");
219
- console.log(" • Use computeNode(nodeId) to run a node (no downstream propagation, but upstream nodes run if needed)");
220
- console.log(" • Use runFromHere(nodeId) to run a node and all downstream nodes (upstream nodes run if needed)");
221
- console.log(" • Use computeNode(nodeId) to run one node without downstream propagation\n");
222
- }
223
- //# sourceMappingURL=runMode.js.map