@floless/app 0.174.0 → 0.175.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.
- package/autostart.mjs +117 -10
- package/dist/floless-server.cjs +2 -2
- package/dist/pdf-engine/floless_pdf/__init__.py +53 -0
- package/dist/pdf-engine/floless_pdf/backend_pdfium.py +823 -0
- package/dist/pdf-engine/floless_pdf/backend_pymupdf.py +245 -0
- package/dist/pdf-engine/floless_pdf/geometry.py +115 -0
- package/dist/pdf-engine/floless_pdf/images.py +75 -0
- package/dist/pdf-engine/floless_pdf/pages.py +136 -0
- package/dist/pdf-engine/floless_pdf/textrules.py +200 -0
- package/dist/schemas/steel.model.v2.schema.json +45 -1
- package/dist/skills/floless-app-approval/SKILL.md +28 -3
- package/dist/skills/floless-app-knowledge/SKILL.md +3 -2
- package/dist/skills/floless-app-sketches/SKILL.md +71 -0
- package/dist/skills/floless-app-sketches/references/steel-plate.md +15 -0
- package/dist/skills/floless-app-steel-model/SKILL.md +14 -1
- package/dist/skills/floless-app-steel-model/references/elements.md +90 -23
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +18 -7
- package/dist/skills/floless-app-tweak-contract/SKILL.md +3 -2
- package/dist/web/agents.js +1 -1
- package/dist/web/app.css +120 -15
- package/dist/web/app.js +89 -38
- package/dist/web/aware-hold.js +10 -0
- package/dist/web/aware.js +405 -51
- package/dist/web/boot-watchdog.js +249 -0
- package/dist/web/card-details.js +88 -0
- package/dist/web/chat.css +29 -0
- package/dist/web/chat.js +430 -128
- package/dist/web/commands-connection-design.js +23 -0
- package/dist/web/commands-revit.js +3 -0
- package/dist/web/commands-shell.js +226 -10
- package/dist/web/commands-steel.js +95 -5
- package/dist/web/commands-tekla-parser.js +21 -1
- package/dist/web/connection-design-editor.html +71 -0
- package/dist/web/connection-design-editor.js +794 -61
- package/dist/web/connection-design-handles.js +9 -3
- package/dist/web/element-approval.js +74 -0
- package/dist/web/element-context.js +76 -6
- package/dist/web/element-geometry.js +8 -2
- package/dist/web/element-holds.js +68 -5
- package/dist/web/element-type-actions.js +22 -3
- package/dist/web/element-types.js +12 -5
- package/dist/web/element-words.js +15 -11
- package/dist/web/grid-place.js +51 -0
- package/dist/web/guide.js +2 -0
- package/dist/web/index.html +13 -16
- package/dist/web/instructor.js +5 -2
- package/dist/web/missed-routines.js +6 -1
- package/dist/web/model-change-findings.js +147 -32
- package/dist/web/model-change-review.js +435 -32
- package/dist/web/model-clash-check.css +100 -0
- package/dist/web/model-clash-check.js +681 -0
- package/dist/web/model-clip-box.js +204 -0
- package/dist/web/model-clip-list.js +153 -3
- package/dist/web/model-clip-session.js +3 -3
- package/dist/web/model-clip-three-overlay.js +135 -25
- package/dist/web/model-editor.css +2 -0
- package/dist/web/model-elements.js +273 -18
- package/dist/web/model-fit-checks.js +354 -0
- package/dist/web/model-spatial-panel.js +9 -3
- package/dist/web/model-spatial-tools.js +12 -3
- package/dist/web/model-tekla-selection.js +74 -0
- package/dist/web/model-view-query.js +70 -14
- package/dist/web/model-viewport-revit-adapter.js +8 -7
- package/dist/web/model-viewport-toolbar.js +8 -4
- package/dist/web/pages.js +78 -1
- package/dist/web/project-history.js +31 -1
- package/dist/web/revit-editor.css +34 -1
- package/dist/web/revit-editor.js +176 -55
- package/dist/web/run-history.js +8 -0
- package/dist/web/sketch-editor.js +141 -2
- package/dist/web/sketches.js +192 -6
- package/dist/web/start-place.js +46 -0
- package/dist/web/steel-3d-core.js +70 -0
- package/dist/web/steel-3d-view.js +288 -47
- package/dist/web/steel-change-review.css +29 -0
- package/dist/web/steel-custom-connection.js +6 -0
- package/dist/web/steel-editor.html +532 -33
- package/dist/web/steel-filter.html +8 -3
- package/dist/web/steel-model-checks.css +76 -0
- package/dist/web/steel-model-commands.js +1 -1
- package/dist/web/steel-model-v2-commands.js +17 -0
- package/dist/web/steel-view-generation.js +6 -2
- package/dist/web/teams.js +259 -19
- package/dist/web/tekla-editor.html +1 -0
- package/dist/web/terminal-requests.js +6 -0
- package/dist/web/vendor/connection-engine.js +890 -89
- package/dist/web/workspaces.js +630 -48
- package/package.json +4 -1
- package/preferences-file.mjs +27 -0
package/autostart.mjs
CHANGED
|
@@ -40,12 +40,13 @@
|
|
|
40
40
|
// — if ever needed — launch.mjs (plain JS), mirroring teardown.mjs / install-path.mjs.
|
|
41
41
|
// Pure logic (the XML builder) is unit-tested; the imperative wrappers (schtasks.exe)
|
|
42
42
|
// are exercised by the human's real Shut-Down → power-on E2E.
|
|
43
|
-
import { execFileSync } from 'node:child_process';
|
|
43
|
+
import { execFile, execFileSync } from 'node:child_process';
|
|
44
|
+
import { promisify } from 'node:util';
|
|
44
45
|
import { writeFileSync, rmSync, appendFileSync, mkdirSync } from 'node:fs';
|
|
45
46
|
import { tmpdir } from 'node:os';
|
|
46
47
|
import { dirname, join } from 'node:path';
|
|
47
48
|
import { RUN_KEY, RUN_VALUE } from './teardown.mjs';
|
|
48
|
-
import { homeHasPriorUse, preferencesPath, readAutostartIntent, readAutostartStored, setAutostartIntent, withLock } from './preferences-file.mjs';
|
|
49
|
+
import { homeHasPriorUse, preferencesPath, readAutostartIntent, readAutostartStored, setAutostartIntent, withAsyncLock, withLock } from './preferences-file.mjs';
|
|
49
50
|
import { logDir, logFilePath } from './log.mjs';
|
|
50
51
|
import { distributionProfile } from './distribution-profile-active.mjs';
|
|
51
52
|
|
|
@@ -188,6 +189,21 @@ function runSchtasks(args) {
|
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
191
|
|
|
192
|
+
const execFileAsync = promisify(execFile);
|
|
193
|
+
const taskProcessOptions = { encoding: 'utf8', windowsHide: true, timeout: 2500 };
|
|
194
|
+
|
|
195
|
+
async function runSchtasksAsync(args) {
|
|
196
|
+
try {
|
|
197
|
+
const { stdout } = await execFileAsync('schtasks', args, taskProcessOptions);
|
|
198
|
+
return { ok: true, stdout };
|
|
199
|
+
} catch { return { ok: false }; }
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async function removeLegacyRunKeyAsync() {
|
|
203
|
+
try { await execFileAsync('reg', ['delete', RUN_KEY, '/v', RUN_VALUE, '/f'], taskProcessOptions); }
|
|
204
|
+
catch { /* the legacy value may already be gone */ }
|
|
205
|
+
}
|
|
206
|
+
|
|
191
207
|
const bareName = (name) => String(name).replace(/^\\+/, '').toLowerCase();
|
|
192
208
|
|
|
193
209
|
/**
|
|
@@ -226,13 +242,52 @@ function writeTaskXml(xml) {
|
|
|
226
242
|
* Returns { saved, enabled, state, ok, busy }; never throws.
|
|
227
243
|
*/
|
|
228
244
|
export function createAutostartController({
|
|
229
|
-
platform = process.platform, taskName = TASK_NAME, run = runSchtasks, writeXml = writeTaskXml,
|
|
230
|
-
userId = currentUserId, removeLegacy = removeLegacyRunKey, log = logLine,
|
|
231
|
-
intent = () => readAutostartIntent(), stored = () => readAutostartStored(), prior = () => homeHasPriorUse(),
|
|
245
|
+
platform = process.platform, taskName = TASK_NAME, run = runSchtasks, runAsync = runSchtasksAsync, writeXml = writeTaskXml,
|
|
246
|
+
userId = currentUserId, removeLegacy = removeLegacyRunKey, removeLegacyAsync = removeLegacyRunKeyAsync, log = logLine,
|
|
247
|
+
intent = () => readAutostartIntent(), stored = () => readAutostartStored(), prior = () => homeHasPriorUse(),
|
|
248
|
+
store = (enabled, options) => setAutostartIntent(enabled, undefined, options), now = Date.now, ttlMs = 60_000,
|
|
232
249
|
lockPath = () => join(dirname(preferencesPath()), 'autostart'), lockWaitMs = 3000,
|
|
233
250
|
} = {}) {
|
|
234
251
|
const win = platform === 'win32';
|
|
235
252
|
|
|
253
|
+
let cached = 'unknown';
|
|
254
|
+
let validUntil = -Infinity;
|
|
255
|
+
let pending;
|
|
256
|
+
let generation = 0;
|
|
257
|
+
let changing = 0;
|
|
258
|
+
|
|
259
|
+
function invalidate() {
|
|
260
|
+
generation++;
|
|
261
|
+
validUntil = -Infinity;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function remember(state) {
|
|
265
|
+
cached = state;
|
|
266
|
+
validUntil = now() + ttlMs;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
async function stateAsync() {
|
|
270
|
+
if (!win) return 'unknown';
|
|
271
|
+
try {
|
|
272
|
+
if ((await runAsync(['/query', '/tn', taskName])).ok) return 'present';
|
|
273
|
+
} catch { /* try the listing when the named query fails */ }
|
|
274
|
+
try {
|
|
275
|
+
const listing = await runAsync(['/query', '/fo', 'CSV', '/nh']);
|
|
276
|
+
return listing.ok ? taskStateFromListing(listing.stdout, taskName) : 'unknown';
|
|
277
|
+
} catch { return 'unknown'; }
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function read() {
|
|
281
|
+
if (changing || now() < validUntil) return cached;
|
|
282
|
+
if (!pending) {
|
|
283
|
+
const epoch = generation;
|
|
284
|
+
pending = stateAsync().then((state) => {
|
|
285
|
+
if (generation === epoch) remember(state);
|
|
286
|
+
}).finally(() => { pending = null; });
|
|
287
|
+
}
|
|
288
|
+
return cached;
|
|
289
|
+
}
|
|
290
|
+
|
|
236
291
|
function state() {
|
|
237
292
|
if (!win) return 'unknown';
|
|
238
293
|
if (run(['/query', '/tn', taskName]).ok) return 'present';
|
|
@@ -320,13 +375,65 @@ export function createAutostartController({
|
|
|
320
375
|
}
|
|
321
376
|
}
|
|
322
377
|
|
|
323
|
-
|
|
378
|
+
async function setAsync(enabled, exePath) {
|
|
379
|
+
if (!win) return { saved: false, enabled: false, state: 'unknown', ok: false, busy: false };
|
|
380
|
+
changing++;
|
|
381
|
+
invalidate();
|
|
382
|
+
try {
|
|
383
|
+
return await withAsyncLock(lockPath(), async () => {
|
|
384
|
+
let saved = true;
|
|
385
|
+
try { store(enabled, { waitMs: 0 }); }
|
|
386
|
+
catch (error) {
|
|
387
|
+
saved = false;
|
|
388
|
+
log(`autostart: the choice could not be stored (${error?.message ?? error})`);
|
|
389
|
+
}
|
|
390
|
+
let tmp;
|
|
391
|
+
let commandSucceeded = false;
|
|
392
|
+
try {
|
|
393
|
+
if (enabled) {
|
|
394
|
+
tmp = writeXml(buildAutostartTaskXml(exePath, userId()));
|
|
395
|
+
commandSucceeded = (await runAsync(['/Create', '/TN', taskName, '/XML', tmp, '/F'])).ok;
|
|
396
|
+
if (commandSucceeded) await removeLegacyAsync();
|
|
397
|
+
} else {
|
|
398
|
+
commandSucceeded = (await runAsync(['/delete', '/tn', taskName, '/f'])).ok;
|
|
399
|
+
await removeLegacyAsync();
|
|
400
|
+
}
|
|
401
|
+
} catch (error) { log(`autostart: the task could not be changed (${error?.message ?? error})`); }
|
|
402
|
+
finally { if (tmp) { try { rmSync(tmp, { force: true }); } catch { /* best effort */ } } }
|
|
403
|
+
const observed = await stateAsync();
|
|
404
|
+
const wanted = enabled ? 'present' : 'absent';
|
|
405
|
+
// A successful scheduler command confirms the change if a separate query cannot answer.
|
|
406
|
+
const state = observed === 'unknown' && commandSucceeded ? wanted : observed;
|
|
407
|
+
remember(state);
|
|
408
|
+
return { saved, enabled: state === 'present', state, ok: saved && state === wanted, busy: false };
|
|
409
|
+
}, { waitMs: lockWaitMs });
|
|
410
|
+
} catch (error) {
|
|
411
|
+
log(`autostart: not changed (${error?.message ?? error})`);
|
|
412
|
+
if (changing === 1) remember('unknown');
|
|
413
|
+
return { saved: false, enabled: false, state: 'unknown', ok: false, busy: true };
|
|
414
|
+
} finally {
|
|
415
|
+
changing--;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function readStatus() {
|
|
420
|
+
const state = read();
|
|
421
|
+
return { supported: win, state, enabled: state === 'unknown' ? null : state === 'present' };
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return { state, register, unregister, reconcile, set, readStatus, setAsync, invalidate };
|
|
324
425
|
}
|
|
325
426
|
|
|
326
427
|
const controller = createAutostartController();
|
|
428
|
+
export const readAutostartStatus = () => controller.readStatus();
|
|
429
|
+
export const setAutostartAsync = (enabled, exePath) => controller.setAsync(enabled, exePath);
|
|
430
|
+
|
|
431
|
+
function invalidateAfter(write) {
|
|
432
|
+
try { return write(); } finally { controller.invalidate(); }
|
|
433
|
+
}
|
|
327
434
|
|
|
328
435
|
/** Register (or refresh) the task to run `"<exe>" --supervise`, then check it is there. Throws when it is not. Win-only. */
|
|
329
|
-
export const registerAutostart = (exePath) => controller.register(exePath);
|
|
436
|
+
export const registerAutostart = (exePath) => invalidateAfter(() => controller.register(exePath));
|
|
330
437
|
|
|
331
438
|
/** True iff Windows lists the autostart task. */
|
|
332
439
|
export const autostartPresent = () => controller.state() === 'present';
|
|
@@ -338,14 +445,14 @@ export const autostartState = () => controller.state();
|
|
|
338
445
|
* Follow the person's stored choice (#3070): called on every packaged open and by the install/update hooks. Puts a
|
|
339
446
|
* missing task back, unless they turned Start with Windows off. Never throws. Win-only.
|
|
340
447
|
*/
|
|
341
|
-
export const reconcileAutostart = (exePath, context) => controller.reconcile(exePath, context);
|
|
448
|
+
export const reconcileAutostart = (exePath, context) => invalidateAfter(() => controller.reconcile(exePath, context));
|
|
342
449
|
export const ensureAutostart = reconcileAutostart;
|
|
343
450
|
|
|
344
451
|
/** The Start with Windows setting: store the choice, change the task, check the result. */
|
|
345
|
-
export const setAutostart = (enabled, exePath) => controller.set(enabled, exePath);
|
|
452
|
+
export const setAutostart = (enabled, exePath) => invalidateAfter(() => controller.set(enabled, exePath));
|
|
346
453
|
|
|
347
454
|
/** Remove the autostart task AND any legacy Run-key value, then check it is gone. Throws when it is not. Win-only. */
|
|
348
|
-
export const unregisterAutostart = () => controller.unregister();
|
|
455
|
+
export const unregisterAutostart = () => invalidateAfter(() => controller.unregister());
|
|
349
456
|
|
|
350
457
|
/**
|
|
351
458
|
* What PUT /api/autostart answers for a finished change (#3070), in plain words. enabled is what Windows really has, or null when
|
package/dist/floless-server.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/floless-server.cjs
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 35583310 bytes
|
|
4
|
+
sha256: b48a37cbcb27cb3ba7b45cfab0d9a7d7b9b8a457347ceb7a29186cdb01eff284
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""FloLess's PDF module (plan docs/superpowers/specs/2026-11-20-pdf-engine-pypdfium2-PLAN.md, section 3.1).
|
|
2
|
+
|
|
3
|
+
One API, two backends: `pymupdf` (a pass-through, the reference while readers migrate) and `pdfium` (pypdfium2).
|
|
4
|
+
A script never picks an engine itself: the server's engine table (server/pdf-engine.ts) decides, the runner passes
|
|
5
|
+
the choice in the script's JSON request, and the script hands it to `open`. Every result reports `doc.engine`, the
|
|
6
|
+
engine that actually ran, so the runner can check it against the one it asked for.
|
|
7
|
+
|
|
8
|
+
This file is the canonical source. Copies (the managed runtime's, a skill's) are generated from it by the build and
|
|
9
|
+
digest-checked by `verify:pdf-engine`; never edit a copy.
|
|
10
|
+
"""
|
|
11
|
+
from . import images
|
|
12
|
+
from .geometry import IDENTITY, Matrix, Point, Rect, rotation_matrix
|
|
13
|
+
|
|
14
|
+
ENGINES = ("pymupdf", "pdfium")
|
|
15
|
+
API_VERSION = 1
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class EngineUnavailable(ImportError):
|
|
19
|
+
"""The engine asked for is not installed in this Python. The server's readiness check names what is missing."""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _backend(engine):
|
|
23
|
+
if engine == "pymupdf":
|
|
24
|
+
try:
|
|
25
|
+
from . import backend_pymupdf as b
|
|
26
|
+
except ImportError as error:
|
|
27
|
+
raise EngineUnavailable("pymupdf: %s" % error) from error
|
|
28
|
+
return b
|
|
29
|
+
if engine == "pdfium":
|
|
30
|
+
try:
|
|
31
|
+
from . import backend_pdfium as b
|
|
32
|
+
except ImportError as error:
|
|
33
|
+
raise EngineUnavailable("pdfium: %s" % error) from error
|
|
34
|
+
return b
|
|
35
|
+
raise ValueError("unknown PDF engine %r (expected one of %s)" % (engine, ", ".join(ENGINES)))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def open(source, engine, count_only_if_locked=False): # noqa: A001 - the module's own verb, as the readers call it
|
|
39
|
+
"""Open a PDF (a path or its bytes) with the named engine. Raises PermissionError for a password-locked PDF.
|
|
40
|
+
|
|
41
|
+
`count_only_if_locked` (the page count's own reader, as MuPDF has always let it): a locked PDF opens for its
|
|
42
|
+
`page_count` and nothing else, every other call raises PermissionError. Where the engine cannot tell the count
|
|
43
|
+
without the password (PDFium, and a file whose page tree is itself encrypted) it still raises PermissionError."""
|
|
44
|
+
return _backend(engine).Document(source, count_only_if_locked=count_only_if_locked)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def versions(engine):
|
|
48
|
+
"""The library versions an engine runs on, without opening anything."""
|
|
49
|
+
return _backend(engine).versions()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
__all__ = ["API_VERSION", "ENGINES", "EngineUnavailable", "IDENTITY", "Matrix", "Point", "Rect", "images", "open",
|
|
53
|
+
"rotation_matrix", "versions"]
|