diff options
| author | Kit Langton <[email protected]> | 2026-04-30 20:33:04 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-30 20:33:04 -0400 |
| commit | a499fe2b1751f79a44808066ec053c36071a9f28 (patch) | |
| tree | c8c4e4cd7669647568879d2b7c9d0e2d2f03ed58 /packages | |
| parent | 451650b584e9eee3b8c7c488a7b3daafd6bdf487 (diff) | |
| download | opencode-a499fe2b1751f79a44808066ec053c36071a9f28.tar.gz opencode-a499fe2b1751f79a44808066ec053c36071a9f28.zip | |
refactor(tool/read): yield InstanceState.context instead of reading ALS (#25183)
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/tool/read.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/opencode/src/tool/read.ts b/packages/opencode/src/tool/read.ts index fb386f579..ef33a48de 100644 --- a/packages/opencode/src/tool/read.ts +++ b/packages/opencode/src/tool/read.ts @@ -7,7 +7,7 @@ import * as Tool from "./tool" import { AppFileSystem } from "@opencode-ai/core/filesystem" import { LSP } from "@/lsp/lsp" import DESCRIPTION from "./read.txt" -import { Instance } from "../project/instance" +import { InstanceState } from "@/effect/instance-state" import { assertExternalDirectoryEffect } from "./external-directory" import { Instruction } from "../session/instruction" import { isImageAttachment, isPdfAttachment, sniffAttachmentMime } from "@/util/media" @@ -157,14 +157,15 @@ export const ReadTool = Tool.define( return yield* Effect.fail(new Error("offset must be greater than or equal to 1")) } + const instance = yield* InstanceState.context let filepath = params.filePath if (!path.isAbsolute(filepath)) { - filepath = path.resolve(Instance.directory, filepath) + filepath = path.resolve(instance.directory, filepath) } if (process.platform === "win32") { filepath = AppFileSystem.normalizePath(filepath) } - const title = path.relative(Instance.worktree, filepath) + const title = path.relative(instance.worktree, filepath) const stat = yield* fs.stat(filepath).pipe( Effect.catchIf( |
