@decaf-ts/integrations 0.6.2 → 0.8.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 (123) hide show
  1. package/dist/integrations.cjs +1 -1
  2. package/jest.config.cjs +10 -0
  3. package/lib/cjs/graph/engine/execution/GraphExecutionContext.cjs +23 -2
  4. package/lib/cjs/graph/engine/execution/GraphExecutionContext.cjs.map +1 -1
  5. package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs +76 -0
  6. package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs.map +1 -1
  7. package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs +29 -4
  8. package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs.map +1 -1
  9. package/lib/cjs/graph/index.cjs +1 -0
  10. package/lib/cjs/graph/index.cjs.map +1 -1
  11. package/lib/cjs/graph/log/GraphRunLogger.cjs +142 -0
  12. package/lib/cjs/graph/log/GraphRunLogger.cjs.map +1 -0
  13. package/lib/cjs/graph/log/LogParameters.cjs +73 -0
  14. package/lib/cjs/graph/log/LogParameters.cjs.map +1 -0
  15. package/lib/cjs/graph/shared/GraphExecutionStateMapper.cjs +97 -0
  16. package/lib/cjs/graph/shared/GraphExecutionStateMapper.cjs.map +1 -0
  17. package/lib/cjs/graph/shared/constants.cjs +56 -1
  18. package/lib/cjs/graph/shared/constants.cjs.map +1 -1
  19. package/lib/cjs/graph/shared/index.cjs +9 -1
  20. package/lib/cjs/graph/shared/index.cjs.map +1 -1
  21. package/lib/cjs/graph/shared/nodes/flow-control.cjs +50 -6
  22. package/lib/cjs/graph/shared/nodes/flow-control.cjs.map +1 -1
  23. package/lib/cjs/index.cjs +3 -3
  24. package/lib/cjs/nest/graph/GraphExecutionResultModel.cjs +1 -1
  25. package/lib/cjs/nest/graph/GraphExecutionResultModel.cjs.map +1 -1
  26. package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs +4 -3
  27. package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs.map +1 -1
  28. package/lib/cjs/nest/graph/GraphWorkflowModel.cjs +1 -5
  29. package/lib/cjs/nest/graph/GraphWorkflowModel.cjs.map +1 -1
  30. package/lib/cjs/sftp/aws/AwsSftpService.cjs +120 -0
  31. package/lib/cjs/sftp/aws/AwsSftpService.cjs.map +1 -0
  32. package/lib/cjs/sftp/core/SftpSource.cjs +29 -0
  33. package/lib/cjs/sftp/core/SftpSource.cjs.map +1 -0
  34. package/lib/cjs/sftp/core/index.cjs +19 -0
  35. package/lib/cjs/sftp/core/index.cjs.map +1 -0
  36. package/lib/cjs/sftp/index.cjs +21 -0
  37. package/lib/cjs/sftp/index.cjs.map +1 -0
  38. package/lib/cjs/sftp/ssh2/Ssh2SftpService.cjs +172 -0
  39. package/lib/cjs/sftp/ssh2/Ssh2SftpService.cjs.map +1 -0
  40. package/lib/cjs/user-requests/index.cjs +27 -0
  41. package/lib/cjs/user-requests/index.cjs.map +1 -0
  42. package/lib/esm/graph/engine/execution/GraphExecutionContext.js +23 -2
  43. package/lib/esm/graph/engine/execution/GraphExecutionContext.js.map +1 -1
  44. package/lib/esm/graph/engine/execution/GraphExecutionEngine.js +77 -1
  45. package/lib/esm/graph/engine/execution/GraphExecutionEngine.js.map +1 -1
  46. package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js +29 -4
  47. package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js.map +1 -1
  48. package/lib/esm/graph/index.js +1 -0
  49. package/lib/esm/graph/index.js.map +1 -1
  50. package/lib/esm/graph/log/GraphRunLogger.js +137 -0
  51. package/lib/esm/graph/log/GraphRunLogger.js.map +1 -0
  52. package/lib/esm/graph/log/LogParameters.js +69 -0
  53. package/lib/esm/graph/log/LogParameters.js.map +1 -0
  54. package/lib/esm/graph/shared/GraphExecutionStateMapper.js +91 -0
  55. package/lib/esm/graph/shared/GraphExecutionStateMapper.js.map +1 -0
  56. package/lib/esm/graph/shared/constants.js +82 -3
  57. package/lib/esm/graph/shared/constants.js.map +1 -1
  58. package/lib/esm/graph/shared/index.js +6 -0
  59. package/lib/esm/graph/shared/index.js.map +1 -1
  60. package/lib/esm/graph/shared/nodes/flow-control.js +49 -5
  61. package/lib/esm/graph/shared/nodes/flow-control.js.map +1 -1
  62. package/lib/esm/index.js +3 -3
  63. package/lib/esm/nest/graph/GraphExecutionResultModel.js +3 -3
  64. package/lib/esm/nest/graph/GraphExecutionResultModel.js.map +1 -1
  65. package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js +4 -3
  66. package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js.map +1 -1
  67. package/lib/esm/nest/graph/GraphWorkflowModel.js +3 -7
  68. package/lib/esm/nest/graph/GraphWorkflowModel.js.map +1 -1
  69. package/lib/esm/sftp/aws/AwsSftpService.js +82 -0
  70. package/lib/esm/sftp/aws/AwsSftpService.js.map +1 -0
  71. package/lib/esm/sftp/core/SftpSource.js +23 -0
  72. package/lib/esm/sftp/core/SftpSource.js.map +1 -0
  73. package/lib/esm/sftp/core/index.js +2 -0
  74. package/lib/esm/sftp/core/index.js.map +1 -0
  75. package/lib/esm/sftp/index.js +4 -0
  76. package/lib/esm/sftp/index.js.map +1 -0
  77. package/lib/esm/sftp/ssh2/Ssh2SftpService.js +135 -0
  78. package/lib/esm/sftp/ssh2/Ssh2SftpService.js.map +1 -0
  79. package/lib/esm/user-requests/index.js +10 -0
  80. package/lib/esm/user-requests/index.js.map +1 -0
  81. package/lib/types/graph/engine/execution/GraphExecutionContext.d.cts +12 -2
  82. package/lib/types/graph/engine/execution/GraphExecutionContext.d.mts +12 -2
  83. package/lib/types/graph/engine/execution/GraphExecutionEngine.d.cts +34 -1
  84. package/lib/types/graph/engine/execution/GraphExecutionEngine.d.mts +34 -1
  85. package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.cts +16 -10
  86. package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.mts +16 -10
  87. package/lib/types/graph/index.d.cts +1 -0
  88. package/lib/types/graph/index.d.mts +1 -0
  89. package/lib/types/graph/log/GraphRunLogger.d.cts +72 -0
  90. package/lib/types/graph/log/GraphRunLogger.d.mts +72 -0
  91. package/lib/types/graph/log/LogParameters.d.cts +7 -0
  92. package/lib/types/graph/log/LogParameters.d.mts +7 -0
  93. package/lib/types/graph/shared/GraphExecutionStateMapper.d.cts +66 -0
  94. package/lib/types/graph/shared/GraphExecutionStateMapper.d.mts +66 -0
  95. package/lib/types/graph/shared/constants.d.cts +70 -3
  96. package/lib/types/graph/shared/constants.d.mts +70 -3
  97. package/lib/types/graph/shared/index.d.cts +3 -0
  98. package/lib/types/graph/shared/index.d.mts +3 -0
  99. package/lib/types/graph/shared/nodes/flow-control.d.cts +20 -7
  100. package/lib/types/graph/shared/nodes/flow-control.d.mts +20 -7
  101. package/lib/types/graph/shared/types.d.cts +94 -5
  102. package/lib/types/graph/shared/types.d.mts +94 -5
  103. package/lib/types/index.d.cts +2 -2
  104. package/lib/types/index.d.mts +2 -2
  105. package/lib/types/nest/graph/GraphExecutionResultModel.d.cts +3 -3
  106. package/lib/types/nest/graph/GraphExecutionResultModel.d.mts +3 -3
  107. package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.cts +3 -3
  108. package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.mts +3 -3
  109. package/lib/types/nest/graph/GraphWorkflowModel.d.cts +3 -4
  110. package/lib/types/nest/graph/GraphWorkflowModel.d.mts +3 -4
  111. package/lib/types/sftp/aws/AwsSftpService.d.cts +37 -0
  112. package/lib/types/sftp/aws/AwsSftpService.d.mts +37 -0
  113. package/lib/types/sftp/core/SftpSource.d.cts +40 -0
  114. package/lib/types/sftp/core/SftpSource.d.mts +40 -0
  115. package/lib/types/sftp/core/index.d.cts +1 -0
  116. package/lib/types/sftp/core/index.d.mts +1 -0
  117. package/lib/types/sftp/index.d.cts +3 -0
  118. package/lib/types/sftp/index.d.mts +3 -0
  119. package/lib/types/sftp/ssh2/Ssh2SftpService.d.cts +47 -0
  120. package/lib/types/sftp/ssh2/Ssh2SftpService.d.mts +47 -0
  121. package/lib/types/user-requests/index.d.cts +9 -0
  122. package/lib/types/user-requests/index.d.mts +9 -0
  123. package/package.json +26 -3
