@trillboards/edge-sdk 0.2.14 → 0.2.15
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.
- package/deploy/windows/README.md +7 -0
- package/deploy/windows/build-windows.ps1 +4 -0
- package/deploy/windows/ensure-sensing.ps1 +58 -0
- package/deploy/windows/install-update.ps1 +32 -6
- package/deploy/windows/stop-existing.ps1 +51 -1
- package/deploy/windows/trillboards-edge.cmd +8 -2
- package/deploy/windows/trillboards-hidden-run.vbs +47 -0
- package/deploy/windows/trillboards-setup.ps1 +25 -0
- package/dist/AudienceAnalyzeClient.d.ts +16 -2
- package/dist/AudienceAnalyzeClient.d.ts.map +1 -1
- package/dist/AudienceAnalyzeClient.js.map +1 -1
- package/dist/CloudSensingManager.d.ts +149 -5
- package/dist/CloudSensingManager.d.ts.map +1 -1
- package/dist/CloudSensingManager.js +365 -23
- package/dist/CloudSensingManager.js.map +1 -1
- package/dist/EdgeAgent.js +1 -1
- package/dist/SceneChangeDetector.d.ts +39 -3
- package/dist/SceneChangeDetector.d.ts.map +1 -1
- package/dist/SceneChangeDetector.js +84 -16
- package/dist/SceneChangeDetector.js.map +1 -1
- package/dist/VlmAdmissionGate.d.ts +14 -0
- package/dist/VlmAdmissionGate.d.ts.map +1 -1
- package/dist/VlmAdmissionGate.js +14 -0
- package/dist/VlmAdmissionGate.js.map +1 -1
- package/dist/VlmCandidateBuffer.d.ts +236 -0
- package/dist/VlmCandidateBuffer.d.ts.map +1 -0
- package/dist/VlmCandidateBuffer.js +347 -0
- package/dist/VlmCandidateBuffer.js.map +1 -0
- package/dist/config.d.ts +46 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/diagnose.d.ts +1 -1
- package/dist/diagnose.js +1 -1
- package/dist/discovery.d.ts +15 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +65 -0
- package/dist/discovery.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/recorderRanking.d.ts +71 -0
- package/dist/recorderRanking.d.ts.map +1 -0
- package/dist/recorderRanking.js +230 -0
- package/dist/recorderRanking.js.map +1 -0
- package/dist/sensingRunMode.d.ts.map +1 -1
- package/dist/sensingRunMode.js +40 -0
- package/dist/sensingRunMode.js.map +1 -1
- package/dist/setupMode.d.ts +9 -0
- package/dist/setupMode.d.ts.map +1 -1
- package/dist/setupMode.js +23 -1
- package/dist/setupMode.js.map +1 -1
- package/package.json +1 -1
package/deploy/windows/README.md
CHANGED
|
@@ -16,7 +16,14 @@ bin\trillboards-edge.cmd launcher (PATH=bin first; node lib\...\cli.js)
|
|
|
16
16
|
bin\trillboards-setup.vbs no-console launcher for the customer setup app
|
|
17
17
|
bin\trillboards-setup.ps1 native Windows Forms customer setup window
|
|
18
18
|
bin\trillboards-pair.cmd hidden setup engine used by the setup window
|
|
19
|
+
bin\trillboards-hidden-run.vbs runs a helper with NO console (never use cmd's
|
|
20
|
+
`start`: it allocates a visible console before the
|
|
21
|
+
child can hide itself)
|
|
19
22
|
bin\register-task.ps1 registers the logon Scheduled Task
|
|
23
|
+
bin\stop-existing.ps1 DISABLES the task, stops this install's processes,
|
|
24
|
+
and proves bin\node.exe is unlocked before a swap
|
|
25
|
+
bin\ensure-sensing.ps1 re-arms the task (register/enable/start) — closing
|
|
26
|
+
the setup window must never stop sensing
|
|
20
27
|
lib\edge-sdk\dist\cli.js the connector CLI
|
|
21
28
|
lib\node_modules\... runtime subset (NO onnxruntime/sharp/sqlite; LiteRT-LM
|
|
22
29
|
provides the on-device VLM outside Node)
|
|
@@ -173,6 +173,10 @@ Copy-Item -Force "$Here\trillboards-pair.cmd" "$Payload\bin\trillboards-pair.cmd
|
|
|
173
173
|
Copy-Item -Force "$Here\trillboards-setup.ps1" "$Payload\bin\trillboards-setup.ps1"
|
|
174
174
|
Copy-Item -Force "$Here\trillboards-setup.vbs" "$Payload\bin\trillboards-setup.vbs"
|
|
175
175
|
Copy-Item -Force "$Here\trillboards-edge-task.vbs" "$Payload\bin\trillboards-edge-task.vbs"
|
|
176
|
+
# Hidden fire-and-forget host: the launcher's local-AI repair goes through this
|
|
177
|
+
# instead of cmd's `start`, which would allocate a visible console.
|
|
178
|
+
Copy-Item -Force "$Here\trillboards-hidden-run.vbs" "$Payload\bin\trillboards-hidden-run.vbs"
|
|
179
|
+
Copy-Item -Force "$Here\ensure-sensing.ps1" "$Payload\bin\ensure-sensing.ps1"
|
|
176
180
|
Copy-Item -Force "$Here\run-connector.ps1" "$Payload\bin\run-connector.ps1"
|
|
177
181
|
Copy-Item -Force "$Here\register-task.ps1" "$Payload\bin\register-task.ps1"
|
|
178
182
|
Copy-Item -Force "$Here\stop-existing.ps1" "$Payload\bin\stop-existing.ps1"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<#
|
|
2
|
+
ensure-sensing.ps1 -- make the background connector registered, ENABLED and
|
|
3
|
+
running. Idempotent, windowless, and safe to call at any moment.
|
|
4
|
+
|
|
5
|
+
This exists because of one field rule: a customer closing something they CAN
|
|
6
|
+
see must never be what stops sensing. The setup wizard is the only visible
|
|
7
|
+
Trillboards window, and closing it taskkill /T /F's the pairing helper tree --
|
|
8
|
+
which may be sitting between "config written" and "scheduled task started".
|
|
9
|
+
It is also the recovery for a disabled task: stop-existing.ps1 disables
|
|
10
|
+
TrillboardsEdge during an upgrade, and a DISABLED task suppresses the AtLogOn
|
|
11
|
+
trigger, so a reboot would not bring sensing back on its own.
|
|
12
|
+
#>
|
|
13
|
+
[CmdletBinding()]
|
|
14
|
+
param(
|
|
15
|
+
[Parameter(Mandatory = $true)][string]$InstallDir
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
$ErrorActionPreference = "Stop"
|
|
19
|
+
$TaskName = "TrillboardsEdge"
|
|
20
|
+
|
|
21
|
+
# Before pairing there is nothing to run: starting the task without a config
|
|
22
|
+
# just crash-loops it against the RestartCount budget.
|
|
23
|
+
if (-not (Test-Path (Join-Path $InstallDir "trillboards.config.json"))) {
|
|
24
|
+
Write-Host "No paired configuration yet - nothing to resume."
|
|
25
|
+
exit 0
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
$task = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
|
29
|
+
if (-not $task) {
|
|
30
|
+
$register = Join-Path $InstallDir "bin\register-task.ps1"
|
|
31
|
+
if (-not (Test-Path $register)) {
|
|
32
|
+
Write-Error "Cannot resume sensing: $register is missing."
|
|
33
|
+
exit 1
|
|
34
|
+
}
|
|
35
|
+
& $register -InstallDir $InstallDir | Out-Null
|
|
36
|
+
$task = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
|
37
|
+
if (-not $task) {
|
|
38
|
+
Write-Error "Cannot resume sensing: scheduled task '$TaskName' did not register."
|
|
39
|
+
exit 1
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if ($task.State -eq 'Disabled') {
|
|
44
|
+
Enable-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue | Out-Null
|
|
45
|
+
$task = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if ($task -and $task.State -ne 'Running') {
|
|
49
|
+
Start-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
$final = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
|
53
|
+
if (-not $final -or $final.State -eq 'Disabled') {
|
|
54
|
+
Write-Error "Scheduled task '$TaskName' is not runnable after resume."
|
|
55
|
+
exit 1
|
|
56
|
+
}
|
|
57
|
+
Write-Host "Background sensing is registered, enabled and scheduled (state: $($final.State))."
|
|
58
|
+
exit 0
|
|
@@ -43,6 +43,31 @@ function Register-Connector([string]$Root) {
|
|
|
43
43
|
if ($LASTEXITCODE -ne 0) { throw "Scheduled-task registration failed." }
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
function Assert-ConnectorScheduled {
|
|
47
|
+
# stop-existing.ps1 DISABLES the task so restart-on-failure cannot relaunch
|
|
48
|
+
# node.exe mid-swap. A disabled task suppresses the AtLogOn trigger too, so
|
|
49
|
+
# leaving it disabled would mean sensing never comes back - not even after a
|
|
50
|
+
# reboot. Re-registration should have re-enabled it; verify rather than trust.
|
|
51
|
+
$task = Get-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction SilentlyContinue
|
|
52
|
+
if (-not $task) { throw "Scheduled task 'TrillboardsEdge' is missing after registration." }
|
|
53
|
+
if ($task.State -eq 'Disabled') {
|
|
54
|
+
Enable-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction SilentlyContinue | Out-Null
|
|
55
|
+
$task = Get-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction SilentlyContinue
|
|
56
|
+
if (-not $task -or $task.State -eq 'Disabled') {
|
|
57
|
+
throw "Scheduled task 'TrillboardsEdge' stayed disabled - sensing would not restart at logon."
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function Restore-ConnectorSchedule {
|
|
63
|
+
# Failure path. Whatever went wrong, the customer must NOT be left with a
|
|
64
|
+
# permanently disabled connector: that is a silent, reboot-proof outage.
|
|
65
|
+
Enable-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction SilentlyContinue | Out-Null
|
|
66
|
+
if (Test-Path (Join-Path $InstallDir "trillboards.config.json")) {
|
|
67
|
+
Start-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction SilentlyContinue
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
46
71
|
try {
|
|
47
72
|
Assert-ConnectorVersion $StagingDir
|
|
48
73
|
& (Join-Path $StagingDir "bin\stop-existing.ps1") -InstallDir $InstallDir
|
|
@@ -66,6 +91,7 @@ try {
|
|
|
66
91
|
|
|
67
92
|
Assert-ConnectorVersion $InstallDir
|
|
68
93
|
Register-Connector $InstallDir
|
|
94
|
+
Assert-ConnectorScheduled
|
|
69
95
|
if (Test-Path (Join-Path $InstallDir "trillboards.config.json")) {
|
|
70
96
|
Start-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction Stop
|
|
71
97
|
}
|
|
@@ -90,12 +116,12 @@ try {
|
|
|
90
116
|
}
|
|
91
117
|
}
|
|
92
118
|
if ($movedPrevious.Count -gt 0) {
|
|
93
|
-
try {
|
|
94
|
-
Register-Connector $InstallDir
|
|
95
|
-
if (Test-Path (Join-Path $InstallDir "trillboards.config.json")) {
|
|
96
|
-
Start-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction SilentlyContinue
|
|
97
|
-
}
|
|
98
|
-
} catch {}
|
|
119
|
+
try { Register-Connector $InstallDir } catch {}
|
|
99
120
|
}
|
|
121
|
+
# UNCONDITIONAL. When the failure happened before anything moved there is no
|
|
122
|
+
# re-registration to re-enable the task, and stop-existing.ps1 already
|
|
123
|
+
# disabled it - so this is the only thing standing between a failed upgrade
|
|
124
|
+
# and a connector that never runs again.
|
|
125
|
+
try { Restore-ConnectorSchedule } catch {}
|
|
100
126
|
throw "Trillboards Edge update failed and the previous version was restored: $($failure.Exception.Message)"
|
|
101
127
|
}
|
|
@@ -12,16 +12,32 @@ $ErrorActionPreference = "Stop"
|
|
|
12
12
|
$root = [IO.Path]::GetFullPath($InstallDir).TrimEnd('\')
|
|
13
13
|
$rootPrefix = $root + '\'
|
|
14
14
|
|
|
15
|
+
# DISABLE BEFORE STOP. register-task.ps1 registers the task with
|
|
16
|
+
# `-RestartCount 99 -RestartInterval 1 minute`, so Stop-ScheduledTask ends the
|
|
17
|
+
# instance as a FAILURE and Task Scheduler relaunches node.exe about a minute
|
|
18
|
+
# later — right inside the installer's bin\ + lib\ move. That is the "reinstall
|
|
19
|
+
# hit a locked node.exe" the field test saw. Disabling suppresses the restart
|
|
20
|
+
# AND the AtLogOn trigger for the whole swap window; install-update.ps1 owns
|
|
21
|
+
# re-enabling it on every exit path, and the uninstaller deletes the task.
|
|
22
|
+
Disable-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction SilentlyContinue | Out-Null
|
|
15
23
|
Stop-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction SilentlyContinue
|
|
16
24
|
Start-Sleep -Milliseconds 750
|
|
17
25
|
|
|
18
26
|
function Get-TrillboardsEdgeProcesses {
|
|
27
|
+
# The process that actually holds bin\node.exe open is node.exe itself, and
|
|
28
|
+
# its command line names NONE of these scripts — it names the cli.js entry.
|
|
29
|
+
# Win32_Process.ExecutablePath is empty across a 32/64-bit boundary, and then
|
|
30
|
+
# the marker list is the only matcher left, so it has to cover the runtime.
|
|
19
31
|
$markers = @(
|
|
20
32
|
'trillboards-edge-task.vbs',
|
|
33
|
+
'trillboards-hidden-run.vbs',
|
|
21
34
|
'run-connector.ps1',
|
|
22
35
|
'trillboards-edge.cmd',
|
|
23
36
|
'trillboards-setup.ps1',
|
|
24
|
-
'trillboards-pair.cmd'
|
|
37
|
+
'trillboards-pair.cmd',
|
|
38
|
+
'setup-litertlm.ps1',
|
|
39
|
+
'cli.js',
|
|
40
|
+
'ffmpeg.exe'
|
|
25
41
|
)
|
|
26
42
|
|
|
27
43
|
@(Get-CimInstance Win32_Process -ErrorAction SilentlyContinue | Where-Object {
|
|
@@ -69,4 +85,38 @@ if ($remaining.Count -gt 0) {
|
|
|
69
85
|
throw "Could not stop the existing Trillboards connector processes: $ids"
|
|
70
86
|
}
|
|
71
87
|
|
|
88
|
+
function Assert-BinariesUnlocked {
|
|
89
|
+
# "No matching process" is NOT "the file is writable". A handle held by an
|
|
90
|
+
# AV scanner, an Explorer preview, or a process we could not attribute keeps
|
|
91
|
+
# bin\node.exe locked, and install-update.ps1 would then fail HALFWAY through
|
|
92
|
+
# moving bin\ and lib\. Prove writability before the installer commits.
|
|
93
|
+
param([string]$Root, [int]$TimeoutSeconds = 15)
|
|
94
|
+
|
|
95
|
+
$targets = @(
|
|
96
|
+
(Join-Path $Root 'bin\node.exe'),
|
|
97
|
+
(Join-Path $Root 'bin\ffmpeg.exe')
|
|
98
|
+
) | Where-Object { Test-Path -LiteralPath $_ }
|
|
99
|
+
if ($targets.Count -eq 0) { return }
|
|
100
|
+
|
|
101
|
+
$deadline = [DateTime]::UtcNow.AddSeconds($TimeoutSeconds)
|
|
102
|
+
foreach ($target in $targets) {
|
|
103
|
+
while ($true) {
|
|
104
|
+
$stream = $null
|
|
105
|
+
try {
|
|
106
|
+
$stream = [IO.File]::Open($target, [IO.FileMode]::Open, [IO.FileAccess]::ReadWrite, [IO.FileShare]::None)
|
|
107
|
+
break
|
|
108
|
+
} catch {
|
|
109
|
+
if ([DateTime]::UtcNow -ge $deadline) {
|
|
110
|
+
throw "A Trillboards connector binary is still locked by another process: $target"
|
|
111
|
+
}
|
|
112
|
+
Start-Sleep -Milliseconds 300
|
|
113
|
+
} finally {
|
|
114
|
+
if ($null -ne $stream) { $stream.Dispose() }
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
Assert-BinariesUnlocked -Root $root
|
|
121
|
+
|
|
72
122
|
Write-Host "Stopped existing Trillboards Edge processes."
|
|
@@ -19,12 +19,18 @@ if /I "%~1"=="auto-sense" (
|
|
|
19
19
|
if errorlevel 1 set "NEEDS_LOCAL_AI=1"
|
|
20
20
|
curl.exe --fail --silent --max-time 2 http://127.0.0.1:9379/v1/models >nul 2>&1
|
|
21
21
|
if errorlevel 1 set "NEEDS_LOCAL_AI=1"
|
|
22
|
+
REM Launch the repair through the wscript host, NOT `start`. cmd's `start`
|
|
23
|
+
REM allocates a NEW console for the child before PowerShell can hide itself,
|
|
24
|
+
REM so the customer saw a black window on exactly the reboot that needs a
|
|
25
|
+
REM repair. wscript.exe is GUI-subsystem and Run(...,0,False) creates the
|
|
26
|
+
REM process hidden from its first instruction.
|
|
22
27
|
if "!NEEDS_LOCAL_AI!"=="1" if exist "%BIN%setup-litertlm.ps1" (
|
|
23
28
|
set "SETUP_PROGRESS=%LOCALAPPDATA%\Trillboards\setup-progress.json"
|
|
29
|
+
set "HIDDEN_RUN=%WINDIR%\System32\wscript.exe"
|
|
24
30
|
if exist "!SETUP_PROGRESS!" (
|
|
25
|
-
|
|
31
|
+
"!HIDDEN_RUN!" "%BIN%trillboards-hidden-run.vbs" "powershell.exe" "-NoProfile" "-ExecutionPolicy" "Bypass" "-WindowStyle" "Hidden" "-File" "%BIN%setup-litertlm.ps1" "-RequireBundledModel" "-ProgressPath" "!SETUP_PROGRESS!"
|
|
26
32
|
) else (
|
|
27
|
-
|
|
33
|
+
"!HIDDEN_RUN!" "%BIN%trillboards-hidden-run.vbs" "powershell.exe" "-NoProfile" "-ExecutionPolicy" "Bypass" "-WindowStyle" "Hidden" "-File" "%BIN%setup-litertlm.ps1" "-RequireBundledModel"
|
|
28
34
|
)
|
|
29
35
|
)
|
|
30
36
|
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Option Explicit
|
|
2
|
+
|
|
3
|
+
' trillboards-hidden-run.vbs — run a command with NO console window, ever.
|
|
4
|
+
'
|
|
5
|
+
' cmd's `start "" prog.exe` allocates a NEW console (conhost) for the child
|
|
6
|
+
' BEFORE the child can hide itself, so `powershell.exe -WindowStyle Hidden`
|
|
7
|
+
' still flashes — and on a slow logon it is a black window the customer sees
|
|
8
|
+
' and closes. wscript.exe is a GUI-subsystem host: WScript.Shell.Run with
|
|
9
|
+
' window style 0 (SW_HIDE) creates the process with a hidden console from the
|
|
10
|
+
' very first instruction. This is the same mechanism trillboards-edge-task.vbs
|
|
11
|
+
' uses for the connector supervisor; this host is the fire-and-forget variant
|
|
12
|
+
' for helpers launched from a .cmd.
|
|
13
|
+
'
|
|
14
|
+
' Usage:
|
|
15
|
+
' wscript.exe "trillboards-hidden-run.vbs" <exe> [arg]...
|
|
16
|
+
' Every argument after <exe> is forwarded verbatim; arguments containing
|
|
17
|
+
' whitespace are re-quoted so paths like %LOCALAPPDATA%\Trillboards survive.
|
|
18
|
+
|
|
19
|
+
Dim shell, index, command, argument
|
|
20
|
+
|
|
21
|
+
If WScript.Arguments.Count < 1 Then
|
|
22
|
+
' Nothing to run. Exit quietly — a hidden helper must never pop a dialog.
|
|
23
|
+
WScript.Quit 2
|
|
24
|
+
End If
|
|
25
|
+
|
|
26
|
+
Set shell = CreateObject("WScript.Shell")
|
|
27
|
+
|
|
28
|
+
command = ""
|
|
29
|
+
For index = 0 To WScript.Arguments.Count - 1
|
|
30
|
+
argument = WScript.Arguments(index)
|
|
31
|
+
' Re-quote anything that is empty or contains whitespace. Arguments that are
|
|
32
|
+
' already quoted are left alone so callers can pass pre-quoted values.
|
|
33
|
+
If Len(argument) = 0 Then
|
|
34
|
+
argument = Chr(34) & Chr(34)
|
|
35
|
+
ElseIf InStr(argument, " ") > 0 Or InStr(argument, vbTab) > 0 Then
|
|
36
|
+
If Not (Left(argument, 1) = Chr(34) And Right(argument, 1) = Chr(34)) Then
|
|
37
|
+
argument = Chr(34) & argument & Chr(34)
|
|
38
|
+
End If
|
|
39
|
+
End If
|
|
40
|
+
If Len(command) > 0 Then command = command & " "
|
|
41
|
+
command = command & argument
|
|
42
|
+
Next
|
|
43
|
+
|
|
44
|
+
' Style 0 == SW_HIDE. False == do not wait: a local-AI repair must never hold
|
|
45
|
+
' up the connector's own startup.
|
|
46
|
+
shell.Run command, 0, False
|
|
47
|
+
WScript.Quit 0
|
|
@@ -287,6 +287,30 @@ function Stop-SetupProcess {
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
function Resume-BackgroundSensing {
|
|
291
|
+
# The wizard is the ONE window a customer can see, and closing it
|
|
292
|
+
# taskkill /T /F's the whole pairing tree. If that happens between "config
|
|
293
|
+
# written" and "scheduled task started" — or during an upgrade, while
|
|
294
|
+
# stop-existing.ps1 has the task disabled — sensing would stay down with
|
|
295
|
+
# nothing to retry it. Closing a window must never be what stops sensing.
|
|
296
|
+
$installDir = Split-Path -Parent $BinDir
|
|
297
|
+
$ensure = Join-Path $BinDir 'ensure-sensing.ps1'
|
|
298
|
+
if (-not (Test-Path $ensure)) { return }
|
|
299
|
+
if (-not (Test-Path (Join-Path $installDir 'trillboards.config.json'))) { return }
|
|
300
|
+
|
|
301
|
+
$startInfo = New-Object System.Diagnostics.ProcessStartInfo
|
|
302
|
+
$startInfo.FileName = 'powershell.exe'
|
|
303
|
+
$startInfo.Arguments = ('-NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -File "{0}" -InstallDir "{1}"' -f $ensure, $installDir)
|
|
304
|
+
$startInfo.UseShellExecute = $false
|
|
305
|
+
$startInfo.CreateNoWindow = $true
|
|
306
|
+
$startInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
|
|
307
|
+
try {
|
|
308
|
+
[void][System.Diagnostics.Process]::Start($startInfo)
|
|
309
|
+
} catch {
|
|
310
|
+
# Best-effort: the logon trigger is still the primary recovery path.
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
290
314
|
function Render-State($State) {
|
|
291
315
|
$stage = [string](Get-StateValue $State 'stage')
|
|
292
316
|
if (-not $stage) { return }
|
|
@@ -380,6 +404,7 @@ $Action.Add_Click({
|
|
|
380
404
|
|
|
381
405
|
$Form.Add_FormClosing({
|
|
382
406
|
Stop-SetupProcess
|
|
407
|
+
Resume-BackgroundSensing
|
|
383
408
|
if ($null -ne $script:SetupMutex) {
|
|
384
409
|
try { $script:SetupMutex.ReleaseMutex() } catch { }
|
|
385
410
|
$script:SetupMutex.Dispose()
|
|
@@ -64,8 +64,22 @@ export interface CameraHealthReport {
|
|
|
64
64
|
lastFailureMessage?: string;
|
|
65
65
|
/** AI/inference state, deliberately separate from RTSP/video health. */
|
|
66
66
|
sensingState?: CameraSensingState;
|
|
67
|
-
/**
|
|
68
|
-
|
|
67
|
+
/**
|
|
68
|
+
* What the connector actually PROVED, locally, without uploading the image.
|
|
69
|
+
* Two different facts, never interchangeable:
|
|
70
|
+
*
|
|
71
|
+
* `stream_open` — the RTSP handshake completed: the RECORDER IS REACHABLE.
|
|
72
|
+
* Says nothing about video. Carries NO `lastFrameAtMs`.
|
|
73
|
+
* `decoded_frame` — ffmpeg decoded a real frame off this feed: VIDEO IS
|
|
74
|
+
* HEALTHY. Always accompanied by `lastFrameAtMs`.
|
|
75
|
+
*
|
|
76
|
+
* Collapsing these is how a camera that answers RTSP and delivers nothing
|
|
77
|
+
* rendered as "Live — connected and sending video": a bare handshake claimed
|
|
78
|
+
* `decoded_frame`, and every reconnect refreshed the frame clock, so the feed
|
|
79
|
+
* could never age into "waiting for video". Reachability is the WEAKER claim
|
|
80
|
+
* and must never be able to mint a frame timestamp.
|
|
81
|
+
*/
|
|
82
|
+
captureProof?: 'decoded_frame' | 'stream_open';
|
|
69
83
|
}
|
|
70
84
|
/** Minimal injectable HTTP transport — lets tests stub the network entirely. */
|
|
71
85
|
export interface HttpPoster {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudienceAnalyzeClient.d.ts","sourceRoot":"","sources":["../src/AudienceAnalyzeClient.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,4BAA4B;IAC3C,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IAC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,CAAC,EACpC,OAAO,GAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,0FAA0F;QAC1F,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,6EAA6E;QAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;KACjB,GACL,OAAO,CAAC,uBAAuB,CAAC;IA+CnC;;;;OAIG;IACG,kBAAkB,CAAC,YAAY,EAAE,kBAAkB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAuB7F;AAkBD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,UA2C/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudienceAnalyzeClient.js","sourceRoot":"","sources":["../src/AudienceAnalyzeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAC/B,6BAA0B;AAC1B,mCAAoC;
|
|
1
|
+
{"version":3,"file":"AudienceAnalyzeClient.js","sourceRoot":"","sources":["../src/AudienceAnalyzeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAC/B,6BAA0B;AAC1B,mCAAoC;AAiHpC,MAAa,qBAAqB;IAUhC,YAAY,OAAqC,EAAE,MAAmB;QACpE,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,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,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACtC,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YACrB,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACtB,GAAG,CAAC,GAAG,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA3CW,QAAA,iBAAiB,qBA2C5B"}
|
|
@@ -5,6 +5,7 @@ import { SharedFrameSource } from './MosaicSource';
|
|
|
5
5
|
import type { EdgeAgentConfig, MosaicTile, RecorderIdentity } from './config';
|
|
6
6
|
import { type VlmAdmissionStats } from './VlmAdmissionGate';
|
|
7
7
|
import { type MotionGateOptions, type MotionGateReason } from './SceneChangeDetector';
|
|
8
|
+
import { type VlmCandidateBufferOptions, type VlmCandidateBufferStats } from './VlmCandidateBuffer';
|
|
8
9
|
import type { DeployedCadence } from './deployedCadence';
|
|
9
10
|
import type { LiteRtAccelerator, LiteRtAcceleratorHealth } from './LiteRtVlmProvider';
|
|
10
11
|
export declare function classifyRtspFailureClass(err: unknown): CameraHealthFailureClass;
|
|
@@ -195,6 +196,37 @@ export interface CloudSensingManagerOptions {
|
|
|
195
196
|
*/
|
|
196
197
|
minScanIntervalMs?: number;
|
|
197
198
|
};
|
|
199
|
+
/**
|
|
200
|
+
* Bounded hold for frames the cascade already called interesting but the
|
|
201
|
+
* admission gate could not take yet.
|
|
202
|
+
*
|
|
203
|
+
* ON BY DEFAULT WHEREVER IT CAN BE, which is wherever `motionGate` is on —
|
|
204
|
+
* and that is not a hedge, it is the precondition. Without a cascade nothing
|
|
205
|
+
* has classified the frame, so holding it would be the undifferentiated queue
|
|
206
|
+
* `VlmAdmissionGate` exists to refuse; the feature is therefore structurally
|
|
207
|
+
* coupled to its own classifier rather than to a flag someone has to
|
|
208
|
+
* remember. That lands it exactly where the single-conversation backend
|
|
209
|
+
* lives (local sensing enables the cascade by default) and leaves the
|
|
210
|
+
* genuinely-concurrent cloud path untouched.
|
|
211
|
+
*
|
|
212
|
+
* It is on rather than off because the thing it fixes is not a tuning
|
|
213
|
+
* preference: a motion-positive frame dropped at the gate is the alert not
|
|
214
|
+
* firing, and a connector shipped with the fix switched off is a connector
|
|
215
|
+
* that still drops it. Memory cannot run away — the hold is capped in
|
|
216
|
+
* frames, per feed, and in bytes, all enforced on the way in (see
|
|
217
|
+
* VlmCandidateBuffer). `enabled: false` restores the pure drop semantics.
|
|
218
|
+
*/
|
|
219
|
+
candidateBuffer?: VlmCandidateBufferOptions & {
|
|
220
|
+
/** Default: true whenever the motion cascade is on. */
|
|
221
|
+
enabled?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* How often the buffer is offered to a freed slot (ms). Default: the same
|
|
224
|
+
* derived value as `admissionRetryDelayMs` (250…5000), because it answers
|
|
225
|
+
* the same question — how quickly should a waiting frame notice a slot
|
|
226
|
+
* freed — and two knobs for one question drift apart.
|
|
227
|
+
*/
|
|
228
|
+
pumpIntervalMs?: number;
|
|
229
|
+
};
|
|
198
230
|
/**
|
|
199
231
|
* Let the motion verdict drive the periodic/face-triggered cadence switch —
|
|
200
232
|
* finally supplying the `setFaceDetected` signal this loop was always
|
|
@@ -253,6 +285,13 @@ export declare class CloudSensingManager extends EventEmitter {
|
|
|
253
285
|
private readonly cameraHealthHeartbeatIntervalMs;
|
|
254
286
|
private readonly admissionGate;
|
|
255
287
|
private readonly admissionRetryDelayMs;
|
|
288
|
+
/**
|
|
289
|
+
* The bounded hold between the cascade and the gate. NULL when there is no
|
|
290
|
+
* cascade to name a candidate — see the `candidateBuffer` option.
|
|
291
|
+
*/
|
|
292
|
+
private readonly candidates;
|
|
293
|
+
private readonly candidatePumpIntervalMs;
|
|
294
|
+
private candidatePumpTimer;
|
|
256
295
|
private readonly motionDrivesCadence;
|
|
257
296
|
/** Retained so a cadence change can rebuild each feed's gate heartbeat. */
|
|
258
297
|
private motionGateOptions;
|
|
@@ -380,6 +419,31 @@ export declare class CloudSensingManager extends EventEmitter {
|
|
|
380
419
|
skipped: number;
|
|
381
420
|
byReason: Record<MotionGateReason, number>;
|
|
382
421
|
};
|
|
422
|
+
/**
|
|
423
|
+
* The bounded hold between the cascade and the gate. `served` is the whole
|
|
424
|
+
* point — frames that were interesting, could not be analyzed at the
|
|
425
|
+
* instant they were taken, and reached the model anyway. `evicted` and
|
|
426
|
+
* `expired` are the price, and they are reported rather than absorbed: a
|
|
427
|
+
* silent eviction would move the lost frame from one invisible place to
|
|
428
|
+
* another, which is the defect this buffer exists to fix.
|
|
429
|
+
*/
|
|
430
|
+
candidateBuffer: {
|
|
431
|
+
enabled: boolean;
|
|
432
|
+
/** Held right now. */
|
|
433
|
+
buffered: number;
|
|
434
|
+
bytes: number;
|
|
435
|
+
maxFrames: number;
|
|
436
|
+
maxPerFeed: number;
|
|
437
|
+
maxBytes: number;
|
|
438
|
+
ttlMs: number;
|
|
439
|
+
enqueued: number;
|
|
440
|
+
served: number;
|
|
441
|
+
evicted: number;
|
|
442
|
+
expired: number;
|
|
443
|
+
/** How long the oldest waiting candidate has been waiting. */
|
|
444
|
+
oldestAgeMs: number | null;
|
|
445
|
+
perFeed: VlmCandidateBufferStats['perFeed'];
|
|
446
|
+
};
|
|
383
447
|
/**
|
|
384
448
|
* Frames sent to the cloud VLM for confirmation (local sensing with
|
|
385
449
|
* escalation enabled). 0 — and `cloudEscalationEnabled:false` — for a
|
|
@@ -408,6 +472,10 @@ export declare class CloudSensingManager extends EventEmitter {
|
|
|
408
472
|
motionSkipped: number;
|
|
409
473
|
/** This feed's skips, attributed to the cascade stage that made them. */
|
|
410
474
|
motionSkippedByReason: Record<MotionGateReason, number>;
|
|
475
|
+
/** Candidates this feed is holding right now — "camera 12 is waiting". */
|
|
476
|
+
candidatesBuffered: number;
|
|
477
|
+
/** Candidates of this feed's that the hold delivered to the model. */
|
|
478
|
+
candidatesServed: number;
|
|
411
479
|
cloudEscalated: number;
|
|
412
480
|
faceDetected: boolean;
|
|
413
481
|
currentIntervalMs: number;
|
|
@@ -524,6 +592,22 @@ export declare class CloudSensingManager extends EventEmitter {
|
|
|
524
592
|
private emitLoopError;
|
|
525
593
|
private reportCameraFailure;
|
|
526
594
|
private reportCameraHealth;
|
|
595
|
+
/**
|
|
596
|
+
* Report this feed as `open`, carrying the proof we ACTUALLY have.
|
|
597
|
+
*
|
|
598
|
+
* `frameProven` and `streamOpened` are two different facts and the caller must
|
|
599
|
+
* not conflate them:
|
|
600
|
+
*
|
|
601
|
+
* `streamOpened` — `camera.open()` resolved. The RTSP handshake completed,
|
|
602
|
+
* so the RECORDER IS REACHABLE. No frame has decoded, so
|
|
603
|
+
* this deliberately carries NO `lastFrameAtMs` and does NOT
|
|
604
|
+
* advance `lastCaptureAtMs` — a feed that has proved only
|
|
605
|
+
* reachability is still owed a video probe, immediately.
|
|
606
|
+
* `frameProven` — ffmpeg handed us real bytes. VIDEO IS HEALTHY.
|
|
607
|
+
*
|
|
608
|
+
* Both force a report, because both are transitions an operator is waiting on
|
|
609
|
+
* ("Connecting…" must clear the moment the recorder answers).
|
|
610
|
+
*/
|
|
527
611
|
private reportCameraOpen;
|
|
528
612
|
private healthProbeDue;
|
|
529
613
|
/**
|
|
@@ -532,14 +616,74 @@ export declare class CloudSensingManager extends EventEmitter {
|
|
|
532
616
|
*/
|
|
533
617
|
private captureHealthFrame;
|
|
534
618
|
/**
|
|
535
|
-
* One cascade pass for a feed
|
|
536
|
-
*
|
|
619
|
+
* One cascade pass for a feed. Which pass depends on whether there is a
|
|
620
|
+
* cascade to name a candidate — see the class header for why the order
|
|
621
|
+
* differs and why that is not two behaviours bolted together.
|
|
537
622
|
*
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
623
|
+
* Deliberately NOT `async`: it hands the chosen pass's promise straight back
|
|
624
|
+
* instead of adopting it. An `async` dispatcher would insert two microtask
|
|
625
|
+
* hops in front of every capture on a path this PR does not otherwise
|
|
626
|
+
* change, and a fake-timer test that advances a fixed number of drains would
|
|
627
|
+
* then complete fewer ticks per advance — which is not a behaviour change but
|
|
628
|
+
* is indistinguishable from one at 2 a.m. Zero delta on the untouched path is
|
|
629
|
+
* cheaper to hold than the argument about whether the delta mattered.
|
|
541
630
|
*/
|
|
542
631
|
private captureAndPost;
|
|
632
|
+
/**
|
|
633
|
+
* LOOK FIRST, admit second: capture → motion → (candidate) → admission.
|
|
634
|
+
*
|
|
635
|
+
* Runs only with the cascade on, because only the cascade can answer "is
|
|
636
|
+
* this frame worth holding?". A candidate the gate cannot take right now
|
|
637
|
+
* goes into the bounded hold instead of onto the floor; anything the cascade
|
|
638
|
+
* rejected is dropped exactly as before and is never offered.
|
|
639
|
+
*/
|
|
640
|
+
private lookThenAdmit;
|
|
641
|
+
/**
|
|
642
|
+
* ADMIT FIRST, look second — the original order, unchanged, and the only one
|
|
643
|
+
* available without a cascade: nothing has classified the frame, so paying
|
|
644
|
+
* for a grab the model cannot take buys nothing, and a denied tick drops
|
|
645
|
+
* without touching the camera. Video health stays independent: at most one
|
|
646
|
+
* feed at a time may take a slow-cadence decode-only proof while the model
|
|
647
|
+
* is occupied.
|
|
648
|
+
*/
|
|
649
|
+
private admitThenLook;
|
|
650
|
+
/**
|
|
651
|
+
* Everything that happens once a frame has been analyzed, in ONE place, so a
|
|
652
|
+
* held frame and a fresh one can never be counted — or reported to the portal
|
|
653
|
+
* — differently.
|
|
654
|
+
*
|
|
655
|
+
* Synchronous on purpose. The obvious factoring wraps the `analyze()` call
|
|
656
|
+
* itself, but that turns every caller's inline await into an await of an
|
|
657
|
+
* async helper, which adds microtask hops to the pre-existing capture path
|
|
658
|
+
* for no behavioural gain. What the two callers genuinely share is the
|
|
659
|
+
* bookkeeping AFTER the call, and that is what lives here; the four-line
|
|
660
|
+
* try/catch around the call stays at each site, where its `unavailable`
|
|
661
|
+
* report is visible next to the thing that can fail.
|
|
662
|
+
*/
|
|
663
|
+
private recordAnalysis;
|
|
664
|
+
/**
|
|
665
|
+
* Arm the candidate pump for ONE run of the manager.
|
|
666
|
+
*
|
|
667
|
+
* A manager-scoped chain rather than a per-feed one, and that is the point:
|
|
668
|
+
* service order across feeds has to be a DECISION (least-recently-served,
|
|
669
|
+
* see VlmCandidateBuffer), not a race between 32 independent timers all
|
|
670
|
+
* polling for the same freed slot. `generation` carries the same meaning it
|
|
671
|
+
* carries in `scheduleNext` — a pump that survives a stop()/start() cycle
|
|
672
|
+
* must not arm a second chain.
|
|
673
|
+
*/
|
|
674
|
+
private scheduleCandidatePump;
|
|
675
|
+
/**
|
|
676
|
+
* Offer the hold to every slot that is free right now.
|
|
677
|
+
*
|
|
678
|
+
* Synchronous by construction: each admitted candidate is launched as its own
|
|
679
|
+
* task and the pump does not await it, so one slow inference cannot delay the
|
|
680
|
+
* next pump tick or another feed's turn. Concurrency stays bounded by the
|
|
681
|
+
* admission gate, which is the only thing that ever knew the backend's real
|
|
682
|
+
* capacity.
|
|
683
|
+
*/
|
|
684
|
+
private pumpCandidates;
|
|
685
|
+
/** Analyze one held candidate and give the slot back. Never throws. */
|
|
686
|
+
private serveCandidate;
|
|
543
687
|
/**
|
|
544
688
|
* Convert a camera frame to JPEG bytes for the POST.
|
|
545
689
|
*
|