Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(runtime): read the whole hand-back reply for a NEEDS INPUT question
AdityaUmale2d8ef3312e52
diff --git a/server/host/acting-person.test.ts b/server/host/acting-person.test.tsindex 472da9dbcc..5dc2bf13f3 100644--- a/server/host/acting-person.test.ts+++ b/server/host/acting-person.test.ts@@ -220,6 +220,7 @@ describe("what work in one person's private chat hands back", () => {expect(asked).toEqual({ ok: true, text: "NEEDS INPUT: Helper has a question for Ada, in Helper's chat with Ada.", cards: { question: "Helper has a question for Ada, in Helper's chat with Ada.", ids: ["c1"] }, privateQuestion: true });expect(privateHandBack({ ok: true, text: "Found two.\nNEEDS INPUT: Forward it to Ben?" }, place(null)), "only she can answer it").toMatchObject({ privateQuestion: true });expect(privateHandBack({ ok: true, text: "Found two.\nNEEDS INPUT: 无" }, place(null)), "a line that asks nothing").toEqual({ ok: true, text: "Done. The result is in Helper's chat with Ada." });+ expect(privateHandBack({ ok: true, text: "Found two.\nNEEDS INPUT: Which account?\nDefault: staging" }, place(null)), "a question with a default").toMatchObject({ text: "NEEDS INPUT: Helper has a question for Ada, in Helper's chat with Ada.", privateQuestion: true });});it("hands everything back into her own private chat, and anything from a chat others read already", () => {diff --git a/server/host/acting-person.ts b/server/host/acting-person.tsindex c3e71f603e..3c85870b70 100644--- a/server/host/acting-person.ts+++ b/server/host/acting-person.ts@@ -167,7 +167,6 @@ type Place = { child: string | null; parent: string | null };/** Work in one person's private chat, for a requester whose chat is not that one: its words stay with that person. */export const keptPrivate = (place: Place): boolean => Boolean(place.child) && place.parent !== place.child;-const lastLineAsks = (text: string) => needsInputQuestion(text.trimEnd().split(/\r?\n/).at(-1) ?? "") !== undefined;/** What work that ran in one person's private chat hands back to a place others read: where its result is, never the* result, which may hold what their own apps brought back or their private notes (a private chat never reaches a room:@@ -178,7 +177,7 @@ export function privateHandBack<T extends HandedBack>(outcome: T, place: Place &const where = `${place.bot}'s chat with ${place.person}`;const question = `${place.bot} has a question for ${place.person}, in ${where}.`;const { evidence: _evidence, ...rest } = outcome;- const asks = lastLineAsks(outcome.text);+ const asks = needsInputQuestion(outcome.text) !== undefined;return {...rest,text: asks ? `NEEDS INPUT: ${question}` : `${outcome.ok ? "Done" : "It stopped before it finished"}. The result is in ${where}.`,diff --git a/server/runtime-coordinator.test.ts b/server/runtime-coordinator.test.tsindex bf7053d5a4..38d191215f 100644--- a/server/runtime-coordinator.test.ts+++ b/server/runtime-coordinator.test.ts@@ -822,6 +822,8 @@ describe("RuntimeCoordinator: the run adapter", () => {expect(w.host.parks).toHaveLength(0);expect(w.coordinator.node(node.id)).toMatchObject({ status: "completed", result: "Imported all 8 guides.\nNEEDS INPUT: 无" });expect(w.host.runs.filter(run => run.node.id === node.id)).toHaveLength(1);+ expect(w.host.reports).toHaveLength(1);+ expect(w.host.reports[0]).toMatchObject({ child: { id: node.id, status: "completed" } });});it("resumes the requester with a teammate's NEEDS INPUT question while its other teammate still works", async () => {