@memberjunction/task-graph 6.2.0-edge.0 → 6.2.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.
Files changed (40) hide show
  1. package/dist/AIDecisionTaskRunner.d.ts +7 -0
  2. package/dist/AIDecisionTaskRunner.d.ts.map +1 -0
  3. package/dist/AIDecisionTaskRunner.js +57 -0
  4. package/dist/AIDecisionTaskRunner.js.map +1 -0
  5. package/dist/TaskClaimStore.d.ts +4 -3
  6. package/dist/TaskClaimStore.d.ts.map +1 -1
  7. package/dist/TaskClaimStore.js +3 -2
  8. package/dist/TaskClaimStore.js.map +1 -1
  9. package/dist/TaskGraphDispatcher.d.ts +89 -2
  10. package/dist/TaskGraphDispatcher.d.ts.map +1 -1
  11. package/dist/TaskGraphDispatcher.js +319 -29
  12. package/dist/TaskGraphDispatcher.js.map +1 -1
  13. package/dist/TaskGraphService.d.ts +56 -3
  14. package/dist/TaskGraphService.d.ts.map +1 -1
  15. package/dist/TaskGraphService.js +121 -17
  16. package/dist/TaskGraphService.js.map +1 -1
  17. package/dist/condition-gate.d.ts +17 -2
  18. package/dist/condition-gate.d.ts.map +1 -1
  19. package/dist/condition-gate.js +25 -1
  20. package/dist/condition-gate.js.map +1 -1
  21. package/dist/decision-node.d.ts +150 -0
  22. package/dist/decision-node.d.ts.map +1 -0
  23. package/dist/decision-node.js +234 -0
  24. package/dist/decision-node.js.map +1 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +2 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/operations/TaskGraphOperations.d.ts +4 -0
  30. package/dist/operations/TaskGraphOperations.d.ts.map +1 -1
  31. package/dist/operations/TaskGraphOperations.js +10 -2
  32. package/dist/operations/TaskGraphOperations.js.map +1 -1
  33. package/dist/task-predicates.d.ts +2 -0
  34. package/dist/task-predicates.d.ts.map +1 -1
  35. package/dist/task-predicates.js +5 -3
  36. package/dist/task-predicates.js.map +1 -1
  37. package/dist/types.d.ts +44 -0
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/types.js.map +1 -1
  40. package/package.json +11 -11
