@fleetless/sdk 3.1.0 → 4.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.
package/dist/index.d.cts CHANGED
@@ -26,13 +26,13 @@ declare const mcpExposure: z.ZodObject<{
26
26
  decimals: z.ZodNullable<z.ZodNumber>;
27
27
  input_schema: z.ZodNullable<z.ZodUnknown>;
28
28
  }, z.core.$strip>;
29
- type McpExposure = z.infer<typeof mcpExposure>;
29
+ type McpExposure$1 = z.infer<typeof mcpExposure>;
30
30
  /** The two role capabilities a robot tool can need beyond a slug grant. `presence` is a stream and has no tool. */
31
31
  declare const mcpCapabilities: z.ZodObject<{
32
32
  action_history: z.ZodBoolean;
33
33
  assets: z.ZodBoolean;
34
34
  }, z.core.$strip>;
35
- type McpCapabilities = z.infer<typeof mcpCapabilities>;
35
+ type McpCapabilities$1 = z.infer<typeof mcpCapabilities>;
36
36
  /**
37
37
  * What one caller may do on one robot — the answer to `robot_describe`, and
38
38
  * since 1.1.0 to `GET /api/robots/:id/datasheet` as well. One schema for both
@@ -352,8 +352,8 @@ declare const historySamplesResponse: z.ZodObject<{
352
352
  }, z.core.$strip>>;
353
353
  truncated: z.ZodBoolean;
354
354
  truncated_by: z.ZodNullable<z.ZodEnum<{
355
- limit: "limit";
356
355
  bytes: "bytes";
356
+ limit: "limit";
357
357
  }>>;
358
358
  }, z.core.$strip>;
359
359
  type HistorySamplesResponse = z.infer<typeof historySamplesResponse>;
@@ -577,6 +577,7 @@ declare const clientRobotListItem: z.ZodObject<{
577
577
  bridge_state: z.ZodObject<{
578
578
  online: z.ZodBoolean;
579
579
  latency_ms: z.ZodNullable<z.ZodNumber>;
580
+ low_bandwidth: z.ZodBoolean;
580
581
  }, z.core.$strip>;
581
582
  published_version: z.ZodNullable<z.ZodNumber>;
582
583
  id: z.ZodUUID;
@@ -593,7 +594,6 @@ declare const asset: z.ZodObject<{
593
594
  urdf: "urdf";
594
595
  mesh: "mesh";
595
596
  texture: "texture";
596
- other: "other";
597
597
  }>;
598
598
  name: z.ZodString;
599
599
  media_type: z.ZodString;
@@ -649,14 +649,16 @@ declare const assetSyncStatus: z.ZodObject<{
649
649
  unresolvable: "unresolvable";
650
650
  upload_failed: "upload_failed";
651
651
  refused: "refused";
652
- too_large: "too_large";
653
652
  }>;
654
653
  details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
655
- limit_bytes: z.ZodNumber;
654
+ store_bytes: z.ZodNumber;
655
+ used_bytes: z.ZodNumber;
656
656
  size_bytes: z.ZodNumber;
657
657
  }, z.core.$strip>>>;
658
658
  }, z.core.$strip>>;
659
659
  reason: z.ZodNullable<z.ZodString>;
660
+ stored: z.ZodNullable<z.ZodNumber>;
661
+ announced: z.ZodNumber;
660
662
  started_at: z.ZodISODateTime;
661
663
  updated_at: z.ZodISODateTime;
662
664
  }, z.core.$strip>;
@@ -669,7 +671,6 @@ declare const assetListResponse: z.ZodObject<{
669
671
  urdf: "urdf";
670
672
  mesh: "mesh";
671
673
  texture: "texture";
672
- other: "other";
673
674
  }>;
674
675
  name: z.ZodString;
675
676
  media_type: z.ZodString;
@@ -693,14 +694,16 @@ declare const assetListResponse: z.ZodObject<{
693
694
  unresolvable: "unresolvable";
694
695
  upload_failed: "upload_failed";
695
696
  refused: "refused";
696
- too_large: "too_large";
697
697
  }>;
698
698
  details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
699
- limit_bytes: z.ZodNumber;
699
+ store_bytes: z.ZodNumber;
700
+ used_bytes: z.ZodNumber;
700
701
  size_bytes: z.ZodNumber;
701
702
  }, z.core.$strip>>>;
702
703
  }, z.core.$strip>>;
703
704
  reason: z.ZodNullable<z.ZodString>;
705
+ stored: z.ZodNullable<z.ZodNumber>;
706
+ announced: z.ZodNumber;
704
707
  started_at: z.ZodISODateTime;
705
708
  updated_at: z.ZodISODateTime;
706
709
  }, z.core.$strip>>;
@@ -716,6 +719,11 @@ declare const assetListResponse: z.ZodObject<{
716
719
  }, z.core.$strip>>;
717
720
  }, z.core.$strip>;
718
721
  urdf_available: z.ZodNullable<z.ZodBoolean>;
722
+ store: z.ZodObject<{
723
+ bytes: z.ZodNumber;
724
+ used_bytes: z.ZodNumber;
725
+ }, z.core.$strip>;
726
+ joint_state_slug: z.ZodNullable<z.ZodString>;
719
727
  }, z.core.$strip>;
720
728
  type AssetListResponse = z.infer<typeof assetListResponse>;
721
729
 
@@ -758,7 +766,7 @@ type ParameterInvalidDetails = z.infer<typeof parameterInvalidDetails>;
758
766
  * list is the shared vocabulary, not a closed set, so a new refusal never
759
767
  * needs a contracts release before it can be reported honestly.
760
768
  */
