@base44-preview/cli 0.2.3-pr.682.9217d4b → 0.2.5-pr.683.39ac9ac

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
@@ -121436,7 +121436,7 @@ function getDataProtocolModuleFormat(parsed) {
121436
121436
  const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [null, null, null];
121437
121437
  return mimeToFormat(mime);
121438
121438
  }
121439
- function extname2(url3) {
121439
+ function extname3(url3) {
121440
121440
  const pathname = url3.pathname;
121441
121441
  let index = pathname.length;
121442
121442
  while (index--) {
@@ -121451,7 +121451,7 @@ function extname2(url3) {
121451
121451
  return "";
121452
121452
  }
121453
121453
  function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
121454
- const value = extname2(url3);
121454
+ const value = extname3(url3);
121455
121455
  if (value === ".js") {
121456
121456
  const packageType = getPackageType(url3);
121457
121457
  if (packageType !== "none") {
@@ -239384,7 +239384,7 @@ import { join as join13 } from "node:path";
239384
239384
  // package.json
239385
239385
  var package_default = {
239386
239386
  name: "base44",
239387
- version: "0.2.3",
239387
+ version: "0.2.5",
239388
239388
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239389
239389
  type: "module",
239390
239390
  bin: {
@@ -265009,7 +265009,7 @@ var import_ms2 = __toESM(require_ms(), 1);
265009
265009
 
265010
265010
  // src/core/session-import/api.ts
265011
265011
  import { randomUUID as randomUUID5 } from "node:crypto";
265012
- var MAX_SESSION_BYTES = 25 * 1024 * 1024;
265012
+ var MAX_SESSION_BYTES = 50 * 1024 * 1024;
265013
265013
  var SessionImportResponseSchema = object({
265014
265014
  branch_id: string2(),
265015
265015
  branch_name: string2(),
@@ -265053,7 +265053,7 @@ function messageFor(status, code, details, viaToken) {
265053
265053
  if (status === 404)
265054
265054
  return "Session import isn't available for this app.";
265055
265055
  if (status === 413)
265056
- return "This session is over 25 MB and can't be imported.";
265056
+ return "This session is over 50 MB and can't be imported.";
265057
265057
  if (code === "unsupported_file") {
265058
265058
  return "That file isn't a Claude Code or Codex session.";
265059
265059
  }
@@ -265114,9 +265114,140 @@ async function uploadSession(appId, content, { token, sourceBranch } = {}) {
265114
265114
  return result.data;
265115
265115
  }
265116
265116
 
265117
+ // src/core/session-import/images.ts
265118
+ import { stat as stat4 } from "node:fs/promises";
265119
+ import { extname as extname2 } from "node:path";
265120
+ var MEDIA_TYPES = {
265121
+ ".png": "image/png",
265122
+ ".jpg": "image/jpeg",
265123
+ ".jpeg": "image/jpeg",
265124
+ ".gif": "image/gif",
265125
+ ".webp": "image/webp"
265126
+ };
265127
+ var MAX_ATTACHED_IMAGES = 20;
265128
+ var MAX_ATTACHED_IMAGE_BYTES = 10 * 1024 * 1024;
265129
+ var IMAGE_PATH = /(?:\/|[A-Za-z]:\\)[^\s"'`<>()]+\.(?:png|jpe?g|gif|webp)\b/gi;
265130
+ var asRecord = (value) => value && typeof value === "object" ? value : {};
265131
+ var isImage = (value) => ["image", "input_image"].includes(String(asRecord(value).type));
265132
+ function withoutImages(value) {
265133
+ if (Array.isArray(value)) {
265134
+ return value.filter((item) => !isImage(item)).map(withoutImages);
265135
+ }
265136
+ if (value && typeof value === "object") {
265137
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, withoutImages(item)]));
265138
+ }
265139
+ return value;
265140
+ }
265141
+ function strings(value) {
265142
+ if (typeof value === "string")
265143
+ return [value];
265144
+ if (Array.isArray(value))
265145
+ return value.flatMap(strings);
265146
+ if (value && typeof value === "object") {
265147
+ return Object.values(value).flatMap(strings);
265148
+ }
265149
+ return [];
265150
+ }
265151
+ var payloadOf = (entry) => asRecord(entry.payload);
265152
+ var messageOf = (entry) => asRecord(entry.message);
265153
+ function isTypedUserMessage(entry) {
265154
+ if (entry.type === "user") {
265155
+ if (entry.isMeta || entry.isSidechain)
265156
+ return false;
265157
+ const content = asRecord(entry.message).content;
265158
+ return typeof content === "string" || Array.isArray(content) && !content.some((block) => asRecord(block).type === "tool_result");
265159
+ }
265160
+ const payload = asRecord(entry.payload);
265161
+ return entry.type === "response_item" && payload.type === "message" && payload.role === "user";
265162
+ }
265163
+ function toolInputs(entries) {
265164
+ return entries.flatMap((entry) => {
265165
+ const payload = asRecord(entry.payload);
265166
+ if (entry.type === "response_item") {
265167
+ return String(payload.type).endsWith("_call") ? strings([payload.input, payload.arguments]) : [];
265168
+ }
265169
+ const content = messageOf(entry).content;
265170
+ return (Array.isArray(content) ? content : []).filter((block) => asRecord(block).type === "tool_use").flatMap((block) => strings(asRecord(block).input));
265171
+ }).join(`
265172
+ `);
265173
+ }
265174
+ async function imageBlock(path, codex) {
265175
+ const mediaType = MEDIA_TYPES[extname2(path).toLowerCase()];
265176
+ const size = await stat4(path).then((info) => info.isFile() ? info.size : 0, () => 0);
265177
+ if (!mediaType || !size || size > MAX_ATTACHED_IMAGE_BYTES)
265178
+ return;
265179
+ const data = (await readFile(path)).toString("base64");
265180
+ return codex ? { type: "input_image", image_url: `data:${mediaType};base64,${data}` } : {
265181
+ type: "image",
265182
+ source: { type: "base64", media_type: mediaType, data }
265183
+ };
265184
+ }
265185
+ async function prepareSessionImages(content) {
265186
+ const lines = Buffer.from(content).toString("utf8").split(`
265187
+ `);
265188
+ const entries = lines.map((line) => {
265189
+ try {
265190
+ const entry = JSON.parse(line);
265191
+ return entry && typeof entry === "object" ? entry : undefined;
265192
+ } catch {
265193
+ return;
265194
+ }
265195
+ });
265196
+ const changed = new Set;
265197
+ entries.forEach((entry, i) => {
265198
+ if (!entry || !lines[i]?.includes("image"))
265199
+ return;
265200
+ const message = messageOf(entry);
265201
+ if (entry.type === "user" && Array.isArray(message.content) && message.content.some((block) => asRecord(block).type === "tool_result")) {
265202
+ const content = message.content.map((block) => asRecord(block).type === "tool_result" ? withoutImages(block) : block);
265203
+ const { toolUseResult: _, ...rest } = entry;
265204
+ entries[i] = { ...rest, message: { ...message, content } };
265205
+ changed.add(i);
265206
+ } else if (entry.type === "response_item" && String(asRecord(entry.payload).type).endsWith("_output")) {
265207
+ entries[i] = { ...entry, payload: withoutImages(entry.payload) };
265208
+ changed.add(i);
265209
+ }
265210
+ });
265211
+ const opened = toolInputs(entries.filter((entry) => !!entry));
265212
+ let budget = MAX_ATTACHED_IMAGES;
265213
+ for (let i = entries.length - 1;i >= 0 && budget > 0; i--) {
265214
+ const entry = entries[i];
265215
+ if (!entry || !isTypedUserMessage(entry))
265216
+ continue;
265217
+ const codex = entry.type === "response_item";
265218
+ const raw = codex ? payloadOf(entry).content : messageOf(entry).content;
265219
+ const blocks = typeof raw === "string" ? [{ type: "text", text: raw }] : Array.isArray(raw) ? [...raw] : [];
265220
+ const paths = new Set(strings(blocks.filter((block) => !isImage(block))).flatMap((text) => text.match(IMAGE_PATH) ?? []));
265221
+ const added = [];
265222
+ for (const path of paths) {
265223
+ if (budget === 0 || !opened.includes(path))
265224
+ continue;
265225
+ const block = await imageBlock(path, codex);
265226
+ if (block) {
265227
+ added.push(block);
265228
+ budget--;
265229
+ }
265230
+ }
265231
+ if (!added.length)
265232
+ continue;
265233
+ entries[i] = codex ? {
265234
+ ...entry,
265235
+ payload: { ...payloadOf(entry), content: [...blocks, ...added] }
265236
+ } : {
265237
+ ...entry,
265238
+ message: { ...messageOf(entry), content: [...blocks, ...added] }
265239
+ };
265240
+ changed.add(i);
265241
+ }
265242
+ if (!changed.size)
265243
+ return content;
265244
+ return Buffer.from(lines.map((line, i) => changed.has(i) ? JSON.stringify(entries[i]) : line).join(`
265245
+ `));
265246
+ }
265247
+
265117
265248
  // src/core/session-import/sessions.ts
265118
265249
  import { createReadStream as createReadStream3 } from "node:fs";
265119
- import { realpath, rm as rm3, stat as stat4 } from "node:fs/promises";
265250
+ import { realpath, rm as rm3, stat as stat5 } from "node:fs/promises";
265120
265251
  import { homedir as homedir4 } from "node:os";
265121
265252
  import { dirname as dirname23, join as join31 } from "node:path";
265122
265253
  import { createInterface as createInterface2 } from "node:readline";
@@ -265151,12 +265282,12 @@ async function scanLines(path, pick, maxLines = Number.POSITIVE_INFINITY) {
265151
265282
  }
265152
265283
  return;
265153
265284
  }
265154
- var asRecord = (value) => value && typeof value === "object" ? value : {};
265155
- var codexCwd = (entry) => entry.type === "session_meta" ? String(asRecord(entry.payload).cwd ?? "") : undefined;
265285
+ var asRecord2 = (value) => value && typeof value === "object" ? value : {};
265286
+ var codexCwd = (entry) => entry.type === "session_meta" ? String(asRecord2(entry.payload).cwd ?? "") : undefined;
265156
265287
  async function newest(paths) {
265157
265288
  let best;
265158
265289
  for (const path of paths) {
265159
- const { mtimeMs } = await stat4(path);
265290
+ const { mtimeMs } = await stat5(path);
265160
265291
  if (!best || mtimeMs > best.mtime)
265161
265292
  best = { path, mtime: mtimeMs };
265162
265293
  }
@@ -265207,11 +265338,11 @@ async function findCurrentSession(cwd) {
265207
265338
  function claudeUserText(entry) {
265208
265339
  if (entry.type !== "user" || entry.isMeta || entry.isSidechain)
265209
265340
  return;
265210
- const content = asRecord(entry.message).content;
265341
+ const content = asRecord2(entry.message).content;
265211
265342
  return typeof content === "string" && !content.startsWith("<") ? content : undefined;
265212
265343
  }
265213
265344
  function codexUserText(entry) {
265214
- const payload = asRecord(entry.payload);
265345
+ const payload = asRecord2(entry.payload);
265215
265346
  return entry.type === "event_msg" && payload.type === "user_message" ? String(payload.message ?? "") : undefined;
265216
265347
  }
265217
265348
  var PICKER_LIMIT = 20;
@@ -265230,7 +265361,7 @@ async function listSessions(cwd) {
265230
265361
  ];
265231
265362
  const dated = await Promise.all(candidates.map(async (c) => ({
265232
265363
  ...c,
265233
- updatedAt: (await stat4(c.path)).mtime
265364
+ updatedAt: (await stat5(c.path)).mtime
265234
265365
  })));
265235
265366
  dated.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
265236
265367
  const sessions = [];
@@ -265252,7 +265383,7 @@ var TELEPORT_PROMPT = "Reply with OK.";
265252
265383
  var TELEPORT_NOTE = "This session is being continued from another machine";
265253
265384
  function parseLine(line) {
265254
265385
  try {
265255
- return asRecord(JSON.parse(line));
265386
+ return asRecord2(JSON.parse(line));
265256
265387
  } catch {
265257
265388
  return {};
265258
265389
  }
@@ -265261,7 +265392,7 @@ function stripTeleportExchange(content) {
265261
265392
  const lines = content.split(`
265262
265393
  `);
265263
265394
  const entries = lines.map(parseLine);
265264
- const userText = (entry) => entry.type === "user" ? asRecord(entry.message).content : undefined;
265395
+ const userText = (entry) => entry.type === "user" ? asRecord2(entry.message).content : undefined;
265265
265396
  let end = lines.length;
265266
265397
  for (let i = lines.length - 1;i >= 0; i--) {
265267
265398
  if (userText(entries[i] ?? {}) === TELEPORT_PROMPT) {
@@ -265308,7 +265439,7 @@ async function teleportSession(sessionId, cwd) {
265308
265439
  cwd: claudeDir(),
265309
265440
  absolute: true
265310
265441
  })) {
265311
- if ((await stat4(path)).mtimeMs < startedAt)
265442
+ if ((await stat5(path)).mtimeMs < startedAt)
265312
265443
  continue;
265313
265444
  const sessionCwd = await scanLines(path, (entry) => typeof entry.cwd === "string" ? entry.cwd : undefined, 50);
265314
265445
  if (sessionCwd === repo || sessionCwd === repoReal)
@@ -265387,9 +265518,9 @@ async function importAction(ctx, link, options, command) {
265387
265518
  throw new InvalidInputError("Pass only one of: a session link, --current, or --file.");
265388
265519
  }
265389
265520
  const appId = requireApp(ctx).id;
265390
- const content = await readSession(ctx, link, options);
265521
+ const content = await prepareSessionImages(await readSession(ctx, link, options));
265391
265522
  if (content.length > MAX_SESSION_BYTES) {
265392
- throw new InvalidInputError("This session is over 25 MB and can't be imported.", { hints: [] });
265523
+ throw new InvalidInputError("This session is over 50 MB and can't be imported.", { hints: [] });
265393
265524
  }
265394
265525
  const git = link || options.file ? undefined : await readGitState(process.cwd());
265395
265526
  if (git?.unpushed && !options.skipPushCheck) {
@@ -268286,11 +268417,11 @@ import { relative as relative11 } from "node:path";
268286
268417
  // ../../node_modules/chokidar/index.js
268287
268418
  import { EventEmitter as EventEmitter3 } from "node:events";
268288
268419
  import { stat as statcb, Stats } from "node:fs";
268289
- import { readdir as readdir3, stat as stat8 } from "node:fs/promises";
268420
+ import { readdir as readdir3, stat as stat9 } from "node:fs/promises";
268290
268421
  import * as sp3 from "node:path";
268291
268422
 
268292
268423
  // ../../node_modules/readdirp/index.js
268293
- import { lstat as lstat2, readdir as readdir2, realpath as realpath2, stat as stat6 } from "node:fs/promises";
268424
+ import { lstat as lstat2, readdir as readdir2, realpath as realpath2, stat as stat7 } from "node:fs/promises";
268294
268425
  import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
268295
268426
  import { Readable as Readable6 } from "node:stream";
268296
268427
  var EntryTypes = {
@@ -268372,7 +268503,7 @@ class ReaddirpStream extends Readable6 {
268372
268503
  const { root, type } = opts;
268373
268504
  this._fileFilter = normalizeFilter(opts.fileFilter);
268374
268505
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
268375
- const statMethod = opts.lstat ? lstat2 : stat6;
268506
+ const statMethod = opts.lstat ? lstat2 : stat7;
268376
268507
  if (wantBigintFsStats) {
268377
268508
  this._stat = (path) => statMethod(path, { bigint: true });
268378
268509
  } else {
@@ -268525,7 +268656,7 @@ function readdirp(root, options = {}) {
268525
268656
 
268526
268657
  // ../../node_modules/chokidar/handler.js
268527
268658
  import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
268528
- import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat7 } from "node:fs/promises";
268659
+ import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat8 } from "node:fs/promises";
268529
268660
  import { type as osType } from "node:os";
268530
268661
  import * as sp2 from "node:path";
268531
268662
  var STR_DATA = "data";
@@ -268551,7 +268682,7 @@ var EVENTS = {
268551
268682
  };
268552
268683
  var EV = EVENTS;
268553
268684
  var THROTTLE_MODE_WATCH = "watch";
268554
- var statMethods = { lstat: lstat3, stat: stat7 };
268685
+ var statMethods = { lstat: lstat3, stat: stat8 };
268555
268686
  var KEY_LISTENERS = "listeners";
268556
268687
  var KEY_ERR = "errHandlers";
268557
268688
  var KEY_RAW = "rawEmitters";
@@ -269022,7 +269153,7 @@ class NodeFsHandler {
269022
269153
  return;
269023
269154
  if (!newStats || newStats.mtimeMs === 0) {
269024
269155
  try {
269025
- const newStats = await stat7(file);
269156
+ const newStats = await stat8(file);
269026
269157
  if (this.fsw.closed)
269027
269158
  return;
269028
269159
  const at = newStats.atimeMs;
@@ -269694,7 +269825,7 @@ class FSWatcher extends EventEmitter3 {
269694
269825
  const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
269695
269826
  let stats;
269696
269827
  try {
269697
- stats = await stat8(fullPath);
269828
+ stats = await stat9(fullPath);
269698
269829
  } catch (err) {}
269699
269830
  if (!stats || this.closed)
269700
269831
  return;
@@ -274649,4 +274780,4 @@ export {
274649
274780
  runCLI
274650
274781
  };
274651
274782
 
274652
- //# debugId=B7C73C57031F826A64756E2164756E21
274783
+ //# debugId=1132327F7ACDA97664756E2164756E21