fleetlens 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/app/apps/web/.next/BUILD_ID +1 -1
  2. package/app/apps/web/.next/build-manifest.json +3 -3
  3. package/app/apps/web/.next/prerender-manifest.json +3 -3
  4. package/app/apps/web/.next/server/app/_global-error.html +1 -1
  5. package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
  6. package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/app/apps/web/.next/server/app/agent/page_client-reference-manifest.js +1 -1
  13. package/app/apps/web/.next/server/app/api/agent/chats/[id]/events/route.js +3 -1
  14. package/app/apps/web/.next/server/app/api/agent/chats/[id]/events/route.js.nft.json +1 -1
  15. package/app/apps/web/.next/server/app/api/agent/chats/[id]/messages/route.js +1 -1
  16. package/app/apps/web/.next/server/app/api/agent/chats/[id]/messages/route.js.nft.json +1 -1
  17. package/app/apps/web/.next/server/app/api/agent/chats/[id]/route.js +3 -1
  18. package/app/apps/web/.next/server/app/api/agent/chats/[id]/route.js.nft.json +1 -1
  19. package/app/apps/web/.next/server/app/api/agent/chats/[id]/stop/route.js +3 -1
  20. package/app/apps/web/.next/server/app/api/agent/chats/[id]/stop/route.js.nft.json +1 -1
  21. package/app/apps/web/.next/server/app/api/agent/chats/route.js +3 -1
  22. package/app/apps/web/.next/server/app/api/agent/chats/route.js.nft.json +1 -1
  23. package/app/apps/web/.next/server/app/api/agent/index/route.js +1 -1
  24. package/app/apps/web/.next/server/app/api/agent/index/route.js.nft.json +1 -1
  25. package/app/apps/web/.next/server/app/api/agent/mcp/route.js +1 -1
  26. package/app/apps/web/.next/server/app/api/agent/mcp/route.js.nft.json +1 -1
  27. package/app/apps/web/.next/server/app/api/agent/suggestions/route.js +1 -1
  28. package/app/apps/web/.next/server/app/api/agent/suggestions/route.js.nft.json +1 -1
  29. package/app/apps/web/.next/server/app/api/ask/route.js +1 -1
  30. package/app/apps/web/.next/server/app/api/ask/route.js.nft.json +1 -1
  31. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js +1 -1
  32. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js.nft.json +1 -1
  33. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js +1 -1
  34. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js.nft.json +1 -1
  35. package/app/apps/web/.next/server/app/api/digest/month-index/route.js +1 -1
  36. package/app/apps/web/.next/server/app/api/digest/month-index/route.js.nft.json +1 -1
  37. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js +1 -1
  38. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js.nft.json +1 -1
  39. package/app/apps/web/.next/server/app/api/digest/week-index/route.js +1 -1
  40. package/app/apps/web/.next/server/app/api/digest/week-index/route.js.nft.json +1 -1
  41. package/app/apps/web/.next/server/app/api/pdf/[key]/route.js +1 -1
  42. package/app/apps/web/.next/server/app/api/pdf/[key]/route.js.nft.json +1 -1
  43. package/app/apps/web/.next/server/app/api/projects/open-folder/route.js +1 -1
  44. package/app/apps/web/.next/server/app/api/projects/open-folder/route.js.nft.json +1 -1
  45. package/app/apps/web/.next/server/app/api/settings/credentials/route.js +1 -1
  46. package/app/apps/web/.next/server/app/api/settings/credentials/route.js.nft.json +1 -1
  47. package/app/apps/web/.next/server/app/api/settings/route.js +1 -1
  48. package/app/apps/web/.next/server/app/api/settings/route.js.nft.json +1 -1
  49. package/app/apps/web/.next/server/app/api/team/onboarding/start/route.js +1 -1
  50. package/app/apps/web/.next/server/app/api/team/onboarding/start/route.js.nft.json +1 -1
  51. package/app/apps/web/.next/server/app/api/team/sync-projects/route.js +1 -1
  52. package/app/apps/web/.next/server/app/api/team/sync-projects/route.js.nft.json +1 -1
  53. package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  54. package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
  55. package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
  56. package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
  57. package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
  58. package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
  59. package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
  60. package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  61. package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
  62. package/app/apps/web/.next/server/app/print/[key]/page_client-reference-manifest.js +1 -1
  63. package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  64. package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  65. package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  66. package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  67. package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  68. package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  69. package/app/apps/web/.next/server/app/team/onboarding/page_client-reference-manifest.js +1 -1
  70. package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +1 -1
  71. package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  72. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__038-.1r._.js → [root-of-the-server]__0-09rjv._.js} +2 -2
  73. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0_5tf-2._.js → [root-of-the-server]__01oercw._.js} +5 -5
  74. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02.51sr._.js +1 -1
  75. package/app/apps/web/.next/server/chunks/[root-of-the-server]__057w7kr._.js +28 -0
  76. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0pirsh0._.js → [root-of-the-server]__07b5796._.js} +2 -2
  77. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__02puo0u._.js → [root-of-the-server]__07xaqv3._.js} +2 -2
  78. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__06xto5z._.js → [root-of-the-server]__08c24et._.js} +2 -2
  79. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0mvl0qn._.js → [root-of-the-server]__08m2h38._.js} +2 -2
  80. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0mx_9mb._.js → [root-of-the-server]__0c7ght_._.js} +2 -2
  81. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__12iid50._.js → [root-of-the-server]__0l5i8nk._.js} +2 -2
  82. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__04g-b-m._.js → [root-of-the-server]__0mcer3z._.js} +2 -2
  83. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0o9lsie._.js +30 -0
  84. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0367vbv._.js → [root-of-the-server]__0ozooam._.js} +2 -2
  85. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0uf_ch4._.js +28 -0
  86. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0uiom2m._.js +28 -0
  87. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__096_llw._.js → [root-of-the-server]__0usaajs._.js} +2 -2
  88. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__06irs4z._.js → [root-of-the-server]__0zyh554._.js} +2 -2
  89. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0gvw6dk._.js → [root-of-the-server]__0~4wgaf._.js} +2 -2
  90. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0~~bpcw._.js +3 -0
  91. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__01~cgp8._.js → [root-of-the-server]__10.g-w1._.js} +2 -2
  92. package/app/apps/web/.next/server/chunks/[root-of-the-server]__12vjv4c._.js +28 -0
  93. package/app/apps/web/.next/server/chunks/packages_entries_dist_node_0bckr7-.js +19 -19
  94. package/app/apps/web/.next/server/chunks/ssr/_0k8yioi._.js +1 -1
  95. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0n7_p1d._.js +1 -1
  96. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0nb5_-s._.js +1 -1
  97. package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
  98. package/app/apps/web/.next/server/middleware-manifest.json +5 -5
  99. package/app/apps/web/.next/server/pages/500.html +1 -1
  100. package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
  101. package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
  102. package/app/apps/web/.next/static/chunks/0ntt~a0712~pv.js +14 -0
  103. package/app/apps/web/app/api/ask/route.ts +8 -2
  104. package/app/apps/web/lib/agent/run.ts +11 -2
  105. package/app/apps/web/lib/changelog-data.generated.ts +1 -1
  106. package/app/apps/web/package.json +1 -1
  107. package/app/apps/web/tsconfig.tsbuildinfo +1 -1
  108. package/dist/daemon-worker.js +104 -55
  109. package/dist/index.js +174 -113
  110. package/menubar/Fleetlens.app/Contents/Info.plist +2 -2
  111. package/menubar/Fleetlens.app/Contents/MacOS/FleetlensMenubar +0 -0
  112. package/package.json +1 -1
  113. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02faosk._.js +0 -30
  114. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02petpy._.js +0 -3
  115. package/app/apps/web/.next/server/chunks/[root-of-the-server]__09cgmam._.js +0 -28
  116. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0tk8p3d._.js +0 -28
  117. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0u6pamj._.js +0 -28
  118. package/app/apps/web/.next/server/chunks/[root-of-the-server]__12jomao._.js +0 -28
  119. package/app/apps/web/.next/static/chunks/0dqhn7-3.038l.js +0 -14
  120. /package/app/apps/web/.next/static/{zyhoVMC9iNC5vofPFRY6z → Shk_TH0B6lHs9cBZekkf5}/_buildManifest.js +0 -0
  121. /package/app/apps/web/.next/static/{zyhoVMC9iNC5vofPFRY6z → Shk_TH0B6lHs9cBZekkf5}/_clientMiddlewareManifest.js +0 -0
  122. /package/app/apps/web/.next/static/{zyhoVMC9iNC5vofPFRY6z → Shk_TH0B6lHs9cBZekkf5}/_ssgManifest.js +0 -0
