@remix_labs/machine-starter 2.2218.0-dev → 2.2222.0-dev

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/common.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { GROOVEBOX_BUILD } from "./groovebox_build.js";
2
- import { mixcoreFFINames } from "./mixcore-common.js";
2
+ import { filterFFINames } from "./mixcore-common.js";
3
3
  import { nanoid } from "nanoid";
4
4
 
5
5
  let workers = {};
@@ -73,14 +73,19 @@ async function StartWASM2(hub, config) {
73
73
  // injected by either index.js or node.js
74
74
  let worker = globalThis.GetMachineWASMWorker();
75
75
  workers[config.vmID] = worker;
76
+ let mixcore = null;
76
77
  let localFFIs = config.localFFIs || {};
77
78
  if (config.mixcore && config.mixcore.kind == 'mixcore') {
78
- let {mixcore, enableFFIs, disableFFIs} = config.mixcore;
79
- let ffiNames = await mixcoreFFINames(mixcore, enableFFIs, disableFFIs);
80
- console.log("Mixcore FFIs (local)", ffiNames);
81
- let mixcoreFFIs = mixcoreLocalFFIs(mixcore, ffiNames);
82
- localFFIs = {...localFFIs, ...mixcoreFFIs};
83
- config.mixcore = null;
79
+ let enableFFIs, disableFFIs;
80
+ ({mixcore, enableFFIs, disableFFIs} = config.mixcore);
81
+ let ffiNames = filterFFINames(await mixcore.ffiNames(), enableFFIs, disableFFIs);
82
+ console.log("Mixcore (starter)", mixcore, ffiNames, mixcore.registerDebugObject);
83
+ localFFIs = {...localFFIs, ...mixcoreLocalFFIs(mixcore, ffiNames)};
84
+ config.mixcore = {};
85
+ if (mixcore.registerDebugObject) {
86
+ config.mixcore.publishDebugObjects = true;
87
+ subscribeDebugObjects(mixcore, hub, config);
88
+ }
84
89
  }
85
90
  let localFFIkind = {};
86
91
  let localFFIfuns = {};
@@ -300,6 +305,19 @@ async function setupLocalFFIs(hub, config, localFFIs) {
300
305
  }
301
306
  }
302
307
 
308
+ async function subscribeDebugObjects(mixcore, hub, config) {
309
+ let channel = await hub.newChannel();
310
+ let vmID = config.vmID;
311
+ await channel.setLocalSubTopic(`/debug-objects/${vmID}`);
312
+ let sub = await channel.subscribe(`/debug-objects/${vmID}`);
313
+ while (true) {
314
+ let msg = await sub.next();
315
+ let id = msg.payload.id;
316
+ let code = msg.payload.code;
317
+ mixcore.registerDebugObject(id, code);
318
+ }
319
+ }
320
+
303
321
  class FFIComm {
304
322
  constructor(vmID, hub, channel) {
305
323
  this.vmID = vmID;
@@ -1,2 +1,2 @@
1
- var GROOVEBOX_BUILD = "2395";
1
+ var GROOVEBOX_BUILD = "2399";
2
2
  export { GROOVEBOX_BUILD }