@hew-lang/sandbox-vm 0.6.2 → 0.6.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.
Files changed (40) hide show
  1. package/README.md +43 -4
  2. package/cli/test-runner.mjs +4 -1
  3. package/dist/interpreter/interpreter.d.ts +1 -1
  4. package/dist/interpreter/interpreter.js +1 -1
  5. package/dist/interpreter/parity-runner.js +26 -1
  6. package/dist/interpreter/run-program.d.ts +3 -2
  7. package/dist/interpreter/run-program.js +5 -3
  8. package/dist/interpreter/schema-validator.d.ts +9 -4
  9. package/dist/interpreter/schema-validator.js +15 -49
  10. package/dist/interpreter/types.d.ts +4 -0
  11. package/dist/interpreter/v1/browser-directory.d.ts +107 -0
  12. package/dist/interpreter/v1/browser-directory.js +288 -0
  13. package/dist/interpreter/v1/calendar.d.ts +4 -0
  14. package/dist/interpreter/v1/calendar.js +64 -0
  15. package/dist/interpreter/v1/codecs.js +2 -2
  16. package/dist/interpreter/v1/exec.d.ts +2 -2
  17. package/dist/interpreter/v1/exec.js +439 -183
  18. package/dist/interpreter/v1/instructions.generated.d.ts +1135 -0
  19. package/dist/interpreter/v1/instructions.generated.js +106 -0
  20. package/dist/interpreter/v1/package-graph.d.ts +2 -0
  21. package/dist/interpreter/v1/package-graph.js +729 -0
  22. package/dist/interpreter/v1/package-validator.generated.d.ts +3 -0
  23. package/dist/interpreter/v1/package-validator.generated.js +75846 -0
  24. package/dist/interpreter/v1/package.d.ts +5 -680
  25. package/dist/interpreter/v1/package.js +0 -12
  26. package/dist/interpreter/v1/scheduler.d.ts +5 -1
  27. package/dist/interpreter/v1/scheduler.js +32 -3
  28. package/dist/interpreter/v1/shims.d.ts +250 -7
  29. package/dist/interpreter/v1/shims.js +429 -150
  30. package/dist/interpreter/v1/structural.d.ts +2 -28
  31. package/dist/interpreter/v1/timestamp.d.ts +7 -0
  32. package/dist/interpreter/v1/timestamp.js +54 -0
  33. package/dist/interpreter/v1/validate.d.ts +8 -2
  34. package/dist/interpreter/v1/validate.js +190 -202
  35. package/dist/interpreter/v1/value-operations.d.ts +7 -2
  36. package/dist/interpreter/v1/value-operations.js +13 -6
  37. package/dist/interpreter/values.d.ts +4 -0
  38. package/dist/interpreter/values.js +6 -0
  39. package/dist/interpreter/worker.js +4 -3
  40. package/package.json +4 -4
@@ -29,6 +29,8 @@ export function cloneValue(value) {
29
29
  throw new Error("cannot copy a released Weak");
30
30
  value.cell.weak += 1;
31
31
  return { kind: "weak", cell: value.cell, closed: false };
32
+ case "host_resource":
33
+ throw new Error("a filesystem owner cannot be copied");
32
34
  case "timer":
33
35
  throw new Error("a timer cancellation handle cannot be copied");
34
36
  case "unit":
@@ -204,6 +206,8 @@ export function renderF64(value) {
204
206
  }
205
207
  export function renderStdout(value) {
206
208
  switch (value.kind) {
209
+ case "host_resource":
210
+ return "FilesystemOwner";
207
211
  case "timer":
208
212
  return "Timer";
209
213
  case "unit":
@@ -261,6 +265,8 @@ export function renderStdout(value) {
261
265
  }
262
266
  export function toJsonValue(value) {
263
267
  switch (value.kind) {
268
+ case "host_resource":
269
+ return "FilesystemOwner";
264
270
  case "timer":
265
271
  return "Timer";
266
272
  case "unit":
@@ -3,18 +3,19 @@ import { buildPlaygroundState } from "./playground.js";
3
3
  import { runProgram } from "./run-program.js";
4
4
  import { BytecodeValidationError } from "./schema-validator.js";
5
5
  const worker = globalThis;
6
- worker.addEventListener("message", (event) => {
6
+ worker.addEventListener("message", async (event) => {
7
7
  const { id } = event.data;
8
8
  try {
9
9
  if (event.data.kind === "run") {
10
- const result = runProgram(event.data.source, event.data.stdin);
10
+ const result = await runProgram(event.data.source, event.data.stdin, undefined, event.data.options);
11
11
  worker.postMessage({ id, ok: true, result });
12
12
  return;
13
13
  }
14
14
  const { bytecode, options } = event.data;
15
- const trace = runBytecode(bytecode, {
15
+ const trace = await runBytecode(bytecode, {
16
16
  ...options,
17
17
  codecBridge: globalThis.__hewSandboxExecuteCodec,
18
+ calendarBridge: globalThis.__hewSandboxExecuteCalendar,
18
19
  });
19
20
  worker.postMessage({
20
21
  id,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@hew-lang/sandbox-vm",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "hewSource": {
5
- "commit": "dd0911184af12136eda7e89052e5b564d56ba643",
6
- "tag": "v0.6.2",
5
+ "commit": "e12d61fa5956986e7a92d4aa7a900462f8f536da",
6
+ "tag": "v0.6.4",
7
7
  "dirty": false
8
8
  },
9
9
  "description": "Deterministic TypeScript interpreter for the Hew educational sandbox",
@@ -21,7 +21,7 @@
21
21
  "cli/"
22
22
  ],
23
23
  "dependencies": {
24
- "@hew-lang/wasm": "0.6.2"
24
+ "@hew-lang/wasm": "0.6.4"
25
25
  },
26
26
  "keywords": [
27
27
  "hew",