@trillboards/edge-sdk 0.2.197 → 0.2.200

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.
Files changed (58) hide show
  1. package/deploy/detector/pyproject.toml +1 -1
  2. package/deploy/detector/tests/test_colors_v2.py +79 -0
  3. package/deploy/detector/tests/test_detection_colors_wire.py +25 -0
  4. package/deploy/detector/tests/test_held_phone_customer_packaging.py +102 -0
  5. package/deploy/detector/trillboards_detector/_version.py +2 -2
  6. package/deploy/detector/trillboards_detector/colors.py +30 -11
  7. package/deploy/detector/trillboards_detector/server.py +1 -1
  8. package/deploy/macos/build-macos-pkg.sh +14 -2
  9. package/deploy/windows/build-windows.ps1 +12 -2
  10. package/deploy/windows/ci/test-published-install.ps1 +167 -8
  11. package/deploy/windows/setup-detector.ps1 +4 -1
  12. package/dist/DetectionColors.d.ts +11 -4
  13. package/dist/DetectionColors.d.ts.map +1 -1
  14. package/dist/DetectionColors.js +5 -2
  15. package/dist/DetectionColors.js.map +1 -1
  16. package/dist/DetectorFields.d.ts +138 -4
  17. package/dist/DetectorFields.d.ts.map +1 -1
  18. package/dist/DetectorFields.js +101 -11
  19. package/dist/DetectorFields.js.map +1 -1
  20. package/dist/EdgeAgent.js +1 -1
  21. package/dist/LiteRtVlmProvider.d.ts.map +1 -1
  22. package/dist/LiteRtVlmProvider.js +10 -1
  23. package/dist/LiteRtVlmProvider.js.map +1 -1
  24. package/dist/PhoneEmbeddingClassifier.d.ts +28 -0
  25. package/dist/PhoneEmbeddingClassifier.d.ts.map +1 -0
  26. package/dist/PhoneEmbeddingClassifier.js +40 -0
  27. package/dist/PhoneEmbeddingClassifier.js.map +1 -0
  28. package/dist/RetainedFieldContract.d.ts +9 -1
  29. package/dist/RetainedFieldContract.d.ts.map +1 -1
  30. package/dist/RetainedFieldContract.js +19 -3
  31. package/dist/RetainedFieldContract.js.map +1 -1
  32. package/dist/ScopedVlmReview.d.ts +6 -2
  33. package/dist/ScopedVlmReview.d.ts.map +1 -1
  34. package/dist/ScopedVlmReview.js +55 -5
  35. package/dist/ScopedVlmReview.js.map +1 -1
  36. package/dist/SensingProfileClient.d.ts +6 -0
  37. package/dist/SensingProfileClient.d.ts.map +1 -1
  38. package/dist/SensingProfileClient.js +7 -0
  39. package/dist/SensingProfileClient.js.map +1 -1
  40. package/dist/diagnose.d.ts +1 -1
  41. package/dist/diagnose.js +1 -1
  42. package/dist/localSensing.d.ts +5 -2
  43. package/dist/localSensing.d.ts.map +1 -1
  44. package/dist/localSensing.js +56 -8
  45. package/dist/localSensing.js.map +1 -1
  46. package/package.json +3 -3
  47. package/retained/ProfileAuthorityClient.cjs +1 -1
  48. package/retained/RetainedCaptureClient.cjs +2 -1
  49. package/retained/WebsiteAdmissionCaptureClient.cjs +478 -0
  50. package/retained/WebsiteAdmissionState.cjs +75 -0
  51. package/retained/__tests__/actor-perception.test.cjs +1 -1
  52. package/retained/__tests__/actor-window.test.cjs +1 -1
  53. package/retained/__tests__/archive-lifecycle.test.cjs +1 -1
  54. package/retained/__tests__/runtime.test.cjs +30 -2
  55. package/retained/__tests__/website-admission-realtime.test.cjs +503 -0
  56. package/retained/__tests__/website-admission.test.cjs +806 -0
  57. package/retained/manager.cjs +4 -1
  58. package/retained/pilot-profile-client.cjs +2 -1
@@ -10,7 +10,7 @@ name = "trillboards-detector"
10
10
  # constant, a `labels.py`-only change survives `uv tool install` AND
11
11
  # `uv tool install --force`; move the version and a bare `uv tool install`
12
12
  # reinstalls. See `stamp_version.py`.
13
- version = "0.2.0+src.a8173c092f27"
13
+ version = "0.2.0+src.42da00861e2b"
14
14
  description = "On-device object-detector service for the Trillboards BYO-CCTV connector (loopback HTTP, ONNX Runtime)."
15
15
  requires-python = ">=3.10"
16
16
 
