@remix_labs/machine-starter 2.3205.0-dev → 2.3209.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 +22 -5
- package/groovebox_build.js +1 -1
- package/node.js +4 -0
- package/package.json +2 -2
- package/webpack.config.js +4 -0
package/common.js
CHANGED
|
@@ -99,6 +99,8 @@ globalThis.MixSetMask = (m => {
|
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
+
const DEBUG_STATE = 4;
|
|
103
|
+
|
|
102
104
|
function StartWASM(hub, baseURL, org, workspace, vmID, user, token, noOutputViaMQTT) {
|
|
103
105
|
return StartWASM2(hub, {
|
|
104
106
|
baseURL: baseURL,
|
|
@@ -357,10 +359,12 @@ async function localFFIsMessageLoop(hub, config, localFFIs, terminate) {
|
|
|
357
359
|
return;
|
|
358
360
|
}
|
|
359
361
|
let name = msg.payload.name;
|
|
360
|
-
let call_id = msg.payload.
|
|
362
|
+
let call_id = msg.payload.callID;
|
|
361
363
|
let args = decode(msg.payload.args);
|
|
362
364
|
let fun = localFFIs[name];
|
|
363
|
-
|
|
365
|
+
if (initialMask & DEBUG_STATE) {
|
|
366
|
+
console.debug("[groovebox-starter] local FFI call", vmID, call_id, name);
|
|
367
|
+
};
|
|
364
368
|
try {
|
|
365
369
|
if (!fun) throw new Error("No such local FFI in groovebox starter: " + name);
|
|
366
370
|
let connector =
|
|
@@ -373,13 +377,26 @@ async function localFFIsMessageLoop(hub, config, localFFIs, terminate) {
|
|
|
373
377
|
let r = fun instanceof Function ? fun(connector, args) : fun.run(connector, args);
|
|
374
378
|
if (r instanceof Promise) {
|
|
375
379
|
// r.catch(_ => null); // prevent "unhandled rejection"
|
|
380
|
+
if (initialMask & DEBUG_STATE) {
|
|
381
|
+
console.debug("[groovebox-starter] running FFI call asynchronously", vmID, call_id, name);
|
|
382
|
+
}
|
|
376
383
|
await comm.later(call_id);
|
|
377
384
|
let value = await r;
|
|
385
|
+
if (initialMask & DEBUG_STATE) {
|
|
386
|
+
console.debug("[groovebox-starter] async FFI call returned", vmID, call_id, name);
|
|
387
|
+
};
|
|
378
388
|
await comm.returnOrFail(fun, call_id, value);
|
|
379
389
|
} else {
|
|
390
|
+
if (initialMask & DEBUG_STATE) {
|
|
391
|
+
console.debug("[groovebox-starter] sync FFI call returned", vmID, call_id, name);
|
|
392
|
+
};
|
|
380
393
|
await comm.returnOrFail(fun, call_id, r);
|
|
381
394
|
}
|
|
382
395
|
} catch (reason) {
|
|
396
|
+
if (initialMask & DEBUG_STATE) {
|
|
397
|
+
console.debug("[groovebox-starter] FFI call exception", vmID, call_id, name);
|
|
398
|
+
console.debug("[groovebox-starter] exception", reason);
|
|
399
|
+
};
|
|
383
400
|
await comm.error(call_id, reason.message, reason.stack);
|
|
384
401
|
}
|
|
385
402
|
}
|
|
@@ -422,14 +439,14 @@ class FFIComm {
|
|
|
422
439
|
}
|
|
423
440
|
later(call_id) {
|
|
424
441
|
let r_payload =
|
|
425
|
-
{
|
|
442
|
+
{ callID: call_id,
|
|
426
443
|
};
|
|
427
444
|
let response = this.hub.newLocalMessage("msg_ffi_later", "starter", r_payload);
|
|
428
445
|
return this.channel.publish("/local/" + this.vmID + "/ffi/return", response, false);
|
|
429
446
|
}
|
|
430
447
|
return_(fun, call_id, result) {
|
|
431
448
|
let r_payload =
|
|
432
|
-
{
|
|
449
|
+
{ callID: call_id,
|
|
433
450
|
value: fun.useJsonDecoder ? result : encode(result)
|
|
434
451
|
};
|
|
435
452
|
let response = this.hub.newLocalMessage("msg_ffi_return", "starter", r_payload);
|
|
@@ -437,7 +454,7 @@ class FFIComm {
|
|
|
437
454
|
}
|
|
438
455
|
error(call_id, message, stack) {
|
|
439
456
|
let r_payload =
|
|
440
|
-
{
|
|
457
|
+
{ callID: call_id,
|
|
441
458
|
message: message,
|
|
442
459
|
stack: stack === undefined ? [] : stack,
|
|
443
460
|
};
|
package/groovebox_build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var GROOVEBOX_BUILD = "
|
|
1
|
+
var GROOVEBOX_BUILD = "3209";
|
|
2
2
|
export { GROOVEBOX_BUILD }
|
package/node.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import Process from "process";
|
|
2
|
+
import Console from "console"
|
|
2
3
|
globalThis.Process = Process;
|
|
4
|
+
globalThis.console = new Console.Console({stdout: process.stderr, stderr: process.stderr });
|
|
5
|
+
// redirect stdout to stderr to avoid that log messages appear in the wrong
|
|
6
|
+
// order
|
|
3
7
|
|
|
4
8
|
// NB: The only way I've made this work in node+webpack is if:
|
|
5
9
|
//
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix_labs/machine-starter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3209.0-dev",
|
|
4
4
|
"description": "start the groove",
|
|
5
5
|
"main": "node.js",
|
|
6
6
|
"browser": "index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"author": "Remixlabs staff",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@remix_labs/hub-client": "2.
|
|
14
|
+
"@remix_labs/hub-client": "2.3209.0-dev",
|
|
15
15
|
"nanoid": "^5.0.2",
|
|
16
16
|
"web-worker": "^1.2.0"
|
|
17
17
|
},
|
package/webpack.config.js
CHANGED