@camstack/types 1.2.385 → 1.2.387
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +4 -4
- package/dist/addon.mjs +4 -4
- package/dist/auth/credential-scope.d.ts +262 -0
- package/dist/auth/principal-scope.d.ts +1 -1
- package/dist/capabilities/index.d.ts +2 -2
- package/dist/capabilities/llm.cap.d.ts +252 -309
- package/dist/capabilities/user-management.cap.d.ts +4 -409
- package/dist/client.js +100 -104
- package/dist/client.mjs +100 -104
- package/dist/generated/addon-api.d.ts +459 -175
- package/dist/generated/collection-array-methods.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +591 -303
- package/dist/index.mjs +548 -301
- package/dist/interfaces/addon-data-plane.d.ts +4 -4
- package/dist/interfaces/addon-peer-bytes.d.ts +1 -1
- package/dist/schemas/auth-records.d.ts +1 -1
- package/dist/schemas/user-preferences.d.ts +103 -0
- package/dist/{sleep-BE7_6UnC.js → sleep-6sOPE0EV.js} +31 -4
- package/dist/{sleep-BxjU_fJM.mjs → sleep-yKL5gfrH.mjs} +31 -4
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_sleep = require("./sleep-6sOPE0EV.js");
|
|
3
3
|
const require_event_category = require("./event-category-eSqkye-K.js");
|
|
4
4
|
const require_err_msg = require("./err-msg-BhVbr0NX.js");
|
|
5
5
|
//#region src/generated/cap-input-defaults.ts
|
|
@@ -63,7 +63,8 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
|
|
|
63
63
|
"enabled": false,
|
|
64
64
|
"maxAttempts": 1
|
|
65
65
|
},
|
|
66
|
-
"toolsEnabled": false
|
|
66
|
+
"toolsEnabled": false,
|
|
67
|
+
"providerConfig": {}
|
|
67
68
|
} } } },
|
|
68
69
|
"llm-runtime": {
|
|
69
70
|
"complete": { "runtime": { "__nested__": {
|
|
@@ -357,7 +358,7 @@ function materialise(defaults) {
|
|
|
357
358
|
* barrel (`ALL_CAPABILITY_DEFINITIONS`), which would cost ~144MB RSS per
|
|
358
359
|
* forked runner. See docs/decisions/adr-0028.md.
|
|
359
360
|
*
|
|
360
|
-
* Coverage: 27 collection caps,
|
|
361
|
+
* Coverage: 27 collection caps, 45 array methods.
|
|
361
362
|
*/
|
|
362
363
|
var COLLECTION_ARRAY_METHODS = Object.freeze({
|
|
363
364
|
"addon-pages-source": ["listPages"],
|
|
@@ -376,7 +377,6 @@ var COLLECTION_ARRAY_METHODS = Object.freeze({
|
|
|
376
377
|
"getDefaults",
|
|
377
378
|
"getUsage",
|
|
378
379
|
"listModelCatalog",
|
|
379
|
-
"listModels",
|
|
380
380
|
"listNodeModels",
|
|
381
381
|
"listProfileKinds",
|
|
382
382
|
"listProfiles",
|
package/dist/addon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $n as PEER_BYTES_CHUNK_BYTES, $t as REMOVE_LEAF, A as HF_REPO, An as RECORD_BATCH_MAX_BYTES, Ar as emitReadiness, B as describeCustomActions, Bn as RECORD_SECRET_COLLECTION_PREFIX, Br as SECRET_CLEAR, Bt as settingsBrokersAdoptsFrom, C as addonSliceHandleApi, Cn as RecordsError, Cr as globalSecretScope, Dn as asRecordsError, En as UnknownRecordKindError, Er as parseSecretRef, F as DEVICE_CHILDREN_BATCH_MAX, Fn as RECORD_ID_MAX_LENGTH, Ft as SETTINGS_ARRAY_ADOPTS_PREFIX, Gn as createSecretsAccess, Gr as isSecretMarkerLike, Gt as RecordFieldPathSchema, H as adminUiCapability, Hn as RECORD_SWEEP_INTERVAL_MS, Hr as isSecretClear, Ht as entryBody, I as CALLER_STAMPED_CAPABILITIES, In as RECORD_MAX_DATA_BYTES, It as parseSettingsArrayAdoptsFrom, Jn as forgetKnownSecret, Jt as RecordKindNameSchema, Kn as MIN_SCRUBBED_LENGTH, Kr as makeSecretMarker, Kt as RecordIndexSchema, L as withoutCallerStamp, Ln as RECORD_MAX_INDEXES, Lt as settingsArrayAdoptsFrom, Mn as RECORD_DATABASES, N as deviceOpsCapability, Nn as RECORD_DEFAULT_MAX_DATA_BYTES, On as recordsErrorFromMessage, P as viewerUiCapability, Pn as RECORD_DELETE_BATCH, Pt as makeInMemoryRecords, Qn as shortSecretRefHash, Qt as defineRecordKinds, Rn as RECORD_MAX_INDEX_FIELDS, Rt as SETTINGS_BROKERS_ADOPTS_PREFIX, Sn as RecordUniqueViolationError, Sr as formatSecretScope, Tn as UnindexedFilterError, Tr as normalizeSecretOwner, Un as resolveSecretViewsIn, Ur as isSecretFieldView, Ut as createRecordsAccess, Vn as RECORD_SETTINGS_MAX_ROWS, Vr as classifySecretWrite, Vt as defineEntryKind, Wn as REVALIDATE_AFTER_MS, Wr as isSecretMarker, Wt as EntryDescriptorSchema, X as expandCapMethods, Xn as registerKnownSecret, Xt as assertValidDeclaration, Yn as knownSecretCount, Yt as RecordRetentionSchema, Zn as scrubKnownSecrets, Zt as declarationsOf, _ as readErrorI18n, _n as PlaintextSecretError, an as recordSecretRef, b as isDeviceScopedCap, bn as RecordSecretUnavailableError, br as arrayItemFieldPath, c as asString, cn as collectZodSecretPaths, ct as ReadinessTimeoutError, d as parseJsonUnknown, dn as BatchTooLargeError, dt as scopeKey, en as collectSecretLeaves, er as PEER_BYTES_MAX_OUTSTANDING, f as hfModelUrl, fn as DeclarationRefusedError, g as ErrorI18nPayloadSchema, gn as NoCallerError, hn as InvalidRecordError, in as recordSecretCollection, ir as DATAPLANE_SECRET_HEADER, it as readNodePin, jn as RECORD_CLASSES, kn as RECORD_BATCH_MAX, kr as createEvent, ln as isZodSecret, lr as normalizeAddonInitResult, mn as ForeignSecretMarkerError, nn as parseSecretPath, nr as PEER_BYTES_TICKET_TTL_MS, o as asJsonObject, on as secretArrayPrefixes, or as DisposerChain, ot as MODEL_FORMATS, p as BOOT_RECOVERY_BACKOFF_MS, pn as FilterRequiredError, qn as clearKnownSecrets, qr as toSecretFieldView, qt as RecordKindDeclarationSchema, r as maskUrlCredentials, rn as recordArrayItemPath, rt as nodePin, sr as BaseAddon, st as ReadinessRegistry, t as sleep, tn as mapSecretLeaves, tr as PEER_BYTES_STALL_MS, un as AdoptionPendingError, vn as RECORDS_ERROR_CODES, w as createEventBusSliceSource, wn as RevConflictError, wr as isSecretRef, x as createDeviceProxy, xn as RecordTooLargeError, xr as buildSecretRef, y as DEVICE_SCOPED_CAPS, yn as RecordNotFoundError, yr as SECRET_REF_SCHEME, zn as RECORD_QUERY_MAX, zt as parseSettingsBrokersAdoptsFrom } from "./sleep-
|
|
1
|
+
import { $n as PEER_BYTES_CHUNK_BYTES, $t as REMOVE_LEAF, A as HF_REPO, An as RECORD_BATCH_MAX_BYTES, Ar as emitReadiness, B as describeCustomActions, Bn as RECORD_SECRET_COLLECTION_PREFIX, Br as SECRET_CLEAR, Bt as settingsBrokersAdoptsFrom, C as addonSliceHandleApi, Cn as RecordsError, Cr as globalSecretScope, Dn as asRecordsError, En as UnknownRecordKindError, Er as parseSecretRef, F as DEVICE_CHILDREN_BATCH_MAX, Fn as RECORD_ID_MAX_LENGTH, Ft as SETTINGS_ARRAY_ADOPTS_PREFIX, Gn as createSecretsAccess, Gr as isSecretMarkerLike, Gt as RecordFieldPathSchema, H as adminUiCapability, Hn as RECORD_SWEEP_INTERVAL_MS, Hr as isSecretClear, Ht as entryBody, I as CALLER_STAMPED_CAPABILITIES, In as RECORD_MAX_DATA_BYTES, It as parseSettingsArrayAdoptsFrom, Jn as forgetKnownSecret, Jt as RecordKindNameSchema, Kn as MIN_SCRUBBED_LENGTH, Kr as makeSecretMarker, Kt as RecordIndexSchema, L as withoutCallerStamp, Ln as RECORD_MAX_INDEXES, Lt as settingsArrayAdoptsFrom, Mn as RECORD_DATABASES, N as deviceOpsCapability, Nn as RECORD_DEFAULT_MAX_DATA_BYTES, On as recordsErrorFromMessage, P as viewerUiCapability, Pn as RECORD_DELETE_BATCH, Pt as makeInMemoryRecords, Qn as shortSecretRefHash, Qt as defineRecordKinds, Rn as RECORD_MAX_INDEX_FIELDS, Rt as SETTINGS_BROKERS_ADOPTS_PREFIX, Sn as RecordUniqueViolationError, Sr as formatSecretScope, Tn as UnindexedFilterError, Tr as normalizeSecretOwner, Un as resolveSecretViewsIn, Ur as isSecretFieldView, Ut as createRecordsAccess, Vn as RECORD_SETTINGS_MAX_ROWS, Vr as classifySecretWrite, Vt as defineEntryKind, Wn as REVALIDATE_AFTER_MS, Wr as isSecretMarker, Wt as EntryDescriptorSchema, X as expandCapMethods, Xn as registerKnownSecret, Xt as assertValidDeclaration, Yn as knownSecretCount, Yt as RecordRetentionSchema, Zn as scrubKnownSecrets, Zt as declarationsOf, _ as readErrorI18n, _n as PlaintextSecretError, an as recordSecretRef, b as isDeviceScopedCap, bn as RecordSecretUnavailableError, br as arrayItemFieldPath, c as asString, cn as collectZodSecretPaths, ct as ReadinessTimeoutError, d as parseJsonUnknown, dn as BatchTooLargeError, dt as scopeKey, en as collectSecretLeaves, er as PEER_BYTES_MAX_OUTSTANDING, f as hfModelUrl, fn as DeclarationRefusedError, g as ErrorI18nPayloadSchema, gn as NoCallerError, hn as InvalidRecordError, in as recordSecretCollection, ir as DATAPLANE_SECRET_HEADER, it as readNodePin, jn as RECORD_CLASSES, kn as RECORD_BATCH_MAX, kr as createEvent, ln as isZodSecret, lr as normalizeAddonInitResult, mn as ForeignSecretMarkerError, nn as parseSecretPath, nr as PEER_BYTES_TICKET_TTL_MS, o as asJsonObject, on as secretArrayPrefixes, or as DisposerChain, ot as MODEL_FORMATS, p as BOOT_RECOVERY_BACKOFF_MS, pn as FilterRequiredError, qn as clearKnownSecrets, qr as toSecretFieldView, qt as RecordKindDeclarationSchema, r as maskUrlCredentials, rn as recordArrayItemPath, rt as nodePin, sr as BaseAddon, st as ReadinessRegistry, t as sleep, tn as mapSecretLeaves, tr as PEER_BYTES_STALL_MS, un as AdoptionPendingError, vn as RECORDS_ERROR_CODES, w as createEventBusSliceSource, wn as RevConflictError, wr as isSecretRef, x as createDeviceProxy, xn as RecordTooLargeError, xr as buildSecretRef, y as DEVICE_SCOPED_CAPS, yn as RecordNotFoundError, yr as SECRET_REF_SCHEME, zn as RECORD_QUERY_MAX, zt as parseSettingsBrokersAdoptsFrom } from "./sleep-yKL5gfrH.mjs";
|
|
2
2
|
import { t as EventCategory } from "./event-category-DOl51-Ij.mjs";
|
|
3
3
|
import { a as DeviceType, t as errMsg } from "./err-msg-BXKzRBwg.mjs";
|
|
4
4
|
//#region src/generated/cap-input-defaults.ts
|
|
@@ -62,7 +62,8 @@ var CAP_INPUT_DEFAULTS = Object.freeze({
|
|
|
62
62
|
"enabled": false,
|
|
63
63
|
"maxAttempts": 1
|
|
64
64
|
},
|
|
65
|
-
"toolsEnabled": false
|
|
65
|
+
"toolsEnabled": false,
|
|
66
|
+
"providerConfig": {}
|
|
66
67
|
} } } },
|
|
67
68
|
"llm-runtime": {
|
|
68
69
|
"complete": { "runtime": { "__nested__": {
|
|
@@ -356,7 +357,7 @@ function materialise(defaults) {
|
|
|
356
357
|
* barrel (`ALL_CAPABILITY_DEFINITIONS`), which would cost ~144MB RSS per
|
|
357
358
|
* forked runner. See docs/decisions/adr-0028.md.
|
|
358
359
|
*
|
|
359
|
-
* Coverage: 27 collection caps,
|
|
360
|
+
* Coverage: 27 collection caps, 45 array methods.
|
|
360
361
|
*/
|
|
361
362
|
var COLLECTION_ARRAY_METHODS = Object.freeze({
|
|
362
363
|
"addon-pages-source": ["listPages"],
|
|
@@ -375,7 +376,6 @@ var COLLECTION_ARRAY_METHODS = Object.freeze({
|
|
|
375
376
|
"getDefaults",
|
|
376
377
|
"getUsage",
|
|
377
378
|
"listModelCatalog",
|
|
378
|
-
"listModels",
|
|
379
379
|
"listNodeModels",
|
|
380
380
|
"listProfileKinds",
|
|
381
381
|
"listProfiles",
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE permission vocabulary every credential is reduced to (D892).
|
|
3
|
+
*
|
|
4
|
+
* A credential — a login session, an account-link token, or a token
|
|
5
|
+
* `auth.mintToken` issues (there is no other format, D895) — is
|
|
6
|
+
* verified into a principal whose permissions are a `CredentialScope[]`, and
|
|
7
|
+
* nothing else. What KIND of credential it was never decides what it may do:
|
|
8
|
+
*
|
|
9
|
+
* - `'*'` — everything (the admin bypass). Held by an admin's session and
|
|
10
|
+
* a token minted with it.
|
|
11
|
+
* - a {@link TokenScope} — the v3 capability grants (`category`,
|
|
12
|
+
* `capability`, `addon`, `device`) the tRPC matcher has always applied.
|
|
13
|
+
* - `share-view` — one fail-closed embed perimeter (`grid-view` /
|
|
14
|
+
* `events-view`) over a few devices. A principal that holds one is
|
|
15
|
+
* RESTRICTED to it: the matcher honours nothing else it holds.
|
|
16
|
+
* - `addon-routes` — may reach any addon's own `authenticated` HTTP routes
|
|
17
|
+
* and data planes (never an `admin` one). A person's session has always
|
|
18
|
+
* had this; an integration token never had it and must hold
|
|
19
|
+
* `addon:<id>` instead. Only an admin may mint it into a token.
|
|
20
|
+
* - `preferences-self` — may read and write the SUBJECT's own account
|
|
21
|
+
* preferences (D894), never another user's. Every person's session holds
|
|
22
|
+
* it; a unified token holds it only when minted with it. `'*'` does NOT
|
|
23
|
+
* imply it: the hub's own mesh principal holds `'*'` and is nobody's
|
|
24
|
+
* account.
|
|
25
|
+
*
|
|
26
|
+
* Pure: no I/O. It lives in `@camstack/types` so the hub, the kernel and any
|
|
27
|
+
* addon read the same vocabulary.
|
|
28
|
+
*/
|
|
29
|
+
import { z } from 'zod';
|
|
30
|
+
import { MethodAccessSchema, type TokenScope } from '../schemas/auth-records.js';
|
|
31
|
+
/** The admin scope: every permission. */
|
|
32
|
+
export declare const ADMIN_SCOPE = "*";
|
|
33
|
+
/** At most this many devices in one share-view grant (the share-link bound). */
|
|
34
|
+
export declare const SHARE_VIEW_MAX_DEVICES = 64;
|
|
35
|
+
/** What a share-view grant lets its holder see. */
|
|
36
|
+
export declare const ShareViewGrantSchema: z.ZodObject<{
|
|
37
|
+
kind: z.ZodEnum<{
|
|
38
|
+
"events-view": "events-view";
|
|
39
|
+
"grid-view": "grid-view";
|
|
40
|
+
}>;
|
|
41
|
+
deviceIds: z.ZodArray<z.ZodNumber>;
|
|
42
|
+
talk: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type ShareViewGrant = z.infer<typeof ShareViewGrantSchema>;
|
|
45
|
+
export declare const ShareViewScopeSchema: z.ZodObject<{
|
|
46
|
+
type: z.ZodLiteral<"share-view">;
|
|
47
|
+
grant: z.ZodObject<{
|
|
48
|
+
kind: z.ZodEnum<{
|
|
49
|
+
"events-view": "events-view";
|
|
50
|
+
"grid-view": "grid-view";
|
|
51
|
+
}>;
|
|
52
|
+
deviceIds: z.ZodArray<z.ZodNumber>;
|
|
53
|
+
talk: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type ShareViewScope = z.infer<typeof ShareViewScopeSchema>;
|
|
57
|
+
export declare const AddonRoutesScopeSchema: z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"addon-routes">;
|
|
59
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
60
|
+
create: "create";
|
|
61
|
+
delete: "delete";
|
|
62
|
+
view: "view";
|
|
63
|
+
}>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export type AddonRoutesScope = z.infer<typeof AddonRoutesScopeSchema>;
|
|
66
|
+
export declare const PreferencesSelfScopeSchema: z.ZodObject<{
|
|
67
|
+
type: z.ZodLiteral<"preferences-self">;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export type PreferencesSelfScope = z.infer<typeof PreferencesSelfScopeSchema>;
|
|
70
|
+
/** The grant every person's session carries for its own account preferences. */
|
|
71
|
+
export declare const PREFERENCES_SELF_SCOPE: PreferencesSelfScope;
|
|
72
|
+
export declare const CredentialScopeSchema: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodObject<{
|
|
73
|
+
type: z.ZodLiteral<"share-view">;
|
|
74
|
+
grant: z.ZodObject<{
|
|
75
|
+
kind: z.ZodEnum<{
|
|
76
|
+
"events-view": "events-view";
|
|
77
|
+
"grid-view": "grid-view";
|
|
78
|
+
}>;
|
|
79
|
+
deviceIds: z.ZodArray<z.ZodNumber>;
|
|
80
|
+
talk: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
type: z.ZodLiteral<"addon-routes">;
|
|
84
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
85
|
+
create: "create";
|
|
86
|
+
delete: "delete";
|
|
87
|
+
view: "view";
|
|
88
|
+
}>>;
|
|
89
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
90
|
+
type: z.ZodLiteral<"preferences-self">;
|
|
91
|
+
}, z.core.$strip>, z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
92
|
+
type: z.ZodLiteral<"category">;
|
|
93
|
+
target: z.ZodEnum<{
|
|
94
|
+
device: "device";
|
|
95
|
+
system: "system";
|
|
96
|
+
}>;
|
|
97
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
98
|
+
create: "create";
|
|
99
|
+
delete: "delete";
|
|
100
|
+
view: "view";
|
|
101
|
+
}>>;
|
|
102
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<"capability">;
|
|
104
|
+
target: z.ZodString;
|
|
105
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
106
|
+
create: "create";
|
|
107
|
+
delete: "delete";
|
|
108
|
+
view: "view";
|
|
109
|
+
}>>;
|
|
110
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
111
|
+
type: z.ZodLiteral<"addon">;
|
|
112
|
+
target: z.ZodString;
|
|
113
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
114
|
+
create: "create";
|
|
115
|
+
delete: "delete";
|
|
116
|
+
view: "view";
|
|
117
|
+
}>>;
|
|
118
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
119
|
+
type: z.ZodLiteral<"device">;
|
|
120
|
+
selector: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
121
|
+
kind: z.ZodLiteral<"all">;
|
|
122
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
+
kind: z.ZodLiteral<"ids">;
|
|
124
|
+
ids: z.ZodArray<z.ZodNumber>;
|
|
125
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
126
|
+
kind: z.ZodLiteral<"types">;
|
|
127
|
+
types: z.ZodArray<z.ZodEnum<typeof import("../index.js").DeviceType>>;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
kind: z.ZodLiteral<"locations">;
|
|
130
|
+
locations: z.ZodArray<z.ZodString>;
|
|
131
|
+
}, z.core.$strip>], "kind">;
|
|
132
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
133
|
+
create: "create";
|
|
134
|
+
delete: "delete";
|
|
135
|
+
view: "view";
|
|
136
|
+
}>>;
|
|
137
|
+
includeLinked: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
}, z.core.$strip>], "type">>]>;
|
|
139
|
+
export type CredentialScope = z.infer<typeof CredentialScopeSchema>;
|
|
140
|
+
/** Every access flavour — what a person's session holds on addon routes. */
|
|
141
|
+
export declare const ALL_METHOD_ACCESS: readonly ['view', 'create', 'delete'];
|
|
142
|
+
/** True iff the scope set holds `'*'`. */
|
|
143
|
+
export declare function scopesGrantAdmin(scopes: readonly CredentialScope[]): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* The share-view grant that RESTRICTS this principal, or `null` when it holds
|
|
146
|
+
* none. Fail closed: a set that mixes a share-view grant with anything else
|
|
147
|
+
* is still restricted to its FIRST share-view grant, never widened by the rest.
|
|
148
|
+
*/
|
|
149
|
+
export declare function shareViewGrantOf(scopes: readonly CredentialScope[]): ShareViewGrant | null;
|
|
150
|
+
/** The capability grants the tRPC scope matcher reads. */
|
|
151
|
+
export declare function capabilityScopesOf(scopes: readonly CredentialScope[]): readonly TokenScope[];
|
|
152
|
+
/** True iff the set reaches every addon's own routes at `access`. */
|
|
153
|
+
export declare function scopesAllowAddonRoutes(scopes: readonly CredentialScope[], access: z.infer<typeof MethodAccessSchema>): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* True iff the set may touch its subject's own account preferences: it holds
|
|
156
|
+
* `preferences-self` and no share-view grant restricts it. `'*'` alone is not
|
|
157
|
+
* enough (see the vocabulary above).
|
|
158
|
+
*/
|
|
159
|
+
export declare function scopesAllowOwnPreferences(scopes: readonly CredentialScope[]): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Parse a scope array from an untrusted source (a JWT claim, a stored row).
|
|
162
|
+
* Any element that does not parse makes the WHOLE set unusable — `null` — so
|
|
163
|
+
* a corrupt grant can never degrade into a partial one.
|
|
164
|
+
*/
|
|
165
|
+
export declare function parseCredentialScopes(raw: unknown): readonly CredentialScope[] | null;
|
|
166
|
+
/**
|
|
167
|
+
* The `kind` claim of a unified token. It names the TOKEN FAMILY (so every
|
|
168
|
+
* older gate that classifies a hub JWT refuses it — `classifyBearerPrincipal`
|
|
169
|
+
* treats any `kind` it does not know as not-a-credential), never what the
|
|
170
|
+
* token may do: that is its `scopes`, and only its `scopes`.
|
|
171
|
+
*/
|
|
172
|
+
export declare const CREDENTIAL_TOKEN_KIND = "credential";
|
|
173
|
+
/**
|
|
174
|
+
* The `aud` claim every minted token is signed with (D895). The hub's raw JWT
|
|
175
|
+
* verify (`AuthManager.verifyToken`, used by every surface that wants a LOGIN
|
|
176
|
+
* session — the OAuth consent page, the session cookie, health, backups)
|
|
177
|
+
* refuses a token carrying it, so a minted token — a share link above all —
|
|
178
|
+
* can never be replayed as a person's session. Only the credential verifier's
|
|
179
|
+
* own door (`verifyCredentialToken`) accepts it.
|
|
180
|
+
*/
|
|
181
|
+
export declare const CREDENTIAL_TOKEN_AUDIENCE = "camstack:credential";
|
|
182
|
+
/** Does a verified JWT payload belong to the minted-token family? */
|
|
183
|
+
export declare function isCredentialTokenPayload(payload: unknown): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* The claims of a unified token (`auth.mintToken`). It carries no `exp`: its
|
|
186
|
+
* row (looked up by `jti` on every verify, for revocation) holds the ONE
|
|
187
|
+
* expiry, so a share link can be extended and a JWT clock can never disagree
|
|
188
|
+
* with the row.
|
|
189
|
+
*/
|
|
190
|
+
export declare const CredentialTokenClaimsSchema: z.ZodObject<{
|
|
191
|
+
kind: z.ZodLiteral<"credential">;
|
|
192
|
+
sub: z.ZodString;
|
|
193
|
+
jti: z.ZodString;
|
|
194
|
+
scopes: z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodObject<{
|
|
195
|
+
type: z.ZodLiteral<"share-view">;
|
|
196
|
+
grant: z.ZodObject<{
|
|
197
|
+
kind: z.ZodEnum<{
|
|
198
|
+
"events-view": "events-view";
|
|
199
|
+
"grid-view": "grid-view";
|
|
200
|
+
}>;
|
|
201
|
+
deviceIds: z.ZodArray<z.ZodNumber>;
|
|
202
|
+
talk: z.ZodOptional<z.ZodBoolean>;
|
|
203
|
+
}, z.core.$strip>;
|
|
204
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
205
|
+
type: z.ZodLiteral<"addon-routes">;
|
|
206
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
207
|
+
create: "create";
|
|
208
|
+
delete: "delete";
|
|
209
|
+
view: "view";
|
|
210
|
+
}>>;
|
|
211
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
212
|
+
type: z.ZodLiteral<"preferences-self">;
|
|
213
|
+
}, z.core.$strip>, z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
214
|
+
type: z.ZodLiteral<"category">;
|
|
215
|
+
target: z.ZodEnum<{
|
|
216
|
+
device: "device";
|
|
217
|
+
system: "system";
|
|
218
|
+
}>;
|
|
219
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
220
|
+
create: "create";
|
|
221
|
+
delete: "delete";
|
|
222
|
+
view: "view";
|
|
223
|
+
}>>;
|
|
224
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
225
|
+
type: z.ZodLiteral<"capability">;
|
|
226
|
+
target: z.ZodString;
|
|
227
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
228
|
+
create: "create";
|
|
229
|
+
delete: "delete";
|
|
230
|
+
view: "view";
|
|
231
|
+
}>>;
|
|
232
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"addon">;
|
|
234
|
+
target: z.ZodString;
|
|
235
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
236
|
+
create: "create";
|
|
237
|
+
delete: "delete";
|
|
238
|
+
view: "view";
|
|
239
|
+
}>>;
|
|
240
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
241
|
+
type: z.ZodLiteral<"device">;
|
|
242
|
+
selector: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
243
|
+
kind: z.ZodLiteral<"all">;
|
|
244
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
245
|
+
kind: z.ZodLiteral<"ids">;
|
|
246
|
+
ids: z.ZodArray<z.ZodNumber>;
|
|
247
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
248
|
+
kind: z.ZodLiteral<"types">;
|
|
249
|
+
types: z.ZodArray<z.ZodEnum<typeof import("../index.js").DeviceType>>;
|
|
250
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
251
|
+
kind: z.ZodLiteral<"locations">;
|
|
252
|
+
locations: z.ZodArray<z.ZodString>;
|
|
253
|
+
}, z.core.$strip>], "kind">;
|
|
254
|
+
access: z.ZodArray<z.ZodEnum<{
|
|
255
|
+
create: "create";
|
|
256
|
+
delete: "delete";
|
|
257
|
+
view: "view";
|
|
258
|
+
}>>;
|
|
259
|
+
includeLinked: z.ZodOptional<z.ZodBoolean>;
|
|
260
|
+
}, z.core.$strip>], "type">>]>>;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
export type CredentialTokenClaims = z.infer<typeof CredentialTokenClaimsSchema>;
|
|
@@ -114,7 +114,7 @@ export type PrincipalAddonReachVerdict = {
|
|
|
114
114
|
* would lock every non-admin viewer out of recorder playback, snapshot media
|
|
115
115
|
* and the stream-broker embed, which is a worse outcome than the hole.
|
|
116
116
|
* - **integration** — must hold `addon:<addonId>` at the verb's access. This is
|
|
117
|
-
* the same rule the
|
|
117
|
+
* the same rule the scoped-token branch has always applied; the JWT
|
|
118
118
|
* branch simply never applied it, and closing that divergence IS the fix.
|
|
119
119
|
* `isAdmin` is ignored: an integration token is minted `isAdmin: false` and a
|
|
120
120
|
* token claiming otherwise must not talk its way past the grant.
|
|
@@ -77,7 +77,7 @@ export { FailureContributionSchema, FailureReasonCountSchema, failureContributio
|
|
|
77
77
|
export { filesystemBrowseCapability, type IFilesystemBrowseProvider, } from './filesystem-browse.cap.js';
|
|
78
78
|
export { AUTOMATIC_HUB_ADDRESS_FLAGS, checkRoleAddress, HUB_ADDRESS_ROLES, type HubAddressCheck, type HubAddressFlags, type HubAddressRole, type HubAddressRoleResolution, type HubAddressRoles, type HubAddressSource, type HubAppConnectionsResolution, HUB_MDNS_QUERY_NAME, HUB_MDNS_ROLE, HUB_MDNS_SERVICE_TYPE, HUB_MDNS_TXT_KEYS, AGENT_MDNS_QUERY_NAME, AGENT_MDNS_SERVICE_TYPE, AGENT_MDNS_TXT_KEYS, hubAddressHostname, isDefaultAppConnectionEndpoint, isSingleHubAddressRole, PUBLIC_ENDPOINT_HTTP_REASON, resolveAppConnections, resolveHubAddressRoles, resolveInternalAddress, resolveNotificationTapAddress, resolvePublicEndpoint, SINGLE_HUB_ADDRESS_ROLES, type SingleHubAddressRole, selectAppConnectionEndpoints, validateCustomAddress, } from './hub-address.js';
|
|
79
79
|
export { addonCatalogHref } from './addon-catalog-href.js';
|
|
80
|
-
export { type HfModelResolution, HfModelResolutionSchema, type ILlmProvider, type LlmDefault, LlmDefaultSchema, type LlmDefaultSelector, LlmDefaultSelectorSchema, type LlmProfile, type LlmProfileKind, type LlmProfileKindDescriptor, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, type LlmRuntimeNode, LlmRuntimeNodeSchema, type LlmUsageRollup, LlmUsageRollupSchema, llmCapability, type ManagedModelCatalogEntry, ManagedModelCatalogEntrySchema, } from './llm.cap.js';
|
|
80
|
+
export { type HfModelResolution, HfModelResolutionSchema, type ILlmProvider, type LlmDefault, LlmDefaultSchema, type LlmDefaultSelector, LlmDefaultSelectorSchema, LLM_PROFILE_KIND_PATTERN, type LlmListModelsErrorCode, LlmListModelsErrorCodeSchema, type LlmListModelsInput, LlmListModelsInputSchema, type LlmListModelsResult, LlmListModelsResultSchema, type LlmModelFeatures, LlmModelFeaturesSchema, type LlmModelInfo, LlmModelInfoSchema, type LlmProfile, type LlmProfileField, LlmProfileFieldSchema, type LlmProfileKind, type LlmProfileKindDescriptor, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, type LlmProviderConfig, LlmProviderConfigSchema, type LlmProviderWidget, LlmProviderWidgetSchema, type LlmRuntimeNode, LlmRuntimeNodeSchema, type LlmUsageRollup, LlmUsageRollupSchema, llmCapability, type ManagedModelCatalogEntry, ManagedModelCatalogEntrySchema, } from './llm.cap.js';
|
|
81
81
|
export { type RawSecretMigrationInput, RawSecretMigrationInputSchema, type RawSecretMigrationReport, RawSecretMigrationReportSchema, } from './raw-secret-migration.js';
|
|
82
82
|
export { type AppleFmAvailability, AppleFmAvailabilitySchema, type AppleFmUnavailableReason, AppleFmUnavailableReasonSchema, type ILlmRuntimeProvider, type LlmDownloadProgress, LlmDownloadProgressSchema, type LlmNodeModel, LlmNodeModelSchema, type LlmRuntimeAppleCompleteInput, LlmRuntimeAppleCompleteInputSchema, type LlmRuntimeCancelInput, LlmRuntimeCancelInputSchema, type LlmRuntimeCompleteInput, LlmRuntimeCompleteInputSchema, type LlmRuntimeDiskUsage, LlmRuntimeDiskUsageSchema, type LlmRuntimeStatus, LlmRuntimeStatusSchema, llmRuntimeCapability, type ManagedModelExtraFile, ManagedModelExtraFileSchema, type ManagedModelRef, ManagedModelRefSchema, type ManagedRuntimeConfig, ManagedRuntimeConfigSchema, } from './llm-runtime.cap.js';
|
|
83
83
|
export { type LlmErrorCode, LlmErrorCodeSchema, type LlmGenerateBaseInput, LlmGenerateBaseInputSchema, type LlmGenerateErr, LlmGenerateErrSchema, type LlmGenerateOk, LlmGenerateOkSchema, type LlmGenerateResult, LlmGenerateResultSchema, type LlmImage, LlmImageSchema, type LlmRefusalSource, LlmRefusalSourceSchema, type LlmRetryPolicy, LlmRetryPolicySchema, LlmTimeoutDefaults, type LlmUsage, LlmUsageSchema, } from './llm-shared.js';
|
|
@@ -238,7 +238,7 @@ export { type ITamperProvider, type TamperStatus, TamperStatusSchema, tamperCapa
|
|
|
238
238
|
export { type ITemperatureSensorProvider, type TemperatureSensorStatus, TemperatureSensorStatusSchema, temperatureSensorCapability, } from './temperature-sensor.cap.js';
|
|
239
239
|
export { type IToastProvider, ToastSchema, toastCapability } from './toast.cap.js';
|
|
240
240
|
export { type IUpdateProvider, type UpdateStatus, UpdateStatusSchema, updateCapability, } from './update.cap.js';
|
|
241
|
-
export { ApiKeySummarySchema,
|
|
241
|
+
export { ApiKeySummarySchema, CreateUserInputSchema, ExternalIdentityKeySchema, ExternalIdentitySchema, type IUserManagementProvider, UpdateUserInputSchema, UserSummarySchema, userManagementCapability, } from './user-management.cap.js';
|
|
242
242
|
export { type IVacuumControlProvider, type TankStatus, TankStatusSchema, type VacuumControlStatus, VacuumControlStatusSchema, type VacuumState, VacuumStateSchema, vacuumControlCapability, } from './vacuum-control.cap.js';
|
|
243
243
|
export { type IValveProvider, type ValveState, ValveStateSchema, type ValveStatus, ValveStatusSchema, valveCapability, } from './valve.cap.js';
|
|
244
244
|
export { type IVibrationProvider, type VibrationStatus, VibrationStatusSchema, vibrationCapability, } from './vibration.cap.js';
|