@floless/app 0.158.0 → 0.159.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 (35) hide show
  1. package/dist/floless-server.cjs +92620 -75445
  2. package/dist/schemas/drawing-check.profile.v1.schema.json +33 -1
  3. package/dist/skills/floless-app-actions/SKILL.md +23 -5
  4. package/dist/skills/floless-app-bridge/SKILL.md +5 -3
  5. package/dist/skills/floless-app-onboarding/SKILL.md +67 -4
  6. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +7 -4
  7. package/dist/skills/floless-app-queue/SKILL.md +3 -1
  8. package/dist/skills/floless-app-steel-model/SKILL.md +11 -5
  9. package/dist/skills/floless-app-steel-takeoff/SKILL.md +28 -8
  10. package/dist/skills/floless-app-workflows/SKILL.md +6 -3
  11. package/dist/web/agents.js +12 -5
  12. package/dist/web/app.css +87 -13
  13. package/dist/web/app.js +6 -0
  14. package/dist/web/aware.js +29 -4
  15. package/dist/web/chat.css +42 -22
  16. package/dist/web/chat.js +181 -30
  17. package/dist/web/commands-shell.js +305 -4
  18. package/dist/web/commands-steel.js +1 -0
  19. package/dist/web/drawing-check-editor.html +10 -0
  20. package/dist/web/drawing-check-editor.js +44 -0
  21. package/dist/web/guide.js +4 -2
  22. package/dist/web/index.html +41 -9
  23. package/dist/web/instructor.js +20 -8
  24. package/dist/web/pages.js +71 -13
  25. package/dist/web/project-access.js +67 -8
  26. package/dist/web/project-modules.js +474 -0
  27. package/dist/web/project-workflows.js +274 -0
  28. package/dist/web/steel-3d-core.js +46 -0
  29. package/dist/web/steel-3d-view.js +8 -38
  30. package/dist/web/steel-editor.html +192 -49
  31. package/dist/web/workspace-root-recovery.js +119 -0
  32. package/dist/web/workspaces.js +358 -114
  33. package/launch-starting-page.mjs +5 -2
  34. package/launch.mjs +136 -78
  35. package/package.json +5 -1
@@ -757,6 +757,25 @@
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
+ 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. Steel models already on this computer stay viewable.',
768
+ action: 'See plans', aria: 'Steel Model is not in your plan — see plans on floless.io (opens in a new tab)',
769
+ },
770
+ 'account-selection-required': {
771
+ status: 'Choose an account', body: 'Choose which FloLess account to use for Steel Model.',
772
+ action: 'Choose account', aria: 'Choose a FloLess account for Steel Model',
773
+ },
774
+ 'check-unavailable': {
775
+ status: 'Couldn’t check access', body: 'FloLess couldn’t verify Steel Model access. Existing projects were not changed.',
776
+ action: 'Check again', aria: 'Steel Model access check unavailable — check again',
777
+ },
778
+ },
760
779
  editor: '/steel-editor.html',
761
780
  filter: '/steel-filter.html',
762
781
  steps: [
@@ -994,6 +1013,8 @@
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: 'modules', label: 'Modules' }, // #2470 R6.7: the module projects linked to this one
997
1018
  ],
998
1019
  diff: false,
999
1020
  exports: [],
@@ -1092,7 +1113,8 @@
1092
1113
  for (const capability of capabilities || []) {
1093
1114
  if (!capability || typeof capability.templateId !== 'string'
1094
1115
  || capability.appId !== capability.templateId
1095
- || WORKSPACE_APPS[capability.templateId]?.serverAuthorizedOnly !== true) continue;
1116
+ || (WORKSPACE_APPS[capability.templateId]?.serverAuthorizedOnly !== true
1117
+ && WORKSPACE_APPS[capability.templateId]?.moduleGated !== true)) continue;
1096
1118
  const known = ['ready', 'access-required', 'account-selection-required', 'setup-provisioning', 'setup-unavailable', 'setup-integrity-failure', 'setup-repair-required', 'check-unavailable'];
1097
1119
  capabilityByRoot.set(capability.templateId, known.includes(capability.status) ? capability.status : 'check-unavailable');
1098
1120
  if (capability.setupChoice === true && ['tekla-parser', 'revit-model'].includes(capability.templateId)) setupChoiceByRoot.add(capability.templateId);
@@ -1101,6 +1123,9 @@
1101
1123
  }
1102
1124
  // A capability row exists only after the server positively found the canonical module. Add
1103
1125
  // its presentation entry even when authorization intentionally filtered it out of `apps`.
1126
+ // A module-gated card's `ready` row says the account may use it, not that its workflow is installed:
1127
+ // that stays the core-defaults check below, so a missing workflow still reads "Needs setup".
1128
+ if (WORKSPACE_APPS[capability.templateId]?.moduleGated === true && capabilityByRoot.get(capability.templateId) === 'ready') continue;
1104
1129
  if (!byRoot.has(capability.templateId)) byRoot.set(capability.templateId, [capability.templateId]);
1105
1130
  }
1106
1131
  // Keep the two built-in drawing actions visible when only one workflow is installed.
@@ -1787,6 +1812,9 @@
1787
1812
  closeProjMenu();
1788
1813
  if (deferIfBusy()) return;
1789
1814
  renderLanding();
1815
+ // #2470 R6.7: an open Add a module sheet shows the same cards; it repaints too. A direct optional call, not a DOM
1816
+ // event: the harnesses that lift this function have no CustomEvent.
1817
+ globalThis.flolessProjectModules?.cardsChanged?.();
1790
1818
  }
1791
1819
  }
1792
1820
 
@@ -2450,7 +2478,8 @@
2450
2478
  `<span class="ws-seed-action">Why unavailable →</span>` +
2451
2479
  `</button>`;
2452
2480
  }
