@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
@@ -0,0 +1,50 @@
1
+ /**
2
+ * A report that carries files (`report_folder`, #2262 slice 3c) refers to them as `assets/…`. Those resolve only inside
3
+ * the report's Page version (its isolated /pages-content frame); in the run's HTML Viewer — a srcdoc frame on FloLess's
4
+ * own origin — they would ask FloLess for files it does not serve, show broken pictures and log failed requests. So the
5
+ * viewer shows a copy in which every reference to the report's own files is made inert, with a short note pointing to
6
+ * the Page version, where the files are.
7
+ *
8
+ * The copy is PARSED, never run (DOMParser), and only references to `assets/…` change: src/href/poster/data/srcset,
9
+ * CSS url(…) in <style> and style="…", and any @import that would load from FloLess's origin. A <base> is dropped, since
10
+ * it would turn ordinary relative names into requests to FloLess. Everything else is kept as the run made it.
11
+ *
12
+ * Loaded as a classic script before aware.js; tested by server/report-files-web.test.ts with linkedom's DOMParser.
13
+ */
14
+ (function (root) {
15
+ var ASSET = /^\s*(?:\.\/|\/)?assets\//i;
16
+ /** An @import that stays outside FloLess's origin (https or data) can't ask FloLess for anything; others are dropped. */
17
+ function cssClean(css) {
18
+ return String(css)
19
+ .replace(/@import[^;]*;?/gi, function (rule) { return /^@import\s+(?:url\(\s*)?['"]?\s*(?:https:|data:)/i.test(rule) ? rule : ''; })
20
+ .replace(/url\(\s*(['"]?)\s*(?:\.\/|\/)?assets\/[^)]*\)/gi, 'url("data:,")');
21
+ }
22
+ /** The report with every reference to its own files made inert, and `note` (if any) shown first. */
23
+ function neutralize(html, Parser, note) {
24
+ var P = Parser || root.DOMParser;
25
+ var doc = new P().parseFromString(String(html || ''), 'text/html');
26
+ doc.querySelectorAll('base').forEach(function (b) { b.remove(); });
27
+ doc.querySelectorAll('*').forEach(function (el) {
28
+ ['src', 'href', 'poster', 'data', 'xlink:href'].forEach(function (name) {
29
+ var v = el.getAttribute(name);
30
+ if (v !== null && ASSET.test(v)) { el.setAttribute('data-floless-' + name.replace(':', '-'), v); el.removeAttribute(name); }
31
+ });
32
+ var srcset = el.getAttribute('srcset');
33
+ if (srcset !== null && srcset.split(',').some(function (c) { return ASSET.test(c); })) {
34
+ el.setAttribute('data-floless-srcset', srcset); el.removeAttribute('srcset');
35
+ }
36
+ var style = el.getAttribute('style');
37
+ if (style && /assets\/|@import/i.test(style)) el.setAttribute('style', cssClean(style));
38
+ if (String(el.tagName).toUpperCase() === 'STYLE') el.textContent = cssClean(el.textContent);
39
+ });
40
+ if (note && doc.body) {
41
+ var p = doc.createElement('p');
42
+ p.setAttribute('data-floless-files-note', '');
43
+ p.setAttribute('style', 'margin:0;padding:.6rem 1rem;font:13px/1.5 system-ui,sans-serif;background:#111c33;color:#e2e8f0;border-left:3px solid #fbbf24');
44
+ p.textContent = note;
45
+ doc.body.insertBefore(p, doc.body.firstChild);
46
+ }
47
+ return '<!doctype html>' + doc.documentElement.outerHTML;
48
+ }
49
+ root.FlolessReportFiles = { neutralize: neutralize };
50
+ })(typeof window !== 'undefined' ? window : globalThis);
@@ -0,0 +1,132 @@
1
+ /* Keep startup reads in the page until the server has recovered their stores.
2
+ * Waiting here uses no HTTP connection. The server's own barrier still authorizes every request.
3
+ */
4
+ (() => {
5
+ function createStartupAdmission(options = {}) {
6
+ const fetchHealth = options.fetch || globalThis.fetch.bind(globalThis);
7
+ const origin = options.origin || globalThis.location.origin;
8
+ const setTimer = options.setTimeout || globalThis.setTimeout.bind(globalThis);
9
+ const clearTimer = options.clearTimeout || globalThis.clearTimeout.bind(globalThis);
10
+ const probeTimeoutMs = options.probeTimeoutMs ?? 45000;
11
+ const pollDelayMs = options.pollDelayMs ?? 1000;
12
+ let generation = 0, suspended = false, disposed = false, probe = null, delay = null;
13
+ const wakeups = new Set();
14
+ const reset = () => Object.assign(new Error('Startup observation was superseded.'), { code: 'startup-observation-superseded' });
15
+ const cancelled = () => new DOMException('The read was cancelled.', 'AbortError');
16
+
17
+ function wait(promise, signal) {
18
+ if (signal?.aborted) return Promise.reject(signal.reason || cancelled());
19
+ if (!signal) return promise;
20
+ return new Promise((resolve, reject) => {
21
+ const abort = () => { cleanup(); reject(signal.reason || cancelled()); };
22
+ const cleanup = () => signal.removeEventListener('abort', abort);
23
+ signal.addEventListener('abort', abort, { once: true });
24
+ promise.then(value => { cleanup(); resolve(value); }, error => { cleanup(); reject(error); });
25
+ });
26
+ }
27
+
28
+ function wake() { for (const resume of [...wakeups]) resume(); }
29
+ function invalidate() {
30
+ generation++;
31
+ const oldProbe = probe; probe = null;
32
+ if (oldProbe) { clearTimer(oldProbe.timer); oldProbe.controller.abort(); oldProbe.reject(reset()); }
33
+ const oldDelay = delay; delay = null;
34
+ if (oldDelay) { clearTimer(oldDelay.timer); oldDelay.reject(reset()); }
35
+ wake();
36
+ }
37
+ function suspend() { suspended = true; invalidate(); }
38
+ function resume() { suspended = false; invalidate(); }
39
+ function dispose() { disposed = true; suspended = false; invalidate(); }
40
+
41
+ async function active(signal) {
42
+ while (suspended) {
43
+ let resume;
44
+ try {
45
+ await wait(new Promise(resolve => {
46
+ resume = () => resolve();
47
+ wakeups.add(resume);
48
+ }), signal);
49
+ } finally { wakeups.delete(resume); }
50
+ }
51
+ if (disposed) throw cancelled();
52
+ if (signal?.aborted) throw signal.reason || cancelled();
53
+ }
54
+
55
+ function observation() {
56
+ if (probe) return probe.promise;
57
+ const owner = { generation, controller: new AbortController(), timer: null, promise: null, reject: null };
58
+ const superseded = new Promise((_, reject) => { owner.reject = reject; });
59
+ owner.timer = setTimer(() => owner.controller.abort(), probeTimeoutMs);
60
+ probe = owner;
61
+ owner.promise = Promise.race([Promise.resolve().then(async () => {
62
+ if (owner.generation !== generation) throw reset();
63
+ let response;
64
+ try { response = await fetchHealth('/api/health', { cache: 'no-store', signal: owner.controller.signal }); }
65
+ catch (cause) {
66
+ if (owner.generation !== generation) throw reset();
67
+ throw Object.assign(new Error('FloLess could not be reached. Make sure it is still running, then try again.'), { cause });
68
+ }
69
+ let body;
70
+ try { body = await response.json(); }
71
+ catch (cause) { throw Object.assign(new Error('FloLess could not check whether project recovery is finished. Try again in a moment.'), { cause }); }
72
+ if (owner.generation !== generation) throw reset();
73
+ if (!response.ok) throw Object.assign(new Error('FloLess could not be reached. Make sure it is still running, then try again.'), { status: response.status, body });
74
+ const admission = body?.startupAdmission;
75
+ if (!admission || typeof admission.ready !== 'boolean' || typeof admission.instanceId !== 'string' || !admission.instanceId
76
+ || !Array.isArray(admission.independentReadPaths) || !admission.independentReadPaths.every(path => typeof path === 'string')
77
+ || !Array.isArray(admission.independentReadPrefixes) || !admission.independentReadPrefixes.every(path => typeof path === 'string')) {
78
+ throw new Error('FloLess could not check whether project recovery is finished. Try again in a moment.');
79
+ }
80
+ return body;
81
+ }), superseded]).finally(() => {
82
+ clearTimer(owner.timer);
83
+ if (probe === owner) probe = null;
84
+ });
85
+ return owner.promise;
86
+ }
87
+
88
+ async function health({ signal } = {}) {
89
+ for (;;) {
90
+ await active(signal);
91
+ try { return await wait(observation(), signal); }
92
+ catch (error) { if (error?.code !== 'startup-observation-superseded') throw error; }
93
+ }
94
+ }
95
+
96
+ function pause() {
97
+ if (!delay) {
98
+ const owner = { timer: null, promise: null, reject: null };
99
+ owner.promise = new Promise((resolve, reject) => {
100
+ owner.reject = reject;
101
+ owner.timer = setTimer(resolve, pollDelayMs);
102
+ }).finally(() => { if (delay === owner) delay = null; });
103
+ delay = owner;
104
+ }
105
+ return delay.promise;
106
+ }
107
+
108
+ async function admit(path, { method = 'GET', signal } = {}) {
109
+ const url = new URL(path, origin);
110
+ if (url.origin !== origin || !['GET', 'HEAD'].includes(method.toUpperCase()) || !url.pathname.startsWith('/api/')) return;
111
+ const pathname = decodeURIComponent(url.pathname);
112
+ if (pathname === '/api/health') return;
113
+ for (;;) {
114
+ const body = await health({ signal });
115
+ const admission = body.startupAdmission;
116
+ if (admission.ready || admission.independentReadPaths.includes(pathname)
117
+ || admission.independentReadPrefixes.some(prefix => pathname === prefix || pathname.startsWith(`${prefix}/`))) return;
118
+ try { await wait(pause(), signal); }
119
+ catch (error) { if (error?.code !== 'startup-observation-superseded') throw error; }
120
+ }
121
+ }
122
+
123
+ return { admit, health, invalidate, suspend, resume, dispose };
124
+ }
125
+
126
+ globalThis.createStartupAdmission = createStartupAdmission;
127
+ if (typeof window !== 'undefined' && window.document) {
128
+ window.flolessStartupAdmission = createStartupAdmission();
129
+ window.addEventListener('pagehide', () => window.flolessStartupAdmission.suspend());
130
+ window.addEventListener('pageshow', event => { if (event.persisted) window.flolessStartupAdmission.resume(); });
131
+ }
132
+ })();
@@ -1063,6 +1063,15 @@ export function isUnknownElev(e) { return !!e && e.unknown === true; }
1063
1063
  export function isAssumedElev(e) { return !!e && e.assumed === true; }
1064
1064
  /** Either spelling of "nobody has confirmed this height". */
1065
1065
  export function isUnresolvedElev(e) { return isUnknownElev(e) || isAssumedElev(e); }
1066
+ /**
1067
+ * DECIDED BY THE AI in a Quick model build (#2521). Real geometry that a quick BOM counts, so it is NOT
1068
+ * unresolved (`isUnresolvedElev` stays false and the member is measured), but it is not evidence either:
1069
+ * never agreement, never an anchor, never the person's answer. Ask this wherever a decision rests on
1070
+ * whether a height is EVIDENCE.
1071
+ */
1072
+ export function isDecidedElev(e) { return !!e && !!e.decided && typeof e.decided === 'object' && typeof e.known === 'number'; }
1073
+ /** Is this height EVIDENCE: a number the drawings or the person gave? Not when unresolved or decided by the AI. */
1074
+ export function isEvidenceElev(e) { return knownZ(e) !== null && !isUnresolvedElev(e) && !isDecidedElev(e); }
1066
1075
  /** The known elevation in mm, or null when unknown/malformed. Never returns 0 for "unknown". */
1067
1076
  export function knownZ(e) { return e && typeof e.known === 'number' && Number.isFinite(e.known) ? e.known : null; }
1068
1077