@floless/app 0.141.0 → 0.141.1
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/dist/floless-server.cjs +1846 -737
- package/dist/web/account-menu.js +168 -0
- package/dist/web/app.css +96 -9
- package/dist/web/app.js +2 -0
- package/dist/web/aware.js +761 -67
- package/dist/web/chat.css +49 -0
- package/dist/web/chat.js +823 -75
- package/dist/web/commands-shell.js +121 -5
- package/dist/web/index.html +78 -2
- package/dist/web/instructor.js +2 -2
- package/dist/web/leave-guard.js +480 -0
- package/dist/web/steel-filter.html +6 -5
- package/dist/web/vector-editor.html +20 -3
- package/dist/web/workspaces.js +378 -34
- package/launch.mjs +32 -1
- package/package.json +1 -1
package/dist/web/workspaces.js
CHANGED
|
@@ -319,6 +319,12 @@
|
|
|
319
319
|
model: document.getElementById('ws-frame-model'),
|
|
320
320
|
drawings: document.getElementById('ws-frame-drawings'),
|
|
321
321
|
};
|
|
322
|
+
// A project's editors autosave, but a Stop FloLess / Sign Out mid-save would still lose the last
|
|
323
|
+
// change — let the leave guard see (and flush) them. See web/leave-guard.js.
|
|
324
|
+
if (window.flolessLeaveGuard) {
|
|
325
|
+
window.flolessLeaveGuard.registerFrame(frames.model, 'workspace-model');
|
|
326
|
+
window.flolessLeaveGuard.registerFrame(frames.drawings, 'workspace-drawings');
|
|
327
|
+
}
|
|
322
328
|
let lastModelDisposeReceipt = null;
|
|
323
329
|
function disposeModelEditorFrame(reason) {
|
|
324
330
|
// The left Model section drops the departing editor's tree now, not at the next load event, so a
|
|
@@ -2423,7 +2429,7 @@
|
|
|
2423
2429
|
const $projectSetupName = document.getElementById('project-setup-name');
|
|
2424
2430
|
const $projectSetupStandard = document.getElementById('project-setup-standard');
|
|
2425
2431
|
const $projectSetupError = document.getElementById('project-setup-error');
|
|
2426
|
-
const $
|
|
2432
|
+
const $projectSetupProvider = document.getElementById('project-setup-provider');
|
|
2427
2433
|
const $projectSetupCancel = document.getElementById('project-setup-cancel');
|
|
2428
2434
|
const $projectSetupCreateOnly = document.getElementById('project-setup-create-only');
|
|
2429
2435
|
const $projectSetupCreate = document.getElementById('project-setup-create');
|
|
@@ -2493,24 +2499,153 @@
|
|
|
2493
2499
|
projectSetupState.busy = !!busy;
|
|
2494
2500
|
$projectSetup.setAttribute('aria-busy', String(!!busy));
|
|
2495
2501
|
for (const control of $projectSetup.querySelectorAll('button, input')) control.disabled = !!busy;
|
|
2502
|
+
// Waiting for FloLess to set an AI up creates nothing yet, so Cancel stays usable (#1607).
|
|
2503
|
+
if (busy && projectSetupState.settingUp) $projectSetupCancel.disabled = false;
|
|
2496
2504
|
$projectSetupCreate.textContent = label || 'Create project & start chat';
|
|
2497
|
-
$projectSetupCreateOnly.textContent = busy ? 'Creating…' : (projectSetupState.kind === 'rvt' ? 'Create project' : 'Create project only');
|
|
2505
|
+
$projectSetupCreateOnly.textContent = busy && !projectSetupState.settingUp ? 'Creating…' : (projectSetupState.kind === 'rvt' ? 'Create project' : 'Create project only');
|
|
2498
2506
|
if (!busy) {
|
|
2499
2507
|
$projectSetupCreate.disabled = !projectSetupReady();
|
|
2500
2508
|
$projectSetupCreateOnly.disabled = !projectSetupReady();
|
|
2501
2509
|
}
|
|
2502
2510
|
}
|
|
2503
2511
|
|
|
2512
|
+
const PROJECT_CHAT_PROVIDER_NAMES = { claude: 'Claude', codex: 'Codex' };
|
|
2513
|
+
|
|
2514
|
+
// Whether this dialog may start the conversation with this AI (#1607): the one answer the default
|
|
2515
|
+
// (preferredChatProvider), the Requests Start affordances and the AI Chat empty state share —
|
|
2516
|
+
// 'ready', 'setup' (FloLess sets up its own copy when the conversation opens) or 'unavailable'.
|
|
2517
|
+
function projectSetupProviderReadiness(runtime) {
|
|
2518
|
+
return runtime ? (bridge.chatRuntimeReadiness?.(runtime) || 'unavailable') : 'unavailable';
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
// Which AI "Create project & start chat" starts the conversation with (#1605): the person's own
|
|
2522
|
+
// pick while it can still start, otherwise the AI FloLess would pick anyway — so the one-click
|
|
2523
|
+
// path still works for anyone who does not care. A Revit project starts no chat, so it has none.
|
|
2524
|
+
// Every answer is checked against what can start now: preferredChatProvider() prefers the open
|
|
2525
|
+
// conversation's AI, which may since have been uninstalled, and a choice that cannot start must
|
|
2526
|
+
// never be the one shown as chosen and sent.
|
|
2527
|
+
function projectSetupProvider(state) {
|
|
2528
|
+
if (!state || state.kind === 'rvt') return null;
|
|
2529
|
+
const runtimes = bridge.chatProviderRuntimes?.() || [];
|
|
2530
|
+
const readiness = (id) => (id ? projectSetupProviderReadiness(runtimes.find((runtime) => runtime.id === id)) : 'unavailable');
|
|
2531
|
+
const canStart = (id) => readiness(id) !== 'unavailable';
|
|
2532
|
+
if (canStart(state.chatProvider)) return state.chatProvider;
|
|
2533
|
+
const preferred = bridge.preferredChatProvider?.() || null;
|
|
2534
|
+
if (canStart(preferred)) return preferred;
|
|
2535
|
+
// An AI that is ready now before one FloLess still has to set up (#1607).
|
|
2536
|
+
const ids = Object.keys(PROJECT_CHAT_PROVIDER_NAMES);
|
|
2537
|
+
return ids.find((id) => readiness(id) === 'ready') || ids.find(canStart) || null;
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
// The per-AI line under the choice (#1607). A copy FloLess sets up itself is offered, and its line
|
|
2541
|
+
// says it is not set up yet, so the wait after Create is no surprise.
|
|
2542
|
+
function projectSetupProviderLine(id, runtime, readiness, state, accountLabel) {
|
|
2543
|
+
const name = PROJECT_CHAT_PROVIDER_NAMES[id] || id;
|
|
2544
|
+
const managed = runtime && runtime.managed && typeof runtime.managed === 'object' ? runtime.managed : null;
|
|
2545
|
+
if (readiness === 'ready') {
|
|
2546
|
+
return typeof accountLabel !== 'function' ? name
|
|
2547
|
+
: accountLabel(id, state.providersRead ? runtime.account : { state: 'checking' });
|
|
2548
|
+
}
|
|
2549
|
+
if (readiness === 'setup') {
|
|
2550
|
+
if (managed?.state === 'preparing') return `${name} · setting up…`;
|
|
2551
|
+
// Nothing retries on its own here: pressing Create is what tries the setup again.
|
|
2552
|
+
if (managed?.state === 'failed') return `${name} · setup failed, Create tries again`;
|
|
2553
|
+
return `${name} · not set up yet`;
|
|
2554
|
+
}
|
|
2555
|
+
return managed ? `${name} · couldn’t be set up` : `${name} · not found`;
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
// Why an AI that cannot start cannot be chosen here, and where to go instead.
|
|
2559
|
+
function projectSetupBlockedReason(id, runtime) {
|
|
2560
|
+
const name = PROJECT_CHAT_PROVIDER_NAMES[id] || id;
|
|
2561
|
+
const other = PROJECT_CHAT_PROVIDER_NAMES[id === 'claude' ? 'codex' : 'claude'];
|
|
2562
|
+
// FloLess runs its own copy here, and that copy failed in a way it cannot retry by itself.
|
|
2563
|
+
if (runtime && runtime.managed && typeof runtime.managed === 'object') {
|
|
2564
|
+
return `FloLess could not set up ${name} on this computer. Choose ${other} here, or open AI Chat with ${name} to see why.`;
|
|
2565
|
+
}
|
|
2566
|
+
// "Did not find", not "not installed": the sentence says only what is known.
|
|
2567
|
+
return `FloLess did not find ${name} on this computer. Choose ${other} here, or open AI Chat to set ${name} up.`;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
// The Claude / Codex choice, in the same shape as the AI Chat empty state: two buttons, and each
|
|
2571
|
+
// one's own sign-in underneath. With no AI able to start, the whole choice is hidden together with
|
|
2572
|
+
// Create project & start chat, rather than offering buttons that cannot be pressed. An AI that
|
|
2573
|
+
// cannot start next to one that can stays visible and focusable, and says why it cannot be chosen.
|
|
2574
|
+
function paintProjectSetupProviders(state, provider) {
|
|
2575
|
+
if (!$projectSetupProvider) return;
|
|
2576
|
+
$projectSetupProvider.hidden = !provider;
|
|
2577
|
+
if (!provider) return;
|
|
2578
|
+
const runtimes = bridge.chatProviderRuntimes?.() || [];
|
|
2579
|
+
const accountLabel = window.flolessChat?.providerAccountLabel;
|
|
2580
|
+
for (const button of $projectSetupProvider.querySelectorAll('[data-chat-provider]')) {
|
|
2581
|
+
const id = button.dataset.chatProvider;
|
|
2582
|
+
const name = PROJECT_CHAT_PROVIDER_NAMES[id] || id;
|
|
2583
|
+
const runtime = runtimes.find((row) => row.id === id);
|
|
2584
|
+
const readiness = projectSetupProviderReadiness(runtime);
|
|
2585
|
+
button.setAttribute('aria-pressed', String(id === provider));
|
|
2586
|
+
if (readiness !== 'unavailable') {
|
|
2587
|
+
button.removeAttribute('aria-disabled');
|
|
2588
|
+
delete button.dataset.tip;
|
|
2589
|
+
delete button.dataset.blockedReason;
|
|
2590
|
+
} else {
|
|
2591
|
+
const why = projectSetupBlockedReason(id, runtime);
|
|
2592
|
+
button.setAttribute('aria-disabled', 'true');
|
|
2593
|
+
button.dataset.tip = why;
|
|
2594
|
+
button.dataset.blockedReason = why;
|
|
2595
|
+
}
|
|
2596
|
+
const status = $projectSetupProvider.querySelector(`[data-chat-provider-status="${id}"]`);
|
|
2597
|
+
if (!status) continue;
|
|
2598
|
+
// While FloLess sets this AI up for the dialog, its line carries the AI Chat panel's own
|
|
2599
|
+
// sentence for that setup (a polite region, so it is read once per change).
|
|
2600
|
+
const text = state.settingUp && state.settingUp.provider === id && state.settingUp.text
|
|
2601
|
+
? state.settingUp.text
|
|
2602
|
+
: projectSetupProviderLine(id, runtime, readiness, state, accountLabel);
|
|
2603
|
+
// The row is a polite live region: an unchanged line must not be read out again.
|
|
2604
|
+
if (status.textContent !== text) status.textContent = text;
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
// Pressing Claude or Codex. An AI that cannot start is aria-disabled (focusable, so its reason can
|
|
2609
|
+
// be read) and pressing it changes nothing; nor does a press while the project is being created.
|
|
2610
|
+
function chooseProjectSetupProvider(button) {
|
|
2611
|
+
if (!button || !projectSetupState || projectSetupState.busy) return;
|
|
2612
|
+
if (button.getAttribute('aria-disabled') === 'true') return;
|
|
2613
|
+
projectSetupState.chatProvider = button.dataset.chatProvider;
|
|
2614
|
+
renderProjectSetup();
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
// Reads which AIs can start and who each is signed in as, when the dialog opens. A read that
|
|
2618
|
+
// failed, or a sign-in the server could not settle (a slow or failed CLI status read), is
|
|
2619
|
+
// transient, so it is asked again a few times while the dialog stays open instead of leaving
|
|
2620
|
+
// "could not check" — or no choice at all — as the only basis for the choice.
|
|
2621
|
+
async function refreshProjectSetupProviders(state, attempt = 0) {
|
|
2622
|
+
const read = await bridge.refreshChatProviders?.();
|
|
2623
|
+
if (projectSetupState !== state) return;
|
|
2624
|
+
state.providersRead = true;
|
|
2625
|
+
renderProjectSetup();
|
|
2626
|
+
// Only a READY AI's sign-in can settle: a copy FloLess has not set up yet answers "unknown" by
|
|
2627
|
+
// construction, and asking again would never change that (#1607).
|
|
2628
|
+
const unsettled = read === false || (bridge.chatProviderRuntimes?.() || []).some((runtime) => projectSetupProviderReadiness(runtime) === 'ready'
|
|
2629
|
+
&& !['signed-in', 'signed-out', 'no-identity'].includes(runtime.account?.state));
|
|
2630
|
+
if (unsettled && attempt < 3) {
|
|
2631
|
+
setTimeout(() => {
|
|
2632
|
+
if (projectSetupState === state) void refreshProjectSetupProviders(state, attempt + 1);
|
|
2633
|
+
}, 4000);
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
// Repaint only the AI lines while the dialog waits for a setup; a full render would re-enable the
|
|
2638
|
+
// create buttons under the wait.
|
|
2639
|
+
function renderProjectSetupWhileBusy(state) {
|
|
2640
|
+
if (projectSetupState !== state) return;
|
|
2641
|
+
paintProjectSetupProviders(state, projectSetupProvider(state));
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2504
2644
|
function renderProjectSetup() {
|
|
2505
2645
|
const state = projectSetupState;
|
|
2506
2646
|
if (!state) return;
|
|
2507
|
-
const provider = state
|
|
2508
|
-
|
|
2509
|
-
$projectSetupChatMeta.hidden = !provider;
|
|
2510
|
-
$projectSetupChatMeta.textContent = provider
|
|
2511
|
-
? `Starts with ${provider === 'claude' ? 'Claude Code' : provider === 'codex' ? 'Codex' : provider} · can edit this project folder`
|
|
2512
|
-
: '';
|
|
2513
|
-
}
|
|
2647
|
+
const provider = projectSetupProvider(state);
|
|
2648
|
+
paintProjectSetupProviders(state, provider);
|
|
2514
2649
|
$projectSetupCreate.hidden = !provider;
|
|
2515
2650
|
$projectSetupCreateOnly.classList.toggle('primary', !provider);
|
|
2516
2651
|
$projectSetupTitle.textContent = `New ${descDisplayName(state.templateId)} project`;
|
|
@@ -2540,7 +2675,11 @@
|
|
|
2540
2675
|
|
|
2541
2676
|
function closeProjectSetup({ restoreFocus = true } = {}) {
|
|
2542
2677
|
const state = projectSetupState;
|
|
2543
|
-
|
|
2678
|
+
// Busy refuses a close, except while FloLess is only setting an AI up: nothing exists yet, and
|
|
2679
|
+
// clearing projectSetupState is what tells that wait to stop (the install itself carries on).
|
|
2680
|
+
if (!state || (state.busy && !state.settingUp)) return;
|
|
2681
|
+
// Leave no control disabled behind for the next time the dialog opens.
|
|
2682
|
+
if (state.busy) { state.settingUp = null; setProjectSetupBusy(false); }
|
|
2544
2683
|
projectSetupState = null;
|
|
2545
2684
|
$projectSetup.classList.remove('show');
|
|
2546
2685
|
$projectSetup.removeAttribute('aria-busy');
|
|
@@ -2585,11 +2724,41 @@
|
|
|
2585
2724
|
async function createProjectFromSetup(startChat = true) {
|
|
2586
2725
|
const state = projectSetupState;
|
|
2587
2726
|
if (!projectSetupReady(state) || state.busy) return;
|
|
2588
|
-
|
|
2727
|
+
const provider = startChat ? projectSetupProvider(state) : null;
|
|
2728
|
+
if (startChat && !provider) {
|
|
2589
2729
|
setProjectSetupError('Sign in to Claude or Codex before starting this project in AI Chat. You can still create the project only.');
|
|
2590
2730
|
return;
|
|
2591
2731
|
}
|
|
2592
2732
|
setProjectSetupError('');
|
|
2733
|
+
if (startChat && projectSetupProviderReadiness((bridge.chatProviderRuntimes?.() || []).find((row) => row.id === provider)) === 'setup') {
|
|
2734
|
+
// FloLess has to set its own copy of this AI up before the conversation's first message can be
|
|
2735
|
+
// sent (#1607). Wait for that here, before anything is created, so a failed or cancelled setup
|
|
2736
|
+
// leaves no project and no dead conversation behind.
|
|
2737
|
+
const name = PROJECT_CHAT_PROVIDER_NAMES[provider] || provider;
|
|
2738
|
+
state.settingUp = { provider, text: '' };
|
|
2739
|
+
setProjectSetupBusy(true, `Setting up ${name}…`);
|
|
2740
|
+
renderProjectSetupWhileBusy(state);
|
|
2741
|
+
// The pressed button is now disabled; keep keyboard focus on the one control that still acts.
|
|
2742
|
+
$projectSetupCancel.focus();
|
|
2743
|
+
const ready = await bridge.ensureChatRuntimeReady(provider, {
|
|
2744
|
+
isCancelled: () => projectSetupState !== state,
|
|
2745
|
+
onProgress: (status) => {
|
|
2746
|
+
if (projectSetupState !== state || !state.settingUp) return;
|
|
2747
|
+
const notice = window.flolessChat?.runtimeNotice?.(provider, status);
|
|
2748
|
+
state.settingUp.text = notice?.body || `FloLess is setting ${name} up. This happens once per FloLess update.`;
|
|
2749
|
+
renderProjectSetupWhileBusy(state);
|
|
2750
|
+
},
|
|
2751
|
+
});
|
|
2752
|
+
if (projectSetupState !== state) return;
|
|
2753
|
+
state.settingUp = null;
|
|
2754
|
+
renderProjectSetupWhileBusy(state);
|
|
2755
|
+
if (!ready.ok) {
|
|
2756
|
+
setProjectSetupBusy(false);
|
|
2757
|
+
renderProjectSetup();
|
|
2758
|
+
setProjectSetupError(ready.reason);
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2593
2762
|
setProjectSetupBusy(true, startChat ? 'Preparing chat…' : 'Creating…');
|
|
2594
2763
|
try {
|
|
2595
2764
|
if (!startChat) {
|
|
@@ -2627,7 +2796,7 @@
|
|
|
2627
2796
|
...(state.askCatalogue ? { environment: state.environment } : {}),
|
|
2628
2797
|
directorySelectionId: state.directory.selectionId,
|
|
2629
2798
|
snapshots,
|
|
2630
|
-
provider
|
|
2799
|
+
provider,
|
|
2631
2800
|
});
|
|
2632
2801
|
const project = result.project;
|
|
2633
2802
|
state.project = project;
|
|
@@ -2703,6 +2872,8 @@
|
|
|
2703
2872
|
templateId,
|
|
2704
2873
|
files,
|
|
2705
2874
|
kind,
|
|
2875
|
+
chatProvider: null,
|
|
2876
|
+
providersRead: false,
|
|
2706
2877
|
askCatalogue: kind === 'drawings' && templateId === 'steel-model',
|
|
2707
2878
|
environment: null,
|
|
2708
2879
|
directory: null,
|
|
@@ -2718,6 +2889,7 @@
|
|
|
2718
2889
|
renderProjectSetup();
|
|
2719
2890
|
$projectSetup.classList.add('show');
|
|
2720
2891
|
$projectSetupFolderChoose.focus();
|
|
2892
|
+
if (kind !== 'rvt') void refreshProjectSetupProviders(state);
|
|
2721
2893
|
try {
|
|
2722
2894
|
await Promise.all(files.map(assertProjectSourceReadable));
|
|
2723
2895
|
if (projectSetupState !== state) return;
|
|
@@ -2755,13 +2927,16 @@
|
|
|
2755
2927
|
projectSetupState.environment = button.dataset.environment;
|
|
2756
2928
|
renderProjectSetup();
|
|
2757
2929
|
});
|
|
2930
|
+
$projectSetupProvider?.addEventListener('click', (event) => {
|
|
2931
|
+
chooseProjectSetupProvider(event.target.closest('[data-chat-provider]'));
|
|
2932
|
+
});
|
|
2758
2933
|
$projectSetupCancel.addEventListener('click', () => closeProjectSetup());
|
|
2759
2934
|
$projectSetupCreate.addEventListener('click', () => createProjectFromSetup(true));
|
|
2760
2935
|
$projectSetupCreateOnly.addEventListener('click', () => createProjectFromSetup(false));
|
|
2761
2936
|
onBackdropDismiss($projectSetup, () => closeProjectSetup(), () => !!projectSetupState && !projectSetupState.busy);
|
|
2762
2937
|
$projectSetup.addEventListener('keydown', (event) => {
|
|
2763
2938
|
if (!projectSetupState) return;
|
|
2764
|
-
if (event.key === 'Escape' && !projectSetupState.busy) {
|
|
2939
|
+
if (event.key === 'Escape' && (!projectSetupState.busy || projectSetupState.settingUp)) {
|
|
2765
2940
|
event.preventDefault();
|
|
2766
2941
|
closeProjectSetup();
|
|
2767
2942
|
return;
|
|
@@ -3515,11 +3690,15 @@
|
|
|
3515
3690
|
if (continuation?.state === 'continuing') return 'FloLess sent the saved filter to the linked AI Chat. Follow that conversation for the drawing read.';
|
|
3516
3691
|
if (continuation?.state === 'completed') return 'The linked AI Chat finished its response. Review its result in that conversation.';
|
|
3517
3692
|
if (continuation?.nextAction) return continuation.nextAction;
|
|
3518
|
-
|
|
3693
|
+
// No continuation record: nothing has said FloLess will carry this on, so the user must. Name
|
|
3694
|
+
// the session they actually have to go back to — "the terminal AI" is wrong for a read AI Chat
|
|
3695
|
+
// started, and sending someone to a terminal that is not doing the work is the same defect as
|
|
3696
|
+
// telling them to start a read that is already running.
|
|
3697
|
+
return `Return to the same ${readSessionName(req)} that prepared this Drawing Filter and tell it to continue the drawing read.`;
|
|
3519
3698
|
}
|
|
3520
3699
|
|
|
3521
3700
|
function readyFilterNextStep(req) {
|
|
3522
|
-
return req
|
|
3701
|
+
return readRunsInChat(req)
|
|
3523
3702
|
? 'Then press Save filter in the top-right corner. FloLess will continue the drawing read in the linked AI Chat.'
|
|
3524
3703
|
: 'Then press Save filter in the top-right corner. After Save, return to the terminal AI that prepared it and tell it to continue.';
|
|
3525
3704
|
}
|
|
@@ -3544,12 +3723,12 @@
|
|
|
3544
3723
|
if (projectContractLifecycle === 'unknown') return '';
|
|
3545
3724
|
if (step === 'model') {
|
|
3546
3725
|
if (waitingForInitial && revCardReq?.preparationState === 'blocked') return 'FloLess could not finish drawing preparation. Restart FloLess, then open Requests and follow the detailed instructions if it remains blocked.';
|
|
3547
|
-
if (waitingForInitial && revCardReq?.preparationState === 'manifest-published' && !revCardReq?.prepassReady) return
|
|
3726
|
+
if (waitingForInitial && revCardReq?.preparationState === 'manifest-published' && !revCardReq?.prepassReady) return `Drawing preparation is complete and saved. Return to the same ${readSessionName(revCardReq)} and tell it to continue creating the Drawing Filter.`;
|
|
3548
3727
|
if (waitingForInitial && revCardReq?.filterSaveContinuation?.state === 'recovery-needed') return `The Drawing Filter needs attention. ${savedFilterNextStep(revCardReq)}`;
|
|
3549
3728
|
if (waitingForInitial && revCardReq?.filterCheckpointCurrent) return `The Drawing Filter is saved. ${savedFilterNextStep(revCardReq)}`;
|
|
3550
3729
|
if (waitingForInitial && revCardReq?.prepassReady) return `Check steel, member marks, grids, dimensions, and relevant callouts. Ask in AI Chat on the left if you need help. ${readyFilterNextStep(revCardReq)}`;
|
|
3551
|
-
if (waitingForInitial && revCardReq?.preparationRetryable) return
|
|
3552
|
-
if (waitingForInitial) return
|
|
3730
|
+
if (waitingForInitial && revCardReq?.preparationRetryable) return `Steel Filter preparation was interrupted. Your drawings are still attached. Return to the same ${readSessionName(revCardReq)} and retry preparation for this same request.`;
|
|
3731
|
+
if (waitingForInitial) return `The initial drawing read is waiting for ${readRunsInChat(revCardReq) ? 'AI Chat' : 'your terminal AI'}. The model unlocks after you review the Drawing Filter and press Save filter.`;
|
|
3553
3732
|
if (projectContractLifecycle === 'filter-checkpoint') return 'Attach the drawing set again in Drawing Filter to restart the read. The earlier request is no longer available to receive a saved filter.';
|
|
3554
3733
|
return 'Read and save a Drawing Filter first. The model will unlock after the first drawing read.';
|
|
3555
3734
|
}
|
|
@@ -3646,7 +3825,7 @@
|
|
|
3646
3825
|
: waitingForInitial && revCardReq?.preparationState === 'blocked'
|
|
3647
3826
|
? 'FloLess could not finish drawing preparation · Restart FloLess, then open Requests and follow the detailed instructions if it remains blocked. Your drawings are still attached.'
|
|
3648
3827
|
: waitingForInitial && revCardReq?.preparationState === 'manifest-published' && !revCardReq?.prepassReady
|
|
3649
|
-
?
|
|
3828
|
+
? `Drawing preparation is complete and saved · Return to the same ${readSessionName(revCardReq)} and tell it to continue creating the Drawing Filter. Do not start or copy this request again.`
|
|
3650
3829
|
: waitingForInitial && revCardReq?.filterSaveContinuation?.state === 'recovery-needed'
|
|
3651
3830
|
? `Drawing Filter needs attention · ${savedFilterNextStep(revCardReq)}`
|
|
3652
3831
|
: waitingForInitial && revCardReq?.filterCheckpointCurrent
|
|
@@ -3654,9 +3833,25 @@
|
|
|
3654
3833
|
: waitingForInitial && revCardReq?.prepassReady
|
|
3655
3834
|
? 'Drawing Filter ready for review · ' + (window.FilterGuidance?.scope || 'Check what this steel read may use — not only the steel. Keep the steel plus member labels and sizes, grid references, scale or location dimensions, and relevant detail or section callouts.') + ' Ask in AI Chat on the left if you are unsure. ' + readyFilterNextStep(revCardReq)
|
|
3656
3835
|
: waitingForInitial && revCardReq?.preparationRetryable
|
|
3657
|
-
?
|
|
3836
|
+
? `Steel Filter preparation was interrupted · Your drawings are still attached. Return to the same ${readSessionName(revCardReq)} and retry preparation for this same request.`
|
|
3837
|
+
: waitingForInitial && readWorkingInChat(revCardReq)
|
|
3838
|
+
? 'Drawing read is running in AI Chat · Follow it in AI Chat on the left (expand that panel if it is collapsed). Nothing to do here — FloLess updates this when the Drawing Filter is ready for your review.'
|
|
3839
|
+
: waitingForInitial && readChatBlockedAction(revCardReq)
|
|
3840
|
+
? `Drawing read is waiting for you in AI Chat · ${OPEN_AI_CHAT} and ${readChatBlockedAction(revCardReq)}. The read continues once you do.`
|
|
3841
|
+
: waitingForInitial && readChatUnreadable(revCardReq)
|
|
3842
|
+
? `FloLess cannot read this drawing read’s AI Chat conversation · ${OPEN_AI_CHAT} to check it. If it will not open, use Report an issue.`
|
|
3843
|
+
: waitingForInitial && readChatArchived(revCardReq)
|
|
3844
|
+
? `Drawing read is in an archived AI Chat conversation · ${OPEN_AI_CHAT} and restore that conversation — its composer stays disabled until you do. Then tell it to continue the drawing read.`
|
|
3845
|
+
: waitingForInitial && readChatBusyElsewhere(revCardReq)
|
|
3846
|
+
? 'Drawing read is waiting on a reply in AI Chat · If you told AI Chat to continue the drawing read, this updates as it goes. If not, tell it to continue once that reply is done — the read will not resume on its own.'
|
|
3847
|
+
: waitingForInitial && readChatFailed(revCardReq)
|
|
3848
|
+
? `Drawing read stopped with an error in AI Chat · AI Chat’s last reply ended with an error. ${OPEN_AI_CHAT} to see what went wrong, then ask it to try the drawing read again.`
|
|
3849
|
+
: waitingForInitial && readChatInterrupted(revCardReq)
|
|
3850
|
+
? `Drawing read was interrupted in AI Chat · AI Chat’s reply stopped before it finished. ${OPEN_AI_CHAT} and tell it to continue the drawing read.`
|
|
3851
|
+
: waitingForInitial && readRunsInChat(revCardReq)
|
|
3852
|
+
? `Drawing read is paused in AI Chat · ${OPEN_AI_CHAT} and tell it to continue the drawing read.`
|
|
3658
3853
|
: waitingForInitial
|
|
3659
|
-
? 'Drawing read not started · Open Requests,
|
|
3854
|
+
? 'Drawing read not started · Open Requests — if Start in AI Chat is shown, choose it; otherwise copy the request into Claude Code or Codex. Then return to review and save the Drawing Filter.'
|
|
3660
3855
|
: projectContractLifecycle === 'filter-checkpoint'
|
|
3661
3856
|
? 'Drawing read needs restarting · The earlier drawing request is no longer available. Attach the drawing set again in Drawing Filter to restart the read.'
|
|
3662
3857
|
: 'Start in Drawing Filter by attaching a PDF or image. The Model, Exports, and History stages unlock after the first steel model is created.';
|
|
@@ -4411,6 +4606,7 @@
|
|
|
4411
4606
|
const KB_LOCK_STALE_MS = 10 * 60 * 1000; // = knowledge-store.ts LOCK_STALE_MS; when to warn "taking longer"
|
|
4412
4607
|
const KB_MB = (n) => Math.round(n / (1024 * 1024));
|
|
4413
4608
|
let knowledgePoll = null;
|
|
4609
|
+
let knowledgePollInFlight = false;
|
|
4414
4610
|
let knowledgeState = null;
|
|
4415
4611
|
let companyKnowledgeState = null;
|
|
4416
4612
|
let companyKnowledgePromotion = null; // { sourceId, filename }
|
|
@@ -4506,7 +4702,10 @@
|
|
|
4506
4702
|
if (knowledgePoll) return; // already ticking — don't stack intervals across re-renders
|
|
4507
4703
|
knowledgePoll = setInterval(() => {
|
|
4508
4704
|
if (!current || $wsKnowledge.hidden) { stopKnowledgePoll(); return; }
|
|
4509
|
-
|
|
4705
|
+
// Skip, don't stack (#1604): each render reads /api/requests, which can outlast this interval.
|
|
4706
|
+
if (knowledgePollInFlight) return;
|
|
4707
|
+
knowledgePollInFlight = true;
|
|
4708
|
+
renderKnowledge().finally(() => { knowledgePollInFlight = false; });
|
|
4510
4709
|
}, 3000);
|
|
4511
4710
|
}
|
|
4512
4711
|
|
|
@@ -4514,10 +4713,13 @@
|
|
|
4514
4713
|
// (the store writes organize.json at `start`), so "pending" must be the UNION of both reads — never
|
|
4515
4714
|
// /status alone. The request queue is advisory: a blip there must not blank the sources column.
|
|
4516
4715
|
async function loadKnowledgeState(proj) {
|
|
4716
|
+
// Each read is bounded (#1604): the 3-second poll skips its ticks while a render is out, so a
|
|
4717
|
+
// request that never answered would stop the column refreshing for good.
|
|
4718
|
+
const bounded = () => ({ signal: AbortSignal.timeout(90_000) });
|
|
4517
4719
|
const [status, reqs, company] = await Promise.all([
|
|
4518
|
-
api(kbUrl(proj.id, '/status')),
|
|
4519
|
-
api('/api/requests').catch(() => []),
|
|
4520
|
-
api(`/api/company-knowledge?projectId=${encodeURIComponent(proj.id)}
|
|
4720
|
+
api(kbUrl(proj.id, '/status'), bounded()),
|
|
4721
|
+
api('/api/requests', bounded()).catch(() => []),
|
|
4722
|
+
api(`/api/company-knowledge?projectId=${encodeURIComponent(proj.id)}`, bounded())
|
|
4521
4723
|
.catch((error) => ({ configured: false, loadError: String((error && error.message) || error) })),
|
|
4522
4724
|
]);
|
|
4523
4725
|
const list = Array.isArray(reqs) ? reqs : (reqs.requests || []);
|
|
@@ -8680,6 +8882,66 @@
|
|
|
8680
8882
|
$revisionCard.replaceChildren();
|
|
8681
8883
|
}
|
|
8682
8884
|
const isInitialRevisionRead = (req) => !req || !req.baseVersion || req.baseVersion <= 0;
|
|
8885
|
+
// ── Who is actually driving this drawing read ───────────────────────────────────────────────
|
|
8886
|
+
// `chatConversation` is server-owned (request-list-route). `executionOwner: 'chat'` is stamped
|
|
8887
|
+
// only when the read was really STARTED in the built-in AI Chat panel — which is what the
|
|
8888
|
+
// "Create project & start chat" flow does for you the moment a drawing set is uploaded.
|
|
8889
|
+
// 'discussion' means a conversation is merely open, so the handoff is still the user's to make.
|
|
8890
|
+
const readRunsInChat = (req) => req?.chatConversation?.executionOwner === 'chat';
|
|
8891
|
+
// …and ownership NEVER expires, so it cannot answer "is it working right now". A conversation
|
|
8892
|
+
// that finished, failed or was interrupted still owns its request, and a card reading ownership
|
|
8893
|
+
// alone would go on claiming motion nothing can see — the same misleading-instruction defect this
|
|
8894
|
+
// wording exists to remove, just relocated. The conversation's own state is the part that moves.
|
|
8895
|
+
// An unrecognised state (an older or newer build) counts as NOT working: the paused wording is
|
|
8896
|
+
// always safe to show, the running wording is not.
|
|
8897
|
+
// WORKING means the conversation is moving on its own. `awaiting-approval` and `recovery` are NOT
|
|
8898
|
+
// that, and putting them here was the same defect this wording exists to remove: a chat that has
|
|
8899
|
+
// STOPPED and is waiting on the person, described to that person as "nothing to do here".
|
|
8900
|
+
// awaiting-approval — the turn is parked on an approval only they can answer (chat-coordinator
|
|
8901
|
+
// patches the active turn to it and renders a decision card); the Tekla model read always
|
|
8902
|
+
// raises one, so this is the common case, not the exotic one.
|
|
8903
|
+
// recovery — the turn broke. AI Chat disables its own composer, shows a recovery control, and
|
|
8904
|
+
// `turnIsVisiblyActive` returns false for it; ensureRequestChatLink refuses to link a Request
|
|
8905
|
+
// to a chat in this state at all. Nothing will ever move it except the user.
|
|
8906
|
+
// They get their own wording because their ACTIONS differ, so they cannot share a sentence.
|
|
8907
|
+
const CHAT_WORKING_STATES = ['starting', 'running'];
|
|
8908
|
+
const CHAT_BLOCKED_ACTIONS = { 'awaiting-approval': 'answer the question it is waiting on', recovery: 'use its recovery control' };
|
|
8909
|
+
const readChatState = (req) => (readRunsInChat(req) ? req?.chatConversation?.chatState ?? null : null);
|
|
8910
|
+
const readWorkingInChat = (req) => CHAT_WORKING_STATES.includes(readChatState(req));
|
|
8911
|
+
const readChatBlockedAction = (req) => CHAT_BLOCKED_ACTIONS[readChatState(req)] || '';
|
|
8912
|
+
// The conversation exists but the server could not read it. Saying "it is paused, go continue it"
|
|
8913
|
+
// here sends the user to open the very conversation the server just failed to read.
|
|
8914
|
+
const readChatUnreadable = (req) => readChatState(req) === 'unreadable';
|
|
8915
|
+
// BUSY WITH SOMETHING ELSE is a third honest answer, and it exists because one conversation can
|
|
8916
|
+
// hold several Requests (`startRequest` reuses the selected chat when it is idle) and the person
|
|
8917
|
+
// can ask it anything else at any time. The conversation is moving, but not on THIS read, so
|
|
8918
|
+
// neither of the other two answers is true — "running" claims motion this request is not getting,
|
|
8919
|
+
// and "tell it to continue" cannot be done yet: Send is disabled while any reply is in flight. Nor
|
|
8920
|
+
// is the read QUEUED behind that reply — a read's own turn never waits in line (acceptTurn refuses
|
|
8921
|
+
// a second active turn), so when the other reply finishes nothing picks the read up. The person
|
|
8922
|
+
// has to wait for it, then tell AI Chat to continue (#1610). And FloLess cannot tell WHAT that
|
|
8923
|
+
// reply is about: a message the person typed — including "continue the drawing read", the very
|
|
8924
|
+
// instruction these cards give — is not provably this read's, so the wording must hold for both
|
|
8925
|
+
// a reply that is continuing the read and one about something else.
|
|
8926
|
+
const readChatBusyElsewhere = (req) => readChatState(req) === 'busy-elsewhere';
|
|
8927
|
+
// ARCHIVED IS NOT PAUSED: AI Chat disables an archived conversation's composer, so "tell it to
|
|
8928
|
+
// continue" cannot be carried out until the user restores it. The guidance names the restore.
|
|
8929
|
+
const readChatArchived = (req) => readChatState(req) === 'archived';
|
|
8930
|
+
// FAILED AND INTERRUPTED ARE NOT "PAUSED" (#1611). Both used to fall into the stopped bucket and
|
|
8931
|
+
// read as "paused … tell it to continue", which is softer than the truth: a failed reply ended with
|
|
8932
|
+
// an error the person should look at before asking again, and an interrupted one stopped before it
|
|
8933
|
+
// finished. The composer stays usable after either, so each names its own next step.
|
|
8934
|
+
const readChatFailed = (req) => readChatState(req) === 'failed';
|
|
8935
|
+
const readChatInterrupted = (req) => readChatState(req) === 'interrupted';
|
|
8936
|
+
// WHERE AI CHAT IS. The left panel can be collapsed (persisted, and the default on touch), and then
|
|
8937
|
+
// no panel called AI Chat is on screen — "open the AI Chat panel on the left and …" was an
|
|
8938
|
+
// instruction a person could not follow without first doing a step it never named (#1611). One
|
|
8939
|
+
// phrase, true in both layouts, used by every instruction that sends someone to AI Chat.
|
|
8940
|
+
const OPEN_AI_CHAT = 'Open AI Chat on the left (expand that panel if it is collapsed)';
|
|
8941
|
+
// Name the session the user has to go back to. Every "return to the terminal AI that prepared
|
|
8942
|
+
// it" line is wrong for a read AI Chat started, and sending someone to a terminal that is not
|
|
8943
|
+
// doing the work is the same defect as telling them to start a read that is already running.
|
|
8944
|
+
const readSessionName = (req) => readRunsInChat(req) ? 'AI Chat conversation' : 'terminal AI session';
|
|
8683
8945
|
function isRevisionStale(req) {
|
|
8684
8946
|
return !!req && Number.isInteger(req.baseVersion) && Number.isInteger(req.headVersion)
|
|
8685
8947
|
&& req.baseVersion !== req.headVersion;
|
|
@@ -8693,9 +8955,20 @@
|
|
|
8693
8955
|
return req.status === 'staged' && req.steelAuditPolicy === 1;
|
|
8694
8956
|
}
|
|
8695
8957
|
function stopRevisionPoll() { if (revisionPoll) { clearInterval(revisionPoll); revisionPoll = null; } }
|
|
8958
|
+
// A tick is SKIPPED while the previous poll is still out, never stacked behind it (#1604). Each render
|
|
8959
|
+
// reads /api/requests, which can outlast this 3-second interval on a busy machine; stacking one per
|
|
8960
|
+
// tick held more and more of the browser's ~6 connections to this server until AI Chat and every
|
|
8961
|
+
// other request queued behind them. Only the poll is gated: a render started by a user action still
|
|
8962
|
+
// runs at once.
|
|
8963
|
+
let revisionPollInFlight = false;
|
|
8696
8964
|
function startRevisionPoll() {
|
|
8697
8965
|
stopRevisionPoll();
|
|
8698
|
-
revisionPoll = setInterval(() => {
|
|
8966
|
+
revisionPoll = setInterval(() => {
|
|
8967
|
+
if (!current) { stopRevisionPoll(); return; }
|
|
8968
|
+
if (revisionPollInFlight) return;
|
|
8969
|
+
revisionPollInFlight = true;
|
|
8970
|
+
renderRevisionCard().finally(() => { revisionPollInFlight = false; });
|
|
8971
|
+
}, 3000);
|
|
8699
8972
|
}
|
|
8700
8973
|
const revEl = (tag, cls, text) => {
|
|
8701
8974
|
const e = document.createElement(tag);
|
|
@@ -8785,7 +9058,7 @@
|
|
|
8785
9058
|
const dot = revEl('span', 'wrc-dot'); dot.setAttribute('aria-hidden', 'true');
|
|
8786
9059
|
const txt = revEl('span', 'wrc-text');
|
|
8787
9060
|
txt.appendChild(revEl('b', null, 'Drawing preparation is complete and saved.'));
|
|
8788
|
-
txt.appendChild(document.createTextNode(
|
|
9061
|
+
txt.appendChild(document.createTextNode(` Return to the same ${readSessionName(req)} and tell it to continue creating the Drawing Filter. Do not start or copy this request again.`));
|
|
8789
9062
|
return [dot, txt];
|
|
8790
9063
|
}
|
|
8791
9064
|
if (req.filterSaveContinuation?.state === 'recovery-needed') {
|
|
@@ -8823,12 +9096,31 @@
|
|
|
8823
9096
|
const txt = revEl('span', 'wrc-text');
|
|
8824
9097
|
const active = runState === 'queued' || runState === 'running';
|
|
8825
9098
|
txt.appendChild(revEl('b', null, active ? 'Retrying Steel Filter preparation.' : 'Steel Filter preparation was interrupted.'));
|
|
9099
|
+
// CHAT OWNERSHIP IS CHECKED FIRST, ahead of `canRun`. `canRun` is server policy about whether
|
|
9100
|
+
// FloLess *could* start a headless retry; it stays true while AI Chat holds the request, and
|
|
9101
|
+
// the Requests row withholds Retry preparation from a chat-owned row exactly as it withholds
|
|
9102
|
+
// Copy. Reading `canRun` first therefore named a button that is not on screen — the one class
|
|
9103
|
+
// of instruction this work exists to remove.
|
|
9104
|
+
//
|
|
9105
|
+
// And a conversation stalled on the person, or one FloLess cannot read, cannot be asked to
|
|
9106
|
+
// retry: "ask that conversation to retry" is unfollowable until the user unblocks it. Those
|
|
9107
|
+
// two states name their own action instead, the same three buckets the rest of this file uses.
|
|
9108
|
+
const chatBlocked = readChatBlockedAction(req);
|
|
8826
9109
|
txt.appendChild(document.createTextNode(active
|
|
8827
9110
|
? ' FloLess is continuing this same request with the attached drawings.'
|
|
9111
|
+
: readChatUnreadable(req)
|
|
9112
|
+
? ` Your drawings are still attached, but FloLess cannot read the AI Chat conversation that holds this request. ${OPEN_AI_CHAT} to check it. If it will not open, use Report an issue.`
|
|
9113
|
+
: chatBlocked
|
|
9114
|
+
? ` Your drawings are still attached. The AI Chat conversation that holds this request is waiting for you. ${OPEN_AI_CHAT} and ${chatBlocked}, then ask it to retry preparation.`
|
|
9115
|
+
: readRunsInChat(req)
|
|
9116
|
+
? ` Your drawings are still attached. ${OPEN_AI_CHAT} and ask that conversation to retry preparation for this same request.`
|
|
8828
9117
|
: req.canRun
|
|
8829
9118
|
? ' Your drawings are still attached. Open Requests and choose Retry preparation to continue this same request.'
|
|
8830
|
-
:
|
|
8831
|
-
|
|
9119
|
+
: ` Your drawings are still attached. Return to the same ${readSessionName(req)} and retry preparation for this same request, or copy the retry request from here.`));
|
|
9120
|
+
// No Copy when AI Chat owns the request, for the same reason the pending branch withholds it:
|
|
9121
|
+
// a second handoff cannot help while the first one holds the request, and pasting it into a
|
|
9122
|
+
// terminal is how two writers end up in one project folder.
|
|
9123
|
+
if (!active && !req.canRun && !readRunsInChat(req)) {
|
|
8832
9124
|
const copy = revEl('button', 'btn-mini', '⧉ Copy retry');
|
|
8833
9125
|
copy.type = 'button'; copy.dataset.revcopy = ''; copy.dataset.commandId = 'shell.revision-request-copy';
|
|
8834
9126
|
copy.setAttribute('data-tip', 'Copy the retained request to retry preparation');
|
|
@@ -8849,17 +9141,58 @@
|
|
|
8849
9141
|
txt.appendChild(document.createTextNode(` Your terminal AI is preparing ${n} file${n > 1 ? 's' : ''}. Leave FloLess open — you can keep working elsewhere in it. Progress and what to do next appear here. Open Requests if you need to stop it.`));
|
|
8850
9142
|
return [dot, txt];
|
|
8851
9143
|
}
|
|
9144
|
+
// AI CHAT ALREADY HAS IT. The "Create project & start chat" flow hands the first read straight to
|
|
9145
|
+
// the AI Chat panel on the left, so the handoff copy below — the whole point of which is to tell
|
|
9146
|
+
// someone to start a read — describes work that is already happening. Like the background-run
|
|
9147
|
+
// branch above, this offers NO Copy: a second handoff is not a useful fallback while the first
|
|
9148
|
+
// one is active, and here it would also try to take a request AI Chat owns. Ownership alone does
|
|
9149
|
+
// not prove motion (readWorkingInChat), so a stopped conversation gets the wording that asks the
|
|
9150
|
+
// user to continue it rather than a claim of progress nothing can see.
|
|
9151
|
+
if (readRunsInChat(req)) {
|
|
9152
|
+
const dot = revEl('span', 'wrc-dot'); dot.setAttribute('aria-hidden', 'true');
|
|
9153
|
+
const txt = revEl('span', 'wrc-text');
|
|
9154
|
+
const blockedAction = readChatBlockedAction(req);
|
|
9155
|
+
const lead = readWorkingInChat(req) ? 'running in AI Chat'
|
|
9156
|
+
: blockedAction ? 'waiting for you in AI Chat'
|
|
9157
|
+
: readChatUnreadable(req) ? 'in an AI Chat conversation FloLess cannot read'
|
|
9158
|
+
: readChatArchived(req) ? 'in an archived AI Chat conversation'
|
|
9159
|
+
: readChatBusyElsewhere(req) ? 'waiting on a reply in AI Chat'
|
|
9160
|
+
: readChatFailed(req) ? 'stopped by an error in AI Chat'
|
|
9161
|
+
: readChatInterrupted(req) ? 'interrupted in AI Chat'
|
|
9162
|
+
: 'paused in AI Chat';
|
|
9163
|
+
txt.appendChild(revEl('b', null, `${isInitialRevisionRead(req) ? 'Initial' : 'Updated'} drawing read is ${lead}.`));
|
|
9164
|
+
txt.appendChild(document.createTextNode(readWorkingInChat(req)
|
|
9165
|
+
? ` AI Chat on the left is reading ${n} file${n > 1 ? 's' : ''}. There is nothing to do here — leave FloLess open. Larger drawing sets take longer; FloLess updates this card when the Drawing Filter is ready for your review.`
|
|
9166
|
+
: blockedAction
|
|
9167
|
+
? ` Your drawings are still attached. ${OPEN_AI_CHAT} and ${blockedAction}; the read continues once you do.`
|
|
9168
|
+
: readChatUnreadable(req)
|
|
9169
|
+
? ` Your drawings are still attached. ${OPEN_AI_CHAT} to check that conversation. If it will not open, use Report an issue — FloLess could not read it.`
|
|
9170
|
+
: readChatArchived(req)
|
|
9171
|
+
? ` Your drawings are still attached. ${OPEN_AI_CHAT} and restore that conversation — its composer stays disabled while it is archived — then tell it to continue the drawing read.`
|
|
9172
|
+
: readChatBusyElsewhere(req)
|
|
9173
|
+
? ' Your drawings are still attached. If you already asked AI Chat to continue, this card updates as the read moves forward. If not, tell it to continue once the current reply is done — the read will not resume on its own.'
|
|
9174
|
+
: readChatFailed(req)
|
|
9175
|
+
? ` Your drawings are still attached, but AI Chat’s last reply ended with an error. ${OPEN_AI_CHAT} to see what went wrong, then ask it to try the drawing read again.`
|
|
9176
|
+
: readChatInterrupted(req)
|
|
9177
|
+
? ` Your drawings are still attached, but AI Chat’s reply stopped before it finished. ${OPEN_AI_CHAT} and tell it to continue the drawing read.`
|
|
9178
|
+
: ` Your drawings are still attached, but AI Chat is not working on them right now. ${OPEN_AI_CHAT} and tell it to continue the drawing read.`));
|
|
9179
|
+
return [dot, txt];
|
|
9180
|
+
}
|
|
8852
9181
|
// `pending` means the request is waiting for the terminal AI handoff; it does not prove that an
|
|
8853
9182
|
// AI is actively reading. A spinner made a pasted instruction look like an already-running job.
|
|
8854
9183
|
const dot = revEl('span', 'wrc-dot'); dot.setAttribute('aria-hidden', 'true');
|
|
8855
9184
|
const txt = revEl('span', 'wrc-text');
|
|
8856
9185
|
txt.appendChild(revEl('b', null, `${isInitialRevisionRead(req) ? 'Initial' : 'Updated'} drawing read is waiting for your terminal AI.`));
|
|
8857
9186
|
// Runtime discovery belongs to the Requests surface, not this workspace card. `canRun` is only
|
|
8858
|
-
// server policy; it does not prove that a supported terminal AI is installed on this machine
|
|
8859
|
-
//
|
|
9187
|
+
// server policy; it does not prove that a supported terminal AI is installed on this machine, and
|
|
9188
|
+
// Start in AI Chat needs a signed-in chat provider plus a request in chat scope. So BOTH halves
|
|
9189
|
+
// name their control conditionally — "if it is shown, choose it" is true either way and never
|
|
9190
|
+
// points at a hidden one. The terminal is one route among them, not the only instruction.
|
|
9191
|
+
// OpenCode is deliberately absent: FloLess cannot run it, so naming it as a destination sends
|
|
9192
|
+
// people to a terminal that will not be able to finish the read.
|
|
8860
9193
|
const handoff = !isInitialRevisionRead(req) && req.canRun
|
|
8861
|
-
? 'Open Requests. If Start automatically is shown, choose it; otherwise copy the request into Claude Code
|
|
8862
|
-
: 'Open Requests
|
|
9194
|
+
? 'Open Requests. If Start automatically is shown, choose it; otherwise copy the request into Claude Code or Codex.'
|
|
9195
|
+
: 'Open Requests. If Start in AI Chat is shown, choose it; otherwise copy the request into Claude Code or Codex.';
|
|
8863
9196
|
// No numeric cap. "up to 30 minutes" was a promise this card cannot keep: the read runs in
|
|
8864
9197
|
// someone else's terminal AI over a drawing set whose size we do not bound, and a stated
|
|
8865
9198
|
// ceiling that is routinely blown past reads as a stall or a hang rather than as normal work.
|
|
@@ -8988,7 +9321,10 @@
|
|
|
8988
9321
|
// to remove, and enough to fail the console-clean bar every E2E is held to. Silence was still
|
|
8989
9322
|
// wrong (a stuck card had no trace at all), so the first failure speaks and the recovery resets it.
|
|
8990
9323
|
try {
|
|
8991
|
-
|
|
9324
|
+
// Bounded (#1604): the poll skips its ticks while this is out, so a read that never answered
|
|
9325
|
+
// would stop the card for good. 90 s, like the Requests window: the route's own lock waits
|
|
9326
|
+
// give up after 60 s.
|
|
9327
|
+
const b = await api('/api/requests', { signal: AbortSignal.timeout(90_000) });
|
|
8992
9328
|
reqs = Array.isArray(b) ? b : (b.requests || []);
|
|
8993
9329
|
// Every owned success is fresh evidence of server contact, even if a later-started poll is in
|
|
8994
9330
|
// flight or has failed. The route can legitimately outlast the 3-second polling interval.
|
|
@@ -9132,6 +9468,14 @@
|
|
|
9132
9468
|
if (retireRevisionCardForStrip(pending)) return;
|
|
9133
9469
|
const cardKey = `${state}:${revCardReq ? revCardReq.id : ''}:${pending && pending.filterCheckpointCurrent ? 'filter-saved' : pending && pending.prepassReady ? 'filter-ready' : 'read-pending'}:${pending && pending.run ? pending.run.state || '' : ''}`
|
|
9134
9470
|
+ (pending ? `:${pending.preparationState || ''}:${pending.preparationRetryable === true}:${pending.canRun === true}:${pending.canCopy === true}:${pending.canClear === true}:${pending.clearWhy || ''}:${pending.filterSaveContinuation?.state || ''}:${pending.filterSaveContinuation?.nextAction || ''}` : '')
|
|
9471
|
+
// WHO IS DRIVING THE READ, and whether that conversation is working, both change the card's
|
|
9472
|
+
// words AND whether it offers Copy — and neither is implied by any field above. Without them
|
|
9473
|
+
// the three-second poll short-circuits on an unchanged key, so a read that AI Chat picks up
|
|
9474
|
+
// keeps its "… drawing read is waiting for your terminal AI." card indefinitely while the
|
|
9475
|
+
// banner two lines up already says the read is running in AI Chat. Measured in a real browser.
|
|
9476
|
+
// (`applyStageGating()` still runs on the short-circuit path, which is why only one of the two
|
|
9477
|
+
// surfaces went stale — and why the contradiction was visible at all.)
|
|
9478
|
+
+ `:${revCardReq?.chatConversation?.executionOwner || ''}:${revCardReq?.chatConversation?.chatState || ''}`
|
|
9135
9479
|
+ (staged ? `:${staged.baseVersion}:${staged.headVersion}:${staged.stageId || ''}:${staged.canDiscardRevision === true}:${staged.discardState || ''}:${staged.discardWhy || ''}:${staged.canClear === true}:${staged.clearWhy || ''}:${unavailableRevisionReviewStages.has(staged.stageId)}` : '');
|
|
9136
9480
|
// The key below exists to preserve focus in the card across the three-second poll. It says
|
|
9137
9481
|
// nothing about the strip, whose progress record advances on its own revision, so the strip is
|