@trillboards/edge-sdk 0.2.157 → 0.2.159
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 +1 -0
- package/deploy/windows/install-update.ps1 +124 -15
- package/deploy/windows/installer.nsi +7 -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 +9 -1
- package/deploy/windows/setup-litertlm.ps1 +84 -10
- package/deploy/windows/stop-existing.ps1 +62 -3
- package/deploy/windows/stop-local-ai.ps1 +138 -0
- package/deploy/windows/trillboards-hidden-run.vbs +17 -2
- package/dist/EdgeAgent.js +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
|
@@ -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,
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Validates a staged connector, stops the running copy, swaps bin/lib, registers
|
|
3
3
|
the new hidden task, and restores the previous runnable version on failure.
|
|
4
4
|
#>
|
|
5
|
-
[CmdletBinding()]
|
|
5
|
+
[CmdletBinding(DefaultParameterSetName = 'Update')]
|
|
6
6
|
param(
|
|
7
7
|
[Parameter(Mandatory = $true)][string]$InstallDir,
|
|
8
|
-
[Parameter(Mandatory = $true)][string]$StagingDir
|
|
8
|
+
[Parameter(Mandatory = $true, ParameterSetName = 'Update')][string]$StagingDir,
|
|
9
|
+
[Parameter(Mandatory = $true, ParameterSetName = 'Restart')][switch]$RestartLocalAi
|
|
9
10
|
)
|
|
10
11
|
|
|
11
12
|
$ErrorActionPreference = "Stop"
|
|
@@ -47,22 +48,29 @@ function Assert-ConnectorVersion([string]$Root) {
|
|
|
47
48
|
|
|
48
49
|
function Register-Connector([string]$Root) {
|
|
49
50
|
$register = Join-Path $Root "bin\register-task.ps1"
|
|
50
|
-
|
|
51
|
+
$registerArgs = @{ InstallDir = $InstallDir; Mode = 'auto-sense' }
|
|
52
|
+
# Rollback may invoke a released registrar without the new switch. Inspect
|
|
53
|
+
# its actual parameter metadata instead of passing an unsupported argument.
|
|
54
|
+
if ((Get-Command -Name $register -ErrorAction Stop).Parameters.ContainsKey('SkipLocalAiRepair')) {
|
|
55
|
+
$registerArgs.SkipLocalAiRepair = $true
|
|
56
|
+
}
|
|
57
|
+
& $register @registerArgs
|
|
51
58
|
if ($LASTEXITCODE -ne 0) { throw "Scheduled-task registration failed." }
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
function Get-OwnedLocalAiProcesses {
|
|
62
|
+
param($Context = $script:modelRuntimeUpdate)
|
|
55
63
|
# Task Scheduler can stop the uv launcher while leaving its Python child
|
|
56
64
|
# alive. Match only this user's model server on the verified task's port;
|
|
57
65
|
# never kill all Python processes or a different user's listener.
|
|
58
|
-
$portPattern = '(?:^|\s)--port(?:\s+|=)' + $
|
|
66
|
+
$portPattern = '(?:^|\s)--port(?:\s+|=)' + $Context.Port + '(?=\s|$)'
|
|
59
67
|
$processes = Get-CimInstance Win32_Process -Filter "Name = 'python.exe' OR Name = 'pythonw.exe' OR Name = 'litert-lm.exe'" -OperationTimeoutSec 5 -ErrorAction Stop
|
|
60
68
|
foreach ($process in $processes) {
|
|
61
69
|
if (-not $process.CommandLine -or $process.CommandLine -notmatch 'litert[-_]lm' -or
|
|
62
70
|
$process.CommandLine -notmatch '(?:^|\s)serve(?=\s|$)' -or $process.CommandLine -notmatch $portPattern) { continue }
|
|
63
71
|
$owner = Invoke-CimMethod -InputObject $process -MethodName GetOwnerSid -OperationTimeoutSec 5 -ErrorAction Stop
|
|
64
72
|
if ($owner.ReturnValue -ne 0 -or -not $owner.Sid) { throw 'Cannot verify the model process owner; no unverified process was stopped' }
|
|
65
|
-
if ($owner.Sid -eq $
|
|
73
|
+
if ($owner.Sid -eq $Context.OwnerSid) { $process }
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
76
|
|
|
@@ -92,7 +100,24 @@ function Restore-LocalAiTaskState {
|
|
|
92
100
|
}
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
function
|
|
103
|
+
function Resolve-BackgroundToolAction($Action, [string]$Root, [string]$ToolName) {
|
|
104
|
+
$wscript = Join-Path $env:WINDIR 'System32\wscript.exe'
|
|
105
|
+
if ([IO.Path]::GetFullPath([string]$Action.Execute) -ine [IO.Path]::GetFullPath($wscript)) { return $Action }
|
|
106
|
+
$hostPath = Join-Path $Root 'bin\trillboards-hidden-run.vbs'
|
|
107
|
+
$prefix = '//B //NoLogo "' + $hostPath + '" --wait "'
|
|
108
|
+
$arguments = [string]$Action.Arguments
|
|
109
|
+
if (-not $arguments.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) { throw 'Cannot verify the hidden service action; no runtime was changed' }
|
|
110
|
+
$tail = $arguments.Substring($prefix.Length)
|
|
111
|
+
$endQuote = $tail.IndexOf('"')
|
|
112
|
+
if ($endQuote -lt 1) { throw 'Cannot verify the hidden service action; no runtime was changed' }
|
|
113
|
+
$tool = $tail.Substring(0, $endQuote)
|
|
114
|
+
$serverArguments = $tail.Substring($endQuote + 1)
|
|
115
|
+
if (-not [IO.Path]::IsPathRooted($tool) -or [IO.Path]::GetFileName($tool) -ine $ToolName -or
|
|
116
|
+
-not $serverArguments.StartsWith(' serve ', [StringComparison]::OrdinalIgnoreCase)) { throw 'Cannot verify the hidden service action; no runtime was changed' }
|
|
117
|
+
return [pscustomobject]@{ Execute = $tool; Arguments = $serverArguments.Substring(1) }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function Get-LocalAiTaskContext([string]$Root, [switch]$AllowCustomToolPath) {
|
|
96
121
|
$modelTaskErrors = @()
|
|
97
122
|
$task = Get-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -ErrorAction SilentlyContinue -ErrorVariable modelTaskErrors
|
|
98
123
|
if (-not $task) {
|
|
@@ -109,9 +134,21 @@ function Update-LocalAiRuntime([string]$Root) {
|
|
|
109
134
|
}
|
|
110
135
|
$currentSid = [Security.Principal.WindowsIdentity]::GetCurrent().User.Value
|
|
111
136
|
$action = @($task.Actions)
|
|
137
|
+
if ($action.Count -eq 1) { $action = @(Resolve-BackgroundToolAction $action[0] $Root 'litert-lm.exe') }
|
|
112
138
|
$ownTool = Join-Path $env:USERPROFILE '.local\bin\litert-lm.exe'
|
|
113
|
-
|
|
114
|
-
|
|
139
|
+
$toolVerified = $false
|
|
140
|
+
if ($action.Count -eq 1) {
|
|
141
|
+
$tool = [string]$action[0].Execute
|
|
142
|
+
if ($AllowCustomToolPath) {
|
|
143
|
+
# Restart the recorded task without changing its executable or venv.
|
|
144
|
+
# Current-user ownership and the verified serve port still gate stops.
|
|
145
|
+
$toolVerified = [IO.Path]::IsPathRooted($tool) -and [IO.Path]::GetFileName($tool) -ieq 'litert-lm.exe'
|
|
146
|
+
} else {
|
|
147
|
+
# File refresh keeps its stricter managed-runtime location contract.
|
|
148
|
+
$toolVerified = [IO.Path]::GetFullPath($tool) -ieq [IO.Path]::GetFullPath($ownTool)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if ($taskSid -ne $currentSid -or -not $toolVerified) {
|
|
115
152
|
throw 'Cannot verify ownership of the local AI task; no runtime was changed'
|
|
116
153
|
}
|
|
117
154
|
$serverArguments = [string]$action[0].Arguments
|
|
@@ -122,12 +159,7 @@ function Update-LocalAiRuntime([string]$Root) {
|
|
|
122
159
|
}
|
|
123
160
|
$setup = Join-Path $Root 'bin\setup-litertlm.ps1'
|
|
124
161
|
if (-not (Test-Path -LiteralPath $setup -PathType Leaf)) { throw 'The released local AI setup is missing' }
|
|
125
|
-
|
|
126
|
-
# every SDK update. /v1/models and the CLI version cannot detect stale code.
|
|
127
|
-
$state = (& $setup -RuntimeAction Inspect | Out-String).Trim() | ConvertFrom-Json
|
|
128
|
-
if ($LASTEXITCODE -ne 0 -or $state.version -ne 1) { throw 'Could not inspect the installed local AI runtime' }
|
|
129
|
-
if (-not $state.needsRefresh) { return }
|
|
130
|
-
$script:modelRuntimeUpdate = [pscustomobject]@{
|
|
162
|
+
$context = [pscustomobject]@{
|
|
131
163
|
Enabled = [bool]$task.Settings.Enabled
|
|
132
164
|
Running = ($task.State -eq 'Running')
|
|
133
165
|
OwnerSid = $currentSid
|
|
@@ -135,6 +167,48 @@ function Update-LocalAiRuntime([string]$Root) {
|
|
|
135
167
|
Setup = $setup
|
|
136
168
|
Backup = (Join-Path $previousDir 'litertlm-runtime')
|
|
137
169
|
}
|
|
170
|
+
# A Ready task may still have a live native server. Preserve availability
|
|
171
|
+
# before stopping it, including OTA stop failures and runtime refresh.
|
|
172
|
+
$context.Running = $context.Running -or (@(Get-OwnedLocalAiProcesses -Context $context).Count -gt 0)
|
|
173
|
+
return $context
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function Restart-LocalAiServe([string]$Root) {
|
|
177
|
+
$context = Get-LocalAiTaskContext $Root -AllowCustomToolPath
|
|
178
|
+
if ($null -eq $context) { throw 'The local AI task is missing; no server was restarted' }
|
|
179
|
+
if (-not $context.Enabled) { throw 'The local AI task is disabled; it was left disabled' }
|
|
180
|
+
$script:modelRuntimeUpdate = $context
|
|
181
|
+
try {
|
|
182
|
+
Stop-LocalAiForUpdate
|
|
183
|
+
# OTA also repairs an already-orphaned native listener whose task is Ready.
|
|
184
|
+
$script:modelRuntimeUpdate.Running = $true
|
|
185
|
+
Restore-LocalAiTaskState
|
|
186
|
+
} catch {
|
|
187
|
+
$restartError = $_
|
|
188
|
+
try {
|
|
189
|
+
Enable-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -ErrorAction Stop | Out-Null
|
|
190
|
+
$state = (Get-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -ErrorAction Stop).State
|
|
191
|
+
if ($context.Running -and $state -notin @('Running','Queued') -and @(Get-OwnedLocalAiProcesses).Count -eq 0) {
|
|
192
|
+
$listenerErrors = @()
|
|
193
|
+
$listeners = @(Get-NetTCPConnection -LocalPort $context.Port -State Listen -ErrorAction SilentlyContinue -ErrorVariable listenerErrors)
|
|
194
|
+
if (@($listenerErrors | Where-Object { $_.CategoryInfo.Category -ne 'ObjectNotFound' }).Count) { throw 'Cannot verify the model recovery port' }
|
|
195
|
+
if ($listeners.Count -eq 0) { Start-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -ErrorAction Stop }
|
|
196
|
+
}
|
|
197
|
+
} catch { Write-Warning ("Could not restore the model schedule after failed OTA restart: " + $_.Exception.Message) }
|
|
198
|
+
throw $restartError
|
|
199
|
+
} finally { $script:modelRuntimeUpdate = $null }
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function Update-LocalAiRuntime([string]$Root) {
|
|
203
|
+
$context = Get-LocalAiTaskContext $Root
|
|
204
|
+
if ($null -eq $context) { return }
|
|
205
|
+
$setup = $context.Setup
|
|
206
|
+
# Inspect first: an unchanged shim does NOT restart a healthy model server on
|
|
207
|
+
# every SDK update. /v1/models and the CLI version cannot detect stale code.
|
|
208
|
+
$state = (& $setup -RuntimeAction Inspect | Out-String).Trim() | ConvertFrom-Json
|
|
209
|
+
if ($LASTEXITCODE -ne 0 -or $state.version -ne 1) { throw 'Could not inspect the installed local AI runtime' }
|
|
210
|
+
if (-not $state.needsRefresh) { return }
|
|
211
|
+
$script:modelRuntimeUpdate = $context
|
|
138
212
|
Stop-LocalAiForUpdate
|
|
139
213
|
# This mode is local file replacement only. It never downloads a CLI/model,
|
|
140
214
|
# imports weights, resets tuning, re-registers tasks or runs image inference.
|
|
@@ -143,6 +217,30 @@ function Update-LocalAiRuntime([string]$Root) {
|
|
|
143
217
|
Restore-LocalAiTaskState
|
|
144
218
|
}
|
|
145
219
|
|
|
220
|
+
function Update-LocalAiTask([string]$Root) {
|
|
221
|
+
try {
|
|
222
|
+
$context = Get-LocalAiTaskContext $Root -AllowCustomToolPath
|
|
223
|
+
if ($null -eq $context -or -not $context.Enabled) { return }
|
|
224
|
+
$task = Get-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -ErrorAction Stop
|
|
225
|
+
$action = @($task.Actions)[0]
|
|
226
|
+
$wscript = Join-Path $env:WINDIR 'System32\wscript.exe'
|
|
227
|
+
if ([IO.Path]::GetFullPath([string]$action.Execute) -ieq [IO.Path]::GetFullPath($wscript)) {
|
|
228
|
+
$definition = Export-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -ErrorAction Stop
|
|
229
|
+
$headless = (($definition -match '<BootTrigger>') -or ($definition -match '<Repetition>')) -and
|
|
230
|
+
($definition -notmatch '<LogonType>InteractiveToken</LogonType>')
|
|
231
|
+
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
|
|
232
|
+
$elevated = (New-Object Security.Principal.WindowsPrincipal($identity)).IsInRole(
|
|
233
|
+
[Security.Principal.WindowsBuiltInRole]::Administrator)
|
|
234
|
+
if ($headless -or -not $elevated) { return }
|
|
235
|
+
}
|
|
236
|
+
$native = Resolve-BackgroundToolAction $action $Root 'litert-lm.exe'
|
|
237
|
+
& (Join-Path $Root 'bin\register-litertlm-task.ps1') -LitertLmPath $native.Execute -Port ([string]$context.Port)
|
|
238
|
+
if ($LASTEXITCODE -ne 0) { throw 'The hidden local AI task could not be registered' }
|
|
239
|
+
} catch {
|
|
240
|
+
Write-Warning "Connector installed; the hidden local AI schedule needs repair: $($_.Exception.Message)"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
146
244
|
function Restore-LocalAiRuntime {
|
|
147
245
|
if ($null -eq $script:modelRuntimeUpdate) { return }
|
|
148
246
|
Stop-LocalAiForUpdate
|
|
@@ -180,11 +278,13 @@ function Update-DetectorTask([string]$Root) {
|
|
|
180
278
|
try {
|
|
181
279
|
$task = Get-ScheduledTask -TaskName "TrillboardsDetector" -ErrorAction SilentlyContinue
|
|
182
280
|
if (-not $task) { return } # nothing registered yet; the cmd repair path owns that case
|
|
281
|
+
if ($task.Settings -and -not $task.Settings.Enabled) { return } # preserve an intentionally disabled detector
|
|
183
282
|
# The interpreter path comes off the task we are replacing rather than being
|
|
184
283
|
# re-derived - setup-detector.ps1 resolved it under the USER profile, and
|
|
185
284
|
# re-deriving here could resolve somewhere else entirely. Same rule
|
|
186
285
|
# register-task.ps1 states for its own repair.
|
|
187
|
-
$
|
|
286
|
+
$resolvedAction = Resolve-BackgroundToolAction (@($task.Actions)[0]) $Root 'trillboards-detector.exe'
|
|
287
|
+
$exe = $resolvedAction.Execute
|
|
188
288
|
if (-not $exe) { return }
|
|
189
289
|
# Older updater array-splatting bound the text '-DetectorPath' positionally
|
|
190
290
|
# as the executable, shifting the real path into --port. Recover ONLY this
|
|
@@ -281,6 +381,11 @@ function Restore-ConnectorSchedule {
|
|
|
281
381
|
}
|
|
282
382
|
}
|
|
283
383
|
|
|
384
|
+
if ($RestartLocalAi) {
|
|
385
|
+
Restart-LocalAiServe $InstallDir
|
|
386
|
+
exit 0
|
|
387
|
+
}
|
|
388
|
+
|
|
284
389
|
try {
|
|
285
390
|
Assert-ConnectorVersion $StagingDir
|
|
286
391
|
& (Join-Path $StagingDir "bin\stop-existing.ps1") -InstallDir $InstallDir
|
|
@@ -354,3 +459,7 @@ try {
|
|
|
354
459
|
try { Restore-ConnectorSchedule } catch {}
|
|
355
460
|
throw "Trillboards Edge update failed and the previous version was restored: $($failure.Exception.Message)"
|
|
356
461
|
}
|
|
462
|
+
|
|
463
|
+
# Migrate the independent model schedule only after the SDK transaction commits.
|
|
464
|
+
# A later connector rollback must not pair a new --wait action with an old host.
|
|
465
|
+
Update-LocalAiTask $InstallDir
|
|
@@ -274,7 +274,13 @@ SectionEnd
|
|
|
274
274
|
|
|
275
275
|
Section "Uninstall"
|
|
276
276
|
; Stop + remove the background tasks (connector + litert-lm serve + detector).
|
|
277
|
-
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -File "$INSTDIR\bin\stop-existing.ps1" -InstallDir "$INSTDIR"'
|
|
277
|
+
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -File "$INSTDIR\bin\stop-existing.ps1" -InstallDir "$INSTDIR" -IncludeLocalAi'
|
|
278
|
+
Pop $0
|
|
279
|
+
${If} $0 != 0
|
|
280
|
+
MessageBox MB_OK|MB_ICONSTOP "The background services could not be stopped safely. Your installation has been kept. Retry uninstall after closing Sense Anything." /SD IDOK
|
|
281
|
+
SetErrorLevel 1
|
|
282
|
+
Abort
|
|
283
|
+
${EndIf}
|
|
278
284
|
nsExec::ExecToLog 'schtasks /End /TN "${TASK_NAME}"'
|
|
279
285
|
nsExec::ExecToLog 'schtasks /Delete /F /TN "${TASK_NAME}"'
|
|
280
286
|
nsExec::ExecToLog 'schtasks /End /TN "${LITERT_TASK_NAME}"'
|
|
@@ -95,7 +95,13 @@ if ($RamBudgetMb -match '^\d+$') {
|
|
|
95
95
|
} elseif (-not [string]::IsNullOrWhiteSpace($RamBudgetMb)) {
|
|
96
96
|
Write-Warning "Ignoring a RAM ceiling that is not a whole number of MiB: '$RamBudgetMb'. The detector will hold its pinned model and refuse to make a second one resident."
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
# The interactive fallback must remain windowless too. Wait in the GUI host
|
|
99
|
+
# so Task Scheduler observes the service lifetime and its actual exit code.
|
|
100
|
+
$hiddenHost = Join-Path $PSScriptRoot 'trillboards-hidden-run.vbs'
|
|
101
|
+
if (-not (Test-Path -LiteralPath $hiddenHost -PathType Leaf)) { throw 'The hidden service launcher is missing' }
|
|
102
|
+
$wscript = Join-Path $env:WINDIR 'System32\wscript.exe'
|
|
103
|
+
$hiddenArgument = '//B //NoLogo "' + $hiddenHost + '" --wait "' + $DetectorPath + '" ' + $argument
|
|
104
|
+
$Action = New-ScheduledTaskAction -Execute $wscript -Argument $hiddenArgument
|
|
99
105
|
|
|
100
106
|
# NOT AT LOGON ONLY -- see register-task.ps1 for the full rationale, including
|
|
101
107
|
# why the REPEATING trigger (not the boot trigger) is the load-bearing one: only
|
|
@@ -149,26 +155,13 @@ $Attempts = @(
|
|
|
149
155
|
#
|
|
150
156
|
# Done ONCE, before the ladder below, which may unregister and re-register
|
|
151
157
|
# several times.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
# Disable the schedule and stop the verified native child before replacing the
|
|
159
|
+
# action. A hidden waiting host alone is not the service's lifetime boundary.
|
|
160
|
+
$priorService = & (Join-Path $PSScriptRoot 'stop-local-ai.ps1') -Service Detector -ToolPath $DetectorPath -Port ([int]$Port) -Inspect
|
|
161
|
+
$priorXml = if ($priorService.TaskPresent) { Export-ScheduledTask -TaskName $TaskName -TaskPath '\' } else { $null }
|
|
162
|
+
& (Join-Path $PSScriptRoot 'stop-local-ai.ps1') -Service Detector -ToolPath $DetectorPath -Port ([int]$Port) | Out-Null
|
|
157
163
|
try {
|
|
158
|
-
|
|
159
|
-
Where-Object { $_.CommandLine -and $_.CommandLine -match 'trillboards.detector' -and $_.CommandLine -match ('--port\s+' + [regex]::Escape($Port)) } |
|
|
160
|
-
ForEach-Object {
|
|
161
|
-
Write-Host "stopping previous detector service (pid $($_.ProcessId)) before re-registering"
|
|
162
|
-
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
|
163
|
-
}
|
|
164
|
-
} catch { }
|
|
165
|
-
|
|
166
|
-
for ($i = 0; $i -lt 15; $i++) {
|
|
167
|
-
$inUse = $null
|
|
168
|
-
try { $inUse = Get-NetTCPConnection -LocalPort ([int]$Port) -State Listen -ErrorAction SilentlyContinue } catch { }
|
|
169
|
-
if (-not $inUse) { break }
|
|
170
|
-
Start-Sleep -Seconds 1
|
|
171
|
-
}
|
|
164
|
+
if (@(Get-NetTCPConnection -LocalPort ([int]$Port) -State Listen -ErrorAction SilentlyContinue).Count) { throw 'The requested local AI port is still occupied' }
|
|
172
165
|
|
|
173
166
|
$Landed = $null
|
|
174
167
|
foreach ($attempt in $Attempts) {
|
|
@@ -183,14 +176,12 @@ foreach ($attempt in $Attempts) {
|
|
|
183
176
|
}
|
|
184
177
|
}
|
|
185
178
|
if (-not $Landed) {
|
|
186
|
-
|
|
187
|
-
exit 1
|
|
179
|
+
throw "Scheduled task '$TaskName' could not be registered in ANY supported shape."
|
|
188
180
|
}
|
|
189
181
|
|
|
190
182
|
$registered = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
|
191
183
|
if (-not $registered) {
|
|
192
|
-
|
|
193
|
-
exit 1
|
|
184
|
+
throw "Scheduled task '$TaskName' did NOT register (Get-ScheduledTask found nothing)."
|
|
194
185
|
}
|
|
195
186
|
$definition = Export-ScheduledTask -TaskName $TaskName
|
|
196
187
|
$logonType = if ($definition -match "<LogonType>([^<]+)</LogonType>") { $Matches[1] } else { "unknown" }
|
|
@@ -203,3 +194,13 @@ if ($logonType -eq "InteractiveToken") {
|
|
|
203
194
|
|
|
204
195
|
Start-ScheduledTask -TaskName $TaskName
|
|
205
196
|
Write-Host "Registered scheduled task '$TaskName' (trillboards-detector serve on :$Port, shape '$($Landed.Label)', logon type $logonType, restarts on failure, log $LogFile)."
|
|
197
|
+
|
|
198
|
+
} catch {
|
|
199
|
+
$registrationFailure = $_
|
|
200
|
+
if ($priorXml) {
|
|
201
|
+
Register-ScheduledTask -TaskName $TaskName -TaskPath '\' -Xml $priorXml -Force -ErrorAction Stop | Out-Null
|
|
202
|
+
if (-not $priorService.Enabled) { Disable-ScheduledTask -TaskName $TaskName -TaskPath '\' -ErrorAction Stop | Out-Null }
|
|
203
|
+
elseif ($priorService.Running) { Start-ScheduledTask -TaskName $TaskName -TaskPath '\' -ErrorAction Stop }
|
|
204
|
+
}
|
|
205
|
+
throw $registrationFailure
|
|
206
|
+
}
|
|
@@ -40,16 +40,18 @@ $UserId = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
|
|
40
40
|
# STILL unknown for exactly this reason -- the one process that knows why wrote
|
|
41
41
|
# its explanation to a handle nobody was holding.
|
|
42
42
|
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
# watching the wrapper instead of the server. Capturing this needs either an
|
|
48
|
-
# upstream --log-file or a purpose-built launcher that keeps the image name, and
|
|
49
|
-
# it must be proved against the S4U/boot-trigger ladder (the 0.2.17 incident)
|
|
50
|
-
# before it ships.
|
|
43
|
+
# The hidden wscript host waits for this exact executable and forwards its
|
|
44
|
+
# exit status. Re-registration and the updater also stop owned native server
|
|
45
|
+
# processes and verify the port is free, including a child left by a stopped
|
|
46
|
+
# host. A fire-and-forget action would discard Task Scheduler supervision.
|
|
51
47
|
$argument = 'serve --host 127.0.0.1 --port ' + $Port
|
|
52
|
-
|
|
48
|
+
# The interactive fallback must remain windowless too. Wait in the GUI host
|
|
49
|
+
# so Task Scheduler observes the service lifetime and its actual exit code.
|
|
50
|
+
$hiddenHost = Join-Path $PSScriptRoot 'trillboards-hidden-run.vbs'
|
|
51
|
+
if (-not (Test-Path -LiteralPath $hiddenHost -PathType Leaf)) { throw 'The hidden service launcher is missing' }
|
|
52
|
+
$wscript = Join-Path $env:WINDIR 'System32\wscript.exe'
|
|
53
|
+
$hiddenArgument = '//B //NoLogo "' + $hiddenHost + '" --wait "' + $LitertLmPath + '" ' + $argument
|
|
54
|
+
$Action = New-ScheduledTaskAction -Execute $wscript -Argument $hiddenArgument
|
|
53
55
|
|
|
54
56
|
# NOT AT LOGON -- see register-task.ps1 for the full rationale, including why
|
|
55
57
|
# the REPEATING trigger (not the boot trigger) is the load-bearing one: only an
|
|
@@ -104,28 +106,13 @@ $Attempts = @(
|
|
|
104
106
|
# Done ONCE, before the degradation ladder below: the ladder may unregister and
|
|
105
107
|
# re-register several times, and killing the serve on each attempt would only
|
|
106
108
|
# lengthen the window with no model server.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
# Disable the schedule and stop the verified native child before replacing the
|
|
110
|
+
# action. A hidden waiting host alone is not the service's lifetime boundary.
|
|
111
|
+
$priorService = & (Join-Path $PSScriptRoot 'stop-local-ai.ps1') -Service Model -ToolPath $LitertLmPath -Port ([int]$Port) -Inspect
|
|
112
|
+
$priorXml = if ($priorService.TaskPresent) { Export-ScheduledTask -TaskName $TaskName -TaskPath '\' } else { $null }
|
|
113
|
+
& (Join-Path $PSScriptRoot 'stop-local-ai.ps1') -Service Model -ToolPath $LitertLmPath -Port ([int]$Port) | Out-Null
|
|
112
114
|
try {
|
|
113
|
-
|
|
114
|
-
Where-Object { $_.CommandLine -and $_.CommandLine -match 'litert-lm' -and $_.CommandLine -match ('--port\s+' + [regex]::Escape($Port)) } |
|
|
115
|
-
ForEach-Object {
|
|
116
|
-
Write-Host "stopping previous litert-lm serve (pid $($_.ProcessId)) before re-registering"
|
|
117
|
-
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
|
118
|
-
}
|
|
119
|
-
} catch { }
|
|
120
|
-
|
|
121
|
-
# Wait for the port to free, so the Start-ScheduledTask below does not race a
|
|
122
|
-
# dying serve.
|
|
123
|
-
for ($i = 0; $i -lt 15; $i++) {
|
|
124
|
-
$inUse = $null
|
|
125
|
-
try { $inUse = Get-NetTCPConnection -LocalPort ([int]$Port) -State Listen -ErrorAction SilentlyContinue } catch { }
|
|
126
|
-
if (-not $inUse) { break }
|
|
127
|
-
Start-Sleep -Seconds 1
|
|
128
|
-
}
|
|
115
|
+
if (@(Get-NetTCPConnection -LocalPort ([int]$Port) -State Listen -ErrorAction SilentlyContinue).Count) { throw 'The requested local AI port is still occupied' }
|
|
129
116
|
|
|
130
117
|
$Landed = $null
|
|
131
118
|
foreach ($attempt in $Attempts) {
|
|
@@ -140,14 +127,12 @@ foreach ($attempt in $Attempts) {
|
|
|
140
127
|
}
|
|
141
128
|
}
|
|
142
129
|
if (-not $Landed) {
|
|
143
|
-
|
|
144
|
-
exit 1
|
|
130
|
+
throw "Scheduled task '$TaskName' could not be registered in ANY supported shape."
|
|
145
131
|
}
|
|
146
132
|
|
|
147
133
|
$registered = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
|
148
134
|
if (-not $registered) {
|
|
149
|
-
|
|
150
|
-
exit 1
|
|
135
|
+
throw "Scheduled task '$TaskName' did NOT register (Get-ScheduledTask found nothing)."
|
|
151
136
|
}
|
|
152
137
|
$definition = Export-ScheduledTask -TaskName $TaskName
|
|
153
138
|
$logonType = if ($definition -match "<LogonType>([^<]+)</LogonType>") { $Matches[1] } else { "unknown" }
|
|
@@ -161,3 +146,13 @@ if ($logonType -eq "InteractiveToken") {
|
|
|
161
146
|
# Start it now (don't wait for the next boot) so first-run sensing has a server.
|
|
162
147
|
Start-ScheduledTask -TaskName $TaskName
|
|
163
148
|
Write-Host "Registered scheduled task '$TaskName' (litert-lm serve on :$Port, shape '$($Landed.Label)', logon type $logonType, restarts on failure)."
|
|
149
|
+
|
|
150
|
+
} catch {
|
|
151
|
+
$registrationFailure = $_
|
|
152
|
+
if ($priorXml) {
|
|
153
|
+
Register-ScheduledTask -TaskName $TaskName -TaskPath '\' -Xml $priorXml -Force -ErrorAction Stop | Out-Null
|
|
154
|
+
if (-not $priorService.Enabled) { Disable-ScheduledTask -TaskName $TaskName -TaskPath '\' -ErrorAction Stop | Out-Null }
|
|
155
|
+
elseif ($priorService.Running) { Start-ScheduledTask -TaskName $TaskName -TaskPath '\' -ErrorAction Stop }
|
|
156
|
+
}
|
|
157
|
+
throw $registrationFailure
|
|
158
|
+
}
|
|
@@ -12,7 +12,9 @@ param(
|
|
|
12
12
|
# the set any more: the connector is local-inference only, and ValidateSet
|
|
13
13
|
# rejecting the value at registration is better than a task that registers
|
|
14
14
|
# fine and then exits 1 on every start.
|
|
15
|
-
[ValidateSet("auto-sense", "local-sense")][string]$Mode = "auto-sense"
|
|
15
|
+
[ValidateSet("auto-sense", "local-sense")][string]$Mode = "auto-sense",
|
|
16
|
+
# A reversible SDK swap must not upgrade independent AI task actions yet.
|
|
17
|
+
[switch]$SkipLocalAiRepair
|
|
16
18
|
)
|
|
17
19
|
$ErrorActionPreference = "Stop"
|
|
18
20
|
|
|
@@ -175,7 +177,28 @@ function Test-IsElevated {
|
|
|
175
177
|
[System.Security.Principal.WindowsBuiltInRole]::Administrator)
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
function Get-BackgroundToolPath($Task, [string]$ToolName) {
|
|
181
|
+
$action = @($Task.Actions)[0]
|
|
182
|
+
$wscript = Join-Path $env:WINDIR 'System32\wscript.exe'
|
|
183
|
+
if ([IO.Path]::GetFullPath([string]$action.Execute) -ine [IO.Path]::GetFullPath($wscript)) { return $action.Execute }
|
|
184
|
+
$hostPath = Join-Path $InstallDir 'bin\trillboards-hidden-run.vbs'
|
|
185
|
+
$prefix = '//B //NoLogo "' + $hostPath + '" --wait "'
|
|
186
|
+
$arguments = [string]$action.Arguments
|
|
187
|
+
if (-not $arguments.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) { throw 'Cannot verify the hidden service action' }
|
|
188
|
+
$tail = $arguments.Substring($prefix.Length)
|
|
189
|
+
$endQuote = $tail.IndexOf('"')
|
|
190
|
+
if ($endQuote -lt 1) { throw 'Cannot verify the hidden service action' }
|
|
191
|
+
$tool = $tail.Substring(0, $endQuote)
|
|
192
|
+
if (-not [IO.Path]::IsPathRooted($tool) -or [IO.Path]::GetFileName($tool) -ine $ToolName -or
|
|
193
|
+
-not $tail.Substring($endQuote + 1).StartsWith(' serve ', [StringComparison]::OrdinalIgnoreCase)) { throw 'Cannot verify the hidden service action' }
|
|
194
|
+
# Preserve the recorded native path, including a custom uv tool location.
|
|
195
|
+
return $tool
|
|
196
|
+
}
|
|
197
|
+
|
|
178
198
|
if (Test-IsElevated) {
|
|
199
|
+
# The updater repairs AI tasks after committing bin/lib. Otherwise rollback
|
|
200
|
+
# can restore an old host beneath a successfully upgraded --wait action.
|
|
201
|
+
if ($SkipLocalAiRepair) { return }
|
|
179
202
|
$litertTask = Get-ScheduledTask -TaskName "TrillboardsLiteRtLm" -ErrorAction SilentlyContinue
|
|
180
203
|
if ($litertTask) {
|
|
181
204
|
$litertXml = Export-ScheduledTask -TaskName "TrillboardsLiteRtLm"
|
|
@@ -185,7 +208,7 @@ if (Test-IsElevated) {
|
|
|
185
208
|
# Recover the interpreter path from the task we are replacing rather than
|
|
186
209
|
# re-deriving it: setup-litertlm.ps1 resolved it under the USER profile,
|
|
187
210
|
# and an elevated re-derivation could resolve somewhere else entirely.
|
|
188
|
-
$litertExe =
|
|
211
|
+
$litertExe = Get-BackgroundToolPath $litertTask 'litert-lm.exe'
|
|
189
212
|
$litertRegister = Join-Path $InstallDir "bin\register-litertlm-task.ps1"
|
|
190
213
|
if ($litertExe -and (Test-Path $litertRegister)) {
|
|
191
214
|
Write-Host "Repairing 'TrillboardsLiteRtLm' in the same elevated pass."
|
|
@@ -212,7 +235,7 @@ if (Test-IsElevated) {
|
|
|
212
235
|
# Recover the interpreter path from the task we are replacing rather than
|
|
213
236
|
# re-deriving it: setup-detector.ps1 resolved it under the USER profile,
|
|
214
237
|
# and an elevated re-derivation could resolve somewhere else entirely.
|
|
215
|
-
$detectorExe =
|
|
238
|
+
$detectorExe = Get-BackgroundToolPath $detectorTask 'trillboards-detector.exe'
|
|
216
239
|
$detectorRegister = Join-Path $InstallDir "bin\register-detector-task.ps1"
|
|
217
240
|
if ($detectorExe -and (Test-Path $detectorRegister)) {
|
|
218
241
|
Write-Host "Repairing 'TrillboardsDetector' in the same elevated pass."
|
|
@@ -139,7 +139,15 @@ function Stop-OwnedDetectorForRepair {
|
|
|
139
139
|
$task = Get-ScheduledTask -TaskName 'TrillboardsDetector' -ErrorAction SilentlyContinue
|
|
140
140
|
if ($task) {
|
|
141
141
|
$actions = @($task.Actions)
|
|
142
|
-
|
|
142
|
+
$ownedAction = $actions.Count -eq 1 -and [IO.Path]::GetFullPath($actions[0].Execute) -ieq $ownLauncher
|
|
143
|
+
if ($actions.Count -eq 1 -and -not $ownedAction) {
|
|
144
|
+
$wscript = Join-Path $env:WINDIR 'System32\wscript.exe'
|
|
145
|
+
$hiddenHost = Join-Path $Here 'trillboards-hidden-run.vbs'
|
|
146
|
+
$prefix = '//B //NoLogo "' + $hiddenHost + '" --wait "' + $ownLauncher + '" serve '
|
|
147
|
+
$ownedAction = [IO.Path]::GetFullPath($actions[0].Execute) -ieq [IO.Path]::GetFullPath($wscript) -and
|
|
148
|
+
([string]$actions[0].Arguments).StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)
|
|
149
|
+
}
|
|
150
|
+
if (-not $ownedAction) {
|
|
143
151
|
throw 'The detector task is not owned by this user installation; refusing to stop or replace it'
|
|
144
152
|
}
|
|
145
153
|
$taskSid = (New-Object System.Security.Principal.NTAccount($task.Principal.UserId)).Translate([System.Security.Principal.SecurityIdentifier]).Value
|
|
@@ -311,11 +311,14 @@ function Test-LitertLmModel([string]$ExecutablePath) {
|
|
|
311
311
|
catch { return $false }
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
$script:ModelImportPreviousState = $null
|
|
314
315
|
function Import-VerifiedModel([string]$SourcePath, [string]$ExecutablePath) {
|
|
316
|
+
$script:ModelImportPreviousState = $null
|
|
315
317
|
if ((Get-FileHash -LiteralPath $SourcePath -Algorithm SHA256).Hash.ToLowerInvariant() -ne $BundledModelSha256) {
|
|
316
318
|
Log "refusing to import an unverified local AI artifact"
|
|
317
319
|
return $false
|
|
318
320
|
}
|
|
321
|
+
$stoppedModel = $null
|
|
319
322
|
$modelFile = Join-Path $StoreDir "model.litertlm"
|
|
320
323
|
if (Test-Path -LiteralPath $modelFile -PathType Leaf) {
|
|
321
324
|
$previousSha = (Get-FileHash -LiteralPath $modelFile -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
@@ -330,11 +333,53 @@ function Import-VerifiedModel([string]$SourcePath, [string]$ExecutablePath) {
|
|
|
330
333
|
Log "previous model rollback copy could not be verified"
|
|
331
334
|
return $false
|
|
332
335
|
}
|
|
333
|
-
|
|
336
|
+
# The task may be a hidden waiting host, or have been deleted while its
|
|
337
|
+
# native child survives. Prove owner/process/port shutdown before import.
|
|
338
|
+
$stoppedModel = & (Join-Path $Here 'stop-local-ai.ps1') -Service Model -ToolPath $ExecutablePath -Port ([int]$Port)
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
$importVerified = $false
|
|
342
|
+
try {
|
|
343
|
+
& $ExecutablePath import $SourcePath $ModelId *>> $LogPath
|
|
344
|
+
$importVerified = (($LASTEXITCODE -eq 0) -and (Test-LitertLmModel $ExecutablePath))
|
|
345
|
+
if ($importVerified -and $stoppedModel) { $script:ModelImportPreviousState = $stoppedModel }
|
|
346
|
+
return $importVerified
|
|
347
|
+
} finally {
|
|
348
|
+
if ($stoppedModel -and -not $importVerified) {
|
|
349
|
+
# Import can fail after truncating/replacing the destination. Restore and
|
|
350
|
+
# verify the previous bytes before allowing its service to run again.
|
|
351
|
+
if (-not (Test-Path -LiteralPath $modelFile -PathType Leaf) -or
|
|
352
|
+
(Get-FileHash -LiteralPath $modelFile -Algorithm SHA256).Hash.ToLowerInvariant() -ne $previousSha) {
|
|
353
|
+
Copy-Item -LiteralPath $backupPath -Destination $modelFile -Force -ErrorAction Stop
|
|
354
|
+
}
|
|
355
|
+
if ((Get-FileHash -LiteralPath $modelFile -Algorithm SHA256).Hash.ToLowerInvariant() -ne $previousSha) {
|
|
356
|
+
throw 'The previous local AI model could not be restored; its service remains stopped'
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if ($stoppedModel -and $stoppedModel.TaskPresent -and $stoppedModel.Enabled) {
|
|
360
|
+
Enable-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -TaskPath '\' -ErrorAction Stop | Out-Null
|
|
361
|
+
# Logon-only fallback tasks have no repeat trigger to recover for us.
|
|
362
|
+
# Successful import is started by registration below; failed import must
|
|
363
|
+
# immediately restore a service that was running before this attempt.
|
|
364
|
+
if (-not $importVerified -and $stoppedModel.Running) {
|
|
365
|
+
Start-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -TaskPath '\' -ErrorAction Stop
|
|
366
|
+
}
|
|
334
367
|
}
|
|
335
368
|
}
|
|
336
|
-
|
|
337
|
-
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function Restore-ImportedModelService {
|
|
372
|
+
$prior = $script:ModelImportPreviousState
|
|
373
|
+
if (-not $prior -or -not $prior.TaskPresent -or -not $prior.Enabled) { return }
|
|
374
|
+
# The child registrar sees Ready after a successful import. The parent owns
|
|
375
|
+
# the pre-import state until registration commits, including its failure path.
|
|
376
|
+
$current = & (Join-Path $Here 'stop-local-ai.ps1') -Service Model -Inspect
|
|
377
|
+
if (-not $current.TaskPresent -or $current.Port -ne $prior.Port) { throw 'The model task changed before registration recovery' }
|
|
378
|
+
Enable-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -TaskPath '\' -ErrorAction Stop | Out-Null
|
|
379
|
+
if ($prior.Running -and $current.TaskState -notin @('Running','Queued') -and
|
|
380
|
+
$current.OwnedProcessCount -eq 0 -and $current.ListenerCount -eq 0) {
|
|
381
|
+
Start-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -TaskPath '\' -ErrorAction Stop
|
|
382
|
+
}
|
|
338
383
|
}
|
|
339
384
|
|
|
340
385
|
# One owner for the shim on fresh installs AND upgrades. None of these helpers
|
|
@@ -346,13 +391,19 @@ function Get-LitertlmShimPaths([string]$UvPath) {
|
|
|
346
391
|
(Join-Path $PSScriptRoot '..\litertlm\trillboards_litertlm_shim.py')
|
|
347
392
|
)) { if (Test-Path -LiteralPath $candidate -PathType Leaf) { $shim = $candidate; break } }
|
|
348
393
|
if (-not $shim) { throw 'The released litert-lm shim is missing' }
|
|
349
|
-
|
|
350
|
-
|
|
394
|
+
# PS 5.1 stops a native process when Select-Object -First has its line,
|
|
395
|
+
# turning a successful lookup into exit -1. Drain stdout before selecting.
|
|
396
|
+
$toolDirOutput = @(& $UvPath tool dir 2>$null)
|
|
397
|
+
$toolDirExit = $LASTEXITCODE
|
|
398
|
+
$toolDir = $toolDirOutput | Select-Object -First 1
|
|
399
|
+
if ($toolDirExit -ne 0 -or [string]::IsNullOrWhiteSpace($toolDir)) { throw 'Cannot resolve uv tool dir' }
|
|
351
400
|
$venv = [IO.Path]::GetFullPath((Join-Path $toolDir.Trim() 'litert-lm'))
|
|
352
401
|
$py = Join-Path $venv 'Scripts\python.exe'
|
|
353
402
|
if (-not (Test-Path -LiteralPath $py -PathType Leaf)) { throw 'The installed litert-lm Python is missing' }
|
|
354
|
-
$
|
|
355
|
-
|
|
403
|
+
$siteOutput = @(& $py -c "import sysconfig;print(sysconfig.get_paths()['purelib'])" 2>$null)
|
|
404
|
+
$siteExit = $LASTEXITCODE
|
|
405
|
+
$site = $siteOutput | Select-Object -First 1
|
|
406
|
+
if ($siteExit -ne 0 -or [string]::IsNullOrWhiteSpace($site)) { throw 'Cannot resolve litert-lm site-packages' }
|
|
356
407
|
$site = [IO.Path]::GetFullPath($site.Trim())
|
|
357
408
|
if (-not $site.StartsWith(($venv.TrimEnd('\') + '\'), [StringComparison]::OrdinalIgnoreCase) -or
|
|
358
409
|
-not (Test-Path -LiteralPath $site -PathType Container)) { throw 'The runtime site is outside its managed venv' }
|
|
@@ -583,7 +634,24 @@ function Get-LitertLmVersion {
|
|
|
583
634
|
# operation that just failed.
|
|
584
635
|
$installedLitertLmVersion = Get-LitertLmVersion
|
|
585
636
|
$serveHealthy = Test-ServeHealthy
|
|
586
|
-
|
|
637
|
+
# A reinstall also migrates legacy console actions. Only the already-hidden
|
|
638
|
+
# task may take the healthy fast path; the normal verified setup below owns
|
|
639
|
+
# registration and proves the replacement service before reporting ready.
|
|
640
|
+
$serveTaskHidden = $false
|
|
641
|
+
try {
|
|
642
|
+
$serviceTask = Get-ScheduledTask -TaskName 'TrillboardsLiteRtLm' -ErrorAction Stop
|
|
643
|
+
$serviceActions = @($serviceTask.Actions)
|
|
644
|
+
$serviceUser = [string]$serviceTask.Principal.UserId
|
|
645
|
+
$serviceSid = if ($serviceUser -match '^S-1-') { $serviceUser } else {
|
|
646
|
+
(New-Object Security.Principal.NTAccount($serviceUser)).Translate([Security.Principal.SecurityIdentifier]).Value
|
|
647
|
+
}
|
|
648
|
+
$hiddenPrefix = '//B //NoLogo "' + (Join-Path $Here 'trillboards-hidden-run.vbs') + '" --wait "' + $litertlmPath + '" serve --host 127.0.0.1 --port ' + $Port
|
|
649
|
+
$serveTaskHidden = $serviceTask.Settings.Enabled -and $serviceTask.State -eq 'Running' -and
|
|
650
|
+
$serviceSid -eq [Security.Principal.WindowsIdentity]::GetCurrent().User.Value -and $serviceActions.Count -eq 1 -and
|
|
651
|
+
[IO.Path]::GetFullPath($serviceActions[0].Execute) -ieq [IO.Path]::GetFullPath((Join-Path $env:WINDIR 'System32\wscript.exe')) -and
|
|
652
|
+
([string]$serviceActions[0].Arguments).Equals($hiddenPrefix, [StringComparison]::OrdinalIgnoreCase)
|
|
653
|
+
} catch { }
|
|
654
|
+
if ($serveHealthy -and ($installedLitertLmVersion -eq $LitertLmVersion) -and $serveTaskHidden) {
|
|
587
655
|
if (Test-LitertlmVision -InferenceModel "$ModelId,gpu") {
|
|
588
656
|
Complete-Setup
|
|
589
657
|
Stop-SetupLock
|
|
@@ -735,8 +803,13 @@ if ((Test-LitertLmCli) -and ($installedLitertLmVersion -eq $LitertLmVersion)) {
|
|
|
735
803
|
# --force` rebuilds the venv and takes both files with it, while Test-LitertLmCli
|
|
736
804
|
# short-circuits that branch on a healthy CLI -- gating this behind it is exactly
|
|
737
805
|
# how a repaired-and-healthy machine would keep the slow serve and report fine.
|
|
738
|
-
#
|
|
739
|
-
|
|
806
|
+
# The adapter also binds runtime model proof to each response; it is required
|
|
807
|
+
# before readiness probes can verify the installed model.
|
|
808
|
+
if (-not (Install-LitertlmShim -UvPath $uvCmd.Source)) {
|
|
809
|
+
Fail-LocalAi "The local AI runtime adapter could not be installed. See $LogPath."
|
|
810
|
+
Stop-SetupLock
|
|
811
|
+
exit 1
|
|
812
|
+
}
|
|
740
813
|
|
|
741
814
|
$bundledModelVerified = $false
|
|
742
815
|
if (-not [string]::IsNullOrWhiteSpace($BundledModelPath)) {
|
|
@@ -850,6 +923,7 @@ Write-LitertlmConfig -VisionBackend "gpu" -SpeculativeDecoding $true | Out-Null
|
|
|
850
923
|
Log "registering litert-lm serve Scheduled Task on :$Port"
|
|
851
924
|
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File $registration -LitertLmPath $litertlmPath -Port $Port *>> $LogPath
|
|
852
925
|
if ($LASTEXITCODE -ne 0) {
|
|
926
|
+
try { Restore-ImportedModelService } catch { Log "WARN: the prior local AI service could not be restored: $_" }
|
|
853
927
|
Fail-LocalAi "The local AI service could not be started. Restart Windows, then retry Local AI."
|
|
854
928
|
Stop-SetupLock
|
|
855
929
|
exit 1
|
|
@@ -5,13 +5,33 @@
|
|
|
5
5
|
#>
|
|
6
6
|
[CmdletBinding()]
|
|
7
7
|
param(
|
|
8
|
-
[Parameter(Mandatory = $true)][string]$InstallDir
|
|
8
|
+
[Parameter(Mandatory = $true)][string]$InstallDir,
|
|
9
|
+
[switch]$IncludeLocalAi
|
|
9
10
|
)
|
|
10
11
|
|
|
11
12
|
$ErrorActionPreference = "Stop"
|
|
12
13
|
$root = [IO.Path]::GetFullPath($InstallDir).TrimEnd('\')
|
|
13
14
|
$rootPrefix = $root + '\'
|
|
14
15
|
|
|
16
|
+
$stoppedLocalAi = @()
|
|
17
|
+
$priorConnector = $null
|
|
18
|
+
try {
|
|
19
|
+
if ($IncludeLocalAi) {
|
|
20
|
+
$connectorErrors = @()
|
|
21
|
+
$connector = Get-ScheduledTask -TaskName 'TrillboardsEdge' -TaskPath '\' -ErrorAction SilentlyContinue -ErrorVariable connectorErrors
|
|
22
|
+
if (@($connectorErrors | Where-Object { $_.CategoryInfo.Category -ne 'ObjectNotFound' }).Count) { throw 'Cannot inspect the connector schedule before uninstall' }
|
|
23
|
+
if ($connector) { $priorConnector = [pscustomobject]@{ Enabled=[bool]$connector.Settings.Enabled; Running=($connector.State -eq 'Running') } }
|
|
24
|
+
}
|
|
25
|
+
if ($IncludeLocalAi) {
|
|
26
|
+
$stopLocalAi = Join-Path $PSScriptRoot 'stop-local-ai.ps1'
|
|
27
|
+
# Verify both tasks before changing either. An uninstall must not remove its
|
|
28
|
+
# files while a foreign/ambiguous service is still running under them.
|
|
29
|
+
foreach ($service in @('Model','Detector')) { & $stopLocalAi -Service $service -Inspect | Out-Null }
|
|
30
|
+
foreach ($service in @('Model','Detector')) {
|
|
31
|
+
$stoppedLocalAi += [pscustomobject]@{ Service=$service; State=(& $stopLocalAi -Service $service) }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
15
35
|
# DISABLE BEFORE STOP. register-task.ps1 registers the task with
|
|
16
36
|
# `-RestartCount 99 -RestartInterval 1 minute`, so Stop-ScheduledTask ends the
|
|
17
37
|
# instance as a FAILURE and Task Scheduler relaunches node.exe about a minute
|
|
@@ -24,6 +44,8 @@ Stop-ScheduledTask -TaskName "TrillboardsEdge" -ErrorAction SilentlyContinue
|
|
|
24
44
|
Start-Sleep -Milliseconds 750
|
|
25
45
|
|
|
26
46
|
function Get-TrillboardsEdgeProcesses {
|
|
47
|
+
param([switch]$VerifyRecovery)
|
|
48
|
+
$queryErrorAction = if ($VerifyRecovery) { 'Stop' } else { 'SilentlyContinue' }
|
|
27
49
|
# The process that actually holds bin\node.exe open is node.exe itself, and
|
|
28
50
|
# its command line names NONE of these scripts - it names the cli.js entry.
|
|
29
51
|
# Win32_Process.ExecutablePath is empty across a 32/64-bit boundary, and then
|
|
@@ -41,9 +63,17 @@ function Get-TrillboardsEdgeProcesses {
|
|
|
41
63
|
'ffmpeg.exe'
|
|
42
64
|
)
|
|
43
65
|
|
|
44
|
-
@(Get-CimInstance Win32_Process -ErrorAction
|
|
66
|
+
@(Get-CimInstance Win32_Process -ErrorAction $queryErrorAction | Where-Object {
|
|
45
67
|
if ($_.ProcessId -eq $PID) { return $false }
|
|
46
68
|
$exe = if ($_.ExecutablePath) { [IO.Path]::GetFullPath($_.ExecutablePath) } else { '' }
|
|
69
|
+
$commandLine = [string]$_.CommandLine
|
|
70
|
+
# Waiting AI hosts belong to their own scheduled tasks and hold neither
|
|
71
|
+
# connector binary open. The runtime refresh/repair paths own their stop
|
|
72
|
+
# and restart; a routine SDK update may leave their adapter unchanged.
|
|
73
|
+
# Name is available even when cross-bitness hides ExecutablePath.
|
|
74
|
+
$servicePrefix = '"' + (Join-Path $root 'bin\trillboards-hidden-run.vbs') + '" --wait "'
|
|
75
|
+
if ($_.Name -ieq 'wscript.exe' -and
|
|
76
|
+
$commandLine.IndexOf($servicePrefix, [StringComparison]::OrdinalIgnoreCase) -ge 0) { return $false }
|
|
47
77
|
$isInstalledExecutable = (
|
|
48
78
|
$exe.Equals($root, [StringComparison]::OrdinalIgnoreCase) -or
|
|
49
79
|
$exe.StartsWith($rootPrefix, [StringComparison]::OrdinalIgnoreCase)
|
|
@@ -51,7 +81,6 @@ function Get-TrillboardsEdgeProcesses {
|
|
|
51
81
|
if ($isInstalledExecutable) {
|
|
52
82
|
return $true
|
|
53
83
|
}
|
|
54
|
-
$commandLine = [string]$_.CommandLine
|
|
55
84
|
if ($commandLine.IndexOf($root, [StringComparison]::OrdinalIgnoreCase) -lt 0) {
|
|
56
85
|
return $false
|
|
57
86
|
}
|
|
@@ -121,3 +150,33 @@ function Assert-BinariesUnlocked {
|
|
|
121
150
|
Assert-BinariesUnlocked -Root $root
|
|
122
151
|
|
|
123
152
|
Write-Host "Stopped existing Trillboards Edge processes."
|
|
153
|
+
|
|
154
|
+
} catch {
|
|
155
|
+
$stopError = $_
|
|
156
|
+
# A later service/connector failure must also restore services already
|
|
157
|
+
# stopped successfully; the failing helper restores only its own schedule.
|
|
158
|
+
foreach ($entry in $stoppedLocalAi) {
|
|
159
|
+
if ($entry.State.TaskPresent -and $entry.State.Enabled) {
|
|
160
|
+
try {
|
|
161
|
+
$current = & $stopLocalAi -Service $entry.Service -Inspect
|
|
162
|
+
if (-not $current.TaskPresent -or $current.Port -ne $entry.State.Port) { throw 'The local AI task changed during cleanup' }
|
|
163
|
+
Enable-ScheduledTask -TaskName $entry.State.TaskName -TaskPath '\' -ErrorAction Stop | Out-Null
|
|
164
|
+
if ($entry.State.Running -and $current.TaskState -notin @('Running','Queued') -and
|
|
165
|
+
$current.OwnedProcessCount -eq 0 -and $current.ListenerCount -eq 0) {
|
|
166
|
+
Start-ScheduledTask -TaskName $entry.State.TaskName -TaskPath '\' -ErrorAction Stop
|
|
167
|
+
}
|
|
168
|
+
} catch { Write-Warning ("Could not restore the previously stopped local AI service: " + $_.Exception.Message) }
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if ($priorConnector -and $priorConnector.Enabled) {
|
|
172
|
+
try {
|
|
173
|
+
Enable-ScheduledTask -TaskName 'TrillboardsEdge' -TaskPath '\' -ErrorAction Stop | Out-Null
|
|
174
|
+
$state = (Get-ScheduledTask -TaskName 'TrillboardsEdge' -TaskPath '\' -ErrorAction Stop).State
|
|
175
|
+
if ($priorConnector.Running -and $state -notin @('Running','Queued') -and
|
|
176
|
+
@(Get-TrillboardsEdgeProcesses -VerifyRecovery).Count -eq 0) {
|
|
177
|
+
Start-ScheduledTask -TaskName 'TrillboardsEdge' -TaskPath '\' -ErrorAction Stop
|
|
178
|
+
}
|
|
179
|
+
} catch { Write-Warning ("Could not restore the connector schedule after failed uninstall: " + $_.Exception.Message) }
|
|
180
|
+
}
|
|
181
|
+
throw $stopError
|
|
182
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<#
|
|
2
|
+
Stop one verified per-user local AI service, including native children left
|
|
3
|
+
behind when Task Scheduler ends its waiting hidden host. Return the original
|
|
4
|
+
schedule state; callers own re-registration, restoration or task deletion.
|
|
5
|
+
-Inspect verifies the same ownership without changing anything.
|
|
6
|
+
#>
|
|
7
|
+
[CmdletBinding()]
|
|
8
|
+
param(
|
|
9
|
+
[Parameter(Mandatory = $true)][ValidateSet('Model','Detector')][string]$Service,
|
|
10
|
+
[string]$ToolPath = '',
|
|
11
|
+
[ValidateRange(0,65535)][int]$Port = 0,
|
|
12
|
+
[switch]$Inspect
|
|
13
|
+
)
|
|
14
|
+
$ErrorActionPreference = 'Stop'
|
|
15
|
+
$toolName = if ($Service -eq 'Model') { 'litert-lm.exe' } else { 'trillboards-detector.exe' }
|
|
16
|
+
$taskName = if ($Service -eq 'Model') { 'TrillboardsLiteRtLm' } else { 'TrillboardsDetector' }
|
|
17
|
+
$packageName = if ($Service -eq 'Model') { 'litert-lm' } else { 'trillboards-detector' }
|
|
18
|
+
$commandPattern = if ($Service -eq 'Model') { 'litert[-_]lm' } else { 'trillboards[-_.]detector' }
|
|
19
|
+
$ownerSid = [Security.Principal.WindowsIdentity]::GetCurrent().User.Value
|
|
20
|
+
$explicitTool = $PSBoundParameters.ContainsKey('ToolPath')
|
|
21
|
+
if (-not $ToolPath) { $ToolPath = Join-Path $env:USERPROFILE ('.local\bin\' + $toolName) }
|
|
22
|
+
if (-not [IO.Path]::IsPathRooted($ToolPath) -or [IO.Path]::GetFileName($ToolPath) -ine $toolName) { throw 'Cannot verify the local AI executable' }
|
|
23
|
+
$ToolPath = [IO.Path]::GetFullPath($ToolPath)
|
|
24
|
+
$taskErrors = @()
|
|
25
|
+
$task = Get-ScheduledTask -TaskName $taskName -TaskPath '\' -ErrorAction SilentlyContinue -ErrorVariable taskErrors
|
|
26
|
+
if (@($taskErrors | Where-Object { $_.CategoryInfo.Category -ne 'ObjectNotFound' }).Count) { throw 'Cannot inspect the local AI task; nothing was stopped' }
|
|
27
|
+
if (@($task).Count -gt 1) { throw 'The local AI task is ambiguous; nothing was stopped' }
|
|
28
|
+
if ($task) {
|
|
29
|
+
$taskUser = [string]$task.Principal.UserId
|
|
30
|
+
$taskSid = if ($taskUser -match '^S-1-') { $taskUser } else {
|
|
31
|
+
(New-Object Security.Principal.NTAccount($taskUser)).Translate([Security.Principal.SecurityIdentifier]).Value
|
|
32
|
+
}
|
|
33
|
+
if ($taskSid -ne $ownerSid) { throw 'The local AI task belongs to another user; nothing was stopped' }
|
|
34
|
+
$actions = @($task.Actions)
|
|
35
|
+
if ($actions.Count -ne 1) { throw 'Cannot verify the local AI task action; nothing was stopped' }
|
|
36
|
+
$execute = [string]$actions[0].Execute
|
|
37
|
+
$arguments = [string]$actions[0].Arguments
|
|
38
|
+
$wscript = Join-Path $env:WINDIR 'System32\wscript.exe'
|
|
39
|
+
if ([IO.Path]::GetFullPath($execute) -ieq [IO.Path]::GetFullPath($wscript)) {
|
|
40
|
+
$prefix = '//B //NoLogo "' + (Join-Path $PSScriptRoot 'trillboards-hidden-run.vbs') + '" --wait "'
|
|
41
|
+
if (-not $arguments.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) { throw 'Cannot verify the hidden local AI action; nothing was stopped' }
|
|
42
|
+
$tail = $arguments.Substring($prefix.Length)
|
|
43
|
+
$endQuote = $tail.IndexOf('"')
|
|
44
|
+
if ($endQuote -lt 1) { throw 'Cannot verify the hidden local AI executable; nothing was stopped' }
|
|
45
|
+
$execute = $tail.Substring(0, $endQuote)
|
|
46
|
+
$arguments = $tail.Substring($endQuote + 1).TrimStart()
|
|
47
|
+
}
|
|
48
|
+
if (-not $explicitTool -and [IO.Path]::IsPathRooted($execute) -and [IO.Path]::GetFileName($execute) -ieq $toolName) { $ToolPath = [IO.Path]::GetFullPath($execute) }
|
|
49
|
+
if (-not [IO.Path]::IsPathRooted($execute) -or [IO.Path]::GetFullPath($execute) -ine $ToolPath) { throw 'The local AI task executable belongs to another installation; nothing was stopped' }
|
|
50
|
+
$ports = [regex]::Matches($arguments, '(?:^|\s)--port(?:\s+|=)([0-9]+)(?=\s|$)')
|
|
51
|
+
if ($arguments -notmatch '^serve\s' -or $ports.Count -ne 1 -or [long]$ports[0].Groups[1].Value -lt 1 -or [long]$ports[0].Groups[1].Value -gt 65535) { throw 'Cannot verify the local AI serve port; nothing was stopped' }
|
|
52
|
+
# Stop the recorded OLD port when re-registering onto a new one.
|
|
53
|
+
$Port = [int]$ports[0].Groups[1].Value
|
|
54
|
+
}
|
|
55
|
+
if (-not $Port) { $Port = if ($Service -eq 'Model') { 9379 } else { 9380 } }
|
|
56
|
+
$context = [pscustomobject]@{ TaskName=$taskName; TaskPresent=[bool]$task; Enabled=($task -and [bool]$task.Settings.Enabled); Running=($task -and $task.State -eq 'Running'); TaskState=$(if($task){[string]$task.State}else{'Absent'}); Port=$Port }
|
|
57
|
+
$toolRoot = [IO.Path]::GetFullPath((Join-Path $env:APPDATA ('uv\tools\' + $packageName))).TrimEnd('\') + '\'
|
|
58
|
+
$portPattern = '(?:^|\s)--port(?:\s+|=)' + $Port + '(?=\s|$)'
|
|
59
|
+
|
|
60
|
+
function Get-OwnedServiceProcesses {
|
|
61
|
+
$filter = "Name = 'python.exe' OR Name = 'pythonw.exe' OR Name = '" + $toolName + "'"
|
|
62
|
+
foreach ($process in @(Get-CimInstance Win32_Process -Filter $filter -OperationTimeoutSec 5 -ErrorAction Stop)) {
|
|
63
|
+
if (-not $process.CommandLine -or $process.CommandLine -notmatch $commandPattern -or
|
|
64
|
+
$process.CommandLine -notmatch '(?:^|\s)serve(?=\s|$)' -or $process.CommandLine -notmatch $portPattern) { continue }
|
|
65
|
+
try { $owner = Invoke-CimMethod -InputObject $process -MethodName GetOwnerSid -OperationTimeoutSec 5 -ErrorAction Stop } catch {
|
|
66
|
+
if (-not (Get-CimInstance Win32_Process -Filter ('ProcessId=' + $process.ProcessId) -OperationTimeoutSec 5 -ErrorAction Stop)) { continue }
|
|
67
|
+
throw
|
|
68
|
+
}
|
|
69
|
+
if ($owner.ReturnValue -ne 0 -or -not $owner.Sid) { throw 'Cannot verify a local AI process owner; nothing unverified was stopped' }
|
|
70
|
+
if ($owner.Sid -ne $ownerSid) { continue }
|
|
71
|
+
$exe = [string]$process.ExecutablePath
|
|
72
|
+
if (-not $exe -or ($exe -ine $ToolPath -and -not $exe.StartsWith($toolRoot, [StringComparison]::OrdinalIgnoreCase) -and
|
|
73
|
+
$process.CommandLine.IndexOf($ToolPath, [StringComparison]::OrdinalIgnoreCase) -lt 0)) { continue }
|
|
74
|
+
$process
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function Get-ServiceListeners {
|
|
78
|
+
$listenerErrors = @()
|
|
79
|
+
$listeners = @(Get-NetTCPConnection -LocalPort $Port -State Listen -ErrorAction SilentlyContinue -ErrorVariable listenerErrors)
|
|
80
|
+
if (@($listenerErrors | Where-Object { $_.CategoryInfo.Category -ne 'ObjectNotFound' }).Count) { throw 'Cannot verify the local AI listening port' }
|
|
81
|
+
$listeners
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
$owned = @(Get-OwnedServiceProcesses)
|
|
85
|
+
$ownedIds = @($owned | ForEach-Object { $_.ProcessId })
|
|
86
|
+
$listeners = @(Get-ServiceListeners)
|
|
87
|
+
foreach ($listener in $listeners) {
|
|
88
|
+
if ($ownedIds -notcontains $listener.OwningProcess) { throw 'The local AI port has an unverified listener; no task or process was stopped' }
|
|
89
|
+
}
|
|
90
|
+
$context | Add-Member -NotePropertyName OwnedProcessCount -NotePropertyValue $owned.Count
|
|
91
|
+
$context | Add-Member -NotePropertyName ListenerCount -NotePropertyValue $listeners.Count
|
|
92
|
+
# Ready describes the scheduler host, not the availability of its native
|
|
93
|
+
# service. Preserve a live owned child too when rolling back a stopped host.
|
|
94
|
+
$context.Running = $context.Running -or ($context.TaskPresent -and $owned.Count -gt 0)
|
|
95
|
+
if ($Inspect) { return $context }
|
|
96
|
+
try {
|
|
97
|
+
if ($task) {
|
|
98
|
+
Disable-ScheduledTask -TaskName $taskName -TaskPath '\' -ErrorAction Stop | Out-Null
|
|
99
|
+
Stop-ScheduledTask -TaskName $taskName -TaskPath '\' -ErrorAction Stop
|
|
100
|
+
}
|
|
101
|
+
for ($attempt = 0; $attempt -lt 15; $attempt++) {
|
|
102
|
+
foreach ($process in @(Get-OwnedServiceProcesses)) {
|
|
103
|
+
# A launcher may exit between the CIM snapshot and termination. Recheck
|
|
104
|
+
# identity, including creation time, so a recycled PID is never a target.
|
|
105
|
+
$live = Get-CimInstance Win32_Process -Filter ('ProcessId=' + $process.ProcessId) -OperationTimeoutSec 5 -ErrorAction Stop
|
|
106
|
+
if (-not $live) { continue }
|
|
107
|
+
if ($live.CreationDate -ne $process.CreationDate -or $live.ExecutablePath -ine $process.ExecutablePath) { throw 'The local AI process identity changed; retry the operation' }
|
|
108
|
+
try { Stop-Process -Id $process.ProcessId -Force -ErrorAction Stop } catch {
|
|
109
|
+
if (Get-CimInstance Win32_Process -Filter ('ProcessId=' + $process.ProcessId) -OperationTimeoutSec 5 -ErrorAction Stop) { throw }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
$remaining = @(Get-OwnedServiceProcesses)
|
|
113
|
+
$listeners = @(Get-ServiceListeners)
|
|
114
|
+
$state = if ($task) { (Get-ScheduledTask -TaskName $taskName -TaskPath '\' -ErrorAction Stop).State } else { 'Absent' }
|
|
115
|
+
if ($state -notin @('Running','Queued') -and $remaining.Count -eq 0 -and $listeners.Count -eq 0) { return $context }
|
|
116
|
+
Start-Sleep -Seconds 1
|
|
117
|
+
}
|
|
118
|
+
throw 'The local AI server or port did not stop; runtime files were left untouched'
|
|
119
|
+
} catch {
|
|
120
|
+
$stopError = $_
|
|
121
|
+
if ($context.TaskPresent -and $context.Enabled) {
|
|
122
|
+
try {
|
|
123
|
+
Enable-ScheduledTask -TaskName $taskName -TaskPath '\' -ErrorAction Stop | Out-Null
|
|
124
|
+
if ($context.Running) {
|
|
125
|
+
$state = (Get-ScheduledTask -TaskName $taskName -TaskPath '\' -ErrorAction Stop).State
|
|
126
|
+
if ($state -notin @('Running','Queued')) {
|
|
127
|
+
# A stop can fail after ending the waiting host and its native child.
|
|
128
|
+
# Logon-only tasks need an explicit restart. Never launch a duplicate
|
|
129
|
+
# while an owned child survives or a listener cannot be cleared.
|
|
130
|
+
if (@(Get-OwnedServiceProcesses).Count -eq 0 -and @(Get-ServiceListeners).Count -eq 0) {
|
|
131
|
+
Start-ScheduledTask -TaskName $taskName -TaskPath '\' -ErrorAction Stop
|
|
132
|
+
} else { Write-Warning 'Local AI recovery left the schedule enabled; a native process or listener still occupies the service' }
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
} catch { Write-Warning ("Could not restore the local AI schedule after the failed stop: " + $_.Exception.Message) }
|
|
136
|
+
}
|
|
137
|
+
throw $stopError
|
|
138
|
+
}
|
|
@@ -16,17 +16,25 @@ Option Explicit
|
|
|
16
16
|
' Every argument after <exe> is forwarded verbatim; arguments containing
|
|
17
17
|
' whitespace are re-quoted so paths like %LOCALAPPDATA%\Trillboards survive.
|
|
18
18
|
|
|
19
|
-
Dim shell, index, command, argument
|
|
19
|
+
Dim shell, index, command, argument, firstArgument, waitForExit, exitCode
|
|
20
20
|
|
|
21
21
|
If WScript.Arguments.Count < 1 Then
|
|
22
22
|
' Nothing to run. Exit quietly - a hidden helper must never pop a dialog.
|
|
23
23
|
WScript.Quit 2
|
|
24
24
|
End If
|
|
25
25
|
|
|
26
|
+
firstArgument = 0
|
|
27
|
+
waitForExit = False
|
|
28
|
+
If WScript.Arguments(0) = "--wait" Then
|
|
29
|
+
firstArgument = 1
|
|
30
|
+
waitForExit = True
|
|
31
|
+
If WScript.Arguments.Count < 2 Then WScript.Quit 2
|
|
32
|
+
End If
|
|
33
|
+
|
|
26
34
|
Set shell = CreateObject("WScript.Shell")
|
|
27
35
|
|
|
28
36
|
command = ""
|
|
29
|
-
For index =
|
|
37
|
+
For index = firstArgument To WScript.Arguments.Count - 1
|
|
30
38
|
argument = WScript.Arguments(index)
|
|
31
39
|
' Re-quote anything that is empty or contains whitespace. Arguments that are
|
|
32
40
|
' already quoted are left alone so callers can pass pre-quoted values.
|
|
@@ -41,6 +49,13 @@ For index = 0 To WScript.Arguments.Count - 1
|
|
|
41
49
|
command = command & argument
|
|
42
50
|
Next
|
|
43
51
|
|
|
52
|
+
' Scheduled services wait and propagate their real exit code, allowing Task
|
|
53
|
+
' Scheduler to supervise/restart them without an interactive console.
|
|
54
|
+
If waitForExit Then
|
|
55
|
+
exitCode = shell.Run(command, 0, True)
|
|
56
|
+
WScript.Quit exitCode
|
|
57
|
+
End If
|
|
58
|
+
|
|
44
59
|
' Style 0 == SW_HIDE. False == do not wait: a local-AI repair must never hold
|
|
45
60
|
' up the connector's own startup.
|
|
46
61
|
shell.Run command, 0, False
|
package/dist/EdgeAgent.js
CHANGED
|
@@ -44,7 +44,7 @@ const edge_ads_1 = require("@trillboards/edge-ads");
|
|
|
44
44
|
const CommandRouter_1 = require("./CommandRouter");
|
|
45
45
|
const config_1 = require("./config");
|
|
46
46
|
const dataDir_1 = require("./dataDir");
|
|
47
|
-
const SDK_VERSION = '0.2.
|
|
47
|
+
const SDK_VERSION = '0.2.159';
|
|
48
48
|
class EdgeAgent extends events_1.EventEmitter {
|
|
49
49
|
constructor(config, deps) {
|
|
50
50
|
super();
|
package/dist/diagnose.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface DiagnosticReport {
|
|
|
31
31
|
skipped: number;
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
declare const SDK_VERSION = "0.2.
|
|
34
|
+
declare const SDK_VERSION = "0.2.159";
|
|
35
35
|
declare function checkNodeVersion(): CheckResult;
|
|
36
36
|
declare function checkPlatform(): CheckResult;
|
|
37
37
|
declare function checkMemory(): CheckResult;
|
package/dist/diagnose.js
CHANGED
|
@@ -63,7 +63,7 @@ const localNetworkAccess_1 = require("./localNetworkAccess");
|
|
|
63
63
|
// ---------------------------------------------------------------------------
|
|
64
64
|
// SDK version — mirrors package.json; kept in sync by CI
|
|
65
65
|
// ---------------------------------------------------------------------------
|
|
66
|
-
const SDK_VERSION = '0.2.
|
|
66
|
+
const SDK_VERSION = '0.2.159';
|
|
67
67
|
exports._SDK_VERSION = SDK_VERSION;
|
|
68
68
|
// ---------------------------------------------------------------------------
|
|
69
69
|
// ANSI helpers (no external deps)
|
package/dist/gemmaModelOta.d.ts
CHANGED
|
@@ -66,6 +66,8 @@ export interface GemmaModelOtaDeps {
|
|
|
66
66
|
env?: NodeJS.ProcessEnv;
|
|
67
67
|
/** execFile override for the serve restart (default child_process.execFile). */
|
|
68
68
|
execFileFn?: (cmd: string, args: string[]) => Promise<void>;
|
|
69
|
+
/** Packaged Windows root override for restart qualification. */
|
|
70
|
+
windowsInstallRoot?: string | null;
|
|
69
71
|
/** uid for the macOS `launchctl kickstart gui/<uid>` domain (default process.getuid()). */
|
|
70
72
|
uid?: number;
|
|
71
73
|
}
|
|
@@ -104,7 +106,7 @@ export declare function clearStaleXnnpackCaches(storeModelPath: string, log?: (m
|
|
|
104
106
|
* model engine in memory, so after a file swap it must be restarted to load the
|
|
105
107
|
* new weights.
|
|
106
108
|
* macOS: launchctl kickstart -k gui/<uid>/com.trillboards.litertlm
|
|
107
|
-
* Windows:
|
|
109
|
+
* Windows: owned native-server stop + restart on packaged installs
|
|
108
110
|
* Linux: no managed serve unit in this repo — log + rely on the next natural
|
|
109
111
|
* restart (KeepAlive supervisors, if any, reload the swapped file).
|
|
110
112
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemmaModelOta.d.ts","sourceRoot":"","sources":["../src/gemmaModelOta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;
|
|
1
|
+
{"version":3,"file":"gemmaModelOta.d.ts","sourceRoot":"","sources":["../src/gemmaModelOta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AASH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAYhD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAClG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,IAAI,CAAC;IACb,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;CAC7D;AAED,MAAM,WAAW,iBAAiB;IAChC,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE;QAC1B,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,KAAK,gBAAgB,CAAC;IACvB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,uCAAuC;IACvC,GAAG,CAAC,EAAE,CAA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AAG,IAAI,CAoF5B"}
|
package/dist/gemmaModelOta.js
CHANGED
|
@@ -73,6 +73,7 @@ const path = __importStar(require("path"));
|
|
|
73
73
|
const child_process_1 = require("child_process");
|
|
74
74
|
const edge_core_1 = require("@trillboards/edge-core");
|
|
75
75
|
const dataDir_1 = require("./dataDir");
|
|
76
|
+
const connectorUpdateApply_1 = require("./connectorUpdateApply");
|
|
76
77
|
/** The connector-facing OTA modelType for the on-device Gemma VLM. */
|
|
77
78
|
exports.GEMMA_VLM_MODEL_TYPE = 'gemma-vlm';
|
|
78
79
|
/** Default litert-lm model id (matches config.localSensing.model + the serve store). */
|
|
@@ -156,7 +157,7 @@ function clearStaleXnnpackCaches(storeModelPath, log = () => { }) {
|
|
|
156
157
|
* model engine in memory, so after a file swap it must be restarted to load the
|
|
157
158
|
* new weights.
|
|
158
159
|
* macOS: launchctl kickstart -k gui/<uid>/com.trillboards.litertlm
|
|
159
|
-
* Windows:
|
|
160
|
+
* Windows: owned native-server stop + restart on packaged installs
|
|
160
161
|
* Linux: no managed serve unit in this repo — log + rely on the next natural
|
|
161
162
|
* restart (KeepAlive supervisors, if any, reload the swapped file).
|
|
162
163
|
*/
|
|
@@ -171,13 +172,22 @@ async function restartLiteRtLmServe(deps = {}) {
|
|
|
171
172
|
return;
|
|
172
173
|
}
|
|
173
174
|
if (platform === 'win32') {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
const root = deps.windowsInstallRoot !== undefined ? deps.windowsInstallRoot : (0, connectorUpdateApply_1.resolveInstallRoot)();
|
|
176
|
+
if (root) {
|
|
177
|
+
// /End can stop only wscript and leave the native server on the old
|
|
178
|
+
// weights. Reuse the updater's SID/port checks and native stop barrier.
|
|
179
|
+
await run('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass',
|
|
180
|
+
'-File', path.join(root, 'bin', 'install-update.ps1'), '-InstallDir', root, '-RestartLocalAi']);
|
|
177
181
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
else {
|
|
183
|
+
// Unpackaged installs retain their original direct-executable task.
|
|
184
|
+
try {
|
|
185
|
+
await run('schtasks', ['/End', '/TN', WINDOWS_SERVE_TASK]);
|
|
186
|
+
}
|
|
187
|
+
catch { /* may not be running */ }
|
|
188
|
+
await run('schtasks', ['/Run', '/TN', WINDOWS_SERVE_TASK]);
|
|
189
|
+
}
|
|
190
|
+
log(`[gemma-ota] restarted litert-lm serve (${WINDOWS_SERVE_TASK})`);
|
|
181
191
|
return;
|
|
182
192
|
}
|
|
183
193
|
log('[gemma-ota] model updated; no managed litert-lm serve unit on this platform — '
|
|
@@ -185,7 +195,7 @@ async function restartLiteRtLmServe(deps = {}) {
|
|
|
185
195
|
}
|
|
186
196
|
function defaultExecFile(cmd, args) {
|
|
187
197
|
return new Promise((resolve, reject) => {
|
|
188
|
-
(0, child_process_1.execFile)(cmd, args, (err) => (err ? reject(err) : resolve()));
|
|
198
|
+
(0, child_process_1.execFile)(cmd, args, { windowsHide: true }, (err) => (err ? reject(err) : resolve()));
|
|
189
199
|
});
|
|
190
200
|
}
|
|
191
201
|
/** Stable, non-PII connector fingerprint for the OTA version-check query param. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemmaModelOta.js","sourceRoot":"","sources":["../src/gemmaModelOta.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"gemmaModelOta.js","sourceRoot":"","sources":["../src/gemmaModelOta.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EH,sEAWC;AAQD,0DAcC;AASD,0DAoBC;AAWD,oDA4BC;AAuBD,gDAuFC;AA7RD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,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