mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-24 06:18:04 -05:00
Compare commits
3 Commits
fix/nested
...
fix/hitl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4835817ee | ||
|
|
8a0156a578 | ||
|
|
ad7fb6e575 |
@@ -85,7 +85,11 @@ export class ConditionBlockHandler implements BlockHandler {
|
|||||||
|
|
||||||
const sourceBlockId = ctx.workflow?.connections.find((conn) => conn.target === block.id)?.source
|
const sourceBlockId = ctx.workflow?.connections.find((conn) => conn.target === block.id)?.source
|
||||||
const evalContext = this.buildEvaluationContext(ctx, sourceBlockId)
|
const evalContext = this.buildEvaluationContext(ctx, sourceBlockId)
|
||||||
const sourceOutput = sourceBlockId ? ctx.blockStates.get(sourceBlockId)?.output : null
|
const rawSourceOutput = sourceBlockId ? ctx.blockStates.get(sourceBlockId)?.output : null
|
||||||
|
|
||||||
|
// Filter out _pauseMetadata from source output to prevent the engine from
|
||||||
|
// thinking this block is pausing (it was already resumed by the HITL block)
|
||||||
|
const sourceOutput = this.filterPauseMetadata(rawSourceOutput)
|
||||||
|
|
||||||
const outgoingConnections = ctx.workflow?.connections.filter((conn) => conn.source === block.id)
|
const outgoingConnections = ctx.workflow?.connections.filter((conn) => conn.source === block.id)
|
||||||
|
|
||||||
@@ -125,6 +129,14 @@ export class ConditionBlockHandler implements BlockHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private filterPauseMetadata(output: any): any {
|
||||||
|
if (!output || typeof output !== 'object') {
|
||||||
|
return output
|
||||||
|
}
|
||||||
|
const { _pauseMetadata, ...rest } = output
|
||||||
|
return rest
|
||||||
|
}
|
||||||
|
|
||||||
private parseConditions(input: any): Array<{ id: string; title: string; value: string }> {
|
private parseConditions(input: any): Array<{ id: string; title: string; value: string }> {
|
||||||
try {
|
try {
|
||||||
const conditions = Array.isArray(input) ? input : JSON.parse(input || '[]')
|
const conditions = Array.isArray(input) ? input : JSON.parse(input || '[]')
|
||||||
|
|||||||
@@ -567,6 +567,32 @@ export class PauseResumeManager {
|
|||||||
|
|
||||||
stateCopy.blockStates[stateBlockKey] = pauseBlockState
|
stateCopy.blockStates[stateBlockKey] = pauseBlockState
|
||||||
|
|
||||||
|
// Update the block log entry with the merged output so logs show the submission data
|
||||||
|
if (Array.isArray(stateCopy.blockLogs)) {
|
||||||
|
const blockLogIndex = stateCopy.blockLogs.findIndex(
|
||||||
|
(log: { blockId: string }) =>
|
||||||
|
log.blockId === stateBlockKey ||
|
||||||
|
log.blockId === pauseBlockId ||
|
||||||
|
log.blockId === contextId
|
||||||
|
)
|
||||||
|
if (blockLogIndex !== -1) {
|
||||||
|
// Filter output for logging (exclude internal fields and response)
|
||||||
|
const filteredOutput: Record<string, unknown> = {}
|
||||||
|
for (const [key, value] of Object.entries(mergedOutput)) {
|
||||||
|
if (key.startsWith('_')) continue
|
||||||
|
if (key === 'response') continue
|
||||||
|
filteredOutput[key] = value
|
||||||
|
}
|
||||||
|
stateCopy.blockLogs[blockLogIndex] = {
|
||||||
|
...stateCopy.blockLogs[blockLogIndex],
|
||||||
|
blockId: stateBlockKey,
|
||||||
|
output: filteredOutput,
|
||||||
|
durationMs: pauseDurationMs,
|
||||||
|
endedAt: new Date().toISOString(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(stateCopy.executedBlocks)) {
|
if (Array.isArray(stateCopy.executedBlocks)) {
|
||||||
const filtered = stateCopy.executedBlocks.filter(
|
const filtered = stateCopy.executedBlocks.filter(
|
||||||
(id: string) => id !== pauseBlockId && id !== contextId
|
(id: string) => id !== pauseBlockId && id !== contextId
|
||||||
|
|||||||
Reference in New Issue
Block a user