Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/app.test.ts
Original file line number Diff line number Diff line change
@@ -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,
}),
]),
);
});
});
8 changes: 7 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<RubyHighAgentService>(
Expand All @@ -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" });
Expand All @@ -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 =
Expand All @@ -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();
Expand Down
Loading