@floless/app 0.153.0 → 0.155.0
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 +51767 -38222
- package/dist/schemas/revit.model.v1.schema.json +5 -0
- package/dist/schemas/steel.model.v2.schema.json +19 -5
- package/dist/skills/floless-app-new-workflow/SKILL.md +8 -2
- package/dist/skills/floless-app-onboarding/SKILL.md +31 -19
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +20 -11
- package/dist/skills/floless-app-queue/SKILL.md +23 -4
- package/dist/skills/floless-app-steel-model/SKILL.md +23 -2
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +158 -65
- package/dist/skills/floless-app-workflows/SKILL.md +23 -5
- package/dist/skills/floless-app-workflows/references/blender-exec.md +183 -0
- package/dist/skills/floless-app-workflows/references/dev-server-and-run-trace.md +27 -12
- package/dist/templates/blender-construction-sequence.flo +96 -0
- package/dist/web/agents.js +33 -13
- package/dist/web/app.css +331 -34
- package/dist/web/app.js +12 -1
- package/dist/web/aware.js +1167 -137
- package/dist/web/chat-question-card.js +477 -0
- package/dist/web/chat.css +237 -25
- package/dist/web/chat.js +2156 -889
- package/dist/web/commands-shell.js +578 -21
- package/dist/web/commands-steel.js +105 -4
- package/dist/web/guide.js +217 -16
- package/dist/web/index.html +104 -10
- package/dist/web/instructor.js +10 -9
- package/dist/web/left-pane.js +43 -6
- package/dist/web/media-player.js +234 -0
- package/dist/web/model-editor-contract.js +2 -0
- package/dist/web/model-editor-revit-adapter.js +1 -0
- package/dist/web/model-editor-steel-adapter.js +89 -1
- package/dist/web/model-panel-bridge.js +16 -2
- package/dist/web/model-view-query.js +590 -0
- package/dist/web/model-viewport-revit-adapter.js +15 -1
- package/dist/web/model-viewport-toolbar.js +5 -2
- package/dist/web/pages.js +592 -0
- package/dist/web/panels.js +2 -1
- package/dist/web/revit-editor.js +182 -16
- package/dist/web/run-progress.js +193 -0
- package/dist/web/run-strip.js +173 -0
- package/dist/web/steel-3d-core.js +70 -0
- package/dist/web/steel-editor.html +2751 -219
- package/dist/web/steel-frames-core.js +958 -0
- package/dist/web/steel-last-seen.js +315 -0
- package/dist/web/steel-marks-core.js +530 -0
- package/dist/web/steel-model-slim.js +95 -0
- package/dist/web/steel-model-v2-client-validation.js +14 -2
- package/dist/web/steel-model-v2-commands.js +258 -27
- package/dist/web/steel-model-v2-projection.js +78 -18
- package/dist/web/steel-read-confidence.js +11 -2
- package/dist/web/tekla-structural-grid-adapter.js +7 -1
- package/dist/web/tool-updates.js +141 -33
- package/dist/web/workspaces.js +446 -30
- package/package.json +3 -2
package/dist/web/aware.js
CHANGED
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
// explicitly via "Save inputs" (Ctrl+S) and rehydrated when the app opens.
|
|
110
110
|
const LS_LAST_APP = 'floless:lastApp';
|
|
111
111
|
const lsInputsKey = (id) => 'floless:inputs:' + id;
|
|
112
|
+
// #2228: the long run this tab is showing progress for (see the live-progress controller near runningFlo).
|
|
113
|
+
// Declared up here because syncRunControls reads it, and that runs during start-up.
|
|
114
|
+
let liveRun = null; // { appId, token, runId, owner, surface, view, shown, showTimer, lingerTimer, ended, startedAt }
|
|
112
115
|
function loadSavedInputs(id) {
|
|
113
116
|
try {
|
|
114
117
|
const v = JSON.parse(localStorage.getItem(lsInputsKey(id)) || 'null');
|
|
@@ -518,6 +521,9 @@
|
|
|
518
521
|
for (const raw of String(code).split(/\r?\n/)) {
|
|
519
522
|
const line = raw.trim();
|
|
520
523
|
if (line.startsWith('//')) { out.push(line.replace(/^\/\/+\s?/, '')); continue; }
|
|
524
|
+
// A Python (blender/exec) or Ruby (sketchup) script opens with `# …`. Only `#` followed by a space or
|
|
525
|
+
// nothing counts, so a C# directive (`#nullable`, `#region`) or a shebang (`#!`) never becomes prose.
|
|
526
|
+
if (/^#(\s|$)/.test(line)) { out.push(line.replace(/^#+\s?/, '')); continue; }
|
|
521
527
|
if (line === '') { if (out.length) break; else continue; }
|
|
522
528
|
break; // first real (non-comment, non-blank) line ends the header block
|
|
523
529
|
}
|
|
@@ -538,7 +544,11 @@
|
|
|
538
544
|
const inputs = n.inputs && Object.keys(n.inputs).length ? n.inputs : n.config;
|
|
539
545
|
// The exec node's Roslyn C# (the actual script the host runs). null for
|
|
540
546
|
// pure-agent nodes that carry no inline code.
|
|
541
|
-
|
|
547
|
+
// A builtin agent (blender/exec) takes its script as an input rather than in `config:` — the same
|
|
548
|
+
// authored code either way, so it gets the same Description and Code tab.
|
|
549
|
+
const execSource = n.config && typeof n.config.code === 'string' ? n.config.code
|
|
550
|
+
: n.inputs && typeof n.inputs.code === 'string' ? n.inputs.code : null;
|
|
551
|
+
const pythonSource = n.agent === 'blender';
|
|
542
552
|
// Description tab: a plain-English explanation + a small input table that
|
|
543
553
|
// EXCLUDES the code (code belongs to the Code tab, never dumped here).
|
|
544
554
|
const plainDesc = execSource ? leadingComment(execSource) : '';
|
|
@@ -567,7 +577,9 @@
|
|
|
567
577
|
// live host) that's `config.code` straight from the .flo — the same text
|
|
568
578
|
// the host compiles, so "Debug in VS" attaches to exactly this. For
|
|
569
579
|
// non-exec nodes there is no script; we show the resolved lockfile YAML.
|
|
570
|
-
code: execSource
|
|
580
|
+
code: execSource && pythonSource
|
|
581
|
+
? escapeHtml(`# ${n.agent}${n.command ? '.' + n.command : ''} · node "${n.id}" · live source from ~/.aware/apps/${app.id}/\n${execSource}`)
|
|
582
|
+
: execSource
|
|
571
583
|
? highlightCSharp(`// ${n.agent || n.kind}${n.command ? '.' + n.command : ''} · node "${n.id}" · live source from ~/.aware/apps/${app.id}/\n${execSource}`)
|
|
572
584
|
: app.lock.present
|
|
573
585
|
? `<span class="cm"># ${escapeHtml(app.id)}.lock · node "${escapeHtml(n.id)}"</span>\n${escapeHtml(nodeYaml(n))}`
|
|
@@ -1104,6 +1116,80 @@
|
|
|
1104
1116
|
|
|
1105
1117
|
let reportRunning = false;
|
|
1106
1118
|
let cancelRequested = false;
|
|
1119
|
+
let activeManualRun = null;
|
|
1120
|
+
let stopPending = false;
|
|
1121
|
+
|
|
1122
|
+
function missingRunInputs(app, values) {
|
|
1123
|
+
return (app.inputs || []).filter((input) => {
|
|
1124
|
+
// A baked drawing was consumed during authoring; the approved run uses its baked data.
|
|
1125
|
+
if (input.readStrategy === 'bake') return false;
|
|
1126
|
+
// #2230: output-dir left empty is a choice, not a gap: FloLess gives the run its own folder, so what it renders
|
|
1127
|
+
// plays inside FloLess (server/run-media.ts).
|
|
1128
|
+
if (input.name === 'output-dir') return false;
|
|
1129
|
+
const value = values[input.name];
|
|
1130
|
+
const blank = value === undefined || value === null || String(value).trim() === '';
|
|
1131
|
+
const hasDefault = input.hasDefault === undefined ? input.default !== null && input.default !== undefined : input.hasDefault;
|
|
1132
|
+
return blank && (input.widget === 'workspace-model-revision' || !hasDefault);
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
async function askForMissingRunInputs(app) {
|
|
1137
|
+
const missing = missingRunInputs(app, currentInputs());
|
|
1138
|
+
if (!missing.length) return false;
|
|
1139
|
+
const names = missing.map((input) => input.label || input.name.replace(/_/g, ' ').toLowerCase()).join(', ');
|
|
1140
|
+
showToast(`Choose ${names} in Set inputs, then choose Run workflow. Nothing has started.`, 'info');
|
|
1141
|
+
await openInputsDialog({ focusInputName: missing[0].name });
|
|
1142
|
+
return true;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
function syncReportStopControls() {
|
|
1146
|
+
if (!$reportStop) return;
|
|
1147
|
+
$reportStop.hidden = !(foregroundTrigger || reportRunning && activeManualRun);
|
|
1148
|
+
$reportStop.disabled = cancelRequested || stopPending || foregroundStopping;
|
|
1149
|
+
$reportStop.textContent = cancelRequested ? 'Cancelling…' : stopPending || foregroundStopping ? 'Stopping…' : '■ Stop run';
|
|
1150
|
+
$reportStop.dataset.tip = foregroundTrigger ? 'Stop the live session — the report stops updating on each change' : 'Stop this workflow run';
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
function beginManualRun(appId) {
|
|
1154
|
+
const request = { id: crypto.randomUUID(), appId, stopPromise: null, settled: false };
|
|
1155
|
+
activeManualRun = request;
|
|
1156
|
+
stopPending = false;
|
|
1157
|
+
return request;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
// Run's own outcome is authoritative, even if a Stop acknowledgement was lost or arrived later.
|
|
1161
|
+
async function dispatchManualRun(request, payload) {
|
|
1162
|
+
let result, error;
|
|
1163
|
+
try {
|
|
1164
|
+
result = await api('/api/run', { method: 'POST', body: JSON.stringify({ ...payload, runRequestId: request.id }) });
|
|
1165
|
+
} catch (caught) { error = caught; }
|
|
1166
|
+
// A Stop reply can disappear even after the server has settled this run. Its acknowledgement
|
|
1167
|
+
// cannot hold the authoritative result hostage or change it after completion.
|
|
1168
|
+
request.settled = true;
|
|
1169
|
+
if (activeManualRun === request) cancelRequested = !!(error && error.body && error.body.cancelled);
|
|
1170
|
+
if (error) throw error;
|
|
1171
|
+
return result;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
function finishManualRun(request) {
|
|
1175
|
+
request.settled = true;
|
|
1176
|
+
if (activeManualRun !== request) return;
|
|
1177
|
+
activeManualRun = null;
|
|
1178
|
+
stopPending = false;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
function stoppedRunCopy(body, report = false) {
|
|
1182
|
+
if (report) return 'Report cancelled. No report was saved.';
|
|
1183
|
+
if (body && body.error === 'Run stopped before execution started.') return 'Run stopped before execution started.';
|
|
1184
|
+
if (body && body.error === 'Simulated run stopped.') return 'Simulated run stopped.';
|
|
1185
|
+
return 'Run stopped. Work already sent to the host may remain.';
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
function acceptsManualRunEvent(message) {
|
|
1189
|
+
if (message.runOrigin === 'panel' && !activeManualRun && !state.running && !reportRunning) return true;
|
|
1190
|
+
if (!message.runRequestId) return !activeManualRun;
|
|
1191
|
+
return !!activeManualRun && !cancelRequested && activeManualRun.id === message.runRequestId;
|
|
1192
|
+
}
|
|
1107
1193
|
let runningSimulation = false;
|
|
1108
1194
|
let foregroundTrigger = null;
|
|
1109
1195
|
let foregroundStarting = false;
|
|
@@ -1185,7 +1271,7 @@
|
|
|
1185
1271
|
// same state (it's the reachable Stop while the Viewer covers the header one).
|
|
1186
1272
|
$runBtn.disabled = !app.runnable || reportRunning || state.running || foregroundStarting || foregroundStopping || !!foregroundTrigger;
|
|
1187
1273
|
if ($stopRunBtn) $stopRunBtn.hidden = !(reportRunning || state.running || foregroundStopping || foregroundTrigger);
|
|
1188
|
-
|
|
1274
|
+
syncReportStopControls();
|
|
1189
1275
|
const agentChanged = gateStateFor(app) === 'agent-changed';
|
|
1190
1276
|
$runBtn.dataset.tip = agentChanged
|
|
1191
1277
|
? (app.approvalCheck
|
|
@@ -1728,10 +1814,9 @@
|
|
|
1728
1814
|
return true;
|
|
1729
1815
|
} catch (error) {
|
|
1730
1816
|
const copied = await copyToClipboard(markedInstruction(request));
|
|
1731
|
-
const
|
|
1732
|
-
showToast(
|
|
1733
|
-
|
|
1734
|
-
: `Couldn’t start ${chosen}. Request queued — open Requests to copy it.`, 'err');
|
|
1817
|
+
const workspaceProblem = ['instructor-workspace-root-changed', 'instructor-workspace-earlier-generation', 'instructor-workspace-unavailable'].includes(error?.code);
|
|
1818
|
+
showToast(workspaceProblem ? error.message
|
|
1819
|
+
: `AI Chat couldn’t start this answer. Your question is saved in Requests; open it there to try again.${copied ? ' The question is also copied.' : ''}`, 'err');
|
|
1735
1820
|
try { await loadRequests(); } catch (refreshError) { console.error(refreshError); }
|
|
1736
1821
|
activeInstructorRuns.delete(fingerprint);
|
|
1737
1822
|
return false;
|
|
@@ -1832,12 +1917,37 @@
|
|
|
1832
1917
|
// ≡ menu "New workflow…" — create the durable owner BEFORE asking the terminal AI to author.
|
|
1833
1918
|
// The UI chooses only a display name and owner; the server mints the UUID and derives the actual
|
|
1834
1919
|
// directory. That makes a queued request project-safe without turning the browser into an author.
|
|
1920
|
+
/**
|
|
1921
|
+
* ≡ New workflow, and a Guide card's Edit details (#2185): name it, choose where it belongs, and it starts building in its
|
|
1922
|
+
* own AI Chat conversation. Only ≡ New workflow offers the terminal instead (the earlier hand-off, unchanged). A Guide
|
|
1923
|
+
* card passes `prefill.guide` and gets the build back (or its error), so the card can show what happened.
|
|
1924
|
+
*/
|
|
1925
|
+
// #2185: each ≡ New workflow start that has not answered yet, by its name and place, so the same name and place
|
|
1926
|
+
// resumes it (see requestNewWorkflow). Kept across a reload and shared by tabs: the server may have made the draft
|
|
1927
|
+
// before its answer was lost. One stored item per start, so a tab only ever touches its own: no shared list for
|
|
1928
|
+
// another tab to overwrite between a read and a write.
|
|
1929
|
+
const UNFINISHED_MENU_BUILD = 'floless.unfinishedMenuBuild:';
|
|
1930
|
+
// ponytail: no storage (a private window) only means a reload starts afresh.
|
|
1931
|
+
const unfinishedMenuBuilds = {
|
|
1932
|
+
get(key) { try { return localStorage.getItem(UNFINISHED_MENU_BUILD + key) || null; } catch { return null; } },
|
|
1933
|
+
keep(key, buildId) { try { localStorage.setItem(UNFINISHED_MENU_BUILD + key, buildId); } catch { /* see above */ } },
|
|
1934
|
+
/** Only while it still holds this build's id: a newer start under the same name and place is not forgotten for it. */
|
|
1935
|
+
// ponytail: the check and the removal are two calls, and storage offers nothing atomic. Two tabs pressing the very
|
|
1936
|
+
// same name and place at the same instant can still lose one start (two presses, two drafts at worst). If that
|
|
1937
|
+
// ever matters, let the server find an unfinished build by its name and place instead.
|
|
1938
|
+
done(key, buildId) {
|
|
1939
|
+
try { if (localStorage.getItem(UNFINISHED_MENU_BUILD + key) === buildId) localStorage.removeItem(UNFINISHED_MENU_BUILD + key); }
|
|
1940
|
+
catch { /* see above */ }
|
|
1941
|
+
},
|
|
1942
|
+
};
|
|
1835
1943
|
async function requestNewWorkflow(prefill = {}) {
|
|
1944
|
+
const guide = prefill.guide && typeof prefill.guide.moveId === 'string' && typeof prefill.guide.chatId === 'string' ? prefill.guide : null;
|
|
1945
|
+
let building = false;
|
|
1836
1946
|
try {
|
|
1837
1947
|
const { projects = [] } = await api('/api/projects');
|
|
1838
1948
|
const ownerOptions = workflowOwnerOptions(projects);
|
|
1839
1949
|
const result = await formModal({
|
|
1840
|
-
title: 'Start a workflow',
|
|
1950
|
+
title: guide ? 'Build this workflow' : 'Start a workflow',
|
|
1841
1951
|
sub: 'Choose where it belongs. Its files, chat, history and AI working folder stay with that location.',
|
|
1842
1952
|
fields: [
|
|
1843
1953
|
{
|
|
@@ -1850,29 +1960,74 @@
|
|
|
1850
1960
|
name: 'owner', label: 'Location', type: 'select', value: 'standalone',
|
|
1851
1961
|
commandId: 'shell.new-workflow-location', options: ownerOptions,
|
|
1852
1962
|
},
|
|
1963
|
+
...(guide ? [] : [{
|
|
1964
|
+
name: 'terminal', type: 'checkbox', commandId: 'shell.new-workflow-terminal',
|
|
1965
|
+
label: 'Build it with my terminal AI instead (FloLess copies a prompt for it)',
|
|
1966
|
+
}]),
|
|
1853
1967
|
],
|
|
1854
|
-
okLabel: 'Start
|
|
1968
|
+
okLabel: 'Start building',
|
|
1969
|
+
footnote: guide
|
|
1970
|
+
? 'The AI starts building it in the workflow’s own chat on the left, and asks you before any run that sends data off this computer.'
|
|
1971
|
+
: 'The AI starts building it in the workflow’s own chat on the left, unless you choose your terminal AI. Either way it asks you before any run that sends data off this computer.',
|
|
1855
1972
|
});
|
|
1856
|
-
if (!result) return;
|
|
1973
|
+
if (!result) return null;
|
|
1857
1974
|
const name = String(result.name || '').trim();
|
|
1858
|
-
if (!name) { showToast('Enter a workflow name', 'warn'); return; }
|
|
1975
|
+
if (!name) { showToast('Enter a workflow name', 'warn'); return null; }
|
|
1859
1976
|
const owner = String(result.owner || '').startsWith('project:')
|
|
1860
1977
|
? { kind: 'project', projectId: String(result.owner).slice('project:'.length) }
|
|
1861
1978
|
: { kind: 'standalone' };
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1979
|
+
if (!guide && result.terminal) { await startWorkflowInTerminal(name, owner); return null; }
|
|
1980
|
+
if (guide) return await buildWorkflowInChat({ buildId: guide.moveId, payload: { source: 'guide', guideChatId: guide.chatId, moveId: guide.moveId, name, owner } });
|
|
1981
|
+
// A start that has not answered keeps its build id, written down before it is sent: trying again with the same name
|
|
1982
|
+
// and place (after a reload too) picks up the draft it may already have saved, never a second one.
|
|
1983
|
+
const key = `${name}\n${owner.kind === 'project' ? owner.projectId : ''}`;
|
|
1984
|
+
const buildId = unfinishedMenuBuilds.get(key) ?? crypto.randomUUID();
|
|
1985
|
+
unfinishedMenuBuilds.keep(key, buildId);
|
|
1986
|
+
building = true;
|
|
1987
|
+
const built = await buildWorkflowInChat({ buildId, payload: { source: 'menu', name, owner } });
|
|
1988
|
+
unfinishedMenuBuilds.done(key, buildId);
|
|
1989
|
+
return built;
|
|
1990
|
+
} catch (e) {
|
|
1991
|
+
if (guide) throw e;
|
|
1992
|
+
if (!building) { reportErr(e); return null; }
|
|
1993
|
+
// Every message on this path is written for people (ours, the AI setup's, the build route's); the toast's own
|
|
1994
|
+
// filter still catches anything technical.
|
|
1995
|
+
showToast(`${e?.message || 'FloLess couldn’t start building it.'} To try again, use ≡ → New workflow with the same name and place; FloLess picks up the same draft.`, 'warn', { persistent: true });
|
|
1996
|
+
return null;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
/**
|
|
2001
|
+
* #2185: one build, set up first (#1607) and then started, landing on the workflow with its conversation working. A
|
|
2002
|
+
* Guide build uses the AI its Guide conversation uses; ≡ New workflow uses the AI Chat's own choice.
|
|
2003
|
+
*/
|
|
2004
|
+
async function buildWorkflowInChat({ buildId, payload, reopen = false }) {
|
|
2005
|
+
if (typeof window.flolessChat?.startWorkflowBuild !== 'function') throw new Error('AI Chat is still starting. Try again in a moment.');
|
|
2006
|
+
const provider = payload.source === 'guide' ? (window.flolessChat.currentProvider?.() || preferredChatProvider()) : preferredChatProvider();
|
|
2007
|
+
if (!provider) throw new Error('Sign in to Claude or Codex in AI Chat, then build the workflow again.');
|
|
2008
|
+
// Reopening a started build needs no AI set up first: the conversation opens either way, and says if it can't send.
|
|
2009
|
+
const ready = reopen ? { ok: true } : await ensureChatRuntimeReady(provider);
|
|
2010
|
+
if (!ready.ok) throw Object.assign(new Error(ready.reason || 'Claude or Codex could not be set up for AI Chat. Try again in a moment.'), { code: 'chat-runtime-not-ready' });
|
|
2011
|
+
const result = await window.flolessChat.startWorkflowBuild(buildId, payload.source === 'menu' ? { ...payload, provider } : payload);
|
|
2012
|
+
try { ({ workflows: wfOwned } = await api('/api/workflows/owned')); } catch { /* the next refresh lists it */ }
|
|
2013
|
+
return result;
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
/** ≡ New workflow → "Build it with my terminal AI instead": the earlier hand-off, unchanged. */
|
|
2017
|
+
async function startWorkflowInTerminal(name, owner) {
|
|
2018
|
+
const { workflow } = await api('/api/workflows/owned', {
|
|
2019
|
+
method: 'POST', body: JSON.stringify({ name, owner }),
|
|
2020
|
+
});
|
|
2021
|
+
const { request } = await api('/api/guide-new', {
|
|
2022
|
+
method: 'POST', body: JSON.stringify({ workflowId: workflow.workflowId }),
|
|
2023
|
+
});
|
|
2024
|
+
const copied = await copyToClipboard(markedInstruction(request));
|
|
2025
|
+
showToast(copied ? `${name} is ready · prompt copied` : `${name} is ready to discuss`, 'ok');
|
|
2026
|
+
// #1890 PR 3b-0: the new draft opens, so it is somewhere to come back to — not only a toast.
|
|
2027
|
+
try { ({ workflows: wfOwned } = await api('/api/workflows/owned')); openDraftWorkflow(workflow.workflowId); }
|
|
2028
|
+
catch { /* the draft is still on the Workflows page after the next refresh */ }
|
|
2029
|
+
appendNarration(`Created <strong>${escapeHtml(name)}</strong> in its chosen location and asked your terminal AI to start there — watch the glowing <strong>requests</strong> pill (bottom-right), or switch to your terminal.${copied ? ' The prompt is also on your clipboard.' : ''}`);
|
|
2030
|
+
loadRequests();
|
|
1876
2031
|
}
|
|
1877
2032
|
|
|
1878
2033
|
// ── First-open spotlight (one-time per workflow) ────────────────────────────
|
|
@@ -2026,6 +2181,7 @@
|
|
|
2026
2181
|
setComboSelected(id);
|
|
2027
2182
|
renderChat();
|
|
2028
2183
|
renderTopology(); // selects first node + renderInspect
|
|
2184
|
+
syncRunStrip(); // #2228: a live run's strip shows only over the workflow it belongs to
|
|
2029
2185
|
paintModes();
|
|
2030
2186
|
markStars();
|
|
2031
2187
|
seedAppInputs(app);
|
|
@@ -2115,6 +2271,7 @@
|
|
|
2115
2271
|
list = list.filter((a) => a.execution !== 'internal');
|
|
2116
2272
|
rememberWorkflowOwners(list);
|
|
2117
2273
|
wfLibrary = list;
|
|
2274
|
+
globalThis.dispatchEvent?.(new CustomEvent('floless:workflows-listed')); // the Tool updates dialog gives its Open workflow buttons to rows painted before this list loaded (globalThis: the catalogue tests run this function without a window)
|
|
2118
2275
|
wfUnreadable = Array.isArray(unreadable) ? unreadable.filter((row) => row && typeof row.id === 'string') : [];
|
|
2119
2276
|
} catch (e) {
|
|
2120
2277
|
// Usable before THIS refresh, or built by an earlier one (an overlapping refresh disabled it first, and its
|
|
@@ -2934,7 +3091,8 @@
|
|
|
2934
3091
|
// The input node is the first node templating {{ inputs.* }} ANYWHERE in its
|
|
2935
3092
|
// config. An exec node carries it under `config.args`, but a REST/agent node
|
|
2936
3093
|
// (e.g. floless-workspace/read-approved) carries it in a plain config field,
|
|
2937
|
-
// so scan the whole config recursively — not just args.
|
|
3094
|
+
// so scan the whole config recursively — not just args. A node may also template them under `inputs:` rather
|
|
3095
|
+
// than `config:` (#2229: the Blender exec demo does), which the server hands over as `node.inputs`.
|
|
2938
3096
|
const usesInput = (v) => {
|
|
2939
3097
|
if (typeof v === 'string') return /\{\{\s*inputs\.[A-Za-z0-9._-]+\s*\}\}/.test(v);
|
|
2940
3098
|
if (Array.isArray(v)) return v.some(usesInput);
|
|
@@ -2942,7 +3100,7 @@
|
|
|
2942
3100
|
return false;
|
|
2943
3101
|
};
|
|
2944
3102
|
for (const n of app.nodes) {
|
|
2945
|
-
if (n.config && usesInput(n.config)) return n.id;
|
|
3103
|
+
if ((n.config && usesInput(n.config)) || (n.inputs && usesInput(n.inputs))) return n.id;
|
|
2946
3104
|
}
|
|
2947
3105
|
return null;
|
|
2948
3106
|
}
|
|
@@ -3684,20 +3842,20 @@
|
|
|
3684
3842
|
|
|
3685
3843
|
// Double-click the input node → styled dialog to set the declared inputs. Writes
|
|
3686
3844
|
// to appInputValues; the header "▶ Run workflow" uses them. No native window.prompt.
|
|
3687
|
-
function openInputsDialog() {
|
|
3845
|
+
function openInputsDialog({ focusInputName = null } = {}) {
|
|
3688
3846
|
const appId = currentId;
|
|
3689
3847
|
const generation = workflowSelectionGeneration;
|
|
3690
3848
|
if (!appId) return Promise.resolve();
|
|
3691
3849
|
const active = inputDialogFlights.get(appId);
|
|
3692
3850
|
if (active && active.generation === generation) return active.promise;
|
|
3693
|
-
const promise = openInputsDialogFor(appId, generation).finally(() => {
|
|
3851
|
+
const promise = openInputsDialogFor(appId, generation, focusInputName).finally(() => {
|
|
3694
3852
|
if (inputDialogFlights.get(appId)?.promise === promise) inputDialogFlights.delete(appId);
|
|
3695
3853
|
});
|
|
3696
3854
|
inputDialogFlights.set(appId, { generation, promise });
|
|
3697
3855
|
return promise;
|
|
3698
3856
|
}
|
|
3699
3857
|
|
|
3700
|
-
async function openInputsDialogFor(appId, generation) {
|
|
3858
|
+
async function openInputsDialogFor(appId, generation, focusInputName = null) {
|
|
3701
3859
|
const app = apps.get(appId);
|
|
3702
3860
|
if (!app || !Array.isArray(app.inputs) || !app.inputs.length) return;
|
|
3703
3861
|
const isCurrent = () => currentId === appId && workflowSelectionGeneration === generation;
|
|
@@ -3804,7 +3962,7 @@
|
|
|
3804
3962
|
group: project.name, groupMeta: `${selectedModelName} model`, label: `Approved v${version.approvalVersion}`,
|
|
3805
3963
|
triggerLabel: `${project.name} · approved v${version.approvalVersion} · ${short}${accepted ? ` · ${accepted}` : ''}`,
|
|
3806
3964
|
meta: `${date} · ${short}${accepted ? ` · ${accepted}` : ''}`,
|
|
3807
|
-
ariaLabel: `${project.name}, ${selectedModelName} model, approved version ${version.approvalVersion}, ${date}, revision ${
|
|
3965
|
+
ariaLabel: `${project.name}, ${selectedModelName} model, approved version ${version.approvalVersion}, ${date}, revision ${short}${accepted ? `, approved with ${accepted.replace(/ accepted$/, '')} accepted as stated assumptions` : ''}`,
|
|
3808
3966
|
search: `${project.name} ${selectedModelName} approved version ${version.approvalVersion} ${date} ${version.approvedRevisionId}`,
|
|
3809
3967
|
};
|
|
3810
3968
|
});
|
|
@@ -3846,7 +4004,7 @@
|
|
|
3846
4004
|
value: cur[inp.name] != null ? cur[inp.name] : inp.default != null ? inp.default : '',
|
|
3847
4005
|
};
|
|
3848
4006
|
});
|
|
3849
|
-
const res = await formModal({ title: `Inputs · ${app.displayName}`, sub: 'Set the values this run uses, then ▶ Run workflow.', fields, okLabel: 'Set inputs' });
|
|
4007
|
+
const res = await formModal({ title: `Inputs · ${app.displayName}`, sub: 'Set the values this run uses, then ▶ Run workflow.', fields, okLabel: 'Set inputs', focusInputName });
|
|
3850
4008
|
if (!res || !isCurrent()) return;
|
|
3851
4009
|
const store = {};
|
|
3852
4010
|
for (const inp of app.inputs) {
|
|
@@ -3880,14 +4038,18 @@
|
|
|
3880
4038
|
paintRunState(app); // The Instructor's set/total count follows Set inputs, not the next Run.
|
|
3881
4039
|
markSpecialNodes();
|
|
3882
4040
|
refreshDirtyIndicator(); // values changed → reflect unsaved state in the header/menu
|
|
3883
|
-
const badge = Object.entries(store).map(([k, v]) => `${k}=${visualNames.has(k) ? String(v).split(/[\\/]/).pop() : v}`).join(' · ');
|
|
4041
|
+
const badge = Object.entries(store).map(([k, v]) => `${k}=${visualNames.has(k) ? String(v).split(/[\\/]/).pop() : workflowInputDisplayValue(fields.find((field) => field.name === k), v)}`).join(' · ');
|
|
3884
4042
|
appendNarration(`Inputs set — <strong>${escapeHtml(badge)}</strong>. Run with <strong>▶ Run workflow</strong>.`);
|
|
3885
4043
|
showToast('Inputs set: ' + badge, 'ok');
|
|
3886
4044
|
}
|
|
3887
4045
|
|
|
3888
|
-
//
|
|
3889
|
-
|
|
3890
|
-
|
|
4046
|
+
// Selection JSON is an AWARE input carrier; people see the same name they picked.
|
|
4047
|
+
function workflowInputDisplayValue(field, value) {
|
|
4048
|
+
if (field?.commandId !== 'workflow.select-model-revision') return value;
|
|
4049
|
+
const option = field.options.find((item) => String(item.value) === String(value));
|
|
4050
|
+
return option ? option.triggerLabel || option.label : 'Previously selected model version unavailable';
|
|
4051
|
+
}
|
|
4052
|
+
|
|
3891
4053
|
// The most recent rendered report per app id: { nodeId, label, html }. Lets a
|
|
3892
4054
|
// double-click LOAD the last result instantly instead of re-running.
|
|
3893
4055
|
const lastReportByApp = new Map();
|
|
@@ -3909,15 +4071,21 @@
|
|
|
3909
4071
|
// the user, on the modal's × tooltip, that closing leaves the run going (Stop is in the
|
|
3910
4072
|
// header) — the canvas keeps showing progress (markCanvasRunning), by design.
|
|
3911
4073
|
function syncRunControls() {
|
|
3912
|
-
|
|
4074
|
+
// #2228: a run this tab resumed after a reload, or follows from another window, is live too: Run stays off for
|
|
4075
|
+
// that workflow until it ends (its own Stop is in the run strip).
|
|
4076
|
+
const followedRun = !!(liveRun && !liveRun.ended && liveRun.appId === currentId && !state.running && !reportRunning);
|
|
4077
|
+
const running = reportRunning || state.running || foregroundStarting || foregroundStopping || !!foregroundTrigger || followedRun;
|
|
3913
4078
|
const stoppable = reportRunning || state.running || foregroundStopping || !!foregroundTrigger;
|
|
3914
|
-
// The
|
|
3915
|
-
//
|
|
3916
|
-
|
|
4079
|
+
// The persistent viewer Stop covers finite manual and live foreground work while
|
|
4080
|
+
// the modal backdrop occludes the header Stop.
|
|
4081
|
+
syncReportStopControls();
|
|
3917
4082
|
if ($stopRunBtn) {
|
|
3918
4083
|
$stopRunBtn.hidden = !stoppable;
|
|
3919
4084
|
// Reset to a fresh, clickable Stop each run; stopRun() flips it to "Cancelling…".
|
|
3920
|
-
if (stoppable && !cancelRequested && !foregroundStopping) {
|
|
4085
|
+
if (stoppable && !cancelRequested && !foregroundStopping) {
|
|
4086
|
+
$stopRunBtn.disabled = stopPending;
|
|
4087
|
+
$stopRunBtn.textContent = stopPending ? 'Stopping…' : '■ Stop run';
|
|
4088
|
+
}
|
|
3921
4089
|
}
|
|
3922
4090
|
if (running) {
|
|
3923
4091
|
$runBtn.disabled = true;
|
|
@@ -3936,10 +4104,9 @@
|
|
|
3936
4104
|
}
|
|
3937
4105
|
}
|
|
3938
4106
|
|
|
3939
|
-
//
|
|
3940
|
-
//
|
|
3941
|
-
//
|
|
3942
|
-
// /api/run then rejects via api() and the catch renders the cancelled state.
|
|
4107
|
+
// Ask to stop this manual run by its request identity. The original run's
|
|
4108
|
+
// answer determines whether it stopped or finished; the Stop acknowledgement
|
|
4109
|
+
// alone must not relabel a completed report or clear another producer's work.
|
|
3943
4110
|
async function stopRun() {
|
|
3944
4111
|
if (!reportRunning && !state.running && !foregroundTrigger) return;
|
|
3945
4112
|
// A live foreground session ends via its own stop route (it runs outside the
|
|
@@ -3950,8 +4117,6 @@
|
|
|
3950
4117
|
foregroundStopping = true;
|
|
3951
4118
|
foregroundTrigger = null;
|
|
3952
4119
|
if ($stopRunBtn) { $stopRunBtn.disabled = true; $stopRunBtn.textContent = 'Stopping…'; }
|
|
3953
|
-
const ovStop = document.querySelector('.overlay-stop');
|
|
3954
|
-
if (ovStop) { ovStop.disabled = true; ovStop.textContent = 'Stopping…'; }
|
|
3955
4120
|
syncRunControls();
|
|
3956
4121
|
try { await api(`/api/trigger-run/${encodeURIComponent(ft.appId)}/stop`, { method: 'POST' }); } catch { /* best effort — the session may already be gone */ }
|
|
3957
4122
|
finally {
|
|
@@ -3965,14 +4130,40 @@
|
|
|
3965
4130
|
}
|
|
3966
4131
|
return;
|
|
3967
4132
|
}
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
const stopBtn = document.querySelector('.overlay-stop');
|
|
3972
|
-
if (stopBtn) { stopBtn.disabled = true; stopBtn.textContent = 'Cancelling…'; }
|
|
3973
|
-
if ($stopRunBtn) { $stopRunBtn.disabled = true; $stopRunBtn.textContent = 'Cancelling…'; }
|
|
4133
|
+
const request = activeManualRun;
|
|
4134
|
+
if (!request || request.settled || stopPending || cancelRequested) return;
|
|
4135
|
+
stopPending = true;
|
|
3974
4136
|
syncRunControls();
|
|
3975
|
-
|
|
4137
|
+
request.stopPromise = (async () => {
|
|
4138
|
+
try {
|
|
4139
|
+
let answer;
|
|
4140
|
+
try {
|
|
4141
|
+
answer = await api('/api/run/stop', { method: 'POST', body: JSON.stringify({ runRequestId: request.id }) });
|
|
4142
|
+
} catch {
|
|
4143
|
+
if (activeManualRun !== request || request.settled) return;
|
|
4144
|
+
showToast('FloLess could not confirm Stop. Try Stop again; the run will confirm whether it stopped.', 'warn');
|
|
4145
|
+
return;
|
|
4146
|
+
}
|
|
4147
|
+
if (activeManualRun !== request || request.settled) return;
|
|
4148
|
+
cancelRequested = answer.accepted === true;
|
|
4149
|
+
if (cancelRequested) {
|
|
4150
|
+
clearNodeStatus();
|
|
4151
|
+
if (reportRunning) $reportSub.textContent = 'Cancelling this report run…';
|
|
4152
|
+
} else if (answer.reason === 'finishing') {
|
|
4153
|
+
if (reportRunning) $reportSub.textContent = 'Execution ended. Waiting for the outcome.';
|
|
4154
|
+
else showToast('Execution ended. Waiting for the outcome.', 'info');
|
|
4155
|
+
} else if (answer.pending) {
|
|
4156
|
+
if (reportRunning) $reportSub.textContent = 'Stop requested. Waiting for this run to confirm its outcome.';
|
|
4157
|
+
}
|
|
4158
|
+
} finally {
|
|
4159
|
+
if (activeManualRun === request && !request.settled) {
|
|
4160
|
+
stopPending = false;
|
|
4161
|
+
if ($stopRunBtn && cancelRequested) { $stopRunBtn.disabled = true; $stopRunBtn.textContent = 'Cancelling…'; }
|
|
4162
|
+
syncRunControls();
|
|
4163
|
+
}
|
|
4164
|
+
}
|
|
4165
|
+
})();
|
|
4166
|
+
await request.stopPromise;
|
|
3976
4167
|
}
|
|
3977
4168
|
|
|
3978
4169
|
// Share is visible exactly when the frame holds a report (the empty state HIDES it —
|
|
@@ -4010,21 +4201,36 @@
|
|
|
4010
4201
|
$reportObjectError.textContent = '';
|
|
4011
4202
|
$reportFrame.removeAttribute('src');
|
|
4012
4203
|
}
|
|
4013
|
-
async function paintCompleteReport(report, ordinal =
|
|
4204
|
+
async function paintCompleteReport(report, ordinal = null) {
|
|
4014
4205
|
const request = ++reportSectionRequest;
|
|
4015
4206
|
const handle = encodeURIComponent(report.handle);
|
|
4016
4207
|
$reportOverlay.hidden = false;
|
|
4017
4208
|
$reportOverlay.replaceChildren(mkEl('div', 'spinner'), mkEl('div', null, 'Loading report section…'));
|
|
4018
4209
|
try {
|
|
4019
|
-
|
|
4210
|
+
let index = await api(`/api/model-reports/${handle}/index?at=${ordinal ?? 0}`);
|
|
4211
|
+
if (request !== reportSectionRequest) return;
|
|
4212
|
+
// Start with the first object's data, while First still opens Model information.
|
|
4213
|
+
// Ask the verified index where that object begins instead of assuming section 2.
|
|
4214
|
+
if (ordinal == null) {
|
|
4215
|
+
ordinal = 0;
|
|
4216
|
+
if (Number(index.objectCount) > 0 && index.current?.firstObject == null) {
|
|
4217
|
+
const firstObject = await api(`/api/model-reports/${handle}/object/0`);
|
|
4218
|
+
if (request !== reportSectionRequest) return;
|
|
4219
|
+
ordinal = firstObject.chunkOrdinal;
|
|
4220
|
+
index = await api(`/api/model-reports/${handle}/index?at=${ordinal}`);
|
|
4221
|
+
}
|
|
4222
|
+
}
|
|
4020
4223
|
if (request !== reportSectionRequest) return;
|
|
4021
4224
|
const response = await fetch(`/api/model-reports/${handle}/chunk/${ordinal}`, { credentials: 'same-origin', cache: 'no-store' });
|
|
4022
4225
|
if (!response.ok) {
|
|
4023
4226
|
const body = await response.json().catch(() => null);
|
|
4024
|
-
throw new Error(
|
|
4227
|
+
throw Object.assign(new Error('Report section request failed'), { status: response.status, body });
|
|
4025
4228
|
}
|
|
4026
4229
|
const length = Number(response.headers.get('content-length'));
|
|
4027
|
-
if (Number.isFinite(length) && length > 1200 * 1024)
|
|
4230
|
+
if (Number.isFinite(length) && length > 1200 * 1024) {
|
|
4231
|
+
await response.body?.cancel();
|
|
4232
|
+
throw Object.assign(new Error('Report section exceeds viewer limit'), { status: 413 });
|
|
4233
|
+
}
|
|
4028
4234
|
await response.body?.cancel();
|
|
4029
4235
|
if (request !== reportSectionRequest) return;
|
|
4030
4236
|
$reportFrame.removeAttribute('srcdoc');
|
|
@@ -4039,9 +4245,9 @@
|
|
|
4039
4245
|
const properties = Number(index.propertyCount) || 0;
|
|
4040
4246
|
const current = index.current || {};
|
|
4041
4247
|
const objectRange = count === 0 ? 'No objects' : current.firstObject == null
|
|
4042
|
-
? `Model information ·
|
|
4248
|
+
? `Model information · Report contains ${count} objects` : `Objects ${Number(current.firstObject) + 1}–${Number(current.lastObject) + 1} of ${count}`;
|
|
4043
4249
|
const propertyRange = properties === 0 ? '0 properties'
|
|
4044
|
-
: current.firstProperty == null ? `
|
|
4250
|
+
: current.firstProperty == null ? `Report contains ${properties} properties`
|
|
4045
4251
|
: `Properties ${Number(current.firstProperty) + 1}–${Number(current.lastProperty) + 1} of ${properties}`;
|
|
4046
4252
|
$reportSectionStatus.textContent = `${objectRange} · ${propertyRange} · section ${ordinal + 1} of ${index.chunkCount}`;
|
|
4047
4253
|
updateReportSectionNavigation(ordinal, index);
|
|
@@ -4067,8 +4273,23 @@
|
|
|
4067
4273
|
if (request !== reportSectionRequest) return;
|
|
4068
4274
|
clearCompleteReportView();
|
|
4069
4275
|
$reportFrame.srcdoc = '';
|
|
4276
|
+
$reportSub.textContent = 'This report section could not be displayed.';
|
|
4277
|
+
const status = Number(error?.status);
|
|
4278
|
+
let remedy = 'Close the viewer and choose View report to retry loading this saved report.';
|
|
4279
|
+
if (status === 401) remedy = 'Sign in again, then close the viewer and choose View report to load this saved report.';
|
|
4280
|
+
else if (status === 403) remedy = 'Report access could not be confirmed. Check your account access and connection, then choose View report again.';
|
|
4281
|
+
else if (status === 404 || status === 410) remedy = 'This report is no longer available. Choose Run workflow to create a fresh report.';
|
|
4282
|
+
else if (status === 409) remedy = 'This saved report cannot be opened right now. If another read is running, wait for it to finish and choose View report again. Otherwise choose an approved model in Inputs and Run workflow to create a fresh report.';
|
|
4283
|
+
else if (status === 429) remedy = 'This report is busy. Wait for the current read to finish, then close the viewer and choose View report again.';
|
|
4284
|
+
else if (status === 413) {
|
|
4285
|
+
remedy = 'This section is too large for the viewer. Download complete report to read the saved report.';
|
|
4286
|
+
currentCompleteReport = report;
|
|
4287
|
+
$reportDownload.hidden = false;
|
|
4288
|
+
} else if (status === 503) remedy = 'Saved reports are being prepared. Wait a moment, then close the viewer and choose View report again.';
|
|
4289
|
+
// Keep diagnostics bounded: transport messages can contain private paths or server details.
|
|
4290
|
+
console.warn('Report section display failed', { status: Number.isFinite(status) ? status : null });
|
|
4070
4291
|
$reportOverlay.hidden = false;
|
|
4071
|
-
$reportOverlay.replaceChildren(mkEl('div', null,
|
|
4292
|
+
$reportOverlay.replaceChildren(mkEl('div', null, remedy));
|
|
4072
4293
|
}
|
|
4073
4294
|
}
|
|
4074
4295
|
// The share route's user-facing cap (server/index.ts sets a 6 MB body limit; the JSON envelope
|
|
@@ -4141,7 +4362,7 @@
|
|
|
4141
4362
|
const cached = lastReportByApp.get(currentId);
|
|
4142
4363
|
if (cached && cached.handle) {
|
|
4143
4364
|
$reportTitle.textContent = `HTML Viewer · ${app.displayName}`;
|
|
4144
|
-
void paintCompleteReport(cached
|
|
4365
|
+
void paintCompleteReport(cached);
|
|
4145
4366
|
} else if (cached && cached.html) {
|
|
4146
4367
|
const sfx = cached.label ? ' · ' + cached.label : '';
|
|
4147
4368
|
if (cached.interactive) {
|
|
@@ -4834,23 +5055,39 @@
|
|
|
4834
5055
|
if (!app) return;
|
|
4835
5056
|
if (!app.runnable) { showToast('Compile the workflow first — Run is gated on a fresh lock.', 'warn'); return; }
|
|
4836
5057
|
if (reportRunning) return;
|
|
5058
|
+
if (await askForMissingRunInputs(app)) return;
|
|
5059
|
+
if (currentId !== app.id || reportRunning || state.running || foregroundStarting || foregroundStopping || foregroundTrigger) return;
|
|
5060
|
+
const request = opts.debug ? null : beginManualRun(app.id);
|
|
4837
5061
|
reportRunning = true;
|
|
4838
5062
|
cancelRequested = false;
|
|
4839
5063
|
markCanvasRunning(); // paints behind the modal; visible once it's closed
|
|
4840
5064
|
syncRunControls(); // header ■ Stop run + Run disabled — reachable even if the modal is closed (#39)
|
|
4841
5065
|
|
|
4842
5066
|
const inputs = currentInputs();
|
|
4843
|
-
const inputBadge = Object.entries(inputs).map(([k, v]) => `${k}=${v}`).join(' · ');
|
|
5067
|
+
const inputBadge = Object.entries(inputs).map(([k, v]) => `${k}=${app.inputs?.some((input) => input.name === k && input.widget === 'workspace-model-revision') ? 'Selected approved model version' : v}`).join(' · ');
|
|
4844
5068
|
const approvedModelReport = app.templateId === 'floless-workspace-model-report' || app.templateId === 'tekla-model-report';
|
|
4845
5069
|
$reportTitle.textContent = `HTML Viewer · ${app.displayName}`;
|
|
4846
5070
|
$reportSub.textContent = 'Running the workflow to create your report.';
|
|
4847
5071
|
clearReportFrames(); // clear any previous report (static or 3D) before this run paints a fresh one
|
|
4848
5072
|
$reportShare.hidden = true; // the frame is blank — only a painted report is shareable
|
|
4849
5073
|
$reportOverlay.hidden = false;
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
5074
|
+
let clientRunToken = null;
|
|
5075
|
+
if (opts.debug) {
|
|
5076
|
+
$reportOverlay.innerHTML = `<div>Launching the .NET debugger for <code>${escapeHtml(nodeId)}</code> — a Windows picker will pop; choose your <strong>Visual Studio</strong> to attach to <code>aware-tekla.exe</code>, then step through. The report renders when you let it finish.</div>`;
|
|
5077
|
+
$reportOverlay.prepend(runningFlo());
|
|
5078
|
+
} else {
|
|
5079
|
+
// #2228: the working Flo, what the run is doing, elapsed time and a real bar when the run reports one —
|
|
5080
|
+
// the same view the canvas strip uses, so a long render reads the same in both places.
|
|
5081
|
+
$reportOverlay.replaceChildren();
|
|
5082
|
+
const host = mkEl('div', 'rp-host');
|
|
5083
|
+
$reportOverlay.append(host); // Stop lives in the report header (#reportStop), beside the run it stops
|
|
5084
|
+
clientRunToken = beginLiveRun(currentId, 'overlay', host,
|
|
5085
|
+
approvedModelReport ? 'Reading the selected approved model to make a complete, read-only report…' : 'Running the workflow against the live model…');
|
|
5086
|
+
if (!host.firstChild) $reportOverlay.prepend(runningFlo()); // the view could not mount: keep the working Flo
|
|
5087
|
+
}
|
|
5088
|
+
let liveOutcome = 'failed';
|
|
5089
|
+
const $reportWatch = document.getElementById('report-watch');
|
|
5090
|
+
if ($reportWatch) $reportWatch.hidden = true;
|
|
4854
5091
|
showModal($reportModal);
|
|
4855
5092
|
$reportModal.dataset.nodeId = nodeId;
|
|
4856
5093
|
|
|
@@ -4859,18 +5096,25 @@
|
|
|
4859
5096
|
// so VS attaches to aware-tekla.exe; a normal run goes through aware app run.
|
|
4860
5097
|
const res = opts.debug
|
|
4861
5098
|
? await api('/api/debug-node', { method: 'POST', body: JSON.stringify({ id: currentId, nodeId, inputs }) })
|
|
4862
|
-
: await
|
|
5099
|
+
: await dispatchManualRun(request, { id: app.id, simulate: false, inputs, ...(clientRunToken ? { clientRunToken } : {}) });
|
|
5100
|
+
liveOutcome = 'ok';
|
|
5101
|
+
const reportVideos = runVideos(res);
|
|
5102
|
+
if (res && typeof res.mediaWarning === 'string') showToast(res.mediaWarning, 'warn');
|
|
5103
|
+
if ($reportWatch && reportVideos.length) {
|
|
5104
|
+
$reportWatch.hidden = false;
|
|
5105
|
+
$reportWatch.onclick = () => watchRunVideos(reportVideos, `Rendered by ${app.displayName}`);
|
|
5106
|
+
}
|
|
4863
5107
|
// Reflect the run in the Execution tab too.
|
|
4864
5108
|
if (Array.isArray(res.events)) { liveTrace.length = 0; res.events.forEach(pushTrace); state.hasRun = true; if (state.currentTab === 'execution') renderInspect(); }
|
|
4865
5109
|
// A run can "succeed" yet carry a rejected token (the report would be an error
|
|
4866
5110
|
// body, not real data) — prompt reconnect instead of rendering the noise.
|
|
4867
|
-
if (res.credentialIssue) { surfaceCredentialIssue(res.credentialIssue); return; }
|
|
5111
|
+
if (res.credentialIssue) { $reportSub.textContent = 'Execution ended. Reconnect the integration to run again.'; surfaceCredentialIssue(res.credentialIssue); return; }
|
|
4868
5112
|
if (res.report && res.report.kind === 'complete-model-properties' && typeof res.report.handle === 'string') {
|
|
4869
5113
|
$reportTitle.textContent = `HTML Viewer · ${app.displayName}`;
|
|
4870
|
-
await paintCompleteReport(res.report, 0);
|
|
4871
|
-
if (!currentCompleteReport) return;
|
|
4872
|
-
markFirstRunDone(app.id);
|
|
4873
5114
|
lastReportByApp.set(app.id, { nodeId, label: inputBadge, ...res.report });
|
|
5115
|
+
await paintCompleteReport(res.report);
|
|
5116
|
+
if (!currentCompleteReport || !$reportOverlay.hidden) return;
|
|
5117
|
+
markFirstRunDone(app.id);
|
|
4874
5118
|
$reportModal.dataset.html = '1';
|
|
4875
5119
|
appendNarration(`Rendered the complete read-only property report from <strong>${escapeHtml(nodeId)}</strong>.`);
|
|
4876
5120
|
return;
|
|
@@ -4878,6 +5122,7 @@
|
|
|
4878
5122
|
const html = res.report && res.report.html;
|
|
4879
5123
|
const interactive = !!(res.report && res.report.interactive);
|
|
4880
5124
|
if (!html) {
|
|
5125
|
+
$reportSub.textContent = 'Execution ended without an HTML report.';
|
|
4881
5126
|
$reportOverlay.innerHTML = `<div>Run completed but <code>${escapeHtml(nodeId)}</code> returned no <code>html</code>. Check the Execution tab.</div>`;
|
|
4882
5127
|
return;
|
|
4883
5128
|
}
|
|
@@ -4897,26 +5142,33 @@
|
|
|
4897
5142
|
appendNarration(`Rendered the ${interactive ? '3D view' : 'report'} from <strong>${escapeHtml(nodeId)}</strong>${inputBadge ? ' (' + escapeHtml(inputBadge) + ')' : ''} — live run against the model.`);
|
|
4898
5143
|
} catch (e) {
|
|
4899
5144
|
const msg = e && e.message ? e.message : String(e);
|
|
4900
|
-
|
|
5145
|
+
liveOutcome = (e && e.body && e.body.cancelled) ? 'stopped' : !(e && e.status) ? 'no-answer'
|
|
5146
|
+
: (e && e.body && (e.body.notRun || e.body.refusal)) ? 'not-run' : 'failed';
|
|
5147
|
+
if (e.body && e.body.cancelled) {
|
|
4901
5148
|
// User hit Stop — an expected outcome, not a failure. A node already
|
|
4902
5149
|
// executing on the host may still finish; the run result is discarded.
|
|
4903
5150
|
clearNodeStatus(); // wipe any status painted before the flag was set
|
|
4904
|
-
$
|
|
5151
|
+
$reportSub.textContent = 'Execution stopped.';
|
|
5152
|
+
$reportOverlay.innerHTML = `<div>${stoppedRunCopy(e.body, approvedModelReport)} Click <strong>▶ Run workflow</strong> to run again.</div>`;
|
|
4905
5153
|
showToast('Run cancelled', 'info');
|
|
4906
5154
|
} else {
|
|
4907
5155
|
// Expected, recoverable failure. If it was a rejected token, prompt the
|
|
4908
5156
|
// user to reconnect that integration (not the misleading host hint).
|
|
4909
5157
|
const cred = e.body && e.body.credentialIssue;
|
|
4910
5158
|
if (cred) {
|
|
5159
|
+
$reportSub.textContent = 'Execution ended. Reconnect the integration to run again.';
|
|
4911
5160
|
surfaceCredentialIssue(cred);
|
|
4912
5161
|
} else {
|
|
4913
5162
|
// Other recoverable failures (host not attached, stale lock, …): show it
|
|
4914
5163
|
// in the viewer overlay + a toast. No console.error — the server returns the
|
|
4915
5164
|
// failure in-band, so a failed run isn't a console-worthy fault.
|
|
5165
|
+
$reportSub.textContent = 'Execution ended without a report.';
|
|
4916
5166
|
showRunFailure(e.body || {}, runFailureMessage(msg), app);
|
|
4917
5167
|
}
|
|
4918
5168
|
}
|
|
4919
5169
|
} finally {
|
|
5170
|
+
if (request) finishManualRun(request);
|
|
5171
|
+
if (clientRunToken) { if (liveOutcome === 'no-answer') settleLiveRunWithoutAnswer(); else finishLiveRun(liveOutcome); }
|
|
4920
5172
|
reportRunning = false;
|
|
4921
5173
|
syncRunControls(); // run ended — hide the header Stop, restore Run from the gate
|
|
4922
5174
|
}
|
|
@@ -5228,7 +5480,7 @@
|
|
|
5228
5480
|
// `onChange(values) -> string` makes the dialog able to answer a question no static label can:
|
|
5229
5481
|
// one whose answer DEPENDS on the choices (five viewpoints cost five times one). Its return value
|
|
5230
5482
|
// becomes the footnote line under the fields. Optional — dialogs that don't pass it are unchanged.
|
|
5231
|
-
function formModal({ title, sub = '', fields, okLabel = 'Save', okCommandId = null, okCommandInstanceLabel = null, cancelCommandInstanceLabel = null, danger = false, safeDefault = false, hideCancel = false, hideOk = false, returnFocusTo = null, returnFocusFallback = null, footnote = '', onChange = null, modalState = null, modalMode = null }) {
|
|
5483
|
+
function formModal({ title, sub = '', fields, okLabel = 'Save', okCommandId = null, okCommandInstanceLabel = null, cancelCommandInstanceLabel = null, danger = false, safeDefault = false, hideCancel = false, hideOk = false, returnFocusTo = null, returnFocusFallback = null, focusInputName = null, footnote = '', onChange = null, modalState = null, modalMode = null }) {
|
|
5232
5484
|
return new Promise((resolve) => {
|
|
5233
5485
|
if (_formModalOpen) { console.warn('formModal: a modal is already open — refusing re-entry'); resolve(null); return; }
|
|
5234
5486
|
const returnFocus = returnFocusTo instanceof HTMLElement
|
|
@@ -5260,7 +5512,7 @@
|
|
|
5260
5512
|
// A consent checkbox renders inline (label beside the box, not above) — used for the
|
|
5261
5513
|
// fork liability terms. `required: true` gates the OK button until it's ticked.
|
|
5262
5514
|
if (f.type === 'checkbox') {
|
|
5263
|
-
return `<label class="modal-check" for="${id}"><input type="checkbox" id="${id}" data-fm-check="${escapeHtml(f.name)}"${f.value ? ' checked' : ''}><span>${escapeHtml(f.label || f.name)}</span></label>`;
|
|
5515
|
+
return `<label class="modal-check" for="${id}"><input type="checkbox" id="${id}" data-fm-check="${escapeHtml(f.name)}"${f.commandId === 'shell.new-workflow-terminal' ? ' data-command-id="shell.new-workflow-terminal"' : ''}${f.value ? ' checked' : ''}><span>${escapeHtml(f.label || f.name)}</span></label>`;
|
|
5264
5516
|
}
|
|
5265
5517
|
// A tick-list where each row carries its OWN state and, when it is not pickable, its own
|
|
5266
5518
|
// way out. `select multiple` cannot do this: its rows are `role=option`, which may hold no
|
|
@@ -5387,7 +5639,7 @@
|
|
|
5387
5639
|
} else {
|
|
5388
5640
|
const fieldCommand = f.commandId === 'shell.new-workflow-name'
|
|
5389
5641
|
? ' data-command-id="shell.new-workflow-name"'
|
|
5390
|
-
: '';
|
|
5642
|
+
: f.commandId === 'shell.revision-note-text' ? ' data-command-id="shell.revision-note-text"' : '';
|
|
5391
5643
|
ctl = f.multiline
|
|
5392
5644
|
? `<textarea id="${id}" rows="4" data-fm="${escapeHtml(f.name)}" placeholder="${ph}"${fieldCommand}>${escapeHtml(val)}</textarea>`
|
|
5393
5645
|
: `<input id="${id}" type="${f.type || 'text'}"${f.type === 'number' ? ' step="1"' : ''} data-fm="${escapeHtml(f.name)}" value="${escapeHtml(val)}" placeholder="${ph}"${fieldCommand}>`;
|
|
@@ -5401,7 +5653,7 @@
|
|
|
5401
5653
|
`<div class="fm-footnote" data-fm-footnote role="status" aria-live="polite"${footnote ? '' : ' hidden'}>${escapeHtml(footnote)}</div>`);
|
|
5402
5654
|
}
|
|
5403
5655
|
$ok.textContent = okLabel;
|
|
5404
|
-
const allowedOkCommand = okCommandId === 'shell.host-send-continue' || okCommandId === 'shell.dialog-close';
|
|
5656
|
+
const allowedOkCommand = okCommandId === 'shell.host-send-continue' || okCommandId === 'shell.dialog-close' || okCommandId === 'shell.revision-note-save';
|
|
5405
5657
|
$ok.setAttribute('data-command-id', allowedOkCommand
|
|
5406
5658
|
? `${okCommandId}#${okCommandInstanceLabel || 'the dialog'}`
|
|
5407
5659
|
: 'shell.form-submit');
|
|
@@ -5844,7 +6096,11 @@
|
|
|
5844
6096
|
// no-op. Gate first, then put focus on an enabled action. In an empty required picker, gating disables
|
|
5845
6097
|
// OK; focusing it before this point made Chromium drop focus outside the modal and bypass the
|
|
5846
6098
|
// Escape/Tab trap. The themed Reload action is the useful first stop when one is available.
|
|
5847
|
-
const
|
|
6099
|
+
const focusCarrier = focusInputName ? Array.from($body.querySelectorAll('[data-fm],[data-fm-file-box],[data-fm-files],[data-fm-images]'))
|
|
6100
|
+
.find((el) => [el.dataset.fm, el.dataset.fmFileBox, el.dataset.fmFiles, el.dataset.fmImages].includes(focusInputName)) : null;
|
|
6101
|
+
const requestedFocus = focusCarrier?.matches(':disabled,[type="hidden"],.fm-file-input,.fm-file,.fm-files,.fm-images')
|
|
6102
|
+
? focusCarrier.closest('.modal-field')?.querySelector('.fm-select-trigger:not([disabled]),.fm-drop,[data-fm-empty-action]:not([disabled])') : focusCarrier;
|
|
6103
|
+
const first = requestedFocus || $body.querySelector('input:not(.fm-file-input):not([type="hidden"]):not(.wf-search),textarea')
|
|
5848
6104
|
|| $body.querySelector('.fm-select-trigger:not([disabled])')
|
|
5849
6105
|
|| $body.querySelector('.fm-files .fm-drop, .fm-file .fm-drop, .fm-images .fm-drop')
|
|
5850
6106
|
|| $body.querySelector('[data-fm-empty-action]:not([disabled])');
|
|
@@ -6004,9 +6260,6 @@
|
|
|
6004
6260
|
void closeReportViewer();
|
|
6005
6261
|
}
|
|
6006
6262
|
});
|
|
6007
|
-
// The Stop button is rebuilt into the overlay each run — delegate so one
|
|
6008
|
-
// listener survives every innerHTML swap.
|
|
6009
|
-
$reportOverlay.addEventListener('click', (e) => { if (e.target.closest('.overlay-stop')) stopRun(); });
|
|
6010
6263
|
// The interactive 3D doc (viewer-3d) posts a load handshake from its opaque-origin frame:
|
|
6011
6264
|
// `viewer-ready` clears the loading overlay; `viewer-error` (CDN/script/timeout) shows a
|
|
6012
6265
|
// retry. Guard: only when the 3D frame is the active surface and the message is from it.
|
|
@@ -8874,6 +9127,8 @@
|
|
|
8874
9127
|
if (!app) return;
|
|
8875
9128
|
if (!app.runnable) { showToast($runBtn.dataset.tip, 'warn'); return; }
|
|
8876
9129
|
if (state.running || reportRunning || foregroundStarting || foregroundStopping || foregroundTrigger) return;
|
|
9130
|
+
if (!simulate && await askForMissingRunInputs(app)) return;
|
|
9131
|
+
if (currentId !== app.id || state.running || reportRunning || foregroundStarting || foregroundStopping || foregroundTrigger) return;
|
|
8877
9132
|
|
|
8878
9133
|
// Streaming/watch app → a LIVE FOREGROUND session, not a finite run (which would
|
|
8879
9134
|
// never complete and time out at 60s). It re-renders the report in the Viewer on
|
|
@@ -8888,6 +9143,7 @@
|
|
|
8888
9143
|
if (!simulate && rid) { runReport(rid); return; }
|
|
8889
9144
|
|
|
8890
9145
|
runningSimulation = simulate;
|
|
9146
|
+
const request = beginManualRun(app.id);
|
|
8891
9147
|
state.running = true;
|
|
8892
9148
|
cancelRequested = false;
|
|
8893
9149
|
$runBtn.disabled = true;
|
|
@@ -8896,8 +9152,17 @@
|
|
|
8896
9152
|
syncRunControls(); // surface the header ■ Stop run for the inline (no-modal) run too (#39)
|
|
8897
9153
|
liveTrace.length = 0;
|
|
8898
9154
|
state.hasRun = true;
|
|
9155
|
+
// #2228: a simulated run stubs every node, so it reports no progress; a real one is watched live.
|
|
9156
|
+
const clientRunToken = simulate ? null : beginLiveRun(currentId, 'strip');
|
|
9157
|
+
let liveOutcome = 'failed';
|
|
8899
9158
|
try {
|
|
8900
|
-
const
|
|
9159
|
+
const runAppId = currentId;
|
|
9160
|
+
const res = await dispatchManualRun(request, { id: app.id, simulate, inputs: currentInputs(), ...(clientRunToken ? { clientRunToken } : {}) });
|
|
9161
|
+
liveOutcome = 'ok';
|
|
9162
|
+
const videos = runVideos(res);
|
|
9163
|
+
if (videos.length) { finishLiveRun('ok'); offerRunVideos(runAppId, videos); }
|
|
9164
|
+
// #2230: the run worked, but what it rendered could not be readied for playing here — say so, and where it is.
|
|
9165
|
+
if (res && typeof res.mediaWarning === 'string') showToast(res.mediaWarning, 'warn');
|
|
8901
9166
|
// SSE usually fills liveTrace first; backfill from the response if it didn't.
|
|
8902
9167
|
if (liveTrace.length === 0 && Array.isArray(res.events)) res.events.forEach(pushTrace);
|
|
8903
9168
|
// A "succeeded" run carrying a rejected token → prompt reconnect, not a result.
|
|
@@ -8909,10 +9174,17 @@
|
|
|
8909
9174
|
: `Run complete · ${steps} node${steps === 1 ? '' : 's'} against the live model · see the <strong>Execution</strong> tab.`);
|
|
8910
9175
|
if (!simulate) markFirstRunDone(app.id); // a real run completed → calm the beacon (app captured pre-await)
|
|
8911
9176
|
} catch (e) {
|
|
8912
|
-
|
|
9177
|
+
liveOutcome = (e && e.body && e.body.cancelled) ? 'stopped'
|
|
9178
|
+
: !(e && e.status) ? 'no-answer' // the request itself was lost (reload, dropped connection), not the run
|
|
9179
|
+
: (e && e.body && (e.body.notRun || e.body.refusal)) ? 'not-run' : 'failed';
|
|
9180
|
+
if (e.body && e.body.cancelled) {
|
|
8913
9181
|
clearNodeStatus();
|
|
8914
9182
|
showToast('Run cancelled', 'info');
|
|
8915
|
-
appendNarration('
|
|
9183
|
+
appendNarration(stoppedRunCopy(e.body, !simulate && (app.templateId === 'floless-workspace-model-report' || app.templateId === 'tekla-model-report')) + ' Click <strong>▶ Run workflow</strong> to run again.');
|
|
9184
|
+
} else if (liveOutcome === 'no-answer' && clientRunToken) {
|
|
9185
|
+
// #2228: the request was lost, not the run — which may still be working. The strip says how it ends
|
|
9186
|
+
// once FloLess answers again; reporting a failure here would contradict it.
|
|
9187
|
+
appendNarration('Lost touch with FloLess while the run was working. The strip above the canvas shows how it ends once FloLess is back.');
|
|
8916
9188
|
} else {
|
|
8917
9189
|
const cred = e.body && e.body.credentialIssue;
|
|
8918
9190
|
if (cred) {
|
|
@@ -8939,6 +9211,8 @@
|
|
|
8939
9211
|
}
|
|
8940
9212
|
}
|
|
8941
9213
|
} finally {
|
|
9214
|
+
finishManualRun(request);
|
|
9215
|
+
if (clientRunToken) { if (liveOutcome === 'no-answer') settleLiveRunWithoutAnswer(); else finishLiveRun(liveOutcome); }
|
|
8942
9216
|
state.running = false;
|
|
8943
9217
|
runningSimulation = false;
|
|
8944
9218
|
$runBtn.disabled = false;
|
|
@@ -8984,7 +9258,8 @@
|
|
|
8984
9258
|
}
|
|
8985
9259
|
function clearNodeStatus() {
|
|
8986
9260
|
document.querySelectorAll('.agent-card').forEach((card) => {
|
|
8987
|
-
card.classList.remove('node-running', 'node-done', 'node-error');
|
|
9261
|
+
card.classList.remove('node-running', 'node-done', 'node-error', 'has-progress');
|
|
9262
|
+
card.style.removeProperty('--node-progress');
|
|
8988
9263
|
const pip = card.querySelector('.node-stat');
|
|
8989
9264
|
if (pip) pip.remove();
|
|
8990
9265
|
});
|
|
@@ -8997,6 +9272,18 @@
|
|
|
8997
9272
|
}
|
|
8998
9273
|
|
|
8999
9274
|
function pushTrace(ev) {
|
|
9275
|
+
// #2228: a long render reports every frame. The Execution tab keeps ONE row per node and pass, updated in
|
|
9276
|
+
// place ("render 143 of 240 · pass 1 of 1"), so a 1,000-frame animation cannot bury the steps that matter.
|
|
9277
|
+
if (ev.kind === 'node-progress') {
|
|
9278
|
+
const d = ev.data && typeof ev.data === 'object' ? ev.data : {};
|
|
9279
|
+
const key = `${ev.node || ''}|${d.phase || ''}|${d.message || ''}`;
|
|
9280
|
+
const count = typeof d.done === 'number' ? ` ${d.done}${typeof d.total === 'number' ? ' of ' + d.total : ''}` : '';
|
|
9281
|
+
const msg = `progress ${escapeHtml(ev.node || '')} · ${escapeHtml(d.phase || '')}${count}${d.message ? ' · ' + escapeHtml(d.message) : ''}`;
|
|
9282
|
+
const row = liveTrace.length && liveTrace[liveTrace.length - 1];
|
|
9283
|
+
if (row && row.kind === 'node-progress' && row.progressKey === key) { row.msg = msg; row.ts = fmtTs(ev.ts); return; }
|
|
9284
|
+
liveTrace.push({ kind: ev.kind, ts: fmtTs(ev.ts), lvl: 'info', msg, node: ev.node || '', progressKey: key });
|
|
9285
|
+
return;
|
|
9286
|
+
}
|
|
9000
9287
|
const node = escapeHtml(ev.node || '');
|
|
9001
9288
|
const agent = escapeHtml(ev.agent || '');
|
|
9002
9289
|
const cmd = ev.command ? '/' + escapeHtml(ev.command) : '';
|
|
@@ -9555,6 +9842,20 @@
|
|
|
9555
9842
|
}
|
|
9556
9843
|
}
|
|
9557
9844
|
|
|
9845
|
+
// #2185: the server events that change what is connected or installed — a sign-in finished, a credential file changed,
|
|
9846
|
+
// a tool was installed or updated, an account was chosen. Relayed as ONE in-page event so AI Chat's and the Guide's
|
|
9847
|
+
// connection and install cards can tick themselves off without a reload (Integrations is a modal, so the window never
|
|
9848
|
+
// regains focus when the person comes back from it). Null for anything else.
|
|
9849
|
+
function connectionsChangeOf(m) {
|
|
9850
|
+
if (!m || typeof m !== 'object') return null;
|
|
9851
|
+
if (m.type === 'connect-result' && m.status === 'connected') return { reason: 'connected', id: typeof m.id === 'string' ? m.id : null };
|
|
9852
|
+
if (m.type === 'fs-change' && m.kind === 'credential') return { reason: 'credential', id: null };
|
|
9853
|
+
if (m.type === 'agent-install-result' && m.ok) return { reason: 'installed', id: typeof m.id === 'string' ? m.id : null };
|
|
9854
|
+
if (m.type === 'connections-changed') return { reason: 'tool-ready', id: typeof m.id === 'string' ? m.id : null };
|
|
9855
|
+
if (m.type === 'account-choice') return { reason: 'account-choice', id: typeof m.integration === 'string' ? m.integration : null };
|
|
9856
|
+
return null;
|
|
9857
|
+
}
|
|
9858
|
+
|
|
9558
9859
|
function connectSse() {
|
|
9559
9860
|
const es = new EventSource('/api/events');
|
|
9560
9861
|
let reloadTimer = null;
|
|
@@ -9587,12 +9888,16 @@
|
|
|
9587
9888
|
// Scheduled reports may finish with every browser closed; refresh their authorized
|
|
9588
9889
|
// pointers on both first connection and reconnect, never from SSE payload data.
|
|
9589
9890
|
void refreshSelectedCompleteReportDiscovery(currentId);
|
|
9891
|
+
// #2228: progress events are at-most-once too — a reload or a reconnect asks where this tab's run is.
|
|
9892
|
+
void resyncLiveRun();
|
|
9590
9893
|
everOpened = true;
|
|
9591
9894
|
};
|
|
9592
9895
|
es.onmessage = (e) => {
|
|
9593
9896
|
let m;
|
|
9594
9897
|
try { m = JSON.parse(e.data); } catch { return; }
|
|
9595
9898
|
if (!m || typeof m !== 'object') return; // valid non-object JSON (null/number) has no .type
|
|
9899
|
+
const connectionsChange = connectionsChangeOf(m);
|
|
9900
|
+
if (connectionsChange) window.dispatchEvent(new CustomEvent('floless:connections-changed', { detail: connectionsChange }));
|
|
9596
9901
|
if (m.type === 'bootstrap') {
|
|
9597
9902
|
// First-run AWARE setup state machine. `line` carries an npm ticker line
|
|
9598
9903
|
// (installing only) → dim ticker; `status`/`reason` drive the card state.
|
|
@@ -9603,6 +9908,27 @@
|
|
|
9603
9908
|
// it immediately; the init-time adopt() only covers tabs opened after it began. adopt() is
|
|
9604
9909
|
// single-flight and idempotent, so the two racing is fine.
|
|
9605
9910
|
if (window.awareUpdateController) window.awareUpdateController.adopt().catch(() => {});
|
|
9911
|
+
} else if (m.type === 'run-live' || m.type === 'node-progress' || m.type === 'run-finished') {
|
|
9912
|
+
// #2228: live progress of a long run. This tab's own run is matched by its token; a run of the
|
|
9913
|
+
// workflow this tab shows that someone else started is followed read-only (no Stop).
|
|
9914
|
+
if (liveRunOwns(m)) {
|
|
9915
|
+
if (m.type === 'run-live') { if (m.runId) liveRun.runId = m.runId; }
|
|
9916
|
+
else if (m.type === 'node-progress') onLiveProgress(m);
|
|
9917
|
+
else finishLiveRun(typeof m.outcome === 'string' ? m.outcome : 'failed');
|
|
9918
|
+
} else if (m.id === currentId && !(liveRun && liveRun.owner && !liveRun.ended)) {
|
|
9919
|
+
if (m.type === 'run-finished') {
|
|
9920
|
+
if (liveRun && !liveRun.owner && (!m.runId || m.runId === liveRun.runId)) finishLiveRun(typeof m.outcome === 'string' ? m.outcome : 'failed');
|
|
9921
|
+
} else {
|
|
9922
|
+
if (!liveRun || liveRun.ended || (m.runId && liveRun.runId && m.runId !== liveRun.runId)) observeLiveRun(m);
|
|
9923
|
+
if (m.type === 'node-progress') onLiveProgress(m);
|
|
9924
|
+
}
|
|
9925
|
+
}
|
|
9926
|
+
} else if (m.type === 'run-media' && Array.isArray(m.media)) {
|
|
9927
|
+
// #2230: the videos a run rendered, for a tab that lost the Run answer (a reload mid-run). The tab that
|
|
9928
|
+
// still holds the answer offers them from it; offerRunVideos is idempotent either way.
|
|
9929
|
+
const videos = m.media.filter((x) => x && x.kind === 'video' && typeof x.url === 'string');
|
|
9930
|
+
const mine = liveRun && ((m.clientRunToken && liveRun.token === m.clientRunToken) || (m.runId && liveRun.runId === m.runId));
|
|
9931
|
+
if (videos.length && (mine || m.id === currentId)) offerRunVideos(m.id, videos);
|
|
9606
9932
|
} else if (m.type === 'render-progress') {
|
|
9607
9933
|
// Relayed as a DOM event rather than widening the bridge: workspaces.js owns the Exports
|
|
9608
9934
|
// card and is the only listener, and a render can outlive several repaints of it.
|
|
@@ -9658,17 +9984,17 @@
|
|
|
9658
9984
|
// The event is only an invalidation. Re-read the workflow-scoped pin so the server remains
|
|
9659
9985
|
// the source of truth; refresh clears first and its epoch rejects any older response.
|
|
9660
9986
|
refreshKbInformed(currentId);
|
|
9661
|
-
} else if (m.type === 'trace' && m.id === currentId) {
|
|
9987
|
+
} else if (m.type === 'trace' && m.id === currentId && acceptsManualRunEvent(m)) {
|
|
9662
9988
|
pushTrace(m.event);
|
|
9663
9989
|
if (state.currentTab === 'execution') renderInspect();
|
|
9664
|
-
} else if (m.type === 'trace-file' && m.id === currentId && !state.running) {
|
|
9990
|
+
} else if (m.type === 'trace-file' && m.id === currentId && !state.running && !reportRunning && !activeManualRun) {
|
|
9665
9991
|
// A terminal-driven run wrote a trace for the open app (our own UI runs
|
|
9666
9992
|
// are handled by the type:'trace' path above and skipped via state.running).
|
|
9667
9993
|
liveTrace.length = 0;
|
|
9668
9994
|
(m.events || []).forEach(pushTrace);
|
|
9669
9995
|
state.hasRun = true;
|
|
9670
9996
|
if (state.currentTab === 'execution') renderInspect();
|
|
9671
|
-
} else if (m.type === 'run-started' && m.id === currentId) {
|
|
9997
|
+
} else if (m.type === 'run-started' && m.id === currentId && acceptsManualRunEvent(m)) {
|
|
9672
9998
|
liveTrace.length = 0;
|
|
9673
9999
|
state.hasRun = true;
|
|
9674
10000
|
} else if (m.type === 'templates-changed') {
|
|
@@ -9772,6 +10098,8 @@
|
|
|
9772
10098
|
// The terminal AI (or undo/reset) rewrote ~/.floless/ui/extensions.json —
|
|
9773
10099
|
// re-render the Dashboard / inspect-tab panels live. panels.js owns it.
|
|
9774
10100
|
if (window.flolessPanels) window.flolessPanels.refresh({ fromChange: true });
|
|
10101
|
+
} else if (m.type === 'revision-note-changed') {
|
|
10102
|
+
window.dispatchEvent(new CustomEvent('floless:revision-note-changed', { detail: m }));
|
|
9775
10103
|
} else if (m.type === 'run-ended') {
|
|
9776
10104
|
// Panel data bindings (last-run-output/-status) go stale after any run.
|
|
9777
10105
|
if (window.flolessPanels) window.flolessPanels.refreshData();
|
|
@@ -9798,6 +10126,8 @@
|
|
|
9798
10126
|
applyTriggerReport(m);
|
|
9799
10127
|
} else if (m.type === 'routine-report') {
|
|
9800
10128
|
applyRoutineReport(m);
|
|
10129
|
+
} else if (m.type === 'action-run-report') {
|
|
10130
|
+
applyActionRunReport(m);
|
|
9801
10131
|
} else if (m.type === 'routine-report-changed') {
|
|
9802
10132
|
if (typeof m.id === 'string') void refreshRoutineReportDiscovery(m.id);
|
|
9803
10133
|
} else if (m.type === 'connect-result') {
|
|
@@ -10523,14 +10853,14 @@
|
|
|
10523
10853
|
requestStartWaits.set(request.id, setTimeout(tick, REQUEST_START_WAIT_MS));
|
|
10524
10854
|
}
|
|
10525
10855
|
|
|
10526
|
-
async function startRequestChatWithSetup(requestId, provider, mode, { onSetup, isCancelled = () => false } = {}) {
|
|
10856
|
+
async function startRequestChatWithSetup(requestId, provider, mode, { onSetup, isCancelled = () => false, ownChat = false, restoreFirst = false } = {}) {
|
|
10527
10857
|
if (typeof window.flolessChat?.startRequest !== 'function') throw new Error('AI Chat is still starting. Try again in a moment.');
|
|
10528
10858
|
if (mode === 'start') {
|
|
10529
10859
|
const ready = await ensureChatRuntimeReady(provider, { onProgress: (status) => onSetup?.(status), isCancelled });
|
|
10530
10860
|
if (ready.cancelled || isCancelled()) throw Object.assign(new Error('The start was cancelled.'), { code: 'chat-start-cancelled' });
|
|
10531
10861
|
if (!ready.ok) throw Object.assign(new Error(ready.reason), { code: 'chat-runtime-not-ready' });
|
|
10532
10862
|
}
|
|
10533
|
-
return window.flolessChat.startRequest(requestId, provider, mode);
|
|
10863
|
+
return window.flolessChat.startRequest(requestId, provider, mode, { ownChat, restoreFirst });
|
|
10534
10864
|
}
|
|
10535
10865
|
// Requests being started in AI Chat while FloLess sets their AI up, by request id → { label } of the
|
|
10536
10866
|
// busy button. Kept outside the list, so a repaint during a long setup shows the same busy button
|
|
@@ -10812,7 +11142,8 @@
|
|
|
10812
11142
|
return;
|
|
10813
11143
|
}
|
|
10814
11144
|
if (holder.kind === 'chat' && holder.chatId && holder.owner && typeof window.flolessChat?.openConversationIn === 'function') {
|
|
10815
|
-
const
|
|
11145
|
+
const scope = holder.label ? { owner: holder.owner, label: holder.label } : { owner: holder.owner };
|
|
11146
|
+
const opened = await window.flolessChat.openConversationIn(scope, holder.chatId).catch(() => false);
|
|
10816
11147
|
if (!opened) showToast('FloLess couldn’t open that conversation. It may have finished or moved; check AI Chat.', 'warn');
|
|
10817
11148
|
return;
|
|
10818
11149
|
}
|
|
@@ -11408,13 +11739,19 @@
|
|
|
11408
11739
|
const unreadable = link?.chatState === 'unreadable';
|
|
11409
11740
|
const linked = Boolean(link?.chatId) && !unreadable;
|
|
11410
11741
|
const provider = preferredChatProvider();
|
|
11411
|
-
const inScope =
|
|
11742
|
+
const inScope = requestHasChatOwner(r) && requestMatchesChatScope(r);
|
|
11412
11743
|
const chatLabel = `${label}${owner ? ` for ${owner}` : ''}`;
|
|
11744
|
+
// #2185: a request that was set aside (not deleted) says why, and can be brought back exactly as it was.
|
|
11745
|
+
const soft = r.lifecycle && typeof r.lifecycle === 'object' ? r.lifecycle : null;
|
|
11746
|
+
const softWord = soft ? ({ dismissed: 'Dismissed', expired: 'Expired', settled: 'Done' }[soft.state] || 'Set aside') : '';
|
|
11747
|
+
const restoreBtn = soft && r.canRestore === true
|
|
11748
|
+
? `<button class="req-chat-action" data-done-restore data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-done-restore#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" aria-label="Restore ${escapeAttr(chatLabel)} to Requests" data-tip="Put this request back in Requests, exactly as it was">Restore</button>`
|
|
11749
|
+
: '';
|
|
11413
11750
|
let action = '';
|
|
11414
11751
|
if (provider && inScope) {
|
|
11415
|
-
action = `<button class="req-chat-action" data-done-chat="${linked ? 'open' : 'discuss'}" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-done-discuss#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" aria-label="${linked ? 'Open' : 'Discuss'} ${escapeAttr(chatLabel)} in AI Chat" data-tip="${linked ? 'Open this request’s conversation in AI Chat' : 'Start a conversation about this request in AI Chat. Nothing runs.'}">${linked ? 'Open
|
|
11416
|
-
} else if (provider && (r
|
|
11417
|
-
action = `<span class="req-chat-elsewhere" data-tip="
|
|
11752
|
+
action = `<button class="req-chat-action" data-done-chat="${linked ? 'open' : 'discuss'}" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-done-discuss#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" aria-label="${linked ? 'Open the chat for' : 'Discuss'} ${escapeAttr(chatLabel)} in AI Chat" data-tip="${linked ? 'Open this request’s conversation in AI Chat' : 'Start a conversation about this request in AI Chat. Nothing runs.'}">${linked ? 'Open chat' : 'Discuss in AI Chat'}</button>`;
|
|
11753
|
+
} else if (provider && requestHasChatOwner(r)) {
|
|
11754
|
+
action = `<span class="req-chat-elsewhere" data-tip="${escapeAttr(requestChatScopeReason(r))}">${escapeHtml(requestChatScopeReason(r))}</span>`;
|
|
11418
11755
|
} else if (!provider) {
|
|
11419
11756
|
action = '<span class="req-chat-elsewhere" data-tip="AI Chat needs Claude or Codex on this computer">AI Chat isn’t available</span>';
|
|
11420
11757
|
}
|
|
@@ -11426,11 +11763,12 @@
|
|
|
11426
11763
|
return `
|
|
11427
11764
|
<div class="req-item req-done-item" data-id="${escapeAttr(r.id)}">
|
|
11428
11765
|
<div class="req-info">
|
|
11429
|
-
<div class="req-head"><span class="${badgeCls}">${escapeHtml(label)}</span> ${owner ? `<span class="req-owner">${highlightQuery(owner, query)}</span>` : ''}${leftLabel ? `<span class="req-time" data-tip="Left the queue ${escapeAttr(leftLabel)}">${escapeHtml(leftLabel)}</span>` : ''}</div>
|
|
11766
|
+
<div class="req-head"><span class="${badgeCls}">${escapeHtml(label)}</span> ${owner ? `<span class="req-owner">${highlightQuery(owner, query)}</span>` : ''}${leftLabel ? `<span class="req-time" data-tip="${soft ? 'Set aside' : 'Left the queue'} ${escapeAttr(leftLabel)}">${escapeHtml(leftLabel)}</span>` : ''}${soft ? `<span class="req-state" data-state="${escapeAttr(soft.state)}">${escapeHtml(softWord)}</span>` : ''}</div>
|
|
11430
11767
|
<div class="req-instruction">${highlightQuery(r.summary || '', query) || 'This request kept no words to show.'}</div>
|
|
11768
|
+
${soft && soft.reason ? `<p class="req-done-why">${escapeHtml(soft.reason)}</p>` : ''}
|
|
11431
11769
|
${runHtml}${unreadableNote}
|
|
11432
11770
|
</div>
|
|
11433
|
-
<div class="req-actions">${action}</div>
|
|
11771
|
+
<div class="req-actions">${action}${restoreBtn}</div>
|
|
11434
11772
|
</div>`;
|
|
11435
11773
|
}
|
|
11436
11774
|
/** Requests → Done: what left the queue, newest first. Read-only apart from opening or discussing a conversation. */
|
|
@@ -11487,6 +11825,14 @@
|
|
|
11487
11825
|
if ($showAll) $showAll.onclick = () => setRequestScopeAll(true);
|
|
11488
11826
|
const $retry = $list.querySelector('[data-done-retry]');
|
|
11489
11827
|
if ($retry) $retry.onclick = async () => { await loadDoneRequests(); renderRequests(); };
|
|
11828
|
+
$list.querySelectorAll('[data-done-restore]').forEach((button) => {
|
|
11829
|
+
button.onclick = async () => {
|
|
11830
|
+
button.disabled = true;
|
|
11831
|
+
button.setAttribute('aria-busy', 'true');
|
|
11832
|
+
const restored = await restoreSetAsideRequest(button.dataset.id);
|
|
11833
|
+
if (!restored && button.isConnected) { button.disabled = false; button.removeAttribute('aria-busy'); }
|
|
11834
|
+
};
|
|
11835
|
+
});
|
|
11490
11836
|
$list.querySelectorAll('[data-done-chat]').forEach((button) => {
|
|
11491
11837
|
button.onclick = async () => {
|
|
11492
11838
|
const request = (doneRequests || []).find((candidate) => candidate?.id === button.dataset.id);
|
|
@@ -11543,13 +11889,17 @@
|
|
|
11543
11889
|
if ($queued) $queued.textContent = pendingRequests.length ? `Queued (${pendingRequests.length})` : 'Queued';
|
|
11544
11890
|
const $sub = document.getElementById('requests-sub');
|
|
11545
11891
|
if ($sub) $sub.textContent = done
|
|
11546
|
-
? 'Requests that left the queue in the last 30 days. Open their conversation or
|
|
11547
|
-
: '
|
|
11892
|
+
? 'Requests that left the queue in the last 30 days, and every one you set aside. Open their conversation, or restore one to Requests. Nothing here runs again by itself.'
|
|
11893
|
+
: 'Work on a request in AI Chat, or run it in the background with your terminal AI. ✕ sets one aside; Done keeps it.';
|
|
11548
11894
|
const $note = document.getElementById('requests-done-note');
|
|
11549
11895
|
if ($note) $note.hidden = !done;
|
|
11550
11896
|
}
|
|
11551
11897
|
let previousRequestCount = 0;
|
|
11552
11898
|
let previousRequestIds = null;
|
|
11899
|
+
// #2185: the one-time tidy of old requests, shown above the list with Undo until it is undone or closed.
|
|
11900
|
+
let requestsBacklog = null;
|
|
11901
|
+
/** Does this request need the person (the REQUESTS pill), by the server's own projection? A row without one counts. */
|
|
11902
|
+
function requestNeedsPerson(r) { return r?.attention?.state !== 'not-now'; }
|
|
11553
11903
|
let reqPulseTimer = null;
|
|
11554
11904
|
let revealFlashTimer = null;
|
|
11555
11905
|
let revealArriveCleanup = null;
|
|
@@ -11577,9 +11927,10 @@
|
|
|
11577
11927
|
try {
|
|
11578
11928
|
// Bounded: every later read waits behind this one, so a response that never arrives must not
|
|
11579
11929
|
// freeze the list for good. The route's own lock waits give up after 60 s.
|
|
11580
|
-
const { requests, chatPublications = [] } = await api('/api/requests', { signal: AbortSignal.timeout(90_000) });
|
|
11930
|
+
const { requests, chatPublications = [], needsYou, backlog = null } = await api('/api/requests', { signal: AbortSignal.timeout(90_000) });
|
|
11581
11931
|
reconcileActiveInstructorRuns(requests, chatPublications);
|
|
11582
11932
|
pendingRequests = requests;
|
|
11933
|
+
requestsBacklog = backlog && typeof backlog === 'object' ? backlog : null;
|
|
11583
11934
|
// A Request leaving the queue arrives in Done: re-read it while Done is what the open window shows.
|
|
11584
11935
|
// Not awaited: the queue's own update never waits on the Done read.
|
|
11585
11936
|
if (requestViewMode === 'done' && document.getElementById('requests-modal')?.classList.contains('show')) {
|
|
@@ -11624,21 +11975,32 @@
|
|
|
11624
11975
|
}
|
|
11625
11976
|
const $rc = document.getElementById('req-count');
|
|
11626
11977
|
const $rs = document.getElementById('req-stat');
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
const
|
|
11978
|
+
// #2185: the pill counts what needs the person, as the server decided it - not everything that exists. Work the AI
|
|
11979
|
+
// is doing, and anything set aside, is in Requests but is not a thing for you to do.
|
|
11980
|
+
const needing = requests.filter((r) => r && requestNeedsPerson(r));
|
|
11981
|
+
const needCount = Number.isFinite(needsYou) ? needsYou : needing.length;
|
|
11982
|
+
if ($rc) $rc.textContent = needCount;
|
|
11983
|
+
if ($rs) {
|
|
11984
|
+
$rs.classList.toggle('has-pending', needCount > 0);
|
|
11985
|
+
$rs.setAttribute('aria-label', `Open Requests. ${needCount} ${needCount === 1 ? 'needs' : 'need'} you`);
|
|
11986
|
+
const withAi = requests.length - needing.length;
|
|
11987
|
+
$rs.setAttribute('data-tip', needCount
|
|
11988
|
+
? `${needCount} request${needCount === 1 ? ' needs' : 's need'} you${withAi ? ` · ${withAi} with the AI` : ''} — click to view & manage`
|
|
11989
|
+
: withAi ? `Nothing needs you · ${withAi} with the AI — click to view` : 'Nothing needs you — click to view & manage');
|
|
11990
|
+
}
|
|
11991
|
+
const ids = new Set(needing.map((r) => r && r.id).filter(Boolean));
|
|
11630
11992
|
const hasNewId = previousRequestIds
|
|
11631
|
-
?
|
|
11632
|
-
:
|
|
11633
|
-
// Add the shake animation when a
|
|
11634
|
-
if ((hasNewId ||
|
|
11993
|
+
? needing.some((r) => r && r.id && !previousRequestIds.has(r.id))
|
|
11994
|
+
: needCount > previousRequestCount;
|
|
11995
|
+
// Add the shake animation when a request that needs you appears in the poll/SSE refresh.
|
|
11996
|
+
if ((hasNewId || needCount > previousRequestCount) && $rs) {
|
|
11635
11997
|
$rs.classList.remove('req-pulse'); // force reflow to restart animation
|
|
11636
11998
|
void $rs.offsetWidth; // trigger reflow
|
|
11637
11999
|
$rs.classList.add('req-pulse');
|
|
11638
12000
|
if (reqPulseTimer) clearTimeout(reqPulseTimer);
|
|
11639
12001
|
reqPulseTimer = setTimeout(() => { $rs.classList.remove('req-pulse'); reqPulseTimer = null; }, 2100);
|
|
11640
12002
|
}
|
|
11641
|
-
previousRequestCount =
|
|
12003
|
+
previousRequestCount = needCount;
|
|
11642
12004
|
previousRequestIds = ids;
|
|
11643
12005
|
const $rm = document.getElementById('requests-modal');
|
|
11644
12006
|
if ($rm && $rm.classList.contains('show')) renderRequests(); // keep an open list live
|
|
@@ -11706,6 +12068,8 @@
|
|
|
11706
12068
|
*/
|
|
11707
12069
|
function requestOwnerName(r) {
|
|
11708
12070
|
if (!r) return '';
|
|
12071
|
+
// #2185: a build's conversation is its workflow's, so "Open … for AI Chat" names the workflow, not its project.
|
|
12072
|
+
if (r.type === 'new-workflow' && r.buildId && r.workflowName) return r.workflowName;
|
|
11709
12073
|
if (r.project) return r.projectName || r.project;
|
|
11710
12074
|
if (r.appId) return r.appId;
|
|
11711
12075
|
return r.type === 'ui-customize' ? 'your dashboard' : r.type === 'new-workflow' ? (r.workflowName || 'a new workflow') : '';
|
|
@@ -11714,9 +12078,30 @@
|
|
|
11714
12078
|
function requestMatchesChatScope(request) {
|
|
11715
12079
|
const scope = currentChatScope();
|
|
11716
12080
|
if (!scope?.owner || !request) return false;
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
12081
|
+
// #2185: a build's Request lives in its workflow's own conversation even inside a project (server requestChatOwner).
|
|
12082
|
+
if (request.type === 'new-workflow' && request.buildId && request.workflowId) {
|
|
12083
|
+
return scope.owner.kind === 'workflow' && request.workflowId === scope.owner.workflowId;
|
|
12084
|
+
}
|
|
12085
|
+
if (request.project) return scope.owner.kind === 'project' && request.project === scope.owner.projectId;
|
|
12086
|
+
if (request.workflowId) return scope.owner.kind === 'workflow' && request.workflowId === scope.owner.workflowId;
|
|
12087
|
+
return workspaceInstructorRequest(request) && scope.owner.kind === 'workspace'
|
|
12088
|
+
&& (request.instructorWorkspaceState === 'current'
|
|
12089
|
+
|| (!request.instructorWorkspaceRootId && !request.instructorWorkspaceState));
|
|
12090
|
+
}
|
|
12091
|
+
|
|
12092
|
+
function workspaceInstructorRequest(request) {
|
|
12093
|
+
return !!request && request.type === 'guide' && !!request.instructorContext && !request.project && !request.workflowId;
|
|
12094
|
+
}
|
|
12095
|
+
|
|
12096
|
+
function requestHasChatOwner(request) {
|
|
12097
|
+
return !!request && !!(request.project || request.workflowId || workspaceInstructorRequest(request));
|
|
12098
|
+
}
|
|
12099
|
+
|
|
12100
|
+
function requestChatScopeReason(request) {
|
|
12101
|
+
if (workspaceInstructorRequest(request)) {
|
|
12102
|
+
return request.instructorWorkspaceWhy || 'Open the Workspaces list to use this question’s AI Chat.';
|
|
12103
|
+
}
|
|
12104
|
+
return `Open ${requestOwnerName(request)} for AI Chat`;
|
|
11720
12105
|
}
|
|
11721
12106
|
|
|
11722
12107
|
// Everything a search should match: the project/workflow the request belongs to, its badge
|
|
@@ -12531,6 +12916,186 @@
|
|
|
12531
12916
|
window.addEventListener('blur', () => release(null)); // the release may happen in another window
|
|
12532
12917
|
}
|
|
12533
12918
|
|
|
12919
|
+
// ── #2185: Requests stop piling up ───────────────────────────────────────────────────────────────────────────────
|
|
12920
|
+
// ✕ sets a request aside; nothing is deleted. Done keeps it with the reason, and Restore brings back the same request.
|
|
12921
|
+
// When the AI is working on it the server refuses, and the click ASKS - stop that work first, or keep the request.
|
|
12922
|
+
const REQUEST_SET_ASIDE_CODES = new Set(['request-dismissed', 'request-expired', 'request-settled']);
|
|
12923
|
+
const requestDismissals = new Map();
|
|
12924
|
+
const requestWords = (r) => { const owner = requestOwnerName(r); return `${requestLabel(r)}${owner ? ` for ${owner}` : ''}`; };
|
|
12925
|
+
|
|
12926
|
+
async function restoreSetAsideRequest(id, { quiet = false } = {}) {
|
|
12927
|
+
try {
|
|
12928
|
+
await api(`/api/requests/${encodeURIComponent(id)}/restore`, { method: 'POST', body: '{}' });
|
|
12929
|
+
} catch (error) {
|
|
12930
|
+
showToast(error?.body?.error || 'FloLess couldn’t restore that request. It is still in Done; try again.', 'warn');
|
|
12931
|
+
return false;
|
|
12932
|
+
}
|
|
12933
|
+
await loadRequests().catch(() => {});
|
|
12934
|
+
if (requestViewMode === 'done') await loadDoneRequests();
|
|
12935
|
+
renderRequests();
|
|
12936
|
+
if (!quiet) showToast('Restored. It is back in Requests.', 'ok');
|
|
12937
|
+
return true;
|
|
12938
|
+
}
|
|
12939
|
+
|
|
12940
|
+
/** A dialog title starts with a capital, however the request's own words begin. */
|
|
12941
|
+
const sentenceStart = (text) => { const s = String(text || ''); return s.charAt(0).toUpperCase() + s.slice(1); };
|
|
12942
|
+
|
|
12943
|
+
/** The ✕. Resolves to 'dismissed' | 'kept' | 'gone' | 'error'. */
|
|
12944
|
+
async function dismissQueuedRequest(r) {
|
|
12945
|
+
if (requestDismissals.has(r.id)) return requestDismissals.get(r.id);
|
|
12946
|
+
const task = (async () => {
|
|
12947
|
+
try {
|
|
12948
|
+
await api(`/api/requests/${encodeURIComponent(r.id)}/dismiss`, { method: 'POST', body: '{}' });
|
|
12949
|
+
} catch (error) {
|
|
12950
|
+
const body = error?.body;
|
|
12951
|
+
if (body?.code === 'request-held' && body.hold) return askDismissHeld(r, body.hold);
|
|
12952
|
+
if (body?.code === 'request-already-set-aside' || error?.status === 404) { await loadRequests().catch(() => {}); renderRequests(); return 'gone'; }
|
|
12953
|
+
showToast(body?.error || 'FloLess couldn’t set that request aside. It is still in Requests; try again.', 'warn');
|
|
12954
|
+
return 'error';
|
|
12955
|
+
}
|
|
12956
|
+
return afterDismissed(r);
|
|
12957
|
+
})().finally(() => requestDismissals.delete(r.id));
|
|
12958
|
+
requestDismissals.set(r.id, task);
|
|
12959
|
+
return task;
|
|
12960
|
+
}
|
|
12961
|
+
|
|
12962
|
+
async function afterDismissed(r) {
|
|
12963
|
+
await loadRequests().catch(() => {});
|
|
12964
|
+
renderRequests();
|
|
12965
|
+
showToast(`Dismissed ${requestWords(r)}. It is kept in Done.`, 'ok', {
|
|
12966
|
+
action: { label: 'Undo', commandId: 'shell.requests-dismiss-undo', onClick: () => { void restoreSetAsideRequest(r.id); } },
|
|
12967
|
+
});
|
|
12968
|
+
return 'dismissed';
|
|
12969
|
+
}
|
|
12970
|
+
|
|
12971
|
+
/** The AI is working on this request: say what, and offer to stop it first. Never only "can't". */
|
|
12972
|
+
async function askDismissHeld(r, hold) {
|
|
12973
|
+
const stop = hold.stop && typeof hold.stop === 'object' ? hold.stop : null;
|
|
12974
|
+
// The chat to open: a recovery has nothing to stop from here, but the ask tells the person to finish it there.
|
|
12975
|
+
const chat = [hold.open, stop].find((c) => c && typeof c === 'object' && c.kind === 'chat' && c.chatId && c.owner) || null;
|
|
12976
|
+
const actions = [{ id: null, label: 'Keep it', commandId: 'shell.requests-dismiss-keep' }];
|
|
12977
|
+
if (chat) actions.push({ id: 'open', label: 'Open the chat', commandId: 'shell.requests-dismiss-open' });
|
|
12978
|
+
if (stop) actions.push({ id: 'stop', label: 'Stop it and dismiss', commandId: 'shell.requests-dismiss-stop', className: 'req-busy-stop' });
|
|
12979
|
+
const choice = await busyChoiceDialog({
|
|
12980
|
+
title: `${sentenceStart(requestWords(r))} is being worked on`,
|
|
12981
|
+
sub: `${hold.why || 'Something is working on this request, so it was not dismissed.'} Nothing was changed.`,
|
|
12982
|
+
actions, focusId: 'shell.requests-dismiss-keep',
|
|
12983
|
+
});
|
|
12984
|
+
if (choice === 'open') {
|
|
12985
|
+
// Out of the way first, so the conversation it opens is what the person sees; named, so AI Chat can say whose it is.
|
|
12986
|
+
closeRequests();
|
|
12987
|
+
if (chat) await openProjectWaitHolder({ projectWait: { holder: { kind: 'chat', owner: chat.owner, chatId: chat.chatId, turnId: chat.turnId, title: chat.title, label: requestOwnerName(r) } } });
|
|
12988
|
+
return 'kept';
|
|
12989
|
+
}
|
|
12990
|
+
if (choice !== 'stop' || !stop) return 'kept';
|
|
12991
|
+
// Only a stop that went through may be reported as "stopped"; a stale one means the work had already ended or changed.
|
|
12992
|
+
let stopped = true;
|
|
12993
|
+
try {
|
|
12994
|
+
if (stop.kind === 'chat') {
|
|
12995
|
+
await api(`/api/chat/conversations/${encodeURIComponent(stop.chatId)}/stop`, { method: 'POST', body: JSON.stringify({ owner: stop.owner, expectTurnId: stop.turnId || undefined }) });
|
|
12996
|
+
} else if (stop.kind === 'wait') {
|
|
12997
|
+
await api(`/api/requests/${encodeURIComponent(stop.requestId)}/run/stop`, { method: 'POST', body: JSON.stringify({ waitId: stop.waitId }) });
|
|
12998
|
+
} else {
|
|
12999
|
+
await api(`/api/requests/${encodeURIComponent(stop.requestId)}/run/stop`, { method: 'POST', body: JSON.stringify(stop.leaseId ? { expectLeaseId: stop.leaseId } : {}) });
|
|
13000
|
+
}
|
|
13001
|
+
} catch (error) {
|
|
13002
|
+
// Already finished is fine - the dismissal below decides. Anything else leaves the request exactly as it was.
|
|
13003
|
+
if (error?.body?.code !== 'stop-stale') {
|
|
13004
|
+
console.warn('[requests] could not stop the work holding a request:', error);
|
|
13005
|
+
showToast('FloLess couldn’t stop that work, so the request was not dismissed.', 'warn');
|
|
13006
|
+
return 'kept';
|
|
13007
|
+
}
|
|
13008
|
+
stopped = false;
|
|
13009
|
+
}
|
|
13010
|
+
try {
|
|
13011
|
+
await api(`/api/requests/${encodeURIComponent(r.id)}/dismiss`, { method: 'POST', body: '{}' });
|
|
13012
|
+
} catch (error) {
|
|
13013
|
+
await loadRequests().catch(() => {}); renderRequests();
|
|
13014
|
+
// A stop that went through is said, so the person does not think the AI is still working; a stale one is not claimed.
|
|
13015
|
+
showToast(error?.body?.code === 'request-held'
|
|
13016
|
+
? (stopped ? 'The work was stopped and is still winding down. Try dismissing it again in a moment.' : 'Something is still working on this request. Try dismissing it again in a moment.')
|
|
13017
|
+
: `${stopped ? 'The work was stopped, but the request' : 'The request'} couldn’t be set aside. It is still in Requests; try ✕ again.`, 'warn');
|
|
13018
|
+
return 'kept';
|
|
13019
|
+
}
|
|
13020
|
+
return afterDismissed(r);
|
|
13021
|
+
}
|
|
13022
|
+
|
|
13023
|
+
/** A start reached a request that was set aside meanwhile: say so, and offer to bring it back and start it in one step. */
|
|
13024
|
+
async function askRestoreAndStart(request, provider, code) {
|
|
13025
|
+
const settled = code === 'request-settled';
|
|
13026
|
+
const why = code === 'request-dismissed' ? 'You dismissed this request.'
|
|
13027
|
+
: code === 'request-expired' ? 'This request sat untouched for 14 days, so FloLess set it aside.'
|
|
13028
|
+
: 'This request was already answered.';
|
|
13029
|
+
const actions = [{ id: null, label: settled ? 'Close' : 'Cancel', commandId: 'shell.requests-restore-cancel' }];
|
|
13030
|
+
if (!settled) {
|
|
13031
|
+
actions.push({ id: 'restore', label: 'Restore', commandId: 'shell.requests-restore' });
|
|
13032
|
+
actions.push({ id: 'start', label: 'Restore and start', commandId: 'shell.requests-restore-start', className: 'primary' });
|
|
13033
|
+
}
|
|
13034
|
+
const choice = await busyChoiceDialog({
|
|
13035
|
+
title: `${sentenceStart(requestWords(request))} is set aside`,
|
|
13036
|
+
sub: `${why} Nothing was started.${settled ? ' Its answer is in AI Chat. To ask again, make a new request.' : ' Restore it to put it back in Requests, or restore it and start the AI on it now.'}`,
|
|
13037
|
+
actions, focusId: settled ? 'shell.requests-restore-cancel' : 'shell.requests-restore-start',
|
|
13038
|
+
});
|
|
13039
|
+
if (choice === 'restore') { await restoreSetAsideRequest(request.id); return; }
|
|
13040
|
+
if (choice !== 'start') return;
|
|
13041
|
+
try {
|
|
13042
|
+
await startRequestChatWithSetup(request.id, provider, 'start', { ownChat: true, restoreFirst: true });
|
|
13043
|
+
await loadRequests().catch(() => {});
|
|
13044
|
+
closeRequests();
|
|
13045
|
+
} catch (error) {
|
|
13046
|
+
if (error?.code === 'chat-start-cancelled') return;
|
|
13047
|
+
// Refused after Restore: say why in the list as well, exactly as the other start surfaces do.
|
|
13048
|
+
const notReady = error?.code === 'chat-runtime-not-ready';
|
|
13049
|
+
const explained = notReady ? '' : chatStartErrorText(error);
|
|
13050
|
+
if (notReady) showToast(error.message, 'warn');
|
|
13051
|
+
else reportChatStartErr(error);
|
|
13052
|
+
await loadRequests().catch(() => {}); renderRequests();
|
|
13053
|
+
const actionStatus = document.getElementById('requests-action-status');
|
|
13054
|
+
if (actionStatus) actionStatus.textContent = notReady ? error.message : explained || `Couldn’t start ${requestLabel(request)} in AI Chat. Try again.`;
|
|
13055
|
+
}
|
|
13056
|
+
}
|
|
13057
|
+
|
|
13058
|
+
// The one-time tidy of old requests: said once, above the list, with Undo.
|
|
13059
|
+
function renderRequestsBacklog() {
|
|
13060
|
+
const line = document.getElementById('requests-backlog');
|
|
13061
|
+
if (!line) return;
|
|
13062
|
+
const summary = requestViewMode === 'queued' ? requestsBacklog : null;
|
|
13063
|
+
const total = summary ? (Number(summary.settled) || 0) + (Number(summary.expired) || 0) : 0;
|
|
13064
|
+
line.hidden = !summary || total === 0;
|
|
13065
|
+
if (line.hidden) { line.replaceChildren(); return; }
|
|
13066
|
+
const parts = [];
|
|
13067
|
+
if (summary.settled) parts.push(`${summary.settled} already answered`);
|
|
13068
|
+
if (summary.expired) parts.push(`${summary.expired} untouched for 14 days`);
|
|
13069
|
+
const text = document.createElement('span');
|
|
13070
|
+
text.className = 'req-backlog-text';
|
|
13071
|
+
text.textContent = `Tidied ${total} old request${total === 1 ? '' : 's'}: ${parts.join(' and ')}. They are kept in Done.`;
|
|
13072
|
+
const undo = document.createElement('button');
|
|
13073
|
+
undo.type = 'button'; undo.className = 'req-backlog-undo'; undo.textContent = 'Undo';
|
|
13074
|
+
undo.setAttribute('data-command-id', 'shell.requests-backlog-undo');
|
|
13075
|
+
undo.setAttribute('data-tip', 'Put every one of those requests back in Requests');
|
|
13076
|
+
undo.onclick = async () => {
|
|
13077
|
+
undo.disabled = true;
|
|
13078
|
+
try {
|
|
13079
|
+
const result = await api('/api/requests/backlog/undo', { method: 'POST', body: '{}' });
|
|
13080
|
+
const put = `Put ${result.restored} request${result.restored === 1 ? '' : 's'} back in Requests.`;
|
|
13081
|
+
if (result.failed > 0) {
|
|
13082
|
+
showToast(`${result.restored ? `${put} ` : ''}${result.failed} couldn’t be put back, so ${result.failed === 1 ? 'it is' : 'they are'} still in Done. Press Undo again to retry.`, 'warn');
|
|
13083
|
+
} else showToast(put, 'ok');
|
|
13084
|
+
} catch (error) { showToast(error?.body?.error || 'FloLess couldn’t undo that. The requests are still in Done.', 'warn'); }
|
|
13085
|
+
await loadRequests().catch(() => {}); renderRequests();
|
|
13086
|
+
};
|
|
13087
|
+
const close = document.createElement('button');
|
|
13088
|
+
close.type = 'button'; close.className = 'req-backlog-close'; close.textContent = '×';
|
|
13089
|
+
close.setAttribute('aria-label', 'Close this note');
|
|
13090
|
+
close.setAttribute('data-command-id', 'shell.requests-backlog-close');
|
|
13091
|
+
close.setAttribute('data-tip', 'Close this note. The requests stay in Done');
|
|
13092
|
+
close.onclick = async () => {
|
|
13093
|
+
requestsBacklog = null; renderRequestsBacklog();
|
|
13094
|
+
try { await api('/api/requests/backlog/ack', { method: 'POST', body: '{}' }); } catch { /* it shows again next time, which is harmless */ }
|
|
13095
|
+
};
|
|
13096
|
+
line.replaceChildren(text, undo, close);
|
|
13097
|
+
}
|
|
13098
|
+
|
|
12534
13099
|
// The Requests window: every queued change in a list, with only the actions the server says are
|
|
12535
13100
|
// currently safe, plus bulk actions over the available rows. The server-composed prompt (which embeds file-derived
|
|
12536
13101
|
// appId/nodeId/instruction) is rendered via textContent-equivalent escaping — which matters MORE
|
|
@@ -12545,6 +13110,7 @@
|
|
|
12545
13110
|
// Everything waits, not only the rows, so the bulk actions keep acting on what is on screen.
|
|
12546
13111
|
if ($list.__requestsHeld) { $list.__requestsOwed = true; return; }
|
|
12547
13112
|
paintRequestViewChrome();
|
|
13113
|
+
renderRequestsBacklog();
|
|
12548
13114
|
if (requestViewMode === 'done') { renderDoneRequests($list); return; }
|
|
12549
13115
|
// Search is pointless over an empty queue, and over a single request it is just clutter.
|
|
12550
13116
|
// Drop the query WITH the box, and before anything is filtered by it: a hidden filter still
|
|
@@ -12684,17 +13250,20 @@
|
|
|
12684
13250
|
// and the run then lands in `exited-unresolved` for a reason the user caused and cannot see.
|
|
12685
13251
|
// #1874: a read nobody can say is discarded or not offers only Keep / Discard, in its own block.
|
|
12686
13252
|
const discardQuestion = requestHasDiscardQuestion(r);
|
|
12687
|
-
|
|
13253
|
+
// #2185: ✕ is always there. It sets the request aside (kept in Done, Restore brings it back); when the AI is working on
|
|
13254
|
+
// it the server says so and the click asks - stop that work first, or keep it - instead of the button vanishing.
|
|
13255
|
+
const heldNote = lifecycleOwned
|
|
12688
13256
|
? '<span class="req-lifecycle" data-tip="This clears itself when your terminal AI finishes or fails the organize">finishing in your terminal</span>'
|
|
12689
13257
|
: projectWaiting
|
|
12690
|
-
? '<span class="req-lifecycle" data-tip="
|
|
13258
|
+
? '<span class="req-lifecycle" data-tip="Waiting for its project to be free. Dismiss asks whether to stop waiting first">waiting</span>'
|
|
12691
13259
|
: inFlight || desktopClaimed
|
|
12692
|
-
? '<span class="req-lifecycle" data-tip="
|
|
13260
|
+
? '<span class="req-lifecycle" data-tip="Running. Dismiss asks whether to stop it first">running</span>'
|
|
12693
13261
|
: !canClear && r.clearState === 'session-saved'
|
|
12694
|
-
? `<span class="req-lifecycle" role="status" aria-live="polite" data-tip="${escapeAttr(r.clearWhy || 'This stopped session is saved so you can continue where you left off. Continue or finish it before
|
|
13262
|
+
? `<span class="req-lifecycle" role="status" aria-live="polite" data-tip="${escapeAttr(r.clearWhy || 'This stopped session is saved so you can continue where you left off. Continue or finish it before dismissing this request.')}"><span aria-hidden="true">session saved</span><span class="sr-only">Session saved. Continue or finish it before dismissing this request.</span></span>`
|
|
12695
13263
|
: !canClear
|
|
12696
|
-
? `<span class="req-lifecycle" data-tip="${escapeAttr(r.clearWhy || 'This request cannot be
|
|
12697
|
-
|
|
13264
|
+
? `<span class="req-lifecycle" data-tip="${escapeAttr(r.clearWhy || 'This request cannot be dismissed yet.')}">kept</span>`
|
|
13265
|
+
: '';
|
|
13266
|
+
const del = `${heldNote}<button class="req-del" aria-label="Dismiss ${escapeAttr(`${label}${owner ? ` for ${owner}` : ''}`)}" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-dismiss#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" data-tip="Dismiss this request. It stays in Done, and you can restore it">×</button>`;
|
|
12698
13267
|
// A server-stamped handoff gets NO re-run. The original terminal session may already be live;
|
|
12699
13268
|
// starting a second headless agent would put two writers in one folder. The server still owns
|
|
12700
13269
|
// run policy; this row repeats only the lifecycle-integrity guards needed to fail closed on a
|
|
@@ -12717,21 +13286,29 @@
|
|
|
12717
13286
|
: `<button class="req-run" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-run#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" aria-label="Start this request in the background" data-tip="Start this request in the background with your terminal AI">▶</button>`
|
|
12718
13287
|
: '';
|
|
12719
13288
|
const chatProvider = preferredChatProvider();
|
|
12720
|
-
const hasChatOwner =
|
|
13289
|
+
const hasChatOwner = requestHasChatOwner(r);
|
|
12721
13290
|
const inChatScope = hasChatOwner && requestMatchesChatScope(r);
|
|
12722
13291
|
const chatLabel = `${label}${owner ? ` for ${owner}` : ''}`;
|
|
12723
13292
|
const hasLinkedChat = Boolean(r.chatConversation?.chatId);
|
|
12724
|
-
|
|
12725
|
-
|
|
13293
|
+
// #2185: "Work on it" is the one button that puts the AI to work - in THIS request's own conversation, never in whatever
|
|
13294
|
+
// chat happens to be open. A conversation that has only been opened (Discuss) owns nothing yet, so it still starts.
|
|
13295
|
+
// What a chat can do is the server's verdict (`chatCanStart`), not the background-run policy.
|
|
13296
|
+
const canWorkOnIt = Boolean(chatProvider && inChatScope && !filterGuide && !discardQuestion
|
|
13297
|
+
&& r.status === 'pending' && r.chatCanStart !== false
|
|
13298
|
+
&& (!chatExecutionOwner || chatExecutionOwner === 'discussion')
|
|
13299
|
+
&& !inFlight && !desktopHandoffs && !resumeCommand && !revisionReadHasTerminalOwner(r));
|
|
13300
|
+
// Read-only: opens the conversation that already holds this request (or, if none can start it, says what it would be).
|
|
13301
|
+
const discussBtn = chatProvider && inChatScope && !discardQuestion && !canWorkOnIt
|
|
13302
|
+
? `<button class="req-chat-action" data-request-chat="discuss" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-discuss#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" aria-label="${hasLinkedChat ? 'Open the chat for' : 'Discuss'} ${escapeAttr(chatLabel)} in AI Chat" data-tip="${hasLinkedChat ? 'Open the conversation that holds this request' : 'Open this request in AI Chat. Nothing runs'}">${hasLinkedChat ? 'Open chat' : 'Discuss in AI Chat'}</button>`
|
|
12726
13303
|
: '';
|
|
12727
13304
|
const starting = requestChatStarts.get(r.id)?.label;
|
|
12728
|
-
const startChatBtn =
|
|
12729
|
-
? `<button class="req-chat-action primary" data-request-chat="start" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-start-chat#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" aria-label="
|
|
13305
|
+
const startChatBtn = canWorkOnIt
|
|
13306
|
+
? `<button class="req-chat-action primary" data-request-chat="start" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-start-chat#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" aria-label="Work on ${escapeAttr(chatLabel)} in AI Chat" data-tip="The AI starts on this now, in this request’s own conversation in AI Chat"${starting ? ' disabled aria-busy="true"' : ''}>${escapeHtml(starting || 'Work on it')}</button>`
|
|
12730
13307
|
: '';
|
|
12731
13308
|
const chatMeta = discardQuestion ? '' : chatProvider && inChatScope
|
|
12732
13309
|
? `<span class="req-chat-meta">AI Chat · ${escapeHtml(runtimeLabel(chatProvider))} · ${r.type === 'guide' || (r.type === 'tweak-contract' && r.mode === 'query') ? 'Read only' : 'Auto'}</span>`
|
|
12733
13310
|
: chatProvider && hasChatOwner
|
|
12734
|
-
? `<span class="req-chat-elsewhere" data-tip="
|
|
13311
|
+
? `<span class="req-chat-elsewhere" data-tip="${escapeAttr(requestChatScopeReason(r))}">${escapeHtml(requestChatScopeReason(r))}</span>`
|
|
12735
13312
|
: '';
|
|
12736
13313
|
return `
|
|
12737
13314
|
<div class="req-item" data-id="${escapeAttr(r.id)}">
|
|
@@ -12756,7 +13333,7 @@
|
|
|
12756
13333
|
${discussBtn}
|
|
12757
13334
|
${runBtn}
|
|
12758
13335
|
${desktopHandoffs || resumeCommand || !requestCanCopy(r) ? '' : `<button class="req-copy" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-copy#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" data-tip="${r.preparationRetryable ? 'Copy this retry request for your terminal AI' : 'Copy this request for your terminal AI'}" aria-label="${r.preparationRetryable ? 'Copy retry request' : 'Copy this request for your terminal AI'}">⧉</button>`}
|
|
12759
|
-
${discardQuestion ? '' : del
|
|
13336
|
+
${discardQuestion ? '' : del}
|
|
12760
13337
|
${startChatBtn}
|
|
12761
13338
|
</div>
|
|
12762
13339
|
</div>`;
|
|
@@ -12781,12 +13358,19 @@
|
|
|
12781
13358
|
const endStart = () => {
|
|
12782
13359
|
if (startEntry && requestChatStarts.get(request.id) === startEntry) requestChatStarts.delete(request.id);
|
|
12783
13360
|
};
|
|
13361
|
+
// #2199: this start clears the line where it goes stale (it went through, or was cancelled) — but only while the
|
|
13362
|
+
// line is still its own: it tags what it writes, and the text must be unchanged too. Never on opening Requests:
|
|
13363
|
+
// another start (even one showing the same words) or a wait owns its own line.
|
|
12784
13364
|
const actionStatus = document.getElementById('requests-action-status');
|
|
12785
|
-
|
|
13365
|
+
const mine = {};
|
|
13366
|
+
let said = null;
|
|
13367
|
+
const say = (text) => { if (actionStatus) { actionStatus.textContent = said = text; actionStatus.__statusOwner = mine; } };
|
|
13368
|
+
const unsay = () => { if (actionStatus?.__statusOwner === mine && actionStatus.textContent === said) actionStatus.textContent = ''; };
|
|
13369
|
+
say(`${button.textContent} ${requestLabel(request)} for ${requestOwnerName(request)}.`);
|
|
12786
13370
|
let settingUp = false;
|
|
12787
13371
|
const slowTimer = setTimeout(() => {
|
|
12788
13372
|
if (!settingUp && button.disabled && button.isConnected && actionStatus) {
|
|
12789
|
-
|
|
13373
|
+
say(`Still opening ${requestLabel(request)} in AI Chat… FloLess is taking longer than expected.`);
|
|
12790
13374
|
}
|
|
12791
13375
|
}, 4000);
|
|
12792
13376
|
const requestsModal = document.getElementById('requests-modal');
|
|
@@ -12796,6 +13380,7 @@
|
|
|
12796
13380
|
|| !pendingRequests.some((candidate) => candidate && candidate.id === request.id && candidate.status === 'pending');
|
|
12797
13381
|
try {
|
|
12798
13382
|
await startRequestChatWithSetup(request.id, provider, starting ? 'start' : 'discuss', {
|
|
13383
|
+
ownChat: starting,
|
|
12799
13384
|
isCancelled: cancelled,
|
|
12800
13385
|
// FloLess is installing its own copy of this AI first (#1607): say so, once per state.
|
|
12801
13386
|
onSetup: (status) => {
|
|
@@ -12806,13 +13391,20 @@
|
|
|
12806
13391
|
// The list may have been repainted meanwhile: label whichever button shows this Request now.
|
|
12807
13392
|
const live = $list.querySelector(`[data-request-chat="start"][data-id="${CSS.escape(request.id)}"]`);
|
|
12808
13393
|
if (live) live.textContent = label;
|
|
12809
|
-
if (actionStatus && (!settingUp || actionStatus.textContent !== text))
|
|
13394
|
+
if (actionStatus && (!settingUp || actionStatus.textContent !== text)) say(text);
|
|
12810
13395
|
settingUp = true;
|
|
12811
13396
|
},
|
|
12812
13397
|
});
|
|
13398
|
+
unsay();
|
|
12813
13399
|
closeRequests();
|
|
12814
13400
|
} catch (error) {
|
|
12815
|
-
if (error?.code === 'chat-start-cancelled') return;
|
|
13401
|
+
if (error?.code === 'chat-start-cancelled') { unsay(); return; }
|
|
13402
|
+
// #2185: it was set aside (dismissed in another window, or expired) after this list was painted - ask, never only fail.
|
|
13403
|
+
if (starting && REQUEST_SET_ASIDE_CODES.has(String(error?.code || ''))) {
|
|
13404
|
+
if (actionStatus) actionStatus.textContent = '';
|
|
13405
|
+
void askRestoreAndStart(request, provider, error.code);
|
|
13406
|
+
return;
|
|
13407
|
+
}
|
|
12816
13408
|
// #2061: the project is busy — ask (wait and start by itself / open it / stop it), never only "failed".
|
|
12817
13409
|
if (starting && REQUEST_START_BUSY_CODES.has(String(error?.code || '')) && error?.holder) {
|
|
12818
13410
|
if (actionStatus) actionStatus.textContent = '';
|
|
@@ -12974,7 +13566,12 @@
|
|
|
12974
13566
|
} catch (e) { reportErr(e); }
|
|
12975
13567
|
};
|
|
12976
13568
|
});
|
|
12977
|
-
$list.querySelectorAll('.req-del').forEach((b) => {
|
|
13569
|
+
$list.querySelectorAll('.req-del').forEach((b) => {
|
|
13570
|
+
b.onclick = () => {
|
|
13571
|
+
const request = pendingRequests.find((candidate) => candidate && candidate.id === b.dataset.id);
|
|
13572
|
+
if (request) void dismissQueuedRequest(request);
|
|
13573
|
+
};
|
|
13574
|
+
});
|
|
12978
13575
|
wireDiscardRecordQuestions($list);
|
|
12979
13576
|
$list.querySelectorAll('.req-thumb').forEach((b) => {
|
|
12980
13577
|
b.onclick = () => window.open(`/api/requests/${encodeURIComponent(b.dataset.id)}/snapshot/${b.dataset.n}`, '_blank');
|
|
@@ -14464,7 +15061,7 @@
|
|
|
14464
15061
|
completeReportDiscovery.set(id, { ...result, checking: false });
|
|
14465
15062
|
if (viewingScheduledReportRoutine === id && $reportModal.classList.contains('show')
|
|
14466
15063
|
&& currentId === r.workflow && result.report && !reportRunning) {
|
|
14467
|
-
await paintCompleteReport(completeReportViewerShape(result.report, scheduledReportCaption(result))
|
|
15064
|
+
await paintCompleteReport(completeReportViewerShape(result.report, scheduledReportCaption(result)));
|
|
14468
15065
|
}
|
|
14469
15066
|
if ($routinesModal.classList.contains('show')) renderRoutinesList();
|
|
14470
15067
|
return result;
|
|
@@ -14557,7 +15154,7 @@
|
|
|
14557
15154
|
$reportTitle.textContent = `HTML Viewer · ${apps.get(r.workflow)?.displayName || r.workflow}`;
|
|
14558
15155
|
showModal($reportModal);
|
|
14559
15156
|
$reportClose.focus();
|
|
14560
|
-
await paintCompleteReport(completeReportViewerShape(state.report, scheduledReportCaption(state))
|
|
15157
|
+
await paintCompleteReport(completeReportViewerShape(state.report, scheduledReportCaption(state)));
|
|
14561
15158
|
}
|
|
14562
15159
|
// Why a second start is refused, in the user's words. Said identically by the greyed ▶ (tip + `?`)
|
|
14563
15160
|
// and by the toast when a click races ahead of the repaint. "or waiting its turn" is not padding:
|
|
@@ -14735,7 +15332,11 @@
|
|
|
14735
15332
|
if (!run) return '';
|
|
14736
15333
|
const lives = run.targets.map((t) => t.live);
|
|
14737
15334
|
const declined = run.targets.reduce((sum, t) => sum + (t.declines ? t.declines.list.filter((d) => d.state === 'declined').length + t.declines.moreDeclined : 0), 0);
|
|
14738
|
-
|
|
15335
|
+
// #2223: an AI question nobody was there to answer is not a declined step; the AI went on with an assumption.
|
|
15336
|
+
const assumed = run.targets.reduce((sum, t) => sum + (t.declines ? t.declines.list.filter((d) => d.state === 'assumed').length + (t.declines.moreAssumed || 0) : 0), 0);
|
|
15337
|
+
const notes = [declined ? `${declined} step${declined === 1 ? '' : 's'} declined` : '',
|
|
15338
|
+
assumed ? `${assumed} question${assumed === 1 ? '' : 's'} went on without your answer` : ''].filter(Boolean);
|
|
15339
|
+
const tail = notes.length ? ` · ${notes.join(' · ')} — see Questions for you on the Agents page` : '';
|
|
14739
15340
|
// #2122: every live state has a deliberate summary; only a run whose every part finished (or was skipped up front)
|
|
14740
15341
|
// says Done, and a state this list does not know yet reads as needing a look — never as Done.
|
|
14741
15342
|
// Most urgent first: the person is being asked something, then work still going, then work that stopped short.
|
|
@@ -14835,6 +15436,25 @@
|
|
|
14835
15436
|
// report HTML actually changed (e.g. an exception-monitor flips from "all clear" to
|
|
14836
15437
|
// "exception detected"). Never auto-opens the viewer, never hijacks another app's open
|
|
14837
15438
|
// viewer, never stomps an in-flight manual run or a live foreground session.
|
|
15439
|
+
// #2247: a run started by a FloLess action (a chat's confirmed card, or a terminal) made a report. No browser
|
|
15440
|
+
// request was waiting on that run, so the server hands the report here. Cache it as this workflow's last report —
|
|
15441
|
+
// "View report" and the card's button then show it — and repaint only when this workflow's viewer is already open
|
|
15442
|
+
// and idle. Never auto-opens the viewer and never stomps a run started here.
|
|
15443
|
+
function applyActionRunReport(m) {
|
|
15444
|
+
if (!m || typeof m.workflow !== 'string' || typeof m.html !== 'string') return;
|
|
15445
|
+
const interactive = m.interactive === true;
|
|
15446
|
+
const savedPath = typeof m.savedPath === 'string' ? m.savedPath : '';
|
|
15447
|
+
const fromChat = m.from !== 'terminal';
|
|
15448
|
+
lastReportByApp.set(m.workflow, { nodeId: m.nodeId || null, label: fromChat ? 'from AI Chat' : 'from a terminal', html: m.html, interactive, savedPath,
|
|
15449
|
+
runId: typeof m.runId === 'string' ? m.runId : null });
|
|
15450
|
+
const open = $reportModal && $reportModal.classList.contains('show');
|
|
15451
|
+
if (!open || currentId !== m.workflow || reportRunning) return;
|
|
15452
|
+
paintReport(m.html, interactive);
|
|
15453
|
+
$reportSub.textContent = fromChat ? 'Report from the run you confirmed in AI Chat — rendered from the run\'s output, never composed by the UI.'
|
|
15454
|
+
: 'Report from a run started in a terminal — rendered from the run\'s output, never composed by the UI.';
|
|
15455
|
+
showSavedPathActions(savedPath);
|
|
15456
|
+
}
|
|
15457
|
+
|
|
14838
15458
|
function applyRoutineReport(m) {
|
|
14839
15459
|
if (!m || !m.workflow || typeof m.html !== 'string') return;
|
|
14840
15460
|
const prev = lastReportByApp.get(m.workflow);
|
|
@@ -14885,6 +15505,371 @@
|
|
|
14885
15505
|
return host;
|
|
14886
15506
|
}
|
|
14887
15507
|
|
|
15508
|
+
// ── #2228: live progress of a long run ─────────────────────────────────────────────────────────
|
|
15509
|
+
// A long node (a Blender animation, a big model read) runs for minutes inside one run. The server
|
|
15510
|
+
// relays AWARE's node-progress records (`run-live` → `node-progress`… → `run-finished`), keyed by the
|
|
15511
|
+
// token this tab minted for its Run click, and the view in web/run-strip.js says what is happening.
|
|
15512
|
+
// An ordinary Run shows it in the strip over the canvas; a report Run shows it in the report overlay
|
|
15513
|
+
// under the working Flo. The token is kept in sessionStorage so a reload finds its run again.
|
|
15514
|
+
const $runStrip = document.getElementById('run-strip');
|
|
15515
|
+
const RUN_TOKEN_KEY = 'floless.run.token';
|
|
15516
|
+
const RUN_STRIP_DELAY_MS = 2000;
|
|
15517
|
+
const RUN_STRIP_LINGER_MS = 6000;
|
|
15518
|
+
// A reload or a closed tab aborts the in-flight Run request, and its catch/finally would settle the strip and
|
|
15519
|
+
// forget the token — which is exactly what a reload needs to find its run again. The run goes on on the server.
|
|
15520
|
+
let pageLeaving = false;
|
|
15521
|
+
window.addEventListener('pagehide', () => { pageLeaving = true; });
|
|
15522
|
+
window.addEventListener('pageshow', () => { pageLeaving = false; });
|
|
15523
|
+
|
|
15524
|
+
function newRunToken() {
|
|
15525
|
+
try { if (window.crypto && typeof crypto.randomUUID === 'function') return crypto.randomUUID(); } catch { /* fall through */ }
|
|
15526
|
+
return `run-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
15527
|
+
}
|
|
15528
|
+
function rememberRunToken(appId, token) {
|
|
15529
|
+
try { sessionStorage.setItem(RUN_TOKEN_KEY, JSON.stringify({ appId, token })); } catch { /* private mode */ }
|
|
15530
|
+
}
|
|
15531
|
+
function forgetRunToken(token) {
|
|
15532
|
+
try {
|
|
15533
|
+
const saved = JSON.parse(sessionStorage.getItem(RUN_TOKEN_KEY) || 'null');
|
|
15534
|
+
if (!token || (saved && saved.token === token)) sessionStorage.removeItem(RUN_TOKEN_KEY);
|
|
15535
|
+
} catch { /* private mode */ }
|
|
15536
|
+
}
|
|
15537
|
+
|
|
15538
|
+
function clearNodeProgress() {
|
|
15539
|
+
document.querySelectorAll('.agent-card.has-progress').forEach((card) => {
|
|
15540
|
+
card.classList.remove('has-progress');
|
|
15541
|
+
card.style.removeProperty('--node-progress');
|
|
15542
|
+
});
|
|
15543
|
+
}
|
|
15544
|
+
function setNodeProgress(nodeId, rec) {
|
|
15545
|
+
if (!nodeId || typeof rec.total !== 'number' || rec.total <= 0 || typeof rec.done !== 'number') return;
|
|
15546
|
+
const card = document.querySelector(`.agent-card[data-agent-id="${(window.CSS && CSS.escape) ? CSS.escape(nodeId) : nodeId}"]`);
|
|
15547
|
+
if (!card || !card.classList.contains('node-running')) return;
|
|
15548
|
+
card.classList.add('has-progress');
|
|
15549
|
+
card.style.setProperty('--node-progress', String(Math.max(0, Math.min(1, rec.done / rec.total))));
|
|
15550
|
+
}
|
|
15551
|
+
|
|
15552
|
+
// Stop from the strip: the same Stop as the header when this tab started the run; after a reload the
|
|
15553
|
+
// tab no longer holds the request, so it asks the server to stop that request by its identity (which the
|
|
15554
|
+
// progress snapshot handed back) — the run's own route ends it.
|
|
15555
|
+
function stopLiveRun() {
|
|
15556
|
+
if (state.running || reportRunning) { stopRun(); return; }
|
|
15557
|
+
const runRequestId = liveRun && liveRun.runRequestId;
|
|
15558
|
+
// On success the run-finished event settles the strip; a stop that never reached the server must say so.
|
|
15559
|
+
api('/api/run/stop', { method: 'POST', body: JSON.stringify(runRequestId ? { runRequestId } : {}) }).catch(() => {
|
|
15560
|
+
// Stop disabled itself on click; a stop that did not land must be pressable again.
|
|
15561
|
+
const btn = liveRun && liveRun.view && liveRun.view.root.querySelector('[data-command-id="workflow.run-strip-stop"]');
|
|
15562
|
+
if (btn) { btn.disabled = false; btn.textContent = '■ Stop run'; }
|
|
15563
|
+
showToast('FloLess didn’t confirm the stop. If the strip keeps counting, the run is still going — press Stop again.', 'warn');
|
|
15564
|
+
});
|
|
15565
|
+
}
|
|
15566
|
+
|
|
15567
|
+
function syncRunStrip() {
|
|
15568
|
+
if (!$runStrip) return;
|
|
15569
|
+
const show = !!(liveRun && liveRun.surface === 'strip' && liveRun.view && liveRun.shown && liveRun.appId === currentId);
|
|
15570
|
+
$runStrip.hidden = !show;
|
|
15571
|
+
syncRunControls();
|
|
15572
|
+
}
|
|
15573
|
+
|
|
15574
|
+
function mountStripView(startedAt) {
|
|
15575
|
+
if (!liveRun || liveRun.view || !$runStrip || !window.flolessRunProgressView) return;
|
|
15576
|
+
$runStrip.classList.remove('rp-leaving');
|
|
15577
|
+
$runStrip.replaceChildren();
|
|
15578
|
+
liveRun.view = window.flolessRunProgressView.create({
|
|
15579
|
+
size: 28,
|
|
15580
|
+
hat: false,
|
|
15581
|
+
startedAt,
|
|
15582
|
+
fallbackHeadline: 'Working on your workflow…',
|
|
15583
|
+
stop: liveRun.owner ? { onClick: stopLiveRun, commandId: 'workflow.run-strip-stop' } : null,
|
|
15584
|
+
});
|
|
15585
|
+
$runStrip.append(liveRun.view.root);
|
|
15586
|
+
}
|
|
15587
|
+
|
|
15588
|
+
function showRunStrip() {
|
|
15589
|
+
if (!liveRun || liveRun.surface !== 'strip' || liveRun.ended) return;
|
|
15590
|
+
if (liveRun.showTimer) { clearTimeout(liveRun.showTimer); liveRun.showTimer = null; }
|
|
15591
|
+
mountStripView(liveRun.startedAt);
|
|
15592
|
+
liveRun.shown = true;
|
|
15593
|
+
syncRunStrip();
|
|
15594
|
+
}
|
|
15595
|
+
|
|
15596
|
+
function disposeLiveRun() {
|
|
15597
|
+
if (!liveRun) return;
|
|
15598
|
+
if (liveRun.showTimer) clearTimeout(liveRun.showTimer);
|
|
15599
|
+
if (liveRun.lingerTimer) clearTimeout(liveRun.lingerTimer);
|
|
15600
|
+
if (liveRun.view) liveRun.view.destroy();
|
|
15601
|
+
if (liveRun.surface === 'strip' && $runStrip) { $runStrip.replaceChildren(); $runStrip.hidden = true; $runStrip.classList.remove('rp-leaving'); }
|
|
15602
|
+
liveRun = null;
|
|
15603
|
+
}
|
|
15604
|
+
|
|
15605
|
+
/**
|
|
15606
|
+
* Begin watching a run this tab is about to start. surface: 'strip' (ordinary Run) or 'overlay' (a
|
|
15607
|
+
* report Run, whose overlay hosts the view). Returns the token to send with the POST.
|
|
15608
|
+
*/
|
|
15609
|
+
function beginLiveRun(appId, surface, overlayHost, fallbackHeadline) {
|
|
15610
|
+
disposeLiveRun();
|
|
15611
|
+
const token = newRunToken();
|
|
15612
|
+
rememberRunToken(appId, token);
|
|
15613
|
+
liveRun = { appId, token, runId: null, owner: true, surface, view: null, shown: false, showTimer: null, lingerTimer: null, ended: false, startedAt: Date.now() };
|
|
15614
|
+
if (surface === 'overlay' && overlayHost && window.flolessRunProgressView) {
|
|
15615
|
+
liveRun.view = window.flolessRunProgressView.create({ size: 40, hat: true, fallbackHeadline, stop: null });
|
|
15616
|
+
overlayHost.append(liveRun.view.root);
|
|
15617
|
+
} else if (surface === 'strip') {
|
|
15618
|
+
// Only a run that lasts: a quick one finishes before the strip would appear, so it never flashes.
|
|
15619
|
+
liveRun.showTimer = setTimeout(showRunStrip, RUN_STRIP_DELAY_MS);
|
|
15620
|
+
}
|
|
15621
|
+
return token;
|
|
15622
|
+
}
|
|
15623
|
+
|
|
15624
|
+
function liveRunOwns(m) {
|
|
15625
|
+
if (!liveRun || liveRun.ended) return false;
|
|
15626
|
+
if (m.clientRunToken && m.clientRunToken === liveRun.token) return true;
|
|
15627
|
+
return !!(m.runId && liveRun.runId && m.runId === liveRun.runId);
|
|
15628
|
+
}
|
|
15629
|
+
|
|
15630
|
+
function onLiveProgress(m) {
|
|
15631
|
+
if (!liveRun) return;
|
|
15632
|
+
if (m.runId && !liveRun.runId) liveRun.runId = m.runId;
|
|
15633
|
+
if (liveRun.surface === 'strip' && !liveRun.shown) showRunStrip();
|
|
15634
|
+
if (liveRun.view) liveRun.view.apply(m);
|
|
15635
|
+
if (liveRun.appId === currentId) setNodeProgress(m.node, m);
|
|
15636
|
+
}
|
|
15637
|
+
|
|
15638
|
+
/** outcome: 'ok' | 'failed' | 'stopped' | 'not-run'. Idempotent — the SSE event and the POST both call it. */
|
|
15639
|
+
// #2230: the videos a run rendered, as the server named them (opaque ids, never a path to fetch).
|
|
15640
|
+
function runVideos(res) {
|
|
15641
|
+
return res && Array.isArray(res.media) ? res.media.filter((m) => m && m.kind === 'video' && typeof m.url === 'string') : [];
|
|
15642
|
+
}
|
|
15643
|
+
function watchRunVideos(videos, sub) {
|
|
15644
|
+
if (!videos.length || !window.flolessMediaPlayer) return;
|
|
15645
|
+
window.flolessMediaPlayer.open({ items: videos, sub });
|
|
15646
|
+
}
|
|
15647
|
+
|
|
15648
|
+
/**
|
|
15649
|
+
* A finished run rendered a video: the strip stays (no fade) with Watch as its one primary action, until
|
|
15650
|
+
* the person watches it, dismisses it, or starts another run. A run quick enough never to have shown the
|
|
15651
|
+
* strip shows it now, already finished.
|
|
15652
|
+
*/
|
|
15653
|
+
function offerRunVideos(appId, videos) {
|
|
15654
|
+
if (!videos.length || !$runStrip || !window.flolessRunProgressView) return;
|
|
15655
|
+
const appName = (apps.get(appId) && apps.get(appId).displayName) || appId;
|
|
15656
|
+
let run = liveRun && liveRun.appId === appId && liveRun.surface === 'strip' ? liveRun : null;
|
|
15657
|
+
if (!run || !run.view) {
|
|
15658
|
+
disposeLiveRun();
|
|
15659
|
+
liveRun = { appId, token: null, runId: null, owner: true, surface: 'strip', view: null, shown: false, showTimer: null, lingerTimer: null, ended: false, startedAt: Date.now() };
|
|
15660
|
+
showRunStrip();
|
|
15661
|
+
run = liveRun;
|
|
15662
|
+
run.view.finish('ok');
|
|
15663
|
+
run.ended = true;
|
|
15664
|
+
// It never showed while running, so there is no honest duration to state here.
|
|
15665
|
+
const head = run.view.root.querySelector('.rp-headline');
|
|
15666
|
+
if (head) head.textContent = 'Finished';
|
|
15667
|
+
}
|
|
15668
|
+
if (run.lingerTimer) { clearTimeout(run.lingerTimer); run.lingerTimer = null; }
|
|
15669
|
+
if ($runStrip) $runStrip.classList.remove('rp-leaving');
|
|
15670
|
+
const detail = run.view.root.querySelector('.rp-detail');
|
|
15671
|
+
if (detail) { detail.textContent = videos.length === 1 ? 'Video ready' : `${videos.length} videos ready`; detail.hidden = false; }
|
|
15672
|
+
const actions = run.view.root.querySelector('.rp-actions');
|
|
15673
|
+
if (!actions || actions.querySelector('.rp-watch')) return;
|
|
15674
|
+
const watch = mkEl('button', 'rp-watch', videos.length === 1 ? '▶ Watch video' : `▶ Watch videos (${videos.length})`);
|
|
15675
|
+
watch.type = 'button';
|
|
15676
|
+
watch.dataset.commandId = 'workflow.run-strip-watch';
|
|
15677
|
+
watch.onclick = () => {
|
|
15678
|
+
watchRunVideos(videos, `Rendered by ${appName}`);
|
|
15679
|
+
watch.textContent = '▶ Watch again';
|
|
15680
|
+
};
|
|
15681
|
+
const dismiss = mkEl('button', 'rp-dismiss', 'Dismiss');
|
|
15682
|
+
dismiss.type = 'button';
|
|
15683
|
+
dismiss.dataset.commandId = 'workflow.run-strip-dismiss';
|
|
15684
|
+
dismiss.onclick = () => { if (liveRun === run) disposeLiveRun(); };
|
|
15685
|
+
actions.append(watch, dismiss);
|
|
15686
|
+
run.shown = true;
|
|
15687
|
+
syncRunStrip();
|
|
15688
|
+
}
|
|
15689
|
+
|
|
15690
|
+
function finishLiveRun(outcome) {
|
|
15691
|
+
if (pageLeaving) return; // the page is going away mid-run: keep the token so the next page resumes it
|
|
15692
|
+
if (!liveRun || liveRun.ended) return;
|
|
15693
|
+
const run = liveRun;
|
|
15694
|
+
run.ended = true;
|
|
15695
|
+
forgetRunToken(run.token);
|
|
15696
|
+
syncRunControls();
|
|
15697
|
+
if (run.showTimer) { clearTimeout(run.showTimer); run.showTimer = null; }
|
|
15698
|
+
clearNodeProgress();
|
|
15699
|
+
if (run.surface === 'overlay') {
|
|
15700
|
+
// The overlay's own result (the report, or the failure card) replaces it.
|
|
15701
|
+
if (run.view) run.view.destroy();
|
|
15702
|
+
liveRun = null;
|
|
15703
|
+
return;
|
|
15704
|
+
}
|
|
15705
|
+
if (!run.shown) { disposeLiveRun(); return; } // a quick run never showed a strip — nothing to settle
|
|
15706
|
+
run.view.finish(outcome);
|
|
15707
|
+
if (outcome === 'ok') {
|
|
15708
|
+
run.lingerTimer = setTimeout(() => {
|
|
15709
|
+
if (liveRun !== run) return;
|
|
15710
|
+
if ($runStrip) $runStrip.classList.add('rp-leaving');
|
|
15711
|
+
setTimeout(() => { if (liveRun === run) disposeLiveRun(); }, 160);
|
|
15712
|
+
}, RUN_STRIP_LINGER_MS);
|
|
15713
|
+
return;
|
|
15714
|
+
}
|
|
15715
|
+
// Failed or stopped: it stays until dismissed or the next run. The failure's own details live in the
|
|
15716
|
+
// Execution tab; the strip carries one line and the way there.
|
|
15717
|
+
const actions = run.view.root.querySelector('.rp-actions');
|
|
15718
|
+
if (actions) {
|
|
15719
|
+
if (outcome === 'failed') {
|
|
15720
|
+
const see = mkEl('button', 'rp-link', 'See what happened');
|
|
15721
|
+
see.type = 'button';
|
|
15722
|
+
see.dataset.commandId = 'workflow.run-strip-details';
|
|
15723
|
+
see.onclick = () => switchToExecution();
|
|
15724
|
+
actions.append(see);
|
|
15725
|
+
}
|
|
15726
|
+
const dismiss = mkEl('button', 'rp-dismiss', 'Dismiss');
|
|
15727
|
+
dismiss.type = 'button';
|
|
15728
|
+
dismiss.dataset.commandId = 'workflow.run-strip-dismiss';
|
|
15729
|
+
dismiss.onclick = () => { if (liveRun === run) disposeLiveRun(); };
|
|
15730
|
+
actions.append(dismiss);
|
|
15731
|
+
}
|
|
15732
|
+
}
|
|
15733
|
+
|
|
15734
|
+
/**
|
|
15735
|
+
* The Run request failed with NO answer — the page is reloading, or the connection dropped. That says nothing
|
|
15736
|
+
* about the run, which goes on on the server: keep the token, and ask the server where the run is instead of
|
|
15737
|
+
* declaring it failed.
|
|
15738
|
+
*/
|
|
15739
|
+
function settleLiveRunWithoutAnswer() {
|
|
15740
|
+
if (!liveRun || liveRun.ended) return;
|
|
15741
|
+
liveRun.owner = false; // this tab no longer holds the request; Stop goes through the server (stopLiveRun)
|
|
15742
|
+
setTimeout(() => { void resyncLiveRun(); }, 1500);
|
|
15743
|
+
}
|
|
15744
|
+
|
|
15745
|
+
/** Another tab (or the terminal) started a run of the workflow this tab shows: follow it, without Stop. */
|
|
15746
|
+
function observeLiveRun(m) {
|
|
15747
|
+
if (liveRun && !liveRun.ended) return;
|
|
15748
|
+
disposeLiveRun();
|
|
15749
|
+
liveRun = { appId: m.id, token: m.clientRunToken || null, runId: m.runId || null, owner: false, surface: 'strip', view: null, shown: false, showTimer: null, lingerTimer: null, ended: false, startedAt: typeof m.startedAt === 'number' ? m.startedAt : Date.now() };
|
|
15750
|
+
liveRun.showTimer = setTimeout(showRunStrip, RUN_STRIP_DELAY_MS);
|
|
15751
|
+
}
|
|
15752
|
+
|
|
15753
|
+
// ── live-run resync (begin) — lifted whole by server/run-strip-ui.test.ts; keep it self-contained.
|
|
15754
|
+
// After a reload or an SSE reconnect: is the run this tab started still going? Resume its strip — or, when it
|
|
15755
|
+
// ended while this tab could not hear it, settle the strip with how it ended (the server remembers that for a
|
|
15756
|
+
// while), so it never ticks on with Run held off. One question at a time: a reconnect and a lost Run answer
|
|
15757
|
+
// can both ask, and they share the one in flight and the one retry timer.
|
|
15758
|
+
let resyncBusy = false;
|
|
15759
|
+
let resyncAgain = false; // asked for while one was in flight: ask once more, fresh, when it settles
|
|
15760
|
+
// The backoff belongs to one run (its token): a reconnect for the same run never restarts it or asks early.
|
|
15761
|
+
let resyncRetry = { token: null, attempt: 0, timer: null };
|
|
15762
|
+
|
|
15763
|
+
function savedRunToken() {
|
|
15764
|
+
try {
|
|
15765
|
+
const saved = JSON.parse(sessionStorage.getItem(RUN_TOKEN_KEY) || 'null');
|
|
15766
|
+
return saved && typeof saved.token === 'string' ? saved : null;
|
|
15767
|
+
} catch { return null; /* private mode */ }
|
|
15768
|
+
}
|
|
15769
|
+
|
|
15770
|
+
/** What a tab that reloaded is told when its run ended while it was away and rendered nothing to watch. */
|
|
15771
|
+
function endedWhileAwayText(outcome) {
|
|
15772
|
+
if (outcome === 'ok') return 'Your workflow finished while the page was reloading.';
|
|
15773
|
+
if (outcome === 'unknown') return 'The run you started has ended, but FloLess can no longer tell how it went (it may have restarted). Run it again if its result is missing.';
|
|
15774
|
+
if (outcome === 'stopped') return 'Your workflow was stopped while the page was reloading.';
|
|
15775
|
+
if (outcome === 'not-run') return 'Your workflow didn’t run. Run it again to see why.';
|
|
15776
|
+
return 'Your workflow stopped with a problem while the page was reloading. Run it again to see what happened.';
|
|
15777
|
+
}
|
|
15778
|
+
|
|
15779
|
+
// A run followed from another tab carries no token of this tab's: ask the server about that workflow instead.
|
|
15780
|
+
// Still going → catch up on what was missed; gone → let it go quietly (it is not this tab's run to report).
|
|
15781
|
+
async function reconcileFollowedRun(saved) {
|
|
15782
|
+
const followed = liveRun;
|
|
15783
|
+
if (!followed || followed.ended || followed.owner || (saved && followed.token === saved.token)) return;
|
|
15784
|
+
let snap;
|
|
15785
|
+
try { snap = await api(`/api/run/progress?app=${encodeURIComponent(followed.appId)}`); } catch { return; }
|
|
15786
|
+
if (liveRun !== followed || followed.ended) return; // it settled, or another run began, while we asked
|
|
15787
|
+
if (snap && snap.active && (!followed.runId || !snap.runId || snap.runId === followed.runId)) {
|
|
15788
|
+
for (const rec of snap.nodes || []) onLiveProgress({ ...rec, runId: snap.runId });
|
|
15789
|
+
return;
|
|
15790
|
+
}
|
|
15791
|
+
disposeLiveRun();
|
|
15792
|
+
syncRunControls();
|
|
15793
|
+
}
|
|
15794
|
+
|
|
15795
|
+
async function resyncOnce() {
|
|
15796
|
+
const saved = savedRunToken();
|
|
15797
|
+
await reconcileFollowedRun(saved);
|
|
15798
|
+
if (!saved) return;
|
|
15799
|
+
const asked = liveRun;
|
|
15800
|
+
let snap;
|
|
15801
|
+
try { snap = await api(`/api/run/progress?token=${encodeURIComponent(saved.token)}`); }
|
|
15802
|
+
catch {
|
|
15803
|
+
// FloLess is not answering yet (a restart, a dropped connection): ask again, a little later each time. The
|
|
15804
|
+
// SSE reconnect asks once more when the server is back.
|
|
15805
|
+
if (resyncRetry.token === saved.token && resyncRetry.attempt < 4) {
|
|
15806
|
+
resyncRetry.attempt += 1;
|
|
15807
|
+
resyncRetry.timer = setTimeout(() => { resyncRetry.timer = null; void resyncLiveRun(); }, 1500 * 2 ** resyncRetry.attempt);
|
|
15808
|
+
}
|
|
15809
|
+
return;
|
|
15810
|
+
}
|
|
15811
|
+
if (resyncRetry.token === saved.token) resyncRetry.attempt = 0; // FloLess answered: a later failure starts afresh
|
|
15812
|
+
// The answer may be stale: the run's own end event settled it, or another Run started, while it was on its way.
|
|
15813
|
+
const still = savedRunToken();
|
|
15814
|
+
if (!still || still.token !== saved.token || liveRun !== asked) return;
|
|
15815
|
+
if (!snap || !snap.active) {
|
|
15816
|
+
forgetRunToken(saved.token);
|
|
15817
|
+
const outcome = snap && typeof snap.outcome === 'string' ? snap.outcome : 'unknown';
|
|
15818
|
+
const videos = runVideos(snap);
|
|
15819
|
+
if (liveRun && liveRun.token === saved.token && !liveRun.ended) {
|
|
15820
|
+
const appId = liveRun.appId;
|
|
15821
|
+
finishLiveRun(outcome);
|
|
15822
|
+
if (videos.length) offerRunVideos(appId, videos);
|
|
15823
|
+
} else if (snap && snap.ended) {
|
|
15824
|
+
// This tab reloaded, and the run ended meanwhile: say how, and offer what it rendered.
|
|
15825
|
+
if (videos.length) offerRunVideos(snap.id, videos);
|
|
15826
|
+
else showToast(endedWhileAwayText(outcome), outcome === 'ok' ? 'ok' : 'warn');
|
|
15827
|
+
} else {
|
|
15828
|
+
// This tab reloaded and FloLess no longer knows the run at all (it restarted, or the run ended long ago).
|
|
15829
|
+
// Never silent — the person started something and is owed a word on where it went.
|
|
15830
|
+
showToast(endedWhileAwayText('unknown'), 'warn');
|
|
15831
|
+
}
|
|
15832
|
+
return;
|
|
15833
|
+
}
|
|
15834
|
+
if (liveRun && liveRun.token === saved.token && !liveRun.ended) {
|
|
15835
|
+
// This tab lost the Run answer: it now stops the run by its request, which the snapshot carries.
|
|
15836
|
+
if (typeof snap.runRequestId === 'string') liveRun.runRequestId = snap.runRequestId;
|
|
15837
|
+
if (liveRun.surface === 'strip') {
|
|
15838
|
+
for (const rec of snap.nodes || []) onLiveProgress({ ...rec, runId: snap.runId });
|
|
15839
|
+
return;
|
|
15840
|
+
}
|
|
15841
|
+
// A report run's overlay belonged to a viewer that has already shown its failure: follow the run on the strip.
|
|
15842
|
+
}
|
|
15843
|
+
disposeLiveRun();
|
|
15844
|
+
liveRun = { appId: snap.id, token: saved.token, runId: snap.runId, runRequestId: typeof snap.runRequestId === 'string' ? snap.runRequestId : null, owner: true, surface: 'strip', view: null, shown: false, showTimer: null, lingerTimer: null, ended: false, startedAt: snap.startedAt };
|
|
15845
|
+
showRunStrip();
|
|
15846
|
+
for (const rec of snap.nodes || []) onLiveProgress({ ...rec, runId: snap.runId });
|
|
15847
|
+
}
|
|
15848
|
+
|
|
15849
|
+
async function resyncLiveRun() {
|
|
15850
|
+
// The question in flight may be about another run (a followed one, or an answer that turns out stale): one
|
|
15851
|
+
// asked for meanwhile is never dropped — it is asked once more, fresh, when that one settles.
|
|
15852
|
+
if (resyncBusy) { resyncAgain = true; return; }
|
|
15853
|
+
resyncBusy = true;
|
|
15854
|
+
try {
|
|
15855
|
+
// A loop, not a call to itself: however many askers queue up meanwhile, they drain one question at a time.
|
|
15856
|
+
do {
|
|
15857
|
+
resyncAgain = false;
|
|
15858
|
+
const saved = savedRunToken();
|
|
15859
|
+
const token = saved ? saved.token : null;
|
|
15860
|
+
if (resyncRetry.token !== token) {
|
|
15861
|
+
if (resyncRetry.timer) clearTimeout(resyncRetry.timer);
|
|
15862
|
+
resyncRetry = { token, attempt: 0, timer: null };
|
|
15863
|
+
}
|
|
15864
|
+
if (resyncRetry.timer) continue; // a retry for this run is already waiting its turn: it asks, not us
|
|
15865
|
+
await resyncOnce();
|
|
15866
|
+
} while (resyncAgain);
|
|
15867
|
+
} finally {
|
|
15868
|
+
resyncBusy = false;
|
|
15869
|
+
}
|
|
15870
|
+
}
|
|
15871
|
+
// ── live-run resync (end)
|
|
15872
|
+
|
|
14888
15873
|
// The trigger session errored/stopped while a "collecting…" spinner was up (a
|
|
14889
15874
|
// fire whose report never arrived) — clear it instead of spinning forever:
|
|
14890
15875
|
// revert to the last cached report if there is one, else an idle prompt.
|
|
@@ -15015,7 +16000,6 @@
|
|
|
15015
16000
|
$reportOverlay.replaceChildren();
|
|
15016
16001
|
$reportOverlay.append(
|
|
15017
16002
|
mkEl('div', null, 'Listening for events — change your selection in Tekla to generate the first report.'),
|
|
15018
|
-
Object.assign(mkEl('button', 'overlay-stop', '■ Stop run'), { type: 'button' }),
|
|
15019
16003
|
);
|
|
15020
16004
|
$reportSub.innerHTML = `<span class="live-pip" aria-hidden="true"></span>Live · listening…`;
|
|
15021
16005
|
}
|
|
@@ -16731,6 +17715,11 @@
|
|
|
16731
17715
|
const clearFocused = document.activeElement?.id === 'wf-search-clear';
|
|
16732
17716
|
const focusedDraft = document.activeElement?.closest?.('#wf-landing [data-wf-draft]')?.dataset.wfDraft || null;
|
|
16733
17717
|
const focusedRestore = document.activeElement?.closest?.('[data-wf-restore]')?.dataset.wfRestore || null;
|
|
17718
|
+
// The Archived disclosure keeps its open state across repaints (apps-changed, search, restore); focus inside it implies open.
|
|
17719
|
+
// Focus on the summary alone must NOT force it open (the person just closed it); focus on a card inside must.
|
|
17720
|
+
const keepArchivedOpen = !!$wfLanding.querySelector('.wf-archived')?.open || !!document.activeElement?.closest?.('.wf-archived > .ws-grid');
|
|
17721
|
+
const keepSearchOpened = !!$wfLanding.querySelector('.wf-archived')?.dataset.searchOpened;
|
|
17722
|
+
const archivedSummaryFocused = !!document.activeElement?.closest?.('.wf-archived > summary');
|
|
16734
17723
|
const focusedRestored = document.activeElement?.closest?.('[data-wf-restored]')?.dataset.wfRestored || null;
|
|
16735
17724
|
const esc = (s) => String(s ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
16736
17725
|
const restoredRows = wfOwned.filter((row) => row.status !== 'archived' && row.restoreRefreshState);
|
|
@@ -16797,7 +17786,9 @@
|
|
|
16797
17786
|
? yoursGroup + group('Installed', installed, both)
|
|
16798
17787
|
+ '<div class="ws-empty-note ws-search-empty" id="wf-search-empty" role="status" aria-live="polite"></div>'
|
|
16799
17788
|
: '<div class="ws-empty-note">No active workflows yet. Start with New workflow, or ask AI Chat on the left.</div>')
|
|
16800
|
-
+ (archived.length ? `<
|
|
17789
|
+
+ (archived.length ? `<details class="ws-archived wf-archived"><summary class="ws-archived-summary" data-command-id="shell.workflows-landing-archived"><span class="ws-archived-caret hd-caret" aria-hidden="true">▸</span>Archived <span class="ws-archived-count">${archived.length}</span></summary><div class="ws-grid">${archived.map(archivedCard).join('')}</div></details>` : '');
|
|
17790
|
+
if (keepArchivedOpen) { const d = $wfLanding.querySelector('.wf-archived'); if (d) { d.open = true; if (keepSearchOpened) d.dataset.searchOpened = '1'; } }
|
|
17791
|
+
if (archivedSummaryFocused) $wfLanding.querySelector('.wf-archived > summary')?.focus();
|
|
16801
17792
|
if (focusedId) $wfLanding.querySelector(`[data-wf-id="${CSS.escape(focusedId)}"]`)?.focus();
|
|
16802
17793
|
if (focusedDraft) $wfLanding.querySelector(`[data-wf-draft="${CSS.escape(focusedDraft)}"]`)?.focus();
|
|
16803
17794
|
if (focusedRestore) $wfLanding.querySelector(`[data-wf-restore="${CSS.escape(focusedRestore)}"]:not(:disabled)`)?.focus();
|
|
@@ -16824,6 +17815,18 @@
|
|
|
16824
17815
|
card.hidden = !terms.every((t) => hay.includes(t));
|
|
16825
17816
|
if (!card.hidden) shown++;
|
|
16826
17817
|
}
|
|
17818
|
+
const archivedBox = grid.closest('.wf-archived');
|
|
17819
|
+
if (archivedBox) {
|
|
17820
|
+
// The Archived disclosure counts in its summary; a search that matches opens it, an empty match hides all of it,
|
|
17821
|
+
// and clearing the search closes it again only if the search was what opened it.
|
|
17822
|
+
archivedBox.hidden = !shown;
|
|
17823
|
+
const count = archivedBox.querySelector('.ws-archived-count');
|
|
17824
|
+
if (count) count.textContent = terms.length ? `${shown} of ${cards.length}` : String(cards.length);
|
|
17825
|
+
if (terms.length && shown && !archivedBox.open) { archivedBox.open = true; archivedBox.dataset.searchOpened = '1'; }
|
|
17826
|
+
else if (!terms.length && archivedBox.dataset.searchOpened) { archivedBox.open = false; delete archivedBox.dataset.searchOpened; }
|
|
17827
|
+
shownAll += shown;
|
|
17828
|
+
continue;
|
|
17829
|
+
}
|
|
16827
17830
|
grid.hidden = !shown;
|
|
16828
17831
|
const label = grid.previousElementSibling?.classList.contains('wf-group-label') ? grid.previousElementSibling : null;
|
|
16829
17832
|
if (label) {
|
|
@@ -16969,7 +17972,8 @@
|
|
|
16969
17972
|
if (!d.hasSource) {
|
|
16970
17973
|
body = d.recompile
|
|
16971
17974
|
? 'This workflow’s file is missing. Ask the AI in this chat to write it again.'
|
|
16972
|
-
:
|
|
17975
|
+
// #2185: a next step that is true for every draft — one building in its chat, one handed to a terminal, one never started.
|
|
17976
|
+
: 'No steps yet. Build it with the AI in this workflow’s chat on the left; its steps appear here as soon as the AI saves them.';
|
|
16973
17977
|
} else {
|
|
16974
17978
|
body = d.recompile
|
|
16975
17979
|
? 'The compiled copy of this workflow is missing or no longer matches. Compile it again to run it.'
|
|
@@ -17074,6 +18078,8 @@
|
|
|
17074
18078
|
|
|
17075
18079
|
if ($wfLanding) {
|
|
17076
18080
|
$wfLanding.addEventListener('click', (event) => {
|
|
18081
|
+
// A hand toggle of Archived means the person owns its state now: clearing the search must not undo it.
|
|
18082
|
+
if (event.target.closest('.wf-archived > summary')) delete event.target.closest('.wf-archived').dataset.searchOpened;
|
|
17077
18083
|
const restore = event.target.closest('[data-wf-restore]');
|
|
17078
18084
|
if (restore) {
|
|
17079
18085
|
if (!restore.disabled) {
|
|
@@ -17118,6 +18124,8 @@
|
|
|
17118
18124
|
api,
|
|
17119
18125
|
/** #2046: the ≡ menu's New workflow, opened from a Guide suggestion with its name filled in. */
|
|
17120
18126
|
newWorkflow: (prefill) => requestNewWorkflow(prefill),
|
|
18127
|
+
// #2185: a Guide card's Build it — straight to its own conversation, no dialog.
|
|
18128
|
+
buildWorkflow: (input) => buildWorkflowInChat(input),
|
|
17121
18129
|
requestScopeLabel(projectId) {
|
|
17122
18130
|
return wsRequestScope?.kind === 'project' && wsRequestScope.project === projectId
|
|
17123
18131
|
? wsRequestScope.label : null;
|
|
@@ -17153,6 +18161,22 @@
|
|
|
17153
18161
|
showWorkflowsLanding(false);
|
|
17154
18162
|
return true;
|
|
17155
18163
|
},
|
|
18164
|
+
// #2247: open a workflow and its report viewer on the last report (a chat card's "View report"). Shows only what
|
|
18165
|
+
// the run already made; it never starts a run.
|
|
18166
|
+
async openAppReport(appId, runId) {
|
|
18167
|
+
// Only the report of THAT run: this window keeps the latest report per workflow, and a newer run (or a window
|
|
18168
|
+
// opened after the run) holds a different one or none. Say so instead of showing the wrong report.
|
|
18169
|
+
const gone = 'This window no longer holds that run\'s report: a newer run replaced it, or the window opened after it ran. Open the workflow to see its latest results.';
|
|
18170
|
+
const cached = lastReportByApp.get(appId);
|
|
18171
|
+
if (!runId || cached?.runId !== runId) throw new Error(gone);
|
|
18172
|
+
await this.openApp(appId);
|
|
18173
|
+
// Opening the workflow waits; a newer report may have arrived meanwhile. Show this run's report or nothing.
|
|
18174
|
+
if (lastReportByApp.get(appId) !== cached) throw new Error(gone);
|
|
18175
|
+
const nodeId = reportNodeId();
|
|
18176
|
+
if (!nodeId) throw new Error('This workflow has no report view, so there is nothing to open. Its results are in the workflow.');
|
|
18177
|
+
showReport(nodeId);
|
|
18178
|
+
return true;
|
|
18179
|
+
},
|
|
17156
18180
|
// #1890 PR 3b: open a FloLess-owned workflow by its id — its published app when it has one, otherwise its draft
|
|
17157
18181
|
// view — so a conversation that moved into it can be followed there. Throws a plain sentence when it is gone.
|
|
17158
18182
|
async openOwnedWorkflow(workflowId) {
|
|
@@ -17164,6 +18188,11 @@
|
|
|
17164
18188
|
showWorkflowsLanding(false);
|
|
17165
18189
|
return true;
|
|
17166
18190
|
}
|
|
18191
|
+
// #2185: a draft built a moment ago is not in the cached list yet: read it once more before saying it is gone.
|
|
18192
|
+
if (!wfOwned.some((row) => row.workflowId === workflowId)) {
|
|
18193
|
+
try { ({ workflows: wfOwned } = await api('/api/workflows/owned')); }
|
|
18194
|
+
catch { throw new Error('FloLess couldn’t load your workflows just now. Try again, or open it from the Workflows page.'); }
|
|
18195
|
+
}
|
|
17167
18196
|
if (wfOwned.some((row) => row.workflowId === workflowId && row.status !== 'archived')) {
|
|
17168
18197
|
openDraftWorkflow(workflowId);
|
|
17169
18198
|
return true;
|
|
@@ -17307,7 +18336,8 @@
|
|
|
17307
18336
|
revealAiChat() {
|
|
17308
18337
|
window.flolessLeftPane?.showSection?.('narrative');
|
|
17309
18338
|
if (state.collapse.left) {
|
|
17310
|
-
|
|
18339
|
+
// The toggle lives in the pane rail, outside the collapsed stub (#2185: the old selector matched nothing).
|
|
18340
|
+
document.querySelector('.panel-toggle[data-side="left"]')?.click();
|
|
17311
18341
|
}
|
|
17312
18342
|
},
|
|
17313
18343
|
isRequestChatBlocked(requestId) {
|