Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Live Activity pushes stay quiet: an alert on a remote start only; content state version 1 (#6079)
Milind Soni68c6cec6e8c3
diff --git a/cloudflare/control-plane/README.md b/cloudflare/control-plane/README.mdindex 5e20c96517..344c71bc67 100644--- a/cloudflare/control-plane/README.md+++ b/cloudflare/control-plane/README.md@@ -232,13 +232,20 @@ shape.that activity's own token.- `activity` `{ "v": 1, "token", "event": "start" | "update" | "end", "alert"?,"activity": { "botId", "botName", "kind": "needsYou" | "working", "headline",- "since", "link", "color", "gradient", "body" } }` starts, updates or ends a+ "since", "link", "color", "gradient", "body", "version"?, "ask"?, "status"?,+ "waiting"? } }` starts, updates or ends abot's Live Activity on iPhone, or sends an FCM token the data message theAndroid app turns into its ongoing "working" notification. The schema is asstrict as `send`'s: `headline` is one line of at most 120 characters (thephone's own words, "Scout needs you", with the name filled in), `link` mustbe the app's chat link, colours are `#rrggbb`, and there is no field for a- line of text or an answer. Same limits and answers as `send`.+ line of text or an answer. `alert` is accepted on a `start` only (`400`+ elsewhere): an alerting update or end lights the screen and expands the+ Dynamic Island. `version: 1` with `ask` (`approval` | `question` | `signIn`+ | `other`), `status` (one line of at most 80, the phone's words without the+ name) and `waiting` (bots waiting on the person) asks for the phone's+ content state version 1; all four or none. Same limits and answers as+ `send`.`collapseId` is the identifier the phone gives the notification the livestream would have posted (`openmaus.<threadId>.<seq>`), so a push and that@@ -267,15 +274,19 @@ however many isolates send; each isolate caches its token for the window.**Live Activities.** `POST https://api.push.apple.com/3/device/<token>`with `apns-push-type: liveactivity`, `apns-topic: <bundle id>.push-type.liveactivity`,-priority 10 for a start or a ringing update and 5 otherwise, a 15-minute-expiration, and `{ "aps": { "timestamp", "event", "content-state": { "name":-"BotActivity", "props": <the app's BotActivityProps as JSON, with an empty line-and no answers> }, "stale-date" (now + 15 min) | "dismissal-date" (an end),-"attributes-type": "LiveActivityAttributes" and "attributes": { "url" } (a-start), "alert"? } }`. `BotActivity` and `LiveActivityAttributes` are the+priority 10 for a start and 5 otherwise, a 15-minute expiration, and+`{ "aps": { "timestamp", "event", "content-state": { "name": "BotActivity",+"props": <the app's BotActivityProps as JSON: version 1 (`version`, `name`,+`color`, `body`, `mood`, `kind`, `ask`, `status`, `waiting`, `since`, `link`,+no answers) when asked for, else the earlier shape with `headline`, an empty+line and no answers> }, "stale-date" (now + 15 min) | "dismissal-date" (an+end), and for a start only "attributes-type": "LiveActivityAttributes",+"attributes": { "url" } and the alert ActivityKit requires to start one+remotely, "alert": { "title": <headline>, "body": <bot name>, "sound" } } }`.+An update or an end never carries an alert. `BotActivity` and `LiveActivityAttributes` are thenames the phone app's Live Activity is registered under (expo-widgets). For anFCM token: a data-only message `{ "omb_kind": "activity", "event", "bot_id",-"bot_name", "kind", "headline", "since", "link", "alert", "sent_at" }`, priority+"bot_name", "kind", "headline", "since", "link", "sent_at" }`, priority`HIGH` when the bot needs the person or the activity ends, else `NORMAL`.**FCM.** An OAuth access token from `https://oauth2.googleapis.com/token`diff --git a/cloudflare/control-plane/src/push-activity.ts b/cloudflare/control-plane/src/push-activity.tsindex 36dfbb5566..430635e8a8 100644--- a/cloudflare/control-plane/src/push-activity.ts+++ b/cloudflare/control-plane/src/push-activity.ts@@ -32,9 +32,17 @@ const activitySchema = z.strictObject({v: z.literal(1),token: z.string().regex(TOKEN),event: z.enum(["start", "update", "end"]),- /** Ring with the headline: a bot started needing the person. */+ /** A push-to-start only: ActivityKit starts an activity remotely only with an alert, and an alerting update or end+ * would light the screen and expand the Dynamic Island. Refused anywhere else. */alert: z.boolean().optional(),activity: z.strictObject({+ /** Content state version 1 (the phone app's `BotActivityProps`): with `ask`, `status` and `waiting`. */+ version: z.literal(1).optional(),+ ask: z.enum(["approval", "question", "signIn", "other"]).optional(),+ /** The status line in the phone's words, without the name ("Needs your approval"). */+ status: oneLine(80).optional(),+ /** How many bots wait on the person now. */+ waiting: z.number().int().min(0).max(999).optional(),botId: z.string().regex(ID),botName: oneLine(80),kind: z.enum(["needsYou", "working"]),@@ -47,11 +55,31 @@ const activitySchema = z.strictObject({gradient: z.array(z.string().regex(HEX)).min(1).max(4),body: z.string().regex(BODY),}),-});+}).refine((request) => !request.alert || request.event === "start")+ .refine(({ activity }) => activity.version === undefined+ ? activity.ask === undefined && activity.status === undefined && activity.waiting === undefined+ : activity.ask !== undefined && activity.status !== undefined && activity.waiting !== undefined);export type ActivitySendRequest = z.infer<typeof activitySchema>;-/** The phone app's `BotActivityProps` for a pushed state: no line of text, no answers. */+/** The phone app's `BotActivityProps` for a pushed state, version 1 or the earlier shape: no message text, no answers. */export function activityProps(activity: ActivitySendRequest["activity"]) {+ if (activity.version === 1) {+ return {+ version: 1,+ botId: activity.botId,+ name: activity.botName,+ color: activity.color,+ body: activity.body,+ mood: activity.kind,+ kind: activity.kind,+ ask: activity.ask,+ status: activity.status,+ waiting: activity.waiting,+ since: activity.since,+ link: activity.link,+ answers: [],+ };+ }return {botId: activity.botId,name: activity.botName,@@ -78,7 +106,8 @@ export function liveActivityPayload(request: ActivitySendRequest, now: number) {"content-state": contentState,...(request.event === "end" ? { "dismissal-date": seconds } : { "stale-date": seconds + ACTIVITY_STALE_SECONDS }),...(request.event === "start" ? { "attributes-type": LIVE_ACTIVITY_ATTRIBUTES, attributes: { url: request.activity.link } } : {}),- ...(request.alert && request.event !== "end" ? { alert: { title: request.activity.headline, body: request.activity.botName, sound: "default" } } : {}),+ // The minimal alert ActivityKit needs to start an activity remotely: names and kind only.+ ...(request.event === "start" ? { alert: { title: request.activity.headline, body: request.activity.botName, sound: "default" } } : {}),},};}@@ -98,7 +127,6 @@ export function activityFcmPayload(request: ActivitySendRequest, now: number) {headline: activity.headline,since: String(activity.since),link: activity.link,- alert: request.alert ? "1" : "0",sent_at: String(now),},android: { priority: activity.kind === "needsYou" || request.event === "end" ? "HIGH" : "NORMAL", ttl: FCM_TTL },@@ -116,7 +144,7 @@ export async function sendActivityPush(request: Request, env: Env, pushFetch: tyconst wanted = body.event === "start" ? "activity-start" : "activity";if (row.purpose !== wanted) return errorResponse(404, "push_device_unknown");if (!config.apns) return errorResponse(503, "push_unavailable");- const priority = body.alert || body.event === "start" ? 10 : 5;+ const priority = body.event === "start" ? 10 : 5;return { kind: "apns", config: config.apns, pushType: "liveactivity", priority, expiresInSeconds: ACTIVITY_EXPIRATION_SECONDS, payload: liveActivityPayload(body, now) };});}diff --git a/cloudflare/control-plane/test/push-activity.test.ts b/cloudflare/control-plane/test/push-activity.test.tsindex 453233e1d6..182e8f500d 100644--- a/cloudflare/control-plane/test/push-activity.test.ts+++ b/cloudflare/control-plane/test/push-activity.test.ts@@ -164,11 +164,12 @@ describe("Live Activities and ongoing notifications by push", () => {const worker = createWorker(fetch, providers.fetch);const credential = await installation(worker, environment, "[email protected]");await register(worker, environment, credential, { platform: "fcm", token: FCM_TOKEN, environment: undefined });- expect((await push(worker, environment, credential, { token: FCM_TOKEN, event: "update", alert: true })).status).toBe(202);+ expect((await push(worker, environment, credential, { token: FCM_TOKEN, event: "update" })).status).toBe(202);expect((await push(worker, environment, credential, { token: FCM_TOKEN, event: "update", activity: { ...activity, kind: "working", headline: "Scout is working" } })).status).toBe(202);const [needs, working] = providers.fcm().map((one) => (JSON.parse(one.text) as { message: { data: Record<string, string>; android: { priority: string } } }).message);- expect(needs!.data).toMatchObject({ omb_kind: "activity", event: "update", bot_id: "bot_1", bot_name: "Scout", kind: "needsYou", headline: "Scout needs you", since: "1794700000000", link: "openmausbot://chat/th_1", alert: "1" });+ expect(needs!.data).toMatchObject({ omb_kind: "activity", event: "update", bot_id: "bot_1", bot_name: "Scout", kind: "needsYou", headline: "Scout needs you", since: "1794700000000", link: "openmausbot://chat/th_1" });expect(needs!.data.title).toBeUndefined();+ expect(needs!.data.alert).toBeUndefined();expect(needs!.android.priority).toBe("HIGH");expect(working!.android.priority).toBe("NORMAL");});@@ -193,4 +194,40 @@ describe("Live Activities and ongoing notifications by push", () => {}expect(providers.calls).toEqual([]);});++ it("never alerts an update or an end, and always gives a remote start the alert ActivityKit needs", async () => {+ const environment = await pushEnv();+ const providers = fakeProviders();+ const worker = createWorker(fetch, providers.fetch);+ const credential = await installation(worker, environment, "[email protected]");+ await register(worker, environment, credential, { purpose: "activity", token: ACTIVITY_TOKEN });+ await register(worker, environment, credential, { purpose: "activity-start", token: START_TOKEN });+ for (const event of ["update", "end"]) {+ expect((await push(worker, environment, credential, { token: ACTIVITY_TOKEN, event, alert: true })).status, event).toBe(400);+ }+ expect((await push(worker, environment, credential, { token: ACTIVITY_TOKEN, event: "update" })).status).toBe(202);+ expect((await push(worker, environment, credential, { token: START_TOKEN, event: "start" })).status).toBe(202);+ const [update, start] = providers.apns().map((one) => ({ priority: one.headers["apns-priority"], aps: (JSON.parse(one.text) as { aps: Record<string, unknown> }).aps }));+ expect(update).toMatchObject({ priority: "5" });+ expect(update!.aps.alert).toBeUndefined();+ expect(start).toMatchObject({ priority: "10", aps: { alert: { title: "Scout needs you", body: "Scout", sound: "default" } } });+ });++ it("sends content state version 1 when asked, all of it or none", async () => {+ const environment = await pushEnv();+ const providers = fakeProviders();+ const worker = createWorker(fetch, providers.fetch);+ const credential = await installation(worker, environment, "[email protected]");+ await register(worker, environment, credential, { purpose: "activity", token: ACTIVITY_TOKEN });+ const v1 = { ...activity, version: 1, ask: "approval", status: "Needs your approval", waiting: 2 };+ expect((await push(worker, environment, credential, { token: ACTIVITY_TOKEN, event: "update", activity: v1 })).status).toBe(202);+ const props = JSON.parse((JSON.parse(providers.apns()[0]!.text) as { aps: { "content-state": { props: string } } }).aps["content-state"].props);+ expect(props).toEqual({+ version: 1, botId: "bot_1", name: "Scout", color: "#7C5CFF", body: "round", mood: "needsYou", kind: "needsYou",+ ask: "approval", status: "Needs your approval", waiting: 2, since: 1_794_700_000_000, link: "openmausbot://chat/th_1", answers: [],+ });+ for (const partial of [{ ...activity, version: 1 }, { ...activity, status: "Working" }, { ...v1, ask: "done" }, { ...v1, status: "two\nlines" }]) {+ expect((await push(worker, environment, credential, { token: ACTIVITY_TOKEN, event: "update", activity: partial })).status, JSON.stringify(partial)).toBe(400);+ }+ });});diff --git a/docs/phone-push.md b/docs/phone-push.mdindex 11dfaeba8c..4d7df0168d 100644--- a/docs/phone-push.md+++ b/docs/phone-push.md@@ -92,9 +92,11 @@ which brings back the large expanded island the phone app removed (its ownactivities send no alert configuration, so the island stays a small mark).The person still hears about the ask: the closed-app alert above arrives asan ordinary notification. Only a push-to-start `start` carries `alert`,-because ActivityKit does not start an activity remotely without one.-`server/phone-activity.ts` sets `alert` today on every move into needs-you,-on updates as well as starts; it should set it on starts only.+because ActivityKit does not start an activity remotely without one, and the+control plane refuses `alert` on anything else. A phone that registers its+status words (`statuses`) gets the activity in its content state version 1+(`status`, `ask`, `waiting`, `version`); a phone that does not gets the+earlier shape with `headline`, which the phone app also draws.## No duplicates with local notificationsdiff --git a/packages/phone-protocol/src/phone-push.ts b/packages/phone-protocol/src/phone-push.tsindex 5cb364c380..fe63020e23 100644--- a/packages/phone-protocol/src/phone-push.ts+++ b/packages/phone-protocol/src/phone-push.ts@@ -130,6 +130,16 @@ export const PHONE_ACTIVITY_RELAY_PATH = "/v1/installations/self/push/activity";/** What a bot's activity shows: it needs the person, or it is working. */export type ActivityKind = "needsYou" | "working";+/** What a bot that needs the person waits for, as the phone's content state version 1 names it. */+export type ActivityAsk = "approval" | "question" | "signIn" | "other";+export const ACTIVITY_ASKS: readonly ActivityAsk[] = ["approval", "question", "signIn", "other"];++/** The phone's words for an activity's status line in content state version 1 ("Working", "Needs your approval"):+ * no name, it sits under the bot's name. */+export interface ActivityStatuses {+ working: string;+ needsYou: Record<ActivityAsk, string>;+}export type ActivityEvent = "start" | "update" | "end";/** How the phone draws a bot: its colour, body gradient and mascot body, as its own widgets do. */@@ -156,6 +166,9 @@ export interface PhoneActivityRegistration {ongoing?: boolean;/** Which kinds the phone wants, from its Settings switches. Absent: both. */kinds?: ActivityKind[];+ /** The status words for content state version 1. A phone that registers them draws version 1, and a pushed+ * activity is sent in it; without them the earlier shape (`headline`) is sent. */+ statuses?: ActivityStatuses;}/** What the server sends the relay for one activity change. */@@ -163,6 +176,8 @@ export interface PushRelayActivityRequest {v: typeof PHONE_PUSH_WIRE_VERSION;token: string;event: ActivityEvent;+ /** A push-to-start `start` only, where ActivityKit requires one. An update or an end never alerts: an alerting+ * update lights the screen and expands the Dynamic Island. */alert?: boolean;activity: {botId: string;@@ -171,5 +186,10 @@ export interface PushRelayActivityRequest {headline: string;since: number;link: string;+ /** Content state version 1, for a phone that registered `statuses`: all four, or none. */+ version?: 1;+ ask?: ActivityAsk;+ status?: string;+ waiting?: number;} & ActivityVisual;}diff --git a/server/phone-activity.test.ts b/server/phone-activity.test.tsindex cdada36057..2850030d53 100644--- a/server/phone-activity.test.ts+++ b/server/phone-activity.test.ts@@ -139,7 +139,7 @@ describe("pushing a bot's activity while the app is closed", () => {await step({ ask: false, busy: false }, runtime("turn.completed"));expect(activityCalls().map((body) => [body.token === FCM, body.event, (body.activity as { kind: string }).kind, body.alert ?? false])).toEqual([[true, "update", "working", false],- [true, "update", "needsYou", true],+ [true, "update", "needsYou", false],[true, "end", "needsYou", false],]);});@@ -201,4 +201,31 @@ describe("pushing a bot's activity while the app is closed", () => {await step({ busy: false });expect(activityCalls().map((body) => [body.token === FCM, body.event])).toEqual([[true, "end"]]);});++ it("never alerts a running activity's update, only a remote start", async () => {+ const { activity, activityCalls, step } = harness();+ await activity.register(IPHONE, registration({ activities: [{ botId: "bot_1", token: ACT }], startToken: START }));+ await step({ busy: true });+ await step({ ask: true }, notify("approval"));+ expect(activityCalls().map((body) => [body.token === ACT, body.event, (body.activity as { kind: string }).kind, "alert" in body])).toEqual([+ [true, "update", "working", false],+ [true, "update", "needsYou", false],+ ]);+ });++ it("sends content state version 1, in the phone's words for the ask, only to a phone that registered them", async () => {+ const { activity, activityCalls, step } = harness();+ const statuses = { working: "Working", needsYou: { approval: "Needs your approval", question: "Has a question", signIn: "Needs you to sign in", other: "Needs you" } };+ await activity.register(IPHONE, registration({ activities: [{ botId: "bot_1", token: ACT }], statuses }));+ await activity.register(ANDROID, registration({ activities: [{ botId: "bot_1", token: START }] }));+ await step({ busy: true });+ await step({ ask: true }, notify("sign-in"));+ const sent = activityCalls().map((body) => [body.token, body.activity as Record<string, unknown>] as const);+ const v1 = sent.filter(([token]) => token === ACT).map(([, body]) => [body.version, body.ask, body.status, body.waiting]);+ expect(v1).toEqual([[1, "other", "Working", 0], [1, "signIn", "Needs you to sign in", 1]]);+ const earlier = sent.filter(([token]) => token === START).map(([, body]) => body);+ expect(earlier).toHaveLength(2);+ for (const body of earlier) expect(["version", "ask", "status", "waiting"].some((field) => field in body)).toBe(false);+ expect(activityRegistrationSchema.safeParse({ scheme: "openmausbot", headlines: HEADLINES, statuses: { ...statuses, working: "Work\ning" } }).success).toBe(false);+ });});diff --git a/server/phone-activity.ts b/server/phone-activity.tsindex 9ba5cb0709..71b6996d40 100644--- a/server/phone-activity.ts+++ b/server/phone-activity.ts@@ -15,6 +15,7 @@ import {PUSH_ID,PUSH_NAME_MAX,PUSH_RELAY_ERRORS,+ type ActivityAsk,type ActivityEvent,type ActivityKind,type ActivityVisual,@@ -29,12 +30,15 @@ export const MAX_ACTIVITY_PHONES = 50;export const MAX_ACTIVITIES = 10;export const MAX_VISUALS = 60;const HEADLINE_MAX = 120;-const NEEDS_YOU_KINDS: ReadonlySet<string> = new Set(["approval", "question", "sign-in"]);+/** A notification kind that means a bot needs the person, as the ask the phone's content state names. */+const ASK_OF_KIND: ReadonlyMap<string, ActivityAsk> = new Map([["approval", "approval"], ["question", "question"], ["sign-in", "signIn"]]);const hex = z.string().regex(/^#[0-9A-Fa-f]{6}$/);const visualSchema = z.object({ color: hex, gradient: z.array(hex).min(1).max(4), body: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/) }).strict();const headline = z.string().min(1).max(HEADLINE_MAX).refine((value) => value.includes("{name}") && !/[\p{Cc}\u2028\u2029]/u.test(value));+const status = z.string().min(1).max(80).refine((value) => value.trim() === value && !/[\p{Cc}\u2028\u2029]/u.test(value));+export const activityRegistrationSchema = z.object({scheme: z.enum(["openmausbot", "openmausbot-dev", "openmausbot-next"]),headlines: z.object({ needsYou: headline, working: headline }).strict(),@@ -44,6 +48,10 @@ export const activityRegistrationSchema = z.object({fallbackVisual: visualSchema.optional(),ongoing: z.boolean().optional(),kinds: z.array(z.enum(["needsYou", "working"])).max(2).optional(),+ statuses: z.object({+ working: status,+ needsYou: z.object({ approval: status, question: status, signIn: status, other: status }).strict(),+ }).strict().optional(),}).strict();const storedSchema = z.object({ version: z.literal(1), phones: z.array(z.object({ key: z.string().regex(PUSH_DEVICE_KEY), registration: activityRegistrationSchema, updatedAt: z.number() })).max(MAX_ACTIVITY_PHONES) });@@ -109,6 +117,7 @@ export class PhoneActivity {private readonly pending = new Map<string, unknown>();private readonly reach = new Map<string, (key: string) => boolean>();private readonly askThread = new Map<string, string>();+ private readonly askKind = new Map<string, ActivityAsk>();constructor(options: PhoneActivityOptions) {this.options = options;@@ -221,8 +230,10 @@ export class PhoneActivity {if (payload.kind === "notify") {const notification = payload.notification as Record<string, unknown> | undefined;const botId = notification?.botId, threadId = notification?.threadId, kind = notification?.kind;- if (typeof botId !== "string" || typeof kind !== "string" || !PUSH_ID.test(botId) || !NEEDS_YOU_KINDS.has(kind)) return null;+ const ask = typeof kind === "string" ? ASK_OF_KIND.get(kind) : undefined;+ if (typeof botId !== "string" || !ask || !PUSH_ID.test(botId)) return null;if (typeof threadId === "string") this.askThread.set(botId, threadId);+ this.askKind.set(botId, ask);return botId;}if (payload.kind === "bot") {@@ -249,7 +260,10 @@ export class PhoneActivity {if (bot) this.remember(botId, bot.name, kind === "needsYou" ? this.askThread.get(botId) ?? bot.threadId : bot.threadId);if (kind && bot) this.bots.set(botId, { kind, since: previous?.kind === kind ? previous.since : now, name: bot.name, threadId: this.seen.get(botId)?.threadId ?? bot.threadId });else this.bots.delete(botId);- if (kind !== "needsYou") this.askThread.delete(botId);+ if (kind !== "needsYou") {+ this.askThread.delete(botId);+ this.askKind.delete(botId);+ }const reaches = this.reach.get(botId) ?? (() => false);for (const phone of this.phones) {if (this.options.push.isLive(phone.key)) {@@ -314,6 +328,8 @@ export class PhoneActivity {const visual = registration.visuals?.[botId] ?? registration.fallbackVisual ?? FALLBACK_VISUAL;const known = state ?? this.seen.get(botId);const name = clipName(known?.name ?? fallbackName);+ const statuses = registration.statuses;+ const ask: ActivityAsk = kind === "needsYou" ? this.askKind.get(botId) ?? "other" : "other";return {botId,botName: name,@@ -322,6 +338,13 @@ export class PhoneActivity {since: state?.since ?? this.now(),link: `${registration.scheme}://chat/${encodeURIComponent(known?.threadId ?? botId)}`,...visual,+ // Content state version 1 only for a phone that registered its words for it.+ ...(statuses ? {+ version: 1 as const,+ ask,+ status: kind === "working" ? statuses.working : statuses.needsYou[ask],+ waiting: [...this.bots.values()].filter((bot) => bot.kind === "needsYou").length,+ } : {}),};}@@ -331,21 +354,23 @@ export class PhoneActivity {const kind = wanted ?? was;if (!kind) return outcomes;const activity = this.activityBody(phone, botId, kind, state, botId);- const alert = wanted === "needsYou" && was !== "needsYou";+ const newlyNeedsYou = wanted === "needsYou" && was !== "needsYou";const event: ActivityEvent = wanted ? "update" : "end";+ // An update or an end never alerts: that lights the screen and expands the Dynamic Island. The person hears of the+ // ask from the closed-app notification.const running = registration.activities?.find((entry) => entry.botId === botId);if (running) {- outcomes.push(await this.post(phone.key, botId, { v: PHONE_PUSH_WIRE_VERSION, token: running.token, event, ...(alert ? { alert } : {}), activity }, "apns"));+ outcomes.push(await this.post(phone.key, botId, { v: PHONE_PUSH_WIRE_VERSION, token: running.token, event, activity }, "apns"));if (event === "end") this.dropActivity(phone.key, botId);- } else if (wanted === "needsYou" && registration.startToken && alert) {- // Only a bot that starts needing the person is started remotely: a working bot is news the app shows when opened.+ } else if (newlyNeedsYou && registration.startToken) {+ // Only a bot that starts needing the person is started remotely, with the alert ActivityKit requires for that.outcomes.push(await this.post(phone.key, botId, { v: PHONE_PUSH_WIRE_VERSION, token: registration.startToken, event: "start", alert: true, activity }, "apns"));}const device = this.options.push.deviceOf(phone.key);if (registration.ongoing && device?.platform === "fcm" && FCM_TOKEN.test(device.token)) {- outcomes.push(await this.post(phone.key, botId, { v: PHONE_PUSH_WIRE_VERSION, token: device.token, event, ...(alert ? { alert } : {}), activity }, "fcm"));+ outcomes.push(await this.post(phone.key, botId, { v: PHONE_PUSH_WIRE_VERSION, token: device.token, event, activity }, "fcm"));}return outcomes;}diff --git a/server/phone-push.e2e.test.ts b/server/phone-push.e2e.test.tsindex 4781efb5e9..e717ab5335 100644--- a/server/phone-push.e2e.test.ts+++ b/server/phone-push.e2e.test.ts@@ -186,6 +186,7 @@ describe("Live Activities by push", () => {const registered = await api(on, "PUT", "/api/push/activity", {scheme: "openmausbot",headlines: { needsYou: "{name} braucht dich", working: "{name} arbeitet" },+ statuses: { working: "Arbeitet", needsYou: { approval: "Braucht deine Freigabe", question: "Hat eine Frage", signIn: "Braucht deine Anmeldung", other: "Braucht dich" } },activities: [{ botId: pip.id, token: ACTIVITY }],visuals: { [pip.id]: { color: "#7C5CFF", gradient: ["#B9A9FF", "#7C5CFF"], body: "round" } },}, phone.token);@@ -202,8 +203,12 @@ describe("Live Activities by push", () => {v: 1,token: ACTIVITY,event: "update",- activity: { botId: pip.id, botName: "Pip", kind: "working", headline: "Pip arbeitet", since: expect.any(Number), link: `openmausbot://chat/${pip.threadId}`, color: "#7C5CFF", gradient: ["#B9A9FF", "#7C5CFF"], body: "round" },+ activity: {+ botId: pip.id, botName: "Pip", kind: "working", headline: "Pip arbeitet", since: expect.any(Number), link: `openmausbot://chat/${pip.threadId}`, color: "#7C5CFF", gradient: ["#B9A9FF", "#7C5CFF"], body: "round",+ version: 1, ask: "other", status: "Arbeitet", waiting: 0,+ },});+ for (const body of activityPushes()) expect(body).not.toHaveProperty("alert");expect(JSON.stringify(activityPushes())).not.toContain("PRIVATE-REPLY-TEXT");await expect.poll(() => stub.pushes.at(-1), { timeout: 10_000 }).toEqual({ path: "/v1/installations/self/push/unregister", body: { v: 1, platform: "apns", token: ACTIVITY } });}, 90_000);