| ... | ... | @@ -35,7 +35,8 @@ import { |
| 35 | 35 | loadPreferences, |
| 36 | 36 | saveAgentAwarenessRegistrationRecord, |
| 37 | 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"; |
| 39 | 40 | import { resolveCloudPublicConfig } from "../cloud/publicConfig"; |
| 40 | 41 | import { supportsAgentAwarenessPush } from "./capabilities"; |
| 41 | 42 | import { makeRelayDeviceRegistrationRequest, resolveApsEnvironment } from "./registrationPayload"; |
| ... | ... | @@ -522,11 +523,11 @@ function armAgentAwarenessLiveActivityForLocalWorkNow(input: { |
| 522 | 523 | readonly projectTitle: string; |
| 523 | 524 | }): void { |
| 524 | 525 | try { |
| 525 | | if (AgentActivity.getInstances().length > 0) { |
| 526 | if (getAgentLiveActivities().length > 0) { |
| 526 | 527 | return; |
| 527 | 528 | } |
| 528 | 529 | const nowIso = new Date(Date.now()).toISOString(); |
| 529 | | const activity = AgentActivity.start({ |
| 530 | const activity = startAgentLiveActivity({ |
| 530 | 531 | title: "T3 Code", |
| 531 | 532 | subtitle: "Agent work in progress", |
| 532 | 533 | activeCount: 1, |
| ... | ... | @@ -545,6 +546,9 @@ function armAgentAwarenessLiveActivityForLocalWorkNow(input: { |
| 545 | 546 | }, |
| 546 | 547 | ], |
| 547 | 548 | }); |
| 549 | if (!activity) { |
| 550 | return; |
| 551 | } |
| 548 | 552 | logRegistrationDebug("live activity card armed for local work", { |
| 549 | 553 | threadTitle: input.threadTitle, |
| 550 | 554 | }); |
| ... | ... | @@ -842,7 +846,7 @@ function endLocalLiveActivities(context: string): void { |
| 842 | 846 | return; |
| 843 | 847 | } |
| 844 | 848 | try { |
| 845 | | for (const activity of AgentActivity.getInstances()) { |
| 849 | for (const activity of getAgentLiveActivities()) { |
| 846 | 850 | activity.end("immediate").catch((error: unknown) => { |
| 847 | 851 | logRegistrationError(context, error); |
| 848 | 852 | }); |
| ... | ... | @@ -1069,7 +1073,7 @@ export function refreshActiveLiveActivityRemoteRegistration(): Effect.Effect< |
| 1069 | 1073 | } |
| 1070 | 1074 | |
| 1071 | 1075 | let activities = yield* Effect.try({ |
| 1072 | | try: () => AgentActivity.getInstances(), |
| 1076 | try: () => getAgentLiveActivities(), |
| 1073 | 1077 | catch: (cause) => |
| 1074 | 1078 | new AgentAwarenessOperationError({ |
| 1075 | 1079 | operation: "list-active-live-activities", |
| ... | ... | @@ -1118,7 +1122,7 @@ export function refreshActiveLiveActivityRemoteRegistration(): Effect.Effect< |
| 1118 | 1122 | // The snapshot request yields; an arm-on-send may have created the |
| 1119 | 1123 | // card in the meantime. Re-check so two cards are never started. |
| 1120 | 1124 | const armedMeanwhile = yield* Effect.try({ |
| 1121 | | try: () => AgentActivity.getInstances(), |
| 1125 | try: () => getAgentLiveActivities(), |
| 1122 | 1126 | catch: () => [] as ReadonlyArray<LiveActivity<AgentActivityProps>>, |
| 1123 | 1127 | }).pipe(Effect.orElseSucceed(() => [] as ReadonlyArray<LiveActivity<AgentActivityProps>>)); |
| 1124 | 1128 | if (armedMeanwhile.length > 0) { |
| ... | ... | @@ -1127,7 +1131,7 @@ export function refreshActiveLiveActivityRemoteRegistration(): Effect.Effect< |
| 1127 | 1131 | const aggregate = snapshot.aggregate; |
| 1128 | 1132 | const primed = yield* Effect.try({ |
| 1129 | 1133 | try: () => |
| 1130 | | AgentActivity.start({ |
| 1134 | startAgentLiveActivity({ |
| 1131 | 1135 | title: aggregate.title, |
| 1132 | 1136 | subtitle: aggregate.subtitle, |
| 1133 | 1137 | activeCount: aggregate.activeCount, |