remora-monorepo / lib / applyDelta
Function: applyDelta()
applyDelta(
state,delta):object
Defined in: packages/core/src/executor/state.ts:246
Apply a delta to an execution state, returning a new state. Pure — no mutations.
Parameters
state
completedAt?
string = "string"
durationMs?
number = "number"
error?
{ category: string; code: string; isRetryable?: boolean; message: string; statusCode?: number; stepId?: string; } = errorSnapshotSchema
error.category
string = "string"
error.code
string = "string"
error.isRetryable?
boolean = "boolean"
error.message
string = "string"
error.statusCode?
number = "number"
error.stepId?
string = "string"
output?
unknown = "unknown"
runId
string = "string"
startedAt
string = "string"
status
"pending" | "running" | "completed" | "failed" = runStatusSchema
stepRecords
object[] = ...
workflowHash?
string = "string"
delta
{ runId: string; startedAt: string; type: "run-started"; } | { path: ({ itemValue: unknown; iterationIndex: number; stepId: string; type: "for-each"; } | { matchedCaseIndex: number; matchedValue: unknown; stepId: string; type: "switch-case"; } | { pollAttempt: number; stepId: string; type: "wait-for-condition"; })[]; startedAt: string; stepId: string; type: "step-started"; } | { completedAt: string; durationMs: number; output: unknown; path: ({ itemValue: unknown; iterationIndex: number; stepId: string; type: "for-each"; } | { matchedCaseIndex: number; matchedValue: unknown; stepId: string; type: "switch-case"; } | { pollAttempt: number; stepId: string; type: "wait-for-condition"; })[]; resolvedInputs?: unknown; stepId: string; trace?: ({ data?: unknown; message: string; type: "log"; } | { step: unknown; type: "agent-step"; })[]; type: "step-completed"; } | { durationMs: number; error: { category: string; code: string; isRetryable?: boolean; message: string; statusCode?: number; stepId?: string; }; failedAt: string; path: ({ itemValue: unknown; iterationIndex: number; stepId: string; type: "for-each"; } | { matchedCaseIndex: number; matchedValue: unknown; stepId: string; type: "switch-case"; } | { pollAttempt: number; stepId: string; type: "wait-for-condition"; })[]; resolvedInputs?: unknown; stepId: string; type: "step-failed"; } | { path: ({ itemValue: unknown; iterationIndex: number; stepId: string; type: "for-each"; } | { matchedCaseIndex: number; matchedValue: unknown; stepId: string; type: "switch-case"; } | { pollAttempt: number; stepId: string; type: "wait-for-condition"; })[]; retry: { attempt: number; errorCode: string; errorMessage: string; failedAt: string; startedAt: string; }; stepId: string; type: "step-retry"; } | { completedAt: string; durationMs: number; output?: unknown; runId: string; type: "run-completed"; } | { durationMs: number; error: { category: string; code: string; isRetryable?: boolean; message: string; statusCode?: number; stepId?: string; }; failedAt: string; runId: string; type: "run-failed"; } | { path: ({ itemValue: unknown; iterationIndex: number; stepId: string; type: "for-each"; } | { matchedCaseIndex: number; matchedValue: unknown; stepId: string; type: "switch-case"; } | { pollAttempt: number; stepId: string; type: "wait-for-condition"; })[]; requestedAt: string; sourcePolicyId: string; stepId: string; type: "step-awaiting-approval"; } | { approvedAt: string; path: ({ itemValue: unknown; iterationIndex: number; stepId: string; type: "for-each"; } | { matchedCaseIndex: number; matchedValue: unknown; stepId: string; type: "switch-case"; } | { pollAttempt: number; stepId: string; type: "wait-for-condition"; })[]; sourcePolicyId: string; stepId: string; type: "step-approved"; } | { deniedAt: string; path: ({ itemValue: unknown; iterationIndex: number; stepId: string; type: "for-each"; } | { matchedCaseIndex: number; matchedValue: unknown; stepId: string; type: "switch-case"; } | { pollAttempt: number; stepId: string; type: "wait-for-condition"; })[]; reason?: string; sourcePolicyId: string; stepId: string; type: "step-denied"; }
Returns
object
completedAt?
optionalcompletedAt:string="string"
durationMs?
optionaldurationMs:number="number"
error?
optionalerror:object=errorSnapshotSchema
error.category
category:
string="string"
error.code
code:
string="string"
error.isRetryable?
optionalisRetryable:boolean="boolean"
error.message
message:
string="string"
error.statusCode?
optionalstatusCode:number="number"
error.stepId?
optionalstepId:string="string"
output?
optionaloutput:unknown="unknown"
runId
runId:
string="string"
startedAt
startedAt:
string="string"
status
status:
"pending"|"running"|"completed"|"failed"=runStatusSchema
stepRecords
stepRecords:
object[]
workflowHash?
optionalworkflowHash:string="string"