Skip to content

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.

fix(windows): spell a dropped path for PowerShell when the node's shell is unset

review795ad734ccf0
diff --git a/CLAUDE.md b/CLAUDE.md
index c8c0ae5f3..388f59dd8 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1697,9 +1697,13 @@ session.
`quoteDroppedPath`, `terminal/file-drop.ts`): POSIX backslash-escaping everywhere — every SSH
pane and Git Bash included, byte-identical to before — except a Windows core, where `\` is the
separator and is never doubled: bare when nothing needs quoting, else double-quoted (pwsh/agent
- panes single-quote a path holding `$` or a backtick). The image receipt strips one pair of quotes
- before reading the extension. `isShellCommand` likewise normalises the session host's image names
- (`pwsh.exe`, `C:\…\cmd.exe`) — leading `-`, either separator, case, `.exe`. A path an
+ panes single-quote a path holding `$` or a backtick; an UNSET shell is spelled for PowerShell,
+ the core's own Windows default, so a `$` path is not expanded). The image receipt strips one pair
+ of quotes before reading the extension. `isShellCommand` likewise normalises the session host's
+ image names (`pwsh.exe`, `C:\…\cmd.exe`) — leading `-`, either separator, case, `.exe` — which is
+ why the session host's `paneCommand` walk (`process-tree.ts`) answers a shell name only when EVERY
+ process in the tree is a shell: claude's Bash/PowerShell tool or a `cmd /c npx` MCP launcher is a
+ shell LEAF under a live agent, and must not read as "the CLI let go of the pane". A path an
agent TUI wrapped under a **hanging indent** (Codex: 2 spaces, broken after a `/` or at a space)
is neither a soft nor a hard wrap, so it is offered as extra READINGS (`hangingReadings` — the
seam as nothing, and as one space), tried BEFORE the plain row's tokens by both the provider and
diff --git a/src/renderer/terminal/file-drop.test.ts b/src/renderer/terminal/file-drop.test.ts
index 2dc3c0562..a57169911 100644
--- a/src/renderer/terminal/file-drop.test.ts
+++ b/src/renderer/terminal/file-drop.test.ts
@@ -90,9 +90,11 @@ describe('dropDialect', () => {
expect(dropDialect({ ...win, shell: 'C:\\Program Files\\Git\\bin\\bash.exe' })).toBe('posix')
})
- it('an unknown shell on Windows reads as cmd (double quotes, which pwsh also accepts)', () => {
- expect(dropDialect({ ...win })).toBe('win-cmd')
- expect(dropDialect({ ...win, shell: 'nu' })).toBe('win-cmd')
+ it("an unset or unknown shell on Windows reads as PowerShell, the core's own default", () => {
+ expect(dropDialect({ ...win })).toBe('win-pwsh')
+ expect(dropDialect({ ...win, shell: 'nu' })).toBe('win-pwsh')
+ // So a `$` path is not expanded by the default shell.
+ expect(quoteDroppedPath('C:\\a$b\\x.png', dropDialect({ ...win }))).toBe("'C:\\a$b\\x.png'")
})
it('an agent pane on Windows is quoted for the CLI, whatever the shell under it', () => {
@@ -101,7 +103,7 @@ describe('dropDialect', () => {
})
it('an unobserved core platform falls back to the viewer ONLY for the local desktop core', () => {
- expect(dropDialect({ corePlatform: null, remote: false, localDesktop: true, viewerWindows: true })).toBe('win-cmd')
+ expect(dropDialect({ corePlatform: null, remote: false, localDesktop: true, viewerWindows: true })).toBe('win-pwsh')
// A Windows browser on a Server Edition / relay tab says nothing about the host.
expect(dropDialect({ corePlatform: null, remote: false, localDesktop: false, viewerWindows: true })).toBe('posix')
expect(dropDialect({ corePlatform: null, remote: false, localDesktop: true, viewerWindows: false })).toBe('posix')
diff --git a/src/renderer/terminal/file-drop.ts b/src/renderer/terminal/file-drop.ts
index 9678b6682..49375a575 100644
--- a/src/renderer/terminal/file-drop.ts
+++ b/src/renderer/terminal/file-drop.ts
@@ -35,7 +35,8 @@ export interface DropDialectFacts {
corePlatform: string | null
/** The pane runs on another (POSIX) machine: an SSH project, or a standalone `ssh` node. */
remote: boolean
- /** The node's shell, or the resolved default. Unknown is fine — it reads as cmd's rules. */
+ /** The node's shell, or the resolved default. Unknown reads as PowerShell — the core's own
+ * Windows default. */
shell?: string | null
/** An agent CLI owns the pane, so the reader is its composer, not the shell. */
agentPane?: boolean
@@ -58,7 +59,12 @@ export function dropDialect(f: DropDialectFacts): DropDialect {
if (exe === 'pwsh' || exe === 'powershell') return 'win-pwsh'
// Git Bash / MSYS / WSL bash read backslash escapes; `C:\\Users\\Jane\ Doe` is right there.
if (exe === 'bash' || exe === 'sh' || exe === 'zsh' || exe === 'fish' || exe === 'wsl') return 'posix'
- return 'win-cmd'
+ if (exe === 'cmd') return 'win-cmd'
+ // No shell configured (or one we do not recognise): the core's own Windows default is PowerShell
+ // (`resolveWindowsShell`: pwsh, then the powershell.exe every install ships; COMSPEC only after
+ // both), so spell it for PowerShell. The two dialects differ only for a `$`/backtick path, which
+ // double quotes would let PowerShell expand into a different path.
+ return 'win-pwsh'
}
/** Extension for a clipboard blob that arrives with no filename, keyed off its MIME type. A