@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
@@ -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(body?.error || 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();
@@ -359,37 +362,59 @@
359
362
  if (saveBtn) saveBtn.disabled = false;
360
363
  }
361
364
 
365
+ /** True only when the draft was saved and the person is still on its page, so a caller may go on with it. */
362
366
  async function save() {
363
- if (state.saving) return false;
367
+ const saved = await saveDraft();
368
+ return saved.ok && saved.here;
369
+ }
370
+
371
+ /**
372
+ * #3148: the answer belongs to the page that sent it: if the person opened another page meanwhile, it is said in a
373
+ * toast by the agent's name and never painted onto that page. `agent` is what the server saved, either way.
374
+ */
375
+ async function saveDraft() {
376
+ if (state.saving) return { ok: false };
364
377
  const draft = state.draft;
365
378
  if (!draft.name.trim()) {
366
379
  state.banner = { text: 'Give the agent a name before you save it.' };
367
380
  paint(); $surface.querySelector('#ag-name')?.focus();
368
- return false;
381
+ return { ok: false };
369
382
  }
383
+ const generation = state.pageGeneration;
384
+ const here = () => state.view === 'page' && state.pageGeneration === generation;
385
+ const created = !state.agent;
370
386
  state.saving = true; paint();
371
387
  try {
372
388
  const body = state.agent
373
389
  ? await api(`/api/chat/agents/${encodeURIComponent(state.agent.agentId)}`, { method: 'PUT', body: { agent: draft, revision: state.agent.revision } })
374
390
  : await api('/api/chat/agents', { method: 'POST', body: draft });
375
- const created = !state.agent;
391
+ if (!here()) {
392
+ toast(created ? `Agent “${body.agent.name}” created.` : `Agent “${body.agent.name}” saved.`, 'ok');
393
+ return { ok: true, here: false, agent: body.agent };
394
+ }
376
395
  state.agent = body.agent; state.draft = draftOf(body.agent); state.dirty = false; state.banner = null;
377
396
  toast(created ? `Agent “${body.agent.name}” created.` : 'Agent saved.', 'ok');
378
397
  if (created) void loadRuns();
379
- return true;
398
+ return { ok: true, here: true, agent: body.agent };
380
399
  } catch (error) {
381
- if (error.code === 'agent-revision-stale' && error.body?.agent) {
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');
402
+ else if (error.code === 'agent-revision-stale' && error.body?.agent) {
382
403
  const current = error.body.agent;
383
- 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: () => {
384
405
  state.agent = current; state.draft = draftOf(current); state.dirty = false; state.banner = null; paint();
385
406
  } } };
386
- } else state.banner = { text: error.message };
387
- return false;
407
+ } else state.banner = { text: said };
408
+ return { ok: false };
388
409
  } finally { state.saving = false; paint(); }
389
410
  }
390
411
 
391
412
  async function setArchived(archived) {
392
413
  if (!state.agent) return;
414
+ const { agentId } = state.agent;
415
+ let { name, revision } = state.agent;
416
+ // #3148: the answer belongs to this agent: if the person opened another one meanwhile, it is not painted onto that page.
417
+ const stillHere = () => state.view === 'page' && state.agent?.agentId === agentId;
393
418
  if (archived) {
394
419
  // Unsaved edits are the person's to keep or drop, never lost by an Archive that only asked about archiving.
395
420
  const dirty = state.dirty;
@@ -408,14 +433,30 @@
408
433
  ],
409
434
  });
410
435
  if (choice !== 'archive' && choice !== 'discard' && choice !== 'save') return;
411
- if (choice === 'save' && !(await save())) return; // a save that failed says why and keeps the edits
436
+ if (choice === 'save') {
437
+ if (!stillHere()) {
438
+ // Another agent's page was opened while this one asked: its unsaved edits are no longer on screen to save.
439
+ toast(`“${name}” wasn’t saved or archived, because another agent was opened before you chose. Open it again to archive it.`, 'warn');
440
+ return;
441
+ }
442
+ const saved = await saveDraft();
443
+ if (!saved.ok) return; // a save that failed says why and keeps the edits
444
+ ({ name, revision } = saved.agent);
445
+ }
412
446
  }
