@trillboards/edge-sdk 0.2.264 → 0.2.267

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 (37) hide show
  1. package/dist/ConnectorStatusClient.d.ts +10 -0
  2. package/dist/ConnectorStatusClient.d.ts.map +1 -1
  3. package/dist/ConnectorStatusClient.js +9 -1
  4. package/dist/ConnectorStatusClient.js.map +1 -1
  5. package/dist/DurableVlmCandidateSpool.d.ts +39 -1
  6. package/dist/DurableVlmCandidateSpool.d.ts.map +1 -1
  7. package/dist/DurableVlmCandidateSpool.js +116 -23
  8. package/dist/DurableVlmCandidateSpool.js.map +1 -1
  9. package/dist/EdgeAgent.js +1 -1
  10. package/dist/connectorUpdate.d.ts +11 -0
  11. package/dist/connectorUpdate.d.ts.map +1 -1
  12. package/dist/connectorUpdate.js +42 -5
  13. package/dist/connectorUpdate.js.map +1 -1
  14. package/dist/diagnose.d.ts +1 -1
  15. package/dist/diagnose.js +1 -1
  16. package/dist/localSensing.d.ts +16 -0
  17. package/dist/localSensing.d.ts.map +1 -1
  18. package/dist/localSensing.js +19 -2
  19. package/dist/localSensing.js.map +1 -1
  20. package/dist/mainThreadStall.d.ts +91 -0
  21. package/dist/mainThreadStall.d.ts.map +1 -0
  22. package/dist/mainThreadStall.js +496 -0
  23. package/dist/mainThreadStall.js.map +1 -0
  24. package/dist/pipelineSwitches.d.ts +52 -1
  25. package/dist/pipelineSwitches.d.ts.map +1 -1
  26. package/dist/pipelineSwitches.js +51 -11
  27. package/dist/pipelineSwitches.js.map +1 -1
  28. package/dist/sensingRunMode.d.ts.map +1 -1
  29. package/dist/sensingRunMode.js +5 -0
  30. package/dist/sensingRunMode.js.map +1 -1
  31. package/package.json +1 -1
  32. package/retained/RetainedCaptureClient.cjs +19 -3
  33. package/retained/__tests__/archive-lifecycle.test.cjs +72 -0
  34. package/retained/__tests__/realtime-schedule.test.cjs +64 -2
  35. package/retained/__tests__/runtime.test.cjs +3 -0
  36. package/retained/__tests__/support/theft-builder.cjs +3 -2
  37. package/retained/manager.cjs +16 -2
@@ -10,7 +10,7 @@ const output=ts.transpileModule(fs.readFileSync(sourceFile,'utf8'),{fileName:sou
10
10
  compilerOptions:{target:ts.ScriptTarget.ES2022,module:ts.ModuleKind.CommonJS},reportDiagnostics:true});
11
11
  assert.equal((output.diagnostics??[]).filter(d=>d.category===ts.DiagnosticCategory.Error).length,0);
12
12
  function fixture(options={}) {
13
- const factoryCalls=[],imports=[],events=[],owners=[],diagnostics=[];
13
+ const factoryCalls=[],imports=[],events=[],owners=[],diagnostics=[],stallClocks=[];
14
14
  const manager=new EventEmitter();
15
15
  manager.start=async function(options){assert.equal(this,manager);events.push(['start',options]);};
16
16
  manager.stop=async function(){assert.equal(this,manager);events.push(['stop']);};
@@ -31,6 +31,7 @@ function fixture(options={}) {
31
31
  if(request==='./CloudSensingManager')return {resolveFeeds:config=>config.cameras??[]};
32
32
  if(request==='./continuousReview')return {retainedReviewApiBase:(_review,base)=>base};
33
33
  if(request==='./dataDir')return {resolveDataDir:value=>value};
34
+ if(request==='./mainThreadStall')return {startMainThreadStallClock:settings=>{stallClocks.push(settings);return ()=>undefined;}};
34
35
  if(request==='./RecorderAddressRecovery')return {RecorderAddressRecovery:class {async recover(){return null;}}};
35
36
  if(request==='../retained/manager.cjs')return {createWebsiteManager:async(...args)=>{
36
37
  factoryCalls.push(args);if(options.factoryError)throw options.factoryError;return {manager};
@@ -56,6 +57,6 @@ function fixture(options={}) {
56
57
  const registration={version:1,profiles:[{feedName:'fixture-camera',profileId:'theft',selectionId:'fixture-selection',sceneId:0,
57
58
  reviewMode:'human_only',environment:{sourceVideoSha256:'a'.repeat(64),regionConfigurationSha256:'b'.repeat(64),frameSize:[640,480]}}]};
58
59
  return {api:module.exports,config,registration,io:{log(){},warn(){},error(){}},lifecycle,manager,originalStart,originalStop,
59
- factoryCalls,imports,events,owners,diagnostics,intervalHandles};
60
+ factoryCalls,imports,events,owners,diagnostics,intervalHandles,stallClocks};
60
61
  }
61
62
  module.exports={fixture};
@@ -128,10 +128,14 @@ async function createWebsiteManager(input, stateDirectory, deps = {}) {
128
128
  // were sized for a 63 ms GPU detector. Every other detector call of the same look already
129
129
  // waits LocalDetectorClient's 5 s; the producer gets that bound too, or a paired look of a
130
130
  // person camera would time out and be retained instead of answered.
131
+ // A paired look's field call and its per-review producers then follow the served
132
+ // CCTV_LOOK_DETECTOR_DEADLINE_MS (pipeline.lookDetectorDeadline, 5000 unless set; read per look),
133
+ // so the bound can be raised to 8 s, and back, with no release.
131
134
  const producerBound = options.parallelDetectorReview === true ? { detectorFieldProducerOptions: {
132
135
  ...(deps.detectorFieldProducerOptions ?? {}),
133
136
  timeoutMs: Math.max(PAIRED_DETECTOR_CALL_MS, deps.detectorFieldProducerOptions?.timeoutMs ?? 0),
134
- deadlineMs: Math.max(PAIRED_DETECTOR_CALL_MS, deps.detectorFieldProducerOptions?.deadlineMs ?? 0) } } : {};
137
+ deadlineMs: Math.max(PAIRED_DETECTOR_CALL_MS, deps.detectorFieldProducerOptions?.deadlineMs ?? 0) },
138
+ servedLookDetectorDeadline: true } : {};
135
139
  const loops = buildLocalSensingLoops(config, { ...deps, ...producerBound, websiteManagedProfiles: websiteManaged,
136
140
  // The paired API takes a review without its photo (capabilities `evidenceImage.optional`),
137
141
  // and a look that only continues an open alert without it (`evidenceImage.episodeContinuation`).
@@ -249,11 +253,15 @@ async function createWebsiteManager(input, stateDirectory, deps = {}) {
249
253
  if (theftRoute && context) theftRoute.stamp(context);
250
254
  loop.client = client; clients.push(client);
251
255
  }
256
+ const { currentPipelineSwitches, bindArchiveStats } = take('pipelineSwitches');
252
257
  const manager = new CloudSensingManager({ loops, retainedApiBaseUrl: base, maxConcurrentAnalyses: pipeline ? 2 : 1, feedStaggerMs: 50,
253
258
  periodicIntervalMs: 3600000, skipPostWhenNoFaces: false, motionGate: { enabled: true, scanIntervalMs: 500 },
254
259
  candidateBuffer: { ...config.cloudSensing.candidateBuffer, diskSpool: {
255
260
  directory: path.join(stateDirectory, 'spool'), maxFrames: 512, maxPerFeed: 128,
256
- maxBytes: 512 * 1024 ** 2, preserveArchivedPending: true }, pumpIntervalMs: 50 } });
261
+ maxBytes: 512 * 1024 ** 2, preserveArchivedPending: true,
262
+ // Plan v7 W8, CCTV_CAPTURE_ARCHIVE=lean: a live look's queue copy waits in memory until a
263
+ // review takes it; the archive above already holds the original durably.
264
+ holdArchivedCopies: () => currentPipelineSwitches().archive === 'lean' }, pumpIntervalMs: 50 } });
257
265
  if (theftRoutes.size) {
258
266
  for (const [name, route] of theftRoutes) manager.registerOptionalReviewSource({name,
259
267
  hasPending: () => [...route.sessions.values()].some(session => session.consumer.pending.size > 0),
@@ -272,6 +280,12 @@ async function createWebsiteManager(input, stateDirectory, deps = {}) {
272
280
  };}
273
281
  }
274
282
  for (const client of clients) client.attachReviewQueue(manager.candidates);
283
+ // What the lean archive spared, on every look (localInferenceTrace.pipeline.archive).
284
+ bindArchiveStats(() => {
285
+ const stats = manager.candidates?.getStats?.();
286
+ return stats && stats.heldOffers !== undefined ? { held: stats.held,
287
+ heldOffers: stats.heldOffers, heldUnwritten: stats.heldUnwritten } : null;
288
+ });
275
289
  offerStallSink = (name, report) => manager.emit('archiveOfferStalled', { name, report });
276
290
  // The native manager constructs a shadow grouper per feed. Match it to the
277
291
  // exact policy recorded in that feed's durable archive before capture starts.