@floless/app 0.155.1 → 0.156.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 (46) hide show
  1. package/cli-actions.mjs +376 -0
  2. package/dist/floless-server.cjs +101615 -87681
  3. package/dist/skills/floless-app-actions/SKILL.md +137 -0
  4. package/dist/skills/floless-app-approval/SKILL.md +8 -5
  5. package/dist/skills/floless-app-bridge/SKILL.md +12 -9
  6. package/dist/skills/floless-app-knowledge/SKILL.md +30 -13
  7. package/dist/skills/floless-app-new-workflow/SKILL.md +4 -4
  8. package/dist/skills/floless-app-onboarding/SKILL.md +1 -1
  9. package/dist/skills/floless-app-onboarding/references/aware-runtime.md +4 -4
  10. package/dist/skills/floless-app-queue/SKILL.md +10 -6
  11. package/dist/skills/floless-app-report-issue/SKILL.md +13 -10
  12. package/dist/skills/floless-app-rfi/SKILL.md +59 -68
  13. package/dist/skills/floless-app-routines/SKILL.md +19 -14
  14. package/dist/skills/floless-app-routines/references/routines-api.md +8 -2
  15. package/dist/skills/floless-app-workflows/SKILL.md +5 -4
  16. package/dist/web/agent-steps.js +933 -0
  17. package/dist/web/agents.js +5 -0
  18. package/dist/web/app.css +210 -5
  19. package/dist/web/app.js +1 -0
  20. package/dist/web/aware.js +584 -44
  21. package/dist/web/chat.css +9 -0
  22. package/dist/web/chat.js +195 -13
  23. package/dist/web/commands-shell.js +299 -1
  24. package/dist/web/commands-tekla-parser.js +7 -0
  25. package/dist/web/index.html +52 -1
  26. package/dist/web/instructor.js +5 -3
  27. package/dist/web/leave-guard.js +4 -2
  28. package/dist/web/left-pane.js +145 -42
  29. package/dist/web/model-editor.css +10 -0
  30. package/dist/web/model-group-navigator.js +331 -0
  31. package/dist/web/model-panel-bridge.js +63 -5
  32. package/dist/web/model-pointer-dock.js +55 -5
  33. package/dist/web/model-revit-module.js +15 -0
  34. package/dist/web/model-selection-tools.js +53 -17
  35. package/dist/web/model-tekla-selection.js +75 -2
  36. package/dist/web/model-viewport-revit-adapter.js +17 -10
  37. package/dist/web/pages.js +27 -3
  38. package/dist/web/panels.js +3 -3
  39. package/dist/web/project-reconciliation.js +357 -0
  40. package/dist/web/revit-editor.js +464 -76
  41. package/dist/web/steel-3d-view.js +1 -0
  42. package/dist/web/terminal-requests.js +541 -0
  43. package/dist/web/tool-updates.js +147 -13
  44. package/dist/web/workspaces.js +213 -12
  45. package/launch.mjs +80 -2
  46. package/package.json +1 -1
package/dist/web/chat.css CHANGED
@@ -1528,6 +1528,15 @@
1528
1528
  .ai-chat-action-card .ai-chat-filter-card-head { align-items: flex-start; }
