@floless/app 0.168.0 → 0.170.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 (80) hide show
  1. package/cli-actions.mjs +8 -1
  2. package/dist/floless-server.cjs +125533 -99597
  3. package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
  4. package/dist/schemas/steel.model.v2.schema.json +2 -1
  5. package/dist/skills/floless-app-knowledge/SKILL.md +43 -13
  6. package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
  7. package/dist/skills/floless-app-rfi/SKILL.md +4 -2
  8. package/dist/skills/floless-app-routines/SKILL.md +2 -2
  9. package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
  10. package/dist/skills/floless-app-steel-model/SKILL.md +8 -5
  11. package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
  12. package/dist/skills/floless-app-workflows/SKILL.md +22 -3
  13. package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
  14. package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
  15. package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
  16. package/dist/templates/college-phase-exporter.flo +7 -2
  17. package/dist/templates/trimble-list-projects.flo +10 -2
  18. package/dist/web/agent-steps.js +90 -19
  19. package/dist/web/agents.js +77 -31
  20. package/dist/web/app.css +267 -4
  21. package/dist/web/app.js +71 -7
  22. package/dist/web/aware-update-client.js +4 -4
  23. package/dist/web/aware.js +1277 -219
  24. package/dist/web/chat.css +10 -0
  25. package/dist/web/chat.js +407 -117
  26. package/dist/web/checkpoint-standard.js +5 -3
  27. package/dist/web/commands-drawing-check.js +4 -0
  28. package/dist/web/commands-shell.js +551 -15
  29. package/dist/web/commands-steel.js +68 -2
  30. package/dist/web/commands-vector.js +69 -0
  31. package/dist/web/drawing-check-editor.html +10 -0
  32. package/dist/web/drawing-check-editor.js +821 -237
  33. package/dist/web/failure-copy.js +50 -2
  34. package/dist/web/filter-ai-proposal.js +11 -8
  35. package/dist/web/flo-3d.js +310 -0
  36. package/dist/web/flo-card.js +72 -0
  37. package/dist/web/guide.js +33 -24
  38. package/dist/web/index.html +95 -5
  39. package/dist/web/instructor.js +102 -15
  40. package/dist/web/left-pane.js +4 -1
  41. package/dist/web/local-discovery.js +8 -7
  42. package/dist/web/missed-routines.js +239 -0
  43. package/dist/web/model-editor-steel-adapter.js +41 -1
  44. package/dist/web/model-measure.js +6 -0
  45. package/dist/web/model-spatial-panel.js +19 -4
  46. package/dist/web/model-spatial-tools.js +3 -3
  47. package/dist/web/model-viewport-revit-adapter.js +3 -3
  48. package/dist/web/model-viewport-toolbar.js +11 -0
  49. package/dist/web/origin-rule.js +155 -0
  50. package/dist/web/pages.js +17 -14
  51. package/dist/web/panels.js +1 -1
  52. package/dist/web/project-access.js +1 -1
  53. package/dist/web/project-history.js +2 -2
  54. package/dist/web/project-modules.js +5 -5
  55. package/dist/web/project-reconciliation.js +1 -1
  56. package/dist/web/project-rfis.js +8 -3
  57. package/dist/web/project-workflows.js +8 -6
  58. package/dist/web/renderers.js +6 -0
  59. package/dist/web/report-csp.js +68 -0
  60. package/dist/web/revit-editor.js +22 -8
  61. package/dist/web/run-history.js +14 -4
  62. package/dist/web/steel-3d-core.js +39 -9
  63. package/dist/web/steel-3d-flo.js +331 -0
  64. package/dist/web/steel-3d-view.js +164 -0
  65. package/dist/web/steel-ai-marks.js +3 -1
  66. package/dist/web/steel-editor.html +583 -129
  67. package/dist/web/steel-environments.js +297 -0
  68. package/dist/web/steel-filter.html +3 -2
  69. package/dist/web/steel-model-v2-client-validation.js +8 -1
  70. package/dist/web/steel-model-v2-commands.js +23 -9
  71. package/dist/web/steel-model-v2-projection.js +1 -1
  72. package/dist/web/step-rename.js +3 -2
  73. package/dist/web/terminal-requests.js +79 -1
  74. package/dist/web/tool-updates.js +9 -7
  75. package/dist/web/vector-3d.html +1 -1
  76. package/dist/web/vector-editor.html +50 -8
  77. package/dist/web/workspace-root-management.js +1 -1
  78. package/dist/web/workspaces.js +2334 -253
  79. package/launch.mjs +5 -0
  80. package/package.json +11 -8
