@camstack/types 1.1.8 → 1.1.9

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.
@@ -112,10 +112,12 @@ export declare const ReleaseInputSchema: z.ZodObject<{
112
112
  }, z.core.$strip>;
113
113
  export declare const ResyncInputSchema: z.ZodObject<{
114
114
  camDeviceId: z.ZodNumber;
115
+ resetToSource: z.ZodOptional<z.ZodBoolean>;
115
116
  }, z.core.$strip>;
116
117
  export declare const ResyncResultSchema: z.ZodObject<{
117
118
  changed: z.ZodBoolean;
118
119
  rebuiltChildren: z.ZodNumber;
120
+ removedChildren: z.ZodOptional<z.ZodNumber>;
119
121
  }, z.core.$strip>;
120
122
  export declare const deviceAdoptionCapability: {
121
123
  readonly name: "device-adoption";
@@ -192,9 +194,11 @@ export declare const deviceAdoptionCapability: {
192
194
  }, z.core.$strip>, z.ZodVoid, "mutation">;
193
195
  readonly resync: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
194
196
  camDeviceId: z.ZodNumber;
197
+ resetToSource: z.ZodOptional<z.ZodBoolean>;
195
198
  }, z.core.$strip>, z.ZodObject<{
196
199
  changed: z.ZodBoolean;
197
200
  rebuiltChildren: z.ZodNumber;
201
+ removedChildren: z.ZodOptional<z.ZodNumber>;
198
202
  }, z.core.$strip>, "mutation">;
199
203
  };
200
204
  };
@@ -107,6 +107,7 @@ export declare const DeviceMetaSchema: z.ZodObject<{
107
107
  addonId: z.ZodString;
108
108
  type: z.ZodString;
109
109
  name: z.ZodString;
110
+ userNamed: z.ZodOptional<z.ZodBoolean>;
110
111
  location: z.ZodNullable<z.ZodString>;
111
112
  disabled: z.ZodBoolean;
112
113
  parentDeviceId: z.ZodNullable<z.ZodNumber>;
@@ -231,6 +232,7 @@ export declare const deviceManagerCapability: {
231
232
  addonId: z.ZodString;
232
233
  type: z.ZodString;
233
234
  name: z.ZodString;
235
+ userNamed: z.ZodOptional<z.ZodBoolean>;
234
236
  location: z.ZodNullable<z.ZodString>;
235
237
  disabled: z.ZodBoolean;
236
238
  parentDeviceId: z.ZodNullable<z.ZodNumber>;
@@ -1135,9 +1137,11 @@ export declare const deviceManagerCapability: {
1135
1137
  */
1136
1138
  readonly adoptionResync: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
1137
1139
  camDeviceId: z.ZodNumber;
1140
+ resetToSource: z.ZodOptional<z.ZodBoolean>;
1138
1141
  }, z.core.$strip>, z.ZodObject<{
1139
1142
  changed: z.ZodBoolean;
1140
1143
  rebuiltChildren: z.ZodNumber;
1144
+ removedChildren: z.ZodOptional<z.ZodNumber>;
1141
1145
  }, z.core.$strip>, "mutation">;
1142
1146
  /**
1143
1147
  * Test a field value on an existing device (e.g. probe an RTSP URL).
@@ -236,7 +236,14 @@ export declare abstract class BaseDevice<T extends z.ZodObject<z.core.$ZodLooseS
236
236
  * is open (Reolink writes `hasPtz/hasIntercom`, Hikvision writes
237
237
  * `hasSupplementalLight/hasAlarmIo`, etc).
238
238
  *
239
- * Default: no-op (driver had no probe to run).
239
+ * Default: nothing to probe mark the device PROBED (set `lastProbedAt`) so
240
+ * the kernel treats it as ready immediately. A device that derives its shape
241
+ * from a spec (a container, or an accessory sensor) rather than from a
242
+ * hardware probe has no probe to "complete"; without stamping `lastProbedAt`
243
+ * it would look perpetually un-probed — logging "Initial probe did not
244
+ * complete" on every boot and spinning a pointless retry chain. Drivers that
245
+ * DO probe override this and write their own `feature-probe` slice (including
246
+ * `lastProbedAt`) once their probe actually succeeds.
240
247
  */
241
248
  onProbe(): Promise<void>;
242
249
  /**
@@ -140,6 +140,14 @@ export interface DeviceMeta {
140
140
  readonly addonId: string;
141
141
  readonly type: DeviceType;
142
142
  readonly name: string;
143
+ /** True once an operator has explicitly renamed this device via `setName`.
144
+ * Drives the reconcile name-precedence: when set, a re-registration PRESERVES
145
+ * the operator's name; when unset, the provider's fresh construction-time name
146
+ * wins (so an improved auto-name propagates instead of being frozen forever).
147
+ * Absent ⇒ treated as user-named (PRESERVE) for safety on legacy rows that
148
+ * predate this flag, so an operator's manual rename is never reset. New
149
+ * auto-derived children land with the flag unset and self-heal their names. */
150
+ readonly userNamed?: boolean;
143
151
  readonly location: string | null;
144
152
  readonly disabled: boolean;
145
153
  readonly parentDeviceId: number | null;
@@ -6201,10 +6201,12 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
6201
6201
  input: {
6202
6202
  [x: string]: unknown;
6203
6203
  camDeviceId: number;
6204
+ resetToSource?: boolean | undefined;
6204
6205
  };
6205
6206
  output: {
6206
6207
  changed: boolean;
6207
6208
  rebuiltChildren: number;
6209
+ removedChildren?: number | undefined;
6208
6210
  };
6209
6211
  meta: object;
6210
6212
  }>;
@@ -6461,6 +6463,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
6461
6463
  location: string | null;
6462
6464
  disabled: boolean;
6463
6465
  parentDeviceId: number | null;
6466
+ userNamed?: boolean | undefined;
6464
6467
  metadata?: Record<string, unknown> | null | undefined;
6465
6468
  sourceInfo?: {
6466
6469
  id: string;
@@ -7414,8 +7417,16 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
7414
7417
  meta: object;
7415
7418
  }>;
7416
7419
  adoptionResync: import("@trpc/server").TRPCMutationProcedure<{
7417
- input: any;
7418
- output: any;
7420
+ input: {
7421
+ [x: string]: unknown;
7422
+ camDeviceId: number;
7423
+ resetToSource?: boolean | undefined;
7424
+ };
7425
+ output: {
7426
+ changed: boolean;
7427
+ rebuiltChildren: number;
7428
+ removedChildren?: number | undefined;
7429
+ };
7419
7430
  meta: object;
7420
7431
  }>;
7421
7432
  testField: import("@trpc/server").TRPCMutationProcedure<{
@@ -19899,10 +19910,12 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
19899
19910
  input: {
19900
19911
  [x: string]: unknown;
19901
19912
  camDeviceId: number;
19913
+ resetToSource?: boolean | undefined;
19902
19914
  };
19903
19915
  output: {
19904
19916
  changed: boolean;
19905
19917
  rebuiltChildren: number;
19918
+ removedChildren?: number | undefined;
19906
19919
  };
19907
19920
  meta: object;
19908
19921
  }>;
@@ -20159,6 +20172,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
20159
20172
  location: string | null;
20160
20173
  disabled: boolean;
20161
20174
  parentDeviceId: number | null;
20175
+ userNamed?: boolean | undefined;
20162
20176
  metadata?: Record<string, unknown> | null | undefined;
20163
20177
  sourceInfo?: {
20164
20178
  id: string;
@@ -21112,8 +21126,16 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
21112
21126
  meta: object;
21113
21127
  }>;
21114
21128
  adoptionResync: import("@trpc/server").TRPCMutationProcedure<{
21115
- input: any;
21116
- output: any;
21129
+ input: {
21130
+ [x: string]: unknown;
21131
+ camDeviceId: number;
21132
+ resetToSource?: boolean | undefined;
21133
+ };
21134
+ output: {
21135
+ changed: boolean;
21136
+ rebuiltChildren: number;
21137
+ removedChildren?: number | undefined;
21138
+ };
21117
21139
  meta: object;
21118
21140
  }>;
21119
21141
  testField: import("@trpc/server").TRPCMutationProcedure<{
package/dist/index.js CHANGED
@@ -9215,9 +9215,29 @@ var BaseDevice = class {
9215
9215
  * is open (Reolink writes `hasPtz/hasIntercom`, Hikvision writes
9216
9216
  * `hasSupplementalLight/hasAlarmIo`, etc).
9217
9217
  *
9218
- * Default: no-op (driver had no probe to run).
9218
+ * Default: nothing to probe mark the device PROBED (set `lastProbedAt`) so
9219
+ * the kernel treats it as ready immediately. A device that derives its shape
9220
+ * from a spec (a container, or an accessory sensor) rather than from a
9221
+ * hardware probe has no probe to "complete"; without stamping `lastProbedAt`
9222
+ * it would look perpetually un-probed — logging "Initial probe did not
9223
+ * complete" on every boot and spinning a pointless retry chain. Drivers that
9224
+ * DO probe override this and write their own `feature-probe` slice (including
9225
+ * `lastProbedAt`) once their probe actually succeeds.
9219
9226
  */
9220
- async onProbe() {}
9227
+ async onProbe() {
9228
+ const base = this.runtimeState.getCapState("feature-probe") ?? {
9229
+ flags: {},
9230
+ deviceType: null,
9231
+ model: null,
9232
+ channelCount: null,
9233
+ lastProbedAt: 0,
9234
+ lastFetchedAt: 0
9235
+ };
9236
+ this.runtimeState.setCapState("feature-probe", {
9237
+ ...base,
9238
+ lastProbedAt: Date.now()
9239
+ });
9240
+ }
9221
9241
  /**
9222
9242
  * Phase 5 — fired after the device + its accessories are registered.
9223
9243
  * Drivers publish streams to the broker, kick off background tasks,
@@ -12481,17 +12501,32 @@ var ReleaseInputSchema = zod.z.object({
12481
12501
  * the parent cascades into every accessory. */
12482
12502
  camDeviceId: zod.z.number().int().nonnegative()
12483
12503
  });
12484
- var ResyncInputSchema = zod.z.object({
12485
- /** Parent CamStack device id of an adopted device. The provider resolves its
12486
- * source (integration/broker + native id) and re-aligns the device's
12487
- * structural spec (type/role/capabilities/units) with the live mapping,
12488
- * rebuilding any child whose class changed while preserving operator edits. */
12489
- camDeviceId: zod.z.number().int().nonnegative() });
12504
+ var ResyncInputSchema = zod.z.object({
12505
+ /** Parent CamStack device id of an adopted device. The provider resolves its
12506
+ * source (integration/broker + native id) and re-aligns the device's
12507
+ * structural spec (type/role/capabilities/units) with the live mapping,
12508
+ * rebuilding any child whose class changed while preserving operator edits. */
12509
+ camDeviceId: zod.z.number().int().nonnegative(),
12510
+ /** "Resync from zero" (#19). When true, the kernel PURGES every accessory
12511
+ * child of `camDeviceId` BEFORE the provider re-derives the device, so the
12512
+ * children are rebuilt fresh from source — correct names, coords, and units —
12513
+ * instead of being preserved by the incremental reconcile. Use to recover from
12514
+ * legacy generic/placeholder names that the normal name-precedence keeps frozen
12515
+ * (the operator's explicit reset). Push-driven integrations (no-op resync)
12516
+ * rebuild on their next snapshot; pull/command integrations rebuild in `resync`.
12517
+ * Operator edits on the PARENT (its name, layout, primary-child pick) survive —
12518
+ * only the children are torn down. Omitted/false ⇒ the normal incremental
12519
+ * re-sync that preserves children. */
12520
+ resetToSource: zod.z.boolean().optional()
12521
+ });
12490
12522
  var ResyncResultSchema = zod.z.object({
12491
12523
  /** True when the persisted spec actually changed (children may have been rebuilt). */
12492
12524
  changed: zod.z.boolean(),
12493
12525
  /** Number of child devices rebuilt into a new class by this re-sync. */
12494
- rebuiltChildren: zod.z.number().int().nonnegative()
12526
+ rebuiltChildren: zod.z.number().int().nonnegative(),
12527
+ /** Number of accessory children torn down by a `resetToSource` purge before the
12528
+ * provider re-derived the device. 0/absent for a normal incremental re-sync. */
12529
+ removedChildren: zod.z.number().int().nonnegative().optional()
12495
12530
  });
12496
12531
  var deviceAdoptionCapability = {
12497
12532
  name: "device-adoption",
@@ -14937,6 +14972,11 @@ var DeviceMetaSchema = zod.z.object({
14937
14972
  addonId: zod.z.string(),
14938
14973
  type: zod.z.string(),
14939
14974
  name: zod.z.string(),
14975
+ /** True once an operator explicitly renamed the device via `setName`. Drives
14976
+ * reconcile name-precedence (preserve operator name vs adopt fresh provider
14977
+ * name). Absent ⇒ treated as user-named (PRESERVE) for legacy rows. See
14978
+ * `DeviceMeta.userNamed`. */
14979
+ userNamed: zod.z.boolean().optional(),
14940
14980
  location: zod.z.string().nullable(),
14941
14981
  disabled: zod.z.boolean(),
14942
14982
  parentDeviceId: zod.z.number().nullable(),
package/dist/index.mjs CHANGED
@@ -9214,9 +9214,29 @@ var BaseDevice = class {
9214
9214
  * is open (Reolink writes `hasPtz/hasIntercom`, Hikvision writes
9215
9215
  * `hasSupplementalLight/hasAlarmIo`, etc).
9216
9216
  *
9217
- * Default: no-op (driver had no probe to run).
9217
+ * Default: nothing to probe mark the device PROBED (set `lastProbedAt`) so
9218
+ * the kernel treats it as ready immediately. A device that derives its shape
9219
+ * from a spec (a container, or an accessory sensor) rather than from a
9220
+ * hardware probe has no probe to "complete"; without stamping `lastProbedAt`
9221
+ * it would look perpetually un-probed — logging "Initial probe did not
9222
+ * complete" on every boot and spinning a pointless retry chain. Drivers that
9223
+ * DO probe override this and write their own `feature-probe` slice (including
9224
+ * `lastProbedAt`) once their probe actually succeeds.
9218
9225
  */
9219
- async onProbe() {}
9226
+ async onProbe() {
9227
+ const base = this.runtimeState.getCapState("feature-probe") ?? {
9228
+ flags: {},
9229
+ deviceType: null,
9230
+ model: null,
9231
+ channelCount: null,
9232
+ lastProbedAt: 0,
9233
+ lastFetchedAt: 0
9234
+ };
9235
+ this.runtimeState.setCapState("feature-probe", {
9236
+ ...base,
9237
+ lastProbedAt: Date.now()
9238
+ });
9239
+ }
9220
9240
  /**
9221
9241
  * Phase 5 — fired after the device + its accessories are registered.
9222
9242
  * Drivers publish streams to the broker, kick off background tasks,
@@ -12480,17 +12500,32 @@ var ReleaseInputSchema = z.object({
12480
12500
  * the parent cascades into every accessory. */
12481
12501
  camDeviceId: z.number().int().nonnegative()
12482
12502
  });
12483
- var ResyncInputSchema = z.object({
12484
- /** Parent CamStack device id of an adopted device. The provider resolves its
12485
- * source (integration/broker + native id) and re-aligns the device's
12486
- * structural spec (type/role/capabilities/units) with the live mapping,
12487
- * rebuilding any child whose class changed while preserving operator edits. */
12488
- camDeviceId: z.number().int().nonnegative() });
12503
+ var ResyncInputSchema = z.object({
12504
+ /** Parent CamStack device id of an adopted device. The provider resolves its
12505
+ * source (integration/broker + native id) and re-aligns the device's
12506
+ * structural spec (type/role/capabilities/units) with the live mapping,
12507
+ * rebuilding any child whose class changed while preserving operator edits. */
12508
+ camDeviceId: z.number().int().nonnegative(),
12509
+ /** "Resync from zero" (#19). When true, the kernel PURGES every accessory
12510
+ * child of `camDeviceId` BEFORE the provider re-derives the device, so the
12511
+ * children are rebuilt fresh from source — correct names, coords, and units —
12512
+ * instead of being preserved by the incremental reconcile. Use to recover from
12513
+ * legacy generic/placeholder names that the normal name-precedence keeps frozen
12514
+ * (the operator's explicit reset). Push-driven integrations (no-op resync)
12515
+ * rebuild on their next snapshot; pull/command integrations rebuild in `resync`.
12516
+ * Operator edits on the PARENT (its name, layout, primary-child pick) survive —
12517
+ * only the children are torn down. Omitted/false ⇒ the normal incremental
12518
+ * re-sync that preserves children. */
12519
+ resetToSource: z.boolean().optional()
12520
+ });
12489
12521
  var ResyncResultSchema = z.object({
12490
12522
  /** True when the persisted spec actually changed (children may have been rebuilt). */
12491
12523
  changed: z.boolean(),
12492
12524
  /** Number of child devices rebuilt into a new class by this re-sync. */
12493
- rebuiltChildren: z.number().int().nonnegative()
12525
+ rebuiltChildren: z.number().int().nonnegative(),
12526
+ /** Number of accessory children torn down by a `resetToSource` purge before the
12527
+ * provider re-derived the device. 0/absent for a normal incremental re-sync. */
12528
+ removedChildren: z.number().int().nonnegative().optional()
12494
12529
  });
12495
12530
  var deviceAdoptionCapability = {
12496
12531
  name: "device-adoption",
@@ -14936,6 +14971,11 @@ var DeviceMetaSchema = z.object({
14936
14971
  addonId: z.string(),
14937
14972
  type: z.string(),
14938
14973
  name: z.string(),
14974
+ /** True once an operator explicitly renamed the device via `setName`. Drives
14975
+ * reconcile name-precedence (preserve operator name vs adopt fresh provider
14976
+ * name). Absent ⇒ treated as user-named (PRESERVE) for legacy rows. See
14977
+ * `DeviceMeta.userNamed`. */
14978
+ userNamed: z.boolean().optional(),
14939
14979
  location: z.string().nullable(),
14940
14980
  disabled: z.boolean(),
14941
14981
  parentDeviceId: z.number().nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",