Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions packages/eve/src/execution/workflow-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ import {
} from "#execution/eve-workflow-attributes.js";
import { resolveInstalledPackageInfo } from "#internal/application/package.js";
import { createLogger, logError } from "#internal/logging.js";
import { getRun, resumeHook, start, type Run } from "#internal/workflow/runtime.js";
import {
getRun,
resumeHook,
start,
type Run,
type StartOptionsWithoutDeploymentId,
type WorkflowFunction,
type WorkflowMetadata,
} from "#internal/workflow/runtime.js";
import type { HandleMessageStreamEvent } from "#protocol/message.js";
import type { RuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";
import { ROOT_RUNTIME_AGENT_NODE_ID } from "#runtime/graph.js";
Expand All @@ -30,17 +38,6 @@ const WORKFLOW_ENTRY_NAME = "workflowEntry";
const TURN_WORKFLOW_NAME = "turnWorkflow";
const EVE_PACKAGE_INFO = resolveInstalledPackageInfo();

type WorkflowFunction<TArgs extends unknown[], TResult> = (...args: TArgs) => Promise<TResult>;

interface WorkflowMetadata {
readonly workflowId: string;
}

interface WorkflowStartOptions {
readonly allowReservedAttributes?: boolean;
readonly attributes?: Record<string, string>;
}

export const LATEST_DEPLOYMENT_UNSUPPORTED_MESSAGE =
"deploymentId 'latest' requires a World that implements resolveLatestDeploymentId()";

Expand Down Expand Up @@ -200,7 +197,7 @@ export function createWorkflowRuntime(config: {
export async function startWorkflowPreferLatest<TArgs extends unknown[], TResult>(
workflow: WorkflowFunction<TArgs, TResult> | WorkflowMetadata,
args: TArgs,
options?: WorkflowStartOptions,
options?: StartOptionsWithoutDeploymentId,
): Promise<Run<unknown> | Run<TResult>> {
if (!shouldRouteToLatestDeployment()) {
return options === undefined
Expand Down
5 changes: 5 additions & 0 deletions packages/eve/src/internal/workflow/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import "#internal/workflow/queue-namespace.js";
import * as workflowRuntime from "#compiled/@workflow/core/runtime.js";

export * from "#compiled/@workflow/core/runtime.js";
export type {
StartOptionsWithoutDeploymentId,
WorkflowFunction,
WorkflowMetadata,
} from "#compiled/@workflow/core/runtime/start.js";

/** Installs a World across source and vendored Workflow package identities. */
export function setWorld(world: unknown): void {
Expand Down
Loading