@fleetless/sdk 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/CONTRIBUTING.md +76 -71
- package/README.md +64 -344
- package/SECURITY.md +11 -11
- package/dist/index.cjs +17 -18
- package/dist/index.d.cts +80 -93
- package/dist/index.d.ts +80 -93
- package/dist/index.js +17 -18
- package/package.json +8 -4
- package/RELEASING.md +0 -195
package/dist/index.d.cts
CHANGED
|
@@ -607,13 +607,13 @@ type ErrorCode = (typeof ERROR_CODES)[number];
|
|
|
607
607
|
* later on the same socket — nobody knows — but the caller cannot be made
|
|
608
608
|
* to wait forever for that.
|
|
609
609
|
* - `command_outcome_unknown`: worse than a timeout, and told apart from it
|
|
610
|
-
* on purpose — the
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
*
|
|
616
|
-
*
|
|
610
|
+
* on purpose — the connection that carried the command was replaced by a
|
|
611
|
+
* new one (a reconnect) before any reply arrived. The server, if it
|
|
612
|
+
* answered at all, answered a socket that no longer exists, so the
|
|
613
|
+
* command may or may not have run. Never retried automatically — that
|
|
614
|
+
* could run an action twice — the caller recovers by reading the job
|
|
615
|
+
* (e.g. `actions.subscribe`), since state is observed by slug regardless
|
|
616
|
+
* of which connection asked for it.
|
|
617
617
|
* - `unexpected_response`: the server answered `ok:true` but left out
|
|
618
618
|
* something the command is defined to always return (e.g. no `job` on a
|
|
619
619
|
* successful `invoke`) — a contract violation the SDK noticed, not a
|
|
@@ -801,20 +801,19 @@ interface JobSubscriptionHandlers {
|
|
|
801
801
|
interface JobSubscription {
|
|
802
802
|
/**
|
|
803
803
|
* Stops this subscription. The `unsubscribe` frame reaches the server only
|
|
804
|
-
* when this was the **last** holder of the robot
|
|
805
|
-
*
|
|
806
|
-
*
|
|
807
|
-
* `
|
|
808
|
-
*
|
|
809
|
-
* than once.
|
|
804
|
+
* when this was the **last** holder of the robot/slug pair and the channel
|
|
805
|
+
* is connected — subscriptions are reference-counted across kinds, so a
|
|
806
|
+
* second `actions.subscribe`, `datapoints.subscribe` or in-flight
|
|
807
|
+
* `services.call` on the same pair keeps its stream running. Safe to call
|
|
808
|
+
* more than once.
|
|
810
809
|
*/
|
|
811
810
|
unsubscribe(): void;
|
|
812
811
|
}
|
|
813
812
|
|
|
814
813
|
/**
|
|
815
814
|
* Long-running work on a robot, reachable as `client.actions`. An action is
|
|
816
|
-
* a ROS action the developer exposed under a slug: it is invoked,
|
|
817
|
-
*
|
|
815
|
+
* a ROS action the developer exposed under a slug: it is invoked, runs as
|
|
816
|
+
* long as it runs, and reports back while it does.
|
|
818
817
|
*/
|
|
819
818
|
interface ActionsApi {
|
|
820
819
|
/**
|
|
@@ -822,7 +821,7 @@ interface ActionsApi {
|
|
|
822
821
|
* — the job id is informative, not the result. Feedback, progress and the
|
|
823
822
|
* eventual result arrive separately over `subscribe`. A second invoke of
|
|
824
823
|
* the same slug while one is already running is refused `busy`, with
|
|
825
|
-
* `error.details.running` naming the job
|
|
824
|
+
* `error.details.running` naming the running job.
|
|
826
825
|
*
|
|
827
826
|
* `options.patienceMs` bounds goal *acceptance* only — once a goal
|
|
828
827
|
* is accepted this call has already resolved; the job then runs as long
|
|
@@ -1106,7 +1105,7 @@ interface AssetsApi {
|
|
|
1106
1105
|
* **Do not also install `createMeshLoader` on the same manager.** The two
|
|
1107
1106
|
* consume different URDF sources — this method fetches the URDF's *raw*
|
|
1108
1107
|
* bytes, `createMeshLoader` is meant to pair with `urdf()`'s
|
|
1109
|
-
* cloud-rewritten text. **
|
|
1108
|
+
* cloud-rewritten text. **Not a double-fetch.**
|
|
1110
1109
|
* What actually happens is asymmetric breakage,
|
|
1111
1110
|
* whichever URDF text the combination ends up parsing: paired with
|
|
1112
1111
|
* *this* method's raw text, `createMeshLoader` receives urdf-loader's
|
|
@@ -1236,7 +1235,7 @@ interface TokenStore {
|
|
|
1236
1235
|
/** The default store: works out of the box, forgets the session on reload. */
|
|
1237
1236
|
declare class InMemoryTokenStore implements TokenStore {
|
|
1238
1237
|
#private;
|
|
1239
|
-
/**
|
|
1238
|
+
/** Nothing is loaded from anywhere — a client built with it starts logged out. */
|
|
1240
1239
|
constructor();
|
|
1241
1240
|
/** Returns the session held in memory, or `null` if there is none. */
|
|
1242
1241
|
load(): StoredSession | null;
|
|
@@ -1680,8 +1679,8 @@ interface CameraLiveSession {
|
|
|
1680
1679
|
* courteous fast path; the robot actually stops publishing once every
|
|
1681
1680
|
* viewer's LiveKit `Room` has disconnected, which the SFU notices on its
|
|
1682
1681
|
* own with no cooperation required. **Always pair this with disconnecting
|
|
1683
|
-
* the `Room` you connected with `url`/`token`** — see the
|
|
1684
|
-
*
|
|
1682
|
+
* the `Room` you connected with `url`/`token`** — see the Cameras
|
|
1683
|
+
* section of the SDK reference for the paired cleanup pattern; a `release()` that ran
|
|
1685
1684
|
* alone while the `Room` stayed connected would stop nothing.
|
|
1686
1685
|
*
|
|
1687
1686
|
* Safe to call more than once (only the first call does anything) and
|
|
@@ -1692,14 +1691,12 @@ interface CameraLiveSession {
|
|
|
1692
1691
|
* from `beforeunload`, where a call that could throw would be a liability.
|
|
1693
1692
|
*
|
|
1694
1693
|
* **A failed DELETE here is not observable anywhere** — not as a
|
|
1695
|
-
* rejection,
|
|
1696
|
-
*
|
|
1697
|
-
*
|
|
1698
|
-
*
|
|
1699
|
-
*
|
|
1700
|
-
*
|
|
1701
|
-
* reach the cloud" (telemetry, say), that is a new, additive signal to
|
|
1702
|
-
* design, not a change to this method's contract.
|
|
1694
|
+
* rejection, a realtime event, or a field on this object. Deliberate, not
|
|
1695
|
+
* an oversight: the only consumer of that information would be code
|
|
1696
|
+
* deciding whether to retry, and the reconciliation backstop described
|
|
1697
|
+
* above already makes a retry unnecessary for correctness. A future need
|
|
1698
|
+
* to know "did my release actually reach the cloud" (telemetry, say) is a
|
|
1699
|
+
* new, additive signal to design, not a change to this method's contract.
|
|
1703
1700
|
*/
|
|
1704
1701
|
release(): Promise<void>;
|
|
1705
1702
|
}
|
|
@@ -1753,12 +1750,11 @@ interface DatapointSubscriptionHandlers {
|
|
|
1753
1750
|
interface DatapointSubscription {
|
|
1754
1751
|
/**
|
|
1755
1752
|
* Stops this subscription. The `unsubscribe` frame reaches the server only
|
|
1756
|
-
* when this was the **last** holder of the robot
|
|
1757
|
-
*
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
1761
|
-
* once.
|
|
1753
|
+
* when this was the **last** holder of the robot/slug pair and the channel
|
|
1754
|
+
* is connected — subscriptions are reference-counted across kinds, so
|
|
1755
|
+
* releasing this one while a `datapoints.subscribe`, `actions.subscribe` or
|
|
1756
|
+
* in-flight `services.call` still holds the same pair leaves that one's
|
|
1757
|
+
* stream running. Safe to call more than once.
|
|
1762
1758
|
*/
|
|
1763
1759
|
unsubscribe(): void;
|
|
1764
1760
|
}
|
|
@@ -1766,11 +1762,10 @@ interface DatapointSubscription {
|
|
|
1766
1762
|
* Window aggregation for `datapoints.history`. `window` and `agg` always
|
|
1767
1763
|
* travel together on the wire — the cloud refuses one without the other
|
|
1768
1764
|
* rather than defaulting either, since a silently chosen aggregation is a
|
|
1769
|
-
* chart that lies quietly — so they live in one object
|
|
1770
|
-
*
|
|
1771
|
-
*
|
|
1772
|
-
*
|
|
1773
|
-
* merely rejected.
|
|
1765
|
+
* chart that lies quietly — so they live in one object instead of two
|
|
1766
|
+
* optional fields a caller could set only one of. Same reasoning as
|
|
1767
|
+
* `cameraSource`'s discriminated union: make the impossible combination
|
|
1768
|
+
* unrepresentable, not merely rejected.
|
|
1774
1769
|
*/
|
|
1775
1770
|
interface HistoryAggregation {
|
|
1776
1771
|
/** Bucket width, e.g. `10s`, `1m`. */
|
|
@@ -1781,9 +1776,8 @@ interface HistoryAggregation {
|
|
|
1781
1776
|
field?: string;
|
|
1782
1777
|
}
|
|
1783
1778
|
/**
|
|
1784
|
-
* The window `datapoints.history` reads
|
|
1785
|
-
* samples or
|
|
1786
|
-
* the two responses you get.
|
|
1779
|
+
* The window `datapoints.history` reads. `aggregate` decides whether the
|
|
1780
|
+
* response is raw samples or aggregated buckets.
|
|
1787
1781
|
*/
|
|
1788
1782
|
interface HistoryOptions {
|
|
1789
1783
|
/**
|
|
@@ -1823,9 +1817,9 @@ interface DatapointsApi {
|
|
|
1823
1817
|
* Reference-counted per `(robotId, slug)`: two subscriptions to the same
|
|
1824
1818
|
* pair share one wire subscription. Unsubscribing one never affects the
|
|
1825
1819
|
* other — the `unsubscribe` frame is sent only when the last subscriber
|
|
1826
|
-
* on that pair goes away.
|
|
1827
|
-
*
|
|
1828
|
-
*
|
|
1820
|
+
* on that pair goes away. In practice: two widgets showing the same
|
|
1821
|
+
* battery value, or a component mounted twice under React StrictMode,
|
|
1822
|
+
* subscribe to the same key. That count is shared with
|
|
1829
1823
|
* `actions.subscribe` and `services.call` — a slug is one namespace across
|
|
1830
1824
|
* kinds, and so is its subscription.
|
|
1831
1825
|
*/
|
|
@@ -1838,10 +1832,9 @@ interface DatapointsApi {
|
|
|
1838
1832
|
* reduced by `aggregate.agg`. Leave `aggregate` out and the other overload
|
|
1839
1833
|
* gives you raw samples instead.
|
|
1840
1834
|
*
|
|
1841
|
-
* Two overloads rather than one union so a caller who already knows which
|
|
1842
|
-
* they asked for isn't forced to narrow
|
|
1843
|
-
*
|
|
1844
|
-
* holding the result dynamically can still branch on it.
|
|
1835
|
+
* Two overloads rather than one union, so a caller who already knows which
|
|
1836
|
+
* one they asked for isn't forced to narrow it. `kind` carries the same
|
|
1837
|
+
* information either way, so dynamic code can still branch on it.
|
|
1845
1838
|
*
|
|
1846
1839
|
* **Rejects, does not silently empty out, two specific refusals** —
|
|
1847
1840
|
* unlike `cameras.snapshot`'s absorption of `no_snapshot_yet` into a null
|
|
@@ -1875,28 +1868,26 @@ interface DatapointsApi {
|
|
|
1875
1868
|
}
|
|
1876
1869
|
|
|
1877
1870
|
/**
|
|
1878
|
-
* Robot-wide job reads, reachable as `client.jobs
|
|
1879
|
-
*
|
|
1880
|
-
* `services` cannot do.
|
|
1871
|
+
* Robot-wide job reads, reachable as `client.jobs` — addressed by robot,
|
|
1872
|
+
* not slug, which `actions` and `services` cannot do.
|
|
1881
1873
|
*/
|
|
1882
1874
|
interface JobsApi {
|
|
1883
1875
|
/**
|
|
1884
1876
|
* Every job the platform currently believes this robot has.
|
|
1885
1877
|
*
|
|
1886
|
-
* `actions.subscribe`/`services.call` and `GET /jobs/:slug`
|
|
1887
|
-
* route those build on
|
|
1888
|
-
*
|
|
1889
|
-
*
|
|
1890
|
-
*
|
|
1891
|
-
*
|
|
1892
|
-
*
|
|
1893
|
-
*
|
|
1894
|
-
*
|
|
1895
|
-
*
|
|
1896
|
-
*
|
|
1897
|
-
*
|
|
1898
|
-
*
|
|
1899
|
-
* a robot doing nothing resolves `[]`.
|
|
1878
|
+
* `actions.subscribe`/`services.call` and `GET /jobs/:slug` — the per-slug
|
|
1879
|
+
* route those build on — all require knowing the slug already. Two cases
|
|
1880
|
+
* don't: a reconnecting bridge naming a job the cloud only *adopted*, and
|
|
1881
|
+
* a config change leaving a job on a slug the published document no
|
|
1882
|
+
* longer contains. Neither has a slug to give — this method is the only
|
|
1883
|
+
* way an app developer reaches them.
|
|
1884
|
+
*
|
|
1885
|
+
* At most one entry per slug: the current job there, same as a per-slug
|
|
1886
|
+
* read would answer. Not a history endpoint. Grant-filtered same as
|
|
1887
|
+
* `cameras.list`/`datapoints` — an end user or server key sees only jobs
|
|
1888
|
+
* on slugs their role grants, a developer session sees every job on the
|
|
1889
|
+
* robot. Never empty-vs-missing ambiguity: a robot doing nothing
|
|
1890
|
+
* resolves `[]`.
|
|
1900
1891
|
*
|
|
1901
1892
|
* **Ordered newest first by `started_at`, with `job.seq` as the
|
|
1902
1893
|
* tiebreaker** (`started_at` alone is not a total order — two jobs minted
|
|
@@ -1920,16 +1911,15 @@ interface PublishersApi {
|
|
|
1920
1911
|
/**
|
|
1921
1912
|
* Publishes one message to a publisher.
|
|
1922
1913
|
*
|
|
1923
|
-
*
|
|
1924
|
-
*
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
1930
|
-
*
|
|
1931
|
-
*
|
|
1932
|
-
* section before building a publisher-driven control loop.
|
|
1914
|
+
* A plain method call — deliberately no deadman switch, rate governor or
|
|
1915
|
+
* "takt" helper. The bridge's own `timeout_ms` failsafe is the platform's
|
|
1916
|
+
* safety primitive: when messages stop arriving, crash included, the
|
|
1917
|
+
* bridge publishes its configured failsafe message. That does **not**
|
|
1918
|
+
* cover a caller who stops calling `publish` on purpose without stopping
|
|
1919
|
+
* cleanly (e.g. no repeated call at a safe rate) — how often and when to
|
|
1920
|
+
* publish is the app's pattern, not the SDK's. See the Publishers
|
|
1921
|
+
* section of the SDK reference before building a
|
|
1922
|
+
* publisher-driven control loop.
|
|
1933
1923
|
*
|
|
1934
1924
|
* Rejects `publisher_busy` while a different user is publishing and has
|
|
1935
1925
|
* not been quiet for its configured quiet timeout yet — whoever publishes
|
|
@@ -1940,16 +1930,15 @@ interface PublishersApi {
|
|
|
1940
1930
|
|
|
1941
1931
|
/**
|
|
1942
1932
|
* Request/response calls to a robot, reachable as `client.services`. A
|
|
1943
|
-
* service answers once and is done
|
|
1944
|
-
* single method and nothing to subscribe to.
|
|
1933
|
+
* service answers once and is done — one method, nothing to subscribe to.
|
|
1945
1934
|
*/
|
|
1946
1935
|
interface ServicesApi {
|
|
1947
1936
|
/**
|
|
1948
1937
|
* Calls a service and resolves with its result. A service call is a job
|
|
1949
1938
|
* underneath — the same `job_id` exchange and disconnect survival as an
|
|
1950
1939
|
* action — but that is deliberately invisible here: the caller gets a
|
|
1951
|
-
* plain `Promise<result>`, matching the REST `serviceCallResponse` shape
|
|
1952
|
-
*
|
|
1940
|
+
* plain `Promise<result>`, matching the REST `serviceCallResponse` shape.
|
|
1941
|
+
* There is nothing to subscribe to for a service —
|
|
1953
1942
|
* no feedback, no progress, no cancel — so this call already waits for
|
|
1954
1943
|
* the terminal state internally.
|
|
1955
1944
|
*
|
|
@@ -1962,8 +1951,7 @@ interface ServicesApi {
|
|
|
1962
1951
|
* call — the ack that a job was created, plus however much of the
|
|
1963
1952
|
* budget is left for it to then reach a terminal state — not two
|
|
1964
1953
|
* separate `timeoutMs`-length windows back to back. A caller who sets
|
|
1965
|
-
* `timeoutMs: 5000`
|
|
1966
|
-
* number means what it says, once, for the whole call.
|
|
1954
|
+
* `timeoutMs: 5000` bounds total latency at ~5s, not ~10s.
|
|
1967
1955
|
*
|
|
1968
1956
|
* It is also **not independent** of `patienceMs`: left unset, it
|
|
1969
1957
|
* is derived from `patienceMs` so this SDK's local clock cannot fire
|
|
@@ -1986,10 +1974,9 @@ interface FleetlessClientOptions {
|
|
|
1986
1974
|
/** The app's identifier (the slug shown in the console), sent on every login. */
|
|
1987
1975
|
appIdentifier: string;
|
|
1988
1976
|
/**
|
|
1989
|
-
* Where refresh/access tokens
|
|
1990
|
-
*
|
|
1991
|
-
*
|
|
1992
|
-
* browser exists.
|
|
1977
|
+
* Where refresh/access tokens live between calls. Defaults to in-memory —
|
|
1978
|
+
* pass your own (localStorage, a cookie, a native keystore) to persist a
|
|
1979
|
+
* session across reloads. The SDK never assumes a browser exists.
|
|
1993
1980
|
*/
|
|
1994
1981
|
tokenStore?: TokenStore;
|
|
1995
1982
|
/**
|
|
@@ -2051,13 +2038,13 @@ interface FleetlessClient {
|
|
|
2051
2038
|
/** URDF and mesh reads — list/get/urdf, plus the `urdf-loader` mesh callback. */
|
|
2052
2039
|
readonly assets: AssetsApi;
|
|
2053
2040
|
/**
|
|
2054
|
-
* Closes the realtime channel and stops it from reconnecting. Safe
|
|
2055
|
-
*
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2059
|
-
*
|
|
2060
|
-
*
|
|
2041
|
+
* Closes the realtime channel and stops it from reconnecting. Safe with
|
|
2042
|
+
* no subscription ever made, and safe to call twice. A Node script (the
|
|
2043
|
+
* exact use case `serverKey` is for) that never calls this after
|
|
2044
|
+
* subscribing will not exit on its own — an open WebSocket keeps the
|
|
2045
|
+
* event loop alive. `auth.logout()` calls this automatically; call it
|
|
2046
|
+
* yourself if the process should exit without logging out (e.g. a
|
|
2047
|
+
* server-side shutdown).
|
|
2061
2048
|
*/
|
|
2062
2049
|
close(): void;
|
|
2063
2050
|
}
|