tori.host 0.1.0 → 0.1.1
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/cli.js +20 -6
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -14532,7 +14532,7 @@ var AppSchema = external_exports.object({
|
|
|
14532
14532
|
slug: external_exports.string(),
|
|
14533
14533
|
name: external_exports.string(),
|
|
14534
14534
|
region: RegionSchema,
|
|
14535
|
-
/** Ops zone the app is scheduled into, e.g. '
|
|
14535
|
+
/** Ops zone the app is scheduled into, e.g. 'cz-prg-1'. */
|
|
14536
14536
|
zone: external_exports.string(),
|
|
14537
14537
|
status: AppStatusSchema,
|
|
14538
14538
|
framework: FrameworkSchema,
|
|
@@ -14646,14 +14646,18 @@ var CliTokenSchema = external_exports.object({
|
|
|
14646
14646
|
/** The row as it now appears in the console's token list. */
|
|
14647
14647
|
apiToken: ApiTokenSchema
|
|
14648
14648
|
});
|
|
14649
|
+
var CLI_AUTH_PENDING = "authorization_pending";
|
|
14650
|
+
var CLI_AUTH_SLOW_DOWN = "slow_down";
|
|
14649
14651
|
|
|
14650
14652
|
// ../api/src/client.ts
|
|
14651
14653
|
var ApiError = class extends Error {
|
|
14652
|
-
constructor(status, message) {
|
|
14654
|
+
constructor(status, message, code) {
|
|
14653
14655
|
super(message);
|
|
14654
14656
|
this.status = status;
|
|
14657
|
+
this.code = code;
|
|
14655
14658
|
}
|
|
14656
14659
|
status;
|
|
14660
|
+
code;
|
|
14657
14661
|
};
|
|
14658
14662
|
function createApiCall({ baseUrl = "", getToken, onUnauthorized }) {
|
|
14659
14663
|
return async function call(schema, path, init) {
|
|
@@ -14672,7 +14676,12 @@ function createApiCall({ baseUrl = "", getToken, onUnauthorized }) {
|
|
|
14672
14676
|
}
|
|
14673
14677
|
if (!res.ok) {
|
|
14674
14678
|
const detail = await res.json().catch(() => null);
|
|
14675
|
-
|
|
14679
|
+
const payload = detail;
|
|
14680
|
+
throw new ApiError(
|
|
14681
|
+
res.status,
|
|
14682
|
+
typeof payload?.error === "string" ? payload.error : res.statusText,
|
|
14683
|
+
typeof payload?.code === "string" ? payload.code : void 0
|
|
14684
|
+
);
|
|
14676
14685
|
}
|
|
14677
14686
|
return schema.parse(await res.json());
|
|
14678
14687
|
};
|
|
@@ -14761,7 +14770,7 @@ var EnrollableNodeRoleSchema = external_exports.literal("worker");
|
|
|
14761
14770
|
var NodeSandboxSchema = external_exports.enum(["gvisor", "none"]);
|
|
14762
14771
|
var ZoneSchema = external_exports.object({
|
|
14763
14772
|
id: external_exports.string(),
|
|
14764
|
-
/** Ops zone name, e.g. '
|
|
14773
|
+
/** Ops zone name, e.g. 'cz-prg-1' — what apps reference as `zone`. */
|
|
14765
14774
|
name: external_exports.string(),
|
|
14766
14775
|
region: RegionSchema,
|
|
14767
14776
|
provider: external_exports.string(),
|
|
@@ -15210,7 +15219,7 @@ async function deviceSignIn(apiUrl, timeoutMs, reason) {
|
|
|
15210
15219
|
info(`\u2192 no browser here (${reason}) \u2014 sign in from any other device`);
|
|
15211
15220
|
info(` Open: ${device.verificationUri}`);
|
|
15212
15221
|
info(` Code: ${device.userCode}`);
|
|
15213
|
-
|
|
15222
|
+
let intervalMs = Math.max(1, device.interval || DEFAULT_POLL_INTERVAL_S) * 1e3;
|
|
15214
15223
|
const stopAt = Date.now() + Math.min(timeoutMs, Math.max(1, device.expiresIn) * 1e3);
|
|
15215
15224
|
const spin = spinner("waiting for approval\u2026");
|
|
15216
15225
|
try {
|
|
@@ -15218,7 +15227,12 @@ async function deviceSignIn(apiUrl, timeoutMs, reason) {
|
|
|
15218
15227
|
try {
|
|
15219
15228
|
return await exchange(apiUrl, device.deviceCode, verifier);
|
|
15220
15229
|
} catch (cause) {
|
|
15221
|
-
if (!(cause instanceof ApiError)
|
|
15230
|
+
if (!(cause instanceof ApiError)) throw cause;
|
|
15231
|
+
if (cause.message === CLI_AUTH_SLOW_DOWN) {
|
|
15232
|
+
intervalMs += DEFAULT_POLL_INTERVAL_S * 1e3;
|
|
15233
|
+
} else if (cause.message !== CLI_AUTH_PENDING) {
|
|
15234
|
+
throw cause;
|
|
15235
|
+
}
|
|
15222
15236
|
}
|
|
15223
15237
|
if (Date.now() >= stopAt) {
|
|
15224
15238
|
throw new CliError(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tori.host",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Deploy AI-generated apps to tori.host: npx tori.host",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"tsx": "^4.19.2",
|
|
48
48
|
"vitest": "^3.0.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "539c6d9d5b5e4144e5171932c13309571337cc47",
|
|
51
51
|
"tori": {
|
|
52
|
-
"commit": "
|
|
52
|
+
"commit": "539c6d9d5b5e4144e5171932c13309571337cc47"
|
|
53
53
|
}
|
|
54
54
|
}
|