Add web search/fetch, sub-agents, MCP support, git tools, session persistence, and context compaction
Substantially expands locode's tool loop toward feature parity with Claude Code: - web_search / web_fetch: DuckDuckGo-backed search and URL fetching (HTML stripped to text) - git_status / git_commit: structured git tools with real diff/status/commit-list previews before any mutating operation is confirmed - agent tool: sub-agents run an isolated, headless tool loop sharing the parent's permissions; bounded by an explicit depth guard (no nested sub-agents) and a 120s hard timeout, independent of the toolset already excluding `agent` for sub-agent sessions - MCP client support (stdio + streamable HTTP transports) via the official SDK: locode connects to servers configured in `.mcp.json` or via `locode mcp add`, and exposes their tools alongside the built-in ones, namespaced as `mcp__<server>__<tool>` - Session persistence: conversations auto-save after every turn; `--continue`/`--resume`, `locode sessions list/rm`, and an interactive resume picker - Context compaction: tracks real token usage via `stream_options.include_usage` (falling back to a char-based estimate), auto-detects the model's context window (Ollama/LM Studio native APIs, cached, else a configurable default), and auto-summarizes the conversation at 85% usage or on demand via /compact - Status bar and welcome banner: added a context-usage indicator and fixed several dim-by-default colors that were hard to read Session/loop architecture changed to support all of this: Session now carries its own toolset (tools + registry + OpenAI schemas) built from local + MCP tools, so runTurn no longer depends on a fixed global tool list — the same mechanism that lets sub-agents inherit MCP tools while excluding `agent` itself. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,3 +7,7 @@ export const KNOWN_BACKENDS = {
|
||||
} as const;
|
||||
|
||||
export type BackendName = keyof typeof KNOWN_BACKENDS;
|
||||
|
||||
/** Used when the context window can't be auto-detected from the backend (see backend/contextWindow.ts)
|
||||
* and the user hasn't configured one — a conservative size common among smaller local models. */
|
||||
export const DEFAULT_CONTEXT_WINDOW = 8192;
|
||||
|
||||
Reference in New Issue
Block a user