feat: expose recent tinymist logs to tools and AI agents - #2418
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the TinyMist VS Code extension by making its operational logs programmatically accessible. Previously, logs were only viewable by human users in the VS Code Output panel, posing a challenge for automated tools and AI agents that need to diagnose issues. The changes introduce a mechanism to buffer these logs and expose them via a hidden command, enabling seamless integration with external tooling for debugging and analysis without altering the user interface. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces programmatic access to TinyMist logs via a new tinymist.getLogText command and a BufferedOutputChannel class, intended to support AI agents and other tooling. However, a critical security vulnerability has been identified in the buffer management logic: the use of slice(-0) can lead to unintended data exposure when requesting zero characters and potential memory exhaustion if the buffer limit is set to zero. Additionally, refactoring in extension.shared.ts for makeExecCommand has removed error handling for the child process and introduced a type incompatibility with the ExecResult interface. In lsp.ts, necessary type definitions appear to have been accidentally removed, which will cause compilation to fail. Please address these issues for a robust and secure implementation.
98b3bb9 to
16429c7
Compare
|
Updated the branch to local HEAD What changed in this update:
The open PR should now reflect the intended code rather than the earlier incomplete remote state. |
There was a problem hiding this comment.
Pull request overview
This PR makes recent TinyMist VS Code extension logs programmatically accessible (for tools/agents) by buffering the extension output channel in memory and exposing a hidden command to retrieve the buffered text.
Changes:
- Wrapped the existing
Tinymist Typstoutput channel with a bounded in-memory buffer and addedLanguageState.getLogText(maxChars?). - Registered a hidden
tinymist.getLogTextcommand to return the buffered log tail. - Added an e2e test validating retrieval and truncation behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| editors/vscode/src/lsp.ts | Adds BufferedOutputChannel and exposes LanguageState.getLogText() backed by an in-memory ring-ish buffer. |
| editors/vscode/src/extension.shared.ts | Registers hidden command tinymist.getLogText to expose buffered logs to callers. |
| editors/vscode/src/test/e2e/simple-docs.test.ts | Adds e2e test for tinymist.getLogText and maxChars truncation. |
You can also share your feedback on Copilot code review. Take the survey.
Summary
This adds programmatic access to recent TinyMist VS Code extension logs.
Today,
tinymist.showLogonly opens the VS Code Output panel. That works for humans, but not for tooling. In practice, AI agents and other automation can often inspect diagnostics and command results, but cannot read raw Output panel contents. That makes TinyMist failures harder to diagnose unless the user manually copies the log text.This change adds a bounded in-memory buffer around the existing
Tinymist Typstoutput channel and exposes a hiddentinymist.getLogTextcommand that returns recent log text, optionally truncated withmaxChars.Why
The main motivation is to make TinyMist logs accessible to AI agents and other tools.
Typical agent workflows in VS Code can read files, diagnostics, and command results, but they usually cannot inspect the Output panel directly because VS Code output channels are effectively write-only to external tooling. That creates a blind spot for compile and runtime failures that TinyMist logs but does not surface through normal diagnostics.
By exposing recent logs through a command:
What changed
editors/vscode/src/lsp.ts.LanguageState.getLogText(maxChars?)ineditors/vscode/src/lsp.ts.tinymist.getLogTextcommand ineditors/vscode/src/extension.shared.ts.editors/vscode/src/test/e2e/simple-docs.test.ts.Behavior
tinymist.showLogstill opens the Output panel.tinymist.getLogTextreturns the buffered recent log text.maxCharsreturns only the most recent tail.Testing
src/lsp.code-action.ts:49.Notes
This is intentionally implemented as a hidden command rather than a new visible UI command because the primary consumer is tooling rather than end users.