@floless/app 0.169.0 → 0.171.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/floless-server.cjs +65531 -43728
  2. package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
  3. package/dist/schemas/steel.model.v2.schema.json +196 -4
  4. package/dist/skills/floless-app-bridge/SKILL.md +3 -3
  5. package/dist/skills/floless-app-knowledge/SKILL.md +46 -15
  6. package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
  7. package/dist/skills/floless-app-onboarding/SKILL.md +5 -4
  8. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +0 -3
  9. package/dist/skills/floless-app-queue/SKILL.md +2 -3
  10. package/dist/skills/floless-app-report-issue/SKILL.md +2 -2
  11. package/dist/skills/floless-app-routines/SKILL.md +2 -2
  12. package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
  13. package/dist/skills/floless-app-steel-model/SKILL.md +42 -39
  14. package/dist/skills/floless-app-steel-model/references/custom-connections.md +47 -0
  15. package/dist/skills/floless-app-steel-model/references/custom-sections.md +32 -0
  16. package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
  17. package/dist/skills/floless-app-ui/SKILL.md +71 -126
  18. package/dist/skills/floless-app-workflows/SKILL.md +22 -3
  19. package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
  20. package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
  21. package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
  22. package/dist/web/add-ons.js +407 -0
  23. package/dist/web/agent-steps.js +89 -18
  24. package/dist/web/agents.js +32 -22
  25. package/dist/web/analytics.js +1 -1
  26. package/dist/web/app.css +331 -190
  27. package/dist/web/app.js +33 -13
  28. package/dist/web/aware.js +926 -218
  29. package/dist/web/chat.css +6 -1
  30. package/dist/web/chat.js +316 -112
  31. package/dist/web/checkpoint-standard.js +5 -3
  32. package/dist/web/commands-drawing-check.js +1 -0
  33. package/dist/web/commands-filter.js +23 -0
  34. package/dist/web/commands-shell.js +479 -78
  35. package/dist/web/commands-steel.js +69 -2
  36. package/dist/web/commands-tekla-parser.js +23 -0
  37. package/dist/web/connections.js +14 -3
  38. package/dist/web/drawing-check-editor.js +352 -88
  39. package/dist/web/failure-copy.js +33 -2
  40. package/dist/web/filter-ai-proposal.js +11 -8
  41. package/dist/web/flo-3d.js +1 -1
  42. package/dist/web/guide.js +36 -29
  43. package/dist/web/index.html +98 -57
  44. package/dist/web/instructor.js +101 -17
  45. package/dist/web/kb-categories.js +64 -7
  46. package/dist/web/left-pane.js +4 -1
  47. package/dist/web/local-discovery.js +8 -7
  48. package/dist/web/missed-routines.js +239 -0
  49. package/dist/web/model-change-findings.js +430 -0
  50. package/dist/web/model-change-review.js +414 -0
  51. package/dist/web/model-editor-steel-adapter.js +2 -2
  52. package/dist/web/model-measure.js +6 -0
  53. package/dist/web/model-spatial-panel.js +19 -4
  54. package/dist/web/model-spatial-tools.js +3 -3
  55. package/dist/web/model-viewport-revit-adapter.js +3 -3
  56. package/dist/web/origin-rule.js +155 -0
  57. package/dist/web/project-access.js +1 -1
  58. package/dist/web/project-history.js +7 -1
  59. package/dist/web/project-modules.js +2 -2
  60. package/dist/web/project-rfis.js +6 -1
  61. package/dist/web/project-workflows.js +2 -2
  62. package/dist/web/revit-editor.css +85 -0
  63. package/dist/web/revit-editor.js +58 -9
  64. package/dist/web/run-history.js +12 -1
  65. package/dist/web/sha256-sync.js +62 -0
  66. package/dist/web/steel-3d-core.js +46 -9
  67. package/dist/web/steel-3d-flo.js +153 -7
  68. package/dist/web/steel-3d-view.js +33 -5
  69. package/dist/web/steel-ai-marks.js +3 -1
  70. package/dist/web/steel-custom-connection.js +161 -0
  71. package/dist/web/steel-custom-sections.js +1796 -0
  72. package/dist/web/steel-editor.html +732 -161
  73. package/dist/web/steel-environments.js +297 -0
  74. package/dist/web/steel-filter-usage.js +299 -0
  75. package/dist/web/steel-filter.html +104 -6
  76. package/dist/web/steel-model-v2-client-validation.js +11 -1
  77. package/dist/web/steel-model-v2-commands.js +116 -13
  78. package/dist/web/steel-model-v2-projection.js +1 -1
  79. package/dist/web/steel-read-confidence.js +1 -56
  80. package/dist/web/step-rename.js +3 -2
  81. package/dist/web/tekla-editor.html +1 -0
  82. package/dist/web/terminal-requests.js +1 -1
  83. package/dist/web/tool-updates.js +7 -6
  84. package/dist/web/workspaces.js +1968 -138
  85. package/launch.mjs +87 -9
  86. package/package.json +4 -1
  87. package/dist/web/panels.js +0 -831
