@camstack/types 1.2.280 → 1.2.282
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/capabilities/backup.cap.d.ts +28 -0
- package/dist/capabilities/database-snapshot.cap.d.ts +136 -0
- package/dist/capabilities/index.d.ts +15 -13
- package/dist/capabilities/notification-rules.cap.d.ts +6 -4
- package/dist/generated/addon-api.d.ts +22 -0
- package/dist/generated/capability-router-map.d.ts +5 -2
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +664 -423
- package/dist/index.mjs +654 -424
- package/dist/notification/rule-kinds.d.ts +68 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7419,6 +7419,119 @@ var authProviderCapability = {
|
|
|
7419
7419
|
/** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
|
|
7420
7420
|
mount: { kind: "skip" }
|
|
7421
7421
|
};
|
|
7422
|
+
//#endregion
|
|
7423
|
+
//#region src/capabilities/database-snapshot.cap.ts
|
|
7424
|
+
/**
|
|
7425
|
+
* The suffix of a verified snapshot, written next to the live database it
|
|
7426
|
+
* copies: `<db>.backup-snapshot`. A restore promotes it back over `<db>`
|
|
7427
|
+
* (`server/backend/src/sqlite-restore.ts` spells the same string — the
|
|
7428
|
+
* launcher stays free of `@camstack/*` runtime imports — and a spec pins the
|
|
7429
|
+
* two together).
|
|
7430
|
+
*/
|
|
7431
|
+
var DATABASE_SNAPSHOT_SUFFIX = ".backup-snapshot";
|
|
7432
|
+
/**
|
|
7433
|
+
* The suffix of a copy still being written or verified. A file under this name
|
|
7434
|
+
* is never archived and never promoted: only a copy that passed every check is
|
|
7435
|
+
* renamed to {@link DATABASE_SNAPSHOT_SUFFIX}.
|
|
7436
|
+
*/
|
|
7437
|
+
var DATABASE_SNAPSHOT_PARTIAL_SUFFIX = ".backup-snapshot-partial";
|
|
7438
|
+
/**
|
|
7439
|
+
* How long one snapshot may take end to end: the pinned copy of the whole
|
|
7440
|
+
* database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
|
|
7441
|
+
* disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
|
|
7442
|
+
* generous because a timeout fails the whole backup run.
|
|
7443
|
+
*/
|
|
7444
|
+
var DATABASE_SNAPSHOT_TIMEOUT_MS = 30 * 6e4;
|
|
7445
|
+
/**
|
|
7446
|
+
* The databases an owner snapshots — declared by the OWNER, so a caller never
|
|
7447
|
+
* guesses which file is live from what sits beside it (a cleanly closed
|
|
7448
|
+
* database has no sidecars and is just as owned). Paths are absolute on the
|
|
7449
|
+
* owner's host.
|
|
7450
|
+
*/
|
|
7451
|
+
var DatabaseSnapshotTargetsSchema = zod.z.object({ databases: zod.z.array(zod.z.object({ livePath: zod.z.string() })) });
|
|
7452
|
+
/** One b-tree table of the snapshot and the rows it holds. */
|
|
7453
|
+
var DatabaseSnapshotTableSchema = zod.z.object({
|
|
7454
|
+
name: zod.z.string(),
|
|
7455
|
+
rows: zod.z.number().int().nonnegative()
|
|
7456
|
+
});
|
|
7457
|
+
/**
|
|
7458
|
+
* What the owner wrote. Every path is ABSOLUTE on the owner's host — the
|
|
7459
|
+
* caller pins the call to its own node, so it can read the file; a caller
|
|
7460
|
+
* that finds the path outside its own data root refuses it rather than
|
|
7461
|
+
* archiving something it cannot place.
|
|
7462
|
+
*/
|
|
7463
|
+
var DatabaseSnapshotResultSchema = zod.z.object({
|
|
7464
|
+
/** The live database the snapshot copies. Never to be copied as a file. */
|
|
7465
|
+
livePath: zod.z.string(),
|
|
7466
|
+
/** The verified copy: `<livePath>` + {@link DATABASE_SNAPSHOT_SUFFIX}. */
|
|
7467
|
+
snapshotPath: zod.z.string(),
|
|
7468
|
+
sizeBytes: zod.z.number().int().nonnegative(),
|
|
7469
|
+
pageCount: zod.z.number().int().nonnegative(),
|
|
7470
|
+
pageSize: zod.z.number().int().positive(),
|
|
7471
|
+
/**
|
|
7472
|
+
* Every b-tree table with its row count. Read inside the SAME read
|
|
7473
|
+
* transaction the copy was taken from, and found EQUAL on the copy — so
|
|
7474
|
+
* this is the content of the snapshot, not an estimate of the source.
|
|
7475
|
+
*/
|
|
7476
|
+
tables: zod.z.array(DatabaseSnapshotTableSchema),
|
|
7477
|
+
/** Wall time of the pinned copy (row counts included). */
|
|
7478
|
+
copyMs: zod.z.number().nonnegative(),
|
|
7479
|
+
/** Wall time of the checks on the copy (`integrity_check`, row counts). */
|
|
7480
|
+
verifyMs: zod.z.number().nonnegative(),
|
|
7481
|
+
/** When the pinned read transaction began (ms epoch) — the snapshot's instant. */
|
|
7482
|
+
takenAt: zod.z.number()
|
|
7483
|
+
});
|
|
7484
|
+
/**
|
|
7485
|
+
* A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
|
|
7486
|
+
* the same facts, with both paths relative to the archive root (the node's
|
|
7487
|
+
* data dir), because an archive outlives the host that made it.
|
|
7488
|
+
*/
|
|
7489
|
+
var ArchiveSqliteSnapshotSchema = DatabaseSnapshotResultSchema.extend({
|
|
7490
|
+
/** Archive-relative path of the live database the archive does NOT carry. */
|
|
7491
|
+
livePath: zod.z.string(),
|
|
7492
|
+
/** Archive-relative path of the verified copy it carries in its place. */
|
|
7493
|
+
snapshotPath: zod.z.string()
|
|
7494
|
+
});
|
|
7495
|
+
/**
|
|
7496
|
+
* database-snapshot — the OWNER of a live SQLite database writes a consistent,
|
|
7497
|
+
* verified copy of it (D693).
|
|
7498
|
+
*
|
|
7499
|
+
* A live database cannot be copied as files: three files written by a live
|
|
7500
|
+
* process cannot be read at one instant from outside it, and a tar of the
|
|
7501
|
+
* `.db` / `-wal` / `-shm` trio was measured torn in 6/6 archives (D679). Nor may
|
|
7502
|
+
* another process open it (D679 rule 2). So the process that owns the
|
|
7503
|
+
* connection writes the copy — through its own connection, on a thread,
|
|
7504
|
+
* pinned to one read transaction — and checks it before handing it out.
|
|
7505
|
+
*
|
|
7506
|
+
* Hub-only and internal: `sqlite-settings` is the registrant, and its consumer
|
|
7507
|
+
* is `backup-orchestrator`, which calls it pinned to its own node so the path
|
|
7508
|
+
* it gets back is on its own host. `auth: 'admin'` explicitly — `internal`
|
|
7509
|
+
* does not gate the mount (see `data-store-provider`).
|
|
7510
|
+
*/
|
|
7511
|
+
var databaseSnapshotCapability = {
|
|
7512
|
+
name: "database-snapshot",
|
|
7513
|
+
scope: "system",
|
|
7514
|
+
mode: "singleton",
|
|
7515
|
+
internal: true,
|
|
7516
|
+
methods: {
|
|
7517
|
+
/**
|
|
7518
|
+
* Which databases this owner snapshots. Answered from memory — no file is
|
|
7519
|
+
* touched — so a backup can ask it before deciding anything.
|
|
7520
|
+
*/
|
|
7521
|
+
listDatabases: require_sleep.method(zod.z.object({}), DatabaseSnapshotTargetsSchema, { auth: "admin" }),
|
|
7522
|
+
/**
|
|
7523
|
+
* Write `<db>.backup-snapshot` and return what it holds. Throws — and
|
|
7524
|
+
* leaves no file under the final name — when the copy fails
|
|
7525
|
+
* `integrity_check` or its row counts differ from the pinned source's.
|
|
7526
|
+
* A second call while one is running joins it.
|
|
7527
|
+
*/
|
|
7528
|
+
writeSnapshot: require_sleep.method(zod.z.object({}), DatabaseSnapshotResultSchema, {
|
|
7529
|
+
kind: "mutation",
|
|
7530
|
+
auth: "admin",
|
|
7531
|
+
timeoutMs: DATABASE_SNAPSHOT_TIMEOUT_MS
|
|
7532
|
+
})
|
|
7533
|
+
}
|
|
7534
|
+
};
|
|
7422
7535
|
/**
|
|
7423
7536
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
7424
7537
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
@@ -7530,7 +7643,12 @@ var ArchiveManifestSchema = zod.z.object({
|
|
|
7530
7643
|
locations: zod.z.array(zod.z.string()),
|
|
7531
7644
|
entries: zod.z.array(ArchiveEntrySchema),
|
|
7532
7645
|
totalBytes: zod.z.number(),
|
|
7533
|
-
totalFiles: zod.z.number()
|
|
7646
|
+
totalFiles: zod.z.number(),
|
|
7647
|
+
/**
|
|
7648
|
+
* Live SQLite databases this archive carries as their OWNER's verified
|
|
7649
|
+
* snapshot instead of as files (D693). Absent on archives made before.
|
|
7650
|
+
*/
|
|
7651
|
+
sqliteSnapshots: zod.z.array(ArchiveSqliteSnapshotSchema).optional()
|
|
7534
7652
|
});
|
|
7535
7653
|
var LocationStatSchema = zod.z.object({
|
|
7536
7654
|
name: zod.z.string(),
|
|
@@ -9920,6 +10038,79 @@ var CompositionBlockStateSchema = zod.z.object({
|
|
|
9920
10038
|
fields: zod.z.array(CompositionFieldStateSchema)
|
|
9921
10039
|
});
|
|
9922
10040
|
//#endregion
|
|
10041
|
+
//#region src/capabilities/composer.cap.ts
|
|
10042
|
+
/**
|
|
10043
|
+
* composer — runs every DECLARATIVE composition (D659).
|
|
10044
|
+
*
|
|
10045
|
+
* Internal and admin-only: its one caller is `core-blocks`' supervisor, which
|
|
10046
|
+
* sends the WHOLE set of composition blocks on every converge (idempotent),
|
|
10047
|
+
* and reads their state for the API. Nothing else talks to it.
|
|
10048
|
+
*/
|
|
10049
|
+
/** The composer's runner id, `resolveRunnerId(decl, 'composer')`; pinned by `composer-manifest.spec.ts`. */
|
|
10050
|
+
var COMPOSER_RUNNER_ID = require_composition.COMPOSER_ADDON_ID;
|
|
10051
|
+
var ComposerBlockSchema = zod.z.object({
|
|
10052
|
+
id: zod.z.string().min(1),
|
|
10053
|
+
name: zod.z.string().min(1).max(120),
|
|
10054
|
+
enabled: zod.z.boolean(),
|
|
10055
|
+
updatedAt: zod.z.number(),
|
|
10056
|
+
composition: require_composition.CompositionSchema
|
|
10057
|
+
});
|
|
10058
|
+
/**
|
|
10059
|
+
* A stored composition row that no longer PARSES — a schema a release
|
|
10060
|
+
* tightened, a row written by a newer build. Sent by id so the composer keeps
|
|
10061
|
+
* its device as a placeholder and reports the block `failed` naming the parse
|
|
10062
|
+
* error. Leaving it out would read, twice, exactly like a delete (D49).
|
|
10063
|
+
*/
|
|
10064
|
+
var ComposerUnreadableBlockSchema = zod.z.object({
|
|
10065
|
+
id: zod.z.string().min(1),
|
|
10066
|
+
/** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
|
|
10067
|
+
name: zod.z.string().nullable(),
|
|
10068
|
+
/** The parse error, in the operator's words. */
|
|
10069
|
+
error: zod.z.string()
|
|
10070
|
+
});
|
|
10071
|
+
var ComposerApplyInputSchema = zod.z.object({
|
|
10072
|
+
/** The shared Blocks integration; null until `core-blocks` has reconciled it. */
|
|
10073
|
+
integrationId: zod.z.string().nullable(),
|
|
10074
|
+
/** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
|
|
10075
|
+
storeLoaded: zod.z.boolean(),
|
|
10076
|
+
blocks: zod.z.array(ComposerBlockSchema),
|
|
10077
|
+
/** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
|
|
10078
|
+
restartBlockIds: zod.z.array(zod.z.string()),
|
|
10079
|
+
/** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
|
|
10080
|
+
unreadableBlocks: zod.z.array(ComposerUnreadableBlockSchema)
|
|
10081
|
+
});
|
|
10082
|
+
var ComposerBlockVerdictSchema = zod.z.object({
|
|
10083
|
+
blockId: zod.z.string(),
|
|
10084
|
+
status: CompositionRunStatusSchema,
|
|
10085
|
+
reason: zod.z.string().optional()
|
|
10086
|
+
});
|
|
10087
|
+
var ComposerApplyResultSchema = zod.z.object({
|
|
10088
|
+
blocks: zod.z.array(ComposerBlockVerdictSchema),
|
|
10089
|
+
/**
|
|
10090
|
+
* False when the composer declared and withdrew NOTHING (store not loaded,
|
|
10091
|
+
* integration unknown, its own rows unread or read empty once). An empty
|
|
10092
|
+
* apply the caller owes is paid off only by one the composer acted on (D49).
|
|
10093
|
+
*/
|
|
10094
|
+
acted: zod.z.boolean()
|
|
10095
|
+
});
|
|
10096
|
+
var composerCapability = {
|
|
10097
|
+
name: "composer",
|
|
10098
|
+
scope: "system",
|
|
10099
|
+
mode: "singleton",
|
|
10100
|
+
internal: true,
|
|
10101
|
+
methods: {
|
|
10102
|
+
/**
|
|
10103
|
+
* Not `apply`: tRPC reserves `apply`, `call` and `then` as router keys, and
|
|
10104
|
+
* `router({})` throws on one — every cap router is built at boot.
|
|
10105
|
+
*/
|
|
10106
|
+
applyBlocks: require_sleep.method(ComposerApplyInputSchema, ComposerApplyResultSchema, {
|
|
10107
|
+
kind: "mutation",
|
|
10108
|
+
auth: "admin"
|
|
10109
|
+
}),
|
|
10110
|
+
getStates: require_sleep.method(zod.z.object({ blockIds: zod.z.array(zod.z.string()) }), zod.z.object({ states: zod.z.array(CompositionBlockStateSchema) }), { auth: "admin" })
|
|
10111
|
+
}
|
|
10112
|
+
};
|
|
10113
|
+
//#endregion
|
|
9923
10114
|
//#region src/composition/plan-result.ts
|
|
9924
10115
|
function problem(code, path, message) {
|
|
9925
10116
|
return {
|
|
@@ -11168,79 +11359,6 @@ var coreBlocksCapability = {
|
|
|
11168
11359
|
}
|
|
11169
11360
|
};
|
|
11170
11361
|
//#endregion
|
|
11171
|
-
//#region src/capabilities/composer.cap.ts
|
|
11172
|
-
/**
|
|
11173
|
-
* composer — runs every DECLARATIVE composition (D659).
|
|
11174
|
-
*
|
|
11175
|
-
* Internal and admin-only: its one caller is `core-blocks`' supervisor, which
|
|
11176
|
-
* sends the WHOLE set of composition blocks on every converge (idempotent),
|
|
11177
|
-
* and reads their state for the API. Nothing else talks to it.
|
|
11178
|
-
*/
|
|
11179
|
-
/** The composer's runner id, `resolveRunnerId(decl, 'composer')`; pinned by `composer-manifest.spec.ts`. */
|
|
11180
|
-
var COMPOSER_RUNNER_ID = require_composition.COMPOSER_ADDON_ID;
|
|
11181
|
-
var ComposerBlockSchema = zod.z.object({
|
|
11182
|
-
id: zod.z.string().min(1),
|
|
11183
|
-
name: zod.z.string().min(1).max(120),
|
|
11184
|
-
enabled: zod.z.boolean(),
|
|
11185
|
-
updatedAt: zod.z.number(),
|
|
11186
|
-
composition: require_composition.CompositionSchema
|
|
11187
|
-
});
|
|
11188
|
-
/**
|
|
11189
|
-
* A stored composition row that no longer PARSES — a schema a release
|
|
11190
|
-
* tightened, a row written by a newer build. Sent by id so the composer keeps
|
|
11191
|
-
* its device as a placeholder and reports the block `failed` naming the parse
|
|
11192
|
-
* error. Leaving it out would read, twice, exactly like a delete (D49).
|
|
11193
|
-
*/
|
|
11194
|
-
var ComposerUnreadableBlockSchema = zod.z.object({
|
|
11195
|
-
id: zod.z.string().min(1),
|
|
11196
|
-
/** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
|
|
11197
|
-
name: zod.z.string().nullable(),
|
|
11198
|
-
/** The parse error, in the operator's words. */
|
|
11199
|
-
error: zod.z.string()
|
|
11200
|
-
});
|
|
11201
|
-
var ComposerApplyInputSchema = zod.z.object({
|
|
11202
|
-
/** The shared Blocks integration; null until `core-blocks` has reconciled it. */
|
|
11203
|
-
integrationId: zod.z.string().nullable(),
|
|
11204
|
-
/** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
|
|
11205
|
-
storeLoaded: zod.z.boolean(),
|
|
11206
|
-
blocks: zod.z.array(ComposerBlockSchema),
|
|
11207
|
-
/** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
|
|
11208
|
-
restartBlockIds: zod.z.array(zod.z.string()),
|
|
11209
|
-
/** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
|
|
11210
|
-
unreadableBlocks: zod.z.array(ComposerUnreadableBlockSchema)
|
|
11211
|
-
});
|
|
11212
|
-
var ComposerBlockVerdictSchema = zod.z.object({
|
|
11213
|
-
blockId: zod.z.string(),
|
|
11214
|
-
status: CompositionRunStatusSchema,
|
|
11215
|
-
reason: zod.z.string().optional()
|
|
11216
|
-
});
|
|
11217
|
-
var ComposerApplyResultSchema = zod.z.object({
|
|
11218
|
-
blocks: zod.z.array(ComposerBlockVerdictSchema),
|
|
11219
|
-
/**
|
|
11220
|
-
* False when the composer declared and withdrew NOTHING (store not loaded,
|
|
11221
|
-
* integration unknown, its own rows unread or read empty once). An empty
|
|
11222
|
-
* apply the caller owes is paid off only by one the composer acted on (D49).
|
|
11223
|
-
*/
|
|
11224
|
-
acted: zod.z.boolean()
|
|
11225
|
-
});
|
|
11226
|
-
var composerCapability = {
|
|
11227
|
-
name: "composer",
|
|
11228
|
-
scope: "system",
|
|
11229
|
-
mode: "singleton",
|
|
11230
|
-
internal: true,
|
|
11231
|
-
methods: {
|
|
11232
|
-
/**
|
|
11233
|
-
* Not `apply`: tRPC reserves `apply`, `call` and `then` as router keys, and
|
|
11234
|
-
* `router({})` throws on one — every cap router is built at boot.
|
|
11235
|
-
*/
|
|
11236
|
-
applyBlocks: require_sleep.method(ComposerApplyInputSchema, ComposerApplyResultSchema, {
|
|
11237
|
-
kind: "mutation",
|
|
11238
|
-
auth: "admin"
|
|
11239
|
-
}),
|
|
11240
|
-
getStates: require_sleep.method(zod.z.object({ blockIds: zod.z.array(zod.z.string()) }), zod.z.object({ states: zod.z.array(CompositionBlockStateSchema) }), { auth: "admin" })
|
|
11241
|
-
}
|
|
11242
|
-
};
|
|
11243
|
-
//#endregion
|
|
11244
11362
|
//#region src/capabilities/custom-model-registry.cap.ts
|
|
11245
11363
|
/**
|
|
11246
11364
|
* `custom-model-registry` — collection cap exposing operator-registered
|
|
@@ -14715,6 +14833,337 @@ var deviceManagerCapability = {
|
|
|
14715
14833
|
}
|
|
14716
14834
|
};
|
|
14717
14835
|
//#endregion
|
|
14836
|
+
//#region src/capabilities/doorbell.cap.ts
|
|
14837
|
+
/**
|
|
14838
|
+
* Doorbell button cap. Two kinds of providers coexist behind this cap
|
|
14839
|
+
* name (same pattern as `snapshot`):
|
|
14840
|
+
*
|
|
14841
|
+
* - **Native** providers: registered per-device by device-driver
|
|
14842
|
+
* addons via `ctx.registerNativeCap` — either on a
|
|
14843
|
+
* `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
|
|
14844
|
+
* or directly on the camera (Reolink registers at camera level).
|
|
14845
|
+
* Emits an `onPressed` event every time the firmware pushes a
|
|
14846
|
+
* ring; status tracks the last press and a pressCount since start
|
|
14847
|
+
* (diagnostic).
|
|
14848
|
+
*
|
|
14849
|
+
* - **Wrapper** provider: the `virtual-doorbell` system builtin
|
|
14850
|
+
* (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
|
|
14851
|
+
* device (contact / switch / event-emitter …) into a doorbell for
|
|
14852
|
+
* a camera. `defaultActive: false` — the operator explicitly binds
|
|
14853
|
+
* it per camera in the device-bindings UI, then picks the source
|
|
14854
|
+
* device + trigger in the per-device settings.
|
|
14855
|
+
*
|
|
14856
|
+
* The DeviceEventPropagator re-emits `onPressed` on the camera parent
|
|
14857
|
+
* — subscribers listening at the camera level receive ring events
|
|
14858
|
+
* with `via[]` populated. No code on the parent needed.
|
|
14859
|
+
*/
|
|
14860
|
+
var DoorbellStatusSchema = zod.z.object({
|
|
14861
|
+
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
14862
|
+
lastPressedAt: zod.z.number().nullable(),
|
|
14863
|
+
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
14864
|
+
pressCountSinceStart: zod.z.number()
|
|
14865
|
+
});
|
|
14866
|
+
var DoorbellPressEventSchema = zod.z.object({
|
|
14867
|
+
deviceId: zod.z.number(),
|
|
14868
|
+
timestamp: zod.z.number()
|
|
14869
|
+
});
|
|
14870
|
+
/**
|
|
14871
|
+
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
14872
|
+
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
14873
|
+
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
14874
|
+
*/
|
|
14875
|
+
var DoorbellSourceSlotValueSchema = zod.z.object({ deviceIds: zod.z.array(zod.z.number().int().positive()) });
|
|
14876
|
+
/**
|
|
14877
|
+
* The `doorbell-source` slot — which devices ring this camera's VIRTUAL
|
|
14878
|
+
* doorbell, owned by the `virtual-doorbell` wrapper over its
|
|
14879
|
+
* `doorbellSources` store (D648). A source rings when one of its
|
|
14880
|
+
* `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
|
|
14881
|
+
* different authority (`deviceManager.setWrapperActive`, D62) — the slot
|
|
14882
|
+
* reports it, it never writes it.
|
|
14883
|
+
*/
|
|
14884
|
+
var DOORBELL_SOURCE_SLOT = {
|
|
14885
|
+
id: "doorbell-source",
|
|
14886
|
+
label: "Doorbell trigger devices",
|
|
14887
|
+
description: "Any of these becoming active rings this camera's virtual doorbell: a binary sensor when it goes active, a switch when it turns on.",
|
|
14888
|
+
shape: "association",
|
|
14889
|
+
hostDeviceTypes: [require_err_msg.DeviceType.Camera],
|
|
14890
|
+
sourceCaps: require_composition.SOURCE_CAPS,
|
|
14891
|
+
cardinality: "many",
|
|
14892
|
+
value: DoorbellSourceSlotValueSchema
|
|
14893
|
+
};
|
|
14894
|
+
var doorbellCapability = {
|
|
14895
|
+
name: "doorbell",
|
|
14896
|
+
scope: "device",
|
|
14897
|
+
deviceNative: true,
|
|
14898
|
+
mode: "singleton",
|
|
14899
|
+
kind: "wrapper",
|
|
14900
|
+
defaultActive: false,
|
|
14901
|
+
deviceTypes: [require_err_msg.DeviceType.Button, require_err_msg.DeviceType.Camera],
|
|
14902
|
+
extensionSlots: [DOORBELL_SOURCE_SLOT],
|
|
14903
|
+
methods: {},
|
|
14904
|
+
events: {
|
|
14905
|
+
/**
|
|
14906
|
+
* Fires once per physical press. Reolink delivers via Baichuan
|
|
14907
|
+
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
14908
|
+
* release/duration — it's a pulse.
|
|
14909
|
+
*/
|
|
14910
|
+
onPressed: {
|
|
14911
|
+
data: DoorbellPressEventSchema,
|
|
14912
|
+
fromState: {
|
|
14913
|
+
field: "lastPressedAt",
|
|
14914
|
+
on: "advance"
|
|
14915
|
+
}
|
|
14916
|
+
} },
|
|
14917
|
+
status: {
|
|
14918
|
+
schema: DoorbellStatusSchema,
|
|
14919
|
+
kind: "push"
|
|
14920
|
+
},
|
|
14921
|
+
/**
|
|
14922
|
+
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
14923
|
+
* Mirrored by the kernel and readable via
|
|
14924
|
+
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
14925
|
+
* without subscribing.
|
|
14926
|
+
*/
|
|
14927
|
+
runtimeState: DoorbellStatusSchema,
|
|
14928
|
+
/**
|
|
14929
|
+
* Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
|
|
14930
|
+
*
|
|
14931
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
14932
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
14933
|
+
*/
|
|
14934
|
+
durability: "restored"
|
|
14935
|
+
};
|
|
14936
|
+
//#endregion
|
|
14937
|
+
//#region src/generated/extension-slots.ts
|
|
14938
|
+
/**
|
|
14939
|
+
* AUTO-GENERATED by scripts/generate-extension-slots.ts — DO NOT EDIT.
|
|
14940
|
+
*
|
|
14941
|
+
* Every extension slot declared by a capability (`extensionSlots` in its
|
|
14942
|
+
* `*.cap.ts`, D648), folded into one typed table. Imports ONLY the declaring
|
|
14943
|
+
* caps' descriptors and value schemas — never the caps barrel — so
|
|
14944
|
+
* `device-extension.cap.ts` can import this module without a cycle.
|
|
14945
|
+
*
|
|
14946
|
+
* Coverage: 2 slot(s).
|
|
14947
|
+
*/
|
|
14948
|
+
/** Every declared slot id, in table order. */
|
|
14949
|
+
var EXTENSION_SLOT_IDS = ["doorbell-source", "linked-devices"];
|
|
14950
|
+
var ExtensionSlotIdSchema = zod.z.enum(EXTENSION_SLOT_IDS);
|
|
14951
|
+
var EXTENSION_SLOTS = {
|
|
14952
|
+
"doorbell-source": {
|
|
14953
|
+
descriptor: DOORBELL_SOURCE_SLOT,
|
|
14954
|
+
declaringCap: "doorbell",
|
|
14955
|
+
hostDeviceTypes: [require_err_msg.DeviceType.Camera]
|
|
14956
|
+
},
|
|
14957
|
+
"linked-devices": {
|
|
14958
|
+
descriptor: LINKED_DEVICES_SLOT,
|
|
14959
|
+
declaringCap: "device-manager",
|
|
14960
|
+
hostDeviceTypes: [require_err_msg.DeviceType.Camera]
|
|
14961
|
+
}
|
|
14962
|
+
};
|
|
14963
|
+
/** A slot's editable value, discriminated on `slot`. */
|
|
14964
|
+
var ExtensionSlotValueSchema = zod.z.discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: zod.z.literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: zod.z.literal("linked-devices") })]);
|
|
14965
|
+
/** Every device type at least one slot is offered on — `device-extension`'s `deviceTypes`. */
|
|
14966
|
+
var EXTENSION_HOST_DEVICE_TYPES = [require_err_msg.DeviceType.Camera];
|
|
14967
|
+
//#endregion
|
|
14968
|
+
//#region src/capabilities/device-extension.cap.ts
|
|
14969
|
+
/**
|
|
14970
|
+
* `device-extension` — ONE place to see and author what a device is extended
|
|
14971
|
+
* with by OTHER devices (D648).
|
|
14972
|
+
*
|
|
14973
|
+
* **A contract, not a store.** Every slot (`linked-devices`, `doorbell-source`)
|
|
14974
|
+
* is declared by the cap that owns the function (`extensionSlots` in its
|
|
14975
|
+
* `*.cap.ts`, D4) and SERVED by the addon that already owns its store, over
|
|
14976
|
+
* that store and its existing write path. This cap persists nothing and has no config method (guarded by
|
|
14977
|
+
* `scripts/check-extension-slots.ts`): D62 applied to the whole feature, and
|
|
14978
|
+
* D3 — no shadow registry.
|
|
14979
|
+
*
|
|
14980
|
+
* **Shape.** A device-scoped wrapper COLLECTION, the D554 shape `videoclips`
|
|
14981
|
+
* uses: `resolveCapMount` gives it the `device-scoped` mount and
|
|
14982
|
+
* `requireDeviceCollection` dispatches it. Its providers are the slot owners
|
|
14983
|
+
* (device-manager, virtual-doorbell, …), and a device's sources are its
|
|
14984
|
+
* bindings (step 0 of `getBindings`, derived, persisted nowhere).
|
|
14985
|
+
*
|
|
14986
|
+
* - `listSources` — one row per provider, the D554 source-listing convention
|
|
14987
|
+
* that lets a scalar call be routed by the prefix of its `slotRef`.
|
|
14988
|
+
* - `listSlots` — fan-out, concatenated. A provider that throws becomes ONE
|
|
14989
|
+
* `unreachable` row naming it, never an absence (D554.4, D315): "no
|
|
14990
|
+
* extensions" is claimed only from an answer.
|
|
14991
|
+
* - `listCandidates` / `setSlot` — scalar, routed by `slotRef`
|
|
14992
|
+
* (`<source>:<slotId>`). An unclaimed ref is refused by name (D554.5).
|
|
14993
|
+
*
|
|
14994
|
+
* The slot's value travels as the generated discriminated union
|
|
14995
|
+
* (`ExtensionSlotValue`, keyed on `slot`), so a value under the wrong slot is
|
|
14996
|
+
* a schema error before it reaches any owner.
|
|
14997
|
+
*
|
|
14998
|
+
* **Associations only.** A slot LISTS other devices on its host. A host that
|
|
14999
|
+
* GAINS a capability from other devices is a composition (D663, amends D648:
|
|
15000
|
+
* the reserved `graft` shape, its `projects` and its `enabled` switch were
|
|
15001
|
+
* retired unimplemented).
|
|
15002
|
+
*/
|
|
15003
|
+
/** Separator between the source and the slot id in a `slotRef`. It is the
|
|
15004
|
+
* D554 routing separator: the dispatcher matches `<source>:` prefixes. */
|
|
15005
|
+
var EXTENSION_SLOT_REF_SEPARATOR = ":";
|
|
15006
|
+
/** The contract method whose failure BECOMES a row, like `listSources`'s. */
|
|
15007
|
+
var EXTENSION_SLOT_LISTING_METHOD = "listSlots";
|
|
15008
|
+
var ExtensionSourceAvailabilitySchema = zod.z.discriminatedUnion("state", [zod.z.object({ state: zod.z.literal("ok") }), zod.z.object({
|
|
15009
|
+
state: zod.z.literal("unreachable"),
|
|
15010
|
+
reason: zod.z.string()
|
|
15011
|
+
})]);
|
|
15012
|
+
/** One provider of slots — the D554 source-listing row. */
|
|
15013
|
+
var ExtensionSourceSchema = zod.z.object({
|
|
15014
|
+
/** The routing prefix of every `slotRef` this provider serves. */
|
|
15015
|
+
source: zod.z.string(),
|
|
15016
|
+
label: zod.z.string(),
|
|
15017
|
+
/** Stamped by the dispatcher from the registry (D557). */
|
|
15018
|
+
addonId: zod.z.string().optional(),
|
|
15019
|
+
availability: ExtensionSourceAvailabilitySchema
|
|
15020
|
+
});
|
|
15021
|
+
/**
|
|
15022
|
+
* How one picked source stands. `missing` — no such device (deleted, or an id
|
|
15023
|
+
* that never existed); `foreign` — a device the slot's owner cannot read from
|
|
15024
|
+
* (a source owned by another addon); `unavailable` — it exists but is not a
|
|
15025
|
+
* valid source now (a container, which is never a pick). A source in any of
|
|
15026
|
+
* these states is SHOWN, never silently dropped or re-pointed.
|
|
15027
|
+
*/
|
|
15028
|
+
var ExtensionSourceHealthSchema = zod.z.enum([
|
|
15029
|
+
"ok",
|
|
15030
|
+
"missing",
|
|
15031
|
+
"foreign",
|
|
15032
|
+
"unavailable"
|
|
15033
|
+
]);
|
|
15034
|
+
var ExtensionSlotSourceSchema = zod.z.object({
|
|
15035
|
+
deviceId: zod.z.number().int(),
|
|
15036
|
+
/** The device's name, or null when it could not be resolved (`missing`). */
|
|
15037
|
+
name: zod.z.string().nullable(),
|
|
15038
|
+
health: ExtensionSourceHealthSchema,
|
|
15039
|
+
detail: zod.z.string().optional()
|
|
15040
|
+
});
|
|
15041
|
+
/**
|
|
15042
|
+
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
15043
|
+
* reported read-only, named, never written through this contract (D62). The
|
|
15044
|
+
* virtual doorbell's sources ring only while the wrapper is bound to the
|
|
15045
|
+
* camera, and that binding belongs to `deviceManager.setWrapperActive`.
|
|
15046
|
+
* `unknown` means the gate could not be read; it is not "inactive" (D315).
|
|
15047
|
+
*/
|
|
15048
|
+
var ExtensionSlotActivationSchema = zod.z.object({
|
|
15049
|
+
state: zod.z.enum([
|
|
15050
|
+
"active",
|
|
15051
|
+
"inactive",
|
|
15052
|
+
"unknown"
|
|
15053
|
+
]),
|
|
15054
|
+
authority: zod.z.string(),
|
|
15055
|
+
detail: zod.z.string().optional()
|
|
15056
|
+
});
|
|
15057
|
+
/** One slot of one device, as its owner reads it from its own store. */
|
|
15058
|
+
var ExtensionSlotStateSchema = zod.z.object({
|
|
15059
|
+
state: zod.z.literal("ok"),
|
|
15060
|
+
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
15061
|
+
slotRef: zod.z.string(),
|
|
15062
|
+
slot: ExtensionSlotIdSchema,
|
|
15063
|
+
/** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
|
|
15064
|
+
authority: zod.z.string(),
|
|
15065
|
+
activation: ExtensionSlotActivationSchema.nullable(),
|
|
15066
|
+
value: ExtensionSlotValueSchema,
|
|
15067
|
+
sources: zod.z.array(ExtensionSlotSourceSchema),
|
|
15068
|
+
/**
|
|
15069
|
+
* Devices the owner links to the host ON ITS OWN, by structure, and that
|
|
15070
|
+
* are therefore not in `value` (D655): a camera's device-tree children, and
|
|
15071
|
+
* the child a picked container stands for (D356 — a container is never a
|
|
15072
|
+
* pick, its children are). Read-only; the editor shows them and may offer
|
|
15073
|
+
* per-device options on them (the linked-devices tracked-event opt-in).
|
|
15074
|
+
* Absent when the owner links nothing beyond the picks, and from an owner
|
|
15075
|
+
* older than D655.
|
|
15076
|
+
*/
|
|
15077
|
+
impliedSources: zod.z.array(ExtensionSlotSourceSchema).optional()
|
|
15078
|
+
});
|
|
15079
|
+
/**
|
|
15080
|
+
* A provider that could not answer `listSlots` at all. It could not name its
|
|
15081
|
+
* own slots, so the row names the ADDON and carries the refusal verbatim.
|
|
15082
|
+
* Written by the dispatcher, never by a provider.
|
|
15083
|
+
*/
|
|
15084
|
+
var ExtensionSlotUnreachableSchema = zod.z.object({
|
|
15085
|
+
state: zod.z.literal("unreachable"),
|
|
15086
|
+
addonId: zod.z.string(),
|
|
15087
|
+
reason: zod.z.string()
|
|
15088
|
+
});
|
|
15089
|
+
var ExtensionSlotRowSchema = zod.z.discriminatedUnion("state", [ExtensionSlotStateSchema, ExtensionSlotUnreachableSchema]);
|
|
15090
|
+
/** The row the dispatcher writes for a provider whose `listSlots` threw. */
|
|
15091
|
+
function unreachableExtensionSlotRow(addonId, reason) {
|
|
15092
|
+
return {
|
|
15093
|
+
state: "unreachable",
|
|
15094
|
+
addonId,
|
|
15095
|
+
reason
|
|
15096
|
+
};
|
|
15097
|
+
}
|
|
15098
|
+
/** One device the slot's editor may offer as a source. */
|
|
15099
|
+
var ExtensionCandidateSchema = zod.z.object({
|
|
15100
|
+
deviceId: zod.z.number().int(),
|
|
15101
|
+
name: zod.z.string(),
|
|
15102
|
+
type: zod.z.string(),
|
|
15103
|
+
location: zod.z.string().nullable(),
|
|
15104
|
+
/** The container a child belongs to — "Spotlight 2" alone does not say which. */
|
|
15105
|
+
parentName: zod.z.string().nullable(),
|
|
15106
|
+
/** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
|
|
15107
|
+
suggested: zod.z.boolean(),
|
|
15108
|
+
/** Why it is suggested ("same location"), null when it is not. */
|
|
15109
|
+
reason: zod.z.string().nullable()
|
|
15110
|
+
});
|
|
15111
|
+
var ExtensionCandidatesSchema = zod.z.object({ candidates: zod.z.array(ExtensionCandidateSchema) });
|
|
15112
|
+
/**
|
|
15113
|
+
* What a write did. `none` — applied in place. `host` / `parent` — the owner
|
|
15114
|
+
* reloaded the host (or, for an accessory child, its parent) because the
|
|
15115
|
+
* write changed what the host REGISTERS. A slot never adds a capability to its
|
|
15116
|
+
* host — that is a composition (D663) — so today's owners answer `none`.
|
|
15117
|
+
*/
|
|
15118
|
+
var ExtensionSetResultSchema = zod.z.object({
|
|
15119
|
+
applied: zod.z.literal(true),
|
|
15120
|
+
reload: zod.z.enum([
|
|
15121
|
+
"none",
|
|
15122
|
+
"host",
|
|
15123
|
+
"parent"
|
|
15124
|
+
])
|
|
15125
|
+
});
|
|
15126
|
+
var ExtensionSlotRefInputSchema = zod.z.object({
|
|
15127
|
+
deviceId: zod.z.number().int(),
|
|
15128
|
+
slotRef: zod.z.string().min(1)
|
|
15129
|
+
});
|
|
15130
|
+
var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
|
|
15131
|
+
var deviceExtensionCapability = {
|
|
15132
|
+
name: "device-extension",
|
|
15133
|
+
scope: "device",
|
|
15134
|
+
mode: "collection",
|
|
15135
|
+
kind: "wrapper",
|
|
15136
|
+
defaultActive: true,
|
|
15137
|
+
deviceTypes: EXTENSION_HOST_DEVICE_TYPES,
|
|
15138
|
+
deviceConfig: { ui: {
|
|
15139
|
+
kind: "widget",
|
|
15140
|
+
widgetId: "host/extensions-panel",
|
|
15141
|
+
tab: "general",
|
|
15142
|
+
label: "Extensions",
|
|
15143
|
+
order: 72
|
|
15144
|
+
} },
|
|
15145
|
+
methods: {
|
|
15146
|
+
/** One row per slot owner — the D554 source listing `slotRef` routes by. */
|
|
15147
|
+
listSources: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.array(ExtensionSourceSchema)),
|
|
15148
|
+
/**
|
|
15149
|
+
* Every slot this device is offered, read by each owner from its own
|
|
15150
|
+
* store. A provider that throws is ONE `unreachable` row (D554.4).
|
|
15151
|
+
*/
|
|
15152
|
+
listSlots: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.array(ExtensionSlotRowSchema)),
|
|
15153
|
+
/** The devices the slot's editor may offer, suggestions pre-marked (D356). */
|
|
15154
|
+
listCandidates: require_sleep.method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema),
|
|
15155
|
+
/**
|
|
15156
|
+
* Write one slot through its owner's EXISTING write path. The owner
|
|
15157
|
+
* validates (a container is never a linked device, a camera is never its
|
|
15158
|
+
* own source) and refuses by name before persisting.
|
|
15159
|
+
*/
|
|
15160
|
+
setSlot: require_sleep.method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
|
|
15161
|
+
kind: "mutation",
|
|
15162
|
+
auth: "admin"
|
|
15163
|
+
})
|
|
15164
|
+
}
|
|
15165
|
+
};
|
|
15166
|
+
//#endregion
|
|
14718
15167
|
//#region src/capabilities/device-state.cap.ts
|
|
14719
15168
|
/**
|
|
14720
15169
|
* Per-field ownership (D663). A composition may CLAIM fields of a native
|
|
@@ -19579,10 +20028,12 @@ var NcMediaPolicySchema = zod.z.object({
|
|
|
19579
20028
|
/**
|
|
19580
20029
|
* Cooldown GRANULARITY over the subject's class — how much a fired
|
|
19581
20030
|
* notification suppresses.
|
|
19582
|
-
* - `
|
|
19583
|
-
*
|
|
19584
|
-
*
|
|
19585
|
-
*
|
|
20031
|
+
* - `per-class` (default, and the absent value since 2026-10-01 — D36) — an
|
|
20032
|
+
* independent window per detected class: cat→dog fires at once, cat→cat
|
|
20033
|
+
* still waits.
|
|
20034
|
+
* - `shared` — one window for the whole rule/scope: a cat silences the next
|
|
20035
|
+
* dog for `cooldownSec`. Only written when an operator picks it; it is no
|
|
20036
|
+
* longer what an unset rule means.
|
|
19586
20037
|
*
|
|
19587
20038
|
* AUDIO subjects are ALWAYS per-class regardless of this setting: a scream
|
|
19588
20039
|
* must not be swallowed by a bark's window (the precedent this generalizes —
|
|
@@ -19597,8 +20048,11 @@ var NcThrottleSchema = zod.z.object({
|
|
|
19597
20048
|
/**
|
|
19598
20049
|
* Class granularity of the cooldown key. Optional rather than defaulted:
|
|
19599
20050
|
* a Zod default does NOT run on the addon→addon cap path, so a persisted
|
|
19600
|
-
* rule authored before this field simply carries none
|
|
19601
|
-
*
|
|
20051
|
+
* rule authored before this field simply carries none. The engine used to
|
|
20052
|
+
* read absent as `shared` (D36); since 2026-10-01 it reads absent as
|
|
20053
|
+
* `per-class` — the operator's default — and only an explicit `shared`
|
|
20054
|
+
* still means `shared`. See `cooldownKey` / `keysPerClass` in the rule
|
|
20055
|
+
* engine, and D36's dated note.
|
|
19602
20056
|
*/
|
|
19603
20057
|
granularity: NcThrottleGranularitySchema.optional()
|
|
19604
20058
|
});
|
|
@@ -31307,337 +31761,6 @@ var CLIP_PLAYBACK_OPTIONS = {
|
|
|
31307
31761
|
}
|
|
31308
31762
|
};
|
|
31309
31763
|
//#endregion
|
|
31310
|
-
//#region src/capabilities/doorbell.cap.ts
|
|
31311
|
-
/**
|
|
31312
|
-
* Doorbell button cap. Two kinds of providers coexist behind this cap
|
|
31313
|
-
* name (same pattern as `snapshot`):
|
|
31314
|
-
*
|
|
31315
|
-
* - **Native** providers: registered per-device by device-driver
|
|
31316
|
-
* addons via `ctx.registerNativeCap` — either on a
|
|
31317
|
-
* `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
|
|
31318
|
-
* or directly on the camera (Reolink registers at camera level).
|
|
31319
|
-
* Emits an `onPressed` event every time the firmware pushes a
|
|
31320
|
-
* ring; status tracks the last press and a pressCount since start
|
|
31321
|
-
* (diagnostic).
|
|
31322
|
-
*
|
|
31323
|
-
* - **Wrapper** provider: the `virtual-doorbell` system builtin
|
|
31324
|
-
* (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
|
|
31325
|
-
* device (contact / switch / event-emitter …) into a doorbell for
|
|
31326
|
-
* a camera. `defaultActive: false` — the operator explicitly binds
|
|
31327
|
-
* it per camera in the device-bindings UI, then picks the source
|
|
31328
|
-
* device + trigger in the per-device settings.
|
|
31329
|
-
*
|
|
31330
|
-
* The DeviceEventPropagator re-emits `onPressed` on the camera parent
|
|
31331
|
-
* — subscribers listening at the camera level receive ring events
|
|
31332
|
-
* with `via[]` populated. No code on the parent needed.
|
|
31333
|
-
*/
|
|
31334
|
-
var DoorbellStatusSchema = zod.z.object({
|
|
31335
|
-
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
31336
|
-
lastPressedAt: zod.z.number().nullable(),
|
|
31337
|
-
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
31338
|
-
pressCountSinceStart: zod.z.number()
|
|
31339
|
-
});
|
|
31340
|
-
var DoorbellPressEventSchema = zod.z.object({
|
|
31341
|
-
deviceId: zod.z.number(),
|
|
31342
|
-
timestamp: zod.z.number()
|
|
31343
|
-
});
|
|
31344
|
-
/**
|
|
31345
|
-
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
31346
|
-
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
31347
|
-
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
31348
|
-
*/
|
|
31349
|
-
var DoorbellSourceSlotValueSchema = zod.z.object({ deviceIds: zod.z.array(zod.z.number().int().positive()) });
|
|
31350
|
-
/**
|
|
31351
|
-
* The `doorbell-source` slot — which devices ring this camera's VIRTUAL
|
|
31352
|
-
* doorbell, owned by the `virtual-doorbell` wrapper over its
|
|
31353
|
-
* `doorbellSources` store (D648). A source rings when one of its
|
|
31354
|
-
* `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
|
|
31355
|
-
* different authority (`deviceManager.setWrapperActive`, D62) — the slot
|
|
31356
|
-
* reports it, it never writes it.
|
|
31357
|
-
*/
|
|
31358
|
-
var DOORBELL_SOURCE_SLOT = {
|
|
31359
|
-
id: "doorbell-source",
|
|
31360
|
-
label: "Doorbell trigger devices",
|
|
31361
|
-
description: "Any of these becoming active rings this camera's virtual doorbell: a binary sensor when it goes active, a switch when it turns on.",
|
|
31362
|
-
shape: "association",
|
|
31363
|
-
hostDeviceTypes: [require_err_msg.DeviceType.Camera],
|
|
31364
|
-
sourceCaps: require_composition.SOURCE_CAPS,
|
|
31365
|
-
cardinality: "many",
|
|
31366
|
-
value: DoorbellSourceSlotValueSchema
|
|
31367
|
-
};
|
|
31368
|
-
var doorbellCapability = {
|
|
31369
|
-
name: "doorbell",
|
|
31370
|
-
scope: "device",
|
|
31371
|
-
deviceNative: true,
|
|
31372
|
-
mode: "singleton",
|
|
31373
|
-
kind: "wrapper",
|
|
31374
|
-
defaultActive: false,
|
|
31375
|
-
deviceTypes: [require_err_msg.DeviceType.Button, require_err_msg.DeviceType.Camera],
|
|
31376
|
-
extensionSlots: [DOORBELL_SOURCE_SLOT],
|
|
31377
|
-
methods: {},
|
|
31378
|
-
events: {
|
|
31379
|
-
/**
|
|
31380
|
-
* Fires once per physical press. Reolink delivers via Baichuan
|
|
31381
|
-
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
31382
|
-
* release/duration — it's a pulse.
|
|
31383
|
-
*/
|
|
31384
|
-
onPressed: {
|
|
31385
|
-
data: DoorbellPressEventSchema,
|
|
31386
|
-
fromState: {
|
|
31387
|
-
field: "lastPressedAt",
|
|
31388
|
-
on: "advance"
|
|
31389
|
-
}
|
|
31390
|
-
} },
|
|
31391
|
-
status: {
|
|
31392
|
-
schema: DoorbellStatusSchema,
|
|
31393
|
-
kind: "push"
|
|
31394
|
-
},
|
|
31395
|
-
/**
|
|
31396
|
-
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
31397
|
-
* Mirrored by the kernel and readable via
|
|
31398
|
-
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
31399
|
-
* without subscribing.
|
|
31400
|
-
*/
|
|
31401
|
-
runtimeState: DoorbellStatusSchema,
|
|
31402
|
-
/**
|
|
31403
|
-
* Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
|
|
31404
|
-
*
|
|
31405
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
31406
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
31407
|
-
*/
|
|
31408
|
-
durability: "restored"
|
|
31409
|
-
};
|
|
31410
|
-
//#endregion
|
|
31411
|
-
//#region src/generated/extension-slots.ts
|
|
31412
|
-
/**
|
|
31413
|
-
* AUTO-GENERATED by scripts/generate-extension-slots.ts — DO NOT EDIT.
|
|
31414
|
-
*
|
|
31415
|
-
* Every extension slot declared by a capability (`extensionSlots` in its
|
|
31416
|
-
* `*.cap.ts`, D648), folded into one typed table. Imports ONLY the declaring
|
|
31417
|
-
* caps' descriptors and value schemas — never the caps barrel — so
|
|
31418
|
-
* `device-extension.cap.ts` can import this module without a cycle.
|
|
31419
|
-
*
|
|
31420
|
-
* Coverage: 2 slot(s).
|
|
31421
|
-
*/
|
|
31422
|
-
/** Every declared slot id, in table order. */
|
|
31423
|
-
var EXTENSION_SLOT_IDS = ["doorbell-source", "linked-devices"];
|
|
31424
|
-
var ExtensionSlotIdSchema = zod.z.enum(EXTENSION_SLOT_IDS);
|
|
31425
|
-
var EXTENSION_SLOTS = {
|
|
31426
|
-
"doorbell-source": {
|
|
31427
|
-
descriptor: DOORBELL_SOURCE_SLOT,
|
|
31428
|
-
declaringCap: "doorbell",
|
|
31429
|
-
hostDeviceTypes: [require_err_msg.DeviceType.Camera]
|
|
31430
|
-
},
|
|
31431
|
-
"linked-devices": {
|
|
31432
|
-
descriptor: LINKED_DEVICES_SLOT,
|
|
31433
|
-
declaringCap: "device-manager",
|
|
31434
|
-
hostDeviceTypes: [require_err_msg.DeviceType.Camera]
|
|
31435
|
-
}
|
|
31436
|
-
};
|
|
31437
|
-
/** A slot's editable value, discriminated on `slot`. */
|
|
31438
|
-
var ExtensionSlotValueSchema = zod.z.discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: zod.z.literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: zod.z.literal("linked-devices") })]);
|
|
31439
|
-
/** Every device type at least one slot is offered on — `device-extension`'s `deviceTypes`. */
|
|
31440
|
-
var EXTENSION_HOST_DEVICE_TYPES = [require_err_msg.DeviceType.Camera];
|
|
31441
|
-
//#endregion
|
|
31442
|
-
//#region src/capabilities/device-extension.cap.ts
|
|
31443
|
-
/**
|
|
31444
|
-
* `device-extension` — ONE place to see and author what a device is extended
|
|
31445
|
-
* with by OTHER devices (D648).
|
|
31446
|
-
*
|
|
31447
|
-
* **A contract, not a store.** Every slot (`linked-devices`, `doorbell-source`)
|
|
31448
|
-
* is declared by the cap that owns the function (`extensionSlots` in its
|
|
31449
|
-
* `*.cap.ts`, D4) and SERVED by the addon that already owns its store, over
|
|
31450
|
-
* that store and its existing write path. This cap persists nothing and has no config method (guarded by
|
|
31451
|
-
* `scripts/check-extension-slots.ts`): D62 applied to the whole feature, and
|
|
31452
|
-
* D3 — no shadow registry.
|
|
31453
|
-
*
|
|
31454
|
-
* **Shape.** A device-scoped wrapper COLLECTION, the D554 shape `videoclips`
|
|
31455
|
-
* uses: `resolveCapMount` gives it the `device-scoped` mount and
|
|
31456
|
-
* `requireDeviceCollection` dispatches it. Its providers are the slot owners
|
|
31457
|
-
* (device-manager, virtual-doorbell, …), and a device's sources are its
|
|
31458
|
-
* bindings (step 0 of `getBindings`, derived, persisted nowhere).
|
|
31459
|
-
*
|
|
31460
|
-
* - `listSources` — one row per provider, the D554 source-listing convention
|
|
31461
|
-
* that lets a scalar call be routed by the prefix of its `slotRef`.
|
|
31462
|
-
* - `listSlots` — fan-out, concatenated. A provider that throws becomes ONE
|
|
31463
|
-
* `unreachable` row naming it, never an absence (D554.4, D315): "no
|
|
31464
|
-
* extensions" is claimed only from an answer.
|
|
31465
|
-
* - `listCandidates` / `setSlot` — scalar, routed by `slotRef`
|
|
31466
|
-
* (`<source>:<slotId>`). An unclaimed ref is refused by name (D554.5).
|
|
31467
|
-
*
|
|
31468
|
-
* The slot's value travels as the generated discriminated union
|
|
31469
|
-
* (`ExtensionSlotValue`, keyed on `slot`), so a value under the wrong slot is
|
|
31470
|
-
* a schema error before it reaches any owner.
|
|
31471
|
-
*
|
|
31472
|
-
* **Associations only.** A slot LISTS other devices on its host. A host that
|
|
31473
|
-
* GAINS a capability from other devices is a composition (D663, amends D648:
|
|
31474
|
-
* the reserved `graft` shape, its `projects` and its `enabled` switch were
|
|
31475
|
-
* retired unimplemented).
|
|
31476
|
-
*/
|
|
31477
|
-
/** Separator between the source and the slot id in a `slotRef`. It is the
|
|
31478
|
-
* D554 routing separator: the dispatcher matches `<source>:` prefixes. */
|
|
31479
|
-
var EXTENSION_SLOT_REF_SEPARATOR = ":";
|
|
31480
|
-
/** The contract method whose failure BECOMES a row, like `listSources`'s. */
|
|
31481
|
-
var EXTENSION_SLOT_LISTING_METHOD = "listSlots";
|
|
31482
|
-
var ExtensionSourceAvailabilitySchema = zod.z.discriminatedUnion("state", [zod.z.object({ state: zod.z.literal("ok") }), zod.z.object({
|
|
31483
|
-
state: zod.z.literal("unreachable"),
|
|
31484
|
-
reason: zod.z.string()
|
|
31485
|
-
})]);
|
|
31486
|
-
/** One provider of slots — the D554 source-listing row. */
|
|
31487
|
-
var ExtensionSourceSchema = zod.z.object({
|
|
31488
|
-
/** The routing prefix of every `slotRef` this provider serves. */
|
|
31489
|
-
source: zod.z.string(),
|
|
31490
|
-
label: zod.z.string(),
|
|
31491
|
-
/** Stamped by the dispatcher from the registry (D557). */
|
|
31492
|
-
addonId: zod.z.string().optional(),
|
|
31493
|
-
availability: ExtensionSourceAvailabilitySchema
|
|
31494
|
-
});
|
|
31495
|
-
/**
|
|
31496
|
-
* How one picked source stands. `missing` — no such device (deleted, or an id
|
|
31497
|
-
* that never existed); `foreign` — a device the slot's owner cannot read from
|
|
31498
|
-
* (a source owned by another addon); `unavailable` — it exists but is not a
|
|
31499
|
-
* valid source now (a container, which is never a pick). A source in any of
|
|
31500
|
-
* these states is SHOWN, never silently dropped or re-pointed.
|
|
31501
|
-
*/
|
|
31502
|
-
var ExtensionSourceHealthSchema = zod.z.enum([
|
|
31503
|
-
"ok",
|
|
31504
|
-
"missing",
|
|
31505
|
-
"foreign",
|
|
31506
|
-
"unavailable"
|
|
31507
|
-
]);
|
|
31508
|
-
var ExtensionSlotSourceSchema = zod.z.object({
|
|
31509
|
-
deviceId: zod.z.number().int(),
|
|
31510
|
-
/** The device's name, or null when it could not be resolved (`missing`). */
|
|
31511
|
-
name: zod.z.string().nullable(),
|
|
31512
|
-
health: ExtensionSourceHealthSchema,
|
|
31513
|
-
detail: zod.z.string().optional()
|
|
31514
|
-
});
|
|
31515
|
-
/**
|
|
31516
|
-
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
31517
|
-
* reported read-only, named, never written through this contract (D62). The
|
|
31518
|
-
* virtual doorbell's sources ring only while the wrapper is bound to the
|
|
31519
|
-
* camera, and that binding belongs to `deviceManager.setWrapperActive`.
|
|
31520
|
-
* `unknown` means the gate could not be read; it is not "inactive" (D315).
|
|
31521
|
-
*/
|
|
31522
|
-
var ExtensionSlotActivationSchema = zod.z.object({
|
|
31523
|
-
state: zod.z.enum([
|
|
31524
|
-
"active",
|
|
31525
|
-
"inactive",
|
|
31526
|
-
"unknown"
|
|
31527
|
-
]),
|
|
31528
|
-
authority: zod.z.string(),
|
|
31529
|
-
detail: zod.z.string().optional()
|
|
31530
|
-
});
|
|
31531
|
-
/** One slot of one device, as its owner reads it from its own store. */
|
|
31532
|
-
var ExtensionSlotStateSchema = zod.z.object({
|
|
31533
|
-
state: zod.z.literal("ok"),
|
|
31534
|
-
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
31535
|
-
slotRef: zod.z.string(),
|
|
31536
|
-
slot: ExtensionSlotIdSchema,
|
|
31537
|
-
/** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
|
|
31538
|
-
authority: zod.z.string(),
|
|
31539
|
-
activation: ExtensionSlotActivationSchema.nullable(),
|
|
31540
|
-
value: ExtensionSlotValueSchema,
|
|
31541
|
-
sources: zod.z.array(ExtensionSlotSourceSchema),
|
|
31542
|
-
/**
|
|
31543
|
-
* Devices the owner links to the host ON ITS OWN, by structure, and that
|
|
31544
|
-
* are therefore not in `value` (D655): a camera's device-tree children, and
|
|
31545
|
-
* the child a picked container stands for (D356 — a container is never a
|
|
31546
|
-
* pick, its children are). Read-only; the editor shows them and may offer
|
|
31547
|
-
* per-device options on them (the linked-devices tracked-event opt-in).
|
|
31548
|
-
* Absent when the owner links nothing beyond the picks, and from an owner
|
|
31549
|
-
* older than D655.
|
|
31550
|
-
*/
|
|
31551
|
-
impliedSources: zod.z.array(ExtensionSlotSourceSchema).optional()
|
|
31552
|
-
});
|
|
31553
|
-
/**
|
|
31554
|
-
* A provider that could not answer `listSlots` at all. It could not name its
|
|
31555
|
-
* own slots, so the row names the ADDON and carries the refusal verbatim.
|
|
31556
|
-
* Written by the dispatcher, never by a provider.
|
|
31557
|
-
*/
|
|
31558
|
-
var ExtensionSlotUnreachableSchema = zod.z.object({
|
|
31559
|
-
state: zod.z.literal("unreachable"),
|
|
31560
|
-
addonId: zod.z.string(),
|
|
31561
|
-
reason: zod.z.string()
|
|
31562
|
-
});
|
|
31563
|
-
var ExtensionSlotRowSchema = zod.z.discriminatedUnion("state", [ExtensionSlotStateSchema, ExtensionSlotUnreachableSchema]);
|
|
31564
|
-
/** The row the dispatcher writes for a provider whose `listSlots` threw. */
|
|
31565
|
-
function unreachableExtensionSlotRow(addonId, reason) {
|
|
31566
|
-
return {
|
|
31567
|
-
state: "unreachable",
|
|
31568
|
-
addonId,
|
|
31569
|
-
reason
|
|
31570
|
-
};
|
|
31571
|
-
}
|
|
31572
|
-
/** One device the slot's editor may offer as a source. */
|
|
31573
|
-
var ExtensionCandidateSchema = zod.z.object({
|
|
31574
|
-
deviceId: zod.z.number().int(),
|
|
31575
|
-
name: zod.z.string(),
|
|
31576
|
-
type: zod.z.string(),
|
|
31577
|
-
location: zod.z.string().nullable(),
|
|
31578
|
-
/** The container a child belongs to — "Spotlight 2" alone does not say which. */
|
|
31579
|
-
parentName: zod.z.string().nullable(),
|
|
31580
|
-
/** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
|
|
31581
|
-
suggested: zod.z.boolean(),
|
|
31582
|
-
/** Why it is suggested ("same location"), null when it is not. */
|
|
31583
|
-
reason: zod.z.string().nullable()
|
|
31584
|
-
});
|
|
31585
|
-
var ExtensionCandidatesSchema = zod.z.object({ candidates: zod.z.array(ExtensionCandidateSchema) });
|
|
31586
|
-
/**
|
|
31587
|
-
* What a write did. `none` — applied in place. `host` / `parent` — the owner
|
|
31588
|
-
* reloaded the host (or, for an accessory child, its parent) because the
|
|
31589
|
-
* write changed what the host REGISTERS. A slot never adds a capability to its
|
|
31590
|
-
* host — that is a composition (D663) — so today's owners answer `none`.
|
|
31591
|
-
*/
|
|
31592
|
-
var ExtensionSetResultSchema = zod.z.object({
|
|
31593
|
-
applied: zod.z.literal(true),
|
|
31594
|
-
reload: zod.z.enum([
|
|
31595
|
-
"none",
|
|
31596
|
-
"host",
|
|
31597
|
-
"parent"
|
|
31598
|
-
])
|
|
31599
|
-
});
|
|
31600
|
-
var ExtensionSlotRefInputSchema = zod.z.object({
|
|
31601
|
-
deviceId: zod.z.number().int(),
|
|
31602
|
-
slotRef: zod.z.string().min(1)
|
|
31603
|
-
});
|
|
31604
|
-
var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
|
|
31605
|
-
var deviceExtensionCapability = {
|
|
31606
|
-
name: "device-extension",
|
|
31607
|
-
scope: "device",
|
|
31608
|
-
mode: "collection",
|
|
31609
|
-
kind: "wrapper",
|
|
31610
|
-
defaultActive: true,
|
|
31611
|
-
deviceTypes: EXTENSION_HOST_DEVICE_TYPES,
|
|
31612
|
-
deviceConfig: { ui: {
|
|
31613
|
-
kind: "widget",
|
|
31614
|
-
widgetId: "host/extensions-panel",
|
|
31615
|
-
tab: "general",
|
|
31616
|
-
label: "Extensions",
|
|
31617
|
-
order: 72
|
|
31618
|
-
} },
|
|
31619
|
-
methods: {
|
|
31620
|
-
/** One row per slot owner — the D554 source listing `slotRef` routes by. */
|
|
31621
|
-
listSources: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.array(ExtensionSourceSchema)),
|
|
31622
|
-
/**
|
|
31623
|
-
* Every slot this device is offered, read by each owner from its own
|
|
31624
|
-
* store. A provider that throws is ONE `unreachable` row (D554.4).
|
|
31625
|
-
*/
|
|
31626
|
-
listSlots: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.array(ExtensionSlotRowSchema)),
|
|
31627
|
-
/** The devices the slot's editor may offer, suggestions pre-marked (D356). */
|
|
31628
|
-
listCandidates: require_sleep.method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema),
|
|
31629
|
-
/**
|
|
31630
|
-
* Write one slot through its owner's EXISTING write path. The owner
|
|
31631
|
-
* validates (a container is never a linked device, a camera is never its
|
|
31632
|
-
* own source) and refuses by name before persisting.
|
|
31633
|
-
*/
|
|
31634
|
-
setSlot: require_sleep.method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
|
|
31635
|
-
kind: "mutation",
|
|
31636
|
-
auth: "admin"
|
|
31637
|
-
})
|
|
31638
|
-
}
|
|
31639
|
-
};
|
|
31640
|
-
//#endregion
|
|
31641
31764
|
//#region src/capabilities/webrtc-session.cap.ts
|
|
31642
31765
|
/**
|
|
31643
31766
|
* Optional client-side hints sent at session creation to help the provider
|
|
@@ -51698,6 +51821,7 @@ var CAPABILITY_NAMES = {
|
|
|
51698
51821
|
cover: "cover",
|
|
51699
51822
|
customModelRegistry: "custom-model-registry",
|
|
51700
51823
|
dataStoreProvider: "data-store-provider",
|
|
51824
|
+
databaseSnapshot: "database-snapshot",
|
|
51701
51825
|
dayNight: "day-night",
|
|
51702
51826
|
decoder: "decoder",
|
|
51703
51827
|
detectionPipeline: "detection-pipeline",
|
|
@@ -51989,6 +52113,10 @@ var CAPABILITY_ROUTER_KEYS = [
|
|
|
51989
52113
|
key: "dataStoreProvider",
|
|
51990
52114
|
name: "data-store-provider"
|
|
51991
52115
|
},
|
|
52116
|
+
{
|
|
52117
|
+
key: "databaseSnapshot",
|
|
52118
|
+
name: "database-snapshot"
|
|
52119
|
+
},
|
|
51992
52120
|
{
|
|
51993
52121
|
key: "dayNight",
|
|
51994
52122
|
name: "day-night"
|
|
@@ -52522,6 +52650,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
52522
52650
|
coverCapability,
|
|
52523
52651
|
customModelRegistryCapability,
|
|
52524
52652
|
dataStoreProviderCapability,
|
|
52653
|
+
databaseSnapshotCapability,
|
|
52525
52654
|
dayNightCapability,
|
|
52526
52655
|
decoderCapability,
|
|
52527
52656
|
detectionPipelineCapability,
|
|
@@ -53786,6 +53915,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
53786
53915
|
addonId: null,
|
|
53787
53916
|
access: "view"
|
|
53788
53917
|
},
|
|
53918
|
+
"databaseSnapshot.listDatabases": {
|
|
53919
|
+
capName: "database-snapshot",
|
|
53920
|
+
capScope: "system",
|
|
53921
|
+
addonId: null,
|
|
53922
|
+
access: "view"
|
|
53923
|
+
},
|
|
53924
|
+
"databaseSnapshot.writeSnapshot": {
|
|
53925
|
+
capName: "database-snapshot",
|
|
53926
|
+
capScope: "system",
|
|
53927
|
+
addonId: null,
|
|
53928
|
+
access: "create"
|
|
53929
|
+
},
|
|
53789
53930
|
"dataStoreProvider.aggregate": {
|
|
53790
53931
|
capName: "data-store-provider",
|
|
53791
53932
|
capScope: "system",
|
|
@@ -59867,6 +60008,7 @@ var KNOWN_CAP_NAMES = [
|
|
|
59867
60008
|
"cover",
|
|
59868
60009
|
"custom-model-registry",
|
|
59869
60010
|
"data-store-provider",
|
|
60011
|
+
"database-snapshot",
|
|
59870
60012
|
"day-night",
|
|
59871
60013
|
"decoder",
|
|
59872
60014
|
"detection-pipeline",
|
|
@@ -60100,6 +60242,7 @@ var SYSTEM_CAP_NAMES = [
|
|
|
60100
60242
|
"core-blocks",
|
|
60101
60243
|
"custom-model-registry",
|
|
60102
60244
|
"data-store-provider",
|
|
60245
|
+
"database-snapshot",
|
|
60103
60246
|
"decoder",
|
|
60104
60247
|
"device-adoption",
|
|
60105
60248
|
"device-export",
|
|
@@ -64771,6 +64914,74 @@ function isSystemDelivery(delivery) {
|
|
|
64771
64914
|
return delivery === NC_SYSTEM_DELIVERY;
|
|
64772
64915
|
}
|
|
64773
64916
|
/**
|
|
64917
|
+
* Which capability a device must carry to be OFFERED on a rule of this kind's
|
|
64918
|
+
* device-scope picker (operator ruling, 2026-10-01). `null` means "no
|
|
64919
|
+
* capability filter for this kind" — either every device applies (the system
|
|
64920
|
+
* families, each already a separate concern; see
|
|
64921
|
+
* `docs/architecture/notifications.md`'s D637 `deviceIds` table) or `mixed`,
|
|
64922
|
+
* which authors nothing.
|
|
64923
|
+
*
|
|
64924
|
+
* DERIVED, never a hand-picked list:
|
|
64925
|
+
* - `sensor` reads `EVENTFUL_CAP_NAMES` — the SAME cap table the engine
|
|
64926
|
+
* itself turns a linked device's bound caps into sensor event kinds with
|
|
64927
|
+
* (`EVENT_KIND_BY_CAP`). A device this picker offers for a sensor rule is
|
|
64928
|
+
* exactly a device the rule's `sensorKinds` condition could ever name.
|
|
64929
|
+
* - `detection` (which a package-event rule is — there is no separate
|
|
64930
|
+
* `package` kind, D637) / `occupancy` read the one pipeline cap a camera
|
|
64931
|
+
* needs to produce the detections / counts / parcels those kinds match on.
|
|
64932
|
+
* - `sound` reads the one cap a device needs to produce the audio metrics a
|
|
64933
|
+
* sound rule's sampling window is built from.
|
|
64934
|
+
* - `device-events` / `system` / `alarm` / `mixed` are `null`: a device
|
|
64935
|
+
* event rule's `deviceIds` legitimately spans every device type (liveness,
|
|
64936
|
+
* battery, consumable, `detection-blind`), a system rule has no device
|
|
64937
|
+
* scope at all (dropped from the editor's tabs), and `alarm`'s `deviceIds`
|
|
64938
|
+
* is a reference to whichever camera's rule set it off — not a scope this
|
|
64939
|
+
* picker authors.
|
|
64940
|
+
*
|
|
64941
|
+
* Callers resolve the ids via `deviceManager.listDeviceIdsByCaps` (max 16
|
|
64942
|
+
* names — `EVENTFUL_CAP_NAMES` is exactly 16) and must treat an unanswered
|
|
64943
|
+
* read as "unknown", never as "no devices" (D315): this function only names
|
|
64944
|
+
* WHICH caps to ask for, not what to show while the answer is pending.
|
|
64945
|
+
*/
|
|
64946
|
+
function ruleDeviceCompatCapNames(kind) {
|
|
64947
|
+
switch (kind) {
|
|
64948
|
+
case "sensor": return EVENTFUL_CAP_NAMES;
|
|
64949
|
+
case "detection":
|
|
64950
|
+
case "occupancy": return ["detection-pipeline"];
|
|
64951
|
+
case "sound": return ["audio-metrics"];
|
|
64952
|
+
case "device-events":
|
|
64953
|
+
case "system":
|
|
64954
|
+
case "alarm":
|
|
64955
|
+
case "mixed": return null;
|
|
64956
|
+
}
|
|
64957
|
+
}
|
|
64958
|
+
/**
|
|
64959
|
+
* The capability every CAMERA carries: `camera-streams` is a `defaultActive`
|
|
64960
|
+
* wrapper bound to every `Camera`-type device (`camera-streams.cap.ts`).
|
|
64961
|
+
* Named once, because a sensor rule's compatible set needs it (below).
|
|
64962
|
+
*/
|
|
64963
|
+
var NC_CAMERA_SCOPE_CAP_NAME = "camera-streams";
|
|
64964
|
+
/**
|
|
64965
|
+
* Every capability QUERY whose union is the set of devices a rule of this kind
|
|
64966
|
+
* may be SCOPED to (`conditions.devices`) — what the save-time guard and the
|
|
64967
|
+
* admin's Devices tab ask `deviceManager.listDeviceIdsByCaps`, one call per
|
|
64968
|
+
* entry. `null` exactly where {@link ruleDeviceCompatCapNames} is `null`.
|
|
64969
|
+
*
|
|
64970
|
+
* Several queries rather than one list because `listDeviceIdsByCaps` takes at
|
|
64971
|
+
* most 16 names and `EVENTFUL_CAP_NAMES` is already exactly 16.
|
|
64972
|
+
*
|
|
64973
|
+
* A `sensor` rule's set is the eventful devices PLUS every camera (fix round
|
|
64974
|
+
* 1, 2026-10-01): the engine matches a sensor rule scoped to a CAMERA — a
|
|
64975
|
+
* per-camera row carries the camera's id, and a linked set matches on
|
|
64976
|
+
* `rowCameraIds` (D630 §6) — so a camera-scoped sensor rule is legitimate and
|
|
64977
|
+
* a guard that refused it would make every such stored rule un-editable.
|
|
64978
|
+
*/
|
|
64979
|
+
function ruleDeviceCompatCapQueries(kind) {
|
|
64980
|
+
const primary = ruleDeviceCompatCapNames(kind);
|
|
64981
|
+
if (primary === null) return null;
|
|
64982
|
+
return kind === "sensor" ? [primary, [NC_CAMERA_SCOPE_CAP_NAME]] : [primary];
|
|
64983
|
+
}
|
|
64984
|
+
/**
|
|
64774
64985
|
* Which kind of rule is this?
|
|
64775
64986
|
*
|
|
64776
64987
|
* The CONDITION wins over the delivery wherever the engine says it does, and
|
|
@@ -64844,12 +65055,20 @@ var NC_RULE_SECTIONS = [
|
|
|
64844
65055
|
},
|
|
64845
65056
|
{
|
|
64846
65057
|
key: "detection",
|
|
64847
|
-
label: "Detections
|
|
64848
|
-
blurb: "Rules driven by what the cameras
|
|
65058
|
+
label: "Detections",
|
|
65059
|
+
blurb: "Rules driven by what the cameras SEE — detections, tracks and package events.",
|
|
64849
65060
|
newRuleLabel: "New detection rule",
|
|
64850
65061
|
emptyHint: "No detection rules yet. Create one to be told what your cameras see.",
|
|
64851
65062
|
creatable: true
|
|
64852
65063
|
},
|
|
65064
|
+
{
|
|
65065
|
+
key: "sensor",
|
|
65066
|
+
label: "Sensors",
|
|
65067
|
+
blurb: "Rules driven by a device or sensor CHANGING STATE — a doorbell press, a linked sensor opening or closing. The picture comes from the camera the sensor is attributed to.",
|
|
65068
|
+
newRuleLabel: "New sensor rule",
|
|
65069
|
+
emptyHint: "No sensor rules yet. Create one to be told when a doorbell is pressed or a linked sensor changes.",
|
|
65070
|
+
creatable: true
|
|
65071
|
+
},
|
|
64853
65072
|
{
|
|
64854
65073
|
key: "audio",
|
|
64855
65074
|
label: "Sound",
|
|
@@ -64921,22 +65140,28 @@ function isOccupancyRule(subject) {
|
|
|
64921
65140
|
* `all` always matches — a section that hides a rule is how an operator
|
|
64922
65141
|
* concludes it was deleted. The others PARTITION the list: sound and
|
|
64923
65142
|
* occupancy are claimed by their condition, a system-event rule by its trigger
|
|
64924
|
-
* and then by the family of its event kinds (or `mixed`, D637),
|
|
64925
|
-
*
|
|
64926
|
-
*
|
|
64927
|
-
*
|
|
64928
|
-
*
|
|
64929
|
-
*
|
|
64930
|
-
*
|
|
64931
|
-
*
|
|
64932
|
-
*
|
|
65143
|
+
* and then by the family of its event kinds (or `mixed`, D637), `sensor`
|
|
65144
|
+
* claims the `device-event` trigger that occupancy did not (operator ruling,
|
|
65145
|
+
* 2026-10-01 — a doorbell press used to fall into `detection` for want of its
|
|
65146
|
+
* own section, which is the "everything mixed together" the viewer's
|
|
65147
|
+
* `ruleKindOf`-based list had already fixed and the admin's section strip had
|
|
65148
|
+
* not), and everything left over — including a trigger this build has never
|
|
65149
|
+
* heard of — counts as a detection rule so it stays visible somewhere.
|
|
65150
|
+
*
|
|
65151
|
+
* Keyed on the CONDITION for sound and occupancy, because the trigger alone
|
|
65152
|
+
* cannot answer: a sound rule is `immediate` and an occupancy rule is
|
|
65153
|
+
* `device-event`, and in each case the condition is the discriminator the
|
|
65154
|
+
* engine itself uses. `sensor` IS keyed on the trigger, same as `ruleKindOf`'s
|
|
65155
|
+
* `'sensor'` kind — a device-event subject with no occupancy condition is a
|
|
65156
|
+
* sensor rule, full stop.
|
|
64933
65157
|
*/
|
|
64934
65158
|
function ruleMatchesSection(subject, section) {
|
|
64935
65159
|
if (section === "all") return true;
|
|
64936
65160
|
if (isSystemDelivery(subject.delivery)) return ruleKindOf(subject) === section;
|
|
64937
65161
|
if (section === "audio") return isAudioRule(subject);
|
|
64938
65162
|
if (section === "occupancy") return isOccupancyRule(subject);
|
|
64939
|
-
if (section === "
|
|
65163
|
+
if (section === "sensor") return subject.delivery === "device-event" && !isOccupancyRule(subject);
|
|
65164
|
+
if (section === "detection") return !isAudioRule(subject) && !isOccupancyRule(subject) && subject.delivery !== "device-event";
|
|
64940
65165
|
return false;
|
|
64941
65166
|
}
|
|
64942
65167
|
/**
|
|
@@ -64950,6 +65175,7 @@ function ruleSectionOf(subject) {
|
|
|
64950
65175
|
if (isSystemDelivery(subject.delivery)) return systemRuleKindOf(subject.conditions.systemEvent);
|
|
64951
65176
|
if (isAudioRule(subject)) return "audio";
|
|
64952
65177
|
if (isOccupancyRule(subject)) return "occupancy";
|
|
65178
|
+
if (subject.delivery === "device-event") return "sensor";
|
|
64953
65179
|
return "detection";
|
|
64954
65180
|
}
|
|
64955
65181
|
/**
|
|
@@ -65007,6 +65233,10 @@ function ruleSeedForSection(section) {
|
|
|
65007
65233
|
delivery: "device-event",
|
|
65008
65234
|
conditions: { occupancy: NC_OCCUPANCY_DEFAULTS }
|
|
65009
65235
|
};
|
|
65236
|
+
case "sensor": return {
|
|
65237
|
+
delivery: "device-event",
|
|
65238
|
+
conditions: {}
|
|
65239
|
+
};
|
|
65010
65240
|
default: return {
|
|
65011
65241
|
delivery: "immediate",
|
|
65012
65242
|
conditions: { source: "pipeline" }
|
|
@@ -69047,6 +69277,7 @@ exports.AppleFmAvailabilitySchema = AppleFmAvailabilitySchema;
|
|
|
69047
69277
|
exports.AppleFmUnavailableReasonSchema = AppleFmUnavailableReasonSchema;
|
|
69048
69278
|
exports.ArchiveEntrySchema = ArchiveEntrySchema;
|
|
69049
69279
|
exports.ArchiveManifestSchema = ArchiveManifestSchema;
|
|
69280
|
+
exports.ArchiveSqliteSnapshotSchema = ArchiveSqliteSnapshotSchema;
|
|
69050
69281
|
exports.ArchivedDebugNoteQueryInputSchema = ArchivedDebugNoteQueryInputSchema;
|
|
69051
69282
|
exports.ArchivedDebugNoteSchema = ArchivedDebugNoteSchema;
|
|
69052
69283
|
exports.AttachmentMediaTypeSchema = AttachmentMediaTypeSchema;
|
|
@@ -69327,6 +69558,9 @@ exports.CreateScopedTokenResultSchema = CreateScopedTokenResultSchema;
|
|
|
69327
69558
|
exports.CreateUserInputSchema = CreateUserInputSchema;
|
|
69328
69559
|
exports.CustomActionInputSchema = CustomActionInputSchema;
|
|
69329
69560
|
exports.CustomModelDescriptorSchema = CustomModelDescriptorSchema;
|
|
69561
|
+
exports.DATABASE_SNAPSHOT_PARTIAL_SUFFIX = DATABASE_SNAPSHOT_PARTIAL_SUFFIX;
|
|
69562
|
+
exports.DATABASE_SNAPSHOT_SUFFIX = DATABASE_SNAPSHOT_SUFFIX;
|
|
69563
|
+
exports.DATABASE_SNAPSHOT_TIMEOUT_MS = DATABASE_SNAPSHOT_TIMEOUT_MS;
|
|
69330
69564
|
exports.DATAPLANE_SECRET_HEADER = require_sleep.DATAPLANE_SECRET_HEADER;
|
|
69331
69565
|
exports.DAYS_PER_WEEK = DAYS_PER_WEEK;
|
|
69332
69566
|
exports.DAY_NAMES = DAY_NAMES;
|
|
@@ -69377,6 +69611,9 @@ exports.DISPLAY_ICON_VOCABULARY = DISPLAY_ICON_VOCABULARY;
|
|
|
69377
69611
|
exports.DOORBELL_RISE_DEBOUNCE_MS = DOORBELL_RISE_DEBOUNCE_MS;
|
|
69378
69612
|
exports.DOORBELL_SOURCE_SLOT = DOORBELL_SOURCE_SLOT;
|
|
69379
69613
|
exports.DataStoreEngineInfoSchema = EngineInfoSchema;
|
|
69614
|
+
exports.DatabaseSnapshotResultSchema = DatabaseSnapshotResultSchema;
|
|
69615
|
+
exports.DatabaseSnapshotTableSchema = DatabaseSnapshotTableSchema;
|
|
69616
|
+
exports.DatabaseSnapshotTargetsSchema = DatabaseSnapshotTargetsSchema;
|
|
69380
69617
|
exports.DayNightModeSchema = DayNightModeSchema;
|
|
69381
69618
|
exports.DayNightOptionsSchema = DayNightOptionsSchema;
|
|
69382
69619
|
exports.DayNightSettingsPatchSchema = DayNightSettingsPatchSchema;
|
|
@@ -69779,6 +70016,7 @@ exports.NC_AUDIO_SEED = NC_AUDIO_SEED;
|
|
|
69779
70016
|
exports.NC_AUTHORABLE_SYSTEM_EVENT_KINDS = NC_AUTHORABLE_SYSTEM_EVENT_KINDS;
|
|
69780
70017
|
exports.NC_BASE_CONDITION_KEYS = NC_BASE_CONDITION_KEYS;
|
|
69781
70018
|
exports.NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS = NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS;
|
|
70019
|
+
exports.NC_CAMERA_SCOPE_CAP_NAME = NC_CAMERA_SCOPE_CAP_NAME;
|
|
69782
70020
|
exports.NC_CLIP_POST_ROLL_DEFAULT_SEC = NC_CLIP_POST_ROLL_DEFAULT_SEC;
|
|
69783
70021
|
exports.NC_CLIP_PRE_ROLL_DEFAULT_SEC = NC_CLIP_PRE_ROLL_DEFAULT_SEC;
|
|
69784
70022
|
exports.NC_CLIP_RETENTION_MAX_SEC = NC_CLIP_RETENTION_MAX_SEC;
|
|
@@ -70537,6 +70775,7 @@ exports.createSystemProxy = createSystemProxy;
|
|
|
70537
70775
|
exports.customAction = require_sleep.customAction;
|
|
70538
70776
|
exports.customModelRegistryCapability = customModelRegistryCapability;
|
|
70539
70777
|
exports.dataStoreProviderCapability = dataStoreProviderCapability;
|
|
70778
|
+
exports.databaseSnapshotCapability = databaseSnapshotCapability;
|
|
70540
70779
|
exports.dayNightCapability = dayNightCapability;
|
|
70541
70780
|
exports.dayOfWeekToIndex = dayOfWeekToIndex;
|
|
70542
70781
|
exports.declarationOwnerNodeId = declarationOwnerNodeId;
|
|
@@ -70890,6 +71129,8 @@ exports.resolveViewableDeviceIds = resolveViewableDeviceIds;
|
|
|
70890
71129
|
exports.roleSpec = roleSpec;
|
|
70891
71130
|
exports.roomCompositionExample = roomCompositionExample;
|
|
70892
71131
|
exports.ruleBelongsToAlarm = ruleBelongsToAlarm;
|
|
71132
|
+
exports.ruleDeviceCompatCapNames = ruleDeviceCompatCapNames;
|
|
71133
|
+
exports.ruleDeviceCompatCapQueries = ruleDeviceCompatCapQueries;
|
|
70893
71134
|
exports.ruleEditorSectionsForKind = ruleEditorSectionsForKind;
|
|
70894
71135
|
exports.ruleKindOf = ruleKindOf;
|
|
70895
71136
|
exports.ruleKindSpec = ruleKindSpec;
|