Bug fixes
This commit is contained in:
28
.agents/skills/impeccable/scripts/live/completion.mjs
Normal file
28
.agents/skills/impeccable/scripts/live/completion.mjs
Normal file
@@ -0,0 +1,28 @@
|
||||
// A preview whose variants live in component modules rather than in the user's
|
||||
// source. These leave no markers in the real file, so a failed accept gives the
|
||||
// agent nothing to hand-edit and must be reported as a failure rather than
|
||||
// reference/live.md's manual-cleanup handoff. Kept as a set: any future
|
||||
// component-module preview mode belongs here the day it lands.
|
||||
const PREVIEW_MODES_WITHOUT_SOURCE_MARKERS = new Set([
|
||||
'svelte-component',
|
||||
]);
|
||||
|
||||
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';
|
||||
if (eventType === 'accept' && PREVIEW_MODES_WITHOUT_SOURCE_MARKERS.has(acceptResult?.previewMode)) 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;
|
||||
}
|
||||
Reference in New Issue
Block a user