refactor(effect): scope read tool warmup
Capture Scope.Scope in the read tool effect and fork LSP warmup into that scope instead of using runFork inside Effect.sync. This keeps the fire-and-forget behavior while matching the surrounding Effect patterns.pull/21016/head
parent
98384cd860
commit
b15f1593c0
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod"
|
||||
import { Effect } from "effect"
|
||||
import { Effect, Scope } from "effect"
|
||||
import { createReadStream } from "fs"
|
||||
import { open } from "fs/promises"
|
||||
import * as path from "path"
|
||||
|
|
@ -32,6 +32,7 @@ export const ReadTool = Tool.defineEffect(
|
|||
const instruction = yield* Instruction.Service
|
||||
const lsp = yield* LSP.Service
|
||||
const time = yield* FileTime.Service
|
||||
const scope = yield* Scope.Scope
|
||||
|
||||
const miss = Effect.fn("ReadTool.miss")(function* (filepath: string) {
|
||||
const dir = path.dirname(filepath)
|
||||
|
|
@ -77,9 +78,7 @@ export const ReadTool = Tool.defineEffect(
|
|||
})
|
||||
|
||||
const warm = Effect.fn("ReadTool.warm")(function* (filepath: string, sessionID: Tool.Context["sessionID"]) {
|
||||
yield* Effect.sync(() => {
|
||||
void Effect.runFork(lsp.touchFile(filepath, false))
|
||||
})
|
||||
yield* lsp.touchFile(filepath, false).pipe(Effect.ignore, Effect.forkIn(scope))
|
||||
yield* time.read(sessionID, filepath)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue