@floless/app 0.156.0 → 0.157.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 (53) hide show
  1. package/cli-actions.mjs +21 -5
  2. package/dist/floless-server.cjs +70965 -43326
  3. package/dist/schemas/drawing-check.profile.v1.schema.json +15 -2
  4. package/dist/schemas/steel.model.v2.schema.json +25 -1
  5. package/dist/skills/floless-app-actions/SKILL.md +79 -17
  6. package/dist/skills/floless-app-knowledge/SKILL.md +21 -2
  7. package/dist/skills/floless-app-new-workflow/SKILL.md +23 -7
  8. package/dist/skills/floless-app-onboarding/SKILL.md +31 -1
  9. package/dist/skills/floless-app-report-issue/SKILL.md +3 -3
  10. package/dist/skills/floless-app-rfi/SKILL.md +40 -6
  11. package/dist/skills/floless-app-routines/SKILL.md +9 -2
  12. package/dist/skills/floless-app-steel-model/SKILL.md +1 -1
  13. package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +4 -2
  14. package/dist/skills/floless-app-tweak-contract/SKILL.md +25 -5
  15. package/dist/skills/floless-app-workflows/SKILL.md +46 -10
  16. package/dist/skills/floless-app-workflows/references/agent-steps.md +119 -0
  17. package/dist/web/agent-steps.js +864 -47
  18. package/dist/web/agents.js +28 -8
  19. package/dist/web/app.css +478 -3
  20. package/dist/web/app.js +110 -11
  21. package/dist/web/aware-update-client.js +1 -0
  22. package/dist/web/aware.js +685 -170
  23. package/dist/web/chat-landing-scene.js +372 -0
  24. package/dist/web/chat.css +245 -1
  25. package/dist/web/chat.js +2466 -78
  26. package/dist/web/commands-drawing-check.js +17 -0
  27. package/dist/web/commands-shell.js +820 -3
  28. package/dist/web/commands-steel.js +6 -0
  29. package/dist/web/connections.js +1 -0
  30. package/dist/web/drawing-check-editor.html +33 -5
  31. package/dist/web/drawing-check-editor.js +538 -22
  32. package/dist/web/drawing-check-overlay.js +13 -0
  33. package/dist/web/flo-avatar.js +28 -3
  34. package/dist/web/guide.js +7 -2
  35. package/dist/web/index.html +119 -6
  36. package/dist/web/instructor.js +3 -3
  37. package/dist/web/model-view-query.js +12 -2
  38. package/dist/web/pages.js +865 -34
  39. package/dist/web/panels.js +5 -2
  40. package/dist/web/parser-setup-recovery.js +12 -4
  41. package/dist/web/project-access.js +549 -0
  42. package/dist/web/report-files.js +50 -0
  43. package/dist/web/startup-admission.js +132 -0
  44. package/dist/web/steel-3d-core.js +9 -0
  45. package/dist/web/steel-editor.html +642 -22
  46. package/dist/web/steel-model-v2-commands.js +63 -5
  47. package/dist/web/step-rename.js +287 -0
  48. package/dist/web/terminal-requests.js +59 -10
  49. package/dist/web/tool-updates.js +1 -0
  50. package/dist/web/workspace-root-management.js +39 -0
  51. package/dist/web/workspaces.js +1667 -63
  52. package/launch.mjs +9 -7
  53. package/package.json +3 -1
