@camstack/types 1.2.75 → 1.2.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/addon.d.ts +19 -18
  2. package/dist/addon.js +59 -56
  3. package/dist/addon.mjs +59 -57
  4. package/dist/capabilities/alerts.cap.d.ts +5 -5
  5. package/dist/capabilities/battery.cap.d.ts +8 -4
  6. package/dist/capabilities/custom-model-registry.cap.d.ts +4 -4
  7. package/dist/capabilities/decoder.cap.d.ts +2 -2
  8. package/dist/capabilities/face-gallery.cap.d.ts +1 -1
  9. package/dist/capabilities/index.d.ts +3 -3
  10. package/dist/capabilities/lawn-mower-control.cap.d.ts +4 -4
  11. package/dist/capabilities/llm-runtime.cap.d.ts +121 -3
  12. package/dist/capabilities/llm.cap.d.ts +189 -4
  13. package/dist/capabilities/metrics-provider.cap.d.ts +2 -2
  14. package/dist/capabilities/model-convert.cap.d.ts +6 -6
  15. package/dist/capabilities/model-distributor.cap.d.ts +4 -4
  16. package/dist/capabilities/notification-output.cap.d.ts +9 -9
  17. package/dist/capabilities/notification-rules.cap.d.ts +11 -11
  18. package/dist/capabilities/oauth-integration.cap.d.ts +2 -2
  19. package/dist/capabilities/osd-manager.cap.d.ts +6 -6
  20. package/dist/capabilities/pipeline-analytics.cap.d.ts +39 -39
  21. package/dist/capabilities/pipeline-executor.cap.d.ts +7 -7
  22. package/dist/capabilities/pipeline-orchestrator.cap.d.ts +6 -6
  23. package/dist/capabilities/pipeline-runner.cap.d.ts +2 -0
  24. package/dist/capabilities/platform-probe.cap.d.ts +2 -2
  25. package/dist/capabilities/recording.cap.d.ts +3 -3
  26. package/dist/capabilities/sso-bridge.cap.d.ts +3 -3
  27. package/dist/capabilities/stream-broker.cap.d.ts +6 -6
  28. package/dist/capabilities/stream-catalog.cap.d.ts +93 -0
  29. package/dist/capabilities/user-management.cap.d.ts +20 -20
  30. package/dist/device/base-device-provider.d.ts +9 -0
  31. package/dist/device/battery-presence.d.ts +84 -0
  32. package/dist/encode-profile.d.ts +2 -2
  33. package/dist/generated/addon-api.d.ts +15 -8
  34. package/dist/generated/device-local-state.d.ts +3 -0
  35. package/dist/generated/device-proxy.d.ts +1 -0
  36. package/dist/generated/method-access-map.d.ts +1 -1
  37. package/dist/generated/runtime-state-durability.d.ts +1 -1
  38. package/dist/generated/system-proxy.d.ts +1 -1
  39. package/dist/index.d.ts +3 -0
  40. package/dist/index.js +309 -9
  41. package/dist/index.mjs +303 -10
  42. package/dist/interfaces/recording-config.d.ts +2 -2
  43. package/dist/interfaces/stream-broker.d.ts +9 -1
  44. package/dist/{sleep-B-mRsuDp.js → sleep-CoL-9qhR.js} +43 -0
  45. package/dist/{sleep-CQayd2Su.mjs → sleep-DlC2kJYf.mjs} +38 -1
  46. package/dist/types/models.d.ts +7 -7
  47. package/dist/util/boot-recovery-backoff.d.ts +26 -0
  48. package/package.json +1 -1
@@ -0,0 +1,84 @@
1
+ /**
2
+ * "Asleep" and "gone" are two different facts, and a battery camera reports
3
+ * neither by itself.
4
+ *
5
+ * A mains camera answers "are you there?" because something may ask it. A
6
+ * battery camera may not be asked: the question IS the damage — a Baichuan
7
+ * login on a sleeping Argus is itself a wake event, so a reachability poll
8
+ * that proves a camera is alive is the same poll that flattens it (D173).
9
+ *
10
+ * That leaves exactly one honest way to tell a healthy sleeper from a dead
11
+ * battery: **wait, and notice**. Every signal that reaches us WITHOUT us
12
+ * reaching for the camera — a firmware push, an inbound motion email, an
13
+ * observed wake, a round-trip somebody else's demand already paid for — stamps
14
+ * `BatteryStatus.lastContactAt`. Silence past a threshold is then a positive
15
+ * observation rather than an absence of one.
16
+ *
17
+ * ## Why this is a function and not a stored field
18
+ *
19
+ * The stored fact is the CONTACT. The verdict is a reading of it against a
20
+ * clock and a threshold, so storing the verdict would create a second
21
+ * authority that goes stale the moment nobody rewrites it — the exact shape
22
+ * D62 forbids for per-camera switches, for the same reason: two knobs that can
23
+ * disagree are worse than one. Every surface (badge, camera status, snapshot
24
+ * courtesy frame, stream error) calls this, so they cannot disagree.
25
+ *
26
+ * ## The failure direction
27
+ *
28
+ * Toward `sleeping`. `unreachable` is a FAULT — it lights a badge and it is
29
+ * meant to be believed — so it is only ever returned when we have positively
30
+ * seen silence for longer than the threshold. A slice we have never written
31
+ * (`lastContactAt` absent or 0) answers `sleeping`, never `unreachable`: a
32
+ * freshly-adopted camera, or one whose slice was lost, has told us nothing,
33
+ * and "we know nothing" must never be painted as "it is broken". That is D62's
34
+ * rule — disabled must never look like broken — applied to the third state.
35
+ */
36
+ import type { BatteryStatus } from '../capabilities/battery.cap.js';
37
+ /**
38
+ * What a battery-operated device is doing, as far as PASSIVE evidence can say.
39
+ *
40
+ * - `awake` — the firmware is up right now. Reads are cheap, streams dial.
41
+ * - `sleeping` — low-power, and that is NORMAL. Not a fault, never a fault
42
+ * badge; a stream can still be had by asking for a wake.
43
+ * - `unreachable` — nothing passive has arrived for longer than the
44
+ * threshold. Flat battery, off the LAN, unpaired. This IS a fault and the
45
+ * surface must say so.
46
+ */
47
+ export type BatteryPresence = 'awake' | 'sleeping' | 'unreachable';
48
+ /**
49
+ * Default silence budget before a sleeping battery camera is called gone.
50
+ *
51
+ * Sized off the mechanism that produces contact, not off taste: a battery cam
52
+ * on this deployment surfaces a firmware push (battery level, sleep/wake, or a
53
+ * motion email) on the order of hours even with no visitors, and the snapshot
54
+ * wrapper's own battery window is 1 hour. Six hours is therefore several
55
+ * missed opportunities, not one — so a single quiet night does not raise a
56
+ * fault, and a genuinely flat camera is named well inside a day.
57
+ */
58
+ export declare const BATTERY_UNREACHABLE_AFTER_MS: number;
59
+ export interface BatteryPresenceInput {
60
+ /** The device's `battery` runtime-state slice, or `undefined` when it has none. */
61
+ readonly status: Pick<BatteryStatus, 'sleeping' | 'lastContactAt'> | undefined | null;
62
+ /** Clock. Pass explicitly from callers that already hold one. */
63
+ readonly nowMs: number;
64
+ /** Silence budget. Defaults to {@link BATTERY_UNREACHABLE_AFTER_MS}. */
65
+ readonly unreachableAfterMs?: number;
66
+ }
67
+ /**
68
+ * THE derivation. One crop rectangle, one presence verdict — see D52 for why
69
+ * this repo insists a derived value has exactly one implementation.
70
+ *
71
+ * `undefined` status ⇒ `sleeping`. A device with no slice has made no claim,
72
+ * and the caller decides separately whether it is even battery-operated
73
+ * (`DeviceFeature.BatteryOperated`); this function never answers that
74
+ * question, only what a battery device is doing.
75
+ */
76
+ export declare function deriveBatteryPresence(input: BatteryPresenceInput): BatteryPresence;
77
+ /**
78
+ * Is this presence a FAULT the operator should be told about?
79
+ *
80
+ * Exists so no surface has to re-decide it — the whole point of the third
81
+ * state is that `sleeping` stops being rendered as breakage, and a caller that
82
+ * writes `presence !== 'awake'` has silently undone that.
83
+ */
84
+ export declare function isBatteryPresenceFault(presence: BatteryPresence): boolean;
@@ -30,11 +30,11 @@ export declare const VideoEncodeSchema: z.ZodObject<{
30
30
  gopFrames: z.ZodOptional<z.ZodNumber>;
31
31
  bf: z.ZodOptional<z.ZodNumber>;
32
32
  preset: z.ZodOptional<z.ZodEnum<{
33
- fast: "fast";
34
33
  ultrafast: "ultrafast";
35
34
  superfast: "superfast";
36
35
  veryfast: "veryfast";
37
36
  faster: "faster";
37
+ fast: "fast";
38
38
  medium: "medium";
39
39
  }>>;
40
40
  tune: z.ZodOptional<z.ZodEnum<{
@@ -77,11 +77,11 @@ export declare const EncodeProfileSchema: z.ZodObject<{
77
77
  gopFrames: z.ZodOptional<z.ZodNumber>;
78
78
  bf: z.ZodOptional<z.ZodNumber>;
79
79
  preset: z.ZodOptional<z.ZodEnum<{
80
- fast: "fast";
81
80
  ultrafast: "ultrafast";
82
81
  superfast: "superfast";
83
82
  veryfast: "veryfast";
84
83
  faster: "faster";
84
+ fast: "fast";
85
85
  medium: "medium";
86
86
  }>>;
87
87
  tune: z.ZodOptional<z.ZodEnum<{
@@ -3445,6 +3445,13 @@ export type AppRouter = TrpcCoreRouter<{
3445
3445
  output: z.infer<typeof llmCapability.methods.listNodeModels.output>;
3446
3446
  meta: object;
3447
3447
  }>;
3448
+ resolveModelRef: TRPCMutationProcedure<{
3449
+ input: {
3450
+ [x: string]: unknown;
3451
+ } & z.input<typeof llmCapability.methods.resolveModelRef.input>;
3452
+ output: z.infer<typeof llmCapability.methods.resolveModelRef.output>;
3453
+ meta: object;
3454
+ }>;
3448
3455
  installModel: TRPCMutationProcedure<{
3449
3456
  input: {
3450
3457
  [x: string]: unknown;
@@ -8801,14 +8808,14 @@ export type AppRouter = TrpcCoreRouter<{
8801
8808
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
8802
8809
  listCapabilities: import("@trpc/server").TRPCQueryProcedure<{
8803
8810
  input: void;
8804
- output: import("packages/types/dist").CapabilityInfo[];
8811
+ output: import("@camstack/types").CapabilityInfo[];
8805
8812
  meta: object;
8806
8813
  }>;
8807
8814
  getCapability: import("@trpc/server").TRPCQueryProcedure<{
8808
8815
  input: {
8809
8816
  name: string;
8810
8817
  };
8811
- output: import("packages/types/dist").CapabilityInfo | null;
8818
+ output: import("@camstack/types").CapabilityInfo | null;
8812
8819
  meta: object;
8813
8820
  }>;
8814
8821
  setActiveSingleton: import("@trpc/server").TRPCMutationProcedure<{
@@ -8880,14 +8887,14 @@ export type AppRouter = TrpcCoreRouter<{
8880
8887
  }>> & import("@trpc/server").TRPCDecorateCreateRouterOptions<{
8881
8888
  listCapabilities: import("@trpc/server").TRPCQueryProcedure<{
8882
8889
  input: void;
8883
- output: import("packages/types/dist").CapabilityInfo[];
8890
+ output: import("@camstack/types").CapabilityInfo[];
8884
8891
  meta: object;
8885
8892
  }>;
8886
8893
  getCapability: import("@trpc/server").TRPCQueryProcedure<{
8887
8894
  input: {
8888
8895
  name: string;
8889
8896
  };
8890
- output: import("packages/types/dist").CapabilityInfo | null;
8897
+ output: import("@camstack/types").CapabilityInfo | null;
8891
8898
  meta: object;
8892
8899
  }>;
8893
8900
  setActiveSingleton: import("@trpc/server").TRPCMutationProcedure<{
@@ -9124,14 +9131,14 @@ export type AppRouter = TrpcCoreRouter<{
9124
9131
  category?: string | undefined;
9125
9132
  limit?: number | undefined;
9126
9133
  } | undefined;
9127
- output: readonly import("packages/types/dist").SystemEvent[];
9134
+ output: readonly import("@camstack/types").SystemEvent[];
9128
9135
  meta: object;
9129
9136
  }>;
9130
9137
  onEvent: import("@trpc/server").TRPCSubscriptionProcedure<{
9131
9138
  input: {
9132
9139
  category?: string | undefined;
9133
9140
  };
9134
- output: AsyncIterable<import("packages/types/dist").SystemEvent, any, any>;
9141
+ output: AsyncIterable<import("@camstack/types").SystemEvent, any, any>;
9135
9142
  meta: object;
9136
9143
  }>;
9137
9144
  onDeviceEvent: import("@trpc/server").TRPCSubscriptionProcedure<{
@@ -9147,14 +9154,14 @@ export type AppRouter = TrpcCoreRouter<{
9147
9154
  category?: string | undefined;
9148
9155
  limit?: number | undefined;
9149
9156
  } | undefined;
9150
- output: readonly import("packages/types/dist").SystemEvent[];
9157
+ output: readonly import("@camstack/types").SystemEvent[];
9151
9158
  meta: object;
9152
9159
  }>;
9153
9160
  onEvent: import("@trpc/server").TRPCSubscriptionProcedure<{
9154
9161
  input: {
9155
9162
  category?: string | undefined;
9156
9163
  };
9157
- output: AsyncIterable<import("packages/types/dist").SystemEvent, any, any>;
9164
+ output: AsyncIterable<import("@camstack/types").SystemEvent, any, any>;
9158
9165
  meta: object;
9159
9166
  }>;
9160
9167
  onDeviceEvent: import("@trpc/server").TRPCSubscriptionProcedure<{
@@ -49,6 +49,7 @@ import { ptzAutotrackCapability } from '../capabilities/ptz-autotrack.cap.js';
49
49
  import { sceneMonitorCapability } from '../capabilities/scene-monitor.cap.js';
50
50
  import { scriptRunnerCapability } from '../capabilities/script-runner.cap.js';
51
51
  import { smokeCapability } from '../capabilities/smoke.cap.js';
52
+ import { streamCatalogCapability } from '../capabilities/stream-catalog.cap.js';
52
53
  import { streamParamsCapability } from '../capabilities/stream-params.cap.js';
53
54
  import { switchCapability } from '../capabilities/switch.cap.js';
54
55
  import { tamperCapability } from '../capabilities/tamper.cap.js';
@@ -124,6 +125,7 @@ export interface DeviceLocalState {
124
125
  sceneMonitor: InferRuntimeState<typeof sceneMonitorCapability>;
125
126
  scriptRunner: InferRuntimeState<typeof scriptRunnerCapability>;
126
127
  smoke: InferRuntimeState<typeof smokeCapability>;
128
+ streamCatalog: InferRuntimeState<typeof streamCatalogCapability>;
127
129
  streamParams: InferRuntimeState<typeof streamParamsCapability>;
128
130
  switch: InferRuntimeState<typeof switchCapability>;
129
131
  tamper: InferRuntimeState<typeof tamperCapability>;
@@ -209,6 +211,7 @@ export interface CapNameToRuntimeStateMap {
209
211
  'scene-monitor': InferRuntimeState<typeof sceneMonitorCapability>;
210
212
  'script-runner': InferRuntimeState<typeof scriptRunnerCapability>;
211
213
  'smoke': InferRuntimeState<typeof smokeCapability>;
214
+ 'stream-catalog': InferRuntimeState<typeof streamCatalogCapability>;
212
215
  'stream-params': InferRuntimeState<typeof streamParamsCapability>;
213
216
  'switch': InferRuntimeState<typeof switchCapability>;
214
217
  'tamper': InferRuntimeState<typeof tamperCapability>;
@@ -154,6 +154,7 @@ export interface DeviceProxyState {
154
154
  readonly sceneMonitor: SliceHandle<InferRuntimeState<typeof sceneMonitorCapability>>;
155
155
  readonly scriptRunner: SliceHandle<InferRuntimeState<typeof scriptRunnerCapability>>;
156
156
  readonly smoke: SliceHandle<InferRuntimeState<typeof smokeCapability>>;
157
+ readonly streamCatalog: SliceHandle<InferRuntimeState<typeof streamCatalogCapability>>;
157
158
  readonly streamParams: SliceHandle<InferRuntimeState<typeof streamParamsCapability>>;
158
159
  readonly switch: SliceHandle<InferRuntimeState<typeof switchCapability>>;
159
160
  readonly tamper: SliceHandle<InferRuntimeState<typeof tamperCapability>>;
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 938 method paths across 123 capabilities.
9
+ * Coverage: 939 method paths across 123 capabilities.
10
10
  */
11
11
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
12
12
  export interface MethodAccessRecord {
@@ -11,7 +11,7 @@ export interface RuntimeStatePolicy {
11
11
  }
12
12
  /**
13
13
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
14
- * `runtimeState`. 63 caps: 33 `restored`, 30 `session`.
14
+ * `runtimeState`. 64 caps: 34 `restored`, 30 `session`.
15
15
  *
16
16
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
17
17
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -73,7 +73,7 @@ export interface SystemProxy {
73
73
  readonly deviceState: Pick<InferProvider<typeof deviceStateCapability>, 'getAllSnapshots'>;
74
74
  readonly faceGallery: Pick<InferProvider<typeof faceGalleryCapability>, 'listIdentities' | 'createIdentity' | 'renameIdentity' | 'deleteIdentity' | 'listIdentitySamples' | 'removeSample' | 'getFaceMedia' | 'assignFace' | 'unassignFace' | 'deleteFace' | 'assignFaces' | 'unassignFaces' | 'suggestFaceClusters'>;
75
75
  readonly integrations: Pick<InferProvider<typeof integrationsCapability>, 'list' | 'get' | 'getByAddonId' | 'create' | 'update' | 'delete' | 'getSettings' | 'setSettings' | 'getAvailableTypes' | 'testConnection'>;
76
- readonly llm: Pick<InferProvider<typeof llmCapability>, 'generate' | 'generateVision' | 'cancel' | 'listProfileKinds' | 'listProfiles' | 'upsertProfile' | 'deleteProfile' | 'testProfile' | 'listModels' | 'getDefaults' | 'setDefault' | 'getUsage' | 'listModelCatalog' | 'listRuntimeNodes' | 'listNodeModels' | 'installModel' | 'deleteModel' | 'getRuntimeStatus' | 'startRuntime' | 'stopRuntime'>;
76
+ readonly llm: Pick<InferProvider<typeof llmCapability>, 'generate' | 'generateVision' | 'cancel' | 'listProfileKinds' | 'listProfiles' | 'upsertProfile' | 'deleteProfile' | 'testProfile' | 'listModels' | 'getDefaults' | 'setDefault' | 'getUsage' | 'listModelCatalog' | 'listRuntimeNodes' | 'listNodeModels' | 'resolveModelRef' | 'installModel' | 'deleteModel' | 'getRuntimeStatus' | 'startRuntime' | 'stopRuntime'>;
77
77
  readonly localNetwork: Pick<InferProvider<typeof localNetworkCapability>, 'list' | 'getPreferred' | 'getConnectionEndpoints' | 'getNotificationEndpoint' | 'setNotificationEndpoint' | 'getAllowedAddresses' | 'setAllowedAddresses' | 'resetAllowlistToBestMatch'>;
78
78
  readonly meshNetwork: Pick<InferProvider<typeof meshNetworkCapability>, 'getStatus' | 'join' | 'startLogin' | 'leave' | 'logout' | 'listPeers' | 'testConnection'>;
79
79
  readonly metricsProvider: Pick<InferProvider<typeof metricsProviderCapability>, 'collectSnapshot' | 'getCached' | 'getCurrent' | 'getDiskSpace' | 'getGpuInfo' | 'getCpuTemperature' | 'getProcessStats' | 'listAddonInstances' | 'getAddonStats' | 'listNodeProcesses' | 'killProcess' | 'dumpHeapSnapshot'>;
package/dist/index.d.ts CHANGED
@@ -147,6 +147,8 @@ export { DeviceRuntimeState } from './device/device-runtime-state.js';
147
147
  export type { SliceHandle, SliceHandleApi, SliceHandleSource, } from './device/device-state-handle.js';
148
148
  export { createLazyTrpcSource, createMirrorSource, createSliceHandle, } from './device/device-state-handle.js';
149
149
  export { ChargingStatus, DeviceFeature, DeviceRole, DeviceType } from './device/device-type.js';
150
+ export type { BatteryPresence, BatteryPresenceInput } from './device/battery-presence.js';
151
+ export { BATTERY_UNREACHABLE_AFTER_MS, deriveBatteryPresence, isBatteryPresenceFault, } from './device/battery-presence.js';
150
152
  export type { IBatteryOperated, IDoorbellButton, INativeSnapshot, IPanTiltZoom, IRebootable, ITwoWayAudio, } from './device/features.js';
151
153
  export { getByPath, setByPath } from './device/path-util.js';
152
154
  export type { ReachabilityPollHandle, ReachabilityPollLogger, ReachabilityPollOptions, } from './device/reachability-poll.js';
@@ -203,6 +205,7 @@ export { type DeviceMetaLike, type DeviceReachSummary, deviceSelectorMatches, ty
203
205
  export type { CameraDetectionCapabilities, CameraMotionConfig, CameraNativeDetectionConfig, } from './types/camera-detection.js';
204
206
  export { DEVICE_TYPE_INFO, type DeviceTypeInfo } from './types/device-type.js';
205
207
  export * from './units/index.js';
208
+ export { BOOT_RECOVERY_BACKOFF_MS } from './util/boot-recovery-backoff.js';
206
209
  export { bestLocationMatch, locationSimilarity } from './util/location-match.js';
207
210
  export { bareAddonId, isSameAddonId } from './utils/addon-id.js';
208
211
  export { cosineSimilarity } from './utils/cosine-similarity.js';