Skip to content

feat: add a VS Code extension that embeds the existing web UI (webview shell)#1780

Draft
kermanx wants to merge 1 commit into
MoonshotAI:mainfrom
kermanx:feat/vscode-extension
Draft

feat: add a VS Code extension that embeds the existing web UI (webview shell)#1780
kermanx wants to merge 1 commit into
MoonshotAI:mainfrom
kermanx:feat/vscode-extension

Conversation

@kermanx

@kermanx kermanx commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Draft kept for the record — not asking to merge. Filed while unaware that
the official SDK-based extension (apps/vscode) was landing upstream; this
explores the opposite tradeoff (embed the existing web UI unchanged) and is
retained as a reference.

Related Issue

N/A — see Problem below (no linked issue).

Problem

Kimi Code has no presence inside VS Code in this fork's base: using it means keeping a browser tab or the desktop app next to the editor, detached from the editor's workspace. This explores a VS Code extension that puts the existing web UI into the activity bar, bound to the editor's own workspace folders.

What changed

  • apps/kimi-vscode (new): activity-bar icon + sidebar webview that iframes the server-served web UI (same thin-shell model as apps/kimi-desktop — no UI reimplementation, no copied code). It starts the local server in the foreground (KIMI_CODE_EXPERIMENTAL_MULTI_SERVER=1, ready-line parsing for port/token, #token= fragment auth), registers every VS Code workspace folder via POST /api/v1/workspaces, and passes them to the UI in order. Dev mode runs the CLI sources via tsx; F5 debug configs committed.
  • kimi-web embedded-host support: src/lib/workspaceHint.ts?workspace=<pin> + ordered repeatable &folder=<root> params: pinned initial selection, workspace listings filtered+ordered by the host, per-workspace session loading restricted to host folders, add/remove-workspace entry points hidden, flat single-workspace layout. src/composables/hostColorScheme.ts + useAppearance — host-pushed color-scheme postMessage resolves 'system' mode to the VS Code theme at the data-color-scheme level (the webview's cross-origin iframe otherwise follows the OS). Plain browser behavior unchanged without the params.
  • Self-contained universal vsix (no platform binaries): ships the CLI's single-file server bundle + web UI (~9.5 MB), runs under VS Code's own Electron Node (ELECTRON_RUN_AS_NODE=1), lifts node-pty natives from VS Code's own install (ABI always matches). Without node-pty only the terminal feature degrades (verified in both states).
  • Release plumbing (manual): .github/workflows/vscode-extension.yml builds/artifacts the vsix on workflow_dispatch; publishes only when dispatched (VSCE_PAT, --skip-duplicate).
  • Repo plumbing: flake.nix, root typecheck script, .gitignore (shared .vscode/{launch,tasks}.json, packaging outputs), AGENTS.md, changeset.

Notes for reviewers / future porting

  • Deliberately different product shape from apps/vscode (full web UI vs SDK-native editor integration). The kimi-web host-binding (workspaceHint) and theme-bridge pieces are independent of this extension and could serve any iframe-embedded host if ever wanted.
  • Branch is based on 81414b6 (pre-apps/vscode-landing fork main); no rebase has been done onto current upstream main.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works. (workspace-hint + focused-loading + host folder ordering coverage in apps/kimi-web/test/)
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update. (Not intended for merge; the extension's README covers dev/packaging.)

@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f31b529

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@acoustesh

Copy link
Copy Markdown

Adding a user perspective in favor of deeper VS Code integration, since this PR is retained as a reference for future porting.

I'm already using the official extension (moonshot-ai.kimi-code, apps/vscode) from the Activity Bar, and it works well as its own panel. What I'd like to see next is integration with VS Code's unified Agent Sessions view — the panel where Copilot Chat, Claude Code, and Codex now run side by side (VS Code 1.109+). Those agents participate through VS Code's agent framework (third-party/background agents, session hand-off like @codex, "Continue In" controls, etc.), and it would be great if Kimi Code could register as one of those agent types instead of living only in its own webview panel.

Concretely, the ask:

The webview-shell approach in this draft and the SDK-native apps/vscode both seem like they could host such an integration — leaving this here in case it helps shape a future official take on it. Thanks for keeping this exploration around!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.

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