@floless/app 0.158.0 → 0.160.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.
Files changed (43) hide show
  1. package/dist/floless-server.cjs +140655 -117708
  2. package/dist/schemas/drawing-check.profile.v1.schema.json +33 -1
  3. package/dist/schemas/steel.model.v2.schema.json +1 -0
  4. package/dist/skills/floless-app-actions/SKILL.md +23 -5
  5. package/dist/skills/floless-app-bridge/SKILL.md +5 -3
  6. package/dist/skills/floless-app-onboarding/SKILL.md +69 -5
  7. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +8 -6
  8. package/dist/skills/floless-app-queue/SKILL.md +3 -1
  9. package/dist/skills/floless-app-rfi/SKILL.md +29 -1
  10. package/dist/skills/floless-app-steel-model/SKILL.md +11 -5
  11. package/dist/skills/floless-app-steel-takeoff/SKILL.md +28 -8
  12. package/dist/skills/floless-app-workflows/SKILL.md +6 -3
  13. package/dist/web/agents.js +12 -5
  14. package/dist/web/app.css +266 -159
  15. package/dist/web/app.js +23 -51
  16. package/dist/web/aware.js +533 -546
  17. package/dist/web/chat-question-card.js +24 -1
  18. package/dist/web/chat.css +170 -48
  19. package/dist/web/chat.js +1406 -208
  20. package/dist/web/commands-shell.js +1104 -177
  21. package/dist/web/commands-steel.js +2 -0
  22. package/dist/web/drawing-check-editor.html +10 -0
  23. package/dist/web/drawing-check-editor.js +44 -0
  24. package/dist/web/guide.js +12 -2
  25. package/dist/web/index.html +62 -48
  26. package/dist/web/instructor.js +33 -12
  27. package/dist/web/pages.js +186 -31
  28. package/dist/web/panels.js +19 -1
  29. package/dist/web/project-access.js +67 -8
  30. package/dist/web/project-modules.js +474 -0
  31. package/dist/web/project-rfis.js +715 -0
  32. package/dist/web/project-workflows.js +506 -0
  33. package/dist/web/run-history.js +198 -0
  34. package/dist/web/run-page-view.js +12 -2
  35. package/dist/web/steel-3d-core.js +75 -1
  36. package/dist/web/steel-3d-view.js +8 -38
  37. package/dist/web/steel-editor.html +263 -59
  38. package/dist/web/steel-model-v2-projection.js +7 -0
  39. package/dist/web/workspace-root-recovery.js +119 -0
  40. package/dist/web/workspaces.js +493 -161
  41. package/launch-starting-page.mjs +5 -2
  42. package/launch.mjs +136 -78
  43. package/package.json +6 -1
@@ -757,6 +757,26 @@
757
757
  dropHint: 'Click or drop PDFs',
758
758
  },
759
759
  ],
760
+ // A paid module (floless.io sells it, 2026-10-22). Unlike the parsers it is NOT serverAuthorizedOnly: its
761
+ // workflow is a core default every install carries, so the card is there by default and the server adds
762
+ // a capability row only when the signed lease does not include it, which turns the card into this lock.
763
+ moduleGated: true,
764
+ accessCopy: {
765
+ 'access-required': {
766
+ status: 'Not in your plan',
767
+ // No "stay viewable": Steel Model has no recovery view since 2026-10-23 (owner ruling, #1894/#2360).
768
+ body: 'Steel Model is not included in this account’s plan. Add it on floless.io, or sign in with an account that has it.',
769
+ action: 'See plans', aria: 'Steel Model is not in your plan — see plans on floless.io (opens in a new tab)',
770
+ },
771
+ 'account-selection-required': {
772
+ status: 'Choose an account', body: 'Choose which FloLess account to use for Steel Model.',
773
+ action: 'Choose account', aria: 'Choose a FloLess account for Steel Model',
774
+ },
775
+ 'check-unavailable': {
776
+ status: 'Couldn’t check access', body: 'FloLess couldn’t verify Steel Model access. Existing projects were not changed.',
777
+ action: 'Check again', aria: 'Steel Model access check unavailable — check again',
778
+ },
779
+ },
760
780
  editor: '/steel-editor.html',
761
781
  filter: '/steel-filter.html',
762
782
  steps: [
@@ -797,7 +817,6 @@
797
817
  cardIcon: '<path d="M5 16C8 6 16 6 19 16"/><rect x="3.25" y="16" width="3.5" height="3.5" rx=".5"/><rect x="17.25" y="16" width="3.5" height="3.5" rx=".5"/><rect x="10.5" y="7" width="3" height="3" rx=".5"/><path d="M6.5 8.5h4M13.5 8.5h4"/><circle cx="5" cy="8.5" r="1.5"/><circle cx="19" cy="8.5" r="1.5"/>', // a curve with anchors and handles
798
818
  displayName: 'Trace',
799
819
  projectCapability: 'editable 2D drawing',
800
- docGuide: true,
801
820
  createActions: [
802
821
  {
803
822
  kind: 'drawing',
@@ -994,6 +1013,9 @@
994
1013
  steps: [
995
1014
  { key: 'knowledge', label: 'Knowledge' },
996
1015
  { key: 'pages', label: 'Pages' },
1016
+ { key: 'workflows', label: 'Workflows' }, // #2470 R6.2: the workflows this project owns
1017
+ { key: 'rfis', label: 'RFIs' }, // #2470 R6.6: the project's questions for the engineer, client or architect
1018
+ { key: 'modules', label: 'Modules' }, // #2470 R6.7: the module projects linked to this one
997
1019
  ],
998
1020
  diff: false,
999
1021
  exports: [],
@@ -1092,7 +1114,8 @@
1092
1114
  for (const capability of capabilities || []) {
1093
1115
  if (!capability || typeof capability.templateId !== 'string'
1094
1116
  || capability.appId !== capability.templateId
1095
- || WORKSPACE_APPS[capability.templateId]?.serverAuthorizedOnly !== true) continue;
1117
+ || (WORKSPACE_APPS[capability.templateId]?.serverAuthorizedOnly !== true
1118
+ && WORKSPACE_APPS[capability.templateId]?.moduleGated !== true)) continue;
1096
1119
  const known = ['ready', 'access-required', 'account-selection-required', 'setup-provisioning', 'setup-unavailable', 'setup-integrity-failure', 'setup-repair-required', 'check-unavailable'];
1097
1120
  capabilityByRoot.set(capability.templateId, known.includes(capability.status) ? capability.status : 'check-unavailable');
1098
1121
  if (capability.setupChoice === true && ['tekla-parser', 'revit-model'].includes(capability.templateId)) setupChoiceByRoot.add(capability.templateId);
@@ -1101,6 +1124,9 @@
1101
1124
  }
1102
1125
  // A capability row exists only after the server positively found the canonical module. Add
1103
1126
  // its presentation entry even when authorization intentionally filtered it out of `apps`.
1127
+ // A module-gated card's `ready` row says the account may use it, not that its workflow is installed:
1128
+ // that stays the core-defaults check below, so a missing workflow still reads "Needs setup".
1129
+ if (WORKSPACE_APPS[capability.templateId]?.moduleGated === true && capabilityByRoot.get(capability.templateId) === 'ready') continue;
1104
1130
  if (!byRoot.has(capability.templateId)) byRoot.set(capability.templateId, [capability.templateId]);
1105
1131
  }
1106
1132
  // Keep the two built-in drawing actions visible when only one workflow is installed.
@@ -1270,6 +1296,7 @@
1270
1296
  $approveBtn.classList.toggle('approval-clean', s.status === 'ready' && !!s.headVersion && s.pendingCount === 0);
1271
1297
  $approveBtn.classList.toggle('approval-findings-accepted', s.status === 'ready' && !!s.headVersion && s.pendingCount === 0
1272
1298
  && !!(s.review && s.review.approvedHeadImportFindings));
1299
+ renderQuickHeader();
1273
1300
  }
1274
1301
 
