@anduril-industries/lattice-sdk 4.4.1 → 4.6.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/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/tasks/client/Client.d.ts +24 -6
- package/dist/cjs/api/resources/tasks/client/Client.js +76 -6
- package/dist/cjs/api/resources/tasks/client/requests/ManualControlStreamRequest.d.ts +12 -0
- package/dist/cjs/api/resources/tasks/client/requests/ManualControlStreamRequest.js +3 -0
- package/dist/cjs/api/resources/tasks/client/requests/TaskStreamRequest.d.ts +52 -0
- package/dist/cjs/api/resources/tasks/client/requests/TaskStreamRequest.js +33 -0
- package/dist/cjs/api/resources/tasks/client/requests/index.d.ts +2 -1
- package/dist/cjs/api/resources/tasks/client/requests/index.js +3 -1
- package/dist/cjs/api/resources/tasks/types/StreamManualControlFramesResponse.d.ts +13 -0
- package/dist/cjs/api/resources/tasks/types/StreamManualControlFramesResponse.js +3 -0
- package/dist/cjs/api/resources/tasks/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/tasks/types/index.js +1 -0
- package/dist/cjs/api/types/ManualControlFrame.d.ts +38 -0
- package/dist/cjs/api/types/ManualControlFrame.js +3 -0
- package/dist/cjs/api/types/ManualControlFrameEvent.d.ts +3 -0
- package/dist/cjs/api/types/ManualControlFrameEvent.js +3 -0
- package/dist/cjs/api/types/index.d.ts +2 -0
- package/dist/cjs/api/types/index.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +2 -2
- package/dist/cjs/core/auth/BasicAuth.js +7 -1
- package/dist/cjs/core/fetcher/Fetcher.d.ts +2 -0
- package/dist/cjs/core/fetcher/Fetcher.js +4 -0
- package/dist/cjs/errors/LatticeError.d.ts +3 -1
- package/dist/cjs/errors/LatticeError.js +4 -1
- package/dist/cjs/errors/LatticeTimeoutError.d.ts +4 -1
- package/dist/cjs/errors/LatticeTimeoutError.js +4 -1
- package/dist/cjs/errors/handleNonStatusCodeError.js +4 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/tasks/client/Client.d.mts +24 -6
- package/dist/esm/api/resources/tasks/client/Client.mjs +76 -6
- package/dist/esm/api/resources/tasks/client/requests/ManualControlStreamRequest.d.mts +12 -0
- package/dist/esm/api/resources/tasks/client/requests/ManualControlStreamRequest.mjs +2 -0
- package/dist/esm/api/resources/tasks/client/requests/TaskStreamRequest.d.mts +52 -0
- package/dist/esm/api/resources/tasks/client/requests/TaskStreamRequest.mjs +32 -1
- package/dist/esm/api/resources/tasks/client/requests/index.d.mts +2 -1
- package/dist/esm/api/resources/tasks/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/tasks/types/StreamManualControlFramesResponse.d.mts +13 -0
- package/dist/esm/api/resources/tasks/types/StreamManualControlFramesResponse.mjs +2 -0
- package/dist/esm/api/resources/tasks/types/index.d.mts +1 -0
- package/dist/esm/api/resources/tasks/types/index.mjs +1 -0
- package/dist/esm/api/types/ManualControlFrame.d.mts +38 -0
- package/dist/esm/api/types/ManualControlFrame.mjs +2 -0
- package/dist/esm/api/types/ManualControlFrameEvent.d.mts +3 -0
- package/dist/esm/api/types/ManualControlFrameEvent.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +2 -0
- package/dist/esm/api/types/index.mjs +2 -0
- package/dist/esm/core/auth/BasicAuth.d.mts +2 -2
- package/dist/esm/core/auth/BasicAuth.mjs +7 -1
- package/dist/esm/core/fetcher/Fetcher.d.mts +2 -0
- package/dist/esm/core/fetcher/Fetcher.mjs +4 -0
- package/dist/esm/errors/LatticeError.d.mts +3 -1
- package/dist/esm/errors/LatticeError.mjs +4 -1
- package/dist/esm/errors/LatticeTimeoutError.d.mts +4 -1
- package/dist/esm/errors/LatticeTimeoutError.mjs +4 -1
- package/dist/esm/errors/handleNonStatusCodeError.mjs +4 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +85 -6
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@anduril-industries/lattice-sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "4.
|
|
47
|
-
"User-Agent": "@anduril-industries/lattice-sdk/4.
|
|
46
|
+
"X-Fern-SDK-Version": "4.6.0",
|
|
47
|
+
"User-Agent": "@anduril-industries/lattice-sdk/4.6.0",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -93,12 +93,11 @@ export declare class TasksClient {
|
|
|
93
93
|
* This method initiates task cancellation based on the task's current state:
|
|
94
94
|
* - If the task has not been sent to an agent, it cancels immediately and transitions the task
|
|
95
95
|
* to a terminal state (`STATUS_DONE_NOT_OK` with `ERROR_CODE_CANCELLED`).
|
|
96
|
-
* - If the task has already been sent to an agent, the cancellation request is routed to the agent
|
|
97
|
-
* The agent is responsible for
|
|
98
|
-
* the task
|
|
99
|
-
* - If the task
|
|
100
|
-
*
|
|
101
|
-
* or the returned task object.
|
|
96
|
+
* - If the task has already been sent to an agent, the cancellation request is routed to the agent.
|
|
97
|
+
* The agent is then responsible for deciding whether cancellation is possible or not:
|
|
98
|
+
* - If the task can be cancelled, the agent must use `UpdateTaskStatus` and set the task status to `STATUS_DONE_NOT_OK`.
|
|
99
|
+
* - If the task cannot be cancelled, the agent must use `UpdateTaskStatus` to attach a `TaskError` to the task with the error code `ERROR_CODE_REJECTED`
|
|
100
|
+
* and a `message` explaining why the task cannot be cancelled.
|
|
102
101
|
*
|
|
103
102
|
* @param {Lattice.TaskCancellation} request
|
|
104
103
|
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -209,4 +208,23 @@ export declare class TasksClient {
|
|
|
209
208
|
*/
|
|
210
209
|
streamAsAgent(request?: Lattice.AgentStreamRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<core.Stream<Lattice.StreamAsAgentResponse>>;
|
|
211
210
|
private __streamAsAgent;
|
|
211
|
+
/**
|
|
212
|
+
* @beta This endpoint is in pre-release and may change.
|
|
213
|
+
*
|
|
214
|
+
* Establishes a server streaming connection that delivers manual control frames to agents
|
|
215
|
+
* using server-sent events (SSE).
|
|
216
|
+
*
|
|
217
|
+
* This endpoint streams manual control frames, for example, for joystick movements, for a specific task
|
|
218
|
+
* to the executing agent. The agent should open this stream before reporting `STATUS_EXECUTING`
|
|
219
|
+
* to ensure it is ready to receive control input when the operator begins sending frames.
|
|
220
|
+
*
|
|
221
|
+
* Each frame includes epoch and sequence metadata for handling concurrent control sessions
|
|
222
|
+
* and detecting stale or out-of-order frames. Heartbeat messages are sent periodically to
|
|
223
|
+
* maintain the connection.
|
|
224
|
+
*
|
|
225
|
+
* The stream terminates automatically when the task reaches a terminal state
|
|
226
|
+
* (`STATUS_DONE_OK` or `STATUS_DONE_NOT_OK`).
|
|
227
|
+
*/
|
|
228
|
+
streamManualControlFrames(request: Lattice.ManualControlStreamRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<core.Stream<Lattice.StreamManualControlFramesResponse>>;
|
|
229
|
+
private __streamManualControlFrames;
|
|
212
230
|
}
|
|
@@ -272,12 +272,11 @@ class TasksClient {
|
|
|
272
272
|
* This method initiates task cancellation based on the task's current state:
|
|
273
273
|
* - If the task has not been sent to an agent, it cancels immediately and transitions the task
|
|
274
274
|
* to a terminal state (`STATUS_DONE_NOT_OK` with `ERROR_CODE_CANCELLED`).
|
|
275
|
-
* - If the task has already been sent to an agent, the cancellation request is routed to the agent
|
|
276
|
-
* The agent is responsible for
|
|
277
|
-
* the task
|
|
278
|
-
* - If the task
|
|
279
|
-
*
|
|
280
|
-
* or the returned task object.
|
|
275
|
+
* - If the task has already been sent to an agent, the cancellation request is routed to the agent.
|
|
276
|
+
* The agent is then responsible for deciding whether cancellation is possible or not:
|
|
277
|
+
* - If the task can be cancelled, the agent must use `UpdateTaskStatus` and set the task status to `STATUS_DONE_NOT_OK`.
|
|
278
|
+
* - If the task cannot be cancelled, the agent must use `UpdateTaskStatus` to attach a `TaskError` to the task with the error code `ERROR_CODE_REJECTED`
|
|
279
|
+
* and a `message` explaining why the task cannot be cancelled.
|
|
281
280
|
*
|
|
282
281
|
* @param {Lattice.TaskCancellation} request
|
|
283
282
|
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -615,5 +614,76 @@ class TasksClient {
|
|
|
615
614
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/v1/agent/stream");
|
|
616
615
|
});
|
|
617
616
|
}
|
|
617
|
+
/**
|
|
618
|
+
* @beta This endpoint is in pre-release and may change.
|
|
619
|
+
*
|
|
620
|
+
* Establishes a server streaming connection that delivers manual control frames to agents
|
|
621
|
+
* using server-sent events (SSE).
|
|
622
|
+
*
|
|
623
|
+
* This endpoint streams manual control frames, for example, for joystick movements, for a specific task
|
|
624
|
+
* to the executing agent. The agent should open this stream before reporting `STATUS_EXECUTING`
|
|
625
|
+
* to ensure it is ready to receive control input when the operator begins sending frames.
|
|
626
|
+
*
|
|
627
|
+
* Each frame includes epoch and sequence metadata for handling concurrent control sessions
|
|
628
|
+
* and detecting stale or out-of-order frames. Heartbeat messages are sent periodically to
|
|
629
|
+
* maintain the connection.
|
|
630
|
+
*
|
|
631
|
+
* The stream terminates automatically when the task reaches a terminal state
|
|
632
|
+
* (`STATUS_DONE_OK` or `STATUS_DONE_NOT_OK`).
|
|
633
|
+
*/
|
|
634
|
+
streamManualControlFrames(request, requestOptions) {
|
|
635
|
+
return core.HttpResponsePromise.fromPromise(this.__streamManualControlFrames(request, requestOptions));
|
|
636
|
+
}
|
|
637
|
+
__streamManualControlFrames(request, requestOptions) {
|
|
638
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
639
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
640
|
+
const { taskId } = request, _body = __rest(request, ["taskId"]);
|
|
641
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
642
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
643
|
+
const _response = yield core.fetcher({
|
|
644
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, `api/v1/tasks/${core.url.encodePathParam(taskId)}/manual-control/stream`),
|
|
645
|
+
method: "POST",
|
|
646
|
+
headers: _headers,
|
|
647
|
+
contentType: "application/json",
|
|
648
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
649
|
+
requestType: "json",
|
|
650
|
+
body: _body,
|
|
651
|
+
responseType: "sse",
|
|
652
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
653
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
654
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
655
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
656
|
+
logging: this._options.logging,
|
|
657
|
+
});
|
|
658
|
+
if (_response.ok) {
|
|
659
|
+
return {
|
|
660
|
+
data: new core.Stream({
|
|
661
|
+
stream: _response.body,
|
|
662
|
+
parse: (data) => data,
|
|
663
|
+
signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
664
|
+
eventShape: {
|
|
665
|
+
type: "sse",
|
|
666
|
+
},
|
|
667
|
+
}),
|
|
668
|
+
rawResponse: _response.rawResponse,
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
if (_response.error.reason === "status-code") {
|
|
672
|
+
switch (_response.error.statusCode) {
|
|
673
|
+
case 400:
|
|
674
|
+
throw new Lattice.BadRequestError(_response.error.body, _response.rawResponse);
|
|
675
|
+
case 401:
|
|
676
|
+
throw new Lattice.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
677
|
+
default:
|
|
678
|
+
throw new errors.LatticeError({
|
|
679
|
+
statusCode: _response.error.statusCode,
|
|
680
|
+
body: _response.error.body,
|
|
681
|
+
rawResponse: _response.rawResponse,
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/v1/tasks/{taskId}/manual-control/stream");
|
|
686
|
+
});
|
|
687
|
+
}
|
|
618
688
|
}
|
|
619
689
|
exports.TasksClient = TasksClient;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* taskId: "taskId"
|
|
5
|
+
* }
|
|
6
|
+
*/
|
|
7
|
+
export interface ManualControlStreamRequest {
|
|
8
|
+
/** The ID of the manual control task to receive frames for. */
|
|
9
|
+
taskId: string;
|
|
10
|
+
/** The time interval, in milliseconds, that determines the frequency at which to send heartbeat events. Defaults to 30000 (30 seconds). */
|
|
11
|
+
heartbeatIntervalMs?: number;
|
|
12
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as Lattice from "../../../../index.js";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {}
|
|
@@ -17,6 +18,18 @@ export interface TaskStreamRequest {
|
|
|
17
18
|
excludePreexistingTasks?: boolean;
|
|
18
19
|
/** Optional filter that only returns tasks with specific types. If not provided, all task types will be streamed. */
|
|
19
20
|
taskType?: TaskStreamRequest.TaskType;
|
|
21
|
+
/** If provided, returns tasks which have been updated since the given time. */
|
|
22
|
+
updateStartTime?: Lattice.Timestamp;
|
|
23
|
+
/**
|
|
24
|
+
* A filter for tasks with a specific parent task ID.
|
|
25
|
+
* Note: This filter is mutually exclusive with all other filter fields (`updateStartTime`, `assignee`, `statusFilter`, `taskType`).
|
|
26
|
+
* Either provide `parentTaskId` or any combination of the other filters, but not both.
|
|
27
|
+
*/
|
|
28
|
+
parentTaskId?: string;
|
|
29
|
+
/** A filter for tasks assigned to a specific principal. */
|
|
30
|
+
assignee?: Lattice.Principal;
|
|
31
|
+
/** A filter for task statuses (inclusive or exclusive). */
|
|
32
|
+
statusFilter?: TaskStreamRequest.StatusFilter;
|
|
20
33
|
}
|
|
21
34
|
export declare namespace TaskStreamRequest {
|
|
22
35
|
/**
|
|
@@ -27,4 +40,43 @@ export declare namespace TaskStreamRequest {
|
|
|
27
40
|
} | {
|
|
28
41
|
taskTypePrefix: string;
|
|
29
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* A filter for task statuses (inclusive or exclusive).
|
|
45
|
+
*/
|
|
46
|
+
interface StatusFilter {
|
|
47
|
+
/** The statuses to filter by. */
|
|
48
|
+
statuses?: StatusFilter.Statuses.Item[] | undefined;
|
|
49
|
+
/** The type of filter to apply. */
|
|
50
|
+
filterType?: StatusFilter.FilterType | undefined;
|
|
51
|
+
}
|
|
52
|
+
namespace StatusFilter {
|
|
53
|
+
type Statuses = Statuses.Item[];
|
|
54
|
+
namespace Statuses {
|
|
55
|
+
const Item: {
|
|
56
|
+
readonly StatusInvalid: "STATUS_INVALID";
|
|
57
|
+
readonly StatusCreated: "STATUS_CREATED";
|
|
58
|
+
readonly StatusScheduledInManager: "STATUS_SCHEDULED_IN_MANAGER";
|
|
59
|
+
readonly StatusSent: "STATUS_SENT";
|
|
60
|
+
readonly StatusMachineReceipt: "STATUS_MACHINE_RECEIPT";
|
|
61
|
+
readonly StatusAck: "STATUS_ACK";
|
|
62
|
+
readonly StatusWilco: "STATUS_WILCO";
|
|
63
|
+
readonly StatusExecuting: "STATUS_EXECUTING";
|
|
64
|
+
readonly StatusWaitingForUpdate: "STATUS_WAITING_FOR_UPDATE";
|
|
65
|
+
readonly StatusDoneOk: "STATUS_DONE_OK";
|
|
66
|
+
readonly StatusDoneNotOk: "STATUS_DONE_NOT_OK";
|
|
67
|
+
readonly StatusReplaced: "STATUS_REPLACED";
|
|
68
|
+
readonly StatusCancelRequested: "STATUS_CANCEL_REQUESTED";
|
|
69
|
+
readonly StatusCompleteRequested: "STATUS_COMPLETE_REQUESTED";
|
|
70
|
+
readonly StatusVersionRejected: "STATUS_VERSION_REJECTED";
|
|
71
|
+
};
|
|
72
|
+
type Item = (typeof Item)[keyof typeof Item];
|
|
73
|
+
}
|
|
74
|
+
/** The type of filter to apply. */
|
|
75
|
+
const FilterType: {
|
|
76
|
+
readonly FilterTypeInvalid: "FILTER_TYPE_INVALID";
|
|
77
|
+
readonly FilterTypeInclusive: "FILTER_TYPE_INCLUSIVE";
|
|
78
|
+
readonly FilterTypeExclusive: "FILTER_TYPE_EXCLUSIVE";
|
|
79
|
+
};
|
|
80
|
+
type FilterType = (typeof FilterType)[keyof typeof FilterType];
|
|
81
|
+
}
|
|
30
82
|
}
|
|
@@ -1,3 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated from our API Definition.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TaskStreamRequest = void 0;
|
|
5
|
+
var TaskStreamRequest;
|
|
6
|
+
(function (TaskStreamRequest) {
|
|
7
|
+
let StatusFilter;
|
|
8
|
+
(function (StatusFilter) {
|
|
9
|
+
let Statuses;
|
|
10
|
+
(function (Statuses) {
|
|
11
|
+
Statuses.Item = {
|
|
12
|
+
StatusInvalid: "STATUS_INVALID",
|
|
13
|
+
StatusCreated: "STATUS_CREATED",
|
|
14
|
+
StatusScheduledInManager: "STATUS_SCHEDULED_IN_MANAGER",
|
|
15
|
+
StatusSent: "STATUS_SENT",
|
|
16
|
+
StatusMachineReceipt: "STATUS_MACHINE_RECEIPT",
|
|
17
|
+
StatusAck: "STATUS_ACK",
|
|
18
|
+
StatusWilco: "STATUS_WILCO",
|
|
19
|
+
StatusExecuting: "STATUS_EXECUTING",
|
|
20
|
+
StatusWaitingForUpdate: "STATUS_WAITING_FOR_UPDATE",
|
|
21
|
+
StatusDoneOk: "STATUS_DONE_OK",
|
|
22
|
+
StatusDoneNotOk: "STATUS_DONE_NOT_OK",
|
|
23
|
+
StatusReplaced: "STATUS_REPLACED",
|
|
24
|
+
StatusCancelRequested: "STATUS_CANCEL_REQUESTED",
|
|
25
|
+
StatusCompleteRequested: "STATUS_COMPLETE_REQUESTED",
|
|
26
|
+
StatusVersionRejected: "STATUS_VERSION_REJECTED",
|
|
27
|
+
};
|
|
28
|
+
})(Statuses = StatusFilter.Statuses || (StatusFilter.Statuses = {}));
|
|
29
|
+
/** The type of filter to apply. */
|
|
30
|
+
StatusFilter.FilterType = {
|
|
31
|
+
FilterTypeInvalid: "FILTER_TYPE_INVALID",
|
|
32
|
+
FilterTypeInclusive: "FILTER_TYPE_INCLUSIVE",
|
|
33
|
+
FilterTypeExclusive: "FILTER_TYPE_EXCLUSIVE",
|
|
34
|
+
};
|
|
35
|
+
})(StatusFilter = TaskStreamRequest.StatusFilter || (TaskStreamRequest.StatusFilter = {}));
|
|
36
|
+
})(TaskStreamRequest || (exports.TaskStreamRequest = TaskStreamRequest = {}));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export type { AgentListener } from "./AgentListener.js";
|
|
2
2
|
export type { AgentStreamRequest } from "./AgentStreamRequest.js";
|
|
3
3
|
export type { GetTaskRequest } from "./GetTaskRequest.js";
|
|
4
|
+
export type { ManualControlStreamRequest } from "./ManualControlStreamRequest.js";
|
|
4
5
|
export type { TaskCancellation } from "./TaskCancellation.js";
|
|
5
6
|
export type { TaskCreation } from "./TaskCreation.js";
|
|
6
7
|
export { TaskQuery } from "./TaskQuery.js";
|
|
7
8
|
export type { TaskStatusUpdate } from "./TaskStatusUpdate.js";
|
|
8
|
-
export
|
|
9
|
+
export { TaskStreamRequest } from "./TaskStreamRequest.js";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaskQuery = void 0;
|
|
3
|
+
exports.TaskStreamRequest = exports.TaskQuery = void 0;
|
|
4
4
|
var TaskQuery_js_1 = require("./TaskQuery.js");
|
|
5
5
|
Object.defineProperty(exports, "TaskQuery", { enumerable: true, get: function () { return TaskQuery_js_1.TaskQuery; } });
|
|
6
|
+
var TaskStreamRequest_js_1 = require("./TaskStreamRequest.js");
|
|
7
|
+
Object.defineProperty(exports, "TaskStreamRequest", { enumerable: true, get: function () { return TaskStreamRequest_js_1.TaskStreamRequest; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as Lattice from "../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The stream event response.
|
|
4
|
+
*/
|
|
5
|
+
export type StreamManualControlFramesResponse = Lattice.StreamManualControlFramesResponse.Heartbeat | Lattice.StreamManualControlFramesResponse.ManualControlFrame;
|
|
6
|
+
export declare namespace StreamManualControlFramesResponse {
|
|
7
|
+
interface Heartbeat extends Lattice.StreamHeartbeat {
|
|
8
|
+
event: "heartbeat";
|
|
9
|
+
}
|
|
10
|
+
interface ManualControlFrame extends Lattice.ManualControlFrameEvent {
|
|
11
|
+
event: "manual_control_frame";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./StreamAsAgentResponse.js"), exports);
|
|
18
|
+
__exportStar(require("./StreamManualControlFramesResponse.js"), exports);
|
|
18
19
|
__exportStar(require("./StreamTasksResponse.js"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type * as Lattice from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* A single frame of manual control input forwarded by Lattice to an agent.
|
|
4
|
+
*
|
|
5
|
+
* When an operator sends manual control input, for example, joystick movements using
|
|
6
|
+
* `SendManualControlFrames`, Lattice packages each input into a `ManualControlFrame`
|
|
7
|
+
* and forwards it to the executing agent via the `ListenForManualControlFrames`
|
|
8
|
+
* streaming RPC.
|
|
9
|
+
*
|
|
10
|
+
* Each frame carries sequencing metadata to support concurrent control sessions,
|
|
11
|
+
* detect stale frames, and ensure proper ordering.
|
|
12
|
+
*/
|
|
13
|
+
export interface ManualControlFrame {
|
|
14
|
+
/** The ID of the manual control task this frame belongs to. */
|
|
15
|
+
taskId?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Unix timestamp in microseconds identifying the control session.
|
|
18
|
+
* Increments each time a client opens a new stream for this task.
|
|
19
|
+
* Agents should ignore frames with a lower epoch to handle stale streams
|
|
20
|
+
* or operator handoffs.
|
|
21
|
+
*/
|
|
22
|
+
epochMicros?: string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The sequence number for a stream, incremented for each frame.
|
|
25
|
+
* Agents can use this to detect out-of-order delivery within the same epoch.
|
|
26
|
+
*/
|
|
27
|
+
sequence?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The time at which this frame was created.
|
|
30
|
+
* Agents can use this to detect stale frame data.
|
|
31
|
+
*/
|
|
32
|
+
creationTime?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The control instructions for this frame, passed through from the client.
|
|
35
|
+
* The format of each task is specific to the task, and not visible to Lattice.
|
|
36
|
+
*/
|
|
37
|
+
specification?: Lattice.GoogleProtobufAny | undefined;
|
|
38
|
+
}
|
|
@@ -76,6 +76,8 @@ export * from "./ListResponse.js";
|
|
|
76
76
|
export * from "./Lla.js";
|
|
77
77
|
export * from "./Location.js";
|
|
78
78
|
export * from "./LocationUncertainty.js";
|
|
79
|
+
export * from "./ManualControlFrame.js";
|
|
80
|
+
export * from "./ManualControlFrameEvent.js";
|
|
79
81
|
export * from "./MeanKeplerianElements.js";
|
|
80
82
|
export * from "./Measurement.js";
|
|
81
83
|
export * from "./Media.js";
|
|
@@ -92,6 +92,8 @@ __exportStar(require("./ListResponse.js"), exports);
|
|
|
92
92
|
__exportStar(require("./Lla.js"), exports);
|
|
93
93
|
__exportStar(require("./Location.js"), exports);
|
|
94
94
|
__exportStar(require("./LocationUncertainty.js"), exports);
|
|
95
|
+
__exportStar(require("./ManualControlFrame.js"), exports);
|
|
96
|
+
__exportStar(require("./ManualControlFrameEvent.js"), exports);
|
|
95
97
|
__exportStar(require("./MeanKeplerianElements.js"), exports);
|
|
96
98
|
__exportStar(require("./Measurement.js"), exports);
|
|
97
99
|
__exportStar(require("./Media.js"), exports);
|
|
@@ -5,10 +5,16 @@ const base64_js_1 = require("../base64.js");
|
|
|
5
5
|
const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
|
|
6
6
|
exports.BasicAuth = {
|
|
7
7
|
toAuthorizationHeader: (basicAuth) => {
|
|
8
|
+
var _a, _b;
|
|
8
9
|
if (basicAuth == null) {
|
|
9
10
|
return undefined;
|
|
10
11
|
}
|
|
11
|
-
const
|
|
12
|
+
const username = (_a = basicAuth.username) !== null && _a !== void 0 ? _a : "";
|
|
13
|
+
const password = (_b = basicAuth.password) !== null && _b !== void 0 ? _b : "";
|
|
14
|
+
if (username === "" && password === "") {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const token = (0, base64_js_1.base64Encode)(`${username}:${password}`);
|
|
12
18
|
return `Basic ${token}`;
|
|
13
19
|
},
|
|
14
20
|
fromAuthorizationHeader: (header) => {
|
|
@@ -38,10 +38,12 @@ export declare namespace Fetcher {
|
|
|
38
38
|
}
|
|
39
39
|
interface TimeoutError {
|
|
40
40
|
reason: "timeout";
|
|
41
|
+
cause?: unknown;
|
|
41
42
|
}
|
|
42
43
|
interface UnknownError {
|
|
43
44
|
reason: "unknown";
|
|
44
45
|
errorMessage: string;
|
|
46
|
+
cause?: unknown;
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
|
|
@@ -261,6 +261,7 @@ function fetcherImpl(args) {
|
|
|
261
261
|
error: {
|
|
262
262
|
reason: "unknown",
|
|
263
263
|
errorMessage: "The user aborted a request",
|
|
264
|
+
cause: error,
|
|
264
265
|
},
|
|
265
266
|
rawResponse: RawResponse_js_1.abortRawResponse,
|
|
266
267
|
};
|
|
@@ -278,6 +279,7 @@ function fetcherImpl(args) {
|
|
|
278
279
|
ok: false,
|
|
279
280
|
error: {
|
|
280
281
|
reason: "timeout",
|
|
282
|
+
cause: error,
|
|
281
283
|
},
|
|
282
284
|
rawResponse: RawResponse_js_1.abortRawResponse,
|
|
283
285
|
};
|
|
@@ -296,6 +298,7 @@ function fetcherImpl(args) {
|
|
|
296
298
|
error: {
|
|
297
299
|
reason: "unknown",
|
|
298
300
|
errorMessage: error.message,
|
|
301
|
+
cause: error,
|
|
299
302
|
},
|
|
300
303
|
rawResponse: RawResponse_js_1.unknownRawResponse,
|
|
301
304
|
};
|
|
@@ -313,6 +316,7 @@ function fetcherImpl(args) {
|
|
|
313
316
|
error: {
|
|
314
317
|
reason: "unknown",
|
|
315
318
|
errorMessage: (0, json_js_1.toJson)(error),
|
|
319
|
+
cause: error,
|
|
316
320
|
},
|
|
317
321
|
rawResponse: RawResponse_js_1.unknownRawResponse,
|
|
318
322
|
};
|
|
@@ -3,10 +3,12 @@ export declare class LatticeError extends Error {
|
|
|
3
3
|
readonly statusCode?: number;
|
|
4
4
|
readonly body?: unknown;
|
|
5
5
|
readonly rawResponse?: core.RawResponse;
|
|
6
|
-
|
|
6
|
+
readonly cause?: unknown;
|
|
7
|
+
constructor({ message, statusCode, body, rawResponse, cause, }: {
|
|
7
8
|
message?: string;
|
|
8
9
|
statusCode?: number;
|
|
9
10
|
body?: unknown;
|
|
10
11
|
rawResponse?: core.RawResponse;
|
|
12
|
+
cause?: unknown;
|
|
11
13
|
});
|
|
12
14
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.LatticeError = void 0;
|
|
5
5
|
const json_js_1 = require("../core/json.js");
|
|
6
6
|
class LatticeError extends Error {
|
|
7
|
-
constructor({ message, statusCode, body, rawResponse, }) {
|
|
7
|
+
constructor({ message, statusCode, body, rawResponse, cause, }) {
|
|
8
8
|
super(buildMessage({ message, statusCode, body }));
|
|
9
9
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
10
10
|
if (Error.captureStackTrace) {
|
|
@@ -14,6 +14,9 @@ class LatticeError extends Error {
|
|
|
14
14
|
this.statusCode = statusCode;
|
|
15
15
|
this.body = body;
|
|
16
16
|
this.rawResponse = rawResponse;
|
|
17
|
+
if (cause != null) {
|
|
18
|
+
this.cause = cause;
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
exports.LatticeError = LatticeError;
|
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.LatticeTimeoutError = void 0;
|
|
5
5
|
class LatticeTimeoutError extends Error {
|
|
6
|
-
constructor(message) {
|
|
6
|
+
constructor(message, opts) {
|
|
7
7
|
super(message);
|
|
8
8
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
9
9
|
if (Error.captureStackTrace) {
|
|
10
10
|
Error.captureStackTrace(this, this.constructor);
|
|
11
11
|
}
|
|
12
12
|
this.name = this.constructor.name;
|
|
13
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
|
|
14
|
+
this.cause = opts.cause;
|
|
15
|
+
}
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
exports.LatticeTimeoutError = LatticeTimeoutError;
|
|
@@ -50,11 +50,14 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
|
|
|
50
50
|
rawResponse: rawResponse,
|
|
51
51
|
});
|
|
52
52
|
case "timeout":
|
|
53
|
-
throw new errors.LatticeTimeoutError(`Timeout exceeded when calling ${method} ${path}
|
|
53
|
+
throw new errors.LatticeTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
|
|
54
|
+
cause: error.cause,
|
|
55
|
+
});
|
|
54
56
|
case "unknown":
|
|
55
57
|
throw new errors.LatticeError({
|
|
56
58
|
message: error.errorMessage,
|
|
57
59
|
rawResponse: rawResponse,
|
|
60
|
+
cause: error.cause,
|
|
58
61
|
});
|
|
59
62
|
default:
|
|
60
63
|
throw new errors.LatticeError({
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.
|
|
1
|
+
export declare const SDK_VERSION = "4.6.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@anduril-industries/lattice-sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "4.
|
|
10
|
-
"User-Agent": "@anduril-industries/lattice-sdk/4.
|
|
9
|
+
"X-Fern-SDK-Version": "4.6.0",
|
|
10
|
+
"User-Agent": "@anduril-industries/lattice-sdk/4.6.0",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -93,12 +93,11 @@ export declare class TasksClient {
|
|
|
93
93
|
* This method initiates task cancellation based on the task's current state:
|
|
94
94
|
* - If the task has not been sent to an agent, it cancels immediately and transitions the task
|
|
95
95
|
* to a terminal state (`STATUS_DONE_NOT_OK` with `ERROR_CODE_CANCELLED`).
|
|
96
|
-
* - If the task has already been sent to an agent, the cancellation request is routed to the agent
|
|
97
|
-
* The agent is responsible for
|
|
98
|
-
* the task
|
|
99
|
-
* - If the task
|
|
100
|
-
*
|
|
101
|
-
* or the returned task object.
|
|
96
|
+
* - If the task has already been sent to an agent, the cancellation request is routed to the agent.
|
|
97
|
+
* The agent is then responsible for deciding whether cancellation is possible or not:
|
|
98
|
+
* - If the task can be cancelled, the agent must use `UpdateTaskStatus` and set the task status to `STATUS_DONE_NOT_OK`.
|
|
99
|
+
* - If the task cannot be cancelled, the agent must use `UpdateTaskStatus` to attach a `TaskError` to the task with the error code `ERROR_CODE_REJECTED`
|
|
100
|
+
* and a `message` explaining why the task cannot be cancelled.
|
|
102
101
|
*
|
|
103
102
|
* @param {Lattice.TaskCancellation} request
|
|
104
103
|
* @param {TasksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -209,4 +208,23 @@ export declare class TasksClient {
|
|
|
209
208
|
*/
|
|
210
209
|
streamAsAgent(request?: Lattice.AgentStreamRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<core.Stream<Lattice.StreamAsAgentResponse>>;
|
|
211
210
|
private __streamAsAgent;
|
|
211
|
+
/**
|
|
212
|
+
* @beta This endpoint is in pre-release and may change.
|
|
213
|
+
*
|
|
214
|
+
* Establishes a server streaming connection that delivers manual control frames to agents
|
|
215
|
+
* using server-sent events (SSE).
|
|
216
|
+
*
|
|
217
|
+
* This endpoint streams manual control frames, for example, for joystick movements, for a specific task
|
|
218
|
+
* to the executing agent. The agent should open this stream before reporting `STATUS_EXECUTING`
|
|
219
|
+
* to ensure it is ready to receive control input when the operator begins sending frames.
|
|
220
|
+
*
|
|
221
|
+
* Each frame includes epoch and sequence metadata for handling concurrent control sessions
|
|
222
|
+
* and detecting stale or out-of-order frames. Heartbeat messages are sent periodically to
|
|
223
|
+
* maintain the connection.
|
|
224
|
+
*
|
|
225
|
+
* The stream terminates automatically when the task reaches a terminal state
|
|
226
|
+
* (`STATUS_DONE_OK` or `STATUS_DONE_NOT_OK`).
|
|
227
|
+
*/
|
|
228
|
+
streamManualControlFrames(request: Lattice.ManualControlStreamRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<core.Stream<Lattice.StreamManualControlFramesResponse>>;
|
|
229
|
+
private __streamManualControlFrames;
|
|
212
230
|
}
|