@camstack/types 1.2.354 → 1.2.356
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.d.ts +7 -1
- package/dist/addon.js +1685 -1
- package/dist/addon.mjs +1679 -2
- package/dist/{composition-Bzr7GwgP.mjs → composition-C-WpVYTX.mjs} +22 -0
- package/dist/{composition-BLWAivB2.js → composition-DCYnv4I6.js} +22 -0
- package/dist/deps/archive-extract.d.ts +11 -0
- package/dist/deps/binary-downloader.d.ts +9 -0
- package/dist/deps/python-downloader.d.ts +4 -0
- package/dist/deps/zip-extract.d.ts +1 -0
- package/dist/generated/addon-api.d.ts +22 -0
- package/dist/generated/addon-cap-facts.d.ts +20 -0
- package/dist/index.js +17 -164
- package/dist/index.mjs +4 -151
- package/dist/node.d.ts +2 -0
- package/dist/node.js +334 -56
- package/dist/node.mjs +330 -58
- package/dist/{sleep-SgkKj2bk.js → sleep-BFVY4_xY.js} +198 -0
- package/dist/{sleep-Tkp9dHXv.mjs → sleep-vWTnHq9G.mjs} +157 -1
- package/dist/types/model-formats.d.ts +9 -0
- package/dist/types/models.d.ts +4 -2
- package/dist/util/owner-only-file.d.ts +28 -0
- package/package.json +1 -1
|
@@ -3821,6 +3821,23 @@ function emitDownForOwnedCaps(registry, owned) {
|
|
|
3821
3821
|
for (const { capName, scope } of owned) registry.emitDown(capName, scope);
|
|
3822
3822
|
}
|
|
3823
3823
|
//#endregion
|
|
3824
|
+
//#region src/types/model-formats.ts
|
|
3825
|
+
/**
|
|
3826
|
+
* The model weight formats a catalog entry can ship. Schema-free on purpose:
|
|
3827
|
+
* `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
|
|
3828
|
+
* (the model downloader in `@camstack/system`) needs only the list and must
|
|
3829
|
+
* reach it through `@camstack/types/addon` without building the cap schema
|
|
3830
|
+
* graph (D28).
|
|
3831
|
+
*/
|
|
3832
|
+
var MODEL_FORMATS = [
|
|
3833
|
+
"onnx",
|
|
3834
|
+
"coreml",
|
|
3835
|
+
"openvino",
|
|
3836
|
+
"tflite",
|
|
3837
|
+
"pt",
|
|
3838
|
+
"gguf"
|
|
3839
|
+
];
|
|
3840
|
+
//#endregion
|
|
3824
3841
|
//#region src/cap-call-context.ts
|
|
3825
3842
|
/**
|
|
3826
3843
|
* Per-call node pinning for `ctx.api` capability calls.
|
|
@@ -4337,6 +4354,65 @@ var deviceOpsCapability = {
|
|
|
4337
4354
|
}
|
|
4338
4355
|
};
|
|
4339
4356
|
//#endregion
|
|
4357
|
+
//#region src/constants.ts
|
|
4358
|
+
var HF_REPO = "camstack/camstack-models";
|
|
4359
|
+
var HF_BASE_URL = `https://huggingface.co/${HF_REPO}/resolve/main`;
|
|
4360
|
+
/**
|
|
4361
|
+
* The ONE default session-JWT lifetime.
|
|
4362
|
+
*
|
|
4363
|
+
* There used to be three, and they disagreed: the `system-config` schema said
|
|
4364
|
+
* `30d`, `RUNTIME_DEFAULTS['auth.tokenExpiry']` said `7d`, and
|
|
4365
|
+
* `AuthManager.signToken` hardcoded `30d` as its own fallback. Because the
|
|
4366
|
+
* production signer (`AuthService extends AuthManager`, wired to
|
|
4367
|
+
* `ConfigManager`) resolves through `RUNTIME_DEFAULTS` BEFORE it can ever
|
|
4368
|
+
* reach the hardcoded fallback, the value actually in force was `7d` while
|
|
4369
|
+
* every surface an operator could read advertised `30d`.
|
|
4370
|
+
*
|
|
4371
|
+
* `30d` is the value the product documents and the one an operator decided on
|
|
4372
|
+
* (2026-07-17: the viewer's silent refresh rotates tokens long before expiry,
|
|
4373
|
+
* so a long lifetime only covers devices left unopened for weeks). It is
|
|
4374
|
+
* declared here once and imported by the schema, by the runtime defaults and
|
|
4375
|
+
* by the signer's fallback — a second default that disagrees with the first is
|
|
4376
|
+
* the same defect in miniature.
|
|
4377
|
+
*/
|
|
4378
|
+
var DEFAULT_TOKEN_EXPIRY = "30d";
|
|
4379
|
+
/**
|
|
4380
|
+
* Runtime defaults -- used by ConfigManager.get() for backward compatibility
|
|
4381
|
+
* until Plan B wires all runtime settings to the system_settings SQL table.
|
|
4382
|
+
*
|
|
4383
|
+
* Moved from @camstack/system/config-schema to @camstack/types so that
|
|
4384
|
+
* @camstack/system can reference it without a cross-package kernel import.
|
|
4385
|
+
*/
|
|
4386
|
+
var RUNTIME_DEFAULTS = {
|
|
4387
|
+
"features.streaming": true,
|
|
4388
|
+
"features.notifications": true,
|
|
4389
|
+
"features.objectDetection": false,
|
|
4390
|
+
"features.remoteAccess": true,
|
|
4391
|
+
"features.agentCluster": false,
|
|
4392
|
+
"features.smartHome": true,
|
|
4393
|
+
"features.recordings": true,
|
|
4394
|
+
"features.backup": true,
|
|
4395
|
+
"features.repl": true,
|
|
4396
|
+
"retention.detectionEventsDays": 30,
|
|
4397
|
+
"retention.audioLevelsDays": 7,
|
|
4398
|
+
"logging.level": "info",
|
|
4399
|
+
"logging.retentionDays": 30,
|
|
4400
|
+
"eventBus.ringBufferSize": 1e4,
|
|
4401
|
+
"storage.provider": "sqlite-storage",
|
|
4402
|
+
"storage.locations": {
|
|
4403
|
+
data: "camstack-data/data",
|
|
4404
|
+
media: "camstack-data/media",
|
|
4405
|
+
recordings: "camstack-data/recordings",
|
|
4406
|
+
cache: "/tmp/camstack-cache",
|
|
4407
|
+
logs: "camstack-data/logs",
|
|
4408
|
+
models: "camstack-data/models"
|
|
4409
|
+
},
|
|
4410
|
+
providers: [],
|
|
4411
|
+
"ffmpeg.hwAccel": "auto",
|
|
4412
|
+
"ffmpeg.threadCount": 0,
|
|
4413
|
+
"auth.tokenExpiry": "30d"
|
|
4414
|
+
};
|
|
4415
|
+
//#endregion
|
|
4340
4416
|
//#region src/device/zod-secret.ts
|
|
4341
4417
|
/**
|
|
4342
4418
|
* Secret declaration on a Zod config schema (D783).
|
|
@@ -5728,6 +5804,11 @@ var BOOT_RECOVERY_BACKOFF_MS = [
|
|
|
5728
5804
|
90 * 6e4
|
|
5729
5805
|
];
|
|
5730
5806
|
//#endregion
|
|
5807
|
+
//#region src/utils/hf-url.ts
|
|
5808
|
+
function hfModelUrl(repo, path) {
|
|
5809
|
+
return `https://huggingface.co/${repo}/resolve/main/${path}`;
|
|
5810
|
+
}
|
|
5811
|
+
//#endregion
|
|
5731
5812
|
//#region src/utils/json-safe.ts
|
|
5732
5813
|
/**
|
|
5733
5814
|
* Type-safe JSON parsing helpers.
|
|
@@ -5788,6 +5869,81 @@ function parseJsonArray(text) {
|
|
|
5788
5869
|
}
|
|
5789
5870
|
}
|
|
5790
5871
|
//#endregion
|
|
5872
|
+
//#region src/utils/mask-url.ts
|
|
5873
|
+
/**
|
|
5874
|
+
* Names that, when used as URL query parameters, almost certainly carry
|
|
5875
|
+
* a secret. Matching is case-insensitive and anchored to the full param
|
|
5876
|
+
* name to avoid false positives like `user_id` (an entity reference, not
|
|
5877
|
+
* a credential) or `topic=password-reset` (a value happens to contain
|
|
5878
|
+
* the substring "password" but the param name is unrelated).
|
|
5879
|
+
*
|
|
5880
|
+
* Add new patterns here as we encounter cameras/APIs that leak through
|
|
5881
|
+
* the existing list.
|
|
5882
|
+
*/
|
|
5883
|
+
var CREDENTIAL_PARAM_PATTERNS = [
|
|
5884
|
+
/^user$/i,
|
|
5885
|
+
/^usr$/i,
|
|
5886
|
+
/^username$/i,
|
|
5887
|
+
/^password$/i,
|
|
5888
|
+
/^pwd$/i,
|
|
5889
|
+
/^pass$/i,
|
|
5890
|
+
/^passwd$/i,
|
|
5891
|
+
/^secret$/i,
|
|
5892
|
+
/^token$/i,
|
|
5893
|
+
/^auth$/i,
|
|
5894
|
+
/^auth[_-]?token$/i,
|
|
5895
|
+
/^bearer$/i,
|
|
5896
|
+
/^api[_-]?key$/i,
|
|
5897
|
+
/^access[_-]?token$/i,
|
|
5898
|
+
/^refresh[_-]?token$/i,
|
|
5899
|
+
/^bridge$/i,
|
|
5900
|
+
/^code$/i,
|
|
5901
|
+
/^state$/i,
|
|
5902
|
+
/^challenge$/i,
|
|
5903
|
+
/^link$/i
|
|
5904
|
+
];
|
|
5905
|
+
function isCredentialParam(name) {
|
|
5906
|
+
return CREDENTIAL_PARAM_PATTERNS.some((re) => re.test(name));
|
|
5907
|
+
}
|
|
5908
|
+
/**
|
|
5909
|
+
* Redact secrets we may surface in logs or telemetry:
|
|
5910
|
+
* 1. `userinfo` (`user:password@host`) — the classic RTSP shape.
|
|
5911
|
+
* 2. Query-string credential params (`?user=...&password=...`) — the
|
|
5912
|
+
* Reolink RTMP shape and several HTTP-pushed-stream APIs.
|
|
5913
|
+
*
|
|
5914
|
+
* Returns the original string verbatim when the input is not a parseable
|
|
5915
|
+
* URL — a log helper must never throw. Param values are replaced with
|
|
5916
|
+
* `***` so an operator reading logs still sees WHICH credential was
|
|
5917
|
+
* present (useful for debugging "wrong password" issues) without
|
|
5918
|
+
* exposing the value.
|
|
5919
|
+
*
|
|
5920
|
+
* The credential-name match is case-insensitive but anchored to the
|
|
5921
|
+
* whole param name; values like `user_id=42` or `topic=password-reset`
|
|
5922
|
+
* are NOT masked (those are entity references, not credentials).
|
|
5923
|
+
*/
|
|
5924
|
+
function maskUrlCredentials(rawUrl) {
|
|
5925
|
+
if (rawUrl.startsWith("/") && !rawUrl.startsWith("//")) {
|
|
5926
|
+
const masked = maskUrlCredentials(`http://relative.invalid${rawUrl}`);
|
|
5927
|
+
return masked.startsWith("http://relative.invalid") ? masked.slice(23) : rawUrl;
|
|
5928
|
+
}
|
|
5929
|
+
try {
|
|
5930
|
+
const u = new URL(rawUrl);
|
|
5931
|
+
let touched = false;
|
|
5932
|
+
if (u.username || u.password) {
|
|
5933
|
+
u.username = "";
|
|
5934
|
+
u.password = "";
|
|
5935
|
+
touched = true;
|
|
5936
|
+
}
|
|
5937
|
+
for (const key of Array.from(u.searchParams.keys())) if (isCredentialParam(key)) {
|
|
5938
|
+
u.searchParams.set(key, "***");
|
|
5939
|
+
touched = true;
|
|
5940
|
+
}
|
|
5941
|
+
return touched ? u.toString() : rawUrl;
|
|
5942
|
+
} catch {
|
|
5943
|
+
return rawUrl;
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
//#endregion
|
|
5791
5947
|
//#region src/utils/sleep.ts
|
|
5792
5948
|
/**
|
|
5793
5949
|
* Promise-based timer helpers — used everywhere the codebase needs to
|
|
@@ -5931,6 +6087,12 @@ Object.defineProperty(exports, "DEFAULT_RUNTIME_STATE_DURABILITY", {
|
|
|
5931
6087
|
return DEFAULT_RUNTIME_STATE_DURABILITY;
|
|
5932
6088
|
}
|
|
5933
6089
|
});
|
|
6090
|
+
Object.defineProperty(exports, "DEFAULT_TOKEN_EXPIRY", {
|
|
6091
|
+
enumerable: true,
|
|
6092
|
+
get: function() {
|
|
6093
|
+
return DEFAULT_TOKEN_EXPIRY;
|
|
6094
|
+
}
|
|
6095
|
+
});
|
|
5934
6096
|
Object.defineProperty(exports, "DEVICE_CHILDREN_BATCH_MAX", {
|
|
5935
6097
|
enumerable: true,
|
|
5936
6098
|
get: function() {
|
|
@@ -5973,6 +6135,18 @@ Object.defineProperty(exports, "FrameHandleSchema", {
|
|
|
5973
6135
|
return FrameHandleSchema;
|
|
5974
6136
|
}
|
|
5975
6137
|
});
|
|
6138
|
+
Object.defineProperty(exports, "HF_BASE_URL", {
|
|
6139
|
+
enumerable: true,
|
|
6140
|
+
get: function() {
|
|
6141
|
+
return HF_BASE_URL;
|
|
6142
|
+
}
|
|
6143
|
+
});
|
|
6144
|
+
Object.defineProperty(exports, "HF_REPO", {
|
|
6145
|
+
enumerable: true,
|
|
6146
|
+
get: function() {
|
|
6147
|
+
return HF_REPO;
|
|
6148
|
+
}
|
|
6149
|
+
});
|
|
5976
6150
|
Object.defineProperty(exports, "KeychainWriteRefusedError", {
|
|
5977
6151
|
enumerable: true,
|
|
5978
6152
|
get: function() {
|
|
@@ -5985,6 +6159,12 @@ Object.defineProperty(exports, "MIN_SCRUBBED_LENGTH", {
|
|
|
5985
6159
|
return MIN_SCRUBBED_LENGTH;
|
|
5986
6160
|
}
|
|
5987
6161
|
});
|
|
6162
|
+
Object.defineProperty(exports, "MODEL_FORMATS", {
|
|
6163
|
+
enumerable: true,
|
|
6164
|
+
get: function() {
|
|
6165
|
+
return MODEL_FORMATS;
|
|
6166
|
+
}
|
|
6167
|
+
});
|
|
5988
6168
|
Object.defineProperty(exports, "PEER_BYTES_CHUNK_BYTES", {
|
|
5989
6169
|
enumerable: true,
|
|
5990
6170
|
get: function() {
|
|
@@ -6051,6 +6231,12 @@ Object.defineProperty(exports, "REVALIDATE_AFTER_MS", {
|
|
|
6051
6231
|
return REVALIDATE_AFTER_MS;
|
|
6052
6232
|
}
|
|
6053
6233
|
});
|
|
6234
|
+
Object.defineProperty(exports, "RUNTIME_DEFAULTS", {
|
|
6235
|
+
enumerable: true,
|
|
6236
|
+
get: function() {
|
|
6237
|
+
return RUNTIME_DEFAULTS;
|
|
6238
|
+
}
|
|
6239
|
+
});
|
|
6054
6240
|
Object.defineProperty(exports, "RawStateResultSchema", {
|
|
6055
6241
|
enumerable: true,
|
|
6056
6242
|
get: function() {
|
|
@@ -6357,6 +6543,12 @@ Object.defineProperty(exports, "globalSecretScope", {
|
|
|
6357
6543
|
return globalSecretScope;
|
|
6358
6544
|
}
|
|
6359
6545
|
});
|
|
6546
|
+
Object.defineProperty(exports, "hfModelUrl", {
|
|
6547
|
+
enumerable: true,
|
|
6548
|
+
get: function() {
|
|
6549
|
+
return hfModelUrl;
|
|
6550
|
+
}
|
|
6551
|
+
});
|
|
6360
6552
|
Object.defineProperty(exports, "hydrateSchema", {
|
|
6361
6553
|
enumerable: true,
|
|
6362
6554
|
get: function() {
|
|
@@ -6459,6 +6651,12 @@ Object.defineProperty(exports, "makeSourceBrokerId", {
|
|
|
6459
6651
|
return makeSourceBrokerId;
|
|
6460
6652
|
}
|
|
6461
6653
|
});
|
|
6654
|
+
Object.defineProperty(exports, "maskUrlCredentials", {
|
|
6655
|
+
enumerable: true,
|
|
6656
|
+
get: function() {
|
|
6657
|
+
return maskUrlCredentials;
|
|
6658
|
+
}
|
|
6659
|
+
});
|
|
6462
6660
|
Object.defineProperty(exports, "mergeSecretStatePaths", {
|
|
6463
6661
|
enumerable: true,
|
|
6464
6662
|
get: function() {
|
|
@@ -3821,6 +3821,23 @@ function emitDownForOwnedCaps(registry, owned) {
|
|
|
3821
3821
|
for (const { capName, scope } of owned) registry.emitDown(capName, scope);
|
|
3822
3822
|
}
|
|
3823
3823
|
//#endregion
|
|
3824
|
+
//#region src/types/model-formats.ts
|
|
3825
|
+
/**
|
|
3826
|
+
* The model weight formats a catalog entry can ship. Schema-free on purpose:
|
|
3827
|
+
* `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
|
|
3828
|
+
* (the model downloader in `@camstack/system`) needs only the list and must
|
|
3829
|
+
* reach it through `@camstack/types/addon` without building the cap schema
|
|
3830
|
+
* graph (D28).
|
|
3831
|
+
*/
|
|
3832
|
+
var MODEL_FORMATS = [
|
|
3833
|
+
"onnx",
|
|
3834
|
+
"coreml",
|
|
3835
|
+
"openvino",
|
|
3836
|
+
"tflite",
|
|
3837
|
+
"pt",
|
|
3838
|
+
"gguf"
|
|
3839
|
+
];
|
|
3840
|
+
//#endregion
|
|
3824
3841
|
//#region src/cap-call-context.ts
|
|
3825
3842
|
/**
|
|
3826
3843
|
* Per-call node pinning for `ctx.api` capability calls.
|
|
@@ -4337,6 +4354,65 @@ var deviceOpsCapability = {
|
|
|
4337
4354
|
}
|
|
4338
4355
|
};
|
|
4339
4356
|
//#endregion
|
|
4357
|
+
//#region src/constants.ts
|
|
4358
|
+
var HF_REPO = "camstack/camstack-models";
|
|
4359
|
+
var HF_BASE_URL = `https://huggingface.co/${HF_REPO}/resolve/main`;
|
|
4360
|
+
/**
|
|
4361
|
+
* The ONE default session-JWT lifetime.
|
|
4362
|
+
*
|
|
4363
|
+
* There used to be three, and they disagreed: the `system-config` schema said
|
|
4364
|
+
* `30d`, `RUNTIME_DEFAULTS['auth.tokenExpiry']` said `7d`, and
|
|
4365
|
+
* `AuthManager.signToken` hardcoded `30d` as its own fallback. Because the
|
|
4366
|
+
* production signer (`AuthService extends AuthManager`, wired to
|
|
4367
|
+
* `ConfigManager`) resolves through `RUNTIME_DEFAULTS` BEFORE it can ever
|
|
4368
|
+
* reach the hardcoded fallback, the value actually in force was `7d` while
|
|
4369
|
+
* every surface an operator could read advertised `30d`.
|
|
4370
|
+
*
|
|
4371
|
+
* `30d` is the value the product documents and the one an operator decided on
|
|
4372
|
+
* (2026-07-17: the viewer's silent refresh rotates tokens long before expiry,
|
|
4373
|
+
* so a long lifetime only covers devices left unopened for weeks). It is
|
|
4374
|
+
* declared here once and imported by the schema, by the runtime defaults and
|
|
4375
|
+
* by the signer's fallback — a second default that disagrees with the first is
|
|
4376
|
+
* the same defect in miniature.
|
|
4377
|
+
*/
|
|
4378
|
+
var DEFAULT_TOKEN_EXPIRY = "30d";
|
|
4379
|
+
/**
|
|
4380
|
+
* Runtime defaults -- used by ConfigManager.get() for backward compatibility
|
|
4381
|
+
* until Plan B wires all runtime settings to the system_settings SQL table.
|
|
4382
|
+
*
|
|
4383
|
+
* Moved from @camstack/system/config-schema to @camstack/types so that
|
|
4384
|
+
* @camstack/system can reference it without a cross-package kernel import.
|
|
4385
|
+
*/
|
|
4386
|
+
var RUNTIME_DEFAULTS = {
|
|
4387
|
+
"features.streaming": true,
|
|
4388
|
+
"features.notifications": true,
|
|
4389
|
+
"features.objectDetection": false,
|
|
4390
|
+
"features.remoteAccess": true,
|
|
4391
|
+
"features.agentCluster": false,
|
|
4392
|
+
"features.smartHome": true,
|
|
4393
|
+
"features.recordings": true,
|
|
4394
|
+
"features.backup": true,
|
|
4395
|
+
"features.repl": true,
|
|
4396
|
+
"retention.detectionEventsDays": 30,
|
|
4397
|
+
"retention.audioLevelsDays": 7,
|
|
4398
|
+
"logging.level": "info",
|
|
4399
|
+
"logging.retentionDays": 30,
|
|
4400
|
+
"eventBus.ringBufferSize": 1e4,
|
|
4401
|
+
"storage.provider": "sqlite-storage",
|
|
4402
|
+
"storage.locations": {
|
|
4403
|
+
data: "camstack-data/data",
|
|
4404
|
+
media: "camstack-data/media",
|
|
4405
|
+
recordings: "camstack-data/recordings",
|
|
4406
|
+
cache: "/tmp/camstack-cache",
|
|
4407
|
+
logs: "camstack-data/logs",
|
|
4408
|
+
models: "camstack-data/models"
|
|
4409
|
+
},
|
|
4410
|
+
providers: [],
|
|
4411
|
+
"ffmpeg.hwAccel": "auto",
|
|
4412
|
+
"ffmpeg.threadCount": 0,
|
|
4413
|
+
"auth.tokenExpiry": "30d"
|
|
4414
|
+
};
|
|
4415
|
+
//#endregion
|
|
4340
4416
|
//#region src/device/zod-secret.ts
|
|
4341
4417
|
/**
|
|
4342
4418
|
* Secret declaration on a Zod config schema (D783).
|
|
@@ -5728,6 +5804,11 @@ var BOOT_RECOVERY_BACKOFF_MS = [
|
|
|
5728
5804
|
90 * 6e4
|
|
5729
5805
|
];
|
|
5730
5806
|
//#endregion
|
|
5807
|
+
//#region src/utils/hf-url.ts
|
|
5808
|
+
function hfModelUrl(repo, path) {
|
|
5809
|
+
return `https://huggingface.co/${repo}/resolve/main/${path}`;
|
|
5810
|
+
}
|
|
5811
|
+
//#endregion
|
|
5731
5812
|
//#region src/utils/json-safe.ts
|
|
5732
5813
|
/**
|
|
5733
5814
|
* Type-safe JSON parsing helpers.
|
|
@@ -5788,6 +5869,81 @@ function parseJsonArray(text) {
|
|
|
5788
5869
|
}
|
|
5789
5870
|
}
|
|
5790
5871
|
//#endregion
|
|
5872
|
+
//#region src/utils/mask-url.ts
|
|
5873
|
+
/**
|
|
5874
|
+
* Names that, when used as URL query parameters, almost certainly carry
|
|
5875
|
+
* a secret. Matching is case-insensitive and anchored to the full param
|
|
5876
|
+
* name to avoid false positives like `user_id` (an entity reference, not
|
|
5877
|
+
* a credential) or `topic=password-reset` (a value happens to contain
|
|
5878
|
+
* the substring "password" but the param name is unrelated).
|
|
5879
|
+
*
|
|
5880
|
+
* Add new patterns here as we encounter cameras/APIs that leak through
|
|
5881
|
+
* the existing list.
|
|
5882
|
+
*/
|
|
5883
|
+
var CREDENTIAL_PARAM_PATTERNS = [
|
|
5884
|
+
/^user$/i,
|
|
5885
|
+
/^usr$/i,
|
|
5886
|
+
/^username$/i,
|
|
5887
|
+
/^password$/i,
|
|
5888
|
+
/^pwd$/i,
|
|
5889
|
+
/^pass$/i,
|
|
5890
|
+
/^passwd$/i,
|
|
5891
|
+
/^secret$/i,
|
|
5892
|
+
/^token$/i,
|
|
5893
|
+
/^auth$/i,
|
|
5894
|
+
/^auth[_-]?token$/i,
|
|
5895
|
+
/^bearer$/i,
|
|
5896
|
+
/^api[_-]?key$/i,
|
|
5897
|
+
/^access[_-]?token$/i,
|
|
5898
|
+
/^refresh[_-]?token$/i,
|
|
5899
|
+
/^bridge$/i,
|
|
5900
|
+
/^code$/i,
|
|
5901
|
+
/^state$/i,
|
|
5902
|
+
/^challenge$/i,
|
|
5903
|
+
/^link$/i
|
|
5904
|
+
];
|
|
5905
|
+
function isCredentialParam(name) {
|
|
5906
|
+
return CREDENTIAL_PARAM_PATTERNS.some((re) => re.test(name));
|
|
5907
|
+
}
|
|
5908
|
+
/**
|
|
5909
|
+
* Redact secrets we may surface in logs or telemetry:
|
|
5910
|
+
* 1. `userinfo` (`user:password@host`) — the classic RTSP shape.
|
|
5911
|
+
* 2. Query-string credential params (`?user=...&password=...`) — the
|
|
5912
|
+
* Reolink RTMP shape and several HTTP-pushed-stream APIs.
|
|
5913
|
+
*
|
|
5914
|
+
* Returns the original string verbatim when the input is not a parseable
|
|
5915
|
+
* URL — a log helper must never throw. Param values are replaced with
|
|
5916
|
+
* `***` so an operator reading logs still sees WHICH credential was
|
|
5917
|
+
* present (useful for debugging "wrong password" issues) without
|
|
5918
|
+
* exposing the value.
|
|
5919
|
+
*
|
|
5920
|
+
* The credential-name match is case-insensitive but anchored to the
|
|
5921
|
+
* whole param name; values like `user_id=42` or `topic=password-reset`
|
|
5922
|
+
* are NOT masked (those are entity references, not credentials).
|
|
5923
|
+
*/
|
|
5924
|
+
function maskUrlCredentials(rawUrl) {
|
|
5925
|
+
if (rawUrl.startsWith("/") && !rawUrl.startsWith("//")) {
|
|
5926
|
+
const masked = maskUrlCredentials(`http://relative.invalid${rawUrl}`);
|
|
5927
|
+
return masked.startsWith("http://relative.invalid") ? masked.slice(23) : rawUrl;
|
|
5928
|
+
}
|
|
5929
|
+
try {
|
|
5930
|
+
const u = new URL(rawUrl);
|
|
5931
|
+
let touched = false;
|
|
5932
|
+
if (u.username || u.password) {
|
|
5933
|
+
u.username = "";
|
|
5934
|
+
u.password = "";
|
|
5935
|
+
touched = true;
|
|
5936
|
+
}
|
|
5937
|
+
for (const key of Array.from(u.searchParams.keys())) if (isCredentialParam(key)) {
|
|
5938
|
+
u.searchParams.set(key, "***");
|
|
5939
|
+
touched = true;
|
|
5940
|
+
}
|
|
5941
|
+
return touched ? u.toString() : rawUrl;
|
|
5942
|
+
} catch {
|
|
5943
|
+
return rawUrl;
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
//#endregion
|
|
5791
5947
|
//#region src/utils/sleep.ts
|
|
5792
5948
|
/**
|
|
5793
5949
|
* Promise-based timer helpers — used everywhere the codebase needs to
|
|
@@ -5841,4 +5997,4 @@ function sleepCancellable(ms, signal) {
|
|
|
5841
5997
|
});
|
|
5842
5998
|
}
|
|
5843
5999
|
//#endregion
|
|
5844
|
-
export {
|
|
6000
|
+
export { ReadinessRegistry as $, transformSecretWrite as $t, viewerUiCapability as A, isKeychainStoredField as An, clearKnownSecrets as At, PROVIDER_PIN_FIELD as B, PeerBytesTicketSchema as Bt, isZodSecret as C, isSecretMarker as Cn, makeSourceBrokerId as Ct, RUNTIME_DEFAULTS as D, REDACTED_SECRET as Dn, REVALIDATE_AFTER_MS as Dt, HF_REPO as E, toSecretFieldView as En, resolveSecretViewsIn as Et, deviceCustomAction as F, expandAudioChunkToF32le as Fn, shortSecretRefHash as Ft, optionalMethod as G, normalizeAddonInitResult as Gt, expandCapMethods as H, SHARE_VIEW_KINDS as Ht, adminUiCapability as I, isAudioChunkFormat as In, PEER_BYTES_CHUNK_BYTES as It, CAP_NODE_PIN_CONTEXT_KEY as J, secretTreeFromPaths as Jt, resolveCapMount as K, mergeSecretStatePaths as Kt, DEFAULT_RUNTIME_STATE_DURABILITY as L, PEER_BYTES_MAX_OUTSTANDING as Lt, customAction as M, schemaDeclaresAnyField as Mn, knownSecretCount as Mt, defineCustomActions as N, AUDIO_CHUNK_FORMATS as Nn, registerKnownSecret as Nt, RawStateResultSchema as O, collectKeychainStoredKeys as On, createSecretsAccess as Ot, describeCustomActions as P, audioChunkBytesPerSample as Pn, scrubKnownSecrets as Pt, MODEL_FORMATS as Q, resolveSecretMarkers as Qt, DEVICE_SETTINGS_CONTRIBUTION_METHODS as R, PEER_BYTES_STALL_MS as Rt, collectZodSecretPaths as S, isSecretFieldView as Sn, makeProfileBrokerId as St, HF_BASE_URL as T, makeSecretMarker as Tn, selectAssignedProfileSlots as Tt, isDeviceConfigCap as U, DisposerChain as Ut, event as V, DATAPLANE_SECRET_HEADER as Vt, method as W, BaseAddon as Wt, readNodePin as X, KeychainWriteRefusedError as Xt, nodePin as Y, secretTreeFromSchema as Yt, toNodeId as Z, collectSecretMarkerRefs as Zt, createEventBusSliceSource as _, hydrateSchema as _n, ProfileSlotStatusSchema as _t, asJsonArray as a, isSecretRef as an, AudioStreamPickSchema as at, createSliceHandle as b, classifySecretWrite as bn, SubscribeAudioChunksInputSchema as bt, asString as c, normalizeNodeId as cn, CAM_PROFILE_ORDER as ct, parseJsonUnknown as d, emitReadiness as dn, CamStreamResolutionSchema as dt, SECRET_REF_SCHEME as en, ReadinessTimeoutError as et, hfModelUrl as f, isEvent as fn, CameraStreamSchema as ft, createDeviceProxy as g, collectHydratedFieldValues as gn, ProfileSlotSchema as gt, isDeviceScopedCap as h, collectHydratedFieldEntries as hn, ProfileRtspEntrySchema as ht, asBoolean as i, globalSecretScope as in, AudioChunkFormatSchema as it, DEVICE_CHILDREN_BATCH_MAX as j, isSecretConfigField as jn, forgetKnownSecret as jt, deviceOpsCapability as k, collectSecretConfigKeys as kn, MIN_SCRUBBED_LENGTH as kt, parseJsonArray as l, createDurableState as ln, CamProfileSchema as lt, DEVICE_SCOPED_CAPS as m, WELL_KNOWN_TAB_MAP as mn, FrameHandleSchema as mt, sleepCancellable as n, buildSecretRef as nn, readinessKey as nt, asJsonObject as o, normalizeSecretOwner as on, BrokerStatsSchema as ot, BOOT_RECOVERY_BACKOFF_MS as p, WELL_KNOWN_TABS as pn, DecodedAudioChunkSchema as pt, systemMethod as q, parseSecretStatePath as qt, maskUrlCredentials as r, formatSecretScope as rn, scopeKey as rt, asNumber as s, parseSecretRef as sn, BrokerStatusSchema as st, sleep as t, arrayItemFieldPath as tn, emitDownForOwnedCaps as tt, parseJsonObject as u, createEvent as un, CamStreamKindSchema as ut, createLazyTrpcSource as v, resolveHydratedFieldValue as vn, StreamSourceEntrySchema$1 as vt, DEFAULT_TOKEN_EXPIRY as w, isSecretMarkerLike as wn, parseProfileBrokerId as wt, SECRET_META as x, isSecretClear as xn, SubscribeAudioChunksResultSchema as xt, createMirrorSource as y, SECRET_CLEAR as yn, StreamSourceSchema as yt, DEVICE_STATUS_METHOD as z, PEER_BYTES_TICKET_TTL_MS as zt };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model weight formats a catalog entry can ship. Schema-free on purpose:
|
|
3
|
+
* `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
|
|
4
|
+
* (the model downloader in `@camstack/system`) needs only the list and must
|
|
5
|
+
* reach it through `@camstack/types/addon` without building the cap schema
|
|
6
|
+
* graph (D28).
|
|
7
|
+
*/
|
|
8
|
+
export declare const MODEL_FORMATS: readonly ['onnx', 'coreml', 'openvino', 'tflite', 'pt', 'gguf'];
|
|
9
|
+
export type ModelFormat = (typeof MODEL_FORMATS)[number];
|
package/dist/types/models.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { ClassMapDefinition, LabelDefinition } from './labels.js';
|
|
3
3
|
import type { PostprocessorType } from './pipeline-step.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { MODEL_FORMATS } from './model-formats.js';
|
|
5
|
+
import type { ModelFormat } from './model-formats.js';
|
|
6
|
+
export { MODEL_FORMATS };
|
|
7
|
+
export type { ModelFormat };
|
|
6
8
|
export type ModelOutputFormat = 'yolo' | 'ssd' | 'embedding' | 'classification' | 'ocr' | 'segmentation';
|
|
7
9
|
/**
|
|
8
10
|
* Multi-file format payload.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare class OwnerOnlyError extends Error {
|
|
2
|
+
readonly target: string;
|
|
3
|
+
constructor(target: string, detail: string);
|
|
4
|
+
}
|
|
5
|
+
/** Everything the Windows branch touches, injectable so a Mac can test it. */
|
|
6
|
+
export interface OwnerOnlyDeps {
|
|
7
|
+
readonly platform: NodeJS.Platform;
|
|
8
|
+
readonly exec: (file: string, args: readonly string[]) => void;
|
|
9
|
+
/** `DOMAIN\\user` or `user` — the principal that keeps access. */
|
|
10
|
+
readonly principal: () => string;
|
|
11
|
+
readonly systemRoot: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
/** The icacls argv for one path: no inheritance, owner + SYSTEM only. */
|
|
14
|
+
export declare function icaclsArgs(target: string, principal: string, isDirectory: boolean): readonly string[];
|
|
15
|
+
/** Restrict an existing file to its owner (chmod 0600 / owner+SYSTEM ACL). */
|
|
16
|
+
export declare function restrictFileToOwnerSync(target: string, overrides?: Partial<OwnerOnlyDeps>): void;
|
|
17
|
+
/** Restrict an existing directory to its owner (chmod 0700 / owner+SYSTEM, inherited). */
|
|
18
|
+
export declare function restrictDirToOwnerSync(target: string, overrides?: Partial<OwnerOnlyDeps>): void;
|
|
19
|
+
/** Create `dir` (and parents) readable by its owner only. */
|
|
20
|
+
export declare function mkdirOwnerOnlySync(dir: string, overrides?: Partial<OwnerOnlyDeps>): void;
|
|
21
|
+
/**
|
|
22
|
+
* Atomically write a secret-bearing file that only its owner can read.
|
|
23
|
+
*
|
|
24
|
+
* Order matters: the temp file is created EMPTY, restricted, and only then
|
|
25
|
+
* given its content, so there is no moment at which the secret exists under a
|
|
26
|
+
* permissive ACL. The rename carries the (already restricted) ACL with it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function writeOwnerOnlyFileSync(target: string, data: string | Uint8Array, overrides?: Partial<OwnerOnlyDeps>): void;
|