@beastmode-develeap/beastmode 0.1.266 → 0.1.267

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/index.js CHANGED
@@ -95,17 +95,36 @@ var init_schemas = __esm({
95
95
  });
96
96
  DeployConfigSchema = z.object({
97
97
  target: z.string().default("pr-only"),
98
+ verify_port: z.number().int().default(3001),
98
99
  config: z.record(z.unknown()).default({})
99
100
  });
100
101
  ProjectConfigSchema = z.object({
101
102
  name: z.string(),
102
- repo: z.string().optional(),
103
103
  path: z.string(),
104
+ github: z.object({
105
+ repo: z.string().default(""),
106
+ default_branch: z.string().default("main")
107
+ }).default({}),
108
+ board: z.object({
109
+ id: z.number().nullable().default(null),
110
+ url: z.string().default("http://127.0.0.1:8080"),
111
+ auto_created: z.boolean().default(false)
112
+ }).default({}),
104
113
  stack: StackConfigSchema,
105
114
  deploy: DeployConfigSchema.default({}),
106
115
  pipeline: z.record(z.unknown()).default({}),
107
116
  models: z.record(z.string()).default({}),
108
- plugins: z.array(z.string()).default([])
117
+ plugins: z.array(z.string()).default([]),
118
+ slots: z.object({
119
+ max: z.number().nullable().default(null)
120
+ }).default({}),
121
+ infra: z.object({
122
+ credentials: z.object({
123
+ mode: z.string().default("factory")
124
+ }).default({}),
125
+ state_backend: z.string().default("auto")
126
+ }).default({}),
127
+ registered_at: z.string().default("")
109
128
  });
110
129
  FactoryIdentitySchema = z.object({
111
130
  factory_name: z.string(),
@@ -2854,7 +2873,10 @@ function mapDaemonToFactory(daemon) {
2854
2873
  const hasDeployConfig = Object.keys(deployConfig).length > 0;
2855
2874
  const projectRaw = {
2856
2875
  name: repoName,
2857
- repo: daemon.github?.project_repo || "",
2876
+ github: {
2877
+ repo: daemon.github?.project_repo || "",
2878
+ default_branch: daemon.github?.base_branch || "main"
2879
+ },
2858
2880
  path: daemon.repos?.project || "",
2859
2881
  stack: {
2860
2882
  detected: stack.name || "node",
@@ -3058,7 +3080,7 @@ function generateDaemonConfig(factoryConfig, projectConfig, factoryPath) {
3058
3080
  taskBackendValue = backendAdapter;
3059
3081
  }
3060
3082
  const boardUrl = process.env.BEASTMODE_BOARD_URL || taskBackend.config?.url || "http://127.0.0.1:8080";
3061
- const projectRepo = projectConfig?.repo || "";
3083
+ const projectRepo = projectConfig?.github?.repo || (projectConfig?.repo ?? "");
3062
3084
  const projectPath = projectConfig?.path || "";
3063
3085
  const projectOrg = projectRepo.split("/")[0] || "beastmode-agent";
3064
3086
  const stack = projectConfig?.stack;
@@ -9243,8 +9265,8 @@ async function runInit(name, opts) {
9243
9265
  throw new Error(`Factory already exists at ./${factoryName}. Use 'beastmode config' to modify.`);
9244
9266
  }
9245
9267
  if (opts.from) {
9246
- const { readFileSync: readFileSync37 } = await import("fs");
9247
- const templateContent = readFileSync37(resolve6(opts.from), "utf-8");
9268
+ const { readFileSync: readFileSync36 } = await import("fs");
9269
+ const templateContent = readFileSync36(resolve6(opts.from), "utf-8");
9248
9270
  const { parseTemplate: parseTemplate2 } = await Promise.resolve().then(() => (init_template_importer(), template_importer_exports));
9249
9271
  const template = parseTemplate2(templateContent);
9250
9272
  info(`Importing from template: ${opts.from}`);
@@ -10228,8 +10250,8 @@ for (const artifact of VALID_ARTIFACTS) {
10228
10250
 
10229
10251
  // src/cli/commands/status.ts
10230
10252
  init_status_checker();
10231
- init_engine();
10232
10253
  init_schemas();
10254
+ init_project_record();
10233
10255
  init_display();
10234
10256
  import { Command as Command10 } from "commander";
10235
10257
  import { existsSync as existsSync24, readFileSync as readFileSync21, readdirSync as readdirSync10 } from "fs";
@@ -12161,10 +12183,10 @@ async function runMigrate(opts) {
12161
12183
  let runDirs = [];
12162
12184
  const checkpoints = /* @__PURE__ */ new Map();
12163
12185
  if (existsSync29(runsDir)) {
12164
- const { readdirSync: readdirSync14 } = await import("fs");
12165
- runDirs = readdirSync14(runsDir).filter((d) => {
12186
+ const { readdirSync: readdirSync13 } = await import("fs");
12187
+ runDirs = readdirSync13(runsDir).filter((d) => {
12166
12188
  try {
12167
- return readdirSync14(join27(runsDir, d)).length > 0;
12189
+ return readdirSync13(join27(runsDir, d)).length > 0;
12168
12190
  } catch {
12169
12191
  return false;
12170
12192
  }
@@ -12272,6 +12294,7 @@ init_display();
12272
12294
  init_board();
12273
12295
  init_bridge();
12274
12296
  init_schemas();
12297
+ init_engine();
12275
12298
  import { Command as Command15 } from "commander";
12276
12299
  import { join as join28 } from "path";
12277
12300
  import { existsSync as existsSync30, readFileSync as readFileSync27, writeFileSync as writeFileSync23, mkdirSync as mkdirSync18 } from "fs";
@@ -12305,25 +12328,16 @@ async function runPipeline(projectName, opts) {
12305
12328
  );
12306
12329
  let projectConfig = null;
12307
12330
  const projectsDir = join28(bmDir, "projects");
12308
- if (existsSync30(projectsDir)) {
12309
- const { readdirSync: readdirSync14 } = await import("fs");
12310
- const projectFiles = readdirSync14(projectsDir).filter(
12311
- (f) => f.endsWith(".json")
12312
- );
12313
- if (projectName) {
12314
- const file = projectFiles.find(
12315
- (f) => f === `${projectName}.json`
12316
- );
12317
- if (!file) {
12318
- throw new Error(`Project not found: ${projectName}`);
12319
- }
12320
- projectConfig = ProjectConfigSchema.parse(
12321
- JSON.parse(readFileSync27(join28(projectsDir, file), "utf-8"))
12322
- );
12323
- } else if (projectFiles.length > 0) {
12324
- projectConfig = ProjectConfigSchema.parse(
12325
- JSON.parse(readFileSync27(join28(projectsDir, projectFiles[0]), "utf-8"))
12326
- );
12331
+ if (projectName) {
12332
+ const record = readProjectRecord(projectsDir, projectName);
12333
+ if (!record) {
12334
+ throw new Error(`Project not found: ${projectName}`);
12335
+ }
12336
+ projectConfig = record;
12337
+ } else {
12338
+ const projects = listProjectRecords(projectsDir);
12339
+ if (projects.length > 0) {
12340
+ projectConfig = projects[0];
12327
12341
  info(`Using project: ${projectConfig.name}`);
12328
12342
  }
12329
12343
  }
@@ -12450,6 +12464,7 @@ init_display();
12450
12464
  init_board();
12451
12465
  init_bridge();
12452
12466
  init_schemas();
12467
+ init_engine();
12453
12468
  import { Command as Command16 } from "commander";
12454
12469
  import { join as join29 } from "path";
12455
12470
  import { existsSync as existsSync31, readFileSync as readFileSync28, writeFileSync as writeFileSync24, mkdirSync as mkdirSync19 } from "fs";
@@ -12483,17 +12498,10 @@ async function runDaemon(opts) {
12483
12498
  );
12484
12499
  let projectConfig = null;
12485
12500
  const projectsDir = join29(bmDir, "projects");
12486
- if (existsSync31(projectsDir)) {
12487
- const { readdirSync: readdirSync14 } = await import("fs");
12488
- const projectFiles = readdirSync14(projectsDir).filter(
12489
- (f) => f.endsWith(".json")
12490
- );
12491
- if (projectFiles.length > 0) {
12492
- projectConfig = ProjectConfigSchema.parse(
12493
- JSON.parse(readFileSync28(join29(projectsDir, projectFiles[0]), "utf-8"))
12494
- );
12495
- info(`Using project: ${projectConfig.name}`);
12496
- }
12501
+ const projects = listProjectRecords(projectsDir);
12502
+ if (projects.length > 0) {
12503
+ projectConfig = projects[0];
12504
+ info(`Using project: ${projectConfig.name}`);
12497
12505
  }
12498
12506
  const cacheDir = join29(bmDir, ".cache");
12499
12507
  mkdirSync19(cacheDir, { recursive: true });
@@ -13201,10 +13209,11 @@ var updateCommand = new Command22("update").description("Pull latest BeastMode i
13201
13209
  });
13202
13210
 
13203
13211
  // src/cli/commands/runner-cmd.ts
13212
+ init_engine();
13204
13213
  init_display();
13205
13214
  import { Command as Command23 } from "commander";
13206
13215
  import { spawn as spawn3 } from "child_process";
13207
- import { existsSync as existsSync38, readdirSync as readdirSync13, readFileSync as readFileSync35 } from "fs";
13216
+ import { existsSync as existsSync38 } from "fs";
13208
13217
  import { basename as basename7, join as join37, resolve as resolve20 } from "path";
13209
13218
 
13210
13219
  // src/cli/runner-image-builder.ts
@@ -14199,18 +14208,12 @@ function resolveProjectName(projectDir) {
14199
14208
  const projectsDir = join37(projectDir, ".beastmode", "projects");
14200
14209
  if (existsSync38(projectsDir)) {
14201
14210
  try {
14202
- for (const entry of readdirSync13(projectsDir)) {
14203
- if (!entry.endsWith(".json")) continue;
14204
- const file = join37(projectsDir, entry);
14205
- try {
14206
- const raw = readFileSync35(file, "utf-8");
14207
- const data = JSON.parse(raw);
14208
- if (typeof data.path === "string" && resolve20(data.path) === resolve20(projectDir) && typeof data.name === "string" && data.name.length > 0) {
14209
- return data.name;
14210
- }
14211
- } catch {
14212
- }
14213
- }
14211
+ const records = listProjectRecords(projectsDir);
14212
+ const target = resolve20(projectDir);
14213
+ const match = records.find(
14214
+ (r) => typeof r.path === "string" && resolve20(r.path) === target
14215
+ );
14216
+ if (match && match.name) return match.name;
14214
14217
  } catch {
14215
14218
  }
14216
14219
  }
@@ -14589,7 +14592,7 @@ runnerCommand.command("build-image").description(
14589
14592
  // src/cli/commands/project-cmd.ts
14590
14593
  init_engine();
14591
14594
  import { Command as Command24 } from "commander";
14592
- import { existsSync as existsSync39, mkdirSync as mkdirSync24, readFileSync as readFileSync36, renameSync as renameSync3 } from "fs";
14595
+ import { existsSync as existsSync39, mkdirSync as mkdirSync24, readFileSync as readFileSync35, renameSync as renameSync3 } from "fs";
14593
14596
  import { join as join38, resolve as resolve21, basename as basename8 } from "path";
14594
14597
  import { execSync as execSync13 } from "child_process";
14595
14598
  var DEFAULT_MAX_PROJECTS = 5;
@@ -14598,7 +14601,7 @@ function getMaxProjects(factoryDir) {
14598
14601
  const configPath = join38(factoryDir, ".beastmode", "config.json");
14599
14602
  if (existsSync39(configPath)) {
14600
14603
  try {
14601
- const config = JSON.parse(readFileSync36(configPath, "utf-8"));
14604
+ const config = JSON.parse(readFileSync35(configPath, "utf-8"));
14602
14605
  if (typeof config.max_projects === "number") return config.max_projects;
14603
14606
  } catch {
14604
14607
  }