@trillboards/edge-sdk 0.2.158 → 0.2.160
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 +17 -0
- package/deploy/windows/build-windows.ps1 +1 -0
- package/deploy/windows/ci/test-local-ai-diagnostic.ps1 +213 -0
- package/deploy/windows/ci/test-published-install.ps1 +243 -0
- package/deploy/windows/install-update.ps1 +124 -15
- package/deploy/windows/installer.nsi +19 -1
- package/deploy/windows/register-detector-task.ps1 +25 -24
- package/deploy/windows/register-litertlm-task.ps1 +29 -34
- package/deploy/windows/register-task.ps1 +26 -3
- package/deploy/windows/setup-detector.ps1 +20 -34
- package/deploy/windows/setup-litertlm.ps1 +170 -30
- package/deploy/windows/stop-existing.ps1 +62 -3
- package/deploy/windows/stop-local-ai.ps1 +256 -0
- package/deploy/windows/trillboards-hidden-run.vbs +17 -2
- package/dist/EdgeAgent.js +1 -1
- package/dist/LiteRtVlmProvider.d.ts +6 -3
- package/dist/LiteRtVlmProvider.d.ts.map +1 -1
- package/dist/LiteRtVlmProvider.js +12 -5
- package/dist/LiteRtVlmProvider.js.map +1 -1
- package/dist/diagnose.d.ts +1 -1
- package/dist/diagnose.js +1 -1
- package/dist/gemmaModelOta.d.ts +3 -1
- package/dist/gemmaModelOta.d.ts.map +1 -1
- package/dist/gemmaModelOta.js +18 -8
- package/dist/gemmaModelOta.js.map +1 -1
- package/package.json +1 -1
package/deploy/windows/README.md
CHANGED
|
@@ -61,6 +61,23 @@ serves every Windows 10/11 — no per-arch builds.
|
|
|
61
61
|
standard user, who is never prompted because they could not satisfy it — keeps
|
|
62
62
|
a working task that repeats every 5 minutes but still needs someone logged on.
|
|
63
63
|
|
|
64
|
+
## Release installation qualification
|
|
65
|
+
|
|
66
|
+
The existing Windows release job installs the complete signed candidate in a
|
|
67
|
+
fresh GitHub-hosted Windows profile before publishing. It requires successful
|
|
68
|
+
setup, the expected installed version, image inference, hidden supervised model
|
|
69
|
+
and detector tasks, repeat installation, both service restarts and supported
|
|
70
|
+
uninstall. The wrapper launch proof remains separate. JSON and logs are retained
|
|
71
|
+
without uploading the installer or model again.
|
|
72
|
+
|
|
73
|
+
To verify the public download afterward, dispatch release-connector-windows.yml
|
|
74
|
+
with dry_run=true and verify_published_release set to the exact live version.
|
|
75
|
+
That mode uses the existing real-model E2E job and skips build/publication. The
|
|
76
|
+
same full-install harness validates the public manifest, package hash and both
|
|
77
|
+
trusted signatures before installation. It refuses laptop, client-PC and
|
|
78
|
+
non-hosted-runner execution. Headless CI does not establish visible desktop
|
|
79
|
+
behavior, physical reboot, account pairing or the site's actual camera network.
|
|
80
|
+
|
|
64
81
|
## Build (CI: `release-connector-windows.yml`, runs on `windows-latest`)
|
|
65
82
|
|
|
66
83
|
```powershell
|
|
@@ -209,6 +209,7 @@ Copy-Item -Force "$Here\run-connector.ps1" "$Payload\bin\run-connector.ps1"
|
|
|
209
209
|
Copy-Item -Force "$Here\register-task.ps1" "$Payload\bin\register-task.ps1"
|
|
210
210
|
Copy-Item -Force "$Here\enroll-connector.ps1" "$Payload\bin\enroll-connector.ps1"
|
|
211
211
|
Copy-Item -Force "$Here\stop-existing.ps1" "$Payload\bin\stop-existing.ps1"
|
|
212
|
+
Copy-Item -Force "$Here\stop-local-ai.ps1" "$Payload\bin\stop-local-ai.ps1"
|
|
212
213
|
Copy-Item -Force "$Here\install-update.ps1" "$Payload\bin\install-update.ps1"
|
|
213
214
|
# The in-field updater. Ships in bin\ so an INSTALLED connector can drive its own
|
|
214
215
|
# replacement; being here is also what puts it in the Authenticode signing set,
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<# CI-only controlled investigation, never an installer qualification. #>
|
|
2
|
+
[CmdletBinding()]
|
|
3
|
+
param([Parameter(Mandatory=$true)][string]$PersonFrame)
|
|
4
|
+
$ErrorActionPreference='Stop'
|
|
5
|
+
Set-StrictMode -Version Latest
|
|
6
|
+
if($env:GITHUB_ACTIONS -ne 'true' -or $env:RUNNER_ENVIRONMENT -ne 'github-hosted' -or $env:RUNNER_OS -ne 'Windows' -or $PSVersionTable.PSVersion.Major -lt 7){throw 'Diagnostic requires a fresh hosted Windows runner and PowerShell7'}
|
|
7
|
+
if(-not(Test-Path -LiteralPath $PersonFrame -PathType Leaf)){throw 'Missing committed person fixture'}
|
|
8
|
+
$deploy=Split-Path -Parent $PSScriptRoot
|
|
9
|
+
$modelId='gemma-4-E2B-it.litertlm'
|
|
10
|
+
$modelSha='ab7838cdfc8f77e54d8ca45eadceb20452d9f01e4bfade03e5dce27911b27e42'
|
|
11
|
+
$litertVersion='0.16.0'
|
|
12
|
+
foreach($name in @('TrillboardsEdge','TrillboardsLiteRtLm','TrillboardsDetector')){
|
|
13
|
+
$taskErrors=@();$task=Get-ScheduledTask -TaskName $name -TaskPath '\' -ErrorAction SilentlyContinue -ErrorVariable taskErrors
|
|
14
|
+
if($task -or @($taskErrors|Where-Object{$_.CategoryInfo.Category -ne 'ObjectNotFound'}).Count){throw 'Diagnostic requires an empty task baseline'}
|
|
15
|
+
}
|
|
16
|
+
foreach($path in @((Join-Path $env:USERPROFILE '.litert-lm'),(Join-Path $env:USERPROFILE '.local\bin\litert-lm.exe'))){if(Test-Path -LiteralPath $path){throw 'Diagnostic requires an empty runtime profile'}}
|
|
17
|
+
if(Get-NetTCPConnection -LocalPort 9379 -State Listen -ErrorAction SilentlyContinue){throw 'Diagnostic port is occupied'}
|
|
18
|
+
$tempPrefix=[IO.Path]::GetFullPath($env:RUNNER_TEMP).TrimEnd('\')+'\'
|
|
19
|
+
$root=[IO.Path]::GetFullPath((Join-Path $env:RUNNER_TEMP ('tb-ai-diagnostic-'+[Guid]::NewGuid().ToString('N'))))
|
|
20
|
+
if(-not $root.StartsWith($tempPrefix,[StringComparison]::OrdinalIgnoreCase) -or (Test-Path -LiteralPath $root)){throw 'Unverified diagnostic root'}
|
|
21
|
+
New-Item -ItemType Directory -Path $root|Out-Null
|
|
22
|
+
$receipt=[ordered]@{atUtc=[DateTimeOffset]::UtcNow.ToString('o');head=$env:GITHUB_SHA;installationQualified=$false;diagnosticCompleted=$false;arms=@();phase='bootstrap';probeTimeoutSeconds=90}
|
|
23
|
+
$started=Get-Date
|
|
24
|
+
$powershell=Join-Path $env:WINDIR 'System32\WindowsPowerShell\v1.0\powershell.exe'
|
|
25
|
+
$litertPath=Join-Path $env:USERPROFILE '.local\bin\litert-lm.exe'
|
|
26
|
+
$stage=Join-Path $root 'source-runtime'
|
|
27
|
+
New-Item -ItemType Directory -Path $stage|Out-Null
|
|
28
|
+
function Invoke-DiagnosticProcess {
|
|
29
|
+
param([string]$File,[string[]]$Arguments,[string]$LogName,[int]$TimeoutSeconds)
|
|
30
|
+
$start=[Diagnostics.ProcessStartInfo]::new($File)
|
|
31
|
+
$start.UseShellExecute=$false;$start.CreateNoWindow=$true;$start.WindowStyle='Hidden'
|
|
32
|
+
$start.RedirectStandardOutput=$true;$start.RedirectStandardError=$true
|
|
33
|
+
$null=$start.Environment.Remove('PSModulePath')
|
|
34
|
+
foreach($argument in $Arguments){$start.ArgumentList.Add($argument)}
|
|
35
|
+
$process=[Diagnostics.Process]::new();$process.StartInfo=$start
|
|
36
|
+
try{
|
|
37
|
+
if(-not $process.Start()){throw 'Diagnostic child did not start'}
|
|
38
|
+
$stdout=$process.StandardOutput.ReadToEndAsync();$stderr=$process.StandardError.ReadToEndAsync()
|
|
39
|
+
if(-not $process.WaitForExit($TimeoutSeconds*1000)){$process.Kill($true);$process.WaitForExit();throw ('Diagnostic command deadline: '+$LogName)}
|
|
40
|
+
$text=$stdout.GetAwaiter().GetResult()+[Environment]::NewLine+$stderr.GetAwaiter().GetResult()
|
|
41
|
+
[IO.File]::WriteAllText((Join-Path $root $LogName),$text,[Text.UTF8Encoding]::new($false))
|
|
42
|
+
if($process.ExitCode -ne 0){throw ('Diagnostic command failed: '+$LogName+' exit '+$process.ExitCode)}
|
|
43
|
+
return $text
|
|
44
|
+
}finally{$process.Dispose()}
|
|
45
|
+
}
|
|
46
|
+
function Wait-DiagnosticModel {
|
|
47
|
+
$deadline=[DateTimeOffset]::UtcNow.AddSeconds(60)
|
|
48
|
+
do{
|
|
49
|
+
try{$models=Invoke-RestMethod -Uri 'http://127.0.0.1:9379/v1/models' -TimeoutSec 3;if(@($models.data|Where-Object{$_.id -eq $modelId}).Count -eq 1){return}}catch{}
|
|
50
|
+
Start-Sleep -Seconds 2
|
|
51
|
+
}while([DateTimeOffset]::UtcNow -lt $deadline)
|
|
52
|
+
throw 'Diagnostic model control route did not answer'
|
|
53
|
+
}
|
|
54
|
+
function Stop-DiagnosticModel {
|
|
55
|
+
if(Get-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -TaskPath '\' -ErrorAction SilentlyContinue){
|
|
56
|
+
$null=Invoke-DiagnosticProcess $powershell @('-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-File',(Join-Path $stage 'stop-local-ai.ps1'),'-Service','Model') 'stop-model.log' 90
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
try{
|
|
60
|
+
$cpu=Get-CimInstance Win32_Processor|Select-Object Name,NumberOfCores,NumberOfLogicalProcessors
|
|
61
|
+
$receipt.hardware=@{cpu=@($cpu);memoryBytes=(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory}
|
|
62
|
+
$manifest=Invoke-RestMethod -Uri 'https://screen.trillboards.com/connector/trillboards-connector-windows.version.json' -Headers @{'Cache-Control'='no-cache'} -TimeoutSec 30
|
|
63
|
+
if($manifest.downloadUrl -ne 'https://screen.trillboards.com/connector/SenseAnythingConnector.exe' -or $manifest.sha256 -notmatch '^[a-f0-9]{64}$' -or $manifest.sizeBytes -lt 2GB -or $manifest.sizeBytes -gt 4GB){throw 'Unexpected public model carrier'}
|
|
64
|
+
$outer=Join-Path $root 'customer-model-carrier.exe'
|
|
65
|
+
Invoke-WebRequest -Uri $manifest.downloadUrl -OutFile $outer -TimeoutSec 1200
|
|
66
|
+
if((Get-Item -LiteralPath $outer).Length -ne $manifest.sizeBytes -or (Get-FileHash -LiteralPath $outer -Algorithm SHA256).Hash -ine $manifest.sha256){throw 'Model carrier does not match its manifest'}
|
|
67
|
+
$signature=Get-AuthenticodeSignature -LiteralPath $outer
|
|
68
|
+
if($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch '(?:^|,\s*)CN=Aethercorp Inc(?:,|$)'){throw 'Untrusted model carrier'}
|
|
69
|
+
$receipt.modelCarrier=@{version=$manifest.connectorVersion;sha256=$manifest.sha256;signature='Valid'}
|
|
70
|
+
$payload=Join-Path $root 'model-payload'
|
|
71
|
+
$null=Invoke-DiagnosticProcess (Get-Command 7z.exe -ErrorAction Stop).Source @('x',$outer,('-o'+$payload),'-y',$modelId) 'extract-model.log' 300
|
|
72
|
+
Remove-Item -LiteralPath $outer -Force
|
|
73
|
+
$model=Join-Path $payload $modelId
|
|
74
|
+
if((Get-FileHash -LiteralPath $model -Algorithm SHA256).Hash -ine $modelSha){throw 'Unexpected extracted model bytes'}
|
|
75
|
+
$localBin=Join-Path $env:USERPROFILE '.local\bin'
|
|
76
|
+
$env:PATH=$localBin+';'+$env:PATH
|
|
77
|
+
if(-not(Get-Command uv.exe -ErrorAction SilentlyContinue)){
|
|
78
|
+
# The vendor script declares $receipt. Run it in a child process so it
|
|
79
|
+
# cannot replace this diagnostic's receipt or other caller variables.
|
|
80
|
+
$uvBootstrap=Join-Path $root 'install-uv.ps1'
|
|
81
|
+
Invoke-WebRequest -Uri 'https://astral.sh/uv/install.ps1' -OutFile $uvBootstrap -TimeoutSec 30
|
|
82
|
+
$null=Invoke-DiagnosticProcess $powershell @('-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-File',$uvBootstrap) 'install-uv.log' 180
|
|
83
|
+
}
|
|
84
|
+
$uv=(Get-Command uv.exe -ErrorAction Stop).Source
|
|
85
|
+
$null=Invoke-DiagnosticProcess $uv @('tool','install','--python','3.12','--managed-python','--force',('litert-lm=='+$litertVersion)) 'install-runtime.log' 300
|
|
86
|
+
foreach($name in @('register-litertlm-task.ps1','stop-local-ai.ps1','trillboards-hidden-run.vbs')){Copy-Item -LiteralPath (Join-Path $deploy $name) -Destination (Join-Path $stage $name)}
|
|
87
|
+
Copy-Item -LiteralPath (Join-Path $deploy '..\litertlm\trillboards_litertlm_shim.py') -Destination (Join-Path $stage 'trillboards_litertlm_shim.py')
|
|
88
|
+
$setup=Join-Path $deploy 'setup-litertlm.ps1'
|
|
89
|
+
$tokens=$null;$errors=$null;$ast=[Management.Automation.Language.Parser]::ParseFile($setup,[ref]$tokens,[ref]$errors)
|
|
90
|
+
if($errors){throw 'Source setup did not parse'}
|
|
91
|
+
$definitions=@()
|
|
92
|
+
foreach($name in @('Invoke-LitertlmShimNative','Get-LitertlmShimPaths','Get-LitertlmShimFiles','Get-ShimBytesHash','Install-LitertlmShim','Get-LitertlmConfigPath','Write-LitertlmConfig','Test-LitertlmVision')){
|
|
93
|
+
$definition=$ast.Find({param($node)$node -is [Management.Automation.Language.FunctionDefinitionAst] -and $node.Name -eq $name},$true)
|
|
94
|
+
if(-not $definition){throw ('Missing source diagnostic boundary: '+$name)}
|
|
95
|
+
# Bound this PRIVATE diagnostic control; the shipped 180-second probe is unchanged.
|
|
96
|
+
$definitions+=$definition.Extent.Text.Replace('-TimeoutSec 180','-TimeoutSec 90')
|
|
97
|
+
}
|
|
98
|
+
$probeAssignment=@($ast.EndBlock.Statements|Where-Object{$_ -is [Management.Automation.Language.AssignmentStatementAst] -and $_.Left.Extent.Text -eq '$script:LitertlmProbeJpegB64'})
|
|
99
|
+
if($probeAssignment.Count -ne 1){throw 'Missing actual installer image fixture'}
|
|
100
|
+
$bootstrapHeader=@'
|
|
101
|
+
param([string]$Mode,[string]$UvPath,[string]$ModelPath,[string]$ExpectedSha)
|
|
102
|
+
$ErrorActionPreference='Stop'
|
|
103
|
+
$ModelId='gemma-4-E2B-it.litertlm';$Port='9379';$BundledModelSha256=$ExpectedSha
|
|
104
|
+
$LitertDir=Join-Path $env:USERPROFILE '.litert-lm'
|
|
105
|
+
$logDir=Join-Path $env:LOCALAPPDATA 'Trillboards\logs'
|
|
106
|
+
New-Item -ItemType Directory -Force -Path $logDir|Out-Null
|
|
107
|
+
$LogPath=Join-Path $logDir 'ci-runtime-bootstrap.log'
|
|
108
|
+
function Log([string]$Message){Write-Host $Message}
|
|
109
|
+
'@
|
|
110
|
+
$bootstrapBody=@'
|
|
111
|
+
if($Mode -eq 'Bootstrap'){
|
|
112
|
+
if(-not(Install-LitertlmShim -UvPath $UvPath)){throw 'Actual source adapter did not install'}
|
|
113
|
+
$ErrorActionPreference='Continue'
|
|
114
|
+
& (Join-Path $env:USERPROFILE '.local\bin\litert-lm.exe') import $ModelPath $ModelId *>> $LogPath
|
|
115
|
+
if($LASTEXITCODE -ne 0){throw 'Diagnostic model import failed'}
|
|
116
|
+
$ErrorActionPreference='Stop'
|
|
117
|
+
if((Get-FileHash -LiteralPath (Join-Path $LitertDir ('models\'+$ModelId+'\model.litertlm')) -Algorithm SHA256).Hash -ine $ExpectedSha){throw 'Imported model differs from source'}
|
|
118
|
+
if(-not(Write-LitertlmConfig -SpeculativeDecoding $false)){throw 'Diagnostic CPU config write failed'}
|
|
119
|
+
Get-LitertlmShimPaths $UvPath|ConvertTo-Json -Compress
|
|
120
|
+
}elseif($Mode -eq 'Probe'){
|
|
121
|
+
[pscustomobject]@{installerProbePassed=[bool](Test-LitertlmVision -InferenceModel $ModelId)}|ConvertTo-Json -Compress
|
|
122
|
+
}else{throw 'Unknown private bootstrap action'}
|
|
123
|
+
'@
|
|
124
|
+
$bootstrap=Join-Path $stage 'diagnostic-bootstrap.ps1'
|
|
125
|
+
[IO.File]::WriteAllText($bootstrap,(@($bootstrapHeader)+$definitions+@($probeAssignment[0].Extent.Text,$bootstrapBody)-join [Environment]::NewLine),[Text.UTF8Encoding]::new($false))
|
|
126
|
+
$bootstrapOutput=Invoke-DiagnosticProcess $powershell @('-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-File',$bootstrap,'-Mode','Bootstrap','-UvPath',$uv,'-ModelPath',$model,'-ExpectedSha',$modelSha) 'bootstrap.log' 600
|
|
127
|
+
$paths=(($bootstrapOutput -split '\r?\n'|Where-Object{$_.StartsWith('{"Source":') -or $_.StartsWith('{"Python":')}|Select-Object -Last 1)|ConvertFrom-Json)
|
|
128
|
+
if(-not $paths.Site -or -not(Test-Path -LiteralPath $paths.Site -PathType Container)){throw 'Diagnostic could not resolve installed runtime site'}
|
|
129
|
+
$receipt.phase='controlled-inference'
|
|
130
|
+
$captureInstalled=$false;$caseNumber=0
|
|
131
|
+
foreach($capture in @($false,$true,$false)){
|
|
132
|
+
$caseNumber++;$label=([string]$caseNumber)+'-'+$capture
|
|
133
|
+
Stop-DiagnosticModel
|
|
134
|
+
if(-not $capture -and $captureInstalled){
|
|
135
|
+
# Remove only the two files this diagnostic introduced in its CI venv.
|
|
136
|
+
Remove-Item -LiteralPath (Join-Path $paths.Site '00_trillboards_ci_service_capture.pth') -Force
|
|
137
|
+
Remove-Item -LiteralPath (Join-Path $paths.Site 'trillboards_ci_service_capture.py') -Force
|
|
138
|
+
$captureInstalled=$false
|
|
139
|
+
}
|
|
140
|
+
if($capture){
|
|
141
|
+
# Instrumentation lives ONLY in this disposable CI venv. The installed
|
|
142
|
+
# task action, S4U principal and source adapter remain identical.
|
|
143
|
+
$logger=@'
|
|
144
|
+
import os, sys
|
|
145
|
+
if sys.platform == "win32" and "serve" in sys.argv[1:]:
|
|
146
|
+
import ctypes, msvcrt, faulthandler
|
|
147
|
+
from pathlib import Path
|
|
148
|
+
_directory = Path(os.environ["LOCALAPPDATA"]) / "Trillboards" / "logs"
|
|
149
|
+
_directory.mkdir(parents=True, exist_ok=True)
|
|
150
|
+
_log = open(_directory / "litertlm-ci-service.log", "ab", buffering=0)
|
|
151
|
+
os.dup2(_log.fileno(), 1)
|
|
152
|
+
os.dup2(_log.fileno(), 2)
|
|
153
|
+
_kernel = ctypes.WinDLL("kernel32", use_last_error=True)
|
|
154
|
+
_kernel.SetStdHandle.argtypes = [ctypes.c_uint32, ctypes.c_void_p]
|
|
155
|
+
_kernel.SetStdHandle.restype = ctypes.c_int
|
|
156
|
+
for _fd, _identifier in ((1, -11), (2, -12)):
|
|
157
|
+
if not _kernel.SetStdHandle(ctypes.c_uint32(_identifier), ctypes.c_void_p(msvcrt.get_osfhandle(_fd))):
|
|
158
|
+
raise ctypes.WinError(ctypes.get_last_error())
|
|
159
|
+
# Retain the old objects so replacing a stream cannot close its remapped fd.
|
|
160
|
+
_prior_streams = (sys.stdout, sys.stderr)
|
|
161
|
+
sys.stdout = open(1, "w", buffering=1, encoding="utf-8", errors="backslashreplace", closefd=False)
|
|
162
|
+
sys.stderr = open(2, "w", buffering=1, encoding="utf-8", errors="backslashreplace", closefd=False)
|
|
163
|
+
faulthandler.enable(file=_log, all_threads=True)
|
|
164
|
+
faulthandler.dump_traceback_later(45, repeat=True, file=_log)
|
|
165
|
+
print("[CI diagnostic] redirected Win32 and CRT stdout/stderr; argv=" + repr(sys.argv), file=sys.stderr, flush=True)
|
|
166
|
+
'@
|
|
167
|
+
foreach($name in @('trillboards_ci_service_capture.py','00_trillboards_ci_service_capture.pth')){
|
|
168
|
+
if(Test-Path -LiteralPath (Join-Path $paths.Site $name)){throw 'Preserve an unexpected pre-existing diagnostic addon'}
|
|
169
|
+
}
|
|
170
|
+
[IO.File]::WriteAllText((Join-Path $paths.Site 'trillboards_ci_service_capture.py'),$logger,[Text.UTF8Encoding]::new($false))
|
|
171
|
+
[IO.File]::WriteAllText((Join-Path $paths.Site '00_trillboards_ci_service_capture.pth'),('import trillboards_ci_service_capture'+[Environment]::NewLine),[Text.UTF8Encoding]::new($false))
|
|
172
|
+
}
|
|
173
|
+
if($capture){$captureInstalled=$true}
|
|
174
|
+
$arm=[ordered]@{label=$label;capturedStdio=$capture;installerProbePassed=$false;personProbePassed=$false}
|
|
175
|
+
try{
|
|
176
|
+
$null=Invoke-DiagnosticProcess $powershell @('-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-File',(Join-Path $stage 'register-litertlm-task.ps1'),'-LitertLmPath',$litertPath,'-Port','9379') ('register-'+$label+'.log') 90
|
|
177
|
+
Wait-DiagnosticModel
|
|
178
|
+
$task=Get-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -TaskPath '\' -ErrorAction Stop
|
|
179
|
+
$arm.task=@{principal=[string]$task.Principal.LogonType;state=[string]$task.State;execute=[string]$task.Actions[0].Execute;arguments=[string]$task.Actions[0].Arguments}
|
|
180
|
+
try{
|
|
181
|
+
$probe=Invoke-DiagnosticProcess $powershell @('-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-File',$bootstrap,'-Mode','Probe','-UvPath',$uv,'-ExpectedSha',$modelSha) ('installer-probe-'+$label+'.log') 120
|
|
182
|
+
$probeResult=(($probe -split '\r?\n'|Where-Object{$_.StartsWith('{"installerProbePassed":')}|Select-Object -Last 1)|ConvertFrom-Json)
|
|
183
|
+
$arm.installerProbePassed=$probeResult.installerProbePassed
|
|
184
|
+
}catch{$arm.installerProbeError=$_.Exception.Message}
|
|
185
|
+
try{
|
|
186
|
+
$image=[Convert]::ToBase64String([IO.File]::ReadAllBytes($PersonFrame))
|
|
187
|
+
$body=@{model=$modelId;max_completion_tokens=256;temperature=0;messages=@(@{role='user';content=@(@{type='text';text='Is a person visible? Answer YES or NO.'},@{type='image_url';image_url=@{url=('data:image/jpeg;base64,'+$image)}})})}|ConvertTo-Json -Depth 10
|
|
188
|
+
$answer=Invoke-RestMethod -Uri 'http://127.0.0.1:9379/v1/chat/completions' -Method Post -ContentType 'application/json' -Headers @{'X-Trillboards-Model-Sha256'=$modelSha} -Body $body -TimeoutSec 90
|
|
189
|
+
$arm.personInferenceAnswered=$true
|
|
190
|
+
$arm.personProbePassed=([string]$answer.choices[0].message.content -match '(?i)\byes\b' -and $answer.runtimeModel.sha256 -eq $modelSha)
|
|
191
|
+
$answer|ConvertTo-Json -Depth 8|Set-Content -LiteralPath (Join-Path $root ('person-response-'+$label+'.json'))
|
|
192
|
+
}catch{$arm.personProbeError=$_.Exception.Message}
|
|
193
|
+
}catch{$arm.error=$_.Exception.Message}
|
|
194
|
+
finally{
|
|
195
|
+
$arm.processes=@(Get-CimInstance Win32_Process -Filter "Name = 'python.exe'"|Select-Object ProcessId,ParentProcessId,WorkingSetSize,PrivatePageCount,CommandLine)
|
|
196
|
+
try{$arm.taskInfo=Get-ScheduledTaskInfo -TaskName 'TrillboardsLiteRtLm' -TaskPath '\'|Select-Object LastRunTime,LastTaskResult,NumberOfMissedRuns}catch{}
|
|
197
|
+
try{Stop-DiagnosticModel}catch{$arm.stopError=$_.Exception.Message}
|
|
198
|
+
$receipt.arms+=@([pscustomobject]$arm)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
$receipt.diagnosticCompleted=$true;$receipt.phase='complete'
|
|
202
|
+
}catch{$receipt.failure=$_.Exception.Message;throw}
|
|
203
|
+
finally{
|
|
204
|
+
try{Stop-DiagnosticModel}catch{$receipt.cleanupFailure=$_.Exception.Message}
|
|
205
|
+
try{Get-WinEvent -FilterHashtable @{LogName='Application';StartTime=$started} -MaxEvents 100 -ErrorAction Stop|Where-Object{$_.ProviderName -match 'Application Error|Windows Error Reporting'}|Select-Object TimeCreated,ProviderName,Id,Message|ConvertTo-Json -Depth 5|Set-Content -LiteralPath (Join-Path $root 'application-events.json')}catch{}
|
|
206
|
+
try{$logs=Join-Path $env:LOCALAPPDATA 'Trillboards\logs';if(Test-Path -LiteralPath $logs){Copy-Item -LiteralPath $logs -Destination (Join-Path $root 'product-logs') -Recurse -Force}}catch{$receipt.logCopyFailure=$_.Exception.Message}
|
|
207
|
+
$receipt.completedAtUtc=[DateTimeOffset]::UtcNow.ToString('o')
|
|
208
|
+
$receipt|ConvertTo-Json -Depth 12|Set-Content -LiteralPath (Join-Path $root 'diagnostic.json')
|
|
209
|
+
if($env:GITHUB_OUTPUT){('artifact_path='+$root)|Out-File -LiteralPath $env:GITHUB_OUTPUT -Encoding utf8 -Append}
|
|
210
|
+
$receipt|ConvertTo-Json -Depth 12
|
|
211
|
+
}
|
|
212
|
+
# A controlled runtime diagnosis never clears the product installer gate.
|
|
213
|
+
if(@($receipt.arms|Where-Object{-not $_.installerProbePassed -or -not $_.personProbePassed}).Count){exit 1}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<#
|
|
2
|
+
Real customer-package qualification before publication and in the public-download E2E. Execute only on a fresh
|
|
3
|
+
GitHub-hosted Windows runner. This deliberately installs real local AI.
|
|
4
|
+
The parent uses PowerShell 7; the customer installer runs its shipped PS5.1
|
|
5
|
+
setup scripts. Do not run on the owner's laptop or the Dallas client PC.
|
|
6
|
+
#>
|
|
7
|
+
[CmdletBinding()]
|
|
8
|
+
param(
|
|
9
|
+
[Parameter(Mandatory = $true)][ValidatePattern('^0\.2\.[0-9]+$')][string]$ExpectedVersion,
|
|
10
|
+
[Parameter(Mandatory = $true)][string]$PersonFrame,
|
|
11
|
+
[string]$CustomerPackagePath = '',
|
|
12
|
+
[string]$ManifestPath = '',
|
|
13
|
+
[ValidateSet('Native','Inherited')][string]$PowerShellModuleEnvironment = 'Native'
|
|
14
|
+
)
|
|
15
|
+
$ErrorActionPreference = 'Stop'
|
|
16
|
+
Set-StrictMode -Version Latest
|
|
17
|
+
if ($env:GITHUB_ACTIONS -ne 'true' -or $env:RUNNER_OS -ne 'Windows' -or
|
|
18
|
+
$env:RUNNER_ENVIRONMENT -ne 'github-hosted' -or $PSVersionTable.PSVersion.Major -lt 7) {
|
|
19
|
+
throw 'Real installation qualification requires a fresh GitHub-hosted Windows runner and PowerShell 7'
|
|
20
|
+
}
|
|
21
|
+
if (-not (Test-Path -LiteralPath $PersonFrame -PathType Leaf)) { throw 'Missing committed person-image fixture' }
|
|
22
|
+
if ($env:TRILLBOARDS_BUNDLE_RELEASE_SMOKE_MARKER) { throw 'The no-install smoke marker must be absent' }
|
|
23
|
+
$taskNames = @('TrillboardsEdge', 'TrillboardsLiteRtLm', 'TrillboardsDetector')
|
|
24
|
+
foreach ($name in $taskNames) {
|
|
25
|
+
$taskErrors = @()
|
|
26
|
+
$task = Get-ScheduledTask -TaskName $name -TaskPath '\' -ErrorAction SilentlyContinue -ErrorVariable taskErrors
|
|
27
|
+
if ($task -or @($taskErrors | Where-Object { $_.CategoryInfo.Category -ne 'ObjectNotFound' }).Count) {
|
|
28
|
+
throw ('Cannot establish an empty scheduled-task baseline: ' + $name)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
foreach ($path in @((Join-Path $env:LOCALAPPDATA 'Trillboards\edge'), (Join-Path $env:USERPROFILE '.litert-lm'),
|
|
32
|
+
(Join-Path $env:USERPROFILE '.local\bin\litert-lm.exe'), (Join-Path $env:USERPROFILE '.local\bin\trillboards-detector.exe'))) {
|
|
33
|
+
if (Test-Path -LiteralPath $path) { throw ('The CI profile already contains connector state: ' + $path) }
|
|
34
|
+
}
|
|
35
|
+
foreach ($port in @(9379, 9380)) {
|
|
36
|
+
if (Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue) {
|
|
37
|
+
throw ('The CI machine already has a listener on the local AI port: ' + $port)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
$tempRoot = [IO.Path]::GetFullPath($env:RUNNER_TEMP).TrimEnd('\') + '\'
|
|
41
|
+
$root = [IO.Path]::GetFullPath((Join-Path $env:RUNNER_TEMP ('tb-published-install-' + [Guid]::NewGuid().ToString('N'))))
|
|
42
|
+
if (-not $root.StartsWith($tempRoot, [StringComparison]::OrdinalIgnoreCase) -or (Test-Path -LiteralPath $root)) {
|
|
43
|
+
throw 'Qualification needs a new, verified runner-temp child'
|
|
44
|
+
}
|
|
45
|
+
New-Item -ItemType Directory -Path $root | Out-Null
|
|
46
|
+
$installDir = Join-Path $root 'installed'
|
|
47
|
+
$receipt = [ordered]@{ atUtc = [DateTimeOffset]::UtcNow.ToString('o'); expectedVersion = $ExpectedVersion;
|
|
48
|
+
githubRunId = $env:GITHUB_RUN_ID; passed = $false; phase = 'manifest'; freshProfile = $true;
|
|
49
|
+
fullInstallerExecuted = $false; desktopVisibilityObserved = $false; rebootTested = $false;
|
|
50
|
+
installerModuleEnvironment = $PowerShellModuleEnvironment }
|
|
51
|
+
|
|
52
|
+
function Invoke-QualificationProcess {
|
|
53
|
+
param([string]$File, [string[]]$Arguments = @(), [string]$RawArguments = '', [string]$LogName, [int]$TimeoutSeconds, [switch]$InheritPowerShellModulePath)
|
|
54
|
+
$start = [Diagnostics.ProcessStartInfo]::new($File)
|
|
55
|
+
$start.UseShellExecute = $false; $start.CreateNoWindow = $true; $start.WindowStyle = 'Hidden'
|
|
56
|
+
$start.RedirectStandardOutput = $true; $start.RedirectStandardError = $true
|
|
57
|
+
# Native probes start like Explorer; the candidate gate deliberately keeps
|
|
58
|
+
# the Core path for installer/uninstaller launches to exercise their reset.
|
|
59
|
+
if (-not $InheritPowerShellModulePath) { $null = $start.Environment.Remove('PSModulePath') }
|
|
60
|
+
if ($RawArguments) { $start.Arguments = $RawArguments } else { foreach ($argument in $Arguments) { $start.ArgumentList.Add($argument) } }
|
|
61
|
+
$process = [Diagnostics.Process]::new(); $process.StartInfo = $start
|
|
62
|
+
$watch = [Diagnostics.Stopwatch]::StartNew()
|
|
63
|
+
try {
|
|
64
|
+
if (-not $process.Start()) { throw ('Could not start ' + $LogName) }
|
|
65
|
+
$stdout = $process.StandardOutput.ReadToEndAsync(); $stderr = $process.StandardError.ReadToEndAsync()
|
|
66
|
+
$timedOut = $false
|
|
67
|
+
while (-not $process.WaitForExit(20000)) {
|
|
68
|
+
Write-Host ('Running ' + $LogName + ': ' + [int]$watch.Elapsed.TotalSeconds + ' seconds')
|
|
69
|
+
if ($watch.Elapsed.TotalSeconds -ge $TimeoutSeconds) {
|
|
70
|
+
$process.Kill($true); $process.WaitForExit()
|
|
71
|
+
$timedOut = $true
|
|
72
|
+
break
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
$output = $stdout.GetAwaiter().GetResult() + "`n" + $stderr.GetAwaiter().GetResult()
|
|
76
|
+
[IO.File]::WriteAllText((Join-Path $root $LogName), $output, [Text.UTF8Encoding]::new($false))
|
|
77
|
+
if ($timedOut) { throw ('Owned CI command exceeded its deadline: ' + $LogName) }
|
|
78
|
+
if ($process.ExitCode -ne 0) { throw ($LogName + ' failed with exit ' + $process.ExitCode) }
|
|
79
|
+
return $output
|
|
80
|
+
} finally { $process.Dispose() }
|
|
81
|
+
}
|
|
82
|
+
function Invoke-InstalledUninstaller {
|
|
83
|
+
param([string]$InstallDir, [string]$RunRoot, [switch]$InheritPowerShellModulePath)
|
|
84
|
+
$installedUninstaller = Join-Path $InstallDir 'uninstall.exe'
|
|
85
|
+
$uninstaller = [IO.Path]::GetFullPath((Join-Path $RunRoot 'qualify-uninstall.exe'))
|
|
86
|
+
$installPrefix = [IO.Path]::GetFullPath($InstallDir).TrimEnd('\') + '\'
|
|
87
|
+
if ($uninstaller.StartsWith($installPrefix, [StringComparison]::OrdinalIgnoreCase)) {
|
|
88
|
+
throw 'Synchronous uninstall qualification must execute outside the installation directory'
|
|
89
|
+
}
|
|
90
|
+
# _?= suppresses NSIS's normal temporary copy so we can wait for the real
|
|
91
|
+
# exit status. Make that same copy ourselves: stop-existing owns executables
|
|
92
|
+
# under InstallDir and would otherwise terminate this in-place uninstaller.
|
|
93
|
+
Copy-Item -LiteralPath $installedUninstaller -Destination $uninstaller -ErrorAction Stop
|
|
94
|
+
$expectedHash = (Get-FileHash -LiteralPath $installedUninstaller -Algorithm SHA256).Hash
|
|
95
|
+
if ((Get-FileHash -LiteralPath $uninstaller -Algorithm SHA256).Hash -ine $expectedHash) {
|
|
96
|
+
throw 'The copied uninstaller differs from the installed customer uninstaller'
|
|
97
|
+
}
|
|
98
|
+
$null = Invoke-QualificationProcess -File $uninstaller -RawArguments ('/S _?=' + $InstallDir) -InheritPowerShellModulePath:$InheritPowerShellModulePath -LogName 'uninstall.log' -TimeoutSeconds 180
|
|
99
|
+
return $expectedHash.ToLowerInvariant()
|
|
100
|
+
}
|
|
101
|
+
function Assert-Publisher([string]$Path) {
|
|
102
|
+
$signature = Get-AuthenticodeSignature -LiteralPath $Path
|
|
103
|
+
if ($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch '(?:^|,\s*)CN=Aethercorp Inc(?:,|$)') {
|
|
104
|
+
throw ('The customer artifact lacks the trusted Aethercorp signature: ' + (Split-Path $Path -Leaf))
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function Assert-HiddenTask([string]$Name) {
|
|
108
|
+
$task = Get-ScheduledTask -TaskName $Name -TaskPath '\' -ErrorAction Stop
|
|
109
|
+
$taskUser = [string]$task.Principal.UserId
|
|
110
|
+
$sid = if ($taskUser -match '^S-1-') { $taskUser } else {
|
|
111
|
+
(New-Object Security.Principal.NTAccount($taskUser)).Translate([Security.Principal.SecurityIdentifier]).Value
|
|
112
|
+
}
|
|
113
|
+
$actions = @($task.Actions)
|
|
114
|
+
$hostPath = Join-Path $installDir 'bin\trillboards-hidden-run.vbs'
|
|
115
|
+
$prefix = '//B //NoLogo "' + $hostPath + '" --wait "'
|
|
116
|
+
if ($sid -ne [Security.Principal.WindowsIdentity]::GetCurrent().User.Value -or -not $task.Settings.Enabled -or $task.State -ne 'Running' -or
|
|
117
|
+
$actions.Count -ne 1 -or [IO.Path]::GetFullPath($actions[0].Execute) -ine (Join-Path $env:WINDIR 'System32\wscript.exe') -or
|
|
118
|
+
-not ([string]$actions[0].Arguments).StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) {
|
|
119
|
+
throw ('The installed local AI task does not use the owned waiting hidden host: ' + $Name)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function Wait-ModelReady {
|
|
123
|
+
$watch = [Diagnostics.Stopwatch]::StartNew()
|
|
124
|
+
do {
|
|
125
|
+
try {
|
|
126
|
+
$models = Invoke-RestMethod -Uri 'http://127.0.0.1:9379/v1/models' -TimeoutSec 5
|
|
127
|
+
if (@($models.data | Where-Object { $_.id -eq 'gemma-4-E2B-it.litertlm' }).Count -eq 1) { return }
|
|
128
|
+
} catch { }
|
|
129
|
+
Start-Sleep -Seconds 2
|
|
130
|
+
} while ($watch.Elapsed.TotalSeconds -lt 120)
|
|
131
|
+
throw 'The installed model endpoint did not become ready'
|
|
132
|
+
}
|
|
133
|
+
function Wait-DetectorAnswer {
|
|
134
|
+
$watch = [Diagnostics.Stopwatch]::StartNew()
|
|
135
|
+
do {
|
|
136
|
+
try {
|
|
137
|
+
$response = Invoke-WebRequest -Uri 'http://127.0.0.1:9380/health' -SkipHttpErrorCheck -TimeoutSec 5
|
|
138
|
+
if ([int]$response.StatusCode -in @(200,503)) { return }
|
|
139
|
+
} catch { }
|
|
140
|
+
Start-Sleep -Seconds 2
|
|
141
|
+
} while ($watch.Elapsed.TotalSeconds -lt 60)
|
|
142
|
+
throw 'The installed detector did not answer after restart'
|
|
143
|
+
}
|
|
144
|
+
function Assert-ImageInference {
|
|
145
|
+
$image = [Convert]::ToBase64String([IO.File]::ReadAllBytes($PersonFrame))
|
|
146
|
+
$body = @{ model = 'gemma-4-E2B-it.litertlm'; max_completion_tokens = 256; temperature = 0;
|
|
147
|
+
messages = @(@{ role = 'user'; content = @(@{ type = 'text'; text = 'Look at the image. Is there a person visible? Answer YES or NO.' },
|
|
148
|
+
@{ type = 'image_url'; image_url = @{ url = ('data:image/jpeg;base64,' + $image) } }) }) } | ConvertTo-Json -Depth 10
|
|
149
|
+
$answer = Invoke-RestMethod -Uri 'http://127.0.0.1:9379/v1/chat/completions' -Method Post -ContentType 'application/json' -Body $body -TimeoutSec 240
|
|
150
|
+
if (@($answer.choices).Count -lt 1 -or [string]$answer.choices[0].message.content -notmatch '(?i)\byes\b') {
|
|
151
|
+
throw 'The installed model did not confirm the person in the committed image fixture'
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
if ([bool]$CustomerPackagePath -ne [bool]$ManifestPath) { throw 'Candidate package and manifest paths must be provided together' }
|
|
156
|
+
$localCandidate = [bool]$CustomerPackagePath
|
|
157
|
+
if ($localCandidate) {
|
|
158
|
+
$manifest = Get-Content -LiteralPath $ManifestPath -Raw | ConvertFrom-Json
|
|
159
|
+
$receipt.artifactSource = 'signed-build-candidate'
|
|
160
|
+
} else {
|
|
161
|
+
$manifest = Invoke-RestMethod -Uri 'https://screen.trillboards.com/connector/trillboards-connector-windows.version.json' -Headers @{ 'Cache-Control' = 'no-cache' } -TimeoutSec 30
|
|
162
|
+
$receipt.artifactSource = 'public-download'
|
|
163
|
+
}
|
|
164
|
+
if ($manifest.platform -ne 'windows-x64' -or $manifest.connectorVersion -ne $ExpectedVersion -or
|
|
165
|
+
$manifest.gitSha -notmatch '^[0-9a-f]{40}$' -or $manifest.sha256 -notmatch '^[0-9a-f]{64}$' -or
|
|
166
|
+
$manifest.sizeBytes -lt 2GB -or $manifest.sizeBytes -gt 4GB -or
|
|
167
|
+
$manifest.downloadUrl -ne 'https://screen.trillboards.com/connector/SenseAnythingConnector.exe') {
|
|
168
|
+
throw 'The live public manifest does not identify the expected complete customer package'
|
|
169
|
+
}
|
|
170
|
+
$manifest | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath (Join-Path $root 'public-manifest.json')
|
|
171
|
+
$receipt.artifactGitSha = $manifest.gitSha; $receipt.phase = 'download'
|
|
172
|
+
if ($localCandidate) {
|
|
173
|
+
$outer = (Resolve-Path -LiteralPath $CustomerPackagePath -ErrorAction Stop).ProviderPath
|
|
174
|
+
} else {
|
|
175
|
+
$outer = Join-Path $root 'SenseAnythingConnector.exe'
|
|
176
|
+
Invoke-WebRequest -Uri $manifest.downloadUrl -OutFile $outer -TimeoutSec 1200
|
|
177
|
+
}
|
|
178
|
+
if ((Get-Item -LiteralPath $outer).Length -ne $manifest.sizeBytes -or
|
|
179
|
+
(Get-FileHash -LiteralPath $outer -Algorithm SHA256).Hash -ine $manifest.sha256) { throw 'Customer package size/hash differs from the pinned manifest' }
|
|
180
|
+
Assert-Publisher $outer
|
|
181
|
+
$receipt.customerSha256 = $manifest.sha256; $receipt.phase = 'extract'
|
|
182
|
+
$payload = Join-Path $root 'customer-payload'
|
|
183
|
+
$sevenZip = (Get-Command 7z.exe -ErrorAction Stop).Source
|
|
184
|
+
$null = Invoke-QualificationProcess -File $sevenZip -Arguments @('x', $outer, ('-o' + $payload), '-y') -LogName 'extract.log' -TimeoutSeconds 300
|
|
185
|
+
$inner = Join-Path $payload 'TrillboardsEdgeSetup-core.exe'
|
|
186
|
+
$model = Join-Path $payload 'gemma-4-E2B-it.litertlm'
|
|
187
|
+
Assert-Publisher $inner
|
|
188
|
+
if (-not (Test-Path -LiteralPath $model -PathType Leaf)) { throw 'The published customer package did not contain its required model' }
|
|
189
|
+
# Keep receipts and logs as CI artifacts, never multi-gigabyte executables.
|
|
190
|
+
# Free the downloaded outer package before importing its extracted model.
|
|
191
|
+
if (-not $localCandidate) { Remove-Item -LiteralPath $outer -Force }
|
|
192
|
+
$installArgs = '/S /MODEL_SOURCE="' + $model + '" /D=' + $installDir
|
|
193
|
+
$receipt.phase = 'fresh-install'; $receipt.fullInstallerExecuted = $true
|
|
194
|
+
$null = Invoke-QualificationProcess -File $inner -RawArguments $installArgs -InheritPowerShellModulePath:($PowerShellModuleEnvironment -eq 'Inherited') -LogName 'fresh-install.log' -TimeoutSeconds 1200
|
|
195
|
+
$node = Join-Path $installDir 'bin\node.exe'; $cli = Join-Path $installDir 'lib\edge-sdk\dist\cli.js'
|
|
196
|
+
$version = Invoke-QualificationProcess -File $node -Arguments @($cli, 'version') -LogName 'installed-version.log' -TimeoutSeconds 30
|
|
197
|
+
if ($version -notmatch ('edge-sdk v' + [regex]::Escape($ExpectedVersion) + '(?:\s|$)')) { throw 'Installed connector version differs from the requested public release' }
|
|
198
|
+
Assert-HiddenTask 'TrillboardsLiteRtLm'; Assert-HiddenTask 'TrillboardsDetector'
|
|
199
|
+
$receipt.phase = 'fresh-install-readiness'
|
|
200
|
+
Wait-ModelReady; Wait-DetectorAnswer
|
|
201
|
+
$receipt.phase = 'fresh-install-inference'
|
|
202
|
+
Assert-ImageInference
|
|
203
|
+
$receipt.freshInstallPassed = $true; $receipt.phase = 'repeat-install'
|
|
204
|
+
$null = Invoke-QualificationProcess -File $inner -RawArguments $installArgs -InheritPowerShellModulePath:($PowerShellModuleEnvironment -eq 'Inherited') -LogName 'repeat-install.log' -TimeoutSeconds 900
|
|
205
|
+
Assert-HiddenTask 'TrillboardsLiteRtLm'; Assert-HiddenTask 'TrillboardsDetector'
|
|
206
|
+
$receipt.phase = 'repeat-install-readiness'
|
|
207
|
+
Wait-ModelReady; Wait-DetectorAnswer
|
|
208
|
+
$receipt.phase = 'repeat-install-inference'
|
|
209
|
+
Assert-ImageInference
|
|
210
|
+
$receipt.repeatInstallPassed = $true; $receipt.phase = 'service-restart'
|
|
211
|
+
$powershell = Join-Path $env:WINDIR 'System32\WindowsPowerShell\v1.0\powershell.exe'
|
|
212
|
+
foreach ($service in @(@{ Name = 'Model'; Task = 'TrillboardsLiteRtLm' }, @{ Name = 'Detector'; Task = 'TrillboardsDetector' })) {
|
|
213
|
+
$null = Invoke-QualificationProcess -File $powershell -Arguments @('-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File',
|
|
214
|
+
(Join-Path $installDir 'bin\stop-local-ai.ps1'), '-Service', $service.Name) -LogName ('stop-' + $service.Name + '.log') -TimeoutSeconds 90
|
|
215
|
+
Enable-ScheduledTask -TaskName $service.Task -TaskPath '\' -ErrorAction Stop | Out-Null
|
|
216
|
+
Start-ScheduledTask -TaskName $service.Task -TaskPath '\' -ErrorAction Stop
|
|
217
|
+
Wait-ModelReady; Wait-DetectorAnswer
|
|
218
|
+
Assert-HiddenTask 'TrillboardsLiteRtLm'; Assert-HiddenTask 'TrillboardsDetector'
|
|
219
|
+
Assert-ImageInference
|
|
220
|
+
}
|
|
221
|
+
$receipt.serviceRestartPassed = $true; $receipt.phase = 'uninstall'
|
|
222
|
+
$receipt.uninstallerSha256 = Invoke-InstalledUninstaller -InstallDir $installDir -RunRoot $root -InheritPowerShellModulePath:($PowerShellModuleEnvironment -eq 'Inherited')
|
|
223
|
+
foreach ($name in $taskNames) {
|
|
224
|
+
if (Get-ScheduledTask -TaskName $name -TaskPath '\' -ErrorAction SilentlyContinue) { throw ('Uninstall left its scheduled task: ' + $name) }
|
|
225
|
+
}
|
|
226
|
+
foreach ($port in @(9379, 9380)) {
|
|
227
|
+
if (Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue) { throw ('Uninstall left its local AI listener: ' + $port) }
|
|
228
|
+
}
|
|
229
|
+
if (Test-Path -LiteralPath $cli -PathType Leaf) { throw 'Uninstall left the installed connector entry point' }
|
|
230
|
+
$receipt.uninstallPassed = $true; $receipt.phase = 'complete'; $receipt.passed = $true
|
|
231
|
+
} catch {
|
|
232
|
+
$receipt.failure = $_.Exception.Message
|
|
233
|
+
throw
|
|
234
|
+
} finally {
|
|
235
|
+
$logDir = Join-Path $env:LOCALAPPDATA 'Trillboards\logs'
|
|
236
|
+
try {
|
|
237
|
+
if (Test-Path -LiteralPath $logDir -PathType Container) { Copy-Item -LiteralPath $logDir -Destination (Join-Path $root 'product-logs') -Recurse -Force }
|
|
238
|
+
} catch { Write-Warning ('Some product logs could not be copied: ' + $_.Exception.Message) }
|
|
239
|
+
$receipt.completedAtUtc = [DateTimeOffset]::UtcNow.ToString('o')
|
|
240
|
+
$receipt | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath (Join-Path $root 'qualification.json')
|
|
241
|
+
if ($env:GITHUB_OUTPUT) { ('artifact_path=' + $root) | Out-File -LiteralPath $env:GITHUB_OUTPUT -Append -Encoding utf8 }
|
|
242
|
+
$receipt | ConvertTo-Json -Depth 8
|
|
243
|
+
}
|