@floless/app 0.174.1 → 0.175.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/autostart.mjs +117 -10
- package/dist/floless-server.cjs +2 -2
- package/dist/pdf-engine/floless_pdf/__init__.py +7 -3
- package/dist/pdf-engine/floless_pdf/backend_pdfium.py +292 -13
- package/dist/pdf-engine/floless_pdf/backend_pymupdf.py +25 -3
- package/dist/pdf-engine/floless_pdf/images.py +4 -3
- package/dist/pdf-engine/floless_pdf/pages.py +136 -0
- package/dist/schemas/steel.model.v2.schema.json +44 -1
- package/dist/skills/floless-app-approval/SKILL.md +28 -3
- package/dist/skills/floless-app-knowledge/SKILL.md +3 -2
- package/dist/skills/floless-app-sketches/SKILL.md +71 -0
- package/dist/skills/floless-app-sketches/references/steel-plate.md +15 -0
- package/dist/skills/floless-app-steel-model/SKILL.md +11 -1
- package/dist/skills/floless-app-steel-model/references/elements.md +90 -23
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +11 -6
- package/dist/web/agents.js +1 -1
- package/dist/web/app.css +120 -15
- package/dist/web/app.js +89 -38
- package/dist/web/aware-hold.js +10 -0
- package/dist/web/aware.js +405 -51
- package/dist/web/boot-watchdog.js +249 -0
- package/dist/web/card-details.js +88 -0
- package/dist/web/chat.css +29 -0
- package/dist/web/chat.js +430 -128
- package/dist/web/commands-connection-design.js +23 -0
- package/dist/web/commands-revit.js +3 -0
- package/dist/web/commands-shell.js +226 -10
- package/dist/web/commands-steel.js +93 -4
- package/dist/web/commands-tekla-parser.js +21 -1
- package/dist/web/connection-design-editor.html +71 -0
- package/dist/web/connection-design-editor.js +794 -61
- package/dist/web/connection-design-handles.js +9 -3
- package/dist/web/element-approval.js +74 -0
- package/dist/web/element-context.js +76 -6
- package/dist/web/element-geometry.js +8 -2
- package/dist/web/element-holds.js +68 -5
- package/dist/web/element-type-actions.js +22 -3
- package/dist/web/element-types.js +12 -5
- package/dist/web/element-words.js +15 -11
- package/dist/web/grid-place.js +51 -0
- package/dist/web/guide.js +2 -0
- package/dist/web/index.html +13 -16
- package/dist/web/instructor.js +5 -2
- package/dist/web/missed-routines.js +6 -1
- package/dist/web/model-change-findings.js +100 -30
- package/dist/web/model-change-review.js +411 -27
- package/dist/web/model-clash-check.css +100 -0
- package/dist/web/model-clash-check.js +681 -0
- package/dist/web/model-clip-box.js +204 -0
- package/dist/web/model-clip-list.js +153 -3
- package/dist/web/model-clip-session.js +3 -3
- package/dist/web/model-clip-three-overlay.js +135 -25
- package/dist/web/model-editor.css +2 -0
- package/dist/web/model-elements.js +273 -18
- package/dist/web/model-fit-checks.js +354 -0
- package/dist/web/model-spatial-panel.js +9 -3
- package/dist/web/model-spatial-tools.js +12 -3
- package/dist/web/model-tekla-selection.js +74 -0
- package/dist/web/model-view-query.js +70 -14
- package/dist/web/model-viewport-revit-adapter.js +8 -7
- package/dist/web/model-viewport-toolbar.js +8 -4
- package/dist/web/pages.js +78 -1
- package/dist/web/project-history.js +31 -1
- package/dist/web/revit-editor.css +34 -1
- package/dist/web/revit-editor.js +174 -55
- package/dist/web/run-history.js +8 -0
- package/dist/web/sketch-editor.js +141 -2
- package/dist/web/sketches.js +192 -6
- package/dist/web/start-place.js +46 -0
- package/dist/web/steel-3d-core.js +70 -0
- package/dist/web/steel-3d-view.js +288 -47
- package/dist/web/steel-change-review.css +28 -0
- package/dist/web/steel-custom-connection.js +6 -0
- package/dist/web/steel-editor.html +532 -33
- package/dist/web/steel-filter.html +8 -3
- package/dist/web/steel-model-checks.css +76 -0
- package/dist/web/steel-model-v2-commands.js +17 -0
- package/dist/web/steel-view-generation.js +6 -2
- package/dist/web/teams.js +259 -19
- package/dist/web/tekla-editor.html +1 -0
- package/dist/web/terminal-requests.js +6 -0
- package/dist/web/vendor/connection-engine.js +886 -91
- package/dist/web/workspaces.js +630 -48
- package/package.json +2 -1
- package/preferences-file.mjs +27 -0
package/dist/web/aware.js
CHANGED
|
@@ -1282,10 +1282,44 @@
|
|
|
1282
1282
|
return choice === 'save' ? 'approve' : choice === 'discard' ? 'anyway' : 'cancel';
|
|
1283
1283
|
}
|
|
1284
1284
|
|
|
1285
|
+
/**
|
|
1286
|
+
* #2470 R6.8 slice 4 (plan §2.3): a workflow that may read Teams channels while channel reading is off for a signed-in
|
|
1287
|
+
* Microsoft 365 account asks before it starts. Open Integrations (the default) lands on the switch; Run anyway is the
|
|
1288
|
+
* person's recorded choice, never the AI's. Returns 'integrations', 'anyway' or 'cancel'.
|
|
1289
|
+
*/
|
|
1290
|
+
async function askChannelReading(body) {
|
|
1291
|
+
// Review R3: every word is the server's (channel-account-state.ts), so the title and body say what its check found.
|
|
1292
|
+
const ask = body.channelReading || {};
|
|
1293
|
+
const choice = await confirmUnsavedSwitch('', [body.error, ask.note].filter((s) => typeof s === 'string' && s).join(' '),
|
|
1294
|
+
typeof ask.title === 'string' && ask.title ? ask.title : '', { confirm: 'Open Integrations', discard: 'Run anyway', cancel: 'Cancel',
|
|
1295
|
+
commandIds: { confirm: 'shell.run-channel-open-integrations', discard: 'shell.run-channel-anyway', cancel: 'shell.dialog-cancel#the Teams channel prompt' } });
|
|
1296
|
+
return choice === 'save' ? 'integrations' : choice === 'discard' ? 'anyway' : 'cancel';
|
|
1297
|
+
}
|
|
1298
|
+
function isChannelAsk(error) {
|
|
1299
|
+
return !!(error && error.status === 409 && error.body && error.body.code === 'channel-reading-off'
|
|
1300
|
+
&& error.body.channelReading && Array.isArray(error.body.channelReading.keys));
|
|
1301
|
+
}
|
|
1302
|
+
function isElsewhereAsk(error) {
|
|
1303
|
+
return !!(error && error.status === 409 && error.body && error.body.code === 'floless-steps-elsewhere' && error.body.elsewhere);
|
|
1304
|
+
}
|
|
1305
|
+
/** The answer a run's ask got, as the field its resend carries, or null when the person did not run it anyway. */
|
|
1306
|
+
async function answerRunAsk(error, { routine = false, onApprove } = {}) {
|
|
1307
|
+
if (isChannelAsk(error)) {
|
|
1308
|
+
const choice = await askChannelReading(error.body);
|
|
1309
|
+
if (choice === 'integrations' && typeof openIntegrations === 'function') openIntegrations('microsoft-365#channel-reading');
|
|
1310
|
+
if (choice !== 'anyway') return null;
|
|
1311
|
+
return { channelRunAnyway: { accounts: error.body.channelReading.accounts, keys: error.body.channelReading.keys } };
|
|
1312
|
+
}
|
|
1313
|
+
const choice = await askRunElsewhere(error.body.elsewhere, { routine });
|
|
1314
|
+
if (choice !== 'anyway') { if (choice === 'approve' && onApprove) await onApprove(); return null; }
|
|
1315
|
+
return { runElsewhere: error.body.elsewhere.signature };
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1285
1318
|
/**
|
|
1286
1319
|
* #3253: POST a run (a routine's Run now, a live run) and, while the server answers that its FloLess steps reach another
|
|
1287
1320
|
* FloLess, ask; "Run anyway" posts again naming the endpoints shown, and other endpoints ask again. Not running throws a
|
|
1288
1321
|
* not-run answer the caller already shows; "Compile and approve here" (or "Open the workflow") calls `onApprove` first.
|
|
1322
|
+
* #2470 R6.8 slice 4: the Teams channel ask is answered the same way, and each Run anyway keeps the other one it already has.
|
|
1289
1323
|
*/
|
|
1290
1324
|
async function postAskingElsewhere(url, body, { routine = false, onApprove } = {}) {
|
|
1291
1325
|
let send = body;
|
|
@@ -1293,13 +1327,10 @@
|
|
|
1293
1327
|
try {
|
|
1294
1328
|
return await api(url, { method: 'POST', body: JSON.stringify(send) });
|
|
1295
1329
|
} catch (error) {
|
|
1296
|
-
if (!(error && error
|
|
1297
|
-
const
|
|
1298
|
-
if (
|
|
1299
|
-
|
|
1300
|
-
throw Object.assign(new Error('Run stopped before execution started.'), { body: { notRun: true, elsewhereStopped: true, error: 'Run stopped before execution started.' } });
|
|
1301
|
-
}
|
|
1302
|
-
send = { ...body, runElsewhere: error.body.elsewhere.signature };
|
|
1330
|
+
if (!isElsewhereAsk(error) && !isChannelAsk(error)) throw error;
|
|
1331
|
+
const answer = await answerRunAsk(error, { routine, onApprove });
|
|
1332
|
+
if (!answer) throw Object.assign(new Error('Run stopped before execution started.'), { body: { notRun: true, elsewhereStopped: true, error: 'Run stopped before execution started.' } });
|
|
1333
|
+
send = { ...send, ...answer };
|
|
1303
1334
|
}
|
|
1304
1335
|
}
|
|
1305
1336
|
}
|
|
@@ -1315,21 +1346,22 @@
|
|
|
1315
1346
|
result = await api('/api/run', { method: 'POST', body: JSON.stringify({ ...payload, runRequestId: request.id }) });
|
|
1316
1347
|
} catch (caught) { error = caught; }
|
|
1317
1348
|
// #3253: asked again for as long as the server answers with other endpoints than the ones the person accepted.
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
if (
|
|
1322
|
-
|
|
1349
|
+
// #2470 R6.8 slice 4: and for as long as it answers that Teams channel reading is off for accounts not yet accepted.
|
|
1350
|
+
let accepted = {};
|
|
1351
|
+
while (isElsewhereAsk(error) || isChannelAsk(error)) {
|
|
1352
|
+
const answer = await answerRunAsk(error, { onApprove: () => { if ($compileBtn && !$compileBtn.disabled) $compileBtn.click(); } });
|
|
1353
|
+
if (!answer) {
|
|
1323
1354
|
error = Object.assign(new Error('Run stopped before execution started.'), { body: { cancelled: true, error: 'Run stopped before execution started.' } });
|
|
1324
1355
|
break;
|
|
1325
1356
|
}
|
|
1326
|
-
// A new request id: the refused one is finished on the server. "Run anyway" covers exactly
|
|
1327
|
-
// if
|
|
1357
|
+
// A new request id: the refused one is finished on the server. Each "Run anyway" covers exactly what was shown;
|
|
1358
|
+
// if it changed meanwhile, the server answers with the new one and the loop asks again.
|
|
1359
|
+
accepted = { ...accepted, ...answer };
|
|
1328
1360
|
request.id = crypto.randomUUID();
|
|
1329
1361
|
if (payload.clientRunToken && retrack) payload = { ...payload, clientRunToken: retrack() };
|
|
1330
1362
|
error = undefined;
|
|
1331
1363
|
try {
|
|
1332
|
-
result = await api('/api/run', { method: 'POST', body: JSON.stringify({ ...payload, runRequestId: request.id,
|
|
1364
|
+
result = await api('/api/run', { method: 'POST', body: JSON.stringify({ ...payload, runRequestId: request.id, ...accepted }) });
|
|
1333
1365
|
} catch (caught) { error = caught; }
|
|
1334
1366
|
}
|
|
1335
1367
|
// A Stop reply can disappear even after the server has settled this run. Its acknowledgement
|
|
@@ -1736,30 +1768,43 @@
|
|
|
1736
1768
|
return body;
|
|
1737
1769
|
}
|
|
1738
1770
|
|
|
1771
|
+
/**
|
|
1772
|
+
* The AIs a direct Ask can start now, and which one it starts by default (#4079). `found` holds every
|
|
1773
|
+
* Claude or Codex FloLess can start with nothing to set up first (`chatRuntimeReadiness` 'ready': the
|
|
1774
|
+
* server's own answer, so FloLess's own copy counts as much as the user's install). A direct Ask sets
|
|
1775
|
+
* nothing up (#1652), so an AI FloLess still has to set up is left out; with none ready the strip
|
|
1776
|
+
* keeps Queue & copy. `provider` is always one of `found`, or null: the server's default when it is
|
|
1777
|
+
* ready, else one whose CLI is not known to be signed out, Claude first.
|
|
1778
|
+
*/
|
|
1739
1779
|
async function instructorAskOptions() {
|
|
1740
1780
|
const info = await refreshHeadless();
|
|
1741
1781
|
const found = info && Array.isArray(info.runtimes)
|
|
1742
|
-
? info.runtimes.filter((runtime) => runtime && runtime
|
|
1743
|
-
&& (runtime.id === 'claude' || runtime.id === 'codex'))
|
|
1782
|
+
? info.runtimes.filter((runtime) => runtime && chatRuntimeReadiness(runtime) === 'ready')
|
|
1744
1783
|
: [];
|
|
1745
|
-
|
|
1784
|
+
const signedOut = (runtime) => runtime.account?.state === 'signed-out';
|
|
1785
|
+
const fallback = [...found].sort((a, b) => (signedOut(a) - signedOut(b)) || ((b.id === 'claude') - (a.id === 'claude')))[0];
|
|
1786
|
+
const provider = found.some((runtime) => runtime.id === info?.provider) ? info.provider : (fallback?.id ?? null);
|
|
1787
|
+
return { found, provider };
|
|
1746
1788
|
}
|
|
1747
1789
|
|
|
1748
|
-
async function startInstructorAnswer(request, runtime, fingerprint) {
|
|
1790
|
+
async function startInstructorAnswer(request, runtime, fingerprint, chosenSignedOut = false) {
|
|
1749
1791
|
activeInstructorRuns.set(fingerprint, request.id);
|
|
1750
1792
|
try {
|
|
1751
1793
|
let chosen = runtime;
|
|
1794
|
+
let signedOut = chosenSignedOut;
|
|
1752
1795
|
if (chosen !== 'claude' && chosen !== 'codex') {
|
|
1753
1796
|
const options = await instructorAskOptions();
|
|
1754
|
-
chosen = options.provider
|
|
1755
|
-
|
|
1756
|
-
: options.found.find((candidate) => candidate.id === 'claude' || candidate.id === 'codex')?.id;
|
|
1797
|
+
chosen = options.provider;
|
|
1798
|
+
signedOut = options.found.find((candidate) => candidate.id === chosen)?.account?.state === 'signed-out';
|
|
1757
1799
|
}
|
|
1758
1800
|
if ((chosen !== 'claude' && chosen !== 'codex') || typeof window.flolessChat?.startRequest !== 'function') {
|
|
1759
1801
|
throw new Error('Claude or Codex chat is unavailable');
|
|
1760
1802
|
}
|
|
1761
1803
|
await window.flolessChat.startRequest(request.id, chosen);
|
|
1762
|
-
|
|
1804
|
+
// Signed out never stops the start (#4079): the conversation opens, and AI Chat offers the sign-in there.
|
|
1805
|
+
showToast(signedOut
|
|
1806
|
+
? `Started in ${runtimeLabel(chosen)}, but ${runtimeLabel(chosen)} isn’t signed in. Sign in from AI Chat to get the answer.`
|
|
1807
|
+
: `Started in ${runtimeLabel(chosen)} — continue in AI Chat`, signedOut ? 'warn' : 'ok');
|
|
1763
1808
|
await loadRequests();
|
|
1764
1809
|
activeInstructorRuns.delete(fingerprint);
|
|
1765
1810
|
return true;
|
|
@@ -1809,7 +1854,7 @@
|
|
|
1809
1854
|
if (mode === 'direct') {
|
|
1810
1855
|
// The durable question is visible now; run admission continues independently. The Ask control
|
|
1811
1856
|
// must not sit on “Starting…” while Windows capability checks and workspace setup happen.
|
|
1812
|
-
void startInstructorAnswer(request, options.runtime, fingerprint);
|
|
1857
|
+
void startInstructorAnswer(request, options.runtime, fingerprint, options.signedOut === true);
|
|
1813
1858
|
return true;
|
|
1814
1859
|
}
|
|
1815
1860
|
|
|
@@ -1834,18 +1879,27 @@
|
|
|
1834
1879
|
async function chooseInstructorRuntime(instructorContext) {
|
|
1835
1880
|
const { found, provider } = await instructorAskOptions();
|
|
1836
1881
|
if (!found.length) return requestInstructorHelp(instructorContext, { mode: 'queue' });
|
|
1882
|
+
// Each AI says who would answer (#4079). A signed-out one stays on offer: AI Chat asks for the sign-in when it opens.
|
|
1883
|
+
const signedOut = (runtime) => runtime.account?.state === 'signed-out';
|
|
1884
|
+
const accountMeta = (runtime) => (signedOut(runtime) ? 'Not signed in'
|
|
1885
|
+
: runtime.account?.state === 'signed-in' && runtime.account.email ? runtime.account.email
|
|
1886
|
+
: runtime.account?.state === 'signed-in' || runtime.account?.state === 'no-identity' ? 'Signed in' : runtime.command);
|
|
1837
1887
|
const result = await formModal({
|
|
1838
1888
|
title: 'Choose terminal AI',
|
|
1839
1889
|
sub: 'This starts a read-only conversation in the current project or workflow’s AI Chat.',
|
|
1840
1890
|
fields: [{
|
|
1841
1891
|
name: 'runtime', label: 'Terminal AI', type: 'select', value: provider || found[0].id,
|
|
1842
1892
|
commandId: 'shell.instructor-ask-runtime',
|
|
1843
|
-
options: found.map((runtime) => ({
|
|
1893
|
+
options: found.map((runtime) => ({
|
|
1894
|
+
value: runtime.id, label: runtime.label, meta: accountMeta(runtime),
|
|
1895
|
+
...(signedOut(runtime) ? { ariaLabel: `${runtime.label}, not signed in` } : {}),
|
|
1896
|
+
})),
|
|
1844
1897
|
}],
|
|
1845
1898
|
okLabel: 'Ask AI now',
|
|
1846
1899
|
});
|
|
1847
1900
|
if (!result) return false;
|
|
1848
|
-
return requestInstructorHelp(instructorContext, { mode: 'direct', runtime: result.runtime
|
|
1901
|
+
return requestInstructorHelp(instructorContext, { mode: 'direct', runtime: result.runtime,
|
|
1902
|
+
signedOut: found.some((runtime) => runtime.id === result.runtime && signedOut(runtime)) });
|
|
1849
1903
|
}
|
|
1850
1904
|
|
|
1851
1905
|
function workflowOwnerOptions(projects) {
|
|
@@ -2067,6 +2121,7 @@
|
|
|
2067
2121
|
function showLockedWorkflow(id, sentence) {
|
|
2068
2122
|
closeDraftView();
|
|
2069
2123
|
currentId = null;
|
|
2124
|
+
if (globalThis.flolessStartPlace) rememberWorkflowPlace();
|
|
2070
2125
|
workflowSelectionGeneration += 1;
|
|
2071
2126
|
// Nothing of the workflow that was open before may stay beside the locked canvas: its nodes, Inspector, run
|
|
2072
2127
|
// state, approval strip, live run strip, Customize, update pill, unsaved dot and Agent-step banner all clear.
|
|
@@ -2142,6 +2197,7 @@
|
|
|
2142
2197
|
await commitPublicationAvailability(id, read, contractState);
|
|
2143
2198
|
if (ticket !== selectionTicket) return; // a newer selection also wins during the availability wait
|
|
2144
2199
|
currentId = id;
|
|
2200
|
+
if (globalThis.flolessStartPlace) rememberWorkflowPlace();
|
|
2145
2201
|
workflowSelectionGeneration += 1;
|
|
2146
2202
|
if (id === 'tekla-model-report' || id === 'floless-workspace-model-report') {
|
|
2147
2203
|
void refreshSelectedCompleteReportDiscovery(id);
|
|
@@ -2327,6 +2383,19 @@
|
|
|
2327
2383
|
if (wfLanding) renderWorkflowsLanding();
|
|
2328
2384
|
return;
|
|
2329
2385
|
}
|
|
2386
|
+
const place = globalThis.flolessStartPlace;
|
|
2387
|
+
const restoringTab = !wfLandingBooted && !wfLanding && place?.resumed && place.initial.mode === 'workflows'
|
|
2388
|
+
&& place.read(location.hash).mode === 'workflows' && place.read(location.hash).workflow === place.initial.workflow;
|
|
2389
|
+
const resumeId = restoringTab ? place.initial.workflow : null;
|
|
2390
|
+
const missingWorkflow = async () => {
|
|
2391
|
+
if (!globalThis.flolessWorkspaces && document.readyState === 'loading') {
|
|
2392
|
+
await new Promise((resolve) => document.addEventListener('DOMContentLoaded', resolve, { once: true }));
|
|
2393
|
+
}
|
|
2394
|
+
await globalThis.flolessWorkspaces?.setMode('workspaces');
|
|
2395
|
+
globalThis.showStartPlaceToast?.('workflow');
|
|
2396
|
+
};
|
|
2397
|
+
const restoreMissing = resumeId && !list.some((app) => app.id === resumeId);
|
|
2398
|
+
if (restoreMissing) await missingWorkflow();
|
|
2330
2399
|
$promptSel.innerHTML = '';
|
|
2331
2400
|
if (!list.length) {
|
|
2332
2401
|
// The guided empty-state panel owns the "install a workflow" message now —
|
|
@@ -2348,6 +2417,7 @@
|
|
|
2348
2417
|
// #1890: an empty library is where the landing matters most: its New workflow card is the way in.
|
|
2349
2418
|
if (!wfLandingBooted) { wfLandingBooted = true; showWorkflowsLanding(true); }
|
|
2350
2419
|
else if (wfLanding) renderWorkflowsLanding();
|
|
2420
|
+
if (restoringTab && !resumeId) globalThis.showStartPlaceToast?.();
|
|
2351
2421
|
return;
|
|
2352
2422
|
}
|
|
2353
2423
|
const $apps = document.getElementById('apps-count');
|
|
@@ -2378,11 +2448,18 @@
|
|
|
2378
2448
|
}
|
|
2379
2449
|
let saved = null;
|
|
2380
2450
|
try { saved = localStorage.getItem(LS_LAST_APP); } catch { /* ignore */ }
|
|
2381
|
-
const startId = chooseStartWorkflow(list, saved);
|
|
2451
|
+
const startId = (restoreMissing ? null : resumeId) || chooseStartWorkflow(list, saved);
|
|
2382
2452
|
const ticketBefore = selectionTicket;
|
|
2383
2453
|
try {
|
|
2384
2454
|
await loadApp(startId);
|
|
2385
2455
|
} catch (error) {
|
|
2456
|
+
if (resumeId && !restoreMissing && error?.status === 404
|
|
2457
|
+
&& selectionTicket === ticketBefore + 1 && generation === appsLoadGeneration) {
|
|
2458
|
+
await missingWorkflow();
|
|
2459
|
+
showWorkflowsLanding(true);
|
|
2460
|
+
wfLandingBooted = true;
|
|
2461
|
+
return;
|
|
2462
|
+
}
|
|
2386
2463
|
// #1890 PR 3b-0: an owned workflow being uninstalled outside FloLess can still be listed for a moment (its lock is
|
|
2387
2464
|
// gone, its folder not yet), so loading it fails. Its installed copy is missing: show its recovery view now —
|
|
2388
2465
|
// unless something newer was opened meanwhile, which wins.
|
|
@@ -2396,8 +2473,11 @@
|
|
|
2396
2473
|
}
|
|
2397
2474
|
// #1890: the Workflows tab starts on its landing (owner: people start there and tell AI Chat what they want); a
|
|
2398
2475
|
// later refresh (rename, delete, apps-changed) keeps whatever is showing.
|
|
2399
|
-
if (!wfLandingBooted) {
|
|
2400
|
-
|
|
2476
|
+
if (!wfLandingBooted) {
|
|
2477
|
+
wfLandingBooted = true;
|
|
2478
|
+
if (!resumeId || restoreMissing || !currentId) showWorkflowsLanding(true);
|
|
2479
|
+
if (restoringTab && !restoreMissing && (!resumeId || currentId === resumeId)) globalThis.showStartPlaceToast?.();
|
|
2480
|
+
} else if (wfLanding) renderWorkflowsLanding();
|
|
2401
2481
|
}
|
|
2402
2482
|
|
|
2403
2483
|
// ── Workflow combobox (searchable, provider-grouped) ─────────────────────────
|
|
@@ -10201,6 +10281,13 @@
|
|
|
10201
10281
|
}
|
|
10202
10282
|
}
|
|
10203
10283
|
const check = awareUpdateCheck || {};
|
|
10284
|
+
// #3420, #4008: while AWARE updates are held the server refuses an upgrade, so every caller is taken to the switch that
|
|
10285
|
+
// lets the person decide, exactly as the footer pill is. A live job or an unacknowledged failure keeps its dialog.
|
|
10286
|
+
if (!awareBusy(current.status) && !awareNeedsAttention(current) && window.flolessAwareHold?.ownsOffer(check)) {
|
|
10287
|
+
// After the click that asked for it: the page closes the ≡ menu on any click outside it.
|
|
10288
|
+
setTimeout(() => { void window.flolessAwareHold.openInMenu(); }, 0);
|
|
10289
|
+
return;
|
|
10290
|
+
}
|
|
10204
10291
|
// A pending recovery wins over the version check, which cannot see one: `check.operation` is
|
|
10205
10292
|
// 'none' on a machine already at the newest release — and 'none' is TRUTHY, so it beat the
|
|
10206
10293
|
// pill's own dataset and opened this dialog titled "Upgrade AWARE" over an interrupted update.
|
|
@@ -10285,6 +10372,8 @@
|
|
|
10285
10372
|
} else if (s.status === 'success') {
|
|
10286
10373
|
const version = s.observedVersion || s.target;
|
|
10287
10374
|
awareMaintenanceRecover(s);
|
|
10375
|
+
// The job is over: whatever waited for this AWARE (a setup that found it too old, #4008) reads the catalogue again.
|
|
10376
|
+
window.dispatchEvent(new CustomEvent('floless:apps-changed', { detail: {} }));
|
|
10288
10377
|
const wv = document.getElementById('aware-version');
|
|
10289
10378
|
if (wv && version) {
|
|
10290
10379
|
wv.textContent = 'AWARE ' + version;
|
|
@@ -11819,6 +11908,8 @@
|
|
|
11819
11908
|
if (healthAwareSeen !== undefined && seen !== healthAwareSeen) {
|
|
11820
11909
|
refreshAwareUpdate();
|
|
11821
11910
|
void window.flolessAwareHold?.refresh();
|
|
11911
|
+
// #4008: a setup that stopped because AWARE was too old runs again when the catalogue is next read.
|
|
11912
|
+
window.dispatchEvent(new CustomEvent('floless:apps-changed', { detail: {} }));
|
|
11822
11913
|
}
|
|
11823
11914
|
healthAwareSeen = seen;
|
|
11824
11915
|
}
|
|
@@ -12124,6 +12215,8 @@
|
|
|
12124
12215
|
rev: Number.isInteger(m.rev) ? m.rev : null, prevSha: typeof m.prevSha === 'string' ? m.prevSha : null,
|
|
12125
12216
|
sha: typeof m.sha === 'string' ? m.sha : null, origin: m.origin && typeof m.origin === 'object' ? m.origin : null,
|
|
12126
12217
|
mutationId: typeof m.mutationId === 'string' ? m.mutationId : null,
|
|
12218
|
+
// S1c: a conversion landed (the working copy may be unchanged), so the shapes' conversion states are read again.
|
|
12219
|
+
conversion: m.conversion === true,
|
|
12127
12220
|
} }));
|
|
12128
12221
|
} else if (m.type === 'pages-changed') {
|
|
12129
12222
|
// #2702: a Page was created, got a version, was shared, published, revoked or deleted — from the chat, a workflow
|
|
@@ -12340,9 +12433,22 @@
|
|
|
12340
12433
|
if (slot) slot.innerHTML = '';
|
|
12341
12434
|
showToast(`Connected ${m.id}`, 'ok');
|
|
12342
12435
|
refreshIntegrations(`Connected ${m.id}. Account readiness updated.`);
|
|
12436
|
+
} else if (slot && channelSignIns.has(m.id)) {
|
|
12437
|
+
// FloLess learns only that it failed, so it names the likely step without claiming a cause (plan §2.2).
|
|
12438
|
+
const alias = channelSignIns.get(m.id);
|
|
12439
|
+
const attr = (choice) => `data-int="${escapeAttr(m.id)}"${alias ? ` data-int-alias="${escapeAttr(alias)}"` : ''} data-int-chread-connect="${choice}"`;
|
|
12440
|
+
slot.innerHTML = `<span class="int-chread-question">${escapeHtml(CHANNEL_SIGN_IN_FAILED)}</span><span class="int-chread-choices">`
|
|
12441
|
+
+ `<button type="button" class="int-action primary" ${attr('without')} data-command-id="shell.integrations-channel-connect#without" data-command-instance-label="Sign in without channel reading">Sign in without channel reading</button>`
|
|
12442
|
+
+ `<button type="button" class="int-action" ${attr('retry')} data-command-id="shell.integrations-channel-connect#retry" data-command-instance-label="Try again">Try again</button></span>`;
|
|
12343
12443
|
} else if (slot) {
|
|
12344
12444
|
slot.innerHTML = connectResultSlotHtml(m);
|
|
12345
12445
|
}
|
|
12446
|
+
channelSignIns.delete(m.id);
|
|
12447
|
+
} else if (m.type === 'channel-reading') {
|
|
12448
|
+
// #2470 R6.8 slice 4: a Teams channel switch was saved here, in another window or from AI Chat.
|
|
12449
|
+
if ($integrationsModal.classList.contains('show')) refreshIntegrations();
|
|
12450
|
+
// #3738 F1: an open Knowledge step re-reads its channel rows, which say whether reading is on.
|
|
12451
|
+
window.dispatchEvent(new CustomEvent('floless:channel-reading-changed'));
|
|
12346
12452
|
} else if (m.type === 'disconnect-result') {
|
|
12347
12453
|
// #3301: a service was disconnected (here, in another window or from AI Chat): every open Integrations flips.
|
|
12348
12454
|
refreshIntegrations();
|
|
@@ -12875,13 +12981,20 @@
|
|
|
12875
12981
|
* way into a conversation or a run shares (#1607): 'ready', 'setup' (FloLess sets up its own copy
|
|
12876
12982
|
* when the conversation opens, and the chat waits for it), or 'unavailable'.
|
|
12877
12983
|
*
|
|
12878
|
-
* It follows what FloLess would LAUNCH
|
|
12879
|
-
*
|
|
12880
|
-
*
|
|
12881
|
-
*
|
|
12984
|
+
* It follows what FloLess would LAUNCH, and the server says which: every row of
|
|
12985
|
+
* `/api/terminal-runtimes` carries `readiness`, from the same `runtimeStartReadiness` the server's
|
|
12986
|
+
* default (`resolveProvider`) uses, and that answer is taken as given (#4079). The table below reads
|
|
12987
|
+
* only a row without it, and is pinned identical to the server's: a row carries `managed` exactly
|
|
12988
|
+
* when FloLess launches its own tested copy (`isManagedLaunch`, server/terminal-runtime.ts); then the
|
|
12989
|
+
* user's own install is irrelevant and only that copy's state counts. Without managed launch the
|
|
12990
|
+
* user's install is what runs, so `state: 'found'` is the test. Never read `state` alone as "can
|
|
12991
|
+
* start": FloLess's own copy reads `not-found` and starts. Anything unnamed fails closed.
|
|
12882
12992
|
*/
|
|
12883
12993
|
function chatRuntimeReadiness(runtime) {
|
|
12884
12994
|
if (!runtime || (runtime.id !== 'claude' && runtime.id !== 'codex')) return 'unavailable';
|
|
12995
|
+
if (runtime.readiness !== undefined) {
|
|
12996
|
+
return runtime.readiness === 'ready' || runtime.readiness === 'setup' ? runtime.readiness : 'unavailable';
|
|
12997
|
+
}
|
|
12885
12998
|
const managed = runtime.managed;
|
|
12886
12999
|
if (managed && typeof managed === 'object') {
|
|
12887
13000
|
if (managed.state === 'installed') return 'ready';
|
|
@@ -16666,10 +16779,12 @@
|
|
|
16666
16779
|
}
|
|
16667
16780
|
}
|
|
16668
16781
|
if (!pendingIntegrationFocus || !$integrationsModal.classList.contains('show')) return;
|
|
16669
|
-
|
|
16782
|
+
// `<integration>#channel-reading` lands on that card's Teams channel switch (#2470 R6.8 slice 4, plan §3.2).
|
|
16783
|
+
const [integrationId, part] = pendingIntegrationFocus.split('#');
|
|
16784
|
+
const id = (window.CSS && CSS.escape) ? CSS.escape(integrationId) : integrationId;
|
|
16670
16785
|
const row = $integrationsList.querySelector(`[data-integration-id="${id}"]`);
|
|
16671
16786
|
if (!row) return;
|
|
16672
|
-
const target = row.querySelector('button:not([hidden])') || row;
|
|
16787
|
+
const target = (part === 'channel-reading' && row.querySelector('[data-int-chread]')) || row.querySelector('button:not([hidden])') || row;
|
|
16673
16788
|
row.scrollIntoView({ block: 'nearest' });
|
|
16674
16789
|
target.focus({ preventScroll: true });
|
|
16675
16790
|
pendingIntegrationFocus = '';
|
|
@@ -17026,8 +17141,12 @@
|
|
|
17026
17141
|
// is open. Called on open and whenever a credential file changes (SSE), so an
|
|
17027
17142
|
// open window flips to Connected the moment `aware connect` writes the token.
|
|
17028
17143
|
function refreshIntegrations(announcement = '') {
|
|
17029
|
-
|
|
17030
|
-
|
|
17144
|
+
// #3738 F2: a list already on screen stays while it is checked again, so a refresh (a click's own, or the event the
|
|
17145
|
+
// same save broadcasts) never collapses it to "Checking integrations…" and sends the person back to the top.
|
|
17146
|
+
if (integrationsLoadState !== 'loaded') {
|
|
17147
|
+
integrationsLoadState = 'loading';
|
|
17148
|
+
if ($integrationsModal.classList.contains('show')) renderIntegrations();
|
|
17149
|
+
}
|
|
17031
17150
|
return api('/api/integrations')
|
|
17032
17151
|
.then(({ integrations: list }) => {
|
|
17033
17152
|
integrations = Array.isArray(list) ? list : [];
|
|
@@ -17080,7 +17199,83 @@
|
|
|
17080
17199
|
+ 'You can keep using this account meanwhile.</span></div>';
|
|
17081
17200
|
}
|
|
17082
17201
|
|
|
17083
|
-
|
|
17202
|
+
/**
|
|
17203
|
+
* #2470 R6.8 slice 4 (plan §2.1, §2.2, §2.5): a work or school Microsoft 365 account's "Read Teams channel messages"
|
|
17204
|
+
* switch. It saves at once, with no sign-in. The line under it says what Microsoft and the installed AWARE allow, from
|
|
17205
|
+
* the server's live check of the channel read, never from what a sign-in asked for. `note` is what this window last did
|
|
17206
|
+
* to the switch: saved, switched off (and which watchers that stopped), the sign-in explanation, or a save that failed.
|
|
17207
|
+
*/
|
|
17208
|
+
function channelReadingHtml(slot, accountName, note) {
|
|
17209
|
+
const cr = slot.channelReading;
|
|
17210
|
+
const key = slot.alias || '';
|
|
17211
|
+
const base = `int-chread-${(slot.alias || 'default').replace(/[^A-Za-z0-9_-]/g, '-')}`;
|
|
17212
|
+
const on = cr.on === true;
|
|
17213
|
+
const lines = [];
|
|
17214
|
+
let action = '';
|
|
17215
|
+
if (cr.unreadable) {
|
|
17216
|
+
lines.push('FloLess couldn’t read its saved Teams channel settings, so it isn’t reading any channel. Close Integrations and open it again.');
|
|
17217
|
+
} else if (!on) {
|
|
17218
|
+
lines.push('FloLess does not read Teams channels for this account.');
|
|
17219
|
+
// Switching off never takes the permission away from Microsoft (plan §2.5), so the row says who can.
|
|
17220
|
+
if (cr.permission === 'granted') lines.push('Microsoft still allows it, because your organisation approved it. Only a Microsoft 365 administrator can remove that approval, and removing it affects everyone in your organisation who uses FloLess Desktop.');
|
|
17221
|
+
} else if (cr.permission === 'granted') {
|
|
17222
|
+
lines.push('FloLess can read Teams channels for this account.');
|
|
17223
|
+
} else if (cr.permission === 'missing') {
|
|
17224
|
+
lines.push('Microsoft has not given FloLess permission to read channels yet.');
|
|
17225
|
+
action = `<button type="button" class="int-action int-chread-act" data-int-chread-ask="${escapeAttr(key)}"`
|
|
17226
|
+
+ ` data-command-id="shell.integrations-channel-reading-ask#${escapeAttr(key || 'default')}" data-command-instance-label="${escapeAttr(accountName)}">Sign in to ask for it</button>`;
|
|
17227
|
+
} else if (cr.permission === 'update-aware') {
|
|
17228
|
+
lines.push('The installed AWARE can’t read Teams channels yet, so FloLess isn’t reading them for this account. Update AWARE to start.');
|
|
17229
|
+
action = `<button type="button" class="int-action int-chread-act" data-int-chread-update`
|
|
17230
|
+
+ ` data-command-id="shell.integrations-channel-reading-update#${escapeAttr(key || 'default')}" data-command-instance-label="${escapeAttr(accountName)}">Update AWARE</button>`;
|
|
17231
|
+
} else if (cr.permission === 'sign-in') {
|
|
17232
|
+
// AWARE answered: the account's sign-in stands in the way (review R2), so the step is Reconnect, not "check again".
|
|
17233
|
+
lines.push('The switch is on, but this account’s Microsoft 365 sign-in can’t be used to read Teams channels right now. Reconnect the account to fix it.');
|
|
17234
|
+
} else {
|
|
17235
|
+
// On, but the live check gave no answer (review R1): never silent, and never claimed as allowed.
|
|
17236
|
+
lines.push('The switch is on, but FloLess couldn’t check just now whether Microsoft allows it to read Teams channels for this account. Close Integrations and open it again to check.');
|
|
17237
|
+
}
|
|
17238
|
+
// What the last click here did, kept across the redraw it caused (the designer pass: one status line per row, no toasts).
|
|
17239
|
+
let said = '';
|
|
17240
|
+
if (note && note.kind === 'saved') said = '<span class="int-chread-saved">Saved.</span>';
|
|
17241
|
+
else if (note && note.kind === 'error') said = `<span class="int-chread-error">${escapeHtml(note.text)}</span>`;
|
|
17242
|
+
else if (note && note.kind === 'ask') {
|
|
17243
|
+
// Shown once before the browser opens (plan §2.2): the permission is the administrator's to approve.
|
|
17244
|
+
said = '<span class="int-chread-explain">Reading Teams channel messages needs a permission that only a Microsoft 365 administrator can approve for your organisation. '
|
|
17245
|
+
+ 'Microsoft may show a page asking for an admin’s approval. Some organisations let you send that request from the page; then you wait for your admin to approve it. '
|
|
17246
|
+
+ 'FloLess only reads channel messages; it never posts.</span>'
|
|
17247
|
+
+ `<span class="int-chread-choices"><button type="button" class="int-action" data-int-chread-ask-cancel="${escapeAttr(key)}" data-command-id="shell.integrations-channel-reading-ask-cancel">Not now</button>`
|
|
17248
|
+
+ `<button type="button" class="int-action primary" data-int-chread-sign-in="${escapeAttr(key)}" data-command-id="shell.integrations-channel-reading-sign-in#${escapeAttr(key || 'default')}"`
|
|
17249
|
+
+ ` data-command-instance-label="${escapeAttr(accountName)}">Sign in and ask</button></span>`;
|
|
17250
|
+
} else if (note && note.kind === 'off') {
|
|
17251
|
+
const stopped = Array.isArray(note.stopped) ? note.stopped : [];
|
|
17252
|
+
const list = stopped.length
|
|
17253
|
+
? `<span class="int-chread-stopped-head">Stopped ${stopped.length === 1 ? '1 watcher' : `${stopped.length} watchers`} that read Teams channels:</span>`
|
|
17254
|
+
+ `<ul class="int-chread-stopped">${stopped.map((w) => `<li><span class="int-chread-watcher" data-tip="${escapeAttr(w.name)}">${escapeHtml(w.name)}</span>`
|
|
17255
|
+
+ `<button type="button" class="int-link" data-int-chread-restart data-app="${escapeAttr(w.restart?.app || '')}"${w.restart?.routineId ? ` data-routine="${escapeAttr(w.restart.routineId)}"` : ''}`
|
|
17256
|
+
+ ` data-tip="Opens it so you can start it again. While reading is off it asks before it reads a channel"`
|
|
17257
|
+
+ ` data-command-id="shell.integrations-channel-reading-restart#${escapeAttr(w.sessionId || w.name)}" data-command-instance-label="${escapeAttr(w.name)}">Open to restart</button></li>`).join('')}</ul>`
|
|
17258
|
+
: '';
|
|
17259
|
+
const failed = Array.isArray(note.failed) ? note.failed.filter((w) => w && w.name) : [];
|
|
17260
|
+
const unclear = note.unclear ? `<span class="int-chread-error">${failed.length
|
|
17261
|
+
? `FloLess couldn’t stop ${failed.length === 1 ? 'this watcher' : 'these watchers'}, so ${failed.length === 1 ? 'it may still read' : 'they may still read'} Teams channels: ${failed.map((w) => escapeHtml(w.name)).join(', ')}. Open Routines to stop ${failed.length === 1 ? 'it' : 'them'}.`
|
|
17262
|
+
: 'FloLess couldn’t stop every watcher that reads Teams channels. Open Routines to check them.'}</span>`
|
|
17263
|
+
+ '<button type="button" class="int-link" data-int-chread-routines data-command-id="shell.integrations-channel-reading-routines">Open Routines</button>' : '';
|
|
17264
|
+
said = list + unclear + (note.note ? `<span class="int-chread-inflight">${escapeHtml(note.note)}</span>` : '')
|
|
17265
|
+
+ `<button type="button" class="int-link int-chread-dismiss" data-int-chread-dismiss="${escapeAttr(key)}" data-command-id="shell.integrations-channel-reading-dismiss">Dismiss</button>`;
|
|
17266
|
+
}
|
|
17267
|
+
return `<div class="int-chread" data-int-chread-row="${escapeAttr(key)}">`
|
|
17268
|
+
+ `<span class="int-chread-switch"><button type="button" class="kb-toggle" role="switch" aria-checked="${on ? 'true' : 'false'}"`
|
|
17269
|
+
+ ` aria-labelledby="${base}-label" aria-describedby="${base}-line" data-int-chread="${escapeAttr(key)}"`
|
|
17270
|
+
+ ` data-principal="${escapeAttr(cr.principal || '')}" data-tenant="${escapeAttr(cr.tenant || '')}" data-revision="${escapeAttr(String(cr.revision ?? 0))}"`
|
|
17271
|
+
+ ` data-tip="${on ? 'On: FloLess may read Teams channels for this account. Click to switch off' : 'Off: FloLess reads no Teams channel for this account. Click to switch on'}"`
|
|
17272
|
+
+ ` data-command-id="shell.integrations-channel-reading#${escapeAttr(key || 'default')}" data-command-instance-label="${escapeAttr(accountName)}"></button>`
|
|
17273
|
+
+ `<span class="int-chread-label" id="${base}-label">Read Teams channel messages</span></span>`
|
|
17274
|
+
+ `<span class="int-chread-line" id="${base}-line">${lines.map(escapeHtml).join(' ')}</span>${action}`
|
|
17275
|
+
+ `<span class="int-chread-note" role="status">${said}</span></div>`;
|
|
17276
|
+
}
|
|
17277
|
+
|
|
17278
|
+
function renderIntegrationAccounts(integration, channelNotes = null) {
|
|
17084
17279
|
const slots = Array.isArray(integration.accountSlots) ? integration.accountSlots : [];
|
|
17085
17280
|
if (!slots.length) return integration.chatSupported
|
|
17086
17281
|
? `<div class="int-accounts"><div class="int-accounts-label">FLOLESS INTEGRATIONS</div><div class="int-account-empty">No FloLess account connected · Connect to use with AI Chat.</div></div>`
|
|
@@ -17167,6 +17362,7 @@
|
|
|
17167
17362
|
${access}
|
|
17168
17363
|
${grantNotice}
|
|
17169
17364
|
<span class="int-account-reason">${escapeHtml(why)}</span>
|
|
17365
|
+
${integration.id === 'microsoft-365' && slot.channelReading ? channelReadingHtml(slot, account, channelNotes ? channelNotes.get(slot.alias || '') : null) : ''}
|
|
17170
17366
|
${mailChoice}
|
|
17171
17367
|
${reconnect}
|
|
17172
17368
|
</div>`;
|
|
@@ -17491,7 +17687,7 @@
|
|
|
17491
17687
|
<div class="int-scopes">${escapeHtml((i.network || []).join(' · ') || '—')}</div>
|
|
17492
17688
|
<div class="int-meta">${escapeHtml(meta)}</div>
|
|
17493
17689
|
${microsoftHelp}
|
|
17494
|
-
${renderIntegrationAccounts(i)}
|
|
17690
|
+
${renderIntegrationAccounts(i, channelReadingNotes)}
|
|
17495
17691
|
<div class="conn-int" data-conn-int="${escapeAttr(i.id)}"></div>
|
|
17496
17692
|
${google ? google.notice + google.driveChoice + google.driveNote + google.mailChoice + google.mailNote : ''}
|
|
17497
17693
|
<div class="int-row">
|
|
@@ -17510,6 +17706,119 @@
|
|
|
17510
17706
|
</div>`;
|
|
17511
17707
|
}
|
|
17512
17708
|
|
|
17709
|
+
// #2470 R6.8 slice 4: what this window last did to each Microsoft 365 account's Teams channel switch, by alias ('' is the
|
|
17710
|
+
// default account), kept across the redraw the click causes. A 'saved' note fades after a few seconds.
|
|
17711
|
+
const channelReadingNotes = new Map();
|
|
17712
|
+
// Sign-ins that ask Microsoft for channel access ("Sign in and ask", or a Reconnect with the switch on), by integration
|
|
17713
|
+
// id → alias: their failure says what to do about the approval and offers signing in without it.
|
|
17714
|
+
const channelSignIns = new Map();
|
|
17715
|
+
const CHANNEL_SIGN_IN_FAILED = 'Microsoft did not finish the sign-in. If it asked for an administrator’s approval, ask your admin to approve FloLess Desktop, then try again. You can also sign in without channel reading; everything else keeps working.';
|
|
17716
|
+
|
|
17717
|
+
// #3738 F2: the redraw replaces the list, so the place is kept across it and the row that was acted on (with its note)
|
|
17718
|
+
// is brought into view.
|
|
17719
|
+
const integrationsScroller = () => {
|
|
17720
|
+
for (let el = $integrationsList; el && el !== document.body; el = el.parentElement) {
|
|
17721
|
+
if (/(auto|scroll)/.test(getComputedStyle(el).overflowY) && el.scrollHeight > el.clientHeight) return el;
|
|
17722
|
+
}
|
|
17723
|
+
return null;
|
|
17724
|
+
};
|
|
17725
|
+
async function refreshKeepingFocus(selector, rowSelector) {
|
|
17726
|
+
const scroller = integrationsScroller();
|
|
17727
|
+
const top = scroller ? scroller.scrollTop : 0;
|
|
17728
|
+
await refreshIntegrations();
|
|
17729
|
+
if (scroller && scroller.isConnected) scroller.scrollTop = top;
|
|
17730
|
+
const target = selector && $integrationsList.querySelector(selector);
|
|
17731
|
+
(target || document.getElementById('integrations-title'))?.focus({ preventScroll: true });
|
|
17732
|
+
const row = rowSelector && $integrationsList.querySelector(rowSelector);
|
|
17733
|
+
if (row) row.scrollIntoView({ block: 'nearest' });
|
|
17734
|
+
}
|
|
17735
|
+
const chreadSelector = (key, attr = 'data-int-chread') => `[${attr}="${(window.CSS && CSS.escape) ? CSS.escape(key) : key}"]`;
|
|
17736
|
+
|
|
17737
|
+
/** Save the switch at once, against the account and revision this row was drawn for; a 409 redraws the current state. */
|
|
17738
|
+
async function toggleChannelReading(btn) {
|
|
17739
|
+
const key = btn.dataset.intChread || '';
|
|
17740
|
+
const on = btn.getAttribute('aria-checked') !== 'true';
|
|
17741
|
+
btn.disabled = true;
|
|
17742
|
+
btn.setAttribute('aria-busy', 'true');
|
|
17743
|
+
try {
|
|
17744
|
+
const res = await api('/api/integrations/microsoft-365/channel-reading', { method: 'PUT', body: JSON.stringify({
|
|
17745
|
+
alias: key || null, expected: { principal: btn.dataset.principal, tenant: btn.dataset.tenant },
|
|
17746
|
+
expectedRevision: Number(btn.dataset.revision) || 0, on }) });
|
|
17747
|
+
channelReadingNotes.set(key, on || !res.stoppedWatchers
|
|
17748
|
+
? { kind: 'saved', at: Date.now() }
|
|
17749
|
+
: { kind: 'off', stopped: res.stoppedWatchers, failed: Array.isArray(res.failedWatchers) ? res.failedWatchers : [],
|
|
17750
|
+
unclear: !!res.watchersUnclear, note: typeof res.note === 'string' ? res.note : '' });
|
|
17751
|
+
} catch (error) {
|
|
17752
|
+
const said = (error && error.body && personText(error.body)) || 'FloLess couldn’t save the Teams channel setting, so the previous one still applies. Try again.';
|
|
17753
|
+
channelReadingNotes.set(key, { kind: 'error', text: said });
|
|
17754
|
+
}
|
|
17755
|
+
await refreshKeepingFocus(chreadSelector(key), chreadSelector(key, 'data-int-chread-row'));
|
|
17756
|
+
const note = channelReadingNotes.get(key);
|
|
17757
|
+
if (note && note.kind === 'saved') {
|
|
17758
|
+
setTimeout(() => { if (channelReadingNotes.get(key) === note) { channelReadingNotes.delete(key); if ($integrationsModal.classList.contains('show')) { const n = $integrationsList.querySelector(`${chreadSelector(key, 'data-int-chread-row')} .int-chread-saved`); if (n) n.remove(); } } }, 4000);
|
|
17759
|
+
}
|
|
17760
|
+
}
|
|
17761
|
+
|
|
17762
|
+
$integrationsList.addEventListener('click', (e) => {
|
|
17763
|
+
const t = e.target instanceof Element ? e.target : null;
|
|
17764
|
+
if (!t) return;
|
|
17765
|
+
const toggle = t.closest('[data-int-chread]');
|
|
17766
|
+
if (toggle) { void toggleChannelReading(toggle); return; }
|
|
17767
|
+
const ask = t.closest('[data-int-chread-ask]');
|
|
17768
|
+
if (ask) { const key = ask.dataset.intChreadAsk || ''; channelReadingNotes.set(key, { kind: 'ask' }); renderIntegrations(); $integrationsList.querySelector(chreadSelector(key, 'data-int-chread-sign-in'))?.focus(); return; }
|
|
17769
|
+
const cancel = t.closest('[data-int-chread-ask-cancel]');
|
|
17770
|
+
if (cancel) { const key = cancel.dataset.intChreadAskCancel || ''; channelReadingNotes.delete(key); renderIntegrations(); $integrationsList.querySelector(chreadSelector(key, 'data-int-chread-ask'))?.focus(); return; }
|
|
17771
|
+
const signIn = t.closest('[data-int-chread-sign-in]');
|
|
17772
|
+
if (signIn) {
|
|
17773
|
+
const key = signIn.dataset.intChreadSignIn || '';
|
|
17774
|
+
channelReadingNotes.delete(key);
|
|
17775
|
+
renderIntegrations();
|
|
17776
|
+
void startConnect(MICROSOFT_INTEGRATION_ID, { ...(key ? { alias: key } : {}), channels: true });
|
|
17777
|
+
return;
|
|
17778
|
+
}
|
|
17779
|
+
const dismiss = t.closest('[data-int-chread-dismiss]');
|
|
17780
|
+
if (dismiss) { const key = dismiss.dataset.intChreadDismiss || ''; channelReadingNotes.delete(key); renderIntegrations(); $integrationsList.querySelector(chreadSelector(key))?.focus(); return; }
|
|
17781
|
+
if (t.closest('[data-int-chread-update]')) { void applyAwareUpdate(''); return; }
|
|
17782
|
+
if (t.closest('[data-int-chread-routines]')) { hideModal($integrationsModal); openRoutines(); return; }
|
|
17783
|
+
const restart = t.closest('[data-int-chread-restart]');
|
|
17784
|
+
if (restart) {
|
|
17785
|
+
// A watcher starts again from where the person starts it, with its own inputs; there it goes through the run-start
|
|
17786
|
+
// check again, which asks while reading is off.
|
|
17787
|
+
hideModal($integrationsModal);
|
|
17788
|
+
if (restart.dataset.routine) void openRoutineEdit(restart.dataset.routine);
|
|
17789
|
+
else if (restart.dataset.app) openWorkflowFromLanding(restart.dataset.app);
|
|
17790
|
+
return;
|
|
17791
|
+
}
|
|
17792
|
+
// The Connect question and the sign-in choices (plan §2.2; master ruling 2026-11-17: nothing refuses, it asks).
|
|
17793
|
+
const answer = t.closest('[data-int-chread-connect]');
|
|
17794
|
+
if (answer) {
|
|
17795
|
+
const id = answer.dataset.int;
|
|
17796
|
+
const alias = answer.dataset.intAlias || '';
|
|
17797
|
+
const choice = answer.dataset.intChreadConnect;
|
|
17798
|
+
if (choice === 'wait') { const slot = dcSlot(id); slot?.querySelector('.int-chread-choices')?.remove(); return; }
|
|
17799
|
+
connecting.delete(id);
|
|
17800
|
+
// Switch on and connect names the account and setting the question was about, so a sign-in that changed meanwhile
|
|
17801
|
+
// asks again instead of switching on another account (review R1).
|
|
17802
|
+
const expected = choice === 'switch-on' && answer.dataset.principal && answer.dataset.tenant
|
|
17803
|
+
? { principal: answer.dataset.principal, tenant: answer.dataset.tenant, revision: Number(answer.dataset.revision) || 0 } : null;
|
|
17804
|
+
void startConnect(id, { ...(alias ? { alias } : {}), channels: choice === 'switch-on' ? 'switch-on' : choice === 'retry' ? true : false,
|
|
17805
|
+
...(expected ? { channelsExpected: expected } : {}) });
|
|
17806
|
+
}
|
|
17807
|
+
});
|
|
17808
|
+
|
|
17809
|
+
/** The question a Microsoft 365 connect answers instead of starting, with a choice that each ends in a sign-in. */
|
|
17810
|
+
function connectQuestionHtml(id, alias, question, choices, account = null) {
|
|
17811
|
+
const expected = choice => choice === 'switch-on' && account && typeof account.principal === 'string' && typeof account.tenant === 'string'
|
|
17812
|
+
? ` data-principal="${escapeAttr(account.principal)}" data-tenant="${escapeAttr(account.tenant)}" data-revision="${escapeAttr(String(Number(account.revision) || 0))}"` : '';
|
|
17813
|
+
const button = (choice, label, primary) => `<button type="button" class="int-action${primary ? ' primary' : ''}" data-int="${escapeAttr(id)}"`
|
|
17814
|
+
+ `${alias ? ` data-int-alias="${escapeAttr(alias)}"` : ''}${expected(choice)} data-int-chread-connect="${escapeAttr(choice)}" data-command-id="shell.integrations-channel-connect#${escapeAttr(choice)}" data-command-instance-label="${escapeAttr(label)}">${escapeHtml(label)}</button>`;
|
|
17815
|
+
const list = Array.isArray(choices) ? choices : [];
|
|
17816
|
+
return `<span class="int-chread-question">${escapeHtml(question)}</span><span class="int-chread-choices">`
|
|
17817
|
+
+ (list.includes('connect-without-channels') ? button('without', 'Connect without channels', !list.includes('switch-on-and-connect')) : '')
|
|
17818
|
+
+ (list.includes('switch-on-and-connect') ? button('switch-on', 'Switch on and connect', true) : '')
|
|
17819
|
+
+ '</span>' + (list.includes('switch-on-and-connect') ? '<span class="int-chread-hint">You can switch it off again in Integrations at any time.</span>' : '');
|
|
17820
|
+
}
|
|
17821
|
+
|
|
17513
17822
|
// #2470 R6.8 slice 3: the list is rebuilt on every refresh (a sign-in result, a slow reload), and each rebuild presets
|
|
17514
17823
|
// the Drive and Gmail boxes to what Google allows now. A box the person changed keeps their choice until Connect or
|
|
17515
17824
|
// Reconnect sends it, so a refresh between the tick and the click can never quietly ask Google for less.
|
|
@@ -17750,7 +18059,11 @@
|
|
|
17750
18059
|
...(driveToggle ? { drive: driveToggle.checked } : {}),
|
|
17751
18060
|
...(mailToggle ? { mail: mailToggle.checked } : {}),
|
|
17752
18061
|
...(opts.alias ? { alias: opts.alias } : {}),
|
|
18062
|
+
// #2470 R6.8 slice 4: Microsoft 365's Teams channel request, sent only when a choice made it (omitted follows the switch).
|
|
18063
|
+
...(opts.channels !== undefined ? { channels: opts.channels } : {}),
|
|
18064
|
+
...(opts.channelsExpected ? { channelsExpected: opts.channelsExpected } : {}),
|
|
17753
18065
|
});
|
|
18066
|
+
if (opts.channels === true) channelSignIns.set(id, opts.alias || ''); else channelSignIns.delete(id);
|
|
17754
18067
|
// What this request asks for, so only these choices are forgotten once it starts (a box changed while it is pending
|
|
17755
18068
|
// is a newer choice and stays).
|
|
17756
18069
|
const sentChoices = [];
|
|
@@ -17766,9 +18079,21 @@
|
|
|
17766
18079
|
// reason also comes back here, so a card waiting on a reconnecting SSE still says why.
|
|
17767
18080
|
if (connect && connect.started === false) {
|
|
17768
18081
|
connecting.delete(id);
|
|
18082
|
+
channelSignIns.delete(id);
|
|
18083
|
+
// Asked for channel access while the switch is off: a question with its choices, never a refusal.
|
|
18084
|
+
if (slot && connect.channelReading && typeof connect.channelReading.question === 'string') {
|
|
18085
|
+
slot.innerHTML = connectQuestionHtml(id, opts.alias || '', connect.channelReading.question, connect.channelReading.choices, connect.channelReading.account || null);
|
|
18086
|
+
slot.querySelector('.int-action.primary')?.focus();
|
|
18087
|
+
return;
|
|
18088
|
+
}
|
|
17769
18089
|
if (slot && typeof connect.message === 'string') slot.innerHTML = connectResultSlotHtml({ status: 'failed', message: connect.message });
|
|
17770
18090
|
return;
|
|
17771
18091
|
}
|
|
18092
|
+
if (connect && connect.channelReadingSwitchedOn) channelReadingNotes.set(opts.alias || '', { kind: 'saved', at: Date.now() });
|
|
18093
|
+
// The server asked Microsoft for channel access (the switch was on, or the person asked): the sign-in may wait on an
|
|
18094
|
+
// administrator, so it gets the same way out as a sign-in started from the channel question.
|
|
18095
|
+
const channelsAsked = opts.channels === true || (opts.channels !== false && connect && connect.channelsAsked === true);
|
|
18096
|
+
if (channelsAsked) channelSignIns.set(id, opts.alias || '');
|
|
17772
18097
|
// The sign-in started with these choices: from here on the boxes show what Google actually allowed. A start that was
|
|
17773
18098
|
// declined or refused (above, or a busy 409 below) keeps the person's ticks for their next try.
|
|
17774
18099
|
for (const [key, value] of sentChoices) if (integrationScopeChoices.get(key) === value) integrationScopeChoices.delete(key);
|
|
@@ -17782,6 +18107,13 @@
|
|
|
17782
18107
|
// OAuth: aware opened the provider sign-in in the browser.
|
|
17783
18108
|
slot.innerHTML = 'Opening your browser to sign in… complete it there and this will update automatically.';
|
|
17784
18109
|
}
|
|
18110
|
+
// While Microsoft may be asking an administrator, the person can stop waiting and sign in without it (plan §2.2).
|
|
18111
|
+
if (channelsAsked) {
|
|
18112
|
+
const alias = opts.alias || '';
|
|
18113
|
+
const attr = (choice) => `data-int="${escapeAttr(id)}"${alias ? ` data-int-alias="${escapeAttr(alias)}"` : ''} data-int-chread-connect="${choice}"`;
|
|
18114
|
+
slot.insertAdjacentHTML('beforeend', `<span class="int-chread-choices"><button type="button" class="int-action primary" ${attr('without')} data-command-id="shell.integrations-channel-connect#without" data-command-instance-label="Sign in without channel reading">Sign in without channel reading</button>`
|
|
18115
|
+
+ `<button type="button" class="int-action" ${attr('wait')} data-command-id="shell.integrations-channel-connect#wait" data-command-instance-label="Keep waiting">Keep waiting</button></span>`);
|
|
18116
|
+
}
|
|
17785
18117
|
}
|
|
17786
18118
|
} catch (e) {
|
|
17787
18119
|
connecting.delete(id);
|
|
@@ -18221,7 +18553,10 @@
|
|
|
18221
18553
|
for (const id of live) void refreshRoutineReportDiscovery(id);
|
|
18222
18554
|
if (routinesData.some((r) => r.agent)) void refreshRoutineAgents();
|
|
18223
18555
|
// Owner ruling 2026-11-06: the card asking whether to run what was missed while FloLess was closed.
|
|
18224
|
-
try { window.flolessMissedRoutines?.update(routinesData, { api,
|
|
18556
|
+
try { window.flolessMissedRoutines?.update(routinesData, { api,
|
|
18557
|
+
// Review R4 #2: a missed run's questions are answered as on Run now, "Open the workflow" included.
|
|
18558
|
+
postRun: (url, body, routineId) => postAskingElsewhere(url, body, { routine: true, onApprove: () => openRoutineWorkflow(routineId) }),
|
|
18559
|
+
reportErr, reload: loadRoutinesData }); }
|
|
18225
18560
|
catch (err) { console.error('Missed-routines card failed', err); }
|
|
18226
18561
|
if ($routinesModal.classList.contains('show')) renderRoutinesList();
|
|
18227
18562
|
// #3414: an Agent's page shows the routines that run it; it hears every reload, so a saved routine shows at once.
|
|
@@ -19255,14 +19590,16 @@
|
|
|
19255
19590
|
} catch (e) { reportErr(e, 'change this routine'); }
|
|
19256
19591
|
loadRoutinesData();
|
|
19257
19592
|
}
|
|
19593
|
+
/** "Open the workflow" from a routine run's question: Routines closes and the routine's workflow opens, to approve it. */
|
|
19594
|
+
async function openRoutineWorkflow(id) {
|
|
19595
|
+
const workflow = routinesData.find((r) => r.id === id)?.workflow;
|
|
19596
|
+
if (!workflow) return;
|
|
19597
|
+
hideModal($routinesModal);
|
|
19598
|
+
await selectComboById(workflow);
|
|
19599
|
+
}
|
|
19258
19600
|
async function runRoutineNow(id) {
|
|
19259
19601
|
try {
|
|
19260
|
-
|
|
19261
|
-
await postAskingElsewhere(`/api/routines/${encodeURIComponent(id)}/run`, {}, { routine: true, onApprove: async () => {
|
|
19262
|
-
if (!workflow) return;
|
|
19263
|
-
hideModal($routinesModal);
|
|
19264
|
-
await selectComboById(workflow);
|
|
19265
|
-
} });
|
|
19602
|
+
await postAskingElsewhere(`/api/routines/${encodeURIComponent(id)}/run`, {}, { routine: true, onApprove: () => openRoutineWorkflow(id) });
|
|
19266
19603
|
runningRoutines.add(id); // optimistic, for immediate feedback; SSE confirms it moments later
|
|
19267
19604
|
renderRoutinesList();
|
|
19268
19605
|
// #2062: a hand run starts a paused agent; its schedule stays held. Queued, not yet started — the row says how it went.
|
|
@@ -20936,12 +21273,25 @@
|
|
|
20936
21273
|
const WF_TAB_KEY = 'floless.workflowsLandingTab';
|
|
20937
21274
|
const WF_TABS = ['workflows', 'pages', 'history'];
|
|
20938
21275
|
let wfLandingTab = (() => { try { const t = localStorage.getItem(WF_TAB_KEY); return WF_TABS.includes(t) ? t : 'workflows'; } catch { return 'workflows'; } })();
|
|
21276
|
+
function rememberWorkflowPlace() {
|
|
21277
|
+
const boot = document.documentElement.classList;
|
|
21278
|
+
const live = document.body.classList;
|
|
21279
|
+
if (boot.contains('mode-workspaces-boot') || boot.contains('mode-agents-boot')
|
|
21280
|
+
|| live.contains('mode-workspaces') || live.contains('mode-agents')) return;
|
|
21281
|
+
window.flolessStartPlace?.remember({ mode: 'workflows', workflow: wfLanding ? null : currentId });
|
|
21282
|
+
}
|
|
21283
|
+
|
|
20939
21284
|
function showWorkflowsLanding(on) {
|
|
20940
21285
|
const next = Boolean(on);
|
|
20941
|
-
if (next === wfLanding && (!next || $wfLanding?.childElementCount)) {
|
|
21286
|
+
if (next === wfLanding && (!next || $wfLanding?.childElementCount)) {
|
|
21287
|
+
if (globalThis.flolessStartPlace) rememberWorkflowPlace();
|
|
21288
|
+
if (next) renderWorkflowsLanding();
|
|
21289
|
+
return;
|
|
21290
|
+
}
|
|
20942
21291
|
if (next && !wfLanding) wfLandingQuery = ''; // a fresh visit starts unfiltered
|
|
20943
21292
|
wfLanding = next;
|
|
20944
21293
|
if (wfLanding) closeDraftView();
|
|
21294
|
+
if (globalThis.flolessStartPlace) rememberWorkflowPlace();
|
|
20945
21295
|
syncWorkflowCardMenu();
|
|
20946
21296
|
document.body.classList.toggle('wf-landing-open', wfLanding);
|
|
20947
21297
|
if ($wfLanding) $wfLanding.hidden = !wfLanding;
|
|
@@ -21935,6 +22285,7 @@
|
|
|
21935
22285
|
refreshCurrentWorkflow() {
|
|
21936
22286
|
return refreshCurrentWorkflow();
|
|
21937
22287
|
},
|
|
22288
|
+
rememberWorkflowPlace,
|
|
21938
22289
|
// The person-facing sentence of a module refusal (see reportErr), or '' for any other failure.
|
|
21939
22290
|
moduleRefusalText,
|
|
21940
22291
|
// The person-facing sentence of a lapsed sign-in or subscription (HTTP 402), or '' for any other failure.
|
|
@@ -21966,14 +22317,15 @@
|
|
|
21966
22317
|
await loadRequests();
|
|
21967
22318
|
return copied;
|
|
21968
22319
|
},
|
|
21969
|
-
// The steel editor's Ask AI list: an AI
|
|
21970
|
-
//
|
|
21971
|
-
// (
|
|
22320
|
+
// The steel editor's Ask AI list: an AI FloLess can start now with nothing to set up first (`chatRuntimeReadiness`
|
|
22321
|
+
// 'ready' — FloLess's own installed copy as much as the user's install, #4079) that the server approved for
|
|
22322
|
+
// read-only runs (`canRunReadOnly`). Its start sets nothing up first, so an AI FloLess still has to set up is not
|
|
22323
|
+
// offered there (#1652).
|
|
21972
22324
|
async readOnlyRequestOptions() {
|
|
21973
22325
|
const info = await refreshHeadless();
|
|
21974
22326
|
return {
|
|
21975
22327
|
provider: info?.provider || null,
|
|
21976
|
-
found: headlessRuntimes().filter((runtime) => runtime && runtime
|
|
22328
|
+
found: headlessRuntimes().filter((runtime) => runtime && chatRuntimeReadiness(runtime) === 'ready' && runtime.canRunReadOnly === true),
|
|
21977
22329
|
};
|
|
21978
22330
|
},
|
|
21979
22331
|
showRequestQueuedModal,
|
|
@@ -22121,3 +22473,5 @@
|
|
|
22121
22473
|
}
|
|
22122
22474
|
})();
|
|
22123
22475
|
})();
|
|
22476
|
+
window.__flolessCoreReady = Object.assign(window.__flolessCoreReady || {}, { 'aware.js': true });
|
|
22477
|
+
window.flolessBoot?.ready('aware.js');
|