You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

18 lines
871 B

export function completionTypeForAcceptResult(eventType, acceptResult) {
if (eventType === 'discard') return acceptResult?.handled === true ? 'discarded' : 'error';
if (acceptResult?.handled === true && acceptResult?.carbonize === true) return 'agent_done';
if (acceptResult?.handled === true) return 'complete';
if (acceptResult?.mode === 'error') return 'error';
return 'agent_done';
}
export function completionAckForAcceptResult(eventId, completionType, acceptResult) {
const ack = { ok: true, type: completionType };
if (acceptResult?.handled === true && acceptResult?.carbonize === true) {
ack.final = false;
ack.requiresComplete = true;
ack.nextCommand = `live-complete.mjs --id ${eventId}`;
ack.message = 'Carbonize cleanup must be verified, then the session must be completed explicitly before polling again.';
}
return ack;
}