1275
1302
  /**
@@ -1380,7 +1407,6 @@
1380
1407
  approvalState = { status: 'unreviewable', reason: review.reason, review: null, pendingCount: 0,
1381
1408
  headVersion: null, error: review.message || 'This project cannot be approved.' };
1382
1409
  renderApprovalHeader();
1383
- syncWorkspaceGuide();
1384
1410
  if (!$wsExports.hidden) paintExports(current.approvedAt);
1385
1411
  // No History re-render here. An earlier cut of this change had one, to repair a History
1386
1412
  // that had painted while the status was still `loading` — but `renderHistory` now parks on
@@ -1395,7 +1421,6 @@
1395
1421
  approvalState = { status: 'ready', review, pendingCount: groups.length, headVersion, error: '' };
1396
1422
  renderApprovalHeader();
1397
1423
  settleImportedSourceCard(projectId);
1398
- syncWorkspaceGuide();
1399
1424
  if (!$wsExports.hidden) paintExports(current.approvedAt);
1400
1425
  return review;
1401
1426
  } catch (error) {
@@ -1421,21 +1446,6 @@
1421
1446
  return (st && st.label) || (key.charAt(0).toUpperCase() + key.slice(1));
1422
1447
  };
1423
1448
 
1424
- // ── Workspaces guide beacon (aware.js owns #guide-beacon; we own project state) ──────
1425
- // The document-lifecycle guide (drop → review → approve → export) is for the lightweight
1426
- // Trace document archetype. Steel can now also start from drawings, but its guide/capability
1427
- // surface is broader and should not inherit Trace-specific SVG guidance.
1428
- const wsHasDocGuide = () => { const d = wsApp(); return !!(d && d.docGuide); };
1429
- function syncWorkspaceGuide() {
1430
- if (!bridge.setWorkspaceGuide) return; // older bridge — no-op (beacon simply stays hidden)
1431
- if (!current || !wsHasDocGuide()) { bridge.clearWorkspaceGuide && bridge.clearWorkspaceGuide(); return; }
1432
- // `exported` = an SVG export file exists (from the last export listing); best-known from
1433
- // exportState, which renderExports() populates. Unknown before Exports is opened → false.
1434
- const exported = !!(exportState && exportState.svg && exportState.svg.exportedAt);
1435
- bridge.setWorkspaceGuide({ app: current.app, name: current.name, displayName: projectAppName(current),
1436
- approved: approvalState.status === 'ready' && !!approvalState.headVersion && approvalState.pendingCount === 0, exported });
1437
- }
1438
-
1439
1449
  // ── mode ────────────────────────────────────────────────────────────────────
1440
1450
  // Which subject the browser tab should name. Pure and named so it can be driven over its three
1441
1451
  // real states in a test rather than grepped for out of applyMode() — review found four realistic
@@ -1494,8 +1504,6 @@
1494
1504
  $app.classList.toggle('mode-workspaces', ws);
1495
1505
  document.body.classList.toggle('mode-workspaces', ws);
1496
1506
  document.documentElement.classList.remove('mode-workspaces-boot');
1497
- // #2007: with both mode classes set, the workflow spotlight closes off Workflows and is offered again on it.
1498
- if (bridge.syncGuideSpotlight) bridge.syncGuideSpotlight();
1499
1507
  // The provenance strip is workflow-level data. Workspaces replaces that surface (including its
1500
1508
  // landing), so cancel any late workflow-pin paint before the project UI starts loading.
1501
1509
  if (ws && bridge.clearKbInformed) bridge.clearKbInformed();
@@ -1542,11 +1550,6 @@
1542
1550
  if (!ws) bridge.setRequestScope(null);
1543
1551
  else bridge.setRequestScope(current ? { project: current.id, appId: current.app, label: current.name } : {});
1544
1552
  }
1545
- // Keep the shared guide beacon in step with mode: in Workflows mode (or the Workspaces
1546
- // landing) it must NOT show a workspace guide — clear it so aware.js reverts to the
1547
- // workflow beacon; in a Workspaces project it points at that project's lifecycle.
1548
- if (!ws || !current) { if (bridge.clearWorkspaceGuide) bridge.clearWorkspaceGuide(); }
1549
- else syncWorkspaceGuide();
1550
1553
  if (window.flolessLeftPane) {
1551
1554
  // Any Model step may offer the left Model section; it appears only once that editor sends a snapshot.
1552
1555
  const modelPanelVisible = ws && !!current && currentStep === 'model';
@@ -1787,6 +1790,9 @@
1787
1790
  closeProjMenu();
1788
1791
  if (deferIfBusy()) return;
1789
1792
  renderLanding();
1793
+ // #2470 R6.7: an open Add a module sheet shows the same cards; it repaints too. A direct optional call, not a DOM
1794
+ // event: the harnesses that lift this function have no CustomEvent.
1795
+ globalThis.flolessProjectModules?.cardsChanged?.();
1790
1796
  }
1791
1797
  }
1792
1798
 
@@ -2450,7 +2456,8 @@
2450
2456
  `<span class="ws-seed-action">Why unavailable →</span>` +
2451
2457
  `</button>`;
2452
2458
  }
2453
- if (descriptor?.serverAuthorizedOnly === true && entry.capabilityStatus && entry.capabilityStatus !== 'ready') {
2459
+ if ((descriptor?.serverAuthorizedOnly === true || descriptor?.moduleGated === true)
2460
+ && entry.capabilityStatus && entry.capabilityStatus !== 'ready') {
2454
2461
  const revitStates = {
2455
2462
  'access-required': {
2456
2463
  status: 'Access required',
@@ -2506,6 +2513,10 @@
2506
2513
  const drawingCheckCommand = ['setup-unavailable', 'setup-integrity-failure'].includes(entry.capabilityStatus)
2507
2514
  ? 'data-command-id="shell.drawing-check-retry-setup"'
2508
2515
  : 'data-command-id="shell.drawing-check-view-access"';
2516
+ // Steel Model is bought, not enabled by an owner: its lock leads to the plans page.
2517
+ const steelModelCommand = entry.capabilityStatus === 'access-required'
2518
+ ? 'data-command-id="shell.steel-model-see-plans"'
2519
+ : 'data-command-id="shell.steel-model-view-access"';
2509
2520
  const remedyState = escapeAttr(entry.capabilityStatus || 'check-unavailable');
2510
2521
  return `<${actionable ? 'button type="button"' : 'div'} class="ws-seed ws-seed-remedy" ` +
2511
2522
  `aria-label="${escapeAttr(state.aria)}" aria-describedby="${escapeAttr(descriptionId)}" ` +
@@ -2516,6 +2527,8 @@
2516
2527
  ? `${revitCommand} data-revit-remedy="${remedyState}"`
2517
2528
  : entry.templateId === 'drawing-check'
2518
2529
  ? `${drawingCheckCommand} data-module-remedy="drawing-check" data-module-remedy-state="${remedyState}"`
2530
+ : entry.templateId === 'steel-model'
2531
+ ? `${steelModelCommand} data-module-remedy="steel-model" data-module-remedy-state="${remedyState}"`
2519
2532
  : `${teklaCommand} data-module-remedy="tekla-parser" data-module-remedy-state="${remedyState}"` : '') + `>` +
2520
2533
  seedIcon('!') +
2521
2534
  `<span class="ws-seed-headline">${escapeHtml(descriptor.displayName)}</span>` +
@@ -2765,6 +2778,8 @@
2765
2778
  thumbBandHtml(p, displayApp) +
2766
2779
  `<span class="ws-body"><span><span class="ws-name">${escapeHtml(p.name)}</span>` +
2767
2780
  (projectCapability ? `<span class="ws-meta">${escapeHtml(projectCapability)}</span>` : '') +
2781
+ // #2521 row 5: the card speaks for the WORKING COPY only, and says so in its tip.
2782
+ (p.quick && quickPillHtml(p.quick) ? `<span class="ws-meta ws-quick">${quickPillHtml(p.quick, { scope: 'Working copy', focusable: false })}</span>` : '') +
2768
2783
  (p.importedMidSave ? `<span class="ws-meta ws-unverified" data-tip="${escapeAttr(UNVERIFIED_IMPORT_TIP)}">Imported mid-save · not verified. Export again on the source computer.</span>` : '') +
2769
2784
  `<span class="ws-meta ws-registration-status"${p.registrationState === 'unavailable' ? '' : ' hidden'}>${escapeHtml(p.registrationReason || 'Project folder unavailable. Locate or restore it.')}</span>` +
2770
2785
  `<span class="ws-meta ws-registration-location-note"${p.registrationState !== 'unavailable' && p.registrationLocationWarning ? '' : ' hidden'}>${escapeHtml(p.registrationLocationWarning || '')}</span>` +
@@ -3019,45 +3034,37 @@
3019
3034
  window.dispatchEvent(new CustomEvent('floless:open-drawing-check-access', { detail: { state } }));
3020
3035
  }
3021
3036
 
3022
- $landing.addEventListener('click', async (e) => {
3023
- const registrationReview = e.target.closest('[data-project-registration-review]');
3024
- if (registrationReview) { window.flolessProjectReconciliation?.openRegistration(registrationReview.dataset.projectRegistrationReview); return; }
3025
- const groupToggle = e.target.closest('[data-project-group-toggle]');
3026
- if (groupToggle) {
3027
- const expanded = groupToggle.getAttribute('aria-expanded') !== 'true';
3028
- const key = groupToggle.dataset.projectGroupToggle;
3029
- if (landingQuery.trim()) projectGroupSearchOverrides.set(key, expanded);
3030
- else saveProjectGroupExpanded(key, expanded);
3031
- showProjectGroup(groupToggle.closest('.ws-project-section'), expanded);
3032
- if (expanded) tipTruncatedNames();
3033
- e.stopPropagation();
3034
- return;
3035
- }
3036
- const kebab = e.target.closest('[data-kebab]');
3037
- if (kebab) { e.stopPropagation(); openProjMenu(kebab.dataset.kebab, kebab); return; }
3038
- // Before the card's own [data-open] branch below, exactly like the kebab: the thumbnail is the one
3039
- // region of the card that does something other than open the project.
3040
- const thumb = e.target.closest('[data-thumb]');
3041
- if (thumb) { e.stopPropagation(); openThumbView(thumb.dataset.thumb, thumb); return; }
3042
- const restore = e.target.closest('[data-restore]');
3043
- if (restore) { e.stopPropagation(); unarchiveProject(restore.dataset.restore); return; }
3044
- const del = e.target.closest('[data-delete-archived]');
3045
- if (del) { e.stopPropagation(); deleteArchivedProject(del.dataset.deleteArchived); return; }
3046
- if (e.target.closest('#ws-retry-projects')) { e.stopPropagation(); retryProjects(); return; }
3047
- // Clearing empties the message the button sits in, so focus goes back to the search box.
3048
- if (e.target.closest('#ws-search-clear')) { setLandingQuery(''); $landing.querySelector('#ws-landing-search')?.focus(); return; }
3049
- if (e.target.closest('#ws-workspace-folder')) {
3050
- e.stopPropagation();
3051
- if (window.flolessWorkspaceRoot) window.flolessWorkspaceRoot.open();
3037
+ /**
3038
+ * The locked Steel Model card's remedies. Not in the plan: the floless.io plans page, where the person adds
3039
+ * it. Account choice and access checks go to the shell's account gate under Steel Model's name.
3040
+ */
3041
+ function runSteelModelRemedy(remedy) {
3042
+ const state = remedy.dataset.moduleRemedyState;
3043
+ if (state === 'access-required') {
3044
+ window.open('https://floless.io/pricing', '_blank', 'noopener'); // the same plans page pages.js links
3052
3045
  return;
3053
3046
  }
3054
- if (e.target.closest('#ws-import-project')) { importProject(); return; }
3055
- const parserSetup = e.target.closest('[data-parser-setup]');
3047
+ window.dispatchEvent(new CustomEvent('floless:open-steel-model-access', { detail: { state } }));
3048
+ }
3049
+
3050
+
3051
+ // ── create cards, shared by the landing and Add a module (#2470 R6.7) ────────────────────────────────────────
3052
+ // A create card behaves the same wherever it is shown: the Workspaces landing, or a General project's Add a module
3053
+ // sheet. There, `linkFrom` names the General project the new one is linked to (spec §6.2); the landing passes none.
3054
+
3055
+ /** The remedy a click on a create card asks for (set-up, access, a report), as a thunk; null when it was not on one. */
3056
+ function createCardRemedy(target) {
3057
+ if (!target?.closest?.('[data-parser-setup], [data-revit-remedy], [data-module-remedy]')) return null;
3058
+ return () => runCreateCardRemedy(target);
3059
+ }
3060
+
3061
+ async function runCreateCardRemedy(target) {
3062
+ const parserSetup = target.closest('[data-parser-setup]');
3056
3063
  if (parserSetup) {
3057
3064
  window.flolessParserSetupRecovery?.open(parserSetup.dataset.parserSetup, parserSetup);
3058
3065
  return;
3059
3066
  }
3060
- const revitRemedy = e.target.closest('[data-revit-remedy]');
3067
+ const revitRemedy = target.closest('[data-revit-remedy]');
3061
3068
  if (revitRemedy) {
3062
3069
  if (revitRemedy.dataset.revitRemedy === 'report-issue') {
3063
3070
  window.dispatchEvent(new CustomEvent('floless:report-revit-setup-issue', {
@@ -3150,11 +3157,15 @@
3150
3157
  }));
3151
3158
  return;
3152
3159
  }
3153
- const moduleRemedy = e.target.closest('[data-module-remedy]');
3160
+ const moduleRemedy = target.closest('[data-module-remedy]');
3154
3161
  if (moduleRemedy && moduleRemedy.dataset.moduleRemedy === 'drawing-check') {
3155
3162
  await runDrawingCheckRemedy(moduleRemedy);
3156
3163
  return;
3157
3164
  }
3165
+ if (moduleRemedy && moduleRemedy.dataset.moduleRemedy === 'steel-model') {
3166
+ runSteelModelRemedy(moduleRemedy);
3167
+ return;
3168
+ }
3158
3169
  if (moduleRemedy) {
3159
3170
  if (moduleRemedy.dataset.moduleRemedyState === 'setup-provisioning') return;
3160
3171
  if (moduleRemedy.dataset.moduleRemedyState === 'setup-integrity-failure') {
@@ -3239,52 +3250,95 @@
3239
3250
  }));
3240
3251
  return;
3241
3252
  }
