@effect-uai/core 0.5.2 → 0.6.0

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 (123) hide show
  1. package/README.md +1 -1
  2. package/dist/{Items-BH8xUkoR.d.mts → Items-pXR5BAgW.d.mts} +12 -12
  3. package/dist/Items-pXR5BAgW.d.mts.map +1 -0
  4. package/dist/SandboxError-BvKypkJm.d.mts +158 -0
  5. package/dist/SandboxError-BvKypkJm.d.mts.map +1 -0
  6. package/dist/{Tool-87ViKCCO.d.mts → Tool-DP-AwKOf.d.mts} +11 -11
  7. package/dist/{Tool-87ViKCCO.d.mts.map → Tool-DP-AwKOf.d.mts.map} +1 -1
  8. package/dist/domain/Items.d.mts +2 -2
  9. package/dist/domain/Items.mjs +15 -15
  10. package/dist/domain/Items.mjs.map +1 -1
  11. package/dist/domain/Turn.d.mts +388 -2
  12. package/dist/domain/Turn.d.mts.map +1 -0
  13. package/dist/domain/Turn.mjs +13 -13
  14. package/dist/domain/Turn.mjs.map +1 -1
  15. package/dist/index.d.mts +11 -6
  16. package/dist/index.mjs +8 -3
  17. package/dist/language-model/LanguageModel.d.mts +5 -5
  18. package/dist/language-model/LanguageModel.d.mts.map +1 -1
  19. package/dist/language-model/LanguageModel.mjs.map +1 -1
  20. package/dist/loop/Loop.d.mts +37 -90
  21. package/dist/loop/Loop.d.mts.map +1 -1
  22. package/dist/loop/Loop.mjs +39 -93
  23. package/dist/loop/Loop.mjs.map +1 -1
  24. package/dist/loop/Loop.test.mjs +46 -54
  25. package/dist/loop/Loop.test.mjs.map +1 -1
  26. package/dist/sandbox/Memory.d.mts +53 -0
  27. package/dist/sandbox/Memory.d.mts.map +1 -0
  28. package/dist/sandbox/Memory.mjs +68 -0
  29. package/dist/sandbox/Memory.mjs.map +1 -0
  30. package/dist/sandbox/Sandbox.d.mts +717 -0
  31. package/dist/sandbox/Sandbox.d.mts.map +1 -0
  32. package/dist/sandbox/Sandbox.mjs +192 -0
  33. package/dist/sandbox/Sandbox.mjs.map +1 -0
  34. package/dist/sandbox/SandboxError.d.mts +2 -0
  35. package/dist/sandbox/SandboxError.mjs +89 -0
  36. package/dist/sandbox/SandboxError.mjs.map +1 -0
  37. package/dist/sandbox/SandboxImage.d.mts +28 -0
  38. package/dist/sandbox/SandboxImage.d.mts.map +1 -0
  39. package/dist/sandbox/SandboxImage.mjs +32 -0
  40. package/dist/sandbox/SandboxImage.mjs.map +1 -0
  41. package/dist/sandbox/SandboxNetwork.d.mts +34 -0
  42. package/dist/sandbox/SandboxNetwork.d.mts.map +1 -0
  43. package/dist/sandbox/SandboxNetwork.mjs +36 -0
  44. package/dist/sandbox/SandboxNetwork.mjs.map +1 -0
  45. package/dist/speech-synthesizer/SpeechSynthesizer.d.mts +98 -2
  46. package/dist/speech-synthesizer/SpeechSynthesizer.d.mts.map +1 -1
  47. package/dist/speech-synthesizer/SpeechSynthesizer.mjs +32 -2
  48. package/dist/speech-synthesizer/SpeechSynthesizer.mjs.map +1 -1
  49. package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs +56 -2
  50. package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs.map +1 -1
  51. package/dist/testing/MockProvider.d.mts +3 -3
  52. package/dist/testing/MockProvider.d.mts.map +1 -1
  53. package/dist/testing/MockProvider.mjs.map +1 -1
  54. package/dist/testing/MockSandbox.d.mts +604 -0
  55. package/dist/testing/MockSandbox.d.mts.map +1 -0
  56. package/dist/testing/MockSandbox.mjs +160 -0
  57. package/dist/testing/MockSandbox.mjs.map +1 -0
  58. package/dist/testing/MockSpeechSynthesizer.d.mts +26 -11
  59. package/dist/testing/MockSpeechSynthesizer.d.mts.map +1 -1
  60. package/dist/testing/MockSpeechSynthesizer.mjs +75 -51
  61. package/dist/testing/MockSpeechSynthesizer.mjs.map +1 -1
  62. package/dist/tool/{Resolvers.d.mts → Approval.d.mts} +27 -27
  63. package/dist/tool/Approval.d.mts.map +1 -0
  64. package/dist/tool/{Resolvers.mjs → Approval.mjs} +18 -18
  65. package/dist/tool/Approval.mjs.map +1 -0
  66. package/dist/tool/{Resolvers.test.mjs → Approval.test.mjs} +40 -40
  67. package/dist/tool/Approval.test.mjs.map +1 -0
  68. package/dist/tool/HistoryCheck.d.mts +6 -6
  69. package/dist/tool/HistoryCheck.d.mts.map +1 -1
  70. package/dist/tool/HistoryCheck.mjs +5 -5
  71. package/dist/tool/HistoryCheck.mjs.map +1 -1
  72. package/dist/tool/Tool.d.mts +2 -2
  73. package/dist/tool/Tool.mjs +4 -4
  74. package/dist/tool/Tool.mjs.map +1 -1
  75. package/dist/tool/ToolEvent.d.mts +19 -19
  76. package/dist/tool/ToolEvent.d.mts.map +1 -1
  77. package/dist/tool/ToolEvent.mjs +8 -8
  78. package/dist/tool/ToolEvent.mjs.map +1 -1
  79. package/dist/tool/{Outcome.d.mts → ToolResult.d.mts} +29 -29
  80. package/dist/tool/ToolResult.d.mts.map +1 -0
  81. package/dist/tool/ToolResult.mjs +61 -0
  82. package/dist/tool/ToolResult.mjs.map +1 -0
  83. package/dist/tool/Toolkit.d.mts +58 -26
  84. package/dist/tool/Toolkit.d.mts.map +1 -1
  85. package/dist/tool/Toolkit.mjs +62 -34
  86. package/dist/tool/Toolkit.mjs.map +1 -1
  87. package/dist/tool/Toolkit.test.mjs +13 -13
  88. package/dist/tool/Toolkit.test.mjs.map +1 -1
  89. package/package.json +31 -7
  90. package/src/domain/Items.ts +9 -9
  91. package/src/domain/Turn.ts +16 -16
  92. package/src/index.ts +7 -2
  93. package/src/language-model/LanguageModel.ts +3 -3
  94. package/src/loop/Loop.test.ts +93 -91
  95. package/src/loop/Loop.ts +72 -170
  96. package/src/sandbox/Memory.ts +128 -0
  97. package/src/sandbox/Sandbox.ts +639 -0
  98. package/src/sandbox/SandboxError.ts +140 -0
  99. package/src/sandbox/SandboxImage.ts +26 -0
  100. package/src/sandbox/SandboxNetwork.ts +34 -0
  101. package/src/speech-synthesizer/SpeechSynthesizer.test.ts +89 -0
  102. package/src/speech-synthesizer/SpeechSynthesizer.ts +124 -0
  103. package/src/testing/MockProvider.ts +21 -20
  104. package/src/testing/MockSandbox.ts +342 -0
  105. package/src/testing/MockSpeechSynthesizer.ts +137 -77
  106. package/src/tool/{Resolvers.test.ts → Approval.test.ts} +45 -54
  107. package/src/tool/{Resolvers.ts → Approval.ts} +25 -25
  108. package/src/tool/HistoryCheck.ts +10 -13
  109. package/src/tool/Tool.ts +13 -15
  110. package/src/tool/ToolEvent.ts +7 -7
  111. package/src/tool/{Outcome.ts → ToolResult.ts} +20 -20
  112. package/src/tool/Toolkit.test.ts +13 -13
  113. package/src/tool/Toolkit.ts +97 -73
  114. package/dist/Items-BH8xUkoR.d.mts.map +0 -1
  115. package/dist/Turn-0CwCAyVe.d.mts +0 -388
  116. package/dist/Turn-0CwCAyVe.d.mts.map +0 -1
  117. package/dist/tool/Outcome.d.mts.map +0 -1
  118. package/dist/tool/Outcome.mjs +0 -61
  119. package/dist/tool/Outcome.mjs.map +0 -1
  120. package/dist/tool/Resolvers.d.mts.map +0 -1
  121. package/dist/tool/Resolvers.mjs.map +0 -1
  122. package/dist/tool/Resolvers.test.mjs.map +0 -1
  123. /package/dist/tool/{Resolvers.test.d.mts → Approval.test.d.mts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sandbox.d.mts","names":[],"sources":["../../src/sandbox/Sandbox.ts"],"mappings":";;;;;;;;;;;;;;;;;KAgBY,SAAA,GAAY,KAAA,CAAM,OAAA;AAAA,cACjB,SAAA,EAAS,KAAA,CAAA,WAAA,CAAA,SAAA;;;;;;KAOV,UAAA;EAAA,SACD,EAAA,EAAI,SAAA;EAAA,SACJ,IAAA;AAAA;AAAA,KAGC,QAAA,GAAW,KAAA,CAAM,OAAA;AAAA,cAChB,QAAA,EAAQ,KAAA,CAAA,WAAA,CAAA,QAAA;AAAA,KAET,UAAA,GAAa,KAAA,CAAM,OAAA;AAAA,cAClB,UAAA,EAAU,KAAA,CAAA,WAAA,CAA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,GAAU,gBAAA;;;AA1UlE;cAoVa,YAAA,GACX,IAAA,UACA,OAAA;EAAA,SAAqB,UAAA;AAAA,MACpB,MAAA,CAAO,MAAA,CAAO,QAAA,EAAU,YAAA,EAA2B,OAAA,GAAU,cAAA;;cAQnD,aAAA,GACX,EAAA,EAAI,QAAA,KACH,MAAA,CAAO,MAAA,OAAa,YAAA,EAA2B,OAAA,GAAU,cAAA;;cAQ/C,WAAA,EAAa,MAAA,CAAO,MAAA,CAC/B,aAAA;EAAA,SAAyB,EAAA,EAAI,QAAA;EAAA,SAAmB,IAAA;AAAA,IAChD,YAAA,EACA,OAAA,GAAU,cAAA;;cAQC,eAAA,GACX,EAAA,EAAI,UAAA,KACH,MAAA,CAAO,MAAA,OAAa,YAAA,EAA2B,OAAA,GAAU,gBAAA;;cAQ/C,aAAA,EAAe,MAAA,CAAO,MAAA,CACjC,aAAA;EAAA,SAAyB,EAAA,EAAI,UAAA;EAAA,SAAqB,IAAA;AAAA,IAClD,YAAA,EACA,OAAA,GAAU,gBAAA;;;;;;;;cAcC,UAAA,GACX,QAAA,EAAU,eAAA,EACV,IAAA,aACC,MAAA,CAAO,MAAA;EAAA,SACG,GAAA;AAAA,GACX,YAAA,EACA,OAAA,GAAU,mBAAA"}
@@ -0,0 +1,192 @@
1
+ import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
2
+ import { Brand, Context, Data, Effect } from "effect";
3
+ //#region src/sandbox/Sandbox.ts
4
+ var Sandbox_exports = /* @__PURE__ */ __exportAll({
5
+ ExecEvent: () => ExecEvent,
6
+ ImageRef: () => ImageRef,
7
+ NetworkPolicy: () => NetworkPolicy,
8
+ Sandbox: () => Sandbox,
9
+ SandboxCustomImage: () => SandboxCustomImage,
10
+ SandboxHostnameAllowlist: () => SandboxHostnameAllowlist,
11
+ SandboxId: () => SandboxId,
12
+ SandboxKernelSession: () => SandboxKernelSession,
13
+ SandboxPauseResume: () => SandboxPauseResume,
14
+ SandboxPortExposure: () => SandboxPortExposure,
15
+ SandboxPty: () => SandboxPty,
16
+ SandboxSecretInjection: () => SandboxSecretInjection,
17
+ SandboxSnapshots: () => SandboxSnapshots,
18
+ SandboxVolumes: () => SandboxVolumes,
19
+ SnapshotId: () => SnapshotId,
20
+ VolumeId: () => VolumeId,
21
+ attach: () => attach,
22
+ create: () => create,
23
+ createVolume: () => createVolume,
24
+ destroy: () => destroy,
25
+ destroySnapshot: () => destroySnapshot,
26
+ destroyVolume: () => destroyVolume,
27
+ exposePort: () => exposePort,
28
+ list: () => list,
29
+ listSnapshots: () => listSnapshots,
30
+ listVolumes: () => listVolumes,
31
+ snapshot: () => snapshot
32
+ });
33
+ const SandboxId = Brand.nominal();
34
+ const VolumeId = Brand.nominal();
35
+ const SnapshotId = Brand.nominal();
36
+ const ImageRef = Data.taggedEnum();
37
+ const NetworkPolicy = Data.taggedEnum();
38
+ const ExecEvent = Data.taggedEnum();
39
+ var Sandbox = class extends Context.Service()("@betalyra/effect-uai/Sandbox") {};
40
+ /**
41
+ * Capability marker — provided by adapter Layers whose provider
42
+ * supports a hostname-level egress allowlist (matching against host
43
+ * names / wildcards, not just CIDRs). Vercel, Cloudflare, Deno,
44
+ * Microsandbox, Runloop, Anthropic srt ship this marker; Modal and
45
+ * Daytona (CIDR-only) do not.
46
+ *
47
+ * Phantom — the value is `void`; adapters register with
48
+ * `Layer.succeed(SandboxHostnameAllowlist, undefined)`.
49
+ */
50
+ var SandboxHostnameAllowlist = class extends Context.Service()("@betalyra/effect-uai/capability/SandboxHostnameAllowlist") {};
51
+ /**
52
+ * Capability marker — adapter's provider supports proxy-layer
53
+ * secret rewriting (header injection on outbound HTTPS to bound
54
+ * hosts; the running code never sees the real value). Deno,
55
+ * Cloudflare, E2B, Vercel (firewall transform), Microsandbox,
56
+ * Runloop (Agent Gateway) ship this. Modal, Daytona, CodeSandbox
57
+ * do not.
58
+ */
59
+ var SandboxSecretInjection = class extends Context.Service()("@betalyra/effect-uai/capability/SandboxSecretInjection") {};
60
+ /**
61
+ * Capability marker — adapter supports snapshot-as-new-sandbox
62
+ * (capture state, restore as a derived sandbox with a fresh id).
63
+ * Distinct from {@link SandboxPauseResume}, which preserves the
64
+ * same id and resumes in place.
65
+ */
66
+ var SandboxSnapshots = class extends Context.Service()("@betalyra/effect-uai/capability/SandboxSnapshots") {};
67
+ /**
68
+ * Capability marker — adapter supports in-place pause and resume on
69
+ * the same sandbox id (E2B, CodeSandbox). Memory + processes are
70
+ * preserved across the pause boundary. Most providers without this
71
+ * marker offer {@link SandboxSnapshots} instead.
72
+ */
73
+ var SandboxPauseResume = class extends Context.Service()("@betalyra/effect-uai/capability/SandboxPauseResume") {};
74
+ /**
75
+ * Capability marker — adapter manages named persistent volumes
76
+ * outside any single sandbox lifecycle (Modal Volume, Daytona,
77
+ * Microsandbox, BoxLite). Providers without this marker leave
78
+ * `Sandbox.volumes.*` returning `SandboxUnsupported`; the free
79
+ * helpers ({@link createVolume}, {@link destroyVolume}) additionally
80
+ * require this marker on R so misuses become a type error.
81
+ */
82
+ var SandboxVolumes = class extends Context.Service()("@betalyra/effect-uai/capability/SandboxVolumes") {};
83
+ /**
84
+ * Capability marker — adapter supports a stateful kernel session
85
+ * (Jupyter-style: persistent Python / JS context that returns rich
86
+ * outputs across many `runCode` calls). Cloudflare Code Interpreter
87
+ * and E2B ship this; everyone else expects you to write your own
88
+ * script and `exec` it.
89
+ *
90
+ * The actual `runCode` helper lives separately (not on
91
+ * `SandboxInstance`) because the return shape is different — rich
92
+ * outputs with images/tables, not buffered stdout strings.
93
+ */
94
+ var SandboxKernelSession = class extends Context.Service()("@betalyra/effect-uai/capability/SandboxKernelSession") {};
95
+ /**
96
+ * Capability marker — adapter exposes an interactive PTY session
97
+ * (Runloop, Cloudflare terminal). Distinct from `execStream` which
98
+ * is byte-oriented and one-shot.
99
+ */
100
+ var SandboxPty = class extends Context.Service()("@betalyra/effect-uai/capability/SandboxPty") {};
101
+ /**
102
+ * Capability marker — adapter accepts a user-supplied Dockerfile (or
103
+ * OCI image build) instead of just a registry reference. Vercel does
104
+ * not ship this (fixed AL2023). Deno does not (snapshots only).
105
+ * Most others do.
106
+ */
107
+ var SandboxCustomImage = class extends Context.Service()("@betalyra/effect-uai/capability/SandboxCustomImage") {};
108
+ /**
109
+ * Capability marker — adapter can expose an internal port as a
110
+ * publicly reachable URL. Most cloud providers ship this; local
111
+ * providers (Microsandbox, BoxLite) typically only support
112
+ * host-side port forwarding (handled by ignoring this marker and
113
+ * documenting via the per-provider request type).
114
+ */
115
+ var SandboxPortExposure = class extends Context.Service()("@betalyra/effect-uai/capability/SandboxPortExposure") {};
116
+ /**
117
+ * Provision a sandbox bound to the caller's scope. Drop the
118
+ * `Scope.Scope` requirement with `Effect.scoped`.
119
+ */
120
+ const create = (request) => Effect.flatMap(Sandbox.asEffect(), (s) => s.create(request));
121
+ /**
122
+ * Re-acquire an existing sandbox by id. Same scope semantics as
123
+ * `create`, but the finalizer detaches rather than destroying.
124
+ */
125
+ const attach = (id) => Effect.flatMap(Sandbox.asEffect(), (s) => s.attach(id));
126
+ /** Enumerate sandboxes for the configured account / project. */
127
+ const list = Effect.flatMap(Sandbox.asEffect(), (s) => s.list);
128
+ /**
129
+ * Escape hatch for destroying a sandbox from outside its owning
130
+ * scope. Most callers should let the scope finalizer handle this
131
+ * automatically.
132
+ */
133
+ const destroy = (id) => Effect.flatMap(Sandbox.asEffect(), (s) => s.destroy(id));
134
+ /**
135
+ * Create a snapshot of a live sandbox. Requires
136
+ * {@link SandboxSnapshots} on the R channel — adapters whose
137
+ * provider doesn't support snapshot-as-new-sandbox don't ship the
138
+ * marker and calls fail at `Effect.provide` with a type error.
139
+ */
140
+ const snapshot = (from, name) => Effect.gen(function* () {
141
+ const s = yield* Sandbox.asEffect();
142
+ yield* SandboxSnapshots.asEffect();
143
+ return yield* s.snapshots.create(from, name);
144
+ });
145
+ /**
146
+ * Create a named persistent volume. Requires {@link SandboxVolumes}.
147
+ */
148
+ const createVolume = (name, options) => Effect.gen(function* () {
149
+ const s = yield* Sandbox.asEffect();
150
+ yield* SandboxVolumes.asEffect();
151
+ return yield* s.volumes.create(name, options);
152
+ });
153
+ /** Destroy a named volume. Requires {@link SandboxVolumes}. */
154
+ const destroyVolume = (id) => Effect.gen(function* () {
155
+ const s = yield* Sandbox.asEffect();
156
+ yield* SandboxVolumes.asEffect();
157
+ return yield* s.volumes.destroy(id);
158
+ });
159
+ /** Enumerate persistent volumes. Requires {@link SandboxVolumes}. */
160
+ const listVolumes = Effect.gen(function* () {
161
+ const s = yield* Sandbox.asEffect();
162
+ yield* SandboxVolumes.asEffect();
163
+ return yield* s.volumes.list;
164
+ });
165
+ /** Destroy a snapshot. Requires {@link SandboxSnapshots}. */
166
+ const destroySnapshot = (id) => Effect.gen(function* () {
167
+ const s = yield* Sandbox.asEffect();
168
+ yield* SandboxSnapshots.asEffect();
169
+ return yield* s.snapshots.destroy(id);
170
+ });
171
+ /** Enumerate snapshots. Requires {@link SandboxSnapshots}. */
172
+ const listSnapshots = Effect.gen(function* () {
173
+ const s = yield* Sandbox.asEffect();
174
+ yield* SandboxSnapshots.asEffect();
175
+ return yield* s.snapshots.list;
176
+ });
177
+ /**
178
+ * Expose an internal port of a live sandbox as a publicly reachable
179
+ * URL. Requires {@link SandboxPortExposure} — adapters whose provider
180
+ * doesn't support runtime port exposure (e.g. Microsandbox, which
181
+ * forwards at create time only) don't ship the marker, and calls
182
+ * fail at `Effect.provide` with a type error.
183
+ */
184
+ const exposePort = (instance, port) => Effect.gen(function* () {
185
+ const s = yield* Sandbox.asEffect();
186
+ yield* SandboxPortExposure.asEffect();
187
+ return yield* s.ports.expose(instance, port);
188
+ });
189
+ //#endregion
190
+ export { ExecEvent, ImageRef, NetworkPolicy, Sandbox, SandboxCustomImage, SandboxHostnameAllowlist, SandboxId, SandboxKernelSession, SandboxPauseResume, SandboxPortExposure, SandboxPty, SandboxSecretInjection, SandboxSnapshots, SandboxVolumes, SnapshotId, VolumeId, attach, create, createVolume, destroy, destroySnapshot, destroyVolume, exposePort, list, listSnapshots, listVolumes, snapshot, Sandbox_exports as t };
191
+
192
+ //# sourceMappingURL=Sandbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sandbox.mjs","names":[],"sources":["../../src/sandbox/Sandbox.ts"],"sourcesContent":["import { Brand, Context, Data, type Duration, Effect, Redacted, Scope, Stream } from \"effect\"\nimport type * as SandboxError from \"./SandboxError.js\"\n\n// ---------------------------------------------------------------------------\n// Identity\n// ---------------------------------------------------------------------------\n\n/**\n * Sandbox identifier. Branded `string` so providers don't accidentally\n * accept a raw user-supplied id. Each provider mints these per its own\n * naming scheme (uuid for E2B/Vercel, user-supplied name for\n * Microsandbox/Modal, …); the core code treats them opaquely.\n *\n * Mint via the value-level `SandboxId(...)` smart constructor instead\n * of `as SandboxId` casts.\n */\nexport type SandboxId = Brand.Branded<string, \"SandboxId\">\nexport const SandboxId = Brand.nominal<SandboxId>()\n\n/**\n * Reference returned by `list`. Carries just enough to call `attach` —\n * provider-specific metadata (createdAt, region, tags, …) lives on the\n * narrowed per-provider ref.\n */\nexport type SandboxRef = {\n readonly id: SandboxId\n readonly name?: string\n}\n\nexport type VolumeId = Brand.Branded<string, \"VolumeId\">\nexport const VolumeId = Brand.nominal<VolumeId>()\n\nexport type SnapshotId = Brand.Branded<string, \"SnapshotId\">\nexport const SnapshotId = Brand.nominal<SnapshotId>()\n\n// ---------------------------------------------------------------------------\n// Image / runtime selection\n// ---------------------------------------------------------------------------\n\n/**\n * What runtime / filesystem to boot the sandbox from.\n *\n * - `Default` — provider picks its house image (Vercel: Amazon Linux\n * 2023; Microsandbox: requires user image but a builder default may\n * apply, …). Use when you don't care what's pre-installed.\n * - `Registry` — an OCI image reference. Supported by every provider\n * except those with a fixed base (Vercel ignores this and the\n * request-schema rejects at decode).\n * - `Snapshot` — restore from a captured state. Gated by\n * {@link SandboxSnapshots} at the call site — the marker is provided\n * by adapters whose provider supports snapshot-as-image.\n * - `Dockerfile` — provider builds a custom image from a Dockerfile.\n * Gated by {@link SandboxCustomImage}.\n */\nexport type ImageRef = Data.TaggedEnum<{\n Default: {}\n Registry: { readonly ref: string }\n Snapshot: { readonly id: SnapshotId }\n Dockerfile: { readonly contents: string }\n}>\n\nexport const ImageRef = Data.taggedEnum<ImageRef>()\n\n// ---------------------------------------------------------------------------\n// Network policy + secrets\n// ---------------------------------------------------------------------------\n\n/**\n * Outbound network policy for a sandbox.\n *\n * - `Open` — no egress restriction. The provider's defaults apply\n * (e.g. Microsandbox's \"public-only\" still blocks private ranges).\n * - `Blocked` — fully airgapped, no outbound connectivity at all.\n * - `Allowlist` — only the listed hosts / CIDRs may be reached.\n *\n * Providers vary in what they honour: hostname-allowlist requires\n * {@link SandboxHostnameAllowlist}; CIDR-only providers ignore `hosts`\n * and the adapter rejects at decode if `hosts` is non-empty.\n */\nexport type NetworkPolicy = Data.TaggedEnum<{\n Open: {}\n Blocked: {}\n Allowlist: {\n readonly hosts?: ReadonlyArray<string>\n readonly cidrs?: ReadonlyArray<string>\n }\n}>\n\nexport const NetworkPolicy = Data.taggedEnum<NetworkPolicy>()\n\n/**\n * A secret bound to a sandbox at create time. The code inside the\n * sandbox sees only a placeholder (`$MSB_<NAME>` for Microsandbox,\n * `{name}` for Vercel header-injection, etc.); the real `value` lives\n * on the provider's proxy and is substituted on outbound HTTPS to\n * `hosts`.\n *\n * Requires the {@link SandboxSecretInjection} capability marker —\n * provider Layers without proxy-layer secret rewriting do not ship the\n * marker and consumer code fails at `Effect.provide` with a type\n * error.\n *\n * `header` is the request header to inject (default\n * `\"Authorization: Bearer <value>\"`). Providers that do not let\n * callers pick the header (Microsandbox's `secretEnv` shorthand)\n * silently ignore this field; providers that require an explicit\n * header (Vercel's `transform.headers`) fail at decode if it's absent.\n */\nexport type BoundSecret = {\n readonly name: string\n readonly value: Redacted.Redacted<string>\n readonly hosts: ReadonlyArray<string>\n readonly header?: string\n}\n\n// ---------------------------------------------------------------------------\n// Volumes (capability-gated on `SandboxVolumes`)\n// ---------------------------------------------------------------------------\n\nexport type VolumeMount = {\n readonly id: VolumeId\n readonly mountPath: string\n readonly readonly?: boolean\n}\n\n// ---------------------------------------------------------------------------\n// Create / exec request shapes\n// ---------------------------------------------------------------------------\n\n/**\n * Cross-provider create request. Provider-specific knobs (region,\n * cpus, memory, template id, …) live on each provider's narrowed\n * request type which extends this.\n *\n * Fields a provider can't honour fail at **decode time** (per the\n * per-provider request schema), not silently at runtime. The\n * ComputeSDK anti-pattern of \"drop unsupported fields\" is the\n * footgun we're avoiding.\n */\nexport type CommonCreateRequest = {\n /** Image / snapshot to boot from. Omit for the provider's default. */\n readonly image?: ImageRef\n /**\n * Idle / hard timeout. Accepts a number (millis), a string like\n * `\"30 seconds\"`, or a `Duration`. Providers default differently.\n */\n readonly timeout?: Duration.Input\n /**\n * Env vars exposed to the sandbox. NOT for secrets you want hidden\n * from the running code — use {@link BoundSecret} instead.\n */\n readonly env?: Readonly<Record<string, string>>\n /** Outbound network policy. */\n readonly network?: NetworkPolicy\n /**\n * Bound secrets — code inside the sandbox sees a placeholder; the\n * proxy substitutes the real value on outbound HTTPS to listed hosts.\n * Capability-gated on {@link SandboxSecretInjection}.\n */\n readonly secrets?: ReadonlyArray<BoundSecret>\n /**\n * Persistent volumes to mount. Volumes are created via\n * `Sandbox.volumes.create` and survive sandbox lifetime.\n * Capability-gated on {@link SandboxVolumes}.\n */\n readonly volumes?: ReadonlyArray<VolumeMount>\n}\n\n/**\n * Cross-provider exec request. Background / long-running processes\n * use `spawn` instead of `exec`; the semantics differ enough that\n * overloading `exec` with a `detached` flag was rejected during\n * design.\n */\nexport type CommonExecRequest = {\n /**\n * Argv-style command. Pass a string for \"run this through the\n * shell\" semantics (provider-dependent — most use `sh -c`); pass\n * an array for direct argv with no shell parsing.\n */\n readonly cmd: string | ReadonlyArray<string>\n readonly cwd?: string\n readonly env?: Readonly<Record<string, string>>\n readonly stdin?: string | Uint8Array\n /**\n * Per-exec timeout. Accepts a number (millis), a string like\n * `\"5 seconds\"`, or a `Duration`.\n */\n readonly timeout?: Duration.Input\n}\n\n/**\n * Spawn request — extends {@link CommonExecRequest} with the option\n * to provide stdin as a `Stream<Uint8Array>`. The provider takes one\n * chunk at a time and sends EOF when the stream completes. Useful\n * for piping LLM output into a sandboxed process, or feeding stdin\n * from another stream source. `exec` does not accept streams.\n */\nexport type CommonSpawnRequest = Omit<CommonExecRequest, \"stdin\"> & {\n readonly stdin?: string | Uint8Array | Stream.Stream<Uint8Array, never, never>\n}\n\nexport type ExecResult = {\n readonly exitCode: number\n readonly stdout: string\n readonly stderr: string\n readonly durationMs: number\n}\n\n/**\n * Streaming exec output. `Complete` is terminal — the stream\n * completes after emitting it.\n */\nexport type ExecEvent = Data.TaggedEnum<{\n Stdout: { readonly chunk: Uint8Array }\n Stderr: { readonly chunk: Uint8Array }\n Complete: { readonly exitCode: number; readonly durationMs: number }\n}>\n\nexport const ExecEvent = Data.taggedEnum<ExecEvent>()\n\n// ---------------------------------------------------------------------------\n// Filesystem\n// ---------------------------------------------------------------------------\n\nexport type FileEntryKind = \"file\" | \"directory\" | \"symlink\" | \"other\"\n\nexport type FileEntry = {\n readonly path: string\n readonly kind: FileEntryKind\n}\n\nexport type SandboxFilesystem = {\n readonly read: (path: string) => Effect.Effect<Uint8Array, SandboxError.SandboxError>\n readonly write: (\n path: string,\n contents: Uint8Array | string,\n ) => Effect.Effect<void, SandboxError.SandboxError>\n readonly remove: (path: string) => Effect.Effect<void, SandboxError.SandboxError>\n readonly mkdir: (path: string) => Effect.Effect<void, SandboxError.SandboxError>\n readonly list: (\n path: string,\n ) => Effect.Effect<ReadonlyArray<FileEntry>, SandboxError.SandboxError>\n readonly exists: (path: string) => Effect.Effect<boolean, SandboxError.SandboxError>\n}\n\n// ---------------------------------------------------------------------------\n// Process handle (returned by `spawn`)\n// ---------------------------------------------------------------------------\n\n/**\n * Long-running process handle. Returned by `spawn` in a `Scope.Scope`\n * — the process is killed on scope close. To outlive the calling\n * scope, do `Effect.forkScoped` against a wider scope or use\n * `attach`-style reconnection per the provider's escape hatch.\n */\nexport type ProcessHandle = {\n readonly pid: number\n readonly events: Stream.Stream<ExecEvent, SandboxError.SandboxError>\n readonly kill: Effect.Effect<void, SandboxError.SandboxError>\n readonly exit: Effect.Effect<{ readonly exitCode: number }, SandboxError.SandboxError>\n}\n\n// ---------------------------------------------------------------------------\n// SandboxInstance — the live handle returned from `create` / `attach`\n// ---------------------------------------------------------------------------\n\n/**\n * Live sandbox handle. Methods are plain `Effect` / `Stream` values\n * — no nullary thunks (`destroy()`, `pause()`) — to match Effect's\n * `Queue.shutdown` / `Fiber.interrupt` style. Destruction is the\n * scope finalizer, not a method here; for the rare \"kill from\n * another fiber\" case use the service-level escape hatch\n * `Sandbox.destroy(id)`.\n */\nexport type SandboxInstance = {\n readonly id: SandboxId\n readonly exec: (\n request: CommonExecRequest,\n ) => Effect.Effect<ExecResult, SandboxError.SandboxError>\n readonly execStream: (\n request: CommonExecRequest,\n ) => Stream.Stream<ExecEvent, SandboxError.SandboxError>\n /**\n * Spawn a background / long-running process. The returned handle is\n * scoped — the process is killed on scope close. Use this for\n * \"dev server / watcher / tail -f\" workloads. For one-shot\n * commands prefer `exec`.\n */\n readonly spawn: (\n request: CommonSpawnRequest,\n ) => Effect.Effect<ProcessHandle, SandboxError.SandboxError, Scope.Scope>\n readonly files: SandboxFilesystem\n}\n\n// ---------------------------------------------------------------------------\n// Snapshot / volume / port sub-services (capability-gated)\n// ---------------------------------------------------------------------------\n\nexport type SandboxSnapshotsApi = {\n readonly create: (\n from: SandboxInstance,\n name?: string,\n ) => Effect.Effect<SnapshotId, SandboxError.SandboxError>\n readonly destroy: (id: SnapshotId) => Effect.Effect<void, SandboxError.SandboxError>\n readonly list: Effect.Effect<\n ReadonlyArray<{ readonly id: SnapshotId; readonly name?: string }>,\n SandboxError.SandboxError\n >\n}\n\nexport type SandboxVolumesApi = {\n readonly create: (\n name: string,\n options?: { readonly quotaBytes?: number },\n ) => Effect.Effect<VolumeId, SandboxError.SandboxError>\n readonly destroy: (id: VolumeId) => Effect.Effect<void, SandboxError.SandboxError>\n readonly list: Effect.Effect<\n ReadonlyArray<{ readonly id: VolumeId; readonly name: string }>,\n SandboxError.SandboxError\n >\n}\n\nexport type SandboxPortsApi = {\n /**\n * Expose an internal sandbox port as a publicly reachable URL.\n * Gated by {@link SandboxPortExposure} on the free helper; adapters\n * that don't ship the marker leave this sub-API out of the public\n * surface entirely (callers can't construct an Effect against it).\n */\n readonly expose: (\n instance: SandboxInstance,\n port: number,\n ) => Effect.Effect<{ readonly url: string }, SandboxError.SandboxError>\n}\n\n// ---------------------------------------------------------------------------\n// Service definition\n// ---------------------------------------------------------------------------\n\n/**\n * Cross-provider sandbox service.\n *\n * Lifetime model: `create` returns a sandbox handle in `Scope.Scope`.\n * The scope finalizer destroys the sandbox. Use `Effect.scoped` to\n * bound a sandbox's lifetime to a single Effect, or manage the scope\n * explicitly via `Scope.make` for sandboxes that span many calls.\n * This is why there's no `destroy()` method on `SandboxInstance` —\n * the scope is the lifecycle handle.\n *\n * `snapshots` and `volumes` sub-APIs are present on the service but\n * are still capability-gated: provider Layers that don't support\n * them ship implementations that always fail with\n * `SandboxUnsupported`. The free helpers ({@link snapshot},\n * {@link createVolume}) additionally require the corresponding\n * capability marker on R, so misuses surface as type errors at\n * `Effect.provide`, not as runtime failures.\n */\nexport type SandboxService = {\n /**\n * Provision a new sandbox. The returned handle's lifetime is\n * bound to the caller's scope; the sandbox is destroyed on scope\n * close. To survive the scope, use `attach`-style reconnection or\n * promote into a wider scope.\n */\n readonly create: (\n request: CommonCreateRequest,\n ) => Effect.Effect<SandboxInstance, SandboxError.SandboxError, Scope.Scope>\n\n /**\n * Re-acquire an existing sandbox by id. The returned handle is\n * scope-bound but the finalizer is \"detach\" (no destroy) —\n * appropriate for paused / detached / persistent sandboxes that\n * outlive any single agent run.\n */\n readonly attach: (\n id: SandboxId,\n ) => Effect.Effect<SandboxInstance, SandboxError.SandboxError, Scope.Scope>\n\n /**\n * Enumerate sandboxes visible to the configured account / project.\n */\n readonly list: Effect.Effect<ReadonlyArray<SandboxRef>, SandboxError.SandboxError>\n\n /**\n * Escape hatch for destroying a sandbox from outside its owning\n * scope. Most callers should let the scope finalizer handle this.\n */\n readonly destroy: (id: SandboxId) => Effect.Effect<void, SandboxError.SandboxError>\n\n /** Snapshot management. Capability-gated on {@link SandboxSnapshots}. */\n readonly snapshots: SandboxSnapshotsApi\n\n /** Volume management. Capability-gated on {@link SandboxVolumes}. */\n readonly volumes: SandboxVolumesApi\n\n /** Port exposure. Capability-gated on {@link SandboxPortExposure}. */\n readonly ports: SandboxPortsApi\n}\n\nexport class Sandbox extends Context.Service<Sandbox, SandboxService>()(\n \"@betalyra/effect-uai/Sandbox\",\n) {}\n\n// ---------------------------------------------------------------------------\n// Capability markers\n// ---------------------------------------------------------------------------\n\n/**\n * Capability marker — provided by adapter Layers whose provider\n * supports a hostname-level egress allowlist (matching against host\n * names / wildcards, not just CIDRs). Vercel, Cloudflare, Deno,\n * Microsandbox, Runloop, Anthropic srt ship this marker; Modal and\n * Daytona (CIDR-only) do not.\n *\n * Phantom — the value is `void`; adapters register with\n * `Layer.succeed(SandboxHostnameAllowlist, undefined)`.\n */\nexport class SandboxHostnameAllowlist extends Context.Service<SandboxHostnameAllowlist, void>()(\n \"@betalyra/effect-uai/capability/SandboxHostnameAllowlist\",\n) {}\n\n/**\n * Capability marker — adapter's provider supports proxy-layer\n * secret rewriting (header injection on outbound HTTPS to bound\n * hosts; the running code never sees the real value). Deno,\n * Cloudflare, E2B, Vercel (firewall transform), Microsandbox,\n * Runloop (Agent Gateway) ship this. Modal, Daytona, CodeSandbox\n * do not.\n */\nexport class SandboxSecretInjection extends Context.Service<SandboxSecretInjection, void>()(\n \"@betalyra/effect-uai/capability/SandboxSecretInjection\",\n) {}\n\n/**\n * Capability marker — adapter supports snapshot-as-new-sandbox\n * (capture state, restore as a derived sandbox with a fresh id).\n * Distinct from {@link SandboxPauseResume}, which preserves the\n * same id and resumes in place.\n */\nexport class SandboxSnapshots extends Context.Service<SandboxSnapshots, void>()(\n \"@betalyra/effect-uai/capability/SandboxSnapshots\",\n) {}\n\n/**\n * Capability marker — adapter supports in-place pause and resume on\n * the same sandbox id (E2B, CodeSandbox). Memory + processes are\n * preserved across the pause boundary. Most providers without this\n * marker offer {@link SandboxSnapshots} instead.\n */\nexport class SandboxPauseResume extends Context.Service<SandboxPauseResume, void>()(\n \"@betalyra/effect-uai/capability/SandboxPauseResume\",\n) {}\n\n/**\n * Capability marker — adapter manages named persistent volumes\n * outside any single sandbox lifecycle (Modal Volume, Daytona,\n * Microsandbox, BoxLite). Providers without this marker leave\n * `Sandbox.volumes.*` returning `SandboxUnsupported`; the free\n * helpers ({@link createVolume}, {@link destroyVolume}) additionally\n * require this marker on R so misuses become a type error.\n */\nexport class SandboxVolumes extends Context.Service<SandboxVolumes, void>()(\n \"@betalyra/effect-uai/capability/SandboxVolumes\",\n) {}\n\n/**\n * Capability marker — adapter supports a stateful kernel session\n * (Jupyter-style: persistent Python / JS context that returns rich\n * outputs across many `runCode` calls). Cloudflare Code Interpreter\n * and E2B ship this; everyone else expects you to write your own\n * script and `exec` it.\n *\n * The actual `runCode` helper lives separately (not on\n * `SandboxInstance`) because the return shape is different — rich\n * outputs with images/tables, not buffered stdout strings.\n */\nexport class SandboxKernelSession extends Context.Service<SandboxKernelSession, void>()(\n \"@betalyra/effect-uai/capability/SandboxKernelSession\",\n) {}\n\n/**\n * Capability marker — adapter exposes an interactive PTY session\n * (Runloop, Cloudflare terminal). Distinct from `execStream` which\n * is byte-oriented and one-shot.\n */\nexport class SandboxPty extends Context.Service<SandboxPty, void>()(\n \"@betalyra/effect-uai/capability/SandboxPty\",\n) {}\n\n/**\n * Capability marker — adapter accepts a user-supplied Dockerfile (or\n * OCI image build) instead of just a registry reference. Vercel does\n * not ship this (fixed AL2023). Deno does not (snapshots only).\n * Most others do.\n */\nexport class SandboxCustomImage extends Context.Service<SandboxCustomImage, void>()(\n \"@betalyra/effect-uai/capability/SandboxCustomImage\",\n) {}\n\n/**\n * Capability marker — adapter can expose an internal port as a\n * publicly reachable URL. Most cloud providers ship this; local\n * providers (Microsandbox, BoxLite) typically only support\n * host-side port forwarding (handled by ignoring this marker and\n * documenting via the per-provider request type).\n */\nexport class SandboxPortExposure extends Context.Service<SandboxPortExposure, void>()(\n \"@betalyra/effect-uai/capability/SandboxPortExposure\",\n) {}\n\n// ---------------------------------------------------------------------------\n// Free helpers — accept Sandbox via Context, optionally require markers.\n// ---------------------------------------------------------------------------\n\n/**\n * Provision a sandbox bound to the caller's scope. Drop the\n * `Scope.Scope` requirement with `Effect.scoped`.\n */\nexport const create = (\n request: CommonCreateRequest,\n): Effect.Effect<SandboxInstance, SandboxError.SandboxError, Sandbox | Scope.Scope> =>\n Effect.flatMap(Sandbox.asEffect(), (s) => s.create(request))\n\n/**\n * Re-acquire an existing sandbox by id. Same scope semantics as\n * `create`, but the finalizer detaches rather than destroying.\n */\nexport const attach = (\n id: SandboxId,\n): Effect.Effect<SandboxInstance, SandboxError.SandboxError, Sandbox | Scope.Scope> =>\n Effect.flatMap(Sandbox.asEffect(), (s) => s.attach(id))\n\n/** Enumerate sandboxes for the configured account / project. */\nexport const list: Effect.Effect<\n ReadonlyArray<SandboxRef>,\n SandboxError.SandboxError,\n Sandbox\n> = Effect.flatMap(Sandbox.asEffect(), (s) => s.list)\n\n/**\n * Escape hatch for destroying a sandbox from outside its owning\n * scope. Most callers should let the scope finalizer handle this\n * automatically.\n */\nexport const destroy = (id: SandboxId): Effect.Effect<void, SandboxError.SandboxError, Sandbox> =>\n Effect.flatMap(Sandbox.asEffect(), (s) => s.destroy(id))\n\n/**\n * Create a snapshot of a live sandbox. Requires\n * {@link SandboxSnapshots} on the R channel — adapters whose\n * provider doesn't support snapshot-as-new-sandbox don't ship the\n * marker and calls fail at `Effect.provide` with a type error.\n */\nexport const snapshot = (\n from: SandboxInstance,\n name?: string,\n): Effect.Effect<SnapshotId, SandboxError.SandboxError, Sandbox | SandboxSnapshots> =>\n Effect.gen(function* () {\n const s = yield* Sandbox.asEffect()\n yield* SandboxSnapshots.asEffect()\n return yield* s.snapshots.create(from, name)\n })\n\n/**\n * Create a named persistent volume. Requires {@link SandboxVolumes}.\n */\nexport const createVolume = (\n name: string,\n options?: { readonly quotaBytes?: number },\n): Effect.Effect<VolumeId, SandboxError.SandboxError, Sandbox | SandboxVolumes> =>\n Effect.gen(function* () {\n const s = yield* Sandbox.asEffect()\n yield* SandboxVolumes.asEffect()\n return yield* s.volumes.create(name, options)\n })\n\n/** Destroy a named volume. Requires {@link SandboxVolumes}. */\nexport const destroyVolume = (\n id: VolumeId,\n): Effect.Effect<void, SandboxError.SandboxError, Sandbox | SandboxVolumes> =>\n Effect.gen(function* () {\n const s = yield* Sandbox.asEffect()\n yield* SandboxVolumes.asEffect()\n return yield* s.volumes.destroy(id)\n })\n\n/** Enumerate persistent volumes. Requires {@link SandboxVolumes}. */\nexport const listVolumes: Effect.Effect<\n ReadonlyArray<{ readonly id: VolumeId; readonly name: string }>,\n SandboxError.SandboxError,\n Sandbox | SandboxVolumes\n> = Effect.gen(function* () {\n const s = yield* Sandbox.asEffect()\n yield* SandboxVolumes.asEffect()\n return yield* s.volumes.list\n})\n\n/** Destroy a snapshot. Requires {@link SandboxSnapshots}. */\nexport const destroySnapshot = (\n id: SnapshotId,\n): Effect.Effect<void, SandboxError.SandboxError, Sandbox | SandboxSnapshots> =>\n Effect.gen(function* () {\n const s = yield* Sandbox.asEffect()\n yield* SandboxSnapshots.asEffect()\n return yield* s.snapshots.destroy(id)\n })\n\n/** Enumerate snapshots. Requires {@link SandboxSnapshots}. */\nexport const listSnapshots: Effect.Effect<\n ReadonlyArray<{ readonly id: SnapshotId; readonly name?: string }>,\n SandboxError.SandboxError,\n Sandbox | SandboxSnapshots\n> = Effect.gen(function* () {\n const s = yield* Sandbox.asEffect()\n yield* SandboxSnapshots.asEffect()\n return yield* s.snapshots.list\n})\n\n/**\n * Expose an internal port of a live sandbox as a publicly reachable\n * URL. Requires {@link SandboxPortExposure} — adapters whose provider\n * doesn't support runtime port exposure (e.g. Microsandbox, which\n * forwards at create time only) don't ship the marker, and calls\n * fail at `Effect.provide` with a type error.\n */\nexport const exposePort = (\n instance: SandboxInstance,\n port: number,\n): Effect.Effect<\n { readonly url: string },\n SandboxError.SandboxError,\n Sandbox | SandboxPortExposure\n> =>\n Effect.gen(function* () {\n const s = yield* Sandbox.asEffect()\n yield* SandboxPortExposure.asEffect()\n return yield* s.ports.expose(instance, port)\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAa,YAAY,MAAM,SAAoB;AAanD,MAAa,WAAW,MAAM,SAAmB;AAGjD,MAAa,aAAa,MAAM,SAAqB;AA4BrD,MAAa,WAAW,KAAK,YAAsB;AA2BnD,MAAa,gBAAgB,KAAK,YAA2B;AAmI7D,MAAa,YAAY,KAAK,YAAuB;AAqLrD,IAAa,UAAb,cAA6B,QAAQ,SAAkC,CACrE,+BACD,CAAC;;;;;;;;;;;AAgBF,IAAa,2BAAb,cAA8C,QAAQ,SAAyC,CAC7F,2DACD,CAAC;;;;;;;;;AAUF,IAAa,yBAAb,cAA4C,QAAQ,SAAuC,CACzF,yDACD,CAAC;;;;;;;AAQF,IAAa,mBAAb,cAAsC,QAAQ,SAAiC,CAC7E,mDACD,CAAC;;;;;;;AAQF,IAAa,qBAAb,cAAwC,QAAQ,SAAmC,CACjF,qDACD,CAAC;;;;;;;;;AAUF,IAAa,iBAAb,cAAoC,QAAQ,SAA+B,CACzE,iDACD,CAAC;;;;;;;;;;;;AAaF,IAAa,uBAAb,cAA0C,QAAQ,SAAqC,CACrF,uDACD,CAAC;;;;;;AAOF,IAAa,aAAb,cAAgC,QAAQ,SAA2B,CACjE,6CACD,CAAC;;;;;;;AAQF,IAAa,qBAAb,cAAwC,QAAQ,SAAmC,CACjF,qDACD,CAAC;;;;;;;;AASF,IAAa,sBAAb,cAAy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,IAAI,OAAO,QAAQ,UAAU;AACnC,QAAO,iBAAiB,UAAU;AAClC,QAAO,OAAO,EAAE,UAAU;EAC1B;;;;;;;;AASF,MAAa,cACX,UACA,SAMA,OAAO,IAAI,aAAa;CACtB,MAAM,IAAI,OAAO,QAAQ,UAAU;AACnC,QAAO,oBAAoB,UAAU;AACrC,QAAO,OAAO,EAAE,MAAM,OAAO,UAAU,KAAK;EAC5C"}
@@ -0,0 +1,2 @@
1
+ import { a as SandboxError, c as SandboxInvalidRequest, d as SandboxQuotaExceeded, f as SandboxTimeout, i as SandboxCreateFailed, l as SandboxNetworkPolicyDenied, n as SandboxAuthFailed, p as SandboxUnsupported, r as SandboxAuthSubtype, s as SandboxExecFailed, t as SandboxAlreadyExists, u as SandboxNotFound } from "../SandboxError-BvKypkJm.mjs";
2
+ export { SandboxAlreadyExists, SandboxAuthFailed, SandboxAuthSubtype, SandboxCreateFailed, SandboxError, SandboxExecFailed, SandboxInvalidRequest, SandboxNetworkPolicyDenied, SandboxNotFound, SandboxQuotaExceeded, SandboxTimeout, SandboxUnsupported };
@@ -0,0 +1,89 @@
1
+ import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
2
+ import { Data } from "effect";
3
+ //#region src/sandbox/SandboxError.ts
4
+ var SandboxError_exports = /* @__PURE__ */ __exportAll({
5
+ SandboxAlreadyExists: () => SandboxAlreadyExists,
6
+ SandboxAuthFailed: () => SandboxAuthFailed,
7
+ SandboxCreateFailed: () => SandboxCreateFailed,
8
+ SandboxExecFailed: () => SandboxExecFailed,
9
+ SandboxInvalidRequest: () => SandboxInvalidRequest,
10
+ SandboxNetworkPolicyDenied: () => SandboxNetworkPolicyDenied,
11
+ SandboxNotFound: () => SandboxNotFound,
12
+ SandboxQuotaExceeded: () => SandboxQuotaExceeded,
13
+ SandboxTimeout: () => SandboxTimeout,
14
+ SandboxUnsupported: () => SandboxUnsupported
15
+ });
16
+ /**
17
+ * Failed to provision a sandbox. Covers image pull failures, region
18
+ * unavailability, the provider being unreachable, etc. The provider's
19
+ * structured reason (if any) is on `reason`; the raw error from the
20
+ * underlying SDK is on `raw`.
21
+ */
22
+ var SandboxCreateFailed = class extends Data.TaggedError("SandboxCreateFailed") {};
23
+ /**
24
+ * The requested sandbox id does not exist (or was already destroyed).
25
+ * Distinct from `SandboxCreateFailed` — this is for `attach` / `destroy` /
26
+ * `get`-style lookups against a stale id.
27
+ */
28
+ var SandboxNotFound = class extends Data.TaggedError("SandboxNotFound") {};
29
+ /**
30
+ * Caller tried to create a sandbox whose id is already taken. Providers
31
+ * that keyed by name (Microsandbox, Modal) surface this when a previous
32
+ * sandbox with the same name is still alive. Distinct from
33
+ * `SandboxCreateFailed` so callers can retry with `replace` semantics.
34
+ */
35
+ var SandboxAlreadyExists = class extends Data.TaggedError("SandboxAlreadyExists") {};
36
+ /**
37
+ * A shell exec inside the sandbox failed at the transport / SDK layer —
38
+ * i.e. the SDK couldn't deliver the command to the guest, or the guest
39
+ * agent itself errored. A non-zero exit code from the guest's command
40
+ * is NOT an error; it's an `ExecResult` with `exitCode !== 0`.
41
+ */
42
+ var SandboxExecFailed = class extends Data.TaggedError("SandboxExecFailed") {};
43
+ /**
44
+ * A sandbox operation (create, exec, file op) exceeded its time budget.
45
+ * Carries the budget that was breached for observability.
46
+ */
47
+ var SandboxTimeout = class extends Data.TaggedError("SandboxTimeout") {};
48
+ /**
49
+ * Outbound network request from inside the sandbox was blocked by the
50
+ * configured egress policy (host not on allowlist, CIDR mismatch, etc.).
51
+ * Surfaced when the provider's SDK reports the denial back to the host
52
+ * — many providers simply let the request fail inside the guest and
53
+ * never report this to the host, in which case this error is never
54
+ * raised by the adapter.
55
+ */
56
+ var SandboxNetworkPolicyDenied = class extends Data.TaggedError("SandboxNetworkPolicyDenied") {};
57
+ /**
58
+ * Provider rejected the create / exec because account / org / project
59
+ * quota or concurrency limit was exceeded. Surfaced separately from
60
+ * `SandboxCreateFailed` so callers can back off and retry intelligently.
61
+ */
62
+ var SandboxQuotaExceeded = class extends Data.TaggedError("SandboxQuotaExceeded") {};
63
+ /**
64
+ * Caller's request shape is malformed for the wired provider — e.g. a
65
+ * Dockerfile passed to a provider that only accepts registry refs, a
66
+ * hostname allowlist passed to a CIDR-only provider, etc. Adapters
67
+ * should also reject these at the request-schema layer where possible;
68
+ * this is the runtime fallback.
69
+ */
70
+ var SandboxInvalidRequest = class extends Data.TaggedError("SandboxInvalidRequest") {};
71
+ var SandboxAuthFailed = class extends Data.TaggedError("SandboxAuthFailed") {};
72
+ /**
73
+ * The wired provider does not implement the requested capability for
74
+ * this specific request. Distinct from `SandboxInvalidRequest` (the
75
+ * request shape is malformed) and from compile-time capability
76
+ * markers (`SandboxSnapshots`, `SandboxSecretInjection`, …) which gate
77
+ * blanket provider-level gaps.
78
+ *
79
+ * Reserved for request-data-dependent gaps where the provider supports
80
+ * the method in general but not for these inputs — e.g. passing
81
+ * `hosts: [...]` to a CIDR-only allowlist provider, or passing
82
+ * `dockerfile: ...` to a provider whose `SandboxCustomImage` marker
83
+ * was provided but which only accepts a flat Dockerfile string.
84
+ */
85
+ var SandboxUnsupported = class extends Data.TaggedError("SandboxUnsupported") {};
86
+ //#endregion
87
+ export { SandboxAlreadyExists, SandboxAuthFailed, SandboxCreateFailed, SandboxExecFailed, SandboxInvalidRequest, SandboxNetworkPolicyDenied, SandboxNotFound, SandboxQuotaExceeded, SandboxTimeout, SandboxUnsupported, SandboxError_exports as t };
88
+
89
+ //# sourceMappingURL=SandboxError.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxError.mjs","names":[],"sources":["../../src/sandbox/SandboxError.ts"],"sourcesContent":["import { Data, Duration } from \"effect\"\n\n/**\n * Failed to provision a sandbox. Covers image pull failures, region\n * unavailability, the provider being unreachable, etc. The provider's\n * structured reason (if any) is on `reason`; the raw error from the\n * underlying SDK is on `raw`.\n */\nexport class SandboxCreateFailed extends Data.TaggedError(\"SandboxCreateFailed\")<{\n provider: string\n reason?: string\n raw: unknown\n}> {}\n\n/**\n * The requested sandbox id does not exist (or was already destroyed).\n * Distinct from `SandboxCreateFailed` — this is for `attach` / `destroy` /\n * `get`-style lookups against a stale id.\n */\nexport class SandboxNotFound extends Data.TaggedError(\"SandboxNotFound\")<{\n provider: string\n id: string\n}> {}\n\n/**\n * Caller tried to create a sandbox whose id is already taken. Providers\n * that keyed by name (Microsandbox, Modal) surface this when a previous\n * sandbox with the same name is still alive. Distinct from\n * `SandboxCreateFailed` so callers can retry with `replace` semantics.\n */\nexport class SandboxAlreadyExists extends Data.TaggedError(\"SandboxAlreadyExists\")<{\n provider: string\n id: string\n}> {}\n\n/**\n * A shell exec inside the sandbox failed at the transport / SDK layer —\n * i.e. the SDK couldn't deliver the command to the guest, or the guest\n * agent itself errored. A non-zero exit code from the guest's command\n * is NOT an error; it's an `ExecResult` with `exitCode !== 0`.\n */\nexport class SandboxExecFailed extends Data.TaggedError(\"SandboxExecFailed\")<{\n provider: string\n reason?: string\n raw: unknown\n}> {}\n\n/**\n * A sandbox operation (create, exec, file op) exceeded its time budget.\n * Carries the budget that was breached for observability.\n */\nexport class SandboxTimeout extends Data.TaggedError(\"SandboxTimeout\")<{\n provider: string\n operation: \"create\" | \"exec\" | \"filesystem\" | \"attach\"\n budget?: Duration.Duration\n raw?: unknown\n}> {}\n\n/**\n * Outbound network request from inside the sandbox was blocked by the\n * configured egress policy (host not on allowlist, CIDR mismatch, etc.).\n * Surfaced when the provider's SDK reports the denial back to the host\n * — many providers simply let the request fail inside the guest and\n * never report this to the host, in which case this error is never\n * raised by the adapter.\n */\nexport class SandboxNetworkPolicyDenied extends Data.TaggedError(\"SandboxNetworkPolicyDenied\")<{\n provider: string\n host?: string\n reason?: string\n raw: unknown\n}> {}\n\n/**\n * Provider rejected the create / exec because account / org / project\n * quota or concurrency limit was exceeded. Surfaced separately from\n * `SandboxCreateFailed` so callers can back off and retry intelligently.\n */\nexport class SandboxQuotaExceeded extends Data.TaggedError(\"SandboxQuotaExceeded\")<{\n provider: string\n reason?: string\n raw: unknown\n}> {}\n\n/**\n * Caller's request shape is malformed for the wired provider — e.g. a\n * Dockerfile passed to a provider that only accepts registry refs, a\n * hostname allowlist passed to a CIDR-only provider, etc. Adapters\n * should also reject these at the request-schema layer where possible;\n * this is the runtime fallback.\n */\nexport class SandboxInvalidRequest extends Data.TaggedError(\"SandboxInvalidRequest\")<{\n provider: string\n param?: string\n reason?: string\n raw?: unknown\n}> {}\n\n/**\n * Sandbox SDK could not authenticate against the provider. Subtype\n * mirrors the model-side `AiError.AuthFailed` shape for consistency.\n */\nexport type SandboxAuthSubtype = \"auth\" | \"permission\" | \"billing\" | \"quota\"\n\nexport class SandboxAuthFailed extends Data.TaggedError(\"SandboxAuthFailed\")<{\n provider: string\n subtype: SandboxAuthSubtype\n raw: unknown\n}> {}\n\n/**\n * The wired provider does not implement the requested capability for\n * this specific request. Distinct from `SandboxInvalidRequest` (the\n * request shape is malformed) and from compile-time capability\n * markers (`SandboxSnapshots`, `SandboxSecretInjection`, …) which gate\n * blanket provider-level gaps.\n *\n * Reserved for request-data-dependent gaps where the provider supports\n * the method in general but not for these inputs — e.g. passing\n * `hosts: [...]` to a CIDR-only allowlist provider, or passing\n * `dockerfile: ...` to a provider whose `SandboxCustomImage` marker\n * was provided but which only accepts a flat Dockerfile string.\n */\nexport class SandboxUnsupported extends Data.TaggedError(\"SandboxUnsupported\")<{\n provider: string\n capability: string\n reason?: string\n}> {}\n\nexport type SandboxError =\n | SandboxCreateFailed\n | SandboxNotFound\n | SandboxAlreadyExists\n | SandboxExecFailed\n | SandboxTimeout\n | SandboxNetworkPolicyDenied\n | SandboxQuotaExceeded\n | SandboxInvalidRequest\n | SandboxAuthFailed\n | SandboxUnsupported\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,IAAa,sBAAb,cAAyC,KAAK,YAAY,sBAAsB,CAI7E;;;;;;AAOH,IAAa,kBAAb,cAAqC,KAAK,YAAY,kBAAkB,CAGrE;;;;;;;AAQH,IAAa,uBAAb,cAA0C,KAAK,YAAY,uBAAuB,CAG/E;;;;;;;AAQH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAIzE;;;;;AAMH,IAAa,iBAAb,cAAoC,KAAK,YAAY,iBAAiB,CAKnE;;;;;;;;;AAUH,IAAa,6BAAb,cAAgD,KAAK,YAAY,6BAA6B,CAK3F;;;;;;AAOH,IAAa,uBAAb,cAA0C,KAAK,YAAY,uBAAuB,CAI/E;;;;;;;;AASH,IAAa,wBAAb,cAA2C,KAAK,YAAY,wBAAwB,CAKjF;AAQH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAIzE;;;;;;;;;;;;;;AAeH,IAAa,qBAAb,cAAwC,KAAK,YAAY,qBAAqB,CAI3E"}
@@ -0,0 +1,28 @@
1
+ import { ImageRef, SnapshotId } from "./Sandbox.mjs";
2
+
3
+ //#region src/sandbox/SandboxImage.d.ts
4
+ declare namespace SandboxImage_d_exports {
5
+ export { auto, dockerfile, registry, snapshot };
6
+ }
7
+ /**
8
+ * Ergonomic constructors for {@link ImageRef}. `ImageRef.*` tagged
9
+ * constructors still exist (and are what pattern-matching code uses);
10
+ * these helpers are what end users reach for at the call site.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import * as Image from "@effect-uai/core/SandboxImage"
15
+ *
16
+ * Image.auto // provider's house image
17
+ * Image.registry("python:3.12") // OCI registry ref
18
+ * Image.snapshot("ml-warm-1") // restore captured state (gated)
19
+ * Image.dockerfile("FROM ubuntu...") // build custom (gated)
20
+ * ```
21
+ */
22
+ declare const auto: ImageRef;
23
+ declare const registry: (ref: string) => ImageRef;
24
+ declare const snapshot: (id: SnapshotId | string) => ImageRef;
25
+ declare const dockerfile: (contents: string) => ImageRef;
26
+ //#endregion
27
+ export { auto, dockerfile, registry, snapshot, SandboxImage_d_exports as t };
28
+ //# sourceMappingURL=SandboxImage.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxImage.d.mts","names":[],"sources":["../../src/sandbox/SandboxImage.ts"],"mappings":";;;;;;;;;;;;;;;AAkBA;;;;;AAEA;cAFa,IAAA,EAAM,QAAA;AAAA,cAEN,QAAA,GAAY,GAAA,aAAc,QAAA;AAAA,cAE1B,QAAA,GAAY,EAAA,EAAI,UAAA,cAAsB,QAAA;AAAA,cAGtC,UAAA,GAAc,QAAA,aAAmB,QAAA"}
@@ -0,0 +1,32 @@
1
+ import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
2
+ import { ImageRef, SnapshotId } from "./Sandbox.mjs";
3
+ //#region src/sandbox/SandboxImage.ts
4
+ var SandboxImage_exports = /* @__PURE__ */ __exportAll({
5
+ auto: () => auto,
6
+ dockerfile: () => dockerfile,
7
+ registry: () => registry,
8
+ snapshot: () => snapshot
9
+ });
10
+ /**
11
+ * Ergonomic constructors for {@link ImageRef}. `ImageRef.*` tagged
12
+ * constructors still exist (and are what pattern-matching code uses);
13
+ * these helpers are what end users reach for at the call site.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import * as Image from "@effect-uai/core/SandboxImage"
18
+ *
19
+ * Image.auto // provider's house image
20
+ * Image.registry("python:3.12") // OCI registry ref
21
+ * Image.snapshot("ml-warm-1") // restore captured state (gated)
22
+ * Image.dockerfile("FROM ubuntu...") // build custom (gated)
23
+ * ```
24
+ */
25
+ const auto = ImageRef.Default();
26
+ const registry = (ref) => ImageRef.Registry({ ref });
27
+ const snapshot = (id) => ImageRef.Snapshot({ id: SnapshotId(id) });
28
+ const dockerfile = (contents) => ImageRef.Dockerfile({ contents });
29
+ //#endregion
30
+ export { auto, dockerfile, registry, snapshot, SandboxImage_exports as t };
31
+
32
+ //# sourceMappingURL=SandboxImage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxImage.mjs","names":[],"sources":["../../src/sandbox/SandboxImage.ts"],"sourcesContent":["import { ImageRef, SnapshotId } from \"./Sandbox.js\"\n\n/**\n * Ergonomic constructors for {@link ImageRef}. `ImageRef.*` tagged\n * constructors still exist (and are what pattern-matching code uses);\n * these helpers are what end users reach for at the call site.\n *\n * @example\n * ```ts\n * import * as Image from \"@effect-uai/core/SandboxImage\"\n *\n * Image.auto // provider's house image\n * Image.registry(\"python:3.12\") // OCI registry ref\n * Image.snapshot(\"ml-warm-1\") // restore captured state (gated)\n * Image.dockerfile(\"FROM ubuntu...\") // build custom (gated)\n * ```\n */\n\nexport const auto: ImageRef = ImageRef.Default()\n\nexport const registry = (ref: string): ImageRef => ImageRef.Registry({ ref })\n\nexport const snapshot = (id: SnapshotId | string): ImageRef =>\n ImageRef.Snapshot({ id: SnapshotId(id) })\n\nexport const dockerfile = (contents: string): ImageRef => ImageRef.Dockerfile({ contents })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAa,OAAiB,SAAS,SAAS;AAEhD,MAAa,YAAY,QAA0B,SAAS,SAAS,EAAE,KAAK,CAAC;AAE7E,MAAa,YAAY,OACvB,SAAS,SAAS,EAAE,IAAI,WAAW,GAAG,EAAE,CAAC;AAE3C,MAAa,cAAc,aAA+B,SAAS,WAAW,EAAE,UAAU,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { NetworkPolicy } from "./Sandbox.mjs";
2
+
3
+ //#region src/sandbox/SandboxNetwork.d.ts
4
+ declare namespace SandboxNetwork_d_exports {
5
+ export { allow, allowCidrs, allowHosts, blocked, open };
6
+ }
7
+ /**
8
+ * Ergonomic constructors for {@link NetworkPolicy}. The tagged
9
+ * constructors under `Sandbox.NetworkPolicy.*` still exist (and are
10
+ * what pattern-matching code uses); these helpers are what end users
11
+ * reach for at the call site.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import * as Network from "@effect-uai/core/SandboxNetwork"
16
+ *
17
+ * Network.open // provider defaults apply
18
+ * Network.blocked // airgapped — no egress
19
+ * Network.allowHosts("api.openai.com", "github.com")
20
+ * Network.allowCidrs("10.0.0.0/8")
21
+ * Network.allow({ hosts: [...], cidrs: [...] }) // combined allowlist
22
+ * ```
23
+ */
24
+ declare const open: NetworkPolicy;
25
+ declare const blocked: NetworkPolicy;
26
+ declare const allowHosts: (...hosts: ReadonlyArray<string>) => NetworkPolicy;
27
+ declare const allowCidrs: (...cidrs: ReadonlyArray<string>) => NetworkPolicy;
28
+ declare const allow: (opts: {
29
+ readonly hosts?: ReadonlyArray<string>;
30
+ readonly cidrs?: ReadonlyArray<string>;
31
+ }) => NetworkPolicy;
32
+ //#endregion
33
+ export { allow, allowCidrs, allowHosts, blocked, open, SandboxNetwork_d_exports as t };
34
+ //# sourceMappingURL=SandboxNetwork.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxNetwork.d.mts","names":[],"sources":["../../src/sandbox/SandboxNetwork.ts"],"mappings":";;;;;;;;;;;;;;;;AAoBA;;;;;AAEA;;cAFa,IAAA,EAAM,aAAA;AAAA,cAEN,OAAA,EAAS,aAAA;AAAA,cAET,UAAA,MAAiB,KAAA,EAAO,aAAA,aAAwB,aAAA;AAAA,cAGhD,UAAA,MAAiB,KAAA,EAAO,aAAA,aAAwB,aAAA;AAAA,cAGhD,KAAA,GAAS,IAAA;EAAA,SACX,KAAA,GAAQ,aAAA;EAAA,SACR,KAAA,GAAQ,aAAA;AAAA,MACf,aAAA"}
@@ -0,0 +1,36 @@
1
+ import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
2
+ import { NetworkPolicy } from "./Sandbox.mjs";
3
+ //#region src/sandbox/SandboxNetwork.ts
4
+ var SandboxNetwork_exports = /* @__PURE__ */ __exportAll({
5
+ allow: () => allow,
6
+ allowCidrs: () => allowCidrs,
7
+ allowHosts: () => allowHosts,
8
+ blocked: () => blocked,
9
+ open: () => open
10
+ });
11
+ /**
12
+ * Ergonomic constructors for {@link NetworkPolicy}. The tagged
13
+ * constructors under `Sandbox.NetworkPolicy.*` still exist (and are
14
+ * what pattern-matching code uses); these helpers are what end users
15
+ * reach for at the call site.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import * as Network from "@effect-uai/core/SandboxNetwork"
20
+ *
21
+ * Network.open // provider defaults apply
22
+ * Network.blocked // airgapped — no egress
23
+ * Network.allowHosts("api.openai.com", "github.com")
24
+ * Network.allowCidrs("10.0.0.0/8")
25
+ * Network.allow({ hosts: [...], cidrs: [...] }) // combined allowlist
26
+ * ```
27
+ */
28
+ const open = NetworkPolicy.Open();
29
+ const blocked = NetworkPolicy.Blocked();
30
+ const allowHosts = (...hosts) => NetworkPolicy.Allowlist({ hosts });
31
+ const allowCidrs = (...cidrs) => NetworkPolicy.Allowlist({ cidrs });
32
+ const allow = (opts) => NetworkPolicy.Allowlist(opts);
33
+ //#endregion
34
+ export { allow, allowCidrs, allowHosts, blocked, open, SandboxNetwork_exports as t };
35
+
36
+ //# sourceMappingURL=SandboxNetwork.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxNetwork.mjs","names":[],"sources":["../../src/sandbox/SandboxNetwork.ts"],"sourcesContent":["import { NetworkPolicy } from \"./Sandbox.js\"\n\n/**\n * Ergonomic constructors for {@link NetworkPolicy}. The tagged\n * constructors under `Sandbox.NetworkPolicy.*` still exist (and are\n * what pattern-matching code uses); these helpers are what end users\n * reach for at the call site.\n *\n * @example\n * ```ts\n * import * as Network from \"@effect-uai/core/SandboxNetwork\"\n *\n * Network.open // provider defaults apply\n * Network.blocked // airgapped — no egress\n * Network.allowHosts(\"api.openai.com\", \"github.com\")\n * Network.allowCidrs(\"10.0.0.0/8\")\n * Network.allow({ hosts: [...], cidrs: [...] }) // combined allowlist\n * ```\n */\n\nexport const open: NetworkPolicy = NetworkPolicy.Open()\n\nexport const blocked: NetworkPolicy = NetworkPolicy.Blocked()\n\nexport const allowHosts = (...hosts: ReadonlyArray<string>): NetworkPolicy =>\n NetworkPolicy.Allowlist({ hosts })\n\nexport const allowCidrs = (...cidrs: ReadonlyArray<string>): NetworkPolicy =>\n NetworkPolicy.Allowlist({ cidrs })\n\nexport const allow = (opts: {\n readonly hosts?: ReadonlyArray<string>\n readonly cidrs?: ReadonlyArray<string>\n}): NetworkPolicy => NetworkPolicy.Allowlist(opts)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,OAAsB,cAAc,MAAM;AAEvD,MAAa,UAAyB,cAAc,SAAS;AAE7D,MAAa,cAAc,GAAG,UAC5B,cAAc,UAAU,EAAE,OAAO,CAAC;AAEpC,MAAa,cAAc,GAAG,UAC5B,cAAc,UAAU,EAAE,OAAO,CAAC;AAEpC,MAAa,SAAS,SAGD,cAAc,UAAU,KAAK"}