@decaf-ts/integrations 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/integrations.cjs +3 -3
- package/dist/integrations.js +3 -3
- package/lib/cjs/graph/execution/CodeSandboxEvaluator.cjs +4 -0
- package/lib/cjs/graph/execution/GraphExecutionEngine.cjs +3 -2
- package/lib/cjs/graph/execution/SwitchGraphNodeExecutor.cjs +95 -0
- package/lib/cjs/graph/execution/index.cjs +4 -2
- package/lib/cjs/graph/index.cjs +7 -2
- package/lib/cjs/graph/loops/ConditionExpressionEvaluator.cjs +87 -0
- package/lib/cjs/graph/loops/GraphConditionEvaluator.cjs +25 -3
- package/lib/cjs/graph/loops/index.cjs +3 -2
- package/lib/cjs/graph/nodes/agent.cjs +110 -0
- package/lib/cjs/graph/nodes/category-styles.cjs +38 -0
- package/lib/cjs/graph/nodes/flow-control.cjs +436 -0
- package/lib/cjs/graph/nodes/index.cjs +34 -0
- package/lib/cjs/graph/nodes/triggers.cjs +250 -0
- package/lib/cjs/graph/types.cjs +2 -2
- package/lib/cjs/index.cjs +3 -3
- package/lib/cjs/keycloak/services/KeycloakAuthService.cjs +5 -4
- package/lib/cjs/keycloak/services/KeycloakClientService.cjs +5 -4
- package/lib/cjs/keycloak/services/KeycloakIdentityProviderService.cjs +5 -4
- package/lib/cjs/keycloak/services/KeycloakRealmService.cjs +8 -7
- package/lib/cjs/keycloak/services/KeycloakRoleService.cjs +5 -4
- package/lib/cjs/keycloak/services/KeycloakService.cjs +5 -3
- package/lib/cjs/keycloak/services/KeycloakUserService.cjs +5 -4
- package/lib/cjs/keycloak/services/runtime.cjs +20 -0
- package/lib/cjs/kibana/services/KibanaAuthService.cjs +6 -5
- package/lib/cjs/kibana/services/KibanaDashboardService.cjs +9 -8
- package/lib/cjs/kibana/services/KibanaDataViewService.cjs +7 -6
- package/lib/cjs/kibana/services/KibanaRoleService.cjs +5 -4
- package/lib/cjs/kibana/services/KibanaService.cjs +4 -2
- package/lib/cjs/kibana/services/KibanaSpaceService.cjs +5 -4
- package/lib/cjs/kibana/services/KibanaUserService.cjs +5 -4
- package/lib/cjs/kibana/services/runtime.cjs +20 -0
- package/lib/esm/graph/execution/CodeSandboxEvaluator.js +18 -0
- package/lib/esm/graph/execution/GraphExecutionEngine.js +2 -1
- package/lib/esm/graph/execution/SwitchGraphNodeExecutor.js +90 -0
- package/lib/esm/graph/execution/index.js +3 -1
- package/lib/esm/graph/index.js +6 -1
- package/lib/esm/graph/loops/ConditionExpressionEvaluator.js +82 -0
- package/lib/esm/graph/loops/GraphConditionEvaluator.js +24 -2
- package/lib/esm/graph/loops/index.js +2 -1
- package/lib/esm/graph/nodes/agent.js +101 -0
- package/lib/esm/graph/nodes/category-styles.js +34 -0
- package/lib/esm/graph/nodes/flow-control.js +427 -0
- package/lib/esm/graph/nodes/index.js +17 -0
- package/lib/esm/graph/nodes/triggers.js +241 -0
- package/lib/esm/graph/types.js +1 -1
- package/lib/esm/index.js +3 -3
- package/lib/esm/keycloak/services/KeycloakAuthService.js +4 -3
- package/lib/esm/keycloak/services/KeycloakClientService.js +4 -3
- package/lib/esm/keycloak/services/KeycloakIdentityProviderService.js +4 -3
- package/lib/esm/keycloak/services/KeycloakRealmService.js +4 -3
- package/lib/esm/keycloak/services/KeycloakRoleService.js +4 -3
- package/lib/esm/keycloak/services/KeycloakService.js +4 -2
- package/lib/esm/keycloak/services/KeycloakUserService.js +4 -3
- package/lib/esm/keycloak/services/runtime.js +15 -0
- package/lib/esm/kibana/services/KibanaAuthService.js +5 -4
- package/lib/esm/kibana/services/KibanaDashboardService.js +5 -4
- package/lib/esm/kibana/services/KibanaDataViewService.js +4 -3
- package/lib/esm/kibana/services/KibanaRoleService.js +4 -3
- package/lib/esm/kibana/services/KibanaService.js +3 -1
- package/lib/esm/kibana/services/KibanaSpaceService.js +4 -3
- package/lib/esm/kibana/services/KibanaUserService.js +4 -3
- package/lib/esm/kibana/services/runtime.js +15 -0
- package/lib/types/graph/execution/CodeSandboxEvaluator.d.cts +53 -0
- package/lib/types/graph/execution/CodeSandboxEvaluator.d.mts +53 -0
- package/lib/types/graph/execution/GraphExecutionEngine.d.cts +10 -0
- package/lib/types/graph/execution/GraphExecutionEngine.d.mts +10 -0
- package/lib/types/graph/execution/SwitchGraphNodeExecutor.d.cts +42 -0
- package/lib/types/graph/execution/SwitchGraphNodeExecutor.d.mts +42 -0
- package/lib/types/graph/execution/index.d.cts +2 -0
- package/lib/types/graph/execution/index.d.mts +2 -0
- package/lib/types/graph/index.d.cts +4 -0
- package/lib/types/graph/index.d.mts +4 -0
- package/lib/types/graph/loops/ConditionExpressionEvaluator.d.cts +36 -0
- package/lib/types/graph/loops/ConditionExpressionEvaluator.d.mts +36 -0
- package/lib/types/graph/loops/GraphConditionEvaluator.d.cts +20 -4
- package/lib/types/graph/loops/GraphConditionEvaluator.d.mts +20 -4
- package/lib/types/graph/loops/index.d.cts +1 -0
- package/lib/types/graph/loops/index.d.mts +1 -0
- package/lib/types/graph/nodes/agent.d.cts +44 -0
- package/lib/types/graph/nodes/agent.d.mts +44 -0
- package/lib/types/graph/nodes/category-styles.d.cts +8 -0
- package/lib/types/graph/nodes/category-styles.d.mts +8 -0
- package/lib/types/graph/nodes/flow-control.d.cts +104 -0
- package/lib/types/graph/nodes/flow-control.d.mts +104 -0
- package/lib/types/graph/nodes/index.d.cts +16 -0
- package/lib/types/graph/nodes/index.d.mts +16 -0
- package/lib/types/graph/nodes/triggers.d.cts +53 -0
- package/lib/types/graph/nodes/triggers.d.mts +53 -0
- package/lib/types/graph/types.d.cts +102 -0
- package/lib/types/graph/types.d.mts +102 -0
- package/lib/types/index.d.cts +2 -2
- package/lib/types/index.d.mts +2 -2
- package/lib/types/keycloak/services/runtime.d.cts +6 -0
- package/lib/types/keycloak/services/runtime.d.mts +6 -0
- package/lib/types/kibana/services/runtime.d.cts +6 -0
- package/lib/types/kibana/services/runtime.d.mts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/graph/nodes/agent
|
|
3
|
+
* @summary Production Agent node declaration.
|
|
4
|
+
* @description The Agent node is the primary AI agent entrypoint. It is a
|
|
5
|
+
* rectangular node with `@connection()` ports for its structural dependencies:
|
|
6
|
+
* `model` (the LLM), `memory` (the memory store), and `workspace` (the
|
|
7
|
+
* workspace/context). Connections are rendered on the bottom side of the node
|
|
8
|
+
* (DECAF-32 §21.3). Each connection category has a distinct color defined in
|
|
9
|
+
* the category style registry.
|
|
10
|
+
*
|
|
11
|
+
* The single `prompt` input accepts placeholder expressions (§22.4) such as
|
|
12
|
+
* `{{ $input.brief }}` or `{{ $node["Research"].output.summary }}` that are
|
|
13
|
+
* resolved at execution time by the placeholder compiler.
|
|
14
|
+
*/
|
|
15
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
16
|
+
import "./category-styles";
|
|
17
|
+
/**
|
|
18
|
+
* Agent node — an AI agent that orchestrates a model, memory, and workspace.
|
|
19
|
+
*
|
|
20
|
+
* The agent has:
|
|
21
|
+
* - `@input` port on the **left**: `prompt` (the task prompt; supports
|
|
22
|
+
* placeholder expressions like `{{ $input.something }}` per §22.4).
|
|
23
|
+
* - `@output` ports on the **right**: `response` (the agent's output), `actions`
|
|
24
|
+
* (any actions the agent decided to take).
|
|
25
|
+
* - `@connection` ports on the **bottom**: `model` (LLM), `memory` (memory
|
|
26
|
+
* store), `workspace` (workspace/context). Each connection has a distinct
|
|
27
|
+
* category color.
|
|
28
|
+
*
|
|
29
|
+
* The node is rectangular (not rounded) to visually distinguish it from
|
|
30
|
+
* regular processing nodes. The `color` and `icon` are omitted from `@node()`
|
|
31
|
+
* so they are resolved from the `"Agent"` category style.
|
|
32
|
+
*/
|
|
33
|
+
export declare class AgentNode extends Model {
|
|
34
|
+
prompt: string;
|
|
35
|
+
response: string;
|
|
36
|
+
actions: unknown[];
|
|
37
|
+
model: unknown;
|
|
38
|
+
memory: unknown;
|
|
39
|
+
workspace: unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* All built-in agent node constructors.
|
|
43
|
+
*/
|
|
44
|
+
export declare const GRAPH_AGENT_NODES: readonly [typeof AgentNode];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/graph/nodes/agent
|
|
3
|
+
* @summary Production Agent node declaration.
|
|
4
|
+
* @description The Agent node is the primary AI agent entrypoint. It is a
|
|
5
|
+
* rectangular node with `@connection()` ports for its structural dependencies:
|
|
6
|
+
* `model` (the LLM), `memory` (the memory store), and `workspace` (the
|
|
7
|
+
* workspace/context). Connections are rendered on the bottom side of the node
|
|
8
|
+
* (DECAF-32 §21.3). Each connection category has a distinct color defined in
|
|
9
|
+
* the category style registry.
|
|
10
|
+
*
|
|
11
|
+
* The single `prompt` input accepts placeholder expressions (§22.4) such as
|
|
12
|
+
* `{{ $input.brief }}` or `{{ $node["Research"].output.summary }}` that are
|
|
13
|
+
* resolved at execution time by the placeholder compiler.
|
|
14
|
+
*/
|
|
15
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
16
|
+
import "./category-styles";
|
|
17
|
+
/**
|
|
18
|
+
* Agent node — an AI agent that orchestrates a model, memory, and workspace.
|
|
19
|
+
*
|
|
20
|
+
* The agent has:
|
|
21
|
+
* - `@input` port on the **left**: `prompt` (the task prompt; supports
|
|
22
|
+
* placeholder expressions like `{{ $input.something }}` per §22.4).
|
|
23
|
+
* - `@output` ports on the **right**: `response` (the agent's output), `actions`
|
|
24
|
+
* (any actions the agent decided to take).
|
|
25
|
+
* - `@connection` ports on the **bottom**: `model` (LLM), `memory` (memory
|
|
26
|
+
* store), `workspace` (workspace/context). Each connection has a distinct
|
|
27
|
+
* category color.
|
|
28
|
+
*
|
|
29
|
+
* The node is rectangular (not rounded) to visually distinguish it from
|
|
30
|
+
* regular processing nodes. The `color` and `icon` are omitted from `@node()`
|
|
31
|
+
* so they are resolved from the `"Agent"` category style.
|
|
32
|
+
*/
|
|
33
|
+
export declare class AgentNode extends Model {
|
|
34
|
+
prompt: string;
|
|
35
|
+
response: string;
|
|
36
|
+
actions: unknown[];
|
|
37
|
+
model: unknown;
|
|
38
|
+
memory: unknown;
|
|
39
|
+
workspace: unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* All built-in agent node constructors.
|
|
43
|
+
*/
|
|
44
|
+
export declare const GRAPH_AGENT_NODES: readonly [typeof AgentNode];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers all built-in category styles. Called once at module init.
|
|
3
|
+
*
|
|
4
|
+
* Categories define the default visual style for nodes and connection ports.
|
|
5
|
+
* A node's explicit `color` / `icon` (on `@node()`) overrides the category
|
|
6
|
+
* style; when omitted, the category style is used.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerBuiltinCategoryStyles(): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers all built-in category styles. Called once at module init.
|
|
3
|
+
*
|
|
4
|
+
* Categories define the default visual style for nodes and connection ports.
|
|
5
|
+
* A node's explicit `color` / `icon` (on `@node()`) overrides the category
|
|
6
|
+
* style; when omitted, the category style is used.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerBuiltinCategoryStyles(): void;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/graph/nodes/flow-control
|
|
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).
|
|
9
|
+
*
|
|
10
|
+
* The three loop kinds (`core.loop.foreach/while/until`) already have built-in
|
|
11
|
+
* executors (§5.9) and are NOT redeclared here.
|
|
12
|
+
*/
|
|
13
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
14
|
+
/**
|
|
15
|
+
* If — conditional branch. Evaluates a `ConditionExpression` (§22.3) and
|
|
16
|
+
* routes the input to the `then` or `else` output.
|
|
17
|
+
*/
|
|
18
|
+
export declare class IfFlowNode extends Model {
|
|
19
|
+
value: unknown;
|
|
20
|
+
then: unknown;
|
|
21
|
+
else: unknown;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Switch — multi-branch. Routes the input to one of the case output ports
|
|
25
|
+
* or `default` based on matching conditions. Each case defines a
|
|
26
|
+
* {@link SwitchCaseCondition} (graphical or code mode) and a dedicated
|
|
27
|
+
* output port. Cases are stored in `metadata.switch.cases` and the
|
|
28
|
+
* renderer creates dynamic output ports from them (DECAF-32 §22.2.2).
|
|
29
|
+
*
|
|
30
|
+
* The node grows in height as cases are added. Each case gets its own
|
|
31
|
+
* output port on the right side, labeled with the case label.
|
|
32
|
+
*/
|
|
33
|
+
export declare class SwitchFlowNode extends Model {
|
|
34
|
+
value: unknown;
|
|
35
|
+
default: unknown;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Parallel — splits execution into concurrent branches.
|
|
39
|
+
*/
|
|
40
|
+
export declare class ParallelFlowNode extends Model {
|
|
41
|
+
value: unknown;
|
|
42
|
+
branches: unknown[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Merge — normalises branch/parallel outputs into a single output.
|
|
46
|
+
*/
|
|
47
|
+
export declare class MergeFlowNode extends Model {
|
|
48
|
+
values: unknown[];
|
|
49
|
+
merged: unknown;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Map — transforms the current input into a new output object.
|
|
53
|
+
*/
|
|
54
|
+
export declare class MapFlowNode extends Model {
|
|
55
|
+
value: unknown;
|
|
56
|
+
result: unknown;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Delay — pauses execution for a configured duration.
|
|
60
|
+
*/
|
|
61
|
+
export declare class DelayFlowNode extends Model {
|
|
62
|
+
value: unknown;
|
|
63
|
+
valueOut: unknown;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Error boundary — try/catch/finally workflow behaviour.
|
|
67
|
+
*/
|
|
68
|
+
export declare class ErrorBoundaryFlowNode extends Model {
|
|
69
|
+
value: unknown;
|
|
70
|
+
result: unknown;
|
|
71
|
+
error: unknown;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Human approval — suspends execution until a human approves or rejects.
|
|
75
|
+
*/
|
|
76
|
+
export declare class HumanApprovalFlowNode extends Model {
|
|
77
|
+
value: unknown;
|
|
78
|
+
approved: unknown;
|
|
79
|
+
rejected: unknown;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Return — defines and normalises the final workflow output.
|
|
83
|
+
*/
|
|
84
|
+
export declare class ReturnFlowNode extends Model {
|
|
85
|
+
value: unknown;
|
|
86
|
+
result: unknown;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Code — sandboxed JS/TS code execution (ALFRED-5 §7).
|
|
90
|
+
*
|
|
91
|
+
* The engine does not implement the sandbox directly (§22.4). A future
|
|
92
|
+
* executor may wrap the `CodeSandbox` contract (ALFRED-5 §7.17) as a
|
|
93
|
+
* pluggable executor. The placeholder syntax (`{{ $input }}`, `{{ $item }}`,
|
|
94
|
+
* `{{ $index }}`, `{{ $vars }}`, `{{ $node["Name"].output }}`) is Mastra-
|
|
95
|
+
* agnostic and lives in the downstream project's `modules/core` (ALFRED-6).
|
|
96
|
+
*/
|
|
97
|
+
export declare class CodeFlowNode extends Model {
|
|
98
|
+
input: unknown;
|
|
99
|
+
result: unknown;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* All built-in flow-control node constructors.
|
|
103
|
+
*/
|
|
104
|
+
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];
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/graph/nodes/flow-control
|
|
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).
|
|
9
|
+
*
|
|
10
|
+
* The three loop kinds (`core.loop.foreach/while/until`) already have built-in
|
|
11
|
+
* executors (§5.9) and are NOT redeclared here.
|
|
12
|
+
*/
|
|
13
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
14
|
+
/**
|
|
15
|
+
* If — conditional branch. Evaluates a `ConditionExpression` (§22.3) and
|
|
16
|
+
* routes the input to the `then` or `else` output.
|
|
17
|
+
*/
|
|
18
|
+
export declare class IfFlowNode extends Model {
|
|
19
|
+
value: unknown;
|
|
20
|
+
then: unknown;
|
|
21
|
+
else: unknown;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Switch — multi-branch. Routes the input to one of the case output ports
|
|
25
|
+
* or `default` based on matching conditions. Each case defines a
|
|
26
|
+
* {@link SwitchCaseCondition} (graphical or code mode) and a dedicated
|
|
27
|
+
* output port. Cases are stored in `metadata.switch.cases` and the
|
|
28
|
+
* renderer creates dynamic output ports from them (DECAF-32 §22.2.2).
|
|
29
|
+
*
|
|
30
|
+
* The node grows in height as cases are added. Each case gets its own
|
|
31
|
+
* output port on the right side, labeled with the case label.
|
|
32
|
+
*/
|
|
33
|
+
export declare class SwitchFlowNode extends Model {
|
|
34
|
+
value: unknown;
|
|
35
|
+
default: unknown;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Parallel — splits execution into concurrent branches.
|
|
39
|
+
*/
|
|
40
|
+
export declare class ParallelFlowNode extends Model {
|
|
41
|
+
value: unknown;
|
|
42
|
+
branches: unknown[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Merge — normalises branch/parallel outputs into a single output.
|
|
46
|
+
*/
|
|
47
|
+
export declare class MergeFlowNode extends Model {
|
|
48
|
+
values: unknown[];
|
|
49
|
+
merged: unknown;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Map — transforms the current input into a new output object.
|
|
53
|
+
*/
|
|
54
|
+
export declare class MapFlowNode extends Model {
|
|
55
|
+
value: unknown;
|
|
56
|
+
result: unknown;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Delay — pauses execution for a configured duration.
|
|
60
|
+
*/
|
|
61
|
+
export declare class DelayFlowNode extends Model {
|
|
62
|
+
value: unknown;
|
|
63
|
+
valueOut: unknown;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Error boundary — try/catch/finally workflow behaviour.
|
|
67
|
+
*/
|
|
68
|
+
export declare class ErrorBoundaryFlowNode extends Model {
|
|
69
|
+
value: unknown;
|
|
70
|
+
result: unknown;
|
|
71
|
+
error: unknown;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Human approval — suspends execution until a human approves or rejects.
|
|
75
|
+
*/
|
|
76
|
+
export declare class HumanApprovalFlowNode extends Model {
|
|
77
|
+
value: unknown;
|
|
78
|
+
approved: unknown;
|
|
79
|
+
rejected: unknown;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Return — defines and normalises the final workflow output.
|
|
83
|
+
*/
|
|
84
|
+
export declare class ReturnFlowNode extends Model {
|
|
85
|
+
value: unknown;
|
|
86
|
+
result: unknown;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Code — sandboxed JS/TS code execution (ALFRED-5 §7).
|
|
90
|
+
*
|
|
91
|
+
* The engine does not implement the sandbox directly (§22.4). A future
|
|
92
|
+
* executor may wrap the `CodeSandbox` contract (ALFRED-5 §7.17) as a
|
|
93
|
+
* pluggable executor. The placeholder syntax (`{{ $input }}`, `{{ $item }}`,
|
|
94
|
+
* `{{ $index }}`, `{{ $vars }}`, `{{ $node["Name"].output }}`) is Mastra-
|
|
95
|
+
* agnostic and lives in the downstream project's `modules/core` (ALFRED-6).
|
|
96
|
+
*/
|
|
97
|
+
export declare class CodeFlowNode extends Model {
|
|
98
|
+
input: unknown;
|
|
99
|
+
result: unknown;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* All built-in flow-control node constructors.
|
|
103
|
+
*/
|
|
104
|
+
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];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/graph/nodes
|
|
3
|
+
* @summary Production node kind declarations (DECAF-32 §22.2).
|
|
4
|
+
* @description Canonical `@node`-decorated classes for the ALFRED-5 node kind
|
|
5
|
+
* taxonomy. These are the framework's built-in node definitions — triggers
|
|
6
|
+
* (§22.2.1), flow-control/utility nodes (§22.2.2–22.2.3), and the Agent node
|
|
7
|
+
* (§21.3). The three loop kinds (`core.loop.foreach/while/until`) already have
|
|
8
|
+
* built-in executors (§5.9) and are not redeclared here.
|
|
9
|
+
*
|
|
10
|
+
* Consumers (for-angular, ALFRED, etc.) import these declarations to populate
|
|
11
|
+
* node palettes, registries, and reference snapshots.
|
|
12
|
+
*/
|
|
13
|
+
export * from "./category-styles.d.cts";
|
|
14
|
+
export * from "./triggers.d.cts";
|
|
15
|
+
export * from "./flow-control.d.cts";
|
|
16
|
+
export * from "./agent.d.cts";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/graph/nodes
|
|
3
|
+
* @summary Production node kind declarations (DECAF-32 §22.2).
|
|
4
|
+
* @description Canonical `@node`-decorated classes for the ALFRED-5 node kind
|
|
5
|
+
* taxonomy. These are the framework's built-in node definitions — triggers
|
|
6
|
+
* (§22.2.1), flow-control/utility nodes (§22.2.2–22.2.3), and the Agent node
|
|
7
|
+
* (§21.3). The three loop kinds (`core.loop.foreach/while/until`) already have
|
|
8
|
+
* built-in executors (§5.9) and are not redeclared here.
|
|
9
|
+
*
|
|
10
|
+
* Consumers (for-angular, ALFRED, etc.) import these declarations to populate
|
|
11
|
+
* node palettes, registries, and reference snapshots.
|
|
12
|
+
*/
|
|
13
|
+
export * from "./category-styles.d.mts";
|
|
14
|
+
export * from "./triggers.d.mts";
|
|
15
|
+
export * from "./flow-control.d.mts";
|
|
16
|
+
export * from "./agent.d.mts";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/graph/nodes/triggers
|
|
3
|
+
* @summary Production trigger node kind declarations (DECAF-32 §22.2.1).
|
|
4
|
+
* @description Canonical `@node`-decorated classes for the six ALFRED-5 trigger
|
|
5
|
+
* kinds. Triggers are metadata-only entrypoints: they define how a workflow
|
|
6
|
+
* starts and produce a trigger payload on their `@output` ports. They have no
|
|
7
|
+
* `@input` ports (nothing feeds a trigger) and no built-in executors — the
|
|
8
|
+
* engine's execution model starts from workflow inputs (§5.8) and treats
|
|
9
|
+
* trigger nodes as metadata-only entrypoints.
|
|
10
|
+
*/
|
|
11
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
12
|
+
/**
|
|
13
|
+
* Manual trigger — user clicks Run; input form generated from `inputSchema`.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ManualTriggerNode extends Model {
|
|
16
|
+
payload: unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Webhook trigger — HTTP request received; path/method/auth/responseMode config.
|
|
20
|
+
*/
|
|
21
|
+
export declare class WebhookTriggerNode extends Model {
|
|
22
|
+
payload: unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Schedule trigger — cron-like schedule; timezone + payload config.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ScheduleTriggerNode extends Model {
|
|
28
|
+
payload: unknown;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Event trigger — internal event bus topic subscriber.
|
|
32
|
+
*/
|
|
33
|
+
export declare class EventTriggerNode extends Model {
|
|
34
|
+
payload: unknown;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Form trigger — generated public/internal form; field definitions.
|
|
38
|
+
*/
|
|
39
|
+
export declare class FormTriggerNode extends Model {
|
|
40
|
+
payload: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Chat trigger — chat message entrypoint; message/sessionId/userId schema.
|
|
44
|
+
*/
|
|
45
|
+
export declare class ChatTriggerNode extends Model {
|
|
46
|
+
message: string;
|
|
47
|
+
sessionId: string;
|
|
48
|
+
userId: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* All built-in trigger node constructors.
|
|
52
|
+
*/
|
|
53
|
+
export declare const GRAPH_TRIGGER_NODES: readonly [typeof ManualTriggerNode, typeof WebhookTriggerNode, typeof ScheduleTriggerNode, typeof EventTriggerNode, typeof FormTriggerNode, typeof ChatTriggerNode];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/graph/nodes/triggers
|
|
3
|
+
* @summary Production trigger node kind declarations (DECAF-32 §22.2.1).
|
|
4
|
+
* @description Canonical `@node`-decorated classes for the six ALFRED-5 trigger
|
|
5
|
+
* kinds. Triggers are metadata-only entrypoints: they define how a workflow
|
|
6
|
+
* starts and produce a trigger payload on their `@output` ports. They have no
|
|
7
|
+
* `@input` ports (nothing feeds a trigger) and no built-in executors — the
|
|
8
|
+
* engine's execution model starts from workflow inputs (§5.8) and treats
|
|
9
|
+
* trigger nodes as metadata-only entrypoints.
|
|
10
|
+
*/
|
|
11
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
12
|
+
/**
|
|
13
|
+
* Manual trigger — user clicks Run; input form generated from `inputSchema`.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ManualTriggerNode extends Model {
|
|
16
|
+
payload: unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Webhook trigger — HTTP request received; path/method/auth/responseMode config.
|
|
20
|
+
*/
|
|
21
|
+
export declare class WebhookTriggerNode extends Model {
|
|
22
|
+
payload: unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Schedule trigger — cron-like schedule; timezone + payload config.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ScheduleTriggerNode extends Model {
|
|
28
|
+
payload: unknown;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Event trigger — internal event bus topic subscriber.
|
|
32
|
+
*/
|
|
33
|
+
export declare class EventTriggerNode extends Model {
|
|
34
|
+
payload: unknown;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Form trigger — generated public/internal form; field definitions.
|
|
38
|
+
*/
|
|
39
|
+
export declare class FormTriggerNode extends Model {
|
|
40
|
+
payload: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Chat trigger — chat message entrypoint; message/sessionId/userId schema.
|
|
44
|
+
*/
|
|
45
|
+
export declare class ChatTriggerNode extends Model {
|
|
46
|
+
message: string;
|
|
47
|
+
sessionId: string;
|
|
48
|
+
userId: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* All built-in trigger node constructors.
|
|
52
|
+
*/
|
|
53
|
+
export declare const GRAPH_TRIGGER_NODES: readonly [typeof ManualTriggerNode, typeof WebhookTriggerNode, typeof ScheduleTriggerNode, typeof EventTriggerNode, typeof FormTriggerNode, typeof ChatTriggerNode];
|
|
@@ -134,6 +134,10 @@ export interface GraphLoopMetadata {
|
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Definition of a condition evaluated by the loop condition evaluator.
|
|
137
|
+
*
|
|
138
|
+
* When the condition object carries an `op` field (see {@link ConditionExpression}),
|
|
139
|
+
* the {@link GraphConditionEvaluator} dispatches to the {@link ConditionExpressionEvaluator}
|
|
140
|
+
* instead of the built-in `type`-based switch.
|
|
137
141
|
*/
|
|
138
142
|
export interface GraphConditionDefinition {
|
|
139
143
|
type: "truthy" | "falsy" | "equals" | "notEquals" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "exists" | "custom";
|
|
@@ -142,6 +146,104 @@ export interface GraphConditionDefinition {
|
|
|
142
146
|
evaluator?: string;
|
|
143
147
|
metadata?: Record<string, unknown>;
|
|
144
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* A value reference inside a {@link ConditionExpression}.
|
|
151
|
+
*
|
|
152
|
+
* - `{ const: x }` — a literal constant.
|
|
153
|
+
* - `{ path: "a.b" }` — a dotted path resolved against the current loop state.
|
|
154
|
+
* - `{ step: "nodeId", path: "out" }` — a cross-node reference (resolved from
|
|
155
|
+
* the execution state in v1; reserved for future multi-step evaluation).
|
|
156
|
+
*/
|
|
157
|
+
export type ExprValue = {
|
|
158
|
+
const: unknown;
|
|
159
|
+
} | {
|
|
160
|
+
path: string;
|
|
161
|
+
} | {
|
|
162
|
+
step: string;
|
|
163
|
+
path: string;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Declarative, serializable condition expression DSL (ALFRED-5 §8 / DECAF-32 §22.3).
|
|
167
|
+
*
|
|
168
|
+
* The engine's {@link GraphConditionEvaluator} recognises this DSL when the
|
|
169
|
+
* condition object carries an `op` field and dispatches to the
|
|
170
|
+
* {@link ConditionExpressionEvaluator}.
|
|
171
|
+
*/
|
|
172
|
+
export type ConditionExpression = {
|
|
173
|
+
op: "eq";
|
|
174
|
+
left: ExprValue;
|
|
175
|
+
right: ExprValue;
|
|
176
|
+
} | {
|
|
177
|
+
op: "neq";
|
|
178
|
+
left: ExprValue;
|
|
179
|
+
right: ExprValue;
|
|
180
|
+
} | {
|
|
181
|
+
op: "gt";
|
|
182
|
+
left: ExprValue;
|
|
183
|
+
right: ExprValue;
|
|
184
|
+
} | {
|
|
185
|
+
op: "gte";
|
|
186
|
+
left: ExprValue;
|
|
187
|
+
right: ExprValue;
|
|
188
|
+
} | {
|
|
189
|
+
op: "lt";
|
|
190
|
+
left: ExprValue;
|
|
191
|
+
right: ExprValue;
|
|
192
|
+
} | {
|
|
193
|
+
op: "lte";
|
|
194
|
+
left: ExprValue;
|
|
195
|
+
right: ExprValue;
|
|
196
|
+
} | {
|
|
197
|
+
op: "and";
|
|
198
|
+
conditions: ConditionExpression[];
|
|
199
|
+
} | {
|
|
200
|
+
op: "or";
|
|
201
|
+
conditions: ConditionExpression[];
|
|
202
|
+
} | {
|
|
203
|
+
op: "not";
|
|
204
|
+
condition: ConditionExpression;
|
|
205
|
+
} | {
|
|
206
|
+
op: "exists";
|
|
207
|
+
value: ExprValue;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* A code-based condition evaluated in a restricted VM sandbox (§22.4).
|
|
211
|
+
*
|
|
212
|
+
* The engine does NOT implement the sandbox directly — a pluggable
|
|
213
|
+
* {@link CodeSandboxEvaluator} must be registered for code conditions to work.
|
|
214
|
+
* The code must follow the same restrictions as the Code Node (§22.4):
|
|
215
|
+
* no system API access, placeholder syntax for workflow data references.
|
|
216
|
+
*/
|
|
217
|
+
export interface CodeCondition {
|
|
218
|
+
type: "code";
|
|
219
|
+
code: string;
|
|
220
|
+
language?: "javascript" | "typescript";
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* A condition on a Switch case — either a declarative
|
|
224
|
+
* {@link ConditionExpression} (graphical mode) or a {@link CodeCondition}
|
|
225
|
+
* (code mode).
|
|
226
|
+
*/
|
|
227
|
+
export type SwitchCaseCondition = ConditionExpression | CodeCondition;
|
|
228
|
+
/**
|
|
229
|
+
* A single case in a Switch node.
|
|
230
|
+
*
|
|
231
|
+
* Each case pairs a condition with a dedicated output port. When the
|
|
232
|
+
* condition evaluates to `true`, the input is routed to `outputPort`.
|
|
233
|
+
*/
|
|
234
|
+
export interface SwitchCase {
|
|
235
|
+
id: string;
|
|
236
|
+
label: string;
|
|
237
|
+
condition: SwitchCaseCondition;
|
|
238
|
+
outputPort: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Metadata for a Switch node, stored in `metadata.switch`.
|
|
242
|
+
*/
|
|
243
|
+
export interface SwitchNodeMetadata {
|
|
244
|
+
cases: SwitchCase[];
|
|
245
|
+
defaultPort?: string;
|
|
246
|
+
}
|
|
145
247
|
/**
|
|
146
248
|
* Pinning metadata attached to a node via `@pinnable()`.
|
|
147
249
|
*/
|
|
@@ -134,6 +134,10 @@ export interface GraphLoopMetadata {
|
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Definition of a condition evaluated by the loop condition evaluator.
|
|
137
|
+
*
|
|
138
|
+
* When the condition object carries an `op` field (see {@link ConditionExpression}),
|
|
139
|
+
* the {@link GraphConditionEvaluator} dispatches to the {@link ConditionExpressionEvaluator}
|
|
140
|
+
* instead of the built-in `type`-based switch.
|
|
137
141
|
*/
|
|
138
142
|
export interface GraphConditionDefinition {
|
|
139
143
|
type: "truthy" | "falsy" | "equals" | "notEquals" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "exists" | "custom";
|
|
@@ -142,6 +146,104 @@ export interface GraphConditionDefinition {
|
|
|
142
146
|
evaluator?: string;
|
|
143
147
|
metadata?: Record<string, unknown>;
|
|
144
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* A value reference inside a {@link ConditionExpression}.
|
|
151
|
+
*
|
|
152
|
+
* - `{ const: x }` — a literal constant.
|
|
153
|
+
* - `{ path: "a.b" }` — a dotted path resolved against the current loop state.
|
|
154
|
+
* - `{ step: "nodeId", path: "out" }` — a cross-node reference (resolved from
|
|
155
|
+
* the execution state in v1; reserved for future multi-step evaluation).
|
|
156
|
+
*/
|
|
157
|
+
export type ExprValue = {
|
|
158
|
+
const: unknown;
|
|
159
|
+
} | {
|
|
160
|
+
path: string;
|
|
161
|
+
} | {
|
|
162
|
+
step: string;
|
|
163
|
+
path: string;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Declarative, serializable condition expression DSL (ALFRED-5 §8 / DECAF-32 §22.3).
|
|
167
|
+
*
|
|
168
|
+
* The engine's {@link GraphConditionEvaluator} recognises this DSL when the
|
|
169
|
+
* condition object carries an `op` field and dispatches to the
|
|
170
|
+
* {@link ConditionExpressionEvaluator}.
|
|
171
|
+
*/
|
|
172
|
+
export type ConditionExpression = {
|
|
173
|
+
op: "eq";
|
|
174
|
+
left: ExprValue;
|
|
175
|
+
right: ExprValue;
|
|
176
|
+
} | {
|
|
177
|
+
op: "neq";
|
|
178
|
+
left: ExprValue;
|
|
179
|
+
right: ExprValue;
|
|
180
|
+
} | {
|
|
181
|
+
op: "gt";
|
|
182
|
+
left: ExprValue;
|
|
183
|
+
right: ExprValue;
|
|
184
|
+
} | {
|
|
185
|
+
op: "gte";
|
|
186
|
+
left: ExprValue;
|
|
187
|
+
right: ExprValue;
|
|
188
|
+
} | {
|
|
189
|
+
op: "lt";
|
|
190
|
+
left: ExprValue;
|
|
191
|
+
right: ExprValue;
|
|
192
|
+
} | {
|
|
193
|
+
op: "lte";
|
|
194
|
+
left: ExprValue;
|
|
195
|
+
right: ExprValue;
|
|
196
|
+
} | {
|
|
197
|
+
op: "and";
|
|
198
|
+
conditions: ConditionExpression[];
|
|
199
|
+
} | {
|
|
200
|
+
op: "or";
|
|
201
|
+
conditions: ConditionExpression[];
|
|
202
|
+
} | {
|
|
203
|
+
op: "not";
|
|
204
|
+
condition: ConditionExpression;
|
|
205
|
+
} | {
|
|
206
|
+
op: "exists";
|
|
207
|
+
value: ExprValue;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* A code-based condition evaluated in a restricted VM sandbox (§22.4).
|
|
211
|
+
*
|
|
212
|
+
* The engine does NOT implement the sandbox directly — a pluggable
|
|
213
|
+
* {@link CodeSandboxEvaluator} must be registered for code conditions to work.
|
|
214
|
+
* The code must follow the same restrictions as the Code Node (§22.4):
|
|
215
|
+
* no system API access, placeholder syntax for workflow data references.
|
|
216
|
+
*/
|
|
217
|
+
export interface CodeCondition {
|
|
218
|
+
type: "code";
|
|
219
|
+
code: string;
|
|
220
|
+
language?: "javascript" | "typescript";
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* A condition on a Switch case — either a declarative
|
|
224
|
+
* {@link ConditionExpression} (graphical mode) or a {@link CodeCondition}
|
|
225
|
+
* (code mode).
|
|
226
|
+
*/
|
|
227
|
+
export type SwitchCaseCondition = ConditionExpression | CodeCondition;
|
|
228
|
+
/**
|
|
229
|
+
* A single case in a Switch node.
|
|
230
|
+
*
|
|
231
|
+
* Each case pairs a condition with a dedicated output port. When the
|
|
232
|
+
* condition evaluates to `true`, the input is routed to `outputPort`.
|
|
233
|
+
*/
|
|
234
|
+
export interface SwitchCase {
|
|
235
|
+
id: string;
|
|
236
|
+
label: string;
|
|
237
|
+
condition: SwitchCaseCondition;
|
|
238
|
+
outputPort: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Metadata for a Switch node, stored in `metadata.switch`.
|
|
242
|
+
*/
|
|
243
|
+
export interface SwitchNodeMetadata {
|
|
244
|
+
cases: SwitchCase[];
|
|
245
|
+
defaultPort?: string;
|
|
246
|
+
}
|
|
145
247
|
/**
|
|
146
248
|
* Pinning metadata attached to a node via `@pinnable()`.
|
|
147
249
|
*/
|