@worldlabsai/client 0.3.0 → 0.4.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 (39) hide show
  1. package/README.md +18 -8
  2. package/dist/core/assets.d.ts +4 -0
  3. package/dist/core/assets.d.ts.map +1 -1
  4. package/dist/core/index.d.ts +1 -0
  5. package/dist/core/index.d.ts.map +1 -1
  6. package/dist/core/index.js +1 -0
  7. package/dist/core/index.js.map +1 -1
  8. package/dist/core/network-error.d.ts +6 -0
  9. package/dist/core/network-error.d.ts.map +1 -0
  10. package/dist/core/network-error.js +8 -0
  11. package/dist/core/network-error.js.map +1 -0
  12. package/dist/core/operations.d.ts +3 -0
  13. package/dist/core/operations.d.ts.map +1 -1
  14. package/dist/core/operations.js +5 -0
  15. package/dist/core/operations.js.map +1 -1
  16. package/dist/core/tasks.d.ts +6 -6
  17. package/dist/core/tasks.d.ts.map +1 -1
  18. package/dist/core/tasks.js +5 -5
  19. package/dist/core/tasks.js.map +1 -1
  20. package/dist/core/transport.d.ts +1 -1
  21. package/dist/core/transport.d.ts.map +1 -1
  22. package/dist/core/transport.js +44 -21
  23. package/dist/core/transport.js.map +1 -1
  24. package/dist/generated/developer-api.gen.d.ts +76 -47
  25. package/dist/generated/developer-api.gen.d.ts.map +1 -1
  26. package/dist/generated/tasks.gen.d.ts +6 -6
  27. package/dist/generated/tasks.gen.d.ts.map +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/package.json +12 -11
  33. package/src/core/index.ts +1 -0
  34. package/src/core/network-error.ts +8 -0
  35. package/src/core/operations.ts +6 -0
  36. package/src/core/tasks.ts +7 -7
  37. package/src/core/transport.ts +61 -24
  38. package/src/generated/developer-api.gen.ts +76 -47
  39. package/src/index.ts +1 -0
@@ -1,3 +1,4 @@
1
+ import { NetworkError } from "./network-error.ts";
1
2
  import { sleep } from "./sleep.ts";
2
3
 
3
4
  /** Handles a `Request` for API calls and signed uploads; standard `fetch` is compatible. */
@@ -8,7 +9,11 @@ export type Fetch = (request: Request) => Promise<Response>;
8
9
  * without calling `next`, call `next` more than once for retries, or inspect the response.
9
10
  * Clone requests before sending them if a retry may need to reuse the body.
10
11
  */
11
- export type Middleware = (request: Request, next: Fetch) => Promise<Response>;
12
+ export type Middleware = (
13
+ request: Request,
14
+ next: Fetch,
15
+ options?: Pick<RequestOptions, "retry">,
16
+ ) => Promise<Response>;
12
17
 
13
18
  /** Values accepted in a request query. `null` and `undefined` are omitted. */
14
19
  export type QueryValue = string | number | boolean | null | undefined;
@@ -40,7 +45,19 @@ export interface TransportOptions {
40
45
  pathParams?: Record<string, string>;
41
46
  }
42
47
 
43
- /** FastAPI puts its reason under `detail`; operation and storage errors use `message`. */
48
+ /** One FastAPI validation issue, `{ loc: ["body", "frames"], msg: "Field required" }`. */
49
+ const validationIssue = (issue: unknown): string => {
50
+ const location: unknown =
51
+ typeof issue === "object" && issue !== null ? Reflect.get(issue, "loc") : undefined;
52
+ const message: unknown =
53
+ typeof issue === "object" && issue !== null ? Reflect.get(issue, "msg") : issue;
54
+ return Array.isArray(location) ? `${location.join(".")}: ${String(message)}` : String(message);
55
+ };
56
+
57
+ /**
58
+ * FastAPI puts its reason under `detail`, as a list of validation issues for a
59
+ * 422; operation and storage errors use `message`.
60
+ */
44
61
  const errorDetail = (body: unknown): string | undefined => {
45
62
  if (typeof body !== "object" || body === null) {
46
63
  return undefined;
@@ -50,6 +67,9 @@ const errorDetail = (body: unknown): string | undefined => {
50
67
  if (typeof value === "string" && value !== "") {
51
68
  return value;
52
69
  }
70
+ if (Array.isArray(value) && value.length > 0) {
71
+ return value.map((issue) => validationIssue(issue)).join("; ");
72
+ }
53
73
  }
54
74
  return undefined;
55
75
  };
@@ -82,11 +102,15 @@ const fillPath = (path: string, params: Record<string, string>): string =>
82
102
  return encodeURIComponent(value);
83
103
  });
