@floless/app 0.133.2 → 0.134.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 +116 -32
- package/dist/web/app.css +65 -0
- package/dist/web/app.js +32 -0
- package/dist/web/aware.js +243 -7
- package/dist/web/commands-shell.js +32 -0
- package/dist/web/commands-steel.js +22 -0
- package/dist/web/index.html +13 -0
- package/dist/web/instructor.js +1 -1
- package/dist/web/steel-3d-core.js +87 -0
- package/dist/web/steel-3d-view.js +363 -6
- package/dist/web/steel-editor.html +179 -19
- package/dist/web/workspaces.js +186 -13
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -55037,7 +55037,7 @@ function appVersion() {
|
|
|
55037
55037
|
return resolveVersion({
|
|
55038
55038
|
isSea: isSea2(),
|
|
55039
55039
|
sqVersionXml: readSqVersionXml(),
|
|
55040
|
-
define: true ? "0.
|
|
55040
|
+
define: true ? "0.134.0" : void 0,
|
|
55041
55041
|
pkgVersion: readPkgVersion()
|
|
55042
55042
|
});
|
|
55043
55043
|
}
|
|
@@ -55053,7 +55053,7 @@ function resolveChannel(s) {
|
|
|
55053
55053
|
function appChannel() {
|
|
55054
55054
|
return resolveChannel({
|
|
55055
55055
|
isSea: isSea2(),
|
|
55056
|
-
define: true ? "0.
|
|
55056
|
+
define: true ? "0.134.0" : void 0,
|
|
55057
55057
|
// argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
|
|
55058
55058
|
// carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
|
|
55059
55059
|
modulePath: process.argv[1]
|
|
@@ -55891,6 +55891,7 @@ function positionOffsetVector(frame, ex, depthFace, widthFace, rotDeg, widthOffM
|
|
|
55891
55891
|
oy * frame.y[2] + oz * frame.z[2]
|
|
55892
55892
|
];
|
|
55893
55893
|
}
|
|
55894
|
+
var POSITION_OFFSET_SNAP_MM = 25.4 / 4;
|
|
55894
55895
|
|
|
55895
55896
|
// canonical-json.ts
|
|
55896
55897
|
var import_node_crypto8 = require("node:crypto");
|
|
@@ -58810,6 +58811,7 @@ var RESERVED_PROJECT_INTERNAL = /(?:^|[\\/])(?:\.member-end-resolution(?:[\\/]|$
|
|
|
58810
58811
|
function isReservedProjectInternalPath(path) {
|
|
58811
58812
|
return RESERVED_PROJECT_INTERNAL.test(path);
|
|
58812
58813
|
}
|
|
58814
|
+
var NO_INCARNATION_REFUSAL = "This project can\u2019t be approved \u2014 duplicate it from the Workspaces list to sign off";
|
|
58813
58815
|
function isProjectId(name) {
|
|
58814
58816
|
return typeof name === "string" && /^[a-z0-9][a-z0-9-]*$/.test(name);
|
|
58815
58817
|
}
|
|
@@ -63430,8 +63432,8 @@ ${isInitialRead ? "Initial" : "Revised"} drawing${req.snapshots.length > 1 ? "s"
|
|
|
63430
63432
|
My note: ${req.instruction}` : "";
|
|
63431
63433
|
const messageHint = isInitialRead ? "<plain-English what was read>" : "<plain-English what changed>";
|
|
63432
63434
|
const vectorPost = `GET the current contract again and keep its ETag, then POST /api/projects/${req.project}/revision-read with { contract, message: "${messageHint}", requestId: "${req.id}" } and If-Match: <that current ETag>. The server derives the base version and source provenance from this queued request. The first completed vector drawing publishes History version 1; later reads stage a review and publish only after confirmation. Do NOT DELETE the request yourself. If you can't read the drawing, POST /api/projects/${req.project}/revision-requests/${req.id}/fail with { error }.`;
|
|
63433
|
-
const post = `After Filter Save, GET /api/projects/${req.project}/revision-requests/${req.id}/steel-manifest and GET the current contract with its ETag. Preserve every server-owned id. Account for every manifest page, layer, candidate line, reference/detail/connection marker, and every new or changed joint in a closed steel-read/v1 attestation. POST /api/projects/${req.project}/revision-read/audit with { requestId: "${req.id}", contract, attestation }; a blocked report is a mandatory checklist, so fix every blocker and repeat until status is read-complete. Then POST the exact same contract and attestation to /api/projects/${req.project}/revision-read with { contract, attestation, message: "${messageHint}", requestId: "${req.id}" } and If-Match: <that exact ETag>. A later read returns 202 for human review; when replacing an existing staged generation, also send If-Match-Stage with its exact stageId. Do NOT DELETE the request yourself. If you can't read the set, POST /api/projects/${req.project}/revision-requests/${req.id}/fail with { error }.`;
|
|
63434
|
-
const manifestPhase = `FIRST POST /api/projects/${req.project}/revision-requests/${req.id}/steel-manifest with {}. This is the only allowed path to inventory source pages and mint Filter element ids. If it returns sheet-identification-required, inspect only the listed pages, establish each sheet identity, and retry with explicit { bindings: [{ pageId, sheet, title?, evidenceKind }] }. Never build or rename Filter geometry yourself.`;
|
|
63435
|
+
const post = `After Filter Save, GET /api/projects/${req.project}/revision-requests/${req.id}/steel-manifest and GET the current contract with its ETag. Preserve every server-owned id. Account for every manifest page, layer, candidate line, reference/detail/connection marker, and every new or changed joint in a closed steel-read/v1 attestation. Keep every disposition reason concise (a short phrase, not a paragraph): the whole attestation has an 8 MB limit, so on a very large set verbose reasons can push it over \u2014 prefer a modeling observation over a written disposition wherever a line is genuinely a member. POST /api/projects/${req.project}/revision-read/audit with { requestId: "${req.id}", contract, attestation }; a blocked report is a mandatory checklist, so fix every blocker and repeat until status is read-complete. Then POST the exact same contract and attestation to /api/projects/${req.project}/revision-read with { contract, attestation, message: "${messageHint}", requestId: "${req.id}" } and If-Match: <that exact ETag>. A later read returns 202 for human review; when replacing an existing staged generation, also send If-Match-Stage with its exact stageId. Do NOT DELETE the request yourself. If you can't read the set, POST /api/projects/${req.project}/revision-requests/${req.id}/fail with { error }.`;
|
|
63436
|
+
const manifestPhase = `FIRST POST /api/projects/${req.project}/revision-requests/${req.id}/steel-manifest with {}. This is the only allowed path to inventory source pages and mint Filter element ids. If it returns sheet-identification-required, inspect only the listed pages, establish each sheet identity, and retry with explicit { bindings: [{ pageId, sheet, title?, evidenceKind }] }. If it returns steel-manifest-over-budget, the drawing set is too large for a single read \u2014 do NOT retry; stop and tell me to split it into smaller revisions (the response lists each sheet's element count). Never build or rename Filter geometry yourself.`;
|
|
63435
63437
|
if ((req.appTemplateId || req.appId) === "vectorize") {
|
|
63436
63438
|
if (isInitialRead) {
|
|
63437
63439
|
return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing was attached \u2014 trace it into this project as its first version (do NOT create a new project). Vectorize the drawing per the floless-app-vectorize skill into a drawing.vector/v1 contract: emit clean, editable 2D vector geometry (sheets \u2192 elements: lines / polylines / curves / text, each on its layer), NOT steel members or a takeoff. A vector PDF is read deterministically (exact geometry, no guessing); a photo, scan or hand sketch is traced by a fenced vision extraction that flags every uncertain stroke (low confidence) for the user's review. ${vectorPost}${snaps}${note}`;
|
|
@@ -67829,7 +67831,7 @@ var import_node_path36 = require("node:path");
|
|
|
67829
67831
|
var STEEL_FILTER_EXTRACTOR_VERSION = "pymupdf-steel-filter/v2";
|
|
67830
67832
|
var STEEL_READ_MAX_SOURCES = 400;
|
|
67831
67833
|
var STEEL_READ_MAX_PAGES = 2e3;
|
|
67832
|
-
var STEEL_READ_MAX_ELEMENTS =
|
|
67834
|
+
var STEEL_READ_MAX_ELEMENTS = 5e4;
|
|
67833
67835
|
function steelFilterGeometryHash(filter) {
|
|
67834
67836
|
const clone2 = filter == null ? filter : JSON.parse(JSON.stringify(filter));
|
|
67835
67837
|
if (clone2 && typeof clone2 === "object" && !Array.isArray(clone2)) {
|
|
@@ -67941,7 +67943,7 @@ function dropSteelReadManifest(requestId) {
|
|
|
67941
67943
|
// steel-read-audit.ts
|
|
67942
67944
|
var STEEL_READ_AUDIT_POLICY = "steel-read-completion/v1";
|
|
67943
67945
|
var MAX_ATTESTATION_BYTES = 8 * 1024 * 1024;
|
|
67944
|
-
var MAX_LINES =
|
|
67946
|
+
var MAX_LINES = STEEL_READ_MAX_ELEMENTS;
|
|
67945
67947
|
var MAX_PAGES = 2e3;
|
|
67946
67948
|
var MAX_JOINTS = 1e4;
|
|
67947
67949
|
var MAX_MEMBERS = 1e4;
|
|
@@ -68064,17 +68066,22 @@ function lineInventory(filter) {
|
|
|
68064
68066
|
function referenceInventory(filter, manifest) {
|
|
68065
68067
|
if (!isObj3(filter)) return [];
|
|
68066
68068
|
const out = [];
|
|
68069
|
+
const seen = /* @__PURE__ */ new Set();
|
|
68067
68070
|
const marker = /(?:\d+\s*[\/-]\s*)?[A-Z]{1,3}-?\d{2,4}/i;
|
|
68068
68071
|
for (const rawSheet of Array.isArray(filter.sheets) ? filter.sheets : []) {
|
|
68069
68072
|
if (!isObj3(rawSheet)) continue;
|
|
68070
68073
|
for (const raw of Array.isArray(rawSheet.elements) ? rawSheet.elements : []) {
|
|
68071
|
-
if (isObj3(raw) && raw.kind === "text" && typeof raw.id === "string" && typeof raw.text === "string" && marker.test(raw.text))
|
|
68074
|
+
if (isObj3(raw) && raw.kind === "text" && typeof raw.id === "string" && typeof raw.text === "string" && marker.test(raw.text)) {
|
|
68075
|
+
out.push({ id: raw.id, text: raw.text });
|
|
68076
|
+
seen.add(raw.id);
|
|
68077
|
+
}
|
|
68072
68078
|
}
|
|
68073
68079
|
}
|
|
68074
68080
|
for (const page of manifest.manifest.pages) for (const candidate of page.candidates ?? []) {
|
|
68075
|
-
if (candidate.kind !== "reference-marker" ||
|
|
68081
|
+
if (candidate.kind !== "reference-marker" || seen.has(candidate.id)) continue;
|
|
68076
68082
|
const element = isObj3(candidate.element) ? candidate.element : {};
|
|
68077
68083
|
out.push({ id: candidate.id, text: typeof element.text === "string" ? element.text : "" });
|
|
68084
|
+
seen.add(candidate.id);
|
|
68078
68085
|
}
|
|
68079
68086
|
return out;
|
|
68080
68087
|
}
|
|
@@ -68209,7 +68216,8 @@ function evaluateSteelRead(context) {
|
|
|
68209
68216
|
add("layer-census", missingLayers.length || foreignLayers.length ? "block" : "pass", missingLayers.length || foreignLayers.length ? "layer census does not exactly cover Filter layers" : `${filterLayers.size} Filter layer(s) classified`, [...missingLayers, ...foreignLayers]);
|
|
68210
68217
|
const observations2 = activeObservationElements(candidate);
|
|
68211
68218
|
const dispositionById = new Map(proof3.lineDispositions.map((row) => [row.elementId, row]));
|
|
68212
|
-
const
|
|
68219
|
+
const linesById = new Map(lines.map((line) => [line.id, line]));
|
|
68220
|
+
const lineIds = new Set(linesById.keys());
|
|
68213
68221
|
const missingLines = [], foreignLines = [], invalidObservations = [], excludedModeled = [];
|
|
68214
68222
|
let observedLines = 0;
|
|
68215
68223
|
for (const line of lines) {
|
|
@@ -68224,7 +68232,7 @@ function evaluateSteelRead(context) {
|
|
|
68224
68232
|
if (!disposition) missingLines.push(line.id);
|
|
68225
68233
|
}
|
|
68226
68234
|
if (disposition?.disposition === "duplicate") {
|
|
68227
|
-
const target =
|
|
68235
|
+
const target = disposition.duplicateOf === void 0 ? void 0 : linesById.get(disposition.duplicateOf);
|
|
68228
68236
|
if (!target || target.id === line.id || target.sourceHash !== line.sourceHash || target.pageId !== line.pageId || target.sheet !== line.sheet || target.geometry !== line.geometry) invalidObservations.push(line.id);
|
|
68229
68237
|
}
|
|
68230
68238
|
}
|
|
@@ -68256,14 +68264,16 @@ function evaluateSteelRead(context) {
|
|
|
68256
68264
|
add("visual-coverage", badPageReviews.length ? "block" : "pass", badPageReviews.length ? "visual reviews do not cover the required source-page bounds" : `${pagesById.size} source page(s) visually reviewed`, badPageReviews);
|
|
68257
68265
|
const refs = referenceInventory(filter, storedManifest);
|
|
68258
68266
|
const refById = new Map(proof3.references.map((row) => [row.elementId, row]));
|
|
68267
|
+
const refIds = new Set(refs.map((ref) => ref.id));
|
|
68259
68268
|
const badRefs = [];
|
|
68260
68269
|
for (const ref of refs) {
|
|
68261
68270
|
const row = refById.get(ref.id);
|
|
68262
68271
|
if (!row || row.status === "resolved" && (!row.targetPageId || !pagesById.has(row.targetPageId))) badRefs.push(ref.id);
|
|
68263
68272
|
}
|
|
68264
|
-
for (const id of refById.keys()) if (!
|
|
68273
|
+
for (const id of refById.keys()) if (!refIds.has(id)) badRefs.push(id);
|
|
68265
68274
|
add("reference-graph", badRefs.length ? "block" : proof3.references.some((row) => row.status === "missing") ? "warning" : "pass", badRefs.length ? "reference candidates are unaccounted or target foreign pages" : `${refs.length} reference marker(s) reach a fixed accounting point`, badRefs);
|
|
68266
68275
|
const markerCandidates = storedManifest.manifest.pages.flatMap((page) => (page.candidates ?? []).filter((candidate2) => candidate2.kind === "detail-marker" || candidate2.kind === "connection-marker"));
|
|
68276
|
+
const markerIds = new Set(markerCandidates.map((marker) => marker.id));
|
|
68267
68277
|
const dispositionByCandidate = new Map(proof3.candidateDispositions.map((row) => [row.elementId, row]));
|
|
68268
68278
|
const jointIdSet = new Set((isObj3(candidate) && Array.isArray(candidate.joints) ? candidate.joints.filter(isObj3) : []).flatMap((joint) => typeof joint.id === "string" ? [joint.id] : []));
|
|
68269
68279
|
const badCandidates = [];
|
|
@@ -68271,7 +68281,7 @@ function evaluateSteelRead(context) {
|
|
|
68271
68281
|
const disposition = dispositionByCandidate.get(marker.id);
|
|
68272
68282
|
if (!disposition || disposition.disposition === "modeled" && (!disposition.jointId || !jointIdSet.has(disposition.jointId))) badCandidates.push(marker.id);
|
|
68273
68283
|
}
|
|
68274
|
-
for (const id of dispositionByCandidate.keys()) if (!
|
|
68284
|
+
for (const id of dispositionByCandidate.keys()) if (!markerIds.has(id)) badCandidates.push(id);
|
|
68275
68285
|
const unresolvedCandidates = proof3.candidateDispositions.filter((row) => row.disposition === "unresolved").map((row) => row.elementId);
|
|
68276
68286
|
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]);
|
|
68277
68287
|
const candidateObj = isObj3(candidate) ? candidate : {};
|
|
@@ -68305,7 +68315,8 @@ function evaluateSteelRead(context) {
|
|
|
68305
68315
|
if (currentJointHashes.get(joint.id) === dependencyHash) continue;
|
|
68306
68316
|
if (reviewByJoint.get(joint.id)?.dependencyHash !== dependencyHash) changedReviewMissing.push(joint.id);
|
|
68307
68317
|
}
|
|
68308
|
-
|
|
68318
|
+
const jointRowIds = new Set(joints.flatMap((joint) => typeof joint.id === "string" ? [joint.id] : []));
|
|
68319
|
+
for (const jointId of reviewByJoint.keys()) if (!jointRowIds.has(jointId)) changedReviewMissing.push(jointId);
|
|
68309
68320
|
add("joint-review", changedReviewMissing.length ? "block" : "pass", changedReviewMissing.length ? "new/changed joints lack a dependency-bound visual review" : `${joints.length} joint dependency fingerprint(s) reviewed or unchanged`, changedReviewMissing);
|
|
68310
68321
|
if (validation.valid && !budgetExceeded) {
|
|
68311
68322
|
try {
|
|
@@ -72102,6 +72113,28 @@ for source in manifest["sources"]:
|
|
|
72102
72113
|
|
|
72103
72114
|
json.dump({"pages":pages}, sys.stdout, separators=(",", ":"))
|
|
72104
72115
|
`;
|
|
72116
|
+
var SteelFilterBudgetError = class extends Error {
|
|
72117
|
+
constructor(total, limit, pages) {
|
|
72118
|
+
super(`the drawing set carries ${total} elements, over the ${limit}-element read limit`);
|
|
72119
|
+
this.total = total;
|
|
72120
|
+
this.limit = limit;
|
|
72121
|
+
this.pages = pages;
|
|
72122
|
+
this.name = "SteelFilterBudgetError";
|
|
72123
|
+
}
|
|
72124
|
+
total;
|
|
72125
|
+
limit;
|
|
72126
|
+
pages;
|
|
72127
|
+
};
|
|
72128
|
+
var SteelFilterOutputTooLargeError = class extends Error {
|
|
72129
|
+
constructor() {
|
|
72130
|
+
super("the drawing set produced more extraction output than a single read can process");
|
|
72131
|
+
this.name = "SteelFilterOutputTooLargeError";
|
|
72132
|
+
}
|
|
72133
|
+
};
|
|
72134
|
+
function isStdoutTooLarge(error) {
|
|
72135
|
+
if (error?.code === "ERR_CHILD_PROCESS_STDOUT_MAXBUFFER") return true;
|
|
72136
|
+
return /stdout maxBuffer/i.test(error instanceof Error ? error.message : "");
|
|
72137
|
+
}
|
|
72105
72138
|
var available = null;
|
|
72106
72139
|
function steelFilterExtractorAvailable(python = "python") {
|
|
72107
72140
|
if (python === "python" && available !== null) return available;
|
|
@@ -72123,9 +72156,11 @@ async function extractSteelFilter(manifest, options = {}) {
|
|
|
72123
72156
|
const child = (0, import_node_child_process7.execFile)(options.python ?? "python", ["-c", PYTHON], {
|
|
72124
72157
|
timeout: options.timeoutMs ?? 12e4,
|
|
72125
72158
|
windowsHide: true,
|
|
72126
|
-
|
|
72159
|
+
// 64 MB: at the raised 50k element cap a dense Filter (long SVG paths) plus per-sheet rasters
|
|
72160
|
+
// can exceed the old 25 MB stdout ceiling; the buffer is in-memory and short-lived (issue #805).
|
|
72161
|
+
maxBuffer: 64 * 1024 * 1024
|
|
72127
72162
|
}, (error, stdout, stderr) => {
|
|
72128
|
-
if (error) return reject(new Error(`Steel Filter extraction failed: ${(stderr || error.message).trim().slice(0, 1e3)}`));
|
|
72163
|
+
if (error) return reject(isStdoutTooLarge(error) ? new SteelFilterOutputTooLargeError() : new Error(`Steel Filter extraction failed: ${(stderr || error.message).trim().slice(0, 1e3)}`));
|
|
72129
72164
|
resolve20(stdout);
|
|
72130
72165
|
});
|
|
72131
72166
|
child.stdin?.end(input);
|
|
@@ -72139,18 +72174,38 @@ async function extractSteelFilter(manifest, options = {}) {
|
|
|
72139
72174
|
if (!filter || typeof filter !== "object" || !Array.isArray(filter.sheets) || filter.sheets.length === 0 || filter.sheets.length > STEEL_READ_MAX_PAGES) {
|
|
72140
72175
|
throw new Error("Steel Filter extraction returned no populated sheets");
|
|
72141
72176
|
}
|
|
72177
|
+
const sheets = filter.sheets;
|
|
72142
72178
|
let elements = 0;
|
|
72143
|
-
for (const sheet of
|
|
72179
|
+
for (const sheet of sheets) {
|
|
72144
72180
|
if (!sheet || typeof sheet !== "object" || Array.isArray(sheet) || !Array.isArray(sheet.elements)) {
|
|
72145
72181
|
throw new Error("Steel Filter extraction returned malformed sheet elements");
|
|
72146
72182
|
}
|
|
72147
72183
|
elements += sheet.elements.length;
|
|
72148
|
-
|
|
72149
|
-
|
|
72150
|
-
|
|
72151
|
-
|
|
72152
|
-
|
|
72153
|
-
|
|
72184
|
+
}
|
|
72185
|
+
if (elements > STEEL_READ_MAX_ELEMENTS) {
|
|
72186
|
+
const pages = [];
|
|
72187
|
+
const seen = /* @__PURE__ */ new Set();
|
|
72188
|
+
for (const sheet of sheets) {
|
|
72189
|
+
const count2 = sheet.elements.length;
|
|
72190
|
+
if (count2 === 0) continue;
|
|
72191
|
+
const sourceHash = sheet.sourceHash;
|
|
72192
|
+
const page = sheet.pageNumber;
|
|
72193
|
+
if (typeof sourceHash !== "string" || !/^[0-9a-f]{64}$/.test(sourceHash) || !Number.isInteger(page) || page < 1) {
|
|
72194
|
+
throw new Error("Steel Filter extraction returned a sheet with no valid source/page identity");
|
|
72195
|
+
}
|
|
72196
|
+
const key2 = `${sourceHash}\0${page}`;
|
|
72197
|
+
if (seen.has(key2)) throw new Error("Steel Filter extraction returned a duplicate source page");
|
|
72198
|
+
seen.add(key2);
|
|
72199
|
+
pages.push({ sourceHash, page, count: count2 });
|
|
72200
|
+
}
|
|
72201
|
+
pages.sort((a, b) => a.sourceHash < b.sourceHash ? -1 : a.sourceHash > b.sourceHash ? 1 : a.page - b.page);
|
|
72202
|
+
throw new SteelFilterBudgetError(elements, STEEL_READ_MAX_ELEMENTS, pages);
|
|
72203
|
+
}
|
|
72204
|
+
for (const sheet of sheets) {
|
|
72205
|
+
const sheetName = sheet.sheet;
|
|
72206
|
+
const sourceHash = sheet.sourceHash;
|
|
72207
|
+
if (typeof sheetName === "string" && typeof sourceHash === "string") {
|
|
72208
|
+
sheet.elements.forEach((element, index) => {
|
|
72154
72209
|
if (element && typeof element === "object" && !Array.isArray(element)) {
|
|
72155
72210
|
element.elementId = filterElementId(sourceHash, sheetName, index, element);
|
|
72156
72211
|
}
|
|
@@ -72532,18 +72587,49 @@ function registerRevisionRoutes(app, deps = {}) {
|
|
|
72532
72587
|
let evidenceFilter;
|
|
72533
72588
|
try {
|
|
72534
72589
|
const extractor = deps.extractSteelFilter ?? extractSteelFilter;
|
|
72590
|
+
evidenceFilter = await extractor({
|
|
72591
|
+
sources: sources.extractorSources,
|
|
72592
|
+
plans: pages.map((_page, index) => ({ sheet: `E${index + 1}` })),
|
|
72593
|
+
pages: pages.map((page, index) => ({ sourceHash: page.sourceHash, page: page.page, sheet: `E${index + 1}` }))
|
|
72594
|
+
});
|
|
72535
72595
|
filter = await extractor({
|
|
72536
72596
|
sources: sources.extractorSources,
|
|
72537
72597
|
plans: modelPages.map((page) => ({ sheet: page.sheet, ...page.title ? { title: page.title } : {} })),
|
|
72538
72598
|
pages: modelPages.map((page) => ({ sourceHash: page.sourceHash, page: page.page, sheet: page.sheet })),
|
|
72539
72599
|
...currentObj?.filter === void 0 ? {} : { filter: currentObj.filter }
|
|
72540
72600
|
});
|
|
72541
|
-
evidenceFilter = await extractor({
|
|
72542
|
-
sources: sources.extractorSources,
|
|
72543
|
-
plans: pages.map((_page, index) => ({ sheet: `E${index + 1}` })),
|
|
72544
|
-
pages: pages.map((page, index) => ({ sourceHash: page.sourceHash, page: page.page, sheet: `E${index + 1}` }))
|
|
72545
|
-
});
|
|
72546
72601
|
} catch (error) {
|
|
72602
|
+
if (error instanceof SteelFilterBudgetError) {
|
|
72603
|
+
const labelByPage = new Map(pages.map((page) => [`${page.sourceHash} ${page.page}`, page.sheet]));
|
|
72604
|
+
const nameByHash = new Map(sources.manifestSources.map((source) => [source.sha256, source.name]));
|
|
72605
|
+
const overBudget = error.pages.map((row) => ({
|
|
72606
|
+
sheet: labelByPage.get(`${row.sourceHash} ${row.page}`) ?? `${nameByHash.get(row.sourceHash) ?? "source"} p.${row.page}`,
|
|
72607
|
+
sourceHash: row.sourceHash,
|
|
72608
|
+
page: row.page,
|
|
72609
|
+
count: row.count
|
|
72610
|
+
}));
|
|
72611
|
+
return reply.status(400).send({
|
|
72612
|
+
ok: false,
|
|
72613
|
+
code: "steel-manifest-over-budget",
|
|
72614
|
+
error: `This drawing set carries ${error.total} elements, over the ${error.limit}-element limit for a single read.`,
|
|
72615
|
+
recovery: `Close this request and re-submit the drawing set as smaller revisions \u2014 split the sheets so each revision stays under ${error.limit} elements.`,
|
|
72616
|
+
total: error.total,
|
|
72617
|
+
limit: error.limit,
|
|
72618
|
+
overBudget: overBudget.slice(0, STEEL_READ_MAX_PAGES)
|
|
72619
|
+
});
|
|
72620
|
+
}
|
|
72621
|
+
if (error instanceof SteelFilterOutputTooLargeError) {
|
|
72622
|
+
return reply.status(400).send({
|
|
72623
|
+
ok: false,
|
|
72624
|
+
code: "steel-manifest-over-budget",
|
|
72625
|
+
error: "This drawing set is too large to process in a single read.",
|
|
72626
|
+
recovery: "Close this request and re-submit the drawing set as several materially smaller revisions.",
|
|
72627
|
+
total: null,
|
|
72628
|
+
limit: null,
|
|
72629
|
+
overBudget: []
|
|
72630
|
+
});
|
|
72631
|
+
}
|
|
72632
|
+
req.log.warn({ projectId: project.id, requestId: request.id, error: error instanceof Error ? error.message : String(error) }, "steel manifest extraction failed");
|
|
72547
72633
|
return reply.status(400).send({ ok: false, code: "steel-manifest-extraction-failed", error: error instanceof Error ? error.message : "could not extract Steel Filter geometry" });
|
|
72548
72634
|
}
|
|
72549
72635
|
const evidenceSheets = evidenceFilter && typeof evidenceFilter === "object" && !Array.isArray(evidenceFilter) && Array.isArray(evidenceFilter.sheets) ? evidenceFilter.sheets : [];
|
|
@@ -80921,11 +81007,7 @@ function mergeContractForward(base, latest, draft, resolutions = {}) {
|
|
|
80921
81007
|
function prepareProjectApprovalReview(projectId, deps) {
|
|
80922
81008
|
const project = getProject(projectId);
|
|
80923
81009
|
if (!project) throw new WorkspaceSnapshotError(404, `unknown project: ${projectId}`);
|
|
80924
|
-
if (!project.uuid) throw new WorkspaceSnapshotError(
|
|
80925
|
-
409,
|
|
80926
|
-
"This project can\u2019t be approved \u2014 duplicate it from the Workspaces list to sign off",
|
|
80927
|
-
"no-incarnation"
|
|
80928
|
-
);
|
|
81010
|
+
if (!project.uuid) throw new WorkspaceSnapshotError(409, NO_INCARNATION_REFUSAL, "no-incarnation");
|
|
80929
81011
|
const draft = readAcceptedForRequest(project.app, projectId, "read");
|
|
80930
81012
|
if (draft == null) {
|
|
80931
81013
|
if (storedContractBytesExist(project.app, projectId)) {
|
|
@@ -93781,6 +93863,7 @@ async function startServer() {
|
|
|
93781
93863
|
app.get("/api/projects/:id/checkpoints", async (req, reply) => {
|
|
93782
93864
|
const project = getProject(req.params.id);
|
|
93783
93865
|
if (!project) return reply.status(404).send({ ok: false, error: `unknown project: ${req.params.id}` });
|
|
93866
|
+
if (!project.uuid) return reply.status(409).send({ ok: false, error: NO_INCARNATION_REFUSAL, code: "no-incarnation" });
|
|
93784
93867
|
return withLifecycleLock("project", project.id, () => ({
|
|
93785
93868
|
ok: true,
|
|
93786
93869
|
checkpoints: listProjectCheckpoints(project).map((saved) => ({
|
|
@@ -93920,6 +94003,7 @@ async function startServer() {
|
|
|
93920
94003
|
app.get("/api/projects/:id/export-sources", async (req, reply) => {
|
|
93921
94004
|
const project = getProject(req.params.id);
|
|
93922
94005
|
if (!project) return reply.status(404).send({ ok: false, error: `unknown project: ${req.params.id}` });
|
|
94006
|
+
if (!project.uuid) return reply.status(409).send({ ok: false, error: NO_INCARNATION_REFUSAL, code: "no-incarnation" });
|
|
93923
94007
|
return withLifecycleLock("project", project.id, () => {
|
|
93924
94008
|
let defaultUnavailable = null;
|
|
93925
94009
|
const recordRefusal = (error) => {
|
package/dist/web/app.css
CHANGED
|
@@ -437,6 +437,71 @@
|
|
|
437
437
|
}
|
|
438
438
|
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
|
|
439
439
|
|
|
440
|
+
/* ── AI answers: bulk toolbar + per-card collapse/remove ─────────────────── */
|
|
441
|
+
/* Sticky bulk row, rendered as the first child of #ai-answers (only when ≥1 answer exists — it is
|
|
442
|
+
hidden by simply not existing over an empty feed, never a disabled control). --surface matches the
|
|
443
|
+
pane so cards scroll cleanly beneath it; the negative margins cancel .messages' 14px side padding
|
|
444
|
+
so the row spans full width. */
|
|
445
|
+
.answers-toolbar {
|
|
446
|
+
position: sticky; top: 0; z-index: 2;
|
|
447
|
+
display: flex; align-items: center; gap: 8px;
|
|
448
|
+
margin: 0 -14px 2px; padding: 7px 14px;
|
|
449
|
+
background: var(--surface);
|
|
450
|
+
border-bottom: 1px solid var(--border);
|
|
451
|
+
}
|
|
452
|
+
.answers-toolbar-spacer { flex: 1 1 auto; }
|
|
453
|
+
.answers-count {
|
|
454
|
+
font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
|
|
455
|
+
color: var(--text-dim); font-variant-numeric: tabular-nums;
|
|
456
|
+
}
|
|
457
|
+
.answers-bulk {
|
|
458
|
+
appearance: none; border: 1px solid var(--border-strong); background: transparent;
|
|
459
|
+
color: var(--text-muted); cursor: pointer; padding: 4px 9px; border-radius: 4px;
|
|
460
|
+
font-size: 11.5px; line-height: 1;
|
|
461
|
+
}
|
|
462
|
+
.answers-bulk:hover { color: var(--text); background: var(--surface-3); }
|
|
463
|
+
.answers-bulk:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
464
|
+
/* Reversible-destructive idiom (see #requests-clear): neutral at rest, --err only on hover. */
|
|
465
|
+
.answers-clear:hover { color: var(--err); border-color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); }
|
|
466
|
+
|
|
467
|
+
/* The card header carries the chevron on the left and the × on the right; who-name takes the slack
|
|
468
|
+
between them so the timestamp + × sit flush-right. Center-aligned (the base .who is baseline, which
|
|
469
|
+
reads crooked next to 26px-tall buttons).
|
|
470
|
+
padding-right clears the narrative panel's absolutely-positioned, vertically-centred collapse
|
|
471
|
+
toggle (`.panel-label .panel-toggle`, ~28px wide at the panel's right edge, z-index 12): it floats
|
|
472
|
+
OVER the feed, so whichever card lands at the panel's vertical midpoint would otherwise have its ×
|
|
473
|
+
stolen by the toggle's hit area. Both toggle and card are right-anchored, so a fixed inset clears
|
|
474
|
+
it at every panel width. Only the header's right controls need it — the body stays full width. */
|
|
475
|
+
.msg.instructor-answer .who.answer-who { align-items: center; gap: 6px; padding-right: 24px; }
|
|
476
|
+
.msg.instructor-answer .answer-who .who-name { margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
477
|
+
.answer-collapse-toggle, .answer-del {
|
|
478
|
+
display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
|
|
479
|
+
appearance: none; border: 1px solid transparent; background: transparent;
|
|
480
|
+
color: var(--text-dim); cursor: pointer; width: 20px; height: 20px; border-radius: 4px;
|
|
481
|
+
font-size: 12px; line-height: 1;
|
|
482
|
+
}
|
|
483
|
+
.answer-collapse-toggle { transition: transform 0.15s ease; }
|
|
484
|
+
/* Chevron points right when collapsed, rotates down when open. Rotate the glyph, not a swap, so the
|
|
485
|
+
motion reads as a disclosure. */
|
|
486
|
+
.msg.instructor-answer:not(.answer-collapsed) .answer-collapse-toggle { transform: rotate(90deg); }
|
|
487
|
+
.answer-collapse-toggle:hover { color: var(--text); background: var(--surface-3); }
|
|
488
|
+
.answer-del:hover { color: var(--err); border-color: var(--err); }
|
|
489
|
+
.answer-collapse-toggle:focus-visible, .answer-del:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
490
|
+
@media (prefers-reduced-motion: reduce) { .answer-collapse-toggle { transition: none; } }
|
|
491
|
+
/* Collapsed: the prose body (and, with it, the new-answer badge inside it) is hidden via a class —
|
|
492
|
+
not a bare `hidden` attribute, which app.css has no global rule for and would fail to honour. */
|
|
493
|
+
.msg.instructor-answer.answer-collapsed .body { display: none; }
|
|
494
|
+
|
|
495
|
+
/* Undo toast: a real focusable action inside the shared #toast-container surface. */
|
|
496
|
+
.toast-undo { display: flex; align-items: center; gap: 12px; }
|
|
497
|
+
.toast-action {
|
|
498
|
+
appearance: none; border: 1px solid var(--border-strong); background: transparent;
|
|
499
|
+
color: var(--accent); cursor: pointer; padding: 3px 10px; border-radius: 4px;
|
|
500
|
+
font-size: 12px; line-height: 1; flex-shrink: 0;
|
|
501
|
+
}
|
|
502
|
+
.toast-action:hover { color: var(--accent-bright); background: var(--surface-3); }
|
|
503
|
+
.toast-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
504
|
+
|
|
440
505
|
/* ========== COLLAPSED STUBS ========== */
|
|
441
506
|
.collapsed-stub {
|
|
442
507
|
display: none;
|
package/dist/web/app.js
CHANGED
|
@@ -1476,6 +1476,38 @@ function showToast(msg, type) {
|
|
|
1476
1476
|
return dismiss;
|
|
1477
1477
|
}
|
|
1478
1478
|
|
|
1479
|
+
// A toast carrying a real, focusable Undo action. Distinct from showToast because that surface has no
|
|
1480
|
+
// action slot. The undo window is the caller's to own (it holds the commit timer) and it should pass
|
|
1481
|
+
// that same duration as `ms` so the visible toast can't outlive the window it advertises — the `6000`
|
|
1482
|
+
// default is a floor, not the source of truth. Reuses #toast-container (already role=status aria-live=polite).
|
|
1483
|
+
function showUndoToast(msg, onUndo, ms = 6000) {
|
|
1484
|
+
const c = document.getElementById('toast-container');
|
|
1485
|
+
if (!c) return () => {};
|
|
1486
|
+
const t = document.createElement('div');
|
|
1487
|
+
t.className = 'toast info toast-undo';
|
|
1488
|
+
const span = document.createElement('span');
|
|
1489
|
+
span.className = 'toast-msg';
|
|
1490
|
+
span.textContent = msg; // textContent — never innerHTML
|
|
1491
|
+
const action = document.createElement('button');
|
|
1492
|
+
action.type = 'button';
|
|
1493
|
+
action.className = 'toast-action';
|
|
1494
|
+
action.textContent = 'Undo';
|
|
1495
|
+
let done = false;
|
|
1496
|
+
const dismiss = () => {
|
|
1497
|
+
if (done) return;
|
|
1498
|
+
done = true;
|
|
1499
|
+
t.style.transition = 'opacity 0.3s, transform 0.3s';
|
|
1500
|
+
t.style.opacity = '0';
|
|
1501
|
+
t.style.transform = 'translateY(8px)';
|
|
1502
|
+
setTimeout(() => t.remove(), 300);
|
|
1503
|
+
};
|
|
1504
|
+
action.onclick = () => { dismiss(); if (typeof onUndo === 'function') onUndo(); };
|
|
1505
|
+
t.append(span, action);
|
|
1506
|
+
c.appendChild(t);
|
|
1507
|
+
if (ms > 0) setTimeout(dismiss, ms);
|
|
1508
|
+
return dismiss;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1479
1511
|
/* ============= ZOOM + PAN ============= */
|
|
1480
1512
|
|
|
1481
1513
|
const ZOOM_LEVELS = [0.5, 0.6, 0.75, 0.85, 1.0, 1.15, 1.3, 1.5, 1.75, 2.0];
|