@holoscript/core 8.0.12 → 8.0.13

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.
Files changed (46) hide show
  1. package/dist/{HoloCompositionParser-3XEC7IJC.cjs → HoloCompositionParser-6GW2BZID.cjs} +3 -3
  2. package/dist/{HoloCompositionParser-FLBZKFD3.js → HoloCompositionParser-P4Y3CXKQ.js} +3 -3
  3. package/dist/{HoloScriptPlusParser-55AY4MUF.js → HoloScriptPlusParser-HQV6IJAH.js} +4 -4
  4. package/dist/{HoloScriptPlusParser-RNUCHOAJ.cjs → HoloScriptPlusParser-RFNHRMPE.cjs} +7 -7
  5. package/dist/{chunk-Z4IUBW46.js → chunk-A4OOLBZD.js} +111 -54
  6. package/dist/{chunk-TYNRXRHF.js → chunk-DJ5BNRIS.js} +30 -9
  7. package/dist/{chunk-G3BM3CT4.cjs → chunk-DVHZD5HV.cjs} +5 -5
  8. package/dist/{chunk-7NPZZZD7.js → chunk-FRSKLX6I.js} +8 -4
  9. package/dist/{chunk-JBYBMBMW.js → chunk-FWKEY4LD.js} +3 -2
  10. package/dist/{chunk-USOUXQYD.js → chunk-G6EKZHXY.js} +129 -21
  11. package/dist/{chunk-QX34ELJ7.js → chunk-G72754QB.js} +3 -3
  12. package/dist/{chunk-OMNHTCS4.cjs → chunk-LHUDAJQT.cjs} +3 -2
  13. package/dist/{chunk-KEYG7HGY.js → chunk-ONPVM4IV.js} +163 -3
  14. package/dist/{chunk-RMOEL2GD.cjs → chunk-PXVAPGTR.cjs} +31 -10
  15. package/dist/{chunk-656IAS7B.cjs → chunk-Q4K2GEMW.cjs} +10 -6
  16. package/dist/{chunk-VO52AJD5.js → chunk-RVNXBF2M.js} +3 -3
  17. package/dist/{chunk-7N63JHUN.cjs → chunk-RZ2EPXO3.cjs} +3 -3
  18. package/dist/{chunk-5H5GFBMG.cjs → chunk-SQAAWO4V.cjs} +111 -54
  19. package/dist/{chunk-W2GA3EQB.cjs → chunk-TC7JEO6R.cjs} +163 -3
  20. package/dist/{chunk-TX6ZBIF4.js → chunk-U3D4SYQ5.js} +3 -3
  21. package/dist/{chunk-EI5G5JLY.cjs → chunk-XF63CZ7E.cjs} +133 -21
  22. package/dist/{chunk-3KMANSQJ.cjs → chunk-Y57AVOM2.cjs} +4 -4
  23. package/dist/cli/holoscript-runner.cjs +9 -9
  24. package/dist/cli/holoscript-runner.js +2 -2
  25. package/dist/compiler/incremental.cjs +6 -6
  26. package/dist/compiler/incremental.js +1 -1
  27. package/dist/compiler/index.cjs +84 -84
  28. package/dist/compiler/index.js +5 -5
  29. package/dist/compiler/webgpu.cjs +3 -3
  30. package/dist/compiler/webgpu.js +2 -2
  31. package/dist/constants.cjs +3 -3
  32. package/dist/constants.js +1 -1
  33. package/dist/entries/scripting.cjs +1 -1
  34. package/dist/entries/scripting.js +1 -1
  35. package/dist/evolution/index.cjs +19 -15
  36. package/dist/evolution/index.d.ts +9 -0
  37. package/dist/evolution/index.js +4 -4
  38. package/dist/index.cjs +196 -180
  39. package/dist/index.js +15 -15
  40. package/dist/parser.cjs +13 -13
  41. package/dist/parser.js +3 -3
  42. package/dist/reconstruction/index.cjs +38 -38
  43. package/dist/reconstruction/index.js +2 -2
  44. package/dist/traits/index.cjs +4 -4
  45. package/dist/traits/index.js +1 -1
  46. package/package.json +20 -40
@@ -3,7 +3,7 @@
3
3
  var chunkJ3UHV5T4_cjs = require('./chunk-J3UHV5T4.cjs');
4
4
  require('./chunk-3VBO3IYQ.cjs');
5
5
  require('./chunk-OIBRWLPY.cjs');
6
- require('./chunk-OMNHTCS4.cjs');
6
+ require('./chunk-LHUDAJQT.cjs');
7
7
  require('./chunk-EI3J6LTW.cjs');
8
8
  require('./chunk-36NPLOI4.cjs');
9
9
  require('./chunk-AWXFEAQL.cjs');
@@ -41,5 +41,5 @@ Object.defineProperty(exports, "parseHoloStrict", {
41
41
  enumerable: true,
42
42
  get: function () { return chunkJ3UHV5T4_cjs.parseHoloStrict; }
43
43
  });
44
- //# sourceMappingURL=HoloCompositionParser-3XEC7IJC.cjs.map
45
- //# sourceMappingURL=HoloCompositionParser-3XEC7IJC.cjs.map
44
+ //# sourceMappingURL=HoloCompositionParser-6GW2BZID.cjs.map
45
+ //# sourceMappingURL=HoloCompositionParser-6GW2BZID.cjs.map
@@ -1,12 +1,12 @@
1
1
  export { HoloCompositionParser, KEYWORDS, LIGHT_PRIMITIVES, PRIMITIVE_SHAPES, parseHolo, parseHoloPartial, parseHoloStrict } from './chunk-FHVPN7BN.js';
2
2
  import './chunk-SYTRBGDS.js';
3
3
  import './chunk-CP7V3ATL.js';
4
- import './chunk-JBYBMBMW.js';
4
+ import './chunk-FWKEY4LD.js';
5
5
  import './chunk-2EGGAZT3.js';
6
6
  import './chunk-YW3I2FQL.js';
7
7
  import './chunk-7I74JWPW.js';
8
8
  import './chunk-2I3XAGMF.js';
9
9
  import './chunk-MD4IVS42.js';
10
10
  import './chunk-W4GABFCR.js';