package/dist/index.js CHANGED
@@ -6243,9 +6243,9 @@ function onDiskVersion() {
6243
6243
  try {
6244
6244
  const here = dirname3(fileURLToPath(import.meta.url));
6245
6245
  const pkg = JSON.parse(readFileSync5(join3(here, "..", "package.json"), "utf8"));
6246
- return pkg.version ?? "1.0.2";
6246
+ return pkg.version ?? "1.0.3";
6247
6247
  } catch {
6248
- return "1.0.2";
6248
+ return "1.0.3";
6249
6249
  }
6250
6250
  }
6251
6251
  function getServerStatus() {
@@ -6257,7 +6257,7 @@ function getServerStatus() {
6257
6257
  return { running: false };
6258
6258
  }
6259
6259
  function isServerStale(status2) {
6260
- return status2.running === true && status2.version !== "1.0.2";
6260
+ return status2.running === true && status2.version !== "1.0.3";
6261
6261
  }
6262
6262
  async function ensureCurrentServer(opts = {}) {
6263
6263
  const status2 = getServerStatus();
@@ -6718,9 +6718,9 @@ Installed: ${PACKAGE_NAME}@${verify.installedVersion} at ${verify.installedPath
6718
6718
  console.warn(
6719
6719
  ` \u2022 reinstall in the correct Node env: 'npm install -g ${PACKAGE_NAME}@latest'`
6720
6720
  );
6721
- } else if (verify.installedVersion !== "1.0.2") {
6721
+ } else if (verify.installedVersion !== "1.0.3") {
6722
6722
  console.log(
6723
- ` \u2192 This process is still running ${"1.0.2"}. Next invocation will use ${verify.installedVersion}.`
6723
+ ` \u2192 This process is still running ${"1.0.3"}. Next invocation will use ${verify.installedVersion}.`
6724
6724
  );
6725
6725
  }
6726
6726
  }
@@ -6755,14 +6755,14 @@ async function getUpdateAvailability() {
6755
6755
  if (isDevMode()) return null;
6756
6756
  const latest = await fetchLatestVersion();
6757
6757
  if (latest === null) return {
6758
- current: "1.0.2",
6758
+ current: "1.0.3",
6759
6759
  latest: null,
6760
6760
  updateAvailable: false
6761
6761
  };
6762
6762
  return {
6763
- current: "1.0.2",
6763
+ current: "1.0.3",
6764
6764
  latest,
6765
- updateAvailable: shouldUpdate("1.0.2", latest)
6765
+ updateAvailable: shouldUpdate("1.0.3", latest)
6766
6766
  };
6767
6767
  }
6768
6768
  async function checkForUpdate() {
@@ -6852,7 +6852,7 @@ async function restartServices(state) {
6852
6852
  }
6853
6853
  async function forceUpdate() {
6854
6854
  const latest = await fetchLatestVersion();
6855
- const current = "1.0.2";
6855
+ const current = "1.0.3";
6856
6856
  if (latest === null) {
6857
6857
  console.error("Could not reach npm registry. Check your network.");
6858
6858
  process.exit(1);
@@ -7273,7 +7273,7 @@ async function status() {
7273
7273
  }
7274
7274
  if (isServerStale(server)) {
7275
7275
  console.log(
7276
- ` \u26A0 serving stale ${ver} (CLI is ${"1.0.2"}) \u2014 run 'fleetlens start' to restart on the current version`
7276
+ ` \u26A0 serving stale ${ver} (CLI is ${"1.0.3"}) \u2014 run 'fleetlens start' to restart on the current version`
7277
7277
  );
7278
7278
  }
7279
7279
  } else {
@@ -14522,10 +14522,58 @@ RESPOND WITH ONLY VALID JSON (no prose, no code fence):
14522
14522
  }
14523
14523
  });
14524
14524
 
14525
- // ../entries/dist/tmux-runner.js
14526
- import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, existsSync as existsSync13, readdirSync as readdirSync3, realpathSync as realpathSync5, readFileSync as readFileSync15, unlinkSync as unlinkSync3, renameSync as renameSync4 } from "node:fs";
14527
- import { join as join11 } from "node:path";
14525
+ // ../entries/dist/claude-bin.js
14526
+ import { existsSync as existsSync13 } from "node:fs";
14527
+ import { join as join11, dirname as dirname10, delimiter } from "node:path";
14528
14528
  import { homedir as homedir5 } from "node:os";