package/dist/web/app.js CHANGED
@@ -373,6 +373,7 @@ function cardEl(id, ports) {
373
373
  <div class="title">${a.title}</div>
374
374
  <div class="subtitle">${a.subtitle}</div>
375
375
  ${a._aiStep ? `<div class="rt-model-badge is-agent" role="note" aria-label="${escapeAttr(a._aiStep.badge.aria)}" data-tip="${escapeAttr(a._aiStep.badge.tip)}">${escapeHtml(a._aiStep.badge.text)}</div>` : ''}
376
+ ${a._aiUse ? `<div class="rt-model-badge is-ai-use is-${escapeAttr(a._aiUse.how)}" role="note" aria-label="${escapeAttr(`${a._aiUse.text}. ${a._aiUse.tip}`)}" data-tip="${escapeAttr(a._aiUse.tip)}">${escapeHtml(a._aiUse.text)}</div>` : ''}
376
377
  ${a._runtimeModel ? '<div class="rt-model-badge" data-tip="This node calls a model at run time (vision.extract). Output is content-cached and sits behind an approve gate — review the extraction before any write.">⚡ calls a model at run time</div>' : ''}
377
378
  ${a._frozen ? '<div class="frozen-badge" data-tip="Frozen — its last result is pinned and Run skips this node. Right-click to unfreeze.">❄ Frozen</div>' : ''}
378
379
  <div class="blurb">${a.blurb}</div>
@@ -1347,6 +1348,26 @@ $menuBtn.addEventListener('click', (e) => {
1347
1348
  // changed out-of-band (Windows Settings → Startup apps). refreshStartup is a
1348
1349
  // hoisted function declaration defined later in this file.
1349
1350
  if ($menu.classList.contains('show')) { try { refreshStartup(); } catch {} }
1351
+ // #2399: the suggestion mode may have changed in AI Chat or another tab.
1352
+ if ($menu.classList.contains('show')) void window.flolessAssistantMode?.refresh();
1353
+ });
1354
+
1355
+ /* ============= SUGGESTIONS (#2399) ============= */
1356
+ // The account's "Suggest next steps" mode: the same setting as the AI Chat ⚙ row (web/chat.js owns reading and saving
1357
+ // it as window.flolessAssistantMode); one floless:assistant-mode event keeps the two in step.
1358
+ function paintSuggestMenu(current) {
1359
+ const recovered = current?.recovered === true;
1360
+ document.querySelectorAll('.suggest-btn').forEach((b) => {
1361
+ const on = !recovered && current?.mode === b.dataset.mode;
1362
+ b.classList.toggle('active', on);
1363
+ b.setAttribute('aria-checked', String(on));
1364
+ });
1365
+ const note = document.getElementById('menu-suggest-note');
1366
+ if (note) note.hidden = !recovered;
1367
+ }
1368
+ window.addEventListener('floless:assistant-mode', (event) => paintSuggestMenu(event.detail));
1369
+ document.querySelectorAll('.suggest-btn').forEach((b) => {
1370
+ b.addEventListener('click', () => { void window.flolessAssistantMode?.set(b.dataset.mode); });
1350
1371
  });
1351
1372
 
1352
1373
  document.addEventListener('click', (e) => {
@@ -1505,6 +1526,7 @@ const $startupToggle = document.getElementById('startup-toggle');
1505
1526
 
1506
1527
  async function refreshStartup() {
1507
1528
  try {
1529
+ await globalThis.flolessStartupAdmission?.admit('/api/autostart');
1508
1530
  const r = await fetch('/api/autostart');
1509
1531
  if (!r.ok) { if ($startupRow) $startupRow.hidden = true; showStartOnLoginLinks(false); return; }
1510
1532
  const d = await r.json();
@@ -1983,8 +2005,15 @@ const $workspaceRootUse = document.getElementById('workspace-root-use');
1983
2005
  let workspaceRootState = null;
1984
2006
  let workspaceRootChoice = null;
1985
2007
  let workspaceRootBusy = false;
2008
+ let workspaceRootObservation = 0;
2009
+ let workspaceRootAcceptedObservation = 0;
2010
+ let workspaceRootSelecting = false;
2011
+ let workspaceRootConnection = 0;
2012
+ let workspaceRootOperation = null;
2013
+ let workspaceRootInterruption = '';
1986
2014
 
1987
2015
  async function workspaceRootApi(path, opts) {
2016
+ await globalThis.flolessStartupAdmission?.admit(path, { method: opts?.method, signal: opts?.signal });
1988
2017
  const response = await fetch(path, { headers: { 'content-type': 'application/json' }, ...opts });
1989
2018
  const body = await response.json().catch(() => ({ ok: false, error: `Unreadable response (HTTP ${response.status})` }));
1990
2019
  if (!response.ok || body.ok === false) {
@@ -2006,10 +2035,32 @@ function announceWorkspaceRootState() {
2006
2035
  }
2007
2036
 
2008
2037
  function setWorkspaceRootError(message) {
2038
+ message = message || workspaceRootInterruption;
2009
2039
  $workspaceRootError.hidden = !message;
2010
2040
  $workspaceRootError.textContent = message || '';
2011
2041
  }
2012
2042
 
2043
+ function ownsWorkspaceRootOperation(operation) {
2044
+ return workspaceRootOperation === operation && operation.connection === workspaceRootConnection;
2045
+ }
2046
+
2047
+ function invalidateWorkspaceRootConnection() {
2048
+ workspaceRootConnection++;
2049
+ workspaceRootObservation++;
2050
+ const operation = workspaceRootOperation;
2051
+ const hadChoice = !!workspaceRootChoice;
2052
+ workspaceRootOperation = null;
2053
+ workspaceRootSelecting = false;
2054
+ workspaceRootChoice = null;
2055
+ if (!operation && !hadChoice) return;
2056
+ // Revoking browser ownership does not cancel the earlier request or establish its outcome.
2057
+ if (operation?.kind === 'select') workspaceRootInterruption = 'The connection changed while FloLess was switching the Workspace directory. The earlier request may have finished. Check the current directory, then choose again if needed.';
2058
+ else if (!workspaceRootInterruption) workspaceRootInterruption = 'The connection changed. Choose a Workspace directory again before using it.';
2059
+ setWorkspaceRootBusy(false);
2060
+ setWorkspaceRootError('');
2061
+ renderWorkspaceRootModal();
2062
+ }
2063
+
2013
2064
  function workspaceRootErrorMessage(error) {
2014
2065
  const raw = String(error && error.message || error || 'Could not use that folder.');
2015
2066
  const uncheckedProjects = "FloLess can't switch to this folder yet. It contains projects, and another saved directory can't be checked right now, so FloLess can't confirm those projects aren't already saved there. For now, cancel this review and choose an empty Workspace directory. You can switch to this folder once every other saved directory is available or stopped.";
@@ -2099,21 +2150,40 @@ function renderWorkspaceRootModal() {
2099
2150
  $workspaceRootUse.hidden = !workspaceRootChoice;
2100
2151
  }
2101
2152
 
2102
- async function refreshWorkspaceRoot() {
2153
+ async function refreshWorkspaceRoot(options = {}) {
2154
+ // A background observation cannot erase the person's pending selection or its failure.
2155
+ if (workspaceRootSelecting) return null;
2156
+ const observation = ++workspaceRootObservation;
2157
+ const current = () => observation === workspaceRootObservation && !workspaceRootSelecting
2158
+ && (!options.isCurrent || options.isCurrent());
2103
2159
  try {
2104
- workspaceRootState = await workspaceRootApi('/api/workspace-root');
2160
+ const result = await workspaceRootApi('/api/workspace-root');
2161
+ if (!current()) return null;
2162
+ if (typeof result.available !== 'boolean' || !result.root
2163
+ || typeof result.root.rootId !== 'string' || !result.root.rootId.trim()
2164
+ || typeof result.root.path !== 'string' || !result.root.path.trim()
2165
+ || !Number.isSafeInteger(result.root.generation) || result.root.generation < 0) {
2166
+ throw new Error('The server did not identify its Workspace directory.');
2167
+ }
2168
+ workspaceRootState = result;
2169
+ workspaceRootAcceptedObservation = observation;
2105
2170
  setWorkspaceRootError('');
2171
+ renderWorkspaceRootModal();
2106
2172
  announceWorkspaceRootState();
2173
+ return result;
2107
2174
  } catch (error) {
2175
+ if (!current()) return null;
2108
2176
  setWorkspaceRootError(workspaceRootErrorMessage(error));
2177
+ renderWorkspaceRootModal();
2178
+ if (options.throwOnError) throw error;
2179
+ return null;
2109
2180
  }
2110
- renderWorkspaceRootModal();
2111
- return workspaceRootState;
2112
2181
  }
2113
2182
 
2114
2183
  function closeWorkspaceRoot() {
2115
2184
  if (workspaceRootBusy) return;
2116
2185
  workspaceRootChoice = null;
2186
+ workspaceRootInterruption = '';
2117
2187
  setWorkspaceRootError('');
2118
2188
  $workspaceRootModal.classList.remove('show');
2119
2189
  }
@@ -2128,10 +2198,14 @@ async function openWorkspaceRoot() {
2128
2198
  }
2129
2199
 
2130
2200
  async function chooseWorkspaceRoot() {
2201
+ const operation = { connection: workspaceRootConnection, kind: 'choose' };
2202
+ workspaceRootOperation = operation;
2203
+ workspaceRootInterruption = '';
2131
2204
  setWorkspaceRootError('');
2132
2205
  setWorkspaceRootBusy(true, 'Choosing…');
2133
2206
  try {
2134
2207
  const choice = await workspaceRootApi('/api/workspace-root/choose', { method: 'POST', body: '{}' });
2208
+ if (!ownsWorkspaceRootOperation(operation)) return;
2135
2209
  if (choice.cancelled) return;
2136
2210
  if (choice.unchanged) {
2137
2211
  setWorkspaceRootBusy(false);
@@ -2139,35 +2213,52 @@ async function chooseWorkspaceRoot() {
2139
2213
  showToast('FloLess is already using that folder.', 'ok');
2140
2214
  return;
2141
2215
  }
2142
- workspaceRootChoice = { selectionId: choice.selectionId, path: choice.path };
2216
+ workspaceRootChoice = { selectionId: choice.selectionId, path: choice.path, connection: operation.connection };
2143
2217
  } catch (error) {
2218
+ if (!ownsWorkspaceRootOperation(operation)) return;
2144
2219
  setWorkspaceRootError(workspaceRootErrorMessage(error));
2145
2220
  } finally {
2146
- setWorkspaceRootBusy(false);
2147
- renderWorkspaceRootModal();
2221
+ if (ownsWorkspaceRootOperation(operation)) {
2222
+ workspaceRootOperation = null;
2223
+ setWorkspaceRootBusy(false);
2224
+ renderWorkspaceRootModal();
2225
+ }
2148
2226
  }
2149
2227
  }
2150
2228
 
2151
2229
  async function confirmWorkspaceRoot() {
2152
- if (!workspaceRootChoice) return chooseWorkspaceRoot();
2230
+ if (!workspaceRootChoice || workspaceRootChoice.connection !== workspaceRootConnection) return chooseWorkspaceRoot();
2231
+ const operation = { connection: workspaceRootConnection, kind: 'select' };
2232
+ const selectionId = workspaceRootChoice.selectionId;
2233
+ workspaceRootOperation = operation;
2234
+ workspaceRootObservation++;
2235
+ workspaceRootSelecting = true;
2153
2236
  setWorkspaceRootError('');
2154
2237
  setWorkspaceRootBusy(true, 'Switching folder…');
2155
2238
  try {
2156
2239
  const result = await workspaceRootApi('/api/workspace-root/select', {
2157
- method: 'POST', body: JSON.stringify({ selectionId: workspaceRootChoice.selectionId }),
2240
+ method: 'POST', body: JSON.stringify({ selectionId }),
2158
2241
  });
2242
+ if (!ownsWorkspaceRootOperation(operation)) return;
2243
+ workspaceRootAcceptedObservation = ++workspaceRootObservation;
2159
2244
  workspaceRootState = result;
2160
2245
  workspaceRootChoice = null;
2246
+ // Publish only after this authoritative commit can satisfy a waiting reconnect.
2247
+ workspaceRootSelecting = false;
2161
2248
  announceWorkspaceRootState();
2249
+ if (!ownsWorkspaceRootOperation(operation)) return;
2162
2250
  // The server also broadcasts these. Dispatching locally closes the old project immediately even
2163
2251
  // when this tab's EventSource is reconnecting; every listener re-reads rather than trusting data.
2164
2252
  window.dispatchEvent(new CustomEvent('floless:projects-changed', { detail: {
2165
2253
  rootId: result.root.rootId, generation: result.root.generation,
2166
2254
  } }));
2255
+ if (!ownsWorkspaceRootOperation(operation)) return;
2167
2256
  if (window.flolessBridge && window.flolessBridge.loadRequests) window.flolessBridge.loadRequests();
2257
+ if (!ownsWorkspaceRootOperation(operation)) return;
2168
2258
  $workspaceRootModal.classList.remove('show');
2169
2259
  showToast(`Workspace directory changed to “${workspaceRootName(result.root.path)}”.`, 'ok');
2170
2260
  } catch (error) {
2261
+ if (!ownsWorkspaceRootOperation(operation)) return;
2171
2262
  const busy = error && error.body && error.body.code === 'workspace-root-busy';
2172
2263
  const activities = busy && Array.isArray(error.body.blockers)
2173
2264
  ? [...new Set(error.body.blockers.map((blocker) => blocker && blocker.label).filter(Boolean))]
@@ -2176,14 +2267,19 @@ async function confirmWorkspaceRoot() {
2176
2267
  ? `FloLess is still finishing a change${activities.length ? ` (${activities.join(', ')})` : ''}, so it can't switch Workspace directory yet. Nothing is wrong with this folder. Let that work finish, or stop it, then click Use folder again.`
2177
2268
  : workspaceRootErrorMessage(error));
2178
2269
  } finally {
2179
- setWorkspaceRootBusy(false);
2180
- renderWorkspaceRootModal();
2270
+ if (ownsWorkspaceRootOperation(operation)) {
2271
+ workspaceRootOperation = null;
2272
+ workspaceRootSelecting = false;
2273
+ setWorkspaceRootBusy(false);
2274
+ renderWorkspaceRootModal();
2275
+ }
2181
2276
  }
2182
2277
  }
2183
2278
 
2184
2279
  $workspaceRootCancel.onclick = () => {
2185
2280
  if (workspaceRootChoice) {
2186
2281
  workspaceRootChoice = null;
2282
+ workspaceRootInterruption = '';
2187
2283
  setWorkspaceRootError('');
2188
2284
  renderWorkspaceRootModal();
2189
2285
  } else closeWorkspaceRoot();
@@ -2195,6 +2291,9 @@ window.flolessWorkspaceRoot = {
2195
2291
  open: openWorkspaceRoot,
2196
2292
  refresh: refreshWorkspaceRoot,
2197
2293
  current: () => workspaceRootState,
2294
+ invalidateConnection: invalidateWorkspaceRootConnection,
2295
+ isCurrent: (observation) => !!observation && observation === workspaceRootState
2296
+ && workspaceRootAcceptedObservation === workspaceRootObservation && !workspaceRootSelecting,
2198
2297
  name: () => workspaceRootName(workspaceRootState && workspaceRootState.root && workspaceRootState.root.path),
2199
2298
  };
2200
2299
  refreshWorkspaceRoot();
@@ -60,6 +60,7 @@
60
60
  };
61
61
 
62
62
  async function request(path, init = {}) {
63
+ await globalThis.flolessStartupAdmission?.admit(path, { method: init.method, signal: init.signal });
63
64
  const controller = new AbortController();
64
65
  const timer = setTimer(() => controller.abort(), requestTimeoutMs);
65
66
  try {