@floless/app 0.112.1 → 0.113.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.
@@ -1,5 +1,5 @@
1
1
  app: steel-model
2
- version: 0.4.0
2
+ version: 0.4.1
3
3
  display-name: Steel Model
4
4
  publisher: floless
5
5
  module: steel-detailer
@@ -20,6 +20,10 @@ exposes-as-agent: false
20
20
  # Workflow changelog (FloLess-published). Newest first; the app shows entries newer than the
21
21
  # installed version when offering an update. Plain-English — it surfaces to the user.
22
22
  changelog:
23
+ - version: 0.4.1
24
+ summary: Housekeeping — no change to how Steel Model works
25
+ changes:
26
+ - "Changed: nothing you will notice. Notes inside the workflow that described how FloLess saves your approved model were out of date; they now match what it actually does. Your model, your steps and your exports are untouched."
23
27
  - version: 0.4.0
24
28
  summary: Housekeeping — no change to how Steel Model works
25
29
  changes:
@@ -74,11 +78,24 @@ nodes:
74
78
  # ── node 2: read — takeoff summary ───────────────────────────────────────────
75
79
  # config.contract is the FloLess editor discriminator (renderers.js contractTypeOf).
76
80
  # config.takeoff is the SINGLE SOURCE the editor + Approve-bake + render all key on:
77
- # server/contract-bake.ts writes the approved contract under config.takeoff (finding
78
- # this node by config.contract === type), and GET /api/contract falls back to it so
79
- # the editor opens with the baked contract. It is BAKED at compose time by the terminal
80
- # AI from the drawing above; the run re-renders it as an HTML summary. Ships with a tiny
81
- # EXAMPLE so it renders out of the box — "Re-read & re-bake ▸" replaces config.takeoff.
81
+ # server/contract-bake.ts writes the approved contract under config.takeoff, and GET
82
+ # /api/contract falls back to it so the editor opens with the baked contract (for a
83
+ # steel.model/v2 bake that app-scoped fallback now answers "no contract" instead — the
84
+ # model belongs to the project that approved it; open the project). It is
85
+ # BAKED at compose time by the terminal AI from the drawing above; the run re-renders it
86
+ # as an HTML summary. Ships with a tiny EXAMPLE so it renders out of the box —
87
+ # "Re-read & re-bake ▸" replaces config.takeoff.
88
+ #
89
+ # ONE node, BOTH steel types. `contract:` below declares what is baked here RIGHT NOW, and
90
+ # Approve rewrites it: a project migrated to steel.model/v2 bakes v2 into this same node
91
+ # and the line becomes `steel.model/v2`. Every project of this app shares this one file, so
92
+ # the bake matches the steel contract node rather than one fixed type — that is what lets a
93
+ # migrated project and its still-v1 siblings both keep approving. Do NOT hand-edit the type
94
+ # to v2 to "enable" the model: a store earns v2 only by migrating. Hand-editing this line
95
+ # does NOT enable anything — nothing reads it as a type (the read judges config.takeoff's own
96
+ # `type` field), so the edit is ignored and the next Approve overwrites it. Where it DOES bite
97
+ # is import: server/app-import.ts refuses a .flo whose declaration is an unearned v2.
98
+ # See server/contract-bake.ts.
82
99
  - id: read
83
100
  agent: html-report
84
101
  command: render
package/dist/web/app.css CHANGED
@@ -3811,7 +3811,15 @@ body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
3811
3811
  .ws-exports-gate button:hover { color:var(--accent-bright); text-decoration:underline; }
3812
3812
  .exports-note { flex:none; padding:14px 20px 4px; color:var(--text-muted); font-size:12px; }
3813
3813
  .exports-note b { color:var(--text); font-weight:600; }
3814
- .exports-note code { font-family:var(--mono); color:var(--accent-bright); font-size:11px; }
3814
+ /* The `exports` word is a real control that opens the folder — it REPLACED the inert `<code>` that
3815
+ used to sit here (whose rule is gone with it, since no `<code>` remains in this note). Keeps that
3816
+ code-token look at REST (mono + accent-bright, as it always read) and reveals its actionability on
3817
+ hover/focus with an underline — the same restraint .ws-exports-gate button uses just above. No
3818
+ focus-ring rule needed: a real <button> inherits the global :focus-visible outline. */
3819
+ .exports-note-link { display:inline-flex; align-items:center; gap:3px; background:none; border:none;
3820
+ padding:0; margin:0 1px; font:inherit; font-family:var(--mono); font-size:11px;
3821
+ color:var(--accent-bright); cursor:pointer; }
3822
+ .exports-note-link:hover, .exports-note-link:focus-visible { text-decoration:underline; }
3815
3823
  .export-grid { flex:1; overflow-y:auto; padding:14px 20px 22px; display:grid; gap:14px;
3816
3824
  grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); align-content:start;
