@memberjunction/ng-task-graph-editor 0.0.0 → 6.1.0-edge.2
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/LICENSE +7 -0
- package/dist/lib/task-graph-canvas-adapter.d.ts +195 -0
- package/dist/lib/task-graph-canvas-adapter.d.ts.map +1 -0
- package/dist/lib/task-graph-canvas-adapter.js +380 -0
- package/dist/lib/task-graph-canvas-adapter.js.map +1 -0
- package/dist/lib/task-graph-editor-events.d.ts +137 -0
- package/dist/lib/task-graph-editor-events.d.ts.map +1 -0
- package/dist/lib/task-graph-editor-events.js +180 -0
- package/dist/lib/task-graph-editor-events.js.map +1 -0
- package/dist/lib/task-graph-editor.component.d.ts +230 -0
- package/dist/lib/task-graph-editor.component.d.ts.map +1 -0
- package/dist/lib/task-graph-editor.component.js +597 -0
- package/dist/lib/task-graph-editor.component.js.map +1 -0
- package/dist/lib/task-graph-editor.module.d.ts +14 -0
- package/dist/lib/task-graph-editor.module.d.ts.map +1 -0
- package/dist/lib/task-graph-editor.module.js +24 -0
- package/dist/lib/task-graph-editor.module.js.map +1 -0
- package/dist/lib/task-graph-properties-panel.component.d.ts +97 -0
- package/dist/lib/task-graph-properties-panel.component.d.ts.map +1 -0
- package/dist/lib/task-graph-properties-panel.component.js +357 -0
- package/dist/lib/task-graph-properties-panel.component.js.map +1 -0
- package/dist/lib/task-graph-run-view.component.d.ts +113 -0
- package/dist/lib/task-graph-run-view.component.d.ts.map +1 -0
- package/dist/lib/task-graph-run-view.component.js +289 -0
- package/dist/lib/task-graph-run-view.component.js.map +1 -0
- package/dist/lib/task-graph-runtime-source.d.ts +55 -0
- package/dist/lib/task-graph-runtime-source.d.ts.map +1 -0
- package/dist/lib/task-graph-runtime-source.js +66 -0
- package/dist/lib/task-graph-runtime-source.js.map +1 -0
- package/dist/public-api.d.ts +8 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +16 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +53 -7
- package/README.md +0 -45
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview View and edit a `TaskGraphSpec` on a canvas.
|
|
3
|
+
*
|
|
4
|
+
* **What makes this reusable is its subject.** It edits `TaskGraphSpec` — the one fully-qualified
|
|
5
|
+
* graph contract every producer in the program already authors against (D16) — rather than any
|
|
6
|
+
* particular persistence. A design-time flow, a graph an agent emitted at runtime, a stored workflow
|
|
7
|
+
* definition and a graph a person is drawing from scratch are all the same type here, so one
|
|
8
|
+
* component serves the Flow Agent editor, the Agent Run admin view, conversation plan cards, the
|
|
9
|
+
* Tasks view, and anything downstream.
|
|
10
|
+
*
|
|
11
|
+
* The alternative — teaching the existing agent editor a second dialect — is precisely how the two
|
|
12
|
+
* graph models drifted apart before Phase 4 pulled them onto one traversal engine.
|
|
13
|
+
*
|
|
14
|
+
* **Layer: `widgets` (L1/L2).** No `@angular/router`, no `@memberjunction/ng-shared`, no
|
|
15
|
+
* `NavigationService`. Route-derived state arrives as `@Input()`; navigation *intent* leaves as an
|
|
16
|
+
* `@Output()` the host acts on, because a widget cannot know whether it is inside Explorer, a
|
|
17
|
+
* downstream app, or an embedded panel. See `guides/UI_LAYERING_GUIDE.md`.
|
|
18
|
+
*
|
|
19
|
+
* **Validation is the engine's.** Cycles, unknown dependency refs and assignment conflicts are
|
|
20
|
+
* reported by calling `ValidateTaskGraphSpec` from `@memberjunction/ai-core-plus` — the same
|
|
21
|
+
* function `LoopAgentType` and `TaskGraphService.Submit` call. A second implementation here would be
|
|
22
|
+
* a second definition of "valid", and the graph that passes on the canvas would be free to fail at
|
|
23
|
+
* submission.
|
|
24
|
+
*
|
|
25
|
+
* @module @memberjunction/ng-task-graph-editor
|
|
26
|
+
*/
|
|
27
|
+
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
|
28
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
29
|
+
import { ConfigOf, ValidateTaskGraphSpec, } from '@memberjunction/ai-core-plus';
|
|
30
|
+
import { FlowEditorComponent } from '@memberjunction/ng-flow-editor';
|
|
31
|
+
import { AddDependency, AddTask, GetDependents, GetNodeTypeConfig, IsAuthorableNodeType, NewTaskFromNodeType, NextTempId, RemoveDependency, RemoveTask, SpecToConnections, SpecToNodes, TASK_GRAPH_NODE_TYPES, UpdateTask, WouldCreateCycle, } from './task-graph-canvas-adapter';
|
|
32
|
+
import { AfterDependencyAddedEventArgs, AfterDependencyRemovedEventArgs, AfterTaskAddedEventArgs, AfterTaskRemovedEventArgs, AfterTaskUpdatedEventArgs, AgentOpenRequestedEventArgs, BeforeDependencyAddedEventArgs, BeforeDependencyRemovedEventArgs, BeforeTaskAddedEventArgs, BeforeTaskRemovedEventArgs, BeforeTaskUpdatedEventArgs, RecordOpenRequestedEventArgs, TaskGraphSelectionChangedEventArgs, TaskGraphSpecChangedEventArgs, TaskGraphValidationChangedEventArgs, } from './task-graph-editor-events';
|
|
33
|
+
import * as i0 from "@angular/core";
|
|
34
|
+
import * as i1 from "@memberjunction/ng-flow-editor";
|
|
35
|
+
import * as i2 from "@memberjunction/ng-ui-components";
|
|
36
|
+
import * as i3 from "./task-graph-properties-panel.component";
|
|
37
|
+
const _forTrack0 = ($index, $item) => $item.Code + ($item.TempId ?? "");
|
|
38
|
+
function TaskGraphEditorComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
39
|
+
i0.ɵɵelement(0, "mj-empty-state", 1);
|
|
40
|
+
} if (rf & 2) {
|
|
41
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
42
|
+
i0.ɵɵproperty("Message", ctx_r0.EmptyStateMessage);
|
|
43
|
+
} }
|
|
44
|
+
function TaskGraphEditorComponent_Conditional_2_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
45
|
+
i0.ɵɵelement(0, "mj-alert", 2);
|
|
46
|
+
} if (rf & 2) {
|
|
47
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
48
|
+
i0.ɵɵproperty("Message", ctx_r0.EmptyStateMessage);
|
|
49
|
+
} }
|
|
50
|
+
function TaskGraphEditorComponent_Conditional_2_Conditional_1_For_5_Template(rf, ctx) { if (rf & 1) {
|
|
51
|
+
i0.ɵɵelementStart(0, "li");
|
|
52
|
+
i0.ɵɵtext(1);
|
|
53
|
+
i0.ɵɵelementEnd();
|
|
54
|
+
} if (rf & 2) {
|
|
55
|
+
const err_r3 = ctx.$implicit;
|
|
56
|
+
i0.ɵɵadvance();
|
|
57
|
+
i0.ɵɵtextInterpolate(err_r3.Message);
|
|
58
|
+
} }
|
|
59
|
+
function TaskGraphEditorComponent_Conditional_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
60
|
+
i0.ɵɵelementStart(0, "mj-alert", 3)(1, "strong");
|
|
61
|
+
i0.ɵɵtext(2);
|
|
62
|
+
i0.ɵɵelementEnd();
|
|
63
|
+
i0.ɵɵelementStart(3, "ul", 7);
|
|
64
|
+
i0.ɵɵrepeaterCreate(4, TaskGraphEditorComponent_Conditional_2_Conditional_1_For_5_Template, 2, 1, "li", null, _forTrack0);
|
|
65
|
+
i0.ɵɵelementEnd()();
|
|
66
|
+
} if (rf & 2) {
|
|
67
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
68
|
+
i0.ɵɵadvance(2);
|
|
69
|
+
i0.ɵɵtextInterpolate2("", ctx_r0.ValidationErrors.length, " problem", ctx_r0.ValidationErrors.length === 1 ? "" : "s", " to fix");
|
|
70
|
+
i0.ɵɵadvance(2);
|
|
71
|
+
i0.ɵɵrepeater(ctx_r0.ValidationErrors);
|
|
72
|
+
} }
|
|
73
|
+
function TaskGraphEditorComponent_Conditional_2_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
74
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
75
|
+
i0.ɵɵelementStart(0, "mj-task-graph-properties", 8);
|
|
76
|
+
i0.ɵɵlistener("TaskPropertyChangeRequested", function TaskGraphEditorComponent_Conditional_2_Conditional_4_Template_mj_task_graph_properties_TaskPropertyChangeRequested_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.OnTaskPropertyChangeRequested($event)); })("DependencyConditionChangeRequested", function TaskGraphEditorComponent_Conditional_2_Conditional_4_Template_mj_task_graph_properties_DependencyConditionChangeRequested_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.OnDependencyConditionChangeRequested($event)); });
|
|
77
|
+
i0.ɵɵelementEnd();
|
|
78
|
+
} if (rf & 2) {
|
|
79
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
80
|
+
i0.ɵɵproperty("Task", ctx_r0.SelectedTask)("Spec", ctx_r0.Spec)("ReadOnly", ctx_r0.ReadOnly)("AvailableAgentNames", ctx_r0.AvailableAgentNames)("AvailableActionNames", ctx_r0.AvailableActionNames);
|
|
81
|
+
} }
|
|
82
|
+
function TaskGraphEditorComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
83
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
84
|
+
i0.ɵɵconditionalCreate(0, TaskGraphEditorComponent_Conditional_2_Conditional_0_Template, 1, 1, "mj-alert", 2);
|
|
85
|
+
i0.ɵɵconditionalCreate(1, TaskGraphEditorComponent_Conditional_2_Conditional_1_Template, 6, 2, "mj-alert", 3);
|
|
86
|
+
i0.ɵɵelementStart(2, "div", 4)(3, "mj-flow-editor", 5);
|
|
87
|
+
i0.ɵɵlistener("NodeSelected", function TaskGraphEditorComponent_Conditional_2_Template_mj_flow_editor_NodeSelected_3_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OnNodeSelected($event)); })("NodeAdded", function TaskGraphEditorComponent_Conditional_2_Template_mj_flow_editor_NodeAdded_3_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OnNodeAdded($event)); })("NodeRemoved", function TaskGraphEditorComponent_Conditional_2_Template_mj_flow_editor_NodeRemoved_3_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OnNodeRemoved($event)); })("NodesChanged", function TaskGraphEditorComponent_Conditional_2_Template_mj_flow_editor_NodesChanged_3_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OnNodesChanged($event)); })("NodeMoved", function TaskGraphEditorComponent_Conditional_2_Template_mj_flow_editor_NodeMoved_3_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OnNodeMoved($event)); })("ConnectionCreated", function TaskGraphEditorComponent_Conditional_2_Template_mj_flow_editor_ConnectionCreated_3_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OnConnectionCreated($event)); })("ConnectionRemoved", function TaskGraphEditorComponent_Conditional_2_Template_mj_flow_editor_ConnectionRemoved_3_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OnConnectionRemoved($event)); });
|
|
88
|
+
i0.ɵɵelementEnd();
|
|
89
|
+
i0.ɵɵconditionalCreate(4, TaskGraphEditorComponent_Conditional_2_Conditional_4_Template, 1, 5, "mj-task-graph-properties", 6);
|
|
90
|
+
i0.ɵɵelementEnd();
|
|
91
|
+
} if (rf & 2) {
|
|
92
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
93
|
+
i0.ɵɵconditional(ctx_r0.IsEmpty ? 0 : -1);
|
|
94
|
+
i0.ɵɵadvance();
|
|
95
|
+
i0.ɵɵconditional(!ctx_r0.IsValid && ctx_r0.ValidationErrors.length > 0 ? 1 : -1);
|
|
96
|
+
i0.ɵɵadvance(2);
|
|
97
|
+
i0.ɵɵproperty("Nodes", ctx_r0.Nodes)("Connections", ctx_r0.Connections)("NodeTypes", ctx_r0.NodeTypes)("ReadOnly", ctx_r0.ReadOnly)("ShowToolbar", ctx_r0.ShowToolbar)("ShowPalette", ctx_r0.ShowPalette && !ctx_r0.ReadOnly)("ShowMinimap", ctx_r0.ShowMinimap)("ShowStatusBar", ctx_r0.ShowStatusBar)("AutoLayoutDirection", ctx_r0.AutoLayoutDirection);
|
|
98
|
+
i0.ɵɵadvance();
|
|
99
|
+
i0.ɵɵconditional(ctx_r0.ShowProperties && !ctx_r0.ReadOnly ? 4 : -1);
|
|
100
|
+
} }
|
|
101
|
+
export class TaskGraphEditorComponent extends BaseAngularComponent {
|
|
102
|
+
// ── Inputs ───────────────────────────────────────────────────────────────
|
|
103
|
+
/**
|
|
104
|
+
* The graph to show. Setter-based rather than `ngOnChanges` (repo convention): the reaction is
|
|
105
|
+
* explicit, runs only when this property changes, and costs nothing on other change-detection
|
|
106
|
+
* passes.
|
|
107
|
+
*/
|
|
108
|
+
set Spec(value) {
|
|
109
|
+
this.currentSpec = value;
|
|
110
|
+
this.project();
|
|
111
|
+
}
|
|
112
|
+
get Spec() {
|
|
113
|
+
return this.currentSpec;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Live per-task state, keyed by `tempId`. Supplying it turns the canvas into a runtime view of
|
|
117
|
+
* the same graph — the convergence point the program was aiming at: one renderer for design time
|
|
118
|
+
* and run time, rather than an editor and a separate Gantt that can disagree.
|
|
119
|
+
*/
|
|
120
|
+
set RuntimeStatus(value) {
|
|
121
|
+
this.currentRuntime = value;
|
|
122
|
+
this.project();
|
|
123
|
+
}
|
|
124
|
+
get RuntimeStatus() {
|
|
125
|
+
return this.currentRuntime;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Geometry for the nodes, keyed by `tempId`. Supplying it places the graph instead of laying it
|
|
129
|
+
* out.
|
|
130
|
+
*
|
|
131
|
+
* **Why a host must be able to supply this.** The spec has no layout field, so without it every
|
|
132
|
+
* node projects to the origin — all of them, stacked in one place — and the canvas is left to
|
|
133
|
+
* rescue the situation with a deferred Dagre pass. That pass is fine in the editor, where the
|
|
134
|
+
* author is present and can rearrange. It was not fine in the RUN views, which held the real
|
|
135
|
+
* geometry (a workflow's authored positions, or a computed layout) and had no way to hand it
|
|
136
|
+
* over: every run rendered its steps piled on the origin, and the zoom-to-fit that followed
|
|
137
|
+
* fitted a bounding box one node wide and blew the viewport up past 250%.
|
|
138
|
+
*
|
|
139
|
+
* Applied as the starting geometry only. Once the canvas reports positions of its own — a drag,
|
|
140
|
+
* an arrange — those win, because the person moving a node is the authority on where it goes.
|
|
141
|
+
*/
|
|
142
|
+
set NodePositions(value) {
|
|
143
|
+
if (!value || value.size === 0)
|
|
144
|
+
return;
|
|
145
|
+
for (const [id, position] of value)
|
|
146
|
+
this.knownPositions.set(id, { ...position });
|
|
147
|
+
// Real geometry means the one-time Dagre pass has nothing to rescue.
|
|
148
|
+
this.hasLaidOut = true;
|
|
149
|
+
this.project();
|
|
150
|
+
this.zoomToFitSoon();
|
|
151
|
+
}
|
|
152
|
+
/** Read-only mode. The same component is the viewer — there is no second, weaker renderer. */
|
|
153
|
+
ReadOnly = false;
|
|
154
|
+
ShowToolbar = true;
|
|
155
|
+
ShowPalette = true;
|
|
156
|
+
ShowMinimap = true;
|
|
157
|
+
ShowStatusBar = true;
|
|
158
|
+
AutoLayoutDirection = 'vertical';
|
|
159
|
+
/**
|
|
160
|
+
* Whether the properties panel rides alongside the canvas.
|
|
161
|
+
*
|
|
162
|
+
* On by default, because without it a step added from the palette can never be named or
|
|
163
|
+
* assigned — the canvas draws structure, the panel supplies content, and one without the other
|
|
164
|
+
* is a graph the author can build but not finish. Hosts embedding the read-only viewer in a chat
|
|
165
|
+
* card turn it off.
|
|
166
|
+
*/
|
|
167
|
+
ShowProperties = true;
|
|
168
|
+
/**
|
|
169
|
+
* Agent names offered when assigning a step. Supplied by the host, which owns data access —
|
|
170
|
+
* this is a widgets-layer component and does not query.
|
|
171
|
+
*/
|
|
172
|
+
AvailableAgentNames = [];
|
|
173
|
+
/** Action names offered when assigning a step. Same ownership rule as `AvailableAgentNames`. */
|
|
174
|
+
AvailableActionNames = [];
|
|
175
|
+
/** Shown when there is nothing to draw yet. */
|
|
176
|
+
EmptyStateMessage = 'No steps yet. Add one to start building this workflow.';
|
|
177
|
+
// ── Outputs ──────────────────────────────────────────────────────────────
|
|
178
|
+
BeforeTaskAdded = new EventEmitter();
|
|
179
|
+
AfterTaskAdded = new EventEmitter();
|
|
180
|
+
BeforeTaskRemoved = new EventEmitter();
|
|
181
|
+
AfterTaskRemoved = new EventEmitter();
|
|
182
|
+
BeforeTaskUpdated = new EventEmitter();
|
|
183
|
+
AfterTaskUpdated = new EventEmitter();
|
|
184
|
+
BeforeDependencyAdded = new EventEmitter();
|
|
185
|
+
AfterDependencyAdded = new EventEmitter();
|
|
186
|
+
BeforeDependencyRemoved = new EventEmitter();
|
|
187
|
+
AfterDependencyRemoved = new EventEmitter();
|
|
188
|
+
/** Informational — no `Before` pair, because these report what already happened. */
|
|
189
|
+
SpecChanged = new EventEmitter();
|
|
190
|
+
SelectionChanged = new EventEmitter();
|
|
191
|
+
ValidationChanged = new EventEmitter();
|
|
192
|
+
/** Intent-only — the host navigates; this widget has no Router and must not acquire one. */
|
|
193
|
+
AgentOpenRequested = new EventEmitter();
|
|
194
|
+
RecordOpenRequested = new EventEmitter();
|
|
195
|
+
// ── Rendered state ───────────────────────────────────────────────────────
|
|
196
|
+
Nodes = [];
|
|
197
|
+
Connections = [];
|
|
198
|
+
NodeTypes = [...TASK_GRAPH_NODE_TYPES];
|
|
199
|
+
SelectedTask = null;
|
|
200
|
+
ValidationErrors = [];
|
|
201
|
+
IsValid = true;
|
|
202
|
+
canvas;
|
|
203
|
+
currentSpec = null;
|
|
204
|
+
currentRuntime = null;
|
|
205
|
+
get IsEmpty() {
|
|
206
|
+
return (this.currentSpec?.tasks?.length ?? 0) === 0;
|
|
207
|
+
}
|
|
208
|
+
// ── Public methods ───────────────────────────────────────────────────────
|
|
209
|
+
//
|
|
210
|
+
// Imperative entry points exist for exactly the case the cancelable-event contract cannot serve:
|
|
211
|
+
// a host that needs to `await` something (a confirm dialog) before the action proceeds. A
|
|
212
|
+
// `Before*` handler cannot await — control returns to the emitter before the handler sets
|
|
213
|
+
// `Cancel` — so the host awaits first and then calls one of these.
|
|
214
|
+
/** Re-runs validation and emits the result. Idempotent. */
|
|
215
|
+
Validate() {
|
|
216
|
+
const result = this.currentSpec
|
|
217
|
+
? ValidateTaskGraphSpec(this.currentSpec)
|
|
218
|
+
: { Valid: true, Errors: [] };
|
|
219
|
+
this.IsValid = result.Valid;
|
|
220
|
+
this.ValidationErrors = result.Errors;
|
|
221
|
+
const args = new TaskGraphValidationChangedEventArgs(result.Valid, result.Errors);
|
|
222
|
+
this.ValidationChanged.emit(args);
|
|
223
|
+
return args;
|
|
224
|
+
}
|
|
225
|
+
/** Adds a task. Returns the new task, or null when a host vetoed it. */
|
|
226
|
+
AddTask(partial = {}) {
|
|
227
|
+
if (this.ReadOnly || !this.currentSpec)
|
|
228
|
+
return null;
|
|
229
|
+
// Kind and configuration travel together — a partial that supplies one without the other
|
|
230
|
+
// would be a node the engine cannot run, so an unspecified partial defaults to an unassigned
|
|
231
|
+
// Agent step and the validator says so immediately.
|
|
232
|
+
const task = {
|
|
233
|
+
tempId: partial.tempId ?? NextTempId(this.currentSpec),
|
|
234
|
+
name: partial.name ?? 'New step',
|
|
235
|
+
description: partial.description ?? '',
|
|
236
|
+
kind: partial.kind ?? 'Agent',
|
|
237
|
+
configuration: partial.configuration ?? { agentName: '' },
|
|
238
|
+
dependsOn: partial.dependsOn ?? [],
|
|
239
|
+
policy: partial.policy,
|
|
240
|
+
layout: partial.layout,
|
|
241
|
+
inputPayload: partial.inputPayload,
|
|
242
|
+
};
|
|
243
|
+
const before = new BeforeTaskAddedEventArgs(task);
|
|
244
|
+
this.BeforeTaskAdded.emit(before);
|
|
245
|
+
if (before.Cancel)
|
|
246
|
+
return null;
|
|
247
|
+
this.commit(AddTask(this.currentSpec, task), 'TaskAdded');
|
|
248
|
+
this.AfterTaskAdded.emit(new AfterTaskAddedEventArgs(task, this.currentSpec));
|
|
249
|
+
return task;
|
|
250
|
+
}
|
|
251
|
+
/** Removes a task and every edge into it. Returns false when a host vetoed it. */
|
|
252
|
+
RemoveTask(tempId) {
|
|
253
|
+
if (this.ReadOnly || !this.currentSpec)
|
|
254
|
+
return false;
|
|
255
|
+
const task = this.findTask(tempId);
|
|
256
|
+
if (!task)
|
|
257
|
+
return false;
|
|
258
|
+
// The blast radius travels with the event: a host deciding whether to veto needs to know
|
|
259
|
+
// what else breaks, not merely which box was clicked.
|
|
260
|
+
const before = new BeforeTaskRemovedEventArgs(task, GetDependents(this.currentSpec, tempId));
|
|
261
|
+
this.BeforeTaskRemoved.emit(before);
|
|
262
|
+
if (before.Cancel)
|
|
263
|
+
return false;
|
|
264
|
+
this.commit(RemoveTask(this.currentSpec, tempId), 'TaskRemoved');
|
|
265
|
+
if (this.SelectedTask?.tempId === tempId)
|
|
266
|
+
this.selectTask(null);
|
|
267
|
+
this.AfterTaskRemoved.emit(new AfterTaskRemovedEventArgs(task, this.currentSpec));
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
/** Replaces a task's properties. Returns false when a host vetoed it. */
|
|
271
|
+
UpdateTask(tempId, next) {
|
|
272
|
+
if (this.ReadOnly || !this.currentSpec)
|
|
273
|
+
return false;
|
|
274
|
+
const previous = this.findTask(tempId);
|
|
275
|
+
if (!previous)
|
|
276
|
+
return false;
|
|
277
|
+
const before = new BeforeTaskUpdatedEventArgs(previous, next);
|
|
278
|
+
this.BeforeTaskUpdated.emit(before);
|
|
279
|
+
if (before.Cancel)
|
|
280
|
+
return false;
|
|
281
|
+
this.commit(UpdateTask(this.currentSpec, tempId, next), 'TaskUpdated');
|
|
282
|
+
if (this.SelectedTask?.tempId === tempId)
|
|
283
|
+
this.SelectedTask = next;
|
|
284
|
+
this.AfterTaskUpdated.emit(new AfterTaskUpdatedEventArgs(next, this.currentSpec));
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Adds a dependency edge. Returns false when it was vetoed **or would create a cycle**.
|
|
289
|
+
*
|
|
290
|
+
* The cycle is refused unconditionally, not merely reported: a cyclic graph can never execute —
|
|
291
|
+
* nothing would ever become eligible — so allowing the canvas to draw one would let a user build
|
|
292
|
+
* something the engine must then reject. Better to refuse the stroke than to accept a graph that
|
|
293
|
+
* cannot run.
|
|
294
|
+
*/
|
|
295
|
+
AddDependency(fromTempId, toTempId, condition) {
|
|
296
|
+
if (this.ReadOnly || !this.currentSpec)
|
|
297
|
+
return false;
|
|
298
|
+
const cycle = WouldCreateCycle(this.currentSpec, fromTempId, toTempId);
|
|
299
|
+
const before = new BeforeDependencyAddedEventArgs(fromTempId, toTempId, cycle);
|
|
300
|
+
this.BeforeDependencyAdded.emit(before);
|
|
301
|
+
if (before.Cancel || cycle)
|
|
302
|
+
return false;
|
|
303
|
+
this.commit(AddDependency(this.currentSpec, fromTempId, toTempId, condition), 'DependencyAdded');
|
|
304
|
+
this.AfterDependencyAdded.emit(new AfterDependencyAddedEventArgs(fromTempId, toTempId, this.currentSpec));
|
|
305
|
+
return true;
|
|
306
|
+
}
|
|
307
|
+
/** Removes a dependency edge. Returns false when a host vetoed it. */
|
|
308
|
+
RemoveDependency(fromTempId, toTempId) {
|
|
309
|
+
if (this.ReadOnly || !this.currentSpec)
|
|
310
|
+
return false;
|
|
311
|
+
const before = new BeforeDependencyRemovedEventArgs(fromTempId, toTempId);
|
|
312
|
+
this.BeforeDependencyRemoved.emit(before);
|
|
313
|
+
if (before.Cancel)
|
|
314
|
+
return false;
|
|
315
|
+
this.commit(RemoveDependency(this.currentSpec, fromTempId, toTempId), 'DependencyRemoved');
|
|
316
|
+
this.AfterDependencyRemoved.emit(new AfterDependencyRemovedEventArgs(fromTempId, toTempId, this.currentSpec));
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Sets — or with an empty string, clears — a dependency edge's condition.
|
|
321
|
+
*
|
|
322
|
+
* Implemented as remove-then-add so it travels the same `Before*`/`After*` path as any other
|
|
323
|
+
* edge change. A separate silent mutation would be a second write path into the spec, and the
|
|
324
|
+
* veto contract would then be right in one place and wrong in the other.
|
|
325
|
+
*/
|
|
326
|
+
SetDependencyCondition(fromTempId, toTempId, condition) {
|
|
327
|
+
if (this.ReadOnly || !this.currentSpec)
|
|
328
|
+
return false;
|
|
329
|
+
if (!this.RemoveDependency(fromTempId, toTempId))
|
|
330
|
+
return false;
|
|
331
|
+
return this.AddDependency(fromTempId, toTempId, condition.trim() || undefined);
|
|
332
|
+
}
|
|
333
|
+
/** Asks the host to open the agent behind a task. */
|
|
334
|
+
RequestAgentOpen(task) {
|
|
335
|
+
const agentName = ConfigOf(task, 'Agent')?.agentName;
|
|
336
|
+
if (agentName) {
|
|
337
|
+
this.AgentOpenRequested.emit(new AgentOpenRequestedEventArgs(agentName, task));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/** Asks the host to open a record the graph references. */
|
|
341
|
+
RequestRecordOpen(entityName, recordID) {
|
|
342
|
+
this.RecordOpenRequested.emit(new RecordOpenRequestedEventArgs(entityName, recordID));
|
|
343
|
+
}
|
|
344
|
+
// ── Canvas handlers ──────────────────────────────────────────────────────
|
|
345
|
+
OnNodeSelected(node) {
|
|
346
|
+
this.selectTask(node ? this.findTask(node.ID) : null);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* A palette entry was clicked or dragged onto the canvas.
|
|
350
|
+
*
|
|
351
|
+
* **This binding is the bug.** The canvas has always emitted `NodeAdded` for a palette drop, and
|
|
352
|
+
* this component simply never listened — so the node the canvas announced was thrown away, the
|
|
353
|
+
* spec never gained a task, and the author was told "a task graph must contain at least one
|
|
354
|
+
* task" no matter how many times they tried to add one. The canvas does not mutate its own
|
|
355
|
+
* `Nodes` on purpose (the host owns the model); an unheard event is therefore a silent no-op
|
|
356
|
+
* rather than a visible failure, which is why it survived.
|
|
357
|
+
*
|
|
358
|
+
* The new step is selected immediately: it lands unnamed and, for an agent or action step with
|
|
359
|
+
* nothing available to default to, unassigned — so the properties panel is where the author has
|
|
360
|
+
* to go next, and putting them there beats making them find it.
|
|
361
|
+
*/
|
|
362
|
+
OnNodeAdded(event) {
|
|
363
|
+
if (this.ReadOnly || !this.currentSpec)
|
|
364
|
+
return;
|
|
365
|
+
const type = GetNodeTypeConfig(event.Node.Type)?.Type;
|
|
366
|
+
// Only an authorable shape can be dropped from the palette. The render set is wider, and a
|
|
367
|
+
// display-only kind arriving here would mean the palette offered something with no editor.
|
|
368
|
+
if (!type || !IsAuthorableNodeType(type))
|
|
369
|
+
return;
|
|
370
|
+
const added = this.AddTask(NewTaskFromNodeType(this.currentSpec, type, {
|
|
371
|
+
agentName: this.AvailableAgentNames[0],
|
|
372
|
+
actionName: this.AvailableActionNames[0],
|
|
373
|
+
}));
|
|
374
|
+
if (!added)
|
|
375
|
+
return;
|
|
376
|
+
// Remember where the canvas put it BEFORE anything re-projects. The spec has no geometry
|
|
377
|
+
// field, so this map is the only record that the author dropped (or clicked) it here — and
|
|
378
|
+
// without it the node would snap back to the origin on the very next edit.
|
|
379
|
+
this.knownPositions.set(added.tempId, { ...event.Node.Position });
|
|
380
|
+
// A graph that has received a hand-placed node is laid out, by definition. Marking it here
|
|
381
|
+
// stops the one-time Dagre pass from firing later and discarding that placement.
|
|
382
|
+
this.hasLaidOut = true;
|
|
383
|
+
this.selectTask(added);
|
|
384
|
+
}
|
|
385
|
+
/** Applies a properties-panel edit through the same vetoable path a canvas edit takes. */
|
|
386
|
+
OnTaskPropertyChangeRequested(args) {
|
|
387
|
+
this.UpdateTask(args.TempId, args.Next);
|
|
388
|
+
}
|
|
389
|
+
/** Applies a properties-panel edge-condition edit. */
|
|
390
|
+
OnDependencyConditionChangeRequested(args) {
|
|
391
|
+
this.SetDependencyCondition(args.FromTempId, args.ToTempId, args.Condition);
|
|
392
|
+
}
|
|
393
|
+
OnConnectionCreated(event) {
|
|
394
|
+
this.AddDependency(event.SourceNodeID, event.TargetNodeID);
|
|
395
|
+
}
|
|
396
|
+
OnConnectionRemoved(connection) {
|
|
397
|
+
this.RemoveDependency(connection.SourceNodeID, connection.TargetNodeID);
|
|
398
|
+
}
|
|
399
|
+
OnNodeRemoved(node) {
|
|
400
|
+
this.RemoveTask(node.ID);
|
|
401
|
+
}
|
|
402
|
+
// ── Internals ────────────────────────────────────────────────────────────
|
|
403
|
+
findTask(tempId) {
|
|
404
|
+
return (this.currentSpec?.tasks ?? []).find((t) => t.tempId === tempId) ?? null;
|
|
405
|
+
}
|
|
406
|
+
selectTask(task) {
|
|
407
|
+
this.SelectedTask = task;
|
|
408
|
+
this.SelectionChanged.emit(new TaskGraphSelectionChangedEventArgs(task));
|
|
409
|
+
}
|
|
410
|
+
/** Applies a new spec, re-projects, re-validates, and tells the host — in that order. */
|
|
411
|
+
commit(spec, reason) {
|
|
412
|
+
this.currentSpec = spec;
|
|
413
|
+
this.project();
|
|
414
|
+
this.SpecChanged.emit(new TaskGraphSpecChangedEventArgs(spec, reason));
|
|
415
|
+
}
|
|
416
|
+
/** Re-derives the canvas from the spec. Validation rides along so the two never disagree. */
|
|
417
|
+
project() {
|
|
418
|
+
if (!this.currentSpec) {
|
|
419
|
+
this.Nodes = [];
|
|
420
|
+
this.Connections = [];
|
|
421
|
+
this.ValidationErrors = [];
|
|
422
|
+
this.IsValid = true;
|
|
423
|
+
this.hasLaidOut = false;
|
|
424
|
+
this.knownPositions.clear();
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
this.Nodes = SpecToNodes(this.currentSpec, this.currentRuntime ?? undefined, this.knownPositions);
|
|
428
|
+
this.Connections = SpecToConnections(this.currentSpec);
|
|
429
|
+
this.Validate();
|
|
430
|
+
this.arrangeIfNeverLaidOut();
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Lays the graph out ONCE — when it arrives with no geometry of its own.
|
|
434
|
+
*
|
|
435
|
+
* A `TaskGraphSpec` carries no positions, so a spec opened for the first time projects with
|
|
436
|
+
* every node at the origin and needs Dagre to make it readable. After that the author's layout
|
|
437
|
+
* is the layout: `knownPositions` carries it across re-projections, and re-arranging again would
|
|
438
|
+
* throw away the arrangement they just made.
|
|
439
|
+
*
|
|
440
|
+
* It must also not run on every edit, because `AutoArrange` ends in `ZoomToFit` — so arranging
|
|
441
|
+
* per change meant the viewport snapped to fit after every added step and every drawn
|
|
442
|
+
* connection, which on a one-node graph zooms to maximum. That is the behaviour being fixed
|
|
443
|
+
* here; the rule mirrors the Flow Agent editor's (`flow-agent-editor.component.ts`), which has
|
|
444
|
+
* always arranged only when every node sits at the origin.
|
|
445
|
+
*/
|
|
446
|
+
arrangeIfNeverLaidOut() {
|
|
447
|
+
if (this.Nodes.length === 0)
|
|
448
|
+
return;
|
|
449
|
+
if (this.hasLaidOut)
|
|
450
|
+
return;
|
|
451
|
+
// Nothing to rescue a layout from: a spec whose nodes all sit at the origin has never been
|
|
452
|
+
// arranged. One node at the origin is the legitimate starting case too.
|
|
453
|
+
const allAtOrigin = this.Nodes.every((n) => n.Position.X === 0 && n.Position.Y === 0);
|
|
454
|
+
if (!allAtOrigin) {
|
|
455
|
+
this.hasLaidOut = true;
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
this.hasLaidOut = true;
|
|
459
|
+
// Deferred one turn: the canvas has to render the nodes before Dagre can measure them.
|
|
460
|
+
// Cleared on destroy so a pending layout cannot run against a torn-down view.
|
|
461
|
+
if (this.pendingLayout !== null)
|
|
462
|
+
clearTimeout(this.pendingLayout);
|
|
463
|
+
this.pendingLayout = setTimeout(() => {
|
|
464
|
+
this.pendingLayout = null;
|
|
465
|
+
this.canvas?.AutoArrange(this.AutoLayoutDirection);
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Fits the viewport to the graph, once the canvas has drawn it.
|
|
470
|
+
*
|
|
471
|
+
* Deferred for the same reason the layout pass is: `fitToScreen` measures the rendered nodes, so
|
|
472
|
+
* calling it in the same turn as the projection fits whatever was on screen a moment ago. With
|
|
473
|
+
* every node still at the origin that bounding box is a single node wide, and "fit" means zoom
|
|
474
|
+
* to ~265% — the symptom that made a four-step workflow look like one enormous box.
|
|
475
|
+
*/
|
|
476
|
+
zoomToFitSoon() {
|
|
477
|
+
if (this.pendingLayout !== null)
|
|
478
|
+
clearTimeout(this.pendingLayout);
|
|
479
|
+
this.pendingLayout = setTimeout(() => {
|
|
480
|
+
this.pendingLayout = null;
|
|
481
|
+
this.canvas?.ZoomToFit();
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* The canvas is the authority on geometry, so remember what it reports.
|
|
486
|
+
*
|
|
487
|
+
* Without this the spec — which has no geometry field — is the only survivor of a re-projection,
|
|
488
|
+
* and every edit silently moved every node back to the origin. That is what forced a re-arrange
|
|
489
|
+
* (and therefore a re-zoom) on each change.
|
|
490
|
+
*/
|
|
491
|
+
OnNodesChanged(nodes) {
|
|
492
|
+
for (const n of nodes)
|
|
493
|
+
this.knownPositions.set(n.ID, { ...n.Position });
|
|
494
|
+
}
|
|
495
|
+
/** A single node was dragged. Same authority, narrower event. */
|
|
496
|
+
OnNodeMoved(event) {
|
|
497
|
+
this.knownPositions.set(event.NodeID, { ...event.NewPosition });
|
|
498
|
+
}
|
|
499
|
+
ngOnDestroy() {
|
|
500
|
+
if (this.pendingLayout !== null) {
|
|
501
|
+
clearTimeout(this.pendingLayout);
|
|
502
|
+
this.pendingLayout = null;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
/** The topology the current layout was computed for; '' when nothing has been laid out. */
|
|
506
|
+
/**
|
|
507
|
+
* Node geometry, which the spec cannot hold.
|
|
508
|
+
*
|
|
509
|
+
* `TaskGraphSpec` is an execution contract with no layout field, so a re-projection would
|
|
510
|
+
* otherwise return every node to the origin. Keyed by `tempId`; written from the canvas
|
|
511
|
+
* (`NodesChanged` / `NodeMoved`) and from the drop position of a newly added node, and read back
|
|
512
|
+
* by `SpecToNodes` on every projection.
|
|
513
|
+
*/
|
|
514
|
+
knownPositions = new Map();
|
|
515
|
+
/** Whether the one-time Dagre pass has run (or been made unnecessary by a hand-placed node). */
|
|
516
|
+
hasLaidOut = false;
|
|
517
|
+
pendingLayout = null;
|
|
518
|
+
static ɵfac = /*@__PURE__*/ (() => { let ɵTaskGraphEditorComponent_BaseFactory; return function TaskGraphEditorComponent_Factory(__ngFactoryType__) { return (ɵTaskGraphEditorComponent_BaseFactory || (ɵTaskGraphEditorComponent_BaseFactory = i0.ɵɵgetInheritedFactory(TaskGraphEditorComponent)))(__ngFactoryType__ || TaskGraphEditorComponent); }; })();
|
|
519
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TaskGraphEditorComponent, selectors: [["mj-task-graph-editor"]], viewQuery: function TaskGraphEditorComponent_Query(rf, ctx) { if (rf & 1) {
|
|
520
|
+
i0.ɵɵviewQuery(FlowEditorComponent, 5);
|
|
521
|
+
} if (rf & 2) {
|
|
522
|
+
let _t;
|
|
523
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.canvas = _t.first);
|
|
524
|
+
} }, inputs: { Spec: "Spec", RuntimeStatus: "RuntimeStatus", NodePositions: "NodePositions", ReadOnly: "ReadOnly", ShowToolbar: "ShowToolbar", ShowPalette: "ShowPalette", ShowMinimap: "ShowMinimap", ShowStatusBar: "ShowStatusBar", AutoLayoutDirection: "AutoLayoutDirection", ShowProperties: "ShowProperties", AvailableAgentNames: "AvailableAgentNames", AvailableActionNames: "AvailableActionNames", EmptyStateMessage: "EmptyStateMessage" }, outputs: { BeforeTaskAdded: "BeforeTaskAdded", AfterTaskAdded: "AfterTaskAdded", BeforeTaskRemoved: "BeforeTaskRemoved", AfterTaskRemoved: "AfterTaskRemoved", BeforeTaskUpdated: "BeforeTaskUpdated", AfterTaskUpdated: "AfterTaskUpdated", BeforeDependencyAdded: "BeforeDependencyAdded", AfterDependencyAdded: "AfterDependencyAdded", BeforeDependencyRemoved: "BeforeDependencyRemoved", AfterDependencyRemoved: "AfterDependencyRemoved", SpecChanged: "SpecChanged", SelectionChanged: "SelectionChanged", ValidationChanged: "ValidationChanged", AgentOpenRequested: "AgentOpenRequested", RecordOpenRequested: "RecordOpenRequested" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 1, consts: [[1, "mj-tge"], ["Icon", "fa-diagram-project", "Title", "Nothing here yet", 3, "Message"], ["Variant", "info", 1, "mj-tge__empty-hint", 3, "Message"], ["Variant", "warning", 1, "mj-tge__validation"], [1, "mj-tge__workspace"], [1, "mj-tge__canvas", 3, "NodeSelected", "NodeAdded", "NodeRemoved", "NodesChanged", "NodeMoved", "ConnectionCreated", "ConnectionRemoved", "Nodes", "Connections", "NodeTypes", "ReadOnly", "ShowToolbar", "ShowPalette", "ShowMinimap", "ShowStatusBar", "AutoLayoutDirection"], [1, "mj-tge__properties", 3, "Task", "Spec", "ReadOnly", "AvailableAgentNames", "AvailableActionNames"], [1, "mj-tge__validation-list"], [1, "mj-tge__properties", 3, "TaskPropertyChangeRequested", "DependencyConditionChangeRequested", "Task", "Spec", "ReadOnly", "AvailableAgentNames", "AvailableActionNames"]], template: function TaskGraphEditorComponent_Template(rf, ctx) { if (rf & 1) {
|
|
525
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
526
|
+
i0.ɵɵconditionalCreate(1, TaskGraphEditorComponent_Conditional_1_Template, 1, 1, "mj-empty-state", 1)(2, TaskGraphEditorComponent_Conditional_2_Template, 5, 12);
|
|
527
|
+
i0.ɵɵelementEnd();
|
|
528
|
+
} if (rf & 2) {
|
|
529
|
+
i0.ɵɵadvance();
|
|
530
|
+
i0.ɵɵconditional(ctx.IsEmpty && ctx.ReadOnly ? 1 : 2);
|
|
531
|
+
} }, dependencies: [i1.FlowEditorComponent, i2.MJEmptyStateComponent, i2.MJAlertComponent, i3.TaskGraphPropertiesPanelComponent], styles: ["\n\n.mj-tge[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 0;\n background: var(--mj-bg-page);\n}\n\n.mj-tge__validation[_ngcontent-%COMP%] {\n flex: 0 0 auto;\n margin: var(--mj-space-sm, 0.5rem);\n}\n\n.mj-tge__validation-list[_ngcontent-%COMP%] {\n margin: var(--mj-space-xs, 0.25rem) 0 0;\n padding-inline-start: 1.25rem;\n}\n\n\n\n.mj-tge__workspace[_ngcontent-%COMP%] {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n}\n\n\n\n.mj-tge__canvas[_ngcontent-%COMP%] {\n flex: 1 1 auto;\n min-width: 0;\n min-height: 0;\n}\n\n.mj-tge__properties[_ngcontent-%COMP%] {\n flex: 0 0 auto;\n width: 300px;\n min-height: 0;\n overflow-y: auto;\n border-left: 1px solid var(--mj-border-default);\n}\n\n@media (max-width: 900px) {\n \n\n .mj-tge__workspace[_ngcontent-%COMP%] {\n flex-direction: column;\n }\n\n .mj-tge__properties[_ngcontent-%COMP%] {\n width: 100%;\n max-height: 40%;\n border-left: 0;\n border-top: 1px solid var(--mj-border-default);\n }\n}\n\n\n\n.mj-tge__empty-hint[_ngcontent-%COMP%] {\n margin: var(--mj-space-2) var(--mj-space-3) 0;\n}"] });
|
|
532
|
+
}
|
|
533
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskGraphEditorComponent, [{
|
|
534
|
+
type: Component,
|
|
535
|
+
args: [{ standalone: false, selector: 'mj-task-graph-editor', template: "<div class=\"mj-tge\">\n <!-- An EDITABLE empty canvas must still render the editor, because the palette is the only way to\n add a step \u2014 showing a bare empty state instead made \"Add one to start building this workflow\"\n an instruction the user could not follow. The hint stays, as a banner above a usable canvas. -->\n @if (IsEmpty && ReadOnly) {\n <mj-empty-state\n Icon=\"fa-diagram-project\"\n Title=\"Nothing here yet\"\n [Message]=\"EmptyStateMessage\">\n </mj-empty-state>\n } @else {\n @if (IsEmpty) {\n <mj-alert Variant=\"info\" class=\"mj-tge__empty-hint\" [Message]=\"EmptyStateMessage\"></mj-alert>\n }\n @if (!IsValid && ValidationErrors.length > 0) {\n <!-- Author-time validation comes from the SAME function the engine runs at submission, so a\n graph that looks fine here cannot be rejected later for a reason the canvas never showed. -->\n <mj-alert Variant=\"warning\" class=\"mj-tge__validation\">\n <strong>{{ ValidationErrors.length }} problem{{ ValidationErrors.length === 1 ? '' : 's' }} to fix</strong>\n <ul class=\"mj-tge__validation-list\">\n @for (err of ValidationErrors; track err.Code + (err.TempId ?? '')) {\n <li>{{ err.Message }}</li>\n }\n </ul>\n </mj-alert>\n }\n\n <div class=\"mj-tge__workspace\">\n <mj-flow-editor\n class=\"mj-tge__canvas\"\n [Nodes]=\"Nodes\"\n [Connections]=\"Connections\"\n [NodeTypes]=\"NodeTypes\"\n [ReadOnly]=\"ReadOnly\"\n [ShowToolbar]=\"ShowToolbar\"\n [ShowPalette]=\"ShowPalette && !ReadOnly\"\n [ShowMinimap]=\"ShowMinimap\"\n [ShowStatusBar]=\"ShowStatusBar\"\n [AutoLayoutDirection]=\"AutoLayoutDirection\"\n (NodeSelected)=\"OnNodeSelected($event)\"\n (NodeAdded)=\"OnNodeAdded($event)\"\n (NodeRemoved)=\"OnNodeRemoved($event)\"\n (NodesChanged)=\"OnNodesChanged($event)\"\n (NodeMoved)=\"OnNodeMoved($event)\"\n (ConnectionCreated)=\"OnConnectionCreated($event)\"\n (ConnectionRemoved)=\"OnConnectionRemoved($event)\">\n </mj-flow-editor>\n\n <!-- The canvas draws structure; this supplies content. A step added from the palette arrives\n unnamed and (with nothing to default to) unassigned, so without this panel the author can\n create a step but never finish one. -->\n @if (ShowProperties && !ReadOnly) {\n <mj-task-graph-properties\n class=\"mj-tge__properties\"\n [Task]=\"SelectedTask\"\n [Spec]=\"Spec\"\n [ReadOnly]=\"ReadOnly\"\n [AvailableAgentNames]=\"AvailableAgentNames\"\n [AvailableActionNames]=\"AvailableActionNames\"\n (TaskPropertyChangeRequested)=\"OnTaskPropertyChangeRequested($event)\"\n (DependencyConditionChangeRequested)=\"OnDependencyConditionChangeRequested($event)\">\n </mj-task-graph-properties>\n }\n </div>\n }\n</div>\n", styles: ["/* Design tokens only \u2014 no hardcoded colors (see .claude/rules/design-tokens.md). */\n.mj-tge {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 0;\n background: var(--mj-bg-page);\n}\n\n.mj-tge__validation {\n flex: 0 0 auto;\n margin: var(--mj-space-sm, 0.5rem);\n}\n\n.mj-tge__validation-list {\n margin: var(--mj-space-xs, 0.25rem) 0 0;\n padding-inline-start: 1.25rem;\n}\n\n/* Canvas + properties side by side; the row takes the remaining height. */\n.mj-tge__workspace {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n}\n\n/* The canvas takes the remaining width; min-width:0 is what lets it actually shrink inside flex. */\n.mj-tge__canvas {\n flex: 1 1 auto;\n min-width: 0;\n min-height: 0;\n}\n\n.mj-tge__properties {\n flex: 0 0 auto;\n width: 300px;\n min-height: 0;\n overflow-y: auto;\n border-left: 1px solid var(--mj-border-default);\n}\n\n@media (max-width: 900px) {\n /* Below this the two side by side leave neither usable; the panel drops under the canvas. */\n .mj-tge__workspace {\n flex-direction: column;\n }\n\n .mj-tge__properties {\n width: 100%;\n max-height: 40%;\n border-left: 0;\n border-top: 1px solid var(--mj-border-default);\n }\n}\n\n/* Shown above a usable, empty canvas \u2014 the palette stays reachable so the hint's advice is followable. */\n.mj-tge__empty-hint {\n margin: var(--mj-space-2) var(--mj-space-3) 0;\n}\n"] }]
|
|
536
|
+
}], null, { Spec: [{
|
|
537
|
+
type: Input
|
|
538
|
+
}], RuntimeStatus: [{
|
|
539
|
+
type: Input
|
|
540
|
+
}], NodePositions: [{
|
|
541
|
+
type: Input
|
|
542
|
+
}], ReadOnly: [{
|
|
543
|
+
type: Input
|
|
544
|
+
}], ShowToolbar: [{
|
|
545
|
+
type: Input
|
|
546
|
+
}], ShowPalette: [{
|
|
547
|
+
type: Input
|
|
548
|
+
}], ShowMinimap: [{
|
|
549
|
+
type: Input
|
|
550
|
+
}], ShowStatusBar: [{
|
|
551
|
+
type: Input
|
|
552
|
+
}], AutoLayoutDirection: [{
|
|
553
|
+
type: Input
|
|
554
|
+
}], ShowProperties: [{
|
|
555
|
+
type: Input
|
|
556
|
+
}], AvailableAgentNames: [{
|
|
557
|
+
type: Input
|
|
558
|
+
}], AvailableActionNames: [{
|
|
559
|
+
type: Input
|
|
560
|
+
}], EmptyStateMessage: [{
|
|
561
|
+
type: Input
|
|
562
|
+
}], BeforeTaskAdded: [{
|
|
563
|
+
type: Output
|
|
564
|
+
}], AfterTaskAdded: [{
|
|
565
|
+
type: Output
|
|
566
|
+
}], BeforeTaskRemoved: [{
|
|
567
|
+
type: Output
|
|
568
|
+
}], AfterTaskRemoved: [{
|
|
569
|
+
type: Output
|
|
570
|
+
}], BeforeTaskUpdated: [{
|
|
571
|
+
type: Output
|
|
572
|
+
}], AfterTaskUpdated: [{
|
|
573
|
+
type: Output
|
|
574
|
+
}], BeforeDependencyAdded: [{
|
|
575
|
+
type: Output
|
|
576
|
+
}], AfterDependencyAdded: [{
|
|
577
|
+
type: Output
|
|
578
|
+
}], BeforeDependencyRemoved: [{
|
|
579
|
+
type: Output
|
|
580
|
+
}], AfterDependencyRemoved: [{
|
|
581
|
+
type: Output
|
|
582
|
+
}], SpecChanged: [{
|
|
583
|
+
type: Output
|
|
584
|
+
}], SelectionChanged: [{
|
|
585
|
+
type: Output
|
|
586
|
+
}], ValidationChanged: [{
|
|
587
|
+
type: Output
|
|
588
|
+
}], AgentOpenRequested: [{
|
|
589
|
+
type: Output
|
|
590
|
+
}], RecordOpenRequested: [{
|
|
591
|
+
type: Output
|
|
592
|
+
}], canvas: [{
|
|
593
|
+
type: ViewChild,
|
|
594
|
+
args: [FlowEditorComponent]
|
|
595
|
+
}] }); })();
|
|
596
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TaskGraphEditorComponent, { className: "TaskGraphEditorComponent", filePath: "src/lib/task-graph-editor.component.ts", lineNumber: 92 }); })();
|
|
597
|
+
//# sourceMappingURL=task-graph-editor.component.js.map
|