runcastle 1.3.1 → 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;
@@ -3145,10 +3157,8 @@ async function ensureProjectWorktree(project, onLanded) {
3145
3157
  if (landed)
3146
3158
  onLanded?.(landed);
3147
3159
  const stillAhead = await branchCommitsAhead(project.repoPath, base, PROJECT_BRANCH);
3148
- if (stillAhead.length === 0) {
3149
- await deleteBranchDetachingWorktrees(g, project.repoPath, PROJECT_BRANCH);
3150
- await g.raw(["branch", PROJECT_BRANCH, base]);
3151
- }
3160
+ if (stillAhead.length === 0)
3161
+ await recutProjectBranch(g, project.repoPath, base);
3152
3162
  if (await worktreeIsValid(g, worktreePath, PROJECT_BRANCH))
3153
3163
  return { worktreePath, base };
3154
3164
  if (existsSync6(worktreePath) && (await registeredWorktrees(g)).has(canon(worktreePath))) {
@@ -3158,6 +3168,20 @@ async function ensureProjectWorktree(project, onLanded) {
3158
3168
  const added = await addWorktree(g, worktreePath, PROJECT_BRANCH, "project worktree");
3159
3169
  return { worktreePath: added, base };
3160
3170
  }
3171
+ async function recutProjectBranch(g, repoPath, base) {
3172
+ const branchIsThere = async () => (await g.branchLocal()).all.includes(PROJECT_BRANCH);
3173
+ if (await branchIsThere()) {
3174
+ if (!await deleteBranchDetachingWorktrees(g, repoPath, PROJECT_BRANCH)) {
3175
+ try {
3176
+ await g.raw(["worktree", "prune"]);
3177
+ } catch {}
3178
+ await deleteBranchDetachingWorktrees(g, repoPath, PROJECT_BRANCH);
3179
+ }
3180
+ if (await branchIsThere())
3181
+ return;
3182
+ }
3183
+ await g.raw(["branch", PROJECT_BRANCH, base]);
3184
+ }
3161
3185
  async function checkoutInWorktree(worktreePath, branch) {
3162
3186
  const gw = git(worktreePath);
3163
3187
  try {
@@ -3263,7 +3287,7 @@ async function excludeFilePath(repoPath) {
3263
3287
  }
3264
3288
  async function excludePath(repoPath, pattern) {
3265
3289
  const file = await excludeFilePath(repoPath);
3266
- mkdirSync2(dirname(file), { recursive: true });
3290
+ mkdirSync2(dirname2(file), { recursive: true });
3267
3291
  const current = existsSync6(file) ? readFileSync3(file, "utf8") : "";
3268
3292
  if (current.split(/\r?\n/).includes(pattern))
3269
3293
  return;
@@ -4267,10 +4291,10 @@ var init_skills = __esm(() => {
4267
4291
 
4268
4292
  // src/launcher/artifacts.ts
4269
4293
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "fs";
4270
- import { fileURLToPath as fileURLToPath2 } from "url";
4294
+ import { fileURLToPath as fileURLToPath3 } from "url";
4271
4295
  import { join as join7 } from "path";
4272
4296
  function hookClientPath() {
4273
- 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)));
4274
4298
  }
4275
4299
  function serverUrlFor(config2) {
4276
4300
  return `http://localhost:${config2.serverPort}`;
@@ -4866,8 +4890,8 @@ var init_artifacts = __esm(() => {
4866
4890
 
4867
4891
  // src/launcher/skills-root.ts
4868
4892
  import { existsSync as existsSync7 } from "fs";
4869
- import { dirname as dirname2, join as join8, resolve as resolve6 } from "path";
4870
- 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";
4871
4895
  function resolveSkillsRoot(fromDir) {
4872
4896
  const override = process.env[SKILLS_DIR_ENV];
4873
4897
  if (override) {
@@ -4883,7 +4907,7 @@ function resolveSkillsRoot(fromDir) {
4883
4907
  searched.push(candidate);
4884
4908
  if (existsSync7(join8(candidate, SKILLS_MARKER)))
4885
4909
  return candidate;
4886
- const parent = dirname2(dir);
4910
+ const parent = dirname3(dir);
4887
4911
  if (parent === dir)
4888
4912
  break;
4889
4913
  dir = parent;
@@ -4892,7 +4916,7 @@ function resolveSkillsRoot(fromDir) {
4892
4916
  ${searched.join(`
4893
4917
  `)}`);
4894
4918
  }
4895
- function resolvePluginDir(fromDir = dirname2(fileURLToPath3(import.meta.url))) {
4919
+ function resolvePluginDir(fromDir = dirname3(fileURLToPath4(import.meta.url))) {
4896
4920
  const rel = join8("packages", "skills", "packs", "runcastle");
4897
4921
  const override = process.env[SKILLS_DIR_ENV];
4898
4922
  if (override) {
@@ -4908,7 +4932,7 @@ function resolvePluginDir(fromDir = dirname2(fileURLToPath3(import.meta.url))) {
4908
4932
  searched.push(candidate);
4909
4933
  if (existsSync7(candidate))
4910
4934
  return candidate;
4911
- const parent = dirname2(dir);
4935
+ const parent = dirname3(dir);
4912
4936
  if (parent === dir)
4913
4937
  break;
4914
4938
  dir = parent;
@@ -5020,7 +5044,6 @@ var init_codex_auth = () => {};
5020
5044
 
5021
5045
  // src/doctor/doctor.ts
5022
5046
  import { existsSync as existsSync9, statSync } from "fs";
5023
- import { fileURLToPath as fileURLToPath4 } from "url";
5024
5047
  async function versionProbe(exec, id, label, bin, fix) {
5025
5048
  const out = await exec(bin, ["--version"]);
5026
5049
  if (out.ok && out.code === 0) {
@@ -5276,7 +5299,7 @@ async function runDoctor(env) {
5276
5299
  const { exec } = env;
5277
5300
  const processEnv = env.env ?? process.env;
5278
5301
  const imageName = env.imageName ?? DEFAULT_SANDBOX_IMAGE;
5279
- const burnerDockerfile = env.burnerDockerfile ?? fileURLToPath4(new URL("../assets/sandcastle/Dockerfile", import.meta.url));
5302
+ const burnerDockerfile = env.burnerDockerfile ?? burnerDockerfilePath();
5280
5303
  const fileMtime = env.fileMtime ?? ((path) => statSync(path).mtime);
5281
5304
  const required = new Set(env.runtimes ?? [DEFAULT_RUNTIME]);
5282
5305
  const results = [
@@ -5308,6 +5331,7 @@ function exitCodeFor(report, mode) {
5308
5331
  var RUNTIME_SPECS;
5309
5332
  var init_doctor = __esm(() => {
5310
5333
  init_src();
5334
+ init_asset_paths();
5311
5335
  init_codex_auth();
5312
5336
  RUNTIME_SPECS = {
5313
5337
  "claude-code": {
@@ -5352,7 +5376,7 @@ import {
5352
5376
  statSync as statSync2,
5353
5377
  writeFileSync as writeFileSync3
5354
5378
  } from "fs";
5355
- 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";
5356
5380
  function codexHomeDir2(sessionId) {
5357
5381
  return join10(sessionDir(sessionId), "codex-home");
5358
5382
  }
@@ -5402,7 +5426,7 @@ function mcpServerTables(userConfigToml) {
5402
5426
  `).trim();
5403
5427
  }
5404
5428
  function readInheritedMcpServers(env = process.env) {
5405
- const path = join10(dirname3(realCodexAuthFile(env)), "config.toml");
5429
+ const path = join10(dirname4(realCodexAuthFile(env)), "config.toml");
5406
5430
  if (!existsSync10(path))
5407
5431
  return "";
5408
5432
  try {
@@ -5474,8 +5498,8 @@ function gitInfoDir(worktreePath) {
5474
5498
  if (!named)
5475
5499
  return null;
5476
5500
  const gitDir = resolve7(worktreePath, named[1].trim());
5477
- const parent = dirname3(gitDir);
5478
- 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");
5479
5503
  }
5480
5504
  function buildCodexArgs(input) {
5481
5505
  return [
@@ -6794,7 +6818,7 @@ var init_chunk_NGBM7T3E = __esm(() => {
6794
6818
  // ../../node_modules/.bun/@ai-hero+sandcastle@0.12.0/node_modules/@ai-hero/sandcastle/dist/chunk-VOG34SRF.js
6795
6819
  import { createRequire as createRequire4 } from "module";
6796
6820
  import * as clack from "@clack/prompts";
6797
- 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";
6798
6822
  import { styleText, promisify } from "util";
6799
6823
  import { existsSync as existsSync13, statSync as statSync5 } from "fs";
6800
6824
  import { tmpdir as tmpdir2, homedir as homedir3 } from "os";
@@ -17936,7 +17960,7 @@ ${e instanceof Error ? e.message : String(e)}`
17936
17960
  const hostFilePath = join$1(untrackedDir, relPath);
17937
17961
  yield* Effect_exports.tryPromise({
17938
17962
  try: async () => {
17939
- await mkdir(dirname4(hostFilePath), { recursive: true });
17963
+ await mkdir(dirname5(hostFilePath), { recursive: true });
17940
17964
  await handle.copyFileOut(sandboxFilePath, hostFilePath);
17941
17965
  },
17942
17966
  catch: (e) => new SyncError({
@@ -17968,7 +17992,7 @@ ${e instanceof Error ? e.message : String(e)}`
17968
17992
  for (const relPath of untrackedFiles) {
17969
17993
  const srcPath = join$1(untrackedDir, relPath);
17970
17994
  const destPath = join$1(hostRepoDir, relPath);
17971
- await mkdir(dirname4(destPath), { recursive: true });
17995
+ await mkdir(dirname5(destPath), { recursive: true });
17972
17996
  const content = await readFile(srcPath);
17973
17997
  await writeFile(destPath, content);
17974
17998
  }
@@ -18619,7 +18643,7 @@ Worktree removed (no uncommitted changes)`);
18619
18643
  }
18620
18644
  if (!isFile2)
18621
18645
  continue;
18622
- const parentDir = dirname4(mount.sandboxPath);
18646
+ const parentDir = dirname5(mount.sandboxPath);
18623
18647
  if (parentDir === sandboxHomedir)
18624
18648
  continue;
18625
18649
  if (!parentDir.startsWith(sandboxHomedir + "/")) {
@@ -29887,7 +29911,7 @@ ${this.stack.split(`
29887
29911
  FileDisplay = {
29888
29912
  layer: (filePath) => Layer_exports.effect(Display, Effect_exports.gen(function* () {
29889
29913
  const fs = yield* FileSystem_exports.FileSystem;
29890
- yield* fs.makeDirectory(dirname4(filePath), { recursive: true }).pipe(Effect_exports.orDie);
29914
+ yield* fs.makeDirectory(dirname5(filePath), { recursive: true }).pipe(Effect_exports.orDie);
29891
29915
  const delimiter = `
29892
29916
  --- Run started: ${(/* @__PURE__ */ new Date()).toISOString()} ---
29893
29917
  `;
@@ -53358,7 +53382,7 @@ var init_chunk_62WN33RK = __esm(() => {
53358
53382
  // ../../node_modules/.bun/@ai-hero+sandcastle@0.12.0/node_modules/@ai-hero/sandcastle/dist/index.js
53359
53383
  import { createRequire as createRequire8 } from "module";
53360
53384
  import { mkdirSync as mkdirSync6, appendFileSync } from "fs";
53361
- 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";
53362
53386
  import { styleText as styleText2 } from "util";
53363
53387
  import * as clack2 from "@clack/prompts";
53364
53388
  import { readdir as readdir2, access as access3, readFile as readFile3, mkdir as mkdir3, writeFile as writeFile3, rm as rm3 } from "fs/promises";
@@ -54465,7 +54489,7 @@ Emit only a corrected <${error.tag}> block. Do not change files or run commands.
54465
54489
  }) => {
54466
54490
  const jsonl = await readSandboxFile(handle, sourcePath, tag);
54467
54491
  const rewritten = transferClaudeSession(jsonl, fromCwd, toCwd);
54468
- await mkdir3(dirname6(destPath), { recursive: true });
54492
+ await mkdir3(dirname7(destPath), { recursive: true });
54469
54493
  await writeFile3(destPath, rewritten);
54470
54494
  }, makeClaudeSessionStorage = (options) => {
54471
54495
  const hostProjectsDir = options?.sessionStorage?.hostProjectsDir;
@@ -54536,7 +54560,7 @@ Emit only a corrected <${error.tag}> block. Do not change files or run commands.
54536
54560
  const rewritten = transferCodexSession(jsonl, sandboxCwd, hostCwd);
54537
54561
  const root = hostSessionsDir ?? join14(process.env.HOME ?? "~", ".codex", "sessions");
54538
54562
  const target = join14(root, located.relativePath);
54539
- await mkdir3(dirname6(target), { recursive: true });
54563
+ await mkdir3(dirname7(target), { recursive: true });
54540
54564
  await writeFile3(target, rewritten);
54541
54565
  capturedPaths.set(sessionId, target);
54542
54566
  },
@@ -54742,7 +54766,7 @@ var init_dist = __esm(() => {
54742
54766
 
54743
54767
  // src/services/settings.ts
54744
54768
  import { existsSync as existsSync14, mkdirSync as mkdirSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
54745
- import { dirname as dirname7 } from "path";
54769
+ import { dirname as dirname8 } from "path";
54746
54770
  import * as z3 from "zod";
54747
54771
  import { eq as eq9 } from "drizzle-orm";
54748
54772
  function hostDefaults(logicalCpus) {
@@ -54895,7 +54919,7 @@ function describeValue(value) {
54895
54919
  function writeGlobal(configFile, configKey, value) {
54896
54920
  const raw = readRawConfig(configFile);
54897
54921
  raw[configKey] = value;
54898
- mkdirSync7(dirname7(configFile), { recursive: true });
54922
+ mkdirSync7(dirname8(configFile), { recursive: true });
54899
54923
  writeFileSync5(configFile, `${JSON.stringify(raw, null, 2)}
54900
54924
  `);
54901
54925
  }
@@ -54934,7 +54958,7 @@ function writeStepModel(configFile, step4, value) {
54934
54958
  else
54935
54959
  stepModels[step4] = value;
54936
54960
  raw.stepModels = stepModels;
54937
- mkdirSync7(dirname7(configFile), { recursive: true });
54961
+ mkdirSync7(dirname8(configFile), { recursive: true });
54938
54962
  writeFileSync5(configFile, `${JSON.stringify(raw, null, 2)}
54939
54963
  `);
54940
54964
  }
@@ -55113,7 +55137,7 @@ var init_settings = __esm(() => {
55113
55137
 
55114
55138
  // src/services/setup.ts
55115
55139
  import { copyFileSync as copyFileSync2, existsSync as existsSync15, mkdirSync as mkdirSync8, readFileSync as readFileSync7, readdirSync as readdirSync4, writeFileSync as writeFileSync6 } from "fs";
55116
- import { dirname as dirname8, join as join15 } from "path";
55140
+ import { dirname as dirname9, join as join15 } from "path";
55117
55141
  import { fileURLToPath as fileURLToPath6 } from "url";
55118
55142
  async function writeGitIdentity(exec3, identity4) {
55119
55143
  const name = identity4.name.trim();
@@ -55217,7 +55241,7 @@ async function resolveRuntime(exec3, preferred) {
55217
55241
  function resolveSandcastleBin() {
55218
55242
  try {
55219
55243
  const mainUrl = import.meta.resolve("@ai-hero/sandcastle");
55220
- let dir = dirname8(fileURLToPath6(mainUrl));
55244
+ let dir = dirname9(fileURLToPath6(mainUrl));
55221
55245
  for (let hops = 0;hops < 6; hops++) {
55222
55246
  const manifestPath = join15(dir, "package.json");
55223
55247
  if (existsSync15(manifestPath)) {
@@ -55226,7 +55250,7 @@ function resolveSandcastleBin() {
55226
55250
  return join15(dir, manifest.bin.sandcastle);
55227
55251
  }
55228
55252
  }
55229
- const parent = dirname8(dir);
55253
+ const parent = dirname9(dir);
55230
55254
  if (parent === dir)
55231
55255
  break;
55232
55256
  dir = parent;
@@ -55251,9 +55275,6 @@ function terminalSpec(kind, opts) {
55251
55275
  args: [opts.sandcastleBin, opts.runtime, "build-image", "--image-name", opts.imageName]
55252
55276
  };
55253
55277
  }
55254
- function sandcastleTemplateDir() {
55255
- return resolveAsset(ASSET_ENV.sandcastleTemplate, fileURLToPath6(new URL("../assets/sandcastle", import.meta.url)));
55256
- }
55257
55278
  function refreshSandcastleConfig(templateDir, targetDir) {
55258
55279
  const dir = join15(targetDir, ".sandcastle");
55259
55280
  mkdirSync8(dir, { recursive: true });
@@ -55302,7 +55323,7 @@ function fileAfkTokenIo(exec3, runtime5 = DEFAULT_RUNTIME) {
55302
55323
  return {
55303
55324
  read: () => existsSync15(path2) ? readFileSync7(path2, "utf8") : "",
55304
55325
  write: (content) => {
55305
- mkdirSync8(dirname8(path2), { recursive: true });
55326
+ mkdirSync8(dirname9(path2), { recursive: true });
55306
55327
  writeFileSync6(path2, content, "utf8");
55307
55328
  },
55308
55329
  verify: createCredentialVerifier(exec3, runtime5)
@@ -56289,7 +56310,7 @@ var init_podman = __esm(() => {
56289
56310
 
56290
56311
  // src/workflows/ticket-burner.ts
56291
56312
  import { existsSync as existsSync17, mkdirSync as mkdirSync10, readFileSync as readFileSync9, readdirSync as readdirSync5, rmSync as rmSync3 } from "fs";
56292
- 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";
56293
56314
  import { fileURLToPath as fileURLToPath7 } from "url";
56294
56315
  function missingImageRuntimeMessage(runtime5, image) {
56295
56316
  const binary = RUNTIME_BINARY[runtime5];
@@ -57391,7 +57412,7 @@ function resolverTemplatePath() {
57391
57412
  return burnerAssetPath("resolve-conflict.md");
57392
57413
  }
57393
57414
  function burnerAssetPath(file) {
57394
- const here = dirname9(fileURLToPath7(import.meta.url));
57415
+ const here = dirname10(fileURLToPath7(import.meta.url));
57395
57416
  return join17(resolveSkillsRoot(here), "burner", file);
57396
57417
  }
57397
57418
  function listFeatureDocs(docsDir, prefix = "") {
@@ -58233,7 +58254,7 @@ var init_ticket_burner = __esm(() => {
58233
58254
 
58234
58255
  // src/workflows/research.ts
58235
58256
  import { mkdirSync as mkdirSync11, readFileSync as readFileSync10 } from "fs";
58236
- import { dirname as dirname10, join as join18 } from "path";
58257
+ import { dirname as dirname11, join as join18 } from "path";
58237
58258
  import { fileURLToPath as fileURLToPath8 } from "url";
58238
58259
  function waypointSlug(waypoint) {
58239
58260
  const base = waypoint.title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -58301,7 +58322,7 @@ function interpretResearchResult(result, docRelPath) {
58301
58322
  return { status: "failed", error: "agent produced no commits \u2014 no research summary landed" };
58302
58323
  }
58303
58324
  function researchTemplatePath() {
58304
- const here = dirname10(fileURLToPath8(import.meta.url));
58325
+ const here = dirname11(fileURLToPath8(import.meta.url));
58305
58326
  return join18(resolveSkillsRoot(here), "burner", "research-waypoint.md");
58306
58327
  }
58307
58328
  async function realExecuteResearchRun(ctx, waypoint, config2, token, model) {
@@ -59092,7 +59113,7 @@ var init_features = __esm(() => {
59092
59113
 
59093
59114
  // src/services/test-notes.ts
59094
59115
  import { existsSync as existsSync19, mkdirSync as mkdirSync12, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "fs";
59095
- import { dirname as dirname11 } from "path";
59116
+ import { dirname as dirname12 } from "path";
59096
59117
  import { and as and9, asc as asc5, eq as eq12, lt } from "drizzle-orm";
59097
59118
  function rowToNote(row) {
59098
59119
  return TestNote.parse({
@@ -59348,7 +59369,7 @@ function renderTestNotes(ctx, feature) {
59348
59369
  lines.push(noteLine(ctx, note2));
59349
59370
  }
59350
59371
  const path2 = featureDocPath(projectForFeature(ctx, feature), feature, "test-notes.md");
59351
- mkdirSync12(dirname11(path2), { recursive: true });
59372
+ mkdirSync12(dirname12(path2), { recursive: true });
59352
59373
  writeFileSync8(path2, `${lines.join(`
59353
59374
  `)}
59354
59375
  `, "utf8");
@@ -60924,12 +60945,12 @@ var init_web = __esm(() => {
60924
60945
 
60925
60946
  // src/version.ts
60926
60947
  import { readFileSync as readFileSync12 } from "fs";
60927
- import { dirname as dirname12, join as join21 } from "path";
60948
+ import { dirname as dirname13, join as join21 } from "path";
60928
60949
  import { fileURLToPath as fileURLToPath9 } from "url";
60929
60950
  function runcastleVersion() {
60930
60951
  if (cached4)
60931
60952
  return cached4;
60932
- const here = dirname12(fileURLToPath9(import.meta.url));
60953
+ const here = dirname13(fileURLToPath9(import.meta.url));
60933
60954
  for (const pkgPath of [join21(here, "..", "package.json"), join21(here, "package.json")]) {
60934
60955
  try {
60935
60956
  const pkg = JSON.parse(readFileSync12(pkgPath, "utf8"));
@@ -60948,7 +60969,7 @@ var init_version = () => {};
60948
60969
  // src/services/install-id.ts
60949
60970
  import { randomUUID as randomUUID3 } from "crypto";
60950
60971
  import { existsSync as existsSync22, mkdirSync as mkdirSync13, readFileSync as readFileSync13, writeFileSync as writeFileSync9 } from "fs";
60951
- import { dirname as dirname13 } from "path";
60972
+ import { dirname as dirname14 } from "path";
60952
60973
  function getInstallId() {
60953
60974
  const file = installIdPath();
60954
60975
  try {
@@ -60958,7 +60979,7 @@ function getInstallId() {
60958
60979
  return existing;
60959
60980
  }
60960
60981
  const id3 = randomUUID3();
60961
- mkdirSync13(dirname13(file), { recursive: true });
60982
+ mkdirSync13(dirname14(file), { recursive: true });
60962
60983
  writeFileSync9(file, `${id3}
60963
60984
  `);
60964
60985
  return id3;
@@ -62047,7 +62068,7 @@ var init_feature = __esm(() => {
62047
62068
  // src/services/fsbrowse.ts
62048
62069
  import { existsSync as existsSync24, readdirSync as readdirSync6, statSync as statSync8 } from "fs";
62049
62070
  import { homedir as homedir4 } from "os";
62050
- 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";
62051
62072
  function expandPath(input, home = homedir4()) {
62052
62073
  const trimmed = input.trim();
62053
62074
  if (trimmed === "")
@@ -62100,7 +62121,7 @@ function crumbsFor(dir) {
62100
62121
  let cur = dir;
62101
62122
  for (;; ) {
62102
62123
  out.unshift({ name: basename3(cur) || cur, path: cur });
62103
- const parent = dirname14(cur);
62124
+ const parent = dirname15(cur);
62104
62125
  if (parent === cur)
62105
62126
  break;
62106
62127
  cur = parent;
@@ -62108,7 +62129,7 @@ function crumbsFor(dir) {
62108
62129
  return out;
62109
62130
  }
62110
62131
  function parentOf(dir) {
62111
- const parent = dirname14(dir);
62132
+ const parent = dirname15(dir);
62112
62133
  return parent === dir ? null : parent;
62113
62134
  }
62114
62135
  function browseDir(input, showHidden = false, home = homedir4()) {
@@ -62122,7 +62143,7 @@ function browseDir(input, showHidden = false, home = homedir4()) {
62122
62143
  let dir = target;
62123
62144
  try {
62124
62145
  if (!statSync8(target).isDirectory())
62125
- dir = dirname14(target);
62146
+ dir = dirname15(target);
62126
62147
  } catch (e) {
62127
62148
  throw new InvalidInputError(`cannot read path: ${target} (${errMsg4(e)})`);
62128
62149
  }
@@ -62596,6 +62617,31 @@ var init_settings2 = __esm(() => {
62596
62617
  });
62597
62618
  });
62598
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
+
62599
62645
  // src/trpc/routers/setup.ts
62600
62646
  import { isNotNull as isNotNull4 } from "drizzle-orm";
62601
62647
  import * as z12 from "zod";
@@ -62603,8 +62649,10 @@ var setupRouter;
62603
62649
  var init_setup2 = __esm(() => {
62604
62650
  init_src();
62605
62651
  init_schema();
62652
+ init_afk_env();
62606
62653
  init_doctor();
62607
62654
  init_system_exec();
62655
+ init_asset_paths();
62608
62656
  init_registry();
62609
62657
  init_setup();
62610
62658
  init_resolve_executable();
@@ -62614,6 +62662,8 @@ var init_setup2 = __esm(() => {
62614
62662
  const projectModels = ctx.db.select({ model: projects.model }).from(projects).where(isNotNull4(projects.model)).all().map((p) => p.model);
62615
62663
  return runDoctor({
62616
62664
  exec: createSystemExec(),
62665
+ burnerDockerfile: burnerDockerfilePath(),
62666
+ env: envWithAfkCredentials(),
62617
62667
  runtimes: configuredRuntimes(ctx.config, projectModels),
62618
62668
  ...ctx.config.sandboxImage ? { imageName: ctx.config.sandboxImage } : {}
62619
62669
  });
@@ -62990,26 +63040,9 @@ __export(exports_cli, {
62990
63040
  resolveDoctorEnv: () => resolveDoctorEnv,
62991
63041
  parseMode: () => parseMode
62992
63042
  });
62993
- import { existsSync as existsSync26, readFileSync as readFileSync15 } from "fs";
62994
63043
  function parseMode(argv) {
62995
63044
  return argv.includes("--gate") || argv.includes("--boot") ? "gate" : "diagnostic";
62996
63045
  }
62997
- function envWithAfkCredentials() {
62998
- const merged = { ...process.env };
62999
- try {
63000
- const path2 = envPath();
63001
- if (existsSync26(path2)) {
63002
- const fromFile = parseEnvFile3(readFileSync15(path2, "utf8"));
63003
- for (const runtime5 of AGENT_RUNTIMES) {
63004
- const key = RUNTIME_SPECS[runtime5].afkKey;
63005
- const value = fromFile[key];
63006
- if (value && value.length > 0)
63007
- merged[key] = value;
63008
- }
63009
- }
63010
- } catch {}
63011
- return merged;
63012
- }
63013
63046
  function resolveDoctorEnv() {
63014
63047
  let imageName;
63015
63048
  let runtimes;
@@ -63026,6 +63059,7 @@ function resolveDoctorEnv() {
63026
63059
  env: envWithAfkCredentials(),
63027
63060
  platform: process.platform,
63028
63061
  cwd: process.cwd(),
63062
+ burnerDockerfile: burnerDockerfilePath(),
63029
63063
  ...imageName ? { imageName } : {},
63030
63064
  ...runtimes ? { runtimes } : {}
63031
63065
  };
@@ -63038,9 +63072,9 @@ async function runCli(argv, log4 = console.log) {
63038
63072
  }
63039
63073
  var init_cli = __esm(() => {
63040
63074
  init_src();
63041
- init_paths();
63042
63075
  init_config_load();
63043
- init_ticket_burner();
63076
+ init_asset_paths();
63077
+ init_afk_env();
63044
63078
  init_doctor();
63045
63079
  init_report();
63046
63080
  init_system_exec();
@@ -63050,7 +63084,7 @@ var init_cli = __esm(() => {
63050
63084
  // src/bin/runcastle.ts
63051
63085
  init_asset_paths();
63052
63086
  init_version();
63053
- import { dirname as dirname15, resolve as resolve13 } from "path";
63087
+ import { dirname as dirname16, resolve as resolve13 } from "path";
63054
63088
  import { fileURLToPath as fileURLToPath10 } from "url";
63055
63089
  function parseCommand(argv) {
63056
63090
  const [first, ...rest] = argv;
@@ -63075,7 +63109,7 @@ Usage:
63075
63109
  runcastle --help Show this help
63076
63110
  `;
63077
63111
  async function main(argv) {
63078
- applyInstalledAssetEnv(resolve13(dirname15(fileURLToPath10(import.meta.url)), ".."));
63112
+ applyInstalledAssetEnv(resolve13(dirname16(fileURLToPath10(import.meta.url)), ".."));
63079
63113
  const { command, args: args2 } = parseCommand(argv);
63080
63114
  switch (command) {
63081
63115
  case "version":