@@ -0,0 +1,79 @@
1
+ """Bounded colour contract; synthetic fixtures establish arithmetic, never field accuracy."""
2
+ import importlib.util
3
+ import unittest
4
+
5
+ from trillboards_detector.colors import validate_color_request, build_color_response
6
+
7
+ V1 = {"version": 1, "minScore": .25, "maxBoxes": 32, "hue": [[0, 10], [240, 255]],
8
+ "minSaturation": 100, "minValue": 60}
9
+ V2 = {"version": 2, "minScore": .25, "maxBoxes": 32, "hue": [[0, 255]],
10
+ "minSaturation": 0, "maxSaturation": 40, "minValue": 60, "maxValue": 199}
11
+
12
+
13
+ class BoundedColourContractTest(unittest.TestCase):
14
+ def test_v1_request_and_response_are_unchanged(self):
15
+ self.assertEqual(validate_color_request(V1), V1)
16
+ self.assertEqual(build_color_response(V1, [2], [.08], "a" * 64, (160, 120)),
17
+ {"version": 1, "imageSha256": "a" * 64, "frameSize": {"width": 160, "height": 120},
18
+ "request": V1, "people": [{"detectionIndex": 2, "fraction": .08}]})
19
+ with self.assertRaises(ValueError):
20
+ validate_color_request({**V1, "maxValue": 255})
21
+
22
+ def test_v2_accepts_bounds_and_echoes_its_own_version(self):
23
+ self.assertEqual(validate_color_request(V2), V2)
24
+ result = build_color_response(V2, [2, 1], [.08, 0.0], "b" * 64, (160, 120))
25
+ self.assertEqual(result["version"], 2)
26
+ self.assertEqual(result["request"], V2)
27
+ self.assertEqual(result["people"], [{"detectionIndex": 2, "fraction": .08},
28
+ {"detectionIndex": 1, "fraction": 0.0}])
29
+
30
+ def test_v2_accepts_equal_inclusive_endpoints(self):
31
+ request = {**V2, "minSaturation": 40, "maxSaturation": 40, "minValue": 199, "maxValue": 199}
32
+ self.assertEqual(validate_color_request(request), request)
33
+
34
+ def test_v2_refuses_missing_unknown_or_invalid_bounds(self):
35
+ bad = [{**V2, "version": 3}, {**V2, "version": True},
36
+ {k: v for k, v in V2.items() if k != "maxValue"},
37
+ {k: v for k, v in V2.items() if k != "maxSaturation"},
38
+ {**V2, "minSaturation": 41}, {**V2, "minValue": 200},
39
+ {**V2, "maxSaturation": 256}, {**V2, "maxValue": -1},
40
+ {**V2, "maxValue": True}, {**V2, "maxValue": 199.5},
41
+ {**V2, "hue": [[10, 0]]}, {**V2, "maxBoxes": 33}, {**V2, "extra": 1}]
42
+ for request in bad:
43
+ with self.subTest(request=request), self.assertRaises(ValueError):
44
+ validate_color_request(request)
45
+
46
+ def test_v2_empty_selection_remains_an_explicit_empty_result(self):
47
+ result = build_color_response(V2, [], [], "c" * 64, (160, 120))
48
+ self.assertEqual(result["version"], 2)
49
+ self.assertEqual(result["people"], [])
50
+
51
+
52
+ @unittest.skipUnless(importlib.util.find_spec("numpy"), "NumPy unavailable for actual HSV arithmetic")
53
+ class BoundedColourArithmeticTest(unittest.TestCase):
54
+ def test_upper_and_lower_bounds_and_red_hue_wrap_are_inclusive(self):
55
+ import numpy as np
56
+ from trillboards_detector.colors import color_pixel_mask
57
+ hsv = np.asarray([[[0, 100, 60], [10, 200, 199], [240, 200, 199], [255, 200, 199],
58
+ [11, 100, 60], [239, 100, 60], [0, 99, 60], [0, 201, 60],
59
+ [0, 100, 59], [0, 100, 200]]], dtype=np.int16)
60
+ request = {**V2, "hue": [[0, 10], [240, 255]], "minSaturation": 100, "maxSaturation": 200}
61
+ self.assertEqual(color_pixel_mask(hsv, request).tolist(),
62
+ [[True, True, True, True, False, False, False, False, False, False]])
63
+ self.assertEqual(color_pixel_mask(hsv, V1).tolist(),
64
+ [[True, True, True, True, False, False, False, True, False, True]])
65
+
66
+ def test_black_white_and_grey_are_distinguished_by_value_and_saturation(self):
67
+ import numpy as np
68
+ from trillboards_detector.colors import color_pixel_mask
69
+ hsv = np.asarray([[[0, 0, 0], [200, 255, 59], [0, 0, 60], [255, 40, 199],
70
+ [0, 0, 200], [255, 40, 255], [0, 41, 200]]], dtype=np.int16)
71
+ black = {**V2, "maxSaturation": 255, "minValue": 0, "maxValue": 59}
72
+ white = {**V2, "minValue": 200, "maxValue": 255}
73
+ self.assertEqual(color_pixel_mask(hsv, black).tolist(), [[True, True, False, False, False, False, False]])
74
+ self.assertEqual(color_pixel_mask(hsv, V2).tolist(), [[False, False, True, True, False, False, False]])
75
+ self.assertEqual(color_pixel_mask(hsv, white).tolist(), [[False, False, False, False, True, True, False]])
76
+
77
+
78
+ if __name__ == "__main__":
79
+ unittest.main()
@@ -123,6 +123,31 @@ class DetectionColorsWireTest(unittest.TestCase):
123
123
  self.assertNotIn("detections", body)
124
124
  self.assertEqual(self.source.calls, 0)
125
125
 
126
+ def test_v2_bounds_select_grey_without_matching_the_saturated_red_half(self):
127
+ self.start([Detection("person", .9, 10, 10, 40, 80), Detection("person", .8, 100, 10, 40, 80)])
128
+ request = {"version": 2, "minScore": .25, "maxBoxes": 32, "hue": [[0, 255]],
129
+ "minSaturation": 0, "maxSaturation": 40, "minValue": 60, "maxValue": 199}
130
+ status, body = self.post(detection_colors=request)
131
+ self.assertEqual(status, 200)
132
+ colors = body["detection_colors"]
133
+ self.assertEqual(colors["version"], 2)
134
+ self.assertEqual(colors["request"], request)
135
+ self.assertEqual(colors["imageSha256"], hashlib.sha256(self.jpeg).hexdigest())
136
+ self.assertEqual(colors["frameSize"], {"width": 160, "height": 120})
137
+ self.assertEqual(colors["people"], [{"detectionIndex": 0, "fraction": 1.0},
138
+ {"detectionIndex": 1, "fraction": 0.0}])
139
+
140
+ def test_v2_invalid_or_incomplete_bounds_are_refused_before_detection(self):
141
+ self.start([Detection("person", .9, 100, 10, 40, 80)])
142
+ request = {**UNIFORM, "version": 2, "maxSaturation": 255, "maxValue": 255}
143
+ for change in [{"maxSaturation": 99}, {"maxValue": 59}, {"maxValue": True},
144
+ {"maxValue": 256}, {"extra": 1}]:
145
+ status, _ = self.post(detection_colors={**request, **change})
146
+ self.assertEqual(status, 400, change)
147
+ status, _ = self.post(detection_colors={key: value for key, value in request.items() if key != "maxValue"})
148
+ self.assertEqual(status, 400)
149
+ self.assertEqual(self.source.calls, 0)
150
+
126
151
  def test_an_unrequested_colour_task_is_absent(self):
127
152
  self.start([Detection("person", .9, 100, 10, 40, 80)])
128
153
  status, body = self.post(detection_colors=None)
@@ -0,0 +1,102 @@
1
+ """Customer manifest and tiny source-staging fixtures; no installer/model run."""
2
+ import base64
3
+ import json
4
+ import os
5
+ from pathlib import Path
6
+ import re
7
+ import shutil
8
+ import subprocess
9
+ import tempfile
10
+ import unittest
11
+
12
+ SDK = Path(__file__).resolve().parents[3]
13
+ DEPLOY = SDK / "deploy"
14
+
15
+
16
+ class HeldPhoneCustomerPackaging(unittest.TestCase):
17
+ def test_npm_manifest_excludes_frozen_phone_but_keeps_other_retained_and_rf_pose(self):
18
+ result = subprocess.run(["npm", "pack", "--dry-run", "--json", "--ignore-scripts"],
19
+ cwd=SDK, capture_output=True, text=True, timeout=40)
20
+ self.assertEqual(result.returncode, 0, result.stderr)
21
+ if os.environ.get("HELD_PHONE_NPM_MANIFEST"):
22
+ Path(os.environ["HELD_PHONE_NPM_MANIFEST"]).write_text(result.stdout)
23
+ files = {row["path"] for row in json.loads(result.stdout)[0]["files"]}
24
+ self.assertFalse(sorted(p for p in files if p.startswith("retained/phone-embedding/")))
25
+ tracked = subprocess.check_output(["git", "ls-files", "--", "retained"], cwd=SDK, text=True).splitlines()
26
+ expected = {p for p in tracked if not p.startswith("retained/phone-embedding/")
27
+ and Path(p).name not in (".npmignore", ".gitignore", ".gitattributes")}
28
+ self.assertTrue(expected)
29
+ self.assertEqual(sorted(expected-files), [])
30
+ for relative in ["deploy/detector/pyproject.toml", "deploy/detector/trillboards_detector/loader.py",
31
+ "deploy/detector/trillboards_detector/pose.py", "deploy/detector/trillboards_detector/session.py"]:
32
+ self.assertIn(relative, files)
33
+ self.assertNotIn("ai-edge-litert", (DEPLOY / "detector/pyproject.toml").read_text())
34
+
35
+ def test_actual_windows_copy_omits_only_phone_and_preserves_original(self):
36
+ powershell = shutil.which("powershell.exe")
37
+ if not powershell:
38
+ self.skipTest("Windows PowerShell is required for the Windows copy fixture")
39
+ source = DEPLOY / "windows/build-windows.ps1"
40
+ source_text = source.read_text()
41
+ self.assertIn('Copy-RetainedRuntime -Source "$PkgRoot\\retained"', source_text)
42
+ self.assertIn('Copy-RetainedRuntime -Source "$src\\retained"', source_text)
43
+ source_path = str(source) if os.name == "nt" else subprocess.check_output(["wslpath", "-w", str(source)], text=True).strip()
44
+ script = r"""
45
+ $ErrorActionPreference='Stop';$ProgressPreference='SilentlyContinue'
46
+ $tokens=$null;$errors=$null
47
+ $tree=[Management.Automation.Language.Parser]::ParseInput([IO.File]::ReadAllText('%s',[Text.Encoding]::UTF8),[ref]$tokens,[ref]$errors)
48
+ if($errors){throw 'Staging source parse failed'}
49
+ $definition=$tree.Find({param($node)$node -is [Management.Automation.Language.FunctionDefinitionAst] -and $node.Name -eq 'Copy-RetainedRuntime'},$true)
50
+ if(-not $definition){throw 'Missing actual staging function'}
51
+ Invoke-Expression $definition.Extent.Text
52
+ $base=[IO.Path]::GetFullPath([IO.Path]::GetTempPath())
53
+ $root=Join-Path $base ('trillboards-held-phone-copy-'+[Guid]::NewGuid().ToString('N'))
54
+ try {
55
+ $source=Join-Path $root 'source'
56
+ New-Item -ItemType Directory -Force -Path (Join-Path $source 'phone-embedding\source'),(Join-Path $source 'other')|Out-Null
57
+ foreach($name in @('manager.cjs','.evidence','other\keep.json','phone-embedding\source\model.tflite')) {
58
+ Set-Content -LiteralPath (Join-Path $source $name) -Value 'non-model fixture'
59
+ }
60
+ $results=@()
61
+ foreach($relative in @('lib\edge-sdk\retained','lib\node_modules\@trillboards\edge-sdk\retained')){
62
+ $dest=Join-Path $root $relative
63
+ Copy-RetainedRuntime -Source $source -Destination $dest
64
+ $results+=,@(Get-ChildItem -LiteralPath $dest -Recurse -Force -File|ForEach-Object{$_.FullName.Substring($dest.Length+1)}|Sort-Object)
65
+ }
66
+ [pscustomobject]@{results=@($results);originalPreserved=(Test-Path -LiteralPath (Join-Path $source 'phone-embedding\source\model.tflite'))}|ConvertTo-Json -Compress -Depth 5
67
+ }finally{
68
+ $resolved=[IO.Path]::GetFullPath($root)
69
+ if(-not $resolved.StartsWith($base,[StringComparison]::OrdinalIgnoreCase) -or [IO.Path]::GetFileName($resolved) -notlike 'trillboards-held-phone-copy-*'){throw 'Fixture cleanup escaped temp root'}
70
+ Remove-Item -LiteralPath $resolved -Recurse -Force -ErrorAction SilentlyContinue
71
+ }
72
+ """ % source_path.replace("'", "''")
73
+ result = subprocess.run([powershell, "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-EncodedCommand",
74
+ base64.b64encode(script.encode("utf-16le")).decode()],
75
+ capture_output=True, text=True, timeout=15)
76
+ self.assertEqual(result.returncode, 0, result.stdout+result.stderr)
77
+ self.assertEqual(json.loads(result.stdout.strip().splitlines()[-1]),
78
+ {"results": [[".evidence", "manager.cjs", "other\\keep.json"]]*2, "originalPreserved": True})
79
+
80
+ def test_actual_macos_copy_omits_only_phone_and_preserves_original(self):
81
+ source = (DEPLOY / "macos/build-macos-pkg.sh").read_text()
82
+ match = re.search(r"^copy_retained_runtime\(\) \{.*?^\}", source, re.M | re.S)
83
+ self.assertIsNotNone(match)
84
+ self.assertIn('copy_retained_runtime "$PKG_ROOT/retained"', source)
85
+ self.assertIn('copy_retained_runtime "$src/retained"', source)
86
+ with tempfile.TemporaryDirectory(prefix="held-phone-copy-") as temp:
87
+ root=Path(temp)
88
+ for name in ["manager.cjs", ".evidence", "other/keep.json", "phone-embedding/source/model.tflite"]:
89
+ file=root/"source"/name;file.parent.mkdir(parents=True,exist_ok=True);file.write_text("non-model fixture")
90
+ for relative in ["lib/edge-sdk/retained", "lib/node_modules/@trillboards/edge-sdk/retained"]:
91
+ dest=root/relative
92
+ result=subprocess.run(["bash","-c",match.group()+'\ncopy_retained_runtime "$1" "$2"',
93
+ "held-phone-copy-fixture",str(root/"source"),str(dest)],
94
+ capture_output=True,text=True,timeout=5)
95
+ self.assertEqual(result.returncode,0,result.stderr)
96
+ self.assertEqual(sorted(p.relative_to(dest).as_posix() for p in dest.rglob("*") if p.is_file()),
97
+ [".evidence","manager.cjs","other/keep.json"])
98
+ self.assertTrue((root/"source/phone-embedding/source/model.tflite").is_file())
99
+
100
+
101
+ if __name__ == "__main__":
102
+ unittest.main()
@@ -13,5 +13,5 @@ human sets.
13
13
  """
14
14
 
15
15
  BASE_VERSION = "0.2.0"
16
- SOURCE_FINGERPRINT = "a8173c092f27"
17
- VERSION = "0.2.0+src.a8173c092f27"
16
+ SOURCE_FINGERPRINT = "42da00861e2b"
17
+ VERSION = "0.2.0+src.42da00861e2b"
@@ -4,7 +4,9 @@ A uniform is the cheapest staff cue a ceiling camera sees: the Texas paint
4
4
  counter's staff wear the store's red vest or shirt, its customers almost never
5
5
  do. The connector decides "is a staff member here" from the share of a
6
6
  person's box that is uniform-coloured; this module measures that share and
7
- nothing else. It runs no model and makes no decision.
7
+ nothing else. It runs no model and makes no decision. Version 2 also supports
8
+ upper saturation/value bounds for selected achromatic and bounded colours;
9
+ neither version identifies garment type.
8
10
 
9
11
  The arithmetic is the one the 2026-11-04 measurement used
10
12
  (docs/runbooks/cctv-detector-tier.md section 5b): Pillow decodes the original
@@ -26,20 +28,28 @@ MAX_HUE_RANGES = 4
26
28
 
27
29
  def validate_color_request(value):
28
30
  """`detection_colors` -> the same dict, or ValueError."""
31
+ bounded = isinstance(value, dict) and value.get("version") == 2
32
+ fields = {"version", "minScore", "maxBoxes", "hue", "minSaturation", "minValue"}
33
+ if bounded:
34
+ fields |= {"maxSaturation", "maxValue"}
29
35
  if (not isinstance(value, dict)
30
- or set(value) != {"version", "minScore", "maxBoxes", "hue", "minSaturation", "minValue"}
31
- or type(value["version"]) is not int or value["version"] != 1
36
+ or set(value) != fields
37
+ or type(value["version"]) is not int or value["version"] not in (1, 2)
32
38
  or isinstance(value["minScore"], bool) or not isinstance(value["minScore"], (int, float))
33
39
  or not math.isfinite(value["minScore"]) or not 0 < value["minScore"] <= 1
34
40
  or type(value["maxBoxes"]) is not int or not 1 <= value["maxBoxes"] <= MAX_COLOR_BOXES
35
41
  or type(value["minSaturation"]) is not int or not 0 <= value["minSaturation"] <= 255
36
42
  or type(value["minValue"]) is not int or not 0 <= value["minValue"] <= 255
43
+ or bounded and (type(value["maxSaturation"]) is not int
44
+ or not value["minSaturation"] <= value["maxSaturation"] <= 255
45
+ or type(value["maxValue"]) is not int
46
+ or not value["minValue"] <= value["maxValue"] <= 255)
37
47
  or not isinstance(value["hue"], list) or not 1 <= len(value["hue"]) <= MAX_HUE_RANGES
38
48
  or any(not isinstance(r, list) or len(r) != 2 or any(type(v) is not int for v in r)
39
49
  or not 0 <= r[0] <= r[1] <= 255 for r in value["hue"])):
40
50
  raise ValueError(
41
- "detection_colors needs version 1, minScore in (0, 1], maxBoxes 1..%d, "
42
- "1..%d hue ranges of whole 0..255 values, and whole saturation/value floors"
51
+ "detection_colors needs version 1 floors or version 2 saturation/value bounds, "
52
+ "minScore in (0, 1], maxBoxes 1..%d, and 1..%d hue ranges of whole 0..255 values"
43
53
  % (MAX_COLOR_BOXES, MAX_HUE_RANGES))
44
54
  return {**value, "hue": [list(r) for r in value["hue"]]}
45
55
 
@@ -52,6 +62,19 @@ def color_box_indices(detections, request):
52
62
  return [index for index, _ in people[:request["maxBoxes"]]]
53
63
 
54
64
 
65
+ def color_pixel_mask(hsv, request):
66
+ """Inclusive Pillow 8-bit HSV predicate; version 1 retains its measured floors."""
67
+ import numpy as np
68
+ hue, sat, val = hsv[..., 0], hsv[..., 1], hsv[..., 2]
69
+ in_hue = np.zeros(hue.shape, dtype=bool)
70
+ for low, high in request["hue"]:
71
+ in_hue |= (hue >= low) & (hue <= high)
72
+ match = in_hue & (sat >= request["minSaturation"]) & (val >= request["minValue"])
73
+ if request["version"] == 2:
74
+ match &= (sat <= request["maxSaturation"]) & (val <= request["maxValue"])
75
+ return match
76
+
77
+
55
78
  def detection_color_fractions(jpeg, boxes, request):
56
79
  """Fraction of each [x, y, width, height] box whose pixels match the request."""
57
80
  import numpy as np
@@ -61,11 +84,7 @@ def detection_color_fractions(jpeg, boxes, request):
61
84
  raise ValueError("colour fractions need a bounded original JPEG")
62
85
  hsv = np.asarray(image.convert("HSV")).astype(np.int16)
63
86
  height, width = hsv.shape[0], hsv.shape[1]
64
- hue, sat, val = hsv[..., 0], hsv[..., 1], hsv[..., 2]
65
- in_hue = np.zeros(hue.shape, dtype=bool)
66
- for low, high in request["hue"]:
67
- in_hue |= (hue >= low) & (hue <= high)
68
- match = in_hue & (sat >= request["minSaturation"]) & (val >= request["minValue"])
87
+ match = color_pixel_mask(hsv, request)
69
88
  fractions = []
70
89
  for x, y, w, h in boxes:
71
90
  x0, x1 = int(max(0, x)), int(min(width, x + w))
@@ -79,7 +98,7 @@ def build_color_response(request, indices, fractions, image_sha256, frame_size):
79
98
  if len(indices) != len(fractions) or any(
80
99
  isinstance(f, bool) or not isinstance(f, float) or not 0 <= f <= 1 for f in fractions):
81
100
  raise ValueError("colour fractions differ from the requested person boxes")
82
- return {"version": 1, "imageSha256": image_sha256,
101
+ return {"version": request["version"], "imageSha256": image_sha256,
83
102
  "frameSize": {"width": frame_size[0], "height": frame_size[1]},
84
103
  "request": request,
85
104
  "people": [{"detectionIndex": i, "fraction": f} for i, f in zip(indices, fractions)]}
@@ -276,7 +276,7 @@ def parse_detection_pose(raw: bytes):
276
276
 
277
277
 
278
278
  def parse_detection_colors(raw: bytes):
279
- """`detection_colors`: uniform-colour share of each confident person box."""
279
+ """`detection_colors`: v1 floors or v2 bounded colour share of each confident person box."""
280
280
  body = json.loads(raw.decode("utf-8"))
281
281
  if "detection_colors" not in body:
282
282
  return None
@@ -206,7 +206,19 @@ log "Building all edge workspaces (tsc, dependency order)…"
206
206
  log "Staging edge-sdk dist…"
207
207
  mkdir -p "$PAYLOAD/lib/edge-sdk"
208
208
  cp -R "$PKG_ROOT/dist" "$PAYLOAD/lib/edge-sdk/dist"
209
- cp -R "$PKG_ROOT/retained" "$PAYLOAD/lib/edge-sdk/retained"
209
+ # Frozen experimental phone code/models remain repository evidence. Released
210
+ # phone sensing uses the normal RF-DETR/pose service; omit the obsolete helper.
211
+ copy_retained_runtime() {
212
+ local source="$1" destination="$2" item
213
+ mkdir -p "$destination"
214
+ for item in "$source"/* "$source"/.[!.]* "$source"/..?*; do
215
+ [ -e "$item" ] || [ -L "$item" ] || continue
216
+ [ "${item##*/}" != 'phone-embedding' ] || continue
217
+ cp -R "$item" "$destination/"
218
+ done
219
+ }
220
+
221
+ copy_retained_runtime "$PKG_ROOT/retained" "$PAYLOAD/lib/edge-sdk/retained"
210
222
  cp "$PKG_ROOT/package.json" "$PAYLOAD/lib/edge-sdk/package.json"
211
223
 
212
224
  # ─── 3. Lay down the runtime node_modules subset (NO heavy native stack) ──────
@@ -242,7 +254,7 @@ for p in edge-core edge-sensing edge-ads edge-federated edge-cloud \
242
254
  rm -rf "$dest"
243
255
  mkdir -p "$dest"
244
256
  [ -d "$src/dist" ] && cp -R "$src/dist" "$dest/dist"
245
- [ "$p" != "edge-sdk" ] || cp -R "$src/retained" "$dest/retained"
257
+ [ "$p" != "edge-sdk" ] || copy_retained_runtime "$src/retained" "$dest/retained"
246
258
  cp "$src/package.json" "$dest/package.json"
247
259
  done
248
260
 
@@ -93,6 +93,16 @@ if (Test-Path $Stage) { Remove-Item -Recurse -Force $Stage }
93
93
  if (Test-Path $Scratch) { Remove-Item -Recurse -Force $Scratch }
94
94
  New-Item -ItemType Directory -Force -Path "$Payload\bin","$Payload\lib","$Scratch" | Out-Null
95
95
 
96
+ # The frozen experimental phone helper remains repository evidence. Released
97
+ # phone sensing uses the normal RF-DETR/pose service; omit the obsolete helper.
98
+ function Copy-RetainedRuntime([string]$Source, [string]$Destination) {
99
+ New-Item -ItemType Directory -Force -Path $Destination | Out-Null
100
+ foreach ($item in (Get-ChildItem -LiteralPath $Source -Force)) {
101
+ if ($item.Name -eq 'phone-embedding') { continue }
102
+ Copy-Item -LiteralPath $item.FullName -Destination $Destination -Recurse -Force
103
+ }
104
+ }
105
+
96
106
  # ─── 1. Build ALL edge workspaces (tsc, dependency order) ──────────────────────
97
107
  # edge-sdk's tsc imports edge-core, edge-platform-rtsp/linux/windows, edge-sensing,
98
108
  # edge-ads, edge-federated AND edge-cloud — every workspace's dist must exist before
@@ -107,7 +117,7 @@ Push-Location $WorkspaceRoot; npm run build; if ($LASTEXITCODE -ne 0) { Die "edg
107
117
  Log "Staging edge-sdk dist…"
108
118
  New-Item -ItemType Directory -Force -Path "$Payload\lib\edge-sdk" | Out-Null
109
119
  Copy-Item -Recurse -Force "$PkgRoot\dist" "$Payload\lib\edge-sdk\dist"
110
- Copy-Item -Recurse -Force "$PkgRoot\retained" "$Payload\lib\edge-sdk\retained"
120
+ Copy-RetainedRuntime -Source "$PkgRoot\retained" -Destination "$Payload\lib\edge-sdk\retained"
111
121
  Copy-Item -Force "$PkgRoot\package.json" "$Payload\lib\edge-sdk\package.json"
112
122
 
113
123
  # ─── 3. Runtime node_modules subset (NO heavy native stack) ────────────────────
@@ -144,7 +154,7 @@ foreach ($p in @("edge-core","edge-sensing","edge-ads","edge-federated","edge-cl
144
154
  if (Test-Path $dest) { Remove-Item -Recurse -Force $dest }
145
155
  New-Item -ItemType Directory -Force -Path $dest | Out-Null
146
156
  if (Test-Path "$src\dist") { Copy-Item -Recurse -Force "$src\dist" "$dest\dist" }
147
- if ($p -eq 'edge-sdk') { Copy-Item -Recurse -Force "$src\retained" "$dest\retained" }
157
+ if ($p -eq 'edge-sdk') { Copy-RetainedRuntime -Source "$src\retained" -Destination "$dest\retained" }
148
158
  Copy-Item -Force "$src\package.json" "$dest\package.json"
149
159
  }
150
160
 
@@ -142,15 +142,162 @@ function Wait-DetectorAnswer {
142
142
  throw 'The installed detector did not answer after restart'
143
143
  }
144
144
  function Assert-ImageInference {
145
+ param([string]$InferenceModel = 'gemma-4-E2B-it.litertlm', [string]$ExpectedModelSha256 = '', [System.Collections.IDictionary]$Evidence = $null)
145
146
  $image = [Convert]::ToBase64String([IO.File]::ReadAllBytes($PersonFrame))
146
- $body = @{ model = 'gemma-4-E2B-it.litertlm'; max_completion_tokens = 256; temperature = 0;
147
+ $body = @{ model = $InferenceModel; max_completion_tokens = 256; temperature = 0;
147
148
  messages = @(@{ role = 'user'; content = @(@{ type = 'text'; text = 'Look at the image. Is there a person visible? Answer YES or NO.' },
148
149
  @{ 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
+ $request = @{ Uri = 'http://127.0.0.1:9379/v1/chat/completions'; Method = 'Post'; ContentType = 'application/json'; Body = $body; TimeoutSec = 240 }
151
+ if ($ExpectedModelSha256) {
152
+ # Same endpoint and selected delegate as the default Windows customer client.
153
+ $request.Uri = 'http://localhost:9379/v1/chat/completions'
154
+ $request.Headers = @{ 'X-Trillboards-Model-Sha256' = $ExpectedModelSha256 }
155
+ }
156
+ if ($null -ne $Evidence) {
157
+ $Evidence.request = [ordered]@{ uri = $request.Uri; model = $InferenceModel; modelSha256 = $ExpectedModelSha256;
158
+ personImageSha256 = (Get-FileHash -LiteralPath $PersonFrame -Algorithm SHA256).Hash.ToLowerInvariant();
159
+ maxCompletionTokens = 256; temperature = 0; timeoutSeconds = 240 }
160
+ }
161
+ $answer = Invoke-RestMethod @request
162
+ if ($null -ne $Evidence) { $Evidence.response = $answer }
163
+ if ($ExpectedModelSha256) { Assert-QualificationRuntimeProof $answer $InferenceModel $ExpectedModelSha256 }
150
164
  if (@($answer.choices).Count -lt 1 -or [string]$answer.choices[0].message.content -notmatch '(?i)\byes\b') {
151
165
  throw 'The installed model did not confirm the person in the committed image fixture'
152
166
  }
153
167
  }
168
+ function Get-QualificationClockSeconds { [Diagnostics.Stopwatch]::GetTimestamp() / [double][Diagnostics.Stopwatch]::Frequency }
169
+ function New-QualificationSetupBarrier {
170
+ $sid = [Security.Principal.WindowsIdentity]::GetCurrent().User.Value
171
+ New-Object System.Threading.Mutex($false, ('Global\TrillboardsLiteRtLmSetup-' + $sid))
172
+ }
173
+ function Get-QualificationModelConfigPath { Join-Path $env:USERPROFILE '.litert-lm\config.json' }
174
+ function Invoke-QualificationModelInspection {
175
+ # Reuse installed ownership validation, including SID, uv runtime and foreign listeners.
176
+ & (Join-Path $installDir 'bin\stop-local-ai.ps1') -Service Model -Inspect
177
+ }
178
+ function Get-QualificationModelSnapshot {
179
+ $snapshot = [ordered]@{ ready = $false; atUtc = [DateTimeOffset]::UtcNow.ToString('o'); reason = 'config-unverified' }
180
+ $path = Get-QualificationModelConfigPath
181
+ $snapshot.configPath = $path
182
+ if (-not (Test-Path -LiteralPath $path -PathType Leaf)) { return $snapshot }
183
+ $snapshot.configSha256 = (Get-FileHash -LiteralPath $path -Algorithm SHA256).Hash.ToLowerInvariant()
184
+ $snapshot.configText = [IO.File]::ReadAllText($path)
185
+ try { $snapshot.config = $snapshot.configText | ConvertFrom-Json } catch {
186
+ $snapshot.reason = 'config-invalid'; $snapshot.configError = $_.Exception.Message; return $snapshot
187
+ }
188
+ if ((Get-FileHash -LiteralPath $path -Algorithm SHA256).Hash -ine $snapshot.configSha256) {
189
+ $snapshot.reason = 'config-changing'; return $snapshot
190
+ }
191
+ $models = $snapshot.config.PSObject.Properties['models']
192
+ if ($null -eq $models) { return $snapshot }
193
+ $model = $models.Value.PSObject.Properties['gemma-4-E2B-it.litertlm']
194
+ if ($null -eq $model) { return $snapshot }
195
+ $backend = $model.Value.PSObject.Properties['backend']
196
+ if ($null -eq $backend -or [string]$backend.Value -notin @('cpu','gpu','npu')) { return $snapshot }
197
+ $snapshot.backend = [string]$backend.Value
198
+ # LiteRtVlmProvider.ts:450-458,607-636: auto uses verified Windows CPU; otherwise GPU.
199
+ $snapshot.inferenceModel = 'gemma-4-E2B-it.litertlm,' + $(if ($snapshot.backend -eq 'cpu') { 'cpu' } else { 'gpu' })
200
+ $snapshot.ownership = Invoke-QualificationModelInspection
201
+ if (-not $snapshot.ownership.TaskPresent -or -not $snapshot.ownership.Enabled -or -not $snapshot.ownership.Running -or
202
+ $snapshot.ownership.Port -ne 9379 -or $snapshot.ownership.ListenerCount -lt 1) {
203
+ $snapshot.reason = 'owned-service-not-listening'; return $snapshot
204
+ }
205
+ $listeners = @(Get-NetTCPConnection -LocalPort 9379 -State Listen -ErrorAction Stop | Select-Object -ExpandProperty OwningProcess -Unique)
206
+ if ($listeners.Count -ne 1) { $snapshot.reason = 'ambiguous-producer'; return $snapshot }
207
+ $producer = @(Get-CimInstance -ClassName Win32_Process -Filter ('ProcessId=' + $listeners[0]) -OperationTimeoutSec 5 -ErrorAction Stop)
208
+ if ($producer.Count -ne 1 -or -not $producer[0].CreationDate -or -not $producer[0].ExecutablePath -or -not $producer[0].CommandLine) {
209
+ $snapshot.reason = 'producer-identity-unavailable'; return $snapshot
210
+ }
211
+ $snapshot.producer = [ordered]@{ processId = [int]$producer[0].ProcessId; creationDate = [string]$producer[0].CreationDate;
212
+ executablePath = [string]$producer[0].ExecutablePath; commandLine = [string]$producer[0].CommandLine }
213
+ # Recheck authority after reading the producer; never accept a newly foreign listener.
214
+ $null = Invoke-QualificationModelInspection
215
+ $snapshot.ready = $true; $snapshot.reason = 'owned-verified-configuration'
216
+ return $snapshot
217
+ }
218
+ function Assert-QualificationModelGeneration($Before, $After) {
219
+ if (-not $Before.ready -or -not $After.ready -or $Before.configSha256 -cne $After.configSha256 -or
220
+ $Before.backend -cne $After.backend -or $Before.inferenceModel -cne $After.inferenceModel -or
221
+ $Before.producer.processId -ne $After.producer.processId -or $Before.producer.creationDate -cne $After.producer.creationDate -or
222
+ $Before.producer.executablePath -cne $After.producer.executablePath -or $Before.producer.commandLine -cne $After.producer.commandLine) {
223
+ throw 'The model configuration or producer generation changed during restart qualification'
224
+ }
225
+ }
226
+ function Wait-QualificationModelReady($Evidence) {
227
+ $started = Get-QualificationClockSeconds
228
+ $barrier = New-QualificationSetupBarrier
229
+ try {
230
+ while (((Get-QualificationClockSeconds) - $started) -lt 120) {
231
+ $held = $false
232
+ try {
233
+ try { $held = $barrier.WaitOne(0) } catch [Threading.AbandonedMutexException] { $held = $true; $Evidence.abandonedSetupOwner = $true }
234
+ if ($held) {
235
+ $Evidence.setupBarrierAcquired = $true
236
+ $snapshot = Get-QualificationModelSnapshot
237
+ $Evidence.lastReadinessSnapshot = $snapshot
238
+ if ($snapshot.ready -and ((Get-QualificationClockSeconds) - $started) -lt 120) { return $snapshot }
239
+ }
240
+ } finally { if ($held) { $barrier.ReleaseMutex() } }
241
+ $remaining = 120 - ((Get-QualificationClockSeconds) - $started)
242
+ if ($remaining -gt 0) { Start-Sleep -Milliseconds ([int][Math]::Min(2000, [Math]::Ceiling($remaining * 1000))) }
243
+ }
244
+ throw 'The owned verified model configuration did not become ready within the existing 120-second deadline'
245
+ } finally { $Evidence.readinessSeconds = (Get-QualificationClockSeconds) - $started; $barrier.Dispose() }
246
+ }
247
+ function Test-QualificationSetupIdle {
248
+ $barrier = New-QualificationSetupBarrier
249
+ $held = $false
250
+ try {
251
+ try { $held = $barrier.WaitOne(0) } catch [Threading.AbandonedMutexException] { $held = $true }
252
+ return $held
253
+ } finally { if ($held) { $barrier.ReleaseMutex() }; $barrier.Dispose() }
254
+ }
255
+ function Assert-QualificationRuntimeProof($Answer, [string]$InferenceModel, [string]$Sha256) {
256
+ $property = $Answer.PSObject.Properties['runtimeModel']
257
+ if ($null -eq $property -or $null -eq $property.Value) { throw 'The person response lacks native runtime model proof' }
258
+ $proof = $property.Value
259
+ if ((@($proof.PSObject.Properties.Name | Sort-Object) -join ',') -cne 'format,runtimeModelId,sha256,version' -or
260
+ $proof.version -ne 1 -or $proof.format -cne 'litert-lm' -or $proof.sha256 -cne $Sha256 -or $proof.runtimeModelId -cne $InferenceModel) {
261
+ throw 'The person response did not execute the selected artifact/backend'
262
+ }
263
+ }
264
+ function Assert-RestartImageInference([string]$ServiceName) {
265
+ $evidence = [ordered]@{ service = $ServiceName; passed = $false; phase = 'setup-completion'; setupBarrierAcquired = $false;
266
+ startedAtUtc = [DateTimeOffset]::UtcNow.ToString('o'); readinessDeadlineSeconds = 120; personTimeoutSeconds = 240;
267
+ backendStandardError = @{ available = $false; reason = 'The installed Windows hidden model task discards stdout/stderr; see register-litertlm-task.ps1:30-41. Available provisioner logs are retained separately.' } }
268
+ $receipt.serviceRestartChecks += $evidence
269
+ try {
270
+ # Setup completion is a barrier only. The customer client takes no setup lock.
271
+ $ready = Wait-QualificationModelReady $evidence
272
+ $evidence.phase = 'detector-readiness'
273
+ Wait-DetectorAnswer
274
+ Assert-HiddenTask 'TrillboardsLiteRtLm'; Assert-HiddenTask 'TrillboardsDetector'
275
+ $evidence.phase = 'before-person-inference'
276
+ $evidence.setupIdleBeforeInference = Test-QualificationSetupIdle
277
+ if (-not $evidence.setupIdleBeforeInference) { throw 'Model setup became active before acceptance inference' }
278
+ $evidence.beforeInference = Get-QualificationModelSnapshot
279
+ Assert-QualificationModelGeneration $ready $evidence.beforeInference
280
+ $evidence.phase = 'person-inference'
281
+ Assert-ImageInference -InferenceModel $ready.inferenceModel -ExpectedModelSha256 'ab7838cdfc8f77e54d8ca45eadceb20452d9f01e4bfade03e5dce27911b27e42' -Evidence $evidence
282
+ $evidence.phase = 'after-person-inference'
283
+ $evidence.afterInference = Get-QualificationModelSnapshot
284
+ $evidence.setupIdleAfterInference = Test-QualificationSetupIdle
285
+ if (-not $evidence.setupIdleAfterInference) { throw 'Model setup became active during acceptance inference' }
286
+ Assert-QualificationModelGeneration $evidence.beforeInference $evidence.afterInference
287
+ $evidence.passed = $true; $evidence.phase = 'complete'
288
+ } catch {
289
+ $evidence.failure = $_.Exception.Message
290
+ $evidence.failureType = $_.Exception.GetType().FullName
291
+ $evidence.failureId = $_.FullyQualifiedErrorId
292
+ $evidence.failureStack = $_.ScriptStackTrace
293
+ try { $evidence.afterFailure = Get-QualificationModelSnapshot } catch { $evidence.afterFailureError = $_.Exception.Message }
294
+ throw
295
+ } finally {
296
+ $evidence.completedAtUtc = [DateTimeOffset]::UtcNow.ToString('o')
297
+ $evidence | ConvertTo-Json -Depth 16 | Set-Content -LiteralPath (Join-Path $root ('restart-' + $ServiceName + '.json'))
298
+ }
299
+ }
300
+
154
301
  try {
155
302
  if ([bool]$CustomerPackagePath -ne [bool]$ManifestPath) { throw 'Candidate package and manifest paths must be provided together' }
156
303
  $localCandidate = [bool]$CustomerPackagePath
@@ -220,16 +367,28 @@ try {
220
367
  Wait-ModelReady; Wait-DetectorAnswer
221
368
  $receipt.phase = 'repeat-install-inference'
222
369
  Assert-ImageInference
223
- $receipt.repeatInstallPassed = $true; $receipt.phase = 'service-restart'
370
+ $receipt.repeatInstallPassed = $true; $receipt.phase = 'service-restart'; $receipt.serviceRestartChecks = @()
371
+ $receipt.serviceRestartPreparationChecks = @()
224
372
  $powershell = Join-Path $env:WINDIR 'System32\WindowsPowerShell\v1.0\powershell.exe'
225
373
  foreach ($service in @(@{ Name = 'Model'; Task = 'TrillboardsLiteRtLm' }, @{ Name = 'Detector'; Task = 'TrillboardsDetector' })) {
374
+ $preStop = [ordered]@{ service = $service.Name; phase = 'before-stop-setup-completion'; passed = $false;
375
+ setupBarrierAcquired = $false; startedAtUtc = [DateTimeOffset]::UtcNow.ToString('o'); readinessDeadlineSeconds = 120 }
376
+ $receipt.serviceRestartPreparationChecks += $preStop
377
+ try {
378
+ # Completion precondition only; the existing waiter releases the mutex before stop/start.
379
+ $preStop.snapshot = Wait-QualificationModelReady $preStop
380
+ $preStop.passed = $true
381
+ } catch {
382
+ $preStop.failure = $_.Exception.Message
383
+ throw
384
+ } finally {
385
+ $preStop.completedAtUtc = [DateTimeOffset]::UtcNow.ToString('o')
386
+ }
226
387
  $null = Invoke-QualificationProcess -File $powershell -Arguments @('-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File',
227
388
  (Join-Path $installDir 'bin\stop-local-ai.ps1'), '-Service', $service.Name) -LogName ('stop-' + $service.Name + '.log') -TimeoutSeconds 90
228
389
  Enable-ScheduledTask -TaskName $service.Task -TaskPath '\' -ErrorAction Stop | Out-Null
229
390
  Start-ScheduledTask -TaskName $service.Task -TaskPath '\' -ErrorAction Stop
230
- Wait-ModelReady; Wait-DetectorAnswer
231
- Assert-HiddenTask 'TrillboardsLiteRtLm'; Assert-HiddenTask 'TrillboardsDetector'
232
- Assert-ImageInference
391
+ Assert-RestartImageInference -ServiceName $service.Name
233
392
  }
234
393
  $receipt.serviceRestartPassed = $true; $receipt.phase = 'uninstall'
235
394
  $receipt.uninstallerSha256 = Invoke-InstalledUninstaller -InstallDir $installDir -RunRoot $root -InheritPowerShellModulePath:($PowerShellModuleEnvironment -eq 'Inherited')
@@ -250,7 +409,7 @@ try {
250
409
  if (Test-Path -LiteralPath $logDir -PathType Container) { Copy-Item -LiteralPath $logDir -Destination (Join-Path $root 'product-logs') -Recurse -Force }
251
410
  } catch { Write-Warning ('Some product logs could not be copied: ' + $_.Exception.Message) }
252
411
  $receipt.completedAtUtc = [DateTimeOffset]::UtcNow.ToString('o')
253
- $receipt | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath (Join-Path $root 'qualification.json')
412
+ $receipt | ConvertTo-Json -Depth 20 | Set-Content -LiteralPath (Join-Path $root 'qualification.json')
254
413
  if ($env:GITHUB_OUTPUT) { ('artifact_path=' + $root) | Out-File -LiteralPath $env:GITHUB_OUTPUT -Append -Encoding utf8 }
255
- $receipt | ConvertTo-Json -Depth 8
414
+ $receipt | ConvertTo-Json -Depth 20
256
415
  }
@@ -76,7 +76,10 @@ function Resolve-DetectorSource {
76
76
  # and a matching package version do not prove the detector can even import.
77
77
  function Ensure-DetectorNativeRuntime {
78
78
  $required = @('vcruntime140.dll','vcruntime140_1.dll','msvcp140.dll')
79
- $missing = @($required | Where-Object { -not (Test-Path -LiteralPath (Join-Path $env:WINDIR ('System32\' + $_))) })
79
+ # The NSIS installer is 32-bit: its System32 view is redirected to SysWOW64.
80
+ # Inspect the native x64 DLLs through Sysnative in that process only.
81
+ $nativeSystemDirectory = if ([Environment]::Is64BitOperatingSystem -and -not [Environment]::Is64BitProcess) { 'Sysnative' } else { 'System32' }
82
+ $missing = @($required | Where-Object { -not (Test-Path -LiteralPath (Join-Path $env:WINDIR ($nativeSystemDirectory + '\' + $_))) })
80
83
  if (-not $missing.Count) { return }
81
84
  Log 'Installing the missing Microsoft x64 C++ runtime required by the local detector'
82
85
  $runtimeDirectory = [IO.Path]::GetFullPath((Join-Path $env:TEMP ('trillboards-detector-vc-' + [Guid]::NewGuid().ToString('N'))))