


























@@ -34,16 +34,21 @@ async function main() {
3434mcp = mcpHandle.client;
3535}
363637-const listed = (await mcp.callTool({
38-name: "conversations_list",
39-arguments: {},
40-})) as {
41-structuredContent?: { conversations?: Array<Record<string, unknown>> };
42-};
43-const conversation = listed.structuredContent?.conversations?.find(
44-(entry) => entry.sessionKey === "agent:main:main",
37+const conversation = await waitFor(
38+"seeded conversation in conversations_list",
39+async () => {
40+const listed = (await mcp.callTool({
41+name: "conversations_list",
42+arguments: {},
43+})) as {
44+structuredContent?: { conversations?: Array<Record<string, unknown>> };
45+};
46+return listed.structuredContent?.conversations?.find(
47+(entry) => entry.sessionKey === "agent:main:main",
48+);
49+},
50+240_000,
4551);
46-assert(conversation, "expected seeded conversation in conversations_list");
4752assert(conversation.channel === "imessage", "expected seeded channel");
4853assert(conversation.to === "+15551234567", "expected seeded target");
4954@@ -60,19 +65,31 @@ async function main() {
6065"conversation_get returned wrong session",
6166);
626763-const history = (await mcp.callTool({
64-name: "messages_read",
65-arguments: { session_key: "agent:main:main", limit: 10 },
66-})) as {
67-structuredContent?: { messages?: Array<Record<string, unknown>> };
68-};
69-const messages = history.structuredContent?.messages ?? [];
70-assert(messages.length >= 2, "expected seeded transcript messages");
71-const attachmentMessage = messages.find((entry) => {
72-const raw = entry.__openclaw;
73-return raw && typeof raw === "object" && (raw as { id?: unknown }).id === "msg-attachment";
74-});
75-assert(attachmentMessage, "expected seeded attachment message");
68+const messages = await waitFor(
69+"seeded transcript messages",
70+async () => {
71+const history = (await mcp.callTool({
72+name: "messages_read",
73+arguments: { session_key: "agent:main:main", limit: 10 },
74+})) as {
75+structuredContent?: { messages?: Array<Record<string, unknown>> };
76+};
77+const currentMessages = history.structuredContent?.messages ?? [];
78+return currentMessages.length >= 2 ? currentMessages : undefined;
79+},
80+240_000,
81+);
82+await waitFor(
83+"seeded attachment message",
84+() =>
85+messages.find((entry) => {
86+const raw = entry.__openclaw;
87+return (
88+raw && typeof raw === "object" && (raw as { id?: unknown }).id === "msg-attachment"
89+);
90+}),
91+240_000,
92+);
76937794const attachments = (await mcp.callTool({
7895name: "attachments_fetch",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。