Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e90a616
feat(ide): host ACP coding agents in the main process (#266)
claude Nov 27, 2026
615e544
feat(ide): expose the Code-XR analysis to agents as an MCP server (#275)
claude Nov 27, 2026
228141a
feat(ide): shadow-git checkpoints and pending changes store (#271, #270)
claude Nov 27, 2026
4e6087c
feat(ide): git worktrees for parallel agent chats (#277)
claude Nov 27, 2026
4d9bff7
feat(ide): agent-first workbench: chats view, chat tabs, Agent and Cl…
claude Nov 27, 2026
fe2dca3
Merge origin/ide (custom editor seam, PDF viewer) into the agent-firs…
claude Nov 27, 2026
4f68a86
feat(ide): metric delta per turn and a scene-updated signal (#273, #274)
claude Nov 27, 2026
8b24619
feat(ide): wire the agent-first workbench into the window (#266, #268…
claude Nov 27, 2026
93b2893
Merge remote-tracking branch 'origin/ide' into claude/project-thread-…
claude Nov 27, 2026
e86d39d
fix(ide): draw the plan markers in CSS so sources stay free of symbol…
claude Nov 27, 2026
7800922
fix(ide): register the chat tab resolver when the editor group is cre…
claude Nov 27, 2026
5baeaa6
feat(ide): review, checkpoints and metric delta per turn in main (#27…
claude Nov 27, 2026
0020d25
feat(ide): Changes tab, inline restore confirmation and metric line u…
claude Nov 27, 2026
a59d31c
IDE: install coding agents on explicit consent and a first-run guide …
claude Nov 27, 2026
980445e
Merge origin/claude/project-thread-9m9bjg into af2-af13 (#267, #278)
claude Nov 27, 2026
b6f2900
Merge af2-af13 (agent install with consent, first-run guide) into the…
claude Nov 27, 2026
b581fe4
docs(ide): manual test guide for the agent-first IDE (#265)
claude Nov 27, 2026
ff715fa
Merge remote-tracking branch 'origin/ide' into claude/project-thread-…
claude Nov 27, 2026
e4ac016
test(ide): make the PATH lookup and worktree tests independent of the…
claude Nov 27, 2026
0721c4f
feat(ide): run agent chats in their own git worktree (#277)
claude Nov 27, 2026
612a24f
feat(ide): Separate worktree option, branch badges and Worktree bar (…
claude Nov 27, 2026
36bc3da
Merge remote-tracking branch 'origin/af12' into claude/project-thread…
claude Nov 27, 2026
98aa8e0
Merge af12 (worktree per chat UI, #277) and make its tests host-indep…
claude Nov 27, 2026
0af18f2
Merge remote-tracking branch 'origin/ide' into claude/project-thread-…
claude Nov 27, 2026
44a4152
Merge remote-tracking branch 'origin/ide' into claude/project-thread-…
claude Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/ide/README.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions apps/ide/THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ Usage in this package:

- Bundled into the renderer by Vite: sanitises the Markdown preview's HTML before it reaches the page (#179, `src/renderer/editor/markdownPreview.ts`). The same version Monaco already depends on.

## MCP TypeScript SDK (the Code-XR MCP server)

- Project: `@modelcontextprotocol/sdk` on npm, 1.32.2, by Anthropic, PBC and the Model Context Protocol contributors
- Source: https://github.com/modelcontextprotocol/typescript-sdk
- License: MIT

Usage in this package:

- Bundled by Vite into the Code-XR MCP server (`out/codexrMcp/index.cjs`, AF10, `src/codexrMcp/`) that external agents run to query the project's analysis. Only that bundle carries it; the main process has its own small MCP client (`src/main/agents/mcp/`).
- The bundle also carries the SDK's own dependencies: `zod` (4.6.7, MIT, https://github.com/colinhacks/zod), `zod-to-json-schema` (3.25.2, ISC, https://github.com/StefanTerdell/zod-to-json-schema), `ajv` (8.20.0, MIT, https://github.com/ajv-validator/ajv), `ajv-formats` (3.0.1, MIT), `fast-deep-equal` (3.1.3, MIT), `json-schema-traverse` (1.0.0, MIT) and `fast-uri` (3.0.6, BSD-3-Clause, https://github.com/fastify/fast-uri).

## vscode-textmate (TextMate grammars of extensions)

- Project: `vscode-textmate` on npm, 9.3.2, by Microsoft Corporation
Expand Down Expand Up @@ -168,6 +179,16 @@ Usage in this package:
- The text-layer rules in `src/renderer/viewers/viewers.css` are a trimmed copy of the `.textLayer` block of its `web/pdf_viewer.css`.
- The optional `@napi-rs/canvas` dependency is only used by PDF.js under Node and is not bundled.

## Agent Client Protocol TypeScript SDK (agent chats)

- Project: `@agentclientprotocol/sdk` on npm, 2.12.0, by Zed Industries and the Agent Client Protocol contributors
- Source: https://github.com/agentclientprotocol/typescript-sdk
- License: Apache-2.0

Usage in this package:

- Bundled by Vite into the main process: speaks the Agent Client Protocol with the coding agents a chat runs (Claude Code, Codex, Gemini CLI; AF1, `src/main/agentSessions/acpConnection.ts`). The agents themselves are separate programs installed by the person and are not part of this package.

## xterm.js search and web-links addons (terminal find and links)

- Project: `@xterm/addon-search` 0.16.0 and `@xterm/addon-web-links` 0.12.0 on npm, by the xterm.js authors (released with `@xterm/xterm` 6.0.0)
Expand Down
2 changes: 2 additions & 0 deletions apps/ide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"node": ">=24"
},
"devDependencies": {
"@agentclientprotocol/sdk": "2.12.0",
"@modelcontextprotocol/sdk": "1.32.2",
"@types/node": "^22.20.7",
"@types/vscode": "1.146.0",
"@types/yauzl": "3.4.0",
Expand Down
1 change: 1 addition & 0 deletions apps/ide/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { nodeTargetConfig, rendererConfig } from './viteConfigs.mjs';
await build(nodeTargetConfig('main'));
await build(nodeTargetConfig('preload'));
await build(nodeTargetConfig('scenePreload'));
await build(nodeTargetConfig('codexrMcp'));
await build(nodeTargetConfig('extensionHost'));
await build(rendererConfig());
console.log('[code-xr-ide] built into apps/ide/out/');
7 changes: 4 additions & 3 deletions apps/ide/scripts/dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ function restartElectron() {
startElectron();
}

// Watch main, both preloads (the window's and the scene view's, #16) and the extension host (#259); restart Electron after each successful rebuild.
const pending = new Set(['main', 'preload', 'scenePreload', 'extensionHost']);
for (const target of /** @type {const} */ (['main', 'preload', 'scenePreload', 'extensionHost'])) {
// Watch main, both preloads (the window's and the scene view's, #16), the
// MCP server (AF10) and the extension host (#259); restart Electron after each successful rebuild.
const pending = new Set(['main', 'preload', 'scenePreload', 'codexrMcp', 'extensionHost']);
for (const target of /** @type {const} */ (['main', 'preload', 'scenePreload', 'codexrMcp', 'extensionHost'])) {
const config = nodeTargetConfig(target, { dev: true });
config.build.watch = {};
const watcher = /** @type {import('vite').Rollup.RollupWatcher} */ (await build(config));
Expand Down
4 changes: 3 additions & 1 deletion apps/ide/scripts/viteConfigs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// out/main/index.cjs main process (Node, CommonJS)
// out/preload/index.cjs preload (sandboxed: may only require 'electron')
// out/renderer/ renderer (browser, served from codexr://app/)
// out/codexrMcp/index.cjs the Code-XR MCP server for external agents (AF10;
// a separate process run with ELECTRON_RUN_AS_NODE)
// out/extensionHost/index.cjs extension host (#259: a Node child process on Electron's own Node)
import { builtinModules } from 'node:module';
import path from 'node:path';
Expand All @@ -28,7 +30,7 @@ const NODE_EXTERNALS = ['electron', /^electron\//, ...builtinModules, ...builtin
*/
const MAIN_NATIVE_EXTERNALS = ['node-pty'];

/** @param {'main' | 'preload' | 'scenePreload' | 'extensionHost'} target @param {{ dev?: boolean }} [opts] */
/** @param {'main' | 'preload' | 'scenePreload' | 'codexrMcp' | 'extensionHost'} target @param {{ dev?: boolean }} [opts] */
export function nodeTargetConfig(target, opts = {}) {
return {
configFile: false,
Expand Down
23 changes: 23 additions & 0 deletions apps/ide/src/codexrMcp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { createCodexrMcpServer, parseArgs } from './server.ts';

/**
* Entry of the Code-XR MCP server (AF10), bundled on its own into
* out/codexrMcp/index.cjs. The IDE hands it to each external agent in ACP
* `session/new` as a stdio server run by the IDE's own binary with
* ELECTRON_RUN_AS_NODE=1, so no system Node is needed:
*
* <code-xr-ide> out/codexrMcp/index.cjs --root <project> --analysis <dir>
*
* stdout carries the protocol; diagnostics go to stderr only.
*/

async function main(): Promise<void> {
const server = createCodexrMcpServer(parseArgs(process.argv.slice(2)));
await server.connect(new StdioServerTransport());
}

main().catch((error: unknown) => {
process.stderr.write(`[code-xr-mcp] ${error instanceof Error ? error.message : String(error)}\n`);
process.exit(1);
});
84 changes: 84 additions & 0 deletions apps/ide/src/codexrMcp/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import path from 'node:path';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import * as z from 'zod';
import { ANALYSIS_QUERIES, NO_ANALYSIS, type AnalysisQuery } from '../main/agents/tools/analysisQueries.ts';

/**
* The Code-XR MCP server (AF10): the analysis queries of the built-in agent
* (get_metrics, get_hotspots, get_dependencies, get_evolution), offered over
* the Model Context Protocol to the external agents the IDE starts (Claude
* Code, Codex, Gemini CLI over ACP), so they reason over the same
* measurements the person sees in XR.
*
* Kept apart from the stdio entry (index.ts) so the tests can drive it over
* the SDK's in-memory transport. It is read-only by construction: the only
* files it opens are those the shared queries read inside the analysis
* folder (data.json, dependency-graph.json, evolution/revision-N/), it never
* starts an analysis, and it has no network listener.
*/

export const CODEXR_MCP_NAME = 'code-xr';
export const CODEXR_MCP_VERSION = '0.1.0';

export interface CodexrMcpOptions {
/** The project open in the IDE (absolute). Paths in the tools' arguments are relative to it. */
readonly root: string;
/** The static folder of the project's XR analysis (absolute), or null when none has run yet. */
readonly analysisDir: string | null;
}

/** The descriptions external agents see: the built-in agent's, saying where they come from. */
export function mcpDescription(query: AnalysisQuery): string {
return `[Code-XR] ${query.description}`;
}

/** The zod shape the SDK wants, built from the query's JSON Schema so both surfaces stay identical. */
function inputShape(query: AnalysisQuery): Record<string, z.ZodType> {
const shape: Record<string, z.ZodType> = {};
for (const [key, property] of Object.entries(query.parameters.properties)) {
shape[key] = (property.type === 'integer' ? z.number().int() : z.string()).optional().describe(property.description);
}
return shape;
}

/** Parses `--root <dir> --analysis <dir>`; an empty analysis argument means "no analysis yet". */
export function parseArgs(argv: readonly string[]): CodexrMcpOptions {
const value = (flag: string): string | undefined => {
const index = argv.indexOf(flag);
return index >= 0 ? argv[index + 1] : undefined;
};
const root = value('--root');
if (!root || !path.isAbsolute(root)) {
throw new Error('--root must be an absolute path.');
}
const analysis = value('--analysis') ?? '';
if (analysis && !path.isAbsolute(analysis)) {
throw new Error('--analysis must be an absolute path or empty.');
}
return { root: path.resolve(root), analysisDir: analysis ? path.resolve(analysis) : null };
}

export function createCodexrMcpServer(options: CodexrMcpOptions): McpServer {
const server = new McpServer(
{ name: CODEXR_MCP_NAME, title: 'Code-XR analysis', version: CODEXR_MCP_VERSION },
{ instructions: `Read-only Code-XR code metrics of the project at ${options.root}: per-file metrics, complexity hot spots, the dependency graph and the Git evolution, from the analysis the person ran in the Code-XR IDE. Paths are relative to the project root.` },
);
for (const query of ANALYSIS_QUERIES) {
server.registerTool(query.name, {
title: query.title,
description: mcpDescription(query),
inputSchema: inputShape(query),
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
}, async (args: Record<string, unknown>) => {
try {
if (!options.analysisDir) {
throw new Error(NO_ANALYSIS);
}
return { content: [{ type: 'text' as const, text: await query.run(args, options.analysisDir) }] };
} catch (error) {
return { content: [{ type: 'text' as const, text: error instanceof Error ? error.message : String(error) }], isError: true };
}
});
}
return server;
}
Loading
Loading