@floless/app 0.168.0 → 0.170.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-actions.mjs +8 -1
- package/dist/floless-server.cjs +125533 -99597
- package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
- package/dist/schemas/steel.model.v2.schema.json +2 -1
- package/dist/skills/floless-app-knowledge/SKILL.md +43 -13
- package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
- package/dist/skills/floless-app-rfi/SKILL.md +4 -2
- package/dist/skills/floless-app-routines/SKILL.md +2 -2
- package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
- package/dist/skills/floless-app-steel-model/SKILL.md +8 -5
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
- package/dist/skills/floless-app-workflows/SKILL.md +22 -3
- package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
- package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
- package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
- package/dist/templates/college-phase-exporter.flo +7 -2
- package/dist/templates/trimble-list-projects.flo +10 -2
- package/dist/web/agent-steps.js +90 -19
- package/dist/web/agents.js +77 -31
- package/dist/web/app.css +267 -4
- package/dist/web/app.js +71 -7
- package/dist/web/aware-update-client.js +4 -4
- package/dist/web/aware.js +1277 -219
- package/dist/web/chat.css +10 -0
- package/dist/web/chat.js +407 -117
- package/dist/web/checkpoint-standard.js +5 -3
- package/dist/web/commands-drawing-check.js +4 -0
- package/dist/web/commands-shell.js +551 -15
- package/dist/web/commands-steel.js +68 -2
- package/dist/web/commands-vector.js +69 -0
- package/dist/web/drawing-check-editor.html +10 -0
- package/dist/web/drawing-check-editor.js +821 -237
- package/dist/web/failure-copy.js +50 -2
- package/dist/web/filter-ai-proposal.js +11 -8
- package/dist/web/flo-3d.js +310 -0
- package/dist/web/flo-card.js +72 -0
- package/dist/web/guide.js +33 -24
- package/dist/web/index.html +95 -5
- package/dist/web/instructor.js +102 -15
- package/dist/web/left-pane.js +4 -1
- package/dist/web/local-discovery.js +8 -7
- package/dist/web/missed-routines.js +239 -0
- package/dist/web/model-editor-steel-adapter.js +41 -1
- package/dist/web/model-measure.js +6 -0
- package/dist/web/model-spatial-panel.js +19 -4
- package/dist/web/model-spatial-tools.js +3 -3
- package/dist/web/model-viewport-revit-adapter.js +3 -3
- package/dist/web/model-viewport-toolbar.js +11 -0
- package/dist/web/origin-rule.js +155 -0
- package/dist/web/pages.js +17 -14
- package/dist/web/panels.js +1 -1
- package/dist/web/project-access.js +1 -1
- package/dist/web/project-history.js +2 -2
- package/dist/web/project-modules.js +5 -5
- package/dist/web/project-reconciliation.js +1 -1
- package/dist/web/project-rfis.js +8 -3
- package/dist/web/project-workflows.js +8 -6
- package/dist/web/renderers.js +6 -0
- package/dist/web/report-csp.js +68 -0
- package/dist/web/revit-editor.js +22 -8
- package/dist/web/run-history.js +14 -4
- package/dist/web/steel-3d-core.js +39 -9
- package/dist/web/steel-3d-flo.js +331 -0
- package/dist/web/steel-3d-view.js +164 -0
- package/dist/web/steel-ai-marks.js +3 -1
- package/dist/web/steel-editor.html +583 -129
- package/dist/web/steel-environments.js +297 -0
- package/dist/web/steel-filter.html +3 -2
- package/dist/web/steel-model-v2-client-validation.js +8 -1
- package/dist/web/steel-model-v2-commands.js +23 -9
- package/dist/web/steel-model-v2-projection.js +1 -1
- package/dist/web/step-rename.js +3 -2
- package/dist/web/terminal-requests.js +79 -1
- package/dist/web/tool-updates.js +9 -7
- package/dist/web/vector-3d.html +1 -1
- package/dist/web/vector-editor.html +50 -8
- package/dist/web/workspace-root-management.js +1 -1
- package/dist/web/workspaces.js +2334 -253
- package/launch.mjs +5 -0
- package/package.json +11 -8
package/dist/web/chat.js
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
// #1890 PR 3b: the workspace history's pointer rows, the move notice on screen, and moves being followed now.
|
|
65
65
|
movedChats: [], movedChatsKnown: null, moveNotice: null, moveNoticeTimer: null, followingMoves: new Set(), movingPoll: null,
|
|
66
66
|
sessionReady: false, sessionOperation: null, sessionLifecycle: 0, sessionDisposed: false, sessionRecoveryHint: null,
|
|
67
|
-
scope: null, chats: [], archivedChats: [], unreadableChats: [], chat: null, events: [], capability: null, signInPending: new Set(), desktop: null,
|
|
67
|
+
scope: null, chats: [], archivedChats: [], unreadableChats: [], chat: null, events: [], capability: null, signInPending: new Set(), signInLandedAt: new Map(), desktop: null,
|
|
68
68
|
source: null, eventReconnectTimer: null, eventReconnectAttempt: 0, eventReconnectChatId: null, attachments: [], imageLimitChatId: null, followupSubmitting: false, followupUnknownId: null, resolvingFollowupIds: new Set(), retryingFollowupIds: new Set(), integrations: null, historyOpen: false, historyOpenings: 0, historyFilter: 'all', archivedHistoryOpen: false,
|
|
69
69
|
instructorAnswers: [], historyLoading: false, historyRequestGeneration: 0, picker: null, loading: false,
|
|
70
70
|
draftTimer: null, localDraft: null, backgroundDrafts: new Map(), draftWrites: new Map(), draftVersions: new Map(), unknownFollowups: new Map(), refreshTimer: null, scopeGeneration: 0, selectionGeneration: 0, openInGeneration: 0, choosingProvider: false,
|
|
@@ -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; })
|
|
@@ -219,13 +219,14 @@
|
|
|
219
219
|
// HTML error page, a proxy's plain text) is not FloLess's JSON, so it goes to the console, never into the message.
|
|
220
220
|
const json = body && typeof body === 'object' ? body : null;
|
|
221
221
|
if (!json) console.warn('[chat] a request was answered with something other than FloLess JSON', path, response.status, String(body ?? '').slice(0, 200));
|
|
222
|
-
const said =
|
|
222
|
+
const said = personText(json);
|
|
223
223
|
const error = new Error(said || failureCopy({ status: response.status, body: json || {} }, { retrySafe: readOnly }).text);
|
|
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
|
-
|
|
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
|
}
|
|
@@ -452,6 +456,23 @@
|
|
|
452
456
|
|| /^(?:Claude Code returned an error result: )?No conversation found with session ID: [0-9a-f-]{36}$/i.test(raw.trim())) {
|
|
453
457
|
return `${providerLabels[state.chat?.provider] || 'This AI app'} can no longer open this conversation’s saved history. Start a new conversation to continue.`;
|
|
454
458
|
}
|
|
459
|
+
// Claude Code's own sign-in failures, in a Claude conversation only. Anchored at the start (the CLI's sentence runs on
|
|
460
|
+
// past what is matched), so quoted or nested text such as "Bash output: …" never matches. errorNeedingSignIn offers
|
|
461
|
+
// its Sign in… button wherever this copy says "sign in to Claude again", and tells the busy renewal apart by its
|
|
462
|
+
// opening words: keep both, or move its tests with them.
|
|
463
|
+
if (state.chat?.provider === 'claude') {
|
|
464
|
+
// Another Claude process held the sign-in renewal (busy, or one that died mid-renewal) and Claude gave up. It
|
|
465
|
+
// clears itself within a minute (the CLI treats a lock as abandoned 60 s after its last update), so waiting and
|
|
466
|
+
// resending comes first; signing in again is the fallback.
|
|
467
|
+
if (/^(?:Claude Code returned an error result: )?(?:Failed to refresh OAuth token: another Claude Code process is refreshing it|Could not refresh your login because another Claude Code process is refreshing it)/.test(raw.trim())) {
|
|
468
|
+
return 'Claude couldn’t finish renewing its sign-in, so its reply stopped. Check anything it already did above, wait a minute, then send your message again. If it keeps happening, sign in to Claude again.';
|
|
469
|
+
}
|
|
470
|
+
// Claude's service refused its sign-in (an invalid, revoked or expired token it could not renew): reloading never
|
|
471
|
+
// fixes that, signing in does.
|
|
472
|
+
if (/^(?:Claude Code returned an error result: )?Failed to authenticate\b/.test(raw.trim())) {
|
|
473
|
+
return 'Claude couldn’t sign in, so its reply stopped. Sign in to Claude again, check anything it already did above, then send your message again.';
|
|
474
|
+
}
|
|
475
|
+
}
|
|
455
476
|
if (/process exited|app-server|command-line runtime|did not return a session|provider .* unavailable/i.test(raw)) {
|
|
456
477
|
return 'The selected AI service could not complete this request. Check your sign-in and try again.';
|
|
457
478
|
}
|
|
@@ -588,7 +609,9 @@
|
|
|
588
609
|
}
|
|
589
610
|
return;
|
|
590
611
|
}
|
|
591
|
-
const message =
|
|
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()
|
|
592
615
|
? 'Another AI Chat is changing this project or workflow. Wait for it to finish or stop it before sending here.'
|
|
593
616
|
: state.followupUnknownId || hasUnknownFollowup()
|
|
594
617
|
? 'FloLess could not confirm this message. Check its status and use the action beside it before sending again.'
|
|
@@ -1479,7 +1502,10 @@
|
|
|
1479
1502
|
meta.textContent = archived
|
|
1480
1503
|
? `${providerLabels[chat.provider]} · Archived ${eventTime({ createdAt: chat.archivedAt || chat.updatedAt })}`
|
|
1481
1504
|
: `${providerLabels[chat.provider]} · Created ${eventTime(chat)}`;
|
|
1482
|
-
|
|
1505
|
+
// #3255: from an earlier opening of this Workspace: it opens to be read. In place of its time, so the title keeps
|
|
1506
|
+
// its room (the day heading above still dates it, and the row's spoken label keeps the time).
|
|
1507
|
+
if (chat?.earlierOpening) meta.textContent = `${providerLabels[chat.provider]} · Read only`;
|
|
1508
|
+
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 })}`);
|
|
1483
1509
|
const rename = document.createElement('button');
|
|
1484
1510
|
rename.type = 'button'; rename.className = 'ai-chat-history-rename'; rename.textContent = '✎';
|
|
1485
1511
|
rename.dataset.commandId = `shell.chat-history-rename#${chat.chatId}`;
|
|
@@ -1512,7 +1538,7 @@
|
|
|
1512
1538
|
event.preventDefault(); event.stopPropagation(); deleteConversation(chat, remove);
|
|
1513
1539
|
});
|
|
1514
1540
|
actions.append(rename, archive, remove);
|
|
1515
|
-
actions.hidden = turnIsVisiblyActive(chat);
|
|
1541
|
+
actions.hidden = turnIsVisiblyActive(chat) || Boolean(chat?.earlierOpening);
|
|
1516
1542
|
row.append(title, meta, actions);
|
|
1517
1543
|
if (turnIsVisiblyActive(chat)) {
|
|
1518
1544
|
const spinner = document.createElement('span'); spinner.className = 'ai-chat-history-working';
|
|
@@ -1711,7 +1737,8 @@
|
|
|
1711
1737
|
/** A waiting move with a warning, for the conversation on screen: the sentence and the person's choices. */
|
|
1712
1738
|
function moveNoticeForChat(chat) {
|
|
1713
1739
|
const rehome = chat?.rehome;
|
|
1714
|
-
|
|
1740
|
+
// #3255: a conversation from an earlier opening of the Workspace is read only, so its move is not offered either.
|
|
1741
|
+
if (!rehome || chat?.earlierOpening || state.scope?.owner?.kind !== 'workspace' || rehome.state !== 'pending' || !rehome.warning) return null;
|
|
1715
1742
|
const keep = { label: 'Keep it here', command: 'shell.chat-move-keep', run: () => keepConversationHere(chat.chatId) };
|
|
1716
1743
|
const retry = { label: 'Try again', command: 'shell.chat-move-retry', run: () => retryConversationMove(chat.chatId) };
|
|
1717
1744
|
return rehome.targetGone
|
|
@@ -1852,7 +1879,7 @@
|
|
|
1852
1879
|
}
|
|
1853
1880
|
|
|
1854
1881
|
function beginRename() {
|
|
1855
|
-
if (!state.chat || turnIsVisiblyActive() || state.renaming) return;
|
|
1882
|
+
if (!state.chat || turnIsVisiblyActive() || state.renaming || state.chat?.earlierOpening) return;
|
|
1856
1883
|
state.renaming = { original: state.chat.title };
|
|
1857
1884
|
ui.title.contentEditable = 'true';
|
|
1858
1885
|
ui.title.setAttribute('role', 'textbox');
|
|
@@ -1873,7 +1900,7 @@
|
|
|
1873
1900
|
ui.title.removeAttribute('role');
|
|
1874
1901
|
ui.title.removeAttribute('aria-label');
|
|
1875
1902
|
ui.title.classList.remove('editing');
|
|
1876
|
-
ui.rename.hidden = !state.chat || Boolean(state.chat.activeTurn);
|
|
1903
|
+
ui.rename.hidden = !state.chat || Boolean(state.chat.activeTurn) || Boolean(state.chat?.earlierOpening);
|
|
1877
1904
|
if (!save || !title || title === original || !snapshot) {
|
|
1878
1905
|
ui.title.textContent = original;
|
|
1879
1906
|
return;
|
|
@@ -4694,7 +4721,8 @@
|
|
|
4694
4721
|
*/
|
|
4695
4722
|
function probeSources(turnId, index) {
|
|
4696
4723
|
const chatId = state.chat?.chatId;
|
|
4697
|
-
|
|
4724
|
+
// #3255: a conversation from an earlier opening of the Workspace is read as history; its sources are not re-checked.
|
|
4725
|
+
if (!chatId || !turnId || state.chat?.earlierOpening || answerRunning(turnId)) return;
|
|
4698
4726
|
const key = `${chatId}\u0000${turnId}`;
|
|
4699
4727
|
if (probedTurns.has(key) || ![...index.byAnchor.values()].some((row) => (row.entry.status === 'resolved' && !row.entry.bare) || row.choice)) return;
|
|
4700
4728
|
probedTurns.add(key);
|
|
@@ -4915,7 +4943,7 @@
|
|
|
4915
4943
|
help.textContent = deliveryReceipt.reason;
|
|
4916
4944
|
item.append(help);
|
|
4917
4945
|
}
|
|
4918
|
-
if (delivery === 'unknown' && event.clientSubmissionId) {
|
|
4946
|
+
if (delivery === 'unknown' && event.clientSubmissionId && !state.chat?.earlierOpening) {
|
|
4919
4947
|
const help = document.createElement('span'); help.className = 'ai-chat-message-delivery ai-chat-message-delivery-detail';
|
|
4920
4948
|
help.textContent = 'AI may have received this. Check the conversation before continuing.';
|
|
4921
4949
|
const resolve = button(event.optimistic ? 'Review draft and continue' : 'Continue without resending',
|
|
@@ -4932,7 +4960,7 @@
|
|
|
4932
4960
|
item.append(help, resolve);
|
|
4933
4961
|
}
|
|
4934
4962
|
if (delivery === 'not-sent' && deliveryReceipt?.retryable !== false
|
|
4935
|
-
&& event.clientSubmissionId && !state.chat?.archivedAt
|
|
4963
|
+
&& event.clientSubmissionId && !state.chat?.archivedAt && !state.chat?.earlierOpening
|
|
4936
4964
|
&& state.chat?.state !== 'recovery'
|
|
4937
4965
|
&& !state.followupUnknownId && !hasUnknownFollowup()
|
|
4938
4966
|
&& (!state.chat?.activeTurn || state.chat.activeTurn.turnId === event.turnId)
|
|
@@ -5064,7 +5092,9 @@
|
|
|
5064
5092
|
item.classList.toggle('ai-chat-request-aside', set === 'dismissed' || set === 'expired');
|
|
5065
5093
|
// A request I dismissed from here can be taken back from here.
|
|
5066
5094
|
let undo = item.querySelector('.ai-chat-request-undo');
|
|
5067
|
-
|
|
5095
|
+
// #3255: a card in a conversation from an earlier opening of the Workspace is read only: no Dismiss or Undo here.
|
|
5096
|
+
const history = Boolean(state.chat?.earlierOpening);
|
|
5097
|
+
if ((set === 'dismissed' || set === 'expired') && !history) {
|
|
5068
5098
|
if (!undo) {
|
|
5069
5099
|
undo = button('Undo', `shell.chat-request-undo#${requestId || 'linked request'}`, 'ai-chat-request-undo');
|
|
5070
5100
|
undo.dataset.tip = 'Put this request back in Requests, exactly as it was';
|
|
@@ -5075,7 +5105,7 @@
|
|
|
5075
5105
|
// Nothing is left to set aside once the request is finished, dismissed or gone; its card still folds (its chevron).
|
|
5076
5106
|
const finished = Boolean(live && (live.found === false || set));
|
|
5077
5107
|
const dismiss = item.querySelector('.ai-chat-request-dismiss');
|
|
5078
|
-
if (dismiss) dismiss.hidden = finished;
|
|
5108
|
+
if (dismiss) dismiss.hidden = finished || history;
|
|
5079
5109
|
// #2678: what a hidden card's line says still waits: the person (the server's "needs you", except a request only waiting
|
|
5080
5110
|
// for the AI to start it), or the AI. The line says the card's own live word either way.
|
|
5081
5111
|
if (finished) item.dataset.waits = 'done';
|
|
@@ -5091,7 +5121,7 @@
|
|
|
5091
5121
|
if (!note) { note = document.createElement('p'); note.className = 'ai-chat-request-note'; note.setAttribute('role', 'status'); item.append(note); }
|
|
5092
5122
|
note.textContent = entry.note;
|
|
5093
5123
|
} else note?.remove();
|
|
5094
|
-
if (entry.hold) paintRequestAsk(item, entry);
|
|
5124
|
+
if (entry.hold && !history) paintRequestAsk(item, entry);
|
|
5095
5125
|
else item.querySelector('.ai-chat-request-ask')?.remove();
|
|
5096
5126
|
}
|
|
5097
5127
|
|
|
@@ -5130,6 +5160,7 @@
|
|
|
5130
5160
|
}
|
|
5131
5161
|
|
|
5132
5162
|
async function dismissRequestFromCard(item) {
|
|
5163
|
+
if (state.chat?.earlierOpening) return;
|
|
5133
5164
|
const requestId = item.dataset.requestId;
|
|
5134
5165
|
if (!requestId) return;
|
|
5135
5166
|
const entry = requestCardEntry(requestId);
|
|
@@ -5180,7 +5211,9 @@
|
|
|
5180
5211
|
}
|
|
5181
5212
|
if (done.body?.code === 'request-held' && done.body.hold) { entry.busy = null; askStopThenDismiss(requestId, done.body.hold); return; }
|
|
5182
5213
|
if (done.status === 404 || done.body?.code === 'request-already-set-aside') { void refreshRequestCards({ force: true }); return; }
|
|
5183
|
-
cardNotice(requestId, done.body
|
|
5214
|
+
cardNotice(requestId, personText(done.body) || (done.body?.diagnostic
|
|
5215
|
+
? 'FloLess couldn’t tell whether that request was dismissed. Check Requests before trying Dismiss again.'
|
|
5216
|
+
: 'FloLess couldn’t dismiss that request. It is still in Requests; try Dismiss again.'));
|
|
5184
5217
|
} catch {
|
|
5185
5218
|
cardNotice(requestId, 'FloLess couldn’t reach the server, so the request was not dismissed. Try Dismiss again in a moment.');
|
|
5186
5219
|
} finally {
|
|
@@ -5229,7 +5262,7 @@
|
|
|
5229
5262
|
const go = button('Stop it and dismiss', `shell.chat-request-stop-dismiss#${item.dataset.requestId || 'linked request'}`, 'danger');
|
|
5230
5263
|
go.disabled = Boolean(entry.busy);
|
|
5231
5264
|
go.addEventListener('click', async () => {
|
|
5232
|
-
if (entry.busy) return;
|
|
5265
|
+
if (entry.busy || state.chat?.earlierOpening) return;
|
|
5233
5266
|
entry.busy = 'stop'; entry.askError = ''; repaintRequestCard(requestId);
|
|
5234
5267
|
openFeedCard(item.dataset.cardEventId); // #2678: as Dismiss: the Undo it offers stays in front of them
|
|
5235
5268
|
let stopped = true; // a stale stop means the work had already ended or changed: never claimed as "stopped"
|
|
@@ -5270,6 +5303,7 @@
|
|
|
5270
5303
|
}
|
|
5271
5304
|
|
|
5272
5305
|
async function restoreRequestFromCard(item) {
|
|
5306
|
+
if (state.chat?.earlierOpening) return;
|
|
5273
5307
|
const requestId = item.dataset.requestId;
|
|
5274
5308
|
const entry = requestCardEntry(requestId);
|
|
5275
5309
|
if (entry.busy) return;
|
|
@@ -5277,7 +5311,12 @@
|
|
|
5277
5311
|
let restored = false;
|
|
5278
5312
|
try {
|
|
5279
5313
|
const done = await lifecycleCall(requestId, 'restore');
|
|
5280
|
-
if (!done.ok) {
|
|
5314
|
+
if (!done.ok) {
|
|
5315
|
+
cardNotice(requestId, personText(done.body) || (done.body?.diagnostic
|
|
5316
|
+
? 'FloLess couldn’t tell whether that request was put back. Check Requests before trying Undo again.'
|
|
5317
|
+
: 'FloLess couldn’t put that request back. It is still in Requests → Done; try Undo again.'));
|
|
5318
|
+
return;
|
|
5319
|
+
}
|
|
5281
5320
|
item = liveRequestCard(requestId);
|
|
5282
5321
|
if (item) forgetHiddenRequestCard(item.dataset.cardEventId);
|
|
5283
5322
|
await refreshRequestCards({ force: true });
|
|
@@ -5400,6 +5439,19 @@
|
|
|
5400
5439
|
const label = document.createElement('strong');
|
|
5401
5440
|
label.textContent = autoReceiptLabel(event);
|
|
5402
5441
|
const payload = event.payload || {};
|
|
5442
|
+
if (payload.protectedCommand === true) {
|
|
5443
|
+
// A "don't ask again" choice let a protected command run: say so plainly, with the command in its tooltip.
|
|
5444
|
+
label.textContent = 'Ran without asking';
|
|
5445
|
+
const grant = String(payload.grantLabel || 'This exact command');
|
|
5446
|
+
const about = grant.startsWith('This exact command') ? 'this exact command' : `${grant.charAt(0).toLowerCase()}${grant.slice(1)}`;
|
|
5447
|
+
item.append(label, document.createTextNode(` · because you said not to ask again ${payload.scope === 'request' ? 'during this reply' : 'in this conversation'} about ${about}.`));
|
|
5448
|
+
// Newer servers send the command alone; an older receipt carried the card text cut short, often before its command.
|
|
5449
|
+
const summary = String(payload.summary || '');
|
|
5450
|
+
const command = summary.includes('\nCommand: ') ? summary.split('\nCommand: ').slice(1).join('\nCommand: ')
|
|
5451
|
+
: summary.includes('\nWhy: ') ? '' : summary;
|
|
5452
|
+
if (command) item.dataset.tip = command.slice(0, 300);
|
|
5453
|
+
return item;
|
|
5454
|
+
}
|
|
5403
5455
|
const what = payload.scopeAdd ? `Added ${payload.scopeAdd.target?.kind || 'project'} “${payload.scopeAdd.label}” to this chat`
|
|
5404
5456
|
: payload.create ? `Created the workflow “${payload.create.name}”`
|
|
5405
5457
|
: String(payload.summary || payload.grantLabel || 'An action').slice(0, 200);
|
|
@@ -5840,13 +5892,33 @@
|
|
|
5840
5892
|
const current = actionProposalState(proposalId);
|
|
5841
5893
|
// #2266: an unfinished card asks FloLess once whether it has moved on (see syncActionProposal).
|
|
5842
5894
|
if (!entry.synced && !ACTION_FINAL.has(current.state)) { entry.synced = true; void syncActionProposal(proposalId); }
|
|
5843
|
-
const signature = JSON.stringify([event.eventId, current.state, current.result?.message || null, current.supersededBy, current.next || null, entry.busy, entry
|
|
5895
|
+
const signature = JSON.stringify([event.eventId, current.state, current.result?.message || null, current.supersededBy, current.next || null, entry.busy, actionStatusLine(entry, current)]);
|
|
5844
5896
|
if (entry.node && entry.signature === signature) return entry.node;
|
|
5845
5897
|
entry.node = paintActionProposal(event, payload, proposalId, entry, current);
|
|
5846
5898
|
entry.signature = signature;
|
|
5847
5899
|
return entry.node;
|
|
5848
5900
|
}
|
|
5849
5901
|
|
|
5902
|
+
/**
|
|
5903
|
+
* #3238: what a waiting card's line says. The click was answered "confirm that card first"; once that card runs, and once
|
|
5904
|
+
* it has made what this card needs, the line says so with FloLess's own words for each, rather than keep a sentence that
|
|
5905
|
+
* is no longer true. A card that card was replaced by is followed, and waiting on the new one says to confirm it (never
|
|
5906
|
+
* the expired one). One that finished without naming what it made keeps the answer: FloLess ends this card then. A card
|
|
5907
|
+
* this window does not show keeps the answer as it came. Once this card itself has moved on (confirmed from another
|
|
5908
|
+
* window, say), "confirm it again" no longer applies, and the line is the card's own.
|
|
5909
|
+
*/
|
|
5910
|
+
function actionStatusLine(entry, current) {
|
|
5911
|
+
const awaits = entry.waitingOn;
|
|
5912
|
+
if (!awaits) return entry.error;
|
|
5913
|
+
if (current.state !== 'proposed') return '';
|
|
5914
|
+
let id = awaits.id;
|
|
5915
|
+
let awaited = actionProposalState(id);
|
|
5916
|
+
for (let hops = 0; awaited.supersededBy && hops < ACTION_CARDS_KEPT; hops++) { id = awaited.supersededBy; awaited = actionProposalState(id); }
|
|
5917
|
+
if (awaited.state === 'done') return awaited.result?.made?.id ? awaits.done : entry.error;
|
|
5918
|
+
if (awaited.state === 'executing') return awaits.running;
|
|
5919
|
+
return awaited.state === 'proposed' && id !== awaits.id ? awaits.waiting : entry.error;
|
|
5920
|
+
}
|
|
5921
|
+
|
|
5850
5922
|
function repaintActionCards(focusProposal) {
|
|
5851
5923
|
for (const old of ui.feed?.querySelectorAll('.ai-chat-action-card[data-proposal-id]') || []) {
|
|
5852
5924
|
const event = state.events.find((known) => known.eventId === old.dataset.eventId);
|
|
@@ -5869,6 +5941,78 @@
|
|
|
5869
5941
|
return control;
|
|
5870
5942
|
}
|
|
5871
5943
|
|
|
5944
|
+
/**
|
|
5945
|
+
* #3131 F2: an action's inputs exactly as they run: each key as it is spelled, each text as written, and a number, yes/no
|
|
5946
|
+
* or empty value as its literal (a text that reads like one is quoted), and a list says it is one, so two different
|
|
5947
|
+
* inputs never look the same.
|
|
5948
|
+
*/
|
|
5949
|
+
function exactInputsTree(data) {
|
|
5950
|
+
const literal = (text) => assistantNode('span', 'ai-chat-action-input-literal', text);
|
|
5951
|
+
const value = (v) => {
|
|
5952
|
+
if (v !== null && typeof v === 'object') return exactInputsTree(v);
|
|
5953
|
+
if (typeof v !== 'string') return literal(JSON.stringify(v));
|
|
5954
|
+
return v === '' || v.trim() !== v || /^(true|false|null|-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?)$/.test(v) ? literal(JSON.stringify(v)) : document.createTextNode(v);
|
|
5955
|
+
};
|
|
5956
|
+
const list = document.createElement('dl');
|
|
5957
|
+
list.className = 'assistant-card-result-list';
|
|
5958
|
+
const entries = Array.isArray(data) ? data.map((v, i) => [`${i + 1}`, v]) : Object.entries(data);
|
|
5959
|
+
if (!entries.length) return literal(Array.isArray(data) ? '[]' : '{}');
|
|
5960
|
+
for (const [key, v] of entries) {
|
|
5961
|
+
const dd = document.createElement('dd');
|
|
5962
|
+
dd.append(value(v));
|
|
5963
|
+
list.append(assistantNode('dt', '', key), dd);
|
|
5964
|
+
}
|
|
5965
|
+
if (!Array.isArray(data)) return list;
|
|
5966
|
+
const items = document.createDocumentFragment();
|
|
5967
|
+
items.append(literal(`list of ${data.length}`), list);
|
|
5968
|
+
return items;
|
|
5969
|
+
}
|
|
5970
|
+
|
|
5971
|
+
/**
|
|
5972
|
+
* #3131 F2: every input the action uses, as FloLess stored it with the card: each value whole, or one too long to read
|
|
5973
|
+
* named by its size and fingerprint (and listed by name). The summary may be shortened; this never is, so what the person
|
|
5974
|
+
* confirms is what runs. Open from the start when the summary was cut or a value is named, and kept as the person left it
|
|
5975
|
+
* when the card repaints.
|
|
5976
|
+
*/
|
|
5977
|
+
function actionInputs(payload, proposalId, summaryText, entry) {
|
|
5978
|
+
const inputs = payload.inputs;
|
|
5979
|
+
if (inputs === undefined || inputs === null || (typeof inputs === 'object' && !Object.keys(inputs).length)) return null;
|
|
5980
|
+
const named = Array.isArray(payload.inputsNamed) ? payload.inputsNamed.map(String) : [];
|
|
5981
|
+
const withheld = Array.isArray(payload.inputsWithheld) ? payload.inputsWithheld.map(String) : [];
|
|
5982
|
+
if (typeof entry.inputsOpen !== 'boolean') entry.inputsOpen = payload.summaryCut === true || named.length > 0;
|
|
5983
|
+
const wrap = document.createElement('div');
|
|
5984
|
+
wrap.className = 'ai-chat-action-inputs';
|
|
5985
|
+
const label = (open) => (open ? 'Hide exact inputs' : 'Show exact inputs');
|
|
5986
|
+
const toggle = actionButton(label(entry.inputsOpen), 'shell.chat-action-inputs', proposalId, summaryText, 'assistant-card-result-more');
|
|
5987
|
+
toggle.dataset.tip = 'Shows every input this action uses.';
|
|
5988
|
+
const body = assistantNode('div', 'assistant-card-result-body assistant-card-result-full ai-chat-action-inputs-body');
|
|
5989
|
+
body.id = `ai-chat-action-inputs-${proposalId}`;
|
|
5990
|
+
body.tabIndex = 0;
|
|
5991
|
+
body.setAttribute('role', 'group');
|
|
5992
|
+
body.setAttribute('aria-label', 'Exact inputs');
|
|
5993
|
+
if (payload.summaryCut === true) body.append(assistantNode('p', 'ai-chat-filter-note ai-chat-action-inputs-note', 'The summary above is shortened. Every input this action uses is listed here.'));
|
|
5994
|
+
if (named.length) {
|
|
5995
|
+
body.append(assistantNode('p', 'ai-chat-filter-note ai-chat-action-inputs-note',
|
|
5996
|
+
`Too long to show here, but sent whole: ${named.join(', ')}. Each is named by its size and a fingerprint of its exact content.`));
|
|
5997
|
+
}
|
|
5998
|
+
if (withheld.length) {
|
|
5999
|
+
body.append(assistantNode('p', 'ai-chat-filter-note ai-chat-action-inputs-note',
|
|
6000
|
+
`Not shown because it looks like a password or key, but sent as given: ${withheld.join(', ')}.`));
|
|
6001
|
+
}
|
|
6002
|
+
body.append(typeof inputs === 'object' ? exactInputsTree(inputs) : assistantNode('p', 'ai-chat-filter-note', String(inputs)));
|
|
6003
|
+
const show = (open) => {
|
|
6004
|
+
entry.inputsOpen = open;
|
|
6005
|
+
body.hidden = !open;
|
|
6006
|
+
toggle.textContent = label(open);
|
|
6007
|
+
toggle.setAttribute('aria-expanded', String(open));
|
|
6008
|
+
};
|
|
6009
|
+
toggle.setAttribute('aria-controls', body.id);
|
|
6010
|
+
toggle.addEventListener('click', () => show(!entry.inputsOpen));
|
|
6011
|
+
show(entry.inputsOpen);
|
|
6012
|
+
wrap.append(toggle, body);
|
|
6013
|
+
return wrap;
|
|
6014
|
+
}
|
|
6015
|
+
|
|
5872
6016
|
/**
|
|
5873
6017
|
* Show one connection in its project's model editor, selected and framed (#2450). Resolves the editor's
|
|
5874
6018
|
* own outcome (see `openConnection` in workspaces.js), or null when the shell cannot do it here. Throws
|
|
@@ -6039,9 +6183,9 @@
|
|
|
6039
6183
|
|
|
6040
6184
|
async function actOnProposal(event, proposalId, verb) {
|
|
6041
6185
|
const entry = actionCards.get(proposalId);
|
|
6042
|
-
if (!entry || entry.busy) return;
|
|
6186
|
+
if (!entry || entry.busy || state.chat?.earlierOpening) return;
|
|
6043
6187
|
const title = String(event.payload?.title || 'the action');
|
|
6044
|
-
entry.busy = verb; entry.error = '';
|
|
6188
|
+
entry.busy = verb; entry.error = ''; entry.waitingOn = null;
|
|
6045
6189
|
repaintActionCards();
|
|
6046
6190
|
let focus = proposalId;
|
|
6047
6191
|
try {
|
|
@@ -6066,10 +6210,15 @@
|
|
|
6066
6210
|
} else if (body.fresh) {
|
|
6067
6211
|
// The target changed or the offer ended: the old card says so, and a fresh card shows the current state.
|
|
6068
6212
|
entry.local = { state: body.proposal?.state || 'superseded', result: null, supersededBy: body.fresh.id };
|
|
6069
|
-
announce(body
|
|
6213
|
+
announce(personText(body) || 'It changed after it was suggested. A new card shows the current state.');
|
|
6070
6214
|
} else {
|
|
6071
|
-
|
|
6215
|
+
// #3238: "waiting" changed nothing about this card, so it is not kept as the card's state: a later update (another
|
|
6216
|
+
// window confirming it) is then not outranked by this answer's "proposed".
|
|
6217
|
+
if (body.proposal?.state && body.code !== 'waiting') entry.local = { state: body.proposal.state, result: body.proposal.result || null, supersededBy: body.proposal.supersededBy || null };
|
|
6072
6218
|
entry.error = body.error || 'FloLess could not do that just now. Try again in a moment.';
|
|
6219
|
+
// #3238: "confirm that card first". The line then follows that card (actionStatusLine), so it never goes stale.
|
|
6220
|
+
const awaits = body.code === 'waiting' ? body.awaits : null;
|
|
6221
|
+
if (awaits && ['id', 'waiting', 'running', 'done'].every((key) => typeof awaits[key] === 'string')) entry.waitingOn = awaits;
|
|
6073
6222
|
}
|
|
6074
6223
|
} catch {
|
|
6075
6224
|
entry.error = 'FloLess could not be reached. Check that it is still running, then try again.';
|
|
@@ -6099,9 +6248,11 @@
|
|
|
6099
6248
|
card.setAttribute('aria-labelledby', titleId);
|
|
6100
6249
|
|
|
6101
6250
|
// Finished, set aside or replaced: one quiet line that says honestly what happened.
|
|
6251
|
+
// #3238: a card that waited for another card, which ended without making what it needed, says why.
|
|
6252
|
+
const ended = current.result?.code === 'card-ended' && typeof current.result.message === 'string' ? current.result.message.trim() : '';
|
|
6102
6253
|
const collapsed = {
|
|
6103
6254
|
declined: `Not now: ${title}`,
|
|
6104
|
-
expired: `Offer ended: ${title}. Ask again if you still want it.`,
|
|
6255
|
+
expired: ended ? `Offer ended: ${title}. ${ended}` : `Offer ended: ${title}. Ask again if you still want it.`,
|
|
6105
6256
|
superseded: `Replaced by a newer suggestion: ${title}`,
|
|
6106
6257
|
cancelled: `Stopped: ${title}. Work already sent to the host may remain.`,
|
|
6107
6258
|
}[current.state];
|
|
@@ -6168,10 +6319,12 @@
|
|
|
6168
6319
|
terms.append(label, document.createTextNode(String(payload.terms)));
|
|
6169
6320
|
card.append(terms);
|
|
6170
6321
|
}
|
|
6322
|
+
const inputs = actionInputs(payload, proposalId, summaryText, entry);
|
|
6323
|
+
if (inputs) card.append(inputs);
|
|
6171
6324
|
|
|
6172
6325
|
if (handedOver) {
|
|
6173
6326
|
card.classList.add('is-handed-over');
|
|
6174
|
-
status.textContent = entry
|
|
6327
|
+
status.textContent = actionStatusLine(entry, current) || String(current.result?.message || 'It is ready for you. Press it to finish.');
|
|
6175
6328
|
card.append(status);
|
|
6176
6329
|
return card;
|
|
6177
6330
|
}
|
|
@@ -6182,7 +6335,7 @@
|
|
|
6182
6335
|
// and the card's edge turns amber so the person notices their choice was not what ran.
|
|
6183
6336
|
const resultNote = typeof current.result?.note === 'string' && current.result.note ? current.result.note : '';
|
|
6184
6337
|
if (resultNote) card.classList.add('is-fallback');
|
|
6185
|
-
status.textContent = entry
|
|
6338
|
+
status.textContent = actionStatusLine(entry, current) || resultNote || (current.next ? 'Done. Its result is ready to view.' : String(payload.doneNote || 'Done.'));
|
|
6186
6339
|
if (current.next) {
|
|
6187
6340
|
// What the finished action made (a run's report): opening it only shows it, it runs nothing again.
|
|
6188
6341
|
const actions = document.createElement('div');
|
|
@@ -6230,11 +6383,17 @@
|
|
|
6230
6383
|
why.textContent = `Why: ${String(payload.why)}`;
|
|
6231
6384
|
card.append(why);
|
|
6232
6385
|
}
|
|
6386
|
+
// #3255: a request in a conversation from an earlier opening of the Workspace is history: it shows what was asked.
|
|
6387
|
+
if (state.chat?.earlierOpening) {
|
|
6388
|
+
status.textContent = 'Read only: this conversation is from before the Workspace was reopened.';
|
|
6389
|
+
card.append(status);
|
|
6390
|
+
return card;
|
|
6391
|
+
}
|
|
6233
6392
|
const actions = document.createElement('div');
|
|
6234
6393
|
actions.className = 'ai-chat-filter-actions';
|
|
6235
6394
|
if (current.state === 'executing') {
|
|
6236
6395
|
// A window step whose report did not land stays running here; what the window said (what to press) still shows.
|
|
6237
|
-
status.textContent = entry
|
|
6396
|
+
status.textContent = actionStatusLine(entry, current) || (actionId === 'workflows.run' || actionId === 'routines.run' ? 'Running…' : 'Working…');
|
|
6238
6397
|
if (actionId === 'workflows.run') {
|
|
6239
6398
|
const stop = actionButton('Stop', 'shell.chat-action-stop', proposalId, summaryText);
|
|
6240
6399
|
stop.dataset.tip = 'Asks the run to stop. Work already sent to the host may remain.';
|
|
@@ -6266,7 +6425,7 @@
|
|
|
6266
6425
|
const note = document.createElement('p');
|
|
6267
6426
|
note.className = 'ai-chat-filter-note';
|
|
6268
6427
|
// #2811: the one question this dialog asks only the person, said on the card that takes them there.
|
|
6269
|
-
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.'
|
|
6428
|
+
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.'
|
|
6270
6429
|
: 'Only you can do this. Nothing runs from here.';
|
|
6271
6430
|
status.textContent = entry.error;
|
|
6272
6431
|
card.append(actions, note, status);
|
|
@@ -6287,7 +6446,7 @@
|
|
|
6287
6446
|
meta.className = 'ai-chat-filter-note ai-chat-action-meta';
|
|
6288
6447
|
meta.textContent = payload.revision === 'bound' ? 'Checked against how it is now; if it changes first, you will be asked again.'
|
|
6289
6448
|
: 'Acts on things as they are when you confirm.';
|
|
6290
|
-
status.textContent = entry
|
|
6449
|
+
status.textContent = actionStatusLine(entry, current);
|
|
6291
6450
|
card.append(actions, meta, status);
|
|
6292
6451
|
return card;
|
|
6293
6452
|
}
|
|
@@ -6498,7 +6657,7 @@
|
|
|
6498
6657
|
Object.assign(document.createElement('span'), { className: 'ai-chat-readiness-assumption-meta', textContent: `About: ${a.readingText}` }),
|
|
6499
6658
|
Object.assign(document.createElement('span'), { className: 'ai-chat-readiness-assumption-meta',
|
|
6500
6659
|
textContent: `You confirmed this on ${readinessDate(a.confirmedAt)}.${a.proposedBy === 'ai' ? ' The AI wrote the words.' : ''}` }));
|
|
6501
|
-
if (card.projectId) {
|
|
6660
|
+
if (card.projectId && !state.chat?.earlierOpening) {
|
|
6502
6661
|
const withdraw = button('Withdraw', 'shell.chat-readiness-withdraw-assumption', 'ai-chat-source-action');
|
|
6503
6662
|
withdraw.setAttribute('aria-label', `Withdraw assumption: ${a.statement}`);
|
|
6504
6663
|
withdraw.dataset.commandInstanceLabel = `${row.jointId}: ${a.statement}`;
|
|
@@ -7329,7 +7488,8 @@
|
|
|
7329
7488
|
card.append(line, retry);
|
|
7330
7489
|
return card;
|
|
7331
7490
|
}
|
|
7332
|
-
|
|
7491
|
+
// #3255: a suggestion made in an earlier opening of the Workspace can no longer be used, so it is not offered.
|
|
7492
|
+
if (!server || state.chat?.earlierOpening) { card.hidden = true; return card; }
|
|
7333
7493
|
|
|
7334
7494
|
const status = assistantNode('p', 'ai-chat-filter-note ai-chat-action-status assistant-card-status');
|
|
7335
7495
|
status.setAttribute('role', 'status');
|
|
@@ -7573,7 +7733,7 @@
|
|
|
7573
7733
|
}
|
|
7574
7734
|
|
|
7575
7735
|
async function useAssistantCard(entry, text) {
|
|
7576
|
-
if (entry.busy) return;
|
|
7736
|
+
if (entry.busy || state.chat?.earlierOpening) return;
|
|
7577
7737
|
const chatId = entry.event.chatId;
|
|
7578
7738
|
// #2678: the person's own click holds the card open (a read's result is shown on it), counted from the click so a
|
|
7579
7739
|
// collapse while it is answered still wins.
|
|
@@ -7687,7 +7847,7 @@
|
|
|
7687
7847
|
}
|
|
7688
7848
|
|
|
7689
7849
|
async function dismissAssistantCard(entry, title, how) {
|
|
7690
|
-
if (entry.busy) return;
|
|
7850
|
+
if (entry.busy || state.chat?.earlierOpening) return;
|
|
7691
7851
|
entry.busy = how; entry.error = '';
|
|
7692
7852
|
repaintAssistantCard(entry);
|
|
7693
7853
|
try {
|
|
@@ -7706,7 +7866,7 @@
|
|
|
7706
7866
|
}
|
|
7707
7867
|
|
|
7708
7868
|
async function bringBackAssistantCard(entry, title) {
|
|
7709
|
-
if (entry.busy) return;
|
|
7869
|
+
if (entry.busy || state.chat?.earlierOpening) return;
|
|
7710
7870
|
entry.busy = 'undo'; entry.error = '';
|
|
7711
7871
|
repaintAssistantCard(entry);
|
|
7712
7872
|
try {
|
|
@@ -8104,7 +8264,8 @@
|
|
|
8104
8264
|
// #2046: a next move the Guide suggested; web/guide.js paints it and owns its button.
|
|
8105
8265
|
// #2399 PR C2: a next step the assistant suggested in a project, workflow or workspace chat; this file paints it.
|
|
8106
8266
|
if (event.type === 'next-move' && event.payload?.assistant === true) return renderAssistantCard(event);
|
|
8107
|
-
|
|
8267
|
+
// #3255: a next move from an earlier opening of the Workspace can no longer be taken, so it is not offered.
|
|
8268
|
+
if (event.type === 'next-move') return state.chat?.earlierOpening ? null : window.flolessGuide?.renderNextMove?.(event) || null;
|
|
8108
8269
|
// #2185: what came of a card's button repaints that card; it is never a line of its own.
|
|
8109
8270
|
if (event.type === 'next-move-update') { window.flolessGuide?.applyMoveUpdate?.(event); return null; }
|
|
8110
8271
|
if (event.type === 'approval-decided' && event.payload?.automatic === true && event.payload?.connectionCheck) return renderConnectionCheckAllowed(event);
|
|
@@ -9058,10 +9219,11 @@
|
|
|
9058
9219
|
else if (!response.ok) {
|
|
9059
9220
|
const body = (response.headers.get('content-type') || '').includes('application/json') ? await response.json().catch(() => null) : null;
|
|
9060
9221
|
// #3097: the server's own sentence when it wrote one; otherwise why and what to do, never the status number.
|
|
9061
|
-
|
|
9222
|
+
const said = personText(body);
|
|
9223
|
+
if (!said) console.warn('[chat] a recorded picture could not be shown', url, response.status, body?.error || '');
|
|
9062
9224
|
// The shared sentence's cause and next step; for an unexplained failure its "couldn’t tell why" is kept too.
|
|
9063
|
-
const parts =
|
|
9064
|
-
text =
|
|
9225
|
+
const parts = said ? null : failureParts({ status: response.status, body: body || {} }, { action: 'show this picture', retrySafe: true });
|
|
9226
|
+
text = said ? `could not be shown: ${said}`
|
|
9065
9227
|
: `could not be shown${parts.kind === 'unexpected' ? ', and FloLess couldn’t tell why' : ''}. ${parts.detail}`;
|
|
9066
9228
|
}
|
|
9067
9229
|
} catch { text = 'could not be shown: FloLess did not answer. Make sure it is still running.'; }
|
|
@@ -9683,8 +9845,9 @@
|
|
|
9683
9845
|
} else if (row.kind === 'origin') {
|
|
9684
9846
|
q.otherInputLabel = 'Grid crossing (optional)'; q.otherPlaceholder = 'A/1'; q.otherUncapped = true;
|
|
9685
9847
|
q.question = 'Which grid crossing is the model’s origin (0, 0)?'; q.layout = 'grid'; q.confirmSelection = true;
|
|
9686
|
-
|
|
9687
|
-
row.
|
|
9848
|
+
// #2909 V4: a crossing past a grid line's end may still be chosen; the card says so before it can be confirmed.
|
|
9849
|
+
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) }); });
|
|
9850
|
+
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) }); });
|
|
9688
9851
|
q.recommended = Number.isInteger(row.proposed) ? row.proposed : null;
|
|
9689
9852
|
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.');
|
|
9690
9853
|
} else {
|
|
@@ -9699,6 +9862,12 @@
|
|
|
9699
9862
|
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 }); });
|
|
9700
9863
|
}
|
|
9701
9864
|
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.');
|
|
9865
|
+
// #2909 (owner ruling 2026-11-08): in a Quick read whose person chose to pick the origin, they can hand it back.
|
|
9866
|
+
// A real answer with a recorded outcome, so it comes before the "None of these" escape hatch (UX review).
|
|
9867
|
+
if (kind === 'setup' && row.kind === 'origin' && entry.view?.originHandBack === true) {
|
|
9868
|
+
q.options.push({ shown: 'Let the AI choose', description: SETUP_HANDBACK_WORDS, confirmLabel: 'Let the AI choose the model origin', tag: '' });
|
|
9869
|
+
choices.push({ key, action: 'to-ai' });
|
|
9870
|
+
}
|
|
9702
9871
|
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' }); }
|
|
9703
9872
|
if (kind === 'setup') { const banner = setupConflictBanner(row); if (banner) q.context.push(banner.textContent); }
|
|
9704
9873
|
const controlKey = kind === 'height' ? `${row.memberId} ${row.endWord}` : key;
|
|
@@ -9781,7 +9950,8 @@
|
|
|
9781
9950
|
const showing = tray.querySelector('.ai-chat-drawing-step');
|
|
9782
9951
|
const heldFocus = showing?.contains(document.activeElement) ? document.activeElement : null;
|
|
9783
9952
|
// A hidden approval or AI question still holds the slot (Codex review round 3): its line is not an .ai-chat-approval.
|
|
9784
|
-
|
|
9953
|
+
// #3255: nothing in a conversation from an earlier opening of the Workspace waits for an answer.
|
|
9954
|
+
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; }
|
|
9785
9955
|
const entries = [...setupCards.values()].map((entry) => ({ kind: 'setup', entry })).concat([...heightCards.values()].map((entry) => ({ kind: 'height', entry })))
|
|
9786
9956
|
.filter(({ entry }) => drawingEntryCurrent(entry) && entry.view?.open && !entry.reloadPending && !entry.loading)
|
|
9787
9957
|
.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);
|
|
@@ -9881,6 +10051,7 @@
|
|
|
9881
10051
|
else if (step.key === 'batch-value') name = 'bulk-confirm';
|
|
9882
10052
|
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; }
|
|
9883
10053
|
else if (step.actions?.[extra]?.action === 'none') name = 'none';
|
|
10054
|
+
else if (step.actions?.[extra]?.action === 'to-ai') name = 'handback';
|
|
9884
10055
|
else { name = 'confirm'; if (step.actions?.[extra]?.choice) suffix += ` ${step.actions[extra].choice}`; }
|
|
9885
10056
|
} else if (what === 'group') { name = 'select-group'; const groups = [...new Set(step.rows.map((row) => row.group).filter(Boolean))]; suffix = groups[extra]; instance = suffix; }
|
|
9886
10057
|
else if (what === 'other-input') name = step.key === 'batch-value' ? 'bulk-input' : 'input';
|
|
@@ -9891,6 +10062,7 @@
|
|
|
9891
10062
|
if (step.key === 'batch-select') name = 'bulk-next';
|
|
9892
10063
|
else if (step.key === 'batch-value') name = !draft.rows[0].choices.length && !draft.rows[0].other.trim() && hasAnswerSource(step.scope) ? 'bulk-evidence' : 'bulk-use';
|
|
9893
10064
|
else if (step.actions?.[draft.rows[0].choices[0]]?.action === 'none') name = 'none-save';
|
|
10065
|
+
else if (step.actions?.[draft.rows[0].choices[0]]?.action === 'to-ai') name = 'handback-confirm';
|
|
9894
10066
|
else if (!draft.rows[0].choices.length && !draft.rows[0].other.trim() && hasAnswerSource(step.scope)) name = 'evidence';
|
|
9895
10067
|
else name = step.row?.kind === 'origin' && !draft.rows[0].otherOpen ? 'origin-confirm' : 'use';
|
|
9896
10068
|
}
|
|
@@ -10049,7 +10221,9 @@
|
|
|
10049
10221
|
|| rememberCard(entry, paintSetupCard(entry, event.eventId, String(event.sequence)), event.eventId, String(event.sequence));
|
|
10050
10222
|
}
|
|
10051
10223
|
|
|
10052
|
-
|
|
10224
|
+
// #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.
|
|
10225
|
+
const setupSettled = (row) => row.status === 'settled' || row.status === 'handed-to-ai';
|
|
10226
|
+
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.';
|
|
10053
10227
|
const setupLive = (row) => row.status !== 'superseded';
|
|
10054
10228
|
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' };
|
|
10055
10229
|
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' };
|
|
@@ -10060,6 +10234,7 @@
|
|
|
10060
10234
|
const a = row.answer;
|
|
10061
10235
|
if (!a) return '';
|
|
10062
10236
|
if (row.kind === 'origin') {
|
|
10237
|
+
if (a.how === 'handed-to-ai') return 'You let the AI choose the model origin';
|
|
10063
10238
|
if (a.how === 'none') return `None of these: ${a.note}`;
|
|
10064
10239
|
return `${originText(a.origin)}${a.origin.pickedAs ? ` (you picked ${a.origin.pickedAs})` : ''}${a.how === 'typed' ? ', typed' : ''}`;
|
|
10065
10240
|
}
|
|
@@ -10113,7 +10288,7 @@
|
|
|
10113
10288
|
const changing = entry.changing.has(row.key);
|
|
10114
10289
|
if (row.answer && !changing && row.status !== 'picture') {
|
|
10115
10290
|
const done = document.createElement('div'); done.className = 'ai-chat-height-answered';
|
|
10116
|
-
const glyph = document.createElement('span'); glyph.className = 'ai-chat-height-glyph'; glyph.textContent = row
|
|
10291
|
+
const glyph = document.createElement('span'); glyph.className = 'ai-chat-height-glyph'; glyph.textContent = setupSettled(row) ? '✓' : '…'; glyph.setAttribute('aria-hidden', 'true');
|
|
10117
10292
|
const text = document.createElement('span');
|
|
10118
10293
|
text.textContent = row.status === 'needs-new-choices' ? `${setupAnswerText(row)}. Waiting for the read to offer other points.` : setupAnswerText(row);
|
|
10119
10294
|
done.append(glyph, text);
|
|
@@ -10553,7 +10728,7 @@
|
|
|
10553
10728
|
const ownerKey = scopeKey(state.scope);
|
|
10554
10729
|
if (!ownerKey) return false;
|
|
10555
10730
|
Promise.resolve(openConversation(link.chatId, { messageEventId: link.messageEventId, ownerKey }))
|
|
10556
|
-
.catch((error) => { window.showToast?.(error
|
|
10731
|
+
.catch((error) => { window.showToast?.(errorText(error, { action: 'open that conversation', retrySafe: true }), 'info'); });
|
|
10557
10732
|
return true;
|
|
10558
10733
|
}
|
|
10559
10734
|
|
|
@@ -10808,14 +10983,14 @@
|
|
|
10808
10983
|
}
|
|
10809
10984
|
|
|
10810
10985
|
// paintEvents rebuilds every control in the feed, so a control that held keyboard focus is put
|
|
10811
|
-
// back on its replacement. The empty state's sign-in
|
|
10986
|
+
// back on its replacement. The empty state's and a failed reply's error-row sign-in are among them: the repaint that follows its
|
|
10812
10987
|
// own click would otherwise drop focus to the page just as it turns to "Sign-in window open".
|
|
10813
10988
|
// That button is `aria-disabled`, not `disabled`, so it passes the filter (#1514).
|
|
10814
10989
|
function restoreFeedFocus(focusedCommand) {
|
|
10815
10990
|
if (!focusedCommand?.startsWith('shell.chat-followup-') && !focusedCommand?.startsWith('shell.chat-filter-')
|
|
10816
10991
|
&& !focusedCommand?.startsWith('shell.chat-question') && !focusedCommand?.startsWith('shell.chat-height-')
|
|
10817
10992
|
&& !focusedCommand?.startsWith('shell.chat-setup-') && !focusedCommand?.startsWith('shell.chat-answer-')
|
|
10818
|
-
&& focusedCommand !== 'shell.chat-sign-in') return null;
|
|
10993
|
+
&& focusedCommand !== 'shell.chat-sign-in' && focusedCommand !== 'shell.chat-error-sign-in') return null;
|
|
10819
10994
|
const control = [...ui.feed.querySelectorAll('[data-command-id]')]
|
|
10820
10995
|
.find(control => control.dataset.commandId === focusedCommand && !control.disabled);
|
|
10821
10996
|
control?.focus({ preventScroll: true });
|
|
@@ -10880,6 +11055,7 @@
|
|
|
10880
11055
|
if (node) { if (links.length && links[0].turnId !== turnId) flushLinks(); links.push({ turnId, node }); }
|
|
10881
11056
|
};
|
|
10882
11057
|
const flushLinks = () => { if (links.length) { ui.feed.append(...receiptFold(links)); links = []; } };
|
|
11058
|
+
const signInError = errorNeedingSignIn();
|
|
10883
11059
|
for (const event of state.events) {
|
|
10884
11060
|
// #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).
|
|
10885
11061
|
if (event.type === 'citation-assumption' || event.type === 'citation-choice') continue;
|
|
@@ -10951,6 +11127,7 @@
|
|
|
10951
11127
|
// #2678: a card comes in its shell, with its chevron, or as the one line it left (an ordinary message or a one-line row comes
|
|
10952
11128
|
// as it is).
|
|
10953
11129
|
const node = feedCard(renderEvent(event), event);
|
|
11130
|
+
if (node && event === signInError) node.append(errorSignIn(event));
|
|
10954
11131
|
if (node) ui.feed.append(node);
|
|
10955
11132
|
if (event.type === 'assistant-message') holdUncitedClaims(event.turnId);
|
|
10956
11133
|
}
|
|
@@ -11108,6 +11285,51 @@
|
|
|
11108
11285
|
return signIn;
|
|
11109
11286
|
}
|
|
11110
11287
|
|
|
11288
|
+
// Owner, 2026-11-04: a reply that failed because Claude could not sign in must offer the sign-in right there. The
|
|
11289
|
+
// newest error in a Claude conversation, written after the newest message the person sent, whose sentence tells them
|
|
11290
|
+
// to sign in to Claude, while nothing is running or held in recovery: that error carries the same sign-in as the empty
|
|
11291
|
+
// state (one switchAccount(), one pending set). Receipts the failed turn writes after it (a queued follow-up marked not
|
|
11292
|
+
// sent) do not move on from it; a new message does, so an older error stays text only. Keyed on the sentence
|
|
11293
|
+
// errorMessage wrote, so the button appears exactly where the advice to sign in does.
|
|
11294
|
+
//
|
|
11295
|
+
// Owner ruling, 2026-11-04: a busy renewal (another Claude process holds it; it clears within a minute) offers the
|
|
11296
|
+
// button only when it has happened before in this conversation, as its own sentence says ("If it keeps happening").
|
|
11297
|
+
// Signing in signs Claude Code out first, and that sign-in is shared with every Claude Code session on the computer,
|
|
11298
|
+
// so a one-off transient lock must not invite signing them all out.
|
|
11299
|
+
function errorNeedingSignIn() {
|
|
11300
|
+
const chat = state.chat;
|
|
11301
|
+
if (chat?.provider !== 'claude' || chat.activeTurn || chat.state === 'recovery' || turnIsVisiblyActive()) return null;
|
|
11302
|
+
const advice = (event) => event.type === 'error' && event.payload?.plain !== true ? errorMessage(payloadText(event)) : '';
|
|
11303
|
+
// An earlier busy renewal counts whatever became of it; it is the evidence that it keeps happening.
|
|
11304
|
+
const renewing = (event) => advice(event).startsWith('Claude couldn’t finish renewing its sign-in');
|
|
11305
|
+
const lastMessage = state.events.findLastIndex((event) => event.type === 'user-message');
|
|
11306
|
+
const index = state.events.findLastIndex((event) => event.type === 'error');
|
|
11307
|
+
const error = index > lastMessage ? state.events[index] : null;
|
|
11308
|
+
// The error the button sits on must be a turn FloLess knows has ended (outcome failed): one left by a recovery the
|
|
11309
|
+
// person ended is of unknown outcome, and "send your message again" is not advice to give over it.
|
|
11310
|
+
if (error?.payload?.outcome !== 'failed' || !/\bsign in to Claude again\b/i.test(advice(error))) return null;
|
|
11311
|
+
if (renewing(error) && !state.events.slice(0, index).some(renewing)) return null;
|
|
11312
|
+
return error;
|
|
11313
|
+
}
|
|
11314
|
+
|
|
11315
|
+
// Its own command id: its own carrier, in its own place (the empty state's rule). Once a sign-in landed after this
|
|
11316
|
+
// error, and Claude still reads as signed in, the error says so instead: another click would sign the CLI out again
|
|
11317
|
+
// for nothing. Both times come from this computer's clock.
|
|
11318
|
+
function errorSignIn(error) {
|
|
11319
|
+
const landedAt = state.signInLandedAt.get('claude') || 0;
|
|
11320
|
+
if (landedAt > Date.parse(error.createdAt || '') && capabilityAnswer(state.capability).state !== 'signed-out') {
|
|
11321
|
+
const done = document.createElement('div');
|
|
11322
|
+
done.className = 'ai-chat-error-signin-done';
|
|
11323
|
+
done.setAttribute('role', 'status');
|
|
11324
|
+
done.textContent = 'Signed in. Send your message again.';
|
|
11325
|
+
return done;
|
|
11326
|
+
}
|
|
11327
|
+
const signIn = emptySignInButton(providerLabels.claude || 'Claude', state.signInPending.has('claude'));
|
|
11328
|
+
signIn.className = 'ai-chat-provider-switch ai-chat-error-signin';
|
|
11329
|
+
signIn.dataset.commandId = 'shell.chat-error-sign-in';
|
|
11330
|
+
return signIn;
|
|
11331
|
+
}
|
|
11332
|
+
|
|
11111
11333
|
/*
|
|
11112
11334
|
* Owner, 2026-10-23: "Any card should have that functionality". An approval, a proposal or the AI's own question above the
|
|
11113
11335
|
* message box hides to one line by hand (× or Esc), like a drawing read's card. Hiding answers, allows or denies nothing:
|
|
@@ -11173,7 +11395,8 @@
|
|
|
11173
11395
|
shell.dataset.approvalPending = String(Boolean(approval) && !deciding);
|
|
11174
11396
|
// #2223 Revision 6: a question Codex asked without waiting, while no approval holds the slot — a blocking question or an
|
|
11175
11397
|
// action the AI is waiting on always goes first, and this one shows once it has settled. The chat is waiting on the person.
|
|
11176
|
-
|
|
11398
|
+
// #3255: a question from an earlier opening of the Workspace is history; nobody can answer it there.
|
|
11399
|
+
const asking = approval || state.chat?.earlierOpening ? null : openAsyncQuestion(state.events, state.chat);
|
|
11177
11400
|
if (asking) shell.dataset.approvalPending = 'true';
|
|
11178
11401
|
document.dispatchEvent(new CustomEvent('floless:chat-indicator'));
|
|
11179
11402
|
const waiting = asking || (approval && !deciding ? approval : null);
|
|
@@ -11307,9 +11530,12 @@
|
|
|
11307
11530
|
// #2224 item 1: why it asks although actions may be approved for this request or conversation.
|
|
11308
11531
|
const why = document.createElement('p');
|
|
11309
11532
|
why.className = 'ai-chat-approval-note';
|
|
11310
|
-
|
|
11533
|
+
// A card FloLess can remember says how to stop the question; one that names a record asks every time.
|
|
11534
|
+
const always = protectedGrantable(approval)
|
|
11535
|
+
? 'Approve for this request or conversation also lets this exact command run again without asking.'
|
|
11536
|
+
: 'FloLess asks every time about this one: a wider choice covers your other actions and approves just this command.';
|
|
11311
11537
|
why.textContent = matchedAt >= 0 ? `${head.slice(matchedAt + '\nWhy: '.length)} ${always}`
|
|
11312
|
-
: `This command names, or
|
|
11538
|
+
: `This command names, or might reach, a workflow’s approved version, its approval record or its saved chats. ${always}`;
|
|
11313
11539
|
nodes.push(why);
|
|
11314
11540
|
const block = document.createElement('pre');
|
|
11315
11541
|
block.className = 'ai-chat-approval-cmd';
|
|
@@ -11860,6 +12086,17 @@
|
|
|
11860
12086
|
return list;
|
|
11861
12087
|
}
|
|
11862
12088
|
|
|
12089
|
+
/**
|
|
12090
|
+
* The server's reading of a protected command when a "don't ask again" choice may remember it (the same rule as
|
|
12091
|
+
* `protectedGrantKey` in server/chat-approval-grants.ts), else null: a command that names a record, one whose folder is
|
|
12092
|
+
* unknown, or a card from a server that sent no reading, keeps today's choices.
|
|
12093
|
+
*/
|
|
12094
|
+
function protectedGrantable(approval) {
|
|
12095
|
+
const analysis = approval?.protectedCommand === true ? approval.protectedAnalysis : null;
|
|
12096
|
+
if (!analysis || analysis.v !== 1 || analysis.namesRecord !== false || analysis.pinned !== true) return null;
|
|
12097
|
+
return analysis;
|
|
12098
|
+
}
|
|
12099
|
+
|
|
11863
12100
|
/*
|
|
11864
12101
|
* Epic #2185 Slice A (owner ruling 7): EVERY approval card offers Deny, Approve once, Approve for this request and
|
|
11865
12102
|
* Approve for this conversation. `approvalOffer` says, for the card on screen, exactly WHAT each wider choice covers (the
|
|
@@ -11875,12 +12112,20 @@
|
|
|
11875
12112
|
const create = approval.create && typeof approval.create === 'object' ? approval.create : null;
|
|
11876
12113
|
const check = approval.connectionCheck && typeof approval.connectionCheck === 'object' ? approval.connectionCheck : null;
|
|
11877
12114
|
const connector = approval.connector && typeof approval.connector === 'object' ? approval.connector : null;
|
|
11878
|
-
// #2196 follow-up: a command that names, or
|
|
11879
|
-
// the full set of choices (owner ruling 7)
|
|
11880
|
-
//
|
|
12115
|
+
// #2196 follow-up: a command that names, or might reach, a workflow's records is outside every ordinary grant. Its card
|
|
12116
|
+
// keeps the full set of choices (owner ruling 7). A card FloLess can remember (plan 2026-11-03, "don't ask again")
|
|
12117
|
+
// offers exactly that; one that names a record approves THIS command once and covers other actions only.
|
|
11881
12118
|
const protectedCommand = approval.protectedCommand === true
|
|
11882
|
-
? { protectedNote: ' This command is approved once
|
|
12119
|
+
? { protectedNote: ' This command is approved once. FloLess asks again whenever a command names, or might reach, a workflow’s approved version, its approval record or its saved chats.' } : {};
|
|
11883
12120
|
const base = { requestRevision, decision: 'allow-chat', warning: '', ...protectedCommand };
|
|
12121
|
+
if (protectedGrantable(approval)) {
|
|
12122
|
+
// The click also approves the command on screen: say so first (UX review). Only the identical command, in the same
|
|
12123
|
+
// folder, is remembered (server: protectedGrantKey).
|
|
12124
|
+
return { ...base, kind: 'protected', key: 'protected', revision: chat.approvalGrants?.revision ?? 0,
|
|
12125
|
+
what: 'Approve this and don’t ask again for this exact command',
|
|
12126
|
+
protectedNote: ' Any other command, even a small edit to this one, still asks. Commands that name a workflow’s approved version, its approval record or its saved chats always ask.',
|
|
12127
|
+
commandId: 'shell.chat-approval-grant-chat', instance: 'this exact command' };
|
|
12128
|
+
}
|
|
11884
12129
|
const PROTECTED_NOTE = ' A workflow’s own records (its .lock, settings and conversations) always ask.';
|
|
11885
12130
|
if (change) {
|
|
11886
12131
|
if (change.refused || change.busy) return null;
|
|
@@ -11994,7 +12239,8 @@
|
|
|
11994
12239
|
const turn = state.chat?.activeTurn;
|
|
11995
12240
|
// #2162: a session grant belongs to the conversation, so it shows whatever the turn is doing, and instead of the
|
|
11996
12241
|
// request strip, which it contains.
|
|
11997
|
-
|
|
12242
|
+
// #3255: what an earlier opening allowed is not live: it is not shown as a permission with Revoke.
|
|
12243
|
+
const session = state.chat?.earlierOpening ? null : state.chat?.sessionApproval;
|
|
11998
12244
|
if (session) { paintSessionApprovalScope(existing, session); return; }
|
|
11999
12245
|
if (!turn?.accessApprovalGranted || !['running', 'awaiting-approval'].includes(state.chat?.state)) {
|
|
12000
12246
|
existing?.remove(); return;
|
|
@@ -12976,9 +13222,10 @@
|
|
|
12976
13222
|
const snapshot = captureChat();
|
|
12977
13223
|
const before = answerKey(state.capability?.account);
|
|
12978
13224
|
state.signInPending.add(chat.provider);
|
|
12979
|
-
//
|
|
13225
|
+
// Every carrier of this action flips to waiting at the click, not at the next 5 s poll — the
|
|
12980
13226
|
// settings strip to "Waiting for sign-in…", the empty state to its "Waiting for sign-in…" title
|
|
12981
|
-
// over a "Sign-in window open" button
|
|
13227
|
+
// over a "Sign-in window open" button (that button is the one a new user just pressed), and a
|
|
13228
|
+
// failed reply's error row to its own "Sign-in window open".
|
|
12982
13229
|
paintSettings(); paintEvents();
|
|
12983
13230
|
try {
|
|
12984
13231
|
await request(`/api/terminal-runtimes/${encodeURIComponent(chat.provider)}/sign-in`, { method: 'POST' });
|
|
@@ -12986,7 +13233,8 @@
|
|
|
12986
13233
|
// much of the empty state a short panel still paints (#1514). Only now: before this await
|
|
12987
13234
|
// resolves there is no window to point at.
|
|
12988
13235
|
if (sameChat(snapshot)) announce(`Waiting for sign-in. Finish signing in to ${providerLabels[chat.provider] || 'AI'} using the window FloLess opened.`);
|
|
12989
|
-
|
|
13236
|
+
// A sign-in that landed answers an error that asked for it (errorSignIn): that error stops offering another one.
|
|
13237
|
+
if (await waitForSignIn(chat.provider, before)) state.signInLandedAt.set(chat.provider, Date.now());
|
|
12990
13238
|
if (sameChat(snapshot)) await loadCapability();
|
|
12991
13239
|
} catch (error) {
|
|
12992
13240
|
const code = String(error && error.code || '');
|
|
@@ -13001,7 +13249,8 @@
|
|
|
13001
13249
|
state.signInPending.delete(chat.provider);
|
|
13002
13250
|
// This runs outside every try above, and the click handler calls switchAccount() with `void`:
|
|
13003
13251
|
// a throw from the repaint would surface as an unhandled rejection with nothing to catch it.
|
|
13004
|
-
// The feed's empty state carries the same button and the waiting copy, so
|
|
13252
|
+
// The feed's empty state carries the same button and the waiting copy, and so does a failed reply's error row, so
|
|
13253
|
+
// the feed repaints too.
|
|
13005
13254
|
try { if (sameChat(snapshot)) { paintSettings(); paintEvents(); updateSendState(); } } catch (error) {
|
|
13006
13255
|
console.warn('floless: could not repaint the provider row after a sign-in', error);
|
|
13007
13256
|
}
|
|
@@ -13031,8 +13280,9 @@
|
|
|
13031
13280
|
if (answer.state === 'unknown') continue;
|
|
13032
13281
|
// A 'signed-out' is FloLess's own doing (above), not the sign-in the user went off to make.
|
|
13033
13282
|
if (answer.state === 'signed-out') { signedOutSeen = true; continue; }
|
|
13034
|
-
if (signedOutSeen || answerKey(answer) !== before) return;
|
|
13283
|
+
if (signedOutSeen || answerKey(answer) !== before) return true;
|
|
13035
13284
|
}
|
|
13285
|
+
return false;
|
|
13036
13286
|
}
|
|
13037
13287
|
|
|
13038
13288
|
/**
|
|
@@ -13061,7 +13311,8 @@
|
|
|
13061
13311
|
current = { mode: body.mode, recovered: body.recovered === true }; publish();
|
|
13062
13312
|
announce(`Suggest next steps: ${SUGGEST_LABELS[body.mode] || body.mode}.`);
|
|
13063
13313
|
} catch (error) {
|
|
13064
|
-
|
|
13314
|
+
// Choosing a setting again sets the same value, so a retry is safe.
|
|
13315
|
+
announce(errorText(error, { action: 'save that setting', retrySafe: true }));
|
|
13065
13316
|
}
|
|
13066
13317
|
},
|
|
13067
13318
|
choices() {
|
|
@@ -13094,7 +13345,7 @@
|
|
|
13094
13345
|
if (ui.scopeControls) paintScopeControl();
|
|
13095
13346
|
paintSuggestSetting();
|
|
13096
13347
|
const chat = state.chat;
|
|
13097
|
-
ui.settingsToggle.disabled = !chat;
|
|
13348
|
+
ui.settingsToggle.disabled = !chat || Boolean(chat?.earlierOpening);
|
|
13098
13349
|
const answer = capabilityAnswer(state.capability);
|
|
13099
13350
|
const pendingSignIn = Boolean(chat && state.signInPending.has(chat.provider));
|
|
13100
13351
|
const accountLabel = chat ? providerAccountLabel(chat.provider, answer) : '—';
|
|
@@ -13243,12 +13494,13 @@
|
|
|
13243
13494
|
const chat = state.chat;
|
|
13244
13495
|
if (!chat) { providerChooser(); paintHistory(); return; }
|
|
13245
13496
|
ui.historyToggle.disabled = false;
|
|
13246
|
-
|
|
13497
|
+
// #3255: an earlier opening's conversation is read only: nothing in its header changes it.
|
|
13498
|
+
ui.refresh.disabled = Boolean(chat?.earlierOpening);
|
|
13247
13499
|
ui.title.textContent = chat.title;
|
|
13248
13500
|
ui.scope.textContent = `${state.scope.label} · ${providerLabels[chat.provider]}`;
|
|
13249
|
-
ui.rename.hidden = Boolean(chat.activeTurn) || Boolean(chat.archivedAt);
|
|
13250
|
-
ui.input.disabled = Boolean(chat.archivedAt) || chat.state === 'recovery' || requestExecutionBlocked();
|
|
13251
|
-
const draft = draftForChat(chat);
|
|
13501
|
+
ui.rename.hidden = Boolean(chat.activeTurn) || Boolean(chat.archivedAt) || Boolean(chat?.earlierOpening);
|
|
13502
|
+
ui.input.disabled = Boolean(chat.archivedAt) || chat.state === 'recovery' || requestExecutionBlocked() || Boolean(chat?.earlierOpening);
|
|
13503
|
+
const draft = chat?.earlierOpening ? '' : draftForChat(chat);
|
|
13252
13504
|
if (ui.input.value !== draft && document.activeElement !== ui.input) ui.input.value = draft;
|
|
13253
13505
|
const active = turnIsVisiblyActive(chat);
|
|
13254
13506
|
ui.stop.hidden = !active || Boolean(chat.activeTurn?.local);
|
|
@@ -13312,7 +13564,8 @@
|
|
|
13312
13564
|
|
|
13313
13565
|
function connectEvents() {
|
|
13314
13566
|
closeSource();
|
|
13315
|
-
|
|
13567
|
+
// #3255: an earlier opening's conversation has nothing live to stream.
|
|
13568
|
+
if (!state.chat || !state.scope || state.chat?.earlierOpening) return;
|
|
13316
13569
|
const chatId = state.chat.chatId;
|
|
13317
13570
|
const scope = state.scope;
|
|
13318
13571
|
const generation = state.scopeGeneration;
|
|
@@ -13571,7 +13824,12 @@
|
|
|
13571
13824
|
if (index >= 0) state.chats[index] = chat;
|
|
13572
13825
|
paintConversation();
|
|
13573
13826
|
if (reconnect) connectEvents();
|
|
13574
|
-
} catch (error) {
|
|
13827
|
+
} catch (error) {
|
|
13828
|
+
if (!sameChat(snapshot)) return;
|
|
13829
|
+
// #3123: a timeout here means FloLess is busy, not stopped, and what the person already sees stays.
|
|
13830
|
+
if (error?.code === 'local-timeout') report(error, '', { 'local-timeout': 'FloLess is busy, so this conversation hasn’t refreshed yet. Your messages are still here. Reopen the conversation in a moment to see anything new.' });
|
|
13831
|
+
else report(error, 'Could not refresh chat');
|
|
13832
|
+
}
|
|
13575
13833
|
}
|
|
13576
13834
|
|
|
13577
13835
|
function showConversationLoading(chatId) {
|
|
@@ -13657,7 +13915,9 @@
|
|
|
13657
13915
|
if (exactQuestion) window.showToast?.(gone, 'info');
|
|
13658
13916
|
return;
|
|
13659
13917
|
}
|
|
13660
|
-
|
|
13918
|
+
// #3255: a conversation from an earlier opening asks the AI app nothing: it is only read.
|
|
13919
|
+
const [capability, desktop] = chat?.earlierOpening ? [null, null]
|
|
13920
|
+
: await Promise.all([readCapability(chat), readDesktopCapability(chat)]);
|
|
13661
13921
|
if (generation !== state.scopeGeneration || selection !== state.selectionGeneration) return;
|
|
13662
13922
|
// Reopened while this conversation was opening: the person has moved on to the history, so
|
|
13663
13923
|
// it stays open — with any rename in it — and focus stays where they put it (#1646).
|
|
@@ -13671,8 +13931,8 @@
|
|
|
13671
13931
|
reconcileUnknownFollowupOnSelection(chat);
|
|
13672
13932
|
state.capability = capability;
|
|
13673
13933
|
state.desktop = desktop;
|
|
13674
|
-
state.attachments = composerDrafts(chat);
|
|
13675
|
-
ui.input.value = draftForChat(chat);
|
|
13934
|
+
state.attachments = chat?.earlierOpening ? [] : composerDrafts(chat);
|
|
13935
|
+
ui.input.value = chat?.earlierOpening ? '' : draftForChat(chat);
|
|
13676
13936
|
// A cached draft may be newer than the server draft after a fast switch.
|
|
13677
13937
|
// Save it now, even if the user does not type again after reopening.
|
|
13678
13938
|
if (state.backgroundDrafts.has(chatId) && draftFitsStorage(state.scope.owner, ui.input.value)) saveDraftSoon();
|
|
@@ -13683,11 +13943,11 @@
|
|
|
13683
13943
|
}, 2600);
|
|
13684
13944
|
}
|
|
13685
13945
|
paintConversation(); connectEvents();
|
|
13686
|
-
if (options.applyProviderDefaults || !chat.nativeSessionId) await applyProviderDefaults(chatId);
|
|
13946
|
+
if (!chat?.earlierOpening && (options.applyProviderDefaults || !chat.nativeSessionId)) await applyProviderDefaults(chatId);
|
|
13687
13947
|
// Let the server prepare the provider for the next message while the user types, after the
|
|
13688
13948
|
// default model and effort are saved so the prepared runtime matches the first message. Best-effort:
|
|
13689
13949
|
// the server decides whether a runtime can be prepared; nothing here waits on it.
|
|
13690
|
-
if (providerReady()) void request(`/api/chat/conversations/${encodeURIComponent(chatId)}/warm`, {
|
|
13950
|
+
if (providerReady() && !chat?.earlierOpening) void request(`/api/chat/conversations/${encodeURIComponent(chatId)}/warm`, {
|
|
13691
13951
|
method: 'POST', body: JSON.stringify({ owner: state.scope.owner }),
|
|
13692
13952
|
}).catch(() => { /* a missed warm-up only means a slower first message */ });
|
|
13693
13953
|
if (answerTarget) {
|
|
@@ -13729,7 +13989,8 @@
|
|
|
13729
13989
|
|| chat.draft?.trim() === uncertain.text.trim()) {
|
|
13730
13990
|
state.localDraft = { chatId, text: '' };
|
|
13731
13991
|
chat.draft = '';
|
|
13732
|
-
|
|
13992
|
+
// #3255: opening an earlier opening's conversation writes nothing into it.
|
|
13993
|
+
if (!chat?.earlierOpening) void writeChatDraft(chatId, state.scope.owner, '').catch(error => report(error, 'Draft was not saved'));
|
|
13733
13994
|
}
|
|
13734
13995
|
} else {
|
|
13735
13996
|
state.followupUnknownId = uncertain.submissionId;
|
|
@@ -13854,7 +14115,9 @@
|
|
|
13854
14115
|
const host = ui.workspaceUnits;
|
|
13855
14116
|
if (!host) return;
|
|
13856
14117
|
const chat = state.chat;
|
|
13857
|
-
|
|
14118
|
+
// #3255: the receipts of a conversation from an earlier opening still read in its own units; only the menu is hidden.
|
|
14119
|
+
if (state.scope?.owner?.kind === 'workspace' && chat?.earlierOpening) state.displayUnits = workspaceUnitsOf(chat);
|
|
14120
|
+
if (state.scope?.owner?.kind !== 'workspace' || !chat || chat.archivedAt || chat.earlierOpening) { dropUnitsMenu(); host.hidden = true; host.replaceChildren(); delete host.dataset.painted; return; }
|
|
13858
14121
|
// The receipts' units follow the conversation's own (chosen, else suggested) — set here, where the chat is known.
|
|
13859
14122
|
state.displayUnits = workspaceUnitsOf(chat);
|
|
13860
14123
|
const units = chat.workspaceUnits || {};
|
|
@@ -13944,6 +14207,7 @@
|
|
|
13944
14207
|
}
|
|
13945
14208
|
|
|
13946
14209
|
async function chooseWorkspaceUnits(value) {
|
|
14210
|
+
if (state.chat?.earlierOpening) return;
|
|
13947
14211
|
const snapshot = captureChat();
|
|
13948
14212
|
if (!snapshot) return;
|
|
13949
14213
|
try {
|
|
@@ -14224,6 +14488,8 @@
|
|
|
14224
14488
|
}
|
|
14225
14489
|
|
|
14226
14490
|
async function saveSettings(patch, options = {}) {
|
|
14491
|
+
// #3255: nothing in an earlier opening's conversation is changed.
|
|
14492
|
+
if (state.chat?.earlierOpening) return;
|
|
14227
14493
|
let snapshot = captureChat();
|
|
14228
14494
|
if (!snapshot) return;
|
|
14229
14495
|
// #2059: giving an Instructor answer tools asks first; the server refuses it without this confirmation.
|
|
@@ -14515,7 +14781,8 @@
|
|
|
14515
14781
|
// A provider FloLess is still setting up cannot take a message; the runtime card explains why.
|
|
14516
14782
|
const settingUp = Boolean(state.capability?.runtime && state.capability.runtime.state !== 'installed');
|
|
14517
14783
|
const uploading = Boolean(state.chat?.chatId && state.uploadingChatIds.has(state.chat.chatId));
|
|
14518
|
-
|
|
14784
|
+
const history = Boolean(state.chat?.earlierOpening);
|
|
14785
|
+
ui.input.disabled = state.followupSubmitting || !state.chat || Boolean(state.chat?.archivedAt) || recovery || blocked || history;
|
|
14519
14786
|
// #1890 PR 3b: while the conversation moves, typing goes on (the draft is kept) and Send waits. Inline, not a helper:
|
|
14520
14787
|
// several harnesses run this function on its own.
|
|
14521
14788
|
const movingTo = state.chat?.rehome && ['freezing', 'copying', 'publishing'].includes(state.chat.rehome.state)
|
|
@@ -14531,10 +14798,10 @@
|
|
|
14531
14798
|
ui.send.disabled = state.loading || state.followupSubmitting || Boolean(state.followupUnknownId) || hasUnknownFollowup() || uploading || !state.chat || blocked || frozen
|
|
14532
14799
|
|| (!ui.input.value.trim() && state.attachments.length === 0
|
|
14533
14800
|
&& !(state.mentions?.[state.chat?.chatId]?.length)) || settingUp;
|
|
14534
|
-
if (moving) ui.send.disabled = true;
|
|
14801
|
+
if (moving || history) ui.send.disabled = true;
|
|
14535
14802
|
// The paperclip is the same on every surface, the Drawing Filter included (#1681, #1859): a message
|
|
14536
14803
|
// there carries the filter's context AND whatever the person attached, under the general rules only.
|
|
14537
|
-
ui.attach.disabled = state.loading || state.followupSubmitting || Boolean(state.followupUnknownId) || hasUnknownFollowup() || uploading || !state.chat || blocked || frozen;
|
|
14804
|
+
ui.attach.disabled = state.loading || state.followupSubmitting || Boolean(state.followupUnknownId) || hasUnknownFollowup() || uploading || !state.chat || blocked || frozen || history;
|
|
14538
14805
|
// Repainted here too: this runs on a surface switch, which changes what may be attached without
|
|
14539
14806
|
// changing the attachments themselves.
|
|
14540
14807
|
paintAttachControl();
|
|
@@ -14543,7 +14810,9 @@
|
|
|
14543
14810
|
const sendingReason = state.followupSubmitting
|
|
14544
14811
|
? 'FloLess is saving this message. Wait for its delivery status before sending another.' : null;
|
|
14545
14812
|
for (const control of [ui.send, ui.attach]) {
|
|
14546
|
-
|
|
14813
|
+
// #3255: Instructor says why Send and the paperclip are off in an earlier opening's conversation.
|
|
14814
|
+
const historyReason = history ? 'Read only: this conversation is from before the Workspace was reopened.' : null;
|
|
14815
|
+
if (unknownReason || sendingReason || historyReason) control.dataset.blockedReason = unknownReason || sendingReason || historyReason;
|
|
14547
14816
|
else delete control.dataset.blockedReason;
|
|
14548
14817
|
}
|
|
14549
14818
|
ui.stop.hidden = !active || Boolean(state.chat?.activeTurn?.local);
|
|
@@ -14551,7 +14820,7 @@
|
|
|
14551
14820
|
ui.send.hidden = false;
|
|
14552
14821
|
// Session recovery must remain available even while provider capability discovery is loading
|
|
14553
14822
|
// or has failed; it is the escape hatch for that exact state.
|
|
14554
|
-
ui.refresh.disabled = !state.chat;
|
|
14823
|
+
ui.refresh.disabled = !state.chat || history;
|
|
14555
14824
|
clearReport();
|
|
14556
14825
|
paintFloLessContext();
|
|
14557
14826
|
}
|
|
@@ -14573,7 +14842,7 @@
|
|
|
14573
14842
|
|
|
14574
14843
|
function saveDraftSoon() {
|
|
14575
14844
|
clearTimeout(state.draftTimer);
|
|
14576
|
-
if (!state.chat) return;
|
|
14845
|
+
if (!state.chat || state.chat?.earlierOpening) return;
|
|
14577
14846
|
const chatId = state.chat.chatId;
|
|
14578
14847
|
const draft = ui.input.value;
|
|
14579
14848
|
state.localDraft = { chatId, text: draft };
|
|
@@ -14881,8 +15150,9 @@
|
|
|
14881
15150
|
// Repaints run on every filter change; keep keyboard focus on the same control when it survives.
|
|
14882
15151
|
const focused = actions.contains(document.activeElement) ? document.activeElement.dataset.commandId : null;
|
|
14883
15152
|
actions.replaceChildren();
|
|
14884
|
-
if (!info.known) {
|
|
14885
|
-
// Nothing here can act on a suggestion this page never recorded
|
|
15153
|
+
if (!info.known || state.chat?.earlierOpening) {
|
|
15154
|
+
// Nothing here can act on a suggestion this page never recorded, or on one from an earlier opening of the
|
|
15155
|
+
// Workspace (#3255); the note says why.
|
|
14886
15156
|
} else if (disposition === 'pending' && hasChanges) {
|
|
14887
15157
|
const unavailable = info.applicable ? null : info.reason || FILTER_NOT_OPEN;
|
|
14888
15158
|
const keep = filterActionButton('Keep current', 'keep', requestId, 'ai-chat-filter-keep', info.known && info.open ? null : unavailable);
|
|
@@ -14904,20 +15174,22 @@
|
|
|
14904
15174
|
const requestId = String(event.payload.requestId || '');
|
|
14905
15175
|
// Re-resolve the page at click time: the frame may have reloaded since this card was painted.
|
|
14906
15176
|
const surface = filterSurface();
|
|
14907
|
-
|
|
14908
|
-
|
|
15177
|
+
// `outcome.message` is the Drawing Filter bridge's own sentence for the person (its apply / undo / keep answer), not
|
|
15178
|
+
// a thrown error's text.
|
|
15179
|
+
let outcome;
|
|
15180
|
+
if (surface.state !== 'ready') outcome = { ok: false, message: FILTER_NOT_OPEN };
|
|
14909
15181
|
else {
|
|
14910
15182
|
try {
|
|
14911
|
-
|
|
15183
|
+
outcome = action === 'apply' ? surface.bridge.apply(requestId, event.payload.filterAi.proposal)
|
|
14912
15184
|
: action === 'undo' ? surface.bridge.undo(requestId) : surface.bridge.keep(requestId);
|
|
14913
15185
|
} catch (error) {
|
|
14914
15186
|
console.error('[chat] the Drawing Filter could not finish a suggestion action:', error);
|
|
14915
|
-
|
|
15187
|
+
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.' };
|
|
14916
15188
|
}
|
|
14917
15189
|
}
|
|
14918
|
-
if (
|
|
14919
|
-
else state.filterCardMessages.set(requestId,
|
|
14920
|
-
announce(
|
|
15190
|
+
if (outcome?.ok) state.filterCardMessages.delete(requestId);
|
|
15191
|
+
else state.filterCardMessages.set(requestId, outcome?.message || FILTER_NOT_OPEN);
|
|
15192
|
+
announce(outcome?.message || FILTER_NOT_OPEN);
|
|
14921
15193
|
refreshFilterCards();
|
|
14922
15194
|
const card = ui.feed.querySelector(`.ai-chat-filter-card[data-request-id="${CSS.escape(requestId)}"]`);
|
|
14923
15195
|
(card?.querySelector('.ai-chat-filter-actions button') || card?.querySelector('.ai-chat-filter-note'))?.focus({ preventScroll: true });
|
|
@@ -15117,6 +15389,7 @@
|
|
|
15117
15389
|
* on-screen selection, and the outcome is settled. A claim that is never settled is never reopened.
|
|
15118
15390
|
*/
|
|
15119
15391
|
async function runServerProposalAction(action, event) {
|
|
15392
|
+
if (state.chat?.earlierOpening) return;
|
|
15120
15393
|
const payload = event.payload.serverProposal;
|
|
15121
15394
|
const requestId = String(event.payload.requestId || '');
|
|
15122
15395
|
const snapshot = captureChat();
|
|
@@ -15228,6 +15501,7 @@
|
|
|
15228
15501
|
function givenMessageBlocked() {
|
|
15229
15502
|
const chat = state.chat;
|
|
15230
15503
|
if (!chat || chat.archivedAt) return 'This conversation can’t take a message right now. Open it again, then send your answer.';
|
|
15504
|
+
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.';
|
|
15231
15505
|
if (state.loading || state.followupSubmitting || chat.activeTurn?.local) return 'FloLess is still sending your last message. Wait a moment, then send your answer again.';
|
|
15232
15506
|
if (state.followupUnknownId || hasUnknownFollowup()) return 'FloLess could not confirm your last message reached the AI. Check it in the conversation, then send your answer.';
|
|
15233
15507
|
if (chat.state === 'recovery') return 'This conversation is reconnecting to the AI. Send your answer once it is ready.';
|
|
@@ -15539,8 +15813,9 @@
|
|
|
15539
15813
|
async function checkProjectWait() {
|
|
15540
15814
|
const busy = state.projectBusy;
|
|
15541
15815
|
if (!busy || busy.mode !== 'waiting' || busy.checking) return;
|
|
15542
|
-
// The wait belongs to the conversation it was asked in; leaving it ends the wait (the draft stays there).
|
|
15543
|
-
|
|
15816
|
+
// The wait belongs to the conversation it was asked in; leaving it ends the wait (the draft stays there). #3255: so
|
|
15817
|
+
// does that conversation becoming an earlier opening's: nothing is sent into it.
|
|
15818
|
+
if (state.chat?.chatId !== busy.message.chatId || state.chat?.earlierOpening) { endProjectBusy(); return; }
|
|
15544
15819
|
if (Date.now() - busy.since >= PROJECT_WAIT_CAP_MS) {
|
|
15545
15820
|
clearInterval(busy.timer); busy.timer = null; busy.mode = 'cap';
|
|
15546
15821
|
paintProjectBusy({ focus: true });
|
|
@@ -15631,7 +15906,7 @@
|
|
|
15631
15906
|
/** #2106: a project's Knowledge step. A missing Workspaces bridge is said, never a silent no-op. */
|
|
15632
15907
|
async function openKnowledgeStepOf(projectId) {
|
|
15633
15908
|
const open = window.flolessWorkspaces?.openKnowledgeStep;
|
|
15634
|
-
if (typeof open !== 'function') throw new Error('FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.');
|
|
15909
|
+
if (typeof open !== 'function') throw Object.assign(new Error('FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.'), { forPerson: true });
|
|
15635
15910
|
await open(projectId);
|
|
15636
15911
|
}
|
|
15637
15912
|
|
|
@@ -15641,7 +15916,7 @@
|
|
|
15641
15916
|
if (holder.kind === 'knowledge') {
|
|
15642
15917
|
// The wait keeps going: opening the Knowledge step only shows the organizing this message waits for.
|
|
15643
15918
|
try { await openKnowledgeStepOf(holder.projectId); }
|
|
15644
|
-
catch (error) { announce(error
|
|
15919
|
+
catch (error) { announce(errorText(error, { action: 'open that project’s Knowledge step', retrySafe: true })); }
|
|
15645
15920
|
return;
|
|
15646
15921
|
}
|
|
15647
15922
|
if (holder.kind === 'chat' && holder.chatId && holder.owner) {
|
|
@@ -15910,7 +16185,7 @@
|
|
|
15910
16185
|
}
|
|
15911
16186
|
|
|
15912
16187
|
async function resolveUnknownFollowup(clientSubmissionId) {
|
|
15913
|
-
if (!state.chat || !clientSubmissionId) return;
|
|
16188
|
+
if (!state.chat || !clientSubmissionId || state.chat.earlierOpening) return;
|
|
15914
16189
|
if (state.resolvingFollowupIds.has(clientSubmissionId)) return;
|
|
15915
16190
|
const optimistic = state.events.find((event) => event.optimistic && event.clientSubmissionId === clientSubmissionId);
|
|
15916
16191
|
if (optimistic) {
|
|
@@ -15958,7 +16233,7 @@
|
|
|
15958
16233
|
}
|
|
15959
16234
|
|
|
15960
16235
|
async function retryNotSentFollowup(clientSubmissionId) {
|
|
15961
|
-
if (!state.chat || !clientSubmissionId || state.retryingFollowupIds.has(clientSubmissionId)) return;
|
|
16236
|
+
if (!state.chat || !clientSubmissionId || state.chat.earlierOpening || state.retryingFollowupIds.has(clientSubmissionId)) return;
|
|
15962
16237
|
const snapshot = captureChat();
|
|
15963
16238
|
if (!snapshot) return;
|
|
15964
16239
|
const commandId = `shell.chat-followup-retry#${clientSubmissionId}`;
|
|
@@ -16430,7 +16705,7 @@
|
|
|
16430
16705
|
}
|
|
16431
16706
|
|
|
16432
16707
|
async function attachFiles(files) {
|
|
16433
|
-
if (!state.chat || state.chat.activeTurn?.local || state.chat.state === 'recovery' || state.followupSubmitting || state.followupUnknownId || hasUnknownFollowup()) return;
|
|
16708
|
+
if (!state.chat || state.chat.earlierOpening || state.chat.activeTurn?.local || state.chat.state === 'recovery' || state.followupSubmitting || state.followupUnknownId || hasUnknownFollowup()) return;
|
|
16434
16709
|
const snapshot = captureChat();
|
|
16435
16710
|
if (!snapshot) return;
|
|
16436
16711
|
if (state.uploadingChatIds.has(snapshot.chatId)) return;
|
|
@@ -16539,7 +16814,7 @@
|
|
|
16539
16814
|
paintTeklaChip();
|
|
16540
16815
|
// SSE delivers messages immediately, while this poll is what confirms that the provider has
|
|
16541
16816
|
// finished. Keep the Rename chat control in step with that durable active-turn state.
|
|
16542
|
-
ui.rename.hidden = !state.chat || Boolean(state.chat.activeTurn) || Boolean(state.chat.archivedAt);
|
|
16817
|
+
ui.rename.hidden = !state.chat || Boolean(state.chat.activeTurn) || Boolean(state.chat.archivedAt) || Boolean(state.chat?.earlierOpening);
|
|
16543
16818
|
// Polling can clear activeTurn after the feed was painted by SSE. Repaint the feed
|
|
16544
16819
|
// so a completed turn removes any stale live activity indicator. With no conversation
|
|
16545
16820
|
// selected the feed is the Claude/Codex chooser, which a repaint would erase.
|
|
@@ -16553,7 +16828,7 @@
|
|
|
16553
16828
|
// after a sign-out made elsewhere can still carry the reader's stale answer. Not for a
|
|
16554
16829
|
// conversation with messages and the strip closed: past the 10 s server cache this read
|
|
16555
16830
|
// asks both CLIs for their status, and nothing there would show the answer.
|
|
16556
|
-
if (state.chat && (!ui.settings.hidden || !state.events.length)) {
|
|
16831
|
+
if (state.chat && !state.chat.earlierOpening && (!ui.settings.hidden || !state.events.length)) {
|
|
16557
16832
|
const chatId = state.chat.chatId;
|
|
16558
16833
|
try {
|
|
16559
16834
|
const info = await request('/api/terminal-runtimes');
|
|
@@ -16709,8 +16984,9 @@
|
|
|
16709
16984
|
* conversation in the same project, the earlier one left in history. Nothing of the old transcript is carried over.
|
|
16710
16985
|
*/
|
|
16711
16986
|
async function startNewChat(projectId) {
|
|
16712
|
-
// `
|
|
16713
|
-
|
|
16987
|
+
// `forPerson` (failure-copy.js errorText): the sentence is written for the person, so the caller shows it as it is
|
|
16988
|
+
// (not as an unknown failure).
|
|
16989
|
+
const refuse = (text) => Object.assign(new Error(text), { forPerson: true });
|
|
16714
16990
|
await refreshScope();
|
|
16715
16991
|
const owner = state.scope?.owner;
|
|
16716
16992
|
if (!owner || (projectId && (owner.kind !== 'project' || owner.projectId !== projectId))) {
|
|
@@ -16776,7 +17052,8 @@
|
|
|
16776
17052
|
const draft = teklaDraftForChat(chat);
|
|
16777
17053
|
const bound = currentTeklaBinding(chat);
|
|
16778
17054
|
const library = draft?.library || bound;
|
|
16779
|
-
|
|
17055
|
+
// #3255: an earlier opening's Tekla model and its read allowance are not live, so they offer no Remove or Revoke.
|
|
17056
|
+
if (!chat || !library || chat.earlierOpening) {
|
|
16780
17057
|
if (!node.hidden || node.childElementCount) { node.replaceChildren(); node.hidden = true; delete node.dataset.key; }
|
|
16781
17058
|
return;
|
|
16782
17059
|
}
|
|
@@ -16894,7 +17171,7 @@
|
|
|
16894
17171
|
if (!host) return;
|
|
16895
17172
|
const chat = state.chat;
|
|
16896
17173
|
// #1907: the line exists only while this chat's own connectors are on; with them off, nothing can call.
|
|
16897
|
-
const on = Boolean(chat && !chat.archivedAt && chat.settings?.useOwnConnectors === true && !chat.integrationBindings?.length);
|
|
17174
|
+
const on = Boolean(chat && !chat.archivedAt && !chat.earlierOpening && chat.settings?.useOwnConnectors === true && !chat.integrationBindings?.length);
|
|
16898
17175
|
const allowed = on && Array.isArray(chat.connectorAllowance?.allowed) ? chat.connectorAllowance.allowed : [];
|
|
16899
17176
|
const busy = Boolean(chat?.activeTurn) || state.ownConnectorsSaving === true;
|
|
16900
17177
|
const painted = `${chat?.chatId || ''}|${on}|${busy}|${chat?.provider || ''}|${allowed.map(connectorKey).join(',')}|${state.connectorRevoking || ''}`;
|
|
@@ -17002,8 +17279,9 @@
|
|
|
17002
17279
|
scopeLabel.textContent = scopeText;
|
|
17003
17280
|
ui.scopeToggle.setAttribute('aria-label', `Scope: ${scopeText}`);
|
|
17004
17281
|
ui.scopeToggle.dataset.tip = `Scope: ${scopeText}. See the conversation’s home folder and add or remove other projects and workflows.`;
|
|
17005
|
-
ui.scopeToggle.disabled = state.loading;
|
|
17006
|
-
if (
|
|
17282
|
+
ui.scopeToggle.disabled = Boolean(state.loading || chat?.earlierOpening);
|
|
17283
|
+
if (chat?.earlierOpening) ui.scopeToggle.dataset.blockedReason = 'Read only: this conversation is from before the Workspace was reopened.';
|
|
17284
|
+
else if (ui.scopeToggle.disabled) ui.scopeToggle.dataset.blockedReason = 'The conversation is still loading.';
|
|
17007
17285
|
else delete ui.scopeToggle.dataset.blockedReason;
|
|
17008
17286
|
if (ui.accessChip) {
|
|
17009
17287
|
const instructor = isInstructorAnswer(chat);
|
|
@@ -17012,8 +17290,9 @@
|
|
|
17012
17290
|
// #2651: Access can change at any time, a reply included: it shows the level the next message uses.
|
|
17013
17291
|
const changed = accessChangedDuringReply(chat);
|
|
17014
17292
|
ui.accessChip.setAttribute('aria-label', changed ? `Access: ${label} from your next message. Change access` : `Access: ${label}. Change access`);
|
|
17015
|
-
ui.accessChip.disabled =
|
|
17016
|
-
|
|
17293
|
+
ui.accessChip.disabled = Boolean(chat?.earlierOpening);
|
|
17294
|
+
if (chat?.earlierOpening) ui.accessChip.dataset.blockedReason = 'Read only: this conversation is from before the Workspace was reopened.';
|
|
17295
|
+
else delete ui.accessChip.dataset.blockedReason;
|
|
17017
17296
|
// One line, like the menu; what the level means in full is in this conversation's Scope view.
|
|
17018
17297
|
ui.accessChip.dataset.tip = instructor
|
|
17019
17298
|
? '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.'
|
|
@@ -17230,7 +17509,7 @@
|
|
|
17230
17509
|
const host = ui.grants;
|
|
17231
17510
|
if (!host) return;
|
|
17232
17511
|
const chat = state.chat;
|
|
17233
|
-
const live = chat && !chat.archivedAt;
|
|
17512
|
+
const live = chat && !chat.archivedAt && !chat.earlierOpening;
|
|
17234
17513
|
const turn = live && ['running', 'awaiting-approval'].includes(chat.state) ? chat.activeTurn : null;
|
|
17235
17514
|
const request = turn && Array.isArray(turn.requestGrants) ? turn.requestGrants.filter((grant) => grant && grant.key) : [];
|
|
17236
17515
|
const conversation = live && Array.isArray(chat.approvalGrants?.grants) ? chat.approvalGrants.grants : [];
|
|
@@ -17257,7 +17536,9 @@
|
|
|
17257
17536
|
const revoke = button('Revoke', grant.which === 'request' ? 'shell.chat-request-grant-revoke' : 'shell.chat-approval-grant-revoke', 'ai-chat-connector-revoke');
|
|
17258
17537
|
revoke.dataset.commandInstanceLabel = grant.label;
|
|
17259
17538
|
revoke.setAttribute('aria-label', `Revoke: ${grant.label}, ${grant.which === 'request' ? 'this reply' : 'this conversation'}`);
|
|
17260
|
-
revoke.dataset.tip =
|
|
17539
|
+
revoke.dataset.tip = grant.kind === 'protected'
|
|
17540
|
+
? 'This command will ask you again. Something already approved may finish.'
|
|
17541
|
+
: `${grant.label} will ask you again. Something already approved may finish.`;
|
|
17261
17542
|
revoke.disabled = state.grantRevoking === id;
|
|
17262
17543
|
revoke.addEventListener('click', () => { void revokeApprovalGrant(grant); });
|
|
17263
17544
|
pill.append(name, revoke);
|
|
@@ -17296,9 +17577,9 @@
|
|
|
17296
17577
|
const host = ui.changeAllowance;
|
|
17297
17578
|
if (!host) return;
|
|
17298
17579
|
const chat = state.chat;
|
|
17299
|
-
const allowed = chat && !chat.archivedAt && Array.isArray(chat.changeAllowance?.allowed)
|
|
17580
|
+
const allowed = chat && !chat.archivedAt && !chat.earlierOpening && Array.isArray(chat.changeAllowance?.allowed)
|
|
17300
17581
|
? chat.changeAllowance.allowed : [];
|
|
17301
|
-
const global = chat && !chat.archivedAt && chat.changeAllowance?.allowedForChat;
|
|
17582
|
+
const global = chat && !chat.archivedAt && !chat.earlierOpening && chat.changeAllowance?.allowedForChat;
|
|
17302
17583
|
const readOnly = chat?.settings?.permissionProfile === 'read-only';
|
|
17303
17584
|
const painted = `${chat?.chatId || ''}|${allowed.map((entry) => entry.key).join(',')}|${Boolean(global)}|${readOnly}|${state.changeRevoking || ''}`;
|
|
17304
17585
|
if (host.dataset.painted === painted) return;
|
|
@@ -17380,7 +17661,7 @@
|
|
|
17380
17661
|
const host = ui.checkAllowance;
|
|
17381
17662
|
if (!host) return;
|
|
17382
17663
|
const chat = state.chat;
|
|
17383
|
-
const grants = chat && !chat.archivedAt && Array.isArray(chat.integrationReadAllowance?.grants) ? chat.integrationReadAllowance.grants : [];
|
|
17664
|
+
const grants = chat && !chat.archivedAt && !chat.earlierOpening && Array.isArray(chat.integrationReadAllowance?.grants) ? chat.integrationReadAllowance.grants : [];
|
|
17384
17665
|
const painted = `${chat?.chatId || ''}|${grants.map((grant) => `${checkGrantKey(grant)}:${grant.identity || ''}`).join(',')}|${state.checkRevoking || ''}`;
|
|
17385
17666
|
if (host.dataset.painted === painted) return;
|
|
17386
17667
|
host.dataset.painted = painted;
|
|
@@ -17655,16 +17936,16 @@
|
|
|
17655
17936
|
// Graft receipt → unsent Chat draft. Opening performs no binding, sends nothing and never
|
|
17656
17937
|
// touches Tekla: the binding is stored only when the user presses Send.
|
|
17657
17938
|
async function openVerifiedTeklaDraft(receipt) {
|
|
17658
|
-
// `
|
|
17939
|
+
// `forPerson` (failure-copy.js errorText) marks errors written for the user, so the Graft dialog can show them as-is.
|
|
17659
17940
|
if (!receipt || typeof receipt.sourcePath !== 'string' || !receipt.sourcePath
|
|
17660
17941
|
|| typeof receipt.hostVersion !== 'string' || !receipt.hostVersion) {
|
|
17661
|
-
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.'), {
|
|
17942
|
+
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 });
|
|
17662
17943
|
}
|
|
17663
17944
|
// The chip lists exactly these reads, and Send binds exactly these: nothing defaults to more.
|
|
17664
17945
|
const library = { sourcePath: receipt.sourcePath, hostVersion: receipt.hostVersion, operations: teklaChatReads() };
|
|
17665
17946
|
const draft = teklaDraftText(receipt);
|
|
17666
17947
|
await refreshScope();
|
|
17667
|
-
if (!state.scope?.owner) throw Object.assign(new Error('Open a project or workflow before continuing in AI Chat.'), {
|
|
17948
|
+
if (!state.scope?.owner) throw Object.assign(new Error('Open a project or workflow before continuing in AI Chat.'), { forPerson: true });
|
|
17668
17949
|
window.flolessBridge?.revealAiChat?.();
|
|
17669
17950
|
ui.tab.click();
|
|
17670
17951
|
const chat = state.chat;
|
|
@@ -17935,6 +18216,15 @@
|
|
|
17935
18216
|
currentProvider: () => state.chat?.provider ?? null,
|
|
17936
18217
|
// #2926: the conversation on screen, so the Drawing Filter's Flo knows a question shown here is its read's.
|
|
17937
18218
|
currentChatId: () => state.chat?.chatId ?? null,
|
|
18219
|
+
// What the 3D model's Flo shows for this conversation (workspaces.js syncModelFlo): Your call while a suggested
|
|
18220
|
+
// action waits on its card, the live row's own mood (thinking / working) while the AI replies, else idle. A
|
|
18221
|
+
// pending approval or question is read from the shell's approvalPending, as the other indicators are.
|
|
18222
|
+
floMood: () => {
|
|
18223
|
+
const proposed = state.events.some((event) => event.type === 'action-proposal'
|
|
18224
|
+
&& actionProposalState(String(event.payload?.proposalId || event.eventId || '')).state === 'proposed');
|
|
18225
|
+
if (proposed) return 'yourcall';
|
|
18226
|
+
return turnIsVisiblyActive() ? liveFloMood() : 'idle';
|
|
18227
|
+
},
|
|
17938
18228
|
// The project this panel's conversations belong to; an object card offers Show in chat only for it (#1653).
|
|
17939
18229
|
scopeProjectId: () => (state.scope?.owner?.kind === 'project' ? state.scope.owner.projectId : null),
|
|
17940
18230
|
// #3003: a Knowledge page rendered the way the chat viewers show it, for the Knowledge step's page panel.
|