@worldlabsai/cli 0.2.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.
- package/README.md +1 -1
- package/dist/index.js +32 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ If the CLI cannot confirm that the installer has stopped, it retains the backup
|
|
|
90
90
|
without restoring it. Stop any remaining installer processes before restoring
|
|
91
91
|
that backup manually.
|
|
92
92
|
|
|
93
|
-
The public skill points to [How To Use Atlas](https://
|
|
93
|
+
The public skill points to [How To Use Atlas](https://docs.atlas-beta.worldlabs.ai/how-to-use-atlas) for maintained guidance on model inputs, cameras, and task combinations.
|
|
94
94
|
|
|
95
95
|
## Configuration
|
|
96
96
|
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { readFileSync } from "node:fs";
|
|
5
4
|
import { parseArgs as parseArgs2 } from "node:util";
|
|
6
5
|
|
|
7
6
|
// ../client/dist/core/network-error.js
|
|
@@ -418,6 +417,18 @@ var createTasks = (transport) => ({
|
|
|
418
417
|
* @beta Requires beta access for your account.
|
|
419
418
|
*/
|
|
420
419
|
images2PosedRGBD: async (body, options) => await submitTask(transport, "/api/v2/tasks:images2PosedRGBD", body, options),
|
|
420
|
+
/**
|
|
421
|
+
* Submit the posedImages2Splats task
|
|
422
|
+
* Retries network failures and HTTP 429/502/503/504 up to three times with the same key and body.
|
|
423
|
+
*
|
|
424
|
+
* @param body - Task inputs and settings.
|
|
425
|
+
* @param options - Abort signal, idempotency key, and server-wait preference.
|
|
426
|
+
* @returns An operation to pass to `client.operations.wait` for the typed result.
|
|
427
|
+
* Check the completed operation's `error` before reading its `response`.
|
|
428
|
+
* @throws {ApiError} If the API rejects the submission or retries are exhausted.
|
|
429
|
+
* @beta Requires beta access for your account.
|
|
430
|
+
*/
|
|
431
|
+
posedImages2Splats: async (body, options) => await submitTask(transport, "/api/v2/tasks:posedImages2Splats", body, options),
|
|
421
432
|
/**
|
|
422
433
|
* Submit the splats2Mesh task
|
|
423
434
|
* Retries network failures and HTTP 429/502/503/504 up to three times with the same key and body.
|
|
@@ -432,8 +443,18 @@ var createTasks = (transport) => ({
|
|
|
432
443
|
splats2Mesh: async (body, options) => await submitTask(transport, "/api/v2/tasks:splats2Mesh", body, options)
|
|
433
444
|
});
|
|
434
445
|
|
|
446
|
+
// ../client/dist/version.js
|
|
447
|
+
var VERSION = "0.0.0";
|
|
448
|
+
|
|
435
449
|
// ../client/dist/client.js
|
|
436
450
|
var DEFAULT_BASE_URL = "https://api.atlas-beta.worldlabs.ai";
|
|
451
|
+
var userAgentMiddleware = (callerTokens) => {
|
|
452
|
+
const node = globalThis.process?.versions?.node;
|
|
453
|
+
if (node === void 0)
|
|
454
|
+
return [];
|
|
455
|
+
const value = [callerTokens, `worldlabsai-client/${VERSION}`, `node/${node}`].filter(Boolean).join(" ");
|
|
456
|
+
return [async (request, next) => await next(withHeader(request, "User-Agent", value))];
|
|
457
|
+
};
|
|
437
458
|
var createClient = (options) => {
|
|
438
459
|
const middleware = [
|
|
439
460
|
...options.apiKey === void 0 ? [] : [apiKeyAuth(options.apiKey)],
|
|
@@ -445,7 +466,7 @@ var createClient = (options) => {
|
|
|
445
466
|
const transport = createTransport({
|
|
446
467
|
baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
|
|
447
468
|
...options.fetch ? { fetch: options.fetch } : {},
|
|
448
|
-
middleware
|
|
469
|
+
middleware: [...userAgentMiddleware(options.userAgent), ...middleware]
|
|
449
470
|
});
|
|
450
471
|
return {
|
|
451
472
|
assets: createAssets(transport, assetsPath),
|
|
@@ -588,7 +609,14 @@ async function openBrowser(url) {
|
|
|
588
609
|
});
|
|
589
610
|
}
|
|
590
611
|
|
|
612
|
+
// src/version.ts
|
|
613
|
+
import { readFileSync } from "node:fs";
|
|
614
|
+
var { version } = JSON.parse(
|
|
615
|
+
readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
|
616
|
+
);
|
|
617
|
+
|
|
591
618
|
// src/auth.ts
|
|
619
|
+
var userAgent = `worldlabsai-cli/${version}`;
|
|
592
620
|
async function authenticatedClient() {
|
|
593
621
|
const { apiOrigin } = configuration();
|
|
594
622
|
let apiKey = process.env.WLT_API_KEY?.trim();
|
|
@@ -596,7 +624,7 @@ async function authenticatedClient() {
|
|
|
596
624
|
apiKey = await readApiKey(apiOrigin);
|
|
597
625
|
}
|
|
598
626
|
if (!apiKey) throw new CliError("Run worldlabs auth login or set WLT_API_KEY.");
|
|
599
|
-
return createClient({ apiKey, baseUrl: apiOrigin });
|
|
627
|
+
return createClient({ apiKey, baseUrl: apiOrigin, userAgent });
|
|
600
628
|
}
|
|
601
629
|
async function authStatus() {
|
|
602
630
|
const client = await authenticatedClient();
|
|
@@ -643,7 +671,7 @@ The key will be saved in plaintext at ${credentialPath(apiOrigin)}.
|
|
|
643
671
|
}
|
|
644
672
|
async function saveValidatedKey(apiKey) {
|
|
645
673
|
const { apiOrigin } = configuration();
|
|
646
|
-
await createClient({ apiKey, baseUrl: apiOrigin }).assets.list({
|
|
674
|
+
await createClient({ apiKey, baseUrl: apiOrigin, userAgent }).assets.list({
|
|
647
675
|
pageSize: 1,
|
|
648
676
|
signal: AbortSignal.timeout(3e4)
|
|
649
677
|
});
|
|
@@ -1072,9 +1100,6 @@ async function setup(client, noBrowser, yes = false, keyFromStdin = false) {
|
|
|
1072
1100
|
}
|
|
1073
1101
|
|
|
1074
1102
|
// src/index.ts
|
|
1075
|
-
var { version } = JSON.parse(
|
|
1076
|
-
readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
|
1077
|
-
);
|
|
1078
1103
|
var help = `worldlabs - World Labs Developer API CLI
|
|
1079
1104
|
|
|
1080
1105
|
Usage: worldlabs [--json] <command>
|