3253
+ }
3254
+
3255
+ /**
3256
+ * Start a create card's own flow. Called straight from the click, with nothing awaited first, so the native file
3257
+ * picker it may open still counts as the person's own gesture.
3258
+ */
3259
+ async function activateSeedCard(seed, linkFrom = null) {
3260
+ // Two ids, and they are not interchangeable: create on the LIVE app (`seed-app`), but look the
3261
+ // descriptor up by its lineage ROOT (`seed-template`) — after a rename the live id answers to no
3262
+ // descriptor, and the built-in id answers to no installed app.
3263
+ const appId = seed.dataset.seedApp;
3264
+ const templateId = seed.dataset.seedTemplate || appId;
3265
+ if (!WORKSPACE_APPS[templateId]) return;
3266
+ // Each create kind has its own branch below. The 'drawing' check stays a check rather than an
3267
+ // assumption: a future kind must declare its own branch, not silently inherit the file picker.
3268
+ if (seed.dataset.seedAction === 'drawing') {
3269
+ if (workspaceWorkflowKnownMissing(appId)) {
3270
+ showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
3271
+ return;
3272
+ }
3273
+ let files;
3274
+ try { files = await pickDrawingFiles($seedFile, templateId); } // keep native picker in the click activation
3275
+ catch { showToast('Couldn’t open the drawing picker. Try again.', 'warn'); return; }
3276
+ if (!files.length) return;
3277
+ if (workspaceWorkflowKnownMissing(appId)) {
3278
+ showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
3279
+ return;
3280
+ }
3281
+ createFromDrawing(appId, templateId, files, { linkFrom });
3282
+ } else if (seed.dataset.seedAction === 'rvt') {
3283
+ const file = await pickRvtFile($seedRvt);
3284
+ if (file) createFromRvt(appId, templateId, file, linkFrom);
3285
+ } else if (seed.dataset.seedAction === 'tekla-source') {
3286
+ openTeklaSourceChoice(appId, templateId, seed, null, linkFrom);
3287
+ } else if (seed.dataset.seedAction === 'drawing-check-profile') {
3288
+ // A client profile starts empty: the reference drawings are added on its own page, where
3289
+ // their page counts and the proposed checklist can be shown. The setup dialog asks only the
3290
+ // folder and the client's name.
3291
+ createFromDrawing(appId, templateId, [], { kind: 'drawing-check-profile', sourceLabel: 'Client profile', returnFocus: seed, linkFrom });
3292
+ } else if (seed.dataset.seedAction === 'general-project') {
3293
+ // A General project starts from nothing but its name and folder (#2470).
3294
+ createFromDrawing(appId, templateId, [], { kind: 'general-project', sourceLabel: 'Blank project', returnFocus: seed });
3295
+ } else {
3296
+ // Unreachable today, and it must not be SILENT the day it isn't: an unhandled kind still
3297
+ // renders a full dashed, focusable card, so without this the first person to add one gets a
3298
+ // control that does nothing and says nothing. A dead control is no better than a missing one.
3299
+ console.warn(`[workspaces] create action "${seed.dataset.seedAction}" has no handler — the card does nothing`);
3300
+ }
3301
+ }
3302
+
3303
+ $landing.addEventListener('click', async (e) => {
3304
+ const registrationReview = e.target.closest('[data-project-registration-review]');
3305
+ if (registrationReview) { window.flolessProjectReconciliation?.openRegistration(registrationReview.dataset.projectRegistrationReview); return; }
3306
+ const groupToggle = e.target.closest('[data-project-group-toggle]');
3307
+ if (groupToggle) {
3308
+ const expanded = groupToggle.getAttribute('aria-expanded') !== 'true';
3309
+ const key = groupToggle.dataset.projectGroupToggle;
3310
+ if (landingQuery.trim()) projectGroupSearchOverrides.set(key, expanded);
3311
+ else saveProjectGroupExpanded(key, expanded);
3312
+ showProjectGroup(groupToggle.closest('.ws-project-section'), expanded);
3313
+ if (expanded) tipTruncatedNames();
3314
+ e.stopPropagation();
3315
+ return;
3316
+ }
3317
+ const kebab = e.target.closest('[data-kebab]');
3318
+ if (kebab) { e.stopPropagation(); openProjMenu(kebab.dataset.kebab, kebab); return; }
3319
+ // Before the card's own [data-open] branch below, exactly like the kebab: the thumbnail is the one
3320
+ // region of the card that does something other than open the project.
3321
+ const thumb = e.target.closest('[data-thumb]');
3322
+ if (thumb) { e.stopPropagation(); openThumbView(thumb.dataset.thumb, thumb); return; }
3323
+ const restore = e.target.closest('[data-restore]');
3324
+ if (restore) { e.stopPropagation(); unarchiveProject(restore.dataset.restore); return; }
3325
+ const del = e.target.closest('[data-delete-archived]');
3326
+ if (del) { e.stopPropagation(); deleteArchivedProject(del.dataset.deleteArchived); return; }
3327
+ if (e.target.closest('#ws-retry-projects')) { e.stopPropagation(); retryProjects(); return; }
3328
+ // Clearing empties the message the button sits in, so focus goes back to the search box.
3329
+ if (e.target.closest('#ws-search-clear')) { setLandingQuery(''); $landing.querySelector('#ws-landing-search')?.focus(); return; }
3330
+ if (e.target.closest('#ws-workspace-folder')) {
3331
+ e.stopPropagation();
3332
+ if (window.flolessWorkspaceRoot) window.flolessWorkspaceRoot.open();
3333
+ return;
3334
+ }
3335
+ if (e.target.closest('#ws-import-project')) { importProject(); return; }
3336
+ const remedy = createCardRemedy(e.target);
3337
+ if (remedy) { await remedy(); return; }
3242
3338
  const card = e.target.closest('[data-open]');
3243
3339
  if (card) { openProject(card.dataset.open); return; }
3244
3340
  const seed = e.target.closest('[data-seed-app]');
3245
- if (seed) {
3246
- // Two ids, and they are not interchangeable: create on the LIVE app (`seed-app`), but look the
3247
- // descriptor up by its lineage ROOT (`seed-template`) — after a rename the live id answers to no
3248
- // descriptor, and the built-in id answers to no installed app.
3249
- const appId = seed.dataset.seedApp;
3250
- const templateId = seed.dataset.seedTemplate || appId;
3251
- if (!WORKSPACE_APPS[templateId]) return;
3252
- // Each create kind has its own branch below. The 'drawing' check stays a check rather than an
3253
- // assumption: a future kind must declare its own branch, not silently inherit the file picker.
3254
- if (seed.dataset.seedAction === 'drawing') {
3255
- if (workspaceWorkflowKnownMissing(appId)) {
3256
- showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
3257
- return;
3258
- }
3259
- let files;
3260
- try { files = await pickDrawingFiles($seedFile, templateId); } // keep native picker in the click activation
3261
- catch { showToast('Couldn’t open the drawing picker. Try again.', 'warn'); return; }
3262
- if (!files.length) return;
3263
- if (workspaceWorkflowKnownMissing(appId)) {
3264
- showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
3265
- return;
3266
- }
3267
- createFromDrawing(appId, templateId, files);
3268
- } else if (seed.dataset.seedAction === 'rvt') {
3269
- const file = await pickRvtFile($seedRvt);
3270
- if (file) createFromRvt(appId, templateId, file);
3271
- } else if (seed.dataset.seedAction === 'tekla-source') {
3272
- openTeklaSourceChoice(appId, templateId, seed);
3273
- } else if (seed.dataset.seedAction === 'drawing-check-profile') {
3274
- // A client profile starts empty: the reference drawings are added on its own page, where
3275
- // their page counts and the proposed checklist can be shown. The setup dialog asks only the
3276
- // folder and the client's name.
3277
- createFromDrawing(appId, templateId, [], { kind: 'drawing-check-profile', sourceLabel: 'Client profile', returnFocus: seed });
3278
- } else if (seed.dataset.seedAction === 'general-project') {
3279
- // A General project starts from nothing but its name and folder (#2470).
3280
- createFromDrawing(appId, templateId, [], { kind: 'general-project', sourceLabel: 'Blank project', returnFocus: seed });
3281
- } else {
3282
- // Unreachable today, and it must not be SILENT the day it isn't: an unhandled kind still
3283
- // renders a full dashed, focusable card, so without this the first person to add one gets a
3284
- // control that does nothing and says nothing. A dead control is no better than a missing one.
3285
- console.warn(`[workspaces] create action "${seed.dataset.seedAction}" has no handler — the card does nothing`);
3286
- }
3287
- }
3341
+ if (seed) await activateSeedCard(seed);
3288
3342
  });
3289
3343
  $landing.addEventListener('input', (e) => {
3290
3344
  if (e.target.id !== 'ws-landing-search') return;
@@ -3349,9 +3403,9 @@
3349
3403
  $teklaSourceStatus.hidden = !message;
3350
3404
  }
3351
3405
  }