@@ -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).
@@ -1,8 +1,13 @@
1
1
  app: college-phase-exporter
2
- version: 0.3.0
2
+ version: 0.3.1
3
3
  publisher: floless
4
4
  update-mode: source-only
5
5
  changelog:
6
+ - version: 0.3.1
7
+ summary: Works with the current Trimble Connect tool.
8
+ changes:
9
+ - Asks for Trimble Connect 0.5, the version a current install has. The upload step works as before.
10
+ - It needs AWARE 0.159.0 or newer. If the footer offers an AWARE update, install it before updating this workflow.
6
11
  - version: 0.3.0
7
12
  summary: Works with the current Microsoft 365 tool by leaving out the three Microsoft 365 steps it does not offer yet.
8
13
  changes:
@@ -25,7 +30,7 @@ description: |
25
30
  exposes-as-agent: false
26
31
  requires:
27
32
  - tekla@0.1.x
28
- - trimble-connect@0.2.x
33
+ - trimble-connect@0.5.x
29
34
  - html-report@0.2.x
30
35
  - file@1.0.x
31
36
  requires-permissions:
@@ -1,5 +1,11 @@
1
1
  app: trimble-list-projects
2
- version: 0.1.0
2
+ version: 0.1.1
3
+ changelog:
4
+ - version: 0.1.1
5
+ summary: Works with the current Trimble Connect tool.
6
+ changes:
7
+ - Asks for Trimble Connect 0.5, the version a current install has. The project list works as before.
8
+ - It needs AWARE 0.159.0 or newer. If the footer offers an AWARE update, install it before updating this workflow.
3
9
  display-name: Trimble — list my projects
4
10
  description: |
5
11
  Lists the Trimble Connect projects you can access (read-only) and renders them
@@ -9,7 +15,7 @@ description: |
9
15
  in-app Viewer shows. Foundation demo for Trimble workflow support.
10
16
  exposes-as-agent: false
11
17
  requires:
12
- - trimble-connect@0.2.x
18
+ - trimble-connect@0.5.x
13
19
  - html-report@0.2.x
14
20
  requires-permissions:
15
21
  network:
@@ -25,11 +31,13 @@ nodes:
25
31
  - id: projects
26
32
  agent: trimble-connect
27
33
  command: list-projects
34
+ description: Asks Trimble Connect for the projects you can access, up to 100 of them.
28
35
  config:
29
36
  top: 100
30
37
  - id: report
31
38
  agent: html-report
32
39
  command: render
40
+ description: Turns the project list into a table in an HTML report, most recently changed first.
33
41
  config:
34
42
  data: '{{ projects.body }}'
35
43
  title: My Trimble Connect projects
@@ -27,6 +27,7 @@
27
27
  generation: new Map(), // appId -> the newest check ask, so an older answer cannot overwrite a newer one
28
28
  notes: new Map(), // #2448: appId -> { enabled, global, shown, off }, the AI note in that workflow's reports
29
29
  noteSync: new Map(), // #2461: appId -> how its AI-note reads and saves are kept in order (see noteSyncOf)
30
+ carried: new Map(), // #3284: appId -> the write warning of a version resting on a tick given on another version, or null
30
31
  triggers: new Map(), // S8 (#2495): appId -> the watcher's waits ({ steps, version, ... }), or null when it waits for no trigger
31
32
  fires: new Map(), // S8: appId -> the watcher's latest events that reached an AI step (newest first)
32
33
  firesState: new Map(), // S8: appId -> null, 'unreadable' (the log could not be read) or 'stale' (the last refresh failed)
@@ -291,6 +292,8 @@
291
292
  const sentence = plainDescription(node);
292
293
  html += `<p>${esc(sentence || `This step asks the Agent “${facts.name}” a question and uses its answer.`)}</p>`;
293
294
  html += `<p class="as-standing">${esc(standingSentence(app, node))}</p>`;
