usebeeline 0.0.91 → 0.0.92

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.
@@ -2415,7 +2415,7 @@ var require_websocket = __commonJS({
2415
2415
  var http = __require("http");
2416
2416
  var net = __require("net");
2417
2417
  var tls = __require("tls");
2418
- var { randomBytes: randomBytes7, createHash: createHash8 } = __require("crypto");
2418
+ var { randomBytes: randomBytes7, createHash: createHash9 } = __require("crypto");
2419
2419
  var { Duplex, Readable } = __require("stream");
2420
2420
  var { URL: URL2 } = __require("url");
2421
2421
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -3083,7 +3083,7 @@ var require_websocket = __commonJS({
3083
3083
  abortHandshake(websocket, socket, "Invalid Upgrade header");
3084
3084
  return;
3085
3085
  }
3086
- const digest = createHash8("sha1").update(key + GUID).digest("base64");
3086
+ const digest = createHash9("sha1").update(key + GUID).digest("base64");
3087
3087
  if (res.headers["sec-websocket-accept"] !== digest) {
3088
3088
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
3089
3089
  return;
@@ -3452,7 +3452,7 @@ var require_websocket_server = __commonJS({
3452
3452
  var EventEmitter2 = __require("events");
3453
3453
  var http = __require("http");
3454
3454
  var { Duplex } = __require("stream");
3455
- var { createHash: createHash8 } = __require("crypto");
3455
+ var { createHash: createHash9 } = __require("crypto");
3456
3456
  var extension2 = require_extension();
3457
3457
  var PerMessageDeflate2 = require_permessage_deflate();
3458
3458
  var subprotocol2 = require_subprotocol();
@@ -3759,7 +3759,7 @@ var require_websocket_server = __commonJS({
3759
3759
  );
3760
3760
  }
3761
3761
  if (this._state > RUNNING) return abortHandshake(socket, 503);
3762
- const digest = createHash8("sha1").update(key + GUID).digest("base64");
3762
+ const digest = createHash9("sha1").update(key + GUID).digest("base64");
3763
3763
  const headers = [
3764
3764
  "HTTP/1.1 101 Switching Protocols",
3765
3765
  "Upgrade: websocket",
@@ -3984,14 +3984,14 @@ __export(self_update_exports, {
3984
3984
  writeUpdateAttemptFixture: () => writeUpdateAttemptFixture,
3985
3985
  writeUpdateState: () => writeUpdateState
3986
3986
  });
3987
- import { createHash as createHash6 } from "node:crypto";
3988
- import { constants as fsConstants } from "node:fs";
3989
- import { access, chmod as chmod4, lstat as lstat2, mkdir as mkdir14, open, readFile as readFile9, rename as rename3, rm as rm5, symlink as symlink2, writeFile as writeFile10 } from "node:fs/promises";
3987
+ import { createHash as createHash7 } from "node:crypto";
3988
+ import { constants as fsConstants2 } from "node:fs";
3989
+ import { access, chmod as chmod5, lstat as lstat3, mkdir as mkdir15, open, readFile as readFile10, rename as rename4, rm as rm6, symlink as symlink3, writeFile as writeFile10 } from "node:fs/promises";
3990
3990
  import { spawn as spawn4 } from "node:child_process";
3991
3991
  import { homedir as homedir9 } from "node:os";
3992
- import { dirname as dirname10, join as join8, resolve as resolve21 } from "node:path";
3992
+ import { dirname as dirname11, join as join9, resolve as resolve22 } from "node:path";
3993
3993
  function anchorLayout(rawLibDir) {
3994
- const libDir = resolve21(rawLibDir);
3994
+ const libDir = resolve22(rawLibDir);
3995
3995
  const segments = libDir.split(/[/\\]/);
3996
3996
  const idx = segments.lastIndexOf(RELEASES_SEGMENT);
3997
3997
  if (idx >= 2 && segments[idx - 1] === "lib") {
@@ -4007,9 +4007,9 @@ function anchorLayout(rawLibDir) {
4007
4007
  // prefix's bin, NOT <prefix>/lib/bin — deriving it one level up was the
4008
4008
  // defect that made activateRelease write its stable forwarders where
4009
4009
  // nothing executed them, leaving stale raw wrappers in <prefix>/bin.
4010
- binDir: resolve21(libDir, "../../bin"),
4010
+ binDir: resolve22(libDir, "../../bin"),
4011
4011
  libDir,
4012
- releasesRoot: resolve21(libDir, `../${RELEASES_SEGMENT}`)
4012
+ releasesRoot: resolve22(libDir, `../${RELEASES_SEGMENT}`)
4013
4013
  };
4014
4014
  }
4015
4015
  function beelineInstallLayout(env = process.env) {
@@ -4020,7 +4020,7 @@ function beelineInstallLayout(env = process.env) {
4020
4020
  }
4021
4021
  function defaultBeelineInstallLayout(env = process.env) {
4022
4022
  const home = env.HOME?.trim() || homedir9();
4023
- return anchorLayout(resolve21(home, ".local", "lib", "beeline"));
4023
+ return anchorLayout(resolve22(home, ".local", "lib", "beeline"));
4024
4024
  }
4025
4025
  function discoveredBeelineInstallLayout(env = process.env) {
4026
4026
  const explicitAnchor = env.BEELINE_INSTALL_LIB_DIR?.trim();
@@ -4028,7 +4028,7 @@ function discoveredBeelineInstallLayout(env = process.env) {
4028
4028
  return anchorLayout(explicitAnchor);
4029
4029
  const explicitBinDir = env.BEELINE_INSTALL_DIR?.trim();
4030
4030
  if (explicitBinDir)
4031
- return anchorLayout(resolve21(dirname10(resolve21(explicitBinDir)), "lib", "beeline"));
4031
+ return anchorLayout(resolve22(dirname11(resolve22(explicitBinDir)), "lib", "beeline"));
4032
4032
  return defaultBeelineInstallLayout(env);
4033
4033
  }
4034
4034
  function hostPlatformKey() {
@@ -4039,13 +4039,13 @@ function hostPlatformKey() {
4039
4039
  return `${os}-${arch}`;
4040
4040
  }
4041
4041
  function bundleJsonCandidates(bundleDir) {
4042
- return [join8(bundleDir, "lib", "beeline", "bundle.json"), join8(bundleDir, "bundle.json")];
4042
+ return [join9(bundleDir, "lib", "beeline", "bundle.json"), join9(bundleDir, "bundle.json")];
4043
4043
  }
4044
4044
  async function readBundleJson(bundleDir) {
4045
4045
  let raw;
4046
4046
  for (const candidate of bundleJsonCandidates(bundleDir)) {
4047
4047
  try {
4048
- raw = await readFile9(candidate, "utf8");
4048
+ raw = await readFile10(candidate, "utf8");
4049
4049
  break;
4050
4050
  } catch {
4051
4051
  }
@@ -4063,17 +4063,17 @@ async function readBundleJson(bundleDir) {
4063
4063
  }
4064
4064
  }
4065
4065
  function updateStatePath(layout) {
4066
- return join8(layout.releasesRoot, ".state", "update-state.json");
4066
+ return join9(layout.releasesRoot, ".state", "update-state.json");
4067
4067
  }
4068
4068
  async function readUpdateState(layout) {
4069
4069
  try {
4070
- return JSON.parse(await readFile9(updateStatePath(layout), "utf8"));
4070
+ return JSON.parse(await readFile10(updateStatePath(layout), "utf8"));
4071
4071
  } catch {
4072
4072
  return {};
4073
4073
  }
4074
4074
  }
4075
4075
  async function writeUpdateState(layout, state) {
4076
- await mkdir14(join8(layout.releasesRoot, ".state"), { recursive: true });
4076
+ await mkdir15(join9(layout.releasesRoot, ".state"), { recursive: true });
4077
4077
  await writeFile10(updateStatePath(layout), `${JSON.stringify(state, null, 2)}
4078
4078
  `, "utf8");
4079
4079
  }
@@ -4089,7 +4089,7 @@ function sanitizeReleaseId(id) {
4089
4089
  }
4090
4090
  async function pathKind(path) {
4091
4091
  try {
4092
- const info = await lstat2(path);
4092
+ const info = await lstat3(path);
4093
4093
  if (info.isSymbolicLink())
4094
4094
  return "symlink";
4095
4095
  return info.isDirectory() ? "directory" : "missing";
@@ -4103,9 +4103,9 @@ async function activeReleaseId(layout) {
4103
4103
  return "legacy";
4104
4104
  if (kind === "missing")
4105
4105
  return void 0;
4106
- const { readlink } = await import("node:fs/promises");
4106
+ const { readlink: readlink2 } = await import("node:fs/promises");
4107
4107
  try {
4108
- const target = await readlink(layout.libDir);
4108
+ const target = await readlink2(layout.libDir);
4109
4109
  return sanitizeReleaseId(target.split("/").pop() ?? target);
4110
4110
  } catch {
4111
4111
  return void 0;
@@ -4155,12 +4155,12 @@ function run(command, args, timeoutMs) {
4155
4155
  });
4156
4156
  }
4157
4157
  function entrypointCandidates(bundleDir) {
4158
- return [join8(bundleDir, BUNDLE_ENTRYPOINT), join8(bundleDir, "beeline-cli.mjs")];
4158
+ return [join9(bundleDir, BUNDLE_ENTRYPOINT), join9(bundleDir, "beeline-cli.mjs")];
4159
4159
  }
4160
4160
  async function resolveBundleEntrypoint(bundleDir) {
4161
4161
  for (const candidate of entrypointCandidates(bundleDir)) {
4162
4162
  try {
4163
- await access(candidate, fsConstants.F_OK);
4163
+ await access(candidate, fsConstants2.F_OK);
4164
4164
  return candidate;
4165
4165
  } catch {
4166
4166
  }
@@ -4177,18 +4177,18 @@ async function stageRelease(layout, manifestUrl, published, opts = {}) {
4177
4177
  const fetchImpl = opts.fetchImpl ?? fetch;
4178
4178
  const log2 = opts.logger ?? ((line) => console.log(`[body] self-update: ${line}`));
4179
4179
  const releaseId = sanitizeReleaseId(published.commit ?? published.version ?? `release-${Date.now()}`);
4180
- const releaseDir = join8(layout.releasesRoot, releaseId);
4181
- const okMarker = join8(releaseDir, ".stage-ok");
4180
+ const releaseDir = join9(layout.releasesRoot, releaseId);
4181
+ const okMarker = join9(releaseDir, ".stage-ok");
4182
4182
  let previouslyVerified = false;
4183
4183
  try {
4184
- const recorded = await readFile9(okMarker, "utf8");
4184
+ const recorded = await readFile10(okMarker, "utf8");
4185
4185
  if (recorded.trim() === published.sha256)
4186
4186
  return releaseId;
4187
4187
  previouslyVerified = true;
4188
4188
  } catch {
4189
4189
  }
4190
- await mkdir14(releaseDir, { recursive: true });
4191
- const tempArchive = join8(layout.releasesRoot, `.download-${releaseId}-${process.pid}.tar.gz`);
4190
+ await mkdir15(releaseDir, { recursive: true });
4191
+ const tempArchive = join9(layout.releasesRoot, `.download-${releaseId}-${process.pid}.tar.gz`);
4192
4192
  try {
4193
4193
  log2(`downloading ${published.file}`);
4194
4194
  const response = await fetchImpl(archiveUrlFor(manifestUrl, published.file), {
@@ -4197,7 +4197,7 @@ async function stageRelease(layout, manifestUrl, published, opts = {}) {
4197
4197
  if (!response.ok || !response.body) {
4198
4198
  throw new Error(`downloading ${published.file} failed: HTTP ${response.status}`);
4199
4199
  }
4200
- const hash = createHash6("sha256");
4200
+ const hash = createHash7("sha256");
4201
4201
  const chunks = [];
4202
4202
  for await (const chunk of response.body) {
4203
4203
  const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
@@ -4228,13 +4228,13 @@ async function stageRelease(layout, manifestUrl, published, opts = {}) {
4228
4228
  throw new Error(`extracting bundle failed: ${extract2.stderr}`);
4229
4229
  for (const relative3 of requiredBundlePaths()) {
4230
4230
  try {
4231
- await access(join8(releaseDir, relative3), fsConstants.F_OK);
4231
+ await access(join9(releaseDir, relative3), fsConstants2.F_OK);
4232
4232
  } catch {
4233
4233
  throw new Error(`staged bundle is missing ${relative3}`);
4234
4234
  }
4235
4235
  }
4236
4236
  if (opts.smokeTestCli !== false) {
4237
- const probe = await run(process.execPath, [join8(releaseDir, BUNDLE_ENTRYPOINT), "--version"], 6e4);
4237
+ const probe = await run(process.execPath, [join9(releaseDir, BUNDLE_ENTRYPOINT), "--version"], 6e4);
4238
4238
  if (probe.status !== 0) {
4239
4239
  throw new Error(`staged bundle failed its startup smoke test (--version exited ${probe.status})${probe.stderr ? `: ${probe.stderr.trim()}` : ""}`);
4240
4240
  }
@@ -4245,10 +4245,10 @@ async function stageRelease(layout, manifestUrl, published, opts = {}) {
4245
4245
  return releaseId;
4246
4246
  } catch (error) {
4247
4247
  if (!previouslyVerified)
4248
- await rm5(releaseDir, { recursive: true, force: true });
4248
+ await rm6(releaseDir, { recursive: true, force: true });
4249
4249
  throw error;
4250
4250
  } finally {
4251
- await rm5(tempArchive, { force: true });
4251
+ await rm6(tempArchive, { force: true });
4252
4252
  }
4253
4253
  }
4254
4254
  function forwarderScript(tool) {
@@ -4268,45 +4268,45 @@ function forwarderScript(tool) {
4268
4268
  async function replaceFile(path, contents, mode) {
4269
4269
  const temp = `${path}.new-${process.pid}`;
4270
4270
  await writeFile10(temp, contents, { mode });
4271
- await chmod4(temp, mode);
4272
- await rename3(temp, path);
4271
+ await chmod5(temp, mode);
4272
+ await rename4(temp, path);
4273
4273
  }
4274
4274
  async function activateRelease(layout, releaseId) {
4275
- const releaseDir = join8(layout.releasesRoot, releaseId);
4276
- await access(join8(releaseDir, BUNDLE_ENTRYPOINT), fsConstants.F_OK);
4277
- await mkdir14(layout.releasesRoot, { recursive: true });
4278
- await mkdir14(layout.binDir, { recursive: true });
4275
+ const releaseDir = join9(layout.releasesRoot, releaseId);
4276
+ await access(join9(releaseDir, BUNDLE_ENTRYPOINT), fsConstants2.F_OK);
4277
+ await mkdir15(layout.releasesRoot, { recursive: true });
4278
+ await mkdir15(layout.binDir, { recursive: true });
4279
4279
  let previousReleaseId = await activeReleaseId(layout);
4280
4280
  const kind = await pathKind(layout.libDir);
4281
4281
  if (kind === "directory") {
4282
4282
  const legacyIdentity = await readBundleJson(layout.libDir);
4283
4283
  const legacyId = sanitizeReleaseId(legacyIdentity?.commit ?? legacyIdentity?.version ?? `legacy-${Date.now()}`);
4284
- const legacyDir = join8(layout.releasesRoot, legacyId);
4284
+ const legacyDir = join9(layout.releasesRoot, legacyId);
4285
4285
  try {
4286
- await access(legacyDir, fsConstants.F_OK);
4286
+ await access(legacyDir, fsConstants2.F_OK);
4287
4287
  previousReleaseId = `${legacyId}-${Date.now()}`;
4288
- await rename3(layout.libDir, join8(layout.releasesRoot, previousReleaseId));
4289
- await normalizeLegacyBundleShape(join8(layout.releasesRoot, previousReleaseId));
4288
+ await rename4(layout.libDir, join9(layout.releasesRoot, previousReleaseId));
4289
+ await normalizeLegacyBundleShape(join9(layout.releasesRoot, previousReleaseId));
4290
4290
  } catch {
4291
- await rename3(layout.libDir, legacyDir);
4291
+ await rename4(layout.libDir, legacyDir);
4292
4292
  await normalizeLegacyBundleShape(legacyDir);
4293
4293
  previousReleaseId = legacyId;
4294
4294
  }
4295
4295
  }
4296
4296
  const tempLink = `${layout.libDir}.new-${process.pid}`;
4297
- await rm5(tempLink, { force: true });
4298
- await symlink2(join8("beeline-releases", releaseId), tempLink);
4299
- await rename3(tempLink, layout.libDir);
4300
- await fsyncDir(dirname10(layout.libDir));
4297
+ await rm6(tempLink, { force: true });
4298
+ await symlink3(join9("beeline-releases", releaseId), tempLink);
4299
+ await rename4(tempLink, layout.libDir);
4300
+ await fsyncDir(dirname11(layout.libDir));
4301
4301
  await writeBinForwarders(layout, releaseDir);
4302
4302
  return { previousReleaseId };
4303
4303
  }
4304
4304
  async function normalizeLegacyBundleShape(bundleDir) {
4305
- const innerLib = join8(bundleDir, "lib", "beeline");
4305
+ const innerLib = join9(bundleDir, "lib", "beeline");
4306
4306
  let anyFlat = false;
4307
4307
  for (const name of LEGACY_FLAT_BUNDLE_FILES) {
4308
4308
  try {
4309
- await access(join8(bundleDir, name), fsConstants.F_OK);
4309
+ await access(join9(bundleDir, name), fsConstants2.F_OK);
4310
4310
  anyFlat = true;
4311
4311
  break;
4312
4312
  } catch {
@@ -4314,14 +4314,14 @@ async function normalizeLegacyBundleShape(bundleDir) {
4314
4314
  }
4315
4315
  if (!anyFlat)
4316
4316
  return;
4317
- await mkdir14(innerLib, { recursive: true });
4317
+ await mkdir15(innerLib, { recursive: true });
4318
4318
  for (const name of LEGACY_FLAT_BUNDLE_FILES) {
4319
4319
  try {
4320
- await access(join8(innerLib, name), fsConstants.F_OK);
4320
+ await access(join9(innerLib, name), fsConstants2.F_OK);
4321
4321
  continue;
4322
4322
  } catch {
4323
4323
  }
4324
- await rename3(join8(bundleDir, name), join8(innerLib, name)).catch(() => void 0);
4324
+ await rename4(join9(bundleDir, name), join9(innerLib, name)).catch(() => void 0);
4325
4325
  }
4326
4326
  }
4327
4327
  async function writeBinForwarders(layout, activeBundleRoot) {
@@ -4330,13 +4330,13 @@ async function writeBinForwarders(layout, activeBundleRoot) {
4330
4330
  ...Object.entries(FORWARDER_ALIASES).map(([alias, tool]) => [alias, tool])
4331
4331
  ];
4332
4332
  for (const [name, tool] of entries) {
4333
- const target = join8(activeBundleRoot, "bin", tool);
4333
+ const target = join9(activeBundleRoot, "bin", tool);
4334
4334
  try {
4335
- await access(target, fsConstants.X_OK);
4335
+ await access(target, fsConstants2.X_OK);
4336
4336
  } catch {
4337
4337
  continue;
4338
4338
  }
4339
- await replaceFile(join8(layout.binDir, name), forwarderScript(tool), 493);
4339
+ await replaceFile(join9(layout.binDir, name), forwarderScript(tool), 493);
4340
4340
  }
4341
4341
  }
4342
4342
  async function repairInstallForwarders(layout, opts = {}) {
@@ -4345,7 +4345,7 @@ async function repairInstallForwarders(layout, opts = {}) {
4345
4345
  const forwarderHealthy = async (name, tool) => {
4346
4346
  let current;
4347
4347
  try {
4348
- current = await readFile9(join8(layout.binDir, name), "utf8");
4348
+ current = await readFile10(join9(layout.binDir, name), "utf8");
4349
4349
  } catch {
4350
4350
  current = void 0;
4351
4351
  }
@@ -4358,29 +4358,29 @@ async function repairInstallForwarders(layout, opts = {}) {
4358
4358
  }
4359
4359
  if (healthy)
4360
4360
  return false;
4361
- await mkdir14(layout.binDir, { recursive: true });
4361
+ await mkdir15(layout.binDir, { recursive: true });
4362
4362
  await writeBinForwarders(layout, layout.libDir);
4363
4363
  opts.logger?.(`[body] self-update: repaired <prefix>/bin forwarders to follow the active-bundle anchor (${layout.libDir})`);
4364
4364
  return true;
4365
4365
  }
4366
4366
  async function rollbackToPreviousRelease(layout, previousReleaseId) {
4367
- const releaseDir = join8(layout.releasesRoot, previousReleaseId);
4367
+ const releaseDir = join9(layout.releasesRoot, previousReleaseId);
4368
4368
  const entrypoint = await resolveBundleEntrypoint(releaseDir);
4369
4369
  if (!entrypoint) {
4370
4370
  throw new Error(`release ${previousReleaseId} has no runnable CLI entrypoint`);
4371
4371
  }
4372
4372
  const tempLink = `${layout.libDir}.rollback-${process.pid}`;
4373
- await rm5(tempLink, { force: true });
4374
- await symlink2(join8("beeline-releases", previousReleaseId), tempLink);
4375
- await rename3(tempLink, layout.libDir);
4376
- await fsyncDir(dirname10(layout.libDir));
4373
+ await rm6(tempLink, { force: true });
4374
+ await symlink3(join9("beeline-releases", previousReleaseId), tempLink);
4375
+ await rename4(tempLink, layout.libDir);
4376
+ await fsyncDir(dirname11(layout.libDir));
4377
4377
  }
4378
4378
  function updateAttemptPath(layout) {
4379
- return join8(layout.releasesRoot, ".state", "update-attempt.json");
4379
+ return join9(layout.releasesRoot, ".state", "update-attempt.json");
4380
4380
  }
4381
4381
  async function readUpdateAttempt(layout) {
4382
4382
  try {
4383
- const raw = JSON.parse(await readFile9(updateAttemptPath(layout), "utf8"));
4383
+ const raw = JSON.parse(await readFile10(updateAttemptPath(layout), "utf8"));
4384
4384
  if (raw.version !== 1 || typeof raw.appliedAt !== "number" || typeof raw.confirmBy !== "number" || typeof raw.releaseId !== "string" || !["pending", "confirmed", "reverted"].includes(raw.status)) {
4385
4385
  return void 0;
4386
4386
  }
@@ -4390,12 +4390,12 @@ async function readUpdateAttempt(layout) {
4390
4390
  }
4391
4391
  }
4392
4392
  async function writeUpdateAttempt(layout, record2) {
4393
- await mkdir14(join8(layout.releasesRoot, ".state"), { recursive: true });
4393
+ await mkdir15(join9(layout.releasesRoot, ".state"), { recursive: true });
4394
4394
  const path = updateAttemptPath(layout);
4395
4395
  const staged = `${path}.${process.pid}.tmp`;
4396
4396
  await writeFile10(staged, `${JSON.stringify(record2, null, 2)}
4397
4397
  `, { mode: 384 });
4398
- await rename3(staged, path);
4398
+ await rename4(staged, path);
4399
4399
  }
4400
4400
  async function replaceUpdateAttempt(layout, record2) {
4401
4401
  await writeUpdateAttempt(layout, record2);
@@ -4655,8 +4655,8 @@ var init_self_update = __esm({
4655
4655
  });
4656
4656
 
4657
4657
  // apps/body/dist/cli.js
4658
- import { dirname as dirname16, resolve as resolve29 } from "node:path";
4659
- import { readFile as readFile14, unlink as unlink5, writeFile as writeFile16 } from "node:fs/promises";
4658
+ import { dirname as dirname17, resolve as resolve30 } from "node:path";
4659
+ import { readFile as readFile15, unlink as unlink5, writeFile as writeFile16 } from "node:fs/promises";
4660
4660
  import { stdin as stdin4, stdout as stdout5 } from "node:process";
4661
4661
 
4662
4662
  // node_modules/@clack/core/dist/index.mjs
@@ -7527,7 +7527,7 @@ var AcpClient = class extends EventEmitter {
7527
7527
  const current = this.activeRunIds.get(sessionId);
7528
7528
  if (current)
7529
7529
  return Promise.resolve(current);
7530
- return new Promise((resolve30, reject) => {
7530
+ return new Promise((resolve31, reject) => {
7531
7531
  const onUpdate = (update) => {
7532
7532
  if (update.sessionId !== sessionId)
7533
7533
  return;
@@ -7535,7 +7535,7 @@ var AcpClient = class extends EventEmitter {
7535
7535
  if (!runId)
7536
7536
  return;
7537
7537
  cleanup();
7538
- resolve30(runId);
7538
+ resolve31(runId);
7539
7539
  };
7540
7540
  const timer = setTimeout(() => {
7541
7541
  cleanup();
@@ -7619,13 +7619,13 @@ var AcpClient = class extends EventEmitter {
7619
7619
  }
7620
7620
  const id = this.nextId++;
7621
7621
  const payload = { jsonrpc: "2.0", id, method, params };
7622
- return new Promise((resolve30, reject) => {
7622
+ return new Promise((resolve31, reject) => {
7623
7623
  const timer = setTimeout(() => {
7624
7624
  this.pending.delete(id);
7625
7625
  reject(new AcpRequestTimeoutError(method, timeoutMs, this.stderrTail, Boolean(onStart), detail));
7626
7626
  }, timeoutMs);
7627
7627
  this.pending.set(id, {
7628
- resolve: resolve30,
7628
+ resolve: resolve31,
7629
7629
  reject,
7630
7630
  timer,
7631
7631
  method,
@@ -17164,10 +17164,10 @@ async function activateDaemonTransport(path, fetchImpl = fetch) {
17164
17164
 
17165
17165
  // apps/body/dist/room-runtime.js
17166
17166
  import { execFile as execFile5 } from "node:child_process";
17167
- import { createHash as createHash5 } from "node:crypto";
17167
+ import { createHash as createHash6 } from "node:crypto";
17168
17168
  import { existsSync as existsSync4, mkdirSync } from "node:fs";
17169
- import { mkdir as mkdir12, rm as rm4 } from "node:fs/promises";
17170
- import { dirname as dirname7, resolve as resolve19 } from "node:path";
17169
+ import { mkdir as mkdir13, rm as rm5 } from "node:fs/promises";
17170
+ import { dirname as dirname8, resolve as resolve20 } from "node:path";
17171
17171
  import { promisify as promisify4 } from "node:util";
17172
17172
 
17173
17173
  // apps/body/dist/grant-runner.js
@@ -17449,7 +17449,7 @@ var KNOWN_CREDENTIAL_MASK_PATHS = [
17449
17449
  ".git-credentials",
17450
17450
  ".secrets.env"
17451
17451
  ];
17452
- function credentialMaskPaths(extraPaths, home = homedir3(), stat3 = (path) => {
17452
+ function credentialMaskPaths(extraPaths, home = homedir3(), stat4 = (path) => {
17453
17453
  try {
17454
17454
  const info = lstatSync2(path);
17455
17455
  return { isDirectory: info.isDirectory() };
@@ -17468,7 +17468,7 @@ function credentialMaskPaths(extraPaths, home = homedir3(), stat3 = (path) => {
17468
17468
  if (seen.has(path))
17469
17469
  continue;
17470
17470
  seen.add(path);
17471
- const info = stat3(path);
17471
+ const info = stat4(path);
17472
17472
  if (!info) {
17473
17473
  if (required.has(path))
17474
17474
  masks.push({ path, kind: "dir", create: true });
@@ -18137,13 +18137,13 @@ async function runServerCommandIntake(options) {
18137
18137
  }
18138
18138
  }
18139
18139
  options.onPoll?.();
18140
- const reconcile = await new Promise((resolve30) => {
18140
+ const reconcile = await new Promise((resolve31) => {
18141
18141
  const done = (needed) => {
18142
18142
  if (timer)
18143
18143
  clearTimeout(timer);
18144
18144
  signal?.removeEventListener("abort", aborted);
18145
18145
  wake = void 0;
18146
- resolve30(needed);
18146
+ resolve31(needed);
18147
18147
  };
18148
18148
  const aborted = () => done(false);
18149
18149
  wake = done;
@@ -18169,10 +18169,10 @@ async function runServerCommandIntake(options) {
18169
18169
 
18170
18170
  // apps/body/dist/monolith-corner-turn.js
18171
18171
  import { execFile as execFile4 } from "node:child_process";
18172
- import { createHash as createHash4 } from "node:crypto";
18173
- import { mkdir as mkdir11 } from "node:fs/promises";
18172
+ import { createHash as createHash5 } from "node:crypto";
18173
+ import { mkdir as mkdir12 } from "node:fs/promises";
18174
18174
  import { homedir as homedir7 } from "node:os";
18175
- import { join as join7 } from "node:path";
18175
+ import { join as join8 } from "node:path";
18176
18176
  import { promisify as promisify3 } from "node:util";
18177
18177
 
18178
18178
  // apps/body/dist/agent-home.js
@@ -18995,7 +18995,7 @@ async function provisionAgentSkillsAndMcp(root, operatorHome, skillReleaseId, fa
18995
18995
  console.warn("[body] operator MCP passthrough failed for claude:", error);
18996
18996
  }
18997
18997
  try {
18998
- const settings2 = { permissions: { allow: ["WebSearch"] } };
18998
+ const settings2 = { permissions: { allow: ["WebSearch", "WebFetch"] } };
18999
18999
  await writeIsolatedHarnessFile(resolve13(root, "claude", "settings.json"), `${JSON.stringify(settings2, null, 2)}
19000
19000
  `);
19001
19001
  } catch (error) {
@@ -19559,18 +19559,6 @@ function sanitizeAgentReply(message) {
19559
19559
  }
19560
19560
  return lines.slice(1).join("\n").trim();
19561
19561
  }
19562
- var CORNER_OPEN_ECHO = /^(?:(?:ok(?:ay)?|done|sure|great|alright)[,.!:]?\s+)?(?:i(?:'ve| have|'ll| will|'m| am)?\s+)?(?:just\s+)?open(?:ed|ing)?\s+(?:up\s+)?(?:a\s+|the\s+|your\s+)?(?:new\s+|write(?:-enabled)?\s+|repository\s+)*corner\b/iu;
19563
- var CORNER_OPEN_ECHO_MAX_CHARS = 320;
19564
- function stripCornerOpenEcho(message) {
19565
- const visible = message.trim();
19566
- if (!visible)
19567
- return "";
19568
- const paragraphs = visible.split(/\n\s*\n/);
19569
- const first = paragraphs[0].trim();
19570
- if (first.length > CORNER_OPEN_ECHO_MAX_CHARS || !CORNER_OPEN_ECHO.test(first))
19571
- return visible;
19572
- return paragraphs.slice(1).join("\n\n").trim();
19573
- }
19574
19562
  var STATUS_FILLER = new Set("a an the this that it its is are was were be been being has have had do does did now still remains remain remaining ready for review reviewing pr pull request all every both and or so to of in on at as with by no not nothing new further more else needed needs need required action actions change changes changed status state update updates updated waiting wait awaiting pending running progress idle done ok okay good great well fine confirmed confirm already again yet just currently right i we will can should would github remote upstream branch head latest current report reported noted note see looks look like everything nothing appears appear seems seem there here which what from without any".split(/\s+/));
19575
19563
  var STATUS_SYNONYMS = {
19576
19564
  passed: ["pass", "passed", "passing", "passes", "green", "succeeded", "success", "successful", "successfully"],
@@ -20792,16 +20780,299 @@ process.exit(result.status ?? 1);
20792
20780
  await chmod3(path, 448);
20793
20781
  }
20794
20782
 
20783
+ // apps/body/dist/warm-node-modules.js
20784
+ import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
20785
+ import { constants as fsConstants } from "node:fs";
20786
+ import { chmod as chmod4, copyFile as copyFile2, link, lstat as lstat2, mkdir as mkdir10, readdir as readdir5, readFile as readFile8, readlink, rename as rename3, rm as rm4, stat as stat2, symlink as symlink2, utimes } from "node:fs/promises";
20787
+ import { dirname as dirname7, join as join6, resolve as resolve19 } from "node:path";
20788
+ var STORE_FORMAT = "v1";
20789
+ var STAGING_PREFIX = ".beeline-warm-";
20790
+ var STAGING_SWEEP_MS = 24 * 60 * 60 * 1e3;
20791
+ var WARM_STORE_MAX_ENTRIES = 3;
20792
+ function sharedNpmCacheDir(supervisorRoot) {
20793
+ return resolve19(supervisorRoot, "beeline", "npm-cache");
20794
+ }
20795
+ function warmNodeModulesStoreDir(supervisorRoot) {
20796
+ return resolve19(supervisorRoot, "beeline", "node-modules");
20797
+ }
20798
+ function isPlanRefusal(value) {
20799
+ return "failure" in value;
20800
+ }
20801
+ async function readWarmPlan(worktreePath) {
20802
+ const lockfile = await readFile8(resolve19(worktreePath, "package-lock.json")).catch(() => void 0);
20803
+ if (!lockfile)
20804
+ return { failure: "no-lockfile" };
20805
+ const packages = parseLockfilePackages(lockfile);
20806
+ if (!packages)
20807
+ return { failure: "no-lockfile" };
20808
+ const escaping = Object.keys(packages).find((path) => namesInstalledPackage(path) && !isContainedPath(path));
20809
+ if (escaping)
20810
+ return { failure: "unsafe-lockfile", detail: escaping };
20811
+ const trees = nodeModulesTreePaths(packages);
20812
+ if (trees.length === 0)
20813
+ return { failure: "no-lockfile" };
20814
+ const unsafe = trees.find((tree) => !isContainedTreePath(tree));
20815
+ if (unsafe)
20816
+ return { failure: "unsafe-lockfile", detail: unsafe };
20817
+ const key = createHash4("sha256").update(`${STORE_FORMAT}\0${process.platform}\0${process.arch}\0${process.versions.modules}\0`).update(lockfile).digest("hex").slice(0, 32);
20818
+ return { key, trees };
20819
+ }
20820
+ function nodeModulesTreePaths(packages) {
20821
+ const trees = /* @__PURE__ */ new Set();
20822
+ for (const path of Object.keys(packages)) {
20823
+ if (!namesInstalledPackage(path))
20824
+ continue;
20825
+ const segments = path.split("/");
20826
+ trees.add(segments.slice(0, segments.indexOf("node_modules") + 1).join("/"));
20827
+ }
20828
+ return [...trees].sort();
20829
+ }
20830
+ function namesInstalledPackage(path) {
20831
+ const segments = path.split("/");
20832
+ const index = segments.indexOf("node_modules");
20833
+ return index >= 0 && index < segments.length - 1;
20834
+ }
20835
+ async function seedWarmNodeModules(input) {
20836
+ const plan = await readWarmPlan(input.worktreePath);
20837
+ if (isPlanRefusal(plan)) {
20838
+ return { reason: plan.failure, ...plan.detail ? { detail: plan.detail } : {} };
20839
+ }
20840
+ for (const tree of plan.trees) {
20841
+ if (await pathExists(resolve19(input.worktreePath, tree))) {
20842
+ return { reason: "present", key: plan.key };
20843
+ }
20844
+ }
20845
+ const entry = resolve19(input.storeRoot, plan.key);
20846
+ if (!await isDirectory(entry))
20847
+ return { reason: "cold", key: plan.key };
20848
+ const [storeDevice, checkoutDevice] = await Promise.all([
20849
+ deviceOf(entry),
20850
+ deviceOf(input.worktreePath)
20851
+ ]);
20852
+ if (storeDevice === void 0 || storeDevice !== checkoutDevice) {
20853
+ return { reason: "cross-device", key: plan.key };
20854
+ }
20855
+ const staging = resolve19(input.storeRoot, `${STAGING_PREFIX}${process.pid}.${randomUUID4()}`);
20856
+ const placed = [];
20857
+ const now2 = (input.now ?? Date.now)();
20858
+ try {
20859
+ await sweepStaleStaging(input.storeRoot, now2);
20860
+ await utimes(entry, now2 / 1e3, now2 / 1e3).catch(() => void 0);
20861
+ for (const tree of plan.trees) {
20862
+ await cloneTree(resolve19(entry, tree), resolve19(staging, tree), seedFile);
20863
+ }
20864
+ for (const tree of plan.trees) {
20865
+ const target = resolve19(input.worktreePath, tree);
20866
+ await mkdir10(dirname7(target), { recursive: true });
20867
+ await rename3(resolve19(staging, tree), target);
20868
+ placed.push(target);
20869
+ }
20870
+ return { reason: "seeded", key: plan.key };
20871
+ } catch (error) {
20872
+ for (const target of placed) {
20873
+ await rm4(target, { recursive: true, force: true }).catch(() => void 0);
20874
+ }
20875
+ return { reason: "failed", key: plan.key, detail: describe(error) };
20876
+ } finally {
20877
+ await rm4(staging, { recursive: true, force: true }).catch(() => void 0);
20878
+ }
20879
+ }
20880
+ async function harvestWarmNodeModules(input) {
20881
+ const plan = await readWarmPlan(input.worktreePath);
20882
+ if (isPlanRefusal(plan)) {
20883
+ return { reason: plan.failure, ...plan.detail ? { detail: plan.detail } : {} };
20884
+ }
20885
+ const entry = resolve19(input.storeRoot, plan.key);
20886
+ if (await pathExists(entry))
20887
+ return { reason: "already-warm", key: plan.key };
20888
+ for (const tree of plan.trees) {
20889
+ if (!await isDirectory(resolve19(input.worktreePath, tree))) {
20890
+ return { reason: "no-node-modules", key: plan.key, detail: tree };
20891
+ }
20892
+ }
20893
+ const missing = await missingInstalledPackages(input.worktreePath);
20894
+ if (missing.length > 0) {
20895
+ return {
20896
+ reason: "incomplete",
20897
+ key: plan.key,
20898
+ detail: `${missing.length} absent, e.g. ${missing.slice(0, 3).join(", ")}`
20899
+ };
20900
+ }
20901
+ const staging = resolve19(input.storeRoot, `${STAGING_PREFIX}${process.pid}.${randomUUID4()}`);
20902
+ try {
20903
+ await mkdir10(input.storeRoot, { recursive: true, mode: 493 });
20904
+ await sweepStaleStaging(input.storeRoot, (input.now ?? Date.now)());
20905
+ for (const tree of plan.trees) {
20906
+ await cloneTree(resolve19(input.worktreePath, tree), resolve19(staging, tree), harvestFile);
20907
+ }
20908
+ await input.onCopied?.();
20909
+ if (!await stagedTreeIsPublishable(input.worktreePath, staging, plan.key)) {
20910
+ return { reason: "changed", key: plan.key };
20911
+ }
20912
+ await rename3(staging, entry);
20913
+ await pruneWarmStore(input.storeRoot, WARM_STORE_MAX_ENTRIES);
20914
+ return { reason: "stored", key: plan.key };
20915
+ } catch (error) {
20916
+ if (await pathExists(entry))
20917
+ return { reason: "already-warm", key: plan.key };
20918
+ return { reason: "failed", key: plan.key, detail: describe(error) };
20919
+ } finally {
20920
+ await rm4(staging, { recursive: true, force: true }).catch(() => void 0);
20921
+ }
20922
+ }
20923
+ async function stagedTreeIsPublishable(worktreePath, staging, key) {
20924
+ const settled = await readWarmPlan(worktreePath);
20925
+ if (isPlanRefusal(settled) || settled.key !== key)
20926
+ return false;
20927
+ const hidden = join6("node_modules", ".package-lock.json");
20928
+ const [copied, current] = await Promise.all([
20929
+ readFile8(resolve19(staging, hidden)).catch(() => void 0),
20930
+ readFile8(resolve19(worktreePath, hidden)).catch(() => void 0)
20931
+ ]);
20932
+ if (!copied || !current || !copied.equals(current))
20933
+ return false;
20934
+ return (await missingInstalledPackages(worktreePath, staging)).length === 0;
20935
+ }
20936
+ async function missingInstalledPackages(worktreePath, treeRoot = worktreePath) {
20937
+ const wanted = parseLockfilePackages(await readFile8(resolve19(worktreePath, "package-lock.json")).catch(() => void 0));
20938
+ const installed = parseLockfilePackages(await readFile8(resolve19(treeRoot, "node_modules", ".package-lock.json")).catch(() => void 0));
20939
+ if (!wanted)
20940
+ return ["package-lock.json is unreadable"];
20941
+ if (!installed)
20942
+ return ["node_modules/.package-lock.json is absent"];
20943
+ const required = [];
20944
+ const missing = [];
20945
+ for (const [path, entry] of Object.entries(wanted)) {
20946
+ if (!namesInstalledPackage(path))
20947
+ continue;
20948
+ if (entry.link === true || entry.optional === true)
20949
+ continue;
20950
+ if (entry.os !== void 0 || entry.cpu !== void 0)
20951
+ continue;
20952
+ if (!isContainedPath(path))
20953
+ missing.push(path);
20954
+ else
20955
+ required.push(path);
20956
+ }
20957
+ await mapWithLimit(required, INTEGRITY_READ_CONCURRENCY, async (path) => {
20958
+ if (!(path in installed) || !await isInstalledPackage(resolve19(treeRoot, path))) {
20959
+ missing.push(path);
20960
+ }
20961
+ });
20962
+ return missing.sort();
20963
+ }
20964
+ async function isInstalledPackage(path) {
20965
+ return stat2(join6(path, "package.json")).then((info) => info.isFile(), () => false);
20966
+ }
20967
+ var INTEGRITY_READ_CONCURRENCY = 64;
20968
+ async function mapWithLimit(values, limit, visit) {
20969
+ let cursor3 = 0;
20970
+ await Promise.all(Array.from({ length: Math.min(limit, values.length) }, async () => {
20971
+ while (cursor3 < values.length)
20972
+ await visit(values[cursor3++]);
20973
+ }));
20974
+ }
20975
+ function parseLockfilePackages(source) {
20976
+ if (!source)
20977
+ return void 0;
20978
+ try {
20979
+ const parsed = JSON.parse(source.toString("utf8"));
20980
+ const packages = parsed.packages;
20981
+ if (!packages || typeof packages !== "object" || Array.isArray(packages))
20982
+ return void 0;
20983
+ return packages;
20984
+ } catch {
20985
+ return void 0;
20986
+ }
20987
+ }
20988
+ function isContainedPath(value) {
20989
+ if (!value)
20990
+ return false;
20991
+ return value.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== ".." && !segment.includes("\\"));
20992
+ }
20993
+ function isContainedTreePath(value) {
20994
+ return isContainedPath(value) && value.split("/").pop() === "node_modules";
20995
+ }
20996
+ async function cloneTree(source, target, file, topLevel = true) {
20997
+ await mkdir10(target, { recursive: true, mode: 493 });
20998
+ for (const entry of await readdir5(source, { withFileTypes: true })) {
20999
+ const from = join6(source, entry.name);
21000
+ const to = join6(target, entry.name);
21001
+ if (entry.isSymbolicLink()) {
21002
+ await symlink2(await readlink(from), to);
21003
+ continue;
21004
+ }
21005
+ if (entry.isDirectory()) {
21006
+ await cloneTree(from, to, file, false);
21007
+ continue;
21008
+ }
21009
+ if (entry.isFile())
21010
+ await file(from, to, topLevel);
21011
+ }
21012
+ }
21013
+ var harvestFile = async (source, target) => {
21014
+ await copyFile2(source, target, fsConstants.COPYFILE_FICLONE);
21015
+ const info = await stat2(source);
21016
+ await chmod4(target, info.mode & 4095 & ~146);
21017
+ };
21018
+ var seedFile = async (source, target, topLevel) => {
21019
+ if (!topLevel) {
21020
+ await link(source, target);
21021
+ return;
21022
+ }
21023
+ await copyFile2(source, target);
21024
+ await chmod4(target, 420);
21025
+ };
21026
+ async function pruneWarmStore(storeRoot, keep) {
21027
+ const names = (await readdir5(storeRoot).catch(() => [])).filter((name) => !name.startsWith(STAGING_PREFIX));
21028
+ const entries = [];
21029
+ for (const name of names) {
21030
+ const info = await lstat2(join6(storeRoot, name)).catch(() => void 0);
21031
+ if (info?.isDirectory())
21032
+ entries.push({ name, usedAt: info.mtimeMs });
21033
+ }
21034
+ const dropped = entries.sort((a2, b) => b.usedAt - a2.usedAt || a2.name.localeCompare(b.name)).slice(keep);
21035
+ for (const entry of dropped) {
21036
+ await rm4(join6(storeRoot, entry.name), { recursive: true, force: true }).catch(() => void 0);
21037
+ }
21038
+ return dropped.map((entry) => entry.name);
21039
+ }
21040
+ async function sweepStaleStaging(storeRoot, now2) {
21041
+ const entries = await readdir5(storeRoot).catch(() => []);
21042
+ for (const name of entries) {
21043
+ if (!name.startsWith(STAGING_PREFIX))
21044
+ continue;
21045
+ const path = join6(storeRoot, name);
21046
+ const info = await lstat2(path).catch(() => void 0);
21047
+ if (!info || now2 - info.mtimeMs < STAGING_SWEEP_MS)
21048
+ continue;
21049
+ await rm4(path, { recursive: true, force: true }).catch(() => void 0);
21050
+ }
21051
+ }
21052
+ async function pathExists(path) {
21053
+ return lstat2(path).then(() => true, () => false);
21054
+ }
21055
+ async function deviceOf(path) {
21056
+ return stat2(path).then((info) => info.dev, () => void 0);
21057
+ }
21058
+ async function isDirectory(path) {
21059
+ return stat2(path).then((info) => info.isDirectory(), () => false);
21060
+ }
21061
+ function describe(error) {
21062
+ return error instanceof Error ? error.message : String(error);
21063
+ }
21064
+
20795
21065
  // apps/body/dist/monolith-room-turn.js
20796
- import { mkdir as mkdir10 } from "node:fs/promises";
21066
+ import { mkdir as mkdir11 } from "node:fs/promises";
20797
21067
  import { homedir as homedir6 } from "node:os";
20798
- import { join as join6 } from "node:path";
21068
+ import { join as join7 } from "node:path";
20799
21069
 
20800
21070
  // packages/api-contract/dist/scheduled-prompts.js
20801
21071
  var SCHEDULE_SCHEDULER_NAME = "Beeline Scheduler";
20802
21072
  var SCHEDULE_RAN_VERB = "ran a schedule for";
20803
21073
 
20804
21074
  // apps/body/dist/monolith-room-turn.js
21075
+ var ROOM_PROMPT_INACTIVITY_TIMEOUT_MS = 18e4;
20805
21076
  function isRoomMcpPermissionRequest(request, mountedServers = ROOM_MOUNTED_MCP_SERVERS) {
20806
21077
  if (isSquireMcpPermissionRequest(request))
20807
21078
  return false;
@@ -20997,7 +21268,7 @@ var MonolithRoomTurnLoop = class {
20997
21268
  const cached = this.deliveredAttachments.get(item.id);
20998
21269
  if (cached)
20999
21270
  return cached;
21000
- const delivered = await deliverAttachments(item.attachments, join6(this.attachmentDir, item.id.replace(/[^\w-]/g, "_")), this.options.fetchImpl);
21271
+ const delivered = await deliverAttachments(item.attachments, join7(this.attachmentDir, item.id.replace(/[^\w-]/g, "_")), this.options.fetchImpl);
21001
21272
  this.deliveredAttachments.set(item.id, withoutImageData(delivered));
21002
21273
  return delivered;
21003
21274
  }
@@ -21064,7 +21335,7 @@ var MonolithRoomTurnLoop = class {
21064
21335
  agentName: self?.name ?? this.agent.name
21065
21336
  });
21066
21337
  const directMessage = Array.isArray(repositoryState.directParticipants) && repositoryState.directParticipants.length === 2;
21067
- await mkdir10(this.options.cwd, { recursive: true });
21338
+ await mkdir11(this.options.cwd, { recursive: true });
21068
21339
  const selection = configuration.model || configuration.effort ? { model: configuration.model, effort: configuration.effort } : this.options.config.modelSelection;
21069
21340
  const homeOverlay = this.options.config.agentHomeRoot ? await prepareRoomAgentHome({
21070
21341
  root: this.options.config.agentHomeRoot,
@@ -21090,14 +21361,14 @@ var MonolithRoomTurnLoop = class {
21090
21361
  }, selection);
21091
21362
  const operatorHome = this.options.config.operatorHome ?? homedir6();
21092
21363
  const { stateDirs, tmpDir } = harnessStateDirsFromEnv(agentEnv);
21093
- this.attachmentDir = tmpDir ? join6(tmpDir, "beeline-attachments") : void 0;
21364
+ this.attachmentDir = tmpDir ? join7(tmpDir, "beeline-attachments") : void 0;
21094
21365
  this.sessionScratchDir = tmpDir;
21095
21366
  this.sessionStateDirs = stateDirs;
21096
21367
  const homeStateDirs = harnessHomeStateDirs(command, agentEnv.HOME ?? operatorHome);
21097
- await Promise.all(homeStateDirs.map((dir) => mkdir10(dir, { recursive: true })));
21368
+ await Promise.all(homeStateDirs.map((dir) => mkdir11(dir, { recursive: true })));
21098
21369
  const attachScratchRoot = this.options.config.agentHomeRoot ?? tmpDir;
21099
21370
  if (attachScratchRoot)
21100
- await mkdir10(attachScratchRoot, { recursive: true });
21371
+ await mkdir11(attachScratchRoot, { recursive: true });
21101
21372
  const spawnCommand = wrapAgentCommand({
21102
21373
  bwrapPath: this.options.config.bwrapPath,
21103
21374
  spec: {
@@ -21361,7 +21632,7 @@ var MonolithRoomTurnLoop = class {
21361
21632
  try {
21362
21633
  stream.beginRun();
21363
21634
  trace.promptSent();
21364
- result2 = await this.client.sessionPrompt(this.sessionId, nextPrompt, 12e4, (delta, full) => {
21635
+ result2 = await this.client.sessionPrompt(this.sessionId, nextPrompt, ROOM_PROMPT_INACTIVITY_TIMEOUT_MS, (delta, full) => {
21365
21636
  trace.firstModelOutput();
21366
21637
  stream.onChunk(delta, full);
21367
21638
  }, void 0, (calls) => trace.toolCalls(calls));
@@ -21434,7 +21705,7 @@ var MonolithRoomTurnLoop = class {
21434
21705
  console.warn(`[thin-core] monolith Room ${this.options.roomId} turn ${item.id}: ${explained.reason}`);
21435
21706
  }
21436
21707
  if (openCornerCall && !isFailedToolCall(openCornerCall)) {
21437
- reply = stripCornerOpenEcho(reply);
21708
+ reply = "";
21438
21709
  }
21439
21710
  await trace.measure("publish", () => stream.settle(reply, reply ? {
21440
21711
  triggerMessageId: item.id
@@ -21521,6 +21792,41 @@ var TOOL_PATH_LIMIT = 12;
21521
21792
  function cornerMergeInstruction(yoloMode) {
21522
21793
  return yoloMode ? "Yolo is on: when the gate passes, merge this pull request with gh." : "Yolo is off: never merge; wait for explicit human approval in the app.";
21523
21794
  }
21795
+ var CORNER_DELIVERY_NUDGE = "Before ending this turn, inspect the repository state and finish delivering the work: commit and push the intended changes and open the pull request if one does not exist. Decide yourself whether any remaining dirty work belongs to the objective; do not discard it merely to make the worktree clean.";
21796
+ var CORNER_YOLO_MERGE_NUDGE = 'Yolo is on. Check the server merge gate with pr_checks_status now and, if checks="passed", held=false, and approvalPending=false, merge this pull request with gh. Otherwise stop without merging.';
21797
+ function isCornerChecksTurn(trigger, restates) {
21798
+ return Boolean(restates) || /\b(?:passed|failed) a check\b/i.test(trigger);
21799
+ }
21800
+ async function cornerUndeliveredRepositoryState(worktreePath, featureBranch, targetBranch) {
21801
+ try {
21802
+ const [{ stdout: status }, ahead] = await Promise.all([
21803
+ execFileAsync3("git", ["-C", worktreePath, "status", "--porcelain=v1"]),
21804
+ featureBranch ? firstResolvedRemoteRef(worktreePath, [featureBranch, targetBranch]).then((remoteRef) => remoteRef ? execFileAsync3("git", [
21805
+ "-C",
21806
+ worktreePath,
21807
+ "rev-list",
21808
+ "--count",
21809
+ `${remoteRef}..HEAD`
21810
+ ]).then(({ stdout: stdout6 }) => Number.parseInt(stdout6.trim(), 10) || 0) : 0).catch(() => 0) : Promise.resolve(0)
21811
+ ]);
21812
+ const dirty = status.trimEnd();
21813
+ return dirty || ahead > 0 ? `${dirty}
21814
+ ahead:${ahead}` : void 0;
21815
+ } catch {
21816
+ return void 0;
21817
+ }
21818
+ }
21819
+ async function firstResolvedRemoteRef(worktreePath, branches) {
21820
+ for (const branch of branches) {
21821
+ if (!branch)
21822
+ continue;
21823
+ const ref = `refs/remotes/origin/${branch}`;
21824
+ const resolved = await execFileAsync3("git", ["-C", worktreePath, "rev-parse", "--verify", ref]).then(() => true).catch(() => false);
21825
+ if (resolved)
21826
+ return ref;
21827
+ }
21828
+ return void 0;
21829
+ }
21524
21830
  function oneLine(value) {
21525
21831
  return value.replace(/\s+/g, " ").trim();
21526
21832
  }
@@ -21606,7 +21912,7 @@ function toolArguments(call) {
21606
21912
  return input ? { input: clampBytes(redactToolDetail(input), TOOL_ARGUMENT_MAX_BYTES) } : {};
21607
21913
  }
21608
21914
  function toolCallKey(call, index) {
21609
- return call.id ? `id-${createHash4("sha256").update(call.id).digest("hex")}` : `tool-${index}`;
21915
+ return call.id ? `id-${createHash5("sha256").update(call.id).digest("hex")}` : `tool-${index}`;
21610
21916
  }
21611
21917
  function toolCallSettled(call) {
21612
21918
  if (call.resultReceived)
@@ -21669,6 +21975,10 @@ var MonolithCornerTurnLoop = class {
21669
21975
  modelTakesImages;
21670
21976
  /** The one provider re-pinned after an empty completion, until the session ends. */
21671
21977
  pinnedProviderOverride;
21978
+ /** The merge authority baked into the current session. */
21979
+ yoloMode = false;
21980
+ /** Repository state already given a delivery reminder, until that state changes. */
21981
+ lastDeliveryNudgeState;
21672
21982
  turnIdentityInstructions = "";
21673
21983
  busy = false;
21674
21984
  forcedStop = false;
@@ -21693,6 +22003,8 @@ var MonolithCornerTurnLoop = class {
21693
22003
  * by the same replay window the inbox already de-duplicates over.
21694
22004
  */
21695
22005
  stoppedTurns = /* @__PURE__ */ new Set();
22006
+ /** In-flight warm-store harvest, awaited at shutdown and never by a turn. */
22007
+ harvest;
21696
22008
  constructor(options) {
21697
22009
  this.options = options;
21698
22010
  this.agent = runtimeIdentity(options.runtime.agent);
@@ -21804,7 +22116,8 @@ var MonolithCornerTurnLoop = class {
21804
22116
  agentName: self?.name ?? this.agent.name,
21805
22117
  yoloMode: configuration.yoloMode
21806
22118
  });
21807
- await mkdir11(this.options.worktreePath, { recursive: true });
22119
+ this.yoloMode = configuration.yoloMode;
22120
+ await mkdir12(this.options.worktreePath, { recursive: true });
21808
22121
  const selection = configuration.model || configuration.effort ? { model: configuration.model, effort: configuration.effort } : this.options.config.modelSelection;
21809
22122
  const homeOverlay = this.options.config.agentHomeRoot ? await prepareRoomAgentHome({
21810
22123
  root: this.options.config.agentHomeRoot,
@@ -21836,10 +22149,13 @@ var MonolithCornerTurnLoop = class {
21836
22149
  inheritedPath: this.options.config.agentEnv.PATH ?? process.env.PATH
21837
22150
  });
21838
22151
  }
22152
+ const npmCacheDir = sharedNpmCacheDir(this.options.runtime.supervisorRoot);
22153
+ await mkdir12(npmCacheDir, { recursive: true, mode: 448 });
21839
22154
  const agentEnv = {
21840
22155
  ...this.options.config.agentEnv,
21841
22156
  ...homeOverlay,
21842
- ...githubEnv
22157
+ ...githubEnv,
22158
+ npm_config_cache: npmCacheDir
21843
22159
  };
21844
22160
  this.agentEnv = agentEnv;
21845
22161
  const agentArgs = agentArgsWithModelSelection({
@@ -21849,13 +22165,13 @@ var MonolithCornerTurnLoop = class {
21849
22165
  }, selection);
21850
22166
  const operatorHome = this.options.config.operatorHome ?? homedir7();
21851
22167
  const { stateDirs, tmpDir } = harnessStateDirsFromEnv(agentEnv);
21852
- this.attachmentDir = tmpDir ? join7(tmpDir, "beeline-attachments") : void 0;
22168
+ this.attachmentDir = tmpDir ? join8(tmpDir, "beeline-attachments") : void 0;
21853
22169
  this.sessionScratchDir = tmpDir;
21854
22170
  const homeStateDirs = harnessHomeStateDirs(command, agentEnv.HOME ?? operatorHome);
21855
- await Promise.all(homeStateDirs.map((dir) => mkdir11(dir, { recursive: true })));
22171
+ await Promise.all(homeStateDirs.map((dir) => mkdir12(dir, { recursive: true })));
21856
22172
  const attachScratchRoot = this.options.config.agentHomeRoot ?? tmpDir;
21857
22173
  if (attachScratchRoot)
21858
- await mkdir11(attachScratchRoot, { recursive: true });
22174
+ await mkdir12(attachScratchRoot, { recursive: true });
21859
22175
  const spawnCommand = wrapAgentCommand({
21860
22176
  bwrapPath: this.options.config.bwrapPath,
21861
22177
  spec: {
@@ -21867,7 +22183,13 @@ var MonolithCornerTurnLoop = class {
21867
22183
  harnessStateDirs: stateDirs,
21868
22184
  harnessHomeStateDirs: homeStateDirs,
21869
22185
  ...tmpDir ? { tmpDir } : {},
21870
- ...attachScratchRoot ? { additionalWritablePaths: [attachScratchRoot] } : {},
22186
+ additionalWritablePaths: [
22187
+ ...attachScratchRoot ? [attachScratchRoot] : [],
22188
+ // The shared npm cache. npm writes to its cache on every install,
22189
+ // and this one is deliberately outside the per-corner home so the
22190
+ // download is paid once per host rather than once per corner.
22191
+ npmCacheDir
22192
+ ],
21871
22193
  maskPaths: credentialMaskPaths(this.options.config.sandboxMaskPaths, operatorHome)
21872
22194
  },
21873
22195
  command,
@@ -21896,7 +22218,11 @@ var MonolithCornerTurnLoop = class {
21896
22218
  // the corner harness without inheriting any host credentials.
21897
22219
  env: [
21898
22220
  { name: "GH_TOKEN", value: repository.githubToken },
21899
- { name: "GITHUB_TOKEN", value: repository.githubToken }
22221
+ { name: "GITHUB_TOKEN", value: repository.githubToken },
22222
+ // Its shell tool runs the same installs the harness does, and
22223
+ // a sanitized env would otherwise send them to npm's default
22224
+ // per-corner cache.
22225
+ { name: "npm_config_cache", value: npmCacheDir }
21900
22226
  ]
21901
22227
  }
21902
22228
  ] : [],
@@ -22056,7 +22382,7 @@ var MonolithCornerTurnLoop = class {
22056
22382
  const [conversation, roster, delivered] = await trace.measure("context-fetch", () => Promise.all([
22057
22383
  api.execute("getRoomConversation", { roomId: cornerId, limit: 200 }),
22058
22384
  this.roster(),
22059
- this.attachmentDir && attachments.length ? deliverAttachments(attachments, join7(this.attachmentDir, requestId.replace(/[^\w-]/g, "_")), this.options.fetchImpl) : Promise.resolve([])
22385
+ this.attachmentDir && attachments.length ? deliverAttachments(attachments, join8(this.attachmentDir, requestId.replace(/[^\w-]/g, "_")), this.options.fetchImpl) : Promise.resolve([])
22060
22386
  ]));
22061
22387
  const names = new Map(roster.members.map((member) => [member.identityId, member.name]));
22062
22388
  const requestedBy = requester && !requester.name && names.get(requester.pubkey) ? { ...requester, name: names.get(requester.pubkey) } : requester;
@@ -22158,7 +22484,7 @@ ${trigger}`,
22158
22484
  publishToolCalls(calls, false);
22159
22485
  await this.activityTail;
22160
22486
  };
22161
- const runPrompt = async () => {
22487
+ const runPrompt = async (prompt = buildPrompt()) => {
22162
22488
  activityAttempt += 1;
22163
22489
  publishedToolCalls.clear();
22164
22490
  observedToolCalls.clear();
@@ -22170,7 +22496,7 @@ ${trigger}`,
22170
22496
  narrationRunBoundary = 0;
22171
22497
  currentNarrationRun = "";
22172
22498
  trace.promptSent();
22173
- return this.client.sessionPrompt(this.sessionId, promptWithImages(buildPrompt(), attachmentImageBlocks(delivered, this.acceptsImages())), 12e4, (delta, full, currentRun, runs) => {
22499
+ return this.client.sessionPrompt(this.sessionId, promptWithImages(prompt, attachmentImageBlocks(delivered, this.acceptsImages())), 12e4, (delta, full, currentRun, runs) => {
22174
22500
  trace.firstModelOutput();
22175
22501
  if (runs) {
22176
22502
  completedNarrationRuns = runs.slice(narrationRunBoundary);
@@ -22202,6 +22528,19 @@ ${trigger}`,
22202
22528
  explained = await this.explainEmpty(result);
22203
22529
  }
22204
22530
  }
22531
+ const checksTurn = isCornerChecksTurn(trigger, restates);
22532
+ const deliveryState = !checksTurn && this.options.repository ? await cornerUndeliveredRepositoryState(this.options.worktreePath, this.options.repository.featureBranch, this.options.repository.targetBranch) : void 0;
22533
+ const needsDeliveryNudge = deliveryState !== void 0 && deliveryState !== this.lastDeliveryNudgeState;
22534
+ let replyBeforeNudge = "";
22535
+ if (!explained && (needsDeliveryNudge || checksTurn && this.yoloMode)) {
22536
+ if (needsDeliveryNudge)
22537
+ this.lastDeliveryNudgeState = deliveryState;
22538
+ replyBeforeNudge = durableReplyText(result.agentText);
22539
+ await flushToolCalls(result.toolCalls, "");
22540
+ result = await runPrompt(checksTurn ? CORNER_YOLO_MERGE_NUDGE : CORNER_DELIVERY_NUDGE);
22541
+ trace.promptSettled();
22542
+ explained = await this.explainEmpty(result);
22543
+ }
22205
22544
  if (this.stoppedTurns.has(requestId)) {
22206
22545
  stream.close();
22207
22546
  throw new TurnStoppedError("turn stopped by the requester");
@@ -22209,6 +22548,7 @@ ${trigger}`,
22209
22548
  let reply = durableReplyText(result.agentText);
22210
22549
  if (!reply && explained?.recoveredText)
22211
22550
  reply = durableReplyText(explained.recoveredText);
22551
+ reply = [replyBeforeNudge, reply].filter(Boolean).join("\n\n");
22212
22552
  await flushToolCalls(result.toolCalls, reply);
22213
22553
  for (const call of result.toolCalls) {
22214
22554
  const failure = toolCallFailureLine(call);
@@ -22256,8 +22596,39 @@ ${trigger}`,
22256
22596
  } finally {
22257
22597
  this.busy = false;
22258
22598
  this.currentTurn = void 0;
22599
+ this.harvestWarmNodeModules();
22259
22600
  }
22260
22601
  }
22602
+ /**
22603
+ * Offer this worktree's `node_modules` to the host-wide warm store.
22604
+ *
22605
+ * A turn's end is the moment the tree is most likely to be a finished
22606
+ * install, and the store keeps only the first complete tree per lockfile —
22607
+ * so after the first corner on a lockfile this is one `stat` that answers
22608
+ * `already-warm`. The copy that the first one does is deliberately NOT
22609
+ * awaited by the turn: nobody in the Room is waiting on a cache, and the
22610
+ * only thing that waits is shutdown, so a half-copied tree is never left
22611
+ * where a later corner could read it as complete.
22612
+ */
22613
+ harvestWarmNodeModules() {
22614
+ if (this.harvest || !this.options.repository)
22615
+ return;
22616
+ const { cornerId, worktreePath, runtime } = this.options;
22617
+ const run2 = harvestWarmNodeModules({
22618
+ worktreePath,
22619
+ storeRoot: warmNodeModulesStoreDir(runtime.supervisorRoot)
22620
+ }).then((outcome) => {
22621
+ if (outcome.reason === "already-warm" || outcome.reason === "no-lockfile")
22622
+ return;
22623
+ console.log(`[thin-core] corner ${cornerId} warm node_modules harvest: ${outcome.reason}${outcome.detail ? ` (${outcome.detail})` : ""}`);
22624
+ }).catch((error) => {
22625
+ console.error(`[thin-core] corner ${cornerId} warm node_modules harvest failed:`, error);
22626
+ }).finally(() => {
22627
+ if (this.harvest === run2)
22628
+ this.harvest = void 0;
22629
+ });
22630
+ this.harvest = run2;
22631
+ }
22261
22632
  /**
22262
22633
  * Bring this worktree onto the corner's branch as GitHub currently has it,
22263
22634
  * before any work is done on top of it.
@@ -22304,6 +22675,7 @@ ${trigger}`,
22304
22675
  const state = await api.execute("getCornerRestoreState", { cornerId });
22305
22676
  if (!state.closeRequested)
22306
22677
  return false;
22678
+ await this.harvest;
22307
22679
  await this.options.onCloseRequested();
22308
22680
  return true;
22309
22681
  },
@@ -22312,6 +22684,7 @@ ${trigger}`,
22312
22684
  } finally {
22313
22685
  this.options.grantRunner?.unregister(cornerId);
22314
22686
  await this.options.scheduler.suspend(cornerId);
22687
+ await this.harvest;
22315
22688
  }
22316
22689
  }
22317
22690
  };
@@ -22732,13 +23105,13 @@ function shouldPostInitialCornerWorkingState(restore, isOpener = true) {
22732
23105
  }
22733
23106
  async function materializeCornerWorktree(input) {
22734
23107
  const remote = roomCheckoutRemote(input.remote);
22735
- const repositoryHash = createHash5("sha256").update(remote).digest("hex").slice(0, 24);
22736
- const gitCommonDir = resolve19(input.supervisorRoot, "beeline", "repositories", `${repositoryHash}.git`);
22737
- const path = resolve19(input.supervisorRoot, "beeline", "corners", input.cornerId);
22738
- await mkdir12(dirname7(gitCommonDir), { recursive: true, mode: 448 });
22739
- await mkdir12(dirname7(path), { recursive: true, mode: 448 });
23108
+ const repositoryHash = createHash6("sha256").update(remote).digest("hex").slice(0, 24);
23109
+ const gitCommonDir = resolve20(input.supervisorRoot, "beeline", "repositories", `${repositoryHash}.git`);
23110
+ const path = resolve20(input.supervisorRoot, "beeline", "corners", input.cornerId);
23111
+ await mkdir13(dirname8(gitCommonDir), { recursive: true, mode: 448 });
23112
+ await mkdir13(dirname8(path), { recursive: true, mode: 448 });
22740
23113
  const authEnv = githubGitEnv(input.token);
22741
- if (!existsSync4(resolve19(gitCommonDir, "HEAD"))) {
23114
+ if (!existsSync4(resolve20(gitCommonDir, "HEAD"))) {
22742
23115
  await execFileAsync4("git", ["clone", "--bare", remote, gitCommonDir], {
22743
23116
  env: authEnv,
22744
23117
  maxBuffer: 4 * 1024 * 1024
@@ -22757,8 +23130,8 @@ async function materializeCornerWorktree(input) {
22757
23130
  "origin",
22758
23131
  `+refs/heads/${input.featureBranch}:refs/remotes/origin/${input.featureBranch}`
22759
23132
  ], { env: authEnv, maxBuffer: 4 * 1024 * 1024 }).then(() => true, () => false);
22760
- if (!existsSync4(resolve19(path, ".git"))) {
22761
- await rm4(path, { recursive: true, force: true });
23133
+ if (!existsSync4(resolve20(path, ".git"))) {
23134
+ await rm5(path, { recursive: true, force: true });
22762
23135
  await execFileAsync4("git", [
22763
23136
  `--git-dir=${gitCommonDir}`,
22764
23137
  "worktree",
@@ -22768,6 +23141,13 @@ async function materializeCornerWorktree(input) {
22768
23141
  path,
22769
23142
  restored ? `refs/remotes/origin/${input.featureBranch}` : `refs/remotes/origin/${input.targetBranch}`
22770
23143
  ], { env: authEnv, maxBuffer: 4 * 1024 * 1024 });
23144
+ const seed = await seedWarmNodeModules({
23145
+ worktreePath: path,
23146
+ storeRoot: warmNodeModulesStoreDir(input.supervisorRoot)
23147
+ });
23148
+ if (seed.reason !== "no-lockfile") {
23149
+ console.log(`[thin-core] corner ${input.cornerId} warm node_modules: ${seed.reason}${seed.detail ? ` (${seed.detail})` : ""}`);
23150
+ }
22771
23151
  }
22772
23152
  await execFileAsync4("git", [
22773
23153
  `--git-dir=${gitCommonDir}`,
@@ -22801,7 +23181,7 @@ async function materializeCornerWorktree(input) {
22801
23181
  `${input.committer.publicKey.slice(0, 16)}@users.noreply.github.com`
22802
23182
  ]);
22803
23183
  const top = await execFileAsync4("git", ["-C", path, "rev-parse", "--show-toplevel"]);
22804
- if (resolve19(top.stdout.trim()) !== resolve19(path)) {
23184
+ if (resolve20(top.stdout.trim()) !== resolve20(path)) {
22805
23185
  throw new Error(`corner worktree escaped its isolated root: ${top.stdout.trim()}`);
22806
23186
  }
22807
23187
  return { path, gitCommonDir };
@@ -22867,11 +23247,11 @@ async function removeCornerWorktreeAndBranches(worktree) {
22867
23247
  }
22868
23248
  var execFileAsync4 = promisify4(execFile5);
22869
23249
  async function removeCornerScratchWorkspace(input) {
22870
- const expected = resolve19(input.roomRoot, "scratch");
22871
- if (resolve19(input.scratchPath) !== expected) {
23250
+ const expected = resolve20(input.roomRoot, "scratch");
23251
+ if (resolve20(input.scratchPath) !== expected) {
22872
23252
  throw new Error(`refusing to remove scratch outside corner ${input.cornerId}`);
22873
23253
  }
22874
- await rm4(expected, { recursive: true, force: true });
23254
+ await rm5(expected, { recursive: true, force: true });
22875
23255
  }
22876
23256
  var RoomRuntimeCoordinator = class {
22877
23257
  configPath;
@@ -23061,13 +23441,13 @@ var RoomRuntimeCoordinator = class {
23061
23441
  return this.runtime.rooms.find((room) => room.channelId === roomId);
23062
23442
  }
23063
23443
  roomRoot(roomId) {
23064
- return this.roomRecord(roomId)?.root ?? resolve19(dirname7(this.configPath), "rooms", roomId);
23444
+ return this.roomRecord(roomId)?.root ?? resolve20(dirname8(this.configPath), "rooms", roomId);
23065
23445
  }
23066
23446
  roomAgentHomeRoot(workspaceRoot, required = false) {
23067
23447
  const flag = process.env.BUZZY_BODY_ROOM_HOME;
23068
23448
  if (!required && flag === "0")
23069
23449
  return void 0;
23070
- const home = resolve19(workspaceRoot, "agent-home");
23450
+ const home = resolve20(workspaceRoot, "agent-home");
23071
23451
  if (!required && flag !== "1" && !existsSync4(home) && existsSync4(workspaceRoot))
23072
23452
  return void 0;
23073
23453
  try {
@@ -23083,10 +23463,10 @@ var RoomRuntimeCoordinator = class {
23083
23463
  return {
23084
23464
  ...this.baseConfig,
23085
23465
  workspaceRoot,
23086
- agentPrivateRoot: resolve19(workspaceRoot, "agent-private"),
23087
- agentMemoryRoot: resolve19(dirname7(this.configPath), "memory"),
23088
- openRouterRoutingCacheDir: openRouterRoutingCacheDir(dirname7(this.configPath)),
23089
- turnTraceDir: turnTraceDirectory(dirname7(this.configPath)),
23466
+ agentPrivateRoot: resolve20(workspaceRoot, "agent-private"),
23467
+ agentMemoryRoot: resolve20(dirname8(this.configPath), "memory"),
23468
+ openRouterRoutingCacheDir: openRouterRoutingCacheDir(dirname8(this.configPath)),
23469
+ turnTraceDir: turnTraceDirectory(dirname8(this.configPath)),
23090
23470
  ...agentHomeRoot ? { agentHomeRoot } : {}
23091
23471
  };
23092
23472
  }
@@ -23152,12 +23532,12 @@ var RoomRuntimeCoordinator = class {
23152
23532
  return this.roomRoot(roomId);
23153
23533
  const remote = roomCheckoutRemote(repository.remote);
23154
23534
  const targetBranch = repository.targetBranch || "main";
23155
- const checkoutId = createHash5("sha256").update(`${remote}\0${targetBranch}`).digest("hex").slice(0, 24);
23156
- const path = resolve19(this.runtime.supervisorRoot, "beeline", "room-checkouts", checkoutId);
23157
- await mkdir12(dirname7(path), { recursive: true, mode: 448 });
23535
+ const checkoutId = createHash6("sha256").update(`${remote}\0${targetBranch}`).digest("hex").slice(0, 24);
23536
+ const path = resolve20(this.runtime.supervisorRoot, "beeline", "room-checkouts", checkoutId);
23537
+ await mkdir13(dirname8(path), { recursive: true, mode: 448 });
23158
23538
  const token = remote.startsWith("https://github.com/") ? await this.options.daemonApi.execute("getRoomGitHubToken", { roomId }) : void 0;
23159
23539
  const env = token ? githubGitEnv(token.token) : process.env;
23160
- if (!existsSync4(resolve19(path, ".git"))) {
23540
+ if (!existsSync4(resolve20(path, ".git"))) {
23161
23541
  await execFileAsync4("git", ["clone", "--no-checkout", remote, path], {
23162
23542
  env,
23163
23543
  maxBuffer: 4 * 1024 * 1024
@@ -23210,9 +23590,9 @@ var RoomRuntimeCoordinator = class {
23210
23590
  featureBranch,
23211
23591
  token: granted.token
23212
23592
  }) : void 0;
23213
- const workspacePath = worktree?.path ?? resolve19(this.roomRoot(corner.cornerId), "scratch");
23593
+ const workspacePath = worktree?.path ?? resolve20(this.roomRoot(corner.cornerId), "scratch");
23214
23594
  if (!worktree)
23215
- await mkdir12(workspacePath, { recursive: true, mode: 448 });
23595
+ await mkdir13(workspacePath, { recursive: true, mode: 448 });
23216
23596
  const isOpener = !corner.openedBy || corner.openedBy === this.agent.publicKey;
23217
23597
  if (worktree && shouldPostInitialCornerWorkingState(restore, isOpener)) {
23218
23598
  await this.options.daemonApi.execute("postCornerRemoteState", {
@@ -23595,9 +23975,9 @@ var ThinDaemonCore = class {
23595
23975
 
23596
23976
  // apps/body/dist/systemd.js
23597
23977
  import { execFile as execFile6 } from "node:child_process";
23598
- import { mkdir as mkdir13, readFile as readFile8, writeFile as writeFile9 } from "node:fs/promises";
23978
+ import { mkdir as mkdir14, readFile as readFile9, writeFile as writeFile9 } from "node:fs/promises";
23599
23979
  import { homedir as homedir8 } from "node:os";
23600
- import { dirname as dirname8, resolve as resolve20 } from "node:path";
23980
+ import { dirname as dirname9, resolve as resolve21 } from "node:path";
23601
23981
  import { setTimeout as sleep } from "node:timers/promises";
23602
23982
  import { promisify as promisify5 } from "node:util";
23603
23983
  var execFileAsync5 = promisify5(execFile6);
@@ -23639,9 +24019,9 @@ WantedBy=default.target
23639
24019
  }
23640
24020
  function isCanonicalInstalledLauncher(env = process.env, invocationPath = process.argv[1]) {
23641
24021
  const home = env.HOME?.trim() || homedir8();
23642
- const expectedLibDir = resolve20(home, ".local", "lib", "beeline");
24022
+ const expectedLibDir = resolve21(home, ".local", "lib", "beeline");
23643
24023
  const expectedPrefix = `${expectedLibDir}/`;
23644
- return resolve20(env.BEELINE_LIB_DIR?.trim() || "/") === expectedLibDir && Boolean(invocationPath) && resolve20(invocationPath).startsWith(expectedPrefix);
24024
+ return resolve21(env.BEELINE_LIB_DIR?.trim() || "/") === expectedLibDir && Boolean(invocationPath) && resolve21(invocationPath).startsWith(expectedPrefix);
23645
24025
  }
23646
24026
  function assertCanonicalInstalledLauncher(env, invocationPath) {
23647
24027
  if (isCanonicalInstalledLauncher(env, invocationPath))
@@ -23649,8 +24029,8 @@ function assertCanonicalInstalledLauncher(env, invocationPath) {
23649
24029
  throw new Error("refusing to modify the shared Beeline systemd unit outside the canonical ~/.local/bin/beeline launcher");
23650
24030
  }
23651
24031
  function systemdUserUnitPath(env = process.env) {
23652
- const configRoot = env.XDG_CONFIG_HOME?.trim() || resolve20(homedir8(), ".config");
23653
- return resolve20(configRoot, "systemd", "user", SYSTEMD_UNIT_NAME);
24032
+ const configRoot = env.XDG_CONFIG_HOME?.trim() || resolve21(homedir8(), ".config");
24033
+ return resolve21(configRoot, "systemd", "user", SYSTEMD_UNIT_NAME);
23654
24034
  }
23655
24035
  var runSystemctl = async (args) => {
23656
24036
  const result = await execFileAsync5("systemctl", ["--user", ...args], {
@@ -23666,9 +24046,9 @@ async function installAgentService(publicKey, options = {}) {
23666
24046
  assertCanonicalInstalledLauncher(env, options.invocationPath);
23667
24047
  const path = systemdUserUnitPath(env);
23668
24048
  const content = agentServiceUnit();
23669
- const existing = await readFile8(path, "utf8").catch(() => "");
24049
+ const existing = await readFile9(path, "utf8").catch(() => "");
23670
24050
  if (existing !== content) {
23671
- await mkdir13(dirname8(path), { recursive: true, mode: 448 });
24051
+ await mkdir14(dirname9(path), { recursive: true, mode: 448 });
23672
24052
  await writeFile9(path, content, { mode: 384 });
23673
24053
  }
23674
24054
  const run2 = options.run ?? runSystemctl;
@@ -23749,7 +24129,7 @@ async function retireRemovedAgent(runtime, options = {}) {
23749
24129
  }
23750
24130
 
23751
24131
  // apps/body/dist/start-command.js
23752
- import { dirname as dirname9 } from "node:path";
24132
+ import { dirname as dirname10 } from "node:path";
23753
24133
  var import_picocolors = __toESM(require_picocolors(), 1);
23754
24134
  var DEFAULT_RESTART_DRAIN_TIMEOUT_MS = 30 * 6e4;
23755
24135
  var RESTART_WAIT_REPORT_INTERVAL_MS = 3e4;
@@ -23824,7 +24204,7 @@ async function runStartCommand(args, interactiveUi) {
23824
24204
  continue;
23825
24205
  }
23826
24206
  const spinnerHandle = spinner();
23827
- spinnerHandle.start(`Starting ${dirname9(path)}\u2026`);
24207
+ spinnerHandle.start(`Starting ${dirname10(path)}\u2026`);
23828
24208
  try {
23829
24209
  await startRuntime(path, spinnerHandle);
23830
24210
  spinnerHandle.stop(import_picocolors.default.green("Started."));
@@ -23840,9 +24220,9 @@ async function runStartCommand(args, interactiveUi) {
23840
24220
 
23841
24221
  // apps/body/dist/connect-command.js
23842
24222
  import { spawn as spawn5 } from "node:child_process";
23843
- import { createHash as createHash7 } from "node:crypto";
23844
- import { chmod as chmod5, mkdir as mkdir15, readFile as readFile10, unlink as unlink2, writeFile as writeFile11 } from "node:fs/promises";
23845
- import { dirname as dirname11, resolve as resolve22 } from "node:path";
24223
+ import { createHash as createHash8 } from "node:crypto";
24224
+ import { chmod as chmod6, mkdir as mkdir16, readFile as readFile11, unlink as unlink2, writeFile as writeFile11 } from "node:fs/promises";
24225
+ import { dirname as dirname12, resolve as resolve23 } from "node:path";
23846
24226
  import { stdin as stdin3, stdout as stdout4 } from "node:process";
23847
24227
 
23848
24228
  // apps/body/dist/clack-support.js
@@ -24109,7 +24489,11 @@ async function pairDevice(grant, options = {}) {
24109
24489
  ...grant.llmEnvFile ? { llmEnvFile: grant.llmEnvFile } : {},
24110
24490
  agent: selectedAgent
24111
24491
  });
24112
- await (options.validateSelection ?? validateAgentModelSelection)(selectedAgent, localConfig.agentEnv, { model: grant.model });
24492
+ const modelSelection = {
24493
+ model: grant.model,
24494
+ ...grant.effort ? { effort: grant.effort } : {}
24495
+ };
24496
+ await (options.validateSelection ?? validateAgentModelSelection)(selectedAgent, localConfig.agentEnv, modelSelection);
24113
24497
  const agentIdentity = identityFromKey(grant.agentSecretKey, grant.agentName);
24114
24498
  const staged = await stageMonolithAgentRuntime({
24115
24499
  workspaceId: grant.workspaceId,
@@ -24121,7 +24505,7 @@ async function pairDevice(grant, options = {}) {
24121
24505
  agentKind: selectedAgent.kind,
24122
24506
  agentCommand: selectedAgent.command,
24123
24507
  agentArgs: selectedAgent.args,
24124
- modelSelection: { model: grant.model },
24508
+ modelSelection,
24125
24509
  ...grant.accessPolicy ? { accessPolicy: grant.accessPolicy } : {},
24126
24510
  mcpBinary: localConfig.mcpBinary,
24127
24511
  agentIdentity,
@@ -24236,6 +24620,12 @@ var clackPrompts = {
24236
24620
  }), "Connection cancelled.");
24237
24621
  }
24238
24622
  };
24623
+ var CONNECT_EFFORT_CATEGORIES = ["effort", "reasoning_effort", "thought_level"];
24624
+ function connectEffortPickerFromAxes(axes, rawAxes = axes) {
24625
+ const isEffort = (axis2) => CONNECT_EFFORT_CATEGORIES.includes(axis2.category) && axis2.options.length > 0;
24626
+ const axis = axes.find(isEffort) ?? rawAxes.find(isEffort);
24627
+ return axis ? { currentValue: axis.currentValue, options: axis.options } : void 0;
24628
+ }
24239
24629
  function connectModelPickerFromAxes(axes, fallbackModel, harness, rawAxes = axes) {
24240
24630
  const filtered = axes.find((axis) => axis.category === "model");
24241
24631
  if (filtered?.options.length) {
@@ -24253,13 +24643,18 @@ function connectModelPickerFromAxes(axes, fallbackModel, harness, rawAxes = axes
24253
24643
  }
24254
24644
  async function loadConnectModelCatalog(input) {
24255
24645
  const agent = resolveAgentCommand({ kind: input.harness });
24646
+ const model = input.model ?? defaultConnectModel(input.harness, input.provider);
24256
24647
  const catalog = await fetchAgentModelCatalog(agent, providerEnvironment({
24257
24648
  harness: input.harness,
24258
24649
  ...input.provider ? { provider: input.provider } : {},
24259
24650
  ...input.apiKey ? { apiKey: input.apiKey } : {},
24260
- model: defaultConnectModel(input.harness, input.provider)
24261
- }), void 0, input.timeoutMs === void 0 ? {} : { timeoutMs: input.timeoutMs });
24262
- return connectModelPickerFromAxes(catalog.catalog, defaultConnectModel(input.harness, input.provider), input.harness, catalog.raw);
24651
+ model
24652
+ }), input.model ? { model: input.model } : void 0, input.timeoutMs === void 0 ? {} : { timeoutMs: input.timeoutMs });
24653
+ const effort = connectEffortPickerFromAxes(catalog.catalog, catalog.raw);
24654
+ return {
24655
+ ...connectModelPickerFromAxes(catalog.catalog, defaultConnectModel(input.harness, input.provider), input.harness, catalog.raw),
24656
+ ...effort ? { effort } : {}
24657
+ };
24263
24658
  }
24264
24659
  var CONNECT_PROBE_TIMEOUT_MS = 12e3;
24265
24660
  function connectProbeFoundModels(catalog) {
@@ -24293,6 +24688,33 @@ async function collectConnectWizard(prompts = clackPrompts, loadModels = loadCon
24293
24688
  });
24294
24689
  return picked.trim();
24295
24690
  };
24691
+ const askEffort = async (catalog2, forHarness, model2, forProvider, forKey) => {
24692
+ if (!catalog2.effort)
24693
+ return void 0;
24694
+ let axis = catalog2.effort;
24695
+ if (model2 !== catalog2.currentValue) {
24696
+ const reread = await loadModels({
24697
+ harness: forHarness,
24698
+ model: model2,
24699
+ ...forProvider ? { provider: forProvider } : {},
24700
+ ...forKey ? { apiKey: forKey } : {},
24701
+ timeoutMs: CONNECT_PROBE_TIMEOUT_MS
24702
+ }).catch(() => void 0);
24703
+ axis = reread?.effort ?? axis;
24704
+ }
24705
+ if (!axis.options.length)
24706
+ return void 0;
24707
+ const picked = await prompts.select({
24708
+ message: brass("Choose reasoning effort"),
24709
+ options: axis.options.map((choice) => ({
24710
+ value: choice.id,
24711
+ label: choice.name ?? choice.id,
24712
+ ...choice.id === axis.currentValue ? { hint: "current" } : {}
24713
+ })),
24714
+ ...axis.options.some((choice) => choice.id === axis.currentValue) ? { initialValue: axis.currentValue } : {}
24715
+ });
24716
+ return picked.trim();
24717
+ };
24296
24718
  const probe = async (candidate) => {
24297
24719
  try {
24298
24720
  const catalog2 = await loadModels({
@@ -24325,10 +24747,9 @@ async function collectConnectWizard(prompts = clackPrompts, loadModels = loadCon
24325
24747
  sole: harness === sole,
24326
24748
  ...configured.currentValue ? { model: configured.currentValue } : {}
24327
24749
  }));
24328
- return {
24329
- harness,
24330
- model: configured.currentValue ?? await askModel(configured, harness)
24331
- };
24750
+ const model2 = await askModel(configured, harness);
24751
+ const effort2 = await askEffort(configured, harness, model2);
24752
+ return { harness, model: model2, ...effort2 ? { effort: effort2 } : {} };
24332
24753
  }
24333
24754
  let provider;
24334
24755
  let apiKey;
@@ -24387,11 +24808,13 @@ async function collectConnectWizard(prompts = clackPrompts, loadModels = loadCon
24387
24808
  ...apiKey ? { apiKey: apiKey.trim() } : {}
24388
24809
  });
24389
24810
  const model = await askModel(catalog, harness, provider);
24811
+ const effort = await askEffort(catalog, harness, model, provider, apiKey?.trim());
24390
24812
  return {
24391
24813
  harness,
24392
24814
  ...provider ? { provider } : {},
24393
24815
  ...apiKey ? { apiKey: apiKey.trim() } : {},
24394
- model
24816
+ model,
24817
+ ...effort ? { effort } : {}
24395
24818
  };
24396
24819
  }
24397
24820
  async function jsonRequest(url, body, fetchImpl) {
@@ -24416,12 +24839,13 @@ function requestConnectGrant(baseUrl, pairingCode, selection, fetchImpl) {
24416
24839
  const normalizedPairingCode = normalizeAgentPairingCode(pairingCode);
24417
24840
  if (!normalizedPairingCode)
24418
24841
  throw new Error("invalid pairing code");
24419
- const avatarSeed = createHash7("sha256").update(normalizedPairingCode.toUpperCase()).digest("hex").slice(0, 32);
24842
+ const avatarSeed = createHash8("sha256").update(normalizedPairingCode.toUpperCase()).digest("hex").slice(0, 32);
24420
24843
  return jsonRequest(`${baseUrl}/auth/agent/connect`, {
24421
24844
  pairing_code: normalizedPairingCode,
24422
24845
  harness: selection.harness,
24423
24846
  ...selection.provider ? { provider: selection.provider } : {},
24424
24847
  model: selection.model,
24848
+ ...selection.effort ? { effort: selection.effort } : {},
24425
24849
  avatar_seed: avatarSeed,
24426
24850
  // This wizard always finishes the join itself (`finishConnectedAgentPairing`,
24427
24851
  // called once the rename prompt below settles), so the claim must not
@@ -24463,7 +24887,7 @@ async function installCurrentRelease(fetchImpl) {
24463
24887
  });
24464
24888
  await activateRelease(layout, releaseId);
24465
24889
  return {
24466
- binary: resolve22(layout.binDir, "beeline"),
24890
+ binary: resolve23(layout.binDir, "beeline"),
24467
24891
  version: published.version ?? releaseId
24468
24892
  };
24469
24893
  }
@@ -24486,21 +24910,21 @@ function providerEnvironment(selection) {
24486
24910
  };
24487
24911
  }
24488
24912
  async function writePrivateJson(path, value) {
24489
- await mkdir15(dirname11(path), { recursive: true, mode: 448 });
24913
+ await mkdir16(dirname12(path), { recursive: true, mode: 448 });
24490
24914
  await writeFile11(path, `${JSON.stringify(value, null, 2)}
24491
24915
  `, { mode: 384 });
24492
- await chmod5(path, 384);
24916
+ await chmod6(path, 384);
24493
24917
  }
24494
24918
  async function writeProviderEnv(selection, agentPubkey) {
24495
24919
  const values = providerEnvironment(selection);
24496
24920
  if (Object.keys(values).length === 0)
24497
24921
  return void 0;
24498
- const path = resolve22(defaultSupervisorRoot(process.env), "beeline", "connect", `${agentPubkey}.env`);
24499
- await mkdir15(dirname11(path), { recursive: true, mode: 448 });
24922
+ const path = resolve23(defaultSupervisorRoot(process.env), "beeline", "connect", `${agentPubkey}.env`);
24923
+ await mkdir16(dirname12(path), { recursive: true, mode: 448 });
24500
24924
  const contents = Object.entries(values).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
24501
24925
  await writeFile11(path, `${contents}
24502
24926
  `, { mode: 384 });
24503
- await chmod5(path, 384);
24927
+ await chmod6(path, 384);
24504
24928
  return path;
24505
24929
  }
24506
24930
  async function runInstalledFinish(binary, grantPath) {
@@ -24561,13 +24985,16 @@ async function runConnectWizard(code, fetchImpl, eventSubscriptions, accessPolic
24561
24985
  await finishConnectedAgentPairing(baseUrl, pairingCode, grant.workspace_joined, eventSubscriptions, fetchImpl);
24562
24986
  const installedRelease = await brassSpinner("Installing the Beeline daemon\u2026", () => installCurrentRelease(fetchImpl), (release) => `Installed Beeline helper ${release.version}`);
24563
24987
  const llmEnvFile = await writeProviderEnv(selection, grant.agent_pubkey);
24564
- const grantPath = resolve22(defaultSupervisorRoot(process.env), "beeline", "connect", `grant-${process.pid}-${Date.now()}.json`);
24988
+ const grantPath = resolve23(defaultSupervisorRoot(process.env), "beeline", "connect", `grant-${process.pid}-${Date.now()}.json`);
24565
24989
  await writePrivateJson(grantPath, {
24566
24990
  agentSecretKey: grant.agent_secret_key,
24567
24991
  bodySecretKey: grant.body_secret_key,
24568
24992
  agentName: grant.agent_name,
24569
24993
  harness: grant.harness,
24570
24994
  model: grant.model,
24995
+ // The server echoes back what it stored; the wizard's own answer is the
24996
+ // fallback for a server too old to carry the effort through.
24997
+ ...grant.effort ?? selection.effort ? { effort: grant.effort ?? selection.effort } : {},
24571
24998
  soul: grant.soul,
24572
24999
  workspaceId: grant.workspace_id,
24573
25000
  workspaceName: grant.workspace_name,
@@ -24623,7 +25050,7 @@ function isDevicePairingGrant(value) {
24623
25050
  } catch {
24624
25051
  return false;
24625
25052
  }
24626
- return typeof grant.agentSecretKey === "string" && /^[0-9a-f]{64}$/.test(grant.agentSecretKey) && typeof grant.bodySecretKey === "string" && /^[0-9a-f]{64}$/.test(grant.bodySecretKey) && typeof grant.agentName === "string" && CONNECT_HARNESSES.includes(grant.harness) && typeof grant.model === "string" && typeof grant.soul === "string" && typeof grant.workspaceId === "string" && typeof grant.workspaceName === "string" && typeof grant.pairedBy === "string" && /^[0-9a-f]{64}$/.test(grant.pairedBy) && typeof grant.monolithBaseUrl === "string" && grant.monolithBaseUrl === monolithOrigin && /^https?:$/.test(new URL(monolithOrigin).protocol) && typeof grant.daemonExchangeToken === "string" && /^bde_[A-Za-z0-9_-]{43}$/.test(grant.daemonExchangeToken);
25053
+ return typeof grant.agentSecretKey === "string" && /^[0-9a-f]{64}$/.test(grant.agentSecretKey) && typeof grant.bodySecretKey === "string" && /^[0-9a-f]{64}$/.test(grant.bodySecretKey) && typeof grant.agentName === "string" && CONNECT_HARNESSES.includes(grant.harness) && typeof grant.model === "string" && (grant.effort === void 0 || typeof grant.effort === "string") && typeof grant.soul === "string" && typeof grant.workspaceId === "string" && typeof grant.workspaceName === "string" && typeof grant.pairedBy === "string" && /^[0-9a-f]{64}$/.test(grant.pairedBy) && typeof grant.monolithBaseUrl === "string" && grant.monolithBaseUrl === monolithOrigin && /^https?:$/.test(new URL(monolithOrigin).protocol) && typeof grant.daemonExchangeToken === "string" && /^bde_[A-Za-z0-9_-]{43}$/.test(grant.daemonExchangeToken);
24627
25054
  }
24628
25055
  function connectPlainFailure(error) {
24629
25056
  const raw = error instanceof Error ? error.message : String(error);
@@ -24643,18 +25070,18 @@ async function runConnectFinishCommand(path) {
24643
25070
  throw new Error("connect-finish may run only from the canonical installed Beeline launcher");
24644
25071
  }
24645
25072
  try {
24646
- const grant = JSON.parse(await readFile10(resolve22(path), "utf8"));
25073
+ const grant = JSON.parse(await readFile11(resolve23(path), "utf8"));
24647
25074
  if (!isDevicePairingGrant(grant))
24648
25075
  throw new Error("device connection grant is invalid");
24649
25076
  const connected = await completeDevicePairing(grant);
24650
- await unlink2(resolve22(path));
24651
- const providerEnv = grant.llmEnvFile ? await readFile10(grant.llmEnvFile, "utf8").catch(() => "") : "";
25077
+ await unlink2(resolve23(path));
25078
+ const providerEnv = grant.llmEnvFile ? await readFile11(grant.llmEnvFile, "utf8").catch(() => "") : "";
24652
25079
  const apiKey = (/^OPENROUTER_API_KEY=(\S+)/m.exec(providerEnv)?.[1] ?? "").replace(/^["']|["']$/g, "");
24653
25080
  const model = openRouterModelId(grant.model, { OPENROUTER_API_KEY: apiKey });
24654
25081
  if (model) {
24655
25082
  const decision2 = await resolveOpenRouterRouting({
24656
25083
  model,
24657
- cacheDir: openRouterRoutingCacheDir(dirname11(connected.configPath)),
25084
+ cacheDir: openRouterRoutingCacheDir(dirname12(connected.configPath)),
24658
25085
  ...apiKey ? { apiKey } : {},
24659
25086
  probeTimeoutMs: 1e4
24660
25087
  });
@@ -24676,24 +25103,24 @@ init_self_update_manifest();
24676
25103
  // apps/body/dist/managed-update.js
24677
25104
  init_self_update();
24678
25105
  import { spawn as spawn6 } from "node:child_process";
24679
- import { mkdir as mkdir17, rm as rm6, stat as stat2, writeFile as writeFile13 } from "node:fs/promises";
24680
- import { dirname as dirname13, resolve as resolve24 } from "node:path";
25106
+ import { mkdir as mkdir18, rm as rm7, stat as stat3, writeFile as writeFile13 } from "node:fs/promises";
25107
+ import { dirname as dirname14, resolve as resolve25 } from "node:path";
24681
25108
 
24682
25109
  // apps/body/dist/update-rollback-alert.js
24683
- import { mkdir as mkdir16, readFile as readFile11, rename as rename4, unlink as unlink3, writeFile as writeFile12 } from "node:fs/promises";
24684
- import { dirname as dirname12, resolve as resolve23 } from "node:path";
25110
+ import { mkdir as mkdir17, readFile as readFile12, rename as rename5, unlink as unlink3, writeFile as writeFile12 } from "node:fs/promises";
25111
+ import { dirname as dirname13, resolve as resolve24 } from "node:path";
24685
25112
  var REPORT_INTERVAL_MS = 60 * 60 * 1e3;
24686
25113
  var lastLogged = /* @__PURE__ */ new Map();
24687
25114
  function updateRollbackAlertPath(runtimeDir) {
24688
- return resolve23(runtimeDir, "update-rollback-alert.json");
25115
+ return resolve24(runtimeDir, "update-rollback-alert.json");
24689
25116
  }
24690
25117
  async function writeAlert(runtimeDir, alert) {
24691
25118
  const path = updateRollbackAlertPath(runtimeDir);
24692
25119
  const staged = `${path}.${process.pid}.tmp`;
24693
- await mkdir16(dirname12(path), { recursive: true });
25120
+ await mkdir17(dirname13(path), { recursive: true });
24694
25121
  await writeFile12(staged, `${JSON.stringify(alert, null, 2)}
24695
25122
  `, { mode: 384 });
24696
- await rename4(staged, path);
25123
+ await rename5(staged, path);
24697
25124
  }
24698
25125
  async function queueUpdateRollbackAlert(runtimeDir, releaseId, now2 = Date.now()) {
24699
25126
  const existing = await readUpdateRollbackAlert(runtimeDir);
@@ -24703,7 +25130,7 @@ async function queueUpdateRollbackAlert(runtimeDir, releaseId, now2 = Date.now()
24703
25130
  }
24704
25131
  async function readUpdateRollbackAlert(runtimeDir) {
24705
25132
  try {
24706
- const value = JSON.parse(await readFile11(updateRollbackAlertPath(runtimeDir), "utf8"));
25133
+ const value = JSON.parse(await readFile12(updateRollbackAlertPath(runtimeDir), "utf8"));
24707
25134
  if (value.version !== 1 || typeof value.releaseId !== "string")
24708
25135
  return void 0;
24709
25136
  return value;
@@ -24754,22 +25181,22 @@ var LOCK_STALE_MS = UPDATE_WORKER_DEADLINE_MS + 5 * 6e4;
24754
25181
  var DEFAULT_UPDATE_INITIAL_DELAY_MS = 0;
24755
25182
  async function withInstallLock(layout, work, options = {}) {
24756
25183
  const now2 = options.now ?? Date.now;
24757
- const lock = resolve24(layout.releasesRoot, ".state", "install.lock");
25184
+ const lock = resolve25(layout.releasesRoot, ".state", "install.lock");
24758
25185
  const deadline = now2() + (options.waitMs ?? 1e4);
24759
- await mkdir17(dirname13(lock), { recursive: true });
25186
+ await mkdir18(dirname14(lock), { recursive: true });
24760
25187
  for (; ; ) {
24761
25188
  try {
24762
- await mkdir17(lock);
24763
- await writeFile13(resolve24(lock, "owner"), `${process.pid}
25189
+ await mkdir18(lock);
25190
+ await writeFile13(resolve25(lock, "owner"), `${process.pid}
24764
25191
  ${now2()}
24765
25192
  `, "utf8");
24766
25193
  break;
24767
25194
  } catch (error) {
24768
25195
  if (error.code !== "EEXIST")
24769
25196
  throw error;
24770
- const age = now2() - await stat2(lock).then((value) => value.mtimeMs).catch(() => now2());
25197
+ const age = now2() - await stat3(lock).then((value) => value.mtimeMs).catch(() => now2());
24771
25198
  if (age > LOCK_STALE_MS) {
24772
- await rm6(lock, { recursive: true, force: true });
25199
+ await rm7(lock, { recursive: true, force: true });
24773
25200
  continue;
24774
25201
  }
24775
25202
  if (now2() >= deadline)
@@ -24780,7 +25207,7 @@ ${now2()}
24780
25207
  try {
24781
25208
  return await work();
24782
25209
  } finally {
24783
- await rm6(lock, { recursive: true, force: true });
25210
+ await rm7(lock, { recursive: true, force: true });
24784
25211
  }
24785
25212
  }
24786
25213
  var ManagedUpdateHandoff = class _ManagedUpdateHandoff {
@@ -24883,7 +25310,7 @@ var ManagedUpdateHandoff = class _ManagedUpdateHandoff {
24883
25310
  if (!attempt || attempt.releaseId !== desiredRelease || attempt.status !== "pending") {
24884
25311
  const from = await readInstalledBundleIdentity({
24885
25312
  ...this.#layout,
24886
- libDir: resolve24(this.#layout.releasesRoot, this.#loadedRelease)
25313
+ libDir: resolve25(this.#layout.releasesRoot, this.#loadedRelease)
24887
25314
  }).catch(() => void 0) ?? {};
24888
25315
  const to = await readInstalledBundleIdentity(this.#layout).catch(() => void 0) ?? {};
24889
25316
  const record2 = {
@@ -25170,7 +25597,7 @@ async function proveLoadedReleaseReady(layout, runtimeDir, loadedRelease, option
25170
25597
  });
25171
25598
  if (!accepted)
25172
25599
  return false;
25173
- await writeFile13(resolve24(runtimeDir, "daemon-ready.json"), `${JSON.stringify({
25600
+ await writeFile13(resolve25(runtimeDir, "daemon-ready.json"), `${JSON.stringify({
25174
25601
  readyAt: (options.now ?? Date.now)(),
25175
25602
  loadedRelease,
25176
25603
  functionalProof: options.functionalProof
@@ -25398,16 +25825,16 @@ async function runUpdateCommand(args) {
25398
25825
  init_self_update();
25399
25826
 
25400
25827
  // apps/body/dist/daemon-failure.js
25401
- import { mkdir as mkdir18, readFile as readFile12, rename as rename5, rm as rm7, writeFile as writeFile14 } from "node:fs/promises";
25402
- import { dirname as dirname14, resolve as resolve25 } from "node:path";
25828
+ import { mkdir as mkdir19, readFile as readFile13, rename as rename6, rm as rm8, writeFile as writeFile14 } from "node:fs/promises";
25829
+ import { dirname as dirname15, resolve as resolve26 } from "node:path";
25403
25830
  var DAEMON_FAILURE_LIMIT = 3;
25404
25831
  var DAEMON_FAILURE_WINDOW_MS = 5 * 6e4;
25405
25832
  function daemonFailurePath(runtimeDir) {
25406
- return resolve25(runtimeDir, "daemon-distress.json");
25833
+ return resolve26(runtimeDir, "daemon-distress.json");
25407
25834
  }
25408
25835
  async function readFailureRecord(runtimeDir) {
25409
25836
  try {
25410
- const value = JSON.parse(await readFile12(daemonFailurePath(runtimeDir), "utf8"));
25837
+ const value = JSON.parse(await readFile13(daemonFailurePath(runtimeDir), "utf8"));
25411
25838
  if (value.version !== 1 || !Array.isArray(value.failures) || value.failures.some((failure) => typeof failure !== "number") || typeof value.lastError !== "string") {
25412
25839
  return void 0;
25413
25840
  }
@@ -25419,10 +25846,10 @@ async function readFailureRecord(runtimeDir) {
25419
25846
  async function writeFailureRecord(runtimeDir, record2) {
25420
25847
  const path = daemonFailurePath(runtimeDir);
25421
25848
  const staged = `${path}.${process.pid}.tmp`;
25422
- await mkdir18(dirname14(path), { recursive: true, mode: 448 });
25849
+ await mkdir19(dirname15(path), { recursive: true, mode: 448 });
25423
25850
  await writeFile14(staged, `${JSON.stringify(record2, null, 2)}
25424
25851
  `, { mode: 384 });
25425
- await rename5(staged, path);
25852
+ await rename6(staged, path);
25426
25853
  }
25427
25854
  async function recordDaemonStartFailure(runtimeDir, error, now2 = Date.now()) {
25428
25855
  const prior = await readFailureRecord(runtimeDir);
@@ -25438,13 +25865,13 @@ async function recordDaemonStartFailure(runtimeDir, error, now2 = Date.now()) {
25438
25865
  return { distressed, count: failures.length, path: daemonFailurePath(runtimeDir) };
25439
25866
  }
25440
25867
  async function clearDaemonStartFailures(runtimeDir) {
25441
- await rm7(daemonFailurePath(runtimeDir), { force: true });
25868
+ await rm8(daemonFailurePath(runtimeDir), { force: true });
25442
25869
  }
25443
25870
 
25444
25871
  // apps/body/dist/update-functional-probe.js
25445
- import { mkdir as mkdir19, rm as rm8 } from "node:fs/promises";
25872
+ import { mkdir as mkdir20, rm as rm9 } from "node:fs/promises";
25446
25873
  import { homedir as homedir10 } from "node:os";
25447
- import { resolve as resolve26 } from "node:path";
25874
+ import { resolve as resolve27 } from "node:path";
25448
25875
  var UPDATE_PROBE_SESSION_TIMEOUT_MS = 1e4;
25449
25876
  var UPDATE_PROBE_SESSION_OPEN_TIMEOUT_MS = 2e4;
25450
25877
  var UPDATE_PROBE_TURN_TIMEOUT_MS = 45e3;
@@ -25538,11 +25965,11 @@ async function runUpdateFunctionalProbe(input) {
25538
25965
  modelAnswerReason: `${detail} (the current release has the same host sandbox failure)`
25539
25966
  };
25540
25967
  }
25541
- const root = input.probeRoot ?? resolve26(input.runtimeDir, "update-functional-probe");
25542
- const cwd = resolve26(root, "checkout");
25543
- const homeRoot = resolve26(root, "agent-home");
25544
- await rm8(root, { recursive: true, force: true });
25545
- await mkdir19(cwd, { recursive: true, mode: 448 });
25968
+ const root = input.probeRoot ?? resolve27(input.runtimeDir, "update-functional-probe");
25969
+ const cwd = resolve27(root, "checkout");
25970
+ const homeRoot = resolve27(root, "agent-home");
25971
+ await rm9(root, { recursive: true, force: true });
25972
+ await mkdir20(cwd, { recursive: true, mode: 448 });
25546
25973
  let client;
25547
25974
  try {
25548
25975
  const agentEnv = {
@@ -25572,7 +25999,7 @@ async function runUpdateFunctionalProbe(input) {
25572
25999
  const { stateDirs, tmpDir } = harnessStateDirsFromEnv(agentEnv);
25573
26000
  const operatorHome = input.config.operatorHome ?? homedir10();
25574
26001
  const homeStateDirs = harnessHomeStateDirs(command, agentEnv.HOME ?? operatorHome);
25575
- await Promise.all(homeStateDirs.map((dir) => mkdir19(dir, { recursive: true })));
26002
+ await Promise.all(homeStateDirs.map((dir) => mkdir20(dir, { recursive: true })));
25576
26003
  spawnCommand = wrapAgentCommand({
25577
26004
  bwrapPath: input.config.bwrapPath,
25578
26005
  spec: {
@@ -25716,13 +26143,13 @@ async function runUpdateFunctionalProbe(input) {
25716
26143
  };
25717
26144
  } finally {
25718
26145
  await client?.stop().catch(() => void 0);
25719
- await rm8(root, { recursive: true, force: true }).catch(() => void 0);
26146
+ await rm9(root, { recursive: true, force: true }).catch(() => void 0);
25720
26147
  }
25721
26148
  }
25722
26149
 
25723
26150
  // apps/body/dist/current-release-probe.js
25724
26151
  import { spawn as spawn7 } from "node:child_process";
25725
- import { dirname as dirname15, join as join9 } from "node:path";
26152
+ import { dirname as dirname16, join as join10 } from "node:path";
25726
26153
  init_self_update();
25727
26154
  var CURRENT_RELEASE_PROBE_TIMEOUT_MS = 12e4;
25728
26155
  var UPDATE_PROBE_COMMAND = "update-probe";
@@ -25765,13 +26192,13 @@ function outcomeFromReport(report) {
25765
26192
  }
25766
26193
  }
25767
26194
  async function probeReleaseInSubprocess(input) {
25768
- const bundleDir = join9(input.layout.releasesRoot, input.releaseId);
26195
+ const bundleDir = join10(input.layout.releasesRoot, input.releaseId);
25769
26196
  const entrypoint = await resolveBundleEntrypoint(bundleDir);
25770
26197
  if (!entrypoint) {
25771
26198
  return { kind: "unavailable", reason: `release ${input.releaseId} has no runnable CLI entrypoint` };
25772
26199
  }
25773
26200
  const timeoutMs = input.timeoutMs ?? CURRENT_RELEASE_PROBE_TIMEOUT_MS;
25774
- return new Promise((resolve30) => {
26201
+ return new Promise((resolve31) => {
25775
26202
  const child = spawn7(input.execPath ?? process.execPath, [entrypoint, UPDATE_PROBE_COMMAND, "--config", input.runtimeConfigPath], { env: input.env ?? process.env, stdio: ["ignore", "pipe", "pipe"] });
25776
26203
  let stdout6 = "";
25777
26204
  let stderr = "";
@@ -25781,7 +26208,7 @@ async function probeReleaseInSubprocess(input) {
25781
26208
  return;
25782
26209
  settled = true;
25783
26210
  clearTimeout(timer);
25784
- resolve30(outcome);
26211
+ resolve31(outcome);
25785
26212
  };
25786
26213
  const timer = setTimeout(() => {
25787
26214
  child.kill("SIGKILL");
@@ -25828,7 +26255,7 @@ async function runUpdateProbeCommand(args, options = {}) {
25828
26255
  const runtime = await readRuntimeRecord(configPath);
25829
26256
  const agent = runtimeAgentCommand(runtime);
25830
26257
  const config = loadBodyConfig({
25831
- workspaceRoot: join9(dirname15(configPath), "workspace"),
26258
+ workspaceRoot: join10(dirname16(configPath), "workspace"),
25832
26259
  llmEnvFile: runtime.llmEnvFile,
25833
26260
  env: { ...env, BUZZ_AGENT_BIN: agent.command, BUZZ_DEV_MCP_BIN: runtime.mcpBinary },
25834
26261
  agent
@@ -25846,7 +26273,7 @@ async function runUpdateProbeCommand(args, options = {}) {
25846
26273
  }
25847
26274
  const layout = beelineInstallLayout(env);
25848
26275
  const releaseId = (layout && await activeReleaseId(layout).catch(() => void 0)) ?? "unknown";
25849
- const runtimeDir = dirname15(configPath);
26276
+ const runtimeDir = dirname16(configPath);
25850
26277
  const outcome = await probeOutcome(() => (options.probe ?? runUpdateFunctionalProbe)({
25851
26278
  config,
25852
26279
  runtimeDir,
@@ -25854,15 +26281,15 @@ async function runUpdateProbeCommand(args, options = {}) {
25854
26281
  sandboxRequired: runtime.sandbox !== "off",
25855
26282
  sandboxUnavailableDetail: sandbox.advisory,
25856
26283
  // The successor's probe still holds `<runtimeDir>/update-functional-probe`.
25857
- probeRoot: join9(runtimeDir, "current-release-probe")
26284
+ probeRoot: join10(runtimeDir, "current-release-probe")
25858
26285
  }));
25859
26286
  const report = outcome.kind === "served" ? { probe: "served" } : outcome.kind === "refused" ? { probe: "refused", status: outcome.status, reason: outcome.reason } : outcome.kind === "sandbox-unavailable" ? { probe: "sandbox-unavailable", reason: outcome.reason } : { probe: "failed", reason: outcome.reason };
25860
26287
  write(JSON.stringify(report));
25861
26288
  }
25862
26289
 
25863
26290
  // apps/body/dist/release-status.js
25864
- import { readFile as readFile13, readdir as readdir5, rename as rename6, writeFile as writeFile15 } from "node:fs/promises";
25865
- import { resolve as resolve27 } from "node:path";
26291
+ import { readFile as readFile14, readdir as readdir6, rename as rename7, writeFile as writeFile15 } from "node:fs/promises";
26292
+ import { resolve as resolve28 } from "node:path";
25866
26293
  var DAEMON_RELEASE_STATUS_FILE = "release-status.json";
25867
26294
  var RELEASE_VERSION = /^v\d+\.\d+\.\d+$/;
25868
26295
  var SOURCE_SHA = /^[0-9a-f]{7,64}$/;
@@ -25879,17 +26306,17 @@ async function writeDaemonReleaseStatus(runtimeDir, agentPubkey, identity, optio
25879
26306
  pid: options.pid ?? process.pid,
25880
26307
  readyAt: (options.now?.() ?? /* @__PURE__ */ new Date()).toISOString()
25881
26308
  };
25882
- const target = resolve27(runtimeDir, DAEMON_RELEASE_STATUS_FILE);
26309
+ const target = resolve28(runtimeDir, DAEMON_RELEASE_STATUS_FILE);
25883
26310
  const temporary = `${target}.${status.pid}.tmp`;
25884
26311
  await writeFile15(temporary, `${JSON.stringify(status, null, 2)}
25885
26312
  `, { mode: 384 });
25886
- await rename6(temporary, target);
26313
+ await rename7(temporary, target);
25887
26314
  return status;
25888
26315
  }
25889
26316
 
25890
26317
  // apps/body/dist/scratch-sweep.js
25891
- import { lstat as lstat3, readdir as readdir6, rmdir, unlink as unlink4 } from "node:fs/promises";
25892
- import { resolve as resolve28 } from "node:path";
26318
+ import { lstat as lstat4, readdir as readdir7, rmdir, unlink as unlink4 } from "node:fs/promises";
26319
+ import { resolve as resolve29 } from "node:path";
25893
26320
  var DEFAULT_SCRATCH_TTL_HOURS = 72;
25894
26321
  var NEVER_SWEEP_SUBDIR_NAMES = new Set(HOME_SUBDIRS.filter((name) => name !== "tmp"));
25895
26322
  function scratchTtlMs(env = process.env) {
@@ -25898,10 +26325,10 @@ function scratchTtlMs(env = process.env) {
25898
26325
  return (Number.isFinite(hours) && hours > 0 ? hours : DEFAULT_SCRATCH_TTL_HOURS) * 60 * 60 * 1e3;
25899
26326
  }
25900
26327
  async function discoverAttachScratchRoots(runtimeDir) {
25901
- const roomsDir = resolve28(runtimeDir, "rooms");
26328
+ const roomsDir = resolve29(runtimeDir, "rooms");
25902
26329
  let entries;
25903
26330
  try {
25904
- entries = await readdir6(roomsDir, { withFileTypes: true });
26331
+ entries = await readdir7(roomsDir, { withFileTypes: true });
25905
26332
  } catch {
25906
26333
  return [];
25907
26334
  }
@@ -25909,8 +26336,8 @@ async function discoverAttachScratchRoots(runtimeDir) {
25909
26336
  for (const entry of entries) {
25910
26337
  if (!entry.isDirectory())
25911
26338
  continue;
25912
- const home = resolve28(roomsDir, entry.name, "agent-home");
25913
- const stats = await lstat3(home).catch(() => void 0);
26339
+ const home = resolve29(roomsDir, entry.name, "agent-home");
26340
+ const stats = await lstat4(home).catch(() => void 0);
25914
26341
  if (stats?.isDirectory())
25915
26342
  roots.push(home);
25916
26343
  }
@@ -25919,7 +26346,7 @@ async function discoverAttachScratchRoots(runtimeDir) {
25919
26346
  async function removeStaleFiles(dir, cutoffMs, protectNamesHere) {
25920
26347
  let entries;
25921
26348
  try {
25922
- entries = await readdir6(dir, { withFileTypes: true });
26349
+ entries = await readdir7(dir, { withFileTypes: true });
25923
26350
  } catch {
25924
26351
  return { removedFiles: 0, removedBytes: 0 };
25925
26352
  }
@@ -25928,15 +26355,15 @@ async function removeStaleFiles(dir, cutoffMs, protectNamesHere) {
25928
26355
  for (const entry of entries) {
25929
26356
  if (protectNamesHere && NEVER_SWEEP_SUBDIR_NAMES.has(entry.name))
25930
26357
  continue;
25931
- const path = resolve28(dir, entry.name);
25932
- const stats = await lstat3(path).catch(() => void 0);
26358
+ const path = resolve29(dir, entry.name);
26359
+ const stats = await lstat4(path).catch(() => void 0);
25933
26360
  if (!stats || stats.isSymbolicLink())
25934
26361
  continue;
25935
26362
  if (stats.isDirectory()) {
25936
26363
  const nested = await removeStaleFiles(path, cutoffMs, false);
25937
26364
  removedFiles += nested.removedFiles;
25938
26365
  removedBytes += nested.removedBytes;
25939
- const remaining = await readdir6(path).catch(() => void 0);
26366
+ const remaining = await readdir7(path).catch(() => void 0);
25940
26367
  if (remaining && remaining.length === 0)
25941
26368
  await rmdir(path).catch(() => void 0);
25942
26369
  continue;
@@ -25954,7 +26381,7 @@ async function sweepAttachScratchRoots(roots, ttlMs, now2 = Date.now()) {
25954
26381
  let removedFiles = 0;
25955
26382
  let removedBytes = 0;
25956
26383
  for (const root of roots) {
25957
- const stats = await lstat3(root).catch(() => void 0);
26384
+ const stats = await lstat4(root).catch(() => void 0);
25958
26385
  if (!stats?.isDirectory())
25959
26386
  continue;
25960
26387
  const result = await removeStaleFiles(root, cutoffMs, true);
@@ -26015,7 +26442,7 @@ var DaemonExitError = class extends Error {
26015
26442
  };
26016
26443
  async function runStoredDaemon(pathOrPointer) {
26017
26444
  const configPath = await resolveRuntimeConfigPath(pathOrPointer);
26018
- daemonFailureRuntimeDir = dirname16(configPath);
26445
+ daemonFailureRuntimeDir = dirname17(configPath);
26019
26446
  const accessMigration = await migrateRuntimeRecordAccessPolicy(configPath);
26020
26447
  let runtime = accessMigration.runtime;
26021
26448
  if (!runtime.transport) {
@@ -26027,7 +26454,7 @@ async function runStoredDaemon(pathOrPointer) {
26027
26454
  runtime = activated.runtime;
26028
26455
  const daemonApi = activated.client;
26029
26456
  const agent = runtimeAgentCommand(runtime);
26030
- await writeFile16(resolve29(dirname16(configPath), "daemon.pid"), `${process.pid}
26457
+ await writeFile16(resolve30(dirname17(configPath), "daemon.pid"), `${process.pid}
26031
26458
  `, { mode: 384 });
26032
26459
  const env = {
26033
26460
  ...process.env,
@@ -26035,7 +26462,7 @@ async function runStoredDaemon(pathOrPointer) {
26035
26462
  BUZZ_DEV_MCP_BIN: runtime.mcpBinary
26036
26463
  };
26037
26464
  const config = loadBodyConfig({
26038
- workspaceRoot: resolve29(dirname16(configPath), "workspace"),
26465
+ workspaceRoot: resolve30(dirname17(configPath), "workspace"),
26039
26466
  llmEnvFile: runtime.llmEnvFile,
26040
26467
  env,
26041
26468
  agent
@@ -26070,7 +26497,7 @@ async function runStoredDaemon(pathOrPointer) {
26070
26497
  const stop = () => controller.abort();
26071
26498
  process.once("SIGINT", stop);
26072
26499
  process.once("SIGTERM", stop);
26073
- const runtimeDir = dirname16(configPath);
26500
+ const runtimeDir = dirname17(configPath);
26074
26501
  const layout = beelineInstallLayout(process.env);
26075
26502
  const notifier = new SystemdNotifier();
26076
26503
  let rollbackAlertDrain;
@@ -26217,8 +26644,8 @@ async function runStoredDaemon(pathOrPointer) {
26217
26644
  } finally {
26218
26645
  clearInterval(scratchSweepTimer);
26219
26646
  await notifier.stopping(stoppingStatus).catch(() => void 0);
26220
- const pidPath = resolve29(dirname16(configPath), "daemon.pid");
26221
- const recorded = Number((await readFile14(pidPath, "utf8").catch(() => "")).trim());
26647
+ const pidPath = resolve30(dirname17(configPath), "daemon.pid");
26648
+ const recorded = Number((await readFile15(pidPath, "utf8").catch(() => "")).trim());
26222
26649
  if (recorded === process.pid) {
26223
26650
  await unlink5(pidPath).catch(() => void 0);
26224
26651
  }
@@ -26245,7 +26672,7 @@ async function main() {
26245
26672
  const roomId = roomFlag >= 0 ? args[roomFlag + 1] : void 0;
26246
26673
  if (!configPath || !roomId)
26247
26674
  throw new Error("corner-read-token requires --config and --room");
26248
- const activated = await activateDaemonTransport(resolve29(configPath));
26675
+ const activated = await activateDaemonTransport(resolve30(configPath));
26249
26676
  if (!activated)
26250
26677
  throw new Error("corner-read-token requires monolith transport");
26251
26678
  const credential = await activated.client.execute("getRoomGitHubToken", { roomId });
@@ -26294,14 +26721,14 @@ async function main() {
26294
26721
  const agentPubkey = agentFlag >= 0 ? args[agentFlag + 1] : void 0;
26295
26722
  if (!configPath && agentPubkey) {
26296
26723
  const configs = await findAgentRuntimeConfigPaths(process.env, process.cwd());
26297
- configPath = configs.find((candidate) => dirname16(candidate).endsWith(agentPubkey));
26724
+ configPath = configs.find((candidate) => dirname17(candidate).endsWith(agentPubkey));
26298
26725
  }
26299
26726
  if (!configPath && agentPubkey) {
26300
26727
  throw new DaemonExitError(`unknown agent ${agentPubkey}: no durable runtime exists; refusing systemd restart loop`, UNKNOWN_AGENT_EXIT_STATUS);
26301
26728
  }
26302
26729
  if (!configPath)
26303
26730
  throw new Error("daemon requires --config <runtime.json> or --agent <pubkey>");
26304
- await runStoredDaemon(resolve29(configPath));
26731
+ await runStoredDaemon(resolve30(configPath));
26305
26732
  return;
26306
26733
  }
26307
26734
  if (command === "update") {
@@ -26322,7 +26749,7 @@ async function main() {
26322
26749
  if (!agentPubkey)
26323
26750
  throw new Error("stop requires --agent <pubkey>");
26324
26751
  const configs = await findAgentRuntimeConfigPaths(process.env, process.cwd());
26325
- const configPath = configs.find((candidate) => dirname16(candidate).endsWith(agentPubkey));
26752
+ const configPath = configs.find((candidate) => dirname17(candidate).endsWith(agentPubkey));
26326
26753
  if (!configPath)
26327
26754
  throw new Error(`no stored runtime found for agent ${agentPubkey}`);
26328
26755
  const runtime = await readRuntimeRecord(configPath);