3352
- function openTeklaSourceChoice(appId, templateId, returnFocus, onPicked = null) {
3406
+ function openTeklaSourceChoice(appId, templateId, returnFocus, onPicked = null, linkFrom = null) {
3353
3407
  if (!$teklaSourceModal || teklaSourceChoice) return;
3354
- teklaSourceChoice = { appId, templateId, returnFocus, onPicked };
3408
+ teklaSourceChoice = { appId, templateId, returnFocus, onPicked, linkFrom };
3355
3409
  setTeklaSourcePicking(false);
3356
3410
  $teklaSourceModal.classList.add('show');
3357
3411
  $teklaSourceDialog?.focus();
@@ -3377,7 +3431,7 @@
3377
3431
  await choice.onPicked(source);
3378
3432
  return;
3379
3433
  }
3380
- const opened = await createFromTeklaSource(choice.appId, choice.templateId, source, choice.returnFocus);
3434
+ const opened = await createFromTeklaSource(choice.appId, choice.templateId, source, choice.returnFocus, choice.linkFrom);
3381
3435
  if (opened && teklaSourceChoice === choice) closeTeklaSourceChoice(false);
3382
3436
  else if (teklaSourceChoice === choice) setTeklaSourcePicking(false,
3383
3437
  'FloLess could not open project setup. Close any other setup window, then choose the source again.');
@@ -3741,6 +3795,7 @@
3741
3795
  const $projectSetupStandard = document.getElementById('project-setup-standard');
3742
3796
  const $projectSetupError = document.getElementById('project-setup-error');
3743
3797
  const $projectSetupProvider = document.getElementById('project-setup-provider');
3798
+ const $projectSetupKickoffNote = document.getElementById('project-setup-kickoff-note');
3744
3799
  const $projectSetupCancel = document.getElementById('project-setup-cancel');
3745
3800
  const $projectSetupCreateOnly = document.getElementById('project-setup-create-only');
3746
3801
  const $projectSetupCreate = document.getElementById('project-setup-create');
@@ -3836,7 +3891,7 @@
3836
3891
  $projectSetupCreate.textContent = label || 'Create project & start chat';
3837
3892
  $projectSetupCreateOnly.textContent = busy && !projectSetupState.settingUp
3838
3893
  ? 'Creating…'
3839
- : (NO_CHAT_SETUP_KINDS.includes(projectSetupState.kind) ? 'Create project' : 'Create project only');
3894
+ : projectSetupState.linkFrom ? 'Create project' : createOnlyLabel(projectSetupState.kind);
3840
3895
  if (!busy) {
3841
3896
  $projectSetupCreate.disabled = !projectSetupReady();
3842
3897
  $projectSetupCreateOnly.disabled = !projectSetupReady();
@@ -3858,13 +3913,18 @@
3858
3913
  // Every answer is checked against what can start now: preferredChatProvider() prefers the open
3859
3914
  // conversation's AI, which may since have been uninstalled, and a choice that cannot start must
3860
3915
  // never be the one shown as chosen and sent.
3861
- // Setup kinds that create a project only — no AI Chat intake, no drawing-intake task. The two model
3862
- // sources are read by FloLess itself; a Drawing Checker profile starts empty and is built on its page.
3863
- const NO_CHAT_SETUP_KINDS = ['rvt', 'tekla-source', 'drawing-check-profile', 'general-project'];
3916
+ // Setup kinds that create a project only — no AI Chat intake. The two model sources are read by
3917
+ // FloLess itself; a Drawing Checker profile starts empty and is built on its page. A General project
3918
+ // does start a chat: Flo's kickoff (#2470 R6.4).
3919
+ const NO_CHAT_SETUP_KINDS = ['rvt', 'tekla-source', 'drawing-check-profile'];
3920
+ // Setup kinds whose Create project makes no drawing-intake task: no drawings are read to start them.
3921
+ const NO_DRAWING_TASK_KINDS = ['rvt', 'tekla-source', 'drawing-check-profile', 'general-project'];
3922
+ // The secondary button says what it leaves out whenever a start-chat button sits beside it.
3923
+ const createOnlyLabel = (kind) => (NO_CHAT_SETUP_KINDS.includes(kind) ? 'Create project' : 'Create project only');
3864
3924
  // Setup kinds that start from no file at all: a Drawing Checker profile and a General project.
3865
3925
  const NO_FILE_SETUP_KINDS = ['drawing-check-profile', 'general-project'];
3866
3926
  function projectSetupProvider(state) {
3867
- if (!state || NO_CHAT_SETUP_KINDS.includes(state.kind)) return null;
3927
+ if (!state || NO_CHAT_SETUP_KINDS.includes(state.kind) || state.linkFrom) return null;
3868
3928
  const runtimes = bridge.chatProviderRuntimes?.() || [];
3869
3929
  const readiness = (id) => (id ? projectSetupProviderReadiness(runtimes.find((runtime) => runtime.id === id)) : 'unavailable');
3870
3930
  const canStart = (id) => readiness(id) !== 'unavailable';
@@ -3985,6 +4045,7 @@
3985
4045
  const provider = projectSetupProvider(state);
3986
4046
  paintProjectSetupProviders(state, provider);
3987
4047
  $projectSetupCreate.hidden = !provider;
4048
+ if ($projectSetupKickoffNote) $projectSetupKickoffNote.hidden = state.kind !== 'general-project';
3988
4049
  $projectSetupCreateOnly.classList.toggle('primary', !provider);
3989
4050
  $projectSetupTitle.textContent = `New ${descDisplayName(state.templateId)} project`;
3990
4051
  $projectSetupSourceName.textContent = state.sourceLabel || state.files[0]?.name || (state.kind === 'rvt' ? 'Revit model' : 'Drawing set');
@@ -3992,7 +4053,7 @@
3992
4053
  const $sourceKicker = $projectSetupSourceName.previousElementSibling;
3993
4054
  if ($sourceKicker) $sourceKicker.textContent = state.kind === 'general-project' ? 'Starting point' : 'Source';
3994
4055
  $projectSetupSourceName.parentElement?.setAttribute('aria-label', state.kind === 'general-project' ? 'Starting point' : 'Selected source drawings');
3995
- $projectSetupCreateOnly.textContent = state.busy ? 'Creating…' : (NO_CHAT_SETUP_KINDS.includes(state.kind) ? 'Create project' : 'Create project only');
4056
+ $projectSetupCreateOnly.textContent = state.busy ? 'Creating…' : state.linkFrom ? 'Create project' : createOnlyLabel(state.kind);
3996
4057
  $projectSetupSourceCount.textContent = state.files.length > 1 ? `+ ${state.files.length - 1} more` : '';
3997
4058
  $projectSetupFolder.textContent = state.directory
3998
4059
  ? state.directory.path
@@ -4109,19 +4170,33 @@
4109
4170
  app: state.appId,
4110
4171
  ...(state.askCatalogue ? { environment: state.environment } : {}),
4111
4172
  directorySelectionId: state.directory.selectionId,
4112
- ...(NO_CHAT_SETUP_KINDS.includes(state.kind) ? {} : { initialTask: { kind: 'drawing-intake', sourceNames: state.files.map((file) => file.name) } }),
4173
+ ...(NO_DRAWING_TASK_KINDS.includes(state.kind) ? {} : { initialTask: { kind: 'drawing-intake', sourceNames: state.files.map((file) => file.name) } }),
4174
+ ...(state.linkFrom ? { linkFrom: state.linkFrom } : {}),
4113
4175
  };
4114
- const { project } = await api('/api/projects', { method: 'POST', body: JSON.stringify(payload) });
4176
+ const created = await api('/api/projects', { method: 'POST', body: JSON.stringify(payload) });
4177
+ const project = created.project;
4178
+ // #2470 R6.7: added from a General project — the link result goes with the project to the module's own next step.
4179
+ const link = state.linkFrom ? { linkFrom: state.linkFrom, moduleLink: created.moduleLink, replayed: created.replayed === true } : null;
4180
+ if (link && link.replayed) {
4181
+ // The first try made this project and its answer was lost: open it as it is. Never import or upload again,
4182
+ // and never archive it as "empty" — whatever the first try started is still its own.
4183
+ if (!project.archived && !projects.some((item) => item.id === project.id)) projects.unshift(project);
4184
+ setProjectSetupBusy(false);
4185
+ closeProjectSetup({ restoreFocus: false });
4186
+ if (!project.archived) await openProject(project.id, state.kind === 'drawing-check-profile' ? 'model' : 'drawings');
4187
+ globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok' });
4188
+ return;
4189
+ }
4115
4190
  if (state.kind === 'rvt') {
4116
4191
  setProjectSetupBusy(false);
4117
4192
  closeProjectSetup({ restoreFocus: false });
4118
- await importRvtIntoProject(project, state.files[0], state.appId);
4193
+ await importRvtIntoProject(project, state.files[0], state.appId, link);
4119
4194
  return;
4120
4195
  }
4121
4196
  if (state.kind === 'tekla-source') {
4122
4197
  setProjectSetupBusy(false);
4123
4198
  closeProjectSetup({ restoreFocus: false });
4124
- await importTeklaIntoProject(project, state.teklaSource, state.appId);
4199
+ await importTeklaIntoProject(project, state.teklaSource, state.appId, link);
4125
4200
  return;
4126
4201
  }
4127
4202
  if (state.kind === 'drawing-check-profile' || state.kind === 'general-project') {
@@ -4131,6 +4206,7 @@
4131
4206
  closeProjectSetup({ restoreFocus: false });
4132
4207
  // A General project opens on Knowledge: the job's context, and the first thing to add.
4133
4208
  await openProject(project.id, state.kind === 'general-project' ? 'knowledge' : 'model');
4209
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok' });
4134
4210
  return;
4135
4211
  }
4136
4212
  projects.unshift(project);
@@ -4138,7 +4214,8 @@
4138
4214
  setProjectSetupBusy(false);
4139
4215
  closeProjectSetup({ restoreFocus: false });
4140
4216
  await openProject(project.id, 'drawings');
4141
- showToast('Project created. Attach the drawings on the Drawings step when you’re ready to read them.', 'ok');
4217
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok', next: 'Attach the drawings on the Drawings step when you’re ready to read them.' });
4218
+ else showToast('Project created. Attach the drawings on the Drawings step when you’re ready to read them.', 'ok');
4142
4219
  return;
4143
4220
  }
4144
4221
  let snapshots = state.snapshots || null;
@@ -4163,7 +4240,8 @@
4163
4240
  track('workspace_project_created', { app: state.appId });
4164
4241
  }
4165
4242
  if (!state.opened) {
4166
- await openProject(project.id, 'drawings');
4243
+ // A General project opens on Knowledge, where its kickoff chat helps fill it (#2470 R6.4).
4244
+ await openProject(project.id, state.kind === 'general-project' ? 'knowledge' : 'drawings');
4167
4245
  state.opened = true;
4168
4246
  }
4169
4247
  await bridge.openChatConversation(result.chat.chatId);
@@ -4183,7 +4261,10 @@
4183
4261
  }
4184
4262
  setProjectSetupBusy(false);
4185
4263
  closeProjectSetup({ restoreFocus: false });
4186
- showToast('Project created — the drawing task is running in AI Chat.', 'ok');
4264
+ // A General project's chat is Flo's kickoff; its first reply may still be on its way (#2470 R6.4).
4265
+ showToast(state.kind === 'general-project'
4266
+ ? 'Project created — Flo will help you set it up in AI Chat.'
4267
+ : 'Project created — the drawing task is running in AI Chat.', 'ok');
4187
4268
  }
4188
4269
 
