diff --git a/COORDINATING-AGENT.md b/COORDINATING-AGENT.md new file mode 100644 index 00000000..ff76b48b --- /dev/null +++ b/COORDINATING-AGENT.md @@ -0,0 +1,128 @@ +# Coordinating Agent — Implementation Notes + +## Overview + +A Claude Code agent running inside a task can now programmatically create and coordinate other tasks in Parallel Code via MCP tools. The coordinating agent can spawn sub-tasks, send prompts, monitor completion, read diffs, and merge results — all without manual human orchestration. + +## Architecture + +``` +Claude Code (coordinating task PTY) + | MCP stdio (JSON-RPC) + v +MCP Server Process (electron/mcp/server.ts) + | HTTP + Bearer token + v +Electron Remote Server (electron/remote/server.ts) + | Direct function calls + v +Orchestrator (electron/mcp/orchestrator.ts) + | Uses existing backend primitives + v +PTY / Git / Worktree functions +``` + +## MCP Tools Available to Coordinating Agents + +| Tool | Description | +| ----------------- | --------------------------------------- | +| `create_task` | Create a new task with worktree + agent | +| `list_tasks` | List all orchestrated tasks with status | +| `get_task_status` | Get task status + git summary | +| `send_prompt` | Send prompt to a task's agent | +| `wait_for_idle` | Wait until agent becomes idle | +| `get_task_diff` | Get changed files + unified diff | +| `get_task_output` | Get recent terminal output | +| `merge_task` | Merge task branch to main | +| `close_task` | Close and clean up a task | + +## Files Created + +- `electron/mcp/prompt-detect.ts` — Shared prompt detection (extracted from taskStatus.ts) +- `electron/mcp/types.ts` — Shared types for orchestrator, API, MCP tools +- `electron/mcp/orchestrator.ts` — Main-process task lifecycle management +- `electron/mcp/client.ts` — HTTP client for MCP server -> remote server +- `electron/mcp/server.ts` — Standalone MCP server (stdio transport) +- `src/components/SubTaskStrip.tsx` — Sub-task status chips on coordinator panel + +## Files Modified + +- `electron/ipc/channels.ts` — MCP IPC channels +- `electron/remote/server.ts` — Orchestrator REST API endpoints +- `electron/ipc/register.ts` — Orchestrator init, MCP IPC handlers +- `src/store/types.ts` — `coordinatorMode`, `coordinatedBy`, `mcpConfigPath` on Task +- `src/store/tasks.ts` — Coordinator task creation, MCP event listeners +- `src/store/taskStatus.ts` — Imports from shared prompt-detect module +- `src/store/persistence.ts` — Persist/restore coordinator fields +- `src/store/store.ts` — Export `initMCPListeners` +- `src/App.tsx` — Initialize MCP listeners +- `src/components/NewTaskDialog.tsx` — "Coordinator mode" checkbox +- `src/components/TaskPanel.tsx` — SubTaskStrip, `--mcp-config` in agent args +- `src/components/Sidebar.tsx` — "via Coordinator" labels on sub-tasks +- `package.json` — Added `@modelcontextprotocol/sdk`, dev build identity + +## UI Changes + +1. **New Task Dialog** — "Coordinator mode" checkbox after agent selector. When enabled, shows a warning banner and auto-starts the MCP infrastructure on task creation. + +2. **Sidebar** — Sub-tasks created by a coordinator show a "via {name}" label below the task name. Clicking the label navigates to the coordinator task. + +3. **Task Panel** — Coordinator tasks show a horizontal sub-task status strip between the branch info bar and the notes panel. Each chip shows a StatusDot + task name and is clickable. + +--- + +## Testing + +### Build + +The build identity has been changed to `com.parallel-code.app.dev` / "Parallel Code Dev" so it installs separately from the production app. + +```bash +# From the worktree directory +npm run build +# .dmg is in release/ +open release/*.dmg +``` + +### Test 1: MCP Server Standalone + +1. Start the dev app +2. Open Settings, start the remote server (or it auto-starts with coordinator mode) +3. Run the MCP server directly to verify it connects: + ```bash + node dist-electron/mcp/server.js --url http://127.0.0.1:7777 --token + ``` + (The token is printed in the app's remote server settings) +4. Use the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) or send JSON-RPC over stdin to call tools like `list_tasks` + +### Test 2: Coordinator Task End-to-End + +1. Link a project in the app +2. Click "New Task" +3. Check the **"Coordinator mode"** checkbox +4. Enter a prompt like: `Create two tasks: one to add a README.md and one to add a LICENSE file. Wait for both to complete, then merge them.` +5. Submit — the app will: + - Auto-start the remote server + - Write a temp MCP config file + - Spawn Claude Code with `--mcp-config ` +6. Verify: + - Sub-tasks appear in the sidebar with "via {coordinator-name}" labels + - The coordinator's panel shows a sub-task status strip with chips + - Clicking a chip navigates to that sub-task + - The coordinating agent can merge and close sub-tasks + +### Test 3: UI Elements + +1. Create a coordinator task (as above) +2. Wait for it to create at least one sub-task +3. Check sidebar: sub-task should show "via {name}" in muted text +4. Check coordinator panel: sub-task strip should appear with status dots +5. Click the "via" label — should navigate to coordinator +6. Click a chip in the strip — should navigate to that sub-task + +### Test 4: Edge Cases + +- Create multiple sub-tasks rapidly +- Close a sub-task while its agent is busy +- Close the coordinator while sub-tasks are still running +- Collapse and uncollapse a coordinator task diff --git a/electron/ipc/agents.ts b/electron/ipc/agents.ts index ea316e16..5ac0e7c8 100644 --- a/electron/ipc/agents.ts +++ b/electron/ipc/agents.ts @@ -31,7 +31,7 @@ const DEFAULT_AGENTS: AgentDef[] = [ command: 'codex', args: [], resume_args: ['resume', '--last'], - skip_permissions_args: ['--full-auto'], + skip_permissions_args: ['--dangerously-bypass-approvals-and-sandbox'], description: "OpenAI's Codex CLI agent", }, { diff --git a/electron/ipc/channels.ts b/electron/ipc/channels.ts index 0b3221d9..98854966 100644 --- a/electron/ipc/channels.ts +++ b/electron/ipc/channels.ts @@ -132,4 +132,14 @@ export enum IPC { // Logging LogFromRenderer = 'log_from_renderer', + + // MCP / Coordinating agent + StartMCPServer = 'start_mcp_server', + StopMCPServer = 'stop_mcp_server', + GetMCPStatus = 'get_mcp_status', + GetMCPLogs = 'get_mcp_logs', + MCP_TaskCreated = 'mcp_task_created', + MCP_TaskClosed = 'mcp_task_closed', + MCP_TaskStateSync = 'mcp_task_state_sync', + MCP_ControlChanged = 'mcp_control_changed', } diff --git a/electron/ipc/pty.test.ts b/electron/ipc/pty.test.ts index afa4a15b..6973c66b 100644 --- a/electron/ipc/pty.test.ts +++ b/electron/ipc/pty.test.ts @@ -4,63 +4,66 @@ import path from 'path'; import type { BrowserWindow } from 'electron'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -const { mockExecFileSync, mockExecFile, mockChildProcessSpawn, mockPtySpawn } = vi.hoisted(() => { - const mockExecFileSync = vi.fn((command: string, args?: string[]) => { - if (command === 'which' && args?.[0] === 'nonexistent-binary-xyz') { - throw new Error('not found'); - } - return ''; - }); - - const mockExecFile = vi.fn(); - const mockChildProcessSpawn = vi.fn(() => ({ - stdout: { on: vi.fn() }, - stderr: { on: vi.fn() }, - on: vi.fn(), - })); - - const mockPtySpawn = vi.fn( - (_command: string, _args: string[], options: { cols: number; rows: number }) => { - let onDataHandler: ((data: string) => void) | undefined; - let onExitHandler: - | ((event: { exitCode: number; signal: number | undefined }) => void) - | undefined; - - const proc = { - cols: options.cols, - rows: options.rows, - write: vi.fn(), - resize: vi.fn((cols: number, rows: number) => { - proc.cols = cols; - proc.rows = rows; - }), - pause: vi.fn(), - resume: vi.fn(), - kill: vi.fn(() => { - onExitHandler?.({ exitCode: 0, signal: 15 }); - }), - onData: vi.fn((handler: (data: string) => void) => { - onDataHandler = handler; - }), - onExit: vi.fn( - (handler: (event: { exitCode: number; signal: number | undefined }) => void) => { - onExitHandler = handler; +const { mockExecFileSync, mockExecFile, mockChildProcessSpawn, mockPtySpawn, mockLogDebug } = + vi.hoisted(() => { + const mockExecFileSync = vi.fn((command: string, args?: string[]) => { + if (command === 'which' && args?.[0] === 'nonexistent-binary-xyz') { + throw new Error('not found'); + } + return ''; + }); + + const mockExecFile = vi.fn(); + const mockChildProcessSpawn = vi.fn(() => ({ + stdout: { on: vi.fn() }, + stderr: { on: vi.fn() }, + on: vi.fn(), + })); + + const mockPtySpawn = vi.fn( + (_command: string, _args: string[], options: { cols: number; rows: number }) => { + let onDataHandler: ((data: string) => void) | undefined; + let onExitHandler: + | ((event: { exitCode: number; signal: number | undefined }) => void) + | undefined; + + const proc = { + cols: options.cols, + rows: options.rows, + write: vi.fn(), + resize: vi.fn((cols: number, rows: number) => { + proc.cols = cols; + proc.rows = rows; + }), + pause: vi.fn(), + resume: vi.fn(), + kill: vi.fn(() => { + onExitHandler?.({ exitCode: 0, signal: 15 }); + }), + onData: vi.fn((handler: (data: string) => void) => { + onDataHandler = handler; + }), + onExit: vi.fn( + (handler: (event: { exitCode: number; signal: number | undefined }) => void) => { + onExitHandler = handler; + }, + ), + emitData(data: string) { + onDataHandler?.(data); }, - ), - emitData(data: string) { - onDataHandler?.(data); - }, - emitExit(event: { exitCode: number; signal: number | undefined }) { - onExitHandler?.(event); - }, - }; + emitExit(event: { exitCode: number; signal: number | undefined }) { + onExitHandler?.(event); + }, + }; - return proc; - }, - ); + return proc; + }, + ); - return { mockExecFileSync, mockExecFile, mockChildProcessSpawn, mockPtySpawn }; -}); + const mockLogDebug = vi.fn(); + + return { mockExecFileSync, mockExecFile, mockChildProcessSpawn, mockPtySpawn, mockLogDebug }; + }); vi.mock('child_process', async () => { const actual = await vi.importActual('child_process'); @@ -76,6 +79,10 @@ vi.mock('node-pty', () => ({ spawn: mockPtySpawn, })); +vi.mock('../log.js', () => ({ + debug: mockLogDebug, +})); + import { buildDockerImage, DOCKER_CONTAINER_HOME, @@ -119,6 +126,7 @@ function buildSpawnArgs( rows: 40, dockerMode: true, dockerImage: 'parallel-code-agent:test', + shareDockerAgentAuth: false, onOutput: { __CHANNEL_ID__: 'channel-1' }, ...overrides, }; @@ -155,6 +163,14 @@ function getFlagValues(args: string[], flag: string): string[] { return values; } +function getSpawnCommandLogCtx(): { args: string[]; command: string } { + const call = mockLogDebug.mock.calls.find( + ([category, msg]) => category === 'pty' && String(msg).startsWith('spawn command '), + ); + expect(call).toBeTruthy(); + return call?.[2] as { args: string[]; command: string }; +} + function makeTempHome(entries: string[]): string { const home = fs.mkdtempSync(path.join(os.tmpdir(), 'pty-docker-home-')); tempPaths.push(home); @@ -229,6 +245,61 @@ describe('spawnAgent docker mode', () => { expect(envFlags).not.toContain(`HOME=${rendererHome}`); }); + it('redacts docker env values in spawn debug logs', () => { + spawnAgent( + createMockWindow(), + buildSpawnArgs({ + env: { + API_KEY: 'secret-api-key', + NO_VALUE: '', + }, + }), + ); + + const ctx = getSpawnCommandLogCtx(); + const logged = ctx.args.join(' '); + + expect(ctx.command).toBe('docker'); + expect(getFlagValues(ctx.args, '-e')).toContain('API_KEY='); + expect(getFlagValues(ctx.args, '-e')).toContain('NO_VALUE='); + expect(getFlagValues(ctx.args, '-e')).toContain(`HOME=`); + expect(logged).not.toContain('secret-api-key'); + expect(logged).not.toContain(`HOME=${DOCKER_CONTAINER_HOME}`); + expect(logged).toContain('parallel-code-agent:test'); + }); + + it('redacts inline docker env values in spawn debug logs', () => { + spawnAgent( + createMockWindow(), + buildSpawnArgs({ + args: ['--env=INLINE_TOKEN=inline-secret', '--env', 'SPLIT_TOKEN=split-secret'], + }), + ); + + const logged = getSpawnCommandLogCtx().args.join(' '); + + expect(logged).toContain('--env=INLINE_TOKEN='); + expect(logged).toContain('SPLIT_TOKEN='); + expect(logged).not.toContain('inline-secret'); + expect(logged).not.toContain('split-secret'); + }); + + it('redacts shell command strings in spawn debug logs', () => { + spawnAgent( + createMockWindow(), + buildSpawnArgs({ + command: '/bin/sh', + args: ['-c', 'codex exec "prompt containing private context"'], + dockerMode: false, + }), + ); + + const ctx = getSpawnCommandLogCtx(); + + expect(ctx.command).toBe('/bin/sh'); + expect(ctx.args).toEqual(['-c', '']); + }); + it('redirects credential mounts under /tmp inside the container', () => { const home = makeTempHome(['.ssh/', '.gitconfig', '.config/gh/']); vi.stubEnv('HOME', home); @@ -240,6 +311,67 @@ describe('spawnAgent docker mode', () => { expect(volumeFlags).toContain(`${home}/.gitconfig:${DOCKER_CONTAINER_HOME}/.gitconfig:ro`); expect(volumeFlags).toContain(`${home}/.config/gh:${DOCKER_CONTAINER_HOME}/.config/gh:ro`); }); + + describe('agent config dir mounts (shareDockerAgentAuth)', () => { + it.each([ + ['claude', '.claude'], + ['codex', '.codex'], + ['gemini', '.gemini'], + ['opencode', '.config/opencode'], + ['copilot', '.config/github-copilot'], + ])( + '%s bind-mounts a user-owned host directory when shareDockerAgentAuth is enabled', + (command, relDir) => { + const home = makeTempHome([]); + vi.stubEnv('HOME', home); + + spawnAgent(createMockWindow(), buildSpawnArgs({ command, shareDockerAgentAuth: true })); + + const volumeFlags = getFlagValues(getLastSpawnCall().args, '-v'); + const expectedHostDir = `${home}/.parallel-code/agent-auth/${command}`; + expect(volumeFlags).toContain(`${expectedHostDir}:${DOCKER_CONTAINER_HOME}/${relDir}`); + }, + ); + + it('creates the host auth directory so it is user-owned before mounting', () => { + const home = makeTempHome([]); + vi.stubEnv('HOME', home); + + spawnAgent( + createMockWindow(), + buildSpawnArgs({ command: 'claude', shareDockerAgentAuth: true }), + ); + + const hostDir = `${home}/.parallel-code/agent-auth/claude`; + expect(fs.existsSync(hostDir)).toBe(true); + }); + + it('does not mount agent auth directory when shareDockerAgentAuth is disabled', () => { + const home = makeTempHome([]); + vi.stubEnv('HOME', home); + + spawnAgent( + createMockWindow(), + buildSpawnArgs({ command: 'claude', shareDockerAgentAuth: false }), + ); + + const volumeFlags = getFlagValues(getLastSpawnCall().args, '-v'); + expect(volumeFlags.some((v) => v.includes('.parallel-code/agent-auth'))).toBe(false); + }); + + it('does not mount agent auth directory for an unknown agent command', () => { + const home = makeTempHome([]); + vi.stubEnv('HOME', home); + + spawnAgent( + createMockWindow(), + buildSpawnArgs({ command: 'unknown-agent', shareDockerAgentAuth: true }), + ); + + const volumeFlags = getFlagValues(getLastSpawnCall().args, '-v'); + expect(volumeFlags.some((v) => v.includes('.parallel-code/agent-auth'))).toBe(false); + }); + }); }); describe('validateCommand', () => { diff --git a/electron/ipc/pty.ts b/electron/ipc/pty.ts index 10194263..cd4a83d2 100644 --- a/electron/ipc/pty.ts +++ b/electron/ipc/pty.ts @@ -64,6 +64,50 @@ const BATCH_INTERVAL = 8; // ms const TAIL_CAP = 8 * 1024; const MAX_LINES = 50; +function redactedSpawnArgs(command: string, args: string[]): string[] { + if ((command === '/bin/sh' || command.endsWith('/sh')) && args[0] === '-c') { + return ['-c', '']; + } + if (command === 'docker') { + return redactDockerArgs(args); + } + return args; +} + +function redactDockerArgs(args: string[]): string[] { + const redacted: string[] = []; + let redactNextEnv = false; + + for (const arg of args) { + if (redactNextEnv) { + redacted.push(redactEnvAssignment(arg)); + redactNextEnv = false; + continue; + } + + if (arg === '-e' || arg === '--env') { + redacted.push(arg); + redactNextEnv = true; + continue; + } + + if (arg.startsWith('--env=')) { + redacted.push(`--env=${redactEnvAssignment(arg.slice('--env='.length))}`); + continue; + } + + redacted.push(arg); + } + + return redacted; +} + +function redactEnvAssignment(value: string): string { + const eqIdx = value.indexOf('='); + if (eqIdx <= 0) return ''; + return `${value.slice(0, eqIdx)}=`; +} + /** Verify that a command exists in PATH. Throws a descriptive error if not found. */ export function validateCommand(command: string): void { if (!command || !command.trim()) { @@ -104,6 +148,7 @@ export function spawnAgent( isShell?: boolean; dockerMode?: boolean; dockerImage?: string; + shareDockerAgentAuth?: boolean; onOutput: { __CHANNEL_ID__: string }; }, ): void { @@ -220,7 +265,7 @@ export function spawnAgent( '-e', `HOME=${DOCKER_CONTAINER_HOME}`, // Mount SSH and git config read-only for git operations - ...buildDockerCredentialMounts(), + ...buildDockerCredentialMounts(args.command, args.shareDockerAgentAuth === true), image, command, ...args.args, @@ -230,6 +275,14 @@ export function spawnAgent( spawnArgs = args.args; } + logDebug('pty', `spawn command ${args.agentId}`, { + taskId: args.taskId, + command: spawnCommand, + args: redactedSpawnArgs(spawnCommand, spawnArgs), + cwd, + dockerMode: args.dockerMode === true, + }); + const proc = pty.spawn(spawnCommand, spawnArgs, { name: 'xterm-256color', cols: args.cols, @@ -564,7 +617,16 @@ function buildDockerEnvFlags(env: Record): string[] { return flags; } -function buildDockerCredentialMounts(): string[] { +// Config directories each agent CLI uses for auth/settings, relative to HOME. +const AGENT_CONFIG_DIRS: Record = { + claude: ['.claude'], + codex: ['.codex'], + gemini: ['.gemini'], + opencode: ['.config/opencode'], + copilot: ['.config/github-copilot'], +}; + +function buildDockerCredentialMounts(agentCommand: string, shareAgentAuth: boolean): string[] { const mounts: string[] = []; const home = process.env.HOME; if (!home) return mounts; @@ -601,6 +663,20 @@ function buildDockerCredentialMounts(): string[] { mountIfExists(googleCredsFile, googleCredsFile); } + // When "Share agent auth across Linux containers" is enabled, bind-mount a + // host directory (created here, owned by the current user) into the agent's + // config location inside the container. Using a host directory avoids the + // root-ownership problem of Docker named volumes: the directory is created + // by this process (running as the user), so the containerised agent can + // write credentials on first login and read them on subsequent runs. + if (shareAgentAuth) { + for (const relDir of AGENT_CONFIG_DIRS[agentCommand] ?? []) { + const hostDir = path.join(home, '.parallel-code', 'agent-auth', agentCommand); + fs.mkdirSync(hostDir, { recursive: true }); + mounts.push('-v', `${hostDir}:${DOCKER_CONTAINER_HOME}/${relDir}`); + } + } + return mounts; } diff --git a/electron/ipc/register.ts b/electron/ipc/register.ts index 1df97739..0c74c76f 100644 --- a/electron/ipc/register.ts +++ b/electron/ipc/register.ts @@ -1,5 +1,6 @@ import { ipcMain, dialog, shell, app, clipboard, BrowserWindow, Notification } from 'electron'; import fs from 'fs'; +import net from 'net'; import os from 'os'; import { fileURLToPath } from 'url'; import { IPC } from './channels.js'; @@ -28,7 +29,8 @@ import { import { startStepsWatcher, stopStepsWatcher, readStepsForWorktree } from './steps.js'; import { initPrChecks, startPrChecksWatcher, stopPrChecksWatcher, isPrUrl } from './pr-checks.js'; import { readCoverageSummary } from './coverage.js'; -import { startRemoteServer } from '../remote/server.js'; +import { startRemoteServer, getMCPLogs } from '../remote/server.js'; +import { Orchestrator } from '../mcp/orchestrator.js'; import { getGitIgnoredDirs, getMainBranch, @@ -76,6 +78,28 @@ import { } from './validate.js'; import { warn as logWarn } from '../log.js'; +function findFreePort(start: number, end: number): Promise { + return new Promise((resolve, reject) => { + let port = start; + const tryNext = () => { + if (port > end) { + reject(new Error(`No free port found in range ${start}–${end}`)); + return; + } + const s = net.createServer(); + s.listen(port, '127.0.0.1', () => { + const found = port; + s.close(() => resolve(found)); + }); + s.on('error', () => { + port++; + tryNext(); + }); + }; + tryNext(); + }); +} + function errMessage(err: unknown): string { if (err instanceof Error) return err.message; if (typeof err === 'string') return err; @@ -166,6 +190,10 @@ export function registerAllHandlers(win: BrowserWindow): void { let remoteServer: ReturnType | null = null; const taskNames = new Map(); + // --- MCP orchestrator --- + const orchestrator = new Orchestrator(); + orchestrator.setWindow(win); + // --- PTY commands --- ipcMain.handle(IPC.SpawnAgent, (_e, args) => { assertString(args.command, 'command'); @@ -176,6 +204,7 @@ export function registerAllHandlers(win: BrowserWindow): void { assertInt(args.rows, 'rows'); assertOptionalBoolean(args.dockerMode, 'dockerMode'); assertOptionalString(args.dockerImage, 'dockerImage'); + assertOptionalBoolean(args.shareDockerAgentAuth, 'shareDockerAgentAuth'); assertOptionalBoolean(args.stepsEnabled, 'stepsEnabled'); if (args.cwd) validatePath(args.cwd, 'cwd'); if (!args.isShell && args.cwd) { @@ -820,6 +849,7 @@ export function registerAllHandlers(win: BrowserWindow): void { lastLine: '', }; }, + orchestrator, }); return { url: remoteServer.url, @@ -850,6 +880,148 @@ export function registerAllHandlers(win: BrowserWindow): void { }; }); + // --- MCP server management --- + ipcMain.handle( + IPC.StartMCPServer, + async ( + _e, + args: { + coordinatorTaskId: string; + projectId: string; + projectRoot: string; + worktreePath?: string; + }, + ) => { + // Set orchestrator's default project + coordinator task ID + orchestrator.setDefaultProject(args.projectId, args.projectRoot, args.coordinatorTaskId); + + // Start remote server if not running + if (!remoteServer) { + const thisDir = path.dirname(fileURLToPath(import.meta.url)); + const distRemote = path.join(thisDir, '..', '..', 'dist-remote'); + const port = await findFreePort(7777, 7800); + remoteServer = startRemoteServer({ + port, + staticDir: distRemote, + getTaskName: (taskId: string) => taskNames.get(taskId) ?? taskId, + getAgentStatus: (agentId: string) => { + const meta = getAgentMeta(agentId); + return { + status: meta ? ('running' as const) : ('exited' as const), + exitCode: null, + lastLine: '', + }; + }, + orchestrator, + }); + } + + // Write temp MCP config file — use the bundled single-file MCP server + // (built by esbuild, no external deps needed at runtime) + const thisDir = path.dirname(fileURLToPath(import.meta.url)); + let mcpServerPath = path.join(thisDir, '..', 'mcp-server.cjs'); + + // In packaged builds, asar-unpacked files live in app.asar.unpacked/ + if (mcpServerPath.includes('/app.asar/')) { + mcpServerPath = mcpServerPath.replace('/app.asar/', '/app.asar.unpacked/'); + } + const serverUrl = `http://127.0.0.1:${remoteServer.port}`; + + const mcpConfig = { + mcpServers: { + 'parallel-code': { + type: 'stdio' as const, + command: 'node', + args: [mcpServerPath, '--url', serverUrl, '--token', remoteServer.token], + }, + }, + }; + + const configJson = JSON.stringify(mcpConfig, null, 2); + + // Write temp config for --mcp-config flag + const configPath = path.join( + app.getPath('temp'), + `parallel-code-mcp-${args.coordinatorTaskId}.json`, + ); + fs.writeFileSync(configPath, configJson); + + // Also write .mcp.json into the worktree so Claude Code auto-discovers it. + // Immediately git-exclude it so the token never gets committed. + if (args.worktreePath) { + const worktreeMcpPath = path.join(args.worktreePath, '.mcp.json'); + fs.writeFileSync(worktreeMcpPath, configJson); + + // Append to .git/info/exclude (local-only gitignore, not committed) + try { + const gitDir = path.join(args.worktreePath, '.git'); + // Worktrees use a .git file pointing to the real gitdir + let infoDir: string; + if (fs.statSync(gitDir).isFile()) { + const gitFileContent = fs.readFileSync(gitDir, 'utf-8').trim(); + const realGitDir = gitFileContent.replace(/^gitdir:\s*/, ''); + infoDir = path.join( + path.isAbsolute(realGitDir) + ? realGitDir + : path.resolve(args.worktreePath, realGitDir), + 'info', + ); + } else { + infoDir = path.join(gitDir, 'info'); + } + fs.mkdirSync(infoDir, { recursive: true }); + const excludePath = path.join(infoDir, 'exclude'); + const existing = fs.existsSync(excludePath) ? fs.readFileSync(excludePath, 'utf-8') : ''; + if (!existing.includes('.mcp.json')) { + fs.appendFileSync( + excludePath, + '\n# Parallel Code MCP config (contains ephemeral token)\n.mcp.json\n', + ); + } + } catch (err) { + console.warn('[MCP] Could not git-exclude .mcp.json:', err); + } + + console.warn('[MCP] Worktree .mcp.json written to:', worktreeMcpPath); + } + + console.warn('[MCP] Config written to:', configPath); + console.warn('[MCP] Server path:', mcpServerPath); + console.warn('[MCP] Remote URL:', serverUrl); + + return { + configPath, + serverUrl, + token: remoteServer.token, + port: remoteServer.port, + }; + }, + ); + + ipcMain.handle( + IPC.MCP_ControlChanged, + (_e, args: { taskId: string; controlledBy: 'orchestrator' | 'human' }) => { + orchestrator.setTaskControl(args.taskId, args.controlledBy); + }, + ); + + ipcMain.handle(IPC.StopMCPServer, async () => { + // The MCP server process is spawned by Claude Code (via --mcp-config), + // not by us. This handler is a no-op but kept for API completeness. + }); + + ipcMain.handle(IPC.GetMCPStatus, () => { + // The MCP server process is spawned by Claude Code (via --mcp-config), + // not by us. We report whether the remote HTTP server that the MCP + // server connects to is running — if it's up, MCP tools should work. + return { + mcpRunning: remoteServer !== null, + remoteRunning: remoteServer !== null, + }; + }); + + ipcMain.handle(IPC.GetMCPLogs, () => getMCPLogs()); + // --- Forward window events to renderer --- win.on('focus', () => { if (!win.isDestroyed()) win.webContents.send(IPC.WindowFocus); diff --git a/electron/mcp/client.ts b/electron/mcp/client.ts new file mode 100644 index 00000000..9ee77f24 --- /dev/null +++ b/electron/mcp/client.ts @@ -0,0 +1,88 @@ +// HTTP client wrapper for calling the remote server API. +// Used by the MCP server to delegate tool calls to the Electron app. + +import type { ApiTaskSummary, ApiTaskDetail, ApiDiffResult, ApiMergeResult } from './types.js'; + +export class MCPClient { + constructor( + private baseUrl: string, + private token: string, + ) {} + + private async request(method: string, path: string, body?: unknown): Promise { + const url = `${this.baseUrl}${path}`; + const headers: Record = { + Authorization: `Bearer ${this.token}`, + 'Content-Type': 'application/json', + }; + + const res = await fetch(url, { + method, + headers, + body: body !== undefined ? JSON.stringify(body) : undefined, + }); + + if (!res.ok) { + const text = await res.text().catch(() => ''); + throw new Error(`API ${method} ${path} failed (${res.status}): ${text}`); + } + + return (await res.json()) as T; + } + + async createTask(opts: { + name: string; + prompt?: string; + projectId?: string; + }): Promise { + return this.request('POST', '/api/tasks', opts); + } + + async listTasks(): Promise { + return this.request('GET', '/api/tasks'); + } + + async getTaskStatus(taskId: string): Promise { + return this.request('GET', `/api/tasks/${encodeURIComponent(taskId)}`); + } + + async sendPrompt(taskId: string, prompt: string): Promise { + await this.request('POST', `/api/tasks/${encodeURIComponent(taskId)}/prompt`, { + prompt, + }); + } + + async waitForIdle(taskId: string, timeoutMs?: number): Promise<{ status: string }> { + return this.request<{ status: string }>( + 'POST', + `/api/tasks/${encodeURIComponent(taskId)}/wait`, + { timeoutMs }, + ); + } + + async getTaskDiff(taskId: string): Promise { + return this.request('GET', `/api/tasks/${encodeURIComponent(taskId)}/diff`); + } + + async getTaskOutput(taskId: string): Promise<{ output: string }> { + return this.request<{ output: string }>( + 'GET', + `/api/tasks/${encodeURIComponent(taskId)}/output`, + ); + } + + async mergeTask( + taskId: string, + opts?: { squash?: boolean; message?: string; cleanup?: boolean }, + ): Promise { + return this.request( + 'POST', + `/api/tasks/${encodeURIComponent(taskId)}/merge`, + opts ?? {}, + ); + } + + async closeTask(taskId: string): Promise { + await this.request('DELETE', `/api/tasks/${encodeURIComponent(taskId)}`); + } +} diff --git a/electron/mcp/orchestrator.ts b/electron/mcp/orchestrator.ts new file mode 100644 index 00000000..87637242 --- /dev/null +++ b/electron/mcp/orchestrator.ts @@ -0,0 +1,401 @@ +// Main-process task orchestration for coordinating agents. +// Manages task lifecycle independently of the SolidJS renderer, +// using existing backend primitives (pty, git, tasks). + +import { randomUUID } from 'crypto'; +import type { BrowserWindow } from 'electron'; +import { createTask as createBackendTask, deleteTask } from '../ipc/tasks.js'; +import { + spawnAgent, + writeToAgent, + killAgent, + subscribeToAgent, + unsubscribeFromAgent, + getAgentScrollback, + onPtyEvent, +} from '../ipc/pty.js'; +import { getChangedFiles, getAllFileDiffs, mergeTask as gitMergeTask } from '../ipc/git.js'; +import { stripAnsi, chunkContainsAgentPrompt } from './prompt-detect.js'; +import type { OrchestratedTask, ApiTaskSummary, ApiTaskDetail, ApiDiffResult } from './types.js'; +import { IPC } from '../ipc/channels.js'; + +const DEFAULT_WAIT_TIMEOUT_MS = 300_000; // 5 minutes +const PROMPT_WRITE_DELAY_MS = 50; + +export class Orchestrator { + private tasks = new Map(); + private tailBuffers = new Map(); + private idleResolvers = new Map void>>(); + private subscribers = new Map void>(); + private decoders = new Map(); + private controlMap = new Map(); + private win: BrowserWindow | null = null; + private projectRoot: string | null = null; + private projectId: string | null = null; + private defaultCoordinatorTaskId: string | null = null; + constructor() { + // Listen for PTY exits to update task status when agents are killed externally + // (e.g., user closes a child task from the UI). + // No cleanup needed — orchestrator lives for the entire app lifetime. + onPtyEvent('exit', (agentId, data) => { + for (const task of this.tasks.values()) { + if (task.agentId === agentId) { + const { exitCode } = (data ?? {}) as { exitCode?: number }; + task.status = 'exited'; + task.exitCode = exitCode ?? null; + // Resolve any idle waiters so they don't hang + const resolvers = this.idleResolvers.get(task.id); + if (resolvers?.length) { + for (const resolve of resolvers) resolve(); + this.idleResolvers.delete(task.id); + } + break; + } + } + }); + } + + setTaskControl(taskId: string, who: 'orchestrator' | 'human'): void { + this.controlMap.set(taskId, who); + // If returning to orchestrator and there are idle resolvers queued, fire them + if (who === 'orchestrator') { + const resolvers = this.idleResolvers.get(taskId); + if (resolvers?.length) { + for (const resolve of resolvers) resolve(); + this.idleResolvers.delete(taskId); + } + } + } + + setWindow(win: BrowserWindow): void { + this.win = win; + } + + setDefaultProject(projectId: string, projectRoot: string, coordinatorTaskId?: string): void { + this.projectId = projectId; + this.projectRoot = projectRoot; + if (coordinatorTaskId) this.defaultCoordinatorTaskId = coordinatorTaskId; + } + + async createTask(opts: { + name: string; + prompt?: string; + coordinatorTaskId: string; + projectId?: string; + projectRoot?: string; + agentCommand?: string; + agentArgs?: string[]; + }): Promise { + const root = opts.projectRoot ?? this.projectRoot; + const projId = opts.projectId ?? this.projectId; + if (!root || !projId) throw new Error('No project configured for orchestrator'); + + // Create worktree + branch via existing backend + const result = await createBackendTask(opts.name, root, ['.claude', 'node_modules'], 'task'); + + const coordinatorId = + opts.coordinatorTaskId !== 'api' + ? opts.coordinatorTaskId + : (this.defaultCoordinatorTaskId ?? opts.coordinatorTaskId); + + const agentId = randomUUID(); + const task: OrchestratedTask = { + id: result.id, + name: opts.name, + projectId: projId, + branchName: result.branch_name, + worktreePath: result.worktree_path, + agentId, + coordinatorTaskId: coordinatorId, + status: 'creating', + exitCode: null, + }; + + this.tasks.set(task.id, task); + this.tailBuffers.set(agentId, ''); + + // Subscribe to PTY output for prompt detection + const decoder = new TextDecoder(); + this.decoders.set(agentId, decoder); + + const outputCb = (encoded: string) => { + const bytes = Buffer.from(encoded, 'base64'); + const text = (this.decoders.get(agentId) ?? new TextDecoder()).decode(bytes, { + stream: true, + }); + const prev = this.tailBuffers.get(agentId) ?? ''; + const combined = prev + text; + this.tailBuffers.set( + agentId, + combined.length > 4096 ? combined.slice(combined.length - 4096) : combined, + ); + + // Check for agent prompt + const stripped = stripAnsi(combined) + // eslint-disable-next-line no-control-regex + .replace(/[\x00-\x1f\x7f]/g, ' ') + .replace(/\s+/g, ' ') + .trim(); + if (chunkContainsAgentPrompt(stripped)) { + if (task.status === 'running') { + task.status = 'idle'; + } + // Resolve any waiting promises + const resolvers = this.idleResolvers.get(task.id); + if (resolvers?.length) { + for (const resolve of resolvers) resolve(); + this.idleResolvers.delete(task.id); + } + } else if (task.status === 'idle') { + task.status = 'running'; + } + }; + this.subscribers.set(agentId, outputCb); + + // Spawn the agent process + if (!this.win) throw new Error('No window set on orchestrator'); + + const command = opts.agentCommand ?? 'claude'; + const args = opts.agentArgs ?? []; + const channelId = randomUUID(); + + spawnAgent(this.win, { + taskId: task.id, + agentId, + command, + args, + cwd: result.worktree_path, + env: {}, + cols: 120, + rows: 40, + onOutput: { __CHANNEL_ID__: channelId }, + }); + + // Subscribe for output monitoring + subscribeToAgent(agentId, outputCb); + task.status = 'running'; + + // Check scrollback in case the prompt was emitted before we subscribed + const scrollback = getAgentScrollback(agentId); + if (scrollback) { + const decoded = Buffer.from(scrollback, 'base64').toString('utf8'); + const stripped = stripAnsi(decoded) + // eslint-disable-next-line no-control-regex + .replace(/[\x00-\x1f\x7f]/g, ' ') + .replace(/\s+/g, ' ') + .trim(); + if (chunkContainsAgentPrompt(stripped)) { + task.status = 'idle'; + } + } + + // Notify renderer with the prompt — the renderer sets it as initialPrompt + // on the task, and PromptInput auto-delivers it using the same code path + // as manually created tasks (stability checks, quiescence detection, etc.) + this.notifyRenderer(IPC.MCP_TaskCreated, { + taskId: task.id, + name: task.name, + projectId: task.projectId, + branchName: task.branchName, + worktreePath: task.worktreePath, + agentId: task.agentId, + coordinatorTaskId: task.coordinatorTaskId, + prompt: opts.prompt, + }); + + return task; + } + + listTasks(): ApiTaskSummary[] { + return Array.from(this.tasks.values()).map((t) => ({ + id: t.id, + name: t.name, + branchName: t.branchName, + status: t.status, + coordinatorTaskId: t.coordinatorTaskId, + })); + } + + getTaskStatus(taskId: string): ApiTaskDetail | null { + const task = this.tasks.get(taskId); + if (!task) return null; + return { + id: task.id, + name: task.name, + branchName: task.branchName, + worktreePath: task.worktreePath, + projectId: task.projectId, + agentId: task.agentId, + status: task.status, + coordinatorTaskId: task.coordinatorTaskId, + exitCode: task.exitCode, + pendingPrompt: task.pendingPrompt, + }; + } + + async sendPrompt(taskId: string, prompt: string): Promise { + const task = this.tasks.get(taskId); + if (!task) throw new Error(`Task not found: ${taskId}`); + if (this.controlMap.get(taskId) === 'human') { + throw new Error( + 'Task is under human control. Return control to orchestrator before sending prompts.', + ); + } + + // Send text then Enter separately (like the frontend does) + writeToAgent(task.agentId, prompt); + await new Promise((r) => setTimeout(r, PROMPT_WRITE_DELAY_MS)); + writeToAgent(task.agentId, '\r'); + task.status = 'running'; + task.pendingPrompt = undefined; + } + + waitForIdle(taskId: string, timeoutMs?: number): Promise { + return this.waitForIdleInternal(taskId, timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS); + } + + private waitForIdleInternal(taskId: string, timeoutMs: number): Promise { + const task = this.tasks.get(taskId); + if (!task) return Promise.reject(new Error(`Task not found: ${taskId}`)); + if (this.controlMap.get(taskId) === 'human') { + return Promise.resolve(); // resolve immediately — caller gets control-change event instead + } + if (task.status === 'idle' || task.status === 'exited') return Promise.resolve(); + + return new Promise((resolve, reject) => { + const timer = setTimeout(() => { + const resolvers = this.idleResolvers.get(taskId); + if (resolvers) { + const idx = resolvers.indexOf(resolve); + if (idx >= 0) resolvers.splice(idx, 1); + } + reject(new Error(`Timed out waiting for task ${taskId} to become idle`)); + }, timeoutMs); + + const wrappedResolve = () => { + clearTimeout(timer); + resolve(); + }; + + let resolvers = this.idleResolvers.get(taskId); + if (!resolvers) { + resolvers = []; + this.idleResolvers.set(taskId, resolvers); + } + resolvers.push(wrappedResolve); + }); + } + + async getTaskDiff(taskId: string): Promise { + const task = this.tasks.get(taskId); + if (!task) throw new Error(`Task not found: ${taskId}`); + + const [files, diff] = await Promise.all([ + getChangedFiles(task.worktreePath), + getAllFileDiffs(task.worktreePath), + ]); + + return { files, diff }; + } + + getTaskOutput(taskId: string): string { + const task = this.tasks.get(taskId); + if (!task) throw new Error(`Task not found: ${taskId}`); + + // Try scrollback buffer first, fall back to tail buffer + const scrollback = getAgentScrollback(task.agentId); + if (scrollback) { + const decoded = Buffer.from(scrollback, 'base64').toString('utf8'); + return stripAnsi(decoded); + } + return stripAnsi(this.tailBuffers.get(task.agentId) ?? ''); + } + + async mergeTask( + taskId: string, + opts?: { squash?: boolean; message?: string; cleanup?: boolean }, + ): Promise<{ mainBranch: string; linesAdded: number; linesRemoved: number }> { + const task = this.tasks.get(taskId); + if (!task) throw new Error(`Task not found: ${taskId}`); + + const root = this.projectRoot; + if (!root) throw new Error('No project root configured'); + + const result = await gitMergeTask( + root, + task.branchName, + opts?.squash ?? false, + opts?.message ?? null, + opts?.cleanup ?? false, + ); + + if (opts?.cleanup) { + await this.cleanupTask(taskId); + } + + return { + mainBranch: result.main_branch, + linesAdded: result.lines_added, + linesRemoved: result.lines_removed, + }; + } + + async closeTask(taskId: string): Promise { + const task = this.tasks.get(taskId); + if (!task) throw new Error(`Task not found: ${taskId}`); + await this.cleanupTask(taskId); + } + + private async cleanupTask(taskId: string): Promise { + const task = this.tasks.get(taskId); + if (!task) return; + + // Unsubscribe from PTY output + const cb = this.subscribers.get(task.agentId); + if (cb) { + unsubscribeFromAgent(task.agentId, cb); + this.subscribers.delete(task.agentId); + } + + // Kill the agent + try { + killAgent(task.agentId); + } catch { + /* already dead */ + } + + // Remove worktree + const root = this.projectRoot; + if (root) { + try { + await deleteTask({ + agentIds: [task.agentId], + branchName: task.branchName, + deleteBranch: true, + projectRoot: root, + }); + } catch (err) { + console.warn('Failed to delete orchestrated task worktree:', err); + } + } + + // Clean up internal state + this.tailBuffers.delete(task.agentId); + this.decoders.delete(task.agentId); + this.idleResolvers.delete(taskId); + this.tasks.delete(taskId); + + // Notify renderer + this.notifyRenderer(IPC.MCP_TaskClosed, { taskId }); + } + + getTask(taskId: string): OrchestratedTask | undefined { + return this.tasks.get(taskId); + } + + private notifyRenderer(channel: string, data: unknown): void { + if (this.win && !this.win.isDestroyed()) { + this.win.webContents.send(channel, data); + } + } +} diff --git a/electron/mcp/prompt-detect.ts b/electron/mcp/prompt-detect.ts new file mode 100644 index 00000000..87bf236b --- /dev/null +++ b/electron/mcp/prompt-detect.ts @@ -0,0 +1,44 @@ +// Shared prompt-detection helpers used by both the renderer (taskStatus.ts) +// and the main-process orchestrator (orchestrator.ts). + +/** Strip ANSI escape sequences (CSI, OSC, and single-char escapes) from terminal output. */ +export function stripAnsi(text: string): string { + return text.replace( + // eslint-disable-next-line no-control-regex + /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nq-uy=><~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?/g, + '', + ); +} + +/** + * Patterns that indicate the agent is waiting for user input (i.e. idle). + * Each regex is tested against the last non-empty line of stripped output. + */ +export const PROMPT_PATTERNS: RegExp[] = [ + /❯\s*$/, // Claude Code prompt + /(?:^|\s)\$\s*$/, // bash/zsh dollar prompt (preceded by whitespace or BOL) + /(?:^|\s)%\s*$/, // zsh percent prompt + /(?:^|\s)#\s*$/, // root prompt + /\[Y\/n\]\s*$/i, // Y/n confirmation + /\[y\/N\]\s*$/i, // y/N confirmation +]; + +/** + * Patterns for known agent main input prompts (ready for a new task). + * Tested against the stripped data chunk (not a single line), because TUI + * apps like Claude Code use cursor positioning instead of newlines. + */ +export const AGENT_READY_TAIL_PATTERNS: RegExp[] = [ + /❯/, // Claude Code + /›/, // Codex CLI +]; + +/** Check stripped output for known agent prompt characters. + * Only checks the tail of the chunk — the agent's main prompt renders as + * the last visible element, while TUI selection UIs place ❯ earlier in + * the render followed by option text and other choices. */ +export function chunkContainsAgentPrompt(stripped: string): boolean { + if (stripped.length === 0) return false; + const tail = stripped.slice(-50); + return AGENT_READY_TAIL_PATTERNS.some((re) => re.test(tail)); +} diff --git a/electron/mcp/server.ts b/electron/mcp/server.ts new file mode 100644 index 00000000..3695f83a --- /dev/null +++ b/electron/mcp/server.ts @@ -0,0 +1,264 @@ +#!/usr/bin/env node +// MCP server entry point — standalone Node.js script. +// Speaks MCP over stdio to Claude Code, delegates to the Electron app via HTTP. + +import { Server } from '@modelcontextprotocol/sdk/server/index.js'; +import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; +import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js'; +import { MCPClient } from './client.js'; + +// Parse CLI args +const args = process.argv.slice(2); +let url = ''; +let token = ''; + +for (let i = 0; i < args.length; i++) { + if (args[i] === '--url' && args[i + 1]) { + url = args[++i]; + } else if (args[i] === '--token' && args[i + 1]) { + token = args[++i]; + } +} + +if (!url || !token) { + console.error('Usage: node server.js --url --token '); + process.exit(1); +} + +const client = new MCPClient(url, token); + +const server = new Server( + { name: 'parallel-code', version: '1.0.0' }, + { capabilities: { tools: {} } }, +); + +// --- Tool definitions --- + +server.setRequestHandler(ListToolsRequestSchema, async () => ({ + tools: [ + { + name: 'create_task', + description: + 'Create a new task with its own git worktree and AI agent. The agent starts automatically and the prompt is delivered once the agent is ready.', + inputSchema: { + type: 'object' as const, + properties: { + name: { type: 'string', description: 'Task name (used for branch name)' }, + prompt: { + type: 'string', + description: 'Initial prompt to send to the agent once it finishes starting up.', + }, + projectId: { + type: 'string', + description: 'Project ID (uses default if not specified)', + }, + }, + required: ['name'], + }, + }, + { + name: 'list_tasks', + description: 'List all orchestrated tasks with their current status.', + inputSchema: { type: 'object' as const, properties: {} }, + }, + { + name: 'get_task_status', + description: 'Get detailed status of a specific task including git info and agent state.', + inputSchema: { + type: 'object' as const, + properties: { + taskId: { type: 'string', description: 'Task ID' }, + }, + required: ['taskId'], + }, + }, + { + name: 'send_prompt', + description: "Send a prompt/instruction to a task's AI agent.", + inputSchema: { + type: 'object' as const, + properties: { + taskId: { type: 'string', description: 'Task ID' }, + prompt: { type: 'string', description: 'Prompt text to send' }, + }, + required: ['taskId', 'prompt'], + }, + }, + { + name: 'wait_for_idle', + description: + "Wait until a task's agent becomes idle (sitting at its prompt). Returns when the agent is ready for the next instruction.", + inputSchema: { + type: 'object' as const, + properties: { + taskId: { type: 'string', description: 'Task ID' }, + timeoutMs: { + type: 'number', + description: 'Timeout in milliseconds (default: 300000 = 5 min)', + }, + }, + required: ['taskId'], + }, + }, + { + name: 'get_task_diff', + description: "Get the changed files and unified diff for a task's work.", + inputSchema: { + type: 'object' as const, + properties: { + taskId: { type: 'string', description: 'Task ID' }, + }, + required: ['taskId'], + }, + }, + { + name: 'get_task_output', + description: "Get recent terminal output from a task's agent (stripped of ANSI codes).", + inputSchema: { + type: 'object' as const, + properties: { + taskId: { type: 'string', description: 'Task ID' }, + }, + required: ['taskId'], + }, + }, + { + name: 'merge_task', + description: "Merge a task's branch into the main branch.", + inputSchema: { + type: 'object' as const, + properties: { + taskId: { type: 'string', description: 'Task ID' }, + squash: { type: 'boolean', description: 'Squash merge (default: false)' }, + message: { type: 'string', description: 'Custom merge commit message' }, + cleanup: { + type: 'boolean', + description: 'Clean up worktree and branch after merge (default: false)', + }, + }, + required: ['taskId'], + }, + }, + { + name: 'close_task', + description: 'Close and clean up a task — kills the agent, removes worktree and branch.', + inputSchema: { + type: 'object' as const, + properties: { + taskId: { type: 'string', description: 'Task ID' }, + }, + required: ['taskId'], + }, + }, + ], +})); + +// --- Tool execution --- + +server.setRequestHandler(CallToolRequestSchema, async (request) => { + const { name, arguments: params } = request.params; + + try { + switch (name) { + case 'create_task': { + const result = await client.createTask({ + name: (params as Record).name as string, + prompt: (params as Record).prompt as string | undefined, + projectId: (params as Record).projectId as string | undefined, + }); + return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; + } + + case 'list_tasks': { + const tasks = await client.listTasks(); + return { content: [{ type: 'text', text: JSON.stringify(tasks, null, 2) }] }; + } + + case 'get_task_status': { + const result = await client.getTaskStatus( + (params as Record).taskId as string, + ); + return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; + } + + case 'send_prompt': { + await client.sendPrompt( + (params as Record).taskId as string, + (params as Record).prompt as string, + ); + return { content: [{ type: 'text', text: 'Prompt sent successfully.' }] }; + } + + case 'wait_for_idle': { + const result = await client.waitForIdle( + (params as Record).taskId as string, + (params as Record).timeoutMs as number | undefined, + ); + return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; + } + + case 'get_task_diff': { + const result = await client.getTaskDiff( + (params as Record).taskId as string, + ); + // Return files summary + truncated diff + const summary = result.files + .map((f) => `${f.status} ${f.path} (+${f.lines_added} -${f.lines_removed})`) + .join('\n'); + const diffText = + result.diff.length > 50_000 + ? result.diff.slice(0, 50_000) + '\n... (diff truncated)' + : result.diff; + return { + content: [{ type: 'text', text: `Changed files:\n${summary}\n\n${diffText}` }], + }; + } + + case 'get_task_output': { + const result = await client.getTaskOutput( + (params as Record).taskId as string, + ); + return { content: [{ type: 'text', text: result.output }] }; + } + + case 'merge_task': { + const p = params as Record; + const result = await client.mergeTask(p.taskId as string, { + squash: p.squash as boolean | undefined, + message: p.message as string | undefined, + cleanup: p.cleanup as boolean | undefined, + }); + return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; + } + + case 'close_task': { + await client.closeTask((params as Record).taskId as string); + return { content: [{ type: 'text', text: 'Task closed successfully.' }] }; + } + + default: + return { + content: [{ type: 'text', text: `Unknown tool: ${name}` }], + isError: true, + }; + } + } catch (err) { + return { + content: [ + { type: 'text', text: `Error: ${err instanceof Error ? err.message : String(err)}` }, + ], + isError: true, + }; + } +}); + +// Start the server +async function main() { + const transport = new StdioServerTransport(); + await server.connect(transport); +} + +main().catch((err) => { + console.error('MCP server failed to start:', err); + process.exit(1); +}); diff --git a/electron/mcp/types.ts b/electron/mcp/types.ts new file mode 100644 index 00000000..a1ec8f66 --- /dev/null +++ b/electron/mcp/types.ts @@ -0,0 +1,92 @@ +// Shared types for the MCP coordinating-agent system. + +export interface OrchestratedTask { + id: string; + name: string; + projectId: string; + branchName: string; + worktreePath: string; + agentId: string; + coordinatorTaskId: string; + status: 'creating' | 'running' | 'idle' | 'exited' | 'error'; + exitCode: number | null; + pendingPrompt?: string; +} + +// --- MCP tool input schemas --- + +export interface CreateTaskInput { + name: string; + prompt?: string; + projectId?: string; +} + +export type ListTasksInput = Record; + +export interface GetTaskStatusInput { + taskId: string; +} + +export interface SendPromptInput { + taskId: string; + prompt: string; +} + +export interface WaitForIdleInput { + taskId: string; + timeoutMs?: number; +} + +export interface GetTaskDiffInput { + taskId: string; +} + +export interface GetTaskOutputInput { + taskId: string; +} + +export interface MergeTaskInput { + taskId: string; + squash?: boolean; + message?: string; + cleanup?: boolean; +} + +export interface CloseTaskInput { + taskId: string; +} + +// --- API request/response types --- + +export interface ApiTaskSummary { + id: string; + name: string; + branchName: string; + status: string; + coordinatorTaskId: string; +} + +export interface ApiTaskDetail extends ApiTaskSummary { + worktreePath: string; + projectId: string; + agentId: string; + exitCode: number | null; + pendingPrompt?: string; +} + +export interface ApiDiffResult { + files: Array<{ + path: string; + lines_added: number; + lines_removed: number; + status: string; + committed: boolean; + }>; + diff: string; +} + +export interface ApiMergeResult { + mainBranch: string; + linesAdded: number; + linesRemoved: number; +} diff --git a/electron/preload.cjs b/electron/preload.cjs index dfd905d6..268fd05a 100644 --- a/electron/preload.cjs +++ b/electron/preload.cjs @@ -118,6 +118,14 @@ const ALLOWED_CHANNELS = new Set([ 'pr_checks_update', // Logging 'log_from_renderer', + // MCP orchestration + 'start_mcp_server', + 'stop_mcp_server', + 'get_mcp_status', + 'get_mcp_logs', + 'mcp_task_created', + 'mcp_task_closed', + 'mcp_task_state_sync', ]); function isAllowedChannel(channel) { diff --git a/electron/remote/server.ts b/electron/remote/server.ts index f9c99fbd..72696c22 100644 --- a/electron/remote/server.ts +++ b/electron/remote/server.ts @@ -19,6 +19,28 @@ import { onPtyEvent, } from '../ipc/pty.js'; import { parseClientMessage, type ServerMessage, type RemoteAgent } from './protocol.js'; +import type { Orchestrator } from '../mcp/orchestrator.js'; + +// --- MCP log ring buffer --- +export interface MCPLogEntry { + ts: number; + level: 'info' | 'error'; + msg: string; +} + +const MAX_LOG_ENTRIES = 200; +const mcpLogs: MCPLogEntry[] = []; + +function mcpLog(level: 'info' | 'error', msg: string): void { + const entry: MCPLogEntry = { ts: Date.now(), level, msg }; + mcpLogs.push(entry); + if (mcpLogs.length > MAX_LOG_ENTRIES) mcpLogs.splice(0, mcpLogs.length - MAX_LOG_ENTRIES); + console.warn(`[MCP ${level}] ${msg}`); +} + +export function getMCPLogs(): MCPLogEntry[] { + return mcpLogs.slice(); +} const MIME: Record = { '.html': 'text/html', @@ -102,6 +124,7 @@ export function startRemoteServer(opts: { exitCode: number | null; lastLine: string; }; + orchestrator?: Orchestrator; }): RemoteServer { const token = randomBytes(24).toString('base64url'); const ips = getNetworkIps(); @@ -169,6 +192,190 @@ export function startRemoteServer(opts: { return; } + // --- Orchestrator task API routes --- + const orch = opts.orchestrator; + if (orch) { + // Helper to read JSON body + const readBody = (): Promise> => + new Promise((resolve, reject) => { + let data = ''; + req.on('data', (chunk: Buffer) => { + data += chunk.toString(); + if (data.length > 1_000_000) { + reject(new Error('Body too large')); + req.destroy(); + } + }); + req.on('end', () => { + try { + resolve(data ? (JSON.parse(data) as Record) : {}); + } catch { + resolve({}); + } + }); + req.on('error', reject); + }); + + const jsonReply = (status: number, body: unknown) => { + res.writeHead(status, { ...SECURITY_HEADERS, 'Content-Type': 'application/json' }); + res.end(JSON.stringify(body)); + }; + + const taskIdMatch = url.pathname.match(/^\/api\/tasks\/([^/]+)(?:\/(.+))?$/); + + if (url.pathname === '/api/tasks' && req.method === 'POST') { + readBody() + .then(async (body) => { + if (typeof body.name !== 'string' || !body.name) + return jsonReply(400, { error: 'name must be a non-empty string' }); + if (body.prompt !== undefined && typeof body.prompt !== 'string') + return jsonReply(400, { error: 'prompt must be a string' }); + if (body.projectId !== undefined && typeof body.projectId !== 'string') + return jsonReply(400, { error: 'projectId must be a string' }); + mcpLog('info', `create_task name=${body.name}`); + const result = await orch.createTask({ + name: body.name, + prompt: body.prompt as string | undefined, + coordinatorTaskId: + typeof body.coordinatorTaskId === 'string' ? body.coordinatorTaskId : 'api', + projectId: body.projectId as string | undefined, + }); + mcpLog('info', `create_task OK id=${result.id}`); + jsonReply(201, orch.getTaskStatus(result.id)); + }) + .catch((err) => { + mcpLog('error', `create_task FAIL: ${String(err)}`); + jsonReply(500, { error: String(err) }); + }); + return; + } + + if (url.pathname === '/api/tasks' && req.method === 'GET') { + mcpLog('info', 'list_tasks'); + jsonReply(200, orch.listTasks()); + return; + } + + if (taskIdMatch && !taskIdMatch[2] && req.method === 'GET') { + const taskId = decodeURIComponent(taskIdMatch[1]); + mcpLog('info', `get_task_status id=${taskId}`); + const detail = orch.getTaskStatus(taskId); + if (!detail) { + jsonReply(404, { error: 'task not found' }); + } else { + jsonReply(200, detail); + } + return; + } + + if (taskIdMatch && taskIdMatch[2] === 'prompt' && req.method === 'POST') { + readBody() + .then(async (body) => { + const taskId = decodeURIComponent(taskIdMatch[1]); + if (typeof body.prompt !== 'string' || !body.prompt) + return jsonReply(400, { error: 'prompt must be a non-empty string' }); + mcpLog('info', `send_prompt id=${taskId}`); + await orch.sendPrompt(taskId, body.prompt); + jsonReply(200, { ok: true }); + }) + .catch((err) => { + mcpLog('error', `send_prompt FAIL: ${String(err)}`); + jsonReply(500, { error: String(err) }); + }); + return; + } + + if (taskIdMatch && taskIdMatch[2] === 'wait' && req.method === 'POST') { + readBody() + .then(async (body) => { + const taskId = decodeURIComponent(taskIdMatch[1]); + if ( + body.timeoutMs !== undefined && + (typeof body.timeoutMs !== 'number' || !Number.isFinite(body.timeoutMs)) + ) + return jsonReply(400, { error: 'timeoutMs must be a finite number' }); + mcpLog('info', `wait_for_idle id=${taskId}`); + await orch.waitForIdle(taskId, body.timeoutMs as number | undefined); + const status = orch.getTaskStatus(taskId); + mcpLog('info', `wait_for_idle OK id=${taskId} status=${status?.status}`); + jsonReply(200, { status: status?.status ?? 'unknown' }); + }) + .catch((err) => { + mcpLog('error', `wait_for_idle FAIL: ${String(err)}`); + jsonReply(500, { error: String(err) }); + }); + return; + } + + if (taskIdMatch && taskIdMatch[2] === 'diff' && req.method === 'GET') { + const taskId = decodeURIComponent(taskIdMatch[1]); + mcpLog('info', `get_task_diff id=${taskId}`); + orch + .getTaskDiff(taskId) + .then((result) => jsonReply(200, result)) + .catch((err) => { + mcpLog('error', `get_task_diff FAIL: ${String(err)}`); + jsonReply(500, { error: String(err) }); + }); + return; + } + + if (taskIdMatch && taskIdMatch[2] === 'output' && req.method === 'GET') { + const taskId = decodeURIComponent(taskIdMatch[1]); + mcpLog('info', `get_task_output id=${taskId}`); + try { + const output = orch.getTaskOutput(taskId); + jsonReply(200, { output }); + } catch (err) { + mcpLog('error', `get_task_output FAIL: ${String(err)}`); + jsonReply(500, { error: String(err) }); + } + return; + } + + if (taskIdMatch && taskIdMatch[2] === 'merge' && req.method === 'POST') { + readBody() + .then(async (body) => { + const taskId = decodeURIComponent(taskIdMatch[1]); + if (body.squash !== undefined && typeof body.squash !== 'boolean') + return jsonReply(400, { error: 'squash must be a boolean' }); + if (body.message !== undefined && typeof body.message !== 'string') + return jsonReply(400, { error: 'message must be a string' }); + if (body.cleanup !== undefined && typeof body.cleanup !== 'boolean') + return jsonReply(400, { error: 'cleanup must be a boolean' }); + mcpLog('info', `merge_task id=${taskId} squash=${body.squash ?? false}`); + const result = await orch.mergeTask(taskId, { + squash: body.squash as boolean | undefined, + message: body.message as string | undefined, + cleanup: body.cleanup as boolean | undefined, + }); + mcpLog('info', `merge_task OK id=${taskId}`); + jsonReply(200, result); + }) + .catch((err) => { + mcpLog('error', `merge_task FAIL: ${String(err)}`); + jsonReply(500, { error: String(err) }); + }); + return; + } + + if (taskIdMatch && !taskIdMatch[2] && req.method === 'DELETE') { + const taskId = decodeURIComponent(taskIdMatch[1]); + mcpLog('info', `close_task id=${taskId}`); + orch + .closeTask(taskId) + .then(() => { + mcpLog('info', `close_task OK id=${taskId}`); + jsonReply(200, { ok: true }); + }) + .catch((err) => { + mcpLog('error', `close_task FAIL: ${String(err)}`); + jsonReply(500, { error: String(err) }); + }); + return; + } + } + res.writeHead(404, { ...SECURITY_HEADERS, 'Content-Type': 'application/json' }); res.end(JSON.stringify({ error: 'not found' })); return; diff --git a/package-lock.json b/package-lock.json index f71e5f3b..43b32c15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,8 +7,10 @@ "": { "name": "parallel-code", "version": "1.8.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { + "@modelcontextprotocol/sdk": "^1.27.1", "@xterm/addon-fit": "^0.12.0-beta.195", "@xterm/addon-web-links": "^0.13.0-beta.195", "@xterm/addon-webgl": "^0.20.0-beta.194", @@ -34,6 +36,7 @@ "concurrently": "^9.2.1", "electron": "^40.8.5", "electron-builder": "^26.8.1", + "esbuild": "^0.27.4", "eslint": "^9.39.3", "eslint-config-prettier": "^10.1.8", "eslint-plugin-solid": "^0.14.5", @@ -848,9 +851,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", - "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.4.tgz", + "integrity": "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==", "cpu": [ "ppc64" ], @@ -865,9 +868,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", - "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.4.tgz", + "integrity": "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==", "cpu": [ "arm" ], @@ -882,9 +885,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", - "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.4.tgz", + "integrity": "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==", "cpu": [ "arm64" ], @@ -899,9 +902,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", - "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.4.tgz", + "integrity": "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==", "cpu": [ "x64" ], @@ -916,9 +919,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", - "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.4.tgz", + "integrity": "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==", "cpu": [ "arm64" ], @@ -933,9 +936,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", - "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.4.tgz", + "integrity": "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==", "cpu": [ "x64" ], @@ -950,9 +953,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", - "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.4.tgz", + "integrity": "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==", "cpu": [ "arm64" ], @@ -967,9 +970,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", - "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.4.tgz", + "integrity": "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==", "cpu": [ "x64" ], @@ -984,9 +987,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", - "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.4.tgz", + "integrity": "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==", "cpu": [ "arm" ], @@ -1001,9 +1004,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", - "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.4.tgz", + "integrity": "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==", "cpu": [ "arm64" ], @@ -1018,9 +1021,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", - "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.4.tgz", + "integrity": "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==", "cpu": [ "ia32" ], @@ -1035,9 +1038,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", - "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.4.tgz", + "integrity": "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==", "cpu": [ "loong64" ], @@ -1052,9 +1055,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", - "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.4.tgz", + "integrity": "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==", "cpu": [ "mips64el" ], @@ -1069,9 +1072,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", - "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.4.tgz", + "integrity": "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==", "cpu": [ "ppc64" ], @@ -1086,9 +1089,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", - "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.4.tgz", + "integrity": "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==", "cpu": [ "riscv64" ], @@ -1103,9 +1106,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", - "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.4.tgz", + "integrity": "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==", "cpu": [ "s390x" ], @@ -1120,9 +1123,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", - "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.4.tgz", + "integrity": "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==", "cpu": [ "x64" ], @@ -1137,9 +1140,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", - "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.4.tgz", + "integrity": "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==", "cpu": [ "arm64" ], @@ -1154,9 +1157,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", - "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.4.tgz", + "integrity": "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==", "cpu": [ "x64" ], @@ -1171,9 +1174,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", - "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.4.tgz", + "integrity": "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==", "cpu": [ "arm64" ], @@ -1188,9 +1191,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", - "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.4.tgz", + "integrity": "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==", "cpu": [ "x64" ], @@ -1205,9 +1208,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", - "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.4.tgz", + "integrity": "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==", "cpu": [ "arm64" ], @@ -1222,9 +1225,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", - "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.4.tgz", + "integrity": "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==", "cpu": [ "x64" ], @@ -1239,9 +1242,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", - "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.4.tgz", + "integrity": "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==", "cpu": [ "arm64" ], @@ -1256,9 +1259,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", - "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.4.tgz", + "integrity": "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==", "cpu": [ "ia32" ], @@ -1273,9 +1276,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", - "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.4.tgz", + "integrity": "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==", "cpu": [ "x64" ], @@ -1549,6 +1552,18 @@ "@hapi/hoek": "^11.0.2" } }, + "node_modules/@hono/node-server": { + "version": "1.19.11", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.11.tgz", + "integrity": "sha512-dr8/3zEaB+p0D2n/IUrlPF1HZm586qgJNXK1a9fhg/PzdtkK7Ksd5l312tJX2yBuALqDYBlG20QEbayqPyxn+g==", + "license": "MIT", + "engines": { + "node": ">=18.14.1" + }, + "peerDependencies": { + "hono": "^4" + } + }, "node_modules/@humanfs/core": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", @@ -1608,14 +1623,14 @@ "license": "MIT" }, "node_modules/@iconify/utils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-3.1.0.tgz", - "integrity": "sha512-Zlzem1ZXhI1iHeeERabLNzBHdOa4VhQbqAcOQaMKuTuyZCpwKbC2R4Dd0Zo3g9EAc+Y4fiarO8HIHRAth7+skw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-3.1.1.tgz", + "integrity": "sha512-MwzoDtw9rO1x+qfgLTV/IVXsHDBqeYZoMIQC8SfxfYSlaSUG+oWiAcoiB1yajAda6mqblm4/1/w2E8tRu7a7Tw==", "license": "MIT", "dependencies": { "@antfu/install-pkg": "^1.1.0", "@iconify/types": "^2.0.0", - "mlly": "^1.8.0" + "mlly": "^1.8.2" } }, "node_modules/@isaacs/cliui": { @@ -1863,14 +1878,76 @@ } }, "node_modules/@mermaid-js/parser": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@mermaid-js/parser/-/parser-1.0.1.tgz", - "integrity": "sha512-opmV19kN1JsK0T6HhhokHpcVkqKpF+x2pPDKKM2ThHtZAB5F4PROopk0amuVYK5qMrIA4erzpNm8gmPNJgMDxQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@mermaid-js/parser/-/parser-1.1.0.tgz", + "integrity": "sha512-gxK9ZX2+Fex5zu8LhRQoMeMPEHbc73UKZ0FQ54YrQtUxE1VVhMwzeNtKRPAu5aXks4FasbMe4xB4bWrmq6Jlxw==", "license": "MIT", "dependencies": { "langium": "^4.0.0" } }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.27.1.tgz", + "integrity": "sha512-sr6GbP+4edBwFndLbM60gf07z0FQ79gaExpnsjMGePXqFcSSb7t6iscpjk9DhFhwd+mTEQrzNafGP8/iGGFYaA==", + "license": "MIT", + "dependencies": { + "@hono/node-server": "^1.19.9", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.2.1", + "express-rate-limit": "^8.2.1", + "hono": "^4.11.4", + "jose": "^6.1.3", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/ajv": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", + "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, "node_modules/@npmcli/agent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-3.0.0.tgz", @@ -3357,9 +3434,9 @@ } }, "node_modules/@xmldom/xmldom": { - "version": "0.8.13", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.13.tgz", - "integrity": "sha512-KRYzxepc14G/CEpEGc3Yn+JKaAeT63smlDr+vjB8jRfgTBBI9wRj/nkQEO+ucV8p8I9bfKLWp37uHgFrbntPvw==", + "version": "0.8.11", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.11.tgz", + "integrity": "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw==", "dev": true, "license": "MIT", "engines": { @@ -3367,36 +3444,36 @@ } }, "node_modules/@xterm/addon-fit": { - "version": "0.12.0-beta.195", - "resolved": "https://registry.npmjs.org/@xterm/addon-fit/-/addon-fit-0.12.0-beta.195.tgz", - "integrity": "sha512-Ihc+azRK3HFB2NVBEoWRkEUGYVxoojK2X4Jx6YxiRKdAu6bYzDTzTImE/0EDOjjz2AUUqddRwCUdSbz2/WvYfA==", + "version": "0.12.0-beta.216", + "resolved": "https://registry.npmjs.org/@xterm/addon-fit/-/addon-fit-0.12.0-beta.216.tgz", + "integrity": "sha512-IgKE3ngNodSnmj1O+EEYpKQZkSbAUbghPlCWd8G32RL0piIMqb3FX3BuYLnWZeLNoD9iMtublLMG1T9XjGeVvA==", "license": "MIT", "peerDependencies": { - "@xterm/xterm": "^6.1.0-beta.195" + "@xterm/xterm": "^6.1.0-beta.216" } }, "node_modules/@xterm/addon-web-links": { - "version": "0.13.0-beta.195", - "resolved": "https://registry.npmjs.org/@xterm/addon-web-links/-/addon-web-links-0.13.0-beta.195.tgz", - "integrity": "sha512-3x1jjud/TAVCSd3Jn7E9ielvPUwHAqvtqL1AKeH9sD5RKUuNr+Z4B+vhkvR0XF2BAk9af6ErgyygdAMnOL2Rwg==", + "version": "0.13.0-beta.216", + "resolved": "https://registry.npmjs.org/@xterm/addon-web-links/-/addon-web-links-0.13.0-beta.216.tgz", + "integrity": "sha512-ZP3BDy1na/37TZHO8FB+XHJFoO8muyPoOzkaL2X28n5A9ZFQPbf834EMRsvDczKnfQvtZcve+ZCmMJj1ZHGjow==", "license": "MIT", "peerDependencies": { - "@xterm/xterm": "^6.1.0-beta.195" + "@xterm/xterm": "^6.1.0-beta.216" } }, "node_modules/@xterm/addon-webgl": { - "version": "0.20.0-beta.194", - "resolved": "https://registry.npmjs.org/@xterm/addon-webgl/-/addon-webgl-0.20.0-beta.194.tgz", - "integrity": "sha512-aX4yGkHyoJVmxh3ZVMha7CYdTFu7tuzTJ0ljyXKAVFrdO+Wve4luK8w3wLmxuvqa9LWA9muMx/bGeEWtwD/Nlg==", + "version": "0.20.0-beta.215", + "resolved": "https://registry.npmjs.org/@xterm/addon-webgl/-/addon-webgl-0.20.0-beta.215.tgz", + "integrity": "sha512-oCbH3YxiGOzRcKxwTfSRCA1TqpoT/AitO2X5MuqD14DVnb4Z3rTKQYfHBA7R6HA7U4K9OzmtIsi5+VyEIEaWsg==", "license": "MIT", "peerDependencies": { - "@xterm/xterm": "^6.1.0-beta.195" + "@xterm/xterm": "^6.1.0-beta.216" } }, "node_modules/@xterm/xterm": { - "version": "6.1.0-beta.195", - "resolved": "https://registry.npmjs.org/@xterm/xterm/-/xterm-6.1.0-beta.195.tgz", - "integrity": "sha512-lLVfI3T4pX4W4qrbf2Qhdq5Pa00FkOOUz9vlOm6f1r5wel1mUafeJL8zacfsUVdc03MsCKHRyZkLubmDEnabcw==", + "version": "6.1.0-beta.216", + "resolved": "https://registry.npmjs.org/@xterm/xterm/-/xterm-6.1.0-beta.216.tgz", + "integrity": "sha512-87rfymzVje5eYUlGG94hz1WkOYvFRcFDGdiOAbg4d8xt8OGSGR2nMNU4I1n5MDE1RBPBqRd+WVJ5w7q3pwMoZA==", "license": "MIT", "workspaces": [ "addons/*" @@ -3419,6 +3496,44 @@ "node": "^18.17.0 || >=20.5.0" } }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/accepts/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/accepts/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/acorn": { "version": "8.16.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", @@ -3468,6 +3583,45 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", + "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, "node_modules/ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", @@ -3784,15 +3938,15 @@ } }, "node_modules/axios": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.15.0.tgz", - "integrity": "sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q==", + "version": "1.13.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.5.tgz", + "integrity": "sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==", "dev": true, "license": "MIT", "dependencies": { "follow-redirects": "^1.15.11", "form-data": "^4.0.5", - "proxy-from-env": "^2.1.0" + "proxy-from-env": "^1.1.0" } }, "node_modules/babel-plugin-jsx-dom-expressions": { @@ -3900,6 +4054,46 @@ "readable-stream": "^3.4.0" } }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/body-parser/node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/boolean": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", @@ -4088,6 +4282,15 @@ "node": ">= 10.0.0" } }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/cacache": { "version": "19.0.1", "resolved": "https://registry.npmjs.org/cacache/-/cacache-19.0.1.tgz", @@ -4207,7 +4410,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0", @@ -4217,6 +4419,22 @@ "node": ">= 0.4" } }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -4344,12 +4562,12 @@ } }, "node_modules/chevrotain-allstar": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.4.1.tgz", - "integrity": "sha512-PvVJm3oGqrveUVW2Vt/eZGeiAIsJszYweUcYwcskg9e+IubNYKKD+rHHem7A6XVO22eDAL+inxNIGAzZ/VIWlA==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.4.3.tgz", + "integrity": "sha512-2X4mkroolSMKqW+H22pyPMUVDqYZzPhephTmg/NODKb1IGYPHfxfhcW0EjS7wcPJNbze2i4vBWT7zT5FKF2lrQ==", "license": "MIT", "dependencies": { - "lodash-es": "^4.17.21" + "lodash-es": "^4.18.1" }, "peerDependencies": { "chevrotain": "^12.0.0" @@ -4576,6 +4794,28 @@ "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", "license": "MIT" }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -4583,6 +4823,24 @@ "dev": true, "license": "MIT" }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -4591,6 +4849,23 @@ "license": "MIT", "optional": true }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/cose-base": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/cose-base/-/cose-base-1.0.3.tgz", @@ -4624,7 +4899,6 @@ "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -4639,14 +4913,12 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, "license": "ISC" }, "node_modules/cross-spawn/node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -4665,9 +4937,9 @@ "license": "MIT" }, "node_modules/cytoscape": { - "version": "3.33.1", - "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.33.1.tgz", - "integrity": "sha512-iJc4TwyANnOGR1OmWhsS9ayRS3s+XQ185FmuHObThD+5AeJCakAAbWv8KimMTt08xCCLNgneQwFp+JRJOr9qGQ==", + "version": "3.33.3", + "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.33.3.tgz", + "integrity": "sha512-Gej7U+OKR+LZ8kvX7rb2HhCYJ0IhvEFsnkud4SB1PR+BUY/TsSO0dmOW59WEVLu51b1Rm+gQRKoz4bLYxGSZ2g==", "license": "MIT", "engines": { "node": ">=0.10" @@ -5182,7 +5454,6 @@ "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -5321,6 +5592,15 @@ "node": ">=0.4.0" } }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -5492,9 +5772,9 @@ } }, "node_modules/dompurify": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.1.tgz", - "integrity": "sha512-JahakDAIg1gyOm7dlgWSDjV4n7Ip2PKR55NIT6jrMfIgLFgWo81vdr1/QGqWtFNRqXP9UV71oVePtjqS2ebnPw==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.2.tgz", + "integrity": "sha512-lHeS9SA/IKeIFFyYciHBr2n0v1VMPlSj843HdLOwjb2OxNwdq9Xykxqhk+FE42MzAdHvInbAolSE4mhahPpjXA==", "license": "(MPL-2.0 OR Apache-2.0)", "optionalDependencies": { "@types/trusted-types": "^2.0.7" @@ -5533,7 +5813,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "dev": true, "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.1", @@ -5551,6 +5830,12 @@ "dev": true, "license": "MIT" }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -5568,9 +5853,9 @@ } }, "node_modules/electron": { - "version": "40.8.5", - "resolved": "https://registry.npmjs.org/electron/-/electron-40.8.5.tgz", - "integrity": "sha512-pgTY/VPQKaiU4sTjfU96iyxCXrFm4htVPCMRT4b7q9ijNTRgtLmLvcmzp2G4e7xDrq9p7OLHSmu1rBKFf6Y1/A==", + "version": "40.9.3", + "resolved": "https://registry.npmjs.org/electron/-/electron-40.9.3.tgz", + "integrity": "sha512-rDcJOT6BBE689Ada+4jD3rVr05pMv9MZOgT0x/rIMVDF9c4ttx4RTb6lVARTyxZC7uqpirttCtcli1eg1DX5qg==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -5786,6 +6071,15 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "license": "MIT" }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/encoding": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", @@ -5854,7 +6148,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -5864,16 +6157,15 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" } }, "node_modules/es-module-lexer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz", - "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", "dev": true, "license": "MIT" }, @@ -5881,7 +6173,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0" @@ -5915,9 +6206,9 @@ "optional": true }, "node_modules/esbuild": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", - "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.4.tgz", + "integrity": "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -5928,32 +6219,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.3", - "@esbuild/android-arm": "0.27.3", - "@esbuild/android-arm64": "0.27.3", - "@esbuild/android-x64": "0.27.3", - "@esbuild/darwin-arm64": "0.27.3", - "@esbuild/darwin-x64": "0.27.3", - "@esbuild/freebsd-arm64": "0.27.3", - "@esbuild/freebsd-x64": "0.27.3", - "@esbuild/linux-arm": "0.27.3", - "@esbuild/linux-arm64": "0.27.3", - "@esbuild/linux-ia32": "0.27.3", - "@esbuild/linux-loong64": "0.27.3", - "@esbuild/linux-mips64el": "0.27.3", - "@esbuild/linux-ppc64": "0.27.3", - "@esbuild/linux-riscv64": "0.27.3", - "@esbuild/linux-s390x": "0.27.3", - "@esbuild/linux-x64": "0.27.3", - "@esbuild/netbsd-arm64": "0.27.3", - "@esbuild/netbsd-x64": "0.27.3", - "@esbuild/openbsd-arm64": "0.27.3", - "@esbuild/openbsd-x64": "0.27.3", - "@esbuild/openharmony-arm64": "0.27.3", - "@esbuild/sunos-x64": "0.27.3", - "@esbuild/win32-arm64": "0.27.3", - "@esbuild/win32-ia32": "0.27.3", - "@esbuild/win32-x64": "0.27.3" + "@esbuild/aix-ppc64": "0.27.4", + "@esbuild/android-arm": "0.27.4", + "@esbuild/android-arm64": "0.27.4", + "@esbuild/android-x64": "0.27.4", + "@esbuild/darwin-arm64": "0.27.4", + "@esbuild/darwin-x64": "0.27.4", + "@esbuild/freebsd-arm64": "0.27.4", + "@esbuild/freebsd-x64": "0.27.4", + "@esbuild/linux-arm": "0.27.4", + "@esbuild/linux-arm64": "0.27.4", + "@esbuild/linux-ia32": "0.27.4", + "@esbuild/linux-loong64": "0.27.4", + "@esbuild/linux-mips64el": "0.27.4", + "@esbuild/linux-ppc64": "0.27.4", + "@esbuild/linux-riscv64": "0.27.4", + "@esbuild/linux-s390x": "0.27.4", + "@esbuild/linux-x64": "0.27.4", + "@esbuild/netbsd-arm64": "0.27.4", + "@esbuild/netbsd-x64": "0.27.4", + "@esbuild/openbsd-arm64": "0.27.4", + "@esbuild/openbsd-x64": "0.27.4", + "@esbuild/openharmony-arm64": "0.27.4", + "@esbuild/sunos-x64": "0.27.4", + "@esbuild/win32-arm64": "0.27.4", + "@esbuild/win32-ia32": "0.27.4", + "@esbuild/win32-x64": "0.27.4" } }, "node_modules/escalade": { @@ -5966,6 +6257,12 @@ "node": ">=6" } }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -6238,6 +6535,15 @@ "node": ">=0.10.0" } }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/eventemitter3": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", @@ -6245,6 +6551,27 @@ "dev": true, "license": "MIT" }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz", + "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/expect-type": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz", @@ -6262,6 +6589,92 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.3.1.tgz", + "integrity": "sha512-D1dKN+cmyPWuvB+G2SREQDzPY1agpBIcTa9sJxOPMCNeH3gwzhqJRDWCXW3gg0y//+LQ/8j52JbMROWyrKdMdw==", + "license": "MIT", + "dependencies": { + "ip-address": "10.1.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/express/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/extract-zip": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", @@ -6298,7 +6711,6 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, "license": "MIT" }, "node_modules/fast-json-stable-stringify": { @@ -6315,14 +6727,30 @@ "dev": true, "license": "MIT" }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "pend": "~1.2.0" + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" } }, "node_modules/fdir": { @@ -6409,6 +6837,27 @@ "node": ">=8" } }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -6441,16 +6890,16 @@ } }, "node_modules/flatted": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", - "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", "dev": true, "license": "ISC" }, "node_modules/follow-redirects": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", - "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", "dev": true, "funding": [ { @@ -6515,6 +6964,24 @@ "node": ">= 6" } }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -6569,7 +7036,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6611,7 +7077,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "dev": true, "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", @@ -6636,7 +7101,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "dev": true, "license": "MIT", "dependencies": { "dunder-proto": "^1.0.1", @@ -6796,7 +7260,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -6872,7 +7335,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -6901,7 +7363,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -6946,6 +7407,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hono": { + "version": "4.12.8", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.8.tgz", + "integrity": "sha512-VJCEvtrezO1IAR+kqEYnxUOoStaQPGrCmX3j4wDTNOcD1uRPFpGlwQUIW8niPuvHXaTUxeOUl5MMDGrl+tmO9A==", + "license": "MIT", + "engines": { + "node": ">=16.9.0" + } + }, "node_modules/hosted-git-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", @@ -7023,6 +7493,26 @@ "dev": true, "license": "BSD-2-Clause" }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/http-proxy-agent": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", @@ -7185,7 +7675,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true, "license": "ISC" }, "node_modules/inline-style-parser": { @@ -7208,12 +7697,20 @@ "version": "10.1.0", "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", - "dev": true, "license": "MIT", "engines": { "node": ">= 12" } }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -7279,6 +7776,12 @@ "node": ">=0.12.0" } }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, "node_modules/is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", @@ -7443,6 +7946,15 @@ "node": ">= 20" } }, + "node_modules/jose": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.2.tgz", + "integrity": "sha512-d7kPDd34KO/YnzaDOlikGpOurfF0ByC2sEV4cANCtdqLlTfBlw2p14O/5d/zv40gJPbIQxfES3nSx1/oYNyuZQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -7490,6 +8002,12 @@ "dev": true, "license": "MIT" }, + "node_modules/json-schema-typed": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz", + "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==", + "license": "BSD-2-Clause" + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -7529,9 +8047,9 @@ } }, "node_modules/katex": { - "version": "0.16.44", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.44.tgz", - "integrity": "sha512-EkxoDTk8ufHqHlf9QxGwcxeLkWRR3iOuYfRpfORgYfqc8s13bgb+YtRY59NK5ZpRaCwq1kqA6a5lpX8C/eLphQ==", + "version": "0.16.45", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.45.tgz", + "integrity": "sha512-pQpZbdBu7wCTmQUh7ufPmLr0pFoObnGUoL/yhtwJDgmmQpbkg/0HSVti25Fu4rmd1oCR6NGWe9vqTWuWv3GcNA==", "funding": [ "https://opencollective.com/katex", "https://github.com/sponsors/katex" @@ -7583,14 +8101,14 @@ "license": "MIT" }, "node_modules/langium": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/langium/-/langium-4.2.2.tgz", - "integrity": "sha512-JUshTRAfHI4/MF9dH2WupvjSXyn8JBuUEWazB8ZVJUtXutT0doDlAv1XKbZ1Pb5sMexa8FF4CFBc0iiul7gbUQ==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/langium/-/langium-4.2.3.tgz", + "integrity": "sha512-sOPIi4hISFnY7twwV97ca1TsxpBtXq0URu/LL1AvxwccPG/RIBBlKS7a/f/EL6w8lTNaS0EFs/F+IdSOaqYpng==", "license": "MIT", "dependencies": { "@chevrotain/regexp-to-ast": "~12.0.0", "chevrotain": "~12.0.0", - "chevrotain-allstar": "~0.4.1", + "chevrotain-allstar": "~0.4.3", "vscode-languageserver": "~9.0.1", "vscode-languageserver-textdocument": "~1.0.11", "vscode-uri": "~3.1.0" @@ -7849,9 +8367,9 @@ } }, "node_modules/lodash": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", - "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", "dev": true, "license": "MIT" }, @@ -8209,7 +8727,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -8236,6 +8753,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/merge-anything": { "version": "5.1.7", "resolved": "https://registry.npmjs.org/merge-anything/-/merge-anything-5.1.7.tgz", @@ -8252,15 +8778,27 @@ "url": "https://github.com/sponsors/mesqueeb" } }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mermaid": { - "version": "11.13.0", - "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-11.13.0.tgz", - "integrity": "sha512-fEnci+Immw6lKMFI8sqzjlATTyjLkRa6axrEgLV2yHTfv8r+h1wjFbV6xeRtd4rUV1cS4EpR9rwp3Rci7TRWDw==", + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-11.14.0.tgz", + "integrity": "sha512-GSGloRsBs+JINmmhl0JDwjpuezCsHB4WGI4NASHxL3fHo3o/BRXTxhDLKnln8/Q0lRFRyDdEjmk1/d5Sn1Xz8g==", "license": "MIT", "dependencies": { "@braintree/sanitize-url": "^7.1.1", "@iconify/utils": "^3.0.2", - "@mermaid-js/parser": "^1.0.1", + "@mermaid-js/parser": "^1.1.0", "@types/d3": "^7.4.3", "@upsetjs/venn.js": "^2.0.0", "cytoscape": "^3.33.1", @@ -8397,9 +8935,9 @@ } }, "node_modules/micromatch/node_modules/picomatch": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", - "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "license": "MIT", "engines": { @@ -8718,7 +9256,6 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, "license": "MIT" }, "node_modules/nano-spawn": { @@ -8764,7 +9301,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.6" @@ -8917,6 +9453,27 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -8939,11 +9496,22 @@ ], "license": "MIT" }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -9127,6 +9695,15 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/path-data-parser": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/path-data-parser/-/path-data-parser-0.1.0.tgz", @@ -9156,7 +9733,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -9186,6 +9762,16 @@ "dev": true, "license": "ISC" }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/pathe": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", @@ -9222,9 +9808,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", "engines": { @@ -9247,6 +9833,15 @@ "node": ">=0.10" } }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, "node_modules/pkg-types": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", @@ -9299,9 +9894,9 @@ } }, "node_modules/postcss": { - "version": "8.5.10", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.10.tgz", - "integrity": "sha512-pMMHxBOZKFU6HgAZ4eyGnwXF/EvPGGqUr0MnZ5+99485wwW41kW91A4LOGxSHhgugZmSChL5AlElNdwlNgcnLQ==", + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", "dev": true, "funding": [ { @@ -9439,16 +10034,26 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/proxy-from-env": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", - "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==", - "dev": true, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, "engines": { - "node": ">=10" + "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true, + "license": "MIT" + }, "node_modules/pump": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", @@ -9605,6 +10210,21 @@ "node": ">=6" } }, + "node_modules/qs": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz", + "integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/quick-lru": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", @@ -9618,6 +10238,46 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/read-binary-file-arch": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/read-binary-file-arch/-/read-binary-file-arch-1.0.6.tgz", @@ -9679,6 +10339,15 @@ "node": ">=0.10.0" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -9861,6 +10530,22 @@ "points-on-path": "^0.2.1" } }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/rw": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", @@ -9942,6 +10627,57 @@ "license": "MIT", "optional": true }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/send/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/send/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/serialize-error": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", @@ -9980,17 +10716,41 @@ "seroval": "^1.0" } }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "license": "ISC" }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" @@ -10003,7 +10763,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -10041,6 +10800,78 @@ "node": ">=20" } }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/siginfo": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", @@ -10243,6 +11074,15 @@ "node": ">= 6" } }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/std-env": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.1.0.tgz", @@ -10364,9 +11204,9 @@ } }, "node_modules/stylis": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.6.tgz", - "integrity": "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.4.0.tgz", + "integrity": "sha512-5Z9ZpRzfuH6l/UAvCPAPUo3665Nk2wLaZU3x+TLHKVzIz33+sbJqbtrYoC3KD4/uVOr2Zp+L0LySezP9OHV9yA==", "license": "MIT" }, "node_modules/sumchecker": { @@ -10399,9 +11239,9 @@ } }, "node_modules/tar": { - "version": "7.5.13", - "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.13.tgz", - "integrity": "sha512-tOG/7GyXpFevhXVh8jOPJrmtRpOTsYqUIkVdVooZYJS/z8WhfQUX8RJILmeuJNinGAMSu1veBr4asSHFt5/hng==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.10.tgz", + "integrity": "sha512-8mOPs1//5q/rlkNSPcCegA6hiHJYDmSLEI8aMH/CdSQJNWztHC9WHNam5zdQlfpTwB9Xp7IBEsHfV5LKMJGVAw==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -10585,6 +11425,15 @@ "node": ">=8.0" } }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -10671,6 +11520,45 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/type-is/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/type-is/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/typescript": { "version": "5.9.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", @@ -10710,9 +11598,9 @@ } }, "node_modules/ufo": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", - "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", "license": "MIT" }, "node_modules/undici-types": { @@ -10826,6 +11714,15 @@ "node": ">= 4.0.0" } }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", @@ -10882,9 +11779,9 @@ "license": "MIT" }, "node_modules/uuid": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", - "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.1.tgz", + "integrity": "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" @@ -10894,6 +11791,15 @@ "uuid": "dist/esm/bin/uuid" } }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/verror": { "version": "1.10.1", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz", @@ -11317,7 +12223,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true, "license": "ISC" }, "node_modules/ws": { @@ -11437,6 +12342,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/zod": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", + "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.25.1", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", + "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.25 || ^4" + } + }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/package.json b/package.json index 8f385933..17cd6150 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,13 @@ "main": "dist-electron/main.js", "type": "module", "scripts": { - "dev": "npm run compile && concurrently -k \"vite --config electron/vite.config.electron.ts\" \"wait-on http://localhost:1421 && VITE_DEV_SERVER_URL=http://localhost:1421 electron --no-sandbox dist-electron/main.js\"", + "dev": "npm run compile && npm run build:mcp && concurrently -k \"vite --config electron/vite.config.electron.ts\" \"wait-on http://localhost:1421 && VITE_DEV_SERVER_URL=http://localhost:1421 electron --no-sandbox dist-electron/main.js\"", "typecheck": "tsc --noEmit", "compile": "tsc -p electron/tsconfig.json", + "build:mcp": "esbuild dist-electron/mcp/server.js --bundle --platform=node --format=cjs --outfile=dist-electron/mcp-server.cjs", "build:frontend": "NODE_OPTIONS='--max-old-space-size=4096' vite build --config electron/vite.config.electron.ts", "build:remote": "vite build --config src/remote/vite.config.ts", - "build": "npm run build:frontend && npm run build:remote && npm run compile && electron-builder", + "build": "npm run build:frontend && npm run build:remote && npm run compile && npm run build:mcp && electron-builder", "serve": "vite preview --config electron/vite.config.electron.ts", "lint": "eslint . --max-warnings 0", "lint:fix": "eslint . --fix", @@ -24,10 +25,12 @@ "test:coverage": "vitest run --coverage", "check": "npm run typecheck && npm run lint && npm run format:check", "release": "npm run typecheck && npm version patch && git push --follow-tags", + "postinstall": "node scripts/fix-node-pty-spawn-helper.mjs", "prepare": "husky && git config core.hooksPath .husky" }, "license": "MIT", "dependencies": { + "@modelcontextprotocol/sdk": "^1.27.1", "@xterm/addon-fit": "^0.12.0-beta.195", "@xterm/addon-web-links": "^0.13.0-beta.195", "@xterm/addon-webgl": "^0.20.0-beta.194", @@ -53,6 +56,7 @@ "concurrently": "^9.2.1", "electron": "^40.8.5", "electron-builder": "^26.8.1", + "esbuild": "^0.27.4", "eslint": "^9.39.3", "eslint-config-prettier": "^10.1.8", "eslint-plugin-solid": "^0.14.5", @@ -74,8 +78,8 @@ "*.{js,cjs,json,md,html,css}": "prettier --write" }, "build": { - "appId": "com.parallel-code.app", - "productName": "Parallel Code", + "appId": "com.parallel-code.app.dev", + "productName": "Parallel Code Dev", "directories": { "buildResources": "build", "output": "release" @@ -87,7 +91,8 @@ "electron/preload.cjs" ], "asarUnpack": [ - "**/node-pty/**" + "**/node-pty/**", + "dist-electron/mcp-server.cjs" ], "extraResources": [ { diff --git a/scripts/fix-node-pty-spawn-helper.mjs b/scripts/fix-node-pty-spawn-helper.mjs new file mode 100644 index 00000000..f7c0b08e --- /dev/null +++ b/scripts/fix-node-pty-spawn-helper.mjs @@ -0,0 +1,18 @@ +import { chmodSync, existsSync } from 'fs'; +import { join } from 'path'; +import process from 'process'; + +if (process.platform === 'darwin') { + const helperPath = join( + process.cwd(), + 'node_modules', + 'node-pty', + 'prebuilds', + `darwin-${process.arch}`, + 'spawn-helper', + ); + + if (existsSync(helperPath)) { + chmodSync(helperPath, 0o755); + } +} diff --git a/src/App.tsx b/src/App.tsx index dfa46a5c..5c66c73d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -24,6 +24,7 @@ import { toggleSidebar, toggleArena, moveActiveTask, + jumpToTask, adjustGlobalScale, resetGlobalScale, startTaskStatusPolling, @@ -46,6 +47,7 @@ import { setStepsContent, setDockerAvailable, toggleTaskFocusMode, + initMCPListeners, } from './store/store'; import { isGitHubUrl } from './lib/github-url'; import type { PersistedWindowState } from './store/types'; @@ -354,6 +356,7 @@ function App() { await captureWindowState(); setupAutosave(); startTaskStatusPolling(); + const stopMCPListeners = initMCPListeners(); const stopNotificationWatcher = startDesktopNotificationWatcher(windowFocused); const stopPrChecksSubscription = startPrChecksSubscription(); @@ -452,6 +455,9 @@ function App() { 'navigateColumn:right': () => navigateColumn('right'), 'moveActiveTask:left': () => moveActiveTask('left'), 'moveActiveTask:right': () => moveActiveTask('right'), + ...Object.fromEntries( + Array.from({ length: 9 }, (_, i) => [`jumpToTask:${i + 1}`, () => jumpToTask(i)]), + ), closeShell: () => { const taskId = store.activeTaskId; if (!taskId) return; @@ -527,6 +533,7 @@ function App() { unlistenCloseRequested(); cleanupShortcuts(); stopTaskStatusPolling(); + stopMCPListeners(); stopNotificationWatcher(); stopPrChecksSubscription(); offPlanContent(); diff --git a/src/arena/ConfigScreen.tsx b/src/arena/ConfigScreen.tsx index 07b5183a..22097aac 100644 --- a/src/arena/ConfigScreen.tsx +++ b/src/arena/ConfigScreen.tsx @@ -24,7 +24,7 @@ import type { BattleCompetitor } from './types'; /** Built-in tool presets — click to fill the next empty competitor slot */ const TOOL_PRESETS: Array<{ name: string; command: string }> = [ { name: 'Claude', command: 'claude -p "{prompt}" --dangerously-skip-permissions' }, - { name: 'Codex', command: 'codex exec --full-auto "{prompt}"' }, + { name: 'Codex', command: 'codex exec --dangerously-bypass-approvals-and-sandbox "{prompt}"' }, { name: 'Gemini', command: 'gemini -p "{prompt}" --yolo' }, { name: 'Copilot', command: 'copilot -p "{prompt}" --yolo' }, { name: 'Aider', command: 'aider -m "{prompt}" --yes' }, diff --git a/src/components/CloseTaskDialog.tsx b/src/components/CloseTaskDialog.tsx index 6e2945a0..e96433dd 100644 --- a/src/components/CloseTaskDialog.tsx +++ b/src/components/CloseTaskDialog.tsx @@ -1,7 +1,7 @@ import { Show, createResource } from 'solid-js'; import { invoke } from '../lib/ipc'; import { IPC } from '../../electron/ipc/channels'; -import { closeTask, getProject } from '../store/store'; +import { closeTask, getProject, getCoordinatorCloseWarning } from '../store/store'; import { ConfirmDialog } from './ConfirmDialog'; import { theme, bannerStyle } from '../lib/theme'; import type { Task } from '../store/types'; @@ -28,6 +28,24 @@ export function CloseTaskDialog(props: CloseTaskDialogProps) { title="Close Task" message={
+ + {(warning) => ( +
+ {warning()} +
+ )} +

