make file browser work without session

This commit is contained in:
Peter Steinberger 2025-06-21 19:06:19 +02:00
parent 16bc60b379
commit e82c633a9a
3 changed files with 12 additions and 4 deletions

View file

@ -73,8 +73,8 @@ export class FileBrowser extends LitElement {
async connectedCallback() {
super.connectedCallback();
if (this.visible && this.session) {
this.currentPath = this.session.workingDir || '.';
if (this.visible) {
this.currentPath = this.session?.workingDir || '.';
await this.loadDirectory(this.currentPath);
}
document.addEventListener('keydown', this.handleKeyDown);
@ -84,8 +84,8 @@ export class FileBrowser extends LitElement {
super.updated(changedProperties);
if (changedProperties.has('visible') || changedProperties.has('session')) {
if (this.visible && this.session) {
this.currentPath = this.session.workingDir || '.';
if (this.visible) {
this.currentPath = this.session?.workingDir || '.';
await this.loadDirectory(this.currentPath);
}
}

View file

@ -38,6 +38,8 @@ function showUsage() {
}
export async function startVibeTunnelForward(args: string[]) {
console.log(`[fwd] Raw args received: ${JSON.stringify(args)}`);
// Parse command line arguments
if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
showUsage();
@ -51,6 +53,8 @@ export async function startVibeTunnelForward(args: string[]) {
if (args[0] === '--session-id' && args.length > 1) {
sessionId = args[1];
remainingArgs = args.slice(2);
console.log(`[fwd] Parsed session ID: ${sessionId}`);
console.log(`[fwd] Remaining args after session ID: ${JSON.stringify(remainingArgs)}`);
}
const monitorOnly = remainingArgs[0] === '--monitor-only';
@ -66,6 +70,7 @@ export async function startVibeTunnelForward(args: string[]) {
console.log(`Starting command: ${command.join(' ')}`);
console.log(`Working directory: ${cwd}`);
console.log(`Session ID: ${sessionId || 'not provided'}`);
// Initialize PTY manager
const controlPath = path.join(os.homedir(), '.vibetunnel', 'control');

View file

@ -74,6 +74,9 @@ export class PtyManager {
options: SessionOptions = {}
): Promise<SessionCreationResult> {
const sessionId = options.sessionId || uuidv4();
console.log(
`[PTY] Creating session - provided ID: ${options.sessionId}, using ID: ${sessionId}`
);
const sessionName = options.sessionName || path.basename(command[0]);
const workingDir = options.workingDir || process.cwd();
const term = options.term || this.defaultTerm;