295
+ const carried = model.carried.get(app.id);
296
+ if (carried) html += `<p class="as-carried" data-as-carried>This step is unchanged since the confirmation that its answer may differ each run, so it is not asked again. ${esc(carried)}</p>`;
294
297
  if (app.runState && app.runState !== 'ready') {
295
298
  html += '<p class="dim-note">These settings are read from the workflow file. It has not been approved in this form yet, so the approved version may differ.</p>';
296
299
  }
@@ -355,6 +358,27 @@
355
358
  };
356
359
  }
357
360
 
361
+ /**
362
+ * #3284: the heads-up a publish made from chat would otherwise hide. The line says a confirmation still holds, so a status
363
+ * that cannot be read removes it rather than leaving the last answer standing, and an answer a newer check replaced is dropped.
364
+ */
365
+ async function refreshCarried(appId, current = () => true) {
366
+ let status = null;
367
+ try {
368
+ // Like every read of the open workflow, it waits until FloLess has finished starting.
369
+ await globalThis.flolessStartupAdmission?.admit(`${CONSENT_API}/status?app=${encodeURIComponent(appId)}`);
370
+ if (current()) status = await consentStatus(appId);
371
+ } catch { status = null; }
372
+ if (!current()) return;
373
+ const carried = status?.carriedWarning || null;
374
+ if ((model.carried.get(appId) || null) === carried) return;
375
+ model.carried.set(appId, carried);
376
+ if (model.context.currentApp()?.id !== appId) return;
377
+ // A wait editor the person has open is never closed under them: the repaint waits until it closes, as refreshTrigger does.
378
+ if (document.querySelector('[data-as-wait-edit]:not([hidden])')) { model.repaintAfterEdit = appId; return; }
379
+ model.context.repaint(appId);
380
+ }
381
+
358
382
  /** S8: read a watcher's waits and its latest events, for Inspect. Never claims anything when a read fails. */
359
383
  async function refreshTrigger(appId, opts = {}) {
360
384
  try {
@@ -403,7 +427,7 @@
403
427
  return;
404
428
  }
405
429
  if (!body || body.code !== 'needs-confirmation') {
406
- model.context.toast(body && body.error ? body.error : 'FloLess couldn’t save the wait. Try again.', 'warn');
430
+ model.context.toast(personText(body) || failureCopy({ status: response.status, body }, { action: 'save the wait' }).text, 'warn');
407
431
  return;
408
432
  }
409
433
  } catch { model.context.toast('FloLess couldn’t save the wait. Check that FloLess is running and try again.', 'warn'); return; }
@@ -434,9 +458,10 @@
434
458
  // The status probe is awaited HERE, in the detached check, never in loadApp: opening a workflow must not wait on it.
435
459
  const on = await probe();
436
460
  if (!current()) return;
437
- if (!on || !Array.isArray(app.nodes) || !app.nodes.some(isStepNode)) { model.checks.delete(app.id); return; }
461
+ if (!on || !Array.isArray(app.nodes) || !app.nodes.some(isStepNode)) { model.checks.delete(app.id); model.carried.delete(app.id); return; }
438
462
  void refreshNote(app.id);
439
463
  void refreshTrigger(app.id);
464
+ void refreshCarried(app.id, current);
440
465
  let steps = null;
441
466
  try {
442
467
  const path = `/api/agent-steps/check?app=${encodeURIComponent(app.id)}`;
@@ -477,11 +502,15 @@
477
502
  for (const [key, value] of Object.entries(extra)) if (value) query.set(key, value);
478
503
  let response;
479
504
  try { response = await fetch(`/api/agent-steps/block?${query}`, { credentials: 'same-origin' }); }
480
- catch { throw new Error('FloLess could not be reached to load the Agent’s step. Make sure it is still running, then try again.'); }
505
+ catch { throw Object.assign(new Error('FloLess could not be reached to load the Agent’s step. Make sure it is still running, then try again.'), { forPerson: true }); }
481
506
  let body = null;
482
507
  try { body = await response.json(); } catch { body = null; }
483
508
  if (!response.ok || !body || body.ok !== true) {
484
- throw Object.assign(new Error(typeof body?.error === 'string' && body.error ? body.error : 'FloLess could not load the Agent’s step just now. Try again.'), { code: typeof body?.code === 'string' ? body.code : '' });
509
+ // #3097 3b: the reply rides on the error, so errorText says the server's sentence, or the access, busy or
510
+ // connection sentence for it; an answer that was not FloLess's JSON is marked unreadable.
511
+ const reply = body && typeof body === 'object' ? body : { code: 'response-unreadable' };
512
+ throw Object.assign(new Error(personText(reply) || 'the Agent step block was refused'),
513
+ { code: typeof reply.code === 'string' ? reply.code : '', status: response.status, body: reply });
485
514
  }
486
515
  return body;
487
516
  }
