mirror of
https://github.com/harivansh-afk/clanker-agent.git
synced 2026-04-17 18:02:32 +00:00
- Copy all pi-mono source into apps/companion-os/ - Update Dockerfile to COPY pre-built binary instead of downloading from GitHub Releases - Update deploy-staging.yml to build pi from source (bun compile) before Docker build - Add apps/companion-os/** to path triggers - No more cross-repo dispatch needed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
/**
|
|
* TUI session selector for --resume flag
|
|
*/
|
|
|
|
import { ProcessTerminal, TUI } from "@mariozechner/pi-tui";
|
|
import { KeybindingsManager } from "../core/keybindings.js";
|
|
import type {
|
|
SessionInfo,
|
|
SessionListProgress,
|
|
} from "../core/session-manager.js";
|
|
import { SessionSelectorComponent } from "../modes/interactive/components/session-selector.js";
|
|
|
|
type SessionsLoader = (
|
|
onProgress?: SessionListProgress,
|
|
) => Promise<SessionInfo[]>;
|
|
|
|
/** Show TUI session selector and return selected session path or null if cancelled */
|
|
export async function selectSession(
|
|
currentSessionsLoader: SessionsLoader,
|
|
allSessionsLoader: SessionsLoader,
|
|
): Promise<string | null> {
|
|
return new Promise((resolve) => {
|
|
const ui = new TUI(new ProcessTerminal());
|
|
const keybindings = KeybindingsManager.create();
|
|
let resolved = false;
|
|
|
|
const selector = new SessionSelectorComponent(
|
|
currentSessionsLoader,
|
|
allSessionsLoader,
|
|
(path: string) => {
|
|
if (!resolved) {
|
|
resolved = true;
|
|
ui.stop();
|
|
resolve(path);
|
|
}
|
|
},
|
|
() => {
|
|
if (!resolved) {
|
|
resolved = true;
|
|
ui.stop();
|
|
resolve(null);
|
|
}
|
|
},
|
|
() => {
|
|
ui.stop();
|
|
process.exit(0);
|
|
},
|
|
() => ui.requestRender(),
|
|
{ showRenameHint: false, keybindings },
|
|
);
|
|
|
|
ui.addChild(selector);
|
|
ui.setFocus(selector.getSessionList());
|
|
ui.start();
|
|
});
|
|
}
|