@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.
@@ -1,5 +1,5 @@
1
1
  import { A as ExecutionMode, An as WebhookTriggerRoutingDiagnostics, Ct as WorkflowPolicyRuntimeDefaults, Dn as WebhookInvocationMatch, K as NodeErrorHandlerSpec, Ln as EngineRunCounters, Mn as WorkflowActivationPolicy, Mr as EngineExecutionLimitsPolicy, Nr as EngineExecutionLimitsPolicyConfig, On as WebhookTriggerMatcher, P as Items, Q as NodeSchedulerDecision, Qt as NodeActivationRequest, Tt as WorkflowStoragePolicyDecisionArgs, U as NodeDefinition, V as NodeConfigBase, Vt as EngineDeps, W as NodeErrorHandler, X as NodeOutputs, Xt as NodeActivationContinuation, Y as NodeOffloadPolicy, Yn as PersistedWorkflowSnapshotNode, Zt as NodeActivationReceipt, _t as WorkflowErrorHandler, an as NodeExecutionScheduler, cn as NodeResolver, cr as RunSummary, dr as WorkflowExecutionPruneRepository, en as NodeActivationScheduler, fr as WorkflowExecutionRepository, ht as WorkflowDefinition, ir as RunResult, jr as ENGINE_EXECUTION_LIMITS_DEFAULTS, mr as DependencyContainer, nr as RunPruneCandidate, nt as PersistedRunPolicySnapshot, ot as RunId, pn as TriggerRuntimeDiagnostics, q as NodeId, qn as PersistedRunState, rn as NodeExecutionRequest, rt as PersistedTokenId, t as InMemoryLiveWorkflowRepository, tt as ParentExecutionRef, ur as WorkflowExecutionListingRepository, vn as WorkflowNodeInstanceFactory, vt as WorkflowErrorHandlerSpec, wn as HttpMethod, xt as WorkflowId, yn as WorkflowRepository, yr as TypeToken } from "../InMemoryLiveWorkflowRepository-orY1VsWG.cjs";
2
- import { a as UnavailableBinaryStorage, c as DefaultAsyncSleeper, d as Engine, i as DefaultExecutionBinaryService, l as AsyncSleeper, n as InMemoryRunDataFactory, o as InProcessRetryRunner, r as InMemoryBinaryStorage, s as DefaultExecutionContextFactory, t as RunIntentService, u as CredentialResolverFactory } from "../RunIntentService-ByuUYsAL.cjs";
2
+ import { a as UnavailableBinaryStorage, c as DefaultAsyncSleeper, d as Engine, i as DefaultExecutionBinaryService, l as AsyncSleeper, n as InMemoryRunDataFactory, o as InProcessRetryRunner, r as InMemoryBinaryStorage, s as DefaultExecutionContextFactory, t as RunIntentService, u as CredentialResolverFactory } from "../RunIntentService-DjbxzBBP.cjs";
3
3
  import { t as WorkflowSnapshotCodec } from "../WorkflowSnapshotCodec-DSEzKyt3.cjs";
4
4
 
5
5
  //#region src/workflowSnapshots/MissingRuntimeFallbacksFactory.d.ts
@@ -1,5 +1,5 @@
1
1
  import { Jn as WebhookTriggerRoutingDiagnostics, Kn as WebhookTriggerMatcher, Lr as TypeToken, Mr as DependencyContainer, Nt as WorkflowDefinition, Xr as EngineExecutionLimitsPolicy, Yr as ENGINE_EXECUTION_LIMITS_DEFAULTS, Zr as EngineExecutionLimitsPolicyConfig, jn as TriggerRuntimeDiagnostics, t as InMemoryLiveWorkflowRepository, xt as PersistedTokenId } from "../InMemoryLiveWorkflowRepository-DxoualoC.js";
2
- import { At as InProcessRetryRunner, It as EngineCompositionDeps, Lt as EngineFactory, Mt as DefaultAsyncSleeper, Nt as AsyncSleeper, Ot as NodeInstanceFactory, Pt as CredentialResolverFactory, Rt as Engine, _ as EngineExecutionLimitsPolicyFactory, a as ConfigDrivenOffloadPolicy, c as EngineWorkflowRunnerService, d as InMemoryRunDataFactory, f as InMemoryBinaryStorage, g as RunPolicySnapshotFactory, h as WorkflowStoragePolicyEvaluator, i as InlineDrivingScheduler, jt as DefaultExecutionContextFactory, kt as NodeExecutor, l as RunSummaryMapper, m as RunTerminalPersistenceCoordinator, n as HintOnlyOffloadPolicy, o as WorkflowRepositoryWebhookTriggerMatcher, p as WorkflowPolicyErrorServices, r as DefaultDrivingScheduler, s as RunIntentService, t as LocalOnlyScheduler, u as InMemoryWorkflowExecutionRepository, v as DefaultExecutionBinaryService, y as UnavailableBinaryStorage } from "../index-B4_ZRTyI.js";
2
+ import { At as InProcessRetryRunner, It as EngineCompositionDeps, Lt as EngineFactory, Mt as DefaultAsyncSleeper, Nt as AsyncSleeper, Ot as NodeInstanceFactory, Pt as CredentialResolverFactory, Rt as Engine, _ as EngineExecutionLimitsPolicyFactory, a as ConfigDrivenOffloadPolicy, c as EngineWorkflowRunnerService, d as InMemoryRunDataFactory, f as InMemoryBinaryStorage, g as RunPolicySnapshotFactory, h as WorkflowStoragePolicyEvaluator, i as InlineDrivingScheduler, jt as DefaultExecutionContextFactory, kt as NodeExecutor, l as RunSummaryMapper, m as RunTerminalPersistenceCoordinator, n as HintOnlyOffloadPolicy, o as WorkflowRepositoryWebhookTriggerMatcher, p as WorkflowPolicyErrorServices, r as DefaultDrivingScheduler, s as RunIntentService, t as LocalOnlyScheduler, u as InMemoryWorkflowExecutionRepository, v as DefaultExecutionBinaryService, y as UnavailableBinaryStorage } from "../index-BIewO9-9.js";
3
3
 
4
4
  //#region src/bootstrap/runtime/EngineRuntimeRegistration.types.d.ts
5
5
 
@@ -1,4 +1,4 @@
1
- import { A as InProcessRetryRunnerFactory, C as PersistedWorkflowTokenRegistry, D as NodeExecutorFactory, E as MissingRuntimeExecutionMarker, F as ActivationEnqueueService, I as DefaultExecutionBinaryService, L as UnavailableBinaryStorage, M as DefaultExecutionContextFactory, N as DefaultAsyncSleeper, O as NodeExecutor, P as CredentialResolverFactory, R as NodeEventPublisher, S as WorkflowSnapshotResolver, T as MissingRuntimeTriggerToken, _ as RunStateSemantics, a as ENGINE_EXECUTION_LIMITS_DEFAULTS, b as NodeInstanceFactoryFactory, c as InlineDrivingScheduler, d as ConfigDrivenOffloadPolicy, f as RunStartService, g as WorkflowRunExecutionContextFactory, h as WorkflowTopology, i as InMemoryBinaryStorage, j as InProcessRetryRunner, k as NodeActivationRequestComposer, l as HintOnlyOffloadPolicy, m as RunContinuationService, n as RunFinishedAtFactory, o as EngineExecutionLimitsPolicy, ot as CoreTokens, p as RunPolicySnapshotFactory, r as InMemoryRunDataFactory, s as LocalOnlyScheduler, t as RunIntentService, tt as instanceCachingFactory, u as DefaultDrivingScheduler, v as PersistedRunStateTerminalBuilder, w as MissingRuntimeFallbacks, x as NodeInstanceFactory, y as NodeRunStateWriterFactory, z as WorkflowExecutableNodeClassifierFactory } from "../RunIntentService-BB4nqX3-.js";
1
+ import { A as InProcessRetryRunnerFactory, C as PersistedWorkflowTokenRegistry, D as NodeExecutorFactory, E as MissingRuntimeExecutionMarker, F as ActivationEnqueueService, I as DefaultExecutionBinaryService, L as UnavailableBinaryStorage, M as DefaultExecutionContextFactory, N as DefaultAsyncSleeper, O as NodeExecutor, P as CredentialResolverFactory, R as NodeEventPublisher, S as WorkflowSnapshotResolver, T as MissingRuntimeTriggerToken, _ as RunStateSemantics, a as ENGINE_EXECUTION_LIMITS_DEFAULTS, b as NodeInstanceFactoryFactory, c as InlineDrivingScheduler, d as ConfigDrivenOffloadPolicy, f as RunStartService, g as WorkflowRunExecutionContextFactory, h as WorkflowTopology, i as InMemoryBinaryStorage, j as InProcessRetryRunner, k as NodeActivationRequestComposer, l as HintOnlyOffloadPolicy, m as RunContinuationService, n as RunFinishedAtFactory, o as EngineExecutionLimitsPolicy, ot as CoreTokens, p as RunPolicySnapshotFactory, r as InMemoryRunDataFactory, s as LocalOnlyScheduler, t as RunIntentService, tt as instanceCachingFactory, u as DefaultDrivingScheduler, v as PersistedRunStateTerminalBuilder, w as MissingRuntimeFallbacks, x as NodeInstanceFactory, y as NodeRunStateWriterFactory, z as WorkflowExecutableNodeClassifierFactory } from "../RunIntentService-C1nu_YwM.js";
2
2
  import { n as WorkflowSnapshotCodec, t as InMemoryLiveWorkflowRepository } from "../InMemoryLiveWorkflowRepository-BoLNnVLg.js";
3
3
 
4
4
  //#region src/policies/executionLimits/EngineExecutionLimitsPolicyFactory.ts
