@fleetless/contracts 13.3.0 → 15.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 (182) hide show
  1. package/CHANGELOG.md +304 -0
  2. package/artifacts/openapi.json +20156 -10513
  3. package/artifacts/routes.json +1429 -292
  4. package/artifacts/schema/access-warning.schema.json +51 -0
  5. package/artifacts/schema/action-config.schema.json +35 -0
  6. package/artifacts/schema/addon-catalogue-entry.schema.json +3 -1
  7. package/artifacts/schema/admin-plan-change-request.schema.json +26 -0
  8. package/artifacts/schema/app-access-response.schema.json +136 -0
  9. package/artifacts/schema/app-access.schema.json +80 -0
  10. package/artifacts/schema/app-deletion-summary.schema.json +15 -8
  11. package/artifacts/schema/app-invitation-list-response.schema.json +13 -6
  12. package/artifacts/schema/app-invitation.schema.json +5 -5
  13. package/artifacts/schema/app-list-response.schema.json +6 -6
  14. package/artifacts/schema/app-lock.schema.json +30 -0
  15. package/artifacts/schema/app-user-list-response.schema.json +13 -6
  16. package/artifacts/schema/app-user.schema.json +13 -6
  17. package/artifacts/schema/app.schema.json +6 -6
  18. package/artifacts/schema/asset-plan-limit-details.schema.json +3 -1
  19. package/artifacts/schema/auth-ok.schema.json +20 -6
  20. package/artifacts/schema/camera-list-response.schema.json +1 -1
  21. package/artifacts/schema/client-identity.schema.json +21 -6
  22. package/artifacts/schema/cloud-config.schema.json +359 -5
  23. package/artifacts/schema/collection-actor.schema.json +35 -0
  24. package/artifacts/schema/collection-definitions-response.schema.json +612 -0
  25. package/artifacts/schema/collection-event.schema.json +216 -0
  26. package/artifacts/schema/collection-export-query.schema.json +56 -0
  27. package/artifacts/schema/collection-filter.schema.json +9 -0
  28. package/artifacts/schema/collection-import-preview.schema.json +143 -0
  29. package/artifacts/schema/collection-import-request.schema.json +105 -0
  30. package/artifacts/schema/collection-import-result.schema.json +38 -0
  31. package/artifacts/schema/collection-list-response.schema.json +119 -0
  32. package/artifacts/schema/collection-record-get-query.schema.json +12 -0
  33. package/artifacts/schema/collection-record-history-query.schema.json +35 -0
  34. package/artifacts/schema/collection-record-history-response.schema.json +389 -0
  35. package/artifacts/schema/collection-record-list-query.schema.json +67 -0
  36. package/artifacts/schema/collection-record-list-response.schema.json +212 -0
  37. package/artifacts/schema/collection-record-restore-request.schema.json +14 -0
  38. package/artifacts/schema/collection-record-write.schema.json +31 -0
  39. package/artifacts/schema/collection-record.schema.json +180 -0
  40. package/artifacts/schema/collection-revision.schema.json +295 -0
  41. package/artifacts/schema/collection-subscribe-error.schema.json +31 -0
  42. package/artifacts/schema/collection-subscribe.schema.json +48 -0
  43. package/artifacts/schema/collection-subscribed.schema.json +22 -0
  44. package/artifacts/schema/collection-summary.schema.json +92 -0
  45. package/artifacts/schema/collection-unsubscribe.schema.json +22 -0
  46. package/artifacts/schema/collections-access-change.schema.json +34 -0
  47. package/artifacts/schema/collections-document.schema.json +732 -0
  48. package/artifacts/schema/collections-draft-response.schema.json +845 -0
  49. package/artifacts/schema/collections-effect.schema.json +384 -0
  50. package/artifacts/schema/collections-issue.schema.json +36 -0
  51. package/artifacts/schema/collections-publish-request.schema.json +18 -0
  52. package/artifacts/schema/collections-publish-response.schema.json +450 -0
  53. package/artifacts/schema/collections-purge-preview.schema.json +60 -0
  54. package/artifacts/schema/collections-purge-request.schema.json +27 -0
  55. package/artifacts/schema/collections-purge-response.schema.json +30 -0
  56. package/artifacts/schema/collections-restore-preview-query.schema.json +20 -0
  57. package/artifacts/schema/collections-restore-preview.schema.json +581 -0
  58. package/artifacts/schema/collections-restore-request.schema.json +27 -0
  59. package/artifacts/schema/collections-restore-response.schema.json +455 -0
  60. package/artifacts/schema/collections-schema-preview.schema.json +519 -0
  61. package/artifacts/schema/collections-schema-published.schema.json +22 -0
  62. package/artifacts/schema/collections-version-response.schema.json +869 -0
  63. package/artifacts/schema/collections-version-summary.schema.json +139 -0
  64. package/artifacts/schema/collections-versions-response.schema.json +167 -0
  65. package/artifacts/schema/config-draft-response.schema.json +359 -5
  66. package/artifacts/schema/config-version-response.schema.json +359 -5
  67. package/artifacts/schema/confirmation-required-details.schema.json +13 -0
  68. package/artifacts/schema/create-app-invitation-request.schema.json +4 -4
  69. package/artifacts/schema/create-app-user-request.schema.json +4 -4
  70. package/artifacts/schema/create-org-role-request.schema.json +33 -0
  71. package/artifacts/schema/dangling-reference.schema.json +130 -0
  72. package/artifacts/schema/datapoint-config.schema.json +35 -0
  73. package/artifacts/schema/datapoint-list-response.schema.json +2 -2
  74. package/artifacts/schema/effective-capability.schema.json +104 -0
  75. package/artifacts/schema/effective-rights-query.schema.json +19 -0
  76. package/artifacts/schema/effective-rights-response.schema.json +396 -0
  77. package/artifacts/schema/effective-robot-rights.schema.json +266 -0
  78. package/artifacts/schema/invoke-or-service-response.schema.json +1 -1
  79. package/artifacts/schema/invoke-response.schema.json +1 -1
  80. package/artifacts/schema/journal-intent-v2-body.schema.json +74 -0
  81. package/artifacts/schema/journal-intent-v2.schema.json +84 -0
  82. package/artifacts/schema/journal-replay-receipt-body.schema.json +1 -0
  83. package/artifacts/schema/journal-replay-receipt.schema.json +1 -0
  84. package/artifacts/schema/mcp-robot-datasheet.schema.json +2 -2
  85. package/artifacts/schema/org-plan.schema.json +29 -1
  86. package/artifacts/schema/org-quota-usage-counts.schema.json +18 -0
  87. package/artifacts/schema/org-quota-usage.schema.json +47 -1
  88. package/artifacts/schema/org-quotas.schema.json +29 -1
  89. package/artifacts/schema/org-role-list-response.schema.json +206 -0
  90. package/artifacts/schema/org-role.schema.json +59 -0
  91. package/artifacts/schema/patch-app-user-request.schema.json +4 -4
  92. package/artifacts/schema/patch-org-role-request.schema.json +38 -0
  93. package/artifacts/schema/plan-catalogue-entry.schema.json +29 -1
  94. package/artifacts/schema/plan-change-decision-status-response.schema.json +29 -1
  95. package/artifacts/schema/plan-limit-details.schema.json +3 -1
  96. package/artifacts/schema/plan-limits.schema.json +29 -1
  97. package/artifacts/schema/plan-overrides.schema.json +26 -0
  98. package/artifacts/schema/publish-config-response.schema.json +48 -1
  99. package/artifacts/schema/publisher-config.schema.json +35 -0
  100. package/artifacts/schema/put-collections-draft-request.schema.json +16 -0
  101. package/artifacts/schema/put-role-defaults-request.schema.json +127 -0
  102. package/artifacts/schema/record-changed-details.schema.json +16 -0
  103. package/artifacts/schema/record-referenced-details.schema.json +35 -0
  104. package/artifacts/schema/reference-invalid-details.schema.json +25 -0
  105. package/artifacts/schema/reference-place.schema.json +112 -0
  106. package/artifacts/schema/rename-slug-response.schema.json +4 -3
  107. package/artifacts/schema/required-missing-details.schema.json +19 -0
  108. package/artifacts/schema/robot-config-doc.schema.json +359 -5
  109. package/artifacts/schema/robot-deletion-summary.schema.json +33 -1
  110. package/artifacts/schema/role-collection-rights.schema.json +82 -0
  111. package/artifacts/schema/role-cycle-details.schema.json +18 -0
  112. package/artifacts/schema/role-defaults-response.schema.json +59 -0
  113. package/artifacts/schema/role-rename-preview.schema.json +147 -0
  114. package/artifacts/schema/service-config.schema.json +35 -0
  115. package/artifacts/schema/slug-usage-response.schema.json +4 -3
  116. package/artifacts/schema/update-app-request.schema.json +0 -12
  117. package/dist/app-users.d.ts +11 -8
  118. package/dist/app-users.js +18 -10
  119. package/dist/apps.d.ts +258 -71
  120. package/dist/apps.js +215 -151
  121. package/dist/audit.d.ts +35 -5
  122. package/dist/audit.js +40 -2
  123. package/dist/billing.d.ts +10 -10
  124. package/dist/client-auth.d.ts +5 -2
  125. package/dist/client-auth.js +11 -3
  126. package/dist/client-robots.d.ts +1 -1
  127. package/dist/client-robots.js +1 -1
  128. package/dist/collections-issues.d.ts +67 -0
  129. package/dist/collections-issues.js +340 -0
  130. package/dist/collections-records.d.ts +562 -0
  131. package/dist/collections-records.js +525 -0
  132. package/dist/collections-rights.d.ts +17 -0
  133. package/dist/collections-rights.js +41 -0
  134. package/dist/collections-schema.d.ts +1064 -0
  135. package/dist/collections-schema.js +386 -0
  136. package/dist/collections-templates.d.ts +55 -0
  137. package/dist/collections-templates.js +137 -0
  138. package/dist/collections-transfer.d.ts +101 -0
  139. package/dist/collections-transfer.js +206 -0
  140. package/dist/collections-values.d.ts +67 -0
  141. package/dist/collections-values.js +284 -0
  142. package/dist/collections.d.ts +568 -0
  143. package/dist/collections.js +332 -0
  144. package/dist/common.d.ts +1 -1
  145. package/dist/common.js +1 -1
  146. package/dist/config-issues.d.ts +1 -1
  147. package/dist/config-issues.js +1 -1
  148. package/dist/config.d.ts +78 -12
  149. package/dist/config.js +109 -15
  150. package/dist/errors.d.ts +63 -5
  151. package/dist/errors.js +152 -24
  152. package/dist/index.d.ts +40 -14
  153. package/dist/index.js +27 -7
  154. package/dist/journal-intents.d.ts +30 -0
  155. package/dist/journal-intents.js +3 -0
  156. package/dist/legal-acceptances.d.ts +2 -2
  157. package/dist/mcp.d.ts +5 -37
  158. package/dist/mcp.js +4 -14
  159. package/dist/org-roles.d.ts +186 -0
  160. package/dist/org-roles.js +199 -0
  161. package/dist/plans.d.ts +25 -7
  162. package/dist/plans.js +21 -1
  163. package/dist/protocol.d.ts +19 -1
  164. package/dist/realtime.d.ts +172 -3
  165. package/dist/realtime.js +164 -1
  166. package/dist/rest.d.ts +104 -53
  167. package/dist/rest.js +79 -55
  168. package/dist/rights.d.ts +197 -0
  169. package/dist/rights.js +396 -0
  170. package/dist/routes.d.ts +1 -1
  171. package/dist/routes.js +675 -150
  172. package/package.json +1 -1
  173. package/artifacts/schema/mcp-role-preview-response.schema.json +0 -134
  174. package/artifacts/schema/put-robot-details-request.schema.json +0 -41
  175. package/artifacts/schema/put-robot-details-response.schema.json +0 -43
  176. package/artifacts/schema/robot-details-doc.schema.json +0 -33
  177. package/artifacts/schema/role-delete-query.schema.json +0 -13
  178. package/artifacts/schema/role-in-use-details.schema.json +0 -28
  179. package/artifacts/schema/role-list-response.schema.json +0 -48
  180. package/artifacts/schema/role-permissions.schema.json +0 -61
  181. package/artifacts/schema/role-rename-request.schema.json +0 -16
  182. package/artifacts/schema/role.schema.json +0 -35
