@decaf-ts/integrations 0.3.11 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/integrations.cjs +1 -1
  2. package/lib/cjs/graph/engine/execution/CodeGraphNodeExecutor.cjs +26 -29
  3. package/lib/cjs/graph/engine/execution/CodeGraphNodeExecutor.cjs.map +1 -1
  4. package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs +20 -1
  5. package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs.map +1 -1
  6. package/lib/cjs/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.cjs +126 -0
  7. package/lib/cjs/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.cjs.map +1 -1
  8. package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs +19 -0
  9. package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs.map +1 -0
  10. package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs +21 -4
  11. package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs.map +1 -1
  12. package/lib/cjs/graph/engine/execution/index.cjs +1 -0
  13. package/lib/cjs/graph/engine/execution/index.cjs.map +1 -1
  14. package/lib/cjs/graph/engine/index.cjs +1 -0
  15. package/lib/cjs/graph/engine/index.cjs.map +1 -1
  16. package/lib/cjs/graph/engine/loops/ForeachGraphNodeExecutor.cjs +1 -0
  17. package/lib/cjs/graph/engine/loops/ForeachGraphNodeExecutor.cjs.map +1 -1
  18. package/lib/cjs/graph/shared/nodes/flow-control.cjs +91 -9
  19. package/lib/cjs/graph/shared/nodes/flow-control.cjs.map +1 -1
  20. package/lib/cjs/index.cjs +3 -3
  21. package/lib/cjs/nest/graph/GraphExecutionController.cjs +39 -50
  22. package/lib/cjs/nest/graph/GraphExecutionController.cjs.map +1 -1
  23. package/lib/cjs/nest/graph/GraphExecutionModule.cjs +45 -40
  24. package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -1
  25. package/lib/cjs/nest/graph/GraphExecutionResultModel.cjs +0 -18
  26. package/lib/cjs/nest/graph/GraphExecutionResultModel.cjs.map +1 -1
  27. package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs +11 -46
  28. package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs.map +1 -1
  29. package/lib/cjs/nest/graph/GraphResultService.cjs +54 -0
  30. package/lib/cjs/nest/graph/GraphResultService.cjs.map +1 -0
  31. package/lib/cjs/nest/graph/GraphWorkflowModel.cjs +44 -0
  32. package/lib/cjs/nest/graph/GraphWorkflowModel.cjs.map +1 -0
  33. package/lib/cjs/nest/graph/GraphWorkflowService.cjs +62 -0
  34. package/lib/cjs/nest/graph/GraphWorkflowService.cjs.map +1 -0
  35. package/lib/cjs/nest/graph/index.cjs +3 -6
  36. package/lib/cjs/nest/graph/index.cjs.map +1 -1
  37. package/lib/cjs/nest/graph/main.cjs +1 -1
  38. package/lib/cjs/nest/graph/main.cjs.map +1 -1
  39. package/lib/esm/graph/engine/execution/CodeGraphNodeExecutor.js +26 -29
  40. package/lib/esm/graph/engine/execution/CodeGraphNodeExecutor.js.map +1 -1
  41. package/lib/esm/graph/engine/execution/GraphExecutionEngine.js +20 -1
  42. package/lib/esm/graph/engine/execution/GraphExecutionEngine.js.map +1 -1
  43. package/lib/esm/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.js +126 -0
  44. package/lib/esm/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.js.map +1 -1
  45. package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js +14 -0
  46. package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js.map +1 -0
  47. package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js +21 -4
  48. package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js.map +1 -1
  49. package/lib/esm/graph/engine/execution/index.js +1 -0
  50. package/lib/esm/graph/engine/execution/index.js.map +1 -1
  51. package/lib/esm/graph/engine/index.js +1 -0
  52. package/lib/esm/graph/engine/index.js.map +1 -1
  53. package/lib/esm/graph/engine/loops/ForeachGraphNodeExecutor.js +1 -0
  54. package/lib/esm/graph/engine/loops/ForeachGraphNodeExecutor.js.map +1 -1
  55. package/lib/esm/graph/shared/nodes/flow-control.js +91 -9
  56. package/lib/esm/graph/shared/nodes/flow-control.js.map +1 -1
  57. package/lib/esm/index.js +3 -3
  58. package/lib/esm/nest/graph/GraphExecutionController.js +39 -50
  59. package/lib/esm/nest/graph/GraphExecutionController.js.map +1 -1
  60. package/lib/esm/nest/graph/GraphExecutionModule.js +11 -39
  61. package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
  62. package/lib/esm/nest/graph/GraphExecutionResultModel.js +0 -18
  63. package/lib/esm/nest/graph/GraphExecutionResultModel.js.map +1 -1
  64. package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js +12 -47
  65. package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js.map +1 -1
  66. package/lib/esm/nest/graph/GraphResultService.js +45 -0
  67. package/lib/esm/nest/graph/GraphResultService.js.map +1 -0
  68. package/lib/esm/nest/graph/GraphWorkflowModel.js +35 -0
  69. package/lib/esm/nest/graph/GraphWorkflowModel.js.map +1 -0
  70. package/lib/esm/nest/graph/GraphWorkflowService.js +53 -0
  71. package/lib/esm/nest/graph/GraphWorkflowService.js.map +1 -0
  72. package/lib/esm/nest/graph/index.js +3 -6
  73. package/lib/esm/nest/graph/index.js.map +1 -1
  74. package/lib/esm/nest/graph/main.js +1 -1
  75. package/lib/esm/nest/graph/main.js.map +1 -1
  76. package/lib/types/graph/engine/execution/CodeGraphNodeExecutor.d.cts +17 -17
  77. package/lib/types/graph/engine/execution/CodeGraphNodeExecutor.d.mts +17 -17
  78. package/lib/types/graph/engine/execution/CodeSandboxEvaluator.d.cts +23 -0
  79. package/lib/types/graph/engine/execution/CodeSandboxEvaluator.d.mts +23 -0
  80. package/lib/types/graph/engine/execution/GraphExecutionEngine.d.cts +6 -0
  81. package/lib/types/graph/engine/execution/GraphExecutionEngine.d.mts +6 -0
  82. package/lib/types/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.d.cts +18 -0
  83. package/lib/types/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.d.mts +18 -0
  84. package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.cts +19 -0
  85. package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.mts +19 -0
  86. package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.cts +3 -2
  87. package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.mts +3 -2
  88. package/lib/types/graph/engine/execution/index.d.cts +1 -0
  89. package/lib/types/graph/engine/execution/index.d.mts +1 -0
  90. package/lib/types/graph/engine/index.d.cts +1 -0
  91. package/lib/types/graph/engine/index.d.mts +1 -0
  92. package/lib/types/graph/shared/nodes/flow-control.d.cts +29 -3
  93. package/lib/types/graph/shared/nodes/flow-control.d.mts +29 -3
  94. package/lib/types/graph/shared/types.d.cts +6 -0
  95. package/lib/types/graph/shared/types.d.mts +6 -0
  96. package/lib/types/index.d.cts +2 -2
  97. package/lib/types/index.d.mts +2 -2
  98. package/lib/types/nest/graph/GraphExecutionController.d.cts +11 -42
  99. package/lib/types/nest/graph/GraphExecutionController.d.mts +11 -42
  100. package/lib/types/nest/graph/GraphExecutionModule.d.cts +9 -29
  101. package/lib/types/nest/graph/GraphExecutionModule.d.mts +9 -29
  102. package/lib/types/nest/graph/GraphExecutionResultModel.d.cts +0 -34
  103. package/lib/types/nest/graph/GraphExecutionResultModel.d.mts +0 -34
  104. package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.cts +9 -9
  105. package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.mts +9 -9
  106. package/lib/types/nest/graph/GraphResultService.d.cts +8 -0
  107. package/lib/types/nest/graph/GraphResultService.d.mts +8 -0
  108. package/lib/types/nest/graph/GraphWorkflowModel.d.cts +7 -0
  109. package/lib/types/nest/graph/GraphWorkflowModel.d.mts +7 -0
  110. package/lib/types/nest/graph/GraphWorkflowService.d.cts +7 -0
  111. package/lib/types/nest/graph/GraphWorkflowService.d.mts +7 -0
  112. package/lib/types/nest/graph/index.d.cts +3 -6
  113. package/lib/types/nest/graph/index.d.mts +3 -6
  114. package/package.json +3 -3
  115. package/lib/cjs/nest/graph/GraphExecutionResultRepository.cjs +0 -66
  116. package/lib/cjs/nest/graph/GraphExecutionResultRepository.cjs.map +0 -1
  117. package/lib/esm/nest/graph/GraphExecutionResultRepository.js +0 -60
  118. package/lib/esm/nest/graph/GraphExecutionResultRepository.js.map +0 -1
  119. package/lib/types/nest/graph/GraphExecutionResultRepository.d.cts +0 -38
  120. package/lib/types/nest/graph/GraphExecutionResultRepository.d.mts +0 -38
@@ -3,56 +3,20 @@
3
3
  * @summary Factory that builds a populated {@link GraphNodeExecutorRegistry}.
4
4
  * @description Creates a registry pre-loaded with the demo executors used by
5
5
  * the graph execution backend's sample workflows. The executors cover the
6
- * publishing-workflow node tags, the flow-control kinds, the agent kind, and
7
- * the loop kinds. Additional executors can be registered on the returned
8
- * registry before it is handed to the {@link GraphExecutionEngine}.
6
+ * flow-control kinds (including Code, Log, and Switch with code conditions),
7
+ * the agent kind, and the loop kinds. Additional executors can be registered
8
+ * on the returned registry before it is handed to the
9
+ * {@link GraphExecutionEngine}.
9
10
  */
10
- import { GraphNodeExecutorRegistry, ConditionExpressionEvaluator, ForeachGraphNodeExecutor, WhileGraphNodeExecutor, UntilGraphNodeExecutor, CodeGraphNodeExecutor, IsolatedVmCodeSandboxEvaluator, } from "./../../graph/index.js";
11
+ import { GraphNodeExecutorRegistry, ForeachGraphNodeExecutor, WhileGraphNodeExecutor, UntilGraphNodeExecutor, CodeGraphNodeExecutor, LogGraphNodeExecutor, SwitchGraphNodeExecutor, IsolatedVmCodeSandboxEvaluator, } from "./../../graph/index.js";
11
12
  const executorMap = {
12
13
  "math.add": (input) => ({ sum: Number(input.a) + Number(input.b) }),
13
14
  "math.multiply": (input) => ({ product: Number(input.x) * 2 }),
14
- "graph-intake-workflow": (input) => ({
15
- brief: `[Normalized brief] ${String(input["request"] ?? "")}`,
16
- }),
17
- "graph-planning-pipeline": (input) => ({
18
- plan: `[Plan] Steps derived from: ${String(input["brief"] ?? "")}`,
19
- }),
20
- "graph-draft-node": (input) => ({
21
- draft: `[Draft] ${String(input["plan"] ?? "")}`,
22
- }),
23
- "graph-review-node": (input) => ({
24
- approved: `[Approved] ${String(input["draft"] ?? "")}`,
25
- }),
26
- "graph-publish-workflow": (input) => ({
27
- artifact: `[Published] ${String(input["approved"] ?? "")}`,
28
- }),
29
15
  "core.flow.map": (input) => ({ result: { mapped: input["value"] ?? input } }),
30
16
  "core.flow.delay": (input) => ({ valueOut: input["value"] ?? input }),
31
17
  "core.flow.return": (input) => ({ result: input["value"] ?? input }),
32
18
  "core.flow.merge": (input) => ({ merged: input["values"] ?? input }),
33
19
  "core.flow.if": (input) => ({ then: input["value"] ?? input }),
34
- "core.flow.switch": (input, context) => {
35
- const meta = context.node.graph?.metadata?.["switch"];
36
- const inputValue = input["value"] ?? input;
37
- if (!meta || !meta.cases || meta.cases.length === 0) {
38
- return { [meta?.defaultPort ?? "default"]: inputValue };
39
- }
40
- const evaluator = new ConditionExpressionEvaluator();
41
- for (const c of meta.cases) {
42
- const cond = c.condition;
43
- if ("op" in cond) {
44
- try {
45
- if (evaluator.evaluate(cond, inputValue)) {
46
- return { [c.outputPort]: inputValue };
47
- }
48
- }
49
- catch {
50
- // skip unparseable conditions in demo
51
- }
52
- }
53
- }
54
- return { [meta.defaultPort ?? "default"]: inputValue };
55
- },
56
20
  "core.flow.parallel": (input) => ({ branches: [input["value"] ?? input] }),
57
21
  "core.flow.errorBoundary": (input) => ({ result: input["value"] ?? input }),
58
22
  "core.flow.humanApproval": (input) => ({ approved: input["value"] ?? input }),
@@ -71,12 +35,11 @@ const executorMap = {
71
35
  *
72
36
  * Registered kinds:
73
37
  * - `math.add`, `math.multiply` — arithmetic demo executors.
74
- * - `graph-intake-workflow`, `graph-planning-pipeline`, `graph-draft-node`,
75
- * `graph-review-node`, `graph-publish-workflow` — publishing workflow demo.
76
- * - `core.flow.*` — flow-control kinds (map, delay, return, merge, if, switch,
77
- * parallel, errorBoundary, humanApproval). The `core.flow.code` kind is
78
- * registered in `onEngineCreated` via the real {@link CodeGraphNodeExecutor}
79
- * because it needs the engine's `codeSandboxEvaluator`.
38
+ * - `core.flow.*` — flow-control kinds (map, delay, return, merge, if,
39
+ * parallel, errorBoundary, humanApproval). The `core.flow.code`,
40
+ * `core.flow.log`, and `core.flow.switch` kinds are registered in
41
+ * `onEngineCreated` via their real executors because Code and Switch
42
+ * need the engine's `codeSandboxEvaluator`.
80
43
  * - `core.agent` — agent node.
81
44
  * - `core.loop.foreach`, `core.loop.while`, `core.loop.until` — loop executors
82
45
  * (registered after the engine is created via `onEngineCreated`).
@@ -118,6 +81,8 @@ export function createDemoEngineConfig() {
118
81
  registry.register("core.loop.while", new WhileGraphNodeExecutor(engine));
119
82
  registry.register("core.loop.until", new UntilGraphNodeExecutor(engine));
120
83
  registry.register("core.flow.code", new CodeGraphNodeExecutor(engine));
84
+ registry.register("core.flow.log", new LogGraphNodeExecutor());
85
+ registry.register("core.flow.switch", new SwitchGraphNodeExecutor(engine));
121
86
  },
122
87
  };
123
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GraphExecutorRegistryFactory.js","sourceRoot":"","sources":["../../../../src/nest/graph/GraphExecutorRegistryFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,yBAAyB,EAKzB,4BAA4B,EAC5B,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,8BAA8B,GAC/B,+BAAoB;AAYrB,MAAM,WAAW,GAA+B;IAC9C,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC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,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;YACvE,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAE,IAAI,oBAAoB,EAAE,CAAC,CAAC;YAC/D,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,EAAE,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7E,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,45 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { ModelService, service } from "@decaf-ts/core";
11
+ import { GraphExecutionResultModel } from "./GraphExecutionResultModel.js";
12
+ let GraphResultService = class GraphResultService extends ModelService {
13
+ constructor() {
14
+ super(GraphExecutionResultModel);
15
+ }
16
+ async saveResult(result, ...args) {
17
+ const { ctxArgs } = (await this.logCtx(args, "saveResult", true)).for(this.saveResult);
18
+ const model = new GraphExecutionResultModel({
19
+ runId: result.runId,
20
+ workflowId: result.workflowId,
21
+ status: result.status,
22
+ inputs: result.inputs,
23
+ outputs: result.outputs,
24
+ nodeResults: result.nodeResults,
25
+ startedAt: result.startedAt,
26
+ finishedAt: result.finishedAt,
27
+ });
28
+ return this.create(model, ...ctxArgs);
29
+ }
30
+ async findByRunId(runId, ...args) {
31
+ const { ctxArgs } = (await this.logCtx(args, "findByRunId", true)).for(this.findByRunId);
32
+ try {
33
+ return (await this.read(runId, ...ctxArgs));
34
+ }
35
+ catch {
36
+ return null;
37
+ }
38
+ }
39
+ };
40
+ GraphResultService = __decorate([
41
+ service(GraphExecutionResultModel),
42
+ __metadata("design:paramtypes", [])
43
+ ], GraphResultService);
44
+ export { GraphResultService };
45
+ //# sourceMappingURL=GraphResultService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphResultService.js","sourceRoot":"","sources":["../../../../src/nest/graph/GraphResultService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAyC,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,yBAAyB,EAAE,uCAAoC;AAIjE,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,YAAuC;IAC7E;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,UAAU,CACd,MAA4B,EAC5B,GAAG,IAAiC;QAEpC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvF,MAAM,KAAK,GAAG,IAAI,yBAAyB,CAAC;YAC1C,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,WAAW,EAAE,MAAM,CAAC,WAAsC;YAC1D,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,WAAW,CACf,KAAa,EACb,GAAG,IAAiC;QAEpC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzF,IAAI,CAAC;YACH,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,CAA8B,CAAC;QAC3E,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAA;AAlCY,kBAAkB;IAD9B,OAAO,CAAC,yBAAyB,CAAC;;GACtB,kBAAkB,CAkC9B"}
@@ -0,0 +1,35 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Model, model } from "@decaf-ts/decorator-validation";
11
+ import { column, pk, table } from "@decaf-ts/core";
12
+ let GraphWorkflowModel = class GraphWorkflowModel extends Model {
13
+ constructor(arg) {
14
+ super(arg);
15
+ }
16
+ };
17
+ __decorate([
18
+ pk({ type: String, generated: false }),
19
+ __metadata("design:type", String)
20
+ ], GraphWorkflowModel.prototype, "workflowId", void 0);
21
+ __decorate([
22
+ column(),
23
+ __metadata("design:type", Object)
24
+ ], GraphWorkflowModel.prototype, "snapshot", void 0);
25
+ __decorate([
26
+ column(),
27
+ __metadata("design:type", Date)
28
+ ], GraphWorkflowModel.prototype, "updatedAt", void 0);
29
+ GraphWorkflowModel = __decorate([
30
+ table("graph_workflow_snapshot"),
31
+ model(),
32
+ __metadata("design:paramtypes", [Object])
33
+ ], GraphWorkflowModel);
34
+ export { GraphWorkflowModel };
35
+ //# sourceMappingURL=GraphWorkflowModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphWorkflowModel.js","sourceRoot":"","sources":["../../../../src/nest/graph/GraphWorkflowModel.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAiB,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAI5C,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,KAAK;IAU3C,YAAY,GAAkC;QAC5C,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AAXC;IADC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;sDACnB;AAGpB;IADC,MAAM,EAAE;;oDAC0B;AAGnC;IADC,MAAM,EAAE;8BACG,IAAI;qDAAC;AARN,kBAAkB;IAF9B,KAAK,CAAC,yBAAyB,CAAC;IAChC,KAAK,EAAE;;GACK,kBAAkB,CAa9B"}
@@ -0,0 +1,53 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { ModelService, service } from "@decaf-ts/core";
11
+ import { GraphWorkflowModel } from "./GraphWorkflowModel.js";
12
+ let GraphWorkflowService = class GraphWorkflowService extends ModelService {
13
+ constructor() {
14
+ super(GraphWorkflowModel);
15
+ }
16
+ async saveSnapshot(workflowId, snapshot, ...args) {
17
+ const { ctxArgs } = (await this.logCtx(args, "saveSnapshot", true)).for(this.saveSnapshot);
18
+ const now = new Date();
19
+ let existing;
20
+ try {
21
+ existing = (await this.read(workflowId, ...ctxArgs));
22
+ }
23
+ catch {
24
+ existing = null;
25
+ }
26
+ if (existing) {
27
+ existing.snapshot = snapshot;
28
+ existing.updatedAt = now;
29
+ return this.update(existing, ...ctxArgs);
30
+ }
31
+ const model = new GraphWorkflowModel({
32
+ workflowId,
33
+ snapshot,
34
+ updatedAt: now,
35
+ });
36
+ return this.create(model, ...ctxArgs);
37
+ }
38
+ async loadSnapshot(workflowId, ...args) {
39
+ const { ctxArgs } = (await this.logCtx(args, "loadSnapshot", true)).for(this.loadSnapshot);
40
+ try {
41
+ return (await this.read(workflowId, ...ctxArgs));
42
+ }
43
+ catch {
44
+ return null;
45
+ }
46
+ }
47
+ };
48
+ GraphWorkflowService = __decorate([
49
+ service(GraphWorkflowModel),
50
+ __metadata("design:paramtypes", [])
51
+ ], GraphWorkflowService);
52
+ export { GraphWorkflowService };
53
+ //# sourceMappingURL=GraphWorkflowService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphWorkflowService.js","sourceRoot":"","sources":["../../../../src/nest/graph/GraphWorkflowService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAyC,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,gCAA6B;AAGnD,IAAM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YACH,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC,CAA8B,CAAC;QAChF,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAA;AA7CY,oBAAoB;IADhC,OAAO,CAAC,kBAAkB,CAAC;;GACf,oBAAoB,CA6ChC"}
@@ -1,10 +1,7 @@
1
- /**
2
- * @module integrations/nest/graph
3
- * @summary NestJS graph execution backend module.
4
- * @description Server-side hosting for the Decaf graph execution engine. Exposes REST endpoints for triggering execution and retrieving persisted results, plus an SSE endpoint for streaming execution events. Designed to be consumed by for-angular via for-http's `ServerEventConnector`.
5
- */
6
1
  export * from "./GraphExecutionResultModel.js";
