@codemation/core 0.0.18 → 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 +8 -0
- package/dist/{RunIntentService-BB4nqX3-.js → RunIntentService-C1nu_YwM.js} +57 -5
- package/dist/RunIntentService-C1nu_YwM.js.map +1 -0
- package/dist/{RunIntentService-ByuUYsAL.d.cts → RunIntentService-DjbxzBBP.d.cts} +10 -1
- package/dist/{RunIntentService-nRx-m0Xs.cjs → RunIntentService-ZkjpY7MS.cjs} +57 -5
- 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-B4_ZRTyI.d.ts → index-BIewO9-9.d.ts} +10 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/planning/CurrentStateFrontierPlanner.ts +24 -1
- package/src/runtime/RunIntentService.ts +68 -14
- package/dist/RunIntentService-BB4nqX3-.js.map +0 -1
- package/dist/RunIntentService-nRx-m0Xs.cjs.map +0 -1
|
@@ -229,6 +229,7 @@ type StartWorkflowIntent = {
|
|
|
229
229
|
workflow: WorkflowDefinition;
|
|
230
230
|
startAt?: string;
|
|
231
231
|
items: Items;
|
|
232
|
+
synthesizeTriggerItems?: boolean;
|
|
232
233
|
parent?: CurrentStateExecutionRequest["parent"];
|
|
233
234
|
executionOptions?: RunExecutionOptions;
|
|
234
235
|
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
@@ -242,6 +243,7 @@ type RerunFromNodeIntent = {
|
|
|
242
243
|
nodeId: NodeId;
|
|
243
244
|
currentState: RunCurrentState;
|
|
244
245
|
items?: Items;
|
|
246
|
+
synthesizeTriggerItems?: boolean;
|
|
245
247
|
parent?: CurrentStateExecutionRequest["parent"];
|
|
246
248
|
executionOptions?: RunExecutionOptions;
|
|
247
249
|
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
@@ -262,6 +264,13 @@ declare class RunIntentService {
|
|
|
262
264
|
constructor(engine: Engine, workflowRepository: WorkflowRepository);
|
|
263
265
|
startWorkflow(args: StartWorkflowIntent): Promise<RunResult>;
|
|
264
266
|
rerunFromNode(args: RerunFromNodeIntent): Promise<RunResult>;
|
|
267
|
+
private resolveStartWorkflowItems;
|
|
268
|
+
private resolveRerunItems;
|
|
269
|
+
private resolveStartWorkflowTriggerNodeId;
|
|
270
|
+
private resolveRerunTriggerNodeId;
|
|
271
|
+
private firstTriggerNodeId;
|
|
272
|
+
private isTriggerNode;
|
|
273
|
+
private hasNonEmptyItems;
|
|
265
274
|
resolveWebhookTrigger(args: {
|
|
266
275
|
endpointPath: string;
|
|
267
276
|
method: HttpMethod;
|
|
@@ -276,4 +285,4 @@ declare class RunIntentService {
|
|
|
276
285
|
}
|
|
277
286
|
//#endregion
|
|
278
287
|
export { UnavailableBinaryStorage as a, DefaultAsyncSleeper as c, Engine as d, DefaultExecutionBinaryService as i, AsyncSleeper as l, InMemoryRunDataFactory as n, InProcessRetryRunner as o, InMemoryBinaryStorage as r, DefaultExecutionContextFactory as s, RunIntentService as t, CredentialResolverFactory as u };
|
|
279
|
-
//# sourceMappingURL=RunIntentService-
|
|
288
|
+
//# sourceMappingURL=RunIntentService-DjbxzBBP.d.cts.map
|
|
@@ -2262,7 +2262,10 @@ var CurrentStateFrontierPlanner = class CurrentStateFrontierPlanner {
|
|
|
2262
2262
|
isEdgeSatisfied(currentState, nodeId, input) {
|
|
2263
2263
|
const incomingEdge = (this.topology.incomingByNode.get(nodeId) ?? []).find((edge) => edge.input === input);
|
|
2264
2264
|
if (!incomingEdge) return false;
|
|
2265
|
-
|
|
2265
|
+
if (!this.hasOutputPort(currentState, incomingEdge.from.nodeId, incomingEdge.from.output)) return false;
|
|
2266
|
+
if (this.usesCollect(nodeId)) return true;
|
|
2267
|
+
if (this.resolveOutputItems(currentState, incomingEdge.from.nodeId, incomingEdge.from.output).length > 0) return true;
|
|
2268
|
+
return this.shouldContinueAfterEmptyOutputFromSource(incomingEdge.from.nodeId);
|
|
2266
2269
|
}
|
|
2267
2270
|
resolveInput(currentState, nodeId, input) {
|
|
2268
2271
|
const incomingEdge = (this.topology.incomingByNode.get(nodeId) ?? []).find((edge) => edge.input === input);
|
|
@@ -2284,6 +2287,15 @@ var CurrentStateFrontierPlanner = class CurrentStateFrontierPlanner {
|
|
|
2284
2287
|
resolveOutputItems(currentState, nodeId, output) {
|
|
2285
2288
|
return currentState.outputsByNode[nodeId]?.[output] ?? [];
|
|
2286
2289
|
}
|
|
2290
|
+
usesCollect(nodeId) {
|
|
2291
|
+
const expectedInputs = this.topology.expectedInputsByNode.get(nodeId) ?? [];
|
|
2292
|
+
return expectedInputs.length !== 1 || expectedInputs[0] !== "in";
|
|
2293
|
+
}
|
|
2294
|
+
shouldContinueAfterEmptyOutputFromSource(nodeId) {
|
|
2295
|
+
const definition = this.topology.defsById.get(nodeId);
|
|
2296
|
+
if (!definition) return false;
|
|
2297
|
+
return definition.config.continueWhenEmptyOutput === true;
|
|
2298
|
+
}
|
|
2287
2299
|
getPinnedOutputs(currentState, nodeId) {
|
|
2288
2300
|
return currentState.mutableState?.nodesById?.[nodeId]?.pinnedOutputsByPort;
|
|
2289
2301
|
}
|
|
@@ -3078,13 +3090,14 @@ var RunIntentService = class {
|
|
|
3078
3090
|
this.workflowRepository = workflowRepository;
|
|
3079
3091
|
}
|
|
3080
3092
|
async startWorkflow(args) {
|
|
3081
|
-
|
|
3093
|
+
const items = await this.resolveStartWorkflowItems(args);
|
|
3094
|
+
if (args.startAt && !args.currentState && !args.stopCondition && !args.reset) return await this.engine.runWorkflow(args.workflow, args.startAt, items, args.parent, args.executionOptions, {
|
|
3082
3095
|
workflowSnapshot: args.workflowSnapshot,
|
|
3083
3096
|
mutableState: args.mutableState
|
|
3084
3097
|
});
|
|
3085
3098
|
return await this.engine.runWorkflowFromState({
|
|
3086
3099
|
workflow: args.workflow,
|
|
3087
|
-
items
|
|
3100
|
+
items,
|
|
3088
3101
|
parent: args.parent,
|
|
3089
3102
|
executionOptions: args.executionOptions,
|
|
3090
3103
|
workflowSnapshot: args.workflowSnapshot,
|
|
@@ -3095,7 +3108,8 @@ var RunIntentService = class {
|
|
|
3095
3108
|
});
|
|
3096
3109
|
}
|
|
3097
3110
|
async rerunFromNode(args) {
|
|
3098
|
-
|
|
3111
|
+
const items = await this.resolveRerunItems(args);
|
|
3112
|
+
if (items) return await this.engine.runWorkflow(args.workflow, args.nodeId, items, args.parent, args.executionOptions, {
|
|
3099
3113
|
workflowSnapshot: args.workflowSnapshot,
|
|
3100
3114
|
mutableState: args.mutableState
|
|
3101
3115
|
});
|
|
@@ -3110,6 +3124,44 @@ var RunIntentService = class {
|
|
|
3110
3124
|
reset: { clearFromNodeId: args.nodeId }
|
|
3111
3125
|
});
|
|
3112
3126
|
}
|
|
3127
|
+
async resolveStartWorkflowItems(args) {
|
|
3128
|
+
if (this.hasNonEmptyItems(args.items)) return args.items;
|
|
3129
|
+
const triggerNodeId = this.resolveStartWorkflowTriggerNodeId(args);
|
|
3130
|
+
if (!triggerNodeId) return args.items;
|
|
3131
|
+
return await this.engine.createTriggerTestItems({
|
|
3132
|
+
workflow: args.workflow,
|
|
3133
|
+
nodeId: triggerNodeId
|
|
3134
|
+
}) ?? args.items;
|
|
3135
|
+
}
|
|
3136
|
+
async resolveRerunItems(args) {
|
|
3137
|
+
if (this.hasNonEmptyItems(args.items)) return args.items;
|
|
3138
|
+
const triggerNodeId = this.resolveRerunTriggerNodeId(args);
|
|
3139
|
+
if (!triggerNodeId) return args.items;
|
|
3140
|
+
return await this.engine.createTriggerTestItems({
|
|
3141
|
+
workflow: args.workflow,
|
|
3142
|
+
nodeId: triggerNodeId
|
|
3143
|
+
}) ?? args.items;
|
|
3144
|
+
}
|
|
3145
|
+
resolveStartWorkflowTriggerNodeId(args) {
|
|
3146
|
+
if (args.stopCondition?.kind === "nodeCompleted" && this.isTriggerNode(args.workflow, args.stopCondition.nodeId)) return args.stopCondition.nodeId;
|
|
3147
|
+
if (!args.synthesizeTriggerItems) return;
|
|
3148
|
+
if (args.startAt && this.isTriggerNode(args.workflow, args.startAt)) return args.startAt;
|
|
3149
|
+
return this.firstTriggerNodeId(args.workflow);
|
|
3150
|
+
}
|
|
3151
|
+
resolveRerunTriggerNodeId(args) {
|
|
3152
|
+
if (this.isTriggerNode(args.workflow, args.nodeId)) return args.nodeId;
|
|
3153
|
+
if (!args.synthesizeTriggerItems) return;
|
|
3154
|
+
return this.firstTriggerNodeId(args.workflow);
|
|
3155
|
+
}
|
|
3156
|
+
firstTriggerNodeId(workflow) {
|
|
3157
|
+
return workflow.nodes.find((node$1) => node$1.kind === "trigger")?.id;
|
|
3158
|
+
}
|
|
3159
|
+
isTriggerNode(workflow, nodeId) {
|
|
3160
|
+
return workflow.nodes.find((node$1) => node$1.id === nodeId)?.kind === "trigger";
|
|
3161
|
+
}
|
|
3162
|
+
hasNonEmptyItems(items) {
|
|
3163
|
+
return (items?.length ?? 0) > 0;
|
|
3164
|
+
}
|
|
3113
3165
|
resolveWebhookTrigger(args) {
|
|
3114
3166
|
return this.engine.resolveWebhookTrigger(args);
|
|
3115
3167
|
}
|
|
@@ -3464,4 +3516,4 @@ Object.defineProperty(exports, 'tool', {
|
|
|
3464
3516
|
return tool;
|
|
3465
3517
|
}
|
|
3466
3518
|
});
|
|
3467
|
-
//# sourceMappingURL=RunIntentService-
|
|
3519
|
+
//# sourceMappingURL=RunIntentService-ZkjpY7MS.cjs.map
|