@floless/app 0.166.0 → 0.167.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 +9455 -6597
- package/dist/schemas/drawing-check.profile.v1.schema.json +1 -1
- package/dist/schemas/steel.model.v2.schema.json +2 -1
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +14 -2
- package/dist/templates/college-phase-exporter.flo +11 -45
- package/dist/web/app.css +58 -0
- package/dist/web/aware.js +383 -86
- package/dist/web/chat.css +22 -0
- package/dist/web/chat.js +630 -40
- package/dist/web/commands-filter.js +23 -0
- package/dist/web/commands-shell.js +133 -9
- package/dist/web/index.html +8 -6
- package/dist/web/project-history.js +131 -10
- package/dist/web/steel-ai-marks.js +45 -1
- package/dist/web/steel-editor.html +61 -15
- package/dist/web/steel-filter-flo.js +171 -7
- package/dist/web/steel-filter.html +36 -10
- package/dist/web/terminal-requests.js +5 -0
- package/dist/web/tool-updates.js +65 -20
- package/dist/web/workspaces.js +363 -41
- package/package.json +1 -1
package/dist/web/workspaces.js
CHANGED
|
@@ -391,6 +391,15 @@
|
|
|
391
391
|
let teklaUploadProjectId = null;
|
|
392
392
|
const teklaAdmissionFailures = new Map();
|
|
393
393
|
let currentStep = 'model';
|
|
394
|
+
// #3053: the finished-read band (see readCompletionNotice).
|
|
395
|
+
const READ_COMPLETION_SEEN = 'floless:read-complete-seen:';
|
|
396
|
+
// A read older than this is not news: without the limit, the first open after an update would announce every
|
|
397
|
+
// project's long-finished read.
|
|
398
|
+
const READ_COMPLETION_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
399
|
+
let readCompletion = null; // { projectId, seenKey, n, members, questions } for the open project, or null
|
|
400
|
+
// Newest-wins for History lookups: bumped by each lookup, a project switch and a newer read, so a late answer
|
|
401
|
+
// (A → B → A, or one that started before a new read appeared) can never install a band.
|
|
402
|
+
let readCompletionGen = 0;
|
|
394
403
|
|
|
395
404
|
// Shared drawing-file picker for both the new-project seed tile and the in-project
|
|
396
405
|
// "Attach revised drawings" button. Prefers the File System Access API so the native
|
|
@@ -3321,13 +3330,16 @@
|
|
|
3321
3330
|
* Start a create card's own flow. Called straight from the click, with nothing awaited first, so the native file
|
|
3322
3331
|
* picker it may open still counts as the person's own gesture.
|
|
3323
3332
|
*/
|
|
3324
|
-
async function activateSeedCard(seed, linkFrom = null) {
|
|
3333
|
+
async function activateSeedCard(seed, linkFrom = null, { buildMode = null } = {}) {
|
|
3325
3334
|
// Two ids, and they are not interchangeable: create on the LIVE app (`seed-app`), but look the
|
|
3326
3335
|
// descriptor up by its lineage ROOT (`seed-template`) — after a rename the live id answers to no
|
|
3327
3336
|
// descriptor, and the built-in id answers to no installed app.
|
|
3328
3337
|
const appId = seed.dataset.seedApp;
|
|
3329
3338
|
const templateId = seed.dataset.seedTemplate || appId;
|
|
3330
3339
|
if (!WORKSPACE_APPS[templateId]) return;
|
|
3340
|
+
// #2811: a Quick press kept for this press is used now, or dropped, whatever happens next (a cancelled picker, another
|
|
3341
|
+
// card): it never reaches a later, unrelated New project.
|
|
3342
|
+
const setupBuildMode = takePendingQuickPress(templateId, seed.dataset.seedAction, buildMode, linkFrom);
|
|
3331
3343
|
// Each create kind has its own branch below. The 'drawing' check stays a check rather than an
|
|
3332
3344
|
// assumption: a future kind must declare its own branch, not silently inherit the file picker.
|
|
3333
3345
|
if (seed.dataset.seedAction === 'drawing') {
|
|
@@ -3343,7 +3355,7 @@
|
|
|
3343
3355
|
showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
|
|
3344
3356
|
return;
|
|
3345
3357
|
}
|
|
3346
|
-
createFromDrawing(appId, templateId, files, { linkFrom });
|
|
3358
|
+
createFromDrawing(appId, templateId, files, { linkFrom, buildMode: setupBuildMode });
|
|
3347
3359
|
} else if (seed.dataset.seedAction === 'rvt') {
|
|
3348
3360
|
const file = await pickRvtFile($seedRvt);
|
|
3349
3361
|
if (file) createFromRvt(appId, templateId, file, linkFrom);
|
|
@@ -4561,7 +4573,7 @@
|
|
|
4561
4573
|
* working directory. Nothing is written while the dialog is open. Creation atomically publishes
|
|
4562
4574
|
* project.json and an unsent initial-task draft; the headless provider is not contacted here.
|
|
4563
4575
|
*/
|
|
4564
|
-
async function createFromDrawing(appId, templateId, files, { kind = 'drawings', sourceLabel = '', teklaSource = null, returnFocus = null, linkFrom = null } = {}) {
|
|
4576
|
+
async function createFromDrawing(appId, templateId, files, { kind = 'drawings', sourceLabel = '', teklaSource = null, returnFocus = null, linkFrom = null, buildMode = 'precise' } = {}) {
|
|
4565
4577
|
if (!$projectSetup || projectSetupState) return false;
|
|
4566
4578
|
// A Drawing Checker profile and a General project start with no source file: what goes in them comes later.
|
|
4567
4579
|
if (!Array.isArray(files) || (!files.length && !NO_FILE_SETUP_KINDS.includes(kind))) return false;
|
|
@@ -4584,8 +4596,9 @@
|
|
|
4584
4596
|
linkFrom,
|
|
4585
4597
|
askCatalogue: kind === 'drawings' && templateId === 'steel-model',
|
|
4586
4598
|
environment: null,
|
|
4587
|
-
// #2521 row 7a: Precise unless the person presses Quick; what was sent is kept in `sentBuildMode`.
|
|
4588
|
-
|
|
4599
|
+
// #2521 row 7a: Precise unless the person presses Quick; what was sent is kept in `sentBuildMode`. #2811: a card
|
|
4600
|
+
// the person clicked in a chat may open the dialog with Quick already pressed; it is asked only where Quick is.
|
|
4601
|
+
buildMode: buildMode === 'quick' && kind === 'drawings' && templateId === 'steel-model' ? 'quick' : 'precise',
|
|
4589
4602
|
// #2521 row 2c: the person's own Filter Save unless they press "Let the AI choose" (with Quick only).
|
|
4590
4603
|
filterChoice: 'person',
|
|
4591
4604
|
// Revision 3: with "Let the AI choose", the AI also approves what the read leaves out unless the person keeps it.
|
|
@@ -5552,6 +5565,8 @@
|
|
|
5552
5565
|
refreshModelPresence(p.id, p.app).catch((e) => {
|
|
5553
5566
|
console.error('[workspaces] could not resolve model presence', e);
|
|
5554
5567
|
});
|
|
5568
|
+
// #3053: a read that finished while this project was closed, or before a reload, is still announced (where there is a strip).
|
|
5569
|
+
if (wsDescOf(p)?.filter) refreshReadCompletion(p).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
5555
5570
|
// BEFORE the first step renders, and that order is the fix rather than a tidy-up.
|
|
5556
5571
|
//
|
|
5557
5572
|
// `initialStep` is not always 'model' — a project re-opened from the picker keeps `currentStep`,
|
|
@@ -5821,6 +5836,24 @@
|
|
|
5821
5836
|
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
5822
5837
|
}
|
|
5823
5838
|
|
|
5839
|
+
/**
|
|
5840
|
+
* The AI's latest sentence in the AI Chat conversation running this read (`req.chatNarration`, from the Requests
|
|
5841
|
+
* poll), when it is newer than the progress record stamped `recordAt`. Null for a terminal-run read, a narration
|
|
5842
|
+
* the record already covers, or anything malformed: the record then speaks alone, exactly as before.
|
|
5843
|
+
*/
|
|
5844
|
+
// Words that belong to the software, not the drawings: the strip shows neither a record nor a chat sentence with them.
|
|
5845
|
+
const PROGRESS_INTERNAL_WORDS = /\b(?:schema|api|manifest|ledger|registration|binding|disposition|audit|reconcile|attestation|evidence|candidate|json|etag|floless-app-[a-z0-9-]+|reading-structural-drawings|steel-drawing-abbreviations|[a-z][a-z0-9.-]*\/v\d+)\b/i;
|
|
5846
|
+
|
|
5847
|
+
function chatNarrationView(req, recordAt, currentTime) {
|
|
5848
|
+
const n = req && req.chatNarration;
|
|
5849
|
+
if (req?.chatConversation?.executionOwner !== 'chat' || !n || typeof n !== 'object' || Array.isArray(n)) return null;
|
|
5850
|
+
const text = progressText(n.text);
|
|
5851
|
+
const at = typeof n.at === 'string' ? Date.parse(n.at) : NaN;
|
|
5852
|
+
if (!text || text.length > 600 || /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/.test(text) || PROGRESS_INTERNAL_WORDS.test(text)) return null;
|
|
5853
|
+
if (!Number.isFinite(at) || at <= recordAt || currentTime - at < -PROGRESS_MAX_CLOCK_LEAD_MS) return null;
|
|
5854
|
+
return { text, at };
|
|
5855
|
+
}
|
|
5856
|
+
|
|
5824
5857
|
/**
|
|
5825
5858
|
* Turn the provider-neutral drawing checklist into the small, honest view this surface needs.
|
|
5826
5859
|
* Returns null when the record cannot be shown truthfully — the caller then says so out loud
|
|
@@ -5835,7 +5868,6 @@
|
|
|
5835
5868
|
const plainText = (value, max, nullable = false) => (nullable && value === null)
|
|
5836
5869
|
|| (typeof value === 'string' && !!value.trim() && value.length <= max
|
|
5837
5870
|
&& !/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/.test(value));
|
|
5838
|
-
const internalVisible = /\b(?:schema|api|manifest|ledger|registration|binding|disposition|audit|reconcile|attestation|evidence|candidate|json|etag|floless-app-[a-z0-9-]+|reading-structural-drawings|steel-drawing-abbreviations|[a-z][a-z0-9.-]*\/v\d+)\b/i;
|
|
5839
5871
|
const sourceSkills = new Set([
|
|
5840
5872
|
'floless-app-steel-model', 'reading-structural-drawings', 'floless-app-steel-takeoff',
|
|
5841
5873
|
'floless-app-approval', 'steel-drawing-abbreviations',
|
|
@@ -5848,22 +5880,22 @@
|
|
|
5848
5880
|
&& exactKeys(item, ['id', 'text', 'state', 'sources', 'verification', 'note'])
|
|
5849
5881
|
&& plainText(item.id, 100) && /^[a-z0-9][a-z0-9-]*$/.test(item.id)
|
|
5850
5882
|
&& !ids.has(item.id) && !!ids.add(item.id)
|
|
5851
|
-
&& plainText(item.text, 500) && !
|
|
5883
|
+
&& plainText(item.text, 500) && !PROGRESS_INTERNAL_WORDS.test(item.text)
|
|
5852
5884
|
&& PROGRESS_ITEM_STATES.has(item.state)
|
|
5853
5885
|
&& Array.isArray(item.sources) && item.sources.length >= 1 && item.sources.length <= 10
|
|
5854
5886
|
&& item.sources.every((source) => source && typeof source === 'object' && !Array.isArray(source)
|
|
5855
5887
|
&& exactKeys(source, ['skill', 'section']) && sourceSkills.has(source.skill)
|
|
5856
5888
|
&& plainText(source.section, 200))
|
|
5857
5889
|
&& (item.verification === undefined || plainText(item.verification, 1_000))
|
|
5858
|
-
&& (item.note === undefined || (plainText(item.note, 1_000) && !
|
|
5890
|
+
&& (item.note === undefined || (plainText(item.note, 1_000) && !PROGRESS_INTERNAL_WORDS.test(item.note)))
|
|
5859
5891
|
&& (item.state !== 'done' || !!progressText(item.verification))
|
|
5860
5892
|
&& (!['blocked', 'waiting', 'provisional'].includes(item.state) || !!progressText(item.note)))
|
|
5861
5893
|
|| !Number.isSafeInteger(progress.revision) || progress.revision < 1
|
|
5862
5894
|
|| !plainText(progress.updatedAt, 50)
|
|
5863
5895
|
|| !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(progress.updatedAt)
|
|
5864
|
-
|| !plainText(progress.done, 1_000) ||
|
|
5865
|
-
|| !plainText(progress.now, 1_000, true) || (progress.now &&
|
|
5866
|
-
|| !plainText(progress.next, 1_000, true) || (progress.next &&
|
|
5896
|
+
|| !plainText(progress.done, 1_000) || PROGRESS_INTERNAL_WORDS.test(progress.done)
|
|
5897
|
+
|| !plainText(progress.now, 1_000, true) || (progress.now && PROGRESS_INTERNAL_WORDS.test(progress.now))
|
|
5898
|
+
|| !plainText(progress.next, 1_000, true) || (progress.next && PROGRESS_INTERNAL_WORDS.test(progress.next))) return null;
|
|
5867
5899
|
// The checklist shape the server guarantees per status. A record that breaks it is corrupt or
|
|
5868
5900
|
// from a future contract; either way its heading would be a claim about work nobody verified.
|
|
5869
5901
|
const nowItems = progress.items.filter((item) => item.state === 'now').length;
|
|
@@ -5876,9 +5908,13 @@
|
|
|
5876
5908
|
if (req.id && progress.requestId !== req.id) return null;
|
|
5877
5909
|
const updatedAt = Date.parse(progress.updatedAt);
|
|
5878
5910
|
if (!Number.isFinite(updatedAt)) return null;
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5911
|
+
if (currentTime - updatedAt < -PROGRESS_MAX_CLOCK_LEAD_MS) return null;
|
|
5912
|
+
// The record is the AI's checklist, rewritten only when the AI remembers to, while AI Chat shows every sentence
|
|
5913
|
+
// the AI writes as it reads. A real read narrated S-202 and S-203 in chat for eight minutes under a record still
|
|
5914
|
+
// saying it was reading the index sheets. So an active record yields to the newer chat narration, named as such.
|
|
5915
|
+
const narration = progress.status === 'active' ? chatNarrationView(req, updatedAt, currentTime) : null;
|
|
5916
|
+
const reportedAt = narration ? narration.at : updatedAt;
|
|
5917
|
+
const stale = currentTime - reportedAt >= PROGRESS_STALE_MS;
|
|
5882
5918
|
// Count only completed checklist items. Their evidence is present, but this surface has not
|
|
5883
5919
|
// independently audited it, so the UI must not promote "complete" into "verified".
|
|
5884
5920
|
const doneCount = progress.items.filter((item) => item.state === 'done').length;
|
|
@@ -5929,19 +5965,22 @@
|
|
|
5929
5965
|
now = `Return to ${backTo} for next steps.`;
|
|
5930
5966
|
next = null;
|
|
5931
5967
|
}
|
|
5968
|
+
if (narration) {
|
|
5969
|
+
nowLabel = 'Latest in AI Chat';
|
|
5970
|
+
now = narration.text;
|
|
5971
|
+
}
|
|
5932
5972
|
// A heartbeat nobody can refresh is not a heartbeat. Both arms below replace the forward-looking
|
|
5933
5973
|
// plan with a recovery route, because carrying "Next: check every connection" into a stalled or
|
|
5934
5974
|
// unreachable state presents work that is not happening as though it were queued.
|
|
5935
5975
|
if (contactLost && progress.status === 'active') {
|
|
5936
5976
|
state = 'waiting';
|
|
5937
5977
|
heading = 'Progress updates have stopped arriving';
|
|
5938
|
-
nowLabel = 'Last reported';
|
|
5939
|
-
now = progressText(progress.now) || now;
|
|
5978
|
+
nowLabel = narration ? 'Last reported in AI Chat' : 'Last reported';
|
|
5940
5979
|
next = 'FloLess could not reach its own server. This refreshes by itself when the connection returns.';
|
|
5941
5980
|
} else if (stale && progress.status === 'active') {
|
|
5942
5981
|
state = 'waiting';
|
|
5943
5982
|
heading = 'No progress update in the last 8 minutes';
|
|
5944
|
-
nowLabel = 'Last reported';
|
|
5983
|
+
nowLabel = narration ? 'Last reported in AI Chat' : 'Last reported';
|
|
5945
5984
|
next = inChat ? 'Ask the read in AI Chat to continue.' : 'Return to the same terminal AI session that prepared this read and ask it to continue.';
|
|
5946
5985
|
} else if (stale && progress.status === 'complete') {
|
|
5947
5986
|
state = 'waiting';
|
|
@@ -5960,13 +5999,18 @@
|
|
|
5960
5999
|
next,
|
|
5961
6000
|
requestId: progress.requestId,
|
|
5962
6001
|
revision: progress.revision,
|
|
5963
|
-
updatedAt: progress.updatedAt,
|
|
6002
|
+
updatedAt: narration ? new Date(narration.at).toISOString() : progress.updatedAt,
|
|
6003
|
+
...(narration ? { fromChat: true } : {}),
|
|
5964
6004
|
};
|
|
5965
6005
|
}
|
|
5966
6006
|
|
|
5967
6007
|
// #2926: no picture asked for in this long, and a conversation that is not running, means a chat-run read is not
|
|
5968
6008
|
// reading. A terminal-run read has only its pictures to prove that once its progress record is stale.
|
|
5969
6009
|
const FLO_FRESH_WORK_MS = 2 * 60_000;
|
|
6010
|
+
// A conversation still replying after it was handed this read's pictures is most likely still studying them: seen
|
|
6011
|
+
// on a real read in AI Chat (2026-11-01), all nine tiles of a sheet in under a minute, then minutes of study. It
|
|
6012
|
+
// keeps Flo thinking this long after the last picture, never longer: the reply might be to something else.
|
|
6013
|
+
const FLO_BUSY_LOOK_MS = 10 * 60_000;
|
|
5970
6014
|
const FLO_HASH = /^[0-9a-f]{64}$/;
|
|
5971
6015
|
function floLookOk(l) {
|
|
5972
6016
|
return !!l && typeof l === 'object' && typeof l.pageId === 'string' && FLO_HASH.test(l.sourceHash)
|
|
@@ -5981,17 +6025,19 @@
|
|
|
5981
6025
|
* signals only. `reading` while it is evidently working (with the sheet pictures it last asked for), `waiting`
|
|
5982
6026
|
* only while the AI has really asked the person something, and `off` otherwise, with the reason.
|
|
5983
6027
|
*
|
|
5984
|
-
* `view` is drawingProgressView()'s projection of the same request
|
|
6028
|
+
* `view` is drawingProgressView()'s projection of the same request: null when the AI has written no progress
|
|
6029
|
+
* record yet, or one the strip cannot show.
|
|
5985
6030
|
* ctx: { contactLost, chatAsking (AI Chat shows a question or approval on this read's conversation), pendingSave }.
|
|
5986
6031
|
*/
|
|
5987
6032
|
function filterFloState(req, view, ctx) {
|
|
5988
6033
|
ctx = ctx || {};
|
|
5989
6034
|
const off = (why) => ({ mode: 'off', why });
|
|
5990
|
-
if (!req
|
|
6035
|
+
if (!req) return off('no-read');
|
|
5991
6036
|
// Before Save, and while it holds unsaved edits, the stage is the person's own work: Flo stays off it.
|
|
5992
6037
|
if (req.filterCheckpointCurrent !== true || ctx.pendingSave) return off('not-saved');
|
|
5993
6038
|
if (ctx.contactLost) return off('contact-lost');
|
|
5994
|
-
|
|
6039
|
+
// A record the strip cannot show is no record: only its question, approval or pictures speak for the read.
|
|
6040
|
+
const progress = view ? req.steelProgress : null;
|
|
5995
6041
|
const raw = progress && progress.status;
|
|
5996
6042
|
if (raw === 'cancelled') return off('cancelled');
|
|
5997
6043
|
const chat = req.chatConversation || null;
|
|
@@ -6002,9 +6048,11 @@
|
|
|
6002
6048
|
const approval = code === 'approval' || chat?.chatState === 'awaiting-approval';
|
|
6003
6049
|
const asked = code === 'ai-question' || approval || ctx.chatAsking === true;
|
|
6004
6050
|
const chatWorking = inChat && (chat.chatState === 'starting' || chat.chatState === 'running');
|
|
6005
|
-
|
|
6006
|
-
//
|
|
6007
|
-
|
|
6051
|
+
const busy = inChat && chat.chatState === 'busy-elsewhere';
|
|
6052
|
+
// The AI writes `waiting`, then asks or stops. A conversation still replying past it has moved on (the person
|
|
6053
|
+
// pressed Save and FloLess continued the read, or typed "continue") and the record is stale until the AI next
|
|
6054
|
+
// writes it: not a question.
|
|
6055
|
+
const recordWaits = raw === 'waiting' && !chatWorking && !busy;
|
|
6008
6056
|
if (recordWaits || asked) {
|
|
6009
6057
|
const note = recordWaits ? progressText(progress.items.find((item) => item.state === 'waiting')?.note) : null;
|
|
6010
6058
|
const question = code === 'ai-question' ? progressText(req.run?.question) : null;
|
|
@@ -6013,20 +6061,28 @@
|
|
|
6013
6061
|
: code === 'ai-question' ? 'The AI has asked you a question.' : 'The AI is waiting for you in AI Chat.');
|
|
6014
6062
|
return { mode: 'waiting', text, chat: inChat };
|
|
6015
6063
|
}
|
|
6016
|
-
if (raw !== 'active') return off('not-active');
|
|
6017
6064
|
const looks = (Array.isArray(req.steelLooks) ? req.steelLooks : []).filter(floLookOk);
|
|
6018
|
-
const freshPictures = looks.some((l) => l.ageMs < FLO_FRESH_WORK_MS);
|
|
6065
|
+
const freshPictures = looks.some((l) => l.ageMs < (busy ? FLO_BUSY_LOOK_MS : FLO_FRESH_WORK_MS));
|
|
6066
|
+
// Seen on a real read in AI Chat (2026-11-01): the AI fetched S-201 tile by tile before it wrote its first
|
|
6067
|
+
// progress record, and Flo stayed hidden while it read. Its pictures prove the work; the words say what is unknown.
|
|
6068
|
+
// The same after Save: the record still says "waiting for you to press Save filter" (a wait the conversation has
|
|
6069
|
+
// moved past, above) until the AI next writes it.
|
|
6070
|
+
if (!view || raw === 'waiting') {
|
|
6071
|
+
return freshPictures ? { mode: 'reading', now: 'The AI is looking at the drawings. Its progress list has not caught up yet.', looks }
|
|
6072
|
+
: off(view ? 'not-active' : 'no-record');
|
|
6073
|
+
}
|
|
6074
|
+
if (raw !== 'active') return off('not-active');
|
|
6019
6075
|
// A record the AI has not rewritten for 8 minutes is stale, but pictures it asked for in the last two, or its
|
|
6020
6076
|
// conversation still running, prove it is still at work (seen on a real read, #2926: tiles seconds old, sentence
|
|
6021
6077
|
// 9 minutes old). Flo keeps going then, and says the sentence is the last one reported, the strip's own words.
|
|
6022
6078
|
if (view.state !== 'active') {
|
|
6023
|
-
return freshPictures || chatWorking ? { mode: 'reading', now: view.now, looks, label:
|
|
6079
|
+
return freshPictures || chatWorking ? { mode: 'reading', now: view.now, looks, label: `${view.nowLabel}:` } : off('not-active');
|
|
6024
6080
|
}
|
|
6025
6081
|
// Pictures for this very read are proof of work even when the chat calls its turn busy elsewhere, which it
|
|
6026
6082
|
// does whenever the person typed into the read's conversation and the read carried on.
|
|
6027
6083
|
const working = freshPictures || !inChat || chatWorking;
|
|
6028
6084
|
if (!working) return off('idle');
|
|
6029
|
-
return { mode: 'reading', now: view.now, looks };
|
|
6085
|
+
return view.fromChat ? { mode: 'reading', now: view.now, looks, label: `${view.nowLabel}:` } : { mode: 'reading', now: view.now, looks };
|
|
6030
6086
|
}
|
|
6031
6087
|
|
|
6032
6088
|
// Keeps the last read and view applyStageGating() painted (`syncFilterFlo.last`), so a chat question opening
|
|
@@ -6212,11 +6268,160 @@
|
|
|
6212
6268
|
|
|
6213
6269
|
function wireStageGuidanceFilterAction() {
|
|
6214
6270
|
$stageGuidance?.addEventListener('click', (e) => {
|
|
6271
|
+
const done = e.target.closest('[data-read-done]');
|
|
6272
|
+
if (done) { readCompletionAction(done.dataset.readDone); return; }
|
|
6215
6273
|
if (!e.target.closest('[data-revfilter]')) return;
|
|
6216
6274
|
openDrawingFilterNextAction();
|
|
6217
6275
|
});
|
|
6218
6276
|
}
|
|
6219
6277
|
|
|
6278
|
+
// ── #3053: "Your model is ready to view" ─────────────────────────────────────────────────────
|
|
6279
|
+
// A finished drawing read used to say so only in a toast, which a person working in the Drawing Filter, or
|
|
6280
|
+
// reading the AI's long summary, missed. The strip now keeps a completion band until they close it. It is
|
|
6281
|
+
// decided from History, never from the AI's words or a request disappearing: the newest version must be one a
|
|
6282
|
+
// drawing read saved, and no other read may be waiting, failed or staged (the strip shows those instead).
|
|
6283
|
+
// (Its state, READ_COMPLETION_* and `readCompletion`, is declared beside `currentStep`: the strip can paint early in boot.)
|
|
6284
|
+
|
|
6285
|
+
/** The completion band a project's History calls for, or null. `versions` newest first; `seen`: the newest version already closed. */
|
|
6286
|
+
function readCompletionNotice(versions, seen, now) {
|
|
6287
|
+
const tip = Array.isArray(versions) ? versions[0] : null;
|
|
6288
|
+
if (!tip || tip.kind !== 'revision-read' || !Number.isSafeInteger(tip.n) || tip.n <= seen) return null;
|
|
6289
|
+
const at = Date.parse(tip.ts || '');
|
|
6290
|
+
if (!Number.isFinite(at) || now - at > READ_COMPLETION_MAX_AGE_MS) return null;
|
|
6291
|
+
const count = (value) => (Number.isSafeInteger(value) && value >= 0 ? value : null);
|
|
6292
|
+
return { n: tip.n, members: count(tip.readiness?.physicalMemberCount), questions: count(tip.readiness?.currentUnansweredQuestionCount) };
|
|
6293
|
+
}
|
|
6294
|
+
|
|
6295
|
+
const readCompletionKey = (proj) => READ_COMPLETION_SEEN + (proj.uuid || proj.id);
|
|
6296
|
+
function readCompletionSeen(seenKey) {
|
|
6297
|
+
try { const n = Number(localStorage.getItem(seenKey)); return Number.isSafeInteger(n) ? n : 0; }
|
|
6298
|
+
catch { return 0; }
|
|
6299
|
+
}
|
|
6300
|
+
function markReadCompletionSeen(seenKey, n) {
|
|
6301
|
+
try { if (n > readCompletionSeen(seenKey)) localStorage.setItem(seenKey, String(n)); }
|
|
6302
|
+
catch { /* private mode: the band comes back on the next open, which is the safe side */ }
|
|
6303
|
+
}
|
|
6304
|
+
|
|
6305
|
+
/** Set the open project's band from its History (`vr`: an answer already in hand). Repaints the strip. */
|
|
6306
|
+
async function refreshReadCompletion(proj, vr = null) {
|
|
6307
|
+
if (!proj) return;
|
|
6308
|
+
const gen = ++readCompletionGen;
|
|
6309
|
+
let answer = vr;
|
|
6310
|
+
if (!answer) {
|
|
6311
|
+
try { answer = await api(`/api/projects/${encodeURIComponent(proj.id)}/versions`); }
|
|
6312
|
+
catch (err) {
|
|
6313
|
+
// History that cannot be read now shows no band; it is looked up again on the next open or read. No toast in
|
|
6314
|
+
// its place: a read that leaves the list unseen may have been discarded in another tab, and one applied here
|
|
6315
|
+
// was already confirmed by its review dialog ("Revision applied").
|
|
6316
|
+
if (current?.id === proj.id && gen === readCompletionGen) console.warn('[workspaces] could not read History for the drawing-read notice', err);
|
|
6317
|
+
return;
|
|
6318
|
+
}
|
|
6319
|
+
}
|
|
6320
|
+
if (current?.id !== proj.id || gen !== readCompletionGen) return;
|
|
6321
|
+
const seenKey = readCompletionKey(proj);
|
|
6322
|
+
const notice = readCompletionNotice(answer?.versions, readCompletionSeen(seenKey), Date.now());
|
|
6323
|
+
readCompletion = notice ? { projectId: proj.id, seenKey, ...notice } : null;
|
|
6324
|
+
applyStageGating();
|
|
6325
|
+
}
|
|
6326
|
+
|
|
6327
|
+
/**
|
|
6328
|
+
* A newer read for this project replaces the band of every version up to its starting point — painted or not, so
|
|
6329
|
+
* clearing that read later never announces an older one as new — and voids any History lookup still out.
|
|
6330
|
+
*/
|
|
6331
|
+
function retireReadCompletion(proj, baseVersion) {
|
|
6332
|
+
if (!proj || !Number.isSafeInteger(baseVersion) || baseVersion <= 0) return;
|
|
6333
|
+
readCompletionGen++;
|
|
6334
|
+
markReadCompletionSeen(readCompletionKey(proj), baseVersion);
|
|
6335
|
+
if (readCompletion && readCompletion.n <= baseVersion) readCompletion = null;
|
|
6336
|
+
}
|
|
6337
|
+
|
|
6338
|
+
/** The band's own contents. `step`: the open project step (Open model is left out on Model, where it would do nothing). */
|
|
6339
|
+
function buildReadCompletion(notice, step) {
|
|
6340
|
+
const el = (tag, className, text) => {
|
|
6341
|
+
const node = document.createElement(tag);
|
|
6342
|
+
if (className) node.className = className;
|
|
6343
|
+
if (text) node.textContent = text;
|
|
6344
|
+
return node;
|
|
6345
|
+
};
|
|
6346
|
+
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
6347
|
+
const head = el('div', 'wsg-head');
|
|
6348
|
+
const signal = el('span', 'wsg-signal');
|
|
6349
|
+
signal.setAttribute('aria-hidden', 'true');
|
|
6350
|
+
head.append(signal, el('strong', '', 'Your model is ready to view.'));
|
|
6351
|
+
const line = el('p', 'wsg-done-line', `Drawing read finished. Version ${notice.n} is on History`
|
|
6352
|
+
+ (notice.members === null ? '' : ` with ${plural(notice.members, 'member', 'members')}`)
|
|
6353
|
+
+ `. ${step === 'model' ? 'You can explore it here.' : 'Open the Model tab to explore it.'} It has not been checked or approved.`);
|
|
6354
|
+
const parts = [head, line];
|
|
6355
|
+
if (notice.questions) {
|
|
6356
|
+
parts.push(el('p', 'wsg-done-line', `${plural(notice.questions, 'question', 'questions')} from the read still `
|
|
6357
|
+
+ `${notice.questions === 1 ? 'needs' : 'need'} your answer.`));
|
|
6358
|
+
}
|
|
6359
|
+
const tip = el('p', 'wsg-done-line');
|
|
6360
|
+
tip.append(el('strong', '', 'We strongly recommend starting a new chat for your next task.'),
|
|
6361
|
+
document.createTextNode(' A chat that ran a drawing read holds a lot of context, so continuing in it may use more tokens and cost more.'));
|
|
6362
|
+
parts.push(tip);
|
|
6363
|
+
const actions = el('div', 'wsg-actions');
|
|
6364
|
+
const button = (action, label, className, commandId, hint) => {
|
|
6365
|
+
const b = el('button', className, label);
|
|
6366
|
+
b.type = 'button';
|
|
6367
|
+
b.dataset.readDone = action;
|
|
6368
|
+
b.dataset.commandId = commandId;
|
|
6369
|
+
b.setAttribute('data-tip', hint);
|
|
6370
|
+
actions.appendChild(b);
|
|
6371
|
+
};
|
|
6372
|
+
if (step !== 'model') button('open', 'Open model', 'btn-mini primary', 'shell.read-complete-open-model', 'Go to the Model tab to explore the model this read built');
|
|
6373
|
+
button('chat', 'Start new chat', 'btn-mini', 'shell.read-complete-new-chat', 'Open a fresh AI Chat conversation in this project. This one stays in your chat history.');
|
|
6374
|
+
button('dismiss', 'Dismiss', 'btn-mini wsg-dismiss', 'shell.read-complete-dismiss', 'Close this notice. The model and History are unchanged.');
|
|
6375
|
+
parts.push(actions);
|
|
6376
|
+
return parts;
|
|
6377
|
+
}
|
|
6378
|
+
|
|
6379
|
+
/** Paint the band into the strip: always expanded, announced once per version, never moving focus. */
|
|
6380
|
+
function paintReadCompletion(notice) {
|
|
6381
|
+
const key = `read-done:${notice.projectId}:${notice.n}:${notice.members}:${notice.questions}:${currentStep === 'model'}`;
|
|
6382
|
+
$stageGuidance.hidden = false;
|
|
6383
|
+
if ($stageGuidance._renderKey === key) return;
|
|
6384
|
+
const announced = String($stageGuidance._renderKey || '').startsWith(`read-done:${notice.projectId}:${notice.n}:`);
|
|
6385
|
+
$stageGuidance._renderKey = key;
|
|
6386
|
+
$stageGuidance.className = 'ws-stage-guidance state-complete';
|
|
6387
|
+
$stageGuidance.replaceChildren(...buildReadCompletion(notice, currentStep));
|
|
6388
|
+
markScrollable($stageGuidance);
|
|
6389
|
+
const live = document.getElementById('ws-stage-guidance-live');
|
|
6390
|
+
if (live && !announced) live.textContent = 'Drawing read finished. Your model is ready to view in the Model tab.';
|
|
6391
|
+
}
|
|
6392
|
+
|
|
6393
|
+
function readCompletionAction(action) {
|
|
6394
|
+
const notice = readCompletion;
|
|
6395
|
+
if (!notice || current?.id !== notice.projectId) return;
|
|
6396
|
+
if (action === 'open') {
|
|
6397
|
+
setStep('model');
|
|
6398
|
+
applyStageGating();
|
|
6399
|
+
// The band on Model has no Open model button, so focus follows the person to the tab they asked for.
|
|
6400
|
+
$stepTabs?.querySelector('button[data-step="model"]')?.focus();
|
|
6401
|
+
return;
|
|
6402
|
+
}
|
|
6403
|
+
if (action === 'chat') {
|
|
6404
|
+
Promise.resolve().then(() => {
|
|
6405
|
+
if (typeof window.flolessChat?.startNewChat !== 'function') {
|
|
6406
|
+
throw Object.assign(new Error('AI Chat is still loading. Try Start new chat again in a moment.'), { personCopy: true });
|
|
6407
|
+
}
|
|
6408
|
+
return window.flolessChat.startNewChat(notice.projectId);
|
|
6409
|
+
}).catch((err) => {
|
|
6410
|
+
// A reason AI Chat wrote for the person is shown as it is; anything else is an unexpected failure. Opening a
|
|
6411
|
+
// new chat changes nothing, so it is always safe to try again.
|
|
6412
|
+
if (err?.personCopy) showToast(`Couldn’t start a new chat. ${err.message}`, 'warn');
|
|
6413
|
+
else showFailureToast(err, { action: 'start a new chat', retrySafe: true });
|
|
6414
|
+
});
|
|
6415
|
+
return;
|
|
6416
|
+
}
|
|
6417
|
+
if (action !== 'dismiss') return;
|
|
6418
|
+
markReadCompletionSeen(notice.seenKey, notice.n);
|
|
6419
|
+
readCompletion = null;
|
|
6420
|
+
applyStageGating();
|
|
6421
|
+
// The button is gone with the band: put focus on the step the person is on rather than letting it drop to the page.
|
|
6422
|
+
$stepTabs?.querySelector('button[data-step].active')?.focus();
|
|
6423
|
+
}
|
|
6424
|
+
|
|
6220
6425
|
function stageGuidanceRow(label, text) {
|
|
6221
6426
|
const row = document.createElement('div');
|
|
6222
6427
|
row.className = 'wsg-row';
|
|
@@ -6269,7 +6474,7 @@
|
|
|
6269
6474
|
const scope = projectId ?? (typeof current !== 'undefined' && current ? current.id : '');
|
|
6270
6475
|
const choices = $stageGuidance._collapseChoices ||= new Map();
|
|
6271
6476
|
const key = `${scope}:` + (progress
|
|
6272
|
-
? `progress:${progress.requestId}:${progress.state}:${progress.revision}:${progress.heading}`
|
|
6477
|
+
? `progress:${progress.requestId}:${progress.state}:${progress.revision}:${progress.heading}:${progress.updatedAt}`
|
|
6273
6478
|
: `text:${state}:${typeof content === 'string' ? content : ''}`);
|
|
6274
6479
|
$stageGuidance.hidden = false;
|
|
6275
6480
|
if ($stageGuidance._renderKey === key) return;
|
|
@@ -6574,7 +6779,8 @@
|
|
|
6574
6779
|
const unavailableInitial = initialRead && lastRevState === 'unavailable';
|
|
6575
6780
|
const ownsProgress = waitingForInitial && stageGuidanceOwnsSavedCheckpoint(revCardReq);
|
|
6576
6781
|
const liveProgress = ownsProgress ? drawingProgressView(revCardReq, Date.now(), revRequestsFailed) : null;
|
|
6577
|
-
|
|
6782
|
+
// Flo follows the read the strip owns even before its first progress record: its pictures are enough.
|
|
6783
|
+
syncFilterFlo(ownsProgress ? revCardReq : null, liveProgress);
|
|
6578
6784
|
if (ownsProgress && revCardReq?.steelProgress && !liveProgress) {
|
|
6579
6785
|
const revision = Number.isSafeInteger(revCardReq.steelProgress.revision)
|
|
6580
6786
|
? String(revCardReq.steelProgress.revision) : `invalid:${String(revCardReq.steelProgress.revision)}`;
|
|
@@ -6598,6 +6804,11 @@
|
|
|
6598
6804
|
// Saving the Filter can unlock the tabs while its initial drawing read is still running.
|
|
6599
6805
|
// Progress belongs to that read, not to the prerequisite gate; only idle guidance needs a gate.
|
|
6600
6806
|
if (!locked && !stripPending) {
|
|
6807
|
+
// #3053: with nothing else to say and no other read in flight, a finished read's band stays up until closed.
|
|
6808
|
+
if (readCompletion && current?.id === readCompletion.projectId && lastRevState === 'none' && revisionListKnown) {
|
|
6809
|
+
paintReadCompletion(readCompletion);
|
|
6810
|
+
return;
|
|
6811
|
+
}
|
|
6601
6812
|
clearStageGuidance();
|
|
6602
6813
|
return;
|
|
6603
6814
|
}
|
|
@@ -7677,6 +7888,12 @@
|
|
|
7677
7888
|
const keptEdits = onProject() && editorHasUnsavedEdits();
|
|
7678
7889
|
if (onProject() && !keptEdits) reloadModelFromServerTruth();
|
|
7679
7890
|
const fresh = onProject() ? await refreshApprovalState(project.id) : null;
|
|
7891
|
+
// #3053: an approval puts its own version on top of History, so a finished-read band saying "It has not been
|
|
7892
|
+
// checked or approved" is over: History is asked again, and an approve row at the head shows no band.
|
|
7893
|
+
// (`typeof`: the approval tests lift this function on its own, without the band's code.)
|
|
7894
|
+
if (onProject() && typeof refreshReadCompletion === 'function') {
|
|
7895
|
+
refreshReadCompletion(project).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
7896
|
+
}
|
|
7680
7897
|
// A recovered receipt's count is from when it was approved; edits made since are pending now, so a
|
|
7681
7898
|
// recovery reports the count just read back, and when that read failed it says so (null) rather than
|
|
7682
7899
|
// claiming "No changes remain pending" over work it never looked at.
|
|
@@ -15401,6 +15618,8 @@
|
|
|
15401
15618
|
*/
|
|
15402
15619
|
let revisionBuildAsk = null; // #2521 row 7b: the open confirm step after the file picker, if any (askRevisionBuild)
|
|
15403
15620
|
function resetRevisionState() {
|
|
15621
|
+
readCompletion = null; // #3053: the band belongs to the project being left
|
|
15622
|
+
readCompletionGen++;
|
|
15404
15623
|
lastRevState = 'none';
|
|
15405
15624
|
revisionListKnown = false;
|
|
15406
15625
|
revCardReq = null;
|
|
@@ -16172,10 +16391,20 @@
|
|
|
16172
16391
|
// rows describing a version that had just been superseded. Clicking Details then resolved
|
|
16173
16392
|
// no receipt and did nothing at all — a control that answers a click with silence.
|
|
16174
16393
|
if (!$wsExports.hidden) safeRenderExports('after the revision read');
|
|
16175
|
-
|
|
16394
|
+
// #3053: the strip's completion band says it, and keeps saying it after a toast would have gone. An app with no
|
|
16395
|
+
// Drawing Filter (Vectorize) has no strip, so it keeps the toast.
|
|
16396
|
+
if (wsApp()?.filter) refreshReadCompletion(proj, vr).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
16397
|
+
else showToast('Revision read complete — a new version is on History', 'ok');
|
|
16176
16398
|
}
|
|
16177
16399
|
}
|
|
16400
|
+
// #3053: a reviewed read goes staged → none when the person applies it, not pending → none, and publishes its version
|
|
16401
|
+
// from the review dialog. Any read leaving the list asks History again; only a new drawing-read version shows the band.
|
|
16402
|
+
if (lastRevState !== 'none' && lastRevState !== 'pending' && state === 'none' && wsApp()?.filter) {
|
|
16403
|
+
refreshReadCompletion(proj).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
16404
|
+
}
|
|
16178
16405
|
lastRevState = state;
|
|
16406
|
+
// #3053: another read for this project starts from a version; a band for that version or an older one is over.
|
|
16407
|
+
if (activeRequest) retireReadCompletion(proj, Number.isSafeInteger(activeRequest.baseVersion) ? activeRequest.baseVersion : 0);
|
|
16179
16408
|
if (state === 'none') {
|
|
16180
16409
|
revCardReq = null;
|
|
16181
16410
|
syncDrawingRevisionRequest('');
|
|
@@ -17840,6 +18069,13 @@
|
|
|
17840
18069
|
if (current && current.id === st.projectId) {
|
|
17841
18070
|
current.approvedAt = undefined; // applying a read clears the sign-off; exports re-lock
|
|
17842
18071
|
if (!$wsHistory.hidden) renderHistory();
|
|
18072
|
+
// #3053: the version this review just published is the finished read the strip's band announces. The request
|
|
18073
|
+
// poll cannot see it as a completion any more (`lastRevState` is already 'none'), so do here what its completion
|
|
18074
|
+
// edge does: an applied FIRST read is what makes the model exist, so the tab gates and the approval header are
|
|
18075
|
+
// asked again (otherwise Model stays locked, and the band with it, until a reload), and History for the band.
|
|
18076
|
+
refreshModelPresence(current.id, current.app, true).catch((e) => console.error('[workspaces] post-apply model presence did not refresh', e));
|
|
18077
|
+
refreshApprovalState(current.id).catch((e) => console.error('[workspaces] approval header did not refresh after the apply', e));
|
|
18078
|
+
if (wsApp()?.filter) refreshReadCompletion(current).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
17843
18079
|
}
|
|
17844
18080
|
$revReviewTitle.textContent = 'Revision applied';
|
|
17845
18081
|
$revReviewSub.textContent = `Version v${res.version?.n ?? res.versionN ?? '—'} is now on History.`;
|
|
@@ -18663,6 +18899,9 @@
|
|
|
18663
18899
|
{ key: 'removed', label: 'Removed' },
|
|
18664
18900
|
{ key: 'resized', label: 'Resized' },
|
|
18665
18901
|
{ key: 'moved', label: 'Moved' },
|
|
18902
|
+
// #2997: ends moved by less than History's move threshold (server/steel-diff.ts MOVE_THRESHOLD_TEXT, the same two
|
|
18903
|
+
// strings). Named by the rule, not "small", so a 2" base drop never reads as ignorable. Optional on the wire.
|
|
18904
|
+
{ key: 'nudged', label: 'Moved under 6 in', labelMm: 'Moved under 152.4 mm', optional: true },
|
|
18666
18905
|
{ key: 'material', label: 'Material' },
|
|
18667
18906
|
{ key: 'changed', label: 'Source questions' },
|
|
18668
18907
|
{ key: 'connections', label: 'Connections' },
|
|
@@ -18724,6 +18963,13 @@
|
|
|
18724
18963
|
if (it.ref.sheet) line.appendChild(el('span', 'hd-sheet', it.ref.sheet));
|
|
18725
18964
|
return line;
|
|
18726
18965
|
}
|
|
18966
|
+
function diffMemberNudged(it) {
|
|
18967
|
+
const line = el('div', 'hd-item');
|
|
18968
|
+
line.appendChild(el('span', 'hd-mark', it.ref.mark || it.ref.id));
|
|
18969
|
+
line.appendChild(el('span', 'hd-prof', `moved up to ${it.text}`));
|
|
18970
|
+
if (it.ref.sheet) line.appendChild(el('span', 'hd-sheet', it.ref.sheet));
|
|
18971
|
+
return line;
|
|
18972
|
+
}
|
|
18727
18973
|
function diffMemberConn(it) {
|
|
18728
18974
|
const line = el('div', 'hd-item');
|
|
18729
18975
|
line.appendChild(el('span', 'hd-mark', it.ref.mark || it.ref.id));
|
|
@@ -18743,14 +18989,15 @@
|
|
|
18743
18989
|
if (key === 'added' || key === 'removed') return diffMemberBasic(it);
|
|
18744
18990
|
if (key === 'resized' || key === 'material') return diffMemberXform(it.ref, it.from, it.to);
|
|
18745
18991
|
if (key === 'moved') return diffMemberMoved(it);
|
|
18992
|
+
if (key === 'nudged') return diffMemberNudged(it);
|
|
18746
18993
|
if (key === 'changed') return diffProvisionalChanged(it);
|
|
18747
18994
|
return diffMemberConn(it);
|
|
18748
18995
|
}
|
|
18749
|
-
function diffGroup(g, items) {
|
|
18996
|
+
function diffGroup(g, items, units) {
|
|
18750
18997
|
if (!items || !items.length) return null;
|
|
18751
18998
|
const box = el('div', `hd-group ${g.key}`);
|
|
18752
18999
|
const head = el('div', 'hd-type');
|
|
18753
|
-
head.appendChild(el('span', null, g.label.toUpperCase()));
|
|
19000
|
+
head.appendChild(el('span', null, (units === 'mm' && g.labelMm ? g.labelMm : g.label).toUpperCase()));
|
|
18754
19001
|
head.appendChild(document.createTextNode(' '));
|
|
18755
19002
|
head.appendChild(el('span', 'hd-count', `(${items.length})`));
|
|
18756
19003
|
box.appendChild(head);
|
|
@@ -18761,17 +19008,25 @@
|
|
|
18761
19008
|
// the server spells them the same way (`server/bom-units.ts`), so the pane and the sentence beneath
|
|
18762
19009
|
// it cannot disagree about what a number is.
|
|
18763
19010
|
const DIFF_TONNAGE_WORD = { 'ft-in': 'tons', mm: 't' };
|
|
19011
|
+
const DIFF_WEIGHT_WORD = { 'ft-in': 'lb', mm: 'kg' };
|
|
19012
|
+
const diffWeightFormat = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 });
|
|
18764
19013
|
function diffNetHeader(t) {
|
|
18765
19014
|
const wrap = el('div', 'hd-net');
|
|
18766
|
-
const
|
|
19015
|
+
const tonnage = t && typeof t.netTonnage === 'number' ? t.netTonnage : 0;
|
|
19016
|
+
const weight = t && typeof t.netWeight === 'number' && Number.isFinite(t.netWeight) ? t.netWeight : 0;
|
|
18767
19017
|
// The units come off the comparison, never from a page-level preference: a panel showing an older
|
|
18768
19018
|
// comparison must keep saying what THAT comparison measured. `wellFormedDiff` has already refused
|
|
18769
19019
|
// anything whose `units` is not one of the two, so the fallback is unreachable rather than a guess.
|
|
18770
|
-
const
|
|
19020
|
+
const units = t && DIFF_TONNAGE_WORD[t.units] ? t.units : 'ft-in';
|
|
19021
|
+
// #2997: under a tenth of a ton the figure reads 0 and contradicts the row's own "increased by 3 lb", so
|
|
19022
|
+
// it drops to the weight — the same rule the History sentence uses (server/version-diff.ts).
|
|
19023
|
+
const byWeight = Math.abs(tonnage) < 0.1 && Math.round(Math.abs(weight)) >= 1; // a rounding residue is not a change
|
|
19024
|
+
const net = byWeight ? weight : tonnage;
|
|
19025
|
+
const shown = byWeight ? `${diffWeightFormat.format(Math.abs(weight))} ${DIFF_WEIGHT_WORD[units]}` : `${Math.abs(tonnage)} ${DIFF_TONNAGE_WORD[units]}`;
|
|
18771
19026
|
if (net === 0) wrap.classList.add('flat');
|
|
18772
19027
|
wrap.appendChild(el('span', 'hd-net-label', 'Net steel:'));
|
|
18773
19028
|
wrap.appendChild(el('span', 'hd-net-arrow', net > 0 ? '▲' : net < 0 ? '▼' : '•'));
|
|
18774
|
-
wrap.appendChild(el('span', 'hd-net-val', `${net > 0 ? '+' : ''}${
|
|
19029
|
+
wrap.appendChild(el('span', 'hd-net-val', `${net > 0 ? '+' : net < 0 ? '-' : ''}${shown}`));
|
|
18775
19030
|
// #2735: the bill prices members on ASSUMED heights, so these totals can rest on them. Say so on its own
|
|
18776
19031
|
// line under the figure (a label, not a reliability warning, so not an .hd-warn banner).
|
|
18777
19032
|
const assumed = diffAssumedNoteText(t);
|
|
@@ -18842,10 +19097,20 @@
|
|
|
18842
19097
|
panel.appendChild(diffNetHeader(diff.tonnage));
|
|
18843
19098
|
let any = false;
|
|
18844
19099
|
for (const g of DIFF_GROUPS) {
|
|
18845
|
-
const grp = diffGroup(g, diff[g.key]);
|
|
19100
|
+
const grp = diffGroup(g, diff[g.key], diff.tonnage && diff.tonnage.units);
|
|
18846
19101
|
if (grp) { panel.appendChild(grp); any = true; }
|
|
18847
19102
|
}
|
|
18848
|
-
if (!any) {
|
|
19103
|
+
if (!any && diff.tonnage && Math.round(Math.abs(Number(diff.tonnage.netWeight) || 0)) >= 1) {
|
|
19104
|
+
// #2997: never "No changes detected" beside a weight that changed — the two would contradict each other.
|
|
19105
|
+
const t = diff.tonnage;
|
|
19106
|
+
const units = DIFF_WEIGHT_WORD[t.units] ? t.units : 'ft-in';
|
|
19107
|
+
const by = `${t.netWeight > 0 ? '+' : '-'}${diffWeightFormat.format(Math.abs(t.netWeight))} ${DIFF_WEIGHT_WORD[units]}`;
|
|
19108
|
+
// A member that could not be compared may be the cause, so a partial comparison names no culprit.
|
|
19109
|
+
const uncompared = Array.isArray(diff.incomparable) ? diff.incomparable.length : 0;
|
|
19110
|
+
panel.appendChild(el('div', 'hd-empty', uncompared
|
|
19111
|
+
? `The steel weight changed by ${by}. ${uncompared} ${uncompared === 1 ? 'member' : 'members'} could not be compared, so FloLess can’t say which change caused it.`
|
|
19112
|
+
: `The steel weight changed by ${by}, but FloLess found no member change that accounts for it.${diff.unchanged ? ` ${diff.unchanged} members compared.` : ''}`));
|
|
19113
|
+
} else if (!any) {
|
|
18849
19114
|
panel.appendChild(el('div', 'hd-empty', `No changes detected${diff.unchanged ? ` — ${diff.unchanged} members unchanged` : ''}.`));
|
|
18850
19115
|
} else if (diff.unchanged) {
|
|
18851
19116
|
panel.appendChild(el('div', 'hd-tail', `${diff.unchanged} members unchanged`));
|
|
@@ -18879,9 +19144,12 @@
|
|
|
18879
19144
|
&& (!Object.prototype.hasOwnProperty.call(value, 'scaleUnknown') || typeof value.scaleUnknown === 'boolean');
|
|
18880
19145
|
const connection = (value) => !!value && typeof value === 'object' && !Array.isArray(value)
|
|
18881
19146
|
&& ref(value.ref) && typeof value.summary === 'string';
|
|
18882
|
-
const
|
|
19147
|
+
const nudged = (value) => !!value && typeof value === 'object' && !Array.isArray(value)
|
|
19148
|
+
&& ref(value.ref) && Number.isFinite(value.mm) && typeof value.text === 'string' && !!value.text;
|
|
19149
|
+
const validators = { added: ref, removed: ref, resized: xform, moved, nudged, material: xform, changed: connection, connections: connection };
|
|
18883
19150
|
if (!DIFF_GROUPS.every((group) =>
|
|
18884
|
-
|
|
19151
|
+
(group.optional && !Object.prototype.hasOwnProperty.call(diff, group.key))
|
|
19152
|
+
|| (Array.isArray(diff[group.key]) && diff[group.key].every(validators[group.key])))) return false;
|
|
18885
19153
|
return ['duplicateKeys', 'ambiguousJoints', 'mergedAmbiguous'].every((key) =>
|
|
18886
19154
|
!Object.prototype.hasOwnProperty.call(diff.warnings, key)
|
|
18887
19155
|
|| (Array.isArray(diff.warnings[key]) && diff.warnings[key].every((value) => typeof value === 'string')));
|
|
@@ -19928,6 +20196,60 @@
|
|
|
19928
20196
|
return { kind: 'create', done: activateSeedCard(seed, linkFrom) };
|
|
19929
20197
|
}
|
|
19930
20198
|
|
|
20199
|
+
/**
|
|
20200
|
+
* #2811: New project for a Steel model from drawings, from a card the person clicked in a chat or a terminal request.
|
|
20201
|
+
* Called straight from that click, with nothing awaited first, so the file picker it opens is still the person's own
|
|
20202
|
+
* gesture. `quick` presses Quick model in the dialog. The Drawing Filter question is left as the dialog always asks
|
|
20203
|
+
* it (the person's own Save): whether the AI may choose the Filter is only ever the person's click there.
|
|
20204
|
+
*/
|
|
20205
|
+
async function openNewProjectFromDrawings({ quick = false } = {}) {
|
|
20206
|
+
pendingQuickPress = 0; // a newer card replaces an older one's ask
|
|
20207
|
+
const seed = usableSteelDrawingSeed();
|
|
20208
|
+
if (seed) {
|
|
20209
|
+
// The picker opens inside the click; Workspaces is entered while it is open, so the project Create makes is the one
|
|
20210
|
+
// on screen (a card already drawn may be behind Workflows or Agents, and opening a project keeps the current view).
|
|
20211
|
+
const opened = activateSeedCard(seed, null, { buildMode: quick ? 'quick' : 'precise' });
|
|
20212
|
+
await setMode('workspaces');
|
|
20213
|
+
await opened;
|
|
20214
|
+
return { ok: true };
|
|
20215
|
+
}
|
|
20216
|
+
// Workspaces not drawn yet (another view was open), or Steel Model not set up: Workspaces, at its card. Waiting for
|
|
20217
|
+
// the cards uses up the click, so the picker cannot open from it; the person's own press on the card does that, and
|
|
20218
|
+
// a Quick asked for here is pressed for them then (within a few minutes, once).
|
|
20219
|
+
await setMode('workspaces');
|
|
20220
|
+
if (current) await leaveProjectToList();
|
|
20221
|
+
if (current) return { ok: false, said: 'You stayed in this project, so New project was not opened. Ask again when you are ready.' };
|
|
20222
|
+
for (let i = 0; i < 60 && !$landing.querySelector('[data-seed-app]'); i++) await new Promise((r) => setTimeout(r, 500));
|
|
20223
|
+
const ready = usableSteelDrawingSeed();
|
|
20224
|
+
const card = ready || $landing.querySelector('[data-seed-template="steel-model"]');
|
|
20225
|
+
card?.scrollIntoView?.({ block: 'nearest' });
|
|
20226
|
+
card?.focus?.();
|
|
20227
|
+
if (ready) {
|
|
20228
|
+
pendingQuickPress = quick ? Date.now() + PENDING_QUICK_PRESS_MS : 0;
|
|
20229
|
+
return { ok: false, said: `Workspaces is open at Steel model from drawings. Press it to choose your drawings${quick ? ', and New project opens with Quick model pressed.' : '.'}` };
|
|
20230
|
+
}
|
|
20231
|
+
return { ok: false, said: card
|
|
20232
|
+
? 'Steel Model isn’t ready to start a project yet. Workspaces is open at its card, which says what it needs.'
|
|
20233
|
+
: 'Steel Model isn’t installed here, so there is no Steel model to start. Workspaces is open.' };
|
|
20234
|
+
}
|
|
20235
|
+
function usableSteelDrawingSeed() {
|
|
20236
|
+
const seed = $landing.querySelector('[data-seed-template="steel-model"][data-seed-action="drawing"]');
|
|
20237
|
+
return seed && !seed.classList.contains('ws-seed-remedy') && !createCardRemedy(seed) ? seed : null;
|
|
20238
|
+
}
|
|
20239
|
+
/**
|
|
20240
|
+
* #2811: a Quick press a chat card asked for, kept for the person's own press on the Steel model card. Every card press
|
|
20241
|
+
* takes it, used or not, so it applies to that one press at most; an explicit choice from a card wins.
|
|
20242
|
+
*/
|
|
20243
|
+
const PENDING_QUICK_PRESS_MS = 5 * 60_000;
|
|
20244
|
+
let pendingQuickPress = 0;
|
|
20245
|
+
function takePendingQuickPress(templateId, seedAction, explicit, linkFrom) {
|
|
20246
|
+
// Only the landing's own Steel model card: a module added from a General project never inherits a chat card's ask.
|
|
20247
|
+
const quick = templateId === 'steel-model' && seedAction === 'drawing' && !linkFrom && pendingQuickPress > Date.now();
|
|
20248
|
+
pendingQuickPress = 0;
|
|
20249
|
+
if (explicit) return explicit;
|
|
20250
|
+
return quick ? 'quick' : 'precise';
|
|
20251
|
+
}
|
|
20252
|
+
|
|
19931
20253
|
/** Open a project by id, from another project's Modules step: the same open a card on the landing does. */
|
|
19932
20254
|
async function openLinkedProject(projectId) {
|
|
19933
20255
|
await setMode('workspaces');
|
|
@@ -20480,7 +20802,7 @@
|
|
|
20480
20802
|
setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind,
|
|
20481
20803
|
openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, openDrawingsStep, openWorkflowsStep, openConnection, openDrawingAt, drawingFilterCheckpointSaved,
|
|
20482
20804
|
// #2470 R6.7: the Modules step of a General project (project-modules.js).
|
|
20483
|
-
moduleCreateCardsHtml, activateCreateCard, openLinkedProject, openModulesStep, showArchivedProjects,
|
|
20805
|
+
moduleCreateCardsHtml, activateCreateCard, openNewProjectFromDrawings, openLinkedProject, openModulesStep, showArchivedProjects,
|
|
20484
20806
|
syncWorkspaceReporter, openChatOwner, openPagesHome, folderDecisionCompleted,
|
|
20485
20807
|
// Project access (project-access.js loads after this file): the project open now, or null.
|
|
20486
20808
|
currentProject: () => ($app.classList.contains('mode-workspaces') && current ? current : null),
|