@fleetless/contracts 1.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 (287) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +17 -0
  4. package/README.md +88 -0
  5. package/artifacts/constants.json +24 -0
  6. package/artifacts/openapi.json +17219 -0
  7. package/artifacts/routes.json +4605 -0
  8. package/artifacts/schema/accept-team-invite-request.schema.json +22 -0
  9. package/artifacts/schema/action-config.schema.json +198 -0
  10. package/artifacts/schema/alert-list-response.schema.json +172 -0
  11. package/artifacts/schema/api-error.schema.json +20 -0
  12. package/artifacts/schema/app-auth-config.schema.json +106 -0
  13. package/artifacts/schema/app-invitation-list-response.schema.json +57 -0
  14. package/artifacts/schema/app-invitation.schema.json +69 -0
  15. package/artifacts/schema/app-list-response.schema.json +82 -0
  16. package/artifacts/schema/app-mail-template-list-response.schema.json +68 -0
  17. package/artifacts/schema/app-mail-template.schema.json +54 -0
  18. package/artifacts/schema/app-oidc-provider-list-response.schema.json +93 -0
  19. package/artifacts/schema/app-oidc-provider.schema.json +80 -0
  20. package/artifacts/schema/app-user-list-response.schema.json +111 -0
  21. package/artifacts/schema/app-user.schema.json +98 -0
  22. package/artifacts/schema/app.schema.json +69 -0
  23. package/artifacts/schema/apply-error.schema.json +41 -0
  24. package/artifacts/schema/asset-list-response.schema.json +288 -0
  25. package/artifacts/schema/asset-sync-request.schema.json +17 -0
  26. package/artifacts/schema/asset-sync-response.schema.json +16 -0
  27. package/artifacts/schema/asset-sync-status.schema.json +136 -0
  28. package/artifacts/schema/asset.schema.json +68 -0
  29. package/artifacts/schema/audit-actor.schema.json +32 -0
  30. package/artifacts/schema/audit-event.schema.json +119 -0
  31. package/artifacts/schema/audit-list-response.schema.json +144 -0
  32. package/artifacts/schema/audit-query.schema.json +79 -0
  33. package/artifacts/schema/auth-error.schema.json +23 -0
  34. package/artifacts/schema/auth-me-response.schema.json +99 -0
  35. package/artifacts/schema/auth-ok.schema.json +115 -0
  36. package/artifacts/schema/authorization-server-metadata.schema.json +80 -0
  37. package/artifacts/schema/bridge-asset-progress.schema.json +99 -0
  38. package/artifacts/schema/bridge-assets-available.schema.json +25 -0
  39. package/artifacts/schema/bridge-camera-state.schema.json +78 -0
  40. package/artifacts/schema/bridge-config-applied.schema.json +67 -0
  41. package/artifacts/schema/bridge-hello.schema.json +65 -0
  42. package/artifacts/schema/bridge-introspect.schema.json +114 -0
  43. package/artifacts/schema/bridge-job-lost.schema.json +22 -0
  44. package/artifacts/schema/bridge-job-update.schema.json +100 -0
  45. package/artifacts/schema/bridge-pong.schema.json +19 -0
  46. package/artifacts/schema/bridge-pressure.schema.json +292 -0
  47. package/artifacts/schema/bridge-state.schema.json +24 -0
  48. package/artifacts/schema/bridge-type-definitions.schema.json +169 -0
  49. package/artifacts/schema/busy-details.schema.json +115 -0
  50. package/artifacts/schema/camera-descriptor.schema.json +45 -0
  51. package/artifacts/schema/camera-list-response.schema.json +58 -0
  52. package/artifacts/schema/camera-source.schema.json +240 -0
  53. package/artifacts/schema/cancel-request.schema.json +20 -0
  54. package/artifacts/schema/client-accept-invitation-request.schema.json +35 -0
  55. package/artifacts/schema/client-auth.schema.json +18 -0
  56. package/artifacts/schema/client-cancel.schema.json +45 -0
  57. package/artifacts/schema/client-identity.schema.json +103 -0
  58. package/artifacts/schema/client-invoke.schema.json +45 -0
  59. package/artifacts/schema/client-login-request.schema.json +29 -0
  60. package/artifacts/schema/client-logout-request.schema.json +14 -0
  61. package/artifacts/schema/client-mcp-interaction-decision-response.schema.json +15 -0
  62. package/artifacts/schema/client-mcp-interaction.schema.json +59 -0
  63. package/artifacts/schema/client-oidc-callback-query.schema.json +28 -0
  64. package/artifacts/schema/client-oidc-exchange-request.schema.json +21 -0
  65. package/artifacts/schema/client-oidc-start-query.schema.json +36 -0
  66. package/artifacts/schema/client-password-reset-confirm-request.schema.json +22 -0
  67. package/artifacts/schema/client-password-reset-request.schema.json +24 -0
  68. package/artifacts/schema/client-provider-list-query.schema.json +17 -0
  69. package/artifacts/schema/client-provider-list-response.schema.json +34 -0
  70. package/artifacts/schema/client-publish.schema.json +40 -0
  71. package/artifacts/schema/client-refresh-request.schema.json +14 -0
  72. package/artifacts/schema/client-register-request.schema.json +44 -0
  73. package/artifacts/schema/client-resend-verification-request.schema.json +24 -0
  74. package/artifacts/schema/client-subscribe.schema.json +43 -0
  75. package/artifacts/schema/client-unsubscribe.schema.json +26 -0
  76. package/artifacts/schema/client-verify-email-request.schema.json +15 -0
  77. package/artifacts/schema/cloud-asset-request.schema.json +37 -0
  78. package/artifacts/schema/cloud-camera-start.schema.json +41 -0
  79. package/artifacts/schema/cloud-camera-stop.schema.json +26 -0
  80. package/artifacts/schema/cloud-cancel.schema.json +33 -0
  81. package/artifacts/schema/cloud-config.schema.json +1635 -0
  82. package/artifacts/schema/cloud-hello-error.schema.json +23 -0
  83. package/artifacts/schema/cloud-hello-ok.schema.json +19 -0
  84. package/artifacts/schema/cloud-introspect-request.schema.json +19 -0
  85. package/artifacts/schema/cloud-invoke.schema.json +40 -0
  86. package/artifacts/schema/cloud-ping.schema.json +19 -0
  87. package/artifacts/schema/cloud-publish.schema.json +28 -0
  88. package/artifacts/schema/cloud-type-request.schema.json +30 -0
  89. package/artifacts/schema/command-result.schema.json +175 -0
  90. package/artifacts/schema/config-draft-response.schema.json +1695 -0
  91. package/artifacts/schema/config-state.schema.json +124 -0
  92. package/artifacts/schema/config-version-response.schema.json +1641 -0
  93. package/artifacts/schema/config-versions-response.schema.json +33 -0
  94. package/artifacts/schema/create-app-invitation-request.schema.json +40 -0
  95. package/artifacts/schema/create-app-oidc-provider-request.schema.json +70 -0
  96. package/artifacts/schema/create-app-request.schema.json +30 -0
  97. package/artifacts/schema/create-app-user-request.schema.json +42 -0
  98. package/artifacts/schema/create-robot-request.schema.json +14 -0
  99. package/artifacts/schema/create-robot-response.schema.json +44 -0
  100. package/artifacts/schema/create-server-key-response.schema.json +65 -0
  101. package/artifacts/schema/create-team-invite-request.schema.json +43 -0
  102. package/artifacts/schema/datapoint-alert-row.schema.json +160 -0
  103. package/artifacts/schema/datapoint-config.schema.json +366 -0
  104. package/artifacts/schema/datapoint-display.schema.json +31 -0
  105. package/artifacts/schema/datapoint-event.schema.json +34 -0
  106. package/artifacts/schema/datapoint-frame.schema.json +28 -0
  107. package/artifacts/schema/datapoint-list-response.schema.json +61 -0
  108. package/artifacts/schema/datapoint-value.schema.json +28 -0
  109. package/artifacts/schema/developer-login-request.schema.json +19 -0
  110. package/artifacts/schema/dynamic-client-registration-request.schema.json +60 -0
  111. package/artifacts/schema/dynamic-client-registration-response.schema.json +68 -0
  112. package/artifacts/schema/error-frame.schema.json +23 -0
  113. package/artifacts/schema/exposure-counts.schema.json +39 -0
  114. package/artifacts/schema/exposure-list-response.schema.json +43 -0
  115. package/artifacts/schema/fetch-types-request.schema.json +19 -0
  116. package/artifacts/schema/fetch-types-response.schema.json +163 -0
  117. package/artifacts/schema/fleetless-user-list-response.schema.json +73 -0
  118. package/artifacts/schema/fleetless-user.schema.json +60 -0
  119. package/artifacts/schema/history-buckets-response.schema.json +79 -0
  120. package/artifacts/schema/history-query.schema.json +58 -0
  121. package/artifacts/schema/history-response.schema.json +150 -0
  122. package/artifacts/schema/history-samples-response.schema.json +68 -0
  123. package/artifacts/schema/introspection-response.schema.json +118 -0
  124. package/artifacts/schema/invoke-or-service-response.schema.json +141 -0
  125. package/artifacts/schema/invoke-request.schema.json +23 -0
  126. package/artifacts/schema/invoke-response.schema.json +125 -0
  127. package/artifacts/schema/job-actor.schema.json +34 -0
  128. package/artifacts/schema/job-event.schema.json +158 -0
  129. package/artifacts/schema/job-response.schema.json +123 -0
  130. package/artifacts/schema/job-run-list-response.schema.json +222 -0
  131. package/artifacts/schema/job-run-query.schema.json +95 -0
  132. package/artifacts/schema/job-run-summary-query.schema.json +23 -0
  133. package/artifacts/schema/job-run-summary.schema.json +33 -0
  134. package/artifacts/schema/job-run.schema.json +195 -0
  135. package/artifacts/schema/job-state.schema.json +11 -0
  136. package/artifacts/schema/job.schema.json +106 -0
  137. package/artifacts/schema/latency-bucket.schema.json +63 -0
  138. package/artifacts/schema/live-session-response.schema.json +41 -0
  139. package/artifacts/schema/mail-outcome.schema.json +20 -0
  140. package/artifacts/schema/mail-template-preview-request.schema.json +35 -0
  141. package/artifacts/schema/mail-template-preview-response.schema.json +31 -0
  142. package/artifacts/schema/mail-template-problem-details.schema.json +24 -0
  143. package/artifacts/schema/mcp-consent-grant-list-response.schema.json +52 -0
  144. package/artifacts/schema/mcp-consent-grant.schema.json +39 -0
  145. package/artifacts/schema/mcp-robot-datasheet.schema.json +115 -0
  146. package/artifacts/schema/mcp-role-preview-response.schema.json +134 -0
  147. package/artifacts/schema/missing-asset-query.schema.json +11 -0
  148. package/artifacts/schema/oauth-authorize-query.schema.json +47 -0
  149. package/artifacts/schema/oauth-redirect-response.schema.json +15 -0
  150. package/artifacts/schema/oauth-token-request.schema.json +47 -0
  151. package/artifacts/schema/oauth-token-response.schema.json +38 -0
  152. package/artifacts/schema/org-alerts-query.schema.json +15 -0
  153. package/artifacts/schema/org-event-dropped.schema.json +26 -0
  154. package/artifacts/schema/org-event-replay.schema.json +97 -0
  155. package/artifacts/schema/org-event-subscribe.schema.json +14 -0
  156. package/artifacts/schema/org-event-unsubscribe.schema.json +14 -0
  157. package/artifacts/schema/org-event.schema.json +75 -0
  158. package/artifacts/schema/org-firing-alerts-response.schema.json +178 -0
  159. package/artifacts/schema/org-health-query.schema.json +13 -0
  160. package/artifacts/schema/org-latency-query.schema.json +42 -0
  161. package/artifacts/schema/org-latency-response.schema.json +124 -0
  162. package/artifacts/schema/org-quota-usage-counts.schema.json +42 -0
  163. package/artifacts/schema/org-quota-usage.schema.json +102 -0
  164. package/artifacts/schema/org-quotas.schema.json +51 -0
  165. package/artifacts/schema/org-usage-query.schema.json +19 -0
  166. package/artifacts/schema/org-usage-response.schema.json +77 -0
  167. package/artifacts/schema/org.schema.json +30 -0
  168. package/artifacts/schema/parameter-invalid-details.schema.json +37 -0
  169. package/artifacts/schema/parameter-spec.schema.json +120 -0
  170. package/artifacts/schema/parameter-violation.schema.json +24 -0
  171. package/artifacts/schema/password-change-request.schema.json +21 -0
  172. package/artifacts/schema/password-reset-confirm.schema.json +19 -0
  173. package/artifacts/schema/password-reset-request.schema.json +14 -0
  174. package/artifacts/schema/patch-app-oidc-provider-request.schema.json +50 -0
  175. package/artifacts/schema/patch-app-user-request.schema.json +34 -0
  176. package/artifacts/schema/patch-auth-me-request.schema.json +22 -0
  177. package/artifacts/schema/patch-fleetless-user-request.schema.json +20 -0
  178. package/artifacts/schema/patch-org-request.schema.json +15 -0
  179. package/artifacts/schema/patch-org-response.schema.json +40 -0
  180. package/artifacts/schema/patch-robot-request.schema.json +15 -0
  181. package/artifacts/schema/patch-robot-response.schema.json +40 -0
  182. package/artifacts/schema/pending-team-invite-list-response.schema.json +52 -0
  183. package/artifacts/schema/pending-team-invite.schema.json +39 -0
  184. package/artifacts/schema/protected-resource-metadata.schema.json +41 -0
  185. package/artifacts/schema/publish-config-response.schema.json +21 -0
  186. package/artifacts/schema/publish-request.schema.json +17 -0
  187. package/artifacts/schema/publisher-config.schema.json +285 -0
  188. package/artifacts/schema/put-app-auth-config-request.schema.json +93 -0
  189. package/artifacts/schema/put-app-mail-template-request.schema.json +35 -0
  190. package/artifacts/schema/put-config-draft-request.schema.json +13 -0
  191. package/artifacts/schema/put-datapoint-display-request.schema.json +31 -0
  192. package/artifacts/schema/put-robot-details-request.schema.json +41 -0
  193. package/artifacts/schema/put-robot-details-response.schema.json +43 -0
  194. package/artifacts/schema/rate-limit-details.schema.json +15 -0
  195. package/artifacts/schema/refresh-request.schema.json +13 -0
  196. package/artifacts/schema/release-live-query.schema.json +13 -0
  197. package/artifacts/schema/rename-slug-request.schema.json +23 -0
  198. package/artifacts/schema/rename-slug-response.schema.json +24 -0
  199. package/artifacts/schema/resource-health-event.schema.json +72 -0
  200. package/artifacts/schema/resource-health-list-response.schema.json +80 -0
  201. package/artifacts/schema/resource-health-state.schema.json +68 -0
  202. package/artifacts/schema/robot-config-doc.schema.json +1616 -0
  203. package/artifacts/schema/robot-delete-query.schema.json +12 -0
  204. package/artifacts/schema/robot-deletion-summary.schema.json +63 -0
  205. package/artifacts/schema/robot-detail-response.schema.json +262 -0
  206. package/artifacts/schema/robot-details-doc.schema.json +33 -0
  207. package/artifacts/schema/robot-jobs-response.schema.json +119 -0
  208. package/artifacts/schema/robot-latency-series.schema.json +81 -0
  209. package/artifacts/schema/robot-list-item.schema.json +94 -0
  210. package/artifacts/schema/robot-list-response.schema.json +106 -0
  211. package/artifacts/schema/robot.schema.json +30 -0
  212. package/artifacts/schema/role-list-response.schema.json +48 -0
  213. package/artifacts/schema/role-permissions.schema.json +61 -0
  214. package/artifacts/schema/role.schema.json +35 -0
  215. package/artifacts/schema/ros-graph.schema.json +99 -0
  216. package/artifacts/schema/server-key-list-response.schema.json +64 -0
  217. package/artifacts/schema/server-key.schema.json +51 -0
  218. package/artifacts/schema/service-call-response.schema.json +13 -0
  219. package/artifacts/schema/service-config.schema.json +198 -0
  220. package/artifacts/schema/session-tokens.schema.json +28 -0
  221. package/artifacts/schema/sign-up-request.schema.json +26 -0
  222. package/artifacts/schema/sign-up-response.schema.json +127 -0
  223. package/artifacts/schema/slug-usage-response.schema.json +32 -0
  224. package/artifacts/schema/snapshot-header.schema.json +44 -0
  225. package/artifacts/schema/snapshot-meta-response.schema.json +85 -0
  226. package/artifacts/schema/subscribe-error.schema.json +31 -0
  227. package/artifacts/schema/team-invite.schema.json +57 -0
  228. package/artifacts/schema/tier-change-request.schema.json +17 -0
  229. package/artifacts/schema/type-definition.schema.json +144 -0
  230. package/artifacts/schema/types-response.schema.json +156 -0
  231. package/artifacts/schema/update-app-request.schema.json +32 -0
  232. package/artifacts/schema/urdf-completeness.schema.json +50 -0
  233. package/artifacts/schema/validation-issue.schema.json +43 -0
  234. package/artifacts/schema/waitlist-request.schema.json +15 -0
  235. package/artifacts/schema-outgoing/bridge-asset-progress.schema.json +102 -0
  236. package/artifacts/schema-outgoing/bridge-assets-available.schema.json +26 -0
  237. package/artifacts/schema-outgoing/bridge-camera-state.schema.json +80 -0
  238. package/artifacts/schema-outgoing/bridge-config-applied.schema.json +69 -0
  239. package/artifacts/schema-outgoing/bridge-hello.schema.json +68 -0
  240. package/artifacts/schema-outgoing/bridge-introspect.schema.json +119 -0
  241. package/artifacts/schema-outgoing/bridge-job-lost.schema.json +23 -0
  242. package/artifacts/schema-outgoing/bridge-job-update.schema.json +102 -0
  243. package/artifacts/schema-outgoing/bridge-pong.schema.json +20 -0
  244. package/artifacts/schema-outgoing/bridge-type-definitions.schema.json +174 -0
  245. package/artifacts/schema-outgoing/datapoint-frame.schema.json +29 -0
  246. package/artifacts/schema-outgoing/snapshot-header.schema.json +45 -0
  247. package/dist/alerts.d.ts +255 -0
  248. package/dist/alerts.js +193 -0
  249. package/dist/app-users.d.ts +606 -0
  250. package/dist/app-users.js +696 -0
  251. package/dist/apps.d.ts +175 -0
  252. package/dist/apps.js +267 -0
  253. package/dist/assets.d.ts +434 -0
  254. package/dist/assets.js +546 -0
  255. package/dist/audit.d.ts +129 -0
  256. package/dist/audit.js +238 -0
  257. package/dist/client-auth.d.ts +409 -0
  258. package/dist/client-auth.js +487 -0
  259. package/dist/common.d.ts +186 -0
  260. package/dist/common.js +199 -0
  261. package/dist/config-issues.d.ts +175 -0
  262. package/dist/config-issues.js +339 -0
  263. package/dist/config.d.ts +862 -0
  264. package/dist/config.js +1988 -0
  265. package/dist/errors.d.ts +52 -0
  266. package/dist/errors.js +786 -0
  267. package/dist/identity.d.ts +549 -0
  268. package/dist/identity.js +503 -0
  269. package/dist/index.d.ts +51 -0
  270. package/dist/index.js +51 -0
  271. package/dist/introspection.d.ts +99 -0
  272. package/dist/introspection.js +97 -0
  273. package/dist/jobs.d.ts +334 -0
  274. package/dist/jobs.js +345 -0
  275. package/dist/mcp.d.ts +239 -0
  276. package/dist/mcp.js +153 -0
  277. package/dist/oauth.d.ts +344 -0
  278. package/dist/oauth.js +488 -0
  279. package/dist/protocol.d.ts +781 -0
  280. package/dist/protocol.js +715 -0
  281. package/dist/realtime.d.ts +494 -0
  282. package/dist/realtime.js +512 -0
  283. package/dist/rest.d.ts +1989 -0
  284. package/dist/rest.js +1963 -0
  285. package/dist/routes.d.ts +94 -0
  286. package/dist/routes.js +2298 -0
  287. package/package.json +61 -0
