diff --git a/config/platform-infra/webterm.yaml b/config/platform-infra/webterm.yaml index 99ea8552..ee329bb4 100644 --- a/config/platform-infra/webterm.yaml +++ b/config/platform-infra/webterm.yaml @@ -68,6 +68,7 @@ targets: cols: 100 rows: 30 resumePrompt: true + fallbackShell: true environment: HOST: 0.0.0.0 PORT: "7681" @@ -148,18 +149,21 @@ targets: cols: 100 rows: 30 resumePrompt: true + fallbackShell: true - title: CONSTAR cwd: /root/unidesk command: mycx resume 019f4b5f-b5ce-76b3-8ccb-508790e9662d cols: 100 rows: 30 resumePrompt: true + fallbackShell: true - title: WORKBENCH cwd: /root/unidesk command: mycx resume 019f4a1a-fd46-7662-8dc2-bf628210739d cols: 100 rows: 30 resumePrompt: true + fallbackShell: true environment: HOST: 0.0.0.0 PORT: "7681" diff --git a/scripts/src/platform-infra-webterm.ts b/scripts/src/platform-infra-webterm.ts index a7cbafcd..76bf1a8c 100644 --- a/scripts/src/platform-infra-webterm.ts +++ b/scripts/src/platform-infra-webterm.ts @@ -56,7 +56,7 @@ interface WebtermTarget { privileged: boolean; pid: "host" | "container"; sourceMounts: Array<{ source: string; target: string; readOnly: boolean }>; - autoStartSessions: Array<{ title: string; cwd: string; command: string; cols: number; rows: number; resumePrompt: boolean }>; + autoStartSessions: Array<{ title: string; cwd: string; command: string; cols: number; rows: number; resumePrompt: boolean; fallbackShell: boolean }>; sessionStartModes: SessionStartModes; autoResumePrompt: AutoResumePrompt; environment: Record; @@ -370,11 +370,14 @@ function resumeCommandWithPrompt( session: WebtermTarget["runtime"]["autoStartSessions"][number], prompt: AutoResumePrompt, ): string { - if (!session.resumePrompt) return session.command; - if (!/^\s*(?:mycx|oncx)\s+resume\s+\S+\s*$/.test(session.command)) { - throw new Error(`resumePrompt requires a mycx/oncx resume command: ${session.title}`); + let command = session.command.trim(); + if (session.resumePrompt) { + if (!/^\s*(?:mycx|oncx)\s+resume\s+\S+\s*$/.test(session.command)) { + throw new Error(`resumePrompt requires a mycx/oncx resume command: ${session.title}`); + } + command = `${command} ${quoteShellArg(prompt.prompt)}`; } - return `${session.command.trim()} ${quoteShellArg(prompt.prompt)}`; + return session.fallbackShell ? `${command}; exec /bin/bash -l` : command; } function quoteShellArg(value: string): string { @@ -554,6 +557,7 @@ function parseAutoStartSessions(value: unknown, path: string): WebtermTarget["ru cols: integerField(record, "cols", itemPath), rows: integerField(record, "rows", itemPath), resumePrompt: booleanField(record, "resumePrompt", itemPath), + fallbackShell: booleanField(record, "fallbackShell", itemPath), }; }); }