761
- 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", "asset_too_large", "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"];
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"];
762
770
  type ErrorCode = (typeof ERROR_CODES)[number];
763
771
 
764
772
  /**
@@ -912,6 +920,34 @@ declare class FleetlessError extends Error {
912
920
  constructor(code: FleetlessErrorCode, message: string, options?: FleetlessErrorOptions);
913
921
  }
914
922
 
923
+ /**
924
+ * Supplies the `Authorization` header value for a request, and knows what to
925
+ * do when the server says the token has expired. `HttpClient` is agnostic to
926
+ * *what* is authenticating it — an end-user session with silent refresh, or
927
+ * a static server key — so both can share one request path.
928
+ */
929
+ interface CredentialSource {
930
+ /**
931
+ * The current raw bearer credential — a JWT or a server key (`flk_...`) —
932
+ * or null if not authenticated. Raw, not `Bearer <token>`: REST forms the
933
+ * `Authorization` header from it, and the realtime auth frame
934
+ * carries the very same value unprefixed, so there is exactly one place
935
+ * that knows what "the token" currently is.
936
+ */
937
+ token(): Promise<string | null>;
938
+ /**
939
+ * Called once when a request comes back `token_expired`. Three outcomes:
940
+ * - resolves `true` — a fresh credential is ready, retry the request;
941
+ * - resolves `false` — nothing to do (e.g. a server key, which cannot be
942
+ * refreshed at all), propagate the original `token_expired`;
943
+ * - throws a `FleetlessError` — refreshing itself failed for a specific,
944
+ * more useful reason (e.g. `token_revoked`, a reused refresh token);
945
+ * that error propagates instead of the original `token_expired`, so the
946
+ * caller learns what actually happened, not just that a retry was tried.
947
+ */
948
+ handleExpired(): Promise<boolean>;
949
+ }
950
+
915
951
  /**
916
952
  * The options every realtime command accepts — `actions.cancel` and
917
953
  * `publishers.publish` take exactly these; `InvokeOptions` extends them for
@@ -2049,13 +2085,19 @@ interface DatapointsApi {
2049
2085
  * `validation_error`, not quietly reduced.
2050
2086
  */
2051
2087
  interface JobHistoryOptions {
2088
+ /** Only runs of this action or service. */
2052
2089
  slug?: string;
2090
+ /** Only runs in this state: `running`, `succeeded`, `failed`, `cancelled` or `lost`. */
2053
2091
  state?: JobState;
2092
+ /** Only `action` runs, or only `service` runs. */
2054
2093
  kind?: 'action' | 'service';
2094
+ /** How many runs to return, 1 to 200; absent means 100. Above the cap the platform refuses with `validation_error` rather than trimming. */
2055
2095
  limit?: number;
2056
2096
  /** The previous page's `next_cursor`. Send it back rather than computing one. */
2057
2097
  beforeSeq?: number;
2098
+ /** Only runs that started at or after this unix timestamp in milliseconds; with `toMs` the window is half-open, `[from, to)`. */
2058
2099
  fromMs?: number;
2100
+ /** Only runs that started before this unix timestamp in milliseconds. */
2059
2101
  toMs?: number;
2060
2102
  }
