feat(ui): expose desktop session actions in header

Add a dedicated desktop header menu for the active session while keeping recent-session switching available when the sidebar is closed. Match inline rename behavior with the sidebar and expose rename, copy ID, share, export, archive, and delete actions with localized feedback.

Automatically copy newly created share links, keep share/unshare state synchronized across live and global stores, and normalize stale upstream unshare responses so the UI immediately reflects successful unsharing.

Require Markdown exports to load every available message page before formatting the conversation. Abort incomplete root exports, retain explicit child-session skip warnings, and guard complete-history pagination against failures and cursor cycles.
This commit is contained in:
Bohdan Triapitsyn
2026-07-31 21:02:23 +03:00
parent aae889b904
commit a6fb7193dc
20 changed files with 564 additions and 72 deletions
+22 -5
View File
@@ -467,11 +467,28 @@ describe("shareSession live state", () => {
const result = await unshareSession("session-a")
expect(result).toBe(unsharedSession)
expect(result).toEqual({ ...unsharedSession, share: undefined })
expect(replyCalls.find((call) => call.method === "session.unshare")?.params.directory).toBe("/test/project")
expect(sessionStore.getState().session[0].share).toBe(undefined)
expect(otherStore.getState().session[0].id).toBe("other")
expect(globalUpsertedSessions).toEqual([unsharedSession])
expect(globalUpsertedSessions).toEqual([{ ...unsharedSession, share: undefined }])
})
test("clears a stale share URL echoed by a successful unshare response", async () => {
const sharedSession = { id: "session-a", time: { created: 1 }, share: { url: "https://share.example/a" } } as Session
const staleResponse = { id: "session-a", time: { created: 1, updated: 2 }, share: { url: "https://share.example/a" } } as Session
const sessionStore = createStore({}, { session: [sharedSession] })
const childStores = createChildStores([["/test/project", sessionStore]])
sessionShareResult = { data: staleResponse }
const { setActionRefs, unshareSession } = await import("./session-actions")
setActionRefs(mockSdk as unknown as OpencodeClient, childStores, () => "/current/project")
const result = await unshareSession("session-a")
expect(result?.share).toBe(undefined)
expect(sessionStore.getState().session[0].share).toBe(undefined)
expect((globalUpsertedSessions[0] as Session).share).toBe(undefined)
})
test("updates the directory live store after sharing", async () => {
@@ -492,7 +509,7 @@ describe("shareSession live state", () => {
expect(globalUpsertedSessions).toEqual([sharedSession])
})
test("preserves live directory metadata while clearing share from null response", async () => {
test("preserves live directory metadata while normalizing a null share response", async () => {
const sharedSession = {
id: "session-a",
time: { created: 1 },
@@ -514,8 +531,8 @@ describe("shareSession live state", () => {
await unshareSession("session-a")
const liveSession = sessionStore.getState().session[0] as SessionWithDirectory & { share?: null }
expect(liveSession.share).toBe(null)
const liveSession = sessionStore.getState().session[0] as SessionWithDirectory
expect(liveSession.share).toBe(undefined)
expect(liveSession.directory).toBe("/test/project")
expect(liveSession.project?.worktree).toBe("/test/project")
})