Start a clean session in one press under the desktop app

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-26 17:05:36 -07:00
1 parent 899b3a48d8
commit 10379e3870
11 files changed
+129 -6

No files matched your search

+17
View File
@@ -36,6 +36,23 @@ export function onAppMessage(kind, handler) {
});
}
/**
* Ask the app for what its bar's New Session button does, confirm and all.
* `command`, when there is one, goes on the clipboard first so it can be
* pasted into the new terminal; a refused copy loses nothing, the page still
* shows it.
*/
export async function startNewSession(command = "") {
if (command) {
try {
await navigator.clipboard.writeText(command);
} catch {
/* the command stays on the page to copy by hand */
}
}
tellApp("new-session");
}
/** Post `message` to the frame's parent, as `{ plan2code: kind, ...extra }`; nothing outside a frame. */
export function tellApp(kind, extra = {}) {
if (!framed()) return;