@floless/app 0.111.3 → 0.112.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/dist/floless-server.cjs +896 -60
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +25 -9
- package/dist/skills/reading-structural-drawings/SKILL.md +11 -1
- package/dist/web/app.css +65 -0
- package/dist/web/aware.js +1 -1
- package/dist/web/index.html +32 -0
- package/dist/web/steel-3d-view.js +87 -11
- package/dist/web/steel-editor.html +78 -13
- package/dist/web/workspaces.js +777 -3
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -50822,7 +50822,7 @@ function deriveSandboxLicenseDir() {
|
|
|
50822
50822
|
deriveSandboxLicenseDir();
|
|
50823
50823
|
|
|
50824
50824
|
// main.ts
|
|
50825
|
-
var
|
|
50825
|
+
var import_node_child_process12 = require("node:child_process");
|
|
50826
50826
|
var import_node_readline2 = require("node:readline");
|
|
50827
50827
|
|
|
50828
50828
|
// index.ts
|
|
@@ -50830,7 +50830,7 @@ var import_node_url5 = require("node:url");
|
|
|
50830
50830
|
var import_node_path45 = require("node:path");
|
|
50831
50831
|
var import_node_os26 = require("node:os");
|
|
50832
50832
|
var import_node_fs48 = require("node:fs");
|
|
50833
|
-
var
|
|
50833
|
+
var import_node_child_process10 = require("node:child_process");
|
|
50834
50834
|
|
|
50835
50835
|
// log.mjs
|
|
50836
50836
|
var import_node_path = require("node:path");
|
|
@@ -52191,7 +52191,7 @@ function awareNpmVersion() {
|
|
|
52191
52191
|
}
|
|
52192
52192
|
}
|
|
52193
52193
|
var SHELL_META = /[&|;<>^"'`$()%\r\n\0]/;
|
|
52194
|
-
function runRaw(args, onSpawn) {
|
|
52194
|
+
function runRaw(args, onSpawn, envOverride) {
|
|
52195
52195
|
const invoker = currentInvoker();
|
|
52196
52196
|
const [bin, ...preArgs] = invoker.head;
|
|
52197
52197
|
if (!bin) throw new AwareError("aware CLI invoker not resolved");
|
|
@@ -52201,7 +52201,11 @@ function runRaw(args, onSpawn) {
|
|
|
52201
52201
|
}
|
|
52202
52202
|
const argv = [...preArgs, ...args];
|
|
52203
52203
|
return new Promise((resolve11, reject) => {
|
|
52204
|
-
const child = (0, import_node_child_process2.spawn)(bin, argv, {
|
|
52204
|
+
const child = (0, import_node_child_process2.spawn)(bin, argv, {
|
|
52205
|
+
shell: invoker.shell,
|
|
52206
|
+
windowsHide: true,
|
|
52207
|
+
...envOverride ? { env: { ...process.env, ...envOverride } } : {}
|
|
52208
|
+
});
|
|
52205
52209
|
onSpawn?.(child);
|
|
52206
52210
|
let stdout = "";
|
|
52207
52211
|
let stderr = "";
|
|
@@ -52290,6 +52294,95 @@ function teklaBridgeStatus() {
|
|
|
52290
52294
|
}
|
|
52291
52295
|
return { path, version };
|
|
52292
52296
|
}
|
|
52297
|
+
function resolveHostBridge(host) {
|
|
52298
|
+
const invoker = currentInvoker();
|
|
52299
|
+
const exe = `aware-${host}.exe`;
|
|
52300
|
+
const candidates = [
|
|
52301
|
+
(0, import_node_path6.join)((0, import_node_os6.homedir)(), ".aware", "bridges", exe),
|
|
52302
|
+
invoker.pkgDir ? (0, import_node_path6.join)(invoker.pkgDir, "binaries", exe) : null
|
|
52303
|
+
].filter((p) => !!p);
|
|
52304
|
+
return candidates.find((p) => (0, import_node_fs7.existsSync)(p)) ?? null;
|
|
52305
|
+
}
|
|
52306
|
+
function hostBridgeStatus(host) {
|
|
52307
|
+
const path = resolveHostBridge(host);
|
|
52308
|
+
if (!path) return { path: null, version: null };
|
|
52309
|
+
let version = null;
|
|
52310
|
+
try {
|
|
52311
|
+
version = (0, import_node_fs7.readFileSync)((0, import_node_path6.join)((0, import_node_path6.dirname)(path), `aware-${host}.version`), "utf8").trim() || null;
|
|
52312
|
+
} catch {
|
|
52313
|
+
}
|
|
52314
|
+
return { path, version };
|
|
52315
|
+
}
|
|
52316
|
+
function standardUserTempDir() {
|
|
52317
|
+
return process.env.LOCALAPPDATA ? (0, import_node_path6.join)(process.env.LOCALAPPDATA, "Temp") : (0, import_node_path6.join)((0, import_node_os6.homedir)(), "AppData", "Local", "Temp");
|
|
52318
|
+
}
|
|
52319
|
+
async function hostInstances(host) {
|
|
52320
|
+
const bin = resolveHostBridge(host);
|
|
52321
|
+
if (!bin) return { ok: false, instances: [], probeFailed: true, error: `aware-${host} bridge not found (run \`aware sidecar install ${host}\`)` };
|
|
52322
|
+
const probe = (env3) => new Promise((resolve11) => {
|
|
52323
|
+
const child = (0, import_node_child_process2.spawn)(bin, ["list-instances"], { windowsHide: true, env: env3 ? { ...process.env, ...env3 } : process.env });
|
|
52324
|
+
let stdout = "";
|
|
52325
|
+
let stderr = "";
|
|
52326
|
+
const timer = setTimeout(() => child.kill(), 3e4);
|
|
52327
|
+
child.stdout.on("data", (d) => stdout += d.toString());
|
|
52328
|
+
child.stderr.on("data", (d) => stderr += d.toString());
|
|
52329
|
+
child.on("error", () => {
|
|
52330
|
+
clearTimeout(timer);
|
|
52331
|
+
resolve11({ code: -1, stdout: "", stderr: "spawn failed" });
|
|
52332
|
+
});
|
|
52333
|
+
child.on("close", (code) => {
|
|
52334
|
+
clearTimeout(timer);
|
|
52335
|
+
resolve11({ code, stdout, stderr });
|
|
52336
|
+
});
|
|
52337
|
+
});
|
|
52338
|
+
const parse = (stdout) => {
|
|
52339
|
+
try {
|
|
52340
|
+
const body = JSON.parse(stdout.trim());
|
|
52341
|
+
const rows2 = Array.isArray(body.instances) ? body.instances : [];
|
|
52342
|
+
return rows2.map((raw) => {
|
|
52343
|
+
const r = raw ?? {};
|
|
52344
|
+
return {
|
|
52345
|
+
pid: typeof r.pid === "number" ? r.pid : null,
|
|
52346
|
+
version: typeof r.version === "string" ? r.version : null,
|
|
52347
|
+
addinLoaded: typeof r.addin_loaded === "boolean" ? r.addin_loaded : null
|
|
52348
|
+
};
|
|
52349
|
+
});
|
|
52350
|
+
} catch {
|
|
52351
|
+
return [];
|
|
52352
|
+
}
|
|
52353
|
+
};
|
|
52354
|
+
let out = await probe();
|
|
52355
|
+
let answered = spoke(out.stdout);
|
|
52356
|
+
let instances = parse(out.stdout);
|
|
52357
|
+
let env2;
|
|
52358
|
+
if (host === "sketchup" && instances.length === 0) {
|
|
52359
|
+
const override = sketchupDiscoveryEnv();
|
|
52360
|
+
out = await probe(override);
|
|
52361
|
+
answered = answered || spoke(out.stdout);
|
|
52362
|
+
instances = parse(out.stdout);
|
|
52363
|
+
if (instances.length > 0) env2 = override;
|
|
52364
|
+
}
|
|
52365
|
+
if (instances.length === 0) {
|
|
52366
|
+
return {
|
|
52367
|
+
ok: false,
|
|
52368
|
+
instances: [],
|
|
52369
|
+
probeFailed: !answered,
|
|
52370
|
+
error: (out.stderr || out.stdout).trim().slice(0, 400) || void 0
|
|
52371
|
+
};
|
|
52372
|
+
}
|
|
52373
|
+
return { ok: true, instances, env: env2 };
|
|
52374
|
+
}
|
|
52375
|
+
function spoke(stdout) {
|
|
52376
|
+
try {
|
|
52377
|
+
const body = JSON.parse(stdout.trim());
|
|
52378
|
+
return !!body && typeof body === "object" && Array.isArray(body.instances);
|
|
52379
|
+
} catch {
|
|
52380
|
+
return false;
|
|
52381
|
+
}
|
|
52382
|
+
}
|
|
52383
|
+
function sketchupDiscoveryEnv() {
|
|
52384
|
+
return { AWARE_SKETCHUP_DISCOVERY_DIR: (0, import_node_path6.join)(standardUserTempDir(), "aware-sketchup") };
|
|
52385
|
+
}
|
|
52293
52386
|
function resolveConnectionReaderBridge() {
|
|
52294
52387
|
const p = (0, import_node_path6.join)((0, import_node_os6.homedir)(), ".aware", "bridges", "aware-connection-reader.exe");
|
|
52295
52388
|
return (0, import_node_fs7.existsSync)(p) ? p : null;
|
|
@@ -52747,6 +52840,8 @@ var aware = {
|
|
|
52747
52840
|
},
|
|
52748
52841
|
refresh: refreshInvoker,
|
|
52749
52842
|
teklaBridgeStatus,
|
|
52843
|
+
hostBridgeStatus,
|
|
52844
|
+
hostInstances,
|
|
52750
52845
|
/** GET /api/apps */
|
|
52751
52846
|
async list() {
|
|
52752
52847
|
const { data } = await runJson(["app", "list"]);
|
|
@@ -53026,7 +53121,7 @@ var aware = {
|
|
|
53026
53121
|
const { code, stdout, stderr } = await runRaw(args, (child) => {
|
|
53027
53122
|
reg2 = { child, cancelled: false };
|
|
53028
53123
|
activeRun = reg2;
|
|
53029
|
-
});
|
|
53124
|
+
}, opts.env);
|
|
53030
53125
|
if (reg2 && reg2.cancelled) {
|
|
53031
53126
|
throw new AwareError("Run cancelled", { cancelled: true });
|
|
53032
53127
|
}
|
|
@@ -53792,7 +53887,7 @@ function appVersion() {
|
|
|
53792
53887
|
return resolveVersion({
|
|
53793
53888
|
isSea: isSea2(),
|
|
53794
53889
|
sqVersionXml: readSqVersionXml(),
|
|
53795
|
-
define: true ? "0.
|
|
53890
|
+
define: true ? "0.112.0" : void 0,
|
|
53796
53891
|
pkgVersion: readPkgVersion()
|
|
53797
53892
|
});
|
|
53798
53893
|
}
|
|
@@ -53808,7 +53903,7 @@ function resolveChannel(s) {
|
|
|
53808
53903
|
function appChannel() {
|
|
53809
53904
|
return resolveChannel({
|
|
53810
53905
|
isSea: isSea2(),
|
|
53811
|
-
define: true ? "0.
|
|
53906
|
+
define: true ? "0.112.0" : void 0,
|
|
53812
53907
|
// argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
|
|
53813
53908
|
// carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
|
|
53814
53909
|
modulePath: process.argv[1]
|
|
@@ -55117,8 +55212,11 @@ var SEC = Object.fromEntries(
|
|
|
55117
55212
|
([k, v]) => !k.startsWith("_") && Array.isArray(v)
|
|
55118
55213
|
)
|
|
55119
55214
|
);
|
|
55215
|
+
function canonicalDesignation(designation) {
|
|
55216
|
+
return (designation ?? "").trim().toUpperCase().replace(/[×✕✖]/g, "X").replace(/[‐-―−]/g, "-").replace(/[‘’ʹ′]/g, "'").replace(/[“”ʺ″]/g, '"').replace(/ /g, " ").replace(/\s+/g, "");
|
|
55217
|
+
}
|
|
55120
55218
|
function sectionDimsIn(designation) {
|
|
55121
|
-
const row = SEC[designation
|
|
55219
|
+
const row = SEC[canonicalDesignation(designation)];
|
|
55122
55220
|
return row ? { d: row[0], bf: row[1] } : void 0;
|
|
55123
55221
|
}
|
|
55124
55222
|
var SECTION_DIMS_IN = Object.fromEntries(
|
|
@@ -55135,9 +55233,9 @@ function parseDim(tok) {
|
|
|
55135
55233
|
}
|
|
55136
55234
|
function xsectionFor(profile, dims) {
|
|
55137
55235
|
const rect = { shape: "rect", w: dims.w, d: dims.d };
|
|
55138
|
-
const raw = (profile ?? "").trim().toUpperCase().replace(
|
|
55236
|
+
const raw = (profile ?? "").trim().toUpperCase().replace(/[×✕✖]/g, "X").replace(/ /g, " ");
|
|
55139
55237
|
if (!raw) return rect;
|
|
55140
|
-
const key =
|
|
55238
|
+
const key = canonicalDesignation(profile);
|
|
55141
55239
|
const m = raw.match(/^([A-Z]+)\s*(.+)$/);
|
|
55142
55240
|
if (!m) return rect;
|
|
55143
55241
|
const prefix = m[1];
|
|
@@ -59709,6 +59807,11 @@ function canonicalHash(doc) {
|
|
|
59709
59807
|
};
|
|
59710
59808
|
return (0, import_node_crypto14.createHash)("sha256").update(JSON.stringify(norm(doc))).digest("hex");
|
|
59711
59809
|
}
|
|
59810
|
+
function decisionsDigest(issues, docHash) {
|
|
59811
|
+
const decisions = issues.filter((i) => i.severity === "decision").map((i) => [i.code, i.sheet ?? null, i.path ?? null, i.message]);
|
|
59812
|
+
return (0, import_node_crypto14.createHash)("sha256").update(`${docHash}
|
|
59813
|
+
${JSON.stringify(decisions)}`).digest("hex");
|
|
59814
|
+
}
|
|
59712
59815
|
var KNOWN_READ_KINDS = /* @__PURE__ */ new Set(["steel-filter-segment"]);
|
|
59713
59816
|
function previewMigration(v1, ctx) {
|
|
59714
59817
|
const doc = isObj2(v1) ? v1 : {};
|
|
@@ -59971,7 +60074,11 @@ function previewMigration(v1, ctx) {
|
|
|
59971
60074
|
survivor: { sheet: p.survivor.sheet, id: p.survivor.v1Id },
|
|
59972
60075
|
conflicts: p.conflicts
|
|
59973
60076
|
})),
|
|
59974
|
-
pendingColMetadata: mat.pendingColMetadata
|
|
60077
|
+
pendingColMetadata: mat.pendingColMetadata,
|
|
60078
|
+
// Computed here, so preview and commit read the same field of the same function's output and there
|
|
60079
|
+
// is no second implementation to drift. `issues` is complete by this line — the last push is the
|
|
60080
|
+
// reference check above — and `ok` on the first line reads the same array.
|
|
60081
|
+
decisionsDigest: decisionsDigest(issues, contractHash(doc))
|
|
59975
60082
|
};
|
|
59976
60083
|
return { candidate: issues.some((i) => i.severity === "block") ? null : candidate, report, remap };
|
|
59977
60084
|
}
|
|
@@ -60160,6 +60267,13 @@ async function runMigration(opts) {
|
|
|
60160
60267
|
}
|
|
60161
60268
|
const { candidate, report, remap } = previewMigration(current);
|
|
60162
60269
|
if (!candidate) throw new ContractTransactionError("this contract cannot be migrated \u2014 see the preview report", "contract-not-migratable");
|
|
60270
|
+
if (report.decisionsDigest !== opts.expectDecisions) {
|
|
60271
|
+
throw new ContractTransactionError(
|
|
60272
|
+
"the decisions you confirmed are not the decisions this migration would commit \u2014 preview it again and re-confirm",
|
|
60273
|
+
"precondition-failed"
|
|
60274
|
+
);
|
|
60275
|
+
}
|
|
60276
|
+
const acknowledgedDecisions = report.issues.filter((i) => i.severity === "decision").map((i) => i.code);
|
|
60163
60277
|
const uuid = getProject(projectId)?.uuid ?? null;
|
|
60164
60278
|
const storeKey = uuid ?? (0, import_node_crypto15.randomUUID)();
|
|
60165
60279
|
const generation = lastGeneration(projectId) + 1;
|
|
@@ -60174,7 +60288,8 @@ async function runMigration(opts) {
|
|
|
60174
60288
|
from,
|
|
60175
60289
|
to: STEEL_V2,
|
|
60176
60290
|
expectContractHash: hash2,
|
|
60177
|
-
expectLedgerHead: head
|
|
60291
|
+
expectLedgerHead: head,
|
|
60292
|
+
acknowledgedDecisions
|
|
60178
60293
|
};
|
|
60179
60294
|
writePhase(dir, "000-begin", begin);
|
|
60180
60295
|
const before = {
|
|
@@ -61634,7 +61749,74 @@ var REGISTRY = /* @__PURE__ */ new Map([
|
|
|
61634
61749
|
// `continue`s on this key before `entryFor` is ever called, and that `continue` is the load-bearing
|
|
61635
61750
|
// line (removing it fails 19 tests, while changing this disposition fails none). Not `descend`, so
|
|
61636
61751
|
// the coverage test does not demand an entry per observation field.
|
|
61637
|
-
["$.plans[].memberObservations", { disposition: "auto", note: "drawing evidence, classified per observation rather than as a plan field" }]
|
|
61752
|
+
["$.plans[].memberObservations", { disposition: "auto", note: "drawing evidence, classified per observation rather than as a plan field" }],
|
|
61753
|
+
// ── the document ROOT (P7c-2) ────────────────────────────────────────────────
|
|
61754
|
+
//
|
|
61755
|
+
// THERE IS NO `$.members` OR `$.plans` ROW HERE, AND ADDING ONE WOULD BE A DISASTER. That is not a
|
|
61756
|
+
// style note — it is measured. `entryFor`'s ancestor veto matches `key + '['` as well as `key + '.'`,
|
|
61757
|
+
// so `$.members` is an ANCESTOR of `$.members[]` and of every path beneath it. A single
|
|
61758
|
+
// `['$.members', { disposition: 'issue' }]` therefore refuses `$.members[].profile`,
|
|
61759
|
+
// `$.members[].ends[].conn` and every other MEMBER field — every member proposal in the product
|
|
61760
|
+
// becomes a refusal. `$.plans` does the same to plans.
|
|
61761
|
+
//
|
|
61762
|
+
// EACH ROW VETOES ITS OWN SUBTREE AND ONLY ITS OWN, which is worth stating exactly, because the
|
|
61763
|
+
// sentence here first said one `$.members` row refuses "every member and plan field" and a review
|
|
61764
|
+
// caught it: the veto is a path-prefix rule, so `$.members` cannot reach `$.plans[]`. It takes both
|
|
61765
|
+
// rows to lose both halves — and "completing the root for consistency" is precisely the edit that
|
|
61766
|
+
// adds both at once, which is why the pair is named together.
|
|
61767
|
+
//
|
|
61768
|
+
// (Not the whole feature either way: evidence and binding updates do not go through this table and
|
|
61769
|
+
// would still flow. The damage is to the confirmable half, which is the half this unit exists for.)
|
|
61770
|
+
// Probed directly before this block was written, and pinned by a test in
|
|
61771
|
+
// `steel-revision-registry.test.ts` — one that drives EACH row separately — so the next author fails
|
|
61772
|
+
// loudly instead of shipping it.
|
|
61773
|
+
//
|
|
61774
|
+
// Those two keys need no entry anyway: the classifier's `HANDLED_ROOT` walks them through their own
|
|
61775
|
+
// loops, and the root coverage test exempts them the same way. `$.read_notes` is likewise absent —
|
|
61776
|
+
// it is revision-PRODUCED output and lives in `IGNORED_INPUT`.
|
|
61777
|
+
//
|
|
61778
|
+
// Everything else at the root is enumerated EXPLICITLY, including the refusals, for the reason the
|
|
61779
|
+
// plan block above gives: the coverage test then reads a decision rather than an omission, and the
|
|
61780
|
+
// refusal a user sees carries a `note` saying why instead of one generic sentence for 24 keys.
|
|
61781
|
+
// THE ONE ROOT FIELD A REVISION READ MAY MOVE — the parent plan's §4.3 list, finally implemented.
|
|
61782
|
+
// A revised drawing set whose printed grid moved is a canonical change to an existing model, which
|
|
61783
|
+
// is precisely what the diff-review UI exists to show. Compared WHOLE (no `descend`): you propose a
|
|
61784
|
+
// grid, not `grid.x` independently, because a partial grid is not a thing the classifier can produce
|
|
61785
|
+
// or a human can sensibly confirm.
|
|
61786
|
+
["$.grid", { disposition: "propose", note: "the one model-wide structural grid" }],
|
|
61787
|
+
// Contract identity and provenance — stamped by whatever created or migrated the model.
|
|
61788
|
+
["$.type", { disposition: "issue", note: "which contract this is, is decided when the model is created or migrated" }],
|
|
61789
|
+
["$.origin", { disposition: "issue", note: "whether the model was migrated or authored natively is a fact about its history" }],
|
|
61790
|
+
["$.migration", { disposition: "issue", note: "the v1 to v2 provenance block is written by the migration that produced it" }],
|
|
61791
|
+
["$.source", { disposition: "issue", note: "where the model was read from is stamped by the server, not asserted by the document" }],
|
|
61792
|
+
// The user's own settings and the pre-read pass's output.
|
|
61793
|
+
["$.target_confidence", { disposition: "issue", note: "the confidence target is the user's setting, not the read's to change" }],
|
|
61794
|
+
["$.filter", { disposition: "issue", note: "the layer and colour filter is written by the pre-read pass" }],
|
|
61795
|
+
["$.active", { disposition: "issue", note: "which sheet is open is the user's place in the editor" }],
|
|
61796
|
+
// Engineering structure beyond members. Refused for the same reason plan-level fields were before
|
|
61797
|
+
// P6b — revising these is a later unit's subject, and a PR that widens write authority as a side
|
|
61798
|
+
// effect of another change is how the authority this unit spent six sub-units narrowing leaks back.
|
|
61799
|
+
["$.connections", { disposition: "issue", note: "the connection library is authored in the editor, not read off a framing plan" }],
|
|
61800
|
+
["$.joints", { disposition: "issue", note: "placed connections are authored in the editor" }],
|
|
61801
|
+
["$.moment_frames", { disposition: "issue", note: "the moment-frame schedule is not among the fields a revision read stages" }],
|
|
61802
|
+
// Derived by a server-side lookup — asserting it from a document would let an AI claim work it did
|
|
61803
|
+
// not do, which is the same argument `$.plans[].autofilled` makes one level down.
|
|
61804
|
+
["$.weights", { disposition: "issue", note: "section weights are looked up from the section tables, not read off a drawing" }],
|
|
61805
|
+
// Draft-only editor and display state. Authored by a HUMAN in the editor, and a revision read has no
|
|
61806
|
+
// view on any of it.
|
|
61807
|
+
["$.palette", { disposition: "issue", note: "display colours are chosen in the editor" }],
|
|
61808
|
+
["$.profile_colors", { disposition: "issue", note: "display colours are chosen in the editor" }],
|
|
61809
|
+
["$.member_styles", { disposition: "issue", note: "line styles are chosen in the editor" }],
|
|
61810
|
+
["$.member_types", { disposition: "issue", note: "the member-type registry is authored in the editor" }],
|
|
61811
|
+
["$.views", { disposition: "issue", note: "saved views are the user's own camera bookmarks" }],
|
|
61812
|
+
["$.dims3d", { disposition: "issue", note: "3D dimensions are drawn by the user" }],
|
|
61813
|
+
["$.dim_overlays", { disposition: "issue", note: "dimension overlay toggles are editor state" }],
|
|
61814
|
+
["$.dim_style", { disposition: "issue", note: "dimension styling is editor state" }],
|
|
61815
|
+
["$.prop_labels", { disposition: "issue", note: "which properties render as chips is editor state" }],
|
|
61816
|
+
["$.detail_placements", { disposition: "issue", note: "placed details are authored in the editor" }],
|
|
61817
|
+
["$.detail_bubbles", { disposition: "issue", note: "detail bubble anchors are authored in the editor" }],
|
|
61818
|
+
["$.custom_details", { disposition: "issue", note: "user-created detail images are uploaded in the editor" }],
|
|
61819
|
+
["$.sheet_previews", { disposition: "issue", note: "sheet previews are generated from the source pages, not authored by a read" }]
|
|
61638
61820
|
]);
|
|
61639
61821
|
function entryFor(registryKey, registry2 = REGISTRY) {
|
|
61640
61822
|
const isAncestor = (key) => key !== registryKey && (registryKey.startsWith(key + ".") || registryKey.startsWith(key + "["));
|
|
@@ -61969,15 +62151,26 @@ function stageRevisionRead(current, incoming) {
|
|
|
61969
62151
|
const HANDLED_ROOT = /* @__PURE__ */ new Set(["members", "plans"]);
|
|
61970
62152
|
const curRoot = current;
|
|
61971
62153
|
const incRoot = incoming;
|
|
61972
|
-
for (const key of
|
|
62154
|
+
for (const key of [.../* @__PURE__ */ new Set([...Object.keys(curRoot), ...Object.keys(incRoot)])].sort()) {
|
|
61973
62155
|
if (HANDLED_ROOT.has(key)) continue;
|
|
61974
62156
|
if (IGNORED_INPUT.has(registryKeyOf(`$.${key}`))) continue;
|
|
61975
|
-
|
|
61976
|
-
|
|
61977
|
-
|
|
61978
|
-
"
|
|
61979
|
-
|
|
61980
|
-
|
|
62157
|
+
const entry2 = entryFor(`$.${key}`);
|
|
62158
|
+
if (!valuesDiffer(curRoot[key], incRoot[key], entry2)) continue;
|
|
62159
|
+
if (entry2?.disposition === "propose" && incRoot[key] !== void 0 && incRoot[key] !== null) {
|
|
62160
|
+
proposals.push({ kind: "model-changed", key, before: curRoot[key], after: incRoot[key] });
|
|
62161
|
+
} else if (entry2?.disposition === "propose") {
|
|
62162
|
+
add(
|
|
62163
|
+
`$.${key}`,
|
|
62164
|
+
"path-refused",
|
|
62165
|
+
`"${key}" is missing from this read, and a revision read may not remove model-level structure \u2014 omitting a key is not a request to delete it. Remove it in the editor if that is what you want.`
|
|
62166
|
+
);
|
|
62167
|
+
} else {
|
|
62168
|
+
add(
|
|
62169
|
+
`$.${key}`,
|
|
62170
|
+
"path-refused",
|
|
62171
|
+
`"${key}" is model-level structure a revision read may not change${entry2?.note ? ` \u2014 ${entry2.note}` : ""}`
|
|
62172
|
+
);
|
|
62173
|
+
}
|
|
61981
62174
|
}
|
|
61982
62175
|
return { accepted, bindingUpdates, bindingProposals, proposals, issues };
|
|
61983
62176
|
}
|
|
@@ -62080,6 +62273,20 @@ function applyStagedRevision(current, staged, selection = SELECT_NOTHING) {
|
|
|
62080
62273
|
}
|
|
62081
62274
|
break;
|
|
62082
62275
|
}
|
|
62276
|
+
case "model-changed": {
|
|
62277
|
+
if (!writableLeaf(`$.${p.key}`)) {
|
|
62278
|
+
throw new RevisionApplyError(
|
|
62279
|
+
`applyStagedRevision: "${p.key}" is not a model field a revision read may change \u2014 the staged proposal does not match the registry`
|
|
62280
|
+
);
|
|
62281
|
+
}
|
|
62282
|
+
if (p.after === void 0 || p.after === null) {
|
|
62283
|
+
throw new RevisionApplyError(
|
|
62284
|
+
`applyStagedRevision: "${p.key}" carries no value \u2014 a revision read may not remove model-level structure, and staging does not produce this`
|
|
62285
|
+
);
|
|
62286
|
+
}
|
|
62287
|
+
writeField(next, p.key, p.after);
|
|
62288
|
+
break;
|
|
62289
|
+
}
|
|
62083
62290
|
}
|
|
62084
62291
|
}
|
|
62085
62292
|
const bySheet = /* @__PURE__ */ new Map();
|
|
@@ -64057,7 +64264,7 @@ function sceneRelationships(scene) {
|
|
|
64057
64264
|
return { boltParentById, gridParentById, gridChildrenByParent, trimmedGridIds, teklaOmittableMeshIds };
|
|
64058
64265
|
}
|
|
64059
64266
|
function sinkKind(sink, canonicalKind) {
|
|
64060
|
-
if (sink === "tekla") {
|
|
64267
|
+
if (sink === "tekla" || sink === "host-members") {
|
|
64061
64268
|
if (canonicalKind === "plate-hole" || canonicalKind === "bolt-hole-effect") return "opening";
|
|
64062
64269
|
return canonicalKind;
|
|
64063
64270
|
}
|
|
@@ -64075,6 +64282,15 @@ function validateProducerUnsupported(row) {
|
|
|
64075
64282
|
}
|
|
64076
64283
|
}
|
|
64077
64284
|
function validateSinkUnsupported(sink, unsupported, relationships) {
|
|
64285
|
+
if (sink === "host-members") {
|
|
64286
|
+
const member = unsupported.find((row) => row.kind === "member");
|
|
64287
|
+
if (member) {
|
|
64288
|
+
throw new ReceiptReconciliationError(
|
|
64289
|
+
`member "${member.id}" came back unsupported ("${String(member.code)}") \u2014 a dragged member must be built or fail, never silently skipped.`
|
|
64290
|
+
);
|
|
64291
|
+
}
|
|
64292
|
+
return;
|
|
64293
|
+
}
|
|
64078
64294
|
if (sink === "ifc") {
|
|
64079
64295
|
if (unsupported.length > 0) {
|
|
64080
64296
|
throw new ReceiptReconciliationError(
|
|
@@ -64194,10 +64410,11 @@ function reconcileReceipt(sceneInput, rawReceipt, producerUnsupported = [], sink
|
|
|
64194
64410
|
}
|
|
64195
64411
|
const missing = [...expected.keys()].filter((id) => !seen.has(id));
|
|
64196
64412
|
if (missing.length) throw new ReceiptReconciliationError(`receipt omitted ${missing.length} scene record(s): ${missing.slice(0, 5).join(", ")}`);
|
|
64197
|
-
|
|
64413
|
+
const identityRequired = sink === "tekla" || sink === "host-members";
|
|
64414
|
+
if (identityRequired || receipt.sourceId !== void 0) {
|
|
64198
64415
|
if (receipt.sourceId !== meta.sourceId) throw new ReceiptReconciliationError("receipt sourceId does not match the exported scene.");
|
|
64199
64416
|
}
|
|
64200
|
-
if (
|
|
64417
|
+
if (identityRequired || receipt.sceneHash !== void 0) {
|
|
64201
64418
|
if (receipt.sceneHash !== meta.sceneHash) throw new ReceiptReconciliationError("receipt sceneHash does not match the exported scene.");
|
|
64202
64419
|
}
|
|
64203
64420
|
if (receipt.ok !== true || failed.length) {
|
|
@@ -64241,6 +64458,9 @@ function reconcileReceipt(sceneInput, rawReceipt, producerUnsupported = [], sink
|
|
|
64241
64458
|
function reconcileExportReceipt(sceneInput, rawReceipt, producerUnsupported = []) {
|
|
64242
64459
|
return reconcileReceipt(sceneInput, rawReceipt, producerUnsupported, "tekla");
|
|
64243
64460
|
}
|
|
64461
|
+
function reconcileHostExportReceipt(sceneInput, rawReceipt, producerUnsupported = []) {
|
|
64462
|
+
return reconcileReceipt(sceneInput, rawReceipt, producerUnsupported, "host-members");
|
|
64463
|
+
}
|
|
64244
64464
|
function reconcileIfcExportReceipt(sceneInput, rawReceipt, producerUnsupported = [], artifact) {
|
|
64245
64465
|
const receipt = reconcileReceipt(sceneInput, rawReceipt, producerUnsupported, "ifc");
|
|
64246
64466
|
checkIfcArtifact(sceneInput, record(rawReceipt, "receipt"), receipt.emitted, artifact.index, artifact.bytes);
|
|
@@ -64317,7 +64537,7 @@ function foldedWeight(weights, profile) {
|
|
|
64317
64537
|
}
|
|
64318
64538
|
function profileDimsIn(profile) {
|
|
64319
64539
|
if (!profile) return null;
|
|
64320
|
-
const p = profile.trim().toUpperCase().replace(
|
|
64540
|
+
const p = profile.trim().toUpperCase().replace(/[×✕✖]/g, "X").replace(/ /g, " ");
|
|
64321
64541
|
if (p === "" || /(^|[^A-Z])MF($|[^A-Z])/.test(p)) return null;
|
|
64322
64542
|
const m = p.match(/^([A-Z]+)\s*(.+)$/);
|
|
64323
64543
|
if (!m) return null;
|
|
@@ -64359,13 +64579,13 @@ function dispToMm(pt, ptPerFt) {
|
|
|
64359
64579
|
return [pt[0] * k, -pt[1] * k];
|
|
64360
64580
|
}
|
|
64361
64581
|
function inferMaterial(profile) {
|
|
64362
|
-
const P = profile
|
|
64582
|
+
const P = canonicalDesignation(profile);
|
|
64363
64583
|
if (P.startsWith("HSS")) return "A500-GR.B";
|
|
64364
64584
|
if (/^W\d/.test(P)) return "A992";
|
|
64365
64585
|
return "A36";
|
|
64366
64586
|
}
|
|
64367
64587
|
function teklaClassFor(profile, role) {
|
|
64368
|
-
const P = profile
|
|
64588
|
+
const P = canonicalDesignation(profile);
|
|
64369
64589
|
if (/^L\d/.test(P)) return "7";
|
|
64370
64590
|
if (/^M?C\d/.test(P)) return "8";
|
|
64371
64591
|
const isHSS = P.startsWith("HSS");
|
|
@@ -65887,7 +66107,7 @@ var DATUM_ON_V2 = `A ${STEEL_V2} model has no root \`datum\`: v1's chose which g
|
|
|
65887
66107
|
var PLAN_KEYS_V1 = ["grid", "datum_at", "datum_ref", "control2_at", "control2_ref", "elevation_in"];
|
|
65888
66108
|
var PLAN_KEYS_V2 = ["datum_at", "datum_ref", "control2_at", "control2_ref", "elevation_in"];
|
|
65889
66109
|
var planKeysFor = (declared) => declared === STEEL_V2 ? PLAN_KEYS_V2 : PLAN_KEYS_V1;
|
|
65890
|
-
var NOT_WRITABLE_FROM_A_READ = "The model grid is not writable from a read: a human moves it in the editor's Grid panel, and a grid
|
|
66110
|
+
var NOT_WRITABLE_FROM_A_READ = "The model grid is not writable from a read: a human moves it in the editor's Grid panel, and a revision read that finds the grid moved stages it as a proposal for them to accept.";
|
|
65891
66111
|
var GRID_ON_V2 = `A ${STEEL_V2} model keeps ONE grid for the whole model rather than one per sheet, so a sheet's \`grid\` has nowhere to go. ` + NOT_WRITABLE_FROM_A_READ;
|
|
65892
66112
|
var GRID_AT_ROOT_ON_V2 = `A ${STEEL_V2} model does keep its grid at the root, but it is canonical model structure rather than a pre-read block. ` + NOT_WRITABLE_FROM_A_READ;
|
|
65893
66113
|
var isObj5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -66668,7 +66888,8 @@ function registerMigrationPreviewRoute(app, deps) {
|
|
|
66668
66888
|
if (bad) return reply.status(404).send({ ok: false, error: bad });
|
|
66669
66889
|
}
|
|
66670
66890
|
const body = isObj2(req.body) ? req.body : null;
|
|
66671
|
-
const
|
|
66891
|
+
const posted = !!(body && "contract" in body);
|
|
66892
|
+
const doc = posted ? body.contract : project ? deps.readContract(req.params.appId, project) : deps.readContractForApp(req.params.appId);
|
|
66672
66893
|
if (doc == null) return reply.status(404).send({ ok: false, error: "no contract to migrate" });
|
|
66673
66894
|
const v = validateSteelTakeoff(doc);
|
|
66674
66895
|
if (!v.valid) {
|
|
@@ -66677,7 +66898,15 @@ function registerMigrationPreviewRoute(app, deps) {
|
|
|
66677
66898
|
}
|
|
66678
66899
|
const { candidate, report, remap } = previewMigration(doc);
|
|
66679
66900
|
const slim = candidate ? stripConfidentialImages(candidate) : null;
|
|
66680
|
-
|
|
66901
|
+
const shown = { ...report, rastersOmitted: true };
|
|
66902
|
+
if (posted) delete shown.decisionsDigest;
|
|
66903
|
+
return reply.send({
|
|
66904
|
+
ok: report.ok,
|
|
66905
|
+
candidate: slim,
|
|
66906
|
+
previewOf: posted ? "posted" : "stored",
|
|
66907
|
+
report: shown,
|
|
66908
|
+
remap
|
|
66909
|
+
});
|
|
66681
66910
|
}
|
|
66682
66911
|
);
|
|
66683
66912
|
}
|
|
@@ -66734,6 +66963,14 @@ function registerMigrationCommitRoute(app, deps) {
|
|
|
66734
66963
|
code: "precondition-required"
|
|
66735
66964
|
});
|
|
66736
66965
|
}
|
|
66966
|
+
const decisions = req.body?.acknowledgeDecisions;
|
|
66967
|
+
if (typeof decisions !== "string" || !decisions) {
|
|
66968
|
+
return reply.status(428).send({
|
|
66969
|
+
ok: false,
|
|
66970
|
+
error: "a migration must name the decisions you confirmed: send `acknowledgeDecisions: <the decisionsDigest from the preview>`",
|
|
66971
|
+
code: "precondition-required"
|
|
66972
|
+
});
|
|
66973
|
+
}
|
|
66737
66974
|
try {
|
|
66738
66975
|
const res = await runMigration({
|
|
66739
66976
|
appId: req.params.appId,
|
|
@@ -66741,8 +66978,10 @@ function registerMigrationCommitRoute(app, deps) {
|
|
|
66741
66978
|
// Unquoted, because `etagOf` quotes per HTTP while `contractHash` does not. Comparing the two
|
|
66742
66979
|
// spellings would refuse every correct precondition.
|
|
66743
66980
|
expectContractHash: tag.replace(/^"|"$/g, ""),
|
|
66744
|
-
expectLedgerHead: head
|
|
66981
|
+
expectLedgerHead: head,
|
|
66982
|
+
expectDecisions: decisions
|
|
66745
66983
|
});
|
|
66984
|
+
deps.broadcast({ type: "contract-changed", appId: req.params.appId, project });
|
|
66746
66985
|
return reply.send(res);
|
|
66747
66986
|
} catch (e) {
|
|
66748
66987
|
if (e instanceof RecoveryPendingError) {
|
|
@@ -71557,6 +71796,71 @@ function writeViewer3dApp(dir, appId, scene) {
|
|
|
71557
71796
|
bakeSceneIntoApp(flo, scene);
|
|
71558
71797
|
return flo;
|
|
71559
71798
|
}
|
|
71799
|
+
function writeRevitApp(dir, appId, scene, hostPid, revitVersion = "2026") {
|
|
71800
|
+
(0, import_node_fs35.mkdirSync)(dir, { recursive: true });
|
|
71801
|
+
const flo = (0, import_node_path31.join)(dir, `${appId}.flo`);
|
|
71802
|
+
(0, import_node_fs35.writeFileSync)(flo, [
|
|
71803
|
+
`app: ${appId}`,
|
|
71804
|
+
"version: 0.1.0",
|
|
71805
|
+
"display-name: Steel to Revit",
|
|
71806
|
+
"description: Native Revit elements created from an approved steel.takeoff/v1 contract (a companion bake; the contract is the source of truth). Needs Revit open with a document.",
|
|
71807
|
+
"exposes-as-agent: false",
|
|
71808
|
+
"requires:",
|
|
71809
|
+
" - revit-2026@0.1.x",
|
|
71810
|
+
"layout: linear",
|
|
71811
|
+
"nodes:",
|
|
71812
|
+
" - id: bake-revit",
|
|
71813
|
+
" agent: revit-2026",
|
|
71814
|
+
" command: bake-scene",
|
|
71815
|
+
" mode: write",
|
|
71816
|
+
" safety:",
|
|
71817
|
+
" snapshot: true",
|
|
71818
|
+
// the bake is one Revit Transaction, so one Undo reverts it
|
|
71819
|
+
" config:",
|
|
71820
|
+
` version: ${JSON.stringify(revitVersion)}`,
|
|
71821
|
+
// The PID of the Revit window the user actually released over. Without it the bridge picks
|
|
71822
|
+
// among matching sessions itself, so with two Revit 2026 windows open a drag aimed at one
|
|
71823
|
+
// could materialize in the other — the members appear, just not where the user pointed. The
|
|
71824
|
+
// whole gesture is "it goes where you dropped it", so the target has to travel with the bake.
|
|
71825
|
+
...hostPid != null && Number.isInteger(hostPid) && hostPid > 0 ? [` host_pid: ${hostPid}`] : [],
|
|
71826
|
+
// Deliberately NO `label`: Tekla's bake announces itself in the status bar, but Revit has no
|
|
71827
|
+
// status bar and its TaskDialog is modal — an announcement would block the bake it announces.
|
|
71828
|
+
// The UI toast carries the feedback instead.
|
|
71829
|
+
" scene: {}",
|
|
71830
|
+
""
|
|
71831
|
+
].join("\n"));
|
|
71832
|
+
bakeSceneIntoApp(flo, scene, "revit-2026");
|
|
71833
|
+
return flo;
|
|
71834
|
+
}
|
|
71835
|
+
function writeSketchupApp(dir, appId, scene) {
|
|
71836
|
+
(0, import_node_fs35.mkdirSync)(dir, { recursive: true });
|
|
71837
|
+
const flo = (0, import_node_path31.join)(dir, `${appId}.flo`);
|
|
71838
|
+
(0, import_node_fs35.writeFileSync)(flo, [
|
|
71839
|
+
`app: ${appId}`,
|
|
71840
|
+
"version: 0.1.0",
|
|
71841
|
+
"display-name: Steel to SketchUp",
|
|
71842
|
+
"description: Native SketchUp groups created from an approved steel.takeoff/v1 contract (a companion bake; the contract is the source of truth). Needs SketchUp open with the AWARE bridge loaded.",
|
|
71843
|
+
"exposes-as-agent: false",
|
|
71844
|
+
"requires:",
|
|
71845
|
+
" - sketchup-2026@0.1.x",
|
|
71846
|
+
"layout: linear",
|
|
71847
|
+
"nodes:",
|
|
71848
|
+
" - id: bake-sketchup",
|
|
71849
|
+
" agent: sketchup-2026",
|
|
71850
|
+
" command: bake-scene",
|
|
71851
|
+
" mode: write",
|
|
71852
|
+
" safety:",
|
|
71853
|
+
" snapshot: true",
|
|
71854
|
+
// the bake is one start_operation, so one SketchUp Undo reverts it
|
|
71855
|
+
" config:",
|
|
71856
|
+
" label: FloLess",
|
|
71857
|
+
// SketchUp DOES have a status bar, so the bake can say who is writing
|
|
71858
|
+
" scene: {}",
|
|
71859
|
+
""
|
|
71860
|
+
].join("\n"));
|
|
71861
|
+
bakeSceneIntoApp(flo, scene, "sketchup-2026");
|
|
71862
|
+
return flo;
|
|
71863
|
+
}
|
|
71560
71864
|
function writeTeklaApp(dir, appId, scene, teklaVersion = "2026.0") {
|
|
71561
71865
|
(0, import_node_fs35.mkdirSync)(dir, { recursive: true });
|
|
71562
71866
|
const flo = (0, import_node_path31.join)(dir, `${appId}.flo`);
|
|
@@ -72428,6 +72732,408 @@ async function teklaReadiness(deps = DEFAULT_DEPS) {
|
|
|
72428
72732
|
}
|
|
72429
72733
|
}
|
|
72430
72734
|
|
|
72735
|
+
// host-window.ts
|
|
72736
|
+
var import_node_child_process6 = require("node:child_process");
|
|
72737
|
+
var HOST_PROCESS_NAMES = {
|
|
72738
|
+
teklastructures: "tekla",
|
|
72739
|
+
revit: "revit",
|
|
72740
|
+
sketchup: "sketchup"
|
|
72741
|
+
};
|
|
72742
|
+
var DEFAULT_DEPS2 = {
|
|
72743
|
+
runPowerShell: (script) => new Promise((resolve11, reject) => {
|
|
72744
|
+
(0, import_node_child_process6.execFile)(
|
|
72745
|
+
"powershell.exe",
|
|
72746
|
+
["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", script],
|
|
72747
|
+
{ encoding: "utf8", windowsHide: true, timeout: 5e3, maxBuffer: 1 << 20 },
|
|
72748
|
+
(error, stdout) => error ? reject(error) : resolve11(stdout)
|
|
72749
|
+
);
|
|
72750
|
+
}),
|
|
72751
|
+
platform: process.platform
|
|
72752
|
+
};
|
|
72753
|
+
function probeScript(x, y) {
|
|
72754
|
+
return `
|
|
72755
|
+
$ErrorActionPreference = 'Stop'
|
|
72756
|
+
Add-Type -TypeDefinition @'
|
|
72757
|
+
using System;
|
|
72758
|
+
using System.Runtime.InteropServices;
|
|
72759
|
+
public static class AwareHitTest {
|
|
72760
|
+
[StructLayout(LayoutKind.Sequential)] public struct POINT { public int X; public int Y; }
|
|
72761
|
+
[DllImport("user32.dll")] public static extern IntPtr WindowFromPoint(POINT p);
|
|
72762
|
+
[DllImport("user32.dll")] public static extern IntPtr GetAncestor(IntPtr hwnd, uint flags);
|
|
72763
|
+
[DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr hwnd, out uint pid);
|
|
72764
|
+
[DllImport("user32.dll")] public static extern bool SetProcessDPIAware();
|
|
72765
|
+
}
|
|
72766
|
+
'@
|
|
72767
|
+
[void][AwareHitTest]::SetProcessDPIAware()
|
|
72768
|
+
$pt = New-Object 'AwareHitTest+POINT'
|
|
72769
|
+
$pt.X = ${x}
|
|
72770
|
+
$pt.Y = ${y}
|
|
72771
|
+
$h = [AwareHitTest]::WindowFromPoint($pt)
|
|
72772
|
+
if ($h -eq [IntPtr]::Zero) { Write-Output '{"pid":null,"name":null}'; exit 0 }
|
|
72773
|
+
$root = [AwareHitTest]::GetAncestor($h, 2)
|
|
72774
|
+
if ($root -eq [IntPtr]::Zero) { $root = $h }
|
|
72775
|
+
[uint32]$owner = 0
|
|
72776
|
+
[void][AwareHitTest]::GetWindowThreadProcessId($root, [ref]$owner)
|
|
72777
|
+
if ($owner -eq 0) { Write-Output '{"pid":null,"name":null}'; exit 0 }
|
|
72778
|
+
$proc = Get-Process -Id $owner -ErrorAction SilentlyContinue
|
|
72779
|
+
$name = if ($proc) { $proc.ProcessName } else { $null }
|
|
72780
|
+
[Console]::Out.Write((ConvertTo-Json -Compress ([ordered]@{ pid = $owner; name = $name })))
|
|
72781
|
+
`.trim();
|
|
72782
|
+
}
|
|
72783
|
+
function candidatePoints(cssX, cssY, dpr) {
|
|
72784
|
+
const ratio = Number.isFinite(dpr) && dpr > 0 ? dpr : 1;
|
|
72785
|
+
const scaled = [Math.round(cssX * ratio), Math.round(cssY * ratio)];
|
|
72786
|
+
const raw = [Math.round(cssX), Math.round(cssY)];
|
|
72787
|
+
if (scaled[0] === raw[0] && scaled[1] === raw[1]) return [scaled];
|
|
72788
|
+
return [scaled, raw];
|
|
72789
|
+
}
|
|
72790
|
+
function hostForProcessName(processName) {
|
|
72791
|
+
if (!processName) return null;
|
|
72792
|
+
return HOST_PROCESS_NAMES[processName.trim().toLowerCase().replace(/\.exe$/, "")] ?? null;
|
|
72793
|
+
}
|
|
72794
|
+
async function hostAtScreenPoint(x, y, deps = DEFAULT_DEPS2) {
|
|
72795
|
+
const miss = { probed: false, host: null, processName: null, pid: null };
|
|
72796
|
+
if (deps.platform !== "win32") return miss;
|
|
72797
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) return miss;
|
|
72798
|
+
const px = Math.round(x);
|
|
72799
|
+
const py = Math.round(y);
|
|
72800
|
+
if (!Number.isSafeInteger(px) || !Number.isSafeInteger(py)) return miss;
|
|
72801
|
+
let stdout;
|
|
72802
|
+
try {
|
|
72803
|
+
stdout = await deps.runPowerShell(probeScript(px, py));
|
|
72804
|
+
} catch {
|
|
72805
|
+
return miss;
|
|
72806
|
+
}
|
|
72807
|
+
let parsed;
|
|
72808
|
+
try {
|
|
72809
|
+
parsed = JSON.parse(stdout.trim());
|
|
72810
|
+
} catch {
|
|
72811
|
+
return miss;
|
|
72812
|
+
}
|
|
72813
|
+
if (!parsed || typeof parsed !== "object") return miss;
|
|
72814
|
+
const row = parsed;
|
|
72815
|
+
if (!("pid" in row)) return miss;
|
|
72816
|
+
const pid = typeof row.pid === "number" && Number.isFinite(row.pid) ? row.pid : null;
|
|
72817
|
+
const processName = typeof row.name === "string" && row.name.trim() ? row.name.trim() : null;
|
|
72818
|
+
return { probed: true, host: hostForProcessName(processName), processName, pid };
|
|
72819
|
+
}
|
|
72820
|
+
async function hostWindowRects(deps = DEFAULT_DEPS2) {
|
|
72821
|
+
if (deps.platform !== "win32") return [];
|
|
72822
|
+
let stdout;
|
|
72823
|
+
try {
|
|
72824
|
+
stdout = await deps.runPowerShell(HOST_RECTS_SCRIPT);
|
|
72825
|
+
} catch {
|
|
72826
|
+
return [];
|
|
72827
|
+
}
|
|
72828
|
+
let parsed;
|
|
72829
|
+
try {
|
|
72830
|
+
parsed = JSON.parse(stdout.trim() || "[]");
|
|
72831
|
+
} catch {
|
|
72832
|
+
return [];
|
|
72833
|
+
}
|
|
72834
|
+
const rows2 = Array.isArray(parsed) ? parsed : parsed && typeof parsed === "object" ? [parsed] : [];
|
|
72835
|
+
const out = [];
|
|
72836
|
+
for (const raw of rows2) {
|
|
72837
|
+
if (!raw || typeof raw !== "object") continue;
|
|
72838
|
+
const row = raw;
|
|
72839
|
+
const nums = ["pid", "left", "top", "right", "bottom"].map(
|
|
72840
|
+
(k) => typeof row[k] === "number" && Number.isFinite(row[k]) ? row[k] : null
|
|
72841
|
+
);
|
|
72842
|
+
if (nums.some((n) => n === null)) continue;
|
|
72843
|
+
const [pid, left, top, right, bottom] = nums;
|
|
72844
|
+
if (right <= left || bottom <= top) continue;
|
|
72845
|
+
const host = hostForProcessName(typeof row.name === "string" ? row.name : null);
|
|
72846
|
+
out.push(host ? { host, pid, left, top, right, bottom } : { host: null, left, top, right, bottom });
|
|
72847
|
+
}
|
|
72848
|
+
return out;
|
|
72849
|
+
}
|
|
72850
|
+
var HOST_RECTS_SCRIPT = `
|
|
72851
|
+
$ErrorActionPreference = 'Stop'
|
|
72852
|
+
Add-Type -TypeDefinition @'
|
|
72853
|
+
using System;
|
|
72854
|
+
using System.Collections.Generic;
|
|
72855
|
+
using System.Runtime.InteropServices;
|
|
72856
|
+
public static class AwareHostRects {
|
|
72857
|
+
[StructLayout(LayoutKind.Sequential)] public struct RECT { public int L, T, R, B; }
|
|
72858
|
+
public delegate bool EnumProc(IntPtr hwnd, IntPtr param);
|
|
72859
|
+
[DllImport("user32.dll")] public static extern bool EnumWindows(EnumProc cb, IntPtr param);
|
|
72860
|
+
[DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr hwnd);
|
|
72861
|
+
[DllImport("user32.dll")] public static extern bool IsIconic(IntPtr hwnd);
|
|
72862
|
+
[DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr hwnd, out RECT r);
|
|
72863
|
+
[DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr hwnd, out uint pid);
|
|
72864
|
+
[DllImport("user32.dll")] public static extern bool SetProcessDPIAware();
|
|
72865
|
+
public static List<int[]> Collect() {
|
|
72866
|
+
var rows = new List<int[]>();
|
|
72867
|
+
EnumWindows(delegate(IntPtr h, IntPtr p) {
|
|
72868
|
+
if (!IsWindowVisible(h) || IsIconic(h)) return true;
|
|
72869
|
+
RECT r;
|
|
72870
|
+
if (!GetWindowRect(h, out r)) return true;
|
|
72871
|
+
if (r.R <= r.L || r.B <= r.T) return true;
|
|
72872
|
+
uint owner; GetWindowThreadProcessId(h, out owner);
|
|
72873
|
+
if (owner == 0) return true;
|
|
72874
|
+
rows.Add(new int[] { (int)owner, r.L, r.T, r.R, r.B });
|
|
72875
|
+
return true;
|
|
72876
|
+
}, IntPtr.Zero);
|
|
72877
|
+
return rows;
|
|
72878
|
+
}
|
|
72879
|
+
}
|
|
72880
|
+
'@
|
|
72881
|
+
[void][AwareHostRects]::SetProcessDPIAware()
|
|
72882
|
+
# EVERY visible window is kept. De-duplicating by owning PROCESS would drop a second Chrome or
|
|
72883
|
+
# Explorer window from the stack, and if that omitted window covers Revit the badge would promise a
|
|
72884
|
+
# drop the authoritative hit-test then refuses. Only the pid->name lookup is cached.
|
|
72885
|
+
$names = @{}
|
|
72886
|
+
$out = New-Object System.Collections.ArrayList
|
|
72887
|
+
foreach ($row in [AwareHostRects]::Collect()) {
|
|
72888
|
+
$owner = $row[0]
|
|
72889
|
+
if (-not $names.ContainsKey($owner)) {
|
|
72890
|
+
$proc = Get-Process -Id $owner -ErrorAction SilentlyContinue
|
|
72891
|
+
$names[$owner] = if ($proc) { $proc.ProcessName } else { $null }
|
|
72892
|
+
}
|
|
72893
|
+
if (-not $names[$owner]) { continue }
|
|
72894
|
+
[void]$out.Add([ordered]@{ pid = $owner; name = $names[$owner]; left = $row[1]; top = $row[2]; right = $row[3]; bottom = $row[4] })
|
|
72895
|
+
}
|
|
72896
|
+
[Console]::Out.Write((ConvertTo-Json -Compress @($out)))
|
|
72897
|
+
`.trim();
|
|
72898
|
+
async function runningKnownHosts(deps = DEFAULT_DEPS2) {
|
|
72899
|
+
if (deps.platform !== "win32") return [];
|
|
72900
|
+
let stdout;
|
|
72901
|
+
try {
|
|
72902
|
+
stdout = await deps.runPowerShell(
|
|
72903
|
+
"[Console]::Out.Write((Get-Process -ErrorAction SilentlyContinue | Select-Object -ExpandProperty ProcessName | ConvertTo-Json -Compress))"
|
|
72904
|
+
);
|
|
72905
|
+
} catch {
|
|
72906
|
+
return [];
|
|
72907
|
+
}
|
|
72908
|
+
let names;
|
|
72909
|
+
try {
|
|
72910
|
+
names = JSON.parse(stdout.trim() || "[]");
|
|
72911
|
+
} catch {
|
|
72912
|
+
return [];
|
|
72913
|
+
}
|
|
72914
|
+
const list = Array.isArray(names) ? names : typeof names === "string" ? [names] : [];
|
|
72915
|
+
const found = /* @__PURE__ */ new Set();
|
|
72916
|
+
for (const raw of list) {
|
|
72917
|
+
const host = hostForProcessName(typeof raw === "string" ? raw : null);
|
|
72918
|
+
if (host) found.add(host);
|
|
72919
|
+
}
|
|
72920
|
+
return [...found];
|
|
72921
|
+
}
|
|
72922
|
+
async function resolveHostAtPoint(cssX, cssY, dpr, probe) {
|
|
72923
|
+
let hit = { probed: false, host: null, processName: null, pid: null };
|
|
72924
|
+
for (const [px, py] of candidatePoints(cssX, cssY, dpr)) {
|
|
72925
|
+
hit = await probe(px, py);
|
|
72926
|
+
if (hit.probed) break;
|
|
72927
|
+
}
|
|
72928
|
+
return hit;
|
|
72929
|
+
}
|
|
72930
|
+
|
|
72931
|
+
// host-readiness.ts
|
|
72932
|
+
var HOST_BAKE_AWARE_FLOOR = "0.104.0";
|
|
72933
|
+
var SUPPORTED_REVIT_VERSIONS = /* @__PURE__ */ new Set(["2026"]);
|
|
72934
|
+
var HOST_LABELS = {
|
|
72935
|
+
tekla: "Tekla Structures",
|
|
72936
|
+
revit: "Revit",
|
|
72937
|
+
sketchup: "SketchUp"
|
|
72938
|
+
};
|
|
72939
|
+
var DEFAULT_DEPS3 = {
|
|
72940
|
+
npmVersion: () => aware.npmVersion(),
|
|
72941
|
+
bridgeStatus: (host) => aware.hostBridgeStatus(host),
|
|
72942
|
+
instances: (host) => aware.hostInstances(host),
|
|
72943
|
+
runningHosts: () => runningKnownHosts()
|
|
72944
|
+
};
|
|
72945
|
+
async function hostReadiness(host, deps = DEFAULT_DEPS3, targetPid) {
|
|
72946
|
+
const label2 = HOST_LABELS[host];
|
|
72947
|
+
const awareVersion = deps.npmVersion();
|
|
72948
|
+
const awareCurrent = !!awareVersion && compareSemver(awareVersion, HOST_BAKE_AWARE_FLOOR) >= 0;
|
|
72949
|
+
const bridge = deps.bridgeStatus(host);
|
|
72950
|
+
const bridgeCurrent = !!bridge.path && bridge.version === awareVersion;
|
|
72951
|
+
const base = {
|
|
72952
|
+
host,
|
|
72953
|
+
aware: { version: awareVersion, floor: HOST_BAKE_AWARE_FLOOR, current: awareCurrent },
|
|
72954
|
+
bridge: { present: !!bridge.path, version: bridge.version, current: bridgeCurrent },
|
|
72955
|
+
session: { open: false, version: null, pid: null }
|
|
72956
|
+
};
|
|
72957
|
+
if (!awareCurrent) {
|
|
72958
|
+
return {
|
|
72959
|
+
...base,
|
|
72960
|
+
ok: false,
|
|
72961
|
+
state: "aware-update-required",
|
|
72962
|
+
message: `Couldn\u2019t send \u2014 this needs AWARE ${HOST_BAKE_AWARE_FLOOR} or newer. Update it, then try again.`,
|
|
72963
|
+
recovery: { action: "update-aware", label: "Update AWARE" }
|
|
72964
|
+
};
|
|
72965
|
+
}
|
|
72966
|
+
if (!bridge.path) {
|
|
72967
|
+
return {
|
|
72968
|
+
...base,
|
|
72969
|
+
ok: false,
|
|
72970
|
+
state: "bridge-missing",
|
|
72971
|
+
message: `Couldn\u2019t send \u2014 the connection to ${label2} isn\u2019t installed yet. Install it, then try again.`,
|
|
72972
|
+
recovery: { action: "install-bridge", label: `Install ${label2} bridge` }
|
|
72973
|
+
};
|
|
72974
|
+
}
|
|
72975
|
+
if (!bridgeCurrent) {
|
|
72976
|
+
return {
|
|
72977
|
+
...base,
|
|
72978
|
+
ok: false,
|
|
72979
|
+
state: "bridge-update-required",
|
|
72980
|
+
message: `Couldn\u2019t send \u2014 the connection to ${label2} is stale (${bridge.version || "unversioned"}, needs ${awareVersion}). Update it, then try again.`,
|
|
72981
|
+
recovery: { action: "install-bridge", label: `Update ${label2} bridge` }
|
|
72982
|
+
};
|
|
72983
|
+
}
|
|
72984
|
+
let probe;
|
|
72985
|
+
try {
|
|
72986
|
+
probe = await deps.instances(host);
|
|
72987
|
+
} catch (error) {
|
|
72988
|
+
return {
|
|
72989
|
+
...base,
|
|
72990
|
+
ok: false,
|
|
72991
|
+
state: "error",
|
|
72992
|
+
message: error instanceof Error ? error.message : `Couldn\u2019t check whether ${label2} is ready.`,
|
|
72993
|
+
recovery: { action: "retry", label: "Check again" }
|
|
72994
|
+
};
|
|
72995
|
+
}
|
|
72996
|
+
const session = targetPid != null ? probe.instances.find((i) => i.pid === targetPid) : probe.instances[0];
|
|
72997
|
+
if (probe.probeFailed) {
|
|
72998
|
+
return {
|
|
72999
|
+
...base,
|
|
73000
|
+
ok: false,
|
|
73001
|
+
state: "error",
|
|
73002
|
+
message: `Couldn\u2019t send \u2014 the ${label2} connection isn\u2019t responding${probe.error ? ` (${probe.error.slice(0, 120)})` : ""}. Try again, and reinstall the ${label2} bridge if it keeps happening.`,
|
|
73003
|
+
recovery: { action: "retry", label: "Check again" }
|
|
73004
|
+
};
|
|
73005
|
+
}
|
|
73006
|
+
if (targetPid != null && !session) {
|
|
73007
|
+
return {
|
|
73008
|
+
...base,
|
|
73009
|
+
ok: false,
|
|
73010
|
+
state: "host-closed",
|
|
73011
|
+
message: probe.instances.length ? `Couldn\u2019t send \u2014 that ${label2} window isn\u2019t open any more. Try the drag again.` : `Couldn\u2019t send \u2014 ${label2} isn\u2019t open. Start it and try again.`,
|
|
73012
|
+
recovery: probe.instances.length ? { action: "retry", label: "Check again" } : { action: "open-host", label: `Open ${label2}` }
|
|
73013
|
+
};
|
|
73014
|
+
}
|
|
73015
|
+
if (!probe.ok || !session) {
|
|
73016
|
+
let alsoRunning = [];
|
|
73017
|
+
try {
|
|
73018
|
+
alsoRunning = await deps.runningHosts();
|
|
73019
|
+
} catch {
|
|
73020
|
+
}
|
|
73021
|
+
if (alsoRunning.includes(host)) {
|
|
73022
|
+
return {
|
|
73023
|
+
...base,
|
|
73024
|
+
ok: false,
|
|
73025
|
+
state: "error",
|
|
73026
|
+
message: `Couldn\u2019t send \u2014 ${label2} is running, but FloLess can\u2019t reach it. Restart ${label2} so its FloLess connection reloads, then try again.`,
|
|
73027
|
+
recovery: { action: "retry", label: "Check again" }
|
|
73028
|
+
};
|
|
73029
|
+
}
|
|
73030
|
+
return {
|
|
73031
|
+
...base,
|
|
73032
|
+
ok: false,
|
|
73033
|
+
state: "host-closed",
|
|
73034
|
+
message: `Couldn\u2019t send \u2014 ${label2} isn\u2019t open. Start it and try again.`,
|
|
73035
|
+
recovery: { action: "open-host", label: `Open ${label2}` }
|
|
73036
|
+
};
|
|
73037
|
+
}
|
|
73038
|
+
const found = { open: true, version: session.version, pid: session.pid };
|
|
73039
|
+
if (targetPid == null && probe.instances.length > 1) {
|
|
73040
|
+
return {
|
|
73041
|
+
...base,
|
|
73042
|
+
ok: false,
|
|
73043
|
+
state: "ambiguous-session",
|
|
73044
|
+
message: `Couldn\u2019t send \u2014 ${probe.instances.length} ${label2} windows are open and there\u2019s no way to tell which model you meant. Close all but one, or drag the members onto the window you want.`,
|
|
73045
|
+
recovery: { action: "retry", label: "Check again" }
|
|
73046
|
+
};
|
|
73047
|
+
}
|
|
73048
|
+
if (host === "sketchup" && probe.instances.length > 1) {
|
|
73049
|
+
return {
|
|
73050
|
+
...base,
|
|
73051
|
+
session: found,
|
|
73052
|
+
ok: false,
|
|
73053
|
+
state: "ambiguous-session",
|
|
73054
|
+
message: `Couldn\u2019t send \u2014 ${probe.instances.length} SketchUp windows are open and there\u2019s no way to tell which model you meant. Close all but one and try again.`,
|
|
73055
|
+
recovery: { action: "retry", label: "Check again" }
|
|
73056
|
+
};
|
|
73057
|
+
}
|
|
73058
|
+
if (host === "revit" && session.version && !SUPPORTED_REVIT_VERSIONS.has(session.version)) {
|
|
73059
|
+
return {
|
|
73060
|
+
...base,
|
|
73061
|
+
session: found,
|
|
73062
|
+
ok: false,
|
|
73063
|
+
state: "host-version-unsupported",
|
|
73064
|
+
message: `Couldn\u2019t send \u2014 FloLess can only build into Revit 2026, and the open session is Revit ${session.version}.`,
|
|
73065
|
+
recovery: null
|
|
73066
|
+
};
|
|
73067
|
+
}
|
|
73068
|
+
if (host === "revit" && session.addinLoaded === false) {
|
|
73069
|
+
return {
|
|
73070
|
+
...base,
|
|
73071
|
+
session: found,
|
|
73072
|
+
ok: false,
|
|
73073
|
+
state: "addin-missing",
|
|
73074
|
+
message: "Couldn\u2019t send \u2014 Revit is open, but the FloLess add-in isn\u2019t loaded. Install it, then restart Revit.",
|
|
73075
|
+
recovery: { action: "install-addin", label: "Install Revit add-in" }
|
|
73076
|
+
};
|
|
73077
|
+
}
|
|
73078
|
+
return {
|
|
73079
|
+
...base,
|
|
73080
|
+
session: found,
|
|
73081
|
+
bakeEnv: probe.env,
|
|
73082
|
+
ok: true,
|
|
73083
|
+
state: "ready",
|
|
73084
|
+
message: `Ready to send to ${label2}${session.version ? ` ${session.version}` : ""}.`,
|
|
73085
|
+
recovery: null
|
|
73086
|
+
};
|
|
73087
|
+
}
|
|
73088
|
+
|
|
73089
|
+
// host-bake.ts
|
|
73090
|
+
var GENERIC_BAKE_HOSTS = ["revit", "sketchup"];
|
|
73091
|
+
function isGenericBakeHost(value) {
|
|
73092
|
+
return typeof value === "string" && GENERIC_BAKE_HOSTS.includes(value);
|
|
73093
|
+
}
|
|
73094
|
+
var DESCRIPTORS = {
|
|
73095
|
+
revit: {
|
|
73096
|
+
host: "revit",
|
|
73097
|
+
label: HOST_LABELS.revit,
|
|
73098
|
+
writeApp: (dir, appId, scene, hostPid) => writeRevitApp(dir, appId, scene, hostPid),
|
|
73099
|
+
nodeId: "bake-revit",
|
|
73100
|
+
unavailable: "Revit must be open with a document, and the FloLess add-in loaded, to receive this."
|
|
73101
|
+
},
|
|
73102
|
+
sketchup: {
|
|
73103
|
+
host: "sketchup",
|
|
73104
|
+
label: HOST_LABELS.sketchup,
|
|
73105
|
+
// SketchUp takes no target: readiness refuses outright when more than one session is open,
|
|
73106
|
+
// because its bake has no instance selector and must never guess between two models.
|
|
73107
|
+
writeApp: (dir, appId, scene) => writeSketchupApp(dir, appId, scene),
|
|
73108
|
+
nodeId: "bake-sketchup",
|
|
73109
|
+
unavailable: "SketchUp must be open with a model to receive this."
|
|
73110
|
+
}
|
|
73111
|
+
};
|
|
73112
|
+
function hostBakeDescriptor(host) {
|
|
73113
|
+
return DESCRIPTORS[host];
|
|
73114
|
+
}
|
|
73115
|
+
function looksLikeHostUnavailable(host, ...messages) {
|
|
73116
|
+
const haystack = messages.filter(Boolean).join(" ").toLowerCase();
|
|
73117
|
+
if (!haystack) return false;
|
|
73118
|
+
const signals = [
|
|
73119
|
+
"no " + host + " instance",
|
|
73120
|
+
"not running",
|
|
73121
|
+
"no instance",
|
|
73122
|
+
"no running",
|
|
73123
|
+
"addin_loaded",
|
|
73124
|
+
"add-in isn",
|
|
73125
|
+
"named pipe",
|
|
73126
|
+
"did not appear",
|
|
73127
|
+
"bridge not found",
|
|
73128
|
+
"bridge i/o",
|
|
73129
|
+
"host-unavailable",
|
|
73130
|
+
"launch " + host,
|
|
73131
|
+
"no document is open",
|
|
73132
|
+
"no model is open"
|
|
73133
|
+
];
|
|
73134
|
+
return signals.some((s) => haystack.includes(s));
|
|
73135
|
+
}
|
|
73136
|
+
|
|
72431
73137
|
// render-readiness.ts
|
|
72432
73138
|
var import_node_fs38 = require("node:fs");
|
|
72433
73139
|
var import_node_path34 = require("node:path");
|
|
@@ -72509,12 +73215,12 @@ function findBlender(env2 = process.env) {
|
|
|
72509
73215
|
}
|
|
72510
73216
|
return null;
|
|
72511
73217
|
}
|
|
72512
|
-
var
|
|
73218
|
+
var DEFAULT_DEPS4 = {
|
|
72513
73219
|
npmVersion: () => aware.npmVersion(),
|
|
72514
73220
|
installedAgentIds: async () => (await aware.agentList()).map((row) => row.id),
|
|
72515
73221
|
locateBlender: () => findBlender()
|
|
72516
73222
|
};
|
|
72517
|
-
async function renderReadiness(deps =
|
|
73223
|
+
async function renderReadiness(deps = DEFAULT_DEPS4) {
|
|
72518
73224
|
try {
|
|
72519
73225
|
const version = deps.npmVersion();
|
|
72520
73226
|
const current = !!version && compareSemver(version, RENDER_AWARE_FLOOR) >= 0;
|
|
@@ -73605,7 +74311,11 @@ function isGatedAwareRoute(url, method) {
|
|
|
73605
74311
|
if (path === "/api/trigger-run") return m === "POST";
|
|
73606
74312
|
if (path.startsWith("/api/app/")) return m === "PATCH" || m === "POST" || m === "DELETE";
|
|
73607
74313
|
if (path.startsWith("/api/contract/")) {
|
|
73608
|
-
return m === "POST" && (path.endsWith("/approve") || path.endsWith("/export-3d") || path.endsWith("/export-ifc") || path.endsWith("/export-tekla") || //
|
|
74314
|
+
return m === "POST" && (path.endsWith("/approve") || path.endsWith("/export-3d") || path.endsWith("/export-ifc") || path.endsWith("/export-tekla") || // Revit/SketchUp. Matched as a SEGMENT, not a suffix: the host is the last path component,
|
|
74315
|
+
// so `/export-host/revit` ends with "/revit" and every endsWith test above sails past it.
|
|
74316
|
+
// It compiles and runs a companion exactly like /export-tekla, so a half-installed AWARE
|
|
74317
|
+
// must stop it here rather than surface as a spawn failure mid-bake.
|
|
74318
|
+
path.includes("/export-host/") || // `aware agent invoke` twice (ifc/write then the blender render). The `m === 'POST'` test
|
|
73609
74319
|
// above is what keeps the `render-preview` GET out of here — that one only reads a file
|
|
73610
74320
|
// off disk and must stay available while AWARE is still installing.
|
|
73611
74321
|
path.endsWith("/render"));
|
|
@@ -73614,7 +74324,7 @@ function isGatedAwareRoute(url, method) {
|
|
|
73614
74324
|
}
|
|
73615
74325
|
|
|
73616
74326
|
// autostart.mjs
|
|
73617
|
-
var
|
|
74327
|
+
var import_node_child_process7 = require("node:child_process");
|
|
73618
74328
|
var import_node_fs42 = require("node:fs");
|
|
73619
74329
|
var import_node_os22 = require("node:os");
|
|
73620
74330
|
var import_node_path38 = require("node:path");
|
|
@@ -73723,7 +74433,7 @@ function currentUserId() {
|
|
|
73723
74433
|
}
|
|
73724
74434
|
function removeLegacyRunKey() {
|
|
73725
74435
|
try {
|
|
73726
|
-
(0,
|
|
74436
|
+
(0, import_node_child_process7.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
|
|
73727
74437
|
} catch {
|
|
73728
74438
|
}
|
|
73729
74439
|
}
|
|
@@ -73741,7 +74451,7 @@ function registerAutostart(exePath) {
|
|
|
73741
74451
|
const tmp = (0, import_node_path38.join)((0, import_node_os22.tmpdir)(), `floless-autostart-${process.pid}-${Date.now()}.xml`);
|
|
73742
74452
|
(0, import_node_fs42.writeFileSync)(tmp, "\uFEFF" + xml, { encoding: "utf16le" });
|
|
73743
74453
|
try {
|
|
73744
|
-
(0,
|
|
74454
|
+
(0, import_node_child_process7.execFileSync)("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", tmp, "/F"], {
|
|
73745
74455
|
stdio: ["ignore", "ignore", "ignore"],
|
|
73746
74456
|
windowsHide: true
|
|
73747
74457
|
});
|
|
@@ -73759,7 +74469,7 @@ function registerAutostart(exePath) {
|
|
|
73759
74469
|
function autostartPresent() {
|
|
73760
74470
|
if (!isWin) return false;
|
|
73761
74471
|
try {
|
|
73762
|
-
(0,
|
|
74472
|
+
(0, import_node_child_process7.execFileSync)("schtasks", ["/query", "/tn", TASK_NAME], { stdio: "ignore", windowsHide: true });
|
|
73763
74473
|
return true;
|
|
73764
74474
|
} catch {
|
|
73765
74475
|
return false;
|
|
@@ -73776,14 +74486,14 @@ function ensureAutostart(exePath) {
|
|
|
73776
74486
|
function unregisterAutostart() {
|
|
73777
74487
|
if (!isWin) return;
|
|
73778
74488
|
try {
|
|
73779
|
-
(0,
|
|
74489
|
+
(0, import_node_child_process7.execFileSync)("schtasks", ["/delete", "/tn", TASK_NAME, "/f"], { stdio: "ignore", windowsHide: true });
|
|
73780
74490
|
} catch {
|
|
73781
74491
|
}
|
|
73782
74492
|
removeLegacyRunKey();
|
|
73783
74493
|
}
|
|
73784
74494
|
|
|
73785
74495
|
// updater.ts
|
|
73786
|
-
var
|
|
74496
|
+
var import_node_child_process8 = require("node:child_process");
|
|
73787
74497
|
var import_node_crypto22 = require("node:crypto");
|
|
73788
74498
|
var import_node_fs44 = require("node:fs");
|
|
73789
74499
|
var import_node_stream3 = require("node:stream");
|
|
@@ -73981,7 +74691,7 @@ async function applyUpdate(check, opts) {
|
|
|
73981
74691
|
const pkg = await downloadPackage(check.asset);
|
|
73982
74692
|
if (opts?.onBeforeApply) await opts.onBeforeApply();
|
|
73983
74693
|
await new Promise((resolve11, reject) => {
|
|
73984
|
-
const child = (0,
|
|
74694
|
+
const child = (0, import_node_child_process8.spawn)(exe, ["apply", "--package", pkg, "--waitPid", String(process.pid)], {
|
|
73985
74695
|
cwd: installRoot(),
|
|
73986
74696
|
detached: true,
|
|
73987
74697
|
stdio: "ignore",
|
|
@@ -74214,7 +74924,7 @@ function isTraceCorrupt(events) {
|
|
|
74214
74924
|
}
|
|
74215
74925
|
|
|
74216
74926
|
// launch.mjs
|
|
74217
|
-
var
|
|
74927
|
+
var import_node_child_process9 = require("node:child_process");
|
|
74218
74928
|
var import_node_path41 = require("node:path");
|
|
74219
74929
|
var import_node_url3 = require("node:url");
|
|
74220
74930
|
var import_node_fs45 = require("node:fs");
|
|
@@ -74306,7 +75016,7 @@ function startServerDetached() {
|
|
|
74306
75016
|
const { cmd, args, shell } = resolveServerStart();
|
|
74307
75017
|
rotateLog();
|
|
74308
75018
|
const fd2 = openLogFd();
|
|
74309
|
-
const child = (0,
|
|
75019
|
+
const child = (0, import_node_child_process9.spawn)(cmd, args, {
|
|
74310
75020
|
cwd: __dirname2,
|
|
74311
75021
|
detached: true,
|
|
74312
75022
|
stdio: fd2 == null ? "ignore" : ["ignore", fd2, fd2],
|
|
@@ -74316,13 +75026,13 @@ function startServerDetached() {
|
|
|
74316
75026
|
child.unref();
|
|
74317
75027
|
}
|
|
74318
75028
|
function openBrowser2(url) {
|
|
74319
|
-
if (isWin2) (0,
|
|
74320
|
-
else (0,
|
|
75029
|
+
if (isWin2) (0, import_node_child_process9.spawn)("cmd", ["/c", "start", "", url], { windowsHide: true }).unref();
|
|
75030
|
+
else (0, import_node_child_process9.spawn)(process.platform === "darwin" ? "open" : "xdg-open", [url], { detached: true }).unref();
|
|
74321
75031
|
}
|
|
74322
75032
|
function stopServer() {
|
|
74323
75033
|
if (!isWin2) {
|
|
74324
75034
|
try {
|
|
74325
|
-
(0,
|
|
75035
|
+
(0, import_node_child_process9.execSync)(`bash -lc "fuser -k ${PORT}/tcp"`, { stdio: "ignore" });
|
|
74326
75036
|
return true;
|
|
74327
75037
|
} catch {
|
|
74328
75038
|
return false;
|
|
@@ -74330,7 +75040,7 @@ function stopServer() {
|
|
|
74330
75040
|
}
|
|
74331
75041
|
try {
|
|
74332
75042
|
const ps = `$p = Get-NetTCPConnection -LocalPort ${PORT} -State Listen -ErrorAction SilentlyContinue | Select-Object -Expand OwningProcess -Unique; if ($p) { $p | ForEach-Object { taskkill /PID $_ /T /F } } else { exit 9 }`;
|
|
74333
|
-
(0,
|
|
75043
|
+
(0, import_node_child_process9.execSync)(`powershell -NoProfile -Command "${ps}"`, { stdio: "ignore" });
|
|
74334
75044
|
return true;
|
|
74335
75045
|
} catch {
|
|
74336
75046
|
return false;
|
|
@@ -74382,7 +75092,7 @@ async function cmdSupervise() {
|
|
|
74382
75092
|
if (isSeaChannel && !process.env[SUPERVISE_RESPAWN_ENV]) {
|
|
74383
75093
|
rotateLog();
|
|
74384
75094
|
const fd2 = openLogFd();
|
|
74385
|
-
const child = (0,
|
|
75095
|
+
const child = (0, import_node_child_process9.spawn)(process.execPath, ["--supervise"], {
|
|
74386
75096
|
detached: true,
|
|
74387
75097
|
stdio: fd2 == null ? "ignore" : ["ignore", fd2, fd2],
|
|
74388
75098
|
windowsHide: true,
|
|
@@ -74437,7 +75147,7 @@ function enumerateProcesses() {
|
|
|
74437
75147
|
if (!isWin2) return [];
|
|
74438
75148
|
try {
|
|
74439
75149
|
const ps = "Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress";
|
|
74440
|
-
const out = (0,
|
|
75150
|
+
const out = (0, import_node_child_process9.execSync)(`powershell -NoProfile -Command "${ps}"`, {
|
|
74441
75151
|
encoding: "utf8",
|
|
74442
75152
|
windowsHide: true,
|
|
74443
75153
|
maxBuffer: 16 * 1024 * 1024
|
|
@@ -74460,7 +75170,7 @@ function killSupervisor({ tree = true } = {}) {
|
|
|
74460
75170
|
for (const pid of pids) {
|
|
74461
75171
|
log(`stopping supervisor (pid ${pid})\u2026`);
|
|
74462
75172
|
try {
|
|
74463
|
-
(0,
|
|
75173
|
+
(0, import_node_child_process9.execFileSync)("taskkill", taskkillArgs(pid, { tree }), { stdio: "ignore", windowsHide: true });
|
|
74464
75174
|
} catch {
|
|
74465
75175
|
}
|
|
74466
75176
|
}
|
|
@@ -74556,11 +75266,11 @@ async function cmdUpdate() {
|
|
|
74556
75266
|
function removeRegistryFootprint() {
|
|
74557
75267
|
if (!isWin2) return;
|
|
74558
75268
|
try {
|
|
74559
|
-
(0,
|
|
75269
|
+
(0, import_node_child_process9.execFileSync)("reg", ["delete", RUN_KEY, "/v", RUN_VALUE, "/f"], { stdio: "ignore", windowsHide: true });
|
|
74560
75270
|
} catch {
|
|
74561
75271
|
}
|
|
74562
75272
|
try {
|
|
74563
|
-
(0,
|
|
75273
|
+
(0, import_node_child_process9.execFileSync)("reg", ["delete", PROTOCOL_KEY, "/f"], { stdio: "ignore", windowsHide: true });
|
|
74564
75274
|
} catch {
|
|
74565
75275
|
}
|
|
74566
75276
|
}
|
|
@@ -74586,13 +75296,13 @@ async function cmdUninstall(flags = {}) {
|
|
|
74586
75296
|
if (removeAware) {
|
|
74587
75297
|
log("removing the AWARE runtime \u2014 this will affect ANY other tool that uses @aware-aeco/cli.");
|
|
74588
75298
|
try {
|
|
74589
|
-
(0,
|
|
75299
|
+
(0, import_node_child_process9.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell: isWin2 });
|
|
74590
75300
|
} catch {
|
|
74591
75301
|
log('warning: "npm uninstall -g @aware-aeco/cli" failed \u2014 see the output above.');
|
|
74592
75302
|
}
|
|
74593
75303
|
let lsJson = "";
|
|
74594
75304
|
try {
|
|
74595
|
-
lsJson = (0,
|
|
75305
|
+
lsJson = (0, import_node_child_process9.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
|
|
74596
75306
|
encoding: "utf8",
|
|
74597
75307
|
stdio: ["ignore", "pipe", "ignore"],
|
|
74598
75308
|
shell: isWin2
|
|
@@ -76710,7 +77420,7 @@ async function startServer() {
|
|
|
76710
77420
|
const isWin3 = process.platform === "win32";
|
|
76711
77421
|
const has = (cmd) => {
|
|
76712
77422
|
try {
|
|
76713
|
-
(0,
|
|
77423
|
+
(0, import_node_child_process10.execFileSync)(isWin3 ? "where" : "which", [cmd], { stdio: "ignore", windowsHide: true, timeout: 5e3 });
|
|
76714
77424
|
return true;
|
|
76715
77425
|
} catch {
|
|
76716
77426
|
return false;
|
|
@@ -76719,7 +77429,7 @@ async function startServer() {
|
|
|
76719
77429
|
function installAwareGlobal(spec, onLine = () => {
|
|
76720
77430
|
}) {
|
|
76721
77431
|
return new Promise((resolve11, reject) => {
|
|
76722
|
-
const child = (0,
|
|
77432
|
+
const child = (0, import_node_child_process10.spawn)("npm", ["i", "-g", `@aware-aeco/cli@${spec}`], { shell: isWin3, windowsHide: true });
|
|
76723
77433
|
let stderrTail = "";
|
|
76724
77434
|
let combinedTail = "";
|
|
76725
77435
|
const tail = (buf, s) => (buf + s).slice(-4e3);
|
|
@@ -77440,7 +78150,7 @@ async function startServer() {
|
|
|
77440
78150
|
readContractForApp: (appId) => readUnacceptedContract(appId),
|
|
77441
78151
|
projectAppMismatch
|
|
77442
78152
|
});
|
|
77443
|
-
registerMigrationCommitRoute(app, { projectAppMismatch });
|
|
78153
|
+
registerMigrationCommitRoute(app, { projectAppMismatch, broadcast });
|
|
77444
78154
|
app.get("/api/contract/:appId", async (req, reply) => {
|
|
77445
78155
|
const project = req.query.project || void 0;
|
|
77446
78156
|
if (project) {
|
|
@@ -78155,6 +78865,132 @@ async function startServer() {
|
|
|
78155
78865
|
}
|
|
78156
78866
|
}, { label: "sending the model to Tekla" });
|
|
78157
78867
|
});
|
|
78868
|
+
app.post(
|
|
78869
|
+
"/api/contract/:appId/export-host/:host",
|
|
78870
|
+
async (req, reply) => {
|
|
78871
|
+
const { appId } = req.params;
|
|
78872
|
+
const project = req.query.project || void 0;
|
|
78873
|
+
if (!isGenericBakeHost(req.params.host)) {
|
|
78874
|
+
return reply.status(404).send({ ok: false, error: `no bake target called "${req.params.host}"` });
|
|
78875
|
+
}
|
|
78876
|
+
const target = hostBakeDescriptor(req.params.host);
|
|
78877
|
+
const parsed = readSelectionFromBody(req.body);
|
|
78878
|
+
if (parsed === "invalid") {
|
|
78879
|
+
return reply.status(400).send({
|
|
78880
|
+
ok: false,
|
|
78881
|
+
error: "Could not read which members to send. Try again, and if it keeps happening, reload the editor."
|
|
78882
|
+
});
|
|
78883
|
+
}
|
|
78884
|
+
const selection = parsed;
|
|
78885
|
+
const rawPid = (req.body ?? {}).hostPid;
|
|
78886
|
+
const hostPid = typeof rawPid === "number" && Number.isInteger(rawPid) && rawPid > 0 ? rawPid : void 0;
|
|
78887
|
+
return withLifecycleLock(project ? "project" : "app", project || appId, async () => {
|
|
78888
|
+
let projectSnapshot;
|
|
78889
|
+
if (project) {
|
|
78890
|
+
const gate = projectExportGate(appId, project);
|
|
78891
|
+
if (gate) return reply.status(gate.status).send({ ok: false, error: gate.error });
|
|
78892
|
+
try {
|
|
78893
|
+
projectSnapshot = currentApprovedSnapshot(project);
|
|
78894
|
+
} catch (error) {
|
|
78895
|
+
if (error instanceof WorkspaceSnapshotError) return reply.status(error.status).send({ ok: false, error: error.message });
|
|
78896
|
+
throw error;
|
|
78897
|
+
}
|
|
78898
|
+
}
|
|
78899
|
+
const readiness = await hostReadiness(target.host, void 0, hostPid);
|
|
78900
|
+
if (!readiness.ok) {
|
|
78901
|
+
return reply.status(409).send({
|
|
78902
|
+
ok: false,
|
|
78903
|
+
needsHost: readiness.state === "host-closed" || readiness.state === "addin-missing",
|
|
78904
|
+
host: target.host,
|
|
78905
|
+
error: readiness.message,
|
|
78906
|
+
readiness
|
|
78907
|
+
});
|
|
78908
|
+
}
|
|
78909
|
+
const candidate = projectSnapshot ? projectSnapshot.contract : readAcceptedForRequest(appId, void 0);
|
|
78910
|
+
if (candidate == null) return reply.status(404).send({ ok: false, error: "no contract to bake" });
|
|
78911
|
+
const steel = acceptSteelForRoute(candidate, { appId, projectId: project }, "stored", "v1-or-v2");
|
|
78912
|
+
if (!steel.accepted) return reply.status(400).send(steel.refusal);
|
|
78913
|
+
const doc = steel.doc;
|
|
78914
|
+
const sourceId = selection ? await dropExportSourceId(appId, project) : await stableExportSourceId(appId, project);
|
|
78915
|
+
const scoped = selection ? contractForMemberSelection(doc, selection) : doc;
|
|
78916
|
+
if (selection && selectionMemberCount(scoped) === 0) {
|
|
78917
|
+
return reply.status(422).send({ ok: false, error: "those members aren\u2019t in the model any more \u2014 reload the editor and try again" });
|
|
78918
|
+
}
|
|
78919
|
+
const built = contractToAwareScene(scoped, sourceId);
|
|
78920
|
+
if (!hasExportableSceneRecords(built.scene)) {
|
|
78921
|
+
return reply.status(422).send({
|
|
78922
|
+
ok: false,
|
|
78923
|
+
error: selection ? `nothing to bake in that selection \u2014 every member you dragged is an RFI (no AISC size yet)` : "no resolvable members to bake \u2014 every member is an RFI (no AISC size yet)",
|
|
78924
|
+
skipped: built.skipped
|
|
78925
|
+
});
|
|
78926
|
+
}
|
|
78927
|
+
const companion = createExportCompanion(appId, target.host);
|
|
78928
|
+
try {
|
|
78929
|
+
const flo = target.writeApp(companion.path, companion.id, built.scene, hostPid);
|
|
78930
|
+
stampExportCompanionLease(companion);
|
|
78931
|
+
await aware.compile(flo);
|
|
78932
|
+
const env2 = readiness.bakeEnv;
|
|
78933
|
+
let runResult;
|
|
78934
|
+
try {
|
|
78935
|
+
runResult = await aware.run(companion.id, { env: env2 });
|
|
78936
|
+
} catch (error) {
|
|
78937
|
+
const recoverable = error instanceof AwareError && /timeout|timed out|lost response|connection reset/i.test(`${error.message} ${awareStderr(error) || ""}`);
|
|
78938
|
+
if (!recoverable) throw error;
|
|
78939
|
+
runResult = await aware.run(companion.id, { env: env2 });
|
|
78940
|
+
}
|
|
78941
|
+
const events = runResult.traceText ? parseTrace(runResult.traceText) : [];
|
|
78942
|
+
const output = [...events].reverse().find((event) => event.kind === "node-output" && event.node === target.nodeId);
|
|
78943
|
+
const envelope = output?.data && typeof output.data === "object" ? output.data : null;
|
|
78944
|
+
const rawReceipt = envelope?.result && typeof envelope.result === "object" ? envelope.result : envelope;
|
|
78945
|
+
const receipt = reconcileHostExportReceipt(built.scene, rawReceipt, built.producerUnsupported);
|
|
78946
|
+
return {
|
|
78947
|
+
ok: true,
|
|
78948
|
+
host: target.host,
|
|
78949
|
+
message: `${receipt.counts.emitted} emitted${receipt.counts.native != null ? ` \xB7 ${receipt.counts.native} native` : ""}${receipt.counts.unsupported ? ` \xB7 ${receipt.counts.unsupported} unsupported` : ""}${receipt.counts.warnings ? ` \xB7 ${receipt.counts.warnings} warning${receipt.counts.warnings === 1 ? "" : "s"}` : ""}`,
|
|
78950
|
+
elements: receipt.counts.emitted,
|
|
78951
|
+
skipped: built.skipped,
|
|
78952
|
+
receipt,
|
|
78953
|
+
counts: receipt.counts,
|
|
78954
|
+
warnings: receipt.warnings
|
|
78955
|
+
};
|
|
78956
|
+
} catch (error) {
|
|
78957
|
+
const reason = error instanceof AwareError ? awareStderr(error) : void 0;
|
|
78958
|
+
const message = error instanceof Error ? error.message : `${target.label} export failed`;
|
|
78959
|
+
const needsHost = looksLikeHostUnavailable(target.host, message, reason);
|
|
78960
|
+
app.log.warn({ appId, project, host: target.host, error: message, reason }, "host export failed");
|
|
78961
|
+
return reply.status(error instanceof ReceiptReconciliationError ? 422 : 502).send({
|
|
78962
|
+
ok: false,
|
|
78963
|
+
needsHost,
|
|
78964
|
+
host: target.host,
|
|
78965
|
+
error: needsHost ? target.unavailable : message,
|
|
78966
|
+
reason
|
|
78967
|
+
});
|
|
78968
|
+
} finally {
|
|
78969
|
+
try {
|
|
78970
|
+
companion.cleanup();
|
|
78971
|
+
} catch (error) {
|
|
78972
|
+
app.log.error({ companionId: companion.id, error: error instanceof Error ? error.message : error }, "could not remove host export companion");
|
|
78973
|
+
}
|
|
78974
|
+
}
|
|
78975
|
+
}, { label: `sending the model to ${target.label}` });
|
|
78976
|
+
}
|
|
78977
|
+
);
|
|
78978
|
+
app.post("/api/host-at-point", async (req, reply) => {
|
|
78979
|
+
const body = req.body ?? {};
|
|
78980
|
+
const x = typeof body.screenX === "number" ? body.screenX : NaN;
|
|
78981
|
+
const y = typeof body.screenY === "number" ? body.screenY : NaN;
|
|
78982
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) {
|
|
78983
|
+
return reply.status(400).send({ ok: false, error: "screenX and screenY must be numbers" });
|
|
78984
|
+
}
|
|
78985
|
+
const dpr = typeof body.dpr === "number" ? body.dpr : 1;
|
|
78986
|
+
const hit = await resolveHostAtPoint(x, y, dpr, (px, py) => hostAtScreenPoint(px, py));
|
|
78987
|
+
const running = await runningKnownHosts();
|
|
78988
|
+
return { ok: true, resolved: hit.probed, host: hit.host, pid: hit.pid, processName: hit.processName, running };
|
|
78989
|
+
});
|
|
78990
|
+
app.get("/api/host-windows", async () => {
|
|
78991
|
+
const [stack, running] = await Promise.all([hostWindowRects(), runningKnownHosts()]);
|
|
78992
|
+
return { ok: true, stack, running };
|
|
78993
|
+
});
|
|
78158
78994
|
app.post("/api/contract/:appId/export-bom/:format", async (req, reply) => {
|
|
78159
78995
|
const { appId, format } = req.params;
|
|
78160
78996
|
const project = req.query.project || void 0;
|
|
@@ -79264,10 +80100,10 @@ async function startServer() {
|
|
|
79264
80100
|
}
|
|
79265
80101
|
|
|
79266
80102
|
// protocol.ts
|
|
79267
|
-
var
|
|
80103
|
+
var import_node_child_process11 = require("node:child_process");
|
|
79268
80104
|
var BASE = PROTOCOL_KEY;
|
|
79269
80105
|
function reg(args) {
|
|
79270
|
-
(0,
|
|
80106
|
+
(0, import_node_child_process11.execFileSync)("reg", args, { stdio: "ignore", windowsHide: true });
|
|
79271
80107
|
}
|
|
79272
80108
|
function registerProtocol(exePath) {
|
|
79273
80109
|
if (process.platform !== "win32") return;
|
|
@@ -79307,13 +80143,13 @@ async function removeAwarePerDecision(removeAwareFlag, prompt) {
|
|
|
79307
80143
|
);
|
|
79308
80144
|
const shell = process.platform === "win32" ? process.env.ComSpec || "cmd.exe" : "/bin/sh";
|
|
79309
80145
|
try {
|
|
79310
|
-
(0,
|
|
80146
|
+
(0, import_node_child_process12.execSync)("npm uninstall -g @aware-aeco/cli", { stdio: "inherit", shell });
|
|
79311
80147
|
} catch {
|
|
79312
80148
|
process.stdout.write('floless: warning: "npm uninstall -g @aware-aeco/cli" failed \u2014 see the output above.\n');
|
|
79313
80149
|
}
|
|
79314
80150
|
let lsJson = "";
|
|
79315
80151
|
try {
|
|
79316
|
-
lsJson = (0,
|
|
80152
|
+
lsJson = (0, import_node_child_process12.execSync)("npm ls -g @aware-aeco/cli --depth=0 --json", {
|
|
79317
80153
|
encoding: "utf8",
|
|
79318
80154
|
stdio: ["ignore", "pipe", "ignore"],
|
|
79319
80155
|
shell
|