shelley: pass working directory to xterm terminal URL

Philip Zeyliger and Shelley created

Prompt: Change the Shelley.json file generation to include this flag with a placeholder WORKING_DIR and change Shelley to have replacement for this parameter in its menu handling.

The terminal_url in shelley.json now includes '?d=WORKING_DIR' placeholder.
When the user clicks the Terminal button in Shelley's menu, the WORKING_DIR
placeholder is replaced with the current conversation's working directory
(URL-encoded), so the terminal opens in the correct directory.

Co-authored-by: Shelley <shelley@exe.dev>

Change summary

ui/src/components/ChatInterface.tsx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Detailed changes

ui/src/components/ChatInterface.tsx 🔗

@@ -1364,7 +1364,9 @@ function ChatInterface({
                   <button
                     onClick={() => {
                       setShowOverflowMenu(false);
-                      window.open(terminalURL, "_blank");
+                      const cwd = currentConversation?.cwd || selectedCwd || "";
+                      const url = terminalURL.replace("WORKING_DIR", encodeURIComponent(cwd));
+                      window.open(url, "_blank");
                     }}
                     className="overflow-menu-item"
                   >