7
- export * from "./GraphExecutionResultRepository.js";
2
+ export * from "./GraphResultService.js";
3
+ export * from "./GraphWorkflowModel.js";
4
+ export * from "./GraphWorkflowService.js";
8
5
  export * from "./GraphExecutorRegistryFactory.js";
9
6
  export * from "./GraphExecutionController.js";
10
7
  export * from "./GraphExecutionModule.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/nest/graph/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+CAA4C;AAC5C,oDAAiD;AACjD,kDAA+C;AAC/C,8CAA2C;AAC3C,0CAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/nest/graph/index.ts"],"names":[],"mappings":"AAAA,+CAA4C;AAC5C,wCAAqC;AACrC,wCAAqC;AACrC,0CAAuC;AACvC,kDAA+C;AAC/C,8CAA2C;AAC3C,0CAAuC"}
@@ -13,7 +13,7 @@ import { GraphExecutionModule } from "./GraphExecutionModule.js";
13
13
  async function bootstrap() {
14
14
  const port = Number(process.env["GRAPH_BACKEND_PORT"] ?? process.argv[2] ?? 3000);
15
15
  const app = await NestFactory.create(GraphExecutionModule.forRoot());
16
- app.enableCors();
16
+ app.enableCors({ origin: true, credentials: true });
17
17
  await app.listen(port);
18
18
  console.log(`[graph-backend] NestJS graph execution server listening on http://localhost:${port}`);
19
19
  console.log(`[graph-backend] POST /graph/execute`);
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/nest/graph/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,kCAA+B;AAE9D,KAAK,UAAU,SAAS;IACtB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;IAElF,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,GAAG,CAAC,UAAU,EAAE,CAAC;IACjB,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAGvB,OAAO,CAAC,GAAG,CAAC,+EAA+E,IAAI,EAAE,CAAC,CAAC;IAEnG,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IAEvD,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAE5D,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAExB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/nest/graph/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,kCAA+B;AAE9D,KAAK,UAAU,SAAS;IACtB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;IAElF,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAGvB,OAAO,CAAC,GAAG,CAAC,+EAA+E,IAAI,EAAE,CAAC,CAAC;IAEnG,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IAEvD,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAE5D,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAExB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -4,9 +4,10 @@
4
4
  * @description Executes user-authored JS/TS in a restricted sandbox via the
5
5
  * pluggable {@link CodeSandboxEvaluator}. The sandbox enforces the Code Node
6
6
  * restrictions: no imports, no requires, pure functions only (no system API
7
- * access). The executor reads the code, language, and timeout from the node's
8
- * graph metadata, resolves the sandbox context from the node's input values
9
- * and execution context, invokes the evaluator, and returns the result on the
7
+ * access). The executor reads the code from the node's `code` input port
8
+ * (spliced from {@link CodeInputSchema}), the timeout from the node's graph
9
+ * metadata, resolves the sandbox context from the node's input values and
10
+ * execution context, invokes the evaluator, and returns the result on the
10
11
  * `result` output port.
