@codemation/core 0.0.16 → 0.0.19
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/CHANGELOG.md +15 -0
- package/LICENSE +37 -0
- package/dist/{RunIntentService-CYnn140t.js → RunIntentService-C1nu_YwM.js} +170 -118
- package/dist/RunIntentService-C1nu_YwM.js.map +1 -0
- package/dist/{RunIntentService-ByuUYsAL.d.cts → RunIntentService-DjbxzBBP.d.cts} +10 -1
- package/dist/{RunIntentService-DlQH5eZ2.cjs → RunIntentService-ZkjpY7MS.cjs} +170 -118
- package/dist/RunIntentService-ZkjpY7MS.cjs.map +1 -0
- package/dist/bootstrap/index.cjs +1 -1
- package/dist/bootstrap/index.d.cts +1 -1
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/bootstrap/index.js +1 -1
- package/dist/{index-k0hwnJyT.d.ts → index-BIewO9-9.d.ts} +89 -10
- package/dist/index.cjs +181 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +180 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/authoring/DefinedNodeRegistry.ts +16 -0
- package/src/authoring/defineCredential.types.ts +172 -0
- package/src/authoring/defineNode.types.ts +227 -0
- package/src/authoring/index.ts +12 -0
- package/src/index.ts +1 -0
- package/src/planning/CurrentStateFrontierPlanner.ts +24 -1
- package/src/runtime/RunIntentService.ts +68 -14
- package/dist/RunIntentService-CYnn140t.js.map +0 -1
- package/dist/RunIntentService-DlQH5eZ2.cjs.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @codemation/core
|
|
2
|
+
|
|
3
|
+
## 0.0.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#26](https://github.com/MadeRelevant/codemation/pull/26) [`405c854`](https://github.com/MadeRelevant/codemation/commit/405c8541961f41dcba653f352691a821b0470ca0) Thanks [@cblokland90](https://github.com/cblokland90)! - Fix manual trigger reruns and current-state resume behavior.
|
|
8
|
+
|
|
9
|
+
Current-state execution now treats empty upstream outputs like the live queue planner, so untaken branches stay dead on resume. Manual downstream runs can also synthesize trigger test items through core intent handling instead of relying on host-specific trigger logic.
|
|
10
|
+
|
|
11
|
+
## 0.0.18
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- f0c6878: Introduce Changesets, a single CI status check for branch protection, and the Codemation pre-stable license across published packages.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Codemation Pre-Stable License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Made Relevant B.V. All rights reserved.
|
|
4
|
+
|
|
5
|
+
1. Definitions
|
|
6
|
+
|
|
7
|
+
"Software" means the Codemation source code, documentation, and artifacts in this repository and any published npm packages in the Codemation monorepo.
|
|
8
|
+
|
|
9
|
+
"Stable Version" means the first published release of the package `@codemation/core` on the public npm registry with version 1.0.0 or higher.
|
|
10
|
+
|
|
11
|
+
2. Permitted use (before Stable Version)
|
|
12
|
+
|
|
13
|
+
Until a Stable Version exists, you may use, copy, modify, and distribute the Software only for non-commercial purposes, including personal learning, research, evaluation, and internal use within your organization that does not charge third parties for access to the Software or a product or service whose primary value is the Software.
|
|
14
|
+
|
|
15
|
+
3. Restrictions (before Stable Version)
|
|
16
|
+
|
|
17
|
+
Until a Stable Version exists, you must not:
|
|
18
|
+
|
|
19
|
+
a) Sell, rent, lease, or sublicense the Software or a derivative work for a fee;
|
|
20
|
+
|
|
21
|
+
b) Offer the Software or a derivative work as part of a paid product or service (including hosting, support, or consulting) where the Software is a material part of the offering;
|
|
22
|
+
|
|
23
|
+
c) Use the Software or a derivative work primarily to generate revenue or commercial advantage for you or others.
|
|
24
|
+
|
|
25
|
+
These restrictions apply to all versions published before a Stable Version, even if a later Stable Version is released under different terms.
|
|
26
|
+
|
|
27
|
+
4. After Stable Version
|
|
28
|
+
|
|
29
|
+
The maintainers may publish a Stable Version under different license terms. If they do, those terms apply only to that Stable Version and subsequent releases they designate; they do not automatically apply to earlier pre-stable versions.
|
|
30
|
+
|
|
31
|
+
5. No warranty
|
|
32
|
+
|
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
34
|
+
|
|
35
|
+
6. Third-party components
|
|
36
|
+
|
|
37
|
+
The Software may include third-party components under their own licenses. Those licenses govern those components.
|
|
@@ -1,99 +1,8 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import "reflect-metadata";
|
|
3
2
|
import { container, delay, inject, injectAll, injectable, instanceCachingFactory, instancePerContainerCachingFactory, predicateAwareClassFactory, registry, singleton } from "tsyringe";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
4
|
import { ReadableStream } from "node:stream/web";
|
|
5
5
|
|
|
6
|
-
//#region src/workflow/definition/ConnectionNodeIdFactory.ts
|
|
7
|
-
/**
|
|
8
|
-
* Deterministic ids for workflow connection-owned child nodes (LLM slot, tools, etc.).
|
|
9
|
-
* These are stable across loads.
|
|
10
|
-
*/
|
|
11
|
-
var ConnectionNodeIdFactory = class {
|
|
12
|
-
static connectionSegment = "__conn__";
|
|
13
|
-
static languageModelConnectionNodeId(parentNodeId) {
|
|
14
|
-
return `${parentNodeId}${this.connectionSegment}llm`;
|
|
15
|
-
}
|
|
16
|
-
static toolConnectionNodeId(parentNodeId, toolName) {
|
|
17
|
-
const normalized = this.normalizeToolName(toolName);
|
|
18
|
-
return `${parentNodeId}${this.connectionSegment}tool${this.connectionSegment}${normalized}`;
|
|
19
|
-
}
|
|
20
|
-
static isLanguageModelConnectionNodeId(nodeId) {
|
|
21
|
-
return nodeId.endsWith(`${this.connectionSegment}llm`);
|
|
22
|
-
}
|
|
23
|
-
static isToolConnectionNodeId(nodeId) {
|
|
24
|
-
return nodeId.includes(`${this.connectionSegment}tool${this.connectionSegment}`);
|
|
25
|
-
}
|
|
26
|
-
/** True when `nodeId` is a connection-owned child of `parentNodeId` (LLM or tool slot). */
|
|
27
|
-
static isConnectionOwnedDescendantOf(parentNodeId, nodeId) {
|
|
28
|
-
return nodeId.startsWith(`${parentNodeId}${this.connectionSegment}`);
|
|
29
|
-
}
|
|
30
|
-
/** Normalizes a tool display name to a stable id segment. */
|
|
31
|
-
static normalizeToolName(toolName) {
|
|
32
|
-
return toolName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "tool";
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/workflow/definition/WorkflowExecutableNodeClassifier.ts
|
|
38
|
-
/**
|
|
39
|
-
* Derives which workflow nodes participate in the main execution graph vs connection-only children.
|
|
40
|
-
*/
|
|
41
|
-
var WorkflowExecutableNodeClassifier = class {
|
|
42
|
-
connectionOwnedIds;
|
|
43
|
-
constructor(workflow) {
|
|
44
|
-
this.connectionOwnedIds = this.collectConnectionOwnedIds(workflow);
|
|
45
|
-
}
|
|
46
|
-
isConnectionOwnedNodeId(nodeId) {
|
|
47
|
-
return this.connectionOwnedIds.has(nodeId);
|
|
48
|
-
}
|
|
49
|
-
isExecutableNodeId(nodeId) {
|
|
50
|
-
return !this.connectionOwnedIds.has(nodeId);
|
|
51
|
-
}
|
|
52
|
-
filterExecutableNodeDefinitions(nodes) {
|
|
53
|
-
return nodes.filter((n) => this.isExecutableNodeId(n.id));
|
|
54
|
-
}
|
|
55
|
-
collectConnectionOwnedIds(workflow) {
|
|
56
|
-
const ids = /* @__PURE__ */ new Set();
|
|
57
|
-
for (const connection of workflow.connections ?? []) for (const childId of connection.childNodeIds) ids.add(childId);
|
|
58
|
-
return ids;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Resolves the default start node: first trigger, else first executable node with no incoming edges from executable nodes.
|
|
62
|
-
*/
|
|
63
|
-
findDefaultExecutableStartNodeId(workflow) {
|
|
64
|
-
const firstTrigger = workflow.nodes.find((n) => n.kind === "trigger" && this.isExecutableNodeId(n.id))?.id;
|
|
65
|
-
if (firstTrigger) return firstTrigger;
|
|
66
|
-
const incoming = /* @__PURE__ */ new Map();
|
|
67
|
-
for (const n of workflow.nodes) if (this.isExecutableNodeId(n.id)) incoming.set(n.id, 0);
|
|
68
|
-
for (const e of workflow.edges) {
|
|
69
|
-
if (!this.isExecutableNodeId(e.from.nodeId) || !this.isExecutableNodeId(e.to.nodeId)) continue;
|
|
70
|
-
incoming.set(e.to.nodeId, (incoming.get(e.to.nodeId) ?? 0) + 1);
|
|
71
|
-
}
|
|
72
|
-
return workflow.nodes.find((n) => this.isExecutableNodeId(n.id) && (incoming.get(n.id) ?? 0) === 0)?.id ?? workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id ?? (() => {
|
|
73
|
-
throw new Error(`Workflow ${workflow.id} has no executable nodes`);
|
|
74
|
-
})();
|
|
75
|
-
}
|
|
76
|
-
firstExecutableNodeIdInDefinitionOrder(workflow) {
|
|
77
|
-
return workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id;
|
|
78
|
-
}
|
|
79
|
-
lastExecutableNodeIdInDefinitionOrder(workflow) {
|
|
80
|
-
for (let i = workflow.nodes.length - 1; i >= 0; i--) {
|
|
81
|
-
const n = workflow.nodes[i];
|
|
82
|
-
if (this.isExecutableNodeId(n.id)) return n.id;
|
|
83
|
-
}
|
|
84
|
-
throw new Error(`Workflow ${workflow.id} has no executable nodes`);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region src/workflow/definition/WorkflowExecutableNodeClassifierFactory.ts
|
|
90
|
-
var WorkflowExecutableNodeClassifierFactory = class {
|
|
91
|
-
static create(workflow) {
|
|
92
|
-
return new WorkflowExecutableNodeClassifier(workflow);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
6
|
//#region src/di/CoreTokens.ts
|
|
98
7
|
const CoreTokens = {
|
|
99
8
|
PersistedWorkflowTokenRegistry: Symbol.for("codemation.core.PersistedWorkflowTokenRegistry"),
|
|
@@ -118,26 +27,6 @@ const CoreTokens = {
|
|
|
118
27
|
WorkflowActivationPolicy: Symbol.for("codemation.core.WorkflowActivationPolicy")
|
|
119
28
|
};
|
|
120
29
|
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region src/events/NodeEventPublisher.ts
|
|
123
|
-
/** Publishes node lifecycle snapshots onto the run {@link RunEventBus}. */
|
|
124
|
-
var NodeEventPublisher = class {
|
|
125
|
-
constructor(eventBus) {
|
|
126
|
-
this.eventBus = eventBus;
|
|
127
|
-
}
|
|
128
|
-
async publish(kind, snapshot) {
|
|
129
|
-
if (!this.eventBus) return;
|
|
130
|
-
await this.eventBus.publish({
|
|
131
|
-
kind,
|
|
132
|
-
runId: snapshot.runId,
|
|
133
|
-
workflowId: snapshot.workflowId,
|
|
134
|
-
parent: snapshot.parent,
|
|
135
|
-
at: snapshot.updatedAt,
|
|
136
|
-
snapshot
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
|
|
141
30
|
//#endregion
|
|
142
31
|
//#region src/runtime-types/persistedRuntimeTypeModelRegistry.ts
|
|
143
32
|
/** Shared metadata key used to attach persisted runtime-type information to decorated classes. */
|
|
@@ -247,6 +136,117 @@ function chatModel(options = {}) {
|
|
|
247
136
|
return InjectableRuntimeDecoratorComposer.compose("chatModel", options, import.meta.url);
|
|
248
137
|
}
|
|
249
138
|
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/workflow/definition/ConnectionNodeIdFactory.ts
|
|
141
|
+
/**
|
|
142
|
+
* Deterministic ids for workflow connection-owned child nodes (LLM slot, tools, etc.).
|
|
143
|
+
* These are stable across loads.
|
|
144
|
+
*/
|
|
145
|
+
var ConnectionNodeIdFactory = class {
|
|
146
|
+
static connectionSegment = "__conn__";
|
|
147
|
+
static languageModelConnectionNodeId(parentNodeId) {
|
|
148
|
+
return `${parentNodeId}${this.connectionSegment}llm`;
|
|
149
|
+
}
|
|
150
|
+
static toolConnectionNodeId(parentNodeId, toolName) {
|
|
151
|
+
const normalized = this.normalizeToolName(toolName);
|
|
152
|
+
return `${parentNodeId}${this.connectionSegment}tool${this.connectionSegment}${normalized}`;
|
|
153
|
+
}
|
|
154
|
+
static isLanguageModelConnectionNodeId(nodeId) {
|
|
155
|
+
return nodeId.endsWith(`${this.connectionSegment}llm`);
|
|
156
|
+
}
|
|
157
|
+
static isToolConnectionNodeId(nodeId) {
|
|
158
|
+
return nodeId.includes(`${this.connectionSegment}tool${this.connectionSegment}`);
|
|
159
|
+
}
|
|
160
|
+
/** True when `nodeId` is a connection-owned child of `parentNodeId` (LLM or tool slot). */
|
|
161
|
+
static isConnectionOwnedDescendantOf(parentNodeId, nodeId) {
|
|
162
|
+
return nodeId.startsWith(`${parentNodeId}${this.connectionSegment}`);
|
|
163
|
+
}
|
|
164
|
+
/** Normalizes a tool display name to a stable id segment. */
|
|
165
|
+
static normalizeToolName(toolName) {
|
|
166
|
+
return toolName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "tool";
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/workflow/definition/WorkflowExecutableNodeClassifier.ts
|
|
172
|
+
/**
|
|
173
|
+
* Derives which workflow nodes participate in the main execution graph vs connection-only children.
|
|
174
|
+
*/
|
|
175
|
+
var WorkflowExecutableNodeClassifier = class {
|
|
176
|
+
connectionOwnedIds;
|
|
177
|
+
constructor(workflow) {
|
|
178
|
+
this.connectionOwnedIds = this.collectConnectionOwnedIds(workflow);
|
|
179
|
+
}
|
|
180
|
+
isConnectionOwnedNodeId(nodeId) {
|
|
181
|
+
return this.connectionOwnedIds.has(nodeId);
|
|
182
|
+
}
|
|
183
|
+
isExecutableNodeId(nodeId) {
|
|
184
|
+
return !this.connectionOwnedIds.has(nodeId);
|
|
185
|
+
}
|
|
186
|
+
filterExecutableNodeDefinitions(nodes) {
|
|
187
|
+
return nodes.filter((n) => this.isExecutableNodeId(n.id));
|
|
188
|
+
}
|
|
189
|
+
collectConnectionOwnedIds(workflow) {
|
|
190
|
+
const ids = /* @__PURE__ */ new Set();
|
|
191
|
+
for (const connection of workflow.connections ?? []) for (const childId of connection.childNodeIds) ids.add(childId);
|
|
192
|
+
return ids;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Resolves the default start node: first trigger, else first executable node with no incoming edges from executable nodes.
|
|
196
|
+
*/
|
|
197
|
+
findDefaultExecutableStartNodeId(workflow) {
|
|
198
|
+
const firstTrigger = workflow.nodes.find((n) => n.kind === "trigger" && this.isExecutableNodeId(n.id))?.id;
|
|
199
|
+
if (firstTrigger) return firstTrigger;
|
|
200
|
+
const incoming = /* @__PURE__ */ new Map();
|
|
201
|
+
for (const n of workflow.nodes) if (this.isExecutableNodeId(n.id)) incoming.set(n.id, 0);
|
|
202
|
+
for (const e of workflow.edges) {
|
|
203
|
+
if (!this.isExecutableNodeId(e.from.nodeId) || !this.isExecutableNodeId(e.to.nodeId)) continue;
|
|
204
|
+
incoming.set(e.to.nodeId, (incoming.get(e.to.nodeId) ?? 0) + 1);
|
|
205
|
+
}
|
|
206
|
+
return workflow.nodes.find((n) => this.isExecutableNodeId(n.id) && (incoming.get(n.id) ?? 0) === 0)?.id ?? workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id ?? (() => {
|
|
207
|
+
throw new Error(`Workflow ${workflow.id} has no executable nodes`);
|
|
208
|
+
})();
|
|
209
|
+
}
|
|
210
|
+
firstExecutableNodeIdInDefinitionOrder(workflow) {
|
|
211
|
+
return workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id;
|
|
212
|
+
}
|
|
213
|
+
lastExecutableNodeIdInDefinitionOrder(workflow) {
|
|
214
|
+
for (let i = workflow.nodes.length - 1; i >= 0; i--) {
|
|
215
|
+
const n = workflow.nodes[i];
|
|
216
|
+
if (this.isExecutableNodeId(n.id)) return n.id;
|
|
217
|
+
}
|
|
218
|
+
throw new Error(`Workflow ${workflow.id} has no executable nodes`);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/workflow/definition/WorkflowExecutableNodeClassifierFactory.ts
|
|
224
|
+
var WorkflowExecutableNodeClassifierFactory = class {
|
|
225
|
+
static create(workflow) {
|
|
226
|
+
return new WorkflowExecutableNodeClassifier(workflow);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/events/NodeEventPublisher.ts
|
|
232
|
+
/** Publishes node lifecycle snapshots onto the run {@link RunEventBus}. */
|
|
233
|
+
var NodeEventPublisher = class {
|
|
234
|
+
constructor(eventBus) {
|
|
235
|
+
this.eventBus = eventBus;
|
|
236
|
+
}
|
|
237
|
+
async publish(kind, snapshot) {
|
|
238
|
+
if (!this.eventBus) return;
|
|
239
|
+
await this.eventBus.publish({
|
|
240
|
+
kind,
|
|
241
|
+
runId: snapshot.runId,
|
|
242
|
+
workflowId: snapshot.workflowId,
|
|
243
|
+
parent: snapshot.parent,
|
|
244
|
+
at: snapshot.updatedAt,
|
|
245
|
+
snapshot
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
250
|
//#endregion
|
|
251
251
|
//#region src/binaries/DefaultNodeBinaryAttachmentServiceFactory.ts
|
|
252
252
|
var DefaultNodeBinaryAttachmentService = class DefaultNodeBinaryAttachmentService {
|
|
@@ -2236,7 +2236,10 @@ var CurrentStateFrontierPlanner = class CurrentStateFrontierPlanner {
|
|
|
2236
2236
|
isEdgeSatisfied(currentState, nodeId, input) {
|
|
2237
2237
|
const incomingEdge = (this.topology.incomingByNode.get(nodeId) ?? []).find((edge) => edge.input === input);
|
|
2238
2238
|
if (!incomingEdge) return false;
|
|
2239
|
-
|
|
2239
|
+
if (!this.hasOutputPort(currentState, incomingEdge.from.nodeId, incomingEdge.from.output)) return false;
|
|
2240
|
+
if (this.usesCollect(nodeId)) return true;
|
|
2241
|
+
if (this.resolveOutputItems(currentState, incomingEdge.from.nodeId, incomingEdge.from.output).length > 0) return true;
|
|
2242
|
+
return this.shouldContinueAfterEmptyOutputFromSource(incomingEdge.from.nodeId);
|
|
2240
2243
|
}
|
|
2241
2244
|
resolveInput(currentState, nodeId, input) {
|
|
2242
2245
|
const incomingEdge = (this.topology.incomingByNode.get(nodeId) ?? []).find((edge) => edge.input === input);
|
|
@@ -2258,6 +2261,15 @@ var CurrentStateFrontierPlanner = class CurrentStateFrontierPlanner {
|
|
|
2258
2261
|
resolveOutputItems(currentState, nodeId, output) {
|
|
2259
2262
|
return currentState.outputsByNode[nodeId]?.[output] ?? [];
|
|
2260
2263
|
}
|
|
2264
|
+
usesCollect(nodeId) {
|
|
2265
|
+
const expectedInputs = this.topology.expectedInputsByNode.get(nodeId) ?? [];
|
|
2266
|
+
return expectedInputs.length !== 1 || expectedInputs[0] !== "in";
|
|
2267
|
+
}
|
|
2268
|
+
shouldContinueAfterEmptyOutputFromSource(nodeId) {
|
|
2269
|
+
const definition = this.topology.defsById.get(nodeId);
|
|
2270
|
+
if (!definition) return false;
|
|
2271
|
+
return definition.config.continueWhenEmptyOutput === true;
|
|
2272
|
+
}
|
|
2261
2273
|
getPinnedOutputs(currentState, nodeId) {
|
|
2262
2274
|
return currentState.mutableState?.nodesById?.[nodeId]?.pinnedOutputsByPort;
|
|
2263
2275
|
}
|
|
@@ -3052,13 +3064,14 @@ var RunIntentService = class {
|
|
|
3052
3064
|
this.workflowRepository = workflowRepository;
|
|
3053
3065
|
}
|
|
3054
3066
|
async startWorkflow(args) {
|
|
3055
|
-
|
|
3067
|
+
const items = await this.resolveStartWorkflowItems(args);
|
|
3068
|
+
if (args.startAt && !args.currentState && !args.stopCondition && !args.reset) return await this.engine.runWorkflow(args.workflow, args.startAt, items, args.parent, args.executionOptions, {
|
|
3056
3069
|
workflowSnapshot: args.workflowSnapshot,
|
|
3057
3070
|
mutableState: args.mutableState
|
|
3058
3071
|
});
|
|
3059
3072
|
return await this.engine.runWorkflowFromState({
|
|
3060
3073
|
workflow: args.workflow,
|
|
3061
|
-
items
|
|
3074
|
+
items,
|
|
3062
3075
|
parent: args.parent,
|
|
3063
3076
|
executionOptions: args.executionOptions,
|
|
3064
3077
|
workflowSnapshot: args.workflowSnapshot,
|
|
@@ -3069,7 +3082,8 @@ var RunIntentService = class {
|
|
|
3069
3082
|
});
|
|
3070
3083
|
}
|
|
3071
3084
|
async rerunFromNode(args) {
|
|
3072
|
-
|
|
3085
|
+
const items = await this.resolveRerunItems(args);
|
|
3086
|
+
if (items) return await this.engine.runWorkflow(args.workflow, args.nodeId, items, args.parent, args.executionOptions, {
|
|
3073
3087
|
workflowSnapshot: args.workflowSnapshot,
|
|
3074
3088
|
mutableState: args.mutableState
|
|
3075
3089
|
});
|
|
@@ -3084,6 +3098,44 @@ var RunIntentService = class {
|
|
|
3084
3098
|
reset: { clearFromNodeId: args.nodeId }
|
|
3085
3099
|
});
|
|
3086
3100
|
}
|
|
3101
|
+
async resolveStartWorkflowItems(args) {
|
|
3102
|
+
if (this.hasNonEmptyItems(args.items)) return args.items;
|
|
3103
|
+
const triggerNodeId = this.resolveStartWorkflowTriggerNodeId(args);
|
|
3104
|
+
if (!triggerNodeId) return args.items;
|
|
3105
|
+
return await this.engine.createTriggerTestItems({
|
|
3106
|
+
workflow: args.workflow,
|
|
3107
|
+
nodeId: triggerNodeId
|
|
3108
|
+
}) ?? args.items;
|
|
3109
|
+
}
|
|
3110
|
+
async resolveRerunItems(args) {
|
|
3111
|
+
if (this.hasNonEmptyItems(args.items)) return args.items;
|
|
3112
|
+
const triggerNodeId = this.resolveRerunTriggerNodeId(args);
|
|
3113
|
+
if (!triggerNodeId) return args.items;
|
|
3114
|
+
return await this.engine.createTriggerTestItems({
|
|
3115
|
+
workflow: args.workflow,
|
|
3116
|
+
nodeId: triggerNodeId
|
|
3117
|
+
}) ?? args.items;
|
|
3118
|
+
}
|
|
3119
|
+
resolveStartWorkflowTriggerNodeId(args) {
|
|
3120
|
+
if (args.stopCondition?.kind === "nodeCompleted" && this.isTriggerNode(args.workflow, args.stopCondition.nodeId)) return args.stopCondition.nodeId;
|
|
3121
|
+
if (!args.synthesizeTriggerItems) return;
|
|
3122
|
+
if (args.startAt && this.isTriggerNode(args.workflow, args.startAt)) return args.startAt;
|
|
3123
|
+
return this.firstTriggerNodeId(args.workflow);
|
|
3124
|
+
}
|
|
3125
|
+
resolveRerunTriggerNodeId(args) {
|
|
3126
|
+
if (this.isTriggerNode(args.workflow, args.nodeId)) return args.nodeId;
|
|
3127
|
+
if (!args.synthesizeTriggerItems) return;
|
|
3128
|
+
return this.firstTriggerNodeId(args.workflow);
|
|
3129
|
+
}
|
|
3130
|
+
firstTriggerNodeId(workflow) {
|
|
3131
|
+
return workflow.nodes.find((node$1) => node$1.kind === "trigger")?.id;
|
|
3132
|
+
}
|
|
3133
|
+
isTriggerNode(workflow, nodeId) {
|
|
3134
|
+
return workflow.nodes.find((node$1) => node$1.id === nodeId)?.kind === "trigger";
|
|
3135
|
+
}
|
|
3136
|
+
hasNonEmptyItems(items) {
|
|
3137
|
+
return (items?.length ?? 0) > 0;
|
|
3138
|
+
}
|
|
3087
3139
|
resolveWebhookTrigger(args) {
|
|
3088
3140
|
return this.engine.resolveWebhookTrigger(args);
|
|
3089
3141
|
}
|
|
@@ -3132,5 +3184,5 @@ var RunIntentService = class {
|
|
|
3132
3184
|
};
|
|
3133
3185
|
|
|
3134
3186
|
//#endregion
|
|
3135
|
-
export {
|
|
3136
|
-
//# sourceMappingURL=RunIntentService-
|
|
3187
|
+
export { injectAll as $, InProcessRetryRunnerFactory as A, WorkflowExecutableNodeClassifier as B, PersistedWorkflowTokenRegistry as C, NodeExecutorFactory as D, MissingRuntimeExecutionMarker as E, ActivationEnqueueService as F, tool as G, chatModel as H, DefaultExecutionBinaryService as I, StackTraceCallSitePathResolver as J, InjectableRuntimeDecoratorComposer as K, UnavailableBinaryStorage as L, DefaultExecutionContextFactory as M, DefaultAsyncSleeper as N, NodeExecutor as O, CredentialResolverFactory as P, inject as Q, NodeEventPublisher as R, WorkflowSnapshotResolver as S, MissingRuntimeTriggerToken as T, getPersistedRuntimeTypeMetadata as U, ConnectionNodeIdFactory as V, node as W, container as X, PersistedRuntimeTypeNameResolver as Y, delay as Z, RunStateSemantics as _, ENGINE_EXECUTION_LIMITS_DEFAULTS as a, singleton as at, NodeInstanceFactoryFactory as b, InlineDrivingScheduler as c, ConfigDrivenOffloadPolicy as d, injectable as et, RunStartService as f, WorkflowRunExecutionContextFactory as g, WorkflowTopology as h, InMemoryBinaryStorage as i, registry as it, InProcessRetryRunner as j, NodeActivationRequestComposer as k, HintOnlyOffloadPolicy as l, RunContinuationService as m, RunFinishedAtFactory as n, instancePerContainerCachingFactory as nt, EngineExecutionLimitsPolicy as o, CoreTokens as ot, RunPolicySnapshotFactory as p, PersistedRuntimeTypeMetadataStore as q, InMemoryRunDataFactory as r, predicateAwareClassFactory as rt, LocalOnlyScheduler as s, RunIntentService as t, instanceCachingFactory as tt, DefaultDrivingScheduler as u, PersistedRunStateTerminalBuilder as v, MissingRuntimeFallbacks as w, NodeInstanceFactory as x, NodeRunStateWriterFactory as y, WorkflowExecutableNodeClassifierFactory as z };
|
|
3188
|
+
//# sourceMappingURL=RunIntentService-C1nu_YwM.js.map
|