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:
kim
2026-07-06 17:53:27 +09:00
co-authored by Claude Sonnet 5
parent 68f2242984
commit 3f1527375c
34 changed files with 2751 additions and 77 deletions
+1
View File
@@ -20,6 +20,7 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.29.0",
"@vscode/ripgrep": "^1.18.0",
"commander": "^13.0.0",
"diff": "^9.0.0",