fleetlens 1.0.1 → 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 (160) hide show
  1. package/app/apps/web/.next/BUILD_ID +1 -1
  2. package/app/apps/web/.next/app-path-routes-manifest.json +1 -0
  3. package/app/apps/web/.next/build-manifest.json +3 -3
  4. package/app/apps/web/.next/prerender-manifest.json +3 -3
  5. package/app/apps/web/.next/routes-manifest.json +6 -0
  6. package/app/apps/web/.next/server/app/_global-error.html +1 -1
  7. package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
  8. package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/app/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/app/apps/web/.next/server/app/agent/page.js.nft.json +1 -1
  16. package/app/apps/web/.next/server/app/agent/page_client-reference-manifest.js +1 -1
  17. package/app/apps/web/.next/server/app/api/agent/chats/[id]/events/route.js +3 -1
  18. package/app/apps/web/.next/server/app/api/agent/chats/[id]/events/route.js.nft.json +1 -1
  19. package/app/apps/web/.next/server/app/api/agent/chats/[id]/messages/route.js +1 -1
  20. package/app/apps/web/.next/server/app/api/agent/chats/[id]/messages/route.js.nft.json +1 -1
  21. package/app/apps/web/.next/server/app/api/agent/chats/[id]/route.js +3 -1
  22. package/app/apps/web/.next/server/app/api/agent/chats/[id]/route.js.nft.json +1 -1
  23. package/app/apps/web/.next/server/app/api/agent/chats/[id]/stop/route.js +3 -1
  24. package/app/apps/web/.next/server/app/api/agent/chats/[id]/stop/route.js.nft.json +1 -1
  25. package/app/apps/web/.next/server/app/api/agent/chats/route.js +3 -1
  26. package/app/apps/web/.next/server/app/api/agent/chats/route.js.nft.json +1 -1
  27. package/app/apps/web/.next/server/app/api/agent/index/route.js +1 -1
  28. package/app/apps/web/.next/server/app/api/agent/index/route.js.nft.json +1 -1
  29. package/app/apps/web/.next/server/app/api/agent/mcp/route.js +3 -3
  30. package/app/apps/web/.next/server/app/api/agent/mcp/route.js.nft.json +1 -1
  31. package/app/apps/web/.next/server/app/api/agent/suggestions/route.js +1 -1
  32. package/app/apps/web/.next/server/app/api/agent/suggestions/route.js.nft.json +1 -1
  33. package/app/apps/web/.next/server/app/api/ask/route.js +1 -1
  34. package/app/apps/web/.next/server/app/api/ask/route.js.nft.json +1 -1
  35. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js +1 -1
  36. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js.nft.json +1 -1
  37. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js +1 -1
  38. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js.nft.json +1 -1
  39. package/app/apps/web/.next/server/app/api/digest/month-index/route.js +1 -1
  40. package/app/apps/web/.next/server/app/api/digest/month-index/route.js.nft.json +1 -1
  41. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js +1 -1
  42. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js.nft.json +1 -1
  43. package/app/apps/web/.next/server/app/api/digest/week-index/route.js +1 -1
  44. package/app/apps/web/.next/server/app/api/digest/week-index/route.js.nft.json +1 -1
  45. package/app/apps/web/.next/server/app/api/health/route/app-paths-manifest.json +3 -0
  46. package/app/apps/web/.next/server/app/api/health/route/build-manifest.json +9 -0
  47. package/app/apps/web/.next/server/app/api/health/route/server-reference-manifest.json +4 -0
  48. package/app/apps/web/.next/server/app/api/health/route.js +7 -0
  49. package/app/apps/web/.next/server/app/api/health/route.js.map +5 -0
  50. package/app/apps/web/.next/server/app/api/health/route.js.nft.json +1 -0
  51. package/app/apps/web/.next/server/app/api/health/route_client-reference-manifest.js +3 -0
  52. package/app/apps/web/.next/server/app/api/pdf/[key]/route.js +1 -1
  53. package/app/apps/web/.next/server/app/api/pdf/[key]/route.js.nft.json +1 -1
  54. package/app/apps/web/.next/server/app/api/projects/open-folder/route.js +1 -1
  55. package/app/apps/web/.next/server/app/api/projects/open-folder/route.js.nft.json +1 -1
  56. package/app/apps/web/.next/server/app/api/runs/[runId]/route.js.nft.json +1 -1
  57. package/app/apps/web/.next/server/app/api/runs/[runId]/stream/route.js.nft.json +1 -1
  58. package/app/apps/web/.next/server/app/api/settings/credentials/route.js +1 -1
  59. package/app/apps/web/.next/server/app/api/settings/credentials/route.js.nft.json +1 -1
  60. package/app/apps/web/.next/server/app/api/settings/route.js +1 -1
  61. package/app/apps/web/.next/server/app/api/settings/route.js.nft.json +1 -1
  62. package/app/apps/web/.next/server/app/api/team/onboarding/start/route.js +1 -1
  63. package/app/apps/web/.next/server/app/api/team/onboarding/start/route.js.nft.json +1 -1
  64. package/app/apps/web/.next/server/app/api/team/sync-projects/route.js +1 -1
  65. package/app/apps/web/.next/server/app/api/team/sync-projects/route.js.nft.json +1 -1
  66. package/app/apps/web/.next/server/app/changelog/page.js.nft.json +1 -1
  67. package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  68. package/app/apps/web/.next/server/app/day/[date]/page.js.nft.json +1 -1
  69. package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
  70. package/app/apps/web/.next/server/app/day/page.js.nft.json +1 -1
  71. package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
  72. package/app/apps/web/.next/server/app/digest/[date]/page.js.nft.json +1 -1
  73. package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
  74. package/app/apps/web/.next/server/app/digest/page.js.nft.json +1 -1
  75. package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
  76. package/app/apps/web/.next/server/app/insights/[key]/page.js.nft.json +1 -1
  77. package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
  78. package/app/apps/web/.next/server/app/insights/page.js.nft.json +1 -1
  79. package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
  80. package/app/apps/web/.next/server/app/page.js.nft.json +1 -1
  81. package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  82. package/app/apps/web/.next/server/app/parallelism/page.js.nft.json +1 -1
  83. package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
  84. package/app/apps/web/.next/server/app/print/[key]/page.js.nft.json +1 -1
  85. package/app/apps/web/.next/server/app/print/[key]/page_client-reference-manifest.js +1 -1
  86. package/app/apps/web/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
  87. package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  88. package/app/apps/web/.next/server/app/projects/page.js.nft.json +1 -1
  89. package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  90. package/app/apps/web/.next/server/app/runs/page.js.nft.json +1 -1
  91. package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  92. package/app/apps/web/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
  93. package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  94. package/app/apps/web/.next/server/app/sessions/page.js.nft.json +1 -1
  95. package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  96. package/app/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
  97. package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  98. package/app/apps/web/.next/server/app/team/onboarding/page.js.nft.json +1 -1
  99. package/app/apps/web/.next/server/app/team/onboarding/page_client-reference-manifest.js +1 -1
  100. package/app/apps/web/.next/server/app/team/page.js.nft.json +1 -1
  101. package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +1 -1
  102. package/app/apps/web/.next/server/app/usage/page.js.nft.json +1 -1
  103. package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  104. package/app/apps/web/.next/server/app-paths-manifest.json +1 -0
  105. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__038-.1r._.js → [root-of-the-server]__0-09rjv._.js} +2 -2
  106. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0_5tf-2._.js → [root-of-the-server]__01oercw._.js} +5 -5
  107. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02.51sr._.js +3 -0
  108. package/app/apps/web/.next/server/chunks/[root-of-the-server]__057w7kr._.js +28 -0
  109. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0pirsh0._.js → [root-of-the-server]__07b5796._.js} +2 -2
  110. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__02puo0u._.js → [root-of-the-server]__07xaqv3._.js} +2 -2
  111. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__06xto5z._.js → [root-of-the-server]__08c24et._.js} +2 -2
  112. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0mvl0qn._.js → [root-of-the-server]__08m2h38._.js} +2 -2
  113. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0mx_9mb._.js → [root-of-the-server]__0c7ght_._.js} +2 -2
  114. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__12iid50._.js → [root-of-the-server]__0l5i8nk._.js} +2 -2
  115. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__04g-b-m._.js → [root-of-the-server]__0mcer3z._.js} +2 -2
  116. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0o9lsie._.js +30 -0
  117. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0367vbv._.js → [root-of-the-server]__0ozooam._.js} +2 -2
  118. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0uf_ch4._.js +28 -0
  119. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0uiom2m._.js +28 -0
  120. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__096_llw._.js → [root-of-the-server]__0usaajs._.js} +2 -2
  121. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0zyh554._.js +3 -0
  122. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0gvw6dk._.js → [root-of-the-server]__0~4wgaf._.js} +2 -2
  123. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0~~bpcw._.js +3 -0
  124. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__01~cgp8._.js → [root-of-the-server]__10.g-w1._.js} +2 -2
  125. package/app/apps/web/.next/server/chunks/[root-of-the-server]__12vjv4c._.js +28 -0
  126. package/app/apps/web/.next/server/chunks/apps_web__next-internal_server_app_api_health_route_actions_08i7v0h.js +3 -0
  127. package/app/apps/web/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0sr4wr_.js +3 -3
  128. package/app/apps/web/.next/server/chunks/packages_entries_dist_node_0bckr7-.js +19 -19
  129. package/app/apps/web/.next/server/chunks/ssr/_0k8yioi._.js +1 -1
  130. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0n7_p1d._.js +1 -1
  131. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0nb5_-s._.js +1 -1
  132. package/app/apps/web/.next/server/functions-config-manifest.json +1 -0
  133. package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
  134. package/app/apps/web/.next/server/middleware-manifest.json +5 -5
  135. package/app/apps/web/.next/server/pages/500.html +1 -1
  136. package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
  137. package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
  138. package/app/apps/web/.next/static/chunks/0ntt~a0712~pv.js +14 -0
  139. package/app/apps/web/app/api/ask/route.ts +8 -2
  140. package/app/apps/web/app/api/health/route.ts +12 -0
  141. package/app/apps/web/lib/agent/run.ts +11 -2
  142. package/app/apps/web/lib/changelog-data.generated.ts +1 -1
  143. package/app/apps/web/package.json +1 -1
  144. package/app/apps/web/tsconfig.tsbuildinfo +1 -1
  145. package/dist/daemon-worker.js +377 -50
  146. package/dist/index.js +204 -114
  147. package/menubar/Fleetlens.app/Contents/Info.plist +2 -2
  148. package/menubar/Fleetlens.app/Contents/MacOS/FleetlensMenubar +0 -0
  149. package/package.json +1 -1
  150. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02faosk._.js +0 -30
  151. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02petpy._.js +0 -3
  152. package/app/apps/web/.next/server/chunks/[root-of-the-server]__09cgmam._.js +0 -28
  153. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0sbhe0s._.js +0 -3
  154. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0tk8p3d._.js +0 -28
  155. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0u6pamj._.js +0 -28
  156. package/app/apps/web/.next/server/chunks/[root-of-the-server]__12jomao._.js +0 -28
  157. package/app/apps/web/.next/static/chunks/03vmnii5njgx2.js +0 -14
  158. /package/app/apps/web/.next/static/{3_tJh8qOJtVg59IUgLbCS → Shk_TH0B6lHs9cBZekkf5}/_buildManifest.js +0 -0
  159. /package/app/apps/web/.next/static/{3_tJh8qOJtVg59IUgLbCS → Shk_TH0B6lHs9cBZekkf5}/_clientMiddlewareManifest.js +0 -0
  160. /package/app/apps/web/.next/static/{3_tJh8qOJtVg59IUgLbCS → Shk_TH0B6lHs9cBZekkf5}/_ssgManifest.js +0 -0
package/dist/index.js CHANGED
@@ -6217,6 +6217,8 @@ __export(server_exports, {
6217
6217
  getServerStatus: () => getServerStatus,
6218
6218
  isServerStale: () => isServerStale,
6219
6219
  openBrowser: () => openBrowser,
6220
+ probeServerHealth: () => probeServerHealth,
6221
+ restartWedgedServer: () => restartWedgedServer,
6220
6222
  startServer: () => startServer,
6221
6223
  stopServer: () => stopServer
6222
6224
  });
@@ -6241,9 +6243,9 @@ function onDiskVersion() {
6241
6243
  try {
6242
6244
  const here = dirname3(fileURLToPath(import.meta.url));
6243
6245
  const pkg = JSON.parse(readFileSync5(join3(here, "..", "package.json"), "utf8"));
6244
- return pkg.version ?? "1.0.1";
6246
+ return pkg.version ?? "1.0.3";
6245
6247
  } catch {
6246
- return "1.0.1";
6248
+ return "1.0.3";
6247
6249
  }
6248
6250
  }
6249
6251
  function getServerStatus() {
@@ -6255,7 +6257,7 @@ function getServerStatus() {
6255
6257
  return { running: false };
6256
6258
  }
6257
6259
  function isServerStale(status2) {
6258
- return status2.running === true && status2.version !== "1.0.1";
6260
+ return status2.running === true && status2.version !== "1.0.3";
6259
6261
  }
6260
6262
  async function ensureCurrentServer(opts = {}) {
6261
6263
  const status2 = getServerStatus();
@@ -6316,6 +6318,25 @@ async function startServer(opts = {}) {
6316
6318
  await waitForHealth(`http://localhost:${port}`, 3e4);
6317
6319
  return { pid, port };
6318
6320
  }
6321
+ async function probeServerHealth(port, timeoutMs) {
6322
+ try {
6323
+ await fetch(`http://localhost:${port}/api/health`, {
6324
+ signal: AbortSignal.timeout(timeoutMs)
6325
+ });
6326
+ return true;
6327
+ } catch {
6328
+ return false;
6329
+ }
6330
+ }
6331
+ async function restartWedgedServer(pid, port) {
6332
+ try {
6333
+ process.kill(pid, "SIGKILL");
6334
+ } catch {
6335
+ }
6336
+ removePid(PID_FILE);
6337
+ await waitForPortFree(port, 5e3);
6338
+ return startServer({ port });
6339
+ }
6319
6340
  function stopServer() {
6320
6341
  cleanStalePid(PID_FILE, SERVER_MARKERS);
6321
6342
  const entry = readPid(PID_FILE);
@@ -6697,9 +6718,9 @@ Installed: ${PACKAGE_NAME}@${verify.installedVersion} at ${verify.installedPath
6697
6718
  console.warn(
6698
6719
  ` \u2022 reinstall in the correct Node env: 'npm install -g ${PACKAGE_NAME}@latest'`
6699
6720
  );
6700
- } else if (verify.installedVersion !== "1.0.1") {
6721
+ } else if (verify.installedVersion !== "1.0.3") {
6701
6722
  console.log(
6702
- ` \u2192 This process is still running ${"1.0.1"}. Next invocation will use ${verify.installedVersion}.`
6723
+ ` \u2192 This process is still running ${"1.0.3"}. Next invocation will use ${verify.installedVersion}.`
6703
6724
  );
6704
6725
  }
6705
6726
  }
@@ -6734,14 +6755,14 @@ async function getUpdateAvailability() {
6734
6755
  if (isDevMode()) return null;
6735
6756
  const latest = await fetchLatestVersion();
6736
6757
  if (latest === null) return {
6737
- current: "1.0.1",
6758
+ current: "1.0.3",
6738
6759
  latest: null,
6739
6760
  updateAvailable: false
6740
6761
  };
6741
6762
  return {
6742
- current: "1.0.1",
6763
+ current: "1.0.3",
6743
6764
  latest,
6744
- updateAvailable: shouldUpdate("1.0.1", latest)
6765
+ updateAvailable: shouldUpdate("1.0.3", latest)
6745
6766
  };
6746
6767
  }
6747
6768
  async function checkForUpdate() {
@@ -6831,7 +6852,7 @@ async function restartServices(state) {
6831
6852
  }
6832
6853
  async function forceUpdate() {
6833
6854
  const latest = await fetchLatestVersion();
6834
- const current = "1.0.1";
6855
+ const current = "1.0.3";
6835
6856
  if (latest === null) {
6836
6857
  console.error("Could not reach npm registry. Check your network.");
6837
6858
  process.exit(1);
@@ -7241,10 +7262,18 @@ async function status() {
7241
7262
  if (server.running) {
7242
7263
  const url = `http://localhost:${server.port}`;
7243
7264
  const ver = server.version ?? "unknown";
7244
- console.log(`Server: running on ${url} (PID ${server.pid}, v${ver})`);
7265
+ const responsive = await probeServerHealth(server.port, 3e3);
7266
+ if (responsive) {
7267
+ console.log(`Server: running on ${url} (PID ${server.pid}, v${ver})`);
7268
+ } else {
7269
+ console.log(`Server: running but UNRESPONSIVE on ${url} (PID ${server.pid}, v${ver})`);
7270
+ console.log(
7271
+ " \u26A0 process is alive but not answering HTTP \u2014 a running daemon's watchdog force-restarts a wedged server ('fleetlens daemon logs' shows its verdicts), or run 'fleetlens start' now"
7272
+ );
7273
+ }
7245
7274
  if (isServerStale(server)) {
7246
7275
  console.log(
7247
- ` \u26A0 serving stale ${ver} (CLI is ${"1.0.1"}) \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`
7248
7277
  );
7249
7278
  }
7250
7279
  } else {
@@ -14493,10 +14522,58 @@ RESPOND WITH ONLY VALID JSON (no prose, no code fence):
14493
14522
  }
14494
14523
  });
14495
14524
 
14496
- // ../entries/dist/tmux-runner.js
14497
- 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";
14498
- 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";
14499
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";
14500
14577
  import { spawnSync as spawnSync2 } from "node:child_process";
14501
14578
  function which(bin) {
14502
14579
  const r = spawnSync2("/usr/bin/env", ["which", bin], { encoding: "utf8" });
@@ -14507,18 +14584,18 @@ function which(bin) {
14507
14584
  function tmuxRunnerAvailable() {
14508
14585
  if (!which("tmux"))
14509
14586
  return { ok: false, reason: "tmux not on PATH" };
14510
- if (!which("claude"))
14511
- return { ok: false, reason: "claude not on PATH" };
14587
+ if (!resolveClaudeBin())
14588
+ return { ok: false, reason: "claude CLI not found" };
14512
14589
  return { ok: true };
14513
14590
  }
14514
14591
  function runtimeCwd() {
14515
- const dir = join11(homedir5(), ".cclens", "runtime");
14516
- if (!existsSync13(dir))
14592
+ const dir = join12(homedir6(), ".cclens", "runtime");
14593
+ if (!existsSync14(dir))
14517
14594
  mkdirSync8(dir, { recursive: true });
14518
14595
  return realpathSync5(dir);
14519
14596
  }
14520
14597
  function ensureRuntimeCwdTrusted(cwd) {
14521
- const cfgPath = join11(homedir5(), ".claude.json");
14598
+ const cfgPath = join12(homedir6(), ".claude.json");
14522
14599
  let cfg;
14523
14600
  try {
14524
14601
  cfg = JSON.parse(readFileSync15(cfgPath, "utf8"));
@@ -14554,18 +14631,18 @@ async function runClaudeUnderTmuxImpl(args2) {
14554
14631
  const tmuxBin = args2.tmuxBin ?? which("tmux");
14555
14632
  if (!tmuxBin)
14556
14633
  throw new TmuxUnavailableError("tmux not on PATH");
14557
- const claudeBin = args2.claudeBin ?? which("claude");
14634
+ const claudeBin = args2.claudeBin ?? resolveClaudeBin();
14558
14635
  if (!claudeBin)
14559
- throw new TmuxUnavailableError("claude not on PATH");
14636
+ throw new TmuxUnavailableError("claude CLI not found");
14560
14637
  if (args2.signal?.aborted)
14561
14638
  throw new TmuxRunError("aborted before spawn");
14562
14639
  const cwd = runtimeCwd();
14563
14640
  ensureRuntimeCwdTrusted(cwd);
14564
14641
  const runId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
14565
14642
  const sessionName = `cclens-${runId}`;
14566
- const systemFile = join11(cwd, `system-${runId}.txt`);
14567
- const userFile = join11(cwd, `user-${runId}.txt`);
14568
- 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`);
14569
14646
  writeFileSync9(systemFile, args2.systemPrompt);
14570
14647
  writeFileSync9(userFile, args2.reminder ? `${args2.userPrompt}
14571
14648
 
@@ -14654,7 +14731,7 @@ function snapshotAllTranscripts() {
14654
14731
  return out;
14655
14732
  }
14656
14733
  for (const sub of subs) {
14657
- const dir = join11(root, sub);
14734
+ const dir = join12(root, sub);
14658
14735
  let files;
14659
14736
  try {
14660
14737
  files = readdirSync3(dir);
@@ -14663,7 +14740,7 @@ function snapshotAllTranscripts() {
14663
14740
  }
14664
14741
  for (const f of files) {
14665
14742
  if (f.endsWith(".jsonl"))
14666
- out.add(join11(dir, f));
14743
+ out.add(join12(dir, f));
14667
14744
  }
14668
14745
  }
14669
14746
  return out;
@@ -14704,7 +14781,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
14704
14781
  subs = [];
14705
14782
  }
14706
14783
  for (const sub of subs) {
14707
- const dir = join11(root, sub);
14784
+ const dir = join12(root, sub);
14708
14785
  let files;
14709
14786
  try {
14710
14787
  files = readdirSync3(dir);
@@ -14714,7 +14791,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
14714
14791
  for (const f of files) {
14715
14792
  if (!f.endsWith(".jsonl"))
14716
14793
  continue;
14717
- const full = join11(dir, f);
14794
+ const full = join12(dir, f);
14718
14795
  if (existingBefore.has(full))
14719
14796
  continue;
14720
14797
  if (readJsonlCwd(full) === targetCwd)
@@ -14788,7 +14865,7 @@ function cleanup(cwd, runId, tmuxBin, sessionName, transcriptPath) {
14788
14865
  }
14789
14866
  for (const f of [`system-${runId}.txt`, `user-${runId}.txt`, `run-${runId}.sh`]) {
14790
14867
  try {
14791
- unlinkSync3(join11(cwd, f));
14868
+ unlinkSync3(join12(cwd, f));
14792
14869
  } catch {
14793
14870
  }
14794
14871
  }
@@ -14803,6 +14880,7 @@ var TmuxUnavailableError, TmuxRunError, mutex, PROJECTS_ROOT;
14803
14880
  var init_tmux_runner = __esm({
14804
14881
  "../entries/dist/tmux-runner.js"() {
14805
14882
  "use strict";
14883
+ init_claude_bin();
14806
14884
  TmuxUnavailableError = class extends Error {
14807
14885
  constructor(message) {
14808
14886
  super(message);
@@ -14816,17 +14894,17 @@ var init_tmux_runner = __esm({
14816
14894
  }
14817
14895
  };
14818
14896
  mutex = Promise.resolve();
14819
- PROJECTS_ROOT = () => join11(homedir5(), ".claude", "projects");
14897
+ PROJECTS_ROOT = () => join12(homedir6(), ".claude", "projects");
14820
14898
  }
14821
14899
  });
14822
14900
 
14823
14901
  // ../entries/dist/llm-runner.js
14824
14902
  import { spawn as spawn4 } from "node:child_process";
14825
- import { mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, writeFileSync as writeFileSync10, existsSync as existsSync14 } from "node:fs";
14826
- 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";
14827
14905
  import { randomUUID } from "node:crypto";
14828
14906
  function ensureRunsDir() {
14829
- if (!existsSync14(RUNS_DIR)) {
14907
+ if (!existsSync15(RUNS_DIR)) {
14830
14908
  try {
14831
14909
  mkdirSync9(RUNS_DIR, { recursive: true });
14832
14910
  } catch {
@@ -14855,7 +14933,7 @@ function newRunId(kind) {
14855
14933
  return `${ts}_${kind}_${short}`;
14856
14934
  }
14857
14935
  function tracePath(runId) {
14858
- return join12(RUNS_DIR, `${runId}.jsonl`);
14936
+ return join13(RUNS_DIR, `${runId}.jsonl`);
14859
14937
  }
14860
14938
  function safeAppend(path11, line) {
14861
14939
  try {
@@ -14998,7 +15076,14 @@ function runClaudePrintMode(args2) {
14998
15076
  "--append-system-prompt",
14999
15077
  args2.systemPrompt
15000
15078
  ];
15001
- 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) });
15002
15087
  safeAppend(trace, JSON.stringify({ _meta: { type: "spawned", run_id: runId, pid: proc.pid } }) + "\n");
15003
15088
  const stdinPayload = args2.reminder ? `${args2.userPrompt}
15004
15089
 
@@ -15099,6 +15184,7 @@ var init_llm_runner = __esm({
15099
15184
  "../entries/dist/llm-runner.js"() {
15100
15185
  "use strict";
15101
15186
  init_fs();
15187
+ init_claude_bin();
15102
15188
  init_tmux_runner();
15103
15189
  RUNS_DIR = cclensPath("llm-runs");
15104
15190
  }
@@ -15271,8 +15357,8 @@ var init_enrich2 = __esm({
15271
15357
  });
15272
15358
 
15273
15359
  // ../entries/dist/budget.js
15274
- import { appendFileSync as appendFileSync4, readFileSync as readFileSync16, existsSync as existsSync15, mkdirSync as mkdirSync10 } from "node:fs";
15275
- 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";
15276
15362
  function spendPath() {
15277
15363
  if (spendPathCached)
15278
15364
  return spendPathCached;
@@ -15284,12 +15370,12 @@ function __setSpendPathForTest(path11) {
15284
15370
  }
15285
15371
  function appendSpend(record) {
15286
15372
  const p = spendPath();
15287
- mkdirSync10(dirname10(p), { recursive: true });
15373
+ mkdirSync10(dirname11(p), { recursive: true });
15288
15374
  appendFileSync4(p, JSON.stringify(record) + "\n", { encoding: "utf8" });
15289
15375
  }
15290
15376
  function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
15291
15377
  const p = spendPath();
15292
- if (!existsSync15(p))
15378
+ if (!existsSync16(p))
15293
15379
  return 0;
15294
15380
  const year = now.getUTCFullYear();
15295
15381
  const month2 = now.getUTCMonth();
@@ -15323,7 +15409,7 @@ var init_budget = __esm({
15323
15409
  });
15324
15410
 
15325
15411
  // ../entries/dist/pipeline-lock.js
15326
- 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";
15327
15413
  function lockPath() {
15328
15414
  if (lockPathCached)
15329
15415
  return lockPathCached;
@@ -15368,7 +15454,7 @@ function pidAlive(pid) {
15368
15454
  }
15369
15455
  function interactiveLockFresh(nowMs) {
15370
15456
  const p = lockPath();
15371
- if (!existsSync16(p))
15457
+ if (!existsSync17(p))
15372
15458
  return false;
15373
15459
  try {
15374
15460
  const mtime = statSync3(p).mtimeMs;
@@ -15480,8 +15566,8 @@ var init_queue = __esm({
15480
15566
  });
15481
15567
 
15482
15568
  // ../entries/dist/settings.js
15483
- import { readFileSync as readFileSync18, writeFileSync as writeFileSync12, renameSync as renameSync5, chmodSync as chmodSync2, mkdirSync as mkdirSync11, existsSync as existsSync17 } from "node:fs";
15484
- 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";
15485
15571
  function settingsPath() {
15486
15572
  if (settingsPathCached)
15487
15573
  return settingsPathCached;
@@ -15516,7 +15602,7 @@ function fromDisk(d) {
15516
15602
  }
15517
15603
  function readSettings() {
15518
15604
  const p = settingsPath();
15519
- if (!existsSync17(p))
15605
+ if (!existsSync18(p))
15520
15606
  return DEFAULT_SETTINGS;
15521
15607
  try {
15522
15608
  const raw = readFileSync18(p, "utf8");
@@ -15527,7 +15613,7 @@ function readSettings() {
15527
15613
  }
15528
15614
  function writeSettings(s) {
15529
15615
  const p = settingsPath();
15530
- mkdirSync11(dirname11(p), { recursive: true });
15616
+ mkdirSync11(dirname12(p), { recursive: true });
15531
15617
  const tmp = `${p}.tmp`;
15532
15618
  writeFileSync12(tmp, JSON.stringify(toDisk(s), null, 2), { encoding: "utf8" });
15533
15619
  if (process.platform !== "win32") {
@@ -18709,8 +18795,8 @@ var init_digest_month_pipeline = __esm({
18709
18795
  });
18710
18796
 
18711
18797
  // ../entries/dist/credentials.js
18712
- 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";
18713
- 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";
18714
18800
  async function fetchZaiUsage(candidate) {
18715
18801
  const key = candidate.trim();
18716
18802
  if (!key)
@@ -18780,7 +18866,7 @@ function credentialsPath() {
18780
18866
  }
18781
18867
  function readCredentials() {
18782
18868
  const p = credentialsPath();
18783
- if (!existsSync18(p))
18869
+ if (!existsSync19(p))
18784
18870
  return {};
18785
18871
  try {
18786
18872
  const raw = readFileSync19(p, "utf8");
@@ -18806,7 +18892,7 @@ function writeZaiKey(apiKey) {
18806
18892
  const store = readCredentials();
18807
18893
  store.zai = { ...store.zai ?? {}, apiKey };
18808
18894
  const p = credentialsPath();
18809
- mkdirSync12(dirname12(p), { recursive: true });
18895
+ mkdirSync12(dirname13(p), { recursive: true });
18810
18896
  const tmp = `${p}.tmp`;
18811
18897
  writeFileSync13(tmp, JSON.stringify(store, null, 2), { encoding: "utf8" });
18812
18898
  if (process.platform !== "win32") {
@@ -18847,6 +18933,7 @@ var init_credentials = __esm({
18847
18933
  // ../entries/dist/node.js
18848
18934
  var node_exports = {};
18849
18935
  __export(node_exports, {
18936
+ ClaudeBinNotFoundError: () => ClaudeBinNotFoundError,
18850
18937
  DIGEST_DAY_SYSTEM_PROMPT: () => DIGEST_DAY_SYSTEM_PROMPT,
18851
18938
  DIGEST_MONTH_SYSTEM_PROMPT: () => DIGEST_MONTH_SYSTEM_PROMPT,
18852
18939
  DIGEST_WEEK_SYSTEM_PROMPT: () => DIGEST_WEEK_SYSTEM_PROMPT,
@@ -18869,6 +18956,7 @@ __export(node_exports, {
18869
18956
  buildEnrichmentUserPrompt: () => buildEnrichmentUserPrompt,
18870
18957
  buildMonthDigestUserPrompt: () => buildMonthDigestUserPrompt,
18871
18958
  buildWeekDigestUserPrompt: () => buildWeekDigestUserPrompt,
18959
+ claudeSpawnEnv: () => claudeSpawnEnv,
18872
18960
  computeCostUsd: () => computeCostUsd,
18873
18961
  computeDaySignals: () => computeDaySignals,
18874
18962
  computeInteractionGrammar: () => computeInteractionGrammar,
@@ -18898,6 +18986,7 @@ __export(node_exports, {
18898
18986
  readSettings: () => readSettings,
18899
18987
  readWeekDigest: () => readWeekDigest,
18900
18988
  removeInteractiveLock: () => removeInteractiveLock,
18989
+ resolveClaudeBin: () => resolveClaudeBin,
18901
18990
  runClaudeSubprocess: () => runClaudeSubprocess,
18902
18991
  runClaudeUnderTmux: () => runClaudeUnderTmux,
18903
18992
  runDayDigestPipeline: () => runDayDigestPipeline,
@@ -18937,6 +19026,7 @@ var init_node = __esm({
18937
19026
  init_digest_month_pipeline();
18938
19027
  init_tmux_runner();
18939
19028
  init_llm_runner();
19029
+ init_claude_bin();
18940
19030
  init_digest_fs();
18941
19031
  init_credentials();
18942
19032
  }
@@ -19413,9 +19503,9 @@ var menubar_exports = {};
19413
19503
  __export(menubar_exports, {
19414
19504
  menubar: () => menubar
19415
19505
  });
19416
- import { existsSync as existsSync19, mkdirSync as mkdirSync13, cpSync, rmSync as rmSync2, readdirSync as readdirSync4, writeFileSync as writeFileSync14, realpathSync as realpathSync6 } from "node:fs";
19417
- import { homedir as homedir6 } from "node:os";
19418
- 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";
19419
19509
  import { fileURLToPath as fileURLToPath3 } from "node:url";
19420
19510
  import { execFile as execFile2 } from "node:child_process";
19421
19511
  import { promisify as promisify2 } from "node:util";
@@ -19423,8 +19513,8 @@ function isMac2() {
19423
19513
  return process.platform === "darwin";
19424
19514
  }
19425
19515
  function bundledAppPath() {
19426
- const here = dirname13(fileURLToPath3(import.meta.url));
19427
- return join13(here, "..", "menubar", APP_BUNDLE);
19516
+ const here = dirname14(fileURLToPath3(import.meta.url));
19517
+ return join14(here, "..", "menubar", APP_BUNDLE);
19428
19518
  }
19429
19519
  function resolveScriptPath2() {
19430
19520
  const argv1 = process.argv[1] ?? "";
@@ -19445,10 +19535,10 @@ function writeCliLaunchFile() {
19445
19535
  }
19446
19536
  }
19447
19537
  function installedAppPath() {
19448
- return join13(homedir6(), "Applications", APP_BUNDLE);
19538
+ return join14(homedir7(), "Applications", APP_BUNDLE);
19449
19539
  }
19450
19540
  function legacyInstalledAppPath() {
19451
- return join13(homedir6(), "Applications", LEGACY_APP_BUNDLE);
19541
+ return join14(homedir7(), "Applications", LEGACY_APP_BUNDLE);
19452
19542
  }
19453
19543
  async function isRunning() {
19454
19544
  try {
@@ -19487,14 +19577,14 @@ async function installMenubar(opts) {
19487
19577
  return;
19488
19578
  }
19489
19579
  const src = bundledAppPath();
19490
- if (!existsSync19(src)) {
19580
+ if (!existsSync20(src)) {
19491
19581
  console.error(
19492
19582
  `Bundled widget not found at ${src}.
19493
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.`
19494
19584
  );
19495
19585
  process.exit(1);
19496
19586
  }
19497
- const destDir = join13(homedir6(), "Applications");
19587
+ const destDir = join14(homedir7(), "Applications");
19498
19588
  mkdirSync13(destDir, { recursive: true });
19499
19589
  const dest = installedAppPath();
19500
19590
  if (await isRunning()) {
@@ -19533,7 +19623,7 @@ async function uninstallMenubar() {
19533
19623
  await new Promise((r) => setTimeout(r, 300));
19534
19624
  }
19535
19625
  const dest = installedAppPath();
19536
- if (existsSync19(dest)) {
19626
+ if (existsSync20(dest)) {
19537
19627
  rmSync2(dest, { recursive: true, force: true });
19538
19628
  console.log(`Removed ${dest}`);
19539
19629
  } else {
@@ -19548,7 +19638,7 @@ async function openMenubar() {
19548
19638
  return;
19549
19639
  }
19550
19640
  const dest = installedAppPath();
19551
- if (!existsSync19(dest)) {
19641
+ if (!existsSync20(dest)) {
19552
19642
  console.log("Widget not installed yet. Run `fleetlens menubar install` first.");
19553
19643
  return;
19554
19644
  }
@@ -19565,15 +19655,15 @@ async function statusMenubar() {
19565
19655
  return;
19566
19656
  }
19567
19657
  const dest = installedAppPath();
19568
- const installed = existsSync19(dest);
19658
+ const installed = existsSync20(dest);
19569
19659
  const running = await isRunning();
19570
- const bundled = existsSync19(bundledAppPath());
19660
+ const bundled = existsSync20(bundledAppPath());
19571
19661
  console.log(`Menu bar widget: ${installed ? "installed" : "not installed"}${installed ? ` (${dest})` : ""}`);
19572
19662
  console.log(`Running: ${running ? "yes" : "no"}`);
19573
19663
  console.log(`Bundled in CLI: ${bundled ? "yes" : "no \u2014 this build ships without the widget"}`);
19574
19664
  if (installed) {
19575
19665
  try {
19576
- const apps = readdirSync4(join13(homedir6(), "Applications"));
19666
+ const apps = readdirSync4(join14(homedir7(), "Applications"));
19577
19667
  const ours = apps.find((a) => a === APP_BUNDLE);
19578
19668
  console.log(`App bundle: ${ours ? "present in ~/Applications" : "missing"}`);
19579
19669
  } catch {
@@ -19659,7 +19749,7 @@ var init_config = __esm({
19659
19749
 
19660
19750
  // src/perception/build-entries.ts
19661
19751
  import { statSync as statSync4, readFileSync as readFileSync20 } from "node:fs";
19662
- import { basename as basename2, dirname as dirname14 } from "node:path";
19752
+ import { basename as basename2, dirname as dirname15 } from "node:path";
19663
19753
  function decodeProjectDirName(projectDir) {
19664
19754
  if (projectDir.startsWith("-")) {
19665
19755
  return "/" + projectDir.slice(1).replace(/-/g, "/");
@@ -19679,7 +19769,7 @@ function buildEntriesForFile(filePath) {
19679
19769
  if (rawLines.length === 0) return null;
19680
19770
  const { meta, events } = parseTranscript(rawLines);
19681
19771
  const fileName = basename2(filePath);
19682
- const projectDir = basename2(dirname14(filePath));
19772
+ const projectDir = basename2(dirname15(filePath));
19683
19773
  const sessionId = fileName.replace(/\.jsonl$/, "");
19684
19774
  const sd = {
19685
19775
  ...meta,
@@ -19937,7 +20027,7 @@ function buildIngestPayload(inputs) {
19937
20027
  return {
19938
20028
  ingestId: randomUUID2(),
19939
20029
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
19940
- cliVersion: "1.0.1",
20030
+ cliVersion: "1.0.3",
19941
20031
  ...richRollup || inputs.enrichedExtras || inputs.artifactSignals ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
19942
20032
  ...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
19943
20033
  ...richRollup ? { richRollup } : {},
@@ -19979,8 +20069,8 @@ var init_push = __esm({
19979
20069
  });
19980
20070
 
19981
20071
  // src/team/git-remote.ts
19982
- import { existsSync as existsSync20, readFileSync as readFileSync21, statSync as statSync5 } from "node:fs";
19983
- 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";
19984
20074
  function parseGithubRemote(url) {
19985
20075
  const m = url.trim().match(GITHUB_URL_RE);
19986
20076
  return m ? `${m[1]}/${m[2]}`.toLowerCase() : null;
@@ -20000,19 +20090,19 @@ function originUrl2(configText) {
20000
20090
  return null;
20001
20091
  }
20002
20092
  function gitConfigPathFor(dir) {
20003
- const dotGit = join14(dir, ".git");
20093
+ const dotGit = join15(dir, ".git");
20004
20094
  const st = statSync5(dotGit, { throwIfNoEntry: false });
20005
20095
  if (!st) return null;
20006
- if (st.isDirectory()) return join14(dotGit, "config");
20096
+ if (st.isDirectory()) return join15(dotGit, "config");
20007
20097
  const m = readFileSync21(dotGit, "utf8").match(/^gitdir:\s*(.+)\s*$/m);
20008
20098
  if (!m) return null;
20009
20099
  const gd = isAbsolute2(m[1]) ? m[1] : resolve2(dir, m[1]);
20010
- const commondirFile = join14(gd, "commondir");
20011
- if (existsSync20(commondirFile)) {
20100
+ const commondirFile = join15(gd, "commondir");
20101
+ if (existsSync21(commondirFile)) {
20012
20102
  const common = readFileSync21(commondirFile, "utf8").trim();
20013
- return join14(isAbsolute2(common) ? common : resolve2(gd, common), "config");
20103
+ return join15(isAbsolute2(common) ? common : resolve2(gd, common), "config");
20014
20104
  }
20015
- return join14(gd, "config");
20105
+ return join15(gd, "config");
20016
20106
  }
20017
20107
  function createRepoResolver() {
20018
20108
  const cache = /* @__PURE__ */ new Map();
@@ -20022,14 +20112,14 @@ function createRepoResolver() {
20022
20112
  if (hit !== void 0) return hit;
20023
20113
  let repo = null;
20024
20114
  try {
20025
- for (let d = dir; ; d = dirname15(d)) {
20115
+ for (let d = dir; ; d = dirname16(d)) {
20026
20116
  const config = gitConfigPathFor(d);
20027
- if (config && existsSync20(config)) {
20117
+ if (config && existsSync21(config)) {
20028
20118
  const url = originUrl2(readFileSync21(config, "utf8"));
20029
20119
  repo = url ? parseGithubRemote(url) : null;
20030
20120
  break;
20031
20121
  }
20032
- if (d === dirname15(d)) break;
20122
+ if (d === dirname16(d)) break;
20033
20123
  }
20034
20124
  } catch {
20035
20125
  repo = null;
@@ -20048,9 +20138,9 @@ var init_git_remote = __esm({
20048
20138
 
20049
20139
  // src/team/queue.ts
20050
20140
  import { readFileSync as readFileSync22, writeFileSync as writeFileSync15, appendFileSync as appendFileSync5, statSync as statSync6, mkdirSync as mkdirSync14 } from "node:fs";
20051
- import { dirname as dirname16 } from "node:path";
20141
+ import { dirname as dirname17 } from "node:path";
20052
20142
  function enqueuePayload(payload, queuePath = QUEUE_PATH) {
20053
- mkdirSync14(dirname16(queuePath), { recursive: true });
20143
+ mkdirSync14(dirname17(queuePath), { recursive: true });
20054
20144
  const entry = { payload, enqueuedAt: (/* @__PURE__ */ new Date()).toISOString() };
20055
20145
  appendFileSync5(queuePath, JSON.stringify(entry) + "\n", "utf8");
20056
20146
  try {
@@ -20104,8 +20194,8 @@ var init_queue2 = __esm({
20104
20194
  });
20105
20195
 
20106
20196
  // src/usage/profile.ts
20107
- import { existsSync as existsSync21, mkdirSync as mkdirSync15, readFileSync as readFileSync23, writeFileSync as writeFileSync16 } from "node:fs";
20108
- 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";
20109
20199
  function mapRateLimitTier(rateLimitTier) {
20110
20200
  switch (rateLimitTier) {
20111
20201
  case "default_claude_pro":
@@ -20145,7 +20235,7 @@ async function fetchProfile(nowMs = Date.now()) {
20145
20235
  };
20146
20236
  }
20147
20237
  function readCachedProfile(cachePath) {
20148
- if (!existsSync21(cachePath)) return null;
20238
+ if (!existsSync22(cachePath)) return null;
20149
20239
  try {
20150
20240
  const raw = JSON.parse(readFileSync23(cachePath, "utf8"));
20151
20241
  if (typeof raw.fetchedAtMs !== "number" || !raw.profile) return null;
@@ -20155,7 +20245,7 @@ function readCachedProfile(cachePath) {
20155
20245
  }
20156
20246
  }
20157
20247
  function writeCachedProfile(cachePath, profile, nowMs = Date.now()) {
20158
- mkdirSync15(dirname17(cachePath), { recursive: true });
20248
+ mkdirSync15(dirname18(cachePath), { recursive: true });
20159
20249
  writeFileSync16(
20160
20250
  cachePath,
20161
20251
  JSON.stringify({ fetchedAtMs: nowMs, profile }, null, 2),
@@ -20369,11 +20459,11 @@ var init_sync_log = __esm({
20369
20459
 
20370
20460
  // src/team/last-push.ts
20371
20461
  import { writeFileSync as writeFileSync17, unlinkSync as unlinkSync6, mkdirSync as mkdirSync16 } from "node:fs";
20372
- import { join as join15 } from "node:path";
20462
+ import { join as join16 } from "node:path";
20373
20463
  function write(record, dir) {
20374
20464
  const d = dir ?? cclensHome();
20375
20465
  mkdirSync16(d, { recursive: true });
20376
- 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 });
20377
20467
  }
20378
20468
  function writeLastPushSuccess(payload, dir) {
20379
20469
  write({ pushedAt: (/* @__PURE__ */ new Date()).toISOString(), ok: true, payload }, dir);
@@ -20384,7 +20474,7 @@ function writeLastPushFailure(payload, error, dir) {
20384
20474
  function clearLastPush(dir) {
20385
20475
  const d = dir ?? cclensHome();
20386
20476
  try {
20387
- unlinkSync6(join15(d, LAST_PUSH_FILE));
20477
+ unlinkSync6(join16(d, LAST_PUSH_FILE));
20388
20478
  } catch {
20389
20479
  }
20390
20480
  }
@@ -20404,25 +20494,25 @@ __export(file_probe_exports, {
20404
20494
  probeArtifactSignals: () => probeArtifactSignals
20405
20495
  });
20406
20496
  import { createHash } from "node:crypto";
20407
- import { existsSync as existsSync22, readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
20408
- import { homedir as homedir7 } from "node:os";
20409
- 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";
20410
20500
  import { execFileSync as execFileSync3 } from "node:child_process";
20411
20501
  function pathHash(relPath) {
20412
20502
  return createHash("sha256").update(relPath.split(sep).join("/")).digest("hex").slice(0, 32);
20413
20503
  }
20414
20504
  function defaultScanRoots(extraRoots = []) {
20415
20505
  const roots = [];
20416
- const home = join16(homedir7(), ".claude");
20417
- 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" });
20418
20508
  for (const e of extraRoots) {
20419
20509
  const r = resolve3(e, ".claude");
20420
- if (existsSync22(r) && r !== home) roots.push({ root: r, label: "project" });
20510
+ if (existsSync23(r) && r !== home) roots.push({ root: r, label: "project" });
20421
20511
  }
20422
20512
  return roots;
20423
20513
  }
20424
20514
  function listMarkdownFiles(dir) {
20425
- if (!existsSync22(dir)) return [];
20515
+ if (!existsSync23(dir)) return [];
20426
20516
  const out = [];
20427
20517
  let entries2;
20428
20518
  try {
@@ -20432,7 +20522,7 @@ function listMarkdownFiles(dir) {
20432
20522
  }
20433
20523
  for (const name of entries2) {
20434
20524
  if (name.startsWith(".")) continue;
20435
- const full = join16(dir, name);
20525
+ const full = join17(dir, name);
20436
20526
  let stat;
20437
20527
  try {
20438
20528
  stat = statSync7(full);
@@ -20452,7 +20542,7 @@ function firstSeenDateOf(file) {
20452
20542
  const out = execFileSync3(
20453
20543
  "git",
20454
20544
  ["log", "--diff-filter=A", "--follow", "--format=%cs", "--", file],
20455
- { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname18(file) }
20545
+ { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname19(file) }
20456
20546
  ).trim().split("\n").filter(Boolean);
20457
20547
  if (out.length > 0) return out[out.length - 1];
20458
20548
  } catch {
@@ -20464,7 +20554,7 @@ function firstSeenDateOf(file) {
20464
20554
  return todayLocal();
20465
20555
  }
20466
20556
  }
20467
- function dirname18(p) {
20557
+ function dirname19(p) {
20468
20558
  const i = p.lastIndexOf(sep);
20469
20559
  return i < 0 ? "." : p.slice(0, i);
20470
20560
  }
@@ -20491,8 +20581,8 @@ function todayLocal() {
20491
20581
  function scanAuthored(roots, subdir, day2) {
20492
20582
  const out = [];
20493
20583
  for (const r of roots) {
20494
- const dir = join16(r.root, subdir);
20495
- if (!existsSync22(dir)) continue;
20584
+ const dir = join17(r.root, subdir);
20585
+ if (!existsSync23(dir)) continue;
20496
20586
  for (const f of listMarkdownFiles(dir)) {
20497
20587
  const firstSeen = firstSeenDateOf(f);
20498
20588
  if (firstSeen !== day2) continue;
@@ -20505,8 +20595,8 @@ function scanAuthored(roots, subdir, day2) {
20505
20595
  function scanEdited(roots, day2) {
20506
20596
  const out = [];
20507
20597
  for (const r of roots) {
20508
- const dir = join16(r.root, "skills");
20509
- if (!existsSync22(dir)) continue;
20598
+ const dir = join17(r.root, "skills");
20599
+ if (!existsSync23(dir)) continue;
20510
20600
  for (const f of listMarkdownFiles(dir)) {
20511
20601
  const firstSeen = firstSeenDateOf(f);
20512
20602
  if (firstSeen === day2) continue;
@@ -20529,16 +20619,16 @@ function claudemdLineDelta(extraRoots, authorEmail, day2) {
20529
20619
  const candidates = [];
20530
20620
  for (const e of extraRoots) {
20531
20621
  const f = resolve3(e, "CLAUDE.md");
20532
- if (existsSync22(f)) candidates.push(f);
20622
+ if (existsSync23(f)) candidates.push(f);
20533
20623
  }
20534
- const homeClaudeMd = join16(homedir7(), "CLAUDE.md");
20535
- if (existsSync22(homeClaudeMd)) candidates.push(homeClaudeMd);
20624
+ const homeClaudeMd = join17(homedir8(), "CLAUDE.md");
20625
+ if (existsSync23(homeClaudeMd)) candidates.push(homeClaudeMd);
20536
20626
  for (const file of candidates) {
20537
20627
  try {
20538
20628
  const out = execFileSync3(
20539
20629
  "git",
20540
20630
  ["log", "--numstat", "--format=COMMIT %cs %ae", "--", file],
20541
- { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname18(file) }
20631
+ { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname19(file) }
20542
20632
  );
20543
20633
  let currentDate = "";
20544
20634
  let currentEmail = "";
@@ -21554,8 +21644,8 @@ __export(runs_exports, {
21554
21644
  runs: () => runs
21555
21645
  });
21556
21646
  import { execSync as execSync2 } from "node:child_process";
21557
- import { existsSync as existsSync23, readFileSync as readFileSync26, readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
21558
- 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";
21559
21649
  async function runs(args2) {
21560
21650
  const json = args2.includes("--json");
21561
21651
  const watch = args2.includes("--watch");
@@ -21639,7 +21729,7 @@ function listActiveRuns() {
21639
21729
  return runs2.sort((a, b) => a.elapsed_s - b.elapsed_s);
21640
21730
  }
21641
21731
  function readSpend(sinceMs) {
21642
- if (!existsSync23(SPEND_PATH)) return [];
21732
+ if (!existsSync24(SPEND_PATH)) return [];
21643
21733
  const lines = readFileSync26(SPEND_PATH, "utf-8").split("\n").filter((l) => l.trim());
21644
21734
  const out = [];
21645
21735
  for (const line of lines) {
@@ -21761,23 +21851,23 @@ function ageLabel(ms) {
21761
21851
  return `${Math.floor(ms / 864e5)}d`;
21762
21852
  }
21763
21853
  function listTraceFiles() {
21764
- if (!existsSync23(RUNS_DIR2)) return [];
21854
+ if (!existsSync24(RUNS_DIR2)) return [];
21765
21855
  const entries2 = readdirSync6(RUNS_DIR2).filter((f) => f.endsWith(".jsonl"));
21766
21856
  return entries2.map((f) => {
21767
- const path11 = join17(RUNS_DIR2, f);
21857
+ const path11 = join18(RUNS_DIR2, f);
21768
21858
  const st = statSync8(path11);
21769
21859
  return { runId: f.replace(/\.jsonl$/, ""), path: path11, mtimeMs: st.mtimeMs };
21770
21860
  }).sort((a, b) => b.mtimeMs - a.mtimeMs);
21771
21861
  }
21772
21862
  function resolveRunId(arg) {
21773
- if (!existsSync23(RUNS_DIR2)) return null;
21863
+ if (!existsSync24(RUNS_DIR2)) return null;
21774
21864
  if (arg === "latest") {
21775
21865
  const all2 = listTraceFiles();
21776
21866
  if (all2.length === 0) return null;
21777
21867
  return { runId: all2[0].runId, path: all2[0].path };
21778
21868
  }
21779
- const exact = join17(RUNS_DIR2, `${arg}.jsonl`);
21780
- 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 };
21781
21871
  const all = listTraceFiles();
21782
21872
  const matches = all.filter((r) => r.runId.includes(arg));
21783
21873
  if (matches.length === 1) return { runId: matches[0].runId, path: matches[0].path };
@@ -21801,7 +21891,7 @@ async function inspect(arg, follow, json) {
21801
21891
  const r = resolveRunId(arg);
21802
21892
  if (!r) {
21803
21893
  console.error(`run not found: ${arg}`);
21804
- if (existsSync23(RUNS_DIR2)) {
21894
+ if (existsSync24(RUNS_DIR2)) {
21805
21895
  const all = listTraceFiles().slice(0, 5);
21806
21896
  if (all.length > 0) {
21807
21897
  console.error(`
@@ -21981,7 +22071,7 @@ async function main() {
21981
22071
  case "version":
21982
22072
  case "--version":
21983
22073
  case "-v":
21984
- console.log(`fleetlens ${"1.0.1"}`);
22074
+ console.log(`fleetlens ${"1.0.3"}`);
21985
22075
  break;
21986
22076
  case "help":
21987
22077
  case "--help":