diff --git a/.changeset/bun-microvm-code-executor.md b/.changeset/bun-microvm-code-executor.md new file mode 100644 index 00000000..c9fc6483 --- /dev/null +++ b/.changeset/bun-microvm-code-executor.md @@ -0,0 +1,9 @@ +--- +"@systemfsoftware/agent-platform-bun": minor +--- + +Add `microVmCodeExecutorLayer` to a Bun platform package: each pass runs model-written JavaScript on Bun in a fresh hardware-isolated microVM whose network device is disabled before boot, so `NetworkDisabled` is enforced by the isolation boundary. Inside the guest the workload runs as an unprivileged user on a read-only root with one writable scratch directory, receives no host environment or credentials, and reads only host directories mounted read-only through `readOnlyMounts`. A host without hardware virtualization fails the pass with `CodeExecutorStartError`, while `NetworkAllowlist`, `cpuMillis`, and a namespace named `console` are refused with `CodeExecutorUnsupportedError`. + +```ts +import { microVmCodeExecutorLayer } from '@systemfsoftware/agent-platform-bun/code-executor' +``` diff --git a/AGENTS.md b/AGENTS.md index 2bbbe045..5d9ba366 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,8 +1,8 @@ # agent -Effect-native agents with durable Threads, published as eleven packages: `@systemfsoftware/agent`, -`@systemfsoftware/agent-ai-decision`, `@systemfsoftware/agent-platform-cloudflare`, -`@systemfsoftware/agent-platform-node`, `@systemfsoftware/agent-pr-review`, +Effect-native agents with durable Threads, published as twelve packages: `@systemfsoftware/agent`, +`@systemfsoftware/agent-ai-decision`, `@systemfsoftware/agent-platform-bun`, +`@systemfsoftware/agent-platform-cloudflare`, `@systemfsoftware/agent-platform-node`, `@systemfsoftware/agent-pr-review`, `@systemfsoftware/agent-storage-cloudflare`, `@systemfsoftware/agent-storage-memory`, `@systemfsoftware/agent-storage-postgres`, `@systemfsoftware/agent-storage-sql`, `@systemfsoftware/agent-storage-sqlite` and `@systemfsoftware/agent-testing`, beside the private diff --git a/docs/src/content/docs/guide/sandbox.md b/docs/src/content/docs/guide/sandbox.md index 8f404052..6d09277a 100644 --- a/docs/src/content/docs/guide/sandbox.md +++ b/docs/src/content/docs/guide/sandbox.md @@ -13,7 +13,15 @@ JavaScript over allowlisted tools and [browser services](/guide/browser/) for we `CodeExecutor` gives one generated program a narrow host-call capability; it does not grant a shell. The Cloudflare adapter runs each pass in a fresh Dynamic Worker with ambient network -access disabled. Calls into application tools still require the host's current authorization. +access disabled. The Bun adapter (`@systemfsoftware/agent-platform-bun/code-executor`) runs each +pass in a fresh hardware-isolated microVM whose network device is disabled before boot; it +requires hardware virtualization (KVM on Linux, Hypervisor.framework on Apple Silicon, or +Windows Hypervisor Platform), pulls its guest image on first use, and fails the pass with +`CodeExecutorStartError` when the host cannot start a VM. +Inside the Bun guest the workload runs as an unprivileged user on a read-only root with one +writable scratch directory, receives no host environment or credentials, and can read only the +library directories the host mounts read-only. Calls into application tools still require the +host's current authorization. Browser adapters own network access and page lifetimes separately. Their configuration controls which destinations and browser capabilities a session can use. Keep credentials and resource diff --git a/packages/platform-bun/package.json b/packages/platform-bun/package.json new file mode 100644 index 00000000..f76fe375 --- /dev/null +++ b/packages/platform-bun/package.json @@ -0,0 +1,61 @@ +{ + "name": "@systemfsoftware/agent-platform-bun", + "version": "0.0.0", + "description": "Bun platform adapters for Effect Agent: an isolated microVM CodeExecutor for generated JavaScript.", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/systemfsoftware/agent.git", + "directory": "packages/platform-bun" + }, + "files": [ + "dist", + "src" + ], + "type": "module", + "sideEffects": [], + "exports": { + ".": "./src/index.ts", + "./code-executor": "./src/CodeExecutor.ts" + }, + "publishConfig": { + "access": "public", + "exports": { + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "./code-executor": { + "types": "./dist/CodeExecutor.d.mts", + "default": "./dist/CodeExecutor.mjs" + } + }, + "provenance": true + }, + "scripts": { + "build": "tsdown", + "typecheck": "tsc -b", + "test": "vitest run --passWithNoTests", + "test:conformance-bun": "bun run tests/__fixtures__/conformance-runner.ts", + "check:pack": "pnpm pack --pack-destination .pack && attw .pack/*.tgz --profile esm-only; s=$?; rm -rf .pack; exit $s" + }, + "dependencies": { + "@systemfsoftware/agent": "workspace:*", + "microsandbox": "catalog:" + }, + "devDependencies": { + "@arethetypeswrong/cli": "catalog:", + "@effect/platform-bun": "catalog:", + "@effect/platform-node": "catalog:", + "@systemfsoftware/agent-testing": "workspace:*", + "@systemfsoftware/effect-gherkin-spec": "catalog:", + "@systemfsoftware/vitest": "catalog:", + "effect": "catalog:", + "tsdown": "catalog:", + "typescript": "catalog:", + "vitest": "catalog:" + }, + "peerDependencies": { + "effect": "^4.1.0" + } +} diff --git a/packages/platform-bun/src/CodeExecutor.ts b/packages/platform-bun/src/CodeExecutor.ts new file mode 100644 index 00000000..71d382e2 --- /dev/null +++ b/packages/platform-bun/src/CodeExecutor.ts @@ -0,0 +1,854 @@ +import { + type CodeExecutionError, + CodeExecutionHost, + CodeExecutionProtocolError, + type CodeExecutionRequest, + CodeExecutionResourceUse, + CodeExecutionResult, + CodeExecutionTimeoutError, + CodeExecutor, + type CodeExecutorExecute, + CodeExecutorStartError, + CodeExecutorTerminatedError, + CodeExecutorUnsupportedError, + CodeHostCall, + CodeHostCallLimitError, + CodeHostCallResult, + CodeOutputLimitError, + CodeProgramFailedError, + CodeSourceError, + type JsIdentifier, +} from '@systemfsoftware/agent/code-executor' +import { SANDBOX_DIAGNOSTIC_MAX_LENGTH, SandboxImplementation } from '@systemfsoftware/agent/sandbox' +import * as Clock from 'effect/Clock' +import * as Deferred from 'effect/Deferred' +import * as Duration from 'effect/Duration' +import * as Effect from 'effect/Effect' +import * as HashSet from 'effect/HashSet' +import * as Layer from 'effect/Layer' +import * as Match from 'effect/Match' +import * as Option from 'effect/Option' +import * as Queue from 'effect/Queue' +import * as Random from 'effect/Random' +import * as Schema from 'effect/Schema' +import type * as Scope from 'effect/Scope' +import * as Semaphore from 'effect/Semaphore' +import type { ExecEvent, ExecHandle, ExecSink, Sandbox as MicroSandbox } from 'microsandbox' + +import { codeExecutorGuestSource } from './internal/code-executor-guest' +import { + type GuestCall, + type GuestConfig, + GuestConfig as GuestConfigSchema, + GuestMessage, + type GuestOutcome, + type GuestResponse, + GuestResponse as GuestResponseSchema, +} from './internal/code-executor.schema' + +export const microVmCodeExecutorImplementation = SandboxImplementation.make({ + isolation: 'isolated', + identity: 'bun-microvm-javascript', +}) + +const GUEST_DIR = '/opt/code-executor' +const GUEST_HARNESS_PATH = `${GUEST_DIR}/harness.mjs` +const GUEST_CONFIG_PATH = `${GUEST_DIR}/pass.json` +const GUEST_SCRATCH = '/scratch' +const SCRATCH_UID = 65_534 +const SCRATCH_GID = 65_534 +const GUEST_USER = `${SCRATCH_UID}:${SCRATCH_GID}` +const DEFAULT_SCRATCH_MIB = 64 +const DEFAULT_IMAGE = 'oven/bun:1-alpine' +const PROVISION_SCRIPT = + `chown ${SCRATCH_UID}:${SCRATCH_GID} ${GUEST_SCRATCH} && chmod 700 ${GUEST_SCRATCH} && mount -o remount,ro / && mount -o remount,ro /dev/shm` +const GUEST_READY_TIMEOUT = Duration.seconds(60) +const MAX_PROTOCOL_LINE_BYTES = 16 * 1024 * 1024 +const RESERVED_NAMESPACE = 'console' + +const reservedNamespaces = HashSet.fromIterable([RESERVED_NAMESPACE]) +const decodeGuestLine = Schema.decodeUnknownOption(Schema.fromJsonString(GuestMessage)) +const encodeGuestResponse = Schema.encodeOption(Schema.fromJsonString(GuestResponseSchema)) +const encodeGuestConfig = Schema.encodeOption(Schema.fromJsonString(GuestConfigSchema)) +const encodeJson = Schema.encodeOption(Schema.fromJsonString(Schema.Json)) + +const utf8ByteLength = (value: string): number => new TextEncoder().encode(value).byteLength + +const boundedMessage = (value: string): string => value.slice(0, SANDBOX_DIAGNOSTIC_MAX_LENGTH) + +const jsonText = (value: Schema.Json): Option.Option => encodeJson(value) + +const protocolError = (message: string): CodeExecutionProtocolError => + CodeExecutionProtocolError.make({ + implementation: microVmCodeExecutorImplementation, + message: boundedMessage(message), + }) + +const terminatedError = (detail: string): CodeExecutorTerminatedError => + CodeExecutorTerminatedError.make({ + implementation: microVmCodeExecutorImplementation, + message: boundedMessage(`The guest harness stopped without a program result: ${detail}`), + }) + +const startError = (message: string): CodeExecutorStartError => + CodeExecutorStartError.make({ + implementation: microVmCodeExecutorImplementation, + message: boundedMessage(message), + }) + +const unsupported = ( + feature: 'network' | 'cpu-limit' | 'namespaces', + message: string, +): CodeExecutorUnsupportedError => + CodeExecutorUnsupportedError.make({ + implementation: microVmCodeExecutorImplementation, + feature, + message, + }) + +export interface ReadOnlyMount { + readonly host: string + readonly guest: string +} + +export interface MicroVmCodeExecutorOptions { + readonly image?: string + readonly scratchMiB?: number + readonly readOnlyMounts?: ReadonlyArray +} + +const checkNetwork = ( + request: CodeExecutionRequest, +): Effect.Effect => + Match.value(request.network).pipe( + Match.tag('NetworkDisabled', () => Effect.void), + Match.tag('NetworkAllowlist', () => + Effect.fail( + unsupported( + 'network', + 'The microVM executor boots with its network device disabled; it cannot enforce an egress allowlist, so only NetworkDisabled is accepted', + ), + )), + Match.exhaustive, + ) + +const checkCpu = ( + request: CodeExecutionRequest, +): Effect.Effect => + request.limits.cpuMillis === undefined + ? Effect.void + : Effect.fail( + unsupported( + 'cpu-limit', + 'A microVM exposes a vCPU count, not a CPU-millisecond budget; this executor cannot enforce cpuMillis', + ), + ) + +const reservedCollision = (name: JsIdentifier): string | undefined => + HashSet.has(reservedNamespaces, name) ? 'the harness console' : undefined + +const duplicateCollision = ( + seen: HashSet.HashSet, + name: JsIdentifier, +): string | undefined => HashSet.has(seen, name) ? 'another namespace' : undefined + +const collisionOf = ( + seen: HashSet.HashSet, + name: JsIdentifier, +): string | undefined => { + const reserved = reservedCollision(name) + + return reserved === undefined ? duplicateCollision(seen, name) : reserved +} + +const refuseCollision = ( + name: JsIdentifier, + collision: string | undefined, +): Effect.Effect => + collision === undefined + ? Effect.void + : Effect.fail(unsupported('namespaces', `Namespace ${name} collides with ${collision}`)) + +const checkNamespaces = ( + request: CodeExecutionRequest, +): Effect.Effect => + Effect.gen(function*() { + let seen = HashSet.empty() + + for (const namespace of request.namespaces) { + yield* refuseCollision(namespace.name, collisionOf(seen, namespace.name)) + seen = HashSet.add(seen, namespace.name) + } + }) + +const checkSourceSize = ( + request: CodeExecutionRequest, +): Effect.Effect => + Effect.gen(function*() { + const sourceBytes = utf8ByteLength(request.source) + + if (sourceBytes <= request.limits.maxSourceBytes) return + return yield* CodeSourceError.make({ + implementation: microVmCodeExecutorImplementation, + reason: 'oversized', + message: boundedMessage( + `Source is ${sourceBytes} bytes; the request allows ${request.limits.maxSourceBytes}`, + ), + }) + }) + +const validateRequest = ( + request: CodeExecutionRequest, +): Effect.Effect => + Effect.gen(function*() { + yield* checkNetwork(request) + yield* checkCpu(request) + yield* checkNamespaces(request) + yield* checkSourceSize(request) + }) + +interface GuestPatch { + mkdir(path: string, opts?: { readonly mode?: number }): GuestPatch + text(path: string, content: string, opts?: { readonly mode?: number }): GuestPatch +} + +interface SandboxSetup { + readonly image: string + readonly scratchMiB: number + readonly readOnlyMounts: ReadonlyArray +} + +interface GuestProcess { + readonly handle: ExecHandle + readonly sink: ExecSink +} + +interface PassCounter { + calls: number +} + +let sandboxSequence = 0 + +const nextSandboxName = (entropy: number, second: number): string => { + sandboxSequence += 1 + + return `agent-code-executor-${entropy}-${second}-${sandboxSequence}` +} + +const imageOf = (options: MicroVmCodeExecutorOptions): string => options.image ?? DEFAULT_IMAGE +const scratchOf = (options: MicroVmCodeExecutorOptions): number => options.scratchMiB ?? DEFAULT_SCRATCH_MIB +const mountsOf = (options: MicroVmCodeExecutorOptions): ReadonlyArray => options.readOnlyMounts ?? [] + +const setupOf = (options: MicroVmCodeExecutorOptions): SandboxSetup => ({ + image: imageOf(options), + scratchMiB: scratchOf(options), + readOnlyMounts: mountsOf(options), +}) + +const guestPatch = (configText: string) => (patch: GuestPatch): GuestPatch => + patch + .mkdir('/opt', { mode: 0o755 }) + .mkdir(GUEST_DIR, { mode: 0o755 }) + .text(GUEST_HARNESS_PATH, codeExecutorGuestSource, { mode: 0o444 }) + .text(GUEST_CONFIG_PATH, configText, { mode: 0o444 }) + +interface GuestPackageMount { + tmpfs(): GuestPackageMount + size(mib: number): GuestPackageMount + bind(host: string): GuestPackageMount + readonly(): GuestPackageMount + noexec(): GuestPackageMount + nosuid(): GuestPackageMount + nodev(): GuestPackageMount +} + +const createSandbox = async ( + config: GuestConfig, + setup: SandboxSetup, + name: string, +): Promise => { + const { Sandbox } = await import('microsandbox') + + const configText = Option.getOrElse(encodeGuestConfig(config), () => '') + const builder = Sandbox.builder(name) + .image(setup.image) + .ephemeral(true) + .disableNetwork() + .volume(GUEST_SCRATCH, (mount: GuestPackageMount) => mount.tmpfs().size(setup.scratchMiB)) + .patch(guestPatch(configText)) + + for (const mount of setup.readOnlyMounts) { + builder.volume( + mount.guest, + (volume: GuestPackageMount) => volume.bind(mount.host).readonly().noexec().nosuid().nodev(), + ) + } + + return await builder.create() +} + +const launchSandbox = ( + config: GuestConfig, + setup: SandboxSetup, + name: string, +): Effect.Effect => + Effect.tryPromise({ + try: () => createSandbox(config, setup, name), + catch: (cause) => + startError( + cause instanceof Error ? `The microVM could not start: ${cause.message}` : 'The microVM could not start', + ), + }) + +const provisionSandbox = (sandbox: MicroSandbox): Effect.Effect => + Effect.tryPromise({ + try: async () => { + const result = await sandbox.exec('sh', ['-c', PROVISION_SCRIPT]) + + if (result.code !== 0) { + throw new Error(`provisioning exited ${result.code}: ${result.stderr()}`) + } + }, + catch: (cause) => + startError( + cause instanceof Error + ? `The microVM could not be sealed: ${cause.message}` + : 'The microVM could not be sealed', + ), + }) + +const stopSandbox = (sandbox: MicroSandbox): Effect.Effect => + Effect.tryPromise({ + try: () => sandbox.destroy({ force: true }), + catch: () => 'the microVM teardown failed', + }).pipe(Effect.ignore) + +const openGuestProcess = (sandbox: MicroSandbox): Effect.Effect => + Effect.gen(function*() { + const handle = yield* Effect.tryPromise({ + try: () => + sandbox.execStreamWith('bun', (builder) => + builder + .arg(GUEST_HARNESS_PATH) + .arg(GUEST_CONFIG_PATH) + .cwd(GUEST_SCRATCH) + .user(GUEST_USER) + .env('HOME', GUEST_SCRATCH) + .env('TMPDIR', GUEST_SCRATCH) + .stdinPipe()), + catch: () => startError('The guest harness could not start'), + }) + const sink = yield* Effect.tryPromise({ + try: () => handle.takeStdin(), + catch: () => startError('The guest harness stdin could not be opened'), + }) + + if (sink === null) return yield* startError('The guest harness stdin is unavailable') + return { handle, sink } + }) + +const guestConfigOf = (request: CodeExecutionRequest): GuestConfig => ({ + source: request.source, + namespaces: request.namespaces.map((namespace) => ({ + name: namespace.name, + methods: namespace.methods, + })), + limits: { + maxLogBytes: request.limits.maxLogBytes, + maxResultBytes: request.limits.maxResultBytes, + maxHostCallArgumentBytes: request.limits.maxHostCallArgumentBytes, + }, +}) + +const hostCallLimit = (request: CodeExecutionRequest): CodeHostCallLimitError => + CodeHostCallLimitError.make({ + implementation: microVmCodeExecutorImplementation, + limit: request.limits.maxHostCalls, + logs: [], + }) + +const surfaceLimit = ( + request: CodeExecutionRequest, +): Record<'logs' | 'result' | 'host-call-argument' | 'host-call-result', number> => ({ + logs: request.limits.maxLogBytes, + result: request.limits.maxResultBytes, + 'host-call-argument': request.limits.maxHostCallArgumentBytes, + 'host-call-result': request.limits.maxHostCallResultBytes, +}) + +const outputLimit = ( + surface: 'logs' | 'result' | 'host-call-argument' | 'host-call-result', + request: CodeExecutionRequest, + observed: number, +): CodeOutputLimitError => + CodeOutputLimitError.make({ + implementation: microVmCodeExecutorImplementation, + surface, + limit: surfaceLimit(request)[surface], + observed, + logs: [], + }) + +interface PassContext { + readonly request: CodeExecutionRequest + readonly host: CodeExecutionHost['Service'] + readonly process: GuestProcess + readonly ready: Deferred.Deferred + readonly terminal: Deferred.Deferred + readonly hostCalls: Queue.Queue + readonly writePermit: Semaphore.Semaphore + readonly counter: PassCounter + readonly failPass: (error: CodeExecutionError) => Effect.Effect +} + +const makeFailPass = ( + ready: Deferred.Deferred, + terminal: Deferred.Deferred, +) => +(error: CodeExecutionError): Effect.Effect => + Deferred.fail(terminal, error).pipe( + Effect.andThen(Deferred.fail(ready, error)), + Effect.asVoid, + ) + +const routeMessage = (context: PassContext, message: typeof GuestMessage.Type): Effect.Effect => + Match.value(message).pipe( + Match.discriminator('t')('call', (call) => Queue.offer(context.hostCalls, call).pipe(Effect.asVoid)), + Match.discriminator('t')('ready', () => Deferred.succeed(context.ready, undefined).pipe(Effect.asVoid)), + Match.discriminator('t')('completed', (outcome) => Deferred.succeed(context.terminal, outcome).pipe(Effect.asVoid)), + Match.discriminator('t')('failed', (outcome) => Deferred.succeed(context.terminal, outcome).pipe(Effect.asVoid)), + Match.discriminator('t')( + 'source-invalid', + (outcome) => Deferred.succeed(context.terminal, outcome).pipe(Effect.asVoid), + ), + Match.discriminator('t')( + 'source-not-a-function', + (outcome) => Deferred.succeed(context.terminal, outcome).pipe(Effect.asVoid), + ), + Match.discriminator('t')('log-limit', (outcome) => Deferred.succeed(context.terminal, outcome).pipe(Effect.asVoid)), + Match.discriminator('t')( + 'result-limit', + (outcome) => Deferred.succeed(context.terminal, outcome).pipe(Effect.asVoid), + ), + Match.exhaustive, + ) + +const handleLine = (context: PassContext, text: string): Effect.Effect => + Effect.gen(function*() { + const message = decodeGuestLine(text) + + if (Option.isNone(message)) { + return yield* context.failPass(protocolError('The guest produced a value outside the pass protocol')) + } + yield* routeMessage(context, message.value) + }) + +const consumeLine = (context: PassContext, text: string): Effect.Effect => + text === '' ? Effect.void : handleLine(context, text) + +const drainLines = (context: PassContext, state: { line: string }): Effect.Effect => + Effect.gen(function*() { + let index = state.line.indexOf('\n') + + while (index >= 0) { + const complete = state.line.slice(0, index) + state.line = state.line.slice(index + 1) + yield* consumeLine(context, complete) + index = state.line.indexOf('\n') + } + }) + +const appendStdout = (context: PassContext, state: ReadState, data: Uint8Array): Effect.Effect => + Effect.gen(function*() { + state.line += state.decoder.decode(data, { stream: true }) + + if (state.line.length > MAX_PROTOCOL_LINE_BYTES) { + return yield* context.failPass(protocolError('The guest exceeded the pass protocol line bound')) + } + yield* drainLines(context, state) + }) + +const appendStderr = (state: ReadState, data: Uint8Array): Effect.Effect => + Effect.sync(() => { + state.stderr = (state.stderr + state.decoder.decode(data, { stream: true })).slice( + -SANDBOX_DIAGNOSTIC_MAX_LENGTH, + ) + }) + +const applyEvent = (context: PassContext, state: ReadState, event: ExecEvent): Effect.Effect => + Match.value(event).pipe( + Match.discriminator('kind')('started', () => Effect.void), + Match.discriminator('kind')('stdout', (chunk) => appendStdout(context, state, chunk.data)), + Match.discriminator('kind')('stderr', (chunk) => appendStderr(state, chunk.data)), + Match.discriminator('kind')('exited', (exit) => + Effect.sync(() => { + state.exitCode = exit.code + })), + Match.exhaustive, + ) + +const exitDetail = (state: ReadState): string => + state.exitCode === undefined ? 'the event stream closed' : `exit ${state.exitCode} ${state.stderr}` + +const finishRead = (context: PassContext, state: ReadState): Effect.Effect => + Effect.gen(function*() { + const done = yield* Deferred.isDone(context.terminal) + + if (done) return + yield* context.failPass(terminatedError(exitDetail(state))) + }) + +const nextEvent = (context: PassContext, handle: ExecHandle): Effect.Effect => + Effect.tryPromise({ + try: () => handle.recv(), + catch: () => 'the event stream failed', + }).pipe(Effect.catch((detail) => context.failPass(terminatedError(detail)).pipe(Effect.as(null)))) + +interface ReadState { + line: string + stderr: string + exitCode: number | undefined + readonly decoder: TextDecoder +} + +const readEvents = (context: PassContext, handle: ExecHandle): Effect.Effect => + Effect.gen(function*() { + const state: ReadState = { + line: '', + stderr: '', + exitCode: undefined, + decoder: new TextDecoder(), + } + let event: ExecEvent | null = yield* nextEvent(context, handle) + + while (event !== null) { + yield* applyEvent(context, state, event) + event = yield* nextEvent(context, handle) + } + yield* finishRead(context, state) + }) + +const respond = (context: PassContext, message: GuestResponse): Effect.Effect => + Effect.gen(function*() { + const text = encodeGuestResponse(message) + + if (Option.isNone(text)) { + return yield* context.failPass(protocolError('The host response could not be encoded')) + } + yield* context.writePermit.withPermits(1)( + Effect.tryPromise({ + try: () => context.process.sink.write(`${text.value}\n`), + catch: () => 'the host response could not be written', + }).pipe(Effect.catch((detail) => context.failPass(terminatedError(detail)))), + ) + }) + +const admitCallCount = (context: PassContext): Effect.Effect => + Effect.gen(function*() { + context.counter.calls += 1 + + if (context.counter.calls <= context.request.limits.maxHostCalls) return true + yield* context.failPass(hostCallLimit(context.request)) + return false + }) + +const admitArgumentBytes = (context: PassContext, call: GuestCall): Effect.Effect => + Effect.gen(function*() { + const bytes = Option.match(jsonText(call.argument), { onNone: () => 0, onSome: utf8ByteLength }) + + if (bytes <= context.request.limits.maxHostCallArgumentBytes) return true + yield* context.failPass(outputLimit('host-call-argument', context.request, bytes)) + return false + }) + +const admitCall = (context: PassContext, call: GuestCall): Effect.Effect => + Effect.gen(function*() { + const counted = yield* admitCallCount(context) + + if (!counted) return false + return yield* admitArgumentBytes(context, call) + }) + +const respondSuccess = ( + context: PassContext, + call: GuestCall, + value: Schema.Json, +): Effect.Effect => + Effect.gen(function*() { + const bytes = Option.match(jsonText(value), { onNone: () => 0, onSome: utf8ByteLength }) + + if (bytes > context.request.limits.maxHostCallResultBytes) { + return yield* context.failPass(outputLimit('host-call-result', context.request, bytes)) + } + yield* respond(context, { t: 'response', id: call.id, ok: true, value }) + }) + +const settleHostOutcome = ( + context: PassContext, + call: GuestCall, + outcome: CodeHostCallResult, +): Effect.Effect => + Match.value(outcome).pipe( + Match.tag('CodeHostCallFailure', (failure) => + respond(context, { t: 'response', id: call.id, ok: false, error: failure.error })), + Match.tag('CodeHostCallSuccess', (success) => + respondSuccess(context, call, success.value)), + Match.exhaustive, + ) + +const serveHostCall = (context: PassContext, call: GuestCall): Effect.Effect => + Effect.gen(function*() { + const admitted = yield* admitCall(context, call) + + if (!admitted) return + yield* relayHostCall(context, call) + }) + +const relayHostCall = (context: PassContext, call: GuestCall): Effect.Effect => + Effect.gen(function*() { + const outcome = yield* context.host.call( + CodeHostCall.make({ namespace: call.namespace, method: call.method, argument: call.argument }), + ) + const decoded = Schema.decodeOption(CodeHostCallResult)(outcome) + + if (Option.isNone(decoded)) { + return yield* context.failPass( + protocolError('The execution host returned a value outside the CodeHostCallResult schema'), + ) + } + yield* settleHostOutcome(context, call, decoded.value) + }) + +const serveHostCalls = (context: PassContext): Effect.Effect => + Effect.forever(Queue.take(context.hostCalls).pipe(Effect.flatMap((call) => serveHostCall(context, call)))) + +const resultLimit = (request: CodeExecutionRequest, observed: number): CodeOutputLimitError => + CodeOutputLimitError.make({ + implementation: microVmCodeExecutorImplementation, + surface: 'result', + limit: request.limits.maxResultBytes, + observed, + logs: [], + }) + +const encodedResultBytes = (value: Schema.Json): Effect.Effect => + Option.match(jsonText(value), { + onNone: () => Effect.fail(protocolError('The guest program value could not be re-encoded')), + onSome: (text) => Effect.succeed(utf8ByteLength(text)), + }) + +const withinResultLimit = ( + request: CodeExecutionRequest, + bytes: number, +): Effect.Effect => + bytes <= request.limits.maxResultBytes + ? Effect.succeed(bytes) + : Effect.fail(resultLimit(request, bytes)) + +const measureResult = ( + request: CodeExecutionRequest, + value: Schema.Json, +): Effect.Effect => + Effect.gen(function*() { + const bytes = yield* encodedResultBytes(value) + return yield* withinResultLimit(request, bytes) + }) + +const resourceUse = ( + startedAt: number, + finishedAt: number, + counter: PassCounter, + logBytes: number, + resultBytes: number, +): CodeExecutionResourceUse => + CodeExecutionResourceUse.make({ + wallTime: Duration.millis(Math.max(0, finishedAt - startedAt)), + hostCalls: counter.calls, + logBytes, + resultBytes, + }) + +const completePass = ( + context: PassContext, + outcome: Extract, + startedAt: number, + finishedAt: number, +): Effect.Effect => + Effect.gen(function*() { + const resultBytes = yield* measureResult(context.request, outcome.value) + + return CodeExecutionResult.make({ + implementation: microVmCodeExecutorImplementation, + value: outcome.value, + logs: outcome.logs, + resourceUse: resourceUse( + startedAt, + finishedAt, + context.counter, + outcome.logBytes, + resultBytes, + ), + }) + }) + +const settleOutcome = ( + context: PassContext, + outcome: GuestOutcome, + startedAt: number, + finishedAt: number, +): Effect.Effect => + Match.value(outcome).pipe( + Match.discriminator('t')('completed', (completed) => completePass(context, completed, startedAt, finishedAt)), + Match.discriminator('t')('failed', (failed) => + Effect.fail( + CodeProgramFailedError.make({ + implementation: microVmCodeExecutorImplementation, + reason: failed.reason, + thrown: failed.thrown, + message: boundedMessage(failed.message), + logs: failed.logs, + }), + )), + Match.discriminator('t')('source-invalid', (invalid) => + Effect.fail( + CodeSourceError.make({ + implementation: microVmCodeExecutorImplementation, + reason: 'invalid', + message: boundedMessage(invalid.message), + }), + )), + Match.discriminator('t')('source-not-a-function', (notAFunction) => + Effect.fail( + CodeSourceError.make({ + implementation: microVmCodeExecutorImplementation, + reason: 'not-a-function', + message: boundedMessage( + `The source expression evaluated to ${notAFunction.actual}; it must evaluate to one async function`, + ), + }), + )), + Match.discriminator('t')('log-limit', (limit) => + Effect.fail( + CodeOutputLimitError.make({ + implementation: microVmCodeExecutorImplementation, + surface: 'logs', + limit: context.request.limits.maxLogBytes, + observed: limit.observed, + logs: limit.logs, + }), + )), + Match.discriminator('t')('result-limit', (limit) => + Effect.fail( + CodeOutputLimitError.make({ + implementation: microVmCodeExecutorImplementation, + surface: 'result', + limit: context.request.limits.maxResultBytes, + observed: limit.observed, + logs: limit.logs, + }), + )), + Match.exhaustive, + ) + +const makePassContext = ( + request: CodeExecutionRequest, + host: CodeExecutionHost['Service'], + process: GuestProcess, +): Effect.Effect => + Effect.gen(function*() { + const ready = yield* Deferred.make() + const terminal = yield* Deferred.make() + + return { + request, + host, + process, + ready, + terminal, + hostCalls: yield* Queue.unbounded(), + writePermit: yield* Semaphore.make(1), + counter: { calls: 0 }, + failPass: makeFailPass(ready, terminal), + } + }) + +const awaitReady = (ready: Deferred.Deferred): Effect.Effect => + Deferred.await(ready).pipe( + Effect.timeoutOrElse({ + duration: GUEST_READY_TIMEOUT, + orElse: () => startError('The guest harness did not report ready'), + }), + ) + +const awaitOutcome = ( + request: CodeExecutionRequest, + terminal: Deferred.Deferred, +): Effect.Effect => + Deferred.await(terminal).pipe( + Effect.timeoutOrElse({ + duration: request.limits.maxWallTime, + orElse: () => + CodeExecutionTimeoutError.make({ + implementation: microVmCodeExecutorImplementation, + kind: 'wall-clock', + maxWallTime: request.limits.maxWallTime, + logs: [], + }), + }), + ) + +const runGuestPass = ( + request: CodeExecutionRequest, + host: CodeExecutionHost['Service'], + process: GuestProcess, +): Effect.Effect => + Effect.gen(function*() { + const context = yield* makePassContext(request, host, process) + const concurrency = request.limits.maxHostCallConcurrency ?? 4 + + yield* readEvents(context, process.handle).pipe(Effect.forkScoped) + yield* Effect.forEach( + Array.from({ length: concurrency }, () => serveHostCalls(context)), + (server) => server, + { concurrency, discard: true }, + ).pipe(Effect.forkScoped) + + yield* awaitReady(context.ready) + const startedAt = yield* Clock.currentTimeMillis + const outcome = yield* awaitOutcome(request, context.terminal) + const finishedAt = yield* Clock.currentTimeMillis + + return yield* settleOutcome(context, outcome, startedAt, finishedAt) + }) + +const makeExecute = (options: MicroVmCodeExecutorOptions): CodeExecutorExecute => + Effect.fnUntraced(function*( + request, + ): Effect.fn.Return< + CodeExecutionResult, + CodeExecutionError, + Scope.Scope | CodeExecutionHost + > { + yield* validateRequest(request) + + const host = yield* CodeExecutionHost + const entropy = yield* Random.nextInt + const second = yield* Random.nextInt + const sandbox = yield* Effect.acquireRelease( + launchSandbox(guestConfigOf(request), setupOf(options), nextSandboxName(entropy, second)), + stopSandbox, + ) + yield* provisionSandbox(sandbox) + const process = yield* openGuestProcess(sandbox) + + return yield* runGuestPass(request, host, process) + }) + +export const microVmCodeExecutorLayer = ( + options: MicroVmCodeExecutorOptions = {}, +): Layer.Layer => Layer.succeed(CodeExecutor)(CodeExecutor.of({ execute: makeExecute(options) })) + +export const NodeCodeExecutor = { + layer: microVmCodeExecutorLayer, + implementation: microVmCodeExecutorImplementation, +} as const diff --git a/packages/platform-bun/src/index.ts b/packages/platform-bun/src/index.ts new file mode 100644 index 00000000..b40015c7 --- /dev/null +++ b/packages/platform-bun/src/index.ts @@ -0,0 +1 @@ +export * as CodeExecutor from './CodeExecutor' diff --git a/packages/platform-bun/src/internal/code-executor-guest.ts b/packages/platform-bun/src/internal/code-executor-guest.ts new file mode 100644 index 00000000..4c783271 --- /dev/null +++ b/packages/platform-bun/src/internal/code-executor-guest.ts @@ -0,0 +1,214 @@ +/** @internal */ +export const codeExecutorGuestSource = String.raw` +import fs from 'node:fs' + +const config = JSON.parse(fs.readFileSync(process.argv[2], 'utf8')) +const limits = config.limits + +const MAX_LOG_LINES = 4096 +const MAX_LOG_LINE_CHARACTERS = 16000 +const MAX_THROWN_CHARACTERS = 4000 + +const utf8 = (text) => new TextEncoder().encode(text).byteLength + +const safeText = (value) => { + try { + if (value instanceof Error) return (value.name + ': ' + value.message).slice(0, MAX_THROWN_CHARACTERS) + if (typeof value === 'string') return value.slice(0, MAX_THROWN_CHARACTERS) + const encoded = JSON.stringify(value) + return (encoded === undefined ? String(value) : encoded).slice(0, MAX_THROWN_CHARACTERS) + } catch { + return '[unserializable value]' + } +} + +const safeJson = (value) => { + try { + const encoded = JSON.stringify(value) + if (encoded === undefined) return safeText(value) + if (encoded.length <= MAX_THROWN_CHARACTERS) return JSON.parse(encoded) + return safeText(value) + } catch { + return safeText(value) + } +} + +const logs = [] +let logBytes = 0 +let fatal = null + +const boundedLogs = () => logs.slice(0, MAX_LOG_LINES) + +const writeLog = (...values) => { + const joined = values.map(safeText).join(' ') + const line = joined.length > MAX_LOG_LINE_CHARACTERS ? joined.slice(0, MAX_LOG_LINE_CHARACTERS - 1) + '…' : joined + const bytes = utf8(line) + if (logs.length >= MAX_LOG_LINES || logBytes + bytes > limits.maxLogBytes) { + fatal = fatal ?? { t: 'log-limit', observed: logBytes + bytes, logs: boundedLogs() } + throw new Error('code executor log limit exceeded') + } + logs.push(line) + logBytes += bytes +} + +let outbox = Promise.resolve() + +const emit = (message, done) => { + const text = JSON.stringify(message) + '\n' + + outbox = outbox.then(() => Bun.write(Bun.stdout, text)) + if (done !== undefined) outbox = outbox.then(done) +} + +const finish = (message) => { + emit(message, () => process.exit(0)) +} + +const pending = new Map() +let nextId = 1 +let buffer = '' + +const receive = (line) => { + let message + try { + message = JSON.parse(line) + } catch { + return + } + if (message === null || typeof message !== 'object' || message.t !== 'response') return + const entry = pending.get(message.id) + if (entry === undefined) return + pending.delete(message.id) + if (message.ok) { + entry.resolve(message.value) + return + } + const error = message.error + if (error !== null && typeof error === 'object') { + try { + Object.defineProperty(error, Symbol.toPrimitive, { value: () => JSON.stringify(error) }) + } catch {} + } + entry.reject(error) +} + +process.stdin.setEncoding('utf8') +process.stdin.on('data', (chunk) => { + buffer += chunk + let index = buffer.indexOf('\n') + while (index >= 0) { + const line = buffer.slice(0, index) + buffer = buffer.slice(index + 1) + if (line !== '') receive(line) + index = buffer.indexOf('\n') + } +}) + +const call = (namespace, method, argument) => new Promise((resolve, reject) => { + if (fatal !== null) { + reject(new Error('the pass is closing')) + return + } + let encoded + try { + encoded = JSON.stringify(argument) + } catch { + encoded = undefined + } + if (encoded === undefined) { + reject(new TypeError('host call arguments must be JSON values')) + return + } + const id = nextId + nextId += 1 + pending.set(id, { resolve, reject }) + emit({ t: 'call', id, namespace, method, argument: JSON.parse(encoded) }) +}) + +const namespaces = {} +for (const namespace of config.namespaces) { + const methods = {} + for (const method of namespace.methods) { + methods[method] = (argument) => call(namespace.name, method, argument) + } + namespaces[namespace.name] = methods +} + +const consoleShim = { log: writeLog, info: writeLog, warn: writeLog, error: writeLog, debug: writeLog } + +emit({ t: 'ready' }) + +const classify = (thrown, evaluation) => ({ + t: 'failed', + reason: evaluation || thrown instanceof Error ? 'threw' : 'rejected', + thrown: safeJson(thrown), + message: safeText(thrown), + logs: boundedLogs(), +}) + +const run = async () => { + let factory + try { + factory = new Function( + 'console', + ...config.namespaces.map((namespace) => namespace.name), + '"use strict";\nreturn (' + config.source + ');', + ) + } catch (error) { + finish({ t: 'source-invalid', message: safeText(error), logs: boundedLogs() }) + return + } + let candidate + try { + candidate = factory(consoleShim, ...config.namespaces.map((namespace) => namespaces[namespace.name])) + } catch (error) { + finish(fatal ?? classify(error, true)) + return + } + if (typeof candidate !== 'function') { + finish({ t: 'source-not-a-function', actual: typeof candidate, logs: boundedLogs() }) + return + } + let value + try { + value = await candidate() + } catch (error) { + finish(fatal ?? classify(error, false)) + return + } + if (fatal !== null) { + finish(fatal) + return + } + let encoded + try { + encoded = JSON.stringify(value) + } catch { + encoded = undefined + } + if (encoded === undefined) { + finish({ + t: 'failed', + reason: 'non-json-result', + thrown: null, + message: 'The program must return a JSON value', + logs: boundedLogs(), + }) + return + } + const resultBytes = utf8(encoded) + if (resultBytes > limits.maxResultBytes) { + finish({ t: 'result-limit', observed: resultBytes, logs: boundedLogs() }) + return + } + finish({ + t: 'completed', + value: JSON.parse(encoded), + logs: boundedLogs(), + logBytes, + resultBytes, + }) +} + +run() +` diff --git a/packages/platform-bun/src/internal/code-executor.schema.ts b/packages/platform-bun/src/internal/code-executor.schema.ts new file mode 100644 index 00000000..c11dc35d --- /dev/null +++ b/packages/platform-bun/src/internal/code-executor.schema.ts @@ -0,0 +1,72 @@ +import * as Schema from 'effect/Schema' + +/** @internal */ +export const GuestLogs = Schema.Array(Schema.String).check(Schema.isMaxLength(4_096)) + +/** @internal */ +export const GuestCall = Schema.Struct({ + t: Schema.Literal('call'), + id: Schema.Natural, + namespace: Schema.String, + method: Schema.String, + argument: Schema.Json, +}) + +/** @internal */ +export const GuestReady = Schema.Struct({ t: Schema.Literal('ready') }) + +/** @internal */ +export const GuestOutcome = Schema.Union([ + Schema.Struct({ + t: Schema.Literal('completed'), + value: Schema.Json, + logs: GuestLogs, + logBytes: Schema.Natural, + resultBytes: Schema.Natural, + }), + Schema.Struct({ + t: Schema.Literal('failed'), + reason: Schema.Literals(['threw', 'rejected', 'non-json-result']), + thrown: Schema.Json, + message: Schema.String, + logs: GuestLogs, + }), + Schema.Struct({ t: Schema.Literal('source-invalid'), message: Schema.String, logs: GuestLogs }), + Schema.Struct({ t: Schema.Literal('source-not-a-function'), actual: Schema.String, logs: GuestLogs }), + Schema.Struct({ t: Schema.Literal('log-limit'), observed: Schema.Natural, logs: GuestLogs }), + Schema.Struct({ t: Schema.Literal('result-limit'), observed: Schema.Natural, logs: GuestLogs }), +]) + +/** @internal */ +export const GuestMessage = Schema.Union([GuestCall, GuestReady, GuestOutcome]) + +/** @internal */ +export const GuestResponse = Schema.Struct({ + t: Schema.Literal('response'), + id: Schema.Natural, + ok: Schema.Boolean, + value: Schema.optionalKey(Schema.Json), + error: Schema.optionalKey(Schema.Json), +}) + +/** @internal */ +export const GuestConfig = Schema.Struct({ + source: Schema.String, + namespaces: Schema.Array( + Schema.Struct({ name: Schema.String, methods: Schema.Array(Schema.String) }), + ), + limits: Schema.Struct({ + maxLogBytes: Schema.Natural, + maxResultBytes: Schema.Natural, + maxHostCallArgumentBytes: Schema.Natural, + }), +}) + +/** @internal */ +export type GuestCall = typeof GuestCall.Type +/** @internal */ +export type GuestOutcome = typeof GuestOutcome.Type +/** @internal */ +export type GuestResponse = typeof GuestResponse.Type +/** @internal */ +export type GuestConfig = typeof GuestConfig.Type diff --git a/packages/platform-bun/tests/__fixtures__/code-executor.schema.ts b/packages/platform-bun/tests/__fixtures__/code-executor.schema.ts new file mode 100644 index 00000000..6bcfe5cf --- /dev/null +++ b/packages/platform-bun/tests/__fixtures__/code-executor.schema.ts @@ -0,0 +1,28 @@ +import * as Schema from 'effect/Schema' + +export const NetworkObservation = Schema.Struct({ + nonLoopback: Schema.Array(Schema.String), + fetchFailed: Schema.Boolean, +}) + +export const FilesystemObservation = Schema.Struct({ + rootOptions: Schema.String, + etc: Schema.String, + tmp: Schema.String, + shm: Schema.String, + scratch: Schema.String, + cwd: Schema.String, +}) + +export const IdentityObservation = Schema.Struct({ + uid: Schema.Natural, + gid: Schema.Natural, + home: Schema.NullOr(Schema.String), + tmpdir: Schema.NullOr(Schema.String), + path: Schema.String, +}) + +export const LibraryObservation = Schema.Struct({ + read: Schema.String, + write: Schema.String, +}) diff --git a/packages/platform-bun/tests/__fixtures__/conformance-runner.ts b/packages/platform-bun/tests/__fixtures__/conformance-runner.ts new file mode 100644 index 00000000..41ce8982 --- /dev/null +++ b/packages/platform-bun/tests/__fixtures__/conformance-runner.ts @@ -0,0 +1,49 @@ +import { BunRuntime } from '@effect/platform-bun' +import { + type CodeExecutorConformanceCase, + codeExecutorConformanceCases, +} from '@systemfsoftware/agent-testing/code-executor-conformance' +import * as Console from 'effect/Console' +import * as Effect from 'effect/Effect' +import * as Exit from 'effect/Exit' +import * as Schema from 'effect/Schema' + +import { + microVmCodeExecutorImplementation, + microVmCodeExecutorLayer, +} from '@systemfsoftware/agent-platform-bun/code-executor' + +class ConformanceFailed + extends Schema.TaggedError()('ConformanceFailed', { + failures: Schema.Array(Schema.String), + }) +{ + get message() { + return `${this.failures.length} conformance case(s) failed: ${this.failures.join(', ')}` + } +} + +const layer = microVmCodeExecutorLayer() + +const runCase = (conformanceCase: CodeExecutorConformanceCase): Effect.Effect => + conformanceCase.run.pipe( + Effect.provide(layer), + Effect.exit, + Effect.map((exit) => (Exit.isSuccess(exit) ? undefined : conformanceCase.name)), + ) + +const report = Effect.gen(function*() { + const cases = codeExecutorConformanceCases({ + implementation: microVmCodeExecutorImplementation, + }) + const results = yield* Effect.forEach(cases, runCase, { concurrency: 1 }) + const failures = results.filter((name): name is string => name !== undefined) + + if (failures.length === 0) { + return yield* Console.log(`CodeExecutorConformance passed ${cases.length}/${cases.length} cases on Bun`) + } + + return yield* new ConformanceFailed({ failures }) +}) + +BunRuntime.runMain(report) diff --git a/packages/platform-bun/tests/code-executor.integration.test.ts b/packages/platform-bun/tests/code-executor.integration.test.ts new file mode 100644 index 00000000..0b98d796 --- /dev/null +++ b/packages/platform-bun/tests/code-executor.integration.test.ts @@ -0,0 +1,221 @@ +import * as NodeFileSystem from '@effect/platform-node/NodeFileSystem' +import * as NodePath from '@effect/platform-node/NodePath' +import { + microVmCodeExecutorLayer, + type MicroVmCodeExecutorOptions, +} from '@systemfsoftware/agent-platform-bun/code-executor' +import { + CodeExecutionHost, + CodeExecutionLimits, + CodeExecutionRequest, + CodeExecutor, +} from '@systemfsoftware/agent/code-executor' +import { NetworkDisabled } from '@systemfsoftware/agent/sandbox' +import { Gherkin, it, makeFeature, Then, When } from '@systemfsoftware/effect-gherkin-spec' +import * as Config from 'effect/Config' +import * as ConfigProvider from 'effect/ConfigProvider' +import * as Duration from 'effect/Duration' +import * as Effect from 'effect/Effect' +import * as FileSystem from 'effect/FileSystem' +import * as Layer from 'effect/Layer' +import * as Path from 'effect/Path' +import * as Schema from 'effect/Schema' +import type * as Scope from 'effect/Scope' + +import { + FilesystemObservation, + IdentityObservation, + LibraryObservation, + NetworkObservation, +} from './__fixtures__/code-executor.schema' + +const host: CodeExecutionHost['Service'] = { + call: () => Effect.die('this pass makes no host call'), +} + +const limits = CodeExecutionLimits.make({ + maxSourceBytes: 64 * 1024, + maxWallTime: Duration.seconds(30), + maxLogBytes: 16 * 1024, + maxResultBytes: 64 * 1024, + maxHostCalls: 8, + maxHostCallArgumentBytes: 16 * 1024, + maxHostCallResultBytes: 32 * 1024, +}) + +const runProgram = ( + source: string, + options: MicroVmCodeExecutorOptions = {}, +): Effect.Effect => + Effect.gen(function*() { + const executor = yield* CodeExecutor + const result = yield* executor.execute( + CodeExecutionRequest.make({ + language: 'javascript', + source, + namespaces: [], + network: NetworkDisabled.make(), + limits, + }), + ).pipe(Effect.provideService(CodeExecutionHost, CodeExecutionHost.of(host))) + + return result.value + }).pipe( + Effect.scoped, + Effect.provide(microVmCodeExecutorLayer(options)), + ) + +const runObserved = ( + schema: S, + source: string, + options: MicroVmCodeExecutorOptions = {}, +) => + runProgram(source, options).pipe( + Effect.flatMap((value) => Schema.decodeEffect(schema)(value)), + ) + +const withPinnedLibrary = ( + use: (mount: { readonly host: string; readonly guest: string }) => Effect.Effect, +): Effect.Effect< + A, + E | import('effect/PlatformError').PlatformError, + R | Scope.Scope | FileSystem.FileSystem | Path.Path +> => + Effect.gen(function*() { + const fs = yield* FileSystem.FileSystem + const path = yield* Path.Path + const directory = yield* fs.makeTempDirectoryScoped({ prefix: 'agent-code-executor-library-' }) + const pinned = path.join(directory, 'pinned.js') + + yield* fs.chmod(directory, 0o755) + yield* fs.writeFileString(pinned, "export const pinned = 'v1'\n", { mode: 0o444 }) + yield* fs.chmod(pinned, 0o444) + + return yield* use({ host: directory, guest: '/opt/libraries/pinned' }) + }) + +const Feature = makeFeature({ it }) + +Feature('Executing generated JavaScript in the Bun CodeExecutor', { timeout: 300_000 }) + .live('each pass boots a real microVM and waits on its guest process') + .withLayer(Layer.merge(NodeFileSystem.layer, NodePath.layer)) + .body(({ scenario }) => { + scenario( + 'A generated program has no network interface and cannot reach the network', + Gherkin.Do.pipe( + When('a program lists its interfaces and tries to fetch an address')('observed', () => + runObserved( + NetworkObservation, + 'async () => {\n' + + " const os = await import('node:os')\n" + + " const nonLoopback = Object.keys(os.networkInterfaces()).filter((name) => name !== 'lo')\n" + + ' let fetchFailed = false\n' + + " try { await fetch('http://1.1.1.1', { signal: AbortSignal.timeout(5000) }) } catch { fetchFailed = true }\n" + + ' return { nonLoopback, fetchFailed }\n' + + '}', + )), + Then('the observation shows only loopback and a refused request')((scope, expect) => + expect(scope.observed).toEqual({ nonLoopback: [], fetchFailed: true }) + ), + ), + ) + + scenario( + 'The guest root is read-only and the scratch directory is the only writable place', + Gherkin.Do.pipe( + When('a program probes the root mount and writes to several paths')('observed', () => + runObserved( + FilesystemObservation, + 'async () => {\n' + + " const fs = await import('node:fs')\n" + + " const probe = (path) => { try { fs.writeFileSync(path, 'x'); return 'wrote' } catch (error) { return error.code ?? 'error' } }\n" + + " const root = fs.readFileSync('/proc/mounts', 'utf8').split('\\n').find((line) => line.split(' ')[1] === '/') ?? ''\n" + + ' return {\n' + + " rootOptions: (root.split(' ')[3] ?? '').split(',')[0],\n" + + " etc: probe('/etc/code-executor-probe'),\n" + + " tmp: probe('/tmp/code-executor-probe'),\n" + + " shm: probe('/dev/shm/code-executor-probe'),\n" + + " scratch: probe('/scratch/code-executor-probe'),\n" + + ' cwd: process.cwd(),\n' + + ' }\n' + + '}', + )), + Then('the root and shared memory are read-only while scratch accepts writes')((scope, expect) => + expect(scope.observed).toEqual({ + rootOptions: 'ro', + etc: 'EROFS', + tmp: 'EROFS', + shm: 'EROFS', + scratch: 'wrote', + cwd: '/scratch', + }) + ), + ), + ) + + scenario( + 'The guest runs as an unprivileged user with no host environment', + Gherkin.Do.pipe( + When('a program reports its identity and environment')('observed', () => + Effect.gen(function*() { + const hostPath = yield* Config.String('PATH').parse(ConfigProvider.fromEnv()) + const guest = yield* runObserved( + IdentityObservation, + 'async () => ({\n' + + ' uid: process.getuid(),\n' + + ' gid: process.getgid(),\n' + + ' home: process.env.HOME ?? null,\n' + + ' tmpdir: process.env.TMPDIR ?? null,\n' + + " path: process.env.PATH ?? '',\n" + + '})', + ) + + return { ...guest, hostPath } + })), + Then('the identity is unprivileged and the host PATH is absent')((scope, expect) => + expect({ + uid: scope.observed.uid, + gid: scope.observed.gid, + home: scope.observed.home, + tmpdir: scope.observed.tmpdir, + hostPathVisible: scope.observed.path === scope.observed.hostPath, + }).toEqual({ + uid: 65_534, + gid: 65_534, + home: '/scratch', + tmpdir: '/scratch', + hostPathVisible: false, + }) + ), + ), + ) + + scenario( + 'A pinned library directory mounts read-only', + Gherkin.Do.pipe( + When('a program reads the pinned file and tries to add one beside it')( + 'observed', + () => + withPinnedLibrary((mount) => + runObserved( + LibraryObservation, + 'async () => {\n' + + " const fs = await import('node:fs')\n" + + " const read = fs.readFileSync('/opt/libraries/pinned/pinned.js', 'utf8')\n" + + ' let write\n' + + " try { fs.writeFileSync('/opt/libraries/pinned/added.js', 'x'); write = 'wrote' } catch (error) { write = error.code ?? 'error' }\n" + + ' return { read, write }\n' + + '}', + { readOnlyMounts: [mount] }, + ) + ), + ), + Then('the pinned file is readable and the directory refuses writes')((scope, expect) => + expect(scope.observed).toEqual({ + read: "export const pinned = 'v1'\n", + write: 'EROFS', + }) + ), + ), + ) + }) diff --git a/packages/platform-bun/tsconfig.app.json b/packages/platform-bun/tsconfig.app.json new file mode 100644 index 00000000..1dedcc16 --- /dev/null +++ b/packages/platform-bun/tsconfig.app.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "composite": true, + "noEmit": false, + "emitDeclarationOnly": true, + "outDir": "node_modules/.cache/tsc/app", + "tsBuildInfoFile": "node_modules/.cache/tsconfig.app.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ], + "references": [ + { + "path": "../effect-agent/tsconfig.app.json" + } + ] +} diff --git a/packages/platform-bun/tsconfig.build.json b/packages/platform-bun/tsconfig.build.json new file mode 100644 index 00000000..51a35ed4 --- /dev/null +++ b/packages/platform-bun/tsconfig.build.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.app.json", + "compilerOptions": { + "composite": false, + "noEmit": true, + "emitDeclarationOnly": false + }, + "include": [ + "src" + ], + "references": [] +} diff --git a/packages/platform-bun/tsconfig.json b/packages/platform-bun/tsconfig.json new file mode 100644 index 00000000..7ddf2dcb --- /dev/null +++ b/packages/platform-bun/tsconfig.json @@ -0,0 +1,11 @@ +{ + "files": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.test.json" + } + ] +} diff --git a/packages/platform-bun/tsconfig.test.json b/packages/platform-bun/tsconfig.test.json new file mode 100644 index 00000000..133957ed --- /dev/null +++ b/packages/platform-bun/tsconfig.test.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "composite": true, + "noEmit": false, + "emitDeclarationOnly": true, + "outDir": "node_modules/.cache/tsc/test", + "tsBuildInfoFile": "node_modules/.cache/tsconfig.test.tsbuildinfo" + }, + "include": [ + "tests/**/*.ts" + ], + "references": [ + { + "path": "../effect-agent/tsconfig.app.json" + }, + { + "path": "./tsconfig.app.json" + } + ] +} diff --git a/packages/platform-bun/tsdown.config.ts b/packages/platform-bun/tsdown.config.ts new file mode 100644 index 00000000..fe2db1d7 --- /dev/null +++ b/packages/platform-bun/tsdown.config.ts @@ -0,0 +1,15 @@ +import { defineConfig } from 'tsdown' + +import manifest from './package.json' with { type: 'json' } + +// The source tree is the development surface: every `exports` entry names one source file, and each is one bundle +// entry. `publishConfig.exports` swaps them for the built files when the package is packed. +export default defineConfig({ + entry: Object.values(manifest.exports), + format: 'esm', + dts: true, + // The solution root owns no files, so declaration emit reads the app role directly. + tsconfig: 'tsconfig.build.json', + sourcemap: true, + fixedExtension: true, +}) diff --git a/packages/platform-bun/vitest.config.ts b/packages/platform-bun/vitest.config.ts new file mode 100644 index 00000000..5457bbbc --- /dev/null +++ b/packages/platform-bun/vitest.config.ts @@ -0,0 +1,15 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + // Vite replaces its defaults when conditions are set, so the defaults are listed back and the + // workspace source condition is appended for both the client and SSR resolvers. + resolve: { conditions: ['module', 'browser', 'development|production', '@systemfsoftware/source'] }, + ssr: { + resolve: { conditions: ['module', 'node', 'development|production', '@systemfsoftware/source'] }, + }, + test: { + cache: false, + silent: 'passed-only', + testTimeout: 30_000, + }, +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c2fcdbfa..d6db9e5f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -239,12 +239,18 @@ catalogs: '@systemfsoftware/effect-cf': specifier: 0.60.0 version: 0.60.0 + '@systemfsoftware/effect-gherkin-spec': + specifier: ^8.4.3 + version: 8.4.3 '@systemfsoftware/effect-microsandbox': specifier: ^6.1.0 version: 6.1.0 '@systemfsoftware/effect-readiness': specifier: ^1.1.4 version: 1.1.4 + '@systemfsoftware/vitest': + specifier: ^4.4.0 + version: 4.4.0 '@tailwindcss/vite': specifier: 4.3.3 version: 4.3.3 @@ -317,6 +323,9 @@ catalogs: memfs: specifier: 4.71.0 version: 4.71.0 + microsandbox: + specifier: ^0.7.8 + version: 0.7.8 miniflare: specifier: 5.20260811.1-alpha version: 5.20260811.1-alpha @@ -371,7 +380,7 @@ overrides: '@effect/platform-node': 4.1.5 '@effect/vitest': 4.1.5 effect: 4.1.5 - vitest: 5.0.3 + vitest: 5.1.2 importers: @@ -432,8 +441,8 @@ importers: specifier: 'catalog:' version: typescript@6.0.3 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) docs: dependencies: @@ -557,7 +566,7 @@ importers: version: link:../../packages/storage-cloudflare '@systemfsoftware/effect-cf': specifier: 'catalog:' - version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) effect: specifier: 4.1.5 version: 4.1.5 @@ -582,7 +591,7 @@ importers: version: 5.20261026.1 '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) '@types/node': specifier: 'catalog:' version: 26.1.2 @@ -608,8 +617,8 @@ importers: specifier: 'catalog:' version: 7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1) vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) wrangler: specifier: 'catalog:' version: 4.123.0(@cloudflare/workers-types@5.20261026.1) @@ -636,7 +645,7 @@ importers: version: link:../../packages/platform-cloudflare '@systemfsoftware/effect-cf': specifier: 'catalog:' - version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) '@types/node': specifier: 'catalog:' version: 26.1.2 @@ -678,7 +687,7 @@ importers: version: link:../../packages/storage-cloudflare '@systemfsoftware/effect-cf': specifier: 'catalog:' - version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) '@types/node': specifier: 'catalog:' version: 26.1.2 @@ -729,13 +738,13 @@ importers: version: link:../../packages/platform-cloudflare '@systemfsoftware/effect-cf': specifier: 'catalog:' - version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) '@systemfsoftware/ui': specifier: workspace:* version: link:../../packages/ui '@yielded/sandbox': specifier: 0.9.0 - version: 0.9.0(effect-cf@0.59.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5))(effect@4.1.5) + version: 0.9.0(effect-cf@0.59.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5))(effect@4.1.5) drizzle-orm: specifier: 'catalog:' version: 1.0.0-rc.4(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(@effect/sql-sqlite-node@4.1.5(effect@4.1.5))(@electric-sql/pglite@0.3.15)(@libsql/client@0.17.4)(effect@4.1.5)(valibot@1.2.0(typescript@7.0.2))(zod@4.6.7) @@ -793,7 +802,7 @@ importers: dependencies: '@systemfsoftware/effect-cf': specifier: 'catalog:' - version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) '@yielded/auth': specifier: 'catalog:' version: 0.1.0-beta.47(effect@4.1.5) @@ -844,7 +853,7 @@ importers: version: link:../../packages/testing '@systemfsoftware/effect-cf': specifier: 'catalog:' - version: 0.60.0(@cloudflare/sandbox@0.13.0-next.830.1)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + version: 0.60.0(@cloudflare/sandbox@0.13.0-next.830.1)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) '@systemfsoftware/ui': specifier: workspace:* version: link:../../packages/ui @@ -890,7 +899,7 @@ importers: version: 4.1.5(effect@4.1.5)(redis@6.3.1) '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) '@tailwindcss/vite': specifier: 'catalog:' version: 4.3.3(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) @@ -925,8 +934,8 @@ importers: specifier: 'catalog:' version: 7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1) vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) packages/ai-decision: devDependencies: @@ -938,7 +947,7 @@ importers: version: 4.1.5(effect@4.1.5) '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) effect: specifier: 4.1.5 version: 4.1.5 @@ -949,8 +958,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/effect-agent: dependencies: @@ -972,7 +981,7 @@ importers: version: 4.1.5(effect@4.1.5)(redis@6.3.1) '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) effect: specifier: 4.1.5 version: 4.1.5 @@ -983,8 +992,48 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + + packages/platform-bun: + dependencies: + '@systemfsoftware/agent': + specifier: workspace:* + version: link:../effect-agent + microsandbox: + specifier: 'catalog:' + version: 0.7.8 + devDependencies: + '@arethetypeswrong/cli': + specifier: 'catalog:' + version: 0.18.5 + '@effect/platform-bun': + specifier: 'catalog:' + version: 4.1.5(effect@4.1.5) + '@effect/platform-node': + specifier: 4.1.5 + version: 4.1.5(effect@4.1.5)(redis@6.3.1) + '@systemfsoftware/agent-testing': + specifier: workspace:* + version: link:../testing + '@systemfsoftware/effect-gherkin-spec': + specifier: 'catalog:' + version: 8.4.3(@systemfsoftware/vitest@4.4.0(effect@4.1.5)(redis@6.3.1)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + '@systemfsoftware/vitest': + specifier: 'catalog:' + version: 4.4.0(effect@4.1.5)(redis@6.3.1)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + effect: + specifier: 4.1.5 + version: 4.1.5 + tsdown: + specifier: 'catalog:' + version: 0.23.7(@arethetypeswrong/core@0.18.5)(@vue/language-core@3.3.14)(tsrs@0.18.0-ts7.1.0-dev.20260929)(typescript@7.0.2) + typescript: + specifier: 'catalog:' + version: 7.0.2 + vitest: + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/platform-cloudflare: dependencies: @@ -1021,7 +1070,7 @@ importers: version: 0.18.5 '@cloudflare/vitest-plugin': specifier: 'catalog:' - version: 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) '@cloudflare/workers-types': specifier: 'catalog:' version: 5.20261026.1 @@ -1033,13 +1082,13 @@ importers: version: 4.1.5(effect@4.1.5) '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) '@systemfsoftware/agent-testing': specifier: workspace:* version: link:../testing '@systemfsoftware/effect-cf': specifier: 'catalog:' - version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) effect: specifier: 4.1.5 version: 4.1.5 @@ -1056,8 +1105,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/platform-node: dependencies: @@ -1079,7 +1128,7 @@ importers: version: 0.18.5 '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) effect: specifier: 4.1.5 version: 4.1.5 @@ -1093,8 +1142,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/pr-review: dependencies: @@ -1107,7 +1156,7 @@ importers: version: 0.18.5 '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) effect: specifier: 4.1.5 version: 4.1.5 @@ -1118,8 +1167,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/pr-review-action: dependencies: @@ -1141,7 +1190,7 @@ importers: devDependencies: '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) '@types/node': specifier: 'catalog:' version: 26.1.2 @@ -1152,8 +1201,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/storage-cloudflare: dependencies: @@ -1175,13 +1224,13 @@ importers: version: 0.18.5 '@cloudflare/vitest-plugin': specifier: 'catalog:' - version: 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) '@cloudflare/workers-types': specifier: 'catalog:' version: 5.20261026.1 '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) '@systemfsoftware/agent-testing': specifier: workspace:* version: link:../testing @@ -1195,8 +1244,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/storage-memory: dependencies: @@ -1212,7 +1261,7 @@ importers: version: 4.1.5(effect@4.1.5)(redis@6.3.1) '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) effect: specifier: 4.1.5 version: 4.1.5 @@ -1223,8 +1272,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/storage-postgres: dependencies: @@ -1246,7 +1295,7 @@ importers: version: 4.1.5(effect@4.1.5) '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) '@systemfsoftware/effect-microsandbox': specifier: 'catalog:' version: 6.1.0(effect@4.1.5)(redis@6.3.1)(typescript@7.0.2) @@ -1263,8 +1312,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/storage-sql: dependencies: @@ -1277,7 +1326,7 @@ importers: version: 0.18.5 '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) effect: specifier: 4.1.5 version: 4.1.5 @@ -1288,8 +1337,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/storage-sqlite: dependencies: @@ -1311,7 +1360,7 @@ importers: version: 0.18.5 '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) effect: specifier: 4.1.5 version: 4.1.5 @@ -1322,8 +1371,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/testing: dependencies: @@ -1348,7 +1397,7 @@ importers: version: 4.1.5(effect@4.1.5) '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) '@systemfsoftware/agent-ai-decision': specifier: workspace:* version: link:../ai-decision @@ -1380,8 +1429,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) packages/ui: dependencies: @@ -1429,8 +1478,8 @@ importers: specifier: 'catalog:' version: 7.0.2 vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) tooling/browser-run-worker-proof: dependencies: @@ -1458,7 +1507,7 @@ importers: version: 5.20261026.1 '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) '@types/node': specifier: 'catalog:' version: 26.1.2 @@ -1478,8 +1527,8 @@ importers: specifier: 'catalog:' version: 7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1) vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) wrangler: specifier: 'catalog:' version: 4.123.0(@cloudflare/workers-types@5.20261026.1) @@ -1500,7 +1549,7 @@ importers: version: link:../../packages/storage-cloudflare '@systemfsoftware/effect-cf': specifier: 'catalog:' - version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) effect: specifier: 4.1.5 version: 4.1.5 @@ -1549,7 +1598,7 @@ importers: version: link:../../packages/platform-node '@systemfsoftware/effect-cf': specifier: 'catalog:' - version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + version: 0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) effect: specifier: 4.1.5 version: 4.1.5 @@ -1579,8 +1628,8 @@ importers: specifier: 'catalog:' version: 7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1) vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) wrangler: specifier: 'catalog:' version: 4.123.0(@cloudflare/workers-types@5.20261026.1) @@ -1605,7 +1654,7 @@ importers: devDependencies: '@effect/vitest': specifier: 4.1.5 - version: 4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) + version: 4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) '@systemfsoftware/agent-testing': specifier: workspace:* version: link:../../packages/testing @@ -1619,8 +1668,8 @@ importers: specifier: 'catalog:' version: 7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1) vitest: - specifier: 5.0.3 - version: 5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) + specifier: 5.1.2 + version: 5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) tooling/semantic-memory-eval: dependencies: @@ -2196,7 +2245,7 @@ packages: '@cloudflare/vitest-plugin@1.4.0': resolution: {integrity: sha512-SgIhyhpVH+2MVSJxidG8gosqrpzF25IwKevQhPykwulTgAFe4s0Nkj71pNzqCkwV2+A4NKkHJP2ReyyRsoIxsg==} peerDependencies: - vitest: 5.0.3 + vitest: 5.1.2 '@cloudflare/workerd-darwin-64@1.20260811.1': resolution: {integrity: sha512-i5jqz+ywtOefr0AJbiAc8qxBLfSim/B0WJG7aW3B+pWnoVfMJdUQvi+BWcFKZJ0MoCci3KadTx6g31VfuEEqpQ==} @@ -2698,7 +2747,7 @@ packages: resolution: {integrity: sha512-18u1013wkJtSelk1ZYLc/5aUnluTQyDfi2hAemkJW1GQ9qXw4mtPSiSf0AXZPhesmGCvG1Dk2C4JYD2sz+R72w==} peerDependencies: effect: 4.1.5 - vitest: 5.0.3 + vitest: 5.1.2 '@electric-sql/pglite@0.3.15': resolution: {integrity: sha512-Cj++n1Mekf9ETfdc16TlDi+cDDQF0W7EcbyRHYOAeZdsAe8M/FJg18itDTSwyHfar2WIezawM9o0EKaRGVKygQ==} @@ -5494,6 +5543,13 @@ packages: just-bash: optional: true + '@systemfsoftware/effect-gherkin-spec@8.4.3': + resolution: {integrity: sha512-Wkzg+BtDlgaIGH93uFmE8mmUnaHLFe+6aHFn7Gqe7vZp7t4kfFjRt27Z4bYv7tZXJMjbwAKYwAb3zeOyiHjxIA==} + peerDependencies: + '@systemfsoftware/vitest': ^4.4.0 + effect: 4.1.5 + vitest: 5.1.2 + '@systemfsoftware/effect-microsandbox@6.1.0': resolution: {integrity: sha512-YTeMvbwzVdz0FyKXRKo0IqXIWz7P5NKLVu9fMTEiE69sKyh1qvC20ZOd42QWGOBaxAvuE4rp3BNVR2TkZnOBwQ==} peerDependencies: @@ -5506,6 +5562,19 @@ packages: effect: 4.1.5 typescript: '>=7.0.0' + '@systemfsoftware/effect-sim-kernel@2.1.1': + resolution: {integrity: sha512-iOYNsa32d7p2VwV7Rlc3qghW7oqlcfMAVCVLHEnGr4JyxS8KHcjC8fCIdwyMqTz4FpxRiOx6fXvrtQ6bw2iCLA==} + engines: {node: ^22.12.0 || ^24.0.0 || >=26.0.0} + peerDependencies: + effect: 4.1.5 + + '@systemfsoftware/effect-spec-runtime@1.4.3': + resolution: {integrity: sha512-AQQ+S4P1NJiVHdRA7sGTg2lyvfdlgxItdWyzn0cO3v77F01rogDZoa0i8mR8dI9bGZzIG4xg5CIbtx9wl1I2pQ==} + peerDependencies: + '@systemfsoftware/vitest': ^4.4.0 + effect: 4.1.5 + vitest: 5.1.2 + '@systemfsoftware/oxlint-config-cell-architecture@6.0.5': resolution: {integrity: sha512-rju0BG6XXU81WZrfzeOIHYEAkLGFKNf3AoeM7xaq3/b59DrGFQWFUlpDu8W9IcrjbKCiE2f2lOdELJvjwhoVMQ==} peerDependencies: @@ -5567,6 +5636,13 @@ packages: effect: 4.1.5 typescript: '>=5.0.0' + '@systemfsoftware/vitest@4.4.0': + resolution: {integrity: sha512-dgYxolRzI21ABlNflBa1UXTrjZ/UH8TUAAQ9NfjICn6UWy1UIj5uqL9DHHTSlHeBUgPs3SjwQzkDEYN17OPfHQ==} + engines: {node: ^22.19.0 || ^24.0.0 || >=26.0.0} + peerDependencies: + effect: 4.1.5 + vitest: 5.1.2 + '@tailwindcss/node@4.3.3': resolution: {integrity: sha512-/T8IKEsf9VTU6tLjgC7+sv2mOPtQxzE2jMw7u4Tt40Tx+QSZxpzh95/H6cMKoja9XuW7iMdLJYBB0o9G1CaAgg==} @@ -6175,10 +6251,10 @@ packages: babel-plugin-react-compiler: optional: true - '@vitest/mocker@5.0.3': - resolution: {integrity: sha512-T8sWAIbkSyAjkwTcaEc3Iu0o9A27X1/kdXrizhZkGuSKScRQtRzclfAMpOTcGdXCsqxeWlpGy3XjqaW8CpLORg==} + '@vitest/mocker@5.1.2': + resolution: {integrity: sha512-UGc97wUIy0Ji2+9GxzHEJiOhiwkaukgE7VYcUNnjpX3sWnwQ8XogmNXX4WyOukxYgKb8Nh2XFa7KId0ZjpmVhQ==} peerDependencies: - msw: ^2.4.9 + msw: ^2.4.9 || ^3.0.0 vite: ^6.0.0 || ^7.0.0 || ^8.0.0 peerDependenciesMeta: msw: @@ -6186,8 +6262,8 @@ packages: vite: optional: true - '@vitest/spy@5.0.3': - resolution: {integrity: sha512-XhFysQTB8AZ+P4gMi+Lpo99vg2AZi0qKpaB9yXQl37+CaMEAPO3iH/wGVnSyL5MPERiLezpqTVtrR6UZH5GCXg==} + '@vitest/spy@5.1.2': + resolution: {integrity: sha512-PQl0/3+p9GaY71+MHywN6oyHfLhVDD5kcbm7oNRldA2F0ExMU3S8RQdnpteJ9gFAdK5P6KCgE6LqCpUgy57KzA==} '@volar/language-core@2.4.30': resolution: {integrity: sha512-73fjwEV8wat6aOZ6U/y/hqtE30ocrIWECg67b0txGczOMNw+MffLmvJ5fnFfN9drVUEYZzLdaNo6VAy6G6avMw==} @@ -8428,10 +8504,6 @@ packages: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} engines: {node: '>= 0.4'} - obug@2.2.1: - resolution: {integrity: sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==} - engines: {node: '>=12.20.0'} - obug@3.0.0: resolution: {integrity: sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==} engines: {node: '>=12.20.0'} @@ -9591,20 +9663,20 @@ packages: vite: optional: true - vitest@5.0.3: - resolution: {integrity: sha512-xMw97S3rjdtj5dkVat7jCsqWBpvchs3RlpQctUqwJD0KkERk40vz2fJ77lDwW/Vzh/pk18eItYAzkodhSes3jQ==} + vitest@5.1.2: + resolution: {integrity: sha512-VIa2wXV208WraXUbzH+dQUrGcFpPuaiRA8HlhXS8R6/sy9cynw6OMqGj8fmAlH1hot7huTCtWUE14+FdXU3eLw==} engines: {node: ^22.12.0 || ^24.0.0 || >=26.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@opentelemetry/api': ^1.9.0 '@types/node': ^22.0.0 || >=24.0.0 - '@vitest/browser-playwright': 5.0.3 - '@vitest/browser-preview': 5.0.3 + '@vitest/browser-playwright': 5.1.2 + '@vitest/browser-preview': 5.1.2 '@vitest/browser-webdriverio': ^5.0.0-beta.5 || >=5.0.0 - '@vitest/coverage-istanbul': 5.0.3 - '@vitest/coverage-v8': 5.0.3 - '@vitest/ui': 5.0.3 + '@vitest/coverage-istanbul': 5.1.2 + '@vitest/coverage-v8': 5.1.2 + '@vitest/ui': 5.1.2 happy-dom: '*' jsdom: '*' vite: ^6.4.0 || ^7.0.0 || ^8.0.0 @@ -10464,12 +10536,12 @@ snapshots: optionalDependencies: workerd: 1.20261026.1 - '@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)))': + '@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)))': dependencies: cjs-module-lexer: 1.2.3 esbuild: 0.28.2 miniflare: 5.20261006.1-alpha(@types/node@26.1.2) - vitest: 5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) + vitest: 5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) wrangler: 4.149.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2) zod: 4.6.5 transitivePeerDependencies: @@ -10479,12 +10551,12 @@ snapshots: - utf-8-validate optional: true - '@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)))': + '@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)))': dependencies: cjs-module-lexer: 1.2.3 esbuild: 0.28.2 miniflare: 5.20261006.1-alpha(@types/node@26.1.2) - vitest: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + vitest: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) wrangler: 4.149.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2) zod: 4.6.5 transitivePeerDependencies: @@ -10901,15 +10973,15 @@ snapshots: '@effect/tsgo-win32-arm64': 0.73.4 '@effect/tsgo-win32-x64': 0.73.4 - '@effect/vitest@4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)))': + '@effect/vitest@4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)))': dependencies: effect: 4.1.5 - vitest: 5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) + vitest: 5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) - '@effect/vitest@4.1.5(effect@4.1.5)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)))': + '@effect/vitest@4.1.5(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)))': dependencies: effect: 4.1.5 - vitest: 5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + vitest: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) '@electric-sql/pglite@0.3.15': optional: true @@ -12921,7 +12993,7 @@ snapshots: dependencies: effect: 4.1.5 - '@systemfsoftware/effect-cf@0.60.0(@cloudflare/sandbox@0.13.0-next.830.1)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5)': + '@systemfsoftware/effect-cf@0.60.0(@cloudflare/sandbox@0.13.0-next.830.1)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5)': dependencies: '@effect/platform-browser': 4.1.0(effect@4.1.5) '@effect/sql-d1': 4.1.5(effect@4.1.5) @@ -12929,11 +13001,11 @@ snapshots: effect: 4.1.5 optionalDependencies: '@cloudflare/sandbox': 0.13.0-next.830.1 - '@cloudflare/vitest-plugin': 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) + '@cloudflare/vitest-plugin': 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) '@cloudflare/workers-types': 5.20261026.1 '@effect/sql-pg': 4.1.5(effect@4.1.5) - '@systemfsoftware/effect-cf@0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5)': + '@systemfsoftware/effect-cf@0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5)': dependencies: '@effect/platform-browser': 4.1.0(effect@4.1.5) '@effect/sql-d1': 4.1.5(effect@4.1.5) @@ -12941,11 +13013,11 @@ snapshots: effect: 4.1.5 optionalDependencies: '@cloudflare/sandbox': 1.0.3 - '@cloudflare/vitest-plugin': 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) + '@cloudflare/vitest-plugin': 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) '@cloudflare/workers-types': 5.20261026.1 '@effect/sql-pg': 4.1.5(effect@4.1.5) - '@systemfsoftware/effect-cf@0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5)': + '@systemfsoftware/effect-cf@0.60.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5)': dependencies: '@effect/platform-browser': 4.1.0(effect@4.1.5) '@effect/sql-d1': 4.1.5(effect@4.1.5) @@ -12953,10 +13025,17 @@ snapshots: effect: 4.1.5 optionalDependencies: '@cloudflare/sandbox': 1.0.3 - '@cloudflare/vitest-plugin': 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + '@cloudflare/vitest-plugin': 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) '@cloudflare/workers-types': 5.20261026.1 '@effect/sql-pg': 4.1.5(effect@4.1.5) + '@systemfsoftware/effect-gherkin-spec@8.4.3(@systemfsoftware/vitest@4.4.0(effect@4.1.5)(redis@6.3.1)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)))': + dependencies: + '@systemfsoftware/effect-spec-runtime': 1.4.3(@systemfsoftware/vitest@4.4.0(effect@4.1.5)(redis@6.3.1)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + '@systemfsoftware/vitest': 4.4.0(effect@4.1.5)(redis@6.3.1)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + effect: 4.1.5 + vitest: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + '@systemfsoftware/effect-microsandbox@6.1.0(effect@4.1.5)(redis@6.3.1)(typescript@7.0.2)': dependencies: '@effect/platform-node': 4.1.5(effect@4.1.5)(redis@6.3.1) @@ -12981,6 +13060,17 @@ snapshots: - redis - utf-8-validate + '@systemfsoftware/effect-sim-kernel@2.1.1(effect@4.1.5)': + dependencies: + effect: 4.1.5 + + '@systemfsoftware/effect-spec-runtime@1.4.3(@systemfsoftware/vitest@4.4.0(effect@4.1.5)(redis@6.3.1)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))))(effect@4.1.5)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)))': + dependencies: + '@systemfsoftware/effect-sim-kernel': 2.1.1(effect@4.1.5) + '@systemfsoftware/vitest': 4.4.0(effect@4.1.5)(redis@6.3.1)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))) + effect: 4.1.5 + vitest: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + '@systemfsoftware/oxlint-config-cell-architecture@6.0.5(effect@4.1.5)(oxlint@1.94.0(oxlint-tsgolint@7.0.2008))(typescript@7.0.2)': dependencies: '@systemfsoftware/oxlint-config-rule-authoring': 3.0.3(oxlint@1.94.0(oxlint-tsgolint@7.0.2008))(typescript@7.0.2) @@ -13073,6 +13163,16 @@ snapshots: oxc-parser: 0.159.0 typescript: 7.0.2 + '@systemfsoftware/vitest@4.4.0(effect@4.1.5)(redis@6.3.1)(vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)))': + dependencies: + '@effect/platform-node': 4.1.5(effect@4.1.5)(redis@6.3.1) + effect: 4.1.5 + vitest: 5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + transitivePeerDependencies: + - bufferutil + - redis + - utf-8-validate + '@tailwindcss/node@4.3.3': dependencies: '@jridgewell/remapping': 2.3.5 @@ -13691,25 +13791,25 @@ snapshots: '@rolldown/pluginutils': 1.1.1 vite: 7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1) - '@vitest/mocker@5.0.3(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))': + '@vitest/mocker@5.1.2(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))': dependencies: '@jridgewell/trace-mapping': 0.3.31 - '@vitest/spy': 5.0.3 + '@vitest/spy': 5.1.2 estree-walker: 3.0.3 magic-string: 1.4.5 optionalDependencies: vite: 7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1) - '@vitest/mocker@5.0.3(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))': + '@vitest/mocker@5.1.2(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1))': dependencies: '@jridgewell/trace-mapping': 0.3.31 - '@vitest/spy': 5.0.3 + '@vitest/spy': 5.1.2 estree-walker: 3.0.3 magic-string: 1.4.5 optionalDependencies: vite: 8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1) - '@vitest/spy@5.0.3': {} + '@vitest/spy@5.1.2': {} '@volar/language-core@2.4.30': dependencies: @@ -13757,11 +13857,11 @@ snapshots: '@yielded/jose': 0.1.0-beta.47(effect@4.1.5) effect: 4.1.5 - '@yielded/sandbox@0.9.0(effect-cf@0.59.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5))(effect@4.1.5)': + '@yielded/sandbox@0.9.0(effect-cf@0.59.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5))(effect@4.1.5)': dependencies: '@cloudflare/sandbox': 1.0.3 effect: 4.1.5 - effect-cf: 0.59.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) + effect-cf: 0.59.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5) '@yielded/starlight-theme@0.2.2(@astrojs/starlight@0.42.4(astro@7.3.5(@types/node@26.1.2)(aws4fetch@1.0.20)(jiti@2.7.0)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3))(astro@7.3.5(@types/node@26.1.2)(aws4fetch@1.0.20)(jiti@2.7.0)(yaml@2.9.1))(supports-color@10.2.2)': dependencies: @@ -14645,7 +14745,7 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 - effect-cf@0.59.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5): + effect-cf@0.59.0(@cloudflare/sandbox@1.0.3)(@cloudflare/vitest-plugin@1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))))(@cloudflare/workers-types@5.20261026.1)(@effect/sql-d1@4.1.5(effect@4.1.5))(@effect/sql-pg@4.1.5(effect@4.1.5))(@effect/sql-sqlite-do@4.1.5(effect@4.1.5))(effect@4.1.5): dependencies: '@effect/platform-browser': 4.1.5(effect@4.1.5) '@effect/sql-d1': 4.1.5(effect@4.1.5) @@ -14653,7 +14753,7 @@ snapshots: effect: 4.1.5 optionalDependencies: '@cloudflare/sandbox': 1.0.3 - '@cloudflare/vitest-plugin': 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) + '@cloudflare/vitest-plugin': 1.4.0(@cloudflare/workers-types@5.20261026.1)(@types/node@26.1.2)(vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1))) '@cloudflare/workers-types': 5.20261026.1 '@effect/sql-pg': 4.1.5(effect@4.1.5) @@ -16256,8 +16356,6 @@ snapshots: object-keys@1.1.1: {} - obug@2.2.1: {} - obug@3.0.0: {} ofetch@1.5.1: @@ -17588,15 +17686,15 @@ snapshots: optionalDependencies: vite: 8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1) - vitest@5.0.3(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)): + vitest@5.1.2(@types/node@26.1.2)(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)): dependencies: '@types/chai': 5.2.3 - '@vitest/mocker': 5.0.3(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) + '@vitest/mocker': 5.1.2(vite@7.3.8(@types/node@26.1.2)(jiti@2.7.0)(lightningcss@1.33.0)(yaml@2.9.1)) chai: 6.3.0 es-module-lexer: 2.3.2 expect-type: 1.4.0 magic-string: 1.4.5 - obug: 2.2.1 + obug: 3.0.0 picomatch: 4.0.7 std-env: 4.3.0 tinybench: 6.2.4 @@ -17609,15 +17707,15 @@ snapshots: transitivePeerDependencies: - msw - vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)): + vitest@5.1.2(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)): dependencies: '@types/chai': 5.2.3 - '@vitest/mocker': 5.0.3(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) + '@vitest/mocker': 5.1.2(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)) chai: 6.3.0 es-module-lexer: 2.3.2 expect-type: 1.4.0 magic-string: 1.4.5 - obug: 2.2.1 + obug: 3.0.0 picomatch: 4.0.7 std-env: 4.3.0 tinybench: 6.2.4 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 0ecf097f..f8cf2937 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -16,6 +16,9 @@ minimumReleaseAgeExclude: - "@systemfsoftware/oxlint-plugin-test-discipline" - "@systemfsoftware/oxlint-config-rule-authoring@3.0.3" - "@systemfsoftware/effect-cf@0.60.0" + - "@systemfsoftware/effect-gherkin-spec@8.4.3" + - "@systemfsoftware/effect-spec-runtime@1.4.3" + - "@systemfsoftware/vitest@4.4.0" packages: - packages/* - examples/* @@ -41,7 +44,7 @@ catalog: "@types/node": "26.1.2" "typescript": "7.0.2" "typescript-twoslash": "npm:typescript@6.0.3" - "vitest": "5.0.3" + "vitest": "5.1.2" "@base-ui/react": "1.6.0" "@cloudflare/vitest-plugin": "1.4.0" "@cloudflare/workers-types": "5.20261026.1" @@ -52,6 +55,8 @@ catalog: "@effect/sql-sqlite-do": "4.1.5" "@systemfsoftware/effect-microsandbox": "^6.1.0" "@systemfsoftware/effect-readiness": "^1.1.4" + "@systemfsoftware/effect-gherkin-spec": "^8.4.3" + "@systemfsoftware/vitest": "^4.4.0" "@types/react": "19.2.17" "@types/react-dom": "19.2.3" "class-variance-authority": "0.7.1" @@ -59,6 +64,7 @@ catalog: "diff": "8.0.4" "@systemfsoftware/effect-cf": "0.60.0" "lucide-react": "1.27.0" + "microsandbox": "^0.7.8" "miniflare": "5.20260811.1-alpha" "puppeteer-core": "25.18.1" "streamdown": "2.5.0" diff --git a/tsconfig.json b/tsconfig.json index 45f61deb..b08d1a91 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,9 @@ { "path": "./packages/effect-agent" }, + { + "path": "./packages/platform-bun" + }, { "path": "./packages/platform-cloudflare" },