Skip to content

Commit 64f9666

Browse files
committed
fix(core): preserve glob tool contract
1 parent 283cda9 commit 64f9666

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

‎packages/core/src/tool/glob.ts‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ export const name = "glob"
1717

1818
export const Input = Schema.Struct({
1919
pattern: FileSystem.GlobInput.fields.pattern.annotate({ description: "Glob pattern to match files against" }),
20-
path: Schema.String.pipe(Schema.optional).annotate({
21-
description:
22-
"Directory to search. Relative paths resolve from the active Location. Absolute paths inside it are accepted; external absolute paths require external_directory approval.",
20+
path: RelativePath.pipe(Schema.optional).annotate({
21+
description: "Relative directory to search. Defaults to the active Location.",
2322
}),
2423
limit: FileSystem.GlobInput.fields.limit.annotate({
2524
description: `Maximum results to return (default: ${FileSystem.DEFAULT_SEARCH_LIMIT})`,
@@ -56,7 +55,7 @@ export const Plugin = {
5655
name,
5756
Tool.make({
5857
description:
59-
"Find files by glob pattern. Relative paths resolve from the active Location; explicit external paths require external_directory approval. Returns concise file resources. Use path to narrow the search and limit to bound the result count.",
58+
"Find files by glob pattern within the active Location. Returns concise relative file resources. Use a relative path to narrow the search and limit to bound the result count.",
6059
input: Input,
6160
output: Output,
6261
execute: (input, context) =>
@@ -84,17 +83,13 @@ export const Plugin = {
8483
agent: context.agent,
8584
source,
8685
})
87-
const info = yield* fs
86+
yield* fs
8887
.stat(target.canonical)
8988
.pipe(
9089
Effect.catchReason("PlatformError", "NotFound", () =>
9190
Effect.fail(new ToolFailure({ message: `Search path does not exist: ${input.path ?? "."}` })),
9291
),
9392
)
94-
if (info.type !== "Directory")
95-
return yield* Effect.fail(
96-
new ToolFailure({ message: `Search path is not a directory: ${input.path ?? "."}` }),
97-
)
9893
const root = path.resolve(location.directory, input.path ?? ".")
9994
const limit = input.limit ?? FileSystem.DEFAULT_SEARCH_LIMIT
10095
const entries = yield* ripgrep

0 commit comments

Comments
 (0)