@camstack/types 1.2.355 → 1.2.357

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.
@@ -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.
@@ -5916,4 +5997,4 @@ function sleepCancellable(ms, signal) {
5916
5997
  });
5917
5998
  }
5918
5999
  //#endregion
5919
- export { AudioStreamPickSchema as $, isSecretRef as $t, deviceCustomAction as A, isAudioChunkFormat as An, PEER_BYTES_CHUNK_BYTES as At, optionalMethod as B, mergeSecretStatePaths as Bt, RawStateResultSchema as C, collectSecretConfigKeys as Cn, MIN_SCRUBBED_LENGTH as Ct, customAction as D, AUDIO_CHUNK_FORMATS as Dn, registerKnownSecret as Dt, DEVICE_CHILDREN_BATCH_MAX as E, schemaDeclaresAnyField as En, knownSecretCount as Et, PROVIDER_PIN_FIELD as F, DATAPLANE_SECRET_HEADER as Ft, readNodePin as G, collectSecretMarkerRefs as Gt, systemMethod as H, secretTreeFromPaths as Ht, event as I, SHARE_VIEW_KINDS as It, ReadinessTimeoutError as J, SECRET_REF_SCHEME as Jt, toNodeId as K, resolveSecretMarkers as Kt, expandCapMethods as L, DisposerChain as Lt, DEFAULT_RUNTIME_STATE_DURABILITY as M, PEER_BYTES_STALL_MS as Mt, DEVICE_SETTINGS_CONTRIBUTION_METHODS as N, PEER_BYTES_TICKET_TTL_MS as Nt, defineCustomActions as O, audioChunkBytesPerSample as On, scrubKnownSecrets as Ot, DEVICE_STATUS_METHOD as P, PeerBytesTicketSchema as Pt, AudioChunkFormatSchema as Q, globalSecretScope as Qt, isDeviceConfigCap as R, BaseAddon as Rt, isZodSecret as S, collectKeychainStoredKeys as Sn, createSecretsAccess as St, viewerUiCapability as T, isSecretConfigField as Tn, forgetKnownSecret as Tt, CAP_NODE_PIN_CONTEXT_KEY as U, secretTreeFromSchema as Ut, resolveCapMount as V, parseSecretStatePath as Vt, nodePin as W, KeychainWriteRefusedError as Wt, readinessKey as X, buildSecretRef as Xt, emitDownForOwnedCaps as Y, arrayItemFieldPath as Yt, scopeKey as Z, formatSecretScope as Zt, createLazyTrpcSource as _, isSecretMarker as _n, makeSourceBrokerId as _t, asJsonArray as a, emitReadiness as an, CamStreamResolutionSchema as at, SECRET_META as b, toSecretFieldView as bn, resolveSecretViewsIn as bt, asString as c, WELL_KNOWN_TAB_MAP as cn, FrameHandleSchema as ct, parseJsonUnknown as d, hydrateSchema as dn, ProfileSlotStatusSchema as dt, normalizeSecretOwner as en, BrokerStatsSchema as et, BOOT_RECOVERY_BACKOFF_MS as f, resolveHydratedFieldValue as fn, StreamSourceEntrySchema$1 as ft, createEventBusSliceSource as g, isSecretFieldView as gn, makeProfileBrokerId as gt, createDeviceProxy as h, isSecretClear as hn, SubscribeAudioChunksResultSchema as ht, asBoolean as i, createEvent as in, CamStreamKindSchema as it, adminUiCapability as j, PEER_BYTES_MAX_OUTSTANDING as jt, describeCustomActions as k, expandAudioChunkToF32le as kn, shortSecretRefHash as kt, parseJsonArray as l, collectHydratedFieldEntries as ln, ProfileRtspEntrySchema as lt, isDeviceScopedCap as m, classifySecretWrite as mn, SubscribeAudioChunksInputSchema as mt, sleepCancellable as n, normalizeNodeId as nn, CAM_PROFILE_ORDER as nt, asJsonObject as o, isEvent as on, CameraStreamSchema as ot, DEVICE_SCOPED_CAPS as p, SECRET_CLEAR as pn, StreamSourceSchema as pt, ReadinessRegistry as q, transformSecretWrite as qt, maskUrlCredentials as r, createDurableState as rn, CamProfileSchema as rt, asNumber as s, WELL_KNOWN_TABS as sn, DecodedAudioChunkSchema as st, sleep as t, parseSecretRef as tn, BrokerStatusSchema as tt, parseJsonObject as u, collectHydratedFieldValues as un, ProfileSlotSchema as ut, createMirrorSource as v, isSecretMarkerLike as vn, parseProfileBrokerId as vt, deviceOpsCapability as w, isKeychainStoredField as wn, clearKnownSecrets as wt, collectZodSecretPaths as x, REDACTED_SECRET as xn, REVALIDATE_AFTER_MS as xt, createSliceHandle as y, makeSecretMarker as yn, selectAssignedProfileSlots as yt, method as z, normalizeAddonInitResult as zt };
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];
@@ -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
- export declare const MODEL_FORMATS: readonly ['onnx', 'coreml', 'openvino', 'tflite', 'pt', 'gguf'];
5
- export type ModelFormat = (typeof MODEL_FORMATS)[number];
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.355",
3
+ "version": "1.2.357",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",