@base44-preview/cli 0.2.6-pr.685.636d588 → 0.2.6-pr.686.168cf90
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 +227 -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,152 @@ 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) {
|
|
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
|
+
}
|
|
265226
|
+
if (!uris.size)
|
|
265227
|
+
return html;
|
|
265228
|
+
return Buffer.from(text.replace(IMG_SRC, (match, prefix, quote, src) => {
|
|
265229
|
+
const uri = uris.get(src);
|
|
265230
|
+
return uri ? `${prefix}${quote}${uri}${quote}` : match;
|
|
265231
|
+
}));
|
|
265232
|
+
}
|
|
265233
|
+
async function collectArtifacts2(session, budget = MAX_REQUEST_BYTES - session.length - MULTIPART_MARGIN) {
|
|
265234
|
+
const entries = Buffer.from(session).toString("utf8").split(`
|
|
265235
|
+
`).map((line) => {
|
|
265236
|
+
try {
|
|
265237
|
+
return asRecord(JSON.parse(line));
|
|
265238
|
+
} catch {
|
|
265239
|
+
return {};
|
|
265240
|
+
}
|
|
265241
|
+
});
|
|
265242
|
+
const byPath = new Map;
|
|
265243
|
+
for (const found of findArtifacts(entries)) {
|
|
265244
|
+
byPath.delete(found.path);
|
|
265245
|
+
byPath.set(found.path, found);
|
|
265246
|
+
}
|
|
265247
|
+
const newest = [...byPath.values()];
|
|
265248
|
+
const skipped = newest.slice(0, -MAX_FILES).map(({ path }) => ({
|
|
265249
|
+
fileName: basename9(path),
|
|
265250
|
+
reason: `only the newest ${MAX_FILES} are sent`
|
|
265251
|
+
}));
|
|
265252
|
+
const artifacts = [];
|
|
265253
|
+
for (const found of newest.slice(-MAX_FILES)) {
|
|
265254
|
+
const fileName = basename9(found.path);
|
|
265255
|
+
if (!ALLOWED.has(extname2(fileName).slice(1).toLowerCase())) {
|
|
265256
|
+
skipped.push({ fileName, reason: "its file type isn't supported" });
|
|
265257
|
+
continue;
|
|
265258
|
+
}
|
|
265259
|
+
let data = await readRegularFile(found.path) ?? (found.claude ? lastCleanWrite(entries, found.path) : undefined);
|
|
265260
|
+
if (!data) {
|
|
265261
|
+
skipped.push({ fileName, reason: "the file isn't on disk anymore" });
|
|
265262
|
+
continue;
|
|
265263
|
+
}
|
|
265264
|
+
if (found.files && /\.html?$/i.test(fileName)) {
|
|
265265
|
+
data = await inlineImages(data, found.files);
|
|
265266
|
+
}
|
|
265267
|
+
if (data.length > MAX_BYTES) {
|
|
265268
|
+
skipped.push({ fileName, reason: "it's larger than 10 MB" });
|
|
265269
|
+
continue;
|
|
265270
|
+
}
|
|
265271
|
+
artifacts.push({ toolUseId: found.toolUseId, fileName, data });
|
|
265272
|
+
}
|
|
265273
|
+
let total = artifacts.reduce((sum, { data }) => sum + data.length, 0);
|
|
265274
|
+
while (total > budget) {
|
|
265275
|
+
const oldest = artifacts.shift();
|
|
265276
|
+
total -= oldest.data.length;
|
|
265277
|
+
skipped.push({
|
|
265278
|
+
fileName: oldest.fileName,
|
|
265279
|
+
reason: "the upload would be over 95 MB"
|
|
265280
|
+
});
|
|
265281
|
+
}
|
|
265282
|
+
return { artifacts, skipped };
|
|
265283
|
+
}
|
|
265284
|
+
|
|
265128
265285
|
// src/core/session-import/images.ts
|
|
265129
|
-
import { stat as
|
|
265130
|
-
import { extname as
|
|
265286
|
+
import { stat as stat5 } from "node:fs/promises";
|
|
265287
|
+
import { extname as extname3 } from "node:path";
|
|
265131
265288
|
var MEDIA_TYPES = {
|
|
265132
265289
|
".png": "image/png",
|
|
265133
265290
|
".jpg": "image/jpeg",
|
|
@@ -265138,8 +265295,8 @@ var MEDIA_TYPES = {
|
|
|
265138
265295
|
var MAX_ATTACHED_IMAGES = 20;
|
|
265139
265296
|
var MAX_ATTACHED_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
265140
265297
|
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(
|
|
265298
|
+
var asRecord2 = (value) => value && typeof value === "object" ? value : {};
|
|
265299
|
+
var isImage = (value) => ["image", "input_image"].includes(String(asRecord2(value).type));
|
|
265143
265300
|
function withoutImages(value) {
|
|
265144
265301
|
if (Array.isArray(value)) {
|
|
265145
265302
|
return value.filter((item) => !isImage(item)).map(withoutImages);
|
|
@@ -265159,32 +265316,32 @@ function strings(value) {
|
|
|
265159
265316
|
}
|
|
265160
265317
|
return [];
|
|
265161
265318
|
}
|
|
265162
|
-
var payloadOf = (entry) =>
|
|
265163
|
-
var messageOf = (entry) =>
|
|
265319
|
+
var payloadOf = (entry) => asRecord2(entry.payload);
|
|
265320
|
+
var messageOf = (entry) => asRecord2(entry.message);
|
|
265164
265321
|
function isTypedUserMessage(entry) {
|
|
265165
265322
|
if (entry.type === "user") {
|
|
265166
265323
|
if (entry.isMeta || entry.isSidechain)
|
|
265167
265324
|
return false;
|
|
265168
|
-
const content =
|
|
265169
|
-
return typeof content === "string" || Array.isArray(content) && !content.some((block) =>
|
|
265325
|
+
const content = asRecord2(entry.message).content;
|
|
265326
|
+
return typeof content === "string" || Array.isArray(content) && !content.some((block) => asRecord2(block).type === "tool_result");
|
|
265170
265327
|
}
|
|
265171
|
-
const payload =
|
|
265328
|
+
const payload = asRecord2(entry.payload);
|
|
265172
265329
|
return entry.type === "response_item" && payload.type === "message" && payload.role === "user";
|
|
265173
265330
|
}
|
|
265174
265331
|
function toolInputs(entries) {
|
|
265175
265332
|
return entries.flatMap((entry) => {
|
|
265176
|
-
const payload =
|
|
265333
|
+
const payload = asRecord2(entry.payload);
|
|
265177
265334
|
if (entry.type === "response_item") {
|
|
265178
265335
|
return String(payload.type).endsWith("_call") ? strings([payload.input, payload.arguments]) : [];
|
|
265179
265336
|
}
|
|
265180
265337
|
const content = messageOf(entry).content;
|
|
265181
|
-
return (Array.isArray(content) ? content : []).filter((block) =>
|
|
265338
|
+
return (Array.isArray(content) ? content : []).filter((block) => asRecord2(block).type === "tool_use").flatMap((block) => strings(asRecord2(block).input));
|
|
265182
265339
|
}).join(`
|
|
265183
265340
|
`);
|
|
265184
265341
|
}
|
|
265185
265342
|
async function imageBlock(path, codex) {
|
|
265186
|
-
const mediaType = MEDIA_TYPES[
|
|
265187
|
-
const size = await
|
|
265343
|
+
const mediaType = MEDIA_TYPES[extname3(path).toLowerCase()];
|
|
265344
|
+
const size = await stat5(path).then((info) => info.isFile() ? info.size : 0, () => 0);
|
|
265188
265345
|
if (!mediaType || !size || size > MAX_ATTACHED_IMAGE_BYTES)
|
|
265189
265346
|
return;
|
|
265190
265347
|
const data = (await readFile(path)).toString("base64");
|
|
@@ -265209,12 +265366,12 @@ async function prepareSessionImages(content) {
|
|
|
265209
265366
|
if (!entry || !lines[i]?.includes("image"))
|
|
265210
265367
|
return;
|
|
265211
265368
|
const message = messageOf(entry);
|
|
265212
|
-
if (entry.type === "user" && Array.isArray(message.content) && message.content.some((block) =>
|
|
265213
|
-
const content = message.content.map((block) =>
|
|
265369
|
+
if (entry.type === "user" && Array.isArray(message.content) && message.content.some((block) => asRecord2(block).type === "tool_result")) {
|
|
265370
|
+
const content = message.content.map((block) => asRecord2(block).type === "tool_result" ? withoutImages(block) : block);
|
|
265214
265371
|
const { toolUseResult: _, ...rest } = entry;
|
|
265215
265372
|
entries[i] = { ...rest, message: { ...message, content } };
|
|
265216
265373
|
changed.add(i);
|
|
265217
|
-
} else if (entry.type === "response_item" && String(
|
|
265374
|
+
} else if (entry.type === "response_item" && String(asRecord2(entry.payload).type).endsWith("_output")) {
|
|
265218
265375
|
entries[i] = { ...entry, payload: withoutImages(entry.payload) };
|
|
265219
265376
|
changed.add(i);
|
|
265220
265377
|
}
|
|
@@ -265258,7 +265415,7 @@ async function prepareSessionImages(content) {
|
|
|
265258
265415
|
|
|
265259
265416
|
// src/core/session-import/sessions.ts
|
|
265260
265417
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
265261
|
-
import { realpath, rm as rm3, stat as
|
|
265418
|
+
import { realpath, rm as rm3, stat as stat6 } from "node:fs/promises";
|
|
265262
265419
|
import { homedir as homedir4 } from "node:os";
|
|
265263
265420
|
import { dirname as dirname23, join as join31 } from "node:path";
|
|
265264
265421
|
import { createInterface as createInterface2 } from "node:readline";
|
|
@@ -265293,12 +265450,12 @@ async function scanLines(path, pick, maxLines = Number.POSITIVE_INFINITY) {
|
|
|
265293
265450
|
}
|
|
265294
265451
|
return;
|
|
265295
265452
|
}
|
|
265296
|
-
var
|
|
265297
|
-
var codexCwd = (entry) => entry.type === "session_meta" ? String(
|
|
265453
|
+
var asRecord3 = (value) => value && typeof value === "object" ? value : {};
|
|
265454
|
+
var codexCwd = (entry) => entry.type === "session_meta" ? String(asRecord3(entry.payload).cwd ?? "") : undefined;
|
|
265298
265455
|
async function newest(paths) {
|
|
265299
265456
|
let best;
|
|
265300
265457
|
for (const path of paths) {
|
|
265301
|
-
const { mtimeMs } = await
|
|
265458
|
+
const { mtimeMs } = await stat6(path);
|
|
265302
265459
|
if (!best || mtimeMs > best.mtime)
|
|
265303
265460
|
best = { path, mtime: mtimeMs };
|
|
265304
265461
|
}
|
|
@@ -265349,11 +265506,11 @@ async function findCurrentSession(cwd) {
|
|
|
265349
265506
|
function claudeUserText(entry) {
|
|
265350
265507
|
if (entry.type !== "user" || entry.isMeta || entry.isSidechain)
|
|
265351
265508
|
return;
|
|
265352
|
-
const content =
|
|
265509
|
+
const content = asRecord3(entry.message).content;
|
|
265353
265510
|
return typeof content === "string" && !content.startsWith("<") ? content : undefined;
|
|
265354
265511
|
}
|
|
265355
265512
|
function codexUserText(entry) {
|
|
265356
|
-
const payload =
|
|
265513
|
+
const payload = asRecord3(entry.payload);
|
|
265357
265514
|
return entry.type === "event_msg" && payload.type === "user_message" ? String(payload.message ?? "") : undefined;
|
|
265358
265515
|
}
|
|
265359
265516
|
var PICKER_LIMIT = 20;
|
|
@@ -265372,7 +265529,7 @@ async function listSessions(cwd) {
|
|
|
265372
265529
|
];
|
|
265373
265530
|
const dated = await Promise.all(candidates.map(async (c) => ({
|
|
265374
265531
|
...c,
|
|
265375
|
-
updatedAt: (await
|
|
265532
|
+
updatedAt: (await stat6(c.path)).mtime
|
|
265376
265533
|
})));
|
|
265377
265534
|
dated.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
265378
265535
|
const sessions = [];
|
|
@@ -265394,7 +265551,7 @@ var TELEPORT_PROMPT = "Reply with OK.";
|
|
|
265394
265551
|
var TELEPORT_NOTE = "This session is being continued from another machine";
|
|
265395
265552
|
function parseLine(line) {
|
|
265396
265553
|
try {
|
|
265397
|
-
return
|
|
265554
|
+
return asRecord3(JSON.parse(line));
|
|
265398
265555
|
} catch {
|
|
265399
265556
|
return {};
|
|
265400
265557
|
}
|
|
@@ -265403,7 +265560,7 @@ function stripTeleportExchange(content) {
|
|
|
265403
265560
|
const lines = content.split(`
|
|
265404
265561
|
`);
|
|
265405
265562
|
const entries = lines.map(parseLine);
|
|
265406
|
-
const userText = (entry) => entry.type === "user" ?
|
|
265563
|
+
const userText = (entry) => entry.type === "user" ? asRecord3(entry.message).content : undefined;
|
|
265407
265564
|
let end = lines.length;
|
|
265408
265565
|
for (let i = lines.length - 1;i >= 0; i--) {
|
|
265409
265566
|
if (userText(entries[i] ?? {}) === TELEPORT_PROMPT) {
|
|
@@ -265450,7 +265607,7 @@ async function teleportSession(sessionId, cwd) {
|
|
|
265450
265607
|
cwd: claudeDir(),
|
|
265451
265608
|
absolute: true
|
|
265452
265609
|
})) {
|
|
265453
|
-
if ((await
|
|
265610
|
+
if ((await stat6(path)).mtimeMs < startedAt)
|
|
265454
265611
|
continue;
|
|
265455
265612
|
const sessionCwd = await scanLines(path, (entry) => typeof entry.cwd === "string" ? entry.cwd : undefined, 50);
|
|
265456
265613
|
if (sessionCwd === repo || sessionCwd === repoReal)
|
|
@@ -265540,20 +265697,37 @@ async function importAction(ctx, link, options, command) {
|
|
|
265540
265697
|
const note = git?.unpushed ? "Base Code started from what's on GitHub; your local changes aren't included." : undefined;
|
|
265541
265698
|
if (!options.token)
|
|
265542
265699
|
await ensureAuth(ctx);
|
|
265700
|
+
const { artifacts, skipped } = await collectArtifacts2(content);
|
|
265543
265701
|
ctx.log.info("This uploads the full conversation to Base Code.");
|
|
265702
|
+
if (artifacts.length) {
|
|
265703
|
+
ctx.log.info(`Sending ${artifacts.length} artifact${artifacts.length === 1 ? "" : "s"}: ${artifacts.map((a) => a.fileName).join(", ")}`);
|
|
265704
|
+
}
|
|
265705
|
+
for (const { fileName, reason } of skipped) {
|
|
265706
|
+
ctx.log.warn(`Not sending ${fileName}: ${reason}.`);
|
|
265707
|
+
}
|
|
265544
265708
|
const imported = await ctx.runTask("Importing session", () => uploadSession(appId, content, {
|
|
265545
265709
|
token: options.token,
|
|
265546
|
-
sourceBranch: git?.branch
|
|
265710
|
+
sourceBranch: git?.branch,
|
|
265711
|
+
artifacts
|
|
265547
265712
|
}));
|
|
265548
265713
|
const url = `${getBase44ApiUrl()}${imported.branchUrl}`;
|
|
265714
|
+
const { importedArtifacts: saved, skippedArtifacts: refused } = imported;
|
|
265715
|
+
const artifactLine = saved || refused ? `Artifacts: ${saved} saved${refused ? `, ${refused} not saved` : ""}.` : undefined;
|
|
265549
265716
|
return {
|
|
265550
265717
|
outroMessage: [
|
|
265551
265718
|
outcome(imported),
|
|
265719
|
+
...artifactLine ? [artifactLine] : [],
|
|
265552
265720
|
...note ? [note] : [],
|
|
265553
265721
|
`Open it: ${url}`
|
|
265554
265722
|
].join(`
|
|
265555
265723
|
`),
|
|
265556
|
-
stdout: ctx.jsonMode ? toJsonStdout({
|
|
265724
|
+
stdout: ctx.jsonMode ? toJsonStdout({
|
|
265725
|
+
...imported,
|
|
265726
|
+
url,
|
|
265727
|
+
sentArtifacts: artifacts.map((a) => a.fileName),
|
|
265728
|
+
unsentArtifacts: skipped,
|
|
265729
|
+
...note ? { note } : {}
|
|
265730
|
+
}) : undefined
|
|
265557
265731
|
};
|
|
265558
265732
|
}
|
|
265559
265733
|
function outcome(imported) {
|
|
@@ -265574,7 +265748,7 @@ function getSessionsCommand() {
|
|
|
265574
265748
|
}
|
|
265575
265749
|
|
|
265576
265750
|
// src/cli/commands/site/deploy.ts
|
|
265577
|
-
import { resolve as
|
|
265751
|
+
import { resolve as resolve17 } from "node:path";
|
|
265578
265752
|
async function deployAction2(ctx, options) {
|
|
265579
265753
|
const { isNonInteractive } = ctx;
|
|
265580
265754
|
if (isNonInteractive && !options.yes) {
|
|
@@ -265659,7 +265833,7 @@ async function deployArchive({ runTask, jsonMode }, outputDir) {
|
|
|
265659
265833
|
}
|
|
265660
265834
|
function siteOutputDir(project) {
|
|
265661
265835
|
const { outputDirectory = DEFAULT_SITE.outputDirectory } = siteOrDefault(project);
|
|
265662
|
-
return
|
|
265836
|
+
return resolve17(project.root, outputDirectory);
|
|
265663
265837
|
}
|
|
265664
265838
|
function getSiteDeployCommand() {
|
|
265665
265839
|
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 +268610,11 @@ import { relative as relative11 } from "node:path";
|
|
|
268436
268610
|
// ../../node_modules/chokidar/index.js
|
|
268437
268611
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
268438
268612
|
import { stat as statcb, Stats } from "node:fs";
|
|
268439
|
-
import { readdir as readdir3, stat as
|
|
268613
|
+
import { readdir as readdir3, stat as stat10 } from "node:fs/promises";
|
|
268440
268614
|
import * as sp3 from "node:path";
|
|
268441
268615
|
|
|
268442
268616
|
// ../../node_modules/readdirp/index.js
|
|
268443
|
-
import { lstat as lstat2, readdir as readdir2, realpath as realpath2, stat as
|
|
268617
|
+
import { lstat as lstat2, readdir as readdir2, realpath as realpath2, stat as stat8 } from "node:fs/promises";
|
|
268444
268618
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
268445
268619
|
import { Readable as Readable6 } from "node:stream";
|
|
268446
268620
|
var EntryTypes = {
|
|
@@ -268522,7 +268696,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
268522
268696
|
const { root, type } = opts;
|
|
268523
268697
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
268524
268698
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
268525
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
268699
|
+
const statMethod = opts.lstat ? lstat2 : stat8;
|
|
268526
268700
|
if (wantBigintFsStats) {
|
|
268527
268701
|
this._stat = (path) => statMethod(path, { bigint: true });
|
|
268528
268702
|
} else {
|
|
@@ -268675,7 +268849,7 @@ function readdirp(root, options = {}) {
|
|
|
268675
268849
|
|
|
268676
268850
|
// ../../node_modules/chokidar/handler.js
|
|
268677
268851
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
268678
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
268852
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat9 } from "node:fs/promises";
|
|
268679
268853
|
import { type as osType } from "node:os";
|
|
268680
268854
|
import * as sp2 from "node:path";
|
|
268681
268855
|
var STR_DATA = "data";
|
|
@@ -268701,7 +268875,7 @@ var EVENTS = {
|
|
|
268701
268875
|
};
|
|
268702
268876
|
var EV = EVENTS;
|
|
268703
268877
|
var THROTTLE_MODE_WATCH = "watch";
|
|
268704
|
-
var statMethods = { lstat: lstat3, stat:
|
|
268878
|
+
var statMethods = { lstat: lstat3, stat: stat9 };
|
|
268705
268879
|
var KEY_LISTENERS = "listeners";
|
|
268706
268880
|
var KEY_ERR = "errHandlers";
|
|
268707
268881
|
var KEY_RAW = "rawEmitters";
|
|
@@ -269172,7 +269346,7 @@ class NodeFsHandler {
|
|
|
269172
269346
|
return;
|
|
269173
269347
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
269174
269348
|
try {
|
|
269175
|
-
const newStats = await
|
|
269349
|
+
const newStats = await stat9(file);
|
|
269176
269350
|
if (this.fsw.closed)
|
|
269177
269351
|
return;
|
|
269178
269352
|
const at = newStats.atimeMs;
|
|
@@ -269844,7 +270018,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
269844
270018
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
|
|
269845
270019
|
let stats;
|
|
269846
270020
|
try {
|
|
269847
|
-
stats = await
|
|
270021
|
+
stats = await stat10(fullPath);
|
|
269848
270022
|
} catch (err) {}
|
|
269849
270023
|
if (!stats || this.closed)
|
|
269850
270024
|
return;
|
|
@@ -270227,16 +270401,14 @@ async function createDevServer(options) {
|
|
|
270227
270401
|
emitEntityEvent = (appId, entityName, event) => {
|
|
270228
270402
|
broadcastEntityEvent(io, appId, entityName, event);
|
|
270229
270403
|
};
|
|
270230
|
-
const functionsDir = join40(dirname29(project.configPath), project.functionsDir);
|
|
270231
270404
|
const base44ConfigWatcher = new WatchBase44({
|
|
270232
|
-
functions: functionsDir,
|
|
270233
|
-
shared: getSharedDir(functionsDir),
|
|
270405
|
+
functions: join40(dirname29(project.configPath), project.functionsDir),
|
|
270234
270406
|
entities: join40(dirname29(project.configPath), project.entitiesDir)
|
|
270235
270407
|
}, devLogger);
|
|
270236
270408
|
base44ConfigWatcher.on("change", async (name) => {
|
|
270237
270409
|
try {
|
|
270238
270410
|
const { functions, entities } = await options.loadResources();
|
|
270239
|
-
if (name === "functions"
|
|
270411
|
+
if (name === "functions") {
|
|
270240
270412
|
const previousFunctionCount = functionManager.getFunctionNames().length;
|
|
270241
270413
|
await functionManager.reload(functions);
|
|
270242
270414
|
const names = functionManager.getFunctionNames();
|
|
@@ -270591,7 +270763,7 @@ Examples:
|
|
|
270591
270763
|
}
|
|
270592
270764
|
|
|
270593
270765
|
// src/cli/commands/project/eject.ts
|
|
270594
|
-
import { resolve as
|
|
270766
|
+
import { resolve as resolve21 } from "node:path";
|
|
270595
270767
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
270596
270768
|
async function eject(ctx, options, command) {
|
|
270597
270769
|
const { log, runTask, isNonInteractive } = ctx;
|
|
@@ -270655,7 +270827,7 @@ async function eject(ctx, options, command) {
|
|
|
270655
270827
|
Ne("Operation cancelled.");
|
|
270656
270828
|
throw new CLIExitError(0);
|
|
270657
270829
|
}
|
|
270658
|
-
const resolvedPath =
|
|
270830
|
+
const resolvedPath = resolve21(selectedPath);
|
|
270659
270831
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
270660
270832
|
await createProjectFilesForExistingProject({
|
|
270661
270833
|
projectId,
|
|
@@ -274801,4 +274973,4 @@ export {
|
|
|
274801
274973
|
runCLI
|
|
274802
274974
|
};
|
|
274803
274975
|
|
|
274804
|
-
//# debugId=
|
|
274976
|
+
//# debugId=4C7BDDBFD564720964756E2164756E21
|