@trillboards/edge-sdk 0.2.255 → 0.2.257

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.
@@ -94,6 +94,11 @@ CAPS = {
94
94
  "shopping cart": ["cart", "Cart", "trolley", "shopping_cart"],
95
95
  "spill": ["Spill", "spill"],
96
96
  "shoplifting / theft": ["shoplifting", "theft", "Shoplifting", "Theft"],
97
+ # Expressible since 2026-11-17 as a server-produced suspicion a person reviews
98
+ # (.github/contracts/sensing-capability-shape.json). No detector class carries
99
+ # it, so it adjudicates NO CANDIDATE here; it is listed because the contract
100
+ # must cover this table exactly.
101
+ "concealment suspicion (human review)": [],
97
102
  "door": ["door", "Door"],
98
103
  "window": ["window", "Window"],
99
104
  "phone use": ["phone", "phone_call", "Phone", "cell phone"],
@@ -598,7 +598,47 @@ function Assert-RestartImageInference([string]$ServiceName) {
598
598
  }
599
599
 
600
600
 
601
+ function Wait-QualificationInstallSetupComplete($Evidence, $BootstrapContext, [double]$DeadlineSeconds) {
602
+ # Pending bootstrap is installer work. It may legitimately execute the
603
+ # provisioner's 180-second image probe; it is not post-restart readiness.
604
+ # Charge it to the SAME repeat-install deadline, never a fresh allowance.
605
+ $started = Get-QualificationClockSeconds
606
+ $Evidence.remainingBudgetAtStartSeconds = [Math]::Max(0, $DeadlineSeconds - $started)
607
+ $barrier = New-QualificationSetupBarrier
608
+ try {
609
+ while ((Get-QualificationClockSeconds) -lt $DeadlineSeconds) {
610
+ $task = Get-QualificationConnectorTaskState
611
+ if ($task.Fingerprint -cne $BootstrapContext.Task.Fingerprint -or $task.Enabled) { throw 'Bootstrap ownership or disabled state changed during installation completion' }
612
+ $actors = @(Get-QualificationBootstrapActors $BootstrapContext)
613
+ $Evidence.bootstrapActors = $actors
614
+ $held = $false
615
+ try {
616
+ if ($task.State -notin @('Running', 'Queued') -and $actors.Count -eq 0) {
617
+ try { $held = $barrier.WaitOne(0) } catch [Threading.AbandonedMutexException] { $held = $true }
618
+ if ($held -and (Get-QualificationClockSeconds) -lt $DeadlineSeconds) {
619
+ $Evidence.setupBarrierAcquired = $true
620
+ $Evidence.passed = $true
621
+ return
622
+ }
623
+ }
624
+ } finally { if ($held) { $barrier.ReleaseMutex() } }
625
+ $remaining = $DeadlineSeconds - (Get-QualificationClockSeconds)
626
+ if ($remaining -gt 0) { Start-Sleep -Milliseconds ([int][Math]::Min(2000, [Math]::Ceiling($remaining * 1000))) }
627
+ }
628
+ throw 'Background model setup did not finish within the remaining installation budget'
629
+ } catch {
630
+ $Evidence.failure = $_.Exception.Message
631
+ $Evidence.modelSetupLogArtifact = 'product-logs/litertlm-setup.log'
632
+ throw
633
+ } finally {
634
+ $Evidence.elapsedSeconds = (Get-QualificationClockSeconds) - $started
635
+ $Evidence.completedAtUtc = [DateTimeOffset]::UtcNow.ToString('o')
636
+ $barrier.Dispose()
637
+ }
638
+ }
639
+
601
640
  function Invoke-QualificationServiceRestarts {
641
+ param([double]$InstallCompletionDeadlineSeconds = 0)
602
642
  # This is an isolated fresh-install AI test, not a paired sensing restart.
603
643
  # Capture restoration authority before the first write; never stop a setup actor.
604
644
  $bootstrapContext = [ordered]@{ Task=$null; AllowedHosts=$null; Traced=@{}; Candidates=@{}; OwnedActors=@{}; FirstStarted=(Get-QualificationClockSeconds); FirstStartedAtUtc=[DateTimeOffset]::UtcNow.ToString('o') }
@@ -616,6 +656,14 @@ function Invoke-QualificationServiceRestarts {
616
656
  $disabled = Get-QualificationConnectorTaskState
617
657
  if ($disabled.Fingerprint -cne $bootstrapContext.Task.Fingerprint -or $disabled.Enabled) { throw 'The owned bootstrap task did not remain unchanged and disabled' }
618
658
  $receipt.bootstrapIsolation.disabledVerified = $true
659
+ if ($InstallCompletionDeadlineSeconds -gt 0) {
660
+ $receipt.installSetupCompletion = [ordered]@{ phase='repeat-install-setup-completion'; passed=$false; setupBarrierAcquired=$false; startedAtUtc=[DateTimeOffset]::UtcNow.ToString('o') }
661
+ Wait-QualificationInstallSetupComplete $receipt.installSetupCompletion $bootstrapContext $InstallCompletionDeadlineSeconds
662
+ $receipt.repeatInstallPassed = $true
663
+ $receipt.phase = 'service-restart'
664
+ $bootstrapContext.FirstStarted = Get-QualificationClockSeconds
665
+ $bootstrapContext.FirstStartedAtUtc = [DateTimeOffset]::UtcNow.ToString('o')
666
+ }
619
667
  $powershell = Join-Path $env:WINDIR 'System32\WindowsPowerShell\v1.0\powershell.exe'
620
668
  foreach ($service in @(@{ Name = 'Model'; Task = 'TrillboardsLiteRtLm' }, @{ Name = 'Detector'; Task = 'TrillboardsDetector' })) {
621
669
  $preStop = [ordered]@{ service = $service.Name; phase = 'before-stop-setup-completion'; passed = $false;
@@ -745,15 +793,16 @@ try {
745
793
  $receipt.phase = 'fresh-install-inference'
746
794
  Assert-ImageInference
747
795
  $receipt.freshInstallPassed = $true; $receipt.phase = 'repeat-install'
796
+ $repeatInstallDeadlineSeconds = (Get-QualificationClockSeconds) + 900
748
797
  $null = Invoke-QualificationProcess -File $inner -RawArguments $installArgs -InheritPowerShellModulePath:($PowerShellModuleEnvironment -eq 'Inherited') -LogName 'repeat-install.log' -TimeoutSeconds 900
749
798
  Assert-HiddenTask 'TrillboardsLiteRtLm'; Assert-HiddenTask 'TrillboardsDetector'
750
799
  $receipt.phase = 'repeat-install-readiness'
751
800
  Wait-ModelReady; Wait-DetectorAnswer
752
801
  $receipt.phase = 'repeat-install-inference'
753
802
  Assert-ImageInference
754
- $receipt.repeatInstallPassed = $true; $receipt.phase = 'service-restart'; $receipt.serviceRestartChecks = @()
803
+ $receipt.repeatInstallPassed = $false; $receipt.phase = 'repeat-install-setup-completion'; $receipt.serviceRestartChecks = @()
755
804
  $receipt.serviceRestartPreparationChecks = @()
756
- Invoke-QualificationServiceRestarts
805
+ Invoke-QualificationServiceRestarts -InstallCompletionDeadlineSeconds $repeatInstallDeadlineSeconds
757
806
  $receipt.serviceRestartPassed = $true; $receipt.phase = 'uninstall'
758
807
  $receipt.uninstallerSha256 = Invoke-InstalledUninstaller -InstallDir $installDir -RunRoot $root -InheritPowerShellModulePath:($PowerShellModuleEnvironment -eq 'Inherited')
759
808
  foreach ($name in $taskNames) {
@@ -376,12 +376,20 @@ function Fail-LocalAi([string]$Message) {
376
376
 
377
377
  function Test-LitertLmModel([string]$ExecutablePath) {
378
378
  try {
379
- if ((& $ExecutablePath list 2>$null | Out-String) -notmatch [regex]::Escape($ModelId)) { return $false }
379
+ Log "model verification: listing installed models"
380
+ $phaseClock = [Diagnostics.Stopwatch]::StartNew()
381
+ $listedModels = & $ExecutablePath list 2>$null | Out-String
382
+ Log ("model verification: list completed in {0} ms" -f $phaseClock.ElapsedMilliseconds)
383
+ if ($listedModels -notmatch [regex]::Escape($ModelId)) { return $false }
380
384
  $modelFile = Join-Path $StoreDir "model.litertlm"
381
385
  if (-not (Test-Path -LiteralPath $modelFile -PathType Leaf)) { return $false }
382
- return ((Get-FileHash -LiteralPath $modelFile -Algorithm SHA256).Hash.ToLowerInvariant() -eq $BundledModelSha256)
386
+ Log "model verification: hashing installed model"
387
+ $phaseClock.Restart()
388
+ $verified = (Get-FileHash -LiteralPath $modelFile -Algorithm SHA256).Hash.ToLowerInvariant() -eq $BundledModelSha256
389
+ Log ("model verification: hash completed in {0} ms; verified={1}" -f $phaseClock.ElapsedMilliseconds, $verified)
390
+ return $verified
383
391
  }
384
- catch { return $false }
392
+ catch { Log ("model verification: failed ({0})" -f $_.Exception.GetType().Name); return $false }
385
393
  }
386
394
 
387
395
  $script:ModelImportPreviousState = $null
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.255';
47
+ const SDK_VERSION = '0.2.257';
48
48
  class EdgeAgent extends events_1.EventEmitter {
49
49
  constructor(config, deps) {
50
50
  super();
@@ -31,7 +31,7 @@ export interface DiagnosticReport {
31
31
  skipped: number;
32
32
  };
33
33
  }
34
- declare const SDK_VERSION = "0.2.255";
34
+ declare const SDK_VERSION = "0.2.257";
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.255';
66
+ const SDK_VERSION = '0.2.257';
67
67
  exports._SDK_VERSION = SDK_VERSION;
68
68
  // ---------------------------------------------------------------------------
69
69
  // ANSI helpers (no external deps)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trillboards/edge-sdk",
3
- "version": "0.2.255",
3
+ "version": "0.2.257",
4
4
  "description": "Composable cross-platform Edge AI SDK for audience sensing on DOOH/CTV devices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",