@floless/app 0.115.0 → 0.117.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 +262 -31
- package/dist/schemas/steel.model.v2.schema.json +9 -4
- package/dist/schemas/steel.takeoff.v1.schema.json +7 -0
- package/dist/schemas/steel.takeoff.v1.staging-snapshot.json +263 -0
- package/dist/skills/floless-app-bridge/SKILL.md +1 -1
- package/dist/skills/floless-app-onboarding/SKILL.md +1 -1
- package/dist/skills/floless-app-queue/SKILL.md +1 -1
- package/dist/skills/floless-app-routines/SKILL.md +1 -1
- package/dist/skills/floless-app-steel-model/SKILL.md +9 -6
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +116 -17
- package/dist/skills/floless-app-ui/SKILL.md +1 -1
- package/dist/skills/floless-app-workflows/SKILL.md +1 -1
- package/dist/skills/reading-structural-drawings/SKILL.md +1 -1
- package/dist/skills/steel-drawing-abbreviations/SKILL.md +1 -1
- package/dist/web/app.css +52 -5
- package/dist/web/aware.js +194 -5
- package/dist/web/index.html +1 -1
- package/dist/web/json-schema-subset.js +72 -0
- package/dist/web/steel-editor.html +473 -142
- package/dist/web/steel-model-commands.js +154 -14
- package/dist/web/steel-model-v2-client-validation.js +95 -0
- package/dist/web/steel-model-v2-commands.js +836 -0
- package/dist/web/steel-model-v2-projection.js +170 -0
- package/dist/web/steel-plan-transform.js +151 -0
- package/dist/web/workspaces.js +406 -17
- package/package.json +3 -1
package/dist/web/workspaces.js
CHANGED
|
@@ -193,6 +193,14 @@
|
|
|
193
193
|
capability: 'Open model → new project',
|
|
194
194
|
sub: 'Copies the steel model open in Workflows into a new project here.',
|
|
195
195
|
label: 'Copy the open model',
|
|
196
|
+
// Describes the MECHANISM, never a live fact. Disabling this card when there is nothing to
|
|
197
|
+
// copy would need a server probe whose answer goes stale between render and click — so it
|
|
198
|
+
// could never be the only gate anyway (the rollback in createSeeded is). A tip that says
|
|
199
|
+
// what the card does sets the same expectation and cannot be wrong.
|
|
200
|
+
// "nothing is KEPT", not "nothing gets created" — the rollback's archive POST can itself
|
|
201
|
+
// fail, and on that branch a project does briefly exist. A tip must not promise what the
|
|
202
|
+
// failure path cannot honour.
|
|
203
|
+
tip: 'Copies the steel model currently open in Workflows. If nothing’s open there, nothing is kept.',
|
|
196
204
|
},
|
|
197
205
|
],
|
|
198
206
|
editor: '/steel-editor.html',
|
|
@@ -339,6 +347,35 @@
|
|
|
339
347
|
let wsAppEntries = wsDefaultAppEntries();
|
|
340
348
|
let current = null; // the open project (null = landing)
|
|
341
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Does the open project hold a model, as far as the Exports pane knows? (#490)
|
|
352
|
+
*
|
|
353
|
+
* Module state rather than a `paintExports` parameter because there are eighteen call sites — a
|
|
354
|
+
* repaint triggered by a finished export, a host-readiness probe, an SSE nudge — and every one of
|
|
355
|
+
* them would have to remember to thread it through. One that forgot would silently repaint the gate
|
|
356
|
+
* as if a model existed, which is the exact bug being fixed. `renderExports` owns refreshing it;
|
|
357
|
+
* `openProject` resets it so a model-less project cannot leave a stale `false` on the next one.
|
|
358
|
+
*
|
|
359
|
+
* Declared HERE with the other project-scoped state rather than beside `paintExports`, because
|
|
360
|
+
* `openProject` assigns it and sits earlier in the file — a `let` further down works only as long as
|
|
361
|
+
* nothing calls that function during module init, which is not a property worth depending on.
|
|
362
|
+
*
|
|
363
|
+
* Defaults TRUE, matching `projectHasContract`'s fail-open: the cost of a wrong `true` is the
|
|
364
|
+
* pre-existing 404, and the cost of a wrong `false` is telling someone their real model is missing.
|
|
365
|
+
*/
|
|
366
|
+
let exportsHasModel = true;
|
|
367
|
+
|
|
368
|
+
/** Sequence number for model-presence probes. A project-id check is NOT a staleness guard: two
|
|
369
|
+
* probes can be in flight for the SAME project, and an older "absent" answer landing last would
|
|
370
|
+
* re-disable Approve on a project that now has a model. Every writer bumps it; older results drop. */
|
|
371
|
+
let modelPresenceGen = 0;
|
|
372
|
+
|
|
373
|
+
/** The header's AUTHORED tooltip, captured from the static markup so the has-a-model state restores
|
|
374
|
+
* it verbatim. The first cut substituted "exports unlock after it", which is a FALSE description of
|
|
375
|
+
* an already-approved project — its exports are unlocked and its gate is gone. */
|
|
376
|
+
const APPROVE_TIP = document.getElementById('ws-approve')?.getAttribute('data-tip')
|
|
377
|
+
|| 'Locks in this version — your edits already auto-save; this is the sign-off.';
|
|
378
|
+
|
|
342
379
|
// The open app's visible label for a step key (Model→"Model" for steel, "Traced" for vectorize) —
|
|
343
380
|
// so shared chrome (banners, prompts) names the app's OWN step, never hard-coded steel vocabulary.
|
|
344
381
|
// Falls back to a capitalized key if the descriptor is missing a step.
|
|
@@ -685,6 +722,7 @@
|
|
|
685
722
|
const target = entry.ambiguous ? entry.appId : '';
|
|
686
723
|
return `<button type="button" class="ws-seed${isDrawing ? ' ws-seed-drop' : ''}" ` +
|
|
687
724
|
`aria-label="${escapeAttr((action.label || action.headline) + (target ? ` (on the ${target} workflow)` : ''))}" ` +
|
|
725
|
+
(action.tip ? `data-tip="${escapeAttr(action.tip)}" ` : '') +
|
|
688
726
|
`data-seed-app="${escapeAttr(entry.appId)}" data-seed-template="${escapeAttr(entry.templateId)}" data-seed-action="${escapeAttr(action.kind)}"` +
|
|
689
727
|
(isDrawing ? ` data-seed-drop="${escapeAttr(entry.appId)}"` : '') +
|
|
690
728
|
`>` +
|
|
@@ -943,11 +981,32 @@
|
|
|
943
981
|
if (!name) return;
|
|
944
982
|
try {
|
|
945
983
|
const { project, seeded } = await api('/api/projects', { method: 'POST', body: JSON.stringify({ name, app: appId, seedFromApp: true }) });
|
|
946
|
-
// Tell the truth about the import: seeded=false means there was no current model to copy
|
|
947
|
-
// (or it was unreadable) — the project is EMPTY, don't imply the model came across.
|
|
948
984
|
const seedLabel = (WORKSPACE_APPS[templateId] && WORKSPACE_APPS[templateId].seedLabel) || 'model';
|
|
949
|
-
|
|
950
|
-
|
|
985
|
+
// ROLL BACK when there was nothing to copy (#489). `seeded:false` means the app held no current
|
|
986
|
+
// model (or it was unreadable), so this card's ONE job did not happen. Saying so in a toast was
|
|
987
|
+
// honest but not enough: it still created and opened a project indistinguishable from a real
|
|
988
|
+
// one, whose Model tab reads "No model for steel-model" and whose only other signal is a 404 in
|
|
989
|
+
// a console the user never opens. They then have to discover the failure two clicks later and
|
|
990
|
+
// clean up a junk project. The sibling drop-a-drawing create already rolls its own failure back
|
|
991
|
+
// through archiveEmptyProject; this is the same move, and it can make the stronger statement —
|
|
992
|
+
// the branch happens BEFORE openProject, so nothing was ever shown and "no project was created"
|
|
993
|
+
// is literally true, where the drawing path can only say the empty one "was removed".
|
|
994
|
+
if (!seeded) {
|
|
995
|
+
const removed = await archiveEmptyProject(project.id);
|
|
996
|
+
showToast(
|
|
997
|
+
removed
|
|
998
|
+
? `There’s no ${seedLabel} currently open in Workflows to copy — no project was created.`
|
|
999
|
+
: `There’s no ${seedLabel} currently open in Workflows to copy — but an empty project was left behind; archive it from the ⋯ menu.`,
|
|
1000
|
+
'warn',
|
|
1001
|
+
);
|
|
1002
|
+
// `archiveEmptyProject` drops the local row whether or not the archive SUCCEEDED, so on
|
|
1003
|
+
// failure the card the toast just told the user to open a menu on would not be there. Go back
|
|
1004
|
+
// to the server: it still holds that project, so the card returns and the instruction can
|
|
1005
|
+
// actually be followed. On success this also reconciles against any racing loadProjects().
|
|
1006
|
+
if (removed) renderLanding(); else await loadProjects();
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
showToast(`Project "${project.name}" created from the current ${seedLabel}`, 'ok');
|
|
951
1010
|
track('workspace_project_created', { app: appId }); // takeoff-import create path
|
|
952
1011
|
projects.unshift(project);
|
|
953
1012
|
openProject(project.id);
|
|
@@ -1058,6 +1117,41 @@
|
|
|
1058
1117
|
setStep(initialStep);
|
|
1059
1118
|
applyMode();
|
|
1060
1119
|
syncWorkspaceGuide(); // point the shared beacon at THIS project's document lifecycle
|
|
1120
|
+
// Detached, but never silent: `projectHasContract` cannot reject, yet the code after its await can
|
|
1121
|
+
// (stepLabel -> wsApp on a descriptor without steps), and an unhandled rejection would leave the
|
|
1122
|
+
// header un-updated with nothing said.
|
|
1123
|
+
refreshModelPresence(p.id, p.app).catch((e) => { // gate the header CHECK Approve for THIS project (#490)
|
|
1124
|
+
console.error('[workspaces] could not resolve model presence', e);
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* One probe, three surfaces (#490). The header **✓ Approve** has the same defect the issue reported
|
|
1130
|
+
* on History and Exports — measured on a model-less project it is fully enabled, and the route it
|
|
1131
|
+
* posts to answers `404 {"error":"no contract to approve"}`. It is not an inline call-to-action
|
|
1132
|
+
* though: it is persistent chrome with nothing to swap it for, so it gets the codebase's
|
|
1133
|
+
* `aria-disabled` + `data-tip` treatment (`.e-act`, `.kb-organize`, `$migConfirm`) rather than
|
|
1134
|
+
* History's removal. `aria-disabled` and not `disabled`, for the reason those three already record:
|
|
1135
|
+
* a disabled button is unhoverable and unfocusable, so the tip explaining WHY would never reach the
|
|
1136
|
+
* person who needs it — and `approveProject` re-checks the same flag rather than trusting the
|
|
1137
|
+
* attribute.
|
|
1138
|
+
*/
|
|
1139
|
+
async function refreshModelPresence(projectId, appId) {
|
|
1140
|
+
const gen = ++modelPresenceGen;
|
|
1141
|
+
const present = await projectHasContract(projectId, appId);
|
|
1142
|
+
if (gen !== modelPresenceGen || !current || current.id !== projectId) return; // superseded
|
|
1143
|
+
applyModelPresence(present);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/** Push the answer to the flag AND the header together, so no two surfaces can disagree. */
|
|
1147
|
+
function applyModelPresence(present) {
|
|
1148
|
+
exportsHasModel = present;
|
|
1149
|
+
const btn = document.getElementById('ws-approve');
|
|
1150
|
+
if (!btn) return;
|
|
1151
|
+
btn.setAttribute('aria-disabled', String(!present));
|
|
1152
|
+
btn.setAttribute('data-tip', present
|
|
1153
|
+
? APPROVE_TIP
|
|
1154
|
+
: `Nothing to approve yet — read a drawing on ${stepLabel('drawings')} first`);
|
|
1061
1155
|
}
|
|
1062
1156
|
function closeProject() {
|
|
1063
1157
|
current = null;
|
|
@@ -1080,6 +1174,9 @@
|
|
|
1080
1174
|
// was already per-project, the two variables behind it were not.)
|
|
1081
1175
|
migReady = null;
|
|
1082
1176
|
closeMigrate();
|
|
1177
|
+
// Reset with the rest of the per-project state — this file resets `histDiffSupported` for exactly
|
|
1178
|
+
// this reason. Bumping the generation also voids any probe still in flight for the closing project.
|
|
1179
|
+
exportsHasModel = true; modelPresenceGen++;
|
|
1083
1180
|
lastRevState = 'none'; $revisionCard.hidden = true; closeProjMenu(); applyMode(); syncWorkspaceGuide();
|
|
1084
1181
|
}
|
|
1085
1182
|
document.getElementById('ws-back').addEventListener('click', closeProject);
|
|
@@ -1150,8 +1247,33 @@
|
|
|
1150
1247
|
// Exports gate unlocks without a reload.
|
|
1151
1248
|
async function approveProject() {
|
|
1152
1249
|
if (!current) return;
|
|
1250
|
+
// The flag, not the attribute — `aria-disabled` is advisory and the button stays clickable BY
|
|
1251
|
+
// DESIGN (that is what keeps its data-tip reachable), so this is the check that actually holds.
|
|
1252
|
+
// Without it the header button still fires the 404 that #490 is about. Say what to do instead
|
|
1253
|
+
// rather than reporting the failure: the user has no model, and that is the only useful sentence.
|
|
1254
|
+
// RE-PROBE before refusing, never refuse from the cache. A stale `false` here is far worse than
|
|
1255
|
+
// the 404 it replaced: it blocks a legitimate sign-off while confidently telling the user to read a
|
|
1256
|
+
// drawing they have already read — and stale IS reachable, because a model can appear without this
|
|
1257
|
+
// pane hearing about it (an AI read landing while Drawings is open, a staged review confirmed
|
|
1258
|
+
// elsewhere, the editor's first autosave). One request at click time removes the whole class.
|
|
1259
|
+
if (!exportsHasModel) {
|
|
1260
|
+
const stillNone = !(await projectHasContract(current.id, current.app));
|
|
1261
|
+
if (!current) return; // closed during the probe
|
|
1262
|
+
applyModelPresence(!stillNone); // correct the cache either way — the header was lying too
|
|
1263
|
+
if (stillNone) {
|
|
1264
|
+
showToast(`There’s no model to approve yet — read a drawing on ${stepLabel('drawings')} first.`, 'warn');
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1153
1268
|
const approvingProject = current;
|
|
1154
1269
|
const btn = document.getElementById('ws-approve');
|
|
1270
|
+
// Unreachable today (#ws-approve is static markup), but approveProject is driven from THREE
|
|
1271
|
+
// controls — a silent return would turn all three into dead clicks if the header were ever renamed.
|
|
1272
|
+
if (!btn) {
|
|
1273
|
+
console.error('[workspaces] #ws-approve is missing — Approve cannot run');
|
|
1274
|
+
showToast('Couldn’t start Approve — reload the page.', 'warn');
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1155
1277
|
btn.disabled = true;
|
|
1156
1278
|
const prev = btn.textContent;
|
|
1157
1279
|
btn.textContent = '◆ Approving…';
|
|
@@ -3621,7 +3743,11 @@
|
|
|
3621
3743
|
for (const attr of EXPORT_FOCUS_ATTRS) {
|
|
3622
3744
|
if (element.hasAttribute(attr)) return { attr, value: element.getAttribute(attr), cardKind };
|
|
3623
3745
|
}
|
|
3624
|
-
|
|
3746
|
+
// BOTH gate buttons. The gate renders one or the other depending on whether a model exists, and
|
|
3747
|
+
// this pane repaints on a timer and on every export completion — so a keyboard user sitting on
|
|
3748
|
+
// "Go to <step>" would be dropped to <body> with no announcement.
|
|
3749
|
+
return (element.id === 'ws-exports-approve' || element.id === 'ws-exports-go-drawings')
|
|
3750
|
+
? { id: element.id, cardKind: null } : null;
|
|
3625
3751
|
}
|
|
3626
3752
|
|
|
3627
3753
|
function restoreExportFocus(identity) {
|
|
@@ -3641,6 +3767,7 @@
|
|
|
3641
3767
|
}
|
|
3642
3768
|
|
|
3643
3769
|
function paintExports(approvedAt, requestedRestoreKind) {
|
|
3770
|
+
const hasModel = exportsHasModel;
|
|
3644
3771
|
// An explicit kind says "put them back on the button they pressed" — but only if they are still
|
|
3645
3772
|
// here. A send runs for minutes and its refresh repaints at the END; honouring the request
|
|
3646
3773
|
// unconditionally would reach across and yank focus out of whatever they had moved on to, which
|
|
@@ -3653,8 +3780,14 @@
|
|
|
3653
3780
|
const approved = !!approvedAt;
|
|
3654
3781
|
let html = '';
|
|
3655
3782
|
if (!approved) {
|
|
3656
|
-
|
|
3657
|
-
|
|
3783
|
+
// Same split as History's empty state (#490): with a model, Approve is genuinely the unlocking
|
|
3784
|
+
// action; with none, `POST …/approve` 404s, so pointing at it is a dead end and the real next
|
|
3785
|
+
// step is to go read a drawing. `stepLabel('drawings')` because that label is per-app.
|
|
3786
|
+
html += hasModel
|
|
3787
|
+
? `<div class="ws-exports-gate">Exports go out after sign-off — ` +
|
|
3788
|
+
`<button type="button" id="ws-exports-approve">Approve this version</button> to enable them.</div>`
|
|
3789
|
+
: `<div class="ws-exports-gate">Nothing to export yet — ` +
|
|
3790
|
+
`<button type="button" id="ws-exports-go-drawings">Go to ${escapeHtml(stepLabel('drawings'))}</button> to get started.</div>`;
|
|
3658
3791
|
}
|
|
3659
3792
|
// The word `exports` was styled like a link (mono, accent-bright) and was inert, so people
|
|
3660
3793
|
// clicked it and nothing happened. It is now the control it already looked like: a real button
|
|
@@ -3662,8 +3795,14 @@
|
|
|
3662
3795
|
// one the per-file Reveal button uses — rather than a new icon vocabulary. Left ENABLED before
|
|
3663
3796
|
// the first export on purpose: the sentence asserts the folder as a present-tense fact, and a
|
|
3664
3797
|
// disabled-in-its-empty-state control is exactly the trap this pane is reviewed for.
|
|
3665
|
-
|
|
3666
|
-
|
|
3798
|
+
//
|
|
3799
|
+
// The headline used to read "Export at any stage", which flatly contradicted the gate directly
|
|
3800
|
+
// above it ("Exports go out after sign-off") and every card's own "Available after approval"
|
|
3801
|
+
// caption. The note's job — per the comment above — is to justify the exports-FOLDER button
|
|
3802
|
+
// staying enabled, not to claim the export actions work unapproved. "Polishing is optional" was
|
|
3803
|
+
// the true and useful half, and it survives; only the opening clause overreached.
|
|
3804
|
+
html += `<div class="exports-note"><b>Any approved version can be exported</b> — polishing further ` +
|
|
3805
|
+
`is optional. Each writes to this project’s <button type="button" class="exports-note-link" data-open-exports-folder ` +
|
|
3667
3806
|
`aria-label="Open the exports folder" data-tip="Open this project’s exports folder">▤ exports</button> folder.</div>`;
|
|
3668
3807
|
const cards = (wsApp() && wsApp().exports) || [];
|
|
3669
3808
|
html += '<div class="export-grid">' + cards.map((c) => cardHtml(c, approved)).join('') + '</div>';
|
|
@@ -3735,6 +3874,47 @@
|
|
|
3735
3874
|
* there is no identity left to restore. Carrying the kind through both paints means pressing
|
|
3736
3875
|
* Send leaves you on Send.
|
|
3737
3876
|
*/
|
|
3877
|
+
/**
|
|
3878
|
+
* Does the open project hold a stored document at all? (#490)
|
|
3879
|
+
*
|
|
3880
|
+
* NOT the same question as "does it have versions", and conflating them is the bug. History's empty
|
|
3881
|
+
* state fires whenever the ledger is empty, which covers TWO situations: a real model waiting for its
|
|
3882
|
+
* first sign-off, and a project nothing has ever been read into. Only the second must not offer
|
|
3883
|
+
* Approve — `POST …/approve` 404s there, and the primary call-to-action on the screen becomes the one
|
|
3884
|
+
* control that lies while every export button around it is correctly gated.
|
|
3885
|
+
*
|
|
3886
|
+
* Decided HERE and shared by both panes rather than derived twice, for the reason
|
|
3887
|
+
* `/api/projects/:id/versions` already gives for shipping `diffSupported` from the server: a client
|
|
3888
|
+
* that guesses is how an affordance appears for something the server will then refuse. Two panes
|
|
3889
|
+
* guessing separately is the same failure with an extra way to disagree.
|
|
3890
|
+
*
|
|
3891
|
+
* `quietMissing=1` answers 204 for both kinds of absence and never emits an ETag, so this costs one
|
|
3892
|
+
* cheap request and cannot be confused with a real document.
|
|
3893
|
+
*/
|
|
3894
|
+
async function projectHasContract(projectId, appId) {
|
|
3895
|
+
try {
|
|
3896
|
+
const url = `/api/contract/${encodeURIComponent(appId)}?project=${encodeURIComponent(projectId)}&quietMissing=1`;
|
|
3897
|
+
// TIMEOUT, because a HANG is not an error and would never reach the catch below. Both callers
|
|
3898
|
+
// await this before painting, so without a deadline a wedged connection leaves History reading
|
|
3899
|
+
// "Loading history…" and every Exports destination row on "Checking…" indefinitely, with no
|
|
3900
|
+
// error and no retry. HEAD, not GET — `web/aware.js`'s copy of this probe already does it and
|
|
3901
|
+
// says why: a GET pulls the whole contract (hundreds of KB on a real model) for a boolean, on
|
|
3902
|
+
// every repaint, and repaints fire after every export and every send to a CAD host.
|
|
3903
|
+
const res = await fetch(url, { method: 'HEAD', signal: AbortSignal.timeout(4000) });
|
|
3904
|
+
// 204 is the ONE unambiguous "nothing here" — the route collapses both kinds of absence into it
|
|
3905
|
+
// after its own app/project mismatch check. EVERYTHING else fails open, including a body that
|
|
3906
|
+
// would not parse: a truncated or malformed 200 means the probe failed, not that the model is
|
|
3907
|
+
// gone, and reading that as absence would disable Approve on a real project.
|
|
3908
|
+
return res.status !== 204;
|
|
3909
|
+
} catch {
|
|
3910
|
+
// Fail OPEN, deliberately. A network blip must not repaint a real project's History as "nothing
|
|
3911
|
+
// here yet — go read a drawing", which is a lie about the user's work and hides the Approve they
|
|
3912
|
+
// were about to click. The cost of the other direction is the pre-existing behaviour: Approve is
|
|
3913
|
+
// offered, and if there is genuinely nothing it answers 404 exactly as it does today.
|
|
3914
|
+
return true;
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3738
3918
|
async function renderExports(restoreKind) {
|
|
3739
3919
|
if (!current) return;
|
|
3740
3920
|
const id = current.id, app = current.app;
|
|
@@ -3745,7 +3925,18 @@
|
|
|
3745
3925
|
? Object.fromEntries(SEND_HOSTS.map((h) => [h.host, { ok: false, state: 'checking' }]))
|
|
3746
3926
|
: {};
|
|
3747
3927
|
renderReadinessState = hasRender ? { ok: false, state: 'checking' } : null;
|
|
3928
|
+
// WHAT WAS PAINTED, not what the flag says. The header's probe can settle between this paint and
|
|
3929
|
+
// ours and move the flag WITHOUT repainting this pane — comparing to the flag then finds them
|
|
3930
|
+
// equal, skips the repaint, and leaves the gate drawn with the old value. That is #490 reproduced
|
|
3931
|
+
// inside the pane this fix is for, reachable by opening an empty project and clicking Exports
|
|
3932
|
+
// while the open-time probe is still in flight.
|
|
3933
|
+
const paintedWith = exportsHasModel;
|
|
3748
3934
|
paintExports(current.approvedAt, restoreKind);
|
|
3935
|
+
const gen = ++modelPresenceGen;
|
|
3936
|
+
const modelPresent = await projectHasContract(id, app);
|
|
3937
|
+
if (gen !== modelPresenceGen || !current || current.id !== id || $wsExports.hidden) return;
|
|
3938
|
+
applyModelPresence(modelPresent);
|
|
3939
|
+
if (modelPresent !== paintedWith) paintExports(current.approvedAt, restoreKind);
|
|
3749
3940
|
let state = null;
|
|
3750
3941
|
let approvedAt = current.approvedAt; // fallback if the fetch fails (best-known)
|
|
3751
3942
|
const exportPromise = api(`/api/contract/${encodeURIComponent(app)}/exports?project=${encodeURIComponent(id)}`);
|
|
@@ -4170,6 +4361,8 @@
|
|
|
4170
4361
|
|
|
4171
4362
|
$wsExports.addEventListener('click', (e) => {
|
|
4172
4363
|
if (e.target.closest('#ws-exports-approve')) { approveProject(); return; }
|
|
4364
|
+
// The no-model gate's real next step — mirrors History's #hist-go-drawings.
|
|
4365
|
+
if (e.target.closest('#ws-exports-go-drawings')) { setStep('drawings'); return; }
|
|
4173
4366
|
if (e.target.closest('[data-open-exports-folder]')) { openExportsFolder(); return; }
|
|
4174
4367
|
const details = e.target.closest('[data-export-details]');
|
|
4175
4368
|
if (details) { showExportReceiptDetails(details.dataset.exportDetails, details); return; }
|
|
@@ -4346,6 +4539,11 @@
|
|
|
4346
4539
|
const tip = (vr.versions || [])[0];
|
|
4347
4540
|
if (tip && tip.kind === 'revision-read' && tip.n > revBaseVersion) {
|
|
4348
4541
|
current.approvedAt = vr.approvedAt || undefined; // the AI read cleared the sign-off (exports re-lock)
|
|
4542
|
+
// A model may have just come into existence, and the repaints below fire only for the VISIBLE
|
|
4543
|
+
// pane — which on the drop-a-drawing flow is Drawings, neither of them. Without this the header
|
|
4544
|
+
// stays gated, telling the user to read a drawing they just finished reading. (approveProject
|
|
4545
|
+
// re-probes so the ACTION is never blocked; this stops the chrome lying in the meantime.)
|
|
4546
|
+
refreshModelPresence(current.id, current.app).catch(() => { /* header stays as-is */ });
|
|
4349
4547
|
if (!$wsHistory.hidden) renderHistory();
|
|
4350
4548
|
// …and the Exports pane, if it is the one showing. "Exports re-lock" was the intent, but
|
|
4351
4549
|
// nothing repainted them: the pane kept its live buttons and its per-destination Details
|
|
@@ -5198,6 +5396,143 @@
|
|
|
5198
5396
|
}
|
|
5199
5397
|
|
|
5200
5398
|
/** One tickable decision. `idx` indexes the decision list, which is what the progress count walks. */
|
|
5399
|
+
/**
|
|
5400
|
+
* Group decisions that are the SAME decision reported many times (#493).
|
|
5401
|
+
*
|
|
5402
|
+
* On a real read this is the difference between a usable gate and an unreachable one: a 218-member
|
|
5403
|
+
* model produced 260 decisions, 230 of them carrying one identical sentence — sheet S-203 declares
|
|
5404
|
+
* no `default_tos`, restated once per member end. Those are not 230 judgements. They are one fact,
|
|
5405
|
+
* and ticking it 230 times cannot inform the decision that is actually being made.
|
|
5406
|
+
*
|
|
5407
|
+
* THE KEY IS EXACT (code, message) EQUALITY, and that is the safety property rather than a
|
|
5408
|
+
* convenience. A `dedup-merge-proposed` row always names its own survivor and retired members in its
|
|
5409
|
+
* message, so two of them can never collide — the key structurally cannot sweep up a decision whose
|
|
5410
|
+
* instances differ, which is what keeps this a collapse of duplicates and not a bulk-accept in
|
|
5411
|
+
* disguise. (The "Needs your decision" bucket still renders NO bulk bar; that rule is untouched.)
|
|
5412
|
+
*
|
|
5413
|
+
* Runs are built in list order, so the rows stay in the order the reader would otherwise have met
|
|
5414
|
+
* them.
|
|
5415
|
+
*/
|
|
5416
|
+
/**
|
|
5417
|
+
* The decisions a fan-out row may collapse — and NOTHING ELSE MAY.
|
|
5418
|
+
*
|
|
5419
|
+
* DEFAULT-DENY, for the same reason `BULKABLE_DECISIONS` and `MIGRATE_TOPIC` are: a collapsed row is
|
|
5420
|
+
* one confirmation standing for many, which is the act epic §8 restricts, so eligibility has to be
|
|
5421
|
+
* granted deliberately rather than inherited by any code whose sentence happens to repeat. The first
|
|
5422
|
+
* cut keyed purely on (code, message) and was opt-out — review proved that reintroduced a bulk accept
|
|
5423
|
+
* by exactly the route the sibling tables were written to prevent.
|
|
5424
|
+
*
|
|
5425
|
+
* THE TEST IS THE SAME ONE `BULKABLE_DECISIONS` applies, one level down: is the repeated sentence a
|
|
5426
|
+
* statement about a SHEET (or the document) that the migrator restates per item, or a finding about
|
|
5427
|
+
* each particular item? `elevation-default-missing` is the first: it says sheet X declares no
|
|
5428
|
+
* `default_tos`, and every end that follows that sheet default gets the identical sentence. Resolving
|
|
5429
|
+
* it means giving sheet X a default — one act, whatever the fan-out.
|
|
5430
|
+
*
|
|
5431
|
+
* `col-metadata-unassigned` is the counter-example and the reason this list exists. Its message names
|
|
5432
|
+
* only the column mark ("column \"C1\" carries col-level note …"), so two DIFFERENT columns sharing a
|
|
5433
|
+
* mark across two sheets produce the identical sentence — and its question ("assign it to an end,
|
|
5434
|
+
* both ends, or the member") genuinely can be answered differently for each. Under the opt-out key
|
|
5435
|
+
* they collapsed into one row, titled with only the first sheet. Measured by review, not reasoned.
|
|
5436
|
+
*/
|
|
5437
|
+
const FANOUT_ELIGIBLE = new Set(['elevation-default-missing']);
|
|
5438
|
+
|
|
5439
|
+
function byIdenticalCause(list) {
|
|
5440
|
+
const runs = new Map();
|
|
5441
|
+
for (const d of list) {
|
|
5442
|
+
// `sheet` IS PART OF THE KEY, even though the eligible code names its sheet in the message. The
|
|
5443
|
+
// server's own `decisionsDigest` keys a decision on [code, sheet, path, message], so dropping a
|
|
5444
|
+
// field it treats as identity is how the two disagree about what "the same decision" means.
|
|
5445
|
+
// `path` is the axis a fan-out is meant to collapse, so it — and only it — is left out.
|
|
5446
|
+
//
|
|
5447
|
+
// JSON.stringify of the tuple, not a delimiter-joined string: a separator has to be a character
|
|
5448
|
+
// the fields cannot contain, and choosing one invisibly is how a raw NUL ended up in this source
|
|
5449
|
+
// on the first cut. Encoding the tuple needs no reserved character at all.
|
|
5450
|
+
//
|
|
5451
|
+
// An INELIGIBLE code is keyed by identity, so it can never share a run with anything.
|
|
5452
|
+
const key = FANOUT_ELIGIBLE.has(d.code)
|
|
5453
|
+
? JSON.stringify([d.code, d.sheet ?? null, d.message || ''])
|
|
5454
|
+
: JSON.stringify(['@solo', runs.size, d.code]);
|
|
5455
|
+
if (!runs.has(key)) runs.set(key, []);
|
|
5456
|
+
runs.get(key).push(d);
|
|
5457
|
+
}
|
|
5458
|
+
return [...runs.values()];
|
|
5459
|
+
}
|
|
5460
|
+
|
|
5461
|
+
/**
|
|
5462
|
+
* One row standing for N identical decisions, with the individual items disclosed behind an
|
|
5463
|
+
* expander. One real checkbox, so `syncMigrateProgress`'s `boxes.length` counts DECISIONS — which is
|
|
5464
|
+
* what "0 of 4 confirmed" should have meant all along.
|
|
5465
|
+
*
|
|
5466
|
+
* Honest by construction: the count is on the row face (not hidden in a tooltip), the expander
|
|
5467
|
+
* offers the evidence proactively rather than asking to be trusted, the badge stays "Decide", and
|
|
5468
|
+
* the message is the server's own sentence shown once, verbatim.
|
|
5469
|
+
*
|
|
5470
|
+
* Safe because the commit does not depend on these boxes. `confirmMigrate` sends
|
|
5471
|
+
* `acknowledgeDecisions: report.decisionsDigest` — a digest the SERVER computed over the whole
|
|
5472
|
+
* decision set at preview time — so the ticking is a client-side "prove you read them" gate and
|
|
5473
|
+
* collapsing rows cannot weaken the precondition. Verified against the route before building this.
|
|
5474
|
+
*/
|
|
5475
|
+
function migFanoutRow(run, idx) {
|
|
5476
|
+
const first = run[0];
|
|
5477
|
+
const row = revEl('div', 'rev-row k-changed');
|
|
5478
|
+
const id = `mig-dec-${idx}`;
|
|
5479
|
+
const label = revEl('label', 'rev-check');
|
|
5480
|
+
const box = document.createElement('input');
|
|
5481
|
+
box.type = 'checkbox';
|
|
5482
|
+
box.dataset.migidx = String(idx);
|
|
5483
|
+
box.dataset.migcode = first.code;
|
|
5484
|
+
box.dataset.migfanout = String(run.length); // read by syncMigrateProgress for the "ends affected" line
|
|
5485
|
+
// The scope belongs in the ACCESSIBLE NAME, not only in the visible count — a screen-reader user
|
|
5486
|
+
// must hear what they are confirming before they tick it, not after.
|
|
5487
|
+
box.setAttribute('aria-label', `Confirm this decision for all ${run.length} affected items`);
|
|
5488
|
+
box.setAttribute('aria-describedby', `${id}-msg`);
|
|
5489
|
+
label.appendChild(box);
|
|
5490
|
+
|
|
5491
|
+
const main = revEl('div', 'rev-row-main');
|
|
5492
|
+
const head = revEl('div', 'rev-row-head');
|
|
5493
|
+
head.appendChild(revEl('span', 'rev-kind-badge', 'Decide'));
|
|
5494
|
+
// The shared ROOT CAUSE names the row — there is no single member to name, and naming one of the
|
|
5495
|
+
// 230 would be worse than naming none.
|
|
5496
|
+
const title = revEl('span', 'rev-row-title', first.sheet || first.path || migTopic(first.code));
|
|
5497
|
+
title.id = `${id}-title`;
|
|
5498
|
+
head.appendChild(title);
|
|
5499
|
+
head.appendChild(revEl('span', 'ws-archived-count', String(run.length)));
|
|
5500
|
+
main.appendChild(head);
|
|
5501
|
+
|
|
5502
|
+
const msg = revEl('div', 'rev-row-note', first.message || first.code);
|
|
5503
|
+
msg.id = `${id}-msg`;
|
|
5504
|
+
main.appendChild(msg);
|
|
5505
|
+
|
|
5506
|
+
// SAY WHAT THE TICK COVERS, in the visible row and not only in the accessible name. The count
|
|
5507
|
+
// badge above states the scale; this states the CONSEQUENCE, which is the part someone consenting
|
|
5508
|
+
// needs. Without it the row reads as one decision that happens to mention a number.
|
|
5509
|
+
main.appendChild(revEl('div', 'mig-fanout-scope',
|
|
5510
|
+
`Confirming this row confirms it for all ${run.length}.`));
|
|
5511
|
+
|
|
5512
|
+
// CLOSED by default — never auto-open a 230-item list next to sibling rows the user must also see.
|
|
5513
|
+
const det = document.createElement('details');
|
|
5514
|
+
det.className = 'mig-fanout';
|
|
5515
|
+
const sum = document.createElement('summary');
|
|
5516
|
+
sum.className = 'mig-fanout-summary';
|
|
5517
|
+
sum.setAttribute('data-tip', 'See exactly which items this covers');
|
|
5518
|
+
sum.appendChild(revEl('span', 'ws-archived-caret', '›'));
|
|
5519
|
+
sum.appendChild(document.createTextNode(`Show all ${run.length} affected items`));
|
|
5520
|
+
det.appendChild(sum);
|
|
5521
|
+
const listEl = revEl('div', 'mig-fanout-list');
|
|
5522
|
+
for (const d of run) {
|
|
5523
|
+
// Read-only evidence, not 230 more checkboxes: the commit is digest-based, so per-item ticks
|
|
5524
|
+
// would imply a granularity the server cannot honour.
|
|
5525
|
+
listEl.appendChild(revEl('span', 'mig-fanout-item',
|
|
5526
|
+
[d.sheet, d.path, d.id].filter(Boolean).join(' · ') || d.code));
|
|
5527
|
+
}
|
|
5528
|
+
det.appendChild(listEl);
|
|
5529
|
+
main.appendChild(det);
|
|
5530
|
+
|
|
5531
|
+
row.appendChild(label);
|
|
5532
|
+
row.appendChild(main);
|
|
5533
|
+
return row;
|
|
5534
|
+
}
|
|
5535
|
+
|
|
5201
5536
|
function migDecisionRow(issue, idx, proposal) {
|
|
5202
5537
|
const row = revEl('div', 'rev-row k-changed');
|
|
5203
5538
|
const id = `mig-dec-${idx}`;
|
|
@@ -5335,11 +5670,21 @@
|
|
|
5335
5670
|
};
|
|
5336
5671
|
if (choices.length) {
|
|
5337
5672
|
body.appendChild(section('Needs your decision',
|
|
5338
|
-
'each of these could have gone another way — take them one at a time'
|
|
5673
|
+
'each of these could have gone another way — take them one at a time; '
|
|
5674
|
+
+ 'some apply to many parts of the model at once'));
|
|
5339
5675
|
for (const [topic, list] of byTopic(choices)) {
|
|
5676
|
+
const runs = byIdenticalCause(list);
|
|
5677
|
+
// THE HEADER COUNTS DECISIONS, matching the rows beneath it and the progress line. Passing the
|
|
5678
|
+
// raw instance count made the same unlabelled number mean two different things on one screen —
|
|
5679
|
+
// a topic would read "230" over a single row that the progress line counted as one. The
|
|
5680
|
+
// fan-out is stated on the row that owns it, which is the only place it means something.
|
|
5340
5681
|
// `null` bucket → `group` renders no bulk bar. The absence IS the rule, not an oversight.
|
|
5341
|
-
const g = group(topic,
|
|
5342
|
-
for (const
|
|
5682
|
+
const g = group(topic, runs.length, null);
|
|
5683
|
+
for (const run of runs) {
|
|
5684
|
+
g.appendChild(run.length === 1
|
|
5685
|
+
? migDecisionRow(run[0], idxOf.get(run[0]), proposalFor(run[0]))
|
|
5686
|
+
: migFanoutRow(run, idxOf.get(run[0])));
|
|
5687
|
+
}
|
|
5343
5688
|
body.appendChild(g);
|
|
5344
5689
|
}
|
|
5345
5690
|
}
|
|
@@ -5385,11 +5730,18 @@
|
|
|
5385
5730
|
const boxes = [...$migBody.querySelectorAll('input[type="checkbox"][data-migidx]')];
|
|
5386
5731
|
const done = boxes.filter((b) => b.checked).length;
|
|
5387
5732
|
const left = boxes.length - done;
|
|
5733
|
+
// A collapsed row stands for many items (#493), so the count of BOXES is the count of decisions
|
|
5734
|
+
// while the count of ITEMS is what the reader is actually agreeing about. State both, and only
|
|
5735
|
+
// when they differ — on a model with no fan-out the parenthetical would be noise.
|
|
5736
|
+
const items = boxes.reduce((n, b) => n + (Number(b.dataset.migfanout) || 1), 0);
|
|
5737
|
+
const fannedOut = items > boxes.length;
|
|
5388
5738
|
if (!boxes.length) { $migProgress.hidden = true; }
|
|
5389
5739
|
else {
|
|
5390
5740
|
$migProgress.replaceChildren();
|
|
5391
5741
|
$migProgress.appendChild(revEl('b', null, String(done)));
|
|
5392
|
-
$migProgress.appendChild(document.createTextNode(
|
|
5742
|
+
$migProgress.appendChild(document.createTextNode(
|
|
5743
|
+
` of ${boxes.length} decision${boxes.length === 1 ? '' : 's'} confirmed`));
|
|
5744
|
+
if (fannedOut) $migProgress.appendChild(document.createTextNode(` (${items} items affected)`));
|
|
5393
5745
|
if (left) $migProgress.appendChild(document.createTextNode(` — ${left} still to go.`));
|
|
5394
5746
|
$migProgress.hidden = false;
|
|
5395
5747
|
}
|
|
@@ -5397,7 +5749,8 @@
|
|
|
5397
5749
|
$migConfirm.setAttribute('aria-disabled', String(!ready));
|
|
5398
5750
|
$migConfirm.setAttribute('data-tip', ready
|
|
5399
5751
|
? 'Convert this project — a new version is recorded'
|
|
5400
|
-
: `Confirm all ${boxes.length}
|
|
5752
|
+
: `Confirm all ${boxes.length} decision${boxes.length === 1 ? '' : 's'} before converting`
|
|
5753
|
+
+ `${fannedOut ? ` (covers ${items} items)` : ''} — ${left} left`);
|
|
5401
5754
|
}
|
|
5402
5755
|
|
|
5403
5756
|
function closeMigrate() {
|
|
@@ -5728,9 +6081,42 @@
|
|
|
5728
6081
|
versions = rows;
|
|
5729
6082
|
if (!rows.length) {
|
|
5730
6083
|
// Empty = an inline-action banner (never a bare header row that reads as broken/loading).
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
6084
|
+
//
|
|
6085
|
+
// TWO empty states, because "no versions" has two causes and only one of them is Approve's.
|
|
6086
|
+
// With a model present, Approve genuinely is the next step and creates v1. With NO model the
|
|
6087
|
+
// approve route 404s — so offering it made the screen's most prominent control the only one that
|
|
6088
|
+
// lied, while every export button beside it was correctly gated. The honest next step there is a
|
|
6089
|
+
// different action on a different step, so Approve is REMOVED rather than disabled: the same
|
|
6090
|
+
// reasoning `migRefusal` records for rendering no Confirm at all — an inert primary button reads
|
|
6091
|
+
// as an invitation to find the way around it, and here there is nothing to get around.
|
|
6092
|
+
//
|
|
6093
|
+
// stepLabel('drawings'), never the literal word: the step key is shared but its LABEL is per-app
|
|
6094
|
+
// ("Drawings" on steel-model, "Source" on vectorize), so hardcoding it would ship a new
|
|
6095
|
+
// wrong-word bug on the other workspace app in a change about correctness.
|
|
6096
|
+
//
|
|
6097
|
+
// Built with DOM methods rather than innerHTML — the label comes from a descriptor, so it is the
|
|
6098
|
+
// same "don't route it through a string template at all" rule `importFailedCmdRow` follows.
|
|
6099
|
+
const gen = ++modelPresenceGen;
|
|
6100
|
+
const hasModel = await projectHasContract(id, current.app);
|
|
6101
|
+
if (gen !== modelPresenceGen || !current || current.id !== id || $wsHistory.hidden) return;
|
|
6102
|
+
applyModelPresence(hasModel); // one answer, every surface — History used to keep its own
|
|
6103
|
+
const empty = document.createElement('div');
|
|
6104
|
+
empty.className = 'hist-empty';
|
|
6105
|
+
const btn = document.createElement('button');
|
|
6106
|
+
btn.type = 'button';
|
|
6107
|
+
if (hasModel) {
|
|
6108
|
+
btn.id = 'hist-approve';
|
|
6109
|
+
btn.textContent = 'Approve this version';
|
|
6110
|
+
empty.append('No versions yet — ', btn, ' to create ');
|
|
6111
|
+
const v1 = document.createElement('b');
|
|
6112
|
+
v1.textContent = 'v1';
|
|
6113
|
+
empty.append(v1, ' and start the ledger.');
|
|
6114
|
+
} else {
|
|
6115
|
+
btn.id = 'hist-go-drawings';
|
|
6116
|
+
btn.textContent = `Go to ${stepLabel('drawings')}`;
|
|
6117
|
+
empty.append('Nothing here yet — ', btn, ' to get started.');
|
|
6118
|
+
}
|
|
6119
|
+
$wsHistory.replaceChildren(empty);
|
|
5734
6120
|
return;
|
|
5735
6121
|
}
|
|
5736
6122
|
// Working copy = the draft; when it isn't signed off (approvedAt cleared by an edit or a
|
|
@@ -6192,6 +6578,9 @@
|
|
|
6192
6578
|
|
|
6193
6579
|
$wsHistory.addEventListener('click', (e) => {
|
|
6194
6580
|
if (e.target.closest('#hist-approve')) { approveProject(); return; }
|
|
6581
|
+
// The no-model empty state's real next step: go read a drawing. Same handler shape as the
|
|
6582
|
+
// Approve it replaces, so the pane keeps owning its own inline actions.
|
|
6583
|
+
if (e.target.closest('#hist-go-drawings')) { setStep('drawings'); return; }
|
|
6195
6584
|
if (e.target.closest('.hc-cancel')) { closeRollbackConfirm(); return; }
|
|
6196
6585
|
const go = e.target.closest('[data-hc-go]');
|
|
6197
6586
|
if (go) { rollbackTo(Number(go.dataset.hcGo)); return; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floless/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.117.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
|
|
6
6
|
"bin": {
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"build": "node build/bundle.mjs",
|
|
26
26
|
"build:exe": "node build/bundle.mjs && node build/make-sea.mjs",
|
|
27
27
|
"verify:skills": "node build/verify-shipped-skills.mjs",
|
|
28
|
+
"verify:skill-versions": "node build/verify-skill-versions.mjs",
|
|
28
29
|
"verify:flo": "node build/verify-flo-descriptions.mjs",
|
|
30
|
+
"verify:flo-naming": "node build/verify-flo-naming.mjs",
|
|
29
31
|
"verify:no-title": "node build/verify-no-title.mjs",
|
|
30
32
|
"verify:display-sync": "node build/verify-display-sync.mjs",
|
|
31
33
|
"verify:view-modes": "node build/verify-view-modes.mjs",
|