()
| 168 | } |
| 169 | |
| 170 | function logActiveState() { |
| 171 | fireAndForget(async () => { |
| 172 | const astate = getActivityState(); |
| 173 | const activity: ActivityUpdate = { openminutes: 1 }; |
| 174 | const ww = focusedWaveWindow; |
| 175 | const activeTabView = ww?.activeTabView; |
| 176 | const isWaveAIOpen = activeTabView?.isWaveAIOpen ?? false; |
| 177 | |
| 178 | if (astate.wasInFg) { |
| 179 | activity.fgminutes = 1; |
| 180 | } |
| 181 | if (astate.wasActive) { |
| 182 | activity.activeminutes = 1; |
| 183 | } |
| 184 | activity.displays = getActivityDisplays(); |
| 185 | |
| 186 | const termCmdCount = getAndClearTermCommandsRun(); |
| 187 | if (termCmdCount > 0) { |
| 188 | activity.termcommandsrun = termCmdCount; |
| 189 | } |
| 190 | const termCmdRemoteCount = getAndClearTermCommandsRemote(); |
| 191 | const termCmdWslCount = getAndClearTermCommandsWsl(); |
| 192 | const termCmdDurableCount = getAndClearTermCommandsDurable(); |
| 193 | |
| 194 | const props: TEventProps = { |
| 195 | "activity:activeminutes": activity.activeminutes, |
| 196 | "activity:fgminutes": activity.fgminutes, |
| 197 | "activity:openminutes": activity.openminutes, |
| 198 | }; |
| 199 | if (termCmdCount > 0) { |
| 200 | props["activity:termcommandsrun"] = termCmdCount; |
| 201 | } |
| 202 | if (termCmdRemoteCount > 0) { |
| 203 | props["activity:termcommands:remote"] = termCmdRemoteCount; |
| 204 | } |
| 205 | if (termCmdWslCount > 0) { |
| 206 | props["activity:termcommands:wsl"] = termCmdWslCount; |
| 207 | } |
| 208 | if (termCmdDurableCount > 0) { |
| 209 | props["activity:termcommands:durable"] = termCmdDurableCount; |
| 210 | } |
| 211 | if (astate.wasActive && isWaveAIOpen) { |
| 212 | props["activity:waveaiactiveminutes"] = 1; |
| 213 | } |
| 214 | if (astate.wasInFg && isWaveAIOpen) { |
| 215 | props["activity:waveaifgminutes"] = 1; |
| 216 | } |
| 217 | |
| 218 | try { |
| 219 | await RpcApi.ActivityCommand(ElectronWshClient, activity, { noresponse: true }); |
| 220 | await RpcApi.RecordTEventCommand( |
| 221 | ElectronWshClient, |
| 222 | { |
| 223 | event: "app:activity", |
| 224 | props, |
| 225 | }, |
| 226 | { noresponse: true } |
| 227 | ); |
no test coverage detected