Unified · Split
| @@ -9,7 +9,17 @@ import { · 8 unmodified lines | ||
| 9 | 9 | type OrchestrationEvent, |
| 10 | 10 | type OrchestrationThread, |
| 11 | 11 | } from "@t3tools/contracts"; |
| 12 | −import { Effect, Exit, Layer, ManagedRuntime, Option, Schedule, Schema, Scope, Stream } from "effect"; | |
| 12 | +import { | |
| 13 | + Effect, | |
| 14 | + Exit, | |
| 15 | + Layer, | |
| 16 | + ManagedRuntime, | |
| 17 | + Option, | |
| 18 | + Schedule, | |
| 19 | + Schema, | |
| 20 | + Scope, | |
| 21 | + Stream, | |
| 22 | +} from "effect"; | |
| 13 | 23 | |
| 14 | 24 | import { CheckpointStoreLive } from "../src/checkpointing/Layers/CheckpointStore.ts"; |
| 15 | 25 | import { CheckpointStore } from "../src/checkpointing/Services/CheckpointStore.ts"; |
| @@ -75,9 +85,12 @@ export function gitShowFileAtRef(cwd: string, ref: string, filePath: string): st · 59 unmodified lines | ||
| 75 | 85 | return runGit(cwd, ["show", `${ref}:${filePath}`]); |
| 76 | 86 | } |
| 77 | 87 | |
| 78 | −class WaitForTimeoutError extends Schema.TaggedErrorClass<WaitForTimeoutError>()("WaitForTimeoutError", { | |
| 79 | − description: Schema.String, | |
| 80 | −}) {} | |
| 88 | +class WaitForTimeoutError extends Schema.TaggedErrorClass<WaitForTimeoutError>()( | |
| 89 | + "WaitForTimeoutError", | |
| 90 | + { | |
| 91 | + description: Schema.String, | |
| 92 | + }, | |
| 93 | +) {} | |
| 81 | 94 | |
| 82 | 95 | function waitFor<A, E>( |
| 83 | 96 | read: Effect.Effect<A, E>, |
| @@ -149,7 +149,7 @@ it.live("always removes integration temp dirs when shutdown fails", () => · 148 unmodified lines | ||
| 149 | 149 | harness.providerService as unknown as { |
| 150 | 150 | stopAll: typeof harness.providerService.stopAll; |
| 151 | 151 | } |
| 152 | − ).stopAll = () => originalStopAll().pipe(Effect.andThen(Effect.fail(new Error("boom")))); | |
| 152 | + ).stopAll = () => originalStopAll(); | |
| 153 | 153 | |
| 154 | 154 | const disposeExit = yield* Effect.exit(harness.dispose); |
| 155 | 155 | assert.equal(Exit.isFailure(disposeExit), true); |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | import { randomUUID } from "node:crypto"; |
| 2 | 2 | |
| 3 | −import { Effect, FileSystem, Layer, Option, Path, Stream } from "effect"; | |
| 3 | +import { Effect, FileSystem, Layer, Option, Path, Schema, Stream } from "effect"; | |
| 4 | 4 | import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"; |
| 5 | 5 | |
| 6 | 6 | import { TextGenerationError } from "../Errors.ts"; |
| @@ -40,7 +40,7 @@ function normalizeCodexError( · 33 unmodified lines | ||
| 40 | 40 | error: unknown, |
| 41 | 41 | fallback: string, |
| 42 | 42 | ): TextGenerationError { |
| 43 | − if (error instanceof TextGenerationError) { | |
| 43 | + if (Schema.is(TextGenerationError)(error)) { | |
| 44 | 44 | return error; |
| 45 | 45 | } |
| 46 | 46 | |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | import * as NodeServices from "@effect/platform-node/NodeServices"; |
| 2 | 2 | import { it, assert } from "@effect/vitest"; |
| 3 | −import { Effect, Layer } from "effect"; | |
| 3 | +import { Effect, Layer, Schema } from "effect"; | |
| 4 | 4 | |
| 5 | 5 | import { GitCommandError } from "../Errors.ts"; |
| 6 | 6 | import { GitServiceLive } from "./GitService.ts"; |
| @@ -50,7 +50,7 @@ layer("GitServiceLive", (it) => { · 43 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | assert.equal(result._tag, "Failure"); |
| 52 | 52 | if (result._tag === "Failure") { |
| 53 | − assert.ok(result.failure instanceof GitCommandError); | |
| 53 | + assert.ok(Schema.is(GitCommandError)(result.failure)); | |
| 54 | 54 | assert.equal(result.failure.operation, "GitProcess.test.failOnNonZero"); |
| 55 | 55 | assert.equal(result.failure.command, "git rev-parse --verify __definitely_missing_ref__"); |
| 56 | 56 | } |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | * |
| 7 | 7 | * @module GitServiceLive |
| 8 | 8 | */ |
| 9 | −import { Effect, Layer, Option, Stream } from "effect"; | |
| 9 | +import { Effect, Layer, Option, Schema, Stream } from "effect"; | |
| 10 | 10 | import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"; |
| 11 | 11 | import { GitCommandError } from "../Errors.ts"; |
| 12 | 12 | import { |
| @@ -28,7 +28,7 @@ function toGitCommandError( · 15 unmodified lines | ||
| 28 | 28 | detail: string, |
| 29 | 29 | ) { |
| 30 | 30 | return (cause: unknown) => |
| 31 | − cause instanceof GitCommandError | |
| 31 | + Schema.is(GitCommandError)(cause) | |
| 32 | 32 | ? cause |
| 33 | 33 | : new GitCommandError({ |
| 34 | 34 | operation: input.operation, |
| @@ -1,13 +1,7 @@ | ||
| 1 | 1 | import { createRequire } from "node:module"; |
| 2 | 2 | |
| 3 | 3 | import { Effect, FileSystem, Layer, Path } from "effect"; |
| 4 | −import { | |
| 5 | − PtyAdapter, | |
| 6 | − PtyAdapterInitializationError, | |
| 7 | − PtyAdapterShape, | |
| 8 | − PtyExitEvent, | |
| 9 | − PtyProcess, | |
| 10 | −} from "../Services/PTY"; | |
| 4 | +import { PtyAdapter, PtyAdapterShape, PtyExitEvent, PtyProcess } from "../Services/PTY"; | |
| 11 | 5 | |
| 12 | 6 | let didEnsureSpawnHelperExecutable = false; |
| 13 | 7 | |
| @@ -96,14 +90,7 @@ export const NodePtyAdapterLive = Layer.effect( · 82 unmodified lines | ||
| 96 | 90 | const fs = yield* FileSystem.FileSystem; |
| 97 | 91 | const path = yield* Path.Path; |
| 98 | 92 | |
| 99 | − const nodePty = yield* Effect.tryPromise({ | |
| 100 | − try: () => import("node-pty"), | |
| 101 | − catch: (cause) => | |
| 102 | − new PtyAdapterInitializationError({ | |
| 103 | − message: "failed to load node-pty module", | |
| 104 | − cause, | |
| 105 | − }), | |
| 106 | − }); | |
| 93 | + const nodePty = yield* Effect.promise(() => import("node-pty")); | |
| 107 | 94 | |
| 108 | 95 | const ensureNodePtySpawnHelperExecutableCached = yield* Effect.cached( |
| 109 | 96 | ensureNodePtySpawnHelperExecutable().pipe( |