@floless/app 0.123.1 → 0.124.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.
@@ -68,6 +68,16 @@
68
68
  "override": { "type": ["string", "null"], "description": "Set only when the user overrode a file that LIES about its units." }
69
69
  }
70
70
  },
71
+ "filter": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "minProperties": 1,
75
+ "description": "The SUBSET of the file this reference was read from — ABSENT means the whole file. Stored so a re-read reproduces the same reference: without it, \"Reload its geometry\" would silently replace one storey with the whole building, from the one action a user takes when something already looks wrong. An empty list is never stored, and neither is an empty object: the reader treats an empty list as selecting NOTHING, so \"no filter\" is this key being absent. The two filters INTERSECT — storeys L1 plus type IFCBEAM means the beams on L1, not both sets.",
76
+ "properties": {
77
+ "storeys": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "description": "Storey names as `probe` reported them. Matched case-insensitively by the reader." },
78
+ "ifcTypes": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "description": "IFC entity names, e.g. IFCBEAM. Subtypes are included, so a supertype does not select nothing." }
79
+ }
80
+ },
71
81
  "display": {
72
82
  "type": "object",
73
83
  "additionalProperties": false,
@@ -2,7 +2,7 @@
2
2
  name: floless-app-approval
3
3
  description: Review and act on FloLess Workspace approval state through the local server API. Use when the user asks what changed or is pending, wants to approve selected changes, leave changes pending, discard a change, inspect approved history or saved checkpoints, start from an older approved version, resume or move saved work forward, or export the latest approved version, an older version, the working DRAFT, or a checkpoint DRAFT.
4
4
  metadata:
5
- version: 0.1.0
5
+ version: 0.2.0
6
6
  ---
7
7
 
8
8
  # FloLess Workspace approval
@@ -24,6 +24,12 @@ This is informational telemetry, not proof of identity.
24
24
  ## Review and approve
25
25
 
26
26
  1. Fetch `GET /api/projects/:id/approval-review`.
27
+ **If the body has `reviewable: false`, there is nothing to review.** Report its `message` to the
28
+ user and stop — do not present a review and do not submit one. The route answers 200 for the two
29
+ states that are a standing condition of the project rather than a fault (`reason: "no-contract"`,
30
+ nothing read in yet; `reason: "no-incarnation"`, a project too old to carry the identity approval
31
+ proves against). Such a body has no `summary`, no `groups`, and no `reviewId`, so presenting it
32
+ would tell the user "nothing needs approval" about a project that cannot be approved at all.
27
33
  2. Present the server's baseline/head, summary, cautions, and every change ID with its headline and
28
34
  detail. If `moveForward` is present, state its old base, current approved head, and every reported
29
35
  overlap. Do this before any mutation, even when this AI authored the changes.
@@ -2,7 +2,7 @@
2
2
  name: floless-app-steel-takeoff
3
3
  description: Read a structural steel drawing into an editable steel.takeoff/v1 contract in floless.app — the "Steel Takeoff" reader. Triggers on a pending floless `rebake` request for the `steel-model` app (queued from its "Re-read & re-bake ▸" button), or asks like "read this framing plan into a takeoff", "turn this structural drawing into a takeoff", "bake my drawing into steel-model", "extract members from this PDF". Teaches the host AI to READ a steel drawing (PDF/image) with its own vision at COMPOSE time, build a steel.takeoff/v1 contract (members + profiles + elevations + weights from AISC lookup), write it to the contract store, and hand control to the editor — no model in the run path, no API key.
4
4
  metadata:
5
- version: 0.16.0
5
+ version: 0.16.1
6
6
  ---
7
7
 
8
8
  # Steel Takeoff — read a drawing into a steel.takeoff/v1 contract
@@ -300,8 +300,12 @@ native/display coords):
300
300
  (**title block excluded** — CONFIDENTIAL, machine-local, never committed). **`page.rect` = the exact
301
301
  clip `[x0,y0,x1,y1]` you rendered `bg_b64` from, in the SAME display-space coords as the element `d`
302
302
  paths** — the viewer registers the raster to `rect` (not the whole page), so it aligns 1:1 with the