@@ -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(error instanceof Error && error.message && !/request failed/.test(error.message) ? error.message : 'FloLess could not open that just now. Try again.', 'warn');
490
+ toast(errorText(error, { action: 'open that', retrySafe: true }), 'warn');
491
491
  }
492
492
  }
493
493
 
@@ -25,14 +25,20 @@
25
25
  { key: 'project', label: 'Project', test: (k) => k === 'project-created' },
26
26
  { key: 'knowledge', label: 'Knowledge', test: (k) => k.startsWith('knowledge-') || k.startsWith('design-set-') || k.startsWith('design-issue-') },
27
27
  { key: 'workflows', label: 'Workflows', test: (k) => k.startsWith('workflow-') || k.startsWith('watcher-') },
28
+ // #3415: an Agent run reaching this project (from the Agents tab, or a routine that runs an agent).
29
+ { key: 'agents', label: 'Agents', test: (k) => k === 'agent-run-started' },
28
30
  { key: 'rfis', label: 'RFIs', test: (k) => k.startsWith('rfi-') },
29
31
  { key: 'linked', label: 'Linked projects', test: (k) => k === 'module-linked' || k === 'module-unlinked' },
30
32
  { key: 'requests', label: 'Requests', test: (k) => k === 'request-changed' },
31
33
  ];
32
34
  const KNOWN = new Set(['project-created', 'knowledge-organized', 'knowledge-source-added', 'knowledge-source-removed',
35
+ // #3415: a connected source (Teams chat, Outlook folder, Trimble Connect project) is project knowledge too.
36
+ 'knowledge-connected-added', 'knowledge-connected-synced', 'knowledge-connected-removed', 'knowledge-connected-rebound',
37
+ 'knowledge-connected-erase-started', 'knowledge-connected-erased',
33
38
  'design-set-registered', 'design-set-cleared', 'design-issue-added', 'design-issue-updated', 'design-issue-withdrawn',
34
39
  'design-issue-restored', 'workflow-created', 'workflow-compiled', 'workflow-run-finished', 'rfi-raised', 'rfi-answered',
35
- 'rfi-closed', 'module-linked', 'module-unlinked', 'request-changed', 'watcher-started', 'watcher-reported', 'watcher-stopped']);
40
+ 'rfi-closed', 'module-linked', 'module-unlinked', 'request-changed', 'watcher-started', 'watcher-reported', 'watcher-stopped',
41
+ 'agent-run-started']);
36
42
  const OTHER = { key: 'other', label: 'Other activity' };
37
43
  const areaOf = (entry) => {
38
44
  const kind = String(entry?.event?.kind || '');
@@ -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?.message || 'FloLess couldn’t open that project. Open it from Workspaces.', 'warn')) };
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?.message || 'FloLess couldn’t open that project. Try again, or open it from Workspaces.', 'warn');
402
+ toast(errorText(error, { action: 'open that project', retrySafe: true }), 'warn');
403
403
  void load();
404
404
  });
405
405
  return;
@@ -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 announce(data.message || 'FloLess couldn’t load this project’s RFIs.');
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?.message || 'FloLess couldn’t open New workflow.', 'warn');
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 };
@@ -74,3 +74,88 @@ body:has(.editor-root[data-model-state="empty"]) .read-only-chip{display:none}
74
74
  .chat-q-failed{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:11px;color:var(--muted)}
75
75
  /* #1836: the files a read went without, above the findings they cause. Not sticky: the summary below it is. */
76
76
  .tekla-audit-sources{display:block;position:static;padding:4px 9px 6px;border-bottom:1px solid var(--line)}.tekla-audit-sources .tekla-audit-state{padding:6px 0 2px;text-align:left}.tekla-audit-sources .tekla-audit-inspector-item{padding:6px 0}.tekla-audit-sources .tekla-audit-inspector-item p{font-size:11px}
