@floless/app 0.43.0 → 0.44.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.
@@ -0,0 +1,57 @@
1
+ app: tekla-watch-logger
2
+ version: 0.1.0
3
+ display-name: Tekla Watch → file log
4
+ description: |
5
+ Event-triggered demo: a tekla.watch source streams every model change, and a
6
+ downstream exec node appends each event's details (mark, type, change, guid,
7
+ timestamp) to ~/Documents/floless-watch-log.txt — one line per event. Proves the
8
+ "On trigger" chain end-to-end and leaves a durable, app-closed-verifiable record.
9
+ self_test:true drives 5 synthetic events with no live Tekla; against a real model
10
+ it logs forever while the routine is enabled.
11
+ exposes-as-agent: false
12
+ layout: linear
13
+ requires:
14
+ - tekla@0.1.x
15
+ nodes:
16
+ - id: watch # SOURCE — streaming lifecycle:start; one fire per change
17
+ agent: tekla
18
+ command: watch
19
+ config:
20
+ filter: all
21
+ self_test: true
22
+ include_deleted: true
23
+ - id: log # SINK — append this event's details to the file
24
+ agent: tekla
25
+ command: exec
26
+ mode: read # author intent; AWARE defaults exec→write (issue #165), cosmetic
27
+ config:
28
+ version: "2025.0"
29
+ # Per-event payload bound by the streaming runtime as {{ inputs.<field> }}
30
+ # (orchestrator.propagate_from → execute_and_chain inserts the fired event
31
+ # under `inputs`). Fields: mark, type, change, guid, host, delivered_at.
32
+ args:
33
+ mark: "{{ inputs.mark }}"
34
+ type: "{{ inputs.type }}"
35
+ change: "{{ inputs.change }}"
36
+ guid: "{{ inputs.guid }}"
37
+ at: "{{ inputs.delivered_at }}"
38
+ code: |
39
+ // Append one line per fired event to ~/Documents/floless-watch-log.txt.
40
+ // System.IO is available in exec (System.Net / System.Diagnostics.Process are not).
41
+ string Get(string k) => args != null && args.ContainsKey(k) && args[k] != null
42
+ ? args[k].ToString() : "";
43
+ string mark = Get("mark");
44
+ string type = Get("type");
45
+ string change = Get("change");
46
+ string guid = Get("guid");
47
+ string at = Get("at");
48
+
49
+ string dir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
50
+ string path = System.IO.Path.Combine(dir, "floless-watch-log.txt");
51
+ string stampedAt = string.IsNullOrEmpty(at) ? System.DateTime.UtcNow.ToString("o") : at;
52
+ string line = string.Format("{0}\t{1}\t{2}\t{3}\tguid={4}", stampedAt, change, type, mark, guid);
53
+ System.IO.File.AppendAllText(path, line + System.Environment.NewLine);
54
+
55
+ return new { ok = true, logged = line, path = path };
56
+ connections:
57
+ - { from: watch, to: log }
@@ -0,0 +1,20 @@
1
+ app: tekla-watch-smoke
2
+ version: 0.1.0
3
+ display-name: Tekla Watch (smoke)
4
+ description: |
5
+ Minimal tekla.watch event-source app for capturing the streaming run-trace
6
+ shape (self_test:true drives synthetic events with no live Tekla). Used to
7
+ ground floless.app's "On trigger" fire-detection.
8
+ exposes-as-agent: false
9
+ layout: linear
10
+ requires:
11
+ - tekla@0.1.x
12
+ nodes:
13
+ - id: watch
14
+ agent: tekla
15
+ command: watch
16
+ config:
17
+ filter: all
18
+ self_test: true
19
+ include_deleted: true
20
+ connections: []
@@ -0,0 +1,41 @@
1
+ app: trimble-list-projects
2
+ version: 0.1.0
3
+ display-name: Trimble — list my projects
4
+ description: |
5
+ Lists the Trimble Connect projects you can access (read-only) and renders them
6
+ as an HTML report. Uses the connected `trimble-connect` credential — AWARE
7
+ attaches the stored OAuth token as a Bearer automatically, floless.app never sees
8
+ it — then html-report's generic auto-render turns the result into a table the
9
+ in-app Viewer shows. Foundation demo for Trimble workflow support.
10
+ exposes-as-agent: false
11
+ requires:
12
+ - trimble-connect@0.2.x
13
+ - html-report@0.2.x
14
+ requires-permissions:
15
+ network:
16
+ - https://app.connect.trimble.com
17
+ layout: linear
18
+ # Explicit edge so `report` waits for `projects`. As of AWARE 0.59.0 (#208) a ref
19
+ # like `{{ projects.body }}` auto-derives this edge, so it's belt-and-suspenders now —
20
+ # kept for clarity.
21
+ connections:
22
+ - from: projects
23
+ to: report
24
+ nodes:
25
+ - id: projects
26
+ agent: trimble-connect
27
+ command: list-projects
28
+ config:
29
+ top: 100
30
+ - id: report
31
+ agent: html-report
32
+ command: render
33
+ config:
34
+ data: '{{ projects.body }}'
35
+ title: My Trimble Connect projects
36
+ # The API returns ~20 columns (incl. raw thumbnail URLs + createdBy JSON blobs);
37
+ # keep a clean, useful set and lead with the most recently modified.
38
+ # (html-report columns + sort, AWARE 0.61.0 / #210.)
39
+ columns: [name, location, modifiedOn, filesCount, foldersCount, access]
40
+ sort: modifiedOn
41
+ sort-desc: true
@@ -0,0 +1,65 @@
1
+ app: viewer-3d-demo
2
+ version: 0.1.0
3
+ display-name: 3D Viewer Demo
4
+ description: |
5
+ A self-contained demo of the viewer-3d agent — renders a small steel portal frame as an
6
+ interactive 3D model in the in-app viewer (orbit/zoom, click a member to inspect, a legend
7
+ and a takeoff table). No Tekla model required: a single viewer-3d `render` node with an
8
+ inline, domain-agnostic scene. Use it to preview the interactive 3D surface end to end.
9
+ exposes-as-agent: false
10
+ requires:
11
+ - viewer-3d@0.1.x
12
+ layout: linear
13
+ nodes:
14
+ # The viewer-3d render node IS the terminal: it returns the interactive HTML the viewer shows.
15
+ - id: view
16
+ agent: viewer-3d
17
+ command: render
18
+ config:
19
+ scene:
20
+ meta: { name: "Sample portal frame — 20 m × 24 m", units: mm, up: z }
21
+ groups:
22
+ - { key: column, label: Columns, color: "#60a5fa" }
23
+ - { key: rafter, label: Rafters, color: "#38bdf8" }
24
+ - { key: beam, label: Beams, color: "#94a3b8" }
25
+ - { key: brace, label: Bracing, color: "#818cf8" }
26
+ elements:
27
+ # columns (z 0 -> 6000)
28
+ - { id: COL-A1, group: column, kind: box, from: [0,0,0], to: [0,0,6000], section: { w: 310, d: 310 }, meta: { profile: "UC 305x305x97" } }
29
+ - { id: COL-C1, group: column, kind: box, from: [20000,0,0], to: [20000,0,6000], section: { w: 310, d: 310 }, meta: { profile: "UC 305x305x97" } }
30
+ - { id: COL-A2, group: column, kind: box, from: [0,6000,0], to: [0,6000,6000], section: { w: 310, d: 310 }, meta: { profile: "UC 305x305x97" } }
31
+ - { id: COL-C2, group: column, kind: box, from: [20000,6000,0], to: [20000,6000,6000], section: { w: 310, d: 310 }, meta: { profile: "UC 305x305x97" } }
32
+ - { id: COL-A3, group: column, kind: box, from: [0,12000,0], to: [0,12000,6000], section: { w: 310, d: 310 }, meta: { profile: "UC 305x305x97" } }
33
+ - { id: COL-C3, group: column, kind: box, from: [20000,12000,0], to: [20000,12000,6000], section: { w: 310, d: 310 }, meta: { profile: "UC 305x305x97" } }
34
+ # rafters (eave -> apex -> eave) per frame
35
+ - { id: RAF-L1, group: rafter, kind: box, from: [0,0,6000], to: [10000,0,7500], section: { w: 190, d: 460 }, meta: { profile: "UB 457x191x67" } }
36
+ - { id: RAF-R1, group: rafter, kind: box, from: [10000,0,7500], to: [20000,0,6000], section: { w: 190, d: 460 }, meta: { profile: "UB 457x191x67" } }
37
+ - { id: RAF-L2, group: rafter, kind: box, from: [0,6000,6000], to: [10000,6000,7500], section: { w: 190, d: 460 }, meta: { profile: "UB 457x191x67" } }
38
+ - { id: RAF-R2, group: rafter, kind: box, from: [10000,6000,7500], to: [20000,6000,6000], section: { w: 190, d: 460 }, meta: { profile: "UB 457x191x67" } }
39
+ - { id: RAF-L3, group: rafter, kind: box, from: [0,12000,6000], to: [10000,12000,7500], section: { w: 190, d: 460 }, meta: { profile: "UB 457x191x67" } }
40
+ - { id: RAF-R3, group: rafter, kind: box, from: [10000,12000,7500], to: [20000,12000,6000], section: { w: 190, d: 460 }, meta: { profile: "UB 457x191x67" } }
41
+ # eaves beams (along Y, z 6000) + ridge (x 10000, z 7500)
42
+ - { id: EAV-A1, group: beam, kind: box, from: [0,0,6000], to: [0,6000,6000], section: { w: 170, d: 310 }, meta: { profile: "UB 305x165x40" } }
43
+ - { id: EAV-A2, group: beam, kind: box, from: [0,6000,6000], to: [0,12000,6000], section: { w: 170, d: 310 }, meta: { profile: "UB 305x165x40" } }
44
+ - { id: EAV-C1, group: beam, kind: box, from: [20000,0,6000], to: [20000,6000,6000], section: { w: 170, d: 310 }, meta: { profile: "UB 305x165x40" } }
45
+ - { id: EAV-C2, group: beam, kind: box, from: [20000,6000,6000], to: [20000,12000,6000], section: { w: 170, d: 310 }, meta: { profile: "UB 305x165x40" } }
46
+ - { id: RDG-1, group: beam, kind: box, from: [10000,0,7500], to: [10000,6000,7500], section: { w: 170, d: 310 }, meta: { profile: "UB 305x165x40" } }
47
+ - { id: RDG-2, group: beam, kind: box, from: [10000,6000,7500], to: [10000,12000,7500], section: { w: 170, d: 310 }, meta: { profile: "UB 305x165x40" } }
48
+ # vertical X-bracing (end bay, wall A)
49
+ - { id: BR-A1, group: brace, kind: box, from: [0,0,0], to: [0,6000,6000], section: { w: 140, d: 140 }, meta: { profile: "CHS 139.7x5.0" } }
50
+ - { id: BR-A2, group: brace, kind: box, from: [0,0,6000], to: [0,6000,0], section: { w: 140, d: 140 }, meta: { profile: "CHS 139.7x5.0" } }
51
+ grids:
52
+ - { label: A, at: [0,-2000,0] }
53
+ - { label: B, at: [10000,-2000,0] }
54
+ - { label: C, at: [20000,-2000,0] }
55
+ - { label: "1", at: [-2000,0,0] }
56
+ - { label: "3", at: [-2000,12000,0] }
57
+ panels:
58
+ - title: Takeoff
59
+ note: "Counted from the scene — no Tekla licence."
60
+ columns: [Section, "No.", Length]
61
+ rows:
62
+ - ["UC 305x305x97", 6, "36.0 m"]
63
+ - ["UB 457x191x67", 6, "60.7 m"]
64
+ - ["UB 305x165x40", 6, "36.0 m"]
65
+ - ["CHS 139.7x5.0", 2, "17.0 m"]
package/dist/web/app.css CHANGED
@@ -1599,6 +1599,23 @@
1599
1599
  .app-update:hover { border-color: var(--accent); color: var(--accent); }
