diff --git a/packages/tui/src/component/prompt/index.tsx b/packages/tui/src/component/prompt/index.tsx index aa002080b1dd..65723abe30cd 100644 --- a/packages/tui/src/component/prompt/index.tsx +++ b/packages/tui/src/component/prompt/index.tsx @@ -527,6 +527,57 @@ export function Prompt(props: PromptProps) { )) }, }, + { + title: "Copy session ID", + desc: "Copy the current session ID to clipboard", + name: "session.copy-id", + category: "Session", + slashName: "session-id", + enabled: Boolean(props.sessionID), + run: async () => { + if (!props.sessionID || !clipboard.write) return + // Clear input synchronously before the async clipboard write. + // The input's onSubmit fires a double-deferred submit() via setTimeout; + // if the input still contains "/session-id" when that fires, it sends + // the text to the LLM as a prompt. + input.setText("") + setStore("prompt", { input: "", parts: [] }) + dialog.clear() + await clipboard.write(props.sessionID) + toast.show({ + variant: "success", + message: `Copied: ${props.sessionID}`, + duration: 3000, + }) + }, + }, + { + title: "Copy session info", + desc: "Copy project path, session title, and session ID to clipboard", + name: "session.copy-info", + category: "Session", + slashName: "session-info", + enabled: Boolean(props.sessionID), + run: async () => { + if (!props.sessionID || !clipboard.write) return + // Clear input synchronously — see /session-id command for rationale. + input.setText("") + setStore("prompt", { input: "", parts: [] }) + dialog.clear() + const dir = + (project.instance.path().worktree === "/" ? undefined : project.instance.path().worktree) || + project.instance.directory() || + "" + const session = sync.session.get(props.sessionID) + const title = session?.title ?? "" + await clipboard.write(`Project ${dir}; Session ${title}; ID ${props.sessionID}`) + toast.show({ + variant: "success", + message: "Copied project, session title, and ID to clipboard", + duration: 3000, + }) + }, + }, { title: "Warp", desc: "Change the workspace for the session",