@floless/app 0.126.3 → 0.126.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 +443 -402
- package/dist/web/app.css +127 -0
- package/dist/web/aware.js +345 -2
- package/dist/web/index.html +32 -1
- package/dist/web/steel-3d-view.js +14 -2
- package/dist/web/steel-editor.html +7 -6
- package/package.json +1 -1
package/dist/web/app.css
CHANGED
|
@@ -1293,6 +1293,14 @@
|
|
|
1293
1293
|
justify-content: center;
|
|
1294
1294
|
}
|
|
1295
1295
|
.modal-backdrop.show { display: flex; animation: fade-in 0.15s ease-out; }
|
|
1296
|
+
/* The shared form modal is the one every OTHER modal opens on top of itself — the run options
|
|
1297
|
+
over Requests, the folder over Integrations — so it cannot share their z-index. Every backdrop
|
|
1298
|
+
sitting at 100 means DOM ORDER decides, and #form-modal is declared before #requests-modal:
|
|
1299
|
+
the form painted UNDERNEATH, its buttons swallowed by the .req-item behind it. Not a paint bug
|
|
1300
|
+
you could see, either — the dialog looked fine and simply refused to respond, which is why it
|
|
1301
|
+
is pinned here rather than fixed by moving the element and hoping. Still below toasts (200),
|
|
1302
|
+
which must stay readable over anything. */
|
|
1303
|
+
#form-modal { z-index: 110; }
|
|
1296
1304
|
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
1297
1305
|
.modal {
|
|
1298
1306
|
background: var(--surface);
|
|
@@ -1969,6 +1977,125 @@
|
|
|
1969
1977
|
padding-left: 10px;
|
|
1970
1978
|
}
|
|
1971
1979
|
|
|
1980
|
+
/* ── Headless runs (#571 slice 3) ─────────────────────────────────────────────
|
|
1981
|
+
floless starting the user's OWN terminal AI on a queued request. Three things this
|
|
1982
|
+
styling is arranged around, all of them honesty constraints rather than taste:
|
|
1983
|
+
|
|
1984
|
+
1. There is no progress signal — only aliveness. So: a spinner, never a bar and never an
|
|
1985
|
+
elapsed clock, both of which invite reading meaning into a duration that carries none.
|
|
1986
|
+
2. There is no "ready" state for a runtime. A signed-out CLI resolves to a binary exactly
|
|
1987
|
+
like a working one, so nothing here may be --ok green: green already means "connected and
|
|
1988
|
+
working" on the OAuth cards in the same modal, and borrowing it would assert readiness
|
|
1989
|
+
floless has not earned. Found/not-found are both NEUTRAL.
|
|
1990
|
+
3. A parked run's question is handed back verbatim and never answered here — so the block
|
|
1991
|
+
that renders it carries no field, no reply box, nothing editable. */
|
|
1992
|
+
|
|
1993
|
+
/* The split: ▶ runs with the current default, ▾ opens the options form. Two buttons sharing one
|
|
1994
|
+
silhouette via joined radii — a real menu popover would need outside-click, focus trapping and
|
|
1995
|
+
its own scroll container for two decisions a themed form already asks better. */
|
|
1996
|
+
/* [hidden] LOSES TO A CLASS THAT SETS display, and this file has no global `[hidden]` rule — a
|
|
1997
|
+
trap this repo has now been caught by six times. Without these three, `$split.hidden = true`
|
|
1998
|
+
is a NO-OP: the queued-request modal's one caller queues a `revision-read`, which the run
|
|
1999
|
+
policy refuses, so "▶ Run it for me" painted on the one surface it could never work from —
|
|
2000
|
+
worse than a disabled control, because it looks live. `.request-help-steps` is pre-existing
|
|
2001
|
+
but only became a TOGGLED element in this change, and it is the other half: without it the
|
|
2002
|
+
modal shows "Paste the copied instructions" beside "Running in Claude Code". Found by review,
|
|
2003
|
+
invisible to any assertion that reads `.hidden` rather than computed style. */
|
|
2004
|
+
.run-split[hidden],
|
|
2005
|
+
.request-help-run-status[hidden],
|
|
2006
|
+
.request-help-steps[hidden] { display: none; }
|
|
2007
|
+
.run-split { display: inline-flex; }
|
|
2008
|
+
.run-split-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
|
|
2009
|
+
.run-split-caret { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 7px 9px;
|
|
2010
|
+
border-left: 1px solid color-mix(in srgb, var(--bg) 35%, transparent); }
|
|
2011
|
+
|
|
2012
|
+
/* The post-click state of #request-help-modal, standing where the 1-2-3 steps were. */
|
|
2013
|
+
.request-help-run-status { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0;
|
|
2014
|
+
padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
|
|
2015
|
+
.rhrs-title { margin: 0; font-size: 12.5px; color: var(--text); line-height: 1.4; }
|
|
2016
|
+
.rhrs-title strong { color: var(--accent-bright); font-weight: 600; }
|
|
2017
|
+
.rhrs-title code { font-family: var(--mono); font-size: 11px; color: var(--text-dim);
|
|
2018
|
+
background: var(--surface); border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; }
|
|
2019
|
+
.rhrs-sub { margin: 4px 0 0; font-size: 11px; color: var(--text-dim); line-height: 1.5; }
|
|
2020
|
+
|
|
2021
|
+
/* The row's run/stop glyph — same 26x26 recipe as .req-copy/.req-del so the gutter stays one
|
|
2022
|
+
control language, and NOT a third size just because this one is new. */
|
|
2023
|
+
.req-run, .req-stop {
|
|
2024
|
+
display: inline-flex; align-items: center; justify-content: center; padding: 0;
|
|
2025
|
+
appearance: none; border: 1px solid var(--border-strong); background: transparent;
|
|
2026
|
+
color: var(--text-muted); cursor: pointer; width: 26px; height: 26px;
|
|
2027
|
+
border-radius: 4px; font-size: 11px; line-height: 1;
|
|
2028
|
+
}
|
|
2029
|
+
.req-run:hover { color: var(--accent-bright); border-color: var(--accent-dim); background: var(--accent-soft); }
|
|
2030
|
+
.req-stop:hover { color: var(--err); border-color: var(--err); }
|
|
2031
|
+
|
|
2032
|
+
/* The live status block, under the instruction. */
|
|
2033
|
+
.req-run-status { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--border);
|
|
2034
|
+
border-radius: 6px; background: var(--surface); display: flex; flex-direction: column;
|
|
2035
|
+
gap: 6px; font-size: 11.5px; }
|
|
2036
|
+
.req-run-head { display: flex; align-items: center; gap: 7px; }
|
|
2037
|
+
.req-run-head .rtn-spinner { width: 11px; height: 11px; border-width: 2px; }
|
|
2038
|
+
.req-run-badge { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em;
|
|
2039
|
+
padding: 2px 8px; border-radius: 10px; font-weight: 600; width: fit-content; flex-shrink: 0; }
|
|
2040
|
+
.req-run-badge-active { background: var(--accent-soft); color: var(--accent-bright); }
|
|
2041
|
+
.req-run-badge-warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
|
|
2042
|
+
.req-run-badge-err { background: color-mix(in srgb, var(--err) 15%, transparent); color: var(--err); }
|
|
2043
|
+
.req-run-badge-muted { background: var(--surface-3); color: var(--text-dim); }
|
|
2044
|
+
.req-run-note { margin: 0; color: var(--text-muted); line-height: 1.45; }
|
|
2045
|
+
.req-run-where { font-family: var(--mono); font-size: 10px; color: var(--text-dim);
|
|
2046
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2047
|
+
/* The agent's question, VERBATIM. A quote, deliberately — the warn rule and the italic say
|
|
2048
|
+
"somebody said this to you", where a plain paragraph would read as floless's own prose and a
|
|
2049
|
+
field would read as somewhere to answer. There is nowhere to answer; that is the point. */
|
|
2050
|
+
.req-run-question { margin: 0; color: var(--text); font-style: italic; line-height: 1.45;
|
|
2051
|
+
border-left: 2px solid var(--warn); padding-left: 9px; white-space: pre-wrap; word-break: break-word; }
|
|
2052
|
+
/* The CLI's own tail, collapsed. 4000 chars of raw output expanded by default would swallow the
|
|
2053
|
+
list; <details> is the platform's own disclosure, with only its marker restyled. */
|
|
2054
|
+
.req-run-output { font-size: 11px; }
|
|
2055
|
+
.req-run-output > summary { list-style: none; cursor: pointer; color: var(--text-dim);
|
|
2056
|
+
font-size: 10.5px; user-select: none; }
|
|
2057
|
+
.req-run-output > summary::-webkit-details-marker { display: none; }
|
|
2058
|
+
.req-run-output > summary::before { content: '▸ '; font-size: 9px; }
|
|
2059
|
+
.req-run-output[open] > summary::before { content: '▾ '; }
|
|
2060
|
+
.req-run-output > summary:hover { color: var(--text-muted); }
|
|
2061
|
+
.req-run-output pre {
|
|
2062
|
+
margin: 6px 0 0; padding: 7px 9px; max-height: 120px; overflow: auto;
|
|
2063
|
+
background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
|
|
2064
|
+
font-family: var(--mono); font-size: 10px; line-height: 1.5; color: var(--text-muted);
|
|
2065
|
+
white-space: pre-wrap; word-break: break-word;
|
|
2066
|
+
}
|
|
2067
|
+
/* Why THIS row has no ▶, shown only when a runnable row is on screen beside it (see
|
|
2068
|
+
renderRequests). Metadata at .req-lifecycle's tier — never a greyed-out button. */
|
|
2069
|
+
.req-why-not { margin-top: 6px; font-size: 10.5px; font-style: italic; color: var(--text-dim); line-height: 1.4; }
|
|
2070
|
+
|
|
2071
|
+
/* The Integrations section: which terminal AIs are installed, and the folder runs happen in. */
|
|
2072
|
+
.int-section { border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-2);
|
|
2073
|
+
padding: 12px; margin-bottom: 10px; flex-shrink: 0; }
|
|
2074
|
+
.int-section-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
|
|
2075
|
+
.int-section-sub { font-size: 11px; color: var(--text-dim); line-height: 1.5; margin-bottom: 10px; }
|
|
2076
|
+
.int-runtimes { display: flex; flex-direction: column; gap: 6px; }
|
|
2077
|
+
.int-rt { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
|
|
2078
|
+
padding: 8px 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
|
|
2079
|
+
.int-rt.is-default { border-color: var(--accent); background: var(--accent-soft); }
|
|
2080
|
+
.int-rt.is-missing { opacity: 0.72; }
|
|
2081
|
+
.int-rt-name { font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; }
|
|
2082
|
+
.int-rt-pill { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
|
|
2083
|
+
padding: 1px 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-bright); }
|
|
2084
|
+
.int-rt-blurb { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
|
|
2085
|
+
.int-rt-blurb code { font-family: var(--mono); color: var(--text-dim); }
|
|
2086
|
+
.int-rt-where { font-family: var(--mono); font-size: 9.5px; color: var(--text-dim); margin-top: 3px;
|
|
2087
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2088
|
+
/* NEUTRAL on purpose, both of them — see point 2 in this block's header. */
|
|
2089
|
+
.int-rt-badge { font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600;
|
|
2090
|
+
padding: 2px 8px; border-radius: 10px; background: var(--surface-3); color: var(--text-muted); }
|
|
2091
|
+
.int-rt.is-missing .int-rt-badge { color: var(--text-dim); }
|
|
2092
|
+
.int-rt-side { display: flex; align-items: center; gap: 7px; }
|
|
2093
|
+
.int-folder { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
|
|
2094
|
+
display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
|
|
2095
|
+
.int-folder-path { font-family: var(--mono); font-size: 10px; color: var(--text); min-width: 0;
|
|
2096
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
|
|
2097
|
+
.int-folder-path.is-unset { font-family: var(--ui); font-style: italic; color: var(--text-dim); }
|
|
2098
|
+
|
|
1972
2099
|
/* "Don't save" in the unsaved-changes dialog: left-pushed, neutral at rest,
|
|
1973
2100
|
destructive only on hover — same restraint as the Requests "Clear all". */
|
|
1974
2101
|
#confirm-dont-save { margin-right: auto; }
|
package/dist/web/aware.js
CHANGED
|
@@ -6881,6 +6881,155 @@
|
|
|
6881
6881
|
? ['Nothing to copy — this request has no instruction', 'err']
|
|
6882
6882
|
: ['copy failed', 'err']);
|
|
6883
6883
|
|
|
6884
|
+
// ── Headless runs (#571 slice 3) ────────────────────────────────────────────
|
|
6885
|
+
// floless starting the user's OWN terminal AI on a queued request, instead of them pasting it.
|
|
6886
|
+
// The browser holds NO copy of which request types may run: every row arrives carrying `canRun`
|
|
6887
|
+
// and `runWhy` from the server's one policy table, so the two cannot drift and a type this build
|
|
6888
|
+
// has never heard of is answered fail-closed at the source rather than guessed at here.
|
|
6889
|
+
//
|
|
6890
|
+
// Detection is a workspace-level fact (which CLIs exist) fetched per surface-open and cached; the
|
|
6891
|
+
// FOLDER is per project, so anything that needs it re-reads with the project key rather than
|
|
6892
|
+
// trusting this. Server-side detection spawns nothing — it is statSync work — so an open is cheap.
|
|
6893
|
+
let headlessInfo = null;
|
|
6894
|
+
async function refreshHeadless() {
|
|
6895
|
+
// A detection failure HIDES the feature rather than leaving a button that cannot work. There is
|
|
6896
|
+
// no honest middle: without the runtime list we do not know that anything is installed.
|
|
6897
|
+
try { headlessInfo = await api('/api/terminal-runtimes'); }
|
|
6898
|
+
catch { headlessInfo = null; }
|
|
6899
|
+
return headlessInfo;
|
|
6900
|
+
}
|
|
6901
|
+
const headlessRuntimes = () => (headlessInfo && Array.isArray(headlessInfo.runtimes) ? headlessInfo.runtimes : []);
|
|
6902
|
+
/** Zero runtimes found ⇒ no run affordance anywhere (§E4). Hidden, never disabled. */
|
|
6903
|
+
const headlessReady = () => headlessRuntimes().some((r) => r && r.state === 'found');
|
|
6904
|
+
const runtimeLabel = (id) => {
|
|
6905
|
+
const m = headlessRuntimes().find((r) => r && r.id === id);
|
|
6906
|
+
return (m && m.label) || String(id || 'your terminal AI');
|
|
6907
|
+
};
|
|
6908
|
+
/** Which project's folder a request runs in — the same key the server derives. */
|
|
6909
|
+
const runProjectKey = (r) => (r && (r.project || r.appId)) || null;
|
|
6910
|
+
|
|
6911
|
+
// How each run state reads to a human. Deliberately absent: `succeeded` — the success path DELETES
|
|
6912
|
+
// the request, so no row can ever display it; success IS the row disappearing, exactly as it does
|
|
6913
|
+
// when a human pastes the prompt themselves. An unmapped state falls through to its own name in
|
|
6914
|
+
// the muted tier rather than rendering blank, which is the honest miss-path for a newer server.
|
|
6915
|
+
const RUN_VIEW = {
|
|
6916
|
+
queued: { badge: 'Queued', cls: 'active', spin: true, note: (rt) => `Starting ${rt}.` },
|
|
6917
|
+
running: { badge: 'Running', cls: 'active', spin: true, note: (rt) => `${rt} is working on this. It clears itself when it’s done.` },
|
|
6918
|
+
'needs-you': { badge: 'Needs you', cls: 'warn', note: () => 'Your terminal AI stopped because this needs a decision from you:' },
|
|
6919
|
+
interrupted: { badge: 'Interrupted', cls: 'warn', note: () => 'floless restarted while this was running, so the run stopped. The request is still queued — pick the session up in your terminal, or run it again.' },
|
|
6920
|
+
// Never the identifier `contract-violation` — the user did not write the contract.
|
|
6921
|
+
'contract-violation': { badge: 'Unverified', cls: 'err', note: () => 'The run ended without a final answer floless could read, so it may or may not have changed anything. Check in your terminal before running it again.' },
|
|
6922
|
+
'exited-unresolved': { badge: 'Finished, unconfirmed', cls: 'warn', note: () => 'The run ended cleanly but left this request queued, so floless can’t say the work was done.' },
|
|
6923
|
+
failed: { badge: 'Failed', cls: 'err', note: () => 'The run failed.' },
|
|
6924
|
+
stopped: { badge: 'Stopped', cls: 'muted', note: () => 'You stopped this run.' },
|
|
6925
|
+
};
|
|
6926
|
+
|
|
6927
|
+
function runStatusHtml(run) {
|
|
6928
|
+
if (!run || !run.state) return '';
|
|
6929
|
+
const v = RUN_VIEW[run.state] || { badge: String(run.state), cls: 'muted', note: () => '' };
|
|
6930
|
+
const rt = runtimeLabel(run.runtime);
|
|
6931
|
+
const note = v.note(rt);
|
|
6932
|
+
return `
|
|
6933
|
+
<div class="req-run-status">
|
|
6934
|
+
<div class="req-run-head">
|
|
6935
|
+
${v.spin ? '<span class="rtn-spinner" aria-hidden="true"></span>' : ''}
|
|
6936
|
+
<span class="req-run-badge req-run-badge-${v.cls}">${escapeHtml(v.badge)}</span>
|
|
6937
|
+
</div>
|
|
6938
|
+
${note ? `<p class="req-run-note">${escapeHtml(note)}</p>` : ''}
|
|
6939
|
+
${run.question ? `<p class="req-run-question">${escapeHtml(run.question)}</p>` : ''}
|
|
6940
|
+
${run.cwd ? `<div class="req-run-where">${escapeHtml(rt)} · ${escapeHtml(run.cwd)}</div>` : ''}
|
|
6941
|
+
${run.lastOutput ? `<details class="req-run-output"><summary>Show what it printed</summary><pre>${escapeHtml(run.lastOutput)}</pre></details>` : ''}
|
|
6942
|
+
</div>`;
|
|
6943
|
+
}
|
|
6944
|
+
|
|
6945
|
+
// Start a run. `runtime` is the §E4 per-run override — omitted, the server resolves the default.
|
|
6946
|
+
async function runRequestHeadless(req, runtime) {
|
|
6947
|
+
try {
|
|
6948
|
+
const res = await api(`/api/requests/${encodeURIComponent(req.id)}/run`, {
|
|
6949
|
+
method: 'POST', body: JSON.stringify(runtime ? { runtime } : {}),
|
|
6950
|
+
});
|
|
6951
|
+
showToast(`Running in ${runtimeLabel((res.run && res.run.runtime) || runtime)} — the row updates as it goes`, 'ok');
|
|
6952
|
+
await loadRequests();
|
|
6953
|
+
renderRequests();
|
|
6954
|
+
return res;
|
|
6955
|
+
} catch (err) {
|
|
6956
|
+
const code = err && err.body && err.body.code;
|
|
6957
|
+
// No folder yet (or one that has since gone) is not an error to report — it is the one
|
|
6958
|
+
// question the user has not been asked. Ask it, pre-loaded with the server's own sentence.
|
|
6959
|
+
if (code === 'no-folder' || code === 'bad-folder') { await openRunOptions(req, err.body.error); return null; }
|
|
6960
|
+
showToast((err && err.message) || 'could not start the run', 'err');
|
|
6961
|
+
return null;
|
|
6962
|
+
}
|
|
6963
|
+
}
|
|
6964
|
+
|
|
6965
|
+
async function stopRequestRun(req) {
|
|
6966
|
+
try {
|
|
6967
|
+
await api(`/api/requests/${encodeURIComponent(req.id)}/run/stop`, { method: 'POST' });
|
|
6968
|
+
await loadRequests();
|
|
6969
|
+
renderRequests();
|
|
6970
|
+
} catch (e) { reportErr(e); }
|
|
6971
|
+
}
|
|
6972
|
+
|
|
6973
|
+
/**
|
|
6974
|
+
* Folder + which terminal AI, then run. Reached from the split button's ▾ and automatically
|
|
6975
|
+
* whenever a run is refused for want of a usable folder.
|
|
6976
|
+
*
|
|
6977
|
+
* A LOOP, not recursion, because the refusal path can repeat: §B says an unusable folder is a
|
|
6978
|
+
* MODAL, not a toast, so a bad path re-opens this same form carrying the server's whole sentence
|
|
6979
|
+
* and the value the user typed — never a toast they have to remember while retyping.
|
|
6980
|
+
*/
|
|
6981
|
+
async function openRunOptions(req, problem) {
|
|
6982
|
+
const key = runProjectKey(req);
|
|
6983
|
+
let info;
|
|
6984
|
+
try { info = await api(`/api/terminal-runtimes${key ? `?project=${encodeURIComponent(key)}` : ''}`); }
|
|
6985
|
+
catch (e) { reportErr(e); return null; }
|
|
6986
|
+
const found = (info.runtimes || []).filter((r) => r && r.state === 'found');
|
|
6987
|
+
if (!found.length) { showToast('No terminal AI found on this machine.', 'warn'); return null; }
|
|
6988
|
+
let folder = info.folder || '';
|
|
6989
|
+
let sub = problem || '';
|
|
6990
|
+
// Tracked SEPARATELY from `sub`, because the two are different messages. `problem` on the first
|
|
6991
|
+
// open is "you haven't chosen a folder yet" — nothing was refused, and titling that
|
|
6992
|
+
// "That folder won't work" blames the user for a folder they never typed.
|
|
6993
|
+
let refused = false;
|
|
6994
|
+
for (;;) {
|
|
6995
|
+
const res = await formModal({
|
|
6996
|
+
// The TITLE carries the refusal too, not just the sub. Both are re-set per open, so this
|
|
6997
|
+
// leaks nothing to the next caller — and without it the only thing that changes on a bad
|
|
6998
|
+
// folder is one line of muted grey, in the same tier as the explanation it replaced.
|
|
6999
|
+
title: refused ? 'That folder won’t work' : 'Run this for me',
|
|
7000
|
+
sub: sub || 'floless starts your own terminal AI in a folder you choose and hands it this request. It runs on your machine, with your login.',
|
|
7001
|
+
fields: [
|
|
7002
|
+
{
|
|
7003
|
+
name: 'folder', label: 'Folder to work in', value: folder,
|
|
7004
|
+
placeholder: 'C:\\Repos\\my-project',
|
|
7005
|
+
},
|
|
7006
|
+
{
|
|
7007
|
+
name: 'runtime', label: 'Which terminal AI', type: 'select', value: info.provider || found[0].id,
|
|
7008
|
+
options: found.map((r) => ({ value: r.id, label: r.label, meta: r.command })),
|
|
7009
|
+
},
|
|
7010
|
+
],
|
|
7011
|
+
// §D2, stated once at the moment the user picks the folder — the point at which they still
|
|
7012
|
+
// have the context to judge. NOT re-shown on every run, which only trains dismissal.
|
|
7013
|
+
footnote: 'Your terminal AI reads and edits this folder unattended, including any instructions it finds in files there. Point it at a folder you trust — and open your own terminal in the same folder later to pick the session up.',
|
|
7014
|
+
okLabel: 'Run it',
|
|
7015
|
+
});
|
|
7016
|
+
if (!res) return null;
|
|
7017
|
+
folder = String(res.folder || '').trim();
|
|
7018
|
+
try {
|
|
7019
|
+
// Always re-nominated, even unchanged: it is also the only re-validation that the folder is
|
|
7020
|
+
// still there and still writable at the moment the user asks for a run.
|
|
7021
|
+
await api('/api/terminal-runtimes/folder', {
|
|
7022
|
+
method: 'PUT', body: JSON.stringify({ project: key, folder }),
|
|
7023
|
+
});
|
|
7024
|
+
} catch (e) {
|
|
7025
|
+
sub = (e && e.message) || 'That folder can’t be used.';
|
|
7026
|
+
refused = true;
|
|
7027
|
+
continue;
|
|
7028
|
+
}
|
|
7029
|
+
return runRequestHeadless(req, res.runtime);
|
|
7030
|
+
}
|
|
7031
|
+
}
|
|
7032
|
+
|
|
6884
7033
|
let requestHelpReq = null;
|
|
6885
7034
|
let requestHelpReturnFocus = null;
|
|
6886
7035
|
function closeRequestHelp({ restoreFocus = true } = {}) {
|
|
@@ -6917,9 +7066,61 @@
|
|
|
6917
7066
|
? 'The web UI queues the drawing read; your terminal agent applies it and reports progress back here.'
|
|
6918
7067
|
: 'The web UI queues the request; your terminal agent applies it and reports progress back here.';
|
|
6919
7068
|
if ($copy) $copy.hidden = copied;
|
|
7069
|
+
// Back to the "not started" face on every open — the previous request's run status must never
|
|
7070
|
+
// be the first thing the next one shows.
|
|
7071
|
+
setRequestHelpRunning(null);
|
|
6920
7072
|
showModal($m);
|
|
6921
7073
|
const shell = $m.querySelector('.modal.request-help');
|
|
6922
7074
|
if (shell) { try { shell.focus(); } catch { /* not focusable */ } }
|
|
7075
|
+
// Detection is a fetch, and this modal is opened synchronously by the caller. Reveal the split
|
|
7076
|
+
// when the answer lands rather than blocking the modal on it — and only if THIS request is
|
|
7077
|
+
// still the one on screen, since a second queue can land while the first fetch is in flight.
|
|
7078
|
+
refreshHeadless().then(() => { if (requestHelpReq === req) syncRequestHelpRun(); });
|
|
7079
|
+
syncRequestHelpRun();
|
|
7080
|
+
}
|
|
7081
|
+
|
|
7082
|
+
/** Show the run split only when this request's type can run AND a runtime exists (§E1/§E4). */
|
|
7083
|
+
function syncRequestHelpRun() {
|
|
7084
|
+
const $split = document.getElementById('request-help-run-split');
|
|
7085
|
+
const $open = document.getElementById('request-help-open');
|
|
7086
|
+
if (!$split || !$open) return;
|
|
7087
|
+
const can = !!(requestHelpReq && requestHelpReq.canRun && headlessReady());
|
|
7088
|
+
$split.hidden = !can;
|
|
7089
|
+
// Exactly one primary in the row: Run takes it when it is there, Open Requests reclaims it
|
|
7090
|
+
// when it is not — a modal with no emphasized action reads as unfinished.
|
|
7091
|
+
$open.classList.toggle('primary', !can);
|
|
7092
|
+
}
|
|
7093
|
+
|
|
7094
|
+
/**
|
|
7095
|
+
* Swap the modal's three "what you must do" steps for what floless is doing instead.
|
|
7096
|
+
*
|
|
7097
|
+
* The steps are REPLACED, not relabelled: after "Run it for me" there is no paste to describe,
|
|
7098
|
+
* and a rewritten step 2 would still be a numbered instruction for the user.
|
|
7099
|
+
*/
|
|
7100
|
+
function setRequestHelpRunning(run) {
|
|
7101
|
+
const $steps = document.getElementById('request-help-steps');
|
|
7102
|
+
const $status = document.getElementById('request-help-run-status');
|
|
7103
|
+
const $title = document.getElementById('request-help-run-title');
|
|
7104
|
+
const $split = document.getElementById('request-help-run-split');
|
|
7105
|
+
const $note = document.getElementById('request-help-note');
|
|
7106
|
+
if (!$steps || !$status) return;
|
|
7107
|
+
$steps.hidden = !!run;
|
|
7108
|
+
$status.hidden = !run;
|
|
7109
|
+
if (!run) {
|
|
7110
|
+
// Cleared, not merely hidden. Leaving the previous request's "Running in Claude Code · <cwd>"
|
|
7111
|
+
// in the DOM means one CSS slip away from the next request opening on somebody else's run.
|
|
7112
|
+
if ($title) $title.textContent = '';
|
|
7113
|
+
return;
|
|
7114
|
+
}
|
|
7115
|
+
if ($split) $split.hidden = true; // it started; there is nothing left to start
|
|
7116
|
+
// …which leaves the row with no emphasized action, so Open Requests takes the primary back.
|
|
7117
|
+
// `syncRequestHelpRun` can't do this: it would re-show the split it just retired.
|
|
7118
|
+
const $open = document.getElementById('request-help-open');
|
|
7119
|
+
if ($open) $open.classList.add('primary');
|
|
7120
|
+
if ($title) {
|
|
7121
|
+
$title.innerHTML = `Running in <strong>${escapeHtml(runtimeLabel(run.runtime))}</strong>${run.cwd ? ` · <code>${escapeHtml(run.cwd)}</code>` : ''}`;
|
|
7122
|
+
}
|
|
7123
|
+
if ($note) $note.textContent = 'Your terminal AI does the work and clears the request itself. Nothing was sent anywhere — this is the same CLI you would have opened yourself.';
|
|
6923
7124
|
}
|
|
6924
7125
|
|
|
6925
7126
|
async function useTemplate(templateId) {
|
|
@@ -7227,6 +7428,12 @@
|
|
|
7227
7428
|
if ($showAll) $showAll.onclick = () => setRequestScopeAll(true);
|
|
7228
7429
|
return;
|
|
7229
7430
|
}
|
|
7431
|
+
// Whether a non-runnable row explains itself, decided ONCE per paint over what is actually on
|
|
7432
|
+
// screen. A user who has never seen a ▶ has nothing to wonder about, so a queue of nothing but
|
|
7433
|
+
// guides stays quiet; the moment a runnable row sits beside a `guide`, the guide says why it
|
|
7434
|
+
// has no button. Derived from this paint — deliberately not a stored "has run before" flag,
|
|
7435
|
+
// which would make the same list read differently for two people.
|
|
7436
|
+
const anyRunnable = headlessReady() && shown.some((r) => r && r.canRun);
|
|
7230
7437
|
$list.innerHTML = shown.map((r) => {
|
|
7231
7438
|
const label = requestLabel(r);
|
|
7232
7439
|
const badgeCls = r.type === 'tweak' || r.type === 'ui-customize' || r.type === 'rebake' || r.type === 'revision-read' || r.type === 'knowledge-organize' || r.type === 'knowledge-adjust' || r.type === 'tweak-contract' ? 'req-type req-type-tweak' : 'req-type';
|
|
@@ -7244,23 +7451,54 @@
|
|
|
7244
7451
|
// A knowledge-organize is resolved by its own finish/fail lifecycle POST. Offering a ✕ here
|
|
7245
7452
|
// would let the user delete a request the terminal AI is mid-way through, 404-ing finish/fail
|
|
7246
7453
|
// and stranding the organize lock until its stale timeout. Show why it can't be cleared instead.
|
|
7454
|
+
const run = r.run || null;
|
|
7455
|
+
const inFlight = !!run && (run.state === 'queued' || run.state === 'running');
|
|
7247
7456
|
const lifecycleOwned = r.type === 'knowledge-organize';
|
|
7457
|
+
// ✕ goes away while a run is live, for the same reason it goes away on a knowledge-organize:
|
|
7458
|
+
// deleting the request out from under a working agent leaves it unable to clear its own work,
|
|
7459
|
+
// and the run then lands in `exited-unresolved` for a reason the user caused and cannot see.
|
|
7248
7460
|
const del = lifecycleOwned
|
|
7249
7461
|
? '<span class="req-lifecycle" data-tip="This clears itself when your terminal AI finishes or fails the organize">finishing in your terminal</span>'
|
|
7250
|
-
:
|
|
7462
|
+
: inFlight
|
|
7463
|
+
? '<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>'
|
|
7464
|
+
: `<button class="req-del" data-id="${escapeAttr(r.id)}" data-tip="Clear this request">×</button>`;
|
|
7465
|
+
// A parked run gets NO re-run: it is waiting on a decision only the human can make, and a
|
|
7466
|
+
// second headless attempt would either abandon that question or look like floless answering
|
|
7467
|
+
// it. Every other terminal state has nothing pending, so running again is a fair offer.
|
|
7468
|
+
const canRunNow = headlessReady() && r.canRun && !inFlight && !(run && run.state === 'needs-you');
|
|
7469
|
+
const runBtn = inFlight
|
|
7470
|
+
? `<button class="req-stop" data-id="${escapeAttr(r.id)}" data-tip="Stop this run">■</button>`
|
|
7471
|
+
: canRunNow
|
|
7472
|
+
? `<button class="req-run" data-id="${escapeAttr(r.id)}" data-tip="${run ? 'Run it again in your terminal AI, headless' : 'Let floless run this in your terminal AI'}">▶</button>`
|
|
7473
|
+
: '';
|
|
7251
7474
|
return `
|
|
7252
7475
|
<div class="req-item" data-id="${escapeAttr(r.id)}">
|
|
7253
7476
|
<div class="req-info">
|
|
7254
7477
|
<div class="req-head"><span class="${badgeCls}">${label}</span> ${owner ? `<span class="req-owner">${highlightQuery(owner, requestQuery)}</span>` : ''}${time}</div>
|
|
7255
7478
|
<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>
|
|
7256
7479
|
${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>` : ''}
|
|
7480
|
+
${runStatusHtml(run)}
|
|
7481
|
+
${!r.canRun && r.runWhy && anyRunnable ? `<div class="req-why-not">Runs only from your terminal — ${escapeHtml(r.runWhy)}</div>` : ''}
|
|
7257
7482
|
</div>
|
|
7258
7483
|
<div class="req-actions">
|
|
7484
|
+
${runBtn}
|
|
7259
7485
|
<button class="req-copy" data-id="${escapeAttr(r.id)}" data-tip="Copy this instruction">⧉</button>
|
|
7260
7486
|
${del}
|
|
7261
7487
|
</div>
|
|
7262
7488
|
</div>`;
|
|
7263
7489
|
}).join('');
|
|
7490
|
+
$list.querySelectorAll('.req-run').forEach((b) => {
|
|
7491
|
+
b.onclick = () => {
|
|
7492
|
+
const r = pendingRequests.find((x) => x.id === b.dataset.id);
|
|
7493
|
+
if (r) void runRequestHeadless(r);
|
|
7494
|
+
};
|
|
7495
|
+
});
|
|
7496
|
+
$list.querySelectorAll('.req-stop').forEach((b) => {
|
|
7497
|
+
b.onclick = () => {
|
|
7498
|
+
const r = pendingRequests.find((x) => x.id === b.dataset.id);
|
|
7499
|
+
if (r) void stopRequestRun(r);
|
|
7500
|
+
};
|
|
7501
|
+
});
|
|
7264
7502
|
$list.querySelectorAll('.req-copy').forEach((b) => {
|
|
7265
7503
|
b.onclick = async () => {
|
|
7266
7504
|
const r = pendingRequests.find((x) => x.id === b.dataset.id);
|
|
@@ -7335,7 +7573,10 @@
|
|
|
7335
7573
|
// Scroll only: the flash belongs to the authoritative paint below, or the cached one would flash a
|
|
7336
7574
|
// row the refresh is about to replace.
|
|
7337
7575
|
revealRequestRow(targetId, true /* scrollOnly */);
|
|
7338
|
-
|
|
7576
|
+
// Detection rides ALONGSIDE the queue fetch, never in front of it: whether a ▶ is offered must
|
|
7577
|
+
// not be able to delay the list itself, and a detection that fails simply leaves the rows
|
|
7578
|
+
// button-less rather than leaving the window empty.
|
|
7579
|
+
await Promise.all([loadRequests(), refreshHeadless()]);
|
|
7339
7580
|
// NOTHING here may touch requestScopeAll. Scoping the window to what you have open is a
|
|
7340
7581
|
// deliberate decision (#633), and revealing a row is not a licence to override it: a reveal that
|
|
7341
7582
|
// widened would answer a different question than the one asked, and the destructive verb is
|
|
@@ -7831,8 +8072,95 @@
|
|
|
7831
8072
|
$integrationsModal.classList.add('show');
|
|
7832
8073
|
renderIntegrations();
|
|
7833
8074
|
refreshIntegrations();
|
|
8075
|
+
refreshHeadless().then(renderRuntimeSection);
|
|
7834
8076
|
};
|
|
7835
8077
|
|
|
8078
|
+
/**
|
|
8079
|
+
* Which terminal AIs are installed, which one headless runs use, and the folder they run in.
|
|
8080
|
+
*
|
|
8081
|
+
* Its own section rather than a card in the integrations grid: a detected CLI is not an OAuth
|
|
8082
|
+
* connection. There is no Connect, no expiry — and deliberately no "ready", because a signed-out
|
|
8083
|
+
* CLI resolves to a binary exactly like a working one. So `Installed` / `Not installed` are both
|
|
8084
|
+
* NEUTRAL: --ok green two rows under a real "Connected" badge would claim readiness floless has
|
|
8085
|
+
* not earned, and the first the user would hear of it is a run that dies on a login prompt.
|
|
8086
|
+
*/
|
|
8087
|
+
function renderRuntimeSection() {
|
|
8088
|
+
const $sec = document.getElementById('int-runtimes-section');
|
|
8089
|
+
const $list = document.getElementById('int-runtimes');
|
|
8090
|
+
const $folder = document.getElementById('int-folder');
|
|
8091
|
+
if (!$sec || !$list || !$folder) return;
|
|
8092
|
+
const rts = headlessRuntimes();
|
|
8093
|
+
// Hidden entirely when detection failed — an empty "Headless runs" box explains nothing. When
|
|
8094
|
+
// detection SUCCEEDED and found nothing, the rows are the explanation (each carries its command).
|
|
8095
|
+
$sec.hidden = !rts.length;
|
|
8096
|
+
if (!rts.length) return;
|
|
8097
|
+
const active = headlessInfo && headlessInfo.provider;
|
|
8098
|
+
$list.innerHTML = rts.map((r) => {
|
|
8099
|
+
const found = r.state === 'found';
|
|
8100
|
+
const isDefault = found && r.id === active;
|
|
8101
|
+
return `
|
|
8102
|
+
<div class="int-rt${isDefault ? ' is-default' : ''}${found ? '' : ' is-missing'}">
|
|
8103
|
+
<div>
|
|
8104
|
+
<div class="int-rt-name">${escapeHtml(r.label)}${isDefault ? '<span class="int-rt-pill">Default</span>' : ''}</div>
|
|
8105
|
+
<div class="int-rt-blurb">${escapeHtml(r.blurb)} · <code>${escapeHtml(r.command)}</code></div>
|
|
8106
|
+
<div class="int-rt-where">${found
|
|
8107
|
+
? `Found at ${escapeHtml(r.path || '')}`
|
|
8108
|
+
: `Not installed — floless looks for <code>${escapeHtml(r.command)}</code>`}</div>
|
|
8109
|
+
</div>
|
|
8110
|
+
<div class="int-rt-side">
|
|
8111
|
+
<span class="int-rt-badge">${found ? 'Installed' : 'Not installed'}</span>
|
|
8112
|
+
${found && !isDefault ? `<button class="int-action" data-rt="${escapeAttr(r.id)}">Use this one</button>` : ''}
|
|
8113
|
+
</div>
|
|
8114
|
+
</div>`;
|
|
8115
|
+
}).join('');
|
|
8116
|
+
$list.querySelectorAll('[data-rt]').forEach((b) => {
|
|
8117
|
+
b.onclick = async () => {
|
|
8118
|
+
try {
|
|
8119
|
+
await api('/api/terminal-runtimes/provider', { method: 'PUT', body: JSON.stringify({ provider: b.dataset.rt }) });
|
|
8120
|
+
await refreshHeadless();
|
|
8121
|
+
renderRuntimeSection();
|
|
8122
|
+
showToast(`Headless runs will use ${runtimeLabel(b.dataset.rt)}`, 'ok');
|
|
8123
|
+
} catch (e) { reportErr(e); }
|
|
8124
|
+
};
|
|
8125
|
+
});
|
|
8126
|
+
const folder = headlessInfo && headlessInfo.folder;
|
|
8127
|
+
$folder.innerHTML = `
|
|
8128
|
+
<span>Runs in</span>
|
|
8129
|
+
<span class="int-folder-path${folder ? '' : ' is-unset'}"${folder ? ` data-tip="${escapeAttr(folder)}"` : ''}>${folder ? escapeHtml(folder) : 'not chosen yet — floless will ask the first time you run one'}</span>
|
|
8130
|
+
<button class="int-action" id="int-folder-set">${folder ? 'Change…' : 'Choose…'}</button>`;
|
|
8131
|
+
const $set = document.getElementById('int-folder-set');
|
|
8132
|
+
if ($set) $set.onclick = () => { void nominateDefaultFolder(); };
|
|
8133
|
+
}
|
|
8134
|
+
|
|
8135
|
+
/**
|
|
8136
|
+
* The workspace-level default folder. Per-project folders are nominated from the run itself,
|
|
8137
|
+
* where the user can see which request they are answering for.
|
|
8138
|
+
*
|
|
8139
|
+
* A refusal re-opens THIS form carrying the server's whole sentence — §B: an unusable folder is a
|
|
8140
|
+
* modal, not a toast. Same loop as `openRunOptions` for the same reason.
|
|
8141
|
+
*/
|
|
8142
|
+
async function nominateDefaultFolder() {
|
|
8143
|
+
let folder = (headlessInfo && headlessInfo.folder) || '';
|
|
8144
|
+
let sub = '';
|
|
8145
|
+
for (;;) {
|
|
8146
|
+
const res = await formModal({
|
|
8147
|
+
title: sub ? 'That folder won’t work' : 'Folder for headless runs',
|
|
8148
|
+
sub: sub || 'Where floless starts your terminal AI when it runs a request for you. Individual projects can override this.',
|
|
8149
|
+
fields: [{ name: 'folder', label: 'Folder', value: folder, placeholder: 'C:\\Repos\\my-project' }],
|
|
8150
|
+
footnote: 'Your terminal AI reads and edits this folder unattended, including any instructions it finds in files there. Point it at a folder you trust — and open your own terminal in the same folder later to pick a session up.',
|
|
8151
|
+
okLabel: 'Save',
|
|
8152
|
+
});
|
|
8153
|
+
if (!res) return;
|
|
8154
|
+
folder = String(res.folder || '').trim();
|
|
8155
|
+
try {
|
|
8156
|
+
await api('/api/terminal-runtimes/folder', { method: 'PUT', body: JSON.stringify({ project: null, folder }) });
|
|
8157
|
+
} catch (e) { sub = (e && e.message) || 'That folder can’t be used.'; continue; }
|
|
8158
|
+
await refreshHeadless();
|
|
8159
|
+
renderRuntimeSection();
|
|
8160
|
+
return;
|
|
8161
|
+
}
|
|
8162
|
+
}
|
|
8163
|
+
|
|
7836
8164
|
// Re-fetch live connection state from the local vault; re-render if the modal
|
|
7837
8165
|
// is open. Called on open and whenever a credential file changes (SSE), so an
|
|
7838
8166
|
// open window flips to Connected the moment `aware connect` writes the token.
|
|
@@ -8965,6 +9293,21 @@
|
|
|
8965
9293
|
if ($sub) $sub.textContent = 'Terminal instructions copied. Open the terminal agent and paste them there.';
|
|
8966
9294
|
}
|
|
8967
9295
|
};
|
|
9296
|
+
// ▶ runs with the resolved default; ▾ asks folder + which terminal AI first. Both leave the modal
|
|
9297
|
+
// OPEN on success and swap its steps for the run status — closing it would hide the one sentence
|
|
9298
|
+
// that says what floless just started on the user's behalf.
|
|
9299
|
+
const runFromHelpModal = async (withOptions) => {
|
|
9300
|
+
const req = requestHelpReq;
|
|
9301
|
+
if (!req) return;
|
|
9302
|
+
const res = withOptions ? await openRunOptions(req) : await runRequestHeadless(req);
|
|
9303
|
+
// Still the same request on screen? A slow spawn plus a fast second queue could otherwise
|
|
9304
|
+
// stamp this run's status onto somebody else's modal.
|
|
9305
|
+
if (res && res.run && requestHelpReq === req) setRequestHelpRunning(res.run);
|
|
9306
|
+
};
|
|
9307
|
+
const $requestHelpRun = document.getElementById('request-help-run');
|
|
9308
|
+
const $requestHelpRunOpts = document.getElementById('request-help-run-opts');
|
|
9309
|
+
if ($requestHelpRun) $requestHelpRun.onclick = () => { void runFromHelpModal(false); };
|
|
9310
|
+
if ($requestHelpRunOpts) $requestHelpRunOpts.onclick = () => { void runFromHelpModal(true); };
|
|
8968
9311
|
if ($requestHelpModal) onBackdropDismiss($requestHelpModal, () => closeRequestHelp());
|
|
8969
9312
|
document.addEventListener('keydown', (e) => {
|
|
8970
9313
|
if (e.key === 'Escape' && $requestHelpModal && $requestHelpModal.classList.contains('show')) {
|
package/dist/web/index.html
CHANGED
|
@@ -734,6 +734,18 @@
|
|
|
734
734
|
<div class="integrations-hint">
|
|
735
735
|
Tokens are stored encrypted by AWARE under <code>~/.aware/credentials/</code>. To connect or refresh, run <code>aware connect <name></code> in claude-code (or codex / opencode). FloLess never touches secrets directly.
|
|
736
736
|
</div>
|
|
737
|
+
<!-- Headless runs (#571): which terminal AI floless may start for you, and where it runs.
|
|
738
|
+
Its own full-width section rather than a card in the 2-col grid below, because a
|
|
739
|
+
detected CLI is not an OAuth connection: there is no Connect, no expiry, and
|
|
740
|
+
deliberately no "ready" state — a signed-out CLI looks identical to a working one, so
|
|
741
|
+
a green tick two rows under a real "Connected" badge would claim what we can't back.
|
|
742
|
+
Rendered per-open by renderRuntimeSection() in aware.js. -->
|
|
743
|
+
<div class="int-section" id="int-runtimes-section" hidden>
|
|
744
|
+
<div class="int-section-title">Headless runs</div>
|
|
745
|
+
<div class="int-section-sub">floless can start your own terminal AI on a queued request instead of you pasting it. It runs on your machine, with your login — floless never sends your work anywhere.</div>
|
|
746
|
+
<div class="int-runtimes" id="int-runtimes"></div>
|
|
747
|
+
<div class="int-folder" id="int-folder"></div>
|
|
748
|
+
</div>
|
|
737
749
|
<div class="integrations-list" id="integrations-list"></div>
|
|
738
750
|
<div class="modal-actions">
|
|
739
751
|
<button id="integrations-close">Close</button>
|
|
@@ -772,11 +784,30 @@
|
|
|
772
784
|
<div class="request-help-step"><span>2</span><p>Paste the copied instructions.</p></div>
|
|
773
785
|
<div class="request-help-step"><span>3</span><p>Return here to track progress in Requests.</p></div>
|
|
774
786
|
</div>
|
|
787
|
+
<!-- Replaces the three steps above once floless has started the work itself: they describe
|
|
788
|
+
things the user must do, and after "Run it for me" there is nothing left for them to do.
|
|
789
|
+
Swapped wholesale rather than relabelled, or the modal would describe a paste that never
|
|
790
|
+
happened. Deliberately NOT live — this modal is dismissed in seconds and the Requests row
|
|
791
|
+
owns liveness; a second poller for a transient modal is plumbing nobody reads. -->
|
|
792
|
+
<div class="request-help-run-status" id="request-help-run-status" hidden>
|
|
793
|
+
<span class="rtn-spinner" aria-hidden="true"></span>
|
|
794
|
+
<div>
|
|
795
|
+
<p class="rhrs-title" id="request-help-run-title"></p>
|
|
796
|
+
<p class="rhrs-sub">This can take a few minutes, and you don’t need to wait. Keep working — the row in Requests updates as it goes.</p>
|
|
797
|
+
</div>
|
|
798
|
+
</div>
|
|
775
799
|
<div class="request-help-note" id="request-help-note">The web UI queues the request; your terminal agent applies it and reports progress back here.</div>
|
|
776
800
|
<div class="modal-actions">
|
|
777
801
|
<button id="request-help-copy" hidden>Copy instruction</button>
|
|
778
802
|
<button id="request-help-keep">Keep working</button>
|
|
779
|
-
<button id="request-help-open"
|
|
803
|
+
<button id="request-help-open">Open Requests</button>
|
|
804
|
+
<!-- The §E4 split: ▶ runs with the current default, ▾ opens folder + which terminal AI for
|
|
805
|
+
THIS run only. Hidden outright when no runtime is installed or this request's type
|
|
806
|
+
can't run headless — hide, never disable. -->
|
|
807
|
+
<span class="run-split" id="request-help-run-split" hidden>
|
|
808
|
+
<button id="request-help-run" class="primary run-split-main">▶ Run it for me</button>
|
|
809
|
+
<button id="request-help-run-opts" class="primary run-split-caret" aria-label="Choose folder and terminal AI" data-tip="Choose the folder and which terminal AI to use">▾</button>
|
|
810
|
+
</span>
|
|
780
811
|
</div>
|
|
781
812
|
</div>
|
|
782
813
|
</div>
|
|
@@ -430,10 +430,22 @@ function orientMember(mesh, dir, el) {
|
|
|
430
430
|
const m = dir.clone().normalize();
|
|
431
431
|
// el.rot (section roll about the reference line) applies to ANY member — columns AND beams. A member
|
|
432
432
|
// rendered as an explicit BOX (traced section, no profile) rolls about its length axis (local Y here).
|
|
433
|
+
// For a non-plumb BOX, first align its authored depth axis with world-up; a plumb member has no
|
|
434
|
+
// plan direction and `positionH` is unavailable, so its roll below only establishes display facing.
|
|
433
435
|
const rollRad = (el && typeof el.rot === 'number' && el.rot) ? el.rot * Math.PI / 180 : 0;
|
|
434
436
|
if (mesh.geometry.type === 'BoxGeometry') {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
+
const q = new THREE.Quaternion().setFromUnitVectors(_YA, m); // length on local Y
|
|
438
|
+
const proj = _ZA.clone().sub(m.clone().multiplyScalar(_ZA.dot(m)));
|
|
439
|
+
if (proj.lengthSq() > 1e-6) {
|
|
440
|
+
proj.normalize();
|
|
441
|
+
const lz = _ZA.clone().applyQuaternion(q); // local depth axis
|
|
442
|
+
const ang = Math.atan2(lz.clone().cross(proj).dot(m), lz.dot(proj));
|
|
443
|
+
q.premultiply(new THREE.Quaternion().setFromAxisAngle(m, ang));
|
|
444
|
+
if (rollRad) q.premultiply(new THREE.Quaternion().setFromAxisAngle(m, rollRad));
|
|
445
|
+
} else if (el && typeof el.rot === 'number') {
|
|
446
|
+
q.premultiply(new THREE.Quaternion().setFromAxisAngle(m, el.rot * Math.PI / 180));
|
|
447
|
+
}
|
|
448
|
+
mesh.quaternion.copy(q);
|
|
437
449
|
return;
|
|
438
450
|
}
|
|
439
451
|
const q = new THREE.Quaternion().setFromUnitVectors(_ZA, m); // member axis = extrude (local Z)
|