@@ -8,4 +8,5 @@
8
8
  * Frontend bundles MUST import from `@decaf-ts/integrations/graph/shared`
9
9
  * instead to avoid pulling in the execution engine.
10
10
  */
11
+ import "./log/LogParameters";
11
12
  export * from "./engine/index.d.mts";
@@ -0,0 +1,72 @@
1
+ import type { Logger, LogMeta, StringLike } from "@decaf-ts/logging";
2
+ import type { GraphExecutionEvent } from "../shared/types.d.cts";
3
+ /**
4
+ * Signature of the context's event emitter used to forward log entries onto
5
+ * the existing graph execution Observable.
6
+ */
7
+ export type GraphLogForwardFn = (event: Partial<GraphExecutionEvent>) => Promise<void>;
8
+ /**
9
+ * Options for constructing a {@link GraphRunLogger}.
10
+ */
11
+ export interface GraphRunLoggerOptions {
12
+ runId: string;
13
+ workflowId: string;
14
+ nodeId: string;
15
+ user?: string | null;
16
+ /**
17
+ * Callback that forwards a structured log entry to the graph execution
18
+ * Observable (emits a `GRAPH_RUN_LOG` event). Errors are swallowed.
19
+ */
20
+ forward: GraphLogForwardFn;
21
+ }
22
+ /**
23
+ * Logger used by graph node executors (`ctx.logger`).
24
+ *
25
+ * Wraps the shared MiniLogger pipeline so the DECAF-48 attributes render as
26
+ * discrete custom attributes in the formatted output, and forwards each
27
+ * structured entry through {@link GraphRunLoggerOptions.forward} so the SSE
28
+ * log channel (`graph.run.log`) receives the level/message/attributes/
29
+ * timestamp payload.
30
+ */
31
+ export declare class GraphRunLogger implements Logger {
32
+ private readonly inner;
33
+ private readonly baseOptions;
34
+ constructor(options: GraphRunLoggerOptions);
35
+ /**
36
+ * Produces the `Partial<LoggingConfig>` carrying the DECAF-48 attributes
37
+ * so the LogParameter descriptors render them (DECAF-9 §4.6).
38
+ */
39
+ private attributeConfig;
40
+ /** Emits a structured log entry synchronously (forward is fire-and-forget). */
41
+ private emit;
42
+ /** @inheritdoc */
43
+ benchmark(msg: StringLike, meta?: LogMeta): void;
44
+ /** @inheritdoc */
45
+ fatal(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
46
+ /** @inheritdoc */
47
+ critical(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
48
+ /** @inheritdoc */
49
+ silly(msg: StringLike, verbosity?: number | LogMeta, meta?: LogMeta): void;
50
+ /** @inheritdoc */
51
+ trace(msg: StringLike, meta?: LogMeta): void;
52
+ /** @inheritdoc */
53
+ verbose(msg: StringLike, verbosity?: number | LogMeta, meta?: LogMeta): void;
54
+ /** @inheritdoc */
55
+ info(msg: StringLike, meta?: LogMeta): void;
56
+ /** @inheritdoc */
57
+ error(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
58
+ /** @inheritdoc */
59
+ warn(msg: StringLike, meta?: LogMeta): void;
60
+ /** @inheritdoc */
61
+ debug(msg: StringLike, meta?: LogMeta): void;
62
+ /** @inheritdoc */
63
+ setConfig(): void;
64
+ /** @inheritdoc */
65
+ for(_method?: string | ((...args: any[]) => any) | {
66
+ new (...args: any[]): any;
67
+ } | object | Partial<any>, _config?: Partial<any>, ..._args: any[]): this;
68
+ /** @inheritdoc */
69
+ clear(): this;
70
+ /** @inheritdoc */
71
+ get root(): string[];
72
+ }
@@ -0,0 +1,72 @@
1
+ import type { Logger, LogMeta, StringLike } from "@decaf-ts/logging";
2
+ import type { GraphExecutionEvent } from "../shared/types.d.mts";
3
+ /**
4
+ * Signature of the context's event emitter used to forward log entries onto
5
+ * the existing graph execution Observable.
6
+ */
7
+ export type GraphLogForwardFn = (event: Partial<GraphExecutionEvent>) => Promise<void>;
8
+ /**
9
+ * Options for constructing a {@link GraphRunLogger}.
10
+ */
11
+ export interface GraphRunLoggerOptions {
12
+ runId: string;
13
+ workflowId: string;
14
+ nodeId: string;
15
+ user?: string | null;
16
+ /**
17
+ * Callback that forwards a structured log entry to the graph execution
18
+ * Observable (emits a `GRAPH_RUN_LOG` event). Errors are swallowed.
19
+ */
20
+ forward: GraphLogForwardFn;
21
+ }
22
+ /**
23
+ * Logger used by graph node executors (`ctx.logger`).
24
+ *
25
+ * Wraps the shared MiniLogger pipeline so the DECAF-48 attributes render as
26
+ * discrete custom attributes in the formatted output, and forwards each
27
+ * structured entry through {@link GraphRunLoggerOptions.forward} so the SSE
28
+ * log channel (`graph.run.log`) receives the level/message/attributes/
29
+ * timestamp payload.
30
+ */
31
+ export declare class GraphRunLogger implements Logger {
32
+ private readonly inner;
33
+ private readonly baseOptions;
34
+ constructor(options: GraphRunLoggerOptions);
35
+ /**
36
+ * Produces the `Partial<LoggingConfig>` carrying the DECAF-48 attributes
37
+ * so the LogParameter descriptors render them (DECAF-9 §4.6).
38
+ */
39
+ private attributeConfig;
40
+ /** Emits a structured log entry synchronously (forward is fire-and-forget). */
41
+ private emit;
42
+ /** @inheritdoc */
43
+ benchmark(msg: StringLike, meta?: LogMeta): void;
44
+ /** @inheritdoc */
45
+ fatal(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
46
+ /** @inheritdoc */
47
+ critical(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
48
+ /** @inheritdoc */
49
+ silly(msg: StringLike, verbosity?: number | LogMeta, meta?: LogMeta): void;
50
+ /** @inheritdoc */
51
+ trace(msg: StringLike, meta?: LogMeta): void;
52
+ /** @inheritdoc */
53
+ verbose(msg: StringLike, verbosity?: number | LogMeta, meta?: LogMeta): void;
54
+ /** @inheritdoc */
55
+ info(msg: StringLike, meta?: LogMeta): void;
56
+ /** @inheritdoc */
57
+ error(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
58
+ /** @inheritdoc */
59
+ warn(msg: StringLike, meta?: LogMeta): void;
60
+ /** @inheritdoc */
61
+ debug(msg: StringLike, meta?: LogMeta): void;
62
+ /** @inheritdoc */
63
+ setConfig(): void;
64
+ /** @inheritdoc */
65
+ for(_method?: string | ((...args: any[]) => any) | {
66
+ new (...args: any[]): any;
67
+ } | object | Partial<any>, _config?: Partial<any>, ..._args: any[]): this;
68
+ /** @inheritdoc */
69
+ clear(): this;
70
+ /** @inheritdoc */
71
+ get root(): string[];
72
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Registers the four DECAF-48 run attributes as log parameter descriptors
3
+ * (nodeId / workflowId / runId / user). Rendered only when keyed with a
4
+ * non-null value so one-shot module imports from other packages never leak
5
+ * empty columns.
6
+ */
7
+ export declare function registerGraphRunLogParameters(): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Registers the four DECAF-48 run attributes as log parameter descriptors
3
+ * (nodeId / workflowId / runId / user). Rendered only when keyed with a
4
+ * non-null value so one-shot module imports from other packages never leak
5
+ * empty columns.
6
+ */
7
+ export declare function registerGraphRunLogParameters(): void;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @module integrations/graph/shared/GraphExecutionStateMapper
3
+ * @summary Maps engine state to the frontend-safe visual-state contract.
4
+ * @description Pure, engine-agnostic helpers that derive
5
+ * {@link GraphVisualState} values from engine execution signals. Frontend
6
+ * bundles may import this from `@decaf-ts/integrations/graph/shared` (no
7
+ * engine runtime dependency); a future Mastra/NestJS driver maps its own
8
+ * runtime states onto {@link GraphVisualState} with the same rules.
9
+ */
10
+ import type { GraphExecutionEvent } from "./types.d.cts";
11
+ import { GraphExecutionStatus, GraphVisualState } from "./constants.d.cts";
12
+ /**
13
+ * Maps an engine execution {@link GraphExecutionStatus} to the shared visual
14
+ * state. `CACHED` collapses onto {@link GraphVisualState.SUCCEEDED} for
15
+ * rendering; `CANCELLED`/`PENDING`/`PLANNING` yield `IDLE`.
16
+ *
17
+ * @param status - The engine execution status, if any.
18
+ * @returns The visual state for the node/edge.
19
+ */
20
+ export declare function mapExecutionStatus(status?: GraphExecutionStatus): GraphVisualState;
21
+ /**
22
+ * Options describing a single node's position within a run (DECAF-48 §4.4).
23
+ */
24
+ export interface GraphVisualStateDerivation {
25
+ /** Whether the node has already executed (any terminal engine status). */
26
+ executed: boolean;
27
+ /** Whether the node is currently running. */
28
+ running: boolean;
29
+ /** Whether the node completed successfully (or from cache). */
30
+ succeeded?: boolean;
31
+ /** Whether the node failed. */
32
+ failed?: boolean;
33
+ /** Number of incoming edges that have completed value routing. */
34
+ completedUpstreams?: number;
35
+ /** Total number of incoming edges for the node. */
36
+ upstreamCount?: number;
37
+ /** Whether the node is reachable from the workflow inputs in the plan. */
38
+ reachable?: boolean;
39
+ /** Whether the whole run has failed (unexecuted nodes then fade/disable). */
40
+ runFailed?: boolean;
41
+ }
42
+ /**
43
+ * Derives the visual state for one node from its execution signals.
44
+ *
45
+ * Rules (DECAF-48 §4.4 / Req-5/Req-6):
46
+ * - currently running → {@link GraphVisualState.RUNNING}
47
+ * - failed → {@link GraphVisualState.FAILED}
48
+ * - executed and succeeded (or from cache) → {@link GraphVisualState.SUCCEEDED}
49
+ * - unexecuted and reachable with incomplete upstream deps → {@link GraphVisualState.BLOCKED}
50
+ * - unexecuted with `runFailed` → {@link GraphVisualState.SKIPPED} (faded/disabled)
51
+ * - otherwise → {@link GraphVisualState.IDLE}
52
+ *
53
+ * @param options - The node execution signals.
54
+ * @returns The derived visual state.
55
+ */
56
+ export declare function deriveNodeVisualState(options: GraphVisualStateDerivation): GraphVisualState;
57
+ /**
58
+ * Translates a {@link GraphExecutionEvent} into a node visual state when the
59
+ * event carries enough information. Used by contract conformance checks and
60
+ * engine-agnostic consumers that derive state from the shared event stream.
61
+ *
62
+ * @param event - The graph execution event.
63
+ * @returns The corresponding {@link GraphVisualState}, or `IDLE` when the
64
+ * event does not indicate a specific visual transition.
65
+ */
66
+ export declare function visualStateOfEvent(event: GraphExecutionEvent): GraphVisualState;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @module integrations/graph/shared/GraphExecutionStateMapper
3
+ * @summary Maps engine state to the frontend-safe visual-state contract.
4
+ * @description Pure, engine-agnostic helpers that derive
5
+ * {@link GraphVisualState} values from engine execution signals. Frontend
6
+ * bundles may import this from `@decaf-ts/integrations/graph/shared` (no
7
+ * engine runtime dependency); a future Mastra/NestJS driver maps its own
8
+ * runtime states onto {@link GraphVisualState} with the same rules.
9
+ */
10
+ import type { GraphExecutionEvent } from "./types.d.mts";
11
+ import { GraphExecutionStatus, GraphVisualState } from "./constants.d.mts";
12
+ /**
13
+ * Maps an engine execution {@link GraphExecutionStatus} to the shared visual
14
+ * state. `CACHED` collapses onto {@link GraphVisualState.SUCCEEDED} for
15
+ * rendering; `CANCELLED`/`PENDING`/`PLANNING` yield `IDLE`.
16
+ *
17
+ * @param status - The engine execution status, if any.
18
+ * @returns The visual state for the node/edge.
19
+ */
20
+ export declare function mapExecutionStatus(status?: GraphExecutionStatus): GraphVisualState;
21
+ /**
22
+ * Options describing a single node's position within a run (DECAF-48 §4.4).
23
+ */
24
+ export interface GraphVisualStateDerivation {
25
+ /** Whether the node has already executed (any terminal engine status). */
26
+ executed: boolean;
27
+ /** Whether the node is currently running. */
28
+ running: boolean;
29
+ /** Whether the node completed successfully (or from cache). */
30
+ succeeded?: boolean;
31
+ /** Whether the node failed. */
32
+ failed?: boolean;
33
+ /** Number of incoming edges that have completed value routing. */
34
+ completedUpstreams?: number;
35
+ /** Total number of incoming edges for the node. */
36
+ upstreamCount?: number;
37
+ /** Whether the node is reachable from the workflow inputs in the plan. */
38
+ reachable?: boolean;
39
+ /** Whether the whole run has failed (unexecuted nodes then fade/disable). */
40
+ runFailed?: boolean;
41
+ }
42
+ /**
43
+ * Derives the visual state for one node from its execution signals.
44
+ *
45
+ * Rules (DECAF-48 §4.4 / Req-5/Req-6):
46
+ * - currently running → {@link GraphVisualState.RUNNING}
47
+ * - failed → {@link GraphVisualState.FAILED}
48
+ * - executed and succeeded (or from cache) → {@link GraphVisualState.SUCCEEDED}
49
+ * - unexecuted and reachable with incomplete upstream deps → {@link GraphVisualState.BLOCKED}
50
+ * - unexecuted with `runFailed` → {@link GraphVisualState.SKIPPED} (faded/disabled)
51
+ * - otherwise → {@link GraphVisualState.IDLE}
52
+ *
53
+ * @param options - The node execution signals.
54
+ * @returns The derived visual state.
55
+ */
56
+ export declare function deriveNodeVisualState(options: GraphVisualStateDerivation): GraphVisualState;
57
+ /**
58
+ * Translates a {@link GraphExecutionEvent} into a node visual state when the
59
+ * event carries enough information. Used by contract conformance checks and
60
+ * engine-agnostic consumers that derive state from the shared event stream.
61
+ *
62
+ * @param event - The graph execution event.
63
+ * @returns The corresponding {@link GraphVisualState}, or `IDLE` when the
64
+ * event does not indicate a specific visual transition.
65
+ */
66
+ export declare function visualStateOfEvent(event: GraphExecutionEvent): GraphVisualState;
@@ -2,9 +2,14 @@
2
2
  * @module integrations/graph/shared/constants
3
3
  * @summary Frontend-safe graph constants and enums.
4
4
  * @description Constants and enumerations that are safe to import from a
5
- * frontend bundle (no engine runtime dependency). The execution-status and
6
- * event-type enums live here because the frontend renders status badges and
7
- * event timelines and must not pull in the execution engine.
5
+ * frontend bundle (no engine runtime dependency). Alongside the existing
6
+ * execution-status and event-type enums (rendered as status badges and event
7
+ * timelines), this module carries the DECAF-48 visual-state contract: the
8
+ * frontend-safe {@link GraphVisualState} enum, the `graph.run.log` /
9
+ * `graph.run.state` SSE topic constants, the run-log attribute keys
10
+ * ({@link GraphLogAttribute}), and the `NODE_STATE_CHANGED` /
11
+ * `EDGE_STATE_CHANGED` / `GRAPH_RUN_LOG` event types. The frontend must not
12
+ * pull in the execution engine.
8
13
  */
9
14
  /**
10
15
  * Execution status for a workflow or individual node.
@@ -19,8 +24,64 @@ export declare enum GraphExecutionStatus {
19
24
  CANCELLED = "cancelled",
20
25
  CACHED = "cached"
21
26
  }
27
+ /**
28
+ * Visual execution state for a node or edge on the workflow canvas.
29
+ *
30
+ * Frontend-safe (DECAF-48 §4.4): a superset of {@link GraphExecutionStatus}
31
+ * normalised for rendering. `BLOCKED` is derived from the plan and execution
32
+ * events (waiting on upstream dependencies), not emitted as an engine status.
33
+ * `SKIPPED` is the post-failure "unexecuted/disabled" visual state.
34
+ */
35
+ export declare enum GraphVisualState {
36
+ IDLE = "idle",
37
+ RUNNING = "running",
38
+ BLOCKED = "blocked",
39
+ SUCCEEDED = "succeeded",
40
+ FAILED = "failed",
41
+ SKIPPED = "skipped"
42
+ }
43
+ /**
44
+ * Namespace root for graph run SSE topics (DECAF-48 §4.2). A subscription
45
+ * filters on these granular topics before `observer.next(...)`.
46
+ */
47
+ export declare const GRAPH_RUN_TOPIC = "graph.run";
48
+ /**
49
+ * SSE sub-topic streaming per-node log lines during a run.
50
+ */
51
+ export declare const GRAPH_RUN_LOG_TOPIC = "graph.run.log";
52
+ /**
53
+ * SSE sub-topic streaming node/edge execution-state updates during a run.
54
+ */
55
+ export declare const GRAPH_RUN_STATE_TOPIC = "graph.run.state";
56
+ /**
57
+ * Logger custom-attribute keys attached to every run log line via
58
+ * DECAF-9 `logger.for({...})` (DECAF-48 §4.3). Rendered as discrete columns
59
+ * (not buried in the message string).
60
+ */
61
+ export declare enum GraphLogAttribute {
62
+ NODE_ID = "nodeId",
63
+ WORKFLOW_ID = "workflowId",
64
+ RUN_ID = "runId",
65
+ USER = "user"
66
+ }
67
+ /**
68
+ * Namespace topic helper for a graph execution event.
69
+ *
70
+ * Log-carrier events resolve to `graph.run.log`; node/edge execution-state
71
+ * events resolve to `graph.run.state`; everything else stays under the shared
72
+ * `graph.run` topic and is only delivered to subscribers that match it.
73
+ *
74
+ * @param eventType - The graph execution event type to scope to a topic.
75
+ * @returns The SSE topic constant for the given event type.
76
+ */
77
+ export declare function graphRunTopicOf(eventType: GraphExecutionEventType): string;
22
78
  /**
23
79
  * Event types emitted through the graph execution observer pipeline.
80
+ *
81
+ * DECAF-48 extends this set with the visual-state and run-log event types the
82
+ * engine emits on the existing Observable: {@link GraphExecutionEventType.NODE_STATE_CHANGED},
83
+ * {@link GraphExecutionEventType.EDGE_STATE_CHANGED} and
84
+ * {@link GraphExecutionEventType.GRAPH_RUN_LOG}.
24
85
  */
25
86
  export declare enum GraphExecutionEventType {
26
87
  WORKFLOW_STARTED = "workflow.started",
@@ -37,7 +98,13 @@ export declare enum GraphExecutionEventType {
37
98
  NODE_CACHE_HIT = "node.cacheHit",
38
99
  NODE_PINNED = "node.pinned",
39
100
  NODE_UNPINNED = "node.unpinned",
101
+ /** Node execution-state transition carrying a `GraphNodeStateChangedPayload` (DECAF-48 §4.4). */
102
+ NODE_STATE_CHANGED = "node.stateChanged",
40
103
  EDGE_VALUE_ROUTED = "edge.valueRouted",
104
+ /** Edge execution-state transition carrying a `GraphEdgeStateChangedPayload` (DECAF-48 §4.4). */
105
+ EDGE_STATE_CHANGED = "edge.stateChanged",
106
+ /** Structured run log line carrying a `GraphRunLogEntry` (DECAF-48 §4.3). */
107
+ GRAPH_RUN_LOG = "graph.run.log",
41
108
  LOOP_STARTED = "loop.started",
42
109
  LOOP_ITERATION_STARTED = "loop.iteration.started",
43
110
  LOOP_ITERATION_COMPLETED = "loop.iteration.completed",
@@ -2,9 +2,14 @@
2
2
  * @module integrations/graph/shared/constants
3
3
  * @summary Frontend-safe graph constants and enums.
4
4
  * @description Constants and enumerations that are safe to import from a
5
- * frontend bundle (no engine runtime dependency). The execution-status and
6
- * event-type enums live here because the frontend renders status badges and
7
- * event timelines and must not pull in the execution engine.
5
+ * frontend bundle (no engine runtime dependency). Alongside the existing
6
+ * execution-status and event-type enums (rendered as status badges and event
7
+ * timelines), this module carries the DECAF-48 visual-state contract: the
8
+ * frontend-safe {@link GraphVisualState} enum, the `graph.run.log` /
9
+ * `graph.run.state` SSE topic constants, the run-log attribute keys
10
+ * ({@link GraphLogAttribute}), and the `NODE_STATE_CHANGED` /
11
+ * `EDGE_STATE_CHANGED` / `GRAPH_RUN_LOG` event types. The frontend must not
12
+ * pull in the execution engine.
8
13
  */
9
14
  /**
10
15
  * Execution status for a workflow or individual node.
@@ -19,8 +24,64 @@ export declare enum GraphExecutionStatus {
19
24
  CANCELLED = "cancelled",
20
25
  CACHED = "cached"
21
26
  }
27
+ /**
28
+ * Visual execution state for a node or edge on the workflow canvas.
29
+ *
30
+ * Frontend-safe (DECAF-48 §4.4): a superset of {@link GraphExecutionStatus}
31
+ * normalised for rendering. `BLOCKED` is derived from the plan and execution
32
+ * events (waiting on upstream dependencies), not emitted as an engine status.
33
+ * `SKIPPED` is the post-failure "unexecuted/disabled" visual state.
34
+ */
35
+ export declare enum GraphVisualState {
36
+ IDLE = "idle",
37
+ RUNNING = "running",
38
+ BLOCKED = "blocked",
39
+ SUCCEEDED = "succeeded",
40
+ FAILED = "failed",
41
+ SKIPPED = "skipped"
42
+ }
43
+ /**
44
+ * Namespace root for graph run SSE topics (DECAF-48 §4.2). A subscription
45
+ * filters on these granular topics before `observer.next(...)`.
46
+ */
47
+ export declare const GRAPH_RUN_TOPIC = "graph.run";
48
+ /**
49
+ * SSE sub-topic streaming per-node log lines during a run.
50
+ */
51
+ export declare const GRAPH_RUN_LOG_TOPIC = "graph.run.log";
52
+ /**
53
+ * SSE sub-topic streaming node/edge execution-state updates during a run.
54
+ */
55
+ export declare const GRAPH_RUN_STATE_TOPIC = "graph.run.state";
56
+ /**
57
+ * Logger custom-attribute keys attached to every run log line via
58
+ * DECAF-9 `logger.for({...})` (DECAF-48 §4.3). Rendered as discrete columns
59
+ * (not buried in the message string).
60
+ */
61
+ export declare enum GraphLogAttribute {
62
+ NODE_ID = "nodeId",
63
+ WORKFLOW_ID = "workflowId",
64
+ RUN_ID = "runId",
65
+ USER = "user"
66
+ }
67
+ /**
68
+ * Namespace topic helper for a graph execution event.
69
+ *
70
+ * Log-carrier events resolve to `graph.run.log`; node/edge execution-state
71
+ * events resolve to `graph.run.state`; everything else stays under the shared
72
+ * `graph.run` topic and is only delivered to subscribers that match it.
73
+ *
74
+ * @param eventType - The graph execution event type to scope to a topic.
75
+ * @returns The SSE topic constant for the given event type.
76
+ */
77
+ export declare function graphRunTopicOf(eventType: GraphExecutionEventType): string;
22
78
  /**
23
79
  * Event types emitted through the graph execution observer pipeline.
80
+ *
81
+ * DECAF-48 extends this set with the visual-state and run-log event types the
82
+ * engine emits on the existing Observable: {@link GraphExecutionEventType.NODE_STATE_CHANGED},
83
+ * {@link GraphExecutionEventType.EDGE_STATE_CHANGED} and
84
+ * {@link GraphExecutionEventType.GRAPH_RUN_LOG}.
24
85
  */
25
86
  export declare enum GraphExecutionEventType {
26
87
  WORKFLOW_STARTED = "workflow.started",
@@ -37,7 +98,13 @@ export declare enum GraphExecutionEventType {
37
98
  NODE_CACHE_HIT = "node.cacheHit",
38
99
  NODE_PINNED = "node.pinned",
39
100
  NODE_UNPINNED = "node.unpinned",
101
+ /** Node execution-state transition carrying a `GraphNodeStateChangedPayload` (DECAF-48 §4.4). */
102
+ NODE_STATE_CHANGED = "node.stateChanged",
40
103
  EDGE_VALUE_ROUTED = "edge.valueRouted",
104
+ /** Edge execution-state transition carrying a `GraphEdgeStateChangedPayload` (DECAF-48 §4.4). */
105
+ EDGE_STATE_CHANGED = "edge.stateChanged",
106
+ /** Structured run log line carrying a `GraphRunLogEntry` (DECAF-48 §4.3). */
107
+ GRAPH_RUN_LOG = "graph.run.log",
41
108
  LOOP_STARTED = "loop.started",
42
109
  LOOP_ITERATION_STARTED = "loop.iteration.started",
43
110
  LOOP_ITERATION_COMPLETED = "loop.iteration.completed",
@@ -15,4 +15,7 @@ import "@decaf-ts/ui-decorators/graph";
15
15
  export { Metadata } from "@decaf-ts/decoration";
16
16
  export * from "./constants.d.cts";
17
17
  export * from "./types.d.cts";
18
+ export * from "./GraphExecutionStateMapper.d.cts";
18
19
  export * from "./nodes/index.d.cts";
20
+ export { GRAPH_VISUAL_STATE_STYLES, graphVisualStyleOf, } from "@decaf-ts/ui-decorators/graph";
21
+ export type { GraphNodeIoMetadata, GraphNodeIoViewMode, GraphVisualStyle, } from "@decaf-ts/ui-decorators/graph";
@@ -15,4 +15,7 @@ import "@decaf-ts/ui-decorators/graph";
15
15
  export { Metadata } from "@decaf-ts/decoration";
16
16
  export * from "./constants.d.mts";
17
17
  export * from "./types.d.mts";
18
+ export * from "./GraphExecutionStateMapper.d.mts";
18
19
  export * from "./nodes/index.d.mts";
20
+ export { GRAPH_VISUAL_STATE_STYLES, graphVisualStyleOf, } from "@decaf-ts/ui-decorators/graph";
21
+ export type { GraphNodeIoMetadata, GraphNodeIoViewMode, GraphVisualStyle, } from "@decaf-ts/ui-decorators/graph";
@@ -1,17 +1,20 @@
1
1
  /**
2
2
  * @module integrations/graph/nodes/flow-control
3
3
  * @summary Production flow-control node kind declarations (DECAF-32 §22.2.2).
4
- * @description Canonical `@node`-decorated classes for the ten ALFRED-5
5
- * flow-control kinds. These are graph-level macros: the engine's planner
6
- * recognises them as ordinary executable nodes (§5.7) but they have no
7
- * built-in executors — downstream projects (e.g. ALFRED) register custom
8
- * executors or compile them into Mastra composition APIs (§22.2.2).
4
+ * @description Canonical `@node`-decorated classes for the ALFRED-5
5
+ * flow-control kinds, plus the DECAF-48 `core.utility.log` Log node. These
6
+ * are graph-level macros: the engine's planner recognises them as ordinary
7
+ * executable nodes (§5.7) but they have no built-in executors — downstream
8
+ * projects (e.g. ALFRED) register custom executors or compile them into
9
+ * Mastra composition APIs (§22.2.2). The `core.utility.log` node is the one
10
+ * exception: its {@link LogGraphNodeExecutor} is built in and logs the input
11
+ * through the run's `ctx.logger` (DECAF-48 §4.3).
9
12
  *
10
13
  * The three loop kinds (`core.loop.foreach/while/until`) already have built-in
11
14
  * executors (§5.9) and are NOT redeclared here.
12
15
  */
13
16
  import { Model } from "@decaf-ts/decorator-validation";
14
- import type { NodeMetadataChange, SwitchNodeMetadata } from "../types.d.cts";
17
+ import type { LogNodeLevel, NodeMetadataChange, SwitchNodeMetadata } from "../types.d.cts";
15
18
  import { GraphNode } from "./base.d.cts";
16
19
  /**
17
20
  * If — conditional branch. Evaluates a `ConditionExpression` (§22.3) and
@@ -133,6 +136,16 @@ export declare class LogFlowNode extends Model {
133
136
  value: unknown;
134
137
  logged: unknown;
135
138
  }
139
+ /**
140
+ * Utility Log — logs the input value through the run's `ctx.logger` at a
141
+ * configurable level and forwards it unchanged on the `logged` output port
142
+ * (DECAF-48 §4.3).
143
+ */
144
+ export declare class UtilityLogNode extends Model {
145
+ value: unknown;
146
+ level: LogNodeLevel;
147
+ logged: unknown;
148
+ }
136
149
  /**
137
150
  * Break — breaks out of the enclosing loop (foreach/while/until). When
138
151
  * executed inside a loop body, the loop terminates early and the loop's
@@ -147,4 +160,4 @@ export declare class BreakFlowNode extends Model {
147
160
  /**
148
161
  * All built-in flow-control node constructors.
149
162
  */
150
- export declare const GRAPH_FLOW_CONTROL_NODES: readonly [typeof IfFlowNode, typeof SwitchFlowNode, typeof ParallelFlowNode, typeof MergeFlowNode, typeof MapFlowNode, typeof DelayFlowNode, typeof ErrorBoundaryFlowNode, typeof HumanApprovalFlowNode, typeof ReturnFlowNode, typeof CodeFlowNode, typeof LogFlowNode, typeof BreakFlowNode];
163
+ export declare const GRAPH_FLOW_CONTROL_NODES: readonly [typeof IfFlowNode, typeof SwitchFlowNode, typeof ParallelFlowNode, typeof MergeFlowNode, typeof MapFlowNode, typeof DelayFlowNode, typeof ErrorBoundaryFlowNode, typeof HumanApprovalFlowNode, typeof ReturnFlowNode, typeof CodeFlowNode, typeof LogFlowNode, typeof UtilityLogNode, typeof BreakFlowNode];
@@ -1,17 +1,20 @@
1
1
  /**
2
2
  * @module integrations/graph/nodes/flow-control
3
3
  * @summary Production flow-control node kind declarations (DECAF-32 §22.2.2).
4
- * @description Canonical `@node`-decorated classes for the ten ALFRED-5
5
- * flow-control kinds. These are graph-level macros: the engine's planner
6
- * recognises them as ordinary executable nodes (§5.7) but they have no
7
- * built-in executors — downstream projects (e.g. ALFRED) register custom
8
- * executors or compile them into Mastra composition APIs (§22.2.2).
4
+ * @description Canonical `@node`-decorated classes for the ALFRED-5
5
+ * flow-control kinds, plus the DECAF-48 `core.utility.log` Log node. These
6
+ * are graph-level macros: the engine's planner recognises them as ordinary
7
+ * executable nodes (§5.7) but they have no built-in executors — downstream
8
+ * projects (e.g. ALFRED) register custom executors or compile them into
9
+ * Mastra composition APIs (§22.2.2). The `core.utility.log` node is the one
10
+ * exception: its {@link LogGraphNodeExecutor} is built in and logs the input
11
+ * through the run's `ctx.logger` (DECAF-48 §4.3).
9
12
  *
10
13
  * The three loop kinds (`core.loop.foreach/while/until`) already have built-in
11
14
  * executors (§5.9) and are NOT redeclared here.
12
15
  */
13
16
  import { Model } from "@decaf-ts/decorator-validation";
14
- import type { NodeMetadataChange, SwitchNodeMetadata } from "../types.d.mts";
17
+ import type { LogNodeLevel, NodeMetadataChange, SwitchNodeMetadata } from "../types.d.mts";
15
18
  import { GraphNode } from "./base.d.mts";
16
19
  /**
17
20
  * If — conditional branch. Evaluates a `ConditionExpression` (§22.3) and
@@ -133,6 +136,16 @@ export declare class LogFlowNode extends Model {
133
136
  value: unknown;
134
137
  logged: unknown;
135
138
  }
139
+ /**
140
+ * Utility Log — logs the input value through the run's `ctx.logger` at a
141
+ * configurable level and forwards it unchanged on the `logged` output port
142
+ * (DECAF-48 §4.3).
143
+ */
144
+ export declare class UtilityLogNode extends Model {
145
+ value: unknown;
146
+ level: LogNodeLevel;
147
+ logged: unknown;
148
+ }
136
149
  /**
137
150
  * Break — breaks out of the enclosing loop (foreach/while/until). When
138
151
  * executed inside a loop body, the loop terminates early and the loop's
@@ -147,4 +160,4 @@ export declare class BreakFlowNode extends Model {
147
160
  /**
148
161
  * All built-in flow-control node constructors.
149
162
  */
150
- export declare const GRAPH_FLOW_CONTROL_NODES: readonly [typeof IfFlowNode, typeof SwitchFlowNode, typeof ParallelFlowNode, typeof MergeFlowNode, typeof MapFlowNode, typeof DelayFlowNode, typeof ErrorBoundaryFlowNode, typeof HumanApprovalFlowNode, typeof ReturnFlowNode, typeof CodeFlowNode, typeof LogFlowNode, typeof BreakFlowNode];
163
+ export declare const GRAPH_FLOW_CONTROL_NODES: readonly [typeof IfFlowNode, typeof SwitchFlowNode, typeof ParallelFlowNode, typeof MergeFlowNode, typeof MapFlowNode, typeof DelayFlowNode, typeof ErrorBoundaryFlowNode, typeof HumanApprovalFlowNode, typeof ReturnFlowNode, typeof CodeFlowNode, typeof LogFlowNode, typeof UtilityLogNode, typeof BreakFlowNode];