@floless/app 0.137.2 → 0.137.3
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 +284 -134
- package/dist/web/app.css +21 -0
- package/dist/web/commands-shell.js +11 -0
- package/dist/web/workspaces.js +81 -1
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -55058,7 +55058,7 @@ function appVersion() {
|
|
|
55058
55058
|
return resolveVersion({
|
|
55059
55059
|
isSea: isSea2(),
|
|
55060
55060
|
sqVersionXml: readSqVersionXml(),
|
|
55061
|
-
define: true ? "0.137.
|
|
55061
|
+
define: true ? "0.137.3" : void 0,
|
|
55062
55062
|
pkgVersion: readPkgVersion()
|
|
55063
55063
|
});
|
|
55064
55064
|
}
|
|
@@ -55074,7 +55074,7 @@ function resolveChannel(s) {
|
|
|
55074
55074
|
function appChannel() {
|
|
55075
55075
|
return resolveChannel({
|
|
55076
55076
|
isSea: isSea2(),
|
|
55077
|
-
define: true ? "0.137.
|
|
55077
|
+
define: true ? "0.137.3" : void 0,
|
|
55078
55078
|
// argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
|
|
55079
55079
|
// carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
|
|
55080
55080
|
modulePath: process.argv[1]
|
|
@@ -64367,7 +64367,7 @@ My note: ${req.instruction}` : "";
|
|
|
64367
64367
|
return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached. Re-read it into the SAME steel.model/v2 project. ${manifestPhase} The server writes the exact Filter into the existing model. Then STOP and tell me exactly: ${REVISION_READ_FILTER_QUESTION} Do not read members, build the model, open 3D, or POST /revision-read until I explicitly return after saving the Drawing Filter. Only after Save, read selected elements into model-global members in world millimetres, preserve unchanged member ids, attach active observations using { sourceHash, sheet, elementId }, and preserve grid and plan registration unless the drawings explicitly prove a reviewed change. ${post}${snaps}${note}`;
|
|
64368
64368
|
}
|
|
64369
64369
|
if (isInitialRead) {
|
|
64370
|
-
return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing set was attached. Create its first steel model version without creating another project. ${manifestPhase} Use the exact returned Filter and bound pages to compose a schema-valid native steel.model/v2 checkpoint shell with zero members/model records, one canonical model grid, and one registered plans[] row per DRAWING VIEW covering the manifest model sheets \u2014 a page carrying several elevations gets one row each, sharing that page's sheet and stating its own model-global id. PUT that shell to /api/contract/${req.appId}?project=${req.project} with If-None-Match: * and X-FloLess-Prepass-Request: "${req.id}". Then STOP and tell me exactly: ${REVISION_READ_FILTER_QUESTION} Do not read members or post /revision-read before Save. AFTER Save, add model-global members in world millimetres and active observations using { sourceHash, sheet, elementId }, preserving the checkpoint Filter
|
|
64370
|
+
return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing set was attached. Create its first steel model version without creating another project. ${manifestPhase} Use the exact returned Filter and bound pages to compose a schema-valid native steel.model/v2 checkpoint shell with zero members/model records, one canonical model grid, and one registered plans[] row per DRAWING VIEW covering the manifest model sheets \u2014 a page carrying several elevations gets one row each, sharing that page's sheet and stating its own model-global id. PUT that shell to /api/contract/${req.appId}?project=${req.project} with If-None-Match: * and X-FloLess-Prepass-Request: "${req.id}". Then STOP and tell me exactly: ${REVISION_READ_FILTER_QUESTION} Do not read members or post /revision-read before Save. AFTER Save, add model-global members in world millimetres and active observations using { sourceHash, sheet, elementId }, preserving the checkpoint Filter byte-for-byte and every grid field and plan registration value the checkpoint STATES. Where the checkpoint states nothing this build can honour you MUST author it: a grid whose axes[] is empty, a datum_ref/control2_ref in the retired { axis_x, axis_y } spelling (replace it with { xAxisId, yAxisId } \u2014 do not delete it, an omitted datum_ref means the datum IS the model origin), and a plans[] row carrying no registration at all. Never change a view's id, sheet or viewKind, and never add or remove a plans[] row. ${post}${snaps}${note}`;
|
|
64371
64371
|
}
|
|
64372
64372
|
throw new Error("unreachable steel revision-read instruction branch");
|
|
64373
64373
|
}
|
|
@@ -65979,6 +65979,31 @@ function withDeterministicFilterIds(document) {
|
|
|
65979
65979
|
return copy;
|
|
65980
65980
|
}
|
|
65981
65981
|
|
|
65982
|
+
// steel-intersection-ref.ts
|
|
65983
|
+
var axisId = (v) => {
|
|
65984
|
+
if (typeof v !== "string") return null;
|
|
65985
|
+
const t = v.trim();
|
|
65986
|
+
return t.length > 0 ? t : null;
|
|
65987
|
+
};
|
|
65988
|
+
var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
65989
|
+
function intersectionRef(v) {
|
|
65990
|
+
if (v === void 0 || v === null) return { state: "absent" };
|
|
65991
|
+
if (isObj3(v)) {
|
|
65992
|
+
const unknown = Object.keys(v).filter((k) => k !== "xAxisId" && k !== "yAxisId");
|
|
65993
|
+
if (unknown.length) {
|
|
65994
|
+
return { state: "invalid", why: `an intersection has only \`xAxisId\` and \`yAxisId\` \u2014 ${unknown.map((k) => `\`${k}\``).join(", ")} ${unknown.length > 1 ? "are" : "is"} not recognised${unknown.some((k) => k === "axis_x" || k === "axis_y") ? "; registration names grid axis IDS now, never labels" : ""}` };
|
|
65995
|
+
}
|
|
65996
|
+
const x = axisId(v.xAxisId), y = axisId(v.yAxisId);
|
|
65997
|
+
if (x && y) return { state: "valid", x, y };
|
|
65998
|
+
const missing = [!x ? "xAxisId" : null, !y ? "yAxisId" : null].filter(Boolean).join(" and ");
|
|
65999
|
+
return { state: "invalid", why: `${missing} must each be a non-blank grid axis id` };
|
|
66000
|
+
}
|
|
66001
|
+
return { state: "invalid", why: `a ${Array.isArray(v) ? "list" : typeof v} names no grid intersection; expected { xAxisId, yAxisId }` };
|
|
66002
|
+
}
|
|
66003
|
+
function canonicalRef(r) {
|
|
66004
|
+
return { xAxisId: r.x, yAxisId: r.y };
|
|
66005
|
+
}
|
|
66006
|
+
|
|
65982
66007
|
// steel-shell-invariants.ts
|
|
65983
66008
|
var SHELL_REGISTRATION_FIELDS = [
|
|
65984
66009
|
"id",
|
|
@@ -65993,14 +66018,119 @@ var SHELL_REGISTRATION_FIELDS = [
|
|
|
65993
66018
|
"frame",
|
|
65994
66019
|
"sourceRegistration"
|
|
65995
66020
|
];
|
|
65996
|
-
|
|
65997
|
-
|
|
65998
|
-
|
|
65999
|
-
|
|
66000
|
-
|
|
66001
|
-
|
|
66021
|
+
var IDENTITY_FIELDS = ["id", "sheet", "viewKind"];
|
|
66022
|
+
var REGISTRATION_FIELDS = SHELL_REGISTRATION_FIELDS.filter((key2) => !IDENTITY_FIELDS.includes(key2));
|
|
66023
|
+
var PLAN_REGISTRATION_FIELDS = [
|
|
66024
|
+
"elevation_in",
|
|
66025
|
+
"pt_per_ft",
|
|
66026
|
+
"datum_at",
|
|
66027
|
+
"datum_ref",
|
|
66028
|
+
"control2_at",
|
|
66029
|
+
"control2_ref",
|
|
66030
|
+
"frame"
|
|
66031
|
+
];
|
|
66032
|
+
var SOURCE_REGISTRATION_FIELDS = ["pt_per_ft", "sourceRegistration", "frame"];
|
|
66033
|
+
var G1_AUTHORABLE_GRID_FIELDS = [
|
|
66034
|
+
"axes",
|
|
66035
|
+
"origin",
|
|
66036
|
+
"x",
|
|
66037
|
+
"y",
|
|
66038
|
+
"z",
|
|
66039
|
+
"labels_x",
|
|
66040
|
+
"labels_y",
|
|
66041
|
+
"labels_z",
|
|
66042
|
+
"hidden_z",
|
|
66043
|
+
"ext",
|
|
66044
|
+
"on",
|
|
66045
|
+
"ends"
|
|
66046
|
+
];
|
|
66047
|
+
var isObj4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
66048
|
+
var states = (row, key2) => isObj4(row) && row[key2] !== void 0 && row[key2] !== null;
|
|
66049
|
+
var plansOf = (doc) => {
|
|
66050
|
+
const plans = isObj4(doc) ? doc.plans : void 0;
|
|
66051
|
+
return Array.isArray(plans) ? plans : [];
|
|
66052
|
+
};
|
|
66053
|
+
var gridOf = (doc) => {
|
|
66054
|
+
const grid = isObj4(doc) ? doc.grid : void 0;
|
|
66055
|
+
return isObj4(grid) ? grid : null;
|
|
66056
|
+
};
|
|
66057
|
+
function registrationFieldsFor(viewKind) {
|
|
66058
|
+
if (viewKind === "plan") return PLAN_REGISTRATION_FIELDS;
|
|
66059
|
+
if (viewKind === "elevation" || viewKind === "section") return SOURCE_REGISTRATION_FIELDS;
|
|
66060
|
+
return [];
|
|
66002
66061
|
}
|
|
66003
|
-
function
|
|
66062
|
+
function shellMask(shell) {
|
|
66063
|
+
const unbound = [];
|
|
66064
|
+
const plans = plansOf(shell);
|
|
66065
|
+
const grid = gridOf(shell);
|
|
66066
|
+
const g3Fields = plans.map((row) => {
|
|
66067
|
+
if (!isObj4(row)) return [];
|
|
66068
|
+
if (REGISTRATION_FIELDS.some((key2) => states(row, key2))) return [];
|
|
66069
|
+
return registrationFieldsFor(row.viewKind);
|
|
66070
|
+
});
|
|
66071
|
+
g3Fields.forEach((fields, index) => {
|
|
66072
|
+
for (const field of fields) {
|
|
66073
|
+
unbound.push({ path: `$.plans[${index}].${field}`, reason: "unregistered-view", mode: "author" });
|
|
66074
|
+
}
|
|
66075
|
+
});
|
|
66076
|
+
plans.forEach((row, index) => {
|
|
66077
|
+
if (!isObj4(row)) return;
|
|
66078
|
+
for (const side2 of ["datum", "control2"]) {
|
|
66079
|
+
const key2 = `${side2}_ref`;
|
|
66080
|
+
const at = `${side2}_at`;
|
|
66081
|
+
if (states(row, key2)) {
|
|
66082
|
+
if (intersectionRef(row[key2]).state !== "invalid") continue;
|
|
66083
|
+
unbound.push({
|
|
66084
|
+
path: `$.plans[${index}].${key2}`,
|
|
66085
|
+
reason: "unreadable-reference",
|
|
66086
|
+
mode: states(row, at) ? "replace" : "author"
|
|
66087
|
+
});
|
|
66088
|
+
} else if (side2 === "control2" && row.viewKind === "plan" && states(row, at)) {
|
|
66089
|
+
unbound.push({ path: `$.plans[${index}].${key2}`, reason: "unreadable-reference", mode: "author" });
|
|
66090
|
+
}
|
|
66091
|
+
}
|
|
66092
|
+
});
|
|
66093
|
+
const axes = grid?.axes;
|
|
66094
|
+
const axesUnstated = axes === void 0 || axes === null || Array.isArray(axes) && axes.length === 0;
|
|
66095
|
+
const gridCorroborated = plans.some((row, index) => isObj4(row) && row.viewKind === "plan" && (states(row, "datum_ref") || states(row, "control2_ref") || g3Fields[index].length > 0));
|
|
66096
|
+
if (grid && axesUnstated && gridCorroborated) {
|
|
66097
|
+
for (const field of G1_AUTHORABLE_GRID_FIELDS) {
|
|
66098
|
+
if (field !== "axes" && states(grid, field)) continue;
|
|
66099
|
+
unbound.push({ path: `$.grid.${field}`, reason: "grid-unstated", mode: "author" });
|
|
66100
|
+
}
|
|
66101
|
+
}
|
|
66102
|
+
return unbound;
|
|
66103
|
+
}
|
|
66104
|
+
var PRESENT = "\0shell:stated";
|
|
66105
|
+
function maskIndex(unbound) {
|
|
66106
|
+
return new Map(unbound.map((row) => [row.path, row.mode]));
|
|
66107
|
+
}
|
|
66108
|
+
function projectPlans(doc, unbound) {
|
|
66109
|
+
const index = maskIndex(unbound);
|
|
66110
|
+
return plansOf(doc).map((raw, i) => {
|
|
66111
|
+
const entries = [];
|
|
66112
|
+
for (const key2 of SHELL_REGISTRATION_FIELDS) {
|
|
66113
|
+
const mode = index.get(`$.plans[${i}].${key2}`);
|
|
66114
|
+
if (mode === "author") continue;
|
|
66115
|
+
if (!states(raw, key2)) continue;
|
|
66116
|
+
entries.push([key2, mode === "replace" ? PRESENT : raw[key2]]);
|
|
66117
|
+
}
|
|
66118
|
+
return Object.fromEntries(entries);
|
|
66119
|
+
});
|
|
66120
|
+
}
|
|
66121
|
+
function projectGrid(doc, unbound) {
|
|
66122
|
+
const grid = gridOf(doc);
|
|
66123
|
+
if (!grid) return isObj4(doc) ? doc.grid : void 0;
|
|
66124
|
+
const index = maskIndex(unbound);
|
|
66125
|
+
const entries = [];
|
|
66126
|
+
for (const key2 of Object.keys(grid)) {
|
|
66127
|
+
if (index.get(`$.grid.${key2}`) === "author") continue;
|
|
66128
|
+
entries.push([key2, grid[key2]]);
|
|
66129
|
+
}
|
|
66130
|
+
return Object.fromEntries(entries);
|
|
66131
|
+
}
|
|
66132
|
+
function shellBinding(shell, candidate) {
|
|
66133
|
+
const unbound = shellMask(shell);
|
|
66004
66134
|
const deviations = [];
|
|
66005
66135
|
const compare = (invariant, detail, left, right) => {
|
|
66006
66136
|
const shellHash = contractHash(left);
|
|
@@ -66010,16 +66140,31 @@ function shellDeviations(shell, candidate) {
|
|
|
66010
66140
|
compare(
|
|
66011
66141
|
"grid",
|
|
66012
66142
|
"the submitted model changed the saved grid",
|
|
66013
|
-
shell
|
|
66014
|
-
candidate
|
|
66143
|
+
projectGrid(shell, unbound),
|
|
66144
|
+
projectGrid(candidate, unbound)
|
|
66015
66145
|
);
|
|
66016
66146
|
compare(
|
|
66017
66147
|
"registration",
|
|
66018
66148
|
"the submitted model changed saved plan registration",
|
|
66019
|
-
|
|
66020
|
-
|
|
66149
|
+
projectPlans(shell, unbound),
|
|
66150
|
+
projectPlans(candidate, unbound)
|
|
66021
66151
|
);
|
|
66022
|
-
|
|
66152
|
+
const shellGrid = gridOf(shell);
|
|
66153
|
+
const candidateGrid = gridOf(candidate);
|
|
66154
|
+
const shellPlans = plansOf(shell);
|
|
66155
|
+
const candidatePlans = plansOf(candidate);
|
|
66156
|
+
const usedUnbound = unbound.filter((row) => {
|
|
66157
|
+
const gridField = /^\$\.grid\.(.+)$/.exec(row.path);
|
|
66158
|
+
if (gridField) return contractHash(shellGrid?.[gridField[1]]) !== contractHash(candidateGrid?.[gridField[1]]);
|
|
66159
|
+
const planField = /^\$\.plans\[(\d+)\]\.(.+)$/.exec(row.path);
|
|
66160
|
+
if (!planField) return false;
|
|
66161
|
+
const index = Number(planField[1]);
|
|
66162
|
+
const key2 = planField[2];
|
|
66163
|
+
const left = shellPlans[index], right = candidatePlans[index];
|
|
66164
|
+
if (!isObj4(right)) return false;
|
|
66165
|
+
return contractHash(isObj4(left) ? left[key2] : void 0) !== contractHash(right[key2]);
|
|
66166
|
+
});
|
|
66167
|
+
return { deviations, unbound, usedUnbound, maskHash: contractHash(usedUnbound) };
|
|
66023
66168
|
}
|
|
66024
66169
|
|
|
66025
66170
|
// steel-prepass-status.ts
|
|
@@ -67336,9 +67481,9 @@ var InvalidModelV2Error = class extends Error {
|
|
|
67336
67481
|
function invalidModelV2Reply(err2) {
|
|
67337
67482
|
return { ok: false, error: err2.issues[0] ?? err2.message, issues: err2.issues };
|
|
67338
67483
|
}
|
|
67339
|
-
var
|
|
67484
|
+
var isObj5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
67340
67485
|
function isModelV2(doc) {
|
|
67341
|
-
return
|
|
67486
|
+
return isObj5(doc) && doc.type === "steel.model/v2";
|
|
67342
67487
|
}
|
|
67343
67488
|
function readModel(doc) {
|
|
67344
67489
|
return readModelOrIssues(doc).view ?? null;
|
|
@@ -69388,12 +69533,12 @@ var SteelManifestCoverageError = class extends Error {
|
|
|
69388
69533
|
}
|
|
69389
69534
|
diagnostic;
|
|
69390
69535
|
};
|
|
69391
|
-
var
|
|
69536
|
+
var isObj6 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
69392
69537
|
function verifiedRawIds(elements, sourceHash, page, filterCount) {
|
|
69393
69538
|
const ids = [];
|
|
69394
69539
|
const seen = /* @__PURE__ */ new Set();
|
|
69395
69540
|
for (const raw of elements) {
|
|
69396
|
-
const element =
|
|
69541
|
+
const element = isObj6(raw) ? raw : {};
|
|
69397
69542
|
const id = typeof element.id === "string" ? element.id : "";
|
|
69398
69543
|
if (!RAW_ID.test(id)) throw new SteelManifestCoverageError({ sourceHash, page, evidenceCount: elements.length, filterCount, category: "missing-id", samples: [`${typeof element.id}:${id.length}:${id.slice(0, 16)}`] });
|
|
69399
69544
|
if (element.sourceHash !== sourceHash) throw new SteelManifestCoverageError({ sourceHash, page, evidenceCount: elements.length, filterCount, category: "source-mismatch", samples: [id] });
|
|
@@ -69488,7 +69633,7 @@ function steelReadPageShards(stored2) {
|
|
|
69488
69633
|
}
|
|
69489
69634
|
var canonicalKey = (dim, value) => facetKey(dim, value);
|
|
69490
69635
|
function selectionIndex(filter) {
|
|
69491
|
-
const source =
|
|
69636
|
+
const source = isObj6(filter) ? filter : {};
|
|
69492
69637
|
const mode = selectionMode(source.mode);
|
|
69493
69638
|
const active2 = new Set(selectionDims(mode));
|
|
69494
69639
|
const onKeys = (dim) => {
|
|
@@ -69496,7 +69641,7 @@ function selectionIndex(filter) {
|
|
|
69496
69641
|
const rows2 = Array.isArray(source[descriptor.control]) ? source[descriptor.control] : [];
|
|
69497
69642
|
const out = /* @__PURE__ */ new Set();
|
|
69498
69643
|
for (const row of rows2) {
|
|
69499
|
-
if (!
|
|
69644
|
+
if (!isObj6(row) || row.on !== true) continue;
|
|
69500
69645
|
const key2 = canonicalKey(dim, row[descriptor.rowKey]);
|
|
69501
69646
|
if (key2 !== void 0) out.add(key2);
|
|
69502
69647
|
}
|
|
@@ -69537,8 +69682,8 @@ function sourceLineInventory(input) {
|
|
|
69537
69682
|
const lines = [];
|
|
69538
69683
|
const unboundSheets = [];
|
|
69539
69684
|
const unownedCandidates = [];
|
|
69540
|
-
if (
|
|
69541
|
-
const sheets = (Array.isArray(filter.sheets) ? filter.sheets : []).filter(
|
|
69685
|
+
if (isObj6(filter)) {
|
|
69686
|
+
const sheets = (Array.isArray(filter.sheets) ? filter.sheets : []).filter(isObj6);
|
|
69542
69687
|
const claims = /* @__PURE__ */ new Map();
|
|
69543
69688
|
for (const sheet of sheets) if (typeof sheet.pageId === "string") claims.set(sheet.pageId, (claims.get(sheet.pageId) ?? 0) + 1);
|
|
69544
69689
|
for (const sheet of sheets) {
|
|
@@ -69556,7 +69701,7 @@ function sourceLineInventory(input) {
|
|
|
69556
69701
|
const modelable = reasons.length === 0;
|
|
69557
69702
|
const sheetName = typeof sheet.sheet === "string" ? sheet.sheet : "";
|
|
69558
69703
|
for (const raw of Array.isArray(sheet.elements) ? sheet.elements : []) {
|
|
69559
|
-
if (!
|
|
69704
|
+
if (!isObj6(raw)) continue;
|
|
69560
69705
|
const identity = typeof raw.elementId === "string" ? raw.elementId : raw.id;
|
|
69561
69706
|
if (raw.kind !== "line" || typeof identity !== "string" || typeof raw.sourceHash !== "string") continue;
|
|
69562
69707
|
const facets = facetsOf(raw);
|
|
@@ -69607,7 +69752,7 @@ function sourceLineInventory(input) {
|
|
|
69607
69752
|
unownedCandidates.push(`${candidate.id}:miskinded`);
|
|
69608
69753
|
continue;
|
|
69609
69754
|
}
|
|
69610
|
-
if (!
|
|
69755
|
+
if (!isObj6(candidate.element)) {
|
|
69611
69756
|
if (candidate.kind === "potential-member-line") {
|
|
69612
69757
|
unownedCandidates.push(`${candidate.id}:malformed`);
|
|
69613
69758
|
continue;
|
|
@@ -69984,11 +70129,11 @@ if (Object.keys(DIM_OF_ROW_KEY).length !== MODE_ORDER.length) {
|
|
|
69984
70129
|
for (const { key: key2 } of FACETS) {
|
|
69985
70130
|
if (!DIM_OF_ROW_KEY[key2]) throw new Error(`facet row key ${JSON.stringify(key2)} has no dimension in FACET_DIMS`);
|
|
69986
70131
|
}
|
|
69987
|
-
var
|
|
70132
|
+
var isObj7 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
69988
70133
|
function rowsOf(source, facet) {
|
|
69989
|
-
if (!
|
|
70134
|
+
if (!isObj7(source)) return [];
|
|
69990
70135
|
const rows2 = source[facet];
|
|
69991
|
-
return Array.isArray(rows2) ? rows2.filter(
|
|
70136
|
+
return Array.isArray(rows2) ? rows2.filter(isObj7) : [];
|
|
69992
70137
|
}
|
|
69993
70138
|
function keyOf(row, key2) {
|
|
69994
70139
|
const dim = DIM_OF_ROW_KEY[key2];
|
|
@@ -70001,7 +70146,7 @@ function explicitOn(row, facet) {
|
|
|
70001
70146
|
return facet === "layers" ? !!row.steel : true;
|
|
70002
70147
|
}
|
|
70003
70148
|
function withUsableDefaultMode(filter) {
|
|
70004
|
-
if (!
|
|
70149
|
+
if (!isObj7(filter)) return filter;
|
|
70005
70150
|
const hasSelection = (dim) => {
|
|
70006
70151
|
const descriptor = FACET_DIMS[dim];
|
|
70007
70152
|
return !!descriptor && rowsOf(filter, descriptor.control).some((row) => explicitOn(row, descriptor.control));
|
|
@@ -70013,7 +70158,7 @@ function withUsableDefaultMode(filter) {
|
|
|
70013
70158
|
}
|
|
70014
70159
|
function mergeWholeSetLayerCensus(input) {
|
|
70015
70160
|
const { modelFilter, evidenceFilter, priorFilter } = input;
|
|
70016
|
-
if (!
|
|
70161
|
+
if (!isObj7(modelFilter)) return modelFilter;
|
|
70017
70162
|
const merged = { ...modelFilter };
|
|
70018
70163
|
for (const { facet, key: key2 } of FACETS) {
|
|
70019
70164
|
const wholeSetCount = /* @__PURE__ */ new Map();
|
|
@@ -70071,27 +70216,27 @@ function mergeWholeSetLayerCensus(input) {
|
|
|
70071
70216
|
return merged;
|
|
70072
70217
|
}
|
|
70073
70218
|
function hasTotalBooleanOn(filter) {
|
|
70074
|
-
if (!
|
|
70219
|
+
if (!isObj7(filter)) return false;
|
|
70075
70220
|
return FACETS.every(({ facet }) => {
|
|
70076
70221
|
const rows2 = filter[facet];
|
|
70077
70222
|
if (rows2 === void 0) return true;
|
|
70078
70223
|
if (!Array.isArray(rows2)) return false;
|
|
70079
|
-
return rows2.every((row) =>
|
|
70224
|
+
return rows2.every((row) => isObj7(row) && typeof row.on === "boolean");
|
|
70080
70225
|
});
|
|
70081
70226
|
}
|
|
70082
70227
|
function hasCanonicalMode(filter) {
|
|
70083
|
-
if (!
|
|
70228
|
+
if (!isObj7(filter)) return false;
|
|
70084
70229
|
const mode = filter.mode;
|
|
70085
70230
|
return typeof mode === "string" && mode !== "" && mode === canonicalMode(modeDims(mode));
|
|
70086
70231
|
}
|
|
70087
70232
|
function hasWellFormedControlValues(filter) {
|
|
70088
|
-
if (!
|
|
70233
|
+
if (!isObj7(filter)) return false;
|
|
70089
70234
|
return FACETS.every(({ facet, key: key2 }) => {
|
|
70090
70235
|
const rows2 = filter[facet];
|
|
70091
70236
|
if (rows2 === void 0) return true;
|
|
70092
70237
|
if (!Array.isArray(rows2)) return false;
|
|
70093
70238
|
const dim = DIM_OF_ROW_KEY[key2];
|
|
70094
|
-
return rows2.every((row) =>
|
|
70239
|
+
return rows2.every((row) => isObj7(row) && facetKey(dim, row[key2]) !== void 0);
|
|
70095
70240
|
});
|
|
70096
70241
|
}
|
|
70097
70242
|
|
|
@@ -71475,7 +71620,7 @@ var MAX_MEMBERS = 1e4;
|
|
|
71475
71620
|
var MAX_TEXT = 1e3;
|
|
71476
71621
|
var SHA = /^[0-9a-f]{64}$/;
|
|
71477
71622
|
var SHORTHAND_DISPOSITIONS = /* @__PURE__ */ new Set(["annotation", "existing", "other"]);
|
|
71478
|
-
var
|
|
71623
|
+
var isObj8 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
71479
71624
|
var text3 = (value, max2 = MAX_TEXT) => typeof value === "string" && value.trim().length > 0 && value.length <= max2 ? value.trim() : null;
|
|
71480
71625
|
var exactKeys2 = (value, allowed) => Object.keys(value).every((key2) => allowed.includes(key2));
|
|
71481
71626
|
var SteelReadAttestationError = class extends Error {
|
|
@@ -71503,7 +71648,7 @@ function parseSteelReadAttestation(input) {
|
|
|
71503
71648
|
} catch {
|
|
71504
71649
|
throw new SteelReadAttestationError("attestation must be acyclic JSON");
|
|
71505
71650
|
}
|
|
71506
|
-
if (typeof json2 !== "string" || !
|
|
71651
|
+
if (typeof json2 !== "string" || !isObj8(input)) throw new SteelReadAttestationError(ATTESTATION_SHAPE_ERROR);
|
|
71507
71652
|
if (input.version === 1) throw new SteelReadAttestationRetiredError(1, ATTESTATION_V1_RETIRED_ERROR);
|
|
71508
71653
|
if (input.version === 2) throw new SteelReadAttestationRetiredError(2, ATTESTATION_V2_RETIRED_ERROR);
|
|
71509
71654
|
if (input.version === 3) throw new SteelReadAttestationRetiredError(3, ATTESTATION_V3_RETIRED_ERROR);
|
|
@@ -71511,18 +71656,18 @@ function parseSteelReadAttestation(input) {
|
|
|
71511
71656
|
if (input.version !== 4 || !exactKeys2(input, ["version", "massing", "layers", "facetExclusions", "lineDispositions", "lineDispositionGroups", "pageReviews", "references", "candidateDispositions", "jointReviews"])) {
|
|
71512
71657
|
throw new SteelReadAttestationError(ATTESTATION_SHAPE_ERROR);
|
|
71513
71658
|
}
|
|
71514
|
-
if (!
|
|
71659
|
+
if (!isObj8(input.massing) || !exactKeys2(input.massing, ["buildingCount", "summary"]) || !Number.isInteger(input.massing.buildingCount) || input.massing.buildingCount < 1 || !text3(input.massing.summary)) {
|
|
71515
71660
|
throw new SteelReadAttestationError("massing must state a positive buildingCount and bounded summary");
|
|
71516
71661
|
}
|
|
71517
71662
|
if (!Array.isArray(input.layers) || input.layers.length > MAX_LAYERS) throw new SteelReadAttestationError("layers must be a bounded array");
|
|
71518
71663
|
const layerNames = /* @__PURE__ */ new Set();
|
|
71519
71664
|
const layerKinds = /* @__PURE__ */ new Set(["member", "annotation", "existing", "mixed", "other"]);
|
|
71520
71665
|
const layers = input.layers.map((raw, index) => {
|
|
71521
|
-
if (!
|
|
71666
|
+
if (!isObj8(raw) || !exactKeys2(raw, ["layer", "disposition", "note", "lineCounts"])) throw new SteelReadAttestationError(`layers[${index}] has unknown or missing keys`);
|
|
71522
71667
|
const layer = text3(raw.layer, 200), note = text3(raw.note);
|
|
71523
71668
|
if (!layer || layerNames.has(layer) || typeof raw.disposition !== "string" || !layerKinds.has(raw.disposition) || !note) throw new SteelReadAttestationError(`layers[${index}] is malformed or duplicated`);
|
|
71524
71669
|
const counts2 = raw.lineCounts;
|
|
71525
|
-
if (!
|
|
71670
|
+
if (!isObj8(counts2) || !exactKeys2(counts2, ["model", "evidence"]) || !Number.isInteger(counts2.model) || counts2.model < 0 || !Number.isInteger(counts2.evidence) || counts2.evidence < 0) {
|
|
71526
71671
|
throw new SteelReadAttestationError(`layers[${index}] must state non-negative integer model/evidence lineCounts`);
|
|
71527
71672
|
}
|
|
71528
71673
|
layerNames.add(layer);
|
|
@@ -71537,7 +71682,7 @@ function parseSteelReadAttestation(input) {
|
|
|
71537
71682
|
const facetSeen = /* @__PURE__ */ new Set();
|
|
71538
71683
|
const facetKinds = /* @__PURE__ */ new Set(["member", "annotation", "existing", "mixed", "other"]);
|
|
71539
71684
|
const facetExclusions = input.facetExclusions.map((raw, index) => {
|
|
71540
|
-
if (!
|
|
71685
|
+
if (!isObj8(raw) || !exactKeys2(raw, ["dim", "value", "disposition", "note", "lineCounts"])) throw new SteelReadAttestationError(`facetExclusions[${index}] has unknown or missing keys`);
|
|
71541
71686
|
const dim = raw.dim === "thickness" ? "thickness" : raw.dim === "color" ? "color" : void 0;
|
|
71542
71687
|
if (dim === void 0) throw new SteelReadAttestationError(`facetExclusions[${index}] must name the thickness or color dimension`);
|
|
71543
71688
|
const key2 = facetKey(dim, dim === "thickness" ? raw.value : typeof raw.value === "string" && raw.value.length <= MAX_FACET_VALUE_CHARS ? raw.value : void 0);
|
|
@@ -71548,7 +71693,7 @@ function parseSteelReadAttestation(input) {
|
|
|
71548
71693
|
if (facetSeen.has(seenKey)) throw new SteelReadAttestationError(`facetExclusions[${index}] duplicates an earlier (dim, value)`);
|
|
71549
71694
|
facetSeen.add(seenKey);
|
|
71550
71695
|
const counts2 = raw.lineCounts;
|
|
71551
|
-
if (!
|
|
71696
|
+
if (!isObj8(counts2) || !exactKeys2(counts2, ["model", "evidence"]) || !Number.isInteger(counts2.model) || counts2.model < 0 || !Number.isInteger(counts2.evidence) || counts2.evidence < 0) {
|
|
71552
71697
|
throw new SteelReadAttestationError(`facetExclusions[${index}] must state non-negative integer model/evidence lineCounts`);
|
|
71553
71698
|
}
|
|
71554
71699
|
return {
|
|
@@ -71563,7 +71708,7 @@ function parseSteelReadAttestation(input) {
|
|
|
71563
71708
|
const lineIds = /* @__PURE__ */ new Set();
|
|
71564
71709
|
const dispositions = /* @__PURE__ */ new Set(["annotation", "existing", "duplicate", "not-steel", "unresolved"]);
|
|
71565
71710
|
const lineDispositions = input.lineDispositions.map((raw, index) => {
|
|
71566
|
-
if (!
|
|
71711
|
+
if (!isObj8(raw) || !exactKeys2(raw, ["elementId", "disposition", "reason", "duplicateOf"])) throw new SteelReadAttestationError(`lineDispositions[${index}] has unknown keys`);
|
|
71567
71712
|
const elementId = text3(raw.elementId, 200), reason = text3(raw.reason);
|
|
71568
71713
|
if (!elementId || lineIds.has(elementId) || typeof raw.disposition !== "string" || !dispositions.has(raw.disposition) || !reason) throw new SteelReadAttestationError(`lineDispositions[${index}] is malformed or duplicated`);
|
|
71569
71714
|
const duplicateOf = raw.duplicateOf === void 0 ? void 0 : text3(raw.duplicateOf, 200);
|
|
@@ -71573,7 +71718,7 @@ function parseSteelReadAttestation(input) {
|
|
|
71573
71718
|
});
|
|
71574
71719
|
if (!Array.isArray(input.lineDispositionGroups) || input.lineDispositionGroups.length > MAX_DISPOSITION_GROUPS) throw new SteelReadAttestationError("lineDispositionGroups must be a bounded array");
|
|
71575
71720
|
const lineDispositionGroups = input.lineDispositionGroups.map((raw, index) => {
|
|
71576
|
-
if (!
|
|
71721
|
+
if (!isObj8(raw) || !exactKeys2(raw, ["disposition", "reason", "duplicateOf", "elementIds"])) throw new SteelReadAttestationError(`lineDispositionGroups[${index}] has unknown or missing keys`);
|
|
71577
71722
|
const reason = text3(raw.reason);
|
|
71578
71723
|
if (typeof raw.disposition !== "string" || !dispositions.has(raw.disposition) || !reason) throw new SteelReadAttestationError(`lineDispositionGroups[${index}] is malformed`);
|
|
71579
71724
|
const duplicateOf = raw.duplicateOf === void 0 ? void 0 : text3(raw.duplicateOf, 200);
|
|
@@ -71594,7 +71739,7 @@ function parseSteelReadAttestation(input) {
|
|
|
71594
71739
|
if (!Array.isArray(input.pageReviews) || input.pageReviews.length > MAX_PAGES) throw new SteelReadAttestationError("pageReviews must be bounded");
|
|
71595
71740
|
const reviewedPageIds = /* @__PURE__ */ new Set();
|
|
71596
71741
|
const pageReviews = input.pageReviews.map((raw, index) => {
|
|
71597
|
-
if (!
|
|
71742
|
+
if (!isObj8(raw) || !exactKeys2(raw, ["pageId", "kind", "candidateShardHash", "note"])) throw new SteelReadAttestationError(`pageReviews[${index}] has unknown keys`);
|
|
71598
71743
|
const pageId = text3(raw.pageId, 200), note = text3(raw.note);
|
|
71599
71744
|
if (!pageId || reviewedPageIds.has(pageId) || raw.kind !== "whole" || typeof raw.candidateShardHash !== "string" || !SHA.test(raw.candidateShardHash) || !note) {
|
|
71600
71745
|
throw new SteelReadAttestationError(`pageReviews[${index}] is malformed or duplicated`);
|
|
@@ -71605,7 +71750,7 @@ function parseSteelReadAttestation(input) {
|
|
|
71605
71750
|
if (!Array.isArray(input.references) || input.references.length > MAX_LINES) throw new SteelReadAttestationError("references must be bounded");
|
|
71606
71751
|
const referenceIds = /* @__PURE__ */ new Set();
|
|
71607
71752
|
const references = input.references.map((raw, index) => {
|
|
71608
|
-
if (!
|
|
71753
|
+
if (!isObj8(raw) || !exactKeys2(raw, ["elementId", "status", "targetPageId", "reason"])) throw new SteelReadAttestationError(`references[${index}] has unknown keys`);
|
|
71609
71754
|
const elementId = text3(raw.elementId, 200);
|
|
71610
71755
|
if (!elementId || referenceIds.has(elementId) || raw.status !== "resolved" && raw.status !== "missing") throw new SteelReadAttestationError(`references[${index}] is malformed or duplicated`);
|
|
71611
71756
|
const targetPageId = raw.targetPageId === void 0 ? void 0 : text3(raw.targetPageId, 200);
|
|
@@ -71618,7 +71763,7 @@ function parseSteelReadAttestation(input) {
|
|
|
71618
71763
|
const candidateIds = /* @__PURE__ */ new Set();
|
|
71619
71764
|
const candidateDispositionKinds = /* @__PURE__ */ new Set(["modeled", "annotation", "not-applicable", "unresolved"]);
|
|
71620
71765
|
const candidateDispositions = input.candidateDispositions.map((raw, index) => {
|
|
71621
|
-
if (!
|
|
71766
|
+
if (!isObj8(raw) || !exactKeys2(raw, ["elementId", "disposition", "reason", "jointId"])) throw new SteelReadAttestationError(`candidateDispositions[${index}] has unknown keys`);
|
|
71622
71767
|
const elementId = text3(raw.elementId, 200), reason = text3(raw.reason);
|
|
71623
71768
|
const jointId = raw.jointId === void 0 ? void 0 : text3(raw.jointId, 200);
|
|
71624
71769
|
if (!elementId || candidateIds.has(elementId) || !candidateDispositionKinds.has(String(raw.disposition)) || !reason) throw new SteelReadAttestationError(`candidateDispositions[${index}] is malformed or duplicated`);
|
|
@@ -71629,7 +71774,7 @@ function parseSteelReadAttestation(input) {
|
|
|
71629
71774
|
if (!Array.isArray(input.jointReviews) || input.jointReviews.length > MAX_JOINTS) throw new SteelReadAttestationError("jointReviews must be bounded");
|
|
71630
71775
|
const jointIds = /* @__PURE__ */ new Set();
|
|
71631
71776
|
const jointReviews = input.jointReviews.map((raw, index) => {
|
|
71632
|
-
if (!
|
|
71777
|
+
if (!isObj8(raw) || !exactKeys2(raw, ["jointId", "dependencyHash", "note"])) throw new SteelReadAttestationError(`jointReviews[${index}] has unknown keys`);
|
|
71633
71778
|
const jointId = text3(raw.jointId, 200), note = text3(raw.note);
|
|
71634
71779
|
if (!jointId || jointIds.has(jointId) || typeof raw.dependencyHash !== "string" || !SHA.test(raw.dependencyHash) || !note) throw new SteelReadAttestationError(`jointReviews[${index}] is malformed or duplicated`);
|
|
71635
71780
|
jointIds.add(jointId);
|
|
@@ -71638,13 +71783,13 @@ function parseSteelReadAttestation(input) {
|
|
|
71638
71783
|
return { version: 4, massing: { buildingCount: input.massing.buildingCount, summary: text3(input.massing.summary) }, layers, facetExclusions, lineDispositions, lineDispositionGroups, pageReviews, references, candidateDispositions, jointReviews };
|
|
71639
71784
|
}
|
|
71640
71785
|
function referenceInventory(filter, manifest, inventory) {
|
|
71641
|
-
if (!
|
|
71786
|
+
if (!isObj8(filter)) return [];
|
|
71642
71787
|
const out = [];
|
|
71643
71788
|
const seen = /* @__PURE__ */ new Set();
|
|
71644
71789
|
for (const rawSheet of Array.isArray(filter.sheets) ? filter.sheets : []) {
|
|
71645
|
-
if (!
|
|
71790
|
+
if (!isObj8(rawSheet)) continue;
|
|
71646
71791
|
for (const raw of Array.isArray(rawSheet.elements) ? rawSheet.elements : []) {
|
|
71647
|
-
if (
|
|
71792
|
+
if (isObj8(raw) && raw.kind === "text" && typeof raw.id === "string" && typeof raw.text === "string" && isSteelReferenceText(raw.text)) {
|
|
71648
71793
|
out.push({ id: raw.id, text: raw.text });
|
|
71649
71794
|
seen.add(raw.id);
|
|
71650
71795
|
}
|
|
@@ -71657,7 +71802,7 @@ function referenceInventory(filter, manifest, inventory) {
|
|
|
71657
71802
|
seen.add(candidate.id);
|
|
71658
71803
|
}
|
|
71659
71804
|
} else for (const page of manifest.manifest.pages) for (const candidate of page.candidates ?? []) {
|
|
71660
|
-
const element =
|
|
71805
|
+
const element = isObj8(candidate.element) ? candidate.element : {};
|
|
71661
71806
|
const candidateText = typeof element.text === "string" ? element.text : "";
|
|
71662
71807
|
if (!isSteelReferenceText(candidateText) || seen.has(candidate.id)) continue;
|
|
71663
71808
|
out.push({ id: candidate.id, text: candidateText });
|
|
@@ -71669,11 +71814,11 @@ function activeObservationElements(candidate, retainedMemberIds) {
|
|
|
71669
71814
|
const out = /* @__PURE__ */ new Map();
|
|
71670
71815
|
let missingEndpointLineageCount = 0;
|
|
71671
71816
|
const missingEndpointLineage = [];
|
|
71672
|
-
if (!
|
|
71817
|
+
if (!isObj8(candidate)) return { elements: out, missingEndpointLineageCount, missingEndpointLineage };
|
|
71673
71818
|
for (const plan of Array.isArray(candidate.plans) ? candidate.plans : []) {
|
|
71674
|
-
if (!
|
|
71819
|
+
if (!isObj8(plan)) continue;
|
|
71675
71820
|
for (const observation of Array.isArray(plan.memberObservations) ? plan.memberObservations : []) {
|
|
71676
|
-
if (!
|
|
71821
|
+
if (!isObj8(observation) || !isObj8(observation.binding) || observation.binding.status !== "active") continue;
|
|
71677
71822
|
const memberIds = Array.isArray(observation.binding.memberIds) ? observation.binding.memberIds.filter((id) => typeof id === "string") : [];
|
|
71678
71823
|
if (!Array.isArray(observation.binding.endpointLineage) || observation.binding.endpointLineage.length === 0) {
|
|
71679
71824
|
const observationId = typeof observation.id === "string" ? observation.id : "<unknown>";
|
|
@@ -71683,10 +71828,10 @@ function activeObservationElements(candidate, retainedMemberIds) {
|
|
|
71683
71828
|
if (missingEndpointLineage.length < 20) missingEndpointLineage.push(`${observationId}:${id}`);
|
|
71684
71829
|
}
|
|
71685
71830
|
}
|
|
71686
|
-
if (!
|
|
71831
|
+
if (!isObj8(observation.evidence) || !isObj8(observation.evidence.source)) continue;
|
|
71687
71832
|
const source = observation.evidence.source;
|
|
71688
71833
|
if (typeof source.elementId !== "string" || typeof source.sourceHash !== "string") continue;
|
|
71689
|
-
const wp =
|
|
71834
|
+
const wp = isObj8(observation.evidence.local) ? observation.evidence.local.wp : void 0;
|
|
71690
71835
|
if (!Array.isArray(wp) || wp.length !== 2 || !wp.every((point3) => Array.isArray(point3) && point3.length === 2 && point3.every(Number.isFinite))) continue;
|
|
71691
71836
|
out.set(source.elementId, { sourceHash: source.sourceHash, sheet: typeof source.sheet === "string" ? source.sheet : "", wp, memberIds });
|
|
71692
71837
|
}
|
|
@@ -71743,8 +71888,8 @@ function worklineMatches(svg, wp) {
|
|
|
71743
71888
|
return straightSegments(svg).some(([a, b]) => samePoint2(a, wp[0]) && samePoint2(b, wp[1]) || samePoint2(a, wp[1]) && samePoint2(b, wp[0]));
|
|
71744
71889
|
}
|
|
71745
71890
|
function jointDependencyHash(candidate, jointId) {
|
|
71746
|
-
if (!
|
|
71747
|
-
const joints = Array.isArray(candidate.joints) ? candidate.joints.filter(
|
|
71891
|
+
if (!isObj8(candidate)) return null;
|
|
71892
|
+
const joints = Array.isArray(candidate.joints) ? candidate.joints.filter(isObj8) : [];
|
|
71748
71893
|
const joint = joints.find((row) => row.id === jointId);
|
|
71749
71894
|
if (!joint) return null;
|
|
71750
71895
|
const memberIds = /* @__PURE__ */ new Set();
|
|
@@ -71752,8 +71897,8 @@ function jointDependencyHash(candidate, jointId) {
|
|
|
71752
71897
|
if (Array.isArray(joint.secondaries)) {
|
|
71753
71898
|
for (const id of joint.secondaries) if (typeof id === "string") memberIds.add(id);
|
|
71754
71899
|
}
|
|
71755
|
-
const members = (Array.isArray(candidate.members) ? candidate.members.filter(
|
|
71756
|
-
const connection = typeof joint.conn === "string" && Array.isArray(candidate.connections) ? candidate.connections.filter(
|
|
71900
|
+
const members = (Array.isArray(candidate.members) ? candidate.members.filter(isObj8) : []).filter((row) => typeof row.id === "string" && memberIds.has(row.id));
|
|
71901
|
+
const connection = typeof joint.conn === "string" && Array.isArray(candidate.connections) ? candidate.connections.filter(isObj8).find((row) => row.id === joint.conn) ?? null : null;
|
|
71757
71902
|
return hashOf({ policy: "steel-joint-dependency/v1", joint, members, connection, expansion: "steel-joints/v2-measured-fit" });
|
|
71758
71903
|
}
|
|
71759
71904
|
function steelExclusionSignOffValid(input) {
|
|
@@ -71766,7 +71911,7 @@ function steelExclusionSignOffValid(input) {
|
|
|
71766
71911
|
if (!hasCanonicalMode(filter)) return { ok: false, why: "mode-noncanonical" };
|
|
71767
71912
|
if (signOff.manifestHash !== storedManifest.manifestHash) return { ok: false, why: "manifest-moved" };
|
|
71768
71913
|
if (signOff.controlsHash !== steelFilterControlsHash(filter)) return { ok: false, why: "controls-moved" };
|
|
71769
|
-
const source =
|
|
71914
|
+
const source = isObj8(filter) ? filter : {};
|
|
71770
71915
|
const active2 = selectionDims(source.mode);
|
|
71771
71916
|
const censusByDim = /* @__PURE__ */ new Map();
|
|
71772
71917
|
for (const dim of active2) {
|
|
@@ -71774,7 +71919,7 @@ function steelExclusionSignOffValid(input) {
|
|
|
71774
71919
|
const rows2 = Array.isArray(source[descriptor.control]) ? source[descriptor.control] : [];
|
|
71775
71920
|
const keys = /* @__PURE__ */ new Set();
|
|
71776
71921
|
for (const row of rows2) {
|
|
71777
|
-
if (!
|
|
71922
|
+
if (!isObj8(row)) continue;
|
|
71778
71923
|
const key2 = facetKey(dim, row[descriptor.rowKey]);
|
|
71779
71924
|
if (key2 !== void 0) keys.add(key2);
|
|
71780
71925
|
}
|
|
@@ -71797,7 +71942,7 @@ function evaluateSteelRead(context) {
|
|
|
71797
71942
|
const add = (id, status, detail, samples) => checks.push({ id, status, detail, ...samples?.length ? { samples: samples.slice(0, 20) } : {} });
|
|
71798
71943
|
const candidateHash = hashOf(candidate);
|
|
71799
71944
|
const proofHash = hashOf(proof3);
|
|
71800
|
-
const filter =
|
|
71945
|
+
const filter = isObj8(candidate) ? candidate.filter : void 0;
|
|
71801
71946
|
const checkpointRecorded = !!storedManifest.savedFilterHash && !!storedManifest.savedFilterEtag;
|
|
71802
71947
|
const checkpointBytesMatch = checkpointRecorded && hashOf(filter) === storedManifest.savedFilterHash;
|
|
71803
71948
|
const checkpointGeometryMatch = checkpointBytesMatch && steelFilterGeometryHash(filter) === steelFilterGeometryHash(storedManifest.manifest.filter);
|
|
@@ -71813,13 +71958,21 @@ function evaluateSteelRead(context) {
|
|
|
71813
71958
|
else if (!checkpointControlValuesOk) add("filter-checkpoint", "block", "the saved Filter has a layer, thickness or colour control whose value is not a value for that control");
|
|
71814
71959
|
else add("filter-checkpoint", "pass", "candidate uses the exact saved server-owned Filter");
|
|
71815
71960
|
if (context.initialFilterCheckpoint) {
|
|
71816
|
-
const
|
|
71817
|
-
if (deviations.length) {
|
|
71961
|
+
const binding = shellBinding(context.current, candidate);
|
|
71962
|
+
if (binding.deviations.length) {
|
|
71818
71963
|
add(
|
|
71819
71964
|
"shell-preserved",
|
|
71820
71965
|
"block",
|
|
71821
|
-
`${deviations.map((deviation) => deviation.detail).join("; ")} \u2014 an initial read may fill the saved Drawing Filter checkpoint in, but may not restate it`,
|
|
71822
|
-
deviations.map((deviation) => `${deviation.invariant}: shell ${deviation.shellHash} vs candidate ${deviation.candidateHash}`)
|
|
71966
|
+
`${binding.deviations.map((deviation) => deviation.detail).join("; ")} \u2014 an initial read may fill the saved Drawing Filter checkpoint in, but may not restate it`,
|
|
71967
|
+
binding.deviations.map((deviation) => `${deviation.invariant}: shell ${deviation.shellHash} vs candidate ${deviation.candidateHash}`)
|
|
71968
|
+
);
|
|
71969
|
+
} else if (binding.usedUnbound.length) {
|
|
71970
|
+
const reasons = [...new Set(binding.usedUnbound.map((row) => row.reason))].sort();
|
|
71971
|
+
add(
|
|
71972
|
+
"shell-preserved",
|
|
71973
|
+
"warning",
|
|
71974
|
+
`${binding.usedUnbound.length} field(s) authored where the saved Drawing Filter checkpoint states nothing this build can honour (${reasons.join(", ")}; mask ${binding.maskHash}) \u2014 every OTHER field the checkpoint states is unchanged`,
|
|
71975
|
+
binding.usedUnbound.map((row) => `${row.path} (${row.reason}, ${row.mode})`)
|
|
71823
71976
|
);
|
|
71824
71977
|
} else {
|
|
71825
71978
|
add("shell-preserved", "pass", "candidate preserves the saved grid and plan registration");
|
|
@@ -71830,7 +71983,7 @@ function evaluateSteelRead(context) {
|
|
|
71830
71983
|
else add("contract-validity", "pass", "final candidate is valid steel.model/v2");
|
|
71831
71984
|
if (validation.valid) {
|
|
71832
71985
|
const model = candidate;
|
|
71833
|
-
const retainedIds = new Set(
|
|
71986
|
+
const retainedIds = new Set(isObj8(context.current) && Array.isArray(context.current.members) ? context.current.members.filter(isObj8).flatMap((member) => typeof member.id === "string" ? [member.id] : []) : []);
|
|
71834
71987
|
const expectedViews = canonicalLineagedViewIds(model);
|
|
71835
71988
|
const report = context.normalization.report;
|
|
71836
71989
|
const scopeMatches = expectedViews.length ? report.scope.kind === "conversion" && JSON.stringify(report.scope.viewIds) === JSON.stringify(expectedViews) : report.scope.kind === "model-3d";
|
|
@@ -71845,12 +71998,12 @@ function evaluateSteelRead(context) {
|
|
|
71845
71998
|
if (inventory) {
|
|
71846
71999
|
const filterIdsByPage = /* @__PURE__ */ new Map();
|
|
71847
72000
|
const filterLineIdsByPage = /* @__PURE__ */ new Map();
|
|
71848
|
-
for (const rawSheet of
|
|
71849
|
-
if (!
|
|
72001
|
+
for (const rawSheet of isObj8(filter) && Array.isArray(filter.sheets) ? filter.sheets : []) {
|
|
72002
|
+
if (!isObj8(rawSheet) || typeof rawSheet.pageId !== "string") continue;
|
|
71850
72003
|
const ids = filterIdsByPage.get(rawSheet.pageId) ?? /* @__PURE__ */ new Set();
|
|
71851
72004
|
const lineIds2 = filterLineIdsByPage.get(rawSheet.pageId) ?? /* @__PURE__ */ new Set();
|
|
71852
72005
|
for (const element of Array.isArray(rawSheet.elements) ? rawSheet.elements : []) {
|
|
71853
|
-
if (!
|
|
72006
|
+
if (!isObj8(element) || typeof element.id !== "string") continue;
|
|
71854
72007
|
ids.add(element.id);
|
|
71855
72008
|
if (element.kind === "line") lineIds2.add(element.id);
|
|
71856
72009
|
}
|
|
@@ -71954,7 +72107,7 @@ function evaluateSteelRead(context) {
|
|
|
71954
72107
|
return owner2 ? { ok: true, ...owner2 } : { ok: false, why: "selected" };
|
|
71955
72108
|
};
|
|
71956
72109
|
const shorthandGatesOpen = filterCheckpointPassed && signOffValid;
|
|
71957
|
-
const retainedMemberIds = new Set(
|
|
72110
|
+
const retainedMemberIds = new Set(isObj8(context.current) && Array.isArray(context.current.members) ? context.current.members.filter(isObj8).flatMap((member) => typeof member.id === "string" ? [member.id] : []) : []);
|
|
71958
72111
|
const observationAudit = activeObservationElements(candidate, retainedMemberIds);
|
|
71959
72112
|
const observations2 = observationAudit.elements;
|
|
71960
72113
|
if (validation.valid) {
|
|
@@ -72100,7 +72253,7 @@ function evaluateSteelRead(context) {
|
|
|
72100
72253
|
const markerCandidates = (inventory ?? storedManifest.manifest.pages.flatMap((page) => page.candidates ?? [])).filter((candidate2) => candidate2.kind === "detail-marker" || candidate2.kind === "connection-marker");
|
|
72101
72254
|
const markerIds = new Set(markerCandidates.map((marker) => marker.id));
|
|
72102
72255
|
const dispositionByCandidate = new Map(proof3.candidateDispositions.map((row) => [row.elementId, row]));
|
|
72103
|
-
const jointIdSet = new Set((
|
|
72256
|
+
const jointIdSet = new Set((isObj8(candidate) && Array.isArray(candidate.joints) ? candidate.joints.filter(isObj8) : []).flatMap((joint) => typeof joint.id === "string" ? [joint.id] : []));
|
|
72104
72257
|
const badCandidates = [];
|
|
72105
72258
|
for (const marker of markerCandidates) {
|
|
72106
72259
|
const disposition = dispositionByCandidate.get(marker.id);
|
|
@@ -72109,9 +72262,9 @@ function evaluateSteelRead(context) {
|
|
|
72109
72262
|
for (const id of dispositionByCandidate.keys()) if (!markerIds.has(id)) badCandidates.push(id);
|
|
72110
72263
|
const unresolvedCandidates = proof3.candidateDispositions.filter((row) => row.disposition === "unresolved").map((row) => row.elementId);
|
|
72111
72264
|
add("detail-reconciliation", badCandidates.length ? "block" : unresolvedCandidates.length ? "warning" : "pass", badCandidates.length ? "detail/connection markers are unaccounted or bind to missing joints" : `${markerCandidates.length} detail/connection marker(s) reconciled`, [...badCandidates, ...unresolvedCandidates]);
|
|
72112
|
-
const candidateObj =
|
|
72113
|
-
const members = Array.isArray(candidateObj.members) ? candidateObj.members.filter(
|
|
72114
|
-
const candidateJoints = Array.isArray(candidateObj.joints) ? candidateObj.joints.filter(
|
|
72265
|
+
const candidateObj = isObj8(candidate) ? candidate : {};
|
|
72266
|
+
const members = Array.isArray(candidateObj.members) ? candidateObj.members.filter(isObj8) : [];
|
|
72267
|
+
const candidateJoints = Array.isArray(candidateObj.joints) ? candidateObj.joints.filter(isObj8) : [];
|
|
72115
72268
|
const budgetExceeded = members.length > MAX_MEMBERS || candidateJoints.length > MAX_JOINTS || lines.length > MAX_LINES;
|
|
72116
72269
|
add("work-budget", budgetExceeded ? "block" : "pass", budgetExceeded ? "candidate or source geometry exceeds the deterministic audit work limits" : `${lines.length} line(s), ${members.length} member(s), and ${candidateJoints.length} joint(s) are within audit limits`);
|
|
72117
72270
|
add("endpoint-lineage", observationAudit.missingEndpointLineageCount ? "block" : "pass", observationAudit.missingEndpointLineageCount ? `${observationAudit.missingEndpointLineageCount} new-member observation binding(s) lack physical endpoint lineage` : "every new-member observation binding carries physical endpoint lineage", observationAudit.missingEndpointLineage);
|
|
@@ -72120,8 +72273,8 @@ function evaluateSteelRead(context) {
|
|
|
72120
72273
|
const id = typeof member.id === "string" ? member.id : "<unknown>";
|
|
72121
72274
|
if (typeof member.profile !== "string" || !profileDims(member.profile)) unresolvedMembers.push(`${id}:profile`);
|
|
72122
72275
|
for (const end of ["from", "to"]) {
|
|
72123
|
-
const point3 =
|
|
72124
|
-
if (!point3 || !
|
|
72276
|
+
const point3 = isObj8(member[end]) ? member[end] : null;
|
|
72277
|
+
if (!point3 || !isObj8(point3.z) || typeof point3.z.known !== "number") unresolvedMembers.push(`${id}:${end}Z`);
|
|
72125
72278
|
}
|
|
72126
72279
|
}
|
|
72127
72280
|
add("resolved-members", unresolvedMembers.length ? "warning" : "pass", unresolvedMembers.length ? `${unresolvedMembers.length} member profile/elevation RFI(s)` : `${members.length} member(s) have resolved profiles and elevations`, unresolvedMembers);
|
|
@@ -72129,8 +72282,8 @@ function evaluateSteelRead(context) {
|
|
|
72129
72282
|
const reviewByJoint = new Map(proof3.jointReviews.map((row) => [row.jointId, row]));
|
|
72130
72283
|
const changedReviewMissing = [];
|
|
72131
72284
|
const currentJointHashes = /* @__PURE__ */ new Map();
|
|
72132
|
-
if (
|
|
72133
|
-
for (const joint of context.current.joints.filter(
|
|
72285
|
+
if (isObj8(context.current) && Array.isArray(context.current.joints)) {
|
|
72286
|
+
for (const joint of context.current.joints.filter(isObj8)) if (typeof joint.id === "string") {
|
|
72134
72287
|
const digest2 = jointDependencyHash(context.current, joint.id);
|
|
72135
72288
|
if (digest2) currentJointHashes.set(joint.id, digest2);
|
|
72136
72289
|
}
|
|
@@ -72380,8 +72533,16 @@ async function runNativeInitialRead(opts) {
|
|
|
72380
72533
|
const checked = validateSteelFilter(candidate, opts.source?.files.map((file) => file.sha256.toLowerCase()));
|
|
72381
72534
|
if (!checked.ok) throw new ContractTransactionError("This filter no longer matches the attached drawing set. Reload the Drawing Filter and review it again.", "filter-invalid", checked.errors);
|
|
72382
72535
|
if (contractHash(shell.filter) !== contractHash(candidate.filter)) throw new ContractTransactionError("the submitted model does not contain the exact saved Drawing Filter", "filter-changed");
|
|
72383
|
-
const
|
|
72536
|
+
const binding = shellBinding(shell, candidate);
|
|
72537
|
+
const deviation = binding.deviations[0];
|
|
72384
72538
|
if (deviation) throw new ContractTransactionError(deviation.detail, "shell-changed");
|
|
72539
|
+
if (binding.usedUnbound.length && !opts.readAudit) {
|
|
72540
|
+
throw new ContractTransactionError(
|
|
72541
|
+
`this read authors ${binding.usedUnbound.length} field(s) the saved Drawing Filter checkpoint does not state, which requires a completion audit to record it \u2014 re-attach the drawing set so the request is created under the completion-audit policy`,
|
|
72542
|
+
"shell-authored-without-audit",
|
|
72543
|
+
{ unbound: binding.usedUnbound, maskHash: binding.maskHash }
|
|
72544
|
+
);
|
|
72545
|
+
}
|
|
72385
72546
|
const normalized = normalizeSteelMemberEndsForRead(opts.candidate);
|
|
72386
72547
|
let readAuditReport;
|
|
72387
72548
|
let storedReadAudit;
|
|
@@ -76763,6 +76924,9 @@ function logSteelAuditEvent(log2, input) {
|
|
|
76763
76924
|
durationMs: Math.max(0, Date.now() - input.startedAt)
|
|
76764
76925
|
}, "steel read audit event");
|
|
76765
76926
|
}
|
|
76927
|
+
function bindsShellInvariants(headVersion, current) {
|
|
76928
|
+
return headVersion === 0 && isExactFilterCheckpointShell(current);
|
|
76929
|
+
}
|
|
76766
76930
|
function loadAuthoritativeSteelAuditState(project, requestId, attestation, allowedStatuses = /* @__PURE__ */ new Set(["pending"])) {
|
|
76767
76931
|
const request = getRequest(requestId);
|
|
76768
76932
|
if (!request || request.type !== "revision-read" || request.project !== project.id || request.appId !== project.app || request.settledVersion !== void 0 || !allowedStatuses.has(request.status)) {
|
|
@@ -76803,7 +76967,7 @@ function loadAuthoritativeSteelAuditState(project, requestId, attestation, allow
|
|
|
76803
76967
|
// dispatch condition of the commit route, which is what makes the audit's verdict predict the
|
|
76804
76968
|
// publish's: same question, same two clauses. A revision read gets `false` and is not asked to
|
|
76805
76969
|
// preserve a grid it is entitled to rewrite.
|
|
76806
|
-
initialFilterCheckpoint: (listVersions(project.id)[0]?.n ?? 0
|
|
76970
|
+
initialFilterCheckpoint: bindsShellInvariants(listVersions(project.id)[0]?.n ?? 0, current)
|
|
76807
76971
|
};
|
|
76808
76972
|
}
|
|
76809
76973
|
function preparedManifestNeedsRegeneration(project, request) {
|
|
@@ -78146,7 +78310,7 @@ function registerRevisionRoutes(app, deps = {}) {
|
|
|
78146
78310
|
}
|
|
78147
78311
|
const currentForEvidence = readAcceptedForRequest(project.app, project.id, "read");
|
|
78148
78312
|
const guardError = revisionReadContractError(resolveTemplateId(project.app), req.body.contract, currentForEvidence, {
|
|
78149
|
-
initialFilterCheckpoint: head
|
|
78313
|
+
initialFilterCheckpoint: bindsShellInvariants(head, currentForEvidence)
|
|
78150
78314
|
});
|
|
78151
78315
|
if (guardError) {
|
|
78152
78316
|
return reply.status(400).send({
|
|
@@ -78192,6 +78356,7 @@ function registerRevisionRoutes(app, deps = {}) {
|
|
|
78192
78356
|
return { ok: true, version, contractType: VECTOR_V1 };
|
|
78193
78357
|
}
|
|
78194
78358
|
if (head === 0 && storedContractType(project.app, project.id) === STEEL_V2 && declaredTypeOf(req.body.contract) === STEEL_V2) {
|
|
78359
|
+
const commitStartedAt = Date.now();
|
|
78195
78360
|
try {
|
|
78196
78361
|
const committed = await runNativeInitialRead({
|
|
78197
78362
|
appId: project.app,
|
|
@@ -78220,6 +78385,16 @@ function registerRevisionRoutes(app, deps = {}) {
|
|
|
78220
78385
|
} : {}
|
|
78221
78386
|
});
|
|
78222
78387
|
const version = listVersions(project.id).find((row) => row.n === committed.versionN);
|
|
78388
|
+
if (committed.readAudit) {
|
|
78389
|
+
logSteelAuditEvent(req.log, {
|
|
78390
|
+
phase: "submit",
|
|
78391
|
+
projectId: project.id,
|
|
78392
|
+
requestId: request.id,
|
|
78393
|
+
outcome: `published-v${committed.versionN}`,
|
|
78394
|
+
startedAt: commitStartedAt,
|
|
78395
|
+
report: committed.readAudit
|
|
78396
|
+
});
|
|
78397
|
+
}
|
|
78223
78398
|
broadcast(contractChangedWithReason(project.app, project.id, committed.etag, committed.storeRevision, "revision-read"));
|
|
78224
78399
|
settleCommittedRevisionRequest(request, committed.versionN, req.log);
|
|
78225
78400
|
if (requiresSteelAudit) {
|
|
@@ -79672,38 +79847,13 @@ function registerConnectionRoutes(app) {
|
|
|
79672
79847
|
registerReviewVerb(app, "untrack", "/api/projects/:id/connections/:jointId/untrack");
|
|
79673
79848
|
}
|
|
79674
79849
|
|
|
79675
|
-
// steel-intersection-ref.ts
|
|
79676
|
-
var axisId = (v) => {
|
|
79677
|
-
if (typeof v !== "string") return null;
|
|
79678
|
-
const t = v.trim();
|
|
79679
|
-
return t.length > 0 ? t : null;
|
|
79680
|
-
};
|
|
79681
|
-
var isObj7 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
79682
|
-
function intersectionRef(v) {
|
|
79683
|
-
if (v === void 0 || v === null) return { state: "absent" };
|
|
79684
|
-
if (isObj7(v)) {
|
|
79685
|
-
const unknown = Object.keys(v).filter((k) => k !== "xAxisId" && k !== "yAxisId");
|
|
79686
|
-
if (unknown.length) {
|
|
79687
|
-
return { state: "invalid", why: `an intersection has only \`xAxisId\` and \`yAxisId\` \u2014 ${unknown.map((k) => `\`${k}\``).join(", ")} ${unknown.length > 1 ? "are" : "is"} not recognised${unknown.some((k) => k === "axis_x" || k === "axis_y") ? "; registration names grid axis IDS now, never labels" : ""}` };
|
|
79688
|
-
}
|
|
79689
|
-
const x = axisId(v.xAxisId), y = axisId(v.yAxisId);
|
|
79690
|
-
if (x && y) return { state: "valid", x, y };
|
|
79691
|
-
const missing = [!x ? "xAxisId" : null, !y ? "yAxisId" : null].filter(Boolean).join(" and ");
|
|
79692
|
-
return { state: "invalid", why: `${missing} must each be a non-blank grid axis id` };
|
|
79693
|
-
}
|
|
79694
|
-
return { state: "invalid", why: `a ${Array.isArray(v) ? "list" : typeof v} names no grid intersection; expected { xAxisId, yAxisId }` };
|
|
79695
|
-
}
|
|
79696
|
-
function canonicalRef(r) {
|
|
79697
|
-
return { xAxisId: r.x, yAxisId: r.y };
|
|
79698
|
-
}
|
|
79699
|
-
|
|
79700
79850
|
// steel-prepass-route.ts
|
|
79701
79851
|
var ROOT_KEYS = ["filter"];
|
|
79702
79852
|
var PLAN_KEYS = ["datum_at", "datum_ref", "control2_at", "control2_ref", "elevation_in"];
|
|
79703
|
-
var
|
|
79853
|
+
var isObj9 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
79704
79854
|
function filterSheetsOf(doc) {
|
|
79705
|
-
const filter =
|
|
79706
|
-
return filter && Array.isArray(filter.sheets) ? filter.sheets.filter(
|
|
79855
|
+
const filter = isObj9(doc.filter) ? doc.filter : null;
|
|
79856
|
+
return filter && Array.isArray(filter.sheets) ? filter.sheets.filter(isObj9) : [];
|
|
79707
79857
|
}
|
|
79708
79858
|
function registerSteelPrepassRoute(app, deps) {
|
|
79709
79859
|
app.put("/api/projects/:id/steel-prepass", { bodyLimit: STEEL_CONTRACT_BODY_LIMIT_BYTES }, async (req, reply) => {
|
|
@@ -79717,7 +79867,7 @@ function registerSteelPrepassRoute(app, deps) {
|
|
|
79717
79867
|
error: "Reload the Drawing Filter and send its exact ETag before saving."
|
|
79718
79868
|
});
|
|
79719
79869
|
}
|
|
79720
|
-
if (!
|
|
79870
|
+
if (!isObj9(req.body)) return reply.status(400).send({ ok: false, error: "body must be an object" });
|
|
79721
79871
|
const body = req.body;
|
|
79722
79872
|
const unknownRoot = Object.keys(body).filter((key2) => ![...ROOT_KEYS, "sheets", "requestId"].includes(key2));
|
|
79723
79873
|
if (unknownRoot.length) {
|
|
@@ -79727,12 +79877,12 @@ function registerSteelPrepassRoute(app, deps) {
|
|
|
79727
79877
|
error: `Drawing Filter pre-read cannot write ${unknownRoot.map((key2) => `\`${key2}\``).join(", ")}. Members and model geometry go through the drawing-read review.`
|
|
79728
79878
|
});
|
|
79729
79879
|
}
|
|
79730
|
-
if (body.sheets !== void 0 && !
|
|
79880
|
+
if (body.sheets !== void 0 && !isObj9(body.sheets)) {
|
|
79731
79881
|
return reply.status(400).send({ ok: false, error: "`sheets` must be an object keyed by sheet name" });
|
|
79732
79882
|
}
|
|
79733
|
-
const sheets =
|
|
79883
|
+
const sheets = isObj9(body.sheets) ? body.sheets : {};
|
|
79734
79884
|
for (const [sheet, patch2] of Object.entries(sheets)) {
|
|
79735
|
-
if (!
|
|
79885
|
+
if (!isObj9(patch2)) return reply.status(400).send({ ok: false, error: `sheets["${sheet}"] must be an object` });
|
|
79736
79886
|
const unknown = Object.keys(patch2).filter((key2) => !PLAN_KEYS.includes(key2));
|
|
79737
79887
|
if (unknown.length) {
|
|
79738
79888
|
return reply.status(400).send({
|
|
@@ -79754,7 +79904,7 @@ function registerSteelPrepassRoute(app, deps) {
|
|
|
79754
79904
|
return reply.status(400).send({ ok: false, code: "prepass-not-steel", error: `this project does not hold a ${STEEL_V2} document` });
|
|
79755
79905
|
}
|
|
79756
79906
|
let doc = structuredClone(current);
|
|
79757
|
-
const plans = Array.isArray(doc.plans) ? doc.plans.filter(
|
|
79907
|
+
const plans = Array.isArray(doc.plans) ? doc.plans.filter(isObj9) : [];
|
|
79758
79908
|
const names2 = plans.map((plan) => rawPlanViewId(plan) ?? "");
|
|
79759
79909
|
const missing = Object.keys(sheets).filter((sheet) => !names2.includes(sheet));
|
|
79760
79910
|
if (missing.length) return reply.status(400).send({ ok: false, code: "prepass-unknown-sheet", error: `unknown drawing view: ${missing.join(", ")}` });
|
|
@@ -79771,7 +79921,7 @@ function registerSteelPrepassRoute(app, deps) {
|
|
|
79771
79921
|
const sheet = rawPlanViewId(plan) ?? "";
|
|
79772
79922
|
const viewName = viewLabels.get(sheet) ?? sheet;
|
|
79773
79923
|
const patch2 = sheets[sheet];
|
|
79774
|
-
if (!
|
|
79924
|
+
if (!isObj9(patch2)) continue;
|
|
79775
79925
|
if (plan.viewKind !== "plan" && PLAN_KEYS.some((key2) => patch2[key2] !== void 0)) {
|
|
79776
79926
|
return reply.status(400).send({
|
|
79777
79927
|
ok: false,
|
|
@@ -79783,7 +79933,7 @@ function registerSteelPrepassRoute(app, deps) {
|
|
|
79783
79933
|
if (patch2[key2] === void 0) continue;
|
|
79784
79934
|
if (key2 === "datum_ref" || key2 === "control2_ref") {
|
|
79785
79935
|
const parsed = intersectionRef(patch2[key2]);
|
|
79786
|
-
if (parsed.state !== "valid" || !
|
|
79936
|
+
if (parsed.state !== "valid" || !isObj9(patch2[key2])) {
|
|
79787
79937
|
refErrors.push(`sheets["${sheet}"].${key2}`);
|
|
79788
79938
|
continue;
|
|
79789
79939
|
}
|
|
@@ -86373,7 +86523,7 @@ var changedKeys = (before, after) => {
|
|
|
86373
86523
|
};
|
|
86374
86524
|
|
|
86375
86525
|
// approval-contract-adapters.ts
|
|
86376
|
-
var
|
|
86526
|
+
var isObj10 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
86377
86527
|
var arr4 = (v) => Array.isArray(v) ? v : [];
|
|
86378
86528
|
var eq = (a, b) => canonicalJson(a) === canonicalJson(b);
|
|
86379
86529
|
var own = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
|
@@ -86397,8 +86547,8 @@ function groupOf(opts) {
|
|
|
86397
86547
|
dependencyGroup: id,
|
|
86398
86548
|
technicalFacts: keys.slice(0, 20).map((key2) => ({
|
|
86399
86549
|
label: key2,
|
|
86400
|
-
...
|
|
86401
|
-
...
|
|
86550
|
+
...isObj10(opts.before) && own(opts.before, key2) ? { before: displayValue(opts.before[key2]) } : {},
|
|
86551
|
+
...isObj10(opts.after) && own(opts.after, key2) ? { after: displayValue(opts.after[key2]) } : {}
|
|
86402
86552
|
}))
|
|
86403
86553
|
};
|
|
86404
86554
|
}
|
|
@@ -86430,7 +86580,7 @@ function keyedCollection(opts) {
|
|
|
86430
86580
|
const map = /* @__PURE__ */ new Map();
|
|
86431
86581
|
const order = [];
|
|
86432
86582
|
for (const value of values2) {
|
|
86433
|
-
if (!
|
|
86583
|
+
if (!isObj10(value)) return null;
|
|
86434
86584
|
const key2 = opts.keyOf(value);
|
|
86435
86585
|
if (!key2 || map.has(key2)) return null;
|
|
86436
86586
|
map.set(key2, value);
|
|
@@ -86452,11 +86602,11 @@ function keyedCollection(opts) {
|
|
|
86452
86602
|
parent: opts.parent,
|
|
86453
86603
|
entity: key2,
|
|
86454
86604
|
category: opts.category,
|
|
86455
|
-
headline: opts.labelOf(
|
|
86605
|
+
headline: opts.labelOf(isObj10(bv) ? bv : av, key2),
|
|
86456
86606
|
location: opts.parent ? `${parentLabel(opts)} \xB7 ${key2}` : key2,
|
|
86457
86607
|
before: av,
|
|
86458
86608
|
after: bv,
|
|
86459
|
-
references:
|
|
86609
|
+
references: isObj10(bv) ? opts.referencesOf?.(bv) : []
|
|
86460
86610
|
}, opts.groups);
|
|
86461
86611
|
return { key: key2, node, inBase: a.map.has(key2), inDraft: b.map.has(key2) };
|
|
86462
86612
|
});
|
|
@@ -86485,7 +86635,7 @@ function objectWithOwnedKeys(base, draft, owned, groups, type) {
|
|
|
86485
86635
|
return objectNode(children);
|
|
86486
86636
|
}
|
|
86487
86637
|
function nestedEntity(base, draft, opts, groups) {
|
|
86488
|
-
if (base === ABSENT || draft === ABSENT || !
|
|
86638
|
+
if (base === ABSENT || draft === ABSENT || !isObj10(base) || !isObj10(draft)) {
|
|
86489
86639
|
return atomicChanged({
|
|
86490
86640
|
type: opts.type,
|
|
86491
86641
|
collection: opts.collection,
|
|
@@ -86555,9 +86705,9 @@ function token(type, collection, parent, id) {
|
|
|
86555
86705
|
function movedAcrossParents(baseParents, draftParents, childKey) {
|
|
86556
86706
|
const locations = (parents) => {
|
|
86557
86707
|
const out = /* @__PURE__ */ new Map();
|
|
86558
|
-
for (const parent of arr4(parents)) if (
|
|
86708
|
+
for (const parent of arr4(parents)) if (isObj10(parent)) {
|
|
86559
86709
|
const parentId = typeof parent.sheet === "string" ? parent.sheet : typeof parent.id === "string" ? parent.id : "";
|
|
86560
|
-
for (const child of arr4(parent[childKey])) if (
|
|
86710
|
+
for (const child of arr4(parent[childKey])) if (isObj10(child) && typeof child.id === "string") {
|
|
86561
86711
|
const list = out.get(child.id) ?? [];
|
|
86562
86712
|
list.push(parentId);
|
|
86563
86713
|
out.set(child.id, list);
|
|
@@ -86601,7 +86751,7 @@ function unionDependencies(groups) {
|
|
|
86601
86751
|
}
|
|
86602
86752
|
function planLabeller(base, draft) {
|
|
86603
86753
|
const byId = /* @__PURE__ */ new Map();
|
|
86604
|
-
for (const row of [...arr4(
|
|
86754
|
+
for (const row of [...arr4(isObj10(draft) ? draft.plans : null), ...arr4(isObj10(base) ? base.plans : null)]) {
|
|
86605
86755
|
const key2 = rawPlanViewId(row);
|
|
86606
86756
|
if (key2 !== null && !byId.has(key2)) byId.set(key2, row);
|
|
86607
86757
|
}
|
|
@@ -86623,7 +86773,7 @@ function fallback(base, draft, type, reason) {
|
|
|
86623
86773
|
return wholeVersionPartition(base, draft, reason, group);
|
|
86624
86774
|
}
|
|
86625
86775
|
function buildKnown(base, draft, type) {
|
|
86626
|
-
if (!
|
|
86776
|
+
if (!isObj10(base) || !isObj10(draft)) return fallback(base, draft, type, "incomplete-comparison");
|
|
86627
86777
|
const groups = [];
|
|
86628
86778
|
const owned = /* @__PURE__ */ new Map();
|
|
86629
86779
|
let reason;
|
|
@@ -86641,7 +86791,7 @@ function buildKnown(base, draft, type) {
|
|
|
86641
86791
|
keyOf: (v) => typeof v.id === "string" ? v.id : null,
|
|
86642
86792
|
labelOf: (v, id) => String(v.mark ?? id),
|
|
86643
86793
|
groups,
|
|
86644
|
-
referencesOf: (v) => arr4(v.ends).flatMap((end) =>
|
|
86794
|
+
referencesOf: (v) => arr4(v.ends).flatMap((end) => isObj10(end) && typeof end.conn === "string" ? [token(type, "connection", null, end.conn)] : [])
|
|
86645
86795
|
}));
|
|
86646
86796
|
const planLabel = planLabeller(base, draft);
|
|
86647
86797
|
add("plans", keyedCollection({
|
|
@@ -86665,7 +86815,7 @@ function buildKnown(base, draft, type) {
|
|
|
86665
86815
|
category: "Observation",
|
|
86666
86816
|
keyOf: (v) => typeof v.id === "string" ? v.id : null,
|
|
86667
86817
|
labelOf: (_v2, id) => `Observation ${id}`,
|
|
86668
|
-
referencesOf: (v) =>
|
|
86818
|
+
referencesOf: (v) => isObj10(v.binding) && Array.isArray(v.binding.memberIds) ? v.binding.memberIds.filter((id) => typeof id === "string").map((id) => token(type, "member", null, id)) : []
|
|
86669
86819
|
},
|
|
86670
86820
|
{
|
|
86671
86821
|
key: "dims",
|
|
@@ -86743,7 +86893,7 @@ function buildKnown(base, draft, type) {
|
|
|
86743
86893
|
labelOf: (v, id) => String(v.label ?? id),
|
|
86744
86894
|
referencesOf: (v) => [
|
|
86745
86895
|
...arr4(v.elementIds).filter((x) => typeof x === "string").map((id) => token(type, "element", key2, id)),
|
|
86746
|
-
...[
|
|
86896
|
+
...[isObj10(v.extrude) ? v.extrude.from : null, isObj10(v.extrude) ? v.extrude.to : null].filter((x) => typeof x === "string").map((id) => token(type, "datum", null, id))
|
|
86747
86897
|
]
|
|
86748
86898
|
}
|
|
86749
86899
|
]
|
|
@@ -86760,7 +86910,7 @@ function buildKnown(base, draft, type) {
|
|
|
86760
86910
|
groups
|
|
86761
86911
|
}));
|
|
86762
86912
|
const links = [...arr4(base.links), ...arr4(draft.links)];
|
|
86763
|
-
if (links.every((v) =>
|
|
86913
|
+
if (links.every((v) => isObj10(v) && typeof v.id === "string")) add("links", keyedCollection({
|
|
86764
86914
|
type,
|
|
86765
86915
|
collection: "link",
|
|
86766
86916
|
category: "Link",
|
package/dist/web/app.css
CHANGED
|
@@ -5184,6 +5184,27 @@ table.hist tr.current td { background:var(--accent-soft); }
|
|
|
5184
5184
|
.hist-change-list li::marker { color:var(--text-dim); }
|
|
5185
5185
|
.hist-change-list .hist-change-more { color:var(--text-dim); font-style:italic; }
|
|
5186
5186
|
.hist-change-caution { margin-top:5px; color:var(--warn); font-size:11px; }
|
|
5187
|
+
/* An audit NOTE, deliberately not the amber caution above. `--warn` is this pane's "you may want to
|
|
5188
|
+
act on this" register; a read that filled in what the saved checkpoint never stated is a fact the
|
|
5189
|
+
owner should know and nothing to act on, so it takes the neutral accent-dim rail `.hist-working`
|
|
5190
|
+
and `.hist-empty` already use for "absence of a signature, not an error". Same tokens, no new
|
|
5191
|
+
colour — the two registers just have to be told apart at a glance when a version carries both. */
|
|
5192
|
+
.hist-change-note { margin-top:6px; padding:7px 10px; background:var(--surface-2); border:1px solid var(--border);
|
|
5193
|
+
border-left:3px solid var(--accent-dim); border-radius:6px; font-size:11px; color:var(--text-muted); }
|
|
5194
|
+
.hist-change-note strong { color:var(--text); font-weight:600; }
|
|
5195
|
+
.hist-change-tech { margin-top:6px; color:var(--text-dim); }
|
|
5196
|
+
/* The native disclosure triangle is a browser default and must not leak through — every other
|
|
5197
|
+
<details> in this app hides it and supplies its own caret (.req-technical, .req-run-output,
|
|
5198
|
+
.ws-archived-summary, .kb-adjust-summary, .import-failed-summary). Follows that majority rather
|
|
5199
|
+
than .approval-tech, which is an unthemed pre-existing gap. */
|
|
5200
|
+
.hist-change-tech > summary { width:max-content; max-width:100%; cursor:pointer; color:var(--text-muted);
|
|
5201
|
+
user-select:none; list-style:none; }
|
|
5202
|
+
.hist-change-tech > summary::-webkit-details-marker { display:none; }
|
|
5203
|
+
.hist-change-tech > summary::before { content:'▸'; margin-right:6px; color:var(--text-dim); }
|
|
5204
|
+
.hist-change-tech[open] > summary::before { content:'▾'; }
|
|
5205
|
+
.hist-change-tech > summary:hover { color:var(--text); }
|
|
5206
|
+
.hist-change-tech > summary:focus-visible { color:var(--text); outline:2px solid var(--accent); outline-offset:2px; border-radius:2px; }
|
|
5207
|
+
.hist-change-tech .hist-change-more { display:block; margin-top:3px; font-style:italic; }
|
|
5187
5208
|
.hist .btn-mini, .ws-drawings-bar .btn-mini, .ws-revision-card .btn-mini, .modal.revreview .btn-mini { background:none; border:1px solid var(--border-strong); color:var(--text-muted); border-radius:6px;
|
|
5188
5209
|
padding:4px 10px; font-size:11px; cursor:pointer; white-space:nowrap; }
|
|
5189
5210
|
.hist .btn-mini:hover, .ws-drawings-bar .btn-mini:hover, .ws-revision-card .btn-mini:hover, .modal.revreview .btn-mini:hover { color:var(--text); border-color:var(--accent); }
|
|
@@ -675,6 +675,17 @@
|
|
|
675
675
|
why: 'Close keeps the review. This separate action asks for confirmation before removing it.',
|
|
676
676
|
});
|
|
677
677
|
|
|
678
|
+
def('shell.history-authored-fields', {
|
|
679
|
+
label: 'Which fields (technical)',
|
|
680
|
+
actsOn: 'Expands the exact contract paths this read filled in beyond the saved Drawing Filter for {instance}',
|
|
681
|
+
group: 'In the project workspace',
|
|
682
|
+
persistence: 'none',
|
|
683
|
+
interaction: 'mode',
|
|
684
|
+
risk: [],
|
|
685
|
+
guidance: 'on-demand',
|
|
686
|
+
why: 'The note above it says WHAT KIND of field was supplied; this lists the exact ones, for whoever wants the evidence rather than the summary.',
|
|
687
|
+
});
|
|
688
|
+
|
|
678
689
|
def('shell.revision-failure-dismiss', {
|
|
679
690
|
label: 'Dismiss failed drawing read',
|
|
680
691
|
actsOn: 'Removes this failed drawing-read request from the project workspace',
|
package/dist/web/workspaces.js
CHANGED
|
@@ -7032,6 +7032,86 @@
|
|
|
7032
7032
|
' detail/connection markers, but modeled 0 joints in this version.</div>';
|
|
7033
7033
|
}
|
|
7034
7034
|
|
|
7035
|
+
/**
|
|
7036
|
+
* WHAT THE READ AUTHORED that the saved Drawing Filter checkpoint never stated (#962b).
|
|
7037
|
+
*
|
|
7038
|
+
* The checkpoint is the document the human approved, and a first read may fill it in but not restate
|
|
7039
|
+
* it. Some upgraded checkpoints state things this build cannot honour — an empty grid, a registration
|
|
7040
|
+
* reference in a retired spelling, a drawing view with no registration at all — and the read is now
|
|
7041
|
+
* allowed to author exactly those. That is an approval fact, so the person who approved the document
|
|
7042
|
+
* has to be able to see it happened; a server log is a record for an operator, not for them.
|
|
7043
|
+
*
|
|
7044
|
+
* NOT the amber caution beside it. Nothing here needs acting on: the version published and is
|
|
7045
|
+
* correct. It reads in the neutral register `.hist-working` uses, and it leads with the reassurance,
|
|
7046
|
+
* because the first question anyone has on seeing this next to "AI read" is whether the AI overrode
|
|
7047
|
+
* what they approved. It did not — that is the whole point of the guard it passed.
|
|
7048
|
+
*
|
|
7049
|
+
* PARSED, NEVER ECHOED, following `detailReconciliationWarningHtml` exactly: the audit's own sentence
|
|
7050
|
+
* is written for a reader-AI and an operator, and it carries a mask hash that identifies nothing a
|
|
7051
|
+
* human can act on. A shape this does not recognise renders nothing rather than dumping that prose
|
|
7052
|
+
* at a detailer.
|
|
7053
|
+
*/
|
|
7054
|
+
const SHELL_AUTHORED_REASON = {
|
|
7055
|
+
'grid-unstated': 'a structural grid',
|
|
7056
|
+
'unreadable-reference': 'a readable drawing reference',
|
|
7057
|
+
'unregistered-view': 'where a drawing view sits in the model',
|
|
7058
|
+
};
|
|
7059
|
+
|
|
7060
|
+
function shellAuthoredNoteHtml(v) {
|
|
7061
|
+
if (!v || v.kind !== 'revision-read') return '';
|
|
7062
|
+
const audit = v.source && v.source.readAudit;
|
|
7063
|
+
const report = audit && audit.report;
|
|
7064
|
+
if (!audit || audit.version !== 1 || !report || report.version !== 1
|
|
7065
|
+
|| report.policy !== 'steel-read-completion/v1' || !Array.isArray(report.checks)) return '';
|
|
7066
|
+
const matching = report.checks.filter((row) => row && typeof row === 'object' && row.id === 'shell-preserved');
|
|
7067
|
+
if (matching.length !== 1) return '';
|
|
7068
|
+
const check = matching[0];
|
|
7069
|
+
if (check.status !== 'warning' || typeof check.detail !== 'string') return '';
|
|
7070
|
+
// ANCHORED END TO END, a 64-hex mask, and the exact closing clause: a regex that accepts any tail
|
|
7071
|
+
// would let a reworded or truncated audit sentence through and be read as the one this UI knows.
|
|
7072
|
+
// The reason CODES are the deliberate exception — an unmapped one falls back to itself below
|
|
7073
|
+
// rather than hiding the whole note, because a build that learns a new reason must not go silent
|
|
7074
|
+
// about a read having authored something. (Format anchoring found by review.)
|
|
7075
|
+
const match = /^([1-9]\d*) field\(s\) authored where the saved Drawing Filter checkpoint states nothing this build can honour \(([a-z][a-z-]*(?:, [a-z][a-z-]*)*); mask [0-9a-f]{64}\) — every OTHER field the checkpoint states is unchanged$/.exec(check.detail);
|
|
7076
|
+
if (!match) return '';
|
|
7077
|
+
const fields = Number(match[1]);
|
|
7078
|
+
if (!Number.isSafeInteger(fields)) return '';
|
|
7079
|
+
// `Object.hasOwn`, never a bare lookup: an inherited key would silently answer for a reason code
|
|
7080
|
+
// nobody wrote a phrase for. An unmapped code falls back to itself, readably, rather than blank.
|
|
7081
|
+
const phrases = match[2].split(', ').map((code) => (Object.hasOwn(SHELL_AUTHORED_REASON, code)
|
|
7082
|
+
? SHELL_AUTHORED_REASON[code]
|
|
7083
|
+
: code.replace(/-/g, ' ')));
|
|
7084
|
+
const listed = phrases.length > 1
|
|
7085
|
+
? `${phrases.slice(0, -1).join(', ')} or ${phrases[phrases.length - 1]}`
|
|
7086
|
+
: phrases[0];
|
|
7087
|
+
// The JSONPath list is evidence for whoever wants it, not copy — collapsed, and labelled technical.
|
|
7088
|
+
const rawSamples = Array.isArray(check.samples) ? check.samples : [];
|
|
7089
|
+
const samples = rawSamples.filter((row) => typeof row === 'string')
|
|
7090
|
+
.map((row) => row.replace(/ \([a-z-]+, [a-z-]+\)$/, ''));
|
|
7091
|
+
// The audit caps its sample list, so the count and the list can legitimately disagree. Say so
|
|
7092
|
+
// rather than letting a reader count nine rows under a headline that says thirteen.
|
|
7093
|
+
// From the RAW length, not the filtered one: a sample that is not a string is still a sample the
|
|
7094
|
+
// audit sent, so counting only the ones this UI could render would over-report what is missing.
|
|
7095
|
+
const undisclosed = fields - rawSamples.length;
|
|
7096
|
+
// The disclosure is a control a person invokes, so it carries its own command id and instance —
|
|
7097
|
+
// otherwise `?` on it falls back to whatever the DOM happens to expose. Instanced by VERSION,
|
|
7098
|
+
// because a project can carry one of these notes per read.
|
|
7099
|
+
const instance = `version ${Number(v.n)}`;
|
|
7100
|
+
const tech = samples.length
|
|
7101
|
+
? `<details class="hist-change-tech"><summary data-command-id="shell.history-authored-fields#${escapeAttr(String(v.n))}" ` +
|
|
7102
|
+
`data-command-instance-label="${escapeAttr(instance)}">Which fields (technical)</summary>` +
|
|
7103
|
+
samples.map((path) => `<span class="rev-issue-path">${escapeHtml(path)}</span>`).join('') +
|
|
7104
|
+
(undisclosed > 0 ? `<span class="hist-change-more">${escapeHtml(`${undisclosed} more not listed.`)}</span>` : '') +
|
|
7105
|
+
'</details>'
|
|
7106
|
+
: '';
|
|
7107
|
+
return '<div class="hist-change-note" role="note"><span aria-hidden="true">●</span> ' +
|
|
7108
|
+
'<strong>Some fields were filled in beyond the saved Drawing Filter.</strong> ' +
|
|
7109
|
+
escapeHtml(`The checkpoint you saved did not state ${listed}, so this read supplied ` +
|
|
7110
|
+
`${phrases.length > 1 ? 'them' : 'it'} — ${fields} ${fields === 1 ? 'field' : 'fields'} in total. ` +
|
|
7111
|
+
'Everything else the checkpoint stated was kept exactly as approved.') +
|
|
7112
|
+
`${tech}</div>`;
|
|
7113
|
+
}
|
|
7114
|
+
|
|
7035
7115
|
function changeCellHtml(v, meta) {
|
|
7036
7116
|
const s = v.changeSummary;
|
|
7037
7117
|
const n = Number(v.n);
|
|
@@ -7042,7 +7122,7 @@
|
|
|
7042
7122
|
'data-tip="Show the complete member-by-member comparison">' +
|
|
7043
7123
|
'<span class="hd-caret">▸</span><span class="hd-toggle-label">View detailed changes</span></button>'
|
|
7044
7124
|
: '';
|
|
7045
|
-
const detailWarning = detailReconciliationWarningHtml(v)
|
|
7125
|
+
const detailWarning = `${detailReconciliationWarningHtml(v)}${shellAuthoredNoteHtml(v)}`;
|
|
7046
7126
|
if (!s || !Array.isArray(s.bullets)) {
|
|
7047
7127
|
return `<div class="hist-event">${escapeHtml(v.message)}</div>${detailWarning}${toggle}`;
|
|
7048
7128
|
}
|