This will stop all running agents and shells for this task. No git operations will be diff --git a/src/components/MergeDialog.tsx b/src/components/MergeDialog.tsx index eca7d267..c92efca7 100644 --- a/src/components/MergeDialog.tsx +++ b/src/components/MergeDialog.tsx @@ -244,15 +244,16 @@ export function MergeDialog(props: MergeDialogProps) { } style={{ padding: '6px 14px', - background: theme.bgInput, - border: `1px solid ${theme.border}`, + background: hasConflicts() ? theme.bgInput : theme.accent, + border: hasConflicts() ? `1px solid ${theme.border}` : 'none', 'border-radius': '8px', - color: theme.fg, + color: hasConflicts() ? theme.fg : theme.accentText, cursor: rebasing() || worktreeStatus()?.has_uncommitted_changes ? 'not-allowed' : 'pointer', 'font-size': '13px', + 'font-weight': hasConflicts() ? 'normal' : '600', opacity: rebasing() || worktreeStatus()?.has_uncommitted_changes ? '0.5' : '1', }} @@ -280,13 +281,13 @@ export function MergeDialog(props: MergeDialogProps) { title="Close dialog and ask the AI agent to rebase" style={{ padding: '6px 14px', - background: theme.accent, - border: 'none', + background: hasConflicts() ? theme.accent : theme.bgInput, + border: hasConflicts() ? 'none' : `1px solid ${theme.border}`, 'border-radius': '8px', - color: theme.accentText, + color: hasConflicts() ? theme.accentText : theme.fg, cursor: 'pointer', 'font-size': '13px', - 'font-weight': '600', + 'font-weight': hasConflicts() ? '600' : 'normal', }} > Rebase with AI diff --git a/src/components/NewTaskDialog.tsx b/src/components/NewTaskDialog.tsx index 9efe6239..322b2d11 100644 --- a/src/components/NewTaskDialog.tsx +++ b/src/components/NewTaskDialog.tsx @@ -62,6 +62,7 @@ export function NewTaskDialog(props: NewTaskDialogProps) { imageTag: string; buildContext: string; } | null>(null); + const [coordinatorMode, setCoordinatorMode] = createSignal(false); const [branchPrefix, setBranchPrefix] = createSignal(''); let promptRef!: HTMLTextAreaElement; const titleId = createUniqueId(); @@ -133,6 +134,7 @@ export function NewTaskDialog(props: NewTaskDialogProps) { setDockerBuildOutput(''); setDockerBuildError(''); setProjectDockerfile(null); + setCoordinatorMode(false); void (async () => { // Check Docker availability in background @@ -531,6 +533,7 @@ export function NewTaskDialog(props: NewTaskDialogProps) { dockerImage: dockerMode() ? (projDocker?.imageTag ?? (store.dockerImage || DEFAULT_DOCKER_IMAGE)) : undefined, + coordinatorMode: coordinatorMode() || undefined, }); // Drop flow: prefill prompt without auto-sending if (isFromDrop && p) { @@ -702,6 +705,46 @@ export function NewTaskDialog(props: NewTaskDialogProps) { wrap={false} /> + {/* Coordinator mode toggle */} +

+ + +
+ This agent will be able to create tasks, send prompts, and merge branches + automatically via MCP tools. The remote server will be started automatically. +
+
+
+ {/* Isolation mode selector — hidden for non-git projects */}
+
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 4b8dee48..83623a69 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -26,7 +26,11 @@ import { } from '../store/store'; import type { Project } from '../store/types'; import type { TaskAttentionState } from '../store/store'; -import { computeGroupedTasks } from '../store/sidebar-order'; +import { + computeGroupedTasks, + getCoordinatorChildren, + isCoordinatedChild, +} from '../store/sidebar-order'; import { ConnectPhoneModal } from './ConnectPhoneModal'; import { ConfirmDialog } from './ConfirmDialog'; import { EditProjectDialog } from './EditProjectDialog'; @@ -97,6 +101,21 @@ function createOffscreenAttentionState(taskId: () => string) { }; } +/** Small bot/coordinator icon (16x16 SVG). */ +function CoordinatorIcon() { + return ( + + + + ); +} + export function Sidebar() { const [confirmRemove, setConfirmRemove] = createSignal(null); const [editingProject, setEditingProject] = createSignal(null); @@ -111,12 +130,15 @@ export function Sidebar() { let taskListRef: HTMLDivElement | undefined; const sidebarWidth = () => getPanelUserSize(SIDEBAR_SIZE_KEY) ?? SIDEBAR_DEFAULT_WIDTH; + const taskIndexById = createMemo(() => { const map = new Map(); store.taskOrder.forEach((taskId, idx) => map.set(taskId, idx)); return map; }); + const groupedTasks = createMemo(() => computeGroupedTasks()); + function handleResizeMouseDown(e: MouseEvent) { e.preventDefault(); setResizing(true); @@ -142,7 +164,6 @@ export function Sidebar() { } onMount(() => { - // Attach mousedown on task list container via native listener const el = taskListRef; if (el) { const handler = (e: MouseEvent) => { @@ -151,18 +172,18 @@ export function Sidebar() { const index = Number(target.dataset.taskIndex); const taskId = store.taskOrder[index]; if (taskId === undefined || taskId === null) return; + // Don't allow dragging coordinated children + if (isCoordinatedChild(taskId)) return; handleTaskMouseDown(e, taskId, index); }; el.addEventListener('mousedown', handler); onCleanup(() => el.removeEventListener('mousedown', handler)); } - // Register sidebar focus registerFocusFn('sidebar', () => taskListRef?.focus()); onCleanup(() => unregisterFocusFn('sidebar')); }); - // When sidebarFocused changes, trigger focus createEffect(() => { if (store.sidebarFocused) { taskListRef?.focus(); @@ -181,7 +202,6 @@ export function Sidebar() { el?.scrollIntoView({ block: 'nearest', behavior: 'instant' }); }); - // Scroll the focused task into view when navigating via keyboard createEffect(() => { const focusedId = store.sidebarFocusedTaskId; if (!focusedId || !taskListRef) return; @@ -196,7 +216,6 @@ export function Sidebar() { el.scrollIntoView({ block: 'nearest', behavior: 'instant' }); }); - // Scroll the focused project into view when it changes createEffect(() => { const projectId = store.sidebarFocusedProjectId; if (!projectId) return; @@ -260,8 +279,7 @@ export function Sidebar() { document.body.classList.add('dragging-task'); } - const dropIdx = computeDropIndex(ev.clientY, index); - setDropTargetIndex(dropIdx); + setDropTargetIndex(computeDropIndex(ev.clientY, index)); } function onUp() { @@ -290,7 +308,6 @@ export function Sidebar() { } function abbreviatePath(path: string): string { - // Handle Linux /home/user/... and macOS /Users/user/... const prefixes = ['/home/', '/Users/']; for (const prefix of prefixes) { if (path.startsWith(prefix)) { @@ -303,7 +320,6 @@ export function Sidebar() { return path; } - // Compute the global taskOrder index for a given task function globalIndex(taskId: string): number { return taskIndexById().get(taskId) ?? -1; } @@ -671,7 +687,7 @@ export function Sidebar() { {(taskId) => ( - - {(taskId) => } + {(taskId) => } ); @@ -709,7 +725,7 @@ export function Sidebar() { {(taskId) => ( - - {(taskId) => } + {(taskId) => } @@ -772,7 +788,6 @@ export function Sidebar() { setShowConnectPhone(false)} /> - {/* Edit project dialog */} setEditingProject(null)} /> - {props.branchName} - - ); -} +// Coordinator children always render inline under their coordinator regardless of +// their position in taskOrder (they're filtered out of computeGroupedTasks). +// So moving the coordinator itself is sufficient — children follow visually. -function OffscreenAttentionBadge(props: { taskId: string }) { - const offscreenAttention = createOffscreenAttentionState(() => props.taskId); - return ( - - {(text) => ( - - {text()} - - )} - - ); -} +// --- Task entry: renders a task row OR a coordinator folder with nested children --- -function NoGitBadge() { - return ( - - no git - - ); +interface TaskEntryProps { + taskId: string; + globalIndex: (taskId: string) => number; + dragFromIndex: () => number | null; + dropTargetIndex: () => number | null; } -function CollapsedTaskRow(props: { taskId: string }) { +function TaskEntry(props: TaskEntryProps) { const task = () => store.tasks[props.taskId]; - const offscreenAttention = createOffscreenAttentionState(() => props.taskId); + const isCoordinator = () => task()?.coordinatorMode ?? false; + return ( - {(t) => ( -
uncollapseTask(props.taskId)} - onKeyDown={(e) => { - if (e.key === 'Enter' || e.key === ' ') { - e.preventDefault(); - uncollapseTask(props.taskId); - } - }} - title="Click to restore" - style={{ - padding: '7px 10px', - 'border-radius': '6px', - background: offscreenAttention.hasAttention() - ? `color-mix(in srgb, ${offscreenAttention.color()} 10%, transparent)` - : 'transparent', - color: offscreenAttention.hasAttention() ? theme.fg : theme.fgSubtle, - 'font-size': sf(13), - 'font-weight': '400', - cursor: 'pointer', - 'white-space': 'nowrap', - overflow: 'hidden', - 'text-overflow': 'ellipsis', - opacity: offscreenAttention.hasAttention() ? '1' : '0.6', - display: 'flex', - 'align-items': 'center', - gap: '6px', - border: - store.sidebarFocused && store.sidebarFocusedTaskId === props.taskId - ? `1.5px solid var(--border-focus)` - : offscreenAttention.hasAttention() - ? `1.5px solid color-mix(in srgb, ${offscreenAttention.color()} 38%, transparent)` - : '1.5px solid transparent', - }} - > - - - - - - - - - {t().name} - - -
- )} + } + > + +
); } -interface TaskRowProps { - taskId: string; - globalIndex: (taskId: string) => number; - dragFromIndex: () => number | null; - dropTargetIndex: () => number | null; -} +// --- Coordinator folder: coordinator row + indented children --- -function TaskRow(props: TaskRowProps) { +function CoordinatorFolder(props: TaskEntryProps) { const task = () => store.tasks[props.taskId]; + const children = createMemo(() => getCoordinatorChildren(props.taskId)); + const childCount = createMemo(() => children().active.length + children().collapsed.length); const idx = () => props.globalIndex(props.taskId); const offscreenAttention = createOffscreenAttentionState(() => props.taskId); + return ( {(t) => ( @@ -969,6 +900,7 @@ function TaskRow(props: TaskRowProps) {
+ {/* Coordinator row */}
- - - - {t().branchName} +
+ + + + {t().name} - - - - - - {t().name} - - + 0}> + + {childCount()} + + +
+
+ + {/* Indented active children */} + + {(childId) => ( + + )} + + + {/* Indented collapsed children */} + + {(childId) => } + + + )} + + ); +} + +// --- Collapsed task entry: also handles coordinator folders in collapsed state --- + +function CollapsedTaskEntry(props: { taskId: string; indented?: boolean }) { + const task = () => store.tasks[props.taskId]; + // Only top-level coordinators render children — indented entries never recurse + const isCoordinator = () => !props.indented && (task()?.coordinatorMode ?? false); + const children = createMemo(() => + isCoordinator() ? getCoordinatorChildren(props.taskId) : { active: [], collapsed: [] }, + ); + const childCount = createMemo(() => children().active.length + children().collapsed.length); + + return ( + + {(t) => ( + <> +
uncollapseTask(props.taskId)} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + uncollapseTask(props.taskId); + } + }} + title="Click to restore" + style={{ + padding: '7px 10px', + 'padding-left': props.indented ? '22px' : '10px', + 'border-radius': '6px', + background: 'transparent', + color: theme.fgSubtle, + 'font-size': sf(12), + 'font-weight': '400', + cursor: 'pointer', + 'white-space': 'nowrap', + overflow: 'hidden', + 'text-overflow': 'ellipsis', + opacity: '0.6', + display: 'flex', + 'flex-direction': 'column', + gap: '1px', + border: + store.sidebarFocused && store.sidebarFocusedTaskId === props.taskId + ? `1.5px solid var(--border-focus)` + : '1.5px solid transparent', + }} + > +
+ + + + + + + {t().branchName} + + + {t().name} + 0}> + + {childCount()} + + +
+
+ + {/* If collapsed coordinator, still show children nested */} + + + {(childId) => } + + + {(childId) => } + + + + )} +
+ ); +} + +// --- Individual task row --- + +interface TaskRowProps { + taskId: string; + globalIndex: (taskId: string) => number; + dragFromIndex: () => number | null; + dropTargetIndex: () => number | null; + indented: boolean; +} + +function TaskRow(props: TaskRowProps) { + const task = () => store.tasks[props.taskId]; + const idx = () => props.globalIndex(props.taskId); + return ( + + {(t) => ( + <> + +
+ +
{ + setActiveTask(props.taskId); + focusSidebar(); + }} + style={{ + padding: '7px 10px', + 'padding-left': props.indented ? '22px' : '10px', + 'border-radius': '6px', + background: 'transparent', + color: store.activeTaskId === props.taskId ? theme.fg : theme.fgMuted, + 'font-size': sf(12), + 'font-weight': store.activeTaskId === props.taskId ? '500' : '400', + cursor: props.indented + ? 'pointer' + : props.dragFromIndex() !== null + ? 'grabbing' + : 'pointer', + 'white-space': 'nowrap', + overflow: 'hidden', + 'text-overflow': 'ellipsis', + opacity: !props.indented && props.dragFromIndex() === idx() ? '0.4' : '1', + display: 'flex', + 'flex-direction': 'column', + gap: '1px', + border: + store.sidebarFocused && store.sidebarFocusedTaskId === props.taskId + ? `1.5px solid var(--border-focus)` + : '1.5px solid transparent', + }} + > +
+ + + + {t().branchName} + + + {t().name} +
)} diff --git a/src/components/SidebarFooter.tsx b/src/components/SidebarFooter.tsx index 8ee52f41..8800c234 100644 --- a/src/components/SidebarFooter.tsx +++ b/src/components/SidebarFooter.tsx @@ -1,10 +1,13 @@ -import { createMemo, Show } from 'solid-js'; +import { createMemo, createEffect, onCleanup, Show } from 'solid-js'; import { + store, getCompletedTasksTodayCount, getMergedLineTotals, toggleHelpDialog, toggleArena, - store, + hasAnyCoordinatorTask, + startMCPStatusPolling, + stopMCPStatusPolling, } from '../store/store'; import { theme } from '../lib/theme'; import { sf } from '../lib/fontScale'; @@ -13,9 +16,53 @@ import { alt, mod } from '../lib/platform'; export function SidebarFooter() { const completedTasksToday = createMemo(() => getCompletedTasksTodayCount()); const mergedLines = createMemo(() => getMergedLineTotals()); + const hasCoordinator = createMemo(() => hasAnyCoordinatorTask()); + + createEffect(() => { + if (hasCoordinator()) { + startMCPStatusPolling(); + } else { + stopMCPStatusPolling(); + } + }); + + onCleanup(() => stopMCPStatusPolling()); + + const mcpOk = () => store.mcpStatus.remoteRunning; return ( <> + +
+
+ + MCP {mcpOk() ? 'Connected' : 'Disconnected'} + +
+ +
+ store.taskOrder + .map((id) => store.tasks[id]) + .filter((t) => t && t.coordinatedBy === props.coordinatorTaskId), + ); + + return ( + 0}> +
+ + Sub-tasks: + + + {(task) => ( + + )} + +
+
+ ); +} diff --git a/src/components/TaskPanel.tsx b/src/components/TaskPanel.tsx index e9597835..d17cf22e 100644 --- a/src/components/TaskPanel.tsx +++ b/src/components/TaskPanel.tsx @@ -11,6 +11,7 @@ import { clearPendingAction, showNotification, setTaskSplitMode, + setTaskControl, } from '../store/store'; import { useFocusRegistration } from '../lib/focus-registration'; import { ResizablePanel, type PanelChild } from './ResizablePanel'; @@ -32,6 +33,7 @@ import { TaskAITerminal } from './TaskAITerminal'; import { TaskClosingOverlay } from './TaskClosingOverlay'; import { invoke } from '../lib/ipc'; import { IPC } from '../../electron/ipc/channels'; +import { SubTaskStrip } from './SubTaskStrip'; import { theme } from '../lib/theme'; import type { Task } from '../store/types'; import type { CommitInfo } from '../ipc/types'; @@ -367,6 +369,68 @@ export function TaskPanel(props: TaskPanelProps) { closingError={props.task.closingError} onRetry={() => retryCloseTask(props.task.id)} /> + + + Orchestrator driving + +
+ } + > +
+ You have control — orchestrator is paused + +
+ + + + +
{ diff --git a/src/lib/keybindings/defaults.ts b/src/lib/keybindings/defaults.ts index 230b872f..0e6ae8c3 100644 --- a/src/lib/keybindings/defaults.ts +++ b/src/lib/keybindings/defaults.ts @@ -75,6 +75,21 @@ export const DEFAULT_BINDINGS: KeyBinding[] = [ global: true, }, + // ------------------------------------------------------------------------- + // App layer — Jump to task by position (Cmd+1 through Cmd+9) + // ------------------------------------------------------------------------- + ...Array.from({ length: 9 }, (_, i) => ({ + id: `app.nav.jump-to-task-${i + 1}`, + layer: 'app' as const, + category: 'Navigation', + description: `Jump to task ${i + 1}`, + platform: 'both' as const, + key: `Digit${i + 1}`, + modifiers: { cmdOrCtrl: true }, + action: `jumpToTask:${i + 1}`, + global: true, + })), + // ------------------------------------------------------------------------- // App layer — Task actions // ------------------------------------------------------------------------- diff --git a/src/store/coordinator-preamble.ts b/src/store/coordinator-preamble.ts new file mode 100644 index 00000000..9efd9882 --- /dev/null +++ b/src/store/coordinator-preamble.ts @@ -0,0 +1,31 @@ +/** + * System preamble prepended to the coordinator agent's initial prompt. + * Instructs the agent to use MCP tools for parallelization and to ask + * clarifying questions when the user's intent is ambiguous. + */ +export const COORDINATOR_PREAMBLE = `[COORDINATOR MODE] You are a coordinating agent inside Parallel Code. \ +You have MCP tools to orchestrate work across isolated git worktree tasks: + +- create_task — Create a new task (own worktree + AI agent). Prompt is auto-delivered when the agent is ready. +- list_tasks — List all orchestrated tasks with status +- get_task_status — Detailed status of a task +- send_prompt — Send follow-up instructions to a task's agent +- wait_for_idle — Wait until an agent is idle (at its prompt, ready for input) +- get_task_diff — Get changed files and diff for a task +- get_task_output — Get recent terminal output from a task +- merge_task — Merge a task's branch into main +- close_task — Close and clean up a task + +RULES: +1. When asked to do work in parallel or break work into pieces, ALWAYS use the create_task MCP tool \ +to create separate Parallel Code tasks. Do NOT use your built-in Agent tool for parallelization — \ +the whole point of coordinator mode is isolated worktree tasks. +2. If the user's request is ambiguous or you are unsure how to split the work into tasks, \ +ASK the user for clarification before creating tasks. It is better to ask a short question \ +than to guess wrong and spin up tasks that do the wrong thing. +3. Typical workflow: create_task (with prompt) for each piece of work → wait_for_idle on each \ +when work is done → get_task_diff to review → merge_task to land → close_task to clean up. +4. Use send_prompt to give follow-up instructions to a task that has already completed its initial work. + +--- +`; diff --git a/src/store/core.ts b/src/store/core.ts index e5c4d0b6..d183bf46 100644 --- a/src/store/core.ts +++ b/src/store/core.ts @@ -51,6 +51,7 @@ export const [store, setStore] = createStore({ editorCommand: '', dockerImage: 'parallel-code-agent:latest', dockerAvailable: false, + shareDockerAgentAuth: false, askCodeProvider: 'claude', newTaskDropUrl: null, newTaskPrefillPrompt: null, @@ -64,6 +65,10 @@ export const [store, setStore] = createStore({ tailscaleUrl: null, connectedClients: 0, }, + mcpStatus: { + mcpRunning: false, + remoteRunning: false, + }, showArena: false, keybindingPreset: 'default', keybindingOverridesByPreset: {}, diff --git a/src/store/mcpStatus.ts b/src/store/mcpStatus.ts new file mode 100644 index 00000000..055282d5 --- /dev/null +++ b/src/store/mcpStatus.ts @@ -0,0 +1,36 @@ +import { store, setStore } from './core'; +import { invoke } from '../lib/ipc'; +import { IPC } from '../../electron/ipc/channels'; + +let pollTimer: ReturnType | null = null; +const POLL_INTERVAL_MS = 3_000; + +export function hasAnyCoordinatorTask(): boolean { + for (const id of store.taskOrder) { + if (store.tasks[id]?.coordinatorMode) return true; + } + return false; +} + +export async function refreshMCPStatus(): Promise { + try { + const result = await invoke<{ mcpRunning: boolean; remoteRunning: boolean }>(IPC.GetMCPStatus); + setStore('mcpStatus', result); + } catch { + setStore('mcpStatus', { mcpRunning: false, remoteRunning: false }); + } +} + +export function startMCPStatusPolling(): void { + if (pollTimer) return; + refreshMCPStatus(); + pollTimer = setInterval(refreshMCPStatus, POLL_INTERVAL_MS); +} + +export function stopMCPStatusPolling(): void { + if (pollTimer) { + clearInterval(pollTimer); + pollTimer = null; + } + setStore('mcpStatus', { mcpRunning: false, remoteRunning: false }); +} diff --git a/src/store/navigation.test.ts b/src/store/navigation.test.ts new file mode 100644 index 00000000..14b2e701 --- /dev/null +++ b/src/store/navigation.test.ts @@ -0,0 +1,88 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; + +type MockStore = { + activeTaskId: string | null; + activeAgentId: string | null; + tasks: Record; + terminals: Record; + taskOrder: string[]; + collapsedTaskOrder: string[]; + projects: Array<{ id: string }>; +}; + +let mockStore: MockStore; + +vi.mock('./core', () => ({ + store: new Proxy( + {}, + { + get(_target, prop) { + return mockStore[prop as keyof MockStore]; + }, + }, + ), + setStore: vi.fn((...args: unknown[]) => { + const key = args[0] as keyof MockStore; + const value = args[1]; + (mockStore as Record)[key] = value; + }), +})); + +vi.mock('./focus', () => ({})); +vi.mock('./notification', () => ({ showNotification: vi.fn() })); +vi.mock('./projects', () => ({ pickAndAddProject: vi.fn() })); +vi.mock('./tasks', () => ({ reorderTask: vi.fn() })); + +vi.mock('./sidebar-order', () => ({ + computeSidebarTaskOrder: vi.fn(() => mockStore.taskOrder), +})); + +import { jumpToTask } from './navigation'; + +beforeEach(() => { + mockStore = { + activeTaskId: null, + activeAgentId: null, + tasks: { + 'task-1': { id: 'task-1', agentIds: ['agent-a'] }, + 'task-2': { id: 'task-2', agentIds: ['agent-b'] }, + 'task-3': { id: 'task-3', agentIds: ['agent-c'] }, + }, + terminals: {}, + taskOrder: ['task-1', 'task-2', 'task-3'], + collapsedTaskOrder: [], + projects: [], + }; +}); + +afterEach(() => { + vi.clearAllMocks(); +}); + +describe('jumpToTask', () => { + it('switches to the task at the given 0-based index', () => { + jumpToTask(1); + expect(mockStore.activeTaskId).toBe('task-2'); + }); + + it('switches to the first task with index 0', () => { + jumpToTask(0); + expect(mockStore.activeTaskId).toBe('task-1'); + }); + + it('switches to the last task with index matching last position', () => { + jumpToTask(2); + expect(mockStore.activeTaskId).toBe('task-3'); + }); + + it('does nothing when index is out of bounds', () => { + mockStore.activeTaskId = 'task-1'; + jumpToTask(9); + expect(mockStore.activeTaskId).toBe('task-1'); + }); + + it('sets activeAgentId to first agent of the target task', () => { + jumpToTask(1); + expect(mockStore.activeAgentId).toBe('agent-b'); + }); +}); diff --git a/src/store/navigation.ts b/src/store/navigation.ts index 574800f8..bb74d901 100644 --- a/src/store/navigation.ts +++ b/src/store/navigation.ts @@ -2,6 +2,7 @@ import { store, setStore } from './core'; import { getTaskFocusedPanel, setTaskFocusedPanel } from './focus'; import { showNotification } from './notification'; import { pickAndAddProject } from './projects'; +import { computeSidebarTaskOrder } from './sidebar-order'; import { reorderTask } from './tasks'; export function setActiveTask(id: string): void { @@ -48,6 +49,12 @@ export function moveActiveTask(direction: 'left' | 'right'): void { setTaskFocusedPanel(activeTaskId, getTaskFocusedPanel(activeTaskId)); } +export function jumpToTask(index: number): void { + const order = computeSidebarTaskOrder(); + const id = order[index]; + if (id) setActiveTask(id); +} + export function toggleNewTaskDialog(show?: boolean): void { const shouldShow = show ?? !store.showNewTaskDialog; if (shouldShow && store.projects.length === 0) { diff --git a/src/store/persistence.test.ts b/src/store/persistence.test.ts index 0d4da8e9..3004cd31 100644 --- a/src/store/persistence.test.ts +++ b/src/store/persistence.test.ts @@ -1,5 +1,83 @@ -import { describe, expect, it } from 'vitest'; -import { resolveIncomingPanelUserSize } from './persistence'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; +import type { AgentDef } from '../ipc/types'; +import type { PersistedTask } from './types'; + +const { mockInvoke } = vi.hoisted(() => ({ + mockInvoke: vi.fn(), +})); + +vi.mock('../lib/ipc', () => ({ + invoke: mockInvoke, +})); + +import { loadState, resolveIncomingPanelUserSize } from './persistence'; +import { setStore, store } from './core'; + +function agentDef(overrides: Partial = {}): AgentDef { + return { + id: 'codex', + name: 'Codex CLI', + command: 'codex', + args: [], + resume_args: ['resume', '--last'], + skip_permissions_args: [], + description: 'Codex', + ...overrides, + }; +} + +function persistedTask(def: AgentDef): PersistedTask { + return { + id: 'task-1', + name: 'Task', + projectId: 'project-1', + branchName: 'task/task-1', + worktreePath: '/repo/.worktrees/task-1', + notes: '', + lastPrompt: '', + shellCount: 0, + agentDef: def, + gitIsolation: 'worktree', + }; +} + +async function loadPersistedAgent(def: AgentDef): Promise { + mockInvoke.mockResolvedValueOnce( + JSON.stringify({ + projects: [{ id: 'project-1', name: 'Repo', path: '/repo', color: 'hsl(0, 70%, 75%)' }], + lastProjectId: 'project-1', + lastAgentId: null, + taskOrder: ['task-1'], + collapsedTaskOrder: [], + tasks: { + 'task-1': persistedTask(def), + }, + activeTaskId: 'task-1', + sidebarVisible: true, + }), + ); + + await loadState(); + + const agentId = store.tasks['task-1']?.agentIds[0]; + expect(agentId).toBeTruthy(); + return store.agents[agentId as string].def; +} + +beforeEach(() => { + vi.clearAllMocks(); + setStore('projects', []); + setStore('lastProjectId', null); + setStore('lastAgentId', null); + setStore('taskOrder', []); + setStore('collapsedTaskOrder', []); + setStore('tasks', {}); + setStore('agents', {}); + setStore('activeTaskId', null); + setStore('activeAgentId', null); + setStore('availableAgents', []); + setStore('customAgents', []); +}); describe('resolveIncomingPanelUserSize', () => { it('prefers panelUserSize when both new and legacy are present', () => { @@ -27,7 +105,7 @@ describe('resolveIncomingPanelUserSize', () => { 'sidebar:width': 240, }, undefined, - undefined, // no migration flag + undefined, ); expect(result).toEqual({ 'tiling:uuid-1': 520, @@ -54,8 +132,6 @@ describe('resolveIncomingPanelUserSize', () => { }); it('rejects records containing non-finite numbers (NaN / Infinity)', () => { - // NaN and Infinity survive JSON.parse through custom reviver or hand edits - // — tighter validation here prevents them from becoming `flex: 0 0 NaNpx`. const result = resolveIncomingPanelUserSize( { 'tiling:a': Number.NaN, 'tiling:b': 200 }, undefined, @@ -82,3 +158,38 @@ describe('resolveIncomingPanelUserSize', () => { }); }); }); + +describe('loadState agent definition migrations', () => { + it('migrates persisted Codex --full-auto skip-permissions args', async () => { + const restored = await loadPersistedAgent( + agentDef({ + skip_permissions_args: ['--full-auto', '--stale-extra'], + }), + ); + + expect(restored.skip_permissions_args).toEqual(['--dangerously-bypass-approvals-and-sandbox']); + }); + + it('leaves non-Codex --full-auto skip-permissions args unchanged', async () => { + const restored = await loadPersistedAgent( + agentDef({ + id: 'custom-agent', + name: 'Custom Agent', + command: 'custom', + skip_permissions_args: ['--full-auto'], + }), + ); + + expect(restored.skip_permissions_args).toEqual(['--full-auto']); + }); + + it('leaves current Codex skip-permissions args unchanged', async () => { + const restored = await loadPersistedAgent( + agentDef({ + skip_permissions_args: ['--dangerously-bypass-approvals-and-sandbox'], + }), + ); + + expect(restored.skip_permissions_args).toEqual(['--dangerously-bypass-approvals-and-sandbox']); + }); +}); diff --git a/src/store/persistence.ts b/src/store/persistence.ts index 798bfaf2..1da63630 100644 --- a/src/store/persistence.ts +++ b/src/store/persistence.ts @@ -28,6 +28,9 @@ function enrichAgentDef(agentDef: AgentDef | null | undefined, availableAgents: if (!agentDef.skip_permissions_args) agentDef.skip_permissions_args = fresh.skip_permissions_args; } + if (agentDef.id === 'codex' && agentDef.skip_permissions_args?.includes('--full-auto')) { + agentDef.skip_permissions_args = ['--dangerously-bypass-approvals-and-sandbox']; + } } export async function saveState(): Promise { @@ -66,6 +69,7 @@ export async function saveState(): Promise { keybindingMigrationDismissed: store.keybindingMigrationDismissed || undefined, focusMode: store.focusMode || undefined, verboseLogging: store.verboseLogging || undefined, + shareDockerAgentAuth: store.shareDockerAgentAuth || undefined, }; for (const taskId of store.taskOrder) { @@ -96,6 +100,8 @@ export async function saveState(): Promise { savedInitialPrompt: task.savedInitialPrompt, planFileName: task.planFileName, stepsEnabled: task.stepsEnabled, + coordinatorMode: task.coordinatorMode, + coordinatedBy: task.coordinatedBy, }; } @@ -128,6 +134,8 @@ export async function saveState(): Promise { planFileName: task.planFileName, stepsEnabled: task.stepsEnabled, collapsed: true, + coordinatorMode: task.coordinatorMode, + coordinatedBy: task.coordinatedBy, }; } @@ -254,6 +262,7 @@ interface LegacyPersistedState { keybindingMigrationDismissed?: unknown; focusMode?: unknown; verboseLogging?: unknown; + shareDockerAgentAuth?: unknown; } export async function loadState(): Promise { @@ -393,6 +402,8 @@ export async function loadState(): Promise { s.verboseLogging = typeof raw.verboseLogging === 'boolean' ? raw.verboseLogging : false; + s.shareDockerAgentAuth = raw.shareDockerAgentAuth === true; + const rawDockerImage = raw.dockerImage; s.dockerImage = typeof rawDockerImage === 'string' && rawDockerImage.trim() @@ -470,6 +481,8 @@ export async function loadState(): Promise { savedInitialPrompt: pt.savedInitialPrompt, planFileName: pt.planFileName, stepsEnabled: pt.stepsEnabled, + coordinatorMode: pt.coordinatorMode, + coordinatedBy: pt.coordinatedBy, }; s.tasks[taskId] = task; @@ -547,6 +560,8 @@ export async function loadState(): Promise { stepsEnabled: pt.stepsEnabled, collapsed: true, savedAgentDef: agentDef ?? undefined, + coordinatorMode: pt.coordinatorMode, + coordinatedBy: pt.coordinatedBy, }; s.tasks[taskId] = task; diff --git a/src/store/sidebar-order.ts b/src/store/sidebar-order.ts index a5f849ba..21c52da4 100644 --- a/src/store/sidebar-order.ts +++ b/src/store/sidebar-order.ts @@ -6,7 +6,42 @@ export interface GroupedSidebarTasks { orphanedCollapsed: string[]; } -/** Group tasks by project: active first, then collapsed. Tasks without a valid project go to orphans. */ +/** + * Get ordered child task IDs for a coordinator, preserving taskOrder ordering. + * Returns both active and collapsed children separately. + */ +export function getCoordinatorChildren(coordinatorId: string): { + active: string[]; + collapsed: string[]; +} { + const active: string[] = []; + const collapsed: string[] = []; + for (const taskId of store.taskOrder) { + if (store.tasks[taskId]?.coordinatedBy === coordinatorId) { + active.push(taskId); + } + } + for (const taskId of store.collapsedTaskOrder) { + const task = store.tasks[taskId]; + if (task?.collapsed && task.coordinatedBy === coordinatorId) { + collapsed.push(taskId); + } + } + return { active, collapsed }; +} + +/** + * Check if a task is a child of any coordinator. + */ +export function isCoordinatedChild(taskId: string): boolean { + const task = store.tasks[taskId]; + if (!task?.coordinatedBy) return false; + // Only treat as child if the coordinator still exists + return !!store.tasks[task.coordinatedBy]; +} + +/** Group tasks by project: active first, then collapsed. Tasks without a valid project go to orphans. + * Coordinated children are excluded from the flat list — they render nested under their coordinator. */ export function computeGroupedTasks(): GroupedSidebarTasks { const grouped: Record = {}; const orphanedActive: string[] = []; @@ -16,6 +51,8 @@ export function computeGroupedTasks(): GroupedSidebarTasks { for (const taskId of store.taskOrder) { const task = store.tasks[taskId]; if (!task) continue; + // Skip coordinated children — they'll be rendered nested under their coordinator + if (isCoordinatedChild(taskId)) continue; if (task.projectId && projectIds.has(task.projectId)) { (grouped[task.projectId] ??= { active: [], collapsed: [] }).active.push(taskId); } else { @@ -26,6 +63,8 @@ export function computeGroupedTasks(): GroupedSidebarTasks { for (const taskId of store.collapsedTaskOrder) { const task = store.tasks[taskId]; if (!task?.collapsed) continue; + // Skip coordinated children + if (isCoordinatedChild(taskId)) continue; if (task.projectId && projectIds.has(task.projectId)) { (grouped[task.projectId] ??= { active: [], collapsed: [] }).collapsed.push(taskId); } else { diff --git a/src/store/store.ts b/src/store/store.ts index 3d58db0e..15b4fb76 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -54,6 +54,9 @@ export { setStepsContent, setTaskStepsEnabled, setTaskLastInputAt, + initMCPListeners, + getCoordinatorCloseWarning, + setTaskControl, } from './tasks'; export { setActiveTask, @@ -61,6 +64,7 @@ export { navigateTask, navigateAgent, moveActiveTask, + jumpToTask, toggleNewTaskDialog, } from './navigation'; export { @@ -114,6 +118,7 @@ export { setEditorCommand, setDockerImage, setDockerAvailable, + setShareDockerAgentAuth, setAskCodeProvider, setMinimaxApiKey, setWindowState, @@ -160,3 +165,9 @@ export { checkConflict, dismissMigrationBanner, } from './keybindings'; +export { + hasAnyCoordinatorTask, + refreshMCPStatus, + startMCPStatusPolling, + stopMCPStatusPolling, +} from './mcpStatus'; diff --git a/src/store/taskStatus.ts b/src/store/taskStatus.ts index 716eadbf..4ee797cb 100644 --- a/src/store/taskStatus.ts +++ b/src/store/taskStatus.ts @@ -95,6 +95,7 @@ export type TaskDotStatus = 'busy' | 'waiting' | 'ready' | 'review'; export type TaskAttentionState = 'idle' | 'active' | 'needs_input' | 'error' | 'ready'; // --- Prompt detection helpers --- +// Re-exported from shared module for backward compatibility. /** Strip ANSI escape sequences (CSI, OSC, and single-char escapes) from terminal output. */ export function stripAnsi(text: string): string { diff --git a/src/store/tasks.ts b/src/store/tasks.ts index ab1fb3fd..341d667d 100644 --- a/src/store/tasks.ts +++ b/src/store/tasks.ts @@ -26,6 +26,8 @@ import type { import { parseGitHubUrl, taskNameFromGitHubUrl } from '../lib/github-url'; import type { Agent, Task, GitIsolationMode } from './types'; import type { DockerSource } from '../lib/docker'; +import { COORDINATOR_PREAMBLE } from './coordinator-preamble'; +import { getCoordinatorChildren } from './sidebar-order'; function initTaskInStore( taskId: string, @@ -111,6 +113,7 @@ export interface CreateTaskOptions { dockerSource?: DockerSource; dockerImage?: string; stepsEnabled?: boolean; + coordinatorMode?: boolean; } export async function createTask(opts: CreateTaskOptions): Promise { @@ -163,6 +166,25 @@ export async function createTask(opts: CreateTaskOptions): Promise { worktreePath = projectRoot; } + // Start MCP server BEFORE adding task to store — the store update triggers + // a reactive render of TerminalView which spawns the PTY immediately. + // If mcpConfigPath isn't set yet, the --mcp-config arg is missing. + let mcpConfigPath: string | undefined; + if (opts.coordinatorMode) { + try { + const mcpResult = await invoke<{ configPath: string }>(IPC.StartMCPServer, { + coordinatorTaskId: taskId, + projectId, + projectRoot, + worktreePath: gitIsolation === 'worktree' ? worktreePath : undefined, + }); + mcpConfigPath = mcpResult.configPath; + console.warn('[MCP] Coordinator config path:', mcpConfigPath); + } catch (err) { + console.warn('[MCP] Failed to start MCP server for coordinator:', err); + } + } + const agentId = crypto.randomUUID(); // Per-task steps tracking — explicit opt-in from dialog, or fall back to last-used preference @@ -189,7 +211,10 @@ export async function createTask(opts: CreateTaskOptions): Promise { shellAgentIds: [], notes: '', lastPrompt: '', - initialPrompt: effectivePrompt ?? undefined, + initialPrompt: + opts.coordinatorMode && effectivePrompt + ? COORDINATOR_PREAMBLE + effectivePrompt + : (effectivePrompt ?? undefined), savedInitialPrompt: initialPrompt ?? undefined, stepsEnabled: stepsEnabled || undefined, skipPermissions: skipPermissions ?? undefined, @@ -197,6 +222,8 @@ export async function createTask(opts: CreateTaskOptions): Promise { dockerSource: dockerSource ?? undefined, dockerImage: dockerImage ?? undefined, githubUrl, + coordinatorMode: opts.coordinatorMode || undefined, + mcpConfigPath, }; const agent: Agent = { @@ -212,6 +239,7 @@ export async function createTask(opts: CreateTaskOptions): Promise { }; initTaskInStore(taskId, task, agent, projectId, agentDef); + saveState(); // fire-and-forget — errors handled internally return taskId; } @@ -280,10 +308,40 @@ export async function createImportedTask(opts: CreateImportedTaskOptions): Promi return id; } +/** + * Check if closing a coordinator would leave orphaned children. + * Returns a warning message if so, or null if safe to close. + */ +export function getCoordinatorCloseWarning(taskId: string): string | null { + const task = store.tasks[taskId]; + if (!task?.coordinatorMode) return null; + const children = getCoordinatorChildren(taskId); + const count = children.active.length + children.collapsed.length; + if (count === 0) return null; + return `This coordinator has ${count} active sub-task(s). Closing it will detach them — they will become standalone tasks and continue running independently.`; +} + export async function closeTask(taskId: string): Promise { const task = store.tasks[taskId]; if (!task || task.closingStatus === 'closing' || task.closingStatus === 'removing') return; + // If this is a coordinator, unparent all children first + if (task.coordinatorMode) { + const children = getCoordinatorChildren(taskId); + const allChildIds = [...children.active, ...children.collapsed]; + if (allChildIds.length > 0) { + setStore( + produce((s) => { + for (const childId of allChildIds) { + if (s.tasks[childId]) { + s.tasks[childId].coordinatedBy = undefined; + } + } + }), + ); + } + } + const agentIds = [...task.agentIds]; const shellAgentIds = [...task.shellAgentIds]; const branchName = task.branchName; @@ -712,6 +770,118 @@ export function setNewTaskPrefillPrompt(prompt: string, projectId: string | null setStore('newTaskPrefillPrompt', { prompt, projectId }); } +// --- MCP orchestrator event listeners --- + +interface MCPTaskCreatedEvent { + taskId: string; + name: string; + projectId: string; + branchName: string; + worktreePath: string; + agentId: string; + coordinatorTaskId: string; + prompt?: string; +} + +/** Call once during app initialization to listen for orchestrator events. */ +export function initMCPListeners(): () => void { + const cleanups: Array<() => void> = []; + + cleanups.push( + window.electron.ipcRenderer.on(IPC.MCP_TaskCreated, (data: unknown) => { + const evt = data as MCPTaskCreatedEvent; + const task: Task = { + id: evt.taskId, + name: evt.name, + projectId: evt.projectId, + branchName: evt.branchName, + worktreePath: evt.worktreePath, + agentIds: [evt.agentId], + shellAgentIds: [], + notes: '', + lastPrompt: '', + gitIsolation: 'worktree', + coordinatedBy: evt.coordinatorTaskId, + // Use the same initialPrompt path as manually created tasks — + // PromptInput auto-delivers it with stability checks + quiescence. + initialPrompt: evt.prompt, + }; + + const agent: Agent = { + id: evt.agentId, + taskId: evt.taskId, + def: { + id: 'claude', + name: 'Claude Code', + command: 'claude', + args: [], + resume_args: [], + skip_permissions_args: [], + description: '', + }, + resumed: false, + status: 'running', + exitCode: null, + signal: null, + lastOutput: [], + generation: 0, + }; + + setStore( + produce((s) => { + s.tasks[evt.taskId] = task; + s.agents[evt.agentId] = agent; + s.taskOrder.push(evt.taskId); + }), + ); + markAgentSpawned(evt.agentId); + rescheduleTaskStatusPolling(); + }), + ); + + cleanups.push( + window.electron.ipcRenderer.on(IPC.MCP_TaskClosed, (data: unknown) => { + const { taskId } = data as { taskId: string }; + const task = store.tasks[taskId]; + if (!task) return; + + const agentIds = [...task.agentIds]; + for (const agentId of agentIds) { + clearAgentActivity(agentId); + } + + setStore( + produce((s) => { + delete s.tasks[taskId]; + delete s.taskGitStatus[taskId]; + cleanupPanelEntries(s, taskId); + for (const agentId of agentIds) { + delete s.agents[agentId]; + } + if (s.activeTaskId === taskId) { + const idx = s.taskOrder.indexOf(taskId); + const filtered = s.taskOrder.filter((id) => id !== taskId); + const neighborIdx = idx <= 0 ? 0 : idx - 1; + s.activeTaskId = filtered[neighborIdx] ?? null; + const neighbor = s.activeTaskId ? s.tasks[s.activeTaskId] : null; + s.activeAgentId = neighbor?.agentIds[0] ?? null; + } + }), + ); + rescheduleTaskStatusPolling(); + }), + ); + + return () => { + for (const cleanup of cleanups) cleanup(); + }; +} + +export function setTaskControl(taskId: string, who: 'orchestrator' | 'human'): void { + setStore('tasks', taskId, 'controlledBy', who); + invoke(IPC.MCP_ControlChanged, { taskId, controlledBy: who }).catch(() => {}); +} + export function setPlanContent( taskId: string, content: string | null, diff --git a/src/store/types.ts b/src/store/types.ts index b1c9f987..e49faf4e 100644 --- a/src/store/types.ts +++ b/src/store/types.ts @@ -73,6 +73,10 @@ export interface Task { stepsEnabled?: boolean; stepsContent?: StepEntry[]; lastInputAt?: string; + coordinatorMode?: boolean; + coordinatedBy?: string; // taskId of the coordinator that created this task + controlledBy?: 'orchestrator' | 'human'; // only set on tasks with coordinatedBy + mcpConfigPath?: string; // path to MCP config file (for coordinator tasks) } export interface Terminal { @@ -105,6 +109,8 @@ export interface PersistedTask { collapsed?: boolean; planFileName?: string; stepsEnabled?: boolean; + coordinatorMode?: boolean; + coordinatedBy?: string; } export interface PersistedTerminal { @@ -153,6 +159,7 @@ export interface PersistedState { inactiveColumnOpacity?: number; editorCommand?: string; dockerImage?: string; + shareDockerAgentAuth?: boolean; askCodeProvider?: 'claude' | 'minimax'; customAgents?: AgentDef[]; keybindingMigrationDismissed?: boolean; @@ -179,10 +186,17 @@ export interface RemoteAccess { connectedClients: number; } +export interface MCPStatus { + mcpRunning: boolean; + remoteRunning: boolean; +} + export interface AppStore { projects: Project[]; lastProjectId: string | null; lastAgentId: string | null; + /** Ordered active task IDs. Coordinated children are present here but filtered + * out of the sidebar's flat list — they render nested under their coordinator. */ taskOrder: string[]; collapsedTaskOrder: string[]; tasks: Record; @@ -230,11 +244,13 @@ export interface AppStore { editorCommand: string; dockerImage: string; dockerAvailable: boolean; + shareDockerAgentAuth: boolean; askCodeProvider: 'claude' | 'minimax'; newTaskDropUrl: string | null; newTaskPrefillPrompt: { prompt: string; projectId: string | null } | null; missingProjectIds: Record; remoteAccess: RemoteAccess; + mcpStatus: MCPStatus; showArena: boolean; keybindingPreset: string; /** Per-preset user overrides. Outer key = preset ID, inner = binding ID → override. */ diff --git a/src/store/ui.ts b/src/store/ui.ts index 18278a29..08e52fcd 100644 --- a/src/store/ui.ts +++ b/src/store/ui.ts @@ -135,6 +135,10 @@ export function setDockerAvailable(available: boolean): void { setStore('dockerAvailable', available); } +export function setShareDockerAgentAuth(enabled: boolean): void { + setStore('shareDockerAgentAuth', enabled); +} + export function toggleArena(show?: boolean): void { setStore('showArena', show ?? !store.showArena); }