@trillboards/edge-sdk 0.2.109 → 0.2.110

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.
@@ -211,10 +211,11 @@ function Write-LitertlmConfig {
211
211
  # /v1/models answers without ever building an engine, so it cannot tell a working
212
212
  # GPU encoder from one that fails on first use.
213
213
  function Test-LitertlmVision {
214
+ param([string]$InferenceModel = "$ModelId,gpu")
214
215
  try {
215
216
  $dataUri = "data:image/jpeg;base64," + $script:LitertlmProbeJpegB64
216
217
  $body = @{
217
- model = "$ModelId,gpu"
218
+ model = $InferenceModel
218
219
  messages = @(@{ role = "user"; content = @(
219
220
  @{ type = "text"; text = "Reply with the single word: ok" },
220
221
  @{ type = "image_url"; image_url = @{ url = $dataUri } }
@@ -227,7 +228,7 @@ function Test-LitertlmVision {
227
228
  -TimeoutSec 180 -UseBasicParsing
228
229
  return ($resp.StatusCode -eq 200)
229
230
  } catch {
230
- Log "vision probe did not answer: $_"
231
+ Log "vision probe for '$InferenceModel' did not answer: $_"
231
232
  return $false
232
233
  }
233
234
  }
@@ -367,23 +368,32 @@ function Get-LitertLmVersion {
367
368
  }
368
369
  }
369
370
 
370
- # A HEALTHY SERVE IS NOT ENOUGH TO SKIP PROVISIONING.
371
+ # A HEALTHY CONTROL ROUTE IS NOT ENOUGH TO SKIP PROVISIONING.
371
372
  #
372
373
  # `Test-ServeHealthy` substring-matches the bare model id, and every litert-lm
373
374
  # version answers that identically - including the ones that reject the `,gpu`
374
- # model id the GPU delegate is selected with. So this fast path, which exists to
375
- # make a repeat run cheap, was also the path that let an already-installed
376
- # 0.14.0 declare itself ready forever: the hosts that most need the pinned
377
- # runtime are exactly the ones with a serve already answering. The version is
378
- # therefore part of the short-circuit condition, not a check further down that a
379
- # healthy serve never reaches.
375
+ # model id the GPU delegate is selected with, and without building an inference
376
+ # engine. So this fast path may run only after BOTH the pinned version check and
377
+ # a real image inference. Otherwise a failed first install can leave /v1/models
378
+ # answering, and a reinstall falsely declares success without re-testing the
379
+ # operation that just failed.
380
380
  $installedLitertLmVersion = Get-LitertLmVersion
381
- if ((Test-ServeHealthy) -and ($installedLitertLmVersion -eq $LitertLmVersion)) {
382
- Complete-Setup
383
- Stop-SetupLock
384
- exit 0
381
+ $serveHealthy = Test-ServeHealthy
382
+ if ($serveHealthy -and ($installedLitertLmVersion -eq $LitertLmVersion)) {
383
+ if (Test-LitertlmVision -InferenceModel "$ModelId,gpu") {
384
+ Complete-Setup
385
+ Stop-SetupLock
386
+ exit 0
387
+ }
388
+ if (Test-LitertlmVision -InferenceModel $ModelId) {
389
+ Log "local AI healthy on the previously configured full CPU fallback (slower, but serving)"
390
+ Complete-Setup
391
+ Stop-SetupLock
392
+ exit 0
393
+ }
394
+ Log "WARN: the pinned serve answers /v1/models but not a real GPU or CPU image inference; reprovisioning local AI"
385
395
  }
386
- if ((Test-ServeHealthy) -and ($installedLitertLmVersion -ne $LitertLmVersion)) {
396
+ if ($serveHealthy -and ($installedLitertLmVersion -ne $LitertLmVersion)) {
387
397
  Log "serve is healthy but litert-lm is $(if ($installedLitertLmVersion) { $installedLitertLmVersion } else { 'unknown' }) not pinned $LitertLmVersion; reinstalling and restarting the serve"
388
398
  }
389
399
 
@@ -686,7 +696,7 @@ if (-not $healthy) {
686
696
  # never builds an engine -- so it cannot see a GPU vision encoder that fails on
687
697
  # first USE. If the probe inference does not answer we fall back to the CPU
688
698
  # encoder rather than leave this host unable to sense at all.
689
- if (-not (Test-LitertlmVision)) {
699
+ if (-not (Test-LitertlmVision -InferenceModel "$ModelId,gpu")) {
690
700
  Log "WARN: GPU vision encoder did not answer a probe inference; falling back to the CPU encoder"
691
701
  Write-LitertlmConfig | Out-Null
692
702
  & powershell.exe -NoProfile -ExecutionPolicy Bypass -File $registration -LitertLmPath $litertlmPath -Port $Port *>> $LogPath
@@ -700,7 +710,9 @@ if (-not (Test-LitertlmVision)) {
700
710
  Stop-SetupLock
701
711
  exit 1
702
712
  }
703
- # RE-PROBE, with the same probe that sent us here.
713
+ # RE-PROBE the CPU-vision tier, first keeping GPU inference for hosts where
714
+ # only the image encoder failed, then using the same bare-model CPU fallback
715
+ # that LiteRtVlmProvider uses at runtime when the main GPU delegate fails.
704
716
  #
705
717
  # Test-ServeHealthy above only proves /v1/models answers, and this file's own
706
718
  # comment six lines up says that route never builds an engine. So before this
@@ -710,15 +722,18 @@ if (-not (Test-LitertlmVision)) {
710
722
  # install: the cascade detected the failure, downgraded a tier, and then
711
723
  # verified the downgrade with a check that cannot fail for this reason.
712
724
  #
713
- # A CPU fallback that cannot infer is not a slower tier. It is a broken
725
+ # A full CPU fallback that cannot infer is not a slower tier. It is a broken
714
726
  # install, and the operator has to hear so at setup time rather than discover
715
727
  # it as silence from a camera weeks later.
716
- if (-not (Test-LitertlmVision)) {
717
- Fail-LocalAi "Gemma is installed and the local AI service is answering, but it could not analyze a test image on either the GPU or the CPU vision encoder. See $LogPath."
728
+ if (Test-LitertlmVision -InferenceModel "$ModelId,gpu") {
729
+ Log "local AI healthy on the CPU vision encoder with GPU inference (slower, but serving)"
730
+ } elseif (Test-LitertlmVision -InferenceModel $ModelId) {
731
+ Log "local AI healthy on the full CPU fallback (slower, but serving)"
732
+ } else {
733
+ Fail-LocalAi "Gemma is installed and the local AI service is answering, but it could not analyze a test image with either GPU inference or the full CPU fallback. See $LogPath."
718
734
  Stop-SetupLock
719
735
  exit 1
720
736
  }
721
- Log "local AI healthy on the CPU vision encoder (slower, but serving)"
722
737
  } else {
723
738
  Log "local AI healthy with the GPU vision encoder"
724
739
  }
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.109';
47
+ const SDK_VERSION = '0.2.110';
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.109";
34
+ declare const SDK_VERSION = "0.2.110";
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.109';
66
+ const SDK_VERSION = '0.2.110';
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.109",
3
+ "version": "0.2.110",
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",