feat: replace pi-based filesystem tools with native implementation#363
Closed
shadowfax92 wants to merge 4 commits intomainfrom
Closed
feat: replace pi-based filesystem tools with native implementation#363shadowfax92 wants to merge 4 commits intomainfrom
shadowfax92 wants to merge 4 commits intomainfrom
Conversation
Contributor
Greptile SummarySuccessfully replaces pi-based filesystem tools with a native in-repo implementation while preserving existing tool names and behavior. Key improvements:
Implementation quality:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[AiSdkAgent] -->|buildFilesystemToolSet| B[native-tool-adapter]
B -->|wraps| C[Native Tool Implementations]
C --> D[read.ts]
C --> E[write.ts]
C --> F[edit.ts]
C --> G[grep.ts]
C --> H[find.ts]
C --> I[ls.ts]
C --> J[bash.ts]
D -->|uses| K[path-utils]
E -->|uses| K
F -->|uses| K
G -->|uses| K
H -->|uses| K
I -->|uses| K
D -->|uses| L[truncate]
G -->|uses| L
H -->|uses| L
I -->|uses| L
J -->|uses| L
K -->|security| M[Path Boundary Checks]
K -->|security| N[Symlink Resolution]
G -->|uses| O[scan.ts]
H -->|uses| O
B -->|returns| P[ToolSet]
P -->|registered as| Q[filesystem_read, filesystem_write, etc]
Last reviewed commit: c9e638f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@mariozechner/pi-agent-core+@mariozechner/pi-coding-agentfilesystem tool adapter inapps/serverwith native in-repo tools.filesystem_*tool names and chat-mode behavior while adding explicit session-directory boundary checks and bounded output handling.apps/server/package.json.Design
This change keeps the existing ToolLoopAgent integration seam intact (
AiSdkAgentstill composes browser tools, external MCP tools, and filesystem tools), but swaps the filesystem layer to a modular native implementation underapps/server/src/agent/tool-loop/filesystem-tools/. The new structure follows pi-mono’s small-per-tool module style while applying stricter safety constraints inspired by Gemini CLI, including consistent path validation, deterministic limits/truncation, and normalized model output mapping.Test plan
bun run --filter @browseros/server typecheckbun test apps/server/tests/agent/filesystem-toolsbun test apps/server/tests(contains existing unrelated failures in this repo; this change does not modify those areas)