413
447
  try {
414
- const body = await api(`/api/chat/agents/${encodeURIComponent(state.agent.agentId)}/archive`, { method: 'POST', body: { archived, revision: state.agent.revision } });
415
- state.agent = body.agent; state.draft = draftOf(body.agent); state.dirty = false; state.banner = null;
416
- toast(archived ? 'Agent archived.' : 'Agent restored.', 'ok');
417
- paint();
418
- } catch (error) { state.banner = { text: error.message }; paint(); }
448
+ const body = await api(`/api/chat/agents/${encodeURIComponent(agentId)}/archive`, { method: 'POST', body: { archived, revision } });
449
+ if (stillHere()) {
450
+ state.agent = body.agent; state.draft = draftOf(body.agent); state.dirty = false; state.banner = null;
451
+ toast(archived ? 'Agent archived.' : 'Agent restored.', 'ok');
452
+ } else toast(archived ? `Agent “${name}” archived.` : `Agent “${name}” restored.`, 'ok');
453
+ } catch (error) {
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');
457
+ }
458
+ paint();
459
+ if (!stillHere()) void loadAgents();
419
460
  }
420
461
 
421
462
  /**
@@ -432,7 +473,10 @@
432
473
  const body = await api(`/api/chat/agents/${encodeURIComponent(agentId)}/pause`, { method: 'POST', body: { paused } });
433
474
  if (stillHere()) { state.agent = { ...state.agent, pausedAt: body.agent.pausedAt }; state.banner = null; }
434
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');
435
- } 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
+ }
436
480
  state.pausing = false;
437
481
  paint();
438
482
  void loadAgents();
@@ -580,11 +624,12 @@
580
624
  await loadRuns();
581
625
  $surface.querySelector('#ag-runs-title')?.focus();
582
626
  } catch (failure) {
583
- 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; }
584
629
  // #2061: a run of this agent started meanwhile — ask, with the sheet's own "Start another run".
585
630
  // The server's own sentence is kept: it says whether the run is going or FloLess can't tell.
586
- else if (failure.code === 'agent-run-overlap') { preview = { ...preview, alreadyRunning: { ...(preview.alreadyRunning || { startedAt: null }), message: failure.message } }; error = null; }
587
- 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;
588
633
  busy = false; render();
589
634
  }
590
635
  };
@@ -710,21 +755,21 @@
710
755
  try {
711
756
  await api(`/api/chat/agents/${encodeURIComponent(state.agent.agentId)}/runs/${encodeURIComponent(run.runId)}/targets/${target.index}/retry`,
712
757
  { method: 'POST', body: { confirmed: Boolean(target.retryNeedsConfirm) } });
713
- } 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'); }
714
759
  await loadRuns();
715
760
  }
716
761
 
717
762
  async function cancelTarget(run, target) {
718
763
  try {
719
764
  await api(`/api/chat/agents/${encodeURIComponent(state.agent.agentId)}/runs/${encodeURIComponent(run.runId)}/targets/${target.index}/cancel`, { method: 'POST', body: {} });
720
- } 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'); }
721
766
  await loadRuns();
722
767
  }
723
768
 
724
769
  /** #2106: a project's Knowledge step. A missing Workspaces bridge is said, never a silent no-op. */
725
770
  async function openKnowledgeStepOf(projectId) {
726
771
  const open = window.flolessWorkspaces?.openKnowledgeStep;
727
- 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 });
728
773
  await open(projectId);
729
774
  }
730
775
 
@@ -734,7 +779,7 @@
734
779
  if (holder?.kind === 'knowledge') {
735
780
  if (!(await confirmLeave())) return;
736
781
  try { await openKnowledgeStepOf(holder.projectId); }
737
- 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'); }
738
783
  return;
739
784
  }
740
785
  if (holder?.kind === 'chat' && holder.owner && holder.chatId) { await openInProject({ owner: holder.owner, chatId: holder.chatId, label: holder.title }); return; }
@@ -752,7 +797,8 @@
752
797
  }
753
798
  toast(`Stopped ${holder?.kind === 'chat' ? `“${holder.title}”` : holder?.title || 'that work'}.`, 'ok');
754
799
  } catch (error) {
755
- 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');
756
802
  }
757
803
  }
758
804
 
@@ -762,7 +808,7 @@
762
808
  try {
763
809
  await window.flolessWorkspaces.openChatOwner(target.owner);
764
810
  await window.flolessChat?.openConversationIn?.({ owner: target.owner, label: target.label }, target.chatId);
765
- } 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'); }
766
812
  }
767
813
 
768
814
  // ── a small themed dialog (no native confirm: it would leak the OS theme) ──────────────────────────────────────