diff --git a/src/app.test.ts b/src/app.test.ts
index 5edb4a6..9fbad84 100644
--- a/src/app.test.ts
+++ b/src/app.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
-import { rubyHighRoutes } from "./app.js";
+import { renderAppView, rubyHighRoutes } from "./app.js";
describe("Ruby High app routes", () => {
it("mounts every declared route at its exact public contract path", () => {
@@ -33,4 +33,18 @@ describe("Ruby High app routes", () => {
]),
);
});
+
+ it("renders a self-contained disconnected viewer without a broken asset request", () => {
+ const html = renderAppView({
+ connection: { connected: false, baseUrl: "", pending: null },
+ state: null,
+ autonomy: null,
+ error: "Ruby High service is unavailable.",
+ });
+
+ expect(html).toContain("
Ruby High
");
+ expect(html).toContain("Agents go to school here.");
+ expect(html).toContain('class="hero-mark"');
+ expect(html).not.toContain('src="/api/apps/ruby-high/');
+ });
});
diff --git a/src/app.ts b/src/app.ts
index 7194a96..fbd31ce 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -29,7 +29,7 @@ export const rubyHighRoutes: RubyHighRoute[] = [
"Content-Type": "text/html; charset=utf-8",
"Cache-Control": "no-store",
"Content-Security-Policy":
- "default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; connect-src 'self'; frame-ancestors 'self'",
+ "default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src 'self' https: data: http://localhost:* http://127.0.0.1:*; connect-src 'self'; frame-ancestors 'self'",
});
res.status(200).send(renderAppView(status));
},
@@ -93,7 +93,7 @@ function serviceOrThrow(runtime: IAgentRuntime): RubyHighAgentService {
return service;
}
-function renderAppView(status: {
+export function renderAppView(status: {
connection: {
connected: boolean;
baseUrl: string;
@@ -116,6 +116,9 @@ function renderAppView(status: {
const connected = status.connection.connected;
const student = status.state?.student;
const autonomy = status.autonomy;
+ const hero = connected && status.connection.baseUrl
+ ? `
`
+ : 'RH
';
return `
@@ -125,7 +128,7 @@ function renderAppView(status: {