@fleetless/contracts 13.3.0 → 14.0.0

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +141 -0
  2. package/artifacts/openapi.json +1983 -784
  3. package/artifacts/routes.json +224 -208
  4. package/artifacts/schema/access-warning.schema.json +51 -0
  5. package/artifacts/schema/action-config.schema.json +35 -0
  6. package/artifacts/schema/app-access-response.schema.json +136 -0
  7. package/artifacts/schema/app-access.schema.json +80 -0
  8. package/artifacts/schema/app-deletion-summary.schema.json +0 -7
  9. package/artifacts/schema/app-invitation-list-response.schema.json +13 -6
  10. package/artifacts/schema/app-invitation.schema.json +5 -5
  11. package/artifacts/schema/app-list-response.schema.json +6 -6
  12. package/artifacts/schema/app-lock.schema.json +30 -0
  13. package/artifacts/schema/app-user-list-response.schema.json +13 -6
  14. package/artifacts/schema/app-user.schema.json +13 -6
  15. package/artifacts/schema/app.schema.json +6 -6
  16. package/artifacts/schema/auth-ok.schema.json +20 -6
  17. package/artifacts/schema/camera-list-response.schema.json +1 -1
  18. package/artifacts/schema/client-identity.schema.json +21 -6
  19. package/artifacts/schema/cloud-config.schema.json +359 -5
  20. package/artifacts/schema/config-draft-response.schema.json +359 -5
  21. package/artifacts/schema/config-version-response.schema.json +359 -5
  22. package/artifacts/schema/create-app-invitation-request.schema.json +4 -4
  23. package/artifacts/schema/create-app-user-request.schema.json +4 -4
  24. package/artifacts/schema/create-org-role-request.schema.json +33 -0
  25. package/artifacts/schema/dangling-reference.schema.json +129 -0
  26. package/artifacts/schema/datapoint-config.schema.json +35 -0
  27. package/artifacts/schema/datapoint-list-response.schema.json +1 -1
  28. package/artifacts/schema/effective-capability.schema.json +104 -0
  29. package/artifacts/schema/effective-rights-query.schema.json +19 -0
  30. package/artifacts/schema/effective-rights-response.schema.json +310 -0
  31. package/artifacts/schema/effective-robot-rights.schema.json +266 -0
  32. package/artifacts/schema/invoke-or-service-response.schema.json +1 -1
  33. package/artifacts/schema/invoke-response.schema.json +1 -1
  34. package/artifacts/schema/journal-intent-v2-body.schema.json +74 -0
  35. package/artifacts/schema/journal-intent-v2.schema.json +84 -0
  36. package/artifacts/schema/journal-replay-receipt-body.schema.json +1 -0
  37. package/artifacts/schema/journal-replay-receipt.schema.json +1 -0
  38. package/artifacts/schema/mcp-robot-datasheet.schema.json +2 -2
  39. package/artifacts/schema/org-role-list-response.schema.json +205 -0
  40. package/artifacts/schema/org-role.schema.json +59 -0
  41. package/artifacts/schema/patch-app-user-request.schema.json +4 -4
  42. package/artifacts/schema/patch-org-role-request.schema.json +38 -0
  43. package/artifacts/schema/publish-config-response.schema.json +48 -1
  44. package/artifacts/schema/publisher-config.schema.json +35 -0
  45. package/artifacts/schema/put-role-defaults-request.schema.json +127 -0
  46. package/artifacts/schema/reference-place.schema.json +111 -0
  47. package/artifacts/schema/rename-slug-response.schema.json +4 -3
  48. package/artifacts/schema/robot-config-doc.schema.json +359 -5
  49. package/artifacts/schema/role-cycle-details.schema.json +18 -0
  50. package/artifacts/schema/role-defaults-response.schema.json +59 -0
  51. package/artifacts/schema/role-rename-preview.schema.json +146 -0
  52. package/artifacts/schema/service-config.schema.json +35 -0
  53. package/artifacts/schema/slug-usage-response.schema.json +4 -3
  54. package/artifacts/schema/update-app-request.schema.json +0 -12
  55. package/dist/app-users.d.ts +11 -8
  56. package/dist/app-users.js +18 -10
  57. package/dist/apps.d.ts +242 -71
  58. package/dist/apps.js +205 -151
  59. package/dist/audit.d.ts +3 -3
  60. package/dist/billing.d.ts +10 -10
  61. package/dist/client-auth.d.ts +5 -2
  62. package/dist/client-auth.js +11 -3
  63. package/dist/client-robots.d.ts +1 -1
  64. package/dist/client-robots.js +1 -1
  65. package/dist/common.d.ts +1 -1
  66. package/dist/common.js +1 -1
  67. package/dist/config-issues.d.ts +1 -1
  68. package/dist/config-issues.js +1 -1
  69. package/dist/config.d.ts +77 -11
  70. package/dist/config.js +108 -14
  71. package/dist/errors.d.ts +14 -5
  72. package/dist/errors.js +37 -24
  73. package/dist/index.d.ts +18 -8
  74. package/dist/index.js +14 -4
  75. package/dist/journal-intents.d.ts +30 -0
  76. package/dist/journal-intents.js +3 -0
  77. package/dist/legal-acceptances.d.ts +2 -2
  78. package/dist/mcp.d.ts +5 -37
  79. package/dist/mcp.js +4 -14
  80. package/dist/org-roles.d.ts +182 -0
  81. package/dist/org-roles.js +198 -0
  82. package/dist/plans.d.ts +6 -6
  83. package/dist/protocol.d.ts +19 -1
  84. package/dist/realtime.d.ts +6 -3
  85. package/dist/realtime.js +1 -1
  86. package/dist/rest.d.ts +76 -25
  87. package/dist/rest.js +41 -29
  88. package/dist/rights.d.ts +197 -0
  89. package/dist/rights.js +396 -0
  90. package/dist/routes.js +185 -134
  91. package/package.json +1 -1
  92. package/artifacts/schema/mcp-role-preview-response.schema.json +0 -134
  93. package/artifacts/schema/role-delete-query.schema.json +0 -13
  94. package/artifacts/schema/role-in-use-details.schema.json +0 -28
  95. package/artifacts/schema/role-list-response.schema.json +0 -48
  96. package/artifacts/schema/role-permissions.schema.json +0 -61
  97. package/artifacts/schema/role-rename-request.schema.json +0 -16
  98. package/artifacts/schema/role.schema.json +0 -35
