@floless/app 0.169.0 → 0.171.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 (87) hide show
  1. package/dist/floless-server.cjs +65531 -43728
  2. package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
  3. package/dist/schemas/steel.model.v2.schema.json +196 -4
  4. package/dist/skills/floless-app-bridge/SKILL.md +3 -3
  5. package/dist/skills/floless-app-knowledge/SKILL.md +46 -15
  6. package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
  7. package/dist/skills/floless-app-onboarding/SKILL.md +5 -4
  8. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +0 -3
  9. package/dist/skills/floless-app-queue/SKILL.md +2 -3
  10. package/dist/skills/floless-app-report-issue/SKILL.md +2 -2
  11. package/dist/skills/floless-app-routines/SKILL.md +2 -2
  12. package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
  13. package/dist/skills/floless-app-steel-model/SKILL.md +42 -39
  14. package/dist/skills/floless-app-steel-model/references/custom-connections.md +47 -0
  15. package/dist/skills/floless-app-steel-model/references/custom-sections.md +32 -0
  16. package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
  17. package/dist/skills/floless-app-ui/SKILL.md +71 -126
  18. package/dist/skills/floless-app-workflows/SKILL.md +22 -3
  19. package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
  20. package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
  21. package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
  22. package/dist/web/add-ons.js +407 -0
  23. package/dist/web/agent-steps.js +89 -18
  24. package/dist/web/agents.js +32 -22
  25. package/dist/web/analytics.js +1 -1
  26. package/dist/web/app.css +331 -190
  27. package/dist/web/app.js +33 -13
  28. package/dist/web/aware.js +926 -218
  29. package/dist/web/chat.css +6 -1
  30. package/dist/web/chat.js +316 -112
  31. package/dist/web/checkpoint-standard.js +5 -3
  32. package/dist/web/commands-drawing-check.js +1 -0
  33. package/dist/web/commands-filter.js +23 -0
  34. package/dist/web/commands-shell.js +479 -78
  35. package/dist/web/commands-steel.js +69 -2
  36. package/dist/web/commands-tekla-parser.js +23 -0
  37. package/dist/web/connections.js +14 -3
  38. package/dist/web/drawing-check-editor.js +352 -88
  39. package/dist/web/failure-copy.js +33 -2
  40. package/dist/web/filter-ai-proposal.js +11 -8
  41. package/dist/web/flo-3d.js +1 -1
  42. package/dist/web/guide.js +36 -29
  43. package/dist/web/index.html +98 -57
  44. package/dist/web/instructor.js +101 -17
  45. package/dist/web/kb-categories.js +64 -7
  46. package/dist/web/left-pane.js +4 -1
  47. package/dist/web/local-discovery.js +8 -7
  48. package/dist/web/missed-routines.js +239 -0
  49. package/dist/web/model-change-findings.js +430 -0
  50. package/dist/web/model-change-review.js +414 -0
  51. package/dist/web/model-editor-steel-adapter.js +2 -2
  52. package/dist/web/model-measure.js +6 -0
  53. package/dist/web/model-spatial-panel.js +19 -4
  54. package/dist/web/model-spatial-tools.js +3 -3
  55. package/dist/web/model-viewport-revit-adapter.js +3 -3
  56. package/dist/web/origin-rule.js +155 -0
  57. package/dist/web/project-access.js +1 -1
  58. package/dist/web/project-history.js +7 -1
  59. package/dist/web/project-modules.js +2 -2
  60. package/dist/web/project-rfis.js +6 -1
  61. package/dist/web/project-workflows.js +2 -2
  62. package/dist/web/revit-editor.css +85 -0
  63. package/dist/web/revit-editor.js +58 -9
  64. package/dist/web/run-history.js +12 -1
  65. package/dist/web/sha256-sync.js +62 -0
  66. package/dist/web/steel-3d-core.js +46 -9
  67. package/dist/web/steel-3d-flo.js +153 -7
  68. package/dist/web/steel-3d-view.js +33 -5
  69. package/dist/web/steel-ai-marks.js +3 -1
  70. package/dist/web/steel-custom-connection.js +161 -0
  71. package/dist/web/steel-custom-sections.js +1796 -0
  72. package/dist/web/steel-editor.html +732 -161
  73. package/dist/web/steel-environments.js +297 -0
  74. package/dist/web/steel-filter-usage.js +299 -0
  75. package/dist/web/steel-filter.html +104 -6
  76. package/dist/web/steel-model-v2-client-validation.js +11 -1
  77. package/dist/web/steel-model-v2-commands.js +116 -13
  78. package/dist/web/steel-model-v2-projection.js +1 -1
  79. package/dist/web/steel-read-confidence.js +1 -56
  80. package/dist/web/step-rename.js +3 -2
  81. package/dist/web/tekla-editor.html +1 -0
  82. package/dist/web/terminal-requests.js +1 -1
  83. package/dist/web/tool-updates.js +7 -6
  84. package/dist/web/workspaces.js +1968 -138
  85. package/launch.mjs +87 -9
  86. package/package.json +4 -1
  87. package/dist/web/panels.js +0 -831
package/dist/web/chat.js CHANGED
@@ -194,7 +194,7 @@
194
194
  // The server is almost always running but busy when this happens (#1604), so the sentence
195
195
  // leads with "try again" and keeps "is it still running?" as the fallback.
196
196
  const timeout = new Error('FloLess took too long to respond, most likely because it is busy. Try again in a moment — if it keeps happening, make sure FloLess is still running.');
197
- timeout.code = 'local-timeout';
197
+ timeout.code = 'local-timeout'; timeout.forPerson = true;
198
198
  // Which call timed out, and after how long: the sentence above is for the user, this is for
199
199
  // whoever reads the console when it happens (#1604).
200
200
  timeout.cause = { path, timeoutMs, name: error.name };
@@ -209,7 +209,7 @@
209
209
  const unreadable = (cause) => {
210
210
  console.warn('[chat] a request was answered with JSON this window could not read', path, response.status, cause);
211
211
  return Object.assign(new Error(failureCopy({ status: response.status, body: { ok: false, code: 'response-unreadable' } }, { retrySafe: readOnly }).text),
212
- { code: 'response-unreadable', status: response.status });
212
+ { code: 'response-unreadable', status: response.status, body: { ok: false, code: 'response-unreadable' } });
213
213
  };
214
214
  const body = contentType.includes('application/json')
215
215
  ? await response.json().catch((cause) => { if (response.ok) throw unreadable(cause); return null; })
@@ -224,8 +224,9 @@
224
224
  error.code = body?.code || null;
225
225
  error.reason = body?.reason || null;
226
226
  error.recovery = Array.isArray(body?.recovery) ? body.recovery : null;
227
- // The subscription gate's answer (state + reason) decides which sign-in sentence errorMessage shows.
228
- if (response.status === 402 && body && typeof body === 'object') error.body = body;
227
+ // The subscription gate's answer (state + reason) decides which sign-in sentence errorMessage shows. #3097 3b: the
228
+ // reply rides on every refusal, so errorText works the sentence out again from it rather than from this message.
229
+ error.body = json || {};
229
230
  // #2061: who holds a busy project, so the person can be asked: wait, stop it, or open it.
230
231
  error.holder = body?.holder && typeof body.holder === 'object' ? body.holder : null;
231
232
  // #2470 R6.7b: a project intake from Add a module whose link the General project can't take is a choice, not a refusal.
@@ -373,6 +374,9 @@
373
374
  'tekla-allowance-changed': 'The Tekla read permission for this chat changed. Choose again.',
374
375
  'connector-allowance-changed': 'The connectors allowed for this chat changed. Choose again.',
375
376
  };
377
+ // #3255: the conversation is from an earlier opening of this Workspace; reopening does not help, a new one does.
378
+ // Written out, not the shared constant: several test harnesses lift this function alone.
379
+ if (code === 'chat-owner-stale' && error?.body?.earlierOpening) return 'This conversation is from before this Workspace was reopened, so you can read it but not continue it. To carry on, choose New conversation at the top of the chat. The new conversation won’t remember this one.';
376
380
  if (code === 'chat-followup-refused' && error?.reason === 'chat-session-required') {
377
381
  return 'Your FloLess session expired before this message was sent. Copy the draft, reload, then paste and send it again.';
378
382
  }
@@ -605,7 +609,9 @@
605
609
  }
606
610
  return;
607
611
  }
608
- const message = requestExecutionBlocked()
612
+ const message = state.chat?.earlierOpening
613
+ ? 'This conversation is from before this Workspace was reopened, so you can read it but not continue it. To carry on, choose New conversation at the top of the chat. The new conversation won’t remember this one.'
614
+ : requestExecutionBlocked()
609
615
  ? 'Another AI Chat is changing this project or workflow. Wait for it to finish or stop it before sending here.'
610
616
  : state.followupUnknownId || hasUnknownFollowup()
611
617
  ? 'FloLess could not confirm this message. Check its status and use the action beside it before sending again.'
@@ -691,7 +697,6 @@
691
697
  rfis: 'project-rfis', // #2470 R6.6 (General's pane) and R6.6c (a steel project's RFI page, in the editor frame)
692
698
  }[selectedStep || ''] || 'project-list';
693
699
  const workspaceProjectOpen = document.getElementById('ws-project')?.hidden === false;
694
- const dashboardVisible = document.getElementById('dashboard')?.hidden === false;
695
700
  // #1890: the Workflows landing (the list of workflows), not the canvas of the workflow loaded underneath.
696
701
  const workflowLanding = document.getElementById('wf-landing')?.hidden === false;
697
702
  // #2007: the Agents tab is its own surface; where you are adds context only.
@@ -699,7 +704,7 @@
699
704
  const surface = agentsMode && !reportOpen ? (window.flolessAgents?.surface?.() || 'agent-list') : reportOpen ? (threeDimensionalReport ? '3d-report' : 'report')
700
705
  : editorOpen ? 'model-editor'
701
706
  : workspaceMode ? (workspaceProjectOpen ? workspaceSurface : 'project-list')
702
- : workflowLanding ? 'workflow-list' : dashboardVisible ? 'dashboard' : 'workflow-canvas';
707
+ : workflowLanding ? 'workflow-list' : 'workflow-canvas';
703
708
  if (options.surfaceOnly) return { surface };
704
709
  return {
705
710
  mode: agentsMode ? 'agents' : workspaceMode ? 'workspaces' : workflowMode ? 'workflows' : 'canvas',
@@ -741,7 +746,6 @@
741
746
  case 'workflow-list': return shellText('wf-landing');
742
747
  case 'agent-list': case 'agent-page': return shellText('agents-surface');
743
748
  case 'workflow-canvas': return shellText('canvas-main', 'inspect');
744
- case 'dashboard': return shellText('dashboard');
745
749
  case 'report': return boundedVisibleText(readVisibleFrameText('report-frame'), shellText('report-title', 'report-sub', 'report-overlay'));
746
750
  case '3d-report': return shellText('report-title', 'report-sub', 'report-overlay');
747
751
  case 'model-editor': return boundedVisibleText(readVisibleFrameText('contract-editor-frame'), shellText('contract-editor-title'));
@@ -753,7 +757,7 @@
753
757
  const labels = {
754
758
  'drawing-filter': 'Drawing Filter', 'project-model': 'project model', 'project-exports': 'project exports',
755
759
  'project-history': 'project history', 'project-knowledge': 'project Knowledge', 'project-pages': 'project Pages', 'project-workflows': 'project Workflows', 'project-rfis': 'project RFIs', 'project-list': 'project list',
756
- 'workflow-canvas': 'workflow canvas', dashboard: 'dashboard', report: 'report', '3d-report': '3D report',
760
+ 'workflow-canvas': 'workflow canvas', report: 'report', '3d-report': '3D report',
757
761
  'model-editor': 'model editor', 'workflow-list': 'workflow list', 'agent-list': 'list of agents', 'agent-page': 'agent page',
758
762
  };
759
763
  return `${labels[context.surface] || 'FloLess'} · visible state${context.activity === 'workflow-running' ? ' · workflow running' : ''}`;
@@ -1496,7 +1500,10 @@
1496
1500
  meta.textContent = archived
1497
1501
  ? `${providerLabels[chat.provider]} · Archived ${eventTime({ createdAt: chat.archivedAt || chat.updatedAt })}`
1498
1502
  : `${providerLabels[chat.provider]} · Created ${eventTime(chat)}`;
1499
- row.setAttribute('aria-label', `${chat.title}, ${unread ? 'unread conversation, ' : ''}${providerLabels[chat.provider]}, ${chat.archivedAt ? 'archived' : 'created'} ${eventTime({ createdAt: chat.archivedAt || chat.createdAt })}`);
1503
+ // #3255: from an earlier opening of this Workspace: it opens to be read. In place of its time, so the title keeps
1504
+ // its room (the day heading above still dates it, and the row's spoken label keeps the time).
1505
+ if (chat?.earlierOpening) meta.textContent = `${providerLabels[chat.provider]} · Read only`;
1506
+ row.setAttribute('aria-label', `${chat.title}, ${unread ? 'unread conversation, ' : ''}${chat?.earlierOpening ? 'read only, ' : ''}${providerLabels[chat.provider]}, ${chat.archivedAt ? 'archived' : 'created'} ${eventTime({ createdAt: chat.archivedAt || chat.createdAt })}`);
1500
1507
  const rename = document.createElement('button');
1501
1508
  rename.type = 'button'; rename.className = 'ai-chat-history-rename'; rename.textContent = '✎';
1502
1509
  rename.dataset.commandId = `shell.chat-history-rename#${chat.chatId}`;
@@ -1529,7 +1536,7 @@
1529
1536
  event.preventDefault(); event.stopPropagation(); deleteConversation(chat, remove);
1530
1537
  });
