@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
@@ -1,131 +1,76 @@
1
1
  ---
2
2
  name: floless-app-ui
3
- description: This skill should be used when the user wants to customize the floless.app Dashboard — add, change, rearrange, or remove custom panels (stat cards, data tables, report buttons, run buttons) — or when picking up queued 'ui-customize' requests from the floless.app Customize box. Use it when the user says things like "add a panel showing last night's BOM run", "pin a run button to my dashboard", "apply my dashboard change", "customize my floless dashboard", "pick up my floless UI request", after they type into the Dashboard's Customize box, OR when they paste a message beginning with a `[floless-request type=ui-customize id=…]` marker (a request copied from the Dashboard — resolve it via /api/requests, don't run it verbatim). It edits ~/.floless/ui/extensions.json (the declarative UI descriptor), validates with the AWARE ui agent, and the app re-renders live.
3
+ description: This skill should be used when the user wants to extend or customize FloLess itself — "make an add-on", "add a custom profile", "add my own section/shape", "write a script that runs inside FloLess", "add a toolbar button", "connect FloLess to a program it doesn't support", "build me a plugin", "customize FloLess", "open My add-ons" — and when someone asks for the old Dashboard ("add a panel to my dashboard", "customize my dashboard", "pin a run button") or pastes an old `[floless-request type=ui-customize …]` marker. FloLess add-ons (definitions such as custom profiles, sandboxed scripts, connectors and toolbar buttons, managed in ≡ → My add-ons) are being built under floless.app #3296 and none of it ships yet, so this skill says that plainly and routes the ask to what exists today — a workflow, a Page, or a skill. It is the seed of the add-on authoring skill and will grow into it as add-ons ship.
4
4
  metadata:
5
- version: 0.1.2
5
+ version: 0.2.0
6
6
  ---
7
7
 