@@ -520,7 +549,7 @@
520
549
  }
521
550
 
522
551
  async function openDraft(text) {
523
- if (typeof window.flolessChat?.openDraft !== 'function') throw new Error('AI Chat is still starting. Try again in a moment.');
552
+ if (typeof window.flolessChat?.openDraft !== 'function') throw Object.assign(new Error('AI Chat is still starting. Try again in a moment.'), { forPerson: true });
524
553
  await window.flolessChat.openDraft(text);
525
554
  }
526
555
 
@@ -536,7 +565,7 @@
536
565
  model.context.toast('Drafted in AI Chat. Review it and send it there.', 'ok');
537
566
  return true;
538
567
  } catch (error) {
539
- const message = error instanceof Error && error.message ? error.message : 'FloLess could not draft that. Try again.';
568
+ const message = errorText(error, { action: 'draft that', retrySafe: true });
540
569
  // Nothing valid to pin (no instructions, nothing to read, instructions beyond what a step can carry): the person is not left at a
541
570
  // dead end. The reason goes to AI Chat as a drafted question, to be sent or not, and the Agent is never changed from here.
542
571
  if (error && ['cannot-pin', 'agent-no-instructions', 'agent-no-scope'].includes(error.code)) {
@@ -585,7 +614,7 @@ ${WARN_LINE}`);
585
614
  model.context.toast('Drafted in AI Chat. Review it and send it there.', 'ok');
586
615
  return true;
587
616
  } catch (error) {
588
- model.context.toast(error instanceof Error && error.message ? error.message : 'FloLess could not draft that. Try again.', 'warn');
617
+ model.context.toast(errorText(error, { action: 'draft that', retrySafe: true }), 'warn');
589
618
  return false;
590
619
  }
591
620
  }
@@ -625,11 +654,11 @@ ${WARN_LINE}`);
625
654
  async function loadAgents() {
626
655
  await globalThis.flolessStartupAdmission?.admit('/api/chat/session');
627
656
  const session = await fetch('/api/chat/session', { credentials: 'same-origin' });
628
- if (!session.ok) throw new Error('FloLess could not open AI Chat’s session, so the Agents could not load. Reload FloLess and try again.');
657
+ if (!session.ok) throw Object.assign(new Error('FloLess could not open AI Chat’s session, so the Agents could not load. Reload FloLess and try again.'), { forPerson: true });
629
658
  await globalThis.flolessStartupAdmission?.admit('/api/chat/agents');
630
659
  const response = await fetch('/api/chat/agents', { credentials: 'same-origin' });
631
660
  const body = await response.json().catch(() => null);
632
- if (!response.ok || !body || !Array.isArray(body.agents)) throw new Error('FloLess could not load your Agents just now. Try again.');
661
+ if (!response.ok || !body || !Array.isArray(body.agents)) throw Object.assign(new Error('FloLess could not load your Agents just now. Try again.'), { forPerson: true });
633
662
  return body.agents.filter((agent) => !agent.archivedAt && agent.instructions && agent.scope && agent.scope.length);
634
663
  }
635
664
 
@@ -658,7 +687,7 @@ ${WARN_LINE}`);
658
687
  try { agents = await loadAgents(); }
659
688
  catch (error) {
660
689
  if (chooser?.root !== root) return;
661
- list.innerHTML = `<div class="wf-empty-search" role="alert">${esc(error.message)}</div>`;
690
+ list.innerHTML = `<div class="wf-empty-search" role="alert">${esc(errorText(error, { action: 'load your Agents', retrySafe: true }))}</div>`;
662
691
  return;
663
692
  }
664
693
  if (chooser?.root !== root) return;
@@ -711,6 +740,8 @@ ${WARN_LINE}`);
711
740
 
712
741
  const CONSENT_API = '/api/chat/agent-steps/consent';
713
742
  const CONSENT_FIRST_SUB = 'The AI writes its answer each time the workflow runs, so that answer can differ from run to run. Everything else in the workflow stays exactly as approved.';