11
12
  */
12
13
  import type { GraphNodeExecutor } from "./GraphNodeExecutor.d.cts";
@@ -22,17 +23,17 @@ import type { GraphExecutionValues } from "../types.d.cts";
22
23
  * no evaluator is registered, the executor throws
23
24
  * `GRAPH_CODE_SANDBOX_NOT_CONFIGURED`.
24
25
  *
26
+ * The code is read from the `code` input port (spliced from
27
+ * {@link CodeInputSchema}). The language is hardcoded to `"javascript"` for
28
+ * now (the `language` field on `CodeInputSchema` has no `@input` so it is not
29
+ * a port and not wired). The timeout is read from `graph.metadata.timeoutMs`.
30
+ *
25
31
  * The sandbox context exposes:
26
- * - `$input` — the value on the node's `input` port (or the full input object
27
- * as a fallback when no `input` port is present).
28
- * - `$vars` — workflow variables (sourced from `context.metadata.vars` when
29
- * the engine populates it).
30
- * - `$item` / `$index` — current loop item and index (sourced from
31
- * `context.metadata` when the node executes inside a foreach body).
32
- * - `$node` — outputs of upstream nodes (sourced from
33
- * `context.metadata.nodes` when available).
34
- * - `$output` — the current draft output (sourced from
35
- * `context.metadata.output`).
32
+ * - `$input` — the full input values object (all resolved port values).
33
+ * - `$vars` — workflow variables (sourced from `context.metadata.vars`).
34
+ * - `$item` / `$index` — current loop item and index.
35
+ * - `$node` — outputs of upstream nodes.
36
+ * - `$output` — the current draft output.
36
37
  *
