























@@ -288,7 +288,10 @@ describe("thread binding lifecycle", () => {
288288webhookToken: "tok-1",
289289introText: "intro",
290290});
291-expect(binding).toEqual(expect.any(Object));
291+expect(binding).toMatchObject({
292+threadId: "thread-1",
293+targetSessionKey: "agent:main:subagent:child",
294+});
292295hoisted.sendMessageDiscord.mockClear();
293296hoisted.sendWebhookMessageDiscord.mockClear();
294297@@ -327,7 +330,10 @@ describe("thread binding lifecycle", () => {
327330webhookId: "wh-1",
328331webhookToken: "tok-1",
329332});
330-expect(binding).toEqual(expect.any(Object));
333+expect(binding).toMatchObject({
334+threadId: "thread-1",
335+targetSessionKey: "agent:main:subagent:child",
336+});
331337hoisted.sendMessageDiscord.mockClear();
332338333339await vi.advanceTimersByTimeAsync(120_000);
@@ -656,7 +662,10 @@ describe("thread binding lifecycle", () => {
656662657663vi.setSystemTime(new Date("2026-02-20T00:00:30.000Z"));
658664const touched = manager.touchThread({ threadId: "thread-1", persist: false });
659-expect(touched).toEqual(expect.any(Object));
665+expect(touched).toMatchObject({
666+threadId: "thread-1",
667+lastActivityAt: new Date("2026-02-20T00:00:30.000Z").getTime(),
668+});
660669661670const record = requireBinding(manager, "thread-1");
662671expect(record.lastActivityAt).toBe(new Date("2026-02-20T00:00:30.000Z").getTime());
@@ -746,7 +755,10 @@ describe("thread binding lifecycle", () => {
746755targetSessionKey: "agent:main:subagent:child-1",
747756agentId: "main",
748757});
749-expect(first).toEqual(expect.any(Object));
758+expect(first).toMatchObject({
759+threadId: "thread-1",
760+targetSessionKey: "agent:main:subagent:child-1",
761+});
750762expect(hoisted.restPost).toHaveBeenCalledTimes(1);
751763752764manager.unbindThread({
@@ -797,7 +809,10 @@ describe("thread binding lifecycle", () => {
797809agentId: "main",
798810});
799811800-expect(childBinding).toEqual(expect.any(Object));
812+expect(childBinding).toMatchObject({
813+threadId: "thread-created-2",
814+targetSessionKey: "agent:main:subagent:child-2",
815+});
801816expect(hoisted.createThreadDiscord).toHaveBeenCalledTimes(1);
802817expect(hoisted.createThreadDiscord).toHaveBeenCalledWith(
803818"parent-1",
@@ -879,7 +894,10 @@ describe("thread binding lifecycle", () => {
879894agentId: "main",
880895});
881896882-expect(childBinding).toEqual(expect.any(Object));
897+expect(childBinding).toMatchObject({
898+threadId: "thread-created-runtime",
899+targetSessionKey: "agent:main:subagent:child-runtime",
900+});
883901const firstClientArgs = hoisted.createDiscordRestClient.mock.calls[0]?.[0] as
884902| { accountId?: string; token?: string }
885903| undefined;
@@ -929,7 +947,10 @@ describe("thread binding lifecycle", () => {
929947agentId: "main",
930948});
931949932-expect(bound).toEqual(expect.any(Object));
950+expect(bound).toMatchObject({
951+threadId: "thread-created-runtime-cfg",
952+targetSessionKey: "agent:main:subagent:runtime-cfg",
953+});
933954const usedRefreshedCfg = hoisted.createDiscordRestClient.mock.calls.some((call) => {
934955if (call?.[1] === refreshedCfg) {
935956return true;
@@ -986,7 +1007,10 @@ describe("thread binding lifecycle", () => {
9861007agentId: "main",
9871008});
9881009989-expect(bound).toEqual(expect.any(Object));
1010+expect(bound).toMatchObject({
1011+threadId: "thread-created-token-refresh",
1012+targetSessionKey: "agent:main:subagent:token-refresh",
1013+});
9901014expect(hoisted.createThreadDiscord).toHaveBeenCalledWith(
9911015"parent-runtime",
9921016expect.objectContaining({ autoArchiveMinutes: 60 }),
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。