@camstack/server 1.2.775 → 1.2.776

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.776] - 2026-11-05
11
+
12
+ ### Changed
13
+
14
+ - Deleting a device from the UI now also stops the instance running inside its addon worker (no zombie timers, no stale 'already adopted'); accessories of a hub-child camera inherit the hub's integration
15
+
10
16
  ## [1.2.775] - 2026-11-05
11
17
 
12
18
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.775",
3
+ "version": "1.2.776",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,18 +66,10 @@
66
66
  ],
67
67
  "requires": {
68
68
  "addons": {
69
- "@camstack/addon-admin-ui": ">=1.2.591",
70
- "@camstack/addon-ai": ">=0.4.177",
71
- "@camstack/addon-cloudflare": ">=1.2.157",
72
- "@camstack/addon-export-hap": ">=1.2.194",
73
- "@camstack/addon-model-studio": ">=1.1.342",
74
- "@camstack/addon-mqtt-broker": ">=1.2.151",
75
- "@camstack/addon-osd-manager": ">=0.1.315",
76
- "@camstack/addon-pipeline": ">=1.2.641",
77
- "@camstack/addon-pipeline-orchestrator": ">=1.2.661",
78
- "@camstack/addon-post-analysis": ">=1.2.669",
79
- "@camstack/addon-provider-reolink": ">=1.2.227",
80
- "@camstack/addon-tailscale": ">=1.2.150"
69
+ "@camstack/addon-matter-broker": ">=0.2.158",
70
+ "@camstack/addon-provider-dreo": ">=0.2.156",
71
+ "@camstack/addon-provider-gree": ">=0.2.152",
72
+ "@camstack/addon-provider-reolink": ">=1.2.228"
81
73
  },
82
74
  "wrapper": {
83
75
  "desktop": ">=0.0.1",
@@ -5922,7 +5922,13 @@ function getWorkerNativeCapProvider(capName, deviceId) {
5922
5922
  function deviceHasStreamSources(device) {
5923
5923
  return typeof Reflect.get(device, "getStreamSources") === "function";
5924
5924
  }
5925
- function buildDeviceOpsProvider(device) {
5925
+ /**
5926
+ * `afterRemove` is the worker's local teardown (registry entry, native caps,
5927
+ * children). The hub's `remove` reaches a forked worker ONLY through this
5928
+ * provider, so the lifecycle call alone would leave a zombie instance in the
5929
+ * worker (timers running, still listed as adopted). It is idempotent.
5930
+ */
5931
+ function buildDeviceOpsProvider(device, afterRemove) {
5926
5932
  const assertMatch = (incoming) => {
5927
5933
  if (incoming !== device.id) throw new Error(`device-ops: deviceId mismatch — expected '${device.id}', got '${incoming}'`);
5928
5934
  };
@@ -5950,6 +5956,7 @@ function buildDeviceOpsProvider(device) {
5950
5956
  removeDevice: async (input) => {
5951
5957
  assertMatch(input.deviceId);
5952
5958
  await device.removeDevice();
5959
+ await afterRemove?.(device.id);
5953
5960
  },
5954
5961
  getSettingsSchema: async (input) => {
5955
5962
  assertMatch(input.deviceId);
@@ -6180,6 +6187,10 @@ function createBrokerDeviceManagerApi(opts) {
6180
6187
  }
6181
6188
  };
6182
6189
  };
6190
+ /** The integration a spawned child inherits: its parent's persisted one, if any. */
6191
+ const resolveParentIntegrationId = async (parentId) => {
6192
+ return (await callDeviceManager(api, "loadMeta", { deviceId: parentId }).catch(() => null))?.integrationId ?? void 0;
6193
+ };
6183
6194
  /**
6184
6195
  * Spawn one accessory child device declared by a parent's
6185
6196
  * `getAccessoryChildren()`. Mirrors the standard `create()` flow
@@ -6197,13 +6208,15 @@ function createBrokerDeviceManagerApi(opts) {
6197
6208
  const empty = {};
6198
6209
  const existingMeta = await callDeviceManager(api, "loadMeta", { deviceId: id }).catch(() => null);
6199
6210
  const isFirstSpawn = !existingMeta || existingMeta.name === childStableId;
6211
+ const linkDeviceId = spec.meta.linkDeviceId ?? parent.id;
6212
+ const integrationId = spec.meta.integrationId ?? await resolveParentIntegrationId(parent.id);
6200
6213
  await callDeviceManager(api, "applyInitialMeta", {
6201
6214
  deviceId: id,
6202
- linkDeviceId: spec.meta.linkDeviceId ?? parent.id,
6215
+ linkDeviceId,
6203
6216
  ...isFirstSpawn && spec.meta.name !== void 0 ? { name: spec.meta.name } : {},
6204
6217
  ...isFirstSpawn && spec.meta.location !== void 0 ? { location: spec.meta.location } : {},
6205
6218
  ...spec.meta.type !== void 0 ? { type: spec.meta.type } : {},
6206
- ...spec.meta.integrationId !== void 0 ? { integrationId: spec.meta.integrationId } : {},
6219
+ ...integrationId !== void 0 ? { integrationId } : {},
6207
6220
  ...spec.meta.role !== void 0 ? { role: spec.meta.role } : {}
6208
6221
  }).catch((err) => {
6209
6222
  opts.logger.warn("spawnAccessoryChild: applyInitialMeta pre-seed failed", {
@@ -6464,7 +6477,7 @@ function createBrokerDeviceManagerApi(opts) {
6464
6477
  },
6465
6478
  register: async (device) => {
6466
6479
  registry.register(addonId, device);
6467
- buildContext(device.stableId, device.id, device.parentDeviceId).registerNativeCap(_camstack_types_addon.deviceOpsCapability, buildDeviceOpsProvider(device));
6480
+ buildContext(device.stableId, device.id, device.parentDeviceId).registerNativeCap(_camstack_types_addon.deviceOpsCapability, buildDeviceOpsProvider(device, (id) => teardownLocal(id, false)));
6468
6481
  try {
6469
6482
  await callDeviceManager(api, "registerDevice", {
6470
6483
  addonId,
@@ -5867,7 +5867,13 @@ function getWorkerNativeCapProvider(capName, deviceId) {
5867
5867
  function deviceHasStreamSources(device) {
5868
5868
  return typeof Reflect.get(device, "getStreamSources") === "function";
5869
5869
  }
5870
- function buildDeviceOpsProvider(device) {
5870
+ /**
5871
+ * `afterRemove` is the worker's local teardown (registry entry, native caps,
5872
+ * children). The hub's `remove` reaches a forked worker ONLY through this
5873
+ * provider, so the lifecycle call alone would leave a zombie instance in the
5874
+ * worker (timers running, still listed as adopted). It is idempotent.
5875
+ */
5876
+ function buildDeviceOpsProvider(device, afterRemove) {
5871
5877
  const assertMatch = (incoming) => {
5872
5878
  if (incoming !== device.id) throw new Error(`device-ops: deviceId mismatch — expected '${device.id}', got '${incoming}'`);
5873
5879
  };
@@ -5895,6 +5901,7 @@ function buildDeviceOpsProvider(device) {
5895
5901
  removeDevice: async (input) => {
5896
5902
  assertMatch(input.deviceId);
5897
5903
  await device.removeDevice();
5904
+ await afterRemove?.(device.id);
5898
5905
  },
5899
5906
  getSettingsSchema: async (input) => {
5900
5907
  assertMatch(input.deviceId);
@@ -6125,6 +6132,10 @@ function createBrokerDeviceManagerApi(opts) {
6125
6132
  }
6126
6133
  };
6127
6134
  };
6135
+ /** The integration a spawned child inherits: its parent's persisted one, if any. */
6136
+ const resolveParentIntegrationId = async (parentId) => {
6137
+ return (await callDeviceManager(api, "loadMeta", { deviceId: parentId }).catch(() => null))?.integrationId ?? void 0;
6138
+ };
6128
6139
  /**
6129
6140
  * Spawn one accessory child device declared by a parent's
6130
6141
  * `getAccessoryChildren()`. Mirrors the standard `create()` flow
@@ -6142,13 +6153,15 @@ function createBrokerDeviceManagerApi(opts) {
6142
6153
  const empty = {};
6143
6154
  const existingMeta = await callDeviceManager(api, "loadMeta", { deviceId: id }).catch(() => null);
6144
6155
  const isFirstSpawn = !existingMeta || existingMeta.name === childStableId;
6156
+ const linkDeviceId = spec.meta.linkDeviceId ?? parent.id;
6157
+ const integrationId = spec.meta.integrationId ?? await resolveParentIntegrationId(parent.id);
6145
6158
  await callDeviceManager(api, "applyInitialMeta", {
6146
6159
  deviceId: id,
6147
- linkDeviceId: spec.meta.linkDeviceId ?? parent.id,
6160
+ linkDeviceId,
6148
6161
  ...isFirstSpawn && spec.meta.name !== void 0 ? { name: spec.meta.name } : {},
6149
6162
  ...isFirstSpawn && spec.meta.location !== void 0 ? { location: spec.meta.location } : {},
6150
6163
  ...spec.meta.type !== void 0 ? { type: spec.meta.type } : {},
6151
- ...spec.meta.integrationId !== void 0 ? { integrationId: spec.meta.integrationId } : {},
6164
+ ...integrationId !== void 0 ? { integrationId } : {},
6152
6165
  ...spec.meta.role !== void 0 ? { role: spec.meta.role } : {}
6153
6166
  }).catch((err) => {
6154
6167
  opts.logger.warn("spawnAccessoryChild: applyInitialMeta pre-seed failed", {
@@ -6409,7 +6422,7 @@ function createBrokerDeviceManagerApi(opts) {
6409
6422
  },
6410
6423
  register: async (device) => {
6411
6424
  registry.register(addonId, device);
6412
- buildContext(device.stableId, device.id, device.parentDeviceId).registerNativeCap(deviceOpsCapability, buildDeviceOpsProvider(device));
6425
+ buildContext(device.stableId, device.id, device.parentDeviceId).registerNativeCap(deviceOpsCapability, buildDeviceOpsProvider(device, (id) => teardownLocal(id, false)));
6413
6426
  try {
6414
6427
  await callDeviceManager(api, "registerDevice", {
6415
6428
  addonId,
@@ -1,3 +1,3 @@
1
- import { C as isModelDownloaded, S as isModelDownloadHttpError, _ as downloadFile, a as startEventLoopStallMonitor, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, p as ModelDownloadHttpError, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-oHl1xltx.mjs";
1
+ import { C as isModelDownloaded, S as isModelDownloadHttpError, _ as downloadFile, a as startEventLoopStallMonitor, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, p as ModelDownloadHttpError, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-BIJZBObd.mjs";
2
2
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg, t as COURTESY_DEFAULT_WIDTH } from "./snapshot-courtesy-CyFs1M3I.mjs";
3
3
  export { COURTESY_DEFAULT_WIDTH, CustomActionRegistry, ModelDownloadHttpError, ModelDownloadService, STALL_REPORT_MS, STALL_TICK_MS, adoptModelRevisions, attributeStall, collectModelFiles, contentTypeFor, courtesyCacheKey, createFileDataPlaneHandler, deleteModelFromDisk, downloadFile, ensureModel, getModelFilePath, isModelDownloadHttpError, isModelDownloaded, parseRangeHeader, renderCourtesyJpeg, renderCourtesyOverlayJpeg, resolveFormatRevision, startEventLoopStallMonitor };
@@ -2,7 +2,7 @@ import { To as BaseAddon, cn as addonPagesCapability, dc as errMsg, fc as EventC
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as path$1 from "node:path";
5
- import * as fs$1 from "node:fs";
5
+ import * as fs from "node:fs";
6
6
  //#region src/builtins/addon-pages-aggregator/dedupe-pages.ts
7
7
  /** Stable identity for an addon page, independent of which node reported it. */
8
8
  function pageKey(info) {
@@ -211,11 +211,11 @@ var AddonPagesAggregatorAddon = class extends BaseAddon {
211
211
  const bundlePath = this.resolveBundlePath(addonId, bundle);
212
212
  if (bundlePath === null) return `/api/addon-pages/${addonId}/${bundle}?v=${Math.floor(Date.now())}`;
213
213
  try {
214
- const stat = fs$1.statSync(bundlePath);
214
+ const stat = fs.statSync(bundlePath);
215
215
  const cacheKey = `${bundlePath}:${stat.size}:${stat.mtimeMs}`;
216
216
  let v = this.bundleHashCache.get(cacheKey);
217
217
  if (v === void 0) {
218
- v = createHash("sha1").update(fs$1.readFileSync(bundlePath)).digest("hex").slice(0, 12);
218
+ v = createHash("sha1").update(fs.readFileSync(bundlePath)).digest("hex").slice(0, 12);
219
219
  this.bundleHashCache.set(cacheKey, v);
220
220
  }
221
221
  return `/api/addon-pages/${addonId}/${bundle}?v=${v}`;
@@ -2,7 +2,7 @@ import { To as BaseAddon, dc as errMsg, fc as EventCategory, un as addonWidgetsC
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as path$1 from "node:path";
5
- import * as fs$1 from "node:fs";
5
+ import * as fs from "node:fs";
6
6
  //#region src/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.ts
7
7
  /**
8
8
  * Addon Widgets Aggregator — hub-local builtin that owns the singleton
@@ -204,9 +204,9 @@ var AddonWidgetsAggregatorAddon = class extends BaseAddon {
204
204
  if (entryPath === null) return String(Math.floor(Date.now()));
205
205
  try {
206
206
  const dir = path$1.dirname(entryPath);
207
- const files = fs$1.readdirSync(dir).filter((f) => fs$1.statSync(path$1.join(dir, f)).isFile()).sort();
207
+ const files = fs.readdirSync(dir).filter((f) => fs.statSync(path$1.join(dir, f)).isFile()).sort();
208
208
  const cacheKey = `${dir}#${files.map((f) => {
209
- const s = fs$1.statSync(path$1.join(dir, f));
209
+ const s = fs.statSync(path$1.join(dir, f));
210
210
  return `${f}:${s.size}:${s.mtimeMs}`;
211
211
  }).join("|")}`;
212
212
  const cached = this.bundleHashCache.get(cacheKey);
@@ -214,7 +214,7 @@ var AddonWidgetsAggregatorAddon = class extends BaseAddon {
214
214
  const hash = createHash("sha1");
215
215
  for (const f of files) {
216
216
  hash.update(f);
217
- hash.update(fs$1.readFileSync(path$1.join(dir, f)));
217
+ hash.update(fs.readFileSync(path$1.join(dir, f)));
218
218
  }
219
219
  const digest = hash.digest("hex").slice(0, 12);
220
220
  this.bundleHashCache.set(cacheKey, digest);
@@ -1,10 +1,10 @@
1
1
  import { Ca as storageOccupancyCapability, Hs as nodePin, To as BaseAddon, _n as backupCapability, fc as EventCategory, rc as toNodeId, si as mayWriteToLocation } from "../../dist-C-reEuab.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
- import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-DYn0lsQl.mjs";
3
+ import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-BT_VMwFC.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import * as fsp from "node:fs/promises";
6
6
  import * as path$1 from "node:path";
7
- import * as fs$1 from "node:fs";
7
+ import * as fs from "node:fs";
8
8
  //#region src/builtins/backup-orchestrator/backup-databases.ts
9
9
  /** Stable id of the seeded weekly schedule. */
10
10
  var WEEKLY_SCHEDULE_ID = "weekly-events-history";
@@ -1018,7 +1018,7 @@ async function downloadArchiveToCache(input) {
1018
1018
  location: input.locationId,
1019
1019
  relativePath: input.filename
1020
1020
  });
1021
- const writeStream = fs$1.createWriteStream(input.cachePath);
1021
+ const writeStream = fs.createWriteStream(input.cachePath);
1022
1022
  let offset = 0;
1023
1023
  try {
1024
1024
  while (offset < sizeBytes) {
@@ -2502,7 +2502,7 @@ var BackupOrchestratorAddon = class extends BaseAddon {
2502
2502
  });
2503
2503
  try {
2504
2504
  let offset = 0;
2505
- const stream = fs$1.createReadStream(input.cachePath, { highWaterMark: UPLOAD_CHUNK_BYTES });
2505
+ const stream = fs.createReadStream(input.cachePath, { highWaterMark: UPLOAD_CHUNK_BYTES });
2506
2506
  for await (const rawChunk of stream) {
2507
2507
  if (input.signal?.aborted) {
2508
2508
  stream.destroy();
@@ -9,7 +9,7 @@ import * as crypto$1 from "node:crypto";
9
9
  import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
10
10
  import nodeCrypto from "crypto";
11
11
  import * as path$1 from "node:path";
12
- import * as fs$1 from "node:fs";
12
+ import * as fs from "node:fs";
13
13
  //#region ../../node_modules/bcryptjs/index.js
14
14
  /**
15
15
  * The random implementation to use as a fallback.
@@ -11912,8 +11912,8 @@ var LocalAuthAddon = class extends BaseAddon {
11912
11912
  users: this.userManager,
11913
11913
  dataDir: this.ctx.nodeDataDir,
11914
11914
  fs: {
11915
- exists: (filePath) => fs$1.existsSync(filePath),
11916
- remove: (filePath) => fs$1.rmSync(filePath, { force: true })
11915
+ exists: (filePath) => fs.existsSync(filePath),
11916
+ remove: (filePath) => fs.rmSync(filePath, { force: true })
11917
11917
  },
11918
11918
  logger: this.ctx.logger
11919
11919
  });
@@ -3,7 +3,7 @@ import { access, readFile, readdir } from "node:fs/promises";
3
3
  import { promisify } from "node:util";
4
4
  import * as os$1 from "node:os";
5
5
  import { platform } from "node:os";
6
- import * as fs$1 from "node:fs";
6
+ import * as fs from "node:fs";
7
7
  import { constants, readFileSync } from "node:fs";
8
8
  import { execFile } from "node:child_process";
9
9
  //#region src/builtins/native-metrics/cgroup-memory.ts
@@ -1686,7 +1686,7 @@ var NativeMetricsProvider = class {
1686
1686
  let swapUsedBytes = 0;
1687
1687
  let swapTotalBytes = 0;
1688
1688
  if (IS_LINUX) try {
1689
- const meminfo = fs$1.readFileSync("/proc/meminfo", "utf-8");
1689
+ const meminfo = fs.readFileSync("/proc/meminfo", "utf-8");
1690
1690
  const availKb = meminfo.match(/MemAvailable:\s+(\d+)/)?.[1];
1691
1691
  if (availKb !== void 0) available = parseInt(availKb, 10) * 1024;
1692
1692
  const swapTotal = parseInt(meminfo.match(/SwapTotal:\s+(\d+)/)?.[1] ?? "0", 10) * 1024;
@@ -1779,7 +1779,7 @@ async function sampleMacMemory(provider) {
1779
1779
  }
1780
1780
  function getDiskSpaceInternal(dirPath) {
1781
1781
  return new Promise((resolve, reject) => {
1782
- fs$1.statfs(dirPath, (err, stats) => {
1782
+ fs.statfs(dirPath, (err, stats) => {
1783
1783
  if (err) return reject(err);
1784
1784
  const totalBytes = stats.blocks * stats.bsize;
1785
1785
  const availableBytes = stats.bavail * stats.bsize;
@@ -1797,7 +1797,7 @@ function getDiskSpaceInternal(dirPath) {
1797
1797
  async function takeDiskIoSnapshot() {
1798
1798
  const now = Date.now();
1799
1799
  if (IS_LINUX) try {
1800
- const data = fs$1.readFileSync("/proc/diskstats", "utf-8");
1800
+ const data = fs.readFileSync("/proc/diskstats", "utf-8");
1801
1801
  let readOps = 0, readBytes = 0, writeOps = 0, writeBytes = 0;
1802
1802
  for (const line of data.split("\n")) {
1803
1803
  const parts = line.trim().split(/\s+/);
@@ -1828,7 +1828,7 @@ async function takeDiskIoSnapshot() {
1828
1828
  async function takeNetworkIoSnapshot() {
1829
1829
  const now = Date.now();
1830
1830
  if (IS_LINUX) try {
1831
- const data = fs$1.readFileSync("/proc/net/dev", "utf-8");
1831
+ const data = fs.readFileSync("/proc/net/dev", "utf-8");
1832
1832
  let rxBytes = 0, txBytes = 0, rxPackets = 0, txPackets = 0, rxErrors = 0, txErrors = 0;
1833
1833
  for (const line of data.split("\n")) {
1834
1834
  const match = line.match(/^\s*(\w+):\s+(.+)$/);
@@ -1889,7 +1889,7 @@ async function takeNetworkIoSnapshot() {
1889
1889
  }
1890
1890
  async function getCpuTemperatureInternal() {
1891
1891
  if (IS_LINUX) for (const p of ["/sys/class/thermal/thermal_zone0/temp", "/sys/class/hwmon/hwmon0/temp1_input"]) try {
1892
- const raw = fs$1.readFileSync(p, "utf-8").trim();
1892
+ const raw = fs.readFileSync(p, "utf-8").trim();
1893
1893
  const millideg = parseInt(raw, 10);
1894
1894
  if (!isNaN(millideg)) return Math.round(millideg / 100) / 10;
1895
1895
  } catch {
@@ -1940,10 +1940,10 @@ function getProcessResources() {
1940
1940
  let threadCount = 0;
1941
1941
  if (IS_LINUX) {
1942
1942
  try {
1943
- openFds = fs$1.readdirSync(`/proc/${process.pid}/fd`).length;
1943
+ openFds = fs.readdirSync(`/proc/${process.pid}/fd`).length;
1944
1944
  } catch {}
1945
1945
  try {
1946
- const match = fs$1.readFileSync(`/proc/${process.pid}/status`, "utf-8").match(/Threads:\s+(\d+)/);
1946
+ const match = fs.readFileSync(`/proc/${process.pid}/status`, "utf-8").match(/Threads:\s+(\d+)/);
1947
1947
  if (match) threadCount = parseInt(match[1], 10);
1948
1948
  } catch {}
1949
1949
  }
@@ -1958,7 +1958,7 @@ function getProcessResources() {
1958
1958
  function getPressure(resource) {
1959
1959
  if (!IS_LINUX) return null;
1960
1960
  try {
1961
- const data = fs$1.readFileSync(`/proc/pressure/${resource}`, "utf-8");
1961
+ const data = fs.readFileSync(`/proc/pressure/${resource}`, "utf-8");
1962
1962
  const parseLine = (prefix) => {
1963
1963
  const match = data.match(new RegExp(`${prefix} avg10=(\\d+\\.\\d+) avg60=(\\d+\\.\\d+) avg300=(\\d+\\.\\d+)`));
1964
1964
  if (!match) return null;
@@ -1,10 +1,10 @@
1
1
  import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
2
2
  import { Ei as parseAcceleratorFactsJson, Ss as emitReadiness, To as BaseAddon, dc as errMsg, dr as enumerateInferenceDevices, fc as EventCategory, ji as platformProbeCapability, ua as scoreRuntimes } from "../../dist-C-reEuab.mjs";
3
- import { n as detectCoralAccelerator, r as nodeCoralFs } from "../../coral-accelerators-DBlgWB8k.mjs";
3
+ import { n as detectCoralAccelerator, r as nodeCoralFs } from "../../coral-accelerators-BW3OcrLD.mjs";
4
4
  import * as path$1 from "node:path";
5
5
  import { promisify } from "node:util";
6
6
  import * as os$1 from "node:os";
7
- import * as fs$1 from "node:fs";
7
+ import * as fs from "node:fs";
8
8
  import { execFile } from "node:child_process";
9
9
  //#region src/builtins/platform-probe/accelerator-reprobe.ts
10
10
  /**
@@ -492,14 +492,14 @@ var PlatformScorer = class {
492
492
  if (nvidia) gpu = nvidia;
493
493
  const listRenderNodes = () => {
494
494
  try {
495
- return fs$1.readdirSync("/dev/dri").filter((n) => n.startsWith("renderD")).map((n) => `/dev/dri/${n}`);
495
+ return fs.readdirSync("/dev/dri").filter((n) => n.startsWith("renderD")).map((n) => `/dev/dri/${n}`);
496
496
  } catch {
497
497
  return [];
498
498
  }
499
499
  };
500
500
  const readDrmAttr = (node, attr) => {
501
501
  try {
502
- return fs$1.readFileSync(`/sys/class/drm/${node.split("/").pop()}/device/${attr}`, "utf8");
502
+ return fs.readFileSync(`/sys/class/drm/${node.split("/").pop()}/device/${attr}`, "utf8");
503
503
  } catch {
504
504
  return "";
505
505
  }
@@ -525,12 +525,12 @@ var PlatformScorer = class {
525
525
  }
526
526
  const listDir = (p) => {
527
527
  try {
528
- return fs$1.readdirSync(p);
528
+ return fs.readdirSync(p);
529
529
  } catch {
530
530
  return [];
531
531
  }
532
532
  };
533
- const exists = (p) => fs$1.existsSync(p);
533
+ const exists = (p) => fs.existsSync(p);
534
534
  if (!npu) {
535
535
  const { classifyIntelNpu } = await import("../../intel-npu-C8HKvRQF.mjs");
536
536
  npu = classifyIntelNpu({
@@ -558,7 +558,7 @@ var PlatformScorer = class {
558
558
  exists,
559
559
  readFile: (p) => {
560
560
  try {
561
- return fs$1.readFileSync(p, "utf8");
561
+ return fs.readFileSync(p, "utf8");
562
562
  } catch {
563
563
  return "";
564
564
  }
@@ -844,7 +844,7 @@ function jsonValue(text) {
844
844
  function readPublishedAcceleratorFacts(filePath) {
845
845
  let text;
846
846
  try {
847
- text = fs$1.readFileSync(filePath, "utf8");
847
+ text = fs.readFileSync(filePath, "utf8");
848
848
  } catch {
849
849
  return null;
850
850
  }
@@ -859,7 +859,7 @@ function findAcceleratorFactsScript(dataDir, cwd = process.cwd()) {
859
859
  const candidates = [];
860
860
  if (typeof dataDir === "string" && dataDir !== "") candidates.push(path$1.join(dataDir, "addons", "@camstack", "addon-pipeline", "python", "accelerator_facts.py"));
861
861
  candidates.push(path$1.join(cwd, "packages", "addon-pipeline", "python", "accelerator_facts.py"));
862
- for (const candidate of candidates) if (fs$1.existsSync(candidate)) return candidate;
862
+ for (const candidate of candidates) if (fs.existsSync(candidate)) return candidate;
863
863
  return null;
864
864
  }
865
865
  async function defaultExec(command, args, timeoutMs) {
@@ -4,7 +4,7 @@ import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
5
5
  import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
6
6
  import { homedir } from "node:os";
7
- import * as fs$1 from "node:fs";
7
+ import * as fs from "node:fs";
8
8
  //#region src/builtins/sqlite-storage/path-guard.ts
9
9
  /**
10
10
  * Guards for the filesystem-browse cap. Pure + synchronous so they are
@@ -169,16 +169,16 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
169
169
  error: "config.basePath must be a non-empty string"
170
170
  };
171
171
  try {
172
- const stat = await fs$1.promises.stat(basePath).catch(() => null);
172
+ const stat = await fs.promises.stat(basePath).catch(() => null);
173
173
  if (stat) {
174
174
  if (!stat.isDirectory()) return {
175
175
  ok: false,
176
176
  error: `Path "${basePath}" exists but is not a directory`
177
177
  };
178
- await fs$1.promises.access(basePath, fs$1.constants.W_OK);
178
+ await fs.promises.access(basePath, fs.constants.W_OK);
179
179
  return { ok: true };
180
180
  }
181
- await fs$1.promises.mkdir(basePath, { recursive: true });
181
+ await fs.promises.mkdir(basePath, { recursive: true });
182
182
  return { ok: true };
183
183
  } catch (err) {
184
184
  return {
@@ -192,12 +192,12 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
192
192
  }
193
193
  async write({ location, relativePath, data }) {
194
194
  const filePath = safeResolve(getBasePath(location), relativePath);
195
- await fs$1.promises.mkdir(path$1.dirname(filePath), { recursive: true });
196
- await fs$1.promises.writeFile(filePath, data);
195
+ await fs.promises.mkdir(path$1.dirname(filePath), { recursive: true });
196
+ await fs.promises.writeFile(filePath, data);
197
197
  }
198
198
  async read({ location, relativePath }) {
199
199
  const filePath = safeResolve(getBasePath(location), relativePath);
200
- const buf = await fs$1.promises.readFile(filePath);
200
+ const buf = await fs.promises.readFile(filePath);
201
201
  const out = new Uint8Array(new ArrayBuffer(buf.byteLength));
202
202
  out.set(buf);
203
203
  return out;
@@ -205,7 +205,7 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
205
205
  async exists({ location, relativePath }) {
206
206
  const filePath = safeResolve(getBasePath(location), relativePath);
207
207
  try {
208
- await fs$1.promises.access(filePath);
208
+ await fs.promises.access(filePath);
209
209
  return true;
210
210
  } catch {
211
211
  return false;
@@ -215,25 +215,25 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
215
215
  const base = getBasePath(location);
216
216
  const dir = prefix ? safeResolve(base, prefix) : path$1.resolve(base);
217
217
  try {
218
- return (await fs$1.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
218
+ return (await fs.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
219
219
  } catch {
220
220
  return [];
221
221
  }
222
222
  }
223
223
  async delete({ location, relativePath }) {
224
224
  const filePath = safeResolve(getBasePath(location), relativePath);
225
- await fs$1.promises.rm(filePath, { force: true });
225
+ await fs.promises.rm(filePath, { force: true });
226
226
  }
227
227
  async getAvailableSpace({ location }) {
228
228
  const base = path$1.resolve(getBasePath(location));
229
229
  try {
230
230
  let target = base;
231
- while (!fs$1.existsSync(target)) {
231
+ while (!fs.existsSync(target)) {
232
232
  const parent = path$1.dirname(target);
233
233
  if (!parent || parent === target) return null;
234
234
  target = parent;
235
235
  }
236
- const stats = await fs$1.promises.statfs(target);
236
+ const stats = await fs.promises.statfs(target);
237
237
  return stats.bavail * stats.bsize;
238
238
  } catch {
239
239
  return null;
@@ -242,9 +242,9 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
242
242
  async beginUpload({ location, relativePath }) {
243
243
  const target = safeResolve(getBasePath(location), relativePath);
244
244
  const partial = `${target}.partial`;
245
- await fs$1.promises.mkdir(path$1.dirname(target), { recursive: true });
246
- await fs$1.promises.unlink(partial).catch(() => {});
247
- const stream = fs$1.createWriteStream(partial);
245
+ await fs.promises.mkdir(path$1.dirname(target), { recursive: true });
246
+ await fs.promises.unlink(partial).catch(() => {});
247
+ const stream = fs.createWriteStream(partial);
248
248
  const uploadId = randomUUID();
249
249
  const session = {
250
250
  stream,
@@ -285,7 +285,7 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
285
285
  session.stream.end(() => resolve());
286
286
  session.stream.on("error", reject);
287
287
  });
288
- await fs$1.promises.rename(session.partial, session.target);
288
+ await fs.promises.rename(session.partial, session.target);
289
289
  clearTimeout(session.timer);
290
290
  this.uploads.delete(uploadId);
291
291
  }
@@ -295,14 +295,14 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
295
295
  try {
296
296
  session.stream.destroy();
297
297
  } catch {}
298
- await fs$1.promises.unlink(session.partial).catch(() => {});
298
+ await fs.promises.unlink(session.partial).catch(() => {});
299
299
  clearTimeout(session.timer);
300
300
  this.uploads.delete(uploadId);
301
301
  }
302
302
  async beginDownload({ location, relativePath }) {
303
303
  const target = safeResolve(getBasePath(location), relativePath);
304
- const stat = await fs$1.promises.stat(target);
305
- const fd = await fs$1.promises.open(target, "r");
304
+ const stat = await fs.promises.stat(target);
305
+ const fd = await fs.promises.open(target, "r");
306
306
  const downloadId = randomUUID();
307
307
  const session = {
308
308
  fd,