3817
3825
  scrollbar-width:thin; scrollbar-color:var(--border-strong) transparent; }
package/dist/web/aware.js CHANGED
@@ -49,6 +49,12 @@
49
49
  let currentId = null;
50
50
  let teklaReadinessState = null;
51
51
  let teklaReadinessPromise = null;
52
+ // appId → 'project-publication' | undefined. Server-computed, carried BESIDE the app on
53
+ // GET /api/app/:id; see `contractStateOf`. Kept out of the app object on purpose (that object is
54
+ // AWARE's app spec, not a place for FloLess's reading of it) and cleared with it in
55
+ // dropClientAppState, so a deleted or renamed workflow cannot leave a stale answer behind to
56
+ // annotate whatever takes its id next.
57
+ const contractStates = new Map();
52
58
  const exportReceiptsByApp = new Map(); // appId:kind → latest reconciled receipt counts
53
59
  const exportBusyByApp = new Set(); // appId:kind → one in-flight host/export mutation
54
60
 
@@ -865,8 +871,13 @@
865
871
 
866
872
  async function loadApp(id) {
867
873
  hideSpotlight(); // a spotlight pointing at the previous app's beacon must clear on switch
868
- const { app } = await api(`/api/app/${encodeURIComponent(id)}`);
874
+ const { app, contractState } = await api(`/api/app/${encodeURIComponent(id)}`);
869
875
  apps.set(id, app);
876
+ // A PARALLEL map, never a key on `app`. The app object is AWARE's app spec — `transform()`,
877
+ // `seedAppInputs()` and `paintGate()` all take it — and FloLess's reading OF that app does not
878
+ // belong inside it. Set unconditionally (including to undefined) so a workflow that stops being a
879
+ // publication clears, rather than keeping the previous answer forever.
880
+ contractStates.set(id, contractState);
870
881
  currentId = id;
871
882
  try { localStorage.setItem(LS_LAST_APP, id); } catch { /* private mode / quota */ }
872
883
  transform(app);
@@ -1177,7 +1188,26 @@
1177
1188
  function dropClientAppState(id) {
1178
1189
  try { localStorage.removeItem(lsInputsKey(id)); } catch { /* ignore */ }
1179
1190
  try { const all = guideStateAll(); if (all[id]) { delete all[id]; localStorage.setItem(LS_GUIDE, JSON.stringify(all)); } } catch { /* ignore */ }
1180
- appInputValues.delete(id); dirtyBaseline.delete(id); apps.delete(id);
1191
+ appInputValues.delete(id); dirtyBaseline.delete(id); apps.delete(id); contractStates.delete(id);
1192
+ }
1193
+
1194
+ /**
1195
+ * What the SERVER said about where this workflow's contract lives — never inferred here.
1196
+ *
1197
+ * Returns undefined for an app that has not been loaded, which reads as "not a publication" and is
1198
+ * the right default: the card renders nothing extra and behaves exactly as it did before this field
1199
+ * existed.
1200
+ *
1201
+ * FRESHNESS, stated accurately — an earlier version of this comment claimed the line and the buttons
1202
+ * "can go stale together but never disagree", and that was wrong. What comes from the payload is the
1203
+ * buttons' EXISTENCE; whether they succeed is decided by the server when clicked. So the two really
1204
+ * can disagree, and the path is an app-scoped contract write: it changes the answer without changing
1205
+ * the `.flo`. That is why the `contract-changed` handler re-reads the app rather than only clearing
1206
+ * receipts. The remaining window is the ordinary one — a payload is a snapshot — not a claim that no
1207
+ * window exists.
1208
+ */
1209
+ function contractStateOf(id) {
1210
+ return contractStates.get(id);
1181
1211
  }
1182
1212
 
1183
1213
  async function openRenameWorkflow(oldId, baked = false) {
@@ -1698,6 +1728,26 @@
1698
1728
  };
1699
1729
  }
1700
1730
 
