@use-aistack/cli 0.16.0 → 0.16.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/index.js CHANGED
@@ -377,10 +377,11 @@ function apiEquivalentCost(modelKey, t, atMs) {
377
377
  }
378
378
 
379
379
  // src/version.ts
380
- var CLI_VERSION = true ? "0.16.0" : "0.0.0-dev";
380
+ var CLI_VERSION = true ? "0.16.1" : "0.0.0-dev";
381
381
 
382
382
  // src/api.ts
383
383
  var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
384
+ var STARTUP_READ_TIMEOUT_MS = 5e3;
384
385
  async function request(path14, options = {}) {
385
386
  return fetch(`${BASE_URL}${path14}`, {
386
387
  ...options,
@@ -501,6 +502,7 @@ async function syncPublish(token, bodyJson) {
501
502
  }
502
503
  async function fetchDayManifest(baseUrl, token) {
503
504
  const res = await fetch(`${baseUrl}/api/cli/sync-manifest`, {
505
+ signal: AbortSignal.timeout(STARTUP_READ_TIMEOUT_MS),
504
506
  headers: { "Content-Type": "application/json", ...authHeaders(token) }
505
507
  });
506
508
  if (res.status === 404) return null;
@@ -524,6 +526,7 @@ async function fetchDayManifest(baseUrl, token) {
524
526
  }
525
527
  async function fetchPriceTable(baseUrl) {
526
528
  const res = await fetch(`${baseUrl}/api/prices`, {
529
+ signal: AbortSignal.timeout(STARTUP_READ_TIMEOUT_MS),
527
530
  headers: { Accept: "application/json" }
528
531
  });
529
532
  if (res.status === 404) return null;
@@ -9954,7 +9957,7 @@ async function stageSync(deps) {
9954
9957
  id: BUNDLED_PRICE_TABLE_ID,
9955
9958
  origin: "bundled"
9956
9959
  };
9957
- progress("Checking prices and stack settings");
9960
+ progress("Checking prices");
9958
9961
  try {
9959
9962
  const table = await fetchPrices(deps.baseUrl);
9960
9963
  if (table) {
@@ -9966,12 +9969,14 @@ async function stageSync(deps) {
9966
9969
  } catch {
9967
9970
  setActivePricer(null);
9968
9971
  }
9972
+ progress("Checking stack settings");
9969
9973
  const { config, source } = await loadConfig({
9970
9974
  baseUrl: deps.baseUrl,
9971
9975
  ...token ? { token } : {}
9972
9976
  });
9973
9977
  let manifest = null;
9974
9978
  if (token) {
9979
+ progress("Checking previously synced days");
9975
9980
  try {
9976
9981
  manifest = await fetchManifest(deps.baseUrl, token);
9977
9982
  } catch {
@@ -9988,6 +9993,7 @@ async function stageSync(deps) {
9988
9993
  const usageScans = [];
9989
9994
  const sinceMs = windowStartMs(now, windowDays);
9990
9995
  const daysSinceMs = windowStartMs(now, retentionDays);
9996
+ progress("Detecting local harnesses");
9991
9997
  const active2 = await adapters(sinceMs);
9992
9998
  const historical = await adapters(daysSinceMs);
9993
9999
  let dayScansComplete = true;