From 159372a121079b40425eb587c77cf16d171627f9 Mon Sep 17 00:00:00 2001 From: atimics Date: Wed, 29 Jul 2026 21:07:30 -0700 Subject: [PATCH] fix: mount Ruby High app routes at declared paths --- src/app.test.ts | 36 ++++++++++++++++++++++++++++++++++++ src/app.ts | 8 +++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/app.test.ts diff --git a/src/app.test.ts b/src/app.test.ts new file mode 100644 index 0000000..5edb4a6 --- /dev/null +++ b/src/app.test.ts @@ -0,0 +1,36 @@ +import { describe, expect, it } from "vitest"; +import { rubyHighRoutes } from "./app.js"; + +describe("Ruby High app routes", () => { + it("mounts every declared route at its exact public contract path", () => { + expect(rubyHighRoutes).toHaveLength(4); + expect(rubyHighRoutes).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + type: "GET", + path: "/ruby-high/viewer", + rawPath: true, + public: false, + }), + expect.objectContaining({ + type: "GET", + path: "/ruby-high/status", + rawPath: true, + public: false, + }), + expect.objectContaining({ + type: "POST", + path: "/ruby-high/autonomy", + rawPath: true, + public: false, + }), + expect.objectContaining({ + type: "POST", + path: "/ruby-high/launch", + rawPath: true, + public: false, + }), + ]), + ); + }); +}); diff --git a/src/app.ts b/src/app.ts index fe59a02..7194a96 100644 --- a/src/app.ts +++ b/src/app.ts @@ -5,10 +5,13 @@ import type { } from "@elizaos/core"; import { RubyHighAgentService } from "./service.js"; -export const rubyHighRoutes: Route[] = [ +type RubyHighRoute = Route & { rawPath: true }; + +export const rubyHighRoutes: RubyHighRoute[] = [ { type: "GET", path: "/ruby-high/viewer", + rawPath: true, public: false, handler: async (_req, res, runtime) => { const service = runtime.getService( @@ -34,6 +37,7 @@ export const rubyHighRoutes: Route[] = [ { type: "GET", path: "/ruby-high/status", + rawPath: true, public: false, handler: async (_req, res, runtime) => { setHeaders(res, { "Cache-Control": "no-store" }); @@ -43,6 +47,7 @@ export const rubyHighRoutes: Route[] = [ { type: "POST", path: "/ruby-high/autonomy", + rawPath: true, public: false, handler: async (req, res, runtime) => { const input = @@ -62,6 +67,7 @@ export const rubyHighRoutes: Route[] = [ { type: "POST", path: "/ruby-high/launch", + rawPath: true, public: false, handler: async (_req, res, runtime) => { const launch = await serviceOrThrow(runtime).client.launch();