@holoscript/core 8.0.14 → 8.0.16

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 (187) hide show
  1. package/README.md +6 -13
  2. package/bin/holo-decision.mjs +0 -0
  3. package/bin/holoscript.cjs +0 -0
  4. package/dist/{GLTFPipeline-6LS3UDYX.js → GLTFPipeline-FRBZIATS.js} +6 -6
  5. package/dist/{GLTFPipeline-VTI6PRRQ.cjs → GLTFPipeline-MTPP444P.cjs} +10 -10
  6. package/dist/{HoloCompositionParser-GILABNN3.js → HoloCompositionParser-2GVQAZ2X.js} +7 -7
  7. package/dist/HoloCompositionParser-3NDF6BMX.cjs +45 -0
  8. package/dist/HoloScriptPlusParser-URSIBEAW.cjs +30 -0
  9. package/dist/HoloScriptPlusParser-YCV6L7GI.js +13 -0
  10. package/dist/{HoloScriptRuntime-YBYXJHJN.cjs → HoloScriptRuntime-CRWI6C3P.cjs} +5 -5
  11. package/dist/{HoloScriptRuntime-UTRLJI5L.js → HoloScriptRuntime-IAZGHPFP.js} +4 -4
  12. package/dist/{SceneIRCompiler-VX75RB6H.js → SceneIRCompiler-BJQMKLWL.js} +6 -6
  13. package/dist/{SceneIRCompiler-7KQ5NKAU.cjs → SceneIRCompiler-RTPPDQAV.cjs} +11 -11
  14. package/dist/{chunk-Y2OCKXVD.js → chunk-22AULOAL.js} +5 -5
  15. package/dist/{chunk-D44CEFY4.cjs → chunk-2DJIS7TH.cjs} +5 -5
  16. package/dist/{chunk-LHUDAJQT.cjs → chunk-2PVEXEOL.cjs} +5 -5
  17. package/dist/{chunk-M7XR3F53.js → chunk-2UP2J3OK.js} +4 -4
  18. package/dist/{chunk-3KHRZTNW.js → chunk-3AUYBQ5I.js} +3 -3
  19. package/dist/{chunk-UKEK2NZJ.js → chunk-3MQAOMKD.js} +3 -3
  20. package/dist/{chunk-FWKEY4LD.js → chunk-4AGNARX6.js} +3 -3
  21. package/dist/{chunk-7ITJP33Q.cjs → chunk-4CQ7ULXZ.cjs} +3 -3
  22. package/dist/{chunk-47XZ62KM.js → chunk-4UA5OBWR.js} +5 -5
  23. package/dist/{chunk-ORBVCOTC.js → chunk-5LCJDX5A.js} +3 -3
  24. package/dist/{chunk-IK6Z2HNC.js → chunk-6OQHLNTT.js} +2 -2
  25. package/dist/{chunk-EI3J6LTW.cjs → chunk-6RDHWSZM.cjs} +217 -217
  26. package/dist/{chunk-73EDVY5D.js → chunk-7AY66PZP.js} +3 -3
  27. package/dist/{chunk-6FCNMTL5.js → chunk-7HDRN5BW.js} +4 -4
  28. package/dist/{chunk-N7MIIDLI.cjs → chunk-7IBXTJP7.cjs} +8 -8
  29. package/dist/{chunk-R5VKLUMR.js → chunk-AAUQTR7I.js} +4 -4
  30. package/dist/{chunk-HCONR4J6.cjs → chunk-AN3ZH7M7.cjs} +38 -38
  31. package/dist/{chunk-YW3I2FQL.js → chunk-ANMME7XT.js} +4 -2
  32. package/dist/{chunk-W4AJMMQR.js → chunk-AUF7HFOO.js} +60 -22
  33. package/dist/{chunk-SKVBUGMC.cjs → chunk-AUMTQV64.cjs} +7 -7
  34. package/dist/{chunk-7ZKQ32XK.js → chunk-B5K3WHJ4.js} +4 -4
  35. package/dist/{chunk-QQFB4RT2.cjs → chunk-BTVHY3UB.cjs} +2 -2
  36. package/dist/{chunk-SE2Y5BSL.cjs → chunk-CMEINO5I.cjs} +186 -70
  37. package/dist/{chunk-YMI3ED3B.cjs → chunk-CRUIGXF7.cjs} +5 -5
  38. package/dist/chunk-DDBYJJZK.js +1571 -0
  39. package/dist/{chunk-2E6PP5UE.cjs → chunk-E2SNPMBO.cjs} +11 -11
  40. package/dist/{chunk-GI5YYZH6.js → chunk-E4YS5SIZ.js} +90 -25
  41. package/dist/{chunk-62OYZT6Q.js → chunk-EKNWUSGW.js} +3 -3
  42. package/dist/{chunk-RVN7OPCP.js → chunk-ETIJOUIO.js} +4 -4
  43. package/dist/chunk-EUNELE7Y.cjs +1605 -0
  44. package/dist/{chunk-C73GVAYC.js → chunk-F33KLYOS.js} +5 -5
  45. package/dist/{chunk-4CRMVEON.cjs → chunk-F47FEV4X.cjs} +40 -40
  46. package/dist/{chunk-FGXJPJ3W.cjs → chunk-FCGTI7FO.cjs} +4 -4
  47. package/dist/{chunk-OSKGCXAQ.cjs → chunk-FGTXAVKG.cjs} +5 -5
  48. package/dist/{chunk-XZC75AJ4.cjs → chunk-FPGYWNNA.cjs} +5 -5
  49. package/dist/{chunk-5B2AJKA5.cjs → chunk-FQ4MYZYU.cjs} +20 -20
  50. package/dist/{chunk-KOGPVAP6.js → chunk-FT4FGTR6.js} +3 -3
  51. package/dist/{chunk-N7IYRAFG.cjs → chunk-FVNV4WHQ.cjs} +14 -14
  52. package/dist/{chunk-SJIRCTIS.cjs → chunk-HSGJFCVJ.cjs} +2 -2
  53. package/dist/{chunk-TKDDIE3T.cjs → chunk-ILO2KMER.cjs} +4 -4
  54. package/dist/{chunk-GGH3ZYDB.cjs → chunk-IPBSNGAN.cjs} +92 -27
  55. package/dist/{chunk-JQCXLKAU.js → chunk-IX2U3RQT.js} +3 -3
  56. package/dist/{chunk-P65OIMJT.cjs → chunk-IYK6LMQ7.cjs} +7 -7
  57. package/dist/{chunk-NWKARJM2.js → chunk-J3VVM6GV.js} +4 -4
  58. package/dist/{chunk-FOM36K5I.cjs → chunk-J74S4ZMF.cjs} +18 -18
  59. package/dist/{chunk-36NPLOI4.cjs → chunk-JERWCCEJ.cjs} +4 -2
  60. package/dist/{chunk-VXHB6ZHY.js → chunk-JTDDLCSP.js} +4 -4
  61. package/dist/{chunk-GYJLP4BO.cjs → chunk-K53L47NH.cjs} +30 -30
  62. package/dist/{chunk-FHR2AVMA.cjs → chunk-LJTM5ONX.cjs} +23 -23
  63. package/dist/{chunk-JCVSCKUH.js → chunk-LJVVOVA6.js} +4 -4
  64. package/dist/{chunk-LQNL3IYV.cjs → chunk-LNJKBQ2B.cjs} +38 -38
  65. package/dist/{chunk-2GKF7JQ6.js → chunk-M2GDE3NV.js} +3 -3
  66. package/dist/{chunk-Z7NUL73U.js → chunk-MSZNGI5P.js} +3 -3
  67. package/dist/{chunk-B6JHTTMR.cjs → chunk-N2BOTBPG.cjs} +15 -15
  68. package/dist/{chunk-L4DBUX3N.cjs → chunk-NFALJJCH.cjs} +12 -12
  69. package/dist/{chunk-YBM34FUJ.cjs → chunk-NRZRBK25.cjs} +6 -6
  70. package/dist/{chunk-SNMQUWIO.cjs → chunk-NTSLNIY7.cjs} +10 -10
  71. package/dist/{chunk-645EWDZW.cjs → chunk-NZJOAWJM.cjs} +4 -4
  72. package/dist/{chunk-LGRKBTPM.js → chunk-OG7RKWWX.js} +3 -3
  73. package/dist/{chunk-OOP4S3GU.cjs → chunk-OQVHCYY4.cjs} +5 -5
  74. package/dist/{chunk-TMNAKNV2.cjs → chunk-PEBNX3VM.cjs} +5 -5
  75. package/dist/{chunk-5T6BWIB7.js → chunk-PFZ5WLIP.js} +4 -4
  76. package/dist/{chunk-CESMPUEZ.cjs → chunk-PHLNABJD.cjs} +159 -145
  77. package/dist/{chunk-CHIZSMWD.js → chunk-PLK3DLTF.js} +3 -3
  78. package/dist/{chunk-4NEPHK2K.js → chunk-PMACVMHL.js} +3 -3
  79. package/dist/{chunk-EYHPTJ3F.js → chunk-PV2OXNP5.js} +40 -26
  80. package/dist/{chunk-KLM6QD6D.cjs → chunk-Q6VW7MGX.cjs} +14 -14
  81. package/dist/{chunk-YDSNDCV3.js → chunk-QC3CAVFN.js} +186 -69
  82. package/dist/{chunk-REN3LHO6.cjs → chunk-QKLEDRHN.cjs} +19 -19
  83. package/dist/{chunk-2EGGAZT3.js → chunk-QS27OYBU.js} +3 -3
  84. package/dist/{chunk-4376VHNJ.js → chunk-RUB7WL6C.js} +3 -3
  85. package/dist/chunk-S2BSXG3B.js +3308 -0
  86. package/dist/{chunk-TZQKJOPC.js → chunk-TW2AH2ZS.js} +3 -3
  87. package/dist/{chunk-Q4J2K7FI.js → chunk-TZM6DKSJ.js} +6 -6
  88. package/dist/{chunk-ESSEF6U2.js → chunk-U227RWXB.js} +3 -3
  89. package/dist/{chunk-ERYKKPHW.cjs → chunk-U6CQOM5Q.cjs} +13 -13
  90. package/dist/{chunk-VMCR5QVI.js → chunk-ULT2QAV5.js} +4 -4
  91. package/dist/chunk-VQOTDNFL.cjs +3337 -0
  92. package/dist/{chunk-VZI7S7P6.cjs → chunk-VSO6HPDZ.cjs} +7 -7
  93. package/dist/{chunk-QLPRI3QW.js → chunk-WQJMSSJT.js} +4 -4
  94. package/dist/{chunk-GILYQ5VH.cjs → chunk-WXSDBWGM.cjs} +4 -4
  95. package/dist/{chunk-42Z3SVHQ.js → chunk-X5PMMK7H.js} +3 -3
  96. package/dist/{chunk-ML4V5PVU.cjs → chunk-X5ZLSPU2.cjs} +74 -32
  97. package/dist/{chunk-PSWCJQS4.js → chunk-X727CQ7X.js} +5 -5
  98. package/dist/{chunk-YM7UUYR5.cjs → chunk-XHZYS4QO.cjs} +5 -5
  99. package/dist/{chunk-PZ46WRHX.cjs → chunk-XRQCTTDC.cjs} +8 -8
  100. package/dist/{chunk-IXFNA5TT.js → chunk-YBIHSN55.js} +4 -4
  101. package/dist/{chunk-BLCWQ225.js → chunk-Z574GVI3.js} +4 -4
  102. package/dist/{chunk-ZVQMKUGJ.js → chunk-Z5V3KA7L.js} +2 -2
  103. package/dist/{chunk-VTFLKSJL.cjs → chunk-ZHW6TDZ6.cjs} +14 -14
  104. package/dist/{chunk-KYJD2UMV.js → chunk-ZPHCTPR6.js} +4 -4
  105. package/dist/{chunk-VA7THINF.cjs → chunk-ZXXC2GXB.cjs} +38 -38
  106. package/dist/cli/holoscript-runner.cjs +168 -19
  107. package/dist/cli/holoscript-runner.js +162 -13
  108. package/dist/compiler/agent-inference.cjs +7 -7
  109. package/dist/compiler/agent-inference.js +3 -3
  110. package/dist/compiler/android-xr.cjs +6 -6
  111. package/dist/compiler/android-xr.js +4 -4
  112. package/dist/compiler/android.cjs +5 -5
  113. package/dist/compiler/android.js +3 -3
  114. package/dist/compiler/context.cjs +5 -5
  115. package/dist/compiler/context.js +2 -2
  116. package/dist/compiler/daimon-seed.cjs +8 -8
  117. package/dist/compiler/daimon-seed.js +3 -3
  118. package/dist/compiler/domain-block-utils.cjs +164 -164
  119. package/dist/compiler/domain-block-utils.js +3 -3
  120. package/dist/compiler/dtdl.cjs +6 -6
  121. package/dist/compiler/dtdl.js +3 -3
  122. package/dist/compiler/gltf-pipeline.cjs +8 -8
  123. package/dist/compiler/gltf-pipeline.js +1 -1
  124. package/dist/compiler/godot.cjs +5 -5
  125. package/dist/compiler/godot.js +4 -4
  126. package/dist/compiler/incremental.cjs +7 -7
  127. package/dist/compiler/incremental.js +2 -2
  128. package/dist/compiler/index.cjs +1603 -204
  129. package/dist/compiler/index.d.ts +8 -0
  130. package/dist/compiler/index.js +1431 -55
  131. package/dist/compiler/ios.cjs +5 -5
  132. package/dist/compiler/ios.js +3 -3
  133. package/dist/compiler/llm-provider-capabilities.cjs +5 -5
  134. package/dist/compiler/llm-provider-capabilities.js +2 -2
  135. package/dist/compiler/openxr.cjs +5 -5
  136. package/dist/compiler/openxr.js +4 -4
  137. package/dist/compiler/sdf.cjs +6 -6
  138. package/dist/compiler/sdf.js +4 -4
  139. package/dist/compiler/state.cjs +5 -5
  140. package/dist/compiler/state.js +3 -3
  141. package/dist/compiler/trait-composition.cjs +6 -6
  142. package/dist/compiler/trait-composition.js +2 -2
  143. package/dist/compiler/unity.cjs +5 -5
  144. package/dist/compiler/unity.js +4 -4
  145. package/dist/compiler/unreal.cjs +6 -6
  146. package/dist/compiler/unreal.js +4 -4
  147. package/dist/compiler/urdf.cjs +13 -13
  148. package/dist/compiler/urdf.js +4 -4
  149. package/dist/compiler/usd-physics.cjs +6 -6
  150. package/dist/compiler/usd-physics.js +3 -3
  151. package/dist/compiler/visionos.cjs +5 -5
  152. package/dist/compiler/visionos.js +4 -4
  153. package/dist/compiler/vrchat.cjs +6 -6
  154. package/dist/compiler/vrchat.js +4 -4
  155. package/dist/compiler/wasm.cjs +9 -9
  156. package/dist/compiler/wasm.js +4 -4
  157. package/dist/compiler/webgpu.cjs +5 -5
  158. package/dist/compiler/webgpu.js +4 -4
  159. package/dist/constants.cjs +99 -99
  160. package/dist/constants.js +3 -3
  161. package/dist/debugger.cjs +5 -5
  162. package/dist/debugger.js +3 -3
  163. package/dist/{dist-GRMOP2UL.cjs → dist-YGATNURH.cjs} +705 -9
  164. package/dist/{dist-ZBUKU2JG.js → dist-ZEZXRCBG.js} +701 -10
  165. package/dist/entries/scripting.cjs +8 -8
  166. package/dist/entries/scripting.js +4 -4
  167. package/dist/evolution/index.cjs +20 -20
  168. package/dist/evolution/index.js +8 -8
  169. package/dist/index.cjs +871 -809
  170. package/dist/index.d.ts +8 -0
  171. package/dist/index.js +132 -70
  172. package/dist/parser/HoloCompositionTypes.d.ts +1 -1
  173. package/dist/parser.cjs +21 -21
  174. package/dist/parser.js +7 -7
  175. package/dist/reconstruction/index.cjs +63 -63
  176. package/dist/reconstruction/index.js +7 -7
  177. package/dist/runtime.cjs +9 -9
  178. package/dist/runtime.js +3 -3
  179. package/dist/traits/botanical-lotus.d.ts +61 -0
  180. package/dist/traits/index.cjs +664 -671
  181. package/dist/traits/index.d.ts +65 -0
  182. package/dist/traits/index.js +14 -21
  183. package/dist/types/HoloScriptPlus.d.ts +1 -1
  184. package/package.json +65 -63
  185. package/dist/HoloCompositionParser-ZVRYVEA5.cjs +0 -45
  186. package/dist/HoloScriptPlusParser-WTPRPRPR.cjs +0 -30
  187. package/dist/HoloScriptPlusParser-ZP53ECSL.js +0 -13
