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/index.js CHANGED
@@ -1017,7 +1017,8 @@ var init_client = __esm(() => {
1017
1017
 
1018
1018
  // src/launcher/asset-paths.ts
1019
1019
  import { existsSync as existsSync2 } from "fs";
1020
- import { join as join3, resolve as resolve2 } from "path";
1020
+ import { dirname, join as join3, resolve as resolve2 } from "path";
1021
+ import { fileURLToPath } from "url";
1021
1022
  function resolveAsset(envVar, fallback) {
1022
1023
  const override = process.env[envVar];
1023
1024
  if (override) {
@@ -1038,6 +1039,17 @@ function vendoredAssetPaths(pkgRoot) {
1038
1039
  [ASSET_ENV.sandcastleTemplate]: join3(pkgRoot, "sandcastle-template")
1039
1040
  };
1040
1041
  }
1042
+ function sandcastleTemplateFallback(moduleDir) {
1043
+ const inSource = join3(moduleDir, "..", "assets", "sandcastle");
1044
+ const installed = [moduleDir, dirname(moduleDir)].map((pkgRoot) => vendoredAssetPaths(pkgRoot)[ASSET_ENV.sandcastleTemplate]);
1045
+ return [inSource, ...installed].find((dir) => existsSync2(dir)) ?? inSource;
1046
+ }
1047
+ function sandcastleTemplateDir() {
1048
+ return resolveAsset(ASSET_ENV.sandcastleTemplate, sandcastleTemplateFallback(dirname(fileURLToPath(import.meta.url))));
1049
+ }
1050
+ function burnerDockerfilePath() {
1051
+ return join3(sandcastleTemplateDir(), "Dockerfile");
1052
+ }
1041
1053
  function applyInstalledAssetEnv(pkgRoot) {
1042
1054
  for (const [envVar, path] of Object.entries(vendoredAssetPaths(pkgRoot))) {
1043
1055
  if (process.env[envVar] === undefined && existsSync2(path))
@@ -1235,7 +1247,7 @@ var init_kill_tree = () => {};
1235
1247
  import { spawn as spawn2 } from "child_process";
1236
1248
  import { createRequire } from "module";
1237
1249
  import { existsSync as existsSync4 } from "fs";
1238
- import { fileURLToPath } from "url";
1250
+ import { fileURLToPath as fileURLToPath2 } from "url";
1239
1251
  function isBun() {
1240
1252
  return typeof globalThis.Bun !== "undefined";
1241
1253
  }
@@ -1428,7 +1440,7 @@ var init_pty_sidecar = __esm(() => {
1428
1440
  init_asset_paths();
1429
1441
  init_resolve_executable();
1430
1442
  init_kill_tree();
1431
- HOST_PATH = resolveAsset(ASSET_ENV.ptyHost, fileURLToPath(new URL("./pty-host.cjs", import.meta.url)));
1443
+ HOST_PATH = resolveAsset(ASSET_ENV.ptyHost, fileURLToPath2(new URL("./pty-host.cjs", import.meta.url)));
1432
1444
  });
1433
1445
 
1434
1446
  // src/pty/pty.ts
@@ -2905,7 +2917,7 @@ import {
2905
2917
  writeFileSync
2906
2918
  } from "fs";
2907
2919
  import { tmpdir } from "os";
2908
- import { dirname, join as join6, resolve as resolve4 } from "path";
2920
+ import { dirname as dirname2, join as join6, resolve as resolve4 } from "path";
2909
2921
  import { simpleGit } from "simple-git";
2910
2922
  function deriveDriveState(info) {
2911
2923
  if (!info)
@@ -3067,7 +3079,7 @@ async function ensureTalkWorktree(project, feature) {
3067
3079
  return addWorktree(g, worktreePath, branch, "talk worktree");
3068
3080
  }
3069
3081
  async function addWorktree(g, worktreePath, branch, label) {
3070
- mkdirSync2(dirname(worktreePath), { recursive: true });
3082
+ mkdirSync2(dirname2(worktreePath), { recursive: true });
3071
3083
  try {
3072
3084
  await g.raw(["worktree", "add", worktreePath, branch]);
3073
3085
  return worktreePath;
@@ -3144,10 +3156,8 @@ async function ensureProjectWorktree(project, onLanded) {
3144
3156
  if (landed)
3145
3157
  onLanded?.(landed);
3146
3158
  const stillAhead = await branchCommitsAhead(project.repoPath, base, PROJECT_BRANCH);
3147
- if (stillAhead.length === 0) {
3148
- await deleteBranchDetachingWorktrees(g, project.repoPath, PROJECT_BRANCH);
3149
- await g.raw(["branch", PROJECT_BRANCH, base]);
3150
- }
3159
+ if (stillAhead.length === 0)
3160
+ await recutProjectBranch(g, project.repoPath, base);
3151
3161
  if (await worktreeIsValid(g, worktreePath, PROJECT_BRANCH))
3152
3162
  return { worktreePath, base };
3153
3163
  if (existsSync6(worktreePath) && (await registeredWorktrees(g)).has(canon(worktreePath))) {
@@ -3157,6 +3167,20 @@ async function ensureProjectWorktree(project, onLanded) {
3157
3167
  const added = await addWorktree(g, worktreePath, PROJECT_BRANCH, "project worktree");
3158
3168
  return { worktreePath: added, base };
3159
3169
  }
3170
+ async function recutProjectBranch(g, repoPath, base) {
3171
+ const branchIsThere = async () => (await g.branchLocal()).all.includes(PROJECT_BRANCH);
3172
+ if (await branchIsThere()) {
3173
+ if (!await deleteBranchDetachingWorktrees(g, repoPath, PROJECT_BRANCH)) {
3174
+ try {
3175
+ await g.raw(["worktree", "prune"]);
3176
+ } catch {}
3177
+ await deleteBranchDetachingWorktrees(g, repoPath, PROJECT_BRANCH);
3178
+ }
3179
+ if (await branchIsThere())
3180
+ return;
3181
+ }
3182
+ await g.raw(["branch", PROJECT_BRANCH, base]);
3183
+ }
3160
3184
  async function checkoutInWorktree(worktreePath, branch) {
3161
3185
  const gw = git(worktreePath);
3162
3186
  try {
@@ -3262,7 +3286,7 @@ async function excludeFilePath(repoPath) {
3262
3286
  }
3263
3287
  async function excludePath(repoPath, pattern) {
3264
3288
  const file = await excludeFilePath(repoPath);
3265
- mkdirSync2(dirname(file), { recursive: true });
3289
+ mkdirSync2(dirname2(file), { recursive: true });
3266
3290
  const current = existsSync6(file) ? readFileSync3(file, "utf8") : "";
3267
3291
  if (current.split(/\r?\n/).includes(pattern))
3268
3292
  return;
@@ -4266,10 +4290,10 @@ var init_skills = __esm(() => {
4266
4290
 
4267
4291
  // src/launcher/artifacts.ts
4268
4292
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "fs";
4269
- import { fileURLToPath as fileURLToPath2 } from "url";
4293
+ import { fileURLToPath as fileURLToPath3 } from "url";
4270
4294
  import { join as join7 } from "path";
4271
4295
  function hookClientPath() {
4272
- return resolveAsset(ASSET_ENV.hookClient, fileURLToPath2(new URL("./hook-client.ts", import.meta.url)));
4296
+ return resolveAsset(ASSET_ENV.hookClient, fileURLToPath3(new URL("./hook-client.ts", import.meta.url)));
4273
4297
  }
4274
4298
  function serverUrlFor(config2) {
4275
4299
  return `http://localhost:${config2.serverPort}`;
@@ -4865,8 +4889,8 @@ var init_artifacts = __esm(() => {
4865
4889
 
4866
4890
  // src/launcher/skills-root.ts
4867
4891
  import { existsSync as existsSync7 } from "fs";
4868
- import { dirname as dirname2, join as join8, resolve as resolve6 } from "path";
4869
- import { fileURLToPath as fileURLToPath3 } from "url";
4892
+ import { dirname as dirname3, join as join8, resolve as resolve6 } from "path";
4893
+ import { fileURLToPath as fileURLToPath4 } from "url";
4870
4894
  function resolveSkillsRoot(fromDir) {
4871
4895
  const override = process.env[SKILLS_DIR_ENV];
4872
4896
  if (override) {
@@ -4882,7 +4906,7 @@ function resolveSkillsRoot(fromDir) {
4882
4906
  searched.push(candidate);
4883
4907
  if (existsSync7(join8(candidate, SKILLS_MARKER)))
4884
4908
  return candidate;
4885
- const parent = dirname2(dir);
4909
+ const parent = dirname3(dir);
4886
4910
  if (parent === dir)
4887
4911
  break;
4888
4912
  dir = parent;
@@ -4891,7 +4915,7 @@ function resolveSkillsRoot(fromDir) {
4891
4915
  ${searched.join(`
4892
4916
  `)}`);
4893
4917
  }
4894
- function resolvePluginDir(fromDir = dirname2(fileURLToPath3(import.meta.url))) {
4918
+ function resolvePluginDir(fromDir = dirname3(fileURLToPath4(import.meta.url))) {
4895
4919
  const rel = join8("packages", "skills", "packs", "runcastle");
4896
4920
  const override = process.env[SKILLS_DIR_ENV];
4897
4921
  if (override) {
@@ -4907,7 +4931,7 @@ function resolvePluginDir(fromDir = dirname2(fileURLToPath3(import.meta.url))) {
4907
4931
  searched.push(candidate);
4908
4932
  if (existsSync7(candidate))
4909
4933
  return candidate;
4910
- const parent = dirname2(dir);
4934
+ const parent = dirname3(dir);
4911
4935
  if (parent === dir)
4912
4936
  break;
4913
4937
  dir = parent;
@@ -5019,7 +5043,6 @@ var init_codex_auth = () => {};
5019
5043
 
5020
5044
  // src/doctor/doctor.ts
5021
5045
  import { existsSync as existsSync9, statSync } from "fs";
5022
- import { fileURLToPath as fileURLToPath4 } from "url";
5023
5046
  async function versionProbe(exec, id, label, bin, fix) {
5024
5047
  const out = await exec(bin, ["--version"]);
5025
5048
  if (out.ok && out.code === 0) {
@@ -5275,7 +5298,7 @@ async function runDoctor(env) {
5275
5298
  const { exec } = env;
5276
5299
  const processEnv = env.env ?? process.env;
5277
5300
  const imageName = env.imageName ?? DEFAULT_SANDBOX_IMAGE;
5278
- const burnerDockerfile = env.burnerDockerfile ?? fileURLToPath4(new URL("../assets/sandcastle/Dockerfile", import.meta.url));
5301
+ const burnerDockerfile = env.burnerDockerfile ?? burnerDockerfilePath();
5279
5302
  const fileMtime = env.fileMtime ?? ((path) => statSync(path).mtime);
5280
5303
  const required = new Set(env.runtimes ?? [DEFAULT_RUNTIME]);
5281
5304
  const results = [
@@ -5307,6 +5330,7 @@ function exitCodeFor(report, mode) {
5307
5330
  var RUNTIME_SPECS;
5308
5331
  var init_doctor = __esm(() => {
5309
5332
  init_src();
5333
+ init_asset_paths();
5310
5334
  init_codex_auth();
5311
5335
  RUNTIME_SPECS = {
5312
5336
  "claude-code": {
@@ -5351,7 +5375,7 @@ import {
5351
5375
  statSync as statSync2,
5352
5376
  writeFileSync as writeFileSync3
5353
5377
  } from "fs";
5354
- import { basename, dirname as dirname3, join as join10, resolve as resolve7 } from "path";
5378
+ import { basename, dirname as dirname4, join as join10, resolve as resolve7 } from "path";
5355
5379
  function codexHomeDir2(sessionId) {
5356
5380
  return join10(sessionDir(sessionId), "codex-home");
5357
5381
  }
@@ -5401,7 +5425,7 @@ function mcpServerTables(userConfigToml) {
5401
5425
  `).trim();
5402
5426
  }
5403
5427
  function readInheritedMcpServers(env = process.env) {
5404
- const path = join10(dirname3(realCodexAuthFile(env)), "config.toml");
5428
+ const path = join10(dirname4(realCodexAuthFile(env)), "config.toml");
5405
5429
  if (!existsSync10(path))
5406
5430
  return "";
5407
5431
  try {
@@ -5473,8 +5497,8 @@ function gitInfoDir(worktreePath) {
5473
5497
  if (!named)
5474
5498
  return null;
5475
5499
  const gitDir = resolve7(worktreePath, named[1].trim());
5476
- const parent = dirname3(gitDir);
5477
- return basename(parent) === "worktrees" ? join10(dirname3(parent), "info") : join10(gitDir, "info");
5500
+ const parent = dirname4(gitDir);
5501
+ return basename(parent) === "worktrees" ? join10(dirname4(parent), "info") : join10(gitDir, "info");
5478
5502
  }
5479
5503
  function buildCodexArgs(input) {
5480
5504
  return [
@@ -6793,7 +6817,7 @@ var init_chunk_NGBM7T3E = __esm(() => {
6793
6817
  // ../../node_modules/.bun/@ai-hero+sandcastle@0.12.0/node_modules/@ai-hero/sandcastle/dist/chunk-VOG34SRF.js
6794
6818
  import { createRequire as createRequire4 } from "module";
6795
6819
  import * as clack from "@clack/prompts";
6796
- import { join as join$1, basename as basename2, dirname as dirname4, resolve as resolve9, posix as posix2, normalize, isAbsolute as isAbsolute2 } from "path";
6820
+ import { join as join$1, basename as basename2, dirname as dirname5, resolve as resolve9, posix as posix2, normalize, isAbsolute as isAbsolute2 } from "path";
6797
6821
  import { styleText, promisify } from "util";
6798
6822
  import { existsSync as existsSync13, statSync as statSync5 } from "fs";
6799
6823
  import { tmpdir as tmpdir2, homedir as homedir3 } from "os";
@@ -17935,7 +17959,7 @@ ${e instanceof Error ? e.message : String(e)}`
17935
17959
  const hostFilePath = join$1(untrackedDir, relPath);
17936
17960
  yield* Effect_exports.tryPromise({
17937
17961
  try: async () => {
17938
- await mkdir(dirname4(hostFilePath), { recursive: true });
17962
+ await mkdir(dirname5(hostFilePath), { recursive: true });
17939
17963
  await handle.copyFileOut(sandboxFilePath, hostFilePath);
17940
17964
  },
17941
17965
  catch: (e) => new SyncError({
@@ -17967,7 +17991,7 @@ ${e instanceof Error ? e.message : String(e)}`
17967
17991
  for (const relPath of untrackedFiles) {
17968
17992
  const srcPath = join$1(untrackedDir, relPath);
17969
17993
  const destPath = join$1(hostRepoDir, relPath);
17970
- await mkdir(dirname4(destPath), { recursive: true });
17994
+ await mkdir(dirname5(destPath), { recursive: true });
17971
17995
  const content = await readFile(srcPath);
17972
17996
  await writeFile(destPath, content);
17973
17997
  }
@@ -18618,7 +18642,7 @@ Worktree removed (no uncommitted changes)`);
18618
18642
  }
18619
18643
  if (!isFile2)
18620
18644
  continue;
18621
- const parentDir = dirname4(mount.sandboxPath);
18645
+ const parentDir = dirname5(mount.sandboxPath);
18622
18646
  if (parentDir === sandboxHomedir)
18623
18647
  continue;
18624
18648
  if (!parentDir.startsWith(sandboxHomedir + "/")) {
@@ -29886,7 +29910,7 @@ ${this.stack.split(`
29886
29910
  FileDisplay = {
29887
29911
  layer: (filePath) => Layer_exports.effect(Display, Effect_exports.gen(function* () {
29888
29912
  const fs = yield* FileSystem_exports.FileSystem;
29889
- yield* fs.makeDirectory(dirname4(filePath), { recursive: true }).pipe(Effect_exports.orDie);
29913
+ yield* fs.makeDirectory(dirname5(filePath), { recursive: true }).pipe(Effect_exports.orDie);
29890
29914
  const delimiter = `
29891
29915
  --- Run started: ${(/* @__PURE__ */ new Date()).toISOString()} ---
29892
29916
  `;
@@ -53357,7 +53381,7 @@ var init_chunk_62WN33RK = __esm(() => {
53357
53381
  // ../../node_modules/.bun/@ai-hero+sandcastle@0.12.0/node_modules/@ai-hero/sandcastle/dist/index.js
53358
53382
  import { createRequire as createRequire8 } from "module";
53359
53383
  import { mkdirSync as mkdirSync6, appendFileSync } from "fs";
53360
- import path, { join as join14, posix as posix4, dirname as dirname6, relative as relative3 } from "path";
53384
+ import path, { join as join14, posix as posix4, dirname as dirname7, relative as relative3 } from "path";
53361
53385
  import { styleText as styleText2 } from "util";
53362
53386
  import * as clack2 from "@clack/prompts";
53363
53387
  import { readdir as readdir2, access as access3, readFile as readFile3, mkdir as mkdir3, writeFile as writeFile3, rm as rm3 } from "fs/promises";
@@ -54464,7 +54488,7 @@ Emit only a corrected <${error.tag}> block. Do not change files or run commands.
54464
54488
  }) => {
54465
54489
  const jsonl = await readSandboxFile(handle, sourcePath, tag);
54466
54490
  const rewritten = transferClaudeSession(jsonl, fromCwd, toCwd);
54467
- await mkdir3(dirname6(destPath), { recursive: true });
54491
+ await mkdir3(dirname7(destPath), { recursive: true });
54468
54492
  await writeFile3(destPath, rewritten);
54469
54493
  }, makeClaudeSessionStorage = (options) => {
54470
54494
  const hostProjectsDir = options?.sessionStorage?.hostProjectsDir;
@@ -54535,7 +54559,7 @@ Emit only a corrected <${error.tag}> block. Do not change files or run commands.
54535
54559
  const rewritten = transferCodexSession(jsonl, sandboxCwd, hostCwd);
54536
54560
  const root = hostSessionsDir ?? join14(process.env.HOME ?? "~", ".codex", "sessions");
54537
54561
  const target = join14(root, located.relativePath);
54538
- await mkdir3(dirname6(target), { recursive: true });
54562
+ await mkdir3(dirname7(target), { recursive: true });
54539
54563
  await writeFile3(target, rewritten);
54540
54564
  capturedPaths.set(sessionId, target);
54541
54565
  },
@@ -54741,7 +54765,7 @@ var init_dist = __esm(() => {
54741
54765
 
54742
54766
  // src/services/settings.ts
54743
54767
  import { existsSync as existsSync14, mkdirSync as mkdirSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
54744
- import { dirname as dirname7 } from "path";
54768
+ import { dirname as dirname8 } from "path";
54745
54769
  import * as z3 from "zod";
54746
54770
  import { eq as eq9 } from "drizzle-orm";
54747
54771
  function hostDefaults(logicalCpus) {
@@ -54894,7 +54918,7 @@ function describeValue(value) {
54894
54918
  function writeGlobal(configFile, configKey, value) {
54895
54919
  const raw = readRawConfig(configFile);
54896
54920
  raw[configKey] = value;
54897
- mkdirSync7(dirname7(configFile), { recursive: true });
54921
+ mkdirSync7(dirname8(configFile), { recursive: true });
54898
54922
  writeFileSync5(configFile, `${JSON.stringify(raw, null, 2)}
54899
54923
  `);
54900
54924
  }
@@ -54933,7 +54957,7 @@ function writeStepModel(configFile, step4, value) {
54933
54957
  else
54934
54958
  stepModels[step4] = value;
54935
54959
  raw.stepModels = stepModels;
54936
- mkdirSync7(dirname7(configFile), { recursive: true });
54960
+ mkdirSync7(dirname8(configFile), { recursive: true });
54937
54961
  writeFileSync5(configFile, `${JSON.stringify(raw, null, 2)}
54938
54962
  `);
54939
54963
  }
@@ -55112,7 +55136,7 @@ var init_settings = __esm(() => {
55112
55136
 
55113
55137
  // src/services/setup.ts
55114
55138
  import { copyFileSync as copyFileSync2, existsSync as existsSync15, mkdirSync as mkdirSync8, readFileSync as readFileSync7, readdirSync as readdirSync4, writeFileSync as writeFileSync6 } from "fs";
55115
- import { dirname as dirname8, join as join15 } from "path";
55139
+ import { dirname as dirname9, join as join15 } from "path";
55116
55140
  import { fileURLToPath as fileURLToPath6 } from "url";
55117
55141
  async function writeGitIdentity(exec3, identity4) {
55118
55142
  const name = identity4.name.trim();
@@ -55216,7 +55240,7 @@ async function resolveRuntime(exec3, preferred) {
55216
55240
  function resolveSandcastleBin() {
55217
55241
  try {
55218
55242
  const mainUrl = import.meta.resolve("@ai-hero/sandcastle");
55219
- let dir = dirname8(fileURLToPath6(mainUrl));
55243
+ let dir = dirname9(fileURLToPath6(mainUrl));
55220
55244
  for (let hops = 0;hops < 6; hops++) {
55221
55245
  const manifestPath = join15(dir, "package.json");
55222
55246
  if (existsSync15(manifestPath)) {
@@ -55225,7 +55249,7 @@ function resolveSandcastleBin() {
55225
55249
  return join15(dir, manifest.bin.sandcastle);
55226
55250
  }
55227
55251
  }
55228
- const parent = dirname8(dir);
55252
+ const parent = dirname9(dir);
55229
55253
  if (parent === dir)
55230
55254
  break;
55231
55255
  dir = parent;
@@ -55250,9 +55274,6 @@ function terminalSpec(kind, opts) {
55250
55274
  args: [opts.sandcastleBin, opts.runtime, "build-image", "--image-name", opts.imageName]
55251
55275
  };
55252
55276
  }
55253
- function sandcastleTemplateDir() {
55254
- return resolveAsset(ASSET_ENV.sandcastleTemplate, fileURLToPath6(new URL("../assets/sandcastle", import.meta.url)));
55255
- }
55256
55277
  function refreshSandcastleConfig(templateDir, targetDir) {
55257
55278
  const dir = join15(targetDir, ".sandcastle");
55258
55279
  mkdirSync8(dir, { recursive: true });
@@ -55301,7 +55322,7 @@ function fileAfkTokenIo(exec3, runtime5 = DEFAULT_RUNTIME) {
55301
55322
  return {
55302
55323
  read: () => existsSync15(path2) ? readFileSync7(path2, "utf8") : "",
55303
55324
  write: (content) => {
55304
- mkdirSync8(dirname8(path2), { recursive: true });
55325
+ mkdirSync8(dirname9(path2), { recursive: true });
55305
55326
  writeFileSync6(path2, content, "utf8");
55306
55327
  },
55307
55328
  verify: createCredentialVerifier(exec3, runtime5)
@@ -56288,7 +56309,7 @@ var init_podman = __esm(() => {
56288
56309
 
56289
56310
  // src/workflows/ticket-burner.ts
56290
56311
  import { existsSync as existsSync17, mkdirSync as mkdirSync10, readFileSync as readFileSync9, readdirSync as readdirSync5, rmSync as rmSync3 } from "fs";
56291
- import { dirname as dirname9, join as join17, posix as posixPath, win32 as winPath } from "path";
56312
+ import { dirname as dirname10, join as join17, posix as posixPath, win32 as winPath } from "path";
56292
56313
  import { fileURLToPath as fileURLToPath7 } from "url";
56293
56314
  function missingImageRuntimeMessage(runtime5, image) {
56294
56315
  const binary = RUNTIME_BINARY[runtime5];
@@ -57390,7 +57411,7 @@ function resolverTemplatePath() {
57390
57411
  return burnerAssetPath("resolve-conflict.md");
57391
57412
  }
57392
57413
  function burnerAssetPath(file) {
57393
- const here = dirname9(fileURLToPath7(import.meta.url));
57414
+ const here = dirname10(fileURLToPath7(import.meta.url));
57394
57415
  return join17(resolveSkillsRoot(here), "burner", file);
57395
57416
  }
57396
57417
  function listFeatureDocs(docsDir, prefix = "") {
@@ -58232,7 +58253,7 @@ var init_ticket_burner = __esm(() => {
58232
58253
 
58233
58254
  // src/workflows/research.ts
58234
58255
  import { mkdirSync as mkdirSync11, readFileSync as readFileSync10 } from "fs";
58235
- import { dirname as dirname10, join as join18 } from "path";
58256
+ import { dirname as dirname11, join as join18 } from "path";
58236
58257
  import { fileURLToPath as fileURLToPath8 } from "url";
58237
58258
  function waypointSlug(waypoint) {
58238
58259
  const base = waypoint.title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -58300,7 +58321,7 @@ function interpretResearchResult(result, docRelPath) {
58300
58321
  return { status: "failed", error: "agent produced no commits \u2014 no research summary landed" };
58301
58322
  }
58302
58323
  function researchTemplatePath() {
58303
- const here = dirname10(fileURLToPath8(import.meta.url));
58324
+ const here = dirname11(fileURLToPath8(import.meta.url));
58304
58325
  return join18(resolveSkillsRoot(here), "burner", "research-waypoint.md");
58305
58326
  }
58306
58327
  async function realExecuteResearchRun(ctx, waypoint, config2, token, model) {
@@ -59091,7 +59112,7 @@ var init_features = __esm(() => {
59091
59112
 
59092
59113
  // src/services/test-notes.ts
59093
59114
  import { existsSync as existsSync19, mkdirSync as mkdirSync12, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "fs";
59094
- import { dirname as dirname11 } from "path";
59115
+ import { dirname as dirname12 } from "path";
59095
59116
  import { and as and9, asc as asc5, eq as eq12, lt } from "drizzle-orm";
59096
59117
  function rowToNote(row) {
59097
59118
  return TestNote.parse({
@@ -59347,7 +59368,7 @@ function renderTestNotes(ctx, feature) {
59347
59368
  lines.push(noteLine(ctx, note2));
59348
59369
  }
59349
59370
  const path2 = featureDocPath(projectForFeature(ctx, feature), feature, "test-notes.md");
59350
- mkdirSync12(dirname11(path2), { recursive: true });
59371
+ mkdirSync12(dirname12(path2), { recursive: true });
59351
59372
  writeFileSync8(path2, `${lines.join(`
59352
59373
  `)}
59353
59374
  `, "utf8");
@@ -60923,12 +60944,12 @@ var init_web = __esm(() => {
60923
60944
 
60924
60945
  // src/version.ts
60925
60946
  import { readFileSync as readFileSync12 } from "fs";
60926
- import { dirname as dirname12, join as join21 } from "path";
60947
+ import { dirname as dirname13, join as join21 } from "path";
60927
60948
  import { fileURLToPath as fileURLToPath9 } from "url";
60928
60949
  function runcastleVersion() {
60929
60950
  if (cached4)
60930
60951
  return cached4;
60931
- const here = dirname12(fileURLToPath9(import.meta.url));
60952
+ const here = dirname13(fileURLToPath9(import.meta.url));
60932
60953
  for (const pkgPath of [join21(here, "..", "package.json"), join21(here, "package.json")]) {
60933
60954
  try {
60934
60955
  const pkg = JSON.parse(readFileSync12(pkgPath, "utf8"));
@@ -60947,7 +60968,7 @@ var init_version = () => {};
60947
60968
  // src/services/install-id.ts
60948
60969
  import { randomUUID as randomUUID3 } from "crypto";
60949
60970
  import { existsSync as existsSync22, mkdirSync as mkdirSync13, readFileSync as readFileSync13, writeFileSync as writeFileSync9 } from "fs";
60950
- import { dirname as dirname13 } from "path";
60971
+ import { dirname as dirname14 } from "path";
60951
60972
  function getInstallId() {
60952
60973
  const file = installIdPath();
60953
60974
  try {
@@ -60957,7 +60978,7 @@ function getInstallId() {
60957
60978
  return existing;
60958
60979
  }
60959
60980
  const id3 = randomUUID3();
60960
- mkdirSync13(dirname13(file), { recursive: true });
60981
+ mkdirSync13(dirname14(file), { recursive: true });
60961
60982
  writeFileSync9(file, `${id3}
60962
60983
  `);
60963
60984
  return id3;
@@ -62046,7 +62067,7 @@ var init_feature = __esm(() => {
62046
62067
  // src/services/fsbrowse.ts
62047
62068
  import { existsSync as existsSync24, readdirSync as readdirSync6, statSync as statSync8 } from "fs";
62048
62069
  import { homedir as homedir4 } from "os";
62049
- import { basename as basename3, dirname as dirname14, isAbsolute as isAbsolute3, join as join26, resolve as resolve12, sep as sep4 } from "path";
62070
+ import { basename as basename3, dirname as dirname15, isAbsolute as isAbsolute3, join as join26, resolve as resolve12, sep as sep4 } from "path";
62050
62071
  function expandPath(input, home = homedir4()) {
62051
62072
  const trimmed = input.trim();
62052
62073
  if (trimmed === "")
@@ -62099,7 +62120,7 @@ function crumbsFor(dir) {
62099
62120
  let cur = dir;
62100
62121
  for (;; ) {
62101
62122
  out.unshift({ name: basename3(cur) || cur, path: cur });
62102
- const parent = dirname14(cur);
62123
+ const parent = dirname15(cur);
62103
62124
  if (parent === cur)
62104
62125
  break;
62105
62126
  cur = parent;
@@ -62107,7 +62128,7 @@ function crumbsFor(dir) {
62107
62128
  return out;
62108
62129
  }
62109
62130
  function parentOf(dir) {
62110
- const parent = dirname14(dir);
62131
+ const parent = dirname15(dir);
62111
62132
  return parent === dir ? null : parent;
62112
62133
  }
62113
62134
  function browseDir(input, showHidden = false, home = homedir4()) {
@@ -62121,7 +62142,7 @@ function browseDir(input, showHidden = false, home = homedir4()) {
62121
62142
  let dir = target;
62122
62143
  try {
62123
62144
  if (!statSync8(target).isDirectory())
62124
- dir = dirname14(target);
62145
+ dir = dirname15(target);
62125
62146
  } catch (e) {
62126
62147
  throw new InvalidInputError(`cannot read path: ${target} (${errMsg4(e)})`);
62127
62148
  }
@@ -62595,6 +62616,31 @@ var init_settings2 = __esm(() => {
62595
62616
  });
62596
62617
  });
62597
62618
 
62619
+ // src/doctor/afk-env.ts
62620
+ import { existsSync as existsSync26, readFileSync as readFileSync15 } from "fs";
62621
+ function envWithAfkCredentials() {
62622
+ const merged = { ...process.env };
62623
+ try {
62624
+ const path2 = envPath();
62625
+ if (existsSync26(path2)) {
62626
+ const fromFile = parseEnvFile3(readFileSync15(path2, "utf8"));
62627
+ for (const runtime5 of AGENT_RUNTIMES) {
62628
+ const key = RUNTIME_SPECS[runtime5].afkKey;
62629
+ const value = fromFile[key];
62630
+ if (value && value.length > 0)
62631
+ merged[key] = value;
62632
+ }
62633
+ }
62634
+ } catch {}
62635
+ return merged;
62636
+ }
62637
+ var init_afk_env = __esm(() => {
62638
+ init_src();
62639
+ init_paths();
62640
+ init_ticket_burner();
62641
+ init_doctor();
62642
+ });
62643
+
62598
62644
  // src/trpc/routers/setup.ts
62599
62645
  import { isNotNull as isNotNull4 } from "drizzle-orm";
62600
62646
  import * as z12 from "zod";
@@ -62602,8 +62648,10 @@ var setupRouter;
62602
62648
  var init_setup2 = __esm(() => {
62603
62649
  init_src();
62604
62650
  init_schema();
62651
+ init_afk_env();
62605
62652
  init_doctor();
62606
62653
  init_system_exec();
62654
+ init_asset_paths();
62607
62655
  init_registry();
62608
62656
  init_setup();
62609
62657
  init_resolve_executable();
@@ -62613,6 +62661,8 @@ var init_setup2 = __esm(() => {
62613
62661
  const projectModels = ctx.db.select({ model: projects.model }).from(projects).where(isNotNull4(projects.model)).all().map((p) => p.model);
62614
62662
  return runDoctor({
62615
62663
  exec: createSystemExec(),
62664
+ burnerDockerfile: burnerDockerfilePath(),
62665
+ env: envWithAfkCredentials(),
62616
62666
  runtimes: configuredRuntimes(ctx.config, projectModels),
62617
62667
  ...ctx.config.sandboxImage ? { imageName: ctx.config.sandboxImage } : {}
62618
62668
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcastle",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Burn tickets into shipped features with Claude Code.",
5
5
  "license": "FSL-1.1-ALv2",
6
6
  "type": "module",