1731
+ /**
1732
+ * The one line that says where a migrated project's model actually lives.
1733
+ *
1734
+ * Same `.node-action-state` idiom as the Tekla readiness line, and deliberately WITHOUT `blocked`
1735
+ * (amber): this is a location fact, not a problem to fix. `role="status"` + `aria-live` because the
1736
+ * buttons it explains are `disabled` — disabled controls are not focusable and announce nothing, so
1737
+ * this line is the accessible explanation, not merely the visible one.
1738
+ */
1739
+ function addPublicationState(card) {
1740
+ const wrap = document.createElement('div');
1741
+ wrap.className = 'node-action-state';
1742
+ const text = document.createElement('span');
1743
+ text.setAttribute('role', 'status');
1744
+ text.setAttribute('aria-live', 'polite');
1745
+ text.textContent = 'This model lives in a project — open it from Workspaces to use these.';
1746
+ wrap.appendChild(text);
1747
+ card.appendChild(wrap);
1748
+ return wrap;
1749
+ }
1750
+
1701
1751
  function addTeklaActionState(card) {
1702
1752
  const state = teklaActionState();
1703
1753
  const wrap = document.createElement('div');
@@ -1813,6 +1863,12 @@
1813
1863
  // B3: a baked-visual app (read-strategy: bake) has no runtime input node, so the
1814
1864
  // "Re-read & re-bake ▸" affordance lands on the entry (first) node card.
1815
1865
  const app = currentId && apps.get(currentId);
1866
+ // Read BESIDE `app`, from the same id in the same tick, so the two provably describe one workflow.
1867
+ // Review raised the pairing as a hazard — one workflow's state annotating another's card — and it
1868
+ // cannot happen here, because both come from `currentId` synchronously. Hoisting the read next to
1869
+ // the app it belongs with makes that a property of the code rather than of the reader's attention:
1870
+ // a future edit that changes how `app` is obtained now has this line staring at it.
1871
+ const publication = contractStateOf(currentId) === 'project-publication';
1816
1872
  const rebakeInput = app && app.rebakeInput ? app.rebakeInput : null;
1817
1873
  const cards = document.querySelectorAll('.agent-card');
1818
1874
  const firstId = cards.length ? cards[0].dataset.agentId : null;
@@ -1840,6 +1896,16 @@
1840
1896
  // Only offer the action when a renderer is actually registered for the type — otherwise
1841
1897
  // openContractEditor() returns false and the click would silently do nothing.
1842
1898
  if (contractType && window.CONTRACT_RENDERERS && window.CONTRACT_RENDERERS[contractType]) {
1899
+ // Approving a migrated project bakes THAT PROJECT's model into this workflow's shared .flo, so
1900
+ // every action below asks for a contract this workflow does not own and fails on click. Say so
1901
+ // once, before the buttons, and dim them — rather than leaving five lit affordances that each
1902
+ // cost a click, a wait, and a raw failure toast to discover.
1903
+ //
1904
+ // The state was read at the top of markSpecialNodes, beside `app`; it is CONSUMED here, inside
1905
+ // the eligibility branch on purpose — rendered before it, the line would annotate a card that
1906
+ // shows no action group at all.
1907
+ const actionsBefore = card.querySelectorAll('.node-action').length; // marker for the dimming below
1908
+ if (publication) addPublicationState(card);
1843
1909
  addNodeAction(card, 'Edit contract ▸', () => openContractEditor(currentId, contractType));
1844
1910
  // A renderer with a LOCAL 3D viewer (the drawing.vector reconstruction) gets View 3D via
1845
1911
  // that page — distinct from the steel `scene` chain below (AWARE exporter companions).
@@ -1861,18 +1927,44 @@
1861
1927
  addNodeAction(card, 'Export BOM (CSV) ▸', () => exportContractBom(currentId, 'csv'));
1862
1928
  addNodeAction(card, 'Export BOM (Excel) ▸', () => exportContractBom(currentId, 'xlsx'));
1863
1929
  const teklaBtn = addHostExportAction(card, currentId, 'tekla', 'Send to Tekla ▸', 'Sending to Tekla…', () => exportContractTekla(currentId));
1864
- hasTeklaAction = true;
1865
- const teklaState = addTeklaActionState(card);
1866
- const teklaBusy = exportActionBusy(currentId, 'tekla');
1867
- teklaBtn.disabled = !teklaBusy && !teklaState.ready;
1868
- teklaBtn.dataset.tip = teklaBusy
1869
- ? 'Sending the approved model to Tekla'
1870
- : teklaState.ready
1871
- ? 'Create native parts in the open Tekla model'
1872
- : teklaState.message;
1930
+ // INSIDE the guard with the line it drives: `hasTeklaAction` is what triggers
1931
+ // refreshTeklaReadiness() after this loop, and in the publication state nothing renders the
1932
+ // result — the button is disabled either way. Left outside, selecting such a workflow fired a
1933
+ // real host probe and then a full repaint that changed nothing.
1934
+ if (!publication) hasTeklaAction = true;
1935
+ // NO Tekla readiness line in the publication state. It renders into the SAME
1936
+ // `.node-action-state` slot, so both lines would stack — and a green "Ready" sitting beside
1937
+ // "you can't use these" contradicts it outright. Whether Tekla is running is not the reason
1938
+ // this button cannot work, and it cannot work either way.
1939
+ if (!publication) {
1940
+ const teklaState = addTeklaActionState(card);
1941
+ const teklaBusy = exportActionBusy(currentId, 'tekla');
1942
+ teklaBtn.disabled = !teklaBusy && !teklaState.ready;
1943
+ teklaBtn.dataset.tip = teklaBusy
1944
+ ? 'Sending the approved model to Tekla'
1945
+ : teklaState.ready
1946
+ ? 'Create native parts in the open Tekla model'
1947
+ : teklaState.message;
1948
+ }
1873
1949
  addExportReceipt(card, currentId, 'tekla');
1874
1950
  }
1875
- card.dataset.tip = 'Double-click to open the contract editor';
1951
+ // Dim every action THIS branch added. Sliced from a marker rather than naming the five, so a
1952
+ // sixth contract action added later is covered by construction instead of silently staying lit.
1953
+ // Deliberately not `card.querySelectorAll('.node-action')`: Set inputs / Re-read & re-bake /
1954
+ // View report live outside this branch and still work.
1955
+ if (publication) {
1956
+ [...card.querySelectorAll('.node-action')].slice(actionsBefore).forEach((b) => { b.disabled = true; });
1957
+ }
1958
+ // NO "double-click to open" tip in the publication state, and the dblclick handler is gated to
1959
+ // match. Two reasons, and the second is the sharper one:
1960
+ //
1961
+ // • It contradicts the card. Disabling Edit contract while the card still invites the same
1962
+ // action by another route is not a smaller affordance, it is a hidden one.
1963
+ // • Tips resolve through `closest('[data-tip]')`, and the disabled buttons carry none of their
1964
+ // own here (the Tekla suppression above also skips `teklaBtn.dataset.tip`). So the CARD's tip
1965
+ // is what surfaces when the user hovers a dimmed button — "Double-click to open the contract
1966
+ // editor", floating over the exact controls that just told them they cannot.
1967
+ if (!publication) card.dataset.tip = 'Double-click to open the contract editor';
1876
1968
  }