743
+ /** #3229: the fields the tick covers (agent-step-contract.ts ConsentStep). Which steps use the answer is the workflow, approved as a whole. */
744
+ const CONSENT_COVERS = 'Your tick covers the AI step itself: its Agent and instructions, what it can read, its answer format and time limit, and what the workflow gives it. Which steps use its answer is part of the workflow you approve, not of this tick.';
714
745
 
715
746
  function whenWords(iso) {
716
747
  const date = new Date(iso);
@@ -800,6 +831,8 @@ ${WARN_LINE}`);
800
831
  body = steps.map((step) => stepCardHtml(step, '')).join('');
801
832
  }
802
833
  if (model.unreadableSteps) body += `<p class="ac-unchanged">${esc(model.unreadableSteps)} AI step${model.unreadableSteps === 1 ? '' : 's'} could not be read, so ${model.unreadableSteps === 1 ? 'it' : 'they'} will not run until fixed.</p>`;
834
+ // #3229: what the tick is about (the server's ConsentStep), so a person who sees it again knows the step itself is what it asks about.
835
+ body += `<p class="ac-unchanged ac-covers">${esc(CONSENT_COVERS)}</p>`;
803
836
  const nameOf = (name) => (/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(String(name)) ? 'You' : name);
804
837
  const who = model.latest ? `${nameOf(model.latest.confirmedBy)}${whenWords(model.latest.confirmedAt) ? ` on ${whenWords(model.latest.confirmedAt)}` : ''}` : '';
805
838
  // S8: a workflow that waits for a trigger adds each step's wait and the second tick.
@@ -1116,8 +1149,11 @@ ${WARN_LINE}`);
1116
1149
  knowledge: runKbView(step.knowledge),
1117
1150
  };
1118
1151
  });
1119
- const summary = `Last run · ${plural(steps.length, 'AI step', 'AI steps')}${needs.length ? ` · ${plural(needs.length, 'question for you', 'questions for you')}` : ''}`;
1120
- return { summary, steps, needsCount: needs.length, groups: needsYouGroups(needs), open: needs.length > 0, uses: usesView(rec) };
1152
+ // #3229: a run its AI step's check stopped ended "ok"; the panel says it stopped, and where.
1153
+ const stopped = stoppedRunView(rec);
1154
+ const summary = `Last run · ${plural(steps.length, 'AI step', 'AI steps')}${needs.length ? ` · ${plural(needs.length, 'question for you', 'questions for you')}` : ''}${stopped ? ` · ${stopped.summary}` : ''}`;
1155
+ return { summary, steps, needsCount: needs.length, groups: needsYouGroups(needs), open: needs.length > 0 || !!stopped, uses: usesView(rec),
1156
+ stoppedLine: stopped ? stopped.line : '', stoppedStep: stopped ? stopped.stepId : '' };
1121
1157
  }
1122
1158
 
1123
1159
  const KB_NONE_WORDS = {
@@ -1127,6 +1163,7 @@ ${WARN_LINE}`);
1127
1163
  'no-search-words': () => 'The search had no words to look up.',
1128
1164
  incomplete: () => 'FloLess couldn’t look through all of the Knowledge, and found no page it could use.',
1129
1165
  'project-replaced': () => 'The project was replaced by another project with the same name, so no pages were given.',
1166
+ erased: () => 'The Knowledge was erased by the person before the Agent read it, so no pages were given.',
1130
1167
  unreadable: () => 'FloLess couldn’t read the Knowledge.',
1131
1168
  };
1132
1169
  const SHORTENED_TIP = 'Only part of this page was given: the part that matched the search, cut to fit.';
@@ -1211,7 +1248,7 @@ ${WARN_LINE}`);
1211
1248
  // Open when the run left something for the person; otherwise whatever the person last chose for this workflow.
1212
1249
  const open = view.open || (box.dataset.for === app.id && box.open);
1213
1250
  box.dataset.for = app.id;
