@effect-uai/core 0.11.0 → 0.12.1
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/dist/{AiError-Bf1pq4BB.d.mts → AiError-eLV9t1lU.d.mts} +12 -16
- package/dist/AiError-eLV9t1lU.d.mts.map +1 -0
- package/dist/{Audio-CR7CSljJ.d.mts → Audio-60lKKHxS.d.mts} +4 -5
- package/dist/Audio-60lKKHxS.d.mts.map +1 -0
- package/dist/{Image-C4vuBmu0.d.mts → Image-BK8-4H6s.d.mts} +12 -14
- package/dist/Image-BK8-4H6s.d.mts.map +1 -0
- package/dist/{Items-BWNu6VGp.d.mts → Items-SfUabNuB.d.mts} +92 -81
- package/dist/Items-SfUabNuB.d.mts.map +1 -0
- package/dist/{Loop-D8nWpowc.d.mts → Loop-B54AB1ME.d.mts} +19 -21
- package/dist/Loop-B54AB1ME.d.mts.map +1 -0
- package/dist/{Media-D_CpcM1Z.d.mts → Media-DwgpifPD.d.mts} +1 -1
- package/dist/Media-DwgpifPD.d.mts.map +1 -0
- package/dist/{SandboxError-CIrVDOMV.d.mts → SandboxError-BN8b28Bh.d.mts} +11 -15
- package/dist/SandboxError-BN8b28Bh.d.mts.map +1 -0
- package/dist/{StructuredFormat-DHaUJBdd.d.mts → StructuredFormat-BlZhyOsi.d.mts} +3 -7
- package/dist/StructuredFormat-BlZhyOsi.d.mts.map +1 -0
- package/dist/{Tool-CXFHCQrT.d.mts → Tool-DE-rnvkw.d.mts} +5 -8
- package/dist/Tool-DE-rnvkw.d.mts.map +1 -0
- package/dist/{ToolEvent-nVijCrvm.d.mts → ToolEvent-D99MGQYH.d.mts} +56 -63
- package/dist/ToolEvent-D99MGQYH.d.mts.map +1 -0
- package/dist/{ToolResult-CQqKkcDa.d.mts → ToolResult-Cj8ChodL.d.mts} +49 -54
- package/dist/ToolResult-Cj8ChodL.d.mts.map +1 -0
- package/dist/{Toolkit-BYPwwu-j.d.mts → Toolkit-BEZrNPTI.d.mts} +13 -16
- package/dist/Toolkit-BEZrNPTI.d.mts.map +1 -0
- package/dist/browser/Browser.d.mts +11 -7
- package/dist/browser/Browser.d.mts.map +1 -1
- package/dist/browser/Browser.mjs +1 -1
- package/dist/browser/Browser.mjs.map +1 -1
- package/dist/browser/BrowserError.d.mts +9 -13
- package/dist/browser/BrowserError.d.mts.map +1 -1
- package/dist/browser/BrowserError.mjs +1 -1
- package/dist/browser/BrowserError.mjs.map +1 -1
- package/dist/browser/BrowserTool.d.mts +33 -36
- package/dist/browser/BrowserTool.d.mts.map +1 -1
- package/dist/browser/BrowserTool.mjs +1 -1
- package/dist/browser/BrowserTool.mjs.map +1 -1
- package/dist/capabilities/Capabilities.d.mts +8 -6
- package/dist/capabilities/Capabilities.d.mts.map +1 -1
- package/dist/capabilities/Capabilities.mjs +1 -1
- package/dist/capabilities/Capabilities.mjs.map +1 -1
- package/dist/dist-BaenoU1A.mjs +145 -0
- package/dist/dist-BaenoU1A.mjs.map +1 -0
- package/dist/{dist-C0m0QnUP.mjs → dist-nohcnkD6.mjs} +16 -15
- package/dist/dist-nohcnkD6.mjs.map +1 -0
- package/dist/domain/AiError.d.mts +1 -1
- package/dist/domain/AiError.mjs +1 -1
- package/dist/domain/AiError.mjs.map +1 -1
- package/dist/domain/Audio.d.mts +1 -1
- package/dist/domain/Audio.mjs +1 -1
- package/dist/domain/Citation.d.mts +0 -2
- package/dist/domain/Citation.d.mts.map +1 -1
- package/dist/domain/Citation.mjs +1 -1
- package/dist/domain/Image.d.mts +1 -1
- package/dist/domain/Image.mjs +1 -1
- package/dist/domain/Image.mjs.map +1 -1
- package/dist/domain/Items.d.mts +1 -1
- package/dist/domain/Items.mjs +16 -2
- package/dist/domain/Items.mjs.map +1 -1
- package/dist/domain/Media.d.mts +1 -1
- package/dist/domain/Media.mjs +1 -1
- package/dist/domain/Music.d.mts +18 -11
- package/dist/domain/Music.d.mts.map +1 -1
- package/dist/domain/Music.mjs +1 -1
- package/dist/domain/Music.mjs.map +1 -1
- package/dist/domain/Research.d.mts +3 -4
- package/dist/domain/Research.d.mts.map +1 -1
- package/dist/domain/Research.mjs +1 -1
- package/dist/domain/Transcript.d.mts +2 -3
- package/dist/domain/Transcript.d.mts.map +1 -1
- package/dist/domain/Transcript.mjs +1 -1
- package/dist/domain/Turn.d.mts +144 -164
- package/dist/domain/Turn.d.mts.map +1 -1
- package/dist/domain/Turn.mjs +1 -1
- package/dist/domain/Turn.mjs.map +1 -1
- package/dist/domain/Turn.test.d.mts +1 -1
- package/dist/domain/Turn.test.mjs +28 -18
- package/dist/domain/Turn.test.mjs.map +1 -1
- package/dist/embedding-model/Embedding.d.mts +1 -3
- package/dist/embedding-model/Embedding.d.mts.map +1 -1
- package/dist/embedding-model/Embedding.mjs +1 -1
- package/dist/embedding-model/EmbeddingModel.d.mts +1 -3
- package/dist/embedding-model/EmbeddingModel.d.mts.map +1 -1
- package/dist/embedding-model/EmbeddingModel.mjs +1 -1
- package/dist/embedding-model/EmbeddingModel.mjs.map +1 -1
- package/dist/embedding-model/EmbeddingModel.test.d.mts +1 -1
- package/dist/embedding-model/EmbeddingModel.test.mjs +14 -9
- package/dist/embedding-model/EmbeddingModel.test.mjs.map +1 -1
- package/dist/index.d.mts +12 -12
- package/dist/job/Job.d.mts +4 -4
- package/dist/job/Job.d.mts.map +1 -1
- package/dist/job/Job.mjs +1 -1
- package/dist/job/Job.mjs.map +1 -1
- package/dist/language-model/LanguageModel.d.mts +4 -6
- package/dist/language-model/LanguageModel.d.mts.map +1 -1
- package/dist/language-model/LanguageModel.mjs +1 -1
- package/dist/language-model/LanguageModel.mjs.map +1 -1
- package/dist/language-model/LanguageModel.test.d.mts +1 -1
- package/dist/language-model/LanguageModel.test.mjs +6 -3
- package/dist/language-model/LanguageModel.test.mjs.map +1 -1
- package/dist/loop/Loop.d.mts +1 -1
- package/dist/loop/Loop.mjs +1 -1
- package/dist/loop/Loop.mjs.map +1 -1
- package/dist/loop/Loop.test.d.mts +1 -1
- package/dist/loop/Loop.test.mjs +60 -34
- package/dist/loop/Loop.test.mjs.map +1 -1
- package/dist/{magic-string.es-Dk-MMA0F.mjs → magic-string.es-CB2hOw9v.mjs} +14 -13
- package/dist/{magic-string.es-Dk-MMA0F.mjs.map → magic-string.es-CB2hOw9v.mjs.map} +1 -1
- package/dist/math/Vector.d.mts +0 -2
- package/dist/math/Vector.d.mts.map +1 -1
- package/dist/math/Vector.mjs +1 -1
- package/dist/math/Vector.mjs.map +1 -1
- package/dist/music-generator/MusicGenerator.d.mts +2 -4
- package/dist/music-generator/MusicGenerator.d.mts.map +1 -1
- package/dist/music-generator/MusicGenerator.mjs +1 -1
- package/dist/music-generator/MusicGenerator.mjs.map +1 -1
- package/dist/music-generator/MusicGenerator.test.d.mts +1 -1
- package/dist/music-generator/MusicGenerator.test.mjs +19 -10
- package/dist/music-generator/MusicGenerator.test.mjs.map +1 -1
- package/dist/observability/Metrics.d.mts +21 -10
- package/dist/observability/Metrics.d.mts.map +1 -1
- package/dist/observability/Metrics.mjs +31 -8
- package/dist/observability/Metrics.mjs.map +1 -1
- package/dist/observability/Metrics.test.d.mts +1 -1
- package/dist/observability/Metrics.test.mjs +87 -23
- package/dist/observability/Metrics.test.mjs.map +1 -1
- package/dist/observability/Telemetry.d.mts +2 -3
- package/dist/observability/Telemetry.d.mts.map +1 -1
- package/dist/observability/Telemetry.mjs +1 -1
- package/dist/observability/Telemetry.mjs.map +1 -1
- package/dist/observability/Telemetry.test.d.mts +1 -1
- package/dist/observability/Telemetry.test.mjs +15 -7
- package/dist/observability/Telemetry.test.mjs.map +1 -1
- package/dist/research/DeepResearch.d.mts +1 -3
- package/dist/research/DeepResearch.d.mts.map +1 -1
- package/dist/research/DeepResearch.mjs +1 -1
- package/dist/research/DeepResearch.mjs.map +1 -1
- package/dist/retry/Retry.d.mts +4 -8
- package/dist/retry/Retry.d.mts.map +1 -1
- package/dist/retry/Retry.mjs +31 -2
- package/dist/retry/Retry.mjs.map +1 -1
- package/dist/retry/Retry.test.d.mts +1 -1
- package/dist/retry/Retry.test.mjs +6 -3
- package/dist/retry/Retry.test.mjs.map +1 -1
- package/dist/sandbox/Memory.d.mts +0 -2
- package/dist/sandbox/Memory.d.mts.map +1 -1
- package/dist/sandbox/Memory.mjs +4 -4
- package/dist/sandbox/Memory.mjs.map +1 -1
- package/dist/sandbox/Sandbox.d.mts +144 -156
- package/dist/sandbox/Sandbox.d.mts.map +1 -1
- package/dist/sandbox/Sandbox.mjs +1 -1
- package/dist/sandbox/Sandbox.mjs.map +1 -1
- package/dist/sandbox/SandboxError.d.mts +1 -1
- package/dist/sandbox/SandboxError.mjs +1 -1
- package/dist/sandbox/SandboxError.mjs.map +1 -1
- package/dist/sandbox/SandboxImage.d.mts +0 -2
- package/dist/sandbox/SandboxImage.d.mts.map +1 -1
- package/dist/sandbox/SandboxImage.mjs +1 -1
- package/dist/sandbox/SandboxImage.mjs.map +1 -1
- package/dist/sandbox/SandboxNetwork.d.mts +0 -2
- package/dist/sandbox/SandboxNetwork.d.mts.map +1 -1
- package/dist/sandbox/SandboxNetwork.mjs +1 -1
- package/dist/sandbox/SandboxNetwork.mjs.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.d.mts +8 -7
- package/dist/speech-synthesizer/SpeechSynthesizer.d.mts.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.mjs +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.mjs.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.test.d.mts +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs +31 -16
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs.map +1 -1
- package/dist/streaming/JSONL.d.mts +1 -5
- package/dist/streaming/JSONL.d.mts.map +1 -1
- package/dist/streaming/JSONL.mjs +1 -1
- package/dist/streaming/JSONL.mjs.map +1 -1
- package/dist/streaming/JSONL.test.d.mts +1 -1
- package/dist/streaming/JSONL.test.mjs +16 -8
- package/dist/streaming/JSONL.test.mjs.map +1 -1
- package/dist/streaming/Lines.d.mts +0 -2
- package/dist/streaming/Lines.d.mts.map +1 -1
- package/dist/streaming/Lines.mjs +1 -1
- package/dist/streaming/Lines.mjs.map +1 -1
- package/dist/streaming/SSE.d.mts +0 -2
- package/dist/streaming/SSE.d.mts.map +1 -1
- package/dist/streaming/SSE.mjs +1 -1
- package/dist/streaming/SSE.mjs.map +1 -1
- package/dist/streaming/SSE.test.d.mts +1 -1
- package/dist/streaming/SSE.test.mjs +34 -17
- package/dist/streaming/SSE.test.mjs.map +1 -1
- package/dist/structured-format/StructuredFormat.d.mts +1 -1
- package/dist/structured-format/StructuredFormat.mjs +1 -1
- package/dist/structured-format/StructuredFormat.mjs.map +1 -1
- package/dist/structured-format/StructuredFormat.test.d.mts +1 -1
- package/dist/structured-format/StructuredFormat.test.mjs +7 -4
- package/dist/structured-format/StructuredFormat.test.mjs.map +1 -1
- package/dist/{dist-CcRV3-A5.mjs → test.DNmyFkvJ-YPzDR0Co.mjs} +1644 -5172
- package/dist/test.DNmyFkvJ-YPzDR0Co.mjs.map +1 -0
- package/dist/testing/MockMusicGenerator.d.mts +4 -3
- package/dist/testing/MockMusicGenerator.d.mts.map +1 -1
- package/dist/testing/MockMusicGenerator.mjs.map +1 -1
- package/dist/testing/MockProvider.d.mts +1 -2
- package/dist/testing/MockProvider.d.mts.map +1 -1
- package/dist/testing/MockProvider.mjs.map +1 -1
- package/dist/testing/MockSandbox.d.mts +256 -290
- package/dist/testing/MockSandbox.d.mts.map +1 -1
- package/dist/testing/MockSandbox.mjs.map +1 -1
- package/dist/testing/MockSpeechSynthesizer.d.mts +10 -6
- package/dist/testing/MockSpeechSynthesizer.d.mts.map +1 -1
- package/dist/testing/MockSpeechSynthesizer.mjs.map +1 -1
- package/dist/testing/MockTranscriber.d.mts +3 -2
- package/dist/testing/MockTranscriber.d.mts.map +1 -1
- package/dist/testing/MockTranscriber.mjs.map +1 -1
- package/dist/tool/Approval.d.mts +31 -36
- package/dist/tool/Approval.d.mts.map +1 -1
- package/dist/tool/Approval.mjs +1 -1
- package/dist/tool/Approval.mjs.map +1 -1
- package/dist/tool/Approval.test.d.mts +1 -1
- package/dist/tool/Approval.test.mjs +37 -24
- package/dist/tool/Approval.test.mjs.map +1 -1
- package/dist/tool/HistoryCheck.d.mts +2 -4
- package/dist/tool/HistoryCheck.d.mts.map +1 -1
- package/dist/tool/HistoryCheck.mjs +1 -1
- package/dist/tool/HistoryCheck.mjs.map +1 -1
- package/dist/tool/Tool.d.mts +1 -1
- package/dist/tool/Tool.mjs +4 -4
- package/dist/tool/Tool.mjs.map +1 -1
- package/dist/tool/Tool.test.d.mts +1 -1
- package/dist/tool/Tool.test.mjs +23 -11
- package/dist/tool/Tool.test.mjs.map +1 -1
- package/dist/tool/ToolEvent.d.mts +1 -1
- package/dist/tool/ToolEvent.mjs +1 -1
- package/dist/tool/ToolEvent.mjs.map +1 -1
- package/dist/tool/ToolResult.d.mts +1 -1
- package/dist/tool/ToolResult.mjs +1 -1
- package/dist/tool/ToolResult.mjs.map +1 -1
- package/dist/tool/Toolkit.d.mts +1 -1
- package/dist/tool/Toolkit.mjs +4 -3
- package/dist/tool/Toolkit.mjs.map +1 -1
- package/dist/tool/Toolkit.test.d.mts +1 -1
- package/dist/tool/Toolkit.test.mjs +40 -21
- package/dist/tool/Toolkit.test.mjs.map +1 -1
- package/dist/transcriber/Transcriber.d.mts +6 -6
- package/dist/transcriber/Transcriber.d.mts.map +1 -1
- package/dist/transcriber/Transcriber.mjs +1 -1
- package/dist/transcriber/Transcriber.mjs.map +1 -1
- package/dist/transcriber/Transcriber.test.d.mts +1 -1
- package/dist/transcriber/Transcriber.test.mjs +20 -10
- package/dist/transcriber/Transcriber.test.mjs.map +1 -1
- package/dist/utils-CiH_DjFW.mjs +3918 -0
- package/dist/utils-CiH_DjFW.mjs.map +1 -0
- package/dist/web-read/WebRead.d.mts +15 -9
- package/dist/web-read/WebRead.d.mts.map +1 -1
- package/dist/web-read/WebRead.mjs +1 -1
- package/dist/web-read/WebRead.mjs.map +1 -1
- package/dist/web-read/WebReadTool.d.mts +4 -5
- package/dist/web-read/WebReadTool.d.mts.map +1 -1
- package/dist/web-read/WebReadTool.mjs +1 -1
- package/dist/web-read/WebReadTool.mjs.map +1 -1
- package/dist/web-search/WebSearch.d.mts +22 -13
- package/dist/web-search/WebSearch.d.mts.map +1 -1
- package/dist/web-search/WebSearch.mjs +1 -1
- package/dist/web-search/WebSearch.mjs.map +1 -1
- package/dist/web-search/WebSearchTool.d.mts +6 -6
- package/dist/web-search/WebSearchTool.d.mts.map +1 -1
- package/dist/web-search/WebSearchTool.mjs +1 -1
- package/dist/web-search/WebSearchTool.mjs.map +1 -1
- package/package.json +4 -4
- package/src/domain/Items.ts +18 -0
- package/src/loop/Loop.test.ts +13 -14
- package/src/loop/Loop.ts +74 -76
- package/src/observability/Metrics.test.ts +65 -0
- package/src/observability/Metrics.ts +53 -11
- package/src/retry/Retry.ts +44 -3
- package/src/testing/MockProvider.ts +8 -9
- package/src/tool/Tool.ts +13 -13
- package/dist/AiError-Bf1pq4BB.d.mts.map +0 -1
- package/dist/Audio-CR7CSljJ.d.mts.map +0 -1
- package/dist/Image-C4vuBmu0.d.mts.map +0 -1
- package/dist/Items-BWNu6VGp.d.mts.map +0 -1
- package/dist/Loop-D8nWpowc.d.mts.map +0 -1
- package/dist/Media-D_CpcM1Z.d.mts.map +0 -1
- package/dist/SandboxError-CIrVDOMV.d.mts.map +0 -1
- package/dist/StructuredFormat-DHaUJBdd.d.mts.map +0 -1
- package/dist/Tool-CXFHCQrT.d.mts.map +0 -1
- package/dist/ToolEvent-nVijCrvm.d.mts.map +0 -1
- package/dist/ToolResult-CQqKkcDa.d.mts.map +0 -1
- package/dist/Toolkit-BYPwwu-j.d.mts.map +0 -1
- package/dist/dist-C0m0QnUP.mjs.map +0 -1
- package/dist/dist-CcRV3-A5.mjs.map +0 -1
- /package/dist/{chunk-uyGKjUfl.mjs → rolldown-runtime-EAsCxrDo.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Memory.mjs","names":[],"sources":["../../src/sandbox/Memory.ts"],"sourcesContent":["import { Brand } from \"effect\"\n\n/**\n * A memory / data size, always represented internally as a number of\n * bytes. Mirrors the `Duration` shape from `effect` — a branded value\n * type with a wider `Input` union for ergonomic construction at call\n * sites.\n *\n * `effect` itself has no byte-count primitive (only `Duration`), so we\n * own this here rather than leak provider-specific shapes (Deno's\n * template-literal `Memory`, Vercel's `mb`, Modal's `gpuMemory`, …)\n * through the cross-provider `Sandbox` request types.\n *\n * @example\n * ```ts\n * import * as Memory from \"@effect-uai/core/Memory\"\n *\n * Memory.gib(2) // 2 GiB → 2_147_483_648 bytes\n * Memory.fromInputUnsafe(\"1.5 GiB\") // human-string parsing\n * Memory.fromInputUnsafe(1_280_000_000) // raw bytes\n * Memory.toBytes(m) // unwrap\n * ```\n */\n\nexport type Memory = Brand.Branded<number, \"Memory\">\n\nconst make = Brand.nominal<Memory>()\n\n// ---------------------------------------------------------------------------\n// Input — what the public APIs accept.\n//\n// Supported string forms (case-insensitive on the unit, whitespace\n// optional between number and unit):\n//\n// \"<n>\" bytes (no unit)\n// \"<n> B\" bytes\n// \"<n> kB\" 1_000 bytes (decimal)\n// \"<n> MB\" 1_000_000 (decimal)\n// \"<n> GB\" 1_000_000_000 (decimal)\n// \"<n> KiB\" 1_024 (binary)\n// \"<n> MiB\" 1_048_576 (binary)\n// \"<n> GiB\" 1_073_741_824 (binary)\n//\n// Decimal vs binary follows the SI / IEC convention (`MB` = 10^6,\n// `MiB` = 2^20). When in doubt, prefer the binary `*iB` units.\n// ---------------------------------------------------------------------------\n\nexport type Input = number | Memory | string\n\nconst UNIT_BYTES: Record<string, number> = {\n b: 1,\n kb: 1_000,\n mb: 1_000_000,\n gb: 1_000_000_000,\n tb: 1_000_000_000_000,\n kib: 1_024,\n mib: 1_024 * 1_024,\n gib: 1_024 * 1_024 * 1_024,\n tib: 1_024 * 1_024 * 1_024 * 1_024,\n}\n\nconst PARSE_RE = /^\\s*(\\d+(?:\\.\\d+)?)\\s*([a-zA-Z]*)\\s*$/\n\nconst parseString = (s: string): number => {\n const m = PARSE_RE.exec(s)\n if (m === null) {\n throw new Error(`Memory: cannot parse \"${s}\" — expected forms like \"1024\", \"10 MB\", \"1GiB\"`)\n }\n const value = Number(m[1])\n const unit = (m[2] ?? \"\").toLowerCase()\n if (unit === \"\") return value\n const factor = UNIT_BYTES[unit]\n if (factor === undefined) {\n throw new Error(\n `Memory: unknown unit \"${m[2]}\" in \"${s}\" — supported: ${Object.keys(UNIT_BYTES).join(\", \")}`,\n )\n }\n return value * factor\n}\n\n/**\n * Coerce a {@link Input} to a {@link Memory}. Throws on malformed\n * strings or non-finite numbers. Mirrors `Duration.fromInputUnsafe`.\n */\nexport const fromInputUnsafe = (input: Input): Memory => {\n if (typeof input === \"number\") {\n if (!Number.isFinite(input) || input < 0) {\n throw new Error(`Memory: bytes must be a non-negative finite number, got ${input}`)\n }\n return make(Math.floor(input))\n }\n return make(Math.floor(parseString(input)))\n}\n\n// ---------------------------------------------------------------------------\n// Unwrap\n// ---------------------------------------------------------------------------\n\n/** Return the underlying byte count. */\nexport const toBytes = (m: Memory | Input): number =>\n typeof m === \"number\" && (m as number) === Math.floor(m as number) && (m as number) >= 0\n ? (m as number)\n : (fromInputUnsafe(m) as unknown as number)\n\n// ---------------------------------------------------------------------------\n// Unit constructors — terse for use at call sites.\n// ---------------------------------------------------------------------------\n\n/** N bytes. */\nexport const bytes = (n: number): Memory => make(Math.floor(n))\n\n/** N KiB (binary kibibytes, `n * 1024`). */\nexport const kib = (n: number): Memory => make(Math.floor(n * 1_024))\n\n/** N MiB (binary mebibytes, `n * 1024^2`). */\nexport const mib = (n: number): Memory => make(Math.floor(n * 1_024 * 1_024))\n\n/** N GiB (binary gibibytes, `n * 1024^3`). */\nexport const gib = (n: number): Memory => make(Math.floor(n * 1_024 * 1_024 * 1_024))\n\n/** N kB (decimal kilobytes, `n * 1000`). */\nexport const kb = (n: number): Memory => make(Math.floor(n * 1_000))\n\n/** N MB (decimal megabytes, `n * 1_000_000`). */\nexport const mb = (n: number): Memory => make(Math.floor(n * 1_000_000))\n\n/** N GB (decimal gigabytes, `n * 1_000_000_000`). */\nexport const gb = (n: number): Memory => make(Math.floor(n * 1_000_000_000))\n"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAM,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"Memory.mjs","names":[],"sources":["../../src/sandbox/Memory.ts"],"sourcesContent":["import { Brand } from \"effect\"\n\n/**\n * A memory / data size, always represented internally as a number of\n * bytes. Mirrors the `Duration` shape from `effect` — a branded value\n * type with a wider `Input` union for ergonomic construction at call\n * sites.\n *\n * `effect` itself has no byte-count primitive (only `Duration`), so we\n * own this here rather than leak provider-specific shapes (Deno's\n * template-literal `Memory`, Vercel's `mb`, Modal's `gpuMemory`, …)\n * through the cross-provider `Sandbox` request types.\n *\n * @example\n * ```ts\n * import * as Memory from \"@effect-uai/core/Memory\"\n *\n * Memory.gib(2) // 2 GiB → 2_147_483_648 bytes\n * Memory.fromInputUnsafe(\"1.5 GiB\") // human-string parsing\n * Memory.fromInputUnsafe(1_280_000_000) // raw bytes\n * Memory.toBytes(m) // unwrap\n * ```\n */\n\nexport type Memory = Brand.Branded<number, \"Memory\">\n\nconst make = Brand.nominal<Memory>()\n\n// ---------------------------------------------------------------------------\n// Input — what the public APIs accept.\n//\n// Supported string forms (case-insensitive on the unit, whitespace\n// optional between number and unit):\n//\n// \"<n>\" bytes (no unit)\n// \"<n> B\" bytes\n// \"<n> kB\" 1_000 bytes (decimal)\n// \"<n> MB\" 1_000_000 (decimal)\n// \"<n> GB\" 1_000_000_000 (decimal)\n// \"<n> KiB\" 1_024 (binary)\n// \"<n> MiB\" 1_048_576 (binary)\n// \"<n> GiB\" 1_073_741_824 (binary)\n//\n// Decimal vs binary follows the SI / IEC convention (`MB` = 10^6,\n// `MiB` = 2^20). When in doubt, prefer the binary `*iB` units.\n// ---------------------------------------------------------------------------\n\nexport type Input = number | Memory | string\n\nconst UNIT_BYTES: Record<string, number> = {\n b: 1,\n kb: 1_000,\n mb: 1_000_000,\n gb: 1_000_000_000,\n tb: 1_000_000_000_000,\n kib: 1_024,\n mib: 1_024 * 1_024,\n gib: 1_024 * 1_024 * 1_024,\n tib: 1_024 * 1_024 * 1_024 * 1_024,\n}\n\nconst PARSE_RE = /^\\s*(\\d+(?:\\.\\d+)?)\\s*([a-zA-Z]*)\\s*$/\n\nconst parseString = (s: string): number => {\n const m = PARSE_RE.exec(s)\n if (m === null) {\n throw new Error(`Memory: cannot parse \"${s}\" — expected forms like \"1024\", \"10 MB\", \"1GiB\"`)\n }\n const value = Number(m[1])\n const unit = (m[2] ?? \"\").toLowerCase()\n if (unit === \"\") return value\n const factor = UNIT_BYTES[unit]\n if (factor === undefined) {\n throw new Error(\n `Memory: unknown unit \"${m[2]}\" in \"${s}\" — supported: ${Object.keys(UNIT_BYTES).join(\", \")}`,\n )\n }\n return value * factor\n}\n\n/**\n * Coerce a {@link Input} to a {@link Memory}. Throws on malformed\n * strings or non-finite numbers. Mirrors `Duration.fromInputUnsafe`.\n */\nexport const fromInputUnsafe = (input: Input): Memory => {\n if (typeof input === \"number\") {\n if (!Number.isFinite(input) || input < 0) {\n throw new Error(`Memory: bytes must be a non-negative finite number, got ${input}`)\n }\n return make(Math.floor(input))\n }\n return make(Math.floor(parseString(input)))\n}\n\n// ---------------------------------------------------------------------------\n// Unwrap\n// ---------------------------------------------------------------------------\n\n/** Return the underlying byte count. */\nexport const toBytes = (m: Memory | Input): number =>\n typeof m === \"number\" && (m as number) === Math.floor(m as number) && (m as number) >= 0\n ? (m as number)\n : (fromInputUnsafe(m) as unknown as number)\n\n// ---------------------------------------------------------------------------\n// Unit constructors — terse for use at call sites.\n// ---------------------------------------------------------------------------\n\n/** N bytes. */\nexport const bytes = (n: number): Memory => make(Math.floor(n))\n\n/** N KiB (binary kibibytes, `n * 1024`). */\nexport const kib = (n: number): Memory => make(Math.floor(n * 1_024))\n\n/** N MiB (binary mebibytes, `n * 1024^2`). */\nexport const mib = (n: number): Memory => make(Math.floor(n * 1_024 * 1_024))\n\n/** N GiB (binary gibibytes, `n * 1024^3`). */\nexport const gib = (n: number): Memory => make(Math.floor(n * 1_024 * 1_024 * 1_024))\n\n/** N kB (decimal kilobytes, `n * 1000`). */\nexport const kb = (n: number): Memory => make(Math.floor(n * 1_000))\n\n/** N MB (decimal megabytes, `n * 1_000_000`). */\nexport const mb = (n: number): Memory => make(Math.floor(n * 1_000_000))\n\n/** N GB (decimal gigabytes, `n * 1_000_000_000`). */\nexport const gb = (n: number): Memory => make(Math.floor(n * 1_000_000_000))\n"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAM,OAAO,MAAM,QAAgB;AAuBnC,MAAM,aAAqC;CACzC,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;AACP;AAEA,MAAM,WAAW;AAEjB,MAAM,eAAe,MAAsB;CACzC,MAAM,IAAI,SAAS,KAAK,CAAC;CACzB,IAAI,MAAM,MACR,MAAM,IAAI,MAAM,yBAAyB,EAAE,gDAAgD;CAE7F,MAAM,QAAQ,OAAO,EAAE,EAAE;CACzB,MAAM,QAAQ,EAAE,MAAM,GAAA,CAAI,YAAY;CACtC,IAAI,SAAS,IAAI,OAAO;CACxB,MAAM,SAAS,WAAW;CAC1B,IAAI,WAAW,KAAA,GACb,MAAM,IAAI,MACR,yBAAyB,EAAE,GAAG,QAAQ,EAAE,iBAAiB,OAAO,KAAK,UAAU,CAAC,CAAC,KAAK,IAAI,GAC5F;CAEF,OAAO,QAAQ;AACjB;;;;;AAMA,MAAa,mBAAmB,UAAyB;CACvD,IAAI,OAAO,UAAU,UAAU;EAC7B,IAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,GACrC,MAAM,IAAI,MAAM,2DAA2D,OAAO;EAEpF,OAAO,KAAK,KAAK,MAAM,KAAK,CAAC;CAC/B;CACA,OAAO,KAAK,KAAK,MAAM,YAAY,KAAK,CAAC,CAAC;AAC5C;;AAOA,MAAa,WAAW,MACtB,OAAO,MAAM,YAAa,MAAiB,KAAK,MAAM,CAAW,KAAM,KAAgB,IAClF,IACA,gBAAgB,CAAC;;AAOxB,MAAa,SAAS,MAAsB,KAAK,KAAK,MAAM,CAAC,CAAC;;AAG9D,MAAa,OAAO,MAAsB,KAAK,KAAK,MAAM,IAAI,IAAK,CAAC;;AAGpE,MAAa,OAAO,MAAsB,KAAK,KAAK,MAAM,IAAI,OAAQ,IAAK,CAAC;;AAG5E,MAAa,OAAO,MAAsB,KAAK,KAAK,MAAM,IAAI,OAAQ,OAAQ,IAAK,CAAC;;AAGpF,MAAa,MAAM,MAAsB,KAAK,KAAK,MAAM,IAAI,GAAK,CAAC;;AAGnE,MAAa,MAAM,MAAsB,KAAK,KAAK,MAAM,IAAI,GAAS,CAAC;;AAGvE,MAAa,MAAM,MAAsB,KAAK,KAAK,MAAM,IAAI,GAAa,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { a as SandboxError } from "../SandboxError-
|
|
1
|
+
import { a as SandboxError } from "../SandboxError-BN8b28Bh.mjs";
|
|
2
2
|
import { Brand, Context, Data, Duration, Effect, Redacted, Scope, Stream } from "effect";
|
|
3
|
-
import * as _$effect_Unify0 from "effect/Unify";
|
|
4
|
-
|
|
5
|
-
//#region src/sandbox/Sandbox.d.ts
|
|
6
3
|
declare namespace Sandbox_d_exports {
|
|
7
4
|
export { BoundSecret, CommonCreateRequest, CommonExecRequest, CommonSpawnRequest, ExecEvent, ExecResult, FileEntry, FileEntryKind, ImageRef, NetworkPolicy, ProcessHandle, Sandbox, SandboxCustomImage, SandboxFilesystem, SandboxHostnameAllowlist, SandboxId, SandboxInstance, SandboxKernelSession, SandboxPauseResume, SandboxPortExposure, SandboxPortsApi, SandboxPty, SandboxRef, SandboxSecretInjection, SandboxService, SandboxSnapshots, SandboxSnapshotsApi, SandboxVolumes, SandboxVolumesApi, SnapshotId, VolumeId, VolumeMount, attach, create, createVolume, destroy, destroySnapshot, destroyVolume, exposePort, list, listSnapshots, listVolumes, snapshot };
|
|
8
5
|
}
|
|
@@ -58,23 +55,13 @@ type ImageRef = Data.TaggedEnum<{
|
|
|
58
55
|
};
|
|
59
56
|
}>;
|
|
60
57
|
declare const ImageRef: {
|
|
61
|
-
readonly Default:
|
|
58
|
+
readonly $is: <Tag extends "Default" | "Dockerfile" | "Registry" | "Snapshot">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
62
59
|
readonly _tag: "Default";
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
readonly ref: string;
|
|
67
|
-
}, "_tag">;
|
|
68
|
-
readonly Snapshot: Data.TaggedEnum.ConstructorFrom<{
|
|
69
|
-
readonly _tag: "Snapshot";
|
|
70
|
-
readonly id: SnapshotId;
|
|
71
|
-
}, "_tag">;
|
|
72
|
-
readonly Dockerfile: Data.TaggedEnum.ConstructorFrom<{
|
|
60
|
+
}, {
|
|
61
|
+
readonly _tag: Tag;
|
|
62
|
+
}> | Extract<{
|
|
73
63
|
readonly _tag: "Dockerfile";
|
|
74
64
|
readonly contents: string;
|
|
75
|
-
}, "_tag">;
|
|
76
|
-
readonly $is: <Tag extends "Default" | "Registry" | "Snapshot" | "Dockerfile">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
77
|
-
readonly _tag: "Default";
|
|
78
65
|
}, {
|
|
79
66
|
readonly _tag: Tag;
|
|
80
67
|
}> | Extract<{
|
|
@@ -87,70 +74,74 @@ declare const ImageRef: {
|
|
|
87
74
|
readonly id: SnapshotId;
|
|
88
75
|
}, {
|
|
89
76
|
readonly _tag: Tag;
|
|
90
|
-
}> | Extract<{
|
|
91
|
-
readonly _tag: "Dockerfile";
|
|
92
|
-
readonly contents: string;
|
|
93
|
-
}, {
|
|
94
|
-
readonly _tag: Tag;
|
|
95
77
|
}>;
|
|
96
78
|
readonly $match: {
|
|
97
|
-
<Cases extends {
|
|
98
|
-
readonly Default: (args: {
|
|
99
|
-
readonly _tag: "Default";
|
|
100
|
-
}) => any;
|
|
101
|
-
readonly Registry: (args: {
|
|
102
|
-
readonly _tag: "Registry";
|
|
103
|
-
readonly ref: string;
|
|
104
|
-
}) => any;
|
|
105
|
-
readonly Snapshot: (args: {
|
|
106
|
-
readonly _tag: "Snapshot";
|
|
107
|
-
readonly id: SnapshotId;
|
|
108
|
-
}) => any;
|
|
109
|
-
readonly Dockerfile: (args: {
|
|
110
|
-
readonly _tag: "Dockerfile";
|
|
111
|
-
readonly contents: string;
|
|
112
|
-
}) => any;
|
|
113
|
-
}>(cases: Cases): (value: {
|
|
79
|
+
<Cases extends { readonly [Tag in "Default" | "Dockerfile" | "Registry" | "Snapshot"]: (args: Extract<{
|
|
114
80
|
readonly _tag: "Default";
|
|
81
|
+
} | {
|
|
82
|
+
readonly _tag: "Dockerfile";
|
|
83
|
+
readonly contents: string;
|
|
115
84
|
} | {
|
|
116
85
|
readonly _tag: "Registry";
|
|
117
86
|
readonly ref: string;
|
|
118
87
|
} | {
|
|
119
88
|
readonly _tag: "Snapshot";
|
|
120
89
|
readonly id: SnapshotId;
|
|
90
|
+
}, {
|
|
91
|
+
readonly _tag: Tag;
|
|
92
|
+
}>) => any; }>(cases: Cases): (value: {
|
|
93
|
+
readonly _tag: "Default";
|
|
121
94
|
} | {
|
|
122
95
|
readonly _tag: "Dockerfile";
|
|
123
96
|
readonly contents: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
readonly
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
readonly
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}) => any;
|
|
133
|
-
readonly Snapshot: (args: {
|
|
134
|
-
readonly _tag: "Snapshot";
|
|
135
|
-
readonly id: SnapshotId;
|
|
136
|
-
}) => any;
|
|
137
|
-
readonly Dockerfile: (args: {
|
|
138
|
-
readonly _tag: "Dockerfile";
|
|
139
|
-
readonly contents: string;
|
|
140
|
-
}) => any;
|
|
141
|
-
}>(value: {
|
|
97
|
+
} | {
|
|
98
|
+
readonly _tag: "Registry";
|
|
99
|
+
readonly ref: string;
|
|
100
|
+
} | {
|
|
101
|
+
readonly _tag: "Snapshot";
|
|
102
|
+
readonly id: SnapshotId;
|
|
103
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Default" | "Dockerfile" | "Registry" | "Snapshot"]>>;
|
|
104
|
+
<Cases extends { readonly [Tag in "Default" | "Dockerfile" | "Registry" | "Snapshot"]: (args: Extract<{
|
|
142
105
|
readonly _tag: "Default";
|
|
106
|
+
} | {
|
|
107
|
+
readonly _tag: "Dockerfile";
|
|
108
|
+
readonly contents: string;
|
|
143
109
|
} | {
|
|
144
110
|
readonly _tag: "Registry";
|
|
145
111
|
readonly ref: string;
|
|
146
112
|
} | {
|
|
147
113
|
readonly _tag: "Snapshot";
|
|
148
114
|
readonly id: SnapshotId;
|
|
115
|
+
}, {
|
|
116
|
+
readonly _tag: Tag;
|
|
117
|
+
}>) => any; }>(value: {
|
|
118
|
+
readonly _tag: "Default";
|
|
149
119
|
} | {
|
|
150
120
|
readonly _tag: "Dockerfile";
|
|
151
121
|
readonly contents: string;
|
|
152
|
-
}
|
|
122
|
+
} | {
|
|
123
|
+
readonly _tag: "Registry";
|
|
124
|
+
readonly ref: string;
|
|
125
|
+
} | {
|
|
126
|
+
readonly _tag: "Snapshot";
|
|
127
|
+
readonly id: SnapshotId;
|
|
128
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Default" | "Dockerfile" | "Registry" | "Snapshot"]>>;
|
|
153
129
|
};
|
|
130
|
+
readonly Default: Data.TaggedEnum.ConstructorFrom<{
|
|
131
|
+
readonly _tag: "Default";
|
|
132
|
+
}, "_tag">;
|
|
133
|
+
readonly Dockerfile: Data.TaggedEnum.ConstructorFrom<{
|
|
134
|
+
readonly _tag: "Dockerfile";
|
|
135
|
+
readonly contents: string;
|
|
136
|
+
}, "_tag">;
|
|
137
|
+
readonly Registry: Data.TaggedEnum.ConstructorFrom<{
|
|
138
|
+
readonly _tag: "Registry";
|
|
139
|
+
readonly ref: string;
|
|
140
|
+
}, "_tag">;
|
|
141
|
+
readonly Snapshot: Data.TaggedEnum.ConstructorFrom<{
|
|
142
|
+
readonly _tag: "Snapshot";
|
|
143
|
+
readonly id: SnapshotId;
|
|
144
|
+
}, "_tag">;
|
|
154
145
|
};
|
|
155
146
|
/**
|
|
156
147
|
* Outbound network policy for a sandbox.
|
|
@@ -173,19 +164,10 @@ type NetworkPolicy = Data.TaggedEnum<{
|
|
|
173
164
|
};
|
|
174
165
|
}>;
|
|
175
166
|
declare const NetworkPolicy: {
|
|
176
|
-
readonly Open:
|
|
177
|
-
readonly _tag: "Open";
|
|
178
|
-
}, "_tag">;
|
|
179
|
-
readonly Blocked: Data.TaggedEnum.ConstructorFrom<{
|
|
180
|
-
readonly _tag: "Blocked";
|
|
181
|
-
}, "_tag">;
|
|
182
|
-
readonly Allowlist: Data.TaggedEnum.ConstructorFrom<{
|
|
167
|
+
readonly $is: <Tag extends "Allowlist" | "Blocked" | "Open">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
183
168
|
readonly _tag: "Allowlist";
|
|
184
169
|
readonly hosts?: ReadonlyArray<string>;
|
|
185
170
|
readonly cidrs?: ReadonlyArray<string>;
|
|
186
|
-
}, "_tag">;
|
|
187
|
-
readonly $is: <Tag extends "Open" | "Blocked" | "Allowlist">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
188
|
-
readonly _tag: "Open";
|
|
189
171
|
}, {
|
|
190
172
|
readonly _tag: Tag;
|
|
191
173
|
}> | Extract<{
|
|
@@ -193,56 +175,61 @@ declare const NetworkPolicy: {
|
|
|
193
175
|
}, {
|
|
194
176
|
readonly _tag: Tag;
|
|
195
177
|
}> | Extract<{
|
|
196
|
-
readonly _tag: "
|
|
197
|
-
readonly hosts?: ReadonlyArray<string>;
|
|
198
|
-
readonly cidrs?: ReadonlyArray<string>;
|
|
178
|
+
readonly _tag: "Open";
|
|
199
179
|
}, {
|
|
200
180
|
readonly _tag: Tag;
|
|
201
181
|
}>;
|
|
202
182
|
readonly $match: {
|
|
203
|
-
<Cases extends {
|
|
204
|
-
readonly
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
readonly Blocked: (args: {
|
|
208
|
-
readonly _tag: "Blocked";
|
|
209
|
-
}) => any;
|
|
210
|
-
readonly Allowlist: (args: {
|
|
211
|
-
readonly _tag: "Allowlist";
|
|
212
|
-
readonly hosts?: ReadonlyArray<string>;
|
|
213
|
-
readonly cidrs?: ReadonlyArray<string>;
|
|
214
|
-
}) => any;
|
|
215
|
-
}>(cases: Cases): (value: {
|
|
216
|
-
readonly _tag: "Open";
|
|
183
|
+
<Cases extends { readonly [Tag in "Allowlist" | "Blocked" | "Open"]: (args: Extract<{
|
|
184
|
+
readonly _tag: "Allowlist";
|
|
185
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
186
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
217
187
|
} | {
|
|
218
188
|
readonly _tag: "Blocked";
|
|
219
189
|
} | {
|
|
190
|
+
readonly _tag: "Open";
|
|
191
|
+
}, {
|
|
192
|
+
readonly _tag: Tag;
|
|
193
|
+
}>) => any; }>(cases: Cases): (value: {
|
|
220
194
|
readonly _tag: "Allowlist";
|
|
221
195
|
readonly hosts?: ReadonlyArray<string>;
|
|
222
196
|
readonly cidrs?: ReadonlyArray<string>;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
readonly _tag: "Open";
|
|
227
|
-
}) => any;
|
|
228
|
-
readonly Blocked: (args: {
|
|
229
|
-
readonly _tag: "Blocked";
|
|
230
|
-
}) => any;
|
|
231
|
-
readonly Allowlist: (args: {
|
|
232
|
-
readonly _tag: "Allowlist";
|
|
233
|
-
readonly hosts?: ReadonlyArray<string>;
|
|
234
|
-
readonly cidrs?: ReadonlyArray<string>;
|
|
235
|
-
}) => any;
|
|
236
|
-
}>(value: {
|
|
197
|
+
} | {
|
|
198
|
+
readonly _tag: "Blocked";
|
|
199
|
+
} | {
|
|
237
200
|
readonly _tag: "Open";
|
|
201
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Allowlist" | "Blocked" | "Open"]>>;
|
|
202
|
+
<Cases extends { readonly [Tag in "Allowlist" | "Blocked" | "Open"]: (args: Extract<{
|
|
203
|
+
readonly _tag: "Allowlist";
|
|
204
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
205
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
238
206
|
} | {
|
|
239
207
|
readonly _tag: "Blocked";
|
|
240
208
|
} | {
|
|
209
|
+
readonly _tag: "Open";
|
|
210
|
+
}, {
|
|
211
|
+
readonly _tag: Tag;
|
|
212
|
+
}>) => any; }>(value: {
|
|
241
213
|
readonly _tag: "Allowlist";
|
|
242
214
|
readonly hosts?: ReadonlyArray<string>;
|
|
243
215
|
readonly cidrs?: ReadonlyArray<string>;
|
|
244
|
-
}
|
|
216
|
+
} | {
|
|
217
|
+
readonly _tag: "Blocked";
|
|
218
|
+
} | {
|
|
219
|
+
readonly _tag: "Open";
|
|
220
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Allowlist" | "Blocked" | "Open"]>>;
|
|
245
221
|
};
|
|
222
|
+
readonly Allowlist: Data.TaggedEnum.ConstructorFrom<{
|
|
223
|
+
readonly _tag: "Allowlist";
|
|
224
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
225
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
226
|
+
}, "_tag">;
|
|
227
|
+
readonly Blocked: Data.TaggedEnum.ConstructorFrom<{
|
|
228
|
+
readonly _tag: "Blocked";
|
|
229
|
+
}, "_tag">;
|
|
230
|
+
readonly Open: Data.TaggedEnum.ConstructorFrom<{
|
|
231
|
+
readonly _tag: "Open";
|
|
232
|
+
}, "_tag">;
|
|
246
233
|
};
|
|
247
234
|
/**
|
|
248
235
|
* A secret bound to a sandbox at create time. The code inside the
|
|
@@ -284,7 +271,8 @@ type VolumeMount = {
|
|
|
284
271
|
* footgun we're avoiding.
|
|
285
272
|
*/
|
|
286
273
|
type CommonCreateRequest = {
|
|
287
|
-
/** Image / snapshot to boot from. Omit for the provider's default. */
|
|
274
|
+
/** Image / snapshot to boot from. Omit for the provider's default. */
|
|
275
|
+
readonly image?: ImageRef;
|
|
288
276
|
/**
|
|
289
277
|
* Idle / hard timeout. Accepts a number (millis), a string like
|
|
290
278
|
* `"30 seconds"`, or a `Duration`. Providers default differently.
|
|
@@ -294,7 +282,8 @@ type CommonCreateRequest = {
|
|
|
294
282
|
* Env vars exposed to the sandbox. NOT for secrets you want hidden
|
|
295
283
|
* from the running code — use {@link BoundSecret} instead.
|
|
296
284
|
*/
|
|
297
|
-
readonly env?: Readonly<Record<string, string>>;
|
|
285
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
286
|
+
/** Outbound network policy. */
|
|
298
287
|
readonly network?: NetworkPolicy;
|
|
299
288
|
/**
|
|
300
289
|
* Bound secrets — code inside the sandbox sees a placeholder; the
|
|
@@ -364,22 +353,10 @@ type ExecEvent = Data.TaggedEnum<{
|
|
|
364
353
|
};
|
|
365
354
|
}>;
|
|
366
355
|
declare const ExecEvent: {
|
|
367
|
-
readonly Stdout:
|
|
368
|
-
readonly _tag: "Stdout";
|
|
369
|
-
readonly chunk: Uint8Array;
|
|
370
|
-
}, "_tag">;
|
|
371
|
-
readonly Stderr: Data.TaggedEnum.ConstructorFrom<{
|
|
372
|
-
readonly _tag: "Stderr";
|
|
373
|
-
readonly chunk: Uint8Array;
|
|
374
|
-
}, "_tag">;
|
|
375
|
-
readonly Complete: Data.TaggedEnum.ConstructorFrom<{
|
|
356
|
+
readonly $is: <Tag extends "Complete" | "Stderr" | "Stdout">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
376
357
|
readonly _tag: "Complete";
|
|
377
358
|
readonly exitCode: number;
|
|
378
359
|
readonly durationMs: number;
|
|
379
|
-
}, "_tag">;
|
|
380
|
-
readonly $is: <Tag extends "Stdout" | "Stderr" | "Complete">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
381
|
-
readonly _tag: "Stdout";
|
|
382
|
-
readonly chunk: Uint8Array;
|
|
383
360
|
}, {
|
|
384
361
|
readonly _tag: Tag;
|
|
385
362
|
}> | Extract<{
|
|
@@ -388,64 +365,72 @@ declare const ExecEvent: {
|
|
|
388
365
|
}, {
|
|
389
366
|
readonly _tag: Tag;
|
|
390
367
|
}> | Extract<{
|
|
391
|
-
readonly _tag: "
|
|
392
|
-
readonly
|
|
393
|
-
readonly durationMs: number;
|
|
368
|
+
readonly _tag: "Stdout";
|
|
369
|
+
readonly chunk: Uint8Array;
|
|
394
370
|
}, {
|
|
395
371
|
readonly _tag: Tag;
|
|
396
372
|
}>;
|
|
397
373
|
readonly $match: {
|
|
398
|
-
<Cases extends {
|
|
399
|
-
readonly
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}) => any;
|
|
403
|
-
readonly Stderr: (args: {
|
|
404
|
-
readonly _tag: "Stderr";
|
|
405
|
-
readonly chunk: Uint8Array;
|
|
406
|
-
}) => any;
|
|
407
|
-
readonly Complete: (args: {
|
|
408
|
-
readonly _tag: "Complete";
|
|
409
|
-
readonly exitCode: number;
|
|
410
|
-
readonly durationMs: number;
|
|
411
|
-
}) => any;
|
|
412
|
-
}>(cases: Cases): (value: {
|
|
413
|
-
readonly _tag: "Stdout";
|
|
414
|
-
readonly chunk: Uint8Array;
|
|
374
|
+
<Cases extends { readonly [Tag in "Complete" | "Stderr" | "Stdout"]: (args: Extract<{
|
|
375
|
+
readonly _tag: "Complete";
|
|
376
|
+
readonly exitCode: number;
|
|
377
|
+
readonly durationMs: number;
|
|
415
378
|
} | {
|
|
416
379
|
readonly _tag: "Stderr";
|
|
417
380
|
readonly chunk: Uint8Array;
|
|
418
381
|
} | {
|
|
382
|
+
readonly _tag: "Stdout";
|
|
383
|
+
readonly chunk: Uint8Array;
|
|
384
|
+
}, {
|
|
385
|
+
readonly _tag: Tag;
|
|
386
|
+
}>) => any; }>(cases: Cases): (value: {
|
|
419
387
|
readonly _tag: "Complete";
|
|
420
388
|
readonly exitCode: number;
|
|
421
389
|
readonly durationMs: number;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
readonly
|
|
425
|
-
|
|
426
|
-
readonly chunk: Uint8Array;
|
|
427
|
-
}) => any;
|
|
428
|
-
readonly Stderr: (args: {
|
|
429
|
-
readonly _tag: "Stderr";
|
|
430
|
-
readonly chunk: Uint8Array;
|
|
431
|
-
}) => any;
|
|
432
|
-
readonly Complete: (args: {
|
|
433
|
-
readonly _tag: "Complete";
|
|
434
|
-
readonly exitCode: number;
|
|
435
|
-
readonly durationMs: number;
|
|
436
|
-
}) => any;
|
|
437
|
-
}>(value: {
|
|
390
|
+
} | {
|
|
391
|
+
readonly _tag: "Stderr";
|
|
392
|
+
readonly chunk: Uint8Array;
|
|
393
|
+
} | {
|
|
438
394
|
readonly _tag: "Stdout";
|
|
439
395
|
readonly chunk: Uint8Array;
|
|
396
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Complete" | "Stderr" | "Stdout"]>>;
|
|
397
|
+
<Cases extends { readonly [Tag in "Complete" | "Stderr" | "Stdout"]: (args: Extract<{
|
|
398
|
+
readonly _tag: "Complete";
|
|
399
|
+
readonly exitCode: number;
|
|
400
|
+
readonly durationMs: number;
|
|
440
401
|
} | {
|
|
441
402
|
readonly _tag: "Stderr";
|
|
442
403
|
readonly chunk: Uint8Array;
|
|
443
404
|
} | {
|
|
405
|
+
readonly _tag: "Stdout";
|
|
406
|
+
readonly chunk: Uint8Array;
|
|
407
|
+
}, {
|
|
408
|
+
readonly _tag: Tag;
|
|
409
|
+
}>) => any; }>(value: {
|
|
444
410
|
readonly _tag: "Complete";
|
|
445
411
|
readonly exitCode: number;
|
|
446
412
|
readonly durationMs: number;
|
|
447
|
-
}
|
|
413
|
+
} | {
|
|
414
|
+
readonly _tag: "Stderr";
|
|
415
|
+
readonly chunk: Uint8Array;
|
|
416
|
+
} | {
|
|
417
|
+
readonly _tag: "Stdout";
|
|
418
|
+
readonly chunk: Uint8Array;
|
|
419
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Complete" | "Stderr" | "Stdout"]>>;
|
|
448
420
|
};
|
|
421
|
+
readonly Complete: Data.TaggedEnum.ConstructorFrom<{
|
|
422
|
+
readonly _tag: "Complete";
|
|
423
|
+
readonly exitCode: number;
|
|
424
|
+
readonly durationMs: number;
|
|
425
|
+
}, "_tag">;
|
|
426
|
+
readonly Stderr: Data.TaggedEnum.ConstructorFrom<{
|
|
427
|
+
readonly _tag: "Stderr";
|
|
428
|
+
readonly chunk: Uint8Array;
|
|
429
|
+
}, "_tag">;
|
|
430
|
+
readonly Stdout: Data.TaggedEnum.ConstructorFrom<{
|
|
431
|
+
readonly _tag: "Stdout";
|
|
432
|
+
readonly chunk: Uint8Array;
|
|
433
|
+
}, "_tag">;
|
|
449
434
|
};
|
|
450
435
|
type FileEntryKind = "file" | "directory" | "symlink" | "other";
|
|
451
436
|
type FileEntry = {
|
|
@@ -565,9 +550,12 @@ type SandboxService = {
|
|
|
565
550
|
* Escape hatch for destroying a sandbox from outside its owning
|
|
566
551
|
* scope. Most callers should let the scope finalizer handle this.
|
|
567
552
|
*/
|
|
568
|
-
readonly destroy: (id: SandboxId) => Effect.Effect<void, SandboxError>;
|
|
569
|
-
|
|
570
|
-
readonly
|
|
553
|
+
readonly destroy: (id: SandboxId) => Effect.Effect<void, SandboxError>;
|
|
554
|
+
/** Snapshot management. Capability-gated on {@link SandboxSnapshots}. */
|
|
555
|
+
readonly snapshots: SandboxSnapshotsApi;
|
|
556
|
+
/** Volume management. Capability-gated on {@link SandboxVolumes}. */
|
|
557
|
+
readonly volumes: SandboxVolumesApi;
|
|
558
|
+
/** Port exposure. Capability-gated on {@link SandboxPortExposure}. */
|
|
571
559
|
readonly ports: SandboxPortsApi;
|
|
572
560
|
};
|
|
573
561
|
declare const Sandbox_base: Context.ServiceClass<Sandbox, "@betalyra/effect-uai/Sandbox", SandboxService>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sandbox.d.mts","names":[],"sources":["../../src/sandbox/Sandbox.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sandbox.d.mts","names":[],"sources":["../../src/sandbox/Sandbox.ts"],"mappings":"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"}
|
package/dist/sandbox/Sandbox.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __exportAll } from "../
|
|
1
|
+
import { n as __exportAll } from "../rolldown-runtime-EAsCxrDo.mjs";
|
|
2
2
|
import { Brand, Context, Data, Effect } from "effect";
|
|
3
3
|
//#region src/sandbox/Sandbox.ts
|
|
4
4
|
var Sandbox_exports = /* @__PURE__ */ __exportAll({
|