mirror of
https://github.com/boxpositron/absolute-dotfiles.git
synced 2026-10-24 08:23:19 +00:00
chore(omo): vendor impeccable skill 4.6.0
Re-copy .opencode/skills/impeccable from upstream tag skill-v4.6.0 (8a0e198, engine 0.1.15), keep LICENSE, and re-apply the OmO path rewrite and the critique routing line. The documented rewrite missed the base-directory fallback in SKILL.md, which ends at scripts rather than scripts/impeccable, so the upgrade command now rewrites the scripts directory prefix. The skills README also notes that the engine binary is downloaded by scripts/VERSION rather than vendored.
This commit is contained in:
@@ -1 +1 @@
|
||||
0.1.5
|
||||
0.1.15
|
||||
|
||||
@@ -59,7 +59,7 @@ if errorlevel 1 goto download
|
||||
call :probe impeccable
|
||||
if not "%probe_ok%"=="1" goto download
|
||||
impeccable %*
|
||||
exit /b
|
||||
exit /b %errorlevel%
|
||||
|
||||
:download
|
||||
rem Last resort: fetch this version's binary from the release channel into
|
||||
@@ -166,7 +166,7 @@ exit /b 127
|
||||
|
||||
:run
|
||||
"%run%" %*
|
||||
exit /b
|
||||
exit /b %errorlevel%
|
||||
|
||||
:probe
|
||||
rem Sets probe_ok=1 when %1 answers the engine handshake: prints
|
||||
|
||||
@@ -100,8 +100,108 @@
|
||||
return doc.body;
|
||||
}
|
||||
|
||||
// A modal <dialog> (showModal) paints in the top layer and makes every
|
||||
// node outside its subtree inert, so chrome on <body> can be neither seen
|
||||
// nor clicked while one is open, and no z-index reaches it (issue #879).
|
||||
// While a modal is open the chrome parks inside the topmost one, in one
|
||||
// popover: inside the dialog it is not inert, and a popover shown after
|
||||
// the dialog paints above it. One popover for all of it, because
|
||||
// top-layer entries stack by show order, which would drop the z-index
|
||||
// order between the roots. The detect overlay (browser-bundle/
|
||||
// 40-overlay.js) mounts its outlines here too: it finds the host by this
|
||||
// id and places its outlines again on the event of the same name, fired
|
||||
// on every move.
|
||||
const topLayerHost = doc.createElement('div');
|
||||
topLayerHost.id = prefix + '-top-layer';
|
||||
// Same box as the SvelteKit shadow host: 0x0, fixed, chrome overflows it.
|
||||
// `all: initial` also clears the popover UA box.
|
||||
for (const [name, value] of Object.entries({
|
||||
all: 'initial', position: 'fixed', top: '0', left: '0', width: '0', height: '0', overflow: 'visible',
|
||||
})) topLayerHost.style.setProperty(name, value, 'important');
|
||||
const pageRoots = new WeakSet(); // chrome nodes mounted on the page itself
|
||||
const openModals = []; // in the order they opened; last is topmost
|
||||
|
||||
// Modals that were open before watching began have no readable top-layer
|
||||
// order, but the topmost one's backdrop covers the viewport, so a hit
|
||||
// test lands in it. Raise that one to the top of the stack.
|
||||
function raiseHitModal() {
|
||||
const i = openModals.indexOf(doc.elementFromPoint(0, 0)?.closest('dialog:modal'));
|
||||
if (i !== -1) openModals.push(...openModals.splice(i, 1));
|
||||
}
|
||||
|
||||
function syncTopLayerHost(records = []) {
|
||||
for (const { type, target, oldValue } of records) {
|
||||
if (type !== 'attributes' || oldValue !== null || !target.matches('dialog:modal')) continue;
|
||||
// Opened, or closed and reopened in one task (the observer sees only
|
||||
// the end state): either way it is back on top of the top layer, so
|
||||
// a host shown inside it earlier has to be shown again. A write to an
|
||||
// `open` that was already set (oldValue not null) moved nothing.
|
||||
const i = openModals.indexOf(target);
|
||||
if (i !== -1) openModals.splice(i, 1);
|
||||
openModals.push(target);
|
||||
if (topLayerHost.parentNode === target) topLayerHost.remove();
|
||||
}
|
||||
// A closed dialog, or one removed from the document while open, stops
|
||||
// matching :modal. Whichever is now on top may predate the watch.
|
||||
const before = openModals.length;
|
||||
for (let i = openModals.length - 1; i >= 0; i--) {
|
||||
if (!openModals[i].matches('dialog:modal')) openModals.splice(i, 1);
|
||||
}
|
||||
if (openModals.length < before && openModals.length > 1) raiseHitModal();
|
||||
const modal = openModals[openModals.length - 1] || null;
|
||||
if (topLayerHost.parentNode === modal) return;
|
||||
if (modal) {
|
||||
modal.appendChild(topLayerHost);
|
||||
for (const el of [...doc.body.children]) if (pageRoots.has(el)) topLayerHost.appendChild(el);
|
||||
topLayerHost.showPopover();
|
||||
} else {
|
||||
doc.body.append(...topLayerHost.childNodes);
|
||||
topLayerHost.remove();
|
||||
}
|
||||
doc.dispatchEvent(new Event(topLayerHost.id));
|
||||
}
|
||||
|
||||
// Returns the function that stops watching and puts the chrome back.
|
||||
function watchModalDialogs() {
|
||||
if (typeof topLayerHost.showPopover !== 'function') return () => {};
|
||||
topLayerHost.popover = 'manual';
|
||||
// Parked in the page's dialog, chrome clicks would bubble into its own
|
||||
// handlers, such as a click-outside-the-box close. Live listens in capture.
|
||||
topLayerHost.addEventListener('click', (e) => e.stopPropagation());
|
||||
openModals.push(...doc.querySelectorAll('dialog:modal'));
|
||||
raiseHitModal();
|
||||
const observer = new MutationObserver(syncTopLayerHost);
|
||||
observer.observe(doc, { subtree: true, childList: true, attributes: true, attributeOldValue: true, attributeFilter: ['open'] });
|
||||
syncTopLayerHost();
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
openModals.length = 0;
|
||||
syncTopLayerHost();
|
||||
};
|
||||
}
|
||||
|
||||
// A copy of a page element without the chrome parked inside it, which a
|
||||
// picked modal dialog contains.
|
||||
function cloneWithoutChrome(el) {
|
||||
const clone = el.cloneNode(true);
|
||||
if (el.contains(topLayerHost)) clone.querySelector('#' + cssId(topLayerHost.id)).remove();
|
||||
return clone;
|
||||
}
|
||||
|
||||
// Mount a chrome node on the page itself: <body>, or the top-layer host
|
||||
// while the chrome is parked in a modal.
|
||||
function uiAppendToPage(el) {
|
||||
pageRoots.add(el);
|
||||
(topLayerHost.parentNode ? topLayerHost : doc.body).appendChild(el);
|
||||
return el;
|
||||
}
|
||||
|
||||
function uiAppend(el) {
|
||||
liveUiRoot().appendChild(el);
|
||||
const uiRoot = liveUiRoot();
|
||||
if (uiRoot === doc.body) return uiAppendToPage(el);
|
||||
// An adapter shadow root: its host is the node that sits on the page.
|
||||
if (uiRoot.host) pageRoots.add(uiRoot.host);
|
||||
uiRoot.appendChild(el);
|
||||
return el;
|
||||
}
|
||||
|
||||
@@ -142,6 +242,15 @@
|
||||
rootEl.addEventListener('focusin', stop);
|
||||
}
|
||||
|
||||
// The half of the defang that cannot sit on the chrome: a focus trap (Radix /
|
||||
// Reka FocusScope) also hears the page's own focusout as focus leaves its
|
||||
// modal for our chrome, and pulls it back. Register on the document in
|
||||
// capture, ahead of the trap. The page's own focusout handlers miss that
|
||||
// one transition too; blur still fires.
|
||||
function stopFocusOutIntoChrome(e) {
|
||||
if (own(e.relatedTarget)) e.stopPropagation();
|
||||
}
|
||||
|
||||
return {
|
||||
own,
|
||||
pickable,
|
||||
@@ -153,10 +262,15 @@
|
||||
cssId,
|
||||
liveUiRoot,
|
||||
uiAppend,
|
||||
uiAppendToPage,
|
||||
topLayerHost,
|
||||
watchModalDialogs,
|
||||
cloneWithoutChrome,
|
||||
uiAppendStyle,
|
||||
uiGetById,
|
||||
activeElementDeep,
|
||||
defangOutsideHandlers,
|
||||
stopFocusOutIntoChrome,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,10 @@
|
||||
|
||||
function saveSession(session) {
|
||||
if (!session || !session.id) return;
|
||||
// Adopt a revision another tab stored so this write does not lower it.
|
||||
// localStorage has no compare-and-set, so a save from another tab that
|
||||
// lands between this read and the write below can still be overwritten.
|
||||
loadSession();
|
||||
const payload = {
|
||||
...session,
|
||||
checkpointRevision,
|
||||
@@ -56,8 +60,8 @@
|
||||
}
|
||||
|
||||
function nextCheckpointRevision() {
|
||||
checkpointRevision += 1;
|
||||
const existing = loadSession();
|
||||
checkpointRevision += 1;
|
||||
if (existing?.id) saveSession(existing);
|
||||
return checkpointRevision;
|
||||
}
|
||||
|
||||
@@ -265,6 +265,7 @@
|
||||
let editBadgeEl = null;
|
||||
let editBadgeProxyRoot = null;
|
||||
let editBadgeProxyByTarget = new Map();
|
||||
let stopModalWatch = null;
|
||||
|
||||
//
|
||||
// Helpers
|
||||
@@ -291,10 +292,15 @@
|
||||
cssId,
|
||||
liveUiRoot,
|
||||
uiAppend,
|
||||
uiAppendToPage,
|
||||
topLayerHost,
|
||||
watchModalDialogs,
|
||||
cloneWithoutChrome,
|
||||
uiAppendStyle,
|
||||
uiGetById,
|
||||
activeElementDeep,
|
||||
defangOutsideHandlers,
|
||||
stopFocusOutIntoChrome,
|
||||
} = domHelpers;
|
||||
|
||||
window.__IMPECCABLE_LIVE_CHROME_CORE__ = {
|
||||
@@ -863,8 +869,15 @@
|
||||
setTimeout(() => input.focus(), 0);
|
||||
}
|
||||
|
||||
// The Enter that commits an IME candidate (Zhuyin, Pinyin, kana, Hangul) is
|
||||
// not a submit. Safari fires that keydown after compositionend, so
|
||||
// isComposing is already false there and keyCode 229 is the only signal.
|
||||
function isImeKeydown(e) {
|
||||
return e.isComposing || e.keyCode === 229;
|
||||
}
|
||||
|
||||
function onAnnotInputKey(e) {
|
||||
if (e.key === 'Enter') {
|
||||
if (e.key === 'Enter' && !isImeKeydown(e)) {
|
||||
e.preventDefault(); e.stopPropagation();
|
||||
finalizeEditingPin();
|
||||
} else if (e.key === 'Escape') {
|
||||
@@ -967,11 +980,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
function sanitizedContextOuterHTML(el, maxLength) {
|
||||
if (!el || !el.cloneNode) return '';
|
||||
const clone = el.cloneNode(true);
|
||||
// The element as the agent reads it, text and markup alike: no parked
|
||||
// chrome (a picked modal dialog contains it) and no edit runtime state.
|
||||
function sanitizedContextClone(el) {
|
||||
const clone = cloneWithoutChrome(el);
|
||||
stripManualEditRuntimeState(clone);
|
||||
return clone.outerHTML ? clone.outerHTML.slice(0, maxLength) : '';
|
||||
return clone;
|
||||
}
|
||||
|
||||
function extractContext(el) {
|
||||
@@ -1001,12 +1015,13 @@
|
||||
: (anchorClasses.length ? el.tagName.toLowerCase() + '.' + anchorClasses.join('.') : null);
|
||||
let anchorMatches = null;
|
||||
if (anchor) { try { anchorMatches = document.querySelectorAll(anchor).length; } catch { anchorMatches = null; } }
|
||||
const clone = sanitizedContextClone(el);
|
||||
return {
|
||||
tagName: el.tagName.toLowerCase(), id: el.id || null,
|
||||
classes: [...el.classList],
|
||||
anchor, anchorMatches,
|
||||
textContent: (el.textContent || '').slice(0, 500),
|
||||
outerHTML: sanitizedContextOuterHTML(el, 10000),
|
||||
textContent: (clone.textContent || '').slice(0, 500),
|
||||
outerHTML: (clone.outerHTML || '').slice(0, 10000),
|
||||
computedStyles: {
|
||||
'font-family': cs.fontFamily, 'font-size': cs.fontSize,
|
||||
'font-weight': cs.fontWeight, 'line-height': cs.lineHeight,
|
||||
@@ -2456,7 +2471,7 @@
|
||||
input.addEventListener('focus', () => syncConfigureInputChrome());
|
||||
input.addEventListener('blur', () => syncConfigureInputChrome());
|
||||
input.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') { e.stopPropagation(); e.preventDefault(); handleGo(); return; }
|
||||
if (e.key === 'Enter' && !isImeKeydown(e)) { e.stopPropagation(); e.preventDefault(); handleGo(); return; }
|
||||
if (e.key === 'Escape') {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
@@ -2542,7 +2557,7 @@
|
||||
try { input.focus({ preventScroll: true }); } catch { input.focus(); }
|
||||
});
|
||||
input.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
if (e.key === 'Enter' && !isImeKeydown(e)) {
|
||||
e.stopPropagation(); e.preventDefault();
|
||||
if (isInsertCreateEnabled()) handleInsertCreate();
|
||||
return;
|
||||
@@ -3710,6 +3725,7 @@
|
||||
|
||||
function copyEditLeafContext(el, originalText, newText) {
|
||||
if (!el) return null;
|
||||
const clone = sanitizedContextClone(el);
|
||||
return {
|
||||
ref: documentRefForElement(el),
|
||||
tagName: el.tagName ? el.tagName.toLowerCase() : null,
|
||||
@@ -3717,8 +3733,8 @@
|
||||
classes: el.classList ? [...el.classList].filter((cls) => cls.indexOf('impeccable-') !== 0) : [],
|
||||
originalText,
|
||||
newText,
|
||||
textContent: (el.textContent || '').slice(0, 500),
|
||||
outerHTML: sanitizedContextOuterHTML(el, 3000) || null,
|
||||
textContent: (clone.textContent || '').slice(0, 500),
|
||||
outerHTML: (clone.outerHTML || '').slice(0, 3000) || null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3744,13 +3760,14 @@
|
||||
|
||||
function copyEditContainerContext(el) {
|
||||
if (!el) return null;
|
||||
const clone = sanitizedContextClone(el);
|
||||
return {
|
||||
ref: documentRefForElement(el),
|
||||
tagName: el.tagName ? el.tagName.toLowerCase() : null,
|
||||
id: el.id || null,
|
||||
classes: el.classList ? [...el.classList].filter((cls) => cls.indexOf('impeccable-') !== 0) : [],
|
||||
textContent: (el.textContent || '').slice(0, 1000),
|
||||
outerHTML: sanitizedContextOuterHTML(el, 10000) || null,
|
||||
textContent: (clone.textContent || '').slice(0, 1000),
|
||||
outerHTML: (clone.outerHTML || '').slice(0, 10000) || null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4540,7 +4557,7 @@
|
||||
for (const [name, value] of Object.entries(styles)) {
|
||||
setImportantStyle(editBadgeProxyRoot, name.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase()), value);
|
||||
}
|
||||
document.body.appendChild(editBadgeProxyRoot);
|
||||
uiAppendToPage(editBadgeProxyRoot);
|
||||
}
|
||||
|
||||
function styleEditBadgeProxy(proxy, target) {
|
||||
@@ -8032,8 +8049,8 @@
|
||||
let depth = 0;
|
||||
while (node && depth < 12) {
|
||||
// 1. Active dialog / modal
|
||||
if (node.getAttribute && node.getAttribute('role') === 'dialog'
|
||||
&& node.getAttribute('aria-modal') === 'true') {
|
||||
if (node.tagName === 'DIALOG' || (node.getAttribute && node.getAttribute('role') === 'dialog'
|
||||
&& node.getAttribute('aria-modal') === 'true')) {
|
||||
showToast('Heads up: this element lives inside a dialog. If state resets during generation, you may need to re-open it.', 6000);
|
||||
return;
|
||||
}
|
||||
@@ -8645,6 +8662,7 @@
|
||||
const opts = {
|
||||
scale: Math.min(window.devicePixelRatio || 1, 2),
|
||||
font: fontCssText ? { cssText: fontCssText } : undefined,
|
||||
filter: (node) => node !== topLayerHost,
|
||||
};
|
||||
if (shouldUseAncestorCropShaderProxy(el)) {
|
||||
try {
|
||||
@@ -11431,7 +11449,7 @@ void main() {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (e.key === 'Enter') {
|
||||
if (e.key === 'Enter' && !isImeKeydown(e)) {
|
||||
e.preventDefault();
|
||||
submitSteerMessage();
|
||||
}
|
||||
@@ -12249,6 +12267,7 @@ void main() {
|
||||
pagePickSkipClick = false;
|
||||
cleanup();
|
||||
hideBar();
|
||||
if (stopModalWatch) { stopModalWatch(); stopModalWatch = null; }
|
||||
if (pendingDockResizeObserver) { pendingDockResizeObserver.disconnect(); pendingDockResizeObserver = null; }
|
||||
window.removeEventListener('resize', positionPendingDock);
|
||||
if (pendingIntroAnimation) { pendingIntroAnimation.cancel(); pendingIntroAnimation = null; }
|
||||
@@ -12286,6 +12305,7 @@ void main() {
|
||||
document.removeEventListener('mousemove', handleMouseMove, true);
|
||||
document.removeEventListener('click', handleClick, true);
|
||||
document.removeEventListener('keydown', handleKeyDown, true);
|
||||
document.removeEventListener('focusout', stopFocusOutIntoChrome, true);
|
||||
window.removeEventListener('message', onDetectMessage);
|
||||
// Remove detection overlays
|
||||
window.postMessage({ source: 'impeccable-command', action: 'remove' }, '*');
|
||||
@@ -13466,10 +13486,12 @@ void main() {
|
||||
attachSteerFocusDebug();
|
||||
attachSteerFocusGuard();
|
||||
initDesignPanel();
|
||||
stopModalWatch = watchModalDialogs();
|
||||
fetchPendingCount();
|
||||
document.addEventListener('mousemove', handleMouseMove, true);
|
||||
document.addEventListener('click', handleClick, true);
|
||||
document.addEventListener('keydown', handleKeyDown, true);
|
||||
document.addEventListener('focusout', stopFocusOutIntoChrome, true);
|
||||
connectSSE();
|
||||
|
||||
// Check for an active session to resume (variant wrapper already in DOM after HMR)
|
||||
|
||||
Reference in New Issue
Block a user