Skip to content

Releases: LMLK-seal/LocalAI-Chat

LocalAI-Chat-v1.20

Choose a tag to compare

@LMLK-seal LMLK-seal released this 25 Jun 16:11
c4ae38a

Changelog

v1.2.0 — Agentic IDE features (tool use, syntax highlighting, command palette)

This release transforms the extension from a chat-with-code into a real
agentic IDE — comparable to Cursor, Cline, and Aider. Six major features
added, all 100% offline, no new external network dependencies.

1. Tool use / function calling (agent mode)

Files: src/tools.js (new), src/chat-manager.js (agent loop)

The model can now actually do things — not just suggest code. Toggle
agent mode with the 💬/🤖 button in the topbar (or ⌘/). In agent mode,
the model is prompted to emit <tool_call> blocks that invoke one of:

Tool Category Description
read_file read Read a file's contents
list_directory read List a directory's contents
grep_search read Regex search across files (with line numbers)
glob_find read Find files matching a glob pattern
write_file write Write content to a file (requires user approval)

Read tools execute immediately and show a tool-call card with the
result. Write tools show an approval card with Approve/Reject buttons
— the agent loop pauses until the user decides.

The agent loop continues until the model stops calling tools or hits the
step cap (10 by default, prevents infinite loops). Each tool call is
visible in the chat as a card showing the tool name, arguments, and
result — fully transparent.

2. Syntax highlighting (highlight.js)

