@floless/app 0.155.2 → 0.156.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/cli-actions.mjs +376 -0
- package/dist/floless-server.cjs +100135 -86559
- package/dist/skills/floless-app-actions/SKILL.md +137 -0
- package/dist/skills/floless-app-approval/SKILL.md +8 -5
- package/dist/skills/floless-app-bridge/SKILL.md +12 -9
- package/dist/skills/floless-app-knowledge/SKILL.md +30 -13
- package/dist/skills/floless-app-new-workflow/SKILL.md +4 -4
- package/dist/skills/floless-app-onboarding/SKILL.md +1 -1
- package/dist/skills/floless-app-onboarding/references/aware-runtime.md +4 -4
- package/dist/skills/floless-app-queue/SKILL.md +10 -6
- package/dist/skills/floless-app-report-issue/SKILL.md +13 -10
- package/dist/skills/floless-app-rfi/SKILL.md +59 -68
- package/dist/skills/floless-app-routines/SKILL.md +19 -14
- package/dist/skills/floless-app-routines/references/routines-api.md +8 -2
- package/dist/skills/floless-app-workflows/SKILL.md +5 -4
- package/dist/web/agent-steps.js +933 -0
- package/dist/web/agents.js +5 -0
- package/dist/web/app.css +205 -3
- package/dist/web/app.js +1 -0
- package/dist/web/aware.js +584 -44
- package/dist/web/chat.css +9 -0
- package/dist/web/chat.js +195 -13
- package/dist/web/commands-shell.js +288 -1
- package/dist/web/index.html +52 -1
- package/dist/web/instructor.js +4 -2
- package/dist/web/leave-guard.js +4 -2
- package/dist/web/left-pane.js +8 -3
- package/dist/web/model-revit-module.js +15 -0
- package/dist/web/model-viewport-revit-adapter.js +3 -1
- package/dist/web/pages.js +27 -3
- package/dist/web/panels.js +3 -3
- package/dist/web/project-reconciliation.js +357 -0
- package/dist/web/revit-editor.js +116 -27
- package/dist/web/terminal-requests.js +541 -0
- package/dist/web/tool-updates.js +147 -13
- package/dist/web/workspaces.js +213 -12
- package/launch.mjs +80 -2
- package/package.json +1 -1
package/dist/web/aware.js
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
const $reportSub = document.getElementById('report-sub');
|
|
29
29
|
const $reportOpen = document.getElementById('report-open');
|
|
30
30
|
const $reportShare = document.getElementById('report-share');
|
|
31
|
+
const $reportPage = document.getElementById('report-page');
|
|
31
32
|
const $reportOpenFile = document.getElementById('report-open-file');
|
|
32
33
|
const $reportRevealFile = document.getElementById('report-reveal-file');
|
|
33
34
|
const $reportClose = document.getElementById('report-close');
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
const $restoreBtn = document.getElementById('restore-btn');
|
|
47
48
|
const $customizeBtn = document.getElementById('customize-btn');
|
|
48
49
|
const $wfForked = document.getElementById('wf-forked');
|
|
50
|
+
const $wfAgentStep = document.getElementById('wf-agent-step');
|
|
49
51
|
|
|
50
52
|
// Contract editor — a dedicated full-window surface for an editable typed
|
|
51
53
|
// contract (steel takeoff, …). Unlike the opaque report viewer, this is a
|
|
@@ -553,8 +555,12 @@
|
|
|
553
555
|
// EXCLUDES the code (code belongs to the Code tab, never dumped here).
|
|
554
556
|
const plainDesc = execSource ? leadingComment(execSource) : '';
|
|
555
557
|
const blurbText = plainDesc && (s => s.length > 80 ? s.slice(0, 79) + '…' : s)(plainDesc.replace(/\.\s+.*/, '.').trim());
|
|
558
|
+
// #2241: an Agent step (its ANSWER is written by an AI at run time). Null for every other node. A label is a fact about the workflow,
|
|
559
|
+
// so it shows whether or not the feature is on; web/agent-steps.js builds the parts from the lock marker / source node, never invented here.
|
|
560
|
+
const aiStep = window.flolessAgentSteps?.entryParts(app, n, window.flolessAgentSteps.checkFor(app.id, n.id)) || null;
|
|
556
561
|
return {
|
|
557
562
|
_mode: n.mode,
|
|
563
|
+
_aiStep: aiStep ? { badge: aiStep.badge, attention: aiStep.attention } : null,
|
|
558
564
|
_runtimeModel: !!n.runtimeModel, // B2: lock stamped runtime-model → card badge
|
|
559
565
|
_frozen: !!n.frozen, // source node carries a `frozen:` block → card badge + Unfreeze menu
|
|
560
566
|
icon: iconFor(n.agent),
|
|
@@ -563,8 +569,8 @@
|
|
|
563
569
|
version: pin ? `v${escapeHtml(String(pin))}` : '—',
|
|
564
570
|
title: escapeHtml(n.id),
|
|
565
571
|
subtitle: `${agentLabel}${cmd ? '/' + cmd : ''} · ${mode}`,
|
|
566
|
-
blurb: blurbText ? escapeHtml(blurbText) : n.notes[0] ? escapeHtml(humanizeNote(n.notes[0].text)) : `${mode}-mode ${cmd ? '<code>' + cmd + '</code>' : escapeHtml(n.kind)} node`,
|
|
567
|
-
description: `${plainDesc ? `<p>${escapeHtml(plainDesc)}</p>` : ''}<p>Resolves to ${modeBadge} via <code>${escapeHtml(n.agent || n.kind)}${n.command ? '.' + escapeHtml(n.command) : ''}</code>.</p>${descInputs(inputs)}${execSource ? `<p class="dim-note">Full source in the <strong>Code</strong> tab.</p>` : ''}${notesHtml}`,
|
|
572
|
+
blurb: aiStep ? aiStep.blurb : blurbText ? escapeHtml(blurbText) : n.notes[0] ? escapeHtml(humanizeNote(n.notes[0].text)) : `${mode}-mode ${cmd ? '<code>' + cmd + '</code>' : escapeHtml(n.kind)} node`,
|
|
573
|
+
description: aiStep ? `${aiStep.descriptionHtml}${notesHtml}` : `${plainDesc ? `<p>${escapeHtml(plainDesc)}</p>` : ''}<p>Resolves to ${modeBadge} via <code>${escapeHtml(n.agent || n.kind)}${n.command ? '.' + escapeHtml(n.command) : ''}</code>.</p>${descInputs(inputs)}${execSource ? `<p class="dim-note">Full source in the <strong>Code</strong> tab.</p>` : ''}${notesHtml}`,
|
|
568
574
|
// Rich agent/command detail when the manifest is installed (n.skill); else
|
|
569
575
|
// the lock-pointer fallback below (exec/agent-less nodes, uninstalled agents).
|
|
570
576
|
skill: skillBody(
|
|
@@ -1302,6 +1308,16 @@
|
|
|
1302
1308
|
const maintained = app.publisher === 'floless' && !app.forked;
|
|
1303
1309
|
const drifted = app.runState === 'drift';
|
|
1304
1310
|
if ($wfForked) $wfForked.hidden = !app.forked;
|
|
1311
|
+
// #2241: text only, and only while Agents as workflow steps is on. It says what varies (one step's answer), never that the whole
|
|
1312
|
+
// workflow is non-deterministic.
|
|
1313
|
+
if ($wfAgentStep) {
|
|
1314
|
+
const aiSteps = window.flolessAgentSteps?.stepCount(app) || 0;
|
|
1315
|
+
$wfAgentStep.hidden = !aiSteps;
|
|
1316
|
+
if (aiSteps) {
|
|
1317
|
+
$wfAgentStep.textContent = window.flolessAgentSteps.headerText(aiSteps);
|
|
1318
|
+
$wfAgentStep.dataset.tip = window.flolessAgentSteps.markTip(aiSteps);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1305
1321
|
if ($customizeBtn) $customizeBtn.hidden = !maintained;
|
|
1306
1322
|
if ($restoreBtn) $restoreBtn.hidden = !(maintained && drifted);
|
|
1307
1323
|
// Suppress Compile for a maintained, drifted app: approving an out-of-band logic edit via
|
|
@@ -2146,7 +2162,31 @@
|
|
|
2146
2162
|
return false;
|
|
2147
2163
|
}
|
|
2148
2164
|
|
|
2165
|
+
// #2241: the Agent-step labels (web/agent-steps.js) learn the open workflow from here and ask for repaints when a check lands.
|
|
2166
|
+
function repaintAgentSteps(appId) {
|
|
2167
|
+
if (appId !== currentId) return;
|
|
2168
|
+
const app = apps.get(appId);
|
|
2169
|
+
if (!app) return;
|
|
2170
|
+
for (const n of app.nodes) {
|
|
2171
|
+
if (!window.flolessAgentSteps.isStepNode(n)) continue;
|
|
2172
|
+
AGENTS[n.id] = buildAgentEntry(app, n);
|
|
2173
|
+
const blurb = [...document.querySelectorAll('.agent-card')].find((card) => card.dataset.agentId === n.id)?.querySelector('.blurb');
|
|
2174
|
+
if (blurb) blurb.innerHTML = AGENTS[n.id].blurb;
|
|
2175
|
+
}
|
|
2176
|
+
if (state.selectedAgentId && AGENTS[state.selectedAgentId]?._aiStep) renderInspect();
|
|
2177
|
+
}
|
|
2178
|
+
window.flolessAgentSteps?.configure({
|
|
2179
|
+
currentApp: () => (currentId ? apps.get(currentId) || null : null),
|
|
2180
|
+
openAgent: (agentId) => { void window.flolessAgents?.open?.(agentId); },
|
|
2181
|
+
openAgents: () => { void window.flolessWorkspaces?.setMode?.('agents'); },
|
|
2182
|
+
toast: (text, kind) => showToast(text, kind),
|
|
2183
|
+
repaint: repaintAgentSteps,
|
|
2184
|
+
});
|
|
2185
|
+
|
|
2149
2186
|
async function loadApp(id) {
|
|
2187
|
+
// (globalThis, not window: this function is also lifted into a test harness that has no window; in the page they are the same object.
|
|
2188
|
+
// It never awaits the Agent-step status probe: opening a workflow must not wait on anything new, or the boot race below it gets likelier.)
|
|
2189
|
+
selectionTargetId = id;
|
|
2150
2190
|
hideSpotlight(); // a spotlight pointing at the previous app's beacon must clear on switch
|
|
2151
2191
|
const ticket = ++selectionTicket;
|
|
2152
2192
|
const payload = api(`/api/app/${encodeURIComponent(id)}`);
|
|
@@ -2171,6 +2211,7 @@
|
|
|
2171
2211
|
// loaded before this app did, so repaint it once the ownership boundary is known.
|
|
2172
2212
|
renderFavBar();
|
|
2173
2213
|
try { localStorage.setItem(LS_LAST_APP, id); } catch { /* private mode / quota */ }
|
|
2214
|
+
globalThis.flolessAgentSteps?.forgetChecks(id); // #2241: a check from an earlier open of this workflow is stale until the new one lands
|
|
2174
2215
|
transform(app);
|
|
2175
2216
|
liveTrace.length = 0;
|
|
2176
2217
|
state.promptKey = id;
|
|
@@ -2193,6 +2234,9 @@
|
|
|
2193
2234
|
refreshDirtyIndicator(); // clean app → dot off; switched back to a dirty one → dot on
|
|
2194
2235
|
renderWfUpdatePill(); // show the "↑ Update to vX" pill when THIS app has a newer published version
|
|
2195
2236
|
maybeSpotlight(app); // one-time first-open spotlight pointing at the beacon (slice 2)
|
|
2237
|
+
globalThis.flolessAgentSteps?.paintCanvasControl();
|
|
2238
|
+
void globalThis.flolessAgentSteps?.refreshChecks(app); // #2241: newer-instructions banner; a failed check says nothing
|
|
2239
|
+
void globalThis.flolessAgentSteps?.refreshRunRecord(app.id); // #2241 S5: how the last run's AI steps went, and what it left for you
|
|
2196
2240
|
}
|
|
2197
2241
|
|
|
2198
2242
|
async function waitForPublicationAvailabilityIdle() {
|
|
@@ -2231,12 +2275,22 @@
|
|
|
2231
2275
|
// leave a stale "Informed by" answer on the canvas.
|
|
2232
2276
|
function refreshCurrentWorkflow() {
|
|
2233
2277
|
const id = currentId;
|
|
2278
|
+
// #2241: an Agent may have been edited, archived or restored while another surface was open; ask again how the steps stand.
|
|
2279
|
+
if (id && apps.get(id)) void window.flolessAgentSteps?.refreshChecks(apps.get(id));
|
|
2234
2280
|
return Promise.all([
|
|
2235
2281
|
refreshCurrentWorkflowAvailability(),
|
|
2236
2282
|
refreshKbInformed(id),
|
|
2237
2283
|
]).then(() => {});
|
|
2238
2284
|
}
|
|
2239
2285
|
|
|
2286
|
+
// Bulk Compile changes the lock itself, including pins and notices. Availability alone cannot
|
|
2287
|
+
// refresh that canvas. A pending selection of another workflow always keeps the person's choice.
|
|
2288
|
+
async function reloadCompiledWorkflows(appIds) {
|
|
2289
|
+
const id = currentId;
|
|
2290
|
+
if (!id || selectionTargetId !== id || !appIds.includes(id)) return;
|
|
2291
|
+
await loadApp(id); // loadApp's selection ticket also rejects a later workflow switch
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2240
2294
|
async function loadApps({ preserveSelection = false } = {}) {
|
|
2241
2295
|
// …and mean it: the trigger said "loading…" but stayed CLICKABLE, so a click during the fetch
|
|
2242
2296
|
// opened the popover onto an empty #wf-list — the exact "picker opens and stays empty, it never
|
|
@@ -2439,6 +2493,7 @@
|
|
|
2439
2493
|
// Opening anything (a workflow or a draft) takes a new ticket; a workflow load that finishes after a newer open
|
|
2440
2494
|
// is dropped, so a slow load can never land on top of a draft opened meanwhile (#1890 PR 3b-0 review).
|
|
2441
2495
|
let selectionTicket = 0;
|
|
2496
|
+
let selectionTargetId = null;
|
|
2442
2497
|
// Each loadApps() takes a number; only the newest may change the lists or what is open.
|
|
2443
2498
|
let appsLoadGeneration = 0;
|
|
2444
2499
|
let wsTitleKind = null; // #2007: 'agents' while the Agents tab is on screen (it reuses this title/Instructor seam)
|
|
@@ -2504,6 +2559,7 @@
|
|
|
2504
2559
|
+ `<button type="button" class="wf-act act-del" data-wf-act="delete" data-command-id="workflow.delete#${escapeAttr(aid)}" data-id="${aid}" tabindex="-1" data-tip="Delete" aria-label="Delete ${escapeAttr(workflowName)}">×</button>`;
|
|
2505
2560
|
html += `<div class="wf-option" role="option" id="wf-opt-${aid}" data-id="${aid}" data-workflow-id="${escapeAttr(ownedId)}" data-workflow-name="${escapeAttr(workflowName)}" data-command-id="workflow.select#${escapeAttr(aid)}" data-baked="${a.baked ? '1' : ''}" data-search="${escapeAttr((workflowName + ' ' + a.id + ' ' + (a.ownerLabel || '') + ' ' + p).toLowerCase())}" tabindex="-1" aria-selected="false">`
|
|
2506
2561
|
+ `<span class="wf-option-name">${escapeHtml(workflowName)}</span><span class="wf-option-meta">${meta}</span>`
|
|
2562
|
+
+ (a.agentStep ? `<span class="wf-fork-badge wf-ai-badge" data-tip="A step in this workflow is answered by an AI Agent, so that answer can differ each run.">AI step</span>` : '')
|
|
2507
2563
|
+ (a.forked ? `<span class="wf-fork-badge" data-tip="You forked this workflow — it no longer receives FloLess updates. You own its output.">yours</span>` : '')
|
|
2508
2564
|
+ `<span class="wf-option-actions">`
|
|
2509
2565
|
+ actions
|
|
@@ -4054,6 +4110,118 @@
|
|
|
4054
4110
|
// double-click LOAD the last result instantly instead of re-running.
|
|
4055
4111
|
const lastReportByApp = new Map();
|
|
4056
4112
|
|
|
4113
|
+
// #2262 slice 3a: a successful real run's report is also kept as a version of its workflow's Page. The server saves
|
|
4114
|
+
// it after answering the run and says when it landed (`workflow-page-captured`), so that news can arrive before or
|
|
4115
|
+
// after the report is cached here. It is kept by run id and joined to the report of the SAME run only, never to a
|
|
4116
|
+
// newer one. `workflowPageLatest` is the newest version this window knows per workflow, for the empty viewer after
|
|
4117
|
+
// a reload; for one Page it only ever grows.
|
|
4118
|
+
const workflowPageByRun = new Map(); // runId → { app, home, pageId, version }
|
|
4119
|
+
const workflowPageLatest = new Map(); // app id → { home, pageId, version, at }
|
|
4120
|
+
const WORKFLOW_PAGE_RUNS_KEPT = 64;
|
|
4121
|
+
|
|
4122
|
+
function noteWorkflowPageLatest(app, page) {
|
|
4123
|
+
const prev = workflowPageLatest.get(app);
|
|
4124
|
+
if (prev && prev.home === page.home && prev.pageId === page.pageId && prev.version >= page.version) return;
|
|
4125
|
+
workflowPageLatest.set(app, { home: page.home, pageId: page.pageId, version: page.version, at: Date.now() });
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4128
|
+
/** The Page version this cached report became, once its capture has landed. */
|
|
4129
|
+
function reportPageOf(entry) {
|
|
4130
|
+
return entry && typeof entry.runId === 'string' ? workflowPageByRun.get(entry.runId) || null : null;
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
function applyWorkflowPageCaptured(m) {
|
|
4134
|
+
if (!m || typeof m.app !== 'string' || typeof m.runId !== 'string') return;
|
|
4135
|
+
if (typeof m.warning === 'string') {
|
|
4136
|
+
// The run itself succeeded and its report is shown; the window on this workflow is told, the others log it.
|
|
4137
|
+
if (currentId === m.app) showToast(m.warning, 'warn');
|
|
4138
|
+
else console.warn(`Workflow ${m.app}: ${m.warning}`);
|
|
4139
|
+
return;
|
|
4140
|
+
}
|
|
4141
|
+
if (typeof m.home !== 'string' || typeof m.pageId !== 'string' || !Number.isInteger(m.version) || m.version < 1) {
|
|
4142
|
+
console.warn('A workflow Page update could not be read, so it was ignored.', m);
|
|
4143
|
+
return;
|
|
4144
|
+
}
|
|
4145
|
+
const page = { app: m.app, home: m.home, pageId: m.pageId, version: m.version };
|
|
4146
|
+
workflowPageByRun.set(m.runId, page);
|
|
4147
|
+
if (workflowPageByRun.size > WORKFLOW_PAGE_RUNS_KEPT) workflowPageByRun.delete(workflowPageByRun.keys().next().value);
|
|
4148
|
+
noteWorkflowPageLatest(m.app, page);
|
|
4149
|
+
window.flolessPages?.refresh?.();
|
|
4150
|
+
if (currentId === m.app) paintReportPageLinks();
|
|
4151
|
+
}
|
|
4152
|
+
|
|
4153
|
+
/** A Page deleted in this window: its versions are gone, so no report may still offer to open them. */
|
|
4154
|
+
function forgetDeletedPage(home, pageId) {
|
|
4155
|
+
for (const [runId, page] of workflowPageByRun) if (page.home === home && page.pageId === pageId) workflowPageByRun.delete(runId);
|
|
4156
|
+
for (const [app, page] of workflowPageLatest) if (page.home === home && page.pageId === pageId) workflowPageLatest.delete(app);
|
|
4157
|
+
paintReportPageLinks();
|
|
4158
|
+
}
|
|
4159
|
+
window.addEventListener('floless:page-deleted', (event) => {
|
|
4160
|
+
const d = event.detail || {};
|
|
4161
|
+
if (typeof d.home === 'string' && typeof d.id === 'string') forgetDeletedPage(d.home, d.id);
|
|
4162
|
+
});
|
|
4163
|
+
|
|
4164
|
+
/** Ask the server for a workflow's Page: the report area after a reload, a reconnect, or an empty viewer. */
|
|
4165
|
+
async function refreshWorkflowPage(app) {
|
|
4166
|
+
if (!app) return;
|
|
4167
|
+
const asked = Date.now();
|
|
4168
|
+
let body;
|
|
4169
|
+
try { body = await api(`/api/pages/workflow?app=${encodeURIComponent(app)}`); }
|
|
4170
|
+
catch (e) { console.warn(`FloLess couldn’t read the Page of workflow ${app}.`, e); return; }
|
|
4171
|
+
const page = body && body.page;
|
|
4172
|
+
if (page && typeof body.home === 'string' && typeof page.id === 'string' && Number.isInteger(page.latestVersion)) {
|
|
4173
|
+
noteWorkflowPageLatest(app, { home: body.home, pageId: page.id, version: page.latestVersion });
|
|
4174
|
+
} else if (body && typeof body.note === 'string') {
|
|
4175
|
+
// Unreadable or unplaceable is not "deleted": keep what this window knows, and say why in the console.
|
|
4176
|
+
console.warn(`Workflow ${app}: ${body.note}`);
|
|
4177
|
+
} else if (body && body.ok && !page && (workflowPageLatest.get(app)?.at ?? 0) < asked) {
|
|
4178
|
+
workflowPageLatest.delete(app); // the Page was deleted (a capture that landed meanwhile is kept)
|
|
4179
|
+
}
|
|
4180
|
+
if (currentId === app) paintReportPageLinks();
|
|
4181
|
+
}
|
|
4182
|
+
|
|
4183
|
+
/** The viewer's links to the workflow's Page: in the header, the version the SHOWN report became; in the empty
|
|
4184
|
+
* viewer, the latest version. Each is hidden when it is not known — never a guess at a version. */
|
|
4185
|
+
function paintReportPageLinks() {
|
|
4186
|
+
const app = currentId;
|
|
4187
|
+
const cached = app ? lastReportByApp.get(app) : null;
|
|
4188
|
+
const page = cached && !reportRunning && $reportOverlay.hidden ? reportPageOf(cached) : null;
|
|
4189
|
+
if ($reportPage) {
|
|
4190
|
+
$reportPage.hidden = !page;
|
|
4191
|
+
if (page) {
|
|
4192
|
+
$reportPage.textContent = `Version ${page.version} · Open in Pages`;
|
|
4193
|
+
$reportPage.setAttribute('data-command-id', `shell.report-page-open#${app}`);
|
|
4194
|
+
Object.assign($reportPage.dataset, { home: page.home, page: page.pageId, version: String(page.version) });
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
const latestButton = document.getElementById('report-latest-page');
|
|
4198
|
+
if (latestButton) {
|
|
4199
|
+
const latest = !cached && app ? workflowPageLatest.get(app) : null;
|
|
4200
|
+
latestButton.hidden = !latest;
|
|
4201
|
+
// "No report yet" would contradict the saved one offered right below it.
|
|
4202
|
+
const line = document.getElementById('report-empty-line');
|
|
4203
|
+
if (line && latest) line.innerHTML = 'No report open in this window.<div class="report-empty-hint">Saved reports are kept in the workflow’s Page. Or click <strong>▶ Run workflow</strong> for a fresh one.</div>';
|
|
4204
|
+
if (latest) {
|
|
4205
|
+
latestButton.textContent = `Open latest report (version ${latest.version})`;
|
|
4206
|
+
Object.assign(latestButton.dataset, { home: latest.home, page: latest.pageId, version: String(latest.version) });
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
|
|
4211
|
+
// Open the Page itself. The report viewer sits above the Page viewer, so it closes first.
|
|
4212
|
+
$reportModal?.addEventListener('click', (event) => {
|
|
4213
|
+
const link = event.target.closest?.('#report-page, #report-latest-page');
|
|
4214
|
+
if (!link || !link.dataset.home || !link.dataset.page) return;
|
|
4215
|
+
const version = Number(link.dataset.version);
|
|
4216
|
+
void (async () => {
|
|
4217
|
+
try {
|
|
4218
|
+
if (typeof window.flolessPages?.open !== 'function') throw new Error('The Pages viewer is not loaded. Reload FloLess and try again.');
|
|
4219
|
+
await closeReportViewer();
|
|
4220
|
+
await window.flolessPages.open(link.dataset.home, link.dataset.page, Number.isInteger(version) && version > 0 ? version : undefined);
|
|
4221
|
+
} catch (e) { showToast(`FloLess couldn’t open the workflow’s Page. ${e && e.message ? e.message : ''}`.trim(), 'warn'); }
|
|
4222
|
+
})();
|
|
4223
|
+
});
|
|
4224
|
+
|
|
4057
4225
|
// A live FOREGROUND trigger session — ▶ Run on a streaming/watch app (one whose
|
|
4058
4226
|
// source is a lifecycle:start watch). The finite run can't complete for a stream,
|
|
4059
4227
|
// so Run hosts a live session that re-renders the report in the Viewer on every
|
|
@@ -4318,6 +4486,7 @@
|
|
|
4318
4486
|
lastPaintedHtml = html || '';
|
|
4319
4487
|
lastPaintedInteractive = !!interactive; // drives the share copy: a 3D model is not a "frozen report"
|
|
4320
4488
|
showSavedPathActions(''); // default off; the caller re-shows if this report saved a file
|
|
4489
|
+
if ($reportPage) $reportPage.hidden = true; // likewise its Page link (paintReportPageLinks, once it is cached)
|
|
4321
4490
|
if (interactive) {
|
|
4322
4491
|
$reportFrame.hidden = true; $reportFrame.srcdoc = '';
|
|
4323
4492
|
$reportFrame3d.hidden = false;
|
|
@@ -4347,6 +4516,7 @@
|
|
|
4347
4516
|
$reportFrame3d.hidden = true; $reportFrame3d.removeAttribute('src');
|
|
4348
4517
|
lastPaintedHtml = '';
|
|
4349
4518
|
showSavedPathActions(''); // no report shown → no saved-file actions
|
|
4519
|
+
if ($reportPage) $reportPage.hidden = true;
|
|
4350
4520
|
}
|
|
4351
4521
|
|
|
4352
4522
|
// Double-click the HTML Viewer node → LOAD the last report (no run; running is
|
|
@@ -4377,9 +4547,13 @@
|
|
|
4377
4547
|
clearReportFrames();
|
|
4378
4548
|
$reportShare.hidden = true; // nothing to share — hide, don't disable
|
|
4379
4549
|
$reportOverlay.hidden = false;
|
|
4380
|
-
$reportOverlay.innerHTML = `<div>No report yet. Click <strong>▶ Run workflow</strong> (top right) to run it against the live model, then double-click to view it any time.</div
|
|
4550
|
+
$reportOverlay.innerHTML = `<div id="report-empty-line">No report yet. Click <strong>▶ Run workflow</strong> (top right) to run it against the live model, then double-click to view it any time.</div>`
|
|
4551
|
+
// #2262 slice 3a: after a reload this window holds no report, but the workflow's Page may: offer its latest.
|
|
4552
|
+
+ `<button type="button" class="ghost report-latest-page" id="report-latest-page" data-command-id="shell.report-latest-page-open#${escapeHtml(app.id)}" hidden></button>`;
|
|
4381
4553
|
$reportSub.textContent = 'Double-click loads the last report; ▶ Run workflow generates a fresh one.';
|
|
4382
4554
|
}
|
|
4555
|
+
paintReportPageLinks();
|
|
4556
|
+
void refreshWorkflowPage(app.id);
|
|
4383
4557
|
}
|
|
4384
4558
|
|
|
4385
4559
|
// ── Contract editor (tier-1 typed, editable contract) ───────────────────────
|
|
@@ -5056,6 +5230,7 @@
|
|
|
5056
5230
|
if (!app.runnable) { showToast('Compile the workflow first — Run is gated on a fresh lock.', 'warn'); return; }
|
|
5057
5231
|
if (reportRunning) return;
|
|
5058
5232
|
if (await askForMissingRunInputs(app)) return;
|
|
5233
|
+
if (!opts.debug && globalThis.flolessAgentSteps && await globalThis.flolessAgentSteps.confirmBeforeRun(app) === 'cancel') return; // #2241 S4
|
|
5059
5234
|
if (currentId !== app.id || reportRunning || state.running || foregroundStarting || foregroundStopping || foregroundTrigger) return;
|
|
5060
5235
|
const request = opts.debug ? null : beginManualRun(app.id);
|
|
5061
5236
|
reportRunning = true;
|
|
@@ -5137,7 +5312,8 @@
|
|
|
5137
5312
|
const savedPath = res && typeof res.savedPath === 'string' ? res.savedPath : '';
|
|
5138
5313
|
showSavedPathActions(savedPath);
|
|
5139
5314
|
markFirstRunDone(app.id); // a real run rendered → this workflow is no longer "new" (app captured pre-await; a mid-run switch must not mark the wrong workflow)
|
|
5140
|
-
lastReportByApp.set(currentId, { nodeId, label: inputBadge, html, interactive, savedPath });
|
|
5315
|
+
lastReportByApp.set(currentId, { nodeId, label: inputBadge, html, interactive, savedPath, runId: typeof res.runId === 'string' ? res.runId : null });
|
|
5316
|
+
paintReportPageLinks();
|
|
5141
5317
|
$reportModal.dataset.html = '1';
|
|
5142
5318
|
appendNarration(`Rendered the ${interactive ? '3D view' : 'report'} from <strong>${escapeHtml(nodeId)}</strong>${inputBadge ? ' (' + escapeHtml(inputBadge) + ')' : ''} — live run against the model.`);
|
|
5143
5319
|
} catch (e) {
|
|
@@ -6434,11 +6610,15 @@
|
|
|
6434
6610
|
$compileBtn.onclick = async () => {
|
|
6435
6611
|
if (!currentId || $compileBtn.disabled || $compileBtn.hidden) return; // hidden = suppressed for a maintained drift
|
|
6436
6612
|
const id = currentId;
|
|
6613
|
+
// #2241 S4: a workflow with an AI step nobody has confirmed (or that changed) is approved from the confirmation dialog, which
|
|
6614
|
+
// records the tick and approves the exact bytes it showed. 'proceed' = nothing to ask, the normal compile goes on.
|
|
6615
|
+
const consent = globalThis.flolessAgentSteps ? await globalThis.flolessAgentSteps.confirmBeforeApprove(apps.get(id) || { id }) : 'proceed';
|
|
6616
|
+
if (consent === 'cancel' || currentId !== id) return;
|
|
6437
6617
|
$compileBtn.disabled = true;
|
|
6438
6618
|
const prev = $compileBtn.textContent;
|
|
6439
6619
|
$compileBtn.textContent = '⎙ Compiling…';
|
|
6440
6620
|
try {
|
|
6441
|
-
await api('/api/compile', { method: 'POST', body: JSON.stringify({ id }) });
|
|
6621
|
+
if (consent !== 'approved') await api('/api/compile', { method: 'POST', body: JSON.stringify({ id }) });
|
|
6442
6622
|
await loadApp(id);
|
|
6443
6623
|
const app = apps.get(id);
|
|
6444
6624
|
appendNarration(app.runnable
|
|
@@ -9128,6 +9308,7 @@
|
|
|
9128
9308
|
if (!app.runnable) { showToast($runBtn.dataset.tip, 'warn'); return; }
|
|
9129
9309
|
if (state.running || reportRunning || foregroundStarting || foregroundStopping || foregroundTrigger) return;
|
|
9130
9310
|
if (!simulate && await askForMissingRunInputs(app)) return;
|
|
9311
|
+
if (!simulate && !reportNodeId() && globalThis.flolessAgentSteps && await globalThis.flolessAgentSteps.confirmBeforeRun(app) === 'cancel') return; // #2241 S4 (a report run asks inside runReport; a live trigger session asks here, before it starts)
|
|
9131
9312
|
if (currentId !== app.id || state.running || reportRunning || foregroundStarting || foregroundStopping || foregroundTrigger) return;
|
|
9132
9313
|
|
|
9133
9314
|
// Streaming/watch app → a LIVE FOREGROUND session, not a finite run (which would
|
|
@@ -9289,11 +9470,17 @@
|
|
|
9289
9470
|
const cmd = ev.command ? '/' + escapeHtml(ev.command) : '';
|
|
9290
9471
|
let lvl = 'info';
|
|
9291
9472
|
let msg;
|
|
9473
|
+
// #2241 S5: a confirmation step starting means a change may soon be waiting for the person. (The last-run panel is refreshed when a run
|
|
9474
|
+
// ends, never cleared here: the trace is replayed after a run, and a clear would discard the refresh already in flight.)
|
|
9475
|
+
globalThis.flolessAgentSteps?.noteTrace(ev);
|
|
9292
9476
|
switch (ev.kind) {
|
|
9293
9477
|
case 'run-start': msg = `run start · ${escapeHtml(ev.app || '')} (${escapeHtml(ev.instance || 'default')})${runStartApprovalNote(ev)}`; break;
|
|
9294
9478
|
case 'node-start': lvl = 'event'; msg = `node ${node} · ${agent}${cmd}`; break;
|
|
9295
9479
|
case 'would-write': lvl = 'warn'; msg = `would-write ${node} · ${escapeHtml(JSON.stringify(ev.proposed_inputs || {}))}`; break;
|
|
9296
|
-
case 'node-output': case 'output': case 'write': lvl = 'ok'; msg = `${escapeHtml(ev.kind)} ${node}`.trim();
|
|
9480
|
+
case 'node-output': case 'output': case 'write': lvl = 'ok'; msg = `${escapeHtml(ev.kind)} ${node}`.trim();
|
|
9481
|
+
// #2241 S5: AWARE marks an Agent step's output; the trace says so wherever it shows the output.
|
|
9482
|
+
if (ev.nondeterministic === true && globalThis.flolessAgentSteps) msg += ` ${globalThis.flolessAgentSteps.aiPillHtml()}`;
|
|
9483
|
+
break;
|
|
9297
9484
|
case 'run-end': lvl = ev.status === 'ok' ? 'ok' : 'err'; msg = `run ${escapeHtml(ev.status || 'ended')}`; break;
|
|
9298
9485
|
default: msg = `${escapeHtml(ev.kind)} ${node}`.trim();
|
|
9299
9486
|
}
|
|
@@ -9415,7 +9602,10 @@
|
|
|
9415
9602
|
switch (reason) {
|
|
9416
9603
|
case 'no-node':
|
|
9417
9604
|
case 'no-npm':
|
|
9418
|
-
|
|
9605
|
+
// The fallback copy, before the install plan has loaded. The Node.js card (nodeInstallView)
|
|
9606
|
+
// replaces it on Windows. No "try again" here: where the server cannot re-read PATH, only a
|
|
9607
|
+
// relaunch finds a Node.js installed after FloLess started (#2381).
|
|
9608
|
+
return "AWARE runs on Node.js, which isn't installed on this computer. Install it from nodejs.org, then close FloLess and open it again.";
|
|
9419
9609
|
case 'eacces':
|
|
9420
9610
|
return "Couldn't install because this location requires administrator permissions. Run FloLess as administrator, or install Node.js globally yourself and try again.";
|
|
9421
9611
|
case 'toolchain-unverified':
|
|
@@ -9451,22 +9641,265 @@
|
|
|
9451
9641
|
wrap.id = 'aware-bootstrap-overlay';
|
|
9452
9642
|
// role=status announces the card text on insertion; spinner + log are
|
|
9453
9643
|
// decorative/noisy (aria-hidden); bs-status is the polite live channel.
|
|
9644
|
+
// A dialog rather than role=status: the failed and Node.js views carry buttons, a link and a
|
|
9645
|
+
// command to read before agreeing, and a dialog announces its title and body on focus.
|
|
9454
9646
|
wrap.innerHTML =
|
|
9455
|
-
`<div class="bs-card" role="
|
|
9647
|
+
`<div class="bs-card" role="dialog" aria-modal="true" aria-labelledby="bs-title" aria-describedby="bs-body" tabindex="-1">
|
|
9456
9648
|
<div class="bs-spinner" aria-hidden="true"></div>
|
|
9457
|
-
<h1></h1>
|
|
9458
|
-
<p class="bs-body"></p>
|
|
9649
|
+
<h1 id="bs-title"></h1>
|
|
9650
|
+
<p class="bs-body" id="bs-body"></p>
|
|
9651
|
+
<div class="bs-cmd-wrap" hidden>
|
|
9652
|
+
<pre class="bs-cmd"></pre>
|
|
9653
|
+
<button type="button" class="bs-copy" data-command-id="shell.setup-node-install-copy" data-tip="Copy command" aria-label="Copy command">Copy</button>
|
|
9654
|
+
</div>
|
|
9655
|
+
<p class="bs-note"></p>
|
|
9459
9656
|
<p class="bs-status" id="bs-status" aria-live="polite"></p>
|
|
9460
9657
|
<p class="bs-log" aria-hidden="true"></p>
|
|
9461
9658
|
<p class="bs-remediation"></p>
|
|
9462
|
-
<button type="button" class="
|
|
9659
|
+
<button type="button" class="bs-primary bs-offer" data-command-id="shell.setup-node-install" hidden></button>
|
|
9660
|
+
<div class="bs-actions">
|
|
9661
|
+
<button type="button" class="secondary bs-cancel" data-command-id="shell.setup-node-install-cancel" hidden>Cancel</button>
|
|
9662
|
+
<button type="button" class="bs-primary bs-confirm" data-command-id="shell.setup-node-install-confirm" hidden>Install</button>
|
|
9663
|
+
<a class="bs-link" data-command-id="shell.setup-node-download" target="_blank" rel="noopener noreferrer" hidden>Download from nodejs.org ↗</a>
|
|
9664
|
+
<button type="button" class="secondary bs-retry" data-command-id="shell.setup-retry" hidden>Try again</button>
|
|
9665
|
+
</div>
|
|
9666
|
+
<p class="bs-hint"></p>
|
|
9463
9667
|
</div>`;
|
|
9464
9668
|
document.body.appendChild(wrap);
|
|
9465
9669
|
bootstrapOverlayEl = wrap;
|
|
9466
|
-
wrap.querySelector('.
|
|
9670
|
+
wrap.querySelector('.bs-retry').addEventListener('click', onBootstrapRetry);
|
|
9671
|
+
wrap.querySelector('.bs-offer').addEventListener('click', onNodeInstallOffer);
|
|
9672
|
+
wrap.querySelector('.bs-confirm').addEventListener('click', onNodeInstallConfirm);
|
|
9673
|
+
wrap.querySelector('.bs-cancel').addEventListener('click', onNodeInstallCancel);
|
|
9674
|
+
wrap.querySelector('.bs-copy').addEventListener('click', onNodeInstallCopy);
|
|
9675
|
+
// Esc on the consent step is Cancel; it does nothing anywhere else on this card.
|
|
9676
|
+
wrap.addEventListener('keydown', (e) => {
|
|
9677
|
+
if (e.key === 'Escape' && nodeInstall.step === 'confirm') { e.preventDefault(); onNodeInstallCancel(); }
|
|
9678
|
+
});
|
|
9467
9679
|
wrap.querySelector('.bs-card').focus();
|
|
9468
9680
|
}
|
|
9469
9681
|
|
|
9682
|
+
// ── "Install Node.js for me" (#2381) ──────────────────────────────────────
|
|
9683
|
+
// For no-node/no-npm the card offers to install Node.js. The SERVER owns the install (winget, or the
|
|
9684
|
+
// nodejs.org MSI checked against its published checksum), streams it as `node-install` SSE events, and
|
|
9685
|
+
// when it ends re-checks and carries on into the AWARE install by itself; this only shows the plan, asks
|
|
9686
|
+
// for consent with the exact command on screen, and follows the job.
|
|
9687
|
+
const NODE_REASONS = new Set(['no-node', 'no-npm']);
|
|
9688
|
+
// How long to show "Checking for Node.js…" after a successful install before concluding the server's
|
|
9689
|
+
// re-check is not coming (its continuation failed), and telling the person to relaunch instead.
|
|
9690
|
+
const NODE_RECHECK_GRACE_MS = 60_000;
|
|
9691
|
+
const nodeInstall = {
|
|
9692
|
+
plan: null, // {supported, method, command, downloadPage} from GET /api/bootstrap/node-install
|
|
9693
|
+
job: null, // {id, rev, status, method, error, recheckError, lastLine, finishedAt}
|
|
9694
|
+
step: 'offer', // 'offer' | 'confirm' — the card's own step; the job is the server's
|
|
9695
|
+
planLoading: false,
|
|
9696
|
+
planFailedAt: 0, // when the plan last failed to load — retried from the next 5 s health tick, not at once
|
|
9697
|
+
startInFlight: false,
|
|
9698
|
+
recheckSeen: false, // the bootstrap left `failed` after the install succeeded
|
|
9699
|
+
};
|
|
9700
|
+
|
|
9701
|
+
// Take a job snapshot only if it is not older than the one we have. SSE events, the POST reply and the
|
|
9702
|
+
// 5 s re-read can arrive in any order; a late "running" must never undo a "failed" or "succeeded".
|
|
9703
|
+
function adoptNodeJob(next) {
|
|
9704
|
+
if (!next || typeof next !== 'object') return false;
|
|
9705
|
+
const cur = nodeInstall.job;
|
|
9706
|
+
// Ids restart with the server; a different epoch is a new server, whose snapshot always wins.
|
|
9707
|
+
if (cur && cur.epoch === next.epoch && typeof cur.id === 'number' && typeof next.id === 'number') {
|
|
9708
|
+
if (next.id < cur.id || (next.id === cur.id && (next.rev ?? 0) < (cur.rev ?? 0))) return false;
|
|
9709
|
+
}
|
|
9710
|
+
nodeInstall.job = { ...(cur && cur.epoch === next.epoch && cur.id === next.id ? cur : {}), ...next };
|
|
9711
|
+
return true;
|
|
9712
|
+
}
|
|
9713
|
+
|
|
9714
|
+
function loadNodeInstallPlan() {
|
|
9715
|
+
if (nodeInstall.plan || nodeInstall.planLoading || Date.now() - nodeInstall.planFailedAt < 4000) return;
|
|
9716
|
+
nodeInstall.planLoading = true;
|
|
9717
|
+
api('/api/bootstrap/node-install')
|
|
9718
|
+
.then((r) => {
|
|
9719
|
+
nodeInstall.plan = r.plan || null;
|
|
9720
|
+
adoptNodeJob(r.job);
|
|
9721
|
+
if (!nodeInstall.plan) nodeInstall.planFailedAt = Date.now();
|
|
9722
|
+
})
|
|
9723
|
+
.catch((err) => { nodeInstall.planFailedAt = Date.now(); console.warn('node install plan unavailable', err); })
|
|
9724
|
+
.finally(() => { nodeInstall.planLoading = false; rerenderBootstrap(); });
|
|
9725
|
+
}
|
|
9726
|
+
|
|
9727
|
+
let nodeJobRefreshedAt = 0;
|
|
9728
|
+
function refreshNodeInstallJob() {
|
|
9729
|
+
if (Date.now() - nodeJobRefreshedAt < 4000) return;
|
|
9730
|
+
nodeJobRefreshedAt = Date.now();
|
|
9731
|
+
api('/api/bootstrap/node-install')
|
|
9732
|
+
.then((r) => {
|
|
9733
|
+
const before = nodeInstall.job && `${nodeInstall.job.id}/${nodeInstall.job.rev}/${nodeInstall.job.status}`;
|
|
9734
|
+
if (adoptNodeJob(r.job) && `${nodeInstall.job.id}/${nodeInstall.job.rev}/${nodeInstall.job.status}` !== before) rerenderBootstrap();
|
|
9735
|
+
})
|
|
9736
|
+
.catch((err) => { console.warn('node install status unavailable', err); });
|
|
9737
|
+
}
|
|
9738
|
+
|
|
9739
|
+
function rerenderBootstrap() {
|
|
9740
|
+
if (bootstrapState && bootstrapState.status !== 'ready') updateBootstrap({ ...bootstrapState });
|
|
9741
|
+
}
|
|
9742
|
+
|
|
9743
|
+
// Which Node.js view the failed card shows. Null = not a Node.js failure.
|
|
9744
|
+
function nodeInstallView(reason) {
|
|
9745
|
+
if (!NODE_REASONS.has(reason)) return null;
|
|
9746
|
+
const job = nodeInstall.job;
|
|
9747
|
+
if (job && job.status === 'running') return 'node-running';
|
|
9748
|
+
if (job && job.status === 'succeeded') {
|
|
9749
|
+
if (job.recheckError) return 'node-recheck-failed';
|
|
9750
|
+
const since = Date.parse(job.finishedAt || '') || 0;
|
|
9751
|
+
return !nodeInstall.recheckSeen && Date.now() - since < NODE_RECHECK_GRACE_MS ? 'node-checking' : 'node-relaunch';
|
|
9752
|
+
}
|
|
9753
|
+
if (!nodeInstall.plan) return 'node-unknown';
|
|
9754
|
+
if (!nodeInstall.plan.supported) return 'node-manual';
|
|
9755
|
+
if (nodeInstall.step === 'confirm') return 'node-confirm';
|
|
9756
|
+
return job && job.status === 'failed' ? 'node-failed' : 'node-offer';
|
|
9757
|
+
}
|
|
9758
|
+
|
|
9759
|
+
// Paint one Node.js view onto the card's elements. Everything not named here stays hidden. Every view
|
|
9760
|
+
// keeps a way forward — the nodejs.org link at the least — because nothing here refuses, it asks.
|
|
9761
|
+
function paintNodeInstallView(view, els) {
|
|
9762
|
+
const { h1, body, cmdWrap, cmd, note, hint, remediation, offer, confirm, cancel, link, retry } = els;
|
|
9763
|
+
const plan = nodeInstall.plan;
|
|
9764
|
+
const job = nodeInstall.job;
|
|
9765
|
+
link.href = (plan && plan.downloadPage) || 'https://nodejs.org/en/download';
|
|
9766
|
+
if (view === 'node-running' || view === 'node-checking') {
|
|
9767
|
+
h1.textContent = view === 'node-running' ? 'Installing Node.js…' : 'Checking for Node.js…';
|
|
9768
|
+
body.textContent = view === 'node-running'
|
|
9769
|
+
? "This takes a minute or two. If Windows asks for permission and you don't see it, look for a flashing icon in the taskbar."
|
|
9770
|
+
: 'Node.js is installed. FloLess is checking for it, then it will set up AWARE.';
|
|
9771
|
+
// Stalled or not, the manual route stays on screen; there is no Cancel, because a running
|
|
9772
|
+
// installer cannot be stopped cleanly.
|
|
9773
|
+
hint.textContent = view === 'node-running' ? 'Prefer to install it yourself?' : '';
|
|
9774
|
+
link.hidden = view !== 'node-running';
|
|
9775
|
+
return { spinner: true };
|
|
9776
|
+
}
|
|
9777
|
+
if (view === 'node-confirm') {
|
|
9778
|
+
h1.textContent = 'Install Node.js?';
|
|
9779
|
+
body.textContent = 'FloLess will run this command:';
|
|
9780
|
+
// One unbreakable span per argument: Chrome would otherwise break after the hyphen of a flag
|
|
9781
|
+
// ("--" / "source"), and a command split mid-flag reads as a different command.
|
|
9782
|
+
cmd.replaceChildren(...String(plan.command).split(' ').flatMap((tok, i) => {
|
|
9783
|
+
const span = document.createElement('span');
|
|
9784
|
+
span.className = 'bs-tok';
|
|
9785
|
+
span.textContent = tok;
|
|
9786
|
+
return i ? [' ', span] : [span];
|
|
9787
|
+
}));
|
|
9788
|
+
cmdWrap.hidden = false;
|
|
9789
|
+
note.textContent = plan.method === 'winget'
|
|
9790
|
+
? 'Windows will ask for permission to make changes. Running it accepts the winget source and Node.js package licence terms.'
|
|
9791
|
+
: "winget isn't available, so FloLess downloads the official Node.js LTS installer from nodejs.org, checks it against nodejs.org's published checksum, then runs it. Windows will ask for permission to make changes.";
|
|
9792
|
+
cancel.hidden = false;
|
|
9793
|
+
confirm.hidden = false;
|
|
9794
|
+
confirm.disabled = nodeInstall.startInFlight;
|
|
9795
|
+
confirm.textContent = nodeInstall.startInFlight ? 'Starting…' : 'Install';
|
|
9796
|
+
return { spinner: false };
|
|
9797
|
+
}
|
|
9798
|
+
if (view === 'node-recheck-failed') {
|
|
9799
|
+
h1.textContent = 'Node.js is installed';
|
|
9800
|
+
body.textContent = "FloLess couldn't carry on setting up AWARE by itself. Choose Try again to continue.";
|
|
9801
|
+
if (job.recheckError) remediation.textContent = job.recheckError;
|
|
9802
|
+
retry.hidden = false;
|
|
9803
|
+
return { spinner: false };
|
|
9804
|
+
}
|
|
9805
|
+
if (view === 'node-relaunch') {
|
|
9806
|
+
h1.textContent = 'Almost there';
|
|
9807
|
+
body.textContent = "Node.js is installed, but FloLess can't see it yet. Close FloLess and open it again to finish setup.";
|
|
9808
|
+
retry.hidden = false;
|
|
9809
|
+
return { spinner: false };
|
|
9810
|
+
}
|
|
9811
|
+
if (view === 'node-manual' || view === 'node-unknown') {
|
|
9812
|
+
h1.textContent = 'Node.js is needed';
|
|
9813
|
+
// Off Windows (node-manual) a running process cannot see a new PATH, so only a relaunch helps and the
|
|
9814
|
+
// copy must not promise Try again. While the plan has not loaded (node-unknown) we cannot tell which
|
|
9815
|
+
// applies, so the copy covers both.
|
|
9816
|
+
body.textContent = view === 'node-manual'
|
|
9817
|
+
? "AWARE runs on Node.js, which isn't installed on this computer. Install it from nodejs.org, then close FloLess and open it again."
|
|
9818
|
+
: "AWARE runs on Node.js, which isn't installed on this computer. Install it from nodejs.org, then choose Try again. If FloLess still can't find it, close FloLess and open it again.";
|
|
9819
|
+
link.hidden = false;
|
|
9820
|
+
retry.hidden = false;
|
|
9821
|
+
return { spinner: false };
|
|
9822
|
+
}
|
|
9823
|
+
// node-offer / node-failed
|
|
9824
|
+
if (view === 'node-failed') {
|
|
9825
|
+
h1.textContent = "Node.js didn't install";
|
|
9826
|
+
body.textContent = (job && job.error) || 'The install stopped before Node.js was installed.';
|
|
9827
|
+
offer.textContent = 'Try the install again';
|
|
9828
|
+
if (job && job.lastLine && job.lastLine !== job.error) remediation.textContent = job.lastLine;
|
|
9829
|
+
} else {
|
|
9830
|
+
h1.textContent = 'Node.js is needed';
|
|
9831
|
+
body.textContent = "AWARE runs on Node.js, which isn't installed on this computer. FloLess can install it for you, or you can install it yourself.";
|
|
9832
|
+
offer.textContent = 'Install Node.js for me';
|
|
9833
|
+
hint.textContent = 'Installed it yourself? Choose Try again.';
|
|
9834
|
+
}
|
|
9835
|
+
offer.hidden = false;
|
|
9836
|
+
link.hidden = false;
|
|
9837
|
+
retry.hidden = false;
|
|
9838
|
+
return { spinner: false };
|
|
9839
|
+
}
|
|
9840
|
+
|
|
9841
|
+
function onNodeInstallOffer() {
|
|
9842
|
+
nodeInstall.step = 'confirm';
|
|
9843
|
+
rerenderBootstrap();
|
|
9844
|
+
}
|
|
9845
|
+
|
|
9846
|
+
function onNodeInstallCancel() {
|
|
9847
|
+
nodeInstall.step = 'offer';
|
|
9848
|
+
rerenderBootstrap();
|
|
9849
|
+
bootstrapOverlayEl?.querySelector('.bs-offer')?.focus();
|
|
9850
|
+
}
|
|
9851
|
+
|
|
9852
|
+
async function onNodeInstallCopy() {
|
|
9853
|
+
const statusEl = bootstrapOverlayEl?.querySelector('.bs-status');
|
|
9854
|
+
const copied = await copyToClipboard(nodeInstall.plan?.command || '');
|
|
9855
|
+
if (statusEl) statusEl.textContent = copied ? 'Copied.' : "Couldn't copy — select the command and copy it instead.";
|
|
9856
|
+
setTimeout(() => { if (statusEl && /^Cop|^Couldn't copy/.test(statusEl.textContent)) statusEl.textContent = ''; }, 2000);
|
|
9857
|
+
}
|
|
9858
|
+
|
|
9859
|
+
async function onNodeInstallConfirm() {
|
|
9860
|
+
if (nodeInstall.startInFlight) return; // guard double-clicks even before disabled paints
|
|
9861
|
+
nodeInstall.startInFlight = true;
|
|
9862
|
+
rerenderBootstrap();
|
|
9863
|
+
let statusText = '';
|
|
9864
|
+
try {
|
|
9865
|
+
// The method the person just read. If the server would now run a different one, it starts nothing
|
|
9866
|
+
// and sends the new plan back, and the card asks again with the new command on screen.
|
|
9867
|
+
const r = await api('/api/bootstrap/node-install', { method: 'POST', body: JSON.stringify({ method: nodeInstall.plan?.method ?? null }) });
|
|
9868
|
+
// Keep the plan the card showed unless the reply carries a complete one to replace it.
|
|
9869
|
+
if (r.plan && r.plan.command) nodeInstall.plan = r.plan;
|
|
9870
|
+
if (r.planChanged) {
|
|
9871
|
+
statusText = 'FloLess would now install Node.js a different way. Check the command and choose Install again.';
|
|
9872
|
+
} else {
|
|
9873
|
+
adoptNodeJob(r.job);
|
|
9874
|
+
nodeInstall.recheckSeen = false;
|
|
9875
|
+
nodeInstall.step = 'offer';
|
|
9876
|
+
}
|
|
9877
|
+
} catch (err) {
|
|
9878
|
+
console.warn('node install did not start', err);
|
|
9879
|
+
// The server answered (err.status) with its own reason, or it did not answer at all.
|
|
9880
|
+
statusText = err && err.status
|
|
9881
|
+
? `Couldn't start the install: ${err.message}`
|
|
9882
|
+
: "Couldn't start the install — FloLess's server didn't answer. Try again in a moment.";
|
|
9883
|
+
} finally {
|
|
9884
|
+
nodeInstall.startInFlight = false;
|
|
9885
|
+
rerenderBootstrap();
|
|
9886
|
+
const statusEl = bootstrapOverlayEl?.querySelector('.bs-status');
|
|
9887
|
+
if (statusEl && statusText) statusEl.textContent = statusText;
|
|
9888
|
+
}
|
|
9889
|
+
}
|
|
9890
|
+
|
|
9891
|
+
// A `node-install` SSE event: follow the server's job. A progress line carries the job's id and rev,
|
|
9892
|
+
// so an older one cannot drag a finished job back to "running".
|
|
9893
|
+
function onNodeInstallEvent(m) {
|
|
9894
|
+
const { type: _t, line, ...rest } = m;
|
|
9895
|
+
const isLine = line != null;
|
|
9896
|
+
const next = isLine ? { epoch: rest.epoch, id: rest.id, rev: rest.rev, status: rest.status, method: rest.method, lastLine: line } : rest;
|
|
9897
|
+
if (!adoptNodeJob(next)) return;
|
|
9898
|
+
if (rest.status === 'succeeded') nodeInstall.recheckSeen = false;
|
|
9899
|
+
if (isLine) setBootstrapLogLine(line);
|
|
9900
|
+
rerenderBootstrap();
|
|
9901
|
+
}
|
|
9902
|
+
|
|
9470
9903
|
// The live npm ticker: REPLACE (never append) the single line; aria-hidden so
|
|
9471
9904
|
// the rapid output is not announced. Only meaningful while installing.
|
|
9472
9905
|
function setBootstrapLogLine(line) {
|
|
@@ -9484,56 +9917,101 @@
|
|
|
9484
9917
|
showBootstrapOverlay();
|
|
9485
9918
|
if (!bootstrapOverlayEl) return;
|
|
9486
9919
|
const prev = bootstrapState;
|
|
9487
|
-
|
|
9920
|
+
// The re-check after a Node.js install has begun once setup leaves `failed`.
|
|
9921
|
+
if (status !== 'failed' && nodeInstall.job && nodeInstall.job.status === 'succeeded') nodeInstall.recheckSeen = true;
|
|
9922
|
+
const nodeView = status === 'failed' ? nodeInstallView(s.reason) : null;
|
|
9923
|
+
const view = nodeView || status;
|
|
9924
|
+
bootstrapState = { status, reason: s.reason ?? null, remediation: s.remediation ?? null, view };
|
|
9488
9925
|
const card = bootstrapOverlayEl.querySelector('.bs-card');
|
|
9489
|
-
const spinner = bootstrapOverlayEl.querySelector('.bs-spinner');
|
|
9490
9926
|
const h1 = bootstrapOverlayEl.querySelector('h1');
|
|
9491
|
-
const
|
|
9492
|
-
|
|
9927
|
+
const els = {
|
|
9928
|
+
h1,
|
|
9929
|
+
body: bootstrapOverlayEl.querySelector('.bs-body'),
|
|
9930
|
+
cmdWrap: bootstrapOverlayEl.querySelector('.bs-cmd-wrap'),
|
|
9931
|
+
cmd: bootstrapOverlayEl.querySelector('.bs-cmd'),
|
|
9932
|
+
note: bootstrapOverlayEl.querySelector('.bs-note'),
|
|
9933
|
+
hint: bootstrapOverlayEl.querySelector('.bs-hint'),
|
|
9934
|
+
statusEl: bootstrapOverlayEl.querySelector('.bs-status'),
|
|
9935
|
+
remediation: bootstrapOverlayEl.querySelector('.bs-remediation'),
|
|
9936
|
+
offer: bootstrapOverlayEl.querySelector('.bs-offer'),
|
|
9937
|
+
confirm: bootstrapOverlayEl.querySelector('.bs-confirm'),
|
|
9938
|
+
cancel: bootstrapOverlayEl.querySelector('.bs-cancel'),
|
|
9939
|
+
link: bootstrapOverlayEl.querySelector('.bs-link'),
|
|
9940
|
+
retry: bootstrapOverlayEl.querySelector('.bs-retry'),
|
|
9941
|
+
};
|
|
9493
9942
|
const log = bootstrapOverlayEl.querySelector('.bs-log');
|
|
9494
|
-
const remediation =
|
|
9495
|
-
|
|
9496
|
-
|
|
9943
|
+
const { body, statusEl, remediation, retry } = els;
|
|
9944
|
+
// Every view starts from a blank card and shows only what it names.
|
|
9945
|
+
hideBootstrapControls();
|
|
9946
|
+
els.note.textContent = '';
|
|
9947
|
+
els.hint.textContent = '';
|
|
9948
|
+
remediation.textContent = '';
|
|
9949
|
+
// A view change clears the status line; a re-render of the same view keeps it (e.g. "Copied.").
|
|
9950
|
+
if (!prev || prev.view !== view) statusEl.textContent = '';
|
|
9951
|
+
let spin;
|
|
9952
|
+
if (nodeView) {
|
|
9953
|
+
// Load the plan the first time a Node.js failure shows; until it arrives the card shows the manual
|
|
9954
|
+
// route, which is never wrong.
|
|
9955
|
+
loadNodeInstallPlan();
|
|
9956
|
+
// SSE is at-most-once: while an install is in flight, the 5 s health re-render also re-reads the
|
|
9957
|
+
// job, so a missed "finished" event cannot leave the card spinning forever.
|
|
9958
|
+
if (nodeView === 'node-running' || nodeView === 'node-checking' || nodeView === 'node-unknown') refreshNodeInstallJob();
|
|
9959
|
+
spin = paintNodeInstallView(nodeView, els).spinner;
|
|
9960
|
+
if (nodeView !== 'node-running' && log) log.textContent = '';
|
|
9961
|
+
if (nodeView === 'node-running' && nodeInstall.job && nodeInstall.job.lastLine && log && !log.textContent) log.textContent = nodeInstall.job.lastLine;
|
|
9962
|
+
} else if (status === 'failed') {
|
|
9497
9963
|
// No spinner on failure — absence of motion is the signal (no error icon).
|
|
9498
|
-
|
|
9964
|
+
spin = false;
|
|
9499
9965
|
h1.textContent = 'Setup failed';
|
|
9500
9966
|
body.textContent = bootstrapBody(s.reason);
|
|
9501
|
-
statusEl.textContent = '';
|
|
9502
9967
|
if (log) log.textContent = ''; // ticker is only meaningful while installing
|
|
9503
9968
|
// Server remediation is SUPPLEMENTARY dim context — omit if empty or if it
|
|
9504
9969
|
// duplicates the fixed body (the fixed copy is the user-facing message).
|
|
9505
9970
|
const rem = (s.remediation || '').trim();
|
|
9506
9971
|
remediation.textContent = rem && rem !== body.textContent ? rem : '';
|
|
9507
9972
|
retry.hidden = false;
|
|
9508
|
-
// Respect an in-flight retry: an SSE/poll re-render of `failed` mid-retry
|
|
9509
|
-
// would otherwise re-enable the button and allow duplicate clicks. The
|
|
9510
|
-
// server is idempotent today (terminal-state guard on /api/bootstrap/retry),
|
|
9511
|
-
// but the UI shouldn't depend on that.
|
|
9512
|
-
retry.disabled = bootstrapRetryInFlight;
|
|
9513
|
-
retry.textContent = bootstrapRetryInFlight ? 'Trying…' : 'Try again';
|
|
9514
9973
|
} else {
|
|
9515
9974
|
// probing / installing — spinner spins, no button.
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
sp.className = 'bs-spinner';
|
|
9519
|
-
sp.setAttribute('aria-hidden', 'true');
|
|
9520
|
-
card.insertBefore(sp, h1);
|
|
9521
|
-
}
|
|
9975
|
+
spin = true;
|
|
9976
|
+
nodeInstall.step = 'offer';
|
|
9522
9977
|
h1.textContent = 'Setting up AWARE…';
|
|
9523
9978
|
body.textContent = 'Installing the AWARE runtime. This happens once.';
|
|
9524
9979
|
// probing may say "Checking…"; installing clears it (the ticker carries the signal).
|
|
9525
9980
|
statusEl.textContent = status === 'probing' ? 'Checking for AWARE…' : '';
|
|
9526
9981
|
if (status !== 'installing' && log) log.textContent = ''; // clear ticker when not installing
|
|
9527
|
-
remediation.textContent = '';
|
|
9528
|
-
retry.hidden = true;
|
|
9529
9982
|
}
|
|
9530
|
-
//
|
|
9531
|
-
//
|
|
9532
|
-
|
|
9983
|
+
// Respect an in-flight retry: an SSE/poll re-render of `failed` mid-retry
|
|
9984
|
+
// would otherwise re-enable the button and allow duplicate clicks. The
|
|
9985
|
+
// server is idempotent today (terminal-state guard on /api/bootstrap/retry),
|
|
9986
|
+
// but the UI shouldn't depend on that.
|
|
9987
|
+
retry.disabled = bootstrapRetryInFlight;
|
|
9988
|
+
retry.textContent = bootstrapRetryInFlight ? 'Trying…' : 'Try again';
|
|
9989
|
+
const spinner = bootstrapOverlayEl.querySelector('.bs-spinner');
|
|
9990
|
+
if (spin && !spinner) {
|
|
9991
|
+
const sp = document.createElement('div');
|
|
9992
|
+
sp.className = 'bs-spinner';
|
|
9993
|
+
sp.setAttribute('aria-hidden', 'true');
|
|
9994
|
+
card.insertBefore(sp, h1);
|
|
9995
|
+
} else if (!spin && spinner) spinner.remove();
|
|
9996
|
+
// Re-focus the card when the VIEW changes (not on every event) so the new
|
|
9997
|
+
// h1/body is re-announced without spamming on each ticker line. Keyed on the
|
|
9998
|
+
// view, not the status: offer → consent → installing are all `failed` to the
|
|
9999
|
+
// server. On consent the card takes focus, never Install, which starts an
|
|
10000
|
+
// elevation prompt.
|
|
10001
|
+
if (!prev || prev.view !== view) {
|
|
9533
10002
|
if (document.activeElement !== card) card.focus();
|
|
9534
10003
|
}
|
|
9535
10004
|
}
|
|
9536
10005
|
|
|
10006
|
+
// Hide every control on the card; each view un-hides only its own.
|
|
10007
|
+
function hideBootstrapControls() {
|
|
10008
|
+
if (!bootstrapOverlayEl) return;
|
|
10009
|
+
for (const sel of ['.bs-cmd-wrap', '.bs-offer', '.bs-confirm', '.bs-cancel', '.bs-link', '.bs-retry']) {
|
|
10010
|
+
const el = bootstrapOverlayEl.querySelector(sel);
|
|
10011
|
+
if (el) el.hidden = true;
|
|
10012
|
+
}
|
|
10013
|
+
}
|
|
10014
|
+
|
|
9537
10015
|
// Transition installing→ready: a brief "Ready" beat, then remove (not instant)
|
|
9538
10016
|
// so success registers before the workspace paints. A dwell, not an animation.
|
|
9539
10017
|
function finishBootstrapReady() {
|
|
@@ -9559,7 +10037,9 @@
|
|
|
9559
10037
|
card.querySelector('.bs-status').textContent = '';
|
|
9560
10038
|
card.querySelector('.bs-log').textContent = '';
|
|
9561
10039
|
card.querySelector('.bs-remediation').textContent = '';
|
|
9562
|
-
card.querySelector('.
|
|
10040
|
+
card.querySelector('.bs-note').textContent = '';
|
|
10041
|
+
card.querySelector('.bs-hint').textContent = '';
|
|
10042
|
+
hideBootstrapControls();
|
|
9563
10043
|
}
|
|
9564
10044
|
bootstrapReadyTimer = setTimeout(() => {
|
|
9565
10045
|
hideBootstrapOverlay();
|
|
@@ -9675,7 +10155,37 @@
|
|
|
9675
10155
|
padding:7px 16px;border-radius:7px;}
|
|
9676
10156
|
#aware-bootstrap-overlay .secondary:hover{border-color:var(--accent,#3b82f6);color:var(--text,#f8fafc);}
|
|
9677
10157
|
#aware-bootstrap-overlay .secondary:disabled{cursor:default;opacity:.55;border-color:var(--border,#1e293b);color:var(--text-dim,#94a3b8);}
|
|
9678
|
-
#aware-bootstrap-overlay .bs-log:empty,#aware-bootstrap-overlay .bs-remediation:empty{display:none;}
|
|
10158
|
+
#aware-bootstrap-overlay .bs-log:empty,#aware-bootstrap-overlay .bs-remediation:empty{display:none;}
|
|
10159
|
+
/* "Install Node.js for me" (#2381): the primary action, the consent step's command, and the
|
|
10160
|
+
alternatives row. Primary mirrors .modal-actions button.primary; no new tokens. */
|
|
10161
|
+
#aware-bootstrap-overlay .bs-primary{appearance:none;cursor:pointer;font-size:13px;font-weight:600;margin-top:16px;
|
|
10162
|
+
background:var(--accent,#3b82f6);border:1px solid var(--accent,#3b82f6);color:#fff;padding:8px 18px;border-radius:7px;}
|
|
10163
|
+
#aware-bootstrap-overlay .bs-primary:hover{background:var(--accent-bright,#60a5fa);box-shadow:0 0 14px var(--accent-glow,rgba(59,130,246,.4));}
|
|
10164
|
+
#aware-bootstrap-overlay .bs-primary:disabled{cursor:default;opacity:.6;box-shadow:none;background:var(--accent,#3b82f6);}
|
|
10165
|
+
#aware-bootstrap-overlay .bs-primary:focus-visible,#aware-bootstrap-overlay .secondary:focus-visible,
|
|
10166
|
+
#aware-bootstrap-overlay .bs-link:focus-visible,#aware-bootstrap-overlay .bs-copy:focus-visible{outline:2px solid var(--accent-bright,#60a5fa);outline-offset:2px;}
|
|
10167
|
+
#aware-bootstrap-overlay .bs-actions{display:flex;gap:12px;justify-content:center;align-items:center;flex-wrap:wrap;}
|
|
10168
|
+
#aware-bootstrap-overlay .bs-actions .bs-primary{margin-top:16px;}
|
|
10169
|
+
#aware-bootstrap-overlay .bs-link{font-size:12.5px;margin-top:16px;color:var(--text-dim,#94a3b8);text-decoration:none;}
|
|
10170
|
+
#aware-bootstrap-overlay .bs-link:hover{color:var(--accent-bright,#60a5fa);text-decoration:underline;}
|
|
10171
|
+
#aware-bootstrap-overlay .bs-cmd-wrap{position:relative;margin:10px 0 6px;text-align:left;}
|
|
10172
|
+
#aware-bootstrap-overlay .bs-cmd{margin:0;font:11.5px/1.5 var(--mono,monospace);color:var(--text,#f8fafc);
|
|
10173
|
+
background:color-mix(in srgb,var(--text-dim,#94a3b8) 8%,transparent);border:1px solid var(--border,#1e293b);border-radius:7px;
|
|
10174
|
+
padding:10px 52px 10px 12px;white-space:pre-wrap;overflow-wrap:break-word;max-height:140px;overflow:auto;
|
|
10175
|
+
scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--text-dim,#94a3b8) 40%,transparent) transparent;}
|
|
10176
|
+
#aware-bootstrap-overlay .bs-cmd .bs-tok{white-space:nowrap;}
|
|
10177
|
+
#aware-bootstrap-overlay .bs-cmd::-webkit-scrollbar{width:8px;height:8px;}
|
|
10178
|
+
#aware-bootstrap-overlay .bs-cmd::-webkit-scrollbar-track{background:transparent;}
|
|
10179
|
+
#aware-bootstrap-overlay .bs-cmd::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--text-dim,#94a3b8) 40%,transparent);border-radius:4px;}
|
|
10180
|
+
#aware-bootstrap-overlay .bs-copy{position:absolute;top:6px;right:6px;appearance:none;cursor:pointer;font-size:11px;
|
|
10181
|
+
background:var(--surface,#0b1424);border:1px solid var(--border,#1e293b);color:var(--text-dim,#94a3b8);padding:2px 8px;border-radius:5px;}
|
|
10182
|
+
#aware-bootstrap-overlay .bs-copy:hover{border-color:var(--accent,#3b82f6);color:var(--text,#f8fafc);}
|
|
10183
|
+
#aware-bootstrap-overlay .bs-note{font-size:12.5px;}
|
|
10184
|
+
#aware-bootstrap-overlay .bs-hint{font-size:12px;margin:12px 0 0;}
|
|
10185
|
+
#aware-bootstrap-overlay .bs-note:empty,#aware-bootstrap-overlay .bs-hint:empty{display:none;}
|
|
10186
|
+
/* display set above would beat the UA [hidden] rule — restore hiding for every control. */
|
|
10187
|
+
#aware-bootstrap-overlay .bs-primary[hidden],#aware-bootstrap-overlay .secondary[hidden],
|
|
10188
|
+
#aware-bootstrap-overlay .bs-link[hidden],#aware-bootstrap-overlay .bs-cmd-wrap[hidden]{display:none;}`;
|
|
9679
10189
|
document.head.appendChild(style);
|
|
9680
10190
|
const stat = document.querySelector('footer .status .stat'); // first stat = runtime
|
|
9681
10191
|
if (!stat) return;
|
|
@@ -9878,6 +10388,8 @@
|
|
|
9878
10388
|
// the catch-up question. (Found by review.)
|
|
9879
10389
|
if (everOpened) {
|
|
9880
10390
|
window.dispatchEvent(new CustomEvent('floless:projects-changed', { detail: {} }));
|
|
10391
|
+
// #2248: requests from the terminal made or answered during the gap are read again too.
|
|
10392
|
+
window.dispatchEvent(new CustomEvent('floless:action-proposal', { detail: { resync: true } }));
|
|
9881
10393
|
loadRequests();
|
|
9882
10394
|
// The SAME catch-up for the other half a live `projects-changed` drives (see that arm): the
|
|
9883
10395
|
// open workflow's publication availability turns on project state, so a gap leaves the card
|
|
@@ -9890,6 +10402,8 @@
|
|
|
9890
10402
|
void refreshSelectedCompleteReportDiscovery(currentId);
|
|
9891
10403
|
// #2228: progress events are at-most-once too — a reload or a reconnect asks where this tab's run is.
|
|
9892
10404
|
void resyncLiveRun();
|
|
10405
|
+
// #2262 slice 3a: a capture that landed while we were gone is read again, for the workflow on screen.
|
|
10406
|
+
if (everOpened && currentId) void refreshWorkflowPage(currentId);
|
|
9893
10407
|
everOpened = true;
|
|
9894
10408
|
};
|
|
9895
10409
|
es.onmessage = (e) => {
|
|
@@ -9903,6 +10417,9 @@
|
|
|
9903
10417
|
// (installing only) → dim ticker; `status`/`reason` drive the card state.
|
|
9904
10418
|
if (m.line != null) setBootstrapLogLine(m.line);
|
|
9905
10419
|
if (m.status) updateBootstrap({ status: m.status, reason: m.reason ?? null, remediation: m.remediation ?? null });
|
|
10420
|
+
} else if (m.type === 'node-install') {
|
|
10421
|
+
// "Install Node.js for me" (#2381): the server's install job, its progress lines and its end.
|
|
10422
|
+
onNodeInstallEvent(m);
|
|
9906
10423
|
} else if (m.type === 'aware-update') {
|
|
9907
10424
|
// The server started an automatic bridge repair. Adopt it now so an ALREADY-OPEN tab shows
|
|
9908
10425
|
// it immediately; the init-time adopt() only covers tabs opened after it began. adopt() is
|
|
@@ -9911,6 +10428,8 @@
|
|
|
9911
10428
|
} else if (m.type === 'run-live' || m.type === 'node-progress' || m.type === 'run-finished') {
|
|
9912
10429
|
// #2228: live progress of a long run. This tab's own run is matched by its token; a run of the
|
|
9913
10430
|
// workflow this tab shows that someone else started is followed read-only (no Stop).
|
|
10431
|
+
// #2241: a run that FAILED after an Agent answered ends with run-finished, not run-ended: its AI record is read then too.
|
|
10432
|
+
if (m.type === 'run-finished' && m.id && m.id === currentId) void globalThis.flolessAgentSteps?.refreshRunRecord(m.id);
|
|
9914
10433
|
if (liveRunOwns(m)) {
|
|
9915
10434
|
if (m.type === 'run-live') { if (m.runId) liveRun.runId = m.runId; }
|
|
9916
10435
|
else if (m.type === 'node-progress') onLiveProgress(m);
|
|
@@ -9929,6 +10448,10 @@
|
|
|
9929
10448
|
const videos = m.media.filter((x) => x && x.kind === 'video' && typeof x.url === 'string');
|
|
9930
10449
|
const mine = liveRun && ((m.clientRunToken && liveRun.token === m.clientRunToken) || (m.runId && liveRun.runId === m.runId));
|
|
9931
10450
|
if (videos.length && (mine || m.id === currentId)) offerRunVideos(m.id, videos);
|
|
10451
|
+
} else if (m.type === 'action-proposal' && typeof m.proposalId === 'string') {
|
|
10452
|
+
// #2248: a request from the terminal was made or changed. terminal-requests.js reads it back by id and shows it.
|
|
10453
|
+
try { window.dispatchEvent(new CustomEvent('floless:action-proposal', { detail: { proposalId: m.proposalId } })); }
|
|
10454
|
+
catch { /* a listener throwing must not break the SSE loop */ }
|
|
9932
10455
|
} else if (m.type === 'render-progress') {
|
|
9933
10456
|
// Relayed as a DOM event rather than widening the bridge: workspaces.js owns the Exports
|
|
9934
10457
|
// card and is the only listener, and a render can outlive several repaints of it.
|
|
@@ -9955,7 +10478,7 @@
|
|
|
9955
10478
|
// workflow, and the open PROJECT is a different question — its app need not be the workflow
|
|
9956
10479
|
// this tab happens to be showing.
|
|
9957
10480
|
window.dispatchEvent(new CustomEvent('floless:projects-changed', { detail: m }));
|
|
9958
|
-
if (typeof m.appId !== 'string' || m.appId === currentId) {
|
|
10481
|
+
if (m.kind !== 'metadata' && (typeof m.appId !== 'string' || m.appId === currentId)) {
|
|
9959
10482
|
refreshCurrentWorkflowAvailability().catch(reportErr);
|
|
9960
10483
|
}
|
|
9961
10484
|
} else if (m.type === 'workspace-root-changed') {
|
|
@@ -10103,6 +10626,7 @@
|
|
|
10103
10626
|
} else if (m.type === 'run-ended') {
|
|
10104
10627
|
// Panel data bindings (last-run-output/-status) go stale after any run.
|
|
10105
10628
|
if (window.flolessPanels) window.flolessPanels.refreshData();
|
|
10629
|
+
if (m.id && m.id === currentId) void globalThis.flolessAgentSteps?.refreshRunRecord(m.id); // #2241 S5
|
|
10106
10630
|
} else if (m.type === 'routine-changed') {
|
|
10107
10631
|
loadRoutinesData();
|
|
10108
10632
|
} else if (m.type === 'agent-changed') {
|
|
@@ -10116,6 +10640,7 @@
|
|
|
10116
10640
|
loadRoutinesData();
|
|
10117
10641
|
if (window.flolessPanels) window.flolessPanels.refreshData(); // routine runs also refresh bindings
|
|
10118
10642
|
window.flolessAgents?.refreshRuns?.(); // #2035: an open agent page shows the run its routine just started
|
|
10643
|
+
if (currentId) void globalThis.flolessAgentSteps?.refreshRunRecord(currentId); // #2241 S5: a scheduled run may have left questions
|
|
10119
10644
|
} else if (m.type === 'trigger-session-changed') {
|
|
10120
10645
|
// A foreground live-run session (▶ Run on a streaming app) shares this SSE
|
|
10121
10646
|
// event with background routines; its server-namespaced id routes it to the
|
|
@@ -10126,6 +10651,8 @@
|
|
|
10126
10651
|
applyTriggerReport(m);
|
|
10127
10652
|
} else if (m.type === 'routine-report') {
|
|
10128
10653
|
applyRoutineReport(m);
|
|
10654
|
+
} else if (m.type === 'workflow-page-captured') {
|
|
10655
|
+
applyWorkflowPageCaptured(m);
|
|
10129
10656
|
} else if (m.type === 'action-run-report') {
|
|
10130
10657
|
applyActionRunReport(m);
|
|
10131
10658
|
} else if (m.type === 'routine-report-changed') {
|
|
@@ -15217,6 +15744,13 @@
|
|
|
15217
15744
|
const d = new Date(iso);
|
|
15218
15745
|
return isNaN(d.getTime()) ? '' : d.toLocaleString();
|
|
15219
15746
|
}
|
|
15747
|
+
// #2241 S5: the last scheduled run used an AI step - say so in the row, and how many questions it left for the person.
|
|
15748
|
+
function routineAiHtml(r) {
|
|
15749
|
+
const ai = !r.agent && r.lastRun ? globalThis.flolessAgentSteps?.routineAiParts(r.lastRun) : null;
|
|
15750
|
+
if (!ai) return '';
|
|
15751
|
+
return `<span class="rtn-dot">·</span><span class="rtn-ai" data-tip="${escapeAttr(ai.aiTip)}">${escapeHtml(ai.ai)}</span>`
|
|
15752
|
+
+ (ai.questions ? `<span class="rtn-dot">·</span><span class="rtn-ai-q" data-tip="${escapeAttr(ai.questionsTip)}">${escapeHtml(ai.questions)}</span>` : '');
|
|
15753
|
+
}
|
|
15220
15754
|
function lastRunTip(r) {
|
|
15221
15755
|
if (!r.lastRun) return 'Never run yet';
|
|
15222
15756
|
const lr = r.lastRun;
|
|
@@ -15232,6 +15766,9 @@
|
|
|
15232
15766
|
return `Didn’t start${lr.reason ? ' — ' + lr.reason : ''} · ${when}`;
|
|
15233
15767
|
}
|
|
15234
15768
|
const dur = lr.durationMs != null ? ` · ${(lr.durationMs / 1000).toFixed(1)} s` : '';
|
|
15769
|
+
// #2241 S5: a run with an AI step says so, and says how many questions it left for you.
|
|
15770
|
+
const ai = globalThis.flolessAgentSteps?.routineAiParts(lr);
|
|
15771
|
+
const aiWords = ai ? ` — ${ai.ai}${ai.questions ? ' · ' + ai.questions : ''}` : '';
|
|
15235
15772
|
// A run that finished on a stated assumption says so with its outcome, never only in the report.
|
|
15236
15773
|
const warnings = Array.isArray(lr.warnings) ? lr.warnings.filter((warning) => typeof warning === 'string' && warning) : [];
|
|
15237
15774
|
// #1998: a run made under an approval carried forward to newer tool versions says so, in AWARE's words.
|
|
@@ -15243,7 +15780,7 @@
|
|
|
15243
15780
|
&& typeof w.detail === 'string' && w.detail.trim() && (w.via === null || typeof w.via === 'string')
|
|
15244
15781
|
&& Array.isArray(w.choices) && w.choices.every((choice) => typeof choice === 'string')) : [];
|
|
15245
15782
|
const bridge = bridgeWarnings.map((w) => `\n${w.status === 'declaration-invalid' ? 'Ran with an invalid bridge declaration' : 'Ran with a bridge mismatch'}: ${w.via ? w.via + ' → ' : ''}${w.name}. ${w.detail}`).join('');
|
|
15246
|
-
return `Last run ${lr.status}${lr.reason ? ' — ' + lr.reason : ''}${warnings.length ? ' — ' + warnings.join(' ') : ''} · ${absTime(lr.at)}${dur}${carried}${bridge}`;
|
|
15783
|
+
return `Last run ${lr.status}${aiWords}${lr.reason ? ' — ' + lr.reason : ''}${warnings.length ? ' — ' + warnings.join(' ') : ''} · ${absTime(lr.at)}${dur}${carried}${bridge}`;
|
|
15247
15784
|
}
|
|
15248
15785
|
|
|
15249
15786
|
// ── Trigger-routine row helpers ─────────────────────────────────────────────
|
|
@@ -15450,6 +15987,7 @@
|
|
|
15450
15987
|
const open = $reportModal && $reportModal.classList.contains('show');
|
|
15451
15988
|
if (!open || currentId !== m.workflow || reportRunning) return;
|
|
15452
15989
|
paintReport(m.html, interactive);
|
|
15990
|
+
paintReportPageLinks();
|
|
15453
15991
|
$reportSub.textContent = fromChat ? 'Report from the run you confirmed in AI Chat — rendered from the run\'s output, never composed by the UI.'
|
|
15454
15992
|
: 'Report from a run started in a terminal — rendered from the run\'s output, never composed by the UI.';
|
|
15455
15993
|
showSavedPathActions(savedPath);
|
|
@@ -15459,10 +15997,11 @@
|
|
|
15459
15997
|
if (!m || !m.workflow || typeof m.html !== 'string') return;
|
|
15460
15998
|
const prev = lastReportByApp.get(m.workflow);
|
|
15461
15999
|
const changed = !prev || prev.html !== m.html;
|
|
15462
|
-
lastReportByApp.set(m.workflow, { nodeId: m.nodeId || null, label: 'scheduled', html: m.html });
|
|
16000
|
+
lastReportByApp.set(m.workflow, { nodeId: m.nodeId || null, label: 'scheduled', html: m.html, runId: typeof m.runId === 'string' ? m.runId : null });
|
|
15463
16001
|
const open = $reportModal && $reportModal.classList.contains('show');
|
|
15464
16002
|
if (open && currentId === m.workflow && !reportRunning && !foregroundTrigger) {
|
|
15465
16003
|
paintReport(m.html); // unhides Share + clears the overlay
|
|
16004
|
+
paintReportPageLinks();
|
|
15466
16005
|
const t = new Date().toLocaleTimeString();
|
|
15467
16006
|
$reportSub.innerHTML =
|
|
15468
16007
|
`<span class="live-pip" aria-hidden="true"></span>Scheduled · updated ${escapeHtml(t)} — rendered from the node's output, never composed by the UI.`;
|
|
@@ -16118,7 +16657,7 @@
|
|
|
16118
16657
|
<div class="rtn-item ${isTrigger ? 'trigger ' : ''}${r.enabled ? '' : 'disabled'} ${running ? 'running' : ''}" data-id="${escapeAttr(r.id)}">
|
|
16119
16658
|
<div class="rtn-main">
|
|
16120
16659
|
<div class="rtn-name">${escapeHtml(r.name)}</div>
|
|
16121
|
-
<div class="rtn-sub"><span class="rtn-wf">${escapeHtml(whatText)}</span><span class="rtn-dot">·</span><span>${escapeHtml(whenText)}</span>${broken}</div>
|
|
16660
|
+
<div class="rtn-sub"><span class="rtn-wf">${escapeHtml(whatText)}</span><span class="rtn-dot">·</span><span>${escapeHtml(whenText)}</span>${broken}${routineAiHtml(r)}</div>
|
|
16122
16661
|
${reportLine}
|
|
16123
16662
|
</div>
|
|
16124
16663
|
<div class="rtn-meta"${isTrigger ? ' aria-live="polite" aria-atomic="true"' : ''}>
|
|
@@ -18253,6 +18792,7 @@
|
|
|
18253
18792
|
refreshCurrentWorkflow() {
|
|
18254
18793
|
return refreshCurrentWorkflow();
|
|
18255
18794
|
},
|
|
18795
|
+
reloadCompiledWorkflows,
|
|
18256
18796
|
// Workspaces is a replacement surface. Invalidate a pending workflow-pin read as soon as it
|
|
18257
18797
|
// opens, rather than allowing a late answer to survive behind the project UI until the return.
|
|
18258
18798
|
clearKbInformed() {
|