-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: AppMap AI: Explain #859
Conversation
src/webviews/getWebviewContent.ts
Outdated
img-src ${webview.cspSource} data:; | ||
script-src ${webview.cspSource} 'unsafe-eval'; | ||
style-src ${webview.cspSource} 'unsafe-inline'; | ||
"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't remove the CSP; if we want the UI to be able to connect to the server (which I don't think it should be able to do directly) then we need to set it as small as possible, cf. #845 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to update the CSP to something that will work. If you can contribute a working snippet I'd be happy to apply it. Decoupling the frontend from the RPC is not something we will take on at this time; since it's already an abstraction over the CLI and the AI backend, I'm not sure why another layer on top of that would be needed or what it would contirbute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the CSP back in 006ad8b — what was needed was fetch-src http://localhost:${rpcPort}
.
2590d45
to
d36cfe2
Compare
Add Explain top-level command. Add Explain quick search command from an open editor.
These were only used for long-ago-removed telemetry.
Rather than showing a user-visible information message
It never happens
It's not handled by the view
It's never sent; this is a deprecated feature.
Does not appear to be used; there aren't release notes available.
3a01a83
to
006ad8b
Compare
🎉 This PR is included in version 0.107.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Dependencies
Commands
AppMap: AI Explain
top-level commandRunning this command opens the Explain UI page.
Explain with AppMap AI
quick search command from an open editor.When the user selects some code in a supported language, the "light bulb" appears. This is known in VSCode as "Quick Search", it opens the AppMap Explain AI page with the question pre-populated with the user's selection.
Considerations
AppMap state
AppMap state (basically, the filter popup), can be saved, applied, and transferred to and from the clipboard. This functionality should work for the AppMaps shown in the Explain UI as well.
AppMap RPC server
The
appmap index
command should be launched with options--port 0
. With this option, the index process will run a JSON-RPC service on an OS-assigned port. JSON-RPC was chosen for the transport because it's also used by the Language Server Protocol.The port is printed to stdout by the index command, so the Plugin should scan stdout to determine this port.
When an Explain UI page is launched, it should be provided with this port number via the
appmapRpcPort
property.API key
The AppMap RPC server makes HTTP calls to the AppMap API services, including a hosted completion AI. Therefore, the user must have an AppMap API key to run the RPC server. The API key is provided to the
appmap index
command using the environment variableAPPMAP_API_KEY
.Not shown in this PR - the AppMap API key is also provided to the Help chat and Explain chat directly as a property, so that the chat UI can send user feedback to the AppMap API services (thumbs up / thumbs down).