1877
1969
  // Filter pre-stage node — opens the served steel-filter view (facets + eyedropper → contract.filter).
1878
1970
  if (node && node.config && node.config.surface === 'steel-filter') {
@@ -3448,7 +3540,12 @@
3448
3540
  const app = currentId && apps.get(currentId);
3449
3541
  const node = app && (app.nodes || []).find((n) => n.id === id);
3450
3542
  const ct = window.contractTypeOf && window.contractTypeOf(node);
3451
- if (ct && openContractEditor(currentId, ct)) return;
3543
+ // Skipped for a project publication, matching the disabled Edit contract button. Without this the
3544
+ // card's own double-click still opened an editor for a contract this workflow does not own — the
3545
+ // click-and-fail round trip the card exists to prevent, reached through the affordance the card
3546
+ // used to advertise. Falling THROUGH is deliberate: this card is usually the report node too, so
3547
+ // the double-click lands on `showReport` below — the one action here that still works.
3548
+ if (ct && contractStateOf(currentId) !== 'project-publication' && openContractEditor(currentId, ct)) return;
3452
3549
  if (node && node.config && node.config.surface === 'steel-filter') { openFilterView(currentId); return; }
3453
3550
  if (id === reportNodeId()) showReport(id);
3454
3551
  else if (id === inputNodeId()) openInputsDialog();
@@ -5570,6 +5667,13 @@
5570
5667
  // A receipt belongs to the exact scene that was exported. Once its contract changes, remove
5571
5668
  // the session summary immediately so an earlier model cannot masquerade as the current one.
5572
5669
  clearExportReceiptsForApp(m.appId);
5670
+ // An APP-SCOPED write can move this workflow out of (or into) the publication state, and this
5671
+ // arm is already scoped to exactly that (`!m.project`). Without the re-read the card kept the
5672
+ // sentence and the five dimmed buttons after a draft made them work again — and worse,
5673
+ // `clearExportReceiptsForApp` repaints via markSpecialNodes(), so the stale map was actively
5674
+ // RE-APPLIED rather than merely left behind. Nothing self-healed until the user switched
5675
+ // workflows. Re-read the payload rather than guess at the new state.
5676
+ if (m.appId === currentId) loadApp(currentId).catch(reportErr);
5573
5677
  } else if (m.type === 'trace' && m.id === currentId) {
5574
5678
  pushTrace(m.event);
5575
5679
  if (state.currentTab === 'execution') renderInspect();