@memberjunction/ng-flow-editor 0.0.1 → 4.1.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 (58) hide show
  1. package/README.md +151 -43
  2. package/dist/lib/agent-editor/agent-flow-transformer.service.d.ts +83 -0
  3. package/dist/lib/agent-editor/agent-flow-transformer.service.d.ts.map +1 -0
  4. package/dist/lib/agent-editor/agent-flow-transformer.service.js +447 -0
  5. package/dist/lib/agent-editor/agent-flow-transformer.service.js.map +1 -0
  6. package/dist/lib/agent-editor/agent-properties-panel.component.d.ts +92 -0
  7. package/dist/lib/agent-editor/agent-properties-panel.component.d.ts.map +1 -0
  8. package/dist/lib/agent-editor/agent-properties-panel.component.js +1139 -0
  9. package/dist/lib/agent-editor/agent-properties-panel.component.js.map +1 -0
  10. package/dist/lib/agent-editor/agent-step-list.component.d.ts +17 -0
  11. package/dist/lib/agent-editor/agent-step-list.component.d.ts.map +1 -0
  12. package/dist/lib/agent-editor/agent-step-list.component.js +278 -0
  13. package/dist/lib/agent-editor/agent-step-list.component.js.map +1 -0
  14. package/dist/lib/agent-editor/flow-agent-editor.component.d.ts +134 -0
  15. package/dist/lib/agent-editor/flow-agent-editor.component.d.ts.map +1 -0
  16. package/dist/lib/agent-editor/flow-agent-editor.component.js +999 -0
  17. package/dist/lib/agent-editor/flow-agent-editor.component.js.map +1 -0
  18. package/dist/lib/components/flow-editor.component.d.ts +169 -0
  19. package/dist/lib/components/flow-editor.component.d.ts.map +1 -0
  20. package/dist/lib/components/flow-editor.component.js +1090 -0
  21. package/dist/lib/components/flow-editor.component.js.map +1 -0
  22. package/dist/lib/components/flow-node.component.d.ts +50 -0
  23. package/dist/lib/components/flow-node.component.d.ts.map +1 -0
  24. package/dist/lib/components/flow-node.component.js +358 -0
  25. package/dist/lib/components/flow-node.component.js.map +1 -0
  26. package/dist/lib/components/flow-palette.component.d.ts +17 -0
  27. package/dist/lib/components/flow-palette.component.d.ts.map +1 -0
  28. package/dist/lib/components/flow-palette.component.js +110 -0
  29. package/dist/lib/components/flow-palette.component.js.map +1 -0
  30. package/dist/lib/components/flow-status-bar.component.d.ts +13 -0
  31. package/dist/lib/components/flow-status-bar.component.d.ts.map +1 -0
  32. package/dist/lib/components/flow-status-bar.component.js +81 -0
  33. package/dist/lib/components/flow-status-bar.component.js.map +1 -0
  34. package/dist/lib/components/flow-toolbar.component.d.ts +25 -0
  35. package/dist/lib/components/flow-toolbar.component.d.ts.map +1 -0
  36. package/dist/lib/components/flow-toolbar.component.js +192 -0
  37. package/dist/lib/components/flow-toolbar.component.js.map +1 -0
  38. package/dist/lib/flow-editor.module.d.ts +19 -0
  39. package/dist/lib/flow-editor.module.d.ts.map +1 -0
  40. package/dist/lib/flow-editor.module.js +84 -0
  41. package/dist/lib/flow-editor.module.js.map +1 -0
  42. package/dist/lib/interfaces/flow-types.d.ts +153 -0
  43. package/dist/lib/interfaces/flow-types.d.ts.map +1 -0
  44. package/dist/lib/interfaces/flow-types.js +6 -0
  45. package/dist/lib/interfaces/flow-types.js.map +1 -0
  46. package/dist/lib/services/flow-layout.service.d.ts +21 -0
  47. package/dist/lib/services/flow-layout.service.d.ts.map +1 -0
  48. package/dist/lib/services/flow-layout.service.js +76 -0
  49. package/dist/lib/services/flow-layout.service.js.map +1 -0
  50. package/dist/lib/services/flow-state.service.d.ts +37 -0
  51. package/dist/lib/services/flow-state.service.d.ts.map +1 -0
  52. package/dist/lib/services/flow-state.service.js +89 -0
  53. package/dist/lib/services/flow-state.service.js.map +1 -0
  54. package/dist/public-api.d.ts +14 -0
  55. package/dist/public-api.d.ts.map +1 -0
  56. package/dist/public-api.js +22 -0
  57. package/dist/public-api.js.map +1 -0
  58. package/package.json +51 -6