37
38
  * The evaluator's return value is forwarded verbatim on the `result` output
38
39
  * port.
@@ -42,7 +43,7 @@ export declare class CodeGraphNodeExecutor implements GraphNodeExecutor {
42
43
  /**
43
44
  * @param engine - The graph execution engine (or any object exposing the
44
45
  * optional `codeSandboxEvaluator`). This mirrors the pattern used by
45
- * {@link SwitchGraphNodeExecutor} for code conditions.
46
+ * {@link SwitchGraphNodeExecutor} for code conditions.
46
47
  */
47
48
  constructor(engine?: {
48
49
  codeSandboxEvaluator?: CodeSandboxEvaluator;
@@ -52,9 +53,8 @@ export declare class CodeGraphNodeExecutor implements GraphNodeExecutor {
52
53
  * Builds the {@link CodeSandboxContext} from the executor input and the
53
54
  * graph execution context.
54
55
  *
55
- * The `$input` value is resolved from the node's `input` port. When the node
56
- * has no explicit `input` port, the full input values object is used as
57
- * `$input` so the code can still access every resolved port value.
56
+ * The `$input` value is the full input values object so the code can access
57
+ * every resolved port value (including `code` itself via `$input.code`).
58
58
  *
59
59
  * The `$vars`, `$item`, `$index`, `$node`, and `$output` values are sourced
60
60
  * from `context.metadata` — the engine (or a wrapping loop executor) may
@@ -4,9 +4,10 @@
4
4
  * @description Executes user-authored JS/TS in a restricted sandbox via the
5
5
  * pluggable {@link CodeSandboxEvaluator}. The sandbox enforces the Code Node
6
6
  * restrictions: no imports, no requires, pure functions only (no system API
7
- * access). The executor reads the code, language, and timeout from the node's
8
- * graph metadata, resolves the sandbox context from the node's input values
9
- * and execution context, invokes the evaluator, and returns the result on the
7
+ * access). The executor reads the code from the node's `code` input port
8
+ * (spliced from {@link CodeInputSchema}), the timeout from the node's graph
9
+ * metadata, resolves the sandbox context from the node's input values and
10
+ * execution context, invokes the evaluator, and returns the result on the
10
11
  * `result` output port.
11
12
  */
12
13
  import type { GraphNodeExecutor } from "./GraphNodeExecutor.d.mts";
@@ -22,17 +23,17 @@ import type { GraphExecutionValues } from "../types.d.mts";
22
23
  * no evaluator is registered, the executor throws
23
24
  * `GRAPH_CODE_SANDBOX_NOT_CONFIGURED`.
24
25
  *
26
+ * The code is read from the `code` input port (spliced from
27
+ * {@link CodeInputSchema}). The language is hardcoded to `"javascript"` for
28
+ * now (the `language` field on `CodeInputSchema` has no `@input` so it is not
29
+ * a port and not wired). The timeout is read from `graph.metadata.timeoutMs`.
30
+ *
25
31
  * The sandbox context exposes:
26
- * - `$input` — the value on the node's `input` port (or the full input object
27
- * as a fallback when no `input` port is present).
28
- * - `$vars` — workflow variables (sourced from `context.metadata.vars` when
29
- * the engine populates it).
30
- * - `$item` / `$index` — current loop item and index (sourced from
31
- * `context.metadata` when the node executes inside a foreach body).
32
- * - `$node` — outputs of upstream nodes (sourced from
33
- * `context.metadata.nodes` when available).
34
- * - `$output` — the current draft output (sourced from
35
- * `context.metadata.output`).
32
+ * - `$input` — the full input values object (all resolved port values).
33
+ * - `$vars` — workflow variables (sourced from `context.metadata.vars`).
34
+ * - `$item` / `$index` — current loop item and index.
35
+ * - `$node` — outputs of upstream nodes.
36
+ * - `$output` — the current draft output.
36
37
  *
37
38
  * The evaluator's return value is forwarded verbatim on the `result` output
38
39
  * port.
@@ -42,7 +43,7 @@ export declare class CodeGraphNodeExecutor implements GraphNodeExecutor {
42
43
  /**
43
44
  * @param engine - The graph execution engine (or any object exposing the
44
45
  * optional `codeSandboxEvaluator`). This mirrors the pattern used by
45
- * {@link SwitchGraphNodeExecutor} for code conditions.
46
+ * {@link SwitchGraphNodeExecutor} for code conditions.
46
47
  */
47
48
  constructor(engine?: {
48
49
  codeSandboxEvaluator?: CodeSandboxEvaluator;
@@ -52,9 +53,8 @@ export declare class CodeGraphNodeExecutor implements GraphNodeExecutor {
52
53
  * Builds the {@link CodeSandboxContext} from the executor input and the
53
54
  * graph execution context.
54
55
  *
55
- * The `$input` value is resolved from the node's `input` port. When the node
56
- * has no explicit `input` port, the full input values object is used as
57
- * `$input` so the code can still access every resolved port value.
56
+ * The `$input` value is the full input values object so the code can access
57
+ * every resolved port value (including `code` itself via `$input.code`).
58
58
  *
59
59
  * The `$vars`, `$item`, `$index`, `$node`, and `$output` values are sourced
60
60
  * from `context.metadata` — the engine (or a wrapping loop executor) may
@@ -32,6 +32,29 @@ export interface CodeSandboxContext {
32
32
  index?: number;
33
33
  /** Outputs of upstream nodes, accessible as `$node["Name"].output`. */
34
34
  nodes?: Record<string, Record<string, unknown>>;
35
+ /**
36
+ * Optional logger that receives `console.log/warn/debug/error` calls from
37
+ * inside the sandbox. When provided, a `console` object is injected into
38
+ * the isolate whose methods forward to this logger.
39
+ */
40
+ logger?: SandboxLogger;
41
+ }
42
+ /**
43
+ * Minimal logger interface the sandbox can call without importing the full
44
+ * Decaf logging package (keeps the interface frontend-safe). Mirrors the
45
+ * methods on `@decaf-ts/logging`'s `Logger`.
46
+ */
47
+ export interface SandboxLogger {
48
+ benchmark(msg: string, meta?: unknown): void;
49
+ fatal(msg: string, meta?: unknown): void;
50
+ critical(msg: string, meta?: unknown): void;
51
+ silly(msg: string, meta?: unknown): void;
52
+ verbose(msg: string, meta?: unknown): void;
53
+ info(msg: string, meta?: unknown): void;
54
+ debug(msg: string, meta?: unknown): void;
55
+ error(msg: string, meta?: unknown): void;
56
+ warn(msg: string, meta?: unknown): void;
57
+ trace(msg: string, meta?: unknown): void;
35
58
  }
36
59
  /**
37
60
  * Pluggable evaluator for code-based conditions and Code Node transforms.
@@ -32,6 +32,29 @@ export interface CodeSandboxContext {
32
32
  index?: number;
33
33
  /** Outputs of upstream nodes, accessible as `$node["Name"].output`. */
34
34
  nodes?: Record<string, Record<string, unknown>>;
35
+ /**
36
+ * Optional logger that receives `console.log/warn/debug/error` calls from
37
+ * inside the sandbox. When provided, a `console` object is injected into
38
+ * the isolate whose methods forward to this logger.
39
+ */
40
+ logger?: SandboxLogger;
41
+ }
42
+ /**
43
+ * Minimal logger interface the sandbox can call without importing the full
44
+ * Decaf logging package (keeps the interface frontend-safe). Mirrors the
45
+ * methods on `@decaf-ts/logging`'s `Logger`.
46
+ */
47
+ export interface SandboxLogger {
48
+ benchmark(msg: string, meta?: unknown): void;
49
+ fatal(msg: string, meta?: unknown): void;
50
+ critical(msg: string, meta?: unknown): void;
51
+ silly(msg: string, meta?: unknown): void;
52
+ verbose(msg: string, meta?: unknown): void;
53
+ info(msg: string, meta?: unknown): void;
54
+ debug(msg: string, meta?: unknown): void;
55
+ error(msg: string, meta?: unknown): void;
56
+ warn(msg: string, meta?: unknown): void;
57
+ trace(msg: string, meta?: unknown): void;
35
58
  }
36
59
  /**
37
60
  * Pluggable evaluator for code-based conditions and Code Node transforms.
@@ -93,6 +93,12 @@ export declare class GraphExecutionEngine implements Observable<[GraphExecutionO
93
93
  private executeNode;
94
94
  /**
95
95
  * Resolves a node's input values from incoming edges.
96
+ *
97
+ * When multiple edges target the same port, their values are spread into the
98
+ * top-level inputs keyed by each edge's `sourcePort`. This allows multiple
99
+ * workflow input badges to connect to a single port (e.g. the Code node's
100
+ * `data` port) and have all values accessible directly as
101
+ * `$input.{sourcePort}` (e.g. `$input.count`, `$input.text`).
96
102
  */
97
103
  private resolveNodeInputs;
98
104
  /**
@@ -93,6 +93,12 @@ export declare class GraphExecutionEngine implements Observable<[GraphExecutionO
93
93
  private executeNode;
94
94
  /**
95
95
  * Resolves a node's input values from incoming edges.
96
+ *
97
+ * When multiple edges target the same port, their values are spread into the
98
+ * top-level inputs keyed by each edge's `sourcePort`. This allows multiple
99
+ * workflow input badges to connect to a single port (e.g. the Code node's
100
+ * `data` port) and have all values accessible directly as
101
+ * `$input.{sourcePort}` (e.g. `$input.count`, `$input.text`).
96
102
  */
97
103
  private resolveNodeInputs;
98
104
  /**
@@ -42,4 +42,22 @@ export declare class IsolatedVmCodeSandboxEvaluator implements CodeSandboxEvalua
42
42
  */
43
43
  constructor(defaultTimeoutMs?: number, defaultMemoryMb?: number);
44
44
  evaluate(ctx: CodeSandboxContext): Promise<unknown>;
45
+ /**
46
+ * Injects a `console` object into the isolate whose methods forward to the
47
+ * Context logger (bound to `runId`).
48
+ *
49
+ * Every standard `console.*` method is supported:
50
+ * `log`, `info`, `warn`, `error`, `debug`, `trace`, `dir`, `dirxml`,
51
+ * `table`, `group`, `groupCollapsed`, `groupEnd`, `time`, `timeEnd`,
52
+ * `timeLog`, `assert`, `count`, `countReset`, `clear`.
53
+ *
54
+ * Arguments are serialised inside the isolate (via `JSON.stringify` with a
55
+ * safe fallback) before being passed across the isolate boundary, because
56
+ * `isolated-vm` cannot copy arbitrary host objects.
57
+ *
58
+ * @param jail - The isolate's global object.
59
+ * @param logger - The Context logger that receives the forwarded calls.
60
+ * @param context - The isolate context (for running the init script).
61
+ */
62
+ private injectConsole;
45
63
  }
@@ -42,4 +42,22 @@ export declare class IsolatedVmCodeSandboxEvaluator implements CodeSandboxEvalua
42
42
  */
43
43
  constructor(defaultTimeoutMs?: number, defaultMemoryMb?: number);
44
44
  evaluate(ctx: CodeSandboxContext): Promise<unknown>;
45
+ /**
46
+ * Injects a `console` object into the isolate whose methods forward to the
47
+ * Context logger (bound to `runId`).
48
+ *
49
+ * Every standard `console.*` method is supported:
50
+ * `log`, `info`, `warn`, `error`, `debug`, `trace`, `dir`, `dirxml`,
51
+ * `table`, `group`, `groupCollapsed`, `groupEnd`, `time`, `timeEnd`,
52
+ * `timeLog`, `assert`, `count`, `countReset`, `clear`.
53
+ *
54
+ * Arguments are serialised inside the isolate (via `JSON.stringify` with a
55
+ * safe fallback) before being passed across the isolate boundary, because
56
+ * `isolated-vm` cannot copy arbitrary host objects.
57
+ *
58
+ * @param jail - The isolate's global object.
59
+ * @param logger - The Context logger that receives the forwarded calls.
60
+ * @param context - The isolate context (for running the init script).
61
+ */
62
+ private injectConsole;
45
63
  }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @module integrations/graph/execution/LogGraphNodeExecutor
3
+ * @summary Executor for the Log flow-control node.
4
+ * @description Logs the input value via the execution context's logger and
5
+ * forwards it unchanged on the `logged` output port. Useful for debugging,
6
+ * audit trails, and discard/side-effect branches in a workflow.
7
+ */
8
+ import type { GraphNodeExecutor } from "./GraphNodeExecutor.d.cts";
9
+ import type { GraphExecutionContext } from "./GraphExecutionContext.d.cts";
10
+ import type { GraphExecutionValues } from "../types.d.cts";
11
+ /**
12
+ * Executor for `core.flow.log` nodes.
13
+ *
14
+ * Reads the `value` input port, logs it through `context.log()`, and returns
15
+ * it unchanged on the `logged` output port.
16
+ */
17
+ export declare class LogGraphNodeExecutor implements GraphNodeExecutor {
18
+ execute(input: GraphExecutionValues, context: GraphExecutionContext): Promise<GraphExecutionValues>;
19
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @module integrations/graph/execution/LogGraphNodeExecutor
3
+ * @summary Executor for the Log flow-control node.
4
+ * @description Logs the input value via the execution context's logger and
5
+ * forwards it unchanged on the `logged` output port. Useful for debugging,
6
+ * audit trails, and discard/side-effect branches in a workflow.
7
+ */
8
+ import type { GraphNodeExecutor } from "./GraphNodeExecutor.d.mts";
9
+ import type { GraphExecutionContext } from "./GraphExecutionContext.d.mts";
10
+ import type { GraphExecutionValues } from "../types.d.mts";
11
+ /**
12
+ * Executor for `core.flow.log` nodes.
13
+ *
14
+ * Reads the `value` input port, logs it through `context.log()`, and returns
15
+ * it unchanged on the `logged` output port.
16
+ */
17
+ export declare class LogGraphNodeExecutor implements GraphNodeExecutor {
18
+ execute(input: GraphExecutionValues, context: GraphExecutionContext): Promise<GraphExecutionValues>;
19
+ }
@@ -15,8 +15,9 @@ import type { CodeSandboxEvaluator } from "./CodeSandboxEvaluator.d.cts";
15
15
  * Executor for `core.flow.switch` nodes.
16
16
  *
17
17
  * Evaluates each case's condition in order and routes the input to the
18
- * first matching case's output port. When no case matches, routes to the
19
- * `default` output port.
18
+ * first matching case's output port. When no case matches:
19
+ * - If `hasDefault` is `true`, routes to the `default` output port.
20
+ * - If `hasDefault` is `false` (the default), throws `GRAPH_SWITCH_NO_MATCH`.
20
21
  *
21
22
  * Condition evaluation:
22
23
  * - `ConditionExpression` — evaluated via {@link ConditionExpressionEvaluator}.
@@ -15,8 +15,9 @@ import type { CodeSandboxEvaluator } from "./CodeSandboxEvaluator.d.mts";
15
15
  * Executor for `core.flow.switch` nodes.
16
16
  *
17
17
  * Evaluates each case's condition in order and routes the input to the
18
- * first matching case's output port. When no case matches, routes to the
19
- * `default` output port.
18
+ * first matching case's output port. When no case matches:
19
+ * - If `hasDefault` is `true`, routes to the `default` output port.
20
+ * - If `hasDefault` is `false` (the default), throws `GRAPH_SWITCH_NO_MATCH`.
20
21
  *
21
22
  * Condition evaluation:
22
23
  * - `ConditionExpression` — evaluated via {@link ConditionExpressionEvaluator}.