claude-use 9.17.0 → 9.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -30535,7 +30535,7 @@ function compile2(pattern, category, source, ordinal) {
30535
30535
  matches: isExact ? (name) => name === pattern : (name) => matcher(name)
30536
30536
  };
30537
30537
  }
30538
- function compileClassificationPatterns(defaults, overlay) {
30538
+ function compileClassificationPatterns(defaults, overlay2) {
30539
30539
  const compiled = [];
30540
30540
  let ordinal = 0;
30541
30541
  for (const category of CATEGORY_NAMES) {
@@ -30544,9 +30544,9 @@ function compileClassificationPatterns(defaults, overlay) {
30544
30544
  ordinal += 1;
30545
30545
  }
30546
30546
  }
30547
- if (overlay !== void 0) {
30547
+ if (overlay2 !== void 0) {
30548
30548
  for (const category of CATEGORY_NAMES) {
30549
- for (const pattern of overlay[category] ?? []) {
30549
+ for (const pattern of overlay2[category] ?? []) {
30550
30550
  compiled.push(compile2(pattern, category, "local", ordinal));
30551
30551
  ordinal += 1;
30552
30552
  }
@@ -30567,10 +30567,10 @@ function compareClassificationPatterns(a10, b) {
30567
30567
  return a10.ordinal - b.ordinal;
30568
30568
  }
30569
30569
  function loadClassification(paths) {
30570
- const overlay = readJson(paths.categoriesLocalFile, CategoryClassificationOverlaySchema);
30570
+ const overlay2 = readJson(paths.categoriesLocalFile, CategoryClassificationOverlaySchema);
30571
30571
  return {
30572
30572
  defaults: CategoryClassificationSchema.parse(categories_default_default),
30573
- ...overlay === void 0 ? {} : { overlay }
30573
+ ...overlay2 === void 0 ? {} : { overlay: overlay2 }
30574
30574
  };
30575
30575
  }
30576
30576
  function classifyEntries(names, options) {
@@ -33317,7 +33317,7 @@ var init_package = __esm({
33317
33317
  "package.json"() {
33318
33318
  package_default = {
33319
33319
  name: "claude-use",
33320
- version: "9.17.0",
33320
+ version: "9.19.0",
33321
33321
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
33322
33322
  license: "MIT",
33323
33323
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -34262,22 +34262,25 @@ function rankPool(input2) {
34262
34262
  return { ...candidate, feasible: true };
34263
34263
  }
34264
34264
  const drySpots = [];
34265
+ const dryAfterMs = [];
34265
34266
  if (fiveHour !== void 0 && pace !== void 0) {
34266
34267
  const runsDryInMs = fiveHour.remaining / pace;
34267
34268
  if (runsDryInMs < fiveHour.untilResetMs) {
34269
+ dryAfterMs.push(runsDryInMs);
34268
34270
  drySpots.push(`5h window would run dry in ${formatAge(runsDryInMs)}, before it resets in ${formatAge(fiveHour.untilResetMs)}`);
34269
34271
  }
34270
34272
  }
34271
34273
  if (sevenDay !== void 0 && sevenDayBurn !== void 0) {
34272
34274
  const runsDryInMs = sevenDay.remaining / sevenDayBurn;
34273
34275
  if (runsDryInMs < sevenDay.untilResetMs) {
34276
+ dryAfterMs.push(runsDryInMs);
34274
34277
  drySpots.push(`7d window would run dry in ${formatAge(runsDryInMs)}, before it resets in ${formatAge(sevenDay.untilResetMs)}`);
34275
34278
  }
34276
34279
  }
34277
34280
  if (drySpots.length === 0) {
34278
34281
  return { ...candidate, feasible: true };
34279
34282
  }
34280
- return { ...candidate, feasible: false, reasons: [...drySpots, ...candidate.reasons] };
34283
+ return { ...candidate, feasible: false, runsDryAtMs: nowMs + Math.min(...dryAfterMs), reasons: [...drySpots, ...candidate.reasons] };
34281
34284
  });
34282
34285
  const ordered = input2.preference === "listed" ? [...candidates] : [...candidates].sort(
34283
34286
  (left, right) => CLASS_ORDER[left.class] - CLASS_ORDER[right.class] || Number(left.policyDemoted ?? false) - Number(right.policyDemoted ?? false) || Number(right.feasible) - Number(left.feasible) || (right.headroom ?? 1) - (left.headroom ?? 1) || (right.score ?? 0) - (left.score ?? 0) || left.identity.localeCompare(right.identity)
@@ -34299,11 +34302,13 @@ function rankPool(input2) {
34299
34302
  const pick2 = ordered.find((candidate) => candidate.class !== "ineligible");
34300
34303
  const returns = ordered.flatMap((candidate) => candidate.blockedUntilMs === void 0 ? [] : [{ identity: candidate.identity, atMs: candidate.blockedUntilMs }]);
34301
34304
  const earliestReturn = returns.length === 0 ? void 0 : returns.reduce((soonest, entry) => entry.atMs < soonest.atMs ? entry : soonest);
34305
+ const holdForReturn = pick2?.runsDryAtMs === void 0 ? void 0 : returns.filter((entry) => entry.atMs < (pick2.runsDryAtMs ?? 0)).reduce((soonest, entry) => soonest === void 0 || entry.atMs < soonest.atMs ? entry : soonest, void 0);
34302
34306
  return {
34303
34307
  candidates: ordered,
34304
34308
  ...pick2 === void 0 ? { ...earliestReturn === void 0 ? {} : { earliestReturn } } : { pick: pick2 },
34305
34309
  ...movedOff === void 0 || pick2 === void 0 ? {} : { movedOff },
34306
- ...pick2?.planReturnsAtMs === void 0 ? {} : { planReturn: { identity: pick2.identity, atMs: pick2.planReturnsAtMs } }
34310
+ ...pick2?.planReturnsAtMs === void 0 ? {} : { planReturn: { identity: pick2.identity, atMs: pick2.planReturnsAtMs } },
34311
+ ...holdForReturn === void 0 ? {} : { holdForReturn }
34307
34312
  };
34308
34313
  }
34309
34314
  var MS_PER_SECOND4, MS_PER_HOUR2, HOURS_PER_DAY2, FIVE_HOURS, PROMPT_CACHE_TTL_HOURS, PERCENT, SEVEN_DAYS, FIVE_HOUR_WINDOW_MS, SEVEN_DAY_WINDOW_MS, PROMPT_CACHE_TTL_MS, CLASS_ORDER;
@@ -61293,7 +61298,7 @@ request.on("error", (error) => finish(failed, (error.code ? error.code + ": " :
61293
61298
  // src/frontdoor/trust.ts
61294
61299
  function resolveTrustBundle(params) {
61295
61300
  const { caCertFile, bundlesDir, variable, inherited, fs: fs22 } = params;
61296
- if (inherited === void 0 || inherited === "" || import_node_path32.default.resolve(inherited) === import_node_path32.default.resolve(caCertFile)) {
61301
+ if (inherited === void 0 || inherited === "" || import_node_path34.default.resolve(inherited) === import_node_path34.default.resolve(caCertFile)) {
61297
61302
  return { path: caCertFile };
61298
61303
  }
61299
61304
  const caPem = fs22.readFileUtf8(caCertFile);
@@ -61311,19 +61316,19 @@ function resolveTrustBundle(params) {
61311
61316
  }
61312
61317
  const combined = `${inheritedPem.trimEnd()}
61313
61318
  ${caPem}`;
61314
- const bundle = import_node_path32.default.join(bundlesDir, `${(0, import_node_crypto11.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
61319
+ const bundle = import_node_path34.default.join(bundlesDir, `${(0, import_node_crypto11.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
61315
61320
  if (!fs22.exists(bundle)) {
61316
61321
  fs22.mkdirp(bundlesDir);
61317
61322
  fs22.writeFileAtomic(bundle, combined);
61318
61323
  }
61319
61324
  return { path: bundle };
61320
61325
  }
61321
- var import_node_crypto11, import_node_path32, BUNDLE_NAME_HEX_DIGITS;
61326
+ var import_node_crypto11, import_node_path34, BUNDLE_NAME_HEX_DIGITS;
61322
61327
  var init_trust = __esm({
61323
61328
  "src/frontdoor/trust.ts"() {
61324
61329
  "use strict";
61325
61330
  import_node_crypto11 = require("node:crypto");
61326
- import_node_path32 = __toESM(require("node:path"), 1);
61331
+ import_node_path34 = __toESM(require("node:path"), 1);
61327
61332
  BUNDLE_NAME_HEX_DIGITS = 16;
61328
61333
  }
61329
61334
  });
@@ -61341,7 +61346,7 @@ function realEnsurePorts(paths, spawnDaemon) {
61341
61346
  process.kill(pid, "SIGTERM");
61342
61347
  },
61343
61348
  // Read fresh for each probe: a replacement supervisor may have regenerated an unparseable CA, and the probe must trust exactly what the serving door's leaf chains to.
61344
- verifyListener: (port) => probeFrontDoorSync(port, import_node_fs12.default.readFileSync(paths.frontdoorCaCertFile, "utf8"))
61349
+ verifyListener: (port) => probeFrontDoorSync(port, import_node_fs13.default.readFileSync(paths.frontdoorCaCertFile, "utf8"))
61345
61350
  };
61346
61351
  }
61347
61352
  function realRestartFrontDoor(paths, spawnDaemon) {
@@ -61365,21 +61370,21 @@ function realFrontDoorPort(paths, spawnDaemon) {
61365
61370
  }
61366
61371
  };
61367
61372
  }
61368
- var import_node_fs12, realTrustBundleFs;
61373
+ var import_node_fs13, realTrustBundleFs;
61369
61374
  var init_realFrontDoorPort = __esm({
61370
61375
  "src/frontdoor/realFrontDoorPort.ts"() {
61371
61376
  "use strict";
61372
- import_node_fs12 = __toESM(require("node:fs"), 1);
61377
+ import_node_fs13 = __toESM(require("node:fs"), 1);
61373
61378
  init_realPorts();
61374
61379
  init_ensure2();
61375
61380
  init_state2();
61376
61381
  init_probe();
61377
61382
  init_trust();
61378
61383
  realTrustBundleFs = {
61379
- readFileUtf8: (file2) => import_node_fs12.default.readFileSync(file2, "utf8"),
61380
- exists: (file2) => import_node_fs12.default.existsSync(file2),
61384
+ readFileUtf8: (file2) => import_node_fs13.default.readFileSync(file2, "utf8"),
61385
+ exists: (file2) => import_node_fs13.default.existsSync(file2),
61381
61386
  mkdirp: (dir) => {
61382
- import_node_fs12.default.mkdirSync(dir, { recursive: true });
61387
+ import_node_fs13.default.mkdirSync(dir, { recursive: true });
61383
61388
  },
61384
61389
  writeFileAtomic: (file2, contents) => {
61385
61390
  realFarmFs.writeFilePrivate(file2, contents);
@@ -61511,10 +61516,10 @@ async function downloadAndInstall(ports, asset, target) {
61511
61516
  const tempDir = ports.fs.mkdtemp();
61512
61517
  try {
61513
61518
  const assetUrl = `${DOWNLOAD_BASE_URL}/${asset}`;
61514
- ports.fs.writeFileBytes(import_node_path33.default.join(tempDir, asset), await mustDownload(ports.http, assetUrl));
61515
- ports.fs.writeFileUtf8(import_node_path33.default.join(tempDir, `${asset}.sha256`), Buffer.from(await mustDownload(ports.http, `${assetUrl}.sha256`)).toString("utf8"));
61516
- const downloaded = ports.fs.readFileBytes(import_node_path33.default.join(tempDir, asset));
61517
- const sidecar = ports.fs.readFileUtf8(import_node_path33.default.join(tempDir, `${asset}.sha256`));
61519
+ ports.fs.writeFileBytes(import_node_path35.default.join(tempDir, asset), await mustDownload(ports.http, assetUrl));
61520
+ ports.fs.writeFileUtf8(import_node_path35.default.join(tempDir, `${asset}.sha256`), Buffer.from(await mustDownload(ports.http, `${assetUrl}.sha256`)).toString("utf8"));
61521
+ const downloaded = ports.fs.readFileBytes(import_node_path35.default.join(tempDir, asset));
61522
+ const sidecar = ports.fs.readFileUtf8(import_node_path35.default.join(tempDir, `${asset}.sha256`));
61518
61523
  if (downloaded === void 0 || sidecar === void 0) {
61519
61524
  throw new UpdateDownloadError(`the downloaded files for ${asset} are missing from ${tempDir}`);
61520
61525
  }
@@ -61523,7 +61528,7 @@ async function downloadAndInstall(ports, asset, target) {
61523
61528
  if (expected === void 0 || expected !== actual) {
61524
61529
  throw new UpdateDownloadError(`checksum mismatch for ${asset} (expected ${expected ?? "(none)"}, got ${actual})`);
61525
61530
  }
61526
- const tempBinary = import_node_path33.default.join(import_node_path33.default.dirname(target), `.${import_node_path33.default.basename(target)}.${String(process.pid)}.${(0, import_node_crypto12.randomUUID)()}.tmp`);
61531
+ const tempBinary = import_node_path35.default.join(import_node_path35.default.dirname(target), `.${import_node_path35.default.basename(target)}.${String(process.pid)}.${(0, import_node_crypto12.randomUUID)()}.tmp`);
61527
61532
  ports.fs.writeFileBytes(tempBinary, downloaded);
61528
61533
  try {
61529
61534
  ports.fs.chmod(tempBinary, EXECUTABLE_MODE);
@@ -61570,12 +61575,12 @@ async function runSelfUpdate(ports, options) {
61570
61575
  }
61571
61576
  return { current: options.currentVersion, latest, action: "updated" };
61572
61577
  }
61573
- var import_node_crypto12, import_node_path33, LATEST_RELEASE_URL, DOWNLOAD_BASE_URL, MACOS_X64_NOTE, BREW_PREFIXES, EXECUTABLE_MODE, UpdateChannelError, UpdateConflictError, UpdateDownloadError;
61578
+ var import_node_crypto12, import_node_path35, LATEST_RELEASE_URL, DOWNLOAD_BASE_URL, MACOS_X64_NOTE, BREW_PREFIXES, EXECUTABLE_MODE, UpdateChannelError, UpdateConflictError, UpdateDownloadError;
61574
61579
  var init_update = __esm({
61575
61580
  "src/update/update.ts"() {
61576
61581
  "use strict";
61577
61582
  import_node_crypto12 = require("node:crypto");
61578
- import_node_path33 = __toESM(require("node:path"), 1);
61583
+ import_node_path35 = __toESM(require("node:path"), 1);
61579
61584
  init_cliError();
61580
61585
  LATEST_RELEASE_URL = "https://github.com/ExaDev/agent-shim/releases/latest";
61581
61586
  DOWNLOAD_BASE_URL = "https://github.com/ExaDev/agent-shim/releases/latest/download";
@@ -62101,7 +62106,7 @@ function buildEnv(params) {
62101
62106
  const parentCustomHeaders = params.baseEnv.ANTHROPIC_CUSTOM_HEADERS;
62102
62107
  let providerCustomHeaders;
62103
62108
  if (!params.configDirEscapeHatch && params.resolvedIdentityName !== void 0) {
62104
- env.CLAUDE_CONFIG_DIR = import_node_path35.default.join(params.identitiesDir, params.resolvedIdentityName);
62109
+ env.CLAUDE_CONFIG_DIR = import_node_path37.default.join(params.identitiesDir, params.resolvedIdentityName);
62105
62110
  }
62106
62111
  if (params.provider !== void 0) {
62107
62112
  const providerEnv = params.provider.definition.env ?? {};
@@ -62145,11 +62150,11 @@ function buildEnv(params) {
62145
62150
  }
62146
62151
  return env;
62147
62152
  }
62148
- var import_node_path35, LOOPBACK_HOSTS;
62153
+ var import_node_path37, LOOPBACK_HOSTS;
62149
62154
  var init_flags = __esm({
62150
62155
  "src/launcher/flags.ts"() {
62151
62156
  "use strict";
62152
- import_node_path35 = __toESM(require("node:path"), 1);
62157
+ import_node_path37 = __toESM(require("node:path"), 1);
62153
62158
  init_envBool();
62154
62159
  init_credential();
62155
62160
  init_headers();
@@ -62223,12 +62228,17 @@ function resolvePoolLaunch(params) {
62223
62228
  if (graph.ranking.candidates.length === 0) {
62224
62229
  return { ok: false, message: `agent-shim: no member of pool "${poolName}" is an existing identity.` };
62225
62230
  }
62226
- const { pick: pick2, earliestReturn, movedOff, planReturn } = graph.ranking;
62231
+ const { pick: pick2, earliestReturn, movedOff, planReturn, holdForReturn } = graph.ranking;
62227
62232
  if (pick2 !== void 0 && params.wait && planReturn !== void 0) {
62228
62233
  log.info(`agent-shim: pool "${poolName}" would continue ${planReturn.identity} on extra usage; waiting until ${new Date(planReturn.atMs).toISOString()} for its plan window`);
62229
62234
  params.sleep(Math.max(planReturn.atMs - nowMs, 0));
62230
62235
  continue;
62231
62236
  }
62237
+ if (pick2 !== void 0 && params.wait && holdForReturn !== void 0) {
62238
+ log.info(`agent-shim: pool "${poolName}" pick ${pick2.identity} would run dry before its window resets; waiting until ${new Date(holdForReturn.atMs).toISOString()} for ${holdForReturn.identity}`);
62239
+ params.sleep(Math.max(holdForReturn.atMs - nowMs, 0));
62240
+ continue;
62241
+ }
62232
62242
  if (pick2 !== void 0) {
62233
62243
  if (params.recordPick) {
62234
62244
  recordStickyPick(params.usageFs, params.paths.usagePicksFile, params.cwd, pick2.identity, nowMs);
@@ -62477,7 +62487,7 @@ function decideLaunch(params, readOnly) {
62477
62487
  identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
62478
62488
  globalDefaultConfigProfile: params.globalDefaultConfigProfile
62479
62489
  });
62480
- if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs22.readConfigFile(import_node_path36.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
62490
+ if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs22.readConfigFile(import_node_path38.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
62481
62491
  log.error(
62482
62492
  `agent-shim: no configuration profile named "${configProfileDecision.name}" (selected via ${configProfileDecision.source}). Run \`agent-shim profile add ${configProfileDecision.name}\` first.`
62483
62493
  );
@@ -62589,7 +62599,7 @@ function decideLaunch(params, readOnly) {
62589
62599
  extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
62590
62600
  passthrough: parsedArgv.rest
62591
62601
  });
62592
- const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path36.default.join(paths.identitiesDir, identityDecision.name);
62602
+ const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path38.default.join(paths.identitiesDir, identityDecision.name);
62593
62603
  const decision = {
62594
62604
  identitySource: identityDecision.source,
62595
62605
  configDirEscapeHatch: identityDecision.configDirEscapeHatch,
@@ -62630,7 +62640,7 @@ function prepareLaunch(params) {
62630
62640
  );
62631
62641
  const updateCheck = runLaunchUpdateCheck({
62632
62642
  mode: params.updateMode ?? "off",
62633
- checkPath: import_node_path36.default.join(paths.root, "update.check"),
62643
+ checkPath: import_node_path38.default.join(paths.root, "update.check"),
62634
62644
  currentVersion: package_default.version,
62635
62645
  port: params.update
62636
62646
  });
@@ -62746,10 +62756,10 @@ function resolveLaunch(params) {
62746
62756
  environment
62747
62757
  };
62748
62758
  }
62749
- function runLaunchPlan(plan, spawn4) {
62759
+ function runLaunchPlan(plan, spawn5) {
62750
62760
  try {
62751
62761
  plan.markChildStarted();
62752
- const result = spawn4.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
62762
+ const result = spawn5.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
62753
62763
  if (result.error !== void 0) {
62754
62764
  throw result.error;
62755
62765
  }
@@ -62761,12 +62771,12 @@ function runLaunchPlan(plan, spawn4) {
62761
62771
  function runLauncher(params) {
62762
62772
  params.proc.exit(runLaunchPlan(prepareLaunch(params), params.spawn));
62763
62773
  }
62764
- var import_node_crypto14, import_node_path36;
62774
+ var import_node_crypto14, import_node_path38;
62765
62775
  var init_launcher = __esm({
62766
62776
  "src/launcher.ts"() {
62767
62777
  "use strict";
62768
62778
  import_node_crypto14 = require("node:crypto");
62769
- import_node_path36 = __toESM(require("node:path"), 1);
62779
+ import_node_path38 = __toESM(require("node:path"), 1);
62770
62780
  init_package();
62771
62781
  init_envBool();
62772
62782
  init_argv();
@@ -63778,10 +63788,10 @@ function Ww(e14) {
63778
63788
  }
63779
63789
  function M_() {
63780
63790
  let e14 = "";
63781
- if (typeof process < "u" && typeof process.cwd === "function" && typeof import_node_fs14.realpathSync === "function") try {
63791
+ if (typeof process < "u" && typeof process.cwd === "function" && typeof import_node_fs15.realpathSync === "function") try {
63782
63792
  let t10 = (0, import_node_process4.cwd)();
63783
63793
  try {
63784
- e14 = Ww((0, import_node_fs14.realpathSync)(t10));
63794
+ e14 = Ww((0, import_node_fs15.realpathSync)(t10));
63785
63795
  } catch {
63786
63796
  e14 = Ww(t10);
63787
63797
  }
@@ -77445,14 +77455,14 @@ async function jGe(e14, t10, n10, r10) {
77445
77455
  if (d.length === 0) return [];
77446
77456
  return iv(Buffer.from(gZ(d)), { limit: r10.limit, offset: r10.offset }, l, c10);
77447
77457
  }
77448
- var import_node_module, import_crypto, import_crypto2, import_path, import_node_fs14, import_node_process4, import_fs, import_os, import_path2, yy, import_fs2, import_promises, import_path3, import_readline, import_promises2, import_path4, import_os2, import_path5, Se, import_promises3, xe, import_promises4, import_fs3, import_promises5, import_os3, import_path6, import_promises6, import_os4, import_node_path37, import_node_os10, import_node_process5, import_path7, import_events, import_fs4, import_promises7, import_path8, import_child_process, import_util9, import_child_process2, import_fs5, import_path9, import_path10, import_crypto3, import_fs6, import_path11, import_promises8, import_path12, import_path13, import_promises9, import_path14, import_path15, import_fs7, import_promises10, import_path16, import_crypto4, import_path17, import_async_hooks, import_fs8, import_promises11, import_crypto5, import_fs9, import_promises12, import_path18, import_promises13, import_path19, import_crypto6, import_path20, import_path21, import_path22, import_path23, import_promises14, import_fs10, import_promises15, import_path24, import_util10, import_path25, import_os5, import_path26, import_path27, import_path28, import_path29, import_path30, import_net, import_os6, import_child_process3, import_fs11, import_child_process4, import_crypto7, import_promises16, import_module, import_os7, import_path31, import_url, import_events2, import_child_process5, import_fs12, import_readline2, import_string_decoder, import_fs13, import_promises17, import_os8, import_path32, import_crypto8, import_os9, import_fs14, import_path33, import_crypto9, import_fs15, import_promises18, import_path34, IZ, DZ, v_, LZ, OT, NZ, UZ, kT, X, FZ, dr, HZ, jZ, BZ, ot, st, ed, Kv, Te, Me, Oo, nd, hF, Xv, Qv, rd, LF, or, WF, ZF, sA, XF, od, sd, hg, id, Sg, Oz, fA, $z, Wz, Zz, s$, a$, d$, f$, g$, _$, E$, v$, T$, O$, I$, L$, wg, z$, j$, G$, V$, yA, SA, rH, lH, uH, _H, EH, EA, RH, TH, kH, DH, NH, zH, jH, GH, VH, ZH, JH, ej, nj, ij, cj, uj, CA, bj, Aj, wj, PT, KZ, GZ, VGe, VZ, MT, wr, jo, JZ, XZ, NT, UT, FT, zT, Bo, $T, HT, jT, BT, a4, sp, l4, c4, vt, u4, Nt, KT, d4, p4, uc, GT, m4, g4, WT, _4, y4, VT, Dn, Et, b4, C4, v4, A4, ra, x4, ip, qT, ZT, w4, O4, ro, P4, I4, D4, L4, M4, N4, U4, YT, JT, Sn, H4, Ko, j4, oo, XT, QT, G4, W4, V4, ew, Z4, Y4, tw, X4, nw, R_, rw, ow, Go, sw, iw, aw, lw, ei, aY, cw, Or, cY, uw, dw, lp, pw, cp, mY, gY, up, _Y, aa, fw, la, EY, bY, CY, vY, AY, RY, xY, TY, wY, OY, kY, PY, IY, mw, x_, gw, ca, MY, et, dp, hw, pp, zY, $Y, _w, HY, ua, yw, wt, KY, T_, Sw, WY, VY, qY, so, mp, Ew, vw, bw, YY, Cw, JY, XY, kr, QY, e9, Wo, n9, da, o9, s9, i9, a9, l9, c9, u9, d9, p9, f9, m9, g9, h9, _9, y9, S9, E9, b9, C9, v9, A9, R9, x9, T9, Qe, Aw, pa, hp, Rw, dc, k9, w_, P9, Pr, xw, I9, fa, D9, L9, _p, N9, ma, yp, z9, Tw, $9, H9, ww, Vo, Ir, pc, W9, V9, q9, Ow, Y9, Sp, J9, Ep, X9, qo, Q9, bp, kw, eJ, Pw, Iw, Dw, Lw, tJ, nJ, rJ, oJ, sJ, ti, io, iJ, Mw, Nw, Cp, aJ, Uw, Fw, ga, pr, uJ, Fe, $w, O_, k_, I_, ha, Bw, D_, qw, Vw, N_, U_, yJ, _a3, Yo, Zw, bJ, Rp, Yw, vJ, AJ, Jw, xp, Xw, Tp, Qw, kJ, ya, IJ, DJ, Sa, MJ, fc, NJ, eO, FJ, zJ, $J, tO, Ea, jJ, nO, rO, sO, iO, Vn, GJ, Ln, Jo, aO, lO, cO, wp, XJ, QJ, uO, ba, dO, pO, fO, Dr, ao, mO, Ca, gO, z_, $_, H_, j_, B_, K_, G_, W_, V_, q_, Z_, _O, Y_, J_, yO, X_, c3, Q_, ey, ty, ny, ry, oy, sy, iy, ay, ly, cy, we, SO, en, d3, Pp, vO, g3, gy, wO, S3, BO, KO, Ip, Dp, v3, GO, WO, F9e, IO, A3, hy, x3, NO, I3, Ay, Ry, D3, xy, L3, bc, xa, Ty, wy, Oy, ky, XO, Py, Iy, Dy, Ly, My, Ny, Uy, Fy, zy, nk, rk, d3e, p3e, f3e, m3e, g3e, U3, jp, jy, ik, By, Ky, lk, $3, uk, ck, G3, W3, V3, it, Y3, J3, hk, tXe, Q3, kt, We, gX, Ta, SX, mr, Yp, Jp, eS, nS, yXe, IX, DX, rS, ka, oS, Ok, kk, HX, jX, ef, bXe, Uk, Mr, wc, Fk, Pa, OXe, kXe, iS, PXe, IXe, DXe, GX, YX, JX, XX, QX, e6, t6, Yk, n6, r6, o6, s6, i6, a6, l6, c6, Vk, uS, lf, dS, Qk, eP, uf, os10, qXe, ZXe, h6, tP, df, _6, y6, S6, E6, b6, Jn, gr, nP, rP, Dc, pS, oP, gS, lP, C6, mS, lS, sP, w6, O6, dP, k6, YXe, JXe, P6, I6, pf, L6, fP, XXe, QXe, M6, SS, z6, $6, j6, bP, CP, G6, Lc, si, Z6, ES, bS, X6, Q6, e5, t5, n5, u5, r5, o5, s5, i5, a5, l5, c5, u52, d5, p5, f5, m5, g5, h5, _5, y5, S5, E5, b5, C5, v5, A5, R5, x5, T5, w5, O5, k5, P5, I5, D5, L5, M5, N5, U5, F5, z5, $5, H5, j5, B5, K5, G5, W5, V5, q5, Z5, Y5, J5, X5, Q5, e8, t8, n8, r8, o8, s8, i8, a8, l8, c8, u8, d8, CS, p8, f8, m8, g8, h8, _8, y8, S8, E8, b8, C8, v8, A8, R8, x8, T8, w8, O8, k8, P8, I8, D8, L8, M8, N8, U8, F8, z8, $8, H8, j8, B8, K8, G8, W8, V8, q8, Z8, Y8, J8, X8, Q8, e7, t7, n7, r7, o7, s7, i7, a7, l7, c7, u7, d7, p7, f7, m7, g7, h7, _7, y7, S7, E7, b7, C7, TP, v7, L6e, RP, A7, x7, kP, ff, U6e, F6e, Ua, z6e, $6e, H6e, j6e, PP, IP, vS, DP, w7, LP, O7, k7, P7, AS, RS, xS, I7, MP, NP, D7, G6e, L7, W6e, M7, N7, UP, V6e, U7, F7, z7, $7, H7, j7, B7, q6e, is, wS, Fa, K7, G7, W7, i5e, X7, Q7, HP, $P, BP, tQ, WP, VP, JP, _Q, QP, eI, xQ, Uc, DS, $a, wQ, OQ, kQ, PQ, IQ, DQ, LQ, MQ, NQ, UQ, FQ, zQ, $Q, HQ, jQ, BQ, KQ, GQ, WQ, VQ, qQ, ZQ, YQ, JQ, XQ, QQ, eee, tee, nee, ree, oee, see, iee, aee, lee, cee, uee, dee, pee, fee, mee, gee, hee, _ee, yee, See, Eee, bee, Cee, vee, Aee, Ree, xee, Tee, wee, Oee, kee, Pee, Iee, Dee, Lee, Mee, Nee, Uee, Fee, zee, $ee, Hee, jee, Bee, Kee, Gee, Wee, Vee, qee, Zee, Yee, Jee, Xee, Qee, ete, tte, nte, rte, ote, ste, ite, ate, lte, cte, ute, dte, pte, fte, mte, gte, hte, _te, yte, Ste, Ete, bte, Cte, vte, Ate, Rte, xte, Tte, wte, Ote, kte, Pte, Ite, Dte, Lte, Mte, Nte, Ute, Fte, zte, $te, Hte, jte, Bte, Kte, Gte, Wte, Vte, qte, Zte, Yte, Jte, Xte, Qte, ene, tne, nne, rne, one, sne, ine, ane, lne, cne, une, dne, pne, fne, mne, gne, hne, _ne, yne, Sne, Ene, bne, Cne, vne, Ane, Rne, xne, Tne, wne, One, kne, Pne, Ine, Dne, Lne, Mne, Nne, Une, Fne, zne, $ne, Hne, jne, Bne, Kne, Gne, Wne, Vne, qne, Zne, Yne, Jne, Xne, Qne, ere, tre, nre, rre, ore, sre, ire, are, lre, cre, ure, dre, pre, fre, mre, gre, hre, _re, yre, Sre, Ere, bre, Cre, vre, Are, Rre, xre, Tre, wre, Ore, kre, Pre, Ire, Dre, Lre, Mre, Nre, Ure, Fre, zre, $re, Hre, jre, Bre, Kre, Gre, Wre, Vre, qre, Zre, Yre, Jre, Xre, Qre, eoe, toe, noe, roe, ooe, soe, ioe, aoe, loe, coe, uoe, doe, poe, foe, moe, goe, hoe, _oe, yoe, Soe, Eoe, boe, Coe, voe, Aoe, Roe, xoe, Toe, woe, Ooe, koe, Poe, Ioe, Doe, Loe, Moe, Noe, Uoe, Foe, zoe, $oe, Hoe, joe, Boe, Koe, Goe, Woe, Voe, qoe, Zoe, Yoe, Joe, Xoe, Qoe, ese, tse, nse, rse, ose, sse, ise, ase, lse, cse, use, dse, pse, fse, mse, gse, hse, _se, yse, Sse, Ese, LS, bse, Cse, vse, Ase, Rse, xse, Tse, wse, Ose, kse, Pse, Ise, Dse, Lse, Mse, Nse, Use, Fse, zse, $se, Hse, jse, Bse, Kse, Gse, Wse, Vse, qse, Zse, Yse, Jse, Xse, Qse, eie, tie, nie, rie, oie, sie, iie, aie, lie, cie, uie, die, pie, fie, mie, gie, hie, _ie, yie, Sie, Eie, bie, Cie, vie, Aie, Rie, xie, Tie, wie, Oie, kie, Pie, Iie, Die, Lie, Mie, Nie, Uie, Fie, zie, $ie, Hie, jie, Bie, Kie, Gie, Wie, Vie, qie, Zie, Yie, Jie, Xie, Qie, eae, tae, nae, rae, oae, sae, iae, aae, lae, cae, uae, dae, pae, fae, mae, gae, hae, _ae, yae, Sae, Eae, bae, Cae, vae, Aae, Rae, xae, Tae, wae, Oae, kae, Pae, Iae, Dae, Lae, Mae, Nae, Uae, Fae, zae, $ae, Hae, jae, Bae, Kae, Gae, Wae, Vae, qae, Zae, Yae, Jae, Xae, Qae, ele, tle, nle, rle, ole, sle, ile, ale, lle, cle, ule, dle, ple, fle, mle, gle, hle, _le, yle, Sle, Ele, ble, Cle, vle, Ale, Rle, xle, Tle, wle, Ole, kle, Ple, Ile, Dle, Lle, Mle, Nle, Ule, Fle, zle, $le, Hle, jle, Ble, Kle, Gle, Wle, Vle, qle, Zle, Yle, Jle, MS, Xle, Qle, ece, tce, nce, rce, oce, sce, ice, ace, lce, cce, uce, dce, pce, fce, mce, gce, hce, _ce, yce, Sce, Ece, bce, Cce, vce, Ace, Rce, xce, Tce, wce, Oce, kce, Pce, Ice, Dce, Lce, Mce, Nce, Uce, Fce, zce, $ce, Hce, jce, Bce, Kce, Gce, Wce, Vce, qce, Zce, Yce, Jce, Xce, Qce, eue, tue, nue, rue, oue, sue, iue, aue, lue, cue, uue, due, pue, fue, mue, gue, hue, _ue, yue, Sue, Eue, bue, Cue, vue, Aue, Rue, xue, Tue, wue, Oue, kue, Pue, Iue, Due, Lue, Mue, Nue, Uue, Fue, zue, $ue, Hue, jue, Bue, Kue, Gue, Wue, Vue, que, Zue, Yue, Jue, Xue, Que, ede, tde, nde, rde, ode, sde, ide, ade, lde, cde, ude, dde, pde, fde, mde, gde, hde, _de, yde, Sde, Ede, bde, Cde, vde, Ade, Rde, xde, Tde, wde, Ode, kde, Pde, Ide, Dde, Lde, Mde, Nde, Ude, Fde, zde, $de, Hde, jde, Bde, Kde, Gde, Wde, Vde, qde, Zde, Yde, Jde, Xde, Qde, epe, tpe, npe, rpe, ope, spe, ipe, ape, lpe, cpe, upe, dpe, ppe, fpe, mpe, gpe, hpe, _pe, ype, Spe, Epe, bpe, Cpe, vpe, Ape, Rpe, xpe, Tpe, wpe, Ope, kpe, Ppe, Ipe, Dpe, Lpe, Mpe, Npe, Upe, Fpe, zpe, $pe, Hpe, jpe, Bpe, Kpe, Gpe, Wpe, Vpe, qpe, Zpe, Ype, Jpe, Xpe, Qpe, efe, tfe, nfe, rfe, ofe, sfe, ife, afe, lfe, cfe, ufe, dfe, pfe, ffe, mfe, gfe, hfe, _fe, yfe, Sfe, Efe, bfe, Cfe, vfe, Afe, Rfe, xfe, Tfe, wfe, Ofe, kfe, Pfe, Ife, Dfe, Lfe, Mfe, Nfe, Ufe, Ffe, zfe, $fe, Hfe, jfe, Bfe, Kfe, Gfe, Wfe, Vfe, qfe, Zfe, Yfe, Jfe, Xfe, Qfe, eme, tme, nme, rme, ome, sme, ime, ame, lme, cme, ume, dme, pme, fme, mme, gme, hme, _me, yme, Sme, Eme, bme, Cme, vme, Ame, Rme, xme, Tme, wme, Ome, kme, Pme, Ime, Dme, Lme, Mme, Nme, Ume, Fme, zme, $me, Hme, jme, Bme, Kme, Gme, Wme, Vme, qme, Zme, Yme, Jme, NS, Xme, Qme, ege, tge, nge, rge, oge, sge, ige, age, lge, cge, uge, dge, pge, fge, mge, gge, hge, _ge, yge, Sge, Ege, bge, Cge, vge, Age, Rge, xge, Tge, wge, Oge, kge, Pge, Ige, Dge, Lge, Mge, Nge, Uge, Fge, zge, $ge, Hge, US, jge, Bge, Kge, Gge, Wge, Vge, qge, Zge, Yge, Jge, Xge, Qge, ehe, the, nhe, rhe, ohe, she, ihe, ahe, lhe, che, uhe, dhe, phe, fhe, mhe, ghe, hhe, _he, yhe, She, Ehe, bhe, Che, vhe, Ahe, Rhe, xhe, The, whe, Ohe, khe, Phe, Ihe, Dhe, Lhe, Mhe, Nhe, FS, rI, oI, Uhe, Fhe, zhe, $he, Hhe, jhe, Bhe, Khe, Ghe, Whe, Vhe, qhe, Zhe, Yhe, Jhe, Xhe, Qhe, e_e, t_e, n_e, r_e, o_e, s_e, i_e, a_e, l_e, c_e, u_e, d_e, p_e, f_e, m_e, g_e, h_e, __e, y_e, S_e, E_e, b_e, C_e, v_e, A_e, R_e, x_e, T_e, w_e, O_e, k_e, P_e, I_e, D_e, L_e, M_e, N_e, U_e, F_e, z_e, $_e, H_e, j_e, B_e, K_e, G_e, W_e, V_e, q_e, Z_e, Y_e, J_e, Q_e, Xn, eye, F8e, tye, z8e, nye, iI, rye, oye, lI, cye, uye, dye, _ye, on, vye, Aye, dI, C7e, v7e, ho, kI, PI, Dye, Sf, Lye, jc, Mye, Nye, LI, NI, Fye, VS, zye, $ye, x7e, zI, YS, KI, GI, VI, Hye, qS, ls, Kye, Gye, oD, nE, sD, So, Yc, vn, Zye, oE, sE, iD, aD, wf, Jc, Xc, kf, Qc, Pf, eu, fi, tu, mi, lD, cD, uD, dD, pD, fD, mD, gD, hD, _D, yD, SD, ED, bD, vD, AD, cE, RD, Xye, TD, wD, OD, kD, PD, uE, ID, DD, LD, MD, FD, If, nu, zD, $D, HD, jD, BD, zt, dE, Df, pE, fE, KD, GD, WD, VD, qD, ru, ZD, YD, JD, XD, QD, eL, tL, mE, yr, He, rL, ou, Je, yE, SE, EE, fL, mL, tSe, bE, CE, vE, AE, RE, xE, TE, wE, gL, hL, _L, yL, OE, sSe, kE, PE, IE, DE, LE, ME, NE, Nf, UE, FE, zE, $E, HE, jE, BE, cSe, gE, KE, vL, Uf, GE, WE, VE, qE, ZE, YE, Ff, JE, XE, QE, eb, tb, nb, zf, AL, rb, ob, sb, TL, ab, RL, xL, $f, Hf, dSe, fSe, OL, kL, Sr, FL, ML, zL, lu, hSe, iC, aC, lC, HL, jL, cC, uC, BL, dC, KL, pC, GL, fC, mC, WL, VL, qL, ZL, gC, YL, hC, JL, XL, _C, yC, SC, EC, QL, sC, bC, CC, vC, AC, RC, xC, TC, wC, OC, tM, qf, kC, $L, rM, ASe, Fn, oM, sM, iM, aM, lM, cM, uM, dM, pM, fM, mM, gM, Be, SM, LC, ct, MC, EM, bM, CM, pEe, fEe, Yf, mEe, gEe, hEe, _Ee, yEe, SEe, EEe, bEe, CEe, vEe, AEe, REe, xEe, TEe, wEe, OEe, NC, kEe, vM, PEe, IEe, DEe, LEe, MEe, fu, AM, NEe, UEe, IC, DC, FEe, zEe, qa, TM, HEe, jEe, KEe, wM, em, mu, qEe, ZEe, JEe, OM, Qn, kM, LM, nbe, rbe, abe, lbe, cbe, rm, pbe, At, hbe, BC, BM, Zet, WM, VM, qM, ZM, Cbe, vbe, YM, Abe, Rbe, JM, xbe, Tbe, QM, Ibe, eN, Lbe, nN, Mbe, Nbe, sm, rN, iN, Fbe, aN, $be, jbe, Kbe, Gbe, yu, lN, uN, dN, Xbe, KM, Qbe, eCe, tCe, oCe, iCe, _N, yN, wN, Ytt, ON, OCe, DCe, LN, $Ce, HCe, Cu, BCe, MN, VCe, QCe, ive, uve, VN, pve, fve, _rt, gve, Sve, nv, tv, GN, tU, Fve, Hve, iU, tAe, sAe, iAe, aAe, cAe, Ie, bU, Q, vo, F, zn, fAe, ms, mAe, _m, nn, he, Xa, an, lv, cv, Si, wu, se, br, CU, Oe, gAe, hAe, _Ae, yAe, SAe, EAe, bAe, CAe, vAe, uv, AAe, RAe, xAe, TAe, wAe, OAe, vU, kAe, Ro, el, tl, ym, ku, Sm, Pu, Iu, Em, Ei, xo, bm, Fr, ft, Du, Ao, pv, Lu, To, Cm, vm, nl, Ou, Mu, Nu, bi, Uu, rl, $r, zr, gs, Fu, zu, Am, fv, Rm, $u, wot, H, Oot, kot, Pot, Iot, Dot, Lot, Mot, Not, Uot, Fot, zot, $ot, Hot, jot, xU, Bot, Kot, Got, Wot, Vot, qot, Zot, Yot, Jot, Xot, Qot, est, tst, nst, rst, ost, sst, ist, ast, FAe, zAe, gv, OU, Ss, km, Mt, kU, PU, kst, HAe, jAe, hv, $n, Hu, IU, Yt, tr, nr, Jt, Pm, DU, _v, LU, MU, yv, ju, le, Sv, NU, Pst, Ist, Im, BAe, Dm, KAe, Bu, ol, UU, GAe, WAe, VAe, qAe, ZAe, YAe, Ev, JAe, XAe, bv, Lm, QAe, eRe, Mm, tRe, Ku, Gu, nRe, Wu, sl, rRe, Vu, Nm, Um, Fm, Dst, zm, $m, Hm, FU, zU, $U, Cv, HU, qu, il, jU, oRe, jm, sRe, Bm, iRe, vv, aRe, Km, lRe, cRe, uRe, dRe, pRe, fRe, mRe, gRe, hRe, _Re, Gm, yRe, SRe, Wm, Av, Rv, xv, ERe, bRe, CRe, Tv, vRe, ARe, RRe, xRe, TRe, BU, Vm, wRe, qm, Lst, ORe, al, kRe, Mst, Zu, PRe, wv, IRe, DRe, LRe, MRe, NRe, URe, FRe, Om, zRe, $Re, HRe, Yu, Ov, jRe, BRe, KRe, GRe, WRe, VRe, qRe, ZRe, YRe, JRe, XRe, QRe, exe, txe, nxe, rxe, oxe, sxe, ll, ixe, axe, lxe, Zm, cxe, uxe, dxe, kv, pxe, Nst, Ust, Fst, zst, $st, Hst, ae, WU, qU, VU, ZU, YU, Ym, e0, fxe, mxe, Dv, Cr, gxe, Ju, d0, h0, _0, v0, A0, Sxe, Exe, Mv, Cxe, Fv, Oj, kj, PA, IA, DA, Lj, Dj, aLe, NA, FA, uLe, dd, fLe, Po, SLe, ELe, zA, bLe, xLe, TLe, wLe, OLe, kLe, $j, qj, ILe, DLe, LLe, MLe, Ce, NLe, Wg, Oi, VA, Do, Jj, Xj, Qj, eB, tB, nB, qA, ZA, jA, Bj, jLe, BLe, GLe, rB, BA, Gg, GA, WA, VLe, qLe, Kj, Hs, sB, QLe, YA, iB, uB, eMe, dB, pB, fB, mB, tMe, XA, aB, QA, gB, hB, _B, yB, jn, lMe, SB, dMe, bB, mMe, fd, RB, hMe, Rr, TB, SMe, EMe, Pl, wB, Vg, AMe, Il, RMe, xMe, qg, OB, wMe, OMe, kB, eo, Dl, Zg, DB, NMe, FB, WMe, VMe, $B, HB, jB, BB, Ml, GB, nR, WB, Jg, KB, eNe, Bs, VB, gd, Nl, Xg, tNe, YB, qB, Pi, rK, iK, pNe, hd, _d, to, yd, nh, uK, aK, _Ne, lK, cK, Sd, Ul, rh, oh, dK, CNe, pK, sh, fK, RNe, xNe, TNe, mK, wNe, ONe, ih, Ed, lr, gK, hK, yK, SK, EK, ah, bK, FNe, CK, zNe, $Ne, HNe, vK, BNe, lh, AK, RK, xK, VNe, dn, TK, wK, OK, kK, PK, QNe, eUe, IK, DK, rUe, LK, MK, NK, UK, iUe, aUe, lUe, cUe, uUe, dUe, pUe, fUe, mUe, gUe, hUe, _Ue, yUe, SUe, EUe, bUe, CUe, vUe, AUe, FK, xUe, zK, $K, wUe, HK, OUe, jK, BK, PUe, KK, IUe, DUe, LUe, GK, MUe, NUe, UUe, FUe, WK, zUe, $Ue, HUe, VK, jUe, BUe, KUe, GUe, WUe, VUe, qUe, ZUe, YUe, JUe, XUe, QUe, e0e, t0e, n0e, r0e, Xe, qK, ZK, YK, JK, a0e, l0e, uh, XK, QK, e1, n1, r1, dh, m0e, g0e, h0e, _0e, bd, o1, S0e, Fl, s1, b0e, i1, Di, a1, l1, c1, u1, d1, p1, f1, P0e, I0e, m1, D0e, g1, h1, _1, vyt, U0e, y1, Ayt, iR, F0e, z0e, $0e, Gs, zl, fh, E1, b1, H0e, j0e, B0e, K0e, mh, $l, gh, Ws, aR, hh, _h, G0e, W0e, lR, R1, x1, V0e, uR, k1, P1, I1, D1, L1, Y0e, dR, J0e, Fyt, pR, X0e, fR, mR, Q0e, zyt, eFe, gR, hR, _R, $yt, M1, yR, N1, U1, tFe, nFe, rFe, oFe, iFe, Mi, cFe, $1, Wyt, Vyt, H1, j1, B1, K1, uFe, G1, W1, V1, q1, dFe, pFe, SR, fFe, eSt, tSt, mFe, jl, Vs, gFe, Y1, hFe, _Fe, X1, Q1, eG, yFe, SFe, tG, EFe, bFe, CFe, vFe, bR, CR, RFe, xFe, vR, TFe, Eh, nSt, Cd, wFe, OFe, aSt, rG, PFe, IFe, _St, oG, sG, bSt, CSt, HFe, jFe, $St, BFe, KFe, HSt, JSt, XSt, lG, OR, VFe, YFe, uG, eze, nze, gG, vd, vh, kR, zi, sze, yG, ize, yEt, Ad, $i, bG, Kn, AEt, REt, xEt, aze, AG, wG, $R, dze, $G, pze, fze, mze, gze, hze, BR, HG, jG, fbt, yze, Sze, Eze, Gn, ji, kG, PG, NR, UR, KR, GG, Cze, vze, Rze, GR, xze, Tze, xh, WR, Oze, kze, mbt, Pze, Ize, Dze, Lze, Mze, Nze, qG, Uze, Fze, zze, $ze, ZG, Hze, IG, jze, Bze, YG, Kze, Gze, DG, Wze, Vze, JG, qze, Zze, Yze, Jze, QG, Xze, Qze, e$e, t$e, r$e, o$e, s$e, i$e, a$e, eW, nW, c$e, m$e, xd, VR, gbt, hbt, _bt, h$e, qR, Th, MR, aW, _$e, S$e, lW, E$e, b$e, C$e, v$e, A$e, x$e, w$e, O$e, k$e, P$e, I$e, N$e, ybt, FR, Sbt, U$e, MG, Td, Ebt, bbt, uW, z$e, $$e, H$e, Cbt, j$e, B$e, vbt, Abt, K$e, Rbt, Oh, kh, G$e, YR, Ph, W$e, Ih, Mbt, Nbt, Ubt, Dh, V$e, Z$e, tx, EW, Id, Fh, X$e, xCt, Q$e, eHe, ix, ax, lx, cx, zh, $h, MW, tHe, nHe, aHe, uHe, dHe, Zs, pHe, CW, vW, AW, Nh, UW, fHe, mHe, gHe, hHe, _He, yHe, SHe, EHe, pn, dx, nx, Mh, Bi, AHe, TCt, xHe, Pd, RW, THe, xW, wHe, OHe, Hh, kHe, TW, fx, Bh, Ki, KW, Gl, PHe, Kh, kW, Wl, NHe, Ld, UHe, tV, rV, jHe, XHe, cvt, tje, fV, mV, sje, aje, _V, yV, pje, zvt, $vt, gje, yje, Sje, Kvt, Gvt, eAt, RV, Eje, bje, mAt, Cje, gAt, xV, wV, OV, Js, Lje, FV, Yh, Jh, Md, Tx, zV, $V, HV, Xh, jV, cr, KV, Mo, Fje, zje, yRt, jje, Gje, Vje, sBe, YV, e22, o_, gBe, t2, s_, kx, o2, LBe, UBe, $x, Vi, R2, KBe, GBe, Dx, ZBe, k2, n_, l2, sKe, lKe, z2, bKe, RKe, ec, W2, H2, xKe, wKe, PKe, IKe, $Ke, X2, HKe, jKe, BKe, KKe, VKe, eTt, qKe, tTt, nTt, ZKe, rTt, YKe, oTt, JKe, Wx, XKe, iTt, eq, tq, QKe, nq, rq, e1e, t1e, oq, sq, n1e, r1e, aTt, lTt, c1e, Zx, cq, u1e, uq, a_, d1e, Xx, nc, S1e, c_, mq, gq, Qx, hq, _q, E1e, Sq, u_, rc, d_, b1e, bq, Uo, Cq, vq, A1e, Yd, Jd, R1e, x1e, Aq, gn, T1e, w1e, O1e, Xs, k1e, P1e, xq, Pwt, I1e, Oq, kq, Pq, D1e, L1e, Iq, M1e, N1e, nT, U1e, p_, rT, Dq, oT, iT, F1e, Uq, aT, jq, K1e, Gq, yOt, sGe, cGe, uGe, yGe;
77458
+ var import_node_module, import_crypto, import_crypto2, import_path, import_node_fs15, import_node_process4, import_fs, import_os, import_path2, yy, import_fs2, import_promises, import_path3, import_readline, import_promises2, import_path4, import_os2, import_path5, Se, import_promises3, xe, import_promises4, import_fs3, import_promises5, import_os3, import_path6, import_promises6, import_os4, import_node_path39, import_node_os10, import_node_process5, import_path7, import_events, import_fs4, import_promises7, import_path8, import_child_process, import_util9, import_child_process2, import_fs5, import_path9, import_path10, import_crypto3, import_fs6, import_path11, import_promises8, import_path12, import_path13, import_promises9, import_path14, import_path15, import_fs7, import_promises10, import_path16, import_crypto4, import_path17, import_async_hooks, import_fs8, import_promises11, import_crypto5, import_fs9, import_promises12, import_path18, import_promises13, import_path19, import_crypto6, import_path20, import_path21, import_path22, import_path23, import_promises14, import_fs10, import_promises15, import_path24, import_util10, import_path25, import_os5, import_path26, import_path27, import_path28, import_path29, import_path30, import_net, import_os6, import_child_process3, import_fs11, import_child_process4, import_crypto7, import_promises16, import_module, import_os7, import_path31, import_url, import_events2, import_child_process5, import_fs12, import_readline2, import_string_decoder, import_fs13, import_promises17, import_os8, import_path32, import_crypto8, import_os9, import_fs14, import_path33, import_crypto9, import_fs15, import_promises18, import_path34, IZ, DZ, v_, LZ, OT, NZ, UZ, kT, X, FZ, dr, HZ, jZ, BZ, ot, st, ed, Kv, Te, Me, Oo, nd, hF, Xv, Qv, rd, LF, or, WF, ZF, sA, XF, od, sd, hg, id, Sg, Oz, fA, $z, Wz, Zz, s$, a$, d$, f$, g$, _$, E$, v$, T$, O$, I$, L$, wg, z$, j$, G$, V$, yA, SA, rH, lH, uH, _H, EH, EA, RH, TH, kH, DH, NH, zH, jH, GH, VH, ZH, JH, ej, nj, ij, cj, uj, CA, bj, Aj, wj, PT, KZ, GZ, VGe, VZ, MT, wr, jo, JZ, XZ, NT, UT, FT, zT, Bo, $T, HT, jT, BT, a4, sp, l4, c4, vt, u4, Nt, KT, d4, p4, uc, GT, m4, g4, WT, _4, y4, VT, Dn, Et, b4, C4, v4, A4, ra, x4, ip, qT, ZT, w4, O4, ro, P4, I4, D4, L4, M4, N4, U4, YT, JT, Sn, H4, Ko, j4, oo, XT, QT, G4, W4, V4, ew, Z4, Y4, tw, X4, nw, R_, rw, ow, Go, sw, iw, aw, lw, ei, aY, cw, Or, cY, uw, dw, lp, pw, cp, mY, gY, up, _Y, aa, fw, la, EY, bY, CY, vY, AY, RY, xY, TY, wY, OY, kY, PY, IY, mw, x_, gw, ca, MY, et, dp, hw, pp, zY, $Y, _w, HY, ua, yw, wt, KY, T_, Sw, WY, VY, qY, so, mp, Ew, vw, bw, YY, Cw, JY, XY, kr, QY, e9, Wo, n9, da, o9, s9, i9, a9, l9, c9, u9, d9, p9, f9, m9, g9, h9, _9, y9, S9, E9, b9, C9, v9, A9, R9, x9, T9, Qe, Aw, pa, hp, Rw, dc, k9, w_, P9, Pr, xw, I9, fa, D9, L9, _p, N9, ma, yp, z9, Tw, $9, H9, ww, Vo, Ir, pc, W9, V9, q9, Ow, Y9, Sp, J9, Ep, X9, qo, Q9, bp, kw, eJ, Pw, Iw, Dw, Lw, tJ, nJ, rJ, oJ, sJ, ti, io, iJ, Mw, Nw, Cp, aJ, Uw, Fw, ga, pr, uJ, Fe, $w, O_, k_, I_, ha, Bw, D_, qw, Vw, N_, U_, yJ, _a3, Yo, Zw, bJ, Rp, Yw, vJ, AJ, Jw, xp, Xw, Tp, Qw, kJ, ya, IJ, DJ, Sa, MJ, fc, NJ, eO, FJ, zJ, $J, tO, Ea, jJ, nO, rO, sO, iO, Vn, GJ, Ln, Jo, aO, lO, cO, wp, XJ, QJ, uO, ba, dO, pO, fO, Dr, ao, mO, Ca, gO, z_, $_, H_, j_, B_, K_, G_, W_, V_, q_, Z_, _O, Y_, J_, yO, X_, c3, Q_, ey, ty, ny, ry, oy, sy, iy, ay, ly, cy, we, SO, en, d3, Pp, vO, g3, gy, wO, S3, BO, KO, Ip, Dp, v3, GO, WO, F9e, IO, A3, hy, x3, NO, I3, Ay, Ry, D3, xy, L3, bc, xa, Ty, wy, Oy, ky, XO, Py, Iy, Dy, Ly, My, Ny, Uy, Fy, zy, nk, rk, d3e, p3e, f3e, m3e, g3e, U3, jp, jy, ik, By, Ky, lk, $3, uk, ck, G3, W3, V3, it, Y3, J3, hk, tXe, Q3, kt, We, gX, Ta, SX, mr, Yp, Jp, eS, nS, yXe, IX, DX, rS, ka, oS, Ok, kk, HX, jX, ef, bXe, Uk, Mr, wc, Fk, Pa, OXe, kXe, iS, PXe, IXe, DXe, GX, YX, JX, XX, QX, e6, t6, Yk, n6, r6, o6, s6, i6, a6, l6, c6, Vk, uS, lf, dS, Qk, eP, uf, os10, qXe, ZXe, h6, tP, df, _6, y6, S6, E6, b6, Jn, gr, nP, rP, Dc, pS, oP, gS, lP, C6, mS, lS, sP, w6, O6, dP, k6, YXe, JXe, P6, I6, pf, L6, fP, XXe, QXe, M6, SS, z6, $6, j6, bP, CP, G6, Lc, si, Z6, ES, bS, X6, Q6, e5, t5, n5, u5, r5, o5, s5, i5, a5, l5, c5, u52, d5, p5, f5, m5, g5, h5, _5, y5, S5, E5, b5, C5, v5, A5, R5, x5, T5, w5, O5, k5, P5, I5, D5, L5, M5, N5, U5, F5, z5, $5, H5, j5, B5, K5, G5, W5, V5, q5, Z5, Y5, J5, X5, Q5, e8, t8, n8, r8, o8, s8, i8, a8, l8, c8, u8, d8, CS, p8, f8, m8, g8, h8, _8, y8, S8, E8, b8, C8, v8, A8, R8, x8, T8, w8, O8, k8, P8, I8, D8, L8, M8, N8, U8, F8, z8, $8, H8, j8, B8, K8, G8, W8, V8, q8, Z8, Y8, J8, X8, Q8, e7, t7, n7, r7, o7, s7, i7, a7, l7, c7, u7, d7, p7, f7, m7, g7, h7, _7, y7, S7, E7, b7, C7, TP, v7, L6e, RP, A7, x7, kP, ff, U6e, F6e, Ua, z6e, $6e, H6e, j6e, PP, IP, vS, DP, w7, LP, O7, k7, P7, AS, RS, xS, I7, MP, NP, D7, G6e, L7, W6e, M7, N7, UP, V6e, U7, F7, z7, $7, H7, j7, B7, q6e, is, wS, Fa, K7, G7, W7, i5e, X7, Q7, HP, $P, BP, tQ, WP, VP, JP, _Q, QP, eI, xQ, Uc, DS, $a, wQ, OQ, kQ, PQ, IQ, DQ, LQ, MQ, NQ, UQ, FQ, zQ, $Q, HQ, jQ, BQ, KQ, GQ, WQ, VQ, qQ, ZQ, YQ, JQ, XQ, QQ, eee, tee, nee, ree, oee, see, iee, aee, lee, cee, uee, dee, pee, fee, mee, gee, hee, _ee, yee, See, Eee, bee, Cee, vee, Aee, Ree, xee, Tee, wee, Oee, kee, Pee, Iee, Dee, Lee, Mee, Nee, Uee, Fee, zee, $ee, Hee, jee, Bee, Kee, Gee, Wee, Vee, qee, Zee, Yee, Jee, Xee, Qee, ete, tte, nte, rte, ote, ste, ite, ate, lte, cte, ute, dte, pte, fte, mte, gte, hte, _te, yte, Ste, Ete, bte, Cte, vte, Ate, Rte, xte, Tte, wte, Ote, kte, Pte, Ite, Dte, Lte, Mte, Nte, Ute, Fte, zte, $te, Hte, jte, Bte, Kte, Gte, Wte, Vte, qte, Zte, Yte, Jte, Xte, Qte, ene, tne, nne, rne, one, sne, ine, ane, lne, cne, une, dne, pne, fne, mne, gne, hne, _ne, yne, Sne, Ene, bne, Cne, vne, Ane, Rne, xne, Tne, wne, One, kne, Pne, Ine, Dne, Lne, Mne, Nne, Une, Fne, zne, $ne, Hne, jne, Bne, Kne, Gne, Wne, Vne, qne, Zne, Yne, Jne, Xne, Qne, ere, tre, nre, rre, ore, sre, ire, are, lre, cre, ure, dre, pre, fre, mre, gre, hre, _re, yre, Sre, Ere, bre, Cre, vre, Are, Rre, xre, Tre, wre, Ore, kre, Pre, Ire, Dre, Lre, Mre, Nre, Ure, Fre, zre, $re, Hre, jre, Bre, Kre, Gre, Wre, Vre, qre, Zre, Yre, Jre, Xre, Qre, eoe, toe, noe, roe, ooe, soe, ioe, aoe, loe, coe, uoe, doe, poe, foe, moe, goe, hoe, _oe, yoe, Soe, Eoe, boe, Coe, voe, Aoe, Roe, xoe, Toe, woe, Ooe, koe, Poe, Ioe, Doe, Loe, Moe, Noe, Uoe, Foe, zoe, $oe, Hoe, joe, Boe, Koe, Goe, Woe, Voe, qoe, Zoe, Yoe, Joe, Xoe, Qoe, ese, tse, nse, rse, ose, sse, ise, ase, lse, cse, use, dse, pse, fse, mse, gse, hse, _se, yse, Sse, Ese, LS, bse, Cse, vse, Ase, Rse, xse, Tse, wse, Ose, kse, Pse, Ise, Dse, Lse, Mse, Nse, Use, Fse, zse, $se, Hse, jse, Bse, Kse, Gse, Wse, Vse, qse, Zse, Yse, Jse, Xse, Qse, eie, tie, nie, rie, oie, sie, iie, aie, lie, cie, uie, die, pie, fie, mie, gie, hie, _ie, yie, Sie, Eie, bie, Cie, vie, Aie, Rie, xie, Tie, wie, Oie, kie, Pie, Iie, Die, Lie, Mie, Nie, Uie, Fie, zie, $ie, Hie, jie, Bie, Kie, Gie, Wie, Vie, qie, Zie, Yie, Jie, Xie, Qie, eae, tae, nae, rae, oae, sae, iae, aae, lae, cae, uae, dae, pae, fae, mae, gae, hae, _ae, yae, Sae, Eae, bae, Cae, vae, Aae, Rae, xae, Tae, wae, Oae, kae, Pae, Iae, Dae, Lae, Mae, Nae, Uae, Fae, zae, $ae, Hae, jae, Bae, Kae, Gae, Wae, Vae, qae, Zae, Yae, Jae, Xae, Qae, ele, tle, nle, rle, ole, sle, ile, ale, lle, cle, ule, dle, ple, fle, mle, gle, hle, _le, yle, Sle, Ele, ble, Cle, vle, Ale, Rle, xle, Tle, wle, Ole, kle, Ple, Ile, Dle, Lle, Mle, Nle, Ule, Fle, zle, $le, Hle, jle, Ble, Kle, Gle, Wle, Vle, qle, Zle, Yle, Jle, MS, Xle, Qle, ece, tce, nce, rce, oce, sce, ice, ace, lce, cce, uce, dce, pce, fce, mce, gce, hce, _ce, yce, Sce, Ece, bce, Cce, vce, Ace, Rce, xce, Tce, wce, Oce, kce, Pce, Ice, Dce, Lce, Mce, Nce, Uce, Fce, zce, $ce, Hce, jce, Bce, Kce, Gce, Wce, Vce, qce, Zce, Yce, Jce, Xce, Qce, eue, tue, nue, rue, oue, sue, iue, aue, lue, cue, uue, due, pue, fue, mue, gue, hue, _ue, yue, Sue, Eue, bue, Cue, vue, Aue, Rue, xue, Tue, wue, Oue, kue, Pue, Iue, Due, Lue, Mue, Nue, Uue, Fue, zue, $ue, Hue, jue, Bue, Kue, Gue, Wue, Vue, que, Zue, Yue, Jue, Xue, Que, ede, tde, nde, rde, ode, sde, ide, ade, lde, cde, ude, dde, pde, fde, mde, gde, hde, _de, yde, Sde, Ede, bde, Cde, vde, Ade, Rde, xde, Tde, wde, Ode, kde, Pde, Ide, Dde, Lde, Mde, Nde, Ude, Fde, zde, $de, Hde, jde, Bde, Kde, Gde, Wde, Vde, qde, Zde, Yde, Jde, Xde, Qde, epe, tpe, npe, rpe, ope, spe, ipe, ape, lpe, cpe, upe, dpe, ppe, fpe, mpe, gpe, hpe, _pe, ype, Spe, Epe, bpe, Cpe, vpe, Ape, Rpe, xpe, Tpe, wpe, Ope, kpe, Ppe, Ipe, Dpe, Lpe, Mpe, Npe, Upe, Fpe, zpe, $pe, Hpe, jpe, Bpe, Kpe, Gpe, Wpe, Vpe, qpe, Zpe, Ype, Jpe, Xpe, Qpe, efe, tfe, nfe, rfe, ofe, sfe, ife, afe, lfe, cfe, ufe, dfe, pfe, ffe, mfe, gfe, hfe, _fe, yfe, Sfe, Efe, bfe, Cfe, vfe, Afe, Rfe, xfe, Tfe, wfe, Ofe, kfe, Pfe, Ife, Dfe, Lfe, Mfe, Nfe, Ufe, Ffe, zfe, $fe, Hfe, jfe, Bfe, Kfe, Gfe, Wfe, Vfe, qfe, Zfe, Yfe, Jfe, Xfe, Qfe, eme, tme, nme, rme, ome, sme, ime, ame, lme, cme, ume, dme, pme, fme, mme, gme, hme, _me, yme, Sme, Eme, bme, Cme, vme, Ame, Rme, xme, Tme, wme, Ome, kme, Pme, Ime, Dme, Lme, Mme, Nme, Ume, Fme, zme, $me, Hme, jme, Bme, Kme, Gme, Wme, Vme, qme, Zme, Yme, Jme, NS, Xme, Qme, ege, tge, nge, rge, oge, sge, ige, age, lge, cge, uge, dge, pge, fge, mge, gge, hge, _ge, yge, Sge, Ege, bge, Cge, vge, Age, Rge, xge, Tge, wge, Oge, kge, Pge, Ige, Dge, Lge, Mge, Nge, Uge, Fge, zge, $ge, Hge, US, jge, Bge, Kge, Gge, Wge, Vge, qge, Zge, Yge, Jge, Xge, Qge, ehe, the, nhe, rhe, ohe, she, ihe, ahe, lhe, che, uhe, dhe, phe, fhe, mhe, ghe, hhe, _he, yhe, She, Ehe, bhe, Che, vhe, Ahe, Rhe, xhe, The, whe, Ohe, khe, Phe, Ihe, Dhe, Lhe, Mhe, Nhe, FS, rI, oI, Uhe, Fhe, zhe, $he, Hhe, jhe, Bhe, Khe, Ghe, Whe, Vhe, qhe, Zhe, Yhe, Jhe, Xhe, Qhe, e_e, t_e, n_e, r_e, o_e, s_e, i_e, a_e, l_e, c_e, u_e, d_e, p_e, f_e, m_e, g_e, h_e, __e, y_e, S_e, E_e, b_e, C_e, v_e, A_e, R_e, x_e, T_e, w_e, O_e, k_e, P_e, I_e, D_e, L_e, M_e, N_e, U_e, F_e, z_e, $_e, H_e, j_e, B_e, K_e, G_e, W_e, V_e, q_e, Z_e, Y_e, J_e, Q_e, Xn, eye, F8e, tye, z8e, nye, iI, rye, oye, lI, cye, uye, dye, _ye, on, vye, Aye, dI, C7e, v7e, ho, kI, PI, Dye, Sf, Lye, jc, Mye, Nye, LI, NI, Fye, VS, zye, $ye, x7e, zI, YS, KI, GI, VI, Hye, qS, ls, Kye, Gye, oD, nE, sD, So, Yc, vn, Zye, oE, sE, iD, aD, wf, Jc, Xc, kf, Qc, Pf, eu, fi, tu, mi, lD, cD, uD, dD, pD, fD, mD, gD, hD, _D, yD, SD, ED, bD, vD, AD, cE, RD, Xye, TD, wD, OD, kD, PD, uE, ID, DD, LD, MD, FD, If, nu, zD, $D, HD, jD, BD, zt, dE, Df, pE, fE, KD, GD, WD, VD, qD, ru, ZD, YD, JD, XD, QD, eL, tL, mE, yr, He, rL, ou, Je, yE, SE, EE, fL, mL, tSe, bE, CE, vE, AE, RE, xE, TE, wE, gL, hL, _L, yL, OE, sSe, kE, PE, IE, DE, LE, ME, NE, Nf, UE, FE, zE, $E, HE, jE, BE, cSe, gE, KE, vL, Uf, GE, WE, VE, qE, ZE, YE, Ff, JE, XE, QE, eb, tb, nb, zf, AL, rb, ob, sb, TL, ab, RL, xL, $f, Hf, dSe, fSe, OL, kL, Sr, FL, ML, zL, lu, hSe, iC, aC, lC, HL, jL, cC, uC, BL, dC, KL, pC, GL, fC, mC, WL, VL, qL, ZL, gC, YL, hC, JL, XL, _C, yC, SC, EC, QL, sC, bC, CC, vC, AC, RC, xC, TC, wC, OC, tM, qf, kC, $L, rM, ASe, Fn, oM, sM, iM, aM, lM, cM, uM, dM, pM, fM, mM, gM, Be, SM, LC, ct, MC, EM, bM, CM, pEe, fEe, Yf, mEe, gEe, hEe, _Ee, yEe, SEe, EEe, bEe, CEe, vEe, AEe, REe, xEe, TEe, wEe, OEe, NC, kEe, vM, PEe, IEe, DEe, LEe, MEe, fu, AM, NEe, UEe, IC, DC, FEe, zEe, qa, TM, HEe, jEe, KEe, wM, em, mu, qEe, ZEe, JEe, OM, Qn, kM, LM, nbe, rbe, abe, lbe, cbe, rm, pbe, At, hbe, BC, BM, Zet, WM, VM, qM, ZM, Cbe, vbe, YM, Abe, Rbe, JM, xbe, Tbe, QM, Ibe, eN, Lbe, nN, Mbe, Nbe, sm, rN, iN, Fbe, aN, $be, jbe, Kbe, Gbe, yu, lN, uN, dN, Xbe, KM, Qbe, eCe, tCe, oCe, iCe, _N, yN, wN, Ytt, ON, OCe, DCe, LN, $Ce, HCe, Cu, BCe, MN, VCe, QCe, ive, uve, VN, pve, fve, _rt, gve, Sve, nv, tv, GN, tU, Fve, Hve, iU, tAe, sAe, iAe, aAe, cAe, Ie, bU, Q, vo, F, zn, fAe, ms, mAe, _m, nn, he, Xa, an, lv, cv, Si, wu, se, br, CU, Oe, gAe, hAe, _Ae, yAe, SAe, EAe, bAe, CAe, vAe, uv, AAe, RAe, xAe, TAe, wAe, OAe, vU, kAe, Ro, el, tl, ym, ku, Sm, Pu, Iu, Em, Ei, xo, bm, Fr, ft, Du, Ao, pv, Lu, To, Cm, vm, nl, Ou, Mu, Nu, bi, Uu, rl, $r, zr, gs, Fu, zu, Am, fv, Rm, $u, wot, H, Oot, kot, Pot, Iot, Dot, Lot, Mot, Not, Uot, Fot, zot, $ot, Hot, jot, xU, Bot, Kot, Got, Wot, Vot, qot, Zot, Yot, Jot, Xot, Qot, est, tst, nst, rst, ost, sst, ist, ast, FAe, zAe, gv, OU, Ss, km, Mt, kU, PU, kst, HAe, jAe, hv, $n, Hu, IU, Yt, tr, nr, Jt, Pm, DU, _v, LU, MU, yv, ju, le, Sv, NU, Pst, Ist, Im, BAe, Dm, KAe, Bu, ol, UU, GAe, WAe, VAe, qAe, ZAe, YAe, Ev, JAe, XAe, bv, Lm, QAe, eRe, Mm, tRe, Ku, Gu, nRe, Wu, sl, rRe, Vu, Nm, Um, Fm, Dst, zm, $m, Hm, FU, zU, $U, Cv, HU, qu, il, jU, oRe, jm, sRe, Bm, iRe, vv, aRe, Km, lRe, cRe, uRe, dRe, pRe, fRe, mRe, gRe, hRe, _Re, Gm, yRe, SRe, Wm, Av, Rv, xv, ERe, bRe, CRe, Tv, vRe, ARe, RRe, xRe, TRe, BU, Vm, wRe, qm, Lst, ORe, al, kRe, Mst, Zu, PRe, wv, IRe, DRe, LRe, MRe, NRe, URe, FRe, Om, zRe, $Re, HRe, Yu, Ov, jRe, BRe, KRe, GRe, WRe, VRe, qRe, ZRe, YRe, JRe, XRe, QRe, exe, txe, nxe, rxe, oxe, sxe, ll, ixe, axe, lxe, Zm, cxe, uxe, dxe, kv, pxe, Nst, Ust, Fst, zst, $st, Hst, ae, WU, qU, VU, ZU, YU, Ym, e0, fxe, mxe, Dv, Cr, gxe, Ju, d0, h0, _0, v0, A0, Sxe, Exe, Mv, Cxe, Fv, Oj, kj, PA, IA, DA, Lj, Dj, aLe, NA, FA, uLe, dd, fLe, Po, SLe, ELe, zA, bLe, xLe, TLe, wLe, OLe, kLe, $j, qj, ILe, DLe, LLe, MLe, Ce, NLe, Wg, Oi, VA, Do, Jj, Xj, Qj, eB, tB, nB, qA, ZA, jA, Bj, jLe, BLe, GLe, rB, BA, Gg, GA, WA, VLe, qLe, Kj, Hs, sB, QLe, YA, iB, uB, eMe, dB, pB, fB, mB, tMe, XA, aB, QA, gB, hB, _B, yB, jn, lMe, SB, dMe, bB, mMe, fd, RB, hMe, Rr, TB, SMe, EMe, Pl, wB, Vg, AMe, Il, RMe, xMe, qg, OB, wMe, OMe, kB, eo, Dl, Zg, DB, NMe, FB, WMe, VMe, $B, HB, jB, BB, Ml, GB, nR, WB, Jg, KB, eNe, Bs, VB, gd, Nl, Xg, tNe, YB, qB, Pi, rK, iK, pNe, hd, _d, to, yd, nh, uK, aK, _Ne, lK, cK, Sd, Ul, rh, oh, dK, CNe, pK, sh, fK, RNe, xNe, TNe, mK, wNe, ONe, ih, Ed, lr, gK, hK, yK, SK, EK, ah, bK, FNe, CK, zNe, $Ne, HNe, vK, BNe, lh, AK, RK, xK, VNe, dn, TK, wK, OK, kK, PK, QNe, eUe, IK, DK, rUe, LK, MK, NK, UK, iUe, aUe, lUe, cUe, uUe, dUe, pUe, fUe, mUe, gUe, hUe, _Ue, yUe, SUe, EUe, bUe, CUe, vUe, AUe, FK, xUe, zK, $K, wUe, HK, OUe, jK, BK, PUe, KK, IUe, DUe, LUe, GK, MUe, NUe, UUe, FUe, WK, zUe, $Ue, HUe, VK, jUe, BUe, KUe, GUe, WUe, VUe, qUe, ZUe, YUe, JUe, XUe, QUe, e0e, t0e, n0e, r0e, Xe, qK, ZK, YK, JK, a0e, l0e, uh, XK, QK, e1, n1, r1, dh, m0e, g0e, h0e, _0e, bd, o1, S0e, Fl, s1, b0e, i1, Di, a1, l1, c1, u1, d1, p1, f1, P0e, I0e, m1, D0e, g1, h1, _1, vyt, U0e, y1, Ayt, iR, F0e, z0e, $0e, Gs, zl, fh, E1, b1, H0e, j0e, B0e, K0e, mh, $l, gh, Ws, aR, hh, _h, G0e, W0e, lR, R1, x1, V0e, uR, k1, P1, I1, D1, L1, Y0e, dR, J0e, Fyt, pR, X0e, fR, mR, Q0e, zyt, eFe, gR, hR, _R, $yt, M1, yR, N1, U1, tFe, nFe, rFe, oFe, iFe, Mi, cFe, $1, Wyt, Vyt, H1, j1, B1, K1, uFe, G1, W1, V1, q1, dFe, pFe, SR, fFe, eSt, tSt, mFe, jl, Vs, gFe, Y1, hFe, _Fe, X1, Q1, eG, yFe, SFe, tG, EFe, bFe, CFe, vFe, bR, CR, RFe, xFe, vR, TFe, Eh, nSt, Cd, wFe, OFe, aSt, rG, PFe, IFe, _St, oG, sG, bSt, CSt, HFe, jFe, $St, BFe, KFe, HSt, JSt, XSt, lG, OR, VFe, YFe, uG, eze, nze, gG, vd, vh, kR, zi, sze, yG, ize, yEt, Ad, $i, bG, Kn, AEt, REt, xEt, aze, AG, wG, $R, dze, $G, pze, fze, mze, gze, hze, BR, HG, jG, fbt, yze, Sze, Eze, Gn, ji, kG, PG, NR, UR, KR, GG, Cze, vze, Rze, GR, xze, Tze, xh, WR, Oze, kze, mbt, Pze, Ize, Dze, Lze, Mze, Nze, qG, Uze, Fze, zze, $ze, ZG, Hze, IG, jze, Bze, YG, Kze, Gze, DG, Wze, Vze, JG, qze, Zze, Yze, Jze, QG, Xze, Qze, e$e, t$e, r$e, o$e, s$e, i$e, a$e, eW, nW, c$e, m$e, xd, VR, gbt, hbt, _bt, h$e, qR, Th, MR, aW, _$e, S$e, lW, E$e, b$e, C$e, v$e, A$e, x$e, w$e, O$e, k$e, P$e, I$e, N$e, ybt, FR, Sbt, U$e, MG, Td, Ebt, bbt, uW, z$e, $$e, H$e, Cbt, j$e, B$e, vbt, Abt, K$e, Rbt, Oh, kh, G$e, YR, Ph, W$e, Ih, Mbt, Nbt, Ubt, Dh, V$e, Z$e, tx, EW, Id, Fh, X$e, xCt, Q$e, eHe, ix, ax, lx, cx, zh, $h, MW, tHe, nHe, aHe, uHe, dHe, Zs, pHe, CW, vW, AW, Nh, UW, fHe, mHe, gHe, hHe, _He, yHe, SHe, EHe, pn, dx, nx, Mh, Bi, AHe, TCt, xHe, Pd, RW, THe, xW, wHe, OHe, Hh, kHe, TW, fx, Bh, Ki, KW, Gl, PHe, Kh, kW, Wl, NHe, Ld, UHe, tV, rV, jHe, XHe, cvt, tje, fV, mV, sje, aje, _V, yV, pje, zvt, $vt, gje, yje, Sje, Kvt, Gvt, eAt, RV, Eje, bje, mAt, Cje, gAt, xV, wV, OV, Js, Lje, FV, Yh, Jh, Md, Tx, zV, $V, HV, Xh, jV, cr, KV, Mo, Fje, zje, yRt, jje, Gje, Vje, sBe, YV, e22, o_, gBe, t2, s_, kx, o2, LBe, UBe, $x, Vi, R2, KBe, GBe, Dx, ZBe, k2, n_, l2, sKe, lKe, z2, bKe, RKe, ec, W2, H2, xKe, wKe, PKe, IKe, $Ke, X2, HKe, jKe, BKe, KKe, VKe, eTt, qKe, tTt, nTt, ZKe, rTt, YKe, oTt, JKe, Wx, XKe, iTt, eq, tq, QKe, nq, rq, e1e, t1e, oq, sq, n1e, r1e, aTt, lTt, c1e, Zx, cq, u1e, uq, a_, d1e, Xx, nc, S1e, c_, mq, gq, Qx, hq, _q, E1e, Sq, u_, rc, d_, b1e, bq, Uo, Cq, vq, A1e, Yd, Jd, R1e, x1e, Aq, gn, T1e, w1e, O1e, Xs, k1e, P1e, xq, Pwt, I1e, Oq, kq, Pq, D1e, L1e, Iq, M1e, N1e, nT, U1e, p_, rT, Dq, oT, iT, F1e, Uq, aT, jq, K1e, Gq, yOt, sGe, cGe, uGe, yGe;
77449
77459
  var init_sdk = __esm({
77450
77460
  "node_modules/.pnpm/@anthropic-ai+claude-agent-sdk@0.3.292_@anthropic-ai+sdk@0.131.0_zod@4.6.5__@modelconte_9caa915130557974815a7ac66b010e49/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs"() {
77451
77461
  import_node_module = require("node:module");
77452
77462
  import_crypto = require("crypto");
77453
77463
  import_crypto2 = require("crypto");
77454
77464
  import_path = require("path");
77455
- import_node_fs14 = require("node:fs");
77465
+ import_node_fs15 = require("node:fs");
77456
77466
  import_node_process4 = require("node:process");
77457
77467
  import_fs = require("fs");
77458
77468
  import_os = require("os");
@@ -77476,7 +77486,7 @@ var init_sdk = __esm({
77476
77486
  import_path6 = require("path");
77477
77487
  import_promises6 = require("fs/promises");
77478
77488
  import_os4 = require("os");
77479
- import_node_path37 = __toESM(require("node:path"), 1);
77489
+ import_node_path39 = __toESM(require("node:path"), 1);
77480
77490
  import_node_os10 = __toESM(require("node:os"), 1);
77481
77491
  import_node_process5 = __toESM(require("node:process"), 1);
77482
77492
  import_path7 = require("path");
@@ -85927,16 +85937,16 @@ var init_sdk = __esm({
85927
85937
  wS = import_node_os10.default.tmpdir();
85928
85938
  ({ env: Fa } = import_node_process5.default);
85929
85939
  K7 = (e14) => {
85930
- let t10 = import_node_path37.default.join(is, "Library");
85931
- return { data: import_node_path37.default.join(t10, "Application Support", e14), config: import_node_path37.default.join(t10, "Preferences", e14), cache: import_node_path37.default.join(t10, "Caches", e14), log: import_node_path37.default.join(t10, "Logs", e14), temp: import_node_path37.default.join(wS, e14) };
85940
+ let t10 = import_node_path39.default.join(is, "Library");
85941
+ return { data: import_node_path39.default.join(t10, "Application Support", e14), config: import_node_path39.default.join(t10, "Preferences", e14), cache: import_node_path39.default.join(t10, "Caches", e14), log: import_node_path39.default.join(t10, "Logs", e14), temp: import_node_path39.default.join(wS, e14) };
85932
85942
  };
85933
85943
  G7 = (e14) => {
85934
- let t10 = Fa.APPDATA || import_node_path37.default.join(is, "AppData", "Roaming"), n10 = Fa.LOCALAPPDATA || import_node_path37.default.join(is, "AppData", "Local");
85935
- return { data: import_node_path37.default.join(n10, e14, "Data"), config: import_node_path37.default.join(t10, e14, "Config"), cache: import_node_path37.default.join(n10, e14, "Cache"), log: import_node_path37.default.join(n10, e14, "Log"), temp: import_node_path37.default.join(wS, e14) };
85944
+ let t10 = Fa.APPDATA || import_node_path39.default.join(is, "AppData", "Roaming"), n10 = Fa.LOCALAPPDATA || import_node_path39.default.join(is, "AppData", "Local");
85945
+ return { data: import_node_path39.default.join(n10, e14, "Data"), config: import_node_path39.default.join(t10, e14, "Config"), cache: import_node_path39.default.join(n10, e14, "Cache"), log: import_node_path39.default.join(n10, e14, "Log"), temp: import_node_path39.default.join(wS, e14) };
85936
85946
  };
85937
85947
  W7 = (e14) => {
85938
- let t10 = import_node_path37.default.basename(is);
85939
- return { data: import_node_path37.default.join(Fa.XDG_DATA_HOME || import_node_path37.default.join(is, ".local", "share"), e14), config: import_node_path37.default.join(Fa.XDG_CONFIG_HOME || import_node_path37.default.join(is, ".config"), e14), cache: import_node_path37.default.join(Fa.XDG_CACHE_HOME || import_node_path37.default.join(is, ".cache"), e14), log: import_node_path37.default.join(Fa.XDG_STATE_HOME || import_node_path37.default.join(is, ".local", "state"), e14), temp: import_node_path37.default.join(wS, t10, e14) };
85948
+ let t10 = import_node_path39.default.basename(is);
85949
+ return { data: import_node_path39.default.join(Fa.XDG_DATA_HOME || import_node_path39.default.join(is, ".local", "share"), e14), config: import_node_path39.default.join(Fa.XDG_CONFIG_HOME || import_node_path39.default.join(is, ".config"), e14), cache: import_node_path39.default.join(Fa.XDG_CACHE_HOME || import_node_path39.default.join(is, ".cache"), e14), log: import_node_path39.default.join(Fa.XDG_STATE_HOME || import_node_path39.default.join(is, ".local", "state"), e14), temp: import_node_path39.default.join(wS, t10, e14) };
85940
85950
  };
85941
85951
  i5e = OS("claude-cli");
85942
85952
  X7 = 100;
@@ -111645,16 +111655,502 @@ function registerCodexCommand(program2, deps) {
111645
111655
 
111646
111656
  // src/frontdoor/commands.ts
111647
111657
  var import_node_crypto20 = require("node:crypto");
111648
- var import_node_path47 = __toESM(require("node:path"), 1);
111649
- var import_node_fs16 = __toESM(require("node:fs"), 1);
111658
+ var import_node_path48 = __toESM(require("node:path"), 1);
111659
+ var import_node_fs17 = __toESM(require("node:fs"), 1);
111650
111660
  init_commandDeps();
111651
111661
  init_schema();
111662
+ init_conditions();
111663
+
111664
+ // src/agents/realFs.ts
111665
+ var import_node_fs12 = __toESM(require("node:fs"), 1);
111666
+ init_realPorts();
111667
+ var realSessionFs = {
111668
+ ...realFarmFs,
111669
+ realpath: (candidate) => {
111670
+ try {
111671
+ return import_node_fs12.default.realpathSync(candidate);
111672
+ } catch {
111673
+ return void 0;
111674
+ }
111675
+ }
111676
+ };
111677
+
111678
+ // src/agents/sessions.ts
111679
+ var import_node_path33 = __toESM(require("node:path"), 1);
111680
+ init_cliError();
111681
+
111682
+ // src/agents/read.ts
111683
+ var import_node_path32 = __toESM(require("node:path"), 1);
111684
+ init_zod();
111685
+
111686
+ // src/agents/schema.ts
111687
+ init_zod();
111688
+ var AgentMetaSchema = external_exports.looseObject({
111689
+ agentType: external_exports.string(),
111690
+ isFork: external_exports.boolean().optional(),
111691
+ description: external_exports.string().optional(),
111692
+ name: external_exports.string().optional(),
111693
+ toolUseId: external_exports.string().optional(),
111694
+ spawnDepth: external_exports.number().int().nonnegative().optional(),
111695
+ parentAgentId: external_exports.string().optional(),
111696
+ model: external_exports.string().optional(),
111697
+ requestShape: external_exports.string().optional(),
111698
+ requestNonInteractive: external_exports.boolean().optional(),
111699
+ workflowPhase: external_exports.string().optional(),
111700
+ taskKind: external_exports.string().optional(),
111701
+ teamName: external_exports.string().optional(),
111702
+ worktreePath: external_exports.string().optional(),
111703
+ worktreeBranch: external_exports.string().optional(),
111704
+ stoppedByUser: external_exports.boolean().optional()
111705
+ });
111706
+ var AgentKindSchema = external_exports.enum(["subagent", "fork", "workflow-agent", "teammate"]);
111707
+ var AgentNodeFields = {
111708
+ id: external_exports.string(),
111709
+ kind: AgentKindSchema,
111710
+ agentType: external_exports.string(),
111711
+ description: external_exports.string().optional(),
111712
+ name: external_exports.string().optional(),
111713
+ toolUseId: external_exports.string().optional(),
111714
+ spawnDepth: external_exports.number().int().nonnegative().optional(),
111715
+ model: external_exports.string().optional(),
111716
+ background: external_exports.boolean().optional(),
111717
+ workflowRunId: external_exports.string().optional(),
111718
+ workflowPhase: external_exports.string().optional(),
111719
+ teamName: external_exports.string().optional(),
111720
+ stoppedByUser: external_exports.boolean().optional(),
111721
+ transcript: external_exports.string()
111722
+ };
111723
+ var AgentNodeSchema = external_exports.lazy(() => external_exports.strictObject({ ...AgentNodeFields, children: external_exports.array(AgentNodeSchema) }));
111724
+ var TaskItemSchema = external_exports.strictObject({
111725
+ id: external_exports.string(),
111726
+ subject: external_exports.string(),
111727
+ description: external_exports.string().optional(),
111728
+ status: external_exports.string(),
111729
+ /** What a spinner shows while the task runs. */
111730
+ activeForm: external_exports.string().optional(),
111731
+ /** The teammate or agent name the task is assigned to, as Agent Teams writes it. */
111732
+ owner: external_exports.string().optional(),
111733
+ /** Free-form data the harness attaches to a task, kept as written. */
111734
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
111735
+ blocks: external_exports.array(external_exports.string()),
111736
+ blockedBy: external_exports.array(external_exports.string()),
111737
+ /** The id of the shared task list this task belongs to (a team's name, or a custom list id), absent for the session's own list. */
111738
+ taskList: external_exports.string().optional()
111739
+ });
111740
+ var WorkflowRunSchema = external_exports.strictObject({
111741
+ runId: external_exports.string(),
111742
+ workflowName: external_exports.string().optional(),
111743
+ status: external_exports.string().optional(),
111744
+ startTime: external_exports.number().optional(),
111745
+ phases: external_exports.array(external_exports.string()),
111746
+ summary: external_exports.string().optional()
111747
+ });
111748
+ var AgentTreeProblemSchema = external_exports.strictObject({
111749
+ /** Relative to the identity's configuration directory. */
111750
+ path: external_exports.string(),
111751
+ reason: external_exports.string()
111752
+ });
111753
+ var SessionSummarySchema = external_exports.strictObject({
111754
+ project: external_exports.string(),
111755
+ sessionId: external_exports.string(),
111756
+ superseded: external_exports.boolean(),
111757
+ /** The directory and transcript stem exactly as on disk, which differs from `sessionId` for a superseded session. */
111758
+ entry: external_exports.string(),
111759
+ agentCount: external_exports.number().int().nonnegative(),
111760
+ workflowRunCount: external_exports.number().int().nonnegative(),
111761
+ /** When the transcript was last written, as an ISO instant; absent when there is no transcript file. */
111762
+ updatedAt: external_exports.iso.datetime().optional(),
111763
+ identities: external_exports.array(external_exports.string())
111764
+ });
111765
+ var SessionAgentTreeSchema = external_exports.strictObject({
111766
+ project: external_exports.string(),
111767
+ sessionId: external_exports.string(),
111768
+ /** True for a session directory a resume superseded (`<session-id>.superseded-<epoch-ms>`). */
111769
+ superseded: external_exports.boolean(),
111770
+ /** The agents the session itself spawned, each with its descendants. */
111771
+ agents: external_exports.array(AgentNodeSchema),
111772
+ tasks: external_exports.array(TaskItemSchema),
111773
+ workflowRuns: external_exports.array(WorkflowRunSchema),
111774
+ problems: external_exports.array(AgentTreeProblemSchema)
111775
+ });
111776
+
111777
+ // src/agents/read.ts
111778
+ var PROJECTS_DIR = "projects";
111779
+ var TASKS_DIR = "tasks";
111780
+ var SUBAGENTS_DIR = "subagents";
111781
+ var WORKFLOWS_DIR = "workflows";
111782
+ var AGENT_FILE_PREFIX = "agent-";
111783
+ var META_SUFFIX = ".meta.json";
111784
+ var TRANSCRIPT_SUFFIX = ".jsonl";
111785
+ var SHORT_SESSION_ID_LENGTH = 8;
111786
+ var SHORT_SESSION_LIST_PREFIX = "session-";
111787
+ var JSON_SUFFIX = ".json";
111788
+ var WORKFLOW_RUN_PREFIX = "wf_";
111789
+ var ARCHIVED_RE = /^(.+)\.(?:superseded|orphaned)-.+$/;
111790
+ var FORK_AGENT_TYPE = "fork";
111791
+ var WORKFLOW_AGENT_TYPE = "workflow-subagent";
111792
+ var TEAMMATE_TASK_KIND = "in_process_teammate";
111793
+ var BACKGROUND_REQUEST_SHAPE = "background";
111794
+ var SESSION_SPAWN_DEPTH = 1;
111795
+ function parseEntry2(project, entry) {
111796
+ const match = ARCHIVED_RE.exec(entry);
111797
+ const base = match?.[1];
111798
+ return base === void 0 ? { project, sessionId: entry, superseded: false, entry } : { project, sessionId: base, superseded: true, entry };
111799
+ }
111800
+ function listSessions2(fs22, configDir) {
111801
+ const found = [];
111802
+ for (const project of fs22.readdir(import_node_path32.default.join(configDir, PROJECTS_DIR))) {
111803
+ const projectDir = import_node_path32.default.join(configDir, PROJECTS_DIR, project);
111804
+ const entries = /* @__PURE__ */ new Set();
111805
+ for (const name of fs22.readdir(projectDir)) {
111806
+ if (name.endsWith(TRANSCRIPT_SUFFIX)) {
111807
+ entries.add(name.slice(0, -TRANSCRIPT_SUFFIX.length));
111808
+ continue;
111809
+ }
111810
+ const children = fs22.readdir(import_node_path32.default.join(projectDir, name));
111811
+ if (children.includes(SUBAGENTS_DIR) || children.includes(WORKFLOWS_DIR)) {
111812
+ entries.add(name);
111813
+ }
111814
+ }
111815
+ for (const entry of entries) {
111816
+ found.push(parseEntry2(project, entry));
111817
+ }
111818
+ }
111819
+ return found.sort((left, right) => left.project.localeCompare(right.project) || left.entry.localeCompare(right.entry));
111820
+ }
111821
+ function locateAgents(fs22, configDir, relativeDir, workflowRunId, report) {
111822
+ const located = [];
111823
+ for (const name of listDirOrReport(fs22, configDir, relativeDir, report)) {
111824
+ if (!name.startsWith(AGENT_FILE_PREFIX) || !name.endsWith(META_SUFFIX)) {
111825
+ continue;
111826
+ }
111827
+ const id2 = name.slice(AGENT_FILE_PREFIX.length, -META_SUFFIX.length);
111828
+ located.push({
111829
+ id: id2,
111830
+ metaPath: import_node_path32.default.join(relativeDir, name),
111831
+ transcriptPath: import_node_path32.default.join(relativeDir, `${AGENT_FILE_PREFIX}${id2}${TRANSCRIPT_SUFFIX}`),
111832
+ workflowRunId
111833
+ });
111834
+ }
111835
+ return located;
111836
+ }
111837
+ function kindOf(meta3, workflowRunId) {
111838
+ if (meta3.isFork === true || meta3.agentType === FORK_AGENT_TYPE) {
111839
+ return "fork";
111840
+ }
111841
+ if (workflowRunId !== void 0 || meta3.agentType === WORKFLOW_AGENT_TYPE) {
111842
+ return "workflow-agent";
111843
+ }
111844
+ if (meta3.taskKind === TEAMMATE_TASK_KIND || meta3.teamName !== void 0) {
111845
+ return "teammate";
111846
+ }
111847
+ return "subagent";
111848
+ }
111849
+ function toNode(read, children) {
111850
+ const { located, meta: meta3 } = read;
111851
+ return {
111852
+ id: located.id,
111853
+ kind: kindOf(meta3, located.workflowRunId),
111854
+ agentType: meta3.agentType,
111855
+ ...meta3.description === void 0 ? {} : { description: meta3.description },
111856
+ ...meta3.name === void 0 ? {} : { name: meta3.name },
111857
+ ...meta3.toolUseId === void 0 ? {} : { toolUseId: meta3.toolUseId },
111858
+ ...meta3.spawnDepth === void 0 ? {} : { spawnDepth: meta3.spawnDepth },
111859
+ ...meta3.model === void 0 ? {} : { model: meta3.model },
111860
+ ...meta3.requestShape === void 0 ? {} : { background: meta3.requestShape === BACKGROUND_REQUEST_SHAPE },
111861
+ ...located.workflowRunId === void 0 ? {} : { workflowRunId: located.workflowRunId },
111862
+ ...meta3.workflowPhase === void 0 ? {} : { workflowPhase: meta3.workflowPhase },
111863
+ ...meta3.teamName === void 0 ? {} : { teamName: meta3.teamName },
111864
+ ...meta3.stoppedByUser === void 0 ? {} : { stoppedByUser: meta3.stoppedByUser },
111865
+ transcript: located.transcriptPath,
111866
+ children
111867
+ };
111868
+ }
111869
+ function describeFailure(error63) {
111870
+ return error63 instanceof Error ? error63.message : String(error63);
111871
+ }
111872
+ function readFileOrReport(fs22, configDir, relative, report) {
111873
+ try {
111874
+ return fs22.readFileUtf8(import_node_path32.default.join(configDir, relative));
111875
+ } catch (error63) {
111876
+ report({ path: relative, reason: `could not be read: ${describeFailure(error63)}` });
111877
+ return void 0;
111878
+ }
111879
+ }
111880
+ function listDirOrReport(fs22, configDir, relative, report) {
111881
+ try {
111882
+ return fs22.readdir(import_node_path32.default.join(configDir, relative));
111883
+ } catch (error63) {
111884
+ report({ path: relative, reason: `could not be listed: ${describeFailure(error63)}` });
111885
+ return [];
111886
+ }
111887
+ }
111888
+ function parseJson3(text2) {
111889
+ try {
111890
+ const value2 = JSON.parse(text2);
111891
+ return value2;
111892
+ } catch {
111893
+ return void 0;
111894
+ }
111895
+ }
111896
+ var TaskFileSchema = external_exports.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: external_exports.array(external_exports.string()).default([]), blockedBy: external_exports.array(external_exports.string()).default([]) });
111897
+ var WorkflowRunFileSchema = external_exports.object({
111898
+ runId: external_exports.string(),
111899
+ workflowName: external_exports.string().optional(),
111900
+ status: external_exports.string().optional(),
111901
+ startTime: external_exports.number().optional(),
111902
+ phases: external_exports.array(external_exports.object({ title: external_exports.string() })).default([]),
111903
+ summary: external_exports.string().optional()
111904
+ });
111905
+ function summariseSession(fs22, configDir, ref) {
111906
+ const sessionRelative = import_node_path32.default.join(PROJECTS_DIR, ref.project, ref.entry);
111907
+ const subagentsRelative = import_node_path32.default.join(sessionRelative, SUBAGENTS_DIR);
111908
+ const workflowsUnderSubagents = import_node_path32.default.join(subagentsRelative, WORKFLOWS_DIR);
111909
+ const isMeta = (name) => name.startsWith(AGENT_FILE_PREFIX) && name.endsWith(META_SUFFIX);
111910
+ let agentCount = fs22.readdir(import_node_path32.default.join(configDir, subagentsRelative)).filter(isMeta).length;
111911
+ for (const runDir of fs22.readdir(import_node_path32.default.join(configDir, workflowsUnderSubagents))) {
111912
+ if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
111913
+ agentCount += fs22.readdir(import_node_path32.default.join(configDir, workflowsUnderSubagents, runDir)).filter(isMeta).length;
111914
+ }
111915
+ }
111916
+ const workflowRunCount = fs22.readdir(import_node_path32.default.join(configDir, sessionRelative, WORKFLOWS_DIR)).filter((name) => name.startsWith(WORKFLOW_RUN_PREFIX) && name.endsWith(JSON_SUFFIX)).length;
111917
+ const transcript = fs22.lstat(import_node_path32.default.join(configDir, PROJECTS_DIR, ref.project, `${ref.entry}${TRANSCRIPT_SUFFIX}`));
111918
+ return { ...ref, agentCount, workflowRunCount, ...transcript === void 0 ? {} : { updatedAt: new Date(transcript.mtimeMs).toISOString() } };
111919
+ }
111920
+ function readSessionAgentTree(fs22, configDir, ref, options = {}) {
111921
+ const problems = [];
111922
+ const report = (problem) => {
111923
+ problems.push(problem);
111924
+ };
111925
+ const sessionRelative = import_node_path32.default.join(PROJECTS_DIR, ref.project, ref.entry);
111926
+ const subagentsRelative = import_node_path32.default.join(sessionRelative, SUBAGENTS_DIR);
111927
+ const workflowsUnderSubagents = import_node_path32.default.join(subagentsRelative, WORKFLOWS_DIR);
111928
+ const located = locateAgents(fs22, configDir, subagentsRelative, void 0, report);
111929
+ for (const runDir of listDirOrReport(fs22, configDir, workflowsUnderSubagents, report)) {
111930
+ if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
111931
+ located.push(...locateAgents(fs22, configDir, import_node_path32.default.join(workflowsUnderSubagents, runDir), runDir, report));
111932
+ }
111933
+ }
111934
+ const agents = /* @__PURE__ */ new Map();
111935
+ for (const candidate of located) {
111936
+ const text2 = readFileOrReport(fs22, configDir, candidate.metaPath, report);
111937
+ if (text2 === void 0) {
111938
+ continue;
111939
+ }
111940
+ const parsed = AgentMetaSchema.safeParse(parseJson3(text2));
111941
+ if (!parsed.success) {
111942
+ report({ path: candidate.metaPath, reason: "meta file is not a JSON object with an agentType" });
111943
+ continue;
111944
+ }
111945
+ agents.set(candidate.id, { located: candidate, meta: parsed.data });
111946
+ }
111947
+ const teamNames = [...new Set([...agents.values()].flatMap((agent) => agent.meta.teamName === void 0 ? [] : [agent.meta.teamName]))].sort();
111948
+ const parentOf4 = resolveParents(fs22, configDir, agents, report);
111949
+ const childrenOf = /* @__PURE__ */ new Map();
111950
+ const roots = [];
111951
+ for (const id2 of agents.keys()) {
111952
+ const parent = parentOf4.get(id2);
111953
+ if (parent === void 0) {
111954
+ roots.push(id2);
111955
+ } else {
111956
+ childrenOf.set(parent, [...childrenOf.get(parent) ?? [], id2]);
111957
+ }
111958
+ }
111959
+ const build = (id2) => {
111960
+ const read = agents.get(id2);
111961
+ if (read === void 0) {
111962
+ throw new Error(`agent ${id2} is in the tree but was never read`);
111963
+ }
111964
+ return toNode(read, (childrenOf.get(id2) ?? []).sort().map(build));
111965
+ };
111966
+ return {
111967
+ project: ref.project,
111968
+ sessionId: ref.sessionId,
111969
+ superseded: ref.superseded,
111970
+ agents: roots.sort().map(build),
111971
+ tasks: readTasks(fs22, configDir, ownTaskLists(ref.sessionId), [.../* @__PURE__ */ new Set([...teamNames, ...options.taskListIds ?? []])].filter((id2) => !ownTaskLists(ref.sessionId).includes(id2)), report),
111972
+ workflowRuns: readWorkflowRuns(fs22, configDir, import_node_path32.default.join(sessionRelative, WORKFLOWS_DIR), report),
111973
+ problems
111974
+ };
111975
+ }
111976
+ function resolveParents(fs22, configDir, agents, report) {
111977
+ const parentOf4 = /* @__PURE__ */ new Map();
111978
+ const transcriptCache = /* @__PURE__ */ new Map();
111979
+ const transcriptOf = (agent) => {
111980
+ const cached2 = transcriptCache.get(agent.located.id);
111981
+ if (cached2 !== void 0) {
111982
+ return cached2;
111983
+ }
111984
+ const text2 = readFileOrReport(fs22, configDir, agent.located.transcriptPath, report) ?? "";
111985
+ transcriptCache.set(agent.located.id, text2);
111986
+ return text2;
111987
+ };
111988
+ const wouldCycle = (child, parent) => {
111989
+ for (let cursor3 = parent; cursor3 !== void 0; cursor3 = parentOf4.get(cursor3)) {
111990
+ if (cursor3 === child) {
111991
+ return true;
111992
+ }
111993
+ }
111994
+ return false;
111995
+ };
111996
+ const attach = (child, parent) => {
111997
+ if (wouldCycle(child.located.id, parent)) {
111998
+ report({ path: child.located.metaPath, reason: `parent ${parent} would make a cycle` });
111999
+ return;
112000
+ }
112001
+ parentOf4.set(child.located.id, parent);
112002
+ };
112003
+ for (const agent of agents.values()) {
112004
+ const { meta: meta3, located } = agent;
112005
+ if (meta3.parentAgentId !== void 0 && agents.has(meta3.parentAgentId)) {
112006
+ attach(agent, meta3.parentAgentId);
112007
+ continue;
112008
+ }
112009
+ const depth = meta3.spawnDepth;
112010
+ if (depth !== void 0 && depth <= SESSION_SPAWN_DEPTH || meta3.toolUseId === void 0) {
112011
+ if (meta3.parentAgentId !== void 0) {
112012
+ report({ path: located.metaPath, reason: `parentAgentId ${meta3.parentAgentId} names no agent in this session` });
112013
+ }
112014
+ continue;
112015
+ }
112016
+ const toolUseId = meta3.toolUseId;
112017
+ const owners = [...agents.values()].filter(
112018
+ (candidate) => candidate.located.id !== located.id && (depth === void 0 || candidate.meta.spawnDepth === void 0 || candidate.meta.spawnDepth === depth - 1) && candidate.located.workflowRunId === located.workflowRunId && transcriptOf(candidate).includes(toolUseId)
112019
+ );
112020
+ const owner = owners[0];
112021
+ if (owners.length === 1 && owner !== void 0) {
112022
+ attach(agent, owner.located.id);
112023
+ } else if (owners.length > 1) {
112024
+ report({ path: located.metaPath, reason: "more than one agent transcript records the call that spawned it" });
112025
+ } else if (depth !== void 0) {
112026
+ report({ path: located.metaPath, reason: "no agent transcript records the call that spawned it" });
112027
+ }
112028
+ }
112029
+ return parentOf4;
112030
+ }
112031
+ function ownTaskLists(sessionId) {
112032
+ return [sessionId, `${SHORT_SESSION_LIST_PREFIX}${sessionId.slice(0, SHORT_SESSION_ID_LENGTH)}`];
112033
+ }
112034
+ function readTasks(fs22, configDir, ownLists, sharedLists, report) {
112035
+ const tasks = [];
112036
+ [...ownLists, ...sharedLists].forEach((scope, index) => {
112037
+ const relativeDir = import_node_path32.default.join(TASKS_DIR, scope);
112038
+ for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
112039
+ if (name.startsWith(".") || !name.endsWith(JSON_SUFFIX)) {
112040
+ continue;
112041
+ }
112042
+ const relative = import_node_path32.default.join(relativeDir, name);
112043
+ const text2 = readFileOrReport(fs22, configDir, relative, report);
112044
+ const parsed = TaskFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson3(text2));
112045
+ if (parsed.success) {
112046
+ tasks.push(index < ownLists.length ? parsed.data : { ...parsed.data, taskList: scope });
112047
+ } else if (text2 !== void 0) {
112048
+ report({ path: relative, reason: "task file is not a task" });
112049
+ }
112050
+ }
112051
+ });
112052
+ return tasks;
112053
+ }
112054
+ function readWorkflowRuns(fs22, configDir, relativeDir, report) {
112055
+ const runs = [];
112056
+ for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
112057
+ if (!name.startsWith(WORKFLOW_RUN_PREFIX) || !name.endsWith(JSON_SUFFIX)) {
112058
+ continue;
112059
+ }
112060
+ const relative = import_node_path32.default.join(relativeDir, name);
112061
+ const text2 = readFileOrReport(fs22, configDir, relative, report);
112062
+ const parsed = WorkflowRunFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson3(text2));
112063
+ if (!parsed.success) {
112064
+ if (text2 !== void 0) {
112065
+ report({ path: relative, reason: "workflow run file is not a run record" });
112066
+ }
112067
+ continue;
112068
+ }
112069
+ const { phases, ...rest } = parsed.data;
112070
+ runs.push({ ...rest, phases: phases.map((phase) => phase.title) });
112071
+ }
112072
+ return runs;
112073
+ }
112074
+
112075
+ // src/agents/sessions.ts
112076
+ var SessionLookupError = class extends CliError {
112077
+ constructor(message) {
112078
+ super(message);
112079
+ this.name = "SessionLookupError";
112080
+ }
112081
+ };
112082
+ function identityConfigDir(identitiesDir, identity) {
112083
+ return import_node_path33.default.join(identitiesDir, identity);
112084
+ }
112085
+ function historyStores(fs22, identitiesDir, identities) {
112086
+ const byRealPath = /* @__PURE__ */ new Map();
112087
+ for (const identity of identities) {
112088
+ const configDir = identityConfigDir(identitiesDir, identity);
112089
+ const real = fs22.realpath(import_node_path33.default.join(configDir, "projects"));
112090
+ if (real === void 0) {
112091
+ continue;
112092
+ }
112093
+ const store = byRealPath.get(real);
112094
+ if (store === void 0) {
112095
+ byRealPath.set(real, { configDir, identities: [identity] });
112096
+ } else {
112097
+ store.identities.push(identity);
112098
+ }
112099
+ }
112100
+ return [...byRealPath.values()];
112101
+ }
112102
+ function collectSessionList(fs22, identitiesDir, identities, filters) {
112103
+ const names = filters.identity === void 0 ? identities : identities.filter((name) => name === filters.identity);
112104
+ if (filters.identity !== void 0 && names.length === 0) {
112105
+ throw new SessionLookupError(`no identity named "${filters.identity}"`);
112106
+ }
112107
+ const sessions = [];
112108
+ for (const store of historyStores(fs22, identitiesDir, names)) {
112109
+ for (const ref of listSessions2(fs22, store.configDir)) {
112110
+ const summary = summariseSession(fs22, store.configDir, ref);
112111
+ if (filters.all === true || summary.agentCount > 0 || summary.workflowRunCount > 0) {
112112
+ sessions.push({ ...summary, identities: store.identities });
112113
+ }
112114
+ }
112115
+ }
112116
+ return sessions.sort((left, right) => (right.updatedAt ?? "").localeCompare(left.updatedAt ?? "") || left.sessionId.localeCompare(right.sessionId));
112117
+ }
112118
+ function locateSession(fs22, identitiesDir, identities, query, onlyIdentity) {
112119
+ const names = onlyIdentity === void 0 ? identities : identities.filter((name) => name === onlyIdentity);
112120
+ if (onlyIdentity !== void 0 && names.length === 0) {
112121
+ throw new SessionLookupError(`no identity named "${onlyIdentity}"`);
112122
+ }
112123
+ const matches = [];
112124
+ for (const store of historyStores(fs22, identitiesDir, names)) {
112125
+ for (const ref of listSessions2(fs22, store.configDir)) {
112126
+ if (ref.sessionId.startsWith(query)) {
112127
+ matches.push({ identities: store.identities, configDir: store.configDir, ref });
112128
+ }
112129
+ }
112130
+ }
112131
+ const exact = matches.filter((match) => match.ref.sessionId === query);
112132
+ const candidates = exact.length > 0 ? exact : matches;
112133
+ const only = candidates[0];
112134
+ if (candidates.length === 1 && only !== void 0) {
112135
+ return only;
112136
+ }
112137
+ if (candidates.length === 0) {
112138
+ throw new SessionLookupError(`no session matches "${query}"`);
112139
+ }
112140
+ throw new SessionLookupError(`"${query}" matches ${String(candidates.length)} sessions: ${candidates.map((match) => `${match.ref.sessionId} (${match.identities.join(", ")})`).join("; ")}; give more of the id or pass --identity`);
112141
+ }
112142
+ function showSession(fs22, identitiesDir, identities, query, onlyIdentity) {
112143
+ const located = locateSession(fs22, identitiesDir, identities, query, onlyIdentity);
112144
+ return { identities: located.identities, tree: readSessionAgentTree(fs22, located.configDir, located.ref) };
112145
+ }
112146
+
112147
+ // src/frontdoor/commands.ts
111652
112148
  init_realPorts();
111653
112149
 
111654
112150
  // src/update/commands.ts
111655
- var import_node_fs13 = __toESM(require("node:fs"), 1);
112151
+ var import_node_fs14 = __toESM(require("node:fs"), 1);
111656
112152
  var import_node_os7 = __toESM(require("node:os"), 1);
111657
- var import_node_path34 = __toESM(require("node:path"), 1);
112153
+ var import_node_path36 = __toESM(require("node:path"), 1);
111658
112154
  init_package();
111659
112155
  init_commandDeps();
111660
112156
  init_store();
@@ -111686,10 +112182,10 @@ var realUpdatePorts = {
111686
112182
  }
111687
112183
  },
111688
112184
  fs: {
111689
- realpath: (target) => import_node_fs13.default.realpathSync(target),
112185
+ realpath: (target) => import_node_fs14.default.realpathSync(target),
111690
112186
  readFileUtf8: (filePath) => {
111691
112187
  try {
111692
- return import_node_fs13.default.readFileSync(filePath, "utf8");
112188
+ return import_node_fs14.default.readFileSync(filePath, "utf8");
111693
112189
  } catch (error63) {
111694
112190
  if (isEnoent5(error63)) {
111695
112191
  return void 0;
@@ -111699,7 +112195,7 @@ var realUpdatePorts = {
111699
112195
  },
111700
112196
  readFileBytes: (filePath) => {
111701
112197
  try {
111702
- return new Uint8Array(import_node_fs13.default.readFileSync(filePath));
112198
+ return new Uint8Array(import_node_fs14.default.readFileSync(filePath));
111703
112199
  } catch (error63) {
111704
112200
  if (isEnoent5(error63)) {
111705
112201
  return void 0;
@@ -111710,7 +112206,7 @@ var realUpdatePorts = {
111710
112206
  readFileHead: (filePath, length) => {
111711
112207
  let descriptor;
111712
112208
  try {
111713
- descriptor = import_node_fs13.default.openSync(filePath, "r");
112209
+ descriptor = import_node_fs14.default.openSync(filePath, "r");
111714
112210
  } catch (error63) {
111715
112211
  if (isEnoent5(error63)) {
111716
112212
  return void 0;
@@ -111719,21 +112215,21 @@ var realUpdatePorts = {
111719
112215
  }
111720
112216
  try {
111721
112217
  const buffer2 = Buffer.alloc(length);
111722
- const read = import_node_fs13.default.readSync(descriptor, buffer2, 0, length, 0);
112218
+ const read = import_node_fs14.default.readSync(descriptor, buffer2, 0, length, 0);
111723
112219
  return read === 0 ? "" : buffer2.toString("latin1", 0, read);
111724
112220
  } finally {
111725
- import_node_fs13.default.closeSync(descriptor);
112221
+ import_node_fs14.default.closeSync(descriptor);
111726
112222
  }
111727
112223
  },
111728
112224
  writeFileUtf8: (filePath, contents) => {
111729
- import_node_fs13.default.writeFileSync(filePath, contents, "utf8");
112225
+ import_node_fs14.default.writeFileSync(filePath, contents, "utf8");
111730
112226
  },
111731
112227
  writeFileBytes: (filePath, contents) => {
111732
- import_node_fs13.default.writeFileSync(filePath, contents);
112228
+ import_node_fs14.default.writeFileSync(filePath, contents);
111733
112229
  },
111734
112230
  writeFileExclusive: (filePath, contents) => {
111735
112231
  try {
111736
- import_node_fs13.default.writeFileSync(filePath, contents, { encoding: "utf8", flag: "wx" });
112232
+ import_node_fs14.default.writeFileSync(filePath, contents, { encoding: "utf8", flag: "wx" });
111737
112233
  return true;
111738
112234
  } catch (error63) {
111739
112235
  if (isErrorWithCode2(error63, "EEXIST")) {
@@ -111744,7 +112240,7 @@ var realUpdatePorts = {
111744
112240
  },
111745
112241
  unlink: (filePath) => {
111746
112242
  try {
111747
- import_node_fs13.default.unlinkSync(filePath);
112243
+ import_node_fs14.default.unlinkSync(filePath);
111748
112244
  } catch (error63) {
111749
112245
  if (!isEnoent5(error63)) {
111750
112246
  throw error63;
@@ -111752,14 +112248,14 @@ var realUpdatePorts = {
111752
112248
  }
111753
112249
  },
111754
112250
  rename: (from, to2) => {
111755
- import_node_fs13.default.renameSync(from, to2);
112251
+ import_node_fs14.default.renameSync(from, to2);
111756
112252
  },
111757
112253
  chmod: (filePath, mode) => {
111758
- import_node_fs13.default.chmodSync(filePath, mode);
112254
+ import_node_fs14.default.chmodSync(filePath, mode);
111759
112255
  },
111760
- mkdtemp: () => import_node_fs13.default.mkdtempSync(import_node_path34.default.join(import_node_os7.default.tmpdir(), "agent-shim-update-")),
112256
+ mkdtemp: () => import_node_fs14.default.mkdtempSync(import_node_path36.default.join(import_node_os7.default.tmpdir(), "agent-shim-update-")),
111761
112257
  rmRecursive: (targetPath) => {
111762
- import_node_fs13.default.rmSync(targetPath, { recursive: true, force: true });
112258
+ import_node_fs14.default.rmSync(targetPath, { recursive: true, force: true });
111763
112259
  }
111764
112260
  },
111765
112261
  // Signal 0 performs the permission and existence checks without delivering anything; EPERM means the process exists but belongs to another user.
@@ -111778,7 +112274,7 @@ function selfUpdateOptions(paths, checkOnly) {
111778
112274
  platform: process.platform,
111779
112275
  arch: process.arch,
111780
112276
  executablePath: realOwnExecutablePath(),
111781
- lockPath: import_node_path34.default.join(paths.root, "update.lock"),
112277
+ lockPath: import_node_path36.default.join(paths.root, "update.lock"),
111782
112278
  checkOnly,
111783
112279
  pid: process.pid
111784
112280
  };
@@ -111918,9 +112414,38 @@ init_anthropicUsageRefresh();
111918
112414
  init_poolPick();
111919
112415
  init_realAnthropicUsageProbe();
111920
112416
 
111921
- // src/usage/realJobRunner.ts
111922
- var import_node_path38 = __toESM(require("node:path"), 1);
111923
- init_conditions();
112417
+ // src/usage/childRun.ts
112418
+ var import_node_child_process5 = require("node:child_process");
112419
+ init_realPorts();
112420
+ var CHILD_GRACE_MS = 3e4;
112421
+ var STDERR_TAIL_CHARS = 2e3;
112422
+ async function runChild(options) {
112423
+ const invocation = (options.invocation ?? selfInvocation)(options.args);
112424
+ await new Promise((resolve2, reject) => {
112425
+ const child = (0, import_node_child_process5.spawn)(invocation.command, [...invocation.args], { stdio: ["ignore", "ignore", "pipe"], env: { ...process.env, AGENT_SHIM_HOME: options.paths.root } });
112426
+ let stderr = "";
112427
+ child.stderr.on("data", (chunk) => {
112428
+ stderr = `${stderr}${chunk.toString()}`.slice(-STDERR_TAIL_CHARS);
112429
+ });
112430
+ const killer = setTimeout(() => {
112431
+ child.kill("SIGKILL");
112432
+ }, options.timeoutMs + CHILD_GRACE_MS);
112433
+ child.on("error", (error63) => {
112434
+ clearTimeout(killer);
112435
+ reject(error63);
112436
+ });
112437
+ child.on("close", (code, signal) => {
112438
+ clearTimeout(killer);
112439
+ if (code === 0) {
112440
+ resolve2();
112441
+ return;
112442
+ }
112443
+ reject(new Error(stderr.trim() === "" ? `the child ended with ${signal === null ? `exit code ${String(code)}` : `signal ${signal}`}` : stderr.trim()));
112444
+ });
112445
+ });
112446
+ }
112447
+
112448
+ // src/usage/realWindowOpener.ts
111924
112449
  init_identityClaude();
111925
112450
 
111926
112451
  // src/usage/sdkResult.ts
@@ -111934,61 +112459,7 @@ function successfulResult(message) {
111934
112459
  return message.result;
111935
112460
  }
111936
112461
 
111937
- // src/usage/realJobRunner.ts
111938
- var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
111939
- var JOB_ISOLATION_OPTIONS = { settingSources: ["user"], mcpServers: {}, strictMcpConfig: true };
111940
- function logEntry(name, identity, endedAt, outcome) {
111941
- return `${endedAt.toISOString()} job ${name} as ${identity}
111942
- ${outcome.trimEnd()}
111943
-
111944
- `;
111945
- }
111946
- function createRealJobRunner(params) {
111947
- return async (name, identity, job) => {
111948
- const logFile = import_node_path38.default.join(params.paths.jobLogsDir, `${name}.log`);
111949
- const append = (outcome) => {
111950
- params.fs.mkdirPrivate(params.paths.jobLogsDir);
111951
- params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
111952
- };
111953
- try {
111954
- const result = await withIdentityClaude({ paths: params.paths, spawnDaemon: params.spawnDaemon, cwd: job.cwd, timeoutMs: parseDuration(job.timeout) }, identity, JOB_LAUNCH_FLAGS, async ({ bin, env, cwd, abort }) => {
111955
- const { query } = await Promise.resolve().then(() => (init_sdk(), sdk_exports));
111956
- const session = query({
111957
- prompt: job.prompt,
111958
- options: {
111959
- pathToClaudeCodeExecutable: bin,
111960
- env,
111961
- cwd,
111962
- abortController: abort,
111963
- settingSources: [...JOB_ISOLATION_OPTIONS.settingSources],
111964
- mcpServers: JOB_ISOLATION_OPTIONS.mcpServers,
111965
- strictMcpConfig: JOB_ISOLATION_OPTIONS.strictMcpConfig,
111966
- permissionMode: "dontAsk",
111967
- ...job.model === void 0 ? {} : { model: job.model },
111968
- ...job.allowedTools === void 0 ? {} : { allowedTools: [...job.allowedTools] }
111969
- }
111970
- });
111971
- try {
111972
- for await (const message of session) {
111973
- if (message.type === "result") {
111974
- return successfulResult(message);
111975
- }
111976
- }
111977
- throw new Error("the run ended without a result");
111978
- } finally {
111979
- session.close();
111980
- }
111981
- });
111982
- append(result);
111983
- } catch (error63) {
111984
- append(`FAILED: ${error63 instanceof Error ? error63.message : String(error63)}`);
111985
- throw error63;
111986
- }
111987
- };
111988
- }
111989
-
111990
112462
  // src/usage/realWindowOpener.ts
111991
- init_identityClaude();
111992
112463
  var OPENER_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
111993
112464
  var WINDOW_OPENING_MODEL = "haiku";
111994
112465
  var WINDOW_OPENING_PROMPT = "ok";
@@ -112035,7 +112506,7 @@ function createRealWindowOpener(params) {
112035
112506
  init_conditions();
112036
112507
 
112037
112508
  // src/usage/handledStamps.ts
112038
- var import_node_path39 = __toESM(require("node:path"), 1);
112509
+ var import_node_path40 = __toESM(require("node:path"), 1);
112039
112510
  init_zod();
112040
112511
  var STAMPS_SCHEMA_VERSION = 1;
112041
112512
  var StampsFileSchema = external_exports.strictObject({
@@ -112058,7 +112529,7 @@ function readHandled(fs22, file2) {
112058
112529
  }
112059
112530
  function writeHandled(fs22, file2, handled) {
112060
112531
  const next = { schemaVersion: STAMPS_SCHEMA_VERSION, handled: Object.fromEntries(Object.entries(handled).map(([key, at2]) => [key, new Date(at2).toISOString()])) };
112061
- fs22.mkdirPrivate(import_node_path39.default.dirname(file2));
112532
+ fs22.mkdirPrivate(import_node_path40.default.dirname(file2));
112062
112533
  fs22.writeFilePrivate(file2, `${JSON.stringify(next, null, 2)}
112063
112534
  `);
112064
112535
  }
@@ -112349,7 +112820,7 @@ init_capability();
112349
112820
 
112350
112821
  // src/frontdoor/capture.ts
112351
112822
  var fs15 = __toESM(require("node:fs"), 1);
112352
- var path39 = __toESM(require("node:path"), 1);
112823
+ var path40 = __toESM(require("node:path"), 1);
112353
112824
  var SECRET_HEADER_NAME = /authorization|cookie|token|secret|credential|api[-_]key/i;
112354
112825
  var SECRET_JSON_KEY = /token|secret|password|credential|authorization|api[-_]key/i;
112355
112826
  var SECRET_BODY_PATTERNS = [
@@ -112393,10 +112864,10 @@ function redactBody(chunk) {
112393
112864
  }
112394
112865
  var CAPTURE_ENV = "AGENT_SHIM_FRONTDOOR_CAPTURE";
112395
112866
  function captureFromEnv(env, logsDir) {
112396
- return env[CAPTURE_ENV] === "1" ? createFileCapture(path39.join(logsDir, "frontdoor-capture.jsonl")) : void 0;
112867
+ return env[CAPTURE_ENV] === "1" ? createFileCapture(path40.join(logsDir, "frontdoor-capture.jsonl")) : void 0;
112397
112868
  }
112398
112869
  function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
112399
- fs15.mkdirSync(path39.dirname(file2), { recursive: true });
112870
+ fs15.mkdirSync(path40.dirname(file2), { recursive: true });
112400
112871
  let nextId = 0;
112401
112872
  const append = (record2) => {
112402
112873
  fs15.appendFileSync(file2, `${JSON.stringify({ ts: now().toISOString(), ...record2 })}
@@ -112815,14 +113286,14 @@ init_capability();
112815
113286
  init_route();
112816
113287
 
112817
113288
  // src/frontdoor/supervisor.ts
112818
- var import_node_path40 = __toESM(require("node:path"), 1);
113289
+ var import_node_path41 = __toESM(require("node:path"), 1);
112819
113290
  init_state2();
112820
113291
  function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
112821
- const parsed = import_node_path40.default.parse(resolvedOwnExecutablePath);
113292
+ const parsed = import_node_path41.default.parse(resolvedOwnExecutablePath);
112822
113293
  if (parsed.name === "agent-shim") {
112823
113294
  return resolvedOwnExecutablePath;
112824
113295
  }
112825
- const sibling = import_node_path40.default.join(parsed.dir, `agent-shim${parsed.ext}`);
113296
+ const sibling = import_node_path41.default.join(parsed.dir, `agent-shim${parsed.ext}`);
112826
113297
  return siblingExists(sibling) ? sibling : resolvedOwnExecutablePath;
112827
113298
  }
112828
113299
  var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
@@ -113364,6 +113835,171 @@ var https3 = __toESM(require("node:https"), 1);
113364
113835
  var net2 = __toESM(require("node:net"), 1);
113365
113836
  var tls = __toESM(require("node:tls"), 1);
113366
113837
 
113838
+ // src/agents/liveTasks.ts
113839
+ init_zod();
113840
+ var LIVE_TASK_CAP = 512;
113841
+ var RUNNING_STATUS = "running";
113842
+ var LiveTaskUsageSchema = external_exports.strictObject({
113843
+ totalTokens: external_exports.number().optional(),
113844
+ toolUses: external_exports.number().optional(),
113845
+ durationMs: external_exports.number().optional()
113846
+ });
113847
+ var LiveTaskSchema = external_exports.strictObject({
113848
+ /** The `task_id`: for an unnamed subagent the stem of its `agent-<id>` files on disk. */
113849
+ taskId: external_exports.string(),
113850
+ /** The `cse_` session whose stream carried the task. */
113851
+ sessionId: external_exports.string(),
113852
+ runId: external_exports.string().optional(),
113853
+ /** The `tool_use` block in the spawning transcript, which is the meta file's `toolUseId`. */
113854
+ toolUseId: external_exports.string().optional(),
113855
+ /** `local_agent` for a subagent, `local_bash` for a backgrounded command; open because other kinds may exist. */
113856
+ taskType: external_exports.string().optional(),
113857
+ description: external_exports.string().optional(),
113858
+ subagentType: external_exports.string().optional(),
113859
+ spawnDepth: external_exports.number().int().nonnegative().optional(),
113860
+ parentTaskId: external_exports.string().optional(),
113861
+ backgrounded: external_exports.boolean().optional(),
113862
+ status: external_exports.string(),
113863
+ /** `<tmpdir>/<project-slug>/<local session id>/tasks/<task_id>.output`, which embeds the local session id. */
113864
+ outputFile: external_exports.string().optional(),
113865
+ summary: external_exports.string().optional(),
113866
+ lastToolName: external_exports.string().optional(),
113867
+ usage: LiveTaskUsageSchema.optional(),
113868
+ /** When the door last observed an event for this task, in epoch milliseconds from its injected clock. */
113869
+ observedAt: external_exports.number()
113870
+ });
113871
+ var SYSTEM_SUBTYPES = ["task_started", "task_progress", "task_updated", "task_notification", "background_tasks_changed"];
113872
+ function isRecord3(value2) {
113873
+ return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
113874
+ }
113875
+ function stringField(record2, field) {
113876
+ const value2 = record2[field];
113877
+ return typeof value2 === "string" && value2 !== "" ? value2 : void 0;
113878
+ }
113879
+ function numberField(record2, field) {
113880
+ const value2 = record2[field];
113881
+ return typeof value2 === "number" && Number.isFinite(value2) ? value2 : void 0;
113882
+ }
113883
+ function booleanField(record2, field) {
113884
+ const value2 = record2[field];
113885
+ return typeof value2 === "boolean" ? value2 : void 0;
113886
+ }
113887
+ function usageOf(record2) {
113888
+ const raw = record2.usage;
113889
+ if (!isRecord3(raw)) {
113890
+ return void 0;
113891
+ }
113892
+ const totalTokens = numberField(raw, "total_tokens");
113893
+ const toolUses = numberField(raw, "tool_uses");
113894
+ const durationMs = numberField(raw, "duration_ms");
113895
+ if (totalTokens === void 0 && toolUses === void 0 && durationMs === void 0) {
113896
+ return void 0;
113897
+ }
113898
+ return { ...totalTokens === void 0 ? {} : { totalTokens }, ...toolUses === void 0 ? {} : { toolUses }, ...durationMs === void 0 ? {} : { durationMs } };
113899
+ }
113900
+ function overlay(base, fields) {
113901
+ const defined = Object.fromEntries(Object.entries(fields).filter(([, value2]) => value2 !== void 0));
113902
+ return LiveTaskSchema.parse({ ...base, ...defined });
113903
+ }
113904
+ function isFinished(task) {
113905
+ return task.status !== RUNNING_STATUS;
113906
+ }
113907
+ function bounded(book) {
113908
+ if (book.size <= LIVE_TASK_CAP) {
113909
+ return book;
113910
+ }
113911
+ const evictable = [...book.values()].filter(isFinished).sort((left, right) => left.observedAt - right.observedAt);
113912
+ for (const task of evictable) {
113913
+ if (book.size <= LIVE_TASK_CAP) {
113914
+ break;
113915
+ }
113916
+ book.delete(task.taskId);
113917
+ }
113918
+ return book;
113919
+ }
113920
+ function applyAgentTaskEvent(book, sessionId, payload, observedAt2) {
113921
+ if (!isRecord3(payload) || payload.type !== "system") {
113922
+ return book;
113923
+ }
113924
+ const subtype = payload.subtype;
113925
+ if (typeof subtype !== "string" || !SYSTEM_SUBTYPES.some((known) => known === subtype)) {
113926
+ return book;
113927
+ }
113928
+ const next = new Map(book);
113929
+ const upsert = (taskId2, fields) => {
113930
+ const existing = next.get(taskId2);
113931
+ const base = existing ?? { taskId: taskId2, sessionId, status: RUNNING_STATUS, observedAt: observedAt2 };
113932
+ next.set(taskId2, overlay(base, { ...fields, observedAt: observedAt2 }));
113933
+ };
113934
+ if (subtype === "background_tasks_changed") {
113935
+ const tasks = Array.isArray(payload.tasks) ? payload.tasks : [];
113936
+ for (const raw of tasks) {
113937
+ const taskId2 = isRecord3(raw) ? stringField(raw, "task_id") : void 0;
113938
+ if (isRecord3(raw) && taskId2 !== void 0) {
113939
+ upsert(taskId2, { runId: stringField(raw, "run_id"), taskType: stringField(raw, "task_type"), description: stringField(raw, "description") });
113940
+ }
113941
+ }
113942
+ return bounded(next);
113943
+ }
113944
+ const taskId = stringField(payload, "task_id");
113945
+ if (taskId === void 0) {
113946
+ return book;
113947
+ }
113948
+ const common = { runId: stringField(payload, "run_id"), toolUseId: stringField(payload, "tool_use_id"), description: stringField(payload, "description") };
113949
+ if (subtype === "task_started") {
113950
+ upsert(taskId, {
113951
+ ...common,
113952
+ taskType: stringField(payload, "task_type"),
113953
+ subagentType: stringField(payload, "subagent_type"),
113954
+ spawnDepth: numberField(payload, "spawn_depth"),
113955
+ parentTaskId: stringField(payload, "parent_task_id"),
113956
+ backgrounded: booleanField(payload, "is_backgrounded")
113957
+ });
113958
+ } else if (subtype === "task_progress") {
113959
+ upsert(taskId, { ...common, subagentType: stringField(payload, "subagent_type"), lastToolName: stringField(payload, "last_tool_name"), usage: usageOf(payload) });
113960
+ } else if (subtype === "task_updated") {
113961
+ const patch = isRecord3(payload.patch) ? payload.patch : {};
113962
+ upsert(taskId, { runId: stringField(payload, "run_id"), status: stringField(patch, "status") });
113963
+ } else {
113964
+ upsert(taskId, { ...common, status: stringField(payload, "status"), outputFile: stringField(payload, "output_file"), summary: stringField(payload, "summary"), usage: usageOf(payload) });
113965
+ }
113966
+ return bounded(next);
113967
+ }
113968
+ var MergedProvenanceSchema = external_exports.enum(["disk", "both"]);
113969
+ var MergedAgentNodeSchema = external_exports.lazy(
113970
+ () => external_exports.strictObject({
113971
+ ...AgentNodeFields,
113972
+ provenance: MergedProvenanceSchema,
113973
+ live: LiveTaskSchema.optional(),
113974
+ children: external_exports.array(MergedAgentNodeSchema)
113975
+ })
113976
+ );
113977
+ var MergedAgentTreeSchema = external_exports.strictObject({
113978
+ ...SessionAgentTreeSchema.shape,
113979
+ agents: external_exports.array(MergedAgentNodeSchema),
113980
+ /** The `cse_` sessions whose live tasks matched this session. Empty when the session is not live or the door has not observed it. */
113981
+ remoteSessions: external_exports.array(external_exports.string()),
113982
+ /** Live tasks of those sessions that match no disk agent (a backgrounded command, or an agent whose files have not appeared yet). */
113983
+ liveOnly: external_exports.array(LiveTaskSchema)
113984
+ });
113985
+ function mergeLiveTasks(tree, live) {
113986
+ const byTaskId = new Map(live.map((task) => [task.taskId, task]));
113987
+ const byToolUseId = new Map(live.flatMap((task) => task.toolUseId === void 0 ? [] : [[task.toolUseId, task]]));
113988
+ const claimed = /* @__PURE__ */ new Set();
113989
+ const merge2 = (node2) => {
113990
+ const task = byTaskId.get(node2.id) ?? (node2.toolUseId === void 0 ? void 0 : byToolUseId.get(node2.toolUseId));
113991
+ if (task !== void 0) {
113992
+ claimed.add(task.taskId);
113993
+ }
113994
+ return { ...node2, provenance: task === void 0 ? "disk" : "both", ...task === void 0 ? {} : { live: task }, children: node2.children.map(merge2) };
113995
+ };
113996
+ const agents = tree.agents.map(merge2);
113997
+ const sessionMarker = `/${tree.sessionId}/`;
113998
+ const liveOnly = live.filter((task) => !claimed.has(task.taskId) && task.outputFile?.includes(sessionMarker) === true);
113999
+ const remoteSessions = [...new Set([...claimed, ...liveOnly.map((task) => task.taskId)].flatMap((taskId) => byTaskId.get(taskId)?.sessionId ?? []))].sort();
114000
+ return { ...tree, agents, remoteSessions, liveOnly };
114001
+ }
114002
+
113367
114003
  // src/frontdoor/rcSessions.ts
113368
114004
  var RC_SESSIONS_PATH_PREFIX = "/v1/code/sessions";
113369
114005
  var RC_SESSION_ID_PREFIX = "cse_";
@@ -113404,7 +114040,7 @@ function sessionCreateId(body) {
113404
114040
  const id2 = session.id;
113405
114041
  return typeof id2 === "string" && id2.startsWith(RC_SESSION_ID_PREFIX) ? id2 : void 0;
113406
114042
  }
113407
- function isRecord3(value2) {
114043
+ function isRecord4(value2) {
113408
114044
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
113409
114045
  }
113410
114046
  function parseJsonObject(body) {
@@ -113414,7 +114050,7 @@ function parseJsonObject(body) {
113414
114050
  } catch {
113415
114051
  return void 0;
113416
114052
  }
113417
- return isRecord3(parsed) ? parsed : void 0;
114053
+ return isRecord4(parsed) ? parsed : void 0;
113418
114054
  }
113419
114055
  function nonEmptyString(record2, field) {
113420
114056
  const value2 = record2 === void 0 ? void 0 : record2[field];
@@ -113435,11 +114071,11 @@ function payloadEventsOf(body) {
113435
114071
  }
113436
114072
  const payloads = [];
113437
114073
  for (const event of events) {
113438
- if (!isRecord3(event)) {
114074
+ if (!isRecord4(event)) {
113439
114075
  continue;
113440
114076
  }
113441
114077
  const payload = event.payload;
113442
- if (!isRecord3(payload)) {
114078
+ if (!isRecord4(payload)) {
113443
114079
  continue;
113444
114080
  }
113445
114081
  payloads.push(payload);
@@ -113454,7 +114090,7 @@ function pendingOfControlRequestPayload(payload) {
113454
114090
  if (requestId === void 0) {
113455
114091
  return void 0;
113456
114092
  }
113457
- const request7 = isRecord3(payload.request) ? payload.request : void 0;
114093
+ const request7 = isRecord4(payload.request) ? payload.request : void 0;
113458
114094
  const subtype = nonEmptyString(request7, "subtype");
113459
114095
  const type2 = subtype ?? "control_request";
113460
114096
  let summary = "";
@@ -113471,20 +114107,21 @@ function answeredRequestIdsOfControlResponsePayload(payload) {
113471
114107
  if (payload.type !== "control_response") {
113472
114108
  return [];
113473
114109
  }
113474
- const response = isRecord3(payload.response) ? payload.response : void 0;
114110
+ const response = isRecord4(payload.response) ? payload.response : void 0;
113475
114111
  const id2 = nonEmptyString(response, "request_id") ?? nonEmptyString(payload, "request_id") ?? nonEmptyString(payload, "uuid");
113476
114112
  return id2 === void 0 ? [] : [id2];
113477
114113
  }
113478
114114
  function parseRcRequestBody(kind, body) {
113479
114115
  if (kind === "heartbeat") {
113480
- return { controlRequests: [], answeredRequestIds: [], idleSeconds: finiteNumber(parseJsonObject(body), "idle_seconds"), workerStatus: void 0 };
114116
+ return { controlRequests: [], answeredRequestIds: [], idleSeconds: finiteNumber(parseJsonObject(body), "idle_seconds"), workerStatus: void 0, payloads: [] };
113481
114117
  }
113482
114118
  if (kind === "worker-registration") {
113483
- return { controlRequests: [], answeredRequestIds: [], idleSeconds: void 0, workerStatus: nonEmptyString(parseJsonObject(body), "worker_status") };
114119
+ return { controlRequests: [], answeredRequestIds: [], idleSeconds: void 0, workerStatus: nonEmptyString(parseJsonObject(body), "worker_status"), payloads: [] };
113484
114120
  }
113485
114121
  const controlRequests = [];
113486
114122
  const answeredRequestIds = [];
113487
- for (const payload of payloadEventsOf(body)) {
114123
+ const payloads = payloadEventsOf(body);
114124
+ for (const payload of payloads) {
113488
114125
  const pending = pendingOfControlRequestPayload(payload);
113489
114126
  if (pending !== void 0) {
113490
114127
  controlRequests.push({ requestId: pending.requestId, type: pending.type, summary: pending.summary });
@@ -113492,7 +114129,7 @@ function parseRcRequestBody(kind, body) {
113492
114129
  }
113493
114130
  answeredRequestIds.push(...answeredRequestIdsOfControlResponsePayload(payload));
113494
114131
  }
113495
- return { controlRequests, answeredRequestIds, idleSeconds: void 0, workerStatus: void 0 };
114132
+ return { controlRequests, answeredRequestIds, idleSeconds: void 0, workerStatus: void 0, payloads };
113496
114133
  }
113497
114134
  function createRcSessionTracker(deps) {
113498
114135
  const entries = /* @__PURE__ */ new Map();
@@ -113518,7 +114155,7 @@ function createRcSessionTracker(deps) {
113518
114155
  const timer = setInterval(sweep, deps.idleMs);
113519
114156
  timer.unref();
113520
114157
  const birth = (id2, facts) => {
113521
- const record2 = { id: id2, createdAt: deps.now(), lastSeenAt: deps.now(), ...facts, pending: /* @__PURE__ */ new Map(), workerState: void 0, workerIdleSeconds: void 0, sequenceNum: void 0 };
114158
+ const record2 = { id: id2, createdAt: deps.now(), lastSeenAt: deps.now(), ...facts, pending: /* @__PURE__ */ new Map(), workerState: void 0, workerIdleSeconds: void 0, sequenceNum: void 0, liveTasks: /* @__PURE__ */ new Map() };
113522
114159
  entries.set(id2, record2);
113523
114160
  return record2;
113524
114161
  };
@@ -113606,6 +114243,9 @@ function createRcSessionTracker(deps) {
113606
114243
  for (const requestId of factsOfBody.answeredRequestIds) {
113607
114244
  entryNow.pending.delete(requestId);
113608
114245
  }
114246
+ for (const payload of factsOfBody.payloads) {
114247
+ entryNow.liveTasks = applyAgentTaskEvent(entryNow.liveTasks, id2, payload, now);
114248
+ }
113609
114249
  if (factsOfBody.idleSeconds !== void 0) {
113610
114250
  entryNow.workerIdleSeconds = { value: factsOfBody.idleSeconds, observedAt: now };
113611
114251
  }
@@ -113696,9 +114336,10 @@ function createRcSessionTracker(deps) {
113696
114336
  return;
113697
114337
  }
113698
114338
  entry.sequenceNum = entry.sequenceNum === void 0 || event.sequence_num > entry.sequenceNum ? event.sequence_num : entry.sequenceNum;
113699
- if (!isRecord3(event.payload)) {
114339
+ if (!isRecord4(event.payload)) {
113700
114340
  return;
113701
114341
  }
114342
+ entry.liveTasks = applyAgentTaskEvent(entry.liveTasks, sessionId, event.payload, deps.now());
113702
114343
  const pending = pendingOfControlRequestPayload(event.payload);
113703
114344
  if (pending !== void 0) {
113704
114345
  if (event.source === RC_STREAM_WORKER_SOURCE) {
@@ -113710,6 +114351,10 @@ function createRcSessionTracker(deps) {
113710
114351
  entry.pending.delete(requestId);
113711
114352
  }
113712
114353
  },
114354
+ liveTasksOf: (sessionId) => {
114355
+ sweep();
114356
+ return sortedEntries().filter((entry) => sessionId === void 0 || entry.id === sessionId).flatMap((entry) => [...entry.liveTasks.values()].sort((left, right) => left.observedAt - right.observedAt || (left.taskId < right.taskId ? -1 : 1)));
114357
+ },
113713
114358
  completePending: (sessionId, requestId) => {
113714
114359
  entries.get(sessionId)?.pending.delete(requestId);
113715
114360
  },
@@ -115229,11 +115874,11 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
115229
115874
  init_claudeShim();
115230
115875
  init_store();
115231
115876
  init_realPorts();
115232
- var import_node_fs15 = __toESM(require("node:fs"), 1);
115233
- var import_node_path42 = __toESM(require("node:path"), 1);
115877
+ var import_node_fs16 = __toESM(require("node:fs"), 1);
115878
+ var import_node_path43 = __toESM(require("node:path"), 1);
115234
115879
 
115235
115880
  // src/usage/signIn.ts
115236
- var import_node_path41 = __toESM(require("node:path"), 1);
115881
+ var import_node_path42 = __toESM(require("node:path"), 1);
115237
115882
  var CREDENTIALS_FILE = ".credentials.json";
115238
115883
  function keychainHasItem(run, account) {
115239
115884
  return run.run("security", ["find-generic-password", "-a", account]).status === 0;
@@ -115251,7 +115896,7 @@ function decideSignIn(facts) {
115251
115896
  return { state: "signed-out", detail: facts.platform === "darwin" ? `no Keychain item and no ${CREDENTIALS_FILE}` : `no ${CREDENTIALS_FILE}` };
115252
115897
  }
115253
115898
  function credentialsFilePath(farmRoot) {
115254
- return import_node_path41.default.join(farmRoot, CREDENTIALS_FILE);
115899
+ return import_node_path42.default.join(farmRoot, CREDENTIALS_FILE);
115255
115900
  }
115256
115901
  function identitySignIn(fs22, probe, identity) {
115257
115902
  const probing = !identity.hasCredentialBlock;
@@ -115377,7 +116022,7 @@ function tcpPortEraRecord(raw) {
115377
116022
  return (has("port") || has("lastPort")) && !has("socketPath");
115378
116023
  }
115379
116024
  function pushPathResolution(push, resolution) {
115380
- const ownDir = import_node_path42.default.dirname(resolution.ownExecutablePath);
116025
+ const ownDir = import_node_path43.default.dirname(resolution.ownExecutablePath);
115381
116026
  switch (resolution.agentShim.status) {
115382
116027
  case "ok":
115383
116028
  push("path-resolution", "pass", `\`agent-shim\` on PATH resolves to this running executable, ${resolution.ownExecutablePath}.`, "agent-shim");
@@ -115476,14 +116121,14 @@ function pushProvider(push, entry, cacheEnv, signIn) {
115476
116121
  }
115477
116122
  function pushLegacyName(push, params) {
115478
116123
  const legacyVariables = Object.keys(params.env).filter((name) => name.startsWith(LEGACY_ENV_PREFIX) && params.env[name] !== void 0).sort();
115479
- if (legacyVariables.length === 0 && import_node_path42.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
116124
+ if (legacyVariables.length === 0 && import_node_path43.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
115480
116125
  push("legacy-name", "pass", "Nothing here still uses the former `claude-use` name.");
115481
116126
  return;
115482
116127
  }
115483
116128
  for (const name of legacyVariables) {
115484
116129
  push("legacy-name", "warn", `${name} is the former name of ${name.replace(LEGACY_ENV_PREFIX, ENV_PREFIX)}. Rename it; the old name still works but is only a fallback.`, name);
115485
116130
  }
115486
- if (import_node_path42.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
116131
+ if (import_node_path43.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
115487
116132
  push(
115488
116133
  "legacy-name",
115489
116134
  "warn",
@@ -115847,27 +116492,27 @@ function formatDoctorReport(report) {
115847
116492
  }
115848
116493
  function realpathOrSelf(target) {
115849
116494
  try {
115850
- return import_node_fs15.default.realpathSync(target);
116495
+ return import_node_fs16.default.realpathSync(target);
115851
116496
  } catch {
115852
116497
  return target;
115853
116498
  }
115854
116499
  }
115855
116500
  function collectDoctorReport(params) {
115856
116501
  const { paths } = params;
115857
- const identityNames = import_node_fs15.default.existsSync(paths.identitiesDir) ? import_node_fs15.default.readdirSync(paths.identitiesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isIdentityDirectoryName(entry.name)).map((entry) => entry.name).sort() : [];
116502
+ const identityNames = import_node_fs16.default.existsSync(paths.identitiesDir) ? import_node_fs16.default.readdirSync(paths.identitiesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isIdentityDirectoryName(entry.name)).map((entry) => entry.name).sort() : [];
115858
116503
  const identities = identityNames.map((name) => {
115859
- const farmRoot = import_node_path42.default.join(paths.identitiesDir, name);
115860
- const identityPath = import_node_path42.default.join(farmRoot, "identity.json");
115861
- return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs15.default.existsSync(credentialsFilePath(farmRoot)) };
116504
+ const farmRoot = import_node_path43.default.join(paths.identitiesDir, name);
116505
+ const identityPath = import_node_path43.default.join(farmRoot, "identity.json");
116506
+ return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs16.default.existsSync(credentialsFilePath(farmRoot)) };
115862
116507
  });
115863
- const profileNames = import_node_fs15.default.existsSync(paths.configProfilesDir) ? import_node_fs15.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
116508
+ const profileNames = import_node_fs16.default.existsSync(paths.configProfilesDir) ? import_node_fs16.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
115864
116509
  const configProfiles = profileNames.map((name) => {
115865
- const profilePath = import_node_path42.default.join(paths.configProfilesDir, `${name}.json`);
116510
+ const profilePath = import_node_path43.default.join(paths.configProfilesDir, `${name}.json`);
115866
116511
  return { name, path: profilePath, raw: realFsPort.readFileUtf8(profilePath) };
115867
116512
  });
115868
- const providerNames = import_node_fs15.default.existsSync(paths.providersDir) ? import_node_fs15.default.readdirSync(paths.providersDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
116513
+ const providerNames = import_node_fs16.default.existsSync(paths.providersDir) ? import_node_fs16.default.readdirSync(paths.providersDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
115869
116514
  const providers = providerNames.map((name) => {
115870
- const providerPath = import_node_path42.default.join(paths.providersDir, `${name}.json`);
116515
+ const providerPath = import_node_path43.default.join(paths.providersDir, `${name}.json`);
115871
116516
  return { name, path: providerPath, raw: realFsPort.readFileUtf8(providerPath) };
115872
116517
  });
115873
116518
  const ownExecutablePath = realOwnExecutablePath();
@@ -115879,12 +116524,12 @@ function collectDoctorReport(params) {
115879
116524
  binaryDiscovery = { ok: false, message: error63 instanceof Error ? error63.message : String(error63) };
115880
116525
  }
115881
116526
  const shimState = readJson(paths.claudeShimFile, ClaudeShimStateSchema);
115882
- const pathDirs = (params.env.PATH ?? "").split(import_node_path42.default.delimiter).filter((dir) => dir !== "");
116527
+ const pathDirs = (params.env.PATH ?? "").split(import_node_path43.default.delimiter).filter((dir) => dir !== "");
115883
116528
  const claudeShimShadow = shimState === void 0 ? void 0 : refinePathShadow(
115884
116529
  findPathShadow({
115885
116530
  pathDirs,
115886
- targetDir: import_node_path42.default.dirname(shimState.targetPath),
115887
- targetFilename: import_node_path42.default.basename(shimState.targetPath),
116531
+ targetDir: import_node_path43.default.dirname(shimState.targetPath),
116532
+ targetFilename: import_node_path43.default.basename(shimState.targetPath),
115888
116533
  findExecutableInDir
115889
116534
  }),
115890
116535
  shimState.targetPath,
@@ -115906,14 +116551,14 @@ function collectDoctorReport(params) {
115906
116551
  categoriesLocal: { path: paths.categoriesLocalFile, raw: realFsPort.readFileUtf8(paths.categoriesLocalFile) },
115907
116552
  activeIdentity: { path: paths.activeIdentityFile, raw: realFsPort.readFileUtf8(paths.activeIdentityFile) },
115908
116553
  binaryDiscovery,
115909
- claudeShim: { state: shimState, targetExists: shimState !== void 0 && import_node_fs15.default.existsSync(shimState.targetPath) },
116554
+ claudeShim: { state: shimState, targetExists: shimState !== void 0 && import_node_fs16.default.existsSync(shimState.targetPath) },
115910
116555
  rootPath: paths.root,
115911
116556
  pathResolution: {
115912
116557
  ownExecutablePath,
115913
116558
  agentShim: refinePathShadow(
115914
116559
  findPathShadow({
115915
116560
  pathDirs,
115916
- targetDir: import_node_path42.default.dirname(ownExecutablePath),
116561
+ targetDir: import_node_path43.default.dirname(ownExecutablePath),
115917
116562
  targetFilename: commandFilename(ownExecutablePath, "agent-shim"),
115918
116563
  findExecutableInDir
115919
116564
  }),
@@ -118437,7 +119082,7 @@ var HTTP_METHODS_UP_TO_V31 = [
118437
119082
  function operationFields(convert) {
118438
119083
  return Object.fromEntries(HTTP_METHODS_UP_TO_V31.map((method) => [method, convert]));
118439
119084
  }
118440
- function isRecord4(value2) {
119085
+ function isRecord5(value2) {
118441
119086
  if (typeof value2 !== "object" || value2 === null) {
118442
119087
  return false;
118443
119088
  }
@@ -118457,7 +119102,7 @@ function setOwn2(object3, key, value2) {
118457
119102
  }
118458
119103
  }
118459
119104
  function cloneValue(value2, seen) {
118460
- if (!(Array.isArray(value2) || isRecord4(value2))) {
119105
+ if (!(Array.isArray(value2) || isRecord5(value2))) {
118461
119106
  return value2;
118462
119107
  }
118463
119108
  const existing = seen.get(value2);
@@ -118480,14 +119125,14 @@ function cloneValue(value2, seen) {
118480
119125
  return out;
118481
119126
  }
118482
119127
  function deepClone(value2) {
118483
- if (!(Array.isArray(value2) || isRecord4(value2))) {
119128
+ if (!(Array.isArray(value2) || isRecord5(value2))) {
118484
119129
  return value2;
118485
119130
  }
118486
119131
  return cloneValue(value2, /* @__PURE__ */ new WeakMap());
118487
119132
  }
118488
119133
  var converting = /* @__PURE__ */ new WeakMap();
118489
119134
  function convertRecord(value2, fields, finish) {
118490
- if (!isRecord4(value2)) {
119135
+ if (!isRecord5(value2)) {
118491
119136
  return deepClone(value2);
118492
119137
  }
118493
119138
  const inProgress = converting.get(value2);
@@ -118513,7 +119158,7 @@ function convertRecord(value2, fields, finish) {
118513
119158
  }
118514
119159
  }
118515
119160
  function mapRecord(value2, convert) {
118516
- if (!isRecord4(value2)) {
119161
+ if (!isRecord5(value2)) {
118517
119162
  return deepClone(value2);
118518
119163
  }
118519
119164
  const out = {};
@@ -118532,7 +119177,7 @@ function mapArray(value2, convert) {
118532
119177
  return value2.map((item) => convert(item)).filter((item) => item !== DROP);
118533
119178
  }
118534
119179
  function getRef(value2) {
118535
- if (isRecord4(value2) && typeof value2.$ref === "string") {
119180
+ if (isRecord5(value2) && typeof value2.$ref === "string") {
118536
119181
  return value2.$ref;
118537
119182
  }
118538
119183
  return void 0;
@@ -118738,7 +119383,7 @@ function convertSchema2(schema) {
118738
119383
  if (schema === false) {
118739
119384
  return { not: {} };
118740
119385
  }
118741
- if (isRecord4(schema) && typeof schema.$ref === "string" && Object.keys(schema).length === 1) {
119386
+ if (isRecord5(schema) && typeof schema.$ref === "string" && Object.keys(schema).length === 1) {
118742
119387
  return { $ref: schema.$ref };
118743
119388
  }
118744
119389
  return convertRecord(schema, SCHEMA_FIELDS, finishSchema);
@@ -118750,7 +119395,7 @@ function resolveSchemeType(name, schemes, seen) {
118750
119395
  return void 0;
118751
119396
  }
118752
119397
  const scheme = schemes[name];
118753
- if (!isRecord4(scheme)) {
119398
+ if (!isRecord5(scheme)) {
118754
119399
  return void 0;
118755
119400
  }
118756
119401
  if (typeof scheme.type === "string") {
@@ -118767,11 +119412,11 @@ function resolveSchemeType(name, schemes, seen) {
118767
119412
  return void 0;
118768
119413
  }
118769
119414
  function createContext(spec) {
118770
- const components = isRecord4(spec) ? spec.components : void 0;
118771
- const pathItems = isRecord4(components) ? components.pathItems : void 0;
118772
- const schemes = isRecord4(components) ? components.securitySchemes : void 0;
119415
+ const components = isRecord5(spec) ? spec.components : void 0;
119416
+ const pathItems = isRecord5(components) ? components.pathItems : void 0;
119417
+ const schemes = isRecord5(components) ? components.securitySchemes : void 0;
118773
119418
  const schemeTypes = /* @__PURE__ */ new Map();
118774
- if (isRecord4(schemes)) {
119419
+ if (isRecord5(schemes)) {
118775
119420
  for (const name of Object.keys(schemes)) {
118776
119421
  const type2 = resolveSchemeType(name, schemes, /* @__PURE__ */ new Set());
118777
119422
  if (type2 !== void 0) {
@@ -118781,7 +119426,7 @@ function createContext(spec) {
118781
119426
  }
118782
119427
  return {
118783
119428
  inlining: /* @__PURE__ */ new Set(),
118784
- pathItems: isRecord4(pathItems) ? pathItems : void 0,
119429
+ pathItems: isRecord5(pathItems) ? pathItems : void 0,
118785
119430
  schemeTypes
118786
119431
  };
118787
119432
  }
@@ -118789,7 +119434,7 @@ function isMutualTls(name, context) {
118789
119434
  return context.schemeTypes.get(name) === "mutualTLS";
118790
119435
  }
118791
119436
  function convertRequirement(value2, context) {
118792
- if (!isRecord4(value2)) {
119437
+ if (!isRecord5(value2)) {
118793
119438
  return deepClone(value2);
118794
119439
  }
118795
119440
  const entries = Object.entries(value2);
@@ -118889,10 +119534,10 @@ function resolvePathItemRef(value2, context) {
118889
119534
  return void 0;
118890
119535
  }
118891
119536
  const target = context.pathItems[name];
118892
- return isRecord4(target) ? [name, target] : void 0;
119537
+ return isRecord5(target) ? [name, target] : void 0;
118893
119538
  }
118894
119539
  function convertPathItem(value2, context) {
118895
- if (!isRecord4(value2)) {
119540
+ if (!isRecord5(value2)) {
118896
119541
  return deepClone(value2);
118897
119542
  }
118898
119543
  const resolved = resolvePathItemRef(value2, context);
@@ -118992,7 +119637,7 @@ function convertExample(value2) {
118992
119637
  });
118993
119638
  }
118994
119639
  function isQuerystringParameter(value2) {
118995
- return isRecord4(value2) && value2.in === "querystring";
119640
+ return isRecord5(value2) && value2.in === "querystring";
118996
119641
  }
118997
119642
  function isRemovedRef(value2, removed) {
118998
119643
  const ref = getRef(value2);
@@ -119008,7 +119653,7 @@ function convertParameterOrHeader2(value2, context) {
119008
119653
  style: (item) => item === "cookie" ? DROP : deepClone(item)
119009
119654
  },
119010
119655
  (out, parameter) => {
119011
- const lostContent = isRecord4(parameter.content) && Object.keys(parameter.content).length > 0 && isRecord4(out.content) && Object.keys(out.content).length === 0;
119656
+ const lostContent = isRecord5(parameter.content) && Object.keys(parameter.content).length > 0 && isRecord5(out.content) && Object.keys(out.content).length === 0;
119012
119657
  return lostContent ? DROP : out;
119013
119658
  }
119014
119659
  );
@@ -119129,7 +119774,7 @@ function convertComponents2(value2, context) {
119129
119774
  });
119130
119775
  }
119131
119776
  function losesEntireContent(value2, mediaTypes) {
119132
- if (!(isRecord4(value2) && isRecord4(value2.content))) {
119777
+ if (!(isRecord5(value2) && isRecord5(value2.content))) {
119133
119778
  return false;
119134
119779
  }
119135
119780
  const entries = Object.values(value2.content);
@@ -119137,7 +119782,7 @@ function losesEntireContent(value2, mediaTypes) {
119137
119782
  }
119138
119783
  function indexRemovedComponentRefs(map2, prefix, mediaTypes, isDirectlyRemoved) {
119139
119784
  const removed = /* @__PURE__ */ new Set();
119140
- if (!isRecord4(map2)) {
119785
+ if (!isRecord5(map2)) {
119141
119786
  return removed;
119142
119787
  }
119143
119788
  const entries = Object.entries(map2);
@@ -119159,12 +119804,12 @@ function indexRemovedComponentRefs(map2, prefix, mediaTypes, isDirectlyRemoved)
119159
119804
  return removed;
119160
119805
  }
119161
119806
  function createContext2(spec) {
119162
- const components = isRecord4(spec) ? spec.components : void 0;
119163
- const mediaTypes = isRecord4(components) && isRecord4(components.mediaTypes) ? components.mediaTypes : void 0;
119807
+ const components = isRecord5(spec) ? spec.components : void 0;
119808
+ const mediaTypes = isRecord5(components) && isRecord5(components.mediaTypes) ? components.mediaTypes : void 0;
119164
119809
  return {
119165
119810
  mediaTypes,
119166
- removedHeaderRefs: indexRemovedComponentRefs(isRecord4(components) ? components.headers : void 0, HEADERS_REF_PREFIX, mediaTypes, () => false),
119167
- removedParameterRefs: indexRemovedComponentRefs(isRecord4(components) ? components.parameters : void 0, PARAMETERS_REF_PREFIX, mediaTypes, isQuerystringParameter)
119811
+ removedHeaderRefs: indexRemovedComponentRefs(isRecord5(components) ? components.headers : void 0, HEADERS_REF_PREFIX, mediaTypes, () => false),
119812
+ removedParameterRefs: indexRemovedComponentRefs(isRecord5(components) ? components.parameters : void 0, PARAMETERS_REF_PREFIX, mediaTypes, isQuerystringParameter)
119168
119813
  };
119169
119814
  }
119170
119815
  function convertJsonSchemaDialect(value2) {
@@ -121440,7 +122085,7 @@ var ResetRowSchema = external_exports.strictObject({
121440
122085
  var ResetScheduleSchema = external_exports.strictObject({ resets: external_exports.readonly(external_exports.array(ResetRowSchema)) });
121441
122086
 
121442
122087
  // src/frontdoor/controlSchemas.ts
121443
- var import_node_path43 = __toESM(require("node:path"), 1);
122088
+ var import_node_path44 = __toESM(require("node:path"), 1);
121444
122089
  init_zod();
121445
122090
  init_schema2();
121446
122091
 
@@ -121652,11 +122297,11 @@ var FrontDoorSessionsOutputSchema = external_exports.strictObject({ sessions: ex
121652
122297
  var CheckRunInputSchema = external_exports.strictObject({
121653
122298
  path: external_exports.string().min(1),
121654
122299
  identity: external_exports.string().min(1).optional()
121655
- }).refine((input2) => import_node_path43.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
122300
+ }).refine((input2) => import_node_path44.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
121656
122301
  var PoolPickInputSchema = external_exports.strictObject({
121657
122302
  pool: external_exports.string().min(1),
121658
122303
  path: external_exports.string().min(1)
121659
- }).refine((input2) => import_node_path43.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
122304
+ }).refine((input2) => import_node_path44.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
121660
122305
  var DoctorFindingSchema = external_exports.strictObject({
121661
122306
  section: external_exports.enum(DOCTOR_SECTIONS),
121662
122307
  subject: external_exports.string().optional(),
@@ -123732,6 +124377,7 @@ var RC_ORPC_PATH_PREFIX = "/__agent-shim/orpc";
123732
124377
  var RC_OPENAPI_DOC_PATH = "/openapi.json";
123733
124378
  var RC_SUBSCRIBER_BUFFER_EVENTS = 100;
123734
124379
  var READ_ONLY_OPERATION_EXTENSION = "x-agent-shim-read-only";
124380
+ var SESSION_HISTORY_TAG = "agent-trees";
123735
124381
  function doorApiBearer(headers) {
123736
124382
  const presented = headers.authorization;
123737
124383
  const bearerPrefix = "bearer ".length;
@@ -124484,7 +125130,7 @@ function createLifecycleApiRouter(deps) {
124484
125130
  init_cliError();
124485
125131
 
124486
125132
  // src/frontdoor/launchSchemas.ts
124487
- var import_node_path44 = __toESM(require("node:path"), 1);
125133
+ var import_node_path45 = __toESM(require("node:path"), 1);
124488
125134
  init_zod();
124489
125135
  init_claudeVersion();
124490
125136
  init_identity();
@@ -124494,7 +125140,7 @@ var LaunchResolveInputSchema = external_exports.strictObject({
124494
125140
  argv: external_exports.readonly(external_exports.array(external_exports.string())).optional(),
124495
125141
  /** The launch's inherited environment. Absent means an empty one: the door's own environment is never a substitute for the caller's, so a caller that wants `AGENT_SHIM_*` switches or a `CLAUDE_CONFIG_DIR` considered names them here. Values are read, never reported. */
124496
125142
  env: external_exports.record(external_exports.string(), external_exports.string()).optional()
124497
- }).refine((input2) => import_node_path44.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
125143
+ }).refine((input2) => import_node_path45.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
124498
125144
  var LaunchPoolDecisionSchema = external_exports.strictObject({
124499
125145
  name: external_exports.string(),
124500
125146
  reasons: external_exports.readonly(external_exports.array(external_exports.string())),
@@ -124562,6 +125208,69 @@ function createLaunchApiRouter(deps) {
124562
125208
  };
124563
125209
  }
124564
125210
 
125211
+ // src/frontdoor/agentTreesApi.ts
125212
+ init_zod();
125213
+ init_cliError();
125214
+ var AgentTreesListInputSchema = external_exports.strictObject({
125215
+ /** Only this identity's sessions. */
125216
+ identity: external_exports.string().optional(),
125217
+ /** Include sessions that spawned no agent and ran no workflow. */
125218
+ all: external_exports.boolean().optional()
125219
+ });
125220
+ var AgentTreesListOutputSchema = external_exports.array(SessionSummarySchema);
125221
+ var AgentTreesShowInputSchema = external_exports.strictObject({
125222
+ /** A session id, or an unambiguous prefix of one. */
125223
+ session: external_exports.string().min(1),
125224
+ /** Look only in this identity. */
125225
+ identity: external_exports.string().optional()
125226
+ });
125227
+ var AgentTreesShowOutputSchema = external_exports.strictObject({ identities: external_exports.array(external_exports.string()), ...MergedAgentTreeSchema.shape });
125228
+ function asBadRequest(error63) {
125229
+ if (error63 instanceof CliError) {
125230
+ throw new ORPCError("BAD_REQUEST", { message: error63.message });
125231
+ }
125232
+ throw error63;
125233
+ }
125234
+ function createAgentTreesApiRouter(deps) {
125235
+ const authed = doorApiAuth(deps.expectedToken);
125236
+ return {
125237
+ agentTrees: {
125238
+ list: authed.meta(
125239
+ openapi({
125240
+ method: "POST",
125241
+ path: "/rest/agent-trees/list",
125242
+ summary: "List the sessions that spawned agents or ran workflows, newest transcript first",
125243
+ tags: [SESSION_HISTORY_TAG],
125244
+ // A POST because the filters are a body, but the answer changes nothing.
125245
+ spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
125246
+ })
125247
+ ).input(AgentTreesListInputSchema).output(AgentTreesListOutputSchema).handler(({ input: input2 }) => {
125248
+ try {
125249
+ return deps.sessionList(input2).map((session) => ({ ...session, identities: [...session.identities] }));
125250
+ } catch (error63) {
125251
+ return asBadRequest(error63);
125252
+ }
125253
+ }),
125254
+ show: authed.meta(
125255
+ openapi({
125256
+ method: "POST",
125257
+ path: "/rest/agent-trees/show",
125258
+ summary: "Show one session's agent tree, task list and workflow runs, with the live Remote Control tasks merged in",
125259
+ tags: [SESSION_HISTORY_TAG],
125260
+ spec: (current) => ({ ...current, [READ_ONLY_OPERATION_EXTENSION]: true })
125261
+ })
125262
+ ).input(AgentTreesShowInputSchema).output(AgentTreesShowOutputSchema).handler(({ input: input2 }) => {
125263
+ try {
125264
+ const view = deps.sessionShow(input2.session, input2.identity);
125265
+ return { identities: [...view.identities], ...mergeLiveTasks(view.tree, deps.liveTasks()) };
125266
+ } catch (error63) {
125267
+ return asBadRequest(error63);
125268
+ }
125269
+ })
125270
+ }
125271
+ };
125272
+ }
125273
+
124565
125274
  // src/frontdoor/controlApi.ts
124566
125275
  var USAGE_API_TAG = "usage";
124567
125276
  var FRONTDOOR_API_TAG2 = "frontdoor";
@@ -124630,7 +125339,7 @@ function createControlApiRouter(deps) {
124630
125339
  function createDoorApiRouter(deps) {
124631
125340
  const control = createControlApiRouter(deps);
124632
125341
  const lifecycle = createLifecycleApiRouter(deps);
124633
- return { ...createRcApiRouter(deps), ...control, ...lifecycle, ...createConfigApiRouter(deps), ...createCodexApiRouter(deps), ...createLaunchApiRouter(deps), ...createEventsApiRouter(deps), frontdoor: { ...control.frontdoor, ...lifecycle.frontdoor } };
125342
+ return { ...createRcApiRouter(deps), ...control, ...lifecycle, ...createConfigApiRouter(deps), ...createCodexApiRouter(deps), ...createLaunchApiRouter(deps), ...createAgentTreesApiRouter(deps), ...createEventsApiRouter(deps), frontdoor: { ...control.frontdoor, ...lifecycle.frontdoor } };
124634
125343
  }
124635
125344
  function createDoorApiNodeHandler(deps) {
124636
125345
  return doorApiNodeHandlerOf(createDoorApiRouter(deps), deps.expectedToken);
@@ -125780,7 +126489,7 @@ data: ${errorBody2(status, message)}
125780
126489
  var UPSTREAM_DETAIL_CHARS = 2e3;
125781
126490
  var UPSTREAM_LOG_DETAIL_CHARS = 300;
125782
126491
  var CHARS_PER_TOKEN = 4;
125783
- function parseJson3(body) {
126492
+ function parseJson4(body) {
125784
126493
  try {
125785
126494
  const value2 = JSON.parse(body);
125786
126495
  return { ok: true, value: value2 };
@@ -125925,7 +126634,7 @@ function createCodexRoute(ports) {
125925
126634
  if (!provider.ok) {
125926
126635
  return errorResponse(provider.status, provider.message);
125927
126636
  }
125928
- const json2 = parseJson3(request7.body);
126637
+ const json2 = parseJson4(request7.body);
125929
126638
  if (!json2.ok) {
125930
126639
  return errorResponse(HTTP_STATUS.badRequest, json2.message);
125931
126640
  }
@@ -126374,15 +127083,15 @@ function readFrontDoorControlMaterial(fsPort, paths, purpose) {
126374
127083
 
126375
127084
  // src/frontdoor/rcLiveUsage.ts
126376
127085
  var RC_RATE_LIMIT_EVENT_TYPE = "rate_limit_event";
126377
- function isRecord5(value2) {
127086
+ function isRecord6(value2) {
126378
127087
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
126379
127088
  }
126380
127089
  function rcRateLimitInfoOf(event) {
126381
127090
  const payload = event.envelope.payload;
126382
- if (!isRecord5(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
127091
+ if (!isRecord6(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
126383
127092
  return void 0;
126384
127093
  }
126385
- if (!isRecord5(payload.rate_limit_info)) {
127094
+ if (!isRecord6(payload.rate_limit_info)) {
126386
127095
  return void 0;
126387
127096
  }
126388
127097
  const parsed = RcRateLimitInfoSchema.safeParse(payload.rate_limit_info);
@@ -126409,7 +127118,7 @@ function createRcLiveUsage(deps) {
126409
127118
  }
126410
127119
 
126411
127120
  // src/frontdoor/rcSelfHostMint.ts
126412
- var import_node_path45 = __toESM(require("node:path"), 1);
127121
+ var import_node_path46 = __toESM(require("node:path"), 1);
126413
127122
  init_account();
126414
127123
 
126415
127124
  // src/frontdoor/rcSelfHostLocal.ts
@@ -126418,7 +127127,7 @@ var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:
126418
127127
  var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
126419
127128
  var MS_PER_SECOND9 = 1e3;
126420
127129
  var HTTP_SERVICE_UNAVAILABLE = 503;
126421
- function isRecord6(value2) {
127130
+ function isRecord7(value2) {
126422
127131
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
126423
127132
  }
126424
127133
  function parseJsonObject2(body) {
@@ -126428,7 +127137,7 @@ function parseJsonObject2(body) {
126428
127137
  } catch {
126429
127138
  return void 0;
126430
127139
  }
126431
- return isRecord6(parsed) ? parsed : void 0;
127140
+ return isRecord7(parsed) ? parsed : void 0;
126432
127141
  }
126433
127142
  function growthBookFeatures() {
126434
127143
  return {
@@ -126522,7 +127231,7 @@ var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
126522
127231
  var RC_SELF_HOST_RECORD_FILE = "credential.json";
126523
127232
  var SELF_HOST_EMAIL = "selfhost@agent-shim.invalid";
126524
127233
  var SELF_HOST_SUBSCRIPTION_TYPE = "max";
126525
- function isRecord7(value2) {
127234
+ function isRecord8(value2) {
126526
127235
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
126527
127236
  }
126528
127237
  function readJsonObject(fs22, file2) {
@@ -126536,10 +127245,10 @@ function readJsonObject(fs22, file2) {
126536
127245
  } catch {
126537
127246
  return void 0;
126538
127247
  }
126539
- return isRecord7(parsed) ? parsed : void 0;
127248
+ return isRecord8(parsed) ? parsed : void 0;
126540
127249
  }
126541
127250
  function readRcSelfHostRecord(fs22, frontdoorDir) {
126542
- const parsed = readJsonObject(fs22, import_node_path45.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
127251
+ const parsed = readJsonObject(fs22, import_node_path46.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
126543
127252
  if (parsed === void 0) {
126544
127253
  return void 0;
126545
127254
  }
@@ -126553,14 +127262,14 @@ function mintRcSelfHostCredential(deps) {
126553
127262
  if (!isIdentityName(deps.identity)) {
126554
127263
  throw new Error(`"${deps.identity}" is not a valid identity name.`);
126555
127264
  }
126556
- const identityDir = import_node_path45.default.join(deps.identitiesDir, deps.identity);
126557
- const credentialsFile = import_node_path45.default.join(identityDir, CREDENTIALS_FILE2);
126558
- const claudeJsonFile = import_node_path45.default.join(identityDir, CLAUDE_JSON2);
126559
- const recordDir = import_node_path45.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
126560
- const recordFile = import_node_path45.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
127265
+ const identityDir = import_node_path46.default.join(deps.identitiesDir, deps.identity);
127266
+ const credentialsFile = import_node_path46.default.join(identityDir, CREDENTIALS_FILE2);
127267
+ const claudeJsonFile = import_node_path46.default.join(identityDir, CLAUDE_JSON2);
127268
+ const recordDir = import_node_path46.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
127269
+ const recordFile = import_node_path46.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
126561
127270
  const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
126562
127271
  const existingCredentials = readJsonObject(deps.fs, credentialsFile);
126563
- const existingOauth = isRecord7(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
127272
+ const existingOauth = isRecord8(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
126564
127273
  const existingToken = typeof existingOauth?.accessToken === "string" && existingOauth.accessToken !== "" ? existingOauth.accessToken : void 0;
126565
127274
  const existingIsOwn = existingToken !== void 0 && previousRecord?.accessToken === existingToken;
126566
127275
  if (existingToken !== void 0 && !existingIsOwn && !deps.force) {
@@ -126573,11 +127282,11 @@ function mintRcSelfHostCredential(deps) {
126573
127282
  const organizationUuid = deps.newUuid();
126574
127283
  const accountUuid = deps.newUuid();
126575
127284
  const mintedAt = new Date(deps.now()).toISOString();
126576
- deps.fs.mkdirPrivate(import_node_path45.default.dirname(credentialsFile));
127285
+ deps.fs.mkdirPrivate(import_node_path46.default.dirname(credentialsFile));
126577
127286
  deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
126578
127287
  `);
126579
127288
  const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
126580
- const existingBlock = (value2) => isRecord7(value2) ? value2 : {};
127289
+ const existingBlock = (value2) => isRecord8(value2) ? value2 : {};
126581
127290
  deps.fs.writeFilePrivate(claudeJsonFile, `${JSON.stringify({
126582
127291
  ...claudeJson,
126583
127292
  oauthAccount: {
@@ -126960,15 +127669,15 @@ function registerRcCommand(frontdoor, paths) {
126960
127669
  }
126961
127670
 
126962
127671
  // src/frontdoor/rcCredentialStore.ts
126963
- var import_node_path46 = __toESM(require("node:path"), 1);
127672
+ var import_node_path47 = __toESM(require("node:path"), 1);
126964
127673
  function isSafeSessionId(sessionId) {
126965
127674
  return /^[A-Za-z0-9_-]+$/.test(sessionId);
126966
127675
  }
126967
- function isRecord8(value2) {
127676
+ function isRecord9(value2) {
126968
127677
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
126969
127678
  }
126970
127679
  function credentialOfJson(parsed) {
126971
- if (!isRecord8(parsed)) {
127680
+ if (!isRecord9(parsed)) {
126972
127681
  return void 0;
126973
127682
  }
126974
127683
  const { authorization, anthropicVersion, anthropicClientPlatform } = parsed;
@@ -126986,7 +127695,7 @@ function sequenceNumOfJson(value2) {
126986
127695
  }
126987
127696
  function createRcCredentialStore(fs22, dir) {
126988
127697
  fs22.mkdirPrivate(dir);
126989
- const fileFor = (sessionId) => import_node_path46.default.join(dir, `${sessionId}.json`);
127698
+ const fileFor = (sessionId) => import_node_path47.default.join(dir, `${sessionId}.json`);
126990
127699
  const readParsed = (sessionId) => {
126991
127700
  const raw = fs22.readFileUtf8(fileFor(sessionId));
126992
127701
  if (raw === void 0) {
@@ -126998,7 +127707,7 @@ function createRcCredentialStore(fs22, dir) {
126998
127707
  } catch {
126999
127708
  return void 0;
127000
127709
  }
127001
- return isRecord8(parsed) ? parsed : void 0;
127710
+ return isRecord9(parsed) ? parsed : void 0;
127002
127711
  };
127003
127712
  return {
127004
127713
  read: (sessionId) => {
@@ -127566,7 +128275,7 @@ init_capability();
127566
128275
  // src/frontdoor/rcSelfHostEndpoints.ts
127567
128276
  var RC_SOURCE_WORKER = "worker";
127568
128277
  var RC_SOURCE_CLIENT = "client";
127569
- function isRecord9(value2) {
128278
+ function isRecord10(value2) {
127570
128279
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
127571
128280
  }
127572
128281
  function parseJsonObject3(body) {
@@ -127576,7 +128285,7 @@ function parseJsonObject3(body) {
127576
128285
  } catch {
127577
128286
  return void 0;
127578
128287
  }
127579
- return isRecord9(parsed) ? parsed : void 0;
128288
+ return isRecord10(parsed) ? parsed : void 0;
127580
128289
  }
127581
128290
  function nonEmptyString2(record2, field) {
127582
128291
  const value2 = record2 === void 0 ? void 0 : record2[field];
@@ -127650,7 +128359,7 @@ async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
127650
128359
  }
127651
128360
  const results = [];
127652
128361
  for (const event of events) {
127653
- if (!isRecord9(event) || !isRecord9(event.payload)) {
128362
+ if (!isRecord10(event) || !isRecord10(event.payload)) {
127654
128363
  await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a teleport write is an object carrying one payload object" } });
127655
128364
  return true;
127656
128365
  }
@@ -127750,7 +128459,7 @@ async function serveRcCompatSessions(ctx, pathname, compatPath) {
127750
128459
  // src/frontdoor/rcSelfHostConversations.ts
127751
128460
  var RC_CONVERSATIONS_PATH_PREFIX = "/v1/code/conversations";
127752
128461
  var RC_CONVERSATION_ID_PREFIX = "conv_";
127753
- function isRecord10(value2) {
128462
+ function isRecord11(value2) {
127754
128463
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
127755
128464
  }
127756
128465
  function parseJsonObject4(body) {
@@ -127760,7 +128469,7 @@ function parseJsonObject4(body) {
127760
128469
  } catch {
127761
128470
  return void 0;
127762
128471
  }
127763
- return isRecord10(parsed) ? parsed : void 0;
128472
+ return isRecord11(parsed) ? parsed : void 0;
127764
128473
  }
127765
128474
  function nonEmptyString3(record2, field) {
127766
128475
  const value2 = record2 === void 0 ? void 0 : record2[field];
@@ -127814,7 +128523,7 @@ async function serveRcConversations(ctx, pathname, method) {
127814
128523
  }
127815
128524
  const results = [];
127816
128525
  for (const event of events) {
127817
- if (!isRecord10(event) || !isRecord10(event.payload)) {
128526
+ if (!isRecord11(event) || !isRecord11(event.payload)) {
127818
128527
  await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
127819
128528
  return;
127820
128529
  }
@@ -128107,7 +128816,7 @@ var RC_SELF_HOST_WORKER_EPOCH = 1;
128107
128816
  var RC_STREAM_EVENT_NAME = "client_event";
128108
128817
  var CONFLICT_REASON_HEADER2 = "x-ccr-conflict-reason";
128109
128818
  var CONFLICT_REASON_EPOCH_STALE = "epoch_stale";
128110
- function isRecord11(value2) {
128819
+ function isRecord12(value2) {
128111
128820
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
128112
128821
  }
128113
128822
  function isWebSearchRefusal(value2) {
@@ -128191,7 +128900,7 @@ function parseJsonObject5(body) {
128191
128900
  } catch {
128192
128901
  return void 0;
128193
128902
  }
128194
- return isRecord11(parsed) ? parsed : void 0;
128903
+ return isRecord12(parsed) ? parsed : void 0;
128195
128904
  }
128196
128905
  function mintWorkerJwt(randomToken, issuedAt) {
128197
128906
  const encode3 = (value2) => Buffer.from(JSON.stringify(value2), "utf8").toString("base64url");
@@ -128451,7 +129160,7 @@ data: ${JSON.stringify(envelope)}
128451
129160
  if (status !== void 0) {
128452
129161
  session.workerStatus = status;
128453
129162
  }
128454
- if (isRecord11(body?.external_metadata)) {
129163
+ if (isRecord12(body?.external_metadata)) {
128455
129164
  session.externalMetadata = body.external_metadata;
128456
129165
  }
128457
129166
  await answerJson2(response, HTTP_STATUS.ok, {});
@@ -128481,7 +129190,7 @@ data: ${JSON.stringify(envelope)}
128481
129190
  }
128482
129191
  const results = [];
128483
129192
  for (const event of events) {
128484
- if (!isRecord11(event) || !isRecord11(event.payload)) {
129193
+ if (!isRecord12(event) || !isRecord12(event.payload)) {
128485
129194
  await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a batch is an object carrying one payload object" } });
128486
129195
  return;
128487
129196
  }
@@ -128514,7 +129223,7 @@ data: ${JSON.stringify(envelope)}
128514
129223
  return;
128515
129224
  }
128516
129225
  for (const event of events) {
128517
- if (isRecord11(event)) {
129226
+ if (isRecord12(event)) {
128518
129227
  session.internalEvents.push({ eventId: deps.newUuid(), body: event });
128519
129228
  }
128520
129229
  }
@@ -128610,7 +129319,7 @@ data: ${JSON.stringify(envelope)}
128610
129319
  }
128611
129320
  const results = [];
128612
129321
  for (const event of events) {
128613
- if (!isRecord11(event) || !isRecord11(event.payload)) {
129322
+ if (!isRecord12(event) || !isRecord12(event.payload)) {
128614
129323
  await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
128615
129324
  return;
128616
129325
  }
@@ -128800,7 +129509,7 @@ function createSseParser() {
128800
129509
  }
128801
129510
  };
128802
129511
  }
128803
- function isRecord12(value2) {
129512
+ function isRecord13(value2) {
128804
129513
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
128805
129514
  }
128806
129515
  function sequenceNumOf(value2) {
@@ -128822,7 +129531,7 @@ function parseRcStreamEnvelope(parsed) {
128822
129531
  } catch {
128823
129532
  return void 0;
128824
129533
  }
128825
- if (!isRecord12(data)) {
129534
+ if (!isRecord13(data)) {
128826
129535
  return void 0;
128827
129536
  }
128828
129537
  const eventType = data.event_type;
@@ -129155,8 +129864,8 @@ function createRealQuotaRefresher(params) {
129155
129864
  // src/frontdoor/commands.ts
129156
129865
  init_store2();
129157
129866
  function appendLog(paths, line) {
129158
- import_node_fs16.default.mkdirSync(paths.logsDir, { recursive: true });
129159
- import_node_fs16.default.appendFileSync(paths.frontdoorLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
129867
+ import_node_fs17.default.mkdirSync(paths.logsDir, { recursive: true });
129868
+ import_node_fs17.default.appendFileSync(paths.frontdoorLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
129160
129869
  `);
129161
129870
  }
129162
129871
  function rcObservingResolver(resolve2, tracker, hub) {
@@ -129169,7 +129878,7 @@ function rcObservingResolver(resolve2, tracker, hub) {
129169
129878
  }
129170
129879
  function realStatOwnExecutable(watchPath) {
129171
129880
  return () => {
129172
- const st2 = import_node_fs16.default.statSync(watchPath, { throwIfNoEntry: false });
129881
+ const st2 = import_node_fs17.default.statSync(watchPath, { throwIfNoEntry: false });
129173
129882
  return st2?.isFile() !== true ? void 0 : { dev: st2.dev, ino: st2.ino, size: st2.size, mtimeMs: st2.mtimeMs };
129174
129883
  };
129175
129884
  }
@@ -129273,7 +129982,9 @@ function realFrontDoorSupervisorPorts(paths) {
129273
129982
  log(`pool usage refresh failed: ${error63 instanceof Error ? error63.message : String(error63)}`);
129274
129983
  }
129275
129984
  }, ANTHROPIC_USAGE_FRESHNESS_MS).unref();
129276
- const windowOpener = createRealWindowOpener({ paths, cwd: process.cwd(), spawnDaemon: spawnDetachedSupervisor });
129985
+ const windowOpener = async (identity) => {
129986
+ await runChild({ paths, args: ["__open-window", identity], timeoutMs: WINDOW_OPEN_TIMEOUT_MS });
129987
+ };
129277
129988
  let keeperRunning = false;
129278
129989
  setInterval(() => {
129279
129990
  if (keeperRunning) {
@@ -129295,7 +130006,9 @@ function realFrontDoorSupervisorPorts(paths) {
129295
130006
  keeperRunning = false;
129296
130007
  });
129297
130008
  }, ANTHROPIC_USAGE_FRESHNESS_MS).unref();
129298
- const jobRunner = createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() });
130009
+ const jobRunner = async (name, identity, job) => {
130010
+ await runChild({ paths, args: ["__run-job", name, identity], timeoutMs: parseDuration(job.timeout) });
130011
+ };
129299
130012
  const runningJobs = /* @__PURE__ */ new Set();
129300
130013
  setInterval(() => {
129301
130014
  try {
@@ -129350,7 +130063,7 @@ function realFrontDoorSupervisorPorts(paths) {
129350
130063
  },
129351
130064
  isRunning: realIsProcessRunning,
129352
130065
  // The turnover check's file identity, over the installed entry resolved once at door start: re-resolving per tick would re-run the PATH scan every second and could theoretically flip between two files, while the entry itself is fixed for as long as this door lives. The existence check prefers the agent-shim sibling only when it is really there (see watchedInstallEntry).
129353
- statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs16.default.existsSync(candidate))),
130066
+ statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs17.default.existsSync(candidate))),
129354
130067
  startProviderListener: async (preferredPort) => {
129355
130068
  const authority = loadCa();
129356
130069
  const rcDial = rcSelfHost ? lateRcEventDial(rcSelfHostDialTarget) : realRcEventDial();
@@ -129388,7 +130101,11 @@ function realFrontDoorSupervisorPorts(paths) {
129388
130101
  },
129389
130102
  poolNames: () => Object.keys(readPools(paths)).sort(),
129390
130103
  // A read-only resolution of what a launch from one directory would do: the launcher's own decision with its effects left out, so a read never recovers or resyncs a farm, starts a daemon, records a pool pick or runs a credential command.
129391
- resolveLaunch: (request7) => resolveClaudeLaunch({ argv: request7.argv, cwd: request7.path, env: request7.env, paths })
130104
+ resolveLaunch: (request7) => resolveClaudeLaunch({ argv: request7.argv, cwd: request7.path, env: request7.env, paths }),
130105
+ // The identities are read per call, like the pool table, so an identity added after the door started is listed the moment the CLI would see it.
130106
+ sessionList: (filters) => collectSessionList(realSessionFs, paths.identitiesDir, listIdentities(paths).map((entry) => entry.name), { ...filters.identity === void 0 ? {} : { identity: filters.identity }, ...filters.all === void 0 ? {} : { all: filters.all } }),
130107
+ liveTasks: () => rcTracker.liveTasksOf(),
130108
+ sessionShow: (query, identity) => showSession(realSessionFs, paths.identitiesDir, listIdentities(paths).map((entry) => entry.name), query, identity)
129392
130109
  };
129393
130110
  const lifecycleAndCodexDeps = {
129394
130111
  doorPid: process.pid,
@@ -129458,7 +130175,7 @@ function realFrontDoorSupervisorPorts(paths) {
129458
130175
  const leafFor = createLeafCache(loadCa(), () => /* @__PURE__ */ new Date());
129459
130176
  const capture = captureFromEnv(process.env, paths.logsDir);
129460
130177
  if (capture !== void 0) {
129461
- log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path47.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
130178
+ log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path48.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
129462
130179
  }
129463
130180
  if (rcSelfHostSurface !== void 0) {
129464
130181
  log("self-hosted Remote Control surface on: the door serves the CCR session family itself, and its own client-half dials its own transparent surface");
@@ -139324,31 +140041,33 @@ async function serveMcp(mcp, transport, options = {}) {
139324
140041
  }
139325
140042
 
139326
140043
  // src/mcp/permissions.ts
139327
- var import_node_fs17 = __toESM(require("node:fs"), 1);
139328
- var import_node_path48 = __toESM(require("node:path"), 1);
140044
+ var import_node_fs18 = __toESM(require("node:fs"), 1);
140045
+ var import_node_path49 = __toESM(require("node:path"), 1);
139329
140046
  init_zod();
139330
140047
  init_store();
139331
140048
  var StoredMcpPermissionsSchema = external_exports.strictObject({
139332
140049
  writes: external_exports.boolean(),
139333
- remoteControl: external_exports.boolean()
140050
+ remoteControl: external_exports.boolean(),
140051
+ // Absent from a file written before the grant existed, which meant not allowed.
140052
+ history: external_exports.boolean().default(false)
139334
140053
  });
139335
140054
  var OWNER_ONLY_MODE = 384;
139336
- var NONE2 = { writes: false, remoteControl: false };
140055
+ var NONE2 = { writes: false, remoteControl: false, history: false };
139337
140056
  function readStoredMcpPermissions(paths) {
139338
140057
  return readJson(paths.mcpPermissionsFile, StoredMcpPermissionsSchema) ?? NONE2;
139339
140058
  }
139340
140059
  function writeStoredMcpPermissions(paths, permissions) {
139341
- writeJsonAtomic(paths.mcpPermissionsFile, { writes: permissions.writes, remoteControl: permissions.remoteControl });
139342
- import_node_fs17.default.chmodSync(paths.mcpPermissionsFile, OWNER_ONLY_MODE);
140060
+ writeJsonAtomic(paths.mcpPermissionsFile, { writes: permissions.writes, remoteControl: permissions.remoteControl, history: permissions.history });
140061
+ import_node_fs18.default.chmodSync(paths.mcpPermissionsFile, OWNER_ONLY_MODE);
139343
140062
  }
139344
140063
  function effectiveMcpPermissions(flags, stored) {
139345
- return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl };
140064
+ return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
139346
140065
  }
139347
140066
  function watchMcpPermissions(paths, onChange) {
139348
- const directory = import_node_path48.default.dirname(paths.mcpPermissionsFile);
139349
- import_node_fs17.default.mkdirSync(directory, { recursive: true });
139350
- const watcher = import_node_fs17.default.watch(directory, (_event, filename) => {
139351
- if (filename === null || filename === import_node_path48.default.basename(paths.mcpPermissionsFile)) {
140067
+ const directory = import_node_path49.default.dirname(paths.mcpPermissionsFile);
140068
+ import_node_fs18.default.mkdirSync(directory, { recursive: true });
140069
+ const watcher = import_node_fs18.default.watch(directory, (_event, filename) => {
140070
+ if (filename === null || filename === import_node_path49.default.basename(paths.mcpPermissionsFile)) {
139352
140071
  onChange();
139353
140072
  }
139354
140073
  });
@@ -139395,6 +140114,9 @@ function isStream(operation) {
139395
140114
  return Object.values(operation.responses ?? {}).some((response) => response.content !== void 0 && "text/event-stream" in response.content);
139396
140115
  }
139397
140116
  function permitted(tag, readOnly, permissions) {
140117
+ if (tag === SESSION_HISTORY_TAG) {
140118
+ return permissions.history;
140119
+ }
139398
140120
  if (readOnly) {
139399
140121
  return true;
139400
140122
  }
@@ -139456,16 +140178,16 @@ function doorMcpPorts(paths, permissions) {
139456
140178
  }
139457
140179
  };
139458
140180
  }
139459
- var PERMISSION_FIELDS = { writes: "writes", "remote-control": "remoteControl" };
140181
+ var PERMISSION_FIELDS = { writes: "writes", "remote-control": "remoteControl", history: "history" };
139460
140182
  function permissionName(value2) {
139461
- if (value2 !== "writes" && value2 !== "remote-control") {
139462
- throw new UsageError(`unknown permission "${value2}": expected writes or remote-control`);
140183
+ if (value2 !== "writes" && value2 !== "remote-control" && value2 !== "history") {
140184
+ throw new UsageError(`unknown permission "${value2}": expected writes, remote-control or history`);
139463
140185
  }
139464
140186
  return value2;
139465
140187
  }
139466
140188
  function registerMcpCommand(program2, deps) {
139467
- const mcp = program2.command("mcp").description("Serve the front door's typed API as MCP tools on standard input and output, so an agent can read quota and door state and, when allowed, act on it.").option("--allow-writes", "Also expose the operations that change the door's configuration and lifecycle, whatever `mcp permissions` says. Read-only without it or a stored permission.").option("--allow-remote-control", "Also expose the Remote Control operations that send into, answer for and end other sessions, whatever `mcp permissions` says.").action(async (options) => {
139468
- const flags = { writes: options.allowWrites === true, remoteControl: options.allowRemoteControl === true };
140189
+ const mcp = program2.command("mcp").description("Serve the front door's typed API as MCP tools on standard input and output, so an agent can read quota and door state and, when allowed, act on it.").option("--allow-writes", "Also expose the operations that change the door's configuration and lifecycle, whatever `mcp permissions` says. Read-only without it or a stored permission.").option("--allow-remote-control", "Also expose the Remote Control operations that send into, answer for and end other sessions, whatever `mcp permissions` says.").option("--allow-history", "Also expose the reads of session history (agents, tasks and workflow runs across every identity), whatever `mcp permissions` says.").action(async (options) => {
140190
+ const flags = { writes: options.allowWrites === true, remoteControl: options.allowRemoteControl === true, history: options.allowHistory === true };
139469
140191
  const inForce = () => effectiveMcpPermissions(flags, readStoredMcpPermissions(deps.paths));
139470
140192
  const server = createMcpServer({ name: "agent-shim", version: package_default.version }, doorMcpPorts(deps.paths, inForce));
139471
140193
  await serveMcp(server, new StdioServerTransport(), {
@@ -139489,12 +140211,13 @@ function registerMcpCommand(program2, deps) {
139489
140211
  }
139490
140212
  console.log(`writes: ${stored.writes ? "allowed" : "not allowed"}`);
139491
140213
  console.log(`remote-control: ${stored.remoteControl ? "allowed" : "not allowed"}`);
140214
+ console.log(`history: ${stored.history ? "allowed" : "not allowed"}`);
139492
140215
  }),
139493
140216
  ["agent-shim mcp permissions show"]
139494
140217
  );
139495
140218
  for (const [verb, granted] of [["allow", true], ["deny", false]]) {
139496
140219
  withExamples(
139497
- permissions.command(`${verb} <permission>`).description(`${verb === "allow" ? "Allow" : "Stop allowing"} \`writes\` (configuration and lifecycle operations) or \`remote-control\` (operations on other sessions) for the MCP server's agents.`).action((permission) => {
140220
+ permissions.command(`${verb} <permission>`).description(`${verb === "allow" ? "Allow" : "Stop allowing"} \`writes\` (configuration and lifecycle operations), \`remote-control\` (operations on other sessions) or \`history\` (reads of session history across identities) for the MCP server's agents.`).action((permission) => {
139498
140221
  const field = PERMISSION_FIELDS[permissionName(permission)];
139499
140222
  writeStoredMcpPermissions(deps.paths, { ...readStoredMcpPermissions(deps.paths), [field]: granted });
139500
140223
  console.log(`${permission}: ${granted ? "allowed" : "not allowed"}`);
@@ -139649,24 +140372,24 @@ function registerCompletionCommand(program2) {
139649
140372
  }
139650
140373
 
139651
140374
  // src/credentialCommand.ts
139652
- var import_node_child_process5 = require("node:child_process");
140375
+ var import_node_child_process6 = require("node:child_process");
139653
140376
  init_commandDeps();
139654
140377
  init_cliError();
139655
140378
  init_credential();
139656
140379
  init_credentialCache();
139657
140380
 
139658
140381
  // src/identityToken.ts
139659
- var import_node_fs18 = __toESM(require("node:fs"), 1);
139660
- var import_node_path49 = __toESM(require("node:path"), 1);
140382
+ var import_node_fs19 = __toESM(require("node:fs"), 1);
140383
+ var import_node_path50 = __toESM(require("node:path"), 1);
139661
140384
  init_cliError();
139662
140385
  var TOKEN_FILE_MODE = 384;
139663
140386
  var TOKEN_DIR_MODE = 448;
139664
140387
  var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
139665
140388
  function identityTokenDir(paths) {
139666
- return import_node_path49.default.join(paths.root, "credentials");
140389
+ return import_node_path50.default.join(paths.root, "credentials");
139667
140390
  }
139668
140391
  function identityTokenPath(paths, identityName) {
139669
- return import_node_path49.default.join(identityTokenDir(paths), `${identityName}.token`);
140392
+ return import_node_path50.default.join(identityTokenDir(paths), `${identityName}.token`);
139670
140393
  }
139671
140394
  function storeIdentityToken(paths, identityName, raw) {
139672
140395
  const token = raw.trim();
@@ -139674,13 +140397,13 @@ function storeIdentityToken(paths, identityName, raw) {
139674
140397
  throw new UsageError("That is not a claude setup-token token (expected it to start with sk-ant-oat). Run `claude setup-token` and pass its token on standard input.");
139675
140398
  }
139676
140399
  const dir = identityTokenDir(paths);
139677
- import_node_fs18.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
139678
- import_node_fs18.default.chmodSync(dir, TOKEN_DIR_MODE);
140400
+ import_node_fs19.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
140401
+ import_node_fs19.default.chmodSync(dir, TOKEN_DIR_MODE);
139679
140402
  const target = identityTokenPath(paths, identityName);
139680
- const temp = import_node_path49.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
139681
- import_node_fs18.default.writeFileSync(temp, `${token}
140403
+ const temp = import_node_path50.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
140404
+ import_node_fs19.default.writeFileSync(temp, `${token}
139682
140405
  `, { mode: TOKEN_FILE_MODE });
139683
- import_node_fs18.default.renameSync(temp, target);
140406
+ import_node_fs19.default.renameSync(temp, target);
139684
140407
  return target;
139685
140408
  }
139686
140409
 
@@ -139709,7 +140432,7 @@ function realCommandPorts(deps) {
139709
140432
  cache: createRealCredentialCache(deps.paths.root),
139710
140433
  platform: process.platform,
139711
140434
  now: () => Date.now(),
139712
- ssh: (host, remoteCommand, input2) => (0, import_node_child_process5.spawnSync)("ssh", ["--", host, remoteCommand], { input: input2, stdio: ["pipe", "inherit", "inherit"] }).status
140435
+ ssh: (host, remoteCommand, input2) => (0, import_node_child_process6.spawnSync)("ssh", ["--", host, remoteCommand], { input: input2, stdio: ["pipe", "inherit", "inherit"] }).status
139713
140436
  };
139714
140437
  }
139715
140438
  var REMOTE_ROOT_SCRIPT = 'root="${AGENT_SHIM_HOME:-${CLAUDE_USE_HOME:-}}"; if [ -z "$root" ]; then if [ ! -d "$HOME/.agent-shim" ] && [ -d "$HOME/.claude-use" ]; then root="$HOME/.claude-use"; else root="$HOME/.agent-shim"; fi; fi';
@@ -139843,10 +140566,10 @@ function registerDoctorCommand(program2, deps) {
139843
140566
  }
139844
140567
 
139845
140568
  // src/headroom/commands.ts
139846
- var import_node_fs19 = __toESM(require("node:fs"), 1);
140569
+ var import_node_fs20 = __toESM(require("node:fs"), 1);
139847
140570
  var import_node_http4 = __toESM(require("node:http"), 1);
139848
- var import_node_path50 = __toESM(require("node:path"), 1);
139849
- var import_node_child_process6 = require("node:child_process");
140571
+ var import_node_path51 = __toESM(require("node:path"), 1);
140572
+ var import_node_child_process7 = require("node:child_process");
139850
140573
  init_commandDeps();
139851
140574
  init_realFrontDoorPort();
139852
140575
  init_trust();
@@ -139971,16 +140694,16 @@ async function readyOverSocket(socketPath) {
139971
140694
  }
139972
140695
  var HEADROOM_TOOL_NAME = "headroom-ai";
139973
140696
  function readInstalledHeadroomCommit() {
139974
- const toolDir = (0, import_node_child_process6.spawnSync)("uv", ["tool", "dir"], { encoding: "utf8" });
140697
+ const toolDir = (0, import_node_child_process7.spawnSync)("uv", ["tool", "dir"], { encoding: "utf8" });
139975
140698
  if (toolDir.status !== 0) {
139976
140699
  return void 0;
139977
140700
  }
139978
- const libDir = import_node_path50.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
140701
+ const libDir = import_node_path51.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
139979
140702
  for (const python of realFarmFs.readdir(libDir)) {
139980
- const sitePackages = import_node_path50.default.join(libDir, python, "site-packages");
140703
+ const sitePackages = import_node_path51.default.join(libDir, python, "site-packages");
139981
140704
  for (const entry of realFarmFs.readdir(sitePackages)) {
139982
140705
  if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
139983
- const directUrl = realFarmFs.readFileUtf8(import_node_path50.default.join(sitePackages, entry, "direct_url.json"));
140706
+ const directUrl = realFarmFs.readFileUtf8(import_node_path51.default.join(sitePackages, entry, "direct_url.json"));
139984
140707
  return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
139985
140708
  }
139986
140709
  }
@@ -140004,14 +140727,14 @@ function realSupervisorPorts(paths) {
140004
140727
  readConfig: () => resolveSupervisorConfig(readGlobalConfig(paths)?.headroom ?? {}),
140005
140728
  spawnHeadroom: (socketPath, allowlist, settings2) => {
140006
140729
  const trust = resolveHeadroomTrustBundle({ caCertFile: paths.frontdoorCaCertFile, bundlesDir: paths.frontdoorCaBundlesDir, inherited: process.env[HEADROOM_CA_BUNDLE], fs: realTrustBundleFs });
140007
- import_node_fs19.default.mkdirSync(paths.logsDir, { recursive: true });
140730
+ import_node_fs20.default.mkdirSync(paths.logsDir, { recursive: true });
140008
140731
  if (trust?.warning !== void 0) {
140009
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${trust.warning}
140732
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${trust.warning}
140010
140733
  `);
140011
140734
  }
140012
- const logFd = import_node_fs19.default.openSync(paths.headroomLogPath, "a");
140735
+ const logFd = import_node_fs20.default.openSync(paths.headroomLogPath, "a");
140013
140736
  try {
140014
- const child = (0, import_node_child_process6.spawn)("headroom", headroomProxyArgs(socketPath, settings2), {
140737
+ const child = (0, import_node_child_process7.spawn)("headroom", headroomProxyArgs(socketPath, settings2), {
140015
140738
  detached: true,
140016
140739
  stdio: ["ignore", logFd, logFd],
140017
140740
  env: headroomSpawnEnv(process.env, allowlist, settings2, trust?.path)
@@ -140024,12 +140747,12 @@ function realSupervisorPorts(paths) {
140024
140747
  child.once("exit", (code, signal) => {
140025
140748
  ownedHeadroom.delete(pid);
140026
140749
  exitedHeadroom.add(pid);
140027
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: headroom exited (${signal ?? `code ${String(code)}`})
140750
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: headroom exited (${signal ?? `code ${String(code)}`})
140028
140751
  `);
140029
140752
  });
140030
140753
  return pid;
140031
140754
  } finally {
140032
- import_node_fs19.default.closeSync(logFd);
140755
+ import_node_fs20.default.closeSync(logFd);
140033
140756
  }
140034
140757
  },
140035
140758
  stopProcess: (pid) => {
@@ -140042,7 +140765,7 @@ function realSupervisorPorts(paths) {
140042
140765
  now: () => Date.now()
140043
140766
  });
140044
140767
  if (outcome === "still-running") {
140045
- import_node_fs19.default.appendFileSync(
140768
+ import_node_fs20.default.appendFileSync(
140046
140769
  paths.headroomLogPath,
140047
140770
  `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: pid ${String(pid)} survived SIGKILL within its grace; it is stuck uninterruptibly
140048
140771
  `
@@ -140051,26 +140774,26 @@ function realSupervisorPorts(paths) {
140051
140774
  },
140052
140775
  ready: readyOverSocket,
140053
140776
  install: (spec) => {
140054
- const result = (0, import_node_child_process6.spawnSync)("uv", ["tool", "install", spec], { encoding: "utf8" });
140777
+ const result = (0, import_node_child_process7.spawnSync)("uv", ["tool", "install", spec], { encoding: "utf8" });
140055
140778
  if (result.error !== void 0) {
140056
140779
  return { ok: false, error: `uv is not installed or not on PATH (${result.error.message})` };
140057
140780
  }
140058
140781
  if (result.stdout !== "") {
140059
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, result.stdout);
140782
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, result.stdout);
140060
140783
  }
140061
140784
  if (result.stderr !== "") {
140062
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, result.stderr);
140785
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, result.stderr);
140063
140786
  }
140064
140787
  return result.status === 0 ? { ok: true } : { ok: false, error: `uv tool install exited ${String(result.status)}` };
140065
140788
  },
140066
140789
  headroomVersion: () => {
140067
- const result = (0, import_node_child_process6.spawnSync)("headroom", ["--version"], { encoding: "utf8" });
140790
+ const result = (0, import_node_child_process7.spawnSync)("headroom", ["--version"], { encoding: "utf8" });
140068
140791
  return result.status === 0 ? result.stdout.trim() : void 0;
140069
140792
  },
140070
140793
  installedCommit: readInstalledHeadroomCommit,
140071
140794
  log: (line) => {
140072
- import_node_fs19.default.mkdirSync(paths.logsDir, { recursive: true });
140073
- import_node_fs19.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
140795
+ import_node_fs20.default.mkdirSync(paths.logsDir, { recursive: true });
140796
+ import_node_fs20.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
140074
140797
  `);
140075
140798
  }
140076
140799
  };
@@ -140115,8 +140838,78 @@ function registerHeadroomCommand(program2, deps) {
140115
140838
  });
140116
140839
  }
140117
140840
 
140841
+ // src/headlessCommands.ts
140842
+ init_realPorts();
140843
+
140844
+ // src/usage/realJobRunner.ts
140845
+ var import_node_path52 = __toESM(require("node:path"), 1);
140846
+ init_conditions();
140847
+ init_identityClaude();
140848
+ var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
140849
+ var JOB_ISOLATION_OPTIONS = { settingSources: ["user"], mcpServers: {}, strictMcpConfig: true };
140850
+ function logEntry(name, identity, endedAt, outcome) {
140851
+ return `${endedAt.toISOString()} job ${name} as ${identity}
140852
+ ${outcome.trimEnd()}
140853
+
140854
+ `;
140855
+ }
140856
+ function createRealJobRunner(params) {
140857
+ return async (name, identity, job) => {
140858
+ const logFile = import_node_path52.default.join(params.paths.jobLogsDir, `${name}.log`);
140859
+ const append = (outcome) => {
140860
+ params.fs.mkdirPrivate(params.paths.jobLogsDir);
140861
+ params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
140862
+ };
140863
+ try {
140864
+ const result = await withIdentityClaude({ paths: params.paths, spawnDaemon: params.spawnDaemon, cwd: job.cwd, timeoutMs: parseDuration(job.timeout) }, identity, JOB_LAUNCH_FLAGS, async ({ bin, env, cwd, abort }) => {
140865
+ const { query } = await Promise.resolve().then(() => (init_sdk(), sdk_exports));
140866
+ const session = query({
140867
+ prompt: job.prompt,
140868
+ options: {
140869
+ pathToClaudeCodeExecutable: bin,
140870
+ env,
140871
+ cwd,
140872
+ abortController: abort,
140873
+ settingSources: [...JOB_ISOLATION_OPTIONS.settingSources],
140874
+ mcpServers: JOB_ISOLATION_OPTIONS.mcpServers,
140875
+ strictMcpConfig: JOB_ISOLATION_OPTIONS.strictMcpConfig,
140876
+ permissionMode: "dontAsk",
140877
+ ...job.model === void 0 ? {} : { model: job.model },
140878
+ ...job.allowedTools === void 0 ? {} : { allowedTools: [...job.allowedTools] }
140879
+ }
140880
+ });
140881
+ try {
140882
+ for await (const message of session) {
140883
+ if (message.type === "result") {
140884
+ return successfulResult(message);
140885
+ }
140886
+ }
140887
+ throw new Error("the run ended without a result");
140888
+ } finally {
140889
+ session.close();
140890
+ }
140891
+ });
140892
+ append(result);
140893
+ } catch (error63) {
140894
+ append(`FAILED: ${error63 instanceof Error ? error63.message : String(error63)}`);
140895
+ throw error63;
140896
+ }
140897
+ };
140898
+ }
140899
+
140900
+ // src/headlessCommands.ts
140901
+ function registerHeadlessCommands(program2, deps) {
140902
+ const { paths } = deps;
140903
+ program2.command("__open-window <identity>", { hidden: true }).description("Internal: open a five-hour window for an identity with one request. Started by the front door's window keeper.").action(async (identity) => {
140904
+ await createRealWindowOpener({ paths, cwd: process.cwd(), spawnDaemon: spawnDetachedSupervisor })(identity);
140905
+ });
140906
+ program2.command("__run-job <name> <identity>", { hidden: true }).description("Internal: run a job as an identity. Started by the front door's job keeper.").action(async (name, identity) => {
140907
+ await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, requireJob(paths, name));
140908
+ });
140909
+ }
140910
+
140118
140911
  // src/jobs.ts
140119
- var import_node_path51 = __toESM(require("node:path"), 1);
140912
+ var import_node_path53 = __toESM(require("node:path"), 1);
140120
140913
  init_commandDeps();
140121
140914
  init_cliError();
140122
140915
  init_schema();
@@ -140141,7 +140934,7 @@ function jobOf(options) {
140141
140934
  target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
140142
140935
  trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
140143
140936
  prompt: options.prompt,
140144
- cwd: import_node_path51.default.resolve(options.cwd ?? process.cwd()),
140937
+ cwd: import_node_path53.default.resolve(options.cwd ?? process.cwd()),
140145
140938
  timeout: options.timeout,
140146
140939
  ...options.model === void 0 ? {} : { model: options.model },
140147
140940
  ...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
@@ -140214,7 +141007,7 @@ function registerJobCommand(program2, deps) {
140214
141007
  console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
140215
141008
  }
140216
141009
  console.log(`Prompt: ${entry.prompt}`);
140217
- console.log(`Results: ${import_node_path51.default.join(paths.jobLogsDir, `${name}.log`)}`);
141010
+ console.log(`Results: ${import_node_path53.default.join(paths.jobLogsDir, `${name}.log`)}`);
140218
141011
  }),
140219
141012
  ["agent-shim job show digest"]
140220
141013
  );
@@ -140237,7 +141030,7 @@ function registerJobCommand(program2, deps) {
140237
141030
  throw new UsageError(`No member of the job's pool can be picked right now.`);
140238
141031
  }
140239
141032
  await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
140240
- console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path51.default.join(paths.jobLogsDir, `${name}.log`)}.`);
141033
+ console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path53.default.join(paths.jobLogsDir, `${name}.log`)}.`);
140241
141034
  }),
140242
141035
  ["agent-shim job run digest"]
140243
141036
  );
@@ -140648,472 +141441,7 @@ function registerRunCommand(program2, handler) {
140648
141441
  }
140649
141442
 
140650
141443
  // src/agents/commands.ts
140651
- var import_node_fs20 = __toESM(require("node:fs"), 1);
140652
- var import_node_path53 = __toESM(require("node:path"), 1);
140653
141444
  init_commandDeps();
140654
- init_cliError();
140655
- init_realPorts();
140656
-
140657
- // src/agents/read.ts
140658
- var import_node_path52 = __toESM(require("node:path"), 1);
140659
- init_zod();
140660
-
140661
- // src/agents/schema.ts
140662
- init_zod();
140663
- var AgentMetaSchema = external_exports.looseObject({
140664
- agentType: external_exports.string(),
140665
- isFork: external_exports.boolean().optional(),
140666
- description: external_exports.string().optional(),
140667
- name: external_exports.string().optional(),
140668
- toolUseId: external_exports.string().optional(),
140669
- spawnDepth: external_exports.number().int().nonnegative().optional(),
140670
- parentAgentId: external_exports.string().optional(),
140671
- model: external_exports.string().optional(),
140672
- requestShape: external_exports.string().optional(),
140673
- requestNonInteractive: external_exports.boolean().optional(),
140674
- workflowPhase: external_exports.string().optional(),
140675
- taskKind: external_exports.string().optional(),
140676
- teamName: external_exports.string().optional(),
140677
- worktreePath: external_exports.string().optional(),
140678
- worktreeBranch: external_exports.string().optional(),
140679
- stoppedByUser: external_exports.boolean().optional()
140680
- });
140681
- var AgentKindSchema = external_exports.enum(["subagent", "fork", "workflow-agent", "teammate"]);
140682
- var AgentNodeSchema = external_exports.lazy(
140683
- () => external_exports.strictObject({
140684
- id: external_exports.string(),
140685
- kind: AgentKindSchema,
140686
- agentType: external_exports.string(),
140687
- description: external_exports.string().optional(),
140688
- name: external_exports.string().optional(),
140689
- toolUseId: external_exports.string().optional(),
140690
- spawnDepth: external_exports.number().int().nonnegative().optional(),
140691
- model: external_exports.string().optional(),
140692
- background: external_exports.boolean().optional(),
140693
- workflowRunId: external_exports.string().optional(),
140694
- workflowPhase: external_exports.string().optional(),
140695
- teamName: external_exports.string().optional(),
140696
- stoppedByUser: external_exports.boolean().optional(),
140697
- transcript: external_exports.string(),
140698
- children: external_exports.array(AgentNodeSchema)
140699
- })
140700
- );
140701
- var TaskItemSchema = external_exports.strictObject({
140702
- id: external_exports.string(),
140703
- subject: external_exports.string(),
140704
- description: external_exports.string().optional(),
140705
- status: external_exports.string(),
140706
- /** What a spinner shows while the task runs. */
140707
- activeForm: external_exports.string().optional(),
140708
- /** The teammate or agent name the task is assigned to, as Agent Teams writes it. */
140709
- owner: external_exports.string().optional(),
140710
- /** Free-form data the harness attaches to a task, kept as written. */
140711
- metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
140712
- blocks: external_exports.array(external_exports.string()),
140713
- blockedBy: external_exports.array(external_exports.string()),
140714
- /** The id of the shared task list this task belongs to (a team's name, or a custom list id), absent for the session's own list. */
140715
- taskList: external_exports.string().optional()
140716
- });
140717
- var WorkflowRunSchema = external_exports.strictObject({
140718
- runId: external_exports.string(),
140719
- workflowName: external_exports.string().optional(),
140720
- status: external_exports.string().optional(),
140721
- startTime: external_exports.number().optional(),
140722
- phases: external_exports.array(external_exports.string()),
140723
- summary: external_exports.string().optional()
140724
- });
140725
- var AgentTreeProblemSchema = external_exports.strictObject({
140726
- /** Relative to the identity's configuration directory. */
140727
- path: external_exports.string(),
140728
- reason: external_exports.string()
140729
- });
140730
- var SessionAgentTreeSchema = external_exports.strictObject({
140731
- project: external_exports.string(),
140732
- sessionId: external_exports.string(),
140733
- /** True for a session directory a resume superseded (`<session-id>.superseded-<epoch-ms>`). */
140734
- superseded: external_exports.boolean(),
140735
- /** The agents the session itself spawned, each with its descendants. */
140736
- agents: external_exports.array(AgentNodeSchema),
140737
- tasks: external_exports.array(TaskItemSchema),
140738
- workflowRuns: external_exports.array(WorkflowRunSchema),
140739
- problems: external_exports.array(AgentTreeProblemSchema)
140740
- });
140741
-
140742
- // src/agents/read.ts
140743
- var PROJECTS_DIR = "projects";
140744
- var TASKS_DIR = "tasks";
140745
- var SUBAGENTS_DIR = "subagents";
140746
- var WORKFLOWS_DIR = "workflows";
140747
- var AGENT_FILE_PREFIX = "agent-";
140748
- var META_SUFFIX = ".meta.json";
140749
- var TRANSCRIPT_SUFFIX = ".jsonl";
140750
- var SHORT_SESSION_ID_LENGTH = 8;
140751
- var SHORT_SESSION_LIST_PREFIX = "session-";
140752
- var JSON_SUFFIX = ".json";
140753
- var WORKFLOW_RUN_PREFIX = "wf_";
140754
- var ARCHIVED_RE = /^(.+)\.(?:superseded|orphaned)-.+$/;
140755
- var FORK_AGENT_TYPE = "fork";
140756
- var WORKFLOW_AGENT_TYPE = "workflow-subagent";
140757
- var TEAMMATE_TASK_KIND = "in_process_teammate";
140758
- var BACKGROUND_REQUEST_SHAPE = "background";
140759
- var SESSION_SPAWN_DEPTH = 1;
140760
- function parseEntry2(project, entry) {
140761
- const match = ARCHIVED_RE.exec(entry);
140762
- const base = match?.[1];
140763
- return base === void 0 ? { project, sessionId: entry, superseded: false, entry } : { project, sessionId: base, superseded: true, entry };
140764
- }
140765
- function listSessions2(fs22, configDir) {
140766
- const found = [];
140767
- for (const project of fs22.readdir(import_node_path52.default.join(configDir, PROJECTS_DIR))) {
140768
- const projectDir = import_node_path52.default.join(configDir, PROJECTS_DIR, project);
140769
- const entries = /* @__PURE__ */ new Set();
140770
- for (const name of fs22.readdir(projectDir)) {
140771
- if (name.endsWith(TRANSCRIPT_SUFFIX)) {
140772
- entries.add(name.slice(0, -TRANSCRIPT_SUFFIX.length));
140773
- continue;
140774
- }
140775
- const children = fs22.readdir(import_node_path52.default.join(projectDir, name));
140776
- if (children.includes(SUBAGENTS_DIR) || children.includes(WORKFLOWS_DIR)) {
140777
- entries.add(name);
140778
- }
140779
- }
140780
- for (const entry of entries) {
140781
- found.push(parseEntry2(project, entry));
140782
- }
140783
- }
140784
- return found.sort((left, right) => left.project.localeCompare(right.project) || left.entry.localeCompare(right.entry));
140785
- }
140786
- function locateAgents(fs22, configDir, relativeDir, workflowRunId, report) {
140787
- const located = [];
140788
- for (const name of listDirOrReport(fs22, configDir, relativeDir, report)) {
140789
- if (!name.startsWith(AGENT_FILE_PREFIX) || !name.endsWith(META_SUFFIX)) {
140790
- continue;
140791
- }
140792
- const id2 = name.slice(AGENT_FILE_PREFIX.length, -META_SUFFIX.length);
140793
- located.push({
140794
- id: id2,
140795
- metaPath: import_node_path52.default.join(relativeDir, name),
140796
- transcriptPath: import_node_path52.default.join(relativeDir, `${AGENT_FILE_PREFIX}${id2}${TRANSCRIPT_SUFFIX}`),
140797
- workflowRunId
140798
- });
140799
- }
140800
- return located;
140801
- }
140802
- function kindOf(meta3, workflowRunId) {
140803
- if (meta3.isFork === true || meta3.agentType === FORK_AGENT_TYPE) {
140804
- return "fork";
140805
- }
140806
- if (workflowRunId !== void 0 || meta3.agentType === WORKFLOW_AGENT_TYPE) {
140807
- return "workflow-agent";
140808
- }
140809
- if (meta3.taskKind === TEAMMATE_TASK_KIND || meta3.teamName !== void 0) {
140810
- return "teammate";
140811
- }
140812
- return "subagent";
140813
- }
140814
- function toNode(read, children) {
140815
- const { located, meta: meta3 } = read;
140816
- return {
140817
- id: located.id,
140818
- kind: kindOf(meta3, located.workflowRunId),
140819
- agentType: meta3.agentType,
140820
- ...meta3.description === void 0 ? {} : { description: meta3.description },
140821
- ...meta3.name === void 0 ? {} : { name: meta3.name },
140822
- ...meta3.toolUseId === void 0 ? {} : { toolUseId: meta3.toolUseId },
140823
- ...meta3.spawnDepth === void 0 ? {} : { spawnDepth: meta3.spawnDepth },
140824
- ...meta3.model === void 0 ? {} : { model: meta3.model },
140825
- ...meta3.requestShape === void 0 ? {} : { background: meta3.requestShape === BACKGROUND_REQUEST_SHAPE },
140826
- ...located.workflowRunId === void 0 ? {} : { workflowRunId: located.workflowRunId },
140827
- ...meta3.workflowPhase === void 0 ? {} : { workflowPhase: meta3.workflowPhase },
140828
- ...meta3.teamName === void 0 ? {} : { teamName: meta3.teamName },
140829
- ...meta3.stoppedByUser === void 0 ? {} : { stoppedByUser: meta3.stoppedByUser },
140830
- transcript: located.transcriptPath,
140831
- children
140832
- };
140833
- }
140834
- function describeFailure(error63) {
140835
- return error63 instanceof Error ? error63.message : String(error63);
140836
- }
140837
- function readFileOrReport(fs22, configDir, relative, report) {
140838
- try {
140839
- return fs22.readFileUtf8(import_node_path52.default.join(configDir, relative));
140840
- } catch (error63) {
140841
- report({ path: relative, reason: `could not be read: ${describeFailure(error63)}` });
140842
- return void 0;
140843
- }
140844
- }
140845
- function listDirOrReport(fs22, configDir, relative, report) {
140846
- try {
140847
- return fs22.readdir(import_node_path52.default.join(configDir, relative));
140848
- } catch (error63) {
140849
- report({ path: relative, reason: `could not be listed: ${describeFailure(error63)}` });
140850
- return [];
140851
- }
140852
- }
140853
- function parseJson4(text2) {
140854
- try {
140855
- const value2 = JSON.parse(text2);
140856
- return value2;
140857
- } catch {
140858
- return void 0;
140859
- }
140860
- }
140861
- var TaskFileSchema = external_exports.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: external_exports.array(external_exports.string()).default([]), blockedBy: external_exports.array(external_exports.string()).default([]) });
140862
- var WorkflowRunFileSchema = external_exports.object({
140863
- runId: external_exports.string(),
140864
- workflowName: external_exports.string().optional(),
140865
- status: external_exports.string().optional(),
140866
- startTime: external_exports.number().optional(),
140867
- phases: external_exports.array(external_exports.object({ title: external_exports.string() })).default([]),
140868
- summary: external_exports.string().optional()
140869
- });
140870
- function summariseSession(fs22, configDir, ref) {
140871
- const sessionRelative = import_node_path52.default.join(PROJECTS_DIR, ref.project, ref.entry);
140872
- const subagentsRelative = import_node_path52.default.join(sessionRelative, SUBAGENTS_DIR);
140873
- const workflowsUnderSubagents = import_node_path52.default.join(subagentsRelative, WORKFLOWS_DIR);
140874
- const isMeta = (name) => name.startsWith(AGENT_FILE_PREFIX) && name.endsWith(META_SUFFIX);
140875
- let agentCount = fs22.readdir(import_node_path52.default.join(configDir, subagentsRelative)).filter(isMeta).length;
140876
- for (const runDir of fs22.readdir(import_node_path52.default.join(configDir, workflowsUnderSubagents))) {
140877
- if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
140878
- agentCount += fs22.readdir(import_node_path52.default.join(configDir, workflowsUnderSubagents, runDir)).filter(isMeta).length;
140879
- }
140880
- }
140881
- const workflowRunCount = fs22.readdir(import_node_path52.default.join(configDir, sessionRelative, WORKFLOWS_DIR)).filter((name) => name.startsWith(WORKFLOW_RUN_PREFIX) && name.endsWith(JSON_SUFFIX)).length;
140882
- const transcript = fs22.lstat(import_node_path52.default.join(configDir, PROJECTS_DIR, ref.project, `${ref.entry}${TRANSCRIPT_SUFFIX}`));
140883
- return { ...ref, agentCount, workflowRunCount, ...transcript === void 0 ? {} : { updatedAt: new Date(transcript.mtimeMs).toISOString() } };
140884
- }
140885
- function readSessionAgentTree(fs22, configDir, ref, options = {}) {
140886
- const problems = [];
140887
- const report = (problem) => {
140888
- problems.push(problem);
140889
- };
140890
- const sessionRelative = import_node_path52.default.join(PROJECTS_DIR, ref.project, ref.entry);
140891
- const subagentsRelative = import_node_path52.default.join(sessionRelative, SUBAGENTS_DIR);
140892
- const workflowsUnderSubagents = import_node_path52.default.join(subagentsRelative, WORKFLOWS_DIR);
140893
- const located = locateAgents(fs22, configDir, subagentsRelative, void 0, report);
140894
- for (const runDir of listDirOrReport(fs22, configDir, workflowsUnderSubagents, report)) {
140895
- if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
140896
- located.push(...locateAgents(fs22, configDir, import_node_path52.default.join(workflowsUnderSubagents, runDir), runDir, report));
140897
- }
140898
- }
140899
- const agents = /* @__PURE__ */ new Map();
140900
- for (const candidate of located) {
140901
- const text2 = readFileOrReport(fs22, configDir, candidate.metaPath, report);
140902
- if (text2 === void 0) {
140903
- continue;
140904
- }
140905
- const parsed = AgentMetaSchema.safeParse(parseJson4(text2));
140906
- if (!parsed.success) {
140907
- report({ path: candidate.metaPath, reason: "meta file is not a JSON object with an agentType" });
140908
- continue;
140909
- }
140910
- agents.set(candidate.id, { located: candidate, meta: parsed.data });
140911
- }
140912
- const teamNames = [...new Set([...agents.values()].flatMap((agent) => agent.meta.teamName === void 0 ? [] : [agent.meta.teamName]))].sort();
140913
- const parentOf4 = resolveParents(fs22, configDir, agents, report);
140914
- const childrenOf = /* @__PURE__ */ new Map();
140915
- const roots = [];
140916
- for (const id2 of agents.keys()) {
140917
- const parent = parentOf4.get(id2);
140918
- if (parent === void 0) {
140919
- roots.push(id2);
140920
- } else {
140921
- childrenOf.set(parent, [...childrenOf.get(parent) ?? [], id2]);
140922
- }
140923
- }
140924
- const build = (id2) => {
140925
- const read = agents.get(id2);
140926
- if (read === void 0) {
140927
- throw new Error(`agent ${id2} is in the tree but was never read`);
140928
- }
140929
- return toNode(read, (childrenOf.get(id2) ?? []).sort().map(build));
140930
- };
140931
- return {
140932
- project: ref.project,
140933
- sessionId: ref.sessionId,
140934
- superseded: ref.superseded,
140935
- agents: roots.sort().map(build),
140936
- tasks: readTasks(fs22, configDir, ownTaskLists(ref.sessionId), [.../* @__PURE__ */ new Set([...teamNames, ...options.taskListIds ?? []])].filter((id2) => !ownTaskLists(ref.sessionId).includes(id2)), report),
140937
- workflowRuns: readWorkflowRuns(fs22, configDir, import_node_path52.default.join(sessionRelative, WORKFLOWS_DIR), report),
140938
- problems
140939
- };
140940
- }
140941
- function resolveParents(fs22, configDir, agents, report) {
140942
- const parentOf4 = /* @__PURE__ */ new Map();
140943
- const transcriptCache = /* @__PURE__ */ new Map();
140944
- const transcriptOf = (agent) => {
140945
- const cached2 = transcriptCache.get(agent.located.id);
140946
- if (cached2 !== void 0) {
140947
- return cached2;
140948
- }
140949
- const text2 = readFileOrReport(fs22, configDir, agent.located.transcriptPath, report) ?? "";
140950
- transcriptCache.set(agent.located.id, text2);
140951
- return text2;
140952
- };
140953
- const wouldCycle = (child, parent) => {
140954
- for (let cursor3 = parent; cursor3 !== void 0; cursor3 = parentOf4.get(cursor3)) {
140955
- if (cursor3 === child) {
140956
- return true;
140957
- }
140958
- }
140959
- return false;
140960
- };
140961
- const attach = (child, parent) => {
140962
- if (wouldCycle(child.located.id, parent)) {
140963
- report({ path: child.located.metaPath, reason: `parent ${parent} would make a cycle` });
140964
- return;
140965
- }
140966
- parentOf4.set(child.located.id, parent);
140967
- };
140968
- for (const agent of agents.values()) {
140969
- const { meta: meta3, located } = agent;
140970
- if (meta3.parentAgentId !== void 0 && agents.has(meta3.parentAgentId)) {
140971
- attach(agent, meta3.parentAgentId);
140972
- continue;
140973
- }
140974
- const depth = meta3.spawnDepth;
140975
- if (depth !== void 0 && depth <= SESSION_SPAWN_DEPTH || meta3.toolUseId === void 0) {
140976
- if (meta3.parentAgentId !== void 0) {
140977
- report({ path: located.metaPath, reason: `parentAgentId ${meta3.parentAgentId} names no agent in this session` });
140978
- }
140979
- continue;
140980
- }
140981
- const toolUseId = meta3.toolUseId;
140982
- const owners = [...agents.values()].filter(
140983
- (candidate) => candidate.located.id !== located.id && (depth === void 0 || candidate.meta.spawnDepth === void 0 || candidate.meta.spawnDepth === depth - 1) && candidate.located.workflowRunId === located.workflowRunId && transcriptOf(candidate).includes(toolUseId)
140984
- );
140985
- const owner = owners[0];
140986
- if (owners.length === 1 && owner !== void 0) {
140987
- attach(agent, owner.located.id);
140988
- } else if (owners.length > 1) {
140989
- report({ path: located.metaPath, reason: "more than one agent transcript records the call that spawned it" });
140990
- } else if (depth !== void 0) {
140991
- report({ path: located.metaPath, reason: "no agent transcript records the call that spawned it" });
140992
- }
140993
- }
140994
- return parentOf4;
140995
- }
140996
- function ownTaskLists(sessionId) {
140997
- return [sessionId, `${SHORT_SESSION_LIST_PREFIX}${sessionId.slice(0, SHORT_SESSION_ID_LENGTH)}`];
140998
- }
140999
- function readTasks(fs22, configDir, ownLists, sharedLists, report) {
141000
- const tasks = [];
141001
- [...ownLists, ...sharedLists].forEach((scope, index) => {
141002
- const relativeDir = import_node_path52.default.join(TASKS_DIR, scope);
141003
- for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
141004
- if (name.startsWith(".") || !name.endsWith(JSON_SUFFIX)) {
141005
- continue;
141006
- }
141007
- const relative = import_node_path52.default.join(relativeDir, name);
141008
- const text2 = readFileOrReport(fs22, configDir, relative, report);
141009
- const parsed = TaskFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson4(text2));
141010
- if (parsed.success) {
141011
- tasks.push(index < ownLists.length ? parsed.data : { ...parsed.data, taskList: scope });
141012
- } else if (text2 !== void 0) {
141013
- report({ path: relative, reason: "task file is not a task" });
141014
- }
141015
- }
141016
- });
141017
- return tasks;
141018
- }
141019
- function readWorkflowRuns(fs22, configDir, relativeDir, report) {
141020
- const runs = [];
141021
- for (const name of [...listDirOrReport(fs22, configDir, relativeDir, report)].sort()) {
141022
- if (!name.startsWith(WORKFLOW_RUN_PREFIX) || !name.endsWith(JSON_SUFFIX)) {
141023
- continue;
141024
- }
141025
- const relative = import_node_path52.default.join(relativeDir, name);
141026
- const text2 = readFileOrReport(fs22, configDir, relative, report);
141027
- const parsed = WorkflowRunFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson4(text2));
141028
- if (!parsed.success) {
141029
- if (text2 !== void 0) {
141030
- report({ path: relative, reason: "workflow run file is not a run record" });
141031
- }
141032
- continue;
141033
- }
141034
- const { phases, ...rest } = parsed.data;
141035
- runs.push({ ...rest, phases: phases.map((phase) => phase.title) });
141036
- }
141037
- return runs;
141038
- }
141039
-
141040
- // src/agents/commands.ts
141041
- var realSessionFs = {
141042
- ...realFarmFs,
141043
- realpath: (candidate) => {
141044
- try {
141045
- return import_node_fs20.default.realpathSync(candidate);
141046
- } catch {
141047
- return void 0;
141048
- }
141049
- }
141050
- };
141051
- var SessionLookupError = class extends CliError {
141052
- constructor(message) {
141053
- super(message);
141054
- this.name = "SessionLookupError";
141055
- }
141056
- };
141057
- function identityConfigDir(identitiesDir, identity) {
141058
- return import_node_path53.default.join(identitiesDir, identity);
141059
- }
141060
- function historyStores(fs22, identitiesDir, identities) {
141061
- const byRealPath = /* @__PURE__ */ new Map();
141062
- for (const identity of identities) {
141063
- const configDir = identityConfigDir(identitiesDir, identity);
141064
- const real = fs22.realpath(import_node_path53.default.join(configDir, "projects"));
141065
- if (real === void 0) {
141066
- continue;
141067
- }
141068
- const store = byRealPath.get(real);
141069
- if (store === void 0) {
141070
- byRealPath.set(real, { configDir, identities: [identity] });
141071
- } else {
141072
- store.identities.push(identity);
141073
- }
141074
- }
141075
- return [...byRealPath.values()];
141076
- }
141077
- function collectSessionList(fs22, identitiesDir, identities, filters) {
141078
- const names = filters.identity === void 0 ? identities : identities.filter((name) => name === filters.identity);
141079
- if (filters.identity !== void 0 && names.length === 0) {
141080
- throw new SessionLookupError(`no identity named "${filters.identity}"`);
141081
- }
141082
- const sessions = [];
141083
- for (const store of historyStores(fs22, identitiesDir, names)) {
141084
- for (const ref of listSessions2(fs22, store.configDir)) {
141085
- const summary = summariseSession(fs22, store.configDir, ref);
141086
- if (filters.all === true || summary.agentCount > 0 || summary.workflowRunCount > 0) {
141087
- sessions.push({ ...summary, identities: store.identities });
141088
- }
141089
- }
141090
- }
141091
- return sessions.sort((left, right) => (right.updatedAt ?? "").localeCompare(left.updatedAt ?? "") || left.sessionId.localeCompare(right.sessionId));
141092
- }
141093
- function locateSession(fs22, identitiesDir, identities, query, onlyIdentity) {
141094
- const names = onlyIdentity === void 0 ? identities : identities.filter((name) => name === onlyIdentity);
141095
- if (onlyIdentity !== void 0 && names.length === 0) {
141096
- throw new SessionLookupError(`no identity named "${onlyIdentity}"`);
141097
- }
141098
- const matches = [];
141099
- for (const store of historyStores(fs22, identitiesDir, names)) {
141100
- for (const ref of listSessions2(fs22, store.configDir)) {
141101
- if (ref.sessionId.startsWith(query)) {
141102
- matches.push({ identities: store.identities, configDir: store.configDir, ref });
141103
- }
141104
- }
141105
- }
141106
- const exact = matches.filter((match) => match.ref.sessionId === query);
141107
- const candidates = exact.length > 0 ? exact : matches;
141108
- const only = candidates[0];
141109
- if (candidates.length === 1 && only !== void 0) {
141110
- return only;
141111
- }
141112
- if (candidates.length === 0) {
141113
- throw new SessionLookupError(`no session matches "${query}"`);
141114
- }
141115
- throw new SessionLookupError(`"${query}" matches ${String(candidates.length)} sessions: ${candidates.map((match) => `${match.ref.sessionId} (${match.identities.join(", ")})`).join("; ")}; give more of the id or pass --identity`);
141116
- }
141117
141445
  function identityColumn(identities) {
141118
141446
  const [first, ...rest] = identities;
141119
141447
  return rest.length === 0 ? first ?? "-" : `${first ?? "-"} +${String(rest.length)}`;
@@ -141174,13 +141502,12 @@ function registerSessionCommands(program2, deps) {
141174
141502
  );
141175
141503
  withExamples(
141176
141504
  session.command("show <session>").description("Show one session's agent tree, task list and workflow runs. Takes the session id or an unambiguous prefix of it. Read-only.").option("--identity <name>", "Look only in this identity.").option("--json", "Print the tree as JSON.").action((query, options) => {
141177
- const located = locateSession(realSessionFs, paths.identitiesDir, identityNames(), query, options.identity);
141178
- const tree = readSessionAgentTree(realSessionFs, located.configDir, located.ref);
141505
+ const view = showSession(realSessionFs, paths.identitiesDir, identityNames(), query, options.identity);
141179
141506
  if (options.json === true) {
141180
- printJson({ identities: located.identities, ...tree });
141507
+ printJson({ identities: view.identities, ...view.tree });
141181
141508
  return;
141182
141509
  }
141183
- for (const line of formatSessionTree(located.identities, tree)) {
141510
+ for (const line of formatSessionTree(view.identities, view.tree)) {
141184
141511
  console.log(line);
141185
141512
  }
141186
141513
  }),
@@ -141499,6 +141826,7 @@ function buildProgram(deps) {
141499
141826
  registerProfileCommand(program2, deps);
141500
141827
  registerPoolCommand(program2, deps);
141501
141828
  registerJobCommand(program2, deps);
141829
+ registerHeadlessCommands(program2, deps);
141502
141830
  registerProviderCommand(program2, deps);
141503
141831
  registerRuleCommand(program2, deps);
141504
141832
  registerCredentialCommand(program2, deps, deps.credentialPorts);