2453
- if (descriptor?.serverAuthorizedOnly === true && entry.capabilityStatus && entry.capabilityStatus !== 'ready') {
2481
+ if ((descriptor?.serverAuthorizedOnly === true || descriptor?.moduleGated === true)
2482
+ && entry.capabilityStatus && entry.capabilityStatus !== 'ready') {
2454
2483
  const revitStates = {
2455
2484
  'access-required': {
2456
2485
  status: 'Access required',
@@ -2506,6 +2535,10 @@
2506
2535
  const drawingCheckCommand = ['setup-unavailable', 'setup-integrity-failure'].includes(entry.capabilityStatus)
2507
2536
  ? 'data-command-id="shell.drawing-check-retry-setup"'
2508
2537
  : 'data-command-id="shell.drawing-check-view-access"';
2538
+ // Steel Model is bought, not enabled by an owner: its lock leads to the plans page.
2539
+ const steelModelCommand = entry.capabilityStatus === 'access-required'
2540
+ ? 'data-command-id="shell.steel-model-see-plans"'
2541
+ : 'data-command-id="shell.steel-model-view-access"';
2509
2542
  const remedyState = escapeAttr(entry.capabilityStatus || 'check-unavailable');
2510
2543
  return `<${actionable ? 'button type="button"' : 'div'} class="ws-seed ws-seed-remedy" ` +
2511
2544
  `aria-label="${escapeAttr(state.aria)}" aria-describedby="${escapeAttr(descriptionId)}" ` +
@@ -2516,6 +2549,8 @@
2516
2549
  ? `${revitCommand} data-revit-remedy="${remedyState}"`
2517
2550
  : entry.templateId === 'drawing-check'
2518
2551
  ? `${drawingCheckCommand} data-module-remedy="drawing-check" data-module-remedy-state="${remedyState}"`
2552
+ : entry.templateId === 'steel-model'
2553
+ ? `${steelModelCommand} data-module-remedy="steel-model" data-module-remedy-state="${remedyState}"`
2519
2554
  : `${teklaCommand} data-module-remedy="tekla-parser" data-module-remedy-state="${remedyState}"` : '') + `>` +
2520
2555
  seedIcon('!') +
2521
2556
  `<span class="ws-seed-headline">${escapeHtml(descriptor.displayName)}</span>` +
@@ -3019,45 +3054,37 @@
3019
3054
  window.dispatchEvent(new CustomEvent('floless:open-drawing-check-access', { detail: { state } }));
3020
3055
  }
3021
3056
 
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();
3057
+ /**
3058
+ * The locked Steel Model card's remedies. Not in the plan: the floless.io plans page, where the person adds
3059
+ * it. Account choice and access checks go to the shell's account gate under Steel Model's name.
3060
+ */
3061
+ function runSteelModelRemedy(remedy) {
3062
+ const state = remedy.dataset.moduleRemedyState;
3063
+ if (state === 'access-required') {
3064
+ window.open('https://floless.io/pricing', '_blank', 'noopener'); // the same plans page pages.js links
3052
3065
  return;
3053
3066
  }
3054
- if (e.target.closest('#ws-import-project')) { importProject(); return; }
3055
- const parserSetup = e.target.closest('[data-parser-setup]');
3067
+ window.dispatchEvent(new CustomEvent('floless:open-steel-model-access', { detail: { state } }));
3068
+ }
3069
+
3070
+
3071
+ // ── create cards, shared by the landing and Add a module (#2470 R6.7) ────────────────────────────────────────
3072
+ // A create card behaves the same wherever it is shown: the Workspaces landing, or a General project's Add a module
3073
+ // sheet. There, `linkFrom` names the General project the new one is linked to (spec §6.2); the landing passes none.
3074
+
3075
+ /** 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. */
3076
+ function createCardRemedy(target) {
3077
+ if (!target?.closest?.('[data-parser-setup], [data-revit-remedy], [data-module-remedy]')) return null;
3078
+ return () => runCreateCardRemedy(target);
3079
+ }
3080
+
3081
+ async function runCreateCardRemedy(target) {
3082
+ const parserSetup = target.closest('[data-parser-setup]');
3056
3083
  if (parserSetup) {
3057
3084
  window.flolessParserSetupRecovery?.open(parserSetup.dataset.parserSetup, parserSetup);
3058
3085
  return;
3059
3086
  }
3060
- const revitRemedy = e.target.closest('[data-revit-remedy]');
3087
+ const revitRemedy = target.closest('[data-revit-remedy]');
3061
3088
  if (revitRemedy) {
3062
3089
  if (revitRemedy.dataset.revitRemedy === 'report-issue') {
3063
3090
  window.dispatchEvent(new CustomEvent('floless:report-revit-setup-issue', {
@@ -3150,11 +3177,15 @@
3150
3177
  }));
3151
3178
  return;
3152
3179
  }
3153
- const moduleRemedy = e.target.closest('[data-module-remedy]');
3180
+ const moduleRemedy = target.closest('[data-module-remedy]');
3154
3181
  if (moduleRemedy && moduleRemedy.dataset.moduleRemedy === 'drawing-check') {
3155
3182
  await runDrawingCheckRemedy(moduleRemedy);
3156
3183
  return;
3157
3184
  }
3185
+ if (moduleRemedy && moduleRemedy.dataset.moduleRemedy === 'steel-model') {
3186
+ runSteelModelRemedy(moduleRemedy);
3187
+ return;
3188
+ }
3158
3189
  if (moduleRemedy) {
3159
3190
  if (moduleRemedy.dataset.moduleRemedyState === 'setup-provisioning') return;
3160
3191
  if (moduleRemedy.dataset.moduleRemedyState === 'setup-integrity-failure') {
@@ -3239,52 +3270,95 @@
3239
3270
  }));
3240
3271
  return;
3241
3272
  }
3273
+ }
3274
+
3275
+ /**
3276
+ * Start a create card's own flow. Called straight from the click, with nothing awaited first, so the native file
3277
+ * picker it may open still counts as the person's own gesture.
3278
+ */
3279
+ async function activateSeedCard(seed, linkFrom = null) {
3280
+ // Two ids, and they are not interchangeable: create on the LIVE app (`seed-app`), but look the
3281
+ // descriptor up by its lineage ROOT (`seed-template`) — after a rename the live id answers to no
3282
+ // descriptor, and the built-in id answers to no installed app.
3283
+ const appId = seed.dataset.seedApp;
3284
+ const templateId = seed.dataset.seedTemplate || appId;
3285
+ if (!WORKSPACE_APPS[templateId]) return;
3286
+ // Each create kind has its own branch below. The 'drawing' check stays a check rather than an
3287
+ // assumption: a future kind must declare its own branch, not silently inherit the file picker.
3288
+ if (seed.dataset.seedAction === 'drawing') {
3289
+ if (workspaceWorkflowKnownMissing(appId)) {
3290
+ showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
3291
+ return;
3292
+ }
3293
+ let files;
3294
+ try { files = await pickDrawingFiles($seedFile, templateId); } // keep native picker in the click activation
3295
+ catch { showToast('Couldn’t open the drawing picker. Try again.', 'warn'); return; }
3296
+ if (!files.length) return;
3297
+ if (workspaceWorkflowKnownMissing(appId)) {
3298
+ showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
3299
+ return;
3300
+ }
3301
+ createFromDrawing(appId, templateId, files, { linkFrom });
3302
+ } else if (seed.dataset.seedAction === 'rvt') {
3303
+ const file = await pickRvtFile($seedRvt);
3304
+ if (file) createFromRvt(appId, templateId, file, linkFrom);
3305
+ } else if (seed.dataset.seedAction === 'tekla-source') {
3306
+ openTeklaSourceChoice(appId, templateId, seed, null, linkFrom);
3307
+ } else if (seed.dataset.seedAction === 'drawing-check-profile') {
3308
+ // A client profile starts empty: the reference drawings are added on its own page, where
3309
+ // their page counts and the proposed checklist can be shown. The setup dialog asks only the
3310
+ // folder and the client's name.
3311
+ createFromDrawing(appId, templateId, [], { kind: 'drawing-check-profile', sourceLabel: 'Client profile', returnFocus: seed, linkFrom });
3312
+ } else if (seed.dataset.seedAction === 'general-project') {
3313
+ // A General project starts from nothing but its name and folder (#2470).
3314
+ createFromDrawing(appId, templateId, [], { kind: 'general-project', sourceLabel: 'Blank project', returnFocus: seed });
3315
+ } else {
3316
+ // Unreachable today, and it must not be SILENT the day it isn't: an unhandled kind still
3317
+ // renders a full dashed, focusable card, so without this the first person to add one gets a
3318
+ // control that does nothing and says nothing. A dead control is no better than a missing one.
3319
+ console.warn(`[workspaces] create action "${seed.dataset.seedAction}" has no handler — the card does nothing`);
3320
+ }
3321
+ }
3322
+
3323
+ $landing.addEventListener('click', async (e) => {
3324
+ const registrationReview = e.target.closest('[data-project-registration-review]');
3325
+ if (registrationReview) { window.flolessProjectReconciliation?.openRegistration(registrationReview.dataset.projectRegistrationReview); return; }
3326
+ const groupToggle = e.target.closest('[data-project-group-toggle]');
3327
+ if (groupToggle) {
3328
+ const expanded = groupToggle.getAttribute('aria-expanded') !== 'true';
3329
+ const key = groupToggle.dataset.projectGroupToggle;
3330
+ if (landingQuery.trim()) projectGroupSearchOverrides.set(key, expanded);
3331
+ else saveProjectGroupExpanded(key, expanded);
3332
+ showProjectGroup(groupToggle.closest('.ws-project-section'), expanded);
3333
+ if (expanded) tipTruncatedNames();
3334
+ e.stopPropagation();
3335
+ return;
3336
+ }
3337
+ const kebab = e.target.closest('[data-kebab]');
3338
+ if (kebab) { e.stopPropagation(); openProjMenu(kebab.dataset.kebab, kebab); return; }
3339
+ // Before the card's own [data-open] branch below, exactly like the kebab: the thumbnail is the one
3340
+ // region of the card that does something other than open the project.
3341
+ const thumb = e.target.closest('[data-thumb]');
3342
+ if (thumb) { e.stopPropagation(); openThumbView(thumb.dataset.thumb, thumb); return; }
3343
+ const restore = e.target.closest('[data-restore]');
3344
+ if (restore) { e.stopPropagation(); unarchiveProject(restore.dataset.restore); return; }
3345
+ const del = e.target.closest('[data-delete-archived]');
3346
+ if (del) { e.stopPropagation(); deleteArchivedProject(del.dataset.deleteArchived); return; }
3347
+ if (e.target.closest('#ws-retry-projects')) { e.stopPropagation(); retryProjects(); return; }
3348
+ // Clearing empties the message the button sits in, so focus goes back to the search box.
3349
+ if (e.target.closest('#ws-search-clear')) { setLandingQuery(''); $landing.querySelector('#ws-landing-search')?.focus(); return; }
3350
+ if (e.target.closest('#ws-workspace-folder')) {
3351
+ e.stopPropagation();
3352
+ if (window.flolessWorkspaceRoot) window.flolessWorkspaceRoot.open();
3353
+ return;
3354
+ }
3355
+ if (e.target.closest('#ws-import-project')) { importProject(); return; }
3356
+ const remedy = createCardRemedy(e.target);
3357
+ if (remedy) { await remedy(); return; }
3242
3358
  const card = e.target.closest('[data-open]');
3243
3359
  if (card) { openProject(card.dataset.open); return; }
3244
3360
  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
- }
3361
+ if (seed) await activateSeedCard(seed);
3288
3362
  });
