@floless/app 0.112.0 → 0.112.1

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.
@@ -53887,7 +53887,7 @@ function appVersion() {
53887
53887
  return resolveVersion({
53888
53888
  isSea: isSea2(),
53889
53889
  sqVersionXml: readSqVersionXml(),
53890
- define: true ? "0.112.0" : void 0,
53890
+ define: true ? "0.112.1" : void 0,
53891
53891
  pkgVersion: readPkgVersion()
53892
53892
  });
53893
53893
  }
@@ -53903,7 +53903,7 @@ function resolveChannel(s) {
53903
53903
  function appChannel() {
53904
53904
  return resolveChannel({
53905
53905
  isSea: isSea2(),
53906
- define: true ? "0.112.0" : void 0,
53906
+ define: true ? "0.112.1" : void 0,
53907
53907
  // argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
53908
53908
  // carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
53909
53909
  modulePath: process.argv[1]
@@ -61642,6 +61642,20 @@ function registerKnowledgeRoutes(app) {
61642
61642
  );
61643
61643
  }
61644
61644
 
61645
+ // mutation-id.ts
61646
+ var MUTATION_ID_RE = /^[A-Za-z0-9._~-]{1,64}$/;
61647
+ function sanitizeMutationId(raw) {
61648
+ if (typeof raw !== "string") return void 0;
61649
+ return MUTATION_ID_RE.test(raw) ? raw : void 0;
61650
+ }
61651
+ function contractChangedEvent(appId, project, etag, rawMutationId) {
61652
+ const mutationId = sanitizeMutationId(rawMutationId);
61653
+ return { type: "contract-changed", appId, project, etag, ...mutationId ? { mutationId } : {} };
61654
+ }
61655
+ function contractChangedWithReason(appId, project, reason) {
61656
+ return { type: "contract-changed", appId, project, reason };
61657
+ }
61658
+
61645
61659
  // steel-revision-registry.ts
61646
61660
  var IGNORED_INPUT = /* @__PURE__ */ new Set([
61647
61661
  "$.read_notes",
@@ -65929,7 +65943,7 @@ function registerRevisionRoutes(app) {
65929
65943
  const message = typeof req.body?.message === "string" && req.body.message.trim() ? req.body.message.trim() : "Re-read a revised drawing set";
65930
65944
  const source = request.sourceRefs && request.sourceRefs.length ? { files: request.sourceRefs, requestId: request.id } : void 0;
65931
65945
  const version = createVersion(project.id, req.body.contract, { author: "AI", message, gate: null, kind: "revision-read", source });
65932
- broadcast({ type: "contract-changed", appId: project.app, project: project.id });
65946
+ broadcast(contractChangedWithReason(project.app, project.id, "revision-read"));
65933
65947
  deleteRequest(request.id);
65934
65948
  return { ok: true, version };
65935
65949
  }
@@ -66073,7 +66087,7 @@ function registerRevisionRoutes(app) {
66073
66087
  const message = typeof req.body?.message === "string" && req.body.message.trim() ? req.body.message.trim() : "Re-read a revised drawing set";
66074
66088
  const source = request.sourceRefs && request.sourceRefs.length ? { files: request.sourceRefs, requestId: request.id } : void 0;
66075
66089
  const version = createVersion(project.id, next, { author: "AI", message, gate: null, kind: "revision-read", source });
66076
- broadcast({ type: "contract-changed", appId: project.app, project: project.id });
66090
+ broadcast(contractChangedWithReason(project.app, project.id, "revision-read"));
66077
66091
  dropStagingFor(stagingKey);
66078
66092
  deleteRequest(request.id);
66079
66093
  return { ok: true, version };
@@ -66981,7 +66995,7 @@ function registerMigrationCommitRoute(app, deps) {
66981
66995
  expectLedgerHead: head,
66982
66996
  expectDecisions: decisions
66983
66997
  });
66984
- deps.broadcast({ type: "contract-changed", appId: req.params.appId, project });
66998
+ deps.broadcast(contractChangedWithReason(req.params.appId, project, "migration"));
66985
66999
  return reply.send(res);
66986
67000
  } catch (e) {
66987
67001
  if (e instanceof RecoveryPendingError) {
@@ -75567,17 +75581,6 @@ function syncSkills() {
75567
75581
  return results;
75568
75582
  }
75569
75583
 
75570
- // mutation-id.ts
75571
- var MUTATION_ID_RE = /^[A-Za-z0-9._~-]{1,64}$/;
75572
- function sanitizeMutationId(raw) {
75573
- if (typeof raw !== "string") return void 0;
75574
- return MUTATION_ID_RE.test(raw) ? raw : void 0;
75575
- }
75576
- function contractChangedEvent(appId, project, etag, rawMutationId) {
75577
- const mutationId = sanitizeMutationId(rawMutationId);
75578
- return { type: "contract-changed", appId, project, etag, ...mutationId ? { mutationId } : {} };
75579
- }
75580
-
75581
75584
  // watch.ts
75582
75585
  var import_node_os25 = require("node:os");
75583
75586
  var import_node_path44 = require("node:path");
@@ -78103,7 +78106,7 @@ async function startServer() {
78103
78106
  if (currentDoc != null && declaredTypeOf(currentDoc) === STEEL_V2 && declaredTypeOf(doc) === STEEL_V1) {
78104
78107
  try {
78105
78108
  const res = await runRollbackToV1({ appId: project.app, projectId: project.id, doc, versionN: n });
78106
- broadcast({ type: "contract-changed", appId: project.app, project: project.id });
78109
+ broadcast(contractChangedWithReason(project.app, project.id, "rollback"));
78107
78110
  return { ok: true, version: listVersions(project.id).find((v) => v.n === res.versionN) ?? null };
78108
78111
  } catch (e) {
78109
78112
  if (e instanceof RecoveryPendingError) return reply.status(409).send({ ok: false, error: e.message, code: e.code });
@@ -78122,7 +78125,7 @@ async function startServer() {
78122
78125
  }
78123
78126
  clearApproval(project.id);
78124
78127
  const row = createVersion(project.id, doc, { author: "You", message: `Rolled back to v${n}`, gate: null, kind: "rollback" });
78125
- broadcast({ type: "contract-changed", appId: project.app, project: project.id });
78128
+ broadcast(contractChangedWithReason(project.app, project.id, "rollback"));
78126
78129
  return { ok: true, version: row };
78127
78130
  });
78128
78131
  registerRevisionRoutes(app);
@@ -1591,8 +1591,21 @@ async function boot() {
1591
1591
  // bearing on its own merits and stays.)
1592
1592
  const hasUnsaved = !!sv && (sv.classList.contains('dirty') || sv.classList.contains('err')
1593
1593
  || sv.classList.contains('conflict'));
1594
- if (hasUnsaved) showAiUpdateBanner('The AI updated this model — reload to see it (you have unsaved edits).');
1595
- else location.reload();
1594
+ if (hasUnsaved) {
1595
+ // WHAT happened, not a guess at who. Absent or unrecognised → today's wording byte for byte.
1596
+ // The contract PUT — the one writer that usually IS the terminal AI — deliberately sends no
1597
+ // reason, so the generic sentence stays correct for it; and a tab left open across an
1598
+ // auto-update can outlive its server, so a token from a NEWER build has to degrade quietly
1599
+ // rather than reach the bar.
1600
+ //
1601
+ // Read INSIDE this branch on purpose. Computed above the `if`, a `CHANGE_LEAD` that ever
1602
+ // became unreachable (P3 is actively refactoring `main()`'s closure) would throw here — and
1603
+ // an exception at this point means the tab neither banners NOR reloads, silently going deaf
1604
+ // to external writes with the error swallowed by the event loop. The reload path must not be
1605
+ // able to fail for a reason that only the banner path cares about.
1606
+ const lead = (typeof m.reason === 'string' && CHANGE_LEAD[m.reason]) || 'The AI updated this model';
1607
+ showAiUpdateBanner(lead + ' — reload to see it (you have unsaved edits).');
1608
+ } else location.reload();
1596
1609
  };
1597
1610
  es.onerror = () => {
1598
1611
  // Transient drops (readyState CONNECTING) auto-reconnect — ignore. A CLOSED channel is
@@ -1613,6 +1626,48 @@ async function boot() {
1613
1626
  }
1614
1627
  }
1615
1628
 
1629
+ /**
1630
+ * What to CALL the change that arrived, keyed by the server's `reason` token (server/mutation-id.ts,
1631
+ * `ContractChangeReason`).
1632
+ *
1633
+ * THE TOKEN IS THE SERVER'S; THE SENTENCE IS OURS. Nothing from the frame is ever rendered — the frame
1634
+ * only SELECTS a row from this table — so no value arriving over the wire can become copy on screen.
1635
+ * That is also why the wire tokens can stay terse and internal while these stay plain English.
1636
+ *
1637
+ * Each string matches the vocabulary of the control the user actually operated, because closing the loop
1638
+ * between what they clicked and what this bar says is the whole job here: History's button reads
1639
+ * "↺ Rollback" (workspaces.js), the conversion's reads "Convert to the 3D model →", and the History pane
1640
+ * already describes a re-read as "The AI read a revised drawing set". Copy that drifts from the control
1641
+ * it describes sends the user looking for a second, non-existent event.
1642
+ *
1643
+ * Only `revision-read` names an actor, and that asymmetry is deliberate rather than sloppy: a re-read
1644
+ * genuinely IS AI-authored (`author: 'AI'`, the History badge reads "AI read"), while a rollback and a
1645
+ * conversion are the user's own doing — saying "the AI" there is the untruth this table exists to fix.
1646
+ * Neither says "you", because this frame does not carry WHO, and a sentence that asserts the reader did
1647
+ * it would be guessing at the one fact the wire withheld.
1648
+ *
1649
+ * The staged confirm (`revision-routes.ts`, the second site) shares `revision-read` even though a human
1650
+ * picked which proposals to apply. Deliberate: the AI still authored the read, and the ledger records
1651
+ * both the same way (`author: 'AI'`, `kind: 'revision-read'`). That is unlike rollback, where blaming
1652
+ * the AI was flatly false rather than merely coarse. Split the token if the two ever want different
1653
+ * sentences — nothing here assumes they cannot.
1654
+ *
1655
+ * NULL PROTOTYPE, deliberately. A plain object literal answers `CHANGE_LEAD['constructor']` with a
1656
+ * FUNCTION, so a frame carrying `reason:"constructor"` would concatenate "function Object() { [native
1657
+ * code] }" into the banner. With no prototype there is nothing to inherit, and every unknown token —
1658
+ * malformed, hostile, or simply from a newer server — falls through to the generic sentence.
1659
+ */
1660
+ const CHANGE_LEAD = Object.assign(Object.create(null), {
1661
+ 'rollback': 'This model was rolled back',
1662
+ // "a revised" is a DEFAULT, not a proof. An initial read can reach this in principle — "initial" is
1663
+ // decided by the version ledger, not by the contract, and a seeded project has a contract before it
1664
+ // has a v1 (`workspaces.js` renders exactly that empty state). It is rare, and the frame carries no
1665
+ // base version to tell the two apart, so the common case wins. `workspaces.js` distinguishes them
1666
+ // ("the initial" vs "a revised") only because it has the ledger to hand; here we do not.
1667
+ 'revision-read': 'The AI read a revised drawing set into this model',
1668
+ 'migration': 'This project was converted to the 3D model',
1669
+ });
1670
+
1616
1671
  /**
1617
1672
  * The bottom bar for "this model changed underneath you".
1618
1673
  *
@@ -1643,7 +1698,11 @@ function showAiUpdateBanner(message, opts) {
1643
1698
 
1644
1699
  const msg = document.createElement('span');
1645
1700
  msg.style.cssText = 'flex:1';
1646
- msg.textContent = message || 'The AI updated this model — reload to see the latest version.';
1701
+ // The fallback is deliberately CAUSE-FREE. All five callers pass a message, so this is unreachable
1702
+ // today — but it was the last place in the file still asserting "the AI" about a change nobody has
1703
+ // established the AI made, which is the claim this bar stopped making. A caller that forgets its
1704
+ // message should say nothing it cannot support.
1705
+ msg.textContent = message || 'This model changed — reload to see the latest version.';
1647
1706
 
1648
1707
  const reloadBtn = document.createElement('button');
1649
1708
  reloadBtn.style.cssText = 'background:#3b82f6;color:#fff;border:1px solid #60a5fa;border-radius:6px;padding:5px 12px;cursor:pointer;font:13px system-ui';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.112.0",
3
+ "version": "0.112.1",
4
4
  "type": "module",
5
- "description": "Thin localhost host for floless.app \u00e2\u20ac\u201d serves web/ and shells the aware CLI. No engine, no LLM.",
5
+ "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {
7
7
  "floless-app": "bin/floless.mjs"
8
8
  },
@@ -31,6 +31,7 @@
31
31
  "verify:gateway": "node build/verify-contract-gateway.mjs",
32
32
  "verify:flo-versions": "node build/verify-flo-versions.mjs",
33
33
  "verify:boundary": "node build/verify-model-boundary.mjs",
34
+ "verify:change-reasons": "node build/verify-change-reasons.mjs",
34
35
  "typecheck": "tsc --noEmit",
35
36
  "prepack": "npm run build"
36
37
  },