84
104
 
85
- const compose = (middleware: Middleware[], fetch: Fetch): Fetch => {
105
+ const compose = (
106
+ middleware: Middleware[],
107
+ fetch: Fetch,
108
+ options?: Pick<RequestOptions, "retry">,
109
+ ): Fetch => {
86
110
  let next = fetch;
87
111
  for (const layer of middleware.toReversed()) {
88
112
  const inner = next;
89
- next = async (request) => await layer(request, inner);
113
+ next = async (request) => await layer(request, inner, options);
90
114
  }
91
115
  return next;
92
116
  };
@@ -105,17 +129,27 @@ const parseBody = async (response: Response): Promise<unknown> => {
105
129
 
106
130
  const RETRYABLE_STATUS_CODES = new Set([429, 502, 503, 504]);
107
131
 
108
- const retryDelay = (error: unknown, attempt: number): number => {
109
- const backoff = 1000 * 2 ** attempt * (0.5 + Math.random() / 2);
132
+ /**
133
+ * Longest `Retry-After` a retry waits out. A concurrency cap, an hourly quota,
134
+ * or a closed task names minutes to hours, which the caller has to surface
135
+ * rather than sit through.
136
+ */
137
+ const MAX_RETRY_AFTER_MS = 10_000;
138
+
139
+ /** The wait a response names in `Retry-After`, as seconds or an HTTP date. */
140
+ const retryAfterMs = (error: unknown): number | undefined => {
110
141
  const value =
111
142
  error instanceof ApiError ? error.response.headers.get("retry-after")?.trim() : undefined;
112
143
  if (!value) {
113
- return backoff;
144
+ return undefined;
114
145
  }
115
146
  const delay = /^\d+$/u.test(value) ? Number(value) * 1000 : Date.parse(value) - Date.now();
116
- return Math.max(backoff, Number.isFinite(delay) ? delay : 0);
147
+ return Number.isFinite(delay) ? Math.max(0, delay) : undefined;
117
148
  };
118
149
 
150
+ const retryDelay = (error: unknown, attempt: number): number =>
151
+ Math.max(1000 * 2 ** attempt * (0.5 + Math.random() / 2), retryAfterMs(error) ?? 0);
152
+
119
153
  export interface Transport {
120
154
  /**
121
155
  * Send a request and parse its response as JSON, falling back to text.
@@ -150,10 +184,8 @@ export const createTransport = (options: TransportOptions): Transport => {
150
184
  return {
151
185
  fetch,
152
186
  send,
153
- request: async <T>(
154
- path: string,
155
- { body, params, query, retry = false, ...init }: RequestOptions = {},
156
- ): Promise<T> => {
187
+ request: async <T>(path: string, requestOptions: RequestOptions = {}): Promise<T> => {
188
+ const { body, params, query, retry = false, ...init } = requestOptions;
157
189
  const url = new URL(baseUrl + fillPath(path, { ...boundParams, ...params }));
158
190
  for (const [key, value] of Object.entries(query ?? {})) {
159
191
  if (value !== undefined && value !== null) {
@@ -172,16 +204,18 @@ export const createTransport = (options: TransportOptions): Transport => {
172
204
 
173
205
  // Provider and middleware TypeErrors must not be mistaken for network failures.
174
206
  let networkError: unknown;
175
- const sendRequest = retry
176
- ? compose(options.middleware ?? [], async (attempt) => {
177
- try {
178
- return await fetch(attempt);
179
- } catch (error) {
180
- networkError = error;
181
- throw error;
182
- }
183
- })
184
- : send;
207
+ const sendRequest = compose(
208
+ options.middleware ?? [],
209
+ async (attempt) => {
210
+ try {
211
+ return await fetch(attempt);
212
+ } catch (error) {
213
+ networkError = error;
214
+ throw error;
215
+ }
216
+ },
217
+ requestOptions,
218
+ );
185
219
 
186
220
  // oxlint-disable no-await-in-loop -- retries are sequential and preserve the original request
187
221
  for (let attempt = 0; ; attempt += 1) {
@@ -206,11 +240,14 @@ export const createTransport = (options: TransportOptions): Transport => {
206
240
  return parsed as T;
207
241
  } catch (error) {
208
242
  request.signal.throwIfAborted();
243
+ const networkFailure = error instanceof TypeError && error === networkError;
209
244
  const transient =
210
245
  error instanceof ApiError
211
- ? RETRYABLE_STATUS_CODES.has(error.response.status)
212
- : error instanceof TypeError && error === networkError;
246
+ ? RETRYABLE_STATUS_CODES.has(error.response.status) &&
247
+ (retryAfterMs(error) ?? 0) <= MAX_RETRY_AFTER_MS
248
+ : networkFailure;
213
249
  if (!retry || attempt >= 3 || !transient) {
250
+ if (networkFailure) throw new NetworkError(error);
214
251
  throw error;
215
252
  }
216
253
  await sleep(retryDelay(error, attempt), request.signal);
@@ -430,6 +430,11 @@ export interface components {
430
430
  * @description Already percent-encoded path for the asset. Append it unchanged to ``baseUrl`` before ``?`` and ``signedQuery``. This path does not grant access by itself. Null until the asset is ``READY`` or when unavailable; use ``assets/{asset}:createReadUrl`` as a fallback.
431
431
  */
432
432
  contentPath?: string | null;
433
+ /**
434
+ * Url
435
+ * @description Unsigned content URL for the asset, ``baseUrl + contentPath``. It does not grant access by itself: the web app's read-prefix cookie authorizes it, and an API client appends ``?`` and a read prefix's ``signedQuery`` or uses ``assets/{asset}:createReadUrl`` instead. Null whenever ``contentPath`` is.
436
+ */
437
+ url?: string | null;
433
438
  };
434
439
  /**
435
440
  * AssetCreate
@@ -486,7 +491,7 @@ export interface components {
486
491
  operation: string;
487
492
  /**
488
493
  * Task
489
- * @description The task that produced them, e.g. ``image2DraftSplats``.
494
+ * @description The task that produced them, e.g. ``atlasGenerate``.
490
495
  */
491
496
  task?: string | null;
492
497
  /** Assets */
@@ -636,9 +641,14 @@ export interface components {
636
641
  purgeContentOnOperationCompletion?: boolean | null;
637
642
  /**
638
643
  * Contextframes
639
- * @description Posed depth frames, one per target camera and posed at it, in target order; each camera is 1280x720. Depth only: frames carry no imageAsset, maskAsset, or depth confidenceAsset. Leave empty to generate from the prompt alone.
644
+ * @description Posed depth frames, one per target camera and posed at it, in target order; each camera is 1280x720. Frames may also carry an imageAsset (the view's known pixels) and a maskAsset (8-bit grayscale, white where the frame's image and depth are known), each on every frame or on none: the model keeps the image where the mask is set and generates the rest, takes frames without masks as fully known, and conditions on the depth alone for frames without an image. Frames carry no depth confidenceAsset. Leave empty to generate from the prompt alone.
640
645
  */
641
646
  contextFrames?: components["schemas"]["PosedDepthAsset"][];
647
+ /**
648
+ * Sourceframes
649
+ * @description Posed RGB photographs of the scene, each an image and its camera in the targets' coordinate convention and scale. The generated views stay consistent with them: the servable feeds them to the model as views it has already committed, so a target that sees the same surfaces keeps their materials, colors, and lighting. Any cameras and any resolution; each is cover-resized and center-cropped onto 1280x720. Frames carry no maskAsset or depth. Together with contextFrames and targetCameras they fill at most 128 views of the servable's rollout, where a context frame costs 3 and a photograph or target one.
650
+ */
651
+ sourceFrames?: components["schemas"]["PosedRGBAsset"][];
642
652
  /**
643
653
  * Targetcameras
644
654
  * @description Pinhole cameras at 1280x720 for the views to generate, in output order, returned in `frames`. At most 32.
@@ -669,7 +679,7 @@ export interface components {
669
679
  modelParameters?: components["schemas"]["AtlasChiselModelParameters"];
670
680
  /**
671
681
  * Returndepth
672
- * @description Return the generated frames as posed RGBD: they are reconstructed together so the depth lands in the request's own camera frame and scale, and every entry in `frames` then carries a `depth` buffer. The contextFrames' own depth is not reconstructed or returned. Needs at least two target cameras. Limitation: the depth scale is recovered from the target cameras' centres, so targets that share one centre (a pure-rotation rig) come back with a 0.0 or NaN scale and a success status.
682
+ * @description Return the generated frames as posed RGBD: they are reconstructed together so the depth lands in the request's own camera frame and scale, and every entry in `frames` then carries a `depth` buffer. The contextFrames' own depth is not reconstructed or returned. A source photograph joins the reconstruction as an anchor, and gets no depth back, only when its image is at the generated resolution and its camera's principal point is centered. Needs at least two target cameras. Limitation: the depth scale is recovered from the camera centers that joined, so targets that share one center (a pure-rotation rig) and no anchor come back with a 0.0 or NaN scale and a success status.
673
683
  * @default false
674
684
  */
675
685
  returnDepth?: boolean;
@@ -719,13 +729,11 @@ export interface components {
719
729
  } | null;
720
730
  /**
721
731
  * Done
722
- * @description Whether the operation is terminal. When false, both ``response`` and ``error`` are null.
732
+ * @description Whether the operation is terminal. When true, a non-null ``error`` indicates failure; otherwise the operation succeeded.
723
733
  */
724
734
  done: boolean;
725
735
  /** @description Failure details when ``done`` is true and the task failed; null while running and after success. */
726
736
  error?: components["schemas"]["OperationError"] | null;
727
- /** @description ``AtlasChiselResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
728
- response?: components["schemas"]["AtlasChiselResponse"] | null;
729
737
  /**
730
738
  * Expiresatsecs
731
739
  * @description Task execution deadline as Unix seconds, when one is exposed. This is not an asset URL expiration.
@@ -736,6 +744,8 @@ export interface components {
736
744
  * @description Unix seconds when the operation was accepted.
737
745
  */
738
746
  createdAtSecs?: number | null;
747
+ /** @description ``AtlasChiselResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
748
+ response?: components["schemas"]["AtlasChiselResponse"] | null;
739
749
  /**
740
750
  * Name
741
751
  * @description Full resource name for the operation.
@@ -778,9 +788,15 @@ export interface components {
778
788
  * @description Purge this operation's outputs and the transient uploads it consumed one hour after it finishes. Omitted, the account's setting applies; true raises it for this operation; false is refused when the account already purges. Uploads in the library are never purged by an operation.
779
789
  */
780
790
  purgeContentOnOperationCompletion?: boolean | null;
791
+ /**
792
+ * Base64Outputs
793
+ * @description When a ?wait=true submission is answered inline, return each output file as base64 in that response rather than by assetId and url. This skips storing the files before the answer and the caller's download after it. Any other submission, and every later read of the operation, names the outputs by assetId and url.
794
+ * @default false
795
+ */
796
+ base64Outputs?: boolean;
781
797
  /**
782
798
  * Contextframes
783
- * @description Posed RGBD context views: each an image, its depth buffer, and its camera, all required. On the reference-context warp route the depth conditions the generation geometrically, so the generated views stay consistent with the provided scene; the hero base checkpoint conditions on the posed images only and does not consume the depth.
799
+ * @description Posed RGBD context views: each an image, its depth buffer, and its camera, all required. All context cameras must declare the same width and height. On the reference-context warp route the depth conditions the generation geometrically, so the generated views stay consistent with the provided scene; the hero base checkpoint conditions on the posed images only and does not consume the depth.
784
800
  */
785
801
  contextFrames: components["schemas"]["PosedRGBDAsset"][];
786
802
  /**
@@ -801,7 +817,7 @@ export interface components {
801
817
  enhancePrompt?: boolean;
802
818
  /**
803
819
  * Returndepth
804
- * @description Return the generated frames as posed RGBD: they are reconstructed together with the context frames so the depth lands in the request's own camera frame and scale, and every entry in `frames` then carries a `depth` buffer. A context frame joins that reconstruction only when its image is at the generated resolution and its camera's principal point is centered. The scale is recovered from the camera centres that joined, so a request whose joined cameras all share one centre (a pure-rotation rig) is rejected.
820
+ * @description Return the generated frames as posed RGBD: they are reconstructed together with the context frames so the depth lands in the request's own camera frame and scale, and every entry in `frames` then carries a `depth` buffer. The scale is recovered from camera centres, so a request whose cameras all share one centre (a pure-rotation rig) is rejected. On the hero base route, with more than 19 context frames, or with a masked context frame, a context frame joins the reconstruction only when its image is at the generated resolution and its camera's principal point is centered.
805
821
  * @default false
806
822
  */
807
823
  returnDepth?: boolean;
@@ -853,13 +869,11 @@ export interface components {
853
869
  } | null;
854
870
  /**
855
871
  * Done
856
- * @description Whether the operation is terminal. When false, both ``response`` and ``error`` are null.
872
+ * @description Whether the operation is terminal. When true, a non-null ``error`` indicates failure; otherwise the operation succeeded.
857
873
  */
858
874
  done: boolean;
859
875
  /** @description Failure details when ``done`` is true and the task failed; null while running and after success. */
860
876
  error?: components["schemas"]["OperationError"] | null;
861
- /** @description ``AtlasGenerateResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
862
- response?: components["schemas"]["AtlasGenerateResponse"] | null;
863
877
  /**
864
878
  * Expiresatsecs
865
879
  * @description Task execution deadline as Unix seconds, when one is exposed. This is not an asset URL expiration.
@@ -870,6 +884,8 @@ export interface components {
870
884
  * @description Unix seconds when the operation was accepted.
871
885
  */
872
886
  createdAtSecs?: number | null;
887
+ /** @description ``AtlasGenerateResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
888
+ response?: components["schemas"]["AtlasGenerateResponse"] | null;
873
889
  /**
874
890
  * Name
875
891
  * @description Full resource name for the operation.
@@ -988,13 +1004,11 @@ export interface components {
988
1004
  } | null;
989
1005
  /**
990
1006
  * Done
991
- * @description Whether the operation is terminal. When false, both ``response`` and ``error`` are null.
1007
+ * @description Whether the operation is terminal. When true, a non-null ``error`` indicates failure; otherwise the operation succeeded.
992
1008
  */
993
1009
  done: boolean;
994
1010
  /** @description Failure details when ``done`` is true and the task failed; null while running and after success. */
995
1011
  error?: components["schemas"]["OperationError"] | null;
996
- /** @description ``AtlasMaskedResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
997
- response?: components["schemas"]["AtlasMaskedResponse"] | null;
998
1012
  /**
999
1013
  * Expiresatsecs
1000
1014
  * @description Task execution deadline as Unix seconds, when one is exposed. This is not an asset URL expiration.
@@ -1005,6 +1019,8 @@ export interface components {
1005
1019
  * @description Unix seconds when the operation was accepted.
1006
1020
  */
1007
1021
  createdAtSecs?: number | null;
1022
+ /** @description ``AtlasMaskedResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
1023
+ response?: components["schemas"]["AtlasMaskedResponse"] | null;
1008
1024
  /**
1009
1025
  * Name
1010
1026
  * @description Full resource name for the operation.
@@ -1113,13 +1129,11 @@ export interface components {
1113
1129
  } | null;
1114
1130
  /**
1115
1131
  * Done
1116
- * @description Whether the operation is terminal. When false, both ``response`` and ``error`` are null.
1132
+ * @description Whether the operation is terminal. When true, a non-null ``error`` indicates failure; otherwise the operation succeeded.
1117
1133
  */
1118
1134
  done: boolean;
1119
1135
  /** @description Failure details when ``done`` is true and the task failed; null while running and after success. */
1120
1136
  error?: components["schemas"]["OperationError"] | null;
1121
- /** @description ``AtlasTextToImageResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
1122
- response?: components["schemas"]["AtlasTextToImageResponse"] | null;
1123
1137
  /**
1124
1138
  * Expiresatsecs
1125
1139
  * @description Task execution deadline as Unix seconds, when one is exposed. This is not an asset URL expiration.
@@ -1130,6 +1144,8 @@ export interface components {
1130
1144
  * @description Unix seconds when the operation was accepted.
1131
1145
  */
1132
1146
  createdAtSecs?: number | null;
1147
+ /** @description ``AtlasTextToImageResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
1148
+ response?: components["schemas"]["AtlasTextToImageResponse"] | null;
1133
1149
  /**
1134
1150
  * Name
1135
1151
  * @description Full resource name for the operation.
@@ -1355,6 +1371,11 @@ export interface components {
1355
1371
  * @description Already percent-encoded path for the asset. Append it unchanged to ``baseUrl`` before ``?`` and ``signedQuery``. This path does not grant access by itself. Null until the asset is ``READY`` or when unavailable; use ``assets/{asset}:createReadUrl`` as a fallback.
1356
1372
  */
1357
1373
  contentPath?: string | null;
1374
+ /**
1375
+ * Url
1376
+ * @description Unsigned content URL for the asset, ``baseUrl + contentPath``. It does not grant access by itself: the web app's read-prefix cookie authorizes it, and an API client appends ``?`` and a read prefix's ``signedQuery`` or uses ``assets/{asset}:createReadUrl`` instead. Null whenever ``contentPath`` is.
1377
+ */
1378
+ url?: string | null;
1358
1379
  /**
1359
1380
  * Uploads
1360
1381
  * @description One grant per declared part; empty for URL or inline ingestion.
@@ -1542,6 +1563,12 @@ export interface components {
1542
1563
  * @description Purge this operation's outputs and the transient uploads it consumed one hour after it finishes. Omitted, the account's setting applies; true raises it for this operation; false is refused when the account already purges. Uploads in the library are never purged by an operation.
1543
1564
  */
1544
1565
  purgeContentOnOperationCompletion?: boolean | null;
1566
+ /**
1567
+ * Base64Outputs
1568
+ * @description When a ?wait=true submission is answered inline, return each output file as base64 in that response rather than by assetId and url. This skips storing the files before the answer and the caller's download after it. Any other submission, and every later read of the operation, names the outputs by assetId and url.
1569
+ * @default false
1570
+ */
1571
+ base64Outputs?: boolean;
1545
1572
  /**
1546
1573
  * Frames
1547
1574
  * @description Ordered image inputs (min 1). A frame that carries a camera, a depth buffer or a mask is rejected rather than quietly ignored: none of them reaches the reconstruction.
@@ -1612,13 +1639,11 @@ export interface components {
1612
1639
  } | null;
1613
1640
  /**
1614
1641
  * Done
1615
- * @description Whether the operation is terminal. When false, both ``response`` and ``error`` are null.
1642
+ * @description Whether the operation is terminal. When true, a non-null ``error`` indicates failure; otherwise the operation succeeded.
1616
1643
  */
1617
1644
  done: boolean;
1618
1645
  /** @description Failure details when ``done`` is true and the task failed; null while running and after success. */
1619
1646
  error?: components["schemas"]["OperationError"] | null;
1620
- /** @description ``Images2PosedRGBDResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
1621
- response?: components["schemas"]["Images2PosedRGBDResponse"] | null;
1622
1647
  /**
1623
1648
  * Expiresatsecs
1624
1649
  * @description Task execution deadline as Unix seconds, when one is exposed. This is not an asset URL expiration.
@@ -1629,6 +1654,8 @@ export interface components {
1629
1654
  * @description Unix seconds when the operation was accepted.
1630
1655
  */
1631
1656
  createdAtSecs?: number | null;
1657
+ /** @description ``Images2PosedRGBDResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
1658
+ response?: components["schemas"]["Images2PosedRGBDResponse"] | null;
1632
1659
  /**
1633
1660
  * Name
1634
1661
  * @description Full resource name for the operation.
@@ -1678,7 +1705,7 @@ export interface components {
1678
1705
  };
1679
1706
  /**
1680
1707
  * ListedOperation
1681
- * @description An Operation as the Marble API lists it: with its callback's progress.
1708
+ * @description An operation summary with callback progress; GET it for the result.
1682
1709
  */
1683
1710
  ListedOperation: {
1684
1711
  /**
@@ -1700,18 +1727,11 @@ export interface components {
1700
1727
  } | null;
1701
1728
  /**
1702
1729
  * Done
1703
- * @description Whether the operation is terminal. When false, both ``response`` and ``error`` are null.
1730
+ * @description Whether the operation is terminal. When true, a non-null ``error`` indicates failure; otherwise the operation succeeded.
1704
1731
  */
1705
1732
  done: boolean;
1706
1733
  /** @description Failure details when ``done`` is true and the task failed; null while running and after success. */
1707
1734
  error?: components["schemas"]["OperationError"] | null;
1708
- /**
1709
- * Response
1710
- * @description Task-specific result when ``done`` is true and the task succeeded; null while running and after failure.
1711
- */
1712
- response?: {
1713
- [key: string]: unknown;
1714
- } | null;
1715
1735
  /**
1716
1736
  * Expiresatsecs
1717
1737
  * @description Task execution deadline as Unix seconds, when one is exposed. This is not an asset URL expiration.
@@ -1772,7 +1792,7 @@ export interface components {
1772
1792
  };
1773
1793
  /**
1774
1794
  * Operation
1775
- * @description The common envelope used to track an asynchronous task.
1795
+ * @description An operation with its result, available through singular reads.
1776
1796
  */
1777
1797
  Operation: {
1778
1798
  /**
@@ -1794,18 +1814,11 @@ export interface components {
1794
1814
  } | null;
1795
1815
  /**
1796
1816
  * Done
1797
- * @description Whether the operation is terminal. When false, both ``response`` and ``error`` are null.
1817
+ * @description Whether the operation is terminal. When true, a non-null ``error`` indicates failure; otherwise the operation succeeded.
1798
1818
  */
1799
1819
  done: boolean;
1800
1820
  /** @description Failure details when ``done`` is true and the task failed; null while running and after success. */
1801
1821
  error?: components["schemas"]["OperationError"] | null;
1802
- /**
1803
- * Response
1804
- * @description Task-specific result when ``done`` is true and the task succeeded; null while running and after failure.
1805
- */
1806
- response?: {
1807
- [key: string]: unknown;
1808
- } | null;
1809
1822
  /**
1810
1823
  * Expiresatsecs
1811
1824
  * @description Task execution deadline as Unix seconds, when one is exposed. This is not an asset URL expiration.
@@ -1816,6 +1829,13 @@ export interface components {
1816
1829
  * @description Unix seconds when the operation was accepted.
1817
1830
  */
1818
1831
  createdAtSecs?: number | null;
1832
+ /**
1833
+ * Response
1834
+ * @description Task-specific result when ``done`` is true and the task succeeded; null while running and after failure.
1835
+ */
1836
+ response?: {
1837
+ [key: string]: unknown;
1838
+ } | null;
1819
1839
  /**
1820
1840
  * Name
1821
1841
  * @description Full resource name for the operation.
@@ -2015,7 +2035,7 @@ export interface components {
2015
2035
  session?: string | null;
2016
2036
  /**
2017
2037
  * Task
2018
- * @description The task that produced it, e.g. ``image2DraftSplats``.
2038
+ * @description The task that produced it, e.g. ``atlasGenerate``.
2019
2039
  */
2020
2040
  task?: string | null;
2021
2041
  /**
@@ -2043,8 +2063,8 @@ export interface components {
2043
2063
  renderHw?: number;
2044
2064
  /**
2045
2065
  * Renderhwsecondary
2046
- * @description Height and width of the secondary views, in pixels. The anchor strategies sample extra cameras around each anchor and render them here, covering what the main views miss. `exterior_sphere` and a supplied camera list render no secondary views and ignore this.
2047
- * @default 640
2066
+ * @description Height and width of the secondary views, in pixels. The anchor strategies place extra cameras from the anchors and render them here, covering what the main views miss. `exterior_sphere` and a supplied camera list render no secondary views and ignore this.
2067
+ * @default 256
2048
2068
  */
2049
2069
  renderHwSecondary?: number;
2050
2070
  /**
@@ -2054,6 +2074,13 @@ export interface components {
2054
2074
  * @enum {string}
2055
2075
  */
2056
2076
  normalSource?: "depth" | "render";
2077
+ /**
2078
+ * Depthsource
2079
+ * @description Depth of the main views. `render` uses the splats' rendered depth; `stereo` measures it by stereo matching each view against a second render from a camera shifted sideways, which is sharper where the splats are fuzzy and slower to compute. Pixels stereo cannot match keep the rendered depth.
2080
+ * @default render
2081
+ * @enum {string}
2082
+ */
2083
+ depthSource?: "render" | "stereo";
2057
2084
  /**
2058
2085
  * Resolution
2059
2086
  * @description Resolution of the grid the implicit surface is built on, across the region's longest side. Powers of two only. This sets the finest detail the mesh can carry.
@@ -2195,13 +2222,11 @@ export interface components {
2195
2222
  } | null;
2196
2223
  /**
2197
2224
  * Done
2198
- * @description Whether the operation is terminal. When false, both ``response`` and ``error`` are null.
2225
+ * @description Whether the operation is terminal. When true, a non-null ``error`` indicates failure; otherwise the operation succeeded.
2199
2226
  */
2200
2227
  done: boolean;
2201
2228
  /** @description Failure details when ``done`` is true and the task failed; null while running and after success. */
2202
2229
  error?: components["schemas"]["OperationError"] | null;
2203
- /** @description ``Splats2MeshResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
2204
- response?: components["schemas"]["Splats2MeshResponse"] | null;
2205
2230
  /**
2206
2231
  * Expiresatsecs
2207
2232
  * @description Task execution deadline as Unix seconds, when one is exposed. This is not an asset URL expiration.
@@ -2212,6 +2237,8 @@ export interface components {
2212
2237
  * @description Unix seconds when the operation was accepted.
2213
2238
  */
2214
2239
  createdAtSecs?: number | null;
2240
+ /** @description ``Splats2MeshResponse`` result when ``done`` is true and the task succeeded; null while running and after failure. */
2241
+ response?: components["schemas"]["Splats2MeshResponse"] | null;
2215
2242
  /**
2216
2243
  * Name
2217
2244
  * @description Full resource name for the operation.
@@ -2229,7 +2256,9 @@ export interface components {
2229
2256
  * A task response names each output by id and url together: the url expires,
2230
2257
  * the id does not. The pair is accepted as input as well, so a response can
2231
2258
  * be handed straight back to the next task; the id names the media and the
2232
- * url is ignored. Inline base64 is an input form only, and stands alone.
2259
+ * url is ignored. Inline base64 stands alone. A response returns it only
2260
+ * when a task is answered at submission; the stored operation names the
2261
+ * same output by id and url.
2233
2262
  */
2234
2263
  TaskAsset: {
2235
2264
  /**
@@ -2239,7 +2268,7 @@ export interface components {
2239
2268
  assetId?: string | null;
2240
2269
  /**
2241
2270
  * Base64
2242
- * @description Base64-encoded media bytes, with or without a data URL prefix. Decoded size must be less than 10 MiB. Input only: a task response never carries inline bytes.
2271
+ * @description Base64-encoded media bytes, with or without a data URL prefix. Decoded size must be less than 10 MiB. A task response carries inline bytes only when it is returned from the submission; the stored operation names the same output by `assetId` and `url`.
2243
2272
  */
2244
2273
  base64?: string | null;
2245
2274
  /**
@@ -2974,7 +3003,7 @@ export interface operations {
2974
3003
  mimeType?: string | null;
2975
3004
  /** @description Only assets this Operation produced. */
2976
3005
  operation?: string | null;
2977
- /** @description Only assets this task produced, e.g. `image2DraftSplats`. */
3006
+ /** @description Only assets this task produced, e.g. `atlasGenerate`. */
2978
3007
  task?: string | null;
2979
3008
  /** @description Only assets made this way, e.g. `UPLOAD` for the customer's own bytes. Assets recorded before the producer was stored match no value. */
2980
3009
  producer?: components["schemas"]["AssetProducer"] | null;
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export {
13
13
  type DoneOperation,
14
14
  type Fetch,
15
15
  type Middleware,
16
+ NetworkError,
16
17
  type Operation,
17
18
  type ListAssetsOptions,
18
19
  type SubmitOptions,