@@ -0,0 +1,150 @@
1
+ /**
2
+ * What a Decision step stores, reads and produces, decided without touching the database.
3
+ *
4
+ * A Decision step answers typed questions in one call and hands the answers to the edges that route
5
+ * on them. Everything here is a decision about data rather than I/O — which state the questions are
6
+ * about, where the answers land, and which answers a condition may act on — so it lives beside
7
+ * `condition-gate` rather than inside the dispatcher, where it would be testable only through mocks.
8
+ *
9
+ * @module @memberjunction/task-graph
10
+ */
11
+ import { type EdgeConditionOutcome, type GraphDecisions, type HeldDecisionAnswer, type TaskGraphDecisionAnswer, type TaskGraphDecisionQuestion, type TaskGraphNodeConfigMap } from '@memberjunction/ai-core-plus';
12
+ import type { MJTaskEntity_ITaskStepConfiguration } from '@memberjunction/core-entities';
13
+ /**
14
+ * What a Decision step keeps in `Task.Configuration.decision`: its spec configuration, plus the name
15
+ * conditions use for it.
16
+ */
17
+ export type TaskDecisionStepConfiguration = TaskGraphNodeConfigMap['Decision'] & {
18
+ /**
19
+ * The node's `tempId` in the submitted spec — the `<step>` in `decisions.<step>.<question>`.
20
+ *
21
+ * Stored because nothing else survives submission: Task rows have real IDs, and the tempIds the
22
+ * conditions were written against are otherwise gone.
23
+ */
24
+ nodeId: string;
25
+ };
26
+ /**
27
+ * `Task.Configuration` as this package writes it: the generated bag, plus a Decision step's settings.
28
+ *
29
+ * An intersection rather than a new member of `ITaskStepConfiguration`, because that interface is
30
+ * generated from a metadata JSONType. Everything else in the bag is read and written through the
31
+ * generated type unchanged.
32
+ */
33
+ export type TaskStepConfiguration = MJTaskEntity_ITaskStepConfiguration & {
34
+ /** Settings for a Decision step. The decision prompt itself is `Task.PromptID`. */
35
+ decision?: TaskDecisionStepConfiguration;
36
+ };
37
+ /** The Task columns the decision readers use. Structural, so `MJTaskEntity` satisfies it as-is. */
38
+ export type DecisionTaskRow = {
39
+ Name: string;
40
+ Status: string;
41
+ StepType: string | null;
42
+ Configuration: string | null;
43
+ OutputPayload: string | null;
44
+ ErrorMessage: string | null;
45
+ };
46
+ /** The payload key a Decision step writes its answers under, by step. */
47
+ export declare const DECISIONS_PAYLOAD_KEY = "decisions";
48
+ /**
49
+ * Reads a Decision step's settings from its stored `Configuration`, or `null` when they are absent
50
+ * or unusable. A step without them cannot ask anything, and a caller must say so rather than guess.
51
+ */
52
+ export declare function ReadDecisionStepConfiguration(configuration: string | null | undefined): TaskDecisionStepConfiguration | null;
53
+ /** One question's entry in a Decision step's output: the answer, or why it is held. */
54
+ export type DecisionStepOutputAnswer = TaskGraphDecisionAnswer | HeldDecisionAnswer;
55
+ /**
56
+ * A Decision step's answers as its output carries them: each usable answer as given, and for every
57
+ * other question the reason it is held.
58
+ *
59
+ * **An answer below its question's `minConfidence` never leaves the step.** The output is what later
60
+ * steps read, and a condition can reach it too (`payload.decisions…`) — the validator refuses that,
61
+ * but a below-threshold answer that is simply not there cannot be acted on by anything that slips
62
+ * past it, or by a later step's prompt. The edges that route on the decision read the graph's own
63
+ * answers through `ResolveGraphDecisions`, which reads the reasons back from here and holds.
64
+ */
65
+ export declare function DecisionStepOutputAnswers(stepName: string, questions: Readonly<Record<string, TaskGraphDecisionQuestion>>, answers: Readonly<Record<string, TaskGraphDecisionAnswer>>): Record<string, DecisionStepOutputAnswer>;
66
+ /**
67
+ * Why a Decision step cannot add its answers to this payload, or `null` when it can.
68
+ *
69
+ * The answers go under `decisions`, merged into whatever object is already there. Anything else
70
+ * there — a list, a string — is business data the merge would destroy, so the step is failed before
71
+ * its call rather than overwrite it.
72
+ */
73
+ export declare function DecisionsPayloadConflict(payload: Readonly<Record<string, unknown>>): string | null;
74
+ /**
75
+ * The payload a Decision step hands downstream: its input, with its answers added under
76
+ * `decisions.<step>`.
77
+ *
78
+ * Earlier steps' answers are kept, so a later step's prompt sees every decision made on its way.
79
+ * Conditions do not read this copy — they read the graph's own, from `ResolveGraphDecisions` — so a
80
+ * downstream step that rewrites the payload cannot change what an edge decides. Pass the answers
81
+ * through {@link DecisionStepOutputAnswers}, so that one below its threshold is not among them, and
82
+ * check {@link DecisionsPayloadConflict} first: a `decisions` field that is not an object is replaced.
83
+ */
84
+ export declare function BuildDecisionStepOutput(payload: Record<string, unknown>, nodeId: string, answers: Readonly<Record<string, DecisionStepOutputAnswer>>): Record<string, unknown>;
85
+ /**
86
+ * Every Decision step's answers in a graph, split into those a condition may act on and, for the
87
+ * rest, why not.
88
+ *
89
+ * Built from the steps' own rows, not from whatever reached an edge's origin through the payload, so
90
+ * `decisions.<step>` means the same thing on every edge. A step that has not completed contributes
91
+ * only reasons: one still running has not answered, one that failed never will, and one that was
92
+ * skipped was not asked. In every case a condition reading it holds rather than reading `false`.
93
+ */
94
+ export declare function ResolveGraphDecisions(rows: readonly DecisionTaskRow[]): GraphDecisions;
95
+ /**
96
+ * The questions a completed Decision step is holding, with why: each answer below its question's
97
+ * `minConfidence`, and each question it gave no answer to.
98
+ *
99
+ * Empty for any other step, and for a Decision whose answers are all usable. This is what makes such
100
+ * a step retryable — the edges that read these answers hold until it is asked again.
101
+ */
102
+ export declare function HeldDecisionAnswers(row: DecisionTaskRow): Record<string, string>;
103
+ /** The `tempId`s of the graph's Decision steps whose call failed. */
104
+ export declare function FailedDecisionIDs(rows: readonly DecisionTaskRow[]): Set<string>;
105
+ /** True when a condition reads any of the given Decision steps. */
106
+ export declare function ReadsFailedDecision(condition: string, failedDecisionIDs: ReadonlySet<string>): boolean;
107
+ /**
108
+ * An exclusive fork's edges with each path that reads a FAILED decision counted as not taken, in
109
+ * every fork that has a satisfied path — so the satisfied one wins whatever its rank.
110
+ *
111
+ * A failed decision call is a failed step, and a flow's failure handling is its outgoing paths: the
112
+ * recovery path its author drew (`stepResult.Success === false`, or a fallback) is how the flow goes
113
+ * on. Holding the fork because a higher-ranked path reads the answer that never came would stop it
114
+ * from ever being taken. The paths are not evaluated — a negated read of a missing answer would come
115
+ * out true — only set aside.
116
+ *
117
+ * A fork with NO satisfied path is left alone: every path is unevaluable, the fork holds, and a
118
+ * Retry of the failed Decision step can still route it. An answer below `minConfidence` is never set
119
+ * aside; it holds, because its path might have been the one to take.
120
+ */
121
+ export declare function PassOverFailedDecisionPaths<E extends {
122
+ id: string;
123
+ exclusiveGroup: string;
124
+ conditionOutcome: EdgeConditionOutcome;
125
+ }>(edges: readonly E[], readsFailedDecision: (edge: E) => boolean): E[];
126
+ /**
127
+ * The usable answers a Decision step already gave, read from its own output: the answers a retry
128
+ * keeps.
129
+ *
130
+ * **A usable answer is final.** The graph acts on it as soon as the step completes: a fork's losing
131
+ * branch is Skipped, and nothing puts it back. So a retry asks only the questions the step is
132
+ * holding. Asking a usable one again could flip a fork whose other branch is already gone, and leave
133
+ * neither branch to run.
134
+ *
135
+ * Empty for a step with no answers of its own: a first run has no output yet, and a failed step's
136
+ * output is cleared when it is retried (`PrepareTaskForRetry`).
137
+ */
138
+ export declare function KeptDecisionAnswers(row: Pick<DecisionTaskRow, 'Name' | 'StepType' | 'Configuration' | 'OutputPayload'>): Record<string, TaskGraphDecisionAnswer>;
139
+ /** The questions a Decision step asks on this run: every one it has no kept answer to. */
140
+ export declare function QuestionsToAsk(questions: Readonly<Record<string, TaskGraphDecisionQuestion>>, kept: Readonly<Record<string, TaskGraphDecisionAnswer>>): Record<string, TaskGraphDecisionQuestion>;
141
+ /**
142
+ * The output of a retried Decision step that could not answer again: its earlier output, with the
143
+ * same usable answers, and each question it asked again held for `reason`.
144
+ *
145
+ * The step stays `Complete` rather than failing. Failing it would undo answers the graph has already
146
+ * acted on: under `'block'` the branch those answers chose would block, and the next retry would find
147
+ * no answers left to keep.
148
+ */
149
+ export declare function StillHoldingDecisionOutput(previousOutput: string | null, stepName: string, nodeId: string, questions: Readonly<Record<string, TaskGraphDecisionQuestion>>, kept: Readonly<Record<string, TaskGraphDecisionAnswer>>, reason: string): Record<string, unknown>;
150
+ //# sourceMappingURL=decision-node.d.ts.map
@@ -0,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EAAE,CAAC,KAAK,OAAO,GAC1C,CAAC,EAAE,CAOL;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAC/B,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,UAAU,GAAG,eAAe,GAAG,eAAe,CAAC,GACpF,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAczC;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,CAC1B,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC,EAC9D,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,GACxD,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAM3C;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACtC,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC,EAC9D,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,EACvD,MAAM,EAAE,MAAM,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB"}
@@ -0,0 +1,234 @@
1
+ /**
2
+ * What a Decision step stores, reads and produces, decided without touching the database.
3
+ *
4
+ * A Decision step answers typed questions in one call and hands the answers to the edges that route
5
+ * on them. Everything here is a decision about data rather than I/O — which state the questions are
6
+ * about, where the answers land, and which answers a condition may act on — so it lives beside
7
+ * `condition-gate` rather than inside the dispatcher, where it would be testable only through mocks.
8
+ *
9
+ * @module @memberjunction/task-graph
10
+ */
11
+ import { DecisionReferencesIn, ResolveDecisionStepAnswers, } from '@memberjunction/ai-core-plus';
12
+ import { ParseConditionOutput } from './condition-gate.js';
13
+ /** The payload key a Decision step writes its answers under, by step. */
14
+ export const DECISIONS_PAYLOAD_KEY = 'decisions';
15
+ /**
16
+ * Reads a Decision step's settings from its stored `Configuration`, or `null` when they are absent
17
+ * or unusable. A step without them cannot ask anything, and a caller must say so rather than guess.
18
+ */
19
+ export function ReadDecisionStepConfiguration(configuration) {
20
+ let parsed;
21
+ try {
22
+ parsed = configuration ? JSON.parse(configuration) : null;
23
+ }
24
+ catch {
25
+ return null;
26
+ }
27
+ if (!isRecord(parsed) || !isRecord(parsed.decision))
28
+ return null;
29
+ const decision = parsed.decision;
30
+ if (typeof decision.nodeId !== 'string' || !decision.nodeId || !isRecord(decision.questions))
31
+ return null;
32
+ // Only `nodeId` and the shape of `questions` are checked here. The runner is the real guard on
33
+ // the questions themselves: `AIDecisionTaskRunner` passes them through `ToDecisionQuestions`
34
+ // and refuses the call on any invalid one. A caller that uses them any other way must check them.
35
+ return decision;
36
+ }
37
+ /**
38
+ * A Decision step's answers as its output carries them: each usable answer as given, and for every
39
+ * other question the reason it is held.
40
+ *
41
+ * **An answer below its question's `minConfidence` never leaves the step.** The output is what later
42
+ * steps read, and a condition can reach it too (`payload.decisions…`) — the validator refuses that,
43
+ * but a below-threshold answer that is simply not there cannot be acted on by anything that slips
44
+ * past it, or by a later step's prompt. The edges that route on the decision read the graph's own
45
+ * answers through `ResolveGraphDecisions`, which reads the reasons back from here and holds.
46
+ */
47
+ export function DecisionStepOutputAnswers(stepName, questions, answers) {
48
+ // The shared answer rules decide which are usable, so this copy and every hold agree.
49
+ const resolved = ResolveDecisionStepAnswers({ Name: stepName, Status: 'Complete', ErrorMessage: null }, questions, answers);
50
+ const output = {};
51
+ for (const key of Object.keys(questions)) {
52
+ output[key] = Object.prototype.hasOwnProperty.call(resolved.Answers, key)
53
+ ? resolved.Answers[key]
54
+ // Every question the rules do not use has a reason; the fallback is for the compiler.
55
+ : { held: resolved.Unresolved[key] ?? `the decision "${stepName}" completed without an answer to "${key}"` };
56
+ }
57
+ return output;
58
+ }
59
+ /**
60
+ * Why a Decision step cannot add its answers to this payload, or `null` when it can.
61
+ *
62
+ * The answers go under `decisions`, merged into whatever object is already there. Anything else
63
+ * there — a list, a string — is business data the merge would destroy, so the step is failed before
64
+ * its call rather than overwrite it.
65
+ */
66
+ export function DecisionsPayloadConflict(payload) {
67
+ const existing = payload[DECISIONS_PAYLOAD_KEY];
68
+ if (existing === undefined || existing === null || isRecord(existing))
69
+ return null;
70
+ const kind = Array.isArray(existing) ? 'a list' : `a ${typeof existing}`;
71
+ return `its payload already has a "${DECISIONS_PAYLOAD_KEY}" field holding ${kind}, which its answers would replace; `
72
+ + `rename that field, since a Decision step writes its answers under "${DECISIONS_PAYLOAD_KEY}"`;
73
+ }
74
+ /**
75
+ * The payload a Decision step hands downstream: its input, with its answers added under
76
+ * `decisions.<step>`.
77
+ *
78
+ * Earlier steps' answers are kept, so a later step's prompt sees every decision made on its way.
79
+ * Conditions do not read this copy — they read the graph's own, from `ResolveGraphDecisions` — so a
80
+ * downstream step that rewrites the payload cannot change what an edge decides. Pass the answers
81
+ * through {@link DecisionStepOutputAnswers}, so that one below its threshold is not among them, and
82
+ * check {@link DecisionsPayloadConflict} first: a `decisions` field that is not an object is replaced.
83
+ */
84
+ export function BuildDecisionStepOutput(payload, nodeId, answers) {
85
+ const existing = payload[DECISIONS_PAYLOAD_KEY];
86
+ const earlier = isRecord(existing) ? existing : {};
87
+ return { ...payload, [DECISIONS_PAYLOAD_KEY]: { ...earlier, [nodeId]: { ...answers } } };
88
+ }
89
+ /**
90
+ * Every Decision step's answers in a graph, split into those a condition may act on and, for the
91
+ * rest, why not.
92
+ *
93
+ * Built from the steps' own rows, not from whatever reached an edge's origin through the payload, so
94
+ * `decisions.<step>` means the same thing on every edge. A step that has not completed contributes
95
+ * only reasons: one still running has not answered, one that failed never will, and one that was
96
+ * skipped was not asked. In every case a condition reading it holds rather than reading `false`.
97
+ */
98
+ export function ResolveGraphDecisions(rows) {
99
+ const answers = {};
100
+ const unresolved = {};
101
+ for (const row of rows) {
102
+ if (row.StepType !== 'Decision')
103
+ continue;
104
+ const config = ReadDecisionStepConfiguration(row.Configuration);
105
+ if (!config)
106
+ continue;
107
+ const given = row.Status === 'Complete' ? answersIn(row.OutputPayload, config.nodeId) : {};
108
+ const resolved = ResolveDecisionStepAnswers(row, config.questions, given);
109
+ if (Object.keys(resolved.Answers).length > 0)
110
+ Object.assign(answers[config.nodeId] ??= {}, resolved.Answers);
111
+ if (Object.keys(resolved.Unresolved).length > 0)
112
+ Object.assign(unresolved[config.nodeId] ??= {}, resolved.Unresolved);
113
+ }
114
+ return { Answers: answers, Unresolved: unresolved };
115
+ }
116
+ /**
117
+ * The questions a completed Decision step is holding, with why: each answer below its question's
118
+ * `minConfidence`, and each question it gave no answer to.
119
+ *
120
+ * Empty for any other step, and for a Decision whose answers are all usable. This is what makes such
121
+ * a step retryable — the edges that read these answers hold until it is asked again.
122
+ */
123
+ export function HeldDecisionAnswers(row) {
124
+ if (row.StepType !== 'Decision' || row.Status !== 'Complete')
125
+ return {};
126
+ const config = ReadDecisionStepConfiguration(row.Configuration);
127
+ if (!config)
128
+ return {};
129
+ return { ...ResolveGraphDecisions([row]).Unresolved[config.nodeId] };
130
+ }
131
+ /** The `tempId`s of the graph's Decision steps whose call failed. */
132
+ export function FailedDecisionIDs(rows) {
133
+ const failed = new Set();
134
+ for (const row of rows) {
135
+ if (row.StepType !== 'Decision' || row.Status !== 'Failed')
136
+ continue;
137
+ const config = ReadDecisionStepConfiguration(row.Configuration);
138
+ if (config)
139
+ failed.add(config.nodeId);
140
+ }
141
+ return failed;
142
+ }
143
+ /** True when a condition reads any of the given Decision steps. */
144
+ export function ReadsFailedDecision(condition, failedDecisionIDs) {
145
+ if (failedDecisionIDs.size === 0 || !condition)
146
+ return false;
147
+ return DecisionReferencesIn(condition).References.some((r) => failedDecisionIDs.has(r.NodeId));
148
+ }
149
+ /**
150
+ * An exclusive fork's edges with each path that reads a FAILED decision counted as not taken, in
151
+ * every fork that has a satisfied path — so the satisfied one wins whatever its rank.
152
+ *
153
+ * A failed decision call is a failed step, and a flow's failure handling is its outgoing paths: the
154
+ * recovery path its author drew (`stepResult.Success === false`, or a fallback) is how the flow goes
155
+ * on. Holding the fork because a higher-ranked path reads the answer that never came would stop it
156
+ * from ever being taken. The paths are not evaluated — a negated read of a missing answer would come
157
+ * out true — only set aside.
158
+ *
159
+ * A fork with NO satisfied path is left alone: every path is unevaluable, the fork holds, and a
160
+ * Retry of the failed Decision step can still route it. An answer below `minConfidence` is never set
161
+ * aside; it holds, because its path might have been the one to take.
162
+ */
163
+ export function PassOverFailedDecisionPaths(edges, readsFailedDecision) {
164
+ const recoverable = new Set(edges.filter((e) => e.conditionOutcome === 'satisfied').map((e) => e.exclusiveGroup));
165
+ return edges.map((e) => e.conditionOutcome === 'unevaluable' && recoverable.has(e.exclusiveGroup) && readsFailedDecision(e)
166
+ ? { ...e, conditionOutcome: 'unsatisfied' }
167
+ : e);
168
+ }
169
+ /**
170
+ * The usable answers a Decision step already gave, read from its own output: the answers a retry
171
+ * keeps.
172
+ *
173
+ * **A usable answer is final.** The graph acts on it as soon as the step completes: a fork's losing
174
+ * branch is Skipped, and nothing puts it back. So a retry asks only the questions the step is
175
+ * holding. Asking a usable one again could flip a fork whose other branch is already gone, and leave
176
+ * neither branch to run.
177
+ *
178
+ * Empty for a step with no answers of its own: a first run has no output yet, and a failed step's
179
+ * output is cleared when it is retried (`PrepareTaskForRetry`).
180
+ */
181
+ export function KeptDecisionAnswers(row) {
182
+ const config = ReadDecisionStepConfiguration(row.Configuration);
183
+ if (!config || !row.OutputPayload)
184
+ return {};
185
+ // Read as the completed step that wrote this output, so the same answer rules apply. Copied field
186
+ // by field, not spread: the row is usually an entity, whose fields are getters a spread drops.
187
+ const written = {
188
+ Name: row.Name,
189
+ StepType: row.StepType,
190
+ Configuration: row.Configuration,
191
+ OutputPayload: row.OutputPayload,
192
+ Status: 'Complete',
193
+ ErrorMessage: null,
194
+ };
195
+ return { ...ResolveGraphDecisions([written]).Answers[config.nodeId] };
196
+ }
197
+ /** The questions a Decision step asks on this run: every one it has no kept answer to. */
198
+ export function QuestionsToAsk(questions, kept) {
199
+ const toAsk = {};
200
+ for (const [key, question] of Object.entries(questions)) {
201
+ if (!Object.prototype.hasOwnProperty.call(kept, key))
202
+ toAsk[key] = question;
203
+ }
204
+ return toAsk;
205
+ }
206
+ /**
207
+ * The output of a retried Decision step that could not answer again: its earlier output, with the
208
+ * same usable answers, and each question it asked again held for `reason`.
209
+ *
210
+ * The step stays `Complete` rather than failing. Failing it would undo answers the graph has already
211
+ * acted on: under `'block'` the branch those answers chose would block, and the next retry would find
212
+ * no answers left to keep.
213
+ */
214
+ export function StillHoldingDecisionOutput(previousOutput, stepName, nodeId, questions, kept, reason) {
215
+ const previous = ParseConditionOutput(previousOutput);
216
+ const answers = {};
217
+ for (const key of Object.keys(questions)) {
218
+ answers[key] = Object.prototype.hasOwnProperty.call(kept, key)
219
+ ? kept[key]
220
+ : { held: `the decision "${stepName}" was asked "${key}" again and could not answer: ${reason}` };
221
+ }
222
+ return BuildDecisionStepOutput(isRecord(previous) ? previous : {}, nodeId, answers);
223
+ }
224
+ /** A completed step's answers, as it wrote them into its output. */
225
+ function answersIn(outputPayload, nodeId) {
226
+ const output = ParseConditionOutput(outputPayload);
227
+ const decisions = isRecord(output) ? output[DECISIONS_PAYLOAD_KEY] : undefined;
228
+ const mine = isRecord(decisions) && Object.prototype.hasOwnProperty.call(decisions, nodeId) ? decisions[nodeId] : undefined;
229
+ return isRecord(mine) ? mine : {};
230
+ }
231
+ function isRecord(value) {
232
+ return !!value && typeof value === 'object' && !Array.isArray(value);
233
+ }
234
+ //# sourceMappingURL=decision-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision-node.js","sourceRoot":"","sources":["../src/decision-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACH,oBAAoB,EACpB,0BAA0B,GAO7B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE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AAS,CAAC;IAC5H,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACzE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,6 +12,8 @@ export * from './TaskGraphService.js';
12
12
  export * from './TaskClaimStore.js';