2061
2103
  /**
@@ -2139,6 +2181,20 @@ interface PublishersApi {
2139
2181
  publish(robotId: string, slug: string, message: Record<string, unknown>, options?: SendCommandOptions): Promise<void>;
2140
2182
  }
2141
2183
 
2184
+ /**
2185
+ * One row of a datasheet's `exposures`: a granted datapoint, action, service,
2186
+ * publisher or camera, with its `slug`, `kind`, `description` (or `null`),
2187
+ * a datapoint's `unit` and `decimals`, and for anything that takes
2188
+ * parameters the JSON Schema under `input_schema`. The wire shape is
2189
+ * contracts' `mcpExposure`; the alias exists so the reference can describe it.
2190
+ */
2191
+ type McpExposure = McpExposure$1;
2192
+ /**
2193
+ * The two role capabilities a datasheet names beyond slugs: `action_history`
2194
+ * (may `jobs.history` be read) and `assets` (may the URDF and meshes be read).
2195
+ * The wire shape is contracts' `mcpCapabilities`.
2196
+ */
2197
+ type McpCapabilities = McpCapabilities$1;
2142
2198
  /**
2143
2199
  * Discovery, reachable as `client.robots`: which robots may I name at all,
2144
2200
  * and what may I do on one. The two calls every app screen starts from;
@@ -2233,6 +2289,25 @@ interface FleetlessClientOptions {
2233
2289
  * with a server key never calls `auth.login`/`auth.logout`.
2234
2290
  */
2235
2291
  serverKey?: string;
2292
+ /**
2293
+ * **A credential this client does not own.** The caller answers both
2294
+ * questions a bearer raises: what the token is right now (`token()`), and
2295
+ * what to do when the server says it expired (`handleExpired()`).
2296
+ *
2297
+ * For an embedder that already holds a session and refreshes it itself —
2298
+ * the Fleetless console is the case this exists for. Without it such a
2299
+ * caller had to impersonate a `TokenStore`, and a cloud-side
2300
+ * `token_expired` arriving while its own clock still read live posted one
2301
+ * empty refresh whose `validation_error` had to be translated back into a
2302
+ * session message. A source that answers `handleExpired: false` never
2303
+ * builds a refresh request at all.
2304
+ *
2305
+ * Mutually exclusive with `tokenStore` and `serverKey`, which each own a
2306
+ * credential of their own; a client acts as exactly one identity.
2307
+ * `auth.login`/`auth.logout` refuse here for the same reason they refuse
2308
+ * on a server key: there is no session for this client to start or end.
2309
+ */
2310
+ credentials?: CredentialSource;
2236
2311
  /** Injectable for tests, or a non-global `fetch` implementation. */
2237
2312
  fetch?: typeof fetch;
2238
2313
  /** Injectable for tests, or a non-global `WebSocket` implementation. */
