@camstack/types 1.2.584 → 1.2.586

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 (37) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/dist/addon/instance-link.d.ts +3 -1
  3. package/dist/addon.d.ts +3 -2
  4. package/dist/addon.js +3 -1
  5. package/dist/addon.mjs +2 -2
  6. package/dist/audit/command-origin-claim.d.ts +33 -0
  7. package/dist/audit/device-transition.d.ts +35 -2
  8. package/dist/capabilities/capability-definition.d.ts +2 -1
  9. package/dist/capabilities/device-transitions.cap.d.ts +44 -0
  10. package/dist/capabilities/index.d.ts +6 -3
  11. package/dist/capabilities/notification-rules.cap.d.ts +70 -0
  12. package/dist/capabilities/siren-duration.d.ts +15 -0
  13. package/dist/capabilities/siren.cap.d.ts +175 -0
  14. package/dist/capabilities/tags.cap.d.ts +42 -16
  15. package/dist/capabilities/terminal-session.cap.d.ts +7 -1
  16. package/dist/client.js +682 -614
  17. package/dist/client.mjs +682 -614
  18. package/dist/generated/addon-api.d.ts +50 -0
  19. package/dist/generated/addon-cap-facts.d.ts +1 -1
  20. package/dist/generated/cap-status-types.d.ts +3 -1
  21. package/dist/generated/cap-vocabulary.d.ts +1 -1
  22. package/dist/generated/capability-router-map.d.ts +5 -2
  23. package/dist/generated/device-local-state.d.ts +3 -0
  24. package/dist/generated/device-proxy.d.ts +3 -0
  25. package/dist/generated/device-scoped-caps.d.ts +1 -1
  26. package/dist/generated/history-catalog.d.ts +1 -1
  27. package/dist/generated/method-access-map.d.ts +1 -1
  28. package/dist/generated/method-device-selectors.d.ts +1 -1
  29. package/dist/generated/runtime-state-durability.d.ts +1 -1
  30. package/dist/generated/system-proxy.d.ts +1 -1
  31. package/dist/helpers/trpc-leaf.d.ts +4 -3
  32. package/dist/index.js +387 -17
  33. package/dist/index.mjs +373 -18
  34. package/dist/notification/timelapse-rule.d.ts +3 -0
  35. package/dist/{sleep-DnhxKL99.mjs → sleep-Ch7Q7UtE.mjs} +728 -620
  36. package/dist/{sleep-Coq9CYAH.js → sleep-DwRtgB2i.js} +739 -619
  37. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-Coq9CYAH.js");
2
+ const require_sleep = require("./sleep-DwRtgB2i.js");
3
3
  const require_event_category = require("./event-category-d9kiqCqC.js");
4
4
  const require_composed_stable_id = require("./composed-stable-id-C3NfRTj8.js");
5
5
  const require_implemented_methods = require("./implemented-methods-C7ScGvEz.js");
@@ -872,12 +872,19 @@ function composeInstanceKinds(parts, base) {
872
872
  return part;
873
873
  };
874
874
  /**
875
+ * Whether a part's kind offers a Test. A kind that states `canTest` is believed; one that does not
876
+ * takes what its OWN provider declares, never the composed base (a calendar or an integration
877
+ * inherited the account's `canTest: true` and offered a button nothing answered, planning#543).
878
+ */
879
+ const canTestPart = async (part) => part.kind.canTest ?? (await part.provider.describe()).canTest === true;
880
+ /**
875
881
  * The part a DRAFT test runs on. A named kind is that kind; an unnamed one is the provider's only
876
882
  * testable kind. Several testable kinds and none named is a typed refusal that lists them, never a throw.
877
883
  */
