@camstack/system 1.2.63 → 1.2.65
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/dist/addon-runner.js +1 -1
- package/dist/addon-runner.mjs +1 -1
- package/dist/addon-utils.js +1 -1
- package/dist/addon-utils.mjs +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +3 -3
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +10 -4
- package/dist/builtins/device-manager/device-manager.addon.mjs +10 -4
- package/dist/builtins/device-manager/device-state-mirror.d.ts +7 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +2 -2
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +2 -2
- package/dist/builtins/platform-probe/index.js +2 -2
- package/dist/builtins/platform-probe/index.mjs +2 -2
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +29 -3
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
- package/dist/builtins/sqlite-storage/vector-index-vec.d.ts +19 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{dist-LDrOFrd-.js → dist-CIkGOAcz.js} +96 -2
- package/dist/{dist-BJ2w3uoN.mjs → dist-DqPyKwVB.mjs} +96 -2
- package/dist/http/asset-compression.d.ts +93 -0
- package/dist/index.js +63 -9
- package/dist/index.mjs +63 -9
- package/dist/kernel/heap-watch.d.ts +55 -0
- package/dist/{model-download-service-D8B-4ktF.mjs → model-download-service-CTBHzORJ.mjs} +220 -2
- package/dist/{model-download-service-Cpc6SWzV.js → model-download-service-Caj1kaSi.js} +220 -2
- package/package.json +1 -1
- package/dist/{manifest-python-deps-DNfmBu20.js → manifest-python-deps-BE6l8Y4W.js} +1 -1
- package/dist/{manifest-python-deps-CopL1_5C.mjs → manifest-python-deps-Dz1ryHIN.mjs} +1 -1
package/dist/addon-runner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_manifest_python_deps = require("./manifest-python-deps-
|
|
2
|
+
const require_manifest_python_deps = require("./manifest-python-deps-BE6l8Y4W.js");
|
|
3
3
|
const require_custom_action_registry = require("./custom-action-registry-jY0NOZK8.js");
|
|
4
4
|
let node_v8 = require("node:v8");
|
|
5
5
|
node_v8 = require_chunk.__toESM(node_v8);
|
package/dist/addon-runner.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as resolveAddonClass, I as createUdsLoggerWithControl, L as LocalChildClient, at as setWorkerNativeCapsChangeListener, bt as installManifestNativeDeps, i as createUdsAddonContext, nt as getWorkerNativeCapProvider, rt as getWorkerNativeCapSnapshot, st as validateProviderRegistrations, t as installManifestPythonDeps } from "./manifest-python-deps-
|
|
1
|
+
import { Ct as resolveAddonClass, I as createUdsLoggerWithControl, L as LocalChildClient, at as setWorkerNativeCapsChangeListener, bt as installManifestNativeDeps, i as createUdsAddonContext, nt as getWorkerNativeCapProvider, rt as getWorkerNativeCapSnapshot, st as validateProviderRegistrations, t as installManifestPythonDeps } from "./manifest-python-deps-Dz1ryHIN.mjs";
|
|
2
2
|
import { t as CustomActionRegistry } from "./custom-action-registry-F__gp_VX.mjs";
|
|
3
3
|
import { register } from "node:module";
|
|
4
4
|
import * as v8 from "node:v8";
|
package/dist/addon-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./chunk-Cek0wNdY.js");
|
|
3
|
-
const require_model_download_service = require("./model-download-service-
|
|
3
|
+
const require_model_download_service = require("./model-download-service-Caj1kaSi.js");
|
|
4
4
|
const require_custom_action_registry = require("./custom-action-registry-jY0NOZK8.js");
|
|
5
5
|
exports.CustomActionRegistry = require_custom_action_registry.CustomActionRegistry;
|
|
6
6
|
exports.ModelDownloadService = require_model_download_service.ModelDownloadService;
|
package/dist/addon-utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as getModelFilePath, d as contentTypeFor, i as downloadFile, l as isModelDownloaded, n as collectModelFiles, o as ensureModel, p as parseRangeHeader, r as deleteModelFromDisk, t as ModelDownloadService, u as createFileDataPlaneHandler } from "./model-download-service-
|
|
1
|
+
import { c as getModelFilePath, d as contentTypeFor, i as downloadFile, l as isModelDownloaded, n as collectModelFiles, o as ensureModel, p as parseRangeHeader, r as deleteModelFromDisk, t as ModelDownloadService, u as createFileDataPlaneHandler } from "./model-download-service-CTBHzORJ.mjs";
|
|
2
2
|
import { t as CustomActionRegistry } from "./custom-action-registry-F__gp_VX.mjs";
|
|
3
3
|
export { CustomActionRegistry, ModelDownloadService, collectModelFiles, contentTypeFor, createFileDataPlaneHandler, deleteModelFromDisk, downloadFile, ensureModel, getModelFilePath, isModelDownloaded, parseRangeHeader };
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Lt as EventCategory, dt as BaseAddon, h as addonPagesCapability, ut as errMsg } from "../../dist-
|
|
1
|
+
import { Lt as EventCategory, dt as BaseAddon, h as addonPagesCapability, ut as errMsg } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import * as fs from "node:fs";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Lt as EventCategory, _ as addonWidgetsCapability, dt as BaseAddon, ut as errMsg } from "../../dist-
|
|
1
|
+
import { Lt as EventCategory, _ as addonWidgetsCapability, dt as BaseAddon, ut as errMsg } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import * as fs from "node:fs";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
//#region src/builtins/alerts/prune-policy.ts
|
|
8
8
|
/**
|
|
9
9
|
* Ids older than `cutoffMs`, oldest first.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Lt as EventCategory, dt as BaseAddon, n as AlertSchema, ut as errMsg, v as alertsCapability, wt as createEvent } from "../../dist-
|
|
1
|
+
import { Lt as EventCategory, dt as BaseAddon, n as AlertSchema, ut as errMsg, v as alertsCapability, wt as createEvent } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
//#region src/builtins/alerts/prune-policy.ts
|
|
3
3
|
/**
|
|
4
4
|
* Ids older than `cutoffMs`, oldest first.
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
let node_fs$1 = require_chunk.__toESM(node_fs, 1);
|
|
@@ -11,6 +11,8 @@ node_fs = require_chunk.__toESM(node_fs);
|
|
|
11
11
|
let node_path = require("node:path");
|
|
12
12
|
let node_path$1 = require_chunk.__toESM(node_path, 1);
|
|
13
13
|
node_path = require_chunk.__toESM(node_path);
|
|
14
|
+
let node_zlib = require("node:zlib");
|
|
15
|
+
node_zlib = require_chunk.__toESM(node_zlib);
|
|
14
16
|
let node_fs_promises = require("node:fs/promises");
|
|
15
17
|
let node_fs_promises$1 = require_chunk.__toESM(node_fs_promises, 1);
|
|
16
18
|
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
@@ -29,8 +31,6 @@ let assert = require("assert");
|
|
|
29
31
|
assert = require_chunk.__toESM(assert, 1);
|
|
30
32
|
let events = require("events");
|
|
31
33
|
events = require_chunk.__toESM(events, 1);
|
|
32
|
-
let node_zlib = require("node:zlib");
|
|
33
|
-
node_zlib = require_chunk.__toESM(node_zlib);
|
|
34
34
|
let node_assert = require("node:assert");
|
|
35
35
|
node_assert = require_chunk.__toESM(node_assert, 1);
|
|
36
36
|
//#region node_modules/tar/dist/esm/index.min.js
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Lt as EventCategory, b as backupCapability, dt as BaseAddon } from "../../dist-
|
|
1
|
+
import { Lt as EventCategory, b as backupCapability, dt as BaseAddon } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import Kt from "node:fs";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
6
6
|
import path, { basename, join, posix, win32 } from "node:path";
|
|
7
|
+
import * as zlib from "node:zlib";
|
|
7
8
|
import * as fsp from "node:fs/promises";
|
|
8
9
|
import jn from "node:fs/promises";
|
|
9
10
|
import { Buffer as Buffer$1 } from "buffer";
|
|
@@ -16,7 +17,6 @@ import * as Ms from "zlib";
|
|
|
16
17
|
import Jr from "zlib";
|
|
17
18
|
import Pi from "assert";
|
|
18
19
|
import $r, { EventEmitter as EventEmitter$1 } from "events";
|
|
19
|
-
import * as zlib from "node:zlib";
|
|
20
20
|
import no from "node:assert";
|
|
21
21
|
//#region node_modules/tar/dist/esm/index.min.js
|
|
22
22
|
var Mr = Object.defineProperty;
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
8
8
|
//#region src/builtins/console-logging/console-destination.ts
|
|
9
9
|
var LEVEL_RANK = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as logDestinationCapability, dt as BaseAddon } from "../../dist-
|
|
1
|
+
import { G as logDestinationCapability, dt as BaseAddon } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
3
3
|
//#region src/builtins/console-logging/console-destination.ts
|
|
4
4
|
var LEVEL_RANK = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
4
4
|
let node_crypto = require("node:crypto");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as coreBlockAddonId, T as coreBlocksCapability, dt as BaseAddon, o as CORE_BLOCK_ADDON_PREFIX, s as CoreBlockSchema, w as coreBlockIdFromAddonId } from "../../dist-
|
|
1
|
+
import { C as coreBlockAddonId, T as coreBlocksCapability, dt as BaseAddon, o as CORE_BLOCK_ADDON_PREFIX, s as CoreBlockSchema, w as coreBlockIdFromAddonId } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import * as path$1 from "node:path";
|
|
4
4
|
import * as fs from "node:fs/promises";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
let _camstack_types_node = require("@camstack/types/node");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
//#region src/builtins/device-manager/day-night-config-schema.ts
|
|
@@ -3619,6 +3619,12 @@ var DeviceStateMirror = class DeviceStateMirror {
|
|
|
3619
3619
|
* persist the new slice in-memory, emit `DeviceStateChanged` for
|
|
3620
3620
|
* this cap. No-op on identical writes (both same shape and same
|
|
3621
3621
|
* values). Called by `setCapSlice` provider.
|
|
3622
|
+
*
|
|
3623
|
+
* @returns whether the mirror actually changed. The caller uses this to
|
|
3624
|
+
* decide whether the (synchronous, disk-blocking) runtime-state write is
|
|
3625
|
+
* worth scheduling — see `scheduleRuntimeStateDiskWrite`. Returning void
|
|
3626
|
+
* here and scheduling unconditionally is what made an unchanged poll cost
|
|
3627
|
+
* a SQLite commit.
|
|
3622
3628
|
*/
|
|
3623
3629
|
applySingleCapUpdate(deviceId, capName, slice) {
|
|
3624
3630
|
let perCap = this.stateMirror.get(deviceId);
|
|
@@ -3627,9 +3633,10 @@ var DeviceStateMirror = class DeviceStateMirror {
|
|
|
3627
3633
|
this.stateMirror.set(deviceId, perCap);
|
|
3628
3634
|
}
|
|
3629
3635
|
const prior = perCap.get(capName);
|
|
3630
|
-
if (prior && shallowEqual(prior, slice)) return;
|
|
3636
|
+
if (prior && shallowEqual(prior, slice)) return false;
|
|
3631
3637
|
perCap.set(capName, { ...slice });
|
|
3632
3638
|
this.emitStateChanged(deviceId, capName, { ...slice });
|
|
3639
|
+
return true;
|
|
3633
3640
|
}
|
|
3634
3641
|
/**
|
|
3635
3642
|
* Debounced disk writer. Coalesces frequent writes (motion phase
|
|
@@ -4255,8 +4262,7 @@ var DeviceManagerAddon = class extends require_dist.BaseAddon {
|
|
|
4255
4262
|
setCapSlice: async (input) => {
|
|
4256
4263
|
const { deviceId, capName, slice } = input;
|
|
4257
4264
|
if (!await resolvePersistedById(deviceId)) throw new Error(`[device-manager] setCapSlice: unknown device id=${deviceId}`);
|
|
4258
|
-
stateMirror.applySingleCapUpdate(deviceId, capName, slice);
|
|
4259
|
-
stateMirror.scheduleRuntimeStateDiskWrite(deviceId, settings);
|
|
4265
|
+
if (stateMirror.applySingleCapUpdate(deviceId, capName, slice)) stateMirror.scheduleRuntimeStateDiskWrite(deviceId, settings);
|
|
4260
4266
|
}
|
|
4261
4267
|
}
|
|
4262
4268
|
}];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as deviceStatusCapability, It as sleep, Lt as EventCategory, N as enumerateItemArrayFields, O as deviceManagerCapability, P as enumerateSchemaFields, Q as parseStreamParamsFormPatch, S as buildStreamParamsConfigSchema, Y as normalizeUnit, _t as DeviceType, a as CAP_NAMES_WITH_STATUS, bt as WELL_KNOWN_TAB_MAP, c as DeviceStatusSchema, d as STREAM_PROFILE_META, dt as BaseAddon, gt as DeviceRole, ht as DeviceFeature, k as deviceStateCapability, kt as isDeviceConfigCap, t as ALL_CAPABILITY_DEFINITIONS, ut as errMsg } from "../../dist-
|
|
1
|
+
import { A as deviceStatusCapability, It as sleep, Lt as EventCategory, N as enumerateItemArrayFields, O as deviceManagerCapability, P as enumerateSchemaFields, Q as parseStreamParamsFormPatch, S as buildStreamParamsConfigSchema, Y as normalizeUnit, _t as DeviceType, a as CAP_NAMES_WITH_STATUS, bt as WELL_KNOWN_TAB_MAP, c as DeviceStatusSchema, d as STREAM_PROFILE_META, dt as BaseAddon, gt as DeviceRole, ht as DeviceFeature, k as deviceStateCapability, kt as isDeviceConfigCap, t as ALL_CAPABILITY_DEFINITIONS, ut as errMsg } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { canonicalDeviceFingerprint } from "@camstack/types/node";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/builtins/device-manager/day-night-config-schema.ts
|
|
@@ -3614,6 +3614,12 @@ var DeviceStateMirror = class DeviceStateMirror {
|
|
|
3614
3614
|
* persist the new slice in-memory, emit `DeviceStateChanged` for
|
|
3615
3615
|
* this cap. No-op on identical writes (both same shape and same
|
|
3616
3616
|
* values). Called by `setCapSlice` provider.
|
|
3617
|
+
*
|
|
3618
|
+
* @returns whether the mirror actually changed. The caller uses this to
|
|
3619
|
+
* decide whether the (synchronous, disk-blocking) runtime-state write is
|
|
3620
|
+
* worth scheduling — see `scheduleRuntimeStateDiskWrite`. Returning void
|
|
3621
|
+
* here and scheduling unconditionally is what made an unchanged poll cost
|
|
3622
|
+
* a SQLite commit.
|
|
3617
3623
|
*/
|
|
3618
3624
|
applySingleCapUpdate(deviceId, capName, slice) {
|
|
3619
3625
|
let perCap = this.stateMirror.get(deviceId);
|
|
@@ -3622,9 +3628,10 @@ var DeviceStateMirror = class DeviceStateMirror {
|
|
|
3622
3628
|
this.stateMirror.set(deviceId, perCap);
|
|
3623
3629
|
}
|
|
3624
3630
|
const prior = perCap.get(capName);
|
|
3625
|
-
if (prior && shallowEqual(prior, slice)) return;
|
|
3631
|
+
if (prior && shallowEqual(prior, slice)) return false;
|
|
3626
3632
|
perCap.set(capName, { ...slice });
|
|
3627
3633
|
this.emitStateChanged(deviceId, capName, { ...slice });
|
|
3634
|
+
return true;
|
|
3628
3635
|
}
|
|
3629
3636
|
/**
|
|
3630
3637
|
* Debounced disk writer. Coalesces frequent writes (motion phase
|
|
@@ -4250,8 +4257,7 @@ var DeviceManagerAddon = class extends BaseAddon {
|
|
|
4250
4257
|
setCapSlice: async (input) => {
|
|
4251
4258
|
const { deviceId, capName, slice } = input;
|
|
4252
4259
|
if (!await resolvePersistedById(deviceId)) throw new Error(`[device-manager] setCapSlice: unknown device id=${deviceId}`);
|
|
4253
|
-
stateMirror.applySingleCapUpdate(deviceId, capName, slice);
|
|
4254
|
-
stateMirror.scheduleRuntimeStateDiskWrite(deviceId, settings);
|
|
4260
|
+
if (stateMirror.applySingleCapUpdate(deviceId, capName, slice)) stateMirror.scheduleRuntimeStateDiskWrite(deviceId, settings);
|
|
4255
4261
|
}
|
|
4256
4262
|
}
|
|
4257
4263
|
}];
|
|
@@ -21,8 +21,14 @@ export declare class DeviceStateMirror {
|
|
|
21
21
|
* persist the new slice in-memory, emit `DeviceStateChanged` for
|
|
22
22
|
* this cap. No-op on identical writes (both same shape and same
|
|
23
23
|
* values). Called by `setCapSlice` provider.
|
|
24
|
+
*
|
|
25
|
+
* @returns whether the mirror actually changed. The caller uses this to
|
|
26
|
+
* decide whether the (synchronous, disk-blocking) runtime-state write is
|
|
27
|
+
* worth scheduling — see `scheduleRuntimeStateDiskWrite`. Returning void
|
|
28
|
+
* here and scheduling unconditionally is what made an unchanged poll cost
|
|
29
|
+
* a SQLite commit.
|
|
24
30
|
*/
|
|
25
|
-
applySingleCapUpdate(deviceId: number, capName: string, slice: Record<string, unknown>):
|
|
31
|
+
applySingleCapUpdate(deviceId: number, capName: string, slice: Record<string, unknown>): boolean;
|
|
26
32
|
/**
|
|
27
33
|
* Debounced disk writer. Coalesces frequent writes (motion phase
|
|
28
34
|
* transitions, battery pushes) into one `writeDeviceRuntimeState`
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
//#region src/builtins/doorbell/trigger-engine.ts
|
|
8
8
|
/**
|
|
9
9
|
* Pure trigger logic for the virtual-doorbell builtin — edge detection over
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as isSameAddonId, Lt as EventCategory, _t as DeviceType, dt as BaseAddon, j as doorbellCapability, ut as errMsg, wt as createEvent, x as bareAddonId } from "../../dist-
|
|
1
|
+
import { B as isSameAddonId, Lt as EventCategory, _t as DeviceType, dt as BaseAddon, j as doorbellCapability, ut as errMsg, wt as createEvent, x as bareAddonId } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
//#region src/builtins/doorbell/trigger-engine.ts
|
|
3
3
|
/**
|
|
4
4
|
* Pure trigger logic for the virtual-doorbell builtin — edge detection over
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
8
8
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
9
9
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as logDestinationCapability, dt as BaseAddon } from "../../dist-
|
|
1
|
+
import { G as logDestinationCapability, dt as BaseAddon } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
3
3
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
4
4
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
4
4
|
//#region src/builtins/liveness-monitor/liveness-checks.ts
|
|
5
5
|
var NO_DEVICES = "liveness:no-devices";
|
|
6
6
|
var ALL_OFFLINE = "liveness:all-devices-offline";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Lt as EventCategory, dt as BaseAddon, ut as errMsg, wt as createEvent } from "../../dist-
|
|
1
|
+
import { Lt as EventCategory, dt as BaseAddon, ut as errMsg, wt as createEvent } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
//#region src/builtins/liveness-monitor/liveness-checks.ts
|
|
3
3
|
var NO_DEVICES = "liveness:no-devices";
|
|
4
4
|
var ALL_OFFLINE = "liveness:all-devices-offline";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
node_crypto = require_chunk.__toESM(node_crypto);
|
|
9
9
|
let crypto$1 = require("crypto");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { X as oauthIntegrationCapability, dt as BaseAddon, f as ScopedTokenSchema, m as UserRecordSchema, r as ApiKeyRecordSchema, st as userManagementCapability, y as authProviderCapability } from "../../dist-
|
|
2
|
+
import { X as oauthIntegrationCapability, dt as BaseAddon, f as ScopedTokenSchema, m as UserRecordSchema, r as ApiKeyRecordSchema, st as userManagementCapability, y as authProviderCapability } from "../../dist-DqPyKwVB.mjs";
|
|
3
3
|
import * as crypto$2 from "node:crypto";
|
|
4
4
|
import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
5
5
|
import nodeCrypto from "crypto";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
4
4
|
let node_os = require("node:os");
|
|
5
5
|
node_os = require_chunk.__toESM(node_os);
|
|
6
6
|
//#region src/builtins/local-network/local-network.addon.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Lt as EventCategory, W as localNetworkCapability, dt as BaseAddon } from "../../dist-
|
|
1
|
+
import { Lt as EventCategory, W as localNetworkCapability, dt as BaseAddon } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
//#region src/builtins/local-network/local-network.addon.ts
|
|
4
4
|
/**
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
//#region src/builtins/loki-logging/loki-payload.ts
|
|
8
8
|
/**
|
|
9
9
|
* Loki rejects a label name that is not a valid Prometheus label
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as logDestinationCapability, dt as BaseAddon } from "../../dist-
|
|
1
|
+
import { G as logDestinationCapability, dt as BaseAddon } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
//#region src/builtins/loki-logging/loki-payload.ts
|
|
3
3
|
/**
|
|
4
4
|
* Loki rejects a label name that is not a valid Prometheus label
|
|
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
8
|
node_fs = require_chunk.__toESM(node_fs);
|
|
9
|
-
let node_child_process = require("node:child_process");
|
|
10
9
|
let node_util = require("node:util");
|
|
10
|
+
let node_child_process = require("node:child_process");
|
|
11
11
|
let node_os = require("node:os");
|
|
12
12
|
node_os = require_chunk.__toESM(node_os);
|
|
13
13
|
//#region src/builtins/native-metrics/native-metrics-provider.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { J as metricsProviderCapability, Lt as EventCategory, dt as BaseAddon, wt as createEvent } from "../../dist-
|
|
1
|
+
import { J as metricsProviderCapability, Lt as EventCategory, dt as BaseAddon, wt as createEvent } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
|
-
import { execFile, execFileSync } from "node:child_process";
|
|
4
3
|
import { promisify } from "node:util";
|
|
4
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
5
5
|
import * as os from "node:os";
|
|
6
6
|
//#region src/builtins/native-metrics/native-metrics-provider.ts
|
|
7
7
|
var IS_DARWIN = os.platform() === "darwin";
|
|
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
8
|
node_fs = require_chunk.__toESM(node_fs);
|
|
9
|
-
let node_child_process = require("node:child_process");
|
|
10
9
|
let node_util = require("node:util");
|
|
10
|
+
let node_child_process = require("node:child_process");
|
|
11
11
|
let node_os = require("node:os");
|
|
12
12
|
node_os = require_chunk.__toESM(node_os);
|
|
13
13
|
//#region src/builtins/platform-probe/coral-accelerators.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { o as __toESM } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { $ as platformProbeCapability, Et as emitReadiness, Lt as EventCategory, M as enumerateInferenceDevices, dt as BaseAddon, tt as scoreRuntimes, ut as errMsg } from "../../dist-
|
|
2
|
+
import { $ as platformProbeCapability, Et as emitReadiness, Lt as EventCategory, M as enumerateInferenceDevices, dt as BaseAddon, tt as scoreRuntimes, ut as errMsg } from "../../dist-DqPyKwVB.mjs";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
|
-
import { execFile } from "node:child_process";
|
|
5
4
|
import { promisify } from "node:util";
|
|
5
|
+
import { execFile } from "node:child_process";
|
|
6
6
|
import * as os from "node:os";
|
|
7
7
|
//#region src/builtins/platform-probe/coral-accelerators.ts
|
|
8
8
|
/**
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
8
8
|
/**
|
|
9
9
|
* Reconcile the durable `enabledProviders` set against authoritative
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Lt as EventCategory, dt as BaseAddon } from "../../dist-
|
|
1
|
+
import { Lt as EventCategory, dt as BaseAddon } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
3
3
|
/**
|
|
4
4
|
* Reconcile the durable `enabledProviders` set against authoritative
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
let node_child_process = require("node:child_process");
|
|
8
8
|
//#region src/builtins/snapshot/snapshot-coalescing.ts
|
|
9
9
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as nodePin, _t as DeviceType, dt as BaseAddon, ht as DeviceFeature, i as BatteryStatusSchema, ot as streamQualityLabel, rt as snapshotCapability, ut as errMsg, x as bareAddonId } from "../../dist-
|
|
1
|
+
import { At as nodePin, _t as DeviceType, dt as BaseAddon, ht as DeviceFeature, i as BatteryStatusSchema, ot as streamQualityLabel, rt as snapshotCapability, ut as errMsg, x as bareAddonId } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { execFile, spawn } from "node:child_process";
|
|
3
3
|
//#region src/builtins/snapshot/snapshot-coalescing.ts
|
|
4
4
|
/**
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as filesystemBrowseCapability, at as storageProviderCapability, dt as BaseAddon } from "../../dist-
|
|
1
|
+
import { I as filesystemBrowseCapability, at as storageProviderCapability, dt as BaseAddon } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CIkGOAcz.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
let node_module = require("node:module");
|
|
@@ -1174,6 +1174,25 @@ var PROMOTED_COLUMNS = [
|
|
|
1174
1174
|
];
|
|
1175
1175
|
//#endregion
|
|
1176
1176
|
//#region src/builtins/sqlite-storage/vector-index-vec.ts
|
|
1177
|
+
/**
|
|
1178
|
+
* The largest `k` sqlite-vec will accept in a KNN query.
|
|
1179
|
+
*
|
|
1180
|
+
* This is the EXTENSION's own compile-time limit, not a number chosen here —
|
|
1181
|
+
* measured against the real extension, which answers a larger `k` with
|
|
1182
|
+
* `SqliteError: k value in knn query too large, provided 20000 and the limit
|
|
1183
|
+
* is 4096` rather than with rows.
|
|
1184
|
+
*
|
|
1185
|
+
* It matters that this is the extension's number. The vector door looked like
|
|
1186
|
+
* a bypass of {@link SETTINGS_QUERY_HARD_ROW_CAP}: `vector-store.cap.ts`
|
|
1187
|
+
* declares `topK: z.number().int().positive()` with no `.max()`, and it is
|
|
1188
|
+
* bound straight into `k = ?` on the same connection, in the same process, as
|
|
1189
|
+
* the capped `data-store-provider.query`. It is not a bypass — sqlite-vec was
|
|
1190
|
+
* holding the line the whole time, which caps a KNN's heap cost at 4 096 rows
|
|
1191
|
+
* of metadata. What was actually broken is that it held the line by THROWING,
|
|
1192
|
+
* so an over-large `topK` reached the caller as a raw SQLite error instead of
|
|
1193
|
+
* as the bounded answer it could always have been served.
|
|
1194
|
+
*/
|
|
1195
|
+
var VEC_KNN_MAX_K = 4096;
|
|
1177
1196
|
var tableFor = (index) => `vec_${index.replace(/[^a-zA-Z0-9_]/g, "_")}`;
|
|
1178
1197
|
var registryTable = "vec_indexes";
|
|
1179
1198
|
/** `vec0` speaks packed Float32; the capability speaks base64 of the same. */
|
|
@@ -1314,10 +1333,17 @@ var SqliteVecVectorIndex = class {
|
|
|
1314
1333
|
if (require_dist.decodeVectorBase64(params.vector).length !== spec.dim) throw new Error(`vector-store: query vector has ${require_dist.decodeVectorBase64(params.vector).length} dims, index "${params.index}" has ${spec.dim}`);
|
|
1315
1334
|
const { clauses, values, unpushable } = compileFilter(params.filter);
|
|
1316
1335
|
const where = clauses.length > 0 ? ` AND ${clauses.join(" AND ")}` : "";
|
|
1336
|
+
const k = Math.min(Math.max(Math.floor(params.topK), 1), VEC_KNN_MAX_K);
|
|
1337
|
+
if (k !== params.topK) this.logger.warn("sqlite-vec: topK clamped to the extension ceiling", { meta: {
|
|
1338
|
+
index: params.index,
|
|
1339
|
+
requested: params.topK,
|
|
1340
|
+
k,
|
|
1341
|
+
ceiling: VEC_KNN_MAX_K
|
|
1342
|
+
} });
|
|
1317
1343
|
const rows = this.db.prepare(`SELECT id, distance, deviceId, timestamp, className, modelId, extra
|
|
1318
1344
|
FROM ${tableFor(params.index)}
|
|
1319
1345
|
WHERE embedding MATCH ? AND k = ?${where}
|
|
1320
|
-
ORDER BY distance`).all(toBlob(params.vector), BigInt(
|
|
1346
|
+
ORDER BY distance`).all(toBlob(params.vector), BigInt(k), ...values);
|
|
1321
1347
|
const minScore = params.minScore ?? Number.NEGATIVE_INFINITY;
|
|
1322
1348
|
const matches = [];
|
|
1323
1349
|
for (const raw of rows) {
|
|
@@ -1339,7 +1365,7 @@ var SqliteVecVectorIndex = class {
|
|
|
1339
1365
|
return {
|
|
1340
1366
|
matches,
|
|
1341
1367
|
scanned: rows.length,
|
|
1342
|
-
truncated:
|
|
1368
|
+
truncated: k < params.topK && rows.length >= k
|
|
1343
1369
|
};
|
|
1344
1370
|
}
|
|
1345
1371
|
async getByIds(index, ids) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as decodeVectorBase64, E as dataStoreProviderCapability, Mt as parseJsonUnknown, ct as vectorDimFromBase64, dt as BaseAddon, lt as vectorStoreCapability, u as RUNTIME_DEFAULTS, ut as errMsg, x as bareAddonId, xt as asJsonObject } from "../../dist-
|
|
1
|
+
import { D as decodeVectorBase64, E as dataStoreProviderCapability, Mt as parseJsonUnknown, ct as vectorDimFromBase64, dt as BaseAddon, lt as vectorStoreCapability, u as RUNTIME_DEFAULTS, ut as errMsg, x as bareAddonId, xt as asJsonObject } from "../../dist-DqPyKwVB.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { statSync } from "node:fs";
|
|
@@ -1168,6 +1168,25 @@ var PROMOTED_COLUMNS = [
|
|
|
1168
1168
|
];
|
|
1169
1169
|
//#endregion
|
|
1170
1170
|
//#region src/builtins/sqlite-storage/vector-index-vec.ts
|
|
1171
|
+
/**
|
|
1172
|
+
* The largest `k` sqlite-vec will accept in a KNN query.
|
|
1173
|
+
*
|
|
1174
|
+
* This is the EXTENSION's own compile-time limit, not a number chosen here —
|
|
1175
|
+
* measured against the real extension, which answers a larger `k` with
|
|
1176
|
+
* `SqliteError: k value in knn query too large, provided 20000 and the limit
|
|
1177
|
+
* is 4096` rather than with rows.
|
|
1178
|
+
*
|
|
1179
|
+
* It matters that this is the extension's number. The vector door looked like
|
|
1180
|
+
* a bypass of {@link SETTINGS_QUERY_HARD_ROW_CAP}: `vector-store.cap.ts`
|
|
1181
|
+
* declares `topK: z.number().int().positive()` with no `.max()`, and it is
|
|
1182
|
+
* bound straight into `k = ?` on the same connection, in the same process, as
|
|
1183
|
+
* the capped `data-store-provider.query`. It is not a bypass — sqlite-vec was
|
|
1184
|
+
* holding the line the whole time, which caps a KNN's heap cost at 4 096 rows
|
|
1185
|
+
* of metadata. What was actually broken is that it held the line by THROWING,
|
|
1186
|
+
* so an over-large `topK` reached the caller as a raw SQLite error instead of
|
|
1187
|
+
* as the bounded answer it could always have been served.
|
|
1188
|
+
*/
|
|
1189
|
+
var VEC_KNN_MAX_K = 4096;
|
|
1171
1190
|
var tableFor = (index) => `vec_${index.replace(/[^a-zA-Z0-9_]/g, "_")}`;
|
|
1172
1191
|
var registryTable = "vec_indexes";
|
|
1173
1192
|
/** `vec0` speaks packed Float32; the capability speaks base64 of the same. */
|
|
@@ -1308,10 +1327,17 @@ var SqliteVecVectorIndex = class {
|
|
|
1308
1327
|
if (decodeVectorBase64(params.vector).length !== spec.dim) throw new Error(`vector-store: query vector has ${decodeVectorBase64(params.vector).length} dims, index "${params.index}" has ${spec.dim}`);
|
|
1309
1328
|
const { clauses, values, unpushable } = compileFilter(params.filter);
|
|
1310
1329
|
const where = clauses.length > 0 ? ` AND ${clauses.join(" AND ")}` : "";
|
|
1330
|
+
const k = Math.min(Math.max(Math.floor(params.topK), 1), VEC_KNN_MAX_K);
|
|
1331
|
+
if (k !== params.topK) this.logger.warn("sqlite-vec: topK clamped to the extension ceiling", { meta: {
|
|
1332
|
+
index: params.index,
|
|
1333
|
+
requested: params.topK,
|
|
1334
|
+
k,
|
|
1335
|
+
ceiling: VEC_KNN_MAX_K
|
|
1336
|
+
} });
|
|
1311
1337
|
const rows = this.db.prepare(`SELECT id, distance, deviceId, timestamp, className, modelId, extra
|
|
1312
1338
|
FROM ${tableFor(params.index)}
|
|
1313
1339
|
WHERE embedding MATCH ? AND k = ?${where}
|
|
1314
|
-
ORDER BY distance`).all(toBlob(params.vector), BigInt(
|
|
1340
|
+
ORDER BY distance`).all(toBlob(params.vector), BigInt(k), ...values);
|
|
1315
1341
|
const minScore = params.minScore ?? Number.NEGATIVE_INFINITY;
|
|
1316
1342
|
const matches = [];
|
|
1317
1343
|
for (const raw of rows) {
|
|
@@ -1333,7 +1359,7 @@ var SqliteVecVectorIndex = class {
|
|
|
1333
1359
|
return {
|
|
1334
1360
|
matches,
|
|
1335
1361
|
scanned: rows.length,
|
|
1336
|
-
truncated:
|
|
1362
|
+
truncated: k < params.topK && rows.length >= k
|
|
1337
1363
|
};
|
|
1338
1364
|
}
|
|
1339
1365
|
async getByIds(index, ids) {
|