1529
1529
  .ai-chat-action-named { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
1530
1530
  .ai-chat-action-named strong { overflow-wrap: anywhere; }
1531
+ /* #2262 — a Page the AI saved: the done card's shell, the viewer's own AI-made label, and Open as the one accent.
1532
+ "Based on" is not a warning (nothing went wrong), so it keeps the same look and only adds a line and a ghost button. */
1533
+ .ai-chat-page-card .ai-chat-filter-card-head { flex-wrap: wrap; gap: 4px 8px; }
1534
+ .ai-chat-page-card .pg-ai-badge { margin-left: auto; }
1535
+ .ai-chat-page-card .ai-chat-page-ver { margin-top: 4px; }
1536
+ .ai-chat-page-card .ai-chat-page-based { margin-top: 2px; color: var(--text); }
1537
+ .ai-chat-page-card .ai-chat-guide-actions { margin-top: 8px; }
1538
+ .ai-chat-page-card .ai-chat-guide-actions .ai-chat-page-open { border-color: var(--accent); background: var(--accent); color: #fff; }
1539
+ .ai-chat-page-card .ai-chat-guide-actions .ai-chat-page-open:hover { filter: brightness(1.08); border-color: var(--accent); background: var(--accent); color: #fff; }
1531
1540
  .ai-chat-action-summary { margin: 6px 0 0; color: var(--text); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
1532
1541
  .ai-chat-action-why { color: var(--text-muted); }
1533
1542
  .ai-chat-action-changed { margin-top: 6px; color: var(--text); }
package/dist/web/chat.js CHANGED
@@ -71,6 +71,7 @@
71
71
  reportHold: null,
72
72
  // Only this exact report announcement may be removed when its composer reason ends (#1704).
73
73
  reportLiveMessage: null,
74
+ pendingSettings: null,
74
75
  // A Tekla model library carried over from a Graft receipt but not yet bound to its chat. It is
75
76
  // browser-only until Send: opening, editing or removing it never calls the binding route.
76
77
  // pendingTeklaLibrary waits for the provider chooser to create the chat it belongs to.
@@ -2861,7 +2862,15 @@
2861
2862
  const actionCards = new Map();
2862
2863
  const ACTION_CARDS_KEPT = 200;
2863
2864
  const ACTION_CONFIRM_VERBS = { 'workflows.run': 'Run it', 'routines.run': 'Run it', 'projects.archive': 'Archive it',
2864
- 'projects.unarchive': 'Bring it back', 'workflows.stop': 'Stop it' };
2865
+ 'projects.unarchive': 'Bring it back', 'workflows.stop': 'Stop it',
2866
+ // #2290: the button says the consequence, never a reversible-sounding verb for something that is not.
2867
+ 'app.stop': 'Stop FloLess', 'workflows.delete': 'Delete it', 'requests.clear': 'Delete it', 'requests.clear-all': 'Delete them',
2868
+ 'routines.delete': 'Delete it', 'templates.delete': 'Delete it', 'requests.discard-read': 'Discard it', 'requests.keep-read': 'Keep it',
2869
+ 'workflows.fork': 'Fork it', 'workflows.copy': 'Copy it', 'workflows.adopt': 'Make it mine', 'workflows.restore': 'Restore it',
2870
+ 'workflows.apply-update': 'Update it', 'workflows.freeze-step': 'Freeze it', 'workflows.unfreeze-step': 'Unfreeze it',
2871
+ 'workflows.rename-installed': 'Rename it', 'workflows.reinstall-approved-tool': 'Reinstall it', 'workflows.run-live': 'Start it',
2872
+ 'requests.run': 'Start it', 'requests.desktop-launch': 'Open the app', 'routines.create': 'Create it',
2873
+ 'routines.create-for-agent': 'Create it', 'routines.update': 'Save changes' };
2865
2874
  const ACTION_EYEBROWS = { write: 'Suggested change', destructive: 'Needs your OK', 'human-only': 'Your decision' };
2866
2875
  const ACTION_FINAL = new Set(['done', 'failed', 'cancelled', 'declined', 'expired', 'superseded', 'unknown']);
2867
2876
 
@@ -2920,7 +2929,9 @@
2920
2929
  /** Open the screen a human-only action names, or the one showing what a finished action made. Nothing runs. */
2921
2930
  async function openActionScreen(screen) {
2922
2931
  if (screen?.view === 'page' && screen.pageHome && screen.pageId && typeof window.flolessPages?.open === 'function') {
2923
- return await window.flolessPages.open(screen.pageHome, screen.pageId);
2932
+ // The exact version a finished action made, when it says one: a later version must not stand in for it.
2933
+ const version = Number.isInteger(screen.pageVersion) && screen.pageVersion > 0 ? screen.pageVersion : undefined;
2934
+ return await window.flolessPages.open(screen.pageHome, screen.pageId, version);
2924
2935
  }
2925
2936
  if (screen?.view === 'chat' && screen.chatId && screen.owner) {
2926
2937
  await openConversation(screen.chatId, { owner: screen.owner });
@@ -2932,15 +2943,55 @@
2932
2943
  if (screen?.view === 'workflow' && screen.workflowId && typeof window.flolessBridge?.openApp === 'function') {
2933
2944
  await window.flolessBridge.openApp(screen.workflowId); return true;
2934
2945
  }
2946
+ if (screen?.view === 'requests' && screen.requestId && typeof window.flolessBridge?.openRequest === 'function') {
2947
+ await window.flolessBridge.openRequest(screen.requestId); return true;
2948
+ }
2949
+ if (screen?.view === 'project' && screen.step === 'drawings' && screen.projectId && typeof window.flolessWorkspaces?.openDrawingsStep === 'function') {
2950
+ await window.flolessWorkspaces.openDrawingsStep(screen.projectId); return true;
2951
+ }
2935
2952
  if (screen?.view === 'project' && screen.projectId && typeof window.flolessWorkspaces?.openChatOwner === 'function') {
2936
2953
  await window.flolessWorkspaces.openChatOwner({ kind: 'project', projectId: screen.projectId }); return true;
2937
2954
  }
2938
2955
  if (['workspaces', 'workflows'].includes(screen?.view) && typeof window.flolessWorkspaces?.setMode === 'function') {
2939
2956
  await window.flolessWorkspaces.setMode(screen.view); return true;
2940
2957
  }
2958
+ // Requests, at the request the screen names.
2959
+ if (screen?.view === 'requests' && typeof window.flolessBridge?.openRequest === 'function') {
2960
+ await window.flolessBridge.openRequest(screen.requestId || null); return true;
2961
+ }
2941
2962
  return false;
2942
2963
  }
2943
2964
 
2965
+ /** Take a confirmed step FloLess's own window must take (#2290). Returns a plain failure sentence, or '' when it went. */
2966
+ async function runBrowserStep(step) {
2967
+ if (step?.flow === 'stop-app') {
2968
+ // The menu's own Stop FloLess: it asks about anything not saved, then closes FloLess and shows the stopped screen.
2969
+ if (typeof window.flolessLeaveGuard?.stopApp !== 'function') return 'FloLess couldn’t start Stop from here. Use Stop FloLess in the ≡ menu.';
2970
+ try {
2971
+ // It resolves false when nothing was stopped (you cancelled, or a stop is already under way): never "Done" over that.
2972
+ if ((await window.flolessLeaveGuard.stopApp()) === false) return 'FloLess was not stopped: you cancelled, or a stop is already under way. Use Stop FloLess in the ≡ menu when you are ready.';
2973
+ } catch {
2974
+ return 'FloLess could not be stopped from here. Use Stop FloLess in the ≡ menu.';
2975
+ }
2976
+ return '';
2977
+ }
2978
+ if (step?.flow === 'desktop-launch') {
2979
+ if (!step.requestId) return 'FloLess could not tell which request to open in the desktop app. Open it from Requests.';
2980
+ try {
2981
+ const response = await fetch(`/api/requests/${encodeURIComponent(step.requestId)}/desktop-handoff/launch`, {
2982
+ method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' },
2983
+ body: JSON.stringify({ provider: step.provider, attemptId: step.attemptId }),
2984
+ });
2985
+ if (response.ok) return '';
2986
+ // The route's own words are not always plain English; the person gets one fixed sentence and Requests shows the detail.
2987
+ return 'The desktop app was not opened. Try it from Requests.';
2988
+ } catch {
2989
+ return 'FloLess could not be reached to open the desktop app. Check that it is still running.';
2990
+ }
2991
+ }
2992
+ return 'FloLess did not recognise the step this card asked its window to take, so it did nothing. Try it from the screen instead.';
2993
+ }
2994
+
2944
2995
  async function sendActionProposal(proposalId, verb) {
2945
2996
  const response = await fetch(`/api/actions/proposals/${encodeURIComponent(proposalId)}/${verb}`, {
2946
2997
  method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' }, body: '{}',
@@ -2962,6 +3013,12 @@
2962
3013
  if (ok) {
2963
3014
  entry.local = { state: body.proposal?.state || (verb === 'decline' ? 'declined' : 'executing'), result: body.proposal?.result || null, supersededBy: null };
2964
3015
  announce(verb === 'confirm' ? `${title}: started.` : verb === 'decline' ? `Not now: ${title}.` : `Asked ${title} to stop.`);
3016
+ // #2290: a step only this window may take (its route checks the window's own origin) is taken here, now that the
3017
+ // person confirmed it: the same flow the menu or the Requests button runs.
3018
+ if (verb === 'confirm' && event.payload?.browserStep) {
3019
+ const failed = await runBrowserStep(event.payload.browserStep);
3020
+ if (failed) entry.error = failed;
3021
+ }
2965
3022
  } else if (body.fresh) {
2966
3023
  // The target changed or the offer ended: the old card says so, and a fresh card shows the current state.
2967
3024
  entry.local = { state: body.proposal?.state || 'superseded', result: null, supersededBy: body.fresh.id };
@@ -3018,7 +3075,8 @@
3018
3075
  head.className = 'ai-chat-filter-card-head';
3019
3076
  const eyebrow = document.createElement('span');
3020
3077
  eyebrow.className = 'guide-move-eyebrow';
3021
- eyebrow.textContent = ACTION_EYEBROWS[risk];
3078
+ // A request that has been answered no longer "needs your OK": the eyebrow says where it ended up.
3079
+ eyebrow.textContent = { executing: actionId === 'workflows.run' || actionId === 'routines.run' ? 'Running' : 'Working', done: 'Finished', failed: 'Could not finish', unknown: 'Outcome unknown' }[current.state] || ACTION_EYEBROWS[risk];
3022
3080
  const strong = document.createElement('strong');
3023
3081
  strong.id = titleId;
3024
3082
  strong.textContent = title;
@@ -3047,7 +3105,8 @@
3047
3105
 
3048
3106
  if (current.state === 'done') {
3049
3107
  card.classList.add('is-done');
3050
- status.textContent = current.next ? 'Done. Its result is ready to view.' : String(payload.doneNote || 'Done.');
3108
+ // A step this window took after the confirm (#2290) can still fail here; that is said, never "Done." over it.
3109
+ status.textContent = entry.error || (current.next ? 'Done. Its result is ready to view.' : String(payload.doneNote || 'Done.'));
3051
3110
  if (current.next) {
3052
3111
  // What the finished action made (a run's report): opening it only shows it, it runs nothing again.
3053
3112
  const actions = document.createElement('div');
@@ -3068,7 +3127,10 @@
3068
3127
  }
3069
3128
  if (current.state === 'failed') {
3070
3129
  card.classList.add('is-failed');
3071
- status.textContent = `${current.result?.message || 'It did not complete.'} You can ask the AI to suggest it again.`;
3130
+ // A route's refusal can be a bare fragment: show it as a sentence, with the next step after it.
3131
+ const refusal = String(current.result?.message || '').trim();
3132
+ const sentence = refusal ? refusal.charAt(0).toUpperCase() + refusal.slice(1) + (/[.!?…]$/.test(refusal) ? '' : '.') : '';
3133
+ status.textContent = `${sentence || 'It did not complete.'} You can ask the AI to suggest it again.`;
3072
3134
  card.append(status);
3073
3135
  return card;
3074
3136
  }
@@ -3131,7 +3193,7 @@
3131
3193
  later.dataset.tip = 'Sets this suggestion aside. Nothing runs.';
3132
3194
  later.disabled = Boolean(entry.busy);
3133
3195
  later.addEventListener('click', () => { void actOnProposal(event, proposalId, 'decline'); });
3134
- const confirm = actionButton(entry.busy === 'confirm' ? 'Starting…' : (ACTION_CONFIRM_VERBS[actionId] || 'Do it'), 'shell.chat-action-confirm', proposalId, summaryText, 'ai-chat-filter-apply');
3196
+ const confirm = actionButton(entry.busy === 'confirm' ? 'Working…' : (ACTION_CONFIRM_VERBS[actionId] || 'Do it'), 'shell.chat-action-confirm', proposalId, summaryText, 'ai-chat-filter-apply');
3135
3197
  confirm.dataset.tip = risk === 'destructive' ? 'Runs it now, for real. FloLess checks first that nothing changed since this was suggested.'
3136
3198
  : 'Makes this change now. FloLess checks first that nothing changed since this was suggested.';
3137
3199
  confirm.disabled = Boolean(entry.busy);
@@ -3140,16 +3202,93 @@
3140
3202
  actions.append(later, confirm);
3141
3203
  const meta = document.createElement('p');
3142
3204
  meta.className = 'ai-chat-filter-note ai-chat-action-meta';
3143
- meta.textContent = payload.revision === 'bound' ? 'Uses the approved version as it is now; if it changes first, you will be asked again.'
3205
+ meta.textContent = payload.revision === 'bound' ? 'Checked against how it is now; if it changes first, you will be asked again.'
3144
3206
  : 'Acts on things as they are when you confirm.';
3145
3207
  status.textContent = entry.error;
3146
3208
  card.append(actions, meta, status);
3147
3209
  return card;
3148
3210
  }
3149
3211
 
3212
+ /**
3213
+ * #2262: a Page the AI saved from this conversation — a receipt the person will want to find again, so a card, not a
3214
+ * line. Title, version, the AI-made label the viewer also shows, and Open. When the AI was asked to change a Page it
3215
+ * did not make, that Page was left as it was and this is a new one: the card says so and can open the original.
3216
+ */
3217
+ function renderPageCard(event) {
3218
+ const card = event.payload.card;
3219
+ const title = String(card.title || 'Untitled Page');
3220
+ const version = Number.isInteger(card.version) && card.version > 0 ? card.version : 1;
3221
+ const node = document.createElement('section');
3222
+ node.className = 'ai-chat-filter-card ai-chat-action-card ai-chat-page-card is-done';
3223
+ node.dataset.eventId = event.eventId;
3224
+ node.dataset.eventSequence = String(event.sequence);
3225
+ node.setAttribute('role', 'group');
3226
+ node.setAttribute('aria-label', `Page: ${title}, version ${version}${card.aiMade === false ? '' : ', made by AI'}`);
3227
+ const head = document.createElement('div');
3228
+ head.className = 'ai-chat-filter-card-head';
3229
+ const named = document.createElement('div');
3230
+ named.className = 'ai-chat-action-named';
3231
+ const eyebrow = document.createElement('span');
3232
+ eyebrow.className = 'guide-move-eyebrow';
3233
+ eyebrow.textContent = 'Page';
3234
+ const strong = document.createElement('strong');
3235
+ strong.textContent = title;
3236
+ named.append(eyebrow, strong);
3237
+ head.append(named);
3238
+ if (card.aiMade !== false) {
3239
+ const badge = document.createElement('span');
3240
+ badge.className = 'pg-ai-badge';
3241
+ badge.textContent = 'AI-made';
3242
+ badge.dataset.tip = 'Made by AI in this conversation. Check it before you rely on it or share it.';
3243
+ badge.tabIndex = 0;
3244
+ head.append(badge);
3245
+ }
3246
+ const line = document.createElement('p');
3247
+ line.className = 'ai-chat-action-line ai-chat-page-ver';
3248
+ line.textContent = card.based ? 'Version 1 · a new Page' : version > 1 ? `Version ${version} · added to this Page` : 'Version 1';
3249
+ node.append(head, line);
3250
+ const basedOn = card.basedOn && card.basedOn.home && card.basedOn.pageId ? card.basedOn : null;
3251
+ if (card.based) {
3252
+ const note = document.createElement('p');
3253
+ note.className = 'ai-chat-action-line ai-chat-page-based';
3254
+ // FloLess's own sentence for what happened (who made the original, or why it could not be used), when it sent one.
3255
+ note.textContent = typeof card.note === 'string' && card.note ? card.note
3256
+ : basedOn ? `Based on “${basedOn.title}”, which was left as it is.` : 'The Page the AI was asked to change was left as it is; this is a new Page.';
3257
+ node.append(note);
3258
+ }
3259
+ const actions = document.createElement('div');
3260
+ actions.className = 'ai-chat-guide-actions';
3261
+ const status = document.createElement('p');
3262
+ status.className = 'ai-chat-filter-note ai-chat-action-status';
3263
+ status.setAttribute('role', 'status');
3264
+ // A Page that cannot be opened says so on its own card, with what to do, rather than a click that does nothing.
3265
+ const openPage = async (screen) => {
3266
+ status.textContent = '';
3267
+ let opened = false;
3268
+ try { opened = await openActionScreen(screen); } catch { opened = false; }
3269
+ if (!opened) status.textContent = 'FloLess couldn’t open that Page. Find it in the Pages list and open it from there.';
3270
+ };
3271
+ const open = button('Open', `shell.chat-page-open#${card.pageId}-v${version}`, 'ai-chat-page-open');
3272
+ open.dataset.commandInstanceLabel = `${title}, version ${version}`;
3273
+ open.setAttribute('aria-label', `Open ${title}, version ${version}`);
3274
+ open.dataset.tip = 'Opens this version in the Page viewer';
3275
+ open.addEventListener('click', () => { void openPage({ view: 'page', pageHome: card.home, pageId: card.pageId, pageVersion: version }); });
3276
+ actions.append(open);
3277
+ if (basedOn) {
3278
+ const original = button('Open the original', `shell.chat-page-open-original#${event.eventId}`);
3279
+ original.dataset.commandInstanceLabel = basedOn.title;
3280
+ original.setAttribute('aria-label', `Open the original, ${basedOn.title}`);
3281
+ original.addEventListener('click', () => { void openPage({ view: 'page', pageHome: basedOn.home, pageId: basedOn.pageId }); });
3282
+ actions.append(original);
3283
+ }
3284
+ node.append(actions, status);
3285
+ return node;
3286
+ }
3287
+
3150
3288
  /** One line per action the AI ran itself from this conversation: what it was, and how it ended. */
3151
3289
  function renderActionRow(event) {
3152
3290
  const payload = event.payload || {};
3291
+ if (payload.outcome === 'ok' && payload.card?.kind === 'page' && payload.card.home && payload.card.pageId) return renderPageCard(event);
3153
3292
  const row = document.createElement('div');
3154
3293
  const outcome = payload.outcome === 'ok' ? 'ok' : payload.outcome === 'cancelled' ? 'stopped' : 'failed';
3155
3294
  row.className = `ai-chat-action-row is-${outcome}`;
@@ -6736,7 +6875,10 @@
6736
6875
  ? `${bindings.length} FloLess account${bindings.length === 1 ? '' : 's'}`
6737
6876
  : 'Not using one';
6738
6877
  const frozen = !chat || Boolean(chat.activeTurn) || !state.capability?.available;
6739
- ui.model.disabled = frozen; ui.effort.disabled = frozen; ui.permission.disabled = frozen;
6878
+ // #2336: Access and the connectors switch do not depend on the provider's model list, so a provider check that failed
6879
+ // or is slow never locks them (only a running reply does). Model and effort need the list.
6880
+ const settled = !chat || Boolean(chat.activeTurn);
6881
+ ui.model.disabled = frozen; ui.effort.disabled = frozen; ui.permission.disabled = settled;
6740
6882
  ui.integrations.disabled = frozen || Boolean(chat?.nativeSessionId) || instructorChat;
6741
6883
  const integrationBlocked = instructorChat
6742
6884
  ? 'An Instructor answer uses no tools, so it cannot use a connected account. Start a new chat to use one.'
@@ -6749,7 +6891,7 @@
6749
6891
  ui.integrations.dataset.tip = integrationBlocked || 'Choose which connected account this chat can use';
6750
6892
  if (integrationBlocked) ui.integrations.dataset.blockedReason = integrationBlocked;
6751
6893
  else delete ui.integrations.dataset.blockedReason;
6752
- paintOwnConnectorsSetting(chat, frozen);
6894
+ paintOwnConnectorsSetting(chat, settled);
6753
6895
  paintDesktopStatus();
6754
6896
  }
6755
6897
 
@@ -6766,8 +6908,7 @@
6766
6908
  const blocked = !chat ? 'Open a conversation first.'
6767
6909
  : usesAccount ? 'This chat uses a FloLess connected account, so your own connectors stay off.'
6768
6910
  : chat.activeTurn ? 'Wait for the current AI reply to finish before changing this.'
6769
- : !state.capability?.available ? capabilityMessage(chat.provider, state.capability?.reason)
6770
- : frozen ? 'This setting cannot change right now.' : '';
6911
+ : frozen ? 'This setting cannot change right now.' : '';
6771
6912
  control.disabled = Boolean(blocked);
6772
6913
  control.dataset.tip = blocked || `Lets the AI use the connectors you added to ${provider}, such as Google Drive. Each call still asks you first. Off in every new chat.`;
6773
6914
  if (blocked) control.dataset.blockedReason = blocked; else delete control.dataset.blockedReason;
@@ -6851,6 +6992,7 @@
6851
6992
  ui.stop.hidden = !active || Boolean(chat.activeTurn?.local);
6852
6993
  ui.send.hidden = false;
6853
6994
  paintSettings(); paintRecovery(); paintApproval(); paintRuntime(); paintAttachments(); paintEvents(); paintHistory(); updateSendState();
6995
+ applyPendingSettings();
6854
6996
  }
6855
6997
 
6856
6998
  function draftForChat(chat) {
@@ -7654,7 +7796,8 @@
7654
7796
  // #2059: giving an Instructor answer tools asks first; the server refuses it without this confirmation.
7655
7797
  let release = false;
7656
7798
  if (widensInstructorAnswer(patch)) {
7657
- if (!await confirmInstructorRelease(patch)) return;
7799
+ // A confirmed change that had to wait for a running reply (#2336) was confirmed already: it is not asked again.
7800
+ if (!options.releaseConfirmed && !await confirmInstructorRelease(patch)) return;
7658
7801
  if (!sameChat(snapshot)) return;
7659
7802
  // The settings may have moved on while the question was open: apply the choice to what is current now.
7660
7803
  snapshot = captureChat();
@@ -7685,7 +7828,46 @@
7685
7828
  // The transcript line the server wrote is shown now, not on the next poll.
7686
7829
  void refreshConversation(snapshot.chatId, false);
7687
7830
  } else if (options.announce !== false) announce('Chat settings updated.');
7688
- } catch (error) { if (sameChat(snapshot)) report(error, 'Could not update settings'); }
7831
+ } catch (error) {
7832
+ if (!sameChat(snapshot)) return;
7833
+ // #2336: a reply is still running, so the change cannot be stored yet. Nothing is refused: say so, keep the control on
7834
+ // the level that is really in force, and apply the choice by itself the moment the reply finishes (paintConversation).
7835
+ if (error?.code === 'chat-turn-active') {
7836
+ const earlier = state.pendingSettings?.chatId === snapshot.chatId ? state.pendingSettings : null;
7837
+ state.pendingSettings = { chatId: snapshot.chatId, patch: { ...(earlier?.patch || {}), ...patch }, releaseConfirmed: release || earlier?.releaseConfirmed === true };
7838
+ report(error, '', { 'chat-turn-active': pendingSettingsSentence(patch) });
7839
+ return;
7840
+ }
7841
+ report(error, 'Could not update settings', settingsSaveMessages(error));
7842
+ }
7843
+ }
7844
+
7845
+ /** #2336: said when a settings choice has to wait for the running reply; it applies by itself afterwards. */
7846
+ function pendingSettingsSentence(patch) {
7847
+ const what = 'permissionProfile' in patch ? `Access to ${permissionLabel(patch.permissionProfile)}`
7848
+ : 'useOwnConnectors' in patch ? (patch.useOwnConnectors === true ? 'your connectors to on' : 'your connectors to off')
7849
+ : 'model' in patch ? 'the model' : 'effort';
7850
+ return `The AI is still replying, so ${what} will change as soon as this reply finishes. Nothing else to do.`;
7851
+ }
7852
+
7853
+ /** #2336: the sentences for a settings change that could not be stored (the shared sentences say "Stop the response", which is wrong here). */
7854
+ function settingsSaveMessages(error) {
7855
+ const code = String(error && error.code || '');
7856
+ if (code === 'chat-turn-active') return { 'chat-turn-active': 'The AI is still replying. Try this change again when the reply has finished.' };
7857
+ if (code === 'chat-provider-unavailable') {
7858
+ return { 'chat-provider-unavailable': `${capabilityMessage(state.chat?.provider, error?.message)} The model and effort can’t be changed until then; Access and connectors still can.` };
7859
+ }
7860
+ return null;
7861
+ }
7862
+
7863
+ /** #2336: applies a choice that waited for a running reply, once that reply is over and only to the chat it was made in. */
7864
+ function applyPendingSettings() {
7865
+ const pending = state.pendingSettings;
7866
+ if (!pending) return;
7867
+ if (state.chat?.chatId !== pending.chatId) { state.pendingSettings = null; return; }
7868
+ if (state.chat.activeTurn || state.chat.archivedAt) return;
7869
+ state.pendingSettings = null;
7870
+ void saveSettings(pending.patch, { releaseConfirmed: pending.releaseConfirmed === true });
7689
7871
  }
7690
7872
 
7691
7873
  function modelChoices() {