* Revert "fix(terminal): add proportional scroll fallback for sidebar resize" (#937) * fix(sidebar): smoothly animate off-screen worktree reveal on click (#1302) Clicking a worktree card whose row lies outside the sidebar viewport caused an instant jump when scrolling it into view. Switching `scrollToIndex` to `behavior: 'smooth'` turns that minimum-distance scroll into an animated slide while keeping `align: 'auto'` so visible cards still no-op (no re-centering). Co-authored-by: Orca <help@stably.ai> * Avoid local scrollback serialization on shutdown (#1821) * Fix PR refresh coordinator test arguments (#2545) * release: v1.4.31 * release: v1.4.31 * release: v1.4.31 * release: v1.4.31 * release: v1.4.31 * release: v1.4.31 * release: v1.4.31 * release: v1.4.36-rc.6 * release: v1.4.36-rc.6 * release: v1.4.36-rc.6 * ci: gate release-cut to the canonical repo so it skips forks (#4815) The cut job checks out main, bumps package.json's version, and fast-forwards main. On a fork with Actions enabled, the scheduled RC cut runs against the fork's main and diverges it on the version line every slot, so that contributor's PRs back to upstream conflict on package.json even when their change never touches it. Gate the job to github.repository == 'stablyai/orca' so it (and the jobs that depend on it) no-op on forks. Canonical scheduled and manual cuts are unaffected. * feat(hooks): install Devin managed status hooks * feat(devin): address hook review, resume, and UI polish - Parse Devin config.json as JSONC; warn on read_config_from overlap - Windows hook command uses forward slashes; APPDATA fallback - Add devin to sleeping-agent resume and UI registries (plan 003/004) - Add hook-service and hook-config-json tests Closes follow-up for plans 002–004 on feat/add-devin-agent. * feat(devin): scan ATIF transcripts for AI Vault Register devin in AI_VAULT_AGENTS, discover ~/.local/share/devin/cli/transcripts (or DEVIN_HOME), parse ATIF JSON sessions, and build devin --resume commands. * docs(devin): clarify stdin-after-start vs bracketed paste * fix(devin): use JSONC for remote install, add partial+APPDATA tests - installRemote: replace readHooksJsonRemote (JSON.parse) with readTextFileRemote + parseJsonc for JSONC compatibility on SSH - Add partial status test (some hooks missing → state:'partial') - Add Windows APPDATA config path test with fallback * fix(devin): address CodeRabbit review — sessionId fallback, parseJsonc errors, comment, i18n * Fix Devin integration edge cases Co-authored-by: Orca <help@stably.ai> * Package Devin JSONC parser dependency Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com> Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Co-authored-by: Orca <help@stably.ai> Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Trevin Chow <trevin@trevinchow.com> Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
290 lines
10 KiB
TypeScript
290 lines
10 KiB
TypeScript
import { ipcMain } from 'electron'
|
|
import type { AgentHookInstallStatus } from '../../shared/agent-hook-types'
|
|
import type {
|
|
AgentStatusIpcPayload,
|
|
MigrationUnsupportedPtyEntry
|
|
} from '../../shared/agent-status-types'
|
|
import type { AgentInterruptInferenceRequest } from '../../shared/agent-interrupt-intent'
|
|
import type { OrcaRuntimeService } from '../runtime/orca-runtime'
|
|
import { agentHookServer, isValidPaneKey } from '../agent-hooks/server'
|
|
import { ampHookService } from '../amp/hook-service'
|
|
import {
|
|
clearMigrationUnsupportedPtysForPaneKey,
|
|
getMigrationUnsupportedPtySnapshot
|
|
} from '../agent-hooks/migration-unsupported-pty-state'
|
|
import { claudeHookService } from '../claude/hook-service'
|
|
import { codexHookService } from '../codex/hook-service'
|
|
import { geminiHookService } from '../gemini/hook-service'
|
|
import { antigravityHookService } from '../antigravity/hook-service'
|
|
import { cursorHookService } from '../cursor/hook-service'
|
|
import { droidHookService } from '../droid/hook-service'
|
|
import { commandCodeHookService } from '../command-code/hook-service'
|
|
import { grokHookService } from '../grok/hook-service'
|
|
import { copilotHookService } from '../copilot/hook-service'
|
|
import { hermesHookService } from '../hermes/hook-service'
|
|
import { devinHookService } from '../devin/hook-service'
|
|
import { openClaudeHookService } from '../openclaude/hook-service'
|
|
|
|
type AgentStatusRuntimeEnrichment = Pick<
|
|
OrcaRuntimeService,
|
|
'getAgentStatusTerminalHandleForPaneKey' | 'getAgentStatusOrchestrationContextForPaneKey'
|
|
>
|
|
|
|
function enrichAgentStatusIpcPayload(
|
|
data: AgentStatusIpcPayload,
|
|
runtime: AgentStatusRuntimeEnrichment | undefined
|
|
): AgentStatusIpcPayload {
|
|
if (!runtime) {
|
|
return data
|
|
}
|
|
const terminalHandle = runtime.getAgentStatusTerminalHandleForPaneKey(data.paneKey)
|
|
const orchestration = runtime.getAgentStatusOrchestrationContextForPaneKey(data.paneKey)
|
|
return {
|
|
...data,
|
|
...(terminalHandle ? { terminalHandle } : {}),
|
|
...(orchestration ? { orchestration } : {})
|
|
}
|
|
}
|
|
|
|
// Why: install/remove are intentionally not exposed to the renderer. Orca
|
|
// auto-installs managed hooks at app startup (see src/main/index.ts), so a
|
|
// renderer-triggered remove would be silently reverted on the next launch
|
|
// and mislead the user.
|
|
export function registerAgentHookHandlers(runtime?: AgentStatusRuntimeEnrichment): void {
|
|
// Why: matches the defensive pattern in src/main/ipc/pty.ts so re-registration
|
|
// never throws "Attempted to register a second handler..." if this function is
|
|
// ever invoked more than once (e.g. the macOS app re-activation path that
|
|
// recreates the main window). Today the module-level `registered` guard in
|
|
// register-core-handlers.ts prevents re-entry, but decoupling from that guard
|
|
// future-proofs this file.
|
|
ipcMain.removeHandler('agentHooks:claudeStatus')
|
|
ipcMain.removeHandler('agentHooks:openClaudeStatus')
|
|
ipcMain.removeHandler('agentHooks:codexStatus')
|
|
ipcMain.removeHandler('agentHooks:geminiStatus')
|
|
ipcMain.removeHandler('agentHooks:antigravityStatus')
|
|
ipcMain.removeHandler('agentHooks:ampStatus')
|
|
ipcMain.removeHandler('agentHooks:cursorStatus')
|
|
ipcMain.removeHandler('agentHooks:droidStatus')
|
|
ipcMain.removeHandler('agentHooks:commandCodeStatus')
|
|
ipcMain.removeHandler('agentHooks:grokStatus')
|
|
ipcMain.removeHandler('agentHooks:copilotStatus')
|
|
ipcMain.removeHandler('agentHooks:hermesStatus')
|
|
ipcMain.removeHandler('agentHooks:devinStatus')
|
|
ipcMain.removeHandler('agentStatus:getSnapshot')
|
|
ipcMain.removeHandler('agentStatus:inferInterrupt')
|
|
ipcMain.removeHandler('agentStatus:getMigrationUnsupportedSnapshot')
|
|
// Why: agentStatus:drop is sent fire-and-forget from the renderer via
|
|
// ipcRenderer.send(); we listen with ipcMain.on (not handle) so we don't
|
|
// round-trip a response. Removing first keeps re-registration safe even
|
|
// though the module-level registered guard already prevents re-entry today.
|
|
ipcMain.removeAllListeners('agentStatus:drop')
|
|
ipcMain.on('agentStatus:drop', (_event, paneKey: unknown) => {
|
|
if (typeof paneKey !== 'string' || !isValidPaneKey(paneKey)) {
|
|
return
|
|
}
|
|
try {
|
|
// Why: dropStatusEntry (not clearPaneState) is correct here — the user is
|
|
// dismissing a status row, not tearing down a PTY. clearPaneState would also
|
|
// wipe the per-pane prompt/tool caches, which the next hook event for that
|
|
// (still-alive) pane needs to render a coherent row.
|
|
agentHookServer.dropStatusEntry(paneKey)
|
|
clearMigrationUnsupportedPtysForPaneKey(paneKey)
|
|
} catch (err) {
|
|
console.warn('[agent-hooks] dropStatusEntry failed:', err)
|
|
}
|
|
})
|
|
ipcMain.handle('agentStatus:getSnapshot', (): AgentStatusIpcPayload[] => {
|
|
// Why: the renderer pulls this after workspace hydration, so startup cannot
|
|
// lose replayed statuses while its local store is still empty. Match the
|
|
// live push enrichment in main/index.ts so parent/child rows survive replay.
|
|
return agentHookServer
|
|
.getStatusSnapshot()
|
|
.map((entry) => enrichAgentStatusIpcPayload(entry, runtime))
|
|
})
|
|
ipcMain.handle('agentStatus:inferInterrupt', (_event, request: unknown): boolean => {
|
|
if (typeof request !== 'object' || request === null) {
|
|
return false
|
|
}
|
|
return agentHookServer.inferInterrupt(request as AgentInterruptInferenceRequest)
|
|
})
|
|
ipcMain.handle(
|
|
'agentStatus:getMigrationUnsupportedSnapshot',
|
|
(): MigrationUnsupportedPtyEntry[] => getMigrationUnsupportedPtySnapshot()
|
|
)
|
|
|
|
// Why: errors from getStatus() (fs permission denied, homedir resolution
|
|
// failure, etc.) must be reported inline via state:'error' so the sidebar can
|
|
// render a coherent per-agent error row. Letting the exception propagate out
|
|
// of the IPC handler surfaces as an unhandled renderer-side rejection, which
|
|
// defeats the AgentHookInstallStatus contract the UI relies on.
|
|
ipcMain.handle('agentHooks:claudeStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return claudeHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'claude',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:openClaudeStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return openClaudeHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'openclaude',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:codexStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return codexHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'codex',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:geminiStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return geminiHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'gemini',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:antigravityStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return antigravityHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'antigravity',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:ampStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return ampHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'amp',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:cursorStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return cursorHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'cursor',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:droidStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return droidHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'droid',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:commandCodeStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return commandCodeHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'command-code',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:grokStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return grokHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'grok',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:copilotStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return copilotHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'copilot',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:hermesStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return hermesHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'hermes',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
ipcMain.handle('agentHooks:devinStatus', (): AgentHookInstallStatus => {
|
|
try {
|
|
return devinHookService.getStatus()
|
|
} catch (err) {
|
|
return {
|
|
agent: 'devin',
|
|
state: 'error',
|
|
configPath: '',
|
|
managedHooksPresent: false,
|
|
detail: err instanceof Error ? err.message : String(err)
|
|
}
|
|
}
|
|
})
|
|
}
|