feat(codemode): add confined execution package (#35079)

This commit is contained in:
Aiden Cline 2026-07-03 00:19:11 -05:00 committed by GitHub
commit 2409c7a3d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 9109 additions and 15 deletions

View file

@ -0,0 +1,31 @@
import type { Effect, Fiber } from "effect"
export class SandboxPromise {
interrupted = false
constructor(
readonly fiber: Fiber.Fiber<unknown, unknown> | undefined,
readonly immediate?: Effect.Effect<unknown, unknown>,
) {}
}
export class SandboxDate {
constructor(readonly time: number) {}
}
export class SandboxRegExp {
readonly regex: RegExp
constructor(pattern: string, flags: string) {
this.regex = new RegExp(pattern, flags)
}
}
export class SandboxMap {
readonly map = new Map<unknown, unknown>()
}
export class SandboxSet {
readonly set = new Set<unknown>()
}
export const isSandboxValue = (value: unknown): value is SandboxDate | SandboxRegExp | SandboxMap | SandboxSet =>
value instanceof SandboxDate || value instanceof SandboxRegExp || value instanceof SandboxMap || value instanceof SandboxSet