Skip to content

Feature/vscode extension#4

Closed
KillerQueen-Z wants to merge 185 commits intoBlockRunAI:mainfrom
KillerQueen-Z:feature/vscode-extension
Closed

Feature/vscode extension#4
KillerQueen-Z wants to merge 185 commits intoBlockRunAI:mainfrom
KillerQueen-Z:feature/vscode-extension

Conversation

@KillerQueen-Z
Copy link
Copy Markdown
Contributor

  • Add a VS Code sidebar extension (vscode-extension/) that provides the full RunCode agent experience
    inside VS Code — chat panel, tool execution, model switching, and all slash commands

    • Implement real-time balance tracking in the webview: balance updates synchronously on each usage
      event using local cost estimation (same approach as the Ink terminal UI), with RPC sync on turn
      completion
    • Add headless session API (src/api/vscode-session.ts) that decouples the agent loop from terminal
      I/O, enabling any host (VS Code, future web UI, etc.) to drive sessions via getUserInput + onEvent
    • Enhance /model command to render a full numbered model list via StreamEvent (previously only worked
      via console.error in TTY), allowing VS Code and other non-terminal hosts to display the picker
    • Add StreamStatusUpdate event type so model changes propagate to persistent UI elements without
      stderr
    • Two-tone banner rendering (gold "Run" + cyan "Code") in webview, matching CLI chalk output
    • Update README with VS Code extension install instructions and architecture diagram
    • Add dist/, .vscode/, vscode-extension/out/, *.vsix to .gitignore

    Test plan

    • npm run build in root — compiles cleanly
    • npm run compile in vscode-extension/ — compiles cleanly
    • F5 launch Extension Development Host — RunCode panel appears in sidebar
    • Send a message — agent responds, model and balance update in status strip
    • Balance decreases after each API call (no page reload needed)
    • /model displays numbered list in chat log
    • /model 3 or /model sonnet switches model, status strip updates
    • Stop button / Esc cancels in-flight requests
    • CLI runcode still works as before — no regressions

1bcMax added 30 commits March 22, 2026 01:50
1bcMax and others added 27 commits April 5, 2026 00:53
Based on Claude Code source review:
- Grep/Glob: output relative paths instead of absolute (saves tokens)
- Grep: add --max-columns 500 to prevent base64/minified line bloat

Glob task tokens: 2,191 → 761 (-65%).
…cking (v2.5.8)

Based on Claude Code source review:
- context.ts: memoize assembleInstructions per workingDir; cap git log at 2KB
- webfetch.ts: 15-min session cache (50 entries) — no re-fetching same URL
- edit.ts: normalize curly quotes before failing (reduces false edit errors)
- read.ts: track partial reads; edit warns when file was only partially read
…fresh, E2E tests (v2.5.18)

- Scrollback: commit full responses to Static immediately; show last-5-line preview in dynamic area so terminal scrollback buffer captures all output
- User-Agent: centralize USER_AGENT in config.ts, apply to LLM client and WebFetch tool
- Balance: re-fetch after every turn_done so status bar reflects real spend
- Session cost: live spend shown in status bar (-$X.XXXX in yellow)
- Type-ahead: queue input while agent is busy, auto-submit on turn_done
- E2E test suite: 13 tests covering all core tools + session cost tracking (node:test, no extra deps)
- Live balance: compute display balance as fetchedBalance - sessionCost in real-time, no stale on-chain lag
- zai/glm-5 pricing: switch from per-token ($1.0/$3.2M) to per-call ($0.001/call) matching actual BlockRun billing
- Track LLM call count per turn, emit in usage event, accumulate in session stats
- Show call count in session footer: "109,795 in / 300 calls · $0.30 session"
- estimateCost: add perCall support for flat-rate models
- Prompt caching: add cache_control ephemeral markers on system prompt, tools, and penultimate message for anthropic/* models — cuts input token costs ~90% on cache hits
- Add anthropic-beta: prompt-caching-2024-07-31 header automatically for Anthropic models
- README: comprehensive Solana/Base payment docs — setup, funding sources, chain switching, USDC acquisition
- README: add `runcode base` / `runcode solana` commands to reference table
- GLM-specific request tuning: temperature=0.8 default per official zai spec
- Thinking mode: auto-enable {"thinking": {"type": "enabled"}} for -thinking- model variants
- Add zai/glm-5-turbo to model picker with shortcut glm-turbo
- Add glm5/glm-turbo shortcuts to model resolver
- Updated .gitignore to include VS Code and distribution files.
- Added exports for VS Code integration in package.json.
- Expanded README with installation instructions for the VS Code extension.
- Introduced new functions for plain-text banner lines and footer for non-terminal UIs.
- Enhanced model management commands to support listing models and switching via index or name.
- Updated StreamEvent types to include status updates for UI hosts.
Copy link
Copy Markdown
Member

@1bcMax 1bcMax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR — good feature choices. /history, /delete, and the numbered model picker are all real user pain points. The headless session API is the right abstraction for multi-host support.

A few things before I can review further:

  1. Remove dist/ from the PR. Compiled output shouldn't be committed — it'll be generated by CI. Please also remove vscode-extension/package-lock.json and vscode-extension/out/ if present.

  2. Split extension.ts (782 lines) into smaller modules. Suggestion: webview-provider.ts, session-manager.ts, and ui-renderer.ts. One file doing webview setup + session management + HTML rendering + balance tracking is too much to review or maintain.

  3. Version bump should be a separate commit (2.5.28 → 2.5.29), not mixed into the feature.

  4. Can you explain the design decision behind the headless session API (vscode-session.ts) — why decouple via getUserInput + onEvent callbacks rather than importing the agent loop directly? Want to make sure we're aligned on the architecture before this ships.

Looking forward to the updated PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants