@fleetless/sdk 5.2.1 → 5.3.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/CHANGELOG.md +12 -0
- package/dist/index.cjs +1243 -1087
- package/dist/index.d.cts +148 -5
- package/dist/index.d.ts +148 -5
- package/dist/index.js +1241 -1087
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -506,6 +506,43 @@ declare const datapointEvent: z.ZodObject<{
|
|
|
506
506
|
timestamp_ms: z.ZodNumber;
|
|
507
507
|
}, z.core.$strip>;
|
|
508
508
|
type DatapointEvent = z.infer<typeof datapointEvent>;
|
|
509
|
+
/**
|
|
510
|
+
* A change in the health of something the developer configured.
|
|
511
|
+
*
|
|
512
|
+
* The push half of `resourceHealthState`; the REST list is the snapshot half,
|
|
513
|
+
* and neither is useful alone — a page that loads after the change would see
|
|
514
|
+
* nothing, and a page that never reloads would never learn.
|
|
515
|
+
*
|
|
516
|
+
* Delivered on the **developer** socket and scoped to the org, not to a
|
|
517
|
+
* subscription: the whole point is to reach somebody who is *not* currently
|
|
518
|
+
* looking at the thing that broke.
|
|
519
|
+
*/
|
|
520
|
+
/**
|
|
521
|
+
/**
|
|
522
|
+
* Why a live camera session ended.
|
|
523
|
+
*
|
|
524
|
+
* **The reason travels WITH the ending, rather than being read afterwards from
|
|
525
|
+
* a state.** Some of these states are sticky — nothing moves a camera out of
|
|
526
|
+
* `stopped_by_config_change` — so a client that reads the current state at the
|
|
527
|
+
* moment a stream ends reports a configuration change from hours ago as the
|
|
528
|
+
* cause of an unrelated ending.
|
|
529
|
+
*
|
|
530
|
+
* A state read after the fact answers "what is true now". A viewer needs "what
|
|
531
|
+
* happened to my session", and only an event carries that.
|
|
532
|
+
*/
|
|
533
|
+
declare const liveSessionEndReason: z.ZodEnum<{
|
|
534
|
+
unknown: "unknown";
|
|
535
|
+
expired: "expired";
|
|
536
|
+
plan_limit: "plan_limit";
|
|
537
|
+
publish_failed: "publish_failed";
|
|
538
|
+
robot_offline: "robot_offline";
|
|
539
|
+
config_changed: "config_changed";
|
|
540
|
+
revoked: "revoked";
|
|
541
|
+
released_by_peer: "released_by_peer";
|
|
542
|
+
start_refused: "start_refused";
|
|
543
|
+
robot_deleted: "robot_deleted";
|
|
544
|
+
}>;
|
|
545
|
+
type LiveSessionEndReason = z.infer<typeof liveSessionEndReason>;
|
|
509
546
|
/**
|
|
510
547
|
* One change to a record the subscriber can see. `record` is the whole record,
|
|
511
548
|
* up to 1 MB, in the shape the REST routes answer.
|
|
@@ -781,6 +818,17 @@ declare const clientRobotListItem: z.ZodObject<{
|
|
|
781
818
|
health_reason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
782
819
|
job_query_unanswered: "job_query_unanswered";
|
|
783
820
|
}>>>;
|
|
821
|
+
failsafe: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
822
|
+
ok: "ok";
|
|
823
|
+
failed: "failed";
|
|
824
|
+
}>>>;
|
|
825
|
+
failsafe_reason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
826
|
+
self_test: "self_test";
|
|
827
|
+
late_fire: "late_fire";
|
|
828
|
+
not_alive: "not_alive";
|
|
829
|
+
crashed: "crashed";
|
|
830
|
+
}>>>;
|
|
831
|
+
failsafe_lateness_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
784
832
|
}, z.core.$strip>;
|
|
785
833
|
published_version: z.ZodNullable<z.ZodNumber>;
|
|
786
834
|
id: z.ZodUUID;
|
|
@@ -939,6 +987,52 @@ declare const assetListResponse: z.ZodObject<{
|
|
|
939
987
|
type AssetListResponse = z.infer<typeof assetListResponse>;
|
|
940
988
|
|
|
941
989
|
|
|
990
|
+
/**
|
|
991
|
+
* Why the robot refused to start a camera's live video, as a class
|
|
992
|
+
* (fleetless/fleetless#1126). The cloud maps the bridge's `error.code` to one
|
|
993
|
+
* of these and to a fixed sentence; the bridge's `error.message` is free text
|
|
994
|
+
* and never leaves the cloud, because a camera password has appeared in one.
|
|
995
|
+
*
|
|
996
|
+
* - `low_bandwidth` — the bridge is in low-bandwidth mode and refuses new
|
|
997
|
+
* streams until the link recovers. Snapshots go on. Not an error.
|
|
998
|
+
* - `source_auth` — the camera source refused the configured credentials.
|
|
999
|
+
* - `source_unreachable` — the camera source could not be reached or used.
|
|
1000
|
+
* - `not_startable` — the bridge could not start this camera's live video
|
|
1001
|
+
* for a reason of its own configuration or encoder; the bridge's log names
|
|
1002
|
+
* it.
|
|
1003
|
+
* - `unknown` — a code this cloud does not know yet.
|
|
1004
|
+
*
|
|
1005
|
+
* A consumer that switches over it has a fallback to keep: the list can
|
|
1006
|
+
* grow in a minor.
|
|
1007
|
+
*/
|
|
1008
|
+
declare const LIVE_START_REFUSALS: readonly ["low_bandwidth", "source_auth", "source_unreachable", "not_startable", "unknown"];
|
|
1009
|
+
declare const liveStartRefusal: z.ZodEnum<{
|
|
1010
|
+
unknown: "unknown";
|
|
1011
|
+
low_bandwidth: "low_bandwidth";
|
|
1012
|
+
source_auth: "source_auth";
|
|
1013
|
+
source_unreachable: "source_unreachable";
|
|
1014
|
+
not_startable: "not_startable";
|
|
1015
|
+
}>;
|
|
1016
|
+
type LiveStartRefusal = z.infer<typeof liveStartRefusal>;
|
|
1017
|
+
/**
|
|
1018
|
+
* The `details` of a `409 camera_offline` refusal of `POST
|
|
1019
|
+
* /api/robots/:id/cameras/:slug/live` (fleetless/fleetless#1126): the robot
|
|
1020
|
+
* already refused the current attempt to start this camera's live video. The
|
|
1021
|
+
* error's `message` is the cloud's fixed sentence for `refusal`, never the
|
|
1022
|
+
* robot's own words.
|
|
1023
|
+
*/
|
|
1024
|
+
declare const cameraOfflineDetails: z.ZodObject<{
|
|
1025
|
+
refusal: z.ZodEnum<{
|
|
1026
|
+
unknown: "unknown";
|
|
1027
|
+
low_bandwidth: "low_bandwidth";
|
|
1028
|
+
source_auth: "source_auth";
|
|
1029
|
+
source_unreachable: "source_unreachable";
|
|
1030
|
+
not_startable: "not_startable";
|
|
1031
|
+
}>;
|
|
1032
|
+
}, z.core.$strip>;
|
|
1033
|
+
type CameraOfflineDetails = z.infer<typeof cameraOfflineDetails>;
|
|
1034
|
+
|
|
1035
|
+
|
|
942
1036
|
/**
|
|
943
1037
|
* One violated parameter rule. `details` on the envelope stays `unknown` — codes
|
|
944
1038
|
* are an open set, so their payloads cannot all be enumerated — but the
|
|
@@ -2769,6 +2863,33 @@ interface AuthApi {
|
|
|
2769
2863
|
revokeMcpGrant(clientId: string): Promise<void>;
|
|
2770
2864
|
}
|
|
2771
2865
|
|
|
2866
|
+
/**
|
|
2867
|
+
* Why a live camera session ended, as the cloud told the holder
|
|
2868
|
+
* (`live_session` on the realtime channel). What `CameraLiveSession.onEnded`
|
|
2869
|
+
* hands its handler.
|
|
2870
|
+
*/
|
|
2871
|
+
interface CameraLiveEnded {
|
|
2872
|
+
/**
|
|
2873
|
+
* Why it ended. `start_refused`: the robot refused to start the camera's
|
|
2874
|
+
* live video (the first start, or the restart after a bridge reconnect);
|
|
2875
|
+
* `publish_failed`: a running stream stopped. A newer cloud may send a reason this version does
|
|
2876
|
+
* not name yet; treat an unknown one as `unknown`.
|
|
2877
|
+
*/
|
|
2878
|
+
reason: LiveSessionEndReason;
|
|
2879
|
+
/**
|
|
2880
|
+
* A sentence the cloud wrote, safe to show a person, or `null`. Never the
|
|
2881
|
+
* robot's own words. With `start_refused` it says why, e.g. "The robot's
|
|
2882
|
+
* link is weak, so live video is paused. Snapshots go on."
|
|
2883
|
+
*/
|
|
2884
|
+
detail: string | null;
|
|
2885
|
+
/**
|
|
2886
|
+
* With `start_refused`, the refusal as a class: `low_bandwidth`,
|
|
2887
|
+
* `source_auth`, `source_unreachable`, `not_startable` or `unknown`.
|
|
2888
|
+
* `null` for every other reason.
|
|
2889
|
+
*/
|
|
2890
|
+
refusal: LiveStartRefusal | null;
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2772
2893
|
/**
|
|
2773
2894
|
* The snapshot's metadata alone, without the bytes. All fields
|
|
2774
2895
|
* are `null` together when nothing has been captured yet for this camera —
|
|
@@ -2877,11 +2998,32 @@ interface CameraLiveSession {
|
|
|
2877
2998
|
* new, additive signal to design, not a change to this method's contract.
|
|
2878
2999
|
*/
|
|
2879
3000
|
release(): Promise<void>;
|
|
3001
|
+
/**
|
|
3002
|
+
* Calls `handler` once when the cloud ends **this** session, with why:
|
|
3003
|
+
* `{ reason, detail, refusal }`. Returns the function that stops listening.
|
|
3004
|
+
*
|
|
3005
|
+
* The ending that matters most is `start_refused`: the robot refused to
|
|
3006
|
+
* start the camera's live video (a weak link, a source that refuses the
|
|
3007
|
+
* credentials or cannot be reached), so the `Room` would never receive a
|
|
3008
|
+
* track. `detail` is a sentence safe to show, `refusal` the class. Other
|
|
3009
|
+
* endings: `publish_failed` (it stopped after starting), `config_changed`,
|
|
3010
|
+
* `robot_offline`, `revoked`, `released_by_peer` and the rest of
|
|
3011
|
+
* `LiveSessionEndReason`.
|
|
3012
|
+
*
|
|
3013
|
+
* It listens on the client's realtime channel, which `live()` opens and
|
|
3014
|
+
* waits for before taking the hold, so an ending that comes at once is not
|
|
3015
|
+
* missed; one that came before this call is delivered right away. If the
|
|
3016
|
+
* channel cannot connect (no WebSocket in the environment, say), the
|
|
3017
|
+
* handler is never called. Disconnect the `Room` and call `release()` in
|
|
3018
|
+
* the handler as after any other ending.
|
|
3019
|
+
*/
|
|
3020
|
+
onEnded(handler: (ended: CameraLiveEnded) => void): () => void;
|
|
2880
3021
|
}
|
|
2881
3022
|
/**
|
|
2882
3023
|
* A robot's cameras, reachable as `client.cameras`: what exists, the latest
|
|
2883
|
-
* still frame, and a live video session. All of it is REST
|
|
2884
|
-
* channel
|
|
3024
|
+
* still frame, and a live video session. All of it is REST, except that
|
|
3025
|
+
* `live()` opens the realtime channel so `onEnded` can hear why a session
|
|
3026
|
+
* ended.
|
|
2885
3027
|
*/
|
|
2886
3028
|
interface CamerasApi {
|
|
2887
3029
|
/** Every camera exposed on this robot, as descriptors — the same per-robot list the other kinds use. */
|
|
@@ -3698,7 +3840,7 @@ interface FleetlessClient {
|
|
|
3698
3840
|
* Closes the realtime channel and stops it from reconnecting. Safe with
|
|
3699
3841
|
* no subscription ever made, and safe to call twice. A Node script (the
|
|
3700
3842
|
* exact use case `serverKey` is for) that never calls this after
|
|
3701
|
-
* subscribing will not exit on its own — an open WebSocket keeps the
|
|
3843
|
+
* subscribing or after `cameras.live()` will not exit on its own — an open WebSocket keeps the
|
|
3702
3844
|
* event loop alive. `auth.logout()` calls this automatically; call it
|
|
3703
3845
|
* yourself if the process should exit without logging out (e.g. a
|
|
3704
3846
|
* server-side shutdown).
|
|
@@ -3715,8 +3857,9 @@ interface FleetlessClient {
|
|
|
3715
3857
|
* as exactly one.
|
|
3716
3858
|
*
|
|
3717
3859
|
* Nothing is fetched here: the realtime channel opens on the first
|
|
3718
|
-
* subscription and closes on `close()` or
|
|
3860
|
+
* subscription or the first `cameras.live()`, and closes on `close()` or
|
|
3861
|
+
* `auth.logout()`.
|
|
3719
3862
|
*/
|
|
3720
3863
|
declare function createClient(options: FleetlessClientOptions): FleetlessClient;
|
|
3721
3864
|
|
|
3722
|
-
export { type AcceptInvitationOptions, type ActionsApi, type Asset, type AssetBytes, type AssetListResponse, type AssetsApi, type AuthApi, type BeginOidcLoginOptions, type BeginTwoFactorSetupOptions, 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 CollectionActor, type CollectionBinding, type CollectionDefinition, type CollectionDefinitions, type CollectionEvent, type CollectionField, type CollectionHistoryOptions, type CollectionHistoryPage, type CollectionListOptions, type CollectionPage, type CollectionRecord, type CollectionRevision, type CollectionSubscribeOptions, type CollectionsApi, type CompleteOidcLoginOptions, type ConfirmTwoFactorSetupOptions, 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 RecordChangedDetails, type RecordReferencedDetails, type ReferenceInvalidDetails, type RegisterOptions, type RequiredMissingDetails, type RobotsApi, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type SignInMethods, type SignInResult, type StoredSession, type TokenStore, type TwoFactorSetup, type TwoFactorSetupConfirmation, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, type VerifyTwoFactorOptions, cancelRejectedDetails, createClient, parameterInvalidDetails, recordChangedDetails, recordReferencedDetails, referenceInvalidDetails, requiredMissingDetails };
|
|
3865
|
+
export { type AcceptInvitationOptions, type ActionsApi, type Asset, type AssetBytes, type AssetListResponse, type AssetsApi, type AuthApi, type BeginOidcLoginOptions, type BeginTwoFactorSetupOptions, type BusyDetails, CANCEL_RETURN_CODES, type CameraDescriptor, type CameraLiveEnded, type CameraLiveSession, type CameraOfflineDetails, type CameraSnapshot, type CameraSnapshotMeta, type CamerasApi, type CancelRejectedDetails, type CancelReturnCode, type ClientIdentity, type ClientMcpInteraction, type ClientOidcErrorCode, type ClientRobotListItem, type CollectionActor, type CollectionBinding, type CollectionDefinition, type CollectionDefinitions, type CollectionEvent, type CollectionField, type CollectionHistoryOptions, type CollectionHistoryPage, type CollectionListOptions, type CollectionPage, type CollectionRecord, type CollectionRevision, type CollectionSubscribeOptions, type CollectionsApi, type CompleteOidcLoginOptions, type ConfirmTwoFactorSetupOptions, 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, LIVE_START_REFUSALS, type LiveSessionEndReason, type LiveStartRefusal, 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 RecordChangedDetails, type RecordReferencedDetails, type ReferenceInvalidDetails, type RegisterOptions, type RequiredMissingDetails, type RobotsApi, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type SignInMethods, type SignInResult, type StoredSession, type TokenStore, type TwoFactorSetup, type TwoFactorSetupConfirmation, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, type VerifyTwoFactorOptions, cameraOfflineDetails, cancelRejectedDetails, createClient, parameterInvalidDetails, recordChangedDetails, recordReferencedDetails, referenceInvalidDetails, requiredMissingDetails };
|
package/dist/index.d.ts
CHANGED
|
@@ -506,6 +506,43 @@ declare const datapointEvent: z.ZodObject<{
|
|
|
506
506
|
timestamp_ms: z.ZodNumber;
|
|
507
507
|
}, z.core.$strip>;
|
|
508
508
|
type DatapointEvent = z.infer<typeof datapointEvent>;
|
|
509
|
+
/**
|
|
510
|
+
* A change in the health of something the developer configured.
|
|
511
|
+
*
|
|
512
|
+
* The push half of `resourceHealthState`; the REST list is the snapshot half,
|
|
513
|
+
* and neither is useful alone — a page that loads after the change would see
|
|
514
|
+
* nothing, and a page that never reloads would never learn.
|
|
515
|
+
*
|
|
516
|
+
* Delivered on the **developer** socket and scoped to the org, not to a
|
|
517
|
+
* subscription: the whole point is to reach somebody who is *not* currently
|
|
518
|
+
* looking at the thing that broke.
|
|
519
|
+
*/
|
|
520
|
+
/**
|
|
521
|
+
/**
|
|
522
|
+
* Why a live camera session ended.
|
|
523
|
+
*
|
|
524
|
+
* **The reason travels WITH the ending, rather than being read afterwards from
|
|
525
|
+
* a state.** Some of these states are sticky — nothing moves a camera out of
|
|
526
|
+
* `stopped_by_config_change` — so a client that reads the current state at the
|
|
527
|
+
* moment a stream ends reports a configuration change from hours ago as the
|
|
528
|
+
* cause of an unrelated ending.
|
|
529
|
+
*
|
|
530
|
+
* A state read after the fact answers "what is true now". A viewer needs "what
|
|
531
|
+
* happened to my session", and only an event carries that.
|
|
532
|
+
*/
|
|
533
|
+
declare const liveSessionEndReason: z.ZodEnum<{
|
|
534
|
+
unknown: "unknown";
|
|
535
|
+
expired: "expired";
|
|
536
|
+
plan_limit: "plan_limit";
|
|
537
|
+
publish_failed: "publish_failed";
|
|
538
|
+
robot_offline: "robot_offline";
|
|
539
|
+
config_changed: "config_changed";
|
|
540
|
+
revoked: "revoked";
|
|
541
|
+
released_by_peer: "released_by_peer";
|
|
542
|
+
start_refused: "start_refused";
|
|
543
|
+
robot_deleted: "robot_deleted";
|
|
544
|
+
}>;
|
|
545
|
+
type LiveSessionEndReason = z.infer<typeof liveSessionEndReason>;
|
|
509
546
|
/**
|
|
510
547
|
* One change to a record the subscriber can see. `record` is the whole record,
|
|
511
548
|
* up to 1 MB, in the shape the REST routes answer.
|
|
@@ -781,6 +818,17 @@ declare const clientRobotListItem: z.ZodObject<{
|
|
|
781
818
|
health_reason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
782
819
|
job_query_unanswered: "job_query_unanswered";
|
|
783
820
|
}>>>;
|
|
821
|
+
failsafe: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
822
|
+
ok: "ok";
|
|
823
|
+
failed: "failed";
|
|
824
|
+
}>>>;
|
|
825
|
+
failsafe_reason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
826
|
+
self_test: "self_test";
|
|
827
|
+
late_fire: "late_fire";
|
|
828
|
+
not_alive: "not_alive";
|
|
829
|
+
crashed: "crashed";
|
|
830
|
+
}>>>;
|
|
831
|
+
failsafe_lateness_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
784
832
|
}, z.core.$strip>;
|
|
785
833
|
published_version: z.ZodNullable<z.ZodNumber>;
|
|
786
834
|
id: z.ZodUUID;
|
|
@@ -939,6 +987,52 @@ declare const assetListResponse: z.ZodObject<{
|
|
|
939
987
|
type AssetListResponse = z.infer<typeof assetListResponse>;
|
|
940
988
|
|
|
941
989
|
|
|
990
|
+
/**
|
|
991
|
+
* Why the robot refused to start a camera's live video, as a class
|
|
992
|
+
* (fleetless/fleetless#1126). The cloud maps the bridge's `error.code` to one
|
|
993
|
+
* of these and to a fixed sentence; the bridge's `error.message` is free text
|
|
994
|
+
* and never leaves the cloud, because a camera password has appeared in one.
|
|
995
|
+
*
|
|
996
|
+
* - `low_bandwidth` — the bridge is in low-bandwidth mode and refuses new
|
|
997
|
+
* streams until the link recovers. Snapshots go on. Not an error.
|
|
998
|
+
* - `source_auth` — the camera source refused the configured credentials.
|
|
999
|
+
* - `source_unreachable` — the camera source could not be reached or used.
|
|
1000
|
+
* - `not_startable` — the bridge could not start this camera's live video
|
|
1001
|
+
* for a reason of its own configuration or encoder; the bridge's log names
|
|
1002
|
+
* it.
|
|
1003
|
+
* - `unknown` — a code this cloud does not know yet.
|
|
1004
|
+
*
|
|
1005
|
+
* A consumer that switches over it has a fallback to keep: the list can
|
|
1006
|
+
* grow in a minor.
|
|
1007
|
+
*/
|
|
1008
|
+
declare const LIVE_START_REFUSALS: readonly ["low_bandwidth", "source_auth", "source_unreachable", "not_startable", "unknown"];
|
|
1009
|
+
declare const liveStartRefusal: z.ZodEnum<{
|
|
1010
|
+
unknown: "unknown";
|
|
1011
|
+
low_bandwidth: "low_bandwidth";
|
|
1012
|
+
source_auth: "source_auth";
|
|
1013
|
+
source_unreachable: "source_unreachable";
|
|
1014
|
+
not_startable: "not_startable";
|
|
1015
|
+
}>;
|
|
1016
|
+
type LiveStartRefusal = z.infer<typeof liveStartRefusal>;
|
|
1017
|
+
/**
|
|
1018
|
+
* The `details` of a `409 camera_offline` refusal of `POST
|
|
1019
|
+
* /api/robots/:id/cameras/:slug/live` (fleetless/fleetless#1126): the robot
|
|
1020
|
+
* already refused the current attempt to start this camera's live video. The
|
|
1021
|
+
* error's `message` is the cloud's fixed sentence for `refusal`, never the
|
|
1022
|
+
* robot's own words.
|
|
1023
|
+
*/
|
|
1024
|
+
declare const cameraOfflineDetails: z.ZodObject<{
|
|
1025
|
+
refusal: z.ZodEnum<{
|
|
1026
|
+
unknown: "unknown";
|
|
1027
|
+
low_bandwidth: "low_bandwidth";
|
|
1028
|
+
source_auth: "source_auth";
|
|
1029
|
+
source_unreachable: "source_unreachable";
|
|
1030
|
+
not_startable: "not_startable";
|
|
1031
|
+
}>;
|
|
1032
|
+
}, z.core.$strip>;
|
|
1033
|
+
type CameraOfflineDetails = z.infer<typeof cameraOfflineDetails>;
|
|
1034
|
+
|
|
1035
|
+
|
|
942
1036
|
/**
|
|
943
1037
|
* One violated parameter rule. `details` on the envelope stays `unknown` — codes
|
|
944
1038
|
* are an open set, so their payloads cannot all be enumerated — but the
|
|
@@ -2769,6 +2863,33 @@ interface AuthApi {
|
|
|
2769
2863
|
revokeMcpGrant(clientId: string): Promise<void>;
|
|
2770
2864
|
}
|
|
2771
2865
|
|
|
2866
|
+
/**
|
|
2867
|
+
* Why a live camera session ended, as the cloud told the holder
|
|
2868
|
+
* (`live_session` on the realtime channel). What `CameraLiveSession.onEnded`
|
|
2869
|
+
* hands its handler.
|
|
2870
|
+
*/
|
|
2871
|
+
interface CameraLiveEnded {
|
|
2872
|
+
/**
|
|
2873
|
+
* Why it ended. `start_refused`: the robot refused to start the camera's
|
|
2874
|
+
* live video (the first start, or the restart after a bridge reconnect);
|
|
2875
|
+
* `publish_failed`: a running stream stopped. A newer cloud may send a reason this version does
|
|
2876
|
+
* not name yet; treat an unknown one as `unknown`.
|
|
2877
|
+
*/
|
|
2878
|
+
reason: LiveSessionEndReason;
|
|
2879
|
+
/**
|
|
2880
|
+
* A sentence the cloud wrote, safe to show a person, or `null`. Never the
|
|
2881
|
+
* robot's own words. With `start_refused` it says why, e.g. "The robot's
|
|
2882
|
+
* link is weak, so live video is paused. Snapshots go on."
|
|
2883
|
+
*/
|
|
2884
|
+
detail: string | null;
|
|
2885
|
+
/**
|
|
2886
|
+
* With `start_refused`, the refusal as a class: `low_bandwidth`,
|
|
2887
|
+
* `source_auth`, `source_unreachable`, `not_startable` or `unknown`.
|
|
2888
|
+
* `null` for every other reason.
|
|
2889
|
+
*/
|
|
2890
|
+
refusal: LiveStartRefusal | null;
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2772
2893
|
/**
|
|
2773
2894
|
* The snapshot's metadata alone, without the bytes. All fields
|
|
2774
2895
|
* are `null` together when nothing has been captured yet for this camera —
|
|
@@ -2877,11 +2998,32 @@ interface CameraLiveSession {
|
|
|
2877
2998
|
* new, additive signal to design, not a change to this method's contract.
|
|
2878
2999
|
*/
|
|
2879
3000
|
release(): Promise<void>;
|
|
3001
|
+
/**
|
|
3002
|
+
* Calls `handler` once when the cloud ends **this** session, with why:
|
|
3003
|
+
* `{ reason, detail, refusal }`. Returns the function that stops listening.
|
|
3004
|
+
*
|
|
3005
|
+
* The ending that matters most is `start_refused`: the robot refused to
|
|
3006
|
+
* start the camera's live video (a weak link, a source that refuses the
|
|
3007
|
+
* credentials or cannot be reached), so the `Room` would never receive a
|
|
3008
|
+
* track. `detail` is a sentence safe to show, `refusal` the class. Other
|
|
3009
|
+
* endings: `publish_failed` (it stopped after starting), `config_changed`,
|
|
3010
|
+
* `robot_offline`, `revoked`, `released_by_peer` and the rest of
|
|
3011
|
+
* `LiveSessionEndReason`.
|
|
3012
|
+
*
|
|
3013
|
+
* It listens on the client's realtime channel, which `live()` opens and
|
|
3014
|
+
* waits for before taking the hold, so an ending that comes at once is not
|
|
3015
|
+
* missed; one that came before this call is delivered right away. If the
|
|
3016
|
+
* channel cannot connect (no WebSocket in the environment, say), the
|
|
3017
|
+
* handler is never called. Disconnect the `Room` and call `release()` in
|
|
3018
|
+
* the handler as after any other ending.
|
|
3019
|
+
*/
|
|
3020
|
+
onEnded(handler: (ended: CameraLiveEnded) => void): () => void;
|
|
2880
3021
|
}
|
|
2881
3022
|
/**
|
|
2882
3023
|
* A robot's cameras, reachable as `client.cameras`: what exists, the latest
|
|
2883
|
-
* still frame, and a live video session. All of it is REST
|
|
2884
|
-
* channel
|
|
3024
|
+
* still frame, and a live video session. All of it is REST, except that
|
|
3025
|
+
* `live()` opens the realtime channel so `onEnded` can hear why a session
|
|
3026
|
+
* ended.
|
|
2885
3027
|
*/
|
|
2886
3028
|
interface CamerasApi {
|
|
2887
3029
|
/** Every camera exposed on this robot, as descriptors — the same per-robot list the other kinds use. */
|
|
@@ -3698,7 +3840,7 @@ interface FleetlessClient {
|
|
|
3698
3840
|
* Closes the realtime channel and stops it from reconnecting. Safe with
|
|
3699
3841
|
* no subscription ever made, and safe to call twice. A Node script (the
|
|
3700
3842
|
* exact use case `serverKey` is for) that never calls this after
|
|
3701
|
-
* subscribing will not exit on its own — an open WebSocket keeps the
|
|
3843
|
+
* subscribing or after `cameras.live()` will not exit on its own — an open WebSocket keeps the
|
|
3702
3844
|
* event loop alive. `auth.logout()` calls this automatically; call it
|
|
3703
3845
|
* yourself if the process should exit without logging out (e.g. a
|
|
3704
3846
|
* server-side shutdown).
|
|
@@ -3715,8 +3857,9 @@ interface FleetlessClient {
|
|
|
3715
3857
|
* as exactly one.
|
|
3716
3858
|
*
|
|
3717
3859
|
* Nothing is fetched here: the realtime channel opens on the first
|
|
3718
|
-
* subscription and closes on `close()` or
|
|
3860
|
+
* subscription or the first `cameras.live()`, and closes on `close()` or
|
|
3861
|
+
* `auth.logout()`.
|
|
3719
3862
|
*/
|
|
3720
3863
|
declare function createClient(options: FleetlessClientOptions): FleetlessClient;
|
|
3721
3864
|
|
|
3722
|
-
export { type AcceptInvitationOptions, type ActionsApi, type Asset, type AssetBytes, type AssetListResponse, type AssetsApi, type AuthApi, type BeginOidcLoginOptions, type BeginTwoFactorSetupOptions, 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 CollectionActor, type CollectionBinding, type CollectionDefinition, type CollectionDefinitions, type CollectionEvent, type CollectionField, type CollectionHistoryOptions, type CollectionHistoryPage, type CollectionListOptions, type CollectionPage, type CollectionRecord, type CollectionRevision, type CollectionSubscribeOptions, type CollectionsApi, type CompleteOidcLoginOptions, type ConfirmTwoFactorSetupOptions, 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 RecordChangedDetails, type RecordReferencedDetails, type ReferenceInvalidDetails, type RegisterOptions, type RequiredMissingDetails, type RobotsApi, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type SignInMethods, type SignInResult, type StoredSession, type TokenStore, type TwoFactorSetup, type TwoFactorSetupConfirmation, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, type VerifyTwoFactorOptions, cancelRejectedDetails, createClient, parameterInvalidDetails, recordChangedDetails, recordReferencedDetails, referenceInvalidDetails, requiredMissingDetails };
|
|
3865
|
+
export { type AcceptInvitationOptions, type ActionsApi, type Asset, type AssetBytes, type AssetListResponse, type AssetsApi, type AuthApi, type BeginOidcLoginOptions, type BeginTwoFactorSetupOptions, type BusyDetails, CANCEL_RETURN_CODES, type CameraDescriptor, type CameraLiveEnded, type CameraLiveSession, type CameraOfflineDetails, type CameraSnapshot, type CameraSnapshotMeta, type CamerasApi, type CancelRejectedDetails, type CancelReturnCode, type ClientIdentity, type ClientMcpInteraction, type ClientOidcErrorCode, type ClientRobotListItem, type CollectionActor, type CollectionBinding, type CollectionDefinition, type CollectionDefinitions, type CollectionEvent, type CollectionField, type CollectionHistoryOptions, type CollectionHistoryPage, type CollectionListOptions, type CollectionPage, type CollectionRecord, type CollectionRevision, type CollectionSubscribeOptions, type CollectionsApi, type CompleteOidcLoginOptions, type ConfirmTwoFactorSetupOptions, 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, LIVE_START_REFUSALS, type LiveSessionEndReason, type LiveStartRefusal, 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 RecordChangedDetails, type RecordReferencedDetails, type ReferenceInvalidDetails, type RegisterOptions, type RequiredMissingDetails, type RobotsApi, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type SignInMethods, type SignInResult, type StoredSession, type TokenStore, type TwoFactorSetup, type TwoFactorSetupConfirmation, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, type VerifyTwoFactorOptions, cameraOfflineDetails, cancelRejectedDetails, createClient, parameterInvalidDetails, recordChangedDetails, recordReferencedDetails, referenceInvalidDetails, requiredMissingDetails };
|