@fleetless/sdk 4.0.0 → 4.2.0-next.1

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.
package/dist/index.d.cts CHANGED
@@ -63,6 +63,23 @@ declare const mcpRobotDatasheet: z.ZodObject<{
63
63
  }, z.core.$strip>;
64
64
  type McpRobotDatasheet = z.infer<typeof mcpRobotDatasheet>;
65
65
 
66
+ /**
67
+ * The ROS 2 `action_msgs/srv/CancelGoal` return codes: `0` `ERROR_NONE` (the
68
+ * server accepted the cancel request), `1` `ERROR_REJECTED` (it refused),
69
+ * `2` `ERROR_UNKNOWN_GOAL_ID`, `3` `ERROR_GOAL_TERMINATED` (the goal had
70
+ * already ended). An accepted request is not an ended goal: whether the goal
71
+ * ends, and how, is what the action's status reports afterwards, and reaches
72
+ * the cloud as the goal's `job_update`.
73
+ */
74
+ declare const CANCEL_RETURN_CODES: {
75
+ readonly none: 0;
76
+ readonly rejected: 1;
77
+ readonly unknown_goal_id: 2;
78
+ readonly goal_terminated: 3;
79
+ };
80
+ declare const cancelReturnCode: z.ZodNumber;
81
+ type CancelReturnCode$1 = z.infer<typeof cancelReturnCode>;
82
+
66
83
 
67
84
  /**
68
85
  * Jobs: one running unit of work on a robot — an action
@@ -74,14 +91,20 @@ type McpRobotDatasheet = z.infer<typeof mcpRobotDatasheet>;
74
91
  * 1. **State is observed by slug, not by id.** The id is informative; a client
75
92
  * watches `robot × slug` and sees whatever job is running there, which is
76
93
  * also why every observer of a slug sees the same job.
77
- * 2. **`lost` is a real outcome and must be said out loud.** Job state
78
- * lives only in the bridge's memory; if it restarts mid-job, the results
79
- * are gone. The cloud then marks the job `lost` — never leaves it reading
80
- * "running" because nobody contradicted it. A system that reports a
81
- * machine is still working when it does not know is worse than one that
82
- * admits it lost track.
94
+ * 2. **What the cloud does not know it calls `unknown`, and `lost` is final.**
95
+ * A job whose robot went quiet — offline past `JOB_OFFLINE_GRACE_MS`, or
96
+ * connected but silent past `JOB_HEARTBEAT_TIMEOUT_MS` — is `unknown`: not
97
+ * terminal, the slug stays occupied, and only a statement of the bridge
98
+ * resolves it (it is running, it ended, or the bridge does not know it and
99
+ * nothing else runs on its action). `lost` is what that last statement
100
+ * produces, and nothing ever leaves it. Neither is left reading "running"
101
+ * because nobody contradicted it: a system that reports a machine is still
102
+ * working when it does not know is worse than one that says so — and one
103
+ * that declares work lost on a guess is wrong the moment the robot comes
104
+ * back and says it finished.
83
105
  */