3289
3363
  $landing.addEventListener('input', (e) => {
3290
3364
  if (e.target.id !== 'ws-landing-search') return;
@@ -3349,9 +3423,9 @@
3349
3423
  $teklaSourceStatus.hidden = !message;
3350
3424
  }
3351
3425
  }
3352
- function openTeklaSourceChoice(appId, templateId, returnFocus, onPicked = null) {
3426
+ function openTeklaSourceChoice(appId, templateId, returnFocus, onPicked = null, linkFrom = null) {
3353
3427
  if (!$teklaSourceModal || teklaSourceChoice) return;
3354
- teklaSourceChoice = { appId, templateId, returnFocus, onPicked };
3428
+ teklaSourceChoice = { appId, templateId, returnFocus, onPicked, linkFrom };
3355
3429
  setTeklaSourcePicking(false);
3356
3430
  $teklaSourceModal.classList.add('show');
3357
3431
  $teklaSourceDialog?.focus();
@@ -3377,7 +3451,7 @@
3377
3451
  await choice.onPicked(source);
3378
3452
  return;
3379
3453
  }
3380
- const opened = await createFromTeklaSource(choice.appId, choice.templateId, source, choice.returnFocus);
3454
+ const opened = await createFromTeklaSource(choice.appId, choice.templateId, source, choice.returnFocus, choice.linkFrom);
3381
3455
  if (opened && teklaSourceChoice === choice) closeTeklaSourceChoice(false);
3382
3456
  else if (teklaSourceChoice === choice) setTeklaSourcePicking(false,
3383
3457
  'FloLess could not open project setup. Close any other setup window, then choose the source again.');
@@ -3741,6 +3815,7 @@
3741
3815
  const $projectSetupStandard = document.getElementById('project-setup-standard');
3742
3816
  const $projectSetupError = document.getElementById('project-setup-error');
3743
3817
  const $projectSetupProvider = document.getElementById('project-setup-provider');
3818
+ const $projectSetupKickoffNote = document.getElementById('project-setup-kickoff-note');
3744
3819
  const $projectSetupCancel = document.getElementById('project-setup-cancel');
3745
3820
  const $projectSetupCreateOnly = document.getElementById('project-setup-create-only');
3746
3821
  const $projectSetupCreate = document.getElementById('project-setup-create');
@@ -3836,7 +3911,7 @@
3836
3911
  $projectSetupCreate.textContent = label || 'Create project & start chat';
3837
3912
  $projectSetupCreateOnly.textContent = busy && !projectSetupState.settingUp
3838
3913
  ? 'Creating…'
3839
- : (NO_CHAT_SETUP_KINDS.includes(projectSetupState.kind) ? 'Create project' : 'Create project only');
3914
+ : projectSetupState.linkFrom ? 'Create project' : createOnlyLabel(projectSetupState.kind);
3840
3915
  if (!busy) {
3841
3916
  $projectSetupCreate.disabled = !projectSetupReady();
3842
3917
  $projectSetupCreateOnly.disabled = !projectSetupReady();
@@ -3858,13 +3933,18 @@
3858
3933
  // Every answer is checked against what can start now: preferredChatProvider() prefers the open
3859
3934
  // conversation's AI, which may since have been uninstalled, and a choice that cannot start must
3860
3935
  // 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'];
3936
+ // Setup kinds that create a project only — no AI Chat intake. The two model sources are read by
3937
+ // FloLess itself; a Drawing Checker profile starts empty and is built on its page. A General project
3938
+ // does start a chat: Flo's kickoff (#2470 R6.4).
3939
+ const NO_CHAT_SETUP_KINDS = ['rvt', 'tekla-source', 'drawing-check-profile'];
3940
+ // Setup kinds whose Create project makes no drawing-intake task: no drawings are read to start them.
3941
+ const NO_DRAWING_TASK_KINDS = ['rvt', 'tekla-source', 'drawing-check-profile', 'general-project'];
3942
+ // The secondary button says what it leaves out whenever a start-chat button sits beside it.
3943
+ const createOnlyLabel = (kind) => (NO_CHAT_SETUP_KINDS.includes(kind) ? 'Create project' : 'Create project only');
3864
3944
  // Setup kinds that start from no file at all: a Drawing Checker profile and a General project.
3865
3945
  const NO_FILE_SETUP_KINDS = ['drawing-check-profile', 'general-project'];
3866
3946
  function projectSetupProvider(state) {
3867
- if (!state || NO_CHAT_SETUP_KINDS.includes(state.kind)) return null;
3947
+ if (!state || NO_CHAT_SETUP_KINDS.includes(state.kind) || state.linkFrom) return null;
3868
3948
  const runtimes = bridge.chatProviderRuntimes?.() || [];
3869
3949
  const readiness = (id) => (id ? projectSetupProviderReadiness(runtimes.find((runtime) => runtime.id === id)) : 'unavailable');
3870
3950
  const canStart = (id) => readiness(id) !== 'unavailable';
@@ -3985,6 +4065,7 @@
3985
4065
  const provider = projectSetupProvider(state);
3986
4066
  paintProjectSetupProviders(state, provider);
3987
4067
  $projectSetupCreate.hidden = !provider;
4068
+ if ($projectSetupKickoffNote) $projectSetupKickoffNote.hidden = state.kind !== 'general-project';
3988
4069
  $projectSetupCreateOnly.classList.toggle('primary', !provider);
3989
4070
  $projectSetupTitle.textContent = `New ${descDisplayName(state.templateId)} project`;
3990
4071
  $projectSetupSourceName.textContent = state.sourceLabel || state.files[0]?.name || (state.kind === 'rvt' ? 'Revit model' : 'Drawing set');
@@ -3992,7 +4073,7 @@
3992
4073
  const $sourceKicker = $projectSetupSourceName.previousElementSibling;
3993
4074
  if ($sourceKicker) $sourceKicker.textContent = state.kind === 'general-project' ? 'Starting point' : 'Source';
3994
4075
  $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');
4076
+ $projectSetupCreateOnly.textContent = state.busy ? 'Creating…' : state.linkFrom ? 'Create project' : createOnlyLabel(state.kind);
3996
4077
  $projectSetupSourceCount.textContent = state.files.length > 1 ? `+ ${state.files.length - 1} more` : '';
3997
4078
  $projectSetupFolder.textContent = state.directory
3998
4079
  ? state.directory.path
@@ -4109,19 +4190,33 @@
4109
4190
  app: state.appId,
4110
4191
  ...(state.askCatalogue ? { environment: state.environment } : {}),
4111
4192
  directorySelectionId: state.directory.selectionId,
4112
- ...(NO_CHAT_SETUP_KINDS.includes(state.kind) ? {} : { initialTask: { kind: 'drawing-intake', sourceNames: state.files.map((file) => file.name) } }),
4193
+ ...(NO_DRAWING_TASK_KINDS.includes(state.kind) ? {} : { initialTask: { kind: 'drawing-intake', sourceNames: state.files.map((file) => file.name) } }),
4194
+ ...(state.linkFrom ? { linkFrom: state.linkFrom } : {}),
4113
4195
  };
4114
- const { project } = await api('/api/projects', { method: 'POST', body: JSON.stringify(payload) });
4196
+ const created = await api('/api/projects', { method: 'POST', body: JSON.stringify(payload) });
4197
+ const project = created.project;
4198
+ // #2470 R6.7: added from a General project — the link result goes with the project to the module's own next step.
4199
+ const link = state.linkFrom ? { linkFrom: state.linkFrom, moduleLink: created.moduleLink, replayed: created.replayed === true } : null;
4200
+ if (link && link.replayed) {
4201
+ // The first try made this project and its answer was lost: open it as it is. Never import or upload again,
4202
+ // and never archive it as "empty" — whatever the first try started is still its own.
4203
+ if (!project.archived && !projects.some((item) => item.id === project.id)) projects.unshift(project);
4204
+ setProjectSetupBusy(false);
4205
+ closeProjectSetup({ restoreFocus: false });
4206
+ if (!project.archived) await openProject(project.id, state.kind === 'drawing-check-profile' ? 'model' : 'drawings');
4207
+ globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok' });
4208
+ return;
4209
+ }
4115
4210
  if (state.kind === 'rvt') {
4116
4211
  setProjectSetupBusy(false);
4117
4212
  closeProjectSetup({ restoreFocus: false });
4118
- await importRvtIntoProject(project, state.files[0], state.appId);
4213
+ await importRvtIntoProject(project, state.files[0], state.appId, link);
4119
4214
  return;
4120
4215
  }
4121
4216
  if (state.kind === 'tekla-source') {
4122
4217
  setProjectSetupBusy(false);
4123
4218
  closeProjectSetup({ restoreFocus: false });
4124
- await importTeklaIntoProject(project, state.teklaSource, state.appId);
4219
+ await importTeklaIntoProject(project, state.teklaSource, state.appId, link);
4125
4220
  return;
4126
4221
  }
4127
4222
  if (state.kind === 'drawing-check-profile' || state.kind === 'general-project') {
@@ -4131,6 +4226,7 @@
4131
4226
  closeProjectSetup({ restoreFocus: false });
4132
4227
  // A General project opens on Knowledge: the job's context, and the first thing to add.
4133
4228
  await openProject(project.id, state.kind === 'general-project' ? 'knowledge' : 'model');
4229
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok' });
4134
4230
  return;
4135
4231
  }
4136
4232
  projects.unshift(project);
@@ -4138,7 +4234,8 @@
4138
4234
  setProjectSetupBusy(false);
4139
4235
  closeProjectSetup({ restoreFocus: false });
4140
4236
  await openProject(project.id, 'drawings');
4141
- showToast('Project created. Attach the drawings on the Drawings step when you’re ready to read them.', 'ok');
4237
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok', next: 'Attach the drawings on the Drawings step when you’re ready to read them.' });
4238
+ else showToast('Project created. Attach the drawings on the Drawings step when you’re ready to read them.', 'ok');
4142
4239
  return;
4143
4240
  }
4144
4241
  let snapshots = state.snapshots || null;
@@ -4163,7 +4260,8 @@
4163
4260
  track('workspace_project_created', { app: state.appId });
4164
4261
  }
