@trillboards/edge-sdk 0.2.52 → 0.2.54
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/macos/README.md +22 -7
- package/deploy/macos/apply-update.sh +225 -0
- package/deploy/macos/bench-local-vlm.sh +140 -0
- package/deploy/macos/build-macos-pkg.sh +13 -10
- package/deploy/macos/scripts/postinstall +13 -3
- package/deploy/windows/README.md +7 -5
- package/deploy/windows/bundle-windows-installer.ps1 +1 -3
- package/deploy/windows/e2e/test-local-sense.ps1 +97 -6
- package/dist/EdgeAgent.js +1 -1
- package/dist/connectorUpdate.d.ts +23 -16
- package/dist/connectorUpdate.d.ts.map +1 -1
- package/dist/connectorUpdate.js +37 -10
- package/dist/connectorUpdate.js.map +1 -1
- package/dist/connectorUpdateApply.d.ts +3 -0
- package/dist/connectorUpdateApply.d.ts.map +1 -1
- package/dist/connectorUpdateApply.js +3 -0
- package/dist/connectorUpdateApply.js.map +1 -1
- package/dist/connectorUpdateApplyMac.d.ts +50 -0
- package/dist/connectorUpdateApplyMac.d.ts.map +1 -0
- package/dist/connectorUpdateApplyMac.js +166 -0
- package/dist/connectorUpdateApplyMac.js.map +1 -0
- package/dist/diagnose.d.ts +1 -1
- package/dist/diagnose.js +1 -1
- package/dist/localVlmBench.d.ts +102 -0
- package/dist/localVlmBench.d.ts.map +1 -1
- package/dist/localVlmBench.js +129 -0
- package/dist/localVlmBench.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* macOS connector updater handoff.
|
|
4
|
+
*
|
|
5
|
+
* The connector owns the safe-point decision. The shipped shell helper owns
|
|
6
|
+
* the signed-pkg transaction because it must use macOS trust, Installer, and
|
|
7
|
+
* launchd. Both stage and commit are detached so a download never blocks
|
|
8
|
+
* sensing and the commit helper survives the connector process it replaces.
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
+
}) : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
+
var ownKeys = function(o) {
|
|
28
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
+
var ar = [];
|
|
30
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
return ownKeys(o);
|
|
34
|
+
};
|
|
35
|
+
return function (mod) {
|
|
36
|
+
if (mod && mod.__esModule) return mod;
|
|
37
|
+
var result = {};
|
|
38
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.MacConnectorUpdateApplier = exports.MAC_UPDATE_DIR_NAME = void 0;
|
|
45
|
+
exports.resolveMacInstallRoot = resolveMacInstallRoot;
|
|
46
|
+
const child_process_1 = require("child_process");
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const connectorUpdateApply_1 = require("./connectorUpdateApply");
|
|
50
|
+
exports.MAC_UPDATE_DIR_NAME = '.edge-auto-update';
|
|
51
|
+
/** A packaged macOS install has node in <root>/bin and the helper in share/. */
|
|
52
|
+
function resolveMacInstallRoot(execPath = process.execPath, exists = (p) => fs.existsSync(p)) {
|
|
53
|
+
const binDir = path.dirname(execPath);
|
|
54
|
+
const root = path.dirname(binDir);
|
|
55
|
+
if (!root || root === binDir)
|
|
56
|
+
return null;
|
|
57
|
+
if (!exists(path.join(root, 'share', 'apply-update.sh')))
|
|
58
|
+
return null;
|
|
59
|
+
return root;
|
|
60
|
+
}
|
|
61
|
+
class MacConnectorUpdateApplier {
|
|
62
|
+
constructor(deps = {}) {
|
|
63
|
+
this.root = deps.installRoot !== undefined ? deps.installRoot : resolveMacInstallRoot();
|
|
64
|
+
this.spawnFn = deps.spawnFn ?? child_process_1.spawn;
|
|
65
|
+
this.readFileFn = deps.readFileFn ?? ((p) => fs.readFileSync(p, 'utf-8'));
|
|
66
|
+
this.existsFn = deps.existsFn ?? ((p) => fs.existsSync(p));
|
|
67
|
+
this.unlinkFn = deps.unlinkFn ?? ((p) => fs.unlinkSync(p));
|
|
68
|
+
this.pid = deps.pid ?? process.pid;
|
|
69
|
+
this.log = deps.log ?? (() => { });
|
|
70
|
+
}
|
|
71
|
+
installRoot() {
|
|
72
|
+
return this.root;
|
|
73
|
+
}
|
|
74
|
+
canStage(manifest) {
|
|
75
|
+
return Boolean(manifest.updateUrl && manifest.updateSha256 && manifest.updateSizeBytes);
|
|
76
|
+
}
|
|
77
|
+
updateDir() {
|
|
78
|
+
return this.root ? path.join(path.dirname(this.root), exports.MAC_UPDATE_DIR_NAME) : null;
|
|
79
|
+
}
|
|
80
|
+
launch(args) {
|
|
81
|
+
if (!this.root)
|
|
82
|
+
return false;
|
|
83
|
+
const script = path.join(this.root, 'share', 'apply-update.sh');
|
|
84
|
+
if (!this.existsFn(script))
|
|
85
|
+
return false;
|
|
86
|
+
try {
|
|
87
|
+
const child = this.spawnFn('/bin/bash', [script, ...args], {
|
|
88
|
+
detached: true,
|
|
89
|
+
stdio: 'ignore',
|
|
90
|
+
});
|
|
91
|
+
child.once('error', (err) => this.log(`[update] macOS applier failed to start: ${err.message}`));
|
|
92
|
+
child.unref();
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
this.log(`[update] macOS applier could not be launched: ${err instanceof Error ? err.message : String(err)}`);
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
stage(opts) {
|
|
101
|
+
if (!this.root || !this.canStage(opts.manifest))
|
|
102
|
+
return false;
|
|
103
|
+
return this.launch([
|
|
104
|
+
'--stage',
|
|
105
|
+
'--install-dir', this.root,
|
|
106
|
+
'--update-url', opts.manifest.updateUrl,
|
|
107
|
+
'--expected-version', opts.manifest.connectorVersion,
|
|
108
|
+
'--current-version', opts.currentVersion,
|
|
109
|
+
'--expected-sha256', opts.manifest.updateSha256,
|
|
110
|
+
'--expected-size', String(opts.manifest.updateSizeBytes),
|
|
111
|
+
]);
|
|
112
|
+
}
|
|
113
|
+
commit(opts) {
|
|
114
|
+
if (!this.root)
|
|
115
|
+
return false;
|
|
116
|
+
return this.launch([
|
|
117
|
+
'--commit',
|
|
118
|
+
'--install-dir', this.root,
|
|
119
|
+
'--expected-version', opts.version,
|
|
120
|
+
'--current-version', opts.currentVersion,
|
|
121
|
+
'--wait-pid', String(this.pid),
|
|
122
|
+
]);
|
|
123
|
+
}
|
|
124
|
+
stagedVersion() {
|
|
125
|
+
const dir = this.updateDir();
|
|
126
|
+
if (!dir)
|
|
127
|
+
return null;
|
|
128
|
+
const marker = path.join(dir, connectorUpdateApply_1.STAGED_MARKER_NAME);
|
|
129
|
+
if (!this.existsFn(marker))
|
|
130
|
+
return null;
|
|
131
|
+
try {
|
|
132
|
+
const parsed = JSON.parse(this.readFileFn(marker));
|
|
133
|
+
return typeof parsed.version === 'string' && parsed.version.length > 0 ? parsed.version : null;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
readOutcome() {
|
|
140
|
+
const dir = this.updateDir();
|
|
141
|
+
if (!dir)
|
|
142
|
+
return null;
|
|
143
|
+
const file = path.join(dir, connectorUpdateApply_1.OUTCOME_FILE_NAME);
|
|
144
|
+
if (!this.existsFn(file))
|
|
145
|
+
return null;
|
|
146
|
+
try {
|
|
147
|
+
return (0, connectorUpdateApply_1.parseUpdateOutcome)(this.readFileFn(file));
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
clearOutcome() {
|
|
154
|
+
const dir = this.updateDir();
|
|
155
|
+
if (!dir)
|
|
156
|
+
return;
|
|
157
|
+
try {
|
|
158
|
+
this.unlinkFn(path.join(dir, connectorUpdateApply_1.OUTCOME_FILE_NAME));
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
// Re-reporting is harmless; crashing the connector is not.
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.MacConnectorUpdateApplier = MacConnectorUpdateApplier;
|
|
166
|
+
//# sourceMappingURL=connectorUpdateApplyMac.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectorUpdateApplyMac.js","sourceRoot":"","sources":["../src/connectorUpdateApplyMac.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBH,sDASC;AAxBD,iDAAsC;AACtC,uCAAyB;AACzB,2CAA6B;AAE7B,iEAKgC;AAGnB,QAAA,mBAAmB,GAAG,mBAAmB,CAAC;AAEvD,gFAAgF;AAChF,SAAgB,qBAAqB,CACnC,WAAmB,OAAO,CAAC,QAA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ped: number;
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
declare const SDK_VERSION = "0.2.
|
|
34
|
+
declare const SDK_VERSION = "0.2.54";
|
|
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.54';
|
|
67
67
|
exports._SDK_VERSION = SDK_VERSION;
|
|
68
68
|
// ---------------------------------------------------------------------------
|
|
69
69
|
// ANSI helpers (no external deps)
|
package/dist/localVlmBench.d.ts
CHANGED
|
@@ -104,6 +104,108 @@ export declare function interleaveArms(arms: BenchArm[], rounds: number): Planne
|
|
|
104
104
|
* 0 s/frame reads as "infinitely fast" and a NaN silently poisons a table.
|
|
105
105
|
*/
|
|
106
106
|
export declare function median(values: number[]): number | null;
|
|
107
|
+
/** The machine a measurement came off. Read from `os`, never asserted. */
|
|
108
|
+
export interface MachineDescriptor {
|
|
109
|
+
platform: string;
|
|
110
|
+
arch: string;
|
|
111
|
+
release: string;
|
|
112
|
+
cpuModel: string;
|
|
113
|
+
cores: number;
|
|
114
|
+
memGb: number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Minimal `os` surface this needs. Injectable ONLY so the unit tests can drive
|
|
118
|
+
* a Windows/Linux descriptor from a Mac — production always passes the real
|
|
119
|
+
* `os` module.
|
|
120
|
+
*/
|
|
121
|
+
export interface OsLike {
|
|
122
|
+
platform(): string;
|
|
123
|
+
arch(): string;
|
|
124
|
+
release(): string;
|
|
125
|
+
cpus(): Array<{
|
|
126
|
+
model?: string;
|
|
127
|
+
}>;
|
|
128
|
+
totalmem(): number;
|
|
129
|
+
}
|
|
130
|
+
export declare function describeMachine(osLike: OsLike): MachineDescriptor;
|
|
131
|
+
/**
|
|
132
|
+
* A STABLE slug for "machines of this kind" — the join key between a measured
|
|
133
|
+
* row and a box we might sell. Deliberately excludes OS version and hostname:
|
|
134
|
+
* two runs of the same silicon a point release apart are the same machine
|
|
135
|
+
* class, and a hostname would make every CI runner its own class (a matrix with
|
|
136
|
+
* 200 one-row classes measures nothing).
|
|
137
|
+
*/
|
|
138
|
+
export declare function machineClassId(m: MachineDescriptor): string;
|
|
139
|
+
/**
|
|
140
|
+
* Analyses per hour one serve sustains at a given per-frame cost.
|
|
141
|
+
*
|
|
142
|
+
* `litert-lm serve` admits ONE request at a time, so this is the machine's
|
|
143
|
+
* whole sensing capacity — not a per-camera figure. `null` (never 0, never
|
|
144
|
+
* Infinity) for a non-positive input, because a fabricated capacity is how a
|
|
145
|
+
* machine that measured nothing ends up in a spec sheet.
|
|
146
|
+
*/
|
|
147
|
+
export declare function analysesPerHour(secondsPerFrame: number): number | null;
|
|
148
|
+
/**
|
|
149
|
+
* How many cameras this per-frame cost serves, if every camera must be looked
|
|
150
|
+
* at once per `cadenceSeconds`. FLOOR, not round: 3.8 cameras is 3 cameras and
|
|
151
|
+
* one that misses its cadence.
|
|
152
|
+
*/
|
|
153
|
+
export declare function camerasAtCadence(secondsPerFrame: number, cadenceSeconds: number): number | null;
|
|
154
|
+
/**
|
|
155
|
+
* The throughput floor a box must clear to serve `cameras` at `cadenceSeconds`.
|
|
156
|
+
*
|
|
157
|
+
* This is NOT a new capacity model — it is `connectorCadence`'s, solved for the
|
|
158
|
+
* machine instead of for the interval. That file derives
|
|
159
|
+
*
|
|
160
|
+
* H >= N x ANALYZE / SHARE
|
|
161
|
+
*
|
|
162
|
+
* (N feeds, one admission slot, SHARE of it reserved for the still-scene
|
|
163
|
+
* heartbeat so the rest stays free for motion-triggered alerts). Fix H at the
|
|
164
|
+
* interval the product must resolve and it becomes a statement about hardware:
|
|
165
|
+
*
|
|
166
|
+
* ANALYZE <= H x SHARE / N
|
|
167
|
+
*/
|
|
168
|
+
export interface HardwareFloor {
|
|
169
|
+
cameras: number;
|
|
170
|
+
cadenceSeconds: number;
|
|
171
|
+
/** Fraction of the single admission slot the still-scene floor may consume. */
|
|
172
|
+
slotShare: number;
|
|
173
|
+
/** The per-frame budget. A machine slower than this cannot make the cadence. */
|
|
174
|
+
maxSecondsPerFrame: number;
|
|
175
|
+
/** The same statement in the unit the capacity plan quotes. */
|
|
176
|
+
minAnalysesPerHour: number;
|
|
177
|
+
}
|
|
178
|
+
export declare function floorFor(cameras: number, cadenceSeconds: number, slotShare?: number): HardwareFloor | null;
|
|
179
|
+
export interface FloorVerdict {
|
|
180
|
+
clears: boolean;
|
|
181
|
+
secondsPerFrame: number;
|
|
182
|
+
camerasSupported: number;
|
|
183
|
+
analysesPerHour: number;
|
|
184
|
+
/** >1 = headroom, <1 = short. Reported so "barely" and "10x" are distinguishable. */
|
|
185
|
+
headroom: number;
|
|
186
|
+
reason: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Does this measured per-frame cost clear the floor? A machine with NO measured
|
|
190
|
+
* number does not "fail" — it returns null, because unmeasured and too-slow are
|
|
191
|
+
* different facts and collapsing them is exactly how windows-latest spent two
|
|
192
|
+
* months looking like a slow box instead of an unmeasured one.
|
|
193
|
+
*/
|
|
194
|
+
export declare function gradeAgainstFloor(secondsPerFrame: number | null, floor: HardwareFloor): FloorVerdict | null;
|
|
195
|
+
/**
|
|
196
|
+
* A time budget for a whole bench run, so a run that cannot finish still
|
|
197
|
+
* REPORTS what it measured. The Windows lane's entire history is runs that
|
|
198
|
+
* measured frames and then died at the job cap having written nothing: a
|
|
199
|
+
* partial matrix is a datapoint, a killed process is not.
|
|
200
|
+
*/
|
|
201
|
+
export declare function budgetRemaining(startedAtMs: number, budgetMs: number, nowMs: number): number;
|
|
202
|
+
/**
|
|
203
|
+
* Should the runner attempt one more frame? Refuses when the time left is less
|
|
204
|
+
* than what the last frames actually cost — starting a frame we cannot finish
|
|
205
|
+
* both wastes the remaining budget and records a DEADLINE as if it were a
|
|
206
|
+
* machine's speed.
|
|
207
|
+
*/
|
|
208
|
+
export declare function shouldAttemptAnother(remainingMs: number, observedFrameMs: number[], fallbackFrameMs: number): boolean;
|
|
107
209
|
/**
|
|
108
210
|
* Nearest-rank percentile of a sample. `null` on empty, for the same reason
|
|
109
211
|
* `median` returns null.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localVlmBench.d.ts","sourceRoot":"","sources":["../src/localVlmBench.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAEhC,uFAAuF;AACvF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,oBAAyB,GAAG,gBAAgB,CAQrF;AASD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,EAAE,CAwBV;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,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kB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,SAAI,GAAG,aAAa,GAAG,IAAI,CAYrG;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,qFAAqF;IACrF,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,aAAa,GAAG,YAAY,GAAG,IAAI,CAe3G;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG5F;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EAAE,EACzB,eAAe,EAAE,MAAM,GACtB,OAAO,CAMT;AACD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQrE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC"}
|
package/dist/localVlmBench.js
CHANGED
|
@@ -6,6 +6,14 @@ exports.validateAgainstContract = validateAgainstContract;
|
|
|
6
6
|
exports.scoreFields = scoreFields;
|
|
7
7
|
exports.interleaveArms = interleaveArms;
|
|
8
8
|
exports.median = median;
|
|
9
|
+
exports.describeMachine = describeMachine;
|
|
10
|
+
exports.machineClassId = machineClassId;
|
|
11
|
+
exports.analysesPerHour = analysesPerHour;
|
|
12
|
+
exports.camerasAtCadence = camerasAtCadence;
|
|
13
|
+
exports.floorFor = floorFor;
|
|
14
|
+
exports.gradeAgainstFloor = gradeAgainstFloor;
|
|
15
|
+
exports.budgetRemaining = budgetRemaining;
|
|
16
|
+
exports.shouldAttemptAnother = shouldAttemptAnother;
|
|
9
17
|
exports.percentile = percentile;
|
|
10
18
|
/**
|
|
11
19
|
* localVlmBench — the reusable, unit-tested pieces of the LIVE on-device VLM
|
|
@@ -170,6 +178,127 @@ function median(values) {
|
|
|
170
178
|
const mid = Math.floor(sorted.length / 2);
|
|
171
179
|
return sorted.length % 2 === 1 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
|
|
172
180
|
}
|
|
181
|
+
/** Trim the vendor noise x86 CPU strings carry ('(R)', '(TM)', 'CPU @ 2.60GHz'). */
|
|
182
|
+
function normaliseCpuModel(raw) {
|
|
183
|
+
return String(raw || 'unknown')
|
|
184
|
+
.replace(/\((R|TM|r|tm)\)/g, '')
|
|
185
|
+
.replace(/\bCPU\b/g, '')
|
|
186
|
+
.replace(/@\s*[\d.]+\s*GHz/i, '')
|
|
187
|
+
.replace(/\s+/g, ' ')
|
|
188
|
+
.trim() || 'unknown';
|
|
189
|
+
}
|
|
190
|
+
function describeMachine(osLike) {
|
|
191
|
+
const cpus = osLike.cpus() || [];
|
|
192
|
+
return {
|
|
193
|
+
platform: osLike.platform(),
|
|
194
|
+
arch: osLike.arch(),
|
|
195
|
+
release: osLike.release(),
|
|
196
|
+
cpuModel: normaliseCpuModel(cpus[0] && cpus[0].model ? cpus[0].model : 'unknown'),
|
|
197
|
+
cores: cpus.length,
|
|
198
|
+
memGb: Math.round((osLike.totalmem() / 1024 ** 3) * 10) / 10,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A STABLE slug for "machines of this kind" — the join key between a measured
|
|
203
|
+
* row and a box we might sell. Deliberately excludes OS version and hostname:
|
|
204
|
+
* two runs of the same silicon a point release apart are the same machine
|
|
205
|
+
* class, and a hostname would make every CI runner its own class (a matrix with
|
|
206
|
+
* 200 one-row classes measures nothing).
|
|
207
|
+
*/
|
|
208
|
+
function machineClassId(m) {
|
|
209
|
+
const cpu = String(m.cpuModel || 'unknown').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
210
|
+
return `${m.platform}-${m.arch}-${cpu}-${m.cores}c-${Math.round(m.memGb)}g`;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Analyses per hour one serve sustains at a given per-frame cost.
|
|
214
|
+
*
|
|
215
|
+
* `litert-lm serve` admits ONE request at a time, so this is the machine's
|
|
216
|
+
* whole sensing capacity — not a per-camera figure. `null` (never 0, never
|
|
217
|
+
* Infinity) for a non-positive input, because a fabricated capacity is how a
|
|
218
|
+
* machine that measured nothing ends up in a spec sheet.
|
|
219
|
+
*/
|
|
220
|
+
function analysesPerHour(secondsPerFrame) {
|
|
221
|
+
if (!Number.isFinite(secondsPerFrame) || secondsPerFrame <= 0)
|
|
222
|
+
return null;
|
|
223
|
+
return Number((3600 / secondsPerFrame).toFixed(1));
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* How many cameras this per-frame cost serves, if every camera must be looked
|
|
227
|
+
* at once per `cadenceSeconds`. FLOOR, not round: 3.8 cameras is 3 cameras and
|
|
228
|
+
* one that misses its cadence.
|
|
229
|
+
*/
|
|
230
|
+
function camerasAtCadence(secondsPerFrame, cadenceSeconds) {
|
|
231
|
+
if (!Number.isFinite(secondsPerFrame) || secondsPerFrame <= 0)
|
|
232
|
+
return null;
|
|
233
|
+
if (!Number.isFinite(cadenceSeconds) || cadenceSeconds <= 0)
|
|
234
|
+
return null;
|
|
235
|
+
return Math.floor(cadenceSeconds / secondsPerFrame);
|
|
236
|
+
}
|
|
237
|
+
function floorFor(cameras, cadenceSeconds, slotShare = 1) {
|
|
238
|
+
if (!Number.isFinite(cameras) || cameras <= 0)
|
|
239
|
+
return null;
|
|
240
|
+
if (!Number.isFinite(cadenceSeconds) || cadenceSeconds <= 0)
|
|
241
|
+
return null;
|
|
242
|
+
if (!Number.isFinite(slotShare) || slotShare <= 0 || slotShare > 1)
|
|
243
|
+
return null;
|
|
244
|
+
const budget = cadenceSeconds * slotShare;
|
|
245
|
+
return {
|
|
246
|
+
cameras,
|
|
247
|
+
cadenceSeconds,
|
|
248
|
+
slotShare,
|
|
249
|
+
maxSecondsPerFrame: Number((budget / cameras).toFixed(2)),
|
|
250
|
+
minAnalysesPerHour: Number(((cameras * 3600) / budget).toFixed(1)),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Does this measured per-frame cost clear the floor? A machine with NO measured
|
|
255
|
+
* number does not "fail" — it returns null, because unmeasured and too-slow are
|
|
256
|
+
* different facts and collapsing them is exactly how windows-latest spent two
|
|
257
|
+
* months looking like a slow box instead of an unmeasured one.
|
|
258
|
+
*/
|
|
259
|
+
function gradeAgainstFloor(secondsPerFrame, floor) {
|
|
260
|
+
if (secondsPerFrame === null || !Number.isFinite(secondsPerFrame) || secondsPerFrame <= 0)
|
|
261
|
+
return null;
|
|
262
|
+
const cameras = camerasAtCadence(secondsPerFrame, floor.cadenceSeconds * floor.slotShare);
|
|
263
|
+
const perHour = analysesPerHour(secondsPerFrame);
|
|
264
|
+
const clears = secondsPerFrame <= floor.maxSecondsPerFrame;
|
|
265
|
+
return {
|
|
266
|
+
clears,
|
|
267
|
+
secondsPerFrame,
|
|
268
|
+
camerasSupported: cameras,
|
|
269
|
+
analysesPerHour: perHour,
|
|
270
|
+
headroom: Number((floor.maxSecondsPerFrame / secondsPerFrame).toFixed(2)),
|
|
271
|
+
reason: clears
|
|
272
|
+
? `${secondsPerFrame}s/frame <= ${floor.maxSecondsPerFrame}s budget: serves ${cameras} cameras at a ${floor.cadenceSeconds}s cadence (target ${floor.cameras})`
|
|
273
|
+
: `${secondsPerFrame}s/frame EXCEEDS the ${floor.maxSecondsPerFrame}s budget: serves ${cameras} camera(s) at a ${floor.cadenceSeconds}s cadence, not ${floor.cameras}`,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* A time budget for a whole bench run, so a run that cannot finish still
|
|
278
|
+
* REPORTS what it measured. The Windows lane's entire history is runs that
|
|
279
|
+
* measured frames and then died at the job cap having written nothing: a
|
|
280
|
+
* partial matrix is a datapoint, a killed process is not.
|
|
281
|
+
*/
|
|
282
|
+
function budgetRemaining(startedAtMs, budgetMs, nowMs) {
|
|
283
|
+
if (!Number.isFinite(budgetMs) || budgetMs <= 0)
|
|
284
|
+
return Number.POSITIVE_INFINITY;
|
|
285
|
+
return budgetMs - (nowMs - startedAtMs);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Should the runner attempt one more frame? Refuses when the time left is less
|
|
289
|
+
* than what the last frames actually cost — starting a frame we cannot finish
|
|
290
|
+
* both wastes the remaining budget and records a DEADLINE as if it were a
|
|
291
|
+
* machine's speed.
|
|
292
|
+
*/
|
|
293
|
+
function shouldAttemptAnother(remainingMs, observedFrameMs, fallbackFrameMs) {
|
|
294
|
+
if (remainingMs === Number.POSITIVE_INFINITY)
|
|
295
|
+
return true;
|
|
296
|
+
if (remainingMs <= 0)
|
|
297
|
+
return false;
|
|
298
|
+
const worst = (observedFrameMs || []).filter((n) => Number.isFinite(n) && n > 0);
|
|
299
|
+
const need = worst.length ? Math.max(...worst) : fallbackFrameMs;
|
|
300
|
+
return remainingMs >= need;
|
|
301
|
+
}
|
|
173
302
|
/**
|
|
174
303
|
* Nearest-rank percentile of a sample. `null` on empty, for the same reason
|
|
175
304
|
* `median` returns null.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localVlmBench.js","sourceRoot":"","sources":["../src/localVlmBench.ts"],"names":[],"mappings":";;;AAkEA,4CAQC;AAeD,0DA2BC;AA0BD,kCAaC;AAqBD,wCAUC;AAMD,wBAMC;
|
|
1
|
+
{"version":3,"file":"local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