14529
+ function resolveClaudeBin(opts = {}) {
14530
+ const env = opts.env ?? process.env;
14531
+ const home = opts.home ?? homedir5();
14532
+ const execPath = opts.execPath ?? process.execPath;
14533
+ const exists = opts.exists ?? existsSync13;
14534
+ for (const dir of (env.PATH ?? "").split(delimiter)) {
14535
+ if (!dir)
14536
+ continue;
14537
+ const onPath = join11(dir, "claude");
14538
+ if (exists(onPath))
14539
+ return onPath;
14540
+ }
14541
+ return [
14542
+ join11(home, ".local", "bin", "claude"),
14543
+ // native installer
14544
+ join11(home, ".claude", "local", "claude"),
14545
+ // legacy local install
14546
+ join11(dirname10(execPath), "claude"),
14547
+ // npm -g, beside the node running us
14548
+ "/opt/homebrew/bin/claude",
14549
+ "/usr/local/bin/claude"
14550
+ ].find(exists);
14551
+ }
14552
+ function claudeSpawnEnv(bin, env = process.env, execPath = process.execPath) {
14553
+ const parts = (env.PATH ?? "").split(delimiter).filter(Boolean);
14554
+ for (const dir of [dirname10(execPath), dirname10(bin)]) {
14555
+ if (!parts.includes(dir))
14556
+ parts.unshift(dir);
14557
+ }
14558
+ return { ...env, PATH: parts.join(delimiter) };
14559
+ }
14560
+ var ClaudeBinNotFoundError;
14561
+ var init_claude_bin = __esm({
14562
+ "../entries/dist/claude-bin.js"() {
14563
+ "use strict";
14564
+ ClaudeBinNotFoundError = class extends Error {
14565
+ constructor() {
14566
+ super("claude CLI not found. Looked on PATH and in ~/.local/bin, ~/.claude/local, the npm global bin, homebrew, and /usr/local/bin. Install it, or if Fleetlens was started at login, restart it from a terminal: fleetlens stop && fleetlens start");
14567
+ this.name = "ClaudeBinNotFoundError";
14568
+ }
14569
+ };
14570
+ }
14571
+ });
14572
+
14573
+ // ../entries/dist/tmux-runner.js
14574
+ import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, existsSync as existsSync14, readdirSync as readdirSync3, realpathSync as realpathSync5, readFileSync as readFileSync15, unlinkSync as unlinkSync3, renameSync as renameSync4 } from "node:fs";
14575
+ import { join as join12 } from "node:path";
14576
+ import { homedir as homedir6 } from "node:os";
14529
14577
  import { spawnSync as spawnSync2 } from "node:child_process";
14530
14578
  function which(bin) {
14531
14579
  const r = spawnSync2("/usr/bin/env", ["which", bin], { encoding: "utf8" });
@@ -14536,18 +14584,18 @@ function which(bin) {
14536
14584
  function tmuxRunnerAvailable() {
14537
14585
  if (!which("tmux"))
14538
14586
  return { ok: false, reason: "tmux not on PATH" };
14539
- if (!which("claude"))
14540
- return { ok: false, reason: "claude not on PATH" };
14587
+ if (!resolveClaudeBin())
14588
+ return { ok: false, reason: "claude CLI not found" };
14541
14589
  return { ok: true };
14542
14590
  }
14543
14591
  function runtimeCwd() {
14544
- const dir = join11(homedir5(), ".cclens", "runtime");
14545
- if (!existsSync13(dir))
14592
+ const dir = join12(homedir6(), ".cclens", "runtime");
14593
+ if (!existsSync14(dir))
14546
14594
  mkdirSync8(dir, { recursive: true });
14547
14595
  return realpathSync5(dir);
14548
14596
  }
14549
14597
  function ensureRuntimeCwdTrusted(cwd) {
14550
- const cfgPath = join11(homedir5(), ".claude.json");
14598
+ const cfgPath = join12(homedir6(), ".claude.json");
14551
14599
  let cfg;
14552
14600
  try {
14553
14601
  cfg = JSON.parse(readFileSync15(cfgPath, "utf8"));
@@ -14583,18 +14631,18 @@ async function runClaudeUnderTmuxImpl(args2) {
14583
14631
  const tmuxBin = args2.tmuxBin ?? which("tmux");
14584
14632
  if (!tmuxBin)
14585
14633
  throw new TmuxUnavailableError("tmux not on PATH");
14586
- const claudeBin = args2.claudeBin ?? which("claude");
14634
+ const claudeBin = args2.claudeBin ?? resolveClaudeBin();
14587
14635
  if (!claudeBin)
14588
- throw new TmuxUnavailableError("claude not on PATH");
14636
+ throw new TmuxUnavailableError("claude CLI not found");
14589
14637
  if (args2.signal?.aborted)
14590
14638
  throw new TmuxRunError("aborted before spawn");
14591
14639
  const cwd = runtimeCwd();
14592
14640
  ensureRuntimeCwdTrusted(cwd);
14593
14641
  const runId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
14594
14642
  const sessionName = `cclens-${runId}`;
14595
- const systemFile = join11(cwd, `system-${runId}.txt`);
14596
- const userFile = join11(cwd, `user-${runId}.txt`);
14597
- const wrapper = join11(cwd, `run-${runId}.sh`);
14643
+ const systemFile = join12(cwd, `system-${runId}.txt`);
14644
+ const userFile = join12(cwd, `user-${runId}.txt`);
14645
+ const wrapper = join12(cwd, `run-${runId}.sh`);
14598
14646
  writeFileSync9(systemFile, args2.systemPrompt);
14599
14647
  writeFileSync9(userFile, args2.reminder ? `${args2.userPrompt}
14600
14648
 
@@ -14683,7 +14731,7 @@ function snapshotAllTranscripts() {
14683
14731
  return out;
14684
14732
  }
14685
14733
  for (const sub of subs) {
14686
- const dir = join11(root, sub);
14734
+ const dir = join12(root, sub);
14687
14735
  let files;
14688
14736
  try {
14689
14737
  files = readdirSync3(dir);
@@ -14692,7 +14740,7 @@ function snapshotAllTranscripts() {
14692
14740
  }
14693
14741
  for (const f of files) {
14694
14742
  if (f.endsWith(".jsonl"))
14695
- out.add(join11(dir, f));
14743
+ out.add(join12(dir, f));
14696
14744
  }
14697
14745
  }
14698
14746
  return out;
@@ -14733,7 +14781,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
14733
14781
  subs = [];
14734
14782
  }
14735
14783
  for (const sub of subs) {
14736
- const dir = join11(root, sub);
14784
+ const dir = join12(root, sub);
14737
14785
  let files;
14738
14786
  try {
14739
14787
  files = readdirSync3(dir);
@@ -14743,7 +14791,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
14743
14791
  for (const f of files) {
14744
14792
  if (!f.endsWith(".jsonl"))
14745
14793
  continue;
14746
- const full = join11(dir, f);
14794
+ const full = join12(dir, f);
14747
14795
  if (existingBefore.has(full))
14748
14796
  continue;
14749
14797
  if (readJsonlCwd(full) === targetCwd)
@@ -14817,7 +14865,7 @@ function cleanup(cwd, runId, tmuxBin, sessionName, transcriptPath) {
14817
14865
  }
14818
14866
  for (const f of [`system-${runId}.txt`, `user-${runId}.txt`, `run-${runId}.sh`]) {
14819
14867
  try {
14820
- unlinkSync3(join11(cwd, f));
14868
+ unlinkSync3(join12(cwd, f));
14821
14869
  } catch {
14822
14870
  }
14823
14871
  }
@@ -14832,6 +14880,7 @@ var TmuxUnavailableError, TmuxRunError, mutex, PROJECTS_ROOT;
14832
14880
  var init_tmux_runner = __esm({
14833
14881
  "../entries/dist/tmux-runner.js"() {
14834
14882
  "use strict";
14883
+ init_claude_bin();
14835
14884
  TmuxUnavailableError = class extends Error {
14836
14885
  constructor(message) {
14837
14886
  super(message);
@@ -14845,17 +14894,17 @@ var init_tmux_runner = __esm({
14845
14894
  }
14846
14895
  };
14847
14896
  mutex = Promise.resolve();
14848
- PROJECTS_ROOT = () => join11(homedir5(), ".claude", "projects");
14897
+ PROJECTS_ROOT = () => join12(homedir6(), ".claude", "projects");
14849
14898
  }
14850
14899
  });
14851
14900
 
14852
14901
  // ../entries/dist/llm-runner.js
14853
14902
  import { spawn as spawn4 } from "node:child_process";
14854
- import { mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, writeFileSync as writeFileSync10, existsSync as existsSync14 } from "node:fs";
14855
- import { join as join12 } from "node:path";
14903
+ import { mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, writeFileSync as writeFileSync10, existsSync as existsSync15 } from "node:fs";
14904
+ import { join as join13 } from "node:path";
14856
14905
  import { randomUUID } from "node:crypto";
14857
14906
  function ensureRunsDir() {
14858
- if (!existsSync14(RUNS_DIR)) {
14907
+ if (!existsSync15(RUNS_DIR)) {
14859
14908
  try {
14860
14909
  mkdirSync9(RUNS_DIR, { recursive: true });
14861
14910
  } catch {
@@ -14884,7 +14933,7 @@ function newRunId(kind) {
14884
14933
  return `${ts}_${kind}_${short}`;
14885
14934
  }
14886
14935
  function tracePath(runId) {
14887
- return join12(RUNS_DIR, `${runId}.jsonl`);
14936
+ return join13(RUNS_DIR, `${runId}.jsonl`);
14888
14937
  }
14889
14938
  function safeAppend(path11, line) {
14890
14939
  try {
@@ -15027,7 +15076,14 @@ function runClaudePrintMode(args2) {
15027
15076
  "--append-system-prompt",
15028
15077
  args2.systemPrompt
15029
15078
  ];
15030
- const proc = spawn4("claude", claudeArgs, { stdio: ["pipe", "pipe", "pipe"], env: { ...process.env } });
15079
+ const claudeBin = resolveClaudeBin();
15080
+ if (!claudeBin) {
15081
+ const err = new ClaudeBinNotFoundError();
15082
+ safeAppend(trace, JSON.stringify({ _meta: { type: "spawn_error", run_id: runId, ts: (/* @__PURE__ */ new Date()).toISOString(), error: err.message } }) + "\n");
15083
+ reject(err);
15084
+ return;
15085
+ }
15086
+ const proc = spawn4(claudeBin, claudeArgs, { stdio: ["pipe", "pipe", "pipe"], env: claudeSpawnEnv(claudeBin) });
15031
15087
  safeAppend(trace, JSON.stringify({ _meta: { type: "spawned", run_id: runId, pid: proc.pid } }) + "\n");
15032
15088
  const stdinPayload = args2.reminder ? `${args2.userPrompt}
15033
15089
 
@@ -15128,6 +15184,7 @@ var init_llm_runner = __esm({
15128
15184
  "../entries/dist/llm-runner.js"() {
15129
15185
  "use strict";
15130
15186
  init_fs();
15187
+ init_claude_bin();
15131
15188
  init_tmux_runner();
15132
15189
  RUNS_DIR = cclensPath("llm-runs");
15133
15190
  }
@@ -15300,8 +15357,8 @@ var init_enrich2 = __esm({
15300
15357
  });
15301
15358
 
15302
15359
  // ../entries/dist/budget.js
15303
- import { appendFileSync as appendFileSync4, readFileSync as readFileSync16, existsSync as existsSync15, mkdirSync as mkdirSync10 } from "node:fs";
15304
- import { dirname as dirname10 } from "node:path";
15360
+ import { appendFileSync as appendFileSync4, readFileSync as readFileSync16, existsSync as existsSync16, mkdirSync as mkdirSync10 } from "node:fs";
15361
+ import { dirname as dirname11 } from "node:path";
15305
15362
  function spendPath() {
15306
15363
  if (spendPathCached)
15307
15364
  return spendPathCached;
@@ -15313,12 +15370,12 @@ function __setSpendPathForTest(path11) {
15313
15370
  }
15314
15371
  function appendSpend(record) {
15315
15372
  const p = spendPath();
15316
- mkdirSync10(dirname10(p), { recursive: true });
15373
+ mkdirSync10(dirname11(p), { recursive: true });
15317
15374
  appendFileSync4(p, JSON.stringify(record) + "\n", { encoding: "utf8" });
15318
15375
  }
15319
15376
  function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
15320
15377
  const p = spendPath();
15321
- if (!existsSync15(p))
15378
+ if (!existsSync16(p))
15322
15379
  return 0;
15323
15380
  const year = now.getUTCFullYear();
15324
15381
  const month2 = now.getUTCMonth();
@@ -15352,7 +15409,7 @@ var init_budget = __esm({
15352
15409
  });
15353
15410
 
15354
15411
  // ../entries/dist/pipeline-lock.js
15355
- import { writeFileSync as writeFileSync11, unlinkSync as unlinkSync4, existsSync as existsSync16, readFileSync as readFileSync17, statSync as statSync3 } from "node:fs";
15412
+ import { writeFileSync as writeFileSync11, unlinkSync as unlinkSync4, existsSync as existsSync17, readFileSync as readFileSync17, statSync as statSync3 } from "node:fs";
15356
15413
  function lockPath() {
15357
15414
  if (lockPathCached)
15358
15415
  return lockPathCached;
@@ -15397,7 +15454,7 @@ function pidAlive(pid) {
15397
15454
  }
15398
15455
  function interactiveLockFresh(nowMs) {
15399
15456
  const p = lockPath();
15400
- if (!existsSync16(p))
15457
+ if (!existsSync17(p))
15401
15458
  return false;
15402
15459
  try {
15403
15460
  const mtime = statSync3(p).mtimeMs;
@@ -15509,8 +15566,8 @@ var init_queue = __esm({
15509
15566
  });
15510
15567
 
15511
15568
  // ../entries/dist/settings.js
15512
- import { readFileSync as readFileSync18, writeFileSync as writeFileSync12, renameSync as renameSync5, chmodSync as chmodSync2, mkdirSync as mkdirSync11, existsSync as existsSync17 } from "node:fs";
15513
- import { dirname as dirname11 } from "node:path";
15569
+ import { readFileSync as readFileSync18, writeFileSync as writeFileSync12, renameSync as renameSync5, chmodSync as chmodSync2, mkdirSync as mkdirSync11, existsSync as existsSync18 } from "node:fs";
15570
+ import { dirname as dirname12 } from "node:path";
15514
15571
  function settingsPath() {
15515
15572
  if (settingsPathCached)
15516
15573
  return settingsPathCached;
@@ -15545,7 +15602,7 @@ function fromDisk(d) {
15545
15602
  }
15546
15603
  function readSettings() {
15547
15604
  const p = settingsPath();
15548
- if (!existsSync17(p))
15605
+ if (!existsSync18(p))
15549
15606
  return DEFAULT_SETTINGS;
15550
15607
  try {
15551
15608
  const raw = readFileSync18(p, "utf8");
@@ -15556,7 +15613,7 @@ function readSettings() {
15556
15613
  }
15557
15614
  function writeSettings(s) {
15558
15615
  const p = settingsPath();
15559
- mkdirSync11(dirname11(p), { recursive: true });
15616
+ mkdirSync11(dirname12(p), { recursive: true });
15560
15617
  const tmp = `${p}.tmp`;
15561
15618
  writeFileSync12(tmp, JSON.stringify(toDisk(s), null, 2), { encoding: "utf8" });
15562
15619
  if (process.platform !== "win32") {
@@ -18738,8 +18795,8 @@ var init_digest_month_pipeline = __esm({
18738
18795
  });
18739
18796
 
18740
18797
  // ../entries/dist/credentials.js
18741
- import { writeFileSync as writeFileSync13, readFileSync as readFileSync19, renameSync as renameSync6, chmodSync as chmodSync3, mkdirSync as mkdirSync12, existsSync as existsSync18, unlinkSync as unlinkSync5 } from "node:fs";
18742
- import { dirname as dirname12 } from "node:path";
18798
+ import { writeFileSync as writeFileSync13, readFileSync as readFileSync19, renameSync as renameSync6, chmodSync as chmodSync3, mkdirSync as mkdirSync12, existsSync as existsSync19, unlinkSync as unlinkSync5 } from "node:fs";
18799
+ import { dirname as dirname13 } from "node:path";
18743
18800
  async function fetchZaiUsage(candidate) {
18744
18801
  const key = candidate.trim();
18745
18802
  if (!key)
@@ -18809,7 +18866,7 @@ function credentialsPath() {
18809
18866
  }
18810
18867
  function readCredentials() {
18811
18868
  const p = credentialsPath();
18812
- if (!existsSync18(p))
18869
+ if (!existsSync19(p))
18813
18870
  return {};
18814
18871
  try {
18815
18872
  const raw = readFileSync19(p, "utf8");
@@ -18835,7 +18892,7 @@ function writeZaiKey(apiKey) {
18835
18892
  const store = readCredentials();
18836
18893
  store.zai = { ...store.zai ?? {}, apiKey };
18837
18894
  const p = credentialsPath();
18838
- mkdirSync12(dirname12(p), { recursive: true });
18895
+ mkdirSync12(dirname13(p), { recursive: true });
18839
18896
  const tmp = `${p}.tmp`;
18840
18897
  writeFileSync13(tmp, JSON.stringify(store, null, 2), { encoding: "utf8" });
18841
18898
  if (process.platform !== "win32") {
@@ -18876,6 +18933,7 @@ var init_credentials = __esm({
18876
18933
  // ../entries/dist/node.js
18877
18934
  var node_exports = {};
18878
18935
  __export(node_exports, {
18936
+ ClaudeBinNotFoundError: () => ClaudeBinNotFoundError,
18879
18937
  DIGEST_DAY_SYSTEM_PROMPT: () => DIGEST_DAY_SYSTEM_PROMPT,
18880
18938
  DIGEST_MONTH_SYSTEM_PROMPT: () => DIGEST_MONTH_SYSTEM_PROMPT,
18881
18939
  DIGEST_WEEK_SYSTEM_PROMPT: () => DIGEST_WEEK_SYSTEM_PROMPT,
@@ -18898,6 +18956,7 @@ __export(node_exports, {
18898
18956
  buildEnrichmentUserPrompt: () => buildEnrichmentUserPrompt,
18899
18957
  buildMonthDigestUserPrompt: () => buildMonthDigestUserPrompt,
18900
18958
  buildWeekDigestUserPrompt: () => buildWeekDigestUserPrompt,
18959
+ claudeSpawnEnv: () => claudeSpawnEnv,
18901
18960
  computeCostUsd: () => computeCostUsd,
18902
18961
  computeDaySignals: () => computeDaySignals,
18903
18962
  computeInteractionGrammar: () => computeInteractionGrammar,
@@ -18927,6 +18986,7 @@ __export(node_exports, {
18927
18986
  readSettings: () => readSettings,
18928
18987
  readWeekDigest: () => readWeekDigest,
18929
18988
  removeInteractiveLock: () => removeInteractiveLock,
18989
+ resolveClaudeBin: () => resolveClaudeBin,
18930
18990
  runClaudeSubprocess: () => runClaudeSubprocess,
18931
18991
  runClaudeUnderTmux: () => runClaudeUnderTmux,
18932
18992
  runDayDigestPipeline: () => runDayDigestPipeline,
@@ -18966,6 +19026,7 @@ var init_node = __esm({
18966
19026
  init_digest_month_pipeline();
18967
19027
  init_tmux_runner();
18968
19028
  init_llm_runner();
19029
+ init_claude_bin();
18969
19030
  init_digest_fs();
18970
19031
  init_credentials();
18971
19032
  }
@@ -19442,9 +19503,9 @@ var menubar_exports = {};
19442
19503
  __export(menubar_exports, {
19443
19504
  menubar: () => menubar
19444
19505
  });
19445
- import { existsSync as existsSync19, mkdirSync as mkdirSync13, cpSync, rmSync as rmSync2, readdirSync as readdirSync4, writeFileSync as writeFileSync14, realpathSync as realpathSync6 } from "node:fs";
19446
- import { homedir as homedir6 } from "node:os";
19447
- import { join as join13, dirname as dirname13 } from "node:path";
19506
+ import { existsSync as existsSync20, mkdirSync as mkdirSync13, cpSync, rmSync as rmSync2, readdirSync as readdirSync4, writeFileSync as writeFileSync14, realpathSync as realpathSync6 } from "node:fs";
19507
+ import { homedir as homedir7 } from "node:os";
19508
+ import { join as join14, dirname as dirname14 } from "node:path";
19448
19509
  import { fileURLToPath as fileURLToPath3 } from "node:url";
19449
19510
  import { execFile as execFile2 } from "node:child_process";
19450
19511
  import { promisify as promisify2 } from "node:util";
@@ -19452,8 +19513,8 @@ function isMac2() {
19452
19513
  return process.platform === "darwin";
19453
19514
  }
19454
19515
  function bundledAppPath() {
19455
- const here = dirname13(fileURLToPath3(import.meta.url));
19456
- return join13(here, "..", "menubar", APP_BUNDLE);
19516
+ const here = dirname14(fileURLToPath3(import.meta.url));
19517
+ return join14(here, "..", "menubar", APP_BUNDLE);
19457
19518
  }
19458
19519
  function resolveScriptPath2() {
19459
19520
  const argv1 = process.argv[1] ?? "";
@@ -19474,10 +19535,10 @@ function writeCliLaunchFile() {
19474
19535
  }
19475
19536
  }
19476
19537
  function installedAppPath() {
19477
- return join13(homedir6(), "Applications", APP_BUNDLE);
19538
+ return join14(homedir7(), "Applications", APP_BUNDLE);
19478
19539
  }
19479
19540
  function legacyInstalledAppPath() {
19480
- return join13(homedir6(), "Applications", LEGACY_APP_BUNDLE);
19541
+ return join14(homedir7(), "Applications", LEGACY_APP_BUNDLE);
19481
19542
  }
19482
19543
  async function isRunning() {
19483
19544
  try {
@@ -19516,14 +19577,14 @@ async function installMenubar(opts) {
19516
19577
  return;
19517
19578
  }
19518
19579
  const src = bundledAppPath();
19519
- if (!existsSync19(src)) {
19580
+ if (!existsSync20(src)) {
19520
19581
  console.error(
19521
19582
  `Bundled widget not found at ${src}.
19522
19583
  This install was probably built without the menubar artifact. Run \`bash apps/menubar/build-app.sh && cp -R apps/menubar/dist/Fleetlens.app packages/cli/menubar/\` and rebuild.`
19523
19584
  );
19524
19585
  process.exit(1);
19525
19586
  }
19526
- const destDir = join13(homedir6(), "Applications");
19587
+ const destDir = join14(homedir7(), "Applications");
19527
19588
  mkdirSync13(destDir, { recursive: true });
19528
19589
  const dest = installedAppPath();
19529
19590
  if (await isRunning()) {
@@ -19562,7 +19623,7 @@ async function uninstallMenubar() {
19562
19623
  await new Promise((r) => setTimeout(r, 300));
19563
19624
  }
19564
19625
  const dest = installedAppPath();
19565
- if (existsSync19(dest)) {
19626
+ if (existsSync20(dest)) {
19566
19627
  rmSync2(dest, { recursive: true, force: true });
19567
19628
  console.log(`Removed ${dest}`);
19568
19629
  } else {
@@ -19577,7 +19638,7 @@ async function openMenubar() {
19577
19638
  return;
19578
19639
  }
19579
19640
  const dest = installedAppPath();
19580
- if (!existsSync19(dest)) {
19641
+ if (!existsSync20(dest)) {
19581
19642
  console.log("Widget not installed yet. Run `fleetlens menubar install` first.");
19582
19643
  return;
19583
19644
  }
@@ -19594,15 +19655,15 @@ async function statusMenubar() {
19594
19655
  return;
19595
19656
  }
19596
19657
  const dest = installedAppPath();
19597
- const installed = existsSync19(dest);
19658
+ const installed = existsSync20(dest);
19598
19659
  const running = await isRunning();
19599
- const bundled = existsSync19(bundledAppPath());
19660
+ const bundled = existsSync20(bundledAppPath());
19600
19661
  console.log(`Menu bar widget: ${installed ? "installed" : "not installed"}${installed ? ` (${dest})` : ""}`);
19601
19662
  console.log(`Running: ${running ? "yes" : "no"}`);
19602
19663
  console.log(`Bundled in CLI: ${bundled ? "yes" : "no \u2014 this build ships without the widget"}`);
19603
19664
  if (installed) {
19604
19665
  try {
19605
- const apps = readdirSync4(join13(homedir6(), "Applications"));
19666
+ const apps = readdirSync4(join14(homedir7(), "Applications"));
19606
19667
  const ours = apps.find((a) => a === APP_BUNDLE);
19607
19668
  console.log(`App bundle: ${ours ? "present in ~/Applications" : "missing"}`);
19608
19669
  } catch {
@@ -19688,7 +19749,7 @@ var init_config = __esm({
19688
19749
 
19689
19750
  // src/perception/build-entries.ts
19690
19751
  import { statSync as statSync4, readFileSync as readFileSync20 } from "node:fs";
19691
- import { basename as basename2, dirname as dirname14 } from "node:path";
19752
+ import { basename as basename2, dirname as dirname15 } from "node:path";
19692
19753
  function decodeProjectDirName(projectDir) {
19693
19754
  if (projectDir.startsWith("-")) {
19694
19755
  return "/" + projectDir.slice(1).replace(/-/g, "/");
@@ -19708,7 +19769,7 @@ function buildEntriesForFile(filePath) {
19708
19769
  if (rawLines.length === 0) return null;
19709
19770
  const { meta, events } = parseTranscript(rawLines);
19710
19771
  const fileName = basename2(filePath);
19711
- const projectDir = basename2(dirname14(filePath));
19772
+ const projectDir = basename2(dirname15(filePath));
19712
19773
  const sessionId = fileName.replace(/\.jsonl$/, "");
19713
19774
  const sd = {
19714
19775
  ...meta,
@@ -19966,7 +20027,7 @@ function buildIngestPayload(inputs) {
19966
20027
  return {
19967
20028
  ingestId: randomUUID2(),
19968
20029
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
19969
- cliVersion: "1.0.2",
20030
+ cliVersion: "1.0.3",
19970
20031
  ...richRollup || inputs.enrichedExtras || inputs.artifactSignals ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
19971
20032
  ...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
19972
20033
  ...richRollup ? { richRollup } : {},
@@ -20008,8 +20069,8 @@ var init_push = __esm({
20008
20069
  });
20009
20070
 
20010
20071
  // src/team/git-remote.ts
20011
- import { existsSync as existsSync20, readFileSync as readFileSync21, statSync as statSync5 } from "node:fs";
20012
- import { dirname as dirname15, isAbsolute as isAbsolute2, join as join14, resolve as resolve2 } from "node:path";
20072
+ import { existsSync as existsSync21, readFileSync as readFileSync21, statSync as statSync5 } from "node:fs";
20073
+ import { dirname as dirname16, isAbsolute as isAbsolute2, join as join15, resolve as resolve2 } from "node:path";
20013
20074
  function parseGithubRemote(url) {
20014
20075
  const m = url.trim().match(GITHUB_URL_RE);
20015
20076
  return m ? `${m[1]}/${m[2]}`.toLowerCase() : null;
@@ -20029,19 +20090,19 @@ function originUrl2(configText) {
20029
20090
  return null;
20030
20091
  }
20031
20092
  function gitConfigPathFor(dir) {
20032
- const dotGit = join14(dir, ".git");
20093
+ const dotGit = join15(dir, ".git");
20033
20094
  const st = statSync5(dotGit, { throwIfNoEntry: false });
20034
20095
  if (!st) return null;
20035
- if (st.isDirectory()) return join14(dotGit, "config");
20096
+ if (st.isDirectory()) return join15(dotGit, "config");
20036
20097
  const m = readFileSync21(dotGit, "utf8").match(/^gitdir:\s*(.+)\s*$/m);
20037
20098
  if (!m) return null;
20038
20099
  const gd = isAbsolute2(m[1]) ? m[1] : resolve2(dir, m[1]);
20039
- const commondirFile = join14(gd, "commondir");
20040
- if (existsSync20(commondirFile)) {
20100
+ const commondirFile = join15(gd, "commondir");
20101
+ if (existsSync21(commondirFile)) {
20041
20102
  const common = readFileSync21(commondirFile, "utf8").trim();
20042
- return join14(isAbsolute2(common) ? common : resolve2(gd, common), "config");
20103
+ return join15(isAbsolute2(common) ? common : resolve2(gd, common), "config");
20043
20104
  }
20044
- return join14(gd, "config");
20105
+ return join15(gd, "config");
20045
20106
  }
20046
20107
  function createRepoResolver() {
20047
20108
  const cache = /* @__PURE__ */ new Map();
@@ -20051,14 +20112,14 @@ function createRepoResolver() {
20051
20112
  if (hit !== void 0) return hit;
20052
20113
  let repo = null;
20053
20114
  try {
20054
- for (let d = dir; ; d = dirname15(d)) {
20115
+ for (let d = dir; ; d = dirname16(d)) {
20055
20116
  const config = gitConfigPathFor(d);
20056
- if (config && existsSync20(config)) {
20117
+ if (config && existsSync21(config)) {
20057
20118
  const url = originUrl2(readFileSync21(config, "utf8"));
20058
20119
  repo = url ? parseGithubRemote(url) : null;
20059
20120
  break;
20060
20121
  }
20061
- if (d === dirname15(d)) break;
20122
+ if (d === dirname16(d)) break;
20062
20123
  }
20063
20124
  } catch {
20064
20125
  repo = null;
@@ -20077,9 +20138,9 @@ var init_git_remote = __esm({
20077
20138
 
20078
20139
  // src/team/queue.ts
20079
20140
  import { readFileSync as readFileSync22, writeFileSync as writeFileSync15, appendFileSync as appendFileSync5, statSync as statSync6, mkdirSync as mkdirSync14 } from "node:fs";
20080
- import { dirname as dirname16 } from "node:path";
20141
+ import { dirname as dirname17 } from "node:path";
20081
20142
  function enqueuePayload(payload, queuePath = QUEUE_PATH) {
20082
- mkdirSync14(dirname16(queuePath), { recursive: true });
20143
+ mkdirSync14(dirname17(queuePath), { recursive: true });
20083
20144
  const entry = { payload, enqueuedAt: (/* @__PURE__ */ new Date()).toISOString() };
20084
20145
  appendFileSync5(queuePath, JSON.stringify(entry) + "\n", "utf8");
20085
20146
  try {
@@ -20133,8 +20194,8 @@ var init_queue2 = __esm({
20133
20194
  });
20134
20195
 
20135
20196
  // src/usage/profile.ts
20136
- import { existsSync as existsSync21, mkdirSync as mkdirSync15, readFileSync as readFileSync23, writeFileSync as writeFileSync16 } from "node:fs";
20137
- import { dirname as dirname17 } from "node:path";
20197
+ import { existsSync as existsSync22, mkdirSync as mkdirSync15, readFileSync as readFileSync23, writeFileSync as writeFileSync16 } from "node:fs";
20198
+ import { dirname as dirname18 } from "node:path";
20138
20199
  function mapRateLimitTier(rateLimitTier) {
20139
20200
  switch (rateLimitTier) {
20140
20201
  case "default_claude_pro":
@@ -20174,7 +20235,7 @@ async function fetchProfile(nowMs = Date.now()) {
20174
20235
  };
20175
20236
  }
20176
20237
  function readCachedProfile(cachePath) {
20177
- if (!existsSync21(cachePath)) return null;
20238
+ if (!existsSync22(cachePath)) return null;
20178
20239
  try {
20179
20240
  const raw = JSON.parse(readFileSync23(cachePath, "utf8"));
20180
20241
  if (typeof raw.fetchedAtMs !== "number" || !raw.profile) return null;
@@ -20184,7 +20245,7 @@ function readCachedProfile(cachePath) {
20184
20245
  }
20185
20246
  }
20186
20247
  function writeCachedProfile(cachePath, profile, nowMs = Date.now()) {
20187
- mkdirSync15(dirname17(cachePath), { recursive: true });
20248
+ mkdirSync15(dirname18(cachePath), { recursive: true });
20188
20249
  writeFileSync16(
20189
20250
  cachePath,
20190
20251
  JSON.stringify({ fetchedAtMs: nowMs, profile }, null, 2),
@@ -20398,11 +20459,11 @@ var init_sync_log = __esm({
20398
20459
 
20399
20460
  // src/team/last-push.ts
20400
20461
  import { writeFileSync as writeFileSync17, unlinkSync as unlinkSync6, mkdirSync as mkdirSync16 } from "node:fs";
20401
- import { join as join15 } from "node:path";
20462
+ import { join as join16 } from "node:path";
20402
20463
  function write(record, dir) {
20403
20464
  const d = dir ?? cclensHome();
20404
20465
  mkdirSync16(d, { recursive: true });
20405
- writeFileSync17(join15(d, LAST_PUSH_FILE), JSON.stringify(record, null, 2), { mode: 384 });
20466
+ writeFileSync17(join16(d, LAST_PUSH_FILE), JSON.stringify(record, null, 2), { mode: 384 });
20406
20467
  }
20407
20468
  function writeLastPushSuccess(payload, dir) {
20408
20469
  write({ pushedAt: (/* @__PURE__ */ new Date()).toISOString(), ok: true, payload }, dir);
@@ -20413,7 +20474,7 @@ function writeLastPushFailure(payload, error, dir) {
20413
20474
  function clearLastPush(dir) {
20414
20475
  const d = dir ?? cclensHome();
20415
20476
  try {
20416
- unlinkSync6(join15(d, LAST_PUSH_FILE));
20477
+ unlinkSync6(join16(d, LAST_PUSH_FILE));
20417
20478
  } catch {
20418
20479
  }
20419
20480
  }
@@ -20433,25 +20494,25 @@ __export(file_probe_exports, {
20433
20494
  probeArtifactSignals: () => probeArtifactSignals
20434
20495
  });
20435
20496
  import { createHash } from "node:crypto";
20436
- import { existsSync as existsSync22, readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
20437
- import { homedir as homedir7 } from "node:os";
20438
- import { join as join16, relative, resolve as resolve3, sep } from "node:path";
20497
+ import { existsSync as existsSync23, readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
20498
+ import { homedir as homedir8 } from "node:os";
20499
+ import { join as join17, relative, resolve as resolve3, sep } from "node:path";
20439
20500
  import { execFileSync as execFileSync3 } from "node:child_process";
20440
20501
  function pathHash(relPath) {
20441
20502
  return createHash("sha256").update(relPath.split(sep).join("/")).digest("hex").slice(0, 32);
20442
20503
  }
20443
20504
  function defaultScanRoots(extraRoots = []) {
20444
20505
  const roots = [];
20445
- const home = join16(homedir7(), ".claude");
20446
- if (existsSync22(home)) roots.push({ root: home, label: "user" });
20506
+ const home = join17(homedir8(), ".claude");
20507
+ if (existsSync23(home)) roots.push({ root: home, label: "user" });
20447
20508
  for (const e of extraRoots) {
20448
20509
  const r = resolve3(e, ".claude");
20449
- if (existsSync22(r) && r !== home) roots.push({ root: r, label: "project" });
20510
+ if (existsSync23(r) && r !== home) roots.push({ root: r, label: "project" });
20450
20511
  }
20451
20512
  return roots;
20452
20513
  }
20453
20514
  function listMarkdownFiles(dir) {
20454
- if (!existsSync22(dir)) return [];
20515
+ if (!existsSync23(dir)) return [];
20455
20516
  const out = [];
20456
20517
  let entries2;
20457
20518
  try {
@@ -20461,7 +20522,7 @@ function listMarkdownFiles(dir) {
20461
20522
  }
20462
20523
  for (const name of entries2) {
20463
20524
  if (name.startsWith(".")) continue;
20464
- const full = join16(dir, name);
20525
+ const full = join17(dir, name);
20465
20526
  let stat;
20466
20527
  try {
20467
20528
  stat = statSync7(full);
@@ -20481,7 +20542,7 @@ function firstSeenDateOf(file) {
20481
20542
  const out = execFileSync3(
20482
20543
  "git",
20483
20544
  ["log", "--diff-filter=A", "--follow", "--format=%cs", "--", file],
20484
- { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname18(file) }
20545
+ { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname19(file) }
20485
20546
  ).trim().split("\n").filter(Boolean);
20486
20547
  if (out.length > 0) return out[out.length - 1];
20487
20548
  } catch {
@@ -20493,7 +20554,7 @@ function firstSeenDateOf(file) {
20493
20554
  return todayLocal();
20494
20555
  }
20495
20556
  }
20496
- function dirname18(p) {
20557
+ function dirname19(p) {
20497
20558
  const i = p.lastIndexOf(sep);
20498
20559
  return i < 0 ? "." : p.slice(0, i);
20499
20560
  }
@@ -20520,8 +20581,8 @@ function todayLocal() {
20520
20581
  function scanAuthored(roots, subdir, day2) {
20521
20582
  const out = [];
20522
20583
  for (const r of roots) {
20523
- const dir = join16(r.root, subdir);
20524
- if (!existsSync22(dir)) continue;
20584
+ const dir = join17(r.root, subdir);
20585
+ if (!existsSync23(dir)) continue;
20525
20586
  for (const f of listMarkdownFiles(dir)) {
20526
20587
  const firstSeen = firstSeenDateOf(f);
20527
20588
  if (firstSeen !== day2) continue;
@@ -20534,8 +20595,8 @@ function scanAuthored(roots, subdir, day2) {
20534
20595
  function scanEdited(roots, day2) {
20535
20596
  const out = [];
20536
20597
  for (const r of roots) {
20537
- const dir = join16(r.root, "skills");
20538
- if (!existsSync22(dir)) continue;
20598
+ const dir = join17(r.root, "skills");
20599
+ if (!existsSync23(dir)) continue;
20539
20600
  for (const f of listMarkdownFiles(dir)) {
20540
20601
  const firstSeen = firstSeenDateOf(f);
20541
20602
  if (firstSeen === day2) continue;
@@ -20558,16 +20619,16 @@ function claudemdLineDelta(extraRoots, authorEmail, day2) {
20558
20619
  const candidates = [];
20559
20620
  for (const e of extraRoots) {
20560
20621
  const f = resolve3(e, "CLAUDE.md");
20561
- if (existsSync22(f)) candidates.push(f);
20622
+ if (existsSync23(f)) candidates.push(f);
20562
20623
  }
20563
- const homeClaudeMd = join16(homedir7(), "CLAUDE.md");
20564
- if (existsSync22(homeClaudeMd)) candidates.push(homeClaudeMd);
20624
+ const homeClaudeMd = join17(homedir8(), "CLAUDE.md");
20625
+ if (existsSync23(homeClaudeMd)) candidates.push(homeClaudeMd);
20565
20626
  for (const file of candidates) {
20566
20627
  try {
20567
20628
  const out = execFileSync3(
20568
20629
  "git",
20569
20630
  ["log", "--numstat", "--format=COMMIT %cs %ae", "--", file],
20570
- { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname18(file) }
20631
+ { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname19(file) }
20571
20632
  );
20572
20633
  let currentDate = "";
20573
20634
  let currentEmail = "";
@@ -21583,8 +21644,8 @@ __export(runs_exports, {
21583
21644
  runs: () => runs
21584
21645
  });
21585
21646
  import { execSync as execSync2 } from "node:child_process";
21586
- import { existsSync as existsSync23, readFileSync as readFileSync26, readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
21587
- import { join as join17 } from "node:path";
21647
+ import { existsSync as existsSync24, readFileSync as readFileSync26, readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
21648
+ import { join as join18 } from "node:path";
21588
21649
  async function runs(args2) {
21589
21650
  const json = args2.includes("--json");
21590
21651
  const watch = args2.includes("--watch");
@@ -21668,7 +21729,7 @@ function listActiveRuns() {
21668
21729
  return runs2.sort((a, b) => a.elapsed_s - b.elapsed_s);
21669
21730
  }
21670
21731
  function readSpend(sinceMs) {
21671
- if (!existsSync23(SPEND_PATH)) return [];
21732
+ if (!existsSync24(SPEND_PATH)) return [];
21672
21733
  const lines = readFileSync26(SPEND_PATH, "utf-8").split("\n").filter((l) => l.trim());
21673
21734
  const out = [];
21674
21735
  for (const line of lines) {
@@ -21790,23 +21851,23 @@ function ageLabel(ms) {
21790
21851
  return `${Math.floor(ms / 864e5)}d`;
21791
21852
  }
21792
21853
  function listTraceFiles() {
21793
- if (!existsSync23(RUNS_DIR2)) return [];
21854
+ if (!existsSync24(RUNS_DIR2)) return [];
21794
21855
  const entries2 = readdirSync6(RUNS_DIR2).filter((f) => f.endsWith(".jsonl"));
21795
21856
  return entries2.map((f) => {
21796
- const path11 = join17(RUNS_DIR2, f);
21857
+ const path11 = join18(RUNS_DIR2, f);
21797
21858
  const st = statSync8(path11);
21798
21859
  return { runId: f.replace(/\.jsonl$/, ""), path: path11, mtimeMs: st.mtimeMs };
21799
21860
  }).sort((a, b) => b.mtimeMs - a.mtimeMs);
21800
21861
  }
21801
21862
  function resolveRunId(arg) {
21802
- if (!existsSync23(RUNS_DIR2)) return null;
21863
+ if (!existsSync24(RUNS_DIR2)) return null;
21803
21864
  if (arg === "latest") {
21804
21865
  const all2 = listTraceFiles();
21805
21866
  if (all2.length === 0) return null;
21806
21867
  return { runId: all2[0].runId, path: all2[0].path };
21807
21868
  }
21808
- const exact = join17(RUNS_DIR2, `${arg}.jsonl`);
21809
- if (existsSync23(exact)) return { runId: arg, path: exact };
21869
+ const exact = join18(RUNS_DIR2, `${arg}.jsonl`);
21870
+ if (existsSync24(exact)) return { runId: arg, path: exact };
21810
21871
  const all = listTraceFiles();
21811
21872
  const matches = all.filter((r) => r.runId.includes(arg));
21812
21873
  if (matches.length === 1) return { runId: matches[0].runId, path: matches[0].path };
@@ -21830,7 +21891,7 @@ async function inspect(arg, follow, json) {
21830
21891
  const r = resolveRunId(arg);
21831
21892
  if (!r) {
21832
21893
  console.error(`run not found: ${arg}`);
21833
- if (existsSync23(RUNS_DIR2)) {
21894
+ if (existsSync24(RUNS_DIR2)) {
21834
21895
  const all = listTraceFiles().slice(0, 5);
21835
21896
  if (all.length > 0) {
21836
21897
  console.error(`
@@ -22010,7 +22071,7 @@ async function main() {
22010
22071
  case "version":
22011
22072
  case "--version":
22012
22073
  case "-v":
22013
- console.log(`fleetlens ${"1.0.2"}`);
22074
+ console.log(`fleetlens ${"1.0.3"}`);
22014
22075
  break;
22015
22076
  case "help":
22016
22077
  case "--help":