@fleetless/contracts 1.0.0 → 1.0.3

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 (49) hide show
  1. package/CHANGELOG.md +97 -2
  2. package/CODE_OF_CONDUCT.md +83 -0
  3. package/CONTRIBUTING.md +136 -0
  4. package/README.md +49 -13
  5. package/SECURITY.md +55 -0
  6. package/artifacts/openapi.json +11 -11
  7. package/artifacts/routes.json +12 -12
  8. package/artifacts/schema/create-app-oidc-provider-request.schema.json +1 -1
  9. package/dist/alerts.d.ts +23 -28
  10. package/dist/alerts.js +23 -29
  11. package/dist/app-users.d.ts +18 -19
  12. package/dist/app-users.js +18 -20
  13. package/dist/apps.d.ts +21 -25
  14. package/dist/apps.js +42 -52
  15. package/dist/assets.d.ts +70 -132
  16. package/dist/assets.js +130 -223
  17. package/dist/audit.d.ts +14 -15
  18. package/dist/audit.js +28 -55
  19. package/dist/client-auth.d.ts +9 -9
  20. package/dist/client-auth.js +8 -9
  21. package/dist/common.d.ts +29 -37
  22. package/dist/common.js +28 -37
  23. package/dist/config-issues.d.ts +23 -25
  24. package/dist/config-issues.js +17 -17
  25. package/dist/config.d.ts +37 -44
  26. package/dist/config.js +145 -187
  27. package/dist/errors.d.ts +4 -3
  28. package/dist/errors.js +83 -116
  29. package/dist/identity.d.ts +24 -27
  30. package/dist/identity.js +23 -27
  31. package/dist/index.d.ts +4 -4
  32. package/dist/index.js +14 -15
  33. package/dist/introspection.d.ts +7 -6
  34. package/dist/introspection.js +6 -6
  35. package/dist/jobs.d.ts +16 -16
  36. package/dist/jobs.js +24 -29
  37. package/dist/mcp.d.ts +14 -15
  38. package/dist/mcp.js +12 -14
  39. package/dist/oauth.d.ts +21 -27
  40. package/dist/oauth.js +33 -43
  41. package/dist/protocol.d.ts +51 -62
  42. package/dist/protocol.js +107 -139
  43. package/dist/realtime.d.ts +53 -68
  44. package/dist/realtime.js +78 -104
  45. package/dist/rest.d.ts +183 -244
  46. package/dist/rest.js +305 -399
  47. package/dist/routes.d.ts +4 -3
  48. package/dist/routes.js +33 -32
  49. package/package.json +12 -7
package/dist/assets.d.ts CHANGED
@@ -1,10 +1,11 @@
1
+ // SPDX-License-Identifier: Apache-2.0
1
2
  import { z } from 'zod';
