@base44-preview/cli 0.2.6-pr.685.636d588 → 0.2.6-pr.686.434aab7
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 +235 -55
- package/dist/cli/index.js.map +8 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -121158,7 +121158,7 @@ function parse42(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
|
|
|
121158
121158
|
}
|
|
121159
121159
|
return res;
|
|
121160
121160
|
}
|
|
121161
|
-
async function
|
|
121161
|
+
async function readFile6(file) {
|
|
121162
121162
|
if (isUrlString(file)) {
|
|
121163
121163
|
file = new URL(file);
|
|
121164
121164
|
}
|
|
@@ -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
|
|
121439
|
+
function extname4(url3) {
|
|
121440
121440
|
const pathname = url3.pathname;
|
|
121441
121441
|
let index = pathname.length;
|
|
121442
121442
|
while (index--) {
|
|
@@ -121451,7 +121451,7 @@ function extname3(url3) {
|
|
|
121451
121451
|
return "";
|
|
121452
121452
|
}
|
|
121453
121453
|
function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
|
|
121454
|
-
const value =
|
|
121454
|
+
const value = extname4(url3);
|
|
121455
121455
|
if (value === ".js") {
|
|
121456
121456
|
const packageType = getPackageType(url3);
|
|
121457
121457
|
if (packageType !== "none") {
|
|
@@ -134952,7 +134952,7 @@ ${codeblock}`, options8);
|
|
|
134952
134952
|
"\\": "\\"
|
|
134953
134953
|
};
|
|
134954
134954
|
KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
134955
|
-
read_file_default =
|
|
134955
|
+
read_file_default = readFile6;
|
|
134956
134956
|
loadConfigFromPackageJson = process.versions.bun ? async function loadConfigFromBunPackageJson(file) {
|
|
134957
134957
|
const { prettier } = await readBunPackageJson(file);
|
|
134958
134958
|
return prettier;
|
|
@@ -238778,11 +238778,8 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
238778
238778
|
}
|
|
238779
238779
|
// src/core/resources/function/config.ts
|
|
238780
238780
|
import { basename as basename4, dirname as dirname8, join as join10, relative as relative3, resolve as resolve2 } from "node:path";
|
|
238781
|
-
function getSharedDir(functionsDir) {
|
|
238782
|
-
return resolve2(functionsDir, "..", "shared");
|
|
238783
|
-
}
|
|
238784
238781
|
async function readSharedFiles(functionsDir) {
|
|
238785
|
-
const sharedDir =
|
|
238782
|
+
const sharedDir = resolve2(functionsDir, "..", "shared");
|
|
238786
238783
|
if (!await pathExists(sharedDir)) {
|
|
238787
238784
|
return [];
|
|
238788
238785
|
}
|
|
@@ -265021,7 +265018,9 @@ var SessionImportResponseSchema = object({
|
|
|
265021
265018
|
branch_url: string2(),
|
|
265022
265019
|
continued: boolean2(),
|
|
265023
265020
|
source_ref: string2(),
|
|
265024
|
-
reimported: boolean2().default(false)
|
|
265021
|
+
reimported: boolean2().default(false),
|
|
265022
|
+
imported_artifacts: number2().default(0),
|
|
265023
|
+
skipped_artifacts: number2().default(0)
|
|
265025
265024
|
}).transform((data) => ({
|
|
265026
265025
|
branchId: data.branch_id,
|
|
265027
265026
|
branchName: data.branch_name,
|
|
@@ -265030,7 +265029,9 @@ var SessionImportResponseSchema = object({
|
|
|
265030
265029
|
branchUrl: data.branch_url,
|
|
265031
265030
|
continued: data.continued,
|
|
265032
265031
|
sourceRef: data.source_ref,
|
|
265033
|
-
reimported: data.reimported
|
|
265032
|
+
reimported: data.reimported,
|
|
265033
|
+
importedArtifacts: data.imported_artifacts,
|
|
265034
|
+
skippedArtifacts: data.skipped_artifacts
|
|
265034
265035
|
}));
|
|
265035
265036
|
var ErrorEnvelopeSchema = object({
|
|
265036
265037
|
error: object({
|
|
@@ -265094,11 +265095,24 @@ async function toImportError(error, viaToken) {
|
|
|
265094
265095
|
hints: known ? [] : fallback.hints
|
|
265095
265096
|
});
|
|
265096
265097
|
}
|
|
265097
|
-
async function uploadSession(appId, content, {
|
|
265098
|
+
async function uploadSession(appId, content, {
|
|
265099
|
+
token,
|
|
265100
|
+
sourceBranch,
|
|
265101
|
+
artifacts = []
|
|
265102
|
+
} = {}) {
|
|
265098
265103
|
const form = new FormData;
|
|
265099
265104
|
form.append("file", new Blob([content]), "session.jsonl");
|
|
265100
265105
|
if (sourceBranch)
|
|
265101
265106
|
form.append("source_branch", sourceBranch);
|
|
265107
|
+
for (const { data, fileName } of artifacts) {
|
|
265108
|
+
form.append("artifacts", new Blob([data]), fileName);
|
|
265109
|
+
}
|
|
265110
|
+
if (artifacts.length) {
|
|
265111
|
+
form.append("artifact_manifest", JSON.stringify(artifacts.map((a) => ({
|
|
265112
|
+
tool_use_id: a.toolUseId,
|
|
265113
|
+
file_name: a.fileName
|
|
265114
|
+
}))));
|
|
265115
|
+
}
|
|
265102
265116
|
const idempotencyKey = randomUUID5();
|
|
265103
265117
|
let response;
|
|
265104
265118
|
try {
|
|
@@ -265125,9 +265139,160 @@ async function uploadSession(appId, content, { token, sourceBranch } = {}) {
|
|
|
265125
265139
|
return result.data;
|
|
265126
265140
|
}
|
|
265127
265141
|
|
|
265142
|
+
// src/core/session-import/artifacts.ts
|
|
265143
|
+
import { readFile as readFile5, stat as stat4 } from "node:fs/promises";
|
|
265144
|
+
import { basename as basename9, extname as extname2, resolve as resolve16 } from "node:path";
|
|
265145
|
+
var ALLOWED = new Set("html htm pdf png jpg jpeg gif webp txt md csv json".split(" "));
|
|
265146
|
+
var IMAGE_TYPES = {
|
|
265147
|
+
".png": "image/png",
|
|
265148
|
+
".jpg": "image/jpeg",
|
|
265149
|
+
".jpeg": "image/jpeg",
|
|
265150
|
+
".gif": "image/gif",
|
|
265151
|
+
".webp": "image/webp"
|
|
265152
|
+
};
|
|
265153
|
+
var MAX_FILES = 10;
|
|
265154
|
+
var MAX_BYTES = 10 * 1024 * 1024;
|
|
265155
|
+
var MAX_REQUEST_BYTES = 95 * 1024 * 1024;
|
|
265156
|
+
var MULTIPART_MARGIN = 1024 * 1024;
|
|
265157
|
+
var OPENS_FILE = /open_in_codex\(\s*\{\s*["']?target["']?\s*:\s*\{([^}]*)\}/g;
|
|
265158
|
+
var FILE_TARGET = /["']?type["']?\s*:\s*["']file["']/;
|
|
265159
|
+
var TARGET_PATH = /(?:^|[\s,])["']?path["']?\s*:\s*(["'])((?:\\.|(?!\1).)*)\1/;
|
|
265160
|
+
var IMG_SRC = /(<img\b[^>]*?\bsrc\s*=\s*)(["'])(.*?)\2/gi;
|
|
265161
|
+
var asRecord = (value) => value && typeof value === "object" ? value : {};
|
|
265162
|
+
function toolUses(entry) {
|
|
265163
|
+
const content = asRecord(entry.message).content;
|
|
265164
|
+
return (Array.isArray(content) ? content : []).map(asRecord).filter((block) => block.type === "tool_use");
|
|
265165
|
+
}
|
|
265166
|
+
function findArtifacts(entries) {
|
|
265167
|
+
const found = [];
|
|
265168
|
+
for (const entry of entries) {
|
|
265169
|
+
const cwd = typeof entry.cwd === "string" ? entry.cwd : "";
|
|
265170
|
+
if (entry.type === "assistant" && !entry.isSidechain) {
|
|
265171
|
+
for (const block of toolUses(entry)) {
|
|
265172
|
+
const input = asRecord(block.input);
|
|
265173
|
+
if (block.name === "Artifact" && typeof block.id === "string" && typeof input.file_path === "string" && (input.action ?? "publish") === "publish" && !input.asset && !input.type_url) {
|
|
265174
|
+
const files = Object.fromEntries(Object.entries(asRecord(input.files)).filter(([, local]) => typeof local === "string").map(([key, local]) => [key, resolve16(cwd, local)]));
|
|
265175
|
+
found.push({
|
|
265176
|
+
toolUseId: block.id,
|
|
265177
|
+
path: input.file_path,
|
|
265178
|
+
claude: true,
|
|
265179
|
+
files
|
|
265180
|
+
});
|
|
265181
|
+
}
|
|
265182
|
+
}
|
|
265183
|
+
}
|
|
265184
|
+
const payload = asRecord(entry.payload);
|
|
265185
|
+
if (entry.type === "response_item" && payload.type === "custom_tool_call" && payload.name === "exec" && typeof payload.input === "string" && typeof payload.call_id === "string") {
|
|
265186
|
+
for (const [, target = ""] of payload.input.matchAll(OPENS_FILE)) {
|
|
265187
|
+
if (!FILE_TARGET.test(target))
|
|
265188
|
+
continue;
|
|
265189
|
+
const path = TARGET_PATH.exec(target)?.[2]?.replace(/\\(.)/g, "$1");
|
|
265190
|
+
if (path)
|
|
265191
|
+
found.push({ toolUseId: payload.call_id, path, claude: false });
|
|
265192
|
+
}
|
|
265193
|
+
}
|
|
265194
|
+
}
|
|
265195
|
+
return found;
|
|
265196
|
+
}
|
|
265197
|
+
function lastCleanWrite(entries, path) {
|
|
265198
|
+
let content;
|
|
265199
|
+
for (const entry of entries) {
|
|
265200
|
+
for (const block of toolUses(entry)) {
|
|
265201
|
+
const input = asRecord(block.input);
|
|
265202
|
+
if (input.file_path !== path)
|
|
265203
|
+
continue;
|
|
265204
|
+
if (block.name === "Write" && typeof input.content === "string") {
|
|
265205
|
+
content = input.content;
|
|
265206
|
+
} else if (block.name === "Edit" || block.name === "MultiEdit") {
|
|
265207
|
+
content = undefined;
|
|
265208
|
+
}
|
|
265209
|
+
}
|
|
265210
|
+
}
|
|
265211
|
+
return content === undefined ? undefined : Buffer.from(content);
|
|
265212
|
+
}
|
|
265213
|
+
var readRegularFile = (path) => stat4(path).then((info) => info.isFile() ? readFile5(path) : undefined, () => {
|
|
265214
|
+
return;
|
|
265215
|
+
});
|
|
265216
|
+
async function inlineImages(html, files, missing) {
|
|
265217
|
+
const text = html.toString("utf8");
|
|
265218
|
+
const uris = new Map;
|
|
265219
|
+
for (const [, , , src = ""] of text.matchAll(IMG_SRC)) {
|
|
265220
|
+
const local = files[src];
|
|
265221
|
+
const mediaType = local && IMAGE_TYPES[extname2(local).toLowerCase()];
|
|
265222
|
+
const data = mediaType && await readRegularFile(local);
|
|
265223
|
+
if (data)
|
|
265224
|
+
uris.set(src, `data:${mediaType};base64,${data.toString("base64")}`);
|
|
265225
|
+
else if (local)
|
|
265226
|
+
missing.push(src);
|
|
265227
|
+
}
|
|
265228
|
+
if (!uris.size)
|
|
265229
|
+
return html;
|
|
265230
|
+
return Buffer.from(text.replace(IMG_SRC, (match, prefix, quote, src) => {
|
|
265231
|
+
const uri = uris.get(src);
|
|
265232
|
+
return uri ? `${prefix}${quote}${uri}${quote}` : match;
|
|
265233
|
+
}));
|
|
265234
|
+
}
|
|
265235
|
+
async function collectArtifacts2(session, budget = MAX_REQUEST_BYTES - session.length - MULTIPART_MARGIN) {
|
|
265236
|
+
const entries = Buffer.from(session).toString("utf8").split(`
|
|
265237
|
+
`).map((line) => {
|
|
265238
|
+
try {
|
|
265239
|
+
return asRecord(JSON.parse(line));
|
|
265240
|
+
} catch {
|
|
265241
|
+
return {};
|
|
265242
|
+
}
|
|
265243
|
+
});
|
|
265244
|
+
const byPath = new Map;
|
|
265245
|
+
for (const found of findArtifacts(entries)) {
|
|
265246
|
+
byPath.delete(found.path);
|
|
265247
|
+
byPath.set(found.path, found);
|
|
265248
|
+
}
|
|
265249
|
+
const newest = [...byPath.values()];
|
|
265250
|
+
const skipped = newest.slice(0, -MAX_FILES).map(({ path }) => ({
|
|
265251
|
+
fileName: basename9(path),
|
|
265252
|
+
reason: `only the newest ${MAX_FILES} are sent`
|
|
265253
|
+
}));
|
|
265254
|
+
const artifacts = [];
|
|
265255
|
+
for (const found of newest.slice(-MAX_FILES)) {
|
|
265256
|
+
const fileName = basename9(found.path);
|
|
265257
|
+
if (!ALLOWED.has(extname2(fileName).slice(1).toLowerCase())) {
|
|
265258
|
+
skipped.push({ fileName, reason: "its file type isn't supported" });
|
|
265259
|
+
continue;
|
|
265260
|
+
}
|
|
265261
|
+
let data = await readRegularFile(found.path) ?? (found.claude ? lastCleanWrite(entries, found.path) : undefined);
|
|
265262
|
+
if (!data) {
|
|
265263
|
+
skipped.push({ fileName, reason: "the file isn't on disk anymore" });
|
|
265264
|
+
continue;
|
|
265265
|
+
}
|
|
265266
|
+
if (found.files && /\.html?$/i.test(fileName)) {
|
|
265267
|
+
const missing = [];
|
|
265268
|
+
data = await inlineImages(data, found.files, missing);
|
|
265269
|
+
for (const src of new Set(missing))
|
|
265270
|
+
skipped.push({
|
|
265271
|
+
fileName: src,
|
|
265272
|
+
reason: `this image in ${fileName} isn't on disk anymore`
|
|
265273
|
+
});
|
|
265274
|
+
}
|
|
265275
|
+
if (data.length > MAX_BYTES) {
|
|
265276
|
+
skipped.push({ fileName, reason: "it's larger than 10 MB" });
|
|
265277
|
+
continue;
|
|
265278
|
+
}
|
|
265279
|
+
artifacts.push({ toolUseId: found.toolUseId, fileName, data });
|
|
265280
|
+
}
|
|
265281
|
+
let total = artifacts.reduce((sum, { data }) => sum + data.length, 0);
|
|
265282
|
+
while (total > budget) {
|
|
265283
|
+
const oldest = artifacts.shift();
|
|
265284
|
+
total -= oldest.data.length;
|
|
265285
|
+
skipped.push({
|
|
265286
|
+
fileName: oldest.fileName,
|
|
265287
|
+
reason: "the upload would be over 95 MB"
|
|
265288
|
+
});
|
|
265289
|
+
}
|
|
265290
|
+
return { artifacts, skipped };
|
|
265291
|
+
}
|
|
265292
|
+
|
|
265128
265293
|
// src/core/session-import/images.ts
|
|
265129
|
-
import { stat as
|
|
265130
|
-
import { extname as
|
|
265294
|
+
import { stat as stat5 } from "node:fs/promises";
|
|
265295
|
+
import { extname as extname3 } from "node:path";
|
|
265131
265296
|
var MEDIA_TYPES = {
|
|
265132
265297
|
".png": "image/png",
|
|
265133
265298
|
".jpg": "image/jpeg",
|
|
@@ -265138,8 +265303,8 @@ var MEDIA_TYPES = {
|
|
|
265138
265303
|
var MAX_ATTACHED_IMAGES = 20;
|
|
265139
265304
|
var MAX_ATTACHED_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
265140
265305
|
var IMAGE_PATH = /(?:\/|[A-Za-z]:\\)[^\s"'`<>()]+\.(?:png|jpe?g|gif|webp)\b/gi;
|
|
265141
|
-
var
|
|
265142
|
-
var isImage = (value) => ["image", "input_image"].includes(String(
|
|
265306
|
+
var asRecord2 = (value) => value && typeof value === "object" ? value : {};
|
|
265307
|
+
var isImage = (value) => ["image", "input_image"].includes(String(asRecord2(value).type));
|
|
265143
265308
|
function withoutImages(value) {
|
|
265144
265309
|
if (Array.isArray(value)) {
|
|
265145
265310
|
return value.filter((item) => !isImage(item)).map(withoutImages);
|
|
@@ -265159,32 +265324,32 @@ function strings(value) {
|
|
|
265159
265324
|
}
|
|
265160
265325
|
return [];
|
|
265161
265326
|
}
|
|
265162
|
-
var payloadOf = (entry) =>
|
|
265163
|
-
var messageOf = (entry) =>
|
|
265327
|
+
var payloadOf = (entry) => asRecord2(entry.payload);
|
|
265328
|
+
var messageOf = (entry) => asRecord2(entry.message);
|
|
265164
265329
|
function isTypedUserMessage(entry) {
|
|
265165
265330
|
if (entry.type === "user") {
|
|
265166
265331
|
if (entry.isMeta || entry.isSidechain)
|
|
265167
265332
|
return false;
|
|
265168
|
-
const content =
|
|
265169
|
-
return typeof content === "string" || Array.isArray(content) && !content.some((block) =>
|
|
265333
|
+
const content = asRecord2(entry.message).content;
|
|
265334
|
+
return typeof content === "string" || Array.isArray(content) && !content.some((block) => asRecord2(block).type === "tool_result");
|
|
265170
265335
|
}
|
|
265171
|
-
const payload =
|
|
265336
|
+
const payload = asRecord2(entry.payload);
|
|
265172
265337
|
return entry.type === "response_item" && payload.type === "message" && payload.role === "user";
|
|
265173
265338
|
}
|
|
265174
265339
|
function toolInputs(entries) {
|
|
265175
265340
|
return entries.flatMap((entry) => {
|
|
265176
|
-
const payload =
|
|
265341
|
+
const payload = asRecord2(entry.payload);
|
|
265177
265342
|
if (entry.type === "response_item") {
|
|
265178
265343
|
return String(payload.type).endsWith("_call") ? strings([payload.input, payload.arguments]) : [];
|
|
265179
265344
|
}
|
|
265180
265345
|
const content = messageOf(entry).content;
|
|
265181
|
-
return (Array.isArray(content) ? content : []).filter((block) =>
|
|
265346
|
+
return (Array.isArray(content) ? content : []).filter((block) => asRecord2(block).type === "tool_use").flatMap((block) => strings(asRecord2(block).input));
|
|
265182
265347
|
}).join(`
|
|
265183
265348
|
`);
|
|
265184
265349
|
}
|
|
265185
265350
|
async function imageBlock(path, codex) {
|
|
265186
|
-
const mediaType = MEDIA_TYPES[
|
|
265187
|
-
const size = await
|
|
265351
|
+
const mediaType = MEDIA_TYPES[extname3(path).toLowerCase()];
|
|
265352
|
+
const size = await stat5(path).then((info) => info.isFile() ? info.size : 0, () => 0);
|
|
265188
265353
|
if (!mediaType || !size || size > MAX_ATTACHED_IMAGE_BYTES)
|
|
265189
265354
|
return;
|
|
265190
265355
|
const data = (await readFile(path)).toString("base64");
|
|
@@ -265209,12 +265374,12 @@ async function prepareSessionImages(content) {
|
|
|
265209
265374
|
if (!entry || !lines[i]?.includes("image"))
|
|
265210
265375
|
return;
|
|
265211
265376
|
const message = messageOf(entry);
|
|
265212
|
-
if (entry.type === "user" && Array.isArray(message.content) && message.content.some((block) =>
|
|
265213
|
-
const content = message.content.map((block) =>
|
|
265377
|
+
if (entry.type === "user" && Array.isArray(message.content) && message.content.some((block) => asRecord2(block).type === "tool_result")) {
|
|
265378
|
+
const content = message.content.map((block) => asRecord2(block).type === "tool_result" ? withoutImages(block) : block);
|
|
265214
265379
|
const { toolUseResult: _, ...rest } = entry;
|
|
265215
265380
|
entries[i] = { ...rest, message: { ...message, content } };
|
|
265216
265381
|
changed.add(i);
|
|
265217
|
-
} else if (entry.type === "response_item" && String(
|
|
265382
|
+
} else if (entry.type === "response_item" && String(asRecord2(entry.payload).type).endsWith("_output")) {
|
|
265218
265383
|
entries[i] = { ...entry, payload: withoutImages(entry.payload) };
|
|
265219
265384
|
changed.add(i);
|
|
265220
265385
|
}
|
|
@@ -265258,7 +265423,7 @@ async function prepareSessionImages(content) {
|
|
|
265258
265423
|
|
|
265259
265424
|
// src/core/session-import/sessions.ts
|
|
265260
265425
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
265261
|
-
import { realpath, rm as rm3, stat as
|
|
265426
|
+
import { realpath, rm as rm3, stat as stat6 } from "node:fs/promises";
|
|
265262
265427
|
import { homedir as homedir4 } from "node:os";
|
|
265263
265428
|
import { dirname as dirname23, join as join31 } from "node:path";
|
|
265264
265429
|
import { createInterface as createInterface2 } from "node:readline";
|
|
@@ -265293,12 +265458,12 @@ async function scanLines(path, pick, maxLines = Number.POSITIVE_INFINITY) {
|
|
|
265293
265458
|
}
|
|
265294
265459
|
return;
|
|
265295
265460
|
}
|
|
265296
|
-
var
|
|
265297
|
-
var codexCwd = (entry) => entry.type === "session_meta" ? String(
|
|
265461
|
+
var asRecord3 = (value) => value && typeof value === "object" ? value : {};
|
|
265462
|
+
var codexCwd = (entry) => entry.type === "session_meta" ? String(asRecord3(entry.payload).cwd ?? "") : undefined;
|
|
265298
265463
|
async function newest(paths) {
|
|
265299
265464
|
let best;
|
|
265300
265465
|
for (const path of paths) {
|
|
265301
|
-
const { mtimeMs } = await
|
|
265466
|
+
const { mtimeMs } = await stat6(path);
|
|
265302
265467
|
if (!best || mtimeMs > best.mtime)
|
|
265303
265468
|
best = { path, mtime: mtimeMs };
|
|
265304
265469
|
}
|
|
@@ -265349,11 +265514,11 @@ async function findCurrentSession(cwd) {
|
|
|
265349
265514
|
function claudeUserText(entry) {
|
|
265350
265515
|
if (entry.type !== "user" || entry.isMeta || entry.isSidechain)
|
|
265351
265516
|
return;
|
|
265352
|
-
const content =
|
|
265517
|
+
const content = asRecord3(entry.message).content;
|
|
265353
265518
|
return typeof content === "string" && !content.startsWith("<") ? content : undefined;
|
|
265354
265519
|
}
|
|
265355
265520
|
function codexUserText(entry) {
|
|
265356
|
-
const payload =
|
|
265521
|
+
const payload = asRecord3(entry.payload);
|
|
265357
265522
|
return entry.type === "event_msg" && payload.type === "user_message" ? String(payload.message ?? "") : undefined;
|
|
265358
265523
|
}
|
|
265359
265524
|
var PICKER_LIMIT = 20;
|
|
@@ -265372,7 +265537,7 @@ async function listSessions(cwd) {
|
|
|
265372
265537
|
];
|
|
265373
265538
|
const dated = await Promise.all(candidates.map(async (c) => ({
|
|
265374
265539
|
...c,
|
|
265375
|
-
updatedAt: (await
|
|
265540
|
+
updatedAt: (await stat6(c.path)).mtime
|
|
265376
265541
|
})));
|
|
265377
265542
|
dated.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
265378
265543
|
const sessions = [];
|
|
@@ -265394,7 +265559,7 @@ var TELEPORT_PROMPT = "Reply with OK.";
|
|
|
265394
265559
|
var TELEPORT_NOTE = "This session is being continued from another machine";
|
|
265395
265560
|
function parseLine(line) {
|
|
265396
265561
|
try {
|
|
265397
|
-
return
|
|
265562
|
+
return asRecord3(JSON.parse(line));
|
|
265398
265563
|
} catch {
|
|
265399
265564
|
return {};
|
|
265400
265565
|
}
|
|
@@ -265403,7 +265568,7 @@ function stripTeleportExchange(content) {
|
|
|
265403
265568
|
const lines = content.split(`
|
|
265404
265569
|
`);
|
|
265405
265570
|
const entries = lines.map(parseLine);
|
|
265406
|
-
const userText = (entry) => entry.type === "user" ?
|
|
265571
|
+
const userText = (entry) => entry.type === "user" ? asRecord3(entry.message).content : undefined;
|
|
265407
265572
|
let end = lines.length;
|
|
265408
265573
|
for (let i = lines.length - 1;i >= 0; i--) {
|
|
265409
265574
|
if (userText(entries[i] ?? {}) === TELEPORT_PROMPT) {
|
|
@@ -265450,7 +265615,7 @@ async function teleportSession(sessionId, cwd) {
|
|
|
265450
265615
|
cwd: claudeDir(),
|
|
265451
265616
|
absolute: true
|
|
265452
265617
|
})) {
|
|
265453
|
-
if ((await
|
|
265618
|
+
if ((await stat6(path)).mtimeMs < startedAt)
|
|
265454
265619
|
continue;
|
|
265455
265620
|
const sessionCwd = await scanLines(path, (entry) => typeof entry.cwd === "string" ? entry.cwd : undefined, 50);
|
|
265456
265621
|
if (sessionCwd === repo || sessionCwd === repoReal)
|
|
@@ -265540,20 +265705,37 @@ async function importAction(ctx, link, options, command) {
|
|
|
265540
265705
|
const note = git?.unpushed ? "Base Code started from what's on GitHub; your local changes aren't included." : undefined;
|
|
265541
265706
|
if (!options.token)
|
|
265542
265707
|
await ensureAuth(ctx);
|
|
265708
|
+
const { artifacts, skipped } = await collectArtifacts2(content);
|
|
265543
265709
|
ctx.log.info("This uploads the full conversation to Base Code.");
|
|
265710
|
+
if (artifacts.length) {
|
|
265711
|
+
ctx.log.info(`Sending ${artifacts.length} artifact${artifacts.length === 1 ? "" : "s"}: ${artifacts.map((a) => a.fileName).join(", ")}`);
|
|
265712
|
+
}
|
|
265713
|
+
for (const { fileName, reason } of skipped) {
|
|
265714
|
+
ctx.log.warn(`Not sending ${fileName}: ${reason}.`);
|
|
265715
|
+
}
|
|
265544
265716
|
const imported = await ctx.runTask("Importing session", () => uploadSession(appId, content, {
|
|
265545
265717
|
token: options.token,
|
|
265546
|
-
sourceBranch: git?.branch
|
|
265718
|
+
sourceBranch: git?.branch,
|
|
265719
|
+
artifacts
|
|
265547
265720
|
}));
|
|
265548
265721
|
const url = `${getBase44ApiUrl()}${imported.branchUrl}`;
|
|
265722
|
+
const { importedArtifacts: saved, skippedArtifacts: refused } = imported;
|
|
265723
|
+
const artifactLine = saved || refused ? `Artifacts: ${saved} saved${refused ? `, ${refused} not saved` : ""}.` : undefined;
|
|
265549
265724
|
return {
|
|
265550
265725
|
outroMessage: [
|
|
265551
265726
|
outcome(imported),
|
|
265727
|
+
...artifactLine ? [artifactLine] : [],
|
|
265552
265728
|
...note ? [note] : [],
|
|
265553
265729
|
`Open it: ${url}`
|
|
265554
265730
|
].join(`
|
|
265555
265731
|
`),
|
|
265556
|
-
stdout: ctx.jsonMode ? toJsonStdout({
|
|
265732
|
+
stdout: ctx.jsonMode ? toJsonStdout({
|
|
265733
|
+
...imported,
|
|
265734
|
+
url,
|
|
265735
|
+
sentArtifacts: artifacts.map((a) => a.fileName),
|
|
265736
|
+
unsentArtifacts: skipped,
|
|
265737
|
+
...note ? { note } : {}
|
|
265738
|
+
}) : undefined
|
|
265557
265739
|
};
|
|
265558
265740
|
}
|
|
265559
265741
|
function outcome(imported) {
|
|
@@ -265574,7 +265756,7 @@ function getSessionsCommand() {
|
|
|
265574
265756
|
}
|
|
265575
265757
|
|
|
265576
265758
|
// src/cli/commands/site/deploy.ts
|
|
265577
|
-
import { resolve as
|
|
265759
|
+
import { resolve as resolve17 } from "node:path";
|
|
265578
265760
|
async function deployAction2(ctx, options) {
|
|
265579
265761
|
const { isNonInteractive } = ctx;
|
|
265580
265762
|
if (isNonInteractive && !options.yes) {
|
|
@@ -265659,7 +265841,7 @@ async function deployArchive({ runTask, jsonMode }, outputDir) {
|
|
|
265659
265841
|
}
|
|
265660
265842
|
function siteOutputDir(project) {
|
|
265661
265843
|
const { outputDirectory = DEFAULT_SITE.outputDirectory } = siteOrDefault(project);
|
|
265662
|
-
return
|
|
265844
|
+
return resolve17(project.root, outputDirectory);
|
|
265663
265845
|
}
|
|
265664
265846
|
function getSiteDeployCommand() {
|
|
265665
265847
|
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").option("--publish", "Serve this build in production once it is deployed").addOption(new Option2("--git-hash <hash>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(deployAction2);
|
|
@@ -268436,11 +268618,11 @@ import { relative as relative11 } from "node:path";
|
|
|
268436
268618
|
// ../../node_modules/chokidar/index.js
|
|
268437
268619
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
268438
268620
|
import { stat as statcb, Stats } from "node:fs";
|
|
268439
|
-
import { readdir as readdir3, stat as
|
|
268621
|
+
import { readdir as readdir3, stat as stat10 } from "node:fs/promises";
|
|
268440
268622
|
import * as sp3 from "node:path";
|
|
268441
268623
|
|
|
268442
268624
|
// ../../node_modules/readdirp/index.js
|
|
268443
|
-
import { lstat as lstat2, readdir as readdir2, realpath as realpath2, stat as
|
|
268625
|
+
import { lstat as lstat2, readdir as readdir2, realpath as realpath2, stat as stat8 } from "node:fs/promises";
|
|
268444
268626
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
268445
268627
|
import { Readable as Readable6 } from "node:stream";
|
|
268446
268628
|
var EntryTypes = {
|
|
@@ -268522,7 +268704,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
268522
268704
|
const { root, type } = opts;
|
|
268523
268705
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
268524
268706
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
268525
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
268707
|
+
const statMethod = opts.lstat ? lstat2 : stat8;
|
|
268526
268708
|
if (wantBigintFsStats) {
|
|
268527
268709
|
this._stat = (path) => statMethod(path, { bigint: true });
|
|
268528
268710
|
} else {
|
|
@@ -268675,7 +268857,7 @@ function readdirp(root, options = {}) {
|
|
|
268675
268857
|
|
|
268676
268858
|
// ../../node_modules/chokidar/handler.js
|
|
268677
268859
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
268678
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
268860
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat9 } from "node:fs/promises";
|
|
268679
268861
|
import { type as osType } from "node:os";
|
|
268680
268862
|
import * as sp2 from "node:path";
|
|
268681
268863
|
var STR_DATA = "data";
|
|
@@ -268701,7 +268883,7 @@ var EVENTS = {
|
|
|
268701
268883
|
};
|
|
268702
268884
|
var EV = EVENTS;
|
|
268703
268885
|
var THROTTLE_MODE_WATCH = "watch";
|
|
268704
|
-
var statMethods = { lstat: lstat3, stat:
|
|
268886
|
+
var statMethods = { lstat: lstat3, stat: stat9 };
|
|
268705
268887
|
var KEY_LISTENERS = "listeners";
|
|
268706
268888
|
var KEY_ERR = "errHandlers";
|
|
268707
268889
|
var KEY_RAW = "rawEmitters";
|
|
@@ -269172,7 +269354,7 @@ class NodeFsHandler {
|
|
|
269172
269354
|
return;
|
|
269173
269355
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
269174
269356
|
try {
|
|
269175
|
-
const newStats = await
|
|
269357
|
+
const newStats = await stat9(file);
|
|
269176
269358
|
if (this.fsw.closed)
|
|
269177
269359
|
return;
|
|
269178
269360
|
const at = newStats.atimeMs;
|
|
@@ -269844,7 +270026,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
269844
270026
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
|
|
269845
270027
|
let stats;
|
|
269846
270028
|
try {
|
|
269847
|
-
stats = await
|
|
270029
|
+
stats = await stat10(fullPath);
|
|
269848
270030
|
} catch (err) {}
|
|
269849
270031
|
if (!stats || this.closed)
|
|
269850
270032
|
return;
|
|
@@ -270227,16 +270409,14 @@ async function createDevServer(options) {
|
|
|
270227
270409
|
emitEntityEvent = (appId, entityName, event) => {
|
|
270228
270410
|
broadcastEntityEvent(io, appId, entityName, event);
|
|
270229
270411
|
};
|
|
270230
|
-
const functionsDir = join40(dirname29(project.configPath), project.functionsDir);
|
|
270231
270412
|
const base44ConfigWatcher = new WatchBase44({
|
|
270232
|
-
functions: functionsDir,
|
|
270233
|
-
shared: getSharedDir(functionsDir),
|
|
270413
|
+
functions: join40(dirname29(project.configPath), project.functionsDir),
|
|
270234
270414
|
entities: join40(dirname29(project.configPath), project.entitiesDir)
|
|
270235
270415
|
}, devLogger);
|
|
270236
270416
|
base44ConfigWatcher.on("change", async (name) => {
|
|
270237
270417
|
try {
|
|
270238
270418
|
const { functions, entities } = await options.loadResources();
|
|
270239
|
-
if (name === "functions"
|
|
270419
|
+
if (name === "functions") {
|
|
270240
270420
|
const previousFunctionCount = functionManager.getFunctionNames().length;
|
|
270241
270421
|
await functionManager.reload(functions);
|
|
270242
270422
|
const names = functionManager.getFunctionNames();
|
|
@@ -270591,7 +270771,7 @@ Examples:
|
|
|
270591
270771
|
}
|
|
270592
270772
|
|
|
270593
270773
|
// src/cli/commands/project/eject.ts
|
|
270594
|
-
import { resolve as
|
|
270774
|
+
import { resolve as resolve21 } from "node:path";
|
|
270595
270775
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
270596
270776
|
async function eject(ctx, options, command) {
|
|
270597
270777
|
const { log, runTask, isNonInteractive } = ctx;
|
|
@@ -270655,7 +270835,7 @@ async function eject(ctx, options, command) {
|
|
|
270655
270835
|
Ne("Operation cancelled.");
|
|
270656
270836
|
throw new CLIExitError(0);
|
|
270657
270837
|
}
|
|
270658
|
-
const resolvedPath =
|
|
270838
|
+
const resolvedPath = resolve21(selectedPath);
|
|
270659
270839
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
270660
270840
|
await createProjectFilesForExistingProject({
|
|
270661
270841
|
projectId,
|
|
@@ -274801,4 +274981,4 @@ export {
|
|
|
274801
274981
|
runCLI
|
|
274802
274982
|
};
|
|
274803
274983
|
|
|
274804
|
-
//# debugId=
|
|
274984
|
+
//# debugId=C068BFC2F2A8F3FB64756E2164756E21
|