Skip to content

Commit

Permalink
Enhance: Allow all "read" calls from our tools
Browse files Browse the repository at this point in the history
If a tool call starts with get, list, or read and is from our github
org, then auto-approve it.

Signed-off-by: Craig Jellick <craig@acorn.io>
  • Loading branch information
cjellick committed Sep 4, 2024
1 parent 50bdc85 commit b7d74a9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions components/chat/useChatSocket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,18 @@ const useChatSocket = (isEmpty?: boolean) => {
if (frame.tool.source?.repo) {
const repo = frame.tool?.source.repo.Root;
const trimmedRepo = trimRepo(repo);

// If it is a read-only tool we've authored, auto-allow it.
if (
trimmedRepo.startsWith('github.com/gptscript-ai') &&
(frame.tool.name?.startsWith('list') ||
frame.tool.name?.startsWith('get') ||
frame.tool.name?.startsWith('read') ||
frame.tool.name?.startsWith('search'))
) {
return true;
}

for (const prefix of trustedRepoPrefixesRef.current) {
if (trimmedRepo.startsWith(prefix)) {
return true;
Expand Down

0 comments on commit b7d74a9

Please sign in to comment.