Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(prompt): replace unsupported window.prompt with an in-app InputDialog
enes96246c866add
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsxindex aca350f22..a48a085cd 100644--- a/src/renderer/App.tsx+++ b/src/renderer/App.tsx@@ -1,10 +1,13 @@import { ReactFlowProvider } from '@xyflow/react'import { Canvas } from './canvas/Canvas'+import { PromptDialogHost } from './components/promptDialog'export default function App() {return (<ReactFlowProvider><Canvas />+ {/* In-app window.prompt replacement (Electron has no prompt); driven by promptDialog(). */}+ <PromptDialogHost /></ReactFlowProvider>)}diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex b777c03bf..aa3e5447f 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -59,6 +59,7 @@ import { ShortcutsPanel } from '../components/ShortcutsPanel'import { UpdateCard } from '../components/UpdateCard'import { AnnouncementBanner } from '../components/AnnouncementBanner'import { ConfirmDialog } from '../components/ConfirmDialog'+import { promptDialog } from '../components/promptDialog'import { UpgradeDialog } from '../components/UpgradeDialog'import { RemotePicker } from '../components/RemotePicker'import { BindWorktreeDialog, type BindWorktreeValue } from '../components/BindWorktreeDialog'@@ -1030,7 +1031,7 @@ export function Canvas() {// and open the live mirror over the local canvas. This is the primary remote entry (it replaces// B4's lone remote-terminal-on-connect flow).const connectRemote = useCallback(async () => {- const offer = window.prompt("Paste the host's pairing code:")?.trim()+ const offer = (await promptDialog({ message: "Paste the host's pairing code:" }))?.trim()if (!offer) returntry {const connectionId = await window.nodeTerminal.remoteClient.connect(offer)@@ -1141,7 +1142,7 @@ export function Canvas() {)const cloneRepo = useCallback(async () => {- const url = window.prompt('Repository URL (https:// or git@):')+ const url = await promptDialog({ message: 'Repository URL (https:// or git@):' })if (!url) returnconst parent = await window.nodeTerminal.dialog.selectFolder()if (!parent) return@@ -1174,8 +1175,8 @@ export function Canvas() {)const addWebView = useCallback(- (center?: { x: number; y: number }) => {- const input = window.prompt('Open web view — enter a URL:')+ async (center?: { x: number; y: number }) => {+ const input = await promptDialog({ message: 'Open web view — enter a URL:' })const url = input?.trim()if (!url) returnsetNodes((ns) => [...ns, createWebNode(ns.length, { url }, center ?? viewCenter())])@@ -2495,8 +2496,9 @@ export function Canvas() {label: 'Rename',icon: <IconEditor />,onClick: () => {- const t = window.prompt('Rename session', '')- if (t && t.trim()) renameSession(projectId, id, t.trim())+ void promptDialog({ message: 'Rename session' }).then((t) => {+ if (t && t.trim()) renameSession(projectId, id, t.trim())+ })}},{diff --git a/src/renderer/components/InputDialog.tsx b/src/renderer/components/InputDialog.tsxnew file mode 100644index 000000000..e55e283a8--- /dev/null+++ b/src/renderer/components/InputDialog.tsx@@ -0,0 +1,69 @@+import { useEffect, useRef, useState } from 'react'+import { createPortal } from 'react-dom'++interface InputDialogProps {+ message: string+ initialValue?: string+ placeholder?: string+ confirmLabel?: string+ cancelLabel?: string+ onSubmit: (value: string) => void+ onCancel: () => void+}++/**+ * A small themed text-input dialog — the in-app replacement for `window.prompt`, which Electron+ * does not support (it throws "prompt() is and will not be supported"). Enter submits, Esc cancels.+ * Reuses the `.confirm*` shell styles; usually driven via the `promptDialog()` singleton helper.+ */+export function InputDialog({+ message,+ initialValue = '',+ placeholder,+ confirmLabel = 'OK',+ cancelLabel = 'Cancel',+ onSubmit,+ onCancel+}: InputDialogProps) {+ const [value, setValue] = useState(initialValue)+ const inputRef = useRef<HTMLInputElement>(null)++ useEffect(() => {+ inputRef.current?.focus()+ inputRef.current?.select()+ }, [])++ return createPortal(+ <div className="confirm-overlay" onClick={onCancel}>+ <div className="confirm" onClick={(e) => e.stopPropagation()}>+ <p className="confirm__msg">{message}</p>+ <input+ ref={inputRef}+ className="confirm__input"+ value={value}+ placeholder={placeholder}+ spellCheck={false}+ onChange={(e) => setValue(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ e.preventDefault()+ onSubmit(value)+ } else if (e.key === 'Escape') {+ e.preventDefault()+ onCancel()+ }+ }}+ />+ <div className="confirm__actions">+ <button className="confirm__btn" onClick={onCancel}>+ {cancelLabel}+ </button>+ <button className="confirm__btn primary" onClick={() => onSubmit(value)}>+ {confirmLabel}+ </button>+ </div>+ </div>+ </div>,+ document.body+ )+}diff --git a/src/renderer/components/SourceControlPanel.tsx b/src/renderer/components/SourceControlPanel.tsxindex 3eec07241..52f168866 100644--- a/src/renderer/components/SourceControlPanel.tsx+++ b/src/renderer/components/SourceControlPanel.tsx@@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'import { createPortal } from 'react-dom'import type { GitFileChange, GitResult, GitStatus } from '@shared/types'import type { GitHistoryItem, GitHistoryResult } from '@shared/git-history'+import { promptDialog } from './promptDialog'import { useProjects } from '../state/projects'import { useSettings } from '../state/settings'import { useSshConn } from '../state/sshConn'@@ -602,8 +603,9 @@ export function SourceControlPanel({void act(() => git.revert(cwd!, item.id))},branchFrom: (item) => {- const name = window.prompt('New branch name (from this commit):')- if (name && name.trim()) void act(() => git.branchAt(cwd!, name.trim(), item.id))+ void promptDialog({ message: 'New branch name (from this commit):' }).then((name) => {+ if (name && name.trim()) void act(() => git.branchAt(cwd!, name.trim(), item.id))+ })},checkout: (item) => {if (!window.confirm(`Check out ${item.displayId || item.id}? This detaches HEAD (you won't be on a branch).`)) return@@ -651,8 +653,11 @@ export function SourceControlPanel({{label: 'Rename Branch…',onClick: () => {- const name = window.prompt('Rename current branch to:', status.branch)- if (name && name.trim()) void act(() => git.renameBranch(cwd!, name.trim()))+ void promptDialog({ message: 'Rename current branch to:', initialValue: status.branch }).then(+ (name) => {+ if (name && name.trim()) void act(() => git.renameBranch(cwd!, name.trim()))+ }+ )}},{diff --git a/src/renderer/components/promptDialog.tsx b/src/renderer/components/promptDialog.tsxnew file mode 100644index 000000000..d71a07da6--- /dev/null+++ b/src/renderer/components/promptDialog.tsx@@ -0,0 +1,68 @@+import { create } from 'zustand'+import { InputDialog } from './InputDialog'++// Promise-based, singleton in-app replacement for window.prompt (unsupported in Electron).+// Call `promptDialog({ message })` and await a `string` (submitted) or `null` (cancelled).+// Render <PromptDialogHost/> once near the app root so any component can call the helper.++interface PromptOptions {+ message: string+ initialValue?: string+ placeholder?: string+ confirmLabel?: string+}++interface PromptState {+ current: (PromptOptions & { resolve: (value: string | null) => void }) | null+ submit: (value: string) => void+ cancel: () => void+}++const usePromptStore = create<PromptState>((set, get) => ({+ current: null,+ submit: (value) => {+ const c = get().current+ if (c) {+ set({ current: null })+ c.resolve(value)+ }+ },+ cancel: () => {+ const c = get().current+ if (c) {+ set({ current: null })+ c.resolve(null)+ }+ }+}))++/** Show the input dialog and resolve with the entered string, or null if cancelled. */+export function promptDialog(options: PromptOptions): Promise<string | null> {+ return new Promise((resolve) => {+ // Only one dialog at a time: cancel any pending one (resolve null) before opening the next.+ const prev = usePromptStore.getState().current+ if (prev) {+ usePromptStore.setState({ current: null })+ prev.resolve(null)+ }+ usePromptStore.setState({ current: { ...options, resolve } })+ })+}++/** Mount once (app root). Renders the active prompt dialog, if any. */+export function PromptDialogHost() {+ const current = usePromptStore((s) => s.current)+ const submit = usePromptStore((s) => s.submit)+ const cancel = usePromptStore((s) => s.cancel)+ if (!current) return null+ return (+ <InputDialog+ message={current.message}+ initialValue={current.initialValue}+ placeholder={current.placeholder}+ confirmLabel={current.confirmLabel}+ onSubmit={submit}+ onCancel={cancel}+ />+ )+}diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex bda52ebfe..4ff905e90 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -2954,6 +2954,23 @@ body,color: var(--text);}+.confirm__input {+ width: 100%;+ box-sizing: border-box;+ margin: 0 0 16px;+ background: rgba(255, 255, 255, 0.06);+ border: 1px solid var(--border);+ border-radius: 8px;+ color: var(--text);+ font-size: 13px;+ padding: 8px 10px;+}++.confirm__input:focus {+ outline: none;+ border-color: var(--accent);+}+.confirm__actions {display: flex;justify-content: flex-end;