Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

fix(ide): one editor, not two — delete the fullscreen file overlay

Chaitanya Giria9b4c0bf4082
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index 2d7c2e76..396403ca 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -25,7 +25,6 @@ import { SidebarSplitter } from '@/components/SidebarSplitter';
import { acquireTerminal, notifyThemeChangeAll } from '@/components/terminalPool';
import { FullscreenTerminal } from '@/components/FullscreenTerminal';
import { TaskDetailOverlay } from '@/components/TaskDetailOverlay';
-import { FullscreenFileEditor } from '@/components/FullscreenFileEditor';
import { IdePanel } from '@/ide/IdePanel';
import { useHoldOptionToTalk } from '@/freeflow/holdOption';
import brandLogo from '@brand/logo.png?url';
@@ -43,7 +42,6 @@ export function App() {
const godStatus = useStore(s => s.godStatus);
const fullscreenAgentId = useStore(s => s.fullscreenAgentId);
const appThemeNow = useAppTheme();
- const fullscreenFilePath = useStore(s => s.fullscreenFilePath);
const sidebarWidth = useStore(s => s.sidebarWidth);
const setSidebarWidth = useStore(s => s.setSidebarWidth);
const ideOpen = useStore(s => s.ideOpen);
@@ -497,7 +495,6 @@ export function App() {
)}
{fullscreenAgentId && <FullscreenTerminal config={config} />}
- {fullscreenFilePath && <FullscreenFileEditor />}
{ideOpen && <IdePanel />}
<TaskDetailOverlay />
</div>
diff --git a/src/renderer/src/components/CodeEditor.tsx b/src/renderer/src/components/CodeEditor.tsx
index 29c7eaed..317d1992 100644
--- a/src/renderer/src/components/CodeEditor.tsx
+++ b/src/renderer/src/components/CodeEditor.tsx
@@ -69,13 +69,14 @@ export interface CodeEditorProps {
root: string;
/** Relative file path within `root` */
filePath: string | null;
- fullscreen?: boolean;
- onToggleFullscreen?: () => void;
+ /** Escalate this file into the IDE. The sidebar editor is deliberately
+ * small; the IDE is where tabs, the tree, git, and markdown preview live. */
+ onOpenInIde?: () => void;
onCopyPath?: () => void;
}
export function CodeEditor({
- root, filePath, fullscreen, onToggleFullscreen, onCopyPath
+ root, filePath, onOpenInIde, onCopyPath
}: CodeEditorProps) {
const [content, setContent] = useState<string>('');
const [originalContent, setOriginalContent] = useState<string>('');
@@ -207,13 +208,14 @@ export function CodeEditor({
>
{saveState === 'saving' ? '...' : saveState === 'saved' ? 'saved' : saveState === 'error' ? 'err' : 'save'}
</button>
- {onToggleFullscreen && (
+ {onOpenInIde && (
<button
- onClick={onToggleFullscreen}
- title={fullscreen ? 'Exit fullscreen (Esc)' : 'Fullscreen'}
+ onClick={onOpenInIde}
+ title="Open in the IDE"
+ aria-label="Open in the IDE"
style={editorBtn}
>
- <Icon name={fullscreen ? 'minimize' : 'expand'} />
+ <Icon name="code" />
</button>
)}
</div>
@@ -240,21 +242,6 @@ export function CodeEditor({
/>
)}
</div>
-
- {/* Footer actions when fullscreen */}
- {fullscreen && (
- <div style={{
- padding: 8, borderTop: '1px solid var(--cth-ink-700)',
- background: 'var(--cth-cream-200)',
- display: 'flex', justifyContent: 'flex-end', gap: 8
- }}>
- <PixelButton variant="secondary" size="sm" onClick={onToggleFullscreen}>
- <span style={{ display: 'inline-flex', gap: 4, alignItems: 'center' }}>
- <Icon name="minimize" /> exit fullscreen
- </span>
- </PixelButton>
- </div>
- )}
</div>
);
}
diff --git a/src/renderer/src/components/FilesTab.tsx b/src/renderer/src/components/FilesTab.tsx
index f97f821a..9f5f30e3 100644
--- a/src/renderer/src/components/FilesTab.tsx
+++ b/src/renderer/src/components/FilesTab.tsx
@@ -12,7 +12,7 @@ function joinAbs(cwd: string, rel: string): string {
}
export function FilesTab({ cwd }: FilesTabProps) {
- const setFullscreenFile = useStore(s => s.setFullscreenFile);
+ const openFileInIde = useStore(s => s.openFileInIde);
const [active, setActive] = useState<string | null>(null);
const [treeWidth, setTreeWidth] = useState<number>(200);
const dragRef = useRef<{ x: number; w: number } | null>(null);
@@ -41,9 +41,9 @@ export function FilesTab({ cwd }: FilesTabProps) {
navigator.clipboard.writeText(abs).catch(() => { /* noop */ });
};
- const onOpenFullscreen = () => {
+ const onOpenInIde = () => {
if (!active) return;
- setFullscreenFile(joinAbs(cwd, active));
+ openFileInIde(joinAbs(cwd, active));
};
return (
@@ -89,8 +89,7 @@ export function FilesTab({ cwd }: FilesTabProps) {
<CodeEditor
root={cwd}
filePath={active}
- fullscreen={false}
- onToggleFullscreen={onOpenFullscreen}
+ onOpenInIde={onOpenInIde}
onCopyPath={active ? () => onCopyPath(active) : undefined}
/>
</div>
diff --git a/src/renderer/src/components/FullscreenFileEditor.tsx b/src/renderer/src/components/FullscreenFileEditor.tsx
deleted file mode 100644
index be949bc3..00000000
--- a/src/renderer/src/components/FullscreenFileEditor.tsx
+++ /dev/null
@@ -1,164 +0,0 @@
-import { useEffect, useState } from 'react';
-import { CodeEditor } from './CodeEditor';
-import { MarkdownPreview } from '@/markdown/MarkdownPreview';
-import { useStore } from '@/store/store';
-
-/**
- * Full-window overlay for one file. The absolute path is in store; root + rel
- * are derived by prefix-matching agent cwds (falling back to the file's parent
- * dir, so files outside any workspace still open).
- *
- * v0.3.4: markdown files get an edit | preview toggle (preview is the default
- * when opened from a terminal ⌘-click), plus an "open in IDE" escalation that
- * queues the path for IdePanel and opens it. Preview renders the SAVED file —
- * switch to edit to change it, save, and the preview picks it up on return.
- */
-export function FullscreenFileEditor() {
- const fullscreenFilePath = useStore(s => s.fullscreenFilePath);
- const view = useStore(s => s.fullscreenFileView);
- const setFullscreenFile = useStore(s => s.setFullscreenFile);
- const agents = useStore(s => s.agents);
-
- useEffect(() => {
- const onKey = (e: KeyboardEvent) => {
- if (e.key === 'Escape') { e.preventDefault(); setFullscreenFile(null); }
- };
- window.addEventListener('keydown', onKey);
- return () => window.removeEventListener('keydown', onKey);
- }, [setFullscreenFile]);
-
- if (!fullscreenFilePath) return null;
-
- // Find the agent cwd that's a prefix of this path. Falls back to using the
- // file's parent dir as the root so we can still read it.
- const matchedAgent = agents.find(a => fullscreenFilePath.startsWith(a.cwd + '/') || fullscreenFilePath === a.cwd);
- const root = matchedAgent?.cwd ?? fullscreenFilePath.replace(/\/[^/]+$/, '');
- const rel = matchedAgent
- ? fullscreenFilePath.slice(matchedAgent.cwd.length + 1)
- : fullscreenFilePath.split('/').pop() ?? fullscreenFilePath;
-
- const isMd = /\.(md|markdown)$/i.test(fullscreenFilePath);
- const mode: 'edit' | 'preview' = isMd ? view : 'edit';
-
- const copyPath = () => {
- navigator.clipboard.writeText(fullscreenFilePath).catch(() => { /* noop */ });
- };
-
- const openInIde = () => {
- const s = useStore.getState();
- s.setIdeInitialFile(fullscreenFilePath);
- s.setFullscreenFile(null);
- // The owning agent is already resolved above (it is how `root` was derived),
- // so hand it over instead of making the IDE re-guess from the selection —
- // this overlay is often reached from a terminal link with nothing selected.
- s.setIdeOpen(true, matchedAgent?.id ?? null);
- };
-
- const chip: React.CSSProperties = {
- padding: '2px 10px', height: 22, border: 'none', cursor: 'pointer',
- fontFamily: 'var(--cth-font-ui)', fontSize: 12, color: 'var(--cth-ink-900)',
- background: 'var(--cth-cream-100)', boxShadow: 'inset 0 0 0 1px var(--cth-ink-100)',
- display: 'inline-flex', alignItems: 'center'
- };
-
- return (
- <div style={{
- position: 'fixed', inset: 0,
- background: 'var(--cth-cream-100)',
- zIndex: 280,
- display: 'flex', flexDirection: 'column',
- paddingTop: 36
- }}>
- <div
- className="cth-titlebar-drag"
- style={{
- position: 'absolute', top: 0, left: 0, right: 0, height: 36,
- background: 'linear-gradient(180deg, var(--cth-cream-100) 0%, var(--cth-cream-200) 100%)',
- borderBottom: '1px solid var(--cth-ink-300)',
- display: 'flex', alignItems: 'center',
- paddingLeft: 96, paddingRight: 12, gap: 12,
- userSelect: 'none',
- fontFamily: 'var(--cth-font-display)', fontSize: 12, lineHeight: '20px',
- color: 'var(--cth-ink-900)'
- }}
- >
- MUNDER DIFFLIN · FILE
- <span
- className="cth-titlebar-nodrag"
- style={{
- fontFamily: 'var(--cth-font-mono)', fontSize: 13, color: 'var(--cth-ink-500)',
- whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', maxWidth: '38vw'
- }}
- title={fullscreenFilePath}
- >{rel}</span>
- <span className="cth-titlebar-nodrag" style={{ marginLeft: 'auto', display: 'inline-flex', gap: 8, alignItems: 'center' }}>
- {isMd && (
- <span style={{ display: 'inline-flex' }}>
- {(['edit', 'preview'] as const).map((v) => (
- <button
- key={v}
- onClick={() => setFullscreenFile(fullscreenFilePath, v)}
- title={v === 'edit' ? 'Edit the source' : 'Rendered preview (of the saved file)'}
- style={{
- ...chip,
- background: mode === v ? 'var(--cth-sky-light)' : 'var(--cth-cream-100)',
- boxShadow: mode === v ? 'inset 0 0 0 1px var(--cth-ink-500)' : 'inset 0 0 0 1px var(--cth-ink-100)'
- }}
- >{v}</button>
- ))}
- </span>
- )}
- <button onClick={openInIde} title="Open this file in the full IDE" style={chip}>open in IDE</button>
- <button onClick={() => setFullscreenFile(null)} title="Close (Esc)" style={chip}>✕</button>
- </span>
- </div>
- <div style={{ flex: 1, minHeight: 0, overflow: mode === 'preview' ? 'auto' : 'hidden' }}>
- {mode === 'preview' ? (
- <SavedFilePreview root={root} rel={rel} />
- ) : (
- <CodeEditor
- root={root}
- filePath={rel}
- fullscreen
- onToggleFullscreen={() => setFullscreenFile(null)}
- onCopyPath={copyPath}
- />
- )}
- </div>
- </div>
- );
-}
-
-/** Reads the saved file and renders it as markdown. Untrusted input is fine —
- * MarkdownPreview has no HTML sink. */
-function SavedFilePreview({ root, rel }: { root: string; rel: string }) {
- const [state, setState] = useState<{ status: 'loading' | 'ready' | 'error'; content: string; error?: string }>({
- status: 'loading', content: ''
- });
- useEffect(() => {
- let alive = true;
- setState({ status: 'loading', content: '' });
- window.cth.readFile(root, rel).then((res) => {
- if (!alive) return;
- setState(res.ok
- ? { status: 'ready', content: res.content }
- : { status: 'error', content: '', error: res.error });
- });
- return () => { alive = false; };
- }, [root, rel]);
-
- if (state.status === 'loading') {
- return <div style={{ padding: 24, fontFamily: 'var(--cth-font-ui)', fontSize: 13, color: 'var(--cth-ink-500)' }}>loading…</div>;
- }
- if (state.status === 'error') {
- return <div style={{ padding: 24, fontFamily: 'var(--cth-font-ui)', fontSize: 13, color: 'var(--cth-coral)' }}>{state.error}</div>;
- }
- return (
- <div style={{ display: 'flex', justifyContent: 'center' }}>
- {/* `root` is what lets screenshots referenced by the report actually
- render — it is the same root this component already reads through, so
- images are confined to exactly the tree the text came from. */}
- <MarkdownPreview source={state.content} baseRel={rel} root={root} />
- </div>
- );
-}
diff --git a/src/renderer/src/components/Icon.tsx b/src/renderer/src/components/Icon.tsx
index 513fd5c2..3bf34202 100644
--- a/src/renderer/src/components/Icon.tsx
+++ b/src/renderer/src/components/Icon.tsx
@@ -7,7 +7,7 @@ export type IconName =
| 'gear' | 'plus' | 'x' | 'check' | 'arrow-right' | 'pause' | 'play'
| 'bell' | 'folder' | 'terminal' | 'code' | 'web' | 'mcp' | 'sparkle'
| 'expand' | 'minimize' | 'clock' | 'mic' | 'ledger' | 'info' | 'sidebar'
- | 'image' | 'edit';
+ | 'image' | 'edit' | 'git';
interface IconDef {
ink: string; // primary color path d
@@ -75,6 +75,14 @@ const paths: Record<IconName, IconDef> = {
accentColor: 'var(--cth-mint)',
ink: 'M1 2h14v12H1V2zm1 1v10h12V3H2zm1 2h1v1h1v1h1v1H5v1H4v1H3V9h1V8h1V7H4V6H3V5zm5 5h4v1H8v-1z'
},
+ // The branch graph, which is what git's own mark is: a trunk with two commit
+ // nodes and one branch arcing off into a third. Drawn at the same hairline
+ // weight as `code` and `terminal` so a row of them reads as one set — a
+ // solid-filled mark next to those two looks like a different icon family.
+ git: {
+ accentColor: 'var(--cth-coral)',
+ ink: 'M5 1h3v1h-3zM4 2h1v1h-1zM8 2h1v1h-1zM4 3h1v1h-1zM8 3h1v1h-1zM5 4h3v1h-3zM6 5h1v1h-1zM6 6h1v1h-1zM9 6h3v1h-3zM6 7h1v1h-1zM8 7h1v1h-1zM12 7h1v1h-1zM6 8h3v1h-3zM12 8h1v1h-1zM6 9h1v1h-1zM9 9h3v1h-3zM6 10h1v1h-1zM5 11h3v1h-3zM4 12h1v1h-1zM8 12h1v1h-1zM4 13h1v1h-1zM8 13h1v1h-1zM5 14h3v1h-3z'
+ },
code: {
accentColor: 'var(--cth-sky)',
ink: 'M5 3h1v1H5v1H4v1H3v1H2v1h1v1h1v1h1v1h1v1H5v-1H4v-1H3v-1H2v-1H1V7h1V6h1V5h1V4h1V3zm5 0h1v1h1v1h1v1h1v1h1v1h-1v1h-1v1h-1v1h-1v1h-1v-1h1v-1h1v-1h1V9h1V7h-1V6h-1V5h-1V4h-1V3z'
diff --git a/src/renderer/src/components/terminalPool.ts b/src/renderer/src/components/terminalPool.ts
index 1e2e5295..12738db6 100644
--- a/src/renderer/src/components/terminalPool.ts
+++ b/src/renderer/src/components/terminalPool.ts
@@ -778,7 +778,7 @@ function resolvePathCandidate(ptyId: string, raw: string): string | null {
interface MdStoreShape {
getState: () => {
agents: Array<{ ptyId?: string; cwd: string }>;
- setFullscreenFile: (p: string, v?: 'edit' | 'preview') => void;
+ openFileInIde: (absPath: string) => void;
};
}
let storeApi: MdStoreShape | null = null;
@@ -786,9 +786,14 @@ void import('@/store/store')
.then((m) => { storeApi = (m as unknown as { useStore: MdStoreShape }).useStore; })
.catch(() => { /* store unavailable (tests) — link provider stays inert */ });
-/** Act on a verified path. `reveal` is the only branch that accepts a directory:
- * the other two need a file to put in the editor. A miss is silent by design —
- * the token is agent output and may simply not exist. */
+/** Act on a verified path. `reveal` also takes any directory that reaches here:
+ * the IDE needs a file. A miss is silent by design — the token is agent output
+ * and may simply not exist.
+ *
+ * Both non-reveal verdicts land in the IDE. The IDE already routes by type
+ * (Monaco for source, preview for markdown, the viewer for images), so this
+ * does not need to pass the verdict along — it only needs to know whether the
+ * file is ours to open at all. */
async function activatePath(abs: string, action: PathAction): Promise<void> {
let hit = mdStatCache.get(abs);
if (!hit) {
@@ -802,7 +807,7 @@ async function activatePath(abs: string, action: PathAction): Promise<void> {
void window.cth.revealPath(hit.path).catch(() => { /* file browser refused */ });
return;
}
- storeApi?.getState().setFullscreenFile(hit.path, action === 'preview' ? 'preview' : 'edit');
+ storeApi?.getState().openFileInIde(hit.path);
}
function registerMarkdownLinkProvider(term: Terminal, ptyId: string): void {
diff --git a/src/renderer/src/ide/IdePanel.tsx b/src/renderer/src/ide/IdePanel.tsx
index 00f0e4f9..098d4b55 100644
--- a/src/renderer/src/ide/IdePanel.tsx
+++ b/src/renderer/src/ide/IdePanel.tsx
@@ -108,13 +108,17 @@ export function IdePanel() {
// v0.3.4 git visualization: which rail pane is showing, and the repo's MAIN
// root (a worktree's history/compare must run against the shared repo).
const [railTab, setRailTab] = useState<'changes' | 'history' | 'compare'>('changes');
- // Git rail collapse. The history graph is tall by nature, and someone working
- // in the file tree wants that space back — persisted because it is a working
- // preference, not a mode, and re-collapsing it on every IDE open would be a
- // chore. Only the pane collapses; the CHANGES/HISTORY/COMPARE strip stays put
- // so the control that expands it again is always visible.
+ // Git rail collapse. COLLAPSED BY DEFAULT: the history graph is tall by
+ // nature and most IDE opens are "read this file", not "inspect the repo" —
+ // starting expanded spent the top 45% of the left column on a pane nobody
+ // asked for and pushed the file tree below the fold.
+ //
+ // The stored value is still honoured in BOTH directions, so a user who opens
+ // the rail keeps it open across restarts. Note the test is `!== '0'` rather
+ // than `=== '1'`: with no stored value at all we must land on collapsed, and
+ // `=== '1'` would have made "never set" mean expanded.
const [gitCollapsed, setGitCollapsed] = useState<boolean>(() => {
- try { return localStorage.getItem(GIT_RAIL_COLLAPSED_KEY) === '1'; } catch { return false; }
+ try { return localStorage.getItem(GIT_RAIL_COLLAPSED_KEY) !== '0'; } catch { return true; }
});
const toggleGitRail = (): void => {
setGitCollapsed((v) => {
@@ -461,12 +465,21 @@ export function IdePanel() {
aria-expanded={!gitCollapsed}
style={{
...iconBtn,
- // A caret is the one glyph that reads as "this section folds"
- // without a legend; it points at where the content will go.
+ // Mark + caret in ONE control rather than a decorative logo
+ // beside a separate toggle: a git mark that does nothing when
+ // clicked is a dead spot exactly where the eye lands first.
+ // The mark names the section (it is collapsed by default, so
+ // the tab labels are the only other clue), the caret says it
+ // folds, and together they are a bigger hit target than the
+ // caret alone was.
+ display: 'flex', alignItems: 'center', gap: 3, width: 'auto', padding: '0 3px',
fontFamily: 'var(--cth-font-mono)', fontSize: 10, lineHeight: '14px',
color: 'var(--cth-ink-700)'
}}
- >{gitCollapsed ? '▸' : '▾'}</button>
+ >
+ <Icon name="git" />
+ <span aria-hidden>{gitCollapsed ? '▸' : '▾'}</span>
+ </button>
{(['changes', 'history', 'compare'] as const).map((k) => (
<button
key={k}
diff --git a/src/renderer/src/scene/office/OfficeFloor.tsx b/src/renderer/src/scene/office/OfficeFloor.tsx
index 075a02a7..0c3422fd 100644
--- a/src/renderer/src/scene/office/OfficeFloor.tsx
+++ b/src/renderer/src/scene/office/OfficeFloor.tsx
@@ -193,14 +193,14 @@ export function OfficeFloor() {
// start(), so a floor paused for an hour advances a few frames on resume rather
// than teleporting every character across the map.
const fullscreenAgentId = useStore((s) => s.fullscreenAgentId);
- const fullscreenFilePath = useStore((s) => s.fullscreenFilePath);
+ const ideOpen = useStore((s) => s.ideOpen);
const [docHidden, setDocHidden] = useState(() => document.hidden);
useEffect(() => {
const onVis = () => setDocHidden(document.hidden);
document.addEventListener('visibilitychange', onVis);
return () => document.removeEventListener('visibilitychange', onVis);
}, []);
- const paused = !!fullscreenAgentId || !!fullscreenFilePath || docHidden;
+ const paused = !!fullscreenAgentId || ideOpen || docHidden;
// Read inside init(), which finishes asynchronously and would otherwise start a
// ticker the effect below had already been asked to stop.
const pausedRef = useRef(paused);
diff --git a/src/renderer/src/store/store.ts b/src/renderer/src/store/store.ts
index ccbf681a..7fb1e6a4 100644
--- a/src/renderer/src/store/store.ts
+++ b/src/renderer/src/store/store.ts
@@ -179,12 +179,9 @@ interface State {
* written ONLY by an explicit toggle. Kept in the store rather than read once
* at construction because the roster arrives after the store does. */
prefersFocusMode: boolean;
- fullscreenFilePath: string | null;
- /** How the fullscreen file overlay renders (v0.3.4): raw editor or rendered
- * markdown preview. Preview is the default when opened from a terminal link. */
- fullscreenFileView: 'edit' | 'preview';
- /** Absolute path queued for the IDE to open on next mount ("open in IDE"
- * escalation from the file overlay). Consumed-and-cleared by IdePanel. */
+ /** Absolute path queued for the IDE to open on next mount. Consumed-and-cleared
+ * by IdePanel, which routes it the same way a tree click would (Monaco for
+ * source, preview for markdown, the viewer for images). */
ideInitialFile: string | null;
/** Whether the full-window IDE panel (file manager + Monaco editor + git diff)
* is open. Toggled from the title-bar IDE button; a global feature surface,
@@ -316,7 +313,14 @@ interface State {
refocusFullscreen: (id: string | null) => void;
/** Re-apply the persisted preference now that the roster has changed. */
restoreFocusMode: () => void;
- setFullscreenFile: (path: string | null, view?: 'edit' | 'preview') => void;
+ /** Open an absolute path in the IDE — the ONE way to show a file.
+ *
+ * v0.4.5 removed a second, worse file surface (a fullscreen overlay wrapping
+ * a bare Monaco). It could not scroll, had no tabs, no tree, and no git, and
+ * every file it opened was one click from "open in IDE" anyway. Everything
+ * that used to open it now comes here, so there is exactly one editor to fix
+ * when an editor bug shows up. */
+ openFileInIde: (absPath: string) => void;
/** Open/close the IDE. `agentId` names the agent whose workspace it should
* show; omit it only when the caller truly has no specific agent (the IDE
* then falls back to the selection and says so in its title). */
@@ -636,7 +640,7 @@ function newQueuedId(): string {
return `q-${Date.now()}-${queuedSeq}`;
}
-export const useStore = create<State>((set) => ({
+export const useStore = create<State>((set, get) => ({
agents: initialAgents,
archivedAgents: initialArchivedAgents,
restorableAgents: initialRestorableAgents,
@@ -648,8 +652,6 @@ export const useStore = create<State>((set) => ({
set((s) => ({ ccTabRequest: { tab, seq: (s.ccTabRequest?.seq ?? 0) + 1 } })),
fullscreenAgentId: focusOnLoad(initialPrefersFocusMode, initialSelectedId),
prefersFocusMode: initialPrefersFocusMode,
- fullscreenFilePath: null,
- fullscreenFileView: 'edit',
ideInitialFile: null,
ideOpen: false,
ideAgentId: null,
@@ -976,7 +978,14 @@ export const useStore = create<State>((set) => ({
const id = restoreFocus(s.prefersFocusMode, s.fullscreenAgentId, s.agents, s.selectedId);
return id === s.fullscreenAgentId ? s : { fullscreenAgentId: id };
}),
- setFullscreenFile: (path, view) => set({ fullscreenFilePath: path, fullscreenFileView: view ?? 'edit' }),
+ openFileInIde: (absPath) => {
+ const s = get();
+ // Resolve the OWNING agent here rather than in each caller: a terminal link
+ // or a Files-tab click often has nothing selected, and the IDE would
+ // otherwise fall back to the selection and open the wrong workspace.
+ const owner = s.agents.find((a) => absPath === a.cwd || absPath.startsWith(a.cwd + '/'));
+ set({ ideInitialFile: absPath, ideOpen: true, ideAgentId: owner?.id ?? null });
+ },
// Closing CLEARS the target: the id is scoped to one IDE session, and a stale
// one left behind would silently win over the selection on the next open from
// a caller that passes nothing.