@floless/app 0.104.2 → 0.105.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +9842 -6508
- package/dist/schemas/steel.model.v2.schema.json +652 -0
- package/dist/schemas/steel.takeoff.v1.schema.json +1 -1
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +109 -5
- package/dist/skills/floless-app-tweak-contract/SKILL.md +23 -7
- package/dist/skills/floless-app-vectorize/SKILL.md +21 -5
- package/dist/templates/steel-model.flo +5 -1
- package/dist/templates/vectorize.flo +5 -1
- package/dist/web/app.css +62 -3
- package/dist/web/aware.js +498 -55
- package/dist/web/index.html +28 -1
- package/dist/web/steel-3d-core.js +242 -0
- package/dist/web/steel-3d-view.js +515 -50
- package/dist/web/steel-editor.html +867 -163
- package/dist/web/steel-filter.html +67 -2
- package/dist/web/steel-materials.js +249 -0
- package/dist/web/steel-model-adapter.js +210 -0
- package/dist/web/steel-model-commands.js +691 -0
- package/dist/web/steel-view-generation.js +10 -1
- package/dist/web/vector-editor.html +118 -3
- package/dist/web/vendor/README.md +6 -1
- package/dist/web/vendor/RoomEnvironment.js +185 -0
- package/dist/web/workspaces.js +345 -26
- package/package.json +6 -1
package/dist/web/aware.js
CHANGED
|
@@ -891,9 +891,26 @@
|
|
|
891
891
|
}
|
|
892
892
|
|
|
893
893
|
async function loadApps() {
|
|
894
|
+
// …and mean it: the trigger said "loading…" but stayed CLICKABLE, so a click during the fetch
|
|
895
|
+
// opened the popover onto an empty #wf-list — the exact "picker opens and stays empty, it never
|
|
896
|
+
// says loading, it just looks broken" report in #358. buildWorkflowCombo() re-enables it once
|
|
897
|
+
// there are rows; the no-apps branch keeps it disabled.
|
|
898
|
+
// A REFRESH is different from a cold load: seven callers re-run this after rename/duplicate/
|
|
899
|
+
// delete/fork/restore/import and the apps-changed SSE, and /api/apps can fail transiently (it
|
|
900
|
+
// shells `aware app list`). Disabling unconditionally would strand an ALREADY-BUILT picker dead
|
|
901
|
+
// with no re-enable path — worst on delete, which clears the open workflow first. So a failed
|
|
902
|
+
// refresh restores what the user had; only a load that never had a list stays disabled.
|
|
903
|
+
const wasUsable = !!$wfTrigger && !$wfTrigger.disabled;
|
|
894
904
|
setComboTriggerLabel('loading…');
|
|
905
|
+
if ($wfTrigger) $wfTrigger.disabled = true;
|
|
895
906
|
renderCanvasPlaceholder('loading');
|
|
896
|
-
|
|
907
|
+
let list;
|
|
908
|
+
try {
|
|
909
|
+
({ apps: list } = await api('/api/apps'));
|
|
910
|
+
} catch (e) {
|
|
911
|
+
if (wasUsable && $wfTrigger) $wfTrigger.disabled = false;
|
|
912
|
+
throw e;
|
|
913
|
+
}
|
|
897
914
|
$promptSel.innerHTML = '';
|
|
898
915
|
if (!list.length) {
|
|
899
916
|
// The guided empty-state panel owns the "install a workflow" message now —
|
|
@@ -1194,7 +1211,25 @@
|
|
|
1194
1211
|
dropClientAppState(oldId);
|
|
1195
1212
|
if (wasOpen) { try { localStorage.setItem(LS_LAST_APP, r.id); } catch { /* ignore */ } }
|
|
1196
1213
|
await loadApps();
|
|
1197
|
-
|
|
1214
|
+
// A project that did not follow the rename still opens and still renders, so the user has no
|
|
1215
|
+
// way to notice — they'd meet it later as an Approve that won't go through, with nothing tying
|
|
1216
|
+
// it back to here. So a partial cascade must never read as a plain success. `projectsStale` is
|
|
1217
|
+
// absent in the ordinary case, a count when we know it, and null when the step failed outright.
|
|
1218
|
+
// Parenthesised, not dashed: the warning branches already own the sentence's em-dash, and
|
|
1219
|
+
// "Renamed to “x” — needs Compile — but we couldn't…" reads as two competing asides.
|
|
1220
|
+
const compileNote = r.compiled ? '' : ' (needs Compile)';
|
|
1221
|
+
if (r.projectsStale > 0) {
|
|
1222
|
+
const n = r.projectsStale;
|
|
1223
|
+
showToast(`Renamed to “${r.id}”${compileNote} — but ${n} project${n === 1 ? '' : 's'} didn’t follow, and won’t approve until a workflow named “${oldId}” exists again.`, 'warn');
|
|
1224
|
+
} else if (r.projectsStale === null) {
|
|
1225
|
+
// `null` means the server could NOT account for the projects, and the copy has to say exactly
|
|
1226
|
+
// that. Rendering it as "some projects are stale" would invent the very fact the server
|
|
1227
|
+
// declined to guess — and it would be wrong in the case this branch's own test pins, where the
|
|
1228
|
+
// step threw on the archive pass after every live project had already followed.
|
|
1229
|
+
showToast(`Renamed to “${r.id}”${compileNote} — but we couldn’t confirm your projects followed. If one won’t approve, rename back to “${oldId}” and try again.`, 'warn');
|
|
1230
|
+
} else {
|
|
1231
|
+
showToast(r.compiled ? `Renamed to “${r.id}”` : `Renamed to “${r.id}” — needs Compile`, r.compiled ? 'ok' : 'warn');
|
|
1232
|
+
}
|
|
1198
1233
|
} catch (e) {
|
|
1199
1234
|
console.error(e); // an unexpected client throw (not a clean server message) stays debuggable
|
|
1200
1235
|
showToast(e.message || 'Rename failed', 'warn');
|
|
@@ -1226,21 +1261,115 @@
|
|
|
1226
1261
|
}
|
|
1227
1262
|
|
|
1228
1263
|
async function confirmDeleteWorkflow(id) {
|
|
1264
|
+
// All THREE probes in flight together — they are independent, and every one of them gates the
|
|
1265
|
+
// confirm modal opening, so serializing them just makes the dialog slower to appear.
|
|
1266
|
+
// The contract probe's own reasoning (HEAD not GET, plain fetch not api(), quietMissing) is on
|
|
1267
|
+
// its result-handling below, where the status codes it explains are actually read.
|
|
1268
|
+
const [routinesRes, projectsRes, contractRes] = await Promise.allSettled([
|
|
1269
|
+
api('/api/routines'),
|
|
1270
|
+
api('/api/projects'),
|
|
1271
|
+
fetch('/api/contract/' + encodeURIComponent(id) + '?quietMissing=1', { method: 'HEAD' }),
|
|
1272
|
+
]);
|
|
1273
|
+
// Returns the list, or null for "couldn't read it" — a state that must stay distinct from an
|
|
1274
|
+
// empty list, since the two produce different copy below. Failures are LOGGED, never swallowed
|
|
1275
|
+
// blind: the same rejection fires when the route is failing outright, which matters far more
|
|
1276
|
+
// than the wording of one dialog and would otherwise leave no trace anywhere.
|
|
1277
|
+
const listOrNull = (res, key, what) => {
|
|
1278
|
+
if (res.status === 'fulfilled') return res.value?.[key] || [];
|
|
1279
|
+
console.error(`${what} count for the delete confirmation failed`, res.reason);
|
|
1280
|
+
return null;
|
|
1281
|
+
};
|
|
1282
|
+
const countBound = (list, match) => list.filter(match).length;
|
|
1283
|
+
|
|
1229
1284
|
// Warn honestly if a routine (schedule OR trigger) is bound — the server cascade removes it.
|
|
1285
|
+
const routines = listOrNull(routinesRes, 'routines', 'routine');
|
|
1230
1286
|
let routineNote = '';
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
if (bound) routineNote = ` Its ${bound} bound routine${bound === 1 ? '' : 's'} will also be removed.`;
|
|
1235
|
-
} catch {
|
|
1236
|
-
// Couldn't read routines — never UNDER-warn before an irreversible delete: state the
|
|
1237
|
-
// worst case so the user knows bound routines (if any) go too (the cascade still removes them).
|
|
1287
|
+
if (routines === null) {
|
|
1288
|
+
// never UNDER-warn before an irreversible delete: state the worst case so the user knows
|
|
1289
|
+
// bound routines (if any) go too (the cascade still removes them).
|
|
1238
1290
|
routineNote = ' Any routines bound to it will also be removed.';
|
|
1291
|
+
} else {
|
|
1292
|
+
const bound = countBound(routines, (r) => r.workflow === id);
|
|
1293
|
+
if (bound) routineNote = ` Its ${bound} bound routine${bound === 1 ? '' : 's'} will also be removed.`;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
// Projects are the OPPOSITE case, and the copy has to carry that asymmetry honestly: a bound
|
|
1297
|
+
// routine is destroyed by the delete, a bound project is KEPT. A project is the user's job — its
|
|
1298
|
+
// drawings, versions, knowledge and exports — so deleting a workflow must not destroy the work
|
|
1299
|
+
// done with it (owner's decision). It simply can't be worked on until a workflow exists under
|
|
1300
|
+
// this name again. Saying nothing here would let someone delete a workflow believing their jobs
|
|
1301
|
+
// were unaffected, then find them unopenable with no explanation.
|
|
1302
|
+
const projects = listOrNull(projectsRes, 'projects', 'project');
|
|
1303
|
+
let projectNote = '';
|
|
1304
|
+
if (projects === null) {
|
|
1305
|
+
projectNote = ` Any projects bound to it will be kept, but will stop working until a workflow named “${id}” exists again.`;
|
|
1306
|
+
} else {
|
|
1307
|
+
// LIVE projects only (that is what /api/projects returns), and deliberately so: the number has
|
|
1308
|
+
// to be one the user can reconcile against the list in front of them. But an archived project
|
|
1309
|
+
// is kept and stops working too, so the clause names those without folding them into the count
|
|
1310
|
+
// — a figure that disagreed with their own screen would cost more trust than it bought.
|
|
1311
|
+
const bound = countBound(projects, (p) => p.app === id);
|
|
1312
|
+
if (bound) projectNote = ` Its ${bound} bound project${bound === 1 ? '' : 's'} — and any archived ones — will be kept, but will stop working until a workflow named “${id}” exists again.`;
|
|
1313
|
+
}
|
|
1314
|
+
// The saved model/drawing, which the delete cascade now removes too (`dropAppContractBytes`).
|
|
1315
|
+
// Same three-way idiom as the routines above, and for the same reason: a confirmed-empty app says
|
|
1316
|
+
// nothing (most workflows structurally cannot hold one), a confirmed one is named, and a failed
|
|
1317
|
+
// check hedges rather than going silent — never UNDER-warn before an irreversible delete.
|
|
1318
|
+
//
|
|
1319
|
+
// NOT "saved model" for every app. That is steel's word; vectorize calls the same thing a traced
|
|
1320
|
+
// drawing (compare the two editors' own <title>s), and `workspaces.js` carries a helper whose
|
|
1321
|
+
// comment exists precisely to stop shared chrome hard-coding steel vocabulary. This dialog fires
|
|
1322
|
+
// for every workflow, so it uses the owning app's noun — the app list mirrors `contract-policy.ts`
|
|
1323
|
+
// `OWNED`, which is what actually decides who may hold a contract.
|
|
1324
|
+
//
|
|
1325
|
+
// KNOWN IMPRECISION, and the honest trade: a RENAMED steel-model still holds a steel model but
|
|
1326
|
+
// falls to the generic noun, because the map keys on the id and the id changed. Keying on the
|
|
1327
|
+
// document's own `type` would survive that, but only by GETting the contract to read one field —
|
|
1328
|
+
// see the HEAD note below for why that is the wrong price for a word. "model or drawing" is never
|
|
1329
|
+
// WRONG, only vaguer, so the failure mode is a less specific warning rather than a false one.
|
|
1330
|
+
const noun = id === 'steel-model' ? 'steel model' : id === 'vectorize' ? 'traced drawing' : 'model or drawing';
|
|
1331
|
+
// HEAD, not GET: this only needs the STATUS, and a contract can be 25 MB (the PUT route's body
|
|
1332
|
+
// limit — they embed sheet rasters). Downloading that to choose a word would stall the dialog on
|
|
1333
|
+
// exactly the models most worth warning about. Fastify serves HEAD for every GET route, and the
|
|
1334
|
+
// three cases the copy distinguishes come back identically: 200 = something saved, 204 = nothing,
|
|
1335
|
+
// and an unknown app also 204 (verified against a live server).
|
|
1336
|
+
//
|
|
1337
|
+
// Plain `fetch`, not `api()`: the helper json-decodes unconditionally, so a 204 comes back as a
|
|
1338
|
+
// misleading `{ ok: false, error: 'HTTP 204' }` rather than the "nothing saved" it means.
|
|
1339
|
+
// `quietMissing=1` is what turns an absent contract into that 204 instead of a 404.
|
|
1340
|
+
let modelNote = '';
|
|
1341
|
+
if (contractRes.status !== 'fulfilled') {
|
|
1342
|
+
// Logged for the same reason as the two counts above: a route failing outright matters more
|
|
1343
|
+
// than the wording here, and must not vanish.
|
|
1344
|
+
console.error('saved-model check for the delete confirmation failed', contractRes.reason);
|
|
1345
|
+
modelNote = ` Any saved ${noun} will also be removed.`;
|
|
1346
|
+
} else {
|
|
1347
|
+
const cr = contractRes.value;
|
|
1348
|
+
// The ETAG, not merely a 200, is what says the user has something of their own here. That route
|
|
1349
|
+
// RESOLVES (draft, then the app's baked `.flo` fallback) while the delete removes only the draft,
|
|
1350
|
+
// and both apps with a specific noun ship a non-empty baked example — so a 200 alone named a loss
|
|
1351
|
+
// that does not exist on a fresh install that had never opened the editor. The route emits an
|
|
1352
|
+
// ETag only for a document that came from the STORE, never for the baked fallback, so its
|
|
1353
|
+
// presence is exactly the question being asked. Verified on a live server: baked-only is 200 with
|
|
1354
|
+
// no ETag, a real draft is 200 with one.
|
|
1355
|
+
if (cr.status === 204) modelNote = ''; // nothing saved — stay quiet
|
|
1356
|
+
else if (cr.ok && cr.headers.get('ETag')) modelNote = ` Its saved ${noun} will also be removed.`;
|
|
1357
|
+
else if (cr.ok) modelNote = ''; // the app's own example, not the user's
|
|
1358
|
+
else modelNote = ` Any saved ${noun} will also be removed.`; // couldn't confirm — hedge
|
|
1359
|
+
// Known gap, in the under-warning direction and accepted: a draft that is corrupt JSON reads as
|
|
1360
|
+
// absent, so it yields no ETag and this stays silent even though the delete does remove the file.
|
|
1361
|
+
// The probe cannot see it — `storeEtag` hashes the parsed document — and the document was already
|
|
1362
|
+
// unreadable, so naming it would promise the user something recoverable that is not.
|
|
1239
1363
|
}
|
|
1240
1364
|
closeCombo(false);
|
|
1241
1365
|
const ok = await formModal({
|
|
1366
|
+
// The project note lands AFTER "This can't be undone." on purpose. `sub` is plain textContent,
|
|
1367
|
+
// so a sentence boundary is the only separator available: keeping the "destroyed" facts
|
|
1368
|
+
// together and the one "survives" fact last means "This" can only read backward to the deletion,
|
|
1369
|
+
// never forward to the projects — which would invert the reassurance into "your jobs are gone
|
|
1370
|
+
// forever". Same reason the button stays `danger`/"Delete": the workflow really is irreversible.
|
|
1242
1371
|
title: 'Delete workflow?',
|
|
1243
|
-
sub: `Permanently delete “${id}” — its source, lock and saved inputs.${routineNote} This can’t be undone
|
|
1372
|
+
sub: `Permanently delete “${id}” — its source, lock and saved inputs.${modelNote}${routineNote} This can’t be undone.${projectNote}`,
|
|
1244
1373
|
fields: [],
|
|
1245
1374
|
okLabel: 'Delete',
|
|
1246
1375
|
danger: true,
|
|
@@ -2104,6 +2233,10 @@
|
|
|
2104
2233
|
// never a disabled affordance with no path forward).
|
|
2105
2234
|
// The last HTML painted (static or 3D) — so ↗ Open works for both surfaces.
|
|
2106
2235
|
let lastPaintedHtml = '';
|
|
2236
|
+
let lastPaintedInteractive = false;
|
|
2237
|
+
// The share route's user-facing cap (server/index.ts sets a 6 MB body limit; the JSON envelope
|
|
2238
|
+
// rides on top of the HTML, so the document itself is held to 5 MB).
|
|
2239
|
+
const SHARE_MAX_BYTES = 5 * 1024 * 1024;
|
|
2107
2240
|
// The workflow-written output file the current report reported (its run's
|
|
2108
2241
|
// `saved_path`), or '' when the run wrote none. Drives the ⧉ Open file / ▤ Reveal
|
|
2109
2242
|
// buttons — both hide together when there's no file (#209). Hidden is the default:
|
|
@@ -2123,12 +2256,17 @@
|
|
|
2123
2256
|
// posts `viewer-ready`. Exactly one frame is shown at a time.
|
|
2124
2257
|
function paintReport(html, interactive) {
|
|
2125
2258
|
lastPaintedHtml = html || '';
|
|
2259
|
+
lastPaintedInteractive = !!interactive; // drives the share copy: a 3D model is not a "frozen report"
|
|
2126
2260
|
showSavedPathActions(''); // default off; the caller re-shows if this report saved a file
|
|
2127
2261
|
if (interactive) {
|
|
2128
2262
|
$reportFrame.hidden = true; $reportFrame.srcdoc = '';
|
|
2129
2263
|
$reportFrame3d.hidden = false;
|
|
2130
2264
|
$reportFrame3d.src = 'data:text/html;charset=utf-8,' + encodeURIComponent(html);
|
|
2131
|
-
|
|
2265
|
+
// A 3D doc IS shareable: AWARE's viewer-3d renders one self-contained HTML file, and the public
|
|
2266
|
+
// viewer already runs it script-enabled. (It previously hid Share here on the grounds that "a
|
|
2267
|
+
// script doc can't be statically hosted" — that was never true of this document.) Size is the
|
|
2268
|
+
// real limit, and the click handler checks it before uploading.
|
|
2269
|
+
$reportShare.hidden = false;
|
|
2132
2270
|
$reportOverlay.hidden = false; $reportOverlay.replaceChildren();
|
|
2133
2271
|
$reportOverlay.append(mkEl('div', 'spinner'), mkEl('div', null, 'Loading 3D view…'));
|
|
2134
2272
|
} else {
|
|
@@ -3265,18 +3403,48 @@
|
|
|
3265
3403
|
// markup) so a server-returned URL can never inject HTML.
|
|
3266
3404
|
$reportShare.onclick = async () => {
|
|
3267
3405
|
const cached = currentId && lastReportByApp.get(currentId);
|
|
3268
|
-
// Share exactly what's on screen — the
|
|
3269
|
-
//
|
|
3270
|
-
|
|
3406
|
+
// Share exactly what's on screen — the HTML we painted — so the link can never carry a different
|
|
3407
|
+
// report than the one the user is looking at (e.g. another app's cache). `lastPaintedHtml` covers
|
|
3408
|
+
// the INTERACTIVE 3D frame too, which has no srcdoc (it renders from a data: URL); the srcdoc
|
|
3409
|
+
// fallback keeps the static path working. Same source as ⧉ Open, deliberately.
|
|
3410
|
+
const html = lastPaintedHtml || $reportFrame.srcdoc;
|
|
3271
3411
|
if (!html || !cached) return; // button is hidden in this state; belt-and-braces
|
|
3412
|
+
// Check the payload BEFORE uploading so an oversized model fails with a size the user can act on,
|
|
3413
|
+
// rather than a generic 413 after a long upload. The route caps the request body at 6 MB; the
|
|
3414
|
+
// user-facing limit is 5 MB and the JSON envelope (title + escaping) rides on top of the HTML —
|
|
3415
|
+
// so measure the SERIALIZED body, not the raw HTML, or quote-heavy markup slips past the check
|
|
3416
|
+
// and 413s anyway.
|
|
3272
3417
|
const app = apps.get(currentId);
|
|
3273
3418
|
const title = `${app ? app.displayName : currentId}${cached.label ? ' · ' + cached.label : ''}`;
|
|
3419
|
+
// Declare an interactive 3D document so the server can hold it to the AWARE display-mode floor.
|
|
3420
|
+
// This path renders via export-3d without `for=share`, so this is the only place it gets gated.
|
|
3421
|
+
const body = JSON.stringify(lastPaintedInteractive ? { title, html, kind: 'model-3d' } : { title, html });
|
|
3422
|
+
const bytes = new Blob([body]).size;
|
|
3423
|
+
if (bytes > SHARE_MAX_BYTES) {
|
|
3424
|
+
// This handler serves BOTH document kinds AND any workflow's viewer — so the remedy has to be
|
|
3425
|
+
// true for all of them. It previously told the user to hide or isolate parts and re-run, which
|
|
3426
|
+
// does nothing: the export renders the full approved contract and applies no visibility filter,
|
|
3427
|
+
// so the retry produced a byte-identical payload. It also can't name members or projects, which
|
|
3428
|
+
// mean nothing to a non-steel workflow. "Reduce it at the source" claims no mechanism, so it
|
|
3429
|
+
// cannot come apart the same way. The static branch stays silent — no generic remedy exists for
|
|
3430
|
+
// an arbitrary report, and inventing one is how the first advice got written.
|
|
3431
|
+
const mb = (bytes / 1048576).toFixed(1);
|
|
3432
|
+
showToast(lastPaintedInteractive
|
|
3433
|
+
? `This model is too large to share — ${mb} MB, limit 5 MB. Sharing always sends the full model, regardless of what's shown on screen — reduce it at the source and run again to share a smaller one.`
|
|
3434
|
+
: `This report is too large to share — ${mb} MB, limit 5 MB.`, 'warn');
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3274
3437
|
$reportShare.disabled = true;
|
|
3275
3438
|
const prev = $reportShare.textContent;
|
|
3276
3439
|
$reportShare.textContent = 'Sharing…';
|
|
3277
3440
|
try {
|
|
3278
|
-
const res = await api('/api/share-report', { method: 'POST', body
|
|
3279
|
-
|
|
3441
|
+
const res = await api('/api/share-report', { method: 'POST', body });
|
|
3442
|
+
// Tracked separately from the upload, and never allowed to reach the outer catch: claiming
|
|
3443
|
+
// "copied" when the clipboard was denied leaves the user pasting something stale, and letting a
|
|
3444
|
+
// missing navigator.clipboard throw would report a SUCCESSFUL share as a failure and hide the
|
|
3445
|
+
// URL entirely. The link is rendered below either way.
|
|
3446
|
+
let copied = false;
|
|
3447
|
+
try { await navigator.clipboard.writeText(res.url); copied = true; } catch { copied = false; }
|
|
3280
3448
|
const link = mkEl('a', null, res.url.replace(/^https:\/\//, ''));
|
|
3281
3449
|
link.href = res.url;
|
|
3282
3450
|
link.target = '_blank';
|
|
@@ -3284,9 +3452,11 @@
|
|
|
3284
3452
|
$reportSub.replaceChildren(
|
|
3285
3453
|
document.createTextNode('Shared — '),
|
|
3286
3454
|
link,
|
|
3287
|
-
document.createTextNode(
|
|
3455
|
+
document.createTextNode(copied
|
|
3456
|
+
? (lastPaintedInteractive ? ' — copied to clipboard. Anyone with the link can view this model.' : ' — copied to clipboard. Anyone with the link can view this frozen report.')
|
|
3457
|
+
: (lastPaintedInteractive ? ' — copy it from here. Anyone with the link can view this model.' : ' — copy it from here. Anyone with the link can view this frozen report.')),
|
|
3288
3458
|
);
|
|
3289
|
-
showToast('Link copied to clipboard', 'ok');
|
|
3459
|
+
showToast(copied ? 'Link copied to clipboard' : 'Share link created — copy it from the panel', 'ok');
|
|
3290
3460
|
} catch (e) {
|
|
3291
3461
|
const err = e && e.body && e.body.error;
|
|
3292
3462
|
const msg =
|
|
@@ -3295,6 +3465,9 @@
|
|
|
3295
3465
|
? 'A FloLess subscription is required to share reports — sign in to continue.' :
|
|
3296
3466
|
err === 'rate_limited' ? 'Share limit reached (30 per hour) — try again in a few minutes.' :
|
|
3297
3467
|
err === 'too_large' ? 'Report is too large to share (over 5 MB).' :
|
|
3468
|
+
err === 'aware_too_old' ? (e.body.version
|
|
3469
|
+
? `AWARE v${e.body.version} is too old to share a faithful model — Realistic and Shadowed need v${e.body.floor} or later. Click ↑ Upgrade AWARE in the footer, then share again.`
|
|
3470
|
+
: `Your installed AWARE is too old to share a faithful model — Realistic and Shadowed need v${e.body.floor} or later. Click ↑ Upgrade AWARE in the footer, then share again.`) :
|
|
3298
3471
|
'Couldn’t reach FloLess — check your connection and try sharing again.';
|
|
3299
3472
|
showToast(msg, 'warn');
|
|
3300
3473
|
} finally {
|
|
@@ -3647,20 +3820,157 @@
|
|
|
3647
3820
|
if ($importFile) $importFile.click();
|
|
3648
3821
|
}
|
|
3649
3822
|
|
|
3823
|
+
// ── Import failed (#314) ────────────────────────────────────────────────────────
|
|
3824
|
+
// `aware app install` refuses an app that fails validation and says exactly why on stderr. That
|
|
3825
|
+
// never reached the user: the route reported only "exit 3", and a one-line toast could not have
|
|
3826
|
+
// carried the detail anyway. The route now attaches AWARE's own words as `reason`, plus
|
|
3827
|
+
// `agentsUnavailable` for the one cause with a known one-command fix.
|
|
3828
|
+
//
|
|
3829
|
+
// Why a command to copy rather than an in-app button: POST /api/agents/update already exists (the
|
|
3830
|
+
// Agent Library's Update button drives it), so an "Update it now" action is buildable and would
|
|
3831
|
+
// report AWARE's real answer instead of the user retrying blind. It is deliberately NOT here —
|
|
3832
|
+
// this change is about telling the truth about a failure, and adding an action means its own
|
|
3833
|
+
// progress, error and re-import states. Filed as a follow-up rather than smuggled in. Three tiers:
|
|
3834
|
+
// agents named → the fix, with the command; AWARE's output collapsed underneath
|
|
3835
|
+
// reason only → say plainly we don't recognise the cause; show the output, already open
|
|
3836
|
+
// no reason → nothing multi-line to show, so the toast stays (see importFlo below)
|
|
3837
|
+
const $importFailedModal = document.getElementById('import-failed-modal');
|
|
3838
|
+
let _importFailedReturnFocus = null;
|
|
3839
|
+
let _importFailedEsc = null;
|
|
3840
|
+
|
|
3841
|
+
// Drop the Escape listener. Split out of closeImportFailedModal so re-opening (two imports racing)
|
|
3842
|
+
// can clear the previous one WITHOUT also moving focus — overwriting `_importFailedEsc` after
|
|
3843
|
+
// adding the new handler leaked the old one, and it would then outlive the modal.
|
|
3844
|
+
function dropImportFailedEsc() {
|
|
3845
|
+
if (!_importFailedEsc) return;
|
|
3846
|
+
document.removeEventListener('keydown', _importFailedEsc);
|
|
3847
|
+
_importFailedEsc = null;
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
function closeImportFailedModal() {
|
|
3851
|
+
hideModal($importFailedModal);
|
|
3852
|
+
dropImportFailedEsc();
|
|
3853
|
+
// Import has no single stable trigger (a menu item that has already closed, an OS file drop with
|
|
3854
|
+
// no DOM node, a hidden input), so fall back to the menu button rather than pretend otherwise.
|
|
3855
|
+
// <body> counts as no target: it is what activeElement reports when nothing is focused, and
|
|
3856
|
+
// handing focus back to it strands a keyboard user at the top of the document.
|
|
3857
|
+
const prev = _importFailedReturnFocus;
|
|
3858
|
+
const usable = prev && prev.isConnected && prev !== document.body;
|
|
3859
|
+
const back = usable ? prev : document.getElementById('menu-btn');
|
|
3860
|
+
_importFailedReturnFocus = null;
|
|
3861
|
+
if (back && back.focus) { try { back.focus(); } catch { /* gone */ } }
|
|
3862
|
+
}
|
|
3863
|
+
|
|
3864
|
+
// One row per agent — built with DOM methods, not innerHTML: the agent name comes out of a CLI's
|
|
3865
|
+
// stderr, and there is no reason to route it through a string template at all.
|
|
3866
|
+
function importFailedCmdRow(agent) {
|
|
3867
|
+
const cmd = `aware agent update ${agent}`;
|
|
3868
|
+
const row = document.createElement('div');
|
|
3869
|
+
row.className = 'import-failed-cmd-row';
|
|
3870
|
+
const code = document.createElement('code');
|
|
3871
|
+
code.className = 'import-failed-cmd';
|
|
3872
|
+
code.textContent = cmd;
|
|
3873
|
+
const copy = document.createElement('button');
|
|
3874
|
+
copy.type = 'button';
|
|
3875
|
+
copy.className = 'import-failed-copy';
|
|
3876
|
+
copy.dataset.cmd = cmd;
|
|
3877
|
+
copy.dataset.tip = 'Copy this command';
|
|
3878
|
+
copy.textContent = '⎘ Copy';
|
|
3879
|
+
row.append(code, copy);
|
|
3880
|
+
return row;
|
|
3881
|
+
}
|
|
3882
|
+
|
|
3883
|
+
function openImportFailedModal(reason, agents) {
|
|
3884
|
+
const $sub = document.getElementById('import-failed-sub');
|
|
3885
|
+
const $remedy = document.getElementById('import-failed-remedy');
|
|
3886
|
+
const $rows = document.getElementById('import-failed-remedy-rows');
|
|
3887
|
+
const $detail = document.getElementById('import-failed-detail');
|
|
3888
|
+
const $raw = document.getElementById('import-failed-raw');
|
|
3889
|
+
$rows.replaceChildren();
|
|
3890
|
+
if (agents.length) {
|
|
3891
|
+
const named = agents.map((a) => `“${a}”`).join(', ');
|
|
3892
|
+
// The second sentence is not padding. "Not yet runnable" covers two different situations, and
|
|
3893
|
+
// the command only fixes one: a stale local copy of an agent that HAS since been published
|
|
3894
|
+
// (the case in #314), versus one upstream has genuinely not shipped a runnable build for yet.
|
|
3895
|
+
// Promising a fix that then changes nothing is worse than the honest "we don't know" tier.
|
|
3896
|
+
$sub.textContent = agents.length === 1
|
|
3897
|
+
? `This workflow needs the ${named} agent, which isn’t runnable yet on this machine.`
|
|
3898
|
+
+ ' Updating usually fixes it. If there is nothing to update, that agent hasn’t been released yet — this workflow can’t run here until it is.'
|
|
3899
|
+
: `This workflow needs ${agents.length} agents that aren’t runnable yet on this machine: ${named}.`
|
|
3900
|
+
+ ' Updating usually fixes it. Any that report nothing to update haven’t been released yet — this workflow can’t run here until they are.';
|
|
3901
|
+
$rows.append(...agents.map(importFailedCmdRow)); // one command per agent, never a guessed multi-agent form
|
|
3902
|
+
$remedy.hidden = false;
|
|
3903
|
+
$detail.open = false; // the fix is the answer; the raw output is backup
|
|
3904
|
+
} else {
|
|
3905
|
+
$sub.textContent = 'AWARE refused this workflow, and FloLess doesn’t recognise the cause well enough to suggest a fix — here is exactly what it reported.';
|
|
3906
|
+
$remedy.hidden = true; // never an empty remedy box pretending there is one
|
|
3907
|
+
$detail.open = true; // it is the only thing we have — don't hide it behind a click
|
|
3908
|
+
}
|
|
3909
|
+
$raw.textContent = reason; // textContent, never innerHTML — this is raw CLI output
|
|
3910
|
+
dropImportFailedEsc(); // a re-open must not stack a second handler on top of the first
|
|
3911
|
+
// Keep the ORIGINAL return target across a re-open: by then activeElement is this dialog.
|
|
3912
|
+
if (!_importFailedReturnFocus) {
|
|
3913
|
+
_importFailedReturnFocus = document.activeElement && document.activeElement.focus ? document.activeElement : null;
|
|
3914
|
+
}
|
|
3915
|
+
showModal($importFailedModal);
|
|
3916
|
+
const shell = $importFailedModal.querySelector('.modal');
|
|
3917
|
+
if (shell) { try { shell.focus(); } catch { /* not focusable */ } }
|
|
3918
|
+
_importFailedEsc = (e) => { if (e.key === 'Escape') { e.preventDefault(); closeImportFailedModal(); } };
|
|
3919
|
+
document.addEventListener('keydown', _importFailedEsc);
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
if ($importFailedModal) {
|
|
3923
|
+
const $close = document.getElementById('import-failed-close');
|
|
3924
|
+
if ($close) $close.onclick = closeImportFailedModal;
|
|
3925
|
+
onBackdropDismiss($importFailedModal, closeImportFailedModal);
|
|
3926
|
+
$importFailedModal.addEventListener('click', async (e) => {
|
|
3927
|
+
const btn = e.target.closest && e.target.closest('.import-failed-copy');
|
|
3928
|
+
if (!btn) return;
|
|
3929
|
+
// copyToClipboard() is the shared helper every other copy affordance in this file uses.
|
|
3930
|
+
const ok = await copyToClipboard(btn.dataset.cmd || '');
|
|
3931
|
+
showToast(ok ? 'Copied — paste it into your terminal AI' : 'Could not copy — select the command and copy it manually', ok ? 'ok' : 'warn');
|
|
3932
|
+
});
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
// One import at a time. `aware app install` takes ~10-15 s, and every entry point here handles a
|
|
3936
|
+
// SINGLE file (the picker is multiple:false, the drop handler takes files[0]), so a second import
|
|
3937
|
+
// started before the first returns is always an accident — an impatient double-click or a second
|
|
3938
|
+
// drop. It used to produce two overlapping results; with a dialog that reads as the dismissal not
|
|
3939
|
+
// working: you close the first failure and the second one pops the dialog straight back up. The
|
|
3940
|
+
// independent QA pass caught exactly that. Same shape as _wfUpdateApplying above.
|
|
3941
|
+
let _importing = false;
|
|
3942
|
+
|
|
3650
3943
|
async function importFlo(file) {
|
|
3651
3944
|
if (!file) return;
|
|
3652
|
-
|
|
3653
|
-
|
|
3945
|
+
if (_importing) { showToast('An import is already running — wait for it to finish', 'warn'); return; }
|
|
3946
|
+
// Claimed BEFORE the first await. Reading the file yields, so two calls in the same tick — which
|
|
3947
|
+
// is exactly the double-click this guards — would otherwise both pass the check above while
|
|
3948
|
+
// file.text() was still pending, and both go on to import. The whole body is inside the
|
|
3949
|
+
// try/finally so every exit, including the early returns below, releases the claim.
|
|
3950
|
+
_importing = true;
|
|
3654
3951
|
try {
|
|
3655
|
-
|
|
3656
|
-
await
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3952
|
+
let content;
|
|
3953
|
+
try { content = await file.text(); } catch { showToast('Could not read that file', 'err'); return; }
|
|
3954
|
+
try {
|
|
3955
|
+
const { id } = await api('/api/import', { method: 'POST', body: JSON.stringify({ filename: file.name, content }) });
|
|
3956
|
+
await loadApps();
|
|
3957
|
+
$promptSel.value = id;
|
|
3958
|
+
$promptSel.dispatchEvent(new Event('change', { bubbles: true })); // → loadApp(id), arms Compile
|
|
3959
|
+
showToast(`Imported "${id}" — Compile to run`, 'ok');
|
|
3960
|
+
} catch (e) {
|
|
3961
|
+
const body = e && e.body;
|
|
3962
|
+
const msg = (body && body.error) || (e && e.message) || 'Import failed';
|
|
3963
|
+
const reason = body && typeof body.reason === 'string' ? body.reason.trim() : '';
|
|
3964
|
+
// Only an install refusal carries AWARE's output. A bad file or a name clash is a one-line
|
|
3965
|
+
// problem the toast already states well — a dialog there would be ceremony.
|
|
3966
|
+
if (reason && $importFailedModal) {
|
|
3967
|
+
openImportFailedModal(reason, Array.isArray(body.agentsUnavailable) ? body.agentsUnavailable : []);
|
|
3968
|
+
return;
|
|
3969
|
+
}
|
|
3970
|
+
showToast(msg, body && body.code === 'exists' ? 'warn' : 'err');
|
|
3971
|
+
}
|
|
3972
|
+
} finally {
|
|
3973
|
+
_importing = false; // every path, including an unreadable file and the dialog's early return
|
|
3664
3974
|
}
|
|
3665
3975
|
}
|
|
3666
3976
|
|
|
@@ -3863,6 +4173,114 @@
|
|
|
3863
4173
|
})();
|
|
3864
4174
|
}
|
|
3865
4175
|
|
|
4176
|
+
// ── Footer version labels: the RUNNING version's changelog on hover ───────────
|
|
4177
|
+
// The static tooltips in index.html explain what a version *is* ("the aware CLI/npm
|
|
4178
|
+
// package this app drives") — accurate, and it tells the user nothing. They stay as the
|
|
4179
|
+
// fallback; once the notes resolve, the label instead carries what actually CHANGED in
|
|
4180
|
+
// the version being run: the same /api/release-notes the update popover uses, compacted
|
|
4181
|
+
// into the shared plain-text tooltip (#tooltip renders textContent with white-space:
|
|
4182
|
+
// pre-line — web/app.js initTooltips + app.css — so newlines are the only formatting
|
|
4183
|
+
// available), with the label itself becoming a click-for-full-notes affordance. No notes
|
|
4184
|
+
// (dev build, offline, no release for this version, an empty release body) → the
|
|
4185
|
+
// descriptive tooltip stays and the label stays inert: never a control that looks
|
|
4186
|
+
// clickable and says nothing new.
|
|
4187
|
+
const TIP_MAX_BULLETS = 3;
|
|
4188
|
+
// Applies to the description alone; with the "Fixed: " prefix that is ≈2 wrapped lines at
|
|
4189
|
+
// #tooltip's 280px / 12px (app.css), which caps the whole box at ~10 lines.
|
|
4190
|
+
const TIP_MAX_CHARS = 60;
|
|
4191
|
+
// Prefer a word boundary so a clipped line still reads as a sentence — falling back to a
|
|
4192
|
+
// hard cut when the last space lands too early to leave anything useful.
|
|
4193
|
+
function clipTipText(s, max) {
|
|
4194
|
+
const t = String(s || '').replace(/\s+/g, ' ').trim();
|
|
4195
|
+
if (t.length <= max) return t;
|
|
4196
|
+
const cut = t.slice(0, max);
|
|
4197
|
+
const sp = cut.lastIndexOf(' ');
|
|
4198
|
+
return (sp > max * 0.6 ? cut.slice(0, sp) : cut).replace(/[\s,;:.–—-]+$/, '') + '…';
|
|
4199
|
+
}
|
|
4200
|
+
// "FloLess <version> — <summary>" + up to TIP_MAX_BULLETS "Fixed: <change>" lines +
|
|
4201
|
+
// "+K more" + the click affordance. Type labels are capitalized: in plain text that's the
|
|
4202
|
+
// only weight bump available for a category tag (the popover styles them uppercase).
|
|
4203
|
+
function changelogTip(head, summary, changes) {
|
|
4204
|
+
const lines = [summary ? head + ' — ' + clipTipText(summary, TIP_MAX_CHARS) : head];
|
|
4205
|
+
for (const c of changes.slice(0, TIP_MAX_BULLETS)) {
|
|
4206
|
+
const type = String(c.type || '').trim();
|
|
4207
|
+
lines.push((type ? type.charAt(0).toUpperCase() + type.slice(1) + ': ' : '') + clipTipText(c.description, TIP_MAX_CHARS));
|
|
4208
|
+
}
|
|
4209
|
+
if (changes.length > TIP_MAX_BULLETS) lines.push('+' + (changes.length - TIP_MAX_BULLETS) + ' more');
|
|
4210
|
+
lines.push('click for release notes');
|
|
4211
|
+
return lines.join('\n');
|
|
4212
|
+
}
|
|
4213
|
+
// Strip a label back to its inert, descriptive state (the data-tip index.html shipped).
|
|
4214
|
+
// Load-bearing when the version changes under us: the label already reads the NEW number,
|
|
4215
|
+
// so the old version's tooltip/notes must go at once — including when the new version's
|
|
4216
|
+
// notes never arrive — or it shows (and opens) the wrong version's changelog.
|
|
4217
|
+
function resetNotesAffordance(el) {
|
|
4218
|
+
if (el.dataset.tipDefault === undefined) el.dataset.tipDefault = el.dataset.tip || '';
|
|
4219
|
+
el.dataset.tip = el.dataset.tipDefault;
|
|
4220
|
+
delete el.dataset.notesVersion;
|
|
4221
|
+
el.classList.remove('relnotes-reopen');
|
|
4222
|
+
for (const a of ['role', 'tabindex', 'aria-haspopup', 'aria-label', 'aria-expanded']) el.removeAttribute(a);
|
|
4223
|
+
// Last, so the focus restore doesn't land on a control we then strip of role and name:
|
|
4224
|
+
// an open popover belongs to the version we just cleared.
|
|
4225
|
+
if (_notesOriginEl === el) closeNotesPopover();
|
|
4226
|
+
}
|
|
4227
|
+
// The other half: make the label a notes affordance for `version`. #tooltip is never wired
|
|
4228
|
+
// to its anchor (no aria-describedby in initTooltips), so the tooltip text is invisible to
|
|
4229
|
+
// assistive tech — and "FloLess 0.104.2" on a role=button says nothing on its own; the
|
|
4230
|
+
// aria-label names the action explicitly.
|
|
4231
|
+
function armNotesAffordance(el, version, tip, name) {
|
|
4232
|
+
el.dataset.tip = tip; // the data-tip MutationObserver (web/app.js initTooltips) refreshes an open tooltip
|
|
4233
|
+
el.dataset.notesVersion = version;
|
|
4234
|
+
el.classList.add('relnotes-reopen');
|
|
4235
|
+
el.setAttribute('role', 'button');
|
|
4236
|
+
el.setAttribute('tabindex', '0');
|
|
4237
|
+
el.setAttribute('aria-haspopup', 'dialog');
|
|
4238
|
+
el.setAttribute('aria-label', name);
|
|
4239
|
+
}
|
|
4240
|
+
// One fetch per component per version CHANGE (the map holds the last version tried, not a
|
|
4241
|
+
// set) — the attempt is latched before the await, so a health tick every few seconds can't
|
|
4242
|
+
// hammer the endpoint (and, for AWARE, GitHub's unauthenticated API). A definitive answer
|
|
4243
|
+
// — notes, or "no release for this version" — settles that version for good; a transient
|
|
4244
|
+
// failure only holds for TIP_RETRY_MS, so a tab that was offline at boot heals itself
|
|
4245
|
+
// instead of carrying a dead label for its whole (multi-day) life. Called from the health
|
|
4246
|
+
// poll AND from the in-place AWARE upgrade, so this state has exactly one owner.
|
|
4247
|
+
// `armAnyway` arms the affordance even when the notes don't resolve — the in-place AWARE
|
|
4248
|
+
// upgrade passes it, because the user just installed this version and the popover's "Full
|
|
4249
|
+
// release notes ↗" deep-link is built from the version string alone, so it still leads
|
|
4250
|
+
// somewhere useful when the GitHub Release isn't published (or reachable) yet.
|
|
4251
|
+
const TIP_RETRY_MS = 5 * 60_000;
|
|
4252
|
+
const _versionTip = new Map(); // component → { version, settled, retryAt }
|
|
4253
|
+
async function refreshVersionNotesTip(component, version, el, armAnyway) {
|
|
4254
|
+
if (!el || !version) return;
|
|
4255
|
+
const prev = _versionTip.get(component);
|
|
4256
|
+
if (prev && prev.version === version && (prev.settled || Date.now() < prev.retryAt)) return;
|
|
4257
|
+
_versionTip.set(component, { version, settled: false, retryAt: Date.now() + TIP_RETRY_MS });
|
|
4258
|
+
resetNotesAffordance(el);
|
|
4259
|
+
let notes = null;
|
|
4260
|
+
try {
|
|
4261
|
+
const r = await fetch('/api/release-notes?component=' + encodeURIComponent(component) + '&version=' + encodeURIComponent(version));
|
|
4262
|
+
notes = await r.json();
|
|
4263
|
+
} catch { notes = null; }
|
|
4264
|
+
const cur = _versionTip.get(component);
|
|
4265
|
+
if (!cur || cur.version !== version) return; // a newer version landed mid-fetch
|
|
4266
|
+
if (!notes || !notes.ok) {
|
|
4267
|
+
// 'not-found' is definitive — that version has no published notes. Anything else is
|
|
4268
|
+
// transient and gets one retry per cooldown. Trace it either way: a label that stayed
|
|
4269
|
+
// generic is otherwise indistinguishable from "this build genuinely has no notes".
|
|
4270
|
+
if (notes && notes.reason === 'not-found') cur.settled = true;
|
|
4271
|
+
console.warn('version tooltip: no release notes', component, version, (notes && notes.reason) || 'fetch-failed');
|
|
4272
|
+
if (armAnyway) armNotesAffordance(el, version, "What's new in v" + version + ' — click for notes', "What's new in v" + version);
|
|
4273
|
+
return;
|
|
4274
|
+
}
|
|
4275
|
+
cur.settled = true;
|
|
4276
|
+
const changes = (Array.isArray(notes.changes) ? notes.changes : []).filter((c) => c && c.description);
|
|
4277
|
+
// An "empty" release (no summary, nothing itemised) would replace the descriptive tooltip
|
|
4278
|
+
// with strictly less — stay inert unless the caller wants the affordance regardless.
|
|
4279
|
+
if (!notes.summary && !changes.length && !armAnyway) return;
|
|
4280
|
+
const head = (el.textContent || '').trim() || version;
|
|
4281
|
+
armNotesAffordance(el, version, changelogTip(head, notes.summary, changes), head + ' — view release notes');
|
|
4282
|
+
}
|
|
4283
|
+
|
|
3866
4284
|
// ── App self-update tag ───────────────────────────────────────────────────────
|
|
3867
4285
|
// Surface updater.ts: poll GET /api/update (on load + every 6h); when a newer
|
|
3868
4286
|
// installed build exists, show a footer pill → click opens the release-notes
|
|
@@ -4034,7 +4452,23 @@
|
|
|
4034
4452
|
const $cancel = document.getElementById('wf-update-cancel'); if ($cancel) $cancel.onclick = () => hideModal($wfUpdateModal);
|
|
4035
4453
|
const $ok = document.getElementById('wf-update-ok'); if ($ok) $ok.onclick = () => { const u = currentId && wfUpdateFor(currentId); if (u) applyWfUpdate(u); };
|
|
4036
4454
|
if ($wfUpdateModal) onBackdropDismiss($wfUpdateModal, () => hideModal($wfUpdateModal));
|
|
4037
|
-
|
|
4455
|
+
}
|
|
4456
|
+
|
|
4457
|
+
// The poll deliberately does NOT start here. Module init runs before the boot sequence, so the
|
|
4458
|
+
// first /api/workflows/updates went out ahead of /api/apps and the workflow picker then waited
|
|
4459
|
+
// behind it — measured empty for ~59 s on a cold server (#358). It is an OFFER (a pill), never
|
|
4460
|
+
// needed for first paint. It was also firing while the subscription gate would 402 it, then not
|
|
4461
|
+
// retrying for an hour — the same reason panels.js boot is deferred to loadWorkspaceData().
|
|
4462
|
+
// loadWorkspaceData() re-runs when the health poll recovers from an outage, so only the INTERVAL is
|
|
4463
|
+
// guarded — the fetch itself must repeat. Guarding the whole function meant a first load that failed
|
|
4464
|
+
// during an outage (the fetch fails too) marked the poll started, and the recovery run was then
|
|
4465
|
+
// suppressed: no update pill until the hourly tick, up to an hour later.
|
|
4466
|
+
let _wfPollStarted = false;
|
|
4467
|
+
function startWorkflowUpdatePolling() {
|
|
4468
|
+
if (!$wfUpdate) return;
|
|
4469
|
+
refreshWorkflowUpdates(); // every call, including a recovery re-run
|
|
4470
|
+
if (_wfPollStarted) return; // ...but exactly one interval, ever
|
|
4471
|
+
_wfPollStarted = true;
|
|
4038
4472
|
setInterval(refreshWorkflowUpdates, 60 * 60 * 1000);
|
|
4039
4473
|
}
|
|
4040
4474
|
|
|
@@ -4095,12 +4529,11 @@
|
|
|
4095
4529
|
if (wv && d.version) {
|
|
4096
4530
|
wv.textContent = 'AWARE ' + d.version;
|
|
4097
4531
|
awareUpgradeFloor = d.version; awareUpgradeFloorUntil = Date.now() + 10000;
|
|
4098
|
-
//
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
wv.dataset.notesVersion = d.version;
|
|
4532
|
+
// Resolve the just-installed version's changelog now rather than waiting out the
|
|
4533
|
+
// next health tick. One owner for that state: the call clears the previous version's
|
|
4534
|
+
// affordance and re-arms it for this one — here unconditionally (armAnyway), so the
|
|
4535
|
+
// user can always reach what they just installed even if its notes aren't published.
|
|
4536
|
+
refreshVersionNotesTip('aware', d.version, wv, true);
|
|
4104
4537
|
}
|
|
4105
4538
|
// Brief confirmation (~2s) before the pill hides.
|
|
4106
4539
|
$awareUpdate.textContent = 'AWARE v' + (d.version || v) + ' installed';
|
|
@@ -4170,21 +4603,21 @@
|
|
|
4170
4603
|
window.addEventListener('focus', recheckUpdatesOnFocus);
|
|
4171
4604
|
}
|
|
4172
4605
|
|
|
4173
|
-
//
|
|
4174
|
-
//
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
};
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
}
|
|
4606
|
+
// Either version label, once it's a notes affordance (its changelog tooltip resolved,
|
|
4607
|
+
// or — for AWARE — an in-place upgrade just landed), opens the full release-notes
|
|
4608
|
+
// popover on click or Enter/Space. Inert until then: the class is the gate.
|
|
4609
|
+
for (const [id, component] of [['aware-version', 'aware'], ['app-version', 'app']]) {
|
|
4610
|
+
const el = document.getElementById(id);
|
|
4611
|
+
if (!el) continue;
|
|
4612
|
+
const reopen = () => {
|
|
4613
|
+
const v = el.dataset.notesVersion;
|
|
4614
|
+
if (v) openNotesPopover({ component, version: v, anchorEl: el });
|
|
4615
|
+
};
|
|
4616
|
+
el.addEventListener('click', () => { if (el.classList.contains('relnotes-reopen')) reopen(); });
|
|
4617
|
+
el.addEventListener('keydown', (e) => {
|
|
4618
|
+
if (!el.classList.contains('relnotes-reopen')) return;
|
|
4619
|
+
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); reopen(); }
|
|
4620
|
+
});
|
|
4188
4621
|
}
|
|
4189
4622
|
|
|
4190
4623
|
// ── What's-new panel (floless.app post-update, relaunch-surviving) ────────────
|
|
@@ -4823,7 +5256,13 @@
|
|
|
4823
5256
|
// (popover + what's-new). Empty until /api/health reports it → links omitted.
|
|
4824
5257
|
if (h && h.webBase) webBase = h.webBase;
|
|
4825
5258
|
const av = document.getElementById('app-version');
|
|
4826
|
-
if (av && h && h.appVersion
|
|
5259
|
+
if (av && h && h.appVersion) {
|
|
5260
|
+
if (!shownVersion) { av.textContent = 'FloLess ' + h.appVersion; shownVersion = true; }
|
|
5261
|
+
// Swap the generic tooltip for this build's changelog. Called every tick (the
|
|
5262
|
+
// call is a map lookup once the version has settled) so a boot-time network
|
|
5263
|
+
// blip doesn't leave the label generic for the life of a days-long tab.
|
|
5264
|
+
refreshVersionNotesTip('app', h.appVersion, av);
|
|
5265
|
+
}
|
|
4827
5266
|
// Adopt a self-update IN PLACE (#37): this tab loaded build X, but the server now
|
|
4828
5267
|
// reports build Y — a self-update swapped the build under us. Reload so the tab runs
|
|
4829
5268
|
// the NEW build's web assets (and a fresh footer + what's-new) instead of being
|
|
@@ -4861,6 +5300,9 @@
|
|
|
4861
5300
|
// with the version we just upgraded to (a poll in flight during the reinstall).
|
|
4862
5301
|
const settling = awareUpgradeFloor && Date.now() < awareUpgradeFloorUntil && h.awareVersion !== awareUpgradeFloor;
|
|
4863
5302
|
if (!settling && wv.textContent !== next) wv.textContent = next;
|
|
5303
|
+
// The runtime version can change under us (in-place upgrade, out-of-band
|
|
5304
|
+
// `npm i -g`) — re-resolve the changelog tooltip for whatever is running now.
|
|
5305
|
+
if (!settling) refreshVersionNotesTip('aware', h.awareVersion, wv);
|
|
4864
5306
|
}
|
|
4865
5307
|
const sep = document.getElementById('ver-sep');
|
|
4866
5308
|
if (sep && h && (h.appVersion || h.awareVersion)) sep.hidden = false;
|
|
@@ -5228,9 +5670,9 @@
|
|
|
5228
5670
|
return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing was attached — re-read (vectorize) it into the SAME project as a new version (do NOT create a new project). Vectorize the drawing per the floless-app-vectorize skill into a drawing.vector/v1 contract: emit clean, editable 2D vector geometry (sheets → elements: lines / polylines / curves / text, each on its layer), NOT steel members or a takeoff. A vector PDF is read deterministically (exact geometry, no guessing); a photo, scan or hand sketch is traced by a fenced vision extraction that flags every uncertain stroke (low confidence) for the user's review. ${post}${snaps}${note}`;
|
|
5229
5671
|
}
|
|
5230
5672
|
if (isInitialRead) {
|
|
5231
|
-
return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing set was attached — read it into this project as its first steel model version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, do the deterministic PyMuPDF steel-filter pass only: identify the framing-plan sheets, enumerate the drawing elements by layer/thickness/color into contract.filter.sheets/facets, PUT that project contract to /api/contract/${req.appId}?project=${req.project}, then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection and compose the steel.takeoff/v1 contract. ${post}${snaps}${note}`;
|
|
5673
|
+
return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing set was attached — read it into this project as its first steel model version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} and KEEP its ETag response header. A 404 "no contract for this app yet" here is NORMAL and not an error — a project created by dropping a drawing starts empty; it simply means this is the create case, so you will send If-None-Match: * instead of an ETag. (A project seeded from an existing model does return a contract and an ETag.) Then do the deterministic PyMuPDF steel-filter pass only: identify the framing-plan sheets, enumerate the drawing elements by layer/thickness/color into contract.filter.sheets/facets, PUT that project contract back to /api/contract/${req.appId}?project=${req.project} (a contract PUT MUST carry a precondition: If-Match with the ETag from that GET, or If-None-Match: * ONLY if the GET returned no ETag at all — one with neither is refused with 428; on 412 re-GET, re-apply your changes to the new document, and retry rather than repeating the same body), then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection and compose the steel.takeoff/v1 contract. ${post}${snaps}${note}`;
|
|
5232
5674
|
}
|
|
5233
|
-
return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached — re-read it into the SAME project as a new version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} to read the CURRENT contract, then do the deterministic PyMuPDF steel-filter pass only for the revised drawing set: identify the framing-plan sheets, enumerate drawing elements by layer/thickness/color into contract.filter.sheets/facets, preserve any compatible existing filter selections, PUT that project contract back to /api/contract/${req.appId}?project=${req.project}, then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection, compose the updated steel.takeoff/v1 contract, and PRESERVE each still-present member's id AND its sheet label (mint a NEW id only for a genuinely new member; drop the id of a member the revision deleted) so the version comparison matches members — do NOT renumber the whole model. ${post}${snaps}${note}`;
|
|
5675
|
+
return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached — re-read it into the SAME project as a new version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} to read the CURRENT contract, then do the deterministic PyMuPDF steel-filter pass only for the revised drawing set: identify the framing-plan sheets, enumerate drawing elements by layer/thickness/color into contract.filter.sheets/facets, preserve any compatible existing filter selections, PUT that project contract back to /api/contract/${req.appId}?project=${req.project} (a contract PUT MUST carry a precondition: If-Match with the ETag from the GET you just did, or If-None-Match: * if that GET returned no ETag — one without either is refused with 428; on 412 re-GET, re-apply, and retry rather than repeating the same body), then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection, compose the updated steel.takeoff/v1 contract, and PRESERVE each still-present member's id AND its sheet label (mint a NEW id only for a genuinely new member; drop the id of a member the revision deleted) so the version comparison matches members — do NOT renumber the whole model. ${post}${snaps}${note}`;
|
|
5234
5676
|
}
|
|
5235
5677
|
// The Knowledge step's Organize verb. The lifecycle is SERVER-owned: start claims the organize
|
|
5236
5678
|
// lock and mints the generation dir; finish publishes it and clears this request; fail releases
|
|
@@ -7024,7 +7466,8 @@
|
|
|
7024
7466
|
reportErr(e);
|
|
7025
7467
|
setComboTriggerLabel('server unreachable');
|
|
7026
7468
|
renderCanvasPlaceholder('offline');
|
|
7027
|
-
|
|
7469
|
+
// Only now — the workflow-update offer must never race the data the picker needs (#358).
|
|
7470
|
+
}).finally(startWorkflowUpdatePolling);
|
|
7028
7471
|
}
|
|
7029
7472
|
|
|
7030
7473
|
// Load the workspace. Entered ONLY for a valid (or offline-grace) subscription AND
|