fix: keep read path validation model-visible
This commit is contained in:
parent
e82542b802
commit
9d61eef141
4 changed files with 48 additions and 10 deletions
|
|
@ -67,6 +67,11 @@ describe("FileSystem", () => {
|
|||
|
||||
expect(yield* service.read({ path: output })).toMatchObject({ type: "text", content: "failure here" })
|
||||
expect((yield* service.resolveRoot({ path: output })).real).toBe(output)
|
||||
expect(
|
||||
yield* service
|
||||
.resolveReadPath({ path: unrelated })
|
||||
.pipe(Effect.catchDefect((defect) => Effect.succeed(defect))),
|
||||
).toBeInstanceOf(FileSystem.PathValidationError)
|
||||
expect(yield* Effect.exit(service.read({ path: unrelated }))).toMatchObject({ _tag: "Failure" })
|
||||
expect(yield* Effect.exit(service.read({ path: managed }))).toMatchObject({ _tag: "Failure" })
|
||||
}).pipe(provide(worktree, inertReferences, FSUtil.defaultLayer, data))
|
||||
|
|
|
|||
|
|
@ -490,6 +490,23 @@ describe("ReadTool", () => {
|
|||
}),
|
||||
)
|
||||
|
||||
it.effect("returns path validation failures as model-visible tool output", () =>
|
||||
Effect.gen(function* () {
|
||||
const registry = yield* ToolRegistry.Service
|
||||
|
||||
resolveFailure = new FileSystem.PathValidationError("Absolute path is not managed tool output")
|
||||
expect(
|
||||
yield* executeTool(registry, {
|
||||
sessionID,
|
||||
...toolIdentity,
|
||||
call: { type: "tool-call", id: "call-unmanaged", name: "read", input: { path: "/tmp/private.txt" } },
|
||||
}),
|
||||
).toEqual({ type: "error", value: "Absolute path is not managed tool output" })
|
||||
|
||||
expect(readCalls).toEqual([])
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("forwards pagination and returns bounded text pages with continuation", () =>
|
||||
Effect.gen(function* () {
|
||||
readResult = new FileSystem.TextPage({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue