Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(routines): drop the default line's own indent when a long NEEDS INPUT block is cut
AdityaUmale0890728f9808
diff --git a/server/automation-reports.test.ts b/server/automation-reports.test.tsindex a9bf03ef50..9e3e941299 100644--- a/server/automation-reports.test.ts+++ b/server/automation-reports.test.ts@@ -56,6 +56,9 @@ describe("routineRunNeedsReview", () => {const spaced = `${"Long report. ".repeat(300)}\nNEEDS INPUT:\n${"\n".repeat(2_000)}default: ${"wait ".repeat(500)}`;expect(routineRunNeedsReview({ status: "completed", output: clipRunOutput(spaced, 2_000) })).toBe(routineRunNeedsReview({ status: "completed" }, spaced));expect(routineRunNeedsReview({ status: "completed", output: clipRunOutput(spaced, 2_000) })).toBe(true);+ const indented = `${"Long report. ".repeat(300)}\nNEEDS INPUT:\n${" ".repeat(2_000)}default: wait`;+ expect(routineRunNeedsReview({ status: "completed", output: clipRunOutput(indented, 2_000) })).toBe(routineRunNeedsReview({ status: "completed" }, indented));+ expect(routineRunNeedsReview({ status: "completed", output: clipRunOutput(indented, 2_000) })).toBe(true);expect(routineRunNeedsReview({ status: "cancelled" })).toBe(false);});});diff --git a/server/routine-lines.test.ts b/server/routine-lines.test.tsindex 8713e4c37e..aedd1e0936 100644--- a/server/routine-lines.test.ts+++ b/server/routine-lines.test.ts@@ -91,5 +91,6 @@ describe("clipRunOutput", () => {const cut = clipRunOutput(`${long}\nNEEDS INPUT:\n${"\n".repeat(2_000)}default: ${"wait ".repeat(500)}`, 2_000);expect(cut.length).toBe(2_000);expect(cut.startsWith("NEEDS INPUT:\ndefault: wait")).toBe(true);+ expect(clipRunOutput(`${long}\nNEEDS INPUT:\n${" ".repeat(2_000)}default: wait`, 2_000)).toBe("NEEDS INPUT:\ndefault: wait…");});});diff --git a/server/routine-lines.ts b/server/routine-lines.tsindex 03cadf3a25..cceee48718 100644--- a/server/routine-lines.ts+++ b/server/routine-lines.ts@@ -104,8 +104,8 @@ export function clipRunOutput(text: string, max: number): string {if (tail.length > max) {const question = lines[at]!.trim();// A bare NEEDS INPUT: line asks through its default: line, so that line is kept (cut) with it.- // Blank lines between them say nothing, so they go first; otherwise they could push the default: line out.- if (!question.replace(CLOSING_QUESTION, "").trim()) return `${[question, ...after].join("\n").slice(0, max - 1)}…`;+ // Blank lines between them and the default: line's own indent say nothing, so they go first; otherwise they could push it out.+ if (!question.replace(CLOSING_QUESTION, "").trim()) return `${[question, ...after.map((line) => line.trim())].join("\n").slice(0, max - 1)}…`;return question.length <= max ? question : `${question.slice(0, max - 1)}…`;}const room = max - tail.length - 3;