84
106
  declare const jobState: z.ZodEnum<{
107
+ unknown: "unknown";
85
108
  failed: "failed";
86
109
  running: "running";
87
110
  succeeded: "succeeded";
@@ -89,17 +112,42 @@ declare const jobState: z.ZodEnum<{
89
112
  lost: "lost";
90
113
  }>;
91
114
  type JobState = z.infer<typeof jobState>;
115
+ /**
116
+ * Who started a job.
117
+ *
118
+ * `fleetless` for every job the cloud minted from an invocation. `external`
119
+ * for a goal the bridge found active on a published action without having
120
+ * sent it — started by anyone else on the robot's ROS graph, or the bridge's
121
+ * own goal after its mapping was lost. An external job has the same shape,
122
+ * states, live stream and cancel as any other, but no parameters (ROS 2
123
+ * publishes a goal's request nowhere), no starter, and it lives in memory
124
+ * only: it is never written to `job_runs` and never counts towards quotas.
125
+ */
126
+ declare const jobOrigin: z.ZodEnum<{
127
+ fleetless: "fleetless";
128
+ external: "external";
129
+ }>;
130
+ type JobOrigin$1 = z.infer<typeof jobOrigin>;
131
+ /**
132
+ * One job, as the cloud tells every client about it — a Fleetless job or an
133
+ * external goal alike, told apart only by `origin`.
134
+ */
92
135
  declare const job: z.ZodObject<{
93
136
  id: z.ZodUUID;
94
137
  robot_id: z.ZodUUID;
95
138
  slug: z.ZodString;
96
139
  state: z.ZodEnum<{
140
+ unknown: "unknown";
97
141
  failed: "failed";
98
142
  running: "running";
99
143
  succeeded: "succeeded";
100
144
  cancelled: "cancelled";
101
145
  lost: "lost";
102
146
  }>;
147
+ origin: z.ZodEnum<{
148
+ fleetless: "fleetless";
149
+ external: "external";
150
+ }>;
103
151
  started_at: z.ZodISODateTime;
104
152
  updated_at: z.ZodISODateTime;
105
153
  seq: z.ZodNumber;
@@ -129,12 +177,17 @@ declare const jobEvent: z.ZodObject<{
129
177
  robot_id: z.ZodUUID;
130
178
  slug: z.ZodString;
131
179
  state: z.ZodEnum<{
180
+ unknown: "unknown";
132
181
  failed: "failed";
133
182
  running: "running";
134
183
  succeeded: "succeeded";
135
184
  cancelled: "cancelled";
136
185
  lost: "lost";
137
186
  }>;
187
+ origin: z.ZodEnum<{
188
+ fleetless: "fleetless";
189
+ external: "external";
190
+ }>;
138
191
  started_at: z.ZodISODateTime;
139
192
  updated_at: z.ZodISODateTime;
140
193
  seq: z.ZodNumber;
@@ -153,6 +206,11 @@ type JobEvent = z.infer<typeof jobEvent>;
153
206
  /**
154
207
  * What a busy refusal tells the caller: what is already running. A refusal that
155
208
  * only says "busy" forces the caller to guess whether to wait or to give up.
209
+ *
210
+ * `running` is whatever occupies the slug — a `running` job, an `unknown` one
211
+ * the robot has not accounted for yet, or an `external` goal someone else
212
+ * started — and its `state` and `origin` say which, so a caller can tell
213
+ * "wait for it" from "cancel what someone else started".
156
214
  */
157
215
  declare const busyDetails: z.ZodObject<{
158
216
  running: z.ZodObject<{
@@ -160,12 +218,17 @@ declare const busyDetails: z.ZodObject<{
160
218
  robot_id: z.ZodUUID;
161
219
  slug: z.ZodString;
162
220
  state: z.ZodEnum<{
221
+ unknown: "unknown";
163
222
  failed: "failed";
164
223
  running: "running";
165
224
  succeeded: "succeeded";
166
225
  cancelled: "cancelled";
167
226
  lost: "lost";
168
227
  }>;
228
+ origin: z.ZodEnum<{
229
+ fleetless: "fleetless";
230
+ external: "external";
231
+ }>;
169
232
  started_at: z.ZodISODateTime;
170
233
  updated_at: z.ZodISODateTime;
171
234
  seq: z.ZodNumber;
@@ -194,6 +257,7 @@ declare const jobRun: z.ZodObject<{
194
257
  service: "service";
195
258
  }>;
196
259
  state: z.ZodEnum<{
260
+ unknown: "unknown";
197
261
  failed: "failed";
198
262
  running: "running";
199
263
  succeeded: "succeeded";
@@ -234,6 +298,7 @@ declare const jobRunListResponse: z.ZodObject<{
234
298
  service: "service";
235
299
  }>;
236
300
  state: z.ZodEnum<{
301
+ unknown: "unknown";
237
302
  failed: "failed";
238
303
  running: "running";
239
304
  succeeded: "succeeded";
@@ -761,12 +826,31 @@ declare const parameterInvalidDetails: z.ZodObject<{
761
826
  }, z.core.$strip>>;
762
827
  }, z.core.$strip>;
763
828
  type ParameterInvalidDetails = z.infer<typeof parameterInvalidDetails>;
829
+ /**
830
+ * The `details` of a `cancel_rejected` refusal: every goal the cancel reached,
831
+ * accepted ones included, each with the `CancelGoal` return code its action
832
+ * server answered — compare `return_code` against `CANCEL_RETURN_CODES`
833
+ * (`none`, `rejected`, `unknown_goal_id`, `goal_terminated`); it is `null`
834
+ * when that goal's server did not answer within the bridge's bound. Always at
835
+ * least one goal: the cloud refuses a cancel only because a goal's server
836
+ * answered `ERROR_REJECTED`. Pinned here for the reason
837
+ * `parameterInvalidDetails` is: a caller parses it instead of reading the
838
+ * shape from prose.
839
+ */
840
+ declare const cancelRejectedDetails: z.ZodObject<{
841
+ goals: z.ZodArray<z.ZodObject<{
842
+ job_id: z.ZodUUID;
843
+ goal_id: z.ZodString;
844
+ return_code: z.ZodNullable<z.ZodNumber>;
845
+ }, z.core.$strip>>;
846
+ }, z.core.$strip>;
847
+ type CancelRejectedDetails = z.infer<typeof cancelRejectedDetails>;
764
848
  /**
765
849
  * The codes in use today. The wire deliberately allows any string — this
766
850
  * list is the shared vocabulary, not a closed set, so a new refusal never
767
851
  * needs a contracts release before it can be reported honestly.
768
852
  */
769
- declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "job_lost", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "target_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired"];
853
+ declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "target_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired"];
770
854
  type ErrorCode = (typeof ERROR_CODES)[number];
771
855
 
772
856
  /**
@@ -1019,6 +1103,17 @@ interface JobSubscription {
1019
1103
  unsubscribe(): void;
1020
1104
  }
1021
1105
 
1106
+ /**
1107
+ * One goal's answer to a cancel: the ROS 2 `CancelGoal` return code its action
1108
+ * server sent — `0` accepted (`CANCEL_RETURN_CODES.none`), `1` refused
1109
+ * (`rejected`), `2` unknown goal (`unknown_goal_id`), `3` already ended
1110
+ * (`goal_terminated`). The type of `return_code` in `CancelRejectedDetails`,
1111
+ * where it is `null` when that goal's server did not answer. The wire shape is
1112
+ * contracts' `cancelReturnCode`; the alias exists so the reference can
1113
+ * describe it — a JSDoc on an `export type { … } from` statement does not
1114
+ * survive bundling.
1115
+ */
1116
+ type CancelReturnCode = CancelReturnCode$1;
1022
1117
  /**
1023
1118
  * Long-running work on a robot, reachable as `client.actions`. An action is
1024
1119
  * a ROS action the developer exposed under a slug: it is invoked, runs as
@@ -1059,6 +1154,27 @@ interface ActionsApi {
1059
1154
  * was nothing there", and "I stopped a job that started after I last
1060
1155
  * looked" are three different outcomes a discarded result cannot tell
1061
1156
  * apart.
1157
+ *
1158
+ * **Resolving means the robot's action server accepted the cancel, not
1159
+ * that the goal ended.** The returned job is usually still `running`; how
1160
+ * it ends arrives as its own update (`subscribe`). The platform answers
1161
+ * from the action server's `CancelGoal` return codes, so a cancel can
1162
+ * also reject with:
1163
+ * - `cancel_rejected` — the server refused (`ERROR_REJECTED`) and the goal
1164
+ * keeps running unless its job later says otherwise.
1165
+ * `cancelRejectedDetails.parse(error.details).goals` lists every goal the
1166
+ * cancel reached as `{ job_id, goal_id, return_code }`; compare
1167
+ * `return_code` against `CANCEL_RETURN_CODES`: `none` (`0`, accepted),
1168
+ * `rejected` (`1`), `unknown_goal_id` (`2`), `goal_terminated` (`3`,
1169
+ * already ended), or `null` when that goal's server did not answer.
1170
+ * - `bridge_timeout` — the robot's bridge did not answer in time; whether
1171
+ * the cancel reached the server is unknown.
1172
+ * - the bridge's own code when it could not ask at all (e.g.
1173
+ * `unknown_slug`, `action_server_lost`), `not_cancellable` for a service,
1174
+ * and `robot_offline`.
1175
+ *
1176
+ * Cancelling an `unknown` job cancels every `external` goal on its action,
1177
+ * never another of the platform's own jobs.
1062
1178
  */
1063
1179
  cancel(robotId: string, slug: string, jobId?: string | null, options?: SendCommandOptions): Promise<Job | null>;
1064
1180
  /**
@@ -2076,6 +2192,18 @@ interface DatapointsApi {
2076
2192
  }): Promise<HistorySamplesResponse>;
2077
2193
  }
2078
2194
 
2195
+ /**
2196
+ * Who started a job: `fleetless` for every job the cloud minted from an
2197
+ * invocation, `external` for a goal the bridge found active on a published
2198
+ * action without having sent it. An external job has no parameters and no
2199
+ * starter (ROS 2 publishes neither) and is never in `jobs.history`. The type
2200
+ * of `Job.origin`, which every job carries.
2201
+ *
2202
+ * The wire shape is contracts' `jobOrigin`; the alias exists so the reference
2203
+ * can describe it — a JSDoc on an `export type { … } from` statement does not
2204
+ * survive bundling.
2205
+ */
2206
+ type JobOrigin = JobOrigin$1;
2079
2207
  /**
2080
2208
  * The filters `jobs.history` reads. Every field is optional; the wire names
2081
2209
  * are snake_case and this SDK spells them the way its other options are
@@ -2087,7 +2215,7 @@ interface DatapointsApi {
2087
2215
  interface JobHistoryOptions {
2088
2216
  /** Only runs of this action or service. */
2089
2217
  slug?: string;
2090
- /** Only runs in this state: `running`, `succeeded`, `failed`, `cancelled` or `lost`. */
2218
+ /** Only runs in this state: `running`, `unknown`, `succeeded`, `failed`, `cancelled` or `lost`. */
2091
2219
  state?: JobState;
2092
2220
  /** Only `action` runs, or only `service` runs. */
2093
2221
  kind?: 'action' | 'service';
@@ -2387,4 +2515,4 @@ interface FleetlessClient {
2387
2515
  */
2388
2516
  declare function createClient(options: FleetlessClientOptions): FleetlessClient;
2389
2517
 
2390
- export { type AcceptInvitationOptions, type ActionsApi, type Asset, type AssetBytes, type AssetListResponse, type AssetsApi, type AuthApi, type BeginOidcLoginOptions, type BusyDetails, type CameraDescriptor, type CameraLiveSession, type CameraSnapshot, type CameraSnapshotMeta, type CamerasApi, type ClientIdentity, type ClientMcpInteraction, type ClientOidcErrorCode, type ClientRobotListItem, type CompleteOidcLoginOptions, type CreateMeshLoaderOptions, type CredentialSource, type DatapointEvent, type DatapointSubscription, type DatapointSubscriptionHandlers, type DatapointValue, type DatapointsApi, type FleetlessClient, type FleetlessClientConfig, type FleetlessClientOptions, FleetlessError, type FleetlessErrorCode, type FleetlessErrorOptions, type HistoryAggregation, type HistoryBucketsResponse, type HistoryOptions, type HistorySamplesResponse, InMemoryTokenStore, type InvokeOptions, type Job, type JobEvent, type JobHistoryOptions, type JobRun, type JobRunListResponse, type JobState, type JobSubscription, type JobSubscriptionHandlers, type JobsApi, type McpCapabilities, type McpConsentGrant, type McpExposure, type McpInteractionDecision, type McpRobotDatasheet, type MeshLoaderDelegate, type OidcLoginRequest, type ParameterInvalidDetails, type ParameterViolation, type PrepareUrdfSceneOptions, type ProviderButton, type PublishersApi, type RateLimitDetails, type RegisterOptions, type RobotsApi, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type StoredSession, type TokenStore, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, createClient, parameterInvalidDetails };
2518
+ export { type AcceptInvitationOptions, type ActionsApi, type Asset, type AssetBytes, type AssetListResponse, type AssetsApi, type AuthApi, type BeginOidcLoginOptions, type BusyDetails, CANCEL_RETURN_CODES, type CameraDescriptor, type CameraLiveSession, type CameraSnapshot, type CameraSnapshotMeta, type CamerasApi, type CancelRejectedDetails, type CancelReturnCode, type ClientIdentity, type ClientMcpInteraction, type ClientOidcErrorCode, type ClientRobotListItem, type CompleteOidcLoginOptions, type CreateMeshLoaderOptions, type CredentialSource, type DatapointEvent, type DatapointSubscription, type DatapointSubscriptionHandlers, type DatapointValue, type DatapointsApi, type FleetlessClient, type FleetlessClientConfig, type FleetlessClientOptions, FleetlessError, type FleetlessErrorCode, type FleetlessErrorOptions, type HistoryAggregation, type HistoryBucketsResponse, type HistoryOptions, type HistorySamplesResponse, InMemoryTokenStore, type InvokeOptions, type Job, type JobEvent, type JobHistoryOptions, type JobOrigin, type JobRun, type JobRunListResponse, type JobState, type JobSubscription, type JobSubscriptionHandlers, type JobsApi, type McpCapabilities, type McpConsentGrant, type McpExposure, type McpInteractionDecision, type McpRobotDatasheet, type MeshLoaderDelegate, type OidcLoginRequest, type ParameterInvalidDetails, type ParameterViolation, type PrepareUrdfSceneOptions, type ProviderButton, type PublishersApi, type RateLimitDetails, type RegisterOptions, type RobotsApi, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type StoredSession, type TokenStore, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, cancelRejectedDetails, createClient, parameterInvalidDetails };
package/dist/index.d.ts CHANGED
@@ -63,6 +63,23 @@ declare const mcpRobotDatasheet: z.ZodObject<{
63
63
  }, z.core.$strip>;
64
64
  type McpRobotDatasheet = z.infer<typeof mcpRobotDatasheet>;
65
65
 
66
+ /**
67
+ * The ROS 2 `action_msgs/srv/CancelGoal` return codes: `0` `ERROR_NONE` (the
68
+ * server accepted the cancel request), `1` `ERROR_REJECTED` (it refused),
69
+ * `2` `ERROR_UNKNOWN_GOAL_ID`, `3` `ERROR_GOAL_TERMINATED` (the goal had
70
+ * already ended). An accepted request is not an ended goal: whether the goal
71
+ * ends, and how, is what the action's status reports afterwards, and reaches
72
+ * the cloud as the goal's `job_update`.
73
+ */
74
+ declare const CANCEL_RETURN_CODES: {
75
+ readonly none: 0;
76
+ readonly rejected: 1;
77
+ readonly unknown_goal_id: 2;
78
+ readonly goal_terminated: 3;
79
+ };
80
+ declare const cancelReturnCode: z.ZodNumber;
81
+ type CancelReturnCode$1 = z.infer<typeof cancelReturnCode>;
82
+
66
83
 
67
84
  /**
68
85
  * Jobs: one running unit of work on a robot — an action
@@ -74,14 +91,20 @@ type McpRobotDatasheet = z.infer<typeof mcpRobotDatasheet>;
74
91
  * 1. **State is observed by slug, not by id.** The id is informative; a client
75
92
  * watches `robot × slug` and sees whatever job is running there, which is
76
93
  * also why every observer of a slug sees the same job.
77
- * 2. **`lost` is a real outcome and must be said out loud.** Job state
78
- * lives only in the bridge's memory; if it restarts mid-job, the results
79
- * are gone. The cloud then marks the job `lost` — never leaves it reading
80
- * "running" because nobody contradicted it. A system that reports a
81
- * machine is still working when it does not know is worse than one that
82
- * admits it lost track.
94
+ * 2. **What the cloud does not know it calls `unknown`, and `lost` is final.**
95
+ * A job whose robot went quiet — offline past `JOB_OFFLINE_GRACE_MS`, or
96
+ * connected but silent past `JOB_HEARTBEAT_TIMEOUT_MS` — is `unknown`: not
97
+ * terminal, the slug stays occupied, and only a statement of the bridge
98
+ * resolves it (it is running, it ended, or the bridge does not know it and
99
+ * nothing else runs on its action). `lost` is what that last statement
100
+ * produces, and nothing ever leaves it. Neither is left reading "running"
101
+ * because nobody contradicted it: a system that reports a machine is still
102
+ * working when it does not know is worse than one that says so — and one
103
+ * that declares work lost on a guess is wrong the moment the robot comes
104
+ * back and says it finished.
83
105
  */
84
106
  declare const jobState: z.ZodEnum<{
107
+ unknown: "unknown";
85
108
  failed: "failed";
86
109
  running: "running";
87
110
  succeeded: "succeeded";
@@ -89,17 +112,42 @@ declare const jobState: z.ZodEnum<{
89
112
  lost: "lost";
90
113
  }>;
91
114
  type JobState = z.infer<typeof jobState>;
115
+ /**
116
+ * Who started a job.
117
+ *
118
+ * `fleetless` for every job the cloud minted from an invocation. `external`
119
+ * for a goal the bridge found active on a published action without having
120
+ * sent it — started by anyone else on the robot's ROS graph, or the bridge's
121
+ * own goal after its mapping was lost. An external job has the same shape,
122
+ * states, live stream and cancel as any other, but no parameters (ROS 2
123
+ * publishes a goal's request nowhere), no starter, and it lives in memory
124
+ * only: it is never written to `job_runs` and never counts towards quotas.
125
+ */
126
+ declare const jobOrigin: z.ZodEnum<{
127
+ fleetless: "fleetless";
128
+ external: "external";
129
+ }>;
130
+ type JobOrigin$1 = z.infer<typeof jobOrigin>;
131
+ /**
132
+ * One job, as the cloud tells every client about it — a Fleetless job or an
133
+ * external goal alike, told apart only by `origin`.
134
+ */
92
135
  declare const job: z.ZodObject<{
93
136
  id: z.ZodUUID;
94
137
  robot_id: z.ZodUUID;
95
138
  slug: z.ZodString;
96
139
  state: z.ZodEnum<{
140
+ unknown: "unknown";
97
141
  failed: "failed";
98
142
  running: "running";
99
143
  succeeded: "succeeded";
100
144
  cancelled: "cancelled";
101
145
  lost: "lost";
102
146
  }>;
147
+ origin: z.ZodEnum<{
148
+ fleetless: "fleetless";
149
+ external: "external";
150
+ }>;
103
151
  started_at: z.ZodISODateTime;
104
152
  updated_at: z.ZodISODateTime;
105
153
  seq: z.ZodNumber;
@@ -129,12 +177,17 @@ declare const jobEvent: z.ZodObject<{
129
177
  robot_id: z.ZodUUID;
130
178
  slug: z.ZodString;
131
179
  state: z.ZodEnum<{
180
+ unknown: "unknown";
132
181
  failed: "failed";
133
182
  running: "running";
134
183
  succeeded: "succeeded";
135
184
  cancelled: "cancelled";
136
185
  lost: "lost";
137
186
  }>;
187
+ origin: z.ZodEnum<{
188
+ fleetless: "fleetless";
189
+ external: "external";
190
+ }>;
138
191
  started_at: z.ZodISODateTime;
139
192
  updated_at: z.ZodISODateTime;
140
193
  seq: z.ZodNumber;
@@ -153,6 +206,11 @@ type JobEvent = z.infer<typeof jobEvent>;
153
206
  /**
154
207
  * What a busy refusal tells the caller: what is already running. A refusal that
155
208
  * only says "busy" forces the caller to guess whether to wait or to give up.
209
+ *
210
+ * `running` is whatever occupies the slug — a `running` job, an `unknown` one
211
+ * the robot has not accounted for yet, or an `external` goal someone else
212
+ * started — and its `state` and `origin` say which, so a caller can tell
213
+ * "wait for it" from "cancel what someone else started".
156
214
  */
157
215
  declare const busyDetails: z.ZodObject<{
158
216
  running: z.ZodObject<{
@@ -160,12 +218,17 @@ declare const busyDetails: z.ZodObject<{
160
218
  robot_id: z.ZodUUID;
161
219
  slug: z.ZodString;
162
220
  state: z.ZodEnum<{
221
+ unknown: "unknown";
163
222
  failed: "failed";
164
223
  running: "running";
165
224
  succeeded: "succeeded";
166
225
  cancelled: "cancelled";
167
226
  lost: "lost";
168
227
  }>;
228
+ origin: z.ZodEnum<{
229
+ fleetless: "fleetless";
230
+ external: "external";
231
+ }>;
169
232
  started_at: z.ZodISODateTime;
170
233
  updated_at: z.ZodISODateTime;
171
234
  seq: z.ZodNumber;
@@ -194,6 +257,7 @@ declare const jobRun: z.ZodObject<{
194
257
  service: "service";
195
258
  }>;
196
259
  state: z.ZodEnum<{
260
+ unknown: "unknown";
197
261
  failed: "failed";
198
262
  running: "running";
199
263
  succeeded: "succeeded";
@@ -234,6 +298,7 @@ declare const jobRunListResponse: z.ZodObject<{
234
298
  service: "service";
235
299
  }>;
236
300
  state: z.ZodEnum<{
301
+ unknown: "unknown";
237
302
  failed: "failed";
238
303
  running: "running";
239
304
  succeeded: "succeeded";
@@ -761,12 +826,31 @@ declare const parameterInvalidDetails: z.ZodObject<{
761
826
  }, z.core.$strip>>;
762
827
  }, z.core.$strip>;
763
828
  type ParameterInvalidDetails = z.infer<typeof parameterInvalidDetails>;
829
+ /**
830
+ * The `details` of a `cancel_rejected` refusal: every goal the cancel reached,
831
+ * accepted ones included, each with the `CancelGoal` return code its action
832
+ * server answered — compare `return_code` against `CANCEL_RETURN_CODES`
833
+ * (`none`, `rejected`, `unknown_goal_id`, `goal_terminated`); it is `null`
834
+ * when that goal's server did not answer within the bridge's bound. Always at
835
+ * least one goal: the cloud refuses a cancel only because a goal's server
836
+ * answered `ERROR_REJECTED`. Pinned here for the reason
837
+ * `parameterInvalidDetails` is: a caller parses it instead of reading the
838
+ * shape from prose.
839
+ */
840
+ declare const cancelRejectedDetails: z.ZodObject<{
841
+ goals: z.ZodArray<z.ZodObject<{
842
+ job_id: z.ZodUUID;
843
+ goal_id: z.ZodString;
844
+ return_code: z.ZodNullable<z.ZodNumber>;
845
+ }, z.core.$strip>>;
846
+ }, z.core.$strip>;
847
+ type CancelRejectedDetails = z.infer<typeof cancelRejectedDetails>;
764
848
  /**
765
849
  * The codes in use today. The wire deliberately allows any string — this
766
850
  * list is the shared vocabulary, not a closed set, so a new refusal never
767
851
  * needs a contracts release before it can be reported honestly.
768
852
  */
769
- declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "job_lost", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "target_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired"];
853
+ declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "target_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired"];
770
854
  type ErrorCode = (typeof ERROR_CODES)[number];
771
855
 
772
856
  /**
@@ -1019,6 +1103,17 @@ interface JobSubscription {
1019
1103
  unsubscribe(): void;
1020
1104
  }
1021
1105
 
1106
+ /**
1107
+ * One goal's answer to a cancel: the ROS 2 `CancelGoal` return code its action
1108
+ * server sent — `0` accepted (`CANCEL_RETURN_CODES.none`), `1` refused
1109
+ * (`rejected`), `2` unknown goal (`unknown_goal_id`), `3` already ended
1110
+ * (`goal_terminated`). The type of `return_code` in `CancelRejectedDetails`,
1111
+ * where it is `null` when that goal's server did not answer. The wire shape is
1112
+ * contracts' `cancelReturnCode`; the alias exists so the reference can
1113
+ * describe it — a JSDoc on an `export type { … } from` statement does not
1114
+ * survive bundling.
1115
+ */
1116
+ type CancelReturnCode = CancelReturnCode$1;
1022
1117
  /**
1023
1118
  * Long-running work on a robot, reachable as `client.actions`. An action is
1024
1119
  * a ROS action the developer exposed under a slug: it is invoked, runs as
@@ -1059,6 +1154,27 @@ interface ActionsApi {
1059
1154
  * was nothing there", and "I stopped a job that started after I last
1060
1155
  * looked" are three different outcomes a discarded result cannot tell
1061
1156
  * apart.
1157
+ *
1158
+ * **Resolving means the robot's action server accepted the cancel, not
1159
+ * that the goal ended.** The returned job is usually still `running`; how
1160
+ * it ends arrives as its own update (`subscribe`). The platform answers
1161
+ * from the action server's `CancelGoal` return codes, so a cancel can
1162
+ * also reject with:
1163
+ * - `cancel_rejected` — the server refused (`ERROR_REJECTED`) and the goal
1164
+ * keeps running unless its job later says otherwise.
1165
+ * `cancelRejectedDetails.parse(error.details).goals` lists every goal the
1166
+ * cancel reached as `{ job_id, goal_id, return_code }`; compare
1167
+ * `return_code` against `CANCEL_RETURN_CODES`: `none` (`0`, accepted),
1168
+ * `rejected` (`1`), `unknown_goal_id` (`2`), `goal_terminated` (`3`,
1169
+ * already ended), or `null` when that goal's server did not answer.
1170
+ * - `bridge_timeout` — the robot's bridge did not answer in time; whether
1171
+ * the cancel reached the server is unknown.
1172
+ * - the bridge's own code when it could not ask at all (e.g.
1173
+ * `unknown_slug`, `action_server_lost`), `not_cancellable` for a service,
1174
+ * and `robot_offline`.
1175
+ *
1176
+ * Cancelling an `unknown` job cancels every `external` goal on its action,
1177
+ * never another of the platform's own jobs.
1062
1178
  */
1063
1179
  cancel(robotId: string, slug: string, jobId?: string | null, options?: SendCommandOptions): Promise<Job | null>;
1064
1180
  /**
@@ -2076,6 +2192,18 @@ interface DatapointsApi {
2076
2192
  }): Promise<HistorySamplesResponse>;
2077
2193
  }
2078
2194
 
2195
+ /**
2196
+ * Who started a job: `fleetless` for every job the cloud minted from an
2197
+ * invocation, `external` for a goal the bridge found active on a published
2198
+ * action without having sent it. An external job has no parameters and no
2199
+ * starter (ROS 2 publishes neither) and is never in `jobs.history`. The type
2200
+ * of `Job.origin`, which every job carries.
2201
+ *
2202
+ * The wire shape is contracts' `jobOrigin`; the alias exists so the reference
2203
+ * can describe it — a JSDoc on an `export type { … } from` statement does not
2204
+ * survive bundling.
2205
+ */
2206
+ type JobOrigin = JobOrigin$1;
2079
2207
  /**
2080
2208
  * The filters `jobs.history` reads. Every field is optional; the wire names
2081
2209
  * are snake_case and this SDK spells them the way its other options are
@@ -2087,7 +2215,7 @@ interface DatapointsApi {
2087
2215
  interface JobHistoryOptions {
2088
2216
  /** Only runs of this action or service. */
2089
2217
  slug?: string;
2090
- /** Only runs in this state: `running`, `succeeded`, `failed`, `cancelled` or `lost`. */
2218
+ /** Only runs in this state: `running`, `unknown`, `succeeded`, `failed`, `cancelled` or `lost`. */
2091
2219
  state?: JobState;
2092
2220
  /** Only `action` runs, or only `service` runs. */
2093
2221
  kind?: 'action' | 'service';
@@ -2387,4 +2515,4 @@ interface FleetlessClient {
2387
2515
  */
2388
2516
  declare function createClient(options: FleetlessClientOptions): FleetlessClient;
2389
2517
 
2390
- export { type AcceptInvitationOptions, type ActionsApi, type Asset, type AssetBytes, type AssetListResponse, type AssetsApi, type AuthApi, type BeginOidcLoginOptions, type BusyDetails, type CameraDescriptor, type CameraLiveSession, type CameraSnapshot, type CameraSnapshotMeta, type CamerasApi, type ClientIdentity, type ClientMcpInteraction, type ClientOidcErrorCode, type ClientRobotListItem, type CompleteOidcLoginOptions, type CreateMeshLoaderOptions, type CredentialSource, type DatapointEvent, type DatapointSubscription, type DatapointSubscriptionHandlers, type DatapointValue, type DatapointsApi, type FleetlessClient, type FleetlessClientConfig, type FleetlessClientOptions, FleetlessError, type FleetlessErrorCode, type FleetlessErrorOptions, type HistoryAggregation, type HistoryBucketsResponse, type HistoryOptions, type HistorySamplesResponse, InMemoryTokenStore, type InvokeOptions, type Job, type JobEvent, type JobHistoryOptions, type JobRun, type JobRunListResponse, type JobState, type JobSubscription, type JobSubscriptionHandlers, type JobsApi, type McpCapabilities, type McpConsentGrant, type McpExposure, type McpInteractionDecision, type McpRobotDatasheet, type MeshLoaderDelegate, type OidcLoginRequest, type ParameterInvalidDetails, type ParameterViolation, type PrepareUrdfSceneOptions, type ProviderButton, type PublishersApi, type RateLimitDetails, type RegisterOptions, type RobotsApi, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type StoredSession, type TokenStore, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, createClient, parameterInvalidDetails };
2518
+ export { type AcceptInvitationOptions, type ActionsApi, type Asset, type AssetBytes, type AssetListResponse, type AssetsApi, type AuthApi, type BeginOidcLoginOptions, type BusyDetails, CANCEL_RETURN_CODES, type CameraDescriptor, type CameraLiveSession, type CameraSnapshot, type CameraSnapshotMeta, type CamerasApi, type CancelRejectedDetails, type CancelReturnCode, type ClientIdentity, type ClientMcpInteraction, type ClientOidcErrorCode, type ClientRobotListItem, type CompleteOidcLoginOptions, type CreateMeshLoaderOptions, type CredentialSource, type DatapointEvent, type DatapointSubscription, type DatapointSubscriptionHandlers, type DatapointValue, type DatapointsApi, type FleetlessClient, type FleetlessClientConfig, type FleetlessClientOptions, FleetlessError, type FleetlessErrorCode, type FleetlessErrorOptions, type HistoryAggregation, type HistoryBucketsResponse, type HistoryOptions, type HistorySamplesResponse, InMemoryTokenStore, type InvokeOptions, type Job, type JobEvent, type JobHistoryOptions, type JobOrigin, type JobRun, type JobRunListResponse, type JobState, type JobSubscription, type JobSubscriptionHandlers, type JobsApi, type McpCapabilities, type McpConsentGrant, type McpExposure, type McpInteractionDecision, type McpRobotDatasheet, type MeshLoaderDelegate, type OidcLoginRequest, type ParameterInvalidDetails, type ParameterViolation, type PrepareUrdfSceneOptions, type ProviderButton, type PublishersApi, type RateLimitDetails, type RegisterOptions, type RobotsApi, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type StoredSession, type TokenStore, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, cancelRejectedDetails, createClient, parameterInvalidDetails };