77
+
78
+ /* #3352 Changes tab (Change Review): reuses the Audit tab's language; only what Audit has no equivalent for is new. */
79
+ .tekla-changes-host{overflow:auto;padding:0 0 10px}
80
+ .tekla-changes-controls{display:flex;flex-direction:column;gap:7px;padding:8px 7px;border-bottom:1px solid var(--line);background:var(--panel)}
81
+ .tekla-changes-picker{position:relative;display:flex;flex-direction:column;gap:3px}
82
+ .tekla-changes-picker-label{color:var(--muted);font-size:10px}
83
+ .tekla-changes-trigger{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;min-height:40px;padding:6px 8px;text-align:left}
84
+ .tekla-changes-trigger span,.tekla-changes-option span{color:var(--muted);font-size:10px}
85
+ .tekla-changes-trigger::after{content:'';position:absolute;right:10px;bottom:16px;border:4px solid transparent;border-top-color:var(--muted)}
86
+ .tekla-changes-options{position:absolute;z-index:5;top:100%;left:0;right:0;max-height:240px;overflow:auto;margin-top:3px;padding:4px;border:1px solid var(--line-strong);border-radius:6px;background:var(--panel-2);box-shadow:var(--shadow)}
87
+ .tekla-changes-option{display:flex;flex-direction:column;gap:2px;padding:6px 7px;border-radius:5px;cursor:pointer}
88
+ .tekla-changes-option:hover,.tekla-changes-option:focus{outline:none;background:var(--btn-hover)}
89
+ .tekla-changes-option[aria-selected="true"]{background:var(--accent-soft);color:var(--selected-ink)}
90
+ .tekla-changes-option[aria-disabled="true"]{cursor:default;opacity:.65}
91
+ .tekla-changes-option-note{white-space:normal}
92
+ .tekla-changes-compare{width:100%;min-height:30px;font-weight:600}
93
+ .tekla-changes-result-title{margin:10px 9px 2px;font-size:12px;line-height:1.35}
94
+ .tekla-changes-result-title:focus{outline:2px solid var(--accent);outline-offset:2px}
95
+ .tekla-changes-metrics{position:static;grid-template-columns:1fr 1fr 1fr}
96
+ .tekla-changes-host>.tekla-audit-omissions{padding:3px 9px}
97
+ .tekla-changes-banner{display:flex;flex-direction:column;gap:3px;margin:6px 7px;padding:7px 8px;border:1px solid var(--line);border-left:3px solid var(--danger);border-radius:6px;background:var(--panel-2);font-size:11px;line-height:1.4}
98
+ .tekla-changes-banner span{color:var(--muted)}
99
+ .tekla-changes-unchecked{margin:6px 7px;padding:6px 8px;border:1px dashed var(--line-strong);border-radius:6px}
100
+ .tekla-changes-unchecked strong{font-size:11px}
101
+ .tekla-changes-unchecked .tekla-audit-omissions{padding:3px 0}
102
+ .tekla-changes-list{flex:0 0 auto;min-height:auto;overflow:visible}
103
+ .tekla-changes-group{margin-bottom:6px}
104
+ .tekla-changes-group>summary{cursor:pointer;padding:5px 2px;font-weight:600;font-size:11px}
105
+ .tekla-changes-row{grid-template-columns:minmax(0,1fr);margin-bottom:0}
106
+ .tekla-changes-chips{display:flex;flex-wrap:wrap;gap:3px;margin-top:3px}
107
+ .tekla-changes-chip{padding:1px 6px;border:1px solid var(--line-strong);border-radius:999px;color:var(--muted);font-size:9.5px}
108
+ .tekla-changes-item{margin-bottom:5px}
109
+ .tekla-changes-detail{display:flex;flex-direction:column;gap:5px;padding:6px 8px 8px;border:1px solid var(--line);border-top:0;border-radius:0 0 6px 6px}
110
+ .tekla-changes-field{display:flex;flex-direction:column;gap:1px;font-size:11px;overflow-wrap:anywhere}
111
+ .tekla-changes-field-name{color:var(--muted);font-size:10px}
112
+ .tekla-changes-locate{align-self:flex-start;min-height:26px;padding:3px 8px;font-size:11px}
113
+ .tekla-changes-message{margin:6px 9px;font-size:11px}
114
+ .tekla-changes-message.error{color:var(--danger)}
115
+ .tekla-changes-history{margin:8px 7px}
116
+ .tekla-changes-history>summary{cursor:pointer;padding:5px 2px;font-weight:600;font-size:11px}
117
+ .tekla-changes-history-row{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;margin-top:5px;padding:6px 8px;text-align:left}
118
+ .tekla-changes-history-row span{color:var(--muted);font-size:10px}
119
+ .tekla-changes-history-row[aria-current="true"]{border-color:var(--accent);background:var(--accent-soft)}
120
+ .tekla-changes-locked{text-align:left}
121
+ .tekla-changes-contact{align-self:flex-start;color:var(--accent);font-weight:600}
122
+ .tekla-changes-live:empty{display:none}
123
+ .tekla-changes-live{margin:4px 9px;color:var(--muted);font-size:11px}
124
+ .tekla-changes-unpaired{display:flex;flex-direction:column;gap:2px;padding:6px 8px;margin-bottom:4px;border:1px solid var(--line);border-radius:6px;font-size:11px}
125
+ .tekla-changes-unpaired span{color:var(--muted);font-size:10px}
126
+ /* Change review S2 (#3461): the Findings section of the Changes tab. Existing tokens only, both themes. */
127
+ .tekla-changes-gate.danger{border-left-color:var(--danger)}.tekla-changes-gate.accent{border-left-color:var(--accent)}.tekla-changes-gate.neutral{border-left-color:var(--line-strong)}
128
+ .tekla-changes-gate .tekla-changes-locate,.tekla-changes-gate .tekla-changes-linkbtn{align-self:flex-start;margin-top:3px}
129
+ .tekla-changes-finding-filters{border-bottom:0;padding:2px 7px 4px}
130
+ .tekla-changes-findings{padding:2px 7px 4px}
131
+ .tekla-changes-coverage ul{margin:2px 0 4px;padding:0 7px 0 22px;list-style:disc}.tekla-changes-coverage li{margin:3px 0}
132
+ .tekla-changes-finding-head{display:flex;flex-direction:column;align-items:flex-start;gap:2px}
133
+ .tekla-changes-finding-head>strong{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
134
+ .tekla-changes-finding-head>span:nth-child(2){color:var(--muted);font-size:11px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
135
+ .tekla-changes-finding-head[aria-expanded="true"]{border-color:var(--line-strong);border-radius:6px 6px 0 0}
136
+ .tekla-changes-finding-note{color:var(--muted);font-size:10.5px}
137
+ .tekla-changes-chip{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
138
+ .tekla-changes-chip.danger{border-color:var(--danger);color:var(--danger)}
139
+ .tekla-changes-chip.accent{border-color:var(--accent);background:var(--accent-soft);color:var(--selected-ink)}
140
+ .tekla-changes-finding-detail{gap:7px}
141
+ .tekla-changes-finding-text{margin:0;font-size:11px;line-height:1.45}.tekla-changes-finding-text.muted{color:var(--muted)}
142
+ .tekla-changes-finding-ask{font-size:11px;margin-top:2px}
143
+ .tekla-changes-finding-record{margin:0;font-size:11px;line-height:1.45}.tekla-changes-finding-record q{font-style:italic}
144
+ .tekla-changes-finding-meta{margin:0;color:var(--muted);font-size:10px;line-height:1.4}
145
+ .tekla-changes-choice-wrap{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:6px;background:var(--panel-2)}
146
+ .tekla-changes-choice{display:flex;flex-direction:column;align-items:flex-start;gap:1px;width:100%;min-height:36px;padding:6px 8px;border:0;border-radius:6px;text-align:left;background:transparent}
147
+ .tekla-changes-choice strong{font-size:11px}.tekla-changes-choice span{color:var(--muted);font-size:10px}
148
+ .tekla-changes-choice[aria-expanded="true"]{border-bottom:1px solid var(--line);border-radius:6px 6px 0 0}
149
+ .tekla-changes-choice-body{display:flex;flex-direction:column;gap:6px;padding:7px 8px 8px}
150
+ .tekla-changes-choice-body button.primary,.tekla-changes-gate button.primary{align-self:flex-start;min-height:28px;padding:4px 10px;border-color:var(--accent);background:var(--accent-soft);color:var(--selected-ink);font-weight:600;font-size:11px}
151
+ .tekla-changes-input{width:100%;box-sizing:border-box;min-height:30px;padding:5px 8px;color:var(--text);background:var(--bg);border:1px solid var(--line);border-radius:6px;font:inherit;font-size:11px}
152
+ .tekla-changes-input::placeholder{color:var(--muted)}
153
+ .tekla-changes-input:focus-visible{outline:2px solid var(--accent);outline-offset:1px;border-color:var(--accent)}
154
+ .tekla-changes-textarea{min-height:64px;resize:vertical;line-height:1.4}
155
+ .tekla-changes-count{align-self:flex-end;color:var(--muted);font-size:10px}.tekla-changes-count.limit{color:var(--danger)}
156
+ .tekla-changes-request{max-height:180px;overflow:auto;margin:0;padding:7px;border:1px solid var(--line);border-radius:5px;background:var(--bg);color:var(--muted);font:10px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere}
157
+ .tekla-changes-linkbtn{min-height:24px;padding:2px 0;border:0;background:transparent;color:var(--accent);font-size:11px;font-weight:600}
158
+ .tekla-changes-linkbtn:hover{background:transparent;text-decoration:underline}
159
+ .tekla-changes-cancel{min-height:26px;padding:3px 8px;font-size:11px}
160
+ .tekla-changes-finding-actions{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:4px}.tekla-changes-finding-actions>span{flex:1 1 100%;color:var(--muted);font-size:10.5px}
161
+ .tekla-changes-gone-heading{display:block;margin:6px 2px 3px;font-size:10.5px;color:var(--muted)}
@@ -26,6 +26,7 @@ import {
26
26
  MODEL_EXPLORER_ENTITY_CAP, MODEL_EXPLORER_GROUP_CAP, assertModelViewerRowBudget,
27
27
  preflightModelJsonReceipt, readModelBinaryArtifact, readModelJsonArtifact, readModelJsonDocument,
28
28
  } from './model-artifact-loader.js';
29
+ import { mountChangeReview } from './model-change-review.js';
29
30
  import { createModelPanelBridge, createModelSelectionOriginGuard, createPanelHost, expandModelPanelGroup, selectModelPanelGroup, serializeModelPanelNodes } from './model-panel-bridge.js';
30
31
  import { mountModelDisplayUnits } from './model-display-units.js';
31
32
  import { formatModelProperty, teklaObjectFields, teklaObjectLabel, teklaPropertyGroups, teklaTypeGroups } from './model-property-display.js';
@@ -212,6 +213,17 @@ function fail(failure = null) {
212
213
  if (failure) { $('editorRoot').dataset.modelState = 'empty'; renderRevitNoModelState(state, failure); return; }
213
214
  state.replaceChildren(); const strong = document.createElement('strong'); strong.textContent = 'Model unavailable'; const copy = document.createElement('span'); copy.textContent = modelUnavailableCopy(); state.append(strong, copy);
214
215
  }
216
+ /**
217
+ * #3097 3b: what a model route wrote for the person. These routes answer in two shapes: the Revit and editor-state
218
+ * routes send `{ error: <code>, message: <developer text>, userMessage? }` ("editorState.clips must be an object",
219
+ * "Revit import requires an active desktop session"), and the Tekla route sends `{ code, error: <sentence>, userMessage? }`.
220
+ * So `message` is never said, and an `error` is said only when it is a sentence (personText), never a bare code.
221
+ */
222
+ function modelReplyText(value) {
223
+ if (typeof value?.userMessage === 'string' && value.userMessage.trim()) return value.userMessage.trim();
224
+ const said =typeof globalThis.personText === 'function' ? globalThis.personText(value) : '';
225
+ return /\s/.test(said) ? said : '';
226
+ }
215
227
  // Any answer that is not ok rides on the error (`status`, `body`), so a failure can say what the server wrote for a person.
216
228
  // #3097: the message is the server's own sentence when it wrote one, else the shared one (failure-copy.js); never "(<status>)".
217
229
  function sharedFailureText(response, value, ctx, thrown) {
@@ -220,7 +232,7 @@ function sharedFailureText(response, value, ctx, thrown) {
220
232
  if (typeof copy === 'function') return copy(thrown && !thrown.status ? thrown : { status: response.status, body: value }, ctx).text;
221
233
  return `Couldn’t ${ctx?.action || 'finish that'}. Reload this window, then try again.`;
222
234
  }
223
- async function json(url, options) { const response = await fetch(url, { credentials: 'same-origin', ...options }); const value = await response.json().catch(() => ({})); if (!response.ok || value.ok === false) throw Object.assign(new Error(value.message || (typeof globalThis.personText === 'function' ? globalThis.personText(value) : '') || sharedFailureText(response, value, { retrySafe: /^(GET|HEAD)$/.test(String(options?.method || 'GET').toUpperCase()) })), { status: response.status, body: value }); return value; }
235
+ async function json(url, options) { const response = await fetch(url, { credentials: 'same-origin', ...options }); const value = await response.json().catch(() => ({})); if (!response.ok || value.ok === false) throw Object.assign(new Error(modelReplyText(value) || sharedFailureText(response, value, { retrySafe: /^(GET|HEAD)$/.test(String(options?.method || 'GET').toUpperCase()) })), { status: response.status, body: value }); return value; }
224
236
 
225
237
  function propertySection(heading, rows) {
226
238
  return { id: heading.toLowerCase().replace(/\W+/g, '-'), heading, editable: false, render(host) {
@@ -1099,7 +1111,7 @@ function renderTeklaAudit() {
1099
1111
  const name = document.createElement('span'); name.textContent = entity?.name || entity?.typeName || finding.entityId;
1100
1112
  const location = document.createElement('span'); location.className = finding.hasGeometry ? 'tekla-audit-location' : 'tekla-audit-location missing'; location.textContent = finding.hasGeometry ? 'Shown in 3D' : 'No 3D location';
1101
1113
  button.dataset.commandId = 'tekla-parser.audit-finding'; button.dataset.commandInstanceLabel = `${copy?.title ?? 'Import finding'}: ${name.textContent}`;
1102
- button.append(heading, name, location); button.addEventListener('click', () => { try { selectAuditFinding(finding); window.__instructor?.notifyChanged(); } catch (error) { toast(error.message); } }); list.append(button);
1114
+ button.append(heading, name, location); button.addEventListener('click', () => { try { selectAuditFinding(finding); window.__instructor?.notifyChanged(); } catch (error) { toast(errorText(error, { action: 'show that import finding', retrySafe: true })); } }); list.append(button);
1103
1115
  }
1104
1116
  };
1105
1117
  for (const [key, label] of filterSpecs) {
@@ -1361,8 +1373,11 @@ function payloadOnly(state) {
1361
1373
  return payload;
1362
1374
  }
1363
1375
 
1364
- // #3097: the editor-state route answers `{ error: <code>, message }`. The message is shown as written; a code that came
1365
- // without one is said in words, and anything else gets the shared sentence. A bare code or a status is never shown.
1376
+ // #3097: the editor-state route answers `{ error: <code>, message }`. 3b: its `message` is a developer's text for most
1377
+ // codes ("editorState.clips must be an object"), so it is said as written only for the codes whose message the route
1378
+ // writes for the person (EDITOR_STATE_PERSON_MESSAGE, reviewed against server/model-editor-state.ts). Any other code
1379
+ // is said in words, and anything else gets the shared sentence. A bare code, a status or a developer message is never shown.
1380
+ const EDITOR_STATE_PERSON_MESSAGE = new Set(['state-access-unconfirmed']);
1366
1381
  const EDITOR_STATE_CODE_WORDS = {
1367
1382
  'state-access-unconfirmed': 'FloLess couldn’t confirm your access to this model.',
1368
1383
  model_module_unavailable: 'This model is open for viewing only here, so its view settings aren’t saved.',
@@ -1371,8 +1386,8 @@ const EDITOR_STATE_CODE_WORDS = {
1371
1386
  'state-pin-unavailable': 'This version of the model is no longer available.',
1372
1387
  };
1373
1388
  function editorStateFailureText(response, value, action, retrySafe) {
1374
- if (typeof value?.message === 'string' && value.message.trim()) return value.message;
1375
- console.warn('[model] editor state request failed', action, response?.status, value?.error);
1389
+ if (EDITOR_STATE_PERSON_MESSAGE.has(value?.error) && typeof value?.message === 'string' && value.message.trim()) return value.message.trim();
1390
+ console.warn('[model] editor state request failed', action, response?.status, value?.error, value?.message);
1376
1391
  const words = EDITOR_STATE_CODE_WORDS[value?.error];
1377
1392
  if (words) return `Couldn’t ${action}. ${words}`;
1378
1393
  return sharedFailureText(response, value, retrySafe ? { action, retrySafe: true } : { action, unsure: 'Change the view again to save it once more.' });
@@ -1505,7 +1520,7 @@ function commitSpatialForRevision(candidate) {
1505
1520
  spatialTools.subscribe((value) => { $('modelFrameStatus').textContent = spatialTools.activeFrame().label; window.__revitInstructorState = { ...(window.__revitInstructorState || {}), activeFrame: value.activeFrameId }; reflectToolbarState(); });
1506
1521
  spatialPanel = mountModelSpatialPanel({ tools: spatialTools, trigger: $('modelFrameStatus'), onBeforeOpen: () => { closeSpatialDialog(); toolbarChrome?.closeMenus(); selectionFilterChrome?.close(); lightingPanel?.close({ restoreFocus: false }); },
1507
1522
  lengthDisplay: { format: (mm) => formatLength(mm, displayUnitControl.units()), parse: (text) => parseLengthMm(text, displayUnitControl.units()), unitLabel: () => displayUnitControl.units() },
1508
- onError: (error) => toast(error.message || 'That spatial action is unavailable.') });
1523
+ onError: (error) => toast(errorText(error, { action: 'use that spatial tool', retrySafe: true })) });
1509
1524
  if (candidate.recovered) { editorStateDirtyPayload = editorStatePayload(); editorStateDirtyGeneration = 1; retainEditorStateRecovery(); editorStateSaveTimer = setTimeout(() => drainEditorStateSaves().catch((error) => reportEditorStateSaveError(error, 'restore this model view')), 0); }
1510
1525
  }
1511
1526
 
@@ -1660,7 +1675,7 @@ function wireToolbar() {
1660
1675
  reflectToolbarState();
1661
1676
  modelPanelBridge?.publishSnapshot();
1662
1677
  window.__instructor?.notifyChanged();
1663
- } catch (error) { toast(error.message || 'That view action is unavailable.'); }
1678
+ } catch (error) { toast(errorText(error, { action: 'change the view', retrySafe: true })); }
1664
1679
  });
1665
1680
  updateSelectionActions();
1666
1681
  reflectToolbarState();
@@ -1803,11 +1818,39 @@ async function loadRevision(state, authority, spatialCandidate) {
1803
1818
  const REVIT_PANEL_TABS = Object.freeze([
1804
1819
  Object.freeze({ key: 'clips', label: 'Clips', tip: 'Clips — the planes and boxes cutting the model: select, rename, switch on or off, remove' }),
1805
1820
  ...(isTeklaParser ? [Object.freeze({ key: 'audit', label: 'Audit', tip: 'Audit — model properties, hierarchy, shape or placement that could not be fully verified' })] : []),
1821
+ // #3352: Change Review — what was added, removed or changed between two saved states.
1822
+ ...(isTeklaParser ? [Object.freeze({ key: 'changes', label: 'Changes', tip: 'Changes — what was added, removed or changed between two saved states' })] : []),
1806
1823
  ]);
1807
1824
  // Held, not looked up: once shown, the Clips tab lives in the main window's frame, where $() cannot find it.
1808
1825
  const revitClipListHost = $('revitClipListHost');
1809
1826
  const teklaAuditHost = $('teklaAuditHost');
1810
- const revitPanelHost = createPanelHost({ win: window, root: $('revitPanelTabs'), bodies: { clips: revitClipListHost, ...(teklaAuditHost ? { audit: teklaAuditHost } : {}) }, install: installTooltips });
1827
+ const teklaChangesHost = $('teklaChangesHost');
1828
+ const revitPanelHost = createPanelHost({ win: window, root: $('revitPanelTabs'), bodies: { clips: revitClipListHost, ...(teklaAuditHost ? { audit: teklaAuditHost } : {}), ...(teklaChangesHost ? { changes: teklaChangesHost } : {}) }, install: installTooltips });
1829
+ let changeReview = null;
1830
+ /**
1831
+ * #3352: open the saved state a change-review row belongs to (any approved version or the working snapshot), then select
1832
+ * the object. The authority toggle shows neither button pressed while a reviewed state other than those two is shown.
1833
+ */
1834
+ async function locateChangeReviewObject(state, { state: saved, entityId }) {
1835
+ if (!saved?.handle || !entityId) throw new Error('This object cannot be shown in 3D.');
1836
+ if (loadedRevisionId !== saved.handle.revisionId) {
1837
+ const host = $('authorityChoices');
1838
+ const key = saved.handle.revisionId === state.draft?.revisionId ? 'draft' : saved.handle.revisionId === state.approved?.revisionId ? 'approved' : 'reviewState';
1839
+ if (key === 'reviewState') state.reviewState = { ...saved.handle, projectUuid: state.projectUuid };
1840
+ let candidate = null;
1841
+ try {
1842
+ candidate = await prepareSpatialForRevision(state, state[key]);
1843
+ if (!await loadRevision(state, key, candidate)) return;
1844
+ } catch (error) {
1845
+ console.error(error);
1846
+ throw new Error(`${saved.label} couldn’t be opened in 3D. The model shown before is still shown.`);
1847
+ } finally { candidate?.dispose(); }
1848
+ host?.querySelectorAll('button').forEach((button) => button.setAttribute('aria-pressed', String(button.dataset.commandInstanceLabel === key)));
1849
+ toast(`Showing ${saved.label}.`, 4000);
1850
+ }
1851
+ if (!entityById.has(entityId)) throw new Error('This object is not drawn in that saved state.');
1852
+ selectTeklaObjects(entityId, [entityId]);
1853
+ }
1811
1854
 
1812
1855
  function mountPanels() {
1813
1856
  inspector = mountInspectorShell({ panel: $('inspectorBody'), doc: document, win: window, placement: 'docked', readOnly: true, emptyMessage: 'Select an object to see its imported properties.' });
@@ -2098,6 +2141,12 @@ async function boot() {
2098
2141
  const authority = authorityButtons(state); const initialSpatial = await prepareSpatialForRevision(state, state[authority]);
2099
2142
  try { await loadRevision(state, authority, initialSpatial); } finally { initialSpatial.dispose(); }
2100
2143
  mountSharedModelTools();
2144
+ if (isTeklaParser && teklaChangesHost) {
2145
+ changeReview = mountChangeReview({ host: teklaChangesHost, doc: document, projectId, fetchJson: json,
2146
+ locate: (target) => locateChangeReviewObject(state, target),
2147
+ onStateChanged: () => { window.__revitInstructorState = { ...(window.__revitInstructorState || {}), changeReview: changeReview?.state() }; window.__instructor?.notifyChanged(); } });
2148
+ void changeReview.load();
2149
+ }
2101
2150
  refreshChatLinks(false); window.addEventListener('focus', () => refreshChatLinks(false));
2102
2151
  const releasePointerCoordinates = viewport.onPointerWorld((renderPoint) => {
2103
2152
  lastCursorCoordinates = renderPoint && spatialTools ? spatialTools.coordinates(viewport.renderToCanonicalPoint(renderPoint)) : null;
@@ -48,6 +48,16 @@
48
48
  return `${Math.floor(s / 3600)} h ${Math.floor((s % 3600) / 60)} min`;
49
49
  }
50
50
 
51
+ // #3253: a run that went ahead although its FloLess steps were set to reach another FloLess on this computer (Run anyway),
52
+ // or where FloLess could not check. "Set to reach", never "reached": FloLess knows what the approved workflow names.
53
+ function elsewherePill(e) {
54
+ const port = Number.isInteger(e.port) ? ` (port ${e.port})` : '';
55
+ const tip = e.kind === 'foreign'
56
+ ? `Run anyway: its FloLess steps were set to reach another FloLess on this computer${port}, so its project steps may have read that FloLess’s projects and its AI steps may not have started.`
57
+ : 'FloLess couldn’t check which FloLess this workflow’s steps reach, so it ran as normal.';
58
+ return `<span class="rh-pill" tabindex="0" data-tip="${esc(tip)}">${e.kind === 'foreign' ? 'Another FloLess' : 'Not checked'}</span>`;
59
+ }
60
+
51
61
  function rowHtml(w, r) {
52
62
  const key = r.runId || `${r.routine?.id || 'routine'}@${r.startedAt}`;
53
63
  const label = `${w.name}, ${when(r.startedAt)}`;
@@ -58,6 +68,7 @@
58
68
  r.routine ? `<span class="rh-pill" data-tip="${esc(`Started by the routine “${r.routine.name}”.`)}">Routine: ${esc(r.routine.name)}</span>` : '',
59
69
  r.aiStep ? `<span class="pg-ai-badge rh-ai" tabindex="0" data-tip="${esc(AI_TIP)}">AI step</span>` : '',
60
70
  r.simulated && r.outcome !== 'simulated' ? `<span class="rh-pill" data-tip="${esc(SIM_TIP)}">Simulated</span>` : '',
71
+ r.elsewhere ? elsewherePill(r.elsewhere) : '',
61
72
  ].join('');
62
73
  const report = r.report && r.runId && !w.damaged && !w.missing
63
74
  ? `<button type="button" class="btn-mini rh-btn" data-rh-report="${esc(r.runId)}" data-rh-app="${esc(w.id)}" data-command-id="shell.workflows-history-report#${esc(r.runId)}" data-command-instance-label="${esc(label)}" aria-label="${esc(`View report: ${label}`)}" data-tip="Opens the report this run made">View report</button>` : '';
@@ -183,7 +194,7 @@
183
194
  const report = event.target.closest('[data-rh-report]');
184
195
  if (report) {
185
196
  Promise.resolve(opts.openReport?.(report.dataset.rhApp, report.dataset.rhReport))
186
- .catch((err) => toast(err?.message || 'FloLess couldn’t open that run’s report. Open the workflow to see its latest results.', 'warn'));
197
+ .catch((err) => toast(errorText(err, { action: 'open that run’s report', retrySafe: true }), 'warn'));
187
198
  return;
188
199
  }
189
200
  const act = event.target.closest('[data-rh-act]');
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Synchronous SHA-256 over a UTF-8 string, for the small identity tokens the steel model computes while it
3
+ * renders or commits an edit (endpoint lineage, custom-section ids). `crypto.subtle` is asynchronous and the
4
+ * editor's command transaction is not, so the browser and the server share this one implementation and
5
+ * therefore cannot disagree about an id. Pinned against Node's `crypto` by `server/sha256-sync.test.ts`.
6
+ */
7
+
8
+ const SHA256_K = Object.freeze([
9
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
10
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
11
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
12
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
13
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
14
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
15
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
16
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
17
+ ]);
18
+
19
+ const rotateRight = (value, bits) => (value >>> bits) | (value << (32 - bits));
20
+
21
+ /** @param {string} text @returns {string} 64 lowercase hex digits */
22
+ export function sha256Hex(text) {
23
+ const input = new TextEncoder().encode(text);
24
+ const byteLength = Math.ceil((input.length + 9) / 64) * 64;
25
+ const bytes = new Uint8Array(byteLength);
26
+ bytes.set(input);
27
+ bytes[input.length] = 0x80;
28
+ const view = new DataView(bytes.buffer);
29
+ const bitLength = input.length * 8;
30
+ view.setUint32(byteLength - 8, Math.floor(bitLength / 0x100000000));
31
+ view.setUint32(byteLength - 4, bitLength >>> 0);
32
+ const hash = new Uint32Array([
33
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
34
+ 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
35
+ ]);
36
+ const words = new Uint32Array(64);
37
+ for (let offset = 0; offset < byteLength; offset += 64) {
38
+ for (let i = 0; i < 16; i++) words[i] = view.getUint32(offset + i * 4);
39
+ for (let i = 16; i < 64; i++) {
40
+ const a = words[i - 15];
41
+ const b = words[i - 2];
42
+ const s0 = rotateRight(a, 7) ^ rotateRight(a, 18) ^ (a >>> 3);
43
+ const s1 = rotateRight(b, 17) ^ rotateRight(b, 19) ^ (b >>> 10);
44
+ words[i] = (words[i - 16] + s0 + words[i - 7] + s1) >>> 0;
45
+ }
46
+ let [a, b, c, d, e, f, g, h] = hash;
47
+ for (let i = 0; i < 64; i++) {
48
+ const s1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);
49
+ const choice = (e & f) ^ (~e & g);
50
+ const t1 = (h + s1 + choice + SHA256_K[i] + words[i]) >>> 0;
51
+ const s0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
52
+ const majority = (a & b) ^ (a & c) ^ (b & c);
53
+ const t2 = (s0 + majority) >>> 0;
54
+ h = g; g = f; f = e; e = (d + t1) >>> 0; d = c; c = b; b = a; a = (t1 + t2) >>> 0;
55
+ }
56
+ hash[0] = (hash[0] + a) >>> 0; hash[1] = (hash[1] + b) >>> 0;
57
+ hash[2] = (hash[2] + c) >>> 0; hash[3] = (hash[3] + d) >>> 0;
58
+ hash[4] = (hash[4] + e) >>> 0; hash[5] = (hash[5] + f) >>> 0;
59
+ hash[6] = (hash[6] + g) >>> 0; hash[7] = (hash[7] + h) >>> 0;
60
+ }
61
+ return [...hash].map((word) => word.toString(16).padStart(8, '0')).join('');
62
+ }