package/README.md CHANGED
@@ -1,45 +1,153 @@
1
1
  # @memberjunction/ng-flow-editor
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
-
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
-
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
-
9
- ## Purpose
10
-
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@memberjunction/ng-flow-editor`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**
3
+ A generic, entity-agnostic visual flow editor component powered by Foblex Flow, with an agent-specific Flow Agent Editor for building AI agent workflows.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @memberjunction/ng-flow-editor
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ The Flow Editor provides a canvas-based visual editor for building node-and-connection graphs. It wraps [Foblex Flow](https://www.foblex.com/flow) with a clean MemberJunction-style API and includes automatic layout via the Dagre graph algorithm. A specialized Agent Editor component is also included for visually designing AI agent step flows.
14
+
15
+ ```mermaid
16
+ flowchart TD
17
+ subgraph Generic["Generic Flow Editor"]
18
+ A["FlowEditorComponent"] --> B["FlowNodeComponent"]
19
+ A --> C["FlowPaletteComponent"]
20
+ A --> D["FlowToolbarComponent"]
21
+ A --> E["FlowStatusBarComponent"]
22
+ end
23
+ subgraph Agent["Agent Editor"]
24
+ F["FlowAgentEditorComponent"] --> G["AgentPropertiesPanelComponent"]
25
+ F --> H["AgentStepListComponent"]
26
+ F --> I["AgentFlowTransformerService"]
27
+ I --> A
28
+ end
29
+ subgraph Services["Services"]
30
+ J["FlowStateService"]
31
+ K["FlowLayoutService (Dagre)"]
32
+ end
33
+
34
+ A --> J
35
+ A --> K
36
+
37
+ style Generic fill:#2d6a9f,stroke:#1a4971,color:#fff
38
+ style Agent fill:#7c5295,stroke:#563a6b,color:#fff
39
+ style Services fill:#2d8659,stroke:#1a5c3a,color:#fff
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ ### Module Import
45
+
46
+ ```typescript
47
+ import { FlowEditorModule } from '@memberjunction/ng-flow-editor';
48
+
49
+ @NgModule({
50
+ imports: [FlowEditorModule]
51
+ })
52
+ export class YourModule {}
53
+ ```
54
+
55
+ ### Basic Flow Editor
56
+
57
+ ```html
58
+ <mj-flow-editor
59
+ [Nodes]="myNodes"
60
+ [Connections]="myConnections"
61
+ [NodeTypes]="myNodeTypes"
62
+ [ShowMinimap]="true"
63
+ [ShowPalette]="true"
64
+ [ShowGrid]="true"
65
+ (NodeSelected)="onNodeSelected($event)"
66
+ (ConnectionCreated)="onConnectionCreated($event)"
67
+ (NodesChanged)="onNodesChanged($event)">
68
+ </mj-flow-editor>
69
+ ```
70
+
71
+ ### Agent Flow Editor
72
+
73
+ ```html
74
+ <mj-flow-agent-editor
75
+ [AgentId]="selectedAgentId"
76
+ [ReadOnly]="false"
77
+ (StepSelected)="onStepSelected($event)"
78
+ (FlowChanged)="onFlowChanged($event)">
79
+ </mj-flow-agent-editor>
80
+ ```
81
+
82
+ ## Components
83
+
84
+ | Component | Selector | Purpose |
85
+ |-----------|----------|---------|
86
+ | `FlowEditorComponent` | `mj-flow-editor` | Generic canvas-based flow editor |
87
+ | `FlowNodeComponent` | internal | Renders individual nodes on the canvas |
88
+ | `FlowPaletteComponent` | internal | Draggable palette of node types |
89
+ | `FlowToolbarComponent` | internal | Toolbar with zoom, layout, grid controls |
90
+ | `FlowStatusBarComponent` | internal | Displays node/connection counts |
91
+ | `FlowAgentEditorComponent` | `mj-flow-agent-editor` | Agent-specific flow editor wrapper |
92
+ | `AgentPropertiesPanelComponent` | internal | Agent property editing panel |
93
+ | `AgentStepListComponent` | internal | List of agent steps |
94
+
95
+ ## FlowEditorComponent API
96
+
97
+ ### Inputs
98
+
99
+ | Property | Type | Default | Description |
100
+ |----------|------|---------|-------------|
101
+ | `Nodes` | `FlowNode[]` | `[]` | Array of flow nodes |
102
+ | `Connections` | `FlowConnection[]` | `[]` | Array of connections between nodes |
103
+ | `NodeTypes` | `FlowNodeTypeConfig[]` | `[]` | Available node type definitions |
104
+ | `ReadOnly` | `boolean` | `false` | Disable editing |
105
+ | `ShowMinimap` | `boolean` | `true` | Show minimap overlay |
106
+ | `ShowPalette` | `boolean` | `true` | Show the node palette |
107
+ | `ShowGrid` | `boolean` | `true` | Show background grid |
108
+ | `ShowStatusBar` | `boolean` | `true` | Show the status bar |
109
+ | `ShowToolbar` | `boolean` | `true` | Show the toolbar |
110
+ | `ShowLegend` | `boolean` | `true` | Show the node type legend |
111
+ | `GridSize` | `number` | `20` | Grid snap size in pixels |
112
+ | `AutoLayoutDirection` | `FlowLayoutDirection` | `'vertical'` | Dagre auto-layout direction |
113
+
114
+ ### Outputs
115
+
116
+ | Event | Type | Description |
117
+ |-------|------|-------------|
118
+ | `NodeSelected` | `EventEmitter<FlowNode \| null>` | A node was selected or deselected |
119
+ | `NodeAdded` | `EventEmitter<FlowNodeAddedEvent>` | A node was added to the canvas |
120
+ | `NodeRemoved` | `EventEmitter<FlowNode>` | A node was removed |
121
+ | `NodeMoved` | `EventEmitter<FlowNodeMovedEvent>` | A node was repositioned |
122
+ | `ConnectionCreated` | `EventEmitter<FlowConnectionCreatedEvent>` | A connection was created |
123
+ | `ConnectionRemoved` | `EventEmitter<FlowConnection>` | A connection was removed |
124
+ | `ConnectionReassigned` | `EventEmitter<FlowConnectionReassignedEvent>` | A connection endpoint was moved |
125
+ | `SelectionChanged` | `EventEmitter<FlowSelectionChangedEvent>` | Selection state changed |
126
+ | `NodesChanged` | `EventEmitter<FlowNode[]>` | The nodes array was modified |
127
+ | `ConnectionsChanged` | `EventEmitter<FlowConnection[]>` | The connections array was modified |
128
+ | `NodeEditRequested` | `EventEmitter<FlowNode>` | Double-click to edit a node |
129
+
130
+ ## Exported Types
131
+
132
+ - `FlowNode` -- A node on the canvas with id, type, label, position, size, ports, badges
133
+ - `FlowConnection` -- A connection between two node ports with optional label
134
+ - `FlowNodeTypeConfig` -- Configuration for a node type (icon, color, ports, palette info)
135
+ - `FlowNodePort` -- Input/output port definition
136
+ - `FlowPosition` / `FlowSize` -- Position and size types
137
+ - `FlowSnapshot` -- Serializable snapshot of the entire flow state
138
+ - `FlowLayoutDirection` -- `'vertical' | 'horizontal'`
139
+
140
+ ## Services
141
+
142
+ | Service | Purpose |
143
+ |---------|---------|
144
+ | `FlowStateService` | Manages undo/redo, snapshots, dirty state |
145
+ | `FlowLayoutService` | Dagre-based auto-layout for flow graphs |
146
+ | `AgentFlowTransformerService` | Transforms MJ Agent entities into flow graph data |
147
+
148
+ ## Dependencies
149
+
150
+ - [@memberjunction/core](../../MJCore/README.md) -- Core MJ functionality
151
+ - [@memberjunction/core-entities](../../MJCoreEntities/README.md) -- Entity types for agent editor
152
+ - `@foblex/flow` -- Canvas rendering engine
153
+ - `@dagrejs/dagre` -- Graph layout algorithm
@@ -0,0 +1,83 @@
1
+ import { AIAgentStepEntity, AIAgentStepPathEntity } from '@memberjunction/core-entities';
2
+ import { FlowNode, FlowConnection, FlowNodeTypeConfig } from '../interfaces/flow-types';
3
+ import * as i0 from "@angular/core";
4
+ /** Picker item shape for Actions with optional icon */
5
+ export interface ActionPickerItem {
6
+ ID: string;
7
+ Name: string;
8
+ IconClass?: string | null;
9
+ }
10
+ /** Picker item shape for Agents with optional icon and logo */
11
+ export interface AgentPickerItem {
12
+ ID: string;
13
+ Name: string;
14
+ IconClass?: string | null;
15
+ LogoURL?: string | null;
16
+ }
17
+ /** Step types mapped to visual configuration */
18
+ export declare const AGENT_STEP_TYPE_CONFIGS: FlowNodeTypeConfig[];
19
+ /**
20
+ * Transforms MJ AIAgentStep/Path entities to/from generic FlowNode/FlowConnection models.
21
+ */
22
+ export declare class AgentFlowTransformerService {
23
+ /** Convert MJ step entities to generic FlowNodes */
24
+ StepsToNodes(steps: AIAgentStepEntity[], actions?: ActionPickerItem[], agents?: AgentPickerItem[]): FlowNode[];
25
+ /** Convert MJ path entities to generic FlowConnections */
26
+ PathsToConnections(paths: AIAgentStepPathEntity[]): FlowConnection[];
27
+ /** Build the subtitle for a step based on its configured action/prompt/agent */
28
+ BuildStepSubtitle(step: AIAgentStepEntity): string;
29
+ /** Apply FlowNode position changes back to a step entity */
30
+ ApplyNodePosition(step: AIAgentStepEntity, node: FlowNode): void;
31
+ /** Map FlowNode status from step entity status */
32
+ MapStepStatus(stepStatus: string): FlowNode['Status'];
33
+ /**
34
+ * Returns a short human-readable message describing what's missing,
35
+ * or null if the step is fully configured.
36
+ */
37
+ BuildConfigWarningMessage(step: AIAgentStepEntity): string | null;
38
+ private buildLoopWarningMessage;
39
+ /**
40
+ * Returns true when a step is missing its required configuration reference
41
+ * (e.g., an Action step with no ActionID, a Prompt step with no PromptID).
42
+ */
43
+ IsStepMissingConfiguration(step: AIAgentStepEntity): boolean;
44
+ private isLoopBodyMissingReference;
45
+ /**
46
+ * Resolve the best icon and optional logo URL for a step based on its
47
+ * configured action/agent and available picker data.
48
+ *
49
+ * Resolution chain:
50
+ * - Action step: action's IconClass -> step-type fallback
51
+ * - Sub-Agent step: agent's LogoURL (stored in Data) -> agent's IconClass -> step-type fallback
52
+ * - Other steps: step-type icon
53
+ */
54
+ ResolveStepIcon(step: AIAgentStepEntity, actions?: ActionPickerItem[], agents?: AgentPickerItem[]): {
55
+ Icon: string;
56
+ LogoURL?: string | null;
57
+ };
58
+ private resolveLoopBodyIcon;
59
+ /** Convert a single MJ step entity to a FlowNode (public for direct use when adding nodes) */
60
+ StepToNode(step: AIAgentStepEntity, actions?: ActionPickerItem[], agents?: AgentPickerItem[]): FlowNode;
61
+ private pathToConnection;
62
+ private buildPathVisuals;
63
+ /** Populate loop-specific display data on the node's Data payload */
64
+ private populateLoopData;
65
+ /** Resolve the best icon for a loop body, checking picker data first */
66
+ private resolveLoopBodySpecificIcon;
67
+ /** Get icon for a loop body type */
68
+ private getBodyTypeIcon;
69
+ /** Get color for a loop body type */
70
+ private getBodyTypeColor;
71
+ private getIconForType;
72
+ private buildLoopSubtitle;
73
+ /** Resolve the display name for the loop body operation */
74
+ private resolveLoopBodyName;
75
+ /** Parse the Configuration JSON, returning null on failure */
76
+ private parseLoopConfig;
77
+ /** Build a short iteration summary for display on loop nodes */
78
+ BuildLoopIterationSummary(step: AIAgentStepEntity): string;
79
+ private truncateCondition;
80
+ static ɵfac: i0.ɵɵFactoryDeclaration<AgentFlowTransformerService, never>;
81
+ static ɵprov: i0.ɵɵInjectableDeclaration<AgentFlowTransformerService>;
82
+ }
83
+ //# sourceMappingURL=agent-flow-transformer.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-flow-transformer.service.d.ts","sourceRoot":"","sources":["../../../src/lib/agent-editor/agent-flow-transformer.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAuB,kBAAkB,EAAgB,MAAM,0BAA0B,CAAC;;AAE3H,uDAAuD;AACvD,MAAM,WAAW,gBAAgB;IAAG,EAAE,EAAE,MAAM,CAAC;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