@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
@@ -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 {
@@ -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(personText(body) || '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
  };
@@ -102,10 +102,10 @@
102
102
  }
103
103
  catch {
104
104
  const failure = new Error('FloLess could not be reached. Make sure it is still running, then try again.');
105
- failure.code = 'local-unreachable';
105
+ failure.code = 'local-unreachable'; failure.forPerson = true;
106
106
  throw failure;
107
107
  }
108
- if (!response.ok) throw new Error('FloLess could not open AI Chat’s session, so agents could not load. Reload FloLess and try again.');
108
+ if (!response.ok) throw Object.assign(new Error('FloLess could not open AI Chat’s session, so agents could not load. Reload FloLess and try again.'), { forPerson: true });
109
109
  state.sessionReady = true;
110
110
  }
111
111
 
@@ -121,7 +121,7 @@
121
121
  const failure = new Error(error?.name === 'TimeoutError'
122
122
  ? 'FloLess took too long to answer, most likely because it is busy. Try again in a moment.'
123
123
  : 'FloLess could not be reached. Make sure it is still running, then try again.');
124
- failure.code = 'local-unreachable';
124
+ failure.code = 'local-unreachable'; failure.forPerson = true;
125
125
  throw failure;
126
126
  }
127
127
  let body = null;
@@ -136,8 +136,11 @@
136
136
  if (!body?.error) console.warn(`[agents] ${path} answered ${response.status} with no explanation`);
137
137
  // #2868: with no sentence from the server, the shared failure copy names the kind of failure (busy, signed out, an
138
138
  // answer that was not FloLess's) instead of "try again, restart FloLess", which fixes none of them.
139
- const failure = new Error(personText(body) || failureCopy({ status: response.status, body: body || { code: 'response-unreadable' } }).text);
140
- failure.code = body?.code || null; failure.body = body; failure.status = response.status;
139
+ // #3097 3b: the reply rides on the error, so errorText works the sentence out again from it; an answer that was
140
+ // not FloLess's JSON is marked unreadable rather than shown.
141
+ const reply = body && typeof body === 'object' ? body : { code: 'response-unreadable' };
142
+ const failure = new Error(personText(reply) || failureCopy({ status: response.status, body: reply }).text);
143
+ failure.code = body?.code || null; failure.body = reply; failure.status = response.status;
141
144
  throw failure;
142
145
  }
143
146
  return body;
@@ -209,7 +212,7 @@
209
212
  const opened = await window.flolessChat?.openConversationIn?.(state.chatScope, target.chatId);
210
213
  if (opened === false) toast('This run’s conversation could not be opened. Use Open in project to find it.', 'warn');
211
214
  } catch (error) {
212
- toast(error?.message || 'This run’s conversation could not be opened.', 'warn');
215
+ toast(errorText(error, { action: 'open this run’s conversation', retrySafe: true }), 'warn');
213
216
  }
214
217
  // #2764: told afterwards, once AI Chat shows this run's conversation, so whatever is bound to the conversation before
215
218
  // it (a compile refusal's Ask AI to fix) lets go. AI Chat itself already has this scope, so it does not reload.
@@ -339,7 +342,7 @@
339
342
  state.agent = body.agent; state.draft = draftOf(body.agent); state.dirty = false; state.view = 'page';
340
343
  } catch (error) {
341
344
  if (generation !== state.pageGeneration) return; // a newer page was opened meanwhile: this answer is stale either way
342
- toast(error.message, 'warn'); state.view = 'list'; await loadAgents(); return;
345
+ toast(errorText(error, { action: 'open this agent', retrySafe: true }), 'warn'); state.view = 'list'; await loadAgents(); return;
343
346
  }
344
347
  paint();
345
348
  $surface.querySelector('#ag-name')?.focus();
@@ -394,13 +397,14 @@
394
397
  if (created) void loadRuns();
395
398
  return { ok: true, here: true, agent: body.agent };
396
399
  } catch (error) {
397
- if (!here()) toast(`Couldn’t save “${draft.name.trim()}”. ${error.message}`, 'err');
400
+ const said = errorText(error, { action: 'save this agent', unsure: 'Check the agent before saving it again.' });
401
+ if (!here()) toast(`Couldn’t save “${draft.name.trim()}”. ${said}`, 'err');
398
402
  else if (error.code === 'agent-revision-stale' && error.body?.agent) {
399
403
  const current = error.body.agent;
400
- state.banner = { text: error.message, action: { label: 'Load the current version', commandId: 'shell.agents-reload', run: () => {
404
+ state.banner = { text: said, action: { label: 'Load the current version', commandId: 'shell.agents-reload', run: () => {
401
405
  state.agent = current; state.draft = draftOf(current); state.dirty = false; state.banner = null; paint();
402
406
  } } };
403
- } else state.banner = { text: error.message };
407
+ } else state.banner = { text: said };
404
408
  return { ok: false };
405
409
  } finally { state.saving = false; paint(); }
406
410
  }
@@ -447,8 +451,9 @@
447
451
  toast(archived ? 'Agent archived.' : 'Agent restored.', 'ok');
448
452
  } else toast(archived ? `Agent “${name}” archived.` : `Agent “${name}” restored.`, 'ok');
449
453
  } catch (error) {
450
- if (stillHere()) state.banner = { text: error.message };
451
- else toast(`Couldn’t ${archived ? 'archive' : 'restore'} “${name}”. ${error.message}`, 'err');
454
+ const said = errorText(error, { action: archived ? 'archive this agent' : 'restore this agent' });
455
+ if (stillHere()) state.banner = { text: said };
456
+ else toast(`Couldn’t ${archived ? 'archive' : 'restore'} “${name}”. ${said}`, 'err');
452
457
  }
453
458
  paint();
454
459
  if (!stillHere()) void loadAgents();
@@ -468,7 +473,10 @@
468
473
  const body = await api(`/api/chat/agents/${encodeURIComponent(agentId)}/pause`, { method: 'POST', body: { paused } });
469
474
  if (stillHere()) { state.agent = { ...state.agent, pausedAt: body.agent.pausedAt }; state.banner = null; }
470
475
  toast(paused ? 'Agent paused. Its routines won’t start it until you resume it.' : 'Agent resumed. Its routines run on their schedule again.', 'ok');
471
- } catch (error) { if (stillHere()) state.banner = { text: error.message }; else toast(error.message, 'err'); }
476
+ } catch (error) {
477
+ const said = errorText(error, { action: paused ? 'pause this agent' : 'resume this agent' });
478
+ if (stillHere()) state.banner = { text: said }; else toast(said, 'err');
479
+ }
472
480
  state.pausing = false;
473
481
  paint();
474
482
  void loadAgents();
@@ -616,11 +624,12 @@
616
624
  await loadRuns();
617
625
  $surface.querySelector('#ag-runs-title')?.focus();
618
626
  } catch (failure) {
619
- if (failure.code === 'agent-run-preview-changed' && failure.body?.preview) { preview = failure.body.preview; error = failure.message; }
627
+ const said = errorText(failure, { action: 'start this run', unsure: 'Check the runs below before starting it again.' });
628
+ if (failure.code === 'agent-run-preview-changed' && failure.body?.preview) { preview = failure.body.preview; error = said; }
620
629
  // #2061: a run of this agent started meanwhile — ask, with the sheet's own "Start another run".
621
630
  // The server's own sentence is kept: it says whether the run is going or FloLess can't tell.
622
- else if (failure.code === 'agent-run-overlap') { preview = { ...preview, alreadyRunning: { ...(preview.alreadyRunning || { startedAt: null }), message: failure.message } }; error = null; }
623
- else error = failure.message;
631
+ else if (failure.code === 'agent-run-overlap') { preview = { ...preview, alreadyRunning: { ...(preview.alreadyRunning || { startedAt: null }), message: said } }; error = null; }
632
+ else error = said;
624
633
  busy = false; render();
625
634
  }
626
635
  };
@@ -746,21 +755,21 @@
746
755
  try {
747
756
  await api(`/api/chat/agents/${encodeURIComponent(state.agent.agentId)}/runs/${encodeURIComponent(run.runId)}/targets/${target.index}/retry`,
748
757
  { method: 'POST', body: { confirmed: Boolean(target.retryNeedsConfirm) } });
749
- } catch (error) { toast(error.message, 'warn'); }
758
+ } catch (error) { toast(errorText(error, { action: 'start it again', unsure: 'Check its row below before starting it again.' }), 'warn'); }
750
759
  await loadRuns();
751
760
  }
752
761
 
753
762
  async function cancelTarget(run, target) {
754
763
  try {
755
764
  await api(`/api/chat/agents/${encodeURIComponent(state.agent.agentId)}/runs/${encodeURIComponent(run.runId)}/targets/${target.index}/cancel`, { method: 'POST', body: {} });
756
- } catch (error) { toast(error.message, 'warn'); }
765
+ } catch (error) { toast(errorText(error, { action: 'cancel it', unsure: 'Check its row below before cancelling it again.' }), 'warn'); }
757
766
  await loadRuns();
758
767
  }
759
768
 
760
769
  /** #2106: a project's Knowledge step. A missing Workspaces bridge is said, never a silent no-op. */
761
770
  async function openKnowledgeStepOf(projectId) {
762
771
  const open = window.flolessWorkspaces?.openKnowledgeStep;
763
- if (typeof open !== 'function') throw new Error('FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.');
772
+ if (typeof open !== 'function') throw Object.assign(new Error('FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.'), { forPerson: true });
764
773
  await open(projectId);
765
774
  }
766
775
 
@@ -770,7 +779,7 @@
770
779
  if (holder?.kind === 'knowledge') {
771
780
  if (!(await confirmLeave())) return;
772
781
  try { await openKnowledgeStepOf(holder.projectId); }
773
- catch (error) { toast(error?.message || 'FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.', 'warn'); }
782
+ catch (error) { toast(errorText(error, { action: 'open that project’s Knowledge step', retrySafe: true }), 'warn'); }
774
783
  return;
775
784
  }
776
785
  if (holder?.kind === 'chat' && holder.owner && holder.chatId) { await openInProject({ owner: holder.owner, chatId: holder.chatId, label: holder.title }); return; }
@@ -788,7 +797,8 @@
788
797
  }
789
798
  toast(`Stopped ${holder?.kind === 'chat' ? `“${holder.title}”` : holder?.title || 'that work'}.`, 'ok');
790
799
  } catch (error) {
791
- toast(error?.code === 'stop-stale' ? 'That work had already finished, so nothing was stopped.' : error?.message || 'FloLess couldn’t stop that work.', 'warn');
800
+ toast(error?.code === 'stop-stale' ? 'That work had already finished, so nothing was stopped.'
801
+ : errorText(error, { action: 'stop that work', unsure: 'Check whether it is still running before stopping it again.' }), 'warn');
792
802
  }
793
803
  }
794
804
 
@@ -798,7 +808,7 @@
798
808
  try {
799
809
  await window.flolessWorkspaces.openChatOwner(target.owner);
800
810
  await window.flolessChat?.openConversationIn?.({ owner: target.owner, label: target.label }, target.chatId);
801
- } catch (error) { toast(error?.message || 'That project could not be opened. Open it from Workspaces.', 'warn'); }
811
+ } catch (error) { toast(errorText(error, { action: 'open that project', retrySafe: true }), 'warn'); }
802
812
  }
803
813
 
804
814
  // ── a small themed dialog (no native confirm: it would leak the OS theme) ──────────────────────────────────────
@@ -7,7 +7,7 @@
7
7
  * handling for a desktop app — a dedicated later pass (spec §5.2). Until then,
8
8
  * trackEvent() is defined and callable everywhere, and simply does nothing.
9
9
  *
10
- * Loaded as a classic <script> (like app.js/aware.js/panels.js/workspaces.js) and
10
+ * Loaded as a classic <script> (like app.js/aware.js/workspaces.js) and
11
11
  * exposed on window — NOT an ESM export — to match the codebase's module pattern.
12
12
  * Callers: workspaces.js emits the Slice-6 Workspaces events through window.trackEvent.
13
13
  *