@base44-preview/cli 0.1.12-pr.611.23d31b2 → 0.1.13-pr.612.385bd7a

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/index.js CHANGED
@@ -221222,7 +221222,7 @@ var require_dist5 = __commonJS(function(exports, module) {
221222
221222
  determineAgent: () => determineAgent
221223
221223
  });
221224
221224
  module.exports = __toCommonJS2(src_exports);
221225
- var import_promises25 = __require("node:fs/promises");
221225
+ var import_promises26 = __require("node:fs/promises");
221226
221226
  var import_node_fs25 = __require("node:fs");
221227
221227
  var DEVIN_LOCAL_PATH = "/opt/.devin";
221228
221228
  var CURSOR2 = "cursor";
@@ -221280,7 +221280,7 @@ var require_dist5 = __commonJS(function(exports, module) {
221280
221280
  return { isAgent: true, agent: { name: REPLIT } };
221281
221281
  }
221282
221282
  try {
221283
- await (0, import_promises25.access)(DEVIN_LOCAL_PATH, import_node_fs25.constants.F_OK);
221283
+ await (0, import_promises26.access)(DEVIN_LOCAL_PATH, import_node_fs25.constants.F_OK);
221284
221284
  return { isAgent: true, agent: { name: DEVIN } };
221285
221285
  } catch (error48) {}
221286
221286
  return { isAgent: false, agent: undefined };
@@ -247823,10 +247823,8 @@ async function* readLines(body) {
247823
247823
  try {
247824
247824
  while (true) {
247825
247825
  const result = await readOrSilence(reader);
247826
- if (result === "silence") {
247827
- await reader.cancel();
247826
+ if (result === "silence")
247828
247827
  return;
247829
- }
247830
247828
  if (result.done || !result.value)
247831
247829
  return;
247832
247830
  buffered += decoder.decode(result.value, { stream: true });
@@ -247836,7 +247834,7 @@ async function* readLines(body) {
247836
247834
  yield* lines;
247837
247835
  }
247838
247836
  } finally {
247839
- reader.releaseLock();
247837
+ await reader.cancel().catch(() => {});
247840
247838
  }
247841
247839
  }
247842
247840
  async function* readStreamEvents(body) {
@@ -247864,17 +247862,16 @@ async function* readStreamEvents(body) {
247864
247862
  var STREAM_CONNECT_TIMEOUT_MS = 1e4;
247865
247863
  var isWorthReconnecting = (status) => status >= 500;
247866
247864
  async function openLogStream(filters) {
247865
+ const url2 = buildStreamUrl(filters);
247866
+ const headers = {
247867
+ Accept: "text/event-stream",
247868
+ ...await buildStreamAuthHeaders()
247869
+ };
247867
247870
  const connectPhase = new AbortController;
247868
247871
  const connectTimer = setTimeout(() => connectPhase.abort(), STREAM_CONNECT_TIMEOUT_MS);
247869
247872
  let response;
247870
247873
  try {
247871
- response = await fetch(buildStreamUrl(filters), {
247872
- headers: {
247873
- Accept: "text/event-stream",
247874
- ...await buildStreamAuthHeaders()
247875
- },
247876
- signal: connectPhase.signal
247877
- });
247874
+ response = await fetch(url2, { headers, signal: connectPhase.signal });
247878
247875
  } catch {
247879
247876
  return { kind: "transient" };
247880
247877
  } finally {
@@ -248062,7 +248059,7 @@ import { join as join12 } from "node:path";
248062
248059
  // package.json
248063
248060
  var package_default = {
248064
248061
  name: "base44",
248065
- version: "0.1.12",
248062
+ version: "0.1.13",
248066
248063
  description: "Base44 CLI - Unified interface for managing Base44 applications",
248067
248064
  type: "module",
248068
248065
  bin: {
@@ -258413,6 +258410,7 @@ function getLinkCommand() {
258413
258410
  }
258414
258411
 
258415
258412
  // src/cli/commands/project/logs.ts
258413
+ import { setTimeout as delay2 } from "node:timers/promises";
258416
258414
  function parseFunctionFilters(options) {
258417
258415
  const filters = {};
258418
258416
  if (options.since) {
@@ -258473,7 +258471,6 @@ function writeFollowLine(entry, jsonMode) {
258473
258471
  process.stdout.write(`${line}
258474
258472
  `);
258475
258473
  }
258476
- var delay2 = (ms2) => new Promise((resolve9) => setTimeout(resolve9, ms2));
258477
258474
  function streamEventToLogEntry(event) {
258478
258475
  return {
258479
258476
  time: event.time,
@@ -258501,46 +258498,42 @@ async function printStreamUntilEnd(stream, levelFilter, jsonMode, startTime) {
258501
258498
  } catch {}
258502
258499
  return { lastTime, provedAlive, end: null };
258503
258500
  }
258504
- var RECONNECT_DELAYS_MS = [1000, 2000, 4000, 8000];
258505
- var ONE_STRIKE_FOR_A_STREAM_THAT_WORKED = 1;
258506
- var strikesAfter = (ending, strikes) => {
258507
- if (ending.end)
258508
- return 0;
258509
- return ending.provedAlive ? ONE_STRIKE_FOR_A_STREAM_THAT_WORKED : strikes + 1;
258510
- };
258511
- var hasRunOutOfStrikes = (strikes) => strikes >= RECONNECT_DELAYS_MS.length;
258512
- async function connectWithinStrikes(filters, strikes) {
258513
- let spent = strikes;
258501
+ var STREAM_RECONNECT_DELAY_MS = 1000;
258502
+ var MAX_DROPS_SINCE_LAST_EVENT = 2;
258503
+ var CONNECT_RETRY_DELAYS_MS = [1000, 2000, 4000, 8000];
258504
+ var countDropTowardGivingUp = (dropsSinceLastEvent, provedAlive) => provedAlive ? 1 : dropsSinceLastEvent + 1;
258505
+ var shouldGiveUpStreaming = (dropsSinceLastEvent) => dropsSinceLastEvent >= MAX_DROPS_SINCE_LAST_EVENT;
258506
+ async function connectWhileTransientlyUnavailable(filters) {
258514
258507
  let attempt = await openLogStream(filters);
258515
- while (attempt.kind === "transient") {
258516
- spent += 1;
258517
- if (hasRunOutOfStrikes(spent))
258518
- return { kind: "exhausted" };
258519
- await delay2(RECONNECT_DELAYS_MS[spent - 1]);
258508
+ for (const retryDelay of CONNECT_RETRY_DELAYS_MS) {
258509
+ if (attempt.kind !== "transient")
258510
+ return attempt;
258511
+ await delay2(retryDelay);
258520
258512
  attempt = await openLogStream(filters);
258521
258513
  }
258522
- if (attempt.kind === "refused")
258523
- return { kind: "refused" };
258524
- return { kind: "stream", events: attempt.events, strikes: spent };
258514
+ return attempt;
258525
258515
  }
258526
258516
  async function streamUntilExhausted(firstStream, filters, options, jsonMode) {
258527
258517
  let events = firstStream;
258528
258518
  let lastTime = "";
258529
- let strikes = 0;
258519
+ let dropsSinceLastEvent = 0;
258530
258520
  while (true) {
258531
258521
  const ending = await printStreamUntilEnd(events, options.level, jsonMode, lastTime);
258532
258522
  lastTime = ending.lastTime;
258533
- if (ending.end && !ending.end.retriable)
258534
- return;
258535
- strikes = strikesAfter(ending, strikes);
258536
- if (hasRunOutOfStrikes(strikes))
258537
- return;
258538
- await delay2(RECONNECT_DELAYS_MS[strikes]);
258539
- const reconnected = await connectWithinStrikes(filters, strikes);
258540
- if (reconnected.kind !== "stream")
258523
+ if (ending.end) {
258524
+ if (!ending.end.retriable)
258525
+ return;
258526
+ dropsSinceLastEvent = 0;
258527
+ } else {
258528
+ dropsSinceLastEvent = countDropTowardGivingUp(dropsSinceLastEvent, ending.provedAlive);
258529
+ if (shouldGiveUpStreaming(dropsSinceLastEvent))
258530
+ return;
258531
+ }
258532
+ await delay2(STREAM_RECONNECT_DELAY_MS);
258533
+ const reopened = await connectWhileTransientlyUnavailable(filters);
258534
+ if (reopened.kind !== "stream")
258541
258535
  return;
258542
- events = reconnected.events;
258543
- strikes = reconnected.strikes;
258536
+ events = reopened.events;
258544
258537
  }
258545
258538
  }
258546
258539
  function streamLostError() {
@@ -258559,7 +258552,14 @@ async function followLogs(functionNames, options, availableFunctionNames, jsonMo
258559
258552
  functions: parseFunctionNames(options.function),
258560
258553
  env: options.env
258561
258554
  };
258562
- const opened = await connectWithinStrikes(filters, 0);
258555
+ if (options.since) {
258556
+ logger2.warn("--since reads the past, so this run polls instead of streaming (lines may lag ~20-30s).");
258557
+ return pollLogs(functionNames, options, availableFunctionNames, jsonMode, {
258558
+ lastTime: "",
258559
+ boundaryKeys: new Set
258560
+ });
258561
+ }
258562
+ const opened = await connectWhileTransientlyUnavailable(filters);
258563
258563
  if (opened.kind !== "stream") {
258564
258564
  logger2.warn(opened.kind === "refused" ? "Realtime logs are not available for this app — falling back to polling (lines may lag ~20-30s)." : "Could not reach the realtime log stream — falling back to polling (lines may lag ~20-30s).");
258565
258565
  return pollLogs(functionNames, options, availableFunctionNames, jsonMode, {
@@ -258674,9 +258674,6 @@ async function logsAction(ctx, options) {
258674
258674
  return { outroMessage: "No functions found in this app." };
258675
258675
  }
258676
258676
  if (options.follow) {
258677
- if (options.since) {
258678
- throw new InvalidInputError("--since cannot be combined with --follow yet (the realtime stream starts from now).");
258679
- }
258680
258677
  if (options.until) {
258681
258678
  throw new InvalidInputError("--until cannot be combined with --follow (a stream has no end).");
258682
258679
  }
@@ -268333,4 +268330,4 @@ export {
268333
268330
  runCLI
268334
268331
  };
268335
268332
 
268336
- //# debugId=F798B29EB4A3A54F64756E2164756E21
268333
+ //# debugId=80FBE85BCE476A3564756E2164756E21