mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-23 00:05:27 +00:00
Merge reviewed Finish delivery protection and skill formatting repair
# Conflicts: # manifests/context-packs/skill-triggers@1.json
This commit is contained in:
5 files changed
+41
-4
No files matched your search
@@ -129,7 +129,6 @@ listening" so the human knows you are connected.
|
||||
"exportPath": "…/pricing-card.edited.html", "editsPath": "…/pricing-card.edits.json" }
|
||||
```
|
||||
|
||||
|
||||
- `finish` means the human clicked **Save and Finish**. The session is over
|
||||
(`sessionEnded: true`). Read `exportPath`, diff it against your original
|
||||
mockup, read `editsPath` for the intent behind each change, and reproduce
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"id": "hand-seeded",
|
||||
"source": "manual-curation-pending-regeneration"
|
||||
},
|
||||
"registryDigest": "5d99a5f5f0ddacf246e9c772cc4a1d0531ebd2ef45f8602740c5718e781948c7",
|
||||
"registryDigest": "e1ae66afd0ca1437da7cb799d413a74a8f5171f285074c9de8bbe2630dc02265",
|
||||
"schemaVersion": 1,
|
||||
"triggers": {
|
||||
"skill:agent-runtime-gateway-smoke-test": [
|
||||
|
||||
@@ -61,6 +61,7 @@ function uiClientJs() {
|
||||
|
||||
let ended = boot.status === 'ended';
|
||||
let sending = false;
|
||||
let finishing = false;
|
||||
let mode = 'edit';
|
||||
let frameReady = false;
|
||||
let selection = null;
|
||||
@@ -208,6 +209,7 @@ function uiClientJs() {
|
||||
interact: 'Interact mode: clicks, hovers and taps reach the component. Switch back to Edit to change things.'
|
||||
};
|
||||
function setMode(next) {
|
||||
if (finishing) return;
|
||||
mode = next === 'interact' ? 'interact' : 'edit';
|
||||
document.querySelectorAll('.seg.modes button').forEach(b => b.setAttribute('aria-pressed', String(b.getAttribute('data-mode') === mode)));
|
||||
stage.setAttribute('data-mode', mode);
|
||||
@@ -223,6 +225,7 @@ function uiClientJs() {
|
||||
|
||||
// --- frame bridge ----------------------------------------------------------------
|
||||
function postToFrame(msg) {
|
||||
if (finishing && ['uc:style', 'uc:size', 'uc:remove', 'uc:edit-text', 'uc:undo', 'uc:redo', 'uc:reset'].includes(msg.type)) return;
|
||||
if (frame.contentWindow) frame.contentWindow.postMessage(msg, '*');
|
||||
}
|
||||
function requestExport() {
|
||||
@@ -243,7 +246,7 @@ function uiClientJs() {
|
||||
switch (msg.type) {
|
||||
case 'uc:ready':
|
||||
frameReady = true;
|
||||
postToFrame({ type: 'uc:set-mode', mode });
|
||||
postToFrame({ type: 'uc:set-mode', mode: finishing ? 'interact' : mode });
|
||||
postToFrame({ type: 'uc:restore', baked: submitted.flatMap(batch => batch.edits), batches: submitted, edits, deliveryRequest, scroll: lastScroll, selection: selection ? selection.selector : null, selectionRevision: selection ? selection.sourceRevision : null });
|
||||
if (paused) postToFrame({ type: 'uc:pause-animations', paused: true });
|
||||
break;
|
||||
@@ -458,6 +461,16 @@ ${inspectorClientJs()}
|
||||
if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); sendChat(); }
|
||||
});
|
||||
|
||||
function freezeForFinish(active) {
|
||||
finishing = active;
|
||||
stage.inert = active;
|
||||
$('groups').inert = active;
|
||||
$('selBody').inert = active;
|
||||
input.disabled = ended || active;
|
||||
$('editTextBtn').disabled = ended || active || !selection || !selection.editable;
|
||||
$('removeBtn').disabled = ended || active;
|
||||
postToFrame({ type: 'uc:set-mode', mode: active ? 'interact' : mode });
|
||||
}
|
||||
async function sendEdits(kind) {
|
||||
if (ended || sending) return;
|
||||
if (edits.some(edit => edit.submitted && edit.stale)) {
|
||||
@@ -465,6 +478,7 @@ ${inspectorClientJs()}
|
||||
return;
|
||||
}
|
||||
const draft = input.value;
|
||||
if (kind === 'finish') freezeForFinish(true);
|
||||
sending = true;
|
||||
sendBtn.disabled = true;
|
||||
$('applyBtn').disabled = true;
|
||||
@@ -497,6 +511,7 @@ ${inspectorClientJs()}
|
||||
postToFrame({ type: 'uc:delivery-end', requestId: deliveryRequest, accepted: false, editIds: [] });
|
||||
deliveryRequest = null;
|
||||
}
|
||||
if (kind === 'finish' && !ended) freezeForFinish(false);
|
||||
sending = false;
|
||||
sendBtn.disabled = ended;
|
||||
$('finishBtn').disabled = ended;
|
||||
|
||||
@@ -129,7 +129,6 @@ listening" so the human knows you are connected.
|
||||
"exportPath": "…/pricing-card.edited.html", "editsPath": "…/pricing-card.edits.json" }
|
||||
```
|
||||
|
||||
|
||||
- `finish` means the human clicked **Save and Finish**. The session is over
|
||||
(`sessionEnded: true`). Read `exportPath`, diff it against your original
|
||||
mockup, read `editsPath` for the intent behind each change, and reproduce
|
||||
|
||||
@@ -121,6 +121,30 @@ async function main() {
|
||||
h.node('send').handlers.click(); await tick(); h.answer({}); await tick();
|
||||
assert.equal(h.node('chatInput').value, '');
|
||||
});
|
||||
await test('Finish freezes preview and inspector mutations immediately and restores editing on failure', async () => {
|
||||
const h = client(); h.message({ type: 'uc:edits', edits: [first], canUndo: true });
|
||||
h.node('finishBtn').handlers.click();
|
||||
assert.equal(h.node('stage').inert, true); assert.equal(h.node('groups').inert, true);
|
||||
assert.equal(h.node('chatInput').disabled, true);
|
||||
assert.ok(h.packets.some(packet => packet.type === 'uc:set-mode' && packet.mode === 'interact'));
|
||||
h.message({ type: 'uc:ready' });
|
||||
assert.equal(h.packets.filter(packet => packet.type === 'uc:set-mode').at(-1).mode, 'interact', 'A frame reload must retain the Finish freeze');
|
||||
h.node('removeBtn').handlers.click();
|
||||
assert.ok(!h.packets.some(packet => packet.type === 'uc:remove'));
|
||||
const packet = h.packets.find(item => item.type === 'uc:export');
|
||||
h.message({ type: 'uc:export', requestId: packet.requestId, edits: [first], html: '<html></html>' }); await tick();
|
||||
h.fail(); await tick();
|
||||
assert.equal(h.node('stage').inert, false); assert.equal(h.node('groups').inert, false);
|
||||
assert.equal(h.node('chatInput').disabled, false); assert.equal(h.node('finishBtn').disabled, false);
|
||||
assert.deepEqual(h.saved().edits, [first]);
|
||||
assert.ok(h.packets.some(packet => packet.type === 'uc:set-mode' && packet.mode === 'edit'));
|
||||
h.message({ type: 'uc:toggle-mode' });
|
||||
h.node('finishBtn').handlers.click();
|
||||
const retry = h.packets.filter(item => item.type === 'uc:export').at(-1);
|
||||
h.message({ type: 'uc:export', requestId: retry.requestId, edits: [first], html: '<html></html>' }); await tick();
|
||||
h.fail(); await tick();
|
||||
assert.equal(h.packets.filter(packet => packet.type === 'uc:set-mode').at(-1).mode, 'interact', 'Failure restores the prior interaction mode');
|
||||
});
|
||||
await test('snapshot boundary prevents rapid nudge, style and resize coalescing', () => {
|
||||
const source = editorGesturesJs();
|
||||
const start = source.indexOf(' function nudgeBy(');
|
||||
|
||||
Reference in new issue
Block a user