diff --git a/client/src/lib/api.ts b/client/src/lib/api.ts index f034be6..ada8717 100644 --- a/client/src/lib/api.ts +++ b/client/src/lib/api.ts @@ -97,6 +97,19 @@ export interface TerminalContent { layout?: 'desktop' | 'landscape' | 'portrait'; } +export interface ExternalTmuxSession { + name: string; + 'working-dir': string; + workingDir?: string; +} + +export interface ImportedSession { + id: string; + name: string; + 'working-dir': string; + workingDir?: string; +} + class ApiClient { private baseUrl: string; @@ -197,6 +210,18 @@ class ApiClient { body: JSON.stringify({ mode }) }); } + + // External tmux sessions + async getExternalTmuxSessions(): Promise { + return this.request('/tmux/external'); + } + + async importTmuxSession(name: string): Promise { + return this.request('/tmux/import', { + method: 'POST', + body: JSON.stringify({ name }) + }); + } } export const api = new ApiClient(); diff --git a/client/src/lib/components/MessageList.svelte b/client/src/lib/components/MessageList.svelte index ce63ac9..c44ddde 100644 --- a/client/src/lib/components/MessageList.svelte +++ b/client/src/lib/components/MessageList.svelte @@ -1,6 +1,6 @@ Spiceflow - (showNewSessionMenu = false)} /> + { showNewSessionMenu = false; showImportMenu = false; }} />
@@ -49,9 +87,64 @@
+
+ + {#if showImportMenu} +
+
+ Import tmux session +
+ {#if loadingExternal} +
+ + + + + Loading... +
+ {:else if externalSessions.length === 0} +
+ No external tmux sessions +
+ {:else} + {#each externalSessions as session} + + {/each} + {/if} +
+ {/if} +
+ + +
+