@@ -0,0 +1,198 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from 'zod';
3
+ import { ACCESS_KINDS, MAX_ORG_ROLES, ROLE_NAME_MAX, roleKey } from './rights.js';
4
+ /**
5
+ * Organization roles on the wire: the roles themselves, what names them, and
6
+ * the organization's defaults.
7
+ *
8
+ * A role belongs to the organization, not to an app. Its **key** is what
9
+ * `fleetless.yaml` and every assignment write; its **name** is what a person
10
+ * reads, and changing it changes nothing about rights. A role inherits from
11
+ * any number of other roles, and the only change the cloud refuses is one that
12
+ * would make a role inherit from itself (`role_cycle`).
13
+ *
14
+ * **A key that names no role is a warning and never an error**, wherever it is
15
+ * written: it grants nothing, and `GET /api/org/roles` lists it under
16
+ * `dangling` with every place that names it. That is what makes deleting or
17
+ * renaming a role safe to do first and tidy up after.
18
+ */
19
+ /** A role's display name: free text, trimmed, 1 to 60 characters. */
20
+ const roleName = z.string().trim().min(1).max(ROLE_NAME_MAX);
21
+ /**
22
+ * A place that writes a role key, as the role list, the rename preview and
23
+ * the dangling-reference list all name it.
24
+ *
25
+ * One flat shape for every kind, with `null` for what a kind does not have,
26
+ * so a client renders a row without switching on `kind` to find a field.
27
+ */
28
+ export const referencePlace = z.object({
29
+ kind: z.enum(['config', 'app_user', 'invitation', 'app_default', 'role_inherits', 'org_default']).meta({
30
+ description: 'What writes the key: `config` is a `role` or `access` value in a robot\'s `fleetless.yaml`, `app_user` an app user who holds it, ' +
31
+ '`invitation` an invitation that carries it, `app_default` an app\'s default role, `role_inherits` another role that inherits from it, ' +
32
+ 'and `org_default` one of the organization\'s defaults.',
33
+ }),
34
+ label: z.string().meta({
35
+ description: 'What a person reads to find the place: the robot name (`config`), the e-mail address of the app user or of the invitee (`app_user`, `invitation`), the app name (`app_default`), the name of the inheriting role (`role_inherits`), or the access kind of an organization default (`org_default`).',
36
+ }),
37
+ path: z.string().nullable().meta({
38
+ description: 'Where the key is written. For `config`, the place in the YAML, such as `services.arm_home.role` or `access.rules[1].role`; for ' +
39
+ '`role_inherits`, the key of the role that inherits from it, because display names are not unique; `null` for every other kind.',
40
+ }),
41
+ robot_id: z.uuid().nullable().meta({
42
+ description: 'The robot whose document holds the key (`config`); `null` for every other kind.',
43
+ }),
44
+ app_id: z.uuid().nullable().meta({
45
+ description: 'The app the user, invitation or default role belongs to (`app_user`, `invitation`, `app_default`); `null` for every other kind.',
46
+ }),
47
+ user_id: z.uuid().nullable().meta({
48
+ description: 'The app user who holds the key (`app_user`); `null` for every other kind.',
49
+ }),
50
+ document: z.enum(['published', 'draft']).nullable().meta({
51
+ description: 'Which version of the robot\'s document holds the key (`config`): the published one or the draft; `null` for every other kind.',
52
+ }),
53
+ new_version: z.number().int().positive().nullable().meta({
54
+ description: 'For a published document, the version number a rename with `update_references` would give it, a copy that differs only in the key; ' +
55
+ '`null` for a draft and for every place that is no document.',
56
+ }),
57
+ });
58
+ /** One role as `GET /api/org/roles` lists it, with how much depends on it. */
59
+ export const orgRole = z.object({
60
+ key: roleKey.meta({
61
+ description: 'The role\'s key, as `fleetless.yaml` and every assignment write it. Unique in the organization.',
62
+ }),
63
+ name: roleName.meta({
64
+ description: 'The display name, 1 to 60 characters and trimmed. Changing it changes nothing about rights.',
65
+ }),
66
+ inherits: z.array(z.string()).meta({
67
+ description: 'The keys of the roles this one inherits from. A role holds whatever its parents hold, and theirs in turn. A key that names no role ' +
68
+ 'is kept as written; inheritance through it grants nothing, and the key appears under `dangling`.',
69
+ }),
70
+ users: z.number().int().nonnegative().meta({
71
+ description: 'App users, in every app of the organization, who hold this role.',
72
+ }),
73
+ invitations: z.number().int().nonnegative().meta({
74
+ description: 'Invitations that carry this role.',
75
+ }),
76
+ app_defaults: z.number().int().nonnegative().meta({
77
+ description: 'Apps that use this role as their default role.',
78
+ }),
79
+ references: z.number().int().nonnegative().meta({
80
+ description: 'Places in documents that name this role, such as a `role` in a robot\'s `fleetless.yaml`. A rename with `update_references` rewrites them.',
81
+ }),
82
+ });
83
+ /** A key that is written somewhere and is no role, with every place that writes it. */
84
+ export const danglingReference = z.object({
85
+ key: z.string().meta({
86
+ description: 'A key that names no role of the organization, because the role was deleted or renamed or never existed.',
87
+ }),
88
+ places: z.array(referencePlace).meta({
89
+ description: 'Every place that writes the key. It grants nothing wherever it is written; creating a role with this key makes the places count again.',
90
+ }),
91
+ });
92
+ /** What `GET /api/org/roles` answers. */
93
+ export const orgRoleListResponse = z.object({
94
+ roles: z.array(orgRole).meta({
95
+ description: 'The organization\'s roles with their counts, in the order they were created: the roles every organization starts with (`observe`, `operate` and `admin`) come first.',
96
+ }),
97
+ dangling: z.array(danglingReference).meta({
98
+ description: 'Keys written somewhere that are no role, each with its places. Empty when nothing is out of step.',
99
+ }),
100
+ });
101
+ /** `POST /api/org/roles`: a new role. Strict, so a field this route does not take is refused rather than dropped. */
102
+ export const createOrgRoleRequest = z.object({
103
+ key: roleKey.meta({
104
+ description: 'The new role\'s key, unique in the organization. Documents and assignments name the role by it.',
105
+ }),
106
+ name: roleName.meta({
107
+ description: 'The display name, 1 to 60 characters; surrounding spaces are removed.',
108
+ }),
109
+ inherits: z.array(roleKey).max(MAX_ORG_ROLES).optional().meta({
110
+ description: 'Keys of the roles to inherit from. A key that names no role is accepted and warns. Left out, the role inherits from nobody; ' +
111
+ 'a key that would lead back to this role is refused with `role_cycle`.',
112
+ }),
113
+ }).strict();
114
+ /**
115
+ * `PATCH /api/org/roles/:key`: change a role. Absent leaves a field alone.
116
+ *
117
+ * At least one field is required: an empty patch is a caller mistake, not a
118
+ * request to do nothing. `update_references` and `confirm` only mean something
119
+ * together with `key`.
120
+ *
121
+ * The one-field rule is a `.refine()`, which JSON Schema cannot express, so
122
+ * `patch-org-role-request.schema.json` describes five independent optional
123
+ * fields; the cloud is the only place an empty patch is refused.
124
+ */
125
+ export const patchOrgRoleRequest = z.object({
126
+ name: roleName.optional().meta({
127
+ description: 'A new display name, 1 to 60 characters; surrounding spaces are removed.',
128
+ }),
129
+ inherits: z.array(roleKey).max(MAX_ORG_ROLES).optional().meta({
130
+ description: 'The role\'s parents from now on. It replaces the whole list; `[]` removes every parent. A list that would lead back to this role is refused with `role_cycle`.',
131
+ }),
132
+ key: roleKey.optional().meta({
133
+ description: 'A new key. On its own, the rename is accepted at once and everything that still names the old key turns into a warning. ' +
134
+ 'To rewrite those places as well, add `update_references`.',
135
+ }),
136
+ update_references: z.boolean().optional().meta({
137
+ description: 'With `key`: rewrite every place that names the old key to the new one, in one transaction. Without `confirm`, when there are places ' +
138
+ 'to rewrite the call changes nothing and answers `409 confirmation_required` with the preview; a rename with none applies at once and ' +
139
+ 'needs no token.',
140
+ }),
141
+ confirm: z.string().min(1).optional().meta({
142
+ description: 'The `confirm` token of the preview the caller was shown. It confirms that preview only; if the places to rewrite have changed since, the call answers a new preview.',
143
+ }),
144
+ }).strict().refine((patch) => Object.values(patch).some((value) => value !== undefined), {
145
+ message: 'A patch names at least one field to change.',
146
+ });
147
+ /**
148
+ * What a rename with `update_references` would rewrite: the `details` of the
149
+ * `409 confirmation_required` that answers it. Repeating the same request with
150
+ * `confirm` set to this token applies the rename.
151
+ */
152
+ export const roleRenamePreview = z.object({
153
+ from: z.string().meta({ description: 'The key being renamed.' }),
154
+ to: z.string().meta({ description: 'The key it would become.' }),
155
+ references: z.array(referencePlace).meta({
156
+ description: 'Every place that would be rewritten, each with the document it is in and, for a published document, the version the rewrite would create.',
157
+ }),
158
+ reference_count: z.number().int().nonnegative().meta({
159
+ description: 'How many places the rename would rewrite.',
160
+ }),
161
+ confirm: z.string().meta({
162
+ description: 'The token that confirms this preview. It only fits the effects listed here: when anything they cover changes, the token is stale and the call answers a new preview.',
163
+ }),
164
+ });
165
+ /** What each kind of access covers; one place so the request, the response and the docs say the same. */
166
+ const KIND_SCOPE = {
167
+ read: 'Reading datapoints and cameras.',
168
+ invoke: 'Calling services and starting actions.',
169
+ publish: 'Driving a robot through its publishers.',
170
+ assets: 'A robot\'s asset files, such as its URDF and meshes.',
171
+ job_history: 'The history of a robot\'s jobs.',
172
+ };
173
+ /** One property per access kind, so a kind added to `ACCESS_KINDS` is a compile error here and not a silent gap. */
174
+ function perKind(make) {
175
+ return Object.fromEntries(ACCESS_KINDS.map((kind) => [kind, make(KIND_SCOPE[kind])]));
176
+ }
177
+ /** What `GET` and `PUT /api/org/roles/defaults` answer: who holds each kind of access when a robot's configuration says nothing. */
178
+ export const roleDefaultsResponse = z.object({
179
+ defaults: z.object(perKind((scope) => z.array(z.string()).meta({
180
+ description: `${scope} The roles that hold this kind of access by default; an empty list means nobody does, however senior the role.`,
181
+ }))).meta({
182
+ description: 'Every kind of access, each with the keys of the roles that hold it when a robot\'s published configuration names nobody.',
183
+ }),
184
+ });
185
+ /** One kind's default as a caller may write it: a role, several roles, or `null`/`[]` for nobody. */
186
+ const defaultHolders = (scope) => z.union([roleKey, z.array(roleKey).max(MAX_ORG_ROLES), z.null()], {
187
+ error: (issue) => (issue.code === 'invalid_union'
188
+ ? 'A default is one role key, `operate`, a list of keys, `[operate, admin]`, or `null` for nobody.'
189
+ : undefined),
190
+ }).optional().meta({
191
+ description: `${scope} One role key, a list of keys, or \`null\` or \`[]\` for nobody. Left out, the kind keeps what it has. A key that names no role is accepted and warns.`,
192
+ });
193
+ /** `PUT /api/org/roles/defaults`: change some defaults and leave the others as they are. */
194
+ export const putRoleDefaultsRequest = z.object({
195
+ defaults: z.object(perKind(defaultHolders)).strict().meta({
196
+ description: 'The kinds to change. A kind that is not named keeps its current default, so this is a patch of the defaults and not a replacement.',
197
+ }),
198
+ }).strict();
package/dist/plans.d.ts CHANGED
@@ -29,8 +29,8 @@ export declare const PLAN_ORDER: readonly PlanId[];
29
29
  */
30
30
  export declare const planLimitKey: z.ZodEnum<{
31
31
  apps: "apps";
32
- seats: "seats";
33
32
  robots: "robots";
33
+ seats: "seats";
34
34
  app_users: "app_users";
35
35
  live_video_ms_per_month: "live_video_ms_per_month";
36
36
  asset_bytes_per_robot: "asset_bytes_per_robot";
@@ -135,8 +135,8 @@ export type PlanCatalogueEntry = z.infer<typeof planCatalogueEntry>;
135
135
  */
136
136
  export declare const addonKey: z.ZodEnum<{
137
137
  apps: "apps";
138
- seats: "seats";
139
138
  robots: "robots";
139
+ seats: "seats";
140
140
  app_user_packs: "app_user_packs";
141
141
  live_video_packs: "live_video_packs";
142
142
  }>;
@@ -144,15 +144,15 @@ export type AddonKey = z.infer<typeof addonKey>;
144
144
  export declare const addonCatalogueEntry: z.ZodObject<{
145
145
  key: z.ZodEnum<{
146
146
  apps: "apps";
147
- seats: "seats";
148
147
  robots: "robots";
148
+ seats: "seats";
149
149
  app_user_packs: "app_user_packs";
150
150
  live_video_packs: "live_video_packs";
151
151
  }>;
152
152
  raises: z.ZodEnum<{
153
153
  apps: "apps";
154
- seats: "seats";
155
154
  robots: "robots";
155
+ seats: "seats";
156
156
  app_users: "app_users";
157
157
  live_video_ms_per_month: "live_video_ms_per_month";
158
158
  asset_bytes_per_robot: "asset_bytes_per_robot";
@@ -574,8 +574,8 @@ export type PlanChangeDecisionStatusResponse = z.infer<typeof planChangeDecision
574
574
  */
575
575
  export declare const planOverrides: z.ZodObject<{
576
576
  apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
577
- seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
578
577
  robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
578
+ seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
579
579
  app_users: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
580
580
  live_video_ms_per_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
581
581
  asset_bytes_per_robot: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -609,8 +609,8 @@ export declare const adminPlanChangeRequest: z.ZodObject<{
609
609
  }, z.core.$strict>>;
610
610
  overrides: z.ZodOptional<z.ZodObject<{
611
611
  apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
612
- seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
613
612
  robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
613
+ seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
614
614
  app_users: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
615
615
  live_video_ms_per_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
616
616
  asset_bytes_per_robot: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -424,6 +424,7 @@ export declare const cloudConfig: z.ZodObject<{
424
424
  name: z.ZodOptional<z.ZodString>;
425
425
  enabled: z.ZodOptional<z.ZodBoolean>;
426
426
  }, z.core.$strict>>>;
427
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
427
428
  }, z.core.$strict>>>;
428
429
  actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
429
430
  ros_name: z.ZodString;
@@ -455,6 +456,7 @@ export declare const cloudConfig: z.ZodObject<{
455
456
  description: z.ZodOptional<z.ZodString>;
456
457
  }, z.core.$strict>>>;
457
458
  description: z.ZodOptional<z.ZodString>;
459
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
458
460
  }, z.core.$strict>>>;
459
461
  services: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
460
462
  ros_name: z.ZodString;
@@ -486,6 +488,7 @@ export declare const cloudConfig: z.ZodObject<{
486
488
  description: z.ZodOptional<z.ZodString>;
487
489
  }, z.core.$strict>>>;
488
490
  description: z.ZodOptional<z.ZodString>;
491
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
489
492
  }, z.core.$strict>>>;
490
493
  publishers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
491
494
  topic: z.ZodString;
@@ -522,6 +525,7 @@ export declare const cloudConfig: z.ZodObject<{
522
525
  }, z.core.$strict>;
523
526
  quiet_timeout_ms: z.ZodNumber;
524
527
  description: z.ZodOptional<z.ZodString>;
528
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
525
529
  }, z.core.$strict>>>;
526
530
  cameras: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
527
531
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -556,12 +560,26 @@ export declare const cloudConfig: z.ZodObject<{
556
560
  bitrate_kbps: z.ZodNumber;
557
561
  snapshot_interval_seconds: z.ZodNumber;
558
562
  description: z.ZodOptional<z.ZodString>;
563
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
559
564
  }, z.core.$strict>>>;
565
+ access: z.ZodOptional<z.ZodObject<{
566
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
567
+ match: z.ZodString;
568
+ kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
569
+ read: "read";
570
+ invoke: "invoke";
571
+ publish: "publish";
572
+ }>>>;
573
+ role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
574
+ }, z.core.$strict>>>;
575
+ assets: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
576
+ job_history: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
577
+ }, z.core.$strict>>;
560
578
  low_bandwidth: z.ZodOptional<z.ZodObject<{
561
579
  mode: z.ZodOptional<z.ZodEnum<{
562
- off: "off";
563
580
  auto: "auto";
564
581
  on: "on";
582
+ off: "off";
565
583
  }>>;
566
584
  enter_lag_ms: z.ZodOptional<z.ZodNumber>;
567
585
  enter_after_s: z.ZodOptional<z.ZodNumber>;
@@ -39,7 +39,10 @@ export declare const authOk: z.ZodObject<{
39
39
  app_user_id: z.ZodNullable<z.ZodUUID>;
40
40
  server_key_id: z.ZodNullable<z.ZodUUID>;
41
41
  app_id: z.ZodNullable<z.ZodUUID>;
42
- role_id: z.ZodNullable<z.ZodUUID>;
42
+ role: z.ZodNullable<z.ZodObject<{
43
+ key: z.ZodString;
44
+ name: z.ZodString;
45
+ }, z.core.$strip>>;
43
46
  email: z.ZodNullable<z.ZodEmail>;
44
47
  two_factor_enabled: z.ZodNullable<z.ZodBoolean>;
45
48
  }, z.core.$strip>;
@@ -329,8 +332,8 @@ export declare const resourceHealthCleared: z.ZodObject<{
329
332
  }>;
330
333
  ref: z.ZodString;
331
334
  facet: z.ZodEnum<{
332
- source: "source";
333
335
  publish: "publish";
336
+ source: "source";
334
337
  }>;
335
338
  cleared_at_ms: z.ZodNumber;
336
339
  }, z.core.$strip>;
@@ -343,8 +346,8 @@ export declare const resourceHealthEvent: z.ZodObject<{
343
346
  }>;
344
347
  ref: z.ZodString;
345
348
  facet: z.ZodEnum<{
346
- source: "source";
347
349
  publish: "publish";
350
+ source: "source";
348
351
  }>;
349
352
  state: z.ZodEnum<{
350
353
  unknown: "unknown";
package/dist/realtime.js CHANGED
@@ -213,7 +213,7 @@ export const clientSubscribe = z.object({
213
213
  */
214
214
  /**
215
215
  * `publisher` is here even though a publisher is not subscribable: a client
216
- * that models the five grantable kinds and honestly names one gets the
216
+ * that models the five exposure kinds and honestly names one gets the
217
217
  * informative `not_subscribable` the cloud already computes, instead of a
218
218
  * `validation_error` reciting an enum. Refusing the *word* rather than the
219
219
  * request was the same mistake as the silent wrong-verb subscribe this
package/dist/rest.d.ts CHANGED
@@ -334,6 +334,7 @@ export declare const configDraftResponse: z.ZodObject<{
334
334
  name: z.ZodOptional<z.ZodString>;
335
335
  enabled: z.ZodOptional<z.ZodBoolean>;
336
336
  }, z.core.$strict>>>;
337
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
337
338
  }, z.core.$strict>>>;
338
339
  actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
339
340
  ros_name: z.ZodString;
@@ -365,6 +366,7 @@ export declare const configDraftResponse: z.ZodObject<{
365
366
  description: z.ZodOptional<z.ZodString>;
366
367
  }, z.core.$strict>>>;
367
368
  description: z.ZodOptional<z.ZodString>;
369
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
368
370
  }, z.core.$strict>>>;
369
371
  services: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
370
372
  ros_name: z.ZodString;
@@ -396,6 +398,7 @@ export declare const configDraftResponse: z.ZodObject<{
396
398
  description: z.ZodOptional<z.ZodString>;
397
399
  }, z.core.$strict>>>;
398
400
  description: z.ZodOptional<z.ZodString>;
401
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
399
402
  }, z.core.$strict>>>;
400
403
  publishers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
401
404
  topic: z.ZodString;
@@ -432,6 +435,7 @@ export declare const configDraftResponse: z.ZodObject<{
432
435
  }, z.core.$strict>;
433
436
  quiet_timeout_ms: z.ZodNumber;
434
437
  description: z.ZodOptional<z.ZodString>;
438
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
435
439
  }, z.core.$strict>>>;
436
440
  cameras: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
437
441
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -466,12 +470,26 @@ export declare const configDraftResponse: z.ZodObject<{
466
470
  bitrate_kbps: z.ZodNumber;
467
471
  snapshot_interval_seconds: z.ZodNumber;
468
472
  description: z.ZodOptional<z.ZodString>;
473
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
469
474
  }, z.core.$strict>>>;
475
+ access: z.ZodOptional<z.ZodObject<{
476
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
477
+ match: z.ZodString;
478
+ kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
479
+ read: "read";
480
+ invoke: "invoke";
481
+ publish: "publish";
482
+ }>>>;
483
+ role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
484
+ }, z.core.$strict>>>;
485
+ assets: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
486
+ job_history: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
487
+ }, z.core.$strict>>;
470
488
  low_bandwidth: z.ZodOptional<z.ZodObject<{
471
489
  mode: z.ZodOptional<z.ZodEnum<{
472
- off: "off";
473
490
  auto: "auto";
474
491
  on: "on";
492
+ off: "off";
475
493
  }>>;
476
494
  enter_lag_ms: z.ZodOptional<z.ZodNumber>;
477
495
  enter_after_s: z.ZodOptional<z.ZodNumber>;
@@ -530,6 +548,16 @@ export type PutConfigDraftRequest = z.infer<typeof putConfigDraftRequest>;
530
548
  export declare const publishConfigResponse: z.ZodObject<{
531
549
  version: z.ZodNumber;
532
550
  published_at: z.ZodISODateTime;
551
+ warnings: z.ZodArray<z.ZodObject<{
552
+ path: z.ZodString;
553
+ slug: z.ZodNullable<z.ZodString>;
554
+ code: z.ZodString;
555
+ message: z.ZodString;
556
+ severity: z.ZodEnum<{
557
+ error: "error";
558
+ warning: "warning";
559
+ }>;
560
+ }, z.core.$strip>>;
533
561
  }, z.core.$strip>;
534
562
  export type PublishConfigResponse = z.infer<typeof publishConfigResponse>;
535
563
  export declare const configVersionsResponse: z.ZodObject<{
@@ -600,6 +628,7 @@ export declare const configVersionResponse: z.ZodObject<{
600
628
  name: z.ZodOptional<z.ZodString>;
601
629
  enabled: z.ZodOptional<z.ZodBoolean>;
602
630
  }, z.core.$strict>>>;
631
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
603
632
  }, z.core.$strict>>>;
604
633
  actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
605
634
  ros_name: z.ZodString;
@@ -631,6 +660,7 @@ export declare const configVersionResponse: z.ZodObject<{
631
660
  description: z.ZodOptional<z.ZodString>;
632
661
  }, z.core.$strict>>>;
633
662
  description: z.ZodOptional<z.ZodString>;
663
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
634
664
  }, z.core.$strict>>>;
635
665
  services: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
636
666
  ros_name: z.ZodString;
@@ -662,6 +692,7 @@ export declare const configVersionResponse: z.ZodObject<{
662
692
  description: z.ZodOptional<z.ZodString>;
663
693
  }, z.core.$strict>>>;
664
694
  description: z.ZodOptional<z.ZodString>;
695
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
665
696
  }, z.core.$strict>>>;
666
697
  publishers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
667
698
  topic: z.ZodString;
@@ -698,6 +729,7 @@ export declare const configVersionResponse: z.ZodObject<{
698
729
  }, z.core.$strict>;
699
730
  quiet_timeout_ms: z.ZodNumber;
700
731
  description: z.ZodOptional<z.ZodString>;
732
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
701
733
  }, z.core.$strict>>>;
702
734
  cameras: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
703
735
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -732,12 +764,26 @@ export declare const configVersionResponse: z.ZodObject<{
732
764
  bitrate_kbps: z.ZodNumber;
733
765
  snapshot_interval_seconds: z.ZodNumber;
734
766
  description: z.ZodOptional<z.ZodString>;
767
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
735
768
  }, z.core.$strict>>>;
769
+ access: z.ZodOptional<z.ZodObject<{
770
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
771
+ match: z.ZodString;
772
+ kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
773
+ read: "read";
774
+ invoke: "invoke";
775
+ publish: "publish";
776
+ }>>>;
777
+ role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
778
+ }, z.core.$strict>>>;
779
+ assets: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
780
+ job_history: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
781
+ }, z.core.$strict>>;
736
782
  low_bandwidth: z.ZodOptional<z.ZodObject<{
737
783
  mode: z.ZodOptional<z.ZodEnum<{
738
- off: "off";
739
784
  auto: "auto";
740
785
  on: "on";
786
+ off: "off";
741
787
  }>>;
742
788
  enter_lag_ms: z.ZodOptional<z.ZodNumber>;
743
789
  enter_after_s: z.ZodOptional<z.ZodNumber>;
@@ -1010,7 +1056,7 @@ export type ServiceCallResponse = z.infer<typeof serviceCallResponse>;
1010
1056
  * shapes.**
1011
1057
  *
1012
1058
  * One route serves both kinds, because a path segment naming the kind would
1013
- * demand a fact a role grant does not carry. **The slug's kind decides, and
1059
+ * demand a fact the rights model does not carry. **The slug's kind decides, and
1014
1060
  * nothing in the request does**: an *action* answers `202` with an
1015
1061
  * `invokeResponse` the moment the job exists, a *service* answers `200` with
1016
1062
  * a `serviceCallResponse` once the result is in. They differ only in what the
@@ -1207,11 +1253,12 @@ export declare const robotJobsResponse: z.ZodObject<{
1207
1253
  }, z.core.$strip>;
1208
1254
  export type RobotJobsResponse = z.infer<typeof robotJobsResponse>;
1209
1255
  /**
1210
- * Every slug of a robot that a role can be granted, **with its kind**.
1256
+ * Every slug of a robot that a role can be required to use or an app can lock,
1257
+ * **with its kind**.
1211
1258
  *
1212
- * A roles matrix built against the datapoint list alone cannot grant an
1213
- * action, a service or a publisher. One list that names every kind, with its
1214
- * kind, is what a matrix needs.
1259
+ * A rights view built against the datapoint list alone cannot show an action,
1260
+ * a service or a publisher. One list that names every kind, with its kind, is
1261
+ * what such a view needs.
1215
1262
  */
1216
1263
  export declare const exposure: z.ZodObject<{
1217
1264
  slug: z.ZodString;
@@ -1654,8 +1701,8 @@ export declare const resourceHealthState: z.ZodObject<{
1654
1701
  }>;
1655
1702
  ref: z.ZodString;
1656
1703
  facet: z.ZodEnum<{
1657
- source: "source";
1658
1704
  publish: "publish";
1705
+ source: "source";
1659
1706
  }>;
1660
1707
  state: z.ZodEnum<{
1661
1708
  unknown: "unknown";
@@ -1687,8 +1734,8 @@ export declare const resourceHealthListResponse: z.ZodObject<{
1687
1734
  }>;
1688
1735
  ref: z.ZodString;
1689
1736
  facet: z.ZodEnum<{
1690
- source: "source";
1691
1737
  publish: "publish";
1738
+ source: "source";
1692
1739
  }>;
1693
1740
  state: z.ZodEnum<{
1694
1741
  unknown: "unknown";
@@ -1816,11 +1863,12 @@ export declare const BRIDGE_LATENCY_RETENTION_DAYS = 7;
1816
1863
  * `GET /api/robots/:id/jobs/history`** — robot-scoped, one route for
1817
1864
  * developers and clients like every other robot-scoped read (`.../jobs`,
1818
1865
  * `.../assets`, `.../datapoints`), never a parallel `/api/client/…` twin. An
1819
- * end user reaches it only when their role's `capabilities.action_history`
1820
- * says so — otherwise `403 capability_required`, naming the capability — and
1821
- * sees only runs on slugs their role grants. On this route `?robot_id=` is
1822
- * not a filter: the path already names the robot, and a query naming a
1823
- * different one is refused rather than quietly answered about the path's.
1866
+ * end user reaches it only when their role satisfies the robot's
1867
+ * `job_history` requirement — otherwise `403 capability_required`, naming the
1868
+ * capability — and sees only runs on slugs their role may use. On this route
1869
+ * `?robot_id=` is not a filter: the path already names the robot, and a query
1870
+ * naming a different one is refused rather than quietly answered about the
1871
+ * path's.
1824
1872
  *
1825
1873
  * **It discloses the actor, and that is what a developer weighs before
1826
1874
  * granting the capability.** A `jobRun` names who invoked it — `jobActor`
@@ -2086,20 +2134,21 @@ export declare const patchRobotRequest: z.ZodObject<{
2086
2134
  export type PatchRobotRequest = z.infer<typeof patchRobotRequest>;
2087
2135
  /**
2088
2136
  * `POST /api/robots/:id/config/rename-slug` — atomic server-side rename:
2089
- * rewrites the **draft** config and every app-role grant carrying
2137
+ * rewrites the **draft** config and every app lock naming
2090
2138
  * `{robot_id, from}`, and moves the recorded history with the name, in one
2091
2139
  * transaction, without rewriting stored samples. Job runs and audit events
2092
2140
  * keep the old slug as historical fact. The published config is immutable,
2093
2141
  * so the caller must publish afterwards (`requires_publish`); samples the
2094
2142
  * robot sends under the old slug between the rename and the publish join the
2095
2143
  * renamed history.
2096
- * One residual remains in that same window: grants and the draft already name
2097
- * `to`, but the still-published config exposes only `from` until the
2098
- * publish lands — an end user's app has no working name for the datapoint
2099
- * at all for however long that gap lasts, since `to` isn't published yet
2100
- * and `from` no longer has a grant behind it. The console must publish
2101
- * immediately after a rename to keep this window short; nothing server-side
2102
- * closes it.
2144
+ *
2145
+ * **Locks follow the rename, and keep the old name.** A lock that lists
2146
+ * `from` lists `to` as well afterwards: until the publish lands, the
2147
+ * published config still exposes only `from`, and dropping it from the lock
2148
+ * would open the capability in that gap. Once the publish has landed, the old
2149
+ * name is an `unknown_lock_slug` warning in the app's access and is removed
2150
+ * with its next `PUT`. A rename that would push a lock past the most slugs
2151
+ * one lock can hold is refused and writes nothing.
2103
2152
  * This schema only enforces slug *shape*; whether `to` is reserved or
2104
2153
  * already in use on this robot is checked once, behind the cloud's
2105
2154
  * `validation.ts` door — one door, not a second copy of that rule here.
@@ -2110,7 +2159,7 @@ export declare const renameSlugRequest: z.ZodObject<{
2110
2159
  }, z.core.$strict>;
2111
2160
  export type RenameSlugRequest = z.infer<typeof renameSlugRequest>;
2112
2161
  export declare const renameSlugResponse: z.ZodObject<{
2113
- rewritten_grants: z.ZodNumber;
2162
+ rewritten_locks: z.ZodNumber;
2114
2163
  history_moved: z.ZodBoolean;
2115
2164
  requires_publish: z.ZodLiteral<true>;
2116
2165
  }, z.core.$strip>;
@@ -2119,13 +2168,15 @@ export type RenameSlugResponse = z.infer<typeof renameSlugResponse>;
2119
2168
  * `GET /api/robots/:id/config/slug-usage/:slug` — what a rename would touch;
2120
2169
  * feeds the console's confirm dialog.
2121
2170
  *
2122
- * `alert_count` is part of the atomic rename transaction alongside grants and
2171
+ * `alert_count` is part of the atomic rename transaction alongside locks and
2123
2172
  * history: alerts are keyed by `(robot_id, slug)` too, and a rename that
2124
2173
  * silently moved the alert row while the usage preview stayed silent about it
2125
2174
  * would show a developer a smaller blast radius than the rename actually has.
2175
+ * `lock_count` is the same promise for the locks: it counts every lock the
2176
+ * rename would rewrite.
2126
2177
  */
2127
2178
  export declare const slugUsageResponse: z.ZodObject<{
2128
- grant_count: z.ZodNumber;
2179
+ lock_count: z.ZodNumber;
2129
2180
  app_identifiers: z.ZodArray<z.ZodString>;
2130
2181
  has_recorded_history: z.ZodBoolean;
2131
2182
  alert_count: z.ZodNumber;