@memberjunction/ng-task-graph-editor 0.0.0 → 6.1.0-edge.1
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 +98 -0
- package/dist/lib/task-graph-canvas-adapter.d.ts.map +1 -0
- package/dist/lib/task-graph-canvas-adapter.js +244 -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 +128 -0
- package/dist/lib/task-graph-editor.component.d.ts.map +1 -0
- package/dist/lib/task-graph-editor.component.js +375 -0
- package/dist/lib/task-graph-editor.component.js.map +1 -0
- package/dist/lib/task-graph-editor.module.d.ts +13 -0
- package/dist/lib/task-graph-editor.module.d.ts.map +1 -0
- package/dist/lib/task-graph-editor.module.js +23 -0
- package/dist/lib/task-graph-editor.module.js.map +1 -0
- package/dist/lib/task-graph-properties-panel.component.d.ts +71 -0
- package/dist/lib/task-graph-properties-panel.component.d.ts.map +1 -0
- package/dist/lib/task-graph-properties-panel.component.js +238 -0
- package/dist/lib/task-graph-properties-panel.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 +7 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +15 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +52 -7
- package/README.md +0 -45
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base for every cancelable graph event.
|
|
3
|
+
*
|
|
4
|
+
* A listener flips `Cancel = true` to halt the default behavior; the matching `After*` event will
|
|
5
|
+
* then **not** fire. That is a contract hosts rely on, not a suggestion.
|
|
6
|
+
*/
|
|
7
|
+
export class CancellableTaskGraphEventArgs {
|
|
8
|
+
Cancel = false;
|
|
9
|
+
CancelReason;
|
|
10
|
+
}
|
|
11
|
+
// ── Node lifecycle ───────────────────────────────────────────────────────────
|
|
12
|
+
/** Fired BEFORE a task is added. Cancel to block it (e.g. the host caps graph size). */
|
|
13
|
+
export class BeforeTaskAddedEventArgs extends CancellableTaskGraphEventArgs {
|
|
14
|
+
Task;
|
|
15
|
+
constructor(Task) {
|
|
16
|
+
super();
|
|
17
|
+
this.Task = Task;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Fired AFTER a task was added. NOT fired when the Before was canceled. */
|
|
21
|
+
export class AfterTaskAddedEventArgs {
|
|
22
|
+
Task;
|
|
23
|
+
Spec;
|
|
24
|
+
constructor(Task, Spec) {
|
|
25
|
+
this.Task = Task;
|
|
26
|
+
this.Spec = Spec;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Fired BEFORE a task is removed. Cancel to block it.
|
|
31
|
+
*
|
|
32
|
+
* `DependentTempIds` is supplied because removing a node also severs every edge into it, and a host
|
|
33
|
+
* deciding whether to veto needs to know the blast radius — not just which node was clicked.
|
|
34
|
+
*/
|
|
35
|
+
export class BeforeTaskRemovedEventArgs extends CancellableTaskGraphEventArgs {
|
|
36
|
+
Task;
|
|
37
|
+
DependentTempIds;
|
|
38
|
+
constructor(Task, DependentTempIds) {
|
|
39
|
+
super();
|
|
40
|
+
this.Task = Task;
|
|
41
|
+
this.DependentTempIds = DependentTempIds;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Fired AFTER a task was removed. NOT fired when the Before was canceled. */
|
|
45
|
+
export class AfterTaskRemovedEventArgs {
|
|
46
|
+
Task;
|
|
47
|
+
Spec;
|
|
48
|
+
constructor(Task, Spec) {
|
|
49
|
+
this.Task = Task;
|
|
50
|
+
this.Spec = Spec;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Fired BEFORE a task's properties change. Cancel to block the edit. */
|
|
54
|
+
export class BeforeTaskUpdatedEventArgs extends CancellableTaskGraphEventArgs {
|
|
55
|
+
Previous;
|
|
56
|
+
Next;
|
|
57
|
+
constructor(Previous, Next) {
|
|
58
|
+
super();
|
|
59
|
+
this.Previous = Previous;
|
|
60
|
+
this.Next = Next;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Fired AFTER a task's properties changed. NOT fired when the Before was canceled. */
|
|
64
|
+
export class AfterTaskUpdatedEventArgs {
|
|
65
|
+
Task;
|
|
66
|
+
Spec;
|
|
67
|
+
constructor(Task, Spec) {
|
|
68
|
+
this.Task = Task;
|
|
69
|
+
this.Spec = Spec;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// ── Edge lifecycle ───────────────────────────────────────────────────────────
|
|
73
|
+
/**
|
|
74
|
+
* Fired BEFORE a dependency edge is created. Cancel to block it.
|
|
75
|
+
*
|
|
76
|
+
* `WouldCreateCycle` is computed before emitting so a host can veto on that alone without
|
|
77
|
+
* re-deriving it. The component refuses a cycle regardless — the flag exists so the host can
|
|
78
|
+
* explain *why* rather than watch an edge silently fail to appear.
|
|
79
|
+
*/
|
|
80
|
+
export class BeforeDependencyAddedEventArgs extends CancellableTaskGraphEventArgs {
|
|
81
|
+
FromTempId;
|
|
82
|
+
ToTempId;
|
|
83
|
+
WouldCreateCycle;
|
|
84
|
+
constructor(FromTempId, ToTempId, WouldCreateCycle) {
|
|
85
|
+
super();
|
|
86
|
+
this.FromTempId = FromTempId;
|
|
87
|
+
this.ToTempId = ToTempId;
|
|
88
|
+
this.WouldCreateCycle = WouldCreateCycle;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** Fired AFTER a dependency edge was created. NOT fired when the Before was canceled. */
|
|
92
|
+
export class AfterDependencyAddedEventArgs {
|
|
93
|
+
FromTempId;
|
|
94
|
+
ToTempId;
|
|
95
|
+
Spec;
|
|
96
|
+
constructor(FromTempId, ToTempId, Spec) {
|
|
97
|
+
this.FromTempId = FromTempId;
|
|
98
|
+
this.ToTempId = ToTempId;
|
|
99
|
+
this.Spec = Spec;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** Fired BEFORE a dependency edge is removed. Cancel to block it. */
|
|
103
|
+
export class BeforeDependencyRemovedEventArgs extends CancellableTaskGraphEventArgs {
|
|
104
|
+
FromTempId;
|
|
105
|
+
ToTempId;
|
|
106
|
+
constructor(FromTempId, ToTempId) {
|
|
107
|
+
super();
|
|
108
|
+
this.FromTempId = FromTempId;
|
|
109
|
+
this.ToTempId = ToTempId;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** Fired AFTER a dependency edge was removed. NOT fired when the Before was canceled. */
|
|
113
|
+
export class AfterDependencyRemovedEventArgs {
|
|
114
|
+
FromTempId;
|
|
115
|
+
ToTempId;
|
|
116
|
+
Spec;
|
|
117
|
+
constructor(FromTempId, ToTempId, Spec) {
|
|
118
|
+
this.FromTempId = FromTempId;
|
|
119
|
+
this.ToTempId = ToTempId;
|
|
120
|
+
this.Spec = Spec;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// ── Informational ────────────────────────────────────────────────────────────
|
|
124
|
+
//
|
|
125
|
+
// Single emitters, no Before pair. Per the layering guide: don't invent a veto for something that
|
|
126
|
+
// cannot be vetoed. A selection that already happened and a validation that already ran are facts,
|
|
127
|
+
// not requests.
|
|
128
|
+
/** The spec changed for any reason. Hosts persist from here. */
|
|
129
|
+
export class TaskGraphSpecChangedEventArgs {
|
|
130
|
+
Spec;
|
|
131
|
+
Reason;
|
|
132
|
+
constructor(Spec, Reason) {
|
|
133
|
+
this.Spec = Spec;
|
|
134
|
+
this.Reason = Reason;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Selection changed. `Task` is null when the selection was cleared. */
|
|
138
|
+
export class TaskGraphSelectionChangedEventArgs {
|
|
139
|
+
Task;
|
|
140
|
+
constructor(Task) {
|
|
141
|
+
this.Task = Task;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Validation ran.
|
|
146
|
+
*
|
|
147
|
+
* Errors come from the engine's own `ValidateTaskGraphSpec`, not from a second implementation here —
|
|
148
|
+
* so a graph that looks valid on the canvas cannot fail a different check at submission.
|
|
149
|
+
*/
|
|
150
|
+
export class TaskGraphValidationChangedEventArgs {
|
|
151
|
+
Valid;
|
|
152
|
+
Errors;
|
|
153
|
+
constructor(Valid, Errors) {
|
|
154
|
+
this.Valid = Valid;
|
|
155
|
+
this.Errors = Errors;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// ── Intent-only (navigation the HOST performs) ───────────────────────────────
|
|
159
|
+
//
|
|
160
|
+
// A widget at this layer must not navigate: it has no Router, and it cannot know whether it is
|
|
161
|
+
// inside Explorer, a downstream app, or an embedded panel. It reports the intent; the host decides.
|
|
162
|
+
/** The user asked to open the agent behind a task. The host navigates. */
|
|
163
|
+
export class AgentOpenRequestedEventArgs {
|
|
164
|
+
AgentName;
|
|
165
|
+
Task;
|
|
166
|
+
constructor(AgentName, Task) {
|
|
167
|
+
this.AgentName = AgentName;
|
|
168
|
+
this.Task = Task;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/** The user asked to open a record referenced by the graph. The host navigates. */
|
|
172
|
+
export class RecordOpenRequestedEventArgs {
|
|
173
|
+
EntityName;
|
|
174
|
+
RecordID;
|
|
175
|
+
constructor(EntityName, RecordID) {
|
|
176
|
+
this.EntityName = EntityName;
|
|
177
|
+
this.RecordID = RecordID;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=task-graph-editor-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-graph-editor-events.js","sourceRoot":"","sources":["../../src/lib/task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,SAAI,GAAJ,IAAI,CAA0B;IAAG,CAAC;CACjE;AAED;;;;;GAKG;AACH,MAAM,OAAO,mCAAmC;IAExB;IACA;IAFpB,YACoB,KAAc,EACd,MAA2C;QAD3C,UAAK,GAAL,KAAK,CAAS;QACd,WAAM,GAAN,MAAM,CAAqC;IAC5D,CAAC;CACP;AAED,gFAAgF;AAChF,EAAE;AACF,+FAA+F;AAC/F,oGAAoG;AAEpG,0EAA0E;AAC1E,MAAM,OAAO,2BAA2B;IAEhB;IACA;IAFpB,YACoB,SAAiB,EACjB,IAAuB;QADvB,cAAS,GAAT,SAAS,CAAQ;QACjB,SAAI,GAAJ,IAAI,CAAmB;IACxC,CAAC;CACP;AAED,mFAAmF;AACnF,MAAM,OAAO,4BAA4B;IAEjB;IACA;IAFpB,YACoB,UAAkB,EAClB,QAAgB;QADhB,eAAU,GAAV,UAAU,CAAQ;QAClB,aAAQ,GAAR,QAAQ,CAAQ;IACjC,CAAC;CACP","sourcesContent":["/**\n * @fileoverview The component's upward contract.\n *\n * Follows MJ's `Before*` / `After*` cancelable pattern (see `guides/UI_LAYERING_GUIDE.md` §6),\n * already used by `ng-base-forms`, `ng-trees`, `ng-entity-viewer` and `ng-conversations`.\n *\n * **Why the args are classes and not payload interfaces.** `Cancel` has to travel *back*. Angular's\n * `EventEmitter` is synchronous for synchronous listeners, so the emitting component reads the\n * mutated object after `.emit()` returns — that is the entire veto mechanism. A frozen payload\n * cannot carry a veto, and a class additionally gives one place for defaults and future fields.\n *\n * **A `Before*` handler must not be `async`.** An `await` inside it returns control to the emitter\n * before the handler sets `Cancel`, so the veto silently does nothing. Where a host genuinely needs\n * to await — a confirmation dialog — the component exposes the action as a public method the host\n * calls *after* its own await, rather than pretending the veto is asynchronous.\n *\n * @module @memberjunction/ng-task-graph-editor\n */\nimport type { TaskGraphSpec, TaskGraphSpecNode, TaskGraphValidationError } from '@memberjunction/ai-core-plus';\n\n/**\n * Base for every cancelable graph event.\n *\n * A listener flips `Cancel = true` to halt the default behavior; the matching `After*` event will\n * then **not** fire. That is a contract hosts rely on, not a suggestion.\n */\nexport class CancellableTaskGraphEventArgs {\n public Cancel: boolean = false;\n public CancelReason?: string;\n}\n\n// ── Node lifecycle ───────────────────────────────────────────────────────────\n\n/** Fired BEFORE a task is added. Cancel to block it (e.g. the host caps graph size). */\nexport class BeforeTaskAddedEventArgs extends CancellableTaskGraphEventArgs {\n constructor(public readonly Task: TaskGraphSpecNode) { super(); }\n}\n\n/** Fired AFTER a task was added. NOT fired when the Before was canceled. */\nexport class AfterTaskAddedEventArgs {\n constructor(\n public readonly Task: TaskGraphSpecNode,\n public readonly Spec: TaskGraphSpec,\n ) {}\n}\n\n/**\n * Fired BEFORE a task is removed. Cancel to block it.\n *\n * `DependentTempIds` is supplied because removing a node also severs every edge into it, and a host\n * deciding whether to veto needs to know the blast radius — not just which node was clicked.\n */\nexport class BeforeTaskRemovedEventArgs extends CancellableTaskGraphEventArgs {\n constructor(\n public readonly Task: TaskGraphSpecNode,\n public readonly DependentTempIds: readonly string[],\n ) { super(); }\n}\n\n/** Fired AFTER a task was removed. NOT fired when the Before was canceled. */\nexport class AfterTaskRemovedEventArgs {\n constructor(\n public readonly Task: TaskGraphSpecNode,\n public readonly Spec: TaskGraphSpec,\n ) {}\n}\n\n/** Fired BEFORE a task's properties change. Cancel to block the edit. */\nexport class BeforeTaskUpdatedEventArgs extends CancellableTaskGraphEventArgs {\n constructor(\n public readonly Previous: TaskGraphSpecNode,\n public readonly Next: TaskGraphSpecNode,\n ) { super(); }\n}\n\n/** Fired AFTER a task's properties changed. NOT fired when the Before was canceled. */\nexport class AfterTaskUpdatedEventArgs {\n constructor(\n public readonly Task: TaskGraphSpecNode,\n public readonly Spec: TaskGraphSpec,\n ) {}\n}\n\n// ── Edge lifecycle ───────────────────────────────────────────────────────────\n\n/**\n * Fired BEFORE a dependency edge is created. Cancel to block it.\n *\n * `WouldCreateCycle` is computed before emitting so a host can veto on that alone without\n * re-deriving it. The component refuses a cycle regardless — the flag exists so the host can\n * explain *why* rather than watch an edge silently fail to appear.\n */\nexport class BeforeDependencyAddedEventArgs extends CancellableTaskGraphEventArgs {\n constructor(\n public readonly FromTempId: string,\n public readonly ToTempId: string,\n public readonly WouldCreateCycle: boolean,\n ) { super(); }\n}\n\n/** Fired AFTER a dependency edge was created. NOT fired when the Before was canceled. */\nexport class AfterDependencyAddedEventArgs {\n constructor(\n public readonly FromTempId: string,\n public readonly ToTempId: string,\n public readonly Spec: TaskGraphSpec,\n ) {}\n}\n\n/** Fired BEFORE a dependency edge is removed. Cancel to block it. */\nexport class BeforeDependencyRemovedEventArgs extends CancellableTaskGraphEventArgs {\n constructor(\n public readonly FromTempId: string,\n public readonly ToTempId: string,\n ) { super(); }\n}\n\n/** Fired AFTER a dependency edge was removed. NOT fired when the Before was canceled. */\nexport class AfterDependencyRemovedEventArgs {\n constructor(\n public readonly FromTempId: string,\n public readonly ToTempId: string,\n public readonly Spec: TaskGraphSpec,\n ) {}\n}\n\n// ── Informational ────────────────────────────────────────────────────────────\n//\n// Single emitters, no Before pair. Per the layering guide: don't invent a veto for something that\n// cannot be vetoed. A selection that already happened and a validation that already ran are facts,\n// not requests.\n\n/** The spec changed for any reason. Hosts persist from here. */\nexport class TaskGraphSpecChangedEventArgs {\n constructor(\n public readonly Spec: TaskGraphSpec,\n public readonly Reason: 'TaskAdded' | 'TaskRemoved' | 'TaskUpdated' | 'DependencyAdded' | 'DependencyRemoved' | 'LayoutApplied',\n ) {}\n}\n\n/** Selection changed. `Task` is null when the selection was cleared. */\nexport class TaskGraphSelectionChangedEventArgs {\n constructor(public readonly Task: TaskGraphSpecNode | null) {}\n}\n\n/**\n * Validation ran.\n *\n * Errors come from the engine's own `ValidateTaskGraphSpec`, not from a second implementation here —\n * so a graph that looks valid on the canvas cannot fail a different check at submission.\n */\nexport class TaskGraphValidationChangedEventArgs {\n constructor(\n public readonly Valid: boolean,\n public readonly Errors: readonly TaskGraphValidationError[],\n ) {}\n}\n\n// ── Intent-only (navigation the HOST performs) ───────────────────────────────\n//\n// A widget at this layer must not navigate: it has no Router, and it cannot know whether it is\n// inside Explorer, a downstream app, or an embedded panel. It reports the intent; the host decides.\n\n/** The user asked to open the agent behind a task. The host navigates. */\nexport class AgentOpenRequestedEventArgs {\n constructor(\n public readonly AgentName: string,\n public readonly Task: TaskGraphSpecNode,\n ) {}\n}\n\n/** The user asked to open a record referenced by the graph. The host navigates. */\nexport class RecordOpenRequestedEventArgs {\n constructor(\n public readonly EntityName: string,\n public readonly RecordID: string,\n ) {}\n}\n"]}
|
|
@@ -0,0 +1,128 @@
|
|
|
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 { EventEmitter } from '@angular/core';
|
|
28
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
29
|
+
import { type TaskGraphSpec, type TaskGraphSpecNode, type TaskGraphValidationError } from '@memberjunction/ai-core-plus';
|
|
30
|
+
import type { FlowConnection, FlowConnectionCreatedEvent, FlowLayoutDirection, FlowNode, FlowNodeTypeConfig } from '@memberjunction/ng-flow-editor';
|
|
31
|
+
import { type TaskGraphRuntimeStatus } 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
|
+
export declare class TaskGraphEditorComponent extends BaseAngularComponent {
|
|
35
|
+
/**
|
|
36
|
+
* The graph to show. Setter-based rather than `ngOnChanges` (repo convention): the reaction is
|
|
37
|
+
* explicit, runs only when this property changes, and costs nothing on other change-detection
|
|
38
|
+
* passes.
|
|
39
|
+
*/
|
|
40
|
+
set Spec(value: TaskGraphSpec | null);
|
|
41
|
+
get Spec(): TaskGraphSpec | null;
|
|
42
|
+
/**
|
|
43
|
+
* Live per-task state, keyed by `tempId`. Supplying it turns the canvas into a runtime view of
|
|
44
|
+
* the same graph — the convergence point the program was aiming at: one renderer for design time
|
|
45
|
+
* and run time, rather than an editor and a separate Gantt that can disagree.
|
|
46
|
+
*/
|
|
47
|
+
set RuntimeStatus(value: TaskGraphRuntimeStatus | null);
|
|
48
|
+
get RuntimeStatus(): TaskGraphRuntimeStatus | null;
|
|
49
|
+
/** Read-only mode. The same component is the viewer — there is no second, weaker renderer. */
|
|
50
|
+
ReadOnly: boolean;
|
|
51
|
+
ShowToolbar: boolean;
|
|
52
|
+
ShowPalette: boolean;
|
|
53
|
+
ShowMinimap: boolean;
|
|
54
|
+
ShowStatusBar: boolean;
|
|
55
|
+
AutoLayoutDirection: FlowLayoutDirection;
|
|
56
|
+
/** Shown when there is nothing to draw yet. */
|
|
57
|
+
EmptyStateMessage: string;
|
|
58
|
+
BeforeTaskAdded: EventEmitter<BeforeTaskAddedEventArgs>;
|
|
59
|
+
AfterTaskAdded: EventEmitter<AfterTaskAddedEventArgs>;
|
|
60
|
+
BeforeTaskRemoved: EventEmitter<BeforeTaskRemovedEventArgs>;
|
|
61
|
+
AfterTaskRemoved: EventEmitter<AfterTaskRemovedEventArgs>;
|
|
62
|
+
BeforeTaskUpdated: EventEmitter<BeforeTaskUpdatedEventArgs>;
|
|
63
|
+
AfterTaskUpdated: EventEmitter<AfterTaskUpdatedEventArgs>;
|
|
64
|
+
BeforeDependencyAdded: EventEmitter<BeforeDependencyAddedEventArgs>;
|
|
65
|
+
AfterDependencyAdded: EventEmitter<AfterDependencyAddedEventArgs>;
|
|
66
|
+
BeforeDependencyRemoved: EventEmitter<BeforeDependencyRemovedEventArgs>;
|
|
67
|
+
AfterDependencyRemoved: EventEmitter<AfterDependencyRemovedEventArgs>;
|
|
68
|
+
/** Informational — no `Before` pair, because these report what already happened. */
|
|
69
|
+
SpecChanged: EventEmitter<TaskGraphSpecChangedEventArgs>;
|
|
70
|
+
SelectionChanged: EventEmitter<TaskGraphSelectionChangedEventArgs>;
|
|
71
|
+
ValidationChanged: EventEmitter<TaskGraphValidationChangedEventArgs>;
|
|
72
|
+
/** Intent-only — the host navigates; this widget has no Router and must not acquire one. */
|
|
73
|
+
AgentOpenRequested: EventEmitter<AgentOpenRequestedEventArgs>;
|
|
74
|
+
RecordOpenRequested: EventEmitter<RecordOpenRequestedEventArgs>;
|
|
75
|
+
Nodes: FlowNode[];
|
|
76
|
+
Connections: FlowConnection[];
|
|
77
|
+
NodeTypes: FlowNodeTypeConfig[];
|
|
78
|
+
SelectedTask: TaskGraphSpecNode | null;
|
|
79
|
+
ValidationErrors: readonly TaskGraphValidationError[];
|
|
80
|
+
IsValid: boolean;
|
|
81
|
+
private currentSpec;
|
|
82
|
+
private currentRuntime;
|
|
83
|
+
get IsEmpty(): boolean;
|
|
84
|
+
/** Re-runs validation and emits the result. Idempotent. */
|
|
85
|
+
Validate(): TaskGraphValidationChangedEventArgs;
|
|
86
|
+
/** Adds a task. Returns the new task, or null when a host vetoed it. */
|
|
87
|
+
AddTask(partial?: Partial<TaskGraphSpecNode>): TaskGraphSpecNode | null;
|
|
88
|
+
/** Removes a task and every edge into it. Returns false when a host vetoed it. */
|
|
89
|
+
RemoveTask(tempId: string): boolean;
|
|
90
|
+
/** Replaces a task's properties. Returns false when a host vetoed it. */
|
|
91
|
+
UpdateTask(tempId: string, next: TaskGraphSpecNode): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Adds a dependency edge. Returns false when it was vetoed **or would create a cycle**.
|
|
94
|
+
*
|
|
95
|
+
* The cycle is refused unconditionally, not merely reported: a cyclic graph can never execute —
|
|
96
|
+
* nothing would ever become eligible — so allowing the canvas to draw one would let a user build
|
|
97
|
+
* something the engine must then reject. Better to refuse the stroke than to accept a graph that
|
|
98
|
+
* cannot run.
|
|
99
|
+
*/
|
|
100
|
+
AddDependency(fromTempId: string, toTempId: string, condition?: string): boolean;
|
|
101
|
+
/** Removes a dependency edge. Returns false when a host vetoed it. */
|
|
102
|
+
RemoveDependency(fromTempId: string, toTempId: string): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Sets — or with an empty string, clears — a dependency edge's condition.
|
|
105
|
+
*
|
|
106
|
+
* Implemented as remove-then-add so it travels the same `Before*`/`After*` path as any other
|
|
107
|
+
* edge change. A separate silent mutation would be a second write path into the spec, and the
|
|
108
|
+
* veto contract would then be right in one place and wrong in the other.
|
|
109
|
+
*/
|
|
110
|
+
SetDependencyCondition(fromTempId: string, toTempId: string, condition: string): boolean;
|
|
111
|
+
/** Asks the host to open the agent behind a task. */
|
|
112
|
+
RequestAgentOpen(task: TaskGraphSpecNode): void;
|
|
113
|
+
/** Asks the host to open a record the graph references. */
|
|
114
|
+
RequestRecordOpen(entityName: string, recordID: string): void;
|
|
115
|
+
OnNodeSelected(node: FlowNode | null): void;
|
|
116
|
+
OnConnectionCreated(event: FlowConnectionCreatedEvent): void;
|
|
117
|
+
OnConnectionRemoved(connection: FlowConnection): void;
|
|
118
|
+
OnNodeRemoved(node: FlowNode): void;
|
|
119
|
+
private findTask;
|
|
120
|
+
private selectTask;
|
|
121
|
+
/** Applies a new spec, re-projects, re-validates, and tells the host — in that order. */
|
|
122
|
+
private commit;
|
|
123
|
+
/** Re-derives the canvas from the spec. Validation rides along so the two never disagree. */
|
|
124
|
+
private project;
|
|
125
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TaskGraphEditorComponent, never>;
|
|
126
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TaskGraphEditorComponent, "mj-task-graph-editor", never, { "Spec": { "alias": "Spec"; "required": false; }; "RuntimeStatus": { "alias": "RuntimeStatus"; "required": false; }; "ReadOnly": { "alias": "ReadOnly"; "required": false; }; "ShowToolbar": { "alias": "ShowToolbar"; "required": false; }; "ShowPalette": { "alias": "ShowPalette"; "required": false; }; "ShowMinimap": { "alias": "ShowMinimap"; "required": false; }; "ShowStatusBar": { "alias": "ShowStatusBar"; "required": false; }; "AutoLayoutDirection": { "alias": "AutoLayoutDirection"; "required": false; }; "EmptyStateMessage": { "alias": "EmptyStateMessage"; "required": false; }; }, { "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"; }, never, never, false, never>;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=task-graph-editor.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-graph-editor.component.d.ts","sourceRoot":"","sources":["../../src/lib/task-graph-editor.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAa,YAAY,EAAiB,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAEH,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAChC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACR,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAYH,KAAK,sBAAsB,EAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACH,6BAA6B,EAC7B,+BAA+B,EAC/B,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,EAC3B,8BAA8B,EAC9B,gCAAgC,EAChC,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,kCAAkC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