Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Bot answers: room for redaction markers, so a 12 000-character answer keeps its end
AdityaUmaled9420e36dce7
diff --git a/server/runtime/envelope.test.ts b/server/runtime/envelope.test.tsindex 7c9b24eb7c..2db02284a8 100644--- a/server/runtime/envelope.test.ts+++ b/server/runtime/envelope.test.ts@@ -1,3 +1,4 @@+import { addHeldSecretScrubber, HELD_SECRET_MASK } from "../../shared/redact.ts";import { describe, expect, it } from "vitest";import { CONSENT_RULE } from "../peer-provenance.ts";@@ -483,6 +484,19 @@ describe("composeEnvelope at Full access: nothing a bot can settle waits on theexpect(envelopeNote(envelope)).toContain(line);expect(composeResume(long, chief, [])).toContain(line);});++ it("keeps the end of a 12 000-character answer that redaction made longer", () => {+ const removeScrubber = addHeldSecretScrubber((text) => text.replaceAll("code 42", `code ${HELD_SECRET_MASK}`));+ try {+ const body = "Sent code 42. ".repeat(100);+ const answer = `${body}${"x".repeat(12_000 - body.length - 4)}End.`;+ expect(answer.length).toBe(12_000);+ const envelope = composeEnvelope(assignment({ question: "Done?", answer, answeredBy: { kind: "bot", botId: "chief" } }), { ...names, answerer: "Chief" });+ expect(envelope).toContain(`End.".`);+ } finally {+ removeScrubber();+ }+ });});describe("composeResume", () => {diff --git a/server/runtime/envelope.ts b/server/runtime/envelope.tsindex 914b761799..b53dc0b318 100644--- a/server/runtime/envelope.ts+++ b/server/runtime/envelope.ts@@ -9,8 +9,8 @@ import type { Assignment, EnvelopeNames, Level, OriginSource, TurnEvidence } froexport const ENVELOPE_MARK = "[From";const QUOTE_MAX = 400;-/** An answer is quoted whole: it is what the next turn works from, and the runtime already keeps it to 12 000 characters. */-const ANSWER_QUOTE_MAX = 12_000;+// Headroom over the runtime's 12 000-character answer: redaction markers can lengthen it, and the next turn works from all of it.+const ANSWER_QUOTE_MAX = 16_000;const NAME_MAX = 80;const DETAIL_MAX = 200;const FILES_SHOWN = 8;