1531
1538
  actions.append(rename, archive, remove);
1532
- actions.hidden = turnIsVisiblyActive(chat);
1539
+ actions.hidden = turnIsVisiblyActive(chat) || Boolean(chat?.earlierOpening);
1533
1540
  row.append(title, meta, actions);
1534
1541
  if (turnIsVisiblyActive(chat)) {
1535
1542
  const spinner = document.createElement('span'); spinner.className = 'ai-chat-history-working';
@@ -1728,7 +1735,8 @@
1728
1735
  /** A waiting move with a warning, for the conversation on screen: the sentence and the person's choices. */
1729
1736
  function moveNoticeForChat(chat) {
1730
1737
  const rehome = chat?.rehome;
1731
- if (!rehome || state.scope?.owner?.kind !== 'workspace' || rehome.state !== 'pending' || !rehome.warning) return null;
1738
+ // #3255: a conversation from an earlier opening of the Workspace is read only, so its move is not offered either.
1739
+ if (!rehome || chat?.earlierOpening || state.scope?.owner?.kind !== 'workspace' || rehome.state !== 'pending' || !rehome.warning) return null;
1732
1740
  const keep = { label: 'Keep it here', command: 'shell.chat-move-keep', run: () => keepConversationHere(chat.chatId) };
1733
1741
  const retry = { label: 'Try again', command: 'shell.chat-move-retry', run: () => retryConversationMove(chat.chatId) };
1734
1742
  return rehome.targetGone
@@ -1869,7 +1877,7 @@
1869
1877
  }
1870
1878
 
1871
1879
  function beginRename() {
1872
- if (!state.chat || turnIsVisiblyActive() || state.renaming) return;
1880
+ if (!state.chat || turnIsVisiblyActive() || state.renaming || state.chat?.earlierOpening) return;
1873
1881
  state.renaming = { original: state.chat.title };
1874
1882
  ui.title.contentEditable = 'true';
1875
1883
  ui.title.setAttribute('role', 'textbox');
@@ -1890,7 +1898,7 @@
1890
1898
  ui.title.removeAttribute('role');
1891
1899
  ui.title.removeAttribute('aria-label');
1892
1900
  ui.title.classList.remove('editing');
1893
- ui.rename.hidden = !state.chat || Boolean(state.chat.activeTurn);
1901
+ ui.rename.hidden = !state.chat || Boolean(state.chat.activeTurn) || Boolean(state.chat?.earlierOpening);
1894
1902
  if (!save || !title || title === original || !snapshot) {
1895
1903
  ui.title.textContent = original;
1896
1904
  return;
@@ -4711,7 +4719,8 @@
4711
4719
  */
4712
4720
  function probeSources(turnId, index) {
4713
4721
  const chatId = state.chat?.chatId;
4714
- if (!chatId || !turnId || answerRunning(turnId)) return;
4722
+ // #3255: a conversation from an earlier opening of the Workspace is read as history; its sources are not re-checked.
4723
+ if (!chatId || !turnId || state.chat?.earlierOpening || answerRunning(turnId)) return;
4715
4724
  const key = `${chatId}\u0000${turnId}`;
4716
4725
  if (probedTurns.has(key) || ![...index.byAnchor.values()].some((row) => (row.entry.status === 'resolved' && !row.entry.bare) || row.choice)) return;
4717
4726
  probedTurns.add(key);
@@ -4932,7 +4941,7 @@
4932
4941
  help.textContent = deliveryReceipt.reason;
4933
4942
  item.append(help);
4934
4943
  }
4935
- if (delivery === 'unknown' && event.clientSubmissionId) {
4944
+ if (delivery === 'unknown' && event.clientSubmissionId && !state.chat?.earlierOpening) {
4936
4945
  const help = document.createElement('span'); help.className = 'ai-chat-message-delivery ai-chat-message-delivery-detail';
4937
4946
  help.textContent = 'AI may have received this. Check the conversation before continuing.';
4938
4947
  const resolve = button(event.optimistic ? 'Review draft and continue' : 'Continue without resending',
@@ -4949,7 +4958,7 @@
4949
4958
  item.append(help, resolve);
4950
4959
  }
4951
4960
  if (delivery === 'not-sent' && deliveryReceipt?.retryable !== false
4952
- && event.clientSubmissionId && !state.chat?.archivedAt
4961
+ && event.clientSubmissionId && !state.chat?.archivedAt && !state.chat?.earlierOpening
4953
4962
  && state.chat?.state !== 'recovery'
4954
4963
  && !state.followupUnknownId && !hasUnknownFollowup()
4955
4964
  && (!state.chat?.activeTurn || state.chat.activeTurn.turnId === event.turnId)
@@ -5081,7 +5090,9 @@
5081
5090
  item.classList.toggle('ai-chat-request-aside', set === 'dismissed' || set === 'expired');
5082
5091
  // A request I dismissed from here can be taken back from here.
5083
5092
  let undo = item.querySelector('.ai-chat-request-undo');
5084
- if (set === 'dismissed' || set === 'expired') {
5093
+ // #3255: a card in a conversation from an earlier opening of the Workspace is read only: no Dismiss or Undo here.
5094
+ const history = Boolean(state.chat?.earlierOpening);
5095
+ if ((set === 'dismissed' || set === 'expired') && !history) {
5085
5096
  if (!undo) {
5086
5097
  undo = button('Undo', `shell.chat-request-undo#${requestId || 'linked request'}`, 'ai-chat-request-undo');
5087
5098
  undo.dataset.tip = 'Put this request back in Requests, exactly as it was';
@@ -5092,7 +5103,7 @@
5092
5103
  // Nothing is left to set aside once the request is finished, dismissed or gone; its card still folds (its chevron).
5093
5104
  const finished = Boolean(live && (live.found === false || set));
5094
5105
  const dismiss = item.querySelector('.ai-chat-request-dismiss');
5095
- if (dismiss) dismiss.hidden = finished;
5106
+ if (dismiss) dismiss.hidden = finished || history;
5096
5107
  // #2678: what a hidden card's line says still waits: the person (the server's "needs you", except a request only waiting
5097
5108
  // for the AI to start it), or the AI. The line says the card's own live word either way.
5098
5109
  if (finished) item.dataset.waits = 'done';
@@ -5108,7 +5119,7 @@
5108
5119
  if (!note) { note = document.createElement('p'); note.className = 'ai-chat-request-note'; note.setAttribute('role', 'status'); item.append(note); }
5109
5120
  note.textContent = entry.note;
5110
5121
  } else note?.remove();
5111
- if (entry.hold) paintRequestAsk(item, entry);
5122
+ if (entry.hold && !history) paintRequestAsk(item, entry);
5112
5123
  else item.querySelector('.ai-chat-request-ask')?.remove();
5113
5124
  }
5114
5125
 
@@ -5147,6 +5158,7 @@
5147
5158
  }
5148
5159
 
5149
5160
  async function dismissRequestFromCard(item) {
5161
+ if (state.chat?.earlierOpening) return;
5150
5162
  const requestId = item.dataset.requestId;
5151
5163
  if (!requestId) return;
5152
5164
  const entry = requestCardEntry(requestId);
@@ -5248,7 +5260,7 @@
5248
5260
  const go = button('Stop it and dismiss', `shell.chat-request-stop-dismiss#${item.dataset.requestId || 'linked request'}`, 'danger');
5249
5261
  go.disabled = Boolean(entry.busy);
5250
5262
  go.addEventListener('click', async () => {
5251
- if (entry.busy) return;
5263
+ if (entry.busy || state.chat?.earlierOpening) return;
5252
5264
  entry.busy = 'stop'; entry.askError = ''; repaintRequestCard(requestId);
5253
5265
  openFeedCard(item.dataset.cardEventId); // #2678: as Dismiss: the Undo it offers stays in front of them
5254
5266
  let stopped = true; // a stale stop means the work had already ended or changed: never claimed as "stopped"
@@ -5289,6 +5301,7 @@
5289
5301
  }
5290
5302
 
5291
5303
  async function restoreRequestFromCard(item) {
5304
+ if (state.chat?.earlierOpening) return;
5292
5305
  const requestId = item.dataset.requestId;
5293
5306
  const entry = requestCardEntry(requestId);
5294
5307
  if (entry.busy) return;
@@ -5733,7 +5746,10 @@
5733
5746
  // The card was asking a moment ago and now is not: say so once to a screen reader (an old card drawn already done stays quiet).
5734
5747
  if (entry.seenOpen && !entry.announcedConnected) announce(`${name} connected, using ${accountLabel}.`);
5735
5748
  entry.announcedConnected = true;
5736
- stateLine.textContent = `FloLess uses ${service.choice.alias ? service.choice.alias : 'the default account'} for ${name}.`;
5749
+ // #3407: an account FloLess picked itself (the only one connected) says so, and says how to use another.
5750
+ stateLine.textContent = service.choice.adopted
5751
+ ? `FloLess is using your only ${name} account. To use a different one, connect it and choose it in Integrations.`
5752
+ : `FloLess uses ${service.choice.alias ? service.choice.alias : 'the default account'} for ${name}.`;
5737
5753
  // The card checks the CHOSEN account at the choice it was painted on: the server refuses a card that is out of date.
5738
5754
  if (payload.checkAgent && alias !== undefined) {
5739
5755
  actions.append(check(alias, { integration: target, expectedChoiceRevision: service.choice.revision }));
@@ -5877,13 +5893,33 @@
5877
5893
  const current = actionProposalState(proposalId);
5878
5894
  // #2266: an unfinished card asks FloLess once whether it has moved on (see syncActionProposal).
5879
5895
  if (!entry.synced && !ACTION_FINAL.has(current.state)) { entry.synced = true; void syncActionProposal(proposalId); }
5880
- const signature = JSON.stringify([event.eventId, current.state, current.result?.message || null, current.supersededBy, current.next || null, entry.busy, entry.error]);
5896
+ const signature = JSON.stringify([event.eventId, current.state, current.result?.message || null, current.result?.note || null, current.supersededBy, current.next || null, entry.busy, actionStatusLine(entry, current)]);
5881
5897
  if (entry.node && entry.signature === signature) return entry.node;
5882
5898
  entry.node = paintActionProposal(event, payload, proposalId, entry, current);
5883
5899
  entry.signature = signature;
5884
5900
  return entry.node;
5885
5901
  }
5886
5902
 
5903
+ /**
5904
+ * #3238: what a waiting card's line says. The click was answered "confirm that card first"; once that card runs, and once
5905
+ * it has made what this card needs, the line says so with FloLess's own words for each, rather than keep a sentence that
5906
+ * is no longer true. A card that card was replaced by is followed, and waiting on the new one says to confirm it (never
5907
+ * the expired one). One that finished without naming what it made keeps the answer: FloLess ends this card then. A card
5908
+ * this window does not show keeps the answer as it came. Once this card itself has moved on (confirmed from another
5909
+ * window, say), "confirm it again" no longer applies, and the line is the card's own.
5910
+ */
5911
+ function actionStatusLine(entry, current) {
5912
+ const awaits = entry.waitingOn;
5913
+ if (!awaits) return entry.error;
5914
+ if (current.state !== 'proposed') return '';
5915
+ let id = awaits.id;
5916
+ let awaited = actionProposalState(id);
5917
+ for (let hops = 0; awaited.supersededBy && hops < ACTION_CARDS_KEPT; hops++) { id = awaited.supersededBy; awaited = actionProposalState(id); }
5918
+ if (awaited.state === 'done') return awaited.result?.made?.id ? awaits.done : entry.error;
5919
+ if (awaited.state === 'executing') return awaits.running;
5920
+ return awaited.state === 'proposed' && id !== awaits.id ? awaits.waiting : entry.error;
5921
+ }
5922
+
5887
5923
  function repaintActionCards(focusProposal) {
5888
5924
  for (const old of ui.feed?.querySelectorAll('.ai-chat-action-card[data-proposal-id]') || []) {
5889
5925
  const event = state.events.find((known) => known.eventId === old.dataset.eventId);
@@ -6047,6 +6083,10 @@
6047
6083
  if (screen?.view === 'tool-update-policy' && typeof window.openToolUpdatePolicy === 'function') {
6048
6084
  window.openToolUpdatePolicy(); return true;
6049
6085
  }
6086
+ // #3296 S1b: My add-ons, at the add-on the screen names.
6087
+ if (screen?.view === 'add-ons' && typeof window.flolessAddOns?.open === 'function') {
6088
+ window.flolessAddOns.open(screen.addOnId || undefined); return true;
6089
+ }
6050
6090
  // Requests, at the request the screen names.
6051
6091
  if (screen?.view === 'requests' && typeof window.flolessBridge?.openRequest === 'function') {
6052
6092
  await window.flolessBridge.openRequest(screen.requestId || null); return true;
@@ -6148,9 +6188,9 @@
6148
6188
 
6149
6189
  async function actOnProposal(event, proposalId, verb) {
6150
6190
  const entry = actionCards.get(proposalId);
6151
- if (!entry || entry.busy) return;
6191
+ if (!entry || entry.busy || state.chat?.earlierOpening) return;
6152
6192
  const title = String(event.payload?.title || 'the action');
6153
- entry.busy = verb; entry.error = '';
6193
+ entry.busy = verb; entry.error = ''; entry.waitingOn = null;
6154
6194
  repaintActionCards();
6155
6195
  let focus = proposalId;
6156
6196
  try {
@@ -6175,10 +6215,15 @@
6175
6215
  } else if (body.fresh) {
6176
6216
  // The target changed or the offer ended: the old card says so, and a fresh card shows the current state.
6177
6217
  entry.local = { state: body.proposal?.state || 'superseded', result: null, supersededBy: body.fresh.id };
6178
- announce(body.error || 'It changed after it was suggested. A new card shows the current state.');
6218
+ announce(personText(body) || 'It changed after it was suggested. A new card shows the current state.');
6179
6219
  } else {
6180
- if (body.proposal?.state) entry.local = { state: body.proposal.state, result: body.proposal.result || null, supersededBy: body.proposal.supersededBy || null };
6220
+ // #3238: "waiting" changed nothing about this card, so it is not kept as the card's state: a later update (another
6221
+ // window confirming it) is then not outranked by this answer's "proposed".
6222
+ if (body.proposal?.state && body.code !== 'waiting') entry.local = { state: body.proposal.state, result: body.proposal.result || null, supersededBy: body.proposal.supersededBy || null };
6181
6223
  entry.error = body.error || 'FloLess could not do that just now. Try again in a moment.';
6224
+ // #3238: "confirm that card first". The line then follows that card (actionStatusLine), so it never goes stale.
6225
+ const awaits = body.code === 'waiting' ? body.awaits : null;
6226
+ if (awaits && ['id', 'waiting', 'running', 'done'].every((key) => typeof awaits[key] === 'string')) entry.waitingOn = awaits;
6182
6227
  }
6183
6228
  } catch {
6184
6229
  entry.error = 'FloLess could not be reached. Check that it is still running, then try again.';
@@ -6199,6 +6244,11 @@
6199
6244
  card.dataset.eventSequence = String(event.sequence);
6200
6245
  card.dataset.proposalId = proposalId;
6201
6246
  card.dataset.state = current.state;
6247
+ // #3416: a card that ran folds to a line naming what it did ("File the RFI … in the project "Westgate Showroom" · Done"),
6248
+ // not the action's general title, so the line under a reply written before the click says what is now true. A done
6249
+ // card whose result says something else ran (`result.note`, #2521 row 3a) keeps the general title: its summary is
6250
+ // what was asked for, not what happened.
6251
+ if (['done', 'failed', 'unknown'].includes(current.state) && current.result?.code !== 'step-handed-over' && !current.result?.note) card.dataset.foldTitle = summaryText;
6202
6252
  card.setAttribute('role', 'group');
6203
6253
  const status = document.createElement('p');
6204
6254
  status.className = 'ai-chat-filter-note ai-chat-action-status';
@@ -6208,9 +6258,11 @@
6208
6258
  card.setAttribute('aria-labelledby', titleId);
6209
6259
 
6210
6260
  // Finished, set aside or replaced: one quiet line that says honestly what happened.
6261
+ // #3238: a card that waited for another card, which ended without making what it needed, says why.
6262
+ const ended = current.result?.code === 'card-ended' && typeof current.result.message === 'string' ? current.result.message.trim() : '';
6211
6263
  const collapsed = {
6212
6264
  declined: `Not now: ${title}`,
6213
- expired: `Offer ended: ${title}. Ask again if you still want it.`,
6265
+ expired: ended ? `Offer ended: ${title}. ${ended}` : `Offer ended: ${title}. Ask again if you still want it.`,
6214
6266
  superseded: `Replaced by a newer suggestion: ${title}`,
6215
6267
  cancelled: `Stopped: ${title}. Work already sent to the host may remain.`,
6216
6268
  }[current.state];
@@ -6247,7 +6299,11 @@
6247
6299
  named.className = 'ai-chat-action-named';
6248
6300
  named.append(eyebrow, strong);
6249
6301
  head.append(named);
6250
- const badgeText = handedOver ? 'Your turn' : { executing: 'Running', done: 'Done', failed: 'Not done', unknown: 'Unknown' }[current.state];
6302
+ // A done result that says something else ran (#2521 row 3a) is not a plain Done: the badge, and so the card's folded
6303
+ // line, says "Done differently" and the card's note says what ran.
6304
+ const doneDifferently = current.state === 'done' && typeof current.result?.note === 'string' && Boolean(current.result.note);
6305
+ const badgeText = handedOver ? 'Your turn' : doneDifferently ? 'Done differently'
6306
+ : { executing: 'Running', done: 'Done', failed: 'Not done', unknown: 'Unknown' }[current.state];
6251
6307
  if (badgeText) {
6252
6308
  const badge = document.createElement('span');
6253
6309
  badge.className = 'ai-chat-filter-state';
@@ -6282,7 +6338,7 @@
6282
6338
 
6283
6339
  if (handedOver) {
6284
6340
  card.classList.add('is-handed-over');
6285
- status.textContent = entry.error || String(current.result?.message || 'It is ready for you. Press it to finish.');
6341
+ status.textContent = actionStatusLine(entry, current) || String(current.result?.message || 'It is ready for you. Press it to finish.');
6286
6342
  card.append(status);
6287
6343
  return card;
6288
6344
  }
@@ -6293,7 +6349,7 @@
6293
6349
  // and the card's edge turns amber so the person notices their choice was not what ran.
6294
6350
  const resultNote = typeof current.result?.note === 'string' && current.result.note ? current.result.note : '';
6295
6351
  if (resultNote) card.classList.add('is-fallback');
6296
- status.textContent = entry.error || resultNote || (current.next ? 'Done. Its result is ready to view.' : String(payload.doneNote || 'Done.'));
6352
+ status.textContent = actionStatusLine(entry, current) || resultNote || (current.next ? 'Done. Its result is ready to view.' : String(payload.doneNote || 'Done.'));
6297
6353
  if (current.next) {
6298
6354
  // What the finished action made (a run's report): opening it only shows it, it runs nothing again.
6299
6355
  const actions = document.createElement('div');
@@ -6341,11 +6397,17 @@
6341
6397
  why.textContent = `Why: ${String(payload.why)}`;
6342
6398
  card.append(why);
6343
6399
  }
6400
+ // #3255: a request in a conversation from an earlier opening of the Workspace is history: it shows what was asked.
6401
+ if (state.chat?.earlierOpening) {
6402
+ status.textContent = 'Read only: this conversation is from before the Workspace was reopened.';
6403
+ card.append(status);
6404
+ return card;
6405
+ }
6344
6406
  const actions = document.createElement('div');
6345
6407
  actions.className = 'ai-chat-filter-actions';
6346
6408
  if (current.state === 'executing') {
6347
6409
  // A window step whose report did not land stays running here; what the window said (what to press) still shows.
6348
- status.textContent = entry.error || (actionId === 'workflows.run' || actionId === 'routines.run' ? 'Running…' : 'Working…');
6410
+ status.textContent = actionStatusLine(entry, current) || (actionId === 'workflows.run' || actionId === 'routines.run' ? 'Running…' : 'Working…');
6349
6411
  if (actionId === 'workflows.run') {
6350
6412
  const stop = actionButton('Stop', 'shell.chat-action-stop', proposalId, summaryText);
6351
6413
  stop.dataset.tip = 'Asks the run to stop. Work already sent to the host may remain.';
@@ -6377,7 +6439,7 @@
6377
6439
  const note = document.createElement('p');
6378
6440
  note.className = 'ai-chat-filter-note';
6379
6441
  // #2811: the one question this dialog asks only the person, said on the card that takes them there.
6380
- note.textContent = screen.view === 'new-project' ? 'In the dialog, only you decide whether the AI may choose the Drawing Filter. Nothing is made until you press Create.'
6442
+ note.textContent = screen.view === 'new-project' ? 'In the dialog, only you decide whether the AI may choose the Drawing Filter, and who picks the model origin. Nothing is made until you press Create.'
6381
6443
  : 'Only you can do this. Nothing runs from here.';
6382
6444
  status.textContent = entry.error;
6383
6445
  card.append(actions, note, status);
@@ -6398,7 +6460,7 @@
6398
6460
  meta.className = 'ai-chat-filter-note ai-chat-action-meta';
6399
6461
  meta.textContent = payload.revision === 'bound' ? 'Checked against how it is now; if it changes first, you will be asked again.'
6400
6462
  : 'Acts on things as they are when you confirm.';
6401
- status.textContent = entry.error;
6463
+ status.textContent = actionStatusLine(entry, current);
6402
6464
  card.append(actions, meta, status);
6403
6465
  return card;
6404
6466
  }
@@ -6609,7 +6671,7 @@
6609
6671
  Object.assign(document.createElement('span'), { className: 'ai-chat-readiness-assumption-meta', textContent: `About: ${a.readingText}` }),
6610
6672
  Object.assign(document.createElement('span'), { className: 'ai-chat-readiness-assumption-meta',
6611
6673
  textContent: `You confirmed this on ${readinessDate(a.confirmedAt)}.${a.proposedBy === 'ai' ? ' The AI wrote the words.' : ''}` }));
6612
- if (card.projectId) {
6674
+ if (card.projectId && !state.chat?.earlierOpening) {
6613
6675
  const withdraw = button('Withdraw', 'shell.chat-readiness-withdraw-assumption', 'ai-chat-source-action');
6614
6676
  withdraw.setAttribute('aria-label', `Withdraw assumption: ${a.statement}`);
6615
6677
  withdraw.dataset.commandInstanceLabel = `${row.jointId}: ${a.statement}`;
@@ -7109,20 +7171,38 @@
7109
7171
  return wrap;
7110
7172
  }
7111
7173
 
7112
- /** One line per action the AI ran itself from this conversation: what it was, and how it ended. */
7174
+ /**
7175
+ * #3409: an action FloLess refused before anything ran (an input it could not use, a project this chat is not working
7176
+ * on, something only a person or a card does). Nothing happened, so its row is quiet ("Not run"), never the red of a
7177
+ * real failure. It is said in the person's words rather than the words FloLess gave the AI, except a refusal FloLess
7178
+ * wrote for the person (`forPerson`: a file too large, a drive that is gone), whose own message they can act on.
7179
+ * A definition FloLess itself got wrong ('action-definition') is a real failure and stays red.
7180
+ *
7181
+ * One line per action the AI ran itself from this conversation: what it was, and how it ended.
7182
+ */
7113
7183
  function renderActionRow(event) {
7184
+ // An input refused for the person's own file or work (a file too large, a drive that is gone) shows FloLess's message
7185
+ // for them, below; any other input FloLess could not use gets this sentence, which blames no one.
7186
+ const ACTION_NOT_RUN_REASONS = {
7187
+ 'invalid-input': 'FloLess couldn’t use what was sent for this, so it didn’t run it. Nothing changed.',
7188
+ 'out-of-scope': 'The AI asked about something this chat isn’t working on, so FloLess didn’t run it. Nothing changed.',
7189
+ 'not-allowed': 'This isn’t available in this chat, so FloLess didn’t run it. Nothing changed.',
7190
+ 'human-only': 'A person does this in FloLess, so FloLess didn’t run it for the AI. Nothing changed.',
7191
+ 'in-browser': 'This runs only when you confirm its card, so FloLess didn’t run it here. Nothing changed.',
7192
+ };
7193
+ const actionNotRun = (payload) => payload.outcome === 'rejected' && payload.code !== 'action-definition';
7114
7194
  const payload = event.payload || {};
7115
7195
  if (payload.outcome === 'ok' && payload.card?.kind === 'page' && payload.card.home && payload.card.pageId) return renderPageCard(event);
7116
7196
  if (payload.outcome === 'ok' && payload.card?.kind === 'connection-readiness') return renderReadinessCard(event);
7117
7197
  const row = document.createElement('div');
7118
- const outcome = payload.outcome === 'ok' ? 'ok' : payload.outcome === 'cancelled' ? 'stopped' : 'failed';
7198
+ const outcome = payload.outcome === 'ok' ? 'ok' : payload.outcome === 'cancelled' ? 'stopped' : actionNotRun(payload) ? 'not-run' : 'failed';
7119
7199
  row.className = `ai-chat-action-row is-${outcome}`;
7120
7200
  row.dataset.eventId = event.eventId;
7121
7201
  row.dataset.eventSequence = String(event.sequence);
7122
7202
  const glyph = document.createElement('span');
7123
7203
  glyph.className = 'ai-chat-action-row-glyph';
7124
7204
  glyph.setAttribute('aria-hidden', 'true');
7125
- glyph.textContent = outcome === 'ok' ? '✓' : outcome === 'stopped' ? '■' : '!';
7205
+ glyph.textContent = outcome === 'ok' ? '✓' : outcome === 'stopped' ? '■' : outcome === 'not-run' ? '–' : '!';
7126
7206
  const verb = document.createElement('span');
7127
7207
  verb.className = 'ai-chat-action-row-verb';
7128
7208
  // "Changed" only when the change happened (#2326): a write that ended not done or stopped changed nothing.
@@ -7132,15 +7212,88 @@
7132
7212
  title.textContent = String(payload.title || payload.actionId || 'A FloLess action');
7133
7213
  const state = document.createElement('span');
7134
7214
  state.className = 'ai-chat-filter-state';
7135
- state.textContent = outcome === 'ok' ? 'Done' : outcome === 'stopped' ? 'Stopped' : 'Not done';
7215
+ state.textContent = outcome === 'ok' ? 'Done' : outcome === 'stopped' ? 'Stopped' : outcome === 'not-run' ? 'Not run' : 'Not done';
7136
7216
  row.append(glyph, verb, title, state);
7137
- if (outcome === 'failed' && payload.message) {
7217
+ // Only a message FloLess marked as written for the person (`forPerson`, from a PersonInputError) is shown; the rest
7218
+ // were addressed to the AI (which field to fix, which action lists the ids) and would read as jargon here.
7219
+ const inputMessage = payload.code === 'invalid-input' && payload.forPerson === true && typeof payload.message === 'string'
7220
+ ? payload.message.trim() : '';
7221
+ const reasonText = outcome === 'not-run'
7222
+ ? (inputMessage ? `${inputMessage}${/[.!?…]$/.test(inputMessage) ? '' : '.'} FloLess didn’t run it, so nothing changed.`
7223
+ : ACTION_NOT_RUN_REASONS[payload.code] || 'FloLess didn’t run it. Nothing changed.')
7224
+ : outcome === 'failed' && payload.message ? String(payload.message) : '';
7225
+ if (reasonText) {
7138
7226
  const reason = document.createElement('span');
7139
7227
  reason.className = 'ai-chat-action-row-reason';
7140
- reason.textContent = String(payload.message);
7228
+ reason.textContent = reasonText;
7141
7229
  row.append(reason);
7142
7230
  }
7143
- row.setAttribute('aria-label', `${verb.textContent}: ${title.textContent}, ${state.textContent.toLowerCase()}${outcome === 'failed' && payload.message ? `. ${payload.message}` : ''}`);
7231
+ row.setAttribute('aria-label', `${verb.textContent}: ${title.textContent}, ${state.textContent.toLowerCase()}${reasonText ? `. ${reasonText}` : ''}`);
7232
+ return row;
7233
+ }
7234
+
7235
+ /**
7236
+ * #3416: how a card the AI suggested ended, said where it ended. The AI's reply beside the card was written before the
7237
+ * person answered and stays as it was ("it isn't filed yet"). When the card sits right under that reply its own folded
7238
+ * line says how it ended; once the conversation has moved on past it, this line at the point the person answered says
7239
+ * it, so nothing later in the conversation still reads as waiting. Only the card's last word is shown, once. "Moved on"
7240
+ * counts the messages the card's own fold counts (`feedCardAnsweredInChat`): a request card or a message FloLess says
7241
+ * was not sent does not.
7242
+ */
7243
+ const ACTION_OUTCOME_STATES = new Set(['done', 'failed', 'unknown', 'declined', 'cancelled']);
7244
+ function renderActionOutcome(event) {
7245
+ const update = event.payload || {};
7246
+ const proposalId = String(update.proposalId || '');
7247
+ if (!proposalId || !ACTION_OUTCOME_STATES.has(update.state)) return null;
7248
+ // A step handed back for the person's last click has not happened yet: its card says so, and nothing here.
7249
+ if (update.state === 'done' && update.result?.code === 'step-handed-over') return null;
7250
+ const at = Number(event.sequence);
7251
+ let card = null;
7252
+ let movedOn = false;
7253
+ for (const other of state.events) {
7254
+ if (other.type === 'action-proposal' && String(other.payload?.proposalId || other.eventId) === proposalId) card = other;
7255
+ else if (other.type === 'action-proposal-update' && other.payload?.proposalId === proposalId && Number(other.sequence) > at) return null;
7256
+ else if (card && other.type === 'user-message' && !other.payload?.source && Number(other.sequence) > Number(card.sequence) && Number(other.sequence) < at
7257
+ && !((other.payload?.followup || other.payload?.deliveryState) && followupDelivery(other) === 'not-sent')) movedOn = true;
7258
+ }
7259
+ if (!card || !movedOn) return null;
7260
+ const summary = String(card.payload?.summary || card.payload?.title || 'A FloLess action');
7261
+ // A done result that says something else ran (a Quick read queued Precise, a sign-in that could not start, #2521
7262
+ // row 3a) is not a green Done over what was asked: it says "Done differently" and gives the result's own note.
7263
+ const resultNote = update.state === 'done' && typeof update.result?.note === 'string' ? update.result.note.trim() : '';
7264
+ const outcome = update.state === 'done' ? (resultNote ? 'fallback' : 'ok') : update.state === 'failed' ? 'failed' : 'stopped';
7265
+ const stopped = update.state === 'cancelled';
7266
+ const row = document.createElement('div');
7267
+ row.className = `ai-chat-action-row ai-chat-action-outcome is-${outcome}`;
7268
+ row.dataset.eventId = event.eventId;
7269
+ row.dataset.eventSequence = String(event.sequence);
7270
+ row.dataset.proposalId = proposalId;
7271
+ const glyph = document.createElement('span');
7272
+ glyph.className = 'ai-chat-action-row-glyph';
7273
+ glyph.setAttribute('aria-hidden', 'true');
7274
+ glyph.textContent = outcome === 'ok' ? '✓' : outcome === 'failed' || outcome === 'fallback' ? '!' : stopped ? '■' : '·';
7275
+ const verb = document.createElement('span');
7276
+ verb.className = 'ai-chat-action-row-verb';
7277
+ verb.textContent = update.state === 'declined' ? 'You chose Not now' : 'You confirmed';
7278
+ const title = document.createElement('span');
7279
+ title.className = 'ai-chat-action-row-title';
7280
+ title.textContent = summary;
7281
+ const said = document.createElement('span');
7282
+ said.className = 'ai-chat-filter-state';
7283
+ said.textContent = resultNote ? 'Done differently' : { done: 'Done', failed: 'Not done', unknown: 'Outcome unknown', declined: 'Nothing ran', cancelled: 'Stopped' }[update.state];
7284
+ row.append(glyph, verb, title, said);
7285
+ const refusal = update.state === 'failed' ? String(update.result?.message || '').trim() : '';
7286
+ const sentence = (text) => `${text.charAt(0).toUpperCase()}${text.slice(1)}${/[.!?…]$/.test(text) ? '' : '.'}`;
7287
+ const reasonText = update.state === 'unknown' ? 'FloLess restarted while it was running. Check the result before you ask for it again.'
7288
+ : stopped ? 'You stopped it before it finished. Work already sent to the host may remain.'
7289
+ : resultNote || refusal ? sentence(resultNote || refusal) : '';
7290
+ if (reasonText) {
7291
+ const reason = document.createElement('span');
7292
+ reason.className = 'ai-chat-action-row-reason';
7293
+ reason.textContent = reasonText;
7294
+ row.append(reason);
7295
+ }
7296
+ row.setAttribute('aria-label', `${verb.textContent}: ${summary}. ${said.textContent}.${reasonText ? ` ${reasonText}` : ''}`);
7144
7297
  return row;
7145
7298
  }
7146
7299
 
@@ -7440,7 +7593,8 @@
7440
7593
  card.append(line, retry);
7441
7594
  return card;
7442
7595
  }
7443
- if (!server) { card.hidden = true; return card; }
7596
+ // #3255: a suggestion made in an earlier opening of the Workspace can no longer be used, so it is not offered.
7597
+ if (!server || state.chat?.earlierOpening) { card.hidden = true; return card; }
7444
7598
 
7445
7599
  const status = assistantNode('p', 'ai-chat-filter-note ai-chat-action-status assistant-card-status');
7446
7600
  status.setAttribute('role', 'status');
@@ -7684,7 +7838,7 @@
7684
7838
  }
7685
7839
 
7686
7840
  async function useAssistantCard(entry, text) {
7687
- if (entry.busy) return;
7841
+ if (entry.busy || state.chat?.earlierOpening) return;
7688
7842
  const chatId = entry.event.chatId;
7689
7843
  // #2678: the person's own click holds the card open (a read's result is shown on it), counted from the click so a
7690
7844
  // collapse while it is answered still wins.
@@ -7798,7 +7952,7 @@
7798
7952
  }
7799
7953
 
7800
7954
  async function dismissAssistantCard(entry, title, how) {
7801
- if (entry.busy) return;
7955
+ if (entry.busy || state.chat?.earlierOpening) return;
7802
7956
  entry.busy = how; entry.error = '';
7803
7957
  repaintAssistantCard(entry);
7804
7958
  try {
@@ -7817,7 +7971,7 @@
7817
7971
  }
7818
7972
 
7819
7973
  async function bringBackAssistantCard(entry, title) {
7820
- if (entry.busy) return;
7974
+ if (entry.busy || state.chat?.earlierOpening) return;
7821
7975
  entry.busy = 'undo'; entry.error = '';
7822
7976
  repaintAssistantCard(entry);
7823
7977
  try {
@@ -8057,7 +8211,7 @@
8057
8211
  */
8058
8212
  function feedCardSentence(node, kind, mark) {
8059
8213
  const words = String((node.matches('.ai-chat-request-card') ? node.querySelector('p')?.textContent
8060
- : node.getAttribute('aria-label') || node.querySelector('strong, .ai-chat-message-body, p')?.textContent) || node.textContent || '')
8214
+ : node.dataset.foldTitle || node.getAttribute('aria-label') || node.querySelector('strong, .ai-chat-message-body, p')?.textContent) || node.textContent || '')
8061
8215
  .replace(/\s+/g, ' ').trim();
8062
8216
  const cut = (text, max) => (text.length > max ? `${text.slice(0, max).replace(/\s+\S*$/, '').replace(/[\s·,;:.-]+$/, '')}…` : text);
8063
8217
  const title = cut(words, 70);
@@ -8215,7 +8369,8 @@
8215
8369
  // #2046: a next move the Guide suggested; web/guide.js paints it and owns its button.
8216
8370
  // #2399 PR C2: a next step the assistant suggested in a project, workflow or workspace chat; this file paints it.
8217
8371
  if (event.type === 'next-move' && event.payload?.assistant === true) return renderAssistantCard(event);
8218
- if (event.type === 'next-move') return window.flolessGuide?.renderNextMove?.(event) || null;
8372
+ // #3255: a next move from an earlier opening of the Workspace can no longer be taken, so it is not offered.
8373
+ if (event.type === 'next-move') return state.chat?.earlierOpening ? null : window.flolessGuide?.renderNextMove?.(event) || null;
8219
8374
  // #2185: what came of a card's button repaints that card; it is never a line of its own.
8220
8375
  if (event.type === 'next-move-update') { window.flolessGuide?.applyMoveUpdate?.(event); return null; }
8221
8376
  if (event.type === 'approval-decided' && event.payload?.automatic === true && event.payload?.connectionCheck) return renderConnectionCheckAllowed(event);
@@ -9795,8 +9950,9 @@
9795
9950
  } else if (row.kind === 'origin') {
9796
9951
  q.otherInputLabel = 'Grid crossing (optional)'; q.otherPlaceholder = 'A/1'; q.otherUncapped = true;
9797
9952
  q.question = 'Which grid crossing is the model’s origin (0, 0)?'; q.layout = 'grid'; q.confirmSelection = true;
9798
- row.choices.forEach((choice, index) => { q.options.push({ shown: originText(choice), description: 'A straight grid crossing in the model', confirmLabel: `Confirm ${originText(choice)} as the model origin`, tag: row.proposed === index ? 'THE READ SUGGESTS' : '' }); choices.push({ key, action: 'confirm', choice: `c${index}`, shown: originText(choice) }); });
9799
- row.offGrid.forEach((point, index) => { const target = row.choices[point.same]; q.options.push({ shown: point.as, description: 'Not a straight grid line; check the read’s mapping', confirmLabel: `Confirm ${originText(target)} as the model origin`, statement: `${point.as} is not a straight grid line in the model. The read says it is the same point as ${originText(target)} (${point.why}). This is the read’s claim; FloLess has not checked it.` }); choices.push({ key, action: 'confirm', choice: `o${index}`, shown: originText(target) }); });
9953
+ // #2909 V4: a crossing past a grid line's end may still be chosen; the card says so before it can be confirmed.
9954
+ row.choices.forEach((choice, index) => { q.options.push({ shown: originText(choice), description: 'A straight grid crossing in the model', confirmLabel: `Confirm ${originText(choice)} as the model origin`, tag: row.proposed === index ? 'THE READ SUGGESTS' : '', ...(choice.offSegment?.why ? { statement: choice.offSegment.why } : {}) }); choices.push({ key, action: 'confirm', choice: `c${index}`, shown: originText(choice) }); });
9955
+ row.offGrid.forEach((point, index) => { const target = row.choices[point.same]; q.options.push({ shown: point.as, description: 'Not a straight grid line; check the read’s mapping', confirmLabel: `Confirm ${originText(target)} as the model origin`, statement: `${point.as} is not a straight grid line in the model. The read says it is the same point as ${originText(target)} (${point.why}). This is the read’s claim; FloLess has not checked it.${target?.offSegment?.why ? ` ${target.offSegment.why}` : ''}` }); choices.push({ key, action: 'confirm', choice: `o${index}`, shown: originText(target) }); });
9800
9956
  q.recommended = Number.isInteger(row.proposed) ? row.proposed : null;
9801
9957
  if (row.fromEvidence) q.context.push(row.inherited?.length ? 'The read’s reading of your picture. Check it before you confirm.' : 'The read’s reading of your note. Check it before you confirm.');
9802
9958
  } else {
@@ -9811,6 +9967,12 @@
9811
9967
  description: row.kind === 'scale' ? proposal.evidence : levelEvidence(proposal), tag: proposal.source === 'read-of-picture' && !row.inherited?.length ? 'THE READ’S READING OF YOUR NOTE' : (row.kind === 'scale' ? scaleTag : levelTag)[proposal.source] || 'PROPOSED' }); choices.push({ key, action: 'confirm', choice: proposal.id, shown: row.kind === 'scale' ? proposal.mmPerPx : proposal.value }); });
9812
9968
  }
9813
9969
  if (kind === 'setup' && (row.kind === 'origin' || row.kind === 'scale')) q.context.push('This setup question has no saved drawing location. Inspect the drawing set in Drawing Filter, or ask the read to point out the context.');
9970
+ // #2909 (owner ruling 2026-11-08): in a Quick read whose person chose to pick the origin, they can hand it back.
9971
+ // A real answer with a recorded outcome, so it comes before the "None of these" escape hatch (UX review).
9972
+ if (kind === 'setup' && row.kind === 'origin' && entry.view?.originHandBack === true) {
9973
+ q.options.push({ shown: 'Let the AI choose', description: SETUP_HANDBACK_WORDS, confirmLabel: 'Let the AI choose the model origin', tag: '' });
9974
+ choices.push({ key, action: 'to-ai' });
9975
+ }
9814
9976
  if (kind === 'setup' && row.kind !== 'scale') { q.options.push({ shown: row.kind === 'origin' ? 'None of these' : 'No single level', description: 'Tell the read what to use instead', requiresNote: { placeholder: 'Say why, and what to use instead', max: MAX_HEIGHT_CLARIFICATION } }); choices.push({ key, action: 'none' }); }
9815
9977
  if (kind === 'setup') { const banner = setupConflictBanner(row); if (banner) q.context.push(banner.textContent); }
9816
9978
  const controlKey = kind === 'height' ? `${row.memberId} ${row.endWord}` : key;
@@ -9893,7 +10055,8 @@
9893
10055
  const showing = tray.querySelector('.ai-chat-drawing-step');
9894
10056
  const heldFocus = showing?.contains(document.activeElement) ? document.activeElement : null;
9895
10057
  // A hidden approval or AI question still holds the slot (Codex review round 3): its line is not an .ai-chat-approval.
9896
- if (state.chat?.pendingApproval || tray.querySelector('.ai-chat-approval:not(.ai-chat-approval-scope):not(.ai-chat-drawing-step), .ai-chat-approval-hidden')) { showing?.remove(); return false; }
10058
+ // #3255: nothing in a conversation from an earlier opening of the Workspace waits for an answer.
10059
+ if (state.chat?.earlierOpening || state.chat?.pendingApproval || tray.querySelector('.ai-chat-approval:not(.ai-chat-approval-scope):not(.ai-chat-drawing-step), .ai-chat-approval-hidden')) { showing?.remove(); return false; }
9897
10060
  const entries = [...setupCards.values()].map((entry) => ({ kind: 'setup', entry })).concat([...heightCards.values()].map((entry) => ({ kind: 'height', entry })))
9898
10061
  .filter(({ entry }) => drawingEntryCurrent(entry) && entry.view?.open && !entry.reloadPending && !entry.loading)
9899
10062
  .sort((a, b) => (drawingEntryHeld(b.entry) ? b.entry.reopenedAt || 0 : 0) - (drawingEntryHeld(a.entry) ? a.entry.reopenedAt || 0 : 0) || a.entry.sequence - b.entry.sequence);
@@ -9993,6 +10156,7 @@
9993
10156
  else if (step.key === 'batch-value') name = 'bulk-confirm';
9994
10157
  else if (step.row?.kind === 'origin' && step.actions[extra]?.action === 'confirm') { name = 'origin-choice'; suffix += ` ${step.actions[extra].choice}`; instance = step.question.options[extra].shown; }
9995
10158
  else if (step.actions?.[extra]?.action === 'none') name = 'none';
10159
+ else if (step.actions?.[extra]?.action === 'to-ai') name = 'handback';
9996
10160
  else { name = 'confirm'; if (step.actions?.[extra]?.choice) suffix += ` ${step.actions[extra].choice}`; }
9997
10161
  } else if (what === 'group') { name = 'select-group'; const groups = [...new Set(step.rows.map((row) => row.group).filter(Boolean))]; suffix = groups[extra]; instance = suffix; }
9998
10162
  else if (what === 'other-input') name = step.key === 'batch-value' ? 'bulk-input' : 'input';
@@ -10003,6 +10167,7 @@
10003
10167
  if (step.key === 'batch-select') name = 'bulk-next';
10004
10168
  else if (step.key === 'batch-value') name = !draft.rows[0].choices.length && !draft.rows[0].other.trim() && hasAnswerSource(step.scope) ? 'bulk-evidence' : 'bulk-use';
10005
10169
  else if (step.actions?.[draft.rows[0].choices[0]]?.action === 'none') name = 'none-save';
10170
+ else if (step.actions?.[draft.rows[0].choices[0]]?.action === 'to-ai') name = 'handback-confirm';
10006
10171
  else if (!draft.rows[0].choices.length && !draft.rows[0].other.trim() && hasAnswerSource(step.scope)) name = 'evidence';
10007
10172
  else name = step.row?.kind === 'origin' && !draft.rows[0].otherOpen ? 'origin-confirm' : 'use';
10008
10173
  }
@@ -10161,7 +10326,9 @@
10161
10326
  || rememberCard(entry, paintSetupCard(entry, event.eventId, String(event.sequence)), event.eventId, String(event.sequence));
10162
10327
  }
10163
10328
 
10164
- const setupSettled = (row) => row.status === 'settled';
10329
+ // #2909: handing the origin to the AI is the person's whole answer to that row; the AI's decision is the read's to make.
10330
+ const setupSettled = (row) => row.status === 'settled' || row.status === 'handed-to-ai';
10331
+ const SETUP_HANDBACK_WORDS = 'The AI uses the bottom-left grid intersection when every plan view is upright and the grid is straight; otherwise it picks one and records why. Its choice is labelled as the AI\u2019s.';
10165
10332
  const setupLive = (row) => row.status !== 'superseded';
10166
10333
  const scaleTag = { floless: 'FLOLESS FIT', 'floless-candidate': 'FLOLESS CANDIDATE', 'floless-scale-bar': 'THE SHEET’S SCALE BAR', read: 'THE READ’S MEASUREMENT', 'read-of-picture': 'THE READ’S READING OF YOUR PICTURE' };
10167
10334
  const levelTag = { 'drawing-text': 'ON THE DRAWING', 'drawing-picture': 'READ OFF THE PICTURE · NOT CHECKED', 'read-of-picture': 'THE READ’S READING OF YOUR PICTURE' };
@@ -10172,6 +10339,7 @@
10172
10339
  const a = row.answer;
10173
10340
  if (!a) return '';
10174
10341
  if (row.kind === 'origin') {
10342
+ if (a.how === 'handed-to-ai') return 'You let the AI choose the model origin';
10175
10343
  if (a.how === 'none') return `None of these: ${a.note}`;
10176
10344
  return `${originText(a.origin)}${a.origin.pickedAs ? ` (you picked ${a.origin.pickedAs})` : ''}${a.how === 'typed' ? ', typed' : ''}`;
10177
10345
  }
@@ -10225,7 +10393,7 @@
10225
10393
  const changing = entry.changing.has(row.key);
10226
10394
  if (row.answer && !changing && row.status !== 'picture') {
10227
10395
  const done = document.createElement('div'); done.className = 'ai-chat-height-answered';
10228
- const glyph = document.createElement('span'); glyph.className = 'ai-chat-height-glyph'; glyph.textContent = row.status === 'settled' ? '✓' : '…'; glyph.setAttribute('aria-hidden', 'true');
10396
+ const glyph = document.createElement('span'); glyph.className = 'ai-chat-height-glyph'; glyph.textContent = setupSettled(row) ? '✓' : '…'; glyph.setAttribute('aria-hidden', 'true');
10229
10397
  const text = document.createElement('span');
10230
10398
  text.textContent = row.status === 'needs-new-choices' ? `${setupAnswerText(row)}. Waiting for the read to offer other points.` : setupAnswerText(row);
10231
10399
  done.append(glyph, text);
@@ -10665,7 +10833,7 @@
10665
10833
  const ownerKey = scopeKey(state.scope);
10666
10834
  if (!ownerKey) return false;
10667
10835
  Promise.resolve(openConversation(link.chatId, { messageEventId: link.messageEventId, ownerKey }))
10668
- .catch((error) => { window.showToast?.(error?.message || 'That conversation could not be opened. Try Show in chat again.', 'info'); });
10836
+ .catch((error) => { window.showToast?.(errorText(error, { action: 'open that conversation', retrySafe: true }), 'info'); });
10669
10837
  return true;
10670
10838
  }
10671
10839
 
@@ -10992,13 +11160,21 @@
10992
11160
  if (node) { if (links.length && links[0].turnId !== turnId) flushLinks(); links.push({ turnId, node }); }
10993
11161
  };
10994
11162
  const flushLinks = () => { if (links.length) { ui.feed.append(...receiptFold(links)); links = []; } };
11163
+ // #3416: how a card ended is said after the answer group it arrived during, in the order the cards ended: drawn
11164
+ // before the person's next message, or at the end. An update never starts or ends an answer group itself.
11165
+ let outcomes = [];
11166
+ const flushOutcomes = () => { if (outcomes.length) { ui.feed.append(...outcomes); outcomes = []; } };
10995
11167
  const signInError = errorNeedingSignIn();
10996
11168
  for (const event of state.events) {
10997
11169
  // #2642/#2643: the person's assumption or chosen source is painted on its claim's chip; it never starts or ends an answer group (it has no turn).
10998
11170
  if (event.type === 'citation-assumption' || event.type === 'citation-choice') continue;
11171
+ // #2247: an update to an action card only changes its card (which reads it when it repaints); #3416: once the
11172
+ // conversation has moved past the card, its outcome line is queued (see flushOutcomes).
11173
+ if (event.type === 'action-proposal-update') { const line = renderActionOutcome(event); if (line) outcomes.push(line); continue; }
10999
11174
  // A follow-up can share its provider turn with the preceding answer. Its question still
11000
11175
  // starts a new visible answer group, after that answer's text and held receipts (#2505).
11001
11176
  if (event.type === 'user-message' || (links.length && event.turnId !== links[0].turnId)) { flushAssistant(); flushLinks(); }
11177
+ if (event.type === 'user-message') flushOutcomes();
11002
11178
  if (event.type === 'assistant-message' && event.payload?.delta) {
11003
11179
  // Codex keeps a stable item id while Claude's SDK may assign one per stream packet.
11004
11180
  // Same-turn deltas stay in one visible answer. Tools separate progress paragraphs;
@@ -11044,7 +11220,6 @@
11044
11220
  if (event.type === 'next-move-update') { renderEvent(event); continue; }
11045
11221
  // #2247: an action suggestion or an action the AI ran is held under the answer, like the cards above; an update
11046
11222
  // only changes its card (which reads it when it repaints).
11047
- if (event.type === 'action-proposal-update') continue;
11048
11223
  if (event.type === 'action-proposal' || event.type === 'action-call') { links.push({ turnId: event.turnId, node: feedCard(renderEvent(event), event) }); continue; }
11049
11224
  // #2255: a model view change is written mid-answer while the tool waits, so it is held under the answer too.
11050
11225
  if (event.type === 'view-command') { links.push({ turnId: event.turnId, node: renderEvent(event), event }); continue; }
@@ -11070,6 +11245,7 @@
11070
11245
  }
11071
11246
  flushAssistant();
11072
11247
  flushLinks();
11248
+ flushOutcomes();
11073
11249
  // #2399: an Instructor answer the person keeps talking to offers to continue with tools, under its latest reply.
11074
11250
  const continueRow = renderInstructorContinue();
11075
11251
  if (continueRow) ui.feed.append(continueRow);
@@ -11332,7 +11508,8 @@
11332
11508
  shell.dataset.approvalPending = String(Boolean(approval) && !deciding);
11333
11509
  // #2223 Revision 6: a question Codex asked without waiting, while no approval holds the slot — a blocking question or an
11334
11510
  // action the AI is waiting on always goes first, and this one shows once it has settled. The chat is waiting on the person.
11335
- const asking = approval ? null : openAsyncQuestion(state.events, state.chat);
11511
+ // #3255: a question from an earlier opening of the Workspace is history; nobody can answer it there.
11512
+ const asking = approval || state.chat?.earlierOpening ? null : openAsyncQuestion(state.events, state.chat);
11336
11513
  if (asking) shell.dataset.approvalPending = 'true';
11337
11514
  document.dispatchEvent(new CustomEvent('floless:chat-indicator'));
11338
11515
  const waiting = asking || (approval && !deciding ? approval : null);
@@ -12175,7 +12352,8 @@
12175
12352
  const turn = state.chat?.activeTurn;
12176
12353
  // #2162: a session grant belongs to the conversation, so it shows whatever the turn is doing, and instead of the
12177
12354
  // request strip, which it contains.
12178
- const session = state.chat?.sessionApproval;
12355
+ // #3255: what an earlier opening allowed is not live: it is not shown as a permission with Revoke.
12356
+ const session = state.chat?.earlierOpening ? null : state.chat?.sessionApproval;
12179
12357
  if (session) { paintSessionApprovalScope(existing, session); return; }
12180
12358
  if (!turn?.accessApprovalGranted || !['running', 'awaiting-approval'].includes(state.chat?.state)) {
12181
12359
  existing?.remove(); return;
@@ -13246,7 +13424,8 @@
13246
13424
  current = { mode: body.mode, recovered: body.recovered === true }; publish();
13247
13425
  announce(`Suggest next steps: ${SUGGEST_LABELS[body.mode] || body.mode}.`);
13248
13426
  } catch (error) {
13249
- announce(error?.message || 'FloLess couldn’t save that just now. Try again in a moment.');
13427
+ // Choosing a setting again sets the same value, so a retry is safe.
13428
+ announce(errorText(error, { action: 'save that setting', retrySafe: true }));
13250
13429
  }
13251
13430
  },
13252
13431
  choices() {
@@ -13279,7 +13458,7 @@
13279
13458
  if (ui.scopeControls) paintScopeControl();
13280
13459
  paintSuggestSetting();
13281
13460
  const chat = state.chat;
13282
- ui.settingsToggle.disabled = !chat;
13461
+ ui.settingsToggle.disabled = !chat || Boolean(chat?.earlierOpening);
13283
13462
  const answer = capabilityAnswer(state.capability);
13284
13463
  const pendingSignIn = Boolean(chat && state.signInPending.has(chat.provider));
13285
13464
  const accountLabel = chat ? providerAccountLabel(chat.provider, answer) : '—';
@@ -13309,7 +13488,7 @@
13309
13488
  ui.permission.dataset.tip = instructorChat
13310
13489
  ? 'This chat answers an Instructor question, so the AI can’t read files, run commands, search the web or use your connectors. Choose an Access to turn it into an ordinary chat. FloLess asks first.'
13311
13490
  : accessTip(chat);
13312
- // #2234: the Guide's Access is chosen like any conversation's (it starts Read only). Its own controls — the morning
13491
+ // #2234: the Guide's Access is chosen like any conversation's (#3406: it starts on Auto). Its own controls — the morning
13313
13492
  // briefing, set-aside suggestions, Turn off and Delete history — keep their cell, shown only in a Guide conversation.
13314
13493
  const guideChat = chat?.initiator?.kind === 'guide';
13315
13494
  if (ui.guideAccess) ui.guideAccess.hidden = !guideChat;
@@ -13428,12 +13607,13 @@
13428
13607
  const chat = state.chat;
13429
13608
  if (!chat) { providerChooser(); paintHistory(); return; }
13430
13609
  ui.historyToggle.disabled = false;
13431
- ui.refresh.disabled = false;
13610
+ // #3255: an earlier opening's conversation is read only: nothing in its header changes it.
13611
+ ui.refresh.disabled = Boolean(chat?.earlierOpening);
13432
13612
  ui.title.textContent = chat.title;
13433
13613
  ui.scope.textContent = `${state.scope.label} · ${providerLabels[chat.provider]}`;
13434
- ui.rename.hidden = Boolean(chat.activeTurn) || Boolean(chat.archivedAt);
13435
- ui.input.disabled = Boolean(chat.archivedAt) || chat.state === 'recovery' || requestExecutionBlocked();
13436
- const draft = draftForChat(chat);
13614
+ ui.rename.hidden = Boolean(chat.activeTurn) || Boolean(chat.archivedAt) || Boolean(chat?.earlierOpening);
13615
+ ui.input.disabled = Boolean(chat.archivedAt) || chat.state === 'recovery' || requestExecutionBlocked() || Boolean(chat?.earlierOpening);
13616
+ const draft = chat?.earlierOpening ? '' : draftForChat(chat);
13437
13617
  if (ui.input.value !== draft && document.activeElement !== ui.input) ui.input.value = draft;
13438
13618
  const active = turnIsVisiblyActive(chat);
13439
13619
  ui.stop.hidden = !active || Boolean(chat.activeTurn?.local);
@@ -13497,7 +13677,8 @@
13497
13677
 
13498
13678
  function connectEvents() {
13499
13679
  closeSource();
13500
- if (!state.chat || !state.scope) return;
13680
+ // #3255: an earlier opening's conversation has nothing live to stream.
13681
+ if (!state.chat || !state.scope || state.chat?.earlierOpening) return;
13501
13682
  const chatId = state.chat.chatId;
13502
13683
  const scope = state.scope;
13503
13684
  const generation = state.scopeGeneration;
@@ -13847,7 +14028,9 @@
13847
14028
  if (exactQuestion) window.showToast?.(gone, 'info');
13848
14029
  return;
13849
14030
  }
13850
- const [capability, desktop] = await Promise.all([readCapability(chat), readDesktopCapability(chat)]);
14031
+ // #3255: a conversation from an earlier opening asks the AI app nothing: it is only read.
14032
+ const [capability, desktop] = chat?.earlierOpening ? [null, null]
14033
+ : await Promise.all([readCapability(chat), readDesktopCapability(chat)]);
13851
14034
  if (generation !== state.scopeGeneration || selection !== state.selectionGeneration) return;
13852
14035
  // Reopened while this conversation was opening: the person has moved on to the history, so
13853
14036
  // it stays open — with any rename in it — and focus stays where they put it (#1646).
@@ -13861,8 +14044,8 @@
13861
14044
  reconcileUnknownFollowupOnSelection(chat);
13862
14045
  state.capability = capability;
13863
14046
  state.desktop = desktop;
13864
- state.attachments = composerDrafts(chat);
13865
- ui.input.value = draftForChat(chat);
14047
+ state.attachments = chat?.earlierOpening ? [] : composerDrafts(chat);
14048
+ ui.input.value = chat?.earlierOpening ? '' : draftForChat(chat);
13866
14049
  // A cached draft may be newer than the server draft after a fast switch.
13867
14050
  // Save it now, even if the user does not type again after reopening.
13868
14051
  if (state.backgroundDrafts.has(chatId) && draftFitsStorage(state.scope.owner, ui.input.value)) saveDraftSoon();
@@ -13873,11 +14056,11 @@
13873
14056
  }, 2600);
13874
14057
  }
13875
14058
  paintConversation(); connectEvents();
13876
- if (options.applyProviderDefaults || !chat.nativeSessionId) await applyProviderDefaults(chatId);
14059
+ if (!chat?.earlierOpening && (options.applyProviderDefaults || !chat.nativeSessionId)) await applyProviderDefaults(chatId);
13877
14060
  // Let the server prepare the provider for the next message while the user types, after the
13878
14061
  // default model and effort are saved so the prepared runtime matches the first message. Best-effort:
13879
14062
  // the server decides whether a runtime can be prepared; nothing here waits on it.
13880
- if (providerReady()) void request(`/api/chat/conversations/${encodeURIComponent(chatId)}/warm`, {
14063
+ if (providerReady() && !chat?.earlierOpening) void request(`/api/chat/conversations/${encodeURIComponent(chatId)}/warm`, {
13881
14064
  method: 'POST', body: JSON.stringify({ owner: state.scope.owner }),
13882
14065
  }).catch(() => { /* a missed warm-up only means a slower first message */ });
13883
14066
  if (answerTarget) {
@@ -13919,7 +14102,8 @@
13919
14102
  || chat.draft?.trim() === uncertain.text.trim()) {
13920
14103
  state.localDraft = { chatId, text: '' };
13921
14104
  chat.draft = '';
13922
- void writeChatDraft(chatId, state.scope.owner, '').catch(error => report(error, 'Draft was not saved'));
14105
+ // #3255: opening an earlier opening's conversation writes nothing into it.
14106
+ if (!chat?.earlierOpening) void writeChatDraft(chatId, state.scope.owner, '').catch(error => report(error, 'Draft was not saved'));
13923
14107
  }
13924
14108
  } else {
13925
14109
  state.followupUnknownId = uncertain.submissionId;
@@ -14044,7 +14228,9 @@
14044
14228
  const host = ui.workspaceUnits;
14045
14229
  if (!host) return;
14046
14230
  const chat = state.chat;
14047
- if (state.scope?.owner?.kind !== 'workspace' || !chat || chat.archivedAt) { dropUnitsMenu(); host.hidden = true; host.replaceChildren(); delete host.dataset.painted; return; }
14231
+ // #3255: the receipts of a conversation from an earlier opening still read in its own units; only the menu is hidden.
14232
+ if (state.scope?.owner?.kind === 'workspace' && chat?.earlierOpening) state.displayUnits = workspaceUnitsOf(chat);
14233
+ if (state.scope?.owner?.kind !== 'workspace' || !chat || chat.archivedAt || chat.earlierOpening) { dropUnitsMenu(); host.hidden = true; host.replaceChildren(); delete host.dataset.painted; return; }
14048
14234
  // The receipts' units follow the conversation's own (chosen, else suggested) — set here, where the chat is known.
14049
14235
  state.displayUnits = workspaceUnitsOf(chat);
14050
14236
  const units = chat.workspaceUnits || {};
@@ -14134,6 +14320,7 @@
14134
14320
  }
14135
14321
 
14136
14322
  async function chooseWorkspaceUnits(value) {
14323
+ if (state.chat?.earlierOpening) return;
14137
14324
  const snapshot = captureChat();
14138
14325
  if (!snapshot) return;
14139
14326
  try {
@@ -14414,6 +14601,8 @@
14414
14601
  }
14415
14602
 
14416
14603
  async function saveSettings(patch, options = {}) {
14604
+ // #3255: nothing in an earlier opening's conversation is changed.
14605
+ if (state.chat?.earlierOpening) return;
14417
14606
  let snapshot = captureChat();
14418
14607
  if (!snapshot) return;
14419
14608
  // #2059: giving an Instructor answer tools asks first; the server refuses it without this confirmation.
@@ -14705,7 +14894,8 @@
14705
14894
  // A provider FloLess is still setting up cannot take a message; the runtime card explains why.
14706
14895
  const settingUp = Boolean(state.capability?.runtime && state.capability.runtime.state !== 'installed');
14707
14896
  const uploading = Boolean(state.chat?.chatId && state.uploadingChatIds.has(state.chat.chatId));
14708
- ui.input.disabled = state.followupSubmitting || !state.chat || Boolean(state.chat?.archivedAt) || recovery || blocked;
14897
+ const history = Boolean(state.chat?.earlierOpening);
14898
+ ui.input.disabled = state.followupSubmitting || !state.chat || Boolean(state.chat?.archivedAt) || recovery || blocked || history;
14709
14899
  // #1890 PR 3b: while the conversation moves, typing goes on (the draft is kept) and Send waits. Inline, not a helper:
14710
14900
  // several harnesses run this function on its own.
14711
14901
  const movingTo = state.chat?.rehome && ['freezing', 'copying', 'publishing'].includes(state.chat.rehome.state)
@@ -14721,10 +14911,10 @@
14721
14911
  ui.send.disabled = state.loading || state.followupSubmitting || Boolean(state.followupUnknownId) || hasUnknownFollowup() || uploading || !state.chat || blocked || frozen
14722
14912
  || (!ui.input.value.trim() && state.attachments.length === 0
14723
14913
  && !(state.mentions?.[state.chat?.chatId]?.length)) || settingUp;
14724
- if (moving) ui.send.disabled = true;
14914
+ if (moving || history) ui.send.disabled = true;
14725
14915
  // The paperclip is the same on every surface, the Drawing Filter included (#1681, #1859): a message
14726
14916
  // there carries the filter's context AND whatever the person attached, under the general rules only.
14727
- ui.attach.disabled = state.loading || state.followupSubmitting || Boolean(state.followupUnknownId) || hasUnknownFollowup() || uploading || !state.chat || blocked || frozen;
14917
+ ui.attach.disabled = state.loading || state.followupSubmitting || Boolean(state.followupUnknownId) || hasUnknownFollowup() || uploading || !state.chat || blocked || frozen || history;
14728
14918
  // Repainted here too: this runs on a surface switch, which changes what may be attached without
14729
14919
  // changing the attachments themselves.
14730
14920
  paintAttachControl();
@@ -14733,7 +14923,9 @@
14733
14923
  const sendingReason = state.followupSubmitting
14734
14924
  ? 'FloLess is saving this message. Wait for its delivery status before sending another.' : null;
14735
14925
  for (const control of [ui.send, ui.attach]) {
14736
- if (unknownReason || sendingReason) control.dataset.blockedReason = unknownReason || sendingReason;
14926
+ // #3255: Instructor says why Send and the paperclip are off in an earlier opening's conversation.
14927
+ const historyReason = history ? 'Read only: this conversation is from before the Workspace was reopened.' : null;
14928
+ if (unknownReason || sendingReason || historyReason) control.dataset.blockedReason = unknownReason || sendingReason || historyReason;
14737
14929
  else delete control.dataset.blockedReason;
14738
14930
  }
14739
14931
  ui.stop.hidden = !active || Boolean(state.chat?.activeTurn?.local);
@@ -14741,7 +14933,7 @@
14741
14933
  ui.send.hidden = false;
14742
14934
  // Session recovery must remain available even while provider capability discovery is loading
14743
14935
  // or has failed; it is the escape hatch for that exact state.
14744
- ui.refresh.disabled = !state.chat;
14936
+ ui.refresh.disabled = !state.chat || history;
14745
14937
  clearReport();
14746
14938
  paintFloLessContext();
14747
14939
  }
@@ -14763,7 +14955,7 @@
14763
14955
 
14764
14956
  function saveDraftSoon() {
14765
14957
  clearTimeout(state.draftTimer);
14766
- if (!state.chat) return;
14958
+ if (!state.chat || state.chat?.earlierOpening) return;
14767
14959
  const chatId = state.chat.chatId;
14768
14960
  const draft = ui.input.value;
14769
14961
  state.localDraft = { chatId, text: draft };
@@ -15071,8 +15263,9 @@
15071
15263
  // Repaints run on every filter change; keep keyboard focus on the same control when it survives.
15072
15264
  const focused = actions.contains(document.activeElement) ? document.activeElement.dataset.commandId : null;
15073
15265
  actions.replaceChildren();
15074
- if (!info.known) {
15075
- // Nothing here can act on a suggestion this page never recorded; the note says why.
15266
+ if (!info.known || state.chat?.earlierOpening) {
15267
+ // Nothing here can act on a suggestion this page never recorded, or on one from an earlier opening of the
15268
+ // Workspace (#3255); the note says why.
15076
15269
  } else if (disposition === 'pending' && hasChanges) {
15077
15270
  const unavailable = info.applicable ? null : info.reason || FILTER_NOT_OPEN;
15078
15271
  const keep = filterActionButton('Keep current', 'keep', requestId, 'ai-chat-filter-keep', info.known && info.open ? null : unavailable);
@@ -15094,20 +15287,22 @@
15094
15287
  const requestId = String(event.payload.requestId || '');
15095
15288
  // Re-resolve the page at click time: the frame may have reloaded since this card was painted.
15096
15289
  const surface = filterSurface();
15097
- let result;
15098
- if (surface.state !== 'ready') result = { ok: false, message: FILTER_NOT_OPEN };
15290
+ // `outcome.message` is the Drawing Filter bridge's own sentence for the person (its apply / undo / keep answer), not
15291
+ // a thrown error's text.
15292
+ let outcome;
15293
+ if (surface.state !== 'ready') outcome = { ok: false, message: FILTER_NOT_OPEN };
15099
15294
  else {
15100
15295
  try {
15101
- result = action === 'apply' ? surface.bridge.apply(requestId, event.payload.filterAi.proposal)
15296
+ outcome = action === 'apply' ? surface.bridge.apply(requestId, event.payload.filterAi.proposal)
15102
15297
  : action === 'undo' ? surface.bridge.undo(requestId) : surface.bridge.keep(requestId);
15103
15298
  } catch (error) {
15104
15299
  console.error('[chat] the Drawing Filter could not finish a suggestion action:', error);
15105
- result = { ok: false, message: 'FloLess could not finish this in the Drawing Filter. Check its ticks before you save, and reload the Drawing Filter if they look wrong.' };
15300
+ outcome = { ok: false, message: 'FloLess could not finish this in the Drawing Filter. Check its ticks before you save, and reload the Drawing Filter if they look wrong.' };
15106
15301
  }
15107
15302
  }
15108
- if (result?.ok) state.filterCardMessages.delete(requestId);
15109
- else state.filterCardMessages.set(requestId, result?.message || FILTER_NOT_OPEN);
15110
- announce(result?.message || FILTER_NOT_OPEN);
15303
+ if (outcome?.ok) state.filterCardMessages.delete(requestId);
15304
+ else state.filterCardMessages.set(requestId, outcome?.message || FILTER_NOT_OPEN);
15305
+ announce(outcome?.message || FILTER_NOT_OPEN);
15111
15306
  refreshFilterCards();
15112
15307
  const card = ui.feed.querySelector(`.ai-chat-filter-card[data-request-id="${CSS.escape(requestId)}"]`);
15113
15308
  (card?.querySelector('.ai-chat-filter-actions button') || card?.querySelector('.ai-chat-filter-note'))?.focus({ preventScroll: true });
@@ -15307,6 +15502,7 @@
15307
15502
  * on-screen selection, and the outcome is settled. A claim that is never settled is never reopened.
15308
15503
  */
15309
15504
  async function runServerProposalAction(action, event) {
15505
+ if (state.chat?.earlierOpening) return;
15310
15506
  const payload = event.payload.serverProposal;
15311
15507
  const requestId = String(event.payload.requestId || '');
15312
15508
  const snapshot = captureChat();
@@ -15418,6 +15614,7 @@
15418
15614
  function givenMessageBlocked() {
15419
15615
  const chat = state.chat;
15420
15616
  if (!chat || chat.archivedAt) return 'This conversation can’t take a message right now. Open it again, then send your answer.';
15617
+ if (chat.earlierOpening) return 'This conversation is from before this Workspace was reopened, so you can read it but not continue it. To carry on, choose New conversation at the top of the chat. The new conversation won’t remember this one.';
15421
15618
  if (state.loading || state.followupSubmitting || chat.activeTurn?.local) return 'FloLess is still sending your last message. Wait a moment, then send your answer again.';
15422
15619
  if (state.followupUnknownId || hasUnknownFollowup()) return 'FloLess could not confirm your last message reached the AI. Check it in the conversation, then send your answer.';
15423
15620
  if (chat.state === 'recovery') return 'This conversation is reconnecting to the AI. Send your answer once it is ready.';
@@ -15729,8 +15926,9 @@
15729
15926
  async function checkProjectWait() {
15730
15927
  const busy = state.projectBusy;
15731
15928
  if (!busy || busy.mode !== 'waiting' || busy.checking) return;
15732
- // The wait belongs to the conversation it was asked in; leaving it ends the wait (the draft stays there).
15733
- if (state.chat?.chatId !== busy.message.chatId) { endProjectBusy(); return; }
15929
+ // The wait belongs to the conversation it was asked in; leaving it ends the wait (the draft stays there). #3255: so
15930
+ // does that conversation becoming an earlier opening's: nothing is sent into it.
15931
+ if (state.chat?.chatId !== busy.message.chatId || state.chat?.earlierOpening) { endProjectBusy(); return; }
15734
15932
  if (Date.now() - busy.since >= PROJECT_WAIT_CAP_MS) {
15735
15933
  clearInterval(busy.timer); busy.timer = null; busy.mode = 'cap';
15736
15934
  paintProjectBusy({ focus: true });
@@ -15821,7 +16019,7 @@
15821
16019
  /** #2106: a project's Knowledge step. A missing Workspaces bridge is said, never a silent no-op. */
15822
16020
  async function openKnowledgeStepOf(projectId) {
15823
16021
  const open = window.flolessWorkspaces?.openKnowledgeStep;
15824
- if (typeof open !== 'function') throw new Error('FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.');
16022
+ if (typeof open !== 'function') throw Object.assign(new Error('FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.'), { forPerson: true });
15825
16023
  await open(projectId);
15826
16024
  }
15827
16025
 
@@ -15831,7 +16029,7 @@
15831
16029
  if (holder.kind === 'knowledge') {
15832
16030
  // The wait keeps going: opening the Knowledge step only shows the organizing this message waits for.
15833
16031
  try { await openKnowledgeStepOf(holder.projectId); }
15834
- catch (error) { announce(error?.message || 'FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.'); }
16032
+ catch (error) { announce(errorText(error, { action: 'open that project’s Knowledge step', retrySafe: true })); }
15835
16033
  return;
15836
16034
  }
15837
16035
  if (holder.kind === 'chat' && holder.chatId && holder.owner) {
@@ -16100,7 +16298,7 @@
16100
16298
  }
16101
16299
 
16102
16300
  async function resolveUnknownFollowup(clientSubmissionId) {
16103
- if (!state.chat || !clientSubmissionId) return;
16301
+ if (!state.chat || !clientSubmissionId || state.chat.earlierOpening) return;
16104
16302
  if (state.resolvingFollowupIds.has(clientSubmissionId)) return;
16105
16303
  const optimistic = state.events.find((event) => event.optimistic && event.clientSubmissionId === clientSubmissionId);
16106
16304
  if (optimistic) {
@@ -16148,7 +16346,7 @@
16148
16346
  }
16149
16347
 
16150
16348
  async function retryNotSentFollowup(clientSubmissionId) {
16151
- if (!state.chat || !clientSubmissionId || state.retryingFollowupIds.has(clientSubmissionId)) return;
16349
+ if (!state.chat || !clientSubmissionId || state.chat.earlierOpening || state.retryingFollowupIds.has(clientSubmissionId)) return;
16152
16350
  const snapshot = captureChat();
16153
16351
  if (!snapshot) return;
16154
16352
  const commandId = `shell.chat-followup-retry#${clientSubmissionId}`;
@@ -16620,7 +16818,7 @@
16620
16818
  }
16621
16819
 
16622
16820
  async function attachFiles(files) {
16623
- if (!state.chat || state.chat.activeTurn?.local || state.chat.state === 'recovery' || state.followupSubmitting || state.followupUnknownId || hasUnknownFollowup()) return;
16821
+ if (!state.chat || state.chat.earlierOpening || state.chat.activeTurn?.local || state.chat.state === 'recovery' || state.followupSubmitting || state.followupUnknownId || hasUnknownFollowup()) return;
16624
16822
  const snapshot = captureChat();
16625
16823
  if (!snapshot) return;
16626
16824
  if (state.uploadingChatIds.has(snapshot.chatId)) return;
@@ -16729,7 +16927,7 @@
16729
16927
  paintTeklaChip();
16730
16928
  // SSE delivers messages immediately, while this poll is what confirms that the provider has
16731
16929
  // finished. Keep the Rename chat control in step with that durable active-turn state.
16732
- ui.rename.hidden = !state.chat || Boolean(state.chat.activeTurn) || Boolean(state.chat.archivedAt);
16930
+ ui.rename.hidden = !state.chat || Boolean(state.chat.activeTurn) || Boolean(state.chat.archivedAt) || Boolean(state.chat?.earlierOpening);
16733
16931
  // Polling can clear activeTurn after the feed was painted by SSE. Repaint the feed
16734
16932
  // so a completed turn removes any stale live activity indicator. With no conversation
16735
16933
  // selected the feed is the Claude/Codex chooser, which a repaint would erase.
@@ -16743,7 +16941,7 @@
16743
16941
  // after a sign-out made elsewhere can still carry the reader's stale answer. Not for a
16744
16942
  // conversation with messages and the strip closed: past the 10 s server cache this read
16745
16943
  // asks both CLIs for their status, and nothing there would show the answer.
16746
- if (state.chat && (!ui.settings.hidden || !state.events.length)) {
16944
+ if (state.chat && !state.chat.earlierOpening && (!ui.settings.hidden || !state.events.length)) {
16747
16945
  const chatId = state.chat.chatId;
16748
16946
  try {
16749
16947
  const info = await request('/api/terminal-runtimes');
@@ -16899,8 +17097,9 @@
16899
17097
  * conversation in the same project, the earlier one left in history. Nothing of the old transcript is carried over.
16900
17098
  */
16901
17099
  async function startNewChat(projectId) {
16902
- // `personCopy`: the sentence is written for the person, so the caller shows it as it is (not as an unknown failure).
16903
- const refuse = (text) => Object.assign(new Error(text), { personCopy: true });
17100
+ // `forPerson` (failure-copy.js errorText): the sentence is written for the person, so the caller shows it as it is
17101
+ // (not as an unknown failure).
17102
+ const refuse = (text) => Object.assign(new Error(text), { forPerson: true });
16904
17103
  await refreshScope();
16905
17104
  const owner = state.scope?.owner;
16906
17105
  if (!owner || (projectId && (owner.kind !== 'project' || owner.projectId !== projectId))) {
@@ -16966,7 +17165,8 @@
16966
17165
  const draft = teklaDraftForChat(chat);
16967
17166
  const bound = currentTeklaBinding(chat);
16968
17167
  const library = draft?.library || bound;
16969
- if (!chat || !library) {
17168
+ // #3255: an earlier opening's Tekla model and its read allowance are not live, so they offer no Remove or Revoke.
17169
+ if (!chat || !library || chat.earlierOpening) {
16970
17170
  if (!node.hidden || node.childElementCount) { node.replaceChildren(); node.hidden = true; delete node.dataset.key; }
16971
17171
  return;
16972
17172
  }
@@ -17084,7 +17284,7 @@
17084
17284
  if (!host) return;
17085
17285
  const chat = state.chat;
17086
17286
  // #1907: the line exists only while this chat's own connectors are on; with them off, nothing can call.
17087
- const on = Boolean(chat && !chat.archivedAt && chat.settings?.useOwnConnectors === true && !chat.integrationBindings?.length);
17287
+ const on = Boolean(chat && !chat.archivedAt && !chat.earlierOpening && chat.settings?.useOwnConnectors === true && !chat.integrationBindings?.length);
17088
17288
  const allowed = on && Array.isArray(chat.connectorAllowance?.allowed) ? chat.connectorAllowance.allowed : [];
17089
17289
  const busy = Boolean(chat?.activeTurn) || state.ownConnectorsSaving === true;
17090
17290
  const painted = `${chat?.chatId || ''}|${on}|${busy}|${chat?.provider || ''}|${allowed.map(connectorKey).join(',')}|${state.connectorRevoking || ''}`;
@@ -17192,8 +17392,9 @@
17192
17392
  scopeLabel.textContent = scopeText;
17193
17393
  ui.scopeToggle.setAttribute('aria-label', `Scope: ${scopeText}`);
17194
17394
  ui.scopeToggle.dataset.tip = `Scope: ${scopeText}. See the conversation’s home folder and add or remove other projects and workflows.`;
17195
- ui.scopeToggle.disabled = state.loading;
17196
- if (ui.scopeToggle.disabled) ui.scopeToggle.dataset.blockedReason = 'The conversation is still loading.';
17395
+ ui.scopeToggle.disabled = Boolean(state.loading || chat?.earlierOpening);
17396
+ if (chat?.earlierOpening) ui.scopeToggle.dataset.blockedReason = 'Read only: this conversation is from before the Workspace was reopened.';
17397
+ else if (ui.scopeToggle.disabled) ui.scopeToggle.dataset.blockedReason = 'The conversation is still loading.';
17197
17398
  else delete ui.scopeToggle.dataset.blockedReason;
17198
17399
  if (ui.accessChip) {
17199
17400
  const instructor = isInstructorAnswer(chat);
@@ -17202,8 +17403,9 @@
17202
17403
  // #2651: Access can change at any time, a reply included: it shows the level the next message uses.
17203
17404
  const changed = accessChangedDuringReply(chat);
17204
17405
  ui.accessChip.setAttribute('aria-label', changed ? `Access: ${label} from your next message. Change access` : `Access: ${label}. Change access`);
17205
- ui.accessChip.disabled = false;
17206
- delete ui.accessChip.dataset.blockedReason;
17406
+ ui.accessChip.disabled = Boolean(chat?.earlierOpening);
17407
+ if (chat?.earlierOpening) ui.accessChip.dataset.blockedReason = 'Read only: this conversation is from before the Workspace was reopened.';
17408
+ else delete ui.accessChip.dataset.blockedReason;
17207
17409
  // One line, like the menu; what the level means in full is in this conversation's Scope view.
17208
17410
  ui.accessChip.dataset.tip = instructor
17209
17411
  ? 'This chat answers an Instructor question, so the AI can’t read files, run commands, search the web or use your connectors. Choose an Access to turn it into an ordinary chat. FloLess asks first.'
@@ -17420,7 +17622,7 @@
17420
17622
  const host = ui.grants;
17421
17623
  if (!host) return;
17422
17624
  const chat = state.chat;
17423
- const live = chat && !chat.archivedAt;
17625
+ const live = chat && !chat.archivedAt && !chat.earlierOpening;
17424
17626
  const turn = live && ['running', 'awaiting-approval'].includes(chat.state) ? chat.activeTurn : null;
17425
17627
  const request = turn && Array.isArray(turn.requestGrants) ? turn.requestGrants.filter((grant) => grant && grant.key) : [];
17426
17628
  const conversation = live && Array.isArray(chat.approvalGrants?.grants) ? chat.approvalGrants.grants : [];
@@ -17488,9 +17690,9 @@
17488
17690
  const host = ui.changeAllowance;
17489
17691
  if (!host) return;
17490
17692
  const chat = state.chat;
17491
- const allowed = chat && !chat.archivedAt && Array.isArray(chat.changeAllowance?.allowed)
17693
+ const allowed = chat && !chat.archivedAt && !chat.earlierOpening && Array.isArray(chat.changeAllowance?.allowed)
17492
17694
  ? chat.changeAllowance.allowed : [];
17493
- const global = chat && !chat.archivedAt && chat.changeAllowance?.allowedForChat;
17695
+ const global = chat && !chat.archivedAt && !chat.earlierOpening && chat.changeAllowance?.allowedForChat;
17494
17696
  const readOnly = chat?.settings?.permissionProfile === 'read-only';
17495
17697
  const painted = `${chat?.chatId || ''}|${allowed.map((entry) => entry.key).join(',')}|${Boolean(global)}|${readOnly}|${state.changeRevoking || ''}`;
17496
17698
  if (host.dataset.painted === painted) return;
@@ -17572,7 +17774,7 @@
17572
17774
  const host = ui.checkAllowance;
17573
17775
  if (!host) return;
17574
17776
  const chat = state.chat;
17575
- const grants = chat && !chat.archivedAt && Array.isArray(chat.integrationReadAllowance?.grants) ? chat.integrationReadAllowance.grants : [];
17777
+ const grants = chat && !chat.archivedAt && !chat.earlierOpening && Array.isArray(chat.integrationReadAllowance?.grants) ? chat.integrationReadAllowance.grants : [];
17576
17778
  const painted = `${chat?.chatId || ''}|${grants.map((grant) => `${checkGrantKey(grant)}:${grant.identity || ''}`).join(',')}|${state.checkRevoking || ''}`;
17577
17779
  if (host.dataset.painted === painted) return;
17578
17780
  host.dataset.painted = painted;
@@ -17847,16 +18049,16 @@
17847
18049
  // Graft receipt → unsent Chat draft. Opening performs no binding, sends nothing and never
17848
18050
  // touches Tekla: the binding is stored only when the user presses Send.
17849
18051
  async function openVerifiedTeklaDraft(receipt) {
17850
- // `plainEnglish` marks errors written for the user, so the Graft dialog can show them as-is.
18052
+ // `forPerson` (failure-copy.js errorText) marks errors written for the user, so the Graft dialog can show them as-is.
17851
18053
  if (!receipt || typeof receipt.sourcePath !== 'string' || !receipt.sourcePath
17852
18054
  || typeof receipt.hostVersion !== 'string' || !receipt.hostVersion) {
17853
- throw Object.assign(new Error('FloLess could not read the result of the model check. Check the model read again, then continue in AI Chat.'), { plainEnglish: true });
18055
+ throw Object.assign(new Error('FloLess could not read the result of the model check. Check the model read again, then continue in AI Chat.'), { forPerson: true });
17854
18056
  }
17855
18057
  // The chip lists exactly these reads, and Send binds exactly these: nothing defaults to more.
17856
18058
  const library = { sourcePath: receipt.sourcePath, hostVersion: receipt.hostVersion, operations: teklaChatReads() };
17857
18059
  const draft = teklaDraftText(receipt);
17858
18060
  await refreshScope();
17859
- if (!state.scope?.owner) throw Object.assign(new Error('Open a project or workflow before continuing in AI Chat.'), { plainEnglish: true });
18061
+ if (!state.scope?.owner) throw Object.assign(new Error('Open a project or workflow before continuing in AI Chat.'), { forPerson: true });
17860
18062
  window.flolessBridge?.revealAiChat?.();
17861
18063
  ui.tab.click();
17862
18064
  const chat = state.chat;
@@ -18103,7 +18305,7 @@
18103
18305
  });
18104
18306
  document.addEventListener('click', () => queueMicrotask(paintFloLessContext));
18105
18307
  const contextObserver = new MutationObserver(paintFloLessContext);
18106
- for (const id of ['app', 'mode-switch', 'ws-step-tabs', 'dashboard', 'report-modal', 'contract-editor', 'stop-run', 'report-stop']) {
18308
+ for (const id of ['app', 'mode-switch', 'ws-step-tabs', 'report-modal', 'contract-editor', 'stop-run', 'report-stop']) {
18107
18309
  const node = document.getElementById(id);
18108
18310
  if (node) contextObserver.observe(node, { attributes: true, childList: id === 'ws-step-tabs', subtree: id === 'ws-step-tabs' });
18109
18311
  }
@@ -18140,6 +18342,8 @@
18140
18342
  scopeProjectId: () => (state.scope?.owner?.kind === 'project' ? state.scope.owner.projectId : null),
18141
18343
  // #3003: a Knowledge page rendered the way the chat viewers show it, for the Knowledge step's page panel.
18142
18344
  knowledgePageHtml,
18345
+ // #3412: the same escaping renderer, for a connected source's preview on the Knowledge step (no [[links]] there).
18346
+ markdownHtml: (text) => markdownHtml(String(text ?? '')),
18143
18347
  // The Knowledge step's "Ask AI to index" (#2399 slice 0b): the person's own draft in the message box; never sent.
18144
18348
  fillMessageBox: (text) => putInMessageBox(String(text || '')),
18145
18349
  // The New project dialog's AI choice (#1605) words each provider's sign-in the way this