@floless/app 0.165.0 → 0.167.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 +30794 -25371
- package/dist/schemas/drawing-check.profile.v1.schema.json +4 -2
- package/dist/schemas/steel.model.v2.schema.json +2 -1
- package/dist/skills/floless-app-knowledge/SKILL.md +8 -1
- package/dist/skills/floless-app-rfi/SKILL.md +7 -2
- package/dist/skills/floless-app-steel-model/SKILL.md +4 -1
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -17
- package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +15 -1
- package/dist/templates/college-phase-exporter.flo +41 -49
- package/dist/templates/screenshot-to-saved-settings.flo +12 -2
- package/dist/web/app.css +120 -1
- package/dist/web/aware.js +385 -88
- package/dist/web/chat-question-card.js +3 -1
- package/dist/web/chat.css +32 -0
- package/dist/web/chat.js +1021 -88
- package/dist/web/commands-drawing-check.js +1 -0
- package/dist/web/commands-filter.js +23 -0
- package/dist/web/commands-shell.js +231 -19
- package/dist/web/commands-steel.js +22 -2
- package/dist/web/drawing-check-editor.html +4 -0
- package/dist/web/drawing-check-editor.js +82 -2
- package/dist/web/index.html +14 -6
- package/dist/web/project-history.js +163 -19
- package/dist/web/project-modules.js +5 -0
- package/dist/web/project-rfis.js +206 -20
- package/dist/web/steel-ai-marks.js +173 -2
- package/dist/web/steel-editor.html +770 -49
- package/dist/web/steel-filter-flo.js +171 -7
- package/dist/web/steel-filter.html +36 -10
- package/dist/web/steel-model-v2-projection.js +26 -20
- package/dist/web/terminal-requests.js +5 -0
- package/dist/web/tool-updates.js +65 -20
- package/dist/web/workspaces.js +632 -85
- package/package.json +3 -2
|
@@ -235,6 +235,42 @@ export function mainPartHtml(it, { touched = false, note = '', locatedOn = false
|
|
|
235
235
|
<p class="note">Normally the main part is the part-list row whose mark is the assembly mark in the drawing title. “Part list agrees with the title” and “Every part is located” both use it. Choose No only if this client lists the main part under a different mark.</p>
|
|
236
236
|
${unticked}${note ? `<p class="note" role="status">${esc(note)}</p>` : ''}</div>`;
|
|
237
237
|
}
|
|
238
|
+
/** The largest line break a checklist may set, pt (server `MAX_LINE_BREAK_PT`). */
|
|
239
|
+
export const MAX_LINE_BREAK_PT = 3;
|
|
240
|
+
/**
|
|
241
|
+
* A typed line break, in points: a number from 0 to MAX_LINE_BREAK_PT (a comma for the decimal point and a trailing
|
|
242
|
+
* "pt" are fine), rounded to tenths; or `{ why }` saying what is wrong. Nothing is saved from a value that is not one.
|
|
243
|
+
*/
|
|
244
|
+
export function parseLineBreak(text) {
|
|
245
|
+
const t = String(text).trim().replace(/\s*pt$/i, '').replace(',', '.');
|
|
246
|
+
if (!/^\d*\.?\d+$|^\d+\.$/.test(t)) return { why: 'Enter a size from 0 to 3 pt, for example 0.6. Nothing was saved.' };
|
|
247
|
+
const v = Number(t);
|
|
248
|
+
if (v > MAX_LINE_BREAK_PT) return { why: `${MAX_LINE_BREAK_PT} pt is the most FloLess closes. Nothing was saved.` };
|
|
249
|
+
return { pt: Math.round(v * 10) / 10 };
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The line break "Every part is located" closes a part's outline across (#2825, owner ruling 2026-10-28): learned from
|
|
253
|
+
* the references, the person's to change. Shown under that item; editable whether or not it is ticked.
|
|
254
|
+
*/
|
|
255
|
+
/** @param {any} it @param {{ touched?: boolean, note?: string, error?: string, typed?: string | null }} [opts] */
|
|
256
|
+
export function lineBreakHtml(it, { touched = false, note = '', error = '', typed = null } = {}) {
|
|
257
|
+
const r = it.rule, pt = typeof r.lineBreakPt === 'number' ? r.lineBreakPt : 0, seen = r.lineBreakSeen;
|
|
258
|
+
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
259
|
+
const chip = touched ? 'set by you'
|
|
260
|
+
: seen && pt > 0 ? `learned from ${plural(seen.breaks, 'break', 'breaks')} on ${plural(seen.sheets, 'reference sheet', 'reference sheets')}`
|
|
261
|
+
: 'no breaks seen in the references';
|
|
262
|
+
const why = touched || pt > 0
|
|
263
|
+
? 'Many firms draw a member’s lines in pieces, with a small break where nothing crosses. When a part’s outline is broken by no more than this, FloLess closes it and says so in the result, as an assumption. 0 closes no break.'
|
|
264
|
+
: 'No breaks were seen in your reference drawings, so FloLess closes none. Enter a size, up to 3 pt, if your drawings have them.';
|
|
265
|
+
return `<div class="clear-panel" role="group" aria-labelledby="line-break-h">
|
|
266
|
+
<p class="clear-head"><span id="line-break-h">Breaks in drawn lines: the largest break FloLess closes</span> <span class="chip">${esc(chip)}</span></p>
|
|
267
|
+
<div class="pt-field"><input type="text" id="line-break-pt" inputmode="decimal" autocomplete="off" spellcheck="false" value="${esc(typed ?? String(pt))}"
|
|
268
|
+
aria-label="Largest break closed, in points" aria-describedby="line-break-note${error ? ' line-break-err' : ''}" aria-invalid="${error ? 'true' : 'false'}"
|
|
269
|
+
data-tip="Its size on paper, 0 to 3 pt. 0 closes no break." data-command-id="drawing-check.line-break" data-command-instance-label="Largest break closed"><span class="pt-unit" aria-hidden="true">pt</span></div>
|
|
270
|
+
${error ? `<p class="err-line" id="line-break-err" role="alert">${esc(error)}</p>` : ''}
|
|
271
|
+
<p class="note" id="line-break-note">${why}</p>
|
|
272
|
+
${it.enabled ? '' : '<p class="note">This item is not ticked, so this setting is not used.</p>'}${note ? `<p class="note" role="status">${esc(note)}</p>` : ''}</div>`;
|
|
273
|
+
}
|
|
238
274
|
export const KIND_WORDS = { standard: 'standard holes', oversize: 'oversize holes', 'short-slot': 'short slots', 'long-slot': 'long slots' };
|
|
239
275
|
export const STANDARD_NAMES = { us: 'US practice (AISC J3.3, standard holes)', en1090: 'EN 1090-2 (normal round holes)' };
|
|
240
276
|
function lenText(l) {
|
|
@@ -672,7 +708,7 @@ function boot() {
|
|
|
672
708
|
|
|
673
709
|
// ── loading ──
|
|
674
710
|
async function loadDraft() {
|
|
675
|
-
S.clearNote = ''; S.mainNote = ''; // a note about the last change says nothing true about a draft read afresh
|
|
711
|
+
S.clearNote = ''; S.mainNote = ''; S.breakNote = ''; S.breakError = ''; S.breakTyped = null; // a note about the last change says nothing true about a draft read afresh
|
|
676
712
|
const res = await fetch(`/api/contract/${encodeURIComponent(APP)}?project=${encodeURIComponent(PROJECT)}&quietMissing=1`, { credentials: 'same-origin' });
|
|
677
713
|
if (res.status === 204) { S.draft = null; S.etag = null; return; }
|
|
678
714
|
if (res.status === 404) throw new Error('This profile could not be found. It may have been archived; open it again from Workspaces.');
|
|
@@ -1037,7 +1073,8 @@ function boot() {
|
|
|
1037
1073
|
<span class="lbl">${esc(it.label)}<span class="origin">${esc(origin)}</span></span>
|
|
1038
1074
|
${pct !== null ? `<span class="freq${pct < 50 ? ' rare' : ''}" data-tip="How often this held on the reference drawings"><span class="bar"><i style="width:${pct}%"></i></span>${pct}%</span>` : '<span></span>'}
|
|
1039
1075
|
<span class="kind">by code</span></label>${it.rule && it.rule.type === 'hole-bolt' ? clearancesHtml(it, S.clearNote) : ''}${it.rule && it.rule.type === 'part-list-agrees' && mainRowItem(list) === it
|
|
1040
|
-
? mainPartHtml(it, { touched: ((S.draft && S.draft.touched) || []).includes(`item:${it.id}.mainRow`), note: S.mainNote, locatedOn: list.some((x) => x.enabled && x.rule && x.rule.type === 'parts-located') }) : ''}
|
|
1076
|
+
? mainPartHtml(it, { touched: ((S.draft && S.draft.touched) || []).includes(`item:${it.id}.mainRow`), note: S.mainNote, locatedOn: list.some((x) => x.enabled && x.rule && x.rule.type === 'parts-located') }) : ''}${it.rule && it.rule.type === 'parts-located'
|
|
1077
|
+
? lineBreakHtml(it, { touched: ((S.draft && S.draft.touched) || []).includes(`item:${it.id}.lineBreakPt`), note: S.breakNote, error: S.breakError, typed: S.breakTyped }) : ''}`;
|
|
1041
1078
|
}).join('');
|
|
1042
1079
|
return `<div class="wrap"><h2>Checklist</h2>
|
|
1043
1080
|
<p class="lede">Common doesn’t mean required. Tick only what this client needs.</p>
|
|
@@ -1102,6 +1139,36 @@ function boot() {
|
|
|
1102
1139
|
} finally { itemsInFlight--; }
|
|
1103
1140
|
});
|
|
1104
1141
|
}
|
|
1142
|
+
// The line break: one PUT on the checklist queue, as the main part setting. Each save is numbered: an earlier
|
|
1143
|
+
// answer never puts back a value over a later one still queued (diff review r1), and the answer to the last save
|
|
1144
|
+
// shows what was saved even when other edits are still queued.
|
|
1145
|
+
let breakSaves = 0;
|
|
1146
|
+
function putLineBreak(pt) {
|
|
1147
|
+
itemsInFlight++;
|
|
1148
|
+
const save = ++breakSaves;
|
|
1149
|
+
return itemsQueue(async () => {
|
|
1150
|
+
S.checklistError = ''; S.breakNote = '';
|
|
1151
|
+
try {
|
|
1152
|
+
const { body } = await call(`${base}/line-break`, jsonOpts('PUT', { pt }, S.etag ? { 'if-match': S.etag } : {}));
|
|
1153
|
+
S.etag = body.etag;
|
|
1154
|
+
S.breakNote = pt ? `The largest break closed is now ${pt} pt. The checklist has to be approved again.` : 'Breaks in drawn lines are no longer closed. The checklist has to be approved again.';
|
|
1155
|
+
const r7 = body.items.find((x) => x.rule && x.rule.type === 'parts-located');
|
|
1156
|
+
if (r7) S.draft.touched = [...new Set([...(S.draft.touched || []), `item:${r7.id}.lineBreakPt`])];
|
|
1157
|
+
if (itemsInFlight === 1) { S.draft.items = body.items; await loadReview(); render(); }
|
|
1158
|
+
else if (save === breakSaves) {
|
|
1159
|
+
const mine = items().find((x) => x.rule && x.rule.type === 'parts-located');
|
|
1160
|
+
if (mine && r7) { mine.rule.lineBreakPt = r7.rule.lineBreakPt; render(); }
|
|
1161
|
+
}
|
|
1162
|
+
// Otherwise a later save is still queued: its value stays as shown, and the note waits for its answer.
|
|
1163
|
+
else S.breakNote = '';
|
|
1164
|
+
} catch (e) {
|
|
1165
|
+
if (e.status === 412 || e.status === 428) S.conflict = true;
|
|
1166
|
+
else S.checklistError = e.message;
|
|
1167
|
+
await loadDraft().catch(() => {});
|
|
1168
|
+
render();
|
|
1169
|
+
} finally { itemsInFlight--; }
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1105
1172
|
// Whether the main part's mark is the assembly mark: one PUT on the checklist queue, as the clearance fill.
|
|
1106
1173
|
// Each main part click is numbered: an answer settles the choice on the page unless a later click is on its way.
|
|
1107
1174
|
let mainClicks = 0;
|
|
@@ -2260,6 +2327,19 @@ function boot() {
|
|
|
2260
2327
|
document.getElementById('client-name')?.focus();
|
|
2261
2328
|
return;
|
|
2262
2329
|
}
|
|
2330
|
+
if (t.id === 'line-break-pt') {
|
|
2331
|
+
const it = items().find((x) => x.rule && x.rule.type === 'parts-located');
|
|
2332
|
+
if (!it) return;
|
|
2333
|
+
const got = parseLineBreak(t.value);
|
|
2334
|
+
// A value that is not one is said beside the field, which keeps what was typed; nothing is saved.
|
|
2335
|
+
if ('why' in got) { S.breakError = got.why; S.breakTyped = t.value; S.breakNote = ''; render(); refocusIfLost(document, root, '#line-break-pt'); return; }
|
|
2336
|
+
S.breakError = ''; S.breakTyped = null;
|
|
2337
|
+
const was = typeof it.rule.lineBreakPt === 'number' ? it.rule.lineBreakPt : 0;
|
|
2338
|
+
if (got.pt !== was) { it.rule.lineBreakPt = got.pt; render(); await putLineBreak(got.pt); }
|
|
2339
|
+
else render();
|
|
2340
|
+
refocusIfLost(document, root, '#line-break-pt');
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2263
2343
|
if (t.dataset.tbLabel) {
|
|
2264
2344
|
const name = t.dataset.tbLabel;
|
|
2265
2345
|
const f = ((S.draft && S.draft.titleBlock && S.draft.titleBlock.fields) || []).find((x) => x.name === name);
|
package/dist/web/index.html
CHANGED
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
appears only when its logic drifted (re-installs the official version); Customize (fork) is
|
|
146
146
|
always available for a maintained app. When shown on drift they replace Compile, so a
|
|
147
147
|
shipped app's logic edit can't be silently approved (form-only). -->
|
|
148
|
-
<button data-command-id="shell.restore-workflow" id="restore-btn" type="button" hidden data-tip="
|
|
148
|
+
<button data-command-id="shell.restore-workflow#the open workflow" data-command-instance-label="the open workflow" id="restore-btn" type="button" hidden data-tip="Put FloLess’s version of this workflow back and make it ready to run. Your changes are kept in a backup, and Undo puts them back.">↺ Restore</button>
|
|
149
149
|
<button data-command-id="shell.customize-workflow" id="customize-btn" type="button" hidden data-tip="Fork this workflow to edit it yourself — takes it off the FloLess update channel">Customize…</button>
|
|
150
150
|
<button id="compile-btn" data-command-id="workflow.compile" data-acts="Acts on the whole workflow" data-tip="Compile + approve → freeze the .lock">⎙ Compile</button>
|
|
151
151
|
<button id="sim-btn" data-command-id="workflow.simulate" data-acts="Acts on the workflow only — never the live host" data-tip="Simulate: stub every node from its output schema — no live host is contacted. Validates the workflow's composition end-to-end, even when the real tools aren't connected yet.">Simulate</button>
|
|
@@ -456,6 +456,12 @@
|
|
|
456
456
|
point at — the button already says what it does. -->
|
|
457
457
|
<button data-command-id="shell.attach-revision" type="button" id="ws-attach-revision" class="btn-mini" data-tip="Attach revised PDF drawings — your terminal AI reads them into a new version" hidden>⤒ Attach revised drawings…</button>
|
|
458
458
|
<input data-command-id="shell.attach-revision" type="file" id="ws-revision-file" accept=".pdf" multiple hidden>
|
|
459
|
+
<!-- #2470 R6.5b: a module project's History step has two views: its approval ledger and its activity journal.
|
|
460
|
+
Shown only on that step (setStep). A radiogroup, not tabs: this row is already the step tablist. -->
|
|
461
|
+
<span class="ws-history-views" id="ws-history-views" role="radiogroup" aria-label="Show history as" hidden>
|
|
462
|
+
<button data-command-id="shell.history-view#approvals" type="button" role="radio" aria-checked="true" tabindex="0" data-history-view="approvals" aria-controls="ws-history" data-tip="Approved versions, saved work and rollback.">Approvals</button>
|
|
463
|
+
<button data-command-id="shell.history-view#activity" type="button" role="radio" aria-checked="false" tabindex="-1" data-history-view="activity" aria-controls="ws-journal" data-tip="What happened in this project, newest first: knowledge, workflows, RFIs and more, and who started each.">Activity</button>
|
|
464
|
+
</span>
|
|
459
465
|
</span>
|
|
460
466
|
</div>
|
|
461
467
|
<!-- The announcer stays outside the bounded visual region so it is mounted before the first
|
|
@@ -720,18 +726,20 @@
|
|
|
720
726
|
</div>
|
|
721
727
|
</div>
|
|
722
728
|
|
|
723
|
-
<!-- Workflow update
|
|
724
|
-
|
|
725
|
-
|
|
729
|
+
<!-- Workflow update (one click, owner ruling 2026-11-02): what is new in the open workflow (#wf-update-changelog),
|
|
730
|
+
the same row the status-bar dialog shows (#wf-update-row: where it stands, the warning when the person changed
|
|
731
|
+
it), and one button that does the next thing: Update, then Undo (or Approve model for a Steel Model). -->
|
|
726
732
|
<div class="modal-backdrop" id="wf-update-modal">
|
|
727
733
|
<div class="modal">
|
|
728
734
|
<div class="modal-title" id="wf-update-title">Workflow update</div>
|
|
729
735
|
<div class="modal-sub" id="wf-update-sub"></div>
|
|
730
736
|
<div class="wf-update-changelog" id="wf-update-changelog"></div>
|
|
731
|
-
<div class="wf-update-
|
|
737
|
+
<div id="wf-update-row" class="wf-update-row"></div>
|
|
738
|
+
<div id="wf-update-announce" class="sr-only" role="status" aria-live="polite"></div>
|
|
732
739
|
<div class="modal-actions">
|
|
733
740
|
<button data-command-id="shell.dialog-cancel#the workflow update" id="wf-update-cancel">Not now</button>
|
|
734
|
-
<button data-command-id="shell.workflow-update-
|
|
741
|
+
<button data-command-id="shell.workflow-update-keep-mine#the open workflow" id="wf-update-ai" type="button" hidden data-tip="Asks the AI chat to bring your changes into the new version. Nothing changes until you send it.">Keep my changes (AI)</button>
|
|
742
|
+
<button data-command-id="shell.workflow-update-apply#the open workflow" data-command-instance-label="the open workflow" id="wf-update-ok" class="primary">Update</button>
|
|
735
743
|
</div>
|
|
736
744
|
</div>
|
|
737
745
|
</div>
|
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
19
|
+
const toast = (msg, kind) => { if (typeof window.showToast === 'function') window.showToast(msg, kind); };
|
|
19
20
|
const PAGE = 100;
|
|
20
21
|
|
|
21
22
|
/** The areas, in the order the owner ruled ("By area", 2026-10-24). A kind this build doesn't name is Other activity. */
|
|
22
23
|
const AREAS = [
|
|
23
24
|
{ key: 'project', label: 'Project', test: (k) => k === 'project-created' },
|
|
24
25
|
{ key: 'knowledge', label: 'Knowledge', test: (k) => k.startsWith('knowledge-') || k.startsWith('design-set-') || k.startsWith('design-issue-') },
|
|
25
|
-
{ key: 'workflows', label: 'Workflows', test: (k) => k.startsWith('workflow-') },
|
|
26
|
+
{ key: 'workflows', label: 'Workflows', test: (k) => k.startsWith('workflow-') || k.startsWith('watcher-') },
|
|
26
27
|
{ key: 'rfis', label: 'RFIs', test: (k) => k.startsWith('rfi-') },
|
|
27
28
|
{ key: 'linked', label: 'Linked projects', test: (k) => k === 'module-linked' || k === 'module-unlinked' },
|
|
28
29
|
{ key: 'requests', label: 'Requests', test: (k) => k === 'request-changed' },
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
const KNOWN = new Set(['project-created', 'knowledge-organized', 'knowledge-source-added', 'knowledge-source-removed',
|
|
31
32
|
'design-set-registered', 'design-set-cleared', 'design-issue-added', 'design-issue-updated', 'design-issue-withdrawn',
|
|
32
33
|
'design-issue-restored', 'workflow-created', 'workflow-compiled', 'workflow-run-finished', 'rfi-raised', 'rfi-answered',
|
|
33
|
-
'rfi-closed', 'module-linked', 'module-unlinked', 'request-changed']);
|
|
34
|
+
'rfi-closed', 'module-linked', 'module-unlinked', 'request-changed', 'watcher-started', 'watcher-reported', 'watcher-stopped']);
|
|
34
35
|
const OTHER = { key: 'other', label: 'Other activity' };
|
|
35
36
|
const areaOf = (entry) => {
|
|
36
37
|
const kind = String(entry?.event?.kind || '');
|
|
@@ -46,6 +47,11 @@
|
|
|
46
47
|
};
|
|
47
48
|
const ROUTINE_TIP = 'Started by a routine on its schedule, or by Run now on that routine.';
|
|
48
49
|
const FAILED_TIP = 'This didn’t finish. Open the workflow or the request to see what went wrong, then try it again.';
|
|
50
|
+
// A watcher’s failed reaction or error stop (#2470 R6.5c): there is no request to open, and nothing to “try again” by hand.
|
|
51
|
+
const WATCHER_FAILED_TIPS = {
|
|
52
|
+
'watcher-reported': 'This event wasn’t handled. Open the workflow to see what went wrong.',
|
|
53
|
+
'watcher-stopped': 'The watcher stopped because of an error. Open the workflow to see what went wrong, then start it again.',
|
|
54
|
+
};
|
|
49
55
|
|
|
50
56
|
const S = {
|
|
51
57
|
loading: 'Reading history…',
|
|
@@ -57,6 +63,23 @@
|
|
|
57
63
|
noAuthor: 'Older events and some automatic ones don’t show who did them.',
|
|
58
64
|
stale: 'Couldn’t refresh the history, so this is what was read before. Try again in a moment.',
|
|
59
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* The words that differ on a module project (#2470 R6.5b), where this is the Activity view beside the approval ledger:
|
|
68
|
+
* a module project links no modules, and its approved versions are in the other view.
|
|
69
|
+
*/
|
|
70
|
+
const VARIANTS = {
|
|
71
|
+
general: { aria: 'Project history', sub: 'What happened in this project, newest first: when, and from where.', empty: S.empty,
|
|
72
|
+
loading: S.loading, unavailable: S.unavailable, failed: S.failed },
|
|
73
|
+
module: {
|
|
74
|
+
aria: 'Project activity',
|
|
75
|
+
sub: 'What happened in this project, newest first: when, and from where. Approved versions are under Approvals.',
|
|
76
|
+
empty: 'Nothing has been recorded in this project yet. Adding knowledge, creating a workflow or raising an RFI shows up here.',
|
|
77
|
+
// “History” is the ledger’s word on these projects, so the states say “activity”.
|
|
78
|
+
loading: 'Reading activity…',
|
|
79
|
+
unavailable: 'Activity isn’t available right now.',
|
|
80
|
+
failed: 'FloLess couldn’t read this project’s activity. Check that FloLess is running, then try again.',
|
|
81
|
+
},
|
|
82
|
+
};
|
|
60
83
|
|
|
61
84
|
const when = (iso) => {
|
|
62
85
|
const t = Date.parse(iso);
|
|
@@ -75,7 +98,7 @@
|
|
|
75
98
|
if (!st || st.identity !== identityOf(project)) {
|
|
76
99
|
st = { identity: identityOf(project), projectId: project.id, uuid: null, rootId: null, entries: [], loaded: false,
|
|
77
100
|
nextBefore: null, unavailable: '', error: '', stale: false, earlierError: false, cursorGone: false, earlierBusy: false, firstBusy: false,
|
|
78
|
-
announce: '', query: '', open: new Map(), clicked: null, token: 0 };
|
|
101
|
+
announce: '', query: '', open: new Map(), expanded: new Set(), clicked: null, token: 0 };
|
|
79
102
|
states.set(pane, st);
|
|
80
103
|
}
|
|
81
104
|
st.project = project;
|
|
@@ -83,13 +106,15 @@
|
|
|
83
106
|
}
|
|
84
107
|
|
|
85
108
|
function skeleton(pane, st) {
|
|
86
|
-
|
|
109
|
+
const words = VARIANTS[st.variant];
|
|
110
|
+
if (pane.dataset.phIdentity === st.identity && pane.dataset.phVariant === st.variant && pane.querySelector('.ph-list-host')) return;
|
|
87
111
|
pane.dataset.phProject = st.projectId;
|
|
88
112
|
pane.dataset.phIdentity = st.identity;
|
|
113
|
+
pane.dataset.phVariant = st.variant;
|
|
89
114
|
pane.setAttribute('role', 'region');
|
|
90
|
-
pane.setAttribute('aria-label',
|
|
115
|
+
pane.setAttribute('aria-label', words.aria);
|
|
91
116
|
pane.innerHTML = '<div class="step-head"><span>History</span></div>'
|
|
92
|
-
+
|
|
117
|
+
+ `<p class="pg-sub">${esc(words.sub)}</p>`
|
|
93
118
|
+ '<div class="ph-tools" hidden><input type="search" class="ws-landing-search ph-search" data-ph-search="1" placeholder="Search history"'
|
|
94
119
|
+ ' aria-label="Search history" autocomplete="off" data-command-id="shell.project-history-search">'
|
|
95
120
|
+ '<p class="rh-cut ph-note" hidden></p></div>'
|
|
@@ -111,22 +136,107 @@
|
|
|
111
136
|
return `<span class="${a.pill ? 'rh-pill ph-author' : 'ph-author ph-author-you'}" tabindex="0" data-tip="${esc(a.tip)}" aria-label="${esc(a.aria)}">${esc(a.label)}</span>`;
|
|
112
137
|
}
|
|
113
138
|
|
|
114
|
-
|
|
139
|
+
/* ── A watcher reaction's detail (#2470 R6.5c): the event as its source reported it, and what each step did ────── */
|
|
140
|
+
|
|
141
|
+
// The names a person reads for the fields a source commonly reports; any other field shows under its own name.
|
|
142
|
+
const FIELD_LABELS = { change: 'Change', type: 'Object type', mark: 'Mark', guid: 'GUID', host: 'Host', delivered_at: 'Raised at' };
|
|
143
|
+
const STEP_OUTCOMES = {
|
|
144
|
+
done: { label: 'Done', cls: 'rh-succeeded' },
|
|
145
|
+
report: { label: 'Made a report', cls: 'rh-succeeded' },
|
|
146
|
+
failed: { label: 'Failed', cls: 'rh-failed' },
|
|
147
|
+
unfinished: { label: 'Didn’t finish', cls: 'rh-stopped' },
|
|
148
|
+
};
|
|
149
|
+
const DETAIL_TIP = { show: 'Show what changed and what the workflow did', hide: 'Hide the details' };
|
|
150
|
+
const IN_DETAILS_TIP = 'Your search was found in this event’s details. Open the row to see it.';
|
|
151
|
+
const own = (map, key) => typeof key === 'string' && Object.prototype.hasOwnProperty.call(map, key);
|
|
152
|
+
const fieldLabel = (key) => (own(FIELD_LABELS, key) && FIELD_LABELS[key])
|
|
153
|
+
|| (key.replace(/[_.-]+/g, ' ').replace(/([a-z0-9])([A-Z])/g, '$1 $2').trim().replace(/^./, (c) => c.toUpperCase()) || key);
|
|
154
|
+
const fieldValue = (key, value) => {
|
|
155
|
+
if (typeof value === 'boolean') return value ? 'yes' : 'no';
|
|
156
|
+
if (key === 'delivered_at' && typeof value === 'string') return when(value) || value;
|
|
157
|
+
return String(value);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The detail a row carries, or null: only a reaction row has one, and only one FloLess wrote with details. Read
|
|
162
|
+
* defensively, as a line in the file may have been edited by hand: only plain values of the expected types are kept.
|
|
163
|
+
*/
|
|
164
|
+
function detailOf(e) {
|
|
165
|
+
const d = e?.event?.kind === 'watcher-reported' ? e.detail : null;
|
|
166
|
+
if (!d || typeof d !== 'object') return null;
|
|
167
|
+
const reported = d.reported && typeof d.reported === 'object' && !Array.isArray(d.reported)
|
|
168
|
+
? Object.entries(d.reported).filter(([, v]) => typeof v === 'string' || typeof v === 'boolean' || (typeof v === 'number' && Number.isFinite(v))) : [];
|
|
169
|
+
const steps = (Array.isArray(d.steps) ? d.steps : [])
|
|
170
|
+
.filter((s) => s && typeof s === 'object' && typeof s.node === 'string' && own(STEP_OUTCOMES, s.outcome))
|
|
171
|
+
.map((s) => ({ node: s.node, outcome: s.outcome, error: typeof s.error === 'string' ? s.error : '' }));
|
|
172
|
+
const count = (n) => (Number.isSafeInteger(n) && n > 0 ? n : 0);
|
|
173
|
+
const more = count(d.moreSteps);
|
|
174
|
+
const moreFields = count(d.moreFields);
|
|
175
|
+
return reported.length || steps.length || more || moreFields ? { reported, steps, more, moreFields } : null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const detailWords = (d) => (d ? [
|
|
179
|
+
...d.reported.flatMap(([k, v]) => [fieldLabel(k), fieldValue(k, v)]),
|
|
180
|
+
...d.steps.flatMap((s) => [s.node, STEP_OUTCOMES[s.outcome].label, s.error || '']),
|
|
181
|
+
].join(' ') : '');
|
|
182
|
+
|
|
183
|
+
function detailHtml(e, d, open) {
|
|
184
|
+
const kv = (d.reported.length
|
|
185
|
+
? `<dl class="ph-kv">${d.reported.map(([k, v]) => `<dt>${esc(fieldLabel(k))}</dt><dd>${esc(fieldValue(k, v))}</dd>`).join('')}</dl>`
|
|
186
|
+
: d.moreFields ? '' : '<p class="ph-sub-note">The source reported no details.</p>')
|
|
187
|
+
+ (d.moreFields ? `<p class="ph-sub-note">${d.moreFields} more field${d.moreFields === 1 ? ' wasn’t' : 's weren’t'} kept, to keep the history small.</p>` : '');
|
|
188
|
+
const steps = d.steps.length
|
|
189
|
+
? `<ol class="ph-steps">${d.steps.map((s) => {
|
|
190
|
+
const o = STEP_OUTCOMES[s.outcome];
|
|
191
|
+
return `<li class="ph-step"><span class="ph-step-id">Step “${esc(s.node)}”</span><span class="rh-outcome ${o.cls}">${esc(o.label)}</span>`
|
|
192
|
+
+ (s.outcome === 'failed' && s.error ? `<p class="ph-step-err">${esc(s.error)}</p>` : '') + '</li>';
|
|
193
|
+
}).join('')}${d.more ? `<li class="ph-sub-note">and ${d.more} more step${d.more === 1 ? '' : 's'}</li>` : ''}</ol>`
|
|
194
|
+
: d.more
|
|
195
|
+
? `<p class="ph-sub-note">${d.more} step${d.more === 1 ? ' wasn’t' : 's weren’t'} kept, to keep the history small.</p>`
|
|
196
|
+
: '<p class="ph-sub-note">No steps after the source were recorded.</p>';
|
|
197
|
+
const workflowId = typeof e.event?.workflowId === 'string' ? e.event.workflowId : '';
|
|
198
|
+
const open_ = workflowId
|
|
199
|
+
? `<div class="ph-detail-actions"><button type="button" class="btn-mini rh-btn" data-ph-act="open-workflow" data-ph-workflow="${esc(workflowId)}"`
|
|
200
|
+
+ ` data-command-id="shell.project-history-open#${esc(e.id)}" data-command-instance-label="${esc(when(e.at))}"`
|
|
201
|
+
+ ' data-tip="Opens this workflow. Its Execution tab shows the run.">Open workflow</button></div>'
|
|
202
|
+
: '';
|
|
203
|
+
return `<div class="ph-detail" id="ph-d-${esc(e.id)}"${open ? '' : ' hidden'}>`
|
|
204
|
+
+ `<section><h4 class="ph-sub-h">What changed</h4>${kv}</section>`
|
|
205
|
+
+ `<section><h4 class="ph-sub-h">What the workflow did</h4>${steps}</section>${open_}</div>`;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function rowHtml(e, st, opts) {
|
|
115
209
|
const failed = e.event?.outcome === 'failed';
|
|
210
|
+
const d = detailOf(e);
|
|
211
|
+
const open = !!d && st.expanded.has(e.id);
|
|
116
212
|
const labels = [
|
|
213
|
+
opts.inDetails ? `<span class="rh-pill" tabindex="0" data-tip="${esc(IN_DETAILS_TIP)}">In details</span>` : '',
|
|
117
214
|
authorHtml(e.actor),
|
|
118
|
-
failed ? `<span class="rh-outcome rh-failed" tabindex="0" data-tip="${esc(FAILED_TIP)}">Failed</span>` : '',
|
|
215
|
+
failed ? `<span class="rh-outcome rh-failed" tabindex="0" data-tip="${esc(WATCHER_FAILED_TIPS[e.event?.kind] || FAILED_TIP)}">Failed</span>` : '',
|
|
119
216
|
e.event?.trigger === 'routine' ? `<span class="rh-pill" tabindex="0" data-tip="${esc(ROUTINE_TIP)}">Routine</span>` : '',
|
|
120
217
|
].join('');
|
|
218
|
+
// The toggle's name stays the same; its state is aria-expanded. A list with any toggle keeps every time aligned.
|
|
219
|
+
const toggle = d
|
|
220
|
+
? `<button type="button" class="ph-toggle" aria-expanded="${open}" aria-controls="ph-d-${esc(e.id)}"`
|
|
221
|
+
+ ` aria-label="${esc(`Details: ${e.text || 'event'}, ${when(e.at)}`)}" data-tip="${esc(open ? DETAIL_TIP.hide : DETAIL_TIP.show)}"`
|
|
222
|
+
+ ` data-ph-act="detail" data-ph-id="${esc(e.id)}" data-command-id="shell.project-history-detail#${esc(e.id)}"`
|
|
223
|
+
+ ` data-command-instance-label="${esc(when(e.at))}"><span class="hd-caret" aria-hidden="true">▸</span></button>`
|
|
224
|
+
: (opts.slot ? '<span class="ph-toggle-slot" aria-hidden="true"></span>' : '');
|
|
121
225
|
// The sentence is set as text after the markup is in place (paintList): it is the server's words, never markup.
|
|
122
226
|
return `<div class="ph-row${failed ? ' is-failed' : ''}" role="listitem" data-ph-entry="${esc(e.id)}">`
|
|
123
|
-
+ `<time class="rh-when" datetime="${esc(e.at)}">${esc(when(e.at))}</time>`
|
|
227
|
+
+ `<span class="ph-when">${toggle}<time class="rh-when" datetime="${esc(e.at)}">${esc(when(e.at))}</time></span>`
|
|
124
228
|
+ '<span class="ph-text"></span>'
|
|
125
|
-
+ `<span class="ph-labels">${labels}</span
|
|
229
|
+
+ `<span class="ph-labels">${labels}</span>${d ? detailHtml(e, d, open) : ''}</div>`;
|
|
126
230
|
}
|
|
127
231
|
|
|
128
232
|
const authorLabel = (e) => AUTHORS[e.actor]?.label || '';
|
|
129
|
-
const
|
|
233
|
+
const rowWords = (e, area) => `${e.text || ''} ${area.label} ${authorLabel(e)}`.toLowerCase();
|
|
234
|
+
// A row matches when every term is in its sentence, area, author or — for a reaction — its details.
|
|
235
|
+
const matches = (e, area, terms) => {
|
|
236
|
+
const words = `${rowWords(e, area)} ${detailWords(detailOf(e)).toLowerCase()}`;
|
|
237
|
+
return terms.every((t) => words.includes(t));
|
|
238
|
+
};
|
|
239
|
+
const onlyInDetails = (e, area, terms) => terms.length > 0 && !terms.every((t) => rowWords(e, area).includes(t));
|
|
130
240
|
|
|
131
241
|
function paint(pane) {
|
|
132
242
|
const st = states.get(pane);
|
|
@@ -147,14 +257,14 @@
|
|
|
147
257
|
host.querySelector('.ph-said').textContent = st.error;
|
|
148
258
|
} else {
|
|
149
259
|
pane.dataset.phState = 'loading';
|
|
150
|
-
host.innerHTML = `<p class="pg-loading-line" role="status">${esc(
|
|
260
|
+
host.innerHTML = `<p class="pg-loading-line" role="status">${esc(VARIANTS[st.variant].loading)}</p>`;
|
|
151
261
|
}
|
|
152
262
|
return;
|
|
153
263
|
}
|
|
154
264
|
if (st.unavailable) {
|
|
155
265
|
pane.dataset.phState = 'unavailable';
|
|
156
266
|
tools.hidden = true;
|
|
157
|
-
host.innerHTML = `<div class="pg-empty" role="status"><p>${esc(
|
|
267
|
+
host.innerHTML = `<div class="pg-empty" role="status"><p>${esc(VARIANTS[st.variant].unavailable)}</p><p class="ph-said"></p><p>${RETRY}</p></div>`;
|
|
158
268
|
host.querySelector('.ph-said').textContent = st.unavailable;
|
|
159
269
|
return;
|
|
160
270
|
}
|
|
@@ -163,7 +273,7 @@
|
|
|
163
273
|
tools.hidden = true;
|
|
164
274
|
// An empty list read before is not proof that nothing happened since: a failed refresh says so here too.
|
|
165
275
|
host.innerHTML = (st.stale ? `<div class="pg-wf-note ph-stale" role="status"><span>${esc(S.stale)}</span> ${RETRY}</div>` : '')
|
|
166
|
-
+ `<div class="pg-empty"><p>${esc(
|
|
276
|
+
+ `<div class="pg-empty"><p>${esc(VARIANTS[st.variant].empty)}</p></div>`;
|
|
167
277
|
return;
|
|
168
278
|
}
|
|
169
279
|
pane.dataset.phState = 'ready';
|
|
@@ -187,7 +297,9 @@
|
|
|
187
297
|
+ `<span class="ws-archived-caret hd-caret" aria-hidden="true">▸</span><span class="rh-sum-name">${esc(area.label)}</span>`
|
|
188
298
|
+ `<span class="rh-sum-meta">${rows.length} event${rows.length === 1 ? '' : 's'}</span>`
|
|
189
299
|
+ `<span class="rh-sum-meta">Latest ${esc(when(rows[0].at))}</span></summary>`
|
|
190
|
-
+ `<div class="rh-list ph-list" role="list" aria-label="${esc(`${area.label} events`)}"
|
|
300
|
+
+ `<div class="rh-list ph-list" role="list" aria-label="${esc(`${area.label} events`)}">`
|
|
301
|
+
+ rows.map((e) => rowHtml(e, st, { slot: rows.some((r) => detailOf(r)), inDetails: onlyInDetails(e, area, terms) })).join('')
|
|
302
|
+
+ '</div></details>';
|
|
191
303
|
}).join('');
|
|
192
304
|
const byId = new Map(st.entries.map((e) => [e.id, e]));
|
|
193
305
|
host.querySelectorAll('[data-ph-entry]').forEach((row) => { row.querySelector('.ph-text').textContent = byId.get(row.dataset.phEntry)?.text || ''; });
|
|
@@ -232,7 +344,7 @@
|
|
|
232
344
|
// Keep what is shown, and say it may be out of date.
|
|
233
345
|
if (st.loaded && !st.unavailable) { st.stale = true; paint(pane); return; }
|
|
234
346
|
st.loaded = false;
|
|
235
|
-
st.error = typeof err?.body?.error === 'string' && err.body.error ? err.body.error :
|
|
347
|
+
st.error = typeof err?.body?.error === 'string' && err.body.error ? err.body.error : VARIANTS[st.variant].failed;
|
|
236
348
|
paint(pane);
|
|
237
349
|
return;
|
|
238
350
|
}
|
|
@@ -241,7 +353,7 @@
|
|
|
241
353
|
const uuid = body.project?.uuid ?? null;
|
|
242
354
|
const rootId = body.rootId ?? null;
|
|
243
355
|
// Another incarnation or Workspace folder than the rows shown: what the person opened or closed was about those.
|
|
244
|
-
if (st.loaded && (uuid !== st.uuid || rootId !== st.rootId)) st.open = new Map();
|
|
356
|
+
if (st.loaded && (uuid !== st.uuid || rootId !== st.rootId)) { st.open = new Map(); st.expanded = new Set(); }
|
|
245
357
|
st.error = '';
|
|
246
358
|
st.stale = false;
|
|
247
359
|
st.loaded = true;
|
|
@@ -298,6 +410,32 @@
|
|
|
298
410
|
else if (fresh.length) pane.querySelector(`[data-ph-entry="${CSS.escape(fresh[0].id)}"]`)?.closest('details')?.querySelector('summary')?.focus({ preventScroll: true });
|
|
299
411
|
}
|
|
300
412
|
|
|
413
|
+
// Opened or closed in place (no repaint, so focus, scroll and a half-made selection stay), and remembered for repaints.
|
|
414
|
+
function toggleDetail(pane, st, button) {
|
|
415
|
+
const id = button.dataset.phId;
|
|
416
|
+
const panel = pane.querySelector(`#${CSS.escape(`ph-d-${id}`)}`);
|
|
417
|
+
if (!id || !panel) return;
|
|
418
|
+
const open = button.getAttribute('aria-expanded') !== 'true';
|
|
419
|
+
if (open) st.expanded.add(id); else st.expanded.delete(id);
|
|
420
|
+
button.setAttribute('aria-expanded', String(open));
|
|
421
|
+
button.dataset.tip = open ? DETAIL_TIP.hide : DETAIL_TIP.show;
|
|
422
|
+
panel.hidden = !open;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
let opening = false;
|
|
426
|
+
async function openWorkflow(workflowId) {
|
|
427
|
+
if (opening || !workflowId) return;
|
|
428
|
+
opening = true;
|
|
429
|
+
try {
|
|
430
|
+
const b = bridge();
|
|
431
|
+
if (typeof b.openOwnedWorkflow !== 'function') throw new Error('this window cannot open workflows');
|
|
432
|
+
await b.openOwnedWorkflow(workflowId);
|
|
433
|
+
} catch (error) {
|
|
434
|
+
console.warn('[project-history] a workflow could not be opened', error);
|
|
435
|
+
toast('FloLess couldn’t open that workflow. It may have been archived or removed since. Open it from the project’s Workflows step.', 'warn');
|
|
436
|
+
} finally { opening = false; }
|
|
437
|
+
}
|
|
438
|
+
|
|
301
439
|
const wired = new WeakSet();
|
|
302
440
|
function wire(pane) {
|
|
303
441
|
if (wired.has(pane)) return;
|
|
@@ -314,6 +452,8 @@
|
|
|
314
452
|
if (event.target.closest('.rh-summary')) st.clicked = event.target.closest('.ph-section')?.dataset.phArea ?? null;
|
|
315
453
|
const act = event.target.closest('[data-ph-act]');
|
|
316
454
|
if (!act) return;
|
|
455
|
+
if (act.dataset.phAct === 'detail') { toggleDetail(pane, st, act); return; }
|
|
456
|
+
if (act.dataset.phAct === 'open-workflow') { void openWorkflow(act.dataset.phWorkflow); return; }
|
|
317
457
|
if (act.dataset.phAct === 'retry') { st.error = ''; const read = loadFirst(pane); paint(pane); void read; }
|
|
318
458
|
else if (act.dataset.phAct === 'earlier') void loadEarlier(pane);
|
|
319
459
|
else if (act.dataset.phAct === 'reread') { st.cursorGone = false; const read = loadFirst(pane); paint(pane); void read; }
|
|
@@ -332,10 +472,14 @@
|
|
|
332
472
|
});
|
|
333
473
|
}
|
|
334
474
|
|
|
335
|
-
/**
|
|
336
|
-
|
|
475
|
+
/**
|
|
476
|
+
* Show `project`'s history in `pane` (the step was opened): the cache at once, then a fresh read of the newest page.
|
|
477
|
+
* `opts.variant` 'module' is the Activity view of a module project's History step (#2470 R6.5b); it changes words only.
|
|
478
|
+
*/
|
|
479
|
+
function render(pane, project, opts) {
|
|
337
480
|
if (!pane || !project?.id) return;
|
|
338
481
|
const st = stateFor(pane, project);
|
|
482
|
+
st.variant = opts?.variant === 'module' ? 'module' : 'general';
|
|
339
483
|
skeleton(pane, st);
|
|
340
484
|
const input = pane.querySelector('[data-ph-search]');
|
|
341
485
|
if (input && input.value !== st.query) input.value = st.query;
|
|
@@ -353,6 +353,11 @@
|
|
|
353
353
|
}
|
|
354
354
|
if (moduleLink.ok === false) {
|
|
355
355
|
if (moduleLink.code === 'link-declined') { toast(`“${project.name}” was created. You chose not to link it, so it stays unlinked.`, 'info'); return; }
|
|
356
|
+
// #2470 R6.7b: the link couldn't be made when it was started from chat, and the person chose to go on without it.
|
|
357
|
+
if (moduleLink.code === 'link-skipped') {
|
|
358
|
+
toast(`“${project.name}” was created without a link to ${general}. You can link it from that project’s Modules step.${next ? ` ${next}` : ''}`, 'info', { action: back });
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
356
361
|
toast(moduleLink.code === 'link-removed'
|
|
357
362
|
? `“${project.name}” was made by an earlier try. Its link was removed since, so it stays unlinked.`
|
|
358
363
|
: `“${project.name}” was created but couldn’t be linked to ${general}. Nothing was lost; you can link it from the Modules step. ${moduleLink.error || ''}`.trim(),
|