1214
- document.getElementById('as-run-sum').innerHTML = `${aiPillHtml()}<span class="as-run-sum-text">${esc(view.summary)}</span>`;
1251
+ document.getElementById('as-run-sum').innerHTML = `${aiPillHtml()}<span class="as-run-sum-text"${view.stoppedStep.length > 40 ? ` data-tip="${esc(`Stopped at “${view.stoppedStep}”`)}"` : ''}>${esc(view.summary)}</span>`;
1215
1252
  const stepHtml = view.steps.map((step) => `<div class="as-run-step"><div class="as-run-line"><b>${esc(step.nodeId)}</b>${aiPillHtml()}<span class="as-run-out ${step.answered ? 'ok' : 'warn'}">${step.answered ? '✓' : '△'} ${esc(step.outcome)}</span></div>`
1216
1253
  + `${step.who ? `<div class="as-run-who">${esc(step.who)}</div>` : ''}`
1217
1254
  + runKbHtml(step.nodeId, step.knowledge)
@@ -1221,7 +1258,8 @@ ${WARN_LINE}`);
1221
1258
  ? `<div class="as-needs" role="group" aria-label="Questions for you"><div class="as-needs-title">Questions for you (${view.needsCount})</div>${view.groups.map((group) => `<div class="as-needs-group"><div class="as-needs-kind">${esc(group.title)}</div><ul>${group.items.map((item) => `<li><b>${esc(item.nodeId)}</b>: ${esc(item.text)}</li>`).join('')}</ul></div>`).join('')}</div>`
1222
1259
  : '';
1223
1260
  const note = noteOffLine(model.notes.get(app.id));
1224
- document.getElementById('as-run-body').innerHTML = stepHtml + usesHtml(view.uses) + (note ? `<p class="as-use-note">${esc(note)}</p>` : '') + needsHtml;
1261
+ const stoppedHtml = view.stoppedLine ? `<p class="as-run-stopped" role="note">${esc(view.stoppedLine)}</p>` : '';
1262
+ document.getElementById('as-run-body').innerHTML = stoppedHtml + stepHtml + usesHtml(view.uses) + (note ? `<p class="as-use-note">${esc(note)}</p>` : '') + needsHtml;
1225
1263
  box.hidden = false;
1226
1264
  box.open = open;
1227
1265
  }
@@ -1249,6 +1287,7 @@ ${WARN_LINE}`);
1249
1287
  runId: body.runId, aiSteps: body.aiSteps, needsYou: Array.isArray(body.needsYou) ? body.needsYou : [],
1250
1288
  ...(Array.isArray(body.dependents) ? { dependents: body.dependents } : {}),
1251
1289
  ...(typeof body.dependentsUnknown === 'string' ? { dependentsUnknown: body.dependentsUnknown } : {}),
1290
+ ...(isRecord(body.stoppedAt) ? { stoppedAt: body.stoppedAt } : {}),
1252
1291
  });
1253
1292
  }
1254
1293
  else runs.delete(appId);
