Typst Side Agent (Chrome Extension for typst.app editor): AI Assistant with line-precise editing, diagnostics loop, and tools


Hi everyone — I’m sharing Typst Side Agent, an open-source Chrome extension that adds a side-panel AI assistant to typst.app.

It is designed for iterative, tool-driven editing (rather than plain chat), with a focus on reproducibility and document safety.

What it does

  • Reads the live editor content with line numbers and workspace context
  • Applies targeted edits (replace_lines, search_replace) and multi-edit atomic patches
  • Captures preview screenshots / opened image assets as optional context
  • Reads diagnostics from both editor underlines and the Improve panel
  • Supports a diagnostics loop (read_diagnostics) so the agent can validate/fix after edits
  • Extends with:
    • custom HTTP tools (JSON-schema function calling)
    • MCP servers (Streamable HTTP)

Why I built it

I genuinely like the official Typst web editor — it feels smooth and practical.
On my machine, editing Typst documents in VS Code is often laggy, so I prefer writing in typst.app.

The problem I ran into was AI-assisted workflows: once I wanted an agent to participate in the editing loop (read current content, apply precise edits, check diagnostics, iterate), integrating that cleanly was harder than expected. This extension is my attempt to make that workflow practical.

Technical notes

  • Chrome extension, Manifest V3
  • OpenAI-compatible Chat Completions + tool calling + SSE streaming
  • Works with multiple provider styles for reasoning/thinking streams
  • Bundles Typst reference docs for in-agent lookup
  • Session management per Typst project
  • CI-tested and packaged via GitHub Actions

My testing so far is still limited, so there may be rough edges or bugs.
If you run into issues, please feel free to open an issue on GitHub or comment directly below this post. Feedback is very welcome.

Hi. In what way are these things achieved?

By reproducibility, I mean the agent edits through explicit tools (read_document , replace_lines , patch_document ) on the live document, so the steps are traceable and repeatable.
By document safety, I mean edits are constrained (line-based/atomic where possible) and followed by read_diagnostics checks, which helps catch bad changes early.

So basically “safe from errors”?

Basically yes, what I want to say here is that this AI assistant plugin is designed to edit the document safely to reduce accidental large destructive changes, with a real agentic step-by-step design with tools to achieve that.