@genex-ai/cli-demo 1.36.9-dev.958 → 1.36.10-dev.959
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/index.js +142 -100
- package/dist/sentry-reporter-FCSQOR4U.js +5442 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
} from "./chunk-K4EHXOZK.js";
|
|
82
82
|
|
|
83
83
|
// src/instrument.ts
|
|
84
|
-
import
|
|
84
|
+
import { setTimeout as sleep } from "timers/promises";
|
|
85
85
|
|
|
86
86
|
// src/lib/sentry-scrub.ts
|
|
87
87
|
import os from "os";
|
|
@@ -192,6 +192,9 @@ function groupCliEvent(event, hint = {}) {
|
|
|
192
192
|
|
|
193
193
|
// src/instrument.ts
|
|
194
194
|
var GENEX_CLI_DSN = "https://43efc6f7d16c3e67cad6c60fa8175c20@o4511115493900288.ingest.us.sentry.io/4511706579599360";
|
|
195
|
+
var FLUSH_TIMEOUT_MS = 2e3;
|
|
196
|
+
var IGNORED_REJECTION_NAMES = /* @__PURE__ */ new Set(["AbortError", "AI_NoOutputGeneratedError"]);
|
|
197
|
+
var REJECTION_WARNING = "This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";
|
|
195
198
|
function bakedDsn() {
|
|
196
199
|
return import.meta.url.includes("/dist/") ? GENEX_CLI_DSN : "";
|
|
197
200
|
}
|
|
@@ -209,40 +212,79 @@ function telemetryDisabled() {
|
|
|
209
212
|
}
|
|
210
213
|
var dsn = resolveDsn();
|
|
211
214
|
var sentryEnabled = !!dsn && !telemetryDisabled();
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
215
|
+
var tags = {};
|
|
216
|
+
var contexts = {};
|
|
217
|
+
var reporter;
|
|
218
|
+
var pending = /* @__PURE__ */ new Set();
|
|
219
|
+
function setSentryTag(key, value) {
|
|
220
|
+
tags[key] = value;
|
|
221
|
+
}
|
|
222
|
+
function setSentryContext(name, context3) {
|
|
223
|
+
contexts[name] = context3;
|
|
224
|
+
}
|
|
225
|
+
function beforeSend(event, hint) {
|
|
226
|
+
const e = event;
|
|
227
|
+
const h = hint;
|
|
228
|
+
if (isCliNoise(e, h)) return null;
|
|
229
|
+
groupCliEvent(e, h);
|
|
230
|
+
scrubEvent(e);
|
|
231
|
+
return event;
|
|
232
|
+
}
|
|
233
|
+
function loadReporter() {
|
|
234
|
+
reporter ??= import("./sentry-reporter-FCSQOR4U.js").then(
|
|
235
|
+
(m) => m.startReporter({
|
|
236
|
+
dsn,
|
|
237
|
+
// release aligns with the AG-757 `x-genex-cli-version` telemetry stream so
|
|
238
|
+
// the two correlate; environment is prod unless pointed at a non-default API.
|
|
239
|
+
release: `@genex-ai/cli-demo@${getCliVersion()}`,
|
|
240
|
+
environment: CLI_CHANNEL === "dev" ? "development" : getApiUrl() === DEFAULT_API_URL ? "production" : "development",
|
|
241
|
+
beforeSend
|
|
242
|
+
})
|
|
243
|
+
);
|
|
244
|
+
return reporter;
|
|
235
245
|
}
|
|
236
|
-
|
|
246
|
+
function reportException(err, hint = {}) {
|
|
237
247
|
if (!sentryEnabled) return;
|
|
248
|
+
const scope = { tags: { ...tags }, contexts: { ...contexts } };
|
|
249
|
+
const report = loadReporter().then((r) => r.capture(err, hint, scope)).catch(() => {
|
|
250
|
+
});
|
|
251
|
+
pending.add(report);
|
|
252
|
+
void report.finally(() => pending.delete(report));
|
|
253
|
+
}
|
|
254
|
+
async function flushSentry(timeoutMs = FLUSH_TIMEOUT_MS) {
|
|
255
|
+
if (!reporter) return;
|
|
256
|
+
const deadline = Date.now() + timeoutMs;
|
|
238
257
|
try {
|
|
239
|
-
await
|
|
258
|
+
await Promise.race([Promise.all(pending), sleep(timeoutMs, void 0, { ref: false })]);
|
|
259
|
+
await (await reporter).flush(Math.max(0, deadline - Date.now()));
|
|
240
260
|
} catch {
|
|
241
261
|
}
|
|
242
262
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
263
|
+
var crashing = false;
|
|
264
|
+
async function onUncaughtException(err) {
|
|
265
|
+
if (!crashing) {
|
|
266
|
+
crashing = true;
|
|
267
|
+
reportException(err, { level: "fatal", mechanism: { type: "auto.node.onuncaughtexception", handled: false } });
|
|
268
|
+
await flushSentry();
|
|
269
|
+
}
|
|
270
|
+
console.error(err);
|
|
271
|
+
process.exit(1);
|
|
272
|
+
}
|
|
273
|
+
function onUnhandledRejection(reason) {
|
|
274
|
+
const name = reason instanceof Error ? reason.name : "";
|
|
275
|
+
if (IGNORED_REJECTION_NAMES.has(name)) return;
|
|
276
|
+
reportException(reason, {
|
|
277
|
+
level: "error",
|
|
278
|
+
extra: { unhandledPromiseRejection: true },
|
|
279
|
+
mechanism: { type: "auto.node.onunhandledrejection", handled: false }
|
|
280
|
+
});
|
|
281
|
+
console.warn(REJECTION_WARNING);
|
|
282
|
+
console.error(reason instanceof Error && reason.stack ? reason.stack : reason);
|
|
283
|
+
}
|
|
284
|
+
if (sentryEnabled) {
|
|
285
|
+
process.on("uncaughtException", (err) => void onUncaughtException(err));
|
|
286
|
+
process.on("unhandledRejection", onUnhandledRejection);
|
|
287
|
+
}
|
|
246
288
|
|
|
247
289
|
// src/lib/auth.ts
|
|
248
290
|
import http from "http";
|
|
@@ -279,9 +321,9 @@ async function readPendingAuth(apiUrl, envPath) {
|
|
|
279
321
|
if (current) return current;
|
|
280
322
|
return defaultProfile(envPath) ? readRecord(legacyPath(), apiUrl) : null;
|
|
281
323
|
}
|
|
282
|
-
async function writePendingAuth(
|
|
283
|
-
const apiUrl = normalizeApiOrigin(
|
|
284
|
-
await writeSecretFile(pendingAuthPath(apiUrl, envPath), JSON.stringify({ ...
|
|
324
|
+
async function writePendingAuth(pending2, envPath) {
|
|
325
|
+
const apiUrl = normalizeApiOrigin(pending2.apiUrl);
|
|
326
|
+
await writeSecretFile(pendingAuthPath(apiUrl, envPath), JSON.stringify({ ...pending2, apiUrl }) + "\n");
|
|
285
327
|
}
|
|
286
328
|
async function clearPendingAuth(apiUrl = getApiUrl(), envPath) {
|
|
287
329
|
await fs.rm(pendingAuthPath(apiUrl, envPath), { force: true }).catch(() => {
|
|
@@ -316,7 +358,7 @@ var AuthPendingError = class extends Error {
|
|
|
316
358
|
function formatUserCode(code) {
|
|
317
359
|
return code.length === 8 ? `${code.slice(0, 4)}-${code.slice(4)}` : code;
|
|
318
360
|
}
|
|
319
|
-
var
|
|
361
|
+
var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
320
362
|
async function authorize(apiBaseUrl, authBaseUrl, options) {
|
|
321
363
|
apiBaseUrl = normalizeApiOrigin(apiBaseUrl);
|
|
322
364
|
const { log, inlineWaitMs = DEFAULT_INLINE_WAIT_MS, open = openBrowser, label, envPath } = options;
|
|
@@ -336,14 +378,14 @@ async function authorize(apiBaseUrl, authBaseUrl, options) {
|
|
|
336
378
|
}
|
|
337
379
|
throw err;
|
|
338
380
|
}
|
|
339
|
-
const
|
|
381
|
+
const pending2 = {
|
|
340
382
|
deviceCode: started.deviceCode,
|
|
341
383
|
userCode: started.userCode,
|
|
342
384
|
verifyUrl: started.verifyUrl,
|
|
343
385
|
expiresAt: Date.now() + started.expiresIn * 1e3,
|
|
344
386
|
apiUrl: apiBaseUrl
|
|
345
387
|
};
|
|
346
|
-
await writePendingAuth(
|
|
388
|
+
await writePendingAuth(pending2, envPath);
|
|
347
389
|
printCode(log, started.userCode, started.verifyUrl);
|
|
348
390
|
let warned = false;
|
|
349
391
|
const warnManual = () => {
|
|
@@ -352,7 +394,7 @@ async function authorize(apiBaseUrl, authBaseUrl, options) {
|
|
|
352
394
|
log.dim(" (couldn't open a browser here \u2014 open the link above yourself)");
|
|
353
395
|
};
|
|
354
396
|
if (!open(started.verifyUrl, warnManual)) warnManual();
|
|
355
|
-
return await pollForToken(apiBaseUrl,
|
|
397
|
+
return await pollForToken(apiBaseUrl, pending2, { log, inlineWaitMs, interval: started.interval, envPath });
|
|
356
398
|
}
|
|
357
399
|
var LegacyApiError = class extends Error {
|
|
358
400
|
};
|
|
@@ -398,7 +440,7 @@ function printCode(log, userCode, verifyUrl) {
|
|
|
398
440
|
].join("\n")
|
|
399
441
|
);
|
|
400
442
|
}
|
|
401
|
-
async function pollForToken(apiBaseUrl,
|
|
443
|
+
async function pollForToken(apiBaseUrl, pending2, opts) {
|
|
402
444
|
const { log, inlineWaitMs } = opts;
|
|
403
445
|
const deadline = Date.now() + inlineWaitMs;
|
|
404
446
|
let intervalMs = Math.max((opts.interval ?? 2) * 1e3, MIN_POLL_INTERVAL_MS);
|
|
@@ -409,7 +451,7 @@ async function pollForToken(apiBaseUrl, pending, opts) {
|
|
|
409
451
|
res = await apiFetch(`${apiBaseUrl}/api/cli/device/poll`, {
|
|
410
452
|
method: "POST",
|
|
411
453
|
headers: { "Content-Type": "application/json" },
|
|
412
|
-
body: JSON.stringify({ deviceCode:
|
|
454
|
+
body: JSON.stringify({ deviceCode: pending2.deviceCode })
|
|
413
455
|
});
|
|
414
456
|
} catch {
|
|
415
457
|
res = new Response(null, { status: 599 });
|
|
@@ -432,8 +474,8 @@ async function pollForToken(apiBaseUrl, pending, opts) {
|
|
|
432
474
|
}
|
|
433
475
|
if (Date.now() + intervalMs > deadline) {
|
|
434
476
|
throw new AuthPendingError(
|
|
435
|
-
|
|
436
|
-
|
|
477
|
+
pending2.userCode,
|
|
478
|
+
pending2.verifyUrl,
|
|
437
479
|
apiBaseUrl,
|
|
438
480
|
opts.envPath || process.env[ENV_FILE_ENV] ? getGenexEnvPath(opts.envPath) : void 0
|
|
439
481
|
);
|
|
@@ -442,7 +484,7 @@ async function pollForToken(apiBaseUrl, pending, opts) {
|
|
|
442
484
|
log.dim(" still waiting for you to approve\u2026");
|
|
443
485
|
nextReassureAt = Date.now() + REASSURE_EVERY_MS;
|
|
444
486
|
}
|
|
445
|
-
await
|
|
487
|
+
await sleep2(intervalMs);
|
|
446
488
|
}
|
|
447
489
|
}
|
|
448
490
|
function printAuthHandoff(log, err) {
|
|
@@ -459,11 +501,11 @@ function printAuthHandoff(log, err) {
|
|
|
459
501
|
);
|
|
460
502
|
}
|
|
461
503
|
async function resumeAuthorization(apiBaseUrl, options) {
|
|
462
|
-
const
|
|
463
|
-
if (!
|
|
504
|
+
const pending2 = await readPendingAuth(apiBaseUrl, options.envPath);
|
|
505
|
+
if (!pending2) return null;
|
|
464
506
|
const { log, inlineWaitMs = DEFAULT_INLINE_WAIT_MS } = options;
|
|
465
|
-
printCode(log,
|
|
466
|
-
return await pollForToken(apiBaseUrl,
|
|
507
|
+
printCode(log, pending2.userCode, pending2.verifyUrl);
|
|
508
|
+
return await pollForToken(apiBaseUrl, pending2, { log, inlineWaitMs, envPath: options.envPath });
|
|
467
509
|
}
|
|
468
510
|
var SUCCESS_HTML = `<!doctype html><html><head><meta charset="utf-8"><title>Genex</title>
|
|
469
511
|
<style>body{font-family:system-ui,sans-serif;background:#0b0b0f;color:#eaeaea;display:grid;place-items:center;height:100vh;margin:0}
|
|
@@ -1622,8 +1664,8 @@ async function fetchLatestFromRegistry(name) {
|
|
|
1622
1664
|
{ signal: AbortSignal.timeout(REGISTRY_TIMEOUT_MS) }
|
|
1623
1665
|
);
|
|
1624
1666
|
if (!res.ok) return null;
|
|
1625
|
-
const
|
|
1626
|
-
return typeof
|
|
1667
|
+
const tags2 = await res.json();
|
|
1668
|
+
return typeof tags2.latest === "string" && parseSemver(tags2.latest) ? tags2.latest : null;
|
|
1627
1669
|
} catch {
|
|
1628
1670
|
return null;
|
|
1629
1671
|
}
|
|
@@ -3299,10 +3341,10 @@ function hashReadsBeforeInit(content) {
|
|
|
3299
3341
|
else if (ch === "}") depth--;
|
|
3300
3342
|
}
|
|
3301
3343
|
if (depth <= 0) {
|
|
3302
|
-
return !inBracelessArrow(content, at) && !inits.some((
|
|
3344
|
+
return !inBracelessArrow(content, at) && !inits.some((init) => init.index < at);
|
|
3303
3345
|
}
|
|
3304
3346
|
const flowEnd = enclosingFlowEnd(content, at);
|
|
3305
|
-
return flowEnd !== content.length && inits.some((
|
|
3347
|
+
return flowEnd !== content.length && inits.some((init) => init.flowEnd === flowEnd && init.index > at);
|
|
3306
3348
|
});
|
|
3307
3349
|
}
|
|
3308
3350
|
async function detectShellApis(cwd = process.cwd()) {
|
|
@@ -4501,12 +4543,12 @@ function edgeOpaqueFraction(png, alphaThresh = 40) {
|
|
|
4501
4543
|
}
|
|
4502
4544
|
function assertNotFlush(png, label, maxFrac) {
|
|
4503
4545
|
const edges = edgeOpaqueFraction(png);
|
|
4504
|
-
const
|
|
4505
|
-
if (
|
|
4546
|
+
const flush = Object.entries(edges).filter(([, frac]) => frac > maxFrac);
|
|
4547
|
+
if (flush.length > 0) {
|
|
4506
4548
|
fail(
|
|
4507
4549
|
`${label}: the crop box is slicing the element \u2014 opaque content is flush against the crop edge. The sheet needs more margin here: widen the crop box if there is room, otherwise region-edit or regenerate the sheet with more spacing around this element (see genex-ai-hud troubleshooting), then re-run.`,
|
|
4508
4550
|
{
|
|
4509
|
-
flushEdges:
|
|
4551
|
+
flushEdges: flush.map(([edge, frac]) => ({ edge, opaqueFraction: Number(frac.toFixed(3)) })),
|
|
4510
4552
|
maxFraction: maxFrac
|
|
4511
4553
|
}
|
|
4512
4554
|
);
|
|
@@ -6357,7 +6399,7 @@ async function isDir(p) {
|
|
|
6357
6399
|
return false;
|
|
6358
6400
|
}
|
|
6359
6401
|
}
|
|
6360
|
-
var
|
|
6402
|
+
var sleep3 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
6361
6403
|
function fingerprintOf(html) {
|
|
6362
6404
|
const m = html.match(/[A-Za-z0-9_]+-[A-Za-z0-9_-]{8}\.(?:js|css)/);
|
|
6363
6405
|
return m ? m[0] : null;
|
|
@@ -6378,7 +6420,7 @@ async function waitUntilLive(playUrl, fingerprint, timeoutMs, log) {
|
|
|
6378
6420
|
}
|
|
6379
6421
|
} catch {
|
|
6380
6422
|
}
|
|
6381
|
-
await
|
|
6423
|
+
await sleep3(1500);
|
|
6382
6424
|
}
|
|
6383
6425
|
log.success(`Published. \u{1F310} ${playUrl}`);
|
|
6384
6426
|
log.dim(" (If the previous build shows, hard-refresh in a few seconds.)");
|
|
@@ -8316,7 +8358,7 @@ async function runDomain(opts) {
|
|
|
8316
8358
|
}
|
|
8317
8359
|
const base = `${apiUrl}/api/projects/${encodeURIComponent(meta.id)}/domains`;
|
|
8318
8360
|
const auth = { Authorization: `Bearer ${token}` };
|
|
8319
|
-
const call = (url,
|
|
8361
|
+
const call = (url, init) => apiFetch(url, { ...init, headers: { ...auth, "Content-Type": "application/json", ...init?.headers ?? {} } });
|
|
8320
8362
|
let res;
|
|
8321
8363
|
try {
|
|
8322
8364
|
if (sub === "list") res = await call(base);
|
|
@@ -8464,7 +8506,7 @@ async function runShop(opts) {
|
|
|
8464
8506
|
await writeUserToken(token, opts.envPath, apiUrl);
|
|
8465
8507
|
}
|
|
8466
8508
|
const auth = { Authorization: `Bearer ${token}`, "Content-Type": "application/json" };
|
|
8467
|
-
const call = (url,
|
|
8509
|
+
const call = (url, init) => apiFetch(url, { ...init, headers: { ...auth, ...init?.headers ?? {} } });
|
|
8468
8510
|
const projectSkus = `${apiUrl}/api/coin/projects/${encodeURIComponent(meta.id)}/skus`;
|
|
8469
8511
|
async function fail5(res2, what) {
|
|
8470
8512
|
if (printedStructuredError(res2)) {
|
|
@@ -9586,13 +9628,13 @@ async function enqueueWithAllowance(input) {
|
|
|
9586
9628
|
const headers = { "Content-Type": "application/json", Authorization: `Bearer ${input.token}` };
|
|
9587
9629
|
const fingerprint = createHash("sha256").update(JSON.stringify([input.apiUrl, createPath, input.body])).digest("hex");
|
|
9588
9630
|
const rows = await readAdmissionRows(cwd);
|
|
9589
|
-
const
|
|
9631
|
+
const pending2 = /* @__PURE__ */ new Map();
|
|
9590
9632
|
for (const row of rows) {
|
|
9591
|
-
if (row.t === "reserve" && typeof row.id === "string")
|
|
9592
|
-
if (row.t === "release" && typeof row.id === "string")
|
|
9593
|
-
if (row.t === "q" && typeof row.reservationId === "string")
|
|
9633
|
+
if (row.t === "reserve" && typeof row.id === "string") pending2.set(row.id, row);
|
|
9634
|
+
if (row.t === "release" && typeof row.id === "string") pending2.delete(row.id);
|
|
9635
|
+
if (row.t === "q" && typeof row.reservationId === "string") pending2.delete(row.reservationId);
|
|
9594
9636
|
}
|
|
9595
|
-
for (const [requestId2, row] of
|
|
9637
|
+
for (const [requestId2, row] of pending2) {
|
|
9596
9638
|
if (row.apiUrl === input.apiUrl && row.generic === true) {
|
|
9597
9639
|
const response2 = await apiFetch(`${input.apiUrl}/api/generations/requests/${encodeURIComponent(requestId2)}`, { headers });
|
|
9598
9640
|
if (response2.ok) {
|
|
@@ -9811,7 +9853,7 @@ function reportMocked(view, log) {
|
|
|
9811
9853
|
if (view.mocked !== true) return;
|
|
9812
9854
|
log.dim(` ${view.provider === "fixture" ? FIXTURE_LINE : MOCKED_LINE}`);
|
|
9813
9855
|
}
|
|
9814
|
-
var
|
|
9856
|
+
var sleep4 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
9815
9857
|
var INLINE_IMAGE_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
9816
9858
|
var IMAGE_MIME_BY_EXT = {
|
|
9817
9859
|
".png": "image/png",
|
|
@@ -10600,14 +10642,14 @@ async function waitViaSSE(apiUrl, token, id, onProgress, deadline) {
|
|
|
10600
10642
|
});
|
|
10601
10643
|
} catch {
|
|
10602
10644
|
if (++connectFailures >= 3) return "unsupported";
|
|
10603
|
-
await
|
|
10645
|
+
await sleep4(2e3);
|
|
10604
10646
|
continue;
|
|
10605
10647
|
}
|
|
10606
10648
|
if (res.status === 404 || res.status === 405) return "unsupported";
|
|
10607
10649
|
const contentType = res.headers.get("content-type") ?? "";
|
|
10608
10650
|
if (!res.ok || !res.body || !contentType.includes("text/event-stream")) {
|
|
10609
10651
|
if (++connectFailures >= 3) return "unsupported";
|
|
10610
|
-
await
|
|
10652
|
+
await sleep4(2e3);
|
|
10611
10653
|
continue;
|
|
10612
10654
|
}
|
|
10613
10655
|
connectFailures = 0;
|
|
@@ -10628,7 +10670,7 @@ async function waitViaSSE(apiUrl, token, id, onProgress, deadline) {
|
|
|
10628
10670
|
}
|
|
10629
10671
|
} catch {
|
|
10630
10672
|
}
|
|
10631
|
-
await
|
|
10673
|
+
await sleep4(1e3);
|
|
10632
10674
|
} finally {
|
|
10633
10675
|
clearTimeout(timer);
|
|
10634
10676
|
abort.abort();
|
|
@@ -10658,7 +10700,7 @@ async function poll(apiUrl, token, id, onProgress, timeoutMs) {
|
|
|
10658
10700
|
}
|
|
10659
10701
|
const remaining = deadline - Date.now();
|
|
10660
10702
|
if (remaining <= 0) break;
|
|
10661
|
-
await
|
|
10703
|
+
await sleep4(Math.min(3e3, remaining));
|
|
10662
10704
|
}
|
|
10663
10705
|
return null;
|
|
10664
10706
|
}
|
|
@@ -20426,12 +20468,12 @@ async function loadManifest(baseOverride) {
|
|
|
20426
20468
|
function resolveSelectors(manifest, selectors) {
|
|
20427
20469
|
const byName = new Map(manifest.clips.map((entry) => [entry.name, entry]));
|
|
20428
20470
|
const byLowerName = new Map(manifest.clips.map((entry) => [entry.name.toLowerCase(), entry]));
|
|
20429
|
-
const
|
|
20471
|
+
const tags2 = /* @__PURE__ */ new Map();
|
|
20430
20472
|
for (const entry of manifest.clips) {
|
|
20431
20473
|
for (const tag of entry.tags) {
|
|
20432
|
-
const list =
|
|
20474
|
+
const list = tags2.get(tag) ?? [];
|
|
20433
20475
|
list.push(entry);
|
|
20434
|
-
|
|
20476
|
+
tags2.set(tag, list);
|
|
20435
20477
|
}
|
|
20436
20478
|
}
|
|
20437
20479
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -20441,12 +20483,12 @@ function resolveSelectors(manifest, selectors) {
|
|
|
20441
20483
|
out.set(selector, [exact]);
|
|
20442
20484
|
continue;
|
|
20443
20485
|
}
|
|
20444
|
-
const tagHit =
|
|
20486
|
+
const tagHit = tags2.get(selector) ?? tags2.get(selector.toLowerCase());
|
|
20445
20487
|
if (tagHit) {
|
|
20446
20488
|
out.set(selector, tagHit);
|
|
20447
20489
|
continue;
|
|
20448
20490
|
}
|
|
20449
|
-
const candidates = [...
|
|
20491
|
+
const candidates = [...tags2.keys(), ...byName.keys()];
|
|
20450
20492
|
const close = suggest(selector, candidates);
|
|
20451
20493
|
throw new Error(
|
|
20452
20494
|
`unknown clip/tag "${selector}"${close.length > 0 ? ` \u2014 closest: ${close.join(", ")}` : ""}. Run ${c.cyan(
|
|
@@ -20512,13 +20554,13 @@ function printCatalog(log, manifest, selectors) {
|
|
|
20512
20554
|
}
|
|
20513
20555
|
return;
|
|
20514
20556
|
}
|
|
20515
|
-
const
|
|
20557
|
+
const tags2 = /* @__PURE__ */ new Map();
|
|
20516
20558
|
for (const entry of manifest.clips) {
|
|
20517
20559
|
for (const tag of entry.tags) {
|
|
20518
20560
|
if (tag === HIDDEN_TAG) continue;
|
|
20519
|
-
const list =
|
|
20561
|
+
const list = tags2.get(tag) ?? [];
|
|
20520
20562
|
list.push(entry);
|
|
20521
|
-
|
|
20563
|
+
tags2.set(tag, list);
|
|
20522
20564
|
}
|
|
20523
20565
|
}
|
|
20524
20566
|
log.plain(
|
|
@@ -20530,7 +20572,7 @@ function printCatalog(log, manifest, selectors) {
|
|
|
20530
20572
|
)}`
|
|
20531
20573
|
);
|
|
20532
20574
|
log.plain("");
|
|
20533
|
-
for (const [tag, entries] of [...
|
|
20575
|
+
for (const [tag, entries] of [...tags2.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
20534
20576
|
const bytes = entries.reduce((sum, entry) => sum + entry.bytes, 0);
|
|
20535
20577
|
const suffix = tag === "core" ? " \u2014 bundled in animation-library.glb" : ` (${formatMb(bytes)})`;
|
|
20536
20578
|
log.plain(` ${c.bold(tag.padEnd(18))} ${entries.map((e) => e.name).join(", ")}${suffix}`);
|
|
@@ -24767,7 +24809,7 @@ async function runBench(args) {
|
|
|
24767
24809
|
const samples = opts.samples ?? DEFAULT_BENCH_SAMPLES;
|
|
24768
24810
|
const prompt = opts.benchPrompt.trim();
|
|
24769
24811
|
const auth = { Authorization: `Bearer ${token}`, "Content-Type": "application/json" };
|
|
24770
|
-
const call = (url,
|
|
24812
|
+
const call = (url, init) => apiFetch(url, { ...init, headers: { ...auth, ...init?.headers ?? {} } });
|
|
24771
24813
|
let schema;
|
|
24772
24814
|
if (opts.schemaPath) {
|
|
24773
24815
|
try {
|
|
@@ -25205,7 +25247,7 @@ function emptyBenchJson(apiUrl, projectId, prompt, outputFormat, samples, maxCre
|
|
|
25205
25247
|
}
|
|
25206
25248
|
async function reportStatus(args) {
|
|
25207
25249
|
const { apiUrl, token, projectId, opts, log } = args;
|
|
25208
|
-
const call = (url,
|
|
25250
|
+
const call = (url, init) => apiFetch(url, { ...init, headers: { Authorization: `Bearer ${token}`, ...init?.headers ?? {} } });
|
|
25209
25251
|
const base = `${apiUrl}/api/runtime/development/projects/${encodeURIComponent(projectId)}/generations`;
|
|
25210
25252
|
const res = await call(`${base}?scope=open`).catch(() => null);
|
|
25211
25253
|
if (!res || !res.ok) {
|
|
@@ -25298,7 +25340,7 @@ function statusJson(apiUrl, projectId, status2, error, rows, slotsHeld, slotLimi
|
|
|
25298
25340
|
}
|
|
25299
25341
|
async function cancelCall(args) {
|
|
25300
25342
|
const { apiUrl, token, projectId, id, opts, log } = args;
|
|
25301
|
-
const call = (url,
|
|
25343
|
+
const call = (url, init) => apiFetch(url, { ...init, headers: { Authorization: `Bearer ${token}`, ...init?.headers ?? {} } });
|
|
25302
25344
|
const base = `${apiUrl}/api/runtime/development/projects/${encodeURIComponent(projectId)}/generations`;
|
|
25303
25345
|
const rowUrl = `${base}/${encodeURIComponent(id)}`;
|
|
25304
25346
|
const done = (status2, error, reason, row2) => {
|
|
@@ -26178,7 +26220,7 @@ var MIN_POLL_INTERVAL_MS2 = 1e3;
|
|
|
26178
26220
|
var DEFAULT_PLAYER_WAIT_MS = 10 * 60 * 1e3;
|
|
26179
26221
|
var REASSURE_EVERY_MS2 = 30 * 1e3;
|
|
26180
26222
|
var PLAYER_NOT_APPROVED = "Nobody approved this machine, so nothing was installed. Re-run `genex player install` when you can open the link.";
|
|
26181
|
-
var
|
|
26223
|
+
var sleep5 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
26182
26224
|
async function authorizePlayer(apiBaseUrl, options) {
|
|
26183
26225
|
const apiUrl = normalizeApiOrigin(apiBaseUrl);
|
|
26184
26226
|
const { log, waitMs = DEFAULT_PLAYER_WAIT_MS, open = openBrowser } = options;
|
|
@@ -26235,7 +26277,7 @@ async function authorizePlayer(apiBaseUrl, options) {
|
|
|
26235
26277
|
log.dim(" still waiting for you to approve\u2026");
|
|
26236
26278
|
nextReassureAt = Date.now() + REASSURE_EVERY_MS2;
|
|
26237
26279
|
}
|
|
26238
|
-
await
|
|
26280
|
+
await sleep5(intervalMs);
|
|
26239
26281
|
}
|
|
26240
26282
|
}
|
|
26241
26283
|
async function startPlayerDeviceAuth(apiUrl, label) {
|
|
@@ -26300,15 +26342,15 @@ var PlayerClient = class {
|
|
|
26300
26342
|
this.version = options.version ?? getCliVersion();
|
|
26301
26343
|
this.timeoutMs = options.timeoutMs ?? 3e4;
|
|
26302
26344
|
}
|
|
26303
|
-
async call(path46,
|
|
26345
|
+
async call(path46, init = {}, provider) {
|
|
26304
26346
|
const headers = {
|
|
26305
26347
|
Authorization: `Bearer ${this.token}`,
|
|
26306
26348
|
[PLAYER_VERSION_HEADER]: this.version,
|
|
26307
26349
|
...provider ? { [EXTERNAL_PROVIDER_HEADER]: provider } : {},
|
|
26308
|
-
...
|
|
26350
|
+
...init.body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
26309
26351
|
};
|
|
26310
26352
|
const res = await apiFetch(`${this.apiUrl}${path46}`, {
|
|
26311
|
-
...
|
|
26353
|
+
...init,
|
|
26312
26354
|
headers,
|
|
26313
26355
|
signal: AbortSignal.timeout(this.timeoutMs)
|
|
26314
26356
|
}, { noTermsWait: true });
|
|
@@ -26952,7 +26994,7 @@ var LEASE_RENEW_MS = 45e3;
|
|
|
26952
26994
|
var JOB_TIMEOUT_MS = 10 * 6e4;
|
|
26953
26995
|
var SHUTDOWN_RETRY_SECONDS = 5;
|
|
26954
26996
|
var MAX_PROVIDER_COOLDOWN_MS = 60 * 6e4;
|
|
26955
|
-
var
|
|
26997
|
+
var sleep6 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
26956
26998
|
function platformTag(platform = process.platform) {
|
|
26957
26999
|
return platform.toLowerCase().replace(/[^a-z0-9_-]/g, "").slice(0, 40) || "unknown";
|
|
26958
27000
|
}
|
|
@@ -27079,7 +27121,7 @@ async function runWatcherLoop(options) {
|
|
|
27079
27121
|
state.lastError = describe(error);
|
|
27080
27122
|
heartbeatAt = now + backoffMs(policy, failures);
|
|
27081
27123
|
log(`player: heartbeat failed (${describe(error)})`);
|
|
27082
|
-
await
|
|
27124
|
+
await sleep6(backoffMs(policy, failures));
|
|
27083
27125
|
continue;
|
|
27084
27126
|
}
|
|
27085
27127
|
}
|
|
@@ -27094,9 +27136,9 @@ async function runWatcherLoop(options) {
|
|
|
27094
27136
|
const until = cooldown.get(provider) ?? 0;
|
|
27095
27137
|
if (until > Date.now()) continue;
|
|
27096
27138
|
if (until) cooldown.delete(provider);
|
|
27097
|
-
let
|
|
27139
|
+
let pending2;
|
|
27098
27140
|
try {
|
|
27099
|
-
|
|
27141
|
+
pending2 = await client.pending(provider);
|
|
27100
27142
|
state.lastPollAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
27101
27143
|
failures = 0;
|
|
27102
27144
|
} catch (error) {
|
|
@@ -27108,10 +27150,10 @@ async function runWatcherLoop(options) {
|
|
|
27108
27150
|
failures += 1;
|
|
27109
27151
|
state.lastError = describe(error);
|
|
27110
27152
|
log(`player: poll failed (${describe(error)})`);
|
|
27111
|
-
await
|
|
27153
|
+
await sleep6(backoffMs(policy, failures));
|
|
27112
27154
|
continue;
|
|
27113
27155
|
}
|
|
27114
|
-
for (const row of
|
|
27156
|
+
for (const row of pending2) {
|
|
27115
27157
|
if (stop2) break;
|
|
27116
27158
|
if (!workable(row, watcherId)) continue;
|
|
27117
27159
|
if (await handleOne(row, provider)) worked = true;
|
|
@@ -27125,7 +27167,7 @@ async function runWatcherLoop(options) {
|
|
|
27125
27167
|
break;
|
|
27126
27168
|
}
|
|
27127
27169
|
const interval = options.pollIntervalMsOverride ?? Math.max(1e3, (policy.pollIntervalSeconds || 5) * 1e3);
|
|
27128
|
-
if (!worked) await
|
|
27170
|
+
if (!worked) await sleep6(interval);
|
|
27129
27171
|
}
|
|
27130
27172
|
} finally {
|
|
27131
27173
|
process.off("SIGINT", sigint);
|
|
@@ -27162,7 +27204,7 @@ async function runWatcherLoop(options) {
|
|
|
27162
27204
|
}
|
|
27163
27205
|
failures += 1;
|
|
27164
27206
|
log(`player: could not claim ${row.id} (${describe(error)})`);
|
|
27165
|
-
await
|
|
27207
|
+
await sleep6(backoffMs(policy, failures));
|
|
27166
27208
|
return false;
|
|
27167
27209
|
}
|
|
27168
27210
|
held.row = { id: row.id, provider };
|
|
@@ -27507,11 +27549,11 @@ async function status(opts, log) {
|
|
|
27507
27549
|
server.policyVersion = policy.version ?? null;
|
|
27508
27550
|
server.minVersion = policy.minVersion ?? null;
|
|
27509
27551
|
server.latestVersion = policy.latestVersion ?? null;
|
|
27510
|
-
let
|
|
27552
|
+
let pending2 = 0;
|
|
27511
27553
|
for (const provider of new Set(runners.map((r) => PROVIDER_FOR_RUNNER[r]))) {
|
|
27512
|
-
|
|
27554
|
+
pending2 += (await client.pending(provider)).length;
|
|
27513
27555
|
}
|
|
27514
|
-
server.pending =
|
|
27556
|
+
server.pending = pending2;
|
|
27515
27557
|
} catch (error) {
|
|
27516
27558
|
server.error = error instanceof PlayerApiError ? `${error.status} ${error.code}`.trim() : error instanceof PlayerAuthError ? "credential_rejected" : error instanceof PlayerUpdateRequiredError ? "player_update_required" : "unreachable";
|
|
27517
27559
|
}
|
|
@@ -29437,11 +29479,11 @@ async function main() {
|
|
|
29437
29479
|
await syncSkills(updateLog, workspace);
|
|
29438
29480
|
}
|
|
29439
29481
|
const updateCheck = startUpdateCheck();
|
|
29440
|
-
|
|
29441
|
-
|
|
29442
|
-
|
|
29443
|
-
|
|
29444
|
-
|
|
29482
|
+
setSentryTag("command", parsed.command);
|
|
29483
|
+
setSentryTag("cli.version", getCliVersion());
|
|
29484
|
+
setSentryTag("node.version", process.versions.node);
|
|
29485
|
+
setSentryTag("os.platform", process.platform);
|
|
29486
|
+
setSentryContext("runtime", {
|
|
29445
29487
|
cliVersion: getCliVersion(),
|
|
29446
29488
|
node: process.version,
|
|
29447
29489
|
platform: process.platform,
|
|
@@ -29689,7 +29731,7 @@ function checkNodeVersion() {
|
|
|
29689
29731
|
guardStdio();
|
|
29690
29732
|
if (checkNodeVersion()) {
|
|
29691
29733
|
main().catch(async (err) => {
|
|
29692
|
-
if (!isExpected(err))
|
|
29734
|
+
if (!isExpected(err)) reportException(err);
|
|
29693
29735
|
if (!wasPrinted(err)) {
|
|
29694
29736
|
const log = createLogger();
|
|
29695
29737
|
log.error(describeError(err));
|