From f52186dbe0887453f4ec9b103b1b5454bffd2ce4 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 11 Jul 2026 07:58:20 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=8A=A8=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E9=80=80=E5=87=BA=E5=90=8E=E5=9B=9E=E5=88=B0?= =?UTF-8?q?=20Bash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/platform-infra/webterm.yaml | 4 ++++ scripts/src/platform-infra-webterm.ts | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) 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), }; }); }