@camstack/system 1.2.454 → 1.2.456
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/{agent-https-oXsR24R2.mjs → agent-https-fm4AR8XL.mjs} +32 -5
- package/dist/{agent-https-B7IjRRzT.js → agent-https-yjxdfJDA.js} +37 -4
- package/dist/auth/auth-audit-log.d.ts +1 -1
- package/dist/auth/auth-manager.d.ts +16 -1
- package/dist/auth/legacy-token-tables.d.ts +16 -0
- package/dist/auth/user-management-internal.d.ts +9 -28
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +2 -2
- package/dist/builtins/alerts/alerts.addon.mjs +2 -2
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/dist/builtins/device-history/device-history.addon.js +1 -1
- package/dist/builtins/device-history/device-history.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +4 -4
- package/dist/builtins/keychain/index.mjs +4 -4
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/auth-schema.d.ts +4 -7
- package/dist/builtins/local-auth/local-auth.addon.d.ts +7 -8
- package/dist/builtins/local-auth/local-auth.addon.js +1094 -1327
- package/dist/builtins/local-auth/local-auth.addon.mjs +1093 -1324
- package/dist/builtins/local-auth/preferences-record-kinds.d.ts +27 -0
- package/dist/builtins/local-auth/record-kinds.d.ts +4 -3
- package/dist/builtins/local-auth/user-preferences-store.d.ts +56 -0
- package/dist/builtins/local-network/local-network.addon.d.ts +8 -0
- package/dist/builtins/local-network/local-network.addon.js +30 -5
- package/dist/builtins/local-network/local-network.addon.mjs +30 -5
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/record-entries/index.js +1 -1
- package/dist/builtins/record-entries/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/index.js +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +1 -0
- package/dist/builtins/sqlite-storage/records/records-provider.d.ts +13 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +52 -6
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +52 -6
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +3 -3
- package/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-bt6IQDLu.mjs → composition-sources-Ds0Vr6eD.mjs} +1 -1
- package/dist/{composition-sources-Cukc78eu.js → composition-sources-gB4coDJR.js} +1 -1
- package/dist/{constants-DBGG6Zu5.js → constants-CavyKfHZ.js} +1 -1
- package/dist/{constants-DQcVrhVI.mjs → constants-i5oD_gLB.mjs} +1 -1
- package/dist/{device-ca-B3hUVfYk.js → device-ca-bpoEr0zG.js} +1 -1
- package/dist/{device-ca-Utfvsx5x.mjs → device-ca-qz1Pmeu1.mjs} +1 -1
- package/dist/{dist-7ZciHCIp.mjs → dist-BSF_C8W2.mjs} +446 -300
- package/dist/{dist-Bi4Ioxop.js → dist-BpqA2CT0.js} +487 -299
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/{hub-mdns-ciao-BRs3DUT-.mjs → hub-mdns-ciao-CHaGDzyz.mjs} +20 -13
- package/dist/{hub-mdns-ciao-2FzLWfbD.js → hub-mdns-ciao-CZlZRxxA.js} +20 -13
- package/dist/index.d.ts +2 -4
- package/dist/index.js +17 -11
- package/dist/index.mjs +17 -9
- package/dist/{phase6-declare-gate-D-2LMw9o.mjs → phase6-declare-gate-B4yfsf2n.mjs} +1 -1
- package/dist/{phase6-declare-gate-DwYAep7y.js → phase6-declare-gate-n-IZRklX.js} +1 -1
- package/dist/{restore-archive-C0ymYQk7.js → restore-archive-B4QG7XmX.js} +1 -1
- package/dist/{restore-archive-UVZv_hmr.mjs → restore-archive-BGUM4FKf.mjs} +1 -1
- package/dist/tls/cert-issue.d.ts +16 -1
- package/dist/tls/cert-manager.d.ts +6 -0
- package/dist/tls/index.d.ts +1 -1
- package/dist/{wal-maintenance-Df89xxrK.mjs → wal-maintenance-AerF4XE6.mjs} +0 -0
- package/dist/{wal-maintenance-Bo_lo3Dh.js → wal-maintenance-CNEs_I94.js} +0 -0
- package/package.json +1 -1
- package/dist/auth/admin-token-manager.d.ts +0 -51
- package/dist/auth/scoped-token-manager.d.ts +0 -25
|
@@ -745,7 +745,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
745
745
|
return EventCategory;
|
|
746
746
|
}({});
|
|
747
747
|
//#endregion
|
|
748
|
-
//#region ../types/dist/sleep-
|
|
748
|
+
//#region ../types/dist/sleep-yKL5gfrH.mjs
|
|
749
749
|
/**
|
|
750
750
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
751
751
|
* window to float samples (D455).
|
|
@@ -3257,6 +3257,12 @@ function normalizeAddonInitResult(result) {
|
|
|
3257
3257
|
* core proxy and the kernel listener) to keep both off a kernel↔core import.
|
|
3258
3258
|
*/
|
|
3259
3259
|
var DATAPLANE_SECRET_HEADER = "x-camstack-dataplane-secret";
|
|
3260
|
+
/**
|
|
3261
|
+
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
3262
|
+
* and validates them (`ShareViewGrantSchema` builds its
|
|
3263
|
+
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
3264
|
+
*/
|
|
3265
|
+
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
3260
3266
|
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
3261
3267
|
var PeerBytesTicketSchema = zod.z.object({
|
|
3262
3268
|
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
@@ -10392,6 +10398,328 @@ function scopesAllowDeviceCap(scopes, access) {
|
|
|
10392
10398
|
function scopesAllowAddon(scopes, addonId, access) {
|
|
10393
10399
|
return scopes.some((s) => s.type === "addon" && s.target === addonId && s.access.includes(access));
|
|
10394
10400
|
}
|
|
10401
|
+
/**
|
|
10402
|
+
* Zod schemas for persisted record types.
|
|
10403
|
+
*
|
|
10404
|
+
* These schemas serve as the single source of truth for types that are
|
|
10405
|
+
* stored in the settings-store backend and retrieved via tRPC. They
|
|
10406
|
+
* replace the manual TypeScript interfaces with schema-derived types,
|
|
10407
|
+
* enabling runtime validation when reading from the backend.
|
|
10408
|
+
*
|
|
10409
|
+
* Convention: each schema is named `<Type>Schema`, the inferred TS type
|
|
10410
|
+
* keeps the original name for backward compatibility.
|
|
10411
|
+
*/
|
|
10412
|
+
/**
|
|
10413
|
+
* Auth model (v2 — 2026-05-12 caps-only):
|
|
10414
|
+
*
|
|
10415
|
+
* Two principals:
|
|
10416
|
+
* - `isAdmin: true` — full bypass. Admin scope set is ignored.
|
|
10417
|
+
* - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
|
|
10418
|
+
*
|
|
10419
|
+
* No role enum. There used to be `viewer / agent / scoped` and earlier
|
|
10420
|
+
* `super_admin` — collapsed onto the single boolean because every
|
|
10421
|
+
* non-admin caller is governed by the same scope-check rules; the
|
|
10422
|
+
* distinction was only ever used to route role-specific procedures
|
|
10423
|
+
* which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
|
|
10424
|
+
* with `isAdmin: false` + an explicit scope list.
|
|
10425
|
+
*/
|
|
10426
|
+
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
10427
|
+
var MethodAccessSchema = zod.z.enum([
|
|
10428
|
+
"view",
|
|
10429
|
+
"create",
|
|
10430
|
+
"delete"
|
|
10431
|
+
]);
|
|
10432
|
+
/**
|
|
10433
|
+
* A single scope grant. Three forms — checked in matcher with OR
|
|
10434
|
+
* semantics; the first match decides whether the call passes:
|
|
10435
|
+
*
|
|
10436
|
+
* - `category` — broadest. `target: 'device' | 'system'` selects every
|
|
10437
|
+
* cap with the matching `scope` declaration. New caps inherit grants
|
|
10438
|
+
* automatically — adding a device cap to the codebase makes it
|
|
10439
|
+
* reachable to every user with `category:device [...]` without a
|
|
10440
|
+
* re-grant. Use this for "family viewer" / "operator" tiers.
|
|
10441
|
+
*
|
|
10442
|
+
* - `addon` — every cap that ships inside a given addon id. Niche;
|
|
10443
|
+
* useful when an integration needs to interact with one specific
|
|
10444
|
+
* addon's surface regardless of how many caps it exports.
|
|
10445
|
+
*
|
|
10446
|
+
* - `capability` — the most precise form. Single cap name. Use for
|
|
10447
|
+
* integration tokens where you want to grant `addons.installPackage`
|
|
10448
|
+
* and nothing else.
|
|
10449
|
+
*
|
|
10450
|
+
* `access` is REQUIRED with min 1 element. `admin` bypass is the
|
|
10451
|
+
* "give me everything" escape; there is no wildcard scope.
|
|
10452
|
+
*/
|
|
10453
|
+
var AllowedProviderSchema = zod.z.union([zod.z.literal("*"), zod.z.array(zod.z.string())]);
|
|
10454
|
+
var AllowedDevicesSchema = zod.z.record(zod.z.string(), zod.z.union([zod.z.literal("*"), zod.z.array(zod.z.string())]));
|
|
10455
|
+
var CapScopeSchema = zod.z.enum(["device", "system"]);
|
|
10456
|
+
/**
|
|
10457
|
+
* DeviceSelector (scope model v3 — 2026-08-12).
|
|
10458
|
+
*
|
|
10459
|
+
* A `device` grant no longer carries a frozen list of deviceIds. It carries
|
|
10460
|
+
* a SELECTOR the matcher resolves against the live fleet, so the grant can be
|
|
10461
|
+
* DYNAMIC: a `types:['camera']` selector automatically covers a camera added
|
|
10462
|
+
* AFTER the grant was minted — no re-grant, no re-login.
|
|
10463
|
+
*
|
|
10464
|
+
* - `all` — every device in the deployment. The broad viewer/operator
|
|
10465
|
+
* lever without a `category` grant (a `category` grant also covers device
|
|
10466
|
+
* caps that carry no deviceId; `all` is specifically the device set).
|
|
10467
|
+
* - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
|
|
10468
|
+
* grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
|
|
10469
|
+
* is NOT covered until the grant is edited.
|
|
10470
|
+
* - `types` — every device of a `DeviceType` (e.g. every `camera`).
|
|
10471
|
+
* DYNAMIC. A device that changes type, or a new device of the type,
|
|
10472
|
+
* re-resolves on the next request.
|
|
10473
|
+
* - `locations` — every device whose operator-assigned `location` label is
|
|
10474
|
+
* in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
|
|
10475
|
+
* null/unset location matches NO `locations` selector.
|
|
10476
|
+
*/
|
|
10477
|
+
var DeviceSelectorSchema = zod.z.discriminatedUnion("kind", [
|
|
10478
|
+
zod.z.object({ kind: zod.z.literal("all") }),
|
|
10479
|
+
zod.z.object({
|
|
10480
|
+
kind: zod.z.literal("ids"),
|
|
10481
|
+
ids: zod.z.array(zod.z.number().int()).min(1)
|
|
10482
|
+
}),
|
|
10483
|
+
zod.z.object({
|
|
10484
|
+
kind: zod.z.literal("types"),
|
|
10485
|
+
types: zod.z.array(zod.z.enum(DeviceType)).min(1)
|
|
10486
|
+
}),
|
|
10487
|
+
zod.z.object({
|
|
10488
|
+
kind: zod.z.literal("locations"),
|
|
10489
|
+
locations: zod.z.array(zod.z.string().min(1)).min(1)
|
|
10490
|
+
})
|
|
10491
|
+
]);
|
|
10492
|
+
var DeviceTokenScopeSchema = zod.z.object({
|
|
10493
|
+
type: zod.z.literal("device"),
|
|
10494
|
+
/** The device SET this grant covers — resolved against the live fleet. */
|
|
10495
|
+
selector: DeviceSelectorSchema,
|
|
10496
|
+
access: zod.z.array(MethodAccessSchema).min(1),
|
|
10497
|
+
/**
|
|
10498
|
+
* Whether a grant on a PARENT device transparently covers its accessory
|
|
10499
|
+
* CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
|
|
10500
|
+
* Direction is parent → children ONLY.
|
|
10501
|
+
*
|
|
10502
|
+
* Absent → the matcher DERIVES it from the access flavour: `view`
|
|
10503
|
+
* inherits (a camera viewer sees the camera's accessories), `create` /
|
|
10504
|
+
* `delete` do NOT (actuating/removing a child is an explicit act the
|
|
10505
|
+
* operator must grant on the child, not inherit from the parent). Set it
|
|
10506
|
+
* explicitly to override that default per grant.
|
|
10507
|
+
*/
|
|
10508
|
+
includeLinked: zod.z.boolean().optional()
|
|
10509
|
+
});
|
|
10510
|
+
/**
|
|
10511
|
+
* v2 → v3 lazy migration. A pre-v3 `device` grant carried
|
|
10512
|
+
* `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
|
|
10513
|
+
* `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
|
|
10514
|
+
* EVERY parse path — stored records AND the JWT-carried scope arrays
|
|
10515
|
+
* normalised at the request boundary ({@link normalizeTokenScopes} in
|
|
10516
|
+
* `device-selector.ts`). Chosen over a one-time DB migration because a
|
|
10517
|
+
* migration cannot reach a JWT already in a client's hands; parse-time
|
|
10518
|
+
* migration covers both without a flag day. No cast — the raw object is read
|
|
10519
|
+
* through `Reflect.get` (its static type is `unknown`).
|
|
10520
|
+
*/
|
|
10521
|
+
function migrateLegacyTokenScope(raw) {
|
|
10522
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
10523
|
+
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
10524
|
+
if (Reflect.get(raw, "selector") !== void 0) return raw;
|
|
10525
|
+
const targets = Reflect.get(raw, "targets");
|
|
10526
|
+
if (!Array.isArray(targets)) return raw;
|
|
10527
|
+
return {
|
|
10528
|
+
type: "device",
|
|
10529
|
+
selector: {
|
|
10530
|
+
kind: "ids",
|
|
10531
|
+
ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
|
|
10532
|
+
},
|
|
10533
|
+
access: Reflect.get(raw, "access")
|
|
10534
|
+
};
|
|
10535
|
+
}
|
|
10536
|
+
var TokenScopeSchema = zod.z.preprocess(migrateLegacyTokenScope, zod.z.discriminatedUnion("type", [
|
|
10537
|
+
zod.z.object({
|
|
10538
|
+
type: zod.z.literal("category"),
|
|
10539
|
+
target: CapScopeSchema,
|
|
10540
|
+
access: zod.z.array(MethodAccessSchema).min(1)
|
|
10541
|
+
}),
|
|
10542
|
+
zod.z.object({
|
|
10543
|
+
type: zod.z.literal("capability"),
|
|
10544
|
+
target: zod.z.string(),
|
|
10545
|
+
access: zod.z.array(MethodAccessSchema).min(1)
|
|
10546
|
+
}),
|
|
10547
|
+
zod.z.object({
|
|
10548
|
+
type: zod.z.literal("addon"),
|
|
10549
|
+
target: zod.z.string(),
|
|
10550
|
+
access: zod.z.array(MethodAccessSchema).min(1)
|
|
10551
|
+
}),
|
|
10552
|
+
DeviceTokenScopeSchema
|
|
10553
|
+
]));
|
|
10554
|
+
var UserRecordSchema = zod.z.object({
|
|
10555
|
+
id: zod.z.string(),
|
|
10556
|
+
username: zod.z.string(),
|
|
10557
|
+
passwordHash: zod.z.string(),
|
|
10558
|
+
/**
|
|
10559
|
+
* Admin bypass. When true, the middleware skips the scope-access
|
|
10560
|
+
* check entirely. There is no other axis of privilege; the legacy
|
|
10561
|
+
* role enum collapsed onto this boolean in v2.
|
|
10562
|
+
*/
|
|
10563
|
+
isAdmin: zod.z.boolean().default(false),
|
|
10564
|
+
allowedProviders: AllowedProviderSchema,
|
|
10565
|
+
allowedDevices: AllowedDevicesSchema,
|
|
10566
|
+
/**
|
|
10567
|
+
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
10568
|
+
* ignored. Non-admins without scopes are locked out of every
|
|
10569
|
+
* protected call.
|
|
10570
|
+
*/
|
|
10571
|
+
scopes: zod.z.array(TokenScopeSchema).default([]),
|
|
10572
|
+
createdAt: zod.z.number(),
|
|
10573
|
+
updatedAt: zod.z.number()
|
|
10574
|
+
});
|
|
10575
|
+
var ApiKeyRecordSchema = zod.z.object({
|
|
10576
|
+
id: zod.z.string(),
|
|
10577
|
+
label: zod.z.string(),
|
|
10578
|
+
isAdmin: zod.z.boolean().default(false),
|
|
10579
|
+
allowedProviders: AllowedProviderSchema,
|
|
10580
|
+
allowedDevices: AllowedDevicesSchema,
|
|
10581
|
+
tokenHash: zod.z.string(),
|
|
10582
|
+
tokenPrefix: zod.z.string(),
|
|
10583
|
+
createdAt: zod.z.number(),
|
|
10584
|
+
lastUsedAt: zod.z.number().optional()
|
|
10585
|
+
});
|
|
10586
|
+
var ScopedTokenSchema = zod.z.object({
|
|
10587
|
+
id: zod.z.string(),
|
|
10588
|
+
userId: zod.z.string(),
|
|
10589
|
+
name: zod.z.string(),
|
|
10590
|
+
tokenHash: zod.z.string(),
|
|
10591
|
+
tokenPrefix: zod.z.string(),
|
|
10592
|
+
scopes: zod.z.array(TokenScopeSchema),
|
|
10593
|
+
expiresAt: zod.z.number().nullish(),
|
|
10594
|
+
lastUsedAt: zod.z.number().nullish(),
|
|
10595
|
+
createdAt: zod.z.number()
|
|
10596
|
+
});
|
|
10597
|
+
/** What a share-view grant lets its holder see. */
|
|
10598
|
+
var ShareViewGrantSchema = zod.z.object({
|
|
10599
|
+
kind: zod.z.enum(SHARE_VIEW_KINDS),
|
|
10600
|
+
deviceIds: zod.z.array(zod.z.number().int().nonnegative()).min(1).max(64),
|
|
10601
|
+
/** Talk-back, opt-in at mint time; absent means off. */
|
|
10602
|
+
talk: zod.z.boolean().optional()
|
|
10603
|
+
});
|
|
10604
|
+
var ShareViewScopeSchema = zod.z.object({
|
|
10605
|
+
type: zod.z.literal("share-view"),
|
|
10606
|
+
grant: ShareViewGrantSchema
|
|
10607
|
+
});
|
|
10608
|
+
var AddonRoutesScopeSchema = zod.z.object({
|
|
10609
|
+
type: zod.z.literal("addon-routes"),
|
|
10610
|
+
access: zod.z.array(MethodAccessSchema).min(1)
|
|
10611
|
+
});
|
|
10612
|
+
var PreferencesSelfScopeSchema = zod.z.object({ type: zod.z.literal("preferences-self") });
|
|
10613
|
+
var CredentialScopeSchema = zod.z.union([
|
|
10614
|
+
zod.z.literal("*"),
|
|
10615
|
+
ShareViewScopeSchema,
|
|
10616
|
+
AddonRoutesScopeSchema,
|
|
10617
|
+
PreferencesSelfScopeSchema,
|
|
10618
|
+
TokenScopeSchema
|
|
10619
|
+
]);
|
|
10620
|
+
/**
|
|
10621
|
+
* The `kind` claim of a unified token. It names the TOKEN FAMILY (so every
|
|
10622
|
+
* older gate that classifies a hub JWT refuses it — `classifyBearerPrincipal`
|
|
10623
|
+
* treats any `kind` it does not know as not-a-credential), never what the
|
|
10624
|
+
* token may do: that is its `scopes`, and only its `scopes`.
|
|
10625
|
+
*/
|
|
10626
|
+
var CREDENTIAL_TOKEN_KIND = "credential";
|
|
10627
|
+
/**
|
|
10628
|
+
* The `aud` claim every minted token is signed with (D895). The hub's raw JWT
|
|
10629
|
+
* verify (`AuthManager.verifyToken`, used by every surface that wants a LOGIN
|
|
10630
|
+
* session — the OAuth consent page, the session cookie, health, backups)
|
|
10631
|
+
* refuses a token carrying it, so a minted token — a share link above all —
|
|
10632
|
+
* can never be replayed as a person's session. Only the credential verifier's
|
|
10633
|
+
* own door (`verifyCredentialToken`) accepts it.
|
|
10634
|
+
*/
|
|
10635
|
+
var CREDENTIAL_TOKEN_AUDIENCE = "camstack:credential";
|
|
10636
|
+
/** Does a verified JWT payload belong to the minted-token family? */
|
|
10637
|
+
function isCredentialTokenPayload(payload) {
|
|
10638
|
+
if (payload === null || typeof payload !== "object") return false;
|
|
10639
|
+
const kind = Reflect.get(payload, "kind");
|
|
10640
|
+
const aud = Reflect.get(payload, "aud");
|
|
10641
|
+
return kind === "credential" || aud === "camstack:credential" || Array.isArray(aud) && aud.includes("camstack:credential");
|
|
10642
|
+
}
|
|
10643
|
+
/**
|
|
10644
|
+
* The claims of a unified token (`auth.mintToken`). It carries no `exp`: its
|
|
10645
|
+
* row (looked up by `jti` on every verify, for revocation) holds the ONE
|
|
10646
|
+
* expiry, so a share link can be extended and a JWT clock can never disagree
|
|
10647
|
+
* with the row.
|
|
10648
|
+
*/
|
|
10649
|
+
var CredentialTokenClaimsSchema = zod.z.object({
|
|
10650
|
+
kind: zod.z.literal(CREDENTIAL_TOKEN_KIND),
|
|
10651
|
+
sub: zod.z.string().min(1),
|
|
10652
|
+
jti: zod.z.string().min(16),
|
|
10653
|
+
scopes: zod.z.array(CredentialScopeSchema).min(1)
|
|
10654
|
+
});
|
|
10655
|
+
/**
|
|
10656
|
+
* Per-user ACCOUNT preferences (D894): the hub-side half of the viewer's two
|
|
10657
|
+
* settings levels.
|
|
10658
|
+
*
|
|
10659
|
+
* - DEVICE settings never leave the phone.
|
|
10660
|
+
* - ACCOUNT settings live here: one row per `(user, namespace)`, private to
|
|
10661
|
+
* that user, synced across every device signed in as them, last write wins
|
|
10662
|
+
* unless the writer sends the revision it based its edit on.
|
|
10663
|
+
*
|
|
10664
|
+
* A setting lives in exactly ONE level; there are no overrides. The caller
|
|
10665
|
+
* never names a user: the hub stamps the principal's own id, admin included.
|
|
10666
|
+
*
|
|
10667
|
+
* The contract the client codes against is the `preferences.*` tRPC router
|
|
10668
|
+
* (`server/backend/src/api/core/preferences.router.ts`).
|
|
10669
|
+
*/
|
|
10670
|
+
/** `viewer.app`, `viewer.cameras`, `viewer.grids` … — lowercase, dot/dash separated. */
|
|
10671
|
+
var PREFERENCES_NAMESPACE_PATTERN = /^[a-z][a-z0-9.-]{0,63}$/;
|
|
10672
|
+
/** One row's value, measured as UTF-8 JSON. */
|
|
10673
|
+
var PREFERENCES_MAX_VALUE_BYTES = 256 * 1024;
|
|
10674
|
+
var PreferenceNamespaceSchema = zod.z.string().regex(PREFERENCES_NAMESPACE_PATTERN);
|
|
10675
|
+
/** A namespace's value: a JSON object, opaque to the hub. */
|
|
10676
|
+
var PreferenceValueSchema = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
10677
|
+
var PreferenceDeviceIdSchema = zod.z.string().min(1).max(64);
|
|
10678
|
+
/** A stored row, as the owner reads it. */
|
|
10679
|
+
var PreferenceRowSchema = zod.z.object({
|
|
10680
|
+
namespace: PreferenceNamespaceSchema,
|
|
10681
|
+
value: PreferenceValueSchema,
|
|
10682
|
+
/** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
|
|
10683
|
+
revision: zod.z.number().int().positive(),
|
|
10684
|
+
updatedAt: zod.z.number().int(),
|
|
10685
|
+
/** The client id the last writer sent; `null` when it sent none. */
|
|
10686
|
+
updatedByDevice: PreferenceDeviceIdSchema.nullable()
|
|
10687
|
+
});
|
|
10688
|
+
zod.z.object({
|
|
10689
|
+
/** Absent: every namespace the caller holds. */
|
|
10690
|
+
namespaces: zod.z.array(PreferenceNamespaceSchema).max(32).optional() });
|
|
10691
|
+
zod.z.object({ rows: zod.z.array(PreferenceRowSchema) });
|
|
10692
|
+
zod.z.object({
|
|
10693
|
+
namespace: PreferenceNamespaceSchema,
|
|
10694
|
+
value: PreferenceValueSchema,
|
|
10695
|
+
/**
|
|
10696
|
+
* The revision the edit was based on. Absent: last write wins. `0`: the
|
|
10697
|
+
* namespace must not exist yet. Any other value that is not the current
|
|
10698
|
+
* revision answers `conflict` and writes nothing.
|
|
10699
|
+
*/
|
|
10700
|
+
baseRevision: zod.z.number().int().nonnegative().optional(),
|
|
10701
|
+
deviceId: PreferenceDeviceIdSchema.optional()
|
|
10702
|
+
});
|
|
10703
|
+
zod.z.discriminatedUnion("status", [zod.z.object({
|
|
10704
|
+
status: zod.z.literal("saved"),
|
|
10705
|
+
row: PreferenceRowSchema
|
|
10706
|
+
}), zod.z.object({
|
|
10707
|
+
status: zod.z.literal("conflict"),
|
|
10708
|
+
current: PreferenceRowSchema.nullable()
|
|
10709
|
+
})]);
|
|
10710
|
+
zod.z.object({ namespace: PreferenceNamespaceSchema });
|
|
10711
|
+
zod.z.object({
|
|
10712
|
+
/** `false` when the namespace did not exist. */
|
|
10713
|
+
deleted: zod.z.boolean() });
|
|
10714
|
+
zod.z.object({
|
|
10715
|
+
/** The revision the client holds per namespace; a namespace it does not list is new to it. */
|
|
10716
|
+
revisionByNamespace: zod.z.record(PreferenceNamespaceSchema, zod.z.number().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
|
|
10717
|
+
zod.z.object({
|
|
10718
|
+
/** Every row whose revision differs from the client's, and every row it did not list. */
|
|
10719
|
+
rows: zod.z.array(PreferenceRowSchema),
|
|
10720
|
+
/** Namespaces the client listed that no longer exist. */
|
|
10721
|
+
deleted: zod.z.array(PreferenceNamespaceSchema)
|
|
10722
|
+
});
|
|
10395
10723
|
zod.z.enum(["new-session", "step-up"]);
|
|
10396
10724
|
/** The languages the hub's app landing pages are written in (D858). */
|
|
10397
10725
|
var AppPageLangSchema = zod.z.enum(["en", "it"]);
|
|
@@ -41988,38 +42316,37 @@ var llmRuntimeCapability = {
|
|
|
41988
42316
|
})
|
|
41989
42317
|
}
|
|
41990
42318
|
};
|
|
42319
|
+
var LlmProfileKindSchema = zod.z.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind id is lower-case letters, digits and dashes");
|
|
42320
|
+
/** What a model (or, by default, every model of a kind) can do. */
|
|
42321
|
+
var LlmModelFeaturesSchema = zod.z.object({
|
|
42322
|
+
vision: zod.z.boolean(),
|
|
42323
|
+
tools: zod.z.boolean(),
|
|
42324
|
+
streaming: zod.z.boolean()
|
|
42325
|
+
});
|
|
42326
|
+
/** One model a provider offers. `features` overrides the kind's defaults, per field. */
|
|
42327
|
+
var LlmModelInfoSchema = zod.z.object({
|
|
42328
|
+
id: zod.z.string(),
|
|
42329
|
+
label: zod.z.string().optional(),
|
|
42330
|
+
contextLength: zod.z.number().int().positive().optional(),
|
|
42331
|
+
features: LlmModelFeaturesSchema.partial().optional()
|
|
42332
|
+
});
|
|
41991
42333
|
/**
|
|
41992
|
-
*
|
|
41993
|
-
*
|
|
41994
|
-
*
|
|
41995
|
-
*
|
|
41996
|
-
|
|
41997
|
-
|
|
41998
|
-
* Profiles are ROWS (data), not addons: one row = one usable model endpoint.
|
|
41999
|
-
* `apiKey` is a password field — providers REDACT it on read and merge on
|
|
42000
|
-
* write; a stored key NEVER round-trips to a client.
|
|
42001
|
-
*/
|
|
42002
|
-
var LlmProfileKindSchema = zod.z.enum([
|
|
42003
|
-
"openai-compatible",
|
|
42004
|
-
"openai",
|
|
42005
|
-
"anthropic",
|
|
42006
|
-
"google",
|
|
42007
|
-
"managed-local",
|
|
42008
|
-
"apple-foundation"
|
|
42009
|
-
]);
|
|
42334
|
+
* The provider-specific part of a profile, validated by the provider that owns
|
|
42335
|
+
* the kind (`upsertProfile` refuses what it does not accept). A field its
|
|
42336
|
+
* `connectionSchema` declares `type: 'password'` is a secret: it is held in the
|
|
42337
|
+
* keychain, never in the row, and reads back as the redaction marker.
|
|
42338
|
+
*/
|
|
42339
|
+
var LlmProviderConfigSchema = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
42010
42340
|
var LlmProfileSchema = zod.z.object({
|
|
42011
42341
|
id: zod.z.string(),
|
|
42012
42342
|
name: zod.z.string(),
|
|
42343
|
+
/** The provider-declared kind (`LlmProfileKindDescriptor.kind`). */
|
|
42013
42344
|
kind: LlmProfileKindSchema,
|
|
42014
42345
|
/** Stamped by the provider — keeps the fanned catalog routable. */
|
|
42015
42346
|
addonId: zod.z.string(),
|
|
42016
42347
|
enabled: zod.z.boolean(),
|
|
42017
42348
|
/** Vendor model id, or the managed runtime's loaded model. */
|
|
42018
42349
|
model: zod.z.string(),
|
|
42019
|
-
/** Required for openai-compatible; override for cloud kinds. */
|
|
42020
|
-
baseUrl: zod.z.string().optional(),
|
|
42021
|
-
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
42022
|
-
apiKey: zod.z.string().optional(),
|
|
42023
42350
|
/** Vision on/off. A vision call against a `false` profile is REFUSED, never
|
|
42024
42351
|
* degraded to text — that shipped once and produced a confident answer to a
|
|
42025
42352
|
* question about a picture nobody sent. */
|
|
@@ -42027,15 +42354,11 @@ var LlmProfileSchema = zod.z.object({
|
|
|
42027
42354
|
temperature: zod.z.number().min(0).max(2).optional(),
|
|
42028
42355
|
/** Nucleus sampling. Every wire we speak has it. */
|
|
42029
42356
|
topP: zod.z.number().min(0).max(1).optional(),
|
|
42030
|
-
/** Top-k sampling. Carried only by the wires that have it —
|
|
42031
|
-
*
|
|
42032
|
-
* `top_p` and no `top_k`). The profile editor hides the field wherever it
|
|
42033
|
-
* would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
|
|
42357
|
+
/** Top-k sampling. Carried only by the wires that have it — a kind offers the
|
|
42358
|
+
* field in its editor only when its descriptor lists it in `profileFields`. */
|
|
42034
42359
|
topK: zod.z.number().int().positive().optional(),
|
|
42035
42360
|
maxTokens: zod.z.number().int().positive().optional(),
|
|
42036
|
-
/** Prompt context window. Advisory for cloud kinds (they enforce their own)
|
|
42037
|
-
* for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
|
|
42038
|
-
* the model with, so it is the one field that changes a PROCESS. */
|
|
42361
|
+
/** Prompt context window. Advisory for cloud kinds (they enforce their own). */
|
|
42039
42362
|
contextLength: zod.z.number().int().positive().optional(),
|
|
42040
42363
|
/** Default system prompt. A caller's `system` REPLACES it (never appends —
|
|
42041
42364
|
* two system prompts fighting is worse than either alone). */
|
|
@@ -42061,16 +42384,37 @@ var LlmProfileSchema = zod.z.object({
|
|
|
42061
42384
|
* library; the REGISTRY of callable tools is ours and is empty in v1, so a
|
|
42062
42385
|
* `true` here buys the wiring, not behaviour, until tools are registered. */
|
|
42063
42386
|
toolsEnabled: zod.z.boolean().default(false),
|
|
42064
|
-
|
|
42065
|
-
|
|
42066
|
-
|
|
42067
|
-
|
|
42068
|
-
|
|
42069
|
-
|
|
42070
|
-
|
|
42071
|
-
|
|
42072
|
-
|
|
42073
|
-
|
|
42387
|
+
/** Everything the kind's provider owns (endpoint, key, node, runtime…). */
|
|
42388
|
+
providerConfig: LlmProviderConfigSchema.default({})
|
|
42389
|
+
});
|
|
42390
|
+
/**
|
|
42391
|
+
* The common profile fields a kind's editor offers. The editor owns how each
|
|
42392
|
+
* one is drawn; the provider says which of them mean something on its wire.
|
|
42393
|
+
*/
|
|
42394
|
+
var LlmProfileFieldSchema = zod.z.enum([
|
|
42395
|
+
"temperature",
|
|
42396
|
+
"topP",
|
|
42397
|
+
"topK",
|
|
42398
|
+
"maxTokens",
|
|
42399
|
+
"contextLength",
|
|
42400
|
+
"systemPrompt",
|
|
42401
|
+
"timeoutMs",
|
|
42402
|
+
"connectTimeoutMs",
|
|
42403
|
+
"firstTokenTimeoutMs",
|
|
42404
|
+
"idleTimeoutMs",
|
|
42405
|
+
"retry",
|
|
42406
|
+
"toolsEnabled"
|
|
42407
|
+
]);
|
|
42408
|
+
/**
|
|
42409
|
+
* A provider-drawn part of the editor, by a generic widget id the admin UI
|
|
42410
|
+
* registers (`ai/apple-node`). `placement: 'model'` replaces the generic model
|
|
42411
|
+
* picker: that widget owns the model choice.
|
|
42412
|
+
*/
|
|
42413
|
+
var LlmProviderWidgetSchema = zod.z.object({
|
|
42414
|
+
id: zod.z.string(),
|
|
42415
|
+
placement: zod.z.enum(["connection", "model"]),
|
|
42416
|
+
/** `providerConfig` keys this widget must fill before the profile can be saved. */
|
|
42417
|
+
requires: zod.z.array(zod.z.string()).optional()
|
|
42074
42418
|
});
|
|
42075
42419
|
/** ConfigUISchema tree passed through untyped on the wire (the
|
|
42076
42420
|
* notification-output `ConfigSchemaPassthrough` precedent at
|
|
@@ -42079,11 +42423,56 @@ var ConfigSchemaPassthrough$3 = zod.z.unknown();
|
|
|
42079
42423
|
var LlmProfileKindDescriptorSchema = zod.z.object({
|
|
42080
42424
|
kind: LlmProfileKindSchema,
|
|
42081
42425
|
label: zod.z.string(),
|
|
42426
|
+
/** A generic icon name (`cloud`, `plug`, `cpu`) — never a glyph or a logo. */
|
|
42082
42427
|
icon: zod.z.string(),
|
|
42083
42428
|
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
42084
42429
|
addonId: zod.z.string(),
|
|
42085
|
-
|
|
42430
|
+
/** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
|
|
42431
|
+
connectionSchema: ConfigSchemaPassthrough$3,
|
|
42432
|
+
/** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
|
|
42433
|
+
advancedSchema: ConfigSchemaPassthrough$3.optional(),
|
|
42434
|
+
/** The kind's defaults; a model from `listModels` may override any of them. */
|
|
42435
|
+
features: LlmModelFeaturesSchema,
|
|
42436
|
+
/** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
|
|
42437
|
+
visionEditable: zod.z.boolean(),
|
|
42438
|
+
/** Where the model list comes from: `listModels`, `staticModels`, or nowhere. */
|
|
42439
|
+
modelCatalog: zod.z.enum([
|
|
42440
|
+
"fetch",
|
|
42441
|
+
"static",
|
|
42442
|
+
"none"
|
|
42443
|
+
]),
|
|
42444
|
+
staticModels: zod.z.array(LlmModelInfoSchema).optional(),
|
|
42445
|
+
/** The common fields that mean something on this kind's wire. */
|
|
42446
|
+
profileFields: zod.z.array(LlmProfileFieldSchema),
|
|
42447
|
+
providerWidgets: zod.z.array(LlmProviderWidgetSchema).optional()
|
|
42448
|
+
});
|
|
42449
|
+
/**
|
|
42450
|
+
* `listModels` input. `connection` is an UNSAVED draft of `providerConfig`
|
|
42451
|
+
* (the editor's form); with `profileId` too, a secret the draft leaves
|
|
42452
|
+
* untouched (absent or the redaction marker) is resolved server-side from the
|
|
42453
|
+
* stored profile — the browser never receives it.
|
|
42454
|
+
*/
|
|
42455
|
+
var LlmListModelsInputSchema = zod.z.object({
|
|
42456
|
+
addonId: zod.z.string(),
|
|
42457
|
+
kind: LlmProfileKindSchema,
|
|
42458
|
+
profileId: zod.z.string().optional(),
|
|
42459
|
+
connection: LlmProviderConfigSchema.optional()
|
|
42086
42460
|
});
|
|
42461
|
+
var LlmListModelsErrorCodeSchema = zod.z.enum([
|
|
42462
|
+
"auth",
|
|
42463
|
+
"network",
|
|
42464
|
+
"unsupported",
|
|
42465
|
+
"invalid"
|
|
42466
|
+
]);
|
|
42467
|
+
/** A RESULT, never a throw: "wrong key" is an answer the editor renders inline. */
|
|
42468
|
+
var LlmListModelsResultSchema = zod.z.discriminatedUnion("ok", [zod.z.object({
|
|
42469
|
+
ok: zod.z.literal(true),
|
|
42470
|
+
models: zod.z.array(LlmModelInfoSchema)
|
|
42471
|
+
}), zod.z.object({
|
|
42472
|
+
ok: zod.z.literal(false),
|
|
42473
|
+
code: LlmListModelsErrorCodeSchema,
|
|
42474
|
+
message: zod.z.string()
|
|
42475
|
+
})]);
|
|
42087
42476
|
var LlmDefaultSelectorSchema = zod.z.union([zod.z.object({ consumer: zod.z.string() }), zod.z.object({ purpose: zod.z.enum(["text", "vision"]) })]);
|
|
42088
42477
|
var LlmDefaultSchema = zod.z.object({
|
|
42089
42478
|
selector: LlmDefaultSelectorSchema,
|
|
@@ -42214,8 +42603,17 @@ var llmCapability = {
|
|
|
42214
42603
|
auth: "admin",
|
|
42215
42604
|
timeoutMs: AI_CAP_TRANSPORT_TIMEOUT_MS
|
|
42216
42605
|
}),
|
|
42217
|
-
/**
|
|
42218
|
-
|
|
42606
|
+
/**
|
|
42607
|
+
* The models a kind offers, for a SAVED profile or an unsaved draft
|
|
42608
|
+
* (`connection`). A mutation, not a query: a draft may carry a key, and a
|
|
42609
|
+
* query's input travels in the URL. Admin: it dials whatever endpoint the
|
|
42610
|
+
* draft names and may resolve a stored key to do it. The answer never
|
|
42611
|
+
* carries a secret — failures are a typed result, never a throw.
|
|
42612
|
+
*/
|
|
42613
|
+
listModels: method(LlmListModelsInputSchema, LlmListModelsResultSchema, {
|
|
42614
|
+
kind: "mutation",
|
|
42615
|
+
auth: "admin"
|
|
42616
|
+
}),
|
|
42219
42617
|
getDefaults: method(zod.z.object({}), zod.z.array(LlmDefaultSchema)),
|
|
42220
42618
|
setDefault: method(zod.z.object({
|
|
42221
42619
|
selector: LlmDefaultSelectorSchema,
|
|
@@ -46812,202 +47210,6 @@ var notificationRulesCapability = {
|
|
|
46812
47210
|
}
|
|
46813
47211
|
};
|
|
46814
47212
|
/**
|
|
46815
|
-
* Zod schemas for persisted record types.
|
|
46816
|
-
*
|
|
46817
|
-
* These schemas serve as the single source of truth for types that are
|
|
46818
|
-
* stored in the settings-store backend and retrieved via tRPC. They
|
|
46819
|
-
* replace the manual TypeScript interfaces with schema-derived types,
|
|
46820
|
-
* enabling runtime validation when reading from the backend.
|
|
46821
|
-
*
|
|
46822
|
-
* Convention: each schema is named `<Type>Schema`, the inferred TS type
|
|
46823
|
-
* keeps the original name for backward compatibility.
|
|
46824
|
-
*/
|
|
46825
|
-
/**
|
|
46826
|
-
* Auth model (v2 — 2026-05-12 caps-only):
|
|
46827
|
-
*
|
|
46828
|
-
* Two principals:
|
|
46829
|
-
* - `isAdmin: true` — full bypass. Admin scope set is ignored.
|
|
46830
|
-
* - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
|
|
46831
|
-
*
|
|
46832
|
-
* No role enum. There used to be `viewer / agent / scoped` and earlier
|
|
46833
|
-
* `super_admin` — collapsed onto the single boolean because every
|
|
46834
|
-
* non-admin caller is governed by the same scope-check rules; the
|
|
46835
|
-
* distinction was only ever used to route role-specific procedures
|
|
46836
|
-
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
46837
|
-
* with `isAdmin: false` + an explicit scope list.
|
|
46838
|
-
*/
|
|
46839
|
-
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
46840
|
-
var MethodAccessSchema = zod.z.enum([
|
|
46841
|
-
"view",
|
|
46842
|
-
"create",
|
|
46843
|
-
"delete"
|
|
46844
|
-
]);
|
|
46845
|
-
/**
|
|
46846
|
-
* A single scope grant. Three forms — checked in matcher with OR
|
|
46847
|
-
* semantics; the first match decides whether the call passes:
|
|
46848
|
-
*
|
|
46849
|
-
* - `category` — broadest. `target: 'device' | 'system'` selects every
|
|
46850
|
-
* cap with the matching `scope` declaration. New caps inherit grants
|
|
46851
|
-
* automatically — adding a device cap to the codebase makes it
|
|
46852
|
-
* reachable to every user with `category:device [...]` without a
|
|
46853
|
-
* re-grant. Use this for "family viewer" / "operator" tiers.
|
|
46854
|
-
*
|
|
46855
|
-
* - `addon` — every cap that ships inside a given addon id. Niche;
|
|
46856
|
-
* useful when an integration needs to interact with one specific
|
|
46857
|
-
* addon's surface regardless of how many caps it exports.
|
|
46858
|
-
*
|
|
46859
|
-
* - `capability` — the most precise form. Single cap name. Use for
|
|
46860
|
-
* integration tokens where you want to grant `addons.installPackage`
|
|
46861
|
-
* and nothing else.
|
|
46862
|
-
*
|
|
46863
|
-
* `access` is REQUIRED with min 1 element. `admin` bypass is the
|
|
46864
|
-
* "give me everything" escape; there is no wildcard scope.
|
|
46865
|
-
*/
|
|
46866
|
-
var AllowedProviderSchema = zod.z.union([zod.z.literal("*"), zod.z.array(zod.z.string())]);
|
|
46867
|
-
var AllowedDevicesSchema = zod.z.record(zod.z.string(), zod.z.union([zod.z.literal("*"), zod.z.array(zod.z.string())]));
|
|
46868
|
-
var CapScopeSchema = zod.z.enum(["device", "system"]);
|
|
46869
|
-
/**
|
|
46870
|
-
* DeviceSelector (scope model v3 — 2026-08-12).
|
|
46871
|
-
*
|
|
46872
|
-
* A `device` grant no longer carries a frozen list of deviceIds. It carries
|
|
46873
|
-
* a SELECTOR the matcher resolves against the live fleet, so the grant can be
|
|
46874
|
-
* DYNAMIC: a `types:['camera']` selector automatically covers a camera added
|
|
46875
|
-
* AFTER the grant was minted — no re-grant, no re-login.
|
|
46876
|
-
*
|
|
46877
|
-
* - `all` — every device in the deployment. The broad viewer/operator
|
|
46878
|
-
* lever without a `category` grant (a `category` grant also covers device
|
|
46879
|
-
* caps that carry no deviceId; `all` is specifically the device set).
|
|
46880
|
-
* - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
|
|
46881
|
-
* grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
|
|
46882
|
-
* is NOT covered until the grant is edited.
|
|
46883
|
-
* - `types` — every device of a `DeviceType` (e.g. every `camera`).
|
|
46884
|
-
* DYNAMIC. A device that changes type, or a new device of the type,
|
|
46885
|
-
* re-resolves on the next request.
|
|
46886
|
-
* - `locations` — every device whose operator-assigned `location` label is
|
|
46887
|
-
* in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
|
|
46888
|
-
* null/unset location matches NO `locations` selector.
|
|
46889
|
-
*/
|
|
46890
|
-
var DeviceSelectorSchema = zod.z.discriminatedUnion("kind", [
|
|
46891
|
-
zod.z.object({ kind: zod.z.literal("all") }),
|
|
46892
|
-
zod.z.object({
|
|
46893
|
-
kind: zod.z.literal("ids"),
|
|
46894
|
-
ids: zod.z.array(zod.z.number().int()).min(1)
|
|
46895
|
-
}),
|
|
46896
|
-
zod.z.object({
|
|
46897
|
-
kind: zod.z.literal("types"),
|
|
46898
|
-
types: zod.z.array(zod.z.enum(DeviceType)).min(1)
|
|
46899
|
-
}),
|
|
46900
|
-
zod.z.object({
|
|
46901
|
-
kind: zod.z.literal("locations"),
|
|
46902
|
-
locations: zod.z.array(zod.z.string().min(1)).min(1)
|
|
46903
|
-
})
|
|
46904
|
-
]);
|
|
46905
|
-
var DeviceTokenScopeSchema = zod.z.object({
|
|
46906
|
-
type: zod.z.literal("device"),
|
|
46907
|
-
/** The device SET this grant covers — resolved against the live fleet. */
|
|
46908
|
-
selector: DeviceSelectorSchema,
|
|
46909
|
-
access: zod.z.array(MethodAccessSchema).min(1),
|
|
46910
|
-
/**
|
|
46911
|
-
* Whether a grant on a PARENT device transparently covers its accessory
|
|
46912
|
-
* CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
|
|
46913
|
-
* Direction is parent → children ONLY.
|
|
46914
|
-
*
|
|
46915
|
-
* Absent → the matcher DERIVES it from the access flavour: `view`
|
|
46916
|
-
* inherits (a camera viewer sees the camera's accessories), `create` /
|
|
46917
|
-
* `delete` do NOT (actuating/removing a child is an explicit act the
|
|
46918
|
-
* operator must grant on the child, not inherit from the parent). Set it
|
|
46919
|
-
* explicitly to override that default per grant.
|
|
46920
|
-
*/
|
|
46921
|
-
includeLinked: zod.z.boolean().optional()
|
|
46922
|
-
});
|
|
46923
|
-
/**
|
|
46924
|
-
* v2 → v3 lazy migration. A pre-v3 `device` grant carried
|
|
46925
|
-
* `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
|
|
46926
|
-
* `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
|
|
46927
|
-
* EVERY parse path — stored records AND the JWT-carried scope arrays
|
|
46928
|
-
* normalised at the request boundary ({@link normalizeTokenScopes} in
|
|
46929
|
-
* `device-selector.ts`). Chosen over a one-time DB migration because a
|
|
46930
|
-
* migration cannot reach a JWT already in a client's hands; parse-time
|
|
46931
|
-
* migration covers both without a flag day. No cast — the raw object is read
|
|
46932
|
-
* through `Reflect.get` (its static type is `unknown`).
|
|
46933
|
-
*/
|
|
46934
|
-
function migrateLegacyTokenScope(raw) {
|
|
46935
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
46936
|
-
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
46937
|
-
if (Reflect.get(raw, "selector") !== void 0) return raw;
|
|
46938
|
-
const targets = Reflect.get(raw, "targets");
|
|
46939
|
-
if (!Array.isArray(targets)) return raw;
|
|
46940
|
-
return {
|
|
46941
|
-
type: "device",
|
|
46942
|
-
selector: {
|
|
46943
|
-
kind: "ids",
|
|
46944
|
-
ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
|
|
46945
|
-
},
|
|
46946
|
-
access: Reflect.get(raw, "access")
|
|
46947
|
-
};
|
|
46948
|
-
}
|
|
46949
|
-
var TokenScopeSchema = zod.z.preprocess(migrateLegacyTokenScope, zod.z.discriminatedUnion("type", [
|
|
46950
|
-
zod.z.object({
|
|
46951
|
-
type: zod.z.literal("category"),
|
|
46952
|
-
target: CapScopeSchema,
|
|
46953
|
-
access: zod.z.array(MethodAccessSchema).min(1)
|
|
46954
|
-
}),
|
|
46955
|
-
zod.z.object({
|
|
46956
|
-
type: zod.z.literal("capability"),
|
|
46957
|
-
target: zod.z.string(),
|
|
46958
|
-
access: zod.z.array(MethodAccessSchema).min(1)
|
|
46959
|
-
}),
|
|
46960
|
-
zod.z.object({
|
|
46961
|
-
type: zod.z.literal("addon"),
|
|
46962
|
-
target: zod.z.string(),
|
|
46963
|
-
access: zod.z.array(MethodAccessSchema).min(1)
|
|
46964
|
-
}),
|
|
46965
|
-
DeviceTokenScopeSchema
|
|
46966
|
-
]));
|
|
46967
|
-
var UserRecordSchema = zod.z.object({
|
|
46968
|
-
id: zod.z.string(),
|
|
46969
|
-
username: zod.z.string(),
|
|
46970
|
-
passwordHash: zod.z.string(),
|
|
46971
|
-
/**
|
|
46972
|
-
* Admin bypass. When true, the middleware skips the scope-access
|
|
46973
|
-
* check entirely. There is no other axis of privilege; the legacy
|
|
46974
|
-
* role enum collapsed onto this boolean in v2.
|
|
46975
|
-
*/
|
|
46976
|
-
isAdmin: zod.z.boolean().default(false),
|
|
46977
|
-
allowedProviders: AllowedProviderSchema,
|
|
46978
|
-
allowedDevices: AllowedDevicesSchema,
|
|
46979
|
-
/**
|
|
46980
|
-
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
46981
|
-
* ignored. Non-admins without scopes are locked out of every
|
|
46982
|
-
* protected call.
|
|
46983
|
-
*/
|
|
46984
|
-
scopes: zod.z.array(TokenScopeSchema).default([]),
|
|
46985
|
-
createdAt: zod.z.number(),
|
|
46986
|
-
updatedAt: zod.z.number()
|
|
46987
|
-
});
|
|
46988
|
-
var ApiKeyRecordSchema = zod.z.object({
|
|
46989
|
-
id: zod.z.string(),
|
|
46990
|
-
label: zod.z.string(),
|
|
46991
|
-
isAdmin: zod.z.boolean().default(false),
|
|
46992
|
-
allowedProviders: AllowedProviderSchema,
|
|
46993
|
-
allowedDevices: AllowedDevicesSchema,
|
|
46994
|
-
tokenHash: zod.z.string(),
|
|
46995
|
-
tokenPrefix: zod.z.string(),
|
|
46996
|
-
createdAt: zod.z.number(),
|
|
46997
|
-
lastUsedAt: zod.z.number().optional()
|
|
46998
|
-
});
|
|
46999
|
-
var ScopedTokenSchema = zod.z.object({
|
|
47000
|
-
id: zod.z.string(),
|
|
47001
|
-
userId: zod.z.string(),
|
|
47002
|
-
name: zod.z.string(),
|
|
47003
|
-
tokenHash: zod.z.string(),
|
|
47004
|
-
tokenPrefix: zod.z.string(),
|
|
47005
|
-
scopes: zod.z.array(TokenScopeSchema),
|
|
47006
|
-
expiresAt: zod.z.number().nullish(),
|
|
47007
|
-
lastUsedAt: zod.z.number().nullish(),
|
|
47008
|
-
createdAt: zod.z.number()
|
|
47009
|
-
});
|
|
47010
|
-
/**
|
|
47011
47213
|
* `oauth-integration` — a collection cap by which an addon declares
|
|
47012
47214
|
* itself a linkable OAuth client of the hub's core `/oauth2/*` server.
|
|
47013
47215
|
* Each provider returns a static descriptor; the core enumerates them
|
|
@@ -71304,26 +71506,6 @@ var ApiKeySummarySchema = zod.z.object({
|
|
|
71304
71506
|
createdAt: zod.z.number(),
|
|
71305
71507
|
lastUsedAt: zod.z.number().optional()
|
|
71306
71508
|
});
|
|
71307
|
-
var ScopedTokenSummarySchema = zod.z.object({
|
|
71308
|
-
id: zod.z.string(),
|
|
71309
|
-
userId: zod.z.string(),
|
|
71310
|
-
name: zod.z.string(),
|
|
71311
|
-
tokenPrefix: zod.z.string(),
|
|
71312
|
-
scopes: zod.z.array(TokenScopeSchema),
|
|
71313
|
-
expiresAt: zod.z.number().nullish(),
|
|
71314
|
-
lastUsedAt: zod.z.number().nullish(),
|
|
71315
|
-
createdAt: zod.z.number()
|
|
71316
|
-
});
|
|
71317
|
-
var CreateScopedTokenInputSchema = zod.z.object({
|
|
71318
|
-
userId: zod.z.string(),
|
|
71319
|
-
name: zod.z.string(),
|
|
71320
|
-
scopes: zod.z.array(TokenScopeSchema),
|
|
71321
|
-
expiresAt: zod.z.number().optional()
|
|
71322
|
-
});
|
|
71323
|
-
var CreateScopedTokenResultSchema = zod.z.object({
|
|
71324
|
-
token: zod.z.string(),
|
|
71325
|
-
record: ScopedTokenSummarySchema
|
|
71326
|
-
});
|
|
71327
71509
|
var OauthSessionSummarySchema = zod.z.object({
|
|
71328
71510
|
id: zod.z.string(),
|
|
71329
71511
|
userId: zod.z.string(),
|
|
@@ -71345,11 +71527,11 @@ var TotpStatusSchema = zod.z.object({
|
|
|
71345
71527
|
confirmedAt: zod.z.number().nullable()
|
|
71346
71528
|
});
|
|
71347
71529
|
/**
|
|
71348
|
-
* user-management — singleton capability for user accounts
|
|
71349
|
-
*
|
|
71530
|
+
* user-management — singleton capability for user accounts and the
|
|
71531
|
+
* legacy API-key rows.
|
|
71350
71532
|
*
|
|
71351
71533
|
* v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
|
|
71352
|
-
* — the subset check on `setUserScopes`
|
|
71534
|
+
* — the subset check on `setUserScopes` is moot
|
|
71353
71535
|
* because non-admins never reach these. If/when we open non-admin
|
|
71354
71536
|
* delegation, structural caller-scope subset check goes inside the
|
|
71355
71537
|
* provider.
|
|
@@ -71420,18 +71602,6 @@ var userManagementCapability = {
|
|
|
71420
71602
|
auth: "admin",
|
|
71421
71603
|
access: "delete"
|
|
71422
71604
|
}),
|
|
71423
|
-
createScopedToken: method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
71424
|
-
kind: "mutation",
|
|
71425
|
-
auth: "admin",
|
|
71426
|
-
access: "create"
|
|
71427
|
-
}),
|
|
71428
|
-
revokeScopedToken: method(zod.z.object({ id: zod.z.string() }), zod.z.object({ success: zod.z.literal(true) }), {
|
|
71429
|
-
kind: "mutation",
|
|
71430
|
-
auth: "admin",
|
|
71431
|
-
access: "delete"
|
|
71432
|
-
}),
|
|
71433
|
-
validateScopedToken: method(zod.z.object({ token: zod.z.string() }), ScopedTokenSummarySchema.nullable(), { access: "view" }),
|
|
71434
|
-
listScopedTokens: method(zod.z.object({ userId: zod.z.string() }), zod.z.array(ScopedTokenSummarySchema), { auth: "admin" }),
|
|
71435
71605
|
setupTotp: method(zod.z.object({ userId: zod.z.string() }), TotpSetupResultSchema, {
|
|
71436
71606
|
kind: "mutation",
|
|
71437
71607
|
auth: "admin",
|
|
@@ -77920,7 +78090,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
77920
78090
|
capName: "llm",
|
|
77921
78091
|
capScope: "system",
|
|
77922
78092
|
addonId: null,
|
|
77923
|
-
access: "
|
|
78093
|
+
access: "create"
|
|
77924
78094
|
},
|
|
77925
78095
|
"llm.listNodeModels": {
|
|
77926
78096
|
capName: "llm",
|
|
@@ -82584,12 +82754,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
82584
82754
|
addonId: null,
|
|
82585
82755
|
access: "create"
|
|
82586
82756
|
},
|
|
82587
|
-
"userManagement.createScopedToken": {
|
|
82588
|
-
capName: "user-management",
|
|
82589
|
-
capScope: "system",
|
|
82590
|
-
addonId: null,
|
|
82591
|
-
access: "create"
|
|
82592
|
-
},
|
|
82593
82757
|
"userManagement.createUser": {
|
|
82594
82758
|
capName: "user-management",
|
|
82595
82759
|
capScope: "system",
|
|
@@ -82638,12 +82802,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
82638
82802
|
addonId: null,
|
|
82639
82803
|
access: "view"
|
|
82640
82804
|
},
|
|
82641
|
-
"userManagement.listScopedTokens": {
|
|
82642
|
-
capName: "user-management",
|
|
82643
|
-
capScope: "system",
|
|
82644
|
-
addonId: null,
|
|
82645
|
-
access: "view"
|
|
82646
|
-
},
|
|
82647
82805
|
"userManagement.listUsers": {
|
|
82648
82806
|
capName: "user-management",
|
|
82649
82807
|
capScope: "system",
|
|
@@ -82698,12 +82856,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
82698
82856
|
addonId: null,
|
|
82699
82857
|
access: "delete"
|
|
82700
82858
|
},
|
|
82701
|
-
"userManagement.revokeScopedToken": {
|
|
82702
|
-
capName: "user-management",
|
|
82703
|
-
capScope: "system",
|
|
82704
|
-
addonId: null,
|
|
82705
|
-
access: "delete"
|
|
82706
|
-
},
|
|
82707
82859
|
"userManagement.setupTotp": {
|
|
82708
82860
|
capName: "user-management",
|
|
82709
82861
|
capScope: "system",
|
|
@@ -82734,12 +82886,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
82734
82886
|
addonId: null,
|
|
82735
82887
|
access: "view"
|
|
82736
82888
|
},
|
|
82737
|
-
"userManagement.validateScopedToken": {
|
|
82738
|
-
capName: "user-management",
|
|
82739
|
-
capScope: "system",
|
|
82740
|
-
addonId: null,
|
|
82741
|
-
access: "view"
|
|
82742
|
-
},
|
|
82743
82889
|
"userManagement.verifyTotp": {
|
|
82744
82890
|
capName: "user-management",
|
|
82745
82891
|
capScope: "system",
|
|
@@ -88438,6 +88584,12 @@ Object.defineProperty(exports, "CORE_BLOCK_ADDON_PREFIX", {
|
|
|
88438
88584
|
return CORE_BLOCK_ADDON_PREFIX;
|
|
88439
88585
|
}
|
|
88440
88586
|
});
|
|
88587
|
+
Object.defineProperty(exports, "CREDENTIAL_TOKEN_AUDIENCE", {
|
|
88588
|
+
enumerable: true,
|
|
88589
|
+
get: function() {
|
|
88590
|
+
return CREDENTIAL_TOKEN_AUDIENCE;
|
|
88591
|
+
}
|
|
88592
|
+
});
|
|
88441
88593
|
Object.defineProperty(exports, "CalendarPreferencesSchema", {
|
|
88442
88594
|
enumerable: true,
|
|
88443
88595
|
get: function() {
|
|
@@ -88456,6 +88608,12 @@ Object.defineProperty(exports, "CoreBlockSchema", {
|
|
|
88456
88608
|
return CoreBlockSchema;
|
|
88457
88609
|
}
|
|
88458
88610
|
});
|
|
88611
|
+
Object.defineProperty(exports, "CredentialTokenClaimsSchema", {
|
|
88612
|
+
enumerable: true,
|
|
88613
|
+
get: function() {
|
|
88614
|
+
return CredentialTokenClaimsSchema;
|
|
88615
|
+
}
|
|
88616
|
+
});
|
|
88459
88617
|
Object.defineProperty(exports, "DATABASE_SNAPSHOT_PARTIAL_SUFFIX", {
|
|
88460
88618
|
enumerable: true,
|
|
88461
88619
|
get: function() {
|
|
@@ -88714,12 +88872,36 @@ Object.defineProperty(exports, "NoCallerError", {
|
|
|
88714
88872
|
return NoCallerError;
|
|
88715
88873
|
}
|
|
88716
88874
|
});
|
|
88875
|
+
Object.defineProperty(exports, "PREFERENCES_MAX_VALUE_BYTES", {
|
|
88876
|
+
enumerable: true,
|
|
88877
|
+
get: function() {
|
|
88878
|
+
return PREFERENCES_MAX_VALUE_BYTES;
|
|
88879
|
+
}
|
|
88880
|
+
});
|
|
88717
88881
|
Object.defineProperty(exports, "PlaintextSecretError", {
|
|
88718
88882
|
enumerable: true,
|
|
88719
88883
|
get: function() {
|
|
88720
88884
|
return PlaintextSecretError;
|
|
88721
88885
|
}
|
|
88722
88886
|
});
|
|
88887
|
+
Object.defineProperty(exports, "PreferenceDeviceIdSchema", {
|
|
88888
|
+
enumerable: true,
|
|
88889
|
+
get: function() {
|
|
88890
|
+
return PreferenceDeviceIdSchema;
|
|
88891
|
+
}
|
|
88892
|
+
});
|
|
88893
|
+
Object.defineProperty(exports, "PreferenceNamespaceSchema", {
|
|
88894
|
+
enumerable: true,
|
|
88895
|
+
get: function() {
|
|
88896
|
+
return PreferenceNamespaceSchema;
|
|
88897
|
+
}
|
|
88898
|
+
});
|
|
88899
|
+
Object.defineProperty(exports, "PreferenceValueSchema", {
|
|
88900
|
+
enumerable: true,
|
|
88901
|
+
get: function() {
|
|
88902
|
+
return PreferenceValueSchema;
|
|
88903
|
+
}
|
|
88904
|
+
});
|
|
88723
88905
|
Object.defineProperty(exports, "RECORDING_SOURCE_CAMSTACK_ADDON", {
|
|
88724
88906
|
enumerable: true,
|
|
88725
88907
|
get: function() {
|
|
@@ -89464,6 +89646,12 @@ Object.defineProperty(exports, "isCollectionArrayMethod", {
|
|
|
89464
89646
|
return isCollectionArrayMethod;
|
|
89465
89647
|
}
|
|
89466
89648
|
});
|
|
89649
|
+
Object.defineProperty(exports, "isCredentialTokenPayload", {
|
|
89650
|
+
enumerable: true,
|
|
89651
|
+
get: function() {
|
|
89652
|
+
return isCredentialTokenPayload;
|
|
89653
|
+
}
|
|
89654
|
+
});
|
|
89467
89655
|
Object.defineProperty(exports, "isDefaultAppConnectionEndpoint", {
|
|
89468
89656
|
enumerable: true,
|
|
89469
89657
|
get: function() {
|