@camstack/addon-provider-hikvision 1.2.39 → 1.2.41
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.js +512 -45
- package/dist/addon.mjs +512 -45
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -7463,6 +7463,111 @@ var CameraSwitchGroupSchema = object({
|
|
|
7463
7463
|
fetchedAt: number()
|
|
7464
7464
|
});
|
|
7465
7465
|
/**
|
|
7466
|
+
* Per-component log CHANNELS — the gate a hot path consults, and the registry
|
|
7467
|
+
* an addon declares its channels in.
|
|
7468
|
+
*
|
|
7469
|
+
* ## Two axes, deliberately separated
|
|
7470
|
+
*
|
|
7471
|
+
* - **DECLARATION** — which channels exist. Only the addon knows:
|
|
7472
|
+
* `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
|
|
7473
|
+
* baichuan/handshake. A hand-wired central list rots at the first addition,
|
|
7474
|
+
* and rots silently. So a channel is declared where it is consulted, and the
|
|
7475
|
+
* `log-channels` capability enumerates the declarations.
|
|
7476
|
+
* - **VALUE** — at which level, for which scope, until when. That stays ONE
|
|
7477
|
+
* thing: the logging settings document on the `system` cap. Two authorities
|
|
7478
|
+
* over the values is the exact defect
|
|
7479
|
+
* `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
|
|
7480
|
+
* remove; re-introducing it from the cure side would be grotesque.
|
|
7481
|
+
*
|
|
7482
|
+
* Nothing in this file reads a clock, an env var or a store. The registry is
|
|
7483
|
+
* a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
|
|
7484
|
+
* the hot path with a value somebody actually read, and by
|
|
7485
|
+
* {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
|
|
7486
|
+
* never reaches here, so it can neither disarm an armed channel nor arm a
|
|
7487
|
+
* disarmed one (D49).
|
|
7488
|
+
*
|
|
7489
|
+
* ## The canonical call shape
|
|
7490
|
+
*
|
|
7491
|
+
* ```ts
|
|
7492
|
+
* if (CH_RTP.on && CH_RTP.wants(deviceId)) {
|
|
7493
|
+
* CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
|
|
7494
|
+
* }
|
|
7495
|
+
* ```
|
|
7496
|
+
*
|
|
7497
|
+
* `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
|
|
7498
|
+
* read. Disarmed, a call site costs one load and one branch, and the `extras`
|
|
7499
|
+
* object literal is never constructed because it lives inside the branch. It
|
|
7500
|
+
* is the same shape already proven in production at `stream-broker.ts:1650`,
|
|
7501
|
+
* and the same discipline `LoggingGate.allowsDestination` uses for the
|
|
7502
|
+
* destination floor (measured at 1.93 ns/call when off).
|
|
7503
|
+
*
|
|
7504
|
+
* ## Why a channel emits at `info`
|
|
7505
|
+
*
|
|
7506
|
+
* `loki-logging.addon.ts` pins the destination default at `info` and
|
|
7507
|
+
* `loki-destination.ts` drops everything below it, so a line emitted at
|
|
7508
|
+
* `debug` never reaches Loki and the hub's in-memory ring only holds ~35
|
|
7509
|
+
* minutes. A diagnostic that cannot be read an hour later is worse than no
|
|
7510
|
+
* diagnostic, because it looks done. {@link LogChannelGate.log} therefore
|
|
7511
|
+
* emits at the channel's declared level, whose schema floor is `info`.
|
|
7512
|
+
*/
|
|
7513
|
+
/**
|
|
7514
|
+
* The level a channel writes at once armed.
|
|
7515
|
+
*
|
|
7516
|
+
* `debug` is absent ON PURPOSE and not by omission: below `info` the line does
|
|
7517
|
+
* not leave the process for Loki, and the whole point of arming a channel is
|
|
7518
|
+
* to read it later.
|
|
7519
|
+
*/
|
|
7520
|
+
var LogChannelLevelSchema = _enum([
|
|
7521
|
+
"info",
|
|
7522
|
+
"warn",
|
|
7523
|
+
"error"
|
|
7524
|
+
]);
|
|
7525
|
+
/**
|
|
7526
|
+
* What an addon declares about one channel. No value, no state — a
|
|
7527
|
+
* declaration is inert.
|
|
7528
|
+
*/
|
|
7529
|
+
var LogChannelDescriptorSchema = object({
|
|
7530
|
+
/**
|
|
7531
|
+
* Dotted `area.thing`, unique across the workspace. `area` is conventionally
|
|
7532
|
+
* the addon's short name so an operator reading a channel list can tell who
|
|
7533
|
+
* owns it without a second lookup.
|
|
7534
|
+
*/
|
|
7535
|
+
name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
|
|
7536
|
+
/** One sentence: what the operator will SEE after arming it. */
|
|
7537
|
+
description: string().min(1),
|
|
7538
|
+
/** The level its lines are emitted at. Never below `info`. */
|
|
7539
|
+
defaultLevel: LogChannelLevelSchema,
|
|
7540
|
+
/**
|
|
7541
|
+
* Whether this channel can be narrowed to a camera.
|
|
7542
|
+
*
|
|
7543
|
+
* `true` is a PROMISE with two halves, and both must hold: the gate is
|
|
7544
|
+
* consulted with the numeric device id, AND every line the channel admits
|
|
7545
|
+
* carries `tags: { deviceId }` with that same numeric id. The second half is
|
|
7546
|
+
* what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
|
|
7547
|
+
* keeps `deviceId` out of the stream labels for cardinality, so the tag in
|
|
7548
|
+
* the body is the only way to filter.
|
|
7549
|
+
*
|
|
7550
|
+
* A channel whose lines carry the device only in `meta` (or not at all) is
|
|
7551
|
+
* declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
|
|
7552
|
+
* the operator narrows to one camera, sees nothing, and concludes the code
|
|
7553
|
+
* path was never taken.
|
|
7554
|
+
*/
|
|
7555
|
+
perDevice: boolean()
|
|
7556
|
+
});
|
|
7557
|
+
/**
|
|
7558
|
+
* An armed window over one channel, as the document hands it to a mirror.
|
|
7559
|
+
*
|
|
7560
|
+
* A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
|
|
7561
|
+
* expires by itself, which is the one failure a boolean cannot avoid.
|
|
7562
|
+
*/
|
|
7563
|
+
var LogChannelWindowSchema = object({
|
|
7564
|
+
channel: string().min(1),
|
|
7565
|
+
/** Epoch ms the window closes at. */
|
|
7566
|
+
armedUntilMs: number(),
|
|
7567
|
+
/** `null` = every camera. A non-empty list narrows to those numeric ids. */
|
|
7568
|
+
deviceIds: array(number().int()).readonly().nullable()
|
|
7569
|
+
});
|
|
7570
|
+
/**
|
|
7466
7571
|
* Ops-log — the durable, append-only operations audit shared by the
|
|
7467
7572
|
* recordings and events management surfaces.
|
|
7468
7573
|
*
|
|
@@ -11270,6 +11375,35 @@ var MutationFilterSchema = object({
|
|
|
11270
11375
|
whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
|
|
11271
11376
|
whereNot: record(string(), unknown()).optional()
|
|
11272
11377
|
});
|
|
11378
|
+
/**
|
|
11379
|
+
* One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
|
|
11380
|
+
*
|
|
11381
|
+
* `as` names the slot in the result, so the SAME column may be asked twice with
|
|
11382
|
+
* two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
|
|
11383
|
+
* a `Record<column, op>` shape could not express.
|
|
11384
|
+
*/
|
|
11385
|
+
var AggregateFieldSchema = object({
|
|
11386
|
+
/** Result key. */
|
|
11387
|
+
as: string().min(1),
|
|
11388
|
+
/** Column to aggregate. Must be a real column of a declared collection. */
|
|
11389
|
+
field: string().min(1),
|
|
11390
|
+
op: _enum([
|
|
11391
|
+
"sum",
|
|
11392
|
+
"min",
|
|
11393
|
+
"max"
|
|
11394
|
+
])
|
|
11395
|
+
});
|
|
11396
|
+
/**
|
|
11397
|
+
* `COUNT(*)` plus one number per requested field.
|
|
11398
|
+
*
|
|
11399
|
+
* `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
|
|
11400
|
+
* that really is 0 are different facts, and an accounting caller that renders
|
|
11401
|
+
* "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
|
|
11402
|
+
*/
|
|
11403
|
+
var AggregateResultSchema = object({
|
|
11404
|
+
count: number().int(),
|
|
11405
|
+
values: record(string(), number().nullable())
|
|
11406
|
+
});
|
|
11273
11407
|
/** A single stored record: `{ id, data }`. */
|
|
11274
11408
|
var SettingsRecordSchema = object({
|
|
11275
11409
|
id: string(),
|
|
@@ -11354,6 +11488,11 @@ method(object({
|
|
|
11354
11488
|
collection: string(),
|
|
11355
11489
|
filter: QueryFilterSchema.optional()
|
|
11356
11490
|
}), number()), method(object({
|
|
11491
|
+
namespace: string().optional(),
|
|
11492
|
+
collection: string(),
|
|
11493
|
+
fields: array(AggregateFieldSchema).readonly(),
|
|
11494
|
+
filter: QueryFilterSchema.optional()
|
|
11495
|
+
}), AggregateResultSchema), method(object({
|
|
11357
11496
|
namespace: string().optional(),
|
|
11358
11497
|
collection: string(),
|
|
11359
11498
|
field: string(),
|
|
@@ -11470,6 +11609,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
11470
11609
|
collection: string(),
|
|
11471
11610
|
filter: QueryFilterSchema.optional()
|
|
11472
11611
|
}), number(), { auth: "admin" }), method(object({
|
|
11612
|
+
namespace: string().optional(),
|
|
11613
|
+
collection: string(),
|
|
11614
|
+
fields: array(AggregateFieldSchema).readonly(),
|
|
11615
|
+
filter: QueryFilterSchema.optional()
|
|
11616
|
+
}), AggregateResultSchema, { auth: "admin" }), method(object({
|
|
11473
11617
|
namespace: string().optional(),
|
|
11474
11618
|
collection: string(),
|
|
11475
11619
|
field: string(),
|
|
@@ -12193,24 +12337,6 @@ var deviceProviderCapability = {
|
|
|
12193
12337
|
})
|
|
12194
12338
|
}
|
|
12195
12339
|
};
|
|
12196
|
-
/**
|
|
12197
|
-
* Device Manager capability — hub-side singleton that unifies device persistence,
|
|
12198
|
-
* live registry access, and all management operations into a single tRPC surface.
|
|
12199
|
-
*
|
|
12200
|
-
* Replaces:
|
|
12201
|
-
* - `device-persistence` capability (persistence methods absorbed here)
|
|
12202
|
-
* - `device-management.router.ts` (deleted in Phase 2)
|
|
12203
|
-
* - `device-ops.router.ts` (compat layer — deleted; device-provider ops absorbed here)
|
|
12204
|
-
*
|
|
12205
|
-
* All device provider addons (rtsp, onvif, frigate, …) are hub-local: they may
|
|
12206
|
-
* fork into separate processes but never run on remote cluster agents. Therefore:
|
|
12207
|
-
* - No nodeId routing needed — this is a pure hub singleton.
|
|
12208
|
-
* - The hub's DeviceRegistry is the single source of truth for all live devices.
|
|
12209
|
-
* - No shadow registry or cross-node aggregation required.
|
|
12210
|
-
*
|
|
12211
|
-
* Forked workers register devices back to the hub via `ctx.devices`
|
|
12212
|
-
* (DeviceManagerApi → ctx.api.deviceManager.registerDevice), same as today.
|
|
12213
|
-
*/
|
|
12214
12340
|
/** One child-placement directive on a container's `childLayout`. Structurally
|
|
12215
12341
|
* identical to `ChildLayoutEntry` in `device-management.ts` — the cap wire
|
|
12216
12342
|
* shape for the same field. The child is identified by its re-sync-stable
|
|
@@ -12579,7 +12705,7 @@ method(object({
|
|
|
12579
12705
|
* it answers today and the caller filters as it already does.
|
|
12580
12706
|
*/
|
|
12581
12707
|
deviceIds: array(number()).optional()
|
|
12582
|
-
}), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
|
|
12708
|
+
}), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ parentDeviceIds: array(number()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number() }), object({
|
|
12583
12709
|
mode: LinkedDevicesModeSchema,
|
|
12584
12710
|
devices: array(LinkedDeviceSchema)
|
|
12585
12711
|
})), method(object({ deviceIds: array(number()) }), array(LinkedDevicesForDeviceSchema)), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
|
|
@@ -13303,6 +13429,59 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
|
|
|
13303
13429
|
kind: "mutation",
|
|
13304
13430
|
auth: "admin"
|
|
13305
13431
|
});
|
|
13432
|
+
/**
|
|
13433
|
+
* `log-channels` — the capability an addon DECLARES its diagnostic channels
|
|
13434
|
+
* through. It stores nothing.
|
|
13435
|
+
*
|
|
13436
|
+
* ## Why a capability at all, and why this shape
|
|
13437
|
+
*
|
|
13438
|
+
* Which channels exist is knowledge only the addon has: `stream-broker` knows
|
|
13439
|
+
* webrtc/ICE/RTP, `provider-reolink` knows baichuan/handshake. A central list
|
|
13440
|
+
* maintained by hand rots at the first addition and rots INVISIBLY — nothing
|
|
13441
|
+
* fails, an operator just never sees the channel somebody added. So the list
|
|
13442
|
+
* is assembled from declarations at runtime.
|
|
13443
|
+
*
|
|
13444
|
+
* The shape is copied from `log-destination.cap.ts`, which already does
|
|
13445
|
+
* exactly this job: `mode: 'collection'`, `internal: true`,
|
|
13446
|
+
* `mount: { kind: 'skip' }` — no tRPC route, no generated hooks — while
|
|
13447
|
+
* `addons.listCapabilityProviders` still enumerates it, and the hub's
|
|
13448
|
+
* `CapabilityRegistry` still holds an RPC proxy per provider so a forked
|
|
13449
|
+
* runner's declarations reach hub-main over the transport that already exists.
|
|
13450
|
+
* No new UDS message, no second registry.
|
|
13451
|
+
*
|
|
13452
|
+
* ## What it deliberately does NOT own
|
|
13453
|
+
*
|
|
13454
|
+
* The VALUES — which channel is armed, for which cameras, until when — live in
|
|
13455
|
+
* ONE place: the logging settings document on the `system` cap
|
|
13456
|
+
* (`getLoggingSettings` / `setLoggingSettings`). Two authorities over the same
|
|
13457
|
+
* value is the defect the plan behind this work exists to remove, and
|
|
13458
|
+
* `setRequestCensus` was retired (D245) rather than allowed to be a second
|
|
13459
|
+
* one. {@link logChannelsCapability} therefore has no getter for a level, no
|
|
13460
|
+
* setter for a window and no persistence of any kind.
|
|
13461
|
+
*
|
|
13462
|
+
* ## Why `apply` is here even so
|
|
13463
|
+
*
|
|
13464
|
+
* The gate lives in the addon's PROCESS; the document lives in hub-main. Some
|
|
13465
|
+
* seam has to carry the value from the authority to the mirror, and a channel
|
|
13466
|
+
* that cannot be reached is precisely the dead knob this whole slice exists to
|
|
13467
|
+
* make impossible (D62 — `audioThresholdDbfs`, the HA entities with no source).
|
|
13468
|
+
* `apply` is that seam and nothing more: it writes an in-memory mirror, it
|
|
13469
|
+
* persists nothing, it is never the source of a value, and it is called only
|
|
13470
|
+
* with a set the hub actually read (D49 — a read that fails does not call it
|
|
13471
|
+
* at all, so no channel is silently disarmed by a bad read).
|
|
13472
|
+
*/
|
|
13473
|
+
/** What `apply` reports back — enough to log, not enough to be a second state. */
|
|
13474
|
+
var LogChannelApplyResultSchema = object({
|
|
13475
|
+
/** How many declared channels are armed in this process after the call. */
|
|
13476
|
+
armed: number().int().min(0),
|
|
13477
|
+
/**
|
|
13478
|
+
* Names the document armed that this process does not declare. Reported
|
|
13479
|
+
* rather than swallowed: a name here is either a typo or an addon that has
|
|
13480
|
+
* not booted, and both deserve a line instead of silence.
|
|
13481
|
+
*/
|
|
13482
|
+
unknown: array(string()).readonly()
|
|
13483
|
+
});
|
|
13484
|
+
method(_void(), array(LogChannelDescriptorSchema).readonly()), method(object({ windows: array(LogChannelWindowSchema).readonly() }), LogChannelApplyResultSchema, { kind: "mutation" });
|
|
13306
13485
|
var LogLevelSchema = _enum([
|
|
13307
13486
|
"debug",
|
|
13308
13487
|
"info",
|
|
@@ -29020,17 +29199,60 @@ var SetSiteLocationInputSchema = object({
|
|
|
29020
29199
|
longitude: number().min(-180).max(180)
|
|
29021
29200
|
}).nullable();
|
|
29022
29201
|
/**
|
|
29023
|
-
*
|
|
29202
|
+
* The TRANSPORT a call arrived on.
|
|
29203
|
+
*
|
|
29204
|
+
* Every counted call carries exactly one of these, and `unknown` is a PLANE
|
|
29205
|
+
* rather than a gap: a plane that cannot attribute a call declares it here, so
|
|
29206
|
+
* the call lands in a named bucket instead of vanishing. `planes` summing to
|
|
29207
|
+
* `procedureCalls` is what makes "the sum of the planes explains the total"
|
|
29208
|
+
* checkable rather than asserted.
|
|
29209
|
+
*
|
|
29210
|
+
* - `http` — the Fastify tRPC plugin (`/trpc/*`), one context per request.
|
|
29211
|
+
* - `ws` — `applyWSSHandler`, counted per OPERATION rather than per
|
|
29212
|
+
* connection; the viewer talks to the hub over `wsLink`
|
|
29213
|
+
* exclusively, so this is the plane the HTTP census could not see.
|
|
29214
|
+
* - `mesh` — the in-process `$core-caps` bridge (`createCaller`), which
|
|
29215
|
+
* never touches a socket and therefore never touched a census.
|
|
29216
|
+
* - `unknown` — counted, plane undecidable. No hook produces it today, and
|
|
29217
|
+
* that is exactly what its `0` asserts: every plane the hub has can name
|
|
29218
|
+
* itself. It is an output bucket, never a knob — a call that arrives on a
|
|
29219
|
+
* plane nobody instrumented lands here instead of vanishing from the total.
|
|
29220
|
+
*/
|
|
29221
|
+
var TransportPlaneSchema = _enum([
|
|
29222
|
+
"http",
|
|
29223
|
+
"ws",
|
|
29224
|
+
"mesh",
|
|
29225
|
+
"unknown"
|
|
29226
|
+
]);
|
|
29227
|
+
/**
|
|
29228
|
+
* Calls per plane. Every key is always present, `0` included — an absent plane
|
|
29229
|
+
* reads as "not instrumented", which is the one thing this census must never
|
|
29230
|
+
* make an operator wonder about.
|
|
29231
|
+
*/
|
|
29232
|
+
var TransportPlaneCountsSchema = object({
|
|
29233
|
+
http: number(),
|
|
29234
|
+
ws: number(),
|
|
29235
|
+
mesh: number(),
|
|
29236
|
+
unknown: number()
|
|
29237
|
+
});
|
|
29238
|
+
/**
|
|
29239
|
+
* One `(plane, procedure, user-agent, ip, principal)` tuple of the transport
|
|
29024
29240
|
* census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
|
|
29025
29241
|
* `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
|
|
29026
29242
|
* already prints - never a token, never an `Authorization` header.
|
|
29243
|
+
*
|
|
29244
|
+
* `subscriptions` is counted APART from `calls`: a subscription is opened once
|
|
29245
|
+
* and lives for hours, so folding it into a call count makes one long-lived
|
|
29246
|
+
* stream look like a storm.
|
|
29027
29247
|
*/
|
|
29028
29248
|
var RequestCensusGroupSchema = object({
|
|
29249
|
+
plane: TransportPlaneSchema,
|
|
29029
29250
|
procedure: string(),
|
|
29030
29251
|
userAgent: string(),
|
|
29031
29252
|
ip: string(),
|
|
29032
29253
|
principal: string(),
|
|
29033
29254
|
calls: number(),
|
|
29255
|
+
subscriptions: number(),
|
|
29034
29256
|
perMin: number()
|
|
29035
29257
|
});
|
|
29036
29258
|
/**
|
|
@@ -29043,6 +29265,14 @@ var RequestCensusGroupSchema = object({
|
|
|
29043
29265
|
var RequestCensusProcedureSchema = object({
|
|
29044
29266
|
procedure: string(),
|
|
29045
29267
|
calls: number(),
|
|
29268
|
+
/**
|
|
29269
|
+
* The same total, split by transport. THIS is the row that answers the
|
|
29270
|
+
* question the census exists for: one look at `deviceManager.listAll` says
|
|
29271
|
+
* which plane carried the 4 960, without joining two log lines by eye.
|
|
29272
|
+
*/
|
|
29273
|
+
planes: TransportPlaneCountsSchema,
|
|
29274
|
+
/** Subscription STARTS on this procedure. Never folded into `calls`. */
|
|
29275
|
+
subscriptions: number(),
|
|
29046
29276
|
perMin: number()
|
|
29047
29277
|
});
|
|
29048
29278
|
/**
|
|
@@ -29070,14 +29300,45 @@ var RequestCensusStatusSchema = object({
|
|
|
29070
29300
|
*/
|
|
29071
29301
|
procedureCalls: number(),
|
|
29072
29302
|
/**
|
|
29303
|
+
* `procedureCalls` split by transport. The four keys sum to
|
|
29304
|
+
* `procedureCalls` by construction - {@link RequestCensusSnapshotSchema}'s
|
|
29305
|
+
* `planesExplainTotal` is that identity, checked rather than assumed.
|
|
29306
|
+
*/
|
|
29307
|
+
planes: TransportPlaneCountsSchema,
|
|
29308
|
+
/**
|
|
29309
|
+
* True iff `planes` sums to `procedureCalls`. False means a call was counted
|
|
29310
|
+
* on no plane at all - which is a RESULT (a plane is missing from the
|
|
29311
|
+
* instrument), not a failure, and it has to be visible to be read as one.
|
|
29312
|
+
*/
|
|
29313
|
+
planesExplainTotal: boolean(),
|
|
29314
|
+
/**
|
|
29073
29315
|
* tRPC WebSocket connections opened during the window. NOT calls - the WS
|
|
29074
|
-
*
|
|
29075
|
-
*
|
|
29316
|
+
* adapter resolves one context per connection - kept because a plane's call
|
|
29317
|
+
* count of zero against 37 open connections says something different from a
|
|
29318
|
+
* plane with no connections at all.
|
|
29076
29319
|
*/
|
|
29077
29320
|
wsConnections: number(),
|
|
29321
|
+
/**
|
|
29322
|
+
* Client frames the WS plane looked at. `wsMessages` far above
|
|
29323
|
+
* `planes.ws + subscriptions` means most traffic is not operations
|
|
29324
|
+
* (keepalives, connection params) - which is itself an answer.
|
|
29325
|
+
*/
|
|
29326
|
+
wsMessages: number(),
|
|
29327
|
+
/**
|
|
29328
|
+
* Subscription STARTS across every plane, excluded from `procedureCalls` on
|
|
29329
|
+
* purpose: one live-events stream opened at boot and held for six hours is
|
|
29330
|
+
* one subscription, and counting it as a call would let a quiet plane
|
|
29331
|
+
* masquerade as the storm.
|
|
29332
|
+
*/
|
|
29333
|
+
subscriptions: number(),
|
|
29334
|
+
/** `subscription.stop` frames. Starts minus stops is what is still open. */
|
|
29335
|
+
subscriptionStops: number(),
|
|
29078
29336
|
distinctGroups: number(),
|
|
29079
|
-
/**
|
|
29080
|
-
*
|
|
29337
|
+
/**
|
|
29338
|
+
* Operations counted in the totals whose CALLER attribution was shed at the
|
|
29339
|
+
* cardinality bound. Unrelated to the `unknown` PLANE: these calls know
|
|
29340
|
+
* which transport they arrived on, they just lost their group row.
|
|
29341
|
+
*/
|
|
29081
29342
|
unattributedCalls: number(),
|
|
29082
29343
|
procedures: array(RequestCensusProcedureSchema).readonly(),
|
|
29083
29344
|
groups: array(RequestCensusGroupSchema).readonly()
|
|
@@ -29100,10 +29361,11 @@ var DiagnosticIdSchema = _enum(["request-census"]);
|
|
|
29100
29361
|
* The layers of the level hierarchy, general → specific. The most specific
|
|
29101
29362
|
* layer that carries an explicit value wins.
|
|
29102
29363
|
*
|
|
29103
|
-
* `component`
|
|
29104
|
-
*
|
|
29105
|
-
*
|
|
29106
|
-
*
|
|
29364
|
+
* `component` became RESOLVABLE on 2026-08-27: a component is a declared log
|
|
29365
|
+
* CHANNEL (`stream-broker.webrtc`, `provider-reolink.baichuan`), named by
|
|
29366
|
+
* `scopeComponent`. It was declared-but-dark in the first slice precisely so
|
|
29367
|
+
* that turning it on would not force every consumer of this document to widen
|
|
29368
|
+
* a `levelSource` enum — which is what has now not happened.
|
|
29107
29369
|
*/
|
|
29108
29370
|
var LoggingScopeKindSchema = _enum([
|
|
29109
29371
|
"cluster",
|
|
@@ -29130,6 +29392,14 @@ var LoggingLevelLayerSchema = object({
|
|
|
29130
29392
|
scope: LoggingScopeKindSchema,
|
|
29131
29393
|
/** The node this layer speaks for; `null` on the cluster layer. */
|
|
29132
29394
|
nodeId: string().nullable(),
|
|
29395
|
+
/**
|
|
29396
|
+
* The declared channel this layer speaks for; `null` on every layer but
|
|
29397
|
+
* `component`. Never folded into `nodeId`: a component level is CLUSTER-WIDE
|
|
29398
|
+
* by design — the convention this repo settled on is one orchestrator-wide
|
|
29399
|
+
* setting, never per node (D52) — so a component layer that carried a node
|
|
29400
|
+
* would invite a per-node copy of a value that has no per-node meaning.
|
|
29401
|
+
*/
|
|
29402
|
+
component: string().nullable(),
|
|
29133
29403
|
/** Explicitly set here, or `null` when this layer inherits. */
|
|
29134
29404
|
level: LogLevelSchema$1.nullable()
|
|
29135
29405
|
});
|
|
@@ -29171,6 +29441,49 @@ var DiagnosticWindowPatchSchema = object({
|
|
|
29171
29441
|
reportEveryMs: number().int().positive().optional()
|
|
29172
29442
|
});
|
|
29173
29443
|
/**
|
|
29444
|
+
* A channel ARMED, as the document reports it.
|
|
29445
|
+
*
|
|
29446
|
+
* `armMs` is not echoed back: what an operator needs to see is the deadline
|
|
29447
|
+
* and the time left, because a diagnostic left running is itself an incident
|
|
29448
|
+
* and "armed for 10 minutes" said an hour ago is not an answer.
|
|
29449
|
+
*/
|
|
29450
|
+
var LogChannelWindowStateSchema = object({
|
|
29451
|
+
channel: string(),
|
|
29452
|
+
armed: boolean(),
|
|
29453
|
+
/** Epoch ms the window closes at. 0 when disarmed. */
|
|
29454
|
+
armedUntilMs: number(),
|
|
29455
|
+
/** Ms left before it expires on its own. 0 when disarmed. */
|
|
29456
|
+
remainingMs: number(),
|
|
29457
|
+
/**
|
|
29458
|
+
* The cameras it is narrowed to, or `null` for every camera.
|
|
29459
|
+
*
|
|
29460
|
+
* A channel declared `perDevice: false` can only ever report `null` here:
|
|
29461
|
+
* its lines do not carry `tags: { deviceId }`, so narrowing them would
|
|
29462
|
+
* produce a filter that silently matches nothing. The server REFUSES such a
|
|
29463
|
+
* patch rather than quietly widening it — ignoring the request would teach
|
|
29464
|
+
* the operator that per-camera filtering works on that channel when it does
|
|
29465
|
+
* not.
|
|
29466
|
+
*/
|
|
29467
|
+
deviceIds: array(number().int()).readonly().nullable()
|
|
29468
|
+
});
|
|
29469
|
+
/**
|
|
29470
|
+
* `armMs: 0` DISARMS. Same grammar as {@link DiagnosticWindowPatchSchema}, and
|
|
29471
|
+
* for the same reason: a channel is a window with a deadline, never a switch.
|
|
29472
|
+
*/
|
|
29473
|
+
var LogChannelWindowPatchSchema = object({
|
|
29474
|
+
channel: string().min(1),
|
|
29475
|
+
armMs: number().int().min(0),
|
|
29476
|
+
/**
|
|
29477
|
+
* Narrow to these numeric device ids. Absent or `null` = every camera.
|
|
29478
|
+
*
|
|
29479
|
+
* Numeric because the repo's own rule makes it possible: every log line
|
|
29480
|
+
* about a device carries `tags: { deviceId }` with the numeric id. That rule
|
|
29481
|
+
* was paid for with a 22% thumbnail gap and a 3-hour media blackout both
|
|
29482
|
+
* diagnosed by hand, and this is the first thing that collects on it.
|
|
29483
|
+
*/
|
|
29484
|
+
deviceIds: array(number().int()).readonly().nullable().optional()
|
|
29485
|
+
});
|
|
29486
|
+
/**
|
|
29174
29487
|
* A PATCH, and patches MERGE.
|
|
29175
29488
|
*
|
|
29176
29489
|
* A field absent from the patch is left exactly as it was — arming a
|
|
@@ -29189,7 +29502,14 @@ var LoggingSettingsPatchSchema = object({
|
|
|
29189
29502
|
* Only the diagnostics NAMED here change. An armed window that is not listed
|
|
29190
29503
|
* keeps running — a patch is never a full replacement.
|
|
29191
29504
|
*/
|
|
29192
|
-
diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional()
|
|
29505
|
+
diagnostics: array(DiagnosticWindowPatchSchema).readonly().optional(),
|
|
29506
|
+
/**
|
|
29507
|
+
* Only the channels NAMED here change. An armed channel that is not listed
|
|
29508
|
+
* keeps running — same rule as `diagnostics`, because a patch that silently
|
|
29509
|
+
* disarmed the channels it did not mention would make the Levels page and
|
|
29510
|
+
* the Diagnostics page fight over the same value.
|
|
29511
|
+
*/
|
|
29512
|
+
channels: array(LogChannelWindowPatchSchema).readonly().optional()
|
|
29193
29513
|
});
|
|
29194
29514
|
/**
|
|
29195
29515
|
* Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
|
|
@@ -29202,9 +29522,22 @@ var LoggingSettingsPatchSchema = object({
|
|
|
29202
29522
|
* authority over the whole hierarchy and answers for every layer, so the
|
|
29203
29523
|
* layer selector needs a name the transport does not already own.
|
|
29204
29524
|
*/
|
|
29205
|
-
var GetLoggingSettingsInputSchema = object({
|
|
29525
|
+
var GetLoggingSettingsInputSchema = object({
|
|
29526
|
+
scopeNodeId: string().optional(),
|
|
29527
|
+
/**
|
|
29528
|
+
* The declared CHANNEL this document is addressed at, when the caller wants
|
|
29529
|
+
* the `component` layer. Absent = the node/cluster hierarchy only.
|
|
29530
|
+
*
|
|
29531
|
+
* Naming it separately rather than overloading `scopeNodeId` keeps the two
|
|
29532
|
+
* axes from collapsing: a component level is cluster-wide, a node level is
|
|
29533
|
+
* not, and one selector for both would make "which of these two did I just
|
|
29534
|
+
* set" unanswerable — the exact ambiguity `explicit` exists to remove.
|
|
29535
|
+
*/
|
|
29536
|
+
scopeComponent: string().optional()
|
|
29537
|
+
});
|
|
29206
29538
|
var SetLoggingSettingsInputSchema = object({
|
|
29207
29539
|
scopeNodeId: string().optional(),
|
|
29540
|
+
scopeComponent: string().optional(),
|
|
29208
29541
|
patch: LoggingSettingsPatchSchema
|
|
29209
29542
|
});
|
|
29210
29543
|
/**
|
|
@@ -29219,9 +29552,20 @@ var SetLoggingSettingsInputSchema = object({
|
|
|
29219
29552
|
var LoggingSettingsStateSchema = object({
|
|
29220
29553
|
/** The layer this document was read at. `null` = the cluster layer. */
|
|
29221
29554
|
scopeNodeId: string().nullable(),
|
|
29555
|
+
/** The channel this document was read at. `null` = no component layer. */
|
|
29556
|
+
scopeComponent: string().nullable(),
|
|
29222
29557
|
effective: LoggingEffectiveSchema,
|
|
29223
29558
|
explicit: LoggingExplicitSchema,
|
|
29224
29559
|
activeWindows: array(DiagnosticWindowSchema).readonly(),
|
|
29560
|
+
/**
|
|
29561
|
+
* Every channel the cluster's addons DECLARE, gathered from the
|
|
29562
|
+
* `log-channels` providers. Not stored anywhere: assembled per read, so a
|
|
29563
|
+
* channel added by a redeployed addon appears without anybody editing a
|
|
29564
|
+
* list, and a channel whose addon is gone stops being offered.
|
|
29565
|
+
*/
|
|
29566
|
+
channels: array(LogChannelDescriptorSchema).readonly(),
|
|
29567
|
+
/** The channels ARMED right now, each with its deadline. */
|
|
29568
|
+
activeChannels: array(LogChannelWindowStateSchema).readonly(),
|
|
29225
29569
|
persisted: boolean()
|
|
29226
29570
|
});
|
|
29227
29571
|
method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string(), unknown()), _null(), {
|
|
@@ -32439,6 +32783,12 @@ Object.freeze({
|
|
|
32439
32783
|
addonId: null,
|
|
32440
32784
|
access: "view"
|
|
32441
32785
|
},
|
|
32786
|
+
"dataStoreProvider.aggregate": {
|
|
32787
|
+
capName: "data-store-provider",
|
|
32788
|
+
capScope: "system",
|
|
32789
|
+
addonId: null,
|
|
32790
|
+
access: "view"
|
|
32791
|
+
},
|
|
32442
32792
|
"dataStoreProvider.count": {
|
|
32443
32793
|
capName: "data-store-provider",
|
|
32444
32794
|
capScope: "system",
|
|
@@ -32853,6 +33203,12 @@ Object.freeze({
|
|
|
32853
33203
|
addonId: null,
|
|
32854
33204
|
access: "view"
|
|
32855
33205
|
},
|
|
33206
|
+
"deviceManager.getChildrenBatch": {
|
|
33207
|
+
capName: "device-manager",
|
|
33208
|
+
capScope: "system",
|
|
33209
|
+
addonId: null,
|
|
33210
|
+
access: "view"
|
|
33211
|
+
},
|
|
32856
33212
|
"deviceManager.getConfigSchema": {
|
|
32857
33213
|
capName: "device-manager",
|
|
32858
33214
|
capScope: "system",
|
|
@@ -33903,6 +34259,18 @@ Object.freeze({
|
|
|
33903
34259
|
addonId: null,
|
|
33904
34260
|
access: "create"
|
|
33905
34261
|
},
|
|
34262
|
+
"logChannels.apply": {
|
|
34263
|
+
capName: "log-channels",
|
|
34264
|
+
capScope: "system",
|
|
34265
|
+
addonId: null,
|
|
34266
|
+
access: "create"
|
|
34267
|
+
},
|
|
34268
|
+
"logChannels.list": {
|
|
34269
|
+
capName: "log-channels",
|
|
34270
|
+
capScope: "system",
|
|
34271
|
+
addonId: null,
|
|
34272
|
+
access: "view"
|
|
34273
|
+
},
|
|
33906
34274
|
"logDestination.query": {
|
|
33907
34275
|
capName: "log-destination",
|
|
33908
34276
|
capScope: "system",
|
|
@@ -36057,6 +36425,12 @@ Object.freeze({
|
|
|
36057
36425
|
addonId: null,
|
|
36058
36426
|
access: "create"
|
|
36059
36427
|
},
|
|
36428
|
+
"settingsStore.aggregate": {
|
|
36429
|
+
capName: "settings-store",
|
|
36430
|
+
capScope: "system",
|
|
36431
|
+
addonId: null,
|
|
36432
|
+
access: "view"
|
|
36433
|
+
},
|
|
36060
36434
|
"settingsStore.count": {
|
|
36061
36435
|
capName: "settings-store",
|
|
36062
36436
|
capScope: "system",
|
|
@@ -37636,6 +38010,11 @@ Object.freeze({
|
|
|
37636
38010
|
form: "single",
|
|
37637
38011
|
optional: false
|
|
37638
38012
|
}],
|
|
38013
|
+
"deviceManager.getChildrenBatch": [{
|
|
38014
|
+
name: "parentDeviceIds",
|
|
38015
|
+
form: "array",
|
|
38016
|
+
optional: false
|
|
38017
|
+
}],
|
|
37639
38018
|
"deviceManager.getConfigSchema": [{
|
|
37640
38019
|
name: "deviceId",
|
|
37641
38020
|
form: "single",
|
|
@@ -40102,6 +40481,38 @@ function createAccessoryDevice(kind, ctx, parent) {
|
|
|
40102
40481
|
default: throw new Error(`Hikvision provider does not implement accessory kind "${String(kind)}"`);
|
|
40103
40482
|
}
|
|
40104
40483
|
}
|
|
40484
|
+
function createAlarmTypeTally(deps) {
|
|
40485
|
+
const intervalMs = deps.intervalMs ?? 3e5;
|
|
40486
|
+
const lastLoggedAt = /* @__PURE__ */ new Map();
|
|
40487
|
+
const suppressed = /* @__PURE__ */ new Map();
|
|
40488
|
+
const note = (type, state, reason) => {
|
|
40489
|
+
const logger = deps.logger;
|
|
40490
|
+
if (!logger) return;
|
|
40491
|
+
const key = `${type}/${state ?? "none"}`;
|
|
40492
|
+
const now = Date.now();
|
|
40493
|
+
const last = lastLoggedAt.get(key);
|
|
40494
|
+
if (last !== void 0 && now - last < intervalMs) {
|
|
40495
|
+
suppressed.set(key, (suppressed.get(key) ?? 0) + 1);
|
|
40496
|
+
return;
|
|
40497
|
+
}
|
|
40498
|
+
const count = (suppressed.get(key) ?? 0) + 1;
|
|
40499
|
+
suppressed.set(key, 0);
|
|
40500
|
+
lastLoggedAt.set(key, now);
|
|
40501
|
+
const extras = {
|
|
40502
|
+
...deps.deviceId === null ? {} : { tags: { deviceId: deps.deviceId } },
|
|
40503
|
+
meta: {
|
|
40504
|
+
type,
|
|
40505
|
+
state,
|
|
40506
|
+
count,
|
|
40507
|
+
...last === void 0 ? { first: true } : { windowMs: now - last },
|
|
40508
|
+
...reason === void 0 ? {} : { reason }
|
|
40509
|
+
}
|
|
40510
|
+
};
|
|
40511
|
+
if (deps.level === "debug") logger.debug(deps.message, extras);
|
|
40512
|
+
else logger.info(deps.message, extras);
|
|
40513
|
+
};
|
|
40514
|
+
return { note };
|
|
40515
|
+
}
|
|
40105
40516
|
//#endregion
|
|
40106
40517
|
//#region src/hikvision-channel-fps.ts
|
|
40107
40518
|
/**
|
|
@@ -40187,6 +40598,24 @@ function buildAuthHeader(input) {
|
|
|
40187
40598
|
return `Digest ${parts.join(", ")}`;
|
|
40188
40599
|
}
|
|
40189
40600
|
//#endregion
|
|
40601
|
+
//#region src/hikvision-alarm-ignore.ts
|
|
40602
|
+
var IGNORED_ALARMS = new Map([["videoloss", {
|
|
40603
|
+
states: ["inactive"],
|
|
40604
|
+
reason: "alertStream keep-alive: \"no video loss\" repeated every ~5s by firmware whether or not anything happened. It carries no edge and no state we do not already hold — the stream being alive is already tracked by the idle watchdog, and camera liveness by markOnline(). Measured at 83 200 events / 12 h (116/min) across the fleet, all byte-identical."
|
|
40605
|
+
}]]);
|
|
40606
|
+
/**
|
|
40607
|
+
* The reason this `(type, state)` is deliberately not acted on, or `null` when
|
|
40608
|
+
* the event must be delivered.
|
|
40609
|
+
*
|
|
40610
|
+
* Both arguments are expected lowercased, matching `eventType` / `eventState`
|
|
40611
|
+
* as normalised by the alert parser.
|
|
40612
|
+
*/
|
|
40613
|
+
function hikvisionIgnoredAlarmReason(type, state) {
|
|
40614
|
+
const policy = IGNORED_ALARMS.get(type);
|
|
40615
|
+
if (!policy) return null;
|
|
40616
|
+
return policy.states.includes(state) ? policy.reason : null;
|
|
40617
|
+
}
|
|
40618
|
+
//#endregion
|
|
40190
40619
|
//#region src/hikvision-snapshot-channel.ts
|
|
40191
40620
|
/**
|
|
40192
40621
|
* Hikvision encodes a channel id as `{cameraNumber}{streamSlot}`; slot `1` is
|
|
@@ -42273,6 +42702,13 @@ async function pumpAlarmStream(stream, declaredBoundary, handlers, options) {
|
|
|
42273
42702
|
const retainBytes = options.retainBytes ?? 65536;
|
|
42274
42703
|
const unparsedWarnBytes = options.unparsedWarnBytes ?? 32768;
|
|
42275
42704
|
const diagnostics = createAlarmDiagnostics(options.logger ?? null, options.deviceId ?? null, options.diagnosticIntervalMs ?? 6e4);
|
|
42705
|
+
const ignoredTally = createAlarmTypeTally({
|
|
42706
|
+
logger: options.logger ?? null,
|
|
42707
|
+
deviceId: options.deviceId ?? null,
|
|
42708
|
+
message: "hikvision alarm stream: ignored alarm type (declared policy)",
|
|
42709
|
+
level: "debug",
|
|
42710
|
+
...options.ignoredTallyIntervalMs === void 0 ? {} : { intervalMs: options.ignoredTallyIntervalMs }
|
|
42711
|
+
});
|
|
42276
42712
|
const reader = stream.getReader();
|
|
42277
42713
|
let activeBoundary = declaredBoundary;
|
|
42278
42714
|
let activeDashBoundary = `--${activeBoundary}`;
|
|
@@ -42315,8 +42751,8 @@ async function pumpAlarmStream(stream, declaredBoundary, handlers, options) {
|
|
|
42315
42751
|
});
|
|
42316
42752
|
return;
|
|
42317
42753
|
}
|
|
42318
|
-
const
|
|
42319
|
-
if (!
|
|
42754
|
+
const peeked = peekAlertTypeState(bodyText);
|
|
42755
|
+
if (!peeked) {
|
|
42320
42756
|
diagnostics.report("alert-xml-without-event-type", "hikvision alarm stream: alert part dropped — no <eventType> tag", {
|
|
42321
42757
|
contentType,
|
|
42322
42758
|
bytes: block.byteLength,
|
|
@@ -42324,7 +42760,12 @@ async function pumpAlarmStream(stream, declaredBoundary, handlers, options) {
|
|
|
42324
42760
|
});
|
|
42325
42761
|
return;
|
|
42326
42762
|
}
|
|
42327
|
-
|
|
42763
|
+
const ignoredReason = hikvisionIgnoredAlarmReason(peeked.type, peeked.state);
|
|
42764
|
+
if (ignoredReason !== null) {
|
|
42765
|
+
ignoredTally.note(peeked.type, peeked.state, ignoredReason);
|
|
42766
|
+
return;
|
|
42767
|
+
}
|
|
42768
|
+
handlers.onEvent(parseAlertXml(bodyText, peeked));
|
|
42328
42769
|
};
|
|
42329
42770
|
let idleTimer = null;
|
|
42330
42771
|
const armIdle = () => {
|
|
@@ -42509,10 +42950,22 @@ function isHikvisionMotionAlarmType(type) {
|
|
|
42509
42950
|
function isHikvisionSmartAlarmType(type) {
|
|
42510
42951
|
return type !== "vmd" && type !== "motiondetection" && isHikvisionMotionAlarmType(type);
|
|
42511
42952
|
}
|
|
42512
|
-
function
|
|
42953
|
+
function peekAlertTypeState(xml) {
|
|
42513
42954
|
const type = extractTag(xml, "eventType");
|
|
42514
42955
|
if (!type) return null;
|
|
42515
42956
|
const state = extractTag(xml, "eventState");
|
|
42957
|
+
return {
|
|
42958
|
+
type: type.toLowerCase(),
|
|
42959
|
+
state: state?.toLowerCase() ?? null
|
|
42960
|
+
};
|
|
42961
|
+
}
|
|
42962
|
+
/**
|
|
42963
|
+
* Build the full event. Takes the already-peeked `(type, state)` so the two
|
|
42964
|
+
* tags are extracted exactly once, and so this function has no failure mode
|
|
42965
|
+
* left: `peekAlertTypeState` returning non-null IS the precondition, and the
|
|
42966
|
+
* caller has already reported the only way it can fail.
|
|
42967
|
+
*/
|
|
42968
|
+
function parseAlertXml(xml, peeked) {
|
|
42516
42969
|
const channelId = extractTag(xml, "dynChannelID") ?? extractTag(xml, "channelID");
|
|
42517
42970
|
const description = extractTag(xml, "eventDescription") ?? extractTag(xml, "description");
|
|
42518
42971
|
const aiClass = extractTag(xml, "targetType") ?? extractTag(xml, "className");
|
|
@@ -42524,8 +42977,8 @@ function parseAlertXml(xml) {
|
|
|
42524
42977
|
})();
|
|
42525
42978
|
return {
|
|
42526
42979
|
observedAt: Date.now(),
|
|
42527
|
-
type: type
|
|
42528
|
-
state: state
|
|
42980
|
+
type: peeked.type,
|
|
42981
|
+
state: peeked.state,
|
|
42529
42982
|
channelId,
|
|
42530
42983
|
aiClass,
|
|
42531
42984
|
description,
|
|
@@ -44053,6 +44506,25 @@ var HikvisionCamera = class HikvisionCamera extends BaseDevice {
|
|
|
44053
44506
|
alarmReconnectAttempts = 0;
|
|
44054
44507
|
/** Pending alarm-reconnect timer. */
|
|
44055
44508
|
alarmReconnectTimer = null;
|
|
44509
|
+
/**
|
|
44510
|
+
* Counting reporter for alarm types the camera receives but does not model.
|
|
44511
|
+
*
|
|
44512
|
+
* Built lazily so it can capture `this.id` / `this.ctx.logger` — every line
|
|
44513
|
+
* it emits carries the numeric `deviceId`. It keeps the historical message
|
|
44514
|
+
* text (`hikvision: unhandled alarm event`) so existing Loki queries keep
|
|
44515
|
+
* working; what changed is that the line now carries `meta.count` and arrives
|
|
44516
|
+
* once per window instead of once per event.
|
|
44517
|
+
*/
|
|
44518
|
+
unhandledAlarmsTally = null;
|
|
44519
|
+
get unhandledAlarms() {
|
|
44520
|
+
this.unhandledAlarmsTally ??= createAlarmTypeTally({
|
|
44521
|
+
logger: this.ctx.logger,
|
|
44522
|
+
deviceId: this.id,
|
|
44523
|
+
message: "hikvision: unhandled alarm event",
|
|
44524
|
+
level: "info"
|
|
44525
|
+
});
|
|
44526
|
+
return this.unhandledAlarmsTally;
|
|
44527
|
+
}
|
|
44056
44528
|
/** Hysteresis: drop motion-active back to inactive after this many ms with
|
|
44057
44529
|
* no fresh `VMD` event. Hikvision fires VMD every ~1s while motion is
|
|
44058
44530
|
* active; missing 2 ticks signals the burst is over. */
|
|
@@ -46278,22 +46750,17 @@ var HikvisionCamera = class HikvisionCamera extends BaseDevice {
|
|
|
46278
46750
|
return;
|
|
46279
46751
|
}
|
|
46280
46752
|
if (ev.type === "videoloss") {
|
|
46281
|
-
this.ctx.logger.
|
|
46753
|
+
this.ctx.logger.warn("hikvision: camera reports video signal loss", {
|
|
46282
46754
|
tags: { deviceId: this.id },
|
|
46283
46755
|
meta: {
|
|
46284
46756
|
type: ev.type,
|
|
46285
|
-
state: ev.state
|
|
46757
|
+
state: ev.state,
|
|
46758
|
+
camStreamId
|
|
46286
46759
|
}
|
|
46287
46760
|
});
|
|
46288
46761
|
return;
|
|
46289
46762
|
}
|
|
46290
|
-
this.
|
|
46291
|
-
tags: { deviceId: this.id },
|
|
46292
|
-
meta: {
|
|
46293
|
-
type: ev.type,
|
|
46294
|
-
state: ev.state
|
|
46295
|
-
}
|
|
46296
|
-
});
|
|
46763
|
+
this.unhandledAlarms.note(ev.type, ev.state);
|
|
46297
46764
|
}
|
|
46298
46765
|
resolveAlarmCamStreamId(channelId) {
|
|
46299
46766
|
if (!channelId) return "native:main";
|