@anduril-industries/lattice-sdk 4.5.0 → 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.
Files changed (56) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/tasks/client/Client.d.ts +19 -0
  3. package/dist/cjs/api/resources/tasks/client/Client.js +71 -0
  4. package/dist/cjs/api/resources/tasks/client/requests/ManualControlStreamRequest.d.ts +12 -0
  5. package/dist/cjs/api/resources/tasks/client/requests/ManualControlStreamRequest.js +3 -0
  6. package/dist/cjs/api/resources/tasks/client/requests/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/tasks/types/StreamManualControlFramesResponse.d.ts +13 -0
  8. package/dist/cjs/api/resources/tasks/types/StreamManualControlFramesResponse.js +3 -0
  9. package/dist/cjs/api/resources/tasks/types/index.d.ts +1 -0
  10. package/dist/cjs/api/resources/tasks/types/index.js +1 -0
  11. package/dist/cjs/api/types/ManualControlFrame.d.ts +38 -0
  12. package/dist/cjs/api/types/ManualControlFrame.js +3 -0
  13. package/dist/cjs/api/types/ManualControlFrameEvent.d.ts +3 -0
  14. package/dist/cjs/api/types/ManualControlFrameEvent.js +3 -0
  15. package/dist/cjs/api/types/index.d.ts +2 -0
  16. package/dist/cjs/api/types/index.js +2 -0
  17. package/dist/cjs/core/auth/BasicAuth.d.ts +2 -2
  18. package/dist/cjs/core/auth/BasicAuth.js +7 -1
  19. package/dist/cjs/core/fetcher/Fetcher.d.ts +2 -0
  20. package/dist/cjs/core/fetcher/Fetcher.js +4 -0
  21. package/dist/cjs/errors/LatticeError.d.ts +3 -1
  22. package/dist/cjs/errors/LatticeError.js +4 -1
  23. package/dist/cjs/errors/LatticeTimeoutError.d.ts +4 -1
  24. package/dist/cjs/errors/LatticeTimeoutError.js +4 -1
  25. package/dist/cjs/errors/handleNonStatusCodeError.js +4 -1
  26. package/dist/cjs/version.d.ts +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/esm/BaseClient.mjs +2 -2
  29. package/dist/esm/api/resources/tasks/client/Client.d.mts +19 -0
  30. package/dist/esm/api/resources/tasks/client/Client.mjs +71 -0
  31. package/dist/esm/api/resources/tasks/client/requests/ManualControlStreamRequest.d.mts +12 -0
  32. package/dist/esm/api/resources/tasks/client/requests/ManualControlStreamRequest.mjs +2 -0
  33. package/dist/esm/api/resources/tasks/client/requests/index.d.mts +1 -0
  34. package/dist/esm/api/resources/tasks/types/StreamManualControlFramesResponse.d.mts +13 -0
  35. package/dist/esm/api/resources/tasks/types/StreamManualControlFramesResponse.mjs +2 -0
  36. package/dist/esm/api/resources/tasks/types/index.d.mts +1 -0
  37. package/dist/esm/api/resources/tasks/types/index.mjs +1 -0
  38. package/dist/esm/api/types/ManualControlFrame.d.mts +38 -0
  39. package/dist/esm/api/types/ManualControlFrame.mjs +2 -0
  40. package/dist/esm/api/types/ManualControlFrameEvent.d.mts +3 -0
  41. package/dist/esm/api/types/ManualControlFrameEvent.mjs +2 -0
  42. package/dist/esm/api/types/index.d.mts +2 -0
  43. package/dist/esm/api/types/index.mjs +2 -0
  44. package/dist/esm/core/auth/BasicAuth.d.mts +2 -2
  45. package/dist/esm/core/auth/BasicAuth.mjs +7 -1
  46. package/dist/esm/core/fetcher/Fetcher.d.mts +2 -0
  47. package/dist/esm/core/fetcher/Fetcher.mjs +4 -0
  48. package/dist/esm/errors/LatticeError.d.mts +3 -1
  49. package/dist/esm/errors/LatticeError.mjs +4 -1
  50. package/dist/esm/errors/LatticeTimeoutError.d.mts +4 -1
  51. package/dist/esm/errors/LatticeTimeoutError.mjs +4 -1
  52. package/dist/esm/errors/handleNonStatusCodeError.mjs +4 -1
  53. package/dist/esm/version.d.mts +1 -1
  54. package/dist/esm/version.mjs +1 -1
  55. package/package.json +1 -1
  56. package/reference.md +80 -0
