@trillboards/edge-sdk 0.2.39 → 0.2.41
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/README.md +1 -1
- package/deploy/docker/{Dockerfile.cloud-sense → Dockerfile.connector} +52 -39
- package/deploy/docker/README.md +73 -1
- package/deploy/docker/connector-entrypoint.sh +46 -80
- package/deploy/macos/README.md +1 -1
- package/deploy/macos/test-install-pair.sh +9 -9
- package/deploy/systemd/install.sh +16 -1
- package/deploy/systemd/setup-litertlm.sh +201 -0
- package/deploy/systemd/trillboards-edge.service +8 -4
- package/deploy/systemd/trillboards-litertlm.service +46 -0
- package/deploy/windows/register-task.ps1 +6 -3
- package/deploy/windows/run-connector.ps1 +1 -1
- package/deploy/windows/trillboards-edge-task.vbs +5 -1
- package/dist/CloudSensingManager.d.ts +45 -19
- package/dist/CloudSensingManager.d.ts.map +1 -1
- package/dist/CloudSensingManager.js +89 -46
- package/dist/CloudSensingManager.js.map +1 -1
- package/dist/EdgeAgent.js +1 -1
- package/dist/SensingProfileClient.d.ts +9 -0
- package/dist/SensingProfileClient.d.ts.map +1 -1
- package/dist/SensingProfileClient.js +4 -0
- package/dist/SensingProfileClient.js.map +1 -1
- package/dist/SetupSessionClient.d.ts +0 -1
- package/dist/SetupSessionClient.d.ts.map +1 -1
- package/dist/autoSense.d.ts +42 -31
- package/dist/autoSense.d.ts.map +1 -1
- package/dist/autoSense.js +127 -99
- package/dist/autoSense.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +25 -84
- package/dist/cli.js.map +1 -1
- package/dist/combinedSense.d.ts +1 -3
- package/dist/combinedSense.d.ts.map +1 -1
- package/dist/combinedSense.js +0 -1
- package/dist/combinedSense.js.map +1 -1
- package/dist/config.d.ts +17 -64
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -10
- package/dist/config.js.map +1 -1
- package/dist/deployedCadence.d.ts +37 -75
- package/dist/deployedCadence.d.ts.map +1 -1
- package/dist/deployedCadence.js +45 -105
- package/dist/deployedCadence.js.map +1 -1
- package/dist/deployedCadenceSource.d.ts +0 -2
- package/dist/deployedCadenceSource.d.ts.map +1 -1
- package/dist/deployedCadenceSource.js +0 -1
- package/dist/deployedCadenceSource.js.map +1 -1
- package/dist/diagnose.d.ts +1 -1
- package/dist/diagnose.js +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -8
- package/dist/index.js.map +1 -1
- package/dist/localInferenceSchema.d.ts +19 -0
- package/dist/localInferenceSchema.d.ts.map +1 -1
- package/dist/localInferenceSchema.js +23 -0
- package/dist/localInferenceSchema.js.map +1 -1
- package/dist/localSensing.d.ts +48 -107
- package/dist/localSensing.d.ts.map +1 -1
- package/dist/localSensing.js +80 -171
- package/dist/localSensing.js.map +1 -1
- package/dist/sensingCatchRate.d.ts +246 -0
- package/dist/sensingCatchRate.d.ts.map +1 -0
- package/dist/sensingCatchRate.js +514 -0
- package/dist/sensingCatchRate.js.map +1 -0
- package/dist/sensingRunMode.d.ts +14 -11
- package/dist/sensingRunMode.d.ts.map +1 -1
- package/dist/sensingRunMode.js +9 -92
- package/dist/sensingRunMode.js.map +1 -1
- package/dist/setupMode.d.ts +0 -1
- package/dist/setupMode.d.ts.map +1 -1
- package/dist/setupMode.js +5 -3
- package/dist/setupMode.js.map +1 -1
- package/dist/startupDiscovery.d.ts +43 -0
- package/dist/startupDiscovery.d.ts.map +1 -0
- package/dist/startupDiscovery.js +72 -0
- package/dist/startupDiscovery.js.map +1 -0
- package/package.json +1 -1
- package/dist/CloudEscalationPolicy.d.ts +0 -143
- package/dist/CloudEscalationPolicy.d.ts.map +0 -1
- package/dist/CloudEscalationPolicy.js +0 -137
- package/dist/CloudEscalationPolicy.js.map +0 -1
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
* on the preAnalyzed ingest path (gated OUT of the sold bidstream).
|
|
66
66
|
*/
|
|
67
67
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
|
+
exports.DEFAULT_SCENE_FIELD_KEYS = void 0;
|
|
68
69
|
exports.buildLocalSensingSchema = buildLocalSensingSchema;
|
|
69
70
|
exports.buildLocalSensingPrompt = buildLocalSensingPrompt;
|
|
70
71
|
/**
|
|
@@ -99,6 +100,28 @@ const AUDIENCE_FIELD_ORDER = [
|
|
|
99
100
|
'people_present',
|
|
100
101
|
'confidence',
|
|
101
102
|
];
|
|
103
|
+
/**
|
|
104
|
+
* Every field key the SDK itself puts in the schema — the union of the presence
|
|
105
|
+
* primitives and the DOOH audience block, whichever field set a profile resolves to.
|
|
106
|
+
*
|
|
107
|
+
* These are the SCENE-OCCUPANCY vocabulary: each one describes the people in front of
|
|
108
|
+
* the camera (or the frame as a whole), and each reads its own "nobody here" value on an
|
|
109
|
+
* empty scene — `person_count: 0`, `people_present: false`, `crowd_density: 'empty'`,
|
|
110
|
+
* `audience_intent_stage: 'none'`. The 'none'/'empty'/'unknown' members are the SDK's own
|
|
111
|
+
* invention (see DEFAULT_FIELD_PROPS: enums that had no "no people" member in the cloud
|
|
112
|
+
* contract were GIVEN one so the model never has to emit null), which is exactly why an
|
|
113
|
+
* empty reading here means "the scene is empty" and nothing more.
|
|
114
|
+
*
|
|
115
|
+
* `localSensing.isAlertWorthy` uses this as the privacy FLOOR: an operator's route may
|
|
116
|
+
* make the absence of their own subject alert-worthy, but it can never do so for these —
|
|
117
|
+
* a blank-room frame is the harm the evidence gate exists to prevent, and no route
|
|
118
|
+
* condition may unlock it. Exported (rather than re-listed in localSensing) so the gate
|
|
119
|
+
* and the schema builder can never drift apart on what counts as a scene field.
|
|
120
|
+
*/
|
|
121
|
+
exports.DEFAULT_SCENE_FIELD_KEYS = new Set([
|
|
122
|
+
...PRESENCE_PRIMITIVE_ORDER,
|
|
123
|
+
...AUDIENCE_FIELD_ORDER,
|
|
124
|
+
]);
|
|
102
125
|
/**
|
|
103
126
|
* The property spec for every DEFAULT field, declared ONCE. `buildLocalSensingSchema`
|
|
104
127
|
* composes a field set out of this table rather than forking into two builders.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localInferenceSchema.js","sourceRoot":"","sources":["../src/localInferenceSchema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG
|
|
1
|
+
{"version":3,"file":"localInferenceSchema.js","sourceRoot":"","sources":["../src/localInferenceSchema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;;;AA2NH,0DAkCC;AAqCD,0DAiBC;AA3PD;;;;;;;;;;;GAWG;AACH,MAAM,wBAAwB,GAAG,CAAC,gBAAgB,EAAE,cAAc,EAAE,YAAY,CAAU,CAAC;AAE3F;;;;GAIG;AACH,MAAM,oBAAoB,GAAG;IAC3B,4BAA4B;IAC5B,uBAAuB;IACvB,yBAAyB;IACzB,oBAAoB;IACpB,+BAA+B;IAC/B,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,gBAAgB;IAChB,YAAY;CACJ,CAAC;AAEX;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,wBAAwB,GAAwB,IAAI,GAAG,CAAS;IAC3E,GAAG,wBAAwB;IAC3B,GAAG,oBAAoB;CACxB,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,mBAAmB,GAA4C;IACnE,4EAA4E;IAC5E,0EAA0E;IAC1E,+DAA+D;IAC/D,0BAA0B,EAAE;QAC1B,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC;KACjF;IACD,qBAAqB,EAAE;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,CAAC,UAAU,EA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MAAM,QAAQ,GAAwB,OAAO,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;IAChG,MAAM,IAAI,GAAG,QAAQ,KAAK,UAAU;QAClC,CAAC,CAAC,wEAAwE;YACxE,kFAAkF;YAClF,gFAAgF;YAChF,oDAAoD;QACtD,CAAC,CAAC,0FAA0F;YAC1F,4FAA4F;YAC5F,+EAA+E;YAC/E,6FAA6F;YAC7F,wCAAwC,CAAC;IAC7C,MAAM,KAAK,GAAG,6BAA6B,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC3E,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,OAAO,GAAG,IAAI,gEAAgE,KAAK,EAAE,CAAC;AACxF,CAAC"}
|
package/dist/localSensing.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { SensingProfileClient } from './SensingProfileClient';
|
|
|
5
5
|
import { type ResolvedFeed, type SensingClient, type SensingLoopDeps } from './CloudSensingManager';
|
|
6
6
|
import type { SharedFrameSource } from './MosaicSource';
|
|
7
7
|
import { type LocalSchemaFieldSet } from './localInferenceSchema';
|
|
8
|
-
import { type CloudEscalationPolicyOptions, type CloudEscalationStats } from './CloudEscalationPolicy';
|
|
9
8
|
import type { EdgeAgentConfig } from './config';
|
|
10
9
|
/**
|
|
11
10
|
* Map a deployed profile's SELF-DESCRIBING type to the on-device field set.
|
|
@@ -43,30 +42,6 @@ export interface LocalSensingClientOptions {
|
|
|
43
42
|
* isAlertWorthy(). Default: true.
|
|
44
43
|
*/
|
|
45
44
|
attachEvidenceFrame?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Per-frame resilience: when ON-DEVICE inference THROWS for a single frame,
|
|
48
|
-
* POST that frame to the CLOUD VLM (uploadClient.analyze) instead of losing it.
|
|
49
|
-
* Reuses the SAME upload client (no new provider). Opt-in (default false) so
|
|
50
|
-
* the plain local-sense path is unchanged; auto-sense's local branch enables it.
|
|
51
|
-
*/
|
|
52
|
-
cloudFallbackOnError?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Confidence-based CLOUD ESCALATION (Phase 6d). When the on-device model
|
|
55
|
-
* flags a CANDIDATE — a frame carrying real signal, judged by the SAME
|
|
56
|
-
* `isAlertWorthy` gate that governs the evidence frame — send THAT ONE frame
|
|
57
|
-
* to the cloud VLM for adjudication instead of shipping the local verdict.
|
|
58
|
-
*
|
|
59
|
-
* Distinct from `cloudFallbackOnError` (a per-frame degrade when local
|
|
60
|
-
* inference THROWS) and from `EdgeAgentConfig.localSensing.allowCloudFallback`
|
|
61
|
-
* (a whole-mode switch when the local runtime is unavailable). Those two reach
|
|
62
|
-
* for the cloud because the local path is BROKEN; this one because the local
|
|
63
|
-
* path WORKED and its judgement is worth confirming.
|
|
64
|
-
*
|
|
65
|
-
* Off unless `enabled: true` — see CloudEscalationPolicy.
|
|
66
|
-
*/
|
|
67
|
-
cloudEscalation?: CloudEscalationPolicyOptions;
|
|
68
|
-
/** Feed label used only in the escalation log line. */
|
|
69
|
-
feedName?: string;
|
|
70
45
|
}
|
|
71
46
|
/**
|
|
72
47
|
* Decide whether an on-device result is potentially ALERT-WORTHY — the gate that
|
|
@@ -90,46 +65,30 @@ export interface LocalSensingClientOptions {
|
|
|
90
65
|
* Non-discriminative keys (source, captured_at, confidence, scene_description)
|
|
91
66
|
* are ignored — see NON_DISCRIMINATIVE_KEYS for why.
|
|
92
67
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
export declare function isAlertWorthy(result: Record<string, unknown>): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* A stable fingerprint of the ALERT-BEARING state of one result — "has the
|
|
103
|
-
* operator-visible situation changed?" in one comparable string.
|
|
68
|
+
* ABSENCE (`absenceWatchedFields`) — the empty-shelf half. The rule above answers
|
|
69
|
+
* "is anything HERE?", which is the right question for people and the WRONG one for
|
|
70
|
+
* stock: "the shelf is empty" is a positive finding about a subject that IS in frame,
|
|
71
|
+
* and the operator asked to be told about it. So a field named in `absenceWatchedFields`
|
|
72
|
+
* flips: its EMPTY reading (`shelf_state: 'empty'`, `stock_level: 0`,
|
|
73
|
+
* `product_available: false`, `[]`, `{}`) counts as signal.
|
|
104
74
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* deliberately does NOT bucket numbers into invented bands.
|
|
75
|
+
* That set is not guessed from the field's spelling and is not an allowlist of stock
|
|
76
|
+
* words. The server derives it per screen from the operator's OWN saved route
|
|
77
|
+
* conditions — a field is in it only when an enabled route would actually FIRE on that
|
|
78
|
+
* field's empty reading (`shelf_state eq 'empty'`). So `smoking_activity_detected: false`
|
|
79
|
+
* on an empty scene stays suppressed, because no route targets its absence, and a
|
|
80
|
+
* profile with no absence-targeting route behaves byte-for-byte as before.
|
|
112
81
|
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
82
|
+
* The privacy FLOOR is unconditional: `DEFAULT_SCENE_FIELD_KEYS` — the presence
|
|
83
|
+
* primitives and the DOOH audience block, i.e. every field whose subject IS the people
|
|
84
|
+
* in front of the camera — can NEVER be unlocked this way, even by a route that
|
|
85
|
+
* explicitly targets them (`person_count lte 0`). Absence of PEOPLE is the blank-room
|
|
86
|
+
* frame the gate exists to prevent; absence of STOCK is the operator's finding. That is
|
|
87
|
+
* the whole distinction, and it is enforced structurally rather than by tuning.
|
|
88
|
+
* Operators who want every frame regardless can still disable the gate
|
|
89
|
+
* (attachEvidenceFrame).
|
|
115
90
|
*/
|
|
116
|
-
export declare function
|
|
117
|
-
/**
|
|
118
|
-
* Is cloud escalation actually ON for this local-sensing configuration?
|
|
119
|
-
*
|
|
120
|
-
* TWO settings decide it, and this is the ONLY place that combines them:
|
|
121
|
-
* `cloudEscalation.enabled` opts in, and `attachEvidenceFrame: false` — the
|
|
122
|
-
* operator's "no frame ever leaves this machine" switch — outranks it, because
|
|
123
|
-
* escalation sends a frame. `LocalSensingClient` enforces the rule and the
|
|
124
|
-
* startup banner reports it; they must read the same expression or the banner
|
|
125
|
-
* will one day claim an egress posture the client is not running.
|
|
126
|
-
*/
|
|
127
|
-
export declare function isCloudEscalationEnabled(options: {
|
|
128
|
-
attachEvidenceFrame?: boolean;
|
|
129
|
-
cloudEscalation?: {
|
|
130
|
-
enabled?: boolean;
|
|
131
|
-
};
|
|
132
|
-
} | null | undefined): boolean;
|
|
91
|
+
export declare function isAlertWorthy(result: Record<string, unknown>, absenceWatchedFields?: ReadonlySet<string> | readonly string[]): boolean;
|
|
133
92
|
/**
|
|
134
93
|
* LocalSensingClient — the SensingClient the cadence loop uses in LOCAL mode.
|
|
135
94
|
* It runs the VLM ON-DEVICE (LiteRtVlmProvider — Gemma 4 on LiteRT-LM via
|
|
@@ -153,33 +112,26 @@ export declare function isCloudEscalationEnabled(options: {
|
|
|
153
112
|
* gating local-inferred data out of the sold bidstream while still firing the
|
|
154
113
|
* operator's Sense-Anything routes.
|
|
155
114
|
*
|
|
156
|
-
* ──
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
115
|
+
* ── THERE IS NO CLOUD PATH ─────────────────────────────────────────────────
|
|
116
|
+
* This client once had three doors to the cloud VLM: `cloudFallbackOnError` (a
|
|
117
|
+
* per-frame degrade when local inference threw), `cloudEscalation` (Phase 6d —
|
|
118
|
+
* local Gemma gates, the cloud adjudicates the candidates it flags), and the
|
|
119
|
+
* whole-mode `allowCloudFallback` in auto-sense. All three are gone, and this
|
|
120
|
+
* supersedes the escalation architecture from #11971 ("local Gemma decides
|
|
121
|
+
* *when* to look, the cloud decides *what* it saw").
|
|
162
122
|
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* stamp — identical to `cloud-sense` and to the existing
|
|
171
|
-
* `cloudFallbackOnError` frame. Nothing the local model produced enters
|
|
172
|
-
* that record, so `ingest_source='local_connector'` (which exists to keep
|
|
173
|
-
* operator-forgeable structured input out of the sold bidstream) does not
|
|
174
|
-
* apply and is not evaded: there IS no local structured input on this path.
|
|
175
|
-
* 3. THE PRIVACY GATE IS UNCHANGED. Escalation reuses `isAlertWorthy`, so the
|
|
176
|
-
* set of frames that can leave the premises is exactly the set that
|
|
177
|
-
* already leaves as evidence photos — and `attachEvidenceFrame: false`
|
|
178
|
-
* (the operator's "no frame ever leaves" switch) disables escalation
|
|
179
|
-
* outright. An empty scene never escalates.
|
|
123
|
+
* The reason is arithmetic, not architecture. Measured 2026-08-12 over 255,812
|
|
124
|
+
* image-bearing cloud VLM calls: $0.007008 per analyzed frame. At a 30s cadence
|
|
125
|
+
* that is ~$605/camera/month, so a 16-camera store cost ~$9,688/month against a
|
|
126
|
+
* $99-500 subscription — about 10x underwater. Escalation narrowed WHICH frames
|
|
127
|
+
* went, and the earlier plan (plans/cctv-byo-sensing-plan.md:26) narrowed HOW
|
|
128
|
+
* OFTEN; neither changes the sign. A path that meters per frame does not belong
|
|
129
|
+
* in a flat-rate product, so the path is removed rather than rate-limited.
|
|
180
130
|
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
131
|
+
* What replaces it: nothing on the frame path. A frame the on-device runtime
|
|
132
|
+
* cannot analyze is dropped and the fault is surfaced (see the catch in
|
|
133
|
+
* `analyze`), and a connector with no usable runtime WAITS and beacons its
|
|
134
|
+
* `waiting` state rather than silently spending.
|
|
183
135
|
*/
|
|
184
136
|
export declare class LocalSensingClient implements SensingClient {
|
|
185
137
|
private readonly localProvider;
|
|
@@ -190,25 +142,22 @@ export declare class LocalSensingClient implements SensingClient {
|
|
|
190
142
|
private readonly basePrompt;
|
|
191
143
|
private cachedSchema;
|
|
192
144
|
private cachedPrompt;
|
|
145
|
+
/**
|
|
146
|
+
* Fields whose ABSENT reading an operator route on this screen fires on, from the
|
|
147
|
+
* deployed profile (see SensingProfileClient.absenceWatchedFields). Refreshed on the
|
|
148
|
+
* SAME cadence as the schema, because a route saved after the last poll must not be
|
|
149
|
+
* able to change the gate before the model is even emitting its field. Empty until a
|
|
150
|
+
* profile fetch succeeds, so the gate's default is the strict pre-existing behavior.
|
|
151
|
+
*/
|
|
152
|
+
private cachedAbsenceWatchedFields;
|
|
193
153
|
private lastProfileFetchMs;
|
|
194
154
|
/** Send the analyzed JPEG (gated to alert-worthy frames) as evidence. Default true. */
|
|
195
155
|
private readonly attachEvidenceFrame;
|
|
196
|
-
/** On a local-inference throw, POST that one frame to the cloud VLM. Default false. */
|
|
197
|
-
private readonly cloudFallbackOnError;
|
|
198
|
-
/**
|
|
199
|
-
* Rate/novelty bound on cloud escalation for THIS feed. Per-client (not
|
|
200
|
-
* global) on purpose: the budget an operator reasons about is "per camera",
|
|
201
|
-
* and one busy camera must not spend a quiet one's confirmations.
|
|
202
|
-
*/
|
|
203
|
-
private readonly escalationPolicy;
|
|
204
|
-
/** Feed label for the escalation log line. */
|
|
205
|
-
private readonly feedName;
|
|
206
156
|
/**
|
|
207
157
|
* Frames the ON-DEVICE runtime actually produced a result for.
|
|
208
158
|
*
|
|
209
159
|
* Counted at the one place that knows — immediately after `localProvider
|
|
210
|
-
* .analyze()` RETURNS
|
|
211
|
-
* cloud answered) and an escalated frame are both excluded. `auto-sense`
|
|
160
|
+
* .analyze()` RETURNS. `auto-sense`
|
|
212
161
|
* reads this through `getSensingHealth().localInferences` as the only
|
|
213
162
|
* positive proof that a `litert-lm serve` too busy to answer `/v1/models` is
|
|
214
163
|
* busy rather than dead; a counter that a cloud call could advance would make
|
|
@@ -244,14 +193,6 @@ export declare class LocalSensingClient implements SensingClient {
|
|
|
244
193
|
* log-diving. See LiteRtVlmProvider.getAcceleratorHealth.
|
|
245
194
|
*/
|
|
246
195
|
getAcceleratorHealth(): LiteRtAcceleratorHealth;
|
|
247
|
-
/**
|
|
248
|
-
* Cloud-escalation counters for this feed — how many candidate frames were
|
|
249
|
-
* adjudicated by the cloud VLM, and why the rest were not. Read by
|
|
250
|
-
* `CloudSensingManager.getSensingHealth()` so escalation shows up on the
|
|
251
|
-
* operator's periodic capacity line: sending frames off-premises must be
|
|
252
|
-
* VISIBLE, not merely documented.
|
|
253
|
-
*/
|
|
254
|
-
getEscalationStats(): CloudEscalationStats;
|
|
255
196
|
/** Frames the on-device runtime produced a result for. See the field docs. */
|
|
256
197
|
getLocalInferenceStats(): {
|
|
257
198
|
completed: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localSensing.d.ts","sourceRoot":"","sources":["../src/localSensing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,qBAAqB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"localSensing.d.ts","sourceRoot":"","sources":["../src/localSensing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,qBAAqB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAA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