@floless/app 0.169.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/dist/floless-server.cjs +71580 -59849
- 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-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/web/agent-steps.js +89 -18
- package/dist/web/agents.js +32 -22
- package/dist/web/app.css +223 -1
- package/dist/web/app.js +24 -3
- package/dist/web/aware.js +877 -189
- package/dist/web/chat.js +184 -95
- package/dist/web/checkpoint-standard.js +5 -3
- package/dist/web/commands-drawing-check.js +1 -0
- package/dist/web/commands-shell.js +440 -11
- package/dist/web/commands-steel.js +60 -1
- package/dist/web/drawing-check-editor.js +352 -88
- package/dist/web/failure-copy.js +32 -2
- package/dist/web/filter-ai-proposal.js +11 -8
- package/dist/web/flo-3d.js +1 -1
- package/dist/web/guide.js +33 -26
- package/dist/web/index.html +69 -1
- package/dist/web/instructor.js +99 -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-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/origin-rule.js +155 -0
- package/dist/web/project-access.js +1 -1
- package/dist/web/project-modules.js +2 -2
- package/dist/web/project-rfis.js +6 -1
- package/dist/web/project-workflows.js +2 -2
- package/dist/web/revit-editor.js +22 -8
- package/dist/web/run-history.js +12 -1
- package/dist/web/steel-3d-core.js +39 -9
- package/dist/web/steel-3d-flo.js +26 -4
- package/dist/web/steel-3d-view.js +8 -3
- package/dist/web/steel-ai-marks.js +3 -1
- package/dist/web/steel-editor.html +455 -122
- 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 +1 -1
- package/dist/web/tool-updates.js +7 -6
- package/dist/web/workspaces.js +1714 -119
- package/package.json +4 -1
package/dist/web/left-pane.js
CHANGED
|
@@ -1147,7 +1147,10 @@
|
|
|
1147
1147
|
.find((row) => !pending.seenPaths.has(row.dataset.occurrencePath));
|
|
1148
1148
|
firstNew?.focus();
|
|
1149
1149
|
}
|
|
1150
|
-
|
|
1150
|
+
// #3097: the frame's `message` is not thrown text: model-panel-bridge.js writes every one as a fixed sentence for
|
|
1151
|
+
// the person ("That model group has changed. Try opening it again.").
|
|
1152
|
+
const frameSentence = typeof data.message === 'string' ? data.message : '';
|
|
1153
|
+
if (!data.ok) status.textContent = frameSentence || 'That model action is no longer available.';
|
|
1151
1154
|
// The frame stays empty, so say so where the tab would be — for the tab still shown, not an earlier one.
|
|
1152
1155
|
if (pending?.kind === 'panel' && !data.ok && pending.key === panelShown) {
|
|
1153
1156
|
panelShown = null;
|
|
@@ -41,12 +41,13 @@
|
|
|
41
41
|
});
|
|
42
42
|
} catch (error) {
|
|
43
43
|
if (error.name === 'AbortError') throw error;
|
|
44
|
-
throw new Error('FloLess could not reach the local scan. Check that FloLess is open, then try again.');
|
|
44
|
+
throw Object.assign(new Error('FloLess could not reach the local scan. Check that FloLess is open, then try again.'), { forPerson: true });
|
|
45
45
|
}
|
|
46
46
|
const data = await response.json().catch(() => ({}));
|
|
47
47
|
if (!response.ok || !data.ok) {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
// #3097: the reply rides on the error, so errorText works the sentence out from it (personText, else the shared
|
|
49
|
+
// sentence) and a reply marked diagnostic never reaches the status line.
|
|
50
|
+
const error = Object.assign(new Error('local discovery request refused'), { status: response.status, body: data });
|
|
50
51
|
error.code = data.code;
|
|
51
52
|
error.expiredSelectionIds = Array.isArray(data.expiredSelectionIds) ? data.expiredSelectionIds : null;
|
|
52
53
|
throw error;
|
|
@@ -126,8 +127,8 @@
|
|
|
126
127
|
resetResults();
|
|
127
128
|
status.textContent = 'Scope changed. Scan again to see current findings.';
|
|
128
129
|
} catch (error) {
|
|
129
|
-
status.textContent = error
|
|
130
|
-
|
|
130
|
+
status.textContent = errorText(error, { action: 'remove this folder from the next scan',
|
|
131
|
+
unsure: 'It is still listed, so try Remove again.' });
|
|
131
132
|
}
|
|
132
133
|
}));
|
|
133
134
|
row.append(remove);
|
|
@@ -431,7 +432,7 @@
|
|
|
431
432
|
paintFolders();
|
|
432
433
|
status.textContent = 'Expired folder choices were removed. Scan again, or add those folders again.';
|
|
433
434
|
} else if (error.name !== 'AbortError' && generation === scanGeneration) {
|
|
434
|
-
status.textContent = error
|
|
435
|
+
status.textContent = errorText(error, { action: 'check those locations', retrySafe: true });
|
|
435
436
|
}
|
|
436
437
|
} finally {
|
|
437
438
|
if (generation === scanGeneration) { scanController = null; setBusy(false); }
|
|
@@ -451,7 +452,7 @@
|
|
|
451
452
|
resetResults();
|
|
452
453
|
status.textContent = 'Folder added to the next scan. Up to three selected folders can be included. No scan has started.';
|
|
453
454
|
}
|
|
454
|
-
} catch (error) { status.textContent = error
|
|
455
|
+
} catch (error) { status.textContent = errorText(error, { action: 'choose that folder', unsure: 'Check the folder list, or try another local folder.' }); }
|
|
455
456
|
}));
|
|
456
457
|
scanButton.addEventListener('click', scan);
|
|
457
458
|
filterInput.addEventListener('input', () => { page = 0; paintPage(); });
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/* Routines that missed their time while FloLess was closed (owner ruling 2026-11-06, plan
|
|
2
|
+
* docs/superpowers/specs/2026-11-06-missed-routine-catch-up-offer-plan.md).
|
|
3
|
+
*
|
|
4
|
+
* The server keeps ONE open question per routine (`missedOffer` on GET /api/routines), however many times it was missed.
|
|
5
|
+
* This is the card that asks it, bottom right, always one card: one routine reads "Run now / Skip"; two or more get a
|
|
6
|
+
* tick box each (none ticked — a run can write to a model or use an AI subscription, so running is always a choice),
|
|
7
|
+
* "Run selected (n)" and "Skip all". Nothing runs on its own. Run goes through the routine's own run route (every gate
|
|
8
|
+
* applies) and names the question it answers, so a second tab cannot answer it twice. × is "Later": the card stays away
|
|
9
|
+
* in this tab until another routine misses its time; Routines says what still waits and reopens it. The card stays out
|
|
10
|
+
* of the way of any open dialog.
|
|
11
|
+
*
|
|
12
|
+
* aware.js hands every routines list it loads to `update()`; this module renders only.
|
|
13
|
+
*/
|
|
14
|
+
(() => {
|
|
15
|
+
const state = {
|
|
16
|
+
offers: [], // [{ routineId, offerId, name, first, last, count, atLeast, starting, ai }]
|
|
17
|
+
ticked: new Set(), // offer ids
|
|
18
|
+
later: new Set(), // offer ids the person set aside in this tab
|
|
19
|
+
answered: new Set(), // offer ids answered from this tab (their leaving needs no note)
|
|
20
|
+
busy: false,
|
|
21
|
+
ctx: null, // { api, reportErr, reload }
|
|
22
|
+
};
|
|
23
|
+
let card = null;
|
|
24
|
+
|
|
25
|
+
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
26
|
+
const toast = (text, kind) => { if (typeof showToast === 'function') showToast(text, kind); };
|
|
27
|
+
const AI_TIP = 'Runs an AI agent and uses your AI subscription';
|
|
28
|
+
const BUSY_REASON = 'Sending your answer. This works again in a moment.';
|
|
29
|
+
// While an answer is on its way every control waits, and says why.
|
|
30
|
+
const busyAttr = () => (state.busy ? `disabled data-blocked-reason="${BUSY_REASON}"` : '');
|
|
31
|
+
|
|
32
|
+
/** "07:00", plus the day when it was not today — the person's own clock, as the routine's runs say it. */
|
|
33
|
+
function clock(iso) {
|
|
34
|
+
const at = new Date(iso);
|
|
35
|
+
if (Number.isNaN(at.getTime())) return '';
|
|
36
|
+
const hm = `${String(at.getHours()).padStart(2, '0')}:${String(at.getMinutes()).padStart(2, '0')}`;
|
|
37
|
+
if (at.toDateString() === new Date().toDateString()) return hm;
|
|
38
|
+
return `${hm} on ${at.toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short' })}`;
|
|
39
|
+
}
|
|
40
|
+
const why = (o) => (o.starting ? 'FloLess was still starting up' : 'FloLess was closed');
|
|
41
|
+
const times = (o) => `${o.atLeast ? 'at least ' : ''}${o.count} times`;
|
|
42
|
+
function rowSub(o) {
|
|
43
|
+
// Past the count cap the last time is only where counting stopped, so the row says since when instead.
|
|
44
|
+
if (o.atLeast) return `Missed ${times(o)} since ${clock(o.first)}`;
|
|
45
|
+
return o.count === 1 ? `Missed at ${clock(o.last)}` : `Missed ${times(o)}, last at ${clock(o.last)}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The open questions in a routines list: a schedule routine that would still run (on, not broken, agent not held). */
|
|
49
|
+
function offersOf(routines) {
|
|
50
|
+
return (Array.isArray(routines) ? routines : []).flatMap((r) => {
|
|
51
|
+
const o = r && r.missedOffer;
|
|
52
|
+
if (!o || r.kind === 'trigger' || !r.enabled || r.broken || r.agentHold) return [];
|
|
53
|
+
return [{ routineId: r.id, offerId: o.id, name: r.name || r.id, first: o.first, last: o.last, count: o.count,
|
|
54
|
+
atLeast: o.atLeast === true, starting: o.starting === true, ai: !!r.agent || r.aiStep === true }];
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function update(routines, ctx) {
|
|
59
|
+
if (ctx) state.ctx = ctx;
|
|
60
|
+
const next = offersOf(routines);
|
|
61
|
+
const nextIds = new Set(next.map((o) => o.offerId));
|
|
62
|
+
// A question that left on its own while the card showed it says so — without claiming it ran: it may have run on
|
|
63
|
+
// its schedule, been switched off, or been answered in another tab.
|
|
64
|
+
if (card && !card.hidden) {
|
|
65
|
+
const gone = state.offers.filter((o) => !nextIds.has(o.offerId) && !state.answered.has(o.offerId)
|
|
66
|
+
&& !next.some((n) => n.routineId === o.routineId));
|
|
67
|
+
for (const o of gone) toast(`“${o.name}” is no longer waiting for an answer: it ran on its schedule, was switched off or was answered elsewhere.`, 'info');
|
|
68
|
+
}
|
|
69
|
+
state.offers = next;
|
|
70
|
+
for (const id of [...state.ticked]) if (!nextIds.has(id)) state.ticked.delete(id);
|
|
71
|
+
render();
|
|
72
|
+
paintRoutinesNote();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function visibleOffers() { return state.offers.filter((o) => !state.later.has(o.offerId)); }
|
|
76
|
+
|
|
77
|
+
function ensureCard() {
|
|
78
|
+
if (card && card.isConnected) return card;
|
|
79
|
+
const container = document.getElementById('toast-container');
|
|
80
|
+
if (!container) return null;
|
|
81
|
+
card = document.createElement('section');
|
|
82
|
+
card.className = 'toast warn missed-card';
|
|
83
|
+
card.id = 'missed-routines-card';
|
|
84
|
+
card.setAttribute('role', 'region');
|
|
85
|
+
card.setAttribute('aria-label', 'Routines that missed their time');
|
|
86
|
+
card.hidden = true;
|
|
87
|
+
card.addEventListener('click', onClick);
|
|
88
|
+
card.addEventListener('change', onChange);
|
|
89
|
+
container.prepend(card);
|
|
90
|
+
return card;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function render() {
|
|
94
|
+
// Shown while at least one question has not been set aside; once shown, it lists every open one.
|
|
95
|
+
const show = visibleOffers().length > 0;
|
|
96
|
+
const offers = state.offers;
|
|
97
|
+
if (!show) { if (card) { card.hidden = true; card.innerHTML = ''; } return; }
|
|
98
|
+
const el = ensureCard();
|
|
99
|
+
if (!el) return;
|
|
100
|
+
// A repaint keeps the person's place: focus goes back to the same control (same command, same routine). When that
|
|
101
|
+
// control is gone — the card changed shape — it goes to Later, never to a different action a keypress would start.
|
|
102
|
+
const focusables = () => [...el.querySelectorAll('button, input, [tabindex="0"]')];
|
|
103
|
+
const keyOf = (node) => `${node.getAttribute('data-command-id') || ''}|${node.getAttribute('data-offer') || ''}`;
|
|
104
|
+
const hadFocus = el.contains(document.activeElement) ? keyOf(document.activeElement) : null;
|
|
105
|
+
el.hidden = false;
|
|
106
|
+
el.classList.toggle('busy', state.busy);
|
|
107
|
+
el.innerHTML = offers.length === 1 ? singleHtml(offers[0]) : manyHtml(offers);
|
|
108
|
+
if (hadFocus !== null) {
|
|
109
|
+
const list = focusables();
|
|
110
|
+
(list.find((node) => keyOf(node) === hadFocus && !node.disabled) || el.querySelector('[data-missed="later"]'))?.focus();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const laterButton = () => '<button type="button" class="toast-close missed-later" data-missed="later" data-command-id="shell.missed-routines-later" aria-label="Later" data-tip="Later. Nothing runs; Routines keeps these waiting for your answer.">×</button>';
|
|
115
|
+
const aiPill = (o) => (o.ai ? `<span class="ai-pill" tabindex="0" data-tip="${esc(AI_TIP)}">AI</span>` : '');
|
|
116
|
+
|
|
117
|
+
function singleHtml(o) {
|
|
118
|
+
const what = o.count === 1
|
|
119
|
+
? `didn’t run at ${esc(clock(o.last))} because ${why(o)}.`
|
|
120
|
+
: o.atLeast
|
|
121
|
+
? `missed ${esc(times(o))} since ${esc(clock(o.first))}, because ${why(o)}. It runs once.`
|
|
122
|
+
: `missed ${esc(times(o))}, the last at ${esc(clock(o.last))}, because ${why(o)}. It runs once.`;
|
|
123
|
+
return `
|
|
124
|
+
<div class="missed-head"><span class="missed-title">A routine missed its time</span>${laterButton()}</div>
|
|
125
|
+
<p class="missed-text"><strong>${esc(o.name)}</strong>${aiPill(o)} ${what} Run it now?</p>
|
|
126
|
+
${o.ai ? `<p class="missed-foot">${esc(AI_TIP)}.</p>` : ''}
|
|
127
|
+
<div class="missed-actions">
|
|
128
|
+
<button type="button" class="toast-action missed-primary" data-missed="run-one" data-command-id="shell.missed-routines-run" ${busyAttr()}>Run now</button>
|
|
129
|
+
<button type="button" class="toast-action" data-missed="skip-one" data-command-id="shell.missed-routines-skip" ${busyAttr()}>Skip</button>
|
|
130
|
+
</div>`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function manyHtml(offers) {
|
|
134
|
+
const n = state.ticked.size;
|
|
135
|
+
const all = n === offers.length;
|
|
136
|
+
const anyStarting = offers.some((o) => o.starting);
|
|
137
|
+
const aiTicked = offers.some((o) => o.ai && state.ticked.has(o.offerId));
|
|
138
|
+
const blocked = state.busy ? BUSY_REASON : n === 0 ? 'Tick the routines you want to run first.' : '';
|
|
139
|
+
const rows = offers.map((o) => `
|
|
140
|
+
<label class="missed-row">
|
|
141
|
+
<input type="checkbox" class="missed-pick" data-offer="${esc(o.offerId)}" data-command-id="shell.missed-routines-pick#${esc(o.routineId)}" data-command-instance-label="${esc(o.name)}" ${state.ticked.has(o.offerId) ? 'checked' : ''} ${busyAttr()}>
|
|
142
|
+
<span class="missed-row-main"><span class="missed-row-name">${esc(o.name)}</span>${aiPill(o)}<span class="missed-row-sub">${esc(rowSub(o))}</span></span>
|
|
143
|
+
</label>`).join('');
|
|
144
|
+
return `
|
|
145
|
+
<div class="missed-head"><span class="missed-title">${offers.length} routines missed their time</span>${laterButton()}</div>
|
|
146
|
+
<p class="missed-text">${anyStarting ? 'FloLess was closed or still starting up' : 'FloLess was closed'}, so nothing ran. Choose what to run now; each runs once.</p>
|
|
147
|
+
<div class="missed-select"><button type="button" class="rtn-link" data-missed="select-all" data-command-id="shell.missed-routines-select-all" ${busyAttr()}>${all ? 'Clear all' : 'Select all'}</button></div>
|
|
148
|
+
<div class="missed-list">${rows}</div>
|
|
149
|
+
${aiTicked ? '<p class="missed-foot">AI routines use your AI subscription.</p>' : ''}
|
|
150
|
+
<div class="missed-actions">
|
|
151
|
+
<button type="button" class="toast-action missed-primary" data-missed="run-selected" data-command-id="shell.missed-routines-run-selected"${n === 0 || state.busy ? ' disabled' : ''}${blocked ? ` data-blocked-reason="${esc(blocked)}" data-tip="${esc(blocked)}"` : ''}>Run selected (${n})</button>
|
|
152
|
+
<button type="button" class="toast-action" data-missed="skip-all" data-command-id="shell.missed-routines-skip-all" ${busyAttr()}>Skip all</button>
|
|
153
|
+
</div>`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function onChange(event) {
|
|
157
|
+
const box = event.target.closest('.missed-pick');
|
|
158
|
+
if (!box) return;
|
|
159
|
+
if (box.checked) state.ticked.add(box.dataset.offer); else state.ticked.delete(box.dataset.offer);
|
|
160
|
+
render();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function onClick(event) {
|
|
164
|
+
const button = event.target.closest('[data-missed]');
|
|
165
|
+
if (!button || button.disabled) return;
|
|
166
|
+
const what = button.dataset.missed;
|
|
167
|
+
if (what === 'later') { for (const o of state.offers) state.later.add(o.offerId); render(); paintRoutinesNote(); return; }
|
|
168
|
+
if (what === 'select-all') {
|
|
169
|
+
if (state.ticked.size === state.offers.length) state.ticked.clear();
|
|
170
|
+
else for (const o of state.offers) state.ticked.add(o.offerId);
|
|
171
|
+
render();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (what === 'run-one') void answer('run', [state.offers[0]]);
|
|
175
|
+
else if (what === 'skip-one') void answer('skip', [state.offers[0]]);
|
|
176
|
+
else if (what === 'run-selected') void answer('run', state.offers.filter((o) => state.ticked.has(o.offerId)));
|
|
177
|
+
else if (what === 'skip-all') void answer('skip', state.offers.slice());
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Sends the answer for each question, one by one, then says what happened in one toast per outcome. */
|
|
181
|
+
async function answer(kind, offers) {
|
|
182
|
+
const ctx = state.ctx;
|
|
183
|
+
if (!ctx || !offers.length || state.busy) return;
|
|
184
|
+
state.busy = true;
|
|
185
|
+
render();
|
|
186
|
+
const done = [];
|
|
187
|
+
const alreadyRunning = [];
|
|
188
|
+
const gone = [];
|
|
189
|
+
for (const o of offers) {
|
|
190
|
+
state.answered.add(o.offerId);
|
|
191
|
+
try {
|
|
192
|
+
if (kind === 'run') {
|
|
193
|
+
await ctx.api(`/api/routines/${encodeURIComponent(o.routineId)}/run`, { method: 'POST', body: JSON.stringify({ missedOfferId: o.offerId }) });
|
|
194
|
+
} else {
|
|
195
|
+
await ctx.api(`/api/routines/${encodeURIComponent(o.routineId)}/missed-offer/skip`, { method: 'POST', body: JSON.stringify({ expectedOfferId: o.offerId }) });
|
|
196
|
+
}
|
|
197
|
+
done.push(o.name);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
if (error?.body?.running) alreadyRunning.push(o.name);
|
|
200
|
+
else if (error?.body?.code === 'no-missed-offer') gone.push(o.name);
|
|
201
|
+
else { state.answered.delete(o.offerId); ctx.reportErr(error, kind === 'run' ? `run “${o.name}”` : `skip “${o.name}”`); }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
state.busy = false;
|
|
205
|
+
const names = (list) => list.map((name) => `“${name}”`).join(', ');
|
|
206
|
+
if (done.length) {
|
|
207
|
+
toast(kind === 'run'
|
|
208
|
+
? `${done.length === 1 ? `Started ${names(done)}` : `Started ${done.length} routines`}. How each run goes shows in Routines.`
|
|
209
|
+
: `${done.length === 1 ? `Skipped ${names(done)}` : `Skipped ${done.length} routines`}. Nothing ran; each runs at its next scheduled time.`, 'ok');
|
|
210
|
+
}
|
|
211
|
+
if (alreadyRunning.length) toast(`${names(alreadyRunning)} ${alreadyRunning.length === 1 ? 'is' : 'are'} already running, so FloLess didn’t start ${alreadyRunning.length === 1 ? 'it' : 'them'} again. ${alreadyRunning.length === 1 ? 'It is' : 'They are'} still waiting for your answer.`, 'info');
|
|
212
|
+
if (gone.length) toast(`${names(gone)} ${gone.length === 1 ? 'is' : 'are'} no longer waiting for an answer, so nothing was done for ${gone.length === 1 ? 'it' : 'them'}.`, 'info');
|
|
213
|
+
for (const name of alreadyRunning) { const o = offers.find((x) => x.name === name); if (o) state.answered.delete(o.offerId); }
|
|
214
|
+
await ctx.reload?.();
|
|
215
|
+
render();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** Routines says what still waits for an answer, and reopens the card. */
|
|
219
|
+
function paintRoutinesNote() {
|
|
220
|
+
const note = document.getElementById('rtn-missed-note');
|
|
221
|
+
const text = document.getElementById('rtn-missed-text');
|
|
222
|
+
if (!note || !text) return;
|
|
223
|
+
const n = state.offers.length;
|
|
224
|
+
note.hidden = n === 0;
|
|
225
|
+
text.textContent = n === 1 ? '1 routine missed its time while FloLess was closed and waits for your answer.'
|
|
226
|
+
: `${n} routines missed their time while FloLess was closed and wait for your answer.`;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Closes Routines (the card never shows over a dialog), shows the card again after Later and moves focus into it. */
|
|
230
|
+
function open() {
|
|
231
|
+
if (document.getElementById('routines-modal')?.classList.contains('show')) document.getElementById('routines-close')?.click();
|
|
232
|
+
state.later.clear();
|
|
233
|
+
render();
|
|
234
|
+
card?.querySelector('[data-missed]:not([disabled]):not(.missed-later)')?.focus();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
document.getElementById('rtn-missed-review')?.addEventListener('click', open);
|
|
238
|
+
window.flolessMissedRoutines = { update, open };
|
|
239
|
+
})();
|
|
@@ -401,6 +401,12 @@ export function mountModelMeasureTool({
|
|
|
401
401
|
const onKey = (event) => {
|
|
402
402
|
const key = String(event.key || '').toLowerCase();
|
|
403
403
|
if (editor && event.key === 'Escape') { event.preventDefault(); closeEditor(); return; }
|
|
404
|
+
// D, F, X, Y and Z are toggles: a held key's auto-repeat would flip them on and off and leave the
|
|
405
|
+
// tool or lock in whatever state the last repeat landed on (#3145). Only the first press counts;
|
|
406
|
+
// the repeats are still consumed so nothing behind the tool acts on them.
|
|
407
|
+
if (event.repeat && ['d', 'f', 'x', 'y', 'z'].includes(key) && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
408
|
+
if (key === 'd' || armed) { event.preventDefault(); return; }
|
|
409
|
+
}
|
|
404
410
|
if (key === 'd' && !event.ctrlKey && !event.metaKey && !event.altKey) { event.preventDefault(); api.toggle(); return; }
|
|
405
411
|
if (!armed) {
|
|
406
412
|
if (event.key === 'Delete' && selectedIndex !== null) { event.preventDefault(); session.remove(selectedIndex); syncSession(); render(); notify(); }
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
let panelSequence = 0;
|
|
10
10
|
const finite = (value, label) => {
|
|
11
11
|
const next = Number(value);
|
|
12
|
-
if (!Number.isFinite(next)) throw new TypeError(`${label} must be a finite number.`);
|
|
12
|
+
if (!Number.isFinite(next)) throw Object.assign(new TypeError(`${label} must be a finite number.`), { forPerson: true });
|
|
13
13
|
return next;
|
|
14
14
|
};
|
|
15
15
|
const degrees = (radians) => radians * 180 / Math.PI;
|
|
@@ -69,6 +69,17 @@ function note(doc, text) { const value = doc.createElement('div'); value.classNa
|
|
|
69
69
|
|
|
70
70
|
function actionRow(doc) { const row = doc.createElement('div'); row.className = 'model-spatial-panel-actions'; return row; }
|
|
71
71
|
|
|
72
|
+
// The shared spatial tools word their checks for a developer ("clip.min must have positive extents"), so the checks a
|
|
73
|
+
// person can trip from this panel's own controls are answered here by code, each saying what to change. Each sentence
|
|
74
|
+
// must hold for every call that raises its code: the range check covers points and directions alike.
|
|
75
|
+
const SPATIAL_GUIDANCE = Object.freeze({
|
|
76
|
+
E_MODEL_SPATIAL_EXTENTS: 'Each minimum must be smaller than its maximum. Change the box corners, then update the clip again.',
|
|
77
|
+
E_MODEL_SPATIAL_DEGENERATE: 'That direction has no length: its values are all zero, or the points picked lie on one line. Change them, then try again.',
|
|
78
|
+
E_MODEL_SPATIAL_RANGE: 'That value is larger than FloLess can place. Use a smaller number, then try again.',
|
|
79
|
+
E_MODEL_WORK_PLANE_UNAVAILABLE: 'There is no working plane yet. Set one first, then try again.',
|
|
80
|
+
E_MODEL_FRAME_LIMIT: 'This view already has as many saved frames as it can hold. Remove one, then try again.',
|
|
81
|
+
});
|
|
82
|
+
|
|
72
83
|
/**
|
|
73
84
|
* @param {{tools:any, trigger:HTMLElement, ports?:Record<string,Function>, documentRef?:Document,
|
|
74
85
|
* windowRef?:Window, onBeforeOpen?:()=>void, onError?:(error:Error)=>void,
|
|
@@ -95,7 +106,7 @@ export function mountModelSpatialPanel({
|
|
|
95
106
|
// quantity, so clicking Apply to change another field must not move this one by the rounding gap.
|
|
96
107
|
if (typeof source !== 'string' && source?.dataset?.displayText === text) return Number(source.dataset.originalMm);
|
|
97
108
|
const mm = lengthDisplay.parse(text);
|
|
98
|
-
if (typeof mm !== 'number' || !Number.isFinite(mm)) throw new TypeError(`${label} must be a finite length.`);
|
|
109
|
+
if (typeof mm !== 'number' || !Number.isFinite(mm)) throw Object.assign(new TypeError(`${label} must be a finite length.`), { forPerson: true });
|
|
99
110
|
return mm;
|
|
100
111
|
};
|
|
101
112
|
const lengthValuesFrom = (host, prefix, label) => [0, 1, 2].map((index) =>
|
|
@@ -105,7 +116,11 @@ export function mountModelSpatialPanel({
|
|
|
105
116
|
|
|
106
117
|
const report = (error) => {
|
|
107
118
|
const value = error instanceof Error ? error : new Error(String(error));
|
|
108
|
-
|
|
119
|
+
// #3097 3b: the panel's own input checks are said as written (forPerson), and a shared-tool check a person can
|
|
120
|
+
// trip with typed values is answered by its code; anything else that threw gets the shared sentence and stays in
|
|
121
|
+
// the console.
|
|
122
|
+
const guidance = SPATIAL_GUIDANCE[value.code];
|
|
123
|
+
if (status) { status.textContent = guidance || errorText(value, { action: 'use that spatial tool', retrySafe: true }); status.dataset.tone = 'error'; }
|
|
109
124
|
try { onError(value); } catch (_) { /* reporting cannot break the spatial interaction */ }
|
|
110
125
|
};
|
|
111
126
|
const run = (operation, success = '') => {
|
|
@@ -169,7 +184,7 @@ export function mountModelSpatialPanel({
|
|
|
169
184
|
if (lengthDisplay) {
|
|
170
185
|
const raw = text.trim(), relative = raw.startsWith('@');
|
|
171
186
|
const parts = (relative ? raw.slice(1) : raw).split(',').map((part) => part.trim());
|
|
172
|
-
if (parts.length !== 3) throw new TypeError('Enter X, Y, Z as three finite lengths.');
|
|
187
|
+
if (parts.length !== 3) throw Object.assign(new TypeError('Enter X, Y, Z as three finite lengths.'), { forPerson: true });
|
|
173
188
|
text = `${relative ? '@' : ''}${parts.map((part, axis) => readLength(part, `Coordinate ${'XYZ'[axis]}`)).join(',')}`;
|
|
174
189
|
}
|
|
175
190
|
const point = tools.parseCoordinates(text, basePoint);
|
|
@@ -27,7 +27,7 @@ const finite = (value, label) => {
|
|
|
27
27
|
const vec3 = (value, label) => {
|
|
28
28
|
if (!Array.isArray(value) || value.length !== 3) throw new TypeError(`${label} must be a 3D point.`);
|
|
29
29
|
const next = value.map((item, index) => finite(item, `${label}[${index}]`));
|
|
30
|
-
if (next.some((item) => Math.abs(item) > MAX_COORDINATE_MM)) throw new TypeError(`${label} exceeds the supported coordinate range.`);
|
|
30
|
+
if (next.some((item) => Math.abs(item) > MAX_COORDINATE_MM)) throw Object.assign(new TypeError(`${label} exceeds the supported coordinate range.`), { code: 'E_MODEL_SPATIAL_RANGE' });
|
|
31
31
|
return next;
|
|
32
32
|
};
|
|
33
33
|
const canonicalText = (value, label, maximum) => {
|
|
@@ -42,7 +42,7 @@ const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a
|
|
|
42
42
|
const length = (value) => Math.hypot(...value);
|
|
43
43
|
const unit = (value, label) => {
|
|
44
44
|
const magnitude = length(value);
|
|
45
|
-
if (!(magnitude > EPS)) throw new TypeError(`${label} is degenerate.`);
|
|
45
|
+
if (!(magnitude > EPS)) throw Object.assign(new TypeError(`${label} is degenerate.`), { code: 'E_MODEL_SPATIAL_DEGENERATE' });
|
|
46
46
|
return scale(value, 1 / magnitude);
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -96,7 +96,7 @@ function validatePlane(value, label = 'plane') {
|
|
|
96
96
|
|
|
97
97
|
function validateBox(value, label = 'box') {
|
|
98
98
|
const min = vec3(value?.min, `${label}.min`); const max = vec3(value?.max, `${label}.max`);
|
|
99
|
-
if (min.some((item, index) => item >= max[index])) throw new TypeError(`${label} must have positive extents.`);
|
|
99
|
+
if (min.some((item, index) => item >= max[index])) throw Object.assign(new TypeError(`${label} must have positive extents.`), { code: 'E_MODEL_SPATIAL_EXTENTS' });
|
|
100
100
|
return snapshot({ min, max });
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -1323,9 +1323,9 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
|
|
|
1323
1323
|
setWorkPlaneVisible: (value) => needSpatial().setWorkPlaneVisible(value),
|
|
1324
1324
|
clearWorkPlane() { const tools = needSpatial(); const state = tools.state(); if (state.workPlane?.visible) tools.setWorkPlaneVisible(false); return tools.resetGlobal(); },
|
|
1325
1325
|
workPlaneInfo: () => spatialState?.workPlane ?? null,
|
|
1326
|
-
setWorkArea(from) { const box = canonicalBounds(from === 'selection' ? selectedMeshes() : ownedMeshes); if (!box) throw new Error(from === 'selection' ? 'Select model objects first.' : '
|
|
1327
|
-
toggleWorkArea() { const tools = needSpatial(); const area = tools.state().workArea; if (!area) throw new Error('Set a work area first.'); return tools.setWorkAreaVisible(!area.visible); },
|
|
1328
|
-
toggleWorkAreaWhole() { const tools = needSpatial(); const area = tools.state().workArea; if (!area) throw new Error('Set a work area first.'); return tools.setWorkAreaWhole(!area.wholeParts); },
|
|
1326
|
+
setWorkArea(from) { const box = canonicalBounds(from === 'selection' ? selectedMeshes() : ownedMeshes); if (!box) throw Object.assign(new Error(from === 'selection' ? 'Select model objects first.' : 'Nothing in this model is shown, so there is no work area to set.'), { forPerson: true }); return needSpatial().setWorkArea({ ...box, wholeParts: true }); },
|
|
1327
|
+
toggleWorkArea() { const tools = needSpatial(); const area = tools.state().workArea; if (!area) throw Object.assign(new Error('Set a work area first.'), { forPerson: true }); return tools.setWorkAreaVisible(!area.visible); },
|
|
1328
|
+
toggleWorkAreaWhole() { const tools = needSpatial(); const area = tools.state().workArea; if (!area) throw Object.assign(new Error('Set a work area first.'), { forPerson: true }); return tools.setWorkAreaWhole(!area.wholeParts); },
|
|
1329
1329
|
workAreaState: () => spatialState?.workArea ?? null,
|
|
1330
1330
|
projection: () => controller.cameraState().projection, displayMode: () => controller.displayMode(),
|
|
1331
1331
|
lightingState: () => ({ ...lighting }), setLighting: (value) => ({ ...applyLighting(value) }),
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* origin-rule — the model origin's default, worked out by FloLess from the model itself (#2909).
|
|
3
|
+
*
|
|
4
|
+
* Owner rulings: Pawel 2026-10-29 (*"for the model origin, as a general rule, we can use on the plan view bottom left
|
|
5
|
+
* corner, so first intersection of grid lines, at the bottom left"*) and 2026-11-08 (the four recommendations of
|
|
6
|
+
* `docs/superpowers/specs/2026-11-08-quick-model-origin-2909-PLAN.md`, Revision 2 V1).
|
|
7
|
+
*
|
|
8
|
+
* THE RULE. The default is where the model grid's FIRST X line and FIRST Y line cross (the lowest world offset in each
|
|
9
|
+
* direction), counting only a crossing both lines actually reach (`grid.ends`). When those two do not meet, it is the
|
|
10
|
+
* first crossing in world order that both lines reach: the lowest Y line, then the lowest X line along it.
|
|
11
|
+
*
|
|
12
|
+
* WHY THE MODEL GRID, NOT EACH DRAWING VIEW. A plan row records no list of the grid lines it shows, so "this view's
|
|
13
|
+
* bottom-left" would claim something FloLess cannot see (Codex plan review round 2, finding 1). The model grid's corner
|
|
14
|
+
* is exact. It is called the bottom-left AS DRAWN only when every registered plan view draws world +X to the right and
|
|
15
|
+
* world +Y up the sheet: a plan's registration is a similarity (scale and rotation, never a mirror), so that is its
|
|
16
|
+
* rotation within `UPRIGHT_TOLERANCE_DEG`. A view that fails, or no straight grid, gives no default and a reason;
|
|
17
|
+
* nothing here blocks anything. Whoever chooses (the AI in a Quick read, the person on the card) still chooses, and a
|
|
18
|
+
* departure from the default is labelled, never refused (owner ruling 2026-11-08).
|
|
19
|
+
*
|
|
20
|
+
* Pure and shared: the server's audit and the steel editor's AI note both call it, on the same grid and registration
|
|
21
|
+
* readers the editor draws with, so the default the person reads can never disagree with the one the audit used.
|
|
22
|
+
*/
|
|
23
|
+
import { axisLabelsFor, gridGeometry, parseSpacings } from './grid-core.js';
|
|
24
|
+
import { PlanTransformError, planTransform } from './steel-plan-transform.js';
|
|
25
|
+
|
|
26
|
+
/** A plan view counts as upright when its registration rotates the grid by at most this much. */
|
|
27
|
+
export const UPRIGHT_TOLERANCE_DEG = 10;
|
|
28
|
+
/** A crossing counts as reached when it sits within this of a line's drawn end (world mm). */
|
|
29
|
+
export const REACH_TOLERANCE_MM = 0.5;
|
|
30
|
+
|
|
31
|
+
const isRecord = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
32
|
+
|
|
33
|
+
/** The model grid's straight lines of one direction, in world order, each with its drawn extent; or a reason. */
|
|
34
|
+
function linesOf(grid, dir) {
|
|
35
|
+
const spacing = parseSpacings(grid[dir]);
|
|
36
|
+
const up = dir.toUpperCase();
|
|
37
|
+
if (spacing.err) return `the grid's ${up} spacing cannot be read`;
|
|
38
|
+
const rows = (Array.isArray(grid.axes) ? grid.axes : []).filter((a) => isRecord(a) && a.dir === dir);
|
|
39
|
+
if (rows.length !== spacing.offsets.length) return `the grid's ${up} lines and spacings do not match`;
|
|
40
|
+
if (rows.some((a) => typeof a.id !== 'string' || !a.id)) return `a grid ${up} line has no id`;
|
|
41
|
+
// Native grid: world mm, Y up, identity scale; `ends` keyed by axis id (grid-core's own reader).
|
|
42
|
+
const geo = gridGeometry(grid, 1, { yUp: true });
|
|
43
|
+
const drawn = dir === 'x' ? geo.v.map((l) => ({ at: l.x, lo: l.lo, hi: l.hi })) : geo.h.map((l) => ({ at: l.y, lo: l.lo, hi: l.hi }));
|
|
44
|
+
const labels = axisLabelsFor(grid, dir, dir === 'x' ? 'num' : 'alpha', rows.length);
|
|
45
|
+
return rows.map((a, i) => ({ id: a.id, label: String(labels[i] ?? ''), ...drawn[i] })).sort((a, b) => a.at - b.at);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const reaches = (line, at) => at >= line.lo - REACH_TOLERANCE_MM && at <= line.hi + REACH_TOLERANCE_MM;
|
|
49
|
+
|
|
50
|
+
/** The rotation (degrees, -180..180] a registered plan view draws the model grid at, or null when it is not registered. */
|
|
51
|
+
function viewRotationDeg(plan, grid) {
|
|
52
|
+
let t;
|
|
53
|
+
try {
|
|
54
|
+
t = planTransform({ ...plan, modelGrid: grid });
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (err instanceof PlanTransformError) return null;
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
let deg = (t.rotation * 180) / Math.PI;
|
|
60
|
+
while (deg > 180) deg -= 360;
|
|
61
|
+
while (deg <= -180) deg += 360;
|
|
62
|
+
return deg;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The model grid's bottom-left corner, without the "as drawn" condition: the first crossing in world order that both
|
|
67
|
+
* lines reach. `corner` says whether it is the first X and first Y line themselves.
|
|
68
|
+
* @returns {{ ok: true, corner: boolean, choice: { xAxisId: string, yAxisId: string, xLabel: string, yLabel: string } } | { ok: false, reason: string }}
|
|
69
|
+
*/
|
|
70
|
+
export function modelGridCorner(grid) {
|
|
71
|
+
if (!isRecord(grid)) return { ok: false, reason: 'the model has no grid' };
|
|
72
|
+
const xs = linesOf(grid, 'x'); if (typeof xs === 'string') return { ok: false, reason: xs };
|
|
73
|
+
const ys = linesOf(grid, 'y'); if (typeof ys === 'string') return { ok: false, reason: ys };
|
|
74
|
+
if (!xs.length || !ys.length) return { ok: false, reason: `the grid has no straight ${!xs.length ? 'X' : 'Y'} lines` };
|
|
75
|
+
for (const y of ys) {
|
|
76
|
+
for (const x of xs) {
|
|
77
|
+
// An X line runs along world Y (its extent is in Y); a Y line runs along world X.
|
|
78
|
+
if (reaches(x, y.at) && reaches(y, x.at)) {
|
|
79
|
+
return { ok: true, corner: x === xs[0] && y === ys[0], choice: { xAxisId: x.id, yAxisId: y.id, xLabel: x.label, yLabel: y.label } };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { ok: false, reason: 'no two grid lines both reach where they cross' };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The default for a model: the corner, when every registered plan view draws the grid upright. Plan views not yet
|
|
88
|
+
* registered are not counted (they say nothing about orientation); with none registered there is no default, because
|
|
89
|
+
* "as drawn" cannot be checked.
|
|
90
|
+
* @returns {{ ok: true, corner: boolean, choice: { xAxisId: string, yAxisId: string, xLabel: string, yLabel: string } } | { ok: false, reason: string }}
|
|
91
|
+
*/
|
|
92
|
+
export function bottomLeftOrigin(model) {
|
|
93
|
+
if (!isRecord(model)) return { ok: false, reason: 'there is no model' };
|
|
94
|
+
const corner = modelGridCorner(model.grid);
|
|
95
|
+
if (!corner.ok) return corner;
|
|
96
|
+
const plans = (Array.isArray(model.plans) ? model.plans : []).filter((p) => isRecord(p) && p.viewKind === 'plan');
|
|
97
|
+
let registered = 0;
|
|
98
|
+
for (const plan of plans) {
|
|
99
|
+
const deg = viewRotationDeg(plan, model.grid);
|
|
100
|
+
if (deg === null) continue;
|
|
101
|
+
registered += 1;
|
|
102
|
+
if (Math.abs(deg) > UPRIGHT_TOLERANCE_DEG) {
|
|
103
|
+
const name = typeof plan.id === 'string' && plan.id ? plan.id : typeof plan.sheet === 'string' && plan.sheet ? plan.sheet : 'a plan view';
|
|
104
|
+
return { ok: false, reason: `plan view ${name} draws the grid rotated ${Math.round(Math.abs(deg))} degrees, so no corner is the bottom-left as drawn on every plan` };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (!registered) return { ok: false, reason: 'no plan view is registered to the grid yet, so FloLess cannot tell which corner is drawn bottom-left' };
|
|
108
|
+
return corner;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* #2909 V4/W1: does a chosen crossing lie where both its grid lines are drawn? `null` when the grid cannot say (no grid,
|
|
113
|
+
* an unreadable one, or ids it does not have); otherwise `{ ok }`, and when a line stops short, the plain sentence the
|
|
114
|
+
* card and the audit say. A crossing past a line's end is still allowed: 0,0 sits where that line would reach if
|
|
115
|
+
* extended. It is said, never refused.
|
|
116
|
+
* @returns {null | { ok: true } | { ok: false, short: string[], sentence: string }}
|
|
117
|
+
*/
|
|
118
|
+
export function crossingReach(grid, chosen) {
|
|
119
|
+
if (!isRecord(grid) || !isRecord(chosen)) return null;
|
|
120
|
+
const xs = linesOf(grid, 'x'); const ys = linesOf(grid, 'y');
|
|
121
|
+
if (typeof xs === 'string' || typeof ys === 'string') return null;
|
|
122
|
+
const x = xs.find((l) => l.id === chosen.xAxisId); const y = ys.find((l) => l.id === chosen.yAxisId);
|
|
123
|
+
if (!x || !y) return null;
|
|
124
|
+
const short = [...(reaches(x, y.at) ? [] : [x.label]), ...(reaches(y, x.at) ? [] : [y.label])];
|
|
125
|
+
if (!short.length) return { ok: true };
|
|
126
|
+
const lines = short.length === 1 ? `line ${short[0]} stops` : `lines ${short[0]} and ${short[1]} stop`;
|
|
127
|
+
return { ok: false, short, sentence: `on the model grid ${lines} short of ${x.label}/${y.label}, so 0,0 sits where ${short.length === 1 ? 'it' : 'they'} would reach if extended` };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Does a chosen origin follow the default? `null` when there is no default. */
|
|
131
|
+
export function followsDefault(rule, chosen) {
|
|
132
|
+
if (!rule || !rule.ok || !isRecord(chosen)) return null;
|
|
133
|
+
return rule.choice.xAxisId === chosen.xAxisId && rule.choice.yAxisId === chosen.yAxisId;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* One plain sentence on how a chosen origin stands against the default, for the person (the editor's AI note) and the
|
|
138
|
+
* read (the audit's pass text). `who` is "The AI" or "You". Never a block, never a claim FloLess did not check.
|
|
139
|
+
*/
|
|
140
|
+
export function originRuleSentence(rule, chosen, who = 'The AI') {
|
|
141
|
+
const named = isRecord(chosen) && chosen.xLabel && chosen.yLabel ? `${chosen.xLabel}/${chosen.yLabel}` : 'this origin';
|
|
142
|
+
if (!rule || !rule.ok) return `FloLess could not work out a bottom-left default here: ${rule && rule.reason ? rule.reason : 'the model gives it nothing to work from'}. ${who} chose ${named}.`;
|
|
143
|
+
const def = `${rule.choice.xLabel}/${rule.choice.yLabel}`;
|
|
144
|
+
const kind = rule.corner ? 'the bottom-left grid intersection' : 'the first grid intersection both lines reach at the bottom left';
|
|
145
|
+
return followsDefault(rule, chosen)
|
|
146
|
+
? `${who} chose ${named}, ${kind}: the default.`
|
|
147
|
+
: `${who} chose ${named}, not the bottom-left default (${def}).`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The same verdict as a short follow-on sentence, for a place that has already named the origin and who chose it. */
|
|
151
|
+
export function originRuleNote(rule, chosen) {
|
|
152
|
+
if (!rule || !rule.ok) return `FloLess could not work out a bottom-left default here: ${rule && rule.reason ? rule.reason : 'the model gives it nothing to work from'}.`;
|
|
153
|
+
if (followsDefault(rule, chosen)) return rule.corner ? 'It is the bottom-left grid intersection, the default.' : 'It is the first grid intersection both lines reach at the bottom left, the default.';
|
|
154
|
+
return `It is not the bottom-left default (${rule.choice.xLabel}/${rule.choice.yLabel}).`;
|
|
155
|
+
}
|
|
@@ -487,7 +487,7 @@
|
|
|
487
487
|
try {
|
|
488
488
|
await go();
|
|
489
489
|
} catch (error) {
|
|
490
|
-
toast(
|
|
490
|
+
toast(errorText(error, { action: 'open that', retrySafe: true }), 'warn');
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
if (!project || !linkFrom) return;
|
|
332
332
|
const general = linkFrom.name || 'the General project';
|
|
333
333
|
const back = { label: `Back to ${general}`, commandId: 'shell.project-modules-back',
|
|
334
|
-
onClick: () => Promise.resolve(ws().openModulesStep?.(linkFrom.projectId)).catch((e) => toast(e
|
|
334
|
+
onClick: () => Promise.resolve(ws().openModulesStep?.(linkFrom.projectId)).catch((e) => toast(errorText(e, { action: 'open that project', retrySafe: true }), 'warn')) };
|
|
335
335
|
if (outcome === 'archived-empty' || outcome === 'left-empty') {
|
|
336
336
|
let removed = false;
|
|
337
337
|
try {
|
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
if (open) {
|
|
400
400
|
event.preventDefault();
|
|
401
401
|
Promise.resolve(ws().openLinkedProject?.(open.getAttribute('data-pm-open'))).catch((error) => {
|
|
402
|
-
toast(error
|
|
402
|
+
toast(errorText(error, { action: 'open that project', retrySafe: true }), 'warn');
|
|
403
403
|
void load();
|
|
404
404
|
});
|
|
405
405
|
return;
|
package/dist/web/project-rfis.js
CHANGED
|
@@ -517,7 +517,12 @@
|
|
|
517
517
|
if (data.store === 'ok') {
|
|
518
518
|
const n = data.rfis.length;
|
|
519
519
|
if (!mine.quietLoad) announce(n === 0 ? 'No RFIs in this project yet' : `${n} RFI${n === 1 ? '' : 's'}`);
|
|
520
|
-
} else
|
|
520
|
+
} else {
|
|
521
|
+
// #3097: not thrown text: a store state's `message` is one of the fixed sentences rfi-correspondence.ts writes
|
|
522
|
+
// for the person (quarantined, newer, transport).
|
|
523
|
+
const storeSentence = typeof data.message === 'string' ? data.message : '';
|
|
524
|
+
announce(storeSentence || 'FloLess couldn’t load this project’s RFIs.');
|
|
525
|
+
}
|
|
521
526
|
mine.quietLoad = false;
|
|
522
527
|
} catch (error) {
|
|
523
528
|
if (state !== mine || mine.generation !== generation) return;
|
|
@@ -422,10 +422,10 @@
|
|
|
422
422
|
mine.view = { ...mine.view, busyNew: true };
|
|
423
423
|
paint();
|
|
424
424
|
try {
|
|
425
|
-
if (typeof bridge().newWorkflow !== 'function') throw new Error('Use ≡ → New workflow and choose this project as its location.');
|
|
425
|
+
if (typeof bridge().newWorkflow !== 'function') throw Object.assign(new Error('Use ≡ → New workflow and choose this project as its location.'), { forPerson: true });
|
|
426
426
|
await bridge().newWorkflow({ ownerProjectId: mine.project.id });
|
|
427
427
|
} catch (error) {
|
|
428
|
-
toast(error
|
|
428
|
+
toast(errorText(error, { action: 'open New workflow', retrySafe: true }), 'warn');
|
|
429
429
|
} finally {
|
|
430
430
|
if (state === mine) {
|
|
431
431
|
mine.view = { ...mine.view, busyNew: false };
|