The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 00:15 UTC
perf(mobile): isolate iOS Live Activity imports (#12380)
Julius Marminge committed
Sep 18, 2026 at 12:55 UTC
53830d413474b2a5749c040d4382c96002894b88
4 files changed
+35
-12
apps/mobile/src/features/agent-awareness/agentLiveActivity.ios.ts
new
+9
@@ -0,0 +1,9 @@
1
+import AgentActivity, { type AgentActivityProps } from "../../widgets/AgentActivity";
2
+
3
+export function getAgentLiveActivities() {
4
+ return AgentActivity.getInstances();
5
+}
6
+
7
+export function startAgentLiveActivity(props: AgentActivityProps) {
8
+ return AgentActivity.start(props);
9
+}
apps/mobile/src/features/agent-awareness/agentLiveActivity.ts
new
+12
@@ -0,0 +1,12 @@
1
+import type { LiveActivity } from "expo-widgets";
2
+import type { AgentActivityProps } from "../../widgets/AgentActivity";
3
+
4
+export function getAgentLiveActivities(): Array<LiveActivity<AgentActivityProps>> {
5
+ return [];
6
+}
7
+
8
+export function startAgentLiveActivity(
9
+ _props: AgentActivityProps,
10
+): LiveActivity<AgentActivityProps> | null {
11
+ return null;
12
+}
apps/mobile/src/features/agent-awareness/remoteRegistration.test.ts
+3
-5
@@ -101,11 +101,9 @@ vi.mock("expo-widgets", () => ({
101
addPushToStartTokenListener: vi.fn(() => ({ remove: vi.fn() })),
102
}));
103
104
-vi.mock("../../widgets/AgentActivity", () => ({
105
- default: {
106
- getInstances: widgetMocks.getInstances,
107
- start: widgetMocks.start,
108
- },
104
+vi.mock("./agentLiveActivity", () => ({
105
+ getAgentLiveActivities: widgetMocks.getInstances,
106
+ startAgentLiveActivity: widgetMocks.start,
107
}));
108
109
// The state modules pull the whole connection stack (and native expo modules)
apps/mobile/src/features/agent-awareness/remoteRegistration.ts
+11
-7
@@ -35,7 +35,8 @@ import {
35
loadPreferences,
36
saveAgentAwarenessRegistrationRecord,
37
} from "../../persistence/imperative";
38
-import AgentActivity, { type AgentActivityProps } from "../../widgets/AgentActivity";
38
+import type { AgentActivityProps } from "../../widgets/AgentActivity";
39
+import { getAgentLiveActivities, startAgentLiveActivity } from "./agentLiveActivity";
40
import { resolveCloudPublicConfig } from "../cloud/publicConfig";
41
import { supportsAgentAwarenessPush } from "./capabilities";
42
import { makeRelayDeviceRegistrationRequest, resolveApsEnvironment } from "./registrationPayload";
@@ -522,11 +523,11 @@ function armAgentAwarenessLiveActivityForLocalWorkNow(input: {
523
readonly projectTitle: string;
524
}): void {
525
try {
525
- if (AgentActivity.getInstances().length > 0) {
526
+ if (getAgentLiveActivities().length > 0) {
527
return;
528
}
529
const nowIso = new Date(Date.now()).toISOString();
529
- const activity = AgentActivity.start({
530
+ const activity = startAgentLiveActivity({
531
title: "T3 Code",
532
subtitle: "Agent work in progress",
533
activeCount: 1,
@@ -545,6 +546,9 @@ function armAgentAwarenessLiveActivityForLocalWorkNow(input: {
546
},
547
],
548
});
549
+ if (!activity) {
550
+ return;
551
+ }
552
logRegistrationDebug("live activity card armed for local work", {
553
threadTitle: input.threadTitle,
554
});
@@ -842,7 +846,7 @@ function endLocalLiveActivities(context: string): void {
846
return;
847
}
848
try {
845
- for (const activity of AgentActivity.getInstances()) {
849
+ for (const activity of getAgentLiveActivities()) {
850
activity.end("immediate").catch((error: unknown) => {
851
logRegistrationError(context, error);
852
});
@@ -1069,7 +1073,7 @@ export function refreshActiveLiveActivityRemoteRegistration(): Effect.Effect<
1073
}
1074
1075
let activities = yield* Effect.try({
1072
- try: () => AgentActivity.getInstances(),
1076
+ try: () => getAgentLiveActivities(),
1077
catch: (cause) =>
1078
new AgentAwarenessOperationError({
1079
operation: "list-active-live-activities",
@@ -1118,7 +1122,7 @@ export function refreshActiveLiveActivityRemoteRegistration(): Effect.Effect<
1122
// The snapshot request yields; an arm-on-send may have created the
1123
// card in the meantime. Re-check so two cards are never started.
1124
const armedMeanwhile = yield* Effect.try({
1121
- try: () => AgentActivity.getInstances(),
1125
+ try: () => getAgentLiveActivities(),
1126
catch: () => [] as ReadonlyArray<LiveActivity<AgentActivityProps>>,
1127
}).pipe(Effect.orElseSucceed(() => [] as ReadonlyArray<LiveActivity<AgentActivityProps>>));
1128
if (armedMeanwhile.length > 0) {
@@ -1127,7 +1131,7 @@ export function refreshActiveLiveActivityRemoteRegistration(): Effect.Effect<
1131
const aggregate = snapshot.aggregate;
1132
const primed = yield* Effect.try({
1133
try: () =>
1130
- AgentActivity.start({
1134
+ startAgentLiveActivity({
1135
title: aggregate.title,
1136
subtitle: aggregate.subtitle,
1137
activeCount: aggregate.activeCount,