11
- //# sourceMappingURL=HoloCompositionParser-FLBZKFD3.js.map
12
- //# sourceMappingURL=HoloCompositionParser-FLBZKFD3.js.map
11
+ //# sourceMappingURL=HoloCompositionParser-P4Y3CXKQ.js.map
12
+ //# sourceMappingURL=HoloCompositionParser-P4Y3CXKQ.js.map
@@ -1,7 +1,7 @@
1
- export { HoloScriptPlusParser, createParser, parse } from './chunk-7NPZZZD7.js';
1
+ export { HoloScriptPlusParser, createParser, parse } from './chunk-FRSKLX6I.js';
2
2
  import './chunk-CP7V3ATL.js';
3
3
  import './chunk-UNMVGZVW.js';
4
- import './chunk-JBYBMBMW.js';
4
+ import './chunk-FWKEY4LD.js';
5
5
  import './chunk-2EGGAZT3.js';
6
6
  import './chunk-YW3I2FQL.js';
7
7
  import './chunk-7I74JWPW.js';
@@ -9,5 +9,5 @@ import './chunk-2I3XAGMF.js';
9
9
  import './chunk-MD4IVS42.js';
10
10
  import './chunk-63AUAIL6.js';
11
11
  import './chunk-W4GABFCR.js';
12
- //# sourceMappingURL=HoloScriptPlusParser-55AY4MUF.js.map
13
- //# sourceMappingURL=HoloScriptPlusParser-55AY4MUF.js.map
12
+ //# sourceMappingURL=HoloScriptPlusParser-HQV6IJAH.js.map
13
+ //# sourceMappingURL=HoloScriptPlusParser-HQV6IJAH.js.map
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunk656IAS7B_cjs = require('./chunk-656IAS7B.cjs');
3
+ var chunkQ4K2GEMW_cjs = require('./chunk-Q4K2GEMW.cjs');
4
4
  require('./chunk-OIBRWLPY.cjs');
5
5
  require('./chunk-YP5CHEYU.cjs');
6
- require('./chunk-OMNHTCS4.cjs');
6
+ require('./chunk-LHUDAJQT.cjs');
7
7
  require('./chunk-EI3J6LTW.cjs');
8
8
  require('./chunk-36NPLOI4.cjs');
9
9
  require('./chunk-AWXFEAQL.cjs');
@@ -16,15 +16,15 @@ require('./chunk-ZHPMP447.cjs');
16
16
 
17
17
  Object.defineProperty(exports, "HoloScriptPlusParser", {
18
18
  enumerable: true,
19
- get: function () { return chunk656IAS7B_cjs.HoloScriptPlusParser; }
19
+ get: function () { return chunkQ4K2GEMW_cjs.HoloScriptPlusParser; }
20
20
  });
21
21
  Object.defineProperty(exports, "createParser", {
22
22
  enumerable: true,
23
- get: function () { return chunk656IAS7B_cjs.createParser; }
23
+ get: function () { return chunkQ4K2GEMW_cjs.createParser; }
24
24
  });
25
25
  Object.defineProperty(exports, "parse", {
26
26
  enumerable: true,
27
- get: function () { return chunk656IAS7B_cjs.parse; }
27
+ get: function () { return chunkQ4K2GEMW_cjs.parse; }
28
28
  });
29
- //# sourceMappingURL=HoloScriptPlusParser-RNUCHOAJ.cjs.map
30
- //# sourceMappingURL=HoloScriptPlusParser-RNUCHOAJ.cjs.map
29
+ //# sourceMappingURL=HoloScriptPlusParser-RFNHRMPE.cjs.map
30
+ //# sourceMappingURL=HoloScriptPlusParser-RFNHRMPE.cjs.map
@@ -3,8 +3,8 @@ import { isWebGpuEnvironmentPresent, HOLOMAP_SIMULATION_CONTRACT_KIND } from './
3
3
 
4
4
  // src/version.ts
5
5
  var HOLOSCRIPT_VERSION = "8.0.12" ;
6
- var GIT_COMMIT_SHA = "530989456" ;
7
- var BUILD_TIMESTAMP = "2026-07-05T23:05:02.393Z" ;
6
+ var GIT_COMMIT_SHA = "65d9a9d46" ;
7
+ var BUILD_TIMESTAMP = "2026-07-07T08:36:54.702Z" ;
8
8
  function getVersionString() {
9
9
  const sha = `+${GIT_COMMIT_SHA}` ;
10
10
  return `${HOLOSCRIPT_VERSION}${sha}`;
@@ -1811,9 +1811,12 @@ function createPagedKVCache(config) {
1811
1811
  const freePhysicalPages = Array.from({ length: config.maxResidentPages }, (_, i) => i).reverse();
1812
1812
  const appendKernel = config.device ? createPagedKVAppendKernel(config.device) : null;
1813
1813
  const lookupKernel = config.device ? createPagedKVLookupKernel(config.device) : null;
1814
+ const residentPageStates = /* @__PURE__ */ new Set();
1814
1815
  let disposed = false;
1815
1816
  let nextPageId = 0;
1816
1817
  let accessClock = 0;
1818
+ let devicePageCount = 0;
1819
+ let hostPageCount = 0;
1817
1820
  function assertLive() {
1818
1821
  if (disposed) throw new Error("PagedKVCache has been disposed.");
1819
1822
  }
@@ -1848,9 +1851,7 @@ function createPagedKVCache(config) {
1848
1851
  valuePages.fill(0, offset, end);
1849
1852
  }
1850
1853
  function residentPages() {
1851
- return layers.flatMap(
1852
- (layer) => Array.from(layer.pages.values()).filter((page) => page.residency === "device")
1853
- );
1854
+ return Array.from(residentPageStates);
1854
1855
  }
1855
1856
  function evictPage(page) {
1856
1857
  if (page.physicalPage === null) return pageSnapshot(page);
@@ -1863,6 +1864,9 @@ function createPagedKVCache(config) {
1863
1864
  page.hostKeys = hostKeys;
1864
1865
  page.hostValues = hostValues;
1865
1866
  page.residency = "host";
1867
+ residentPageStates.delete(page);
1868
+ devicePageCount -= 1;
1869
+ hostPageCount += 1;
1866
1870
  return pageSnapshot(page);
1867
1871
  }
1868
1872
  function evictOldestInternal(count, protectedPage) {
@@ -1888,7 +1892,10 @@ function createPagedKVCache(config) {
1888
1892
  }
1889
1893
  const physicalPage = allocatePhysicalPage(page);
1890
1894
  page.physicalPage = physicalPage;
1895
+ if (page.residency === "host") hostPageCount -= 1;
1891
1896
  page.residency = "device";
1897
+ residentPageStates.add(page);
1898
+ devicePageCount += 1;
1892
1899
  page.lastAccess = ++accessClock;
1893
1900
  if (page.hostKeys) {
1894
1901
  keyPages.set(page.hostKeys, pageOffset(physicalPage));
@@ -1918,6 +1925,8 @@ function createPagedKVCache(config) {
1918
1925
  lastAccess: ++accessClock
1919
1926
  };
1920
1927
  layerState.pages.set(logicalPage, page);
1928
+ residentPageStates.add(page);
1929
+ devicePageCount += 1;
1921
1930
  return page;
1922
1931
  }
1923
1932
  function buildPageTable(layer, logicalPages) {
@@ -1935,27 +1944,32 @@ function createPagedKVCache(config) {
1935
1944
  }
1936
1945
  return pageTable;
1937
1946
  }
1938
- function appendCpu(pages, pageTable, slotMap, vectors) {
1939
- const out = new Float32Array(pages);
1947
+ function appendCpuInPlace(pages, touchedPages, vectors, startToken) {
1940
1948
  const numVecs = vectors.length / config.hiddenDim;
1941
1949
  for (let v = 0; v < numVecs; v += 1) {
1942
- const logicalPage = slotMap[v] >>> 16;
1943
- const inPage = slotMap[v] & 65535;
1944
- const physicalPage = pageTable[logicalPage];
1950
+ const token = startToken + v;
1951
+ const logicalPage = Math.floor(token / config.pageSize);
1952
+ const inPage = token % config.pageSize;
1953
+ const physicalPage = touchedPages.get(logicalPage)?.physicalPage;
1954
+ if (physicalPage === void 0 || physicalPage === null) {
1955
+ throw new Error(`PagedKVCache append misses resident logical page ${logicalPage}.`);
1956
+ }
1945
1957
  const base = physicalPage * config.pageSize * config.hiddenDim;
1946
1958
  for (let d = 0; d < config.hiddenDim; d += 1) {
1947
- out[base + inPage * config.hiddenDim + d] = vectors[v * config.hiddenDim + d];
1959
+ pages[base + inPage * config.hiddenDim + d] = vectors[v * config.hiddenDim + d];
1948
1960
  }
1949
1961
  }
1950
- return out;
1951
1962
  }
1952
- function lookupCpu(pages, pageTable, tokenCount, startToken) {
1963
+ function lookupCpuDirect(pages, layerState, tokenCount, startToken) {
1953
1964
  const out = new Float32Array(tokenCount * config.hiddenDim);
1954
1965
  for (let v = 0; v < tokenCount; v += 1) {
1955
1966
  const logicalSlot = startToken + v;
1956
1967
  const logicalPage = Math.floor(logicalSlot / config.pageSize);
1957
1968
  const inPage = logicalSlot % config.pageSize;
1958
- const physicalPage = pageTable[logicalPage];
1969
+ const physicalPage = layerState.pages.get(logicalPage)?.physicalPage;
1970
+ if (physicalPage === void 0 || physicalPage === null) {
1971
+ throw new Error(`PagedKVCache lookup misses resident logical page ${logicalPage}.`);
1972
+ }
1959
1973
  const base = physicalPage * config.pageSize * config.hiddenDim;
1960
1974
  for (let d = 0; d < config.hiddenDim; d += 1) {
1961
1975
  out[v * config.hiddenDim + d] = pages[base + inPage * config.hiddenDim + d];
@@ -1977,7 +1991,7 @@ function createPagedKVCache(config) {
1977
1991
  residentPagesForLayer(layer) {
1978
1992
  assertLive();
1979
1993
  validateLayer(layer);
1980
- return Array.from(layers[layer].pages.values()).filter((page) => page.residency === "device").sort((a, b) => a.firstToken - b.firstToken).map((page) => pageSnapshot(page));
1994
+ return Array.from(residentPageStates).filter((page) => page.layer === layer).sort((a, b) => a.firstToken - b.firstToken).map((page) => pageSnapshot(page));
1981
1995
  },
1982
1996
  evictOldest(count) {
1983
1997
  assertLive();
@@ -1988,23 +2002,18 @@ function createPagedKVCache(config) {
1988
2002
  },
1989
2003
  memoryUsage() {
1990
2004
  assertLive();
1991
- let devicePages = 0;
1992
- let hostPages = 0;
1993
- for (const layer of layers) {
1994
- for (const page of layer.pages.values()) {
1995
- if (page.residency === "device") devicePages += 1;
1996
- if (page.residency === "host") hostPages += 1;
1997
- }
1998
- }
1999
2005
  return {
2000
- device: devicePages * pageBytes * 2,
2001
- host: hostPages * pageBytes * 2
2006
+ device: devicePageCount * pageBytes * 2,
2007
+ host: hostPageCount * pageBytes * 2
2002
2008
  };
2003
2009
  },
2004
2010
  async dispose() {
2005
2011
  disposed = true;
2006
2012
  for (const layer of layers) layer.pages.clear();
2013
+ residentPageStates.clear();
2007
2014
  freePhysicalPages.length = 0;
2015
+ devicePageCount = 0;
2016
+ hostPageCount = 0;
2008
2017
  },
2009
2018
  async append(layer, keyVectors, valueVectors = keyVectors, firstToken) {
2010
2019
  assertLive();
@@ -2024,14 +2033,11 @@ function createPagedKVCache(config) {
2024
2033
  throw new Error(`PagedKVCache append firstToken must be non-negative, got ${startToken}`);
2025
2034
  }
2026
2035
  const touchedPages = /* @__PURE__ */ new Map();
2027
- const slotMap = new Uint32Array(tokenCount);
2028
2036
  const requiredPages = /* @__PURE__ */ new Set();
2029
2037
  for (let i = 0; i < tokenCount; i += 1) {
2030
2038
  const token = startToken + i;
2031
2039
  const logicalPage = Math.floor(token / config.pageSize);
2032
- const slot = token % config.pageSize;
2033
2040
  requiredPages.add(logicalPage);
2034
- slotMap[i] = logicalPage << 16 | slot;
2035
2041
  }
2036
2042
  if (requiredPages.size > config.maxResidentPages) {
2037
2043
  throw new Error(
@@ -2042,8 +2048,15 @@ function createPagedKVCache(config) {
2042
2048
  const page = allocatePageInternal(layer, logicalPage);
2043
2049
  touchedPages.set(logicalPage, page);
2044
2050
  }
2045
- const pageTable = buildPageTable(layer, touchedPages.keys());
2046
2051
  if (appendKernel) {
2052
+ const slotMap = new Uint32Array(tokenCount);
2053
+ for (let i = 0; i < tokenCount; i += 1) {
2054
+ const token = startToken + i;
2055
+ const logicalPage = Math.floor(token / config.pageSize);
2056
+ const slot = token % config.pageSize;
2057
+ slotMap[i] = logicalPage << 16 | slot;
2058
+ }
2059
+ const pageTable = buildPageTable(layer, touchedPages.keys());
2047
2060
  keyPages.set(
2048
2061
  await appendKernel.run(
2049
2062
  keyPages,
@@ -2065,8 +2078,8 @@ function createPagedKVCache(config) {
2065
2078
  )
2066
2079
  );
2067
2080
  } else {
2068
- keyPages.set(appendCpu(keyPages, pageTable, slotMap, keyVectors));
2069
- valuePages.set(appendCpu(valuePages, pageTable, slotMap, valueVectors));
2081
+ appendCpuInPlace(keyPages, touchedPages, keyVectors, startToken);
2082
+ appendCpuInPlace(valuePages, touchedPages, valueVectors, startToken);
2070
2083
  }
2071
2084
  for (const page of touchedPages.values()) page.lastAccess = ++accessClock;
2072
2085
  layers[layer].nextToken = Math.max(layers[layer].nextToken, startToken + tokenCount);
@@ -2103,8 +2116,8 @@ function createPagedKVCache(config) {
2103
2116
  for (const logicalPage of requiredPages) {
2104
2117
  ensurePageResident(layers[layer].pages.get(logicalPage));
2105
2118
  }
2106
- const pageTable = buildPageTable(layer, requiredPages);
2107
2119
  if (lookupKernel) {
2120
+ const pageTable = buildPageTable(layer, requiredPages);
2108
2121
  return {
2109
2122
  keys: await lookupKernel.run(
2110
2123
  keyPages,
@@ -2125,8 +2138,8 @@ function createPagedKVCache(config) {
2125
2138
  };
2126
2139
  }
2127
2140
  return {
2128
- keys: lookupCpu(keyPages, pageTable, tokenCount, startToken),
2129
- values: lookupCpu(valuePages, pageTable, tokenCount, startToken)
2141
+ keys: lookupCpuDirect(keyPages, layers[layer], tokenCount, startToken),
2142
+ values: lookupCpuDirect(valuePages, layers[layer], tokenCount, startToken)
2130
2143
  };
2131
2144
  }
2132
2145
  };
@@ -2204,6 +2217,9 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
2204
2217
  */
2205
2218
  this.globalPosSum = [0, 0, 0];
2206
2219
  this.globalConfSum = 0;
2220
+ this.globalPrincipalMomentXX = 0;
2221
+ this.globalPrincipalMomentZZ = 0;
2222
+ this.globalPrincipalMomentXZ = 0;
2207
2223
  /** Previous frame camera pose (centroid of that frame's points). */
2208
2224
  this.prevPose = null;
2209
2225
  /** Previous full camera pose, including scan-derived principal-axis rotation. */
@@ -2455,6 +2471,15 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
2455
2471
  const yaw = 0.5 * Math.atan2(2 * xz, xx - zz);
2456
2472
  return _HoloMapRuntimeImpl.yawToQuaternion(yaw);
2457
2473
  }
2474
+ static estimatePrincipalAxisRotationFromMoments(momentXX, momentZZ, momentXZ, pointCount, centroid) {
2475
+ if (pointCount < 2) return [0, 0, 0, 1];
2476
+ const xx = momentXX - pointCount * centroid[0] * centroid[0];
2477
+ const zz = momentZZ - pointCount * centroid[2] * centroid[2];
2478
+ const xz = momentXZ - pointCount * centroid[0] * centroid[2];
2479
+ if (xx + zz < 1e-12) return [0, 0, 0, 1];
2480
+ const yaw = 0.5 * Math.atan2(2 * xz, xx - zz);
2481
+ return _HoloMapRuntimeImpl.yawToQuaternion(yaw);
2482
+ }
2458
2483
  static yawToQuaternion(yaw) {
2459
2484
  const half = yaw / 2;
2460
2485
  return [0, Math.sin(half), 0, Math.cos(half)];
@@ -2490,17 +2515,23 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
2490
2515
  anchorDescriptor[3] ?? 0
2491
2516
  ]);
2492
2517
  }
2493
- static cloneTrajectoryKeyframes(keyframes) {
2494
- return keyframes.map((keyframe) => ({
2495
- frameIndex: keyframe.frameIndex,
2496
- timestampMs: keyframe.timestampMs,
2497
- pose: {
2498
- position: [...keyframe.pose.position],
2499
- rotation: [...keyframe.pose.rotation],
2500
- confidence: keyframe.pose.confidence
2501
- },
2502
- embedding: new Float32Array(keyframe.embedding)
2503
- }));
2518
+ static cloneTrajectoryKeyframes(keyframes, maxCount = keyframes.length) {
2519
+ const start = Math.max(0, keyframes.length - Math.max(0, maxCount));
2520
+ const out = [];
2521
+ for (let i = start; i < keyframes.length; i += 1) {
2522
+ const keyframe = keyframes[i];
2523
+ out.push({
2524
+ frameIndex: keyframe.frameIndex,
2525
+ timestampMs: keyframe.timestampMs,
2526
+ pose: {
2527
+ position: [...keyframe.pose.position],
2528
+ rotation: [...keyframe.pose.rotation],
2529
+ confidence: keyframe.pose.confidence
2530
+ },
2531
+ embedding: new Float32Array(keyframe.embedding)
2532
+ });
2533
+ }
2534
+ return out;
2504
2535
  }
2505
2536
  pushTrajectoryKeyframe(keyframe) {
2506
2537
  this.trajectoryKeyframes.push(keyframe);
@@ -2543,6 +2574,9 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
2543
2574
  this.trajectoryKeyframes.length = 0;
2544
2575
  this.globalPosSum = [0, 0, 0];
2545
2576
  this.globalConfSum = 0;
2577
+ this.globalPrincipalMomentXX = 0;
2578
+ this.globalPrincipalMomentZZ = 0;
2579
+ this.globalPrincipalMomentXZ = 0;
2546
2580
  this.lastAcceptedFrameTimestampMs = null;
2547
2581
  this.sessionStartMs = performance.now();
2548
2582
  this.perfMetrics = {
@@ -2811,9 +2845,15 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
2811
2845
  this.totalPointCount -= evictedPoints;
2812
2846
  const ep = evicted.points.positions;
2813
2847
  for (let i = 0; i < ep.length; i += 3) {
2814
- this.globalPosSum[0] -= ep[i];
2815
- this.globalPosSum[1] -= ep[i + 1];
2816
- this.globalPosSum[2] -= ep[i + 2];
2848
+ const x = ep[i];
2849
+ const y = ep[i + 1];
2850
+ const z = ep[i + 2];
2851
+ this.globalPosSum[0] -= x;
2852
+ this.globalPosSum[1] -= y;
2853
+ this.globalPosSum[2] -= z;
2854
+ this.globalPrincipalMomentXX -= x * x;
2855
+ this.globalPrincipalMomentZZ -= z * z;
2856
+ this.globalPrincipalMomentXZ -= x * z;
2817
2857
  }
2818
2858
  const ec = evicted.points.confidence;
2819
2859
  for (let i = 0; i < ec.length; i += 1) this.globalConfSum -= ec[i];
@@ -2898,6 +2938,9 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
2898
2938
  let centroidY = 0;
2899
2939
  let centroidZ = 0;
2900
2940
  let confidenceSum = 0;
2941
+ let framePrincipalMomentXX = 0;
2942
+ let framePrincipalMomentZZ = 0;
2943
+ let framePrincipalMomentXZ = 0;
2901
2944
  for (let t = 0; t < numPoints; t += 1) {
2902
2945
  const { meanColor, centerUv, texture, latent, rawDepthSignal } = encodedTiles[t];
2903
2946
  const [latentX, latentY, latentZ] = latent;
@@ -2956,6 +2999,9 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
2956
2999
  centroidX += px;
2957
3000
  centroidY += py;
2958
3001
  centroidZ += pz;
3002
+ framePrincipalMomentXX += px * px;
3003
+ framePrincipalMomentZZ += pz * pz;
3004
+ framePrincipalMomentXZ += px * pz;
2959
3005
  }
2960
3006
  const inv = 1 / Math.max(1, numPoints);
2961
3007
  const poseX = centroidX * inv;
@@ -3037,6 +3083,9 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
3037
3083
  this.globalPosSum[1] += centroidY;
3038
3084
  this.globalPosSum[2] += centroidZ;
3039
3085
  this.globalConfSum += confidenceSum;
3086
+ this.globalPrincipalMomentXX += framePrincipalMomentXX;
3087
+ this.globalPrincipalMomentZZ += framePrincipalMomentZZ;
3088
+ this.globalPrincipalMomentXZ += framePrincipalMomentXZ;
3040
3089
  const totalPoints = this.totalPointCount + numPoints;
3041
3090
  const ginv = 1 / Math.max(1, totalPoints);
3042
3091
  const anchorCenter = [
@@ -3049,8 +3098,11 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
3049
3098
  const extentX = b.max[0] - b.min[0];
3050
3099
  const extentY = b.max[1] - b.min[1];
3051
3100
  const extentZ = b.max[2] - b.min[2];
3052
- const anchorRotation = _HoloMapRuntimeImpl.estimatePrincipalAxisRotation(
3053
- _HoloMapRuntimeImpl.retainedPositionChunks(this.steps, positions),
3101
+ const anchorRotation = _HoloMapRuntimeImpl.estimatePrincipalAxisRotationFromMoments(
3102
+ this.globalPrincipalMomentXX,
3103
+ this.globalPrincipalMomentZZ,
3104
+ this.globalPrincipalMomentXZ,
3105
+ totalPoints,
3054
3106
  anchorCenter
3055
3107
  );
3056
3108
  const anchorDescriptor = new Float32Array([extentX, extentY, extentZ, globalMeanConfidence]);
@@ -3066,7 +3118,8 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
3066
3118
  )
3067
3119
  });
3068
3120
  const trajectoryKeyframes = _HoloMapRuntimeImpl.cloneTrajectoryKeyframes(
3069
- this.trajectoryKeyframes
3121
+ this.trajectoryKeyframes,
3122
+ _HoloMapRuntimeImpl.TRAJECTORY_STEP_SNAPSHOT_CAP
3070
3123
  );
3071
3124
  const step = {
3072
3125
  frame,
@@ -3084,7 +3137,7 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
3084
3137
  revision: frame.index + 1
3085
3138
  },
3086
3139
  anchor: {
3087
- anchorFrameIndex: trajectoryKeyframes[0]?.frameIndex ?? frame.index,
3140
+ anchorFrameIndex: this.trajectoryKeyframes[0]?.frameIndex ?? frame.index,
3088
3141
  anchorPose: {
3089
3142
  position: anchorCenter,
3090
3143
  rotation: anchorRotation,
@@ -3206,6 +3259,9 @@ var _HoloMapRuntimeImpl = class _HoloMapRuntimeImpl {
3206
3259
  this.trajectoryKeyframes.length = 0;
3207
3260
  this.globalPosSum = [0, 0, 0];
3208
3261
  this.globalConfSum = 0;
3262
+ this.globalPrincipalMomentXX = 0;
3263
+ this.globalPrincipalMomentZZ = 0;
3264
+ this.globalPrincipalMomentXZ = 0;
3209
3265
  this.boundsValid = false;
3210
3266
  this.lastAcceptedFrameTimestampMs = null;
3211
3267
  this.perfMetrics = {
@@ -3221,6 +3277,7 @@ _HoloMapRuntimeImpl.LOOP_CLOSURE_MIN_GAP = 3;
3221
3277
  _HoloMapRuntimeImpl.LOOP_CLOSURE_RADIUS = 0.05;
3222
3278
  _HoloMapRuntimeImpl.POSE_HISTORY_CAP = 512;
3223
3279
  _HoloMapRuntimeImpl.TRAJECTORY_KEYFRAME_CAP = 512;
3280
+ _HoloMapRuntimeImpl.TRAJECTORY_STEP_SNAPSHOT_CAP = 64;
3224
3281
  /** Maps normalized measured depth [0=near,1=far] to a point Z range matching
3225
3282
  * the monocular estimate's spread (±~0.17), so sensor and estimate paths
3226
3283
  * produce geometry in the same coordinate scale. */
@@ -3247,5 +3304,5 @@ function createHoloMapRuntime(_config) {
3247
3304
  }
3248
3305
 
3249
3306
  export { BUILD_TIMESTAMP, GIT_COMMIT_SHA, HOLOMAP_DEFAULTS, HOLOMAP_DENSE_PROOF_DEFAULTS, HOLOSCRIPT_VERSION, anchorReconstructionManifest, assertWeightCid, computeReconstructionManifestDigest, createHoloMapMicroEncoder, createHoloMapRunId, createHoloMapRuntime, createPagedKVCache, deserializeMicroWeights, frameToMicroImage, getCachedWeightBlob, getVersionInfo, getVersionString, loadHoloMapWeightBlob, logHoloMapEvent, mergeAnchoredProvenance, normalizeWeightCidDigest, putCachedWeightBlob, resetHoloMapTelemetryForTests, runHoloMapMicroEncoderCpu, selfAttestReconstructionManifest, serializeMicroWeights, stripAnchoredProvenance, tryCreateHoloMapEncoderDevice };
3250
- //# sourceMappingURL=chunk-Z4IUBW46.js.map
3251
- //# sourceMappingURL=chunk-Z4IUBW46.js.map
3307
+ //# sourceMappingURL=chunk-A4OOLBZD.js.map
3308
+ //# sourceMappingURL=chunk-A4OOLBZD.js.map
@@ -8,7 +8,7 @@ import { init_AndroidXRCompiler, AndroidXRCompiler_exports } from './chunk-G6KAC
8
8
  import { init_IOSCompiler, IOSCompiler_exports } from './chunk-77QI552M.js';
9
9
  import { init_VisionOSCompiler, VisionOSCompiler_exports } from './chunk-Z557DVYN.js';
10
10
  import { init_WASMCompiler, WASMCompiler_exports } from './chunk-PJFTTSKE.js';
11
- import { init_WebGPUCompiler, WebGPUCompiler_exports } from './chunk-KEYG7HGY.js';
11
+ import { init_WebGPUCompiler, WebGPUCompiler_exports } from './chunk-ONPVM4IV.js';
12
12
  import { init_DTDLCompiler, DTDLCompiler_exports } from './chunk-SQXAZHDG.js';
13
13
  import { init_URDFCompiler, URDFCompiler_exports } from './chunk-AATYYLYK.js';
14
14
  import { init_OpenXRCompiler, OpenXRCompiler_exports } from './chunk-WTH23ISI.js';
@@ -1598,12 +1598,22 @@ var init_LlamaServerCompiler = __esm({
1598
1598
  const normalized = trimmed.replace(/\\/g, "/");
1599
1599
  if (/^llama-server(?:\.exe)?$/i.test(trimmed)) {
1600
1600
  throw new Error(
1601
- "LlamaServerCompiler requires a HOLO-patched llama.cpp build binary; use build/bin/llama-server(.exe), not a bare PATH lookup."
1601
+ "LlamaServerCompiler requires a HOLO-patched llama.cpp build binary; use build-holo/bin/.../llama-server(.exe), not a bare PATH lookup."
1602
1602
  );
1603
1603
  }
1604
1604
  if (/\/?\.docker\/bin\/inference\/llama-server(?:\.exe)?$/i.test(normalized)) {
1605
1605
  throw new Error(
1606
- "LlamaServerCompiler rejects the prebuilt .docker/bin/inference llama-server binary because HOLO patching it is a silent no-op; use the rebuilt build/bin/llama-server(.exe)."
1606
+ "LlamaServerCompiler rejects the prebuilt .docker/bin/inference llama-server binary because HOLO patching it is a silent no-op; use the rebuilt build-holo/bin/.../llama-server(.exe)."
1607
+ );
1608
+ }
1609
+ if (/\/llama\.cpp\/build\/bin\/(?:release\/)?llama-server(?:\.exe)?$/i.test(normalized)) {
1610
+ throw new Error(
1611
+ "LlamaServerCompiler rejects the legacy llama.cpp build/bin llama-server path; use the HOLO-patched build-holo/bin/.../llama-server(.exe)."
1612
+ );
1613
+ }
1614
+ if (/\/ollama\/.*\/llama-server(?:\.exe)?$/i.test(normalized)) {
1615
+ throw new Error(
1616
+ "LlamaServerCompiler rejects Ollama-owned llama-server binaries for HoloLlama serving; use the HOLO-patched llama.cpp build-holo binary."
1607
1617
  );
1608
1618
  }
1609
1619
  }
@@ -8613,12 +8623,19 @@ function digest(value) {
8613
8623
  var POINT_PROVENANCE_CODE = {
8614
8624
  observed: 0,
8615
8625
  interpolated: 1,
8616
- "generative-extended": 2
8626
+ "generative-extended": 2,
8627
+ // Appended (never renumber existing codes — persisted buffers depend on them).
8628
+ "nlos-inferred": 3
8617
8629
  };
8618
8630
  var POINT_PROVENANCE_CLASS_BY_CODE = [
8619
8631
  "observed",
8632
+ // 0
8620
8633
  "interpolated",
8621
- "generative-extended"
8634
+ // 1
8635
+ "generative-extended",
8636
+ // 2
8637
+ "nlos-inferred"
8638
+ // 3
8622
8639
  ];
8623
8640
  function provenanceClassToCode(cls) {
8624
8641
  return POINT_PROVENANCE_CODE[cls];
@@ -8629,17 +8646,20 @@ function provenanceCodeToClass(code) {
8629
8646
  function provenanceHistogram(codes) {
8630
8647
  let observed = 0;
8631
8648
  let interpolated = 0;
8649
+ let nlosInferred = 0;
8632
8650
  let generativeExtended = 0;
8633
8651
  for (let i = 0; i < codes.length; i++) {
8634
8652
  const c = codes[i];
8635
8653
  if (c === 0) observed++;
8636
8654
  else if (c === 1) interpolated++;
8655
+ else if (c === 3) nlosInferred++;
8637
8656
  else generativeExtended++;
8638
8657
  }
8639
8658
  const total = codes.length;
8640
8659
  return {
8641
8660
  observed,
8642
8661
  interpolated,
8662
+ "nlos-inferred": nlosInferred,
8643
8663
  "generative-extended": generativeExtended,
8644
8664
  total,
8645
8665
  observedFraction: total > 0 ? observed / total : 0
@@ -8651,7 +8671,7 @@ function uniformProvenance(count, cls) {
8651
8671
  return arr;
8652
8672
  }
8653
8673
  var HOLOMAP_CAPTURE_DEFAULT_PROVENANCE = "observed";
8654
- var PROVENANCE_RECEIPT_VERSION = "provenance-receipt-v1";
8674
+ var PROVENANCE_RECEIPT_VERSION = "provenance-receipt-v2";
8655
8675
  function sha256Hex(bytes) {
8656
8676
  return createHash("sha256").update(bytes).digest("hex");
8657
8677
  }
@@ -8665,6 +8685,7 @@ function buildProvenanceReceipt(provenanceCodes, deliveredBytes, source) {
8665
8685
  counts: {
8666
8686
  observed: histogram.observed,
8667
8687
  interpolated: histogram.interpolated,
8688
+ "nlos-inferred": histogram["nlos-inferred"],
8668
8689
  "generative-extended": histogram["generative-extended"],
8669
8690
  total: histogram.total
8670
8691
  },
@@ -13470,7 +13491,7 @@ var CompilerBridge = class {
13470
13491
  if (this.initialized) return;
13471
13492
  try {
13472
13493
  const [parserModule, compilerModule] = await Promise.all([
13473
- import('./HoloScriptPlusParser-55AY4MUF.js'),
13494
+ import('./HoloScriptPlusParser-HQV6IJAH.js'),
13474
13495
  import('./SceneIRCompiler-63KA3M2F.js')
13475
13496
  ]);
13476
13497
  this.modules = {
@@ -14094,5 +14115,5 @@ function compilePipelineSource(source, options = {}) {
14094
14115
  }
14095
14116
 
14096
14117
  export { A2AAgentCardCompiler, BUILTIN_RESOURCES, CAPABILITY_HIERARCHY, CATEGORY_DEFAULT_EMBODIMENT, CodeEditorCompiler, CompileTimeAuthorityEffectError, CompilerBridge, CrossRealityTraitRegistry, DEFAULT_MATERIAL_KEYWORDS, DEFAULT_OBJECT_KEYWORDS, DEFAULT_PRIMITIVE_SHAPES, DialectRegistry, EFFECT_TO_CAPABILITY, EdgeCompiler, EmbodiedDatasetCompiler, FMUCompiler, GaussianSplattingCompiler, GaussianTrainCompiler, GaussianTrainConfigError, HANDOFF_PATH_RULES, HOLOMAP_CAPTURE_DEFAULT_PROVENANCE, HOLOSCRIPT_GRAMMAR_PRESETS, HoloMCPCompiler, LinearTypeChecker, LlamaServerCompiler, MJCFCompiler, MJXCompiler, MVC_BUDGET_CONSTRAINTS, NIRCompiler, NextJSAPICompiler, NodeServiceCompiler, OmnigentAgentYamlCompiler, PCGGraphCompiler, PCG_GRAPH_SCHEMA, PLATFORM_BUDGETS, PLATFORM_EMBODIMENT_OVERRIDES, POINT_PROVENANCE_CLASS_BY_CODE, POINT_PROVENANCE_CODE, PROVENANCE_RECEIPT_VERSION, REMOTE_TRAIN_EXECUTOR, REQUIRED_SANDBOX_AUTHORITY_EFFECT, ResourceBudgetAnalyzer, SANDBOX_AUTHORITY_TRAIT, SCMCompiler, SDKCompiler, SHARED_SORT_SHADER_PATH, SOVEREIGN_TRAIN_EXECUTOR, SVGCompiler, SpatialPartitionPass, TRAIT_RESOURCE_COSTS, TRAIT_RESOURCE_MAP, TRUST_LEVEL_CAPABILITIES, ThreeDTilesCompiler, USDZPipeline, absorbFMU, assertAuthorityEffects, bestCategoryForTraits, buildProvenanceReceipt, buildSafetyReport, checkAuthorityEffects, checkCapabilities, collectAuthorityEffectNodes, compileAllToNextJSAPI, compilePCGGraphFromBlocks, compilePipelineSource, compilePipelineSourceToNode, compilePipelineSourceToPython, compilePipelineToNode, compilePipelineToPython, compileTo3DTiles, compileToFMU, compileToNextJSAPI, compileToPCGGraph, createCrossRealityTraitRegistry, createGaussianSplattingCompiler, createGaussianTrainCompiler, createOmnigentAgentYamlCompiler, createThreeDTilesCompiler, densifyByInterpolation, deriveRequirements, detectMultiUserSharedSort, ensureDialectsBooted, expandCapabilities, formatReport, generateCertificate, generateHoloScriptGbnf, getCompilerBridge, getCrossRealityTraitRegistry, init_A2AAgentCardCompiler, init_DialectRegistry, init_EmbodiedDatasetCompiler, init_HoloMCPCompiler, init_LlamaServerCompiler, init_MJCFCompiler, init_MJXCompiler, init_NIRCompiler, init_NextJSAPICompiler, init_NodeServiceCompiler, init_OmnigentAgentYamlCompiler, init_PCGGraphCompiler, init_SDKCompiler, init_holoscript_gbnf, init_registerBuiltinDialects, isHoloScriptGrammarPreset, pcgGraphToUnrealXml, provenanceClassToCode, provenanceCodeToClass, provenanceHistogram, quickSafetyCheck, registerBuiltinDialects, resetCrossRealityTraitRegistry, runSafetyPass, selectModality, selectModalityForAll, spatialPartition, streamWorldTiles, uniformProvenance };
14097
- //# sourceMappingURL=chunk-TYNRXRHF.js.map
14098
- //# sourceMappingURL=chunk-TYNRXRHF.js.map
14118
+ //# sourceMappingURL=chunk-DJ5BNRIS.js.map
14119
+ //# sourceMappingURL=chunk-DJ5BNRIS.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk5H5GFBMG_cjs = require('./chunk-5H5GFBMG.cjs');
3
+ var chunkSQAAWO4V_cjs = require('./chunk-SQAAWO4V.cjs');
4
4
 
5
5
  // src/reconstruction/FusedAttentionKernel.ts
6
6
  var FUSED_ATTENTION_WGSL = `
@@ -587,9 +587,9 @@ function mobileSensorBundleToFrames(bundle) {
587
587
  }
588
588
  async function replayMobileSensorBundle(bundle, config = {}) {
589
589
  const frames = mobileSensorBundleToFrames(bundle);
590
- const runtime = chunk5H5GFBMG_cjs.createHoloMapRuntime();
590
+ const runtime = chunkSQAAWO4V_cjs.createHoloMapRuntime();
591
591
  await runtime.init({
592
- ...chunk5H5GFBMG_cjs.HOLOMAP_DEFAULTS,
592
+ ...chunkSQAAWO4V_cjs.HOLOMAP_DEFAULTS,
593
593
  seed: 0,
594
594
  modelHash: bundle.bundleId,
595
595
  videoHash: bundle.bundleId,
@@ -635,5 +635,5 @@ exports.createTrajectoryMemory = createTrajectoryMemory;
635
635
  exports.mobileSensorBundleToFrames = mobileSensorBundleToFrames;
636
636
  exports.replayMobileSensorBundle = replayMobileSensorBundle;
637
637
  exports.validateMobileSensorBundle = validateMobileSensorBundle;
638
- //# sourceMappingURL=chunk-G3BM3CT4.cjs.map
639
- //# sourceMappingURL=chunk-G3BM3CT4.cjs.map
638
+ //# sourceMappingURL=chunk-DVHZD5HV.cjs.map
639
+ //# sourceMappingURL=chunk-DVHZD5HV.cjs.map
@@ -1,6 +1,6 @@
1
1
  import { ErrorRecovery, generateQuickFixes, enrichErrorWithSuggestions } from './chunk-CP7V3ATL.js';
2
2
  import { isBrainKeyword, isCognitiveVerb, nearestCognitiveVerb } from './chunk-UNMVGZVW.js';
3
- import { LIFECYCLE_HOOKS, STRUCTURAL_DIRECTIVES } from './chunk-JBYBMBMW.js';
3
+ import { LIFECYCLE_HOOKS, STRUCTURAL_DIRECTIVES } from './chunk-FWKEY4LD.js';
4
4
  import { VR_TRAITS } from './chunk-2EGGAZT3.js';
5
5
  import { isLocomotionReactionTrigger } from './chunk-63AUAIL6.js';
6
6
  import * as crypto from 'crypto';
@@ -2969,7 +2969,7 @@ var HoloScriptPlusParser = class _HoloScriptPlusParser {
2969
2969
  let body = "";
2970
2970
  if (this.check("ARROW")) {
2971
2971
  this.advance();
2972
- body = this.parseInlineExpression();
2972
+ body = this.check("LBRACE") ? this.parseCodeBlock() : this.parseInlineExpression();
2973
2973
  } else if (this.check("LBRACE")) {
2974
2974
  body = this.parseCodeBlock();
2975
2975
  }
@@ -3293,6 +3293,10 @@ var HoloScriptPlusParser = class _HoloScriptPlusParser {
3293
3293
  config.body = this.parseCodeBlock();
3294
3294
  }
3295
3295
  }
3296
+ if (this.check("ARROW")) {
3297
+ this.advance();
3298
+ config.body = this.check("LBRACE") ? this.parseCodeBlock() : this.parseInlineExpression();
3299
+ }
3296
3300
  const directive = { type: "trait", name, config };
3297
3301
  if (configStyle === "block") {
3298
3302
  this.markBlockConfigDirective(directive, nameToken);
@@ -6247,5 +6251,5 @@ function parse(source, options) {
6247
6251
  }
6248
6252
 
6249
6253
  export { ChunkBasedIncrementalParser, HSPLUS_ERROR_CODES, HoloScriptPlusParser, ParseCache, createKeywordError, createParser, createRichError, createTraitError, findSimilarKeyword, findSimilarTrait, formatRichError, formatRichErrors, getErrorCodeDocumentation, getSourceContext, globalParseCache, parse, parseIncrementalChunks };
6250
- //# sourceMappingURL=chunk-7NPZZZD7.js.map
6251
- //# sourceMappingURL=chunk-7NPZZZD7.js.map
6254
+ //# sourceMappingURL=chunk-FRSKLX6I.js.map
6255
+ //# sourceMappingURL=chunk-FRSKLX6I.js.map
@@ -72,6 +72,7 @@ var LIFECYCLE_HOOKS = [
72
72
  "on_update",
73
73
  "on_data_update",
74
74
  "on_tick",
75
+ "on_spawn",
75
76
  "on_activate",
76
77
  "on_deactivate",
77
78
  "on_detected",
@@ -257,5 +258,5 @@ var LIFECYCLE_HOOKS = [
257
258
  ];
258
259
 
259
260
  export { LIFECYCLE_HOOKS, STRUCTURAL_DIRECTIVES };
260
- //# sourceMappingURL=chunk-JBYBMBMW.js.map
261
- //# sourceMappingURL=chunk-JBYBMBMW.js.map
261
+ //# sourceMappingURL=chunk-FWKEY4LD.js.map
262
+ //# sourceMappingURL=chunk-FWKEY4LD.js.map