Files: src/highlight.js (new), src/markdown.js, lib/highlight/* (new)

Code blocks and the file viewer now have proper syntax highlighting via
highlight.js (BSD-3-Clause, bundled — no
network fetch). 17 languages included: Python, JavaScript, TypeScript,
XML/HTML, CSS, JSON, Bash, SQL, YAML, Markdown, Go, Rust, Java, C, C++,
Ruby, PHP.

The github-dark theme is used by default and matches the extension's
dark mode.

3. @-mention autocomplete

Files: src/ide-features.js (new), src/app.js

Typing @ in the composer now shows a fuzzy-searchable dropdown of files
in the workspace. Arrow keys to navigate, Enter to insert @file:path.
This is the Cursor-style mention experience — no need to know exact paths.

4. File finder (Cmd+P) + Command palette (Cmd+Shift+P)

Files: src/ide-features.js (CommandPalette class), src/app.js

VSCode's signature features:

  • ⌘P (or Ctrl+P) — fuzzy file finder. Type a few letters, get
    matching files in the workspace. Enter to open in the file viewer.
  • ⌘⇧P (or Ctrl+Shift+P) — command palette. Fuzzy-searchable list of
    all extension commands: new chat, open workspace, toggle theme, toggle
    agent mode, export, reload model, etc.

Both use a custom fuzzy matcher that scores by word-boundary matches,
substring position, and target length.

5. Plan/Act mode toggle

Files: src/chat-manager.js, src/app.js, newtab.html

The 💬 Chat / 🤖 Agent toggle in the topbar switches between:

  • Chat mode — standard back-and-forth, no tool use. Faster, simpler.
  • Agent mode — tool use enabled, model can read/write files via
    tool calls. Write tools require approval.

Keyboard shortcut: ⌘/ (or Ctrl+/).

6. Multi-tab file viewer

Files: src/ide-features.js (TabManager class), src/app.js

The file viewer now supports multiple open files in tabs — like VSCode.
Double-click a file in the tree to open it in a new tab. Click tabs to
switch. × to close. Tabs persist for the session. Syntax highlighting
is applied per-tab based on file extension.

Keyboard shortcuts

Shortcut Action
⌘P / Ctrl+P File finder
⌘⇧P / Ctrl+Shift+P Command palette
⌘K / Ctrl+K Focus composer
⌘B / Ctrl+B Toggle sidebar
⌘/ / Ctrl+/ Toggle agent mode
Enter Send message
Shift+Enter Newline in composer
Escape Close modal / dropdown

Files changed

  • New: src/tools.js, src/highlight.js, src/ide-features.js
  • Modified: src/app.js, src/chat-manager.js, src/markdown.js, newtab.html, newtab.css, PRIVACY.md, privacy-policy.html
  • New bundled library: lib/highlight/ (highlight.js core + 17 language packs + github-dark theme, ~224 KB total)

v1.1.2 — Critical fix: promoted code fences were not rendering

Bug: In v1.1.1, when the model used a markdown code fence instead of
a <file> block, the code-fence-to-file-block promotion logic correctly
computed the promoted blocks and replaced the code fence with a pointer
text ("Code promoted to file block: X — see card below") — but the file-
block card itself was never rendered due to a variable-shadowing bug.

Root cause: _renderMessage in src/chat-manager.js computed the
fileBlocks array (including promoted code fences) at the top of the
function, then re-declared const fileBlocks = parseFileBlocks(...) in
the assistant-only rendering block below. The inner declaration shadowed
the outer one, and parseFileBlocks only finds real <file> blocks —
so when no real <file> blocks existed, the rendering loop never ran,
and the user saw the pointer text but no card (effectively losing the
code from view).

Fix: Removed the inner const fileBlocks = parseFileBlocks(...)
re-declaration. The outer fileBlocks (which already includes promoted
code fences when applicable) is now used for the rendering loop.

Files changed: src/chat-manager.js (one block of code rewritten).


v1.1.1 — Code-fence-to-file-block promotion (fixes "no Apply button")

Problem: When the model wrapped its code in a markdown code fence
(```python ... ```) instead of the <file path="..."> block format the
system prompt asks for, the extension only showed a "💾 Save" button (which
prompts for a filename one at a time, with no diff, no undo, no Apply-all).
The proper Apply / Preview / Undo / Apply-all UI only appeared when the model
used <file> blocks — which smaller models (Qwen 0.5B/1.5B, Llama-3.2-1B,
etc.) often don't follow.

Fix: When an assistant message contains NO <file> blocks but DOES
contain code fences with a language tag (and a workspace is open), the code
fences are now automatically promoted to first-class file-block cards with
the full Apply / Preview / Undo / Apply-all UI.

Files changed:

  • src/file-renderer.js — new parseCodeFences, guessFilenameFromPrompt,
    promoteCodeFencesToFileBlocks exports; renderFileBlock now supports
    editable paths (click the path to rename before applying) and a "guessed"
    badge for promoted blocks.
  • src/chat-manager.js_renderMessage and send() auto-apply now use
    the promotion logic when no real <file> blocks are found.
  • newtab.css — styles for promoted file blocks (accent left-border),
    the "guessed" badge, and the editable path input.

Filename guessing strategy:

  1. If the user's prompt contains "save as X" / "name it X" / "call it X",
    use that filename.
  2. Else, extract the first 1–4 words from the prompt (after stripping
    filler like "write me a", "in python", etc.) and slugify them.
    Example: @workspace write me a tic tac toe game in python
    tic_tac_toe_game.py.
  3. Fallback: snippet-<N>.<ext>.

Minimum fence size: Code fences must have at least 3 content lines to
be promoted. Shorter fences (e.g. print("hello")) are treated as inline
examples and left as-is.

Editable path: The path on a promoted file-block card is clickable.
Click it → it becomes a text input → type a new path → Enter to confirm
or Escape to cancel. The path is re-sanitized on commit (absolute paths
and .. traversal are rejected).


v1.1.0 — Tier 1 strategic additions

This release ships 8 major feature areas on top of the v1.0.1 Tier 0
robustness fixes. All features are 100% offline, add no new external
dependencies, and preserve backward compatibility with existing user data.

1. Model persistence via IndexedDB blobs

Files: src/model-store.js (new), src/app.js

Reload the tab → your model survives. Models are saved to IndexedDB
as Blobs (one record per model + optional mmproj companion) and listed
on the drop overlay under "Recent models". One-click reload without
re-picking the file.

A "Clear" button removes the cached blobs (the original files on disk
are not affected).

2. Model library & metadata

Files: src/model-loader.js (parseGgufHeader, _buildDisplayMeta), src/app.js, newtab.html

The model card in the sidebar now shows architecture · parameter count ·
quantization · file size, parsed directly from the GGUF binary header
(no network call, no external library). Examples:

  • llama · 1.5B · Q4_K_M · 950 MB · vision
  • qwen2 · 7B · Q5_K_M · 5.2 GB
  • gemma · 2B · F16 · 5.0 GB

A memory-budget indicator on the drop overlay shows the tab's available
JS heap (via performance.memory) and color-codes it green / amber / red
based on whether a typical small model will fit.

3. Token-aware context management

Files: src/token-counter.js (new), src/chat-manager.js, newtab.html

The old naive slice(-8, -1) truncation is gone. The new
fitToTokenBudget function:

  • Estimates tokens per message using a chars/4 heuristic for ASCII and
    chars/1.5 for CJK (covers English, code, and Chinese text within ±20%).
  • Reserves space for the system prompt + max_tokens + a 512-token
    safety margin for the chat template's special tokens.
  • Always keeps the system message(s) and the most recent turns; drops
    older middle messages first.
  • Reports how many messages were dropped via the context-usage bar in
    the topbar.

The context-usage bar (ctx used / ctx size) color-codes green < 60%,
amber 60–85%, red > 85%,...

Read more