13
13
  export * from './settlement-rescue.js';
14
14
  export * from './condition-gate.js';
15
+ export * from './decision-node.js';
16
+ export * from './AIDecisionTaskRunner.js';
15
17
  export * from './task-predicates.js';
16
18
  export * from './DispatcherConditionEvaluator.js';
17
19
  export * from './TaskGraphDispatcher.js';
@@ -1 +1 @@
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"}
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,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,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
@@ -12,6 +12,8 @@ export * from './TaskGraphService.js';
12
12
  export * from './TaskClaimStore.js';
13
13
  export * from './settlement-rescue.js';
14
14
  export * from './condition-gate.js';
15
+ export * from './decision-node.js';
16
+ export * from './AIDecisionTaskRunner.js';
15
17
  export * from './task-predicates.js';
16
18
  export * from './DispatcherConditionEvaluator.js';
17
19
  export * from './TaskGraphDispatcher.js';
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,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"}
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,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,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"}
@@ -35,6 +35,10 @@ export declare class TaskGraphCancelServerOperation extends TaskGraphCancelOpera
35
35
  *
36
36
  * Unblocking is not optional: retrying a task while its dependents remain `Blocked` leaves the graph
37
37
  * exactly as stuck as before, because nothing downstream ever becomes eligible again.
38
+ *
39
+ * Also the way out of a Decision step's hold: a completed Decision holding an answer below its
40
+ * question's `minConfidence` is asked the questions it is holding again, and keeps the rest (see
41
+ * `TaskGraphService.Retry`).
38
42
  */
39
43
  export declare class TaskGraphRetryTaskServerOperation extends TaskGraphRetryTaskOperation {
40
44
  protected InternalExecute(input: TaskGraphRetryInput & {
@@ -1 +1 @@
1
- {"version":3,"file":"TaskGraphOperations.d.ts","sourceRoot":"","sources":["../../src/operations/TaskGraphOperations.ts"],"names":[],"mappings":"AAqBA,OAAO,EAA0B,iBAAiB,EAAW,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAEH,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,qB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,CAAC,qBAAqB,CAAC;CAkCpC;AAED,iEAAiE;AACjE,wBAAgB,uBAAuB,IAAI,IAAI,CAY9C"}
@@ -126,6 +126,10 @@ export { TaskGraphCancelServerOperation };
126
126
  *
127
127
  * Unblocking is not optional: retrying a task while its dependents remain `Blocked` leaves the graph
128
128
  * exactly as stuck as before, because nothing downstream ever becomes eligible again.
129
+ *
130
+ * Also the way out of a Decision step's hold: a completed Decision holding an answer below its
131
+ * question's `minConfidence` is asked the questions it is holding again, and keeps the rest (see
132
+ * `TaskGraphService.Retry`).
129
133
  */
130
134
  let TaskGraphRetryTaskServerOperation = class TaskGraphRetryTaskServerOperation extends TaskGraphRetryTaskOperation {
131
135
  async InternalExecute(
@@ -136,8 +140,12 @@ let TaskGraphRetryTaskServerOperation = class TaskGraphRetryTaskServerOperation
136
140
  if (!input?.taskID)
137
141
  throw new Error('taskID is required');
138
142
  const ok = await new TaskGraphService().Retry(input.taskID, submitContext(provider, user, ''), input.inputPayload);
139
- if (!ok)
140
- return { success: false, errorMessage: 'Retry failed; the task may not be in a Failed state.' };
143
+ if (!ok) {
144
+ return {
145
+ success: false,
146
+ errorMessage: 'Retry failed; the task may be neither Failed nor a Decision step holding an answer below its minConfidence.',
147
+ };
148
+ }
141
149
  const task = await provider.GetEntityObject('MJ: Tasks', user);
142
150
  const loaded = await task.Load(input.taskID);
143
151
  return { success: true, status: loaded ? task.Status : undefined };
@@ -1 +1 @@
1
- {"version":3,"file":"TaskGraphOperations.js","sourceRoot":"","sources":["../../src/operations/TaskGraphOperations.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAqB,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAEH,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,GAO9B,MAAM,+BAA+B,CAAC;AACvC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AI,SAAS;aAC5C,CAAC,CAAC;SACN,CAAC;IACN,CAAC;CACJ,CAAA;AAvCY,iCAAiC;IAD7C,aAAa,CAAC,sBAAsB,EAAE,qBAAqB,CAAC;GAChD,iCAAiC,CAuC7C;;AAED,iEAAiE;AACjE,MAAM,UAAU,uBAAuB;IACnC,KAAK,8BAA8B,CAAC;IACpC,KAAK,8BAA8B,CAAC;IACpC,KAAK,iCAAiC,CAAC;IACvC,KAAK,iCAAiC,CAAC;IACvC,wFAAwF;IACxF,wFAAwF;IACxF,0BAA0B,EAAE,CAAC;IAC7B,6FAA6F;IAC7F,2FAA2F;IAC3F,mDAAmD;IACnD,4BAA4B,EAAE,CAAC;AACnC,CAAC"}
@@ -28,6 +28,8 @@
28
28
  /** Renders a column reference for the dialect the caller is building. */
29
29
  export type ColumnQuoter = (column: string) => string;
30
30
  /** For `RunView.ExtraFilter`, which takes bare column names. */
31
+ export declare const BARECOLUMNS: ColumnQuoter;
32
+ /** @deprecated Use {@link BARECOLUMNS}. */
31
33
  export declare const BARE_COLUMNS: ColumnQuoter;
32
34
  /**
33
35
  * The columns that assign a task to an executor, in the order claim routing tries them.
@@ -1 +1 @@
1
- {"version":3,"file":"task-predicates.d.ts","sourceRoot":"","sources":["../src/task-predicates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,yEAAyE;AACzE,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;AAEtD,gEAAgE;AAChE,eAAO,MAAM,YAAY,EAAE,YAAiC,CAAC;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,8CAA+C,CAAC;AAE7E,wFAAwF;AACxF,MAAM,MAAM,cAAc,GAAG;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ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,MAAM,CAExE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,GAAE,YAA0B,GAAG,MAAM,CAEtE;AAED,2FAA2F;AAC3F,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC,GAAG,OAAO,CAEtG;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,QAAQ,CAAC,GAAG,OAAO,CAEtF"}
@@ -26,7 +26,9 @@
26
26
  * @module @memberjunction/task-graph
27
27
  */
28
28
  /** For `RunView.ExtraFilter`, which takes bare column names. */
29
- export const BARE_COLUMNS = (column) => column;
29
+ export const BARECOLUMNS = (column) => column;
30
+ /** @deprecated Use {@link BARECOLUMNS}. */
31
+ export const BARE_COLUMNS = BARECOLUMNS;
30
32
  /**
31
33
  * The columns that assign a task to an executor, in the order claim routing tries them.
32
34
  *
@@ -42,7 +44,7 @@ export const EXECUTOR_COLUMNS = ['AgentID', 'ActionID', 'PromptID'];
42
44
  * abandoned by a crash. A human task's `In Progress` — if it ever reaches it — is a person's state
43
45
  * to own, not a claim to reclaim.
44
46
  */
45
- export function MachineTaskSQL(quote = BARE_COLUMNS) {
47
+ export function MachineTaskSQL(quote = BARECOLUMNS) {
46
48
  return `(${EXECUTOR_COLUMNS.map((c) => `${quote(c)} IS NOT NULL`).join(' OR ')})`;
47
49
  }
48
50
  /**
@@ -53,7 +55,7 @@ export function MachineTaskSQL(quote = BARE_COLUMNS) {
53
55
  * `StepType='Human'` filter — asked, never settled, never expired, dead forever. This is the wide
54
56
  * form the reopen path already used; the settle and expiry paths were narrower, which is B4.
55
57
  */
56
- export function HumanTaskSQL(quote = BARE_COLUMNS) {
58
+ export function HumanTaskSQL(quote = BARECOLUMNS) {
57
59
  return `(${quote('StepType')} = 'Human' OR (${quote('StepType')} IS NULL AND ${quote('UserID')} IS NOT NULL))`;
58
60
  }
59
61
  /** True when some runner owns this task. The TypeScript twin of {@link MachineTaskSQL}. */
@@ -1 +1 @@
1
- {"version":3,"file":"task-predicates.js","sourceRoot":"","sources":["../src/task-predicates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAiB,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAW7E;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,QAAsB,YAAY;IAC7D,OAAO,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;AACtF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,QAAsB,YAAY;IAC3D,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,kBAAkB,KAAK,CAAC,UAAU,CAAC,gBAAgB,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;AACnH,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,aAAa,CAAC,IAA+D;IACzF,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,IAAiD;IACzE,OAAO,IAAI,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;AACvF,CAAC"}
1
+ {"version":3,"file":"task-predicates.js","source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
5
  import { IMetadataProvider, UserInfo } from '@memberjunction/core';
6
+ import type { AgentDecisionQuestion, TaskGraphDecisionAnswer } from '@memberjunction/ai-core-plus';
6
7
  /**
7
8
  * Mints a fresh metadata/data provider.
8
9
  *
@@ -127,6 +128,49 @@ export type TaskPromptRunResult = {
127
128
  export type TaskPromptRunner = {
128
129
  RunPromptForTask(params: TaskPromptRunParams): Promise<TaskPromptRunResult>;
129
130
  };
131
+ /** Everything answering one Decision node's questions needs. */
132
+ export type TaskDecisionRunParams = {
133
+ TaskID: string;
134
+ /** The decision prompt (`MJ: AI Prompts`) whose model bindings run the call. */
135
+ PromptID: string;
136
+ /** What the questions are about, already resolved from the node's `state` path. */
137
+ State: string | Record<string, unknown>;
138
+ /** The node's questions, answered together in ONE call. */
139
+ Questions: Record<string, AgentDecisionQuestion>;
140
+ Provider: IMetadataProvider;
141
+ ContextUser: UserInfo;
142
+ /** Optional progress sink; the dispatcher turns calls into rate-limited `NodeProgress` frames. */
143
+ OnProgress?: TaskRunProgressCallback;
144
+ };
145
+ /** The outcome of one Decision node's call. */
146
+ export type TaskDecisionRunResult = {
147
+ Success: boolean;
148
+ /**
149
+ * The answers by question key, in the shape a condition reads them. Absent on failure: a failed
150
+ * call has no answers, and a partial set would let a condition act on half a decision.
151
+ */
152
+ Answers?: Record<string, TaskGraphDecisionAnswer>;
153
+ ErrorMessage?: string;
154
+ /**
155
+ * The `MJ: AI Prompt Runs` row the call wrote, including a failed one. It is how the decision's
156
+ * cost reaches the graph's rollup.
157
+ */
158
+ PromptRunID?: string;
159
+ };
160
+ /**
161
+ * Answers one Decision node's questions, in one call.
162
+ *
163
+ * A seam like the other runners, so the dispatcher's Decision handling is testable without a model.
164
+ * Unlike them it has a default — `AIDecisionTaskRunner` — because this package can make the call
165
+ * itself: it already depends on `@memberjunction/ai-prompts`, and a Decision needs nothing a host
166
+ * owns. A host with its own decision strategy supplies one.
167
+ *
168
+ * MUST make exactly one decision call per invocation. The questions a fork needs are asked
169
+ * together on purpose; splitting them multiplies cost for no gain.
170
+ */
171
+ export type TaskDecisionRunner = {
172
+ RunDecisionForTask(params: TaskDecisionRunParams): Promise<TaskDecisionRunResult>;
173
+ };
130
174
  /** What happened to a task or a graph, as a closed set a consumer can branch on. */
131
175
  export type TaskGraphFrameKind =
132
176
  /** A task was claimed by an instance and is about to run. */