8
- # floless.app Custom Panels — the dashboard descriptor
9
-
10
- floless.app's Dashboard view renders **`~/.floless/ui/extensions.json`** — one declarative
11
- JSON document describing the user's custom panels. **You (the terminal AI) compose the
12
- description; floless.app renders it** with its own design system. You never write HTML,
13
- CSS, or JS — and never need to: every string in the descriptor is escaped at render time,
14
- so markup would show up as literal text.
15
-
16
- The file is watched: the moment you write it, the open FloLess window or browser tab re-renders the Dashboard.
17
- No compile, no approve, no restart.
18
-
19
- ## Picking up a queued request
20
-
21
- When the user types into the Dashboard's **Customize box**, floless.app queues a request:
22
-
23
- ```sh
24
- curl -s http://127.0.0.1:4317/api/requests # → { ok, requests: [...] }
25
- ```
26
-
27
- ```jsonc
28
- // type "ui-customize" — a dashboard change in plain English. No appId (it's
29
- // workspace-level); panelId optionally scopes it to one existing panel.
30
- { "id": "uuid", "type": "ui-customize", "status": "pending",
31
- "instruction": "show last night's BOM run as a table with a re-run button",
32
- "panelId": null }
33
- ```
34
-
35
- Workflow: read the request → edit `extensions.json` (below) → validate → **delete the
36
- processed request** (`curl -s -X DELETE http://127.0.0.1:4317/api/requests/<id>`).
37
- The request files also live at `~/.floless/requests/*.json` if the server is down.
38
-
39
- ## The descriptor schema (v1)
40
-
41
- Authoritative sources — read them, don't guess field names:
42
-
43
- ```sh
44
- aware agent describe ui # the agent's commands
45
- aware agent skill ui descriptor-authoring.md # the full authoring guide
46
- aware agent invoke ui catalog --json # machine-readable block contracts
47
- ```
48
-
49
- Shape: `{ "version": 1, "panels": [ { "id", "slot", "title", "blocks": [...] } ] }`
50
-
51
- - `id` — unique, `[a-z0-9-]+` (floless.app keys panels by it).
52
- - `slot` — floless.app honors **`"dashboard"`** (the Dashboard grid) and
53
- **`"inspect-tab"`** (an extra tab in the right Inspect column, after Execution).
54
- Anything else falls back to the Dashboard.
55
- - `blocks` — ordered; order is the layout. Types floless.app renders:
56
- - `stat` `{label, value, hint?}` — a KPI card. Consecutive stats become one strip;
57
- lead a panel with 2–4. Values are LITERALS — write the number/text yourself.
58
- - `table` `{source, columns?, sort?, "sort-desc"?}` — a data table fed by a
59
- floless-resolved `source` (below). Columns/sort mirror html-report (#210).
60
- - `text` `{content}` — escaped prose; blank lines separate paragraphs.
61
- - `report` `{source, title?}` — a "View report" button opening the run's HTML
62
- report in the app's sandboxed viewer.
63
- - `action` `{label, "action-id", inputs?}` — a button. floless.app wires ONLY
64
- `"action-id": "run-app:<appId>"` (runs that installed workflow with `inputs`,
65
- respecting the compile/lock gate). Other action-ids render inert.
66
- - An unknown `type` renders as a friendly placeholder — never an error — so
67
- composing for a newer FloLess degrades safely.
68
-
69
- ## Source strings the floless server resolves
70
-
71
- `table.source` / `report.source` bind data BY NAME; floless.app resolves these:
72
-
73
- | source | payload |
74
- |---|---|
75
- | `last-run-output:<appId>` | the app's latest run trace → `{appId, runId, status, rows, html}` — `table` uses the rows, `report` uses the html |
76
- | `last-run-status:<appId>` | `{appId, status, finishedAt, runId}` of the latest run |
77
- | `routine-status:<routineId-or-appId>` | `{id, name, workflow, kind, enabled, nextFireAt, lastRun, broken}` from the user's routines |
78
-
79
- `<appId>` is an installed app id (`aware app list`). An unresolvable source renders a
80
- quiet "no data yet" placeholder — the descriptor outlives any one run, so binding to an
81
- app that hasn't run yet is fine.
82
-
83
- ## Worked example
84
-
85
- ```json
86
- {
87
- "version": 1,
88
- "panels": [
89
- {
90
- "id": "morning-bom",
91
- "slot": "dashboard",
92
- "title": "Morning BOM",
93
- "blocks": [
94
- { "type": "stat", "label": "Scope", "value": "Phase 2", "hint": "live Tekla model" },
95
- { "type": "table", "source": "last-run-output:tekla-bom-by-phase",
96
- "columns": ["profile", "qty"], "sort": "qty", "sort-desc": true },
97
- { "type": "report", "source": "last-run-output:tekla-bom-by-phase", "title": "Full BOM report" },
98
- { "type": "action", "label": "Re-run BOM", "action-id": "run-app:tekla-bom-by-phase",
99
- "inputs": { "phase": 2 } }
100
- ]
101
- }
102
- ]
103
- }
104
- ```
105
-
106
- ## Write → validate → done
107
-
108
- 1. **Edit atomically**: write to `~/.floless/ui/extensions.json.tmp`, then rename over
109
- `~/.floless/ui/extensions.json` (the watcher fires once, on a complete file). Create
110
- `~/.floless/ui/` if missing. Edit the EXISTING file when the user is changing/adding —
111
- read it first; replace it wholesale only when they ask to start over.
112
- 2. **Validate** (the check, before or right after writing):
113
- ```sh
114
- aware agent invoke ui validate --inputs '{"descriptor": { ...the json... }}' --json
115
- # or, for a large descriptor: --inputs @args.json where args.json = {"descriptor": …}
116
- ```
117
- Fix `errors` (the UI falls back to the default view on an invalid file and shows a
118
- warning); review `warnings` (typos surface as unknown-field warnings).
119
- 3. **Delete the processed request** if you picked one up from `/api/requests`.
120
- 4. Nothing else — the app re-renders live and shows a "Customized" badge.
121
-
122
- ## Guardrails
123
-
124
- - **Never write raw HTML/markup into descriptor strings** — it renders as literal text
125
- by design. Describe; don't mark up.
126
- - Every write is recorded in the app's undo timeline (`~/.floless/ui/timeline.json`,
127
- newest 20 states), and the user has multi-level **Undo / Redo** and **Reset to default**
128
- in the app — so be bold composing, but never destructive: don't delete panels the user
129
- didn't ask to remove, and prefer editing the existing document over regenerating it.
130
- - The UI renders; AWARE runs; you compose. Don't put computed values in `stat` blocks
131
- that a `source`-bound block could keep live — a stale hand-written number misleads.
8
+ # Extending FloLess — add-ons (coming) and what to use today
9
+
10
+ People ask to make FloLess their own: a custom steel profile, a little tool that runs inside the
11
+ model editor, a button that does their usual three steps, a link to a program FloLess does not
12
+ connect to. FloLess's answer to all of that is **add-ons**. This skill is where the AI learns to
13
+ author them. Today it does one thing well: it tells the person where that stands, and builds what
14
+ they asked for with the pieces FloLess already has.
15
+
16
+ ## Where add-ons stand
17
+
18
+ **None of this ships yet. Never tell the person it does, and never write files that pretend to be an
19
+ add-on.** FloLess add-ons are being built under floless.app #3296 (design:
20
+ `docs/superpowers/specs/2026-11-07-add-ons-design.md` in the floless.app repo). When they land, an
21
+ add-on will be a folder the AI writes from the chat, made of any of:
22
+
23
+ - **Definitions** — new things in a model, such as a custom profile, that travel inside the model so
24
+ it still opens without the add-on;
25
+ - **Scripts** — small tools the AI writes, running sandboxed inside FloLess and reaching it only
26
+ through a narrow, versioned add-on API;
27
+ - **Connectors** — an AWARE agent for a program FloLess does not support, so a workflow can use it;
28
+ - **Toolbar buttons** — one click that starts a script, opens a Page, runs a workflow or asks the AI.
29
+
30
+ They will be managed in one place, **≡ → My add-ons**. Every add-on arrives **off**, is labelled
31
+ **unreviewed**, and only a person turns it on, after seeing in plain English what it can reach. The
32
+ AI may make and change an add-on; it never turns one on.
33
+
34
+ Until that ships there is no `~/.floless/add-ons/` folder to write, no My add-ons screen, and no
35
+ add-on API. Say so in one sentence, then move on to what you can build now.
36
+
37
+ ## What to use today
38
+
39
+ Most add-on ideas already have a home. Pick the one that fits, say why in one line, and build it:
40
+
41
+ | The person wants… | Use today | How |
42
+ |---|---|---|
43
+ | A repeatable process: read something, change a model, make a report, send it somewhere | **A workflow** | `floless-app-new-workflow` to build one from scratch; `floless-app-workflows` to change one |
44
+ | Something to look at and keep: a chart, a table, a summary, a small dashboard | **A Page** | `pages.create` (see `floless-app-actions`, "Pages") — FloLess keeps, versions and opens it |
45
+ | It to run on a timer or whenever the model changes | **A routine** on a workflow | `floless-app-routines` |
46
+ | The AI to know how they work: their conventions, their checks, their wording | **A skill**, or the project's Knowledge | write a skill for their terminal AI; for project facts use `floless-app-knowledge` |
47
+ | A program FloLess does not connect to | **An AWARE agent**, used as a workflow step | `aware build agent`, then a workflow that calls it (`floless-app-workflows`) |
48
+ | A custom profile, a script inside the editor, a toolbar button | **Not yet possible** | say it is coming with add-ons (#3296); offer the nearest workflow or Page, or note the idea for them |
49
+
50
+ Do not invent a stand-in for the parts that do not exist: no hand-edited files under `~/.floless/`,
51
+ no extra buttons patched into FloLess's pages, no "add-on" folder FloLess will never read.
52
+
53
+ ## The old Dashboard is gone
54
+
55
+ FloLess used to have a hidden Custom Panels Dashboard (`~/.floless/ui/extensions.json`). It was
56
+ removed (floless.app #3296, slice S0) because nobody used it. If someone asks for a dashboard panel,
57
+ or pastes an old `[floless-request type=ui-customize …]` marker:
58
+
59
+ 1. Tell them in one sentence that the Dashboard was removed, and that the same thing is now a Page.
60
+ 2. Offer to make it as a **Page** (`pages.create`): a table of their latest runs, a status card, a
61
+ chart. A Page is kept and versioned, and it opens in FloLess's sealed viewer.
62
+ 3. For "a button that runs my workflow", the workflow itself is the button: point them to it in the
63
+ Workflows tab, or set up a routine if they want it to run on its own.
64
+
65
+ An old `ui-customize` request can still sit in the queue: FloLess no longer acts on that type, but it
66
+ still lists it and lets it be cleared. Find it with `requests.list` (match the marker's id) to read
67
+ what was asked, offer the Page as above, and then clear it with `requests.clear`. That is a
68
+ confirmed deletion, so the person confirms it on the card. Never leave it pending once its ask has
69
+ been answered or turned down.
70
+
71
+ ## When add-ons ship
72
+
73
+ This skill becomes the add-on authoring skill: the manifest, the definitions, the script API and its
74
+ grants, connectors, buttons, versions, and how to ask the person to turn an add-on on. Until then,
75
+ keep every answer to what exists today, and keep the person's idea: if they describe an add-on they
76
+ want, write it down in plain English so it is ready when the time comes.
@@ -2,7 +2,7 @@
2
2
  name: floless-app-workflows
3
3
  description: This skill should be used when building, modifying, or reasoning about FloLess .flo workflows for floless.app — especially reusable apps that take inputs (e.g. a phase number) and run across different models from any source (Tekla, Revit, Rhino, SketchUp, an IFC file, the FloLess steel model, a Workspace project), exec nodes that run code against a live host model (e.g. Roslyn C# in Tekla), Blender animations of a building (blender/exec Python rendered headlessly — construction sequence, fly-through, sun study), the in-app HTML Viewer, the Code tab, or "Debug in VS". Covers the exec contract, the install→validate→compile→run loop, app inputs templating, reading approved Workspace project data and immutable approved Revit model snapshots through the floless-workspace REST seam plus its themed pickers, and the server seams (aware-adapter, app-reader, index).
4
4
  metadata:
5
- version: 0.8.9
5
+ version: 0.8.12
6
6
  ---
7
7
 
8
8
  # Building reusable .flo workflows in floless.app
@@ -123,13 +123,21 @@ templates in prose without braces (e.g. "reads `node.result.x`"). The only legit
123
123
  in `config.args` values. (`tekla-bom`'s comments dodge this only because they reference an
124
124
  *upstream* node that has already run — fragile; prefer no braces in code at all.)
125
125
 
126
+ > **Steps that touch no host run on `script`, not on a host bridge (#3234).** The BOM demo above
127
+ > predates AWARE's built-in `script/run` runner (JavaScript, no host). In a new workflow only the step
128
+ > that really reads the model is `tekla/exec` (or `revit`, `rhino`, … `exec`); the input, comparison
129
+ > and report steps are `script/run`. A workflow whose steps are all `script` needs no host at all.
130
+ > Read `references/script-runner.md`. **Only when `aware --version` is 0.175.0 or newer**: older AWAREs have no `script` runner and refuse the workflow. There, a workflow that already uses a host keeps these steps on that host's `exec` as before; a workflow with no host uses AWARE's other built-ins where they fit (`file`, `html-report`), and if a step can only be written as `script/run`, tell the person it needs AWARE 0.175.0 or newer before you write it.
131
+ > Run `aware --version` before you choose.
132
+
126
133
  ### Why all three nodes are `tekla/exec` (hard constraints — predicates can't carry data)
127
134
 
128
135
  - **Inline nodes can't carry data.** Only `inline.kind: predicate` runs, and predicates return a
129
136
  **boolean** — they cannot emit a value to a downstream node. `kind: shape`/`map` (which could
130
137
  reshape/pass data) are **rejected at validate + compile** on aware 0.46 (`E_APP_INLINE_KIND`,
131
138
  closed #160) and marked reserved/not-yet-runtime-supported. So a genuine input→logic→viewer
132
- **data flow** can only be built from real host (`exec`) nodes.
139
+ **data flow** was built from real host (`exec`) nodes. Today a step that carries or reshapes data
140
+ without the model is `script/run` (`references/script-runner.md`).
133
141
  - **The `html-report` agent ships no binary** and on aware 0.46 is marked `status: planned` and
134
142
  **rejected** at validate/install/compile/run (`E_APP_AGENT_UNAVAILABLE`, closed #161) — never
135
143
  use it as the viewer. The viewer is a `tekla/exec` node that **forwards `{{ bom.result.html }}`**
@@ -166,6 +174,15 @@ Two rules that bite immediately:
166
174
  Do **not** write a file. AWARE ships no html-report render binary, and inline HTML keeps the
167
175
  app model-agnostic (no filesystem permission, no hardcoded path). The HTML Viewer renders
168
176
  whatever the node returns.
177
+ - **Style the report's whole page, never only its text.** Set the page background AND the text
178
+ colour explicitly (`html, body { background: …; color: … }`), then either style both themes or
179
+ pick one on purpose and declare it: `:root { color-scheme: light; }` for a light report,
180
+ `color-scheme: dark` for a dark one, or `color-scheme: light dark` plus an
181
+ `@media (prefers-color-scheme: dark)` block that resets the background, text, borders and table
182
+ headers together. Text colours with no background were an AI-authored report's failure (#3233): white
183
+ headers and dark-grey text on a dark page. The viewer now puts a report that paints no page on a light
184
+ page unless its own text is light, but the report is also opened, shared and printed outside
185
+ FloLess, where no viewer chooses for it. See `references/exec-contract.md` "Styling a report".
169
186
  - **A report with files (images, a 3D model, data) — `report_folder`.** Every successful real run's
170
187
  report becomes the next version of the workflow's Page. When the report needs files beside it,
171
188
  write them under one folder as `<folder>/assets/...` (up to two folders deep inside `assets/`,
@@ -391,7 +408,9 @@ differ each run. Read `references/agent-steps.md` before adding one. The rules i
391
408
  - Use one only for work that needs judgement at run time; anything a fixed rule can do stays an ordinary node.
392
409
  - Find the Agent with `agent-steps.agents`, then get the step from FloLess with the `agent-steps.block` action and copy it byte for byte (the step and its
393
410
  `<id>-ok` predicate); never type the pinned fields. Wire what feeds it into the step, and `<id>-ok` into the
394
- first node that uses the answer.
411
+ first node that uses the answer. When the answer only goes to a report, ask for `use: carry` instead: no
412
+ check, and the report shows the answer, or the Agent's questions above what it wrote, so a needs-you answer
413
+ still reaches the person. Keep the gate in front of anything that writes.
395
414
  - Put a **confirm** step (and an `e.body.proceed == true` predicate) before anything that writes, and make the
396
415
  write read only the confirm step's `approvedValues`.
397
416
  - Add `nondeterministic-output: acknowledged` (AWARE's marker; not consent), then check the workflow with
@@ -26,16 +26,19 @@ whole workflow: the step and its instructions are pinned by the lock, and only t
26
26
  2. **Get the pinned step from FloLess, never type it.** Call the `agent-steps.block` action with the
27
27
  Agent's id and, when you know them, the workflow id, a starting node id, one plain-English
28
28
  description, the `context` template that feeds it (for example `{{ read-notes.result.text }}`),
29
- the provider and the answer format (`{"format":"text"}` or `{"format":"json","fields":{…}}`).
30
- It returns YAML with two parts:
29
+ the provider, the answer format (`{"format":"text"}` or `{"format":"json","fields":{…}}`) and
30
+ **`use`**: `gate` or `carry` (see "Gate or carry" below; `gate` is the default).
31
+ With `use: gate` it returns YAML with two parts:
31
32
  - `nodes:` — the step itself (`agent: floless-agent-step`, `command: reason`) and its **`<id>-ok`**
32
33
  predicate, which stops the run cleanly when the Agent could not answer;
33
34
  - `connections:` — `<id>` → `<id>-ok`.
34
- Copy both parts **byte for byte**. The pinned fields (instructions, agent id and revision, provider,
35
+ With `use: carry` it returns the step alone, with `connections: []`.
36
+ Copy what it returns **byte for byte**. The pinned fields (instructions, agent id and revision, provider,
35
37
  scope, output, limits) are what the lock approves; a retyped field is a different step.
36
- 3. **Wire it.** Add your own connections: the node that feeds the step → `<id>`, and `<id>-ok` → the
37
- first node that uses the answer. Every node that uses the answer must come **after `<id>-ok`**, so it
38
- never runs on a step that did not answer.
38
+ 3. **Wire it.** Add your own connections: the node that feeds the step → `<id>`, then either
39
+ `<id>-ok` → the first node that uses the answer (gate), or `<id>` → the report that shows it (carry).
40
+ In a gated step every node that uses the answer must come **after `<id>-ok`**, so it never runs on a
41
+ step that did not answer.
39
42
  4. **Read the answer by its path.** A text answer is `{{ <id>.body.text }}`; a JSON answer's field is
40
43
  `{{ <id>.body.answer.<field> }}`. Questions and assumptions the Agent raised are listed in the run
41
44
  record for the person; do not try to act on them in the workflow.
@@ -68,6 +71,37 @@ whole workflow: the step and its instructions are pinned by the lock, and only t
68
71
  Agent: newer instructions, a deleted Agent, or a project the step can no longer read. Fix what it
69
72
  reports by asking for a fresh block, never by editing pinned fields.
70
73
 
74
+ ## Gate or carry
75
+
76
+ An Agent that needs the person does not fail: it answers `body.ok: false` with `body.outcome: needs-you`,
77
+ its questions in `body.questions`, and often a full written answer in `body.text` anyway. What happens
78
+ next is your choice when you ask for the block.
79
+
80
+ - **Carry the answer to a report** (`use: carry`) when the next thing only **shows** the answer — a
81
+ report, a summary page, a message the person reads. Nothing stops: the report gets the step's body
82
+ every time and must render all three cases from it:
83
+ - `body.ok` is true — show the answer (`body.text`, or the JSON fields under `body.answer`);
84
+ - `body.ok` is false and `body.text` is not empty — show an amber **"Waiting for your answer"** box
85
+ listing `body.questions` (and `body.assumptions`), then the Agent's answer below it, so nothing it
86
+ wrote is lost;
87
+ - `body.text` is empty — say "The AI gave no answer this run" with the reason FloLess recorded
88
+ (`body.message`), and the questions if any.
89
+ Every one of these fields is present in every answer, including a step FloLess could not start, so the
90
+ report never needs a guard against a missing field. Escape the text like any other value you put in
91
+ HTML: it is the Agent's words, not markup.
92
+ - **Keep the `-ok` gate** (`use: gate`) when anything after the step **writes or changes** something —
93
+ a model, a file, a design program, a message sent on someone's behalf — or when a later step must not
94
+ act on an answer the person has not settled. A gated write still also needs its confirm step (step 5
95
+ above). Never connect a carry step to a step that writes; the helper says so too.
96
+
97
+ When a gated step stops a run, FloLess says so, and never as "Run complete". After a Run, a scheduled
98
+ run or a run confirmed in AI Chat, a report made before the stop opens under a banner that says the run
99
+ stopped there; its button opens the step's questions (or Last run when there are none). Last run names
100
+ the step, and the routine's history row reads "Stopped at AI step". A watcher shows each report the moment
101
+ it is made, before the check runs, so it shows no banner; the event's history row and the watcher's card
102
+ still count the questions waiting for the person.
103
+ You do not need to add any of that yourself.
104
+
71
105
  ## The person confirms — never you
72
106
 
73
107
  Before the workflow can be approved and run, the person ticks in FloLess's approval dialog that it has
@@ -4,6 +4,11 @@ The `tekla` agent's `exec` command runs a C# **script** (Roslyn scripting, not a
4
4
  inside the host bridge `aware-tekla.exe`, which is connected to a running Tekla Structures
5
5
  instance with a model open. Reference impl: `demos/tekla-bom-by-phase/bom-by-phase.exec.cs`.
6
6
 
7
+ Use it only in a step that really reads or changes the Tekla model. A step that compares data,
8
+ shapes rows or builds the report HTML from earlier results runs on `script/run` instead
9
+ (`script-runner.md`) when `aware --version` is 0.175.0 or newer: it needs no Tekla, and the workflow then
10
+ needs Tekla only where it uses it. On an older AWARE keep it on `exec`.
11
+
7
12
  ## Globals injected into the script
8
13
 
9
14
  | Global | Type | Notes |
@@ -38,6 +43,28 @@ For a report node, return the HTML **inline**:
38
43
  `return new { ok = true, phase, html = sb.ToString(), modelName, totalParts, … };`
39
44
  floless extracts `data.result.html` for the HTML Viewer.
40
45
 
46
+ ### Styling a report (#3233)
47
+
48
+ A report is a whole page: set its background and text colour explicitly, and say which theme it is
49
+ written for. Partial styling, such as `body{color:#1f2328}` and `th{background:#f6f8fa}` with no page
50
+ background, rendered as white headers and dark-grey text on the viewer's dark page.
51
+
52
+ - **One theme, on purpose:** declare it and paint it.
53
+ `:root{color-scheme:light} html,body{background:#ffffff;color:#1f2328}`, or the dark equivalent
54
+ with `color-scheme:dark`.
55
+ - **Both themes:** `:root{color-scheme:light dark}`, light values first, then one
56
+ `@media (prefers-color-scheme: dark){…}` block that resets every colour you set: background, text,
57
+ borders, table headers and row stripes. A dark block that resets only some of them leaves light
58
+ boxes on a dark page.
59
+ - What FloLess adds follows the report's declared `color-scheme`, not the reader's system theme:
60
+ the AI-generated pill and footer, and the approval and bridge-warning notes. Each paints its own
61
+ background, so it reads on any page. A report that paints itself dark without declaring it gets the
62
+ light versions, so declare it.
63
+ - In the in-app viewer, a report that paints no page sits on a light page, or on a dark one when its
64
+ own body text is light. Inside the frame, `prefers-color-scheme` follows the computer's theme, not
65
+ FloLess's ☀/☾ setting. Opened in a browser, shared or printed, the report gets no help, so it must
66
+ carry its own page.
67
+
41
68
  ## References available / NOT available
42
69
 
43
70
  - **Available:** `System`, `System.Collections.Generic`, `System.Linq`, `System.Text`,
@@ -0,0 +1,105 @@
1
+ # The host-neutral runner: `script/run` (JavaScript, no host)
2
+
3
+ Use `agent: script, command: run` for every step that touches **no host model**: comparing two data files,
4
+ filtering or totalling rows, shaping a schedule, building the report HTML. Use a host's own `exec`
5
+ (`tekla/exec`, `blender/exec`, …) only in the step that really reads or changes that host's model. A step
6
+ that only builds HTML on a host bridge ties the whole workflow to that host for nothing: the workflow then
7
+ needs the host installed and open, its card names the host, and it cannot run beside a live watcher on it.
8
+
9
+ `script` is built into AWARE (no bridge, no install of a host tool). It needs AWARE 0.175.0 or newer.
10
+ **Run `aware --version` before you choose a runner.** On an older AWARE there is no `script` runner and a
11
+ workflow that uses it is refused. There, a workflow that already uses a host keeps those steps on that host's
12
+ `exec` as before; a workflow with no host uses AWARE's other built-ins where they fit (`file`, `html-report`), and
13
+ if a step can only be written as `script/run`, tell the person it needs AWARE 0.175.0 or newer. FloLess's card and
14
+ canvas then tell the person that a newer AWARE is needed if they open a `script` workflow there.
15
+
16
+ ## The node
17
+
18
+ ```yaml
19
+ requires:
20
+ - script@0.1.x
21
+ nodes:
22
+ - id: compare
23
+ agent: script
24
+ command: run
25
+ config:
26
+ language: javascript
27
+ files:
28
+ design: "C:/Projects/ADNOC/exports/design.json" # literal, absolute
29
+ contract: "C:/Projects/ADNOC/exports/contract.json"
30
+ args:
31
+ phase: "{{ inputs.phase }}"
32
+ tolerance: 0.5
33
+ code: |
34
+ // Compares the design export with the contract quantities and lists every member
35
+ // whose weight differs by more than the tolerance.
36
+ const design = files.design.json;
37
+ const contract = files.contract.json;
38
+ const rows = design.members.filter((m) => m.phase === args.phase);
39
+ return { ok: true, count: rows.length, rows };
40
+ - id: report
41
+ agent: script
42
+ command: run
43
+ config:
44
+ language: javascript
45
+ args: { rows: "{{ compare.result.rows }}", at: "{{ compare.result.count }}" }
46
+ code: |
47
+ // Builds the HTML report from the compared rows.
48
+ const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' })[c]);
49
+ const body = args.rows.map((r) => `<tr><td>${esc(r.mark)}</td><td>${esc(r.weight)}</td></tr>`).join('');
50
+ return { ok: true, html: `<!doctype html><style>:root{color-scheme:light}html,body{background:#fff;color:#111}</style><table>${body}</table>` };
51
+ ```
52
+
53
+ - **`code`** is the body of a function; its `return` value is the node's `result`, so a later step reads
54
+ `compare.result.rows` (templated as in every other node). A `result.html` is the report, exactly as from
55
+ `exec`. Open it with a one or two sentence `//` comment: that comment is the node's Description.
56
+ - **`code` is literal.** No `{{ … }}` anywhere in it, not even in a comment: data goes in through `args`.
57
+ - **`args`** is data only, templatable, handed over as a frozen copy.
58
+ - **`files`** maps a name to a **literal absolute path**. Templates, `inputs.*` and relative paths are
59
+ refused at validate, compile and run, so the approved lock pins exactly what is read and the person sees
60
+ it at approval. AWARE reads each file once, read-only, before the script starts: `files.<name>.text`, and
61
+ `files.<name>.json` (parsed on first use). At most 16 files and 128 MB in all by default
62
+ (`max-input-mb`, up to 512). The trace keeps a receipt per file (path, size, sha256), never its contents.
63
+ A path the person picks at Run is not supported yet: bake the path, or ask the person for it while
64
+ authoring.
65
+ - **Limits:** `timeout-seconds` (default 60, at most 600), `memory-mb` (default 1024, at most 4096).
66
+
67
+ ## What the script can and cannot do
68
+
69
+ - Globals: `args`, `files`, `run.startedAt` (ISO 8601, UTC) and `run.startedAtMs`, and `console.log`
70
+ (into the trace, capped). Nothing else: no `require`/`import`, no `fetch`, no timers, no file system.
71
+ - **No clock, no randomness, no locale.** There is no `Date` global; use `run.startedAt` for "today".
72
+ `Math.random`, `toLocaleString`, `localeCompare` and `Intl` throw or are absent: format numbers with
73
+ `toFixed` and sort with `<`/`>`. That is what makes the output a function of the code, `args`, the file
74
+ bytes and the run start, for a given AWARE CLI version (the trace records the CLI and engine versions).
75
+ - **No `eval`, no `Function`.** Data handed in can never be run as code, an AI answer included.
76
+ - **The result must be plain JSON:** objects, arrays, strings, finite numbers, booleans, `null`.
77
+ `undefined`, `NaN`, a `Date`, a `Map`, a function or a cycle is an error naming what it found. `toJSON` is
78
+ not called.
79
+ - It **writes nothing.** Write files with a `file/write` step after it, behind `safety:` as usual.
80
+
81
+ ## Failure fails the step
82
+
83
+ A throw, a timeout, the memory limit, an unreadable file or an invalid result **fails the node** with a
84
+ plain-English error, and the steps after it do not run. This differs from `tekla/exec`, which returns
85
+ `ok: false` as data: a report or a write must never run on a broken comparison.
86
+
87
+ ## With an Agent step
88
+
89
+ A `script` step that uses an Agent step's answer (through `args`) is marked as using it, like any other
90
+ step, and so is every step after it that uses its result. Its `report_folder` is never read into the
91
+ Page, and a `file/write` after it is named in the approval warning: put a `floless-agent-step/confirm` step
92
+ before the write so the person holds it (`agent-steps.md`). Never take a file path from an answer.
93
+
94
+ ## Where the step shows
95
+
96
+ The Code tab shows a `script` step's source coloured as JavaScript. Debug in VS is offered only for a
97
+ `tekla/exec` step. The Workflows card names what the workflow needs, not its runner: a workflow whose
98
+ steps are all `script` names no host. To say what it works on, add up to three short phrases:
99
+
100
+ ```yaml
101
+ floless:
102
+ needs: [Steel model, HTML report]
103
+ ```
104
+
105
+ They describe; they never hide what FloLess finds itself (a host step, a Workspace project, an AI step).