@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
package/CHANGELOG.md CHANGED
@@ -9,6 +9,147 @@ version.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [14.0.0] — 2026-11-05
13
+
14
+ Per-app roles are replaced by organization roles. What follows is one major
15
+ release; every breaking item is named once, under Removed or Changed.
16
+
17
+ ### Removed
18
+
19
+ - **Breaking (major):** The per-app role routes: `POST` and `GET
20
+ /api/apps/:id/roles`, `PATCH` and `DELETE /api/apps/:id/roles/:roleId`,
21
+ `PUT` and `GET /api/apps/:id/roles/:roleId/permissions`, and `GET
22
+ /api/apps/:id/roles/:roleId/mcp-tools`. Roles belong to the organization
23
+ from here on. What a role may use is no longer a matrix kept per app: it is
24
+ written in each robot's `fleetless.yaml` (`role` on an entry, `access.rules`,
25
+ `access.assets` and `access.job_history`) and in the organization's defaults
26
+ (`PUT /api/org/roles/defaults`), and what an app takes away is its locks
27
+ (`PUT /api/apps/:id/access`). To carry a per-app role over, create an
28
+ organization role with the role's key, name the key where the matrix granted
29
+ access, and give the app's users and invitations that key.
30
+ - **Breaking (major):** The shapes of those routes, with their types and JSON
31
+ Schema artifacts: `role`, `roleListResponse`, `roleRenameRequest`,
32
+ `roleDeleteQuery`, `roleInUseDetails`, `rolePermissions` and
33
+ `mcpRolePreviewResponse`.
34
+ - **Breaking (major):** The error codes `role_name_taken`, `role_in_use` and
35
+ `last_role`.
36
+ - **Breaking (major):** `appDeletionSummary.role_count`. Deleting an app
37
+ deletes no role, so the preview counts five things, not six.
38
+
39
+ ### Changed
40
+
41
+ - **Breaking (major):** `clientIdentity.role_id` is replaced by `role`, an
42
+ object with the role's `key` and display `name`, or `null` when the caller
43
+ has no role to name (a developer, a server key, an app user whose key is no
44
+ role). It is part of the `GET /api/client/me` answer and of the realtime
45
+ `auth_ok` frame. A consumer that read `role_id` reads `role.key` now.
46
+ - **Breaking (major):** `mcpCapabilities.action_history` is renamed
47
+ `job_history`, without an alias. The capability names the same thing, the
48
+ past jobs of a robot (`GET /api/robots/:id/jobs/history`), and now matches
49
+ the `job_history` of the `fleetless.yaml` `access` section and of the
50
+ organization defaults. It travels in the `capabilities` of
51
+ `mcpRobotDatasheet` (`robots.describe` and `GET /api/robots/:id/datasheet`)
52
+ and is what `capability_required` names beside `assets`. A datasheet
53
+ without `job_history` no longer satisfies the schema, and a consumer that
54
+ read `action_history` reads `job_history` now.
55
+ - **Breaking (major):** `app.default_role_id` is replaced by `default_role`,
56
+ the role's key or `null` when the app has none, and `updateAppRequest` no
57
+ longer takes `default_role_id`: a patch that names it is refused. The default
58
+ role is set with `PUT /api/apps/:id/access`, together with the locks. A key
59
+ that names no role is shown as stored and warns. The `robot_ids`
60
+ description no longer says a role decides what an attached robot allows: that
61
+ follows the robot's `fleetless.yaml` and the organization's defaults, less
62
+ what the app locks.
63
+ - **Breaking (major):** app users and app invitations hold a role key.
64
+ `role_id` is replaced by `role`, a role key, in `appUser`,
65
+ `createAppUserRequest`, `patchAppUserRequest`, `createAppInvitationRequest`
66
+ and `appInvitation` (so also `pendingAppInvitation`). `role` is optional in
67
+ the three requests, and absent means the app's `default_role`; `appInvitation`
68
+ requires it. `appUser.role` and `pendingAppInvitation.role` are nullable: an
69
+ account, or a pending invitation whose app has no default role, left without a
70
+ key lists with `role: null` and reaches nothing. A malformed key is refused; a
71
+ key that names no role is accepted and grants nothing. `409
72
+ target_state_conflict` now names `default_role` (rule `not_set`) where it
73
+ named `default_role_id`, and a role of another app is no longer a `404`. A
74
+ consumer that sent or read `role_id` sends and reads the role's key now.
75
+ - **Breaking (major):** locks follow a slug rename where role grants used to.
76
+ `renameSlugResponse.rewritten_grants` is `rewritten_locks` and
77
+ `slugUsageResponse.grant_count` is `lock_count`: the app locks that list the
78
+ renamed slug now list the new name as well, in every app of the
79
+ organization. A rename that would push a lock past the most slugs it can hold
80
+ is refused with `409 target_state_conflict`, rule `lock_full`.
81
+ - **Breaking (major):** `publishConfigResponse` requires `warnings`: every
82
+ warning of the published document, `[]` when it has none. An answer from a
83
+ cloud that does not send it yet no longer satisfies the contract.
84
+ - **Breaking (major):** the slugs `assets` and `job_history` are reserved, like
85
+ `bridge_state`, `robot_details` and `history`: `RESERVED_SLUGS` lists them,
86
+ and a configured entry of either name is refused when the document is
87
+ validated. They name the robot-level capabilities, so an exposure of the same
88
+ name would have left the `name` of an `effectiveCapability` ambiguous.
89
+ - `POST /api/apps/:id/invitations/:invId/reissue` lists `target_state_conflict`:
90
+ an invitation that holds no role key, in an app with no default role, is
91
+ refused with it (rule `not_set`, field `default_role`) before the old link is
92
+ revoked.
93
+ - The mail template variable `role.name` is the display name of the
94
+ organization role the invitee is given.
95
+ - The journal kind `app_role.delete` is retired: no producer writes it any more,
96
+ and it stays in the contract so that journals written before still parse and
97
+ replay.
98
+
99
+ ### Added
100
+
101
+ - Roles in `fleetless.yaml`. `role` — one role key, or a list of keys — is an
102
+ optional field of every entry of `datapoints`, `actions`, `services`,
103
+ `publishers` and `cameras`, and the new optional `access` section holds
104
+ `rules` (each with a `match` glob over the entry's ROS name, optional
105
+ `kinds` and a `role`) and the robot-level `assets` and `job_history`.
106
+ `accessRule` and `accessSection` are exported. The bridge ignores both
107
+ fields.
108
+ - The helpers that resolve them, from the package root: `roleKey`, `roleRef`,
109
+ `accessKind`, `matchRosGlob`, `roleClosure`, `roleSatisfies`, `findCycle`,
110
+ `listExposures`, `requirementOf`, `collectRoleRefs` and `roleIssues`, with
111
+ `ROLE_KEY_PATTERN` and `ROLE_KEY_RULE` (the pattern a role key must match
112
+ and the sentence that says so), `ACCESS_KINDS`, `ENTRY_KINDS`,
113
+ `MAX_ORG_ROLES`, `ROLE_NAME_MAX`, `SEED_ROLES`, `SEED_DEFAULTS` and their
114
+ types. `RoleRef` is the type of a `role` field, one key or a list of keys;
115
+ `RoleRefUse`, the result of `collectRoleRefs`, is one place a document names
116
+ a key. `roleIssues` yields the two warnings a document can earn,
117
+ `unknown_role` and `rule_matches_nothing`.
118
+ - Organization roles on the wire. Six developer routes, none owner-only:
119
+ `GET` and `POST /api/org/roles`, `PATCH` and `DELETE /api/org/roles/:key`,
120
+ and `GET` and `PUT /api/org/roles/defaults`. The list answers each role with
121
+ its counts and the keys that are written somewhere but are no role; a rename
122
+ with `update_references` that has places to rewrite is two calls, the first
123
+ answered with a preview and a `confirm` token, and one with none applies at
124
+ once. The key `defaults` is reserved and is no role key. Shapes: `orgRole`,
125
+ `orgRoleListResponse`, `danglingReference`, `referencePlace`,
126
+ `createOrgRoleRequest`, `patchOrgRoleRequest`, `roleRenamePreview`,
127
+ `roleDefaultsResponse` and `putRoleDefaultsRequest`, each with its type and
128
+ JSON Schema artifact.
129
+ - The error codes `role_cycle` (`400`, `details` is `roleCycleDetails`),
130
+ `role_key_taken` (`409`) and `confirmation_required` (`409`, `details` is
131
+ the preview that carries the token to confirm with).
132
+ - The journal kind `org_role.delete`, recorded like `server_key.revoke`.
133
+ - App access and effective rights on the wire. `GET` and `PUT
134
+ /api/apps/:id/access` read and replace what an app locks (`locked_kinds` for
135
+ whole kinds of access, `locked` for single exposures of single robots) and
136
+ the role its users get by default; the answer carries `warnings` for what is
137
+ out of step. `GET /api/apps/:id/effective-rights` takes `role` or `user` and
138
+ answers, per attached robot, every capability with whether it is granted,
139
+ where its requirement came from, whether the robot is `reachable` at all and
140
+ the datasheet an MCP session of that role would get. Developer routes, none
141
+ owner-only. Shapes: `appAccess`, `appLock`, `accessWarning`,
142
+ `appAccessResponse`, `effectiveRightsQuery`, `effectiveCapability`,
143
+ `effectiveRobotRights` and `effectiveRightsResponse`.
144
+ The lists of an access name each kind, slug and robot once, and are bounded;
145
+ `MAX_LOCK_SLUGS` is the most slugs one lock can name.
146
+ - `revision` on the access of an app. `appAccessResponse` carries the revision
147
+ of the stored access, and the `PUT /api/apps/:id/access` body may send back
148
+ the one it was composed from: when the stored access has changed since (a
149
+ write, a slug rename that extended a lock, a robot detached), the write is
150
+ refused with `409 target_state_conflict`, rule `stale`, and nothing is
151
+ written. Without a `revision` the body replaces what is stored, as before.
152
+
12
153
  ## [13.3.0] — 2026-11-05
13
154
 
14
155
  ### Added