@fleetless/sdk 3.0.3 → 3.1.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 +11 -0
- package/README.md +2 -0
- package/dist/index.cjs +294 -191
- package/dist/index.d.cts +260 -10
- package/dist/index.d.ts +260 -10
- package/dist/index.js +294 -191
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,68 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* One exposure of a robot, as `robot_describe` and the console's per-role
|
|
7
|
+
* preview list it. Every exposure the role grants is listed —
|
|
8
|
+
* a missing `description` is shown as `null`, never used to hide the entry.
|
|
9
|
+
*
|
|
10
|
+
* `input_schema` is a JSON Schema document generated from an action's,
|
|
11
|
+
* service's or publisher's `parameters`; `null` for the other kinds. It is
|
|
12
|
+
* `unknown` for the same reason the retired `mcpToolPreview.input_schema`
|
|
13
|
+
* was: pinning it would mean maintaining a zod description of JSON Schema.
|
|
14
|
+
*/
|
|
15
|
+
declare const mcpExposure: z.ZodObject<{
|
|
16
|
+
slug: z.ZodString;
|
|
17
|
+
kind: z.ZodEnum<{
|
|
18
|
+
datapoint: "datapoint";
|
|
19
|
+
action: "action";
|
|
20
|
+
service: "service";
|
|
21
|
+
publisher: "publisher";
|
|
22
|
+
camera: "camera";
|
|
23
|
+
}>;
|
|
24
|
+
description: z.ZodNullable<z.ZodString>;
|
|
25
|
+
unit: z.ZodNullable<z.ZodString>;
|
|
26
|
+
decimals: z.ZodNullable<z.ZodNumber>;
|
|
27
|
+
input_schema: z.ZodNullable<z.ZodUnknown>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
type McpExposure = z.infer<typeof mcpExposure>;
|
|
30
|
+
/** The two role capabilities a robot tool can need beyond a slug grant. `presence` is a stream and has no tool. */
|
|
31
|
+
declare const mcpCapabilities: z.ZodObject<{
|
|
32
|
+
action_history: z.ZodBoolean;
|
|
33
|
+
assets: z.ZodBoolean;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
type McpCapabilities = z.infer<typeof mcpCapabilities>;
|
|
36
|
+
/**
|
|
37
|
+
* What one caller may do on one robot — the answer to `robot_describe`, and
|
|
38
|
+
* since 1.1.0 to `GET /api/robots/:id/datasheet` as well. One schema for both
|
|
39
|
+
* surfaces on purpose: an app and an AI tool read the same description of the
|
|
40
|
+
* same grant. The `mcp` prefix is history, not scope.
|
|
41
|
+
*/
|
|
42
|
+
declare const mcpRobotDatasheet: z.ZodObject<{
|
|
43
|
+
robot_id: z.ZodUUID;
|
|
44
|
+
robot_name: z.ZodString;
|
|
45
|
+
capabilities: z.ZodObject<{
|
|
46
|
+
action_history: z.ZodBoolean;
|
|
47
|
+
assets: z.ZodBoolean;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
exposures: z.ZodArray<z.ZodObject<{
|
|
50
|
+
slug: z.ZodString;
|
|
51
|
+
kind: z.ZodEnum<{
|
|
52
|
+
datapoint: "datapoint";
|
|
53
|
+
action: "action";
|
|
54
|
+
service: "service";
|
|
55
|
+
publisher: "publisher";
|
|
56
|
+
camera: "camera";
|
|
57
|
+
}>;
|
|
58
|
+
description: z.ZodNullable<z.ZodString>;
|
|
59
|
+
unit: z.ZodNullable<z.ZodString>;
|
|
60
|
+
decimals: z.ZodNullable<z.ZodNumber>;
|
|
61
|
+
input_schema: z.ZodNullable<z.ZodUnknown>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
type McpRobotDatasheet = z.infer<typeof mcpRobotDatasheet>;
|
|
65
|
+
|
|
66
|
+
|
|
5
67
|
/**
|
|
6
68
|
* Jobs: one running unit of work on a robot — an action
|
|
7
69
|
* goal or a service call — with an id both sides know, so bridge and cloud
|
|
@@ -116,6 +178,94 @@ declare const busyDetails: z.ZodObject<{
|
|
|
116
178
|
}, z.core.$strip>;
|
|
117
179
|
}, z.core.$strip>;
|
|
118
180
|
type BusyDetails = z.infer<typeof busyDetails>;
|
|
181
|
+
/**
|
|
182
|
+
* One durable record of one invocation. One row per run, never one per event:
|
|
183
|
+
* the per-event timeline's write rate
|
|
184
|
+
* is set by the bridge, and a throttled log that cannot say it was throttled is
|
|
185
|
+
* an instrument that cannot say what it does not know. The live timeline is
|
|
186
|
+
* delivered in full by realtime, for as long as somebody is watching.
|
|
187
|
+
*/
|
|
188
|
+
declare const jobRun: z.ZodObject<{
|
|
189
|
+
id: z.ZodUUID;
|
|
190
|
+
robot_id: z.ZodUUID;
|
|
191
|
+
slug: z.ZodString;
|
|
192
|
+
kind: z.ZodEnum<{
|
|
193
|
+
action: "action";
|
|
194
|
+
service: "service";
|
|
195
|
+
}>;
|
|
196
|
+
state: z.ZodEnum<{
|
|
197
|
+
failed: "failed";
|
|
198
|
+
running: "running";
|
|
199
|
+
succeeded: "succeeded";
|
|
200
|
+
cancelled: "cancelled";
|
|
201
|
+
lost: "lost";
|
|
202
|
+
}>;
|
|
203
|
+
started_at: z.ZodISODateTime;
|
|
204
|
+
ended_at: z.ZodNullable<z.ZodISODateTime>;
|
|
205
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
206
|
+
result: z.ZodNullable<z.ZodUnknown>;
|
|
207
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
208
|
+
code: z.ZodString;
|
|
209
|
+
message: z.ZodString;
|
|
210
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
211
|
+
}, z.core.$strip>>;
|
|
212
|
+
actor: z.ZodObject<{
|
|
213
|
+
kind: z.ZodEnum<{
|
|
214
|
+
developer: "developer";
|
|
215
|
+
server_key: "server_key";
|
|
216
|
+
end_user: "end_user";
|
|
217
|
+
app_user: "app_user";
|
|
218
|
+
}>;
|
|
219
|
+
id: z.ZodUUID;
|
|
220
|
+
label: z.ZodString;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
seq: z.ZodNumber;
|
|
223
|
+
progress: z.ZodNullable<z.ZodNumber>;
|
|
224
|
+
feedback: z.ZodNullable<z.ZodUnknown>;
|
|
225
|
+
}, z.core.$strip>;
|
|
226
|
+
type JobRun = z.infer<typeof jobRun>;
|
|
227
|
+
declare const jobRunListResponse: z.ZodObject<{
|
|
228
|
+
runs: z.ZodArray<z.ZodObject<{
|
|
229
|
+
id: z.ZodUUID;
|
|
230
|
+
robot_id: z.ZodUUID;
|
|
231
|
+
slug: z.ZodString;
|
|
232
|
+
kind: z.ZodEnum<{
|
|
233
|
+
action: "action";
|
|
234
|
+
service: "service";
|
|
235
|
+
}>;
|
|
236
|
+
state: z.ZodEnum<{
|
|
237
|
+
failed: "failed";
|
|
238
|
+
running: "running";
|
|
239
|
+
succeeded: "succeeded";
|
|
240
|
+
cancelled: "cancelled";
|
|
241
|
+
lost: "lost";
|
|
242
|
+
}>;
|
|
243
|
+
started_at: z.ZodISODateTime;
|
|
244
|
+
ended_at: z.ZodNullable<z.ZodISODateTime>;
|
|
245
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
246
|
+
result: z.ZodNullable<z.ZodUnknown>;
|
|
247
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
248
|
+
code: z.ZodString;
|
|
249
|
+
message: z.ZodString;
|
|
250
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
251
|
+
}, z.core.$strip>>;
|
|
252
|
+
actor: z.ZodObject<{
|
|
253
|
+
kind: z.ZodEnum<{
|
|
254
|
+
developer: "developer";
|
|
255
|
+
server_key: "server_key";
|
|
256
|
+
end_user: "end_user";
|
|
257
|
+
app_user: "app_user";
|
|
258
|
+
}>;
|
|
259
|
+
id: z.ZodUUID;
|
|
260
|
+
label: z.ZodString;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
seq: z.ZodNumber;
|
|
263
|
+
progress: z.ZodNullable<z.ZodNumber>;
|
|
264
|
+
feedback: z.ZodNullable<z.ZodUnknown>;
|
|
265
|
+
}, z.core.$strip>>;
|
|
266
|
+
next_cursor: z.ZodNullable<z.ZodNumber>;
|
|
267
|
+
}, z.core.$strip>;
|
|
268
|
+
type JobRunListResponse = z.infer<typeof jobRunListResponse>;
|
|
119
269
|
|
|
120
270
|
/**
|
|
121
271
|
* The REST read of one datapoint. For bridge-captured data `timestamp_ms`
|
|
@@ -413,6 +563,29 @@ declare const clientIdentity: z.ZodObject<{
|
|
|
413
563
|
type ClientIdentity = z.infer<typeof clientIdentity>;
|
|
414
564
|
|
|
415
565
|
|
|
566
|
+
/**
|
|
567
|
+
* One robot as `GET /api/client/robots` lists it — the REST twin of the MCP
|
|
568
|
+
* tool `robots_list`, and the one robot question no robot-scoped route can
|
|
569
|
+
* answer: which robots may I name at all.
|
|
570
|
+
*
|
|
571
|
+
* Deliberately not `robotListItem`: that one carries `exposes`, the per-kind
|
|
572
|
+
* counts a developer's list shows, which are a configuration fact rather than
|
|
573
|
+
* something an app user's role grants. What an app user is entitled to is the
|
|
574
|
+
* robot, its bridge state, and whether anything is published on it yet.
|
|
575
|
+
*/
|
|
576
|
+
declare const clientRobotListItem: z.ZodObject<{
|
|
577
|
+
bridge_state: z.ZodObject<{
|
|
578
|
+
online: z.ZodBoolean;
|
|
579
|
+
latency_ms: z.ZodNullable<z.ZodNumber>;
|
|
580
|
+
}, z.core.$strip>;
|
|
581
|
+
published_version: z.ZodNullable<z.ZodNumber>;
|
|
582
|
+
id: z.ZodUUID;
|
|
583
|
+
name: z.ZodString;
|
|
584
|
+
created_at: z.ZodISODateTime;
|
|
585
|
+
}, z.core.$strip>;
|
|
586
|
+
type ClientRobotListItem = z.infer<typeof clientRobotListItem>;
|
|
587
|
+
|
|
588
|
+
|
|
416
589
|
declare const asset: z.ZodObject<{
|
|
417
590
|
id: z.ZodUUID;
|
|
418
591
|
robot_id: z.ZodUUID;
|
|
@@ -555,10 +728,10 @@ type AssetListResponse = z.infer<typeof assetListResponse>;
|
|
|
555
728
|
* console renders a third, and each is right in its own tests.
|
|
556
729
|
*
|
|
557
730
|
* `field` is the **flat key exactly as the caller sent it** — the same string
|
|
558
|
-
* as the `parameterSpec.name` it violated. That is the
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
731
|
+
* as the `parameterSpec.name` it violated. That is why the parameter form
|
|
732
|
+
* stays flat: a refusal has to name something the caller can find in what
|
|
733
|
+
* they typed, and a console can attach the error to that one input rather
|
|
734
|
+
* than to the form.
|
|
562
735
|
*/
|
|
563
736
|
declare const parameterViolation: z.ZodObject<{
|
|
564
737
|
field: z.ZodString;
|
|
@@ -1867,6 +2040,24 @@ interface DatapointsApi {
|
|
|
1867
2040
|
}): Promise<HistorySamplesResponse>;
|
|
1868
2041
|
}
|
|
1869
2042
|
|
|
2043
|
+
/**
|
|
2044
|
+
* The filters `jobs.history` reads. Every field is optional; the wire names
|
|
2045
|
+
* are snake_case and this SDK spells them the way its other options are
|
|
2046
|
+
* spelt. `fromMs`/`toMs` are unix milliseconds, a half-open window
|
|
2047
|
+
* `[from, to)` so adjacent windows never both contain the run on their
|
|
2048
|
+
* boundary. `limit` above the platform's page cap is refused with
|
|
2049
|
+
* `validation_error`, not quietly reduced.
|
|
2050
|
+
*/
|
|
2051
|
+
interface JobHistoryOptions {
|
|
2052
|
+
slug?: string;
|
|
2053
|
+
state?: JobState;
|
|
2054
|
+
kind?: 'action' | 'service';
|
|
2055
|
+
limit?: number;
|
|
2056
|
+
/** The previous page's `next_cursor`. Send it back rather than computing one. */
|
|
2057
|
+
beforeSeq?: number;
|
|
2058
|
+
fromMs?: number;
|
|
2059
|
+
toMs?: number;
|
|
2060
|
+
}
|
|
1870
2061
|
/**
|
|
1871
2062
|
* Robot-wide job reads, reachable as `client.jobs` — addressed by robot,
|
|
1872
2063
|
* not slug, which `actions` and `services` cannot do.
|
|
@@ -1883,11 +2074,11 @@ interface JobsApi {
|
|
|
1883
2074
|
* way an app developer reaches them.
|
|
1884
2075
|
*
|
|
1885
2076
|
* At most one entry per slug: the current job there, same as a per-slug
|
|
1886
|
-
* read would answer. Not a history endpoint
|
|
1887
|
-
* `cameras.list`/`datapoints` — an end user or
|
|
1888
|
-
* on slugs their role grants, a developer
|
|
1889
|
-
* robot. Never empty-vs-missing ambiguity:
|
|
1890
|
-
* resolves `[]`.
|
|
2077
|
+
* read would answer. Not a history endpoint — that is `history` below.
|
|
2078
|
+
* Grant-filtered same as `cameras.list`/`datapoints` — an end user or
|
|
2079
|
+
* server key sees only jobs on slugs their role grants, a developer
|
|
2080
|
+
* session sees every job on the robot. Never empty-vs-missing ambiguity:
|
|
2081
|
+
* a robot doing nothing resolves `[]`.
|
|
1891
2082
|
*
|
|
1892
2083
|
* **Ordered newest first by `started_at`, with `job.seq` as the
|
|
1893
2084
|
* tiebreaker** (`started_at` alone is not a total order — two jobs minted
|
|
@@ -1900,6 +2091,26 @@ interface JobsApi {
|
|
|
1900
2091
|
* hour-long one was only just adopted.
|
|
1901
2092
|
*/
|
|
1902
2093
|
list(robotId: string): Promise<Job[]>;
|
|
2094
|
+
/**
|
|
2095
|
+
* What *has* run on this robot: one row per run, newest first by the
|
|
2096
|
+
* durable `seq`, with its actor, its outcome and its `duration_ms`, kept
|
|
2097
|
+
* for 90 days. The durable counterpart of `list`.
|
|
2098
|
+
*
|
|
2099
|
+
* **Needs the `action_history` capability** on the caller's role, or it
|
|
2100
|
+
* rejects `capability_required`. An app user sees only runs on the slugs
|
|
2101
|
+
* their role grants; a developer session sees the whole robot.
|
|
2102
|
+
*
|
|
2103
|
+
* **Page until `next_cursor` is `null`, never until a page looks short.**
|
|
2104
|
+
* The cloud applies the role's grants to the page it already read, so a
|
|
2105
|
+
* page can come back thin — or empty — with a perfectly good non-null
|
|
2106
|
+
* cursor behind it. `runs.length === 0` is not an end-of-data signal.
|
|
2107
|
+
*
|
|
2108
|
+
* It lags realtime by a moment, deliberately: a run watched to completion
|
|
2109
|
+
* over `actions.subscribe` can still read `running` here for an instant.
|
|
2110
|
+
* Render the outcome from the realtime job you already have; use this for
|
|
2111
|
+
* what you were not watching.
|
|
2112
|
+
*/
|
|
2113
|
+
history(robotId: string, options?: JobHistoryOptions): Promise<JobRunListResponse>;
|
|
1903
2114
|
}
|
|
1904
2115
|
|
|
1905
2116
|
/**
|
|
@@ -1928,6 +2139,43 @@ interface PublishersApi {
|
|
|
1928
2139
|
publish(robotId: string, slug: string, message: Record<string, unknown>, options?: SendCommandOptions): Promise<void>;
|
|
1929
2140
|
}
|
|
1930
2141
|
|
|
2142
|
+
/**
|
|
2143
|
+
* Discovery, reachable as `client.robots`: which robots may I name at all,
|
|
2144
|
+
* and what may I do on one. The two calls every app screen starts from;
|
|
2145
|
+
* every other namespace takes a `robotId` that came from here.
|
|
2146
|
+
*
|
|
2147
|
+
* The answers are the caller's role made visible — the same rows and the
|
|
2148
|
+
* same datasheet the MCP tools `robots_list` and `robot_describe` answer,
|
|
2149
|
+
* from the same code on the server. There is no client-side filtering to
|
|
2150
|
+
* do and nothing to cache: a role change shows at the next call.
|
|
2151
|
+
*/
|
|
2152
|
+
interface RobotsApi {
|
|
2153
|
+
/**
|
|
2154
|
+
* The robots this caller reaches, in name order with the id as the tiebreak.
|
|
2155
|
+
*
|
|
2156
|
+
* An app user reaches the robots their app attaches on which their role
|
|
2157
|
+
* grants at least one slug or capability; a server key reaches every robot
|
|
2158
|
+
* its app attaches. A robot the role grants nothing on is absent rather
|
|
2159
|
+
* than listed empty — reach is a grant, not an attachment — so a new app
|
|
2160
|
+
* whose built-in roles grant nothing yet resolves `[]`, and that is the
|
|
2161
|
+
* console's Roles tab talking, not a broken login.
|
|
2162
|
+
*/
|
|
2163
|
+
list(): Promise<ClientRobotListItem[]>;
|
|
2164
|
+
/**
|
|
2165
|
+
* Everything the caller's role lets them do on one robot: every granted
|
|
2166
|
+
* datapoint (with `unit` and `decimals`), action, service and publisher
|
|
2167
|
+
* (with the parameter JSON Schema under `input_schema`) and camera, plus
|
|
2168
|
+
* the two capabilities that gate whole features, `action_history` and
|
|
2169
|
+
* `assets`. A robot with nothing published resolves an empty `exposures`
|
|
2170
|
+
* list. One the caller does not reach rejects `not_found`, exactly as a
|
|
2171
|
+
* robot that does not exist — never `forbidden`, which would say it exists.
|
|
2172
|
+
*
|
|
2173
|
+
* The type is `McpRobotDatasheet` because the MCP server answered it first;
|
|
2174
|
+
* the prefix is history, not scope.
|
|
2175
|
+
*/
|
|
2176
|
+
describe(robotId: string): Promise<McpRobotDatasheet>;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
1931
2179
|
/**
|
|
1932
2180
|
* Request/response calls to a robot, reachable as `client.services`. A
|
|
1933
2181
|
* service answers once and is done — one method, nothing to subscribe to.
|
|
@@ -2037,6 +2285,8 @@ interface FleetlessClient {
|
|
|
2037
2285
|
readonly jobs: JobsApi;
|
|
2038
2286
|
/** URDF and mesh reads — list/get/urdf, plus the `urdf-loader` mesh callback. */
|
|
2039
2287
|
readonly assets: AssetsApi;
|
|
2288
|
+
/** Which robots this caller reaches, and what their role lets them do on each — the calls every screen starts from. */
|
|
2289
|
+
readonly robots: RobotsApi;
|
|
2040
2290
|
/**
|
|
2041
2291
|
* Closes the realtime channel and stops it from reconnecting. Safe with
|
|
2042
2292
|
* no subscription ever made, and safe to call twice. A Node script (the
|
|
@@ -2060,4 +2310,4 @@ interface FleetlessClient {
|
|
|
2060
2310
|
*/
|
|
2061
2311
|
declare function createClient(options: FleetlessClientOptions): FleetlessClient;
|
|
2062
2312
|
|
|
2063
|
-
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 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 JobState, type JobSubscription, type JobSubscriptionHandlers, type JobsApi, type McpConsentGrant, type McpInteractionDecision, type MeshLoaderDelegate, type OidcLoginRequest, type ParameterInvalidDetails, type ParameterViolation, type PrepareUrdfSceneOptions, type ProviderButton, type PublishersApi, type RateLimitDetails, type RegisterOptions, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type StoredSession, type TokenStore, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, createClient, parameterInvalidDetails };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,68 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* One exposure of a robot, as `robot_describe` and the console's per-role
|
|
7
|
+
* preview list it. Every exposure the role grants is listed —
|
|
8
|
+
* a missing `description` is shown as `null`, never used to hide the entry.
|
|
9
|
+
*
|
|
10
|
+
* `input_schema` is a JSON Schema document generated from an action's,
|
|
11
|
+
* service's or publisher's `parameters`; `null` for the other kinds. It is
|
|
12
|
+
* `unknown` for the same reason the retired `mcpToolPreview.input_schema`
|
|
13
|
+
* was: pinning it would mean maintaining a zod description of JSON Schema.
|
|
14
|
+
*/
|
|
15
|
+
declare const mcpExposure: z.ZodObject<{
|
|
16
|
+
slug: z.ZodString;
|
|
17
|
+
kind: z.ZodEnum<{
|
|
18
|
+
datapoint: "datapoint";
|
|
19
|
+
action: "action";
|
|
20
|
+
service: "service";
|
|
21
|
+
publisher: "publisher";
|
|
22
|
+
camera: "camera";
|
|
23
|
+
}>;
|
|
24
|
+
description: z.ZodNullable<z.ZodString>;
|
|
25
|
+
unit: z.ZodNullable<z.ZodString>;
|
|
26
|
+
decimals: z.ZodNullable<z.ZodNumber>;
|
|
27
|
+
input_schema: z.ZodNullable<z.ZodUnknown>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
type McpExposure = z.infer<typeof mcpExposure>;
|
|
30
|
+
/** The two role capabilities a robot tool can need beyond a slug grant. `presence` is a stream and has no tool. */
|
|
31
|
+
declare const mcpCapabilities: z.ZodObject<{
|
|
32
|
+
action_history: z.ZodBoolean;
|
|
33
|
+
assets: z.ZodBoolean;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
type McpCapabilities = z.infer<typeof mcpCapabilities>;
|
|
36
|
+
/**
|
|
37
|
+
* What one caller may do on one robot — the answer to `robot_describe`, and
|
|
38
|
+
* since 1.1.0 to `GET /api/robots/:id/datasheet` as well. One schema for both
|
|
39
|
+
* surfaces on purpose: an app and an AI tool read the same description of the
|
|
40
|
+
* same grant. The `mcp` prefix is history, not scope.
|
|
41
|
+
*/
|
|
42
|
+
declare const mcpRobotDatasheet: z.ZodObject<{
|
|
43
|
+
robot_id: z.ZodUUID;
|
|
44
|
+
robot_name: z.ZodString;
|
|
45
|
+
capabilities: z.ZodObject<{
|
|
46
|
+
action_history: z.ZodBoolean;
|
|
47
|
+
assets: z.ZodBoolean;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
exposures: z.ZodArray<z.ZodObject<{
|
|
50
|
+
slug: z.ZodString;
|
|
51
|
+
kind: z.ZodEnum<{
|
|
52
|
+
datapoint: "datapoint";
|
|
53
|
+
action: "action";
|
|
54
|
+
service: "service";
|
|
55
|
+
publisher: "publisher";
|
|
56
|
+
camera: "camera";
|
|
57
|
+
}>;
|
|
58
|
+
description: z.ZodNullable<z.ZodString>;
|
|
59
|
+
unit: z.ZodNullable<z.ZodString>;
|
|
60
|
+
decimals: z.ZodNullable<z.ZodNumber>;
|
|
61
|
+
input_schema: z.ZodNullable<z.ZodUnknown>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
type McpRobotDatasheet = z.infer<typeof mcpRobotDatasheet>;
|
|
65
|
+
|
|
66
|
+
|
|
5
67
|
/**
|
|
6
68
|
* Jobs: one running unit of work on a robot — an action
|
|
7
69
|
* goal or a service call — with an id both sides know, so bridge and cloud
|
|
@@ -116,6 +178,94 @@ declare const busyDetails: z.ZodObject<{
|
|
|
116
178
|
}, z.core.$strip>;
|
|
117
179
|
}, z.core.$strip>;
|
|
118
180
|
type BusyDetails = z.infer<typeof busyDetails>;
|
|
181
|
+
/**
|
|
182
|
+
* One durable record of one invocation. One row per run, never one per event:
|
|
183
|
+
* the per-event timeline's write rate
|
|
184
|
+
* is set by the bridge, and a throttled log that cannot say it was throttled is
|
|
185
|
+
* an instrument that cannot say what it does not know. The live timeline is
|
|
186
|
+
* delivered in full by realtime, for as long as somebody is watching.
|
|
187
|
+
*/
|
|
188
|
+
declare const jobRun: z.ZodObject<{
|
|
189
|
+
id: z.ZodUUID;
|
|
190
|
+
robot_id: z.ZodUUID;
|
|
191
|
+
slug: z.ZodString;
|
|
192
|
+
kind: z.ZodEnum<{
|
|
193
|
+
action: "action";
|
|
194
|
+
service: "service";
|
|
195
|
+
}>;
|
|
196
|
+
state: z.ZodEnum<{
|
|
197
|
+
failed: "failed";
|
|
198
|
+
running: "running";
|
|
199
|
+
succeeded: "succeeded";
|
|
200
|
+
cancelled: "cancelled";
|
|
201
|
+
lost: "lost";
|
|
202
|
+
}>;
|
|
203
|
+
started_at: z.ZodISODateTime;
|
|
204
|
+
ended_at: z.ZodNullable<z.ZodISODateTime>;
|
|
205
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
206
|
+
result: z.ZodNullable<z.ZodUnknown>;
|
|
207
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
208
|
+
code: z.ZodString;
|
|
209
|
+
message: z.ZodString;
|
|
210
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
211
|
+
}, z.core.$strip>>;
|
|
212
|
+
actor: z.ZodObject<{
|
|
213
|
+
kind: z.ZodEnum<{
|
|
214
|
+
developer: "developer";
|
|
215
|
+
server_key: "server_key";
|
|
216
|
+
end_user: "end_user";
|
|
217
|
+
app_user: "app_user";
|
|
218
|
+
}>;
|
|
219
|
+
id: z.ZodUUID;
|
|
220
|
+
label: z.ZodString;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
seq: z.ZodNumber;
|
|
223
|
+
progress: z.ZodNullable<z.ZodNumber>;
|
|
224
|
+
feedback: z.ZodNullable<z.ZodUnknown>;
|
|
225
|
+
}, z.core.$strip>;
|
|
226
|
+
type JobRun = z.infer<typeof jobRun>;
|
|
227
|
+
declare const jobRunListResponse: z.ZodObject<{
|
|
228
|
+
runs: z.ZodArray<z.ZodObject<{
|
|
229
|
+
id: z.ZodUUID;
|
|
230
|
+
robot_id: z.ZodUUID;
|
|
231
|
+
slug: z.ZodString;
|
|
232
|
+
kind: z.ZodEnum<{
|
|
233
|
+
action: "action";
|
|
234
|
+
service: "service";
|
|
235
|
+
}>;
|
|
236
|
+
state: z.ZodEnum<{
|
|
237
|
+
failed: "failed";
|
|
238
|
+
running: "running";
|
|
239
|
+
succeeded: "succeeded";
|
|
240
|
+
cancelled: "cancelled";
|
|
241
|
+
lost: "lost";
|
|
242
|
+
}>;
|
|
243
|
+
started_at: z.ZodISODateTime;
|
|
244
|
+
ended_at: z.ZodNullable<z.ZodISODateTime>;
|
|
245
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
246
|
+
result: z.ZodNullable<z.ZodUnknown>;
|
|
247
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
248
|
+
code: z.ZodString;
|
|
249
|
+
message: z.ZodString;
|
|
250
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
251
|
+
}, z.core.$strip>>;
|
|
252
|
+
actor: z.ZodObject<{
|
|
253
|
+
kind: z.ZodEnum<{
|
|
254
|
+
developer: "developer";
|
|
255
|
+
server_key: "server_key";
|
|
256
|
+
end_user: "end_user";
|
|
257
|
+
app_user: "app_user";
|
|
258
|
+
}>;
|
|
259
|
+
id: z.ZodUUID;
|
|
260
|
+
label: z.ZodString;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
seq: z.ZodNumber;
|
|
263
|
+
progress: z.ZodNullable<z.ZodNumber>;
|
|
264
|
+
feedback: z.ZodNullable<z.ZodUnknown>;
|
|
265
|
+
}, z.core.$strip>>;
|
|
266
|
+
next_cursor: z.ZodNullable<z.ZodNumber>;
|
|
267
|
+
}, z.core.$strip>;
|
|
268
|
+
type JobRunListResponse = z.infer<typeof jobRunListResponse>;
|
|
119
269
|
|
|
120
270
|
/**
|
|
121
271
|
* The REST read of one datapoint. For bridge-captured data `timestamp_ms`
|
|
@@ -413,6 +563,29 @@ declare const clientIdentity: z.ZodObject<{
|
|
|
413
563
|
type ClientIdentity = z.infer<typeof clientIdentity>;
|
|
414
564
|
|
|
415
565
|
|
|
566
|
+
/**
|
|
567
|
+
* One robot as `GET /api/client/robots` lists it — the REST twin of the MCP
|
|
568
|
+
* tool `robots_list`, and the one robot question no robot-scoped route can
|
|
569
|
+
* answer: which robots may I name at all.
|
|
570
|
+
*
|
|
571
|
+
* Deliberately not `robotListItem`: that one carries `exposes`, the per-kind
|
|
572
|
+
* counts a developer's list shows, which are a configuration fact rather than
|
|
573
|
+
* something an app user's role grants. What an app user is entitled to is the
|
|
574
|
+
* robot, its bridge state, and whether anything is published on it yet.
|
|
575
|
+
*/
|
|
576
|
+
declare const clientRobotListItem: z.ZodObject<{
|
|
577
|
+
bridge_state: z.ZodObject<{
|
|
578
|
+
online: z.ZodBoolean;
|
|
579
|
+
latency_ms: z.ZodNullable<z.ZodNumber>;
|
|
580
|
+
}, z.core.$strip>;
|
|
581
|
+
published_version: z.ZodNullable<z.ZodNumber>;
|
|
582
|
+
id: z.ZodUUID;
|
|
583
|
+
name: z.ZodString;
|
|
584
|
+
created_at: z.ZodISODateTime;
|
|
585
|
+
}, z.core.$strip>;
|
|
586
|
+
type ClientRobotListItem = z.infer<typeof clientRobotListItem>;
|
|
587
|
+
|
|
588
|
+
|
|
416
589
|
declare const asset: z.ZodObject<{
|
|
417
590
|
id: z.ZodUUID;
|
|
418
591
|
robot_id: z.ZodUUID;
|
|
@@ -555,10 +728,10 @@ type AssetListResponse = z.infer<typeof assetListResponse>;
|
|
|
555
728
|
* console renders a third, and each is right in its own tests.
|
|
556
729
|
*
|
|
557
730
|
* `field` is the **flat key exactly as the caller sent it** — the same string
|
|
558
|
-
* as the `parameterSpec.name` it violated. That is the
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
731
|
+
* as the `parameterSpec.name` it violated. That is why the parameter form
|
|
732
|
+
* stays flat: a refusal has to name something the caller can find in what
|
|
733
|
+
* they typed, and a console can attach the error to that one input rather
|
|
734
|
+
* than to the form.
|
|
562
735
|
*/
|
|
563
736
|
declare const parameterViolation: z.ZodObject<{
|
|
564
737
|
field: z.ZodString;
|
|
@@ -1867,6 +2040,24 @@ interface DatapointsApi {
|
|
|
1867
2040
|
}): Promise<HistorySamplesResponse>;
|
|
1868
2041
|
}
|
|
1869
2042
|
|
|
2043
|
+
/**
|
|
2044
|
+
* The filters `jobs.history` reads. Every field is optional; the wire names
|
|
2045
|
+
* are snake_case and this SDK spells them the way its other options are
|
|
2046
|
+
* spelt. `fromMs`/`toMs` are unix milliseconds, a half-open window
|
|
2047
|
+
* `[from, to)` so adjacent windows never both contain the run on their
|
|
2048
|
+
* boundary. `limit` above the platform's page cap is refused with
|
|
2049
|
+
* `validation_error`, not quietly reduced.
|
|
2050
|
+
*/
|
|
2051
|
+
interface JobHistoryOptions {
|
|
2052
|
+
slug?: string;
|
|
2053
|
+
state?: JobState;
|
|
2054
|
+
kind?: 'action' | 'service';
|
|
2055
|
+
limit?: number;
|
|
2056
|
+
/** The previous page's `next_cursor`. Send it back rather than computing one. */
|
|
2057
|
+
beforeSeq?: number;
|
|
2058
|
+
fromMs?: number;
|
|
2059
|
+
toMs?: number;
|
|
2060
|
+
}
|
|
1870
2061
|
/**
|
|
1871
2062
|
* Robot-wide job reads, reachable as `client.jobs` — addressed by robot,
|
|
1872
2063
|
* not slug, which `actions` and `services` cannot do.
|
|
@@ -1883,11 +2074,11 @@ interface JobsApi {
|
|
|
1883
2074
|
* way an app developer reaches them.
|
|
1884
2075
|
*
|
|
1885
2076
|
* At most one entry per slug: the current job there, same as a per-slug
|
|
1886
|
-
* read would answer. Not a history endpoint
|
|
1887
|
-
* `cameras.list`/`datapoints` — an end user or
|
|
1888
|
-
* on slugs their role grants, a developer
|
|
1889
|
-
* robot. Never empty-vs-missing ambiguity:
|
|
1890
|
-
* resolves `[]`.
|
|
2077
|
+
* read would answer. Not a history endpoint — that is `history` below.
|
|
2078
|
+
* Grant-filtered same as `cameras.list`/`datapoints` — an end user or
|
|
2079
|
+
* server key sees only jobs on slugs their role grants, a developer
|
|
2080
|
+
* session sees every job on the robot. Never empty-vs-missing ambiguity:
|
|
2081
|
+
* a robot doing nothing resolves `[]`.
|
|
1891
2082
|
*
|
|
1892
2083
|
* **Ordered newest first by `started_at`, with `job.seq` as the
|
|
1893
2084
|
* tiebreaker** (`started_at` alone is not a total order — two jobs minted
|
|
@@ -1900,6 +2091,26 @@ interface JobsApi {
|
|
|
1900
2091
|
* hour-long one was only just adopted.
|
|
1901
2092
|
*/
|
|
1902
2093
|
list(robotId: string): Promise<Job[]>;
|
|
2094
|
+
/**
|
|
2095
|
+
* What *has* run on this robot: one row per run, newest first by the
|
|
2096
|
+
* durable `seq`, with its actor, its outcome and its `duration_ms`, kept
|
|
2097
|
+
* for 90 days. The durable counterpart of `list`.
|
|
2098
|
+
*
|
|
2099
|
+
* **Needs the `action_history` capability** on the caller's role, or it
|
|
2100
|
+
* rejects `capability_required`. An app user sees only runs on the slugs
|
|
2101
|
+
* their role grants; a developer session sees the whole robot.
|
|
2102
|
+
*
|
|
2103
|
+
* **Page until `next_cursor` is `null`, never until a page looks short.**
|
|
2104
|
+
* The cloud applies the role's grants to the page it already read, so a
|
|
2105
|
+
* page can come back thin — or empty — with a perfectly good non-null
|
|
2106
|
+
* cursor behind it. `runs.length === 0` is not an end-of-data signal.
|
|
2107
|
+
*
|
|
2108
|
+
* It lags realtime by a moment, deliberately: a run watched to completion
|
|
2109
|
+
* over `actions.subscribe` can still read `running` here for an instant.
|
|
2110
|
+
* Render the outcome from the realtime job you already have; use this for
|
|
2111
|
+
* what you were not watching.
|
|
2112
|
+
*/
|
|
2113
|
+
history(robotId: string, options?: JobHistoryOptions): Promise<JobRunListResponse>;
|
|
1903
2114
|
}
|
|
1904
2115
|
|
|
1905
2116
|
/**
|
|
@@ -1928,6 +2139,43 @@ interface PublishersApi {
|
|
|
1928
2139
|
publish(robotId: string, slug: string, message: Record<string, unknown>, options?: SendCommandOptions): Promise<void>;
|
|
1929
2140
|
}
|
|
1930
2141
|
|
|
2142
|
+
/**
|
|
2143
|
+
* Discovery, reachable as `client.robots`: which robots may I name at all,
|
|
2144
|
+
* and what may I do on one. The two calls every app screen starts from;
|
|
2145
|
+
* every other namespace takes a `robotId` that came from here.
|
|
2146
|
+
*
|
|
2147
|
+
* The answers are the caller's role made visible — the same rows and the
|
|
2148
|
+
* same datasheet the MCP tools `robots_list` and `robot_describe` answer,
|
|
2149
|
+
* from the same code on the server. There is no client-side filtering to
|
|
2150
|
+
* do and nothing to cache: a role change shows at the next call.
|
|
2151
|
+
*/
|
|
2152
|
+
interface RobotsApi {
|
|
2153
|
+
/**
|
|
2154
|
+
* The robots this caller reaches, in name order with the id as the tiebreak.
|
|
2155
|
+
*
|
|
2156
|
+
* An app user reaches the robots their app attaches on which their role
|
|
2157
|
+
* grants at least one slug or capability; a server key reaches every robot
|
|
2158
|
+
* its app attaches. A robot the role grants nothing on is absent rather
|
|
2159
|
+
* than listed empty — reach is a grant, not an attachment — so a new app
|
|
2160
|
+
* whose built-in roles grant nothing yet resolves `[]`, and that is the
|
|
2161
|
+
* console's Roles tab talking, not a broken login.
|
|
2162
|
+
*/
|
|
2163
|
+
list(): Promise<ClientRobotListItem[]>;
|
|
2164
|
+
/**
|
|
2165
|
+
* Everything the caller's role lets them do on one robot: every granted
|
|
2166
|
+
* datapoint (with `unit` and `decimals`), action, service and publisher
|
|
2167
|
+
* (with the parameter JSON Schema under `input_schema`) and camera, plus
|
|
2168
|
+
* the two capabilities that gate whole features, `action_history` and
|
|
2169
|
+
* `assets`. A robot with nothing published resolves an empty `exposures`
|
|
2170
|
+
* list. One the caller does not reach rejects `not_found`, exactly as a
|
|
2171
|
+
* robot that does not exist — never `forbidden`, which would say it exists.
|
|
2172
|
+
*
|
|
2173
|
+
* The type is `McpRobotDatasheet` because the MCP server answered it first;
|
|
2174
|
+
* the prefix is history, not scope.
|
|
2175
|
+
*/
|
|
2176
|
+
describe(robotId: string): Promise<McpRobotDatasheet>;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
1931
2179
|
/**
|
|
1932
2180
|
* Request/response calls to a robot, reachable as `client.services`. A
|
|
1933
2181
|
* service answers once and is done — one method, nothing to subscribe to.
|
|
@@ -2037,6 +2285,8 @@ interface FleetlessClient {
|
|
|
2037
2285
|
readonly jobs: JobsApi;
|
|
2038
2286
|
/** URDF and mesh reads — list/get/urdf, plus the `urdf-loader` mesh callback. */
|
|
2039
2287
|
readonly assets: AssetsApi;
|
|
2288
|
+
/** Which robots this caller reaches, and what their role lets them do on each — the calls every screen starts from. */
|
|
2289
|
+
readonly robots: RobotsApi;
|
|
2040
2290
|
/**
|
|
2041
2291
|
* Closes the realtime channel and stops it from reconnecting. Safe with
|
|
2042
2292
|
* no subscription ever made, and safe to call twice. A Node script (the
|
|
@@ -2060,4 +2310,4 @@ interface FleetlessClient {
|
|
|
2060
2310
|
*/
|
|
2061
2311
|
declare function createClient(options: FleetlessClientOptions): FleetlessClient;
|
|
2062
2312
|
|
|
2063
|
-
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 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 JobState, type JobSubscription, type JobSubscriptionHandlers, type JobsApi, type McpConsentGrant, type McpInteractionDecision, type MeshLoaderDelegate, type OidcLoginRequest, type ParameterInvalidDetails, type ParameterViolation, type PrepareUrdfSceneOptions, type ProviderButton, type PublishersApi, type RateLimitDetails, type RegisterOptions, SDK_ERROR_CODES, type SdkErrorCode, type SendCommandOptions, type ServicesApi, type StoredSession, type TokenStore, type UrdfCompleteness, type UrdfSceneManager, type UrdfSceneResources, createClient, parameterInvalidDetails };
|
|
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 };
|