@@ -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.5.0",
47
- "User-Agent": "@anduril-industries/lattice-sdk/4.5.0",
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);
@@ -208,4 +208,23 @@ export declare class TasksClient {
208
208
  */
209
209
  streamAsAgent(request?: Lattice.AgentStreamRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<core.Stream<Lattice.StreamAsAgentResponse>>;
210
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;
211
230
  }
@@ -614,5 +614,76 @@ class TasksClient {
614
614
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/v1/agent/stream");
615
615
  });
616
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
+ }
617
688
  }
618
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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,7 @@
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";
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,3 @@
1
1
  export * from "./StreamAsAgentResponse.js";
2
+ export * from "./StreamManualControlFramesResponse.js";
2
3
  export * from "./StreamTasksResponse.js";
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import type * as Lattice from "../index.js";
2
+ export interface ManualControlFrameEvent extends Lattice.ManualControlFrame {
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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);
@@ -1,6 +1,6 @@
1
1
  export interface BasicAuth {
2
- username: string;
3
- password: string;
2
+ username?: string;
3
+ password?: string;
4
4
  }
5
5
  export declare const BasicAuth: {
6
6
  toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
@@ -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 token = (0, base64_js_1.base64Encode)(`${basicAuth.username}:${basicAuth.password}`);
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
- constructor({ message, statusCode, body, rawResponse, }: {
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;
@@ -1,3 +1,6 @@
1
1
  export declare class LatticeTimeoutError extends Error {
2
- constructor(message: string);
2
+ readonly cause?: unknown;
3
+ constructor(message: string, opts?: {
4
+ cause?: unknown;
5
+ });
3
6
  }
@@ -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({
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.5.0";
1
+ export declare const SDK_VERSION = "4.6.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "4.5.0";
4
+ exports.SDK_VERSION = "4.6.0";
@@ -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.5.0",
10
- "User-Agent": "@anduril-industries/lattice-sdk/4.5.0",
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);
@@ -208,4 +208,23 @@ export declare class TasksClient {
208
208
  */
209
209
  streamAsAgent(request?: Lattice.AgentStreamRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<core.Stream<Lattice.StreamAsAgentResponse>>;
210
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;
211
230
  }
@@ -578,4 +578,75 @@ export class TasksClient {
578
578
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/api/v1/agent/stream");
579
579
  });
580
580
  }
581
+ /**
582
+ * @beta This endpoint is in pre-release and may change.
583
+ *
584
+ * Establishes a server streaming connection that delivers manual control frames to agents
585
+ * using server-sent events (SSE).
586
+ *
587
+ * This endpoint streams manual control frames, for example, for joystick movements, for a specific task
588
+ * to the executing agent. The agent should open this stream before reporting `STATUS_EXECUTING`
589
+ * to ensure it is ready to receive control input when the operator begins sending frames.
590
+ *
591
+ * Each frame includes epoch and sequence metadata for handling concurrent control sessions
592
+ * and detecting stale or out-of-order frames. Heartbeat messages are sent periodically to
593
+ * maintain the connection.
594
+ *
595
+ * The stream terminates automatically when the task reaches a terminal state
596
+ * (`STATUS_DONE_OK` or `STATUS_DONE_NOT_OK`).
597
+ */
598
+ streamManualControlFrames(request, requestOptions) {
599
+ return core.HttpResponsePromise.fromPromise(this.__streamManualControlFrames(request, requestOptions));
600
+ }
601
+ __streamManualControlFrames(request, requestOptions) {
602
+ return __awaiter(this, void 0, void 0, function* () {
603
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
604
+ const { taskId } = request, _body = __rest(request, ["taskId"]);
605
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
606
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
607
+ const _response = yield core.fetcher({
608
+ 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`),
609
+ method: "POST",
610
+ headers: _headers,
611
+ contentType: "application/json",
612
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
613
+ requestType: "json",
614
+ body: _body,
615
+ responseType: "sse",
616
+ 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,
617
+ 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,
618
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
619
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
620
+ logging: this._options.logging,
621
+ });
622
+ if (_response.ok) {
623
+ return {
624
+ data: new core.Stream({
625
+ stream: _response.body,
626
+ parse: (data) => data,
627
+ signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
628
+ eventShape: {
629
+ type: "sse",
630
+ },
631
+ }),
632
+ rawResponse: _response.rawResponse,
633
+ };
634
+ }
635
+ if (_response.error.reason === "status-code") {
636
+ switch (_response.error.statusCode) {
637
+ case 400:
638
+ throw new Lattice.BadRequestError(_response.error.body, _response.rawResponse);
639
+ case 401:
640
+ throw new Lattice.UnauthorizedError(_response.error.body, _response.rawResponse);
641
+ default:
642
+ throw new errors.LatticeError({
643
+ statusCode: _response.error.statusCode,
644
+ body: _response.error.body,
645
+ rawResponse: _response.rawResponse,
646
+ });
647
+ }
648
+ }
649
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/api/v1/tasks/{taskId}/manual-control/stream");
650
+ });
651
+ }
581
652
  }
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated from our API Definition.
2
+ export {};
@@ -1,6 +1,7 @@
1
1
  export type { AgentListener } from "./AgentListener.mjs";
2
2
  export type { AgentStreamRequest } from "./AgentStreamRequest.mjs";
3
3
  export type { GetTaskRequest } from "./GetTaskRequest.mjs";
4
+ export type { ManualControlStreamRequest } from "./ManualControlStreamRequest.mjs";
4
5
  export type { TaskCancellation } from "./TaskCancellation.mjs";
5
6
  export type { TaskCreation } from "./TaskCreation.mjs";
6
7
  export { TaskQuery } from "./TaskQuery.mjs";
@@ -0,0 +1,13 @@
1
+ import type * as Lattice from "../../../index.mjs";
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
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated from our API Definition.
2
+ export {};
@@ -1,2 +1,3 @@
1
1
  export * from "./StreamAsAgentResponse.mjs";
2
+ export * from "./StreamManualControlFramesResponse.mjs";
2
3
  export * from "./StreamTasksResponse.mjs";
@@ -1,2 +1,3 @@
1
1
  export * from "./StreamAsAgentResponse.mjs";
2
+ export * from "./StreamManualControlFramesResponse.mjs";
2
3
  export * from "./StreamTasksResponse.mjs";
@@ -0,0 +1,38 @@
1
+ import type * as Lattice from "../index.mjs";
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
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ import type * as Lattice from "../index.mjs";
2
+ export interface ManualControlFrameEvent extends Lattice.ManualControlFrame {
3
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated from our API Definition.
2
+ export {};
@@ -76,6 +76,8 @@ export * from "./ListResponse.mjs";
76
76
  export * from "./Lla.mjs";
77
77
  export * from "./Location.mjs";
78
78
  export * from "./LocationUncertainty.mjs";
79
+ export * from "./ManualControlFrame.mjs";
80
+ export * from "./ManualControlFrameEvent.mjs";
79
81
  export * from "./MeanKeplerianElements.mjs";
80
82
  export * from "./Measurement.mjs";
81
83
  export * from "./Media.mjs";
@@ -76,6 +76,8 @@ export * from "./ListResponse.mjs";
76
76
  export * from "./Lla.mjs";
77
77
  export * from "./Location.mjs";
78
78
  export * from "./LocationUncertainty.mjs";
79
+ export * from "./ManualControlFrame.mjs";
80
+ export * from "./ManualControlFrameEvent.mjs";
79
81
  export * from "./MeanKeplerianElements.mjs";
80
82
  export * from "./Measurement.mjs";
81
83
  export * from "./Media.mjs";
@@ -1,6 +1,6 @@
1
1
  export interface BasicAuth {
2
- username: string;
3
- password: string;
2
+ username?: string;
3
+ password?: string;
4
4
  }
5
5
  export declare const BasicAuth: {
6
6
  toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
@@ -2,10 +2,16 @@ import { base64Decode, base64Encode } from "../base64.mjs";
2
2
  const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
3
3
  export const BasicAuth = {
4
4
  toAuthorizationHeader: (basicAuth) => {
5
+ var _a, _b;
5
6
  if (basicAuth == null) {
6
7
  return undefined;
7
8
  }
8
- const token = base64Encode(`${basicAuth.username}:${basicAuth.password}`);
9
+ const username = (_a = basicAuth.username) !== null && _a !== void 0 ? _a : "";
10
+ const password = (_b = basicAuth.password) !== null && _b !== void 0 ? _b : "";
11
+ if (username === "" && password === "") {
12
+ return undefined;
13
+ }
14
+ const token = base64Encode(`${username}:${password}`);
9
15
  return `Basic ${token}`;
10
16
  },
11
17
  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>>;
@@ -257,6 +257,7 @@ export function fetcherImpl(args) {
257
257
  error: {
258
258
  reason: "unknown",
259
259
  errorMessage: "The user aborted a request",
260
+ cause: error,
260
261
  },
261
262
  rawResponse: abortRawResponse,
262
263
  };
@@ -274,6 +275,7 @@ export function fetcherImpl(args) {
274
275
  ok: false,
275
276
  error: {
276
277
  reason: "timeout",
278
+ cause: error,
277
279
  },
278
280
  rawResponse: abortRawResponse,
279
281
  };
@@ -292,6 +294,7 @@ export function fetcherImpl(args) {
292
294
  error: {
293
295
  reason: "unknown",
294
296
  errorMessage: error.message,
297
+ cause: error,
295
298
  },
296
299
  rawResponse: unknownRawResponse,
297
300
  };
@@ -309,6 +312,7 @@ export function fetcherImpl(args) {
309
312
  error: {
310
313
  reason: "unknown",
311
314
  errorMessage: toJson(error),
315
+ cause: error,
312
316
  },
313
317
  rawResponse: unknownRawResponse,
314
318
  };
@@ -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
- constructor({ message, statusCode, body, rawResponse, }: {
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
  }
@@ -1,7 +1,7 @@
1
1
  // This file was auto-generated from our API Definition.
2
2
  import { toJson } from "../core/json.mjs";
3
3
  export class LatticeError extends Error {
4
- constructor({ message, statusCode, body, rawResponse, }) {
4
+ constructor({ message, statusCode, body, rawResponse, cause, }) {
5
5
  super(buildMessage({ message, statusCode, body }));
6
6
  Object.setPrototypeOf(this, new.target.prototype);
7
7
  if (Error.captureStackTrace) {
@@ -11,6 +11,9 @@ export class LatticeError extends Error {
11
11
  this.statusCode = statusCode;
12
12
  this.body = body;
13
13
  this.rawResponse = rawResponse;
14
+ if (cause != null) {
15
+ this.cause = cause;
16
+ }
14
17
  }
15
18
  }
16
19
  function buildMessage({ message, statusCode, body, }) {
@@ -1,3 +1,6 @@
1
1
  export declare class LatticeTimeoutError extends Error {
2
- constructor(message: string);
2
+ readonly cause?: unknown;
3
+ constructor(message: string, opts?: {
4
+ cause?: unknown;
5
+ });
3
6
  }
@@ -1,11 +1,14 @@
1
1
  // This file was auto-generated from our API Definition.
2
2
  export class LatticeTimeoutError extends Error {
3
- constructor(message) {
3
+ constructor(message, opts) {
4
4
  super(message);
5
5
  Object.setPrototypeOf(this, new.target.prototype);
6
6
  if (Error.captureStackTrace) {
7
7
  Error.captureStackTrace(this, this.constructor);
8
8
  }
9
9
  this.name = this.constructor.name;
10
+ if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
11
+ this.cause = opts.cause;
12
+ }
10
13
  }
11
14
  }
@@ -14,11 +14,14 @@ export function handleNonStatusCodeError(error, rawResponse, method, path) {
14
14
  rawResponse: rawResponse,
15
15
  });
16
16
  case "timeout":
17
- throw new errors.LatticeTimeoutError(`Timeout exceeded when calling ${method} ${path}.`);
17
+ throw new errors.LatticeTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
18
+ cause: error.cause,
19
+ });
18
20
  case "unknown":
19
21
  throw new errors.LatticeError({
20
22
  message: error.errorMessage,
21
23
  rawResponse: rawResponse,
24
+ cause: error.cause,
22
25
  });
23
26
  default:
24
27
  throw new errors.LatticeError({
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.5.0";
1
+ export declare const SDK_VERSION = "4.6.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.5.0";
1
+ export const SDK_VERSION = "4.6.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anduril-industries/lattice-sdk",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -1013,6 +1013,86 @@ for await (const item of response) {
1013
1013
  </dl>
1014
1014
 
1015
1015
 
1016
+ </dd>
1017
+ </dl>
1018
+ </details>
1019
+
1020
+ <details><summary><code>client.tasks.<a href="/src/api/resources/tasks/client/Client.ts">streamManualControlFrames</a>({ ...params }) -> core.Stream&lt;Lattice.StreamManualControlFramesResponse&gt;</code></summary>
1021
+ <dl>
1022
+ <dd>
1023
+
1024
+ #### 📝 Description
1025
+
1026
+ <dl>
1027
+ <dd>
1028
+
1029
+ <dl>
1030
+ <dd>
1031
+
1032
+ Establishes a server streaming connection that delivers manual control frames to agents
1033
+ using server-sent events (SSE).
1034
+
1035
+ This endpoint streams manual control frames, for example, for joystick movements, for a specific task
1036
+ to the executing agent. The agent should open this stream before reporting `STATUS_EXECUTING`
1037
+ to ensure it is ready to receive control input when the operator begins sending frames.
1038
+
1039
+ Each frame includes epoch and sequence metadata for handling concurrent control sessions
1040
+ and detecting stale or out-of-order frames. Heartbeat messages are sent periodically to
1041
+ maintain the connection.
1042
+
1043
+ The stream terminates automatically when the task reaches a terminal state
1044
+ (`STATUS_DONE_OK` or `STATUS_DONE_NOT_OK`).
1045
+ </dd>
1046
+ </dl>
1047
+ </dd>
1048
+ </dl>
1049
+
1050
+ #### 🔌 Usage
1051
+
1052
+ <dl>
1053
+ <dd>
1054
+
1055
+ <dl>
1056
+ <dd>
1057
+
1058
+ ```typescript
1059
+ const response = await client.tasks.streamManualControlFrames({
1060
+ taskId: "taskId"
1061
+ });
1062
+ for await (const item of response) {
1063
+ console.log(item);
1064
+ }
1065
+
1066
+ ```
1067
+ </dd>
1068
+ </dl>
1069
+ </dd>
1070
+ </dl>
1071
+
1072
+ #### ⚙️ Parameters
1073
+
1074
+ <dl>
1075
+ <dd>
1076
+
1077
+ <dl>
1078
+ <dd>
1079
+
1080
+ **request:** `Lattice.ManualControlStreamRequest`
1081
+
1082
+ </dd>
1083
+ </dl>
1084
+
1085
+ <dl>
1086
+ <dd>
1087
+
1088
+ **requestOptions:** `TasksClient.RequestOptions`
1089
+
1090
+ </dd>
1091
+ </dl>
1092
+ </dd>
1093
+ </dl>
1094
+
1095
+
1016
1096
  </dd>
1017
1097
  </dl>
1018
1098
  </details>