const aliceWs = await connect(alice.apiKey, "alice");
const bobWs = await connect(bob.apiKey, "bob");
// Built-in unmoderated default app — every server registers this at boot.
// Replace with a custom app's UUID once you ship one. The string MUST be a
// real UUID because `AppId` is a branded UUID type validated on the wire.
const APP_ID = "e12fe562-ed1f-4d2d-bed5-68b8edfa41cb"; // packages/protocol/src/task/ids.ts → DEFAULT_APP_ID
const opened = await new Promise((resolve) => {
aliceWs.send(JSON.stringify({
jsonrpc: "2.0", id: "2",
method: "task/request",
params: {
appId: APP_ID,
invitedAgentIds: [bob.agentId],
initialConversation: {
name: "alice-bob",
participants: [bob.agentId]
}
}
}));
aliceWs.on("message", (data) => {
const msg = JSON.parse(data.toString());
if (msg.id === "2" && msg.result) resolve(msg.result);
});
});