Skip to content

feat: expose recent tinymist logs to tools and AI agents - #2418

Open
flol3622 wants to merge 2 commits into
Myriad-Dreamin:mainfrom
flol3622:feat/agent-readable-log-text
Open

feat: expose recent tinymist logs to tools and AI agents#2418
flol3622 wants to merge 2 commits into
Myriad-Dreamin:mainfrom
flol3622:feat/agent-readable-log-text

Conversation

@flol3622

@flol3622 flol3622 commented Mar 9, 2026

Copy link
Copy Markdown

Summary

This adds programmatic access to recent TinyMist VS Code extension logs.

Today, tinymist.showLog only 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 Typst output channel and exposes a hidden tinymist.getLogText command that returns recent log text, optionally truncated with maxChars.

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:

  • AI agents can inspect TinyMist output without requiring the user to copy-paste logs.
  • Other tooling can programmatically retrieve recent log text for debugging or integration.
  • Existing UI behavior stays unchanged for human users.

What changed

  • Added a buffered output channel wrapper in editors/vscode/src/lsp.ts.
  • Added LanguageState.getLogText(maxChars?) in editors/vscode/src/lsp.ts.
  • Registered a hidden tinymist.getLogText command in editors/vscode/src/extension.shared.ts.
  • Added an e2e test in editors/vscode/src/test/e2e/simple-docs.test.ts.

Behavior

  • tinymist.showLog still opens the Output panel.
  • tinymist.getLogText returns the buffered recent log text.
  • Passing maxChars returns only the most recent tail.
  • Clearing the output channel clears the in-memory buffer as well.

Testing

  • Added e2e coverage for reading recent log text and truncation behavior.
  • The touched files are clean under editor diagnostics.
  • A full extension typecheck in the local clone still reported one unrelated existing error in 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.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Programmatic Log Access: Implemented a new hidden VS Code command, "tinymist.getLogText", allowing external tools and AI agents to programmatically retrieve recent logs from the TinyMist extension's output channel.
  • Buffered Output Channel: Introduced a "BufferedOutputChannel" wrapper that maintains an in-memory buffer of the extension's logs, making them accessible for retrieval while preserving existing UI behavior.
  • E2E Testing: Added end-to-end tests to verify the functionality of retrieving log text and its truncation behavior.

🧠 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
  • editors/vscode/src/extension.shared.ts
    • Registered a new hidden command "tinymist.getLogText" to retrieve buffered logs.
    • Refactored process execution handling in "makeExecCommand" for improved async behavior.
    • Removed the "statusBarFormatString" function.
  • editors/vscode/src/lsp.ts
    • Added "BufferedOutputChannel" class to store output channel content in memory.
    • Updated "LanguageState" to use "BufferedOutputChannel" for its output.
    • Implemented "getLogText" method in "LanguageState" to expose buffered logs.
    • Removed several unused interfaces and a helper function.
  • editors/vscode/src/test/e2e/simple-docs.test.ts
    • Added an end-to-end test for the new log retrieval command, including truncation.
Activity
  • The pull request was created by flol3622.
  • The changes have been implemented and are ready for review.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread editors/vscode/src/lsp.ts
Comment thread editors/vscode/src/extension.shared.ts Outdated
Comment thread editors/vscode/src/lsp.ts
Comment thread editors/vscode/src/lsp.ts
@flol3622
flol3622 force-pushed the feat/agent-readable-log-text branch from 98b3bb9 to 16429c7 Compare March 9, 2026 08:49
@flol3622

flol3622 commented Mar 9, 2026

Copy link
Copy Markdown
Author

Updated the branch to local HEAD 16429c74.

What changed in this update:

  • Fixed the zero-length edge case in BufferedOutputChannel.getText, so maxChars: 0 now returns an empty string instead of the full buffer.
  • Fixed the zero-capacity edge case in BufferedOutputChannel.push, so a maxChars <= 0 buffer cannot grow unexpectedly.
  • Added test coverage for the maxChars: 0 case.
  • Republished the branch from the exact local git history, which also restores the full lsp.ts content after the earlier branch upload mismatch.

The open PR should now reflect the intended code rather than the earlier incomplete remote state.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Typst output channel with a bounded in-memory buffer and added LanguageState.getLogText(maxChars?).
  • Registered a hidden tinymist.getLogText command 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.

Comment thread editors/vscode/src/extension.shared.ts
@Myriad-Dreamin Myriad-Dreamin changed the title Expose recent TinyMist logs to tools and AI agents feat: expose recent tinymist logs to tools and AI agents Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants