chore: upgrade Effect to beta.98 (#37498)

This commit is contained in:
Kit Langton 2026-07-17 10:31:27 -04:00 committed by GitHub
commit 44f7bb71c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 316 additions and 138 deletions

View file

@ -23,7 +23,7 @@ import { Skill } from "../skill"
import { Effect, Context, Layer, Schema } from "effect"
import { InstanceState } from "@/effect/instance-state"
import * as Option from "effect/Option"
import * as OtelTracer from "@effect/opentelemetry/Tracer"
import * as OtelTracer from "@effect/opentelemetry/OtelTracer"
import { AbsolutePath, type DeepMutable } from "@opencode-ai/core/schema"
import { ProviderV2 } from "@opencode-ai/core/provider"
import { ModelV2 } from "@opencode-ai/core/model"

View file

@ -315,7 +315,7 @@ const layer = Layer.effect(
if (input.icon?.url) return
const matches = yield* fs
.glob("**/favicon.{ico,png,svg,jpg,jpeg,webp}", {
.scan("**/favicon.{ico,png,svg,jpg,jpeg,webp}", {
cwd: input.worktree,
absolute: true,
include: "file",

View file

@ -186,7 +186,7 @@ export const ExperimentalApi = HttpApi.make("experimental")
),
HttpApiEndpoint.post("worktreeCreate", ExperimentalPaths.worktree, {
disableCodecs: true,
query: WorkspaceRoutingQuery,
query: WorkspaceRoutingQueryFields,
payload: [HttpApiSchema.NoContent, Worktree.CreateInput],
success: described(Worktree.Info, "Worktree created"),
error: WorktreeApiError,

View file

@ -138,7 +138,7 @@ const layer: Layer.Layer<
const instruction = raw.startsWith("~/") ? path.join(global.home, raw.slice(2)) : raw
const matches = yield* (
path.isAbsolute(instruction)
? fs.glob(path.basename(instruction), {
? fs.scan(path.basename(instruction), {
cwd: path.dirname(instruction),
absolute: true,
include: "file",

View file

@ -25,7 +25,7 @@ import { Auth } from "@/auth"
import { EffectBridge } from "@/effect/bridge"
import { RuntimeFlags } from "@/effect/runtime-flags"
import * as Option from "effect/Option"
import * as OtelTracer from "@effect/opentelemetry/Tracer"
import * as OtelTracer from "@effect/opentelemetry/OtelTracer"
import { LLMAISDK } from "./llm/ai-sdk"
import { LLMNativeRuntime } from "./llm/native-runtime"
import { LLMRequestPrep } from "./llm/request"

View file

@ -82,7 +82,7 @@ const MIGRATIONS: Migration[] = [
Effect.fn("Storage.migration.1")(function* (dir: string, fs: FSUtil.Interface, git: Git.Interface) {
const project = path.resolve(dir, "../project")
if (!(yield* fs.isDir(project))) return
const projectDirs = yield* fs.glob("*", {
const projectDirs = yield* fs.scan("*", {
cwd: project,
include: "all",
})
@ -94,7 +94,7 @@ const MIGRATIONS: Migration[] = [
let worktree = "/"
if (projectID !== "global") {
for (const msgFile of yield* fs.glob("storage/session/message/*/*.json", {
for (const msgFile of yield* fs.scan("storage/session/message/*/*.json", {
cwd: full,
absolute: true,
})) {
@ -136,7 +136,7 @@ const MIGRATIONS: Migration[] = [
)
yield* Effect.logInfo(`migrating sessions for project ${projectID}`)
for (const sessionFile of yield* fs.glob("storage/session/info/*.json", {
for (const sessionFile of yield* fs.scan("storage/session/info/*.json", {
cwd: full,
absolute: true,
})) {
@ -147,7 +147,7 @@ const MIGRATIONS: Migration[] = [
yield* fs.writeWithDirs(dest, JSON.stringify(session, null, 2))
if (Option.isNone(info)) continue
yield* Effect.logInfo(`migrating messages for session ${info.value.id}`)
for (const msgFile of yield* fs.glob(`storage/session/message/${info.value.id}/*.json`, {
for (const msgFile of yield* fs.scan(`storage/session/message/${info.value.id}/*.json`, {
cwd: full,
absolute: true,
})) {
@ -162,7 +162,7 @@ const MIGRATIONS: Migration[] = [
if (Option.isNone(item)) continue
yield* Effect.logInfo(`migrating parts for message ${item.value.id}`)
for (const partFile of yield* fs.glob(`storage/session/part/${info.value.id}/${item.value.id}/*.json`, {
for (const partFile of yield* fs.scan(`storage/session/part/${info.value.id}/${item.value.id}/*.json`, {
cwd: full,
absolute: true,
})) {
@ -180,7 +180,7 @@ const MIGRATIONS: Migration[] = [
}
}),
Effect.fn("Storage.migration.2")(function* (dir: string, fs: FSUtil.Interface) {
for (const item of yield* fs.glob("session/*/*.json", {
for (const item of yield* fs.scan("session/*/*.json", {
cwd: dir,
absolute: true,
})) {
@ -302,7 +302,7 @@ const layer = Layer.effect(
const dir = (yield* state).dir
const cwd = path.join(dir, ...prefix)
const result = yield* fs
.glob("**/*", {
.scan("**/*", {
cwd,
include: "file",
})

View file

@ -220,7 +220,7 @@ describe("FSUtil", () => {
yield* fs.writeFileString(path.join(tmp, "b.ts"), "b")
yield* fs.writeFileString(path.join(tmp, "c.json"), "c")
const result = yield* fs.glob("*.ts", { cwd: tmp })
const result = yield* fs.scan("*.ts", { cwd: tmp })
expect(result.sort()).toEqual(["a.ts", "b.ts"])
}),
)
@ -232,7 +232,7 @@ describe("FSUtil", () => {
const tmp = yield* fs.makeTempDirectoryScoped()
yield* fs.writeFileString(path.join(tmp, "file.txt"), "hello")
const result = yield* fs.glob("*.txt", { cwd: tmp, absolute: true })
const result = yield* fs.scan("*.txt", { cwd: tmp, absolute: true })
expect(result).toEqual([path.join(tmp, "file.txt")])
}),
)

View file

@ -202,7 +202,7 @@ export function withCliFixture<A, E>(
yield* Effect.addFinalizer(() =>
fs
.remove(home, { recursive: true })
.pipe(Effect.retry(Schedule.spaced("50 millis").pipe(Schedule.both(Schedule.recurs(20)))), Effect.ignore),
.pipe(Effect.retry(Schedule.max([Schedule.spaced("50 millis"), Schedule.recurs(20)])), Effect.ignore),
)
const env = isolatedEnv(home)

View file

@ -47,8 +47,8 @@ function remappedFs(root: string) {
writeWithDirs: (file, content, mode) => fs.writeWithDirs(remap(root, file), content, mode),
readFileString: (file) => fs.readFileString(remap(root, file)),
remove: (file) => fs.remove(remap(root, file)),
glob: (pattern, options) =>
fs.glob(pattern, options?.cwd ? { ...options, cwd: remap(root, options.cwd) } : options),
scan: (pattern, options) =>
fs.scan(pattern, options?.cwd ? { ...options, cwd: remap(root, options.cwd) } : options),
})
}),
).pipe(Layer.provide(LayerNode.compile(FSUtil.node)))