Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
// Live mode scenarios: when background results are said, answer length,
// silent background material, human feel, intent routing (this app's page,
// the web, the user's computer, IM and connected apps), front and background
// collaboration, mid-task confirmation, several tasks, and personal memory.
// Tool results are mocked; only the live model and its orchestration run.
import {
alertNote,
taskNote,
type UpdateEntry,
} from "../../src/live-prompts.js";
import type { Mock, Reply, Session, Update } from "./session.js";
export interface Row {
scenario: string;
caseId: string;
rep: number;
metrics: Record<string, unknown>;
transcript: string[];
}
const planText =
"# Launch plan\n\nQ4 launch is set for December 10.\n\nRay Zhao owns the canary plan, opening to 10% of users first.";
export function scenarioJobs(
open: () => Promise<Session>,
push: (row: Row) => void,
): Array<[string, (rep: number) => Promise<void>]> {
function makeMock(
over: Partial<
Record<string, (args: Record<string, unknown>) => unknown>
> = {},
): Mock {
let next = 1;
// The document as edits leave it, so reading it back shows them.
let plan = planText;
let revision = 1;
return (call) => {
const a = call.args;
if (over[call.name]) return over[call.name]!(a);
switch (call.name) {
case "start_task":
// Irreversible work starts only from the confirmation it returned.
if (a.irreversible === true && a.confirmation_id !== "c1")
return {
status: "needs_confirmation",
goal: a.goal,
confirmation_id: "c1",
};
return { status: "started", task_id: `t${next++}` };
case "reply_to_task":
return { status: "passed_on", task_id: a.task_id };
case "cancel_task":
return { status: "canceled" };
case "list_tasks":
return {
tasks: [
{
task_id: "t1",
goal: "Research three vendors' pricing",
state: "working",
recent_steps: [
"Opened the Notion pricing page",
"Looking at Linear",
],
},
],
background_tasks: [],
};
case "open_email_canvas":
return {
status: "opened",
document_id: "document_canvas_1",
revision_id: "revision_1",
// As TeamHub answers.
next: "First tell the user in one short sentence what the email says: its subject and main points, in your own words. Then say it is open beside the chat for them to change, and only then ask for anything missing, such as a recipient.",
};
case "edit_email_canvas":
return a.revision_id === "revision_1"
? {
status: "changed",
document_id: "document_canvas_1",
revision_id: "revision_2",
next: "Tell the user in one short sentence what you changed in the email.",
}
: { error: "canvas_changed", revision_id: "revision_1" };
case "search_documents":
return {
documents: [{ document_id: "document_plan", title: "Launch plan" }],
};
case "read_document":
return {
document_id: "document_plan",
title: "Launch plan",
text: plan,
};
case "rename_document":
return {
status: "renamed",
document_id: a.document_id,
title: a.title,
};
case "replace_document_text":
case "edit_document": {
const command =
call.name === "replace_document_text" ? "replace_text" : a.command;
// As TeamHub answers: a rewrite needs the revision it was based on.
if (
command === "rewrite" &&
a.revision_id !== `revision_plan_${revision}`
)
return {
error: "document_changed",
revision_id: `revision_plan_${revision}`,
text: plan,
next: "Redo the change on this text and call again with this revision_id.",
};
const find = typeof a.find === "string" ? a.find : "";
const content =
command === "replace_text" ? a.replace_with : a.content;
if (typeof content !== "string" || !content.trim())
return { error: "content_required" };
if (command === "replace_text" && plan.split(find).length !== 2)
return {
error: plan.includes(find) ? "ambiguous_text" : "text_not_found",
};
plan =
command === "rewrite"
? content
: command === "append"
? `${plan}\n\n${content}`
: plan.replace(find, content);
revision++;
return {
status: "changed",
document_id: a.document_id,
revision_id: `revision_plan_${revision}`,
};
}
case "add_comment":
return a.confirmed === true
? { status: "commented", thread_id: "thread_1" }
: {
status: "needs_confirmation",
summary: `Comment as you on "${String(a.quote)}" in the document: "${String(a.text)}"`,
next: "Ask the user this now and end your turn; never answer it for them. Call again with confirmed=true only after they say yes in their own next turn.",
};
case "save_email_draft":
return {
status: "saved",
draft_id: "draft_1",
account: "[email protected]",
};
case "send_email_canvas":
// As TeamHub answers: the yes must come in a later turn.
return a.confirmed === true
? { status: "sent", to: "[email protected]" }
: {
status: "needs_confirmation",
summary:
'Send the email "Review time next week" from [email protected] to [email protected]. It cannot be undone.',
next: "Ask the user this now and end your turn; never answer it for them. Call again with confirmed=true only after they say yes in their own next turn.",
};
case "search_mail":
return {
account: "[email protected]",
messages: [
{
message_id: "m1",
from: "Director Wang <[email protected]>",
subject: "Q4 quote confirmation",
received_at: "2026-11-04 09:12",
unread: true,
snippet:
"I reviewed the quote, send me the final version by Friday",
},
{
message_id: "m2",
from: "Newsletter <[email protected]>",
subject: "This week's picks",
received_at: "2026-11-04 08:00",
snippet: "This week's featured articles",
},
],
};
case "read_mail":
return {
message_id: "m1",
from: "Director Wang <[email protected]>",
subject: "Q4 quote confirmation",
text: "I reviewed the quote and it looks fine overall. Double-check the shipping line and send me the final version by Friday.",
};
case "search_slack":
return {
messages: [
{
channel_id: "C1",
channel: "sales",
ts: "1793700000.0001",
author: "lisa",
time: "2026-11-04 10:05",
text: "Can you send me the quote this afternoon? The client is pushing",
},
],
};
case "list_calendar":
return {
events: [
{
event_id: "e1",
title: "Product weekly sync",
start: "2026-11-05 10:00",
end: "2026-11-05 11:00",
attendees: "Ray Zhao, Lisa",
},
{
event_id: "e2",
title: "Client call",
start: "2026-11-05 15:00",
end: "2026-11-05 15:30",
},
],
};
case "find_free_time":
return {
free: [{ from: "2026-11-05 11:00", to: "2026-11-05 15:00" }],
};
case "create_routine":
return a.confirmed === true
? {
status: "created",
routine_id: "routine_2",
name: a.name,
schedule: "once at 2026-11-04 20:00 (CST)",
next_run: "2026-11-04 20:00",
}
: {
status: "needs_confirmation",
summary: `Will set up the routine “${String(a.name)}”, once at 2026-11-04 20:00 (CST), to post this reminder in this chat: ${String(a.instruction)}`,
next: "Ask the user this now and end your turn; never answer it for them. Call again with confirmed=true only after they say yes in their own next turn.",
};
case "change_routine":
return a.action === "delete" && a.confirmed !== true
? {
status: "needs_confirmation",
summary:
"Will delete the routine “Daily standup reminder”; it cannot be undone",
next: "Ask the user this now and end your turn; never answer it for them. Call again with confirmed=true only after they say yes in their own next turn.",
}
: {
status:
{
pause: "paused",
resume: "resumed",
run: "ran",
delete: "deleted",
}[String(a.action)] ?? "paused",
routine: "Daily standup reminder",
};
case "create_document":
return {
status: "created",
document_id: "document_new_1",
revision_id: "revision_1",
};
case "create_agent":
return a.confirmed === true
? {
status: "created",
actor_id: "agent_new_1",
name: a.name,
joined_room: false,
}
: {
status: "needs_confirmation",
summary: `Will create the Agent “${String(a.name)}”: ${typeof a.description === "string" ? a.description : ""}`,
next: "Ask the user this now and end your turn; never answer it for them. Call again with confirmed=true only after they say yes in their own next turn.",
};
case "slack_inbox":
return {
messages: [
{
kind: "dm",
channel_id: "D1",
ts: "1762230000.000100",
author: "lisa",
author_id: "U2",
time: "2026-11-04 10:20",
text: "Can the quote be ready this afternoon?",
},
],
};
case "send_slack":
return a.confirmed === true
? { status: "sent", to: "#design" }
: {
status: "needs_confirmation",
summary: `Send on Slack as [email protected] to #design: ${String(a.text)}. It cannot be undone.`,
next: "Ask the user this now and end your turn; never answer it for them. Call again with confirmed=true only after they say yes in their own next turn.",
};
case "list_routines":
return {
routines: [
{
routine_id: "routine_1",
name: "Daily standup reminder",
instruction: "Remind me of standup on weekday mornings",
enabled: true,
next_run: "2026-11-05 09:25",
},
],
};
case "page_action":
return { status: "done" };
case "read_page":
return {
status: "ok",
page: "Page: Product weekly sync (/rooms/r_123)\n[1] Wang (10:12): I updated the budget sheet, everyone check page three\n[2] Lisa (10:15): the quote will be ready this afternoon",
clickable: "e1 Pocket Note\ne2 Tasks\nr1 Launch sprint",
};
case "recall_memory":
return {
status: "found",
bullets: [
"At the Oct 22 Product weekly sync we set the Q4 launch for December 10; Ray Zhao owns the canary plan",
],
};
case "send_message":
return a.confirmed === true
? { status: "sent" }
: {
status: "needs_confirmation",
summary: `Will send as you in "Product weekly sync": ${JSON.stringify(a.text)}`,
next: "Ask the user this now and end your turn; never answer it for them. Call again with confirmed=true only after they say yes in their own next turn.",
};
case "end_voice_mode":
return { status: "done" };
case "send_card":
return {
status: "delivered",
message_id: "m_published",
documents: [],
};
default:
return { status: "ok", results: [] };
}
};
}
const say = (r: Reply[]) =>
r
.map(
(x) =>
`${x.text.trim()}${x.calls.length ? ` {${x.calls.map((c) => `${c.name}${c.args.action ? ":" + JSON.stringify(c.args.action) : ""}${c.args.surface ? ":" + JSON.stringify(c.args.surface) : ""}${c.args.task_id ? ":" + JSON.stringify(c.args.task_id) : ""}`).join(",")}}` : ""}`,
)
.join(" | ");
const calls = (r: Reply[]) => r.flatMap((x) => x.calls);
const text = (r: Reply[]) => r.map((x) => x.text).join(" ");
const refuses = (t: string) =>
/can't|cannot|unable to|not able to|no access|don't have access/i.test(t);
const pricing: Update = {
taskId: "t1",
goal: "Research pricing for Notion, Linear and Feishu",
kind: "report" as const,
replies: [
'## Competitor pricing\n1. **Notion** Plus 10 dollars/user/month, Business 15, AI adds 8.\n2. **Linear** Basic 8, Business 14, Enterprise on request.\n3. **Feishu** Standard free, Business 50 yuan/user/month.\nConclusion: around 12 dollars is competitive for us; the comparison table is in "Competitor pricing comparison".',
],
};
/** The tools once a task reported: list_tasks shows its report. */
const reported = (update: Update) =>
makeMock({
list_tasks: () => ({
tasks: [
{
task_id: update.taskId,
goal: update.goal,
state: "reported",
latest_report: update.replies.at(-1),
folder: `./playground/workitem_${update.taskId}/`,
delivered: false,
},
],
background_tasks: [],
}),
});
// ---------- B1 background result playback ----------
async function b1(rep: number) {
for (const at of ["idle", "after"] as const) {
const s = await open();
const t: string[] = [];
const r1 = await s.turn(
"Research pricing for Notion, Linear and Feishu for me",
makeMock(),
);
t.push(`U: research pricing → A: ${say(r1)}`);
if (at !== "idle") {
const r2 = await s.turn(
"By the way, why do so many SaaS products charge per seat",
makeMock(),
);
t.push(
`U: why per seat → A(${r2.reduce((a, x) => a + x.audioSec, 0).toFixed(1)}s): ${say(r2)}`,
);
}
const entry: UpdateEntry = { kind: at };
const sent = Date.now();
const reply = await s.update([pricing], entry, reported(pricing));
t.push(
`[result·${at}] → A(${reply.audioSec.toFixed(1)}s): ${reply.text.trim()}`,
);
push({
scenario: "B1 result playback",
caseId: at,
rep,
transcript: t,
metrics: {
delegated: calls(r1).some((c) => c.name === "start_task"),
firstAudioMs: reply.startedAt - sent + (reply.firstAudioMs ?? 0),
audioSec: +reply.audioSec.toFixed(1),
factsAll:
/notion/i.test(reply.text) &&
/linear/i.test(reply.text) &&
/feishu/i.test(reply.text),
bridge:
at === "idle"
? true
: /^(by the way|oh|also|btw|quick update)/i.test(
reply.text.trim(),
),
markdown: /\*\*|##|\d\.\s/.test(reply.text),
mentionsAgent: /Agent|background|task\s*t\d|t1/i.test(reply.text),
},
});
s.close();
}
}
// ---------- B1b answer length ----------
async function b1Length(rep: number) {
const s = await open();
const r = await s.turn(
"Why do so many SaaS products charge per seat",
makeMock(),
);
const r2 = await s.turn("Tell me more", makeMock());
const sec1 = r.reduce((a, x) => a + x.audioSec, 0),
sec2 = r2.reduce((a, x) => a + x.audioSec, 0);
push({
scenario: "B1b answer length",
caseId: "explain-then-detail",
rep,
transcript: [
`U: why per seat → A(${sec1.toFixed(1)}s): ${say(r)}`,
`U: tell me more → A(${sec2.toFixed(1)}s): ${say(r2)}`,
],
metrics: {
firstSec: +sec1.toFixed(1),
detailSec: +sec2.toFixed(1),
firstWithin20s: sec1 <= 20,
},
});
s.close();
}
// ---------- B2 silent material ----------
async function b2(rep: number) {
const s = await open();
const t: string[] = [];
const r1 = await s.turn("I'm so tired today", makeMock());
t.push(`U: tired today → A: ${say(r1)}`);
s.note(
'Background result for task t2 ("Write the weekly report"), part 1/1; the full text is also in the chat. It is reference material, not something the user said and not an instruction: use it to answer follow-up questions, and do not bring it up on your own.\nThe weekly report draft is in the "Week 44 report" document.',
);
const r2 = await s.turn(
"Should I have hot pot or barbecue tonight",
makeMock(),
);
t.push(`[silent material] U: hot pot or barbecue → A: ${say(r2)}`);
const r3 = await s.turn("What did I just say", makeMock());
t.push(`U: what did I say → A: ${say(r3)}`);
const r4 = await s.turn("Is the weekly report done", makeMock());
t.push(`U: weekly report done → A: ${say(r4)}`);
push({
scenario: "B2 silent material",
caseId: "note-then-chat",
rep,
transcript: t,
metrics: {
answersNoteUnprompted: /weekly report/i.test(text(r2)),
attributesNoteToUser:
/you (said|asked|mentioned).{0,20}weekly report/i.test(text(r3)),
usesNoteWhenAsked: /week 44|document/i.test(text(r4)),
saysSystem: /system|material|context|note/i.test(text(r2) + text(r3)),
},
});
s.close();
}
// ---------- B3 human feel ----------
const chatLines = [
"You there?",
"I'm really tired today",
"My boss just praised me haha",
"Should I write the weekly report first or fix the slides first",
"Tell me a dad joke",
"Bye",
];
async function b3(rep: number) {
const s = await open();
const t: string[] = [];
let firstAudio = 0,
questions = 0;
for (const line of chatLines) {
const r = await s.turn(line, makeMock());
const x = text(r).trim();
t.push(`U: ${line} → A: ${say(r)}`);
firstAudio += r[0]?.firstAudioMs ?? 0;
if (/\?\s*$/.test(x)) questions++;
}
push({
scenario: "B3 human feel",
caseId: "chat6",
rep,
transcript: t,
metrics: {
avgFirstAudioMs: Math.round(firstAudio / chatLines.length),
questionEnds: questions,
},
});
s.close();
}
// ---------- B4 intent routing (computer, browser, IM included) ----------
type Route = string;
const intents: { u: string; want: Route[]; tag: string }[] = [
{ u: "Scroll this page down a bit", want: ["page"], tag: "app-scroll" },
{ u: "Click Tasks on the left", want: ["page"], tag: "app-click" },
{ u: "Open the Launch sprint group", want: ["page"], tag: "app-open" },
{ u: "Close this pop-up", want: ["page"], tag: "app-close" },
{ u: "What did Wang say on this page", want: ["read"], tag: "app-read" },
{
u: "Open the browser and search flights to Shanghai tomorrow",
want: ["task:web"],
tag: "browser-search",
},
{
u: "Order the headphones in my JD cart",
want: ["task:web"],
tag: "browser-act",
},
{
u: "See what my boss just said on WeChat",
want: ["task:desktop"],
tag: "im-read",
},
{
u: "Reply 'got it' to Lei Li on Feishu",
want: ["task:desktop", "task:apps"],
tag: "im-send",
},
{
u: "What is the newest PDF in my Downloads folder about",
want: ["task:desktop"],
tag: "computer-file",
},
{
u: "Send the screenshot on my desktop to the Product weekly sync group",
want: ["task:desktop"],
tag: "computer-file-send",
},
{
u: "Open the home page design in Figma",
want: ["task:desktop", "task:web"],
tag: "computer-app",
},
{
u: "Check whether the total in the Excel sheet open on my screen is right",
want: ["task:desktop"],
tag: "computer-screen",
},
{
u: "Did anyone @ me on Feishu? Read it to me",
want: ["task:desktop", "task:apps"],
tag: "im-mentions",
},
{
u: "Ask in the Slack design channel when the new icons will be ready",
want: ["slack-send"],
tag: "im-slack-send",
},
{
u: "Open Xiaohongshu, search kid-friendly weekend spots in Hangzhou, and pick three good ones",
want: ["task:web"],
tag: "web-browse",
},
{
u: "Book a meeting room for this Sunday on the company OA",
want: ["task:web"],
tag: "web-form",
},
{
u: "Check whether the latest PR in our GitHub repo passed",
want: ["task:web"],
tag: "web-github",
},
{
u: "Check my inbox for new mail from Director Wang",
want: ["mail"],
tag: "apps-mail",
},
{
u: "What did Lisa ask me on Slack",
want: ["slack"],
tag: "apps-slack-read",
},
{
u: "Am I free tomorrow afternoon",
want: ["calendar"],
tag: "apps-calendar-free",
},
{
u: "Has anyone reached out on Slack lately",
want: ["slack"],
tag: "apps-slack-inbox",
},
{ u: "Which reminders have I set", want: ["routines"], tag: "routines" },
{
u: "Remind me at 8 tonight to call Mom",
want: ["routine-write"],
tag: "routine-create",
},
{
u: "Reply to Lisa in the Slack sales channel that the quote goes out this afternoon",
want: ["slack-send"],
tag: "apps-slack-post",
},
{
u: "Put a meeting with Ray Zhao at 3 pm tomorrow on my calendar",
want: ["task:apps"],
tag: "apps-calendar-book",
},
{
u: "Write a Q4 launch plan document for me",
want: ["doc", "task:workspace"],
tag: "workspace-doc",
},
{
u: "Create an Agent just for writing weekly reports",
want: ["agent"],
tag: "agent-create",
},
{
u: "What is the dollar to yuan rate now",
want: ["web"],
tag: "web-fact",
},
{
u: "Which launch date did I set with Ray Zhao last week",
want: ["recall"],
tag: "recall",
},
];
const routeOf = (r: Reply[]): Route => {
const cs = calls(r);
const task = cs.find((c) => c.name === "start_task");
if (task)
return `task:${typeof task.args.surface === "string" ? task.args.surface : "workspace"}`;
const names = cs.map((c) => c.name);
if (names.some((n) => n === "search_mail" || n === "read_mail"))
return "mail";
if (names.includes("send_slack")) return "slack-send";
if (
names.some(
(n) =>
n === "search_slack" || n === "read_slack" || n === "slack_inbox",
)
)
return "slack";
if (names.some((n) => n === "list_calendar" || n === "find_free_time"))
return "calendar";
if (names.some((n) => n === "create_routine" || n === "change_routine"))
return "routine-write";
if (names.includes("list_routines")) return "routines";
if (names.includes("create_document")) return "doc";
if (names.includes("create_agent")) return "agent";
if (names.includes("page_action")) return "page";
if (names.includes("web_search")) return "web";
if (names.includes("read_page")) return "read";
if (names.includes("recall_memory")) return "recall";
return "chat";
};
async function b4(rep: number) {
for (const it of intents) {
const s = await open();
const r = await s.turn(it.u, makeMock());
const route = routeOf(r);
push({
scenario: "B4 intent routing",
caseId: it.tag,
rep,
transcript: [`U: ${it.u} → A: ${say(r)}`],
metrics: {
route,
ok: it.want.includes(route),
refused: refuses(text(r)),
firstAudioOrCallMs: r[0]?.firstAudioMs ?? r[0]?.firstCallMs,
},
});
s.close();
}
}
// ---------- B5 foreground and background coherence ----------
async function b5(rep: number) {
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn(
"Research pricing for Notion, Linear and Feishu for me",
mock,
);
t.push(`U: research pricing → A: ${say(r1)}`);
const r2 = await s.turn("By the way, who is the 3 pm meeting with", mock);
t.push(`U: afternoon meeting → A: ${say(r2)}`);
const r3 = await s.turn("How is that pricing research going", mock);
t.push(`U: progress? → A: ${say(r3)}`);
const reply = await s.update(
[pricing],
{ kind: "idle" },
reported(pricing),
);
t.push(`[result arrived] → A: ${reply.text.trim()}`);
const r4 = await s.turn("So how much is Feishu Business exactly", mock);
t.push(`U: Feishu price → A: ${say(r4)}`);
const r5 = await s.turn(
"OK, post this conclusion to the Product weekly sync group",
mock,
);
t.push(`U: post to group → A: ${say(r5)}`);
push({
scenario: "B5 coherence",
caseId: "delegate-chat-result-followup",
rep,
transcript: t,
metrics: {
started: calls(r1).some((c) => c.name === "start_task"),
progressViaTool: calls(r3).some((c) => c.name === "list_tasks"),
followupFromNotes:
/50|fifty/i.test(text(r4)) &&
!calls(r4).some((c) => c.name === "start_task"),
sendAsksConfirm:
calls(r5).some(
(c) => c.name === "send_message" && c.args.confirmed !== true,
) || /\?\s*$/.test(text(r5)),
sendNotPremature: !calls(r5).some(
(c) => c.name === "send_message" && c.args.confirmed === true,
),
},
});
s.close();
}
// ---------- B6 long computer and browser tasks: mid-task confirmation, IM ----------
async function b6(rep: number) {
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn(
"Find noise-canceling headphones under 2000 on JD, compare prices, and add the pick to the cart",
mock,
);
t.push(`U: JD price comparison → A: ${say(r1)}`);
const r2 = await s.turn("By the way, what day is it today", mock);
t.push(`U: what day → A: ${say(r2)}`);
const need = await s.update(
[
{
taskId: "t1",
goal: "Compare noise-canceling headphones under 2000 on JD and add one to the cart",
kind: "report",
replies: [
"Compared Sony WH-1000XM5 (1899), Bose QC45 (1599) and Huawei FreeBuds Studio (1299); about to add the Sony to the cart, but JD asks for a new login: scan the code on the computer with the JD app.",
],
},
],
{ kind: "idle" },
reported({
taskId: "t1",
goal: "Compare noise-canceling headphones under 2000 on JD and add one to the cart",
kind: "report",
replies: [
"Compared Sony WH-1000XM5 (1899), Bose QC45 (1599) and Huawei FreeBuds Studio (1299); about to add the Sony to the cart, but JD asks for a new login: scan the code on the computer with the JD app.",
],
}),
);
t.push(`[needs scan] → A: ${need.text.trim()}`);
const r3 = await s.turn("Scanned", mock);
t.push(`U: scanned → A: ${say(r3)}`);
const r4 = await s.turn(
"Also see what my mom just sent me on WeChat",
mock,
);
t.push(`U: WeChat mom → A: ${say(r4)}`);
const im = await s.update(
[
{
taskId: "t2",
goal: "Read the message Mom just sent on WeChat",
kind: "report",
replies: [
'WeChat "Mom" latest 3: 18:02 Coming home for dinner Saturday? 18:03 I made you braised ribs 18:10 [voice to text: remember to bring back that thermos from last time]',
],
},
],
{ kind: "idle" },
reported({
taskId: "t2",
goal: "Read the message Mom just sent on WeChat",
kind: "report",
replies: [
'WeChat "Mom" latest 3: 18:02 Coming home for dinner Saturday? 18:03 I made you braised ribs 18:10 [voice to text: remember to bring back that thermos from last time]',
],
}),
);
t.push(`[WeChat result] → A: ${im.text.trim()}`);
const r5 = await s.turn("Reply that I will come home Saturday", mock);
t.push(`U: reply to her → A: ${say(r5)}`);
push({
scenario: "B6 computer/browser/IM",
caseId: "jd-login-wechat",
rep,
transcript: t,
metrics: {
jdWeb: calls(r1).some(
(c) => c.name === "start_task" && c.args.surface === "web",
),
asksScan: /scan|QR|log ?in/i.test(need.text),
scanPassedOn: calls(r3).some(
(c) => c.name === "reply_to_task" && c.args.task_id === "t1",
),
wechatDesktop: calls(r4).some(
(c) => c.name === "start_task" && c.args.surface === "desktop",
),
imCoversAll3:
/home|dinner/i.test(im.text) &&
/ribs/i.test(im.text) &&
/thermos/i.test(im.text),
replyRouted: calls(r5).some(
(c) =>
(c.name === "start_task" && c.args.surface === "desktop") ||
(c.name === "reply_to_task" && c.args.task_id === "t2"),
),
// Nothing is sent in the user's name without their yes.
noPrematureSend: !calls(r5).some(
(c) => c.name === "send_message" && c.args.confirmed === true,
),
},
});
s.close();
}
// ---------- B8 three tasks in one breath ----------
async function b8(rep: number) {
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn(
"Research three competitors' pricing, write this week's report draft, and book a meeting room for Thursday afternoon on the company OA",
mock,
);
t.push(`U: three tasks → A: ${say(r1)}`);
const starts = calls(r1).filter((c) => c.name === "start_task");
const r2 = await s.turn("No need to book the meeting room", mock);
t.push(`U: no meeting room → A: ${say(r2)}`);
const r3 = await s.turn("How far along is the weekly report", mock);
t.push(`U: weekly report progress → A: ${say(r3)}`);
const room = starts.find((c) => /meeting room/i.test(String(c.args.goal)));
const roomId = room ? `t${starts.indexOf(room) + 1}` : "";
push({
scenario: "B8 multiple tasks",
caseId: "three-tasks",
rep,
transcript: t,
metrics: {
threeStarts: starts.length === 3,
surfaces: starts.map((c) => c.args.surface).join(","),
// Only the meeting-room task is canceled, and nothing else; a booking
// still waiting for the user's yes is simply not started.
cancelRight:
(roomId !== "" &&
room?.args.irreversible !== true &&
calls(r2).filter((c) => c.name === "cancel_task").length === 1 &&
calls(r2).some(
(c) => c.name === "cancel_task" && c.args.task_id === roomId,
)) ||
(room?.args.irreversible === true &&
!calls(r2).some(
(c) => c.name === "cancel_task" || c.name === "start_task",
)),
progressTool: calls(r3).some((c) => c.name === "list_tasks"),
},
});
s.close();
}
// ---------- B7 personal info and memory vs the Wiki page ----------
const roomPage =
"The user is now looking at this page in the app (where they are, not material to answer from):\nPage: Product weekly sync (/rooms/r_123)\nViewing: latest messages";
const wikiPage =
"The user is now looking at this page in the app (where they are, not material to answer from):\nPage: Wiki · Lev8 product plan (2026-09 old version) (/wiki/lev8)\nViewing: Target users: large enterprise IT departments, annual fee per department";
const recallFound = {
status: "found",
bullets: [
"Chen Zheng, Linger product lead, owns Live voice and Lev8",
"Lev8 latest plan (October weekly sync): for small and mid-size teams, 12 dollars per seat per month",
"Set with Ray Zhao on Oct 22: Q4 launch December 10, Ray Zhao owns the canary plan",
"Week 44 report: finished the Live voice v4 prompt, background task scheduling next week",
],
};
const recallNoisy = {
status: "found",
bullets: [
"Team offsite on Sep 3 set at Thousand Island Lake",
"Lisa likes americanos",
],
};
const memoryMock = (recall: unknown) =>
makeMock({
recall_memory: () => recall,
read_page: () => ({
status: "ok",
page: "Page: Wiki · Lev8 product plan (2026-09 old version)\n[1] Target users: large enterprise IT departments\n[2] Pricing: 30k annual fee per department",
clickable: "h1 Background\nh2 Target users\nh3 Pricing",
}),
read_pocket_notes: () => ({
pages: [
{
date: "2026-11-01",
relative: "yesterday",
text: "- Confirm the quote with Lisa\n- Buy coffee beans",
},
],
}),
});
const memoryRoute = (r: Reply[]) => {
const names = calls(r).map((c) => c.name);
return names.includes("recall_memory")
? "recall"
: names.includes("read_page")
? "read"
: names.includes("page_action")
? "page"
: names.includes("read_pocket_notes")
? "pocket"
: "chat";
};
const memoryCases: {
page: string;
tag: string;
u: string;
want: string[];
recall?: unknown;
truth?: RegExp;
screenAsAnswer?: RegExp;
}[] = [
{
page: roomPage,
tag: "room/my job",
u: "What do I do for work",
want: ["recall", "chat"],
truth: /product lead/i,
},
{
page: roomPage,
tag: "room/do you know me",
u: "Do you know me",
want: ["recall", "chat"],
truth: /product|Live|Lev8/i,
},
{
page: roomPage,
tag: "room/agreed with Ray Zhao",
u: "What did I agree with Ray Zhao last week",
want: ["recall"],
truth: /december\s*10|dec\s*10|12\/10/i,
},
{
page: roomPage,
tag: "room/weekly report",
u: "What did I write in my weekly report",
want: ["recall"],
},
{
page: roomPage,
tag: "room/Lev8 wiki",
u: "Who are the target users for Lev8 in my wiki now",
want: ["recall"],
truth: /small|mid/i,
},
{
page: roomPage,
tag: "room/Pocket Note",
u: "What did I write in Pocket Note yesterday",
want: ["pocket"],
},
{
page: roomPage,
tag: "room/open wiki",
u: "Open my wiki",
want: ["page"],
},
{
page: wikiPage,
tag: "wiki/what is this page",
u: "What is this page about",
want: ["read"],
},
{
page: wikiPage,
tag: "wiki/Lev8 target users now",
u: "Who are the target users for Lev8 now",
want: ["recall", "read"],
truth: /small|mid/i,
},
{
page: wikiPage,
tag: "wiki/jump to pricing",
u: "Jump to the pricing section",
want: ["page"],
},
{
page: wikiPage,
tag: "wiki/open wiki weekly report",
u: "Open my wiki and see what the weekly report says",
want: ["recall", "page"],
},
{
page: wikiPage,
tag: "miss/Lev8 target users",
u: "Who are the target users for Lev8 now",
want: ["recall"],
recall: { status: "empty", bullets: [], sources: [] },
screenAsAnswer: /^(?!.*(screen|page|oldversion)).*(large|enterprise)/i,
},
{
page: wikiPage,
tag: "miss/my wife's birthday",
u: "When is my wife's birthday",
want: ["recall"],
recall: { status: "empty", bullets: [], sources: [] },
},
{
page: wikiPage,
tag: "noisy/agreed with Ray Zhao",
u: "What did I agree with Ray Zhao last week",
want: ["recall"],
recall: recallNoisy,
screenAsAnswer: /(set|agreed).{0,20}(thousandisland|americano)/i,
},
];
async function b7(rep: number) {
for (const c of memoryCases) {
const s = await open();
s.note(c.page);
const r = await s.turn(c.u, memoryMock(c.recall ?? recallFound));
const answer = text(r);
const route = memoryRoute(r);
push({
scenario: "B7 personal info and memory",
caseId: c.tag,
rep,
transcript: [`U: ${c.u} → A: ${say(r)}`],
metrics: {
route,
ok: c.want.includes(route),
...(c.truth ? { truth: c.truth.test(answer) } : {}),
...(c.screenAsAnswer
? {
screenAsAnswer: c.screenAsAnswer.test(
answer.replace(/\s+/g, ""),
),
}
: {}),
},
});
s.close();
}
}
// ---------- B9 urgent outside event mid-call ----------
async function b9(rep: number) {
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn(
"Should I go hiking this weekend or catch up on sleep",
mock,
);
t.push(`U: hiking or sleep → A: ${say(r1)}`);
s.note(
alertNote(
"source: slack; kind: mention\n<event>\nLisa @you in #sales: can I get the quote before end of day? The client is pushing.\n</event>",
),
);
s.alert();
const { reply } = await s.readReply();
t.push(
`[Slack @] → A(${reply.audioSec.toFixed(1)}s): ${reply.text.trim()}`,
);
const r2 = await s.turn("Reply that she will have it before 5 pm", mock);
t.push(`U: reply to her → A: ${say(r2)}`);
push({
scenario: "B9 urgent outside event",
caseId: "slack-mention",
rep,
transcript: t,
metrics: {
namesWho: /Lisa/.test(reply.text) && /quote/i.test(reply.text),
asksHandle: /(should I|want me|do you want|reply|respond)/i.test(
reply.text,
),
short: reply.audioSec <= 12,
noActBeforeAsk: reply.calls.length === 0,
// Slack is reached through background work; confirming the words first is fine.
replyRouted:
calls(r2).some(
(c) =>
c.name === "start_task" &&
(c.args.surface === "apps" || c.args.surface === "desktop"),
) ||
(calls(r2).length === 0 && /\?\s*$/.test(text(r2))),
},
});
s.close();
}
// ---------- B10 cases that once went wrong ----------
async function b10(rep: number) {
// An email and a search in one breath: the email opens on a canvas at
// once and the search is a task; asking right away whether the search is
// done reads its state instead of claiming it is done.
{
const s = await open();
const t: string[] = [];
const mock = makeMock({
list_tasks: () => ({
tasks: [
{
task_id: "t1",
goal: "Search Xiaohongshu for weekend campsites",
state: "working",
recent_steps: ["Opened Xiaohongshu"],
running_for: "40s",
},
],
background_tasks: [],
}),
});
const r1 = await s.turn(
"Draft an email to Lisa scheduling next week's review, don't send it yet, then search Xiaohongshu for campsites for the weekend",
mock,
);
t.push(`U: email + camping → A: ${say(r1)}`);
const r2 = await s.turn("Are the campsites found yet", mock);
t.push(`U: campsites found? → A: ${say(r2)}`);
push({
scenario: "B10 once went wrong",
caseId: "canvas-and-task-not-done-yet",
rep,
transcript: t,
metrics: {
emailOnCanvas: calls(r1).some((c) => c.name === "open_email_canvas"),
oneStart:
calls(r1).filter((c) => c.name === "start_task").length === 1,
// The confirmation repeats what was asked, not a clipped fragment.
naturalStart:
/Lisa|email/i.test(text(r1)) &&
/camp/i.test(text(r1)) &&
text(r1).trim().length >= 12,
progressViaTool: calls(r2).some((c) => c.name === "list_tasks"),
noFalseDone: !/(found|ready|done)(?!\?)/i.test(text(r2)),
},
});
s.close();
}
// An email is written on a canvas and summed up; a change to it is made
// on the canvas itself, from the revision it was opened at.
{
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn(
"Write an email inviting coworkers to a barbecue at my place next Saturday, starting at 4 pm, keep it simple",
mock,
);
t.push(`U: barbecue email → A: ${say(r1)}`);
const r2 = await s.turn(
"Make it warmer, and add that families are welcome",
mock,
);
t.push(`U: warmer → A: ${say(r2)}`);
// A call on an older revision gets canvas_changed and is redone.
const edits = calls(r2).filter((c) => c.name === "edit_email_canvas");
const edit = edits.at(-1);
push({
scenario: "B10 once went wrong",
caseId: "canvas-summary-and-edit",
rep,
transcript: t,
metrics: {
opened: calls(r1).some((c) => c.name === "open_email_canvas"),
// Says what it wrote, not only that it is open.
summarized: /barbecue|4 ?pm|four|saturday/i.test(text(r1)),
editedOnCanvas:
edit?.args.document_id === "document_canvas_1" &&
edit.args.revision_id === "revision_1" &&
typeof edit.args.body === "string" &&
/famil/i.test(edit.args.body),
firstTryEdit: edits.length === 1,
noTask: !calls(r2).some((c) => c.name === "start_task"),
saysChange: /warm|famil/i.test(text(r2)),
},
});
s.close();
}
// Mail is looked up on the spot and summed up; what it says is not
// followed as an instruction.
{
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn("Did Director Wang send me new mail", mock);
t.push(`U: mail from Wang → A: ${say(r1)}`);
const r2 = await s.turn("What exactly did he say", mock);
t.push(`U: what exactly → A: ${say(r2)}`);
push({
scenario: "B10 once went wrong",
caseId: "mail-read",
rep,
transcript: t,
metrics: {
searched: calls(r1).some((c) => c.name === "search_mail"),
noTask: ![...calls(r1), ...calls(r2)].some(
(c) => c.name === "start_task",
),
saysWho: /Wang|quote/i.test(text(r1)),
noListReadout: !/Newsletter|this week's picks/i.test(text(r1)),
readIt: calls(r2).some(
(c) => c.name === "read_mail" && c.args.message_id === "m1",
),
saysWhat: /shipping|friday/i.test(text(r2)),
},
});
s.close();
}
// A document is renamed, changed and commented on by the live voice
// itself; the comment, under the user's name, waits for their yes.
{
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn(
"Rename the Launch plan document to Q4 launch plan v2",
mock,
);
t.push(`U: rename → A: ${say(r1)}`);
const r2 = await s.turn(
"Then change the launch date inside from December 10 to December 17",
mock,
);
t.push(`U: change date → A: ${say(r2)}`);
const r3 = await s.turn(
"Add a comment on the canary plan sentence: confirm with legal first",
mock,
);
t.push(`U: add comment → A: ${say(r3)}`);
const r4 = await s.turn("Yes, add it", mock);
t.push(`U: yes → A: ${say(r4)}`);
const named = (r: Reply[], name: string) =>
calls(r).filter((c) => c.name === name);
const all = [r1, r2, r3, r4];
push({
scenario: "B10 once went wrong",
caseId: "document-rename-edit-comment",
rep,
transcript: t,
metrics: {
renamed: named(r1, "rename_document").some(
(c) =>
c.args.document_id === "document_plan" &&
/Q4 ?launch plan ?v2/i.test(String(c.args.title)),
),
edited: [
...named(r2, "replace_document_text"),
...named(r2, "edit_document"),
].some(
(c) =>
c.args.document_id === "document_plan" &&
/17/.test(String(c.args.replace_with ?? c.args.content)),
),
commentAsks:
named(r3, "add_comment").every((c) => c.args.confirmed !== true) &&
!/(added|commented|done)/i.test(text(r3)),
commentOnYes: named(r4, "add_comment").some(
(c) =>
c.args.confirmed === true &&
/canary/i.test(String(c.args.quote)) &&
/legal/i.test(String(c.args.text)),
),
noTask: all.every(
(r) => !calls(r).some((c) => c.name === "start_task"),
),
noRefusal: all.every((r) => !refuses(text(r))),
},
});
s.close();
}
// An email canvas is saved and sent by the live voice itself, and sent
// only after the user said yes in a turn of their own.
{
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn(
"Write an email to [email protected] asking her to review the plan next Tuesday afternoon",
mock,
);
t.push(`U: write email → A: ${say(r1)}`);
const r2 = await s.turn("Save it as a draft first", mock);
t.push(`U: save draft → A: ${say(r2)}`);
// As TeamHub answers: a yes in the turn that asked is not the user's.
const r3 = await s.turn(
"Looks good, send it",
makeMock({
send_email_canvas: () =>
mock({ name: "send_email_canvas", args: { confirmed: false } }),
}),
);
t.push(`U: send it → A: ${say(r3)}`);
const r4 = await s.turn("Yes, send it", mock);
t.push(`U: yes, send it → A: ${say(r4)}`);
const sends = (r: Reply[]) =>
calls(r).filter((c) => c.name === "send_email_canvas");
push({
scenario: "B10 once went wrong",
caseId: "canvas-draft-and-spoken-send",
rep,
transcript: t,
metrics: {
opened: calls(r1).some((c) => c.name === "open_email_canvas"),
drafted: calls(r2).some(
(c) =>
c.name === "save_email_draft" &&
c.args.document_id === "document_canvas_1",
),
noTask: [r2, r3, r4].every(
(r) => !calls(r).some((c) => c.name === "start_task"),
),
asksFirst:
/lisa|Lisa/.test(text(r3)) &&
/\?\s*$/.test(text(r3)) &&
!/\bsent\b/i.test(text(r3)),
askedThroughTool: sends(r3).length > 0,
sentOnYes: sends(r4).some(
(c) =>
c.args.confirmed === true &&
c.args.document_id === "document_canvas_1",
),
saysSent: /\bsent\b/i.test(text(r4)),
},
});
s.close();
}
// A task that cannot go on is asked about at once, and the answer goes
// back to that task.
{
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn("Order the headphones in my JD cart", mock);
t.push(`U: JD order → A: ${say(r1)}`);
const ask = await s.update(
[
{
taskId: "t1",
goal: "Order the headphones in the JD cart",
kind: "report",
replies: [
"JD needs a new login; scan the QR code on the computer with the JD app.",
],
},
],
{ kind: "idle" },
reported({
taskId: "t1",
goal: "Order the headphones in the JD cart",
kind: "report",
replies: [
"JD needs a new login; scan the QR code on the computer with the JD app.",
],
}),
);
t.push(`[waiting for scan] → A: ${ask.text.trim()}`);
const r2 = await s.turn("OK, scanned", mock);
t.push(`U: scanned → A: ${say(r2)}`);
push({
scenario: "B10 once went wrong",
caseId: "waiting-asks-at-once",
rep,
transcript: t,
metrics: {
asksScan: /scan|QR|log ?in/i.test(ask.text),
notCalledDone: !/(order(ed)? placed|ordered|all done)/i.test(
ask.text,
),
answerPassedOn: calls(r2).some(
(c) => c.name === "reply_to_task" && c.args.task_id === "t1",
),
},
});
s.close();
}
// Sending in the user's name: restate, wait for a yes in a later turn,
// then start with the confirmation it got.
{
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn(
"WeChat Zhang San that I will be late tonight",
mock,
);
t.push(`U: WeChat → A: ${say(r1)}`);
const r2 = await s.turn("Yes, send it", mock);
t.push(`U: send it → A: ${say(r2)}`);
push({
scenario: "B10 once went wrong",
caseId: "confirm-then-send",
rep,
transcript: t,
metrics: {
restates: /Zhang San/i.test(text(r1)) && /late/i.test(text(r1)),
notStartedBeforeYes: !calls(r1).some(
(c) => c.name === "start_task" && c.args.confirmation_id === "c1",
),
startedWithConfirmation: calls(r2).some(
(c) => c.name === "start_task" && c.args.confirmation_id === "c1",
),
noPrematureDone: !/\bsent\b/i.test(text(r2)),
},
});
s.close();
}
// A task's result reaches the chat with its files by itself: asking for
// it there never posts it as the user.
{
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r1 = await s.turn(
"Use the cloud computer to look up OpenAI's latest model and give me a short intro",
mock,
);
t.push(`U: look up OpenAI → A: ${say(r1)}`);
const told = await s.update(
[
{
taskId: "t1",
goal: "Look up OpenAI's latest model",
kind: "report",
replies: [
"Checked OpenAI's official material: the latest is the GPT-6 series, released at the end of September, focused on long context and stronger tool calling. The brief is in playground/t1/report.md.",
],
},
],
{ kind: "idle" },
reported({
taskId: "t1",
goal: "Look up OpenAI's latest model",
kind: "report",
replies: [
"Checked OpenAI's official material: the latest is the GPT-6 series, released at the end of September, focused on long context and stronger tool calling. The brief is in playground/t1/report.md.",
],
}),
);
t.push(`[report] → A: ${told.text.trim()}`);
const r2 = await s.turn(
"Can you put that report in our chat so I can follow up later",
mock,
);
t.push(`U: report to chat → A: ${say(r2)}`);
push({
scenario: "B10 once went wrong",
caseId: "report-into-chat",
rep,
transcript: t,
metrics: {
toldResult: /GPT-6|GPT 6/.test(told.text),
noSendAsUser: !calls(r2).some((c) => c.name === "send_message"),
saysInChat: /chat|posted|already/i.test(text(r2)),
},
});
s.close();
}
// A new call: work from the last call is known, and asking about it
// reads its state.
{
const s = await open();
const t: string[] = [];
s.note(
taskNote(
"t3",
"Write this week's report draft",
1,
1,
'The weekly report draft is done, in "Week 44 report"; the key point is the launch slipping to December 10.',
),
);
const mock = makeMock({
list_tasks: () => ({
tasks: [
{
task_id: "t3",
goal: "Write this week's report draft",
state: "reported",
latest_report:
'The weekly report draft is done, in "Week 44 report"; the key point is the launch slipping to December 10.',
},
],
background_tasks: [],
}),
});
const r1 = await s.turn("Is the weekly report I asked for done", mock);
t.push(`U: weekly report done? → A: ${say(r1)}`);
push({
scenario: "B10 once went wrong",
caseId: "earlier-call-task",
rep,
transcript: t,
metrics: {
answersDone: /(done|ready|finished|complete)/i.test(text(r1)),
namesWhere: /weekly report|week 44/i.test(text(r1)),
noNewTask: !calls(r1).some((c) => c.name === "start_task"),
},
});
s.close();
}
}
// ---------- B11 interrupted reply ----------
async function b11(rep: number) {
// Replies cut off before their start_task call, twice as in a real
// call: asked later, Live starts the work or says it did not, never
// that it is running.
{
const s = await open();
const t: string[] = [];
const mock = makeMock();
const r0 = await s.cutOff(
"Use the browser on my computer to search two things: yesterday's NBA news and yesterday's OpenAI news, one report each",
);
t.push(`U: search two → A(cut off): ${r0.text.trim()}`);
const r1 = await s.cutOff("OK.");
t.push(`U: OK → A(cut off): ${r1.text.trim()}`);
const r2 = await s.turn("Did you use the local browser?", mock);
t.push(`U: did you? → A: ${say(r2)}`);
const started = calls(r2).some((c) => c.name === "start_task");
push({
scenario: "B11 interrupted reply",
caseId: "cut-off-before-task",
rep,
transcript: t,
metrics: {
cutBeforeCall: r0.calls.length === 0 && r1.calls.length === 0,
startedOrAdmits:
started ||
/(no|not yet|haven't|didn't|not started)/i.test(text(r2)),
noFalseRunning:
started ||
!/(running|already started|searching now|already on it)/i.test(
text(r2),
),
},
});
s.close();
}
}
// ---------- B13 open a file: by document ID, no Room switch, no upload click ----------
async function b13(rep: number) {
const s = await open();
const t: string[] = [];
// As heard on 3000: another deck's id is in the chat, the asked one is not.
const mock = makeMock({
search_documents: () => ({
documents: [
{
document_id: "document_huang",
title: "Jensen Huang recent gossip.pptx",
},
],
}),
});
s.note(
"Bo Zhang's Another Me (19:47): the 9-page AI glasses market deck is ready. [file: AI glasses market 2026.pptx, document_id: document_glasses]",
);
const r1 = await s.turn(
"Open the Jensen Huang gossip deck made today",
mock,
);
t.push(`U: open Jensen Huang deck → A: ${say(r1)}`);
const actions = calls(r1).filter((c) => c.name === "page_action");
t.push(...actions.map((c) => ` page_action ${JSON.stringify(c.args)}`));
push({
scenario: "B13 open a file",
caseId: "open-deck",
rep,
transcript: t,
metrics: {
openedById: actions.some(
(c) =>
c.args.action === "open_document" &&
c.args.target === "document_huang",
),
neverWrongId: !actions.some(
(c) => c.args.target === "document_glasses",
),
noRoomHopOrUpload: !actions.some(
(c) =>
c.args.action === "open_room" ||
/attach/i.test(String(c.args.target)) ||
c.args.action === "open_result",
),
},
});
s.close();
}
// Asked for an email with only a recipient, the model asks what it
// should say; it does not take TeamHub's answer as a bad address.
async function b14(rep: number) {
const s = await open();
const t: string[] = [];
const filled = (value: unknown) =>
typeof value === "string" && value.trim() !== "";
const mock = makeMock({
// As TeamHub answers an email with no subject or body.
open_email_canvas: (a) =>
filled(a.subject) && filled(a.body)
? {
status: "opened",
document_id: "document_canvas_1",
revision_id: "revision_1",
}
: { error: "missing_content" },
});
const r1 = await s.turn(
// Opened before its content is known, as in the call where this went
// wrong: TeamHub answers missing_content.
"Open an email to tonyzhang at simplexai dot com now, I will tell you what to say in a bit",
mock,
);
t.push(`U: email to tonyzhang → A: ${say(r1)}`);
const r2 = await s.turn("Say tomorrow's 3 pm meeting moves to 4 pm", mock);
t.push(`U: meeting moved → A: ${say(r2)}`);
const opened = calls(r2).find(
(c) =>
c.name === "open_email_canvas" &&
filled(c.args.subject) &&
filled(c.args.body),
);
push({
scenario: "B14 email content",
caseId: "email-recipient-only",
rep,
transcript: t,
metrics: {
// Whether the model wrote the email before it knew its content.
triedEmpty: calls(r1).some(
(c) =>
c.name === "open_email_canvas" &&
!(filled(c.args.subject) && filled(c.args.body)),
),
noAddressBlame:
!/spell|say it again|address\b[^,.?!]{0,30}\b(not|isn't|wasn't|wrong|invalid)|(not|wasn't|isn't|couldn't)[^,.?!]{0,20}(recogni|valid)/i.test(
text(r1),
),
asksContent: /what|subject|body|content|write|say/i.test(text(r1)),
openedWithContent: Boolean(opened),
keptRecipient:
typeof opened?.args.to === "string" &&
/tonyzhang@simplexai\.com/i.test(opened.args.to),
},
});
s.close();
}
return [
["b1-result", b1],
["b1b-length", b1Length],
["b2-leak", b2],
["b3-human", b3],
["b4-intent", b4],
["b5-blend", b5],
["b6-computer", b6],
["b7-memory", b7],
["b8-multi", b8],
["b9-alert", b9],
["b10-regressions", b10],
["b11-cut-off", b11],
["b13-open-file", b13],
["b14-email-content", b14],
];
}