package/dist/realtime.js CHANGED
@@ -5,6 +5,8 @@ import { MAX_PATIENCE_MS, MIN_PATIENCE_MS } from './protocol.js';
5
5
  import { slug } from './common.js';
6
6
  import { clientIdentity } from './client-auth.js';
7
7
  import { job } from './jobs.js';
8
+ import { collectionKey } from './collections.js';
9
+ import { collectionFilter, collectionRecord } from './collections-records.js';
8
10
  /**
9
11
  * Client realtime protocol: WebSocket subscriptions on datapoints, the
10
12
  * datapoint event stream, and full command parity with REST.
@@ -213,7 +215,7 @@ export const clientSubscribe = z.object({
213
215
  */
214
216
  /**
215
217
  * `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
218
+ * that models the five exposure kinds and honestly names one gets the
217
219
  * informative `not_subscribable` the cloud already computes, instead of a
218
220
  * `validation_error` reciting an enum. Refusing the *word* rather than the
219
221
  * request was the same mistake as the silent wrong-verb subscribe this
@@ -490,3 +492,164 @@ export const orgEventDropped = z
490
492
  dropped: z.number().int().positive(),
491
493
  })
492
494
  .strict();
495
+ // ---------------------------------------------------------------------------
496
+ // App collections
497
+ // ---------------------------------------------------------------------------
498
+ /**
499
+ * The name a client gives one of its collection subscriptions. Every event and
500
+ * every refusal of that subscription carries it back, so one socket can hold
501
+ * several subscriptions, to the same collection with different filters
502
+ * included, and tell their events apart.
503
+ */
504
+ const collectionRequestId = z.string().min(1).max(64).meta({
505
+ description: 'Chosen by the client, unique among the collection subscriptions open on this socket: a `request_id` that is already in use is refused with `validation_error`. Every frame about the subscription carries it.',
506
+ });
507
+ /**
508
+ * Subscribe to the changes of one collection's records.
509
+ *
510
+ * **The cloud answers with `collection_subscribed` once the subscription is
511
+ * registered, and with `collection_subscribe_error` when it is refused. There
512
+ * is no first snapshot.** To show the records that exist, subscribe, wait for
513
+ * `collection_subscribed` and list then: from that frame on every change the
514
+ * subscription covers is delivered as an event, so none can fall between the
515
+ * list and the events. An event that arrives while the list is still being
516
+ * read may or may not be in its result; apply it to the result by `id` and
517
+ * `revision`. A subscription is registered afresh on every connection, so a
518
+ * client that reconnects and subscribes again gets a new `collection_subscribed`
519
+ * and lists again; changes made while it was disconnected are not replayed.
520
+ *
521
+ * The caller's rights are checked on every event, not only on subscribe: a
522
+ * record that the caller may no longer see, because its values changed, the
523
+ * role lost the right or the robot was detached, is announced once as
524
+ * `removed`, and one that comes into view as `entered`.
525
+ *
526
+ * **When a subscription is judged.** At the frame, with the role and status an
527
+ * app user has then and not as at `auth`: a user who was re-roled is answered
528
+ * for the new role (`collection_not_found` when it has no right on the
529
+ * collection, `forbidden` when it may not read it), and one who was blocked or
530
+ * removed is answered `forbidden` and stays unsubscribed. A frame sent before
531
+ * `auth` is answered with `collection_subscribe_error` and code `unauthorized`;
532
+ * the socket stays open. A socket holds at most 50 subscriptions.
533
+ */
534
+ export const collectionSubscribe = z
535
+ .object({
536
+ type: z.literal('collection_subscribe'),
537
+ request_id: collectionRequestId,
538
+ app_id: z
539
+ .uuid()
540
+ .meta({
541
+ description: 'The app whose collection to follow. Required on the connection of a developer, whose token belongs to the organization and so to no app: without it the subscribe is refused with `validation_error`. On the connection of an app user or a server key it can be left out, because the token names the app; if it is sent, it must be that app, otherwise `validation_error`. An app that does not exist or belongs to another organization is answered `collection_not_found`.',
542
+ })
543
+ .optional(),
544
+ collection: collectionKey.meta({ description: 'The key of the collection.' }),
545
+ robot_id: z.uuid().meta({ description: 'Only the records of this robot, in a collection that belongs to robots.' }).optional(),
546
+ filter: collectionFilter
547
+ .meta({
548
+ description: 'Only records matching this filter are delivered, with the grammar of the `filter` of the record list but as an object, not JSON text. The whole frame is at most 16,384 bytes; a larger frame closes the socket with code 1009 (message too big) instead of being answered, so a filter with many long values may not fit.',
549
+ })
550
+ .optional(),
551
+ })
552
+ .strict()
553
+ .meta({
554
+ description: 'Subscribes to the changes of the records of one collection. The cloud answers an accepted subscription with `collection_subscribed` and a refused one with `collection_subscribe_error`.',
555
+ });
556
+ /**
557
+ * A collection subscription is registered. Sent once for every
558
+ * `collection_subscribe` that is accepted, after the cloud has judged it (the
559
+ * collection exists, the caller may read it, the robot and the filter fit) and
560
+ * registered it, and before the first `collection_event` of that
561
+ * subscription: a client that lists the records now misses no change, because
562
+ * every change from this frame on reaches it as an event.
563
+ *
564
+ * The frame is sent again for every subscribe, so a client that reconnects and
565
+ * subscribes again receives it again. It does not say that anything exists or
566
+ * changed; it carries only the `request_id`.
567
+ */
568
+ export const collectionSubscribed = z
569
+ .object({
570
+ type: z.literal('collection_subscribed'),
571
+ request_id: collectionRequestId.meta({ description: 'The `request_id` of the subscription that is now registered.' }),
572
+ })
573
+ .strict()
574
+ .meta({ description: 'A collection subscription is registered: every change it covers is delivered from now on.' });
575
+ export const collectionUnsubscribe = z
576
+ .object({
577
+ type: z.literal('collection_unsubscribe'),
578
+ request_id: collectionRequestId.meta({ description: 'The `request_id` of the subscription to end.' }),
579
+ })
580
+ .strict()
581
+ .meta({ description: 'Ends a collection subscription.' });
582
+ /**
583
+ * One change to a record the subscriber can see. `record` is the whole record,
584
+ * up to 1 MB, in the shape the REST routes answer.
585
+ *
586
+ * **A client that cannot keep up is disconnected, not skipped.** A socket whose
587
+ * send buffer holds more than 8 MiB, or that has more than 2,000 collection
588
+ * changes waiting to be delivered (a bulk import into a big collection does
589
+ * that), is closed with code 1013 ("try again later"). The client reconnects,
590
+ * subscribes again and lists again.
591
+ */
592
+ export const collectionEvent = z
593
+ .object({
594
+ type: z.literal('collection_event'),
595
+ request_id: collectionRequestId.meta({ description: 'The `request_id` of the subscription the event belongs to.' }),
596
+ event: z.enum(['created', 'updated', 'deleted', 'removed', 'entered']).meta({
597
+ description: '`created`, `updated` and `deleted`: the record was written. `removed`: the record left the view of this subscription without being deleted, because its values no longer match the filter, the role lost the right to read it or its robot was detached. `entered`: the record came into view the same way.',
598
+ }),
599
+ id: z.uuid().meta({ description: 'The id of the record.' }),
600
+ record: collectionRecord
601
+ .meta({
602
+ description: 'The record: as it is now for `created`, `updated`, `entered` and `removed`, and as it was for `deleted`. Absent only on a `removed` event for a record the subscriber may no longer read, so that its values are not told: that is the case when the robot of the record was detached, or when the role lost the right to read the collection.',
603
+ })
604
+ .optional(),
605
+ })
606
+ .strict()
607
+ .meta({ description: 'A record came into view, changed or went away.' });
608
+ /**
609
+ * Refusal of a collection subscription, or the end of one. The codes are those
610
+ * of REST: `collection_not_found`, `forbidden`, `robot_not_attached` and
611
+ * `validation_error` when the subscribe is refused; `collection_removed`,
612
+ * `forbidden`, `robot_not_attached`, `validation_error` and `internal_error`
613
+ * when a running subscription ends:
614
+ *
615
+ * - `collection_removed`: a publish or restore removed its collection;
616
+ * - `forbidden`: the user was re-roled, blocked or removed, or the role lost the
617
+ * right to read the collection;
618
+ * - `robot_not_attached`: the robot the subscription follows was detached, or a
619
+ * robot with more than 5,000 records was detached (when a robot is attached
620
+ * or detached, at most 5,000 of its records are announced to a subscription,
621
+ * as `entered` or `removed`);
622
+ * - `validation_error`: its `filter` no longer fits the collection after a
623
+ * publish;
624
+ * - `internal_error`: it could not be judged again (the database or the rights
625
+ * check failed), or a robot coming or going could not be announced. The cloud
626
+ * ends the subscription rather than go on telling a caller what it may no
627
+ * longer see; subscribing again is the way back.
628
+ *
629
+ * `request_id` echoes what the client sent and is a plain string for the reason
630
+ * `subscribeError`'s ids are: the refusal must be constructible when the id
631
+ * itself was what was wrong.
632
+ */
633
+ export const collectionSubscribeError = z
634
+ .object({
635
+ type: z.literal('collection_subscribe_error'),
636
+ request_id: z.string().meta({ description: 'The `request_id` of the subscription, as the client sent it.' }),
637
+ code: z.string().min(1).meta({ description: 'A stable error code, as in REST; `unauthorized` is also possible here, for a subscribe sent before `auth`.' }),
638
+ message: z.string().min(1),
639
+ })
640
+ .strict()
641
+ .meta({ description: 'A collection subscription was refused or has ended.' });
642
+ /**
643
+ * Sent to every socket that holds a collection subscription in the app after a
644
+ * schema version was published or restored. Rights and collections may have
645
+ * changed, so a client that cached definitions reads them again. Subscriptions
646
+ * whose collection or right is gone end with their own
647
+ * `collection_subscribe_error`.
648
+ */
649
+ export const collectionsSchemaPublished = z
650
+ .object({
651
+ type: z.literal('collections_schema_published'),
652
+ version: z.number().int().min(1).meta({ description: 'The version that is in force now.' }),
653
+ })
654
+ .strict()
655
+ .meta({ description: 'A new schema version is in force for the app.' });
package/dist/rest.d.ts CHANGED
@@ -77,19 +77,19 @@ export type JointStatePutResponse = z.infer<typeof jointStatePutResponse>;
77
77
  * same call for the same reason: fold cameras in and the sentence "this deletes
78
78
  * N slugs and M cameras" counts them twice. A list row has the same problem.
79
79
  *
80
- * **Counted from the published configuration, and excluding the built-ins.**
80
+ * **Counted from the published configuration, and excluding the built-in datapoint.**
81
81
  * `GET /api/robots/:id/exposures` answers *which* slugs and prepends the
82
- * built-in datapoints — `bridge_state` and `robot_details` — as
83
- * `builtin: true`; this answers *how many* and counts only what somebody
84
- * configured. So a robot with an empty published config reports
85
- * `datapoints: 0` here and two entries there. That is intentional, and it is
86
- * written on both sides so the disagreement is never mistaken for a bug.
87
- *
88
- * The number was "three" while `bridge_pressure` existed and is "two" since
89
- * protocol 3 dropped it; the cloud builds that prefix from its own built-in
90
- * set rather than a literal, so the next built-in moves this count again.
91
- * Read the count off that set, not off this sentence, before filing the bug
92
- * this comment exists to prevent.
82
+ * built-in datapoint, `bridge_state`, as `builtin: true`; this answers *how
83
+ * many* and counts only what somebody configured. So a robot with an empty
84
+ * published config reports `datapoints: 0` here and one entry there. That is
85
+ * intentional, and it is written on both sides so the disagreement is never
86
+ * mistaken for a bug.
87
+ *
88
+ * The number was "three" while `bridge_pressure` existed and has only gone
89
+ * down since; the cloud builds that prefix from its own built-in set rather
90
+ * than a literal, so the next built-in moves this count again. Read the count
91
+ * off that set, not off this sentence, before filing the bug this comment
92
+ * exists to prevent.
93
93
  */
94
94
  export declare const exposureCounts: z.ZodObject<{
95
95
  datapoints: z.ZodNumber;
@@ -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>;
@@ -824,7 +870,7 @@ export declare const fetchTypesResponse: z.ZodObject<{
824
870
  }, z.core.$strip>;
825
871
  export type FetchTypesResponse = z.infer<typeof fetchTypesResponse>;
826
872
  /**
827
- * What a client can read on this robot: the built-ins plus everything the
873
+ * What a client can read on this robot: the built-in plus everything the
828
874
  * published configuration exposes. This is the seed of the generated
829
875
  * per-robot API.
830
876
  *
@@ -848,21 +894,6 @@ export declare const datapointListResponse: z.ZodObject<{
848
894
  }, z.core.$strip>>;
849
895
  }, z.core.$strip>;
850
896
  export type DatapointListResponse = z.infer<typeof datapointListResponse>;
851
- /**
852
- * The built-in `robot_details` datapoint: static properties the developer
853
- * maintains. Bounded so one robot cannot become a document store.
854
- */
855
- export declare const robotDetailsDoc: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
856
- export type RobotDetailsDoc = z.infer<typeof robotDetailsDoc>;
857
- /** What `PUT /api/robots/:id/details` answers: the stored document, which is the one that was sent. */
858
- export declare const putRobotDetailsResponse: z.ZodObject<{
859
- details: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
860
- }, z.core.$strip>;
861
- export type PutRobotDetailsResponse = z.infer<typeof putRobotDetailsResponse>;
862
- export declare const putRobotDetailsRequest: z.ZodObject<{
863
- details: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
864
- }, z.core.$strip>;
865
- export type PutRobotDetailsRequest = z.infer<typeof putRobotDetailsRequest>;
866
897
  /**
867
898
  * Invoke an action or call a service; parameters by field path.
868
899
  *
@@ -1010,7 +1041,7 @@ export type ServiceCallResponse = z.infer<typeof serviceCallResponse>;
1010
1041
  * shapes.**
1011
1042
  *
1012
1043
  * 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
1044
+ * demand a fact the rights model does not carry. **The slug's kind decides, and
1014
1045
  * nothing in the request does**: an *action* answers `202` with an
1015
1046
  * `invokeResponse` the moment the job exists, a *service* answers `200` with
1016
1047
  * a `serviceCallResponse` once the result is in. They differ only in what the
@@ -1207,11 +1238,12 @@ export declare const robotJobsResponse: z.ZodObject<{
1207
1238
  }, z.core.$strip>;
1208
1239
  export type RobotJobsResponse = z.infer<typeof robotJobsResponse>;
1209
1240
  /**
1210
- * Every slug of a robot that a role can be granted, **with its kind**.
1241
+ * Every slug of a robot that a role can be required to use or an app can lock,
1242
+ * **with its kind**.
1211
1243
  *
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.
1244
+ * A rights view built against the datapoint list alone cannot show an action,
1245
+ * a service or a publisher. One list that names every kind, with its kind, is
1246
+ * what such a view needs.
1215
1247
  */
1216
1248
  export declare const exposure: z.ZodObject<{
1217
1249
  slug: z.ZodString;
@@ -1592,6 +1624,11 @@ export declare const robotDeletionSummary: z.ZodObject<{
1592
1624
  job_run_count: z.ZodNumber;
1593
1625
  had_live_session: z.ZodBoolean;
1594
1626
  had_unpublished_draft: z.ZodBoolean;
1627
+ collection_records: z.ZodArray<z.ZodObject<{
1628
+ app_id: z.ZodUUID;
1629
+ app_name: z.ZodString;
1630
+ records: z.ZodNumber;
1631
+ }, z.core.$strip>>;
1595
1632
  }, z.core.$strip>;
1596
1633
  export type RobotDeletionSummary = z.infer<typeof robotDeletionSummary>;
1597
1634
  /**
@@ -1654,8 +1691,8 @@ export declare const resourceHealthState: z.ZodObject<{
1654
1691
  }>;
1655
1692
  ref: z.ZodString;
1656
1693
  facet: z.ZodEnum<{
1657
- source: "source";
1658
1694
  publish: "publish";
1695
+ source: "source";
1659
1696
  }>;
1660
1697
  state: z.ZodEnum<{
1661
1698
  unknown: "unknown";
@@ -1687,8 +1724,8 @@ export declare const resourceHealthListResponse: z.ZodObject<{
1687
1724
  }>;
1688
1725
  ref: z.ZodString;
1689
1726
  facet: z.ZodEnum<{
1690
- source: "source";
1691
1727
  publish: "publish";
1728
+ source: "source";
1692
1729
  }>;
1693
1730
  state: z.ZodEnum<{
1694
1731
  unknown: "unknown";
@@ -1728,6 +1765,8 @@ export declare const orgQuotas: z.ZodObject<{
1728
1765
  max_retention_bytes: z.ZodNumber;
1729
1766
  max_retention_writes_per_minute: z.ZodNumber;
1730
1767
  max_realtime_connections: z.ZodNumber;
1768
+ collection_records: z.ZodNullable<z.ZodNumber>;
1769
+ collection_bytes: z.ZodNullable<z.ZodNumber>;
1731
1770
  }, z.core.$strip>;
1732
1771
  export type OrgQuotas = z.infer<typeof orgQuotas>;
1733
1772
  /**
@@ -1752,6 +1791,9 @@ export declare const orgQuotaUsageCounts: z.ZodObject<{
1752
1791
  max_retention_bytes: z.ZodOptional<z.ZodNumber>;
1753
1792
  max_retention_writes_per_minute: z.ZodOptional<z.ZodNumber>;
1754
1793
  max_realtime_connections: z.ZodOptional<z.ZodNumber>;
1794
+ collection_records: z.ZodOptional<z.ZodNumber>;
1795
+ collection_bytes: z.ZodOptional<z.ZodNumber>;
1796
+ collection_history_bytes: z.ZodOptional<z.ZodNumber>;
1755
1797
  }, z.core.$strip>;
1756
1798
  export type OrgQuotaUsageCounts = z.infer<typeof orgQuotaUsageCounts>;
1757
1799
  /** Limits beside what is actually used — a limit alone tells nobody where they stand. */
@@ -1763,6 +1805,8 @@ export declare const orgQuotaUsage: z.ZodObject<{
1763
1805
  max_retention_bytes: z.ZodNumber;
1764
1806
  max_retention_writes_per_minute: z.ZodNumber;
1765
1807
  max_realtime_connections: z.ZodNumber;
1808
+ collection_records: z.ZodNullable<z.ZodNumber>;
1809
+ collection_bytes: z.ZodNullable<z.ZodNumber>;
1766
1810
  }, z.core.$strip>;
1767
1811
  usage: z.ZodObject<{
1768
1812
  max_robots: z.ZodOptional<z.ZodNumber>;
@@ -1771,6 +1815,9 @@ export declare const orgQuotaUsage: z.ZodObject<{
1771
1815
  max_retention_bytes: z.ZodOptional<z.ZodNumber>;
1772
1816
  max_retention_writes_per_minute: z.ZodOptional<z.ZodNumber>;
1773
1817
  max_realtime_connections: z.ZodOptional<z.ZodNumber>;
1818
+ collection_records: z.ZodOptional<z.ZodNumber>;
1819
+ collection_bytes: z.ZodOptional<z.ZodNumber>;
1820
+ collection_history_bytes: z.ZodOptional<z.ZodNumber>;
1774
1821
  }, z.core.$strip>;
1775
1822
  }, z.core.$strip>;
1776
1823
  export type OrgQuotaUsage = z.infer<typeof orgQuotaUsage>;
@@ -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;