2
3
  /**
3
- * The asset store (spec §4.6, W7).
4
+ * The asset store.
4
5
  *
5
6
  * An **asset is an immutable file belonging to a robot**. It has a uuid and is
6
7
  * fetched by it. There are no org-level assets and no public retrieval: every
7
- * read is authenticated and role-checked (`assets`, §3.3).
8
+ * read is authenticated and checked against the `assets` role.
8
9
  *
9
10
  * **One authorization model — the `Authorization` header.** Not a signed URL,
10
11
  * not a cookie, not a token in a query string. The reason is not ergonomics
@@ -12,7 +13,7 @@ import { z } from 'zod';
12
13
  * lifetime, its own renewal, its own rotation, and in every log the question
13
14
  * of which token that was. Directus solves the same problem with a cookie and
14
15
  * an `access_token` query parameter, and the cookie half does not transfer —
15
- * Fleetless has no interface of its own (§1), so the consumers of a robot's
16
+ * Fleetless has no end-user interface of its own, so the consumers of a robot's
16
17
  * assets sit on other origins.
17
18
  *
18
19
  * **The consequence, said out loud: this is not a CDN.** A shared cache must
@@ -25,10 +26,9 @@ import { z } from 'zod';
25
26
  *
26
27
  * ---
27
28
  *
28
- * **`texture` is its own member of `assetKind` and not `other` (W7a, D2).**
29
+ * **`texture` is its own member of `assetKind` and not `other`.**
29
30
  *
30
- * Filing textures under `other` would be the catch-all this project has
31
- * already split five times, and it costs a real capability: a client that
31
+ * Filing textures under `other` costs a real capability: a client that
32
32
  * renders a robot must know, from the asset list alone and before fetching
33
33
  * anything, which bytes it has to pre-fetch. Every load in the browser goes
34
34
  * through the SDK with the bearer token — there is no lazy second fetch a
@@ -94,23 +94,18 @@ export type Asset = z.infer<typeof asset>;
94
94
  *
95
95
  * `missing` carries **the reference, verbatim, that no asset answers** — for
96
96
  * a `package://` mesh the URI the bridge could not resolve in the workspace,
97
- * and since W7's security fix also the absolute paths and bare relative paths
98
- * a URDF may carry, which the extractor sees and the sync deliberately never
99
- * offers. The sentence used to say "the `package://` URIs" and the field
100
- * carried three kinds of string (Momus-W7); it is widened here rather than
101
- * narrowed, because a developer whose URDF names `/opt/meshes/arm.stl` is
102
- * entitled to be told that nothing will ever fetch it.
103
- *
104
- * The spec's example is "2 Meshes fehlen" and that number alone is a dead
105
- * end: it tells a developer to go looking through a workspace by hand. The
106
- * references are what they can act on, so the references travel.
107
- *
108
- * **Every entry must be actionable, and that is a constraint on the
109
- * producers, not on this field (W7a).** An entry a developer cannot make
110
- * disappear by fixing what it names is a defect in whoever put it there: for
111
- * a whole wave `<texture>` references were listed here and no sync would ever
112
- * offer them, so the honest instruction behind the list was "fix this, it
113
- * will not help".
97
+ * and also the absolute paths and bare relative paths a URDF may carry, which
98
+ * the extractor sees and the sync deliberately never offers. A developer whose
99
+ * URDF names `/opt/meshes/arm.stl` is entitled to be told that nothing will
100
+ * ever fetch it.
101
+ *
102
+ * A bare count of what is missing is a dead end: it tells a developer to go
103
+ * looking through a workspace by hand. The references are what they can act
104
+ * on, so the references travel.
105
+ *
106
+ * **Every entry must be actionable, and that is a constraint on the producers,
107
+ * not on this field.** An entry a developer cannot make disappear by fixing
108
+ * what it names is a defect in whoever put it there.
114
109
  */
