@camstack/system 1.2.459 → 1.2.461

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 (36) hide show
  1. package/dist/addon-runner.js +26 -11
  2. package/dist/addon-runner.mjs +26 -11
  3. package/dist/addon-utils.js +1 -1
  4. package/dist/addon-utils.mjs +1 -1
  5. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +3 -3
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +4 -4
  7. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +4 -4
  8. package/dist/builtins/local-auth/local-auth.addon.mjs +3 -3
  9. package/dist/builtins/native-metrics/native-metrics.addon.js +38 -3
  10. package/dist/builtins/native-metrics/native-metrics.addon.mjs +47 -12
  11. package/dist/builtins/native-metrics/node-metrics-history-recorder.d.ts +15 -0
  12. package/dist/builtins/platform-probe/coral-accelerators.d.ts +10 -1
  13. package/dist/builtins/platform-probe/index.js +6 -3
  14. package/dist/builtins/platform-probe/index.mjs +12 -9
  15. package/dist/builtins/platform-probe/platform-scorer.d.ts +4 -1
  16. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +19 -19
  17. package/dist/builtins/sqlite-storage/index.js +1 -1
  18. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  19. package/dist/builtins/sqlite-storage/records/records-plan.d.ts +9 -4
  20. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  21. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  22. package/dist/builtins/system-config/system-config.addon.mjs +112 -112
  23. package/dist/{coral-accelerators-DcnZvctM.mjs → coral-accelerators-Qhn5TOYZ.mjs} +18 -15
  24. package/dist/{coral-accelerators-Bi_c3Rft.js → coral-accelerators-oUXmmbc2.js} +13 -10
  25. package/dist/{custom-action-registry-stpC3Zy-.mjs → custom-action-registry-DZSCLBuT.mjs} +39 -37
  26. package/dist/{custom-action-registry-COyb49zm.js → custom-action-registry-MRyes5j0.js} +2 -0
  27. package/dist/file-host-worker.js +1 -1
  28. package/dist/file-host-worker.mjs +1 -1
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +31 -3
  31. package/dist/index.mjs +248 -221
  32. package/dist/kernel/deps/addon-deps-manager.d.ts +9 -0
  33. package/dist/{restore-archive-CmP-iiG9.mjs → restore-archive-CM23Pq9B.mjs} +93 -93
  34. package/dist/{wal-maintenance-NKbwWovZ.mjs → wal-maintenance-Bj_MmDkr.mjs} +0 -0
  35. package/dist/{wal-maintenance-DUHEp_09.js → wal-maintenance-CaJjuLHq.js} +0 -0
  36. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
2
2
  import { Ta as EventCategory, ni as BaseAddon, qi as emitReadiness, sn as enumerateInferenceDevices, ti as errMsg, tr as platformProbeCapability, yr as scoreRuntimes } from "../../dist-Wy8cTxg6.mjs";
3
- import { n as nodeCoralFs, t as classifyCoralAccelerator } from "../../coral-accelerators-DcnZvctM.mjs";
3
+ import { n as nodeCoralFs, t as classifyCoralAccelerator } from "../../coral-accelerators-Qhn5TOYZ.mjs";
4
4
  import { promisify } from "node:util";
5
5
  import * as os$1 from "node:os";
6
- import * as fs from "node:fs";
6
+ import * as fs$1 from "node:fs";
7
7
  import { execFile } from "node:child_process";
8
8
  //#region src/builtins/platform-probe/amd-npu.ts
9
9
  var amd_npu_exports = /* @__PURE__ */ __exportAll({
@@ -323,9 +323,12 @@ var PlatformScorer = class {
323
323
  * lookup (dev / agent environments where Python is on PATH).
324
324
  */
325
325
  embeddedPythonPath;
326
- constructor(logger = noopLogger, embeddedPythonPath = null) {
326
+ /** Where the Coral scan reads `/sys` and `/dev` (the host's, unless a spec fakes one). */
327
+ coralFs;
328
+ constructor(logger = noopLogger, embeddedPythonPath = null, coralFs = nodeCoralFs) {
327
329
  this.logger = logger;
328
330
  this.embeddedPythonPath = embeddedPythonPath;
331
+ this.coralFs = coralFs;
329
332
  }
330
333
  /**
331
334
  * Probe hardware + derive scores from pure rules and score all backend combos.
@@ -408,7 +411,7 @@ var PlatformScorer = class {
408
411
  } });
409
412
  let gpu = null;
410
413
  let npu = null;
411
- const coral = classifyCoralAccelerator(nodeCoralFs);
414
+ const coral = classifyCoralAccelerator(this.coralFs);
412
415
  if (coral) {
413
416
  if ((coral.units ?? []).length > 0) this.logger.info("Coral Edge TPU detected", { meta: { units: coral.units } });
414
417
  for (const unavailable of coral.unavailable ?? []) this.logger.warn("Coral Edge TPU present but unusable", { meta: {
@@ -445,14 +448,14 @@ var PlatformScorer = class {
445
448
  if (nvidia) gpu = nvidia;
446
449
  const listRenderNodes = () => {
447
450
  try {
448
- return fs.readdirSync("/dev/dri").filter((n) => n.startsWith("renderD")).map((n) => `/dev/dri/${n}`);
451
+ return fs$1.readdirSync("/dev/dri").filter((n) => n.startsWith("renderD")).map((n) => `/dev/dri/${n}`);
449
452
  } catch {
450
453
  return [];
451
454
  }
452
455
  };
453
456
  const readDrmAttr = (node, attr) => {
454
457
  try {
455
- return fs.readFileSync(`/sys/class/drm/${node.split("/").pop()}/device/${attr}`, "utf8");
458
+ return fs$1.readFileSync(`/sys/class/drm/${node.split("/").pop()}/device/${attr}`, "utf8");
456
459
  } catch {
457
460
  return "";
458
461
  }
@@ -478,12 +481,12 @@ var PlatformScorer = class {
478
481
  }
479
482
  const listDir = (p) => {
480
483
  try {
481
- return fs.readdirSync(p);
484
+ return fs$1.readdirSync(p);
482
485
  } catch {
483
486
  return [];
484
487
  }
485
488
  };
486
- const exists = (p) => fs.existsSync(p);
489
+ const exists = (p) => fs$1.existsSync(p);
487
490
  if (!npu) {
488
491
  const { classifyIntelNpu } = await import("../../intel-npu-C8HKvRQF.mjs");
489
492
  npu = classifyIntelNpu({
@@ -511,7 +514,7 @@ var PlatformScorer = class {
511
514
  exists,
512
515
  readFile: (p) => {
513
516
  try {
514
- return fs.readFileSync(p, "utf8");
517
+ return fs$1.readFileSync(p, "utf8");
515
518
  } catch {
516
519
  return "";
517
520
  }
@@ -1,4 +1,5 @@
1
1
  import type { HardwareInfo, PlatformCapabilities, IScopedLogger } from "@camstack/types";
2
+ import { type CoralFs } from "./coral-accelerators.js";
2
3
  export declare class PlatformScorer {
3
4
  private cached;
4
5
  private readonly logger;
@@ -11,7 +12,9 @@ export declare class PlatformScorer {
11
12
  * lookup (dev / agent environments where Python is on PATH).
12
13
  */
13
14
  private readonly embeddedPythonPath;
14
- constructor(logger?: IScopedLogger, embeddedPythonPath?: string | null);
15
+ /** Where the Coral scan reads `/sys` and `/dev` (the host's, unless a spec fakes one). */
16
+ private readonly coralFs;
17
+ constructor(logger?: IScopedLogger, embeddedPythonPath?: string | null, coralFs?: CoralFs);
15
18
  /**
16
19
  * Probe hardware + derive scores from pure rules and score all backend combos.
17
20
  *
@@ -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 from "node:fs";
7
+ import * as fs$1 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.promises.stat(basePath).catch(() => null);
172
+ const stat = await fs$1.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.promises.access(basePath, fs.constants.W_OK);
178
+ await fs$1.promises.access(basePath, fs$1.constants.W_OK);
179
179
  return { ok: true };
180
180
  }
181
- await fs.promises.mkdir(basePath, { recursive: true });
181
+ await fs$1.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.promises.mkdir(path$1.dirname(filePath), { recursive: true });
196
- await fs.promises.writeFile(filePath, data);
195
+ await fs$1.promises.mkdir(path$1.dirname(filePath), { recursive: true });
196
+ await fs$1.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.promises.readFile(filePath);
200
+ const buf = await fs$1.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.promises.access(filePath);
208
+ await fs$1.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.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
218
+ return (await fs$1.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.promises.rm(filePath, { force: true });
225
+ await fs$1.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.existsSync(target)) {
231
+ while (!fs$1.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.promises.statfs(target);
236
+ const stats = await fs$1.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.promises.mkdir(path$1.dirname(target), { recursive: true });
246
- await fs.promises.unlink(partial).catch(() => {});
247
- const stream = fs.createWriteStream(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);
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.promises.rename(session.partial, session.target);
288
+ await fs$1.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.promises.unlink(session.partial).catch(() => {});
298
+ await fs$1.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.promises.stat(target);
305
- const fd = await fs.promises.open(target, "r");
304
+ const stat = await fs$1.promises.stat(target);
305
+ const fd = await fs$1.promises.open(target, "r");
306
306
  const downloadId = randomUUID();
307
307
  const session = {
308
308
  fd,
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
6
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
7
- const require_wal_maintenance = require("../../wal-maintenance-DUHEp_09.js");
7
+ const require_wal_maintenance = require("../../wal-maintenance-CaJjuLHq.js");
8
8
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
9
9
  //#region src/builtins/sqlite-storage/config-store.ts
10
10
  var ConfigStore = class {
@@ -1,5 +1,5 @@
1
1
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
2
- import { A as SQLITE_MMAP_CEILING_BYTES, B as SQLITE_SLOW_CALL_MS, F as sqlitePageCacheKibFor, H as sqliteEngineStorm, I as SQLITE_ENGINE_STORM_WALL_SHARE, L as SQLITE_PROFILE_REPORT_FLOOR_MS, M as SQLITE_PAGE_CACHE_CEILING_KIB, N as SQLITE_PAGE_CACHE_FLOOR_KIB, P as sqliteMmapSizeFor, R as SQLITE_PROFILE_REPORT_INTERVAL_MS, V as SqliteOpProfiler, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_MMAP_FLOOR_BYTES, k as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SQLITE_PROFILE_TOP_N } from "../../wal-maintenance-NKbwWovZ.mjs";
2
+ import { A as SQLITE_MMAP_CEILING_BYTES, B as SQLITE_SLOW_CALL_MS, F as sqlitePageCacheKibFor, H as sqliteEngineStorm, I as SQLITE_ENGINE_STORM_WALL_SHARE, L as SQLITE_PROFILE_REPORT_FLOOR_MS, M as SQLITE_PAGE_CACHE_CEILING_KIB, N as SQLITE_PAGE_CACHE_FLOOR_KIB, P as sqliteMmapSizeFor, R as SQLITE_PROFILE_REPORT_INTERVAL_MS, V as SqliteOpProfiler, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_MMAP_FLOOR_BYTES, k as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SQLITE_PROFILE_TOP_N } from "../../wal-maintenance-Bj_MmDkr.mjs";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
5
5
  var ConfigStore = class {
@@ -23,14 +23,19 @@ export interface WherePlan {
23
23
  /** The index fields after the equality prefix: the order a `where` query returns in. */
24
24
  readonly orderFields: readonly string[];
25
25
  }
26
+ /** How `planWhere` may serve a filter. */
27
+ export interface WhereOptions {
28
+ readonly allowIn: boolean;
29
+ /** Fields the statement reads beyond the filter: an aggregate's value and group columns. */
30
+ readonly extraFields?: readonly string[];
31
+ /** The field the statement groups by: an index it leads is preferred. */
32
+ readonly groupBy?: string | undefined;
33
+ }
26
34
  /**
27
35
  * Find the declared index that serves `where` (plus any `extraFields` the
28
36
  * statement reads: an aggregate's value and group columns), or throw.
29
37
  */
30
- export declare function planWhere(kind: string, decl: RecordKindDeclaration, where: RecordWhere | undefined, opts: {
31
- readonly allowIn: boolean;
32
- readonly extraFields?: readonly string[];
33
- }): WherePlan | null;
38
+ export declare function planWhere(kind: string, decl: RecordKindDeclaration, where: RecordWhere | undefined, opts: WhereOptions): WherePlan | null;
34
39
  /** The built-in filters shared by every statement. */
35
40
  export interface WindowFilter {
36
41
  readonly deviceId?: number | undefined;
@@ -5,7 +5,7 @@ Object.defineProperties(exports, {
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
6
  const require_dist = require("../../dist-Bn-RNanh.js");
7
7
  const require_retired_settings_keys = require("../../retired-settings-keys-D_VwZiDt.js");
8
- const require_wal_maintenance = require("../../wal-maintenance-DUHEp_09.js");
8
+ const require_wal_maintenance = require("../../wal-maintenance-CaJjuLHq.js");
9
9
  const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
10
10
  const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
11
11
  let node_fs_promises = require("node:fs/promises");
@@ -1,6 +1,6 @@
1
1
  import { C as DATABASE_SNAPSHOT_TIMEOUT_MS, Jt as databaseSnapshotCapability, Ot as bareAddonId, Rr as vectorStoreCapability, S as DATABASE_SNAPSHOT_SUFFIX, Tr as storageAdminCapability, ar as recordsCapability, ca as normalizeSecretOwner, ci as DeclarationRefusedError, ji as UnknownRecordKindError, ni as BaseAddon, ot as STORAGE_ADMIN_MOVED_COLLECTIONS, pi as NoCallerError, qt as dataStoreProviderCapability, st as STORAGE_ADMIN_SCOPED_BASES, ti as errMsg, vi as RECORD_SWEEP_INTERVAL_MS, w as DATA_STORE_DATABASES, wi as RecordKindDeclarationSchema, x as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, xi as RUNTIME_DEFAULTS } from "../../dist-Wy8cTxg6.mjs";
2
2
  import { i as retiredKeyStoreOf, n as purgeRetiredSettingsKeys } from "../../retired-settings-keys-Bhwe4ymb.mjs";
3
- import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, S as trustResult, T as callData, _ as collectTransferables, a as WalMaintenance, c as vectorProviderOfOwnedFile, d as CrossDatabaseTransactError, f as DatabaseBusyError, l as SqliteSettingsBackend, m as rehydrateError, o as createVectorIndex, p as DuplicatePlacementError, s as vectorProviderOf, u as CollectionPlacementError, v as isFileHostMessage, w as callControl } from "../../wal-maintenance-NKbwWovZ.mjs";
3
+ import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, S as trustResult, T as callData, _ as collectTransferables, a as WalMaintenance, c as vectorProviderOfOwnedFile, d as CrossDatabaseTransactError, f as DatabaseBusyError, l as SqliteSettingsBackend, m as rehydrateError, o as createVectorIndex, p as DuplicatePlacementError, s as vectorProviderOf, u as CollectionPlacementError, v as isFileHostMessage, w as callControl } from "../../wal-maintenance-Bj_MmDkr.mjs";
4
4
  import { r as isSnapshotWorkerMessage } from "../../sqlite-snapshot-protocol-2QaTouWV.mjs";
5
5
  import { a as isWorkerMessage, t as WAL_CHECKPOINT_LARGE_PASS_FRAMES } from "../../wal-checkpoint-policy-BahrTtyD.mjs";
6
6
  import { createRequire } from "node:module";