@@ -1303,6 +1342,33 @@ ${WARN_LINE}`);
1303
1342
  };
1304
1343
  }
1305
1344
 
1345
+ /** A step name for a sentence: at most 40 characters, so a long id never pushes the rest of the words out. */
1346
+ const shortName = (id) => (id.length > 40 ? `${id.slice(0, 39)}…` : id);
1347
+
1348
+ /**
1349
+ * #3229: what to say when the run stopped at an AI step's `-ok` check (`res.stoppedAt`, read by the server from the check's own
1350
+ * output). The run ended "ok", so without this it reads as complete. Pure: the run's answer in, plain words out; null when it did
1351
+ * not stop there. `button` opens the step's questions when the record left some for it, otherwise Last run itself.
1352
+ */
1353
+ function stoppedRunView(res) {
1354
+ const at = isRecord(res) && isRecord(res.stoppedAt) ? res.stoppedAt : null;
1355
+ if (!at || typeof at.stepId !== 'string' || !at.stepId) return null;
1356
+ const step = `“${shortName(at.stepId)}”`;
1357
+ const needs = Array.isArray(res.needsYou) ? res.needsYou.filter(isRecord) : [];
1358
+ const asks = needs.some((item) => item.nodeId === at.stepId && item.kind === 'question');
1359
+ const listed = needs.some((item) => item.nodeId === at.stepId);
1360
+ const what = asks ? 'It has questions for you' : 'It gave no answer the workflow could use';
1361
+ return {
1362
+ stepId: at.stepId, asks, listed, runId: typeof res.runId === 'string' ? res.runId : null,
1363
+ toast: `Stopped at the AI step ${step}. ${what}, so the steps after it did not run. ${asks ? 'Open Last run to read them.' : 'Open Last run to see why.'}`,
1364
+ banner: `This report was made before the run stopped at the AI step ${step}, which ${asks ? 'has questions for you' : 'gave no answer the workflow could use'}. The steps after it did not run, so the report may be incomplete.`,
1365
+ summary: `stopped at ${step}`,
1366
+ line: `The run stopped at ${step} because ${asks ? 'it has questions for you' : 'it gave no answer the workflow could use'}. The steps after it did not run.`,
1367
+ button: listed ? 'Open Questions for you' : 'Open Last run',
1368
+ commandId: listed ? 'shell.report-ai-stop-questions' : 'shell.report-ai-stop-last-run',
1369
+ };
1370
+ }
1371
+
1306
1372
  /**
1307
1373
  * #2415: open the canvas's Last run panel on its Questions for you and move focus there. The record is read again unless the panel
1308
1374
  * already holds this very run (`runId`), so it never shows an earlier run's questions. False when it cannot show this run, so the
@@ -1680,9 +1746,13 @@ ${WARN_LINE}`);
1680
1746
  function routineAiParts(lastRun) {
1681
1747
  if (!isRecord(lastRun) || lastRun.aiAnswer !== true) return null;
1682
1748
  const q = Number.isSafeInteger(lastRun.questionsForYou) && lastRun.questionsForYou > 0 ? lastRun.questionsForYou : 0;
1749
+ // #3229: the run stopped at its AI step's check; one chip says so (an "AI answer" chip beside it would read as an answer it used).
1750
+ const stoppedAt = typeof lastRun.stoppedAtAiStep === 'string' && lastRun.stoppedAtAiStep ? lastRun.stoppedAtAiStep : '';
1683
1751
  return {
1684
- ai: 'AI answer',
1685
- aiTip: 'This run used an AI step. Its answer can differ each run.',
1752
+ ai: stoppedAt ? 'Stopped at AI step' : 'AI answer',
1753
+ aiTip: stoppedAt ? `The run stopped at the AI step “${shortName(stoppedAt)}”, so the steps after it did not run. Open the workflow to see why.`
1754
+ : 'This run used an AI step. Its answer can differ each run.',
1755
+ stoppedAt,
1686
1756
  questions: q ? plural(q, 'question for you', 'questions for you') : '',
1687
1757
  questionsTip: q ? 'The AI step left questions, assumptions or changes that were not made. Open the workflow to read them.' : '',
1688
1758
  };
@@ -1737,13 +1807,14 @@ ${WARN_LINE}`);
1737
1807
  probe, enabled, isStepNode, entryParts, refreshChecks, checkFor, stepCount, headerText, markTip, draftAdd, draftUpdate, paintCanvasControl,
1738
1808
  BADGE_TIP, answerWords, bannerModel, stepFacts, consentView, consentStatus, consentDialog, confirmBeforeApprove, confirmBeforeRun, takeRenameAsk,
1739
1809
  aiPillHtml, runRecordView, refreshRunRecord, kbInspectHtml, runKbView, paintRunRecord, gateView, checkGates, noteTrace, routineAiParts,
1740
- useParts, standingSentence, usePillHtml, usesView, openStepConversation, stoppedReportView, openQuestions,
1810
+ useParts, standingSentence, usePillHtml, usesView, openStepConversation, stoppedReportView, stoppedRunView, openQuestions,
1741
1811
  noteView, noteHtml, noteOffLine, refreshNote, setNote, initGlobalNote,
1742
1812
  triggerSentenceFor, triggerInspectHtml, watcherCardParts, refreshTrigger, saveWait, watcherChanged,
1743
1813
  configure(context) { Object.assign(model.context, context); },
1744
1814
  forgetChecks(appId) {
1745
- const ids = appId === undefined ? [...model.checks.keys(), ...model.generation.keys()] : [appId];
1746
- for (const id of ids) { model.checks.delete(id); model.generation.set(id, (model.generation.get(id) || 0) + 1); }
1815
+ const ids = appId === undefined ? [...model.checks.keys(), ...model.generation.keys(), ...model.carried.keys()] : [appId];
1816
+ // #3284: the carried line claims a confirmation still holds, so it is as stale as a check until the new status lands.
1817
+ for (const id of ids) { model.checks.delete(id); model.carried.delete(id); model.generation.set(id, (model.generation.get(id) || 0) + 1); }
1747
1818
  },
1748
1819
  _model: model,
1749
1820
  };