4189
4270
  async function resumeInterruptedProjectChatIntake() {
@@ -4196,7 +4277,7 @@
4196
4277
  const result = await bridge.resumeProjectChatIntake(submissionId);
4197
4278
  if (!result) continue;
4198
4279
  if (!projects.some((item) => item.id === result.project.id)) projects.unshift(result.project);
4199
- await openProject(result.project.id, 'drawings');
4280
+ await openProject(result.project.id, result.project.app === 'floless-general' ? 'knowledge' : 'drawings');
4200
4281
  await bridge.openChatConversation(result.chat.chatId);
4201
4282
  forgetProjectChatIntake(submissionId);
4202
4283
  showToast('Recovered the project and its AI Chat.', 'ok');
@@ -4204,6 +4285,10 @@
4204
4285
  const code = error && (error.code || error.body && error.body.code);
4205
4286
  if (code === 'project-intake-not-found' || code === 'project-intake-damaged') {
4206
4287
  forgetProjectChatIntake(submissionId);
4288
+ } else if (code === 'project-intake-project-missing') {
4289
+ // The project this setup made was removed or replaced: nothing is left to resume, so say so once (#2470 R6.4).
4290
+ forgetProjectChatIntake(submissionId);
4291
+ showToast(projectSetupErrorMessage(error), 'error');
4207
4292
  } else {
4208
4293
  console.warn('project Chat intake recovery is still pending', error);
4209
4294
  }
@@ -4217,7 +4302,7 @@
4217
4302
  * working directory. Nothing is written while the dialog is open. Creation atomically publishes
4218
4303
  * project.json and an unsent initial-task draft; the headless provider is not contacted here.
4219
4304
  */
4220
- async function createFromDrawing(appId, templateId, files, { kind = 'drawings', sourceLabel = '', teklaSource = null, returnFocus = null } = {}) {
4305
+ async function createFromDrawing(appId, templateId, files, { kind = 'drawings', sourceLabel = '', teklaSource = null, returnFocus = null, linkFrom = null } = {}) {
4221
4306
  if (!$projectSetup || projectSetupState) return false;
4222
4307
  // A Drawing Checker profile and a General project start with no source file: what goes in them comes later.
4223
4308
  if (!Array.isArray(files) || (!files.length && !NO_FILE_SETUP_KINDS.includes(kind))) return false;
@@ -4235,6 +4320,9 @@
4235
4320
  providersRead: false,
4236
4321
  sourceLabel,
4237
4322
  teklaSource,
4323
+ // #2470 R6.7: the General project this one is added to, with the one operation id this dialog uses for every
4324
+ // press of Create (a retry after a lost answer is the same operation, so it can never make a second project).
4325
+ linkFrom,
4238
4326
  askCatalogue: kind === 'drawings' && templateId === 'steel-model',
4239
4327
  environment: null,
4240
4328
  directory: null,
@@ -4250,7 +4338,7 @@
4250
4338
  renderProjectSetup();
4251
4339
  $projectSetup.classList.add('show');
4252
4340
  $projectSetupFolderChoose.focus();
4253
- if (!NO_CHAT_SETUP_KINDS.includes(kind)) void refreshProjectSetupProviders(state);
4341
+ if (!NO_CHAT_SETUP_KINDS.includes(kind) && !linkFrom) void refreshProjectSetupProviders(state);
4254
4342
  try {
4255
4343
  if (kind !== 'tekla-source') {
4256
4344
  await Promise.all(files.map(assertProjectSourceReadable));
@@ -4980,23 +5068,23 @@
4980
5068
 
4981
5069
  // An RVT project is created like a drawing project: the setup dialog asks for the project folder
4982
5070
  // and name (every project lives in a chosen working directory), then the RVT is uploaded and imported.
4983
- function createFromTeklaSource(appId, templateId, source, returnFocus = null) {
5071
+ function createFromTeklaSource(appId, templateId, source, returnFocus = null, linkFrom = null) {
4984
5072
  if (!source || !['folder', 'zip'].includes(source.kind) || !Array.isArray(source.entries) || !source.entries.length) return false;
4985
5073
  if (source.kind === 'folder' && !source.entries.some((entry) => /\.db1$/i.test(entry.path) && !/(?:^|\/)xslib\.db1$/i.test(entry.path))) {
4986
5074
  showToast('That folder is not a Tekla model folder.', 'warn');
4987
5075
  return false;
4988
5076
  }
4989
5077
  return createFromDrawing(appId, templateId, source.entries.map((entry) => entry.file), {
4990
- kind: 'tekla-source', sourceLabel: source.label, teklaSource: source, returnFocus,
5078
+ kind: 'tekla-source', sourceLabel: source.label, teklaSource: source, returnFocus, linkFrom,
4991
5079
  });
4992
5080
  }
4993
5081
 
4994
- function createFromRvt(appId, templateId, file) {
5082
+ function createFromRvt(appId, templateId, file, linkFrom = null) {
4995
5083
  if (!file || !/\.rvt$/i.test(file.name)) { showToast('Choose one Revit .rvt file.', 'warn'); return; }
4996
- return createFromDrawing(appId, templateId, [file], { kind: 'rvt' });
5084
+ return createFromDrawing(appId, templateId, [file], { kind: 'rvt', linkFrom });
4997
5085
  }
4998
5086
 
4999
- async function importRvtIntoProject(project, file, appId) {
5087
+ async function importRvtIntoProject(project, file, appId, link = null) {
5000
5088
  try {
5001
5089
  const operation = await uploadRvtForProject(project, file, 0);
5002
5090
  track('workspace_project_created', { app: appId });
@@ -5005,15 +5093,18 @@
5005
5093
  paintRevitSourceState('Waiting for AWARE', 'Your RVT is stored locally and waiting for the trusted reader.');
5006
5094
  if (revitActiveOperation?.operationId !== operation.operationId) revitActiveOperation = operation;
5007
5095
  pollRevitImport(operation.operationId, project.id);
5096
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok' });
5008
5097
  } catch (err) {
5009
5098
  const removed = await archiveEmptyProject(project.id);
5099
+ // #2470 R6.7: the empty project is not kept linked either; the Modules step says what happened (spec §6.3).
5100
+ if (link) { await globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: removed ? 'archived-empty' : 'left-empty', error: err && err.message || String(err) }); return; }
5010
5101
  showToast(removed
5011
5102
  ? `Couldn’t import the RVT — the empty project was removed. ${err && err.message || err}`
5012
5103
  : `Couldn’t import the RVT. An empty project was left behind; archive it from the ⋯ menu. ${err && err.message || err}`, 'warn');
5013
5104
  }
5014
5105
  }
5015
5106
 
5016
- async function importTeklaIntoProject(project, source, appId) {
5107
+ async function importTeklaIntoProject(project, source, appId, link = null) {
5017
5108
  try {
5018
5109
  track('workspace_project_created', { app: appId });
5019
5110
  if (!projects.some((entry) => entry.id === project.id)) projects.unshift(project);
@@ -5024,7 +5115,9 @@
5024
5115
  if (revitActiveOperation?.operationId !== operation.operationId) revitActiveOperation = operation;
5025
5116
  pollRevitImport(operation.operationId, project.id);
5026
5117
  }
5118
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok' });
5027
5119
  } catch (error) {
5120
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'failed-kept' });
5028
5121
  if (error?.name === 'AbortError') {
5029
5122
  if (current?.id === project.id) {
5030
5123
  paintRevitSourceState('Read cancelled', 'No read-only snapshot was created. The source Tekla model was not changed.');
@@ -5199,7 +5292,6 @@
5199
5292
  // first actionable stage, and restore the destination only after an explicit `model` answer.
5200
5293
  setStep(pendingPresenceStep ? 'drawings' : initialStep);
5201
5294
  applyMode();
5202
- syncWorkspaceGuide(); // point the shared beacon at THIS project's document lifecycle
5203
5295
  }
5204
5296
 
5205
5297
  /**
@@ -5400,7 +5492,7 @@
5400
5492
  projectContractLifecycle = 'unknown'; exportsHasModel = false; modelPresenceGen++; modelPresenceProbe = null; pendingPresenceStep = null;
5401
5493
  if (pendingPresenceToast) pendingPresenceToast();
5402
5494
  pendingPresenceToast = null;
5403
- closeProjMenu(); applyMode(); syncWorkspaceGuide(); // revision state cleared by resetRevisionState() above
5495
+ closeProjMenu(); applyMode(); // revision state cleared by resetRevisionState() above
5404
5496
  }
5405
5497
  document.getElementById('ws-back').addEventListener('click', (e) => { void leaveProjectToList(e.currentTarget); });
5406
5498
 
@@ -6217,6 +6309,33 @@
6217
6309
  });
6218
6310
  }
6219
6311
  }
6312
+ // #2470 R6.2: Workflows is a shell-rendered pane too: the workflows this project owns (project-workflows.js).
6313
+ // Queried here for the same reason as the Pages pane above.
6314
+ const $workflowsPane = document.getElementById('ws-workflows');
6315
+ if ($workflowsPane) {
6316
+ const showWorkflows = s === 'workflows';
6317
+ $workflowsPane.hidden = !showWorkflows;
6318
+ const project = typeof current !== 'undefined' ? current : null;
6319
+ if (showWorkflows && project && window.flolessProjectWorkflows) window.flolessProjectWorkflows.render($workflowsPane, project);
6320
+ }
6321
+ // #2470 R6.6: RFIs is a shell-rendered pane too: the project's correspondence RFIs (project-rfis.js). Its module is
6322
+ // reached through globalThis, so a harness that lifts setStep without it still runs.
6323
+ const $rfisPane = document.getElementById('ws-rfis');
6324
+ if ($rfisPane) {
6325
+ const showRfis = s === 'rfis';
6326
+ $rfisPane.hidden = !showRfis;
6327
+ const project = typeof current !== 'undefined' ? current : null;
6328
+ if (showRfis && project) globalThis.flolessProjectRfis?.render?.($rfisPane, project);
6329
+ }
6330
+ // #2470 R6.7: Modules is a shell-rendered pane too: the module projects linked to this one (project-modules.js).
6331
+ // Queried here for the same reason as the Pages pane above.
6332
+ const $modulesPane = document.getElementById('ws-modules');
6333
+ if ($modulesPane) {
6334
+ const showModules = s === 'modules';
6335
+ $modulesPane.hidden = !showModules;
6336
+ const project = typeof current !== 'undefined' ? current : null;
6337
+ if (showModules && project && window.flolessProjectModules) window.flolessProjectModules.render($modulesPane, project);
6338
+ }
6220
6339
  // Knowledge is a shell-rendered pane too: the project's Knowledge Base (References column).
6221
6340
  const showKnowledge = s === 'knowledge';
6222
6341
  $wsKnowledge.hidden = !showKnowledge;
@@ -6651,6 +6770,51 @@
6651
6770
  return { operationId: state.operationId, operationToken: state.operationToken };
6652
6771
  }
6653
6772
 
6773
+ /**
6774
+ * #2521 row 5: the Quick model label. The server sends the words with each document it describes
6775
+ * (`quick: { state, short, label, tip }`); this only paints them. A precise model, or a payload without
6776
+ * the field, shows nothing. `scope` names WHICH document it describes ("v3", "Working copy") in the tip,
6777
+ * and in the visible text too with `showScope`, so a label never speaks for a document it was not read from.
6778
+ * `focusable: false` inside a control (a project card, a picker option): no second tab stop, and no Instructor id
6779
+ * that would shadow the control the click really drives. Its tooltip and words stay.
6780
+ */
6781
+ function quickPillHtml(q, opts = {}) {
6782
+ if (!q || (q.state !== 'quick' && q.state !== 'unknown') || typeof q.short !== 'string' || !q.short) return '';
6783
+ const scope = opts.scope ? `${opts.scope}: ` : '';
6784
+ const tip = `${scope}${q.label || q.short}. ${q.tip || ''}`.trim();
6785
+ const nested = opts.focusable === false;
6786
+ const carrier = nested ? '' : ' data-command-id="shell.quick-model-label" tabindex="0"';
6787
+ // Nested in a control: its full words ride along as that control's text, so a keyboard or screen-reader user who
6788
+ // cannot reach the pill's own tooltip still hears the count and what it means (code review of row 5a, round 2).
6789
+ const spoken = nested ? `<span class="sr-only"> (${escapeHtml(tip)})</span>` : '';
6790
+ return `<span class="quick-pill${q.state === 'unknown' ? ' is-unknown' : ''}"${carrier} data-tip="${escapeAttr(tip)}">${escapeHtml((opts.showScope ? scope : '') + q.short)}</span>${spoken}`;
6791
+ }
6792
+
6793
+ /**
6794
+ * The header chip: ONE compact chip for the approved head and, whenever it differs from the head, the working copy.
6795
+ * Its tooltip names each document and says what it rests on, so the header never grows a second chip that pushes
6796
+ * Approve off a laptop-width header (found by the independent QA run: two chips beside "Review changes · 10" ended
6797
+ * Approve at 1418 px in a 1280 px window).
6798
+ */
6799
+ function renderQuickHeader() {
6800
+ const $quick = document.getElementById('ws-quick');
6801
+ if (!$quick) return;
6802
+ const s = approvalState;
6803
+ const q = s.status === 'ready' && s.review && s.review.quick ? s.review.quick : null;
6804
+ const parts = [];
6805
+ if (q && s.headVersion && quickPillHtml(q.head)) parts.push([`v${s.headVersion}`, q.head]);
6806
+ if (q && (s.pendingCount > 0 || !s.headVersion) && quickPillHtml(q.draft)) parts.push(['Working copy', q.draft]);
6807
+ if (!parts.length) { $quick.innerHTML = ''; $quick.hidden = true; return; }
6808
+ // "Quick model" when any document it speaks for is readably Quick; "Possibly Quick model" when none is; dashed
6809
+ // whenever one of them could not be read.
6810
+ const anyQuick = parts.some(([, label]) => label.state === 'quick');
6811
+ const anyUnknown = parts.some(([, label]) => label.state === 'unknown');
6812
+ const tip = parts.map(([scope, label]) => `${scope}: ${label.label}.`).join(' ')
6813
+ + ` ${(parts.find(([, label]) => label.state === 'quick') || parts[0])[1].tip || ''}`;
6814
+ $quick.innerHTML = `<span class="quick-pill${anyUnknown ? ' is-unknown' : ''}" data-command-id="shell.quick-model-label" tabindex="0" data-tip="${escapeAttr(tip.trim())}">${escapeHtml(anyQuick ? 'Quick model' : 'Possibly Quick model')}</span>`;
6815
+ $quick.hidden = false;
6816
+ }
6817
+
6654
6818
  async function finishApprovalSuccess(res, project) {
6655
6819
  const revisionNoteStatus = await finishApprovalRevisionNote(res, project);
6656
6820
  if ($approvalRevisionNoteText) $approvalRevisionNoteText.value = '';
@@ -6669,9 +6833,11 @@
6669
6833
  // #2449: an approval resting on connection assumptions (or one whose record could not be read) is never announced
6670
6834
  // as a plain approval either; the server's own sentence, the same one History shows.
6671
6835
  const assumed = res && res.connectionAssumptions && typeof res.connectionAssumptions.note === 'string' ? res.connectionAssumptions.note : '';
6672
- showToast(`${headline} ${assumed ? `${assumed} ` : ''}${pending ? `${pending} change${pending === 1 ? ' remains' : 's remain'} pending${saved ? ' in Saved work' : ''}; approved exports omit them unless you explicitly choose DRAFT.` : 'No changes remain pending.'}`, 'ok');
6836
+ // #2521 row 5: an approved Quick model says so in the same breath, read from the approved version itself.
6837
+ const quick = res && res.quick && (res.quick.state === 'quick' || res.quick.state === 'unknown') && typeof res.quick.label === 'string'
6838
+ ? `${res.quick.label}. ` : '';
6839
+ showToast(`${headline} ${quick}${assumed ? `${assumed} ` : ''}${pending ? `${pending} change${pending === 1 ? ' remains' : 's remain'} pending${saved ? ' in Saved work' : ''}; approved exports omit them unless you explicitly choose DRAFT.` : 'No changes remain pending.'}`, 'ok');
6673
6840
  track('workspace_project_approved', { app: project.app });
6674
- if (bridge.markWorkspaceApproved && wsDescOf(project)?.docGuide) bridge.markWorkspaceApproved(project.app);
6675
6841
  if (!$wsExports.hidden) safeRenderExports('after approving this version');
6676
6842
  if (!$wsHistory.hidden) await renderHistory();
6677
6843
  if (!approvalDialogState) return;
@@ -12601,17 +12767,18 @@
12601
12767
  const out = [];
12602
12768
  // #2449: each approved source carries its own frozen connection-assumptions label from the server, bound to it.
12603
12769
  const frozen = (row) => (row && row.connectionAssumptions && typeof row.connectionAssumptions.note === 'string' ? row.connectionAssumptions : null);
12604
- if (data.default) out.push({ selector: { kind: 'latest-approved' }, label: `Latest approved · v${data.default.version}`, group: 'Recommended', version: data.default.version, assumptions: frozen(data.default) });
12770
+ // #2521 row 5: `quick` first, so each option keeps the exact shape the #2449 checks read.
12771
+ if (data.default) out.push({ quick: data.default.quick, selector: { kind: 'latest-approved' }, label: `Latest approved · v${data.default.version}`, group: 'Recommended', version: data.default.version, assumptions: frozen(data.default) });
12605
12772
  if (data.working) out.push({
12606
12773
  selector: {
12607
12774
  kind: 'working', expectedEtag: data.working.etag,
12608
12775
  ...(data.working.epoch !== null && Number.isInteger(Number(data.working.epoch)) ? { expectedEpoch: Number(data.working.epoch) } : {}),
12609
12776
  },
12610
- label: 'Working copy · DRAFT', group: 'Drafts',
12777
+ label: 'Working copy · DRAFT', group: 'Drafts', quick: data.working.quick,
12611
12778
  });
12612
- for (const saved of data.checkpoints || []) out.push({ selector: { kind: 'checkpoint', checkpointId: saved.checkpointId, expectedHash: saved.hash }, label: `Checkpoint ${String(saved.checkpointId).slice(0, 8)} · DRAFT`, group: 'Drafts', sub: saved.baseVersion ? `Pending work from v${saved.baseVersion}` : 'No approved baseline' });
12779
+ for (const saved of data.checkpoints || []) out.push({ selector: { kind: 'checkpoint', checkpointId: saved.checkpointId, expectedHash: saved.hash }, label: `Checkpoint ${String(saved.checkpointId).slice(0, 8)} · DRAFT`, group: 'Drafts', sub: saved.baseVersion ? `Pending work from v${saved.baseVersion}` : 'No approved baseline', quick: saved.quick });
12613
12780
  for (const row of data.defaultUnavailable?.reason === 'refused' ? [] : (data.approved || [])) {
12614
- if (!data.default || Number(row.version) !== Number(data.default.version)) out.push({ selector: { kind: 'approved', version: row.version }, label: `Older approved · v${row.version}`, group: 'Approved history', version: row.version, assumptions: frozen(row) });
12781
+ if (!data.default || Number(row.version) !== Number(data.default.version)) out.push({ quick: row.quick, selector: { kind: 'approved', version: row.version }, label: `Older approved · v${row.version}`, group: 'Approved history', version: row.version, assumptions: frozen(row) });
12615
12782
  }
12616
12783
  return out;
12617
12784
  }
@@ -12644,7 +12811,7 @@
12644
12811
  const rows = options.filter((option) => option.group === group);
12645
12812
  if (!rows.length) return '';
12646
12813
  return `<div class="export-source-group" role="group" aria-label="${escapeAttr(group)}"><div class="export-source-group-label">${escapeHtml(group)}</div>`
12647
- + rows.map((option) => { const key = JSON.stringify(option.selector); return `<button type="button" class="export-source-option${key === selectedKey ? ' selected' : ''}" role="option" aria-selected="${String(key === selectedKey)}" data-export-source="${escapeAttr(key)}"><span>${escapeHtml(option.label)}</span>${option.sub ? `<small>${escapeHtml(option.sub)}</small>` : ''}</button>`; }).join('') + '</div>';
12814
+ + rows.map((option) => { const key = JSON.stringify(option.selector); const quickTip = quickPillHtml(option.quick) ? ` data-tip="${escapeAttr(`${option.label}: ${option.quick.label}. ${option.quick.tip || ''}`.trim())}"` : ''; return `<button type="button" class="export-source-option${key === selectedKey ? ' selected' : ''}" role="option" aria-selected="${String(key === selectedKey)}" data-export-source="${escapeAttr(key)}"${quickTip}><span>${escapeHtml(option.label)}${quickPillHtml(option.quick, { scope: option.label, focusable: false })}</span>${option.sub ? `<small>${escapeHtml(option.sub)}</small>` : ''}</button>`; }).join('') + '</div>';
12648
12815
  }).join('');
12649
12816
  let warning = '';
12650
12817
  if (data.defaultUnavailable?.reason === 'refused') {
@@ -12673,6 +12840,22 @@
12673
12840
  return selectedSourceAssumptionsHtml(source) + exportedFilesAssumptionsHtml(source);
12674
12841
  }
12675
12842
 
12843
+ /**
12844
+ * #2521 row 5: what the SELECTED source rests on, and, separately, what the version the listed files came from rests
12845
+ * on (from the same answer as the files), so neither line speaks for the other's document.
12846
+ */
12847
+ function exportsQuickHtml() {
12848
+ const source = currentExportSourceOption();
12849
+ if (!source) return '';
12850
+ const line = (q, scope) => (quickPillHtml(q) ? `<div class="export-quick-note" role="note"><b>${escapeHtml(scope)}:</b> ${escapeHtml(q.label)}. ${escapeHtml(q.tip || '')}</div>` : '');
12851
+ const selected = line(source.quick, source.label);
12852
+ const from = exportStateFrom;
12853
+ const files = from && from.quick && exportState && Object.values(exportState).some((e) => e && e.exportedAt)
12854
+ && !(source.selector.kind === 'latest-approved' && Number(source.version) === Number(from.version))
12855
+ ? line(from.quick, `Files below, exported from v${from.version}`) : '';
12856
+ return selected + files;
12857
+ }
12858
+
12676
12859
  /**
12677
12860
  * The files already listed on the cards were exported from the LATEST approved version (the listing only returns
12678
12861
  * receipts for it). While another source is selected the note above describes that source, so the written files
@@ -12768,6 +12951,7 @@
12768
12951
  // caption. The note's job — per the comment above — is to justify the exports-FOLDER button
12769
12952
  // staying enabled, not to claim the export actions work unapproved. "Polishing is optional" was
12770
12953
  // the true and useful half, and it survives; only the opening clause overreached.
12954
+ html += exportsQuickHtml(); // #2521 row 5: what the selected source and the listed files rest on
12771
12955
  html += exportsAssumptionsHtml();
12772
12956
  html += `<div class="exports-note"><b>Any saved source can be exported</b> — approved is the safe default, while DRAFT and older versions stay explicit. Polishing further ` +
12773
12957
  `is optional. Each writes to this project’s <button type="button" class="exports-note-link" data-open-exports-folder ` +
@@ -13134,7 +13318,6 @@
13134
13318
  if (answered) current.approvedAt = approvedAt;
13135
13319
  exportState = state;
13136
13320
  exportStateFrom = answered ? filesFrom : null;
13137
- syncWorkspaceGuide(); // fresh approve/export state → tick the Export (and re-sync Approve) guide rows
13138
13321
  paintExports(approvedAt, restoreKind);
13139
13322
  }
13140
13323
 
@@ -13142,7 +13325,11 @@
13142
13325
  })();
13143
13326
 
13144
13327
  async function captureSelectedExportSources(projectId, copies = 1, selectedSelector = null) {
13145
- const option = selectedSelector ? { selector: selectedSelector } : currentExportSourceOption();
13328
+ // A pinned selector (Send to a CAD app) is checked against the label the list shows for that same source.
13329
+ const listedOption = selectedSelector
13330
+ ? exportSourceOptions(exportSourcesState.data).find((o) => JSON.stringify(o.selector) === JSON.stringify(selectedSelector))
13331
+ : null;
13332
+ const option = selectedSelector ? { selector: selectedSelector, quick: listedOption ? (listedOption.quick || null) : undefined } : currentExportSourceOption();
13146
13333
  if (!option) throw new Error('Choose an export source first.');
13147
13334
  let selector = option.selector;
13148
13335
  if (option.selector.kind === 'working') {
@@ -13157,6 +13344,15 @@
13157
13344
  method: 'POST', body: JSON.stringify({ selector, copies }),
13158
13345
  });
13159
13346
  if (!captured || !captured.source || !captured.source.handleId) throw new Error('The export source could not be frozen.');
13347
+ // #2521 row 5: the frozen source says what IT rests on. When that differs from the label the list showed (an
13348
+ // approval or a save landed in between), say what is really being exported and repaint the list from the server.
13349
+ const listed = option.quick && option.quick.state !== 'precise' ? option.quick : null;
13350
+ const frozen = captured.source.quick && captured.source.quick.state !== 'precise' ? captured.source.quick : null;
13351
+ // A pinned selector with no listed label to compare (an older caller) is not second-guessed.
13352
+ if ((!selectedSelector || option.quick !== undefined) && (listed && listed.label) !== (frozen && frozen.label)) {
13353
+ showToast(`This source changed since the list was shown. What is being exported: ${frozen ? `${frozen.label}.` : 'a model that rests on no AI decisions.'}`, 'info');
13354
+ if (current && current.id === projectId) safeRenderExports('after the export source changed');
13355
+ }
13160
13356
  return Array.isArray(captured.sources) && captured.sources.length === copies ? captured.sources : [captured.source];
13161
13357
  }
13162
13358
 
@@ -14911,7 +15107,7 @@
14911
15107
  return line;
14912
15108
  }
14913
15109
 
14914
- function proposalRow(p, idx, bucket) {
15110
+ function proposalRow(p, idx, bucket, { preTicks = false } = {}) {
14915
15111
  // A read that only ADDS (marks on a sheet, detail anchors, moment frames) reads as an addition, not as a change.
14916
15112
  const addsOnly = isMarksRow(p) || (p.kind === 'model-changed' && (p.key === 'detail_bubbles' || p.key === 'moment_frames'));
14917
15113
  const row = revEl('div', 'rev-row ' + (addsOnly ? 'k-added' : (KIND_CLASS[p.kind] || 'k-changed')));
@@ -14938,6 +15134,23 @@
14938
15134
  // is named from its subject.
14939
15135
  const rf = p.kind === 'model-changed' ? rootField(p.key) : null;
14940
15136
  head.appendChild(revEl('span', 'rev-kind-badge', rf ? rf.badge : (isMarksRow(p) ? marksBadge(p) : (KIND_LABEL[p.kind] || p.kind))));
15137
+ // #2521 row 3b-3: the SERVER marks a row whose new height the AI of this Quick build chose (`p.ai`). The pill says who
15138
+ // chose it at a glance; what that means for the tick is in the row's note, which the checkbox is described by.
15139
+ const aiRow = p.kind === 'member-changed' && p.ai && typeof p.ai === 'object' && p.ai.heights > 0 ? p.ai : null;
15140
+ if (aiRow) {
15141
+ const pill = revEl('span', 'ai-pill rev-ai-pill', aiRow.onlyAiHeights ? 'AI-chosen height' : 'AI height');
15142
+ pill.dataset.tip = 'Chosen by the AI in the Quick model, not from the drawings.';
15143
+ head.appendChild(pill);
15144
+ }
15145
+ // Pre-ticked only when the person chose to auto-accept the AI's changes, the server says every change in the row is
15146
+ // the AI's height, and the review is not a re-render after the model moved (then every tick is cleared, below).
15147
+ const preTicked = !!(aiRow && p.preTick === true && preTicks);
15148
+ if (preTicked) box.checked = true;
15149
+ // Instructor (`?`) explains this tick in its own words, as it does the pre-selected registration row.
15150
+ if (aiRow) {
15151
+ box.dataset.commandId = `shell.revision-ai-height#${p.memberId}`;
15152
+ box.dataset.commandInstanceLabel = String(p.memberId || '');
15153
+ }
14941
15154
  // A plan proposal is titled by `viewLabel`, which the SERVER computes with `planViewLabels` (#938).
14942
15155
  // The rule needs sibling context — a page's name is enough when it carries one view and must be
14943
15156
  // disambiguated when it carries several — which a single proposal row does not have, so re-deriving
@@ -14988,9 +15201,15 @@
14988
15201
  // with other changes the read proposes for the same member; accepting it takes those too, so the
14989
15202
  // row says so FIRST (design review: it is the most consequential note) rather than letting the
14990
15203
  // height stand for the whole decision.
14991
- if (answeredEnds && otherFields) {
15204
+ if ((answeredEnds && otherFields) || (aiRow && !aiRow.onlyAiHeights)) {
14992
15205
  desc.push(revEl('div', 'rev-row-note', 'Ticking this row also applies the other changes shown for this member.'));
14993
15206
  }
15207
+ // ONE note for the AI's height (design review: never two stacked), saying whose number it is and what the tick does.
15208
+ if (aiRow) {
15209
+ desc.push(revEl('div', 'rev-row-note', preTicked
15210
+ ? 'The AI picked this height in the Quick model; it is not from the drawings or from you. It is ticked for you because you chose to auto-accept the AI’s changes: untick it to keep the height as it is.'
15211
+ : 'The AI picked this height in the Quick model; it is not from the drawings or from you. It is applied only if this row is ticked when you confirm.'));
15212
+ }
14994
15213
  desc.push(...notes);
14995
15214
  } else if (p.kind === 'model-changed') {
14996
15215
  const isGrid = p.key === 'grid';
@@ -15279,7 +15498,15 @@
15279
15498
  root.querySelectorAll('.rev-check, .rev-group-actions').forEach((control) => control.remove());
15280
15499
  }
15281
15500
 
15282
- function renderReview(summary, { readOnly = false } = {}) {
15501
+ /** #2521 row 3b-3: what the review's subtitle adds while a row starts ticked for the person; taken out when none does. */
15502
+ const PRE_TICKED_SUB = ' Some of the AI’s height changes are ticked for you because you chose to auto-accept them; untick any you do not want, then confirm.';
15503
+
15504
+ /*
15505
+ * `preTicks` (#2521 row 3b-3): whether a row the server pre-ticks (`preTick`, the person's auto-accept choice) starts
15506
+ * ticked. Off for the re-render after the model moved mid-review: that render clears every tick on purpose ("each one
15507
+ * needs deciding again"), so it never re-ticks an AI row the person had unticked (Codex plan review, finding 3).
15508
+ */
15509
+ function renderReview(summary, { readOnly = false, preTicks = true } = {}) {
15283
15510
  // COUNTS: one quiet line, and never "0 of X" — the zero clause is simply omitted.
15284
15511
  // The numbers carry a <b>, so the two figures worth scanning stand out of the muted sentence —
15285
15512
  // the rule for it existed and nothing emitted the element.
@@ -15334,7 +15561,7 @@
15334
15561
  }
15335
15562
  if (props.length) {
15336
15563
  const g = group(readOnly ? 'Changes this read proposed' : 'Needs your decision', props.length, 'proposals');
15337
- props.forEach((p, i) => g.appendChild(proposalRow(p, i, 'proposals')));
15564
+ props.forEach((p, i) => g.appendChild(proposalRow(p, i, 'proposals', { preTicks: preTicks && !readOnly })));
15338
15565
  body.appendChild(g);
15339
15566
  }
15340
15567
  if (binds.length) {
@@ -15433,9 +15660,11 @@
15433
15660
  const created = outcomes.filter((row) => ['created', 'successor'].includes(row.result));
15434
15661
  const existing = outcomes.filter((row) => ['reused', 'reopened', 'already-seeded'].includes(row.result));
15435
15662
  const removed = outcomes.filter((row) => row.result === 'not-in-report');
15436
- const attention = outcomes.filter((row) => !['created', 'reused', 'reopened', 'successor', 'already-seeded', 'not-in-report'].includes(row.result));
15663
+ // #2521 row 3b-2: a Quick RFI whose question the person's review changed. It stays open; it is not lost.
15664
+ const changed = outcomes.filter((row) => row.result === 'facts-changed');
15665
+ const attention = outcomes.filter((row) => !['created', 'reused', 'reopened', 'successor', 'already-seeded', 'not-in-report', 'facts-changed'].includes(row.result));
15437
15666
  $revReviewCounts.replaceChildren(document.createTextNode(
15438
- `RFI result: ${created.length} created · ${existing.length} existing record${existing.length === 1 ? '' : 's'} used · ${removed.length} selected question${removed.length === 1 ? '' : 's'} no longer in the final report · ${unasked.length} new question${unasked.length === 1 ? '' : 's'} appeared only at confirm and ${unasked.length === 1 ? 'was' : 'were'} not filed.${attention.length ? ` ${attention.length} other RFI result${attention.length === 1 ? '' : 's'} need attention.` : ''}`,
15667
+ `RFI result: ${created.length} created · ${existing.length} existing record${existing.length === 1 ? '' : 's'} used · ${removed.length} selected question${removed.length === 1 ? '' : 's'} no longer in the final report · ${unasked.length} new question${unasked.length === 1 ? '' : 's'} appeared only at confirm and ${unasked.length === 1 ? 'was' : 'were'} not filed.${changed.length ? ` ${changed.length} stayed open and ${changed.length === 1 ? 'was' : 'were'} not filed: your review changed the question, so the AI's recommendation no longer answers it.` : ''}${attention.length ? ` ${attention.length} other RFI result${attention.length === 1 ? '' : 's'} need attention.` : ''}`,
15439
15668
  ));
15440
15669
  $revReviewCounts.dataset.revRfiSelection = 'result';
15441
15670
  $revReviewCounts.hidden = false;
@@ -15469,6 +15698,16 @@
15469
15698
  }
15470
15699
  body.appendChild(section);
15471
15700
  }
15701
+ if (changed.length) {
15702
+ const section = group('Changed in your review, still open', changed.length);
15703
+ for (const row of changed) {
15704
+ const item = revEl('div', 'rev-row');
15705
+ item.appendChild(revEl('div', 'rev-row-title', row.gapKey));
15706
+ item.appendChild(revEl('div', 'rev-row-note', 'Changed in your review. The AI’s recommendation no longer answers this, so it stays open and is not filed.'));
15707
+ section.appendChild(item);
15708
+ }
15709
+ body.appendChild(section);
15710
+ }
15472
15711
  if (unasked.length) {
15473
15712
  const section = group('New questions that were not filed', unasked.length);
15474
15713
  for (const row of unasked) {
@@ -15489,7 +15728,7 @@
15489
15728
  }
15490
15729
  body.appendChild(section);
15491
15730
  }
15492
- if (!records.length && !removed.length && !unasked.length && !attention.length) {
15731
+ if (!records.length && !removed.length && !changed.length && !unasked.length && !attention.length) {
15493
15732
  body.appendChild(revEl('div', 'hd-empty', 'No RFI record changed with this revision.'));
15494
15733
  }
15495
15734
  $revReviewBody.replaceChildren(body);
@@ -15600,6 +15839,11 @@
15600
15839
  : moveForward
15601
15840
  ? `This read started from v${moveForward.fromVersion}. Its non-overlapping changes can be applied on top of approved v${moveForward.toVersion}; decide every overlap before applying.`
15602
15841
  : 'Nothing is applied until you confirm. Registration rows start selected; tick any other changes you want, and clear any registration this read may not change.';
15842
+ // #2521 row 3b-3: said without a number, so it cannot go stale as the person unticks (design review), and as
15843
+ // "ticked for you", never "accepted": nothing lands until the confirm.
15844
+ if (!readOnly && (summary.proposals || []).some((p) => p && p.kind === 'member-changed' && p.preTick === true && p.ai)) {
15845
+ $revReviewSub.textContent += PRE_TICKED_SUB;
15846
+ }
15603
15847
  $revReviewChanged.hidden = true;
15604
15848
  delete $revReviewChanged.dataset.kind;
15605
15849
  renderReview(summary, { readOnly });
@@ -15822,7 +16066,9 @@
15822
16066
  // `revReviewState` to the fresh stageId would leave the user looking at one review while the
15823
16067
  // next confirm submitted indices against another. Rendering first means a throw leaves the
15824
16068
  // stale-but-consistent pair, and the `finally` below still restores the button.
15825
- renderReview(fresh); // replaceChildren builds new, unticked inputs — no tick can survive it
16069
+ renderReview(fresh, { preTicks: false }); // replaceChildren builds new, unticked inputs — no tick can survive it, a pre-tick included
16070
+ // So the subtitle no longer says any row is ticked for the person (code review of 3b-3).
16071
+ $revReviewSub.textContent = $revReviewSub.textContent.replace(PRE_TICKED_SUB, '');
15826
16072
  revReviewState = { ...st, stageId: fresh.stageId, summary: fresh };
15827
16073
  if (fresh.rfiSelection?.decision === 'required') showRequiredRfiSelection(fresh, true);
15828
16074
  else {
@@ -16322,7 +16568,7 @@
16322
16568
  `<td><span class="ver${v.current ? ' cur' : ''}">v${escapeHtml(String(v.n))}</span></td>` +
16323
16569
  `<td class="htime">${escapeHtml(histWhen(v.ts))}</td>` +
16324
16570
  `<td><span class="hby">${avatarFor(v.author)}${escapeHtml(v.author)}</span></td>` +
16325
- `<td>${gateBadge(v.gate, v.kind, v.n, typeof v.acceptedImportFindingsNote === 'string' ? v.acceptedImportFindingsNote : '')}</td>` +
16571
+ `<td>${gateBadge(v.gate, v.kind, v.n, typeof v.acceptedImportFindingsNote === 'string' ? v.acceptedImportFindingsNote : '')}${quickPillHtml(v.quick, { scope: `v${v.n}` })}</td>` +
16326
16572
  `<td class="change">${revisionNoteHtml(v)}${changeCellHtml(v, meta)}${diffStatus}</td>` +
16327
16573
  `<td>${action}</td></tr>`;
16328
16574
  // The disclosure row is always emitted (hidden) so toggling is a pure show/hide + lazy fetch.
@@ -16355,7 +16601,7 @@
16355
16601
  const resume = allowed.includes('resume')
16356
16602
  ? `<button type="button" class="btn-mini" data-resume-checkpoint="${escapeAttr(String(saved.id))}" data-tip="Switch the working copy to this exact saved checkpoint">Resume exact checkpoint</button>`
16357
16603
  : '';
16358
- return `<article class="saved-work-card"><div><b>${escapeHtml(base)}</b><span>${escapeHtml(histWhen(saved.capturedAt))} · ${escapeHtml(String(saved.id || '').slice(0, 8))}</span></div>`
16604
+ return `<article class="saved-work-card"><div><b>${escapeHtml(base)}</b>${quickPillHtml(saved.quick, { scope: 'This checkpoint' })}<span>${escapeHtml(histWhen(saved.capturedAt))} · ${escapeHtml(String(saved.id || '').slice(0, 8))}</span></div>`
16359
16605
  + `<p>This checkpoint stays attached to its original approved base; it is never applied backward into another revision.</p>${resume}</article>`;
16360
16606
  }).join('')}</div>`;
16361
16607
  }
@@ -16808,10 +17054,18 @@
16808
17054
  wrap.appendChild(btn);
16809
17055
  return wrap;
16810
17056
  }
16811
- function renderDiffPanel(panel, diff) {
17057
+ function renderDiffPanel(panel, diff, quick) {
16812
17058
  panel.textContent = '';
16813
17059
  panel.appendChild(diffBasePicker(diff));
16814
17060
  for (const c of diffCautions(diff.warnings)) panel.appendChild(c); // above the numbers — context for reading them
17061
+ // #2521 row 5: each side says what IT rests on, above the tonnage, so a Quick side never reads as precise.
17062
+ const sides = quick ? [[quick.from, `v${diff.from}`], [quick.to, `v${diff.to}`]].filter(([q]) => quickPillHtml(q)) : [];
17063
+ if (sides.length) {
17064
+ const note = el('div', 'hd-quick');
17065
+ note.setAttribute('role', 'note');
17066
+ note.innerHTML = sides.map(([q, scope]) => quickPillHtml(q, { scope, showScope: true })).join(' ');
17067
+ panel.appendChild(note);
17068
+ }
16815
17069
  panel.appendChild(diffNetHeader(diff.tonnage));
16816
17070
  let any = false;
16817
17071
  for (const g of DIFF_GROUPS) {
@@ -16926,7 +17180,8 @@
16926
17180
  // and server ship together, so that window is a half-finished upgrade, not a supported state.
16927
17181
  if (!hasStatus && legacyUnreadableDiff(response.diff)) return { kind: 'unavailable' };
16928
17182
  if (!wellFormedDiff(response.diff)) throw new Error('invalid comparison response');
16929
- return { kind: 'available', diff: response.diff };
17183
+ return response.quick && typeof response.quick === 'object'
17184
+ ? { kind: 'available', diff: response.diff, quick: response.quick } : { kind: 'available', diff: response.diff };
16930
17185
  }
16931
17186
  function restoreDiffFocus(panel, n) {
16932
17187
  const target = panel.querySelector('.hd-base')
@@ -16989,7 +17244,7 @@
16989
17244
  panel.setAttribute('aria-busy', 'false');
16990
17245
  if (progress) progress.textContent = '';
16991
17246
  if (decoded.kind === 'unavailable') renderDiffUnavailable(panel);
16992
- else renderDiffPanel(panel, decoded.diff);
17247
+ else renderDiffPanel(panel, decoded.diff, decoded.quick);
16993
17248
  if (opts && opts.restoreBaseFocus) restoreDiffFocus(panel, n);
16994
17249
  }
16995
17250
  function toggleDiff(btn) {
@@ -17410,11 +17665,11 @@
17410
17665
  showToast(`Renamed to "${project.name}"`, 'ok');
17411
17666
  } else if (action === 'duplicate') {
17412
17667
  dismissProgress = showToast(`Duplicating “${proj ? proj.name : 'project'}”…`, 'progress');
17413
- const { project, rfiTransfer } = await api(`/api/projects/${encodeURIComponent(id)}/duplicate`, { method: 'POST', body: '{}' });
17668
+ const { project, rfiTransfer, workflowTransfer, correspondenceTransfer } = await api(`/api/projects/${encodeURIComponent(id)}/duplicate`, { method: 'POST', body: '{}' });
17414
17669
  projects.unshift(project); // newest → front, matching the server's newest-first list order
17415
17670
  renderLanding();
17416
17671
  flashCard(project.id, { scroll: true });
17417
- const resultToast = formatRfiTransferToast(rfiTransfer, 'duplicate', project.name, true);
17672
+ const resultToast = withWorkflowTransfer(formatRfiTransferToast(rfiTransfer, 'duplicate', project.name, true), workflowTransfer, 'duplicate', correspondenceTransfer);
17418
17673
  finishProgress();
17419
17674
  showToast(resultToast.message, resultToast.tone);
17420
17675
  } else if (action === 'clear-unverified') {
@@ -17594,14 +17849,14 @@
17594
17849
  };
17595
17850
  try {
17596
17851
  const buf = await file.arrayBuffer();
17597
- const { project, appInstalled, rfiTransfer, leftOut } = await api('/api/projects/import', {
17852
+ const { project, appInstalled, rfiTransfer, leftOut, workflowTransfer, correspondenceTransfer } = await api('/api/projects/import', {
17598
17853
  method: 'POST', headers: { 'content-type': 'application/zip' }, body: buf,
17599
17854
  });
17600
17855
  projects.unshift(project); // newest → front, matching duplicate/create
17601
17856
  renderLanding();
17602
17857
  flashCard(project.id, { scroll: true });
17603
17858
  track('workspace_project_imported', { app: project.app });
17604
- const resultToast = formatRfiTransferToast(rfiTransfer, 'import', project.name, appInstalled);
17859
+ const resultToast = withWorkflowTransfer(formatRfiTransferToast(rfiTransfer, 'import', project.name, appInstalled), workflowTransfer, 'import', correspondenceTransfer);
17605
17860
  const leftOutNote = importLeftOutNote(leftOut, project.name);
17606
17861
  finishProgress();
17607
17862
  showToast(leftOutNote.skipped ? `${resultToast.message} ${leftOutNote.skipped}` : resultToast.message, resultToast.tone);
@@ -17619,6 +17874,18 @@
17619
17874
  // - zipped mid-save → a persistent warning: the copy may miss that save or hold part of it;
17620
17875
  // - saved checkpoints / undo steps → a persistent warning: those stay on the source computer;
17621
17876
  // - anything else is set up fresh here → one quiet sentence on the success toast.
17877
+ /**
17878
+ * #2603: a Duplicate or Import toast also says what happened to the project's workflows (project-workflows.js writes
17879
+ * the sentence). Reached through globalThis, so a harness that lifts the callers without that module still runs.
17880
+ */
17881
+ function withWorkflowTransfer(toast, workflowTransfer, operation = 'duplicate', correspondenceTransfer = undefined) {
17882
+ // #2470 R6.6: and what happened to a General project's RFIs (project-rfis.js writes that sentence).
17883
+ const notes = [globalThis.flolessProjectWorkflows?.transferNote?.(workflowTransfer, operation) ?? null,
17884
+ globalThis.flolessProjectRfis?.transferNote?.(correspondenceTransfer, operation) ?? null].filter(Boolean);
17885
+ if (!notes.length) return toast;
17886
+ return { message: `${toast.message} ${notes.map((n) => n.text).join(' ')}`, tone: notes.some((n) => n.warn) && toast.tone === 'ok' ? 'warn' : toast.tone };
17887
+ }
17888
+
17622
17889
  function importLeftOutNote(leftOut, projectName) {
17623
17890
  const files = leftOut && Array.isArray(leftOut.files) ? leftOut.files.length : 0;
17624
17891
  if (!files) return { skipped: '', warning: '' };
@@ -17869,6 +18136,59 @@
17869
18136
  if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
17870
18137
  }
17871
18138
 
18139
+ // #2470 R6.2: a project's Workflows step, where the workflows it owns are listed (Project access links here).
18140
+ // #2470 R6.7: the create cards a General project's Add a module sheet shows — the landing's own entries and markup,
18141
+ // minus General, so every lock, setup and remedy state reads exactly as it does on the landing.
18142
+ function moduleCreateCardsHtml() {
18143
+ return workspaceCreateEntries(wsAppEntries)
18144
+ .filter(({ entry }) => entry.templateId !== 'floless-general')
18145
+ .map(({ entry, action }) => workspaceCreateCardHtml(entry, action))
18146
+ .join('');
18147
+ }
18148
+
18149
+ /** A click on a card in the Add a module sheet: the card's remedy, or its own create flow carrying `linkFrom`. */
18150
+ function activateCreateCard(target, linkFrom) {
18151
+ const remedy = createCardRemedy(target);
18152
+ if (remedy) return { kind: 'remedy', done: remedy() };
18153
+ const seed = target?.closest?.('[data-seed-app]');
18154
+ if (!seed) return null;
18155
+ return { kind: 'create', done: activateSeedCard(seed, linkFrom) };
18156
+ }
18157
+
18158
+ /** Open a project by id, from another project's Modules step: the same open a card on the landing does. */
18159
+ async function openLinkedProject(projectId) {
18160
+ await setMode('workspaces');
18161
+ const opened = await openProject(projectId);
18162
+ if (opened === STAYED_IN_PROJECT) throw new Error('You stayed in this project, so the other one was not opened.');
18163
+ if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
18164
+ }
18165
+
18166
+ /** A General project's Modules step: where Back to … after an Add a module returns to. */
18167
+ async function openModulesStep(projectId) {
18168
+ await setMode('workspaces');
18169
+ const opened = await openProject(projectId, 'modules');
18170
+ if (opened === STAYED_IN_PROJECT) throw new Error('You stayed in this project, so the other one was not opened.');
18171
+ if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
18172
+ }
18173
+
18174
+ /** Show the archived projects on the Workspaces page, where Restore is, with this one in view. */
18175
+ async function showArchivedProjects(returnFocus) {
18176
+ await setMode('workspaces');
18177
+ if (current) await leaveProjectToList(returnFocus);
18178
+ if (current) return false;
18179
+ const archived = $landing.querySelector('.ws-archived');
18180
+ if (archived) { archived.open = true; archived.scrollIntoView?.({ block: 'nearest' }); archived.querySelector('summary')?.focus?.(); }
18181
+ return true;
18182
+ }
18183
+
18184
+ async function openWorkflowsStep(projectId) {
18185
+ if (typeof projectId !== 'string' || !projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
18186
+ await setMode('workspaces');
18187
+ const opened = await openProject(projectId, 'workflows');
18188
+ if (opened === STAYED_IN_PROJECT) throw new Error('You stayed in this project, so the other one was not opened.');
18189
+ if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
18190
+ }
18191
+
17872
18192
  // The Drawing Filter step of a project, where a drawing read's exclusions are saved and signed off.
17873
18193
  async function openDrawingsStep(projectId) {
17874
18194
  if (typeof projectId !== 'string' || !projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
@@ -17957,6 +18277,10 @@
17957
18277
  const citedElsewhere = () => validId(target.projectUuid) && String(current?.uuid || '').toLowerCase() !== target.projectUuid.toLowerCase();
17958
18278
  const citedGone = () => connectionError(`This project is no longer the one the answer cited, so the ${thing} was not shown.`);
17959
18279
  let until = Infinity;
18280
+ // #2605: the document the model frame held before this call opened the project. Left for the Workspaces list,
18281
+ // a project's editor page stays in the hidden frame, and openProject's reset of it lands only later: until
18282
+ // then that page still answers to the project id, and a request handed to it dies with the reload.
18283
+ let pageLeftBehind = null;
17960
18284
  // Everything that ends this call's wait without the editor's answer.
17961
18285
  const interrupted = () => {
17962
18286
  if (superseded()) return { superseded: true };
@@ -17975,6 +18299,7 @@
17975
18299
  // setMode leaves the person where they were when they chose to stay (an Agent with unsaved changes).
17976
18300
  if (mode !== 'workspaces') throw stayedOutside();
17977
18301
  if (current?.id !== target.projectId) {
18302
+ try { pageLeftBehind = frames.model.contentWindow?.document ?? null; } catch { pageLeftBehind = null; }
17978
18303
  const opened = await navigating(openProject(target.projectId, 'model', { stillWanted }), true);
17979
18304
  if (opened?.superseded || superseded()) return { superseded: true };
17980
18305
  // openProject answers "stayed" for several causes (the person chose to stay, the project's folder is
@@ -18007,7 +18332,8 @@
18007
18332
  const child = frames.model.contentWindow;
18008
18333
  if (!answer) {
18009
18334
  const state = child && child.flolessEditorState;
18010
- if (state && state.project === target.projectId && typeof child.flolessEditorFocus === 'function') {
18335
+ if (state && state.project === target.projectId && typeof child.flolessEditorFocus === 'function'
18336
+ && (!pageLeftBehind || child.document !== pageLeftBehind)) {
18011
18337
  if (citedElsewhere()) throw citedGone();
18012
18338
  // The frame's window survives a reload; its DOCUMENT does not. That is what tells a reload apart.
18013
18339
  page = child; doc = child.document;
@@ -18088,9 +18414,11 @@
18088
18414
  async function folderDecisionCompleted(result, operation) {
18089
18415
  const project = result.project;
18090
18416
  if (operation === 'import') {
18091
- const toast = formatRfiTransferToast(result.rfiTransfer, 'import', project.name, result.appInstalled);
18417
+ const toast = withWorkflowTransfer(formatRfiTransferToast(result.rfiTransfer, 'import', project.name, result.appInstalled), result.workflowTransfer, 'import', result.correspondenceTransfer);
18418
+ // importLeftOutNote answers { skipped, warning } (it used to be appended whole, as "[object Object]").
18092
18419
  const leftOut = importLeftOutNote(result.leftOut, project.name);
18093
- showToast(toast.message + (leftOut ? ` ${leftOut}` : ''), leftOut ? 'warn' : toast.tone);
18420
+ showToast(leftOut.skipped ? `${toast.message} ${leftOut.skipped}` : toast.message, toast.tone);
18421
+ if (leftOut.warning) showToast(leftOut.warning, 'warn', { persistent: true });
18094
18422
  } else showToast(`Project folder updated for “${project.name}”.`, 'ok');
18095
18423
  await loadProjects({ quiet: true });
18096
18424
  flashCard(project.id, { scroll: true });
@@ -18236,10 +18564,14 @@
18236
18564
  tellModelFrame({ type: 'knowledge-changed', projectId });
18237
18565
  },
18238
18566
  setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind,
18239
- openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, openDrawingsStep, openConnection, drawingFilterCheckpointSaved,
18567
+ openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, openDrawingsStep, openWorkflowsStep, openConnection, drawingFilterCheckpointSaved,
18568
+ // #2470 R6.7: the Modules step of a General project (project-modules.js).
18569
+ moduleCreateCardsHtml, activateCreateCard, openLinkedProject, openModulesStep, showArchivedProjects,
18240
18570
  syncWorkspaceReporter, openChatOwner, openPagesHome, folderDecisionCompleted,
18241
18571
  // Project access (project-access.js loads after this file): the project open now, or null.
18242
18572
  currentProject: () => ($app.classList.contains('mode-workspaces') && current ? current : null),
18573
+ // #2470 R6.2: whether the open project's kind has this step (a General project has Workflows; the others not yet).
18574
+ projectHasStep: (key) => Boolean(current && wsDescOf(current)?.steps?.some((st) => st.key === key)),
18243
18575
  };
18244
18576
  applyMode(); // restore persisted mode immediately (matches panels.js applyView timing)
18245
18577
  })();