@trillboards/edge-sdk 0.2.243 → 0.2.244
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/build-windows.ps1 +17 -1
- package/deploy/windows/ci/test-private-live-view-staging.ps1 +43 -0
- package/deploy/windows/ci/test-stop-existing-processes.ps1 +58 -0
- package/deploy/windows/e2e/test-headless-principal.ps1 +24 -2
- package/deploy/windows/stage-private-live-view.ps1 +59 -0
- package/deploy/windows/stop-existing.ps1 +6 -5
- package/deploy/windows/stop-local-ai.ps1 +4 -0
- package/dist/CctvLiveViewCoordinator.d.ts +123 -0
- package/dist/CctvLiveViewCoordinator.d.ts.map +1 -0
- package/dist/CctvLiveViewCoordinator.js +393 -0
- package/dist/CctvLiveViewCoordinator.js.map +1 -0
- package/dist/EdgeAgent.js +1 -1
- package/dist/LiveViewControlHttp.d.ts +10 -0
- package/dist/LiveViewControlHttp.d.ts.map +1 -0
- package/dist/LiveViewControlHttp.js +84 -0
- package/dist/LiveViewControlHttp.js.map +1 -0
- package/dist/LiveViewOwnedSenderScope.d.ts +38 -0
- package/dist/LiveViewOwnedSenderScope.d.ts.map +1 -0
- package/dist/LiveViewOwnedSenderScope.js +88 -0
- package/dist/LiveViewOwnedSenderScope.js.map +1 -0
- package/dist/LiveViewProducerSignaling.d.ts +37 -0
- package/dist/LiveViewProducerSignaling.d.ts.map +1 -0
- package/dist/LiveViewProducerSignaling.js +97 -0
- package/dist/LiveViewProducerSignaling.js.map +1 -0
- package/dist/LiveViewRelayBootstrap.d.ts +26 -0
- package/dist/LiveViewRelayBootstrap.d.ts.map +1 -0
- package/dist/LiveViewRelayBootstrap.js +85 -0
- package/dist/LiveViewRelayBootstrap.js.map +1 -0
- package/dist/autoSense.d.ts +5 -0
- package/dist/autoSense.d.ts.map +1 -1
- package/dist/autoSense.js +53 -2
- package/dist/autoSense.js.map +1 -1
- package/dist/diagnose.d.ts +1 -1
- package/dist/diagnose.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/sensingRunMode.d.ts +1 -0
- package/dist/sensingRunMode.d.ts.map +1 -1
- package/dist/sensingRunMode.js.map +1 -1
- package/dist/windowsLiveView.d.ts +57 -0
- package/dist/windowsLiveView.d.ts.map +1 -0
- package/dist/windowsLiveView.js +180 -0
- package/dist/windowsLiveView.js.map +1 -0
- package/package.json +2 -2
|
@@ -45,6 +45,12 @@
|
|
|
45
45
|
workflow reads the pin from here rather than restating
|
|
46
46
|
it, so the two can never drift.
|
|
47
47
|
|
|
48
|
+
|
|
49
|
+
.PARAMETER PrivateLiveViewArchive
|
|
50
|
+
Optional exact worker bundle for a private lab build.
|
|
51
|
+
.PARAMETER PrivateLiveViewSha256
|
|
52
|
+
SHA-256 of that archive before any extraction.
|
|
53
|
+
|
|
48
54
|
.OUTPUTS
|
|
49
55
|
Prints the inner installer path on the last line:
|
|
50
56
|
<pkgroot>\deploy\windows\dist-installer\inner\TrillboardsEdgeSetup-core-<ver>-x64.exe
|
|
@@ -55,12 +61,18 @@ param(
|
|
|
55
61
|
[switch]$Offline,
|
|
56
62
|
[switch]$SkipNsis,
|
|
57
63
|
[string]$FfmpegPath = "",
|
|
58
|
-
[switch]$PrintFfmpegPin
|
|
64
|
+
[switch]$PrintFfmpegPin,
|
|
65
|
+
[string]$PrivateLiveViewArchive = "",
|
|
66
|
+
[string]$PrivateLiveViewSha256 = ""
|
|
59
67
|
)
|
|
60
68
|
|
|
61
69
|
$ErrorActionPreference = "Stop"
|
|
62
70
|
Set-StrictMode -Version Latest
|
|
63
71
|
|
|
72
|
+
if ([bool]$PrivateLiveViewArchive -ne [bool]$PrivateLiveViewSha256) {
|
|
73
|
+
throw "A private live-view archive and its SHA-256 are required together."
|
|
74
|
+
}
|
|
75
|
+
|
|
64
76
|
# ─── Pinned static ffmpeg (win32-x64) — eugeneware/ffmpeg-static b6.0 ──────────
|
|
65
77
|
# Same upstream + release the macOS build pins, so behavior matches. SHA-256
|
|
66
78
|
# verified after download; refuse to bundle an unverified binary.
|
|
@@ -119,6 +131,10 @@ New-Item -ItemType Directory -Force -Path "$Payload\lib\edge-sdk" | Out-Null
|
|
|
119
131
|
Copy-Item -Recurse -Force "$PkgRoot\dist" "$Payload\lib\edge-sdk\dist"
|
|
120
132
|
Copy-RetainedRuntime -Source "$PkgRoot\retained" -Destination "$Payload\lib\edge-sdk\retained"
|
|
121
133
|
Copy-Item -Force "$PkgRoot\package.json" "$Payload\lib\edge-sdk\package.json"
|
|
134
|
+
if ($PrivateLiveViewArchive) {
|
|
135
|
+
$liveViewStage = @{ Archive = $PrivateLiveViewArchive; ExpectedSha256 = $PrivateLiveViewSha256; SdkPayload = "$Payload\lib\edge-sdk" }
|
|
136
|
+
& "$Here\stage-private-live-view.ps1" @liveViewStage
|
|
137
|
+
}
|
|
122
138
|
|
|
123
139
|
# ─── 3. Runtime node_modules subset (NO heavy native stack) ────────────────────
|
|
124
140
|
# robocopy /E mirrors the tree; /XD prunes the heavy/native/dev packages cloud-
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
param([string]$Stager = (Join-Path $PSScriptRoot "..\stage-private-live-view.ps1"))
|
|
2
|
+
$ErrorActionPreference = 'Stop'
|
|
3
|
+
$root = [IO.Path]::GetFullPath([IO.Path]::GetTempPath()).TrimEnd('\') + '\'
|
|
4
|
+
$temp = (New-Item -ItemType Directory -Path (Join-Path $root ('sense-stage-lab-' + [guid]::NewGuid().ToString('N')))).FullName
|
|
5
|
+
try {
|
|
6
|
+
$inputs = (New-Item -ItemType Directory -Path (Join-Path $temp 'input')).FullName
|
|
7
|
+
$output = (New-Item -ItemType Directory -Path (Join-Path $temp 'sdk')).FullName
|
|
8
|
+
$entry = Join-Path $inputs 'platform.cjs'
|
|
9
|
+
Set-Content -LiteralPath $entry -Value 'module.exports.createPlatform = () => undefined;'
|
|
10
|
+
$entryHash = (Get-FileHash -LiteralPath $entry).Hash.ToLowerInvariant()
|
|
11
|
+
@{ apiVersion = 1; entrySha256 = $entryHash } | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $inputs 'platform.json')
|
|
12
|
+
Set-Content -LiteralPath (Join-Path $inputs 'owned-relay.node') -Value 'test fixture bytes'
|
|
13
|
+
$archive = Join-Path $temp 'fixture.zip'
|
|
14
|
+
Compress-Archive -Path (Join-Path $inputs '*') -DestinationPath $archive
|
|
15
|
+
$sha = (Get-FileHash -LiteralPath $archive).Hash
|
|
16
|
+
if (-not (Test-Path -LiteralPath $Stager)) { throw 'The normal Windows builder has no private media stager.' }
|
|
17
|
+
$rejected = $false
|
|
18
|
+
try { & $Stager -Archive $archive -ExpectedSha256 ('0' * 64) -SdkPayload $output }
|
|
19
|
+
catch { $rejected = $_.Exception.Message -match 'digest' }
|
|
20
|
+
if (-not $rejected -or (Test-Path -LiteralPath (Join-Path $output 'live-view'))) { throw 'Wrong archive digest was accepted' }
|
|
21
|
+
$bad = Join-Path $temp 'unsafe.zip'
|
|
22
|
+
Copy-Item -LiteralPath $archive -Destination $bad
|
|
23
|
+
$zip = [IO.Compression.ZipFile]::Open($bad, [IO.Compression.ZipArchiveMode]::Update)
|
|
24
|
+
try { $null = $zip.CreateEntry('../outside.txt') }
|
|
25
|
+
finally { $zip.Dispose() }
|
|
26
|
+
$rejected = $false
|
|
27
|
+
try { & $Stager -Archive $bad -ExpectedSha256 (Get-FileHash -LiteralPath $bad).Hash -SdkPayload $output }
|
|
28
|
+
catch { $rejected = $_.Exception.Message -match 'Unsafe private live-view archive entry' }
|
|
29
|
+
if (-not $rejected -or (Test-Path -LiteralPath (Join-Path $output 'live-view'))) { throw 'Unsafe archive path was accepted' }
|
|
30
|
+
& $Stager -Archive $archive -ExpectedSha256 $sha -SdkPayload $output
|
|
31
|
+
$staged = Join-Path $output 'live-view'
|
|
32
|
+
foreach ($file in @('platform.cjs', 'platform.json', 'owned-relay.node')) {
|
|
33
|
+
$from = (Get-FileHash -LiteralPath (Join-Path $inputs $file)).Hash
|
|
34
|
+
$to = (Get-FileHash -LiteralPath (Join-Path $staged $file)).Hash
|
|
35
|
+
if ($from -ne $to) { throw 'Windows builder changed the pinned bundle bytes' }
|
|
36
|
+
}
|
|
37
|
+
Write-Output 'PASS wrong hash and unsafe paths refused before extraction, exact bundle staged'
|
|
38
|
+
} finally {
|
|
39
|
+
$resolved = [IO.Path]::GetFullPath($temp)
|
|
40
|
+
if (-not $resolved.StartsWith($root, [StringComparison]::OrdinalIgnoreCase) -or
|
|
41
|
+
(Split-Path -Leaf $resolved) -notmatch '^sense-stage-lab-[a-f0-9]{32}$') { throw 'Unexpected test directory' }
|
|
42
|
+
Remove-Item -LiteralPath $resolved -Recurse -Force
|
|
43
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[CmdletBinding()]
|
|
2
|
+
param([string]$StopScriptPath = (Join-Path $PSScriptRoot '..\stop-existing.ps1'))
|
|
3
|
+
|
|
4
|
+
Set-StrictMode -Version Latest
|
|
5
|
+
$ErrorActionPreference = 'Stop'
|
|
6
|
+
$stopScript = [scriptblock]::Create((Get-Content -LiteralPath $StopScriptPath -Raw))
|
|
7
|
+
|
|
8
|
+
function Test-ProcessCounts([int]$OwnedCount) {
|
|
9
|
+
$root = Join-Path ([IO.Path]::GetTempPath()) ('stop-existing-test-' + [Guid]::NewGuid().ToString('N'))
|
|
10
|
+
$bin = Join-Path $root 'bin'
|
|
11
|
+
$null = New-Item -Path $bin -ItemType Directory
|
|
12
|
+
try {
|
|
13
|
+
$ownedIds = @(for ($i = 0; $i -lt $OwnedCount; $i++) { 99101 + $i })
|
|
14
|
+
$script:caseState = @{
|
|
15
|
+
Queries = 0
|
|
16
|
+
Stopped = [Collections.Generic.List[int]]::new()
|
|
17
|
+
Owned = @(foreach ($id in $ownedIds) {
|
|
18
|
+
[pscustomobject]@{ ProcessId = $id; Name = 'node.exe'; CommandLine = 'node cli.js';
|
|
19
|
+
ExecutablePath = (Join-Path $bin 'node.exe') }
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
for ($i = 0; $i -lt $OwnedCount; $i++) {
|
|
23
|
+
$name = @('node.exe', 'ffmpeg.exe')[$i]
|
|
24
|
+
[IO.File]::WriteAllText((Join-Path $bin $name), 'unlocked fixture binary')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function Get-CimInstance {
|
|
28
|
+
[CmdletBinding()]
|
|
29
|
+
param([string]$ClassName)
|
|
30
|
+
if ($ClassName -ne 'Win32_Process') { throw "Unexpected query $ClassName" }
|
|
31
|
+
$script:caseState.Queries++
|
|
32
|
+
[pscustomobject]@{ ProcessId = 99301; Name = 'node.exe'; CommandLine = 'node unrelated.js';
|
|
33
|
+
ExecutablePath = (Join-Path ([IO.Path]::GetTempPath()) 'unrelated\node.exe') }
|
|
34
|
+
if ($script:caseState.Queries -le 2) { $script:caseState.Owned }
|
|
35
|
+
}
|
|
36
|
+
function Stop-Process {
|
|
37
|
+
[CmdletBinding()]
|
|
38
|
+
param([int]$Id, [switch]$Force)
|
|
39
|
+
if ($Id -notin $ownedIds -or $Force) { throw "Unexpected stop of process $Id" }
|
|
40
|
+
$script:caseState.Stopped.Add($Id)
|
|
41
|
+
}
|
|
42
|
+
function Disable-ScheduledTask { [CmdletBinding()] param([string]$TaskName) }
|
|
43
|
+
function Stop-ScheduledTask { [CmdletBinding()] param([string]$TaskName) }
|
|
44
|
+
function Start-Sleep { param([int]$Milliseconds) }
|
|
45
|
+
|
|
46
|
+
& $stopScript -InstallDir $root
|
|
47
|
+
if (($script:caseState.Stopped -join ',') -ne ($ownedIds -join ',') -or $script:caseState.Queries -lt 3) {
|
|
48
|
+
throw "Wrong owned process stop or recheck for count $OwnedCount"
|
|
49
|
+
}
|
|
50
|
+
Write-Host "PASS strict cleanup with $OwnedCount owned processes and binaries"
|
|
51
|
+
} finally {
|
|
52
|
+
foreach ($file in @(Get-ChildItem -LiteralPath $bin -File)) { $file.Delete() }
|
|
53
|
+
[IO.Directory]::Delete($bin)
|
|
54
|
+
[IO.Directory]::Delete($root)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
foreach ($count in @(0, 1, 2)) { Test-ProcessCounts $count }
|
|
@@ -300,8 +300,30 @@ try {
|
|
|
300
300
|
# profile. On a customer machine this is always true: the installing user has
|
|
301
301
|
# logged on. Without it Arm D would be measuring first-logon profile creation.
|
|
302
302
|
Log ' materialising the probe user profile'
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
# Own the creation handle while this intentionally short-lived process exits.
|
|
304
|
+
# Start-Process -Wait failed after exit in native CI, before any headless arm.
|
|
305
|
+
# WaitForExit uses this Process object's handle rather than rediscovering a PID.
|
|
306
|
+
$profileStartInfo = New-Object System.Diagnostics.ProcessStartInfo
|
|
307
|
+
$profileStartInfo.FileName = $env:ComSpec
|
|
308
|
+
$profileStartInfo.Arguments = '/c exit 0'
|
|
309
|
+
$profileStartInfo.WorkingDirectory = 'C:\'
|
|
310
|
+
$profileStartInfo.UseShellExecute = $false
|
|
311
|
+
$profileStartInfo.CreateNoWindow = $true
|
|
312
|
+
$profileStartInfo.LoadUserProfile = $true
|
|
313
|
+
$profileStartInfo.UserName = $cred.GetNetworkCredential().UserName
|
|
314
|
+
$profileStartInfo.Domain = $cred.GetNetworkCredential().Domain
|
|
315
|
+
$profileStartInfo.Password = $cred.Password
|
|
316
|
+
$profileProcess = New-Object System.Diagnostics.Process
|
|
317
|
+
$profileProcess.StartInfo = $profileStartInfo
|
|
318
|
+
try {
|
|
319
|
+
if (-not $profileProcess.Start()) { Die 'Probe profile warmup did not start' }
|
|
320
|
+
if (-not $profileProcess.WaitForExit(30000)) {
|
|
321
|
+
$profileProcess.Kill()
|
|
322
|
+
$profileProcess.WaitForExit()
|
|
323
|
+
Die 'Probe profile warmup did not exit within 30 seconds'
|
|
324
|
+
}
|
|
325
|
+
if ($profileProcess.ExitCode -ne 0) { Die "Probe profile warmup exited $($profileProcess.ExitCode)" }
|
|
326
|
+
} finally { $profileProcess.Dispose() }
|
|
305
327
|
$probeProfile = (Get-CimInstance Win32_UserProfile -ErrorAction SilentlyContinue |
|
|
306
328
|
Where-Object { $_.LocalPath -like "*\$ProbeUser" } | Select-Object -First 1).LocalPath
|
|
307
329
|
Log " probe user profile: $probeProfile"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[CmdletBinding()]
|
|
2
|
+
param(
|
|
3
|
+
[Parameter(Mandatory)][string]$Archive,
|
|
4
|
+
[Parameter(Mandatory)][ValidatePattern('^[a-fA-F0-9]{64}$')][string]$ExpectedSha256,
|
|
5
|
+
[Parameter(Mandatory)][string]$SdkPayload
|
|
6
|
+
)
|
|
7
|
+
$ErrorActionPreference = 'Stop'
|
|
8
|
+
Add-Type -AssemblyName System.IO.Compression
|
|
9
|
+
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
10
|
+
|
|
11
|
+
$source = [IO.File]::OpenRead((Resolve-Path -LiteralPath $Archive).ProviderPath)
|
|
12
|
+
try {
|
|
13
|
+
if ($source.Length -gt 64MB -or (Get-FileHash -InputStream $source -Algorithm SHA256).Hash -ne $ExpectedSha256) {
|
|
14
|
+
throw 'Private live-view archive digest did not match.'
|
|
15
|
+
}
|
|
16
|
+
$source.Position = 0
|
|
17
|
+
$bundle = [IO.Compression.ZipArchive]::new($source, [IO.Compression.ZipArchiveMode]::Read, $true)
|
|
18
|
+
try {
|
|
19
|
+
$names = [Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase)
|
|
20
|
+
[long]$expanded = 0
|
|
21
|
+
if ($bundle.Entries.Count -gt 2048) { throw 'Private live-view archive has too many files.' }
|
|
22
|
+
foreach ($item in $bundle.Entries) {
|
|
23
|
+
$name = $item.FullName
|
|
24
|
+
if ($name -cnotmatch '^[A-Za-z0-9_-][A-Za-z0-9_.-]*(/[A-Za-z0-9_-][A-Za-z0-9_.-]*)*$' -or
|
|
25
|
+
$name -match '(?:^|/)(?:CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])(?:[./]|$)' -or
|
|
26
|
+
$name -match '\.(?:/|$)' -or -not $names.Add($name)) {
|
|
27
|
+
throw 'Unsafe private live-view archive entry.'
|
|
28
|
+
}
|
|
29
|
+
$expanded += $item.Length
|
|
30
|
+
if ($expanded -gt 128MB) { throw 'Private live-view archive expanded size exceeded its limit.' }
|
|
31
|
+
}
|
|
32
|
+
$manifest = $bundle.GetEntry('platform.json')
|
|
33
|
+
$platform = $bundle.GetEntry('platform.cjs')
|
|
34
|
+
$addon = $bundle.GetEntry('owned-relay.node')
|
|
35
|
+
if (-not $manifest -or $manifest.Length -gt 4096 -or -not $platform -or $platform.Length -gt 256KB -or
|
|
36
|
+
-not $addon -or $addon.Length -le 0) {
|
|
37
|
+
throw 'Private live-view archive is missing the startup manifest, platform or native worker.'
|
|
38
|
+
}
|
|
39
|
+
$reader = [IO.StreamReader]::new($manifest.Open())
|
|
40
|
+
try { $stamp = $reader.ReadToEnd() | ConvertFrom-Json }
|
|
41
|
+
finally { $reader.Dispose() }
|
|
42
|
+
$entry = $platform.Open()
|
|
43
|
+
try { $entrySha = (Get-FileHash -InputStream $entry -Algorithm SHA256).Hash.ToLowerInvariant() }
|
|
44
|
+
finally { $entry.Dispose() }
|
|
45
|
+
if ($stamp.apiVersion -ne 1 -or $stamp.entrySha256 -cne $entrySha) {
|
|
46
|
+
throw 'Private live-view platform entry digest did not match.'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
$sdk = (Resolve-Path -LiteralPath $SdkPayload).ProviderPath
|
|
50
|
+
$destination = Join-Path $sdk 'live-view'
|
|
51
|
+
if (Test-Path -LiteralPath $destination) { throw 'Private live-view destination already exists.' }
|
|
52
|
+
New-Item -ItemType Directory -Path $destination | Out-Null
|
|
53
|
+
foreach ($item in $bundle.Entries) {
|
|
54
|
+
$file = Join-Path $destination $item.FullName
|
|
55
|
+
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $file) | Out-Null
|
|
56
|
+
[IO.Compression.ZipFileExtensions]::ExtractToFile($item, $file, $false)
|
|
57
|
+
}
|
|
58
|
+
} finally { $bundle.Dispose() }
|
|
59
|
+
} finally { $source.Dispose() }
|
|
@@ -93,7 +93,7 @@ function Get-TrillboardsEdgeProcesses {
|
|
|
93
93
|
})
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
$processes = Get-TrillboardsEdgeProcesses
|
|
96
|
+
$processes = @(Get-TrillboardsEdgeProcesses)
|
|
97
97
|
foreach ($process in $processes) {
|
|
98
98
|
Stop-Process -Id $process.ProcessId -ErrorAction SilentlyContinue
|
|
99
99
|
}
|
|
@@ -101,7 +101,7 @@ foreach ($process in $processes) {
|
|
|
101
101
|
$deadline = [DateTime]::UtcNow.AddSeconds(5)
|
|
102
102
|
do {
|
|
103
103
|
Start-Sleep -Milliseconds 250
|
|
104
|
-
$remaining = Get-TrillboardsEdgeProcesses
|
|
104
|
+
$remaining = @(Get-TrillboardsEdgeProcesses)
|
|
105
105
|
} while ($remaining.Count -gt 0 -and [DateTime]::UtcNow -lt $deadline)
|
|
106
106
|
|
|
107
107
|
foreach ($process in $remaining) {
|
|
@@ -109,7 +109,7 @@ foreach ($process in $remaining) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
Start-Sleep -Milliseconds 250
|
|
112
|
-
$remaining = Get-TrillboardsEdgeProcesses
|
|
112
|
+
$remaining = @(Get-TrillboardsEdgeProcesses)
|
|
113
113
|
if ($remaining.Count -gt 0) {
|
|
114
114
|
$ids = ($remaining | ForEach-Object { $_.ProcessId }) -join ', '
|
|
115
115
|
throw "Could not stop the existing Trillboards connector processes: $ids"
|
|
@@ -124,8 +124,9 @@ function Assert-BinariesUnlocked {
|
|
|
124
124
|
|
|
125
125
|
$targets = @(
|
|
126
126
|
(Join-Path $Root 'bin\node.exe'),
|
|
127
|
-
(Join-Path $Root 'bin\ffmpeg.exe')
|
|
128
|
-
|
|
127
|
+
(Join-Path $Root 'bin\ffmpeg.exe') |
|
|
128
|
+
Where-Object { Test-Path -LiteralPath $_ }
|
|
129
|
+
)
|
|
129
130
|
if ($targets.Count -eq 0) { return }
|
|
130
131
|
|
|
131
132
|
$deadline = [DateTime]::UtcNow.AddSeconds($TimeoutSeconds)
|
|
@@ -224,6 +224,10 @@ try {
|
|
|
224
224
|
}
|
|
225
225
|
if (-not $process.CreationDate -or -not $live.CreationDate -or -not $live.ExecutablePath) { continue }
|
|
226
226
|
try { Stop-Process -Id $process.ProcessId -Force -ErrorAction Stop } catch {
|
|
227
|
+
# CIM may still list an exiting process after Stop-Process reports it
|
|
228
|
+
# gone. Only that error retries via the owned-process and port checks.
|
|
229
|
+
if ($_.CategoryInfo.Category -eq 'ObjectNotFound' -and
|
|
230
|
+
$_.FullyQualifiedErrorId -like 'NoProcessFoundForGivenId,*') { continue }
|
|
227
231
|
if (Get-CimInstance Win32_Process -Filter ('ProcessId=' + $process.ProcessId) -OperationTimeoutSec 5 -ErrorAction Stop) { throw }
|
|
228
232
|
}
|
|
229
233
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/** Implementations must be qualified to include suspend; no JS-clock default is supplied. */
|
|
2
|
+
export interface LiveViewClockSample {
|
|
3
|
+
elapsedMs: number;
|
|
4
|
+
generation: string;
|
|
5
|
+
certain: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface LiveViewBinding {
|
|
8
|
+
screenId: string;
|
|
9
|
+
revision: string;
|
|
10
|
+
}
|
|
11
|
+
export interface LiveViewConfiguredFeed {
|
|
12
|
+
id?: string;
|
|
13
|
+
screenId?: string;
|
|
14
|
+
sourceFeedId?: string;
|
|
15
|
+
tile?: unknown;
|
|
16
|
+
rtspUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface LiveViewConfig {
|
|
19
|
+
cameras?: readonly LiveViewConfiguredFeed[];
|
|
20
|
+
connector?: {
|
|
21
|
+
key?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface LiveViewQualification {
|
|
25
|
+
revision: string;
|
|
26
|
+
configurationGeneration: string;
|
|
27
|
+
screenId: string;
|
|
28
|
+
codec: 'h264';
|
|
29
|
+
h264ParametersQualified: true;
|
|
30
|
+
recorderAdmissionQualified: true;
|
|
31
|
+
independentFenceQualified: true;
|
|
32
|
+
}
|
|
33
|
+
export declare function liveViewConfigurationRevision(config: LiveViewConfig): string;
|
|
34
|
+
export declare function resolveLiveViewBinding(config: LiveViewConfig, screenId: string, qualification: LiveViewQualification | null, configurationGeneration: string): LiveViewBinding | null;
|
|
35
|
+
export interface LiveViewOwnership {
|
|
36
|
+
sessionId: string;
|
|
37
|
+
producerInstanceId: string;
|
|
38
|
+
generation: number;
|
|
39
|
+
binding: LiveViewBinding;
|
|
40
|
+
}
|
|
41
|
+
export interface LiveViewOwnedScope {
|
|
42
|
+
/** Container creation opens nothing. Start returns promptly and retains partial acquisitions. */
|
|
43
|
+
start(): Promise<void>;
|
|
44
|
+
/** Synchronously stop output; release must observe exact children and release reservation last. */
|
|
45
|
+
fence(): void;
|
|
46
|
+
/** Cancel/join pending start and late handles; observe exit before releasing admission. */
|
|
47
|
+
release(): Promise<void>;
|
|
48
|
+
/** Synchronously publish media readiness after start and before reporting the view active. */
|
|
49
|
+
activate?(): void;
|
|
50
|
+
/** At native commit, require the proposed deadline and any previous deadline to be live. Throw on refusal. */
|
|
51
|
+
setDeadline(deadlineMs: number, clockGeneration: string, requestStartMs: number): void;
|
|
52
|
+
}
|
|
53
|
+
export type LiveViewMonitoringState = 'available' | 'busy' | 'unknown';
|
|
54
|
+
export interface LiveViewControlRequest {
|
|
55
|
+
protocolVersion: 1;
|
|
56
|
+
producerInstanceId: string;
|
|
57
|
+
sequence: number;
|
|
58
|
+
ready: boolean;
|
|
59
|
+
leaseClock: 'request_start';
|
|
60
|
+
monitoringState: LiveViewMonitoringState;
|
|
61
|
+
activeSessionId: string | null;
|
|
62
|
+
stoppedSessionId: string | null;
|
|
63
|
+
}
|
|
64
|
+
export interface LiveViewControlContext {
|
|
65
|
+
startedAt: LiveViewClockSample | null;
|
|
66
|
+
signal: AbortSignal;
|
|
67
|
+
}
|
|
68
|
+
export interface CctvLiveViewCoordinatorOptions {
|
|
69
|
+
producerInstanceId: string;
|
|
70
|
+
clock(): LiveViewClockSample;
|
|
71
|
+
binding(): LiveViewBinding | null;
|
|
72
|
+
/** Current independently observed monitoring health/capacity, not static feed qualification. */
|
|
73
|
+
monitoringState(): LiveViewMonitoringState;
|
|
74
|
+
/** Bound the HTTP request independently. The request's producer identity can rotate. */
|
|
75
|
+
control(request: LiveViewControlRequest, context: LiveViewControlContext): Promise<unknown>;
|
|
76
|
+
/** leaseAllowed permits owned setup traffic; packetAllowed additionally requires completed startup. */
|
|
77
|
+
createScope(owner: LiveViewOwnership, packetAllowed: () => boolean, leaseAllowed: () => boolean, terminalFault: () => void): LiveViewOwnedScope;
|
|
78
|
+
setTimer?: (callback: () => void, delayMs: number) => unknown;
|
|
79
|
+
clearTimer?: (handle: unknown) => void;
|
|
80
|
+
/**
|
|
81
|
+
* The exact viewing resource is released and its stop receipt is pending. The
|
|
82
|
+
* poller may report it now instead of waiting out its ordinary cadence.
|
|
83
|
+
*/
|
|
84
|
+
released?: () => void;
|
|
85
|
+
}
|
|
86
|
+
/** Injection-only foundation. No autoSense wiring, clock adapter, sender or control polling activation. */
|
|
87
|
+
export declare class CctvLiveViewCoordinator {
|
|
88
|
+
private readonly options;
|
|
89
|
+
private generation;
|
|
90
|
+
private sequence;
|
|
91
|
+
private closed;
|
|
92
|
+
private inFlight;
|
|
93
|
+
private requestAbort;
|
|
94
|
+
private current;
|
|
95
|
+
private stoppedSessionId;
|
|
96
|
+
private lastClock;
|
|
97
|
+
private clockHealthy;
|
|
98
|
+
private monitoring;
|
|
99
|
+
private timer;
|
|
100
|
+
private readonly terminal;
|
|
101
|
+
private producerInstanceId;
|
|
102
|
+
private retirement;
|
|
103
|
+
constructor(options: CctvLiveViewCoordinatorOptions);
|
|
104
|
+
private binding;
|
|
105
|
+
private clock;
|
|
106
|
+
check(): void;
|
|
107
|
+
private clearWatchdog;
|
|
108
|
+
private arm;
|
|
109
|
+
private remember;
|
|
110
|
+
private revoke;
|
|
111
|
+
private leaseAllowed;
|
|
112
|
+
private ready;
|
|
113
|
+
private finishRetirement;
|
|
114
|
+
pollNow(): Promise<void>;
|
|
115
|
+
close(): Promise<void>;
|
|
116
|
+
parentLost(): Promise<void>;
|
|
117
|
+
status(): {
|
|
118
|
+
ready: boolean;
|
|
119
|
+
activeSessionId: string | null;
|
|
120
|
+
stoppedSessionId: string | null;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=CctvLiveViewCoordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CctvLiveViewCoordinator.d.ts","sourceRoot":"","sources":["../src/CctvLiveViewCoordinator.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,MAAM,WAAW,mBAAmB;IAAG,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE;AAChG,MAAM,WAAW,eAAe;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AACvE,MAAM,WAAW,sBAAsB;IAAG,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AACnI,MAAM,WAAW,cAAc;IAAG,OAAO,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE;AAC7G,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IAAC,uBAAuB,EAAE,MAAM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