@@ -2302,12 +2377,14 @@ interface FleetlessClient {
2302
2377
  * Builds a client for one app. Pass `tokenStore` (or nothing — the default
2303
2378
  * keeps the session in memory) for an app-user client that signs in with
2304
2379
  * `auth.login` or a federated provider; pass `serverKey` for a server-side
2305
- * caller that never holds a user session. Passing both throws, because the
2306
- * two are different identities and a client acts as exactly one.
2380
+ * caller that never holds a user session; pass `credentials` when the
2381
+ * embedder already holds the bearer and refreshes it itself. Passing more
2382
+ * than one throws, because each is a different identity and a client acts
2383
+ * as exactly one.
2307
2384
  *
2308
2385
  * Nothing is fetched here: the realtime channel opens on the first
2309
2386
  * subscription and closes on `close()` or `auth.logout()`.
2310
2387
  */
2311
2388
  declare function createClient(options: FleetlessClientOptions): FleetlessClient;
2312
2389
 
2313
- 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 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -26,13 +26,13 @@ declare const mcpExposure: z.ZodObject<{
26
26
  decimals: z.ZodNullable<z.ZodNumber>;
27
27
  input_schema: z.ZodNullable<z.ZodUnknown>;
28
28
  }, z.core.$strip>;
29
- type McpExposure = z.infer<typeof mcpExposure>;
29
+ type McpExposure$1 = z.infer<typeof mcpExposure>;
30
30
  /** The two role capabilities a robot tool can need beyond a slug grant. `presence` is a stream and has no tool. */
31
31
  declare const mcpCapabilities: z.ZodObject<{
32
32
  action_history: z.ZodBoolean;
33
33
  assets: z.ZodBoolean;
34
34
  }, z.core.$strip>;
35
- type McpCapabilities = z.infer<typeof mcpCapabilities>;
35
+ type McpCapabilities$1 = z.infer<typeof mcpCapabilities>;
36
36
  /**
37
37
  * What one caller may do on one robot — the answer to `robot_describe`, and
38
38
  * since 1.1.0 to `GET /api/robots/:id/datasheet` as well. One schema for both
@@ -352,8 +352,8 @@ declare const historySamplesResponse: z.ZodObject<{
352
352
  }, z.core.$strip>>;
353
353
  truncated: z.ZodBoolean;
354
354
  truncated_by: z.ZodNullable<z.ZodEnum<{
355
- limit: "limit";
356
355
  bytes: "bytes";
356
+ limit: "limit";
357
357
  }>>;
358
358
  }, z.core.$strip>;
359
359
  type HistorySamplesResponse = z.infer<typeof historySamplesResponse>;
@@ -577,6 +577,7 @@ declare const clientRobotListItem: z.ZodObject<{
577
577
  bridge_state: z.ZodObject<{
578
578
  online: z.ZodBoolean;
579
579
  latency_ms: z.ZodNullable<z.ZodNumber>;
580
+ low_bandwidth: z.ZodBoolean;
580
581
  }, z.core.$strip>;
581
582
  published_version: z.ZodNullable<z.ZodNumber>;
582
583
  id: z.ZodUUID;
@@ -593,7 +594,6 @@ declare const asset: z.ZodObject<{
593
594
  urdf: "urdf";
594
595
  mesh: "mesh";
595
596
  texture: "texture";
596
- other: "other";
597
597
  }>;
598
598
  name: z.ZodString;
599
599
  media_type: z.ZodString;
@@ -649,14 +649,16 @@ declare const assetSyncStatus: z.ZodObject<{
649
649
  unresolvable: "unresolvable";
650
650
  upload_failed: "upload_failed";
651
651
  refused: "refused";
652
- too_large: "too_large";
653
652
  }>;
654
653
  details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
655
- limit_bytes: z.ZodNumber;
654
+ store_bytes: z.ZodNumber;
655
+ used_bytes: z.ZodNumber;
656
656
  size_bytes: z.ZodNumber;
657
657
  }, z.core.$strip>>>;
658
658
  }, z.core.$strip>>;
659
659
  reason: z.ZodNullable<z.ZodString>;
660
+ stored: z.ZodNullable<z.ZodNumber>;
661
+ announced: z.ZodNumber;
660
662
  started_at: z.ZodISODateTime;
661
663
  updated_at: z.ZodISODateTime;
662
664
  }, z.core.$strip>;
@@ -669,7 +671,6 @@ declare const assetListResponse: z.ZodObject<{
669
671
  urdf: "urdf";
670
672
  mesh: "mesh";
671
673
  texture: "texture";
672
- other: "other";
673
674
  }>;
674
675
  name: z.ZodString;
675
676
  media_type: z.ZodString;
@@ -693,14 +694,16 @@ declare const assetListResponse: z.ZodObject<{
693
694
  unresolvable: "unresolvable";
694
695
  upload_failed: "upload_failed";
695
696
  refused: "refused";
696
- too_large: "too_large";
697
697
  }>;
698
698
  details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
699
- limit_bytes: z.ZodNumber;
699
+ store_bytes: z.ZodNumber;
700
+ used_bytes: z.ZodNumber;
700
701
  size_bytes: z.ZodNumber;
701
702
  }, z.core.$strip>>>;
702
703
  }, z.core.$strip>>;
703
704
  reason: z.ZodNullable<z.ZodString>;
705
+ stored: z.ZodNullable<z.ZodNumber>;
706
+ announced: z.ZodNumber;
704
707
  started_at: z.ZodISODateTime;
705
708
  updated_at: z.ZodISODateTime;
706
709
  }, z.core.$strip>>;
@@ -716,6 +719,11 @@ declare const assetListResponse: z.ZodObject<{
716
719
  }, z.core.$strip>>;
717
720
  }, z.core.$strip>;
718
721
  urdf_available: z.ZodNullable<z.ZodBoolean>;
722
+ store: z.ZodObject<{
723
+ bytes: z.ZodNumber;
724
+ used_bytes: z.ZodNumber;
725
+ }, z.core.$strip>;
726
+ joint_state_slug: z.ZodNullable<z.ZodString>;
719
727
  }, z.core.$strip>;
720
728
  type AssetListResponse = z.infer<typeof assetListResponse>;
721
729
 
@@ -758,7 +766,7 @@ type ParameterInvalidDetails = z.infer<typeof parameterInvalidDetails>;
758
766
  * list is the shared vocabulary, not a closed set, so a new refusal never
759
767
  * needs a contracts release before it can be reported honestly.
760
768
  */
761
- 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", "asset_too_large", "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"];
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"];
762
770
  type ErrorCode = (typeof ERROR_CODES)[number];
763
771
 
764
772
  /**
@@ -912,6 +920,34 @@ declare class FleetlessError extends Error {
912
920
  constructor(code: FleetlessErrorCode, message: string, options?: FleetlessErrorOptions);
913
921
  }
914
922
 
923
+ /**
924
+ * Supplies the `Authorization` header value for a request, and knows what to
925
+ * do when the server says the token has expired. `HttpClient` is agnostic to
926
+ * *what* is authenticating it — an end-user session with silent refresh, or
927
+ * a static server key — so both can share one request path.
928
+ */
929
+ interface CredentialSource {
930
+ /**
931
+ * The current raw bearer credential — a JWT or a server key (`flk_...`) —
932
+ * or null if not authenticated. Raw, not `Bearer <token>`: REST forms the
933
+ * `Authorization` header from it, and the realtime auth frame
934
+ * carries the very same value unprefixed, so there is exactly one place
935
+ * that knows what "the token" currently is.
936
+ */
937
+ token(): Promise<string | null>;
938
+ /**
939
+ * Called once when a request comes back `token_expired`. Three outcomes:
940
+ * - resolves `true` — a fresh credential is ready, retry the request;
941
+ * - resolves `false` — nothing to do (e.g. a server key, which cannot be
942
+ * refreshed at all), propagate the original `token_expired`;
943
+ * - throws a `FleetlessError` — refreshing itself failed for a specific,
944
+ * more useful reason (e.g. `token_revoked`, a reused refresh token);
945
+ * that error propagates instead of the original `token_expired`, so the
946
+ * caller learns what actually happened, not just that a retry was tried.
947
+ */
948
+ handleExpired(): Promise<boolean>;
949
+ }
950
+
915
951
  /**
916
952
  * The options every realtime command accepts — `actions.cancel` and
917
953
  * `publishers.publish` take exactly these; `InvokeOptions` extends them for
@@ -2049,13 +2085,19 @@ interface DatapointsApi {
2049
2085
  * `validation_error`, not quietly reduced.
2050
2086
  */
2051
2087
  interface JobHistoryOptions {
2088
+ /** Only runs of this action or service. */
2052
2089
  slug?: string;
2090
+ /** Only runs in this state: `running`, `succeeded`, `failed`, `cancelled` or `lost`. */
2053
2091
  state?: JobState;
2092
+ /** Only `action` runs, or only `service` runs. */
2054
2093
  kind?: 'action' | 'service';
2094
+ /** How many runs to return, 1 to 200; absent means 100. Above the cap the platform refuses with `validation_error` rather than trimming. */
2055
2095
  limit?: number;
2056
2096
  /** The previous page's `next_cursor`. Send it back rather than computing one. */
2057
2097
  beforeSeq?: number;
2098
+ /** Only runs that started at or after this unix timestamp in milliseconds; with `toMs` the window is half-open, `[from, to)`. */
2058
2099
  fromMs?: number;
2100
+ /** Only runs that started before this unix timestamp in milliseconds. */
2059
2101
  toMs?: number;
2060
2102
  }
2061
2103
  /**
@@ -2139,6 +2181,20 @@ interface PublishersApi {
2139
2181
  publish(robotId: string, slug: string, message: Record<string, unknown>, options?: SendCommandOptions): Promise<void>;
2140
2182
  }
2141
2183
 
2184
+ /**
2185
+ * One row of a datasheet's `exposures`: a granted datapoint, action, service,
2186
+ * publisher or camera, with its `slug`, `kind`, `description` (or `null`),
2187
+ * a datapoint's `unit` and `decimals`, and for anything that takes
2188
+ * parameters the JSON Schema under `input_schema`. The wire shape is
2189
+ * contracts' `mcpExposure`; the alias exists so the reference can describe it.
2190
+ */
2191
+ type McpExposure = McpExposure$1;
2192
+ /**
2193
+ * The two role capabilities a datasheet names beyond slugs: `action_history`
2194
+ * (may `jobs.history` be read) and `assets` (may the URDF and meshes be read).
2195
+ * The wire shape is contracts' `mcpCapabilities`.
2196
+ */
2197
+ type McpCapabilities = McpCapabilities$1;
2142
2198
  /**
2143
2199
  * Discovery, reachable as `client.robots`: which robots may I name at all,
2144
2200
  * and what may I do on one. The two calls every app screen starts from;
@@ -2233,6 +2289,25 @@ interface FleetlessClientOptions {
2233
2289
  * with a server key never calls `auth.login`/`auth.logout`.
2234
2290
  */
2235
2291
  serverKey?: string;
2292
+ /**
2293
+ * **A credential this client does not own.** The caller answers both
2294
+ * questions a bearer raises: what the token is right now (`token()`), and
2295
+ * what to do when the server says it expired (`handleExpired()`).
2296
+ *
2297
+ * For an embedder that already holds a session and refreshes it itself —
2298
+ * the Fleetless console is the case this exists for. Without it such a
2299
+ * caller had to impersonate a `TokenStore`, and a cloud-side
2300
+ * `token_expired` arriving while its own clock still read live posted one
2301
+ * empty refresh whose `validation_error` had to be translated back into a
2302
+ * session message. A source that answers `handleExpired: false` never
2303
+ * builds a refresh request at all.
2304
+ *
2305
+ * Mutually exclusive with `tokenStore` and `serverKey`, which each own a
2306
+ * credential of their own; a client acts as exactly one identity.
2307
+ * `auth.login`/`auth.logout` refuse here for the same reason they refuse
2308
+ * on a server key: there is no session for this client to start or end.
2309
+ */
2310
+ credentials?: CredentialSource;
2236
2311
  /** Injectable for tests, or a non-global `fetch` implementation. */
2237
2312
  fetch?: typeof fetch;
2238
2313
  /** Injectable for tests, or a non-global `WebSocket` implementation. */
@@ -2302,12 +2377,14 @@ interface FleetlessClient {
2302
2377
  * Builds a client for one app. Pass `tokenStore` (or nothing — the default
2303
2378
  * keeps the session in memory) for an app-user client that signs in with
2304
2379
  * `auth.login` or a federated provider; pass `serverKey` for a server-side
2305
- * caller that never holds a user session. Passing both throws, because the
2306
- * two are different identities and a client acts as exactly one.
2380
+ * caller that never holds a user session; pass `credentials` when the
2381
+ * embedder already holds the bearer and refreshes it itself. Passing more
2382
+ * than one throws, because each is a different identity and a client acts
2383
+ * as exactly one.
2307
2384
  *
2308
2385
  * Nothing is fetched here: the realtime channel opens on the first
2309
2386
  * subscription and closes on `close()` or `auth.logout()`.
2310
2387
  */
2311
2388
  declare function createClient(options: FleetlessClientOptions): FleetlessClient;
2312
2389
 
2313
- 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 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 };
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 };