Skip to content

core: forward cwd through BlitWorkspace.createSession#87

Merged
pcarrier merged 2 commits into
mainfrom
add-createsession-cwd
Jul 24, 2026
Merged

core: forward cwd through BlitWorkspace.createSession#87
pcarrier merged 2 commits into
mainfrom
add-createsession-cwd

Conversation

@jsegaran

Copy link
Copy Markdown
Contributor

What

BlitWorkspace.createSession dropped cwd: CreateWorkspaceSessionOptions didn't expose the field, even though the lower-level BlitConnection.createSession and the CREATE2 wire message already accept a cwd (working directory interpreted on the target server). Callers using the workspace-level API therefore couldn't open a new session in a chosen directory — every session inherited the blit server process's cwd.

This adds cwd?: string to CreateWorkspaceSessionOptions and forwards it to connection.createSession.

Why

In neo, the web terminal opens PTYs through BlitWorkspace.createSession. On local (desktop) computers a single shared blit server serves every session, and its cwd is whatever the Electron main process inherited (/), so new terminals open at / instead of the user's chosen workspace directory. With this field, neo can pass the session's workspace path per-terminal and open each one in the right place, without spawning a server per session.

Testing

Type-safe passthrough; cwd mirrors the existing CreateSessionOptions.cwd on BlitConnection, whose wire encoding is already covered by BlitConnection.test.ts ("createSession with cwd sets features").

View in Indent
Tag @indent to continue the conversation here.

BlitConnection.createSession and the CREATE2 wire message already accept a
cwd, but BlitWorkspace.createSession dropped it, so callers using the
workspace API couldn't open a session in a chosen directory. Add cwd to
CreateWorkspaceSessionOptions and forward it.

Co-authored-by: Indent <noreply@indent.com>
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

🔗 Preview: https://blit-r973k5vcv-indent.vercel.app

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

Coverage

Crate Lines Functions Regions
alacritty-driver 69.7% (698/1002) 72.0% (54/75) 71.7% (1050/1464)
browser 0.0% (0/807) 0.0% (0/65) 0.0% (0/1370)
cli 28.1% (1313/4665) 39.6% (179/452) 31.2% (2371/7600)
compositor 1.0% (93/9248) 2.0% (8/400) 1.2% (146/12403)
fonts 76.8% (486/633) 85.5% (47/55) 77.9% (922/1183)
gateway 25.5% (362/1419) 29.0% (36/124) 19.3% (449/2332)
proxy 19.4% (173/892) 21.3% (27/127) 21.4% (295/1381)
remote 71.7% (1985/2768) 81.8% (189/231) 74.2% (3749/5051)
sd-notify 72.8% (67/92) 100.0% (6/6) 82.4% (108/131)
server 19.1% (2247/11767) 34.3% (259/756) 20.6% (3760/18285)
ssh 1.9% (7/374) 3.2% (1/31) 0.7% (4/613)
upsidedown 31.4% (391/1247) 27.8% (55/198) 34.8% (797/2287)
webrtc-forwarder 2.7% (72/2624) 2.1% (4/187) 1.2% (50/4335)
webserver 63.5% (753/1185) 70.8% (121/171) 67.8% (1380/2034)
Total 22.3% (8647/38723) 34.3% (986/2878) 24.9% (15081/60469)

@jsegaran
jsegaran requested a review from pcarrier July 24, 2026 06:21
Comment thread js/core/src/BlitWorkspace.ts Outdated
tag?: string;
command?: string;
cwdFromSessionId?: SessionId;
/** Working directory for the new session. Interpreted on the target server. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs a comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@indent drop the comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the comment in 731bf6d.

Co-authored-by: Indent <noreply@indent.com>
@jsegaran
jsegaran requested a review from pcarrier July 24, 2026 08:52
@pcarrier
pcarrier merged commit c169975 into main Jul 24, 2026
11 of 12 checks passed
@pcarrier
pcarrier deleted the add-createsession-cwd branch July 24, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants