New workspace create page (#710)

* New workspace page with agent catalog, composer modal, and terminal integration

* fix lint

* better blank state

* fix: resolve typecheck errors in new-workspace flow

- widen activateAndRevealWorktree's issueCommand to accept direct
  command shape used by NewWorkspacePage, not just the main-process
  runner-script variant
- use a ref object in pty-connection tests to dodge TS narrowing the
  captured callback to never across the mock closure boundary

* fix: bound worktree name auto-suffix loop to prevent OOM in tests

The auto-suffix loop in createLocalWorktree had no termination cap.
When tests (or a misconfigured env) mocked getBranchConflictKind /
getPRForBranch to always return a collision, the loop ran forever and
the vitest worker crashed with "Ineffective mark-compacts near heap
limit".

Cap the search at 100 suffixes, and if all fail, fall back to the
original specific error messages (branch already exists / PR already
owns the name) instead of a generic failure.

Update the two tests that asserted the old throw-on-first-conflict
behavior to verify the new auto-suffix path end-to-end.
This commit is contained in:
Neil
2026-04-16 15:41:40 -07:00
committed by GitHub
parent c8a8ef1b5c
commit d2a53c8fcc
52 changed files with 5699 additions and 1052 deletions
+4 -1
View File
@@ -117,7 +117,10 @@ export function getDefaultSettings(homedir: string): GlobalSettings {
promptCacheTtlMs: 300_000,
codexManagedAccounts: [],
activeCodexManagedAccountId: null,
terminalScopeHistoryByWorktree: true
terminalScopeHistoryByWorktree: true,
defaultTuiAgent: null,
defaultTaskViewPreset: 'all',
agentCmdOverrides: {}
}
}
+155
View File
@@ -0,0 +1,155 @@
import type { TuiAgent } from './types'
export type AgentPromptInjectionMode =
| 'argv'
| 'flag-prompt'
| 'flag-prompt-interactive'
| 'stdin-after-start'
export type TuiAgentConfig = {
detectCmd: string
launchCmd: string
expectedProcess: string
promptInjectionMode: AgentPromptInjectionMode
}
// Why: the new-workspace handoff depends on three pieces of per-agent
// knowledge staying in sync: how Orca detects the agent on PATH, which binary
// it actually launches, and whether the initial prompt should be passed as an
// argv flag/argument or typed into the interactive session after startup.
// Centralizing that metadata prevents the picker, launcher, and preflight
// checks from quietly drifting apart as new agents are added.
export const TUI_AGENT_CONFIG: Record<TuiAgent, TuiAgentConfig> = {
claude: {
detectCmd: 'claude',
launchCmd: 'claude',
expectedProcess: 'claude',
promptInjectionMode: 'argv'
},
codex: {
detectCmd: 'codex',
launchCmd: 'codex',
expectedProcess: 'codex',
promptInjectionMode: 'argv'
},
opencode: {
detectCmd: 'opencode',
launchCmd: 'opencode',
expectedProcess: 'opencode',
promptInjectionMode: 'flag-prompt'
},
pi: {
detectCmd: 'pi',
launchCmd: 'pi',
expectedProcess: 'pi',
promptInjectionMode: 'argv'
},
gemini: {
detectCmd: 'gemini',
launchCmd: 'gemini',
expectedProcess: 'gemini',
promptInjectionMode: 'flag-prompt-interactive'
},
aider: {
detectCmd: 'aider',
launchCmd: 'aider',
expectedProcess: 'aider',
promptInjectionMode: 'stdin-after-start'
},
goose: {
detectCmd: 'goose',
launchCmd: 'goose',
expectedProcess: 'goose',
promptInjectionMode: 'stdin-after-start'
},
amp: {
detectCmd: 'amp',
launchCmd: 'amp',
expectedProcess: 'amp',
promptInjectionMode: 'stdin-after-start'
},
kilo: {
detectCmd: 'kilo',
launchCmd: 'kilo',
expectedProcess: 'kilo',
promptInjectionMode: 'stdin-after-start'
},
kiro: {
detectCmd: 'kiro',
launchCmd: 'kiro',
expectedProcess: 'kiro',
promptInjectionMode: 'stdin-after-start'
},
crush: {
detectCmd: 'crush',
launchCmd: 'crush',
expectedProcess: 'crush',
promptInjectionMode: 'stdin-after-start'
},
aug: {
detectCmd: 'aug',
launchCmd: 'aug',
expectedProcess: 'aug',
promptInjectionMode: 'stdin-after-start'
},
cline: {
detectCmd: 'cline',
launchCmd: 'cline',
expectedProcess: 'cline',
promptInjectionMode: 'stdin-after-start'
},
codebuff: {
detectCmd: 'codebuff',
launchCmd: 'codebuff',
expectedProcess: 'codebuff',
promptInjectionMode: 'stdin-after-start'
},
continue: {
detectCmd: 'continue',
launchCmd: 'continue',
expectedProcess: 'continue',
promptInjectionMode: 'stdin-after-start'
},
cursor: {
detectCmd: 'cursor-agent',
launchCmd: 'cursor-agent',
expectedProcess: 'cursor-agent',
promptInjectionMode: 'argv'
},
droid: {
detectCmd: 'droid',
launchCmd: 'droid',
expectedProcess: 'droid',
promptInjectionMode: 'argv'
},
kimi: {
detectCmd: 'kimi',
launchCmd: 'kimi',
expectedProcess: 'kimi',
promptInjectionMode: 'stdin-after-start'
},
'mistral-vibe': {
detectCmd: 'mistral-vibe',
launchCmd: 'mistral-vibe',
expectedProcess: 'mistral-vibe',
promptInjectionMode: 'stdin-after-start'
},
'qwen-code': {
detectCmd: 'qwen-code',
launchCmd: 'qwen-code',
expectedProcess: 'qwen-code',
promptInjectionMode: 'stdin-after-start'
},
rovo: {
detectCmd: 'rovo',
launchCmd: 'rovo',
expectedProcess: 'rovo',
promptInjectionMode: 'stdin-after-start'
},
hermes: {
detectCmd: 'hermes',
launchCmd: 'hermes',
expectedProcess: 'hermes',
promptInjectionMode: 'stdin-after-start'
}
}
+48
View File
@@ -352,6 +352,20 @@ export type GitHubViewer = {
email: string | null
}
export type GitHubWorkItem = {
id: string
type: 'issue' | 'pr'
number: number
title: string
state: 'open' | 'closed' | 'merged' | 'draft'
url: string
labels: string[]
updatedAt: string
author: string | null
branchName?: string
baseRefName?: string
}
// ─── Hooks (orca.yaml) ──────────────────────────────────────────────
export type OrcaHooks = {
scripts: {
@@ -466,6 +480,34 @@ export type CodexRateLimitAccountsState = {
activeAccountId: string | null
}
/** All AI coding agents Orca knows how to launch. Used for the agent picker in the new-workspace
* flow and for the default-agent setting. Extend this union as new agents are added. */
export type TuiAgent =
| 'claude' // Claude Code
| 'codex' // OpenAI Codex
| 'opencode' // OpenCode
| 'pi' // Pi (pi.dev)
| 'gemini' // Gemini CLI
| 'aider' // Aider
| 'goose' // Goose
| 'amp' // Amp
| 'kilo' // Kilocode
| 'kiro' // Kiro
| 'crush' // Charm/Crush
| 'aug' // Augment/Auggie
| 'cline' // Cline
| 'codebuff' // Codebuff
| 'continue' // Continue
| 'cursor' // Cursor
| 'droid' // Factory Droid
| 'kimi' // Kimi
| 'mistral-vibe' // Mistral Vibe
| 'qwen-code' // Qwen Code
| 'rovo' // Rovo Dev
| 'hermes' // Hermes Agent
export type TaskViewPresetId = 'all' | 'issues' | 'review' | 'my-issues' | 'my-prs' | 'prs'
export type GlobalSettings = {
workspaceDir: string
nestWorkspaces: boolean
@@ -522,6 +564,12 @@ export type GlobalSettings = {
* does not surface commands from other worktrees. Defaults to true.
* Disable to revert to shared global shell history. */
terminalScopeHistoryByWorktree: boolean
/** Which agent to pre-select in the new-workspace composer. null = auto (first detected). */
defaultTuiAgent: TuiAgent | null
/** Default preset in the new-workspace GitHub task view. */
defaultTaskViewPreset: TaskViewPresetId
/** Per-agent CLI command overrides. A missing key means use the catalog default binary name. */
agentCmdOverrides: Partial<Record<TuiAgent, string>>
}
export type NotificationEventSource = 'agent-task-complete' | 'terminal-bell' | 'test'