@@ -0,0 +1,781 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Bridge <-> cloud protocol, version 2.
4
+ *
5
+ * The version is exchanged in the hello handshake; the cloud refuses an
6
+ * incompatible bridge with a clear message (spec §5) — `ws/bridge.ts`'s
7
+ * `protocol_mismatch`, which names both versions and lands on the robot
8
+ * detail page as `last_hello_error`.
9
+ *
10
+ * **2 (2026-08-21):** `config_applied.errors` entries gained `kind` and `code`
11
+ * beside `message`. The check is `!==`, not a floor, so a bridge that is not
12
+ * exactly this version is refused entirely. That is deliberate: a cloud and a
13
+ * bridge that disagree about the wire should not pretend otherwise.
14
+ */
15
+ export declare const PROTOCOL_VERSION = 2;
16
+ /**
17
+ * The bridge socket close code for "this robot no longer exists" (W6a).
18
+ *
19
+ * Deliberately distinct from the auth failures: a deleted robot must **stop**,
20
+ * and a token that was valid a second ago is indistinguishable from one that
21
+ * was revoked unless the cloud says which. Without its own code the bridge
22
+ * reconnects forever against a robot that will never come back — a permanent
23
+ * load on the cloud, and a robot on someone's shelf whose logs say nothing
24
+ * more informative than "connection closed".
25
+ */
26
+ export declare const CLOSE_ROBOT_DELETED = 4004;
27
+ /**
28
+ * How long a command waits for its answer when the caller names no patience
29
+ * of its own (W6b).
30
+ *
31
+ * 15 s, which is what both halves already used independently: the cloud's
32
+ * `commandTimeoutMs` and the bridge's `GOAL_ACCEPT_TIMEOUT_S`. That they
33
+ * agreed was a coincidence of two separate decisions, and neither side could
34
+ * be told otherwise for a single call. Naming the number once, here, is what
35
+ * makes it one number rather than two that happen to match.
36
+ *
37
+ * A caller who knows their robot's work takes longer says so per call. A
38
+ * caller who says nothing gets exactly today's behaviour — which is the point
39
+ * of picking today's number as the default rather than a nicer one.
40
+ */
41
+ export declare const DEFAULT_PATIENCE_MS = 15000;
42
+ /**
43
+ * The longest patience a caller may ask for.
44
+ *
45
+ * A waiting REST request is a held-open connection, and there is **no rate
46
+ * limiting** on this platform until W8 — so an unbounded `patience_ms` is an
47
+ * unauthenticated way to pin the cloud's sockets open. Two minutes is long
48
+ * enough for the robot work anybody has described (a planner, a docking
49
+ * manoeuvre, an arm trajectory) and short enough that a thousand of them is
50
+ * still a bounded amount of cloud.
51
+ *
52
+ * Raising it is a W8 conversation, after rate limiting exists — not a
53
+ * one-line change here.
54
+ */
55
+ export declare const MAX_PATIENCE_MS = 120000;
56
+ /**
57
+ * The shortest patience a caller may ask for.
58
+ *
59
+ * A floor exists because **impatience reaches the robot**. Measured in W6b's
60
+ * review: `patience_ms: 1` on an action makes the bridge report `goal_timeout`
61
+ * and then issue a *corrective cancel* against a goal the action server
62
+ * accepts a moment later — so a caller who asks for an unreachable deadline
63
+ * does not merely get an error, they cause a cancellation on the machine.
64
+ * Repeatable, and on a platform with no rate limiting until W8.
65
+ *
66
+ * One second, because it has to be longer than a goal-acceptance round trip on
67
+ * a healthy robot and shorter than any wait a human would call patient. It is
68
+ * a guard against a number that cannot be satisfied, not a policy about how
69
+ * long work takes — `MAX_PATIENCE_MS` is the end that bounds the platform,
70
+ * this end bounds what the caller can do to the robot.
71
+ */
72
+ export declare const MIN_PATIENCE_MS = 1000;
73
+ /** Re-exported so consumers keep importing wire names from one place. */
74
+ export { slug } from './common.js';
75
+ /**
76
+ * One job the bridge still has, as reported in the handshake (W6b).
77
+ *
78
+ * It carries the **slug and the state**, not only the id, because the cloud's
79
+ * reconciliation needs both and had neither. Reading `active_job_ids` as bare
80
+ * uuids, a restarted cloud could answer exactly one question — "is this job
81
+ * still alive?" — for jobs it already knew about. It could not name what the
82
+ * robot is doing, could not tell a job that is still `running` from one that
83
+ * finished while the cloud was down, and had nothing at all to say about a
84
+ * job it never recorded because it crashed between minting the id and writing
85
+ * the row.
86
+ *
87
+ * `state` is the bridge's own current answer, not a history. A bridge that
88
+ * has a terminal result still in hand reports it here and the cloud writes it
89
+ * down, instead of publishing `lost` over a job that in fact succeeded.
90
+ */
91
+ export declare const activeJob: z.ZodObject<{
92
+ job_id: z.ZodUUID;
93
+ slug: z.ZodString;
94
+ state: z.ZodEnum<{
95
+ failed: "failed";
96
+ running: "running";
97
+ succeeded: "succeeded";
98
+ cancelled: "cancelled";
99
+ lost: "lost";
100
+ }>;
101
+ }, z.core.$strip>;
102
+ export type ActiveJob = z.infer<typeof activeJob>;
103
+ /** First frame a bridge sends after the socket opens. */
104
+ export declare const bridgeHello: z.ZodObject<{
105
+ type: z.ZodLiteral<"hello">;
106
+ protocol_version: z.ZodNumber;
107
+ token: z.ZodString;
108
+ bridge_version: z.ZodString;
109
+ active_jobs: z.ZodDefault<z.ZodArray<z.ZodObject<{
110
+ job_id: z.ZodUUID;
111
+ slug: z.ZodString;
112
+ state: z.ZodEnum<{
113
+ failed: "failed";
114
+ running: "running";
115
+ succeeded: "succeeded";
116
+ cancelled: "cancelled";
117
+ lost: "lost";
118
+ }>;
119
+ }, z.core.$strip>>>;
120
+ }, z.core.$strip>;
121
+ export type BridgeHello = z.infer<typeof bridgeHello>;
122
+ /** Cloud accepts the bridge: the robot is online from here on. */
123
+ export declare const cloudHelloOk: z.ZodObject<{
124
+ type: z.ZodLiteral<"hello_ok">;
125
+ robot_id: z.ZodUUID;
126
+ }, z.core.$strip>;
127
+ export type CloudHelloOk = z.infer<typeof cloudHelloOk>;
128
+ /** Cloud refuses the bridge (bad token, incompatible protocol, ...). */
129
+ export declare const cloudHelloError: z.ZodObject<{
130
+ type: z.ZodLiteral<"hello_error">;
131
+ code: z.ZodString;
132
+ message: z.ZodString;
133
+ }, z.core.$strip>;
134
+ export type CloudHelloError = z.infer<typeof cloudHelloError>;
135
+ /**
136
+ * One datapoint sample. `timestamp_ms` is the capture time at the bridge —
137
+ * never the receive time — so clients compute age themselves (spec §6.3).
138
+ */
139
+ export declare const datapointFrame: z.ZodObject<{
140
+ type: z.ZodLiteral<"datapoint">;
141
+ slug: z.ZodString;
142
+ value: z.ZodUnknown;
143
+ timestamp_ms: z.ZodNumber;
144
+ }, z.core.$strip>;
145
+ export type DatapointFrame = z.infer<typeof datapointFrame>;
146
+ /**
147
+ * Latency probe, cloud → bridge. The cloud sends its own clock in `ts_ms`;
148
+ * the bridge echoes it back untouched and the cloud derives the round-trip
149
+ * latency shown as `bridge_state.latency_ms`.
150
+ */
151
+ export declare const cloudPing: z.ZodObject<{
152
+ type: z.ZodLiteral<"ping">;
153
+ ts_ms: z.ZodNumber;
154
+ }, z.core.$strip>;
155
+ export type CloudPing = z.infer<typeof cloudPing>;
156
+ /** Immediate bridge answer to a `CloudPing`, `ts_ms` echoed unchanged. */
157
+ export declare const bridgePong: z.ZodObject<{
158
+ type: z.ZodLiteral<"pong">;
159
+ ts_ms: z.ZodNumber;
160
+ }, z.core.$strip>;
161
+ export type BridgePong = z.infer<typeof bridgePong>;
162
+ /**
163
+ * The published configuration, cloud → bridge (spec §4.1: the bridge applies
164
+ * the published version). Sent right after `hello_ok` and again on every
165
+ * publish, so a bridge never has to ask.
166
+ *
167
+ * `version: 0` with an empty document means *nothing published yet* — a fresh
168
+ * robot, not an error.
169
+ */
170
+ /**
171
+ * Cloud → bridge: the configuration to apply.
172
+ *
173
+ * **`doc` is the whole of it.** Camera credentials travel inline in
174
+ * `doc.cameras[].source`, per `config.ts`'s `cameraCredentials` — there is no
175
+ * side channel any more. That was a deliberate, recorded trade-off: a
176
+ * password here is in every published version, and those are immutable. The
177
+ * bound on that decision is elsewhere and load-bearing — the publish audit
178
+ * event and the org event stream must not carry the document body.
179
+ *
180
+ * **The bridge does not persist configuration.** It holds this frame in
181
+ * memory and is sent it again on every reconnect, and that is the only thing
182
+ * keeping camera passwords off the robot's disk. The retired side channel
183
+ * carried this warning with an escape hatch attached — cache the config, just
184
+ * exclude the `credentials` field. There is no such field now: the secrets are
185
+ * inside `doc`, so caching the configuration caches the passwords, with
186
+ * nothing left to leave out. The warning survives its own mechanism, narrower
187
+ * and harder to satisfy than when it was written.
188
+ */
189
+ export declare const cloudConfig: z.ZodObject<{
190
+ type: z.ZodLiteral<"config">;
191
+ version: z.ZodNumber;
192
+ doc: z.ZodObject<{
193
+ fleetless: z.ZodLiteral<1>;
194
+ messages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
195
+ datapoints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
196
+ topic: z.ZodString;
197
+ type: z.ZodString;
198
+ field: z.ZodOptional<z.ZodString>;
199
+ rate_throttle_hz: z.ZodOptional<z.ZodNumber>;
200
+ description: z.ZodOptional<z.ZodString>;
201
+ numeric: z.ZodOptional<z.ZodObject<{
202
+ scale: z.ZodOptional<z.ZodNumber>;
203
+ offset: z.ZodOptional<z.ZodNumber>;
204
+ unit: z.ZodOptional<z.ZodString>;
205
+ decimals: z.ZodOptional<z.ZodNumber>;
206
+ }, z.core.$strict>>;
207
+ retention: z.ZodOptional<z.ZodObject<{
208
+ enabled: z.ZodOptional<z.ZodBoolean>;
209
+ interval_seconds: z.ZodOptional<z.ZodNumber>;
210
+ max_buffer_values: z.ZodOptional<z.ZodNumber>;
211
+ }, z.core.$strict>>;
212
+ chart: z.ZodOptional<z.ZodObject<{
213
+ y_min: z.ZodOptional<z.ZodNumber>;
214
+ y_max: z.ZodOptional<z.ZodNumber>;
215
+ style: z.ZodOptional<z.ZodEnum<{
216
+ line: "line";
217
+ step: "step";
218
+ }>>;
219
+ default_window_minutes: z.ZodOptional<z.ZodNumber>;
220
+ }, z.core.$strict>>;
221
+ alerts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
222
+ condition: z.ZodObject<{
223
+ fire_at: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean]>;
224
+ resolve_at: z.ZodOptional<z.ZodNumber>;
225
+ }, z.core.$strict>;
226
+ severity: z.ZodOptional<z.ZodEnum<{
227
+ error: "error";
228
+ warning: "warning";
229
+ }>>;
230
+ name: z.ZodOptional<z.ZodString>;
231
+ enabled: z.ZodOptional<z.ZodBoolean>;
232
+ }, z.core.$strict>>>;
233
+ }, z.core.$strict>>>;
234
+ actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
235
+ ros_name: z.ZodString;
236
+ type: z.ZodString;
237
+ message: z.ZodOptional<z.ZodUnknown>;
238
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
239
+ type: z.ZodEnum<{
240
+ string: "string";
241
+ bool: "bool";
242
+ byte: "byte";
243
+ char: "char";
244
+ int8: "int8";
245
+ uint8: "uint8";
246
+ int16: "int16";
247
+ uint16: "uint16";
248
+ int32: "int32";
249
+ uint32: "uint32";
250
+ int64: "int64";
251
+ uint64: "uint64";
252
+ float32: "float32";
253
+ float64: "float64";
254
+ wstring: "wstring";
255
+ }>;
256
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean]>>;
257
+ min_value: z.ZodOptional<z.ZodNumber>;
258
+ max_value: z.ZodOptional<z.ZodNumber>;
259
+ enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
260
+ regex: z.ZodOptional<z.ZodString>;
261
+ description: z.ZodOptional<z.ZodString>;
262
+ }, z.core.$strict>>>;
263
+ description: z.ZodOptional<z.ZodString>;
264
+ }, z.core.$strict>>>;
265
+ services: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
266
+ ros_name: z.ZodString;
267
+ type: z.ZodString;
268
+ message: z.ZodOptional<z.ZodUnknown>;
269
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
270
+ type: z.ZodEnum<{
271
+ string: "string";
272
+ bool: "bool";
273
+ byte: "byte";
274
+ char: "char";
275
+ int8: "int8";
276
+ uint8: "uint8";
277
+ int16: "int16";
278
+ uint16: "uint16";
279
+ int32: "int32";
280
+ uint32: "uint32";
281
+ int64: "int64";
282
+ uint64: "uint64";
283
+ float32: "float32";
284
+ float64: "float64";
285
+ wstring: "wstring";
286
+ }>;
287
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean]>>;
288
+ min_value: z.ZodOptional<z.ZodNumber>;
289
+ max_value: z.ZodOptional<z.ZodNumber>;
290
+ enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
291
+ regex: z.ZodOptional<z.ZodString>;
292
+ description: z.ZodOptional<z.ZodString>;
293
+ }, z.core.$strict>>>;
294
+ description: z.ZodOptional<z.ZodString>;
295
+ }, z.core.$strict>>>;
296
+ publishers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
297
+ topic: z.ZodString;
298
+ type: z.ZodString;
299
+ message: z.ZodUnknown;
300
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
301
+ type: z.ZodEnum<{
302
+ string: "string";
303
+ bool: "bool";
304
+ byte: "byte";
305
+ char: "char";
306
+ int8: "int8";
307
+ uint8: "uint8";
308
+ int16: "int16";
309
+ uint16: "uint16";
310
+ int32: "int32";
311
+ uint32: "uint32";
312
+ int64: "int64";
313
+ uint64: "uint64";
314
+ float32: "float32";
315
+ float64: "float64";
316
+ wstring: "wstring";
317
+ }>;
318
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean]>>;
319
+ min_value: z.ZodOptional<z.ZodNumber>;
320
+ max_value: z.ZodOptional<z.ZodNumber>;
321
+ enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
322
+ regex: z.ZodOptional<z.ZodString>;
323
+ description: z.ZodOptional<z.ZodString>;
324
+ }, z.core.$strict>>>;
325
+ failsafe: z.ZodObject<{
326
+ timeout_ms: z.ZodNumber;
327
+ message: z.ZodUnknown;
328
+ }, z.core.$strict>;
329
+ quiet_timeout_ms: z.ZodNumber;
330
+ description: z.ZodOptional<z.ZodString>;
331
+ }, z.core.$strict>>>;
332
+ cameras: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
333
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
334
+ kind: z.ZodLiteral<"ros">;
335
+ topic: z.ZodString;
336
+ type: z.ZodString;
337
+ }, z.core.$strict>, z.ZodObject<{
338
+ kind: z.ZodLiteral<"rtsp">;
339
+ url: z.ZodString;
340
+ transport: z.ZodOptional<z.ZodEnum<{
341
+ tcp: "tcp";
342
+ udp: "udp";
343
+ }>>;
344
+ credentials: z.ZodOptional<z.ZodObject<{
345
+ username: z.ZodOptional<z.ZodString>;
346
+ password: z.ZodOptional<z.ZodString>;
347
+ }, z.core.$strict>>;
348
+ }, z.core.$strict>, z.ZodObject<{
349
+ kind: z.ZodLiteral<"mjpeg">;
350
+ url: z.ZodString;
351
+ credentials: z.ZodOptional<z.ZodObject<{
352
+ username: z.ZodOptional<z.ZodString>;
353
+ password: z.ZodOptional<z.ZodString>;
354
+ }, z.core.$strict>>;
355
+ }, z.core.$strict>, z.ZodObject<{
356
+ kind: z.ZodLiteral<"v4l2">;
357
+ device: z.ZodString;
358
+ }, z.core.$strict>], "kind">;
359
+ width: z.ZodNumber;
360
+ height: z.ZodNumber;
361
+ fps: z.ZodNumber;
362
+ bitrate_kbps: z.ZodNumber;
363
+ snapshot_interval_seconds: z.ZodNumber;
364
+ description: z.ZodOptional<z.ZodString>;
365
+ }, z.core.$strict>>>;
366
+ }, z.core.$strict>;
367
+ }, z.core.$strip>;
368
+ export type CloudConfig = z.infer<typeof cloudConfig>;
369
+ /**
370
+ * What the bridge made of it. A single unusable entry must never stop the
371
+ * others: the bridge applies what it can, reports the rest per slug, and
372
+ * sets `ok: false`. The console shows this as "published v2 · applied v1".
373
+ */
374
+ export declare const bridgeConfigApplied: z.ZodObject<{
375
+ type: z.ZodLiteral<"config_applied">;
376
+ version: z.ZodNumber;
377
+ ok: z.ZodBoolean;
378
+ errors: z.ZodArray<z.ZodObject<{
379
+ slug: z.ZodString;
380
+ kind: z.ZodEnum<{
381
+ datapoint: "datapoint";
382
+ action: "action";
383
+ service: "service";
384
+ publisher: "publisher";
385
+ camera: "camera";
386
+ }>;
387
+ code: z.ZodString;
388
+ message: z.ZodString;
389
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
390
+ }, z.core.$strip>>;
391
+ }, z.core.$strip>;
392
+ export type BridgeConfigApplied = z.infer<typeof bridgeConfigApplied>;
393
+ /**
394
+ * Commands, cloud → bridge (spec §6.1, §11.3). The **cloud** mints the
395
+ * `job_id` before the bridge is asked to do anything, so a job exists —
396
+ * and can be reported `lost` — even if the answer never comes back.
397
+ */
398
+ export declare const cloudInvoke: z.ZodObject<{
399
+ type: z.ZodLiteral<"invoke">;
400
+ job_id: z.ZodUUID;
401
+ slug: z.ZodString;
402
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
403
+ patience_ms: z.ZodNumber;
404
+ }, z.core.$strip>;
405
+ export type CloudInvoke = z.infer<typeof cloudInvoke>;
406
+ /**
407
+ * Cancel — the bridge must issue a real ROS goal cancel (§11.3).
408
+ *
409
+ * `slug` stays, and stays required: it is how the bridge finds the tracker,
410
+ * and it is what a cancel with no id means.
411
+ *
412
+ * `job_id` is what W6b adds, and what makes a cancel say *which* job. Without
413
+ * it a cancel arriving a moment after one job ended and another began on the
414
+ * same slug stops the **new** one — the caller asked to stop something that
415
+ * had already finished and stopped a machine that had just started moving.
416
+ * That is not a race anybody had to lose: the caller knew the id, and the
417
+ * wire had nowhere to put it.
418
+ *
419
+ * `null` keeps today's meaning and must be read as exactly that: *cancel
420
+ * whatever is running on this slug*. It is a real request — an operator
421
+ * hitting stop wants the robot stopped, not a lecture about job identity —
422
+ * and it stays available for that. A bridge given an id that does not match
423
+ * what is running cancels **nothing** and says so; it must not fall back to
424
+ * the slug, because a caller who named an id has ruled that out.
425
+ */
426
+ export declare const cloudCancel: z.ZodObject<{
427
+ type: z.ZodLiteral<"cancel">;
428
+ slug: z.ZodString;
429
+ job_id: z.ZodNullable<z.ZodUUID>;
430
+ }, z.core.$strip>;
431
+ export type CloudCancel = z.infer<typeof cloudCancel>;
432
+ export declare const cloudPublish: z.ZodObject<{
433
+ type: z.ZodLiteral<"publish">;
434
+ slug: z.ZodString;
435
+ message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
436
+ }, z.core.$strip>;
437
+ export type CloudPublish = z.infer<typeof cloudPublish>;
438
+ /**
439
+ * Progress on a job, bridge → cloud. `timestamp_ms` is capture time, so a
440
+ * burst delivered late after a reconnect is visibly late (§6.3).
441
+ */
442
+ export declare const bridgeJobUpdate: z.ZodObject<{
443
+ type: z.ZodLiteral<"job_update">;
444
+ job_id: z.ZodUUID;
445
+ slug: z.ZodString;
446
+ state: z.ZodEnum<{
447
+ failed: "failed";
448
+ running: "running";
449
+ succeeded: "succeeded";
450
+ cancelled: "cancelled";
451
+ lost: "lost";
452
+ }>;
453
+ feedback: z.ZodNullable<z.ZodUnknown>;
454
+ progress: z.ZodNullable<z.ZodNumber>;
455
+ result: z.ZodNullable<z.ZodUnknown>;
456
+ error: z.ZodNullable<z.ZodObject<{
457
+ code: z.ZodString;
458
+ message: z.ZodString;
459
+ details: z.ZodOptional<z.ZodUnknown>;
460
+ }, z.core.$strip>>;
461
+ timestamp_ms: z.ZodNumber;
462
+ }, z.core.$strip>;
463
+ export type BridgeJobUpdate = z.infer<typeof bridgeJobUpdate>;
464
+ /**
465
+ * Jobs the bridge can no longer account for **while connected** (§6.1) — a
466
+ * tracker dropped, an action server that vanished mid-goal, anything where
467
+ * the honest answer is "I lost this" rather than a state.
468
+ *
469
+ * The restart case is not this frame's job: a restarted bridge has nothing
470
+ * left to enumerate, so it is `hello.active_job_ids` that closes that gap.
471
+ * Both paths end in the same place — the cloud publishes `lost` rather than
472
+ * leaving a job reading "running" because nobody contradicted it.
473
+ */
474
+ export declare const bridgeJobLost: z.ZodObject<{
475
+ type: z.ZodLiteral<"job_lost">;
476
+ job_ids: z.ZodArray<z.ZodUUID>;
477
+ }, z.core.$strip>;
478
+ export type BridgeJobLost = z.infer<typeof bridgeJobLost>;
479
+ /** Cloud asks for a fresh ROS graph; `request_id` correlates the answer. */
480
+ export declare const cloudIntrospectRequest: z.ZodObject<{
481
+ type: z.ZodLiteral<"introspect_request">;
482
+ request_id: z.ZodString;
483
+ }, z.core.$strip>;
484
+ export type CloudIntrospectRequest = z.infer<typeof cloudIntrospectRequest>;
485
+ /** The graph snapshot, bridge → cloud. */
486
+ export declare const bridgeIntrospect: z.ZodObject<{
487
+ type: z.ZodLiteral<"introspect">;
488
+ request_id: z.ZodString;
489
+ graph: z.ZodObject<{
490
+ topics: z.ZodArray<z.ZodObject<{
491
+ name: z.ZodString;
492
+ types: z.ZodArray<z.ZodString>;
493
+ }, z.core.$strip>>;
494
+ services: z.ZodArray<z.ZodObject<{
495
+ name: z.ZodString;
496
+ types: z.ZodArray<z.ZodString>;
497
+ }, z.core.$strip>>;
498
+ actions: z.ZodArray<z.ZodObject<{
499
+ name: z.ZodString;
500
+ types: z.ZodArray<z.ZodString>;
501
+ }, z.core.$strip>>;
502
+ captured_at_ms: z.ZodNumber;
503
+ }, z.core.$strip>;
504
+ }, z.core.$strip>;
505
+ export type BridgeIntrospect = z.infer<typeof bridgeIntrospect>;
506
+ /**
507
+ * Field trees are fetched on demand, not shipped with the graph: a robot with
508
+ * hundreds of topics would otherwise push hundreds of kilobytes on every
509
+ * refresh, for types nobody opened.
510
+ */
511
+ export declare const cloudTypeRequest: z.ZodObject<{
512
+ type: z.ZodLiteral<"type_request">;
513
+ request_id: z.ZodString;
514
+ type_names: z.ZodArray<z.ZodString>;
515
+ }, z.core.$strip>;
516
+ export type CloudTypeRequest = z.infer<typeof cloudTypeRequest>;
517
+ /**
518
+ * The resolved definitions. Names the bridge cannot resolve in its sourced
519
+ * workspace are listed in `unresolved` — an unknown type is an answer, not a
520
+ * failed frame.
521
+ */
522
+ export declare const bridgeTypeDefinitions: z.ZodObject<{
523
+ type: z.ZodLiteral<"type_definitions">;
524
+ request_id: z.ZodString;
525
+ definitions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
526
+ name: z.ZodString;
527
+ kind: z.ZodLiteral<"msg">;
528
+ fields: z.ZodArray<z.ZodType<import("./introspection.js").TypeField, unknown, z.core.$ZodTypeInternals<import("./introspection.js").TypeField, unknown>>>;
529
+ }, z.core.$strip>, z.ZodObject<{
530
+ name: z.ZodString;
531
+ kind: z.ZodLiteral<"srv">;
532
+ request: z.ZodArray<z.ZodType<import("./introspection.js").TypeField, unknown, z.core.$ZodTypeInternals<import("./introspection.js").TypeField, unknown>>>;
533
+ response: z.ZodArray<z.ZodType<import("./introspection.js").TypeField, unknown, z.core.$ZodTypeInternals<import("./introspection.js").TypeField, unknown>>>;
534
+ }, z.core.$strip>, z.ZodObject<{
535
+ name: z.ZodString;
536
+ kind: z.ZodLiteral<"action">;
537
+ goal: z.ZodArray<z.ZodType<import("./introspection.js").TypeField, unknown, z.core.$ZodTypeInternals<import("./introspection.js").TypeField, unknown>>>;
538
+ result: z.ZodArray<z.ZodType<import("./introspection.js").TypeField, unknown, z.core.$ZodTypeInternals<import("./introspection.js").TypeField, unknown>>>;
539
+ feedback: z.ZodArray<z.ZodType<import("./introspection.js").TypeField, unknown, z.core.$ZodTypeInternals<import("./introspection.js").TypeField, unknown>>>;
540
+ }, z.core.$strip>], "kind">>;
541
+ unresolved: z.ZodArray<z.ZodString>;
542
+ }, z.core.$strip>;
543
+ export type BridgeTypeDefinitions = z.infer<typeof bridgeTypeDefinitions>;
544
+ /**
545
+ * The built-in `bridge_state` datapoint every robot has (spec §4.3):
546
+ * connection status plus latency, the basis for offline-aware client UIs.
547
+ */
548
+ export declare const bridgeState: z.ZodObject<{
549
+ online: z.ZodBoolean;
550
+ latency_ms: z.ZodNullable<z.ZodNumber>;
551
+ }, z.core.$strip>;
552
+ export type BridgeState = z.infer<typeof bridgeState>;
553
+ /**
554
+ * The built-in `bridge_pressure` datapoint (spec §4.3, the pressure-telemetry
555
+ * design's "The decision that shapes everything"): the bridge's own
556
+ * bandwidth-shaping state, sent on the same reserved-slug path as
557
+ * `bridge_state` so history, realtime, REST and MCP exposure fall out of the
558
+ * ordinary datapoint machinery for free.
559
+ */
560
+ export declare const bridgePressure: z.ZodObject<{
561
+ link: z.ZodObject<{
562
+ rate_bps: z.ZodNullable<z.ZodNumber>;
563
+ snapshot_max_bytes: z.ZodNumber;
564
+ }, z.core.$strip>;
565
+ tiers: z.ZodObject<{
566
+ '0': z.ZodOptional<z.ZodObject<{
567
+ sent: z.ZodNumber;
568
+ bytes: z.ZodNumber;
569
+ drops: z.ZodNumber;
570
+ high_water: z.ZodNumber;
571
+ }, z.core.$strip>>;
572
+ '1': z.ZodOptional<z.ZodObject<{
573
+ sent: z.ZodNumber;
574
+ bytes: z.ZodNumber;
575
+ drops: z.ZodNumber;
576
+ high_water: z.ZodNumber;
577
+ }, z.core.$strip>>;
578
+ '2': z.ZodOptional<z.ZodObject<{
579
+ sent: z.ZodNumber;
580
+ bytes: z.ZodNumber;
581
+ drops: z.ZodNumber;
582
+ high_water: z.ZodNumber;
583
+ }, z.core.$strip>>;
584
+ '3': z.ZodOptional<z.ZodObject<{
585
+ sent: z.ZodNumber;
586
+ bytes: z.ZodNumber;
587
+ drops: z.ZodNumber;
588
+ high_water: z.ZodNumber;
589
+ }, z.core.$strip>>;
590
+ '4': z.ZodOptional<z.ZodObject<{
591
+ sent: z.ZodNumber;
592
+ bytes: z.ZodNumber;
593
+ drops: z.ZodNumber;
594
+ high_water: z.ZodNumber;
595
+ }, z.core.$strip>>;
596
+ '5': z.ZodOptional<z.ZodObject<{
597
+ sent: z.ZodNumber;
598
+ bytes: z.ZodNumber;
599
+ drops: z.ZodNumber;
600
+ high_water: z.ZodNumber;
601
+ }, z.core.$strip>>;
602
+ }, z.core.$strict>;
603
+ video: z.ZodObject<{
604
+ active_streams: z.ZodNumber;
605
+ bitrate_sum_kbps: z.ZodNumber;
606
+ uplink_kbps: z.ZodNullable<z.ZodNumber>;
607
+ override_kbps: z.ZodNullable<z.ZodNumber>;
608
+ video_budget_kbps: z.ZodNullable<z.ZodNumber>;
609
+ reserve_kbps: z.ZodNumber;
610
+ }, z.core.$strip>;
611
+ }, z.core.$strip>;
612
+ export type BridgePressure = z.infer<typeof bridgePressure>;
613
+ export declare const PRESSURE_SLUG: "bridge_pressure";
614
+ /**
615
+ * The header of a **binary** snapshot frame, bridge → cloud.
616
+ *
617
+ * A snapshot frame is laid out as:
618
+ *
619
+ * [4-byte big-endian header length][UTF-8 JSON header][image bytes]
620
+ *
621
+ * Binary rather than base64 in a text frame, because base64 costs a third of
622
+ * the robot's upstream for nothing. Self-contained rather than a JSON frame
623
+ * followed by a binary one, because that pairing would depend on frame
624
+ * ordering — and W4 established, at some cost, that ordering across a socket
625
+ * is not something to lean on.
626
+ *
627
+ * `timestamp_ms` is the bridge's **capture** time (§6.3), which is what lets
628
+ * every consumer state a snapshot's true age. A picture that lies about when
629
+ * it was taken is this wave's version of a job that reads "running" when
630
+ * nobody knows.
631
+ */
632
+ /**
633
+ * The largest a snapshot frame — header and image bytes together — may be on
634
+ * the `/bridge` socket.
635
+ *
636
+ * This is a **byte** bound and not a pixel one, deliberately. A camera's
637
+ * `width`/`height` govern the *live* stream, which travels through LiveKit
638
+ * and never touches this socket, so capping resolution to protect the socket
639
+ * would cost live quality to solve a snapshot problem.
640
+ *
641
+ * The bound exists because exceeding it is not a dropped frame: `ws` enforces
642
+ * its payload limit before the frame is ever delivered and closes the
643
+ * connection with 1009 — taking datapoints, jobs, commands and configuration
644
+ * down with it. The bridge would then reconnect, receive the same
645
+ * configuration, capture the same frame and be closed again: a robot that
646
+ * will not stay online, from a configuration the platform accepted. Measured
647
+ * during the W5 review, a 4K JPEG of real camera content lands around
648
+ * 2.2 MiB and 1080p on a noisy scene within 40% of this number, so the margin
649
+ * is thinner than it looks.
650
+ *
651
+ * **The bridge must degrade rather than exceed it** — lower JPEG quality,
652
+ * then downscale, and if it still does not fit, skip the frame and say so.
653
+ * A missing snapshot is a gap, and this wave already established that a gap
654
+ * is an honest answer; a closed socket is not.
655
+ */
656
+ export declare const SNAPSHOT_MAX_BYTES = 1572864;
657
+ export declare const snapshotHeader: z.ZodObject<{
658
+ type: z.ZodLiteral<"snapshot">;
659
+ slug: z.ZodString;
660
+ mime: z.ZodString;
661
+ width: z.ZodNumber;
662
+ height: z.ZodNumber;
663
+ timestamp_ms: z.ZodNumber;
664
+ }, z.core.$strip>;
665
+ export type SnapshotHeader = z.infer<typeof snapshotHeader>;
666
+ /**
667
+ * Cloud → bridge: start publishing this camera live.
668
+ *
669
+ * The **cloud** mints the room and the publisher token, for the same reason
670
+ * it mints a `job_id` before asking anything (§6.1): the side that owns the
671
+ * refcount must own the identity of the stream, or a robot could end up
672
+ * publishing into a room nobody is watching.
673
+ */
674
+ export declare const cloudCameraStart: z.ZodObject<{
675
+ type: z.ZodLiteral<"camera_start">;
676
+ slug: z.ZodString;
677
+ url: z.ZodString;
678
+ room: z.ZodString;
679
+ token: z.ZodString;
680
+ request_id: z.ZodString;
681
+ }, z.core.$strip>;
682
+ export type CloudCameraStart = z.infer<typeof cloudCameraStart>;
683
+ /** Cloud → bridge: the last viewer left; stop publishing (§10 refcount). */
684
+ /**
685
+ * Assets (spec §4.6, W7): the bridge **reports availability and transfers
686
+ * nothing** until asked.
687
+ *
688
+ * **The bytes never travel on this socket.** `server.ts` caps a frame at
689
+ * 2 MiB, a single mesh exceeds that routinely, and raising the cap is already
690
+ * tied to W8's rate limiting in the deferral register because it amplifies an
691
+ * unauthenticated path. So the socket carries the *conversation* — what exists,
692
+ * transfer this, here is how far I got — and the bytes go over HTTP with the
693
+ * robot's own credential.
694
+ *
695
+ * That split is the whole design: a 40 MB mesh cannot stall the frames that
696
+ * keep a robot answerable, and a failed upload cannot take the control channel
697
+ * down with it.
698
+ */
699
+ export declare const bridgeAssetsAvailable: z.ZodObject<{
700
+ type: z.ZodLiteral<"assets_available">;
701
+ urdf: z.ZodBoolean;
702
+ meshes: z.ZodArray<z.ZodString>;
703
+ }, z.core.$strip>;
704
+ export type BridgeAssetsAvailable = z.infer<typeof bridgeAssetsAvailable>;
705
+ /**
706
+ * The explicit request §4.6 requires — nothing moves without it.
707
+ *
708
+ * The upload credential is minted per sync and travels here rather than being
709
+ * derived from the robot token: it is scoped to one robot's assets and one
710
+ * sync, so a bridge cannot be talked into uploading somewhere else, and an
711
+ * expired one fails a sync instead of failing a robot.
712
+ */
713
+ export declare const cloudAssetRequest: z.ZodObject<{
714
+ type: z.ZodLiteral<"asset_request">;
715
+ sync_id: z.ZodUUID;
716
+ upload_url: z.ZodURL;
717
+ token: z.ZodString;
718
+ meshes: z.ZodArray<z.ZodString>;
719
+ }, z.core.$strip>;
720
+ export type CloudAssetRequest = z.infer<typeof cloudAssetRequest>;
721
+ /**
722
+ * How far a sync got, and — required, not optional — what it could not do.
723
+ *
724
+ * `failed` carries the URIs that did not resolve. A sync that quietly drops
725
+ * three meshes and reports success moves the failure into somebody else's
726
+ * renderer, where it appears as a robot with missing limbs and no cause.
727
+ */
728
+ export declare const bridgeAssetProgress: z.ZodObject<{
729
+ type: z.ZodLiteral<"asset_progress">;
730
+ sync_id: z.ZodUUID;
731
+ done: z.ZodNumber;
732
+ total: z.ZodNumber;
733
+ failed: z.ZodArray<z.ZodObject<{
734
+ reference: z.ZodString;
735
+ kind: z.ZodEnum<{
736
+ unresolvable: "unresolvable";
737
+ upload_failed: "upload_failed";
738
+ refused: "refused";
739
+ too_large: "too_large";
740
+ }>;
741
+ details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
742
+ limit_bytes: z.ZodNumber;
743
+ size_bytes: z.ZodNumber;
744
+ }, z.core.$strip>>>;
745
+ }, z.core.$strip>>;
746
+ state: z.ZodEnum<{
747
+ running: "running";
748
+ finished: "finished";
749
+ refused_busy: "refused_busy";
750
+ }>;
751
+ }, z.core.$strip>;
752
+ export type BridgeAssetProgress = z.infer<typeof bridgeAssetProgress>;
753
+ export declare const cloudCameraStop: z.ZodObject<{
754
+ type: z.ZodLiteral<"camera_stop">;
755
+ slug: z.ZodString;
756
+ request_id: z.ZodString;
757
+ }, z.core.$strip>;
758
+ export type CloudCameraStop = z.infer<typeof cloudCameraStop>;
759
+ /**
760
+ * What the bridge made of it. `publishing: false` with an `error` is how a
761
+ * camera that cannot start says so — the cloud must not leave a viewer
762
+ * watching a black rectangle while believing the stream is live.
763
+ */
764
+ export declare const bridgeCameraState: z.ZodObject<{
765
+ type: z.ZodLiteral<"camera_state">;
766
+ slug: z.ZodString;
767
+ publishing: z.ZodBoolean;
768
+ error: z.ZodNullable<z.ZodObject<{
769
+ code: z.ZodString;
770
+ message: z.ZodString;
771
+ }, z.core.$strip>>;
772
+ cause: z.ZodEnum<{
773
+ source: "source";
774
+ command: "command";
775
+ config_change: "config_change";
776
+ live_lost: "live_lost";
777
+ }>;
778
+ observed_at_ms: z.ZodNumber;
779
+ request_id: z.ZodNullable<z.ZodString>;
780
+ }, z.core.$strip>;
781
+ export type BridgeCameraState = z.infer<typeof bridgeCameraState>;