@floless/app 0.101.4 → 0.101.5
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 +192 -28
- package/dist/web/app.css +11 -4
- package/dist/web/workspaces.js +72 -17
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -53106,7 +53106,7 @@ function appVersion() {
|
|
|
53106
53106
|
return resolveVersion({
|
|
53107
53107
|
isSea: isSea2(),
|
|
53108
53108
|
sqVersionXml: readSqVersionXml(),
|
|
53109
|
-
define: true ? "0.101.
|
|
53109
|
+
define: true ? "0.101.5" : void 0,
|
|
53110
53110
|
pkgVersion: readPkgVersion()
|
|
53111
53111
|
});
|
|
53112
53112
|
}
|
|
@@ -53116,7 +53116,7 @@ function resolveChannel(s) {
|
|
|
53116
53116
|
return "dev";
|
|
53117
53117
|
}
|
|
53118
53118
|
function appChannel() {
|
|
53119
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.101.
|
|
53119
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.101.5" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
|
@@ -57080,6 +57080,7 @@ function registerKnowledgeRoutes(app) {
|
|
|
57080
57080
|
// project-versions-store.ts
|
|
57081
57081
|
var import_node_crypto8 = require("node:crypto");
|
|
57082
57082
|
var import_node_fs23 = require("node:fs");
|
|
57083
|
+
var import_promises2 = require("node:fs/promises");
|
|
57083
57084
|
var import_node_path20 = require("node:path");
|
|
57084
57085
|
var BLOB_MIN = 8192;
|
|
57085
57086
|
var BLOB_KEY = "__blobRef__";
|
|
@@ -57191,6 +57192,14 @@ function readVersionSkeleton(id, n) {
|
|
|
57191
57192
|
return null;
|
|
57192
57193
|
}
|
|
57193
57194
|
}
|
|
57195
|
+
async function readVersionSkeletonAsync(id, n) {
|
|
57196
|
+
try {
|
|
57197
|
+
const snap = JSON.parse(await (0, import_promises2.readFile)((0, import_node_path20.join)(versionsDir(id), `${n}.json`), "utf8"));
|
|
57198
|
+
return snap.contract;
|
|
57199
|
+
} catch {
|
|
57200
|
+
return null;
|
|
57201
|
+
}
|
|
57202
|
+
}
|
|
57194
57203
|
|
|
57195
57204
|
// project-contract-hash.ts
|
|
57196
57205
|
var import_node_crypto9 = require("node:crypto");
|
|
@@ -58611,6 +58620,140 @@ function diffContracts(from, to) {
|
|
|
58611
58620
|
}
|
|
58612
58621
|
|
|
58613
58622
|
// version-diff.ts
|
|
58623
|
+
var summaryCache = /* @__PURE__ */ new Map();
|
|
58624
|
+
var baseForVersion = (n, bases) => {
|
|
58625
|
+
if (bases?.has(n)) {
|
|
58626
|
+
const base = bases.get(n);
|
|
58627
|
+
return base == null ? null : base;
|
|
58628
|
+
}
|
|
58629
|
+
return n === 1 ? null : n - 1;
|
|
58630
|
+
};
|
|
58631
|
+
var summaryKey = (id, n, from) => `${id}\0${n}\0${from ?? "baseline"}`;
|
|
58632
|
+
var countWord = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
58633
|
+
var refName = (ref) => {
|
|
58634
|
+
const name = ref.mark || ref.id;
|
|
58635
|
+
return ref.sheet ? `${name} (${ref.sheet})` : name;
|
|
58636
|
+
};
|
|
58637
|
+
var preview = (items, max2 = 3) => {
|
|
58638
|
+
const shown = items.slice(0, max2);
|
|
58639
|
+
const rest = items.length - shown.length;
|
|
58640
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
58641
|
+
};
|
|
58642
|
+
var pounds = new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 });
|
|
58643
|
+
var cautionsForWarnings = (warnings) => {
|
|
58644
|
+
const cautions = [];
|
|
58645
|
+
if (warnings.identityNotPreserved) cautions.push("Member identities were not preserved, so this comparison may be incomplete.");
|
|
58646
|
+
if (warnings.duplicateKeys?.length) {
|
|
58647
|
+
cautions.push(`${countWord(warnings.duplicateKeys.length, "member")} could not be compared because duplicate IDs were found.`);
|
|
58648
|
+
}
|
|
58649
|
+
if (warnings.ambiguousJoints?.length) cautions.push("Some connection changes could not be attributed to a specific member.");
|
|
58650
|
+
if (warnings.scaleUnknown) cautions.push("Move distances are approximate because a drawing scale is missing.");
|
|
58651
|
+
return cautions;
|
|
58652
|
+
};
|
|
58653
|
+
function summarizeContractDiff(diff) {
|
|
58654
|
+
const bullets = [];
|
|
58655
|
+
let detailCount = 0;
|
|
58656
|
+
const add = (count, text) => {
|
|
58657
|
+
if (!count) return;
|
|
58658
|
+
detailCount += count;
|
|
58659
|
+
bullets.push(text);
|
|
58660
|
+
};
|
|
58661
|
+
add(diff.added.length, `Added ${countWord(diff.added.length, "member")}: ${preview(diff.added.map(refName))}.`);
|
|
58662
|
+
add(diff.removed.length, `Removed ${countWord(diff.removed.length, "member")}: ${preview(diff.removed.map(refName))}.`);
|
|
58663
|
+
add(
|
|
58664
|
+
diff.resized.length,
|
|
58665
|
+
`Resized ${countWord(diff.resized.length, "member")}: ${preview(diff.resized.map((x) => `${refName(x.ref)} (${x.from || "unspecified"} \u2192 ${x.to || "unspecified"})`))}.`
|
|
58666
|
+
);
|
|
58667
|
+
add(
|
|
58668
|
+
diff.moved.length,
|
|
58669
|
+
`Moved ${countWord(diff.moved.length, "member")}: ${preview(diff.moved.map((x) => `${refName(x.ref)} (about ${x.feet} ft)`))}.`
|
|
58670
|
+
);
|
|
58671
|
+
add(
|
|
58672
|
+
diff.material.length,
|
|
58673
|
+
`Changed material on ${countWord(diff.material.length, "member")}: ${preview(diff.material.map((x) => `${refName(x.ref)} (${x.from || "unspecified"} \u2192 ${x.to || "unspecified"})`))}.`
|
|
58674
|
+
);
|
|
58675
|
+
add(
|
|
58676
|
+
diff.connections.length,
|
|
58677
|
+
`Updated connections on ${countWord(diff.connections.length, "member")}: ${preview(diff.connections.map((x) => refName(x.ref)))}.`
|
|
58678
|
+
);
|
|
58679
|
+
if (diff.tonnage.netLb !== 0) {
|
|
58680
|
+
const up = diff.tonnage.netLb > 0;
|
|
58681
|
+
const absLb = Math.abs(diff.tonnage.netLb);
|
|
58682
|
+
const amount = Math.abs(diff.tonnage.netTons) >= 0.1 ? `${Math.abs(diff.tonnage.netTons)} tons (${pounds.format(absLb)} lb)` : `${pounds.format(absLb)} lb`;
|
|
58683
|
+
bullets.push(
|
|
58684
|
+
`Net steel ${up ? "increased" : "decreased"} by ${amount}.`
|
|
58685
|
+
);
|
|
58686
|
+
}
|
|
58687
|
+
const cautions = cautionsForWarnings(diff.warnings);
|
|
58688
|
+
const headline = detailCount > 0 ? `${countWord(detailCount, "model change")} since v${diff.from}` : bullets.length > 0 ? `Steel quantity changed since v${diff.from}` : `No model changes detected since v${diff.from}`;
|
|
58689
|
+
if (!bullets.length) {
|
|
58690
|
+
bullets.push(diff.unchanged > 0 ? `${countWord(diff.unchanged, "member")} unchanged; sign-off recorded.` : "Sign-off recorded with no detectable model changes.");
|
|
58691
|
+
}
|
|
58692
|
+
return { from: diff.from, headline, detailCount, bullets, cautions };
|
|
58693
|
+
}
|
|
58694
|
+
function summarizeSnapshots(n, to, fromVersion, from) {
|
|
58695
|
+
if (fromVersion == null) {
|
|
58696
|
+
const baseline = diffContracts({}, to);
|
|
58697
|
+
const rawPlans = Array.isArray(to?.plans) ? to.plans : [];
|
|
58698
|
+
const plans = rawPlans.length;
|
|
58699
|
+
const memberCount = rawPlans.reduce(
|
|
58700
|
+
(count, plan) => count + (Array.isArray(plan?.members) ? plan.members.length : 0),
|
|
58701
|
+
0
|
|
58702
|
+
);
|
|
58703
|
+
const bullets = [`${countWord(memberCount, "member")} across ${countWord(plans, "drawing sheet")}.`];
|
|
58704
|
+
if (baseline.tonnage.toLb > 0) {
|
|
58705
|
+
bullets.push(baseline.tonnage.toTons > 0 ? `Total modeled steel: ${baseline.tonnage.toTons} tons (${pounds.format(baseline.tonnage.toLb)} lb).` : `Total modeled steel: ${pounds.format(baseline.tonnage.toLb)} lb.`);
|
|
58706
|
+
}
|
|
58707
|
+
return {
|
|
58708
|
+
from: null,
|
|
58709
|
+
headline: "Baseline approved",
|
|
58710
|
+
detailCount: memberCount,
|
|
58711
|
+
bullets,
|
|
58712
|
+
cautions: cautionsForWarnings(baseline.warnings)
|
|
58713
|
+
};
|
|
58714
|
+
}
|
|
58715
|
+
const diff = diffContracts(from, to);
|
|
58716
|
+
diff.from = fromVersion;
|
|
58717
|
+
diff.to = n;
|
|
58718
|
+
return summarizeContractDiff(diff);
|
|
58719
|
+
}
|
|
58720
|
+
function uncachedVersions(id, versions, out, bases) {
|
|
58721
|
+
return [...new Set(versions.filter((n) => Number.isInteger(n) && n > 0))].filter((n) => {
|
|
58722
|
+
const cached = summaryCache.get(summaryKey(id, n, baseForVersion(n, bases)));
|
|
58723
|
+
if (cached) out.set(n, cached);
|
|
58724
|
+
return !cached;
|
|
58725
|
+
});
|
|
58726
|
+
}
|
|
58727
|
+
async function summarizeVersionChangesAsync(id, versions, bases) {
|
|
58728
|
+
const out = /* @__PURE__ */ new Map();
|
|
58729
|
+
const missing = uncachedVersions(id, versions, out, bases);
|
|
58730
|
+
if (!missing.length) return out;
|
|
58731
|
+
try {
|
|
58732
|
+
const needed = /* @__PURE__ */ new Set();
|
|
58733
|
+
for (const n of missing) {
|
|
58734
|
+
needed.add(n);
|
|
58735
|
+
const base = baseForVersion(n, bases);
|
|
58736
|
+
if (base != null) needed.add(base);
|
|
58737
|
+
}
|
|
58738
|
+
const docs = /* @__PURE__ */ new Map();
|
|
58739
|
+
await Promise.all([...needed].map(async (n) => {
|
|
58740
|
+
docs.set(n, await readVersionSkeletonAsync(id, n));
|
|
58741
|
+
}));
|
|
58742
|
+
for (const n of missing) {
|
|
58743
|
+
const to = docs.get(n);
|
|
58744
|
+
if (to == null) continue;
|
|
58745
|
+
const fromVersion = baseForVersion(n, bases);
|
|
58746
|
+
const from = fromVersion != null ? docs.get(fromVersion) : void 0;
|
|
58747
|
+
if (fromVersion != null && from == null) continue;
|
|
58748
|
+
await new Promise((resolve8) => setImmediate(resolve8));
|
|
58749
|
+
const summary = summarizeSnapshots(n, to, fromVersion, from);
|
|
58750
|
+
summaryCache.set(summaryKey(id, n, fromVersion), summary);
|
|
58751
|
+
out.set(n, summary);
|
|
58752
|
+
}
|
|
58753
|
+
} catch {
|
|
58754
|
+
}
|
|
58755
|
+
return out;
|
|
58756
|
+
}
|
|
58614
58757
|
function appSupportsDiff(app) {
|
|
58615
58758
|
return app === "steel-model";
|
|
58616
58759
|
}
|
|
@@ -61869,7 +62012,7 @@ function generateXlsxFileContents(arg1, arg2, arg3) {
|
|
|
61869
62012
|
sheetsOptions = setConditionalFormattingRulesGlobalIndexes(sheetsOptions);
|
|
61870
62013
|
var features = getFeatures(options.features);
|
|
61871
62014
|
var files2 = {};
|
|
61872
|
-
var
|
|
62015
|
+
var readFile3 = function readFile4(path) {
|
|
61873
62016
|
return files2[path];
|
|
61874
62017
|
};
|
|
61875
62018
|
var writeFiles = function writeFiles2(filesToWrite) {
|
|
@@ -61936,7 +62079,7 @@ function generateXlsxFileContents(arg1, arg2, arg3) {
|
|
|
61936
62079
|
sheetIndex++;
|
|
61937
62080
|
}
|
|
61938
62081
|
writeFiles(getWrittenFiles(features, sheetsOptions, {
|
|
61939
|
-
read:
|
|
62082
|
+
read: readFile3
|
|
61940
62083
|
}));
|
|
61941
62084
|
files2["xl/styles.xml"] = generateStylesXml(getCellStyles(), sheetsOptions, features);
|
|
61942
62085
|
files2["xl/sharedStrings.xml"] = generateSharedStringsXml(getSharedStrings());
|
|
@@ -63955,7 +64098,7 @@ var import_node_child_process6 = require("node:child_process");
|
|
|
63955
64098
|
var import_node_crypto11 = require("node:crypto");
|
|
63956
64099
|
var import_node_fs36 = require("node:fs");
|
|
63957
64100
|
var import_node_stream3 = require("node:stream");
|
|
63958
|
-
var
|
|
64101
|
+
var import_promises3 = require("node:stream/promises");
|
|
63959
64102
|
var import_node_path32 = require("node:path");
|
|
63960
64103
|
|
|
63961
64104
|
// post-update-marker.mjs
|
|
@@ -64112,7 +64255,7 @@ async function checkForUpdate() {
|
|
|
64112
64255
|
}
|
|
64113
64256
|
async function sha1OfFile(path) {
|
|
64114
64257
|
const hash = (0, import_node_crypto11.createHash)("sha1");
|
|
64115
|
-
await (0,
|
|
64258
|
+
await (0, import_promises3.pipeline)((0, import_node_fs36.createReadStream)(path), hash);
|
|
64116
64259
|
return hash.digest("hex").toUpperCase();
|
|
64117
64260
|
}
|
|
64118
64261
|
async function downloadPackage(asset) {
|
|
@@ -64127,7 +64270,7 @@ async function downloadPackage(asset) {
|
|
|
64127
64270
|
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
|
|
64128
64271
|
});
|
|
64129
64272
|
if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status} for ${asset.FileName}`);
|
|
64130
|
-
await (0,
|
|
64273
|
+
await (0, import_promises3.pipeline)(import_node_stream3.Readable.fromWeb(res.body), (0, import_node_fs36.createWriteStream)(dest));
|
|
64131
64274
|
const got = await sha1OfFile(dest);
|
|
64132
64275
|
if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
|
|
64133
64276
|
return dest;
|
|
@@ -65026,12 +65169,12 @@ var import_node_fs39 = require("node:fs");
|
|
|
65026
65169
|
|
|
65027
65170
|
// node_modules/chokidar/esm/index.js
|
|
65028
65171
|
var import_fs2 = require("fs");
|
|
65029
|
-
var
|
|
65172
|
+
var import_promises6 = require("fs/promises");
|
|
65030
65173
|
var import_events = require("events");
|
|
65031
65174
|
var sysPath2 = __toESM(require("path"), 1);
|
|
65032
65175
|
|
|
65033
65176
|
// node_modules/readdirp/esm/index.js
|
|
65034
|
-
var
|
|
65177
|
+
var import_promises4 = require("node:fs/promises");
|
|
65035
65178
|
var import_node_stream4 = require("node:stream");
|
|
65036
65179
|
var import_node_path35 = require("node:path");
|
|
65037
65180
|
var EntryTypes = {
|
|
@@ -65098,7 +65241,7 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
|
|
|
65098
65241
|
const { root, type } = opts;
|
|
65099
65242
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
65100
65243
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
65101
|
-
const statMethod = opts.lstat ?
|
|
65244
|
+
const statMethod = opts.lstat ? import_promises4.lstat : import_promises4.stat;
|
|
65102
65245
|
if (wantBigintFsStats) {
|
|
65103
65246
|
this._stat = (path) => statMethod(path, { bigint: true });
|
|
65104
65247
|
} else {
|
|
@@ -65169,7 +65312,7 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
|
|
|
65169
65312
|
async _exploreDir(path, depth) {
|
|
65170
65313
|
let files2;
|
|
65171
65314
|
try {
|
|
65172
|
-
files2 = await (0,
|
|
65315
|
+
files2 = await (0, import_promises4.readdir)(path, this._rdOptions);
|
|
65173
65316
|
} catch (error) {
|
|
65174
65317
|
this._onError(error);
|
|
65175
65318
|
}
|
|
@@ -65207,8 +65350,8 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
|
|
|
65207
65350
|
if (stats && stats.isSymbolicLink()) {
|
|
65208
65351
|
const full = entry2.fullPath;
|
|
65209
65352
|
try {
|
|
65210
|
-
const entryRealPath = await (0,
|
|
65211
|
-
const entryRealPathStats = await (0,
|
|
65353
|
+
const entryRealPath = await (0, import_promises4.realpath)(full);
|
|
65354
|
+
const entryRealPathStats = await (0, import_promises4.lstat)(entryRealPath);
|
|
65212
65355
|
if (entryRealPathStats.isFile()) {
|
|
65213
65356
|
return "file";
|
|
65214
65357
|
}
|
|
@@ -65251,7 +65394,7 @@ function readdirp(root, options = {}) {
|
|
|
65251
65394
|
|
|
65252
65395
|
// node_modules/chokidar/esm/handler.js
|
|
65253
65396
|
var import_fs = require("fs");
|
|
65254
|
-
var
|
|
65397
|
+
var import_promises5 = require("fs/promises");
|
|
65255
65398
|
var sysPath = __toESM(require("path"), 1);
|
|
65256
65399
|
var import_os = require("os");
|
|
65257
65400
|
var STR_DATA = "data";
|
|
@@ -65278,7 +65421,7 @@ var EVENTS = {
|
|
|
65278
65421
|
};
|
|
65279
65422
|
var EV = EVENTS;
|
|
65280
65423
|
var THROTTLE_MODE_WATCH = "watch";
|
|
65281
|
-
var statMethods = { lstat:
|
|
65424
|
+
var statMethods = { lstat: import_promises5.lstat, stat: import_promises5.stat };
|
|
65282
65425
|
var KEY_LISTENERS = "listeners";
|
|
65283
65426
|
var KEY_ERR = "errHandlers";
|
|
65284
65427
|
var KEY_RAW = "rawEmitters";
|
|
@@ -65635,7 +65778,7 @@ var setFsWatchListener = (path, fullPath, options, handlers) => {
|
|
|
65635
65778
|
cont.watcherUnusable = true;
|
|
65636
65779
|
if (isWindows && error.code === "EPERM") {
|
|
65637
65780
|
try {
|
|
65638
|
-
const fd2 = await (0,
|
|
65781
|
+
const fd2 = await (0, import_promises5.open)(path, "r");
|
|
65639
65782
|
await fd2.close();
|
|
65640
65783
|
broadcastErr(error);
|
|
65641
65784
|
} catch (err2) {
|
|
@@ -65764,7 +65907,7 @@ var NodeFsHandler = class {
|
|
|
65764
65907
|
return;
|
|
65765
65908
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
65766
65909
|
try {
|
|
65767
|
-
const newStats2 = await (0,
|
|
65910
|
+
const newStats2 = await (0, import_promises5.stat)(file);
|
|
65768
65911
|
if (this.fsw.closed)
|
|
65769
65912
|
return;
|
|
65770
65913
|
const at = newStats2.atimeMs;
|
|
@@ -65819,7 +65962,7 @@ var NodeFsHandler = class {
|
|
|
65819
65962
|
this.fsw._incrReadyCount();
|
|
65820
65963
|
let linkPath;
|
|
65821
65964
|
try {
|
|
65822
|
-
linkPath = await (0,
|
|
65965
|
+
linkPath = await (0, import_promises5.realpath)(path);
|
|
65823
65966
|
} catch (e) {
|
|
65824
65967
|
this.fsw._emitReady();
|
|
65825
65968
|
return true;
|
|
@@ -65967,7 +66110,7 @@ var NodeFsHandler = class {
|
|
|
65967
66110
|
let closer;
|
|
65968
66111
|
if (stats.isDirectory()) {
|
|
65969
66112
|
const absPath = sysPath.resolve(path);
|
|
65970
|
-
const targetPath = follow ? await (0,
|
|
66113
|
+
const targetPath = follow ? await (0, import_promises5.realpath)(path) : path;
|
|
65971
66114
|
if (this.fsw.closed)
|
|
65972
66115
|
return;
|
|
65973
66116
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -65977,7 +66120,7 @@ var NodeFsHandler = class {
|
|
|
65977
66120
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
65978
66121
|
}
|
|
65979
66122
|
} else if (stats.isSymbolicLink()) {
|
|
65980
|
-
const targetPath = follow ? await (0,
|
|
66123
|
+
const targetPath = follow ? await (0, import_promises5.realpath)(path) : path;
|
|
65981
66124
|
if (this.fsw.closed)
|
|
65982
66125
|
return;
|
|
65983
66126
|
const parent = sysPath.dirname(wh.watchPath);
|
|
@@ -66138,7 +66281,7 @@ var DirEntry = class {
|
|
|
66138
66281
|
return;
|
|
66139
66282
|
const dir = this.path;
|
|
66140
66283
|
try {
|
|
66141
|
-
await (0,
|
|
66284
|
+
await (0, import_promises6.readdir)(dir);
|
|
66142
66285
|
} catch (err2) {
|
|
66143
66286
|
if (this._removeWatcher) {
|
|
66144
66287
|
this._removeWatcher(sysPath2.dirname(dir), sysPath2.basename(dir));
|
|
@@ -66463,7 +66606,7 @@ var FSWatcher = class extends import_events.EventEmitter {
|
|
|
66463
66606
|
const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path) : path;
|
|
66464
66607
|
let stats2;
|
|
66465
66608
|
try {
|
|
66466
|
-
stats2 = await (0,
|
|
66609
|
+
stats2 = await (0, import_promises6.stat)(fullPath);
|
|
66467
66610
|
} catch (err2) {
|
|
66468
66611
|
}
|
|
66469
66612
|
if (!stats2 || this.closed)
|
|
@@ -67390,7 +67533,27 @@ async function startServer() {
|
|
|
67390
67533
|
app.get("/api/projects/:id/versions", async (req, reply) => {
|
|
67391
67534
|
const p = getProject(req.params.id);
|
|
67392
67535
|
if (!p) return reply.status(404).send({ ok: false, error: `unknown project: ${req.params.id}` });
|
|
67393
|
-
|
|
67536
|
+
const versions = listVersions(req.params.id);
|
|
67537
|
+
let enriched = versions;
|
|
67538
|
+
if (appSupportsDiff(p.app)) {
|
|
67539
|
+
const approvals = versions.filter((v) => v.kind === "approve").sort((a, b) => a.n - b.n);
|
|
67540
|
+
const approvalBases = /* @__PURE__ */ new Map();
|
|
67541
|
+
let previousApproval = null;
|
|
67542
|
+
for (const version of approvals) {
|
|
67543
|
+
approvalBases.set(version.n, previousApproval);
|
|
67544
|
+
previousApproval = version.n;
|
|
67545
|
+
}
|
|
67546
|
+
const summaries = await summarizeVersionChangesAsync(
|
|
67547
|
+
p.id,
|
|
67548
|
+
approvals.map((v) => v.n),
|
|
67549
|
+
approvalBases
|
|
67550
|
+
);
|
|
67551
|
+
enriched = versions.map((v) => {
|
|
67552
|
+
const changeSummary = summaries.get(v.n);
|
|
67553
|
+
return v.kind === "approve" && changeSummary ? { ...v, changeSummary } : v;
|
|
67554
|
+
});
|
|
67555
|
+
}
|
|
67556
|
+
return { ok: true, versions: enriched, approvedAt: p.approvedAt ?? null };
|
|
67394
67557
|
});
|
|
67395
67558
|
app.get(
|
|
67396
67559
|
"/api/projects/:id/versions/:n/diff",
|
|
@@ -67609,15 +67772,16 @@ async function startServer() {
|
|
|
67609
67772
|
}
|
|
67610
67773
|
broadcast({ type: "compiled", id: req.params.appId, lockPath: result.lockPath });
|
|
67611
67774
|
let approvedAt;
|
|
67775
|
+
let version;
|
|
67612
67776
|
if (project) {
|
|
67613
67777
|
const latest = readContract(req.params.appId, project);
|
|
67614
67778
|
if (latest == null || contractHash(latest) !== approvingHash) {
|
|
67615
67779
|
return reply.status(409).send({ ok: false, error: "contract changed while approval was running \u2014 review the latest draft and Approve again" });
|
|
67616
67780
|
}
|
|
67617
|
-
createVersion(project, doc, { author: "You", message: "Approved this version", gate: "model", kind: "approve" });
|
|
67781
|
+
version = createVersion(project, doc, { author: "You", message: "Approved this version", gate: "model", kind: "approve" });
|
|
67618
67782
|
approvedAt = markApproved(project).approvedAt;
|
|
67619
67783
|
}
|
|
67620
|
-
return { ok: true, result, approvedAt };
|
|
67784
|
+
return { ok: true, result, approvedAt, version };
|
|
67621
67785
|
});
|
|
67622
67786
|
app.post(
|
|
67623
67787
|
"/api/contract/:appId/score",
|
|
@@ -68250,11 +68414,11 @@ async function startServer() {
|
|
|
68250
68414
|
}
|
|
68251
68415
|
const token = (0, import_node_crypto12.randomUUID)();
|
|
68252
68416
|
registerStage(token, tempHome, result.agentId);
|
|
68253
|
-
const
|
|
68417
|
+
const preview2 = buildPreview(manifest, sourceKind, sourceRef, token);
|
|
68254
68418
|
if ((0, import_node_fs40.existsSync)((0, import_node_path37.join)(graftAgentsDir(), result.agentId))) {
|
|
68255
|
-
|
|
68419
|
+
preview2.warnings.unshift(`An agent named "${result.agentId}" is already installed \u2014 creating it will overwrite it.`);
|
|
68256
68420
|
}
|
|
68257
|
-
return { ok: true, preview };
|
|
68421
|
+
return { ok: true, preview: preview2 };
|
|
68258
68422
|
});
|
|
68259
68423
|
app.post("/api/graft/commit", async (req, reply) => {
|
|
68260
68424
|
const { stagedRef, force = false } = req.body ?? {};
|
package/dist/web/app.css
CHANGED
|
@@ -3614,7 +3614,7 @@ table.hist { width:100%; border-collapse:collapse; font-size:12.5px; }
|
|
|
3614
3614
|
table.hist th { text-align:left; font-size:10px; text-transform:uppercase; letter-spacing:.1em; color:var(--text-dim);
|
|
3615
3615
|
font-weight:600; padding:0 12px 8px; border-bottom:1px solid var(--border); white-space:nowrap; }
|
|
3616
3616
|
table.hist td { padding:11px 12px; border-bottom:1px solid var(--border); color:var(--text); vertical-align:middle; }
|
|
3617
|
-
table.hist td.change { line-height:1.45; }
|
|
3617
|
+
table.hist td.change { line-height:1.45; min-width:300px; }
|
|
3618
3618
|
table.hist tr:hover td { background:var(--surface-2); }
|
|
3619
3619
|
table.hist tr.current td { background:var(--accent-soft); }
|
|
3620
3620
|
.hist .ver { font-family:var(--mono); font-size:11.5px; color:var(--text-dim); }
|
|
@@ -3630,6 +3630,13 @@ table.hist tr.current td { background:var(--accent-soft); }
|
|
|
3630
3630
|
.hist .gate-badge { display:inline-block; padding:2px 7px; border-radius:4px; font-size:9.5px; font-weight:600;
|
|
3631
3631
|
text-transform:uppercase; letter-spacing:.05em; background:transparent; border:1px solid var(--border-strong); color:var(--text-dim); }
|
|
3632
3632
|
.hist .gate-badge.model { background:var(--accent-soft); border-color:var(--accent-dim); color:var(--accent-bright); }
|
|
3633
|
+
.hist-event { color:var(--text); }
|
|
3634
|
+
.hist-change-head { color:var(--text); font-weight:600; margin-bottom:4px; }
|
|
3635
|
+
.hist-change-list { margin:0; padding-left:17px; color:var(--text-muted); }
|
|
3636
|
+
.hist-change-list li { margin:1px 0; padding-left:1px; }
|
|
3637
|
+
.hist-change-list li::marker { color:var(--text-dim); }
|
|
3638
|
+
.hist-change-list .hist-change-more { color:var(--text-dim); font-style:italic; }
|
|
3639
|
+
.hist-change-caution { margin-top:5px; color:var(--warn); font-size:11px; }
|
|
3633
3640
|
.hist .btn-mini, .ws-drawings-bar .btn-mini, .ws-revision-card .btn-mini { background:none; border:1px solid var(--border-strong); color:var(--text-muted); border-radius:6px;
|
|
3634
3641
|
padding:4px 10px; font-size:11px; cursor:pointer; white-space:nowrap; }
|
|
3635
3642
|
.hist .btn-mini:hover, .ws-drawings-bar .btn-mini:hover, .ws-revision-card .btn-mini:hover { color:var(--text); border-color:var(--accent); }
|
|
@@ -3667,10 +3674,10 @@ table.hist tr.current td { background:var(--accent-soft); }
|
|
|
3667
3674
|
/* ── Workspaces ▸ History ▸ "What changed" semantic diff (Slice 5) ──────────────
|
|
3668
3675
|
A per-version disclosure row (colspan) under table.hist. Uses only History tokens; group
|
|
3669
3676
|
headers follow the same mono-uppercase idiom as table.hist th. No new fonts/colors/widgets. */
|
|
3670
|
-
.
|
|
3671
|
-
|
|
3672
|
-
display:inline-flex; align-items:center; border-radius:4px; line-height:1; }
|
|
3677
|
+
.hd-toggle { background:none; border:none; padding:3px 5px; margin:6px 0 0 -5px; cursor:pointer; color:var(--accent);
|
|
3678
|
+
display:inline-flex; align-items:center; gap:5px; border-radius:4px; line-height:1.2; font:inherit; font-size:11px; }
|
|
3673
3679
|
.hd-toggle:hover, .hd-toggle[aria-expanded="true"] { color:var(--text); background:var(--surface-2); }
|
|
3680
|
+
.hd-toggle:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
|
|
3674
3681
|
.hd-caret { display:inline-block; font-size:10px; transition:transform .18s ease-out; }
|
|
3675
3682
|
.hd-toggle[aria-expanded="true"] .hd-caret { transform:rotate(90deg); }
|
|
3676
3683
|
table.hist tr.hd-open td { background:var(--surface-2); }
|
package/dist/web/workspaces.js
CHANGED
|
@@ -625,6 +625,7 @@
|
|
|
625
625
|
// Exports gate unlocks without a reload.
|
|
626
626
|
async function approveProject() {
|
|
627
627
|
if (!current) return;
|
|
628
|
+
const approvingProject = current;
|
|
628
629
|
const btn = document.getElementById('ws-approve');
|
|
629
630
|
btn.disabled = true;
|
|
630
631
|
const prev = btn.textContent;
|
|
@@ -635,16 +636,24 @@
|
|
|
635
636
|
// fires. flushContract() PUTs the live contract and resolves; a save failure aborts the bake.
|
|
636
637
|
const win = frames.model && frames.model.contentWindow;
|
|
637
638
|
if (win && typeof win.flushContract === 'function') await win.flushContract();
|
|
638
|
-
const res = await api(`/api/contract/${encodeURIComponent(
|
|
639
|
-
if (res && res.approvedAt)
|
|
640
|
-
|
|
641
|
-
|
|
639
|
+
const res = await api(`/api/contract/${encodeURIComponent(approvingProject.app)}/approve?project=${encodeURIComponent(approvingProject.id)}`, { method: 'POST' });
|
|
640
|
+
if (res && res.approvedAt) approvingProject.approvedAt = res.approvedAt; // unlock exports
|
|
641
|
+
const stillOpen = current && current.id === approvingProject.id;
|
|
642
|
+
if (stillOpen && !$wsHistory.hidden && res && res.version && Number.isInteger(Number(res.version.n))) {
|
|
643
|
+
expandDiffOnce = { projectId: approvingProject.id, n: Number(res.version.n) };
|
|
644
|
+
}
|
|
645
|
+
showToast(`Approved — "${approvingProject.name}" is baked into ${appDisplayName(approvingProject.app)}`, 'ok');
|
|
646
|
+
track('workspace_project_approved', { app: approvingProject.app }); // a successful sign-off
|
|
642
647
|
// First Approve for this app calms the "✦ Start here" beacon (the document-archetype
|
|
643
648
|
// analog of a workflow's first Run); ticks the Review + Approve guide rows.
|
|
644
|
-
if (bridge.markWorkspaceApproved &&
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
if (
|
|
649
|
+
if (bridge.markWorkspaceApproved && WORKSPACE_APPS[approvingProject.app]?.docGuide) {
|
|
650
|
+
bridge.markWorkspaceApproved(approvingProject.app);
|
|
651
|
+
}
|
|
652
|
+
if (stillOpen) {
|
|
653
|
+
syncWorkspaceGuide();
|
|
654
|
+
if (!$wsExports.hidden) renderExports(); // reflect the unlocked gate immediately if it's open
|
|
655
|
+
if (!$wsHistory.hidden) await renderHistory(); // reflect it, clear the banner, and open the new version's comparison
|
|
656
|
+
}
|
|
648
657
|
} catch (err) {
|
|
649
658
|
showToast('Approve failed: ' + (err && err.message || err), 'warn');
|
|
650
659
|
} finally { btn.disabled = false; btn.textContent = prev; }
|
|
@@ -2103,6 +2112,32 @@
|
|
|
2103
2112
|
};
|
|
2104
2113
|
|
|
2105
2114
|
let versions = []; // last-rendered ledger (newest first)
|
|
2115
|
+
let expandDiffOnce = null; // { projectId, n }: successful Approve opens only that project's new row
|
|
2116
|
+
|
|
2117
|
+
function changeCellHtml(v, canDiff) {
|
|
2118
|
+
const s = v.changeSummary;
|
|
2119
|
+
const n = Number(v.n);
|
|
2120
|
+
const summaryBase = s && Number.isInteger(Number(s.from)) ? Number(s.from) : null;
|
|
2121
|
+
const baseAttr = summaryBase != null ? ` data-diff-base="${escapeAttr(String(summaryBase))}"` : '';
|
|
2122
|
+
const toggle = canDiff
|
|
2123
|
+
? `<button type="button" class="hd-toggle" data-diff="${escapeAttr(String(n))}"${baseAttr} aria-expanded="false" ` +
|
|
2124
|
+
`aria-controls="hist-diff-${escapeAttr(String(n))}" aria-label="View detailed changes in version ${escapeAttr(String(n))}" ` +
|
|
2125
|
+
'data-tip="Show the complete member-by-member comparison">' +
|
|
2126
|
+
'<span class="hd-caret">▸</span><span class="hd-toggle-label">View detailed changes</span></button>'
|
|
2127
|
+
: '';
|
|
2128
|
+
if (!s || !Array.isArray(s.bullets)) {
|
|
2129
|
+
return `<div class="hist-event">${escapeHtml(v.message)}</div>${toggle}`;
|
|
2130
|
+
}
|
|
2131
|
+
const visible = s.bullets.slice(0, 4);
|
|
2132
|
+
const more = s.bullets.length - visible.length;
|
|
2133
|
+
const bullets = visible.map((x) => `<li>${escapeHtml(String(x))}</li>`).join('') +
|
|
2134
|
+
(more > 0 ? `<li class="hist-change-more">${escapeHtml(`${more} more change ${more === 1 ? 'category' : 'categories'} in the detailed view.`)}</li>` : '');
|
|
2135
|
+
const cautions = Array.isArray(s.cautions) && s.cautions.length
|
|
2136
|
+
? `<div class="hist-change-caution">⚠ ${escapeHtml(s.cautions.join(' '))}</div>`
|
|
2137
|
+
: '';
|
|
2138
|
+
return `<div class="hist-change-head">${escapeHtml(String(s.headline || v.message))}</div>` +
|
|
2139
|
+
`<ul class="hist-change-list">${bullets}</ul>${cautions}${toggle}`;
|
|
2140
|
+
}
|
|
2106
2141
|
|
|
2107
2142
|
function versionRowHtml(v) {
|
|
2108
2143
|
// Rolling back to the version you're already on is a no-op — omit the button (blank cell), never disable it.
|
|
@@ -2112,21 +2147,20 @@
|
|
|
2112
2147
|
// "What changed" disclosure — only when the app HAS a semantic diff (steel; wsApp().diff) AND the
|
|
2113
2148
|
// version has a predecessor (n>1). v1 is the baseline, and a no-diff app (vectorize) gets NO toggle
|
|
2114
2149
|
// on ANY row — an ABSENT control, never a disabled one (spec §4.4, mirroring the v1-baseline branch).
|
|
2115
|
-
const
|
|
2116
|
-
const
|
|
2117
|
-
? `<button type="button" class="hd-toggle" data-diff="${escapeAttr(String(v.n))}" aria-expanded="false" data-tip="What changed vs the previous version"><span class="hd-caret">▸</span></button>`
|
|
2118
|
-
: '';
|
|
2150
|
+
const isApprovalBaseline = v.kind === 'approve' && v.changeSummary && v.changeSummary.from == null;
|
|
2151
|
+
const canDiff = !!(wsApp() && wsApp().diff) && Number(v.n) > 1 && !isApprovalBaseline;
|
|
2119
2152
|
const verRow = `<tr class="${v.current ? 'current' : ''}" data-ver="${escapeAttr(String(v.n))}">` +
|
|
2120
|
-
`<td class="hd-cell">${toggle}</td>` +
|
|
2121
2153
|
`<td><span class="ver${v.current ? ' cur' : ''}">v${escapeHtml(String(v.n))}</span></td>` +
|
|
2122
2154
|
`<td class="htime">${escapeHtml(histWhen(v.ts))}</td>` +
|
|
2123
2155
|
`<td><span class="hby">${avatarFor(v.author)}${escapeHtml(v.author)}</span></td>` +
|
|
2124
2156
|
`<td>${gateBadge(v.gate, v.kind, v.n)}</td>` +
|
|
2125
|
-
`<td class="change">${
|
|
2157
|
+
`<td class="change">${changeCellHtml(v, canDiff)}</td>` +
|
|
2126
2158
|
`<td>${action}</td></tr>`;
|
|
2127
2159
|
// The disclosure row is always emitted (hidden) so toggling is a pure show/hide + lazy fetch.
|
|
2128
2160
|
const diffRow = canDiff
|
|
2129
|
-
? `<tr class="hist-diff-row" data-diff-for="${escapeAttr(String(v.n))}" hidden><td colspan="
|
|
2161
|
+
? `<tr class="hist-diff-row" data-diff-for="${escapeAttr(String(v.n))}" hidden><td colspan="6">` +
|
|
2162
|
+
`<div class="hd-panel" id="hist-diff-${escapeAttr(String(v.n))}" data-panel="${escapeAttr(String(v.n))}" role="region" ` +
|
|
2163
|
+
`aria-label="Detailed changes in version ${escapeAttr(String(v.n))}"></div></td></tr>`
|
|
2130
2164
|
: '';
|
|
2131
2165
|
return verRow + diffRow;
|
|
2132
2166
|
}
|
|
@@ -2176,10 +2210,14 @@
|
|
|
2176
2210
|
// Version/Gate/action are fixed-narrow; When/By auto-size to their nowrap content (fixing them
|
|
2177
2211
|
// wider than the content wastes room and needlessly wraps Change). Change flexes to the rest.
|
|
2178
2212
|
'<table class="hist"><thead><tr>' +
|
|
2179
|
-
'<th style="width:26px"></th>' +
|
|
2180
2213
|
'<th style="width:44px">Version</th><th>When</th><th>By</th>' +
|
|
2181
2214
|
'<th style="width:80px">Gate</th><th style="width:99%">Change</th><th style="width:92px"></th>' +
|
|
2182
2215
|
'</tr></thead><tbody>' + rows.map(versionRowHtml).join('') + '</tbody></table>';
|
|
2216
|
+
if (expandDiffOnce && expandDiffOnce.projectId === id) {
|
|
2217
|
+
const toggle = $wsHistory.querySelector(`.hd-toggle[data-diff="${CSS.escape(String(expandDiffOnce.n))}"]`);
|
|
2218
|
+
expandDiffOnce = null;
|
|
2219
|
+
if (toggle) toggleDiff(toggle);
|
|
2220
|
+
}
|
|
2183
2221
|
}
|
|
2184
2222
|
|
|
2185
2223
|
// Rollback confirm — a styled anchored popover (never a native dialog); names the Exports re-lock.
|
|
@@ -2391,12 +2429,29 @@
|
|
|
2391
2429
|
if (row.hasAttribute('hidden')) {
|
|
2392
2430
|
row.removeAttribute('hidden');
|
|
2393
2431
|
btn.setAttribute('aria-expanded', 'true');
|
|
2432
|
+
btn.setAttribute('aria-label', `Hide detailed changes in version ${n}`);
|
|
2433
|
+
const label = btn.querySelector('.hd-toggle-label');
|
|
2434
|
+
if (label) label.textContent = 'Hide detailed changes';
|
|
2394
2435
|
if (verRow) verRow.classList.add('hd-open');
|
|
2395
2436
|
const panel = row.querySelector('.hd-panel');
|
|
2396
|
-
if (panel && !panel.dataset.stamp)
|
|
2437
|
+
if (panel && !panel.dataset.stamp) {
|
|
2438
|
+
const key = baseKeyFor(n);
|
|
2439
|
+
let base = diffBase.get(key);
|
|
2440
|
+
if (!diffBase.has(key) && btn.dataset.diffBase) {
|
|
2441
|
+
const summaryBase = Number(btn.dataset.diffBase);
|
|
2442
|
+
if (Number.isInteger(summaryBase)) {
|
|
2443
|
+
diffBase.set(key, summaryBase);
|
|
2444
|
+
base = summaryBase;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
loadDiff(n, base); // lazy first load; approval rows start at the previous signed version
|
|
2448
|
+
}
|
|
2397
2449
|
} else {
|
|
2398
2450
|
row.setAttribute('hidden', '');
|
|
2399
2451
|
btn.setAttribute('aria-expanded', 'false');
|
|
2452
|
+
btn.setAttribute('aria-label', `View detailed changes in version ${n}`);
|
|
2453
|
+
const label = btn.querySelector('.hd-toggle-label');
|
|
2454
|
+
if (label) label.textContent = 'View detailed changes';
|
|
2400
2455
|
if (verRow) verRow.classList.remove('hd-open');
|
|
2401
2456
|
}
|
|
2402
2457
|
}
|