@camstack/addon-post-analysis 1.2.40 → 1.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.
@@ -22939,6 +22939,16 @@ function buildStationarySnapshot(input) {
22939
22939
  * effect without a restart and long enough that no search pays for it twice.
22940
22940
  */
22941
22941
  var ENCODER_INFO_TTL_MS = 6e4;
22942
+ /**
22943
+ * Rows the orphan sweep considers per pass, on both sides of the comparison.
22944
+ *
22945
+ * Bounded so a retention tick cannot turn into a full-index scan. A pass that
22946
+ * does not reach everything simply leaves the rest for the next tick — orphans
22947
+ * are not urgent, they are just dead weight the search has to skip.
22948
+ */
22949
+ var EMBEDDING_ORPHAN_SCAN_LIMIT = 2e4;
22950
+ /** Dimension of the zero probe vector used to enumerate the index. */
22951
+ var EMBEDDING_ORPHAN_PROBE_DIM = 512;
22942
22952
  var PIPELINE_ANALYTICS_ADDON_ID = "pipeline-analytics";
22943
22953
  /** Operator-visible name of the fixed integration. */
22944
22954
  var NC_INTEGRATION_NAME = "Notification Center";
@@ -26228,6 +26238,23 @@ var PipelineAnalyticsAddon = class extends require_dist.BaseAddon {
26228
26238
  }
26229
26239
  }
26230
26240
  if (deletedEmbeddings > 0) this.ctx.logger.info("object embedding retention prune", { meta: { deleted: deletedEmbeddings } });
26241
+ try {
26242
+ const live = await this.collectLiveTrackIds(deviceIds);
26243
+ const stored = await embeddingStore.searchByVector({
26244
+ vector: new Float32Array(EMBEDDING_ORPHAN_PROBE_DIM),
26245
+ limit: EMBEDDING_ORPHAN_SCAN_LIMIT
26246
+ });
26247
+ const orphanResult = await embeddingStore.pruneOrphans({
26248
+ liveTrackIds: live,
26249
+ candidates: stored.hits.map((h) => h.row.trackId)
26250
+ });
26251
+ if (orphanResult.deleted > 0) this.ctx.logger.info("object embedding orphan sweep", { meta: {
26252
+ deleted: orphanResult.deleted,
26253
+ scanned: stored.hits.length
26254
+ } });
26255
+ } catch (err) {
26256
+ this.ctx.logger.debug("object embedding orphan sweep failed", { meta: { error: String(err) } });
26257
+ }
26231
26258
  }
26232
26259
  } catch (err) {
26233
26260
  this.ctx.logger.debug("sweepRetention failed", { meta: { error: String(err) } });
@@ -26797,6 +26824,25 @@ var PipelineAnalyticsAddon = class extends require_dist.BaseAddon {
26797
26824
  return info.modelId;
26798
26825
  }
26799
26826
  /**
26827
+ * Every track id the track store still holds, across the given devices.
26828
+ *
26829
+ * Returned as a Set for the orphan sweep, which REFUSES an empty one — a
26830
+ * store that failed to answer must not be read as "no tracks exist".
26831
+ */
26832
+ async collectLiveTrackIds(deviceIds) {
26833
+ const live = /* @__PURE__ */ new Set();
26834
+ const trackStore = this.trackStore;
26835
+ if (!trackStore) return live;
26836
+ for (const deviceId of deviceIds) {
26837
+ const page = await trackStore.queryRecent({
26838
+ deviceIds: [deviceId],
26839
+ limit: EMBEDDING_ORPHAN_SCAN_LIMIT
26840
+ });
26841
+ for (const track of page.tracks) live.add(track.trackId);
26842
+ }
26843
+ return live;
26844
+ }
26845
+ /**
26800
26846
  * Empty the CLIP index — the clean slate before a crop-policy or encoder
26801
26847
  * change, to be followed by {@link rebuildObjectEmbeddings}.
26802
26848
  */
@@ -22933,6 +22933,16 @@ function buildStationarySnapshot(input) {
22933
22933
  * effect without a restart and long enough that no search pays for it twice.
22934
22934
  */
22935
22935
  var ENCODER_INFO_TTL_MS = 6e4;
22936
+ /**
22937
+ * Rows the orphan sweep considers per pass, on both sides of the comparison.
22938
+ *
22939
+ * Bounded so a retention tick cannot turn into a full-index scan. A pass that
22940
+ * does not reach everything simply leaves the rest for the next tick — orphans
22941
+ * are not urgent, they are just dead weight the search has to skip.
22942
+ */
22943
+ var EMBEDDING_ORPHAN_SCAN_LIMIT = 2e4;
22944
+ /** Dimension of the zero probe vector used to enumerate the index. */
22945
+ var EMBEDDING_ORPHAN_PROBE_DIM = 512;
22936
22946
  var PIPELINE_ANALYTICS_ADDON_ID = "pipeline-analytics";
22937
22947
  /** Operator-visible name of the fixed integration. */
22938
22948
  var NC_INTEGRATION_NAME = "Notification Center";
@@ -26222,6 +26232,23 @@ var PipelineAnalyticsAddon = class extends BaseAddon {
26222
26232
  }
26223
26233
  }
26224
26234
  if (deletedEmbeddings > 0) this.ctx.logger.info("object embedding retention prune", { meta: { deleted: deletedEmbeddings } });
26235
+ try {
26236
+ const live = await this.collectLiveTrackIds(deviceIds);
26237
+ const stored = await embeddingStore.searchByVector({
26238
+ vector: new Float32Array(EMBEDDING_ORPHAN_PROBE_DIM),
26239
+ limit: EMBEDDING_ORPHAN_SCAN_LIMIT
26240
+ });
26241
+ const orphanResult = await embeddingStore.pruneOrphans({
26242
+ liveTrackIds: live,
26243
+ candidates: stored.hits.map((h) => h.row.trackId)
26244
+ });
26245
+ if (orphanResult.deleted > 0) this.ctx.logger.info("object embedding orphan sweep", { meta: {
26246
+ deleted: orphanResult.deleted,
26247
+ scanned: stored.hits.length
26248
+ } });
26249
+ } catch (err) {
26250
+ this.ctx.logger.debug("object embedding orphan sweep failed", { meta: { error: String(err) } });
26251
+ }
26225
26252
  }
26226
26253
  } catch (err) {
26227
26254
  this.ctx.logger.debug("sweepRetention failed", { meta: { error: String(err) } });
@@ -26791,6 +26818,25 @@ var PipelineAnalyticsAddon = class extends BaseAddon {
26791
26818
  return info.modelId;
26792
26819
  }
26793
26820
  /**
26821
+ * Every track id the track store still holds, across the given devices.
26822
+ *
26823
+ * Returned as a Set for the orphan sweep, which REFUSES an empty one — a
26824
+ * store that failed to answer must not be read as "no tracks exist".
26825
+ */
26826
+ async collectLiveTrackIds(deviceIds) {
26827
+ const live = /* @__PURE__ */ new Set();
26828
+ const trackStore = this.trackStore;
26829
+ if (!trackStore) return live;
26830
+ for (const deviceId of deviceIds) {
26831
+ const page = await trackStore.queryRecent({
26832
+ deviceIds: [deviceId],
26833
+ limit: EMBEDDING_ORPHAN_SCAN_LIMIT
26834
+ });
26835
+ for (const track of page.tracks) live.add(track.trackId);
26836
+ }
26837
+ return live;
26838
+ }
26839
+ /**
26794
26840
  * Empty the CLIP index — the clean slate before a crop-policy or encoder
26795
26841
  * change, to be followed by {@link rebuildObjectEmbeddings}.
26796
26842
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-post-analysis",
3
- "version": "1.2.40",
3
+ "version": "1.2.41",
4
4
  "description": "Post-Analysis bundle — enrichment, embedding-encoder, pipeline-analytics. Multi-entry npm package shipping addons that consume pipeline output.",
5
5
  "keywords": [
6
6
  "camstack",