@blunking/codexlink 0.1.1 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,164 +1,299 @@
1
1
  param(
2
- [string]$Profile = "default"
2
+ [string]$Profile = "default"
3
+ )
4
+
5
+ $ErrorActionPreference = "Stop"
6
+
7
+ function Try-ReadJson {
8
+ param([string]$Path)
9
+ if (-not (Test-Path $Path)) { return $null }
10
+ try { return Get-Content -Raw -Path $Path | ConvertFrom-Json } catch { return $null }
11
+ }
12
+
13
+ function Read-DotEnvFile {
14
+ param([string]$Path)
15
+ $values = @{}
16
+ if (-not (Test-Path $Path)) { return $values }
17
+ foreach ($line in (Get-Content -Path $Path)) {
18
+ if (-not $line) { continue }
19
+ if ($line.Trim().StartsWith("#")) { continue }
20
+ $parts = $line -split "=", 2
21
+ if ($parts.Count -ne 2) { continue }
22
+ $values[$parts[0].Trim()] = $parts[1]
23
+ }
24
+ return $values
25
+ }
26
+
27
+ function Test-PidAlive {
28
+ param([int]$ProcId)
29
+ if ($ProcId -le 0) { return $false }
30
+ return $null -ne (Get-Process -Id $ProcId -ErrorAction SilentlyContinue)
31
+ }
32
+
33
+ function Normalize-Preview {
34
+ param([string]$Value, [int]$MaxLength = 72)
35
+ $text = [string]$Value
36
+ $text = $text -replace "\s+", " "
37
+ $text = $text.Trim()
38
+ if (-not $text) { return "" }
39
+ if ($text.Length -le $MaxLength) { return $text }
40
+ return ($text.Substring(0, [Math]::Max(0, $MaxLength - 3)).TrimEnd() + "...")
41
+ }
42
+
43
+ function Get-IsoAgeMs {
44
+ param([string]$IsoString)
45
+ if (-not $IsoString) { return [double]::PositiveInfinity }
46
+ try {
47
+ $parsed = [DateTimeOffset]::Parse($IsoString)
48
+ return [Math]::Max(0, ([DateTimeOffset]::UtcNow - $parsed.ToUniversalTime()).TotalMilliseconds)
49
+ } catch {
50
+ return [double]::PositiveInfinity
51
+ }
52
+ }
53
+
54
+ function Resolve-ConfiguredPath {
55
+ param([string]$Value, [string]$RuntimeRoot)
56
+ if (-not $Value) { return "" }
57
+ $expanded = [Environment]::ExpandEnvironmentVariables($Value)
58
+ if ([System.IO.Path]::IsPathRooted($expanded)) { return $expanded }
59
+ return [System.IO.Path]::GetFullPath((Join-Path $RuntimeRoot $expanded))
60
+ }
61
+
62
+ function Get-TelegramPluginRoot {
63
+ param([string]$RuntimeRoot)
64
+
65
+ $candidates = @()
66
+ if ($env:BLUN_CODEX_TELEGRAM_PLUGIN_ROOT) {
67
+ $candidates += $env:BLUN_CODEX_TELEGRAM_PLUGIN_ROOT
68
+ }
69
+ $candidates += (Join-Path $RuntimeRoot "telegram-plugin")
70
+
71
+ foreach ($candidate in $candidates) {
72
+ if (-not $candidate) { continue }
73
+ if ((Test-Path (Join-Path $candidate "app-server-cli.js")) -and (Test-Path (Join-Path $candidate "sidecar-manager.js"))) {
74
+ return $candidate
75
+ }
76
+ }
77
+
78
+ return $null
79
+ }
80
+
81
+ function Get-ProfilePath {
82
+ param(
83
+ [string]$RuntimeRoot,
84
+ [string]$ProfileName
85
+ )
86
+
87
+ $normalized = [string]$ProfileName
88
+ if (-not $normalized) { $normalized = "" }
89
+ $normalized = $normalized.ToLower()
90
+ $candidates = @()
91
+ if ($env:BLUN_CODEX_PROFILE_ROOT) {
92
+ $candidates += (Join-Path $env:BLUN_CODEX_PROFILE_ROOT ($normalized + ".json"))
93
+ }
94
+ $candidates += (Join-Path $env:USERPROFILE (".codex\\profiles\\codexlink\\" + $normalized + ".json"))
95
+ $candidates += (Join-Path $RuntimeRoot ("profiles\\" + $normalized + ".json"))
96
+
97
+ foreach ($candidate in $candidates) {
98
+ if ($candidate -and (Test-Path $candidate)) {
99
+ return $candidate
100
+ }
101
+ }
102
+
103
+ return $candidates[-1]
104
+ }
105
+
106
+ $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
107
+ $profilePath = Get-ProfilePath -RuntimeRoot $runtimeRoot -ProfileName $Profile
108
+ $profileJson = Try-ReadJson -Path $profilePath
109
+ $profileAgent = if ($profileJson -and $profileJson.agent_name) { [string]$profileJson.agent_name } else { $Profile.ToLower() }
110
+ $runtimeDir = Join-Path $env:USERPROFILE (".codex\\runtimes\\" + $profileAgent)
111
+ $stateDir = if ($profileJson -and $profileJson.telegram -and $profileJson.telegram.state_dir) {
112
+ Resolve-ConfiguredPath -Value ([string]$profileJson.telegram.state_dir) -RuntimeRoot $runtimeRoot
113
+ } else {
114
+ Join-Path $env:USERPROFILE (".codex\\channels\\telegram-" + $profileAgent)
115
+ }
116
+ $currentRuntime = Try-ReadJson -Path (Join-Path $runtimeDir "current-remote-runtime.json")
117
+ $state = Try-ReadJson -Path (Join-Path $stateDir "state.json")
118
+ $envFile = Read-DotEnvFile -Path (Join-Path $stateDir ".env")
119
+ $loadedThreads = @()
120
+ $ambientQueueTtlMs = if ($envFile["BLUN_TELEGRAM_AMBIENT_QUEUE_TTL_MS"]) { [int]$envFile["BLUN_TELEGRAM_AMBIENT_QUEUE_TTL_MS"] } else { 600000 }
121
+ $queue = @($state.queue)
122
+ $staleAmbientQueued = @($queue | Where-Object {
123
+ $_.status -eq "queued" -and
124
+ [string]$_.relevance -eq "ambient" -and
125
+ (Get-IsoAgeMs -IsoString ([string]$_.ts)) -ge $ambientQueueTtlMs
126
+ })
127
+ $queued = @($queue | Where-Object {
128
+ if ($_.status -ne "queued") { return $false }
129
+ if ([string]$_.relevance -eq "ambient" -and (Get-IsoAgeMs -IsoString ([string]$_.ts)) -ge $ambientQueueTtlMs) { return $false }
130
+ return $true
131
+ })
132
+ $directQueued = @($queued | Where-Object { @("direct", "lane") -contains [string]$_.relevance })
133
+ $ambientQueued = @($queued | Where-Object { [string]$_.relevance -eq "ambient" })
134
+ $escalationQueued = @($queued | Where-Object { [string]$_.relevance -eq "escalation" })
135
+ $submitted = @($queue | Where-Object { $_.status -eq "submitted" })
136
+ $delivered = @($queue | Where-Object { $_.status -eq "delivered" })
137
+ $errors = @($queue | Where-Object { $_.status -eq "error" })
138
+ $pendingReplies = @($state.pendingReplies | Where-Object { -not $_.sentAt -and @("error", "expired", "ignored_bot", "suppressed_ack", "superseded", "sent", "stale_thread") -notcontains $_.status })
139
+ $expiredPendingReplies = @($state.pendingReplies | Where-Object { $_.status -eq "expired" })
140
+ $pollerPid = if (Test-Path (Join-Path $stateDir "poller.pid")) { (Get-Content -Raw (Join-Path $stateDir "poller.pid")).Trim() } else { $null }
141
+ $dispatcherPid = if (Test-Path (Join-Path $stateDir "dispatcher.pid")) { (Get-Content -Raw (Join-Path $stateDir "dispatcher.pid")).Trim() } else { $null }
142
+ $responderPid = if (Test-Path (Join-Path $stateDir "responder.pid")) { (Get-Content -Raw (Join-Path $stateDir "responder.pid")).Trim() } else { $null }
143
+ $stateThreadId = if ($state.currentThreadId) { [string]$state.currentThreadId } else { "" }
144
+ $runtimeThreadId = if ($currentRuntime -and $currentRuntime.thread_id) { [string]$currentRuntime.thread_id } else { "" }
145
+ $telegramPluginRoot = Get-TelegramPluginRoot -RuntimeRoot $runtimeRoot
146
+ $dispatchMode = if ($envFile["BLUN_TELEGRAM_DISPATCH_MODE"]) { [string]$envFile["BLUN_TELEGRAM_DISPATCH_MODE"] } else { "deferred" }
147
+ $idleCooldownMs = if ($envFile["BLUN_TELEGRAM_IDLE_COOLDOWN_MS"]) { [int]$envFile["BLUN_TELEGRAM_IDLE_COOLDOWN_MS"] } else { 15000 }
148
+ $eligibleQueued = if ($dispatchMode -eq "legacy") {
149
+ @($queued)
150
+ } else {
151
+ @($queued | Where-Object {
152
+ [string]$_.chatType -eq "private" -or @("direct", "lane", "escalation") -contains [string]$_.relevance
153
+ })
154
+ }
155
+ $nextQueued = @(
156
+ $eligibleQueued |
157
+ Sort-Object `
158
+ @{ Expression = {
159
+ if ([string]$_.relevance -eq "escalation") { 0 }
160
+ elseif ([string]$_.chatType -eq "private" -or @("direct", "lane") -contains [string]$_.relevance) { 1 }
161
+ else { 2 }
162
+ }
163
+ },
164
+ @{ Expression = { [string]$_.ts } },
165
+ @{ Expression = { [int]$_.messageId } } |
166
+ Select-Object -First 1
3
167
  )
4
-
5
- $ErrorActionPreference = "Stop"
6
-
7
- function Try-ReadJson {
8
- param([string]$Path)
9
- if (-not (Test-Path $Path)) { return $null }
10
- try { return Get-Content -Raw -Path $Path | ConvertFrom-Json } catch { return $null }
11
- }
12
-
13
- function Read-DotEnvFile {
14
- param([string]$Path)
15
- $values = @{}
16
- if (-not (Test-Path $Path)) { return $values }
17
- foreach ($line in (Get-Content -Path $Path)) {
18
- if (-not $line) { continue }
19
- if ($line.Trim().StartsWith("#")) { continue }
20
- $parts = $line -split "=", 2
21
- if ($parts.Count -ne 2) { continue }
22
- $values[$parts[0].Trim()] = $parts[1]
23
- }
24
- return $values
25
- }
26
-
27
- function Test-PidAlive {
28
- param([int]$ProcId)
29
- if ($ProcId -le 0) { return $false }
30
- return $null -ne (Get-Process -Id $ProcId -ErrorAction SilentlyContinue)
31
- }
32
-
33
- function Resolve-ConfiguredPath {
34
- param([string]$Value, [string]$RuntimeRoot)
35
- if (-not $Value) { return "" }
36
- $expanded = [Environment]::ExpandEnvironmentVariables($Value)
37
- if ([System.IO.Path]::IsPathRooted($expanded)) { return $expanded }
38
- return [System.IO.Path]::GetFullPath((Join-Path $RuntimeRoot $expanded))
39
- }
40
-
41
- function Get-TelegramPluginRoot {
42
- param([string]$RuntimeRoot)
43
-
44
- $candidates = @()
45
- if ($env:BLUN_CODEX_TELEGRAM_PLUGIN_ROOT) {
46
- $candidates += $env:BLUN_CODEX_TELEGRAM_PLUGIN_ROOT
47
- }
48
- $candidates += (Join-Path $RuntimeRoot "telegram-plugin")
49
-
50
- foreach ($candidate in $candidates) {
51
- if (-not $candidate) { continue }
52
- if ((Test-Path (Join-Path $candidate "app-server-cli.js")) -and (Test-Path (Join-Path $candidate "sidecar-manager.js"))) {
53
- return $candidate
54
- }
55
- }
56
-
57
- return $null
58
- }
59
-
60
- $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
61
- $profilePath = Join-Path $runtimeRoot ("profiles\" + $Profile.ToLower() + ".json")
62
- $profileJson = Try-ReadJson -Path $profilePath
63
- $profileAgent = if ($profileJson -and $profileJson.agent_name) { [string]$profileJson.agent_name } else { $Profile.ToLower() }
64
- $runtimeDir = Join-Path $env:USERPROFILE (".codex\\runtimes\\" + $profileAgent)
65
- $stateDir = if ($profileJson -and $profileJson.telegram -and $profileJson.telegram.state_dir) {
66
- Resolve-ConfiguredPath -Value ([string]$profileJson.telegram.state_dir) -RuntimeRoot $runtimeRoot
168
+ $nextPendingReply = @(
169
+ $pendingReplies |
170
+ Sort-Object `
171
+ @{ Expression = { [string]$_.createdAt } },
172
+ @{ Expression = { [int]$_.messageId } } |
173
+ Select-Object -First 1
174
+ )
175
+ $waitReason = if ($pendingReplies.Count -gt 0) {
176
+ "wartet auf Antwort"
177
+ } elseif ($queued.Count -eq 0) {
178
+ $null
179
+ } elseif ($state.lastInjectAt -and (Get-IsoAgeMs -IsoString ([string]$state.lastInjectAt)) -lt $idleCooldownMs) {
180
+ "wartet auf Ruhe"
67
181
  } else {
68
- Join-Path $env:USERPROFILE (".codex\\channels\\telegram-" + $profileAgent)
69
- }
70
- $currentRuntime = Try-ReadJson -Path (Join-Path $runtimeDir "current-remote-runtime.json")
71
- $state = Try-ReadJson -Path (Join-Path $stateDir "state.json")
72
- $envFile = Read-DotEnvFile -Path (Join-Path $stateDir ".env")
73
- $loadedThreads = @()
74
- $queue = @($state.queue)
75
- $queued = @($queue | Where-Object { $_.status -eq "queued" })
76
- $ambient = @($queued | Where-Object { $_.relevance -eq "ambient" })
77
- $submitted = @($queue | Where-Object { $_.status -eq "submitted" })
78
- $delivered = @($queue | Where-Object { $_.status -eq "delivered" })
79
- $errors = @($queue | Where-Object { $_.status -eq "error" })
80
- $pendingReplies = @($state.pendingReplies | Where-Object { -not $_.sentAt -and $_.status -ne "error" })
81
- $pollerPid = if (Test-Path (Join-Path $stateDir "poller.pid")) { (Get-Content -Raw (Join-Path $stateDir "poller.pid")).Trim() } else { $null }
82
- $dispatcherPid = if (Test-Path (Join-Path $stateDir "dispatcher.pid")) { (Get-Content -Raw (Join-Path $stateDir "dispatcher.pid")).Trim() } else { $null }
83
- $responderPid = if (Test-Path (Join-Path $stateDir "responder.pid")) { (Get-Content -Raw (Join-Path $stateDir "responder.pid")).Trim() } else { $null }
84
- $stateThreadId = if ($state.currentThreadId) { [string]$state.currentThreadId } else { "" }
85
- $telegramPluginRoot = Get-TelegramPluginRoot -RuntimeRoot $runtimeRoot
86
-
87
- if ($currentRuntime) {
88
- if ($stateThreadId) {
89
- if ($currentRuntime.PSObject.Properties.Name.Contains("thread_id")) {
90
- $currentRuntime.thread_id = $stateThreadId
91
- } else {
92
- $currentRuntime | Add-Member -NotePropertyName "thread_id" -NotePropertyValue $stateThreadId
93
- }
94
- }
95
- if ($pollerPid) {
96
- if ($currentRuntime.PSObject.Properties.Name.Contains("poller_pid")) {
97
- $currentRuntime.poller_pid = $pollerPid
98
- } else {
99
- $currentRuntime | Add-Member -NotePropertyName "poller_pid" -NotePropertyValue $pollerPid
100
- }
101
- }
102
- if ($dispatcherPid) {
103
- if ($currentRuntime.PSObject.Properties.Name.Contains("dispatcher_pid")) {
104
- $currentRuntime.dispatcher_pid = $dispatcherPid
105
- } else {
106
- $currentRuntime | Add-Member -NotePropertyName "dispatcher_pid" -NotePropertyValue $dispatcherPid
107
- }
182
+ "wartet in Queue"
183
+ }
184
+
185
+ if ($currentRuntime) {
186
+ if ($stateThreadId) {
187
+ if ($currentRuntime.PSObject.Properties.Name.Contains("thread_id")) {
188
+ $currentRuntime.thread_id = $stateThreadId
189
+ } else {
190
+ $currentRuntime | Add-Member -NotePropertyName "thread_id" -NotePropertyValue $stateThreadId
191
+ }
192
+ }
193
+ if ($pollerPid) {
194
+ if ($currentRuntime.PSObject.Properties.Name.Contains("poller_pid")) {
195
+ $currentRuntime.poller_pid = $pollerPid
196
+ } else {
197
+ $currentRuntime | Add-Member -NotePropertyName "poller_pid" -NotePropertyValue $pollerPid
198
+ }
199
+ }
200
+ if ($dispatcherPid) {
201
+ if ($currentRuntime.PSObject.Properties.Name.Contains("dispatcher_pid")) {
202
+ $currentRuntime.dispatcher_pid = $dispatcherPid
203
+ } else {
204
+ $currentRuntime | Add-Member -NotePropertyName "dispatcher_pid" -NotePropertyValue $dispatcherPid
205
+ }
206
+ }
207
+ if ($responderPid) {
208
+ if ($currentRuntime.PSObject.Properties.Name.Contains("responder_pid")) {
209
+ $currentRuntime.responder_pid = $responderPid
210
+ } else {
211
+ $currentRuntime | Add-Member -NotePropertyName "responder_pid" -NotePropertyValue $responderPid
212
+ }
213
+ }
214
+ }
215
+
216
+ if ($envFile["BLUN_TELEGRAM_APP_SERVER_WS_URL"] -and $telegramPluginRoot) {
217
+ try {
218
+ $bootstrapScript = Join-Path $telegramPluginRoot "app-server-cli.js"
219
+ $loaded = & node $bootstrapScript "list-loaded" "--ws-url" $envFile["BLUN_TELEGRAM_APP_SERVER_WS_URL"] | ConvertFrom-Json
220
+ $loadedThreads = @($loaded.data)
221
+ } catch {
222
+ $loadedThreads = @()
223
+ }
224
+ }
225
+
226
+ $result = [ordered]@{
227
+ profile = $profileAgent
228
+ state_dir = $stateDir
229
+ plugin_root = $telegramPluginRoot
230
+ active_ws = $envFile["BLUN_TELEGRAM_APP_SERVER_WS_URL"]
231
+ dispatch_mode = $dispatchMode
232
+ idle_cooldown_ms = $idleCooldownMs
233
+ ambient_queue_ttl_ms = $ambientQueueTtlMs
234
+ pending_reply_timeout_ms = $(if ($envFile["BLUN_TELEGRAM_PENDING_REPLY_TIMEOUT_MS"]) { $envFile["BLUN_TELEGRAM_PENDING_REPLY_TIMEOUT_MS"] } else { "1800000" })
235
+ env_thread_id = $envFile["BLUN_TELEGRAM_THREAD_ID"]
236
+ runtime_thread_id = $runtimeThreadId
237
+ state_thread_id = $stateThreadId
238
+ active_thread_id = if ($runtimeThreadId) { $runtimeThreadId } elseif ($envFile["BLUN_TELEGRAM_THREAD_ID"]) { $envFile["BLUN_TELEGRAM_THREAD_ID"] } else { $stateThreadId }
239
+ frontend_owner_pid = $(if ($currentRuntime -and $currentRuntime.frontend_host_pid) { [string]$currentRuntime.frontend_host_pid } else { "" })
240
+ queue_notifier_pid = $(if ($currentRuntime -and $currentRuntime.queue_notifier_pid) { [string]$currentRuntime.queue_notifier_pid } else { "" })
241
+ current_runtime = $currentRuntime
242
+ loaded_threads = $loadedThreads
243
+ queue_depth = $queued.Count
244
+ visible_waiting_depth = ($queued.Count + $pendingReplies.Count)
245
+ direct_queue_depth = $directQueued.Count
246
+ ambient_queue_depth = $ambientQueued.Count
247
+ escalation_queue_depth = $escalationQueued.Count
248
+ parked_queue_depth = $staleAmbientQueued.Count
249
+ submitted_depth = $submitted.Count
250
+ pending_reply_depth = $pendingReplies.Count
251
+ expired_pending_reply_depth = $expiredPendingReplies.Count
252
+ delivered_count = $delivered.Count
253
+ error_count = $errors.Count
254
+ history_count = $queue.Count
255
+ last_inbound = $state.lastInbound
256
+ last_outbound = $state.lastOutbound
257
+ poller_pid = $pollerPid
258
+ dispatcher_pid = $dispatcherPid
259
+ responder_pid = $responderPid
260
+ next_queued = if ($nextQueued.Count -gt 0) {
261
+ [ordered]@{
262
+ chat_id = $nextQueued[0].chatId
263
+ message_id = $nextQueued[0].messageId
264
+ relevance = $nextQueued[0].relevance
265
+ preview = Normalize-Preview -Value ([string]$nextQueued[0].text)
266
+ }
267
+ } else {
268
+ $null
108
269
  }
109
- if ($responderPid) {
110
- if ($currentRuntime.PSObject.Properties.Name.Contains("responder_pid")) {
111
- $currentRuntime.responder_pid = $responderPid
112
- } else {
113
- $currentRuntime | Add-Member -NotePropertyName "responder_pid" -NotePropertyValue $responderPid
270
+ pending_message = if ($nextPendingReply.Count -gt 0) {
271
+ [ordered]@{
272
+ chat_id = $nextPendingReply[0].chatId
273
+ message_id = $nextPendingReply[0].messageId
274
+ relevance = $nextPendingReply[0].relevance
275
+ preview = Normalize-Preview -Value ([string]$nextPendingReply[0].sourceText)
114
276
  }
277
+ } else {
278
+ $null
115
279
  }
280
+ wait_reason = $waitReason
116
281
  }
117
-
118
- if ($envFile["BLUN_TELEGRAM_APP_SERVER_WS_URL"] -and $telegramPluginRoot) {
119
- try {
120
- $bootstrapScript = Join-Path $telegramPluginRoot "app-server-cli.js"
121
- $loaded = & node $bootstrapScript "list-loaded" "--ws-url" $envFile["BLUN_TELEGRAM_APP_SERVER_WS_URL"] | ConvertFrom-Json
122
- $loadedThreads = @($loaded.data)
123
- } catch {
124
- $loadedThreads = @()
125
- }
126
- }
127
-
128
- $result = [ordered]@{
129
- profile = $profileAgent
130
- state_dir = $stateDir
131
- plugin_root = $telegramPluginRoot
132
- active_ws = $envFile["BLUN_TELEGRAM_APP_SERVER_WS_URL"]
133
- dispatch_mode = $(if ($envFile["BLUN_TELEGRAM_DISPATCH_MODE"]) { $envFile["BLUN_TELEGRAM_DISPATCH_MODE"] } else { "deferred" })
134
- idle_cooldown_ms = $(if ($envFile["BLUN_TELEGRAM_IDLE_COOLDOWN_MS"]) { $envFile["BLUN_TELEGRAM_IDLE_COOLDOWN_MS"] } else { "15000" })
135
- env_thread_id = $envFile["BLUN_TELEGRAM_THREAD_ID"]
136
- state_thread_id = $stateThreadId
137
- active_thread_id = if ($stateThreadId) { $stateThreadId } else { $envFile["BLUN_TELEGRAM_THREAD_ID"] }
138
- current_runtime = $currentRuntime
139
- loaded_threads = $loadedThreads
140
- queue_depth = $queued.Count
141
- ambient_queue_depth = $ambient.Count
142
- submitted_depth = $submitted.Count
143
- pending_reply_depth = $pendingReplies.Count
144
- delivered_count = $delivered.Count
145
- error_count = $errors.Count
146
- history_count = $queue.Count
147
- last_inbound = $state.lastInbound
148
- last_outbound = $state.lastOutbound
149
- poller_pid = $pollerPid
150
- dispatcher_pid = $dispatcherPid
151
- responder_pid = $responderPid
152
- }
153
-
154
- if ($result.poller_pid) {
155
- $result["poller_alive"] = Test-PidAlive -ProcId ([int]$result.poller_pid)
156
- }
157
- if ($result.dispatcher_pid) {
158
- $result["dispatcher_alive"] = Test-PidAlive -ProcId ([int]$result.dispatcher_pid)
159
- }
160
- if ($result.responder_pid) {
161
- $result["responder_alive"] = Test-PidAlive -ProcId ([int]$result.responder_pid)
162
- }
163
-
164
- $result | ConvertTo-Json -Depth 8
282
+
283
+ if ($result.poller_pid) {
284
+ $result["poller_alive"] = Test-PidAlive -ProcId ([int]$result.poller_pid)
285
+ }
286
+ if ($result.dispatcher_pid) {
287
+ $result["dispatcher_alive"] = Test-PidAlive -ProcId ([int]$result.dispatcher_pid)
288
+ }
289
+ if ($result.responder_pid) {
290
+ $result["responder_alive"] = Test-PidAlive -ProcId ([int]$result.responder_pid)
291
+ }
292
+ if ($result.frontend_owner_pid) {
293
+ $result["frontend_owner_alive"] = Test-PidAlive -ProcId ([int]$result.frontend_owner_pid)
294
+ }
295
+ if ($result.queue_notifier_pid) {
296
+ $result["queue_notifier_alive"] = Test-PidAlive -ProcId ([int]$result.queue_notifier_pid)
297
+ }
298
+
299
+ $result | ConvertTo-Json -Depth 8