feat: add the slc VS Code extension (surface) #1

Open
jgaspard wants to merge 20 commits from jgaspard/slc:main into main
Member

Adds surface/, the VS Code extension for SLC: a Cursor-style chat in the secondary sidebar that talks to the ScottyLabs AI gateway (LiteLLM) through this repo's secretspec setup.

  • Chat: tabs and history, copy, file attachments (picker or drag and drop), macOS dictation, a model picker with the gateway's models (Sonnet 5.5 by default), and streaming replies with markdown, tables and LaTeX (KaTeX).
  • Modes:
    • Ask reads the code (list_files, read_file, search) and answers.
    • Plan reads the code and writes a markdown plan, shown as a card with Open and Build.
    • Agent can also edit files and run commands.
  • Inline review: agent edits are written into the file and highlighted in the editor, with Undo / Keep on each change (Cmd+N / Cmd+Y) and an Undo / Keep / Review bar for all changed files. The user's own typing never counts as an agent change.
  • Safety: tools only work inside the open workspace, every command needs an explicit Run click, and the gateway key stays in memory and out of commands' environment.

Try it

  1. Log in to OpenBao (see "Setting up OpenBao" in the root README).
  2. cd surface && npm install && npm run compile
  3. Open surface/ in VS Code and press F5. The extension gets the dev key from secretspec by itself.

Docs

  • surface/README.md: running it, using it, and how the code fits together.
  • surface/docs/files.md: how the agent reads and changes files (tools, pending changes, Keep / Undo, limits).
  • AGENTS.md: guidelines and git workflow for contributors. CLAUDE.md just points to it.

Testing

  • npm run compile passes.
  • Checked end to end in an Extension Development Host with Sonnet 5.5: an Agent run edited a file and ran an approved command, and a Plan run wrote a plan that Build then carried out.
  • The webview was checked in headless Chrome at sidebar width, and the change tracking (keep / undo per change and per file, the user's own edits, CRLF files, created files) with a script against a mocked VS Code API. Those scripts aren't in this PR; there are no automated tests in the repo yet.

Not yet

  • No sign-in or project picker; requests go straight to LiteLLM with the dev key.
  • Pending Undo / Keep state is lost when the window reloads (the edits stay in the files).
  • Dictation is macOS only.

Merging

The earlier commits predate the repo's hooks: 11 don't follow Conventional Commits, and the upstream merge commit has an AI co-author line. Squash merging with this title avoids both.

The PR has 20 commits, all inside surface/ except AGENTS.md and CLAUDE.md.

I left out the usual "Generated with Claude Code" footer, because your repo's hooks reject AI attribution lines. Add it back if you want it.

Adds `surface/`, the VS Code extension for SLC: a Cursor-style chat in the secondary sidebar that talks to the ScottyLabs AI gateway (LiteLLM) through this repo's secretspec setup. - **Chat:** tabs and history, copy, file attachments (picker or drag and drop), macOS dictation, a model picker with the gateway's models (Sonnet 5.5 by default), and streaming replies with markdown, tables and LaTeX (KaTeX). - **Modes:** - Ask reads the code (`list_files`, `read_file`, `search`) and answers. - Plan reads the code and writes a markdown plan, shown as a card with Open and Build. - Agent can also edit files and run commands. - **Inline review:** agent edits are written into the file and highlighted in the editor, with Undo / Keep on each change (Cmd+N / Cmd+Y) and an Undo / Keep / Review bar for all changed files. The user's own typing never counts as an agent change. - **Safety:** tools only work inside the open workspace, every command needs an explicit Run click, and the gateway key stays in memory and out of commands' environment. ## Try it 1. Log in to OpenBao (see "Setting up OpenBao" in the root README). 2. `cd surface && npm install && npm run compile` 3. Open `surface/` in VS Code and press F5. The extension gets the dev key from secretspec by itself. ## Docs - `surface/README.md`: running it, using it, and how the code fits together. - `surface/docs/files.md`: how the agent reads and changes files (tools, pending changes, Keep / Undo, limits). - `AGENTS.md`: guidelines and git workflow for contributors. `CLAUDE.md` just points to it. ## Testing - `npm run compile` passes. - Checked end to end in an Extension Development Host with Sonnet 5.5: an Agent run edited a file and ran an approved command, and a Plan run wrote a plan that Build then carried out. - The webview was checked in headless Chrome at sidebar width, and the change tracking (keep / undo per change and per file, the user's own edits, CRLF files, created files) with a script against a mocked VS Code API. Those scripts aren't in this PR; there are no automated tests in the repo yet. ## Not yet - No sign-in or project picker; requests go straight to LiteLLM with the dev key. - Pending Undo / Keep state is lost when the window reloads (the edits stay in the files). - Dictation is macOS only. ## Merging The earlier commits predate the repo's hooks: 11 don't follow Conventional Commits, and the upstream merge commit has an AI co-author line. Squash merging with this title avoids both. The PR has 20 commits, all inside surface/ except AGENTS.md and CLAUDE.md. I left out the usual "Generated with Claude Code" footer, because your repo's hooks reject AI attribution lines. Add it back if you want it.
Manifest with an slc activity bar container and a Chat webview view,
TypeScript build, and a launch config for the Extension Development Host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Registers the slc.chat webview view, serves the page with a nonce CSP,
and wires message passing. Replies with a placeholder until an agent
backend exists. Adds a New Chat button to the view title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Message list with user bubbles and assistant text, typing indicator,
auto-growing composer (Enter sends, Shift+Enter new line), state kept
across reloads, and styling from VS Code theme variables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Textarea gets min-width: 0 so it shrinks with the sidebar, and the
placeholder is shortened. README covers running with F5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the view container to the secondary sidebar where the built-in
chat lives, activates on startup and focuses the view, and defaults
chat.disableAIFeatures to true so Copilot Chat stays out of the way
while the extension is installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Covers scope (frontend only, small), how the extension behaves, code
conventions, verification, and the git workflow: task branches off
surface, pulling and rebasing regularly, and how to finish a task.
CLAUDE.md imports it so Claude Code sessions load the same rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chat lives in the secondary sidebar, which has no activity bar icon,
so once closed it was hard to find. slc.openChat focuses it again and is
on the status bar, the editor title bar, and Ctrl+Cmd+I.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replies are now lists of blocks (step lines, markdown text, file
changes) defined in protocol.ts. DiffStore keeps before/after text and
opens VS Code's diff editor when a file card is clicked. The sample
reply shows every block type and the first message gets a short title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Title header, outlined user message cards, muted step lines, markdown
replies, clickable file cards with +N -M, a Thinking shimmer, and a
composer with Agent/Ask/Plan mode pill, model picker and round send
button. Old saved chats are converted on load. AGENTS.md documents the
new files and design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New files (protocol, diffs, placeholder, markdown renderer), the design
reference, and converting old saved chat state on load. This was meant
to land with the redesign commit but the edit failed to apply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in the dev shell, secretspec, CI and README updates from ScottyLabs/slc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chat now has Cursor-style tabs: + opens a new chat, the clock opens
a history of past chats (open or delete), and each tab can be closed.
Replies get a copy button and a relative time. The composer gains an
attach button (file picker, chips above the input) and a mic button.

Webviews can't use the microphone, so the mic triggers macOS system
dictation through Edit > Start Dictation, which types into the focused
composer. Saved single-chat state is converted to the new chats shape.
Agent edits are now written straight into the file instead of shown in
a side-by-side diff. ChangeTracker keeps each changed file's kept text
(baseline); pending hunks are the diff from it to the file. Review
highlights added lines in the editor, marks removed lines, shows the
removed text on hover, and puts "Undo ⌘N | Keep ⌘Y" above each hunk.
⌘N/⌘Y act on the hunk at the cursor while the file has pending changes.

The user's own typing outside pending hunks is applied to the baseline,
so it never counts as an agent change. Undoing all of a created file
deletes it. File cards in the chat show the changed lines, and a
"N Files Undo Keep Review" bar above the composer acts on all files.

The placeholder turn edits greeting.sample.ts in Agent mode so the
flow can be tried without a backend. DiffStore is gone.
The bottom-right "slc" item read as a watermark. The chat can still be
reopened from the editor title bar button and Ctrl+Cmd+I.
VS Code always draws the secondary sidebar's header, so the closest to
"no header" is making it useful: showLabels defaults to false (chat icon
instead of the "slc" label), and + and history move into the header as
view title actions. The chat tabs now start right under it, and the
history dropdown opens below the header button.
The chat now talks to LiteLLM instead of answering with a sample turn.
The model picker lists the gateway's models (Sonnet 5.5 by default),
replies stream into the chat, and each request carries the earlier
turns, per-mode instructions and the contents of attached files.

The key comes from LITELLM_API_KEY when VS Code runs under secretspec
run, or else from `secretspec get` against the repo's secretspec.toml
(openbao, dev profile), so F5 works once the user has logged in to
OpenBao. It's only held in memory. Without a key the sample replies
remain.
Replies and plans can now use $...$, $$...$$, \(...\) and \[...\] math, rendered with KaTeX (0.19.1, loaded from the package as local webview resources, fonts allowed in the CSP). The markdown renderer also gains tables, nested lists, task lists, rules and h4-h6. Dollar amounts like "$5 and $10" stay text, and math still streaming in shows as text until it closes. The model is asked to write math in LaTeX.
The model now works through tools: list_files, read_file and search in
every mode; edit_file, write_file and run_command in Agent mode; and
write_plan in Plan mode. Each step streams into the chat as it happens
(step lines, file cards, command output). Edits go through the inline
review, and every command waits for Run or Skip in the chat. Tools stay
inside the workspace and commands run without the gateway key.

Plan mode saves the plan as markdown in the extension's storage and
shows it as a rendered card with Open and Build; Build carries it out in
Agent mode. While a reply runs the send button becomes Stop, and files
dropped on the composer are attached.
surface/README.md now covers running the extension, the gateway key, using the chat (modes, composer, replies, review) and how the pieces fit together. surface/docs/files.md explains the tools: how files are listed, read and searched, how an edit becomes a pending change with a baseline, what Keep and Undo do, how the user's own typing is handled, command approval, plans, and the rules and limits.
docs: have the fork's main mirror surface
Some checks are pending
CI / checks (pull_request) Blocked by required conditions
CI / checks-1 (pull_request) Blocked by required conditions
9379091191
main on our fork now fast-forwards to surface after each push, so the fork's front page shows the latest work. AGENTS.md says so in the branch rules and the finishing steps.
Some checks are pending
CI / checks (pull_request) Blocked by required conditions
Required
Details
CI / checks-1 (pull_request) Blocked by required conditions
Required
Details
nixbot/nix-eval
Required
kennel/deploy
Required
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'main:jgaspard-main'
git switch 'jgaspard-main'
Sign in to join this conversation.
No description provided.