@camstack/addon-admin-ui 1.2.440 → 1.2.442
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/assets/{AddonAssetIcon-DoCqXzAv.js → AddonAssetIcon-BccuV0q0.js} +1 -1
- package/dist/assets/Addons-kSQ_LfKG.js +4 -0
- package/dist/assets/{AdminPage-KGO_m_yt.js → AdminPage-C_5SnDIL.js} +1 -1
- package/dist/assets/{AdminSectionedPage-BiMhPKOP.js → AdminSectionedPage-9KWXxykK.js} +1 -1
- package/dist/assets/AiProfiles-jgiZ-hEI.js +3 -0
- package/dist/assets/{BrokerForm-yx58WRgh.js → BrokerForm-DzQNeSxm.js} +1 -1
- package/dist/assets/Build-DCeob-yZ.js +40 -0
- package/dist/assets/{Calendars-BdN8ZQmv.js → Calendars-Cla89sbi.js} +1 -1
- package/dist/assets/Cluster-eTZjguTx.js +1 -0
- package/dist/assets/{ClusterStepModel-DPmlzTfm.js → ClusterStepModel-8aoPvS-k.js} +1 -1
- package/dist/assets/{CompositionEditor-BhL25d6e.js → CompositionEditor-CJR7m-qo.js} +1 -1
- package/dist/assets/{CompositionEditorPage-BwqVkeY-.js → CompositionEditorPage-BgQSiVo8.js} +1 -1
- package/dist/assets/Data-xUdBOATt.js +2 -0
- package/dist/assets/DeviceDetail-BxgqCzrO.js +2 -0
- package/dist/assets/{DeviceDoActionFields-C6f9gioM.js → DeviceDoActionFields-BjVWVHu7.js} +1 -1
- package/dist/assets/{Devices-CtivG8K9.js → Devices-D9zuTHOW.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-BD-Z7zz-.js → EmbedPlayerPage-MXUvBkWX.js} +1 -1
- package/dist/assets/Identity-0TfWSUca.js +1 -0
- package/dist/assets/IntegrationDetail-e-6OvQx9.js +1 -0
- package/dist/assets/IntegrationHub-CA9MM1oL.js +1 -0
- package/dist/assets/Integrations-BbsiTLtO.js +1 -0
- package/dist/assets/Integrations-BdrRZHfb.js +1 -0
- package/dist/assets/{Library-ToUHY4O3.js → Library-B9_Scpen.js} +1 -1
- package/dist/assets/Locations-DdCSAAsc.js +3 -0
- package/dist/assets/{Logs-Ds6SPC6o.js → Logs-CVR97TYT.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-BoY32Qvt.js → MaskShapeCanvas-DEZFJVo5.js} +1 -1
- package/dist/assets/{MotionZonesSettings-DBW4jTEr.js → MotionZonesSettings-Bwo-3iRG.js} +1 -1
- package/dist/assets/MyAccess-oZ9l9GBy.js +2 -0
- package/dist/assets/Network-CNhaeFmn.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-CIISQuIL.js → NodeAddonsSettingsPanel-CRyxRlRb.js} +1 -1
- package/dist/assets/Notifications-2cTCf7lp.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-z8P3R0fA.js → PrivacyMaskSettings-cDl1Qu_T.js} +1 -1
- package/dist/assets/Recordings-DycF_b6H.js +1 -0
- package/dist/assets/{ScanNetworkModal-D7N2aC7y.js → ScanNetworkModal-C5RUKriq.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-CyjEekEM.js → SceneMonitorEditor-BmaWm_DT.js} +1 -1
- package/dist/assets/SessionsList-Cu3ZE31w.js +2 -0
- package/dist/assets/{Showroom-PlFtcQrL.js → Showroom-ndc_ZezE.js} +1 -1
- package/dist/assets/{System-DxszqVYV.js → System-C_RpKyaA.js} +1 -1
- package/dist/assets/{Terminal-BMG2w8DZ.js → Terminal-BdKedDZS.js} +3 -3
- package/dist/assets/{Viewer-CRLD_tt7.js → Viewer-LdYt8Q3H.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-GapjKGVe.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DId7Mdzp.js} +1 -1
- package/dist/assets/{addon-icons-context-BrgGsfoE.js → addon-icons-context-BNhm5nij.js} +1 -1
- package/dist/assets/{archive-Dx-auPAN.js → archive-Dj3rQasM.js} +1 -1
- package/dist/assets/{authed-media-MhMmWNH3.js → authed-media-CRKmATDJ.js} +1 -1
- package/dist/assets/{bell-off-BQQTURVF.js → bell-off-BxB4ohQe.js} +1 -1
- package/dist/assets/{board-model-Bdetmchn.js → board-model-Bx9i2Ikh.js} +1 -1
- package/dist/assets/{boxes-BIK98bHo.js → boxes-Cyb74Sc2.js} +1 -1
- package/dist/assets/circle-slash-CJ8sDXES.js +1 -0
- package/dist/assets/client-CqoBi3ym.js +358 -0
- package/dist/assets/{cloud-upload-FvK6xW2I.js → cloud-upload-STkEa8On.js} +1 -1
- package/dist/assets/crop-Cvf_bPJF.js +1 -0
- package/dist/assets/{device-integration-icon-ClmWzwM_.js → device-integration-icon-NmvFHcoT.js} +1 -1
- package/dist/assets/device-picker-model-2g0u_pQE.js +1 -0
- package/dist/assets/{dist-CEnfZ10I.js → dist-CboU_aT5.js} +1 -1
- package/dist/assets/dist-yylqec5a.js +358 -0
- package/dist/assets/{eraser-CUAqtnBD.js → eraser-MfKJ-xHy.js} +1 -1
- package/dist/assets/{hard-drive-download-XGtks2vE.js → hard-drive-download-DNMTqY2h.js} +1 -1
- package/dist/assets/{history-DqvhlzWX.js → history-ohLSkO2A.js} +1 -1
- package/dist/assets/{hostInit-DzBGXsvZ.js → hostInit-LP6ARUYA.js} +1 -1
- package/dist/assets/i18n-Bldp2nug.js +1 -0
- package/dist/assets/{icons-DNRi-jSy.js → icons-Bft8hsua.js} +1 -1
- package/dist/assets/{index-yoPG03d0.js → index-WxoBkjSL.js} +3 -3
- package/dist/assets/{key-bw9xhRgT.js → key-LDVs0Hda.js} +1 -1
- package/dist/assets/{key-round-BngMS2dZ.js → key-round-ufq1OhZE.js} +1 -1
- package/dist/assets/{layers-CIl8QXpN.js → layers-DMR3HPTk.js} +1 -1
- package/dist/assets/{linked-devices-model-CclOXMLj.js → linked-devices-model-BhIH5Kho.js} +1 -1
- package/dist/assets/{list-ordered-_52_xrQ7.js → list-ordered-iFgP3FdK.js} +1 -1
- package/dist/assets/{location-owned-usage-5eb6nny3.js → location-owned-usage-ChRB3Z7a.js} +1 -1
- package/dist/assets/{log-in-DH9Lu6bJ.js → log-in-4wTdM9C2.js} +1 -1
- package/dist/assets/{memory-stick-CzaP6KiN.js → memory-stick-BVZbZTDE.js} +1 -1
- package/dist/assets/{message-square-plus-vMywres_.js → message-square-plus-DTEXt10L.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-54468006.js → mf-entry-bootstrap-0-6f3bb22b.js} +2 -2
- package/dist/assets/{mic-off-Da09u2hl.js → mic-off-BOvuLxyG.js} +1 -1
- package/dist/assets/{monitor-off-jOOWdiSg.js → monitor-off-BJJUHiNu.js} +1 -1
- package/dist/assets/{monitor-smartphone-D_W4zyWO.js → monitor-smartphone-BaRjkvN9.js} +1 -1
- package/dist/assets/mount-2g0u_pQE.js +1 -0
- package/dist/assets/{notification-schedule-field-LytDFkpQ.js → notification-schedule-field-BHhbg0a-.js} +1 -1
- package/dist/assets/{player-overlays-CCZE3o8q.js → player-overlays-CpALjVtS.js} +1 -1
- package/dist/assets/{recycle-BVcCaHVd.js → recycle-CjrRLz-b.js} +1 -1
- package/dist/assets/remoteEntry-CgICLtvC.js +1 -0
- package/dist/assets/{scan-eye-CHwWv39K.js → scan-eye-D35EojCj.js} +1 -1
- package/dist/assets/{scissors-BrUBwnKn.js → scissors-DreuVKed.js} +1 -1
- package/dist/assets/{search-x-BcR2pidC.js → search-x-DQHP4OCR.js} +1 -1
- package/dist/assets/{send-8R5TbxHN.js → send-Dta9lxhX.js} +1 -1
- package/dist/assets/{settings-2-C4PaSGfb.js → settings-2-DPZ8CKFD.js} +1 -1
- package/dist/assets/{speaker-CBRM7GNH.js → speaker-D95jrOt6.js} +1 -1
- package/dist/assets/src-CsHgYIi2.js +67 -0
- package/dist/assets/{timer-reset-DlfKkTg_.js → timer-reset-EEmenpu7.js} +1 -1
- package/dist/assets/{ungroup-BzlNECzG.js → ungroup-Db4urNO1.js} +1 -1
- package/dist/assets/{unlink-HIuzqEig.js → unlink-6J-SREPz.js} +1 -1
- package/dist/assets/{usb-DqboQtO8.js → usb-UiuX4lHP.js} +1 -1
- package/dist/assets/{use-scenes-feed-Cnl4Is6T.js → use-scenes-feed-xAvk3mdK.js} +1 -1
- package/dist/assets/{use-stationary-objects-DmFWTPK0.js → use-stationary-objects-BSuACN9l.js} +1 -1
- package/dist/assets/useEventInvalidation-2g0u_pQE.js +1 -0
- package/dist/assets/{useNodeUrlSelection-CSh6gqLc.js → useNodeUrlSelection-itsA69-a.js} +1 -1
- package/dist/assets/user-round-t1eXjuPz.js +1 -0
- package/dist/assets/{user-x-ciro8k7Z.js → user-x-BiLr1XcR.js} +1 -1
- package/dist/assets/{video-BJUj4GaK.js → video-DSVienqW.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CwjeQPZx.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BzdoZPn9.js} +2 -2
- package/dist/index.html +10 -10
- package/dist/server/addon.js +391 -295
- package/package.json +1 -1
- package/dist/assets/Addons-CrSVEbe3.js +0 -4
- package/dist/assets/AiProfiles-D8mKo1K9.js +0 -3
- package/dist/assets/Build-BArewEF3.js +0 -40
- package/dist/assets/Cluster-Bn5YZafT.js +0 -1
- package/dist/assets/Data-BvY-zVHv.js +0 -2
- package/dist/assets/DeviceDetail-g2esa6u-.js +0 -2
- package/dist/assets/Identity-BQNP0wku.js +0 -1
- package/dist/assets/IntegrationDetail-CzEG-I4B.js +0 -1
- package/dist/assets/IntegrationHub-tqxee2Rm.js +0 -1
- package/dist/assets/Integrations-C7Ptcn3c.js +0 -1
- package/dist/assets/Integrations-GZm_SrQK.js +0 -1
- package/dist/assets/Locations-CPFCvUKd.js +0 -3
- package/dist/assets/MyAccess-2mSUBp14.js +0 -2
- package/dist/assets/Network-BddKO6B1.js +0 -1
- package/dist/assets/Notifications-DWJcnXvV.js +0 -1
- package/dist/assets/Recordings-g1Jxg_Lr.js +0 -1
- package/dist/assets/SessionsList-bmTxxIOE.js +0 -2
- package/dist/assets/circle-slash-DKE4hxbW.js +0 -1
- package/dist/assets/client-Cy6wyTLQ.js +0 -358
- package/dist/assets/crop-7vsE3Qcd.js +0 -1
- package/dist/assets/device-picker-model-DVvq9nYp.js +0 -1
- package/dist/assets/dist-BPMeH1J4.js +0 -358
- package/dist/assets/i18n-B1bxeya5.js +0 -1
- package/dist/assets/mount-DVvq9nYp.js +0 -1
- package/dist/assets/remoteEntry-BOaeaEWk.js +0 -1
- package/dist/assets/src-Cw4W7OtK.js +0 -67
- package/dist/assets/useEventInvalidation-DVvq9nYp.js +0 -1
- package/dist/assets/user-round-C4K7vDWN.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -5415,7 +5415,7 @@ var ZodIssueCode = {
|
|
|
5415
5415
|
var ZodFirstPartyTypeKind;
|
|
5416
5416
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5417
5417
|
//#endregion
|
|
5418
|
-
//#region ../types/dist/sleep-
|
|
5418
|
+
//#region ../types/dist/sleep-yKL5gfrH.mjs
|
|
5419
5419
|
/**
|
|
5420
5420
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5421
5421
|
* window to float samples (D455).
|
|
@@ -7797,6 +7797,12 @@ function normalizeAddonInitResult(result) {
|
|
|
7797
7797
|
if (Array.isArray(result)) return { providers: result };
|
|
7798
7798
|
return result;
|
|
7799
7799
|
}
|
|
7800
|
+
/**
|
|
7801
|
+
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
7802
|
+
* and validates them (`ShareViewGrantSchema` builds its
|
|
7803
|
+
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
7804
|
+
*/
|
|
7805
|
+
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
7800
7806
|
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
7801
7807
|
var PeerBytesTicketSchema = object({
|
|
7802
7808
|
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
@@ -12399,6 +12405,280 @@ var ConvertResultSchema = object({
|
|
|
12399
12405
|
files: array(string()).readonly()
|
|
12400
12406
|
})).readonly()
|
|
12401
12407
|
});
|
|
12408
|
+
/**
|
|
12409
|
+
* Zod schemas for persisted record types.
|
|
12410
|
+
*
|
|
12411
|
+
* These schemas serve as the single source of truth for types that are
|
|
12412
|
+
* stored in the settings-store backend and retrieved via tRPC. They
|
|
12413
|
+
* replace the manual TypeScript interfaces with schema-derived types,
|
|
12414
|
+
* enabling runtime validation when reading from the backend.
|
|
12415
|
+
*
|
|
12416
|
+
* Convention: each schema is named `<Type>Schema`, the inferred TS type
|
|
12417
|
+
* keeps the original name for backward compatibility.
|
|
12418
|
+
*/
|
|
12419
|
+
/**
|
|
12420
|
+
* Auth model (v2 — 2026-05-12 caps-only):
|
|
12421
|
+
*
|
|
12422
|
+
* Two principals:
|
|
12423
|
+
* - `isAdmin: true` — full bypass. Admin scope set is ignored.
|
|
12424
|
+
* - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
|
|
12425
|
+
*
|
|
12426
|
+
* No role enum. There used to be `viewer / agent / scoped` and earlier
|
|
12427
|
+
* `super_admin` — collapsed onto the single boolean because every
|
|
12428
|
+
* non-admin caller is governed by the same scope-check rules; the
|
|
12429
|
+
* distinction was only ever used to route role-specific procedures
|
|
12430
|
+
* which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
|
|
12431
|
+
* with `isAdmin: false` + an explicit scope list.
|
|
12432
|
+
*/
|
|
12433
|
+
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
12434
|
+
var MethodAccessSchema = _enum([
|
|
12435
|
+
"view",
|
|
12436
|
+
"create",
|
|
12437
|
+
"delete"
|
|
12438
|
+
]);
|
|
12439
|
+
/**
|
|
12440
|
+
* A single scope grant. Three forms — checked in matcher with OR
|
|
12441
|
+
* semantics; the first match decides whether the call passes:
|
|
12442
|
+
*
|
|
12443
|
+
* - `category` — broadest. `target: 'device' | 'system'` selects every
|
|
12444
|
+
* cap with the matching `scope` declaration. New caps inherit grants
|
|
12445
|
+
* automatically — adding a device cap to the codebase makes it
|
|
12446
|
+
* reachable to every user with `category:device [...]` without a
|
|
12447
|
+
* re-grant. Use this for "family viewer" / "operator" tiers.
|
|
12448
|
+
*
|
|
12449
|
+
* - `addon` — every cap that ships inside a given addon id. Niche;
|
|
12450
|
+
* useful when an integration needs to interact with one specific
|
|
12451
|
+
* addon's surface regardless of how many caps it exports.
|
|
12452
|
+
*
|
|
12453
|
+
* - `capability` — the most precise form. Single cap name. Use for
|
|
12454
|
+
* integration tokens where you want to grant `addons.installPackage`
|
|
12455
|
+
* and nothing else.
|
|
12456
|
+
*
|
|
12457
|
+
* `access` is REQUIRED with min 1 element. `admin` bypass is the
|
|
12458
|
+
* "give me everything" escape; there is no wildcard scope.
|
|
12459
|
+
*/
|
|
12460
|
+
var AllowedProviderSchema = union([literal("*"), array(string())]);
|
|
12461
|
+
var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
|
|
12462
|
+
var CapScopeSchema = _enum(["device", "system"]);
|
|
12463
|
+
/**
|
|
12464
|
+
* DeviceSelector (scope model v3 — 2026-08-12).
|
|
12465
|
+
*
|
|
12466
|
+
* A `device` grant no longer carries a frozen list of deviceIds. It carries
|
|
12467
|
+
* a SELECTOR the matcher resolves against the live fleet, so the grant can be
|
|
12468
|
+
* DYNAMIC: a `types:['camera']` selector automatically covers a camera added
|
|
12469
|
+
* AFTER the grant was minted — no re-grant, no re-login.
|
|
12470
|
+
*
|
|
12471
|
+
* - `all` — every device in the deployment. The broad viewer/operator
|
|
12472
|
+
* lever without a `category` grant (a `category` grant also covers device
|
|
12473
|
+
* caps that carry no deviceId; `all` is specifically the device set).
|
|
12474
|
+
* - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
|
|
12475
|
+
* grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
|
|
12476
|
+
* is NOT covered until the grant is edited.
|
|
12477
|
+
* - `types` — every device of a `DeviceType` (e.g. every `camera`).
|
|
12478
|
+
* DYNAMIC. A device that changes type, or a new device of the type,
|
|
12479
|
+
* re-resolves on the next request.
|
|
12480
|
+
* - `locations` — every device whose operator-assigned `location` label is
|
|
12481
|
+
* in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
|
|
12482
|
+
* null/unset location matches NO `locations` selector.
|
|
12483
|
+
*/
|
|
12484
|
+
var DeviceSelectorSchema = discriminatedUnion("kind", [
|
|
12485
|
+
object({ kind: literal("all") }),
|
|
12486
|
+
object({
|
|
12487
|
+
kind: literal("ids"),
|
|
12488
|
+
ids: array(number().int()).min(1)
|
|
12489
|
+
}),
|
|
12490
|
+
object({
|
|
12491
|
+
kind: literal("types"),
|
|
12492
|
+
types: array(_enum(DeviceType)).min(1)
|
|
12493
|
+
}),
|
|
12494
|
+
object({
|
|
12495
|
+
kind: literal("locations"),
|
|
12496
|
+
locations: array(string().min(1)).min(1)
|
|
12497
|
+
})
|
|
12498
|
+
]);
|
|
12499
|
+
var DeviceTokenScopeSchema = object({
|
|
12500
|
+
type: literal("device"),
|
|
12501
|
+
/** The device SET this grant covers — resolved against the live fleet. */
|
|
12502
|
+
selector: DeviceSelectorSchema,
|
|
12503
|
+
access: array(MethodAccessSchema).min(1),
|
|
12504
|
+
/**
|
|
12505
|
+
* Whether a grant on a PARENT device transparently covers its accessory
|
|
12506
|
+
* CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
|
|
12507
|
+
* Direction is parent → children ONLY.
|
|
12508
|
+
*
|
|
12509
|
+
* Absent → the matcher DERIVES it from the access flavour: `view`
|
|
12510
|
+
* inherits (a camera viewer sees the camera's accessories), `create` /
|
|
12511
|
+
* `delete` do NOT (actuating/removing a child is an explicit act the
|
|
12512
|
+
* operator must grant on the child, not inherit from the parent). Set it
|
|
12513
|
+
* explicitly to override that default per grant.
|
|
12514
|
+
*/
|
|
12515
|
+
includeLinked: boolean().optional()
|
|
12516
|
+
});
|
|
12517
|
+
/**
|
|
12518
|
+
* v2 → v3 lazy migration. A pre-v3 `device` grant carried
|
|
12519
|
+
* `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
|
|
12520
|
+
* `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
|
|
12521
|
+
* EVERY parse path — stored records AND the JWT-carried scope arrays
|
|
12522
|
+
* normalised at the request boundary ({@link normalizeTokenScopes} in
|
|
12523
|
+
* `device-selector.ts`). Chosen over a one-time DB migration because a
|
|
12524
|
+
* migration cannot reach a JWT already in a client's hands; parse-time
|
|
12525
|
+
* migration covers both without a flag day. No cast — the raw object is read
|
|
12526
|
+
* through `Reflect.get` (its static type is `unknown`).
|
|
12527
|
+
*/
|
|
12528
|
+
function migrateLegacyTokenScope(raw) {
|
|
12529
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
12530
|
+
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
12531
|
+
if (Reflect.get(raw, "selector") !== void 0) return raw;
|
|
12532
|
+
const targets = Reflect.get(raw, "targets");
|
|
12533
|
+
if (!Array.isArray(targets)) return raw;
|
|
12534
|
+
return {
|
|
12535
|
+
type: "device",
|
|
12536
|
+
selector: {
|
|
12537
|
+
kind: "ids",
|
|
12538
|
+
ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
|
|
12539
|
+
},
|
|
12540
|
+
access: Reflect.get(raw, "access")
|
|
12541
|
+
};
|
|
12542
|
+
}
|
|
12543
|
+
var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
|
|
12544
|
+
object({
|
|
12545
|
+
type: literal("category"),
|
|
12546
|
+
target: CapScopeSchema,
|
|
12547
|
+
access: array(MethodAccessSchema).min(1)
|
|
12548
|
+
}),
|
|
12549
|
+
object({
|
|
12550
|
+
type: literal("capability"),
|
|
12551
|
+
target: string(),
|
|
12552
|
+
access: array(MethodAccessSchema).min(1)
|
|
12553
|
+
}),
|
|
12554
|
+
object({
|
|
12555
|
+
type: literal("addon"),
|
|
12556
|
+
target: string(),
|
|
12557
|
+
access: array(MethodAccessSchema).min(1)
|
|
12558
|
+
}),
|
|
12559
|
+
DeviceTokenScopeSchema
|
|
12560
|
+
]));
|
|
12561
|
+
object({
|
|
12562
|
+
id: string(),
|
|
12563
|
+
username: string(),
|
|
12564
|
+
passwordHash: string(),
|
|
12565
|
+
/**
|
|
12566
|
+
* Admin bypass. When true, the middleware skips the scope-access
|
|
12567
|
+
* check entirely. There is no other axis of privilege; the legacy
|
|
12568
|
+
* role enum collapsed onto this boolean in v2.
|
|
12569
|
+
*/
|
|
12570
|
+
isAdmin: boolean().default(false),
|
|
12571
|
+
allowedProviders: AllowedProviderSchema,
|
|
12572
|
+
allowedDevices: AllowedDevicesSchema,
|
|
12573
|
+
/**
|
|
12574
|
+
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
12575
|
+
* ignored. Non-admins without scopes are locked out of every
|
|
12576
|
+
* protected call.
|
|
12577
|
+
*/
|
|
12578
|
+
scopes: array(TokenScopeSchema).default([]),
|
|
12579
|
+
createdAt: number(),
|
|
12580
|
+
updatedAt: number()
|
|
12581
|
+
});
|
|
12582
|
+
object({
|
|
12583
|
+
id: string(),
|
|
12584
|
+
label: string(),
|
|
12585
|
+
isAdmin: boolean().default(false),
|
|
12586
|
+
allowedProviders: AllowedProviderSchema,
|
|
12587
|
+
allowedDevices: AllowedDevicesSchema,
|
|
12588
|
+
tokenHash: string(),
|
|
12589
|
+
tokenPrefix: string(),
|
|
12590
|
+
createdAt: number(),
|
|
12591
|
+
lastUsedAt: number().optional()
|
|
12592
|
+
});
|
|
12593
|
+
object({
|
|
12594
|
+
id: string(),
|
|
12595
|
+
userId: string(),
|
|
12596
|
+
name: string(),
|
|
12597
|
+
tokenHash: string(),
|
|
12598
|
+
tokenPrefix: string(),
|
|
12599
|
+
scopes: array(TokenScopeSchema),
|
|
12600
|
+
expiresAt: number().nullish(),
|
|
12601
|
+
lastUsedAt: number().nullish(),
|
|
12602
|
+
createdAt: number()
|
|
12603
|
+
});
|
|
12604
|
+
/** What a share-view grant lets its holder see. */
|
|
12605
|
+
var ShareViewGrantSchema = object({
|
|
12606
|
+
kind: _enum(SHARE_VIEW_KINDS),
|
|
12607
|
+
deviceIds: array(number().int().nonnegative()).min(1).max(64),
|
|
12608
|
+
/** Talk-back, opt-in at mint time; absent means off. */
|
|
12609
|
+
talk: boolean().optional()
|
|
12610
|
+
});
|
|
12611
|
+
var ShareViewScopeSchema = object({
|
|
12612
|
+
type: literal("share-view"),
|
|
12613
|
+
grant: ShareViewGrantSchema
|
|
12614
|
+
});
|
|
12615
|
+
var AddonRoutesScopeSchema = object({
|
|
12616
|
+
type: literal("addon-routes"),
|
|
12617
|
+
access: array(MethodAccessSchema).min(1)
|
|
12618
|
+
});
|
|
12619
|
+
var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
|
|
12620
|
+
var CredentialScopeSchema = union([
|
|
12621
|
+
literal("*"),
|
|
12622
|
+
ShareViewScopeSchema,
|
|
12623
|
+
AddonRoutesScopeSchema,
|
|
12624
|
+
PreferencesSelfScopeSchema,
|
|
12625
|
+
TokenScopeSchema
|
|
12626
|
+
]);
|
|
12627
|
+
object({
|
|
12628
|
+
kind: literal("credential"),
|
|
12629
|
+
sub: string().min(1),
|
|
12630
|
+
jti: string().min(16),
|
|
12631
|
+
scopes: array(CredentialScopeSchema).min(1)
|
|
12632
|
+
});
|
|
12633
|
+
var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
|
|
12634
|
+
/** A namespace's value: a JSON object, opaque to the hub. */
|
|
12635
|
+
var PreferenceValueSchema = record(string(), unknown());
|
|
12636
|
+
var PreferenceDeviceIdSchema = string().min(1).max(64);
|
|
12637
|
+
/** A stored row, as the owner reads it. */
|
|
12638
|
+
var PreferenceRowSchema = object({
|
|
12639
|
+
namespace: PreferenceNamespaceSchema,
|
|
12640
|
+
value: PreferenceValueSchema,
|
|
12641
|
+
/** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
|
|
12642
|
+
revision: number().int().positive(),
|
|
12643
|
+
updatedAt: number().int(),
|
|
12644
|
+
/** The client id the last writer sent; `null` when it sent none. */
|
|
12645
|
+
updatedByDevice: PreferenceDeviceIdSchema.nullable()
|
|
12646
|
+
});
|
|
12647
|
+
object({
|
|
12648
|
+
/** Absent: every namespace the caller holds. */
|
|
12649
|
+
namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
|
|
12650
|
+
object({ rows: array(PreferenceRowSchema) });
|
|
12651
|
+
object({
|
|
12652
|
+
namespace: PreferenceNamespaceSchema,
|
|
12653
|
+
value: PreferenceValueSchema,
|
|
12654
|
+
/**
|
|
12655
|
+
* The revision the edit was based on. Absent: last write wins. `0`: the
|
|
12656
|
+
* namespace must not exist yet. Any other value that is not the current
|
|
12657
|
+
* revision answers `conflict` and writes nothing.
|
|
12658
|
+
*/
|
|
12659
|
+
baseRevision: number().int().nonnegative().optional(),
|
|
12660
|
+
deviceId: PreferenceDeviceIdSchema.optional()
|
|
12661
|
+
});
|
|
12662
|
+
discriminatedUnion("status", [object({
|
|
12663
|
+
status: literal("saved"),
|
|
12664
|
+
row: PreferenceRowSchema
|
|
12665
|
+
}), object({
|
|
12666
|
+
status: literal("conflict"),
|
|
12667
|
+
current: PreferenceRowSchema.nullable()
|
|
12668
|
+
})]);
|
|
12669
|
+
object({ namespace: PreferenceNamespaceSchema });
|
|
12670
|
+
object({
|
|
12671
|
+
/** `false` when the namespace did not exist. */
|
|
12672
|
+
deleted: boolean() });
|
|
12673
|
+
object({
|
|
12674
|
+
/** The revision the client holds per namespace; a namespace it does not list is new to it. */
|
|
12675
|
+
revisionByNamespace: record(PreferenceNamespaceSchema, number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
|
|
12676
|
+
object({
|
|
12677
|
+
/** Every row whose revision differs from the client's, and every row it did not list. */
|
|
12678
|
+
rows: array(PreferenceRowSchema),
|
|
12679
|
+
/** Namespaces the client listed that no longer exist. */
|
|
12680
|
+
deleted: array(PreferenceNamespaceSchema)
|
|
12681
|
+
});
|
|
12402
12682
|
_enum(["new-session", "step-up"]);
|
|
12403
12683
|
/** The languages the hub's app landing pages are written in (D858). */
|
|
12404
12684
|
var AppPageLangSchema = _enum(["en", "it"]);
|
|
@@ -39277,38 +39557,37 @@ method(LlmRuntimeCompleteInputSchema, LlmGenerateResultSchema, {
|
|
|
39277
39557
|
auth: "admin",
|
|
39278
39558
|
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
39279
39559
|
});
|
|
39560
|
+
var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
|
|
39561
|
+
/** What a model (or, by default, every model of a kind) can do. */
|
|
39562
|
+
var LlmModelFeaturesSchema = object({
|
|
39563
|
+
vision: boolean(),
|
|
39564
|
+
tools: boolean(),
|
|
39565
|
+
streaming: boolean()
|
|
39566
|
+
});
|
|
39567
|
+
/** One model a provider offers. `features` overrides the kind's defaults, per field. */
|
|
39568
|
+
var LlmModelInfoSchema = object({
|
|
39569
|
+
id: string(),
|
|
39570
|
+
label: string().optional(),
|
|
39571
|
+
contextLength: number().int().positive().optional(),
|
|
39572
|
+
features: LlmModelFeaturesSchema.partial().optional()
|
|
39573
|
+
});
|
|
39280
39574
|
/**
|
|
39281
|
-
*
|
|
39282
|
-
*
|
|
39283
|
-
*
|
|
39284
|
-
*
|
|
39285
|
-
* (hub-placed); the cap stays open for future providers.
|
|
39286
|
-
*
|
|
39287
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
39288
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
39289
|
-
* write; a stored key NEVER round-trips to a client.
|
|
39575
|
+
* The provider-specific part of a profile, validated by the provider that owns
|
|
39576
|
+
* the kind (`upsertProfile` refuses what it does not accept). A field its
|
|
39577
|
+
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
39578
|
+
* keychain, never in the row, and reads back as the redaction marker.
|
|
39290
39579
|
*/
|
|
39291
|
-
var
|
|
39292
|
-
"openai-compatible",
|
|
39293
|
-
"openai",
|
|
39294
|
-
"anthropic",
|
|
39295
|
-
"google",
|
|
39296
|
-
"managed-local",
|
|
39297
|
-
"apple-foundation"
|
|
39298
|
-
]);
|
|
39580
|
+
var LlmProviderConfigSchema = record(string(), unknown());
|
|
39299
39581
|
var LlmProfileSchema = object({
|
|
39300
39582
|
id: string(),
|
|
39301
39583
|
name: string(),
|
|
39584
|
+
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
39302
39585
|
kind: LlmProfileKindSchema,
|
|
39303
39586
|
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
39304
39587
|
addonId: string(),
|
|
39305
39588
|
enabled: boolean(),
|
|
39306
39589
|
/** Vendor model id, or the managed runtime's loaded model. */
|
|
39307
39590
|
model: string(),
|
|
39308
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
39309
|
-
baseUrl: string().optional(),
|
|
39310
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
39311
|
-
apiKey: string().optional(),
|
|
39312
39591
|
/** Vision on/off. A vision call against a `false` profile is REFUSED, never
|
|
39313
39592
|
* degraded to text — that shipped once and produced a confident answer to a
|
|
39314
39593
|
* question about a picture nobody sent. */
|
|
@@ -39316,15 +39595,11 @@ var LlmProfileSchema = object({
|
|
|
39316
39595
|
temperature: number().min(0).max(2).optional(),
|
|
39317
39596
|
/** Nucleus sampling. Every wire we speak has it. */
|
|
39318
39597
|
topP: number().min(0).max(1).optional(),
|
|
39319
|
-
/** Top-k sampling. Carried only by the wires that have it —
|
|
39320
|
-
*
|
|
39321
|
-
* `top_p` and no `top_k`). The profile editor hides the field wherever it
|
|
39322
|
-
* would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
|
|
39598
|
+
/** Top-k sampling. Carried only by the wires that have it — a kind offers the
|
|
39599
|
+
* field in its editor only when its descriptor lists it in `profileFields`. */
|
|
39323
39600
|
topK: number().int().positive().optional(),
|
|
39324
39601
|
maxTokens: number().int().positive().optional(),
|
|
39325
|
-
/** Prompt context window. Advisory for cloud kinds (they enforce their own)
|
|
39326
|
-
* for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
|
|
39327
|
-
* the model with, so it is the one field that changes a PROCESS. */
|
|
39602
|
+
/** Prompt context window. Advisory for cloud kinds (they enforce their own). */
|
|
39328
39603
|
contextLength: number().int().positive().optional(),
|
|
39329
39604
|
/** Default system prompt. A caller's `system` REPLACES it (never appends —
|
|
39330
39605
|
* two system prompts fighting is worse than either alone). */
|
|
@@ -39350,16 +39625,37 @@ var LlmProfileSchema = object({
|
|
|
39350
39625
|
* library; the REGISTRY of callable tools is ours and is empty in v1, so a
|
|
39351
39626
|
* `true` here buys the wiring, not behaviour, until tools are registered. */
|
|
39352
39627
|
toolsEnabled: boolean().default(false),
|
|
39353
|
-
|
|
39354
|
-
|
|
39355
|
-
|
|
39356
|
-
|
|
39357
|
-
|
|
39358
|
-
|
|
39359
|
-
|
|
39360
|
-
|
|
39361
|
-
|
|
39362
|
-
|
|
39628
|
+
/** Everything the kind's provider owns (endpoint, key, node, runtime…). */
|
|
39629
|
+
providerConfig: LlmProviderConfigSchema.default({})
|
|
39630
|
+
});
|
|
39631
|
+
/**
|
|
39632
|
+
* The common profile fields a kind's editor offers. The editor owns how each
|
|
39633
|
+
* one is drawn; the provider says which of them mean something on its wire.
|
|
39634
|
+
*/
|
|
39635
|
+
var LlmProfileFieldSchema = _enum([
|
|
39636
|
+
"temperature",
|
|
39637
|
+
"topP",
|
|
39638
|
+
"topK",
|
|
39639
|
+
"maxTokens",
|
|
39640
|
+
"contextLength",
|
|
39641
|
+
"systemPrompt",
|
|
39642
|
+
"timeoutMs",
|
|
39643
|
+
"connectTimeoutMs",
|
|
39644
|
+
"firstTokenTimeoutMs",
|
|
39645
|
+
"idleTimeoutMs",
|
|
39646
|
+
"retry",
|
|
39647
|
+
"toolsEnabled"
|
|
39648
|
+
]);
|
|
39649
|
+
/**
|
|
39650
|
+
* A provider-drawn part of the editor, by a generic widget id the admin UI
|
|
39651
|
+
* registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
|
|
39652
|
+
* picker: that widget owns the model choice.
|
|
39653
|
+
*/
|
|
39654
|
+
var LlmProviderWidgetSchema = object({
|
|
39655
|
+
id: string(),
|
|
39656
|
+
placement: _enum(["connection", "model"]),
|
|
39657
|
+
/** `providerConfig` keys this widget must fill before the profile can be saved. */
|
|
39658
|
+
requires: array(string()).optional()
|
|
39363
39659
|
});
|
|
39364
39660
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
39365
39661
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
@@ -39368,11 +39664,56 @@ var ConfigSchemaPassthrough$3 = unknown();
|
|
|
39368
39664
|
var LlmProfileKindDescriptorSchema = object({
|
|
39369
39665
|
kind: LlmProfileKindSchema,
|
|
39370
39666
|
label: string(),
|
|
39667
|
+
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
39371
39668
|
icon: string(),
|
|
39372
39669
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
39373
39670
|
addonId: string(),
|
|
39374
|
-
|
|
39671
|
+
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
39672
|
+
connectionSchema: ConfigSchemaPassthrough$3,
|
|
39673
|
+
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
39674
|
+
advancedSchema: ConfigSchemaPassthrough$3.optional(),
|
|
39675
|
+
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
39676
|
+
features: LlmModelFeaturesSchema,
|
|
39677
|
+
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
39678
|
+
visionEditable: boolean(),
|
|
39679
|
+
/** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
|
|
39680
|
+
modelCatalog: _enum([
|
|
39681
|
+
"fetch",
|
|
39682
|
+
"static",
|
|
39683
|
+
"none"
|
|
39684
|
+
]),
|
|
39685
|
+
staticModels: array(LlmModelInfoSchema).optional(),
|
|
39686
|
+
/** The common fields that mean something on this kind's wire. */
|
|
39687
|
+
profileFields: array(LlmProfileFieldSchema),
|
|
39688
|
+
providerWidgets: array(LlmProviderWidgetSchema).optional()
|
|
39689
|
+
});
|
|
39690
|
+
/**
|
|
39691
|
+
* `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
|
|
39692
|
+
* (the editor's form); with `profileId` too, a secret the draft leaves
|
|
39693
|
+
* untouched (absent or the redaction marker) is resolved server-side from the
|
|
39694
|
+
* stored profile — the browser never receives it.
|
|
39695
|
+
*/
|
|
39696
|
+
var LlmListModelsInputSchema = object({
|
|
39697
|
+
addonId: string(),
|
|
39698
|
+
kind: LlmProfileKindSchema,
|
|
39699
|
+
profileId: string().optional(),
|
|
39700
|
+
connection: LlmProviderConfigSchema.optional()
|
|
39375
39701
|
});
|
|
39702
|
+
var LlmListModelsErrorCodeSchema = _enum([
|
|
39703
|
+
"auth",
|
|
39704
|
+
"network",
|
|
39705
|
+
"unsupported",
|
|
39706
|
+
"invalid"
|
|
39707
|
+
]);
|
|
39708
|
+
/** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
|
|
39709
|
+
var LlmListModelsResultSchema = discriminatedUnion("ok", [object({
|
|
39710
|
+
ok: literal(true),
|
|
39711
|
+
models: array(LlmModelInfoSchema)
|
|
39712
|
+
}), object({
|
|
39713
|
+
ok: literal(false),
|
|
39714
|
+
code: LlmListModelsErrorCodeSchema,
|
|
39715
|
+
message: string()
|
|
39716
|
+
})]);
|
|
39376
39717
|
var LlmDefaultSelectorSchema = union([object({ consumer: string() }), object({ purpose: _enum(["text", "vision"]) })]);
|
|
39377
39718
|
var LlmDefaultSchema = object({
|
|
39378
39719
|
selector: LlmDefaultSelectorSchema,
|
|
@@ -39472,7 +39813,10 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
39472
39813
|
kind: "mutation",
|
|
39473
39814
|
auth: "admin",
|
|
39474
39815
|
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
39475
|
-
}), method(
|
|
39816
|
+
}), method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
39817
|
+
kind: "mutation",
|
|
39818
|
+
auth: "admin"
|
|
39819
|
+
}), method(object({}), array(LlmDefaultSchema)), method(object({
|
|
39476
39820
|
selector: LlmDefaultSelectorSchema,
|
|
39477
39821
|
profileId: string().nullable()
|
|
39478
39822
|
}), _void(), {
|
|
@@ -43536,202 +43880,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
43536
43880
|
auth: "admin"
|
|
43537
43881
|
}), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
|
|
43538
43882
|
/**
|
|
43539
|
-
* Zod schemas for persisted record types.
|
|
43540
|
-
*
|
|
43541
|
-
* These schemas serve as the single source of truth for types that are
|
|
43542
|
-
* stored in the settings-store backend and retrieved via tRPC. They
|
|
43543
|
-
* replace the manual TypeScript interfaces with schema-derived types,
|
|
43544
|
-
* enabling runtime validation when reading from the backend.
|
|
43545
|
-
*
|
|
43546
|
-
* Convention: each schema is named `<Type>Schema`, the inferred TS type
|
|
43547
|
-
* keeps the original name for backward compatibility.
|
|
43548
|
-
*/
|
|
43549
|
-
/**
|
|
43550
|
-
* Auth model (v2 — 2026-05-12 caps-only):
|
|
43551
|
-
*
|
|
43552
|
-
* Two principals:
|
|
43553
|
-
* - `isAdmin: true` — full bypass. Admin scope set is ignored.
|
|
43554
|
-
* - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
|
|
43555
|
-
*
|
|
43556
|
-
* No role enum. There used to be `viewer / agent / scoped` and earlier
|
|
43557
|
-
* `super_admin` — collapsed onto the single boolean because every
|
|
43558
|
-
* non-admin caller is governed by the same scope-check rules; the
|
|
43559
|
-
* distinction was only ever used to route role-specific procedures
|
|
43560
|
-
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
43561
|
-
* with `isAdmin: false` + an explicit scope list.
|
|
43562
|
-
*/
|
|
43563
|
-
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
43564
|
-
var MethodAccessSchema = _enum([
|
|
43565
|
-
"view",
|
|
43566
|
-
"create",
|
|
43567
|
-
"delete"
|
|
43568
|
-
]);
|
|
43569
|
-
/**
|
|
43570
|
-
* A single scope grant. Three forms — checked in matcher with OR
|
|
43571
|
-
* semantics; the first match decides whether the call passes:
|
|
43572
|
-
*
|
|
43573
|
-
* - `category` — broadest. `target: 'device' | 'system'` selects every
|
|
43574
|
-
* cap with the matching `scope` declaration. New caps inherit grants
|
|
43575
|
-
* automatically — adding a device cap to the codebase makes it
|
|
43576
|
-
* reachable to every user with `category:device [...]` without a
|
|
43577
|
-
* re-grant. Use this for "family viewer" / "operator" tiers.
|
|
43578
|
-
*
|
|
43579
|
-
* - `addon` — every cap that ships inside a given addon id. Niche;
|
|
43580
|
-
* useful when an integration needs to interact with one specific
|
|
43581
|
-
* addon's surface regardless of how many caps it exports.
|
|
43582
|
-
*
|
|
43583
|
-
* - `capability` — the most precise form. Single cap name. Use for
|
|
43584
|
-
* integration tokens where you want to grant `addons.installPackage`
|
|
43585
|
-
* and nothing else.
|
|
43586
|
-
*
|
|
43587
|
-
* `access` is REQUIRED with min 1 element. `admin` bypass is the
|
|
43588
|
-
* "give me everything" escape; there is no wildcard scope.
|
|
43589
|
-
*/
|
|
43590
|
-
var AllowedProviderSchema = union([literal("*"), array(string())]);
|
|
43591
|
-
var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
|
|
43592
|
-
var CapScopeSchema = _enum(["device", "system"]);
|
|
43593
|
-
/**
|
|
43594
|
-
* DeviceSelector (scope model v3 — 2026-08-12).
|
|
43595
|
-
*
|
|
43596
|
-
* A `device` grant no longer carries a frozen list of deviceIds. It carries
|
|
43597
|
-
* a SELECTOR the matcher resolves against the live fleet, so the grant can be
|
|
43598
|
-
* DYNAMIC: a `types:['camera']` selector automatically covers a camera added
|
|
43599
|
-
* AFTER the grant was minted — no re-grant, no re-login.
|
|
43600
|
-
*
|
|
43601
|
-
* - `all` — every device in the deployment. The broad viewer/operator
|
|
43602
|
-
* lever without a `category` grant (a `category` grant also covers device
|
|
43603
|
-
* caps that carry no deviceId; `all` is specifically the device set).
|
|
43604
|
-
* - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
|
|
43605
|
-
* grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
|
|
43606
|
-
* is NOT covered until the grant is edited.
|
|
43607
|
-
* - `types` — every device of a `DeviceType` (e.g. every `camera`).
|
|
43608
|
-
* DYNAMIC. A device that changes type, or a new device of the type,
|
|
43609
|
-
* re-resolves on the next request.
|
|
43610
|
-
* - `locations` — every device whose operator-assigned `location` label is
|
|
43611
|
-
* in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
|
|
43612
|
-
* null/unset location matches NO `locations` selector.
|
|
43613
|
-
*/
|
|
43614
|
-
var DeviceSelectorSchema = discriminatedUnion("kind", [
|
|
43615
|
-
object({ kind: literal("all") }),
|
|
43616
|
-
object({
|
|
43617
|
-
kind: literal("ids"),
|
|
43618
|
-
ids: array(number().int()).min(1)
|
|
43619
|
-
}),
|
|
43620
|
-
object({
|
|
43621
|
-
kind: literal("types"),
|
|
43622
|
-
types: array(_enum(DeviceType)).min(1)
|
|
43623
|
-
}),
|
|
43624
|
-
object({
|
|
43625
|
-
kind: literal("locations"),
|
|
43626
|
-
locations: array(string().min(1)).min(1)
|
|
43627
|
-
})
|
|
43628
|
-
]);
|
|
43629
|
-
var DeviceTokenScopeSchema = object({
|
|
43630
|
-
type: literal("device"),
|
|
43631
|
-
/** The device SET this grant covers — resolved against the live fleet. */
|
|
43632
|
-
selector: DeviceSelectorSchema,
|
|
43633
|
-
access: array(MethodAccessSchema).min(1),
|
|
43634
|
-
/**
|
|
43635
|
-
* Whether a grant on a PARENT device transparently covers its accessory
|
|
43636
|
-
* CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
|
|
43637
|
-
* Direction is parent → children ONLY.
|
|
43638
|
-
*
|
|
43639
|
-
* Absent → the matcher DERIVES it from the access flavour: `view`
|
|
43640
|
-
* inherits (a camera viewer sees the camera's accessories), `create` /
|
|
43641
|
-
* `delete` do NOT (actuating/removing a child is an explicit act the
|
|
43642
|
-
* operator must grant on the child, not inherit from the parent). Set it
|
|
43643
|
-
* explicitly to override that default per grant.
|
|
43644
|
-
*/
|
|
43645
|
-
includeLinked: boolean().optional()
|
|
43646
|
-
});
|
|
43647
|
-
/**
|
|
43648
|
-
* v2 → v3 lazy migration. A pre-v3 `device` grant carried
|
|
43649
|
-
* `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
|
|
43650
|
-
* `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
|
|
43651
|
-
* EVERY parse path — stored records AND the JWT-carried scope arrays
|
|
43652
|
-
* normalised at the request boundary ({@link normalizeTokenScopes} in
|
|
43653
|
-
* `device-selector.ts`). Chosen over a one-time DB migration because a
|
|
43654
|
-
* migration cannot reach a JWT already in a client's hands; parse-time
|
|
43655
|
-
* migration covers both without a flag day. No cast — the raw object is read
|
|
43656
|
-
* through `Reflect.get` (its static type is `unknown`).
|
|
43657
|
-
*/
|
|
43658
|
-
function migrateLegacyTokenScope(raw) {
|
|
43659
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
43660
|
-
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
43661
|
-
if (Reflect.get(raw, "selector") !== void 0) return raw;
|
|
43662
|
-
const targets = Reflect.get(raw, "targets");
|
|
43663
|
-
if (!Array.isArray(targets)) return raw;
|
|
43664
|
-
return {
|
|
43665
|
-
type: "device",
|
|
43666
|
-
selector: {
|
|
43667
|
-
kind: "ids",
|
|
43668
|
-
ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
|
|
43669
|
-
},
|
|
43670
|
-
access: Reflect.get(raw, "access")
|
|
43671
|
-
};
|
|
43672
|
-
}
|
|
43673
|
-
var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
|
|
43674
|
-
object({
|
|
43675
|
-
type: literal("category"),
|
|
43676
|
-
target: CapScopeSchema,
|
|
43677
|
-
access: array(MethodAccessSchema).min(1)
|
|
43678
|
-
}),
|
|
43679
|
-
object({
|
|
43680
|
-
type: literal("capability"),
|
|
43681
|
-
target: string(),
|
|
43682
|
-
access: array(MethodAccessSchema).min(1)
|
|
43683
|
-
}),
|
|
43684
|
-
object({
|
|
43685
|
-
type: literal("addon"),
|
|
43686
|
-
target: string(),
|
|
43687
|
-
access: array(MethodAccessSchema).min(1)
|
|
43688
|
-
}),
|
|
43689
|
-
DeviceTokenScopeSchema
|
|
43690
|
-
]));
|
|
43691
|
-
object({
|
|
43692
|
-
id: string(),
|
|
43693
|
-
username: string(),
|
|
43694
|
-
passwordHash: string(),
|
|
43695
|
-
/**
|
|
43696
|
-
* Admin bypass. When true, the middleware skips the scope-access
|
|
43697
|
-
* check entirely. There is no other axis of privilege; the legacy
|
|
43698
|
-
* role enum collapsed onto this boolean in v2.
|
|
43699
|
-
*/
|
|
43700
|
-
isAdmin: boolean().default(false),
|
|
43701
|
-
allowedProviders: AllowedProviderSchema,
|
|
43702
|
-
allowedDevices: AllowedDevicesSchema,
|
|
43703
|
-
/**
|
|
43704
|
-
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
43705
|
-
* ignored. Non-admins without scopes are locked out of every
|
|
43706
|
-
* protected call.
|
|
43707
|
-
*/
|
|
43708
|
-
scopes: array(TokenScopeSchema).default([]),
|
|
43709
|
-
createdAt: number(),
|
|
43710
|
-
updatedAt: number()
|
|
43711
|
-
});
|
|
43712
|
-
object({
|
|
43713
|
-
id: string(),
|
|
43714
|
-
label: string(),
|
|
43715
|
-
isAdmin: boolean().default(false),
|
|
43716
|
-
allowedProviders: AllowedProviderSchema,
|
|
43717
|
-
allowedDevices: AllowedDevicesSchema,
|
|
43718
|
-
tokenHash: string(),
|
|
43719
|
-
tokenPrefix: string(),
|
|
43720
|
-
createdAt: number(),
|
|
43721
|
-
lastUsedAt: number().optional()
|
|
43722
|
-
});
|
|
43723
|
-
object({
|
|
43724
|
-
id: string(),
|
|
43725
|
-
userId: string(),
|
|
43726
|
-
name: string(),
|
|
43727
|
-
tokenHash: string(),
|
|
43728
|
-
tokenPrefix: string(),
|
|
43729
|
-
scopes: array(TokenScopeSchema),
|
|
43730
|
-
expiresAt: number().nullish(),
|
|
43731
|
-
lastUsedAt: number().nullish(),
|
|
43732
|
-
createdAt: number()
|
|
43733
|
-
});
|
|
43734
|
-
/**
|
|
43735
43883
|
* `oauth-integration` — a collection cap by which an addon declares
|
|
43736
43884
|
* itself a linkable OAuth client of the hub's core `/oauth2/*` server.
|
|
43737
43885
|
* Each provider returns a static descriptor; the core enumerates them
|
|
@@ -60663,26 +60811,6 @@ var ApiKeySummarySchema = object({
|
|
|
60663
60811
|
createdAt: number(),
|
|
60664
60812
|
lastUsedAt: number().optional()
|
|
60665
60813
|
});
|
|
60666
|
-
var ScopedTokenSummarySchema = object({
|
|
60667
|
-
id: string(),
|
|
60668
|
-
userId: string(),
|
|
60669
|
-
name: string(),
|
|
60670
|
-
tokenPrefix: string(),
|
|
60671
|
-
scopes: array(TokenScopeSchema),
|
|
60672
|
-
expiresAt: number().nullish(),
|
|
60673
|
-
lastUsedAt: number().nullish(),
|
|
60674
|
-
createdAt: number()
|
|
60675
|
-
});
|
|
60676
|
-
var CreateScopedTokenInputSchema = object({
|
|
60677
|
-
userId: string(),
|
|
60678
|
-
name: string(),
|
|
60679
|
-
scopes: array(TokenScopeSchema),
|
|
60680
|
-
expiresAt: number().optional()
|
|
60681
|
-
});
|
|
60682
|
-
var CreateScopedTokenResultSchema = object({
|
|
60683
|
-
token: string(),
|
|
60684
|
-
record: ScopedTokenSummarySchema
|
|
60685
|
-
});
|
|
60686
60814
|
var OauthSessionSummarySchema = object({
|
|
60687
60815
|
id: string(),
|
|
60688
60816
|
userId: string(),
|
|
@@ -60704,11 +60832,11 @@ var TotpStatusSchema = object({
|
|
|
60704
60832
|
confirmedAt: number().nullable()
|
|
60705
60833
|
});
|
|
60706
60834
|
/**
|
|
60707
|
-
* user-management — singleton capability for user accounts
|
|
60708
|
-
*
|
|
60835
|
+
* user-management — singleton capability for user accounts and the
|
|
60836
|
+
* legacy API-key rows.
|
|
60709
60837
|
*
|
|
60710
60838
|
* v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
|
|
60711
|
-
* — the subset check on `setUserScopes`
|
|
60839
|
+
* — the subset check on `setUserScopes` is moot
|
|
60712
60840
|
* because non-admins never reach these. If/when we open non-admin
|
|
60713
60841
|
* delegation, structural caller-scope subset check goes inside the
|
|
60714
60842
|
* provider.
|
|
@@ -60765,15 +60893,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
60765
60893
|
kind: "mutation",
|
|
60766
60894
|
auth: "admin",
|
|
60767
60895
|
access: "delete"
|
|
60768
|
-
}), method(
|
|
60769
|
-
kind: "mutation",
|
|
60770
|
-
auth: "admin",
|
|
60771
|
-
access: "create"
|
|
60772
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
60773
|
-
kind: "mutation",
|
|
60774
|
-
auth: "admin",
|
|
60775
|
-
access: "delete"
|
|
60776
|
-
}), method(object({ token: string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }), method(object({ userId: string() }), array(ScopedTokenSummarySchema), { auth: "admin" }), method(object({ userId: string() }), TotpSetupResultSchema, {
|
|
60896
|
+
}), method(object({ userId: string() }), TotpSetupResultSchema, {
|
|
60777
60897
|
kind: "mutation",
|
|
60778
60898
|
auth: "admin",
|
|
60779
60899
|
access: "create"
|
|
@@ -64929,7 +65049,7 @@ Object.freeze({
|
|
|
64929
65049
|
capName: "llm",
|
|
64930
65050
|
capScope: "system",
|
|
64931
65051
|
addonId: null,
|
|
64932
|
-
access: "
|
|
65052
|
+
access: "create"
|
|
64933
65053
|
},
|
|
64934
65054
|
"llm.listNodeModels": {
|
|
64935
65055
|
capName: "llm",
|
|
@@ -69593,12 +69713,6 @@ Object.freeze({
|
|
|
69593
69713
|
addonId: null,
|
|
69594
69714
|
access: "create"
|
|
69595
69715
|
},
|
|
69596
|
-
"userManagement.createScopedToken": {
|
|
69597
|
-
capName: "user-management",
|
|
69598
|
-
capScope: "system",
|
|
69599
|
-
addonId: null,
|
|
69600
|
-
access: "create"
|
|
69601
|
-
},
|
|
69602
69716
|
"userManagement.createUser": {
|
|
69603
69717
|
capName: "user-management",
|
|
69604
69718
|
capScope: "system",
|
|
@@ -69647,12 +69761,6 @@ Object.freeze({
|
|
|
69647
69761
|
addonId: null,
|
|
69648
69762
|
access: "view"
|
|
69649
69763
|
},
|
|
69650
|
-
"userManagement.listScopedTokens": {
|
|
69651
|
-
capName: "user-management",
|
|
69652
|
-
capScope: "system",
|
|
69653
|
-
addonId: null,
|
|
69654
|
-
access: "view"
|
|
69655
|
-
},
|
|
69656
69764
|
"userManagement.listUsers": {
|
|
69657
69765
|
capName: "user-management",
|
|
69658
69766
|
capScope: "system",
|
|
@@ -69707,12 +69815,6 @@ Object.freeze({
|
|
|
69707
69815
|
addonId: null,
|
|
69708
69816
|
access: "delete"
|
|
69709
69817
|
},
|
|
69710
|
-
"userManagement.revokeScopedToken": {
|
|
69711
|
-
capName: "user-management",
|
|
69712
|
-
capScope: "system",
|
|
69713
|
-
addonId: null,
|
|
69714
|
-
access: "delete"
|
|
69715
|
-
},
|
|
69716
69818
|
"userManagement.setupTotp": {
|
|
69717
69819
|
capName: "user-management",
|
|
69718
69820
|
capScope: "system",
|
|
@@ -69743,12 +69845,6 @@ Object.freeze({
|
|
|
69743
69845
|
addonId: null,
|
|
69744
69846
|
access: "view"
|
|
69745
69847
|
},
|
|
69746
|
-
"userManagement.validateScopedToken": {
|
|
69747
|
-
capName: "user-management",
|
|
69748
|
-
capScope: "system",
|
|
69749
|
-
addonId: null,
|
|
69750
|
-
access: "view"
|
|
69751
|
-
},
|
|
69752
69848
|
"userManagement.verifyTotp": {
|
|
69753
69849
|
capName: "user-management",
|
|
69754
69850
|
capScope: "system",
|
|
@@ -74084,7 +74180,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
74084
74180
|
capability: adminUiCapability,
|
|
74085
74181
|
provider: {
|
|
74086
74182
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
74087
|
-
getVersion: async () => ({ version: "1.2.
|
|
74183
|
+
getVersion: async () => ({ version: "1.2.442" })
|
|
74088
74184
|
}
|
|
74089
74185
|
}];
|
|
74090
74186
|
}
|