Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Send the burst card refusal through refusalText
AdityaUmale8c3ffcd79aaa
diff --git a/server/routes/burst.test.ts b/server/routes/burst.test.tsindex 8b59ab276d..472cb9c5c2 100644--- a/server/routes/burst.test.ts+++ b/server/routes/burst.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from "vitest";import type { RequestAuth } from "../request-auth.ts";+import { USER_ERROR, userError } from "../user-errors.ts";import { createBurstProposalRoutes, createBurstRoutes, type BurstProposalDeps, type BurstRoutesDeps } from "./burst.ts";import { PASS, type RouteContext } from "./table.ts";@@ -33,8 +34,8 @@ describe("burst card routes", () => {it("refuses a press from someone who may not answer this chat's cards", async () => {const { context, sent } = ctx("/api/bursts/b1/run", "POST");- await createBurstRoutes(deps({ refusal: () => "Only the owner of this Cloud can answer this card.", run: () => { throw new Error("must not run"); } }))(context);- expect(sent).toEqual({ status: 403, body: { error: "Only the owner of this Cloud can answer this card." } });+ await createBurstRoutes(deps({ refusal: () => USER_ERROR["serverError.card.cloudOwnerOnly"], run: () => { throw new Error("must not run"); } }))(context);+ expect(sent).toEqual({ status: 403, body: userError("serverError.card.cloudOwnerOnly") });});it("runs, cancels and retries on a press", async () => {diff --git a/server/routes/burst.ts b/server/routes/burst.tsindex 90d65b8b1e..7a214229c0 100644--- a/server/routes/burst.ts+++ b/server/routes/burst.ts@@ -4,6 +4,7 @@ import type { BurstCardData } from "../../shared/burst.ts";import type { ModelSelection } from "../../shared/wire.ts";import { INSTRUCTIONS_MAX, ITEM_MAX, type BurstRefusal } from "../burst/manager.ts";import type { RequestAuth } from "../request-auth.ts";+import { refusalText } from "../user-errors.ts";import { PASS, type RouteHandler } from "./table.ts";const LIST_MAX = 1_000;@@ -37,7 +38,7 @@ export function createBurstRoutes(deps: BurstRoutesDeps): RouteHandler {}if (method !== "POST") return json(res, 405, { error: "method not allowed" });const refused = deps.refusal(auth, owner.threadId, id!);- if (refused) return json(res, 403, { error: refused });+ if (refused) return json(res, 403, refusalText(refused));let result: BurstCardData | BurstRefusal;if (action === "edit") {const parsed = editSchema.safeParse(await readBody(req));