runcastle 1.3.2 → 1.3.3

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/bin/runcastle.js CHANGED
@@ -1018,7 +1018,8 @@ var init_client = __esm(() => {
1018
1018
 
1019
1019
  // src/launcher/asset-paths.ts
1020
1020
  import { existsSync as existsSync2 } from "fs";
1021
- import { join as join3, resolve as resolve2 } from "path";
1021
+ import { dirname, join as join3, resolve as resolve2 } from "path";
1022
+ import { fileURLToPath } from "url";
1022
1023
  function resolveAsset(envVar, fallback) {
1023
1024
  const override = process.env[envVar];
1024
1025
  if (override) {
@@ -1039,6 +1040,17 @@ function vendoredAssetPaths(pkgRoot) {
1039
1040
  [ASSET_ENV.sandcastleTemplate]: join3(pkgRoot, "sandcastle-template")
1040
1041
  };
1041
1042
  }
1043
+ function sandcastleTemplateFallback(moduleDir) {
1044
+ const inSource = join3(moduleDir, "..", "assets", "sandcastle");
1045
+ const installed = [moduleDir, dirname(moduleDir)].map((pkgRoot) => vendoredAssetPaths(pkgRoot)[ASSET_ENV.sandcastleTemplate]);
1046
+ return [inSource, ...installed].find((dir) => existsSync2(dir)) ?? inSource;
1047
+ }
1048
+ function sandcastleTemplateDir() {
1049
+ return resolveAsset(ASSET_ENV.sandcastleTemplate, sandcastleTemplateFallback(dirname(fileURLToPath(import.meta.url))));
1050
+ }
1051
+ function burnerDockerfilePath() {
1052
+ return join3(sandcastleTemplateDir(), "Dockerfile");
1053
+ }
1042
1054
  function applyInstalledAssetEnv(pkgRoot) {
1043
1055
  for (const [envVar, path] of Object.entries(vendoredAssetPaths(pkgRoot))) {
1044
1056
  if (process.env[envVar] === undefined && existsSync2(path))
@@ -1236,7 +1248,7 @@ var init_kill_tree = () => {};
1236
1248
  import { spawn as spawn2 } from "child_process";
1237
1249
  import { createRequire } from "module";
1238
1250
  import { existsSync as existsSync4 } from "fs";
1239
- import { fileURLToPath } from "url";
1251
+ import { fileURLToPath as fileURLToPath2 } from "url";
1240
1252
  function isBun() {
1241
1253
  return typeof globalThis.Bun !== "undefined";
1242
1254
  }
@@ -1429,7 +1441,7 @@ var init_pty_sidecar = __esm(() => {
1429
1441
  init_asset_paths();
1430
1442
  init_resolve_executable();
1431
1443
  init_kill_tree();
1432
- HOST_PATH = resolveAsset(ASSET_ENV.ptyHost, fileURLToPath(new URL("./pty-host.cjs", import.meta.url)));
1444
+ HOST_PATH = resolveAsset(ASSET_ENV.ptyHost, fileURLToPath2(new URL("./pty-host.cjs", import.meta.url)));
1433
1445
  });
1434
1446
 
1435
1447
  // src/pty/pty.ts
@@ -2906,7 +2918,7 @@ import {
2906
2918
  writeFileSync
2907
2919
  } from "fs";
2908
2920
  import { tmpdir } from "os";
2909
- import { dirname, join as join6, resolve as resolve4 } from "path";
2921
+ import { dirname as dirname2, join as join6, resolve as resolve4 } from "path";
2910
2922
  import { simpleGit } from "simple-git";
2911
2923
  function deriveDriveState(info) {
2912
2924
  if (!info)
@@ -3068,7 +3080,7 @@ async function ensureTalkWorktree(project, feature) {
3068
3080
  return addWorktree(g, worktreePath, branch, "talk worktree");
3069
3081
  }
3070
3082
  async function addWorktree(g, worktreePath, branch, label) {
3071
- mkdirSync2(dirname(worktreePath), { recursive: true });
3083
+ mkdirSync2(dirname2(worktreePath), { recursive: true });
3072
3084
  try {
3073
3085
  await g.raw(["worktree", "add", worktreePath, branch]);
3074
3086
  return worktreePath;
@@ -3275,7 +3287,7 @@ async function excludeFilePath(repoPath) {
3275
3287
  }
3276
3288
  async function excludePath(repoPath, pattern) {
3277
3289
  const file = await excludeFilePath(repoPath);
3278
- mkdirSync2(dirname(file), { recursive: true });
3290
+ mkdirSync2(dirname2(file), { recursive: true });
3279
3291
  const current = existsSync6(file) ? readFileSync3(file, "utf8") : "";
3280
3292
  if (current.split(/\r?\n/).includes(pattern))
3281
3293
  return;
@@ -4279,10 +4291,10 @@ var init_skills = __esm(() => {
4279
4291
 
4280
4292
  // src/launcher/artifacts.ts
4281
4293
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "fs";
4282
- import { fileURLToPath as fileURLToPath2 } from "url";
4294
+ import { fileURLToPath as fileURLToPath3 } from "url";
4283
4295
  import { join as join7 } from "path";
4284
4296
  function hookClientPath() {
4285
- return resolveAsset(ASSET_ENV.hookClient, fileURLToPath2(new URL("./hook-client.ts", import.meta.url)));
4297
+ return resolveAsset(ASSET_ENV.hookClient, fileURLToPath3(new URL("./hook-client.ts", import.meta.url)));
4286
4298
  }
4287
4299
  function serverUrlFor(config2) {
4288
4300
  return `http://localhost:${config2.serverPort}`;
@@ -4878,8 +4890,8 @@ var init_artifacts = __esm(() => {
4878
4890
 
4879
4891
  // src/launcher/skills-root.ts
4880
4892
  import { existsSync as existsSync7 } from "fs";
4881
- import { dirname as dirname2, join as join8, resolve as resolve6 } from "path";
4882
- import { fileURLToPath as fileURLToPath3 } from "url";
4893
+ import { dirname as dirname3, join as join8, resolve as resolve6 } from "path";
4894
+ import { fileURLToPath as fileURLToPath4 } from "url";
4883
4895
  function resolveSkillsRoot(fromDir) {
4884
4896
  const override = process.env[SKILLS_DIR_ENV];
4885
4897
  if (override) {
@@ -4895,7 +4907,7 @@ function resolveSkillsRoot(fromDir) {
4895
4907
  searched.push(candidate);
4896
4908
  if (existsSync7(join8(candidate, SKILLS_MARKER)))
4897
4909
  return candidate;
4898
- const parent = dirname2(dir);
4910
+ const parent = dirname3(dir);
4899
4911
  if (parent === dir)
4900
4912
  break;
4901
4913
  dir = parent;
@@ -4904,7 +4916,7 @@ function resolveSkillsRoot(fromDir) {
4904
4916
  ${searched.join(`
4905
4917
  `)}`);
4906
4918
  }
4907
- function resolvePluginDir(fromDir = dirname2(fileURLToPath3(import.meta.url))) {
4919
+ function resolvePluginDir(fromDir = dirname3(fileURLToPath4(import.meta.url))) {
4908
4920
  const rel = join8("packages", "skills", "packs", "runcastle");
4909
4921
  const override = process.env[SKILLS_DIR_ENV];
4910
4922
  if (override) {
@@ -4920,7 +4932,7 @@ function resolvePluginDir(fromDir = dirname2(fileURLToPath3(import.meta.url))) {
4920
4932
  searched.push(candidate);
4921
4933
  if (existsSync7(candidate))
4922
4934
  return candidate;
4923
- const parent = dirname2(dir);
4935
+ const parent = dirname3(dir);
4924
4936
  if (parent === dir)
4925
4937
  break;
4926
4938
  dir = parent;
@@ -5032,7 +5044,6 @@ var init_codex_auth = () => {};
5032
5044
 
5033
5045
  // src/doctor/doctor.ts
5034
5046
  import { existsSync as existsSync9, statSync } from "fs";
5035
- import { fileURLToPath as fileURLToPath4 } from "url";
5036
5047
  async function versionProbe(exec, id, label, bin, fix) {
5037
5048
  const out = await exec(bin, ["--version"]);
5038
5049
  if (out.ok && out.code === 0) {
@@ -5288,7 +5299,7 @@ async function runDoctor(env) {
5288
5299
  const { exec } = env;
5289
5300
  const processEnv = env.env ?? process.env;
5290
5301
  const imageName = env.imageName ?? DEFAULT_SANDBOX_IMAGE;
5291
- const burnerDockerfile = env.burnerDockerfile ?? fileURLToPath4(new URL("../assets/sandcastle/Dockerfile", import.meta.url));
5302
+ const burnerDockerfile = env.burnerDockerfile ?? burnerDockerfilePath();
5292
5303
  const fileMtime = env.fileMtime ?? ((path) => statSync(path).mtime);
5293
5304
  const required = new Set(env.runtimes ?? [DEFAULT_RUNTIME]);
5294
5305
  const results = [
@@ -5320,6 +5331,7 @@ function exitCodeFor(report, mode) {
5320
5331
  var RUNTIME_SPECS;
5321
5332
  var init_doctor = __esm(() => {
5322
5333
  init_src();
5334
+ init_asset_paths();
5323
5335
  init_codex_auth();
5324
5336
  RUNTIME_SPECS = {
5325
5337
  "claude-code": {
@@ -5364,7 +5376,7 @@ import {
5364
5376
  statSync as statSync2,
5365
5377
  writeFileSync as writeFileSync3
5366
5378
  } from "fs";
5367
- import { basename, dirname as dirname3, join as join10, resolve as resolve7 } from "path";
5379
+ import { basename, dirname as dirname4, join as join10, resolve as resolve7 } from "path";
5368
5380
  function codexHomeDir2(sessionId) {
5369
5381
  return join10(sessionDir(sessionId), "codex-home");
5370
5382
  }
@@ -5414,7 +5426,7 @@ function mcpServerTables(userConfigToml) {
5414
5426
  `).trim();
5415
5427
  }
5416
5428
  function readInheritedMcpServers(env = process.env) {
5417
- const path = join10(dirname3(realCodexAuthFile(env)), "config.toml");
5429
+ const path = join10(dirname4(realCodexAuthFile(env)), "config.toml");
5418
5430
  if (!existsSync10(path))
5419
5431
  return "";
5420
5432
  try {
@@ -5486,8 +5498,8 @@ function gitInfoDir(worktreePath) {
5486
5498
  if (!named)
5487
5499
  return null;
5488
5500
  const gitDir = resolve7(worktreePath, named[1].trim());
5489
- const parent = dirname3(gitDir);
5490
- return basename(parent) === "worktrees" ? join10(dirname3(parent), "info") : join10(gitDir, "info");
5501
+ const parent = dirname4(gitDir);
5502
+ return basename(parent) === "worktrees" ? join10(dirname4(parent), "info") : join10(gitDir, "info");
5491
5503
  }
5492
5504
  function buildCodexArgs(input) {
5493
5505
  return [
@@ -6806,7 +6818,7 @@ var init_chunk_NGBM7T3E = __esm(() => {
6806
6818
  // ../../node_modules/.bun/@ai-hero+sandcastle@0.12.0/node_modules/@ai-hero/sandcastle/dist/chunk-VOG34SRF.js
6807
6819
  import { createRequire as createRequire4 } from "module";
6808
6820
  import * as clack from "@clack/prompts";
6809
- import { join as join$1, basename as basename2, dirname as dirname4, resolve as resolve9, posix as posix2, normalize, isAbsolute as isAbsolute2 } from "path";
6821
+ import { join as join$1, basename as basename2, dirname as dirname5, resolve as resolve9, posix as posix2, normalize, isAbsolute as isAbsolute2 } from "path";
6810
6822
  import { styleText, promisify } from "util";
6811
6823
  import { existsSync as existsSync13, statSync as statSync5 } from "fs";
6812
6824
  import { tmpdir as tmpdir2, homedir as homedir3 } from "os";
@@ -17948,7 +17960,7 @@ ${e instanceof Error ? e.message : String(e)}`
17948
17960
  const hostFilePath = join$1(untrackedDir, relPath);
17949
17961
  yield* Effect_exports.tryPromise({
17950
17962
  try: async () => {
17951
- await mkdir(dirname4(hostFilePath), { recursive: true });
17963
+ await mkdir(dirname5(hostFilePath), { recursive: true });
17952
17964
  await handle.copyFileOut(sandboxFilePath, hostFilePath);
17953
17965
  },
17954
17966
  catch: (e) => new SyncError({
@@ -17980,7 +17992,7 @@ ${e instanceof Error ? e.message : String(e)}`
17980
17992
  for (const relPath of untrackedFiles) {
17981
17993
  const srcPath = join$1(untrackedDir, relPath);
17982
17994
  const destPath = join$1(hostRepoDir, relPath);
17983
- await mkdir(dirname4(destPath), { recursive: true });
17995
+ await mkdir(dirname5(destPath), { recursive: true });
17984
17996
  const content = await readFile(srcPath);
17985
17997
  await writeFile(destPath, content);
17986
17998
  }
@@ -18631,7 +18643,7 @@ Worktree removed (no uncommitted changes)`);
18631
18643
  }
18632
18644
  if (!isFile2)
18633
18645
  continue;
18634
- const parentDir = dirname4(mount.sandboxPath);
18646
+ const parentDir = dirname5(mount.sandboxPath);
18635
18647
  if (parentDir === sandboxHomedir)
18636
18648
  continue;
18637
18649
  if (!parentDir.startsWith(sandboxHomedir + "/")) {
@@ -29899,7 +29911,7 @@ ${this.stack.split(`
29899
29911
  FileDisplay = {
29900
29912
  layer: (filePath) => Layer_exports.effect(Display, Effect_exports.gen(function* () {
29901
29913
  const fs = yield* FileSystem_exports.FileSystem;
29902
- yield* fs.makeDirectory(dirname4(filePath), { recursive: true }).pipe(Effect_exports.orDie);
29914
+ yield* fs.makeDirectory(dirname5(filePath), { recursive: true }).pipe(Effect_exports.orDie);
29903
29915
  const delimiter = `
29904
29916
  --- Run started: ${(/* @__PURE__ */ new Date()).toISOString()} ---
29905
29917
  `;
@@ -53370,7 +53382,7 @@ var init_chunk_62WN33RK = __esm(() => {
53370
53382
  // ../../node_modules/.bun/@ai-hero+sandcastle@0.12.0/node_modules/@ai-hero/sandcastle/dist/index.js
53371
53383
  import { createRequire as createRequire8 } from "module";
53372
53384
  import { mkdirSync as mkdirSync6, appendFileSync } from "fs";
53373
- import path, { join as join14, posix as posix4, dirname as dirname6, relative as relative3 } from "path";
53385
+ import path, { join as join14, posix as posix4, dirname as dirname7, relative as relative3 } from "path";
53374
53386
  import { styleText as styleText2 } from "util";
53375
53387
  import * as clack2 from "@clack/prompts";
53376
53388
  import { readdir as readdir2, access as access3, readFile as readFile3, mkdir as mkdir3, writeFile as writeFile3, rm as rm3 } from "fs/promises";
@@ -54477,7 +54489,7 @@ Emit only a corrected <${error.tag}> block. Do not change files or run commands.
54477
54489
  }) => {
54478
54490
  const jsonl = await readSandboxFile(handle, sourcePath, tag);
54479
54491
  const rewritten = transferClaudeSession(jsonl, fromCwd, toCwd);
54480
- await mkdir3(dirname6(destPath), { recursive: true });
54492
+ await mkdir3(dirname7(destPath), { recursive: true });
54481
54493
  await writeFile3(destPath, rewritten);
54482
54494
  }, makeClaudeSessionStorage = (options) => {
54483
54495
  const hostProjectsDir = options?.sessionStorage?.hostProjectsDir;
@@ -54548,7 +54560,7 @@ Emit only a corrected <${error.tag}> block. Do not change files or run commands.
54548
54560
  const rewritten = transferCodexSession(jsonl, sandboxCwd, hostCwd);
54549
54561
  const root = hostSessionsDir ?? join14(process.env.HOME ?? "~", ".codex", "sessions");
54550
54562
  const target = join14(root, located.relativePath);
54551
- await mkdir3(dirname6(target), { recursive: true });
54563
+ await mkdir3(dirname7(target), { recursive: true });
54552
54564
  await writeFile3(target, rewritten);
54553
54565
  capturedPaths.set(sessionId, target);
54554
54566
  },
@@ -54754,7 +54766,7 @@ var init_dist = __esm(() => {
54754
54766
 
54755
54767
  // src/services/settings.ts
54756
54768
  import { existsSync as existsSync14, mkdirSync as mkdirSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
54757
- import { dirname as dirname7 } from "path";
54769
+ import { dirname as dirname8 } from "path";
54758
54770
  import * as z3 from "zod";
54759
54771
  import { eq as eq9 } from "drizzle-orm";
54760
54772
  function hostDefaults(logicalCpus) {
@@ -54907,7 +54919,7 @@ function describeValue(value) {
54907
54919
  function writeGlobal(configFile, configKey, value) {
54908
54920
  const raw = readRawConfig(configFile);
54909
54921
  raw[configKey] = value;
54910
- mkdirSync7(dirname7(configFile), { recursive: true });
54922
+ mkdirSync7(dirname8(configFile), { recursive: true });
54911
54923
  writeFileSync5(configFile, `${JSON.stringify(raw, null, 2)}
54912
54924
  `);
54913
54925
  }
@@ -54946,7 +54958,7 @@ function writeStepModel(configFile, step4, value) {
54946
54958
  else
54947
54959
  stepModels[step4] = value;
54948
54960
  raw.stepModels = stepModels;
54949
- mkdirSync7(dirname7(configFile), { recursive: true });
54961
+ mkdirSync7(dirname8(configFile), { recursive: true });
54950
54962
  writeFileSync5(configFile, `${JSON.stringify(raw, null, 2)}
54951
54963
  `);
54952
54964
  }
@@ -55125,7 +55137,7 @@ var init_settings = __esm(() => {
55125
55137
 
55126
55138
  // src/services/setup.ts
55127
55139
  import { copyFileSync as copyFileSync2, existsSync as existsSync15, mkdirSync as mkdirSync8, readFileSync as readFileSync7, readdirSync as readdirSync4, writeFileSync as writeFileSync6 } from "fs";
55128
- import { dirname as dirname8, join as join15 } from "path";
55140
+ import { dirname as dirname9, join as join15 } from "path";
55129
55141
  import { fileURLToPath as fileURLToPath6 } from "url";
55130
55142
  async function writeGitIdentity(exec3, identity4) {
55131
55143
  const name = identity4.name.trim();
@@ -55229,7 +55241,7 @@ async function resolveRuntime(exec3, preferred) {
55229
55241
  function resolveSandcastleBin() {
55230
55242
  try {
55231
55243
  const mainUrl = import.meta.resolve("@ai-hero/sandcastle");
55232
- let dir = dirname8(fileURLToPath6(mainUrl));
55244
+ let dir = dirname9(fileURLToPath6(mainUrl));
55233
55245
  for (let hops = 0;hops < 6; hops++) {
55234
55246
  const manifestPath = join15(dir, "package.json");
55235
55247
  if (existsSync15(manifestPath)) {
@@ -55238,7 +55250,7 @@ function resolveSandcastleBin() {
55238
55250
  return join15(dir, manifest.bin.sandcastle);
55239
55251
  }
55240
55252
  }
55241
- const parent = dirname8(dir);
55253
+ const parent = dirname9(dir);
55242
55254
  if (parent === dir)
55243
55255
  break;
55244
55256
  dir = parent;
@@ -55263,9 +55275,6 @@ function terminalSpec(kind, opts) {
55263
55275
  args: [opts.sandcastleBin, opts.runtime, "build-image", "--image-name", opts.imageName]
55264
55276
  };
55265
55277
  }
55266
- function sandcastleTemplateDir() {
55267
- return resolveAsset(ASSET_ENV.sandcastleTemplate, fileURLToPath6(new URL("../assets/sandcastle", import.meta.url)));
55268
- }
55269
55278
  function refreshSandcastleConfig(templateDir, targetDir) {
55270
55279
  const dir = join15(targetDir, ".sandcastle");
55271
55280
  mkdirSync8(dir, { recursive: true });
@@ -55314,7 +55323,7 @@ function fileAfkTokenIo(exec3, runtime5 = DEFAULT_RUNTIME) {
55314
55323
  return {
55315
55324
  read: () => existsSync15(path2) ? readFileSync7(path2, "utf8") : "",
55316
55325
  write: (content) => {
55317
- mkdirSync8(dirname8(path2), { recursive: true });
55326
+ mkdirSync8(dirname9(path2), { recursive: true });
55318
55327
  writeFileSync6(path2, content, "utf8");
55319
55328
  },
55320
55329
  verify: createCredentialVerifier(exec3, runtime5)
@@ -56301,7 +56310,7 @@ var init_podman = __esm(() => {
56301
56310
 
56302
56311
  // src/workflows/ticket-burner.ts
56303
56312
  import { existsSync as existsSync17, mkdirSync as mkdirSync10, readFileSync as readFileSync9, readdirSync as readdirSync5, rmSync as rmSync3 } from "fs";
56304
- import { dirname as dirname9, join as join17, posix as posixPath, win32 as winPath } from "path";
56313
+ import { dirname as dirname10, join as join17, posix as posixPath, win32 as winPath } from "path";
56305
56314
  import { fileURLToPath as fileURLToPath7 } from "url";
56306
56315
  function missingImageRuntimeMessage(runtime5, image) {
56307
56316
  const binary = RUNTIME_BINARY[runtime5];
@@ -57403,7 +57412,7 @@ function resolverTemplatePath() {
57403
57412
  return burnerAssetPath("resolve-conflict.md");
57404
57413
  }
57405
57414
  function burnerAssetPath(file) {
57406
- const here = dirname9(fileURLToPath7(import.meta.url));
57415
+ const here = dirname10(fileURLToPath7(import.meta.url));
57407
57416
  return join17(resolveSkillsRoot(here), "burner", file);
57408
57417
  }
57409
57418
  function listFeatureDocs(docsDir, prefix = "") {
@@ -58245,7 +58254,7 @@ var init_ticket_burner = __esm(() => {
58245
58254
 
58246
58255
  // src/workflows/research.ts
58247
58256
  import { mkdirSync as mkdirSync11, readFileSync as readFileSync10 } from "fs";
58248
- import { dirname as dirname10, join as join18 } from "path";
58257
+ import { dirname as dirname11, join as join18 } from "path";
58249
58258
  import { fileURLToPath as fileURLToPath8 } from "url";
58250
58259
  function waypointSlug(waypoint) {
58251
58260
  const base = waypoint.title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -58313,7 +58322,7 @@ function interpretResearchResult(result, docRelPath) {
58313
58322
  return { status: "failed", error: "agent produced no commits \u2014 no research summary landed" };
58314
58323
  }
58315
58324
  function researchTemplatePath() {
58316
- const here = dirname10(fileURLToPath8(import.meta.url));
58325
+ const here = dirname11(fileURLToPath8(import.meta.url));
58317
58326
  return join18(resolveSkillsRoot(here), "burner", "research-waypoint.md");
58318
58327
  }
58319
58328
  async function realExecuteResearchRun(ctx, waypoint, config2, token, model) {
@@ -59104,7 +59113,7 @@ var init_features = __esm(() => {
59104
59113
 
59105
59114
  // src/services/test-notes.ts
59106
59115
  import { existsSync as existsSync19, mkdirSync as mkdirSync12, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "fs";
59107
- import { dirname as dirname11 } from "path";
59116
+ import { dirname as dirname12 } from "path";
59108
59117
  import { and as and9, asc as asc5, eq as eq12, lt } from "drizzle-orm";
59109
59118
  function rowToNote(row) {
59110
59119
  return TestNote.parse({
@@ -59360,7 +59369,7 @@ function renderTestNotes(ctx, feature) {
59360
59369
  lines.push(noteLine(ctx, note2));
59361
59370
  }
59362
59371
  const path2 = featureDocPath(projectForFeature(ctx, feature), feature, "test-notes.md");
59363
- mkdirSync12(dirname11(path2), { recursive: true });
59372
+ mkdirSync12(dirname12(path2), { recursive: true });
59364
59373
  writeFileSync8(path2, `${lines.join(`
59365
59374
  `)}
59366
59375
  `, "utf8");
@@ -60936,12 +60945,12 @@ var init_web = __esm(() => {
60936
60945
 
60937
60946
  // src/version.ts
60938
60947
  import { readFileSync as readFileSync12 } from "fs";
60939
- import { dirname as dirname12, join as join21 } from "path";
60948
+ import { dirname as dirname13, join as join21 } from "path";
60940
60949
  import { fileURLToPath as fileURLToPath9 } from "url";
60941
60950
  function runcastleVersion() {
60942
60951
  if (cached4)
60943
60952
  return cached4;
60944
- const here = dirname12(fileURLToPath9(import.meta.url));
60953
+ const here = dirname13(fileURLToPath9(import.meta.url));
60945
60954
  for (const pkgPath of [join21(here, "..", "package.json"), join21(here, "package.json")]) {
60946
60955
  try {
60947
60956
  const pkg = JSON.parse(readFileSync12(pkgPath, "utf8"));
@@ -60960,7 +60969,7 @@ var init_version = () => {};
60960
60969
  // src/services/install-id.ts
60961
60970
  import { randomUUID as randomUUID3 } from "crypto";
60962
60971
  import { existsSync as existsSync22, mkdirSync as mkdirSync13, readFileSync as readFileSync13, writeFileSync as writeFileSync9 } from "fs";
60963
- import { dirname as dirname13 } from "path";
60972
+ import { dirname as dirname14 } from "path";
60964
60973
  function getInstallId() {
60965
60974
  const file = installIdPath();
60966
60975
  try {
@@ -60970,7 +60979,7 @@ function getInstallId() {
60970
60979
  return existing;
60971
60980
  }
60972
60981
  const id3 = randomUUID3();
60973
- mkdirSync13(dirname13(file), { recursive: true });
60982
+ mkdirSync13(dirname14(file), { recursive: true });
60974
60983
  writeFileSync9(file, `${id3}
60975
60984
  `);
60976
60985
  return id3;
@@ -62059,7 +62068,7 @@ var init_feature = __esm(() => {
62059
62068
  // src/services/fsbrowse.ts
62060
62069
  import { existsSync as existsSync24, readdirSync as readdirSync6, statSync as statSync8 } from "fs";
62061
62070
  import { homedir as homedir4 } from "os";
62062
- import { basename as basename3, dirname as dirname14, isAbsolute as isAbsolute3, join as join26, resolve as resolve12, sep as sep4 } from "path";
62071
+ import { basename as basename3, dirname as dirname15, isAbsolute as isAbsolute3, join as join26, resolve as resolve12, sep as sep4 } from "path";
62063
62072
  function expandPath(input, home = homedir4()) {
62064
62073
  const trimmed = input.trim();
62065
62074
  if (trimmed === "")
@@ -62112,7 +62121,7 @@ function crumbsFor(dir) {
62112
62121
  let cur = dir;
62113
62122
  for (;; ) {
62114
62123
  out.unshift({ name: basename3(cur) || cur, path: cur });
62115
- const parent = dirname14(cur);
62124
+ const parent = dirname15(cur);
62116
62125
  if (parent === cur)
62117
62126
  break;
62118
62127
  cur = parent;
@@ -62120,7 +62129,7 @@ function crumbsFor(dir) {
62120
62129
  return out;
62121
62130
  }
62122
62131
  function parentOf(dir) {
62123
- const parent = dirname14(dir);
62132
+ const parent = dirname15(dir);
62124
62133
  return parent === dir ? null : parent;
62125
62134
  }
62126
62135
  function browseDir(input, showHidden = false, home = homedir4()) {
@@ -62134,7 +62143,7 @@ function browseDir(input, showHidden = false, home = homedir4()) {
62134
62143
  let dir = target;
62135
62144
  try {
62136
62145
  if (!statSync8(target).isDirectory())
62137
- dir = dirname14(target);
62146
+ dir = dirname15(target);
62138
62147
  } catch (e) {
62139
62148
  throw new InvalidInputError(`cannot read path: ${target} (${errMsg4(e)})`);
62140
62149
  }
@@ -62608,6 +62617,31 @@ var init_settings2 = __esm(() => {
62608
62617
  });
62609
62618
  });
62610
62619
 
62620
+ // src/doctor/afk-env.ts
62621
+ import { existsSync as existsSync26, readFileSync as readFileSync15 } from "fs";
62622
+ function envWithAfkCredentials() {
62623
+ const merged = { ...process.env };
62624
+ try {
62625
+ const path2 = envPath();
62626
+ if (existsSync26(path2)) {
62627
+ const fromFile = parseEnvFile3(readFileSync15(path2, "utf8"));
62628
+ for (const runtime5 of AGENT_RUNTIMES) {
62629
+ const key = RUNTIME_SPECS[runtime5].afkKey;
62630
+ const value = fromFile[key];
62631
+ if (value && value.length > 0)
62632
+ merged[key] = value;
62633
+ }
62634
+ }
62635
+ } catch {}
62636
+ return merged;
62637
+ }
62638
+ var init_afk_env = __esm(() => {
62639
+ init_src();
62640
+ init_paths();
62641
+ init_ticket_burner();
62642
+ init_doctor();
62643
+ });
62644
+
62611
62645
  // src/trpc/routers/setup.ts
62612
62646
  import { isNotNull as isNotNull4 } from "drizzle-orm";
62613
62647
  import * as z12 from "zod";
@@ -62615,8 +62649,10 @@ var setupRouter;
62615
62649
  var init_setup2 = __esm(() => {
62616
62650
  init_src();
62617
62651
  init_schema();
62652
+ init_afk_env();
62618
62653
  init_doctor();
62619
62654
  init_system_exec();
62655
+ init_asset_paths();
62620
62656
  init_registry();
62621
62657
  init_setup();
62622
62658
  init_resolve_executable();
@@ -62626,6 +62662,8 @@ var init_setup2 = __esm(() => {
62626
62662
  const projectModels = ctx.db.select({ model: projects.model }).from(projects).where(isNotNull4(projects.model)).all().map((p) => p.model);
62627
62663
  return runDoctor({
62628
62664
  exec: createSystemExec(),
62665
+ burnerDockerfile: burnerDockerfilePath(),
62666
+ env: envWithAfkCredentials(),
62629
62667
  runtimes: configuredRuntimes(ctx.config, projectModels),
62630
62668
  ...ctx.config.sandboxImage ? { imageName: ctx.config.sandboxImage } : {}
62631
62669
  });
@@ -63002,26 +63040,9 @@ __export(exports_cli, {
63002
63040
  resolveDoctorEnv: () => resolveDoctorEnv,
63003
63041
  parseMode: () => parseMode
63004
63042
  });
63005
- import { existsSync as existsSync26, readFileSync as readFileSync15 } from "fs";
63006
63043
  function parseMode(argv) {
63007
63044
  return argv.includes("--gate") || argv.includes("--boot") ? "gate" : "diagnostic";
63008
63045
  }
63009
- function envWithAfkCredentials() {
63010
- const merged = { ...process.env };
63011
- try {
63012
- const path2 = envPath();
63013
- if (existsSync26(path2)) {
63014
- const fromFile = parseEnvFile3(readFileSync15(path2, "utf8"));
63015
- for (const runtime5 of AGENT_RUNTIMES) {
63016
- const key = RUNTIME_SPECS[runtime5].afkKey;
63017
- const value = fromFile[key];
63018
- if (value && value.length > 0)
63019
- merged[key] = value;
63020
- }
63021
- }
63022
- } catch {}
63023
- return merged;
63024
- }
63025
63046
  function resolveDoctorEnv() {
63026
63047
  let imageName;
63027
63048
  let runtimes;
@@ -63038,6 +63059,7 @@ function resolveDoctorEnv() {
63038
63059
  env: envWithAfkCredentials(),
63039
63060
  platform: process.platform,
63040
63061
  cwd: process.cwd(),
63062
+ burnerDockerfile: burnerDockerfilePath(),
63041
63063
  ...imageName ? { imageName } : {},
63042
63064
  ...runtimes ? { runtimes } : {}
63043
63065
  };
@@ -63050,9 +63072,9 @@ async function runCli(argv, log4 = console.log) {
63050
63072
  }
63051
63073
  var init_cli = __esm(() => {
63052
63074
  init_src();
63053
- init_paths();
63054
63075
  init_config_load();
63055
- init_ticket_burner();
63076
+ init_asset_paths();
63077
+ init_afk_env();
63056
63078
  init_doctor();
63057
63079
  init_report();
63058
63080
  init_system_exec();
@@ -63062,7 +63084,7 @@ var init_cli = __esm(() => {
63062
63084
  // src/bin/runcastle.ts
63063
63085
  init_asset_paths();
63064
63086
  init_version();
63065
- import { dirname as dirname15, resolve as resolve13 } from "path";
63087
+ import { dirname as dirname16, resolve as resolve13 } from "path";
63066
63088
  import { fileURLToPath as fileURLToPath10 } from "url";
63067
63089
  function parseCommand(argv) {
63068
63090
  const [first, ...rest] = argv;
@@ -63087,7 +63109,7 @@ Usage:
63087
63109
  runcastle --help Show this help
63088
63110
  `;
63089
63111
  async function main(argv) {
63090
- applyInstalledAssetEnv(resolve13(dirname15(fileURLToPath10(import.meta.url)), ".."));
63112
+ applyInstalledAssetEnv(resolve13(dirname16(fileURLToPath10(import.meta.url)), ".."));
63091
63113
  const { command, args: args2 } = parseCommand(argv);
63092
63114
  switch (command) {
63093
63115
  case "version":