303
- linework. `w`/`h` stay the full display-space page size (the vectors' coordinate frame). `steelBbox`
304
- = the bbox of this sheet's steel-layer elements (Zoom-to-steel).
303
+ linework. `w`/`h` stay the full display-space page size (the vectors' coordinate frame). Pass that
304
+ same display-space rect to `page.get_pixmap(clip=…)` **unchanged** — do NOT run it back through
305
+ `page.derotation_matrix` on the theory that PyMuPDF wants native coords. `get_pixmap` is the one
306
+ exception to that habit, and derotating its clip renders the wrong region of the sheet (see
307
+ "Hard-won gotchas" below). `steelBbox` = the bbox of this sheet's steel-layer elements
308
+ (Zoom-to-steel).
305
309
  4. **Global facets (union across sheets)** — aggregate distinct `layers` / `thicknesses` / `colors`
306
310
  with a summed `count` each, ACROSS all sheets, into the top-level `filter.layers/thicknesses/colors`
307
311
  (NOT per-sheet). Round each element's `w` and the facet `w` the **same** way (matching is
@@ -836,6 +840,20 @@ Follow the methodology condensed here (full detail + every gotcha in
836
840
  - **Pages may be rotated (e.g. 270°).** Work entirely in display space via
837
841
  `page.rotation_matrix`. Never mix native/display coords — this is the single biggest source of
838
842
  misplaced members.
843
+ - **`page.get_pixmap(clip=…)` is the ONE call that wants the rect already in DISPLAY space — do
844
+ NOT derotate it first.** Every *extraction* (`get_drawings()`, `get_text()`, `search_for()`)
845
+ hands back **native** coordinates you push through `page.rotation_matrix` to reach display space,
846
+ so "always transform" becomes muscle memory — and it is wrong here. `clip` is interpreted in the
847
+ same rotated frame as PyMuPDF's `Page.rect` attribute and the element `d`/`bbox`/`cx,cy` coords you
848
+ already hold, so the display-space crop goes in **verbatim**; that same rect is also what you write
849
+ into the sheet entry's `page.rect` field (step 3 above). Running it through `derotation_matrix`
850
+ first silently renders a *different region* of the sheet. At 90°/270° that usually swaps the crop's
851
+ width and height, so an
852
+ **exact** expected-dimensions assert often does catch it — but at 180°, or on a square or
853
+ symmetrically-clipped region, the pixel size comes back plausible, so dimensions alone cannot
854
+ reliably rule it out. The symptom is a `bg_b64` backdrop shifted and rescaled under
855
+ correctly-placed linework; the check that always settles it is a pixel-diff of the crop against the
856
+ same region of a full-page render.
839
857
  - **When a subagent reports a POSITION — the scan-only fallback of step 4 — it must be normalized
840
858
  fractions, one pass, no sub-cropping.** Pixel coords from a subagent collapse after downscaling.
841
859
  The live-text and montage branches of step 4 are exempt: neither asks a reader for a position at
package/dist/web/app.js CHANGED
@@ -244,7 +244,7 @@ function renderTopology() {
244
244
  function renderLinearTopology(p) {
245
245
  const ports = computePorts(p);
246
246
  p.nodes.forEach((id, i) => {
247
- if (i > 0) $topology.appendChild(wireEl(i - 1, p.wires[i - 1]));
247
+ if (i > 0) $topology.appendChild(wireEl(p.wires[i - 1]));
248
248
  $topology.appendChild(cardEl(id, ports[id]));
249
249
  });
250
250
  }
@@ -395,12 +395,12 @@ function cardEl(id, ports) {
395
395
  return div;
396
396
  }
397
397
 
398
- function wireEl(idx, label) {
398
+ function wireEl(label) {
399
399
  const wrap = document.createElement('div');
400
400
  wrap.className = 'wire-wrap';
401
401
  wrap.innerHTML = `
402
402
  <div class="wire-label">${label || ''}</div>
403
- <div class="wire" data-wire-idx="${idx}"><div class="pulse"></div></div>
403
+ <div class="wire"><div class="pulse"></div></div>
404
404
  `;
405
405
  return wrap;
406
406
  }
package/dist/web/aware.js CHANGED
@@ -1059,13 +1059,26 @@
1059
1059
 
1060
1060
  // Status placeholders that flow through setComboTriggerLabel but are NOT workflow names.
1061
1061
  const WF_STATUS_TEXT = new Set(['loading…', 'no workflows installed', 'server unreachable', 'select workflow', '']);
1062
+ // App tab title — kept distinct from the marketing site's "FloLess — Workflow Automation for
1063
+ // AEC": "<subject> — FloLess" so parallel browser tabs are tellable apart, else the static
1064
+ // "FloLess Workspace" (which is also the initial <title> in index.html).
1065
+ //
1066
+ // The subject is whatever surface is ON SCREEN, which is why there are two inputs and one owner:
1067
+ // in Workspaces mode the workflow combo is not even visible, so naming its workflow there was
1068
+ // simply the wrong surface (the tab kept a workflow name while the user was in a project).
1069
+ // Workspaces mode wins when set; workspaces.js pushes it through bridge.setWorkspaceTitle().
1070
+ // Pure on purpose — the branch is pinned by tab-title.test.ts.
1071
+ function tabTitle(wsName, wfName) {
1072
+ const subject = wsName || (wfName && !WF_STATUS_TEXT.has(wfName) ? wfName : '');
1073
+ return subject ? `${subject} — FloLess` : 'FloLess Workspace';
1074
+ }
1075
+ let wfTitleText = ''; // last workflow-combo label (may be a WF_STATUS_TEXT placeholder)
1076
+ let wsTitleName = null; // open Workspaces project name, or 'Workspaces' on its landing; null = Workflows mode
1077
+ const syncTabTitle = () => { document.title = tabTitle(wsTitleName, wfTitleText); };
1062
1078
  function setComboTriggerLabel(text) {
1063
1079
  if ($wfTriggerLabel) $wfTriggerLabel.textContent = text || 'select workflow';
1064
- // App tab title — kept distinct from the marketing site's "FloLess — Workflow
1065
- // Automation for AEC": show "<workflow> — FloLess" when a workflow is selected so
1066
- // parallel browser tabs are tellable apart, else the static "FloLess Workspace"
1067
- // (which is also the initial <title> in index.html).
1068
- document.title = (text && !WF_STATUS_TEXT.has(text)) ? `${text} — FloLess` : 'FloLess Workspace';
1080
+ wfTitleText = text || '';
1081
+ syncTabTitle();
1069
1082
  }
1070
1083
  function setComboSelected(id) {
1071
1084
  if (!$wfList) return;
@@ -3241,7 +3254,7 @@
3241
3254
  : sel ? sel.label + (sel.meta ? ` (${sel.meta})` : '') : (f.placeholder || 'Select…');
3242
3255
  const rows = opts.map((o) =>
3243
3256
  `<div class="wf-option${isOn(o) ? ' selected' : ''}" role="option" data-id="${escapeAttr(String(o.value))}" data-search="${escapeAttr(String(o.search || o.label).toLowerCase())}" tabindex="-1" aria-selected="${isOn(o) ? 'true' : 'false'}"><span class="wf-option-name">${escapeHtml(o.label)}</span>${o.meta ? `<span class="wf-option-meta">${escapeHtml(o.meta)}</span>` : ''}</div>`).join('');
3244
- ctl = `<div class="wf-combo fm-select" data-fm-select="${escapeAttr(f.name)}"${f.placeholder ? ` data-placeholder="${escapeAttr(f.placeholder)}"` : ''}>
3257
+ ctl = `<div class="wf-combo fm-select">
3245
3258
  <input type="hidden" data-fm="${escapeHtml(f.name)}" value="${escapeAttr(val)}">
3246
3259
  <button type="button" class="wf-trigger fm-select-trigger" aria-haspopup="listbox" aria-expanded="false"${disabled ? ' disabled' : ''}>
3247
3260
  <span class="wf-trigger-label fm-select-label"${sel ? '' : ' data-empty="1"'}>${escapeHtml(trigLabel)}</span>
@@ -6348,7 +6361,29 @@
6348
6361
  function connectSse() {
6349
6362
  const es = new EventSource('/api/events');
6350
6363
  let reloadTimer = null;
6351
- es.onopen = () => setServerStatus(true);
6364
+ let everOpened = false;
6365
+ es.onopen = () => {
6366
+ setServerStatus(true);
6367
+ // A RECONNECT MEANS WE MISSED WHATEVER HAPPENED WHILE WE WERE GONE — and this catches up the
6368
+ // PROJECT half of that, not every arm below (workflow imports, contract writes and the rest
6369
+ // still heal on their next event or a reload). These events are
6370
+ // at-most-once — no `Last-Event-ID`, no replay, and `sse.ts` silently drops a client whose
6371
+ // write throws (backpressure, a slept laptop, AV closing the socket) — so a project renamed
6372
+ // or archived during the gap would leave the Workspaces tab addressing a retired id forever,
6373
+ // with the status dot back to green telling the user everything is fine. Re-announce on
6374
+ // reconnect only (never the first connect, which has nothing to catch up on) and carry NO
6375
+ // payload: workspaces.js answers an empty event by re-reading the live set, which is exactly
6376
+ // the catch-up question. (Found by review.)
6377
+ if (everOpened) {
6378
+ window.dispatchEvent(new CustomEvent('floless:projects-changed', { detail: {} }));
6379
+ // The SAME catch-up for the other half a live `projects-changed` drives (see that arm): the
6380
+ // open workflow's publication availability turns on project state, so a gap leaves the card
6381
+ // asserting a state that may no longer hold. Re-asking for Workspaces but not for Workflows
6382
+ // would fix one stale surface and leave its sibling. (Found by review round 2.)
6383
+ if (currentId) refreshCurrentWorkflowAvailability().catch(reportErr);
6384
+ }
6385
+ everOpened = true;
6386
+ };
6352
6387
  es.onmessage = (e) => {
6353
6388
  let m;
6354
6389
  try { m = JSON.parse(e.data); } catch { return; }
@@ -6379,9 +6414,19 @@
6379
6414
  // RE-APPLIED rather than merely left behind. Nothing self-healed until the user switched
6380
6415
  // workflows. Re-read the payload rather than guess at the new state.
6381
6416
  if (m.appId === currentId) refreshCurrentWorkflowAvailability().catch(reportErr);
6382
- } else if (m.type === 'projects-changed'
6383
- && (typeof m.appId !== 'string' || m.appId === currentId)) {
6384
- refreshCurrentWorkflowAvailability().catch(reportErr);
6417
+ } else if (m.type === 'projects-changed') {
6418
+ // Relayed as a DOM event for the same reason apps-changed is (see that arm below):
6419
+ // workspaces.js owns the project view and is the only listener. It reconciles the project it
6420
+ // has OPEN when another tab — or the terminal AI — renames or archives it; a rename mints a
6421
+ // new project id, and its step frames carry the old one in `?project=`.
6422
+ //
6423
+ // Relayed UNGATED, unlike the availability refresh under it: `appId` scopes the event to a
6424
+ // workflow, and the open PROJECT is a different question — its app need not be the workflow
6425
+ // this tab happens to be showing.
6426
+ window.dispatchEvent(new CustomEvent('floless:projects-changed', { detail: m }));
6427
+ if (typeof m.appId !== 'string' || m.appId === currentId) {
6428
+ refreshCurrentWorkflowAvailability().catch(reportErr);
6429
+ }
6385
6430
  } else if (m.type === 'trace' && m.id === currentId) {
6386
6431
  pushTrace(m.event);
6387
6432
  if (state.currentTab === 'execution') renderInspect();
@@ -8729,6 +8774,13 @@
8729
8774
  openAwareUpdate(version, returnFocusTo) {
8730
8775
  openAwareUpgrade(version, returnFocusTo);
8731
8776
  },
8777
+ // Tab title: workspaces.js owns which project is open, aware.js owns document.title (one
8778
+ // writer — the workflow combo keeps updating underneath in Workspaces mode). Pass the open
8779
+ // project's name, 'Workspaces' on the landing, or null to hand the tab back to the workflow.
8780
+ setWorkspaceTitle(name) {
8781
+ wsTitleName = name || null;
8782
+ syncTabTitle();
8783
+ },
8732
8784
  // ── Workspaces guide beacon (the SAME #guide-beacon/#guide-modal, document variant) ──
8733
8785
  // workspaces.js owns the open project + its lifecycle state; aware.js owns the beacon
8734
8786
  // chrome. workspaces.js calls setWorkspaceGuide() with a small snapshot whenever the
@@ -876,7 +876,7 @@
876
876
  <label>Days</label>
877
877
  <div class="rtn-days" id="rtn-days"></div>
878
878
  </div>
879
- <div class="modal-field" data-sched="daily weekdays weekly" id="rtn-time-field">
879
+ <div class="modal-field" data-sched="daily weekdays weekly">
880
880
  <label for="rtn-hour">At (local time)</label>
881
881
  <div class="rtn-time">
882
882
  <select id="rtn-hour" aria-label="Hour"></select>
@@ -973,7 +973,7 @@
973
973
  <div class="modal-title" id="graft-title">Graft into agent</div>
974
974
  <div class="modal-sub" id="graft-sub">Point at a DLL, package, or API spec — AWARE reads it and builds an agent you can drop into any workflow.</div>
975
975
  <div id="graft-body"></div>
976
- <div class="modal-actions" id="graft-actions">
976
+ <div class="modal-actions">
977
977
  <button id="graft-back" style="margin-right:auto;" hidden>‹ Back</button>
978
978
  <button id="graft-cancel">Cancel</button>
979
979
  <button id="graft-primary" class="primary" disabled>Introspect</button>