Skip to content

🤖 Open-source, local-first alternative to Grok Bot, OpenAI dots and Claude Duet. Your own AI bots on any model: GPT, Claude, Gemini, Grok, DeepSeek, Kimi, GLM and 70+ more through one Modelflare key. Reach them in the app, WeChat or Feishu; they remember you, work in the background, run commands and use your computer. Pay per use.

Merge remote-tracking branch 'origin/master' into feat/pause-background

Marla4d94ed0247ea
diff --cc test/tasks.integration.test.ts
index 885b60e,7990490..9073727
--- a/test/tasks.integration.test.ts
+++ b/test/tasks.integration.test.ts
@@@ -196,26 -197,26 +199,46 @@@ describe.skipIf(!runtime || !hasBwrap |
expect(host.restarts).toBe(0);
}, 180_000);
+ it("pause switch: the chat agent pauses background work; a new task waits (chat still answers), /tasks says so; resuming starts it and its result arrives once", async () => {
+ ilink.push(OWNER, "PAUSEBG on");
+ await waitFor(() => sentTo("PAUSED-on").length === 1);
+ expect(app.store.getBot("default")!.settings.paused).toBe(true);
+ const t = await research("PAUSEQ");
+ await new Promise((r) => setTimeout(r, 1500));
+ expect(stage("PAUSEQ")).toBe("working/queued");
+ expect(calls.some((c) => c.task && c.users.some((u) => u.includes("RESEARCH PAUSEQ")))).toBe(false);
+ ilink.push(OWNER, "/tasks");
+ await waitFor(() => sentTo("后台任务:").some((s) => s.text.includes("调研 PAUSEQ · 排队中")));
+ expect(sentTo("后台任务:").at(-1)!.text).toMatch(/\n后台工作已暂停,跟我说一声就恢复。$/);
+ ilink.push(OWNER, "PAUSEBG off");
+ await waitFor(() => sentTo("PAUSED-off").length === 1);
+ await waitFor(() => sentTo("RESULT-PAUSEQ").length === 1);
+ await waitFor(() => stage("PAUSEQ") === "ready");
+ await app.outbox.idle();
+ expect(sentTo("RESULT-PAUSEQ")).toHaveLength(1);
+ expect((await api(`/tasks/${t.id}`)).runs.map((r: any) => [r.cause, r.outcome])).toEqual([["launch", "done"]]);
+ }, 180_000);
+
+ it("follow-ups reach the task directly: quoting its pushed result on WeChat resumes the same task without a chat turn", async () => {
+ const t = await research("FOLLOWQ");
+ await waitFor(() => sentTo("RESULT-FOLLOWQ").length === 1);
+ const result = sentTo("RESULT-FOLLOWQ")[0].text;
+ expect(result).toBe("RESULT-FOLLOWQ:调研好了,结论在 notes.md。引用这条消息可以继续问。");
+ await waitFor(() => stage("FOLLOWQ") === "ready");
+ const chats = calls.filter((c) => !c.task).length;
+ ilink.pushItems(OWNER, [{ type: 1, text_item: { text: "加上 H100" }, ref_msg: { title: "", message_item: { type: 1, text_item: { text: result } } } }]);
+ await waitFor(() => sentTo("收到,「调研 FOLLOWQ」继续。").length === 1);
+ await waitFor(() => sentTo("FOLLOWED-FOLLOWQ").length === 1);
+ expect(sentTo("FOLLOWED-FOLLOWQ")[0].text).toBe("FOLLOWED-FOLLOWQ:加上 H100。引用这条消息可以继续问。");
+ await waitFor(() => stage("FOLLOWQ") === "ready");
+ // 聊天代理没有被叫醒;同一个任务、同一个会话接着做
+ expect(calls.filter((c) => !c.task).length).toBe(chats);
+ expect((await api(`/tasks/${t.id}`)).runs.map((r: any) => [r.cause, r.outcome])).toEqual([
+ ["launch", "done"],
+ ["followup", "done"],
+ ]);
+ }, 180_000);
+
it("exit demo (3b): a task asks 「中文还是英文?」 on WeChat; a bare number answers it and the task continues; needs-you lists it on desktop and is empty after", async () => {
expect((await api("/attention")).items).toEqual([]);
const t = await research("ASKQ");