@poe-platform/safe-js 0.1.743 → 0.1.744

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 (101) hide show
  1. package/README.md +4 -3
  2. package/dist/safe-js/chunks/{chunk-F6CV74HU.js → chunk-3NFTBEZR.js} +2 -3
  3. package/dist/safe-js/chunks/{chunk-LMS5SSTN.js → chunk-5WP5IRMP.js} +437 -388
  4. package/dist/safe-js/chunks/{chunk-47JWFV2B.js → chunk-6UP3B5TB.js} +7 -8
  5. package/dist/safe-js/chunks/{chunk-24Z6PSCN.js → chunk-6ZVFR4HR.js} +1 -2
  6. package/dist/safe-js/chunks/{chunk-J3CUCOMP.js → chunk-AB6ERQE5.js} +14798 -14210
  7. package/dist/safe-js/chunks/{chunk-4YIDX44G.js → chunk-CQ52GEHY.js} +0 -1
  8. package/dist/safe-js/chunks/chunk-DHGJSEFX.js +0 -0
  9. package/dist/safe-js/chunks/{chunk-GVKXZW53.js → chunk-DIG26TEI.js} +0 -1
  10. package/dist/safe-js/chunks/{chunk-JCVARKWT.js → chunk-DIMBVKHT.js} +6 -7
  11. package/dist/safe-js/chunks/{chunk-UQPYTZOZ.js → chunk-JCHJGIQA.js} +0 -1
  12. package/dist/safe-js/chunks/{chunk-IRYOK5BR.js → chunk-L265M6OS.js} +2 -3
  13. package/dist/safe-js/chunks/{chunk-3ITVV2R6.js → chunk-L3MIVH3T.js} +1 -2
  14. package/dist/safe-js/chunks/{chunk-AUVGHYM5.js → chunk-LRINZRJA.js} +2 -3
  15. package/dist/safe-js/chunks/{chunk-UIUJHTWG.js → chunk-MKY3MQUB.js} +3 -4
  16. package/dist/safe-js/chunks/{chunk-YDVEVDVT.js → chunk-MLJ4BKDX.js} +102 -20
  17. package/dist/safe-js/chunks/{chunk-YUQFFRUF.js → chunk-MMN3IESA.js} +1 -2
  18. package/dist/safe-js/chunks/{chunk-WEGFNME4.js → chunk-O3S3JVWS.js} +1 -2
  19. package/dist/safe-js/chunks/{chunk-2GVBG23M.js → chunk-ONWFPHUI.js} +0 -1
  20. package/dist/safe-js/chunks/chunk-OQYVEDRN.js +66 -0
  21. package/dist/safe-js/chunks/{chunk-EMH7CXQM.js → chunk-POEMWNHD.js} +1 -2
  22. package/dist/safe-js/chunks/{chunk-G6WTEIJJ.js → chunk-X3YCE3ZH.js} +1 -2
  23. package/dist/safe-js/chunks/{chunk-WWETRQCF.js → chunk-YYF5R6ML.js} +3 -4
  24. package/dist/safe-js/chunks/{cli-runtime-3SOHLG5M.js → cli-runtime-BGB24HNE.js} +19 -20
  25. package/dist/safe-js/chunks/{dump-CSLHITIE.js → dump-M7CMVXW7.js} +5 -6
  26. package/dist/safe-js/chunks/harness-4CPQ7WKS.js +10 -0
  27. package/dist/safe-js/chunks/mcp-7SNWIP5H.js +11 -0
  28. package/dist/safe-js/chunks/migration-file-CPBVNMLD.js +14 -0
  29. package/dist/safe-js/chunks/restore-FLH6OC5F.js +13 -0
  30. package/dist/safe-js/chunks/run-KFAD7GTT.js +19 -0
  31. package/dist/safe-js/chunks/runtime-modules-D6NO4KJW.js +10 -0
  32. package/dist/safe-js/chunks/source-files-BSDM22Y2.js +9 -0
  33. package/dist/safe-js/cli.js +5 -6
  34. package/dist/safe-js/core.d.ts +1 -1
  35. package/dist/safe-js/core.js +14 -15
  36. package/dist/safe-js/extensions.d.ts +17 -0
  37. package/dist/safe-js/index.d.ts +2 -2
  38. package/dist/safe-js/index.js +22 -23
  39. package/dist/safe-js/interp/arguments.d.ts +2 -0
  40. package/dist/safe-js/interp/collection-properties.d.ts +2 -0
  41. package/dist/safe-js/interp/data-copy.d.ts +2 -0
  42. package/dist/safe-js/interp/host-bridge.d.ts +5 -0
  43. package/dist/safe-js/interp/host-capabilities.d.ts +5 -0
  44. package/dist/safe-js/interp/internal-symbols.d.ts +1 -0
  45. package/dist/safe-js/interp/interpreter.d.ts +3 -1
  46. package/dist/safe-js/interp/regex/compile-guard.d.ts +6 -4
  47. package/dist/safe-js/interp/template-cache.d.ts +5 -0
  48. package/dist/safe-js/interp/values.d.ts +11 -0
  49. package/dist/safe-js/modules/fs.d.ts +4 -3
  50. package/dist/safe-js/modules/fs.js +8 -9
  51. package/dist/safe-js/platform/context.d.ts +14 -0
  52. package/dist/safe-js/platform/node.d.ts +16 -0
  53. package/dist/safe-js/platform/types.d.ts +18 -0
  54. package/dist/safe-js/platform/workerd.d.ts +21 -0
  55. package/dist/safe-js/restore.d.ts +1 -1
  56. package/dist/safe-js/snapshot/validation.d.ts +2 -1
  57. package/package.json +5 -5
  58. package/dist/safe-js/chunks/chunk-24Z6PSCN.js.map +0 -7
  59. package/dist/safe-js/chunks/chunk-2GVBG23M.js.map +0 -7
  60. package/dist/safe-js/chunks/chunk-3ITVV2R6.js.map +0 -7
  61. package/dist/safe-js/chunks/chunk-47JWFV2B.js.map +0 -7
  62. package/dist/safe-js/chunks/chunk-4YIDX44G.js.map +0 -7
  63. package/dist/safe-js/chunks/chunk-AUVGHYM5.js.map +0 -7
  64. package/dist/safe-js/chunks/chunk-EMH7CXQM.js.map +0 -7
  65. package/dist/safe-js/chunks/chunk-F6CV74HU.js.map +0 -7
  66. package/dist/safe-js/chunks/chunk-G6WTEIJJ.js.map +0 -7
  67. package/dist/safe-js/chunks/chunk-GVKXZW53.js.map +0 -7
  68. package/dist/safe-js/chunks/chunk-IRYOK5BR.js.map +0 -7
  69. package/dist/safe-js/chunks/chunk-J3CUCOMP.js.map +0 -7
  70. package/dist/safe-js/chunks/chunk-JCVARKWT.js.map +0 -7
  71. package/dist/safe-js/chunks/chunk-LMS5SSTN.js.map +0 -7
  72. package/dist/safe-js/chunks/chunk-U7ZNMTSQ.js +0 -1
  73. package/dist/safe-js/chunks/chunk-U7ZNMTSQ.js.map +0 -7
  74. package/dist/safe-js/chunks/chunk-UIUJHTWG.js.map +0 -7
  75. package/dist/safe-js/chunks/chunk-UQPYTZOZ.js.map +0 -7
  76. package/dist/safe-js/chunks/chunk-V72WS373.js +0 -128
  77. package/dist/safe-js/chunks/chunk-V72WS373.js.map +0 -7
  78. package/dist/safe-js/chunks/chunk-WEGFNME4.js.map +0 -7
  79. package/dist/safe-js/chunks/chunk-WWETRQCF.js.map +0 -7
  80. package/dist/safe-js/chunks/chunk-YDVEVDVT.js.map +0 -7
  81. package/dist/safe-js/chunks/chunk-YUQFFRUF.js.map +0 -7
  82. package/dist/safe-js/chunks/cli-runtime-3SOHLG5M.js.map +0 -7
  83. package/dist/safe-js/chunks/dump-CSLHITIE.js.map +0 -7
  84. package/dist/safe-js/chunks/harness-QKPVLVOT.js +0 -11
  85. package/dist/safe-js/chunks/harness-QKPVLVOT.js.map +0 -7
  86. package/dist/safe-js/chunks/mcp-A4YKQCIS.js +0 -12
  87. package/dist/safe-js/chunks/mcp-A4YKQCIS.js.map +0 -7
  88. package/dist/safe-js/chunks/migration-file-QCZTVXEU.js +0 -15
  89. package/dist/safe-js/chunks/migration-file-QCZTVXEU.js.map +0 -7
  90. package/dist/safe-js/chunks/restore-22OGYS6N.js +0 -14
  91. package/dist/safe-js/chunks/restore-22OGYS6N.js.map +0 -7
  92. package/dist/safe-js/chunks/run-EMFOFJ22.js +0 -20
  93. package/dist/safe-js/chunks/run-EMFOFJ22.js.map +0 -7
  94. package/dist/safe-js/chunks/runtime-modules-QCVDLUVF.js +0 -11
  95. package/dist/safe-js/chunks/runtime-modules-QCVDLUVF.js.map +0 -7
  96. package/dist/safe-js/chunks/source-files-L3SGK63Z.js +0 -10
  97. package/dist/safe-js/chunks/source-files-L3SGK63Z.js.map +0 -7
  98. package/dist/safe-js/cli.js.map +0 -7
  99. package/dist/safe-js/core.js.map +0 -7
  100. package/dist/safe-js/index.js.map +0 -7
  101. package/dist/safe-js/modules/fs.js.map +0 -7
package/README.md CHANGED
@@ -332,6 +332,7 @@ Supply your own bounded `journal`; this does not add browser console behavior. W
332
332
  | `onCleanup(fn)` | Register a sync/async disposer. Cleanup runs in reverse order, awaits every disposer, and reports failures without skipping the rest. |
333
333
  | `chargeWork(units = 1)` | Charge a nonnegative integer against the shared execution budget. Fatal exhaustion cannot be swallowed to continue execution. |
334
334
  | `createHostObject({ properties?, methods?, indexed?, named?, expandos? })` | Create a realm-owned capability. Properties declare synchronous `get`/`set` functions; methods are host functions. Optional `indexed` and `named` expose bounded live members. Optional `expandos` stores guest fields with guest identity preserved. Undeclared members expose no native prototype. |
335
+ | `createHostConstructor(name, construct, { parent?, hasInstance?, constants? })` | Create an opaque guest reference to a native constructor. The synchronous callback must return a live host object from this realm; its identity and prototype are preserved even for subclasses. Optional `parent` is another native constructor reference; `constants` installs finite numeric constants on the function and prototype. A synchronous `hasInstance` predicate receives only live host objects and installs the prototype's name tag. Ordinary objects cannot forge this brand. The handle counts against `guestReferences` and can be released with `releaseGuestReference`; realm close revokes all operations. |
335
336
  | `createArrayBufferReference(buffer)` | Create an opaque live reference to a fixed, attached, plain ArrayBuffer without own metadata. Requires declared and granted `array-buffer:share`; full buffer bytes count against array/data budgets and `limits.guestReferences`. |
336
337
  | `invokeCallback(callback, { thisValue?, args? })` | Invoke a captured guest function with the realm's state, cancellation and budgets. Same operation as on the realm. |
337
338
  | `startCallback(callback, { thisValue?, args? })` | Return separate `synchronous` and `result` promises for the same realm-owned invocation. Also available on the realm. |
@@ -536,7 +537,7 @@ Factories return exports to register in `modules`; calling a factory alone does
536
537
  | --- | --- |
537
538
  | `makeAgentModule(spawnAgent, options?)` | Inject the agent runner. Options: `defaultRetry`, `onEvent`, `otelSink`. Exposes `spawn`, `spawn.retry`, and `spawn.parallel`; call options follow this table. |
538
539
  | `makeMcpModule(options)` | Required `servers` map: stdio `{ command, args?, cwd?, env? }` or HTTP `{ url, headers? }`. Options: `requestTimeoutMs` (30,000), `closeTimeoutMs` (1,000), `maxToolPages` (100), `signal`, and injected `fetch`/`spawn`. Named clients expose `tools`, `tool`, `toolBatch`, and `close`; close managed clients when finished. A custom connector function is also accepted. |
539
- | `makeFsModule(options?)` | Node-backed `{ root?, fs? }`, or shared-filesystem `{ adapter, root?, cwd?, signal? }`; do not combine `fs` and `adapter`. Pass safe-fs instances through `adapter`; supplying one as `fs` throws at construction. Named methods, default imports and `promises` imports expose the same asynchronous filesystem operations. Node access without `root` is unconfined. Rooted calls sharing the same adapter or Node implementation are serialized through path checks and backend completion to prevent guest namespace races. External host mutations or distinct adapters over the same storage require independent backend confinement. With an adapter, `root` confines access and `cwd` selects the virtual relative-path base; without `root`, explicit `cwd` also confines access. Omitting both uses virtual `/`. Adapter text reads pass a byte cap derived conservatively from the guest string and remaining data limits to the backend before decoding. Optional `readFileMaxBytes` and `hostReadMemoryLimit` default to `Infinity` and accept explicit `Infinity`. A finite host allowance reserves ten bytes per input byte for collection, copies, encoding expansion and admission across concurrent reads from that module; reservations release after the underlying read settles and decoding finishes, including when cancellation rejects the caller earlier. Native Node/injected `fs` implementations retain their own read behavior. Read text with `readFile(path, "utf8")`; see the [module methods](src/modules/fs.ts) and [filesystem package](../safe-fs/README.md). |
540
+ | `makeFsModule(options?)` | Node-backed `{ root?, fs? }`, or shared-filesystem `{ adapter, root?, cwd?, signal? }`; do not combine `fs` and `adapter`. Pass safe-fs instances through `adapter`; supplying one as `fs` throws at construction. Named methods, default imports and `promises` imports expose the same asynchronous filesystem operations, including `fs.promises.readFile(...)` on default imports and `promises.default.readFile(...)` on named imports. Node access without `root` is unconfined. Rooted calls sharing the same adapter or Node implementation are serialized through path checks and backend completion to prevent guest namespace races. External host mutations or distinct adapters over the same storage require independent backend confinement. With an adapter, `root` confines access and `cwd` selects the virtual relative-path base; without `root`, explicit `cwd` also confines access. Omitting both uses virtual `/`. Adapter text reads pass a byte cap derived conservatively from the guest string and remaining data limits to the backend before decoding. Optional `readFileMaxBytes` and `hostReadMemoryLimit` default to `Infinity` and accept explicit `Infinity`. A finite host allowance reserves ten bytes per input byte for collection, copies, encoding expansion and admission across concurrent reads from that module; reservations release after the underlying read settles and decoding finishes, including when cancellation rejects the caller earlier. Native Node/injected `fs` implementations retain their own read behavior. Read text with `readFile(path, "utf8")`; see the [module methods](src/modules/fs.ts) and [filesystem package](../safe-fs/README.md). |
540
541
  | `makeEnvModule(namesOrOptions)` | Allowed-name array or `{ allow, values? }`; exposes `get(name)`. `parseEnvConfig(json)` accepts the object form. |
541
542
  | `makeTimeModule(options?)` | `now`, `random`, `seed`, `signal`; exposes `now`, `random`, `sleep`, `uuid`. Defaults to host time/randomness; `seed` makes the random generator deterministic, and explicit `random` takes precedence. |
542
543
  | `makeLogModule(sink)` | Sends timestamped `info`, `error`, and `event` entries to your callback. |
@@ -562,8 +563,8 @@ drivers, adoption tokens, cleanup state and scope resource-state records out of
562
563
  guest data. Their field-specific internal links remain restorable; guest handler
563
564
  functions can still be retained by custom Promise constructors.
564
565
 
565
- - `dump(resultOrRunningPromise, { mode?, onFailure? })` returns checkpoint JSON. `mode` is `capture` or `replay`; `onFailure` is `throw` or `checkpoint`.
566
- - `restore(snapshot, { source })` validates state for compatible source; pass it as `run`'s `snapshot` option. It does not run the program.
566
+ - `dump(resultOrRunningPromise, { mode?, onFailure? })` returns checkpoint JSON. `mode` is `capture` or `replay`; `onFailure` is `throw` or `checkpoint`. Weak collection entries survive when their keys are reachable; weak references and finalization targets retain reachable aliases.
567
+ - `restore(snapshot, { source })` validates state for compatible source; pass it as `run`'s `snapshot` option. It does not run the program. Proxy callable and constructor flags are checked against their targets, including bound functions and dynamic function sources.
567
568
  - `new FileSnapshotBackend(path, { writeMaxAttempts?, writeRetryDelayMs? })` defaults to 3 write attempts and a 100 ms retry delay.
568
569
  - `createReplayableRandom({ seed?, snapshot? })` supplies `next`, `seed`, `snapshot`, and `restore` for reproducible random sequences. Unseeded generators use Web Crypto entropy; unseeded `makeTimeModule().uuid()` uses `globalThis.crypto.randomUUID()`.
569
570
  - `declareHostOperation(fn, policy, { onReplay?, awaitResult?, callbackScheduling? })` declares `re-issue` or `read-side-effect` recovery policy. `registerPendingHostCallPolicy({ moduleId, operation, policy })` registers it by name. Only mark operations re-issuable when repeating them is acceptable; a declaration does not implement deduplication or external recovery. With `awaitResult: true`, an asynchronous host operation completes before the guest call returns its copied value or throws its error, without exposing a guest Promise. This is an explicit host capability; the host event loop still runs, and cancellation, value budgets, and host-call recovery still apply. Use `callbackScheduling: "after-prefix"` for event-style APIs whose callbacks must wait for the current guest synchronous work to finish or explicitly await. Callbacks can then await other callbacks without blocking their admission. The default keeps inline callback behavior; `after-prefix` cannot be combined with `awaitResult: true`.
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  paths_default
3
- } from "./chunk-YUQFFRUF.js";
3
+ } from "./chunk-MMN3IESA.js";
4
4
  import {
5
5
  constants,
6
6
  hostFs
7
- } from "./chunk-UQPYTZOZ.js";
7
+ } from "./chunk-JCHJGIQA.js";
8
8
 
9
9
  // packages/safe-js/src/modules/source-files.ts
10
10
  import { resolvePath } from "@poe-platform/safe-fs/core";
@@ -111,4 +111,3 @@ async function openSourceFile(adapter, id, signal) {
111
111
  export {
112
112
  createRootedSourceResolver
113
113
  };
114
- //# sourceMappingURL=chunk-F6CV74HU.js.map