4165
4262
  if (!state.opened) {
4166
- await openProject(project.id, 'drawings');
4263
+ // A General project opens on Knowledge, where its kickoff chat helps fill it (#2470 R6.4).
4264
+ await openProject(project.id, state.kind === 'general-project' ? 'knowledge' : 'drawings');
4167
4265
  state.opened = true;
4168
4266
  }
4169
4267
  await bridge.openChatConversation(result.chat.chatId);
@@ -4183,7 +4281,10 @@
4183
4281
  }
4184
4282
  setProjectSetupBusy(false);
4185
4283
  closeProjectSetup({ restoreFocus: false });
4186
- showToast('Project created — the drawing task is running in AI Chat.', 'ok');
4284
+ // A General project's chat is Flo's kickoff; its first reply may still be on its way (#2470 R6.4).
4285
+ showToast(state.kind === 'general-project'
4286
+ ? 'Project created — Flo will help you set it up in AI Chat.'
4287
+ : 'Project created — the drawing task is running in AI Chat.', 'ok');
4187
4288
  }
4188
4289
 
4189
4290
  async function resumeInterruptedProjectChatIntake() {
@@ -4196,7 +4297,7 @@
4196
4297
  const result = await bridge.resumeProjectChatIntake(submissionId);
4197
4298
  if (!result) continue;
4198
4299
  if (!projects.some((item) => item.id === result.project.id)) projects.unshift(result.project);
4199
- await openProject(result.project.id, 'drawings');
4300
+ await openProject(result.project.id, result.project.app === 'floless-general' ? 'knowledge' : 'drawings');
4200
4301
  await bridge.openChatConversation(result.chat.chatId);
4201
4302
  forgetProjectChatIntake(submissionId);
4202
4303
  showToast('Recovered the project and its AI Chat.', 'ok');
@@ -4204,6 +4305,10 @@
4204
4305
  const code = error && (error.code || error.body && error.body.code);
4205
4306
  if (code === 'project-intake-not-found' || code === 'project-intake-damaged') {
4206
4307
  forgetProjectChatIntake(submissionId);
4308
+ } else if (code === 'project-intake-project-missing') {
4309
+ // The project this setup made was removed or replaced: nothing is left to resume, so say so once (#2470 R6.4).
4310
+ forgetProjectChatIntake(submissionId);
4311
+ showToast(projectSetupErrorMessage(error), 'error');
4207
4312
  } else {
4208
4313
  console.warn('project Chat intake recovery is still pending', error);
4209
4314
  }
@@ -4217,7 +4322,7 @@
4217
4322
  * working directory. Nothing is written while the dialog is open. Creation atomically publishes
4218
4323
  * project.json and an unsent initial-task draft; the headless provider is not contacted here.
4219
4324
  */
4220
- async function createFromDrawing(appId, templateId, files, { kind = 'drawings', sourceLabel = '', teklaSource = null, returnFocus = null } = {}) {
4325
+ async function createFromDrawing(appId, templateId, files, { kind = 'drawings', sourceLabel = '', teklaSource = null, returnFocus = null, linkFrom = null } = {}) {
4221
4326
  if (!$projectSetup || projectSetupState) return false;
4222
4327
  // A Drawing Checker profile and a General project start with no source file: what goes in them comes later.
4223
4328
  if (!Array.isArray(files) || (!files.length && !NO_FILE_SETUP_KINDS.includes(kind))) return false;
@@ -4235,6 +4340,9 @@
4235
4340
  providersRead: false,
4236
4341
  sourceLabel,
4237
4342
  teklaSource,
4343
+ // #2470 R6.7: the General project this one is added to, with the one operation id this dialog uses for every
4344
+ // press of Create (a retry after a lost answer is the same operation, so it can never make a second project).
4345
+ linkFrom,
4238
4346
  askCatalogue: kind === 'drawings' && templateId === 'steel-model',
4239
4347
  environment: null,
4240
4348
  directory: null,
@@ -4250,7 +4358,7 @@
4250
4358
  renderProjectSetup();
4251
4359
  $projectSetup.classList.add('show');
4252
4360
  $projectSetupFolderChoose.focus();
4253
- if (!NO_CHAT_SETUP_KINDS.includes(kind)) void refreshProjectSetupProviders(state);
4361
+ if (!NO_CHAT_SETUP_KINDS.includes(kind) && !linkFrom) void refreshProjectSetupProviders(state);
4254
4362
  try {
4255
4363
  if (kind !== 'tekla-source') {
4256
4364
  await Promise.all(files.map(assertProjectSourceReadable));
@@ -4980,23 +5088,23 @@
4980
5088
 
4981
5089
  // An RVT project is created like a drawing project: the setup dialog asks for the project folder
4982
5090
  // 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) {
5091
+ function createFromTeklaSource(appId, templateId, source, returnFocus = null, linkFrom = null) {
4984
5092
  if (!source || !['folder', 'zip'].includes(source.kind) || !Array.isArray(source.entries) || !source.entries.length) return false;
4985
5093
  if (source.kind === 'folder' && !source.entries.some((entry) => /\.db1$/i.test(entry.path) && !/(?:^|\/)xslib\.db1$/i.test(entry.path))) {
4986
5094
  showToast('That folder is not a Tekla model folder.', 'warn');
4987
5095
  return false;
4988
5096
  }
4989
5097
  return createFromDrawing(appId, templateId, source.entries.map((entry) => entry.file), {
4990
- kind: 'tekla-source', sourceLabel: source.label, teklaSource: source, returnFocus,
5098
+ kind: 'tekla-source', sourceLabel: source.label, teklaSource: source, returnFocus, linkFrom,
4991
5099
  });
4992
5100
  }
4993
5101
 
4994
- function createFromRvt(appId, templateId, file) {
5102
+ function createFromRvt(appId, templateId, file, linkFrom = null) {
4995
5103
  if (!file || !/\.rvt$/i.test(file.name)) { showToast('Choose one Revit .rvt file.', 'warn'); return; }
4996
- return createFromDrawing(appId, templateId, [file], { kind: 'rvt' });
5104
+ return createFromDrawing(appId, templateId, [file], { kind: 'rvt', linkFrom });
4997
5105
  }
4998
5106
 
4999
- async function importRvtIntoProject(project, file, appId) {
5107
+ async function importRvtIntoProject(project, file, appId, link = null) {
5000
5108
  try {
5001
5109
  const operation = await uploadRvtForProject(project, file, 0);
5002
5110
  track('workspace_project_created', { app: appId });
@@ -5005,15 +5113,18 @@
5005
5113
  paintRevitSourceState('Waiting for AWARE', 'Your RVT is stored locally and waiting for the trusted reader.');
5006
5114
  if (revitActiveOperation?.operationId !== operation.operationId) revitActiveOperation = operation;
5007
5115
  pollRevitImport(operation.operationId, project.id);
5116
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok' });
5008
5117
  } catch (err) {
5009
5118
  const removed = await archiveEmptyProject(project.id);
5119
+ // #2470 R6.7: the empty project is not kept linked either; the Modules step says what happened (spec §6.3).
5120
+ if (link) { await globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: removed ? 'archived-empty' : 'left-empty', error: err && err.message || String(err) }); return; }
5010
5121
  showToast(removed
5011
5122
  ? `Couldn’t import the RVT — the empty project was removed. ${err && err.message || err}`
5012
5123
  : `Couldn’t import the RVT. An empty project was left behind; archive it from the ⋯ menu. ${err && err.message || err}`, 'warn');
5013
5124
  }
5014
5125
  }
5015
5126
 
5016
- async function importTeklaIntoProject(project, source, appId) {
5127
+ async function importTeklaIntoProject(project, source, appId, link = null) {
5017
5128
  try {
5018
5129
  track('workspace_project_created', { app: appId });
5019
5130
  if (!projects.some((entry) => entry.id === project.id)) projects.unshift(project);
@@ -5024,7 +5135,9 @@
5024
5135
  if (revitActiveOperation?.operationId !== operation.operationId) revitActiveOperation = operation;
5025
5136
  pollRevitImport(operation.operationId, project.id);
5026
5137
  }
5138
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'ok' });
5027
5139
  } catch (error) {
5140
+ if (link) globalThis.flolessProjectModules?.afterCreate?.({ project, ...link, outcome: 'failed-kept' });
5028
5141
  if (error?.name === 'AbortError') {
5029
5142
  if (current?.id === project.id) {
5030
5143
  paintRevitSourceState('Read cancelled', 'No read-only snapshot was created. The source Tekla model was not changed.');
@@ -6217,6 +6330,24 @@
6217
6330
  });
6218
6331
  }
6219
6332
  }
6333
+ // #2470 R6.2: Workflows is a shell-rendered pane too: the workflows this project owns (project-workflows.js).
6334
+ // Queried here for the same reason as the Pages pane above.
6335
+ const $workflowsPane = document.getElementById('ws-workflows');
6336
+ if ($workflowsPane) {
6337
+ const showWorkflows = s === 'workflows';
6338
+ $workflowsPane.hidden = !showWorkflows;
6339
+ const project = typeof current !== 'undefined' ? current : null;
6340
+ if (showWorkflows && project && window.flolessProjectWorkflows) window.flolessProjectWorkflows.render($workflowsPane, project);
6341
+ }
6342
+ // #2470 R6.7: Modules is a shell-rendered pane too: the module projects linked to this one (project-modules.js).
6343
+ // Queried here for the same reason as the Pages pane above.
6344
+ const $modulesPane = document.getElementById('ws-modules');
6345
+ if ($modulesPane) {
6346
+ const showModules = s === 'modules';
6347
+ $modulesPane.hidden = !showModules;
6348
+ const project = typeof current !== 'undefined' ? current : null;
6349
+ if (showModules && project && window.flolessProjectModules) window.flolessProjectModules.render($modulesPane, project);
6350
+ }
6220
6351
  // Knowledge is a shell-rendered pane too: the project's Knowledge Base (References column).
6221
6352
  const showKnowledge = s === 'knowledge';
6222
6353
  $wsKnowledge.hidden = !showKnowledge;
@@ -14911,7 +15042,7 @@
14911
15042
  return line;
14912
15043
  }
14913
15044
 
14914
- function proposalRow(p, idx, bucket) {
15045
+ function proposalRow(p, idx, bucket, { preTicks = false } = {}) {
14915
15046
  // A read that only ADDS (marks on a sheet, detail anchors, moment frames) reads as an addition, not as a change.
14916
15047
  const addsOnly = isMarksRow(p) || (p.kind === 'model-changed' && (p.key === 'detail_bubbles' || p.key === 'moment_frames'));
14917
15048
  const row = revEl('div', 'rev-row ' + (addsOnly ? 'k-added' : (KIND_CLASS[p.kind] || 'k-changed')));
@@ -14938,6 +15069,23 @@
14938
15069
  // is named from its subject.
14939
15070
  const rf = p.kind === 'model-changed' ? rootField(p.key) : null;
14940
15071
  head.appendChild(revEl('span', 'rev-kind-badge', rf ? rf.badge : (isMarksRow(p) ? marksBadge(p) : (KIND_LABEL[p.kind] || p.kind))));
15072
+ // #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
15073
+ // chose it at a glance; what that means for the tick is in the row's note, which the checkbox is described by.
15074
+ const aiRow = p.kind === 'member-changed' && p.ai && typeof p.ai === 'object' && p.ai.heights > 0 ? p.ai : null;
15075
+ if (aiRow) {
15076
+ const pill = revEl('span', 'ai-pill rev-ai-pill', aiRow.onlyAiHeights ? 'AI-chosen height' : 'AI height');
15077
+ pill.dataset.tip = 'Chosen by the AI in the Quick model, not from the drawings.';
15078
+ head.appendChild(pill);
15079
+ }
15080
+ // Pre-ticked only when the person chose to auto-accept the AI's changes, the server says every change in the row is
15081
+ // the AI's height, and the review is not a re-render after the model moved (then every tick is cleared, below).
15082
+ const preTicked = !!(aiRow && p.preTick === true && preTicks);
15083
+ if (preTicked) box.checked = true;
15084
+ // Instructor (`?`) explains this tick in its own words, as it does the pre-selected registration row.
15085
+ if (aiRow) {
15086
+ box.dataset.commandId = `shell.revision-ai-height#${p.memberId}`;
15087
+ box.dataset.commandInstanceLabel = String(p.memberId || '');
15088
+ }
14941
15089
  // A plan proposal is titled by `viewLabel`, which the SERVER computes with `planViewLabels` (#938).
14942
15090
  // The rule needs sibling context — a page's name is enough when it carries one view and must be
14943
15091
  // disambiguated when it carries several — which a single proposal row does not have, so re-deriving
@@ -14988,9 +15136,15 @@
14988
15136
  // with other changes the read proposes for the same member; accepting it takes those too, so the
14989
15137
  // row says so FIRST (design review: it is the most consequential note) rather than letting the
14990
15138
  // height stand for the whole decision.
14991
- if (answeredEnds && otherFields) {
15139
+ if ((answeredEnds && otherFields) || (aiRow && !aiRow.onlyAiHeights)) {
14992
15140
  desc.push(revEl('div', 'rev-row-note', 'Ticking this row also applies the other changes shown for this member.'));
14993
15141
  }
15142
+ // ONE note for the AI's height (design review: never two stacked), saying whose number it is and what the tick does.
15143
+ if (aiRow) {
15144
+ desc.push(revEl('div', 'rev-row-note', preTicked
15145
+ ? '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.'
15146
+ : '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.'));
15147
+ }
14994
15148
  desc.push(...notes);
14995
15149
  } else if (p.kind === 'model-changed') {
14996
15150
  const isGrid = p.key === 'grid';
@@ -15279,7 +15433,15 @@
15279
15433
  root.querySelectorAll('.rev-check, .rev-group-actions').forEach((control) => control.remove());
15280
15434
  }
15281
15435
 
15282
- function renderReview(summary, { readOnly = false } = {}) {
15436
+ /** #2521 row 3b-3: what the review's subtitle adds while a row starts ticked for the person; taken out when none does. */
15437
+ 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.';
15438
+
15439
+ /*
15440
+ * `preTicks` (#2521 row 3b-3): whether a row the server pre-ticks (`preTick`, the person's auto-accept choice) starts
15441
+ * ticked. Off for the re-render after the model moved mid-review: that render clears every tick on purpose ("each one
15442
+ * needs deciding again"), so it never re-ticks an AI row the person had unticked (Codex plan review, finding 3).
15443
+ */
15444
+ function renderReview(summary, { readOnly = false, preTicks = true } = {}) {
15283
15445
  // COUNTS: one quiet line, and never "0 of X" — the zero clause is simply omitted.
15284
15446
  // The numbers carry a <b>, so the two figures worth scanning stand out of the muted sentence —
15285
15447
  // the rule for it existed and nothing emitted the element.
@@ -15334,7 +15496,7 @@
15334
15496
  }
15335
15497
  if (props.length) {
15336
15498
  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')));
15499
+ props.forEach((p, i) => g.appendChild(proposalRow(p, i, 'proposals', { preTicks: preTicks && !readOnly })));
15338
15500
  body.appendChild(g);
15339
15501
  }
15340
15502
  if (binds.length) {
@@ -15433,9 +15595,11 @@
15433
15595
  const created = outcomes.filter((row) => ['created', 'successor'].includes(row.result));
15434
15596
  const existing = outcomes.filter((row) => ['reused', 'reopened', 'already-seeded'].includes(row.result));
15435
15597
  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));
15598
+ // #2521 row 3b-2: a Quick RFI whose question the person's review changed. It stays open; it is not lost.
15599
+ const changed = outcomes.filter((row) => row.result === 'facts-changed');
15600
+ const attention = outcomes.filter((row) => !['created', 'reused', 'reopened', 'successor', 'already-seeded', 'not-in-report', 'facts-changed'].includes(row.result));
15437
15601
  $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.` : ''}`,
15602
+ `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
15603
  ));
15440
15604
  $revReviewCounts.dataset.revRfiSelection = 'result';
15441
15605
  $revReviewCounts.hidden = false;
@@ -15469,6 +15633,16 @@
15469
15633
  }
15470
15634
  body.appendChild(section);
15471
15635
  }
15636
+ if (changed.length) {
15637
+ const section = group('Changed in your review, still open', changed.length);
15638
+ for (const row of changed) {
15639
+ const item = revEl('div', 'rev-row');
15640
+ item.appendChild(revEl('div', 'rev-row-title', row.gapKey));
15641
+ 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.'));
15642
+ section.appendChild(item);
15643
+ }
15644
+ body.appendChild(section);
15645
+ }
15472
15646
  if (unasked.length) {
15473
15647
  const section = group('New questions that were not filed', unasked.length);
15474
15648
  for (const row of unasked) {
@@ -15489,7 +15663,7 @@
15489
15663
  }
15490
15664
  body.appendChild(section);
15491
15665
  }
15492
- if (!records.length && !removed.length && !unasked.length && !attention.length) {
15666
+ if (!records.length && !removed.length && !changed.length && !unasked.length && !attention.length) {
15493
15667
  body.appendChild(revEl('div', 'hd-empty', 'No RFI record changed with this revision.'));
15494
15668
  }
15495
15669
  $revReviewBody.replaceChildren(body);
@@ -15600,6 +15774,11 @@
15600
15774
  : moveForward
15601
15775
  ? `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
15776
  : '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.';
15777
+ // #2521 row 3b-3: said without a number, so it cannot go stale as the person unticks (design review), and as
15778
+ // "ticked for you", never "accepted": nothing lands until the confirm.
15779
+ if (!readOnly && (summary.proposals || []).some((p) => p && p.kind === 'member-changed' && p.preTick === true && p.ai)) {
15780
+ $revReviewSub.textContent += PRE_TICKED_SUB;
15781
+ }
15603
15782
  $revReviewChanged.hidden = true;
15604
15783
  delete $revReviewChanged.dataset.kind;
15605
15784
  renderReview(summary, { readOnly });
@@ -15822,7 +16001,9 @@
15822
16001
  // `revReviewState` to the fresh stageId would leave the user looking at one review while the
15823
16002
  // next confirm submitted indices against another. Rendering first means a throw leaves the
15824
16003
  // 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
16004
+ renderReview(fresh, { preTicks: false }); // replaceChildren builds new, unticked inputs — no tick can survive it, a pre-tick included
16005
+ // So the subtitle no longer says any row is ticked for the person (code review of 3b-3).
16006
+ $revReviewSub.textContent = $revReviewSub.textContent.replace(PRE_TICKED_SUB, '');
15826
16007
  revReviewState = { ...st, stageId: fresh.stageId, summary: fresh };
15827
16008
  if (fresh.rfiSelection?.decision === 'required') showRequiredRfiSelection(fresh, true);
15828
16009
  else {
@@ -17869,6 +18050,59 @@
17869
18050
  if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
17870
18051
  }
17871
18052
 
18053
+ // #2470 R6.2: a project's Workflows step, where the workflows it owns are listed (Project access links here).
18054
+ // #2470 R6.7: the create cards a General project's Add a module sheet shows — the landing's own entries and markup,
18055
+ // minus General, so every lock, setup and remedy state reads exactly as it does on the landing.
18056
+ function moduleCreateCardsHtml() {
18057
+ return workspaceCreateEntries(wsAppEntries)
18058
+ .filter(({ entry }) => entry.templateId !== 'floless-general')
18059
+ .map(({ entry, action }) => workspaceCreateCardHtml(entry, action))
18060
+ .join('');
18061
+ }
18062
+
18063
+ /** A click on a card in the Add a module sheet: the card's remedy, or its own create flow carrying `linkFrom`. */
18064
+ function activateCreateCard(target, linkFrom) {
18065
+ const remedy = createCardRemedy(target);
18066
+ if (remedy) return { kind: 'remedy', done: remedy() };
18067
+ const seed = target?.closest?.('[data-seed-app]');
18068
+ if (!seed) return null;
18069
+ return { kind: 'create', done: activateSeedCard(seed, linkFrom) };
18070
+ }
18071
+
18072
+ /** Open a project by id, from another project's Modules step: the same open a card on the landing does. */
18073
+ async function openLinkedProject(projectId) {
18074
+ await setMode('workspaces');
18075
+ const opened = await openProject(projectId);
18076
+ if (opened === STAYED_IN_PROJECT) throw new Error('You stayed in this project, so the other one was not opened.');
18077
+ if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
18078
+ }
18079
+
18080
+ /** A General project's Modules step: where Back to … after an Add a module returns to. */
18081
+ async function openModulesStep(projectId) {
18082
+ await setMode('workspaces');
18083
+ const opened = await openProject(projectId, 'modules');
18084
+ if (opened === STAYED_IN_PROJECT) throw new Error('You stayed in this project, so the other one was not opened.');
18085
+ if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
18086
+ }
18087
+
18088
+ /** Show the archived projects on the Workspaces page, where Restore is, with this one in view. */
18089
+ async function showArchivedProjects(returnFocus) {
18090
+ await setMode('workspaces');
18091
+ if (current) await leaveProjectToList(returnFocus);
18092
+ if (current) return false;
18093
+ const archived = $landing.querySelector('.ws-archived');
18094
+ if (archived) { archived.open = true; archived.scrollIntoView?.({ block: 'nearest' }); archived.querySelector('summary')?.focus?.(); }
18095
+ return true;
18096
+ }
18097
+
18098
+ async function openWorkflowsStep(projectId) {
18099
+ if (typeof projectId !== 'string' || !projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
18100
+ await setMode('workspaces');
18101
+ const opened = await openProject(projectId, 'workflows');
18102
+ if (opened === STAYED_IN_PROJECT) throw new Error('You stayed in this project, so the other one was not opened.');
18103
+ if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
18104
+ }
18105
+
17872
18106
  // The Drawing Filter step of a project, where a drawing read's exclusions are saved and signed off.
17873
18107
  async function openDrawingsStep(projectId) {
17874
18108
  if (typeof projectId !== 'string' || !projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
@@ -17957,6 +18191,10 @@
17957
18191
  const citedElsewhere = () => validId(target.projectUuid) && String(current?.uuid || '').toLowerCase() !== target.projectUuid.toLowerCase();
17958
18192
  const citedGone = () => connectionError(`This project is no longer the one the answer cited, so the ${thing} was not shown.`);
17959
18193
  let until = Infinity;
18194
+ // #2605: the document the model frame held before this call opened the project. Left for the Workspaces list,
18195
+ // a project's editor page stays in the hidden frame, and openProject's reset of it lands only later: until
18196
+ // then that page still answers to the project id, and a request handed to it dies with the reload.
18197
+ let pageLeftBehind = null;
17960
18198
  // Everything that ends this call's wait without the editor's answer.
17961
18199
  const interrupted = () => {
17962
18200
  if (superseded()) return { superseded: true };
@@ -17975,6 +18213,7 @@
17975
18213
  // setMode leaves the person where they were when they chose to stay (an Agent with unsaved changes).
17976
18214
  if (mode !== 'workspaces') throw stayedOutside();
17977
18215
  if (current?.id !== target.projectId) {
18216
+ try { pageLeftBehind = frames.model.contentWindow?.document ?? null; } catch { pageLeftBehind = null; }
17978
18217
  const opened = await navigating(openProject(target.projectId, 'model', { stillWanted }), true);
17979
18218
  if (opened?.superseded || superseded()) return { superseded: true };
17980
18219
  // openProject answers "stayed" for several causes (the person chose to stay, the project's folder is
@@ -18007,7 +18246,8 @@
18007
18246
  const child = frames.model.contentWindow;
18008
18247
  if (!answer) {
18009
18248
  const state = child && child.flolessEditorState;
18010
- if (state && state.project === target.projectId && typeof child.flolessEditorFocus === 'function') {
18249
+ if (state && state.project === target.projectId && typeof child.flolessEditorFocus === 'function'
18250
+ && (!pageLeftBehind || child.document !== pageLeftBehind)) {
18011
18251
  if (citedElsewhere()) throw citedGone();
18012
18252
  // The frame's window survives a reload; its DOCUMENT does not. That is what tells a reload apart.
18013
18253
  page = child; doc = child.document;
@@ -18236,10 +18476,14 @@
18236
18476
  tellModelFrame({ type: 'knowledge-changed', projectId });
18237
18477
  },
18238
18478
  setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind,
18239
- openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, openDrawingsStep, openConnection, drawingFilterCheckpointSaved,
18479
+ openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, openDrawingsStep, openWorkflowsStep, openConnection, drawingFilterCheckpointSaved,
18480
+ // #2470 R6.7: the Modules step of a General project (project-modules.js).
18481
+ moduleCreateCardsHtml, activateCreateCard, openLinkedProject, openModulesStep, showArchivedProjects,
18240
18482
  syncWorkspaceReporter, openChatOwner, openPagesHome, folderDecisionCompleted,
18241
18483
  // Project access (project-access.js loads after this file): the project open now, or null.
18242
18484
  currentProject: () => ($app.classList.contains('mode-workspaces') && current ? current : null),
18485
+ // #2470 R6.2: whether the open project's kind has this step (a General project has Workflows; the others not yet).
18486
+ projectHasStep: (key) => Boolean(current && wsDescOf(current)?.steps?.some((st) => st.key === key)),
18243
18487
  };
18244
18488
  applyMode(); // restore persisted mode immediately (matches panels.js applyView timing)
18245
18489
  })();