//#region src/interface/workflows.d.ts /** * The v1 platform event catalog IS the webhook catalog: same types, same * payload schemas, single source of truth in the crud files. Workflows * automatically inherit any future webhook event that gets added here. * * Note this deliberately includes the two project_permission events that the * OpenAPI-focused `webhookEvents` array in webhooks.ts omits — the 12 * `send*Webhook` exports in the backend are the real catalog. */ declare const workflowPlatformEvents: readonly [import("./webhooks").WebhookEvent>, import("./webhooks").WebhookEvent>, import("./webhooks").WebhookEvent>, { type: string; schema: import("yup").ObjectSchema<{ id: string; display_name: string; profile_image_url: string | null; client_metadata: {} | null | undefined; client_read_only_metadata: {} | null | undefined; } & { created_at_millis: number; server_metadata: {} | null | undefined; }, import("yup").AnyObject, { id: undefined; display_name: undefined; profile_image_url: undefined; client_metadata: undefined; client_read_only_metadata: undefined; created_at_millis: undefined; server_metadata: undefined; }, "">; metadata: { summary: string; description: string; tags: string[]; }; }, { type: string; schema: import("yup").ObjectSchema<{ id: string; display_name: string; profile_image_url: string | null; client_metadata: {} | null | undefined; client_read_only_metadata: {} | null | undefined; } & { created_at_millis: number; server_metadata: {} | null | undefined; }, import("yup").AnyObject, { id: undefined; display_name: undefined; profile_image_url: undefined; client_metadata: undefined; client_read_only_metadata: undefined; created_at_millis: undefined; server_metadata: undefined; }, "">; metadata: { summary: string; description: string; tags: string[]; }; }, { type: string; schema: import("yup").ObjectSchema<{ id: string; }, import("yup").AnyObject, { id: undefined; }, "">; metadata: { summary: string; description: string; tags: string[]; }; }, { type: string; schema: import("yup").ObjectSchema<{ team_id: string; user_id: string; }, import("yup").AnyObject, { team_id: undefined; user_id: undefined; }, "">; metadata: { summary: string; description: string; tags: string[]; }; }, { type: string; schema: import("yup").ObjectSchema<{ team_id: string; user_id: string; }, import("yup").AnyObject, { team_id: undefined; user_id: undefined; }, "">; metadata: { summary: string; description: string; tags: string[]; }; }, { type: string; schema: import("yup").ObjectSchema<{ id: string; user_id: string; team_id: string; }, import("yup").AnyObject, { id: undefined; user_id: undefined; team_id: undefined; }, "">; metadata: { summary: string; description: string; tags: string[]; }; }, { type: string; schema: import("yup").ObjectSchema<{ id: string; user_id: string; team_id: string; }, import("yup").AnyObject, { id: undefined; user_id: undefined; team_id: undefined; }, "">; metadata: { summary: string; description: string; tags: string[]; }; }, { type: string; schema: import("yup").ObjectSchema<{ id: string; user_id: string; }, import("yup").AnyObject, { id: undefined; user_id: undefined; }, "">; metadata: { summary: string; description: string; tags: string[]; }; }, { type: string; schema: import("yup").ObjectSchema<{ id: string; user_id: string; }, import("yup").AnyObject, { id: undefined; user_id: undefined; }, "">; metadata: { summary: string; description: string; tags: string[]; }; }]; declare const workflowPlatformEventTypes: string[]; /** * The wire type of custom events is ALWAYS prefixed with this; send() only * emits custom events and auto-prefixes. The unprefixed namespace is * reserved for platform events forever. */ declare const WORKFLOW_CUSTOM_EVENT_PREFIX = "custom."; /** The synthetic trigger type of schedule occurrences. */ declare const WORKFLOW_SCHEDULE_TRIGGER_TYPE = "schedule"; declare const WORKFLOW_SOURCE_MAX_BYTES: number; declare const WORKFLOW_EVENT_PAYLOAD_MAX_BYTES: number; declare const WORKFLOW_STEP_RESULT_MAX_BYTES: number; declare const WORKFLOW_RUN_MEMO_MAX_BYTES: number; declare const WORKFLOW_RUN_KEY_MAX_LENGTH = 512; /** 1 initial attempt + 3 retries. */ declare const WORKFLOW_STEP_MAX_ATTEMPTS = 4; /** Backoff before retry N (1-indexed), jittered by the engine. */ declare const WORKFLOW_STEP_RETRY_BACKOFF_MS: readonly [10000, 60000, 600000]; /** Workflow ids are user-chosen slugs; the business identity across versions. */ declare const WORKFLOW_ID_REGEX: RegExp; type WorkflowConflictBehavior = "skip" | "cancel-existing" | "error"; type WorkflowTriggerJson = { type: "event"; event_type: string; } | { type: "schedule"; cron: string; timezone: string; }; /** * Extracted from the workflow file by executing its compiled bundle in * manifest mode at sync time. Trigger declarations are matched as data by * event dispatch; user code is never re-evaluated to answer "what does this * workflow subscribe to". */ type WorkflowManifestJson = { workflow_id: string; triggers: WorkflowTriggerJson[]; has_run_key: boolean; on_conflict: WorkflowConflictBehavior; /** Which pinned stdlib packages the source imports (e.g. ["date-fns"]); drives sandbox nodeModules installs. */ uses_stdlib: string[]; }; /** * queued -> running <-> sleeping -> completed | failed | canceled. * There is deliberately NO paused state: divergent upgrade transfers are * skipped (the run keeps executing its pinned version), never halted. */ type WorkflowRunStateJson = "queued" | "running" | "sleeping" | "completed" | "failed" | "canceled"; declare const workflowRunActiveStates: readonly ["queued", "running", "sleeping"]; type WorkflowRunFailureKindJson = "user" | "platform"; type WorkflowDivergenceDiagnosticJson = { reason: "unknown-step-with-unconsumed-facts" | "suspended-step-not-reached" | "run-busy" | "probe-failed"; /** Step the run is currently suspended on / executing, if any. */ suspended_step_key: string | null; /** First non-memoized step the target version's code requested, if the probe got that far. */ found_step_key: string | null; /** Recorded step keys the target version's replay consumed before diverging. */ consumed_step_keys: string[]; /** Recorded step keys the target version's replay never consumed. */ unconsumed_step_keys: string[]; details: string; }; type WorkflowRunJson = { id: string; workflow_id: string; run_key: string | null; state: WorkflowRunStateJson; version: number; trigger_type: string; /** Short human-readable summary derived from the trigger payload (best-effort). */ trigger_summary: string; current_step_id: string | null; steps_recorded: number; error_summary: string | null; failure_kind: WorkflowRunFailureKindJson | null; last_upgrade_divergence: WorkflowDivergenceDiagnosticJson | null; created_at_millis: number; completed_at_millis: number | null; next_wake_at_millis: number | null; }; type WorkflowStepResultJson = { step_key: string; step_id: string; kind: "run" | "sleep"; result: unknown; result_size_bytes: number; attempts: number; executed_at_version: number; elapsed_ms: number | null; created_at_millis: number; }; type WorkflowStepAttemptJson = { step_key: string; step_id: string; /** 0 for the original execution; incremented by each manual retry of the run. */ retry_epoch: number; attempt: number; outcome: "succeeded" | "failed"; error: { name: string; message: string; stack?: string; } | null; failure_kind: WorkflowRunFailureKindJson | null; logs: string | null; started_at_millis: number; finished_at_millis: number; }; type WorkflowRunDetailsJson = WorkflowRunJson & { trigger_payload: unknown; steps: WorkflowStepResultJson[]; step_attempts: WorkflowStepAttemptJson[]; }; type WorkflowStatsJson = { /** Number of retained runs available in the workflow's run history. */total_runs: number; active_runs: number; sleeping_runs: number; failed_7d: number; /** Daily run-start counts, oldest first, exactly 14 entries. */ run_volume_14d: number[]; }; type WorkflowSummaryJson = { id: string; display_name: string; latest_version: number; triggers: WorkflowTriggerJson[]; /** Paused workflows create no new runs; their in-flight runs keep going. */ is_paused: boolean; paused_at_millis: number | null; stats: WorkflowStatsJson; created_at_millis: number; last_deployed_at_millis: number; }; type WorkflowVersionJson = { workflow_id: string; version: number; source: string; source_hash: string; runtime_env_version: string; is_latest: boolean; /** Active (queued/running/sleeping) runs pinned to this version. */ in_flight_runs: number; created_at_millis: number; }; type WorkflowSyncResultJson = { workflow_id: string; /** The latest version after the sync. */ version: number; /** False when the source (and runtime env) was unchanged, so no version was minted. */ created: boolean; /** Active runs remaining on versions older than `version`. */ in_flight_runs_on_older_versions: number; }; type WorkflowCancelRunsResultJson = { canceled_count: number; }; type WorkflowUpgradeRunsResultJson = { upgraded_count: number; skipped: { run_id: string; run_key: string | null; from_version: number; diagnostic: WorkflowDivergenceDiagnosticJson; }[]; }; type WorkflowRunsFilterJson = { state?: WorkflowRunStateJson; version?: number; run_key?: string; cursor?: string; limit?: number; /** Include each run's memoized state bag (steps) in the response. */ include_state?: boolean; }; //#endregion export { WORKFLOW_CUSTOM_EVENT_PREFIX, WORKFLOW_EVENT_PAYLOAD_MAX_BYTES, WORKFLOW_ID_REGEX, WORKFLOW_RUN_KEY_MAX_LENGTH, WORKFLOW_RUN_MEMO_MAX_BYTES, WORKFLOW_SCHEDULE_TRIGGER_TYPE, WORKFLOW_SOURCE_MAX_BYTES, WORKFLOW_STEP_MAX_ATTEMPTS, WORKFLOW_STEP_RESULT_MAX_BYTES, WORKFLOW_STEP_RETRY_BACKOFF_MS, WorkflowCancelRunsResultJson, WorkflowConflictBehavior, WorkflowDivergenceDiagnosticJson, WorkflowManifestJson, WorkflowRunDetailsJson, WorkflowRunFailureKindJson, WorkflowRunJson, WorkflowRunStateJson, WorkflowRunsFilterJson, WorkflowStatsJson, WorkflowStepAttemptJson, WorkflowStepResultJson, WorkflowSummaryJson, WorkflowSyncResultJson, WorkflowTriggerJson, WorkflowUpgradeRunsResultJson, WorkflowVersionJson, workflowPlatformEventTypes, workflowPlatformEvents, workflowRunActiveStates }; //# sourceMappingURL=workflows.d.ts.map