1600
1600
  .app-update[disabled] { opacity: 0.6; cursor: default; }
1601
1601
 
1602
+ /* Workflow-update pill (a published workflow has a newer version) — mirrors the app-update pill. */
1603
+ .wf-update-pill { display: none; border: 1px solid var(--accent-dim); background: var(--accent-soft); color: var(--accent-bright); font-size: 10px; padding: 1px 7px; border-radius: 999px; cursor: pointer; margin-left: 8px; line-height: 1.5; }
1604
+ .wf-update-pill:not([hidden]) { display: inline-flex; align-items: center; gap: 4px; }
1605
+ .wf-update-pill:hover { border-color: var(--accent); color: var(--accent); }
1606
+ .wf-update-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
1607
+ /* Changelog list inside the update modal — themed scroll container (no native bar leaks). */
1608
+ .wf-update-changelog { max-height: 280px; overflow-y: auto; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
1609
+ .wf-update-changelog::-webkit-scrollbar { width: 6px; }
1610
+ .wf-update-changelog::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
1611
+ .wf-update-changelog::-webkit-scrollbar-track { background: transparent; }
1612
+ .wf-update-changelog .wf-ver-head { font-family: var(--mono); font-weight: 700; color: var(--text); font-size: 12px; }
1613
+ .wf-update-changelog .wf-ver-sum { color: var(--text-muted); font-size: 11px; margin: 2px 0 6px; }
1614
+ .wf-update-changelog ul { margin: 0; padding-left: 16px; }
1615
+ .wf-update-changelog li { color: var(--text); font-size: 12px; margin: 2px 0; }
1616
+ #wf-update-sub { color: var(--text-muted); }
1617
+ .wf-update-note { font-size: 11px; color: var(--text-muted); margin: 0 0 16px; line-height: 1.5; padding-top: 12px; border-top: 1px solid var(--border); }
1618
+
1602
1619
  /* Add/edit form */
1603
1620
  .modal.routine-edit { width: 540px; max-width: 92vw; max-height: 90vh; overflow-y: auto; }
1604
1621
  #rtn-workflow, .rtn-kind-select { min-width: 0; width: 100%; }
package/dist/web/aware.js CHANGED
@@ -533,6 +533,8 @@
533
533
 
534
534
  // ── load / select / compile / run ───────────────────────────────────────────
535
535
 
536
+ let _wfUpdates = []; // workflow updates available, keyed by app id — polled by refreshWorkflowUpdates() below
537
+
536
538
  async function loadApp(id) {
537
539
  const { app } = await api(`/api/app/${encodeURIComponent(id)}`);
538
540
  apps.set(id, app);
@@ -554,6 +556,7 @@
554
556
  markSpecialNodes();
555
557
  paintGate(app);
556
558
  refreshDirtyIndicator(); // clean app → dot off; switched back to a dirty one → dot on
559
+ renderWfUpdatePill(); // show the "↑ Update to vX" pill when THIS app has a newer published version
557
560
  }
558
561
 
559
562
  async function loadApps() {
@@ -2826,6 +2829,82 @@
2826
2829
  setInterval(refreshUpdate, 60 * 60 * 1000); // hourly backstop; the focus re-check (below) is the fast path
2827
2830
  }
2828
2831
 
2832
+ // ── Workflow update (module-shaped) ─────────────────────────────────────────────
2833
+ // A FloLess-published workflow (e.g. steel-takeoff) has a newer bundled template. Poll GET
2834
+ // /api/workflows/updates; when the OPEN app has one, show a pill → modal with the changelog →
2835
+ // "Back up & update" POSTs /api/workflows/:id/update (backup → swap structure → re-bake the user's
2836
+ // data from the contract store → recompile) → reload the app. No auto-update. `_wfUpdates` + the
2837
+ // renderWfUpdatePill() call in loadApp() live earlier; renderWfUpdatePill queries the DOM so it's
2838
+ // safe to call before this block initialises.
2839
+ const $wfUpdate = document.getElementById('wf-update');
2840
+ const $wfUpdateModal = document.getElementById('wf-update-modal');
2841
+ let _wfUpdateApplying = false;
2842
+ function wfUpdateFor(id) { return _wfUpdates.find((u) => u.id === id) || null; }
2843
+ function renderWfUpdatePill() {
2844
+ const el = document.getElementById('wf-update');
2845
+ if (!el) return;
2846
+ const u = currentId ? wfUpdateFor(currentId) : null;
2847
+ if (u) {
2848
+ el.textContent = '↑ Update to v' + u.available;
2849
+ el.dataset.tip = 'A newer version of this workflow is available — see what changed';
2850
+ el.hidden = false;
2851
+ } else {
2852
+ el.hidden = true;
2853
+ }
2854
+ }
2855
+ async function refreshWorkflowUpdates() {
2856
+ try {
2857
+ const r = await fetch('/api/workflows/updates');
2858
+ const d = await r.json();
2859
+ _wfUpdates = (r.ok && d.ok && Array.isArray(d.updates)) ? d.updates : [];
2860
+ } catch { _wfUpdates = []; }
2861
+ renderWfUpdatePill();
2862
+ }
2863
+ function openWfUpdateModal(u) {
2864
+ if (!$wfUpdateModal) return;
2865
+ const a = apps.get(u.id);
2866
+ const name = (a && a.displayName) || u.id;
2867
+ document.getElementById('wf-update-title').textContent = `Update “${name}” to v${u.available}`;
2868
+ document.getElementById('wf-update-sub').textContent = `You’re on v${u.installed}. What’s new:`;
2869
+ const changelog = Array.isArray(u.changelog) ? u.changelog : [];
2870
+ document.getElementById('wf-update-changelog').innerHTML = changelog.map((e) => {
2871
+ const changes = Array.isArray(e.changes) && e.changes.length
2872
+ ? '<ul>' + e.changes.map((c) => `<li>${escapeHtml(String(c))}</li>`).join('') + '</ul>' : '';
2873
+ return `<div class="wf-ver"><div class="wf-ver-head">v${escapeHtml(String(e.version))}</div>`
2874
+ + (e.summary ? `<div class="wf-ver-sum">${escapeHtml(String(e.summary))}</div>` : '') + changes + '</div>';
2875
+ }).join('') || '<div class="wf-ver-sum">No changelog provided.</div>';
2876
+ showModal($wfUpdateModal);
2877
+ }
2878
+ async function applyWfUpdate(u) {
2879
+ if (_wfUpdateApplying) return;
2880
+ _wfUpdateApplying = true;
2881
+ const $ok = document.getElementById('wf-update-ok');
2882
+ const prev = $ok ? $ok.textContent : '';
2883
+ if ($ok) { $ok.disabled = true; $ok.textContent = 'Updating…'; }
2884
+ try {
2885
+ const r = await fetch(`/api/workflows/${encodeURIComponent(u.id)}/update`, { method: 'POST', headers: { 'content-type': 'application/json' } });
2886
+ const d = await r.json().catch(() => ({}));
2887
+ if (!r.ok || !d.ok) throw new Error(d.error || 'update failed');
2888
+ hideModal($wfUpdateModal);
2889
+ showToast(`Updated to v${d.toVersion} — your data is preserved, a backup was saved.`, 'ok');
2890
+ await refreshWorkflowUpdates();
2891
+ if (currentId === u.id) await loadApp(currentId); // reload to show the new structure
2892
+ } catch (e) {
2893
+ showToast('Workflow update failed — ' + String((e && e.message) || e).slice(0, 100), 'warn');
2894
+ } finally {
2895
+ _wfUpdateApplying = false;
2896
+ if ($ok) { $ok.disabled = false; $ok.textContent = prev; }
2897
+ }
2898
+ }
2899
+ if ($wfUpdate) {
2900
+ $wfUpdate.onclick = () => { const u = currentId && wfUpdateFor(currentId); if (u) openWfUpdateModal(u); };
2901
+ const $cancel = document.getElementById('wf-update-cancel'); if ($cancel) $cancel.onclick = () => hideModal($wfUpdateModal);
2902
+ const $ok = document.getElementById('wf-update-ok'); if ($ok) $ok.onclick = () => { const u = currentId && wfUpdateFor(currentId); if (u) applyWfUpdate(u); };
2903
+ if ($wfUpdateModal) onBackdropDismiss($wfUpdateModal, () => hideModal($wfUpdateModal));
2904
+ refreshWorkflowUpdates();
2905
+ setInterval(refreshWorkflowUpdates, 60 * 60 * 1000);
2906
+ }
2907
+
2829
2908
  // Dev-override helper — the ONLY forced-visible path. Reveals a pill with a fixed
2830
2909
  // version when localStorage['floless.dev.forceUpdate'] matches the component, so an
2831
2910
  // E2E can exercise the popover without a real pending update. Returns true if forced.
@@ -54,6 +54,7 @@
54
54
  </div>
55
55
  </div>
56
56
  <select id="prompt-select" hidden></select>
57
+ <button id="wf-update" class="wf-update-pill" type="button" hidden aria-haspopup="dialog"></button>
57
58
  <!-- Agents (⊞) and Routines (⏱) buttons moved into the ≡ menu in #149
58
59
  (Ctrl+G / Ctrl+R); the toolbar keeps only the run-critical controls. -->
59
60
  <span class="ctl-sep" aria-hidden="true"></span>
@@ -241,6 +242,22 @@
241
242
  </div>
242
243
  </div>
243
244
 
245
+ <!-- Workflow update: a FloLess-published workflow has a newer version. The changelog (entries
246
+ newer than installed) renders into #wf-update-changelog; "Back up & update" swaps the
247
+ structure but keeps the user's data (re-baked from the contract store). -->
248
+ <div class="modal-backdrop" id="wf-update-modal">
249
+ <div class="modal">
250
+ <div class="modal-title" id="wf-update-title">Workflow update</div>
251
+ <div class="modal-sub" id="wf-update-sub"></div>
252
+ <div class="wf-update-changelog" id="wf-update-changelog"></div>
253
+ <div class="wf-update-note">Your work is safe — this updates the workflow's steps and keeps your data. A backup of the current version is saved first.</div>
254
+ <div class="modal-actions">
255
+ <button id="wf-update-cancel">Not now</button>
256
+ <button id="wf-update-ok" class="primary">↑ Back up &amp; update</button>
257
+ </div>
258
+ </div>
259
+ </div>
260
+
244
261
  <div class="menu" id="menu" role="menu">
245
262
  <button class="menu-item" data-action="open" role="menuitem">
246
263
  <span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"/></svg></span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {