-
-
Notifications
You must be signed in to change notification settings - Fork 910
Add session-level auto-approve for AI file read operations #3101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
mits-pl
wants to merge
28
commits into
wavetermdev:main
from
mits-pl:feature/session-read-auto-approve
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
20de8a8
add session-level auto-approve for AI file read operations
programista-wordpress 03ae5bd
fix: handle Windows path separators in directory extraction
programista-wordpress 0ab2969
fix: block sensitive directories from session auto-approval
programista-wordpress 42a16e7
fix: canonicalize paths with symlink resolution to prevent bypass
programista-wordpress 12f4861
feat: add MCP (Model Context Protocol) client package
programista-wordpress 85eb4b0
feat: integrate MCP with AI chat pipeline
programista-wordpress f7f72c6
feat: MCP Context toggle and auto-detect in AI panel
programista-wordpress 69c7e84
feat: MCP Client widget with tools panel and call log
programista-wordpress 92c9603
feat: web content tools - read text, read HTML, SEO audit
programista-wordpress 0e6a6bc
feat: session history - persist and display previous AI sessions
programista-wordpress dd7f3d8
feat: AI execution plans with progress tracking
programista-wordpress b4c8402
feat: project instructions reader (WAVE.md, CLAUDE.md, .cursorrules)
programista-wordpress b02b7f6
perf: compress tool descriptions and consolidate utility tools
programista-wordpress df51b85
fix: syntax highlighting in AI diff viewer
programista-wordpress 7a0db93
feat: Quick Add Model with BYOK presets
programista-wordpress f6d1e4f
feat: graceful shutdown for MCP clients and session history save
programista-wordpress 7df705f
fix: improve AI message handling and shell command detection
programista-wordpress 54da2fc
docs: update README with MCP, web tools, plans, session history, and …
programista-wordpress ce1f244
feat: improve AI quality - project stack context, detailed plans, pro…
programista-wordpress 7c39a6b
security: sanitize WebSelector opts in RPC handler
programista-wordpress e2b0558
fix: use error banner instead of API key input for Ollama connection …
programista-wordpress e189c5a
fix: only send mcpcwd when MCP context is enabled
programista-wordpress d1532e5
a11y: add switch role and aria-label to toggle buttons
programista-wordpress 776abcb
fix: prevent panic on missing step_id in plan_update
programista-wordpress 5aa0c87
fix: remove hardcoded tool names and approval language from system pr…
programista-wordpress e17cc55
fix: kill MCP process on read timeout to prevent goroutine leak
programista-wordpress 4b32276
brand: introduce Wove - AI-first terminal built on Wave engine
programista-wordpress 669c647
brand: rename to Wove - AI-first terminal
programista-wordpress File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| // Copyright 2025, Command Line Inc. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package aiusechat | ||
|
|
||
| import ( | ||
| "path/filepath" | ||
| "strings" | ||
| "sync" | ||
|
|
||
| "github.com/wavetermdev/waveterm/pkg/util/logutil" | ||
| "github.com/wavetermdev/waveterm/pkg/wavebase" | ||
| ) | ||
|
|
||
| // SessionApprovalRegistry tracks paths that the user has approved for reading | ||
| // during the current session. This is in-memory only and resets when the app restarts. | ||
| type SessionApprovalRegistry struct { | ||
| mu sync.RWMutex | ||
| approvedPaths map[string]bool // set of approved directory prefixes | ||
| } | ||
|
|
||
| var globalSessionApproval = &SessionApprovalRegistry{ | ||
| approvedPaths: make(map[string]bool), | ||
| } | ||
|
|
||
| // AddSessionReadApproval adds a directory path to the session-level read approval list. | ||
| // All files under this directory (and subdirectories) will be auto-approved for reading. | ||
| func AddSessionReadApproval(dirPath string) { | ||
| expanded, err := wavebase.ExpandHomeDir(dirPath) | ||
| if err != nil { | ||
| expanded = dirPath | ||
| } | ||
| cleaned := filepath.Clean(expanded) | ||
| if !strings.HasSuffix(cleaned, string(filepath.Separator)) { | ||
| cleaned += string(filepath.Separator) | ||
| } | ||
| logutil.DevPrintf("session read approval added: %s\n", cleaned) | ||
| globalSessionApproval.mu.Lock() | ||
| defer globalSessionApproval.mu.Unlock() | ||
| globalSessionApproval.approvedPaths[cleaned] = true | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| // IsSessionReadApproved checks if a file path falls under any session-approved directory. | ||
| func IsSessionReadApproved(filePath string) bool { | ||
| cleaned := filepath.Clean(filePath) | ||
| globalSessionApproval.mu.RLock() | ||
| defer globalSessionApproval.mu.RUnlock() | ||
| for approvedDir := range globalSessionApproval.approvedPaths { | ||
| if strings.HasPrefix(cleaned, approvedDir) || cleaned == strings.TrimSuffix(approvedDir, string(filepath.Separator)) { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| // GetSessionApprovedPaths returns a copy of all currently approved paths. | ||
| func GetSessionApprovedPaths() []string { | ||
| globalSessionApproval.mu.RLock() | ||
| defer globalSessionApproval.mu.RUnlock() | ||
| paths := make([]string, 0, len(globalSessionApproval.approvedPaths)) | ||
| for p := range globalSessionApproval.approvedPaths { | ||
| paths = append(paths, p) | ||
| } | ||
| return paths | ||
| } | ||
|
|
||
| // ClearSessionApprovals removes all session-level read approvals. | ||
| func ClearSessionApprovals() { | ||
| globalSessionApproval.mu.Lock() | ||
| defer globalSessionApproval.mu.Unlock() | ||
| globalSessionApproval.approvedPaths = make(map[string]bool) | ||
| } | ||
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.