@base44-preview/cli 0.1.14-pr.626.999301d → 0.1.15-pr.626.2b403ee

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
@@ -31177,7 +31177,7 @@ function cleanDoc(doc) {
31177
31177
  return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
31178
31178
  }
31179
31179
  function replaceEndOfLine(doc, replacement = literalline) {
31180
- return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join29(replacement, currentDoc.split(`
31180
+ return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join30(replacement, currentDoc.split(`
31181
31181
  `)) : currentDoc);
31182
31182
  }
31183
31183
  function canBreakFn(doc) {
@@ -31257,7 +31257,7 @@ function indentIfBreak(contents, options) {
31257
31257
  negate: options.negate
31258
31258
  };
31259
31259
  }
31260
- function join29(separator, docs) {
31260
+ function join30(separator, docs) {
31261
31261
  assertDoc(separator);
31262
31262
  assertDocArray(docs);
31263
31263
  const parts = [];
@@ -31968,7 +31968,7 @@ var init_doc = __esm(() => {
31968
31968
  MODE_FLAT = Symbol("MODE_FLAT");
31969
31969
  DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
31970
31970
  builders = {
31971
- join: join29,
31971
+ join: join30,
31972
31972
  line,
31973
31973
  softline,
31974
31974
  hardline,
@@ -228634,6 +228634,10 @@ class InternalError extends SystemError {
228634
228634
  }
228635
228635
  }
228636
228636
 
228637
+ class ResourceDeploymentError extends SystemError {
228638
+ code = "RESOURCE_DEPLOYMENT_FAILED";
228639
+ }
228640
+
228637
228641
  class TypeGenerationError extends SystemError {
228638
228642
  code = "TYPE_GENERATION_ERROR";
228639
228643
  constructor(message, entityName, cause) {
@@ -228779,7 +228783,7 @@ function normalizeBase44Env() {
228779
228783
  loadProjectEnvFiles();
228780
228784
 
228781
228785
  // src/cli/index.ts
228782
- import { dirname as dirname27, join as join38 } from "node:path";
228786
+ import { dirname as dirname29, join as join39 } from "node:path";
228783
228787
  import { fileURLToPath as fileURLToPath6 } from "node:url";
228784
228788
 
228785
228789
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -229905,8 +229909,10 @@ var {
229905
229909
  Help: Help2
229906
229910
  } = exports_commander;
229907
229911
 
229908
- // src/cli/commands/agent-skills/pull.ts
229909
- import { dirname as dirname11, join as join18 } from "node:path";
229912
+ // src/cli/commands/functions/parseNames.ts
229913
+ function parseNames(args) {
229914
+ return args.flatMap((arg) => arg.split(",")).map((n) => n.trim()).filter(Boolean);
229915
+ }
229910
229916
  // ../../node_modules/chalk/source/vendor/ansi-styles/index.js
229911
229917
  var ANSI_BACKGROUND_OFFSET = 10;
229912
229918
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -230720,6 +230726,7 @@ var ProjectConfigSchema = object({
230720
230726
  site: SiteConfigSchema.optional(),
230721
230727
  entitiesDir: string2().optional().default("entities"),
230722
230728
  functionsDir: string2().optional().default("functions"),
230729
+ actorsDir: string2().optional().default("actors"),
230723
230730
  agentsDir: string2().optional().default("agents"),
230724
230731
  agentSkillsDir: string2().optional().default("agent-skills"),
230725
230732
  connectorsDir: string2().optional().default("connectors"),
@@ -236672,7 +236679,7 @@ async function getSiteUrl() {
236672
236679
  return result.data.url;
236673
236680
  }
236674
236681
  // src/core/project/config.ts
236675
- import { dirname as dirname8, join as join11 } from "node:path";
236682
+ import { dirname as dirname10, join as join12 } from "node:path";
236676
236683
 
236677
236684
  // src/core/project/plugins.ts
236678
236685
  import { createRequire as createRequire2 } from "node:module";
@@ -236710,6 +236717,159 @@ function markPluginEntities(entities, pluginNamespace) {
236710
236717
  }));
236711
236718
  }
236712
236719
 
236720
+ // src/core/resources/actor/schema.ts
236721
+ var RESERVED_NAMES = new Set(("await break case catch class const continue debugger default delete do else " + "enum export extends false finally for function if import in instanceof let " + "new null return static super switch this throw true try typeof var void " + "while with yield implements interface package private protected public " + "eval arguments").split(" "));
236722
+ var ActorNameSchema = string2().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$(?![\s\S])/, "Actor names must be JavaScript identifiers of at most 128 characters (letters, digits, and underscores)").refine((name) => !RESERVED_NAMES.has(name), {
236723
+ message: "Actor names cannot be JavaScript reserved words"
236724
+ });
236725
+ function validateActorName(name) {
236726
+ const result = ActorNameSchema.safeParse(name);
236727
+ if (!result.success) {
236728
+ throw new SchemaValidationError(`Invalid actor name '${name}'`, result.error);
236729
+ }
236730
+ }
236731
+ var ActorDefinitionSchema = object({
236732
+ name: ActorNameSchema,
236733
+ entry: _enum(["entry.ts", "entry.js"]),
236734
+ entryPath: string2().min(1),
236735
+ filePaths: array(string2()).min(1),
236736
+ source: object({ type: literal("project") })
236737
+ });
236738
+ var ActorDeployPayloadSchema = object({
236739
+ entry: _enum(["entry.ts", "entry.js"]),
236740
+ files: array(object({ path: string2().min(1), content: string2() })).min(1)
236741
+ });
236742
+ var DeployActorResponseSchema = object({
236743
+ status: _enum(["deployed", "unchanged"]),
236744
+ warnings: array(string2()).optional().default([])
236745
+ });
236746
+ var DeleteActorResponseSchema = object({ status: literal("deleted"), handler_name: ActorNameSchema }).transform((data) => ({
236747
+ status: data.status,
236748
+ handlerName: data.handler_name
236749
+ }));
236750
+
236751
+ // src/core/resources/actor/api.ts
236752
+ async function deploySingleActor(name, payload) {
236753
+ validateActorName(name);
236754
+ const input = ActorDeployPayloadSchema.safeParse(payload);
236755
+ if (!input.success)
236756
+ throw new SchemaValidationError("Invalid actor deployment", input.error);
236757
+ let response;
236758
+ try {
236759
+ response = await getAppClient().put(`actors/${encodeURIComponent(name)}`, {
236760
+ json: input.data,
236761
+ timeout: false
236762
+ });
236763
+ } catch (error) {
236764
+ throw await ApiError.fromHttpError(error, `deploying actor "${name}"`);
236765
+ }
236766
+ const result = DeployActorResponseSchema.safeParse(await response.json());
236767
+ if (!result.success)
236768
+ throw new SchemaValidationError("Invalid actor deployment response", result.error);
236769
+ return result.data;
236770
+ }
236771
+ async function deleteSingleActor(name) {
236772
+ validateActorName(name);
236773
+ let response;
236774
+ try {
236775
+ response = await getAppClient().delete(`actors/${encodeURIComponent(name)}`, { timeout: 60000 });
236776
+ } catch (error) {
236777
+ throw await ApiError.fromHttpError(error, `deleting actor "${name}"`);
236778
+ }
236779
+ const result = DeleteActorResponseSchema.safeParse(await response.json());
236780
+ if (!result.success)
236781
+ throw new SchemaValidationError("Invalid actor deletion response", result.error);
236782
+ return result.data;
236783
+ }
236784
+ // src/core/resources/actor/config.ts
236785
+ import { basename as basename3, dirname as dirname6, join as join5, relative } from "node:path";
236786
+ async function readAllActors(actorsDir) {
236787
+ if (!await pathExists(actorsDir))
236788
+ return [];
236789
+ const entries = await globby(ENTRY_FILE_GLOB, {
236790
+ cwd: actorsDir,
236791
+ absolute: true,
236792
+ ignore: ENTRY_IGNORE_DOT_PATHS
236793
+ });
236794
+ const actors = [];
236795
+ const names = new Set;
236796
+ for (const entryPath of entries.sort()) {
236797
+ const actorDir = dirname6(entryPath);
236798
+ const name = relative(actorsDir, actorDir).split(/[/\\]/).join("/");
236799
+ if (!name) {
236800
+ throw new InvalidInputError("entry.ts or entry.js found directly in the actors directory — it must be inside a named subfolder");
236801
+ }
236802
+ if (name.includes("/")) {
236803
+ throw new InvalidInputError(`Invalid actor name '${name}' — actors cannot be nested`);
236804
+ }
236805
+ validateActorName(name);
236806
+ if (names.has(name)) {
236807
+ throw new ConfigInvalidError(`Duplicate actor name "${name}" in ${actorsDir}`, actorsDir);
236808
+ }
236809
+ names.add(name);
236810
+ const filePaths = (await globby(BACKEND_FILE_GLOB, { cwd: actorDir, absolute: true })).sort();
236811
+ const entry = basename3(entryPath) === "entry.js" ? "entry.js" : "entry.ts";
236812
+ actors.push({
236813
+ name,
236814
+ entry,
236815
+ entryPath: join5(actorDir, entry),
236816
+ filePaths,
236817
+ source: { type: "project" }
236818
+ });
236819
+ }
236820
+ return actors;
236821
+ }
236822
+ // src/core/resources/actor/deploy.ts
236823
+ import { dirname as dirname7, relative as relative2 } from "node:path";
236824
+ function actorOperationError(name, error) {
236825
+ return {
236826
+ name,
236827
+ status: "error",
236828
+ error: error instanceof Error ? error.message : String(error),
236829
+ ...error instanceof ApiError ? { statusCode: error.statusCode, requestId: error.requestId } : {}
236830
+ };
236831
+ }
236832
+ function describeActorResult(result) {
236833
+ if (result.status !== "error")
236834
+ return `${result.name}: ${result.status}`;
236835
+ const context = [
236836
+ result.statusCode === undefined ? undefined : `HTTP ${result.statusCode}`,
236837
+ result.requestId ? `request ${result.requestId}` : undefined
236838
+ ].filter(Boolean).join(", ");
236839
+ return `${result.name}: error — ${result.error}${context ? ` (${context})` : ""}`;
236840
+ }
236841
+ async function deployOne(actor) {
236842
+ const start = Date.now();
236843
+ try {
236844
+ const actorDir = dirname7(actor.entryPath);
236845
+ const files = await Promise.all(actor.filePaths.map(async (filePath) => ({
236846
+ path: relative2(actorDir, filePath).split(/[/\\]/).join("/"),
236847
+ content: await readTextFile(filePath)
236848
+ })));
236849
+ const response = await deploySingleActor(actor.name, {
236850
+ entry: actor.entry,
236851
+ files
236852
+ });
236853
+ return { name: actor.name, ...response, durationMs: Date.now() - start };
236854
+ } catch (error) {
236855
+ return actorOperationError(actor.name, error);
236856
+ }
236857
+ }
236858
+ async function deployActorsSequentially(actors, options) {
236859
+ const results = [];
236860
+ for (const actor of actors) {
236861
+ options?.onStart?.(actor.name);
236862
+ const result = await deployOne(actor);
236863
+ results.push(result);
236864
+ options?.onResult?.(result);
236865
+ }
236866
+ return results;
236867
+ }
236868
+ // src/core/resources/actor/resource.ts
236869
+ var actorResource = {
236870
+ readAll: readAllActors,
236871
+ push: deployActorsSequentially
236872
+ };
236713
236873
  // src/core/resources/agent/schema.ts
236714
236874
  var EntityOperationSchema = _enum(["create", "update", "delete", "read"]);
236715
236875
  var EntityToolConfigSchema = object({
@@ -236788,7 +236948,7 @@ async function fetchAgents() {
236788
236948
  return result.data;
236789
236949
  }
236790
236950
  // src/core/resources/agent/config.ts
236791
- import { join as join5, normalize } from "node:path";
236951
+ import { join as join6, normalize } from "node:path";
236792
236952
  import { isDeepStrictEqual } from "node:util";
236793
236953
  async function readAgentFile(agentPath) {
236794
236954
  const raw = await readJsonFile(agentPath);
@@ -236833,12 +236993,12 @@ async function readAllAgents(agentsDir) {
236833
236993
  return [...nameToEntry.values()].map((e) => e.data);
236834
236994
  }
236835
236995
  function findAvailablePath(agentsDir, name, claimedPaths) {
236836
- const base = join5(agentsDir, `${name}.${CONFIG_FILE_EXTENSION}`);
236996
+ const base = join6(agentsDir, `${name}.${CONFIG_FILE_EXTENSION}`);
236837
236997
  if (!claimedPaths.has(base)) {
236838
236998
  return base;
236839
236999
  }
236840
237000
  for (let i = 1;; i++) {
236841
- const candidate = join5(agentsDir, `${name}_${i}.${CONFIG_FILE_EXTENSION}`);
237001
+ const candidate = join6(agentsDir, `${name}_${i}.${CONFIG_FILE_EXTENSION}`);
236842
237002
  if (!claimedPaths.has(candidate)) {
236843
237003
  return candidate;
236844
237004
  }
@@ -236953,7 +237113,7 @@ async function pushAgentSkills(skills) {
236953
237113
  }
236954
237114
  // src/core/resources/agent-skill/config.ts
236955
237115
  var import_front_matter = __toESM(require_front_matter(), 1);
236956
- import { join as join6 } from "node:path";
237116
+ import { join as join7 } from "node:path";
236957
237117
 
236958
237118
  // ../../node_modules/yaml/dist/index.js
236959
237119
  var composer = require_composer();
@@ -237039,7 +237199,7 @@ async function writeAgentSkills(dir, remote) {
237039
237199
  const deleted = [];
237040
237200
  for (const skill of existing) {
237041
237201
  if (!remoteNames.has(skill.name)) {
237042
- await deleteFile(join6(dir, `${skill.name}.md`));
237202
+ await deleteFile(join7(dir, `${skill.name}.md`));
237043
237203
  deleted.push(skill.name);
237044
237204
  }
237045
237205
  }
@@ -237050,7 +237210,7 @@ async function writeAgentSkills(dir, remote) {
237050
237210
  if (prev && prev.description === skill.description && prev.body === skill.body) {
237051
237211
  continue;
237052
237212
  }
237053
- await writeFile(join6(dir, `${skill.name}.md`), serializeSkillFile(skill));
237213
+ await writeFile(join7(dir, `${skill.name}.md`), serializeSkillFile(skill));
237054
237214
  written.push(skill.name);
237055
237215
  }
237056
237216
  return { written, deleted };
@@ -237176,7 +237336,7 @@ async function pushAuthConfigToApi(config) {
237176
237336
  return result.data.authConfig;
237177
237337
  }
237178
237338
  // src/core/resources/auth-config/config.ts
237179
- import { join as join7 } from "node:path";
237339
+ import { join as join8 } from "node:path";
237180
237340
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
237181
237341
  var AUTH_CONFIG_FILENAME = `config.${CONFIG_FILE_EXTENSION}`;
237182
237342
  var DEFAULT_AUTH_CONFIG = {
@@ -237192,7 +237352,7 @@ var DEFAULT_AUTH_CONFIG = {
237192
237352
  useWorkspaceSSO: false
237193
237353
  };
237194
237354
  function getAuthConfigPath(authDir) {
237195
- return join7(authDir, AUTH_CONFIG_FILENAME);
237355
+ return join8(authDir, AUTH_CONFIG_FILENAME);
237196
237356
  }
237197
237357
  async function readAuthConfig(authDir) {
237198
237358
  const filePath = getAuthConfigPath(authDir);
@@ -237844,7 +238004,7 @@ async function removeStripe() {
237844
238004
  return result.data;
237845
238005
  }
237846
238006
  // src/core/resources/connector/config.ts
237847
- import { join as join8 } from "node:path";
238007
+ import { join as join9 } from "node:path";
237848
238008
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
237849
238009
  async function readConnectorFile(connectorPath) {
237850
238010
  const parsed = await readJsonFile(connectorPath);
@@ -237905,7 +238065,7 @@ async function writeConnectors(connectorsDir, remoteConnectors) {
237905
238065
  if (existing && isDeepStrictEqual3(existing.data, connector)) {
237906
238066
  continue;
237907
238067
  }
237908
- const filePath = existing?.filePath ?? join8(connectorsDir, `${connector.type}.${CONFIG_FILE_EXTENSION}`);
238068
+ const filePath = existing?.filePath ?? join9(connectorsDir, `${connector.type}.${CONFIG_FILE_EXTENSION}`);
237909
238069
  await writeJsonFile(filePath, connector);
237910
238070
  written.push(connector.type);
237911
238071
  }
@@ -238511,7 +238671,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
238511
238671
  return result.data;
238512
238672
  }
238513
238673
  // src/core/resources/function/config.ts
238514
- import { basename as basename3, dirname as dirname6, join as join9, relative, resolve as resolve2 } from "node:path";
238674
+ import { basename as basename4, dirname as dirname8, join as join10, relative as relative3, resolve as resolve2 } from "node:path";
238515
238675
  async function readSharedFiles(functionsDir) {
238516
238676
  const sharedDir = resolve2(functionsDir, "..", "shared");
238517
238677
  if (!await pathExists(sharedDir)) {
@@ -238529,8 +238689,8 @@ async function readFunctionConfig(configPath) {
238529
238689
  }
238530
238690
  async function readFunction(configPath, sharedFiles) {
238531
238691
  const config = await readFunctionConfig(configPath);
238532
- const functionDir = dirname6(configPath);
238533
- const entryPath = join9(functionDir, config.entry);
238692
+ const functionDir = dirname8(configPath);
238693
+ const entryPath = join10(functionDir, config.entry);
238534
238694
  if (!await pathExists(entryPath)) {
238535
238695
  throw new InvalidInputError(`Function entry file not found: ${entryPath} (referenced in ${configPath})`, {
238536
238696
  hints: [{ message: "Check the 'entry' field in your function config" }]
@@ -238562,18 +238722,18 @@ async function readAllFunctions(functionsDir) {
238562
238722
  absolute: true,
238563
238723
  ignore: ENTRY_IGNORE_DOT_PATHS
238564
238724
  });
238565
- const configFilesDirs = new Set(configFiles.map((f) => dirname6(f)));
238566
- const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname6(entryFile)));
238725
+ const configFilesDirs = new Set(configFiles.map((f) => dirname8(f)));
238726
+ const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname8(entryFile)));
238567
238727
  const sharedFiles = await readSharedFiles(functionsDir);
238568
238728
  const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath, sharedFiles)));
238569
238729
  const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
238570
- const functionDir = dirname6(entryFile);
238730
+ const functionDir = dirname8(entryFile);
238571
238731
  const filePaths = await globby(BACKEND_FILE_GLOB, {
238572
238732
  cwd: functionDir,
238573
238733
  absolute: true
238574
238734
  });
238575
238735
  const allFilePaths = [...new Set([...filePaths, ...sharedFiles])];
238576
- const name = relative(functionsDir, functionDir).split(/[/\\]/).join("/");
238736
+ const name = relative3(functionsDir, functionDir).split(/[/\\]/).join("/");
238577
238737
  if (!name) {
238578
238738
  throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
238579
238739
  hints: [
@@ -238583,7 +238743,7 @@ async function readAllFunctions(functionsDir) {
238583
238743
  ]
238584
238744
  });
238585
238745
  }
238586
- const entry = basename3(entryFile);
238746
+ const entry = basename4(entryFile);
238587
238747
  const functionData = {
238588
238748
  name,
238589
238749
  entry,
@@ -238610,17 +238770,17 @@ async function readAllFunctions(functionsDir) {
238610
238770
  return functions;
238611
238771
  }
238612
238772
  // src/core/resources/function/deploy.ts
238613
- import { dirname as dirname7, relative as relative2 } from "node:path";
238773
+ import { dirname as dirname9, relative as relative4 } from "node:path";
238614
238774
  async function loadFunctionCode(fn) {
238615
- const functionDir = dirname7(fn.entryPath);
238775
+ const functionDir = dirname9(fn.entryPath);
238616
238776
  const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
238617
238777
  const content = await readTextFile(filePath);
238618
- const path = relative2(functionDir, filePath).split(/[/\\]/).join("/");
238778
+ const path = relative4(functionDir, filePath).split(/[/\\]/).join("/");
238619
238779
  return { path, content };
238620
238780
  }));
238621
238781
  return { ...fn, files: resolvedFiles };
238622
238782
  }
238623
- async function deployOne(fn) {
238783
+ async function deployOne2(fn) {
238624
238784
  const start = Date.now();
238625
238785
  try {
238626
238786
  const functionWithCode = await loadFunctionCode(fn);
@@ -238648,7 +238808,7 @@ async function deployFunctionsSequentially(functions, options) {
238648
238808
  const results = [];
238649
238809
  for (const fn of functions) {
238650
238810
  options?.onStart?.([fn.name]);
238651
- const result = await deployOne(fn);
238811
+ const result = await deployOne2(fn);
238652
238812
  results.push(result);
238653
238813
  options?.onResult?.(result);
238654
238814
  }
@@ -238679,14 +238839,14 @@ async function pruneRemovedFunctions(localFunctionNames, options) {
238679
238839
  return results;
238680
238840
  }
238681
238841
  // src/core/resources/function/pull.ts
238682
- import { join as join10 } from "node:path";
238842
+ import { join as join11 } from "node:path";
238683
238843
  import { isDeepStrictEqual as isDeepStrictEqual4 } from "node:util";
238684
238844
  async function writeFunctions(functionsDir, functions) {
238685
238845
  const written = [];
238686
238846
  const skipped = [];
238687
238847
  for (const fn of functions) {
238688
- const functionDir = join10(functionsDir, fn.name);
238689
- const configPath = join10(functionDir, "function.jsonc");
238848
+ const functionDir = join11(functionsDir, fn.name);
238849
+ const configPath = join11(functionDir, "function.jsonc");
238690
238850
  if (await isFunctionUnchanged(functionDir, fn)) {
238691
238851
  skipped.push(fn.name);
238692
238852
  continue;
@@ -238700,7 +238860,7 @@ async function writeFunctions(functionsDir, functions) {
238700
238860
  }
238701
238861
  await writeJsonFile(configPath, config);
238702
238862
  for (const file of fn.files) {
238703
- await writeFile(join10(functionDir, file.path), file.content);
238863
+ await writeFile(join11(functionDir, file.path), file.content);
238704
238864
  }
238705
238865
  written.push(fn.name);
238706
238866
  }
@@ -238710,7 +238870,7 @@ async function isFunctionUnchanged(functionDir, fn) {
238710
238870
  if (!await pathExists(functionDir)) {
238711
238871
  return false;
238712
238872
  }
238713
- const configPath = join10(functionDir, "function.jsonc");
238873
+ const configPath = join11(functionDir, "function.jsonc");
238714
238874
  try {
238715
238875
  const localConfig = await readJsonFile(configPath);
238716
238876
  if (localConfig.entry !== fn.entry) {
@@ -238723,7 +238883,7 @@ async function isFunctionUnchanged(functionDir, fn) {
238723
238883
  return false;
238724
238884
  }
238725
238885
  for (const file of fn.files) {
238726
- const filePath = join10(functionDir, file.path);
238886
+ const filePath = join11(functionDir, file.path);
238727
238887
  if (!await pathExists(filePath)) {
238728
238888
  return false;
238729
238889
  }
@@ -238895,10 +239055,17 @@ class ProjectConfigReader {
238895
239055
  ...pluginResources.functions
238896
239056
  ];
238897
239057
  this.validateFunctionNames(functions, configPath);
239058
+ const functionNames = new Set(functions.map((fn) => fn.name));
239059
+ for (const actor of localResources.actors) {
239060
+ if (functionNames.has(actor.name)) {
239061
+ throw new ConfigInvalidError(`'${actor.name}' exists as both a backend function and an actor`, configPath);
239062
+ }
239063
+ }
238898
239064
  return {
238899
239065
  project,
238900
239066
  entities,
238901
239067
  functions,
239068
+ actors: localResources.actors,
238902
239069
  agents: localResources.agents,
238903
239070
  agentSkills: localResources.agentSkills,
238904
239071
  connectors: localResources.connectors,
@@ -238926,17 +239093,34 @@ class ProjectConfigReader {
238926
239093
  }
238927
239094
  return result.data;
238928
239095
  }
238929
- async readProjectResources(configPath, project) {
238930
- const configDir = dirname8(configPath);
238931
- const [entities, functions, agents, agentSkills, connectors, authConfig] = await Promise.all([
238932
- entityResource.readAll(join11(configDir, project.entitiesDir)),
238933
- functionResource.readAll(join11(configDir, project.functionsDir)),
238934
- agentResource.readAll(join11(configDir, project.agentsDir)),
238935
- agentSkillResource.readAll(join11(configDir, project.agentSkillsDir)),
238936
- connectorResource.readAll(join11(configDir, project.connectorsDir)),
238937
- authConfigResource.readAll(join11(configDir, project.authDir))
239096
+ async readProjectResources(configPath, project, includeActors = true) {
239097
+ const configDir = dirname10(configPath);
239098
+ const [
239099
+ entities,
239100
+ functions,
239101
+ actors,
239102
+ agents,
239103
+ agentSkills,
239104
+ connectors,
239105
+ authConfig
239106
+ ] = await Promise.all([
239107
+ entityResource.readAll(join12(configDir, project.entitiesDir)),
239108
+ functionResource.readAll(join12(configDir, project.functionsDir)),
239109
+ includeActors ? actorResource.readAll(join12(configDir, project.actorsDir)) : Promise.resolve([]),
239110
+ agentResource.readAll(join12(configDir, project.agentsDir)),
239111
+ agentSkillResource.readAll(join12(configDir, project.agentSkillsDir)),
239112
+ connectorResource.readAll(join12(configDir, project.connectorsDir)),
239113
+ authConfigResource.readAll(join12(configDir, project.authDir))
238938
239114
  ]);
238939
- return { entities, functions, agents, agentSkills, connectors, authConfig };
239115
+ return {
239116
+ entities,
239117
+ functions,
239118
+ actors,
239119
+ agents,
239120
+ agentSkills,
239121
+ connectors,
239122
+ authConfig
239123
+ };
238940
239124
  }
238941
239125
  assertPluginProjectDoesNotLoadPlugins(project, configPath) {
238942
239126
  if (project.plugin && project.plugins.length > 0) {
@@ -238957,7 +239141,7 @@ class ProjectConfigReader {
238957
239141
  this.pluginSourceByNamespace.set(namespace, source);
238958
239142
  }
238959
239143
  async readPluginConfig(plugin, hostConfigPath) {
238960
- const pluginRoot = resolvePluginRoot(plugin.source, dirname8(hostConfigPath));
239144
+ const pluginRoot = resolvePluginRoot(plugin.source, dirname10(hostConfigPath));
238961
239145
  const { configPath } = await this.findConfigOrThrow(pluginRoot);
238962
239146
  const project = await this.readConfigFile(configPath);
238963
239147
  const namespace = requirePluginNamespace(project, plugin.source, configPath);
@@ -238965,10 +239149,11 @@ class ProjectConfigReader {
238965
239149
  return { configPath, namespace, project, source: plugin.source };
238966
239150
  }
238967
239151
  async readPluginResources(project, configPath, namespace) {
238968
- const resources = await this.readProjectResources(configPath, project);
239152
+ const resources = await this.readProjectResources(configPath, project, false);
238969
239153
  return {
238970
239154
  entities: markPluginEntities(resources.entities, namespace),
238971
239155
  functions: namespacePluginFunctions(resources.functions, namespace),
239156
+ actors: [],
238972
239157
  agents: [],
238973
239158
  agentSkills: [],
238974
239159
  connectors: [],
@@ -239007,6 +239192,7 @@ class ProjectConfigReader {
239007
239192
  return {
239008
239193
  entities,
239009
239194
  functions,
239195
+ actors: [],
239010
239196
  agents: [],
239011
239197
  agentSkills: [],
239012
239198
  connectors: [],
@@ -239041,16 +239227,16 @@ async function readProjectSettings(projectRoot) {
239041
239227
  // src/core/project/template.ts
239042
239228
  var import_ejs = __toESM(require_ejs(), 1);
239043
239229
  var import_front_matter2 = __toESM(require_front_matter(), 1);
239044
- import { dirname as dirname9, join as join13 } from "node:path";
239230
+ import { dirname as dirname11, join as join14 } from "node:path";
239045
239231
 
239046
239232
  // src/core/assets.ts
239047
239233
  import { cpSync, existsSync } from "node:fs";
239048
239234
  import { homedir as homedir2 } from "node:os";
239049
- import { join as join12 } from "node:path";
239235
+ import { join as join13 } from "node:path";
239050
239236
  // package.json
239051
239237
  var package_default = {
239052
239238
  name: "base44",
239053
- version: "0.1.14",
239239
+ version: "0.1.15",
239054
239240
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239055
239241
  type: "module",
239056
239242
  bin: {
@@ -239153,21 +239339,21 @@ var package_default = {
239153
239339
  };
239154
239340
 
239155
239341
  // src/core/assets.ts
239156
- var ASSETS_DIR = join12(homedir2(), ".base44", "assets", package_default.version);
239342
+ var ASSETS_DIR = join13(homedir2(), ".base44", "assets", package_default.version);
239157
239343
  function getTemplatesDir() {
239158
- return join12(ASSETS_DIR, "templates");
239344
+ return join13(ASSETS_DIR, "templates");
239159
239345
  }
239160
239346
  function getTemplatesIndexPath() {
239161
- return join12(ASSETS_DIR, "templates", "templates.json");
239347
+ return join13(ASSETS_DIR, "templates", "templates.json");
239162
239348
  }
239163
239349
  function getBackendRuntimeDir() {
239164
- return join12(ASSETS_DIR, "backend-runtime");
239350
+ return join13(ASSETS_DIR, "backend-runtime");
239165
239351
  }
239166
239352
  function getDenoWrapperPath() {
239167
- return join12(getBackendRuntimeDir(), "main.ts");
239353
+ return join13(getBackendRuntimeDir(), "main.ts");
239168
239354
  }
239169
239355
  function getExecWrapperPath() {
239170
- return join12(getBackendRuntimeDir(), "exec.ts");
239356
+ return join13(getBackendRuntimeDir(), "exec.ts");
239171
239357
  }
239172
239358
  function ensureNpmAssets(sourceDir) {
239173
239359
  if (existsSync(ASSETS_DIR) && existsSync(getBackendRuntimeDir()))
@@ -239189,7 +239375,7 @@ async function listTemplates() {
239189
239375
  }
239190
239376
  async function renderTemplate(template, destPath, data, options = {}) {
239191
239377
  const { skipExisting = false } = options;
239192
- const templateDir = join13(getTemplatesDir(), template.path);
239378
+ const templateDir = join14(getTemplatesDir(), template.path);
239193
239379
  const files = await globby("**/*", {
239194
239380
  cwd: templateDir,
239195
239381
  dot: true,
@@ -239197,20 +239383,20 @@ async function renderTemplate(template, destPath, data, options = {}) {
239197
239383
  });
239198
239384
  const skipped = [];
239199
239385
  for (const file of files) {
239200
- const srcPath = join13(templateDir, file);
239386
+ const srcPath = join14(templateDir, file);
239201
239387
  try {
239202
239388
  if (file.endsWith(".ejs")) {
239203
239389
  const rendered = await import_ejs.default.renderFile(srcPath, data);
239204
239390
  const { attributes, body } = import_front_matter2.default(rendered);
239205
- const destFile = attributes.outputFileName ? join13(dirname9(file), attributes.outputFileName) : file.replace(/\.ejs$/, "");
239206
- const destFilePath = join13(destPath, destFile);
239391
+ const destFile = attributes.outputFileName ? join14(dirname11(file), attributes.outputFileName) : file.replace(/\.ejs$/, "");
239392
+ const destFilePath = join14(destPath, destFile);
239207
239393
  if (skipExisting && await pathExists(destFilePath)) {
239208
239394
  skipped.push(destFile);
239209
239395
  continue;
239210
239396
  }
239211
239397
  await writeFile(destFilePath, body);
239212
239398
  } else {
239213
- const destFilePath = join13(destPath, file);
239399
+ const destFilePath = join14(destPath, file);
239214
239400
  if (skipExisting && await pathExists(destFilePath)) {
239215
239401
  skipped.push(file);
239216
239402
  continue;
@@ -239364,7 +239550,7 @@ async function getSiteFilePaths(outputDir) {
239364
239550
  // src/core/site/deploy.ts
239365
239551
  import { randomUUID } from "node:crypto";
239366
239552
  import { tmpdir } from "node:os";
239367
- import { join as join14 } from "node:path";
239553
+ import { join as join15 } from "node:path";
239368
239554
  async function deploySite(siteOutputDir) {
239369
239555
  if (!await pathExists(siteOutputDir)) {
239370
239556
  throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
@@ -239385,7 +239571,7 @@ async function deploySite(siteOutputDir) {
239385
239571
  ]
239386
239572
  });
239387
239573
  }
239388
- const archivePath = join14(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
239574
+ const archivePath = join15(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
239389
239575
  try {
239390
239576
  await createArchive(siteOutputDir, archivePath);
239391
239577
  return await uploadSite(archivePath);
@@ -239402,94 +239588,11 @@ async function createArchive(pathToArchive, targetArchivePath) {
239402
239588
  }
239403
239589
  // src/core/site/deployment.ts
239404
239590
  import { readFile as readFile3 } from "node:fs/promises";
239405
- import { join as join17 } from "node:path";
239406
-
239407
- // src/core/site/manifest.ts
239408
- import { createHash } from "node:crypto";
239409
- import { createReadStream } from "node:fs";
239410
- import { stat } from "node:fs/promises";
239411
- import { basename as basename4, extname, join as join15 } from "node:path";
239412
- var MAX_ASSET_COUNT = 1e5;
239413
- var ASSETS_IGNORE_FILE = ".assetsignore";
239414
- var ALWAYS_IGNORED = new Set([
239415
- ASSETS_IGNORE_FILE,
239416
- "wrangler.json",
239417
- ".dev.vars"
239418
- ]);
239419
- var MIME_TYPES = {
239420
- ".html": "text/html",
239421
- ".htm": "text/html",
239422
- ".css": "text/css",
239423
- ".js": "text/javascript",
239424
- ".mjs": "text/javascript",
239425
- ".json": "application/json",
239426
- ".map": "application/json",
239427
- ".txt": "text/plain",
239428
- ".xml": "application/xml",
239429
- ".svg": "image/svg+xml",
239430
- ".png": "image/png",
239431
- ".jpg": "image/jpeg",
239432
- ".jpeg": "image/jpeg",
239433
- ".gif": "image/gif",
239434
- ".webp": "image/webp",
239435
- ".avif": "image/avif",
239436
- ".ico": "image/x-icon",
239437
- ".woff": "font/woff",
239438
- ".woff2": "font/woff2",
239439
- ".ttf": "font/ttf",
239440
- ".otf": "font/otf",
239441
- ".eot": "application/vnd.ms-fontobject",
239442
- ".mp3": "audio/mpeg",
239443
- ".mp4": "video/mp4",
239444
- ".webm": "video/webm",
239445
- ".pdf": "application/pdf",
239446
- ".wasm": "application/wasm",
239447
- ".webmanifest": "application/manifest+json"
239448
- };
239449
- function getAssetContentType(filePath) {
239450
- return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
239451
- }
239452
- async function hashAssetFile(appId, absolutePath) {
239453
- const hash = createHash("sha256").update(Buffer.from(appId, "utf8"));
239454
- for await (const chunk of createReadStream(absolutePath)) {
239455
- hash.update(chunk);
239456
- }
239457
- return hash.digest("hex").slice(0, 32);
239458
- }
239459
- async function buildAssetManifest(assetsDir, appId) {
239460
- const manifest = {};
239461
- const filesByHash = new Map;
239462
- const found = await globby("**/*", {
239463
- cwd: assetsDir,
239464
- dot: true,
239465
- onlyFiles: true,
239466
- followSymbolicLinks: false,
239467
- ignoreFiles: [ASSETS_IGNORE_FILE]
239468
- });
239469
- const relativeFilePaths = found.filter((path) => !ALWAYS_IGNORED.has(basename4(path)));
239470
- if (relativeFilePaths.length > MAX_ASSET_COUNT) {
239471
- throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
239472
- }
239473
- for (const relativePath of relativeFilePaths.sort()) {
239474
- const absolutePath = join15(assetsDir, ...relativePath.split("/"));
239475
- const { size } = await stat(absolutePath);
239476
- const hash = await hashAssetFile(appId, absolutePath);
239477
- manifest[`/${relativePath}`] = { hash, size };
239478
- if (!filesByHash.has(hash)) {
239479
- filesByHash.set(hash, {
239480
- absolutePath,
239481
- hash,
239482
- size,
239483
- contentType: getAssetContentType(absolutePath)
239484
- });
239485
- }
239486
- }
239487
- return { manifest, filesByHash };
239488
- }
239591
+ import { join as join18 } from "node:path";
239489
239592
 
239490
239593
  // src/core/site/modules.ts
239491
- import { stat as stat2 } from "node:fs/promises";
239492
- import { relative as relative3, resolve as resolve3, sep } from "node:path";
239594
+ import { stat } from "node:fs/promises";
239595
+ import { relative as relative5, resolve as resolve3, sep } from "node:path";
239493
239596
  var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
239494
239597
  var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
239495
239598
  var RULE_TYPE_TO_MODULE_TYPE = {
@@ -239509,7 +239612,7 @@ async function collectModules(config) {
239509
239612
  });
239510
239613
  }
239511
239614
  const modulesByName = new Map;
239512
- const entryName = toPosix(relative3(config.configDir, entryPath));
239615
+ const entryName = toPosix(relative5(config.configDir, entryPath));
239513
239616
  modulesByName.set(entryName, {
239514
239617
  name: entryName,
239515
239618
  absolutePath: entryPath,
@@ -239518,7 +239621,7 @@ async function collectModules(config) {
239518
239621
  });
239519
239622
  const ignore = [...MODULE_IGNORE];
239520
239623
  if (config.assetsDirectory?.startsWith(config.configDir + sep)) {
239521
- ignore.push(`${toPosix(relative3(config.configDir, config.assetsDirectory))}/**`);
239624
+ ignore.push(`${toPosix(relative5(config.configDir, config.assetsDirectory))}/**`);
239522
239625
  }
239523
239626
  for (const rule of config.rules) {
239524
239627
  const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
@@ -239563,7 +239666,7 @@ async function collectModules(config) {
239563
239666
  const modules = [...modulesByName.values()];
239564
239667
  let totalBytes = 0;
239565
239668
  for (const module of modules) {
239566
- module.size = (await stat2(module.absolutePath)).size;
239669
+ module.size = (await stat(module.absolutePath)).size;
239567
239670
  totalBytes += module.size;
239568
239671
  }
239569
239672
  if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
@@ -239582,8 +239685,104 @@ function addSourcemap(modulesByName, configDir, name) {
239582
239685
  });
239583
239686
  }
239584
239687
 
239585
- // src/core/site/upload.ts
239586
- import { readFile as readFile2 } from "node:fs/promises";
239688
+ // src/core/site/wrangler-config.ts
239689
+ import { dirname as dirname12, join as join16, resolve as resolve4 } from "node:path";
239690
+ var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
239691
+ var RedirectConfigSchema = looseObject({
239692
+ configPath: string2().min(1)
239693
+ });
239694
+ var WranglerConfigSchema = looseObject({
239695
+ main: string2().min(1, "wrangler config is missing a 'main' entry module"),
239696
+ no_bundle: boolean2().optional(),
239697
+ rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
239698
+ assets: looseObject({
239699
+ directory: string2().optional(),
239700
+ html_handling: string2().optional(),
239701
+ not_found_handling: string2().optional(),
239702
+ run_worker_first: union([boolean2(), array(string2())]).optional(),
239703
+ headers: string2().optional(),
239704
+ redirects: string2().optional()
239705
+ }).optional(),
239706
+ compatibility_date: string2().optional(),
239707
+ compatibility_flags: array(string2()).optional(),
239708
+ vars: record(string2(), unknown()).optional(),
239709
+ upload_source_maps: boolean2().optional()
239710
+ });
239711
+ async function detectFullStackArtifact(projectRoot) {
239712
+ const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
239713
+ return await pathExists(redirectPath) ? redirectPath : null;
239714
+ }
239715
+ async function resolveWranglerConfig(redirectPath) {
239716
+ const configPath = await resolveRedirectedConfigPath(redirectPath);
239717
+ const parsed = await readJsonFile(configPath);
239718
+ const result = WranglerConfigSchema.safeParse(parsed);
239719
+ if (!result.success) {
239720
+ throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
239721
+ }
239722
+ const config = result.data;
239723
+ if (config.no_bundle !== true) {
239724
+ throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
239725
+ }
239726
+ const configDir = dirname12(configPath);
239727
+ const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
239728
+ return {
239729
+ configPath,
239730
+ configDir,
239731
+ main: config.main,
239732
+ assetsDirectory,
239733
+ assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
239734
+ compatibilityDate: config.compatibility_date ?? null,
239735
+ compatibilityFlags: config.compatibility_flags ?? [],
239736
+ rules: (config.rules ?? []).map((rule) => ({
239737
+ type: rule.type,
239738
+ globs: rule.globs
239739
+ })),
239740
+ uploadSourceMaps: config.upload_source_maps ?? false
239741
+ };
239742
+ }
239743
+ async function resolveRedirectedConfigPath(redirectPath) {
239744
+ const parsed = await readJsonFile(redirectPath);
239745
+ const result = RedirectConfigSchema.safeParse(parsed);
239746
+ if (!result.success) {
239747
+ throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
239748
+ }
239749
+ const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
239750
+ if (!await pathExists(configPath)) {
239751
+ throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
239752
+ hints: [{ message: "Rebuild the project to regenerate the artifact" }]
239753
+ });
239754
+ }
239755
+ return configPath;
239756
+ }
239757
+ function toResolvedAssetsConfig(assets) {
239758
+ return {
239759
+ htmlHandling: assets.html_handling,
239760
+ notFoundHandling: assets.not_found_handling,
239761
+ runWorkerFirst: assets.run_worker_first,
239762
+ headers: assets.headers,
239763
+ redirects: assets.redirects
239764
+ };
239765
+ }
239766
+
239767
+ // src/core/site/full-stack.ts
239768
+ async function resolveFullStackBuild(projectRoot) {
239769
+ const redirectPath = await detectFullStackArtifact(projectRoot);
239770
+ if (!redirectPath) {
239771
+ return null;
239772
+ }
239773
+ const config = await resolveWranglerConfig(redirectPath);
239774
+ return {
239775
+ config,
239776
+ modules: await collectModules(config),
239777
+ assetsDir: config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null
239778
+ };
239779
+ }
239780
+
239781
+ // src/core/site/manifest.ts
239782
+ import { createHash } from "node:crypto";
239783
+ import { createReadStream } from "node:fs";
239784
+ import { stat as stat2 } from "node:fs/promises";
239785
+ import { basename as basename5, extname, join as join17 } from "node:path";
239587
239786
 
239588
239787
  // ../../node_modules/p-map/index.js
239589
239788
  async function pMap(iterable, mapper, {
@@ -239709,7 +239908,99 @@ async function pMap(iterable, mapper, {
239709
239908
  }
239710
239909
  var pMapSkip = Symbol("skip");
239711
239910
 
239911
+ // src/core/site/manifest.ts
239912
+ var MAX_ASSET_COUNT = 1e5;
239913
+ var ASSETS_IGNORE_FILE = ".assetsignore";
239914
+ var ALWAYS_IGNORED = new Set([
239915
+ ASSETS_IGNORE_FILE,
239916
+ "wrangler.json",
239917
+ ".dev.vars"
239918
+ ]);
239919
+ var MIME_TYPES = {
239920
+ ".html": "text/html",
239921
+ ".htm": "text/html",
239922
+ ".css": "text/css",
239923
+ ".js": "text/javascript",
239924
+ ".mjs": "text/javascript",
239925
+ ".json": "application/json",
239926
+ ".map": "application/json",
239927
+ ".txt": "text/plain",
239928
+ ".xml": "application/xml",
239929
+ ".svg": "image/svg+xml",
239930
+ ".png": "image/png",
239931
+ ".jpg": "image/jpeg",
239932
+ ".jpeg": "image/jpeg",
239933
+ ".gif": "image/gif",
239934
+ ".webp": "image/webp",
239935
+ ".avif": "image/avif",
239936
+ ".ico": "image/x-icon",
239937
+ ".woff": "font/woff",
239938
+ ".woff2": "font/woff2",
239939
+ ".ttf": "font/ttf",
239940
+ ".otf": "font/otf",
239941
+ ".eot": "application/vnd.ms-fontobject",
239942
+ ".mp3": "audio/mpeg",
239943
+ ".mp4": "video/mp4",
239944
+ ".webm": "video/webm",
239945
+ ".pdf": "application/pdf",
239946
+ ".wasm": "application/wasm",
239947
+ ".webmanifest": "application/manifest+json"
239948
+ };
239949
+ function getAssetContentType(filePath) {
239950
+ return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
239951
+ }
239952
+ async function walkBuildOutput(outputDir) {
239953
+ const found = await globby("**/*", {
239954
+ cwd: outputDir,
239955
+ dot: true,
239956
+ onlyFiles: true,
239957
+ followSymbolicLinks: false,
239958
+ ignoreFiles: [ASSETS_IGNORE_FILE]
239959
+ });
239960
+ return found.filter((path) => !ALWAYS_IGNORED.has(basename5(path))).sort();
239961
+ }
239962
+ var STAT_CONCURRENCY = 32;
239963
+ async function describeBuildOutput(outputDir) {
239964
+ const relativePaths = await walkBuildOutput(outputDir);
239965
+ return await pMap(relativePaths, async (path) => {
239966
+ const absolutePath = join17(outputDir, ...path.split("/"));
239967
+ return { path, absolutePath, size: (await stat2(absolutePath)).size };
239968
+ }, { concurrency: STAT_CONCURRENCY });
239969
+ }
239970
+ async function hashFileInto(hash, absolutePath) {
239971
+ for await (const chunk of createReadStream(absolutePath)) {
239972
+ hash.update(chunk);
239973
+ }
239974
+ return hash;
239975
+ }
239976
+ async function hashAssetFile(appId, absolutePath) {
239977
+ const hash = await hashFileInto(createHash("sha256").update(Buffer.from(appId, "utf8")), absolutePath);
239978
+ return hash.digest("hex").slice(0, 32);
239979
+ }
239980
+ async function buildAssetManifest(assetsDir, appId) {
239981
+ const manifest = {};
239982
+ const filesByHash = new Map;
239983
+ const files = await describeBuildOutput(assetsDir);
239984
+ if (files.length > MAX_ASSET_COUNT) {
239985
+ throw new InvalidInputError(`Too many static assets: found ${files.length}, the limit is ${MAX_ASSET_COUNT} files.`);
239986
+ }
239987
+ for (const { path: relativePath, absolutePath, size } of files) {
239988
+ const hash = await hashAssetFile(appId, absolutePath);
239989
+ manifest[`/${relativePath}`] = { hash, size };
239990
+ if (!filesByHash.has(hash)) {
239991
+ filesByHash.set(hash, {
239992
+ absolutePath,
239993
+ hash,
239994
+ size,
239995
+ contentType: getAssetContentType(absolutePath)
239996
+ });
239997
+ }
239998
+ }
239999
+ return { manifest, filesByHash };
240000
+ }
240001
+
239712
240002
  // src/core/site/upload.ts
240003
+ import { readFile as readFile2 } from "node:fs/promises";
239713
240004
  var DEFAULT_UPLOAD_CONCURRENCY = 3;
239714
240005
  var MAX_UPLOAD_CONCURRENCY = 50;
239715
240006
  var MAX_UPLOAD_ATTEMPTS = 3;
@@ -239808,7 +240099,10 @@ async function uploadPresignedAsset(upload, assets) {
239808
240099
  if (!file) {
239809
240100
  throw new InternalError(`Server requested upload of unknown asset path: ${upload.path}`);
239810
240101
  }
239811
- const content = await readFile2(file.absolutePath);
240102
+ await putPresigned(upload, file.absolutePath);
240103
+ }
240104
+ async function putPresigned(upload, absolutePath) {
240105
+ const content = await readFile2(absolutePath);
239812
240106
  try {
239813
240107
  await distribution_default.put(upload.url, {
239814
240108
  body: new Uint8Array(content),
@@ -239824,85 +240118,6 @@ async function uploadPresignedAsset(upload, assets) {
239824
240118
  }
239825
240119
  }
239826
240120
 
239827
- // src/core/site/wrangler-config.ts
239828
- import { dirname as dirname10, join as join16, resolve as resolve4 } from "node:path";
239829
- var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
239830
- var RedirectConfigSchema = looseObject({
239831
- configPath: string2().min(1)
239832
- });
239833
- var WranglerConfigSchema = looseObject({
239834
- main: string2().min(1, "wrangler config is missing a 'main' entry module"),
239835
- no_bundle: boolean2().optional(),
239836
- rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
239837
- assets: looseObject({
239838
- directory: string2().optional(),
239839
- html_handling: string2().optional(),
239840
- not_found_handling: string2().optional(),
239841
- run_worker_first: union([boolean2(), array(string2())]).optional(),
239842
- headers: string2().optional(),
239843
- redirects: string2().optional()
239844
- }).optional(),
239845
- compatibility_date: string2().optional(),
239846
- compatibility_flags: array(string2()).optional(),
239847
- vars: record(string2(), unknown()).optional(),
239848
- upload_source_maps: boolean2().optional()
239849
- });
239850
- async function detectFullStackArtifact(projectRoot) {
239851
- const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
239852
- return await pathExists(redirectPath) ? redirectPath : null;
239853
- }
239854
- async function resolveWranglerConfig(redirectPath) {
239855
- const configPath = await resolveRedirectedConfigPath(redirectPath);
239856
- const parsed = await readJsonFile(configPath);
239857
- const result = WranglerConfigSchema.safeParse(parsed);
239858
- if (!result.success) {
239859
- throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
239860
- }
239861
- const config = result.data;
239862
- if (config.no_bundle !== true) {
239863
- throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
239864
- }
239865
- const configDir = dirname10(configPath);
239866
- const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
239867
- return {
239868
- configPath,
239869
- configDir,
239870
- main: config.main,
239871
- assetsDirectory,
239872
- assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
239873
- compatibilityDate: config.compatibility_date ?? null,
239874
- compatibilityFlags: config.compatibility_flags ?? [],
239875
- rules: (config.rules ?? []).map((rule) => ({
239876
- type: rule.type,
239877
- globs: rule.globs
239878
- })),
239879
- uploadSourceMaps: config.upload_source_maps ?? false
239880
- };
239881
- }
239882
- async function resolveRedirectedConfigPath(redirectPath) {
239883
- const parsed = await readJsonFile(redirectPath);
239884
- const result = RedirectConfigSchema.safeParse(parsed);
239885
- if (!result.success) {
239886
- throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
239887
- }
239888
- const configPath = resolve4(dirname10(redirectPath), result.data.configPath);
239889
- if (!await pathExists(configPath)) {
239890
- throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
239891
- hints: [{ message: "Rebuild the project to regenerate the artifact" }]
239892
- });
239893
- }
239894
- return configPath;
239895
- }
239896
- function toResolvedAssetsConfig(assets) {
239897
- return {
239898
- htmlHandling: assets.html_handling,
239899
- notFoundHandling: assets.not_found_handling,
239900
- runWorkerFirst: assets.run_worker_first,
239901
- headers: assets.headers,
239902
- redirects: assets.redirects
239903
- };
239904
- }
239905
-
239906
240121
  // src/core/site/deployment.ts
239907
240122
  var NO_ASSETS = { manifest: {}, filesByHash: new Map };
239908
240123
  var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
@@ -239929,12 +240144,11 @@ async function deployToDeployments(options) {
239929
240144
  return { deploymentId: finalized.deploymentId, gitHash };
239930
240145
  }
239931
240146
  async function resolveWorkerBuild(projectRoot, progress) {
239932
- const redirectPath = await detectFullStackArtifact(projectRoot);
239933
- if (!redirectPath) {
240147
+ const built = await resolveFullStackBuild(projectRoot);
240148
+ if (!built) {
239934
240149
  return null;
239935
240150
  }
239936
- const config = await resolveWranglerConfig(redirectPath);
239937
- const assetsDir = config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null;
240151
+ const { config, modules, assetsDir } = built;
239938
240152
  return {
239939
240153
  config: {
239940
240154
  main: config.main,
@@ -239942,7 +240156,7 @@ async function resolveWorkerBuild(projectRoot, progress) {
239942
240156
  compatibility_flags: config.compatibilityFlags,
239943
240157
  assets: buildAssetsConfig(config.assetsConfig, progress)
239944
240158
  },
239945
- modules: await collectModules(config),
240159
+ modules,
239946
240160
  assetsDir
239947
240161
  };
239948
240162
  }
@@ -239950,7 +240164,7 @@ async function readIndexHtml(assetsDir, assets) {
239950
240164
  if (!assetsDir || !assets.manifest["/index.html"]) {
239951
240165
  throw new InvalidInputError(`No index.html found in "${assetsDir ?? "the site output directory"}" — a static site needs one at the output directory root.`);
239952
240166
  }
239953
- return new Uint8Array(await readFile3(join17(assetsDir, "index.html")));
240167
+ return new Uint8Array(await readFile3(join18(assetsDir, "index.html")));
239954
240168
  }
239955
240169
  function buildAssetsConfig(assetsConfig, progress) {
239956
240170
  if (!assetsConfig)
@@ -246509,6 +246723,7 @@ function hasResourcesToDeploy(projectData) {
246509
246723
  project,
246510
246724
  entities,
246511
246725
  functions,
246726
+ actors,
246512
246727
  agents,
246513
246728
  agentSkills,
246514
246729
  connectors,
@@ -246517,18 +246732,20 @@ function hasResourcesToDeploy(projectData) {
246517
246732
  const hasSite = Boolean(project.site?.outputDirectory);
246518
246733
  const hasEntities = entities.length > 0;
246519
246734
  const hasFunctions = functions.length > 0;
246735
+ const hasActors = actors.length > 0;
246520
246736
  const hasAgents = agents.length > 0;
246521
246737
  const hasAgentSkills = agentSkills.length > 0;
246522
246738
  const hasConnectors = connectors.length > 0;
246523
246739
  const hasAuthConfig = authConfig.length > 0;
246524
246740
  const hasVisibility = Boolean(project.visibility);
246525
- return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
246741
+ return hasEntities || hasFunctions || hasActors || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
246526
246742
  }
246527
246743
  async function deployAll(projectData, options) {
246528
246744
  const {
246529
246745
  project,
246530
246746
  entities,
246531
246747
  functions,
246748
+ actors,
246532
246749
  agents,
246533
246750
  agentSkills,
246534
246751
  connectors,
@@ -246539,10 +246756,33 @@ async function deployAll(projectData, options) {
246539
246756
  options?.onVisibilitySet?.(project.visibility);
246540
246757
  }
246541
246758
  await entityResource.push(entities);
246542
- await deployFunctionsSequentially(functions, {
246759
+ const functionResults = await deployFunctionsSequentially(functions, {
246543
246760
  onStart: options?.onFunctionStart,
246544
246761
  onResult: options?.onFunctionResult
246545
246762
  });
246763
+ const completedStages = [
246764
+ ...project.visibility ? [`Visibility set to ${project.visibility}`] : [],
246765
+ ...entities.length ? [`Entities synced: ${entities.length}`] : []
246766
+ ];
246767
+ const functionDetails = functionResults.map((result) => `Function ${result.name}: ${result.status}${result.error ? ` — ${result.error}` : ""}`);
246768
+ if (functionResults.some((result) => result.status === "error")) {
246769
+ throw new ResourceDeploymentError("Function deployment failed; remaining deploy stages were not run", {
246770
+ details: [...completedStages, ...functionDetails]
246771
+ });
246772
+ }
246773
+ const actorResults = await deployActorsSequentially(actors, {
246774
+ onStart: options?.onActorStart,
246775
+ onResult: options?.onActorResult
246776
+ });
246777
+ if (actorResults.some((result) => result.status === "error")) {
246778
+ throw new ResourceDeploymentError("Actor deployment failed; remaining deploy stages were not run", {
246779
+ details: [
246780
+ ...completedStages,
246781
+ ...functionDetails,
246782
+ ...actorResults.map(describeActorResult)
246783
+ ]
246784
+ });
246785
+ }
246546
246786
  await agentSkillResource.push(agentSkills);
246547
246787
  await agentResource.push(agents);
246548
246788
  await authConfigResource.push(authConfig);
@@ -246836,6 +247076,12 @@ async function ensureAppContext(ctx, options = {}) {
246836
247076
  ctx.app = appContext;
246837
247077
  ctx.errorReporter.setContext({ appId: appContext.id });
246838
247078
  }
247079
+ function requireApp(ctx) {
247080
+ if (!ctx.app) {
247081
+ throw new InternalError("This command read an app context it never resolved — it is declared with requireAppContext: false.");
247082
+ }
247083
+ return ctx.app;
247084
+ }
246839
247085
 
246840
247086
  // src/cli/utils/version-check.ts
246841
247087
  async function checkForUpgrade() {
@@ -247027,26 +247273,29 @@ var DeclareVersionResponseSchema = object({
247027
247273
  }));
247028
247274
  var CreateVersionResponseSchema = object({
247029
247275
  version_id: string2(),
247030
- manifest_hash: string2(),
247031
- deduplicated: boolean2()
247276
+ manifest_hash: string2()
247032
247277
  }).transform((data) => ({
247033
247278
  versionId: data.version_id,
247034
- manifestHash: data.manifest_hash,
247035
- deduplicated: data.deduplicated
247279
+ manifestHash: data.manifest_hash
247036
247280
  }));
247037
- var DeployVersionResponseSchema = object({
247038
- deployment_id: string2(),
247281
+ var EnvironmentResponseSchema = object({
247282
+ name: string2(),
247283
+ version_id: string2(),
247039
247284
  manifest_hash: string2(),
247040
- revision: number2()
247285
+ deployment_id: string2()
247041
247286
  }).transform((data) => ({
247042
- deploymentId: data.deployment_id,
247287
+ name: data.name,
247288
+ versionId: data.version_id,
247043
247289
  manifestHash: data.manifest_hash,
247044
- revision: data.revision
247290
+ deploymentId: data.deployment_id
247045
247291
  }));
247046
247292
 
247047
247293
  // src/core/version/api.ts
247048
247294
  var DEFAULT_VERSION_UPLOAD_CONCURRENCY = 8;
247049
247295
  var MAX_VERSION_UPLOAD_CONCURRENCY = 16;
247296
+ function declaredFile({ path, size, digest }) {
247297
+ return { path, size, digest };
247298
+ }
247050
247299
  async function post(path, json, doing) {
247051
247300
  try {
247052
247301
  return await getAppClient().post(path, { json, timeout: 180000 });
@@ -247054,6 +247303,13 @@ async function post(path, json, doing) {
247054
247303
  throw await ApiError.fromHttpError(error, doing);
247055
247304
  }
247056
247305
  }
247306
+ async function patch(path, json, doing) {
247307
+ try {
247308
+ return await getAppClient().patch(path, { json, timeout: 180000 });
247309
+ } catch (error) {
247310
+ throw await ApiError.fromHttpError(error, doing);
247311
+ }
247312
+ }
247057
247313
  function parse10(schema, body, what) {
247058
247314
  const result = schema.safeParse(body);
247059
247315
  if (!result.success) {
@@ -247063,49 +247319,53 @@ function parse10(schema, body, what) {
247063
247319
  }
247064
247320
  async function createVersion(artifacts, options = {}) {
247065
247321
  const declared = parse10(DeclareVersionResponseSchema, await (await post("versions", {
247066
- static_bundle: artifacts.files.map(({ path, size, digest }) => ({
247067
- path,
247068
- size,
247069
- digest
247070
- })),
247322
+ static_bundle: artifacts.files.map(declaredFile),
247323
+ ...artifacts.siteWorker ? {
247324
+ site_worker: {
247325
+ main: artifacts.siteWorker.main,
247326
+ modules: artifacts.siteWorker.modules.map(declaredFile),
247327
+ assets: artifacts.siteWorker.assets.map(declaredFile),
247328
+ compatibility_date: artifacts.siteWorker.compatibilityDate,
247329
+ compatibility_flags: artifacts.siteWorker.compatibilityFlags
247330
+ }
247331
+ } : {},
247071
247332
  entities: artifacts.entities,
247072
247333
  agents: artifacts.agents,
247073
- source_commit: options.sourceCommit,
247074
- frontend_commit: options.sourceCommit
247334
+ source_commit: options.sourceCommit
247075
247335
  }, "declaring a version")).json(), "declare");
247336
+ const declaredFiles = [
247337
+ ...artifacts.files,
247338
+ ...artifacts.siteWorker?.modules ?? [],
247339
+ ...artifacts.siteWorker?.assets ?? []
247340
+ ];
247076
247341
  options.progress?.onDeclared?.({
247077
- fileCount: artifacts.files.length,
247342
+ fileCount: declaredFiles.length,
247078
247343
  owedFiles: declared.uploads.length
247079
247344
  });
247080
- await uploadPresignedAssets(declared.uploads, {
247081
- manifest: Object.fromEntries(artifacts.files.map((file) => [
247082
- file.path,
247083
- { hash: file.digest, size: file.size }
247084
- ])),
247085
- filesByHash: new Map(artifacts.files.map((file) => [
247086
- file.digest,
247087
- {
247088
- absolutePath: file.absolutePath,
247089
- hash: file.digest,
247090
- size: file.size,
247091
- contentType: "application/octet-stream"
247092
- }
247093
- ]))
247094
- }, {
247095
- concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY,
247096
- onProgress: options.progress?.onUpload
247097
- });
247345
+ if (declared.uploads.length !== declaredFiles.length) {
247346
+ throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
247347
+ }
247348
+ let uploadedFiles = 0;
247349
+ await pMap(declared.uploads, async (upload, index) => {
247350
+ await putPresigned(upload, declaredFiles[index].absolutePath);
247351
+ uploadedFiles++;
247352
+ options.progress?.onUpload?.({
247353
+ uploadedFiles,
247354
+ totalFiles: declared.uploads.length
247355
+ });
247356
+ }, { concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY });
247098
247357
  return parse10(CreateVersionResponseSchema, await (await post(`versions/${encodeURIComponent(declared.sessionId)}/finalize`, {}, "creating a version")).json(), "create version");
247099
247358
  }
247100
- async function deployVersion(versionId, options = {}) {
247101
- return parse10(DeployVersionResponseSchema, await (await post(`versions/${encodeURIComponent(versionId)}/deployments`, {
247102
- ...options.target ? { target: options.target } : {},
247359
+ async function setEnvironmentVersion(environment, versionId, options = {}) {
247360
+ return parse10(EnvironmentResponseSchema, await (await patch(`environments/${encodeURIComponent(environment)}`, {
247361
+ version_id: versionId,
247103
247362
  ...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
247104
- }, "deploying a version")).json(), "deploy");
247363
+ }, "setting the environment's version")).json(), "environment");
247105
247364
  }
247106
247365
 
247107
247366
  // src/core/version/publish.ts
247108
247367
  var STEP = Symbol.for("base44.publishStep");
247368
+ var DEFAULT_ENVIRONMENT = "production";
247109
247369
  async function tagStep(step, run) {
247110
247370
  try {
247111
247371
  return await run();
@@ -247125,11 +247385,15 @@ async function publishVersion(artifacts, options = {}) {
247125
247385
  concurrency: options.concurrency,
247126
247386
  progress: options.progress
247127
247387
  }));
247128
- const deployment = await tagStep("deploy", () => deployVersion(version.versionId, {
247129
- target: options.target,
247388
+ const environment = await tagStep("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
247130
247389
  idempotencyKey: randomUUID4()
247131
247390
  }));
247132
- return { ...version, ...deployment };
247391
+ return {
247392
+ environment: environment.name,
247393
+ versionId: environment.versionId,
247394
+ manifestHash: environment.manifestHash,
247395
+ deploymentId: environment.deploymentId
247396
+ };
247133
247397
  }
247134
247398
 
247135
247399
  // src/cli/utils/command/Base44Command.ts
@@ -247411,6 +247675,118 @@ function formatYaml(data, options = {}) {
247411
247675
  const replacer = stripEmpty ? stripEmptyReplacer : undefined;
247412
247676
  return $stringify(data, replacer, { indent: YAML_INDENT }).trimEnd();
247413
247677
  }
247678
+ // src/cli/commands/actors/delete.ts
247679
+ async function deleteActorsAction({ log, jsonMode, runTask }, rawNames) {
247680
+ const names = [...new Set(parseNames(rawNames))];
247681
+ if (!names.length)
247682
+ throw new InvalidInputError("At least one actor name is required");
247683
+ names.forEach(validateActorName);
247684
+ const results = [];
247685
+ for (const name of names) {
247686
+ try {
247687
+ await runTask(`Deleting ${name}...`, () => deleteSingleActor(name), {
247688
+ successMessage: `${name} deleted`,
247689
+ errorMessage: `Failed to delete ${name}`
247690
+ });
247691
+ results.push({ name, status: "deleted" });
247692
+ } catch (error) {
247693
+ if (error instanceof ApiError && error.statusCode === 404) {
247694
+ results.push({ name, status: "not_found" });
247695
+ log.info(`${name} not found`);
247696
+ } else {
247697
+ const result = actorOperationError(name, error);
247698
+ results.push(result);
247699
+ log.error(describeActorResult(result));
247700
+ }
247701
+ }
247702
+ }
247703
+ const summary = {
247704
+ deleted: results.filter((result) => result.status === "deleted").length,
247705
+ notFound: results.filter((result) => result.status === "not_found").length,
247706
+ failed: results.filter((result) => result.status === "error").length
247707
+ };
247708
+ if (summary.failed)
247709
+ throw new ResourceDeploymentError("Actor deletion failed", {
247710
+ details: results.map(describeActorResult)
247711
+ });
247712
+ return {
247713
+ outroMessage: names.length === 1 ? `Actor "${names[0]}" ${summary.deleted ? "deleted" : "not found"}` : `${summary.deleted} deleted, ${summary.notFound} not found`,
247714
+ stdout: jsonMode ? `${JSON.stringify({ actors: results, summary })}
247715
+ ` : undefined
247716
+ };
247717
+ }
247718
+ function getDeleteCommand() {
247719
+ return new Base44Command("delete").description("Delete deployed actors").argument("[names...]", "Actor names to delete (required)").action(deleteActorsAction);
247720
+ }
247721
+
247722
+ // src/cli/commands/functions/formatDeployResult.ts
247723
+ function formatDuration(ms) {
247724
+ return `${(ms / 1000).toFixed(1)}s`;
247725
+ }
247726
+ function formatDeployResult(result, log) {
247727
+ const label = result.name.padEnd(25);
247728
+ if (result.status === "deployed") {
247729
+ const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
247730
+ log.success(`${label} deployed${timing}`);
247731
+ } else if (result.status === "unchanged") {
247732
+ log.success(`${label} unchanged`);
247733
+ } else {
247734
+ log.error(`${label} error: ${result.error}`);
247735
+ }
247736
+ }
247737
+
247738
+ // src/cli/commands/actors/deploy.ts
247739
+ async function deployActorsAction({ log, jsonMode }, rawNames) {
247740
+ const names = [...new Set(parseNames(rawNames))];
247741
+ if (rawNames.length && !names.length)
247742
+ throw new InvalidInputError("At least one actor name is required");
247743
+ names.forEach(validateActorName);
247744
+ const { actors, project } = await readProjectConfig();
247745
+ const notFound = names.filter((name) => !actors.some((actor) => actor.name === name));
247746
+ if (notFound.length)
247747
+ throw new InvalidInputError(`Actor not found in project: ${notFound.join(", ")}`);
247748
+ const selected = names.length ? actors.filter((actor) => names.includes(actor.name)) : actors;
247749
+ let completed = 0;
247750
+ if (selected.length)
247751
+ log.info(`Found ${selected.length} ${selected.length === 1 ? "actor" : "actors"} to deploy`);
247752
+ const results = await deployActorsSequentially(selected, {
247753
+ onStart: (name) => log.step(theme.styles.dim(`[${completed + 1}/${selected.length}] Deploying ${name}...`)),
247754
+ onResult: (result) => {
247755
+ completed++;
247756
+ formatDeployResult(result, log);
247757
+ if (result.status !== "error")
247758
+ for (const warning of result.warnings)
247759
+ log.warn(`${result.name}: ${warning}`);
247760
+ }
247761
+ });
247762
+ const summary = {
247763
+ deployed: results.filter((result) => result.status === "deployed").length,
247764
+ unchanged: results.filter((result) => result.status === "unchanged").length,
247765
+ failed: results.filter((result) => result.status === "error").length
247766
+ };
247767
+ const message = Object.entries(summary).filter(([, count]) => count > 0).map(([status, count]) => `${count} ${status}`).join(", ");
247768
+ if (summary.failed) {
247769
+ throw new ResourceDeploymentError(message, {
247770
+ details: results.map(describeActorResult)
247771
+ });
247772
+ }
247773
+ return {
247774
+ outroMessage: message || `No actors found. Create actors in the '${project.actorsDir}' directory.`,
247775
+ stdout: jsonMode ? `${JSON.stringify({ actors: results, summary })}
247776
+ ` : undefined
247777
+ };
247778
+ }
247779
+ function getDeployCommand() {
247780
+ return new Base44Command("deploy").description("Deploy actors to Base44").argument("[names...]", "Actor names to deploy (deploys all if omitted)").action(deployActorsAction);
247781
+ }
247782
+
247783
+ // src/cli/commands/actors/index.ts
247784
+ function getActorsCommand() {
247785
+ return new Command2("actors").description("Manage realtime actors").addCommand(getDeployCommand()).addCommand(getDeleteCommand());
247786
+ }
247787
+
247788
+ // src/cli/commands/agent-skills/pull.ts
247789
+ import { dirname as dirname13, join as join19 } from "node:path";
247414
247790
  // src/core/utils/dependencies.ts
247415
247791
  import { spawnSync as spawnSync2 } from "node:child_process";
247416
247792
  function verifyDenoInstalled(context) {
@@ -247499,7 +247875,7 @@ async function pullAction({
247499
247875
  runTask
247500
247876
  }) {
247501
247877
  const { project } = await readProjectConfig();
247502
- const dir = join18(dirname11(project.configPath), project.agentSkillsDir);
247878
+ const dir = join19(dirname13(project.configPath), project.agentSkillsDir);
247503
247879
  const remote = await runTask("Fetching agent skills from Base44", () => fetchAgentSkills(), {
247504
247880
  successMessage: "Agent skills fetched successfully",
247505
247881
  errorMessage: "Failed to fetch agent skills"
@@ -247555,14 +247931,14 @@ function getAgentSkillsCommand() {
247555
247931
  }
247556
247932
 
247557
247933
  // src/cli/commands/agents/pull.ts
247558
- import { dirname as dirname12, join as join19 } from "node:path";
247934
+ import { dirname as dirname14, join as join20 } from "node:path";
247559
247935
  async function pullAgentsAction({
247560
247936
  log,
247561
247937
  runTask
247562
247938
  }) {
247563
247939
  const { project } = await readProjectConfig();
247564
- const configDir = dirname12(project.configPath);
247565
- const agentsDir = join19(configDir, project.agentsDir);
247940
+ const configDir = dirname14(project.configPath);
247941
+ const agentsDir = join20(configDir, project.agentsDir);
247566
247942
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
247567
247943
  return await fetchAgents();
247568
247944
  }, {
@@ -247632,12 +248008,12 @@ function getAgentsCommand() {
247632
248008
  }
247633
248009
 
247634
248010
  // src/cli/commands/auth/password-login.ts
247635
- import { dirname as dirname13, join as join20 } from "node:path";
248011
+ import { dirname as dirname15, join as join21 } from "node:path";
247636
248012
  async function passwordLoginAction({ log, runTask }, action) {
247637
248013
  const shouldEnable = action === "enable";
247638
248014
  const { project } = await readProjectConfig();
247639
- const configDir = dirname13(project.configPath);
247640
- const authDir = join20(configDir, project.authDir);
248015
+ const configDir = dirname15(project.configPath);
248016
+ const authDir = join21(configDir, project.authDir);
247641
248017
  const updated = await runTask("Updating local auth config", async () => {
247642
248018
  const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
247643
248019
  const merged = { ...current, enableUsernamePassword: shouldEnable };
@@ -247657,14 +248033,14 @@ function getPasswordLoginCommand() {
247657
248033
  }
247658
248034
 
247659
248035
  // src/cli/commands/auth/pull.ts
247660
- import { dirname as dirname14, join as join21 } from "node:path";
248036
+ import { dirname as dirname16, join as join22 } from "node:path";
247661
248037
  async function pullAuthAction({
247662
248038
  log,
247663
248039
  runTask
247664
248040
  }) {
247665
248041
  const { project } = await readProjectConfig();
247666
- const configDir = dirname14(project.configPath);
247667
- const authDir = join21(configDir, project.authDir);
248042
+ const configDir = dirname16(project.configPath);
248043
+ const authDir = join22(configDir, project.authDir);
247668
248044
  const remoteConfig = await runTask("Fetching auth config from Base44", async () => {
247669
248045
  return await pullAuthConfig();
247670
248046
  }, {
@@ -247728,7 +248104,7 @@ function getAuthPushCommand() {
247728
248104
  }
247729
248105
 
247730
248106
  // src/cli/commands/auth/social-login.ts
247731
- import { dirname as dirname15, join as join22, resolve as resolve6 } from "node:path";
248107
+ import { dirname as dirname17, join as join23, resolve as resolve6 } from "node:path";
247732
248108
  var PROVIDER_LABELS = {
247733
248109
  google: "Google",
247734
248110
  microsoft: "Microsoft",
@@ -247798,8 +248174,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask }, provider, a
247798
248174
  }
247799
248175
  }
247800
248176
  const { project } = await readProjectConfig();
247801
- const configDir = dirname15(project.configPath);
247802
- const authDir = join22(configDir, project.authDir);
248177
+ const configDir = dirname17(project.configPath);
248178
+ const authDir = join23(configDir, project.authDir);
247803
248179
  const { config: updated } = await runTask("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
247804
248180
  if (clientSecret) {
247805
248181
  await runTask("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
@@ -247824,7 +248200,7 @@ function getSocialLoginCommand() {
247824
248200
  }
247825
248201
 
247826
248202
  // src/cli/commands/auth/sso.ts
247827
- import { dirname as dirname16, join as join23, resolve as resolve7 } from "node:path";
248203
+ import { dirname as dirname18, join as join24, resolve as resolve7 } from "node:path";
247828
248204
  var SSOConfigFileSchema = object({
247829
248205
  provider: _enum(Object.values(KNOWN_SSO_PROVIDERS)),
247830
248206
  clientId: string2(),
@@ -247987,8 +248363,8 @@ async function ssoEnableAction({ isNonInteractive, runTask }, options) {
247987
248363
  throw error;
247988
248364
  }
247989
248365
  const { project } = await readProjectConfig();
247990
- const configDir = dirname16(project.configPath);
247991
- const authDir = join23(configDir, project.authDir);
248366
+ const configDir = dirname18(project.configPath);
248367
+ const authDir = join24(configDir, project.authDir);
247992
248368
  await runTask("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
247993
248369
  await runTask("Saving SSO credentials", async () => pushSSOSecrets(secrets));
247994
248370
  return {
@@ -248003,8 +248379,8 @@ async function ssoDisableAction({ log, runTask }, options) {
248003
248379
  throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
248004
248380
  }
248005
248381
  const { project } = await readProjectConfig();
248006
- const configDir = dirname16(project.configPath);
248007
- const authDir = join23(configDir, project.authDir);
248382
+ const configDir = dirname18(project.configPath);
248383
+ const authDir = join24(configDir, project.authDir);
248008
248384
  const updated = await runTask("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
248009
248385
  await runTask("Removing SSO credentials", async () => deleteSSOSecrets());
248010
248386
  if (!hasAnyLoginMethod(updated)) {
@@ -248886,13 +249262,13 @@ function getConnectorsListAvailableCommand() {
248886
249262
  }
248887
249263
 
248888
249264
  // src/cli/commands/connectors/pull.ts
248889
- import { dirname as dirname17, join as join24, resolve as resolve8 } from "node:path";
249265
+ import { dirname as dirname19, join as join25, resolve as resolve8 } from "node:path";
248890
249266
  async function resolveConnectorsDir(options) {
248891
249267
  if (!getAppContext().projectRoot) {
248892
249268
  return resolve8(options.dir ?? "connectors");
248893
249269
  }
248894
249270
  const { project } = await readProjectConfig();
248895
- return join24(dirname17(project.configPath), project.connectorsDir);
249271
+ return join25(dirname19(project.configPath), project.connectorsDir);
248896
249272
  }
248897
249273
  async function pullConnectorsAction({ log, runTask, jsonMode }, options) {
248898
249274
  const connectorsDir = await resolveConnectorsDir(options);
@@ -249147,43 +249523,22 @@ async function deleteFunctionsAction({ runTask }, names) {
249147
249523
  parts.push(`${errors} error${errors !== 1 ? "s" : ""}`);
249148
249524
  return { outroMessage: parts.join(", ") };
249149
249525
  }
249150
- function parseNames(args) {
249526
+ function parseNames2(args) {
249151
249527
  return args.flatMap((arg) => arg.split(",")).map((n) => n.trim()).filter(Boolean);
249152
249528
  }
249153
249529
  function validateNames(command) {
249154
- const names = parseNames(command.args);
249530
+ const names = parseNames2(command.args);
249155
249531
  if (names.length === 0) {
249156
249532
  command.error("At least one function name is required");
249157
249533
  }
249158
249534
  }
249159
- function getDeleteCommand() {
249535
+ function getDeleteCommand2() {
249160
249536
  return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (ctx, rawNames) => {
249161
- const names = parseNames(rawNames);
249537
+ const names = parseNames2(rawNames);
249162
249538
  return deleteFunctionsAction(ctx, names);
249163
249539
  });
249164
249540
  }
249165
249541
 
249166
- // src/cli/commands/functions/formatDeployResult.ts
249167
- function formatDuration(ms) {
249168
- return `${(ms / 1000).toFixed(1)}s`;
249169
- }
249170
- function formatDeployResult(result, log) {
249171
- const label = result.name.padEnd(25);
249172
- if (result.status === "deployed") {
249173
- const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
249174
- log.success(`${label} deployed${timing}`);
249175
- } else if (result.status === "unchanged") {
249176
- log.success(`${label} unchanged`);
249177
- } else {
249178
- log.error(`${label} error: ${result.error}`);
249179
- }
249180
- }
249181
-
249182
- // src/cli/commands/functions/parseNames.ts
249183
- function parseNames2(args) {
249184
- return args.flatMap((arg) => arg.split(",")).map((n) => n.trim()).filter(Boolean);
249185
- }
249186
-
249187
249542
  // src/cli/commands/functions/deploy.ts
249188
249543
  function resolveFunctionsToDeploy(names, allFunctions) {
249189
249544
  if (names.length === 0)
@@ -249270,9 +249625,9 @@ async function deployFunctionsAction({ log }, names, options) {
249270
249625
  }
249271
249626
  return { outroMessage: buildDeploySummary(results) };
249272
249627
  }
249273
- function getDeployCommand() {
249628
+ function getDeployCommand2() {
249274
249629
  return new Base44Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (ctx, rawNames, options) => {
249275
- const names = parseNames2(rawNames);
249630
+ const names = parseNames(rawNames);
249276
249631
  return deployFunctionsAction(ctx, names, options);
249277
249632
  });
249278
249633
  }
@@ -249300,11 +249655,11 @@ function getListCommand() {
249300
249655
  }
249301
249656
 
249302
249657
  // src/cli/commands/functions/pull.ts
249303
- import { dirname as dirname18, join as join25 } from "node:path";
249658
+ import { dirname as dirname20, join as join26 } from "node:path";
249304
249659
  async function pullFunctionsAction({ log, runTask }, name) {
249305
249660
  const { project, functions } = await readProjectConfig();
249306
- const configDir = dirname18(project.configPath);
249307
- const functionsDir = join25(configDir, project.functionsDir);
249661
+ const configDir = dirname20(project.configPath);
249662
+ const functionsDir = join26(configDir, project.functionsDir);
249308
249663
  const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
249309
249664
  const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
249310
249665
  const { functions } = await listDeployedFunctions();
@@ -249359,7 +249714,7 @@ function getPullCommand() {
249359
249714
 
249360
249715
  // src/cli/commands/functions/index.ts
249361
249716
  function getFunctionsCommand() {
249362
- return new Command2("functions").description("Manage backend functions").addCommand(getDeployCommand()).addCommand(getDeleteCommand()).addCommand(getListCommand()).addCommand(getPullCommand());
249717
+ return new Command2("functions").description("Manage backend functions").addCommand(getDeployCommand2()).addCommand(getDeleteCommand2()).addCommand(getListCommand()).addCommand(getPullCommand());
249363
249718
  }
249364
249719
 
249365
249720
  // src/cli/commands/project/site-build.ts
@@ -249406,56 +249761,54 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
249406
249761
  }
249407
249762
  // src/core/version/artifacts.ts
249408
249763
  import { createHash as createHash2 } from "node:crypto";
249409
- import { createReadStream as createReadStream3 } from "node:fs";
249410
- import { stat as stat3 } from "node:fs/promises";
249411
- import { basename as basename5, join as join26 } from "node:path";
249412
- var MAX_FILE_COUNT = 1e5;
249413
- var ASSETS_IGNORE_FILE2 = ".assetsignore";
249414
- var ALWAYS_IGNORED2 = new Set([
249415
- ASSETS_IGNORE_FILE2,
249416
- "wrangler.json",
249417
- ".dev.vars"
249418
- ]);
249764
+ import { join as join27, resolve as resolve10 } from "node:path";
249765
+ var MAX_FILE_COUNT = 50000;
249766
+ var HASH_CONCURRENCY = 32;
249419
249767
  var ENTRY2 = "index.html";
249420
249768
  async function digestFile(absolutePath) {
249421
- const hash = createHash2("sha256");
249422
- for await (const chunk of createReadStream3(absolutePath)) {
249423
- hash.update(chunk);
249424
- }
249769
+ const hash = await hashFileInto(createHash2("sha256"), absolutePath);
249425
249770
  return `sha256:${hash.digest("hex")}`;
249426
249771
  }
249427
- async function collectBuildOutput(outputDir) {
249428
- const found = await globby("**/*", {
249429
- cwd: outputDir,
249430
- dot: true,
249431
- onlyFiles: true,
249432
- followSymbolicLinks: false,
249433
- ignoreFiles: [ASSETS_IGNORE_FILE2]
249434
- });
249435
- const relativePaths = found.filter((path) => !ALWAYS_IGNORED2.has(basename5(path))).sort();
249436
- if (relativePaths.length === 0) {
249772
+ async function collectBuildOutput(outputDir, options = {}) {
249773
+ const found = await describeBuildOutput(outputDir);
249774
+ if (found.length === 0) {
249437
249775
  throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
249438
249776
  hints: [
249439
249777
  { message: "Run 'base44 build' first", command: "base44 build" }
249440
249778
  ]
249441
249779
  });
249442
249780
  }
249443
- if (relativePaths.length > MAX_FILE_COUNT) {
249444
- throw new InvalidInputError(`Too many files: found ${relativePaths.length}, the limit is ${MAX_FILE_COUNT}.`);
249781
+ if (found.length > MAX_FILE_COUNT) {
249782
+ throw new InvalidInputError(`Too many files: found ${found.length}, the limit is ${MAX_FILE_COUNT}.`);
249445
249783
  }
249446
- if (!relativePaths.includes(ENTRY2)) {
249784
+ if (options.requireEntry !== false && !found.some((f) => f.path === ENTRY2)) {
249447
249785
  throw new InvalidInputError(`${outputDir} has no ${ENTRY2}, so nothing could enter the site.`);
249448
249786
  }
249449
- return await Promise.all(relativePaths.map(async (path) => {
249450
- const absolutePath = join26(outputDir, ...path.split("/"));
249451
- const { size } = await stat3(absolutePath);
249452
- return {
249453
- path,
249787
+ return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
249788
+ }
249789
+ async function collectSiteWorker(projectRoot) {
249790
+ const built = await resolveFullStackBuild(projectRoot);
249791
+ if (!built) {
249792
+ return null;
249793
+ }
249794
+ const { config, modules, assetsDir } = built;
249795
+ const entry = resolve10(config.configDir, config.main);
249796
+ const main = modules.find((m) => m.absolutePath === entry)?.name;
249797
+ if (!main) {
249798
+ throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
249799
+ }
249800
+ return {
249801
+ main,
249802
+ modules: await pMap(modules, async ({ name, absolutePath, size }) => ({
249803
+ path: name,
249454
249804
  absolutePath,
249455
249805
  size,
249456
249806
  digest: await digestFile(absolutePath)
249457
- };
249458
- }));
249807
+ }), { concurrency: HASH_CONCURRENCY }),
249808
+ assets: assetsDir ? await collectBuildOutput(assetsDir, { requireEntry: false }) : [],
249809
+ compatibilityDate: config.compatibilityDate,
249810
+ compatibilityFlags: config.compatibilityFlags
249811
+ };
249459
249812
  }
249460
249813
  async function readRawResources(dir) {
249461
249814
  if (!await pathExists(dir)) {
@@ -249469,19 +249822,25 @@ async function readRawResources(dir) {
249469
249822
  const payloads = {};
249470
249823
  for (const relativePath of files.sort()) {
249471
249824
  const name = relativePath.replace(/\.jsonc?$/, "");
249472
- payloads[name] = await readJsonFile(join26(dir, ...relativePath.split("/")));
249825
+ payloads[name] = await readJsonFile(join27(dir, ...relativePath.split("/")));
249473
249826
  }
249474
249827
  return payloads;
249475
249828
  }
249476
249829
  async function collectResources(configDir, dirs) {
249477
249830
  const [entities, agents] = await Promise.all([
249478
- readRawResources(join26(configDir, dirs.entitiesDir)),
249479
- readRawResources(join26(configDir, dirs.agentsDir))
249831
+ readRawResources(join27(configDir, dirs.entitiesDir)),
249832
+ readRawResources(join27(configDir, dirs.agentsDir))
249480
249833
  ]);
249481
249834
  return { entities, agents };
249482
249835
  }
249836
+ // src/core/version/gate.ts
249837
+ var VERSIONS_API_ENV = "BASE44_VERSIONS_API";
249838
+ function versionsApiEnabled(env = process.env) {
249839
+ const value = env[VERSIONS_API_ENV];
249840
+ return value === "1" || value === "true";
249841
+ }
249483
249842
  // src/core/version/project.ts
249484
- import { dirname as dirname19, join as join27, resolve as resolve10 } from "node:path";
249843
+ import { dirname as dirname21, join as join28, resolve as resolve11 } from "node:path";
249485
249844
  var DEFAULT_BUILD_COMMAND = "npm run build";
249486
249845
  var DEFAULT_OUTPUT_DIRECTORY = "dist";
249487
249846
  async function resolvePublishTarget(projectRoot, overrides = {}) {
@@ -249489,7 +249848,7 @@ async function resolvePublishTarget(projectRoot, overrides = {}) {
249489
249848
  const root = project?.root ?? projectRoot ?? process.cwd();
249490
249849
  return {
249491
249850
  root,
249492
- configDir: project ? dirname19(project.configPath) : join27(root, PROJECT_SUBDIR),
249851
+ configDir: project ? dirname21(project.configPath) : join28(root, PROJECT_SUBDIR),
249493
249852
  buildCommand: project ? project.site?.buildCommand : DEFAULT_BUILD_COMMAND,
249494
249853
  outputDir: outputDirectory(project, root, overrides.outputDir),
249495
249854
  entitiesDir: project?.entitiesDir ?? "entities",
@@ -249498,7 +249857,7 @@ async function resolvePublishTarget(projectRoot, overrides = {}) {
249498
249857
  }
249499
249858
  function outputDirectory(project, root, override) {
249500
249859
  const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
249501
- return configured ? resolve10(root, configured) : null;
249860
+ return configured ? resolve11(root, configured) : null;
249502
249861
  }
249503
249862
  function requireOutputDir(target) {
249504
249863
  if (target.outputDir === null) {
@@ -249524,41 +249883,28 @@ async function readSettingsIfPresent(projectRoot) {
249524
249883
  }
249525
249884
  }
249526
249885
  // src/cli/commands/project/build.ts
249527
- async function buildAction(ctx, options) {
249528
- const { app, jsonMode } = ctx;
249529
- const target = await resolvePublishTarget(app?.projectRoot, {
249530
- outputDir: options.outputDir
249531
- });
249886
+ async function buildAction(ctx) {
249887
+ const app = requireApp(ctx);
249888
+ const target = await resolvePublishTarget(app.projectRoot);
249532
249889
  await runSiteBuild(ctx, {
249533
249890
  root: target.root,
249534
249891
  buildCommand: target.buildCommand,
249535
- appId: app?.id ?? ""
249892
+ appId: app.id
249536
249893
  });
249537
- const files = await collectBuildOutput(requireOutputDir(target));
249538
- const totalBytes = files.reduce((sum, file) => sum + file.size, 0);
249539
249894
  return {
249540
- outroMessage: `Built ${files.length} files (${totalBytes} bytes) with app id ${theme.styles.bold(app?.id ?? "")}`,
249541
- stdout: jsonMode ? `${JSON.stringify({
249542
- outputDir: target.outputDir,
249543
- files: files.map(({ path, size, digest }) => ({
249544
- path,
249545
- size,
249546
- digest
249547
- }))
249548
- }, null, 2)}
249549
- ` : undefined
249895
+ outroMessage: `Site built with app id ${theme.styles.bold(app.id)}`
249550
249896
  };
249551
249897
  }
249552
249898
  function getBuildCommand() {
249553
- return new Base44Command("build", { requireAuth: false }).description("Build the site with the Base44 app id injected").option("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)").action(buildAction);
249899
+ return new Base44Command("build", { requireAuth: false }).description("Build the site with the Base44 app id injected").action(buildAction);
249554
249900
  }
249555
249901
 
249556
249902
  // src/cli/commands/project/create.ts
249557
- import { basename as basename6, resolve as resolve11 } from "node:path";
249903
+ import { basename as basename6, resolve as resolve12 } from "node:path";
249558
249904
  var import_kebabCase = __toESM(require_kebabCase(), 1);
249559
249905
 
249560
249906
  // src/cli/commands/project/scaffold-shared.ts
249561
- import { join as join28 } from "node:path";
249907
+ import { join as join29 } from "node:path";
249562
249908
  var DEFAULT_TEMPLATE_ID = "backend-only";
249563
249909
  async function getTemplateById(templateId) {
249564
249910
  const templates = await listTemplates();
@@ -249621,7 +249967,7 @@ async function completeProjectSetup({
249621
249967
  env: { VITE_BASE44_APP_ID: projectId }
249622
249968
  })`${buildCommand}`;
249623
249969
  updateMessage("Deploying site...");
249624
- return await deploySite(join28(resolvedPath, outputDirectory));
249970
+ return await deploySite(join29(resolvedPath, outputDirectory));
249625
249971
  }, {
249626
249972
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
249627
249973
  errorMessage: "Failed to deploy site"
@@ -249750,7 +250096,7 @@ async function createInteractive(options, ctx) {
249750
250096
  }, ctx);
249751
250097
  }
249752
250098
  async function createNonInteractive(options, ctx) {
249753
- ctx.log.info(`Creating a new project at ${resolve11(options.path)}`);
250099
+ ctx.log.info(`Creating a new project at ${resolve12(options.path)}`);
249754
250100
  const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
249755
250101
  return await executeCreate({
249756
250102
  template,
@@ -249774,7 +250120,7 @@ async function executeCreate({
249774
250120
  }, ctx) {
249775
250121
  const { log, runTask } = ctx;
249776
250122
  const name = rawName.trim();
249777
- const resolvedPath = resolve11(projectPath);
250123
+ const resolvedPath = resolve12(projectPath);
249778
250124
  const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
249779
250125
  const { projectId } = await runTask("Setting up your project...", async () => {
249780
250126
  return await createProjectFiles({
@@ -249836,7 +250182,15 @@ async function deployAction(ctx, options = {}) {
249836
250182
  outroMessage: "No resources found to deploy"
249837
250183
  };
249838
250184
  }
249839
- const { project, entities, functions, agents, connectors, authConfig } = projectData;
250185
+ const {
250186
+ project,
250187
+ entities,
250188
+ functions,
250189
+ actors,
250190
+ agents,
250191
+ connectors,
250192
+ authConfig
250193
+ } = projectData;
249840
250194
  const summaryLines = [];
249841
250195
  if (entities.length > 0) {
249842
250196
  summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
@@ -249844,6 +250198,9 @@ async function deployAction(ctx, options = {}) {
249844
250198
  if (functions.length > 0) {
249845
250199
  summaryLines.push(` - ${functions.length} ${functions.length === 1 ? "function" : "functions"}`);
249846
250200
  }
250201
+ if (actors.length > 0) {
250202
+ summaryLines.push(` - ${actors.length} ${actors.length === 1 ? "actor" : "actors"}`);
250203
+ }
249847
250204
  if (agents.length > 0) {
249848
250205
  summaryLines.push(` - ${agents.length} ${agents.length === 1 ? "agent" : "agents"}`);
249849
250206
  }
@@ -249877,6 +250234,7 @@ ${summaryLines.join(`
249877
250234
  await maybeBuildBeforeDeploy(ctx, project, options.build);
249878
250235
  let functionCompleted = 0;
249879
250236
  const functionTotal = functions.length;
250237
+ let actorCompleted = 0;
249880
250238
  const result = await deployAll(projectData, {
249881
250239
  onVisibilitySet: (level) => {
249882
250240
  log.success(`App visibility set to ${level}`);
@@ -249888,6 +250246,16 @@ ${summaryLines.join(`
249888
250246
  onFunctionResult: (r) => {
249889
250247
  functionCompleted++;
249890
250248
  formatDeployResult(r, log);
250249
+ },
250250
+ onActorStart: (name) => {
250251
+ log.step(theme.styles.dim(`[${actorCompleted + 1}/${actors.length}] Deploying ${name}...`));
250252
+ },
250253
+ onActorResult: (result) => {
250254
+ actorCompleted++;
250255
+ formatDeployResult(result, log);
250256
+ if (result.status !== "error")
250257
+ for (const warning of result.warnings)
250258
+ log.warn(`${result.name}: ${warning}`);
249891
250259
  }
249892
250260
  });
249893
250261
  const connectorResults = result.connectorResults ?? [];
@@ -249902,8 +250270,8 @@ ${summaryLines.join(`
249902
250270
  }
249903
250271
  return { outroMessage: "App deployed successfully" };
249904
250272
  }
249905
- function getDeployCommand2() {
249906
- return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").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)").action(deployAction);
250273
+ function getDeployCommand3() {
250274
+ return new Base44Command("deploy").description("Deploy all project resources (entities, functions, actors, agents, connectors, and site)").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)").action(deployAction);
249907
250275
  }
249908
250276
  async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
249909
250277
  const needsOAuth = filterPendingOAuth(connectorResults);
@@ -250389,11 +250757,11 @@ async function logsAction(ctx, options) {
250389
250757
  function getLogsCommand() {
250390
250758
  return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all deployed functions").option("--since <datetime>", "Show logs from this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).option("--until <datetime>", "Show logs until this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).addOption(new Option2("--level <level>", "Filter by log level").choices([
250391
250759
  ...LogLevelSchema.options
250392
- ])).option("-n, --limit <n>", "Results per page (1-1000; the server returns at most 500)").option("-f, --follow", "Stream new logs as they arrive").addOption(new Option2("--order <order>", "Sort order").choices(["asc", "desc"])).addOption(new Option2("--env <env>", "Which deployment to read logs from: preview (current draft) or prod (published). Default: preview").choices([...LogEnvSchema.options])).action(logsAction);
250760
+ ])).option("-n, --limit <n>", "Results per page (1-1000; the server returns at most 500)").option("-f, --follow", "Stream new logs as they arrive").addOption(new Option2("--order <order>", "Sort order").choices(["asc", "desc"])).addOption(new Option2("--env <env>", "Which deployment to read logs from: preview (current draft) or prod (published). Omit to read both.").choices([...LogEnvSchema.options])).action(logsAction);
250393
250761
  }
250394
250762
 
250395
250763
  // src/cli/commands/project/scaffold.ts
250396
- import { basename as basename7, resolve as resolve12 } from "node:path";
250764
+ import { basename as basename7, resolve as resolve13 } from "node:path";
250397
250765
  function resolveAppId(options) {
250398
250766
  const appId = options.appId;
250399
250767
  if (!appId) {
@@ -250409,7 +250777,7 @@ function resolveAppId(options) {
250409
250777
  async function scaffoldAction(ctx, name, options, command) {
250410
250778
  const { log, runTask } = ctx;
250411
250779
  const appId = resolveAppId(command.optsWithGlobals());
250412
- const resolvedPath = resolve12("./");
250780
+ const resolvedPath = resolve13("./");
250413
250781
  const projectName = (name ?? basename7(resolvedPath)).trim();
250414
250782
  const template = await getTemplateById("backend-only");
250415
250783
  log.info(`Scaffolding project at ${resolvedPath}`);
@@ -250457,26 +250825,55 @@ function getVisibilityCommand() {
250457
250825
  ])).action(setVisibility);
250458
250826
  }
250459
250827
 
250828
+ // src/cli/commands/versions/options.ts
250829
+ function outputDirOption() {
250830
+ return new Option2("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)");
250831
+ }
250832
+ function targetOption() {
250833
+ return new Option2("--target <name>", "Environment to serve the version at");
250834
+ }
250835
+ function gitHashOption() {
250836
+ return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser((value) => {
250837
+ if (!isGitCommitHash(value)) {
250838
+ throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
250839
+ }
250840
+ return value;
250841
+ });
250842
+ }
250843
+ function concurrencyOption() {
250844
+ return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
250845
+ const parsed = Number(value);
250846
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
250847
+ throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
250848
+ }
250849
+ return parsed;
250850
+ });
250851
+ }
250852
+
250460
250853
  // src/cli/commands/publish.ts
250461
250854
  async function publishAction(ctx, options) {
250462
- const { runTask, log, jsonMode, app } = ctx;
250463
- const target = await resolvePublishTarget(app?.projectRoot, {
250855
+ const { runTask, log, jsonMode } = ctx;
250856
+ const app = requireApp(ctx);
250857
+ const target = await resolvePublishTarget(app.projectRoot, {
250464
250858
  outputDir: options.outputDir
250465
250859
  });
250466
250860
  if (options.build !== false) {
250467
250861
  await tagStep("build", () => runSiteBuild(ctx, {
250468
250862
  root: target.root,
250469
250863
  buildCommand: target.buildCommand,
250470
- appId: app?.id ?? ""
250864
+ appId: app.id
250471
250865
  }));
250472
250866
  }
250473
- const outputDir = requireOutputDir(target);
250474
250867
  const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
250475
250868
  const result = await runTask("Publishing...", async (updateMessage) => {
250476
- const artifacts = {
250477
- files: await collectBuildOutput(outputDir),
250478
- ...await collectResources(target.configDir, target)
250479
- };
250869
+ const artifacts = await tagStep("create_version", async () => {
250870
+ const siteWorker = await collectSiteWorker(target.root);
250871
+ return {
250872
+ files: siteWorker ? [] : await collectBuildOutput(requireOutputDir(target)),
250873
+ ...siteWorker ? { siteWorker } : {},
250874
+ ...await collectResources(target.configDir, target)
250875
+ };
250876
+ });
250480
250877
  return await publishVersion(artifacts, {
250481
250878
  sourceCommit: gitHash,
250482
250879
  target: options.target,
@@ -250488,29 +250885,16 @@ async function publishAction(ctx, options) {
250488
250885
  });
250489
250886
  }, { successMessage: "Published", errorMessage: "Publish failed" });
250490
250887
  if (!jsonMode) {
250491
- log.message(theme.styles.dim(`version ${result.versionId}${result.deduplicated ? " (existing content)" : ""}`));
250888
+ log.message(theme.styles.dim(`version ${result.versionId}`));
250492
250889
  }
250493
250890
  return {
250494
- outroMessage: `Deployment ${result.deploymentId} at revision ${result.revision}`,
250891
+ outroMessage: `${result.environment} now serves ${result.versionId}`,
250495
250892
  stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
250496
250893
  ` : undefined
250497
250894
  };
250498
250895
  }
250499
250896
  function getPublishCommand() {
250500
- return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").option("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)").option("--target <name>", "Environment to serve the version at").addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash)).addOption(new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(publishAction);
250501
- }
250502
- function parseGitHash(value) {
250503
- if (!isGitCommitHash(value)) {
250504
- throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
250505
- }
250506
- return value;
250507
- }
250508
- function parseConcurrency(value) {
250509
- const parsed = Number(value);
250510
- if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
250511
- throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
250512
- }
250513
- return parsed;
250897
+ return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").addOption(outputDirOption()).addOption(targetOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(publishAction);
250514
250898
  }
250515
250899
 
250516
250900
  // src/core/resources/sandbox/schema.ts
@@ -250882,7 +251266,7 @@ function getSecretsListCommand() {
250882
251266
  }
250883
251267
 
250884
251268
  // src/cli/commands/secrets/set.ts
250885
- import { resolve as resolve13 } from "node:path";
251269
+ import { resolve as resolve14 } from "node:path";
250886
251270
  function parseEntries(entries) {
250887
251271
  const secrets = {};
250888
251272
  for (const entry of entries) {
@@ -250913,7 +251297,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
250913
251297
  validateInput(entries, options);
250914
251298
  let secrets;
250915
251299
  if (options.envFile) {
250916
- secrets = await parseEnvFile(resolve13(options.envFile));
251300
+ secrets = await parseEnvFile(resolve14(options.envFile));
250917
251301
  if (Object.keys(secrets).length === 0) {
250918
251302
  throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
250919
251303
  }
@@ -250942,7 +251326,7 @@ function getSecretsCommand() {
250942
251326
  }
250943
251327
 
250944
251328
  // src/cli/commands/site/deploy.ts
250945
- import { resolve as resolve14 } from "node:path";
251329
+ import { resolve as resolve15 } from "node:path";
250946
251330
  async function deployAction2(ctx, options) {
250947
251331
  const { isNonInteractive } = ctx;
250948
251332
  if (isNonInteractive && !options.yes) {
@@ -251020,23 +251404,23 @@ async function deployTarball({ runTask }, project) {
251020
251404
  }
251021
251405
  function siteOutputDir(project) {
251022
251406
  const outputDirectory = project.site?.outputDirectory;
251023
- return outputDirectory ? resolve14(project.root, outputDirectory) : null;
251407
+ return outputDirectory ? resolve15(project.root, outputDirectory) : null;
251024
251408
  }
251025
251409
  function getSiteDeployCommand() {
251026
251410
  const command = 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)");
251027
251411
  if (deploymentsApiEnabled()) {
251028
- command.addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash2));
251029
- command.addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency2));
251412
+ command.addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash));
251413
+ command.addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
251030
251414
  }
251031
251415
  return command.action(deployAction2);
251032
251416
  }
251033
- function parseGitHash2(value) {
251417
+ function parseGitHash(value) {
251034
251418
  if (!isGitCommitHash(value)) {
251035
251419
  throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
251036
251420
  }
251037
251421
  return value;
251038
251422
  }
251039
- function parseConcurrency2(value) {
251423
+ function parseConcurrency(value) {
251040
251424
  const parsed = Number(value);
251041
251425
  if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_UPLOAD_CONCURRENCY) {
251042
251426
  throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_UPLOAD_CONCURRENCY}.`);
@@ -251074,10 +251458,12 @@ var EMPTY_TEMPLATE = import_common_tags.stripIndent`
251074
251458
  // Auto-generated by Base44 CLI - DO NOT EDIT
251075
251459
  // Regenerate with: base44 types
251076
251460
  //
251077
- // No entities, functions, agents, or connectors found in project.
251078
- // Add resources to base44/entities/, base44/functions/, base44/agents/, or base44/connectors/
251461
+ // No entities, functions, actors, agents, or connectors found in project.
251462
+ // Add resources to base44/entities/, base44/functions/, base44/actors/, base44/agents/, or base44/connectors/
251079
251463
  // and run \`base44 types generate\` again.
251080
251464
 
251465
+ import '@base44/sdk';
251466
+
251081
251467
  declare module '@base44/sdk' {
251082
251468
  // No types to augment - add resources and regenerate
251083
251469
  }
@@ -251087,8 +251473,8 @@ async function generateTypesFile(input) {
251087
251473
  await writeFile(getTypesOutputPath(input.projectRoot), content);
251088
251474
  }
251089
251475
  async function generateContent(input) {
251090
- const { entities, functions, agents, connectors } = input;
251091
- if (!entities.length && !functions.length && !agents.length && !connectors.length) {
251476
+ const { entities, functions, actors, agents, connectors } = input;
251477
+ if (!entities.length && !functions.length && !actors.length && !agents.length && !connectors.length) {
251092
251478
  return EMPTY_TEMPLATE;
251093
251479
  }
251094
251480
  const entityInterfaces = await Promise.all(entities.map((e) => compileEntity(e)));
@@ -251098,12 +251484,14 @@ async function generateContent(input) {
251098
251484
  entities.map((e) => `"${e.name}": ${toPascalCase(e.name)};`)
251099
251485
  ],
251100
251486
  ["FunctionNameRegistry", functions.map((f) => `"${f.name}": true;`)],
251487
+ ["ActorNameRegistry", actors.map((actor) => `"${actor.name}": true;`)],
251101
251488
  ["AgentNameRegistry", agents.map((a) => `"${a.name}": true;`)],
251102
251489
  ["ConnectorTypeRegistry", connectors.map((c) => `"${c.type}": true;`)]
251103
251490
  ];
251104
251491
  const registries = registryEntries.filter(([, entries]) => entries.length > 0).map(([name, entries]) => registry2(name, entries));
251105
251492
  return [
251106
251493
  HEADER2,
251494
+ "import '@base44/sdk';",
251107
251495
  entityInterfaces.join(`
251108
251496
 
251109
251497
  `),
@@ -251148,10 +251536,10 @@ function toPascalCase(name) {
251148
251536
  return name.split(/[-_\s]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
251149
251537
  }
251150
251538
  // src/core/types/update-project.ts
251151
- import { join as join31 } from "node:path";
251539
+ import { join as join33 } from "node:path";
251152
251540
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
251153
251541
  async function updateProjectConfig(projectRoot) {
251154
- const tsconfigPath = join31(projectRoot, "tsconfig.json");
251542
+ const tsconfigPath = join33(projectRoot, "tsconfig.json");
251155
251543
  if (!await pathExists(tsconfigPath)) {
251156
251544
  return false;
251157
251545
  }
@@ -251175,12 +251563,13 @@ var TYPES_FILE_PATH = "base44/.types/types.d.ts";
251175
251563
  async function generateTypesAction({
251176
251564
  runTask
251177
251565
  }) {
251178
- const { entities, functions, agents, connectors, project } = await readProjectConfig();
251566
+ const { entities, functions, actors, agents, connectors, project } = await readProjectConfig();
251179
251567
  await runTask("Generating types", async () => {
251180
251568
  await generateTypesFile({
251181
251569
  projectRoot: project.root,
251182
251570
  entities,
251183
251571
  functions,
251572
+ actors,
251184
251573
  agents,
251185
251574
  connectors
251186
251575
  });
@@ -251226,35 +251615,27 @@ async function createAction2({ runTask, jsonMode, app }, options) {
251226
251615
  };
251227
251616
  }
251228
251617
  function getVersionCreateCommand() {
251229
- return new Base44Command("create").description("Record the built output as a version, without deploying it").option("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)").addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser((value) => {
251230
- if (!isGitCommitHash(value)) {
251231
- throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
251232
- }
251233
- return value;
251234
- })).addOption(new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
251235
- const parsed = Number(value);
251236
- if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
251237
- throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
251238
- }
251239
- return parsed;
251240
- })).action(createAction2);
251618
+ return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(createAction2);
251241
251619
  }
251242
251620
 
251243
251621
  // src/cli/commands/versions/deploy.ts
251244
251622
  import { randomUUID as randomUUID5 } from "node:crypto";
251245
251623
  async function deployAction3({ runTask, jsonMode }, versionId, options) {
251246
- const deployment = await runTask(`Deploying version ${versionId}...`, async () => await deployVersion(versionId, {
251247
- target: options.target,
251624
+ const environment = options.target ?? DEFAULT_ENVIRONMENT;
251625
+ const result = await runTask(`Pointing ${environment} at ${versionId}...`, async () => await setEnvironmentVersion(environment, versionId, {
251248
251626
  idempotencyKey: randomUUID5()
251249
- }), { successMessage: "Version deployed", errorMessage: "Deploy failed" });
251627
+ }), {
251628
+ successMessage: "Environment updated",
251629
+ errorMessage: "Could not update the environment"
251630
+ });
251250
251631
  return {
251251
- outroMessage: `Deployment ${deployment.deploymentId} at revision ${deployment.revision}`,
251252
- stdout: jsonMode ? `${JSON.stringify(deployment, null, 2)}
251632
+ outroMessage: `${result.name} now serves ${result.versionId}`,
251633
+ stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
251253
251634
  ` : undefined
251254
251635
  };
251255
251636
  }
251256
251637
  function getVersionDeployCommand() {
251257
- return new Base44Command("deploy").description("Serve an already-recorded version (also how a rollback is done)").argument("<version-id>", "The version to serve").option("--target <name>", "Environment to serve the version at").action(deployAction3);
251638
+ return new Base44Command("deploy").description("Point an environment at an already-recorded version (also the rollback)").argument("<version-id>", "The version to serve").option("--target <name>", "Environment to point at it").action(deployAction3);
251258
251639
  }
251259
251640
 
251260
251641
  // src/cli/commands/versions/index.ts
@@ -251678,7 +252059,7 @@ function createDevLogger(label, labelColor = theme.styles.dim) {
251678
252059
  // src/cli/dev/dev-server/main.ts
251679
252060
  var import_cors = __toESM(require_lib4(), 1);
251680
252061
  var import_express6 = __toESM(require_express(), 1);
251681
- import { dirname as dirname25, join as join37 } from "node:path";
252062
+ import { dirname as dirname27, join as join38 } from "node:path";
251682
252063
 
251683
252064
  // ../../node_modules/get-port/index.js
251684
252065
  import net from "node:net";
@@ -251808,7 +252189,7 @@ var $tmpName = promisify11(tmp.tmpName);
251808
252189
 
251809
252190
  // src/cli/dev/dev-server/function-manager.ts
251810
252191
  import { spawn as spawn2 } from "node:child_process";
251811
- import { dirname as dirname22, join as join33 } from "node:path";
252192
+ import { dirname as dirname24, join as join34 } from "node:path";
251812
252193
  import { pathToFileURL } from "node:url";
251813
252194
 
251814
252195
  // src/cli/dev/dev-server/base-function-manager.ts
@@ -251913,7 +252294,7 @@ class FunctionManager extends BaseFunctionManager {
251913
252294
  }
251914
252295
  spawnFunction(func, port) {
251915
252296
  this.logger.log(`Spawning function "${func.name}" on port ${port}`);
251916
- const importMapPath = join33(dirname22(this.wrapperPath), "import-map.json");
252297
+ const importMapPath = join34(dirname24(this.wrapperPath), "import-map.json");
251917
252298
  const process2 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
251918
252299
  env: {
251919
252300
  ...globalThis.process.env,
@@ -251987,7 +252368,7 @@ class FunctionManager extends BaseFunctionManager {
251987
252368
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
251988
252369
  import { isBuiltin } from "node:module";
251989
252370
  import { homedir as homedir3 } from "node:os";
251990
- import { join as join34 } from "node:path";
252371
+ import { join as join35 } from "node:path";
251991
252372
  import { pathToFileURL as pathToFileURL6 } from "node:url";
251992
252373
  var depsPromise;
251993
252374
  function loadDeps() {
@@ -252108,9 +252489,9 @@ export default {
252108
252489
  };
252109
252490
  `;
252110
252491
  function ensureBundlerConfig() {
252111
- const dir = join34(homedir3(), ".base44", "function-bundler");
252492
+ const dir = join35(homedir3(), ".base44", "function-bundler");
252112
252493
  mkdirSync2(dir, { recursive: true });
252113
- const configPath = join34(dir, "deno.json");
252494
+ const configPath = join35(dir, "deno.json");
252114
252495
  writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
252115
252496
  `);
252116
252497
  return configPath;
@@ -253580,16 +253961,16 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
253580
253961
 
253581
253962
  // src/cli/dev/dev-server/watcher.ts
253582
253963
  import { EventEmitter as EventEmitter4 } from "node:events";
253583
- import { relative as relative7 } from "node:path";
253964
+ import { relative as relative9 } from "node:path";
253584
253965
 
253585
253966
  // ../../node_modules/chokidar/index.js
253586
253967
  import { EventEmitter as EventEmitter3 } from "node:events";
253587
253968
  import { stat as statcb, Stats } from "node:fs";
253588
- import { readdir as readdir3, stat as stat7 } from "node:fs/promises";
253969
+ import { readdir as readdir3, stat as stat6 } from "node:fs/promises";
253589
253970
  import * as sp3 from "node:path";
253590
253971
 
253591
253972
  // ../../node_modules/readdirp/index.js
253592
- import { lstat as lstat2, readdir as readdir2, realpath, stat as stat5 } from "node:fs/promises";
253973
+ import { lstat as lstat2, readdir as readdir2, realpath, stat as stat4 } from "node:fs/promises";
253593
253974
  import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
253594
253975
  import { Readable as Readable6 } from "node:stream";
253595
253976
  var EntryTypes = {
@@ -253671,7 +254052,7 @@ class ReaddirpStream extends Readable6 {
253671
254052
  const { root, type } = opts;
253672
254053
  this._fileFilter = normalizeFilter(opts.fileFilter);
253673
254054
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
253674
- const statMethod = opts.lstat ? lstat2 : stat5;
254055
+ const statMethod = opts.lstat ? lstat2 : stat4;
253675
254056
  if (wantBigintFsStats) {
253676
254057
  this._stat = (path) => statMethod(path, { bigint: true });
253677
254058
  } else {
@@ -253824,7 +254205,7 @@ function readdirp(root, options = {}) {
253824
254205
 
253825
254206
  // ../../node_modules/chokidar/handler.js
253826
254207
  import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
253827
- import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat6 } from "node:fs/promises";
254208
+ import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat5 } from "node:fs/promises";
253828
254209
  import { type as osType } from "node:os";
253829
254210
  import * as sp2 from "node:path";
253830
254211
  var STR_DATA = "data";
@@ -253850,7 +254231,7 @@ var EVENTS = {
253850
254231
  };
253851
254232
  var EV = EVENTS;
253852
254233
  var THROTTLE_MODE_WATCH = "watch";
253853
- var statMethods = { lstat: lstat3, stat: stat6 };
254234
+ var statMethods = { lstat: lstat3, stat: stat5 };
253854
254235
  var KEY_LISTENERS = "listeners";
253855
254236
  var KEY_ERR = "errHandlers";
253856
254237
  var KEY_RAW = "rawEmitters";
@@ -254321,7 +254702,7 @@ class NodeFsHandler {
254321
254702
  return;
254322
254703
  if (!newStats || newStats.mtimeMs === 0) {
254323
254704
  try {
254324
- const newStats = await stat6(file);
254705
+ const newStats = await stat5(file);
254325
254706
  if (this.fsw.closed)
254326
254707
  return;
254327
254708
  const at = newStats.atimeMs;
@@ -254993,7 +255374,7 @@ class FSWatcher extends EventEmitter3 {
254993
255374
  const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
254994
255375
  let stats;
254995
255376
  try {
254996
- stats = await stat7(fullPath);
255377
+ stats = await stat6(fullPath);
254997
255378
  } catch (err) {}
254998
255379
  if (!stats || this.closed)
254999
255380
  return;
@@ -255265,7 +255646,7 @@ class WatchBase44 extends EventEmitter4 {
255265
255646
  ignoreInitial: true
255266
255647
  });
255267
255648
  watcher.on("all", import_debounce.default(async (_event, path) => {
255268
- this.emit("change", name, relative7(targetPath, path));
255649
+ this.emit("change", name, relative9(targetPath, path));
255269
255650
  }, WATCH_DEBOUNCE_MS));
255270
255651
  watcher.on("error", (err) => {
255271
255652
  this.logger.error(`Watch handler failed for ${targetPath}`, err);
@@ -255302,6 +255683,11 @@ async function createDevServer(options) {
255302
255683
  next();
255303
255684
  });
255304
255685
  const devLogger = createDevLogger("backend", theme.styles.info);
255686
+ app.use("/api/apps/:appId/actors", (_req, res) => {
255687
+ const message = "Actors are not available in local development";
255688
+ devLogger.error(message);
255689
+ res.status(500).json({ error: message });
255690
+ });
255305
255691
  const functionManager = await createFunctionRuntime(functions, devLogger, options.denoWrapperPath);
255306
255692
  const functionRoutes = createFunctionRouter(functionManager, devLogger);
255307
255693
  app.use("/api/apps/:appId/functions", functionRoutes);
@@ -255372,8 +255758,8 @@ async function createDevServer(options) {
255372
255758
  broadcastEntityEvent(io, appId, entityName, event);
255373
255759
  };
255374
255760
  const base44ConfigWatcher = new WatchBase44({
255375
- functions: join37(dirname25(project.configPath), project.functionsDir),
255376
- entities: join37(dirname25(project.configPath), project.entitiesDir)
255761
+ functions: join38(dirname27(project.configPath), project.functionsDir),
255762
+ entities: join38(dirname27(project.configPath), project.entitiesDir)
255377
255763
  }, devLogger);
255378
255764
  base44ConfigWatcher.on("change", async (name) => {
255379
255765
  try {
@@ -255770,7 +256156,7 @@ Examples:
255770
256156
  }
255771
256157
 
255772
256158
  // src/cli/commands/project/eject.ts
255773
- import { resolve as resolve18 } from "node:path";
256159
+ import { resolve as resolve19 } from "node:path";
255774
256160
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
255775
256161
  async function eject(ctx, options, command) {
255776
256162
  const { log, runTask, isNonInteractive } = ctx;
@@ -255834,7 +256220,7 @@ async function eject(ctx, options, command) {
255834
256220
  Ne("Operation cancelled.");
255835
256221
  throw new CLIExitError(0);
255836
256222
  }
255837
- const resolvedPath = resolve18(selectedPath);
256223
+ const resolvedPath = resolve19(selectedPath);
255838
256224
  await runTask("Downloading your project's code...", async (updateMessage) => {
255839
256225
  await createProjectFilesForExistingProject({
255840
256226
  projectId,
@@ -255901,7 +256287,7 @@ function createProgram(context) {
255901
256287
  program.addCommand(getScaffoldCommand());
255902
256288
  program.addCommand(getDashboardCommand());
255903
256289
  program.addCommand(getBuildCommand());
255904
- program.addCommand(getDeployCommand2());
256290
+ program.addCommand(getDeployCommand3());
255905
256291
  program.addCommand(getVisibilityCommand());
255906
256292
  program.addCommand(getLinkCommand());
255907
256293
  program.addCommand(getEjectCommand());
@@ -255911,14 +256297,17 @@ function createProgram(context) {
255911
256297
  program.addCommand(getAgentSkillsCommand());
255912
256298
  program.addCommand(getConnectorsCommand());
255913
256299
  program.addCommand(getFunctionsCommand());
256300
+ program.addCommand(getActorsCommand());
255914
256301
  program.addCommand(getWorkflowsCommand());
255915
256302
  program.addCommand(getSecretsCommand());
255916
256303
  program.addCommand(getSandboxCommand());
255917
256304
  program.addCommand(getBranchesCommand());
255918
256305
  program.addCommand(getAuthCommand());
255919
256306
  program.addCommand(getSiteCommand());
255920
- program.addCommand(getPublishCommand());
255921
- program.addCommand(getVersionsCommand());
256307
+ if (versionsApiEnabled()) {
256308
+ program.addCommand(getPublishCommand());
256309
+ program.addCommand(getVersionsCommand());
256310
+ }
255922
256311
  program.addCommand(getTypesCommand());
255923
256312
  program.addCommand(getExecCommand());
255924
256313
  program.addCommand(getDevCommand());
@@ -255931,7 +256320,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
255931
256320
  import { release, type } from "node:os";
255932
256321
 
255933
256322
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
255934
- import { dirname as dirname26, posix, sep as sep2 } from "path";
256323
+ import { dirname as dirname28, posix, sep as sep2 } from "path";
255935
256324
  function createModulerModifier() {
255936
256325
  const getModuleFromFileName = createGetModuleFromFilename();
255937
256326
  return async (frames) => {
@@ -255940,7 +256329,7 @@ function createModulerModifier() {
255940
256329
  return frames;
255941
256330
  };
255942
256331
  }
255943
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname26(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
256332
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname28(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
255944
256333
  const normalizedBase = isWindows ? normalizeWindowsPath2(basePath) : basePath;
255945
256334
  return (filename) => {
255946
256335
  if (!filename)
@@ -257975,7 +258364,7 @@ class ReduceableCache {
257975
258364
  }
257976
258365
  }
257977
258366
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
257978
- import { createReadStream as createReadStream4 } from "node:fs";
258367
+ import { createReadStream as createReadStream3 } from "node:fs";
257979
258368
  import { createInterface as createInterface2 } from "node:readline";
257980
258369
  var LRU_FILE_CONTENTS_CACHE = new ReduceableCache(25);
257981
258370
  var LRU_FILE_CONTENTS_FS_READ_FAILED = new ReduceableCache(20);
@@ -258019,7 +258408,7 @@ async function addSourceContext(frames) {
258019
258408
  }
258020
258409
  function getContextLinesFromFile(path, ranges, output) {
258021
258410
  return new Promise((resolve) => {
258022
- const stream = createReadStream4(path);
258411
+ const stream = createReadStream3(path);
258023
258412
  const lineReaded = createInterface2({
258024
258413
  input: stream
258025
258414
  });
@@ -259929,9 +260318,9 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
259929
260318
  });
259930
260319
  }
259931
260320
  // src/cli/index.ts
259932
- var __dirname4 = dirname27(fileURLToPath6(import.meta.url));
260321
+ var __dirname4 = dirname29(fileURLToPath6(import.meta.url));
259933
260322
  async function runCLI(options) {
259934
- ensureNpmAssets(join38(__dirname4, "../assets"));
260323
+ ensureNpmAssets(join39(__dirname4, "../assets"));
259935
260324
  const errorReporter = new ErrorReporter;
259936
260325
  errorReporter.registerProcessErrorHandlers();
259937
260326
  const jsonMode = process.argv.includes("--json");
@@ -259970,4 +260359,4 @@ export {
259970
260359
  runCLI
259971
260360
  };
259972
260361
 
259973
- //# debugId=8ACC6798F4A12B0564756E2164756E21
260362
+ //# debugId=A3CC3878ECA39CF664756E2164756E21