@camstack/system 1.2.448 → 1.2.449

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.
@@ -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-Bj3Z87Dx.js");
7
+ const require_wal_maintenance = require("../../wal-maintenance-mwCBe3Vr.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_FLOOR_BYTES, B as SqliteOpProfiler, F as SQLITE_ENGINE_STORM_WALL_SHARE, I as SQLITE_PROFILE_REPORT_FLOOR_MS, L as SQLITE_PROFILE_REPORT_INTERVAL_MS, M as SQLITE_PAGE_CACHE_FLOOR_KIB, N as sqliteMmapSizeFor, O as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as sqlitePageCacheKibFor, R as SQLITE_PROFILE_TOP_N, V as sqliteEngineStorm, a as WalMaintenance, c as SqliteSettingsBackend, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_PAGE_CACHE_CEILING_KIB, k as SQLITE_MMAP_CEILING_BYTES, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SQLITE_SLOW_CALL_MS } from "../../wal-maintenance-DTmqHKdi.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-BineOch3.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,11 +23,9 @@ import type { SqliteVecVectorIndex } from "./vector-index-vec.js";
23
23
  * of its database that the nightly backup archives in place of the live files
24
24
  * (D693).
25
25
  *
26
- * It ALSO serves `vector-store` (singleton, internal), from the settings file's
27
- * open handle. That capability first shipped as its own addon and the
28
- * separation cost two round trips per write — caller → door → engine — plus a
29
- * runner process, to reach a database this addon already has open. The
30
- * capability is what keeps the backend swappable; the package never was.
26
+ * It ALSO serves `vector-store` (singleton, internal), from the **events**
27
+ * file's worker thread (sqlite-vec loaded there). The capability is what keeps
28
+ * the backend swappable; the package never was.
31
29
  */
32
30
  export declare class SqliteSettingsAddon extends BaseAddon {
33
31
  private settingsFile;
@@ -62,7 +60,7 @@ export declare class SqliteSettingsAddon extends BaseAddon {
62
60
  getBackend(): SqliteSettingsBackend | null;
63
61
  /** The placement router; null before `onInitialize`. */
64
62
  getRouter(): PlacementRouter | null;
65
- /** Exposed for tests; null before `onInitialize`. */
63
+ /** Exposed for tests; vectors are served from the events file (P5). */
66
64
  getVectorIndex(): SqliteVecVectorIndex | null;
67
65
  }
68
66
  export default SqliteSettingsAddon;
@@ -5,7 +5,7 @@ Object.defineProperties(exports, {
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
6
  const require_dist = require("../../dist-Ct88catN.js");
7
7
  const require_retired_settings_keys = require("../../retired-settings-keys-D_VwZiDt.js");
8
- const require_wal_maintenance = require("../../wal-maintenance-Bj3Z87Dx.js");
8
+ const require_wal_maintenance = require("../../wal-maintenance-mwCBe3Vr.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");
@@ -1812,11 +1812,9 @@ var DATABASE_FILE_NAMES = {
1812
1812
  * of its database that the nightly backup archives in place of the live files
1813
1813
  * (D693).
1814
1814
  *
1815
- * It ALSO serves `vector-store` (singleton, internal), from the settings file's
1816
- * open handle. That capability first shipped as its own addon and the
1817
- * separation cost two round trips per write — caller → door → engine — plus a
1818
- * runner process, to reach a database this addon already has open. The
1819
- * capability is what keeps the backend swappable; the package never was.
1815
+ * It ALSO serves `vector-store` (singleton, internal), from the **events**
1816
+ * file's worker thread (sqlite-vec loaded there). The capability is what keeps
1817
+ * the backend swappable; the package never was.
1820
1818
  */
1821
1819
  var SqliteSettingsAddon = class extends require_dist.BaseAddon {
1822
1820
  settingsFile = null;
@@ -1864,7 +1862,7 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
1864
1862
  livePath: settingsPath,
1865
1863
  thread: "main",
1866
1864
  autoVacuum: "none",
1867
- loadVectorExtension: true
1865
+ loadVectorExtension: false
1868
1866
  }, deps);
1869
1867
  if (!(settings instanceof InlineOwnedFile)) throw new Error("sqlite-settings: the settings file must be served on the main thread");
1870
1868
  this.settingsFile = settings;
@@ -1877,8 +1875,7 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
1877
1875
  logger: this.ctx.logger.child("Placement")
1878
1876
  });
1879
1877
  this.router = router;
1880
- const vectorIndex = settings.getVectorIndex();
1881
- if (vectorIndex === null) throw new Error("vector-store: the settings file has no vector index");
1878
+ const vectorProvider = require_wal_maintenance.vectorProviderOfOwnedFile(() => router.recordsFileFor("events"));
1882
1879
  const records = new RecordsProvider(router, this.ctx.logger.child("Records"));
1883
1880
  await records.init();
1884
1881
  this.startRecordsSweep(records);
@@ -1894,7 +1891,7 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
1894
1891
  },
1895
1892
  {
1896
1893
  capability: require_dist.vectorStoreCapability,
1897
- provider: require_wal_maintenance.vectorProviderOf(vectorIndex)
1894
+ provider: vectorProvider
1898
1895
  },
1899
1896
  {
1900
1897
  capability: require_dist.databaseSnapshotCapability,
@@ -1963,19 +1960,19 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
1963
1960
  getRouter() {
1964
1961
  return this.router;
1965
1962
  }
1966
- /** Exposed for tests; null before `onInitialize`. */
1963
+ /** Exposed for tests; vectors are served from the events file (P5). */
1967
1964
  getVectorIndex() {
1968
- return this.settingsFile?.getVectorIndex() ?? null;
1965
+ return null;
1969
1966
  }
1970
1967
  };
1971
- /** How a non-settings file is opened: its own worker; `events` is the one that holds vectors later. */
1968
+ /** How a non-settings file is opened: its own worker; `events` loads sqlite-vec. */
1972
1969
  function workerSpec(databaseId, livePath) {
1973
1970
  return {
1974
1971
  databaseId,
1975
1972
  livePath,
1976
1973
  thread: "worker",
1977
1974
  autoVacuum: "incremental",
1978
- loadVectorExtension: false
1975
+ loadVectorExtension: databaseId === "events"
1979
1976
  };
1980
1977
  }
1981
1978
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { $ as STORAGE_ADMIN_SCOPED_BASES, $i as parseSettingsArrayAdoptsFrom, $r as NoCallerError, Gn as recordsCapability, Hr as BaseAddon, It as dataStoreProviderCapability, Jr as DeclarationRefusedError, Lt as databaseSnapshotCapability, Q as STORAGE_ADMIN_MOVED_COLLECTIONS, S as DATA_STORE_DATABASES, Vr as errMsg, Yi as normalizeSecretOwner, _i as UnknownRecordKindError, _t as bareAddonId, b as DATABASE_SNAPSHOT_SUFFIX, dr as storageAdminCapability, ea as parseSettingsBrokersAdoptsFrom, ii as RECORD_SWEEP_INTERVAL_MS, si as RUNTIME_DEFAULTS, ui as RecordKindDeclarationSchema, wr as vectorStoreCapability, x as DATABASE_SNAPSHOT_TIMEOUT_MS, y as DATABASE_SNAPSHOT_PARTIAL_SUFFIX } from "../../dist-DV2ll9Hi.mjs";
2
2
  import { i as retiredKeyStoreOf, n as purgeRetiredSettingsKeys } from "../../retired-settings-keys-Bhwe4ymb.mjs";
3
- import { C as callControl, D as controlTargetOf, E as callVector, S as RecordsEngine, T as callRecords, _ as isFileHostMessage, a as WalMaintenance, c as SqliteSettingsBackend, d as DatabaseBusyError, f as DuplicatePlacementError, g as collectTransferables, l as CollectionPlacementError, o as createVectorIndex, p as rehydrateError, s as vectorProviderOf, u as CrossDatabaseTransactError, w as callData, x as trustResult } from "../../wal-maintenance-DTmqHKdi.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-BineOch3.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";
@@ -1806,11 +1806,9 @@ var DATABASE_FILE_NAMES = {
1806
1806
  * of its database that the nightly backup archives in place of the live files
1807
1807
  * (D693).
1808
1808
  *
1809
- * It ALSO serves `vector-store` (singleton, internal), from the settings file's
1810
- * open handle. That capability first shipped as its own addon and the
1811
- * separation cost two round trips per write — caller → door → engine — plus a
1812
- * runner process, to reach a database this addon already has open. The
1813
- * capability is what keeps the backend swappable; the package never was.
1809
+ * It ALSO serves `vector-store` (singleton, internal), from the **events**
1810
+ * file's worker thread (sqlite-vec loaded there). The capability is what keeps
1811
+ * the backend swappable; the package never was.
1814
1812
  */
1815
1813
  var SqliteSettingsAddon = class extends BaseAddon {
1816
1814
  settingsFile = null;
@@ -1858,7 +1856,7 @@ var SqliteSettingsAddon = class extends BaseAddon {
1858
1856
  livePath: settingsPath,
1859
1857
  thread: "main",
1860
1858
  autoVacuum: "none",
1861
- loadVectorExtension: true
1859
+ loadVectorExtension: false
1862
1860
  }, deps);
1863
1861
  if (!(settings instanceof InlineOwnedFile)) throw new Error("sqlite-settings: the settings file must be served on the main thread");
1864
1862
  this.settingsFile = settings;
@@ -1871,8 +1869,7 @@ var SqliteSettingsAddon = class extends BaseAddon {
1871
1869
  logger: this.ctx.logger.child("Placement")
1872
1870
  });
1873
1871
  this.router = router;
1874
- const vectorIndex = settings.getVectorIndex();
1875
- if (vectorIndex === null) throw new Error("vector-store: the settings file has no vector index");
1872
+ const vectorProvider = vectorProviderOfOwnedFile(() => router.recordsFileFor("events"));
1876
1873
  const records = new RecordsProvider(router, this.ctx.logger.child("Records"));
1877
1874
  await records.init();
1878
1875
  this.startRecordsSweep(records);
@@ -1888,7 +1885,7 @@ var SqliteSettingsAddon = class extends BaseAddon {
1888
1885
  },
1889
1886
  {
1890
1887
  capability: vectorStoreCapability,
1891
- provider: vectorProviderOf(vectorIndex)
1888
+ provider: vectorProvider
1892
1889
  },
1893
1890
  {
1894
1891
  capability: databaseSnapshotCapability,
@@ -1957,19 +1954,19 @@ var SqliteSettingsAddon = class extends BaseAddon {
1957
1954
  getRouter() {
1958
1955
  return this.router;
1959
1956
  }
1960
- /** Exposed for tests; null before `onInitialize`. */
1957
+ /** Exposed for tests; vectors are served from the events file (P5). */
1961
1958
  getVectorIndex() {
1962
- return this.settingsFile?.getVectorIndex() ?? null;
1959
+ return null;
1963
1960
  }
1964
1961
  };
1965
- /** How a non-settings file is opened: its own worker; `events` is the one that holds vectors later. */
1962
+ /** How a non-settings file is opened: its own worker; `events` loads sqlite-vec. */
1966
1963
  function workerSpec(databaseId, livePath) {
1967
1964
  return {
1968
1965
  databaseId,
1969
1966
  livePath,
1970
1967
  thread: "worker",
1971
1968
  autoVacuum: "incremental",
1972
- loadVectorExtension: false
1969
+ loadVectorExtension: databaseId === "events"
1973
1970
  };
1974
1971
  }
1975
1972
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import type { IScopedLogger, IVectorStoreProvider } from "@camstack/types";
2
+ import type { OwnedSqliteFile } from "./owned-sqlite-file.js";
2
3
  import type { SqliteSettingsBackend } from "./sqlite-settings-backend.js";
3
4
  import { SqliteVecVectorIndex } from "./vector-index-vec.js";
4
5
  /**
@@ -17,6 +18,11 @@ import { SqliteVecVectorIndex } from "./vector-index-vec.js";
17
18
  */
18
19
  export declare function createVectorIndex(backend: SqliteSettingsBackend, logger: IScopedLogger): SqliteVecVectorIndex;
19
20
  /**
21
+ * `vector-store` served from the events worker (P5): every call opens or reuses
22
+ * `events.db` with sqlite-vec loaded there, not on the settings thread.
23
+ */
24
+ export declare function vectorProviderOfOwnedFile(openEvents: () => Promise<OwnedSqliteFile>): IVectorStoreProvider;
25
+ /**
20
26
  * The `vector-store` provider surface over one sqlite-vec index. Extracted
21
27
  * from the addon so the main thread (settings) and the file-host worker
22
28
  * (events) serve the SAME mapping.
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-Bj3Z87Dx.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-mwCBe3Vr.js");
3
3
  let node_worker_threads = require("node:worker_threads");
4
4
  //#region src/builtins/sqlite-storage/file-host-worker.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { C as callControl, D as controlTargetOf, E as callVector, S as RecordsEngine, T as callRecords, a as WalMaintenance, b as trustInput, c as SqliteSettingsBackend, g as collectTransferables, m as serializeError, o as createVectorIndex, s as vectorProviderOf, v as isFileHostRequest, w as callData, y as isFileHostWorkerData } from "./wal-maintenance-DTmqHKdi.mjs";
1
+ import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, T as callData, _ as collectTransferables, a as WalMaintenance, b as isFileHostWorkerData, h as serializeError, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, w as callControl, x as trustInput, y as isFileHostRequest } from "./wal-maintenance-BineOch3.mjs";
2
2
  import { parentPort, threadId, workerData } from "node:worker_threads";
3
3
  //#region src/builtins/sqlite-storage/file-host-worker.ts
4
4
  /**
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
27
27
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
28
28
  const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
29
29
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
30
- const require_wal_maintenance = require("./wal-maintenance-Bj3Z87Dx.js");
30
+ const require_wal_maintenance = require("./wal-maintenance-mwCBe3Vr.js");
31
31
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
32
32
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
33
33
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
package/dist/index.mjs CHANGED
@@ -26,7 +26,7 @@ import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index
26
26
  import NativeMetricsAddon, { a as NativeMetricsProvider, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
27
27
  import { DeviceHistoryAddon } from "./builtins/device-history/device-history.addon.mjs";
28
28
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
29
- import { c as SqliteSettingsBackend } from "./wal-maintenance-DTmqHKdi.mjs";
29
+ import { l as SqliteSettingsBackend } from "./wal-maintenance-BineOch3.mjs";
30
30
  import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
31
31
  import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
32
32
  import { StorageOrchestratorAddon, a as stripForwardedCaller, i as createHubCapForwardService, l as STORAGE_DRAIN_STATE_LEGACY, n as HUB_CAP_FWD_ACTION, o as buildStorageLocationRegistry, r as HUB_CAP_FWD_SERVICE, t as StorageOrchestratorService, u as storageOrchestratorRecordKinds } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.448",
3
+ "version": "1.2.449",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",