Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge origin/main into train/nov16-s1

milind-soni023eedeed43a
diff --cc shared/person-wait.test.ts
index 7ee231d188,fbdc7aeb1c..ecb6012917
--- a/shared/person-wait.test.ts
+++ b/shared/person-wait.test.ts
@@@ -65,14 -65,29 +65,41 @@@ describe("a conversation's visible bran
});
});
+describe("cards that stay in view", () => {
+ it("are an open key or app to connect, not a question, sign-in, or a settled or first-hour card", () => {
+ expect(staysInView(secret())).toBe(true);
+ expect(staysInView(connector())).toBe(true);
+ expect(staysInView(secret({ dismissed: true }))).toBe(false);
+ expect(staysInView(connector({ resumeKey: "first-hour-gmail" }))).toBe(false);
+ expect(staysInView(signIn())).toBe(false);
+ expect(staysInView(options({ subtitle: "Which day?" }))).toBe(false);
+ expect(staysInView(row({}))).toBe(false);
+ });
+});
++
+ describe("a question the person wrote past", () => {
+ const question = { ...options({ subtitle: "Which page?" }), id: "question" };
+ const password = { ...secret(), id: "password" };
+ const wrote = (fields: Partial<WireMessage> = {}) => row({ id: "said", role: "user", text: "Do the report instead", ...fields });
+
+ it("no longer waits once the person writes after it, while cards that are not questions still do", () => {
+ expect(restingOnPerson([question])?.messageId).toBe("question");
+ expect(restingOnPerson([question, wrote()])).toBeUndefined();
+ expect(restingOnPerson([password, question, wrote()])?.messageId).toBe("password");
+ expect(restingOnPerson([wrote(), question])?.messageId).toBe("question");
+ });
+
+ it.each([
+ ["another bot", { peerAsk: { botId: "scout", name: "Scout" } }],
+ ["a relay", { relayed: true }],
+ ["the API", { via: "api" as const }],
+ ["an automation", { automated: true }],
+ ])("still waits after a line %s wrote", (_name, fields) => {
+ expect(restingOnPerson([question, wrote(fields)])?.messageId).toBe("question");
+ });
+
+ it("in a room, waits until the person replies to the question itself", () => {
+ expect(restingOnPerson([question, wrote()], true)?.messageId).toBe("question");
+ expect(restingOnPerson([question, wrote({ replyToId: "question" })], true)).toBeUndefined();
+ });
+ });