@@ -728,6 +728,7 @@ type StartWorkflowIntent = {
728
728
  workflow: WorkflowDefinition;
729
729
  startAt?: string;
730
730
  items: Items;
731
+ synthesizeTriggerItems?: boolean;
731
732
  parent?: CurrentStateExecutionRequest["parent"];
732
733
  executionOptions?: RunExecutionOptions;
733
734
  workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
@@ -741,6 +742,7 @@ type RerunFromNodeIntent = {
741
742
  nodeId: NodeId;
742
743
  currentState: RunCurrentState;
743
744
  items?: Items;
745
+ synthesizeTriggerItems?: boolean;
744
746
  parent?: CurrentStateExecutionRequest["parent"];
745
747
  executionOptions?: RunExecutionOptions;
746
748
  workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
@@ -761,6 +763,13 @@ declare class RunIntentService {
761
763
  constructor(engine: Engine, workflowRepository: WorkflowRepository);
762
764
  startWorkflow(args: StartWorkflowIntent): Promise<RunResult>;
763
765
  rerunFromNode(args: RerunFromNodeIntent): Promise<RunResult>;
766
+ private resolveStartWorkflowItems;
767
+ private resolveRerunItems;
768
+ private resolveStartWorkflowTriggerNodeId;
769
+ private resolveRerunTriggerNodeId;
770
+ private firstTriggerNodeId;
771
+ private isTriggerNode;
772
+ private hasNonEmptyItems;
764
773
  resolveWebhookTrigger(args: {
765
774
  endpointPath: string;
766
775
  method: HttpMethod;
@@ -869,4 +878,4 @@ declare class LocalOnlyScheduler implements NodeExecutionScheduler {
869
878
  }
870
879
  //#endregion
871
880
  export { AgentTurnLimitBehavior as $, PersistedRuntimeTypeKind as A, InProcessRetryRunner as At, AgentMessageDto as B, node as C, DefinedNodeCredentialBindings as Ct, PersistedRuntimeTypeMetadataStore as D, SystemClock as Dt, PersistedRuntimeTypeNameResolver as E, Clock as Et, AgentCanvasPresentation as F, NodeEventPublisher as Ft, AgentModelInvocationOptions as G, AgentMessageRole as H, AgentGuardrailConfig as I, EngineCompositionDeps as It, AgentToolCall as J, AgentNodeConfig as K, AgentGuardrailDefaults as L, EngineFactory as Lt, EventPublishingWorkflowExecutionRepository as M, DefaultAsyncSleeper as Mt, InMemoryRunEventBus as N, AsyncSleeper as Nt, InjectableRuntimeDecoratorComposer as O, NodeInstanceFactory as Ot, AgentAttachmentRole as P, CredentialResolverFactory as Pt, AgentToolToken as Q, AgentMessageBuildArgs as R, Engine as Rt, getPersistedRuntimeTypeMetadata as S, DefinedNodeCredentialBinding as St, StackTraceCallSitePathResolver as T, defineNode as Tt, AgentMessageTemplate as U, AgentMessageLine as V, AgentMessageTemplateContent as W, AgentToolDefinition as X, AgentToolCallPlanner as Y, AgentToolExecuteArgs as Z, EngineExecutionLimitsPolicyFactory as _, defineCredential as _t, ConfigDrivenOffloadPolicy as a, NodeBackedToolInputMapperArgs as at, ItemsInputNormalizer as b, DefinedNode as bt, EngineWorkflowRunnerService as c, Tool as ct, InMemoryRunDataFactory as d, ZodSchemaAny as dt, ChatModelConfig as et, InMemoryBinaryStorage as f, AgentConfigInspector as ft, RunPolicySnapshotFactory as g, DefineCredentialOptions as gt, WorkflowStoragePolicyEvaluator as h, NodeBackedToolConfig as ht, InlineDrivingScheduler as i, NodeBackedToolInputMapper as it, PersistedRuntimeTypeMetadata as j, DefaultExecutionContextFactory as jt, PersistedRuntimeTypeDecoratorOptions as k, NodeExecutor as kt, RunSummaryMapper as l, ToolConfig as lt, RunTerminalPersistenceCoordinator as m, AgentToolFactory as mt, HintOnlyOffloadPolicy as n, LangChainChatModelLike as nt, WorkflowRepositoryWebhookTriggerMatcher as o, NodeBackedToolOutputMapper as ot, WorkflowPolicyErrorServices as p, AgentMessageConfigNormalizer as pt, AgentTool as q, DefaultDrivingScheduler as r, NodeBackedToolConfigOptions as rt, RunIntentService as s, NodeBackedToolOutputMapperArgs as st, LocalOnlyScheduler as t, ChatModelFactory as tt, InMemoryWorkflowExecutionRepository as u, ToolExecuteArgs as ut, DefaultExecutionBinaryService as v, DefinedNodeRegistry as vt, tool as w, DefinedNodeRunContext as wt, chatModel as x, DefinedNodeCredentialAccessors as xt, UnavailableBinaryStorage as y, DefineNodeOptions as yt, AgentMessageConfig as z };
872
- //# sourceMappingURL=index-B4_ZRTyI.d.ts.map
881
+ //# sourceMappingURL=index-BIewO9-9.d.ts.map
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_RunIntentService = require('./RunIntentService-nRx-m0Xs.cjs');
1
+ const require_RunIntentService = require('./RunIntentService-ZkjpY7MS.cjs');
2
2
  const require_InMemoryLiveWorkflowRepository = require('./InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs');
3
3
  let zod = require("zod");
4
4
  zod = require_RunIntentService.__toESM(zod);
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as OutputPortKey, $n as RunCurrentState, $t as NodeActivationRequestBase, A as ExecutionMode, An as WebhookTriggerRoutingDiagnostics, Ar as CoreTokens, At as runnableNodeInputType, B as NodeActivationId, Bn as NodeExecutionSnapshot, Br as RetryPolicySpec, Bt as BinaryStorageWriteResult, C as CredentialTypeRegistry, Cn as WorkflowSnapshotResolver, Cr as injectAll, Ct as WorkflowPolicyRuntimeDefaults, D as BinaryAttachment, Dn as WebhookInvocationMatch, Dr as predicateAwareClassFactory, Dt as WorkflowStoragePolicyResolver, E as ActivationIdFactory, En as WebhookControlSignal, Er as instancePerContainerCachingFactory, Et as WorkflowStoragePolicyMode, F as JsonArray, Fn as ConnectionInvocationRecord, Fr as RunEventBus, Ft as BinaryBody, G as NodeErrorHandlerArgs, Gn as PersistedMutableRunState, Gt as ExecutionContext, H as NodeConnectionName, Hn as NodeInputsByPort, Ht as EngineHost, I as JsonObject, In as CurrentStateExecutionRequest, Ir as RunEventSubscription, It as BinaryStorage, J as NodeKind, Jn as PersistedWorkflowSnapshot, Jt as MultiInputNode, K as NodeErrorHandlerSpec, Kn as PersistedRunControlState, Kt as ExecutionContextFactory, L as JsonPrimitive, Ln as EngineRunCounters, Lr as ExponentialRetryPolicySpec, Lt as BinaryStorageReadResult, M as Item, Mn as WorkflowActivationPolicy, Mr as EngineExecutionLimitsPolicy, Mt as triggerNodeOutputType, N as ItemBinary, Nn as ConnectionInvocationAppendArgs, Nr as EngineExecutionLimitsPolicyConfig, Nt as triggerNodeSetupStateType, O as BinaryPreviewKind, On as WebhookTriggerMatcher, Or as registry, Ot as WorkflowStoragePolicySpec, P as Items, Pn as ConnectionInvocationId, Pr as RunEvent, Pt as BinaryAttachmentCreateRequest, Q as NodeSchedulerDecision, Qn as RunCompletionNotifier, Qt as NodeActivationRequest, R as JsonValue, Rn as ExecutionFrontierPlan, Rr as FixedRetryPolicySpec, Rt as BinaryStorageStatResult, S as CredentialTypeId, Sn as WorkflowSnapshotFactory, Sr as inject, St as WorkflowNodeConnection, T as OAuth2ProviderFromPublicConfig, Tn as TriggerInstanceId, Tr as instanceCachingFactory, Tt as WorkflowStoragePolicyDecisionArgs, U as NodeDefinition, Un as PendingNodeExecution, Ut as ExecutableTriggerNode, V as NodeConfigBase, Vn as NodeExecutionStatus, Vt as EngineDeps, W as NodeErrorHandler, Wn as PersistedMutableNodeState, Wt as ExecutionBinaryService, X as NodeOutputs, Xn as PersistedWorkflowTokenRegistryLike, Xt as NodeActivationContinuation, Y as NodeOffloadPolicy, Yn as PersistedWorkflowSnapshotNode, Yt as Node, Z as NodeRef, Zn as PinnedNodeOutputsByPort, Zt as NodeActivationReceipt, _ as CredentialSessionFactoryArgs, _n as TriggerTestItemsContext, _r as Lifecycle, _t as WorkflowErrorHandler, a as CredentialBindingKey, an as NodeExecutionScheduler, ar as RunStateResetRequest, at as RunDataSnapshot, b as CredentialType, bn as WorkflowRunnerResolver, br as container, bt as WorkflowGraphFactory, c as CredentialHealthStatus, cn as NodeResolver, cr as RunSummary, ct as RunnableNodeConfig, d as CredentialInstanceRecord, dn as TriggerCleanupHandle, dr as WorkflowExecutionPruneRepository, dt as TriggerNodeConfig, en as NodeActivationScheduler, er as RunEventPublisherDeps, et as PairedItemRef, f as CredentialJsonRecord, fn as TriggerNode, fr as WorkflowExecutionRepository, ft as TriggerNodeOutputJson, g as CredentialSessionFactory, gn as TriggerSetupStateRepository, gr as InjectionToken, gt as WorkflowErrorContext, h as CredentialRequirement, hn as TriggerSetupStateFor, hr as Disposable, ht as WorkflowDefinition, i as CredentialBinding, in as NodeExecutionRequestHandler, ir as RunResult, it as RunDataFactory, j as InputPortKey, jn as AllWorkflowsActiveWorkflowActivationPolicy, jt as runnableNodeOutputType, k as Edge, kn as WebhookTriggerResolution, kr as singleton, kt as branchRef, l as CredentialHealthTester, ln as PersistedTriggerSetupState, lr as WebhookRunResult, lt as RunnableNodeInputJson, m as CredentialOAuth2AuthDefinition, mn as TriggerSetupContext, mr as DependencyContainer, mt as UpstreamRefPlaceholder, n as AnyCredentialType, nn as NodeExecutionContext, nr as RunPruneCandidate, nt as PersistedRunPolicySnapshot, o as CredentialFieldSchema, on as NodeExecutionStatePublisher, or as RunStatus, ot as RunId, p as CredentialMaterialSourceKind, pn as TriggerRuntimeDiagnostics, pr as Container, pt as TriggerNodeSetupState, q as NodeId, qn as PersistedRunState, qt as LiveWorkflowRepository, r as CredentialAuthDefinition, rn as NodeExecutionRequest, rr as RunQueueEntry, rt as PersistedTokenId, s as CredentialHealth, sn as NodeExecutor, sr as RunStopCondition, st as RunIdFactory, t as InMemoryLiveWorkflowRepository, tn as NodeBinaryAttachmentService, tr as RunExecutionOptions, tt as ParentExecutionRef, u as CredentialInstanceId, un as TestableTriggerNode, ur as WorkflowExecutionListingRepository, ut as RunnableNodeOutputJson, v as CredentialSessionService, vn as WorkflowNodeInstanceFactory, vr as RegistrationOptions, vt as WorkflowErrorHandlerSpec, w as CredentialUnboundError, wn as HttpMethod, wr as injectable, wt as WorkflowPrunePolicySpec, x as CredentialTypeDefinition, xn as WorkflowRunnerService, xr as delay, xt as WorkflowId, y as CredentialSetupStatus, yn as WorkflowRepository, yr as TypeToken, yt as WorkflowGraph, z as MutableRunData, zn as NodeExecutionError, zr as NoneRetryPolicySpec, zt as BinaryStorageWriteRequest } from "./InMemoryLiveWorkflowRepository-orY1VsWG.cjs";
2
- import { a as UnavailableBinaryStorage, c as DefaultAsyncSleeper, i as DefaultExecutionBinaryService, n as InMemoryRunDataFactory, o as InProcessRetryRunner, r as InMemoryBinaryStorage, s as DefaultExecutionContextFactory, t as RunIntentService, u as CredentialResolverFactory } from "./RunIntentService-ByuUYsAL.cjs";
2
+ import { a as UnavailableBinaryStorage, c as DefaultAsyncSleeper, i as DefaultExecutionBinaryService, n as InMemoryRunDataFactory, o as InProcessRetryRunner, r as InMemoryBinaryStorage, s as DefaultExecutionContextFactory, t as RunIntentService, u as CredentialResolverFactory } from "./RunIntentService-DjbxzBBP.cjs";
3
3
  import { ZodType, input, output, z } from "zod";
4
4
 
5
5
  //#region src/contracts/NoRetryPolicy.d.ts
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { $ as JsonArray, $n as ConnectionInvocationRecord, $r as RunEventBus, $t as BinaryBody, A as CredentialJsonRecord, An as TriggerNode, Ar as WorkflowExecutionRepository, At as TriggerNodeOutputJson, B as CredentialTypeId, Bn as WorkflowSnapshotFactory, Br as inject, Bt as WorkflowNodeConnection, C as CredentialBindingKey, Cn as NodeExecutionScheduler, Cr as RunStateResetRequest, Ct as RunDataSnapshot, D as CredentialHealthTester, Dn as PersistedTriggerSetupState, Dr as WebhookRunResult, Dt as RunnableNodeInputJson, E as CredentialHealthStatus, En as NodeResolver, Er as RunSummary, Et as RunnableNodeConfig, F as CredentialSessionFactoryArgs, Fn as TriggerTestItemsContext, Fr as Lifecycle, Ft as WorkflowErrorHandler, G as BinaryAttachment, Gn as WebhookInvocationMatch, Gr as predicateAwareClassFactory, Gt as WorkflowStoragePolicyResolver, H as CredentialUnboundError, Hn as HttpMethod, Hr as injectable, Ht as WorkflowPrunePolicySpec, I as CredentialSessionService, In as WorkflowNodeInstanceFactory, Ir as RegistrationOptions, It as WorkflowErrorHandlerSpec, J as ExecutionMode, Jn as WebhookTriggerRoutingDiagnostics, Jr as CoreTokens, Jt as runnableNodeInputType, K as BinaryPreviewKind, Kn as WebhookTriggerMatcher, Kr as registry, Kt as WorkflowStoragePolicySpec, L as CredentialSetupStatus, Ln as WorkflowRepository, Lr as TypeToken, Lt as WorkflowGraph, M as CredentialOAuth2AuthDefinition, Mn as TriggerSetupContext, Mr as DependencyContainer, Mt as UpstreamRefPlaceholder, N as CredentialRequirement, Nn as TriggerSetupStateFor, Nr as Disposable, Nt as WorkflowDefinition, O as CredentialInstanceId, On as TestableTriggerNode, Or as WorkflowExecutionListingRepository, Ot as RunnableNodeOutputJson, P as CredentialSessionFactory, Pn as TriggerSetupStateRepository, Pr as InjectionToken, Pt as WorkflowErrorContext, Q as Items, Qn as ConnectionInvocationId, Qr as RunEvent, Qt as BinaryAttachmentCreateRequest, R as CredentialType, Rn as WorkflowRunnerResolver, Rr as container, Rt as WorkflowGraphFactory, S as CredentialBinding, Sn as NodeExecutionRequestHandler, Sr as RunResult, St as RunDataFactory, T as CredentialHealth, Tn as NodeExecutor, Tr as RunStopCondition, Tt as RunIdFactory, U as OAuth2ProviderFromPublicConfig, Un as TriggerInstanceId, Ur as instanceCachingFactory, Ut as WorkflowStoragePolicyDecisionArgs, V as CredentialTypeRegistry, Vn as WorkflowSnapshotResolver, Vr as injectAll, Vt as WorkflowPolicyRuntimeDefaults, W as ActivationIdFactory, Wn as WebhookControlSignal, Wr as instancePerContainerCachingFactory, Wt as WorkflowStoragePolicyMode, X as Item, Xn as WorkflowActivationPolicy, Xr as EngineExecutionLimitsPolicy, Xt as triggerNodeOutputType, Y as InputPortKey, Yn as AllWorkflowsActiveWorkflowActivationPolicy, Yt as runnableNodeOutputType, Z as ItemBinary, Zn as ConnectionInvocationAppendArgs, Zr as EngineExecutionLimitsPolicyConfig, Zt as triggerNodeSetupStateType, _ as StepSequenceOutput, _n as NodeActivationRequestBase, _r as RunCurrentState, _t as OutputPortKey, a as WorkflowExecutableNodeClassifier, ai as FixedRetryPolicySpec, an as EngineDeps, ar as NodeExecutionStatus, at as NodeConfigBase, b as AnyCredentialType, bn as NodeExecutionContext, br as RunPruneCandidate, bt as PersistedRunPolicySnapshot, c as WorkflowBuilder, cn as ExecutionBinaryService, cr as PersistedMutableNodeState, ct as NodeErrorHandler, d as AnyRunnableNodeConfig, dn as LiveWorkflowRepository, dr as PersistedRunState, dt as NodeId, ei as RunEventSubscription, en as BinaryStorage, er as CurrentStateExecutionRequest, et as JsonObject, f as AnyTriggerNodeConfig, fn as MultiInputNode, fr as PersistedWorkflowSnapshot, ft as NodeKind, g as BranchStepsArg, gn as NodeActivationRequest, gr as RunCompletionNotifier, gt as NodeSchedulerDecision, h as BranchOutputGuard, hn as NodeActivationReceipt, hr as PinnedNodeOutputsByPort, ht as NodeRef, i as WorkflowExecutableNodeClassifierFactory, ii as ExponentialRetryPolicySpec, in as BinaryStorageWriteResult, ir as NodeExecutionSnapshot, it as NodeActivationId, j as CredentialMaterialSourceKind, jn as TriggerRuntimeDiagnostics, jr as Container, jt as TriggerNodeSetupState, k as CredentialInstanceRecord, kn as TriggerCleanupHandle, kr as WorkflowExecutionPruneRepository, kt as TriggerNodeConfig, l as ChainCursor, ln as ExecutionContext, lr as PersistedMutableRunState, lt as NodeErrorHandlerArgs, m as BranchMoreArgs, mn as NodeActivationContinuation, mr as PersistedWorkflowTokenRegistryLike, mt as NodeOutputs, ni as RetryPolicy, nn as BinaryStorageStatResult, nr as ExecutionFrontierPlan, nt as JsonValue, o as ConnectionNodeIdFactory, oi as NoneRetryPolicySpec, on as EngineHost, or as NodeInputsByPort, ot as NodeConnectionName, p as BooleanWhenOverloads, pn as Node, pr as PersistedWorkflowSnapshotNode, pt as NodeOffloadPolicy, q as Edge, qn as WebhookTriggerResolution, qr as singleton, qt as branchRef, r as DefaultWorkflowGraphFactory, ri as NoRetryPolicy, rn as BinaryStorageWriteRequest, rr as NodeExecutionError, rt as MutableRunData, s as ConnectionInvocationIdFactory, si as RetryPolicySpec, sn as ExecutableTriggerNode, sr as PendingNodeExecution, st as NodeDefinition, t as InMemoryLiveWorkflowRepository, ti as ExpRetryPolicy, tn as BinaryStorageReadResult, tr as EngineRunCounters, tt as JsonPrimitive, u as WhenBuilder, un as ExecutionContextFactory, ur as PersistedRunControlState, ut as NodeErrorHandlerSpec, v as ValidStepSequence, vn as NodeActivationScheduler, vr as RunEventPublisherDeps, vt as PairedItemRef, w as CredentialFieldSchema, wn as NodeExecutionStatePublisher, wr as RunStatus, wt as RunId, x as CredentialAuthDefinition, xn as NodeExecutionRequest, xr as RunQueueEntry, xt as PersistedTokenId, y as RunFinishedAtFactory, yn as NodeBinaryAttachmentService, yr as RunExecutionOptions, yt as ParentExecutionRef, z as CredentialTypeDefinition, zn as WorkflowRunnerService, zr as delay, zt as WorkflowId } from "./InMemoryLiveWorkflowRepository-DxoualoC.js";
2
- import { $ as AgentTurnLimitBehavior, A as PersistedRuntimeTypeKind, At as InProcessRetryRunner, B as AgentMessageDto, C as node, Ct as DefinedNodeCredentialBindings, D as PersistedRuntimeTypeMetadataStore, Dt as SystemClock, E as PersistedRuntimeTypeNameResolver, Et as Clock, F as AgentCanvasPresentation, Ft as NodeEventPublisher, G as AgentModelInvocationOptions, H as AgentMessageRole, I as AgentGuardrailConfig, J as AgentToolCall, K as AgentNodeConfig, L as AgentGuardrailDefaults, M as EventPublishingWorkflowExecutionRepository, Mt as DefaultAsyncSleeper, N as InMemoryRunEventBus, O as InjectableRuntimeDecoratorComposer, P as AgentAttachmentRole, Pt as CredentialResolverFactory, Q as AgentToolToken, R as AgentMessageBuildArgs, S as getPersistedRuntimeTypeMetadata, St as DefinedNodeCredentialBinding, T as StackTraceCallSitePathResolver, Tt as defineNode, U as AgentMessageTemplate, V as AgentMessageLine, W as AgentMessageTemplateContent, X as AgentToolDefinition, Y as AgentToolCallPlanner, Z as AgentToolExecuteArgs, _t as defineCredential, at as NodeBackedToolInputMapperArgs, b as ItemsInputNormalizer, bt as DefinedNode, ct as Tool, d as InMemoryRunDataFactory, dt as ZodSchemaAny, et as ChatModelConfig, f as InMemoryBinaryStorage, ft as AgentConfigInspector, gt as DefineCredentialOptions, ht as NodeBackedToolConfig, it as NodeBackedToolInputMapper, j as PersistedRuntimeTypeMetadata, jt as DefaultExecutionContextFactory, k as PersistedRuntimeTypeDecoratorOptions, lt as ToolConfig, mt as AgentToolFactory, nt as LangChainChatModelLike, ot as NodeBackedToolOutputMapper, pt as AgentMessageConfigNormalizer, q as AgentTool, rt as NodeBackedToolConfigOptions, s as RunIntentService, st as NodeBackedToolOutputMapperArgs, tt as ChatModelFactory, ut as ToolExecuteArgs, v as DefaultExecutionBinaryService, vt as DefinedNodeRegistry, w as tool, wt as DefinedNodeRunContext, x as chatModel, xt as DefinedNodeCredentialAccessors, y as UnavailableBinaryStorage, yt as DefineNodeOptions, z as AgentMessageConfig } from "./index-B4_ZRTyI.js";
2
+ import { $ as AgentTurnLimitBehavior, A as PersistedRuntimeTypeKind, At as InProcessRetryRunner, B as AgentMessageDto, C as node, Ct as DefinedNodeCredentialBindings, D as PersistedRuntimeTypeMetadataStore, Dt as SystemClock, E as PersistedRuntimeTypeNameResolver, Et as Clock, F as AgentCanvasPresentation, Ft as NodeEventPublisher, G as AgentModelInvocationOptions, H as AgentMessageRole, I as AgentGuardrailConfig, J as AgentToolCall, K as AgentNodeConfig, L as AgentGuardrailDefaults, M as EventPublishingWorkflowExecutionRepository, Mt as DefaultAsyncSleeper, N as InMemoryRunEventBus, O as InjectableRuntimeDecoratorComposer, P as AgentAttachmentRole, Pt as CredentialResolverFactory, Q as AgentToolToken, R as AgentMessageBuildArgs, S as getPersistedRuntimeTypeMetadata, St as DefinedNodeCredentialBinding, T as StackTraceCallSitePathResolver, Tt as defineNode, U as AgentMessageTemplate, V as AgentMessageLine, W as AgentMessageTemplateContent, X as AgentToolDefinition, Y as AgentToolCallPlanner, Z as AgentToolExecuteArgs, _t as defineCredential, at as NodeBackedToolInputMapperArgs, b as ItemsInputNormalizer, bt as DefinedNode, ct as Tool, d as InMemoryRunDataFactory, dt as ZodSchemaAny, et as ChatModelConfig, f as InMemoryBinaryStorage, ft as AgentConfigInspector, gt as DefineCredentialOptions, ht as NodeBackedToolConfig, it as NodeBackedToolInputMapper, j as PersistedRuntimeTypeMetadata, jt as DefaultExecutionContextFactory, k as PersistedRuntimeTypeDecoratorOptions, lt as ToolConfig, mt as AgentToolFactory, nt as LangChainChatModelLike, ot as NodeBackedToolOutputMapper, pt as AgentMessageConfigNormalizer, q as AgentTool, rt as NodeBackedToolConfigOptions, s as RunIntentService, st as NodeBackedToolOutputMapperArgs, tt as ChatModelFactory, ut as ToolExecuteArgs, v as DefaultExecutionBinaryService, vt as DefinedNodeRegistry, w as tool, wt as DefinedNodeRunContext, x as chatModel, xt as DefinedNodeCredentialAccessors, y as UnavailableBinaryStorage, yt as DefineNodeOptions, z as AgentMessageConfig } from "./index-BIewO9-9.js";
3
3
  export { ActivationIdFactory, AgentAttachmentRole, AgentCanvasPresentation, AgentConfigInspector, AgentGuardrailConfig, AgentGuardrailDefaults, AgentMessageBuildArgs, AgentMessageConfig, AgentMessageConfigNormalizer, AgentMessageDto, AgentMessageLine, AgentMessageRole, AgentMessageTemplate, AgentMessageTemplateContent, AgentModelInvocationOptions, AgentNodeConfig, AgentTool, AgentToolCall, AgentToolCallPlanner, AgentToolDefinition, AgentToolExecuteArgs, AgentToolFactory, AgentToolToken, AgentTurnLimitBehavior, AllWorkflowsActiveWorkflowActivationPolicy, AnyCredentialType, AnyRunnableNodeConfig, AnyTriggerNodeConfig, BinaryAttachment, BinaryAttachmentCreateRequest, BinaryBody, BinaryPreviewKind, BinaryStorage, BinaryStorageReadResult, BinaryStorageStatResult, BinaryStorageWriteRequest, BinaryStorageWriteResult, BooleanWhenOverloads, BranchMoreArgs, BranchOutputGuard, BranchStepsArg, ChainCursor, ChatModelConfig, ChatModelFactory, Clock, ConnectionInvocationAppendArgs, ConnectionInvocationId, ConnectionInvocationIdFactory, ConnectionInvocationRecord, ConnectionNodeIdFactory, Container, CoreTokens, CredentialAuthDefinition, CredentialBinding, CredentialBindingKey, CredentialFieldSchema, CredentialHealth, CredentialHealthStatus, CredentialHealthTester, CredentialInstanceId, CredentialInstanceRecord, CredentialJsonRecord, CredentialMaterialSourceKind, CredentialOAuth2AuthDefinition, CredentialRequirement, CredentialResolverFactory, CredentialSessionFactory, CredentialSessionFactoryArgs, CredentialSessionService, CredentialSetupStatus, CredentialType, CredentialTypeDefinition, CredentialTypeId, CredentialTypeRegistry, CredentialUnboundError, CurrentStateExecutionRequest, DefaultAsyncSleeper, DefaultExecutionBinaryService, DefaultExecutionContextFactory, DefaultWorkflowGraphFactory, DefineCredentialOptions, DefineNodeOptions, DefinedNode, DefinedNodeCredentialAccessors, DefinedNodeCredentialBinding, DefinedNodeCredentialBindings, DefinedNodeRegistry, DefinedNodeRunContext, DependencyContainer, Disposable, Edge, EngineDeps, EngineExecutionLimitsPolicy, EngineExecutionLimitsPolicyConfig, EngineHost, EngineRunCounters, EventPublishingWorkflowExecutionRepository, ExecutableTriggerNode, ExecutionBinaryService, ExecutionContext, ExecutionContextFactory, ExecutionFrontierPlan, ExecutionMode, ExpRetryPolicy, ExponentialRetryPolicySpec, FixedRetryPolicySpec, HttpMethod, InMemoryBinaryStorage, InMemoryLiveWorkflowRepository, InMemoryRunDataFactory, InMemoryRunEventBus, InProcessRetryRunner, InjectableRuntimeDecoratorComposer, InjectionToken, InputPortKey, Item, ItemBinary, Items, ItemsInputNormalizer, JsonArray, JsonObject, JsonPrimitive, JsonValue, LangChainChatModelLike, Lifecycle, LiveWorkflowRepository, MultiInputNode, MutableRunData, NoRetryPolicy, Node, NodeActivationContinuation, NodeActivationId, NodeActivationReceipt, NodeActivationRequest, NodeActivationRequestBase, NodeActivationScheduler, NodeBackedToolConfig, NodeBackedToolConfigOptions, NodeBackedToolInputMapper, NodeBackedToolInputMapperArgs, NodeBackedToolOutputMapper, NodeBackedToolOutputMapperArgs, NodeBinaryAttachmentService, NodeConfigBase, NodeConnectionName, NodeDefinition, NodeErrorHandler, NodeErrorHandlerArgs, NodeErrorHandlerSpec, NodeEventPublisher, NodeExecutionContext, NodeExecutionError, NodeExecutionRequest, NodeExecutionRequestHandler, NodeExecutionScheduler, NodeExecutionSnapshot, NodeExecutionStatePublisher, NodeExecutionStatus, NodeExecutor, NodeId, NodeInputsByPort, NodeKind, NodeOffloadPolicy, NodeOutputs, NodeRef, NodeResolver, NodeSchedulerDecision, NoneRetryPolicySpec, OAuth2ProviderFromPublicConfig, OutputPortKey, PairedItemRef, ParentExecutionRef, PendingNodeExecution, PersistedMutableNodeState, PersistedMutableRunState, PersistedRunControlState, PersistedRunPolicySnapshot, PersistedRunState, PersistedRuntimeTypeDecoratorOptions, PersistedRuntimeTypeKind, PersistedRuntimeTypeMetadata, PersistedRuntimeTypeMetadataStore, PersistedRuntimeTypeNameResolver, PersistedTokenId, PersistedTriggerSetupState, PersistedWorkflowSnapshot, PersistedWorkflowSnapshotNode, PersistedWorkflowTokenRegistryLike, PinnedNodeOutputsByPort, RegistrationOptions, RetryPolicy, RetryPolicySpec, RunCompletionNotifier, RunCurrentState, RunDataFactory, RunDataSnapshot, RunEvent, RunEventBus, RunEventPublisherDeps, RunEventSubscription, RunExecutionOptions, RunFinishedAtFactory, RunId, RunIdFactory, RunIntentService, RunPruneCandidate, RunQueueEntry, RunResult, RunStateResetRequest, RunStatus, RunStopCondition, RunSummary, RunnableNodeConfig, RunnableNodeInputJson, RunnableNodeOutputJson, StackTraceCallSitePathResolver, StepSequenceOutput, SystemClock, TestableTriggerNode, Tool, ToolConfig, ToolExecuteArgs, TriggerCleanupHandle, TriggerInstanceId, TriggerNode, TriggerNodeConfig, TriggerNodeOutputJson, TriggerNodeSetupState, TriggerRuntimeDiagnostics, TriggerSetupContext, TriggerSetupStateFor, TriggerSetupStateRepository, TriggerTestItemsContext, TypeToken, UnavailableBinaryStorage, UpstreamRefPlaceholder, ValidStepSequence, WebhookControlSignal, WebhookInvocationMatch, WebhookRunResult, WebhookTriggerMatcher, WebhookTriggerResolution, WebhookTriggerRoutingDiagnostics, WhenBuilder, WorkflowActivationPolicy, WorkflowBuilder, WorkflowDefinition, WorkflowErrorContext, WorkflowErrorHandler, WorkflowErrorHandlerSpec, WorkflowExecutableNodeClassifier, WorkflowExecutableNodeClassifierFactory, WorkflowExecutionListingRepository, WorkflowExecutionPruneRepository, WorkflowExecutionRepository, WorkflowGraph, WorkflowGraphFactory, WorkflowId, WorkflowNodeConnection, WorkflowNodeInstanceFactory, WorkflowPolicyRuntimeDefaults, WorkflowPrunePolicySpec, WorkflowRepository, WorkflowRunnerResolver, WorkflowRunnerService, WorkflowSnapshotFactory, WorkflowSnapshotResolver, WorkflowStoragePolicyDecisionArgs, WorkflowStoragePolicyMode, WorkflowStoragePolicyResolver, WorkflowStoragePolicySpec, ZodSchemaAny, branchRef, chatModel, container, defineCredential, defineNode, delay, getPersistedRuntimeTypeMetadata, inject, injectAll, injectable, instanceCachingFactory, instancePerContainerCachingFactory, node, predicateAwareClassFactory, registry, runnableNodeInputType, runnableNodeOutputType, singleton, tool, triggerNodeOutputType, triggerNodeSetupStateType };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as injectAll, B as WorkflowExecutableNodeClassifier, G as tool, H as chatModel, I as DefaultExecutionBinaryService, J as StackTraceCallSitePathResolver, K as InjectableRuntimeDecoratorComposer, L as UnavailableBinaryStorage, M as DefaultExecutionContextFactory, N as DefaultAsyncSleeper, P as CredentialResolverFactory, Q as inject, R as NodeEventPublisher, U as getPersistedRuntimeTypeMetadata, V as ConnectionNodeIdFactory, W as node, X as container, Y as PersistedRuntimeTypeNameResolver, Z as delay, at as singleton, et as injectable, i as InMemoryBinaryStorage, it as registry, j as InProcessRetryRunner, n as RunFinishedAtFactory, nt as instancePerContainerCachingFactory, o as EngineExecutionLimitsPolicy, ot as CoreTokens, q as PersistedRuntimeTypeMetadataStore, r as InMemoryRunDataFactory, rt as predicateAwareClassFactory, t as RunIntentService, tt as instanceCachingFactory, z as WorkflowExecutableNodeClassifierFactory } from "./RunIntentService-BB4nqX3-.js";
1
+ import { $ as injectAll, B as WorkflowExecutableNodeClassifier, G as tool, H as chatModel, I as DefaultExecutionBinaryService, J as StackTraceCallSitePathResolver, K as InjectableRuntimeDecoratorComposer, L as UnavailableBinaryStorage, M as DefaultExecutionContextFactory, N as DefaultAsyncSleeper, P as CredentialResolverFactory, Q as inject, R as NodeEventPublisher, U as getPersistedRuntimeTypeMetadata, V as ConnectionNodeIdFactory, W as node, X as container, Y as PersistedRuntimeTypeNameResolver, Z as delay, at as singleton, et as injectable, i as InMemoryBinaryStorage, it as registry, j as InProcessRetryRunner, n as RunFinishedAtFactory, nt as instancePerContainerCachingFactory, o as EngineExecutionLimitsPolicy, ot as CoreTokens, q as PersistedRuntimeTypeMetadataStore, r as InMemoryRunDataFactory, rt as predicateAwareClassFactory, t as RunIntentService, tt as instanceCachingFactory, z as WorkflowExecutableNodeClassifierFactory } from "./RunIntentService-C1nu_YwM.js";
2
2
  import { t as InMemoryLiveWorkflowRepository } from "./InMemoryLiveWorkflowRepository-BoLNnVLg.js";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemation/core",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -303,7 +303,17 @@ export class CurrentStateFrontierPlanner {
303
303
  if (!incomingEdge) {
304
304
  return false;
305
305
  }
306
- return this.hasOutputPort(currentState, incomingEdge.from.nodeId, incomingEdge.from.output);
306
+ if (!this.hasOutputPort(currentState, incomingEdge.from.nodeId, incomingEdge.from.output)) {
307
+ return false;
308
+ }
309
+ if (this.usesCollect(nodeId)) {
310
+ return true;
311
+ }
312
+ const items = this.resolveOutputItems(currentState, incomingEdge.from.nodeId, incomingEdge.from.output);
313
+ if (items.length > 0) {
314
+ return true;
315
+ }
316
+ return this.shouldContinueAfterEmptyOutputFromSource(incomingEdge.from.nodeId);
307
317
  }
308
318
 
309
319
  private resolveInput(currentState: RunCurrentState, nodeId: NodeId, input: InputPortKey): Items {
@@ -335,6 +345,19 @@ export class CurrentStateFrontierPlanner {
335
345
  return currentState.outputsByNode[nodeId]?.[output] ?? [];
336
346
  }
337
347
 
348
+ private usesCollect(nodeId: NodeId): boolean {
349
+ const expectedInputs = this.topology.expectedInputsByNode.get(nodeId) ?? [];
350
+ return expectedInputs.length !== 1 || expectedInputs[0] !== "in";
351
+ }
352
+
353
+ private shouldContinueAfterEmptyOutputFromSource(nodeId: NodeId): boolean {
354
+ const definition = this.topology.defsById.get(nodeId);
355
+ if (!definition) {
356
+ return false;
357
+ }
358
+ return definition.config.continueWhenEmptyOutput === true;
359
+ }
360
+
338
361
  private getPinnedOutputs(currentState: RunCurrentState, nodeId: NodeId): NodeOutputs | undefined {
339
362
  return currentState.mutableState?.nodesById?.[nodeId]?.pinnedOutputsByPort;
340
363
  }
@@ -20,6 +20,7 @@ export type StartWorkflowIntent = {
20
20
  workflow: WorkflowDefinition;
21
21
  startAt?: string;
22
22
  items: Items;
23
+ synthesizeTriggerItems?: boolean;
23
24
  parent?: CurrentStateExecutionRequest["parent"];
24
25
  executionOptions?: RunExecutionOptions;
25
26
  workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
@@ -34,6 +35,7 @@ export type RerunFromNodeIntent = {
34
35
  nodeId: NodeId;
35
36
  currentState: RunCurrentState;
36
37
  items?: Items;
38
+ synthesizeTriggerItems?: boolean;
37
39
  parent?: CurrentStateExecutionRequest["parent"];
38
40
  executionOptions?: RunExecutionOptions;
39
41
  workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
@@ -58,22 +60,16 @@ export class RunIntentService {
58
60
  ) {}
59
61
 
60
62
  async startWorkflow(args: StartWorkflowIntent): Promise<RunResult> {
63
+ const items = await this.resolveStartWorkflowItems(args);
61
64
  if (args.startAt && !args.currentState && !args.stopCondition && !args.reset) {
62
- return await this.engine.runWorkflow(
63
- args.workflow,
64
- args.startAt,
65
- args.items,
66
- args.parent,
67
- args.executionOptions,
68
- {
69
- workflowSnapshot: args.workflowSnapshot,
70
- mutableState: args.mutableState,
71
- },
72
- );
65
+ return await this.engine.runWorkflow(args.workflow, args.startAt, items, args.parent, args.executionOptions, {
66
+ workflowSnapshot: args.workflowSnapshot,
67
+ mutableState: args.mutableState,
68
+ });
73
69
  }
74
70
  return await this.engine.runWorkflowFromState({
75
71
  workflow: args.workflow,
76
- items: args.items,
72
+ items,
77
73
  parent: args.parent,
78
74
  executionOptions: args.executionOptions,
79
75
  workflowSnapshot: args.workflowSnapshot,
@@ -85,8 +81,9 @@ export class RunIntentService {
85
81
  }
86
82
 
87
83
  async rerunFromNode(args: RerunFromNodeIntent): Promise<RunResult> {
88
- if (args.items) {
89
- return await this.engine.runWorkflow(args.workflow, args.nodeId, args.items, args.parent, args.executionOptions, {
84
+ const items = await this.resolveRerunItems(args);
85
+ if (items) {
86
+ return await this.engine.runWorkflow(args.workflow, args.nodeId, items, args.parent, args.executionOptions, {
90
87
  workflowSnapshot: args.workflowSnapshot,
91
88
  mutableState: args.mutableState,
92
89
  });
@@ -103,6 +100,63 @@ export class RunIntentService {
103
100
  });
104
101
  }
105
102
 
103
+ private async resolveStartWorkflowItems(args: StartWorkflowIntent): Promise<Items> {
104
+ if (this.hasNonEmptyItems(args.items)) {
105
+ return args.items;
106
+ }
107
+ const triggerNodeId = this.resolveStartWorkflowTriggerNodeId(args);
108
+ if (!triggerNodeId) {
109
+ return args.items;
110
+ }
111
+ return (await this.engine.createTriggerTestItems({ workflow: args.workflow, nodeId: triggerNodeId })) ?? args.items;
112
+ }
113
+
114
+ private async resolveRerunItems(args: RerunFromNodeIntent): Promise<Items | undefined> {
115
+ if (this.hasNonEmptyItems(args.items)) {
116
+ return args.items;
117
+ }
118
+ const triggerNodeId = this.resolveRerunTriggerNodeId(args);
119
+ if (!triggerNodeId) {
120
+ return args.items;
121
+ }
122
+ return (await this.engine.createTriggerTestItems({ workflow: args.workflow, nodeId: triggerNodeId })) ?? args.items;
123
+ }
124
+
125
+ private resolveStartWorkflowTriggerNodeId(args: StartWorkflowIntent): NodeId | undefined {
126
+ if (args.stopCondition?.kind === "nodeCompleted" && this.isTriggerNode(args.workflow, args.stopCondition.nodeId)) {
127
+ return args.stopCondition.nodeId;
128
+ }
129
+ if (!args.synthesizeTriggerItems) {
130
+ return undefined;
131
+ }
132
+ if (args.startAt && this.isTriggerNode(args.workflow, args.startAt)) {
133
+ return args.startAt;
134
+ }
135
+ return this.firstTriggerNodeId(args.workflow);
136
+ }
137
+
138
+ private resolveRerunTriggerNodeId(args: RerunFromNodeIntent): NodeId | undefined {
139
+ if (this.isTriggerNode(args.workflow, args.nodeId)) {
140
+ return args.nodeId;
141
+ }
142
+ if (!args.synthesizeTriggerItems) {
143
+ return undefined;
144
+ }
145
+ return this.firstTriggerNodeId(args.workflow);
146
+ }
147
+
148
+ private firstTriggerNodeId(workflow: WorkflowDefinition): NodeId | undefined {
149
+ return workflow.nodes.find((node) => node.kind === "trigger")?.id;
150
+ }
151
+
152
+ private isTriggerNode(workflow: WorkflowDefinition, nodeId: string): boolean {
153
+ return workflow.nodes.find((node) => node.id === nodeId)?.kind === "trigger";
154
+ }
155
+
156
+ private hasNonEmptyItems(items: Items | undefined): boolean {
157
+ return (items?.length ?? 0) > 0;
158
+ }
159
+
106
160
  resolveWebhookTrigger(args: { endpointPath: string; method: HttpMethod }): WebhookTriggerResolution {
107
161
  return this.engine.resolveWebhookTrigger(args);
108
162
  }