@remix_labs/machine-starter 2.2194.0-dev → 2.2198.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.
@@ -0,0 +1,38 @@
1
+
2
+ const CORE_FFI_NAMES = [
3
+ "$destroyHook",
4
+ "$hideHook",
5
+ "$isSyncEnabled",
6
+ "$loadHook",
7
+ "$flush",
8
+ "$mqtt_available",
9
+ "$showHook",
10
+ "$mqtt_enabled",
11
+ "$log",
12
+ "get_env",
13
+ "$outputError",
14
+ "$outputWithVersion",
15
+ "$co_sleep",
16
+ "$decodeError",
17
+ ];
18
+
19
+ function ffiNameMatches(name, pattern) {
20
+ if (pattern == "CORE") {
21
+ return CORE_FFI_NAMES.includes(name);
22
+ }
23
+ if (pattern.slice(-1) === '*') {
24
+ return name.startsWith(pattern.slice(0, -1));
25
+ }
26
+ return name === pattern;
27
+ }
28
+
29
+ async function mixcoreFFIs(mixcore, enable, disable) {
30
+ let names = await mixcore.ffiNames();
31
+ if (enable !== undefined) {
32
+ names = names.filter(name => enable.some(pat => ffiNameMatches(name, pat)));
33
+ }
34
+ disable = disable ?? [...CORE_FFI_NAMES, "$http_do"];
35
+ return names.filter(name => !disable.some(pat => ffiNameMatches(name, pat)));
36
+ }
37
+
38
+ export { mixcoreFFIs }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix_labs/machine-starter",
3
- "version": "2.2194.0-dev",
3
+ "version": "2.2198.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.2194.0-dev",
14
+ "@remix_labs/hub-client": "2.2198.0-dev",
15
15
  "nanoid": "^5.0.2",
16
16
  "web-worker": "^1.2.0"
17
17
  },
package/start.js CHANGED
@@ -1,6 +1,17 @@
1
1
  import Process from "process";
2
2
  import { StartWASM2, Hub } from "./node.js";
3
3
  import { StartMixCompiler, WaitForMixCompiler } from "@remix_labs/mixc-starter";
4
+ import { MiniWASI } from "@remix_labs/hub-client/miniwasi.js";
5
+ import { MixcoreWasm, MixcoreWasmApi } from './mixcore-main.js';
6
+ import { mixcoreWasmCode } from './mixcore_mini-main.js';
7
+ function importCode(base64) {
8
+ let binstr = atob(base64);
9
+ let code = new Uint8Array(binstr.length);
10
+ for (let i = 0; i < binstr.length; i++)
11
+ code[i] = binstr.charCodeAt(i);
12
+ return code;
13
+ }
14
+ let mixcoreWasm = importCode(mixcoreWasmCode);
4
15
 
5
16
  if (Process.stdout._handle)
6
17
  Process.stdout._handle.setBlocking(true);
@@ -33,6 +44,9 @@ let with_mixc = !!(Process.env["MIXC_ENABLE"]);
33
44
  console.log("Machine params: variant=" + variant + " baseURL=" + baseURL, " mqttURL=" + mqttURL, " mqttUser=" + mqttUser, " mqttToken=" + mqttToken, " id=" + id, " noOutputViaMQTT=" + noOutputViaMQTT, " withMixc=" + with_mixc);
34
45
  let protoquery = Process.env["PROTOQUERY_ROOT"] || "";
35
46
  let wasm_base = Process.env["MIX_WASM_BASE"] || "file://" + protoquery + "/wasm-build/artifacts/lib/wasm32-unknown-unknown";
47
+ let mixcoreWasmApi = new MixcoreWasmApi.create(mixcoreWasm, new MiniWasi());
48
+ let mixcore = MixcoreWasm.create(null, null, null, mixcoreWasm, mixcoreWasmApi);
49
+ let mixcoreConfig = { kind: "mixcore", mixcore, enableFFIs: ["$decodeError"] };
36
50
  let w = new Hub.Worker();
37
51
  globalThis.GROOVEBOX_ALLOW_INSECURE_HTTP = true;
38
52
  w.configure({wsURL: mqttURL, user:mqttUser, token:mqttToken}).then(resp => {
@@ -53,6 +67,7 @@ w.configure({wsURL: mqttURL, user:mqttUser, token:mqttToken}).then(resp => {
53
67
  noOutputViaMQTT: noOutputViaMQTT,
54
68
  machType: variant,
55
69
  localFFIs: {},
70
+ mixcore: mixcoreConfig,
56
71
  });
57
72
  });
58
73
  if (with_mixc) {