Skip to content

Commit 9286f7d

Browse files
authored
fix: openshell naming migration and launchable start up issues (NVIDIA#21)
* Add rebrand for welcome UI, include launch.sh script * Remove BASH_SOURCE dependency * Invalid key handlin * Wait for valid key before triggering * Address silent fail on launch.sh * Add retry count and delay * Add favicon, handle ghcr.io login if params present, fix logo * Address broken return * Consistent favicon, add multi context login if token present * Enforce consistent favicon * Ensusre sandbox base image is pulled * Handle proper status updates in welcome UI * Cosmetic rebrand cleanup. * Ensure non-root user context
1 parent ac31bd5 commit 9286f7d

15 files changed

Lines changed: 783 additions & 108 deletions

‎brev/launch.sh‎

Lines changed: 585 additions & 0 deletions
Large diffs are not rendered by default.

‎brev/welcome-ui/SERVER_ARCHITECTURE.md‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# NemoClaw Welcome UI — `server.py` Complete Architecture Reference
1+
# OpenShell Welcome UI — `server.py` Complete Architecture Reference
22

33
> **Purpose:** This document provides an exhaustive, implementation-level description of `server.py` so that a software engineer can faithfully recreate it in Node.js with log-streaming support. Every endpoint, state machine, threading model, edge case, and dependency is documented.
44
@@ -409,7 +409,7 @@ Step 10: Cleanup temp policy file
409409

410410
### 6.3 `POST /api/inject-key`
411411

412-
**Purpose:** Asynchronously update the NemoClaw provider credential with an API key.
412+
**Purpose:** Asynchronously update the OpenShell provider credential with an API key.
413413

414414
**Request Body:**
415415
```json
@@ -450,7 +450,7 @@ Step 3: If success:
450450

451451
### 6.4 `POST /api/policy-sync`
452452

453-
**Purpose:** Push a policy YAML to the NemoClaw gateway via the host-side CLI.
453+
**Purpose:** Push a policy YAML to the OpenShell gateway via the host-side CLI.
454454

455455
**Request Body:** Raw YAML text (Content-Type is not checked, but body is read as UTF-8).
456456

@@ -499,10 +499,10 @@ Step 6: Cleanup tempfile (always, even on failure — in finally block)
499499
"gatewayUrl": "https://8080-xxx.brevlab.com",
500500
"gatewayPort": 8080,
501501
"instructions": {
502-
"install": "curl -fsSL https://github.com/NVIDIA/NemoClaw/releases/download/devel/install.sh | sh",
503-
"connect": "nemoclaw gateway add https://8080-xxx.brevlab.com",
504-
"createSandbox": "nemoclaw sandbox create -- claude",
505-
"tui": "nemoclaw term"
502+
"install": "curl -fsSL https://github.com/NVIDIA/OpenShell/releases/download/devel/install.sh | sh",
503+
"connect": "openshell gateway add https://8080-xxx.brevlab.com",
504+
"createSandbox": "openshell sandbox create -- claude",
505+
"tui": "openshell term"
506506
}
507507
}
508508
```
@@ -519,7 +519,7 @@ Step 6: Cleanup tempfile (always, even on failure — in finally block)
519519

520520
### 6.6 `GET /api/providers`
521521

522-
**Purpose:** List all configured NemoClaw providers with their details.
522+
**Purpose:** List all configured OpenShell providers with their details.
523523

524524
**Processing:**
525525
```
@@ -1013,7 +1013,7 @@ Gateway URL:
10131013
Else: http://{hostname}:8080
10141014
```
10151015

1016-
This is a DIFFERENT port (8080) — the NemoClaw gateway itself, not the welcome-ui.
1016+
This is a DIFFERENT port (8080) — the OpenShell gateway itself, not the welcome-ui.
10171017

10181018
---
10191019

@@ -1081,7 +1081,7 @@ Page Load
10811081
│ → keyInjected tracked via sandbox-status polling
10821082
│
10831083
├── When sandboxReady + keyValid + keyInjected:
1084-
│ → "Open NemoClaw" button enabled
1084+
│ → "Open OpenShell" button enabled
10851085
│ → Click opens: sandboxUrl + ?nvapi=<key> in new tab
10861086
│
10871087
└── User clicks "Other Agents" card
@@ -1098,7 +1098,7 @@ Page Load
10981098
| 2 | API key valid + tasks running | "Provisioning Sandbox..." | No (spinner) |
10991099
| 3 | API key empty + tasks done | "Waiting for API key..." | No |
11001100
| 4 | API key valid + sandbox ready + key not injected | "Configuring API key..." | No (spinner) |
1101-
| 5 | API key valid + sandbox ready + key injected | "Open NemoClaw" | Yes |
1101+
| 5 | API key valid + sandbox ready + key injected | "Open OpenShell" | Yes |
11021102

11031103
### API Key Validation
11041104

‎brev/welcome-ui/__tests__/connection-details.test.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ describe("GET /api/connection-details", () => {
5151
expect(res.body.gatewayPort).toBe(8080);
5252
expect(res.body.instructions).toBeDefined();
5353
expect(res.body.instructions.install).toContain("curl");
54-
expect(res.body.instructions.connect).toContain("nemoclaw gateway add");
55-
expect(res.body.instructions.createSandbox).toContain("nemoclaw sandbox create");
56-
expect(res.body.instructions.tui).toBe("nemoclaw term");
54+
expect(res.body.instructions.connect).toContain("openshell gateway add");
55+
expect(res.body.instructions.createSandbox).toContain("openshell sandbox create");
56+
expect(res.body.instructions.tui).toBe("openshell term");
5757
});
5858

5959
it("TC-CD02: with Brev ID, gatewayUrl is https://8080-{id}.brevlab.com", async () => {
@@ -99,11 +99,11 @@ describe("GET /api/connection-details", () => {
9999
it("TC-CD06: instructions contain exact CLI strings", async () => {
100100
const res = await request(server).get("/api/connection-details");
101101
expect(res.body.instructions.install).toBe(
102-
"curl -fsSL https://github.com/NVIDIA/NemoClaw/releases/download/devel/install.sh | sh"
102+
"curl -fsSL https://github.com/NVIDIA/OpenShell/releases/download/devel/install.sh | sh"
103103
);
104104
expect(res.body.instructions.createSandbox).toBe(
105-
"nemoclaw sandbox create -- claude"
105+
"openshell sandbox create -- claude"
106106
);
107-
expect(res.body.instructions.tui).toBe("nemoclaw term");
107+
expect(res.body.instructions.tui).toBe("openshell term");
108108
});
109109
});

‎brev/welcome-ui/__tests__/routing.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe("routing — priority", () => {
9999
const res = await request(server).get("/");
100100
expect(res.status).toBe(200);
101101
expect(res.headers["content-type"]).toContain("text/html");
102-
expect(res.text).toContain("NemoClaw");
102+
expect(res.text).toContain("OpenShell");
103103
});
104104

105105
it("TC-R13: unknown path returns 404 when sandbox NOT ready", async () => {

‎brev/welcome-ui/__tests__/static-files.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe("static file serving", () => {
2424
const res = await request(server).get("/styles.css");
2525
expect(res.status).toBe(200);
2626
expect(res.headers["content-type"]).toContain("text/css");
27-
expect(res.text).toContain("NemoClaw");
27+
expect(res.text).toContain("OpenShell");
2828
});
2929

3030
it("TC-SF02: GET /app.js returns JS with application/javascript content-type", async () => {
@@ -43,7 +43,7 @@ describe("static file serving", () => {
4343
expect(res.status).toBe(200);
4444
expect(res.headers["content-type"]).toContain("text/html");
4545
expect(res.text).not.toContain("{{OTHER_AGENTS_MODAL}}");
46-
expect(res.text).toContain("NemoClaw");
46+
expect(res.text).toContain("OpenShell");
4747
});
4848

4949
it("TC-SF05: GET /index.html returns templated index.html", async () => {

‎brev/welcome-ui/__tests__/template-render.test.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe("renderOtherAgentsModal", () => {
3737
it("TC-T07: steps are auto-numbered (1., 2., etc.)", () => {
3838
const html = renderOtherAgentsModal();
3939
if (!html) return;
40-
expect(html).toContain("1. Install NemoClaw CLI");
40+
expect(html).toContain("1. Install OpenShell CLI");
4141
expect(html).toContain("2. Add the gateway");
4242
expect(html).toContain("3. Create a sandbox");
4343
expect(html).toContain("4. Manage policies");
@@ -54,7 +54,7 @@ describe("renderOtherAgentsModal", () => {
5454
const html = renderOtherAgentsModal();
5555
if (!html) return;
5656
expect(html).toContain('<span class="comment"># Claude Code</span>');
57-
expect(html).toContain("nemoclaw sandbox create -- claude");
57+
expect(html).toContain("openshell sandbox create -- claude");
5858
});
5959

6060
it("TC-T10: dict command with id renders cmd span with id attribute", () => {
@@ -73,7 +73,7 @@ describe("renderOtherAgentsModal", () => {
7373
it("TC-T12: copyable + single command + no button ID renders data-copy", () => {
7474
const html = renderOtherAgentsModal();
7575
if (!html) return;
76-
// "Install NemoClaw CLI" step has copyable:true and one command, no copy_button_id
76+
// "Install OpenShell CLI" step has copyable:true and one command, no copy_button_id
7777
expect(html).toContain("data-copy=");
7878
});
7979

‎brev/welcome-ui/app.js‎

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@
120120
let injectInFlight = false;
121121
let injectTimer = null;
122122
let lastSubmittedKey = "";
123+
let keyInjectError = "";
124+
let installFailed = false;
123125

124126
function stopPolling() {
125127
if (pollTimer) {
@@ -132,6 +134,7 @@
132134
if (key === lastSubmittedKey) return;
133135
lastSubmittedKey = key;
134136
keyInjected = false;
137+
keyInjectError = "";
135138
injectInFlight = true;
136139
updateButtonState();
137140
try {
@@ -149,6 +152,9 @@
149152
updateButtonState();
150153
const key = apiKeyInput.value.trim();
151154
if (!isApiKeyValid()) return;
155+
if (!sandboxReady && !installTriggered && !installFailed) {
156+
triggerInstall();
157+
}
152158
if (injectTimer) clearTimeout(injectTimer);
153159
injectTimer = setTimeout(() => submitKeyForInjection(key), 300);
154160
}
@@ -159,7 +165,7 @@
159165
* 2. API valid + tasks running -> "Provisioning Sandbox…" (disabled, spinner)
160166
* 3. API empty + tasks complete -> "Waiting for API key…" (disabled)
161167
* 4. API valid + sandbox ready + !key -> "Configuring API key…" (disabled, spinner)
162-
* 5. API valid + sandbox ready + key -> "Open NemoClaw" (enabled)
168+
* 5. API valid + sandbox ready + key -> "Open OpenShell" (enabled)
163169
*/
164170
function updateButtonState() {
165171
const keyValid = isApiKeyValid();
@@ -169,6 +175,9 @@
169175
if (keyRaw.length === 0) {
170176
keyHint.textContent = "";
171177
keyHint.className = "form-field__hint";
178+
} else if (keyInjectError) {
179+
keyHint.textContent = keyInjectError;
180+
keyHint.className = "form-field__hint form-field__hint--warn";
172181
} else if (keyValid) {
173182
keyHint.textContent = "Valid key format";
174183
keyHint.className = "form-field__hint form-field__hint--ok";
@@ -191,13 +200,19 @@
191200
btnLaunch.classList.add("btn--ready");
192201
btnSpinner.hidden = true;
193202
btnSpinner.style.display = "none";
194-
btnLaunchLabel.textContent = "Open NemoClaw";
195-
} else if (sandboxReady && keyValid && !keyInjected) {
203+
btnLaunchLabel.textContent = "Open OpenShell";
204+
} else if (sandboxReady && keyValid && !keyInjected && (injectInFlight || !keyInjectError)) {
196205
btnLaunch.disabled = true;
197206
btnLaunch.classList.remove("btn--ready");
198207
btnSpinner.hidden = false;
199208
btnSpinner.style.display = "";
200209
btnLaunchLabel.textContent = "Configuring API key\u2026";
210+
} else if (sandboxReady && keyValid && !keyInjected) {
211+
btnLaunch.disabled = true;
212+
btnLaunch.classList.remove("btn--ready");
213+
btnSpinner.hidden = true;
214+
btnSpinner.style.display = "none";
215+
btnLaunchLabel.textContent = "Update API key to retry";
201216
} else if (!sandboxReady && keyValid) {
202217
btnLaunch.disabled = true;
203218
btnLaunch.classList.remove("btn--ready");
@@ -225,6 +240,18 @@
225240
errorMessage.textContent = msg;
226241
}
227242

243+
function setSandboxChecklistCreating() {
244+
setLogIcon(logSandboxIcon, "spin");
245+
logSandbox.querySelector(".console__text").textContent =
246+
"Provisioning secure OpenShell sandbox...";
247+
}
248+
249+
function setSandboxChecklistReady() {
250+
setLogIcon(logSandboxIcon, "done");
251+
logSandbox.querySelector(".console__text").textContent =
252+
"Secure OpenShell sandbox created.";
253+
}
254+
228255
async function triggerInstall() {
229256
if (installTriggered) return;
230257
installTriggered = true;
@@ -247,9 +274,7 @@
247274
return;
248275
}
249276

250-
setLogIcon(logSandboxIcon, "done");
251-
logSandbox.querySelector(".console__text").textContent =
252-
"Secure NemoClaw sandbox created.";
277+
setSandboxChecklistCreating();
253278
setLogIcon(logGatewayIcon, "spin");
254279
startPolling();
255280
} catch {
@@ -268,11 +293,18 @@
268293
if (!injectInFlight) {
269294
keyInjected = !!data.key_injected;
270295
}
296+
keyInjectError = data.key_inject_error || "";
297+
if (keyInjectError) {
298+
injectInFlight = false;
299+
keyInjected = false;
300+
lastSubmittedKey = "";
301+
}
271302

272303
if (data.status === "running") {
273304
sandboxReady = true;
274305
sandboxUrl = data.url || null;
275306

307+
setSandboxChecklistReady();
276308
setLogIcon(logGatewayIcon, "done");
277309
logGateway.querySelector(".console__text").textContent =
278310
"OpenClaw agent gateway online.";
@@ -284,6 +316,7 @@
284316
} else if (data.status === "error") {
285317
stopPolling();
286318
installTriggered = false;
319+
installFailed = true;
287320
showError(data.error || "Sandbox creation failed");
288321
} else {
289322
updateButtonState();
@@ -308,13 +341,15 @@
308341
sandboxUrl = null;
309342
installTriggered = false;
310343
keyInjected = false;
344+
keyInjectError = "";
345+
installFailed = false;
311346
lastSubmittedKey = "";
312347
stopPolling();
313348

314349
setLogIcon(logSandboxIcon, null);
315350
setLogIcon(logGatewayIcon, null);
316351
logSandbox.querySelector(".console__text").textContent =
317-
"Initializing secure NemoClaw sandbox...";
352+
"Initializing secure OpenShell sandbox...";
318353
logGateway.querySelector(".console__text").textContent =
319354
"Launching OpenClaw agent gateway...";
320355
logReady.hidden = true;
@@ -344,9 +379,7 @@
344379
sandboxUrl = data.url;
345380
installTriggered = true;
346381

347-
setLogIcon(logSandboxIcon, "done");
348-
logSandbox.querySelector(".console__text").textContent =
349-
"Secure NemoClaw sandbox created.";
382+
setSandboxChecklistReady();
350383
setLogIcon(logGatewayIcon, "done");
351384
logGateway.querySelector(".console__text").textContent =
352385
"OpenClaw agent gateway online.";
@@ -359,9 +392,7 @@
359392
} else if (data.status === "creating") {
360393
installTriggered = true;
361394

362-
setLogIcon(logSandboxIcon, "done");
363-
logSandbox.querySelector(".console__text").textContent =
364-
"Secure NemoClaw sandbox created.";
395+
setSandboxChecklistCreating();
365396
setLogIcon(logGatewayIcon, "spin");
366397
updateButtonState();
367398

@@ -379,21 +410,23 @@
379410
try {
380411
const res = await fetch("/api/connection-details");
381412
const data = await res.json();
382-
const cmd = `nemoclaw cluster connect ${data.hostname}`;
413+
const cmd = data.instructions?.connect || `openshell gateway add ${data.gatewayUrl}`;
383414
connectCmd.textContent = cmd;
384415
copyConnect.dataset.copy = cmd;
385416
} catch {
386-
connectCmd.textContent = "nemoclaw cluster connect <hostname>";
417+
connectCmd.textContent = "openshell gateway add <gateway-url>";
387418
}
388419
}
389420

390421
// -- Event wiring ---------------------------------------------------
391422

392423
cardOpenclaw.addEventListener("click", () => {
393424
showOverlay(overlayInstall);
394-
showMainView();
395-
if (!installTriggered) {
396-
triggerInstall();
425+
if (installFailed) {
426+
stepError.hidden = false;
427+
installMain.hidden = true;
428+
} else {
429+
showMainView();
397430
}
398431
apiKeyInput.focus();
399432
updateButtonState();

‎brev/welcome-ui/favicon.ico‎

31.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)