@holoscript/core 6.0.3 → 6.0.4
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/README.md +38 -38
- package/dist/GLTFPipeline-DEN36VNK.js +12 -0
- package/dist/GLTFPipeline-YPCAK236.cjs +33 -0
- package/dist/{HoloScriptPlusParser-BZR5DELQ.js → HoloScriptPlusParser-BN6KVRCM.js} +5 -5
- package/dist/{HoloScriptPlusParser-SBMYDNXO.cjs → HoloScriptPlusParser-NC5FE6AL.cjs} +16 -16
- package/dist/{USDZExporter-YA55ZS35.js → USDZExporter-NTMBNTDB.js} +3 -3
- package/dist/{USDZExporter-MHEHXZB4.cjs → USDZExporter-UWGWNMMD.cjs} +3 -3
- package/dist/{chunk-32TWR3HE.js → chunk-2CWOLHTE.js} +3 -4
- package/dist/{chunk-2UX5LRAP.cjs → chunk-33LSUQDD.cjs} +33 -31
- package/dist/{chunk-LBPEZQAF.js → chunk-3FJCK5XA.js} +7 -7
- package/dist/{chunk-EGIZHYJP.cjs → chunk-3SAK5KFL.cjs} +2 -4
- package/dist/{chunk-PJMOXFPR.cjs → chunk-4XSNJCLC.cjs} +25 -27
- package/dist/{chunk-HKCVM6OK.cjs → chunk-5BGSECRJ.cjs} +21 -21
- package/dist/{chunk-EMO7HAKJ.cjs → chunk-5O6TQC6M.cjs} +26 -30
- package/dist/{chunk-XSUZMPVQ.cjs → chunk-5OEOHAAW.cjs} +26 -26
- package/dist/{chunk-EJA7G2C4.cjs → chunk-5WUNN6ZN.cjs} +2 -2
- package/dist/{chunk-CQDOF3G7.cjs → chunk-6TZPZCOJ.cjs} +18 -18
- package/dist/{chunk-NRUB55IT.cjs → chunk-6UEHYZ7V.cjs} +18 -16
- package/dist/{chunk-V42NTCFH.js → chunk-6XSERL6L.js} +4230 -2197
- package/dist/{chunk-X4YVN7H3.cjs → chunk-72EQECGT.cjs} +37 -17
- package/dist/{chunk-4KJ2R7VP.cjs → chunk-7AGYRWKW.cjs} +19 -19
- package/dist/{chunk-UQW6SLM5.js → chunk-A7PIMZGU.js} +110 -19
- package/dist/{chunk-RT7LJRSF.cjs → chunk-ATSKSYVE.cjs} +1013 -6708
- package/dist/{chunk-WN3YF33G.cjs → chunk-B5TCIAPQ.cjs} +9 -10
- package/dist/{chunk-AIUXRS74.cjs → chunk-BF2235SI.cjs} +4275 -2242
- package/dist/{chunk-DIEDKX5B.cjs → chunk-BND3ST2K.cjs} +18 -16
- package/dist/{chunk-EPWRXL6S.js → chunk-BU7VWW2K.js} +29 -29
- package/dist/{chunk-6OQBLABR.js → chunk-BWFJEM5A.js} +368 -189
- package/dist/{chunk-ARNKA274.cjs → chunk-CAUCGUEA.cjs} +6 -6
- package/dist/{chunk-YCMQQQ5U.cjs → chunk-CBJSLA2E.cjs} +398 -219
- package/dist/{chunk-BU5ZAFMC.js → chunk-CDPGV4DN.js} +6 -7
- package/dist/{chunk-CO2VM2DK.js → chunk-CS2EMTGF.js} +10 -9
- package/dist/{chunk-AW7WAELW.js → chunk-DMG7C4H2.js} +4 -4
- package/dist/{chunk-XSF76QRU.js → chunk-DXJQDCFL.js} +3 -3
- package/dist/{chunk-4FCZDTD5.js → chunk-E3FWRT3Z.js} +7 -9
- package/dist/{chunk-KYM4XRFG.js → chunk-E3UALNFA.js} +4 -4
- package/dist/{chunk-GC3YU46J.js → chunk-EONILVMF.js} +2 -2
- package/dist/{chunk-VJVCD5T5.cjs → chunk-EQV4R3EV.cjs} +22 -22
- package/dist/{chunk-FEFHPUEM.cjs → chunk-F3HH56EB.cjs} +74 -658
- package/dist/{chunk-WYH4GVZ5.js → chunk-F4IULT7N.js} +2 -2
- package/dist/{chunk-XDXZM3ZP.cjs → chunk-FFKU7BTK.cjs} +19 -19
- package/dist/{chunk-NKRKT6V2.js → chunk-FHQVYCH2.js} +11 -10
- package/dist/{chunk-7H5UNJZD.cjs → chunk-FSF7EQVA.cjs} +11 -10
- package/dist/{chunk-KUJRR4FJ.js → chunk-G4VZTCIB.js} +9 -7
- package/dist/{chunk-A6GO3DPZ.cjs → chunk-G7CT3EMP.cjs} +4 -4
- package/dist/{chunk-EUFLX2PI.js → chunk-GGHSW2NN.js} +989 -6611
- package/dist/chunk-GVUR45UF.cjs +777 -0
- package/dist/{chunk-ODGMVILH.js → chunk-H5Z7NASB.js} +3 -3
- package/dist/{chunk-7KPI4EKH.cjs → chunk-HE7ULERA.cjs} +45 -49
- package/dist/{chunk-26TLYBFD.js → chunk-HPS76H7Q.js} +3 -3
- package/dist/{chunk-RE3OKSYF.cjs → chunk-HQUEA5R6.cjs} +6 -6
- package/dist/{chunk-ZGTGVSTZ.js → chunk-HYNTS5CP.js} +2 -2
- package/dist/{chunk-PBA6NXCT.cjs → chunk-IBDG74G2.cjs} +6 -3
- package/dist/chunk-IFNQFCTM.js +3098 -0
- package/dist/{chunk-ZL6VJ6SN.js → chunk-IWI6J7FX.js} +5 -5
- package/dist/{chunk-3KEU5QYY.cjs → chunk-K3JDKWGI.cjs} +118 -23
- package/dist/{chunk-NLPSZT4C.js → chunk-K6EKD26I.js} +6 -6
- package/dist/chunk-KCQ5NDYC.cjs +3172 -0
- package/dist/{chunk-ELLQPFAF.js → chunk-KED34ILP.js} +11 -9
- package/dist/{chunk-BY3B7ZYV.cjs → chunk-KSGXLT74.cjs} +3 -3
- package/dist/{chunk-65RFOWZI.js → chunk-L4G4RLXX.js} +9 -7
- package/dist/{chunk-4SMUJFHL.js → chunk-LDP5OK6G.js} +6 -3
- package/dist/{chunk-VZNKJZTT.cjs → chunk-LGGRPKTV.cjs} +82 -96
- package/dist/{chunk-C2QHVHZF.js → chunk-LSW7P7ML.js} +23 -414
- package/dist/{chunk-HHS6FMOU.cjs → chunk-LXJ4667L.cjs} +83 -22
- package/dist/{chunk-H6WMMLQK.cjs → chunk-LZ266PCM.cjs} +20 -13
- package/dist/{chunk-V2ILLPHK.cjs → chunk-MD6KDHVE.cjs} +10 -10
- package/dist/{chunk-6WNCRE6F.js → chunk-MEASWI2Y.js} +5 -5
- package/dist/chunk-MPXBVFHQ.js +768 -0
- package/dist/{chunk-WUXIRGZP.cjs → chunk-NCUKG4SK.cjs} +304 -144
- package/dist/chunk-NDQNIJEH.js +1715 -0
- package/dist/{chunk-Y5MUAYTO.js → chunk-NOZZ46QU.js} +9 -8
- package/dist/{chunk-F5LVGHNT.js → chunk-OFKWH2IP.js} +3 -3
- package/dist/{chunk-SPDELRRV.cjs → chunk-PMGODDJA.cjs} +12 -12
- package/dist/{chunk-I3XGTIHM.cjs → chunk-Q4QX3AET.cjs} +2 -2
- package/dist/{chunk-Y7VK5TH3.cjs → chunk-Q5JT3YML.cjs} +10 -10
- package/dist/{chunk-TSWTWZ42.cjs → chunk-Q5SJOGHQ.cjs} +247 -205
- package/dist/{chunk-M6FU6S22.js → chunk-QGKNANZ3.js} +251 -91
- package/dist/{chunk-WFJIDI2N.cjs → chunk-QLEAOI3Q.cjs} +10 -10
- package/dist/{chunk-VK5AXKO3.js → chunk-R7MA7QWV.js} +70 -84
- package/dist/{chunk-W76ETJTI.js → chunk-RVYPEYPX.js} +6 -6
- package/dist/{chunk-MWEFR6YQ.js → chunk-S2N5TNMA.js} +7 -9
- package/dist/{chunk-NCUHGRTZ.js → chunk-S565K7NK.js} +7 -7
- package/dist/{chunk-AC4BSHFV.js → chunk-SDAMZIRE.js} +5 -5
- package/dist/{chunk-HBZYCASG.js → chunk-T36DDXSF.js} +75 -33
- package/dist/{chunk-BO2OKHIY.js → chunk-T4NKMBDL.js} +30 -611
- package/dist/{chunk-7X2IEJIE.cjs → chunk-T7LEXZUZ.cjs} +29 -29
- package/dist/{chunk-HUFNKFA6.js → chunk-TEWCN33Y.js} +8 -12
- package/dist/{chunk-L3Z2HIWJ.cjs → chunk-TQSZUOW5.cjs} +2 -2
- package/dist/chunk-TSH3MSQU.cjs +129 -0
- package/dist/{chunk-PLMYCCA4.js → chunk-UERJ3YJV.js} +6 -6
- package/dist/{chunk-7N3JIJMT.js → chunk-UPJBDCVF.js} +6 -6
- package/dist/{chunk-CMYAWUX3.js → chunk-V3NN3HPP.js} +12 -5
- package/dist/{chunk-SUCBB66F.js → chunk-WB4Z63GG.js} +3 -3
- package/dist/{chunk-PPULB4GG.cjs → chunk-WDW67DZB.cjs} +68 -68
- package/dist/chunk-WGMEAYBG.js +126 -0
- package/dist/{chunk-VSXOIUCF.cjs → chunk-X4ZF6CNE.cjs} +7 -7
- package/dist/{chunk-HF4OFY25.cjs → chunk-X6SEAXAX.cjs} +29 -445
- package/dist/{chunk-C7BNX4XJ.js → chunk-XCWFGZAA.js} +6 -6
- package/dist/{chunk-CNVM7J3M.js → chunk-XD6IYDUX.js} +34 -14
- package/dist/chunk-XG23EUQX.cjs +1717 -0
- package/dist/{chunk-DN7UFU63.cjs → chunk-XRKWN5PL.cjs} +12 -11
- package/dist/{chunk-XNMEH2BI.js → chunk-XUTX5CBW.js} +3 -3
- package/dist/{chunk-PQLGZKMC.cjs → chunk-XWPNTWDN.cjs} +26 -26
- package/dist/{chunk-NTMZSDXM.cjs → chunk-XXINBTZK.cjs} +43 -43
- package/dist/{chunk-74YCHHTE.js → chunk-YCXFCXDS.js} +8 -12
- package/dist/{chunk-KDB6BUMB.js → chunk-YQK5JNFK.js} +77 -18
- package/dist/{chunk-DH5G2JUA.cjs → chunk-Z34RLXRA.cjs} +44 -46
- package/dist/{chunk-XH7SE4HH.cjs → chunk-ZP4D3CSX.cjs} +19 -19
- package/dist/cli/holoscript-runner.cjs +33 -32
- package/dist/cli/holoscript-runner.js +13 -12
- package/dist/codebase/index.cjs +1 -1
- package/dist/codebase/index.d.ts +25 -0
- package/dist/codebase/index.js +1 -1
- package/dist/compiler/agent-inference.cjs +7 -8
- package/dist/compiler/agent-inference.js +3 -4
- package/dist/compiler/android-xr.cjs +7 -8
- package/dist/compiler/android-xr.js +5 -6
- package/dist/compiler/android.cjs +8 -9
- package/dist/compiler/android.js +6 -7
- package/dist/compiler/ar.cjs +6 -7
- package/dist/compiler/ar.js +4 -5
- package/dist/compiler/babylon.cjs +8 -9
- package/dist/compiler/babylon.js +7 -8
- package/dist/compiler/coco.cjs +1 -1
- package/dist/compiler/coco.js +1 -1
- package/dist/compiler/domain-block-utils.cjs +158 -151
- package/dist/compiler/domain-block-utils.js +4 -5
- package/dist/compiler/dtdl.cjs +7 -8
- package/dist/compiler/dtdl.js +4 -5
- package/dist/compiler/gltf-pipeline.cjs +9 -9
- package/dist/compiler/gltf-pipeline.js +2 -2
- package/dist/compiler/godot.cjs +6 -7
- package/dist/compiler/godot.js +5 -6
- package/dist/compiler/incremental.cjs +7 -8
- package/dist/compiler/incremental.js +2 -3
- package/dist/compiler/index.cjs +1934 -878
- package/dist/compiler/index.js +1904 -842
- package/dist/compiler/ios.cjs +8 -9
- package/dist/compiler/ios.js +6 -7
- package/dist/compiler/multi-layer.cjs +10 -17
- package/dist/compiler/multi-layer.js +9 -10
- package/dist/compiler/nodetoy.cjs +1 -1
- package/dist/compiler/nodetoy.js +1 -1
- package/dist/compiler/openxr.cjs +6 -7
- package/dist/compiler/openxr.js +5 -6
- package/dist/compiler/playcanvas.cjs +7 -8
- package/dist/compiler/playcanvas.js +6 -7
- package/dist/compiler/r3f.cjs +13 -14
- package/dist/compiler/r3f.js +8 -9
- package/dist/compiler/remotion.cjs +1 -1
- package/dist/compiler/remotion.js +1 -1
- package/dist/compiler/reproducibility.cjs +1 -1
- package/dist/compiler/reproducibility.js +1 -1
- package/dist/compiler/sdf.cjs +7 -8
- package/dist/compiler/sdf.js +5 -6
- package/dist/compiler/semantic-scene.cjs +7 -7
- package/dist/compiler/semantic-scene.js +2 -2
- package/dist/compiler/state.cjs +5 -6
- package/dist/compiler/state.js +3 -4
- package/dist/compiler/trait-composition.cjs +7 -8
- package/dist/compiler/trait-composition.js +3 -4
- package/dist/compiler/unity.cjs +6 -7
- package/dist/compiler/unity.js +5 -6
- package/dist/compiler/unreal.cjs +7 -8
- package/dist/compiler/unreal.js +5 -6
- package/dist/compiler/urdf.cjs +13 -14
- package/dist/compiler/urdf.js +5 -6
- package/dist/compiler/usd-physics.cjs +7 -8
- package/dist/compiler/usd-physics.js +4 -5
- package/dist/compiler/visionos.cjs +6 -7
- package/dist/compiler/visionos.js +5 -6
- package/dist/compiler/vrchat.cjs +7 -8
- package/dist/compiler/vrchat.js +5 -6
- package/dist/compiler/vrr.cjs +7 -8
- package/dist/compiler/vrr.js +5 -6
- package/dist/compiler/wasm.cjs +10 -11
- package/dist/compiler/wasm.js +5 -6
- package/dist/compiler/webgpu.cjs +6 -7
- package/dist/compiler/webgpu.js +5 -6
- package/dist/constants.d.ts +3 -0
- package/dist/debugger.cjs +7 -7
- package/dist/debugger.js +5 -5
- package/dist/entries/interop.cjs +1 -1
- package/dist/entries/interop.d.ts +9 -0
- package/dist/entries/interop.js +1 -1
- package/dist/entries/scripting.cjs +18 -17
- package/dist/entries/scripting.d.ts +7 -0
- package/dist/entries/scripting.js +8 -7
- package/dist/index.cjs +6773 -27555
- package/dist/index.d.ts +19 -0
- package/dist/index.js +5212 -26101
- package/dist/math/vec3.cjs +1 -1
- package/dist/math/vec3.js +1 -1
- package/dist/ml-dsa-PHCWUBPX.cjs +1178 -0
- package/dist/ml-dsa-WYLJHJO6.js +1178 -0
- package/dist/parser.cjs +11 -10
- package/dist/parser.js +8 -7
- package/dist/{playwright-BIZXMLD2.js → playwright-5OSAPTNH.js} +3 -3
- package/dist/{playwright-7DTEQCBD.cjs → playwright-RL6GY4F7.cjs} +1985 -1985
- package/dist/runtime.cjs +5 -5
- package/dist/runtime.js +4 -4
- package/dist/self-improvement/index.d.ts +0 -48
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.d.ts +24 -0
- package/dist/storage/index.js +1 -1
- package/dist/tools/index.d.ts +12 -0
- package/dist/traits/index.cjs +925 -607
- package/dist/traits/index.js +137 -20
- package/dist/type-checker.cjs +4 -4
- package/dist/type-checker.js +2 -2
- package/package.json +56 -21
- package/LICENSE +0 -21
- package/dist/GLTFPipeline-3KLWWUQO.cjs +0 -34
- package/dist/GLTFPipeline-LYII2ZVQ.js +0 -13
- package/dist/chunk-CN4NOESF.cjs +0 -416
- package/dist/chunk-DXVCEFZB.js +0 -2027
- package/dist/chunk-ENV7K6XA.js +0 -282
- package/dist/chunk-H7XMORZI.js +0 -2731
- package/dist/chunk-HAN4V3PF.cjs +0 -2037
- package/dist/chunk-LER4WXW5.cjs +0 -286
- package/dist/chunk-QHVVVN47.cjs +0 -2033
- package/dist/chunk-QWKUKVRE.js +0 -2026
- package/dist/chunk-UITWA6DV.cjs +0 -2829
- package/dist/chunk-X67XRI2T.js +0 -410
- package/dist/post-quantum-JTTAAGO3.cjs +0 -6
- package/dist/post-quantum-RVPVDEPI.js +0 -4
- package/dist/wot/index.cjs +0 -29
- package/dist/wot/index.js +0 -4
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { HoloScriptCodeParser } from './chunk-
|
|
2
|
-
import { mitosisHandler, orbitalHandler
|
|
1
|
+
import { HoloScriptCodeParser } from './chunk-BU7VWW2K.js';
|
|
2
|
+
import { mitosisHandler, orbitalHandler } from './chunk-WGMEAYBG.js';
|
|
3
3
|
import { logger } from './chunk-PHENW4MQ.js';
|
|
4
|
-
import { __decorateClass } from './chunk-
|
|
4
|
+
import { __decorateClass } from './chunk-2CWOLHTE.js';
|
|
5
5
|
import { WebSocketServer, WebSocket } from 'ws';
|
|
6
6
|
import { AttentionEngine, TimeManager } from '@holoscript/engine/orbital';
|
|
7
|
-
import
|
|
8
|
-
import * as path from 'path';
|
|
7
|
+
import { StateSynchronizer } from '@holoscript/mesh';
|
|
9
8
|
import { stateMachineInterpreter } from '@holoscript/engine/runtime/StateMachineInterpreter';
|
|
10
|
-
import { MemoryConsolidator } from '@holoscript/framework';
|
|
9
|
+
import { MemoryConsolidator } from '@holoscript/framework/learning';
|
|
11
10
|
import { BaseVoiceSynthesizer } from '@holoscript/engine/runtime/BaseVoiceSynthesizer';
|
|
12
11
|
import { registerVoiceSynthesizer } from '@holoscript/engine/runtime/VoiceSynthesizer';
|
|
13
12
|
import { LocalEmotionDetector } from '@holoscript/engine/runtime/LocalEmotionDetector';
|
|
@@ -246,401 +245,6 @@ function setSharedEventBus(bus) {
|
|
|
246
245
|
sharedBus = bus;
|
|
247
246
|
}
|
|
248
247
|
|
|
249
|
-
// src/network/PriorityScorer.ts
|
|
250
|
-
var PriorityScorer = class {
|
|
251
|
-
/**
|
|
252
|
-
* Scores a raw delta based on simulated heuristics returning a priority class.
|
|
253
|
-
* Lower is more important.
|
|
254
|
-
*/
|
|
255
|
-
static score(delta) {
|
|
256
|
-
let basePriority = 50;
|
|
257
|
-
if (delta.field === "x" || delta.field === "y" || delta.field === "z") {
|
|
258
|
-
basePriority -= 40;
|
|
259
|
-
}
|
|
260
|
-
if (delta.field === "health" || delta.field === "status") {
|
|
261
|
-
basePriority -= 50;
|
|
262
|
-
}
|
|
263
|
-
if (typeof delta.newValue === "string" && delta.newValue.length > 50) {
|
|
264
|
-
basePriority += 30;
|
|
265
|
-
}
|
|
266
|
-
basePriority = Math.max(0, Math.min(100, basePriority));
|
|
267
|
-
return {
|
|
268
|
-
...delta,
|
|
269
|
-
priority: basePriority
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
// src/network/SpatialSharder.ts
|
|
275
|
-
var SpatialSharder = class {
|
|
276
|
-
/**
|
|
277
|
-
* Maps an absolute position to a unique Shard ID string.
|
|
278
|
-
*/
|
|
279
|
-
static getShardId(x, y, z) {
|
|
280
|
-
const sx = Math.floor(x / this.SHARD_SIZE);
|
|
281
|
-
const sy = Math.floor(y / this.SHARD_SIZE);
|
|
282
|
-
const sz = Math.floor(z / this.SHARD_SIZE);
|
|
283
|
-
return `shard_${sx}_${sy}_${sz}`;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Calculates all overlapping shards for a given bounding sphere or interaction radius.
|
|
287
|
-
*/
|
|
288
|
-
static getOverlappingShards(x, y, z, radius) {
|
|
289
|
-
const shards = /* @__PURE__ */ new Set();
|
|
290
|
-
const minX = Math.floor((x - radius) / this.SHARD_SIZE);
|
|
291
|
-
const maxX = Math.floor((x + radius) / this.SHARD_SIZE);
|
|
292
|
-
const minY = Math.floor((y - radius) / this.SHARD_SIZE);
|
|
293
|
-
const maxY = Math.floor((y + radius) / this.SHARD_SIZE);
|
|
294
|
-
const minZ = Math.floor((z - radius) / this.SHARD_SIZE);
|
|
295
|
-
const maxZ = Math.floor((z + radius) / this.SHARD_SIZE);
|
|
296
|
-
for (let ix = minX; ix <= maxX; ix++) {
|
|
297
|
-
for (let iy = minY; iy <= maxY; iy++) {
|
|
298
|
-
for (let iz = minZ; iz <= maxZ; iz++) {
|
|
299
|
-
shards.add(`shard_${ix}_${iy}_${iz}`);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return Array.from(shards);
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
SpatialSharder.SHARD_SIZE = 100;
|
|
307
|
-
var TransactionLog = class {
|
|
308
|
-
constructor(logPath) {
|
|
309
|
-
this.writeQueue = [];
|
|
310
|
-
this.isWriting = false;
|
|
311
|
-
this.sequenceId = 0;
|
|
312
|
-
this.logFile = logPath || path.resolve(process.cwd(), ".data", "state_transaction.wal");
|
|
313
|
-
const dir = path.dirname(this.logFile);
|
|
314
|
-
if (!fs.existsSync(dir)) {
|
|
315
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Appends an active delta directly to the offline WAL buffer.
|
|
320
|
-
*/
|
|
321
|
-
append(delta) {
|
|
322
|
-
const stampedDelta = { ...delta, _seq: ++this.sequenceId };
|
|
323
|
-
this.writeQueue.push(stampedDelta);
|
|
324
|
-
this.flush();
|
|
325
|
-
}
|
|
326
|
-
async flush() {
|
|
327
|
-
if (this.isWriting || this.writeQueue.length === 0) return;
|
|
328
|
-
this.isWriting = true;
|
|
329
|
-
const toWrite = this.writeQueue.splice(0, this.writeQueue.length);
|
|
330
|
-
const dataStr = toWrite.map((d) => JSON.stringify(d)).join("\n") + "\n";
|
|
331
|
-
try {
|
|
332
|
-
await fs.promises.appendFile(this.logFile, dataStr, "utf-8");
|
|
333
|
-
} catch (error) {
|
|
334
|
-
this.writeQueue.unshift(...toWrite);
|
|
335
|
-
} finally {
|
|
336
|
-
this.isWriting = false;
|
|
337
|
-
if (this.writeQueue.length > 0) {
|
|
338
|
-
this.flush();
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Recover the state strictly from the raw disk array.
|
|
344
|
-
*/
|
|
345
|
-
async recover() {
|
|
346
|
-
if (!fs.existsSync(this.logFile)) {
|
|
347
|
-
return [];
|
|
348
|
-
}
|
|
349
|
-
try {
|
|
350
|
-
const data = await fs.promises.readFile(this.logFile, "utf-8");
|
|
351
|
-
const lines = data.split("\n").filter((l) => l.trim().length > 0);
|
|
352
|
-
const recoveredDeltas = lines.map((line) => {
|
|
353
|
-
const parsed = JSON.parse(line);
|
|
354
|
-
if (parsed._seq && parsed._seq > this.sequenceId) {
|
|
355
|
-
this.sequenceId = parsed._seq;
|
|
356
|
-
}
|
|
357
|
-
return parsed;
|
|
358
|
-
});
|
|
359
|
-
return recoveredDeltas;
|
|
360
|
-
} catch (error) {
|
|
361
|
-
return [];
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
async truncate() {
|
|
365
|
-
if (fs.existsSync(this.logFile)) {
|
|
366
|
-
await fs.promises.unlink(this.logFile);
|
|
367
|
-
}
|
|
368
|
-
this.sequenceId = 0;
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
// src/network/StateSynchronizer.ts
|
|
373
|
-
var StateSynchronizer = class _StateSynchronizer {
|
|
374
|
-
constructor() {
|
|
375
|
-
// Subscriber maps bound by entity ID (who is interested in what)
|
|
376
|
-
this.globalSubscribers = /* @__PURE__ */ new Set();
|
|
377
|
-
this.subscriberOptions = /* @__PURE__ */ new Map();
|
|
378
|
-
this.entitySubscribers = /* @__PURE__ */ new Map();
|
|
379
|
-
// Spatial culling position tracking
|
|
380
|
-
this.entityPositions = /* @__PURE__ */ new Map();
|
|
381
|
-
this.entityShards = /* @__PURE__ */ new Map();
|
|
382
|
-
// Procedural Skill Syncer Mesh
|
|
383
|
-
this.skillSubscribers = /* @__PURE__ */ new Set();
|
|
384
|
-
// Adaptive Batching Metrics
|
|
385
|
-
this.pendingBatch = [];
|
|
386
|
-
this.batchTimer = null;
|
|
387
|
-
this.currentBatchWindowMs = 50;
|
|
388
|
-
// Persistent Storage (WAL)
|
|
389
|
-
this.wal = new TransactionLog();
|
|
390
|
-
// Active Transport Mesh
|
|
391
|
-
this.transport = null;
|
|
392
|
-
this.initializedMesh = false;
|
|
393
|
-
}
|
|
394
|
-
static getInstance() {
|
|
395
|
-
if (!_StateSynchronizer.instance) {
|
|
396
|
-
_StateSynchronizer.instance = new _StateSynchronizer();
|
|
397
|
-
}
|
|
398
|
-
return _StateSynchronizer.instance;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Bootstraps the local synchronization node over WebSockets.
|
|
402
|
-
*/
|
|
403
|
-
initializeMesh() {
|
|
404
|
-
if (this.initializedMesh) return;
|
|
405
|
-
this.initializedMesh = true;
|
|
406
|
-
this.transport = new WebSocketTransport({
|
|
407
|
-
roomId: "local_actor",
|
|
408
|
-
serverUrl: "ws://127.0.0.1:8080"
|
|
409
|
-
});
|
|
410
|
-
this.transport.connect();
|
|
411
|
-
this.transport.onMessage("state-sync", (msg) => {
|
|
412
|
-
const payload = msg.payload;
|
|
413
|
-
if (payload && payload.agent_updates && Array.isArray(payload.agent_updates)) {
|
|
414
|
-
const inboundDeltas = [];
|
|
415
|
-
for (const update of payload.agent_updates) {
|
|
416
|
-
inboundDeltas.push({
|
|
417
|
-
entityId: update.id,
|
|
418
|
-
field: "x",
|
|
419
|
-
newValue: update.x,
|
|
420
|
-
oldValue: 0,
|
|
421
|
-
timestamp: payload.timestamp
|
|
422
|
-
});
|
|
423
|
-
inboundDeltas.push({
|
|
424
|
-
entityId: update.id,
|
|
425
|
-
field: "y",
|
|
426
|
-
newValue: update.y,
|
|
427
|
-
oldValue: 0,
|
|
428
|
-
timestamp: payload.timestamp
|
|
429
|
-
});
|
|
430
|
-
inboundDeltas.push({
|
|
431
|
-
entityId: update.id,
|
|
432
|
-
field: "z",
|
|
433
|
-
newValue: update.z,
|
|
434
|
-
oldValue: 0,
|
|
435
|
-
timestamp: payload.timestamp
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
if (inboundDeltas.length > 0) {
|
|
439
|
-
this.dispatchToSubscribers(inboundDeltas);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
dispatchToSubscribers(deltas) {
|
|
445
|
-
const publicDeltasToDispatch = deltas.filter((delta) => {
|
|
446
|
-
const isPrivate = delta.field.includes("private_") || delta.field.includes("_secure");
|
|
447
|
-
return !isPrivate;
|
|
448
|
-
});
|
|
449
|
-
this.globalSubscribers.forEach((sub) => {
|
|
450
|
-
sub(publicDeltasToDispatch);
|
|
451
|
-
});
|
|
452
|
-
const entityGroups = /* @__PURE__ */ new Map();
|
|
453
|
-
for (const delta of deltas) {
|
|
454
|
-
let arr = entityGroups.get(delta.entityId);
|
|
455
|
-
if (!arr) {
|
|
456
|
-
arr = [];
|
|
457
|
-
entityGroups.set(delta.entityId, arr);
|
|
458
|
-
}
|
|
459
|
-
arr.push(delta);
|
|
460
|
-
}
|
|
461
|
-
for (const [entityId, entityDeltas] of entityGroups.entries()) {
|
|
462
|
-
const scopedListeners = this.entitySubscribers.get(entityId);
|
|
463
|
-
if (scopedListeners) {
|
|
464
|
-
scopedListeners.forEach((sub) => sub(entityDeltas));
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Enqueue a burst of pre-computed deltas. Rather than instant transmission,
|
|
470
|
-
* they are loaded into an adaptive batch prioritized by the PriorityScorer.
|
|
471
|
-
*/
|
|
472
|
-
broadcastDeltas(deltas) {
|
|
473
|
-
if (deltas.length === 0) return;
|
|
474
|
-
for (const delta of deltas) {
|
|
475
|
-
this.pendingBatch.push(PriorityScorer.score(delta));
|
|
476
|
-
}
|
|
477
|
-
if (!this.batchTimer) {
|
|
478
|
-
this.scheduleNextFlush();
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
scheduleNextFlush() {
|
|
482
|
-
if (this.pendingBatch.length > 500) {
|
|
483
|
-
this.currentBatchWindowMs = Math.min(200, this.currentBatchWindowMs + 10);
|
|
484
|
-
} else if (this.pendingBatch.length < 100) {
|
|
485
|
-
this.currentBatchWindowMs = Math.max(10, this.currentBatchWindowMs - 10);
|
|
486
|
-
}
|
|
487
|
-
this.batchTimer = setTimeout(() => this.flushDeltas(), this.currentBatchWindowMs);
|
|
488
|
-
}
|
|
489
|
-
flushDeltas() {
|
|
490
|
-
this.batchTimer = null;
|
|
491
|
-
if (this.pendingBatch.length === 0) return;
|
|
492
|
-
this.pendingBatch.sort((a, b) => a.priority - b.priority);
|
|
493
|
-
const deltasToDispatch = this.pendingBatch.splice(0, this.pendingBatch.length);
|
|
494
|
-
for (const delta of deltasToDispatch) {
|
|
495
|
-
if (delta.field === "x" || delta.field === "y" || delta.field === "z") {
|
|
496
|
-
let pos = this.entityPositions.get(delta.entityId);
|
|
497
|
-
if (!pos) {
|
|
498
|
-
pos = { x: 0, y: 0, z: 0 };
|
|
499
|
-
this.entityPositions.set(delta.entityId, pos);
|
|
500
|
-
}
|
|
501
|
-
pos[delta.field] = delta.newValue;
|
|
502
|
-
this.entityShards.set(delta.entityId, SpatialSharder.getShardId(pos.x, pos.y, pos.z));
|
|
503
|
-
}
|
|
504
|
-
this.wal.append(delta);
|
|
505
|
-
}
|
|
506
|
-
if (this.transport) {
|
|
507
|
-
this.transport.sendMessage({
|
|
508
|
-
type: "state-sync",
|
|
509
|
-
payload: {
|
|
510
|
-
deltas: deltasToDispatch.map((d) => ({
|
|
511
|
-
id: d.entityId,
|
|
512
|
-
field: d.field,
|
|
513
|
-
value: d.newValue,
|
|
514
|
-
time: d.timestamp
|
|
515
|
-
}))
|
|
516
|
-
}
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
const publicDeltasToDispatch = deltasToDispatch.filter((delta) => {
|
|
520
|
-
const isPrivate = delta.field.includes("private_") || delta.field.includes("_secure");
|
|
521
|
-
return !isPrivate;
|
|
522
|
-
});
|
|
523
|
-
this.globalSubscribers.forEach((sub) => {
|
|
524
|
-
const options = this.subscriberOptions.get(sub);
|
|
525
|
-
if (!options || !options.position || !options.interactionRadius) {
|
|
526
|
-
if (publicDeltasToDispatch.length > 0) sub(publicDeltasToDispatch);
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
const targetShards = new Set(
|
|
530
|
-
SpatialSharder.getOverlappingShards(
|
|
531
|
-
options.position.x,
|
|
532
|
-
options.position.y,
|
|
533
|
-
options.position.z,
|
|
534
|
-
options.interactionRadius
|
|
535
|
-
)
|
|
536
|
-
);
|
|
537
|
-
const culledDeltas = publicDeltasToDispatch.filter((delta) => {
|
|
538
|
-
const entityPos = this.entityPositions.get(delta.entityId);
|
|
539
|
-
if (!entityPos) return true;
|
|
540
|
-
const entityShard = this.entityShards.get(delta.entityId);
|
|
541
|
-
if (entityShard && !targetShards.has(entityShard)) {
|
|
542
|
-
return false;
|
|
543
|
-
}
|
|
544
|
-
const dx = entityPos.x - options.position.x;
|
|
545
|
-
const dy = entityPos.y - options.position.y;
|
|
546
|
-
const dz = entityPos.z - options.position.z;
|
|
547
|
-
const distSq = dx * dx + dy * dy + dz * dz;
|
|
548
|
-
const r = options.interactionRadius;
|
|
549
|
-
return distSq <= r * r;
|
|
550
|
-
});
|
|
551
|
-
if (culledDeltas.length > 0) {
|
|
552
|
-
sub(culledDeltas);
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
const entityGroups = /* @__PURE__ */ new Map();
|
|
556
|
-
for (const delta of deltasToDispatch) {
|
|
557
|
-
let arr = entityGroups.get(delta.entityId);
|
|
558
|
-
if (!arr) {
|
|
559
|
-
arr = [];
|
|
560
|
-
entityGroups.set(delta.entityId, arr);
|
|
561
|
-
}
|
|
562
|
-
arr.push(delta);
|
|
563
|
-
}
|
|
564
|
-
for (const [entityId, entityDeltas] of entityGroups.entries()) {
|
|
565
|
-
const scopedListeners = this.entitySubscribers.get(entityId);
|
|
566
|
-
if (scopedListeners) {
|
|
567
|
-
scopedListeners.forEach((sub) => sub(entityDeltas));
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
if (this.pendingBatch.length > 0) {
|
|
571
|
-
this.scheduleNextFlush();
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* Subscribe to all global state deltas (e.g. Server sync bridges).
|
|
576
|
-
*/
|
|
577
|
-
subscribeGlobal(callback, options) {
|
|
578
|
-
this.globalSubscribers.add(callback);
|
|
579
|
-
if (options) {
|
|
580
|
-
this.subscriberOptions.set(callback, options);
|
|
581
|
-
}
|
|
582
|
-
return () => {
|
|
583
|
-
this.globalSubscribers.delete(callback);
|
|
584
|
-
this.subscriberOptions.delete(callback);
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
/**
|
|
588
|
-
* Subscribe to targeted changes restricted strictly to a specific Entity.
|
|
589
|
-
*/
|
|
590
|
-
subscribeEntity(entityId, callback) {
|
|
591
|
-
let scopedListeners = this.entitySubscribers.get(entityId);
|
|
592
|
-
if (!scopedListeners) {
|
|
593
|
-
scopedListeners = /* @__PURE__ */ new Set();
|
|
594
|
-
this.entitySubscribers.set(entityId, scopedListeners);
|
|
595
|
-
}
|
|
596
|
-
scopedListeners.add(callback);
|
|
597
|
-
return () => {
|
|
598
|
-
const listeners = this.entitySubscribers.get(entityId);
|
|
599
|
-
if (listeners) {
|
|
600
|
-
listeners.delete(callback);
|
|
601
|
-
if (listeners.size === 0) {
|
|
602
|
-
this.entitySubscribers.delete(entityId);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Broadcast a procedural skill mutation recursively so all agents merge success rates.
|
|
609
|
-
*/
|
|
610
|
-
broadcastSkill(skill) {
|
|
611
|
-
this.skillSubscribers.forEach((sub) => sub(skill));
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Listen globally for procedurally acquired skills bouncing across the instance.
|
|
615
|
-
*/
|
|
616
|
-
subscribeSkills(callback) {
|
|
617
|
-
this.skillSubscribers.add(callback);
|
|
618
|
-
return () => this.skillSubscribers.delete(callback);
|
|
619
|
-
}
|
|
620
|
-
/**
|
|
621
|
-
* Recovery API reading `.wal` states sequentially mapping offline CRDT histories completely locally.
|
|
622
|
-
*/
|
|
623
|
-
async recoverFromLog() {
|
|
624
|
-
const deltas = await this.wal.recover();
|
|
625
|
-
if (deltas.length > 0) {
|
|
626
|
-
for (const d of deltas) {
|
|
627
|
-
if (d.field === "x" || d.field === "y" || d.field === "z") {
|
|
628
|
-
let pos = this.entityPositions.get(d.entityId);
|
|
629
|
-
if (!pos) {
|
|
630
|
-
pos = { x: 0, y: 0, z: 0 };
|
|
631
|
-
this.entityPositions.set(d.entityId, pos);
|
|
632
|
-
}
|
|
633
|
-
pos[d.field] = d.newValue;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
return deltas;
|
|
638
|
-
}
|
|
639
|
-
async clearLog() {
|
|
640
|
-
await this.wal.truncate();
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
|
|
644
248
|
// src/monitoring/telemetry.ts
|
|
645
249
|
var TelemetryRegistry = class {
|
|
646
250
|
constructor() {
|
|
@@ -1321,7 +925,7 @@ var HoloScriptRuntime = class {
|
|
|
1321
925
|
);
|
|
1322
926
|
builtins.set("wait", async (args) => {
|
|
1323
927
|
const ms = Number(args[0]) || 0;
|
|
1324
|
-
await new Promise((
|
|
928
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
1325
929
|
return { waited: ms };
|
|
1326
930
|
});
|
|
1327
931
|
builtins.set("print", (args) => {
|
|
@@ -1387,7 +991,7 @@ var HoloScriptRuntime = class {
|
|
|
1387
991
|
builtins.set("calculate_arc", (args) => this.handleCalculateArc(args));
|
|
1388
992
|
builtins.set(
|
|
1389
993
|
"sleep",
|
|
1390
|
-
(args) => new Promise((
|
|
994
|
+
(args) => new Promise((resolve) => setTimeout(resolve, Number(args[0]) || 0))
|
|
1391
995
|
);
|
|
1392
996
|
builtins.set("think", async (args) => {
|
|
1393
997
|
const activeNode = this.context.executionStack[this.context.executionStack.length - 1];
|
|
@@ -2049,10 +1653,10 @@ var HoloScriptRuntime = class {
|
|
|
2049
1653
|
async executeGate(node) {
|
|
2050
1654
|
try {
|
|
2051
1655
|
const condition = this.evaluateCondition(node.condition);
|
|
2052
|
-
const
|
|
1656
|
+
const path = condition ? node.truePath : node.falsePath;
|
|
2053
1657
|
logger.info("Gate evaluation", { condition: node.condition, result: condition });
|
|
2054
|
-
if (
|
|
2055
|
-
const subResults = await this.executeProgram(
|
|
1658
|
+
if (path.length > 0) {
|
|
1659
|
+
const subResults = await this.executeProgram(path, this.callStack.length + 1);
|
|
2056
1660
|
const lastResult = subResults[subResults.length - 1];
|
|
2057
1661
|
if (lastResult && lastResult.success && lastResult.output !== void 0) {
|
|
2058
1662
|
return lastResult;
|
|
@@ -3432,9 +3036,9 @@ var HoloScriptRuntime = class {
|
|
|
3432
3036
|
case "UpdateExpression": {
|
|
3433
3037
|
const val = await this.evaluateHoloExpression(expr.argument, scopeOverride);
|
|
3434
3038
|
const newVal = expr.operator === "++" ? val + 1 : val - 1;
|
|
3435
|
-
const
|
|
3436
|
-
if (
|
|
3437
|
-
this.setVariable(
|
|
3039
|
+
const path = this.getMemberPath(expr.argument);
|
|
3040
|
+
if (path) {
|
|
3041
|
+
this.setVariable(path, newVal, scopeOverride);
|
|
3438
3042
|
}
|
|
3439
3043
|
return expr.prefix ? newVal : val;
|
|
3440
3044
|
}
|
|
@@ -3762,7 +3366,9 @@ var HoloScriptRuntime = class {
|
|
|
3762
3366
|
const parser = new HoloScriptCodeParser();
|
|
3763
3367
|
const result = parser.parse(migration.body);
|
|
3764
3368
|
if (result.errors.length > 0) {
|
|
3765
|
-
logger.error(`Migration parse errors for ${orb.name}:`, {
|
|
3369
|
+
logger.error(`Migration parse errors for ${orb.name}:`, {
|
|
3370
|
+
errors: result.errors
|
|
3371
|
+
});
|
|
3766
3372
|
return;
|
|
3767
3373
|
}
|
|
3768
3374
|
await this.executeProgram(result.ast, 0);
|
|
@@ -4036,7 +3642,10 @@ var HoloScriptRuntime = class {
|
|
|
4036
3642
|
if (event === "position_update") {
|
|
4037
3643
|
const posPayload = payload;
|
|
4038
3644
|
if (posPayload?.position) {
|
|
4039
|
-
this.setOrbPosition(
|
|
3645
|
+
this.setOrbPosition(
|
|
3646
|
+
name,
|
|
3647
|
+
posPayload.position
|
|
3648
|
+
);
|
|
4040
3649
|
}
|
|
4041
3650
|
}
|
|
4042
3651
|
return this.emit(event, payload);
|
|
@@ -4061,6 +3670,6 @@ __decorateClass([
|
|
|
4061
3670
|
MethodMemoize(500)
|
|
4062
3671
|
], HoloScriptRuntime.prototype, "getMemberPath", 1);
|
|
4063
3672
|
|
|
4064
|
-
export { EventBus, HoloScriptRuntime,
|
|
4065
|
-
//# sourceMappingURL=chunk-
|
|
4066
|
-
//# sourceMappingURL=chunk-
|
|
3673
|
+
export { EventBus, HoloScriptRuntime, getSharedEventBus, setSharedEventBus, telemetry };
|
|
3674
|
+
//# sourceMappingURL=chunk-LSW7P7ML.js.map
|
|
3675
|
+
//# sourceMappingURL=chunk-LSW7P7ML.js.map
|