@volter/world-runtime 3.0.32 → 3.0.33

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.
@@ -2656,11 +2656,30 @@ export class WorldDoors {
2656
2656
  if (home)
2657
2657
  listed = [{ id: `home:${home.id}`, kind: 'home', title: vendor, section: { id: 'home', title: 'Home' }, url: home.path, covers: [], drawn: true }];
2658
2658
  }
2659
+ const entries = wholeLog(this.stateOf(vendor), this.controlRoot(vendor));
2660
+ // One index per vendor, rather than scanning its history for every page on every board read.
2661
+ const positions = new Map();
2662
+ let vendorPosition = 0;
2663
+ for (let i = 0; i < entries.length; i++) {
2664
+ const entry = entries[i];
2665
+ if (entry.subject.type.startsWith('_'))
2666
+ continue;
2667
+ vendorPosition = i + 1;
2668
+ positions.set(`${entry.subject.type}:${entry.subject.id}`, vendorPosition);
2669
+ if (entry.aliasOf)
2670
+ positions.set(`${entry.subject.type}:${entry.aliasOf}`, vendorPosition);
2671
+ }
2659
2672
  for (const f of listed) {
2660
2673
  const covered = new Set(f.covers.map(c => `${c.type}:${c.id}`));
2661
2674
  const mine = changes.filter(x => x.service === vendor && (fallback || covered.has(`${x.action.subject.type}:${x.action.subject.id}`)));
2675
+ // A page's revision includes already-cut writes and landed receipts, independent of the board's filter.
2676
+ // Another page's writes never move it. A fallback home covers the vendor's public writes, as its change count does.
2677
+ let position = fallback ? vendorPosition : 0;
2678
+ if (!fallback)
2679
+ for (const key of covered)
2680
+ position = Math.max(position, positions.get(key) ?? 0);
2662
2681
  const add = (at, browser, unseen) => {
2663
- frames.push({ frame: { vendor, ...(browser ? { browser } : {}), id: f.id, kind: f.kind, title: f.title, section: f.section, url: f.url, at, ...(f.parent ? { parent: f.parent } : {}), ...(f.ours ? { ours: true } : {}), ...(unseen ? { unseen } : {}) }, mine });
2682
+ frames.push({ frame: { vendor, ...(browser ? { browser } : {}), id: f.id, kind: f.kind, title: f.title, section: f.section, url: f.url, position, at, ...(f.parent ? { parent: f.parent } : {}), ...(f.ours ? { ours: true } : {}), ...(unseen ? { unseen } : {}) }, mine });
2664
2683
  };
2665
2684
  let plain = false;
2666
2685
  const openedBrowsers = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/world-runtime",
3
- "version": "3.0.32",
3
+ "version": "3.0.33",
4
4
  "description": "World configs for twins: boot named local runtimes, allocate ports, generate world.env/instance.json, and run apps against fake-key twin worlds.",
5
5
  "keywords": [
6
6
  "twin",
@@ -68,14 +68,14 @@
68
68
  "node": ">=22.3"
69
69
  },
70
70
  "peerDependencies": {
71
- "@volter/world-core": "3.0.32",
72
- "@volter/world-console": "3.0.27"
71
+ "@volter/world-core": "3.0.33",
72
+ "@volter/world-console": "3.0.28"
73
73
  },
74
74
  "dependencies": {
75
75
  "@electric-sql/pglite": "0.5.8",
76
76
  "@electric-sql/pglite-pgvector": "0.0.9",
77
77
  "@volter/world-access": "3.0.1",
78
- "@volter/world-core": "3.0.32",
78
+ "@volter/world-core": "3.0.33",
79
79
  "pg-gateway": "0.3.0-beta.4",
80
80
  "smol-toml": "^1.8.0",
81
81
  "yaml": "2.9.0"
@@ -2212,11 +2212,26 @@ export class WorldDoors {
2212
2212
  homeHost = home?.host;
2213
2213
  if (home) listed = [{ id: `home:${home.id}`, kind: 'home', title: vendor, section: { id: 'home', title: 'Home' }, url: home.path, covers: [], drawn: true }];
2214
2214
  }
2215
+ const entries = wholeLog(this.stateOf(vendor), this.controlRoot(vendor));
2216
+ // One index per vendor, rather than scanning its history for every page on every board read.
2217
+ const positions = new Map<string, number>();
2218
+ let vendorPosition = 0;
2219
+ for (let i = 0; i < entries.length; i++) {
2220
+ const entry = entries[i]!;
2221
+ if (entry.subject.type.startsWith('_')) continue;
2222
+ vendorPosition = i + 1;
2223
+ positions.set(`${entry.subject.type}:${entry.subject.id}`, vendorPosition);
2224
+ if (entry.aliasOf) positions.set(`${entry.subject.type}:${entry.aliasOf}`, vendorPosition);
2225
+ }
2215
2226
  for (const f of listed) {
2216
2227
  const covered = new Set(f.covers.map(c => `${c.type}:${c.id}`));
2217
2228
  const mine = changes.filter(x => x.service === vendor && (fallback || covered.has(`${x.action.subject.type}:${x.action.subject.id}`)));
2229
+ // A page's revision includes already-cut writes and landed receipts, independent of the board's filter.
2230
+ // Another page's writes never move it. A fallback home covers the vendor's public writes, as its change count does.
2231
+ let position = fallback ? vendorPosition : 0;
2232
+ if (!fallback) for (const key of covered) position = Math.max(position, positions.get(key) ?? 0);
2218
2233
  const add = (at: { site: string } | { screen: string } | null, browser?: string, unseen?: string): void => {
2219
- frames.push({ frame: { vendor, ...(browser ? { browser } : {}), id: f.id, kind: f.kind, title: f.title, section: f.section, url: f.url, at, ...(f.parent ? { parent: f.parent } : {}), ...(f.ours ? { ours: true } : {}), ...(unseen ? { unseen } : {}) }, mine });
2234
+ frames.push({ frame: { vendor, ...(browser ? { browser } : {}), id: f.id, kind: f.kind, title: f.title, section: f.section, url: f.url, position, at, ...(f.parent ? { parent: f.parent } : {}), ...(f.ours ? { ours: true } : {}), ...(unseen ? { unseen } : {}) }, mine });
2220
2235
  };
2221
2236
  let plain = false;
2222
2237
  const openedBrowsers: Array<{ browser: string; at: string }> = [];