@floless/app 0.127.3 → 0.127.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +2038 -1463
- package/dist/web/app.css +36 -4
- package/dist/web/aware.js +138 -22
- package/dist/web/index.html +2 -1
- package/dist/web/steel-editor.html +14 -8
- package/package.json +1 -1
package/dist/web/app.css
CHANGED
|
@@ -1305,14 +1305,16 @@
|
|
|
1305
1305
|
justify-content: center;
|
|
1306
1306
|
}
|
|
1307
1307
|
.modal-backdrop.show { display: flex; animation: fade-in 0.15s ease-out; }
|
|
1308
|
-
/* The shared form
|
|
1309
|
-
over Requests, the folder over Integrations — so
|
|
1308
|
+
/* The shared form and confirmation modals are the ones OTHER modals open on top of themselves —
|
|
1309
|
+
run options and desktop-claim release over Requests, the folder over Integrations — so they
|
|
1310
|
+
cannot share their z-index. Every backdrop
|
|
1310
1311
|
sitting at 100 means DOM ORDER decides, and #form-modal is declared before #requests-modal:
|
|
1311
|
-
the
|
|
1312
|
+
the nested modal paints UNDERNEATH, its buttons swallowed by the .req-item behind it. Not a paint bug
|
|
1312
1313
|
you could see, either — the dialog looked fine and simply refused to respond, which is why it
|
|
1313
1314
|
is pinned here rather than fixed by moving the element and hoping. Still below toasts (200),
|
|
1314
1315
|
which must stay readable over anything. */
|
|
1315
|
-
#form-modal
|
|
1316
|
+
#form-modal,
|
|
1317
|
+
#confirm-modal { z-index: 110; }
|
|
1316
1318
|
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
1317
1319
|
.modal {
|
|
1318
1320
|
background: var(--surface);
|
|
@@ -2067,6 +2069,36 @@
|
|
|
2067
2069
|
.req-run-resume-command:hover { border-color: var(--accent-dim); background: var(--accent-soft); color: var(--text); }
|
|
2068
2070
|
.req-run-resume-command:active { background: var(--surface-3); }
|
|
2069
2071
|
.req-run-resume-command:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
2072
|
+
.req-app-recovery, .req-app-claimed { display: flex; flex-direction: column; gap: 7px;
|
|
2073
|
+
padding: 9px; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface-2); }
|
|
2074
|
+
.req-app-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
|
2075
|
+
.req-app-handoff, .req-app-release { min-height: 40px; padding: 0 12px; border: 1px solid var(--border-strong);
|
|
2076
|
+
border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; text-align: center;
|
|
2077
|
+
appearance: none; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
|
|
2078
|
+
color: var(--accent-bright); background: transparent; transition: border-color .12s, background .12s, color .12s; }
|
|
2079
|
+
.req-app-handoff { width: auto; flex: 0 0 auto; }
|
|
2080
|
+
.req-app-handoff:disabled { cursor: wait; opacity: .65; }
|
|
2081
|
+
.req-app-handoff-primary { color: var(--text); border-color: var(--accent); background: var(--accent); }
|
|
2082
|
+
.req-app-handoff:hover, .req-app-release:hover { border-color: var(--accent-dim); background: var(--accent-soft); color: var(--text); }
|
|
2083
|
+
.req-app-handoff-primary:hover { border-color: var(--accent-bright); background: var(--accent-bright); color: var(--bg); }
|
|
2084
|
+
.req-app-handoff:focus-visible, .req-app-release:focus-visible, .req-app-copy:focus-visible,
|
|
2085
|
+
.req-terminal-fallback > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
2086
|
+
.req-app-launch-status { min-height: 16px; color: var(--text-muted); font-size: 10.5px; }
|
|
2087
|
+
.req-app-launch-status:empty { display: none; }
|
|
2088
|
+
.req-app-copy { width: fit-content; min-height: 40px; padding: 0; appearance: none; border: 0;
|
|
2089
|
+
background: transparent; color: var(--text-muted); font: inherit; font-size: 10.5px; cursor: pointer; }
|
|
2090
|
+
.req-app-copy:hover { color: var(--accent-bright); }
|
|
2091
|
+
.req-app-claimed strong { color: var(--text); }
|
|
2092
|
+
.req-app-claimed span { color: var(--text-muted); }
|
|
2093
|
+
.req-app-release { width: 100%; color: var(--text-muted); }
|
|
2094
|
+
.req-terminal-fallback { padding-top: 2px; }
|
|
2095
|
+
.req-terminal-fallback > summary { min-height: 40px; display: flex; align-items: center; list-style: none;
|
|
2096
|
+
cursor: pointer; color: var(--text-dim); user-select: none; }
|
|
2097
|
+
.req-terminal-fallback > summary::-webkit-details-marker { display: none; }
|
|
2098
|
+
.req-terminal-fallback > summary::before { content: '▸'; margin-right: 6px; color: var(--text-dim); }
|
|
2099
|
+
.req-terminal-fallback[open] > summary::before { content: '▾'; }
|
|
2100
|
+
.req-terminal-fallback .req-run-resume { margin-top: 5px; }
|
|
2101
|
+
.req-terminal-fallback .req-run-where { margin-top: 5px; }
|
|
2070
2102
|
/* The agent's question, VERBATIM. A quote, deliberately — the warn rule and the italic say
|
|
2071
2103
|
"somebody said this to you", where a plain paragraph would read as floless's own prose and a
|
|
2072
2104
|
field would read as somewhere to answer. There is nowhere to answer; that is the point. */
|
package/dist/web/aware.js
CHANGED
|
@@ -3249,35 +3249,58 @@
|
|
|
3249
3249
|
function hideModal(el) { el.classList.remove('show'); }
|
|
3250
3250
|
|
|
3251
3251
|
// Save-on-switch confirmation. Resolves with 'save' | 'discard' | 'cancel'.
|
|
3252
|
-
//
|
|
3252
|
+
// Enter belongs to the focused native button; Esc and the backdrop cancel (the safe,
|
|
3253
3253
|
// non-destructive default — never lose edits to a stray key/click).
|
|
3254
3254
|
const $confirmModal = document.getElementById('confirm-modal');
|
|
3255
|
-
|
|
3255
|
+
let _confirmModalOpen = false;
|
|
3256
|
+
function confirmUnsavedSwitch(appName, subMsg, titleMsg, actionLabels) {
|
|
3256
3257
|
return new Promise((resolve) => {
|
|
3258
|
+
if (_confirmModalOpen) { console.warn('confirmUnsavedSwitch: confirmation already open'); resolve('cancel'); return; }
|
|
3259
|
+
const returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
3257
3260
|
const $title = document.getElementById('confirm-modal-title');
|
|
3258
3261
|
const $sub = document.getElementById('confirm-modal-sub');
|
|
3259
3262
|
const $save = document.getElementById('confirm-save');
|
|
3260
3263
|
const $dont = document.getElementById('confirm-dont-save');
|
|
3261
3264
|
const $cancel = document.getElementById('confirm-cancel');
|
|
3265
|
+
$save.textContent = (actionLabels && actionLabels.confirm) || 'Save';
|
|
3266
|
+
$dont.textContent = (actionLabels && actionLabels.discard) || 'Don’t save';
|
|
3267
|
+
$cancel.textContent = (actionLabels && actionLabels.cancel) || 'Cancel';
|
|
3268
|
+
$dont.hidden = !!(actionLabels && actionLabels.hideDiscard);
|
|
3262
3269
|
$title.textContent = titleMsg || 'Unsaved input changes'; // reset each call (default = the inputs-switch copy)
|
|
3263
3270
|
$sub.textContent = subMsg || `You changed the inputs for “${appName}” but haven’t saved them yet. What would you like to do?`;
|
|
3264
3271
|
showModal($confirmModal);
|
|
3265
|
-
|
|
3272
|
+
_confirmModalOpen = true;
|
|
3273
|
+
setTimeout(() => ((actionLabels && actionLabels.initialFocus === 'cancel') ? $cancel : $save).focus(), 0);
|
|
3274
|
+
let settled = false;
|
|
3266
3275
|
const done = (result) => {
|
|
3276
|
+
if (settled) return;
|
|
3277
|
+
settled = true;
|
|
3278
|
+
_confirmModalOpen = false;
|
|
3267
3279
|
hideModal($confirmModal);
|
|
3268
|
-
$
|
|
3269
|
-
|
|
3280
|
+
$dont.hidden = false;
|
|
3281
|
+
$save.onclick = $dont.onclick = $cancel.onclick = $confirmModal.onclick = $confirmModal.onkeydown = null;
|
|
3282
|
+
if (returnFocus && returnFocus.isConnected && !returnFocus.matches(':disabled,[aria-disabled="true"]')) returnFocus.focus();
|
|
3270
3283
|
resolve(result);
|
|
3271
3284
|
};
|
|
3272
3285
|
const onKey = (e) => {
|
|
3273
|
-
if (e.key === 'Escape') { e.preventDefault(); done('cancel'); }
|
|
3274
|
-
else if (e.key === '
|
|
3286
|
+
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); done('cancel'); }
|
|
3287
|
+
else if (e.key === 'Tab') {
|
|
3288
|
+
const focusable = Array.from($confirmModal.querySelectorAll('button:not([disabled]):not([hidden]), [tabindex]:not([tabindex="-1"])'))
|
|
3289
|
+
.filter((el) => el instanceof HTMLElement && !el.hidden && el.getClientRects().length);
|
|
3290
|
+
if (!focusable.length) { e.preventDefault(); return; }
|
|
3291
|
+
const first = focusable[0]; const last = focusable[focusable.length - 1];
|
|
3292
|
+
if (e.shiftKey && (document.activeElement === first || !$confirmModal.contains(document.activeElement))) {
|
|
3293
|
+
e.preventDefault(); last.focus();
|
|
3294
|
+
} else if (!e.shiftKey && (document.activeElement === last || !$confirmModal.contains(document.activeElement))) {
|
|
3295
|
+
e.preventDefault(); first.focus();
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3275
3298
|
};
|
|
3276
3299
|
$save.onclick = () => done('save');
|
|
3277
3300
|
$dont.onclick = () => done('discard');
|
|
3278
3301
|
$cancel.onclick = () => done('cancel');
|
|
3279
3302
|
onBackdropDismiss($confirmModal, () => done('cancel'));
|
|
3280
|
-
|
|
3303
|
+
$confirmModal.onkeydown = onKey;
|
|
3281
3304
|
});
|
|
3282
3305
|
}
|
|
3283
3306
|
|
|
@@ -7065,13 +7088,13 @@
|
|
|
7065
7088
|
const RUN_VIEW = {
|
|
7066
7089
|
queued: { badge: 'Queued', cls: 'active', spin: true, note: (rt) => `Starting ${rt}.` },
|
|
7067
7090
|
running: { badge: 'Running', cls: 'active', spin: true, note: (rt) => `${rt} is working on this. It clears itself when it’s done.` },
|
|
7068
|
-
'needs-you': { badge: 'Needs
|
|
7069
|
-
interrupted: { badge: 'Interrupted', cls: 'warn', note: () => '
|
|
7091
|
+
'needs-you': { badge: 'Needs your input', cls: 'warn', note: () => 'Your input is needed:' },
|
|
7092
|
+
interrupted: { badge: 'Interrupted', cls: 'warn', note: () => 'This request stopped before finishing.' },
|
|
7070
7093
|
// Never the identifier `contract-violation` — the user did not write the contract.
|
|
7071
|
-
'contract-violation': { badge: 'Unverified', cls: 'err', note: () => '
|
|
7072
|
-
'exited-unresolved': { badge: 'Finished, unconfirmed', cls: 'warn', note: () => '
|
|
7094
|
+
'contract-violation': { badge: 'Unverified', cls: 'err', note: () => 'This request finished without a verified result.' },
|
|
7095
|
+
'exited-unresolved': { badge: 'Finished, unconfirmed', cls: 'warn', note: () => 'Review and confirm this request in a desktop app.' },
|
|
7073
7096
|
failed: { badge: 'Failed', cls: 'err', note: () => 'The run failed.' },
|
|
7074
|
-
stopped: { badge: 'Stopped', cls: 'muted', note: () => '
|
|
7097
|
+
stopped: { badge: 'Stopped', cls: 'muted', note: () => 'Continue this request in a desktop app.' },
|
|
7075
7098
|
};
|
|
7076
7099
|
|
|
7077
7100
|
// A parked run is a hand-off, not a browser-owned conversation (§G). The server stamps a command
|
|
@@ -7084,7 +7107,7 @@
|
|
|
7084
7107
|
return (await copyToClipboard(command)) ? 'ok' : 'denied';
|
|
7085
7108
|
}
|
|
7086
7109
|
|
|
7087
|
-
function runStatusHtml(run, stampedResumeCommand) {
|
|
7110
|
+
function runStatusHtml(run, stampedResumeCommand, desktopHandoffs, requestId) {
|
|
7088
7111
|
if (!run || !run.state) return '';
|
|
7089
7112
|
const v = RUN_VIEW[run.state] || { badge: String(run.state), cls: 'muted', note: () => '' };
|
|
7090
7113
|
const rt = runtimeLabel(run.runtime);
|
|
@@ -7092,6 +7115,27 @@
|
|
|
7092
7115
|
// `resumeCommand` belongs to the SERVER'S request view, not persisted `run` metadata: the
|
|
7093
7116
|
// store deliberately carries only runtime/session identity, while terminal-runtime.ts owns argv.
|
|
7094
7117
|
const resumeCommand = RESUMABLE_RUN_STATES.has(run.state) ? stampedResumeCommand : null;
|
|
7118
|
+
const handoffs = desktopHandoffs && RESUMABLE_RUN_STATES.has(run.state) ? desktopHandoffs : null;
|
|
7119
|
+
const claim = handoffs && handoffs.claim;
|
|
7120
|
+
const providers = handoffs && handoffs.preferredProvider === 'claude' ? ['claude', 'codex'] : ['codex', 'claude'];
|
|
7121
|
+
const availableProviders = handoffs ? providers.filter((provider) => handoffs[provider].available) : [];
|
|
7122
|
+
const copyProvider = handoffs ? (availableProviders[0] || handoffs.preferredProvider) : null;
|
|
7123
|
+
const appButtons = handoffs && !claim ? availableProviders.map((provider, i) => {
|
|
7124
|
+
const app = handoffs[provider];
|
|
7125
|
+
const label = provider === 'codex' ? 'Codex' : 'Claude';
|
|
7126
|
+
return `<button type="button" class="req-app-handoff ${i === 0 ? 'req-app-handoff-primary' : ''}" data-id="${escapeAttr(requestId)}" data-attempt-id="${escapeAttr(run.leaseId)}" data-provider="${provider}" data-handoff-prompt="${escapeAttr(app.prompt)}" data-tip="Open this request in ${label} Desktop">Open ${label}</button>`;
|
|
7127
|
+
}).join('') : '';
|
|
7128
|
+
const desktop = handoffs
|
|
7129
|
+
? claim
|
|
7130
|
+
? `<div class="req-app-claimed"><strong>Continuing in ${claim.provider === 'claude' ? 'Claude' : 'Codex'}</strong><span>That app owns this recovery.</span><button type="button" class="req-app-release" data-id="${escapeAttr(requestId)}" data-attempt-id="${escapeAttr(claim.attemptId)}" data-claim-id="${escapeAttr(claim.claimId)}">Release and choose another app</button></div>`
|
|
7131
|
+
: `<div class="req-app-recovery"><div class="req-app-actions">${appButtons}</div><div class="req-app-launch-status" aria-live="polite"></div><button type="button" class="req-app-copy" data-handoff-prompt="${escapeAttr(handoffs[copyProvider].prompt)}" data-tip="Copy this handoff to paste in a desktop app or terminal AI">${appButtons ? 'Didn’t open? Copy handoff' : 'Copy handoff'}</button></div>`
|
|
7132
|
+
: '';
|
|
7133
|
+
// Never expose a reusable resume command beside a claim-aware handoff bootstrap. A user could
|
|
7134
|
+
// copy one, claim the other, and later start two writers in the same folder. The bootstrap remains
|
|
7135
|
+
// copyable even when native launch fails or no protocol fits, and is safe to paste in an app or CLI.
|
|
7136
|
+
const terminalFallback = !handoffs && resumeCommand
|
|
7137
|
+
? `<details class="req-terminal-fallback"><summary>Terminal fallback</summary><div class="req-run-resume"><button type="button" class="req-run-resume-command" data-resume-command="${escapeAttr(resumeCommand)}" data-tip="Copy command to continue this session" aria-label="Copy terminal fallback command"><code>${escapeHtml(resumeCommand)}</code></button></div>${run.cwd ? `<div class="req-run-where">Run in · ${escapeHtml(run.cwd)}</div>` : ''}</details>`
|
|
7138
|
+
: '';
|
|
7095
7139
|
return `
|
|
7096
7140
|
<div class="req-run-status">
|
|
7097
7141
|
<div class="req-run-head">
|
|
@@ -7100,8 +7144,9 @@
|
|
|
7100
7144
|
</div>
|
|
7101
7145
|
${note ? `<p class="req-run-note">${escapeHtml(note)}</p>` : ''}
|
|
7102
7146
|
${run.question ? `<p class="req-run-question">${escapeHtml(run.question)}</p>` : ''}
|
|
7103
|
-
${
|
|
7104
|
-
${
|
|
7147
|
+
${desktop}
|
|
7148
|
+
${terminalFallback}
|
|
7149
|
+
${!handoffs && run.cwd ? `<div class="req-run-where">Run in · ${escapeHtml(run.cwd)}</div>` : ''}
|
|
7105
7150
|
${run.lastOutput ? `<details class="req-run-output"><summary>Show what it printed</summary><pre>${escapeHtml(run.lastOutput)}</pre></details>` : ''}
|
|
7106
7151
|
</div>`;
|
|
7107
7152
|
}
|
|
@@ -7520,8 +7565,8 @@
|
|
|
7520
7565
|
* per-id loop rather than the atomic verb.
|
|
7521
7566
|
*/
|
|
7522
7567
|
function bulkClearPlan(painted, all, filterActive) {
|
|
7523
|
-
const keep = painted.filter((r) => r && r.type === 'knowledge-organize');
|
|
7524
|
-
const drop = painted.filter((r) => r && r.type !== 'knowledge-organize');
|
|
7568
|
+
const keep = painted.filter((r) => r && (r.type === 'knowledge-organize' || (r.desktopHandoffs && r.desktopHandoffs.claim)));
|
|
7569
|
+
const drop = painted.filter((r) => r && r.type !== 'knowledge-organize' && !(r.desktopHandoffs && r.desktopHandoffs.claim));
|
|
7525
7570
|
return { atomic: !filterActive && !keep.length && painted.length === all.length, keep, drop };
|
|
7526
7571
|
}
|
|
7527
7572
|
|
|
@@ -7617,19 +7662,20 @@
|
|
|
7617
7662
|
// and stranding the organize lock until its stale timeout. Show why it can't be cleared instead.
|
|
7618
7663
|
const run = r.run || null;
|
|
7619
7664
|
const inFlight = !!run && (run.state === 'queued' || run.state === 'running');
|
|
7665
|
+
const desktopClaimed = !!(r.desktopHandoffs && r.desktopHandoffs.claim);
|
|
7620
7666
|
const lifecycleOwned = r.type === 'knowledge-organize';
|
|
7621
7667
|
// ✕ goes away while a run is live, for the same reason it goes away on a knowledge-organize:
|
|
7622
7668
|
// deleting the request out from under a working agent leaves it unable to clear its own work,
|
|
7623
7669
|
// and the run then lands in `exited-unresolved` for a reason the user caused and cannot see.
|
|
7624
7670
|
const del = lifecycleOwned
|
|
7625
7671
|
? '<span class="req-lifecycle" data-tip="This clears itself when your terminal AI finishes or fails the organize">finishing in your terminal</span>'
|
|
7626
|
-
: inFlight
|
|
7672
|
+
: inFlight || desktopClaimed
|
|
7627
7673
|
? '<span class="req-lifecycle" data-tip="Stop the run first — clearing it now would leave the agent working on a request that no longer exists">running</span>'
|
|
7628
7674
|
: `<button class="req-del" data-id="${escapeAttr(r.id)}" data-tip="${r.resumeCommand ? 'Clear this request and discard its saved terminal session' : 'Clear this request'}">×</button>`;
|
|
7629
7675
|
// A server-stamped handoff gets NO re-run. The original terminal session may already be live;
|
|
7630
7676
|
// starting a second headless agent would put two writers in one folder. The browser decides no
|
|
7631
7677
|
// policy here: it simply withholds ▶ whenever the server supplied the resume command.
|
|
7632
|
-
const canRunNow = headlessReady() && r.canRun && !inFlight && !r.resumeCommand;
|
|
7678
|
+
const canRunNow = headlessReady() && r.canRun && !inFlight && !r.desktopHandoffs && !r.resumeCommand;
|
|
7633
7679
|
const runBtn = inFlight
|
|
7634
7680
|
? `<button class="req-stop" data-id="${escapeAttr(r.id)}" data-tip="Stop this run">■</button>`
|
|
7635
7681
|
: canRunNow
|
|
@@ -7641,12 +7687,12 @@
|
|
|
7641
7687
|
<div class="req-head"><span class="${badgeCls}">${label}</span> ${owner ? `<span class="req-owner">${highlightQuery(owner, requestQuery)}</span>` : ''}${time}</div>
|
|
7642
7688
|
<div class="req-instruction">${highlightQuery(instructionFor(r), requestQuery) || 'This request has no instruction, so it can’t be handed to your terminal AI. Clear it and queue it again.'}</div>
|
|
7643
7689
|
${r.snapshots && r.snapshots.length ? `<div class="req-thumbs">${r.snapshots.map((sp, i) => { const pdf = /\.pdf$/i.test(String(sp)); return `<button type="button" class="req-thumb" data-id="${escapeAttr(r.id)}" data-n="${i}" aria-label="View ${pdf ? 'PDF' : 'screenshot'} ${i + 1}">${pdf ? '<span class="req-thumb-pdf">PDF</span>' : `<img src="/api/requests/${encodeURIComponent(r.id)}/snapshot/${i}" alt="">`}</button>`; }).join('')}</div>` : ''}
|
|
7644
|
-
${runStatusHtml(run, r.resumeCommand)}
|
|
7690
|
+
${runStatusHtml(run, r.resumeCommand, r.desktopHandoffs, r.id)}
|
|
7645
7691
|
${!r.canRun && r.runWhy && anyRunnable ? `<div class="req-why-not">Runs only from your terminal — ${escapeHtml(r.runWhy)}</div>` : ''}
|
|
7646
7692
|
</div>
|
|
7647
7693
|
<div class="req-actions">
|
|
7648
7694
|
${runBtn}
|
|
7649
|
-
${r.resumeCommand ? '' : `<button class="req-copy" data-id="${escapeAttr(r.id)}" data-tip="Copy this instruction">⧉</button>`}
|
|
7695
|
+
${r.desktopHandoffs || r.resumeCommand ? '' : `<button class="req-copy" data-id="${escapeAttr(r.id)}" data-tip="Copy this instruction">⧉</button>`}
|
|
7650
7696
|
${del}
|
|
7651
7697
|
</div>
|
|
7652
7698
|
</div>`;
|
|
@@ -7680,6 +7726,76 @@
|
|
|
7680
7726
|
else showToast('Could not copy — select the command and copy it manually', 'err');
|
|
7681
7727
|
};
|
|
7682
7728
|
});
|
|
7729
|
+
$list.querySelectorAll('.req-app-handoff').forEach((button) => {
|
|
7730
|
+
button.onclick = async () => {
|
|
7731
|
+
const requestId = button.dataset.id || '';
|
|
7732
|
+
const attemptId = button.dataset.attemptId || '';
|
|
7733
|
+
const provider = button.dataset.provider === 'claude' ? 'claude' : 'codex';
|
|
7734
|
+
const label = provider === 'claude' ? 'Claude' : 'Codex';
|
|
7735
|
+
const choice = await confirmUnsavedSwitch(
|
|
7736
|
+
'',
|
|
7737
|
+
`FloLess will open this request and its project folder in ${label}.`,
|
|
7738
|
+
`Open ${label} Desktop?`,
|
|
7739
|
+
{ confirm: `Open ${label}`, hideDiscard: true, initialFocus: 'cancel' },
|
|
7740
|
+
);
|
|
7741
|
+
if (choice !== 'save') return;
|
|
7742
|
+
const exactButton = Array.from($list.querySelectorAll('.req-app-handoff')).find((candidate) =>
|
|
7743
|
+
candidate.dataset.id === requestId
|
|
7744
|
+
&& candidate.dataset.attemptId === attemptId
|
|
7745
|
+
&& candidate.dataset.provider === provider);
|
|
7746
|
+
if (!exactButton) { await loadRequests(); renderRequests(); return; }
|
|
7747
|
+
const card = exactButton.closest('.req-run-status');
|
|
7748
|
+
const status = card && card.querySelector('.req-app-launch-status');
|
|
7749
|
+
const copy = card && card.querySelector('.req-app-copy');
|
|
7750
|
+
const controls = card ? Array.from(card.querySelectorAll('.req-app-handoff')) : [];
|
|
7751
|
+
controls.forEach((control) => { control.disabled = true; });
|
|
7752
|
+
if (status) status.textContent = `Starting ${label} Desktop…`;
|
|
7753
|
+
if (copy) copy.dataset.handoffPrompt = exactButton.dataset.handoffPrompt || '';
|
|
7754
|
+
try {
|
|
7755
|
+
await api(`/api/requests/${encodeURIComponent(requestId)}/desktop-handoff/launch`, {
|
|
7756
|
+
method: 'POST', body: JSON.stringify({ provider, attemptId }),
|
|
7757
|
+
});
|
|
7758
|
+
const stillCurrent = Array.from($list.querySelectorAll('.req-app-handoff')).some((candidate) =>
|
|
7759
|
+
candidate.dataset.id === requestId
|
|
7760
|
+
&& candidate.dataset.attemptId === attemptId
|
|
7761
|
+
&& candidate.dataset.provider === provider);
|
|
7762
|
+
if (stillCurrent && status) status.textContent = `Windows was asked to open ${label} Desktop.`;
|
|
7763
|
+
} catch (error) {
|
|
7764
|
+
if (/no longer available|already requested/i.test(String(error && error.message))) {
|
|
7765
|
+
await loadRequests(); renderRequests();
|
|
7766
|
+
} else if (status) {
|
|
7767
|
+
status.textContent = `${label} couldn’t be started.`;
|
|
7768
|
+
}
|
|
7769
|
+
} finally {
|
|
7770
|
+
controls.forEach((control) => { if (control.isConnected) control.disabled = false; });
|
|
7771
|
+
}
|
|
7772
|
+
};
|
|
7773
|
+
});
|
|
7774
|
+
$list.querySelectorAll('.req-app-copy').forEach((b) => {
|
|
7775
|
+
b.onclick = async () => {
|
|
7776
|
+
const result = await copyToClipboard(b.dataset.handoffPrompt || '');
|
|
7777
|
+
showToast(result ? 'Handoff copied — paste it into a desktop app or terminal AI' : 'Could not copy the handoff', result ? 'ok' : 'err');
|
|
7778
|
+
};
|
|
7779
|
+
});
|
|
7780
|
+
$list.querySelectorAll('.req-app-release').forEach((b) => {
|
|
7781
|
+
b.onclick = async () => {
|
|
7782
|
+
const choice = await confirmUnsavedSwitch(
|
|
7783
|
+
'',
|
|
7784
|
+
'The first desktop app may still be working. Stop it there before releasing this claim.',
|
|
7785
|
+
'Release desktop recovery?',
|
|
7786
|
+
{ confirm: 'Release and choose another app', hideDiscard: true, initialFocus: 'cancel' },
|
|
7787
|
+
);
|
|
7788
|
+
if (choice !== 'save') return;
|
|
7789
|
+
try {
|
|
7790
|
+
await api(`/api/requests/${encodeURIComponent(b.dataset.id)}/desktop-handoff`, {
|
|
7791
|
+
method: 'DELETE',
|
|
7792
|
+
body: JSON.stringify({ attemptId: b.dataset.attemptId, claimId: b.dataset.claimId }),
|
|
7793
|
+
});
|
|
7794
|
+
await loadRequests();
|
|
7795
|
+
renderRequests();
|
|
7796
|
+
} catch (e) { reportErr(e); }
|
|
7797
|
+
};
|
|
7798
|
+
});
|
|
7683
7799
|
$list.querySelectorAll('.req-del').forEach((b) => { b.onclick = () => deleteOneRequest(b.dataset.id); });
|
|
7684
7800
|
$list.querySelectorAll('.req-thumb').forEach((b) => {
|
|
7685
7801
|
b.onclick = () => window.open(`/api/requests/${encodeURIComponent(b.dataset.id)}/snapshot/${b.dataset.n}`, '_blank');
|
package/dist/web/index.html
CHANGED
|
@@ -679,7 +679,8 @@
|
|
|
679
679
|
|
|
680
680
|
<!-- Save-on-switch confirmation — shown when switching workflows with unsaved
|
|
681
681
|
input changes. Reuses the shared modal styling; no new backdrop look. -->
|
|
682
|
-
<div class="modal-backdrop" id="confirm-modal"
|
|
682
|
+
<div class="modal-backdrop" id="confirm-modal" role="dialog" aria-modal="true"
|
|
683
|
+
aria-labelledby="confirm-modal-title" aria-describedby="confirm-modal-sub">
|
|
683
684
|
<div class="modal">
|
|
684
685
|
<div class="modal-title" id="confirm-modal-title">Unsaved input changes</div>
|
|
685
686
|
<div class="modal-sub" id="confirm-modal-sub"></div>
|
|
@@ -1613,7 +1613,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1613
1613
|
<!-- The spinner is `connImportModal`'s own `.ci-prog`/`.ci-spin` (see the CSS above), reused rather
|
|
1614
1614
|
than re-invented: this stage sat as static text for up to six seconds before its honest
|
|
1615
1615
|
"still working" message appeared, which reads as hung next to the sibling modal that spins. -->
|
|
1616
|
-
<div id=riProgStage style="display:none"><div class=ci-prog><span class=ci-spin aria-hidden=true></span><span id=riProgTxt role=status aria-live=polite>
|
|
1616
|
+
<div id=riProgStage style="display:none"><div class=ci-prog><span class=ci-spin aria-hidden=true></span><span id=riProgTxt role=status aria-live=polite>Preparing the IFC file…</span></div><div id=riProgNote style="display:none">You can close this — FloLess will keep importing this model.</div></div>
|
|
1617
1617
|
<div id=riConfirmStage style="display:none">
|
|
1618
1618
|
<div id=riSays></div>
|
|
1619
1619
|
<div class=rirow><span class=pn>Schema</span><span class=pv id=riSchema>—</span></div>
|
|
@@ -11146,7 +11146,7 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11146
11146
|
// that guard could never fire from this UI, because the browser never disconnected — Cancel left the
|
|
11147
11147
|
// request in flight, so a cancelled 66 MB read went on holding the single run lock for its full
|
|
11148
11148
|
// duration and the next import queued behind the file the user had just given up on.
|
|
11149
|
-
let riRun=0,riAbort=null,riMutationId=null;
|
|
11149
|
+
let riRun=0,riAbort=null,riMutationId=null,riBackgrounded=false;
|
|
11150
11150
|
/** End the current attempt: nothing it started may touch the modal, and its upload stops now. */
|
|
11151
11151
|
const riStop=()=>{riRun++;if(riAbort){try{riAbort.abort();}catch(_){/* already settled */}riAbort=null;}};
|
|
11152
11152
|
const riClearSoft=()=>{if(riSoftT){clearTimeout(riSoftT);riSoftT=null;}};
|
|
@@ -11167,6 +11167,9 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11167
11167
|
function openRefImport(){
|
|
11168
11168
|
if(!MODEL_V2){toast('Reference models need this project on the model-level contract');return;}
|
|
11169
11169
|
if(!view3d){toast('Switch to the 3D view to add a reference model');return;}
|
|
11170
|
+
// There is one accepted import at a time. Reopening its observer must reveal that same work,
|
|
11171
|
+
// never cancel it and leave `riBusy` wedged behind an invalidated run token.
|
|
11172
|
+
if(riBusy){riBackgrounded=false;ri$('refImportModal').style.display='flex';return;}
|
|
11170
11173
|
riStop(); // a previous attempt's in-flight probe must not answer into this one
|
|
11171
11174
|
riSha=null;riName='';riVerdict=null;riProbeCentre=null;riErr('');ri$('riDrop').classList.remove('drag');
|
|
11172
11175
|
riBuildPick(null); // and the picker, so a cancelled file's storeys never show under a new name
|
|
@@ -11176,10 +11179,11 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11176
11179
|
// A reference insert is intentionally detached from this modal once accepted. Closing is a
|
|
11177
11180
|
// backgrounding action, never an implicit cancellation of an expensive model read.
|
|
11178
11181
|
if(riBusy&&riStageNow==='prog'){
|
|
11179
|
-
//
|
|
11180
|
-
//
|
|
11181
|
-
|
|
11182
|
-
|
|
11182
|
+
// Keep the request identity, abort controller and run token alive. The response still owns the
|
|
11183
|
+
// local commit + viewer update after this observer closes; invalidating the token here made that
|
|
11184
|
+
// response return early and relied on a broadcast which may already have been suppressed by our
|
|
11185
|
+
// mutation claim. The reference then existed on disk but stayed invisible until reload.
|
|
11186
|
+
riBackgrounded=true;riClearSoft();ri$('refImportModal').style.display='none';
|
|
11183
11187
|
toast('Import continues in the background.');return;
|
|
11184
11188
|
}
|
|
11185
11189
|
riStop();riClearSoft();ri$('refImportModal').style.display='none';
|
|
@@ -11529,7 +11533,7 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11529
11533
|
const riNative=nativeModelCentre();
|
|
11530
11534
|
const riFilterBody=riBuildFilter(); // computed ONCE — it was called twice in one expression
|
|
11531
11535
|
const riOriginShift=takeOrigin&&riProbeCentre?riProbeCentre.map((v,i)=>riNative[i]-v):null;
|
|
11532
|
-
riStage('prog');ri$('riProgNote').style.display='block';ri$('riCancel').textContent='Continue in background';riProg('
|
|
11536
|
+
riStage('prog');ri$('riTitle').textContent='Converting into 3D viewer geometry';ri$('riProgNote').style.display='block';ri$('riCancel').textContent='Continue in background';riProg('Converting “'+riName+'” into 3D viewer geometry…','AWARE is tessellating objects and preparing the viewer file. Whole-building models can take several minutes; FloLess will add the reference when that completes.');
|
|
11533
11537
|
let mid=null;
|
|
11534
11538
|
try{
|
|
11535
11539
|
mid=newMutationId();riMutationId=mid;claimMutation(mid);
|
|
@@ -11557,6 +11561,7 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11557
11561
|
}
|
|
11558
11562
|
riClearSoft();
|
|
11559
11563
|
if(!res.ok||!d.ok){
|
|
11564
|
+
if(riBackgrounded)toast('Reference import failed — '+(d.error||'the model could not be added.'));
|
|
11560
11565
|
// STAY ON CONFIRM for the refusals the picker itself can fix. `riStage('drop')` swaps the whole
|
|
11561
11566
|
// body back to the dropzone, so telling somebody to "choose fewer storeys or types" would
|
|
11562
11567
|
// remove every control that lets them. The other failures still go back — there is nothing to
|
|
@@ -11582,8 +11587,9 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11582
11587
|
// Aborted: no response at all, so we cannot know whether the write landed. Same reasoning as
|
|
11583
11588
|
// above — release the claim so a broadcast that does arrive is applied rather than swallowed.
|
|
11584
11589
|
if(mine!==riRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);if(riMutationId===mid)riMutationId=null;return;}
|
|
11590
|
+
if(riBackgrounded)toast('Reference import failed — the model could not be added.');
|
|
11585
11591
|
riClearSoft();riStage('drop');riErr('Could not add that reference.');console.error('[reference] insert failed',e);return;}
|
|
11586
|
-
finally{if(mine===riRun){riBusy=false;riAbort=null;ri$('riCancel').textContent='Cancel';}if(riMutationId===mid)riMutationId=null;}
|
|
11592
|
+
finally{if(mine===riRun){riBusy=false;riAbort=null;riBackgrounded=false;ri$('riCancel').textContent='Cancel';}if(riMutationId===mid)riMutationId=null;}
|
|
11587
11593
|
// ── PAST THE POINT OF NO RETURN. Everything above is the transaction; everything below is showing
|
|
11588
11594
|
// it. They were one try, and a throw in the presentation half ran riErr() on a modal riClose() had
|
|
11589
11595
|
// already hidden — so the user saw NOTHING while the reference was committed and on disk, and the
|