Files
HomerandClaude Opus 5.5 eab47acb39 VS Code: only project files go along, the account change lets go, review fixes
Privacy: the text of other open files with a suggestion, and the paths of other open tabs with
a message, now come only from files inside the window's folders, never from a file that looks
like it holds secrets (the table both editors share, tests/rules/private_files.json), and never
from one the project's .gitignore leaves out. In a file that looks secret no suggestion is
asked for; said once. The README (What is sent) and the settings' descriptions say exactly
what is sent and what is not.

- Signing in elsewhere, or out, drops the old account's models, this window's model choice and
  the listed sessions, and reads the models again.
- A rewrite or generation holds the file only while it is written; asked again before the
  instruction was typed, the question that waits gets the keyboard.
- The Mode and model lists are rebuilt only when what they offer changed.
- Session times are local time.
- _lembas/session/deleted is gone: the CLI sends it only on the LLeMbas link, never on
  serve --stdio. Deleting says why it could not (agent, too old, working) and reads the list
  again when the CLI no longer has the session.
- Dead page messages (focus, insertText, keepBeside), data-line and hooks.filesChanged removed.
- Sign-in lines and versions read as the Neovim plugin reads them (tests/rules/).
- Texts: one sentence for "still working" and one for "this CLI is too old"; Open a File of This
  Project; Send now; Approve: edit without asking / ask before each edit; "You (sent while
  working)" as in Neovim; the Status rows named in words, no Harness row; the hero image has no
  "LLeMbas IDE" alt text; Choose the Main Model removed (Models does it); Stop the Agent.
- README: "nothing is stored in the editor"; the VS Code 1.85 subgrid note names Electron 25 /
  Chromium 114 and 1.86's Electron 27 / Chromium 118 (read from each tag's cgmanifest.json).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 07:52:23 +00:00

300 lines
19 KiB
Markdown

# LLeMbas for VS Code and VSCodium
LLeMbas in the editor, **in one side panel**: an agentic chat beside your files, questions and plans
as interactive cards, rewriting and generating code as inline diffs, session resume, `@file` and
`/command` completion, tunable inline autocomplete — and, in the same frame, the sessions, the
models, every setting, the sign-in and the agent's status. Nothing sends you to a Quick Pick, an
input box, a notification that wants an answer, or the editor's Settings page.
The extension is a client of the [LLeMbas CLI](https://github.com/LLeMbas/LLeMbas-CLI). The CLI is
the agent: it holds the sign-in to your LLeMbas server, the models, the tools and the permissions.
The extension starts `lembas serve --stdio` and talks to it over the Agent Client Protocol. Nothing
about a server or a model is stored in the editor: the panel signs in and chooses models through
the CLI, which keeps the sign-in, and your account, which keeps the models. The editor's own
settings are which command starts the CLI and how the panel and the suggestions behave.
## What you need
- VS Code or VSCodium 1.85 or newer.
- The LLeMbas CLI, 2.0.0-beta.16 or newer, on the same computer. An older one is said once, with how
to update it (`lembas update`), and what it lacks is off.
- The CLI signed in to your LLeMbas server: the panel's **Account** view (*LLeMbas: Sign In*), or
`lembas login <address>` in a terminal. It is the same sign-in — the CLI keeps **one for the whole
computer**, which the terminal and the linked service use too.
## Install
Build the package (needs only Node 18 or newer — no `npm install`, no packaging tool):
```sh
scripts/package-vscode.sh # writes dist/llembas-<version>.vsix
```
Then install it:
```sh
codium --install-extension dist/llembas-<version>.vsix # VSCodium
code --install-extension dist/llembas-<version>.vsix # VS Code
```
or in the editor: Extensions → `…` → *Install from VSIX…*.
If the editor does not find `lembas` (an editor started from the desktop does not always have your
shell's `PATH`) it also looks in `~/.local/bin`, where the CLI's installer puts it; anywhere else,
set the program's full path in the panel under **Settings → Program** (`llembas.command`).
The extension is off in a folder you have not trusted (Restricted Mode): it starts an agent that
works in that folder.
## What it does
**One panel.** The LLeMbas icon in the activity bar opens it. A strip of tabs runs along its top —
**Chat, Sessions, Models, Autocomplete, Settings, Account, Status** — icons in a narrow side bar
(each with its name as a tooltip and for a screen reader), icons with their names in a wide one.
The arrow keys walk the strip, `Home` and `End` go to its ends, and the view that is open is the
one you find again after closing the panel or reloading the window, with what you were typing.
**Whole, or beside the conversation.** One rule decides how a view opens:
- **A tab opens its view in the whole frame**, and so does a command that is about how LLeMbas is
set up (*Models*, *Settings*, *Sign In*, *Status*). The **Chat** tab is the way back.
- **Anything reached from the conversation opens beside it** — the model button and **History** in
the chat's header, a note's *Sign in* or *Status* button, and the commands that are about the
conversation in progress (*Resume a Previous Session*, *Choose This Session's Model*, *Open a File
of This Project*). The conversation stays where it is: the view takes the lower half of the
panel, or the right half when the panel is 640 px wide or more. **Esc** or **Close** puts it away
and gives the keyboard back to where it was; the composer's text and the place you had scrolled
to are untouched.
Something in the conversation that waits for your answer while another view fills the frame marks
the **Chat** tab; it does not pull you away from what you are doing.
**Chat.** The header shows the connection status, the session's title, the mode (switchable live
mid-turn), the session's model (a button: the models open beside the conversation), **Compact**,
**History** and **New**. Enter sends (while LLeMbas works the button reads **Send now**: the
message reaches it mid-turn), Shift+Enter starts a new line, `@`
searches project files and folders, and `/` completes slash commands and skills. Approval cards
open edited files in the diff view first; question cards support single/multi-select, recommended
markers, custom answers, and skip; plan cards render formatted Markdown with **Approve: edit without
asking**, **Approve: ask before each edit**, Revise, and Dismiss.
**Sessions.** The earlier sessions of this folder, with a filter. A press resumes one; **Delete**
(where the CLI can delete a session) asks again in the row before anything goes.
**Models.** Three lists from your server, the one in force marked: the model of **this
conversation**, the **chat and rewrite** model new sessions start with, and the **autocomplete**
model. The last two are kept *saved in your account* (every editor you sign in from uses it) or for
*this window only* (a quick switch, saved nowhere) — chosen next to each list.
**Settings, in the panel.** Every `llembas.*` setting has a field in the panel: autocomplete's in
**Autocomplete**, the certificate file in **Account**, the rest in **Settings**. They are the
editor's own settings underneath, so `settings.json`, Settings Sync and policies work as ever. Each
field says where the value in force comes from (the default, your User settings, the Workspace, a
folder), lets you choose the level your change is written to (**User** or **Workspace**; what starts
a program is User only) and has a **Reset** for that level. A change made anywhere else — the
editor's Settings page, `settings.json` — shows in the panel at once. A small link at the foot of
**Settings** opens the editor's own Settings page; nothing needs it.
What a model writes is drawn as text through the extension's own Markdown reader: paragraphs,
headings, lists, task checklists, quotes, real GFM tables (in horizontally scrollable wrappers),
strikethrough, fenced code blocks with **Copy** and **Insert** buttons, and clickable `file:line`
references. HTML in a reply stays text, pictures in a reply are not loaded, and links open only for
`http`, `https` and `mailto`. Replies over 400,000 characters are shown as written. Tool calls show
status, kind, duration, clickable changed files, and expandable output; thinking blocks collapse
cleanly.
**Ask, Explain, Fix, Generate & Rewrite.** *Ask About the Selection* attaches the selection to your
next message and puts the keyboard in the composer. *Explain* and *Fix Problems* send at once.
*Generate* and *Rewrite* ask for their instruction in the panel, above the composer (Enter sends it,
Esc puts it away, and the keyboard goes back to your text); while the model writes, the same place
shows how far it is, with **Cancel**. The result is proposed hunks in the file, with *Accept* /
*Reject* CodeLenses and a side-by-side diff view — and, in the panel, **Accept all**, **Reject all**
and **Show as a diff**. Nothing is written until you accept, and hunks whose lines you edited
meanwhile are dropped safely.
**Tunable Autocomplete.** Inline suggestions appear as you type and on `Alt+\` (Tab accepts, Escape
dismisses). The panel's **Autocomplete** view holds all of it: on or off as you type, how much to
suggest (`Auto`, a few words, one line, a function or block, a large part of the file), the most
tokens (`0`..`4096`), the pause before asking, and your own instructions for suggestions.
**In the status bar.** The *LLeMbas* item says which autocomplete model is in use and whether
suggestions are on, for when the panel is closed; a press opens the panel on **Models** (or, when
there are no suggestions because no model is chosen or nobody is signed in, where that is put
right).
**Files the agent shows.** Pictures appear inline in the chat. Other files appear with *Open* (only
for display-only kinds whose bytes match their filename) or *Show in folder* for anything else. Files
over 64 MB are refused (`llembas.media.maxMegabytes`).
**Unsaved text.** The agent reads open files from your editor buffers (saved or not), and writes
open files back through the document so undo and disk stay in sync. A document keeps its own line
ends (CRLF stays CRLF).
**Signing in.** The **Account** view says who this computer is signed in as. Type your server's
address (nothing is predefined) and press **Sign in**: the CLI's own sign-in runs, the view shows
the code to approve and where, with **Open the approval page** (your browser is opened when you
press it, never by itself) and **Cancel**. When it is approved the agent starts anew and the open
chat works at once. If the computer is signed in to another server already, the view says which and
asks first: the new sign-in replaces it, for the terminal and the linked service too. For a server
with a private certificate authority, the certificate file is a field of the same view
(`llembas.login.caFile`); with it the CLI always makes a new sign-in. **Sign out** signs the
computer out, after asking in the view.
**When something is wrong.** A CLI that is not found, is too old, is not signed in, stops or does
not answer is said in the chat in words, with a button to where it is put right; a turn that failed
says why. The **Status** view has the agent's state, the program that is started and its version,
the oldest version this needs, what your server asks for, what went wrong lately, what the agent
last wrote on stderr (kept after it is gone), and **Restart the agent**. The same lines go to the
*LLeMbas* channel of the Output panel.
## What stays outside the panel, and why
- **Inline suggestions** (ghost text at the cursor) — they are about the text you are typing.
- **A rewrite's changes**: the marks in the file, the *Accept* / *Reject* CodeLenses above each
change, and the editor's own diff view — a change is judged where the code is.
- **The diff of an edit the agent asks about**, in the editor's diff view (the question itself is a
card in the chat).
- **The editor context menu, the keys and the command palette** — every command is still there, so
keys can be bound to them; each one opens the panel where it belongs or does its work in the file.
- **The status bar item** — one glance when the panel is closed; a press opens the panel.
- **A line of the editor's own** (a notification with no button) when a command could not start in
the editor: nothing selected, a rewrite already under way in that file.
## Commands and keys
| Command | Key | |
|---|---|---|
| LLeMbas: Open the Chat | `Ctrl+Alt+L` | the panel on Chat, the keyboard in the composer |
| LLeMbas: Ask About the Selection | `Ctrl+Alt+K` | also in editor context menu; type the question in the composer |
| LLeMbas: Explain the Selection | | editor context menu |
| LLeMbas: Fix Problems in This File | | editor context menu |
| LLeMbas: Generate Code at Cursor | | editor context menu |
| LLeMbas: Rewrite the Selection | `Ctrl+Alt+E` | also in editor context menu; the instruction is typed in the panel |
| LLeMbas: Suggest a Completion Here | `Alt+\` | |
| LLeMbas: Toggle Autocomplete as You Type | | |
| LLeMbas: Accept All Proposed Changes in This File | `Ctrl+Alt+Enter` | while changes are proposed |
| LLeMbas: Reject All Proposed Changes in This File | `Ctrl+Alt+Backspace` | while changes are proposed |
| LLeMbas: Accept / Reject the Proposed Change at the Cursor | | or CodeLenses above each change |
| LLeMbas: Show the Proposed Changes as a Diff | | |
| LLeMbas: Open a File of This Project | | a search beside the conversation |
| LLeMbas: Add File to Chat | | an `@` in the composer, with the project's files listed under it |
| LLeMbas: New Session | | |
| LLeMbas: Resume a Previous Session | | the Sessions view, beside the conversation |
| LLeMbas: Compact Session Context | | |
| LLeMbas: Stop the Running Turn | | |
| LLeMbas: Choose the Mode | | the keyboard on the mode list of the chat's header |
| LLeMbas: Choose This Session's Model | | the Models view, beside the conversation |
| LLeMbas: Models (Autocomplete, Chat and Rewrite) | | the Models view; also the status bar item |
| LLeMbas: Choose the Autocomplete Model | | the Models view, on that list |
| LLeMbas: Settings (in the Panel) | | the Settings view |
| LLeMbas: Status of the Agent | | the Status view |
| LLeMbas: Stop the Agent | | it starts again when it is needed (**Restart the agent** in Status stops it and starts it at once) |
| LLeMbas: Sign In / Sign Out | | the Account view; the CLI's one sign-in for this computer |
On macOS the keys use `Cmd` in place of `Ctrl`.
## Settings
Each has a field in the panel (the view is named in the last column), and is an ordinary setting of
the editor underneath.
| Setting | Default | |
|---|---|---|
| `llembas.command` | `lembas` | the LLeMbas CLI, or its full path (User level only) — *Settings* |
| `llembas.login.caFile` | | the CA file of a server with a private certificate authority, for signing in (User level only) — *Account* |
| `llembas.chat.sendEditorContext` | on | with each message: the file in front, the cursor, the selection, the problems shown there, and the paths of the other open tabs of this project (see *What is sent*) — *Settings* |
| `llembas.chat.showThinking` | off | show collapsible model thinking blocks — *Settings* |
| `llembas.chat.startMode` | | initial mode for a new session (User level only) — *Settings* |
| `llembas.complete.auto` | on | suggest as you type; off: only on `Alt+\` — *Autocomplete* |
| `llembas.complete.debounce` | 250 | pause in milliseconds before requesting a completion — *Autocomplete* |
| `llembas.complete.maxTokens` | 0 | the longest suggestion, in tokens (`0`: as the length says; up to `4096`) — *Autocomplete* |
| `llembas.complete.length` | `auto` | how much a suggestion writes (`auto`, `words`, `line`, `block`, `file`) — *Autocomplete* |
| `llembas.complete.instructions` | `""` | your own instructions for suggestions — *Autocomplete* |
| `llembas.rewrite.openDiff` | on | open diff view beside the file when a rewrite is proposed — *Settings* |
| `llembas.media.maxMegabytes` | 64 | largest shown file accepted from the agent — *Settings* |
## What is sent
Everything goes to the LLeMbas CLI on this computer, and from there to **your** LLeMbas server —
nowhere else; the extension has no telemetry and fetches nothing.
- **What you send**: the message you type; a selection you ask about, have explained or
rewritten; a file you name with `@`.
- **With a message** (`llembas.chat.sendEditorContext`, on by default): the path of the file in
front, the cursor's line, the selection, the problems the editor shows there, and the **paths**
(not the text) of the other open tabs.
- **With a suggestion** (autocomplete): the text around the cursor (about 12,000 characters before
it and 4,000 after), the file's path and language, and the **text** of up to six other open
files (the first 400 lines of each), of which the CLI puts pieces beside it.
What goes along without your pointing at it — the tab paths and the other files' text — is held
to three rules, in both cases:
1. **Only files inside this window's folders.** A file open from somewhere else is never named or
read for this, and with no folder open nothing of other files goes along.
2. **Never a file that looks like it holds secrets**, by its name or its place: `.env` and
`.env.*` (but not `.env.example`, `.env.sample`, `.env.template`), `*.env`, `*.pem`, `*.key`,
`*.p12`, `*.pfx`, `*.jks`, `*.keystore`, `*.ppk`, `*.kdbx`, `id_rsa*`, `id_ed25519*`,
`id_ecdsa*`, `id_dsa*`, `.netrc`, `.npmrc`, `.pypirc`, `.pgpass`, `.htpasswd`,
`.git-credentials`, `credentials*`, `secrets.*`, `secret.*`, and anything under `.ssh/`,
`.gnupg/`, `.aws/`, `.kube/`, `.docker/` or `.azure/`.
3. **Never a file the project's `.gitignore` leaves out** (git is asked, once a file; a file git
has not answered for yet is left out).
And **in a file that looks like it holds secrets no suggestion is asked for at all**, so nothing
of it is sent; the editor says so once. A file the project ignores, or one outside the folders,
still gets suggestions while you type in it: its own text around the cursor is what a suggestion
is made from.
The agent itself reads and writes files as a turn needs them, under the CLI's permissions; that
is the CLI's to allow or ask about, and is not limited by the rules above.
## Not there yet
- Sound, video and PDF files are not rendered inline in the chat: they appear with *Open*. Any
other kind — a document, a program — can only be shown in its folder.
- An edit the agent asks about in a chat is allowed or denied as a whole, not change by change.
- No marketplace listing: install from the `.vsix`.
- A question card has no "ask back" answer, and a plan card no editing of the plan in place.
- The effort of a conversation is shown (in **Models**) and cannot be changed from the editor: the
CLI does not tell an editor which levels a model has.
- A setting a folder of a multi-root workspace holds is shown as coming from that folder, and is
changed there: the panel writes the User and the Workspace level.
- In VS Code 1.85 itself, fields that stand side by side in a wide panel do not share their rows:
it is built on Electron 25 with Chromium 114, and `subgrid` came with Chromium 117. From VS Code
1.86 (Electron 27, Chromium 118) they do. In a narrow side bar fields are stacked either way.
- It has been tested against a stand-in for the editor and against the LLeMbas CLI itself, not yet
in a release of VS Code by these tests: tell us what you see.
## How it is made
Plain JavaScript, no bundler, no dependencies, nothing fetched from the network, no telemetry.
`extension.js` is the only file that talks to the editor; everything else is in `src/` and runs
without one. The panel's page (`src/webview.js`, `media/chat.js`) builds elements with
`createElement` and `textContent` only, under a strict Content-Security-Policy (no remote resource,
no inline script or style); every colour comes from VS Code's theme variables, and high-contrast
themes and "reduce motion" are respected.
- **The settings come from one table** (`src/settings.js`) made from the manifest: a setting that is
contributed cannot be missing from the panel, and a test fails when the table and the manifest
differ.
- **What the page sends is checked against a schema** (`src/messages.js`) — type, shapes, lengths,
enumerations — before anything is done. A setting is written only when it is one of the table,
with a value of its declared type and range, at a level it has; a model or a session only when
the server or the CLI listed it. A path typed in the panel is stored, never run: the CLI is
started as one list of arguments, and a server's address is refused when the program would read
it as an option.
- **Forms line up by construction**: a field is always its four parts — label, control, hint, level
— on the rows of the form it is in (`subgrid`), so two fields side by side keep their parts on
the same lines whatever the text does; a track gives up its minimum before a 240 px side bar
scrolls sideways; what is pressed is 28 px high.
- The page says what happens to a screen reader (a turn began or ended, something waits for your
answer, which view is in front), labels are tied to their controls, and everything in it can be
reached with the keyboard.
## Tests
```sh
scripts/test-vscode.sh # needs Node 18+ and python3
```