115
110
  export declare const urdfCompleteness: z.ZodObject<{
116
111
  present: z.ZodBoolean;
@@ -128,21 +123,14 @@ export type UrdfCompleteness = z.infer<typeof urdfCompleteness>;
128
123
  * A sync is long-running and is therefore answered with something to watch,
129
124
  * never with a status that was true at the moment of asking.
130
125
  *
131
- * **`source` has one value, and that is deliberate.** §4.6 also names a manual
132
- * zip upload, and the first version of this shape had `'upload'` in the enum —
133
- * with **no body defined for the bytes**. An enum value with no producer and
134
- * no payload invites every consumer to guess a shape, and each guesses
135
- * differently; that is a defect this project has deliberately refused to
136
- * introduce before, when an error code was proposed whose payload had moved.
137
- * The zip path stays a condition rather than sitting in the wire as a
138
- * promise.
126
+ * **`source` has one value, and that is deliberate.** A manual upload path is
127
+ * planned but has no body defined for the bytes yet. An enum value with no
128
+ * producer and no payload invites every consumer to guess a shape, and each
129
+ * guesses differently, so it stays out of the wire until it is real.
139
130
  *
140
- * A single-member enum rather than dropping the field: the second source is a
131
+ * A single-member enum rather than no field at all: the second source is a
141
132
  * question of when, not whether, and a caller that already names its source
142
133
  * does not change shape when the second one arrives.
143
- *
144
- * Caught by Eve-W7 asking what body `'upload'` takes, rather than building
145
- * against a guess.
146
134
  */
147
135
  export declare const assetSyncRequest: z.ZodObject<{
148
136
  source: z.ZodEnum<{
@@ -150,18 +138,11 @@ export declare const assetSyncRequest: z.ZodObject<{
150
138
  }>;
151
139
  }, z.core.$strict>;
152
140
  /**
153
- * **And the route must read it (W7a).** Through W7 it did not: `{source:
154
- * 'bridge'}`, `{source:'upload'}`, `{nonsense:1}` and `{}` all behaved
155
- * identically, so the argument above — that a caller naming its source does
156
- * not change shape when the second one arrives — was true of the document and
157
- * false of the system. A shape with no consumer is not a contract; it is a
158
- * comment with a type.
159
- *
160
- * The decision is to keep the shape and **validate it, `.strict()`**, rather
161
- * than delete it. Deleting removes the record of why the enum has one member,
162
- * and the zip path is a question of when. Validation is what makes the single
163
- * member mean something: a caller who sends `'upload'` today learns that it
164
- * does not exist yet, instead of silently getting a bridge sync.
141
+ * **And the route reads it.** The body is `.strict()`, so `{source:'upload'}`
142
+ * and `{nonsense:1}` are refusals rather than silent bridge syncs. A shape no
143
+ * route validates is not a contract; it is a comment with a type. Validation
144
+ * is what makes the single member mean something: a caller who names a source
145
+ * that does not exist yet learns that, instead of getting a different one.
165
146
  */
166
147
  export type AssetSyncRequest = z.infer<typeof assetSyncRequest>;
167
148
  export declare const assetSyncResponse: z.ZodObject<{
@@ -176,83 +157,43 @@ export type AssetSyncResponse = z.infer<typeof assetSyncResponse>;
176
157
  * worse than one that fails outright, because the failure surfaces later, in a
177
158
  * renderer, as a robot with missing limbs and no explanation.
178
159
  *
179
- * **`failed` carries per-reference facts and `reason` carries the sync's own,
180
- * and that split is what M7 bought.** Three different kinds of string used to
181
- * reach `failed`: unresolvable `package://` URIs (the documented meaning), the
182
- * literal `robot_description` when a URDF *upload* failed, and English
183
- * sentences written by the cloud — "the robot disconnected mid-sync". The
184
- * console printed the array under *"these meshes could not be resolved"*, so a
185
- * developer whose robot dropped was told to go find a mesh named *the robot
186
- * disconnected mid-sync* (Momus-W7, M7).
187
- *
188
- * **Two of those three were defects and the third was not, which this
189
- * paragraph used to get wrong** (Argus-W7a, W7a review, reading the file top to
190
- * bottom). The cloud's English sentences do not belong here — that is what
191
- * `reason` is for. But `robot_description` is a **legitimate** entry: the URDF
192
- * is an asset that can fail to upload like any other, and W7a made that
193
- * explicit rather than removing it — see `assetFailure.reference`, which says
194
- * in as many words that not every entry is a mesh URI and a consumer must not
195
- * assume one. Read together with the old sentence *"`failed` is URIs and
196
- * nothing else"*, this file told a consumer the same value was both a defect
197
- * and a documented case.
198
- *
199
- * So the rule is: **anything that is not about one specific reference goes in
200
- * `reason`** — one human-readable sentence
201
- * about why the sync ended as it did, `null` when the outcome speaks for
202
- * itself. It also carries the distinction `bridgeAssetProgress.state` makes
203
- * and this shape could not — a sync **refused** because another was in flight
204
- * is not a sync that tried and failed.
205
- *
206
- * **`assetSyncState` was deliberately not widened to carry that.** Consumers
207
- * switch on it, a new member silently changes what every existing switch
208
- * covers, and "refused" is a *reason* for a terminal outcome rather than a
209
- * different one. Adding a field is additive; adding an enum member is not.
160
+ * **`failed` carries per-reference facts and `reason` carries the sync's
161
+ * own.** Anything that is not about one specific reference goes in `reason` —
162
+ * one human-readable sentence about why the sync ended as it did, `null` when
163
+ * the outcome speaks for itself. A whole-sync condition written into `failed`
164
+ * reaches a developer as a mesh they are told to go and find.
165
+ *
166
+ * Not every `failed` entry is a mesh URI. A URDF upload can fail like any
167
+ * other asset, and it appears under the name `robot_description`; see
168
+ * `assetFailure.reference`. A consumer must not assume every entry is a
169
+ * `package://` URI.
170
+ *
171
+ * **`assetSyncState` is deliberately not widened to carry the reason.**
172
+ * Consumers switch on it, and a new member silently changes what every
173
+ * existing switch covers. A sync refused because another was in flight is
174
+ * still a terminal outcome with a reason, not a different state. Adding a
175
+ * field is additive; adding an enum member is not.
210
176
  */
211
177
  /**
212
- * **Der Deckel, den beide Seiten kennen müssen (W9b).**
213
- *
214
- * Bis hierher hatte die Bridge eine eigene Zahl und die Cloud eine eigene, und
215
- * die Registerzeile dazu nannte die der Bridge beim Namen: *„a guess … chosen
216
- * as a starting number with no measurement behind it"* (DEF-127). Eine Grenze,
217
- * die der Sender rät und der Empfänger durchsetzt, ist keine Grenze — sie ist
218
- * zwei Zahlen, die zufällig übereinstimmen, bis eine von beiden sich ändert.
219
- *
220
- * Hier steht sie einmal. Die Bridge liest sie, **bevor** sie eine Datei in den
221
- * Speicher liest; die Cloud setzt sie durch. Ohne das kann die Bridge gar nicht
222
- * ablehnen, ohne 194 MB zu puffern — was am 2026-08-18 auf rx1 genau so passiert
223
- * ist (DEF-148).
224
- *
225
- * **Sie gilt je Datei, nicht je Sync**, und das steht hier, weil DEF-127 es
226
- * ausdrücklich verlangt hat: acht Meshes zu je 30 MiB passen durch, eine Datei
227
- * zu 65 MiB nicht. Wer sie für eine Obergrenze der Übertragung hält, rechnet
228
- * mit einer Schranke, die es nicht gibt — die Summe eines Syncs bindet das
229
- * Speicherkontingent der Organisation, und das ist eine andere Zahl an einer
230
- * anderen Stelle.
178
+ * **The upload ceiling both sides read.**
231
179
  *
232
- * **Die Zahl ist bewusst unverändert, und die Begründung hat zwei Fassungen
233
- * gebraucht — die Korrektur ist hier mehr wert als das Ergebnis.**
180
+ * It is stated once, here, rather than once in the producer and once in the
181
+ * cloud. A limit the sender guesses and the receiver enforces is not a limit;
182
+ * it is two numbers that agree until one of them changes.
234
183
  *
235
- * Zuerst stand hier: *„rx1s echte Meshes sind gemessen — `base.dae`
236
- * 193.886.766 Bytes, also das 2,9-fache"*, im Präsens, als stünde das über
237
- * der heute laufenden Beschreibung. Gemessen am 2026-08-19 gegen die
238
- * **laufende** `robot_description`: acht `package://`-Referenzen, zusammen
239
- * 89.379.096 Bytes, die größte `RX1.dae` mit 38.229.621 — **keine über dem
240
- * Deckel.**
184
+ * The bridge reads it **before** it reads a file into memory, and the cloud
185
+ * enforces it. Without a shared number a producer cannot refuse an oversized
186
+ * mesh without first buffering the whole of it.
241
187
  *
242
- * Daraus habe ich dann geschlossen, `base.dae` werde *von keiner* rx1-URDF
243
- * referenziert. **Auch das war falsch, und zwar weil ich nur den aktuellen
244
- * Workspace geprüft hatte.** `src.old-20260730/rx1` und `.../rx1_linac`
245
- * referenzieren beide `base.dae` **und** `base.stl` und kennen `RX1.dae`
246
- * nicht — das ist die Beschreibung, die rx1 am 2026-08-18 lief, als DEF-148
247
- * gemessen wurde. Die Beobachtung von damals war korrekt und ihre Erklärung
248
- * auch.
188
+ * **It applies per file, not per sync.** Eight meshes of 30 MiB each pass; one
189
+ * file of 65 MiB does not. Reading it as a ceiling on a whole transfer means
190
+ * planning against a bound that does not exist — the total of a sync counts
191
+ * against the organisation's storage quota, which is a different number in a
192
+ * different place.
249
193
  *
250
- * Was heute gilt: **welche Beschreibung rx1 fährt, entscheidet, ob der Deckel
251
- * reicht** — die aktuelle passt mit Abstand hinein, die vorherige um das
252
- * 2,9-fache nicht. Das ist keine Vertragsfrage, sondern eine über Speicher,
253
- * Übertragungszeit und Kontingente, und sie liegt bei André. Sie blockiert
254
- * nichts: W9bs Gate-Schritt 6 ist gegen die heute laufende Beschreibung
255
- * erreichbar, ohne dass jemand eine Zahl anfasst.
194
+ * A robot whose meshes exceed this is not a contract question but a question
195
+ * about storage, transfer time and quota, and it is answered by raising the
196
+ * number here, in one place, for both sides.
256
197
  */
257
198
  export declare const ASSET_UPLOAD_MAX_BYTES: number;
258
199
  export declare const assetTooLargeDetails: z.ZodObject<{
@@ -274,9 +215,9 @@ export type AssetTooLargeDetails = z.infer<typeof assetTooLargeDetails>;
274
215
  * - **`upload_failed`** — the bytes exist and the transfer did not succeed.
275
216
  * **Transient.** The asset is still wanted; a later sync will carry it.
276
217
  * - **`refused`** — never attempted, because a producer-side ceiling was hit
277
- * (R9: a `.dae` with more internal references than one file or one sync will
278
- * report). **Transient in the same sense**: nothing is known to be missing,
279
- * only unexamined.
218
+ * (for example a `.dae` carrying more internal references than one file or
219
+ * one sync will report). **Transient in the same sense**: nothing is known
220
+ * to be missing, only unexamined.
280
221
  *
281
222
  * A consumer that cannot act on the distinction may still print `reference`
282
223
  * alone and lose nothing it had before.
@@ -413,19 +354,16 @@ export type MissingAssetQuery = z.infer<typeof missingAssetQuery>;
413
354
  * number leaves the caller unable to decide anything.
414
355
  */
415
356
  /**
416
- * Was eine `busy`-Absage beim Asset-Sync mitgeben muss (W9b, DEF-147).
357
+ * What a `busy` refusal on an asset sync has to carry.
417
358
  *
418
- * Vorher antwortete die Cloud *„Robot <id> already has a sync in progress"* —
419
- * eine Absage, die einen **Zustand** benennt, aber nicht das **Ding** in diesem
420
- * Zustand. Der laufende Sync ist serverseitig beobachtbar und über
421
- * `GET .../assets/sync/<id>` abfragbar, nur erreichte ihn niemand mehr, der die
422
- * id nicht aufgehoben hatte. Genau die Form, die W6b eine ganze Welle lang
423
- * ausgeräumt hat: ein Abbruch ohne Job-Id, eine Freigabe ohne Session-Id.
359
+ * A refusal that names a **state** — "a sync is already in progress" — and not
360
+ * the **thing** in that state leaves the caller with nothing to look at. The
361
+ * running sync is observable under `GET .../assets/sync/<id>`, but only to
362
+ * someone who kept its id.
424
363
  *
425
- * **Das allein genügt nicht**, und deshalb steht daneben `activeSync` auf der
426
- * Asset-Liste: Diese Details helfen nur dem, der den Knopf noch einmal drückt.
427
- * Wer die Seite neu lädt — der Fall, den André am 2026-08-18 hatte —, drückt
428
- * gar nichts und braucht den laufenden Sync im ersten `GET`.
364
+ * These details serve the caller that presses the button again. A client that
365
+ * reloads instead presses nothing, which is why `active_sync` sits on the
366
+ * asset list as well.
429
367
  */
430
368
  export declare const assetSyncBusyDetails: z.ZodObject<{
431
369
  sync_id: z.ZodUUID;