@@ -4,7 +4,7 @@ var chunkGJNCFRJU_cjs = require('./chunk-GJNCFRJU.cjs');
4
4
  var chunkOQXB6NNC_cjs = require('./chunk-OQXB6NNC.cjs');
5
5
  var chunk3CDDRUER_cjs = require('./chunk-3CDDRUER.cjs');
6
6
  var chunkPVODJEJ7_cjs = require('./chunk-PVODJEJ7.cjs');
7
- var chunkSJIRCTIS_cjs = require('./chunk-SJIRCTIS.cjs');
7
+ var chunkHSGJFCVJ_cjs = require('./chunk-HSGJFCVJ.cjs');
8
8
  var chunkILRBGFVD_cjs = require('./chunk-ILRBGFVD.cjs');
9
9
  var chunkQ47JEE2C_cjs = require('./chunk-Q47JEE2C.cjs');
10
10
 
@@ -286,7 +286,7 @@ function updateAnimations(animations, setVariable, now) {
286
286
  for (const [key, anim] of animations) {
287
287
  const elapsed = now - anim.startTime;
288
288
  let progress = Math.min(elapsed / anim.duration, 1);
289
- progress = chunkSJIRCTIS_cjs.applyEasing(progress, anim.easing);
289
+ progress = chunkHSGJFCVJ_cjs.applyEasing(progress, anim.easing);
290
290
  const currentValue = anim.from + (anim.to - anim.from) * progress;
291
291
  if (anim.yoyo && progress >= 1) {
292
292
  anim.startTime = now;
@@ -2449,7 +2449,7 @@ var HoloScriptAgentRuntime = class _HoloScriptAgentRuntime {
2449
2449
  // JEPA action-planning loop (Phase 8)
2450
2450
  // Default latentDim=64, condDim=16 (action conditioning). Caller can swap
2451
2451
  // weights externally via this.jepaPredictor.setWeights() after training.
2452
- this.jepaPredictor = new chunkSJIRCTIS_cjs.JEPAPredictor({ latentDim: 64, condDim: 16 });
2452
+ this.jepaPredictor = new chunkHSGJFCVJ_cjs.JEPAPredictor({ latentDim: 64, condDim: 16 });
2453
2453
  this.jepaObjectiveNode = {};
2454
2454
  this.jepaObjectiveAttached = false;
2455
2455
  if (!agentNode || !parentRuntime) {
@@ -2601,12 +2601,12 @@ var HoloScriptAgentRuntime = class _HoloScriptAgentRuntime {
2601
2601
  ensureJepaObjectiveAttached() {
2602
2602
  if (!this.jepaObjectiveAttached) {
2603
2603
  const config = this.getJepaObjectiveConfig();
2604
- chunkSJIRCTIS_cjs.jepObjectiveHandler.onAttach?.(this.jepaObjectiveNode, config, this.buildJepaTraitContext());
2604
+ chunkHSGJFCVJ_cjs.jepObjectiveHandler.onAttach?.(this.jepaObjectiveNode, config, this.buildJepaTraitContext());
2605
2605
  this.jepaObjectiveAttached = true;
2606
2606
  }
2607
2607
  }
2608
2608
  getJepaObjectiveConfig() {
2609
- const config = chunkSJIRCTIS_cjs.jepObjectiveHandler.defaultConfig;
2609
+ const config = chunkHSGJFCVJ_cjs.jepObjectiveHandler.defaultConfig;
2610
2610
  if (!config) {
2611
2611
  throw new Error("JEPAObjective handler defaultConfig is required for offline training");
2612
2612
  }
@@ -2656,7 +2656,7 @@ var HoloScriptAgentRuntime = class _HoloScriptAgentRuntime {
2656
2656
  const latentDim = config.latentDim;
2657
2657
  const outcomeStr = outcome.success ? `success:${String(outcome.output ?? "")}` : `failure:${String(outcome.error ?? "")}`;
2658
2658
  const targetVec = textToEmbeddingFloat32(outcomeStr, latentDim);
2659
- chunkSJIRCTIS_cjs.jepObjectiveHandler.onEvent?.(this.jepaObjectiveNode, config, this.buildJepaTraitContext(), {
2659
+ chunkHSGJFCVJ_cjs.jepObjectiveHandler.onEvent?.(this.jepaObjectiveNode, config, this.buildJepaTraitContext(), {
2660
2660
  type: "jepa:encode_pair",
2661
2661
  context: contextStr,
2662
2662
  targetVec,
@@ -3095,8 +3095,8 @@ var HoloScriptRuntime = class {
3095
3095
  topK
3096
3096
  );
3097
3097
  });
3098
- this.traitHandlers.set("mitosis", chunkSJIRCTIS_cjs.mitosisHandler);
3099
- this.traitHandlers.set("orbital", chunkSJIRCTIS_cjs.orbitalHandler);
3098
+ this.traitHandlers.set("mitosis", chunkHSGJFCVJ_cjs.mitosisHandler);
3099
+ this.traitHandlers.set("orbital", chunkHSGJFCVJ_cjs.orbitalHandler);
3100
3100
  this.traitHandlers.set(
3101
3101
  "corona_simulation",
3102
3102
  chunkOQXB6NNC_cjs.coronaSimulationHandler
@@ -3576,7 +3576,7 @@ var HoloScriptRuntime = class {
3576
3576
  // contract requires Promise<void> so trait-side emits can `await`
3577
3577
  // through a unified interface. Wrap with Promise.resolve.
3578
3578
  globalBusEmit: (event, data) => {
3579
- chunkSJIRCTIS_cjs.getSharedEventBus().emit(event, data);
3579
+ chunkHSGJFCVJ_cjs.getSharedEventBus().emit(event, data);
3580
3580
  return Promise.resolve();
3581
3581
  },
3582
3582
  sendStateMachineEvent: (id, event) => engineRuntime.stateMachineInterpreter.sendEvent(id, event)
@@ -4347,5 +4347,5 @@ exports.HoloScriptAgentRuntime = HoloScriptAgentRuntime;
4347
4347
  exports.HoloScriptRuntime = HoloScriptRuntime;
4348
4348
  exports.TRAIT_OWNER_KEY = TRAIT_OWNER_KEY;
4349
4349
  exports.registerPluginTraits = registerPluginTraits;
4350
- //# sourceMappingURL=chunk-2E6PP5UE.cjs.map
4351
- //# sourceMappingURL=chunk-2E6PP5UE.cjs.map
4350
+ //# sourceMappingURL=chunk-E2SNPMBO.cjs.map
4351
+ //# sourceMappingURL=chunk-E2SNPMBO.cjs.map
@@ -1,7 +1,13 @@
1
- import { init_CompilerBase, CompilerBase } from './chunk-YDSNDCV3.js';
1
+ import { init_CompilerBase, CompilerBase } from './chunk-QC3CAVFN.js';
2
2
 
3
3
  // src/compiler/QuantumCircuitCompiler.ts
4
4
  init_CompilerBase();
5
+ function configValue(entry) {
6
+ if (typeof entry === "object" && entry !== null && "value" in entry) {
7
+ return entry.value;
8
+ }
9
+ return entry;
10
+ }
5
11
  function qubitsForMolecule(atoms) {
6
12
  const orbitalCount = atoms.reduce((sum, a) => {
7
13
  if (a.symbol === "H") return sum + 1;
@@ -12,8 +18,8 @@ function qubitsForMolecule(atoms) {
12
18
  }
13
19
  function extractNumber(config, key) {
14
20
  const entry = config[key];
15
- if (!entry) return void 0;
16
- const v = entry.value;
21
+ if (entry === void 0) return void 0;
22
+ const v = configValue(entry);
17
23
  if (typeof v === "number") return v;
18
24
  if (typeof v === "string") {
19
25
  const n = parseFloat(v);
@@ -21,10 +27,33 @@ function extractNumber(config, key) {
21
27
  }
22
28
  return void 0;
23
29
  }
30
+ function extractString(config, ...keys) {
31
+ for (const key of keys) {
32
+ const value = configValue(config[key]);
33
+ if (typeof value === "string" && value.trim().length > 0) return value.trim();
34
+ }
35
+ return void 0;
36
+ }
37
+ function extractNumberArray(config, ...keys) {
38
+ for (const key of keys) {
39
+ let value = configValue(config[key]);
40
+ if (typeof value === "string") {
41
+ try {
42
+ value = JSON.parse(value);
43
+ } catch {
44
+ continue;
45
+ }
46
+ }
47
+ if (Array.isArray(value) && value.every((entry) => typeof entry === "number" && Number.isFinite(entry))) {
48
+ return value;
49
+ }
50
+ }
51
+ return void 0;
52
+ }
24
53
  function extractAtoms(config) {
25
54
  const entry = config["molecule"] ?? config["atoms"];
26
55
  if (!entry) return void 0;
27
- let raw = entry.value;
56
+ let raw = configValue(entry);
28
57
  if (typeof raw === "string") {
29
58
  try {
30
59
  raw = JSON.parse(raw);
@@ -38,9 +67,9 @@ function extractAtoms(config) {
38
67
  );
39
68
  }
40
69
  function extractWeightMatrix(config) {
41
- const entry = config["weightMatrix"] ?? config["weight_matrix"] ?? config["adjacency"];
70
+ const entry = config["quboMatrix"] ?? config["qubo_matrix"] ?? config["weightMatrix"] ?? config["weight_matrix"] ?? config["adjacency"];
42
71
  if (!entry) return void 0;
43
- let raw = entry.value;
72
+ let raw = configValue(entry);
44
73
  if (typeof raw === "string") {
45
74
  try {
46
75
  raw = JSON.parse(raw);
@@ -105,7 +134,7 @@ function generateVQECircuit(atoms, moleculeName, ansatzLayers, initialParams) {
105
134
  const estimatedDepth = ansatzLayers * 2 + 1;
106
135
  return { qasm: lines.join("\n"), numQubits: n, estimatedDepth, warnings, paramNames };
107
136
  }
108
- function generateQAOACircuit(weightMatrix, p, initialGamma, initialBeta) {
137
+ function generateQAOACircuit(weightMatrix, p, optimizationProblem, initialGamma, initialBeta) {
109
138
  const warnings = [];
110
139
  let n = weightMatrix.length;
111
140
  if (n > 100) {
@@ -130,7 +159,9 @@ function generateQAOACircuit(weightMatrix, p, initialGamma, initialBeta) {
130
159
  const lines = [];
131
160
  lines.push("OPENQASM 3.0;");
132
161
  lines.push('include "stdgates.inc";');
133
- lines.push(`// QAOA Max-Cut circuit for ${n}-node graph (p=${p})`);
162
+ lines.push(
163
+ `// QAOA ${optimizationProblem === "qubo" ? "upper-triangular QUBO" : "Max-Cut"} circuit for ${n} binary variables (p=${p})`
164
+ );
134
165
  lines.push("// Generated by HoloScript QuantumCircuitCompiler");
135
166
  lines.push(`qubit[${n}] q;`);
136
167
  lines.push(`bit[${n}] c;`);
@@ -145,16 +176,36 @@ function generateQAOACircuit(weightMatrix, p, initialGamma, initialBeta) {
145
176
  }
146
177
  for (let round = 0; round < p; round++) {
147
178
  lines.push(`// Problem unitary - round ${round + 1} (gamma=gamma_${round})`);
148
- for (let i = 0; i < n; i++) {
149
- for (let j = i + 1; j < n; j++) {
150
- const w = weightMatrix[i]?.[j] ?? 0;
151
- if (w !== 0) {
152
- lines.push(`// Edge (${i},${j}) weight=${w}: rzz(2.0*gamma_${round}*${w.toFixed(4)})`);
179
+ if (optimizationProblem === "qubo") {
180
+ for (let i = 0; i < n; i++) {
181
+ const qii = weightMatrix[i]?.[i] ?? 0;
182
+ if (qii !== 0) {
183
+ lines.push(`// QUBO linear x_${i} coefficient=${qii}`);
184
+ lines.push(`rz(-1.0 * gamma_${round} * ${qii.toFixed(4)}) q[${i}];`);
185
+ }
186
+ for (let j = i + 1; j < n; j++) {
187
+ const qij = weightMatrix[i]?.[j] ?? 0;
188
+ if (qij === 0) continue;
189
+ lines.push(`// QUBO pair x_${i}*x_${j} coefficient=${qij}`);
190
+ lines.push(`rz(-0.5 * gamma_${round} * ${qij.toFixed(4)}) q[${i}];`);
191
+ lines.push(`rz(-0.5 * gamma_${round} * ${qij.toFixed(4)}) q[${j}];`);
153
192
  lines.push(`cx q[${i}], q[${j}];`);
154
- lines.push(`rz(2.0 * gamma_${round} * ${w.toFixed(4)}) q[${j}];`);
193
+ lines.push(`rz(0.5 * gamma_${round} * ${qij.toFixed(4)}) q[${j}];`);
155
194
  lines.push(`cx q[${i}], q[${j}];`);
156
195
  }
157
196
  }
197
+ } else {
198
+ for (let i = 0; i < n; i++) {
199
+ for (let j = i + 1; j < n; j++) {
200
+ const w = weightMatrix[i]?.[j] ?? 0;
201
+ if (w !== 0) {
202
+ lines.push(`// Edge (${i},${j}) weight=${w}: rzz(2.0*gamma_${round}*${w.toFixed(4)})`);
203
+ lines.push(`cx q[${i}], q[${j}];`);
204
+ lines.push(`rz(2.0 * gamma_${round} * ${w.toFixed(4)}) q[${j}];`);
205
+ lines.push(`cx q[${i}], q[${j}];`);
206
+ }
207
+ }
208
+ }
158
209
  }
159
210
  lines.push(`// Mixer unitary - round ${round + 1} (beta=beta_${round})`);
160
211
  for (let i = 0; i < n; i++) {
@@ -163,8 +214,11 @@ function generateQAOACircuit(weightMatrix, p, initialGamma, initialBeta) {
163
214
  }
164
215
  lines.push("// Measurement");
165
216
  lines.push("c = measure q;");
166
- const edgeCount = weightMatrix.flat().filter((w) => w !== 0).length / 2;
167
- const estimatedDepth = 1 + p * (Math.ceil(edgeCount * 3) + 1) + 1;
217
+ const termCount = weightMatrix.reduce(
218
+ (count, row, i) => count + row.slice(optimizationProblem === "qubo" ? i : i + 1).filter((w) => w !== 0).length,
219
+ 0
220
+ );
221
+ const estimatedDepth = 1 + p * (Math.ceil(termCount * (optimizationProblem === "qubo" ? 5 : 3)) + 1) + 1;
168
222
  return { qasm: lines.join("\n"), numQubits: n, estimatedDepth, warnings, paramNames };
169
223
  }
170
224
  function generateStubCircuit() {
@@ -181,7 +235,7 @@ function generateStubCircuit() {
181
235
  return {
182
236
  qasm,
183
237
  warnings: [
184
- "No @quantumCircuit (or @quantum_circuit) trait found in the composition. A stub 1-qubit circuit has been emitted. Add a @quantumCircuit trait with `molecule` or `weightMatrix` params to generate a real circuit."
238
+ "No @quantumCircuit (or @quantum_circuit) trait found in the composition. A stub 1-qubit circuit has been emitted. Add a @quantum_circuit trait with `molecule`, `weightMatrix`, or `quboMatrix` params to generate a real circuit."
185
239
  ]
186
240
  };
187
241
  }
@@ -197,6 +251,7 @@ var QuantumCircuitCompiler = class extends CompilerBase {
197
251
  * `@quantumCircuit` or `@quantum_circuit` trait. Trait params drive the type:
198
252
  * - `molecule` (or `atoms`) - VQE hardware-efficient ansatz
199
253
  * - `weightMatrix` / `weight_matrix` / `adjacency` / `numNodes` - QAOA Max-Cut
254
+ * - `quboMatrix` / `qubo_matrix` - QAOA upper-triangular QUBO minimization
200
255
  * - none of the above - stub 1-qubit circuit with a warning
201
256
  *
202
257
  * @param composition - Parsed HoloScript AST
@@ -224,12 +279,20 @@ var QuantumCircuitCompiler = class extends CompilerBase {
224
279
  const cfg = trait.config;
225
280
  const atoms = extractAtoms(cfg);
226
281
  const weightMatrix = extractWeightMatrix(cfg);
282
+ const requestedProblem = extractString(
283
+ cfg,
284
+ "problemType",
285
+ "problem_type",
286
+ "optimizationProblem"
287
+ );
288
+ const hasExplicitQuboMatrix = cfg["quboMatrix"] !== void 0 || cfg["qubo_matrix"] !== void 0;
289
+ const optimizationProblem = requestedProblem?.toLowerCase() === "qubo" || hasExplicitQuboMatrix ? "qubo" : "maxcut";
227
290
  const numNodes = extractNumber(cfg, "numNodes") ?? extractNumber(cfg, "num_nodes");
228
291
  if (atoms && atoms.length > 0) {
229
292
  return this.buildVQEOutput(atoms, cfg);
230
293
  }
231
294
  if (weightMatrix) {
232
- return this.buildQAOAOutput(weightMatrix, cfg);
295
+ return this.buildQAOAOutput(weightMatrix, cfg, optimizationProblem);
233
296
  }
234
297
  if (numNodes !== void 0 && numNodes > 0) {
235
298
  const n = Math.min(Math.round(numNodes), 100);
@@ -237,11 +300,11 @@ var QuantumCircuitCompiler = class extends CompilerBase {
237
300
  { length: n },
238
301
  (_, i) => Array.from({ length: n }, (_2, j) => i !== j ? 1 : 0)
239
302
  );
240
- return this.buildQAOAOutput(matrix, cfg);
303
+ return this.buildQAOAOutput(matrix, cfg, "maxcut");
241
304
  }
242
305
  const { qasm, warnings } = generateStubCircuit();
243
306
  warnings.unshift(
244
- "@quantumCircuit trait found but neither `molecule`/`atoms` nor `weightMatrix`/`numNodes` params are present. Add params to generate a circuit."
307
+ "@quantumCircuit trait found but neither `molecule`/`atoms`, `weightMatrix`/`numNodes`, nor `quboMatrix` params are present. Add params to generate a circuit."
245
308
  );
246
309
  return {
247
310
  qasm,
@@ -276,12 +339,12 @@ var QuantumCircuitCompiler = class extends CompilerBase {
276
339
  }
277
340
  /** Build a {@link QASMOutput} for a VQE circuit. */
278
341
  buildVQEOutput(atoms, cfg) {
279
- const moleculeName = (extractNumber(cfg, "moleculeName") !== void 0 ? void 0 : cfg["moleculeName"]?.value) ?? atoms.map((a) => a.symbol).join("") ?? "molecule";
342
+ const moleculeName = extractString(cfg, "moleculeName", "molecule_name") ?? atoms.map((a) => a.symbol).join("") ?? "molecule";
280
343
  const ansatzLayers = Math.max(
281
344
  1,
282
345
  Math.round(extractNumber(cfg, "ansatzLayers") ?? extractNumber(cfg, "ansatz_layers") ?? 2)
283
346
  );
284
- const initialParams = cfg["initialParams"]?.value ?? cfg["initial_params"]?.value ?? void 0;
347
+ const initialParams = extractNumberArray(cfg, "initialParams", "initial_params");
285
348
  const { qasm, numQubits, estimatedDepth, warnings, paramNames } = generateVQECircuit(
286
349
  atoms,
287
350
  moleculeName,
@@ -301,13 +364,14 @@ var QuantumCircuitCompiler = class extends CompilerBase {
301
364
  };
302
365
  }
303
366
  /** Build a {@link QASMOutput} for a QAOA circuit. */
304
- buildQAOAOutput(weightMatrix, cfg) {
367
+ buildQAOAOutput(weightMatrix, cfg, optimizationProblem) {
305
368
  const p = Math.max(1, Math.round(extractNumber(cfg, "p") ?? 1));
306
369
  const initialGamma = extractNumber(cfg, "gamma") ?? extractNumber(cfg, "initial_gamma");
307
370
  const initialBeta = extractNumber(cfg, "beta") ?? extractNumber(cfg, "initial_beta");
308
371
  const { qasm, numQubits, estimatedDepth, warnings, paramNames } = generateQAOACircuit(
309
372
  weightMatrix,
310
373
  p,
374
+ optimizationProblem,
311
375
  initialGamma,
312
376
  initialBeta
313
377
  );
@@ -318,6 +382,7 @@ var QuantumCircuitCompiler = class extends CompilerBase {
318
382
  estimatedDepth,
319
383
  circuitType: "qaoa",
320
384
  weightMatrix,
385
+ optimizationProblem,
321
386
  recommendedBackend: numQubits <= 50 ? "aer" : "ibm-quantum",
322
387
  warnings,
323
388
  paramNames
@@ -326,5 +391,5 @@ var QuantumCircuitCompiler = class extends CompilerBase {
326
391
  };
327
392
 
328
393
  export { QuantumCircuitCompiler };
329
- //# sourceMappingURL=chunk-GI5YYZH6.js.map
330
- //# sourceMappingURL=chunk-GI5YYZH6.js.map
394
+ //# sourceMappingURL=chunk-E4YS5SIZ.js.map
395
+ //# sourceMappingURL=chunk-E4YS5SIZ.js.map
@@ -1,4 +1,4 @@
1
- import { init_AgentRBAC, init_CompilerBase, getRBAC, UnauthorizedCompilerAccessError } from './chunk-YDSNDCV3.js';
1
+ import { init_AgentRBAC, init_CompilerBase, getRBAC, UnauthorizedCompilerAccessError } from './chunk-QC3CAVFN.js';
2
2
  import { __export, __esm } from './chunk-W4GABFCR.js';
3
3
 
4
4
  // src/compiler/StateCompiler.ts
@@ -109,5 +109,5 @@ var init_StateCompiler = __esm({
109
109
  });
110
110
 
111
111
  export { StateCompiler, StateCompiler_exports, UnauthorizedStateCompilerAccessError, init_StateCompiler };
112
- //# sourceMappingURL=chunk-62OYZT6Q.js.map
113
- //# sourceMappingURL=chunk-62OYZT6Q.js.map
112
+ //# sourceMappingURL=chunk-EKNWUSGW.js.map
113
+ //# sourceMappingURL=chunk-EKNWUSGW.js.map
@@ -1,5 +1,5 @@
1
- import { init_DomainBlockCompilerMixin, compileDomainBlocks, inputToGodot, compileInputBlock, navigationToGodot, compileNavigationBlock, renderingToGodot, compileRenderingBlock, proceduralToGodot, compileProceduralBlock, web3ToGodot, compileWeb3Block, architectureToGodot, compileArchitectureBlock, musicToGodot, compileMusicBlock, educationToGodot, compileEducationBlock, datavizToGodot, compileDataVizBlock, iotToGodot, compileIoTBlock, compileRoboticsBlock, roboticsToGodot, compileHealthcareBlock, healthcareToGodot, compilePaymentBlock, paymentToGodot, compileNarrativeBlock, narrativeToGodot, compileWeatherBlock, weatherToGodot, compileAudioSourceBlock, audioSourceToGodot, compilePostProcessingBlock, postProcessingToGodot, compileParticleBlock, particlesToGodot, compilePhysicsBlock, physicsToGodot, compileMaterialBlock, materialToGodot } from './chunk-TZQKJOPC.js';
2
- import { init_CompilerBase, CompilerBase } from './chunk-YDSNDCV3.js';
1
+ import { init_DomainBlockCompilerMixin, compileDomainBlocks, inputToGodot, compileInputBlock, navigationToGodot, compileNavigationBlock, renderingToGodot, compileRenderingBlock, proceduralToGodot, compileProceduralBlock, web3ToGodot, compileWeb3Block, architectureToGodot, compileArchitectureBlock, musicToGodot, compileMusicBlock, educationToGodot, compileEducationBlock, datavizToGodot, compileDataVizBlock, iotToGodot, compileIoTBlock, compileRoboticsBlock, roboticsToGodot, compileHealthcareBlock, healthcareToGodot, compilePaymentBlock, paymentToGodot, compileNarrativeBlock, narrativeToGodot, compileWeatherBlock, weatherToGodot, compileAudioSourceBlock, audioSourceToGodot, compilePostProcessingBlock, postProcessingToGodot, compileParticleBlock, particlesToGodot, compilePhysicsBlock, physicsToGodot, compileMaterialBlock, materialToGodot } from './chunk-TW2AH2ZS.js';
2
+ import { init_CompilerBase, CompilerBase } from './chunk-QC3CAVFN.js';
3
3
  import { __esm, __export } from './chunk-W4GABFCR.js';
4
4
  import { ANSCapabilityPath } from '@holoscript/core-types/ans';
5
5
 
@@ -686,5 +686,5 @@ var init_GodotCompiler = __esm({
686
686
  });
687
687
 
688
688
  export { GodotCompiler, GodotCompiler_exports, init_GodotCompiler };
689
- //# sourceMappingURL=chunk-RVN7OPCP.js.map
690
- //# sourceMappingURL=chunk-RVN7OPCP.js.map
689
+ //# sourceMappingURL=chunk-ETIJOUIO.js.map
690
+ //# sourceMappingURL=chunk-ETIJOUIO.js.map