878
- const draftPart = (kindId) => {
884
+ const draftPart = async (kindId) => {
879
885
  if (kindId !== void 0) return parts.find((candidate) => candidate.kind.id === kindId) ?? { error: `Unknown instance kind '${kindId}'` };
880
- const testable = parts.filter((part) => part.kind.canTest !== false);
886
+ const flags = await Promise.all(parts.map(canTestPart));
887
+ const testable = parts.filter((_part, index) => flags[index] === true);
881
888
  const only = testable.length === 1 ? testable[0] : parts.length === 1 ? parts[0] : void 0;
882
889
  if (only !== void 0) return only;
883
890
  return { error: `This provider has several kinds: name one of ${(testable.length > 0 ? testable : parts).map((part) => part.kind.id).join(", ")}` };
@@ -895,7 +902,10 @@ function composeInstanceKinds(parts, base) {
895
902
  const links = (await Promise.all(parts.map(async (part) => (await part.provider.describe()).links ?? []))).flat();
896
903
  return {
897
904
  ...base,
898
- kinds: parts.map((part) => part.kind),
905
+ kinds: await Promise.all(parts.map(async (part) => ({
906
+ ...part.kind,
907
+ canTest: await canTestPart(part)
908
+ }))),
899
909
  ...links.length > 0 ? { links } : {}
900
910
  };
901
911
  },
@@ -917,7 +927,7 @@ function composeInstanceKinds(parts, base) {
917
927
  setInstanceEnabled: async (input) => (await holderOf(input.id)).provider.setInstanceEnabled(input),
918
928
  deleteInstance: async (input) => (await holderOf(input.id)).provider.deleteInstance(input),
919
929
  testInstance: async (input) => {
920
- const resolved = input.id === null ? draftPart(input.kind) : await holderOf(input.id);
930
+ const resolved = input.id === null ? await draftPart(input.kind) : await holderOf(input.id);
921
931
  if ("error" in resolved) return {
922
932
  success: false,
923
933
  status: "inconclusive",
@@ -51444,7 +51454,7 @@ function groupTemplate(id) {
51444
51454
  //#region src/generated/history-catalog.ts
51445
51455
  /**
51446
51456
  * Cap history catalog, projected from every `*.cap.ts` `history` block.
51447
- * 46 caps with series (124 series), 38 caps answered `'none'`.
51457
+ * 46 caps with series (124 series), 39 caps answered `'none'`.
51448
51458
  * Field keys are `runtimeState` paths (`a.b` into fixed objects only).
51449
51459
  */
51450
51460
  var HISTORY_CATALOG = {
@@ -52201,6 +52211,7 @@ var HISTORY_NONE_CAPS = [
52201
52211
  "recording-signal",
52202
52212
  "scene-monitor",
52203
52213
  "script-runner",
52214
+ "siren",
52204
52215
  "stream-catalog",
52205
52216
  "stream-signals",
52206
52217
  "timed-run",
@@ -82090,7 +82101,32 @@ var NcRuleInputSchema = zod.z.object({
82090
82101
  * authored before this field meant. An editor turns it off by writing
82091
82102
  * `false`, so it needs no `clear` key.
82092
82103
  */
82093
- askVerdict: zod.z.boolean().optional()
82104
+ askVerdict: zod.z.boolean().optional(),
82105
+ /**
82106
+ * Operator tags (D1054), kept on the rule like a core block's. Absent = no
82107
+ * tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
82108
+ * does not name `tags` keeps the stored ones (the store merges), and an
82109
+ * editor empties them by sending `[]` (the store drops an empty list).
82110
+ * Renamed or removed fleet-wide only through the `tags` cap, which writes
82111
+ * here with `setRuleTags`.
82112
+ */
82113
+ tags: TagsFieldSchema.optional()
82114
+ });
82115
+ /**
82116
+ * The rule kinds that carry tags (D1054) — each one its own store. Every kind
82117
+ * labels its rules the same way; this names which store a tag write goes to.
82118
+ */
82119
+ var NcTaggedRuleKindSchema = zod.z.enum([
82120
+ "event",
82121
+ "summary",
82122
+ "timelapse",
82123
+ "calendar-events"
82124
+ ]);
82125
+ /** One rule's tags, as the `tags` cap reads them across every kind. */
82126
+ var NcRuleTagsEntrySchema = zod.z.object({
82127
+ kind: NcTaggedRuleKindSchema,
82128
+ ruleId: zod.z.string(),
82129
+ tags: zod.z.array(zod.z.string())
82094
82130
  });
82095
82131
  /**
82096
82132
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -83813,6 +83849,29 @@ var notificationRulesCapability = {
83813
83849
  auth: "admin"
83814
83850
  }),
83815
83851
  /**
83852
+ * Every rule of every kind with its tags (D1054) — event rules, summaries,
83853
+ * timelapses and calendar-events rules. The `tags` cap counts and rewrites
83854
+ * from this one read; a rule without tags is listed with `[]`.
83855
+ */
83856
+ listRuleTags: require_sleep.method(zod.z.object({}), zod.z.object({ rules: zod.z.array(NcRuleTagsEntrySchema) }), {
83857
+ kind: "query",
83858
+ auth: "admin"
83859
+ }),
83860
+ /**
83861
+ * Replace ONE rule's tags (D1054) and nothing else — the `tags` cap's rename
83862
+ * and remove write through this. `kind` names the store the rule lives in.
83863
+ * Normalised on write (trimmed, deduplicated case-insensitively); `[]`
83864
+ * clears them.
83865
+ */
83866
+ setRuleTags: require_sleep.method(zod.z.object({
83867
+ kind: NcTaggedRuleKindSchema,
83868
+ ruleId: zod.z.string(),
83869
+ tags: TagsFieldSchema
83870
+ }), zod.z.object({ success: zod.z.literal(true) }), {
83871
+ kind: "mutation",
83872
+ auth: "admin"
83873
+ }),
83874
+ /**
83816
83875
  * WHAT THE RULES ACTUALLY ASK the stream broker to retain, per camera.
83817
83876
  *
83818
83877
  * The notification centre owns the rules, so it is the only thing that can
@@ -95174,6 +95233,152 @@ var serverManagementCapability = {
95174
95233
  vocabulary: { notOperatorFacing: require_sleep.NOT_A_DEVICE.CLUSTER }
95175
95234
  };
95176
95235
  //#endregion
95236
+ //#region src/capabilities/siren.cap.ts
95237
+ /**
95238
+ * Timed siren: trigger the siren for a duration and know until when it sounds.
95239
+ *
95240
+ * The plain on/off `switch` of a siren stays as it is (HomeKit / Alexa see a
95241
+ * switch); this cap adds the part a switch cannot say — HOW LONG, and the
95242
+ * moment the siren is expected to fall silent (`activeUntil`, epoch ms), so a
95243
+ * UI can show the activation with a countdown.
95244
+ *
95245
+ * The allowed durations are never hardcoded: `getOptions` answers what the
95246
+ * CAMERA reports (a discrete list or `{min,max,step}`), the default, and the
95247
+ * unit truth — a camera that counts plays rather than seconds says so, with the
95248
+ * seconds-per-play factor used to convert, and whether that factor was read
95249
+ * from the camera or is an estimate.
95250
+ */
95251
+ /** What the camera counts natively. */
95252
+ var SirenDurationUnit = {
95253
+ Seconds: "seconds",
95254
+ Plays: "plays"
95255
+ };
95256
+ /** Where the numbers of an options answer come from. */
95257
+ var SirenOptionsSource = {
95258
+ /** Read from the camera by this fetch. */
95259
+ Camera: "camera",
95260
+ /** The camera did not answer or does not advertise it; a documented fallback. */
95261
+ Fallback: "fallback"
95262
+ };
95263
+ var SirenDurationRangeSchema = zod.z.object({
95264
+ min: zod.z.number().positive(),
95265
+ max: zod.z.number().positive(),
95266
+ step: zod.z.number().positive()
95267
+ });
95268
+ var SirenOptionsSchema = zod.z.object({
95269
+ /** Discrete durations in seconds the operator may pick; `null` when the camera gives a range. */
95270
+ allowedSeconds: zod.z.array(zod.z.number().positive()).nullable(),
95271
+ /** Continuous range in seconds; `null` when the camera gives a discrete list. */
95272
+ rangeSeconds: SirenDurationRangeSchema.nullable(),
95273
+ /** The camera's default duration, seconds. */
95274
+ defaultSeconds: zod.z.number().positive(),
95275
+ /** What the camera counts natively. */
95276
+ unit: zod.z.enum([SirenDurationUnit.Seconds, SirenDurationUnit.Plays]),
95277
+ /** Seconds one play lasts, when `unit` is `plays`; `null` for a seconds camera. */
95278
+ secondsPerPlay: zod.z.number().positive().nullable(),
95279
+ /** `camera` when the values were read from it, `fallback` when the camera could not say. */
95280
+ source: zod.z.enum([SirenOptionsSource.Camera, SirenOptionsSource.Fallback]),
95281
+ /** Ms epoch of the read that produced this answer. */
95282
+ fetchedAt: zod.z.number()
95283
+ });
95284
+ var SirenStatusSchema = zod.z.object({
95285
+ /** True while the siren is sounding by a timed trigger or switched on. */
95286
+ active: zod.z.boolean(),
95287
+ /** Ms epoch the siren is expected to fall silent; `null` when not active or open-ended. */
95288
+ activeUntil: zod.z.number().nullable(),
95289
+ /** Duration of the current / last activation, seconds; `null` when none yet. */
95290
+ durationSeconds: zod.z.number().nullable(),
95291
+ /** Ms epoch of the last trigger (0 = never). */
95292
+ lastTriggeredAt: zod.z.number()
95293
+ });
95294
+ var SirenRuntimeStateSchema = SirenStatusSchema.extend({
95295
+ /** Ms epoch of the last successful camera read of the options (0 = never). */
95296
+ lastFetchedAt: zod.z.number() });
95297
+ var sirenCapability = {
95298
+ name: "siren",
95299
+ scope: "device",
95300
+ deviceNative: true,
95301
+ mode: "singleton",
95302
+ deviceTypes: [require_composed_stable_id.DeviceType.Siren],
95303
+ methods: {
95304
+ /** The durations the camera allows, read from the camera. */
95305
+ getOptions: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), SirenOptionsSchema, {
95306
+ kind: "query",
95307
+ auth: "protected"
95308
+ }),
95309
+ /**
95310
+ * Sound the siren. Without `durationSeconds` the camera default applies.
95311
+ * Answers the state at the moment of the trigger (`activeUntil` included).
95312
+ */
95313
+ trigger: require_sleep.method(zod.z.object({
95314
+ deviceId: zod.z.number().int().nonnegative(),
95315
+ durationSeconds: zod.z.number().positive().optional()
95316
+ }), SirenStatusSchema, {
95317
+ kind: "mutation",
95318
+ auth: "protected",
95319
+ actions: [{
95320
+ id: "siren.trigger",
95321
+ label: require_sleep.t("Sound the siren", "Fai suonare la sirena"),
95322
+ phrase: require_sleep.t("Sound {device}", "Fai suonare {device}"),
95323
+ icon: "siren",
95324
+ args: {}
95325
+ }]
95326
+ }),
95327
+ /** Silence the siren now. */
95328
+ stop: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), SirenStatusSchema, {
95329
+ kind: "mutation",
95330
+ auth: "protected",
95331
+ actions: [{
95332
+ id: "siren.stop",
95333
+ label: require_sleep.t("Silence the siren", "Zittisci la sirena"),
95334
+ phrase: require_sleep.t("Silence {device}", "Zittisci {device}"),
95335
+ icon: "siren",
95336
+ effect: {
95337
+ field: "active",
95338
+ value: false
95339
+ },
95340
+ args: {}
95341
+ }]
95342
+ })
95343
+ },
95344
+ events: { onSirenChanged: {
95345
+ data: zod.z.object({
95346
+ deviceId: zod.z.number(),
95347
+ active: zod.z.boolean(),
95348
+ activeUntil: zod.z.number().nullable()
95349
+ }),
95350
+ notOperatorFacing: "the `active` state trigger phrases both edges of this change"
95351
+ } },
95352
+ status: {
95353
+ schema: SirenStatusSchema,
95354
+ kind: "command-driven"
95355
+ },
95356
+ runtimeState: SirenRuntimeStateSchema,
95357
+ /**
95358
+ * Runtime-state durability: **session** — a siren activation is a moment, not a fact to restore after a restart.
95359
+ *
95360
+ * See `RuntimeStateDurability`. Enforced by
95361
+ * `scripts/check-runtime-state-durability.ts`.
95362
+ */
95363
+ durability: "session",
95364
+ /**
95365
+ * History (D850): none — an activation is already recorded by the switch / alarm events.
95366
+ */
95367
+ history: "none",
95368
+ vocabulary: {
95369
+ noun: require_sleep.t("Siren", "Sirena"),
95370
+ order: 1170,
95371
+ state: [{
95372
+ kind: "boolean",
95373
+ field: "active",
95374
+ label: require_sleep.t("Siren sounding", "Sirena in funzione"),
95375
+ whenTrue: require_sleep.t("When {device} starts sounding", "Quando {device} inizia a suonare"),
95376
+ whenFalse: require_sleep.t("When {device} falls silent", "Quando {device} smette di suonare"),
95377
+ icon: "siren"
95378
+ }]
95379
+ }
95380
+ };
95381
+ //#endregion
95177
95382
  //#region src/capabilities/smoke.cap.ts
95178
95383
  /**
95179
95384
  * Smoke alarm sensor — boolean "is smoke currently detected" with
@@ -97877,10 +98082,11 @@ var systemCapability = {
97877
98082
  /**
97878
98083
  * tags — the registry of tag STYLES and the one place that renames or removes a
97879
98084
  * tag everywhere (D1054). A tag itself lives in the `tags` array of the record it
97880
- * labels (a core block, a scheduler, a template, an action, a device); only its
98085
+ * labels (a core block, a scheduler, a template, an action, a device, a
98086
+ * notification rule); only its
97881
98087
  * colour token and icon are registered here. Provided by the core-blocks builtin,
97882
- * the one place that knows every owner kind; devices are reached through
97883
- * `deviceManager` over `ctx.api`.
98088
+ * the one place that knows every owner kind; devices and notification rules
98089
+ * are reached through `deviceManager` / `notificationRules` over `ctx.api`.
97884
98090
  *
97885
98091
  * Tags compare trimmed and case-insensitively. `list` is the union of styled tags
97886
98092
  * and tags in use; a tag with no style answers a colour derived from its name and
@@ -97891,7 +98097,21 @@ var TagUsageCountsSchema = zod.z.object({
97891
98097
  schedulers: zod.z.number().int().nonnegative(),
97892
98098
  templates: zod.z.number().int().nonnegative(),
97893
98099
  actions: zod.z.number().int().nonnegative(),
97894
- devices: zod.z.number().int().nonnegative()
98100
+ devices: zod.z.number().int().nonnegative(),
98101
+ notificationRules: zod.z.number().int().nonnegative()
98102
+ });
98103
+ /**
98104
+ * The counts `list` answers. An owner that could not be read (a forked addon
98105
+ * that is down, redeploying or not installed) is `null` — unknown, never `0`
98106
+ * (D393) — and `list` still answers with the other owners' tags.
98107
+ */
98108
+ var TagListCountsSchema = zod.z.object({
98109
+ coreBlocks: zod.z.number().int().nonnegative().nullable(),
98110
+ schedulers: zod.z.number().int().nonnegative().nullable(),
98111
+ templates: zod.z.number().int().nonnegative().nullable(),
98112
+ actions: zod.z.number().int().nonnegative().nullable(),
98113
+ devices: zod.z.number().int().nonnegative().nullable(),
98114
+ notificationRules: zod.z.number().int().nonnegative().nullable()
97895
98115
  });
97896
98116
  var TagEntrySchema = zod.z.object({
97897
98117
  name: TagNameSchema,
@@ -97899,14 +98119,19 @@ var TagEntrySchema = zod.z.object({
97899
98119
  icon: IconKeySchema,
97900
98120
  /** `false` when the operator never chose a style: colour and icon are the derived defaults. */
97901
98121
  styled: zod.z.boolean(),
97902
- counts: TagUsageCountsSchema
98122
+ /** Per owner kind; `null` = that owner could not be read on this call. */
98123
+ counts: TagListCountsSchema
97903
98124
  });
97904
98125
  var tagsCapability = {
97905
98126
  name: "tags",
97906
98127
  scope: "system",
97907
98128
  mode: "singleton",
97908
98129
  methods: {
97909
- /** Every tag: styled or in use, with how many records of each kind carry it. */
98130
+ /**
98131
+ * Every tag: styled or in use, with how many records of each kind carry it.
98132
+ * An unreachable owner degrades that kind's count to `null`; the call still
98133
+ * answers.
98134
+ */
97910
98135
  list: require_sleep.method(zod.z.object({}), zod.z.array(TagEntrySchema), { auth: "protected" }),
97911
98136
  /** Choose the colour and icon of a tag. The tag need not be in use. */
97912
98137
  setStyle: require_sleep.method(zod.z.object({
@@ -97920,7 +98145,9 @@ var tagsCapability = {
97920
98145
  /**
97921
98146
  * Rename a tag on EVERY owner in one call. When `to` already exists the two
97922
98147
  * merge and the TARGET's style wins (like `renameLocation`). An empty `to`
97923
- * is refused before anything is written.
98148
+ * is refused before anything is written, and so is any call while an owner
98149
+ * cannot be read (the error names the owner): a rename applied to
98150
+ * only some owners would split the fleet across two spellings.
97924
98151
  */
97925
98152
  rename: require_sleep.method(zod.z.object({
97926
98153
  from: zod.z.string(),
@@ -97929,7 +98156,7 @@ var tagsCapability = {
97929
98156
  kind: "mutation",
97930
98157
  auth: "admin"
97931
98158
  }),
97932
- /** Drop a tag from every owner and delete its style. */
98159
+ /** Drop a tag from every owner and delete its style. Refused like `rename` while an owner cannot be read. */
97933
98160
  remove: require_sleep.method(zod.z.object({ name: zod.z.string() }), zod.z.object({ updated: TagUsageCountsSchema }), {
97934
98161
  kind: "mutation",
97935
98162
  auth: "admin"
@@ -99004,7 +99231,11 @@ var TerminalSessionInfoSchema = zod.z.object({
99004
99231
  cols: zod.z.number().int().positive(),
99005
99232
  rows: zod.z.number().int().positive(),
99006
99233
  /** ms-epoch the session's pty was spawned. */
99007
- startedAt: zod.z.number()
99234
+ startedAt: zod.z.number(),
99235
+ /** User id of the admin who opened it; `unattributed` when the caller was not passed. */
99236
+ openedBy: zod.z.string().optional(),
99237
+ /** ms-epoch of the last pty input or output — what the idle timeout measures. */
99238
+ lastActivityAt: zod.z.number().optional()
99008
99239
  });
99009
99240
  /**
99010
99241
  * A profile the operator may open — a pre-declared, allowlisted program
@@ -102947,6 +103178,7 @@ var CAPABILITY_NAMES = {
102947
103178
  scriptRunner: "script-runner",
102948
103179
  serverManagement: "server-management",
102949
103180
  settingsStore: "settings-store",
103181
+ siren: "siren",
102950
103182
  smoke: "smoke",
102951
103183
  smtpProvider: "smtp-provider",
102952
103184
  snapshot: "snapshot",
@@ -103660,6 +103892,10 @@ var CAPABILITY_ROUTER_KEYS = [
103660
103892
  key: "settingsStore",
103661
103893
  name: "settings-store"
103662
103894
  },
103895
+ {
103896
+ key: "siren",
103897
+ name: "siren"
103898
+ },
103663
103899
  {
103664
103900
  key: "smoke",
103665
103901
  name: "smoke"
@@ -104006,6 +104242,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
104006
104242
  scriptRunnerCapability,
104007
104243
  serverManagementCapability,
104008
104244
  settingsStoreCapability,
104245
+ sirenCapability,
104009
104246
  smokeCapability,
104010
104247
  smtpProviderCapability,
104011
104248
  snapshotCapability,
@@ -105809,6 +106046,47 @@ function selectNavigationMethods(getStatus, setValue) {
105809
106046
  };
105810
106047
  }
105811
106048
  //#endregion
106049
+ //#region src/capabilities/siren-duration.ts
106050
+ /**
106051
+ * Pure duration maths for the `siren` cap, shared by every provider so a
106052
+ * trigger and the countdown it publishes mean the same thing everywhere.
106053
+ */
106054
+ /** The state of a siren that is not sounding. Keeps the last activation's facts. */
106055
+ function sirenIdleStatus(previous) {
106056
+ return {
106057
+ active: false,
106058
+ activeUntil: null,
106059
+ durationSeconds: previous?.durationSeconds ?? null,
106060
+ lastTriggeredAt: previous?.lastTriggeredAt ?? 0
106061
+ };
106062
+ }
106063
+ /** The state right after a timed trigger: sounding until `now + seconds`. */
106064
+ function sirenTriggeredStatus(nowMs, seconds) {
106065
+ return {
106066
+ active: true,
106067
+ activeUntil: nowMs + Math.round(seconds * 1e3),
106068
+ durationSeconds: seconds,
106069
+ lastTriggeredAt: nowMs
106070
+ };
106071
+ }
106072
+ /**
106073
+ * The duration a trigger will really use: the request (or the camera default)
106074
+ * snapped to what the camera allows — the nearest listed value, or clamped and
106075
+ * stepped inside the range. Never longer or shorter than the camera can play.
106076
+ */
106077
+ function resolveSirenSeconds(options, requested) {
106078
+ const wanted = requested ?? options.defaultSeconds;
106079
+ const list = options.allowedSeconds;
106080
+ if (list !== null && list.length > 0) return list.reduce((best, candidate) => Math.abs(candidate - wanted) < Math.abs(best - wanted) ? candidate : best);
106081
+ const range = options.rangeSeconds;
106082
+ if (range !== null) {
106083
+ const clamped = Math.min(range.max, Math.max(range.min, wanted));
106084
+ const steps = Math.min(Math.round((clamped - range.min) / range.step), Math.floor((range.max - range.min) / range.step));
106085
+ return range.min + steps * range.step;
106086
+ }
106087
+ return wanted;
106088
+ }
106089
+ //#endregion
105812
106090
  //#region src/capabilities/recording-onboard-rules.ts
105813
106091
  /** Minutes in a day. `endMinute === 1440` means "to end of day". */
105814
106092
  var MINUTES_PER_DAY = 1440;
@@ -111626,6 +111904,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
111626
111904
  runningState: runningStateCapability,
111627
111905
  sceneMonitor: sceneMonitorCapability,
111628
111906
  scriptRunner: scriptRunnerCapability,
111907
+ siren: sirenCapability,
111629
111908
  smoke: smokeCapability,
111630
111909
  streamCatalog: streamCatalogCapability,
111631
111910
  streamParams: streamParamsCapability,
@@ -123690,6 +123969,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
123690
123969
  access: "view",
123691
123970
  role: "admin"
123692
123971
  },
123972
+ "notificationRules.listRuleTags": {
123973
+ capName: "notification-rules",
123974
+ capScope: "system",
123975
+ addonId: null,
123976
+ access: "view",
123977
+ role: "admin"
123978
+ },
123693
123979
  "notificationRules.listSnoozes": {
123694
123980
  capName: "notification-rules",
123695
123981
  capScope: "system",
@@ -123746,6 +124032,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
123746
124032
  access: "create",
123747
124033
  role: "admin"
123748
124034
  },
124035
+ "notificationRules.setRuleTags": {
124036
+ capName: "notification-rules",
124037
+ capScope: "system",
124038
+ addonId: null,
124039
+ access: "create",
124040
+ role: "admin"
124041
+ },
123749
124042
  "notificationRules.testRule": {
123750
124043
  capName: "notification-rules",
123751
124044
  capScope: "system",
@@ -126707,6 +127000,34 @@ var METHOD_ACCESS_MAP = Object.freeze({
126707
127000
  access: "create",
126708
127001
  role: "admin"
126709
127002
  },
127003
+ "siren.getOptions": {
127004
+ capName: "siren",
127005
+ capScope: "device",
127006
+ addonId: null,
127007
+ access: "view",
127008
+ role: "viewer"
127009
+ },
127010
+ "siren.getStatus": {
127011
+ capName: "siren",
127012
+ capScope: "device",
127013
+ addonId: null,
127014
+ access: "view",
127015
+ role: "viewer"
127016
+ },
127017
+ "siren.stop": {
127018
+ capName: "siren",
127019
+ capScope: "device",
127020
+ addonId: null,
127021
+ access: "create",
127022
+ role: "viewer"
127023
+ },
127024
+ "siren.trigger": {
127025
+ capName: "siren",
127026
+ capScope: "device",
127027
+ addonId: null,
127028
+ access: "create",
127029
+ role: "viewer"
127030
+ },
126710
127031
  "smoke.getStatus": {
126711
127032
  capName: "smoke",
126712
127033
  capScope: "device",
@@ -128837,6 +129158,7 @@ var KNOWN_CAP_NAMES = [
128837
129158
  "script-runner",
128838
129159
  "server-management",
128839
129160
  "settings-store",
129161
+ "siren",
128840
129162
  "smoke",
128841
129163
  "smtp-provider",
128842
129164
  "snapshot",
@@ -128968,6 +129290,7 @@ var DEVICE_CAP_NAMES = [
128968
129290
  "running-state",
128969
129291
  "scene-monitor",
128970
129292
  "script-runner",
129293
+ "siren",
128971
129294
  "smoke",
128972
129295
  "snapshot",
128973
129296
  "stream-catalog",
@@ -131094,6 +131417,7 @@ var CAP_NAMES_WITH_STATUS = [
131094
131417
  "running-state",
131095
131418
  "scene-monitor",
131096
131419
  "script-runner",
131420
+ "siren",
131097
131421
  "smoke",
131098
131422
  "snapshot",
131099
131423
  "stream-params",
@@ -133799,6 +134123,26 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
133799
134123
  form: "single",
133800
134124
  optional: false
133801
134125
  }],
134126
+ "siren.getOptions": [{
134127
+ name: "deviceId",
134128
+ form: "single",
134129
+ optional: false
134130
+ }],
134131
+ "siren.getStatus": [{
134132
+ name: "deviceId",
134133
+ form: "single",
134134
+ optional: false
134135
+ }],
134136
+ "siren.stop": [{
134137
+ name: "deviceId",
134138
+ form: "single",
134139
+ optional: false
134140
+ }],
134141
+ "siren.trigger": [{
134142
+ name: "deviceId",
134143
+ form: "single",
134144
+ optional: false
134145
+ }],
133802
134146
  "smoke.getStatus": [{
133803
134147
  name: "deviceId",
133804
134148
  form: "single",
@@ -134505,7 +134849,7 @@ function getCapsByProviderKind(kind) {
134505
134849
  //#region src/generated/runtime-state-durability.ts
134506
134850
  /**
134507
134851
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
134508
- * `runtimeState`. 85 caps: 43 `restored`, 42 `session`.
134852
+ * `runtimeState`. 86 caps: 43 `restored`, 43 `session`.
134509
134853
  *
134510
134854
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
134511
134855
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -134780,6 +135124,10 @@ var RUNTIME_STATE_POLICY = {
134780
135124
  durability: "session",
134781
135125
  volatileFields: []
134782
135126
  },
135127
+ "siren": {
135128
+ durability: "session",
135129
+ volatileFields: []
135130
+ },
134783
135131
  "smoke": {
134784
135132
  durability: "restored",
134785
135133
  volatileFields: ["lastChangedAt"]
@@ -135947,6 +136295,8 @@ function createSystemProxy(api) {
135947
136295
  updateRule: (input) => dispatch("notificationRules", "updateRule", "mutation", input),
135948
136296
  deleteRule: (input) => dispatch("notificationRules", "deleteRule", "mutation", input),
135949
136297
  setRuleEnabled: (input) => dispatch("notificationRules", "setRuleEnabled", "mutation", input),
136298
+ listRuleTags: (input) => dispatch("notificationRules", "listRuleTags", "query", input),
136299
+ setRuleTags: (input) => dispatch("notificationRules", "setRuleTags", "mutation", input),
135950
136300
  getClipRetentionAsks: (input) => dispatch("notificationRules", "getClipRetentionAsks", "query", input),
135951
136301
  listDeviceMutes: (input) => dispatch("notificationRules", "listDeviceMutes", "query", input),
135952
136302
  testRule: (input) => dispatch("notificationRules", "testRule", "mutation", input),
@@ -142521,6 +142871,8 @@ var TimelapseRuleInputSchema = zod.z.object({
142521
142871
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
142522
142872
  priority: PriorityField.default(3),
142523
142873
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
142874
+ /** Operator labels (D1054) — optional and NEVER defaulted: an absent key leaves the stored tags alone; `[]` clears them. Admin-only. */
142875
+ tags: TagsFieldSchema.optional(),
142524
142876
  targetOverrides: NcTargetOverridesSchema.optional()
142525
142877
  });
142526
142878
  /**
@@ -142563,6 +142915,8 @@ var TimelapseRulePatchSchema = zod.z.object({
142563
142915
  reportClasses: ReportClassesField.optional(),
142564
142916
  priority: PriorityField.optional(),
142565
142917
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
142918
+ /** Absent = keep the stored tags; `[]` clears them (D1054). Never defaulted. */
142919
+ tags: TagsFieldSchema.optional(),
142566
142920
  targetOverrides: NcTargetOverridesSchema.optional()
142567
142921
  });
142568
142922
  /** A persisted timelapse rule. */
@@ -148276,6 +148630,7 @@ function buildLinkedInstances(records, spec) {
148276
148630
  }),
148277
148631
  configured: (body) => links.every((link) => linkedId(body, link.field) !== void 0) && (spec.alsoConfigured?.(body) ?? true),
148278
148632
  ...spec.mintId !== void 0 ? { mintId: spec.mintId } : {},
148633
+ ...spec.test !== void 0 ? { test: spec.test } : {},
148279
148634
  ...spec.onChanged !== void 0 ? { onChanged: spec.onChanged } : {}
148280
148635
  });
148281
148636
  return instances;
@@ -150180,6 +150535,7 @@ exports.NcRuleLastRunsSchema = NcRuleLastRunsSchema;
150180
150535
  exports.NcRuleNotificationButtonSchema = NcRuleNotificationButtonSchema;
150181
150536
  exports.NcRulePatchSchema = NcRulePatchSchema;
150182
150537
  exports.NcRuleSchema = NcRuleSchema;
150538
+ exports.NcRuleTagsEntrySchema = NcRuleTagsEntrySchema;
150183
150539
  exports.NcRuleTargetSchema = NcRuleTargetSchema;
150184
150540
  exports.NcRuleUpdateInputSchema = NcRuleUpdateInputSchema;
150185
150541
  exports.NcSceneConditionSchema = NcSceneConditionSchema;
@@ -150200,6 +150556,7 @@ exports.NcSystemEventDeliveryModeSchema = NcSystemEventDeliveryModeSchema;
150200
150556
  exports.NcSystemEventDeliverySchema = NcSystemEventDeliverySchema;
150201
150557
  exports.NcSystemEventDeliveryToggleSchema = NcSystemEventDeliveryToggleSchema;
150202
150558
  exports.NcSystemEventKindSchema = NcSystemEventKindSchema;
150559
+ exports.NcTaggedRuleKindSchema = NcTaggedRuleKindSchema;
150203
150560
  exports.NcTargetAttachmentSchema = NcTargetAttachmentSchema;
150204
150561
  exports.NcTargetOverrideSchema = NcTargetOverrideSchema;
150205
150562
  exports.NcTargetOverridesSchema = NcTargetOverridesSchema;
@@ -150285,6 +150642,8 @@ exports.OccupancyLookAnswerSchema = OccupancyLookAnswerSchema;
150285
150642
  exports.OccupancyLookRefusalSchema = OccupancyLookRefusalSchema;
150286
150643
  exports.OccupancyLookRequestSchema = OccupancyLookRequestSchema;
150287
150644
  exports.OldTargetBodySchema = OldTargetBodySchema;
150645
+ exports.OnBehalfSchema = require_sleep.OnBehalfSchema;
150646
+ exports.OnBehalfSourceSchema = require_sleep.OnBehalfSourceSchema;
150288
150647
  exports.OnboardFieldSupportSchema = OnboardFieldSupportSchema;
150289
150648
  exports.OnboardRecordTrackSchema = OnboardRecordTrackSchema;
150290
150649
  exports.OnboardScheduleSupportSchema = OnboardScheduleSupportSchema;
@@ -150866,6 +151225,12 @@ exports.ShareSourceSchema = ShareSourceSchema;
150866
151225
  exports.ShareViewGrantSchema = ShareViewGrantSchema;
150867
151226
  exports.ShareViewScopeSchema = ShareViewScopeSchema;
150868
151227
  exports.ShareWeightsSchema = ShareWeightsSchema;
151228
+ exports.SirenDurationRangeSchema = SirenDurationRangeSchema;
151229
+ exports.SirenDurationUnit = SirenDurationUnit;
151230
+ exports.SirenOptionsSchema = SirenOptionsSchema;
151231
+ exports.SirenOptionsSource = SirenOptionsSource;
151232
+ exports.SirenRuntimeStateSchema = SirenRuntimeStateSchema;
151233
+ exports.SirenStatusSchema = SirenStatusSchema;
150869
151234
  exports.SiteLocationSchema = SiteLocationSchema;
150870
151235
  exports.SiteLocationSourceSchema = SiteLocationSourceSchema;
150871
151236
  exports.SiteLocationStatusSchema = SiteLocationStatusSchema;
@@ -150995,6 +151360,7 @@ exports.TRANSCODE_DOWN_MAX_HEIGHT = TRANSCODE_DOWN_MAX_HEIGHT;
150995
151360
  exports.TRIGGERED_BY_MAX_IDS = TRIGGERED_BY_MAX_IDS;
150996
151361
  exports.TagColorIdSchema = TagColorIdSchema;
150997
151362
  exports.TagEntrySchema = TagEntrySchema;
151363
+ exports.TagListCountsSchema = TagListCountsSchema;
150998
151364
  exports.TagNameSchema = TagNameSchema;
150999
151365
  exports.TagStyleSchema = TagStyleSchema;
151000
151366
  exports.TagUsageCountsSchema = TagUsageCountsSchema;
@@ -152421,6 +152787,7 @@ exports.resolveSecretMarkers = require_sleep.resolveSecretMarkers;
152421
152787
  exports.resolveSecretViewsIn = require_sleep.resolveSecretViewsIn;
152422
152788
  exports.resolveSelectStep = resolveSelectStep;
152423
152789
  exports.resolveServerName = resolveServerName;
152790
+ exports.resolveSirenSeconds = resolveSirenSeconds;
152424
152791
  exports.resolveStepArgs = resolveStepArgs;
152425
152792
  exports.resolveStepArgsWithTemplates = resolveStepArgsWithTemplates;
152426
152793
  exports.resolveStreamMaps = require_implemented_methods.resolveStreamMaps;
@@ -152540,6 +152907,9 @@ exports.shortHostname = shortHostname;
152540
152907
  exports.shortSecretRefHash = require_sleep.shortSecretRefHash;
152541
152908
  exports.signalPercentFromBars = signalPercentFromBars;
152542
152909
  exports.signalPercentFromRssi = signalPercentFromRssi;
152910
+ exports.sirenCapability = sirenCapability;
152911
+ exports.sirenIdleStatus = sirenIdleStatus;
152912
+ exports.sirenTriggeredStatus = sirenTriggeredStatus;
152543
152913
  exports.siteFor = siteFor;
152544
152914
  exports.siteZoneKey = siteZoneKey;
152545
152915
  exports.skipSignature = skipSignature;