@memberjunction/task-graph 6.1.0-edge.2 → 6.1.0-edge.3

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 (53) hide show
  1. package/LICENSE +180 -4
  2. package/README.md +30 -1
  3. package/dist/TaskClaimStore.d.ts +376 -4
  4. package/dist/TaskClaimStore.d.ts.map +1 -1
  5. package/dist/TaskClaimStore.js +600 -20
  6. package/dist/TaskClaimStore.js.map +1 -1
  7. package/dist/TaskGraphDispatcher.d.ts +326 -25
  8. package/dist/TaskGraphDispatcher.d.ts.map +1 -1
  9. package/dist/TaskGraphDispatcher.js +1604 -286
  10. package/dist/TaskGraphDispatcher.js.map +1 -1
  11. package/dist/TaskGraphService.d.ts +255 -5
  12. package/dist/TaskGraphService.d.ts.map +1 -1
  13. package/dist/TaskGraphService.js +583 -26
  14. package/dist/TaskGraphService.js.map +1 -1
  15. package/dist/TaskGraphSubmitterImpl.d.ts.map +1 -1
  16. package/dist/TaskGraphSubmitterImpl.js +5 -0
  17. package/dist/TaskGraphSubmitterImpl.js.map +1 -1
  18. package/dist/condition-gate.d.ts +128 -0
  19. package/dist/condition-gate.d.ts.map +1 -0
  20. package/dist/condition-gate.js +257 -0
  21. package/dist/condition-gate.js.map +1 -0
  22. package/dist/debug-state.d.ts +102 -0
  23. package/dist/debug-state.d.ts.map +1 -0
  24. package/dist/debug-state.js +135 -0
  25. package/dist/debug-state.js.map +1 -0
  26. package/dist/index.d.ts +6 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +6 -0
  29. package/dist/index.js.map +1 -1
  30. package/dist/operations/TaskGraphDebugOperations.d.ts +99 -0
  31. package/dist/operations/TaskGraphDebugOperations.d.ts.map +1 -0
  32. package/dist/operations/TaskGraphDebugOperations.js +310 -0
  33. package/dist/operations/TaskGraphDebugOperations.js.map +1 -0
  34. package/dist/operations/TaskGraphOperations.d.ts +20 -2
  35. package/dist/operations/TaskGraphOperations.d.ts.map +1 -1
  36. package/dist/operations/TaskGraphOperations.js +47 -8
  37. package/dist/operations/TaskGraphOperations.js.map +1 -1
  38. package/dist/settlement-rescue.d.ts +85 -0
  39. package/dist/settlement-rescue.d.ts.map +1 -0
  40. package/dist/settlement-rescue.js +119 -0
  41. package/dist/settlement-rescue.js.map +1 -0
  42. package/dist/task-graph-kick.d.ts +3 -0
  43. package/dist/task-graph-kick.d.ts.map +1 -0
  44. package/dist/task-graph-kick.js +17 -0
  45. package/dist/task-graph-kick.js.map +1 -0
  46. package/dist/task-predicates.d.ts +77 -0
  47. package/dist/task-predicates.d.ts.map +1 -0
  48. package/dist/task-predicates.js +75 -0
  49. package/dist/task-predicates.js.map +1 -0
  50. package/dist/types.d.ts +110 -1
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/types.js.map +1 -1
  53. package/package.json +12 -11
@@ -0,0 +1,102 @@
1
+ /** What a step allowance permits: one task, the current frontier, or one named task. */
2
+ export type StepTarget = 'one' | 'wave' | string;
3
+ /** A user's answer for an edge whose condition they have overridden. */
4
+ export type EdgeOverrideVerdict = 'true' | 'false';
5
+ /**
6
+ * The durable debug state of one graph.
7
+ *
8
+ * Everything optional: the empty object is "no debugging", and a graph submitted before this existed
9
+ * parses to exactly that.
10
+ */
11
+ export type TaskGraphDebugState = {
12
+ /** Nothing new is claimed while true. In-flight tasks finish naturally. */
13
+ paused?: boolean;
14
+ /** Who paused it — informational, for the console and the frame. */
15
+ pausedBy?: string | null;
16
+ /** Whether a person paused it or a breakpoint did. */
17
+ pausedReason?: 'user' | 'breakpoint';
18
+ /** The task whose breakpoint fired, when `pausedReason` is `'breakpoint'`. */
19
+ pausedAtTaskID?: string | null;
20
+ /** Task IDs the dispatcher pauses the graph on, before claiming them. */
21
+ breakpoints?: string[];
22
+ /**
23
+ * One-shot claim allowance while paused. Consumed atomically (CAS) by the instance that honors
24
+ * it, so two dispatchers polling the same paused graph release work exactly once.
25
+ */
26
+ step?: StepTarget;
27
+ /**
28
+ * Continue from a breakpoint: this task's breakpoint is ignored for one claim so the stopped
29
+ * step actually runs. Without this, Resume clears `paused` and the next poll re-hits the same
30
+ * still-eligible breakpoint without claiming anything — a ForEach on the last step never starts.
31
+ */
32
+ skipBreakpointTaskID?: string | null;
33
+ /**
34
+ * Authored verdicts for edges whose conditions the user has overridden, keyed by
35
+ * `MJ: Task Dependencies` row ID. `'false'` drops the edge (branch not taken → skip cascade);
36
+ * `'true'` satisfies it. The operator-grade escape hatch for a held graph — durable, so it
37
+ * survives restarts and is honored by every instance.
38
+ */
39
+ edgeOverrides?: Record<string, EdgeOverrideVerdict>;
40
+ };
41
+ /** What the claim gate decided for one graph on one pass. */
42
+ export type ClaimGateDecision =
43
+ /** Not paused, no breakpoint in the eligible set — claim normally. */
44
+ {
45
+ mode: 'open';
46
+ }
47
+ /** Paused with no step allowance — claim nothing, notify nobody. */
48
+ | {
49
+ mode: 'closed';
50
+ }
51
+ /**
52
+ * Paused with a step allowance — the caller may claim `taskIDs` this pass (after consuming the
53
+ * marker CAS-style; a lost consume means another instance is stepping).
54
+ */
55
+ | {
56
+ mode: 'step';
57
+ taskIDs: string[];
58
+ }
59
+ /**
60
+ * An eligible task has a breakpoint — the caller should pause the graph (CAS), announce
61
+ * `BreakpointHit`, and claim nothing this pass.
62
+ */
63
+ | {
64
+ mode: 'breakpoint';
65
+ taskID: string;
66
+ };
67
+ /**
68
+ * Parses a parent Task's debug state from its `InputPayload` bag.
69
+ *
70
+ * Mirrors `ParseTaskGraphParentMetadata`'s posture exactly: unparseable input is a legitimate state
71
+ * (a row predating this, a hand edit), and the right reading of "I don't know" is "not being
72
+ * debugged" — never a throw, and never a guess that could gate real work on garbage.
73
+ */
74
+ export declare function ParseTaskGraphDebugState(raw: string | null | undefined): TaskGraphDebugState;
75
+ /**
76
+ * Decides what the claim filter may do for one graph this pass, given its debug state and the tasks
77
+ * that are otherwise eligible.
78
+ *
79
+ * Pure by design — the CAS writes (consuming the step marker, pausing at the breakpoint) stay with
80
+ * the dispatcher, and this function only says which of them to attempt. Precedence:
81
+ *
82
+ * 1. **Paused** wins over everything, including breakpoints — a paused graph claims nothing unless
83
+ * a step allowance releases work, and a breakpoint inside a paused graph is moot.
84
+ * 2. **Breakpoints** fire before any claim: the FIRST eligible task carrying one pauses the whole
85
+ * graph, so no sibling of the breakpointed task starts either. That is what "pause here" means
86
+ * on a parallel graph — the alternative (claim the siblings, hold only the one task) turns a
87
+ * breakpoint into a per-task hold, which `holdTaskIDs` already is.
88
+ * 3. Otherwise the gate is open.
89
+ *
90
+ * A named-step target that is not currently eligible releases nothing — the allowance stays for the
91
+ * caller to keep or clear; stepping a task that cannot run must not release an arbitrary other one.
92
+ */
93
+ export declare function DecideClaimGate(debug: TaskGraphDebugState, eligibleTaskIDs: readonly string[]): ClaimGateDecision;
94
+ /**
95
+ * The verdict an edge override dictates, if one exists for this edge.
96
+ *
97
+ * Consulted BEFORE the condition is evaluated: an override exists precisely because the condition
98
+ * cannot be answered (or answered wrongly), so evaluating first would re-produce the hold the
99
+ * override exists to end.
100
+ */
101
+ export declare function OverrideVerdictFor(debug: TaskGraphDebugState, edgeID: string): EdgeOverrideVerdict | undefined;
102
+ //# sourceMappingURL=debug-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-state.d.ts","sourceRoot":"","sources":["../src/debug-state.ts"],"names":[],"mappings":"AA0BA,wFAAwF;AACxF,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjD,wEAAwE;AACxE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CACvD,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,iBAAiB;AACzB,sEAAsE;AACpE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;AAClB,oEAAoE;GAClE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE;AACpB;;;GAGG;GACD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE;AACrC;;;GAGG;GACD;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAS7C;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,mBAAmB,CAiC5F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,iBAAiB,CAkBjH;AAOD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,MAAM,GACf,mBAAmB,GAAG,SAAS,CAEjC"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * @fileoverview Debug/runner state for a task graph — pause, single-step, breakpoints, and edge
3
+ * overrides — expressed as durable, declarative state the dispatcher's claim filter consults.
4
+ *
5
+ * **Why state, not hooks.** The dispatcher is multi-instance and survives restarts; a callback
6
+ * registered in one process gates nothing on the peer that actually wins a claim, and dies with the
7
+ * process. A flag on the parent row gates every instance uniformly, works when "start paused" is set
8
+ * before any dispatcher has seen the graph, and holds across a deploy. The debugger and the
9
+ * dispatcher never talk directly — they rendezvous on the row, which is this engine's native
10
+ * coordination idiom (the claim protocol itself is nothing but CAS'd shared state).
11
+ *
12
+ * **Why every control is a gate on CLAIMING, never on running.** A claimed task can never be
13
+ * interrupted mid-flight anyway — only the next claim can be prevented. So `paused` means "nothing
14
+ * new starts; in-flight work finishes and its completions land", a breakpoint is an authored hold
15
+ * (the exact mechanism `holdTaskIDs` already implements for unevaluable conditions, driven by user
16
+ * intent instead of a broken guard), and `step` is a one-shot claim allowance consumed CAS-style so
17
+ * exactly one instance honors it.
18
+ *
19
+ * The state lives under `$.debug` in the parent Task's `InputPayload` bag, beside the continuation
20
+ * marker, and is written only through `TaskClaimStore`'s guarded `JSON_MODIFY` statements — the same
21
+ * two-writer discipline that protects the marker.
22
+ *
23
+ * @module @memberjunction/task-graph
24
+ */
25
+ import { UUIDsEqual } from '@memberjunction/global';
26
+ const UUID_SHAPE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
27
+ /** True for values JSON round-trips or hand edits commonly produce for a boolean. */
28
+ function readBool(value) {
29
+ return value === true || value === 'true';
30
+ }
31
+ /**
32
+ * Parses a parent Task's debug state from its `InputPayload` bag.
33
+ *
34
+ * Mirrors `ParseTaskGraphParentMetadata`'s posture exactly: unparseable input is a legitimate state
35
+ * (a row predating this, a hand edit), and the right reading of "I don't know" is "not being
36
+ * debugged" — never a throw, and never a guess that could gate real work on garbage.
37
+ */
38
+ export function ParseTaskGraphDebugState(raw) {
39
+ if (!raw)
40
+ return {};
41
+ try {
42
+ const parsed = JSON.parse(raw);
43
+ const debug = parsed && typeof parsed === 'object' ? parsed.debug : undefined;
44
+ if (!debug || typeof debug !== 'object')
45
+ return {};
46
+ const d = debug;
47
+ const state = {};
48
+ if (readBool(d.paused))
49
+ state.paused = true;
50
+ if (typeof d.pausedBy === 'string')
51
+ state.pausedBy = d.pausedBy;
52
+ if (d.pausedReason === 'user' || d.pausedReason === 'breakpoint')
53
+ state.pausedReason = d.pausedReason;
54
+ if (typeof d.pausedAtTaskID === 'string')
55
+ state.pausedAtTaskID = d.pausedAtTaskID;
56
+ if (typeof d.skipBreakpointTaskID === 'string')
57
+ state.skipBreakpointTaskID = d.skipBreakpointTaskID;
58
+ if (Array.isArray(d.breakpoints)) {
59
+ const ids = d.breakpoints.filter((b) => typeof b === 'string' && UUID_SHAPE.test(b));
60
+ if (ids.length > 0)
61
+ state.breakpoints = ids;
62
+ }
63
+ if (d.step === 'one' || d.step === 'wave' || (typeof d.step === 'string' && UUID_SHAPE.test(d.step))) {
64
+ state.step = d.step;
65
+ }
66
+ if (d.edgeOverrides && typeof d.edgeOverrides === 'object') {
67
+ const overrides = {};
68
+ for (const [edgeID, verdict] of Object.entries(d.edgeOverrides)) {
69
+ if (UUID_SHAPE.test(edgeID) && (verdict === 'true' || verdict === 'false')) {
70
+ overrides[edgeID] = verdict;
71
+ }
72
+ }
73
+ if (Object.keys(overrides).length > 0)
74
+ state.edgeOverrides = overrides;
75
+ }
76
+ return state;
77
+ }
78
+ catch {
79
+ return {};
80
+ }
81
+ }
82
+ /**
83
+ * Decides what the claim filter may do for one graph this pass, given its debug state and the tasks
84
+ * that are otherwise eligible.
85
+ *
86
+ * Pure by design — the CAS writes (consuming the step marker, pausing at the breakpoint) stay with
87
+ * the dispatcher, and this function only says which of them to attempt. Precedence:
88
+ *
89
+ * 1. **Paused** wins over everything, including breakpoints — a paused graph claims nothing unless
90
+ * a step allowance releases work, and a breakpoint inside a paused graph is moot.
91
+ * 2. **Breakpoints** fire before any claim: the FIRST eligible task carrying one pauses the whole
92
+ * graph, so no sibling of the breakpointed task starts either. That is what "pause here" means
93
+ * on a parallel graph — the alternative (claim the siblings, hold only the one task) turns a
94
+ * breakpoint into a per-task hold, which `holdTaskIDs` already is.
95
+ * 3. Otherwise the gate is open.
96
+ *
97
+ * A named-step target that is not currently eligible releases nothing — the allowance stays for the
98
+ * caller to keep or clear; stepping a task that cannot run must not release an arbitrary other one.
99
+ */
100
+ export function DecideClaimGate(debug, eligibleTaskIDs) {
101
+ if (debug.paused) {
102
+ if (!debug.step)
103
+ return { mode: 'closed' };
104
+ if (debug.step === 'wave')
105
+ return { mode: 'step', taskIDs: [...eligibleTaskIDs] };
106
+ if (debug.step === 'one') {
107
+ return eligibleTaskIDs.length > 0 ? { mode: 'step', taskIDs: [eligibleTaskIDs[0]] } : { mode: 'closed' };
108
+ }
109
+ // A named task steps only itself, and only when it is genuinely eligible.
110
+ const named = eligibleTaskIDs.find((id) => UUIDsEqual(id, debug.step));
111
+ return named ? { mode: 'step', taskIDs: [named] } : { mode: 'closed' };
112
+ }
113
+ if (debug.breakpoints && debug.breakpoints.length > 0) {
114
+ const bp = eligibleTaskIDs.find((id) => isArmedBreakpoint(debug, id));
115
+ if (bp)
116
+ return { mode: 'breakpoint', taskID: bp };
117
+ }
118
+ return { mode: 'open' };
119
+ }
120
+ function isArmedBreakpoint(debug, taskID) {
121
+ if (debug.skipBreakpointTaskID && UUIDsEqual(debug.skipBreakpointTaskID, taskID))
122
+ return false;
123
+ return (debug.breakpoints ?? []).some((id) => UUIDsEqual(id, taskID));
124
+ }
125
+ /**
126
+ * The verdict an edge override dictates, if one exists for this edge.
127
+ *
128
+ * Consulted BEFORE the condition is evaluated: an override exists precisely because the condition
129
+ * cannot be answered (or answered wrongly), so evaluating first would re-produce the hold the
130
+ * override exists to end.
131
+ */
132
+ export function OverrideVerdictFor(debug, edgeID) {
133
+ return debug.edgeOverrides?.[edgeID];
134
+ }
135
+ //# sourceMappingURL=debug-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-state.js","sourceRoot":"","sources":["../src/debug-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,UA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AAE,EAAE,CAAC;IACtD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,iBAAiB,CAAC,KAA0B,EAAE,MAAc;IACjE,IAAI,KAAK,CAAC,oBAAoB,IAAI,UAAU,CAAC,KAAK,CAAC,oBAAoB,EAAE,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/F,OAAO,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAC9B,KAA0B,EAC1B,MAAc;IAEd,OAAO,KAAK,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,13 +7,19 @@
7
7
  * `@memberjunction/ai-core-plus`, which both this dispatcher and the in-run executor consume.
8
8
  */
9
9
  export * from './types.js';
10
+ export * from './debug-state.js';
10
11
  export * from './TaskGraphService.js';
11
12
  export * from './TaskClaimStore.js';
13
+ export * from './settlement-rescue.js';
14
+ export * from './condition-gate.js';
15
+ export * from './task-predicates.js';
12
16
  export * from './DispatcherConditionEvaluator.js';
13
17
  export * from './TaskGraphDispatcher.js';
18
+ export * from './task-graph-kick.js';
14
19
  export * from './TaskGraphSubmitterImpl.js';
15
20
  export * from './WorkflowSpecSync.js';
16
21
  export * from './operations/TaskGraphOperations.js';
22
+ export * from './operations/TaskGraphDebugOperations.js';
17
23
  export * from './operations/WorkflowDraftOperation.js';
18
24
  export * from './operations/WorkflowOperations.js';
19
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC"}
package/dist/index.js CHANGED
@@ -7,13 +7,19 @@
7
7
  * `@memberjunction/ai-core-plus`, which both this dispatcher and the in-run executor consume.
8
8
  */
9
9
  export * from './types.js';
10
+ export * from './debug-state.js';
10
11
  export * from './TaskGraphService.js';
11
12
  export * from './TaskClaimStore.js';
13
+ export * from './settlement-rescue.js';
14
+ export * from './condition-gate.js';
15
+ export * from './task-predicates.js';
12
16
  export * from './DispatcherConditionEvaluator.js';
13
17
  export * from './TaskGraphDispatcher.js';
18
+ export * from './task-graph-kick.js';
14
19
  export * from './TaskGraphSubmitterImpl.js';
15
20
  export * from './WorkflowSpecSync.js';
16
21
  export * from './operations/TaskGraphOperations.js';
22
+ export * from './operations/TaskGraphDebugOperations.js';
17
23
  export * from './operations/WorkflowDraftOperation.js';
18
24
  export * from './operations/WorkflowOperations.js';
19
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { BaseRemotableOperation, IMetadataProvider, UserInfo } from '@memberjunction/core';
2
+ import type { TaskGraphDebugState } from '../debug-state.js';
3
+ /** Input for `TaskGraph.Pause` and `TaskGraph.Resume`. */
4
+ export interface TaskGraphPauseInput {
5
+ /** Parent task ID identifying the workflow run. */
6
+ parentTaskID: string;
7
+ }
8
+ /** Input for `TaskGraph.Step`. */
9
+ export interface TaskGraphStepInput {
10
+ parentTaskID: string;
11
+ /** `'one'` (default) releases the next eligible step, `'wave'` the current frontier, a task ID exactly that step. */
12
+ target?: string;
13
+ }
14
+ /** Input for `TaskGraph.SetBreakpoints`. */
15
+ export interface TaskGraphSetBreakpointsInput {
16
+ parentTaskID: string;
17
+ /** The full breakpoint set — replaces what was there. Empty clears all breakpoints. */
18
+ taskIDs: string[];
19
+ }
20
+ /** Input for `TaskGraph.OverrideEdge`. */
21
+ export interface TaskGraphOverrideEdgeInput {
22
+ parentTaskID: string;
23
+ /** The `MJ: Task Dependencies` row being answered. */
24
+ edgeID: string;
25
+ /** `'false'` = branch not taken, `'true'` = gate open, omitted/null = remove the override. */
26
+ verdict?: 'true' | 'false' | null;
27
+ }
28
+ /** Input for `TaskGraph.SkipTask`, `TaskGraph.ForceCompleteTask` and `TaskGraph.UpdateTaskInput`. */
29
+ export interface TaskGraphTaskInterventionInput {
30
+ taskID: string;
31
+ /** ForceCompleteTask: the output downstream paths evaluate against. UpdateTaskInput: the new input. */
32
+ payload?: Record<string, unknown> | string | null;
33
+ }
34
+ /** Output of the debug control verbs — what happened and the debug state now in force. */
35
+ export interface TaskGraphDebugControlOutput {
36
+ success: boolean;
37
+ /** The graph's debug state after the verb (pause/step/breakpoints/overrides). */
38
+ debug?: TaskGraphDebugState;
39
+ errorMessage?: string;
40
+ }
41
+ /** `TaskGraph.Pause` — nothing new starts; in-flight steps finish and their completions land. */
42
+ export declare class TaskGraphPauseServerOperation extends BaseRemotableOperation<TaskGraphPauseInput, TaskGraphDebugControlOutput> {
43
+ readonly OperationKey = "TaskGraph.Pause";
44
+ readonly ExecutionMode: "Sync";
45
+ readonly RequiredScope = "taskgraph:execute";
46
+ protected InternalExecute(input: TaskGraphPauseInput, provider: IMetadataProvider, user: UserInfo): Promise<TaskGraphDebugControlOutput>;
47
+ }
48
+ /** `TaskGraph.Resume` — claiming continues; breakpoints and overrides survive. */
49
+ export declare class TaskGraphResumeServerOperation extends BaseRemotableOperation<TaskGraphPauseInput, TaskGraphDebugControlOutput> {
50
+ readonly OperationKey = "TaskGraph.Resume";
51
+ readonly ExecutionMode: "Sync";
52
+ readonly RequiredScope = "taskgraph:execute";
53
+ protected InternalExecute(input: TaskGraphPauseInput, provider: IMetadataProvider, user: UserInfo): Promise<TaskGraphDebugControlOutput>;
54
+ }
55
+ /** `TaskGraph.Step` — arm a one-shot claim allowance on a paused workflow. */
56
+ export declare class TaskGraphStepServerOperation extends BaseRemotableOperation<TaskGraphStepInput, TaskGraphDebugControlOutput> {
57
+ readonly OperationKey = "TaskGraph.Step";
58
+ readonly ExecutionMode: "Sync";
59
+ readonly RequiredScope = "taskgraph:execute";
60
+ protected InternalExecute(input: TaskGraphStepInput, provider: IMetadataProvider, user: UserInfo): Promise<TaskGraphDebugControlOutput>;
61
+ }
62
+ /** `TaskGraph.SetBreakpoints` — replace the workflow's breakpoint set. */
63
+ export declare class TaskGraphSetBreakpointsServerOperation extends BaseRemotableOperation<TaskGraphSetBreakpointsInput, TaskGraphDebugControlOutput> {
64
+ readonly OperationKey = "TaskGraph.SetBreakpoints";
65
+ readonly ExecutionMode: "Sync";
66
+ readonly RequiredScope = "taskgraph:execute";
67
+ protected InternalExecute(input: TaskGraphSetBreakpointsInput, provider: IMetadataProvider, user: UserInfo): Promise<TaskGraphDebugControlOutput>;
68
+ }
69
+ /** `TaskGraph.OverrideEdge` — answer a path the engine cannot decide (or decided wrongly). */
70
+ export declare class TaskGraphOverrideEdgeServerOperation extends BaseRemotableOperation<TaskGraphOverrideEdgeInput, TaskGraphDebugControlOutput> {
71
+ readonly OperationKey = "TaskGraph.OverrideEdge";
72
+ readonly ExecutionMode: "Sync";
73
+ readonly RequiredScope = "taskgraph:execute";
74
+ protected InternalExecute(input: TaskGraphOverrideEdgeInput, provider: IMetadataProvider, user: UserInfo): Promise<TaskGraphDebugControlOutput>;
75
+ }
76
+ /** `TaskGraph.SkipTask` — declare a Pending step not-taken; dependents proceed. */
77
+ export declare class TaskGraphSkipTaskServerOperation extends BaseRemotableOperation<TaskGraphTaskInterventionInput, TaskGraphDebugControlOutput> {
78
+ readonly OperationKey = "TaskGraph.SkipTask";
79
+ readonly ExecutionMode: "Sync";
80
+ readonly RequiredScope = "taskgraph:execute";
81
+ protected InternalExecute(input: TaskGraphTaskInterventionInput, provider: IMetadataProvider, user: UserInfo): Promise<TaskGraphDebugControlOutput>;
82
+ }
83
+ /** `TaskGraph.ForceCompleteTask` — mark a wedged or externally-resolved step Complete with a supplied output. */
84
+ export declare class TaskGraphForceCompleteTaskServerOperation extends BaseRemotableOperation<TaskGraphTaskInterventionInput, TaskGraphDebugControlOutput> {
85
+ readonly OperationKey = "TaskGraph.ForceCompleteTask";
86
+ readonly ExecutionMode: "Sync";
87
+ readonly RequiredScope = "taskgraph:execute";
88
+ protected InternalExecute(input: TaskGraphTaskInterventionInput, provider: IMetadataProvider, user: UserInfo): Promise<TaskGraphDebugControlOutput>;
89
+ }
90
+ /** `TaskGraph.UpdateTaskInput` — replace a Pending step's input before stepping it. */
91
+ export declare class TaskGraphUpdateTaskInputServerOperation extends BaseRemotableOperation<TaskGraphTaskInterventionInput, TaskGraphDebugControlOutput> {
92
+ readonly OperationKey = "TaskGraph.UpdateTaskInput";
93
+ readonly ExecutionMode: "Sync";
94
+ readonly RequiredScope = "taskgraph:execute";
95
+ protected InternalExecute(input: TaskGraphTaskInterventionInput, provider: IMetadataProvider, user: UserInfo): Promise<TaskGraphDebugControlOutput>;
96
+ }
97
+ /** Prevents tree-shaking of the registered operation classes. */
98
+ export declare function LoadTaskGraphDebugOperations(): void;
99
+ //# sourceMappingURL=TaskGraphDebugOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskGraphDebugOperations.d.ts","sourceRoot":"","sources":["../../src/operations/TaskGraphDebugOperations.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAW,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIpG,OAAO,KAAK,EAAmC,mBAAmB,EAAE,MAAM,gBAAgB,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