@@ -35,7 +35,8 @@ import {
3535 loadPreferences ,
3636 saveAgentAwarenessRegistrationRecord ,
3737} from "../../persistence/imperative" ;
38- import AgentActivity , { type AgentActivityProps } from "../../widgets/AgentActivity" ;
38+ import type { AgentActivityProps } from "../../widgets/AgentActivity" ;
39+ import { getAgentLiveActivities , startAgentLiveActivity } from "./agentLiveActivity" ;
3940import { resolveCloudPublicConfig } from "../cloud/publicConfig" ;
4041import { supportsAgentAwarenessPush } from "./capabilities" ;
4142import { makeRelayDeviceRegistrationRequest , resolveApsEnvironment } from "./registrationPayload" ;
@@ -522,11 +523,11 @@ function armAgentAwarenessLiveActivityForLocalWorkNow(input: {
522523 readonly projectTitle : string ;
523524} ) : void {
524525 try {
525- if ( AgentActivity . getInstances ( ) . length > 0 ) {
526+ if ( getAgentLiveActivities ( ) . length > 0 ) {
526527 return ;
527528 }
528529 const nowIso = new Date ( Date . now ( ) ) . toISOString ( ) ;
529- const activity = AgentActivity . start ( {
530+ const activity = startAgentLiveActivity ( {
530531 title : "T3 Code" ,
531532 subtitle : "Agent work in progress" ,
532533 activeCount : 1 ,
@@ -545,6 +546,9 @@ function armAgentAwarenessLiveActivityForLocalWorkNow(input: {
545546 } ,
546547 ] ,
547548 } ) ;
549+ if ( ! activity ) {
550+ return ;
551+ }
548552 logRegistrationDebug ( "live activity card armed for local work" , {
549553 threadTitle : input . threadTitle ,
550554 } ) ;
@@ -842,7 +846,7 @@ function endLocalLiveActivities(context: string): void {
842846 return ;
843847 }
844848 try {
845- for ( const activity of AgentActivity . getInstances ( ) ) {
849+ for ( const activity of getAgentLiveActivities ( ) ) {
846850 activity . end ( "immediate" ) . catch ( ( error : unknown ) => {
847851 logRegistrationError ( context , error ) ;
848852 } ) ;
@@ -1069,7 +1073,7 @@ export function refreshActiveLiveActivityRemoteRegistration(): Effect.Effect<
10691073 }
10701074
10711075 let activities = yield * Effect . try ( {
1072- try : ( ) => AgentActivity . getInstances ( ) ,
1076+ try : ( ) => getAgentLiveActivities ( ) ,
10731077 catch : ( cause ) =>
10741078 new AgentAwarenessOperationError ( {
10751079 operation : "list-active-live-activities" ,
@@ -1118,7 +1122,7 @@ export function refreshActiveLiveActivityRemoteRegistration(): Effect.Effect<
11181122 // The snapshot request yields; an arm-on-send may have created the
11191123 // card in the meantime. Re-check so two cards are never started.
11201124 const armedMeanwhile = yield * Effect . try ( {
1121- try : ( ) => AgentActivity . getInstances ( ) ,
1125+ try : ( ) => getAgentLiveActivities ( ) ,
11221126 catch : ( ) => [ ] as ReadonlyArray < LiveActivity < AgentActivityProps > > ,
11231127 } ) . pipe ( Effect . orElseSucceed ( ( ) => [ ] as ReadonlyArray < LiveActivity < AgentActivityProps > > ) ) ;
11241128 if ( armedMeanwhile . length > 0 ) {
@@ -1127,7 +1131,7 @@ export function refreshActiveLiveActivityRemoteRegistration(): Effect.Effect<
11271131 const aggregate = snapshot . aggregate ;
11281132 const primed = yield * Effect . try ( {
11291133 try : ( ) =>
1130- AgentActivity . start ( {
1134+ startAgentLiveActivity ( {
11311135 title : aggregate . title ,
11321136 subtitle : aggregate . subtitle ,
11331137 activeCount : aggregate . activeCount ,
0 commit comments