fleetlens 1.0.2 → 1.0.4

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 (147) 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.js +2 -2
  12. package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/app/apps/web/.next/server/app/agent/page.js +2 -2
  14. package/app/apps/web/.next/server/app/agent/page_client-reference-manifest.js +1 -1
  15. package/app/apps/web/.next/server/app/api/agent/chats/[id]/events/route.js +3 -1
  16. package/app/apps/web/.next/server/app/api/agent/chats/[id]/events/route.js.nft.json +1 -1
  17. package/app/apps/web/.next/server/app/api/agent/chats/[id]/messages/route.js +1 -1
  18. package/app/apps/web/.next/server/app/api/agent/chats/[id]/messages/route.js.nft.json +1 -1
  19. package/app/apps/web/.next/server/app/api/agent/chats/[id]/route.js +3 -1
  20. package/app/apps/web/.next/server/app/api/agent/chats/[id]/route.js.nft.json +1 -1
  21. package/app/apps/web/.next/server/app/api/agent/chats/[id]/stop/route.js +3 -1
  22. package/app/apps/web/.next/server/app/api/agent/chats/[id]/stop/route.js.nft.json +1 -1
  23. package/app/apps/web/.next/server/app/api/agent/chats/route.js +3 -1
  24. package/app/apps/web/.next/server/app/api/agent/chats/route.js.nft.json +1 -1
  25. package/app/apps/web/.next/server/app/api/agent/index/route.js +1 -1
  26. package/app/apps/web/.next/server/app/api/agent/index/route.js.nft.json +1 -1
  27. package/app/apps/web/.next/server/app/api/agent/mcp/route.js +1 -1
  28. package/app/apps/web/.next/server/app/api/agent/mcp/route.js.nft.json +1 -1
  29. package/app/apps/web/.next/server/app/api/agent/suggestions/route.js +1 -1
  30. package/app/apps/web/.next/server/app/api/agent/suggestions/route.js.nft.json +1 -1
  31. package/app/apps/web/.next/server/app/api/ask/route.js +1 -1
  32. package/app/apps/web/.next/server/app/api/ask/route.js.nft.json +1 -1
  33. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js +1 -1
  34. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js.nft.json +1 -1
  35. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js +1 -1
  36. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js.nft.json +1 -1
  37. package/app/apps/web/.next/server/app/api/digest/month-index/route.js +1 -1
  38. package/app/apps/web/.next/server/app/api/digest/month-index/route.js.nft.json +1 -1
  39. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js +1 -1
  40. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js.nft.json +1 -1
  41. package/app/apps/web/.next/server/app/api/digest/week-index/route.js +1 -1
  42. package/app/apps/web/.next/server/app/api/digest/week-index/route.js.nft.json +1 -1
  43. package/app/apps/web/.next/server/app/api/pdf/[key]/route.js +1 -1
  44. package/app/apps/web/.next/server/app/api/pdf/[key]/route.js.nft.json +1 -1
  45. package/app/apps/web/.next/server/app/api/projects/open-folder/route.js +1 -1
  46. package/app/apps/web/.next/server/app/api/projects/open-folder/route.js.nft.json +1 -1
  47. package/app/apps/web/.next/server/app/api/settings/credentials/route.js +1 -1
  48. package/app/apps/web/.next/server/app/api/settings/credentials/route.js.nft.json +1 -1
  49. package/app/apps/web/.next/server/app/api/settings/route.js +1 -1
  50. package/app/apps/web/.next/server/app/api/settings/route.js.nft.json +1 -1
  51. package/app/apps/web/.next/server/app/api/team/onboarding/start/route.js +1 -1
  52. package/app/apps/web/.next/server/app/api/team/onboarding/start/route.js.nft.json +1 -1
  53. package/app/apps/web/.next/server/app/api/team/sync-projects/route.js +1 -1
  54. package/app/apps/web/.next/server/app/api/team/sync-projects/route.js.nft.json +1 -1
  55. package/app/apps/web/.next/server/app/changelog/page.js +2 -2
  56. package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  57. package/app/apps/web/.next/server/app/day/[date]/page.js +2 -2
  58. package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
  59. package/app/apps/web/.next/server/app/day/page.js +2 -2
  60. package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
  61. package/app/apps/web/.next/server/app/digest/[date]/page.js +2 -2
  62. package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
  63. package/app/apps/web/.next/server/app/digest/page.js +2 -2
  64. package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
  65. package/app/apps/web/.next/server/app/insights/[key]/page.js +2 -2
  66. package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
  67. package/app/apps/web/.next/server/app/insights/page.js +2 -2
  68. package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
  69. package/app/apps/web/.next/server/app/page.js +2 -2
  70. package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  71. package/app/apps/web/.next/server/app/parallelism/page.js +2 -2
  72. package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
  73. package/app/apps/web/.next/server/app/print/[key]/page.js +2 -2
  74. package/app/apps/web/.next/server/app/print/[key]/page_client-reference-manifest.js +1 -1
  75. package/app/apps/web/.next/server/app/projects/[slug]/page.js +2 -2
  76. package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  77. package/app/apps/web/.next/server/app/projects/page.js +2 -2
  78. package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  79. package/app/apps/web/.next/server/app/runs/page.js +2 -2
  80. package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  81. package/app/apps/web/.next/server/app/sessions/[id]/page.js +2 -2
  82. package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  83. package/app/apps/web/.next/server/app/sessions/page.js +2 -2
  84. package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  85. package/app/apps/web/.next/server/app/settings/page.js +2 -2
  86. package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  87. package/app/apps/web/.next/server/app/team/onboarding/page.js +2 -2
  88. package/app/apps/web/.next/server/app/team/onboarding/page_client-reference-manifest.js +1 -1
  89. package/app/apps/web/.next/server/app/team/page.js +2 -2
  90. package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +1 -1
  91. package/app/apps/web/.next/server/app/usage/page.js +2 -2
  92. package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  93. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__038-.1r._.js → [root-of-the-server]__0-09rjv._.js} +2 -2
  94. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0_5tf-2._.js → [root-of-the-server]__01oercw._.js} +5 -5
  95. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02.51sr._.js +1 -1
  96. package/app/apps/web/.next/server/chunks/[root-of-the-server]__057w7kr._.js +28 -0
  97. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0pirsh0._.js → [root-of-the-server]__07b5796._.js} +2 -2
  98. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__02puo0u._.js → [root-of-the-server]__07xaqv3._.js} +2 -2
  99. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__06xto5z._.js → [root-of-the-server]__08c24et._.js} +2 -2
  100. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0mvl0qn._.js → [root-of-the-server]__08m2h38._.js} +2 -2
  101. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0mx_9mb._.js → [root-of-the-server]__0c7ght_._.js} +2 -2
  102. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__12iid50._.js → [root-of-the-server]__0l5i8nk._.js} +2 -2
  103. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__04g-b-m._.js → [root-of-the-server]__0mcer3z._.js} +2 -2
  104. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0o9lsie._.js +30 -0
  105. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0367vbv._.js → [root-of-the-server]__0ozooam._.js} +2 -2
  106. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0uf_ch4._.js +28 -0
  107. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0uiom2m._.js +28 -0
  108. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__096_llw._.js → [root-of-the-server]__0usaajs._.js} +2 -2
  109. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__06irs4z._.js → [root-of-the-server]__0zyh554._.js} +2 -2
  110. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0gvw6dk._.js → [root-of-the-server]__0~4wgaf._.js} +2 -2
  111. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0~~bpcw._.js +3 -0
  112. package/app/apps/web/.next/server/chunks/{[root-of-the-server]__01~cgp8._.js → [root-of-the-server]__10.g-w1._.js} +2 -2
  113. package/app/apps/web/.next/server/chunks/[root-of-the-server]__12vjv4c._.js +28 -0
  114. package/app/apps/web/.next/server/chunks/packages_entries_dist_node_0bckr7-.js +19 -19
  115. package/app/apps/web/.next/server/chunks/packages_parser_dist_06d9se1._.js +1 -1
  116. package/app/apps/web/.next/server/chunks/packages_parser_dist_10ihc3~._.js +1 -1
  117. package/app/apps/web/.next/server/chunks/ssr/_0k8yioi._.js +1 -1
  118. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0n7_p1d._.js +1 -1
  119. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0nb5_-s._.js +1 -1
  120. package/app/apps/web/.next/server/chunks/ssr/packages_parser_dist_0mx_509._.js +1 -1
  121. package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
  122. package/app/apps/web/.next/server/middleware-manifest.json +5 -5
  123. package/app/apps/web/.next/server/pages/500.html +1 -1
  124. package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
  125. package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
  126. package/app/apps/web/.next/static/chunks/0c89~zhm.xoni.js +1 -0
  127. package/app/apps/web/.next/static/chunks/0szn9z03gip~_.js +14 -0
  128. package/app/apps/web/app/api/ask/route.ts +8 -2
  129. package/app/apps/web/lib/agent/run.ts +11 -2
  130. package/app/apps/web/lib/changelog-data.generated.ts +1 -1
  131. package/app/apps/web/package.json +1 -1
  132. package/app/apps/web/tsconfig.tsbuildinfo +1 -1
  133. package/dist/daemon-worker.js +159 -55
  134. package/dist/index.js +229 -113
  135. package/menubar/Fleetlens.app/Contents/Info.plist +2 -2
  136. package/menubar/Fleetlens.app/Contents/MacOS/FleetlensMenubar +0 -0
  137. package/package.json +1 -1
  138. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02faosk._.js +0 -30
  139. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02petpy._.js +0 -3
  140. package/app/apps/web/.next/server/chunks/[root-of-the-server]__09cgmam._.js +0 -28
  141. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0tk8p3d._.js +0 -28
  142. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0u6pamj._.js +0 -28
  143. package/app/apps/web/.next/server/chunks/[root-of-the-server]__12jomao._.js +0 -28
  144. package/app/apps/web/.next/static/chunks/0dqhn7-3.038l.js +0 -14
  145. /package/app/apps/web/.next/static/{zyhoVMC9iNC5vofPFRY6z → Z2JhhQdyMdGTIYOOPolIJ}/_buildManifest.js +0 -0
  146. /package/app/apps/web/.next/static/{zyhoVMC9iNC5vofPFRY6z → Z2JhhQdyMdGTIYOOPolIJ}/_clientMiddlewareManifest.js +0 -0
  147. /package/app/apps/web/.next/static/{zyhoVMC9iNC5vofPFRY6z → Z2JhhQdyMdGTIYOOPolIJ}/_ssgManifest.js +0 -0
@@ -2780,6 +2780,36 @@ function emptyUsage() {
2780
2780
  function previewOf(text) {
2781
2781
  return text.replace(/\s+/g, " ").trim().slice(0, 200);
2782
2782
  }
2783
+ function stripCodexMemCitation(text) {
2784
+ const cut = text.search(/<oai-mem-citation\b/i);
2785
+ return (cut >= 0 ? text.slice(0, cut) : text).trim();
2786
+ }
2787
+ function normalizeCodexAgentBody(text) {
2788
+ return stripCodexMemCitation(text);
2789
+ }
2790
+ function agentEventText(ev) {
2791
+ for (const b of ev.blocks) {
2792
+ if (b?.type === "text" && typeof b.text === "string")
2793
+ return b.text;
2794
+ }
2795
+ return ev.preview ?? "";
2796
+ }
2797
+ function lastAgentEventIndex(events) {
2798
+ for (let i = events.length - 1; i >= 0; i--) {
2799
+ if (events[i].role === "agent")
2800
+ return i;
2801
+ }
2802
+ return -1;
2803
+ }
2804
+ function sameCodexAgentBody(a, b) {
2805
+ const na = normalizeCodexAgentBody(a);
2806
+ const nb = normalizeCodexAgentBody(b);
2807
+ if (!na && !nb)
2808
+ return true;
2809
+ if (!na || !nb)
2810
+ return false;
2811
+ return na === nb;
2812
+ }
2783
2813
  function parseRollout(file, lines) {
2784
2814
  const events = [];
2785
2815
  let firstTimestamp;
@@ -2871,6 +2901,27 @@ function parseRollout(file, lines) {
2871
2901
  if (type === "event_msg" && subtype === "agent_message") {
2872
2902
  const text = typeof payload.message === "string" ? payload.message : "";
2873
2903
  const preview = previewOf(text);
2904
+ const lastIdx = lastAgentEventIndex(events);
2905
+ if (lastIdx >= 0) {
2906
+ const prev = events[lastIdx];
2907
+ if (prev.rawType === "response_item/message" && sameCodexAgentBody(agentEventText(prev), text)) {
2908
+ events[lastIdx] = {
2909
+ ...prev,
2910
+ timestamp: ts ?? prev.timestamp,
2911
+ rawType: "event_msg/agent_message",
2912
+ preview,
2913
+ blocks: text ? [{ type: "text", text }] : [],
2914
+ model,
2915
+ raw: obj
2916
+ };
2917
+ if (text)
2918
+ lastAgentPreview = preview;
2919
+ continue;
2920
+ }
2921
+ if (prev.rawType === "event_msg/agent_message" && sameCodexAgentBody(agentEventText(prev), text)) {
2922
+ continue;
2923
+ }
2924
+ }
2874
2925
  if (text)
2875
2926
  lastAgentPreview = preview;
2876
2927
  events.push({
@@ -2903,6 +2954,10 @@ function parseRollout(file, lines) {
2903
2954
  if (type === "response_item" && subtype === "message" && payload.role === "assistant") {
2904
2955
  const items = payload.content ?? [];
2905
2956
  const text = items.map((c) => typeof c.text === "string" ? c.text : "").join("\n").trim();
2957
+ const lastIdx = lastAgentEventIndex(events);
2958
+ if (lastIdx >= 0 && sameCodexAgentBody(agentEventText(events[lastIdx]), text)) {
2959
+ continue;
2960
+ }
2906
2961
  const preview = previewOf(text);
2907
2962
  if (text)
2908
2963
  lastAgentPreview = preview;
@@ -6863,9 +6918,9 @@ var init_file_probe = __esm({
6863
6918
  // src/pid.ts
6864
6919
  import { readFileSync as readFileSync21, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, unlinkSync as unlinkSync5 } from "node:fs";
6865
6920
  import { execFileSync as execFileSync3 } from "node:child_process";
6866
- import { dirname as dirname12 } from "node:path";
6921
+ import { dirname as dirname13 } from "node:path";
6867
6922
  function writePid(filePath, pid, port, version) {
6868
- mkdirSync14(dirname12(filePath), { recursive: true });
6923
+ mkdirSync14(dirname13(filePath), { recursive: true });
6869
6924
  let content = String(pid);
6870
6925
  if (port != null) {
6871
6926
  content += `:${port}`;
@@ -6929,13 +6984,13 @@ var init_pid = __esm({
6929
6984
 
6930
6985
  // src/server.ts
6931
6986
  import { spawn as spawn3 } from "node:child_process";
6932
- import { join as join13, dirname as dirname13 } from "node:path";
6987
+ import { join as join14, dirname as dirname14 } from "node:path";
6933
6988
  import { fileURLToPath } from "node:url";
6934
- import { existsSync as existsSync19, realpathSync as realpathSync3, readFileSync as readFileSync22 } from "node:fs";
6935
- import { homedir as homedir6 } from "node:os";
6989
+ import { existsSync as existsSync20, realpathSync as realpathSync3, readFileSync as readFileSync22 } from "node:fs";
6990
+ import { homedir as homedir7 } from "node:os";
6936
6991
  function appDir() {
6937
- const here = dirname13(fileURLToPath(import.meta.url));
6938
- return join13(here, "..", "app", "apps", "web");
6992
+ const here = dirname14(fileURLToPath(import.meta.url));
6993
+ return join14(here, "..", "app", "apps", "web");
6939
6994
  }
6940
6995
  function cliBinRealPath() {
6941
6996
  const argv1 = process.argv[1] ?? "";
@@ -6947,11 +7002,11 @@ function cliBinRealPath() {
6947
7002
  }
6948
7003
  function onDiskVersion() {
6949
7004
  try {
6950
- const here = dirname13(fileURLToPath(import.meta.url));
6951
- const pkg = JSON.parse(readFileSync22(join13(here, "..", "package.json"), "utf8"));
6952
- return pkg.version ?? "1.0.2";
7005
+ const here = dirname14(fileURLToPath(import.meta.url));
7006
+ const pkg = JSON.parse(readFileSync22(join14(here, "..", "package.json"), "utf8"));
7007
+ return pkg.version ?? "1.0.4";
6953
7008
  } catch {
6954
- return "1.0.2";
7009
+ return "1.0.4";
6955
7010
  }
6956
7011
  }
6957
7012
  function getServerStatus() {
@@ -6964,15 +7019,15 @@ function getServerStatus() {
6964
7019
  }
6965
7020
  async function startServer(opts = {}) {
6966
7021
  const port = opts.port ?? (parseInt(process.env.CCLENS_PORT ?? "", 10) || DEFAULT_PORT);
6967
- const serverJs = join13(appDir(), "server.js");
6968
- if (!existsSync19(serverJs)) {
7022
+ const serverJs = join14(appDir(), "server.js");
7023
+ if (!existsSync20(serverJs)) {
6969
7024
  throw new Error(`Server not found at ${serverJs}. Reinstall with: npm install -g fleetlens`);
6970
7025
  }
6971
7026
  const portInUse = await checkPort(port);
6972
7027
  if (portInUse) {
6973
7028
  throw new Error(`Port ${port} is in use. Use --port to specify a different port.`);
6974
7029
  }
6975
- const dataDir = join13(homedir6(), ".claude", "projects");
7030
+ const dataDir = join14(homedir7(), ".claude", "projects");
6976
7031
  const child = spawn3(process.execPath, [serverJs], {
6977
7032
  detached: true,
6978
7033
  stdio: "ignore",
@@ -7055,8 +7110,8 @@ var init_server = __esm({
7055
7110
 
7056
7111
  // src/daemon-worker.ts
7057
7112
  import { spawn as spawn4 } from "node:child_process";
7058
- import { closeSync, existsSync as existsSync20, mkdirSync as mkdirSync15, openSync, readFileSync as readFileSync23, writeFileSync as writeFileSync16 } from "node:fs";
7059
- import { dirname as dirname14, join as join14 } from "node:path";
7113
+ import { closeSync, existsSync as existsSync21, mkdirSync as mkdirSync15, openSync, readFileSync as readFileSync23, writeFileSync as writeFileSync16 } from "node:fs";
7114
+ import { dirname as dirname15, join as join15 } from "node:path";
7060
7115
  import { fileURLToPath as fileURLToPath2 } from "node:url";
7061
7116
 
7062
7117
  // src/usage/token.ts
@@ -9304,7 +9359,7 @@ function buildIngestPayload(inputs) {
9304
9359
  return {
9305
9360
  ingestId: randomUUID(),
9306
9361
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
9307
- cliVersion: "1.0.2",
9362
+ cliVersion: "1.0.4",
9308
9363
  ...richRollup || inputs.enrichedExtras || inputs.artifactSignals ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
9309
9364
  ...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
9310
9365
  ...richRollup ? { richRollup } : {},
@@ -14577,14 +14632,56 @@ var ENRICHMENT_SYSTEM_PROMPT = SYSTEM_PROMPT;
14577
14632
  // ../entries/dist/llm-runner.js
14578
14633
  init_fs();
14579
14634
  import { spawn as spawn2 } from "node:child_process";
14580
- import { mkdirSync as mkdirSync11, appendFileSync as appendFileSync5, writeFileSync as writeFileSync12, existsSync as existsSync15 } from "node:fs";
14581
- import { join as join12 } from "node:path";
14635
+ import { mkdirSync as mkdirSync11, appendFileSync as appendFileSync5, writeFileSync as writeFileSync12, existsSync as existsSync16 } from "node:fs";
14636
+ import { join as join13 } from "node:path";
14582
14637
  import { randomUUID as randomUUID4 } from "node:crypto";
14583
14638
 
14584
- // ../entries/dist/tmux-runner.js
14585
- import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync11, existsSync as existsSync14, readdirSync as readdirSync5, realpathSync as realpathSync2, readFileSync as readFileSync17, unlinkSync as unlinkSync3, renameSync as renameSync5 } from "node:fs";
14586
- import { join as join11 } from "node:path";
14639
+ // ../entries/dist/claude-bin.js
14640
+ import { existsSync as existsSync14 } from "node:fs";
14641
+ import { join as join11, dirname as dirname11, delimiter } from "node:path";
14587
14642
  import { homedir as homedir5 } from "node:os";
14643
+ function resolveClaudeBin(opts = {}) {
14644
+ const env = opts.env ?? process.env;
14645
+ const home = opts.home ?? homedir5();
14646
+ const execPath = opts.execPath ?? process.execPath;
14647
+ const exists = opts.exists ?? existsSync14;
14648
+ for (const dir of (env.PATH ?? "").split(delimiter)) {
14649
+ if (!dir)
14650
+ continue;
14651
+ const onPath = join11(dir, "claude");
14652
+ if (exists(onPath))
14653
+ return onPath;
14654
+ }
14655
+ return [
14656
+ join11(home, ".local", "bin", "claude"),
14657
+ // native installer
14658
+ join11(home, ".claude", "local", "claude"),
14659
+ // legacy local install
14660
+ join11(dirname11(execPath), "claude"),
14661
+ // npm -g, beside the node running us
14662
+ "/opt/homebrew/bin/claude",
14663
+ "/usr/local/bin/claude"
14664
+ ].find(exists);
14665
+ }
14666
+ function claudeSpawnEnv(bin, env = process.env, execPath = process.execPath) {
14667
+ const parts = (env.PATH ?? "").split(delimiter).filter(Boolean);
14668
+ for (const dir of [dirname11(execPath), dirname11(bin)]) {
14669
+ if (!parts.includes(dir))
14670
+ parts.unshift(dir);
14671
+ }
14672
+ return { ...env, PATH: parts.join(delimiter) };
14673
+ }
14674
+ var ClaudeBinNotFoundError = class extends Error {
14675
+ constructor() {
14676
+ 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");
14677
+ this.name = "ClaudeBinNotFoundError";
14678
+ }
14679
+ };
14680
+
14681
+ // ../entries/dist/tmux-runner.js
14682
+ import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync11, existsSync as existsSync15, readdirSync as readdirSync5, realpathSync as realpathSync2, readFileSync as readFileSync17, unlinkSync as unlinkSync3, renameSync as renameSync5 } from "node:fs";
14683
+ import { join as join12 } from "node:path";
14684
+ import { homedir as homedir6 } from "node:os";
14588
14685
  import { spawnSync } from "node:child_process";
14589
14686
  var TmuxUnavailableError = class extends Error {
14590
14687
  constructor(message) {
@@ -14607,18 +14704,18 @@ function which(bin) {
14607
14704
  function tmuxRunnerAvailable() {
14608
14705
  if (!which("tmux"))
14609
14706
  return { ok: false, reason: "tmux not on PATH" };
14610
- if (!which("claude"))
14611
- return { ok: false, reason: "claude not on PATH" };
14707
+ if (!resolveClaudeBin())
14708
+ return { ok: false, reason: "claude CLI not found" };
14612
14709
  return { ok: true };
14613
14710
  }
14614
14711
  function runtimeCwd() {
14615
- const dir = join11(homedir5(), ".cclens", "runtime");
14616
- if (!existsSync14(dir))
14712
+ const dir = join12(homedir6(), ".cclens", "runtime");
14713
+ if (!existsSync15(dir))
14617
14714
  mkdirSync10(dir, { recursive: true });
14618
14715
  return realpathSync2(dir);
14619
14716
  }
14620
14717
  function ensureRuntimeCwdTrusted(cwd) {
14621
- const cfgPath = join11(homedir5(), ".claude.json");
14718
+ const cfgPath = join12(homedir6(), ".claude.json");
14622
14719
  let cfg;
14623
14720
  try {
14624
14721
  cfg = JSON.parse(readFileSync17(cfgPath, "utf8"));
@@ -14655,18 +14752,18 @@ async function runClaudeUnderTmuxImpl(args) {
14655
14752
  const tmuxBin = args.tmuxBin ?? which("tmux");
14656
14753
  if (!tmuxBin)
14657
14754
  throw new TmuxUnavailableError("tmux not on PATH");
14658
- const claudeBin = args.claudeBin ?? which("claude");
14755
+ const claudeBin = args.claudeBin ?? resolveClaudeBin();
14659
14756
  if (!claudeBin)
14660
- throw new TmuxUnavailableError("claude not on PATH");
14757
+ throw new TmuxUnavailableError("claude CLI not found");
14661
14758
  if (args.signal?.aborted)
14662
14759
  throw new TmuxRunError("aborted before spawn");
14663
14760
  const cwd = runtimeCwd();
14664
14761
  ensureRuntimeCwdTrusted(cwd);
14665
14762
  const runId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
14666
14763
  const sessionName = `cclens-${runId}`;
14667
- const systemFile = join11(cwd, `system-${runId}.txt`);
14668
- const userFile = join11(cwd, `user-${runId}.txt`);
14669
- const wrapper = join11(cwd, `run-${runId}.sh`);
14764
+ const systemFile = join12(cwd, `system-${runId}.txt`);
14765
+ const userFile = join12(cwd, `user-${runId}.txt`);
14766
+ const wrapper = join12(cwd, `run-${runId}.sh`);
14670
14767
  writeFileSync11(systemFile, args.systemPrompt);
14671
14768
  writeFileSync11(userFile, args.reminder ? `${args.userPrompt}
14672
14769
 
@@ -14745,7 +14842,7 @@ function num(v) {
14745
14842
  function sleep(ms) {
14746
14843
  return new Promise((r) => setTimeout(r, ms));
14747
14844
  }
14748
- var PROJECTS_ROOT = () => join11(homedir5(), ".claude", "projects");
14845
+ var PROJECTS_ROOT = () => join12(homedir6(), ".claude", "projects");
14749
14846
  function snapshotAllTranscripts() {
14750
14847
  const out = /* @__PURE__ */ new Set();
14751
14848
  const root = PROJECTS_ROOT();
@@ -14756,7 +14853,7 @@ function snapshotAllTranscripts() {
14756
14853
  return out;
14757
14854
  }
14758
14855
  for (const sub of subs) {
14759
- const dir = join11(root, sub);
14856
+ const dir = join12(root, sub);
14760
14857
  let files;
14761
14858
  try {
14762
14859
  files = readdirSync5(dir);
@@ -14765,7 +14862,7 @@ function snapshotAllTranscripts() {
14765
14862
  }
14766
14863
  for (const f of files) {
14767
14864
  if (f.endsWith(".jsonl"))
14768
- out.add(join11(dir, f));
14865
+ out.add(join12(dir, f));
14769
14866
  }
14770
14867
  }
14771
14868
  return out;
@@ -14806,7 +14903,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
14806
14903
  subs = [];
14807
14904
  }
14808
14905
  for (const sub of subs) {
14809
- const dir = join11(root, sub);
14906
+ const dir = join12(root, sub);
14810
14907
  let files;
14811
14908
  try {
14812
14909
  files = readdirSync5(dir);
@@ -14816,7 +14913,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
14816
14913
  for (const f of files) {
14817
14914
  if (!f.endsWith(".jsonl"))
14818
14915
  continue;
14819
- const full = join11(dir, f);
14916
+ const full = join12(dir, f);
14820
14917
  if (existingBefore.has(full))
14821
14918
  continue;
14822
14919
  if (readJsonlCwd(full) === targetCwd)
@@ -14890,7 +14987,7 @@ function cleanup(cwd, runId, tmuxBin, sessionName, transcriptPath) {
14890
14987
  }
14891
14988
  for (const f of [`system-${runId}.txt`, `user-${runId}.txt`, `run-${runId}.sh`]) {
14892
14989
  try {
14893
- unlinkSync3(join11(cwd, f));
14990
+ unlinkSync3(join12(cwd, f));
14894
14991
  } catch {
14895
14992
  }
14896
14993
  }
@@ -14905,7 +15002,7 @@ function shellEscape(s) {
14905
15002
  // ../entries/dist/llm-runner.js
14906
15003
  var RUNS_DIR = cclensPath("llm-runs");
14907
15004
  function ensureRunsDir() {
14908
- if (!existsSync15(RUNS_DIR)) {
15005
+ if (!existsSync16(RUNS_DIR)) {
14909
15006
  try {
14910
15007
  mkdirSync11(RUNS_DIR, { recursive: true });
14911
15008
  } catch {
@@ -14934,7 +15031,7 @@ function newRunId(kind) {
14934
15031
  return `${ts}_${kind}_${short}`;
14935
15032
  }
14936
15033
  function tracePath(runId) {
14937
- return join12(RUNS_DIR, `${runId}.jsonl`);
15034
+ return join13(RUNS_DIR, `${runId}.jsonl`);
14938
15035
  }
14939
15036
  function safeAppend(path11, line) {
14940
15037
  try {
@@ -15077,7 +15174,14 @@ function runClaudePrintMode(args) {
15077
15174
  "--append-system-prompt",
15078
15175
  args.systemPrompt
15079
15176
  ];
15080
- const proc = spawn2("claude", claudeArgs, { stdio: ["pipe", "pipe", "pipe"], env: { ...process.env } });
15177
+ const claudeBin = resolveClaudeBin();
15178
+ if (!claudeBin) {
15179
+ const err = new ClaudeBinNotFoundError();
15180
+ safeAppend(trace, JSON.stringify({ _meta: { type: "spawn_error", run_id: runId, ts: (/* @__PURE__ */ new Date()).toISOString(), error: err.message } }) + "\n");
15181
+ reject(err);
15182
+ return;
15183
+ }
15184
+ const proc = spawn2(claudeBin, claudeArgs, { stdio: ["pipe", "pipe", "pipe"], env: claudeSpawnEnv(claudeBin) });
15081
15185
  safeAppend(trace, JSON.stringify({ _meta: { type: "spawned", run_id: runId, pid: proc.pid } }) + "\n");
15082
15186
  const stdinPayload = args.reminder ? `${args.userPrompt}
15083
15187
 
@@ -15333,8 +15437,8 @@ function applyEnrichmentError(entry, errorMessage, model, costUsd, generatedAt,
15333
15437
 
15334
15438
  // ../entries/dist/budget.js
15335
15439
  init_fs();
15336
- import { appendFileSync as appendFileSync6, readFileSync as readFileSync18, existsSync as existsSync16, mkdirSync as mkdirSync12 } from "node:fs";
15337
- import { dirname as dirname11 } from "node:path";
15440
+ import { appendFileSync as appendFileSync6, readFileSync as readFileSync18, existsSync as existsSync17, mkdirSync as mkdirSync12 } from "node:fs";
15441
+ import { dirname as dirname12 } from "node:path";
15338
15442
  var spendPathCached = null;
15339
15443
  function spendPath() {
15340
15444
  if (spendPathCached)
@@ -15344,12 +15448,12 @@ function spendPath() {
15344
15448
  }
15345
15449
  function appendSpend(record) {
15346
15450
  const p = spendPath();
15347
- mkdirSync12(dirname11(p), { recursive: true });
15451
+ mkdirSync12(dirname12(p), { recursive: true });
15348
15452
  appendFileSync6(p, JSON.stringify(record) + "\n", { encoding: "utf8" });
15349
15453
  }
15350
15454
  function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
15351
15455
  const p = spendPath();
15352
- if (!existsSync16(p))
15456
+ if (!existsSync17(p))
15353
15457
  return 0;
15354
15458
  const year = now.getUTCFullYear();
15355
15459
  const month = now.getUTCMonth();
@@ -15376,7 +15480,7 @@ function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
15376
15480
 
15377
15481
  // ../entries/dist/pipeline-lock.js
15378
15482
  init_fs();
15379
- import { writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, existsSync as existsSync17, readFileSync as readFileSync19, statSync as statSync7 } from "node:fs";
15483
+ import { writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, existsSync as existsSync18, readFileSync as readFileSync19, statSync as statSync7 } from "node:fs";
15380
15484
  var STALE_MS2 = 60 * 1e3;
15381
15485
  var HEARTBEAT_MS = 30 * 1e3;
15382
15486
  var lockPathCached = null;
@@ -15422,7 +15526,7 @@ function pidAlive(pid) {
15422
15526
  }
15423
15527
  function interactiveLockFresh(nowMs) {
15424
15528
  const p = lockPath();
15425
- if (!existsSync17(p))
15529
+ if (!existsSync18(p))
15426
15530
  return false;
15427
15531
  try {
15428
15532
  const mtime = statSync7(p).mtimeMs;
@@ -15443,7 +15547,7 @@ function interactiveLockFresh(nowMs) {
15443
15547
  var THIRTY_MIN_MS = 30 * 60 * 1e3;
15444
15548
 
15445
15549
  // ../entries/dist/settings.js
15446
- import { readFileSync as readFileSync20, writeFileSync as writeFileSync14, renameSync as renameSync6, chmodSync as chmodSync2, mkdirSync as mkdirSync13, existsSync as existsSync18 } from "node:fs";
15550
+ import { readFileSync as readFileSync20, writeFileSync as writeFileSync14, renameSync as renameSync6, chmodSync as chmodSync2, mkdirSync as mkdirSync13, existsSync as existsSync19 } from "node:fs";
15447
15551
  init_fs();
15448
15552
  var DEFAULT_SETTINGS = {
15449
15553
  ai_features: {
@@ -15475,7 +15579,7 @@ function fromDisk(d) {
15475
15579
  }
15476
15580
  function readSettings() {
15477
15581
  const p = settingsPath();
15478
- if (!existsSync18(p))
15582
+ if (!existsSync19(p))
15479
15583
  return DEFAULT_SETTINGS;
15480
15584
  try {
15481
15585
  const raw = readFileSync20(p, "utf8");
@@ -18238,14 +18342,14 @@ async function getUpdateAvailability() {
18238
18342
  if (isDevMode()) return null;
18239
18343
  const latest = await fetchLatestVersion();
18240
18344
  if (latest === null) return {
18241
- current: "1.0.2",
18345
+ current: "1.0.4",
18242
18346
  latest: null,
18243
18347
  updateAvailable: false
18244
18348
  };
18245
18349
  return {
18246
- current: "1.0.2",
18350
+ current: "1.0.4",
18247
18351
  latest,
18248
- updateAvailable: shouldUpdate("1.0.2", latest)
18352
+ updateAvailable: shouldUpdate("1.0.4", latest)
18249
18353
  };
18250
18354
  }
18251
18355
 
@@ -18297,7 +18401,7 @@ var WATCHDOG_INTERVAL_MS = 5 * 1e3;
18297
18401
  var AUTO_UPDATE_INTERVAL_MS = 6 * 60 * 60 * 1e3;
18298
18402
  var SERVER_HEALTH_INTERVAL_MS = 60 * 1e3;
18299
18403
  var SERVER_HEALTH_TIMEOUT_MS = 10 * 1e3;
18300
- mkdirSync15(dirname14(USAGE_LOG3), { recursive: true });
18404
+ mkdirSync15(dirname15(USAGE_LOG3), { recursive: true });
18301
18405
  function log2(level, message) {
18302
18406
  appendDaemonLogLine(level, message);
18303
18407
  }
@@ -18357,7 +18461,7 @@ function nextUpdateCheckFromState(nowMs) {
18357
18461
  }
18358
18462
  var nextUpdateCheckAtMs = nextUpdateCheckFromState(Date.now());
18359
18463
  function cliEntryPath() {
18360
- return join14(dirname14(fileURLToPath2(import.meta.url)), "index.js");
18464
+ return join15(dirname15(fileURLToPath2(import.meta.url)), "index.js");
18361
18465
  }
18362
18466
  async function runDaemonUpdateCheck() {
18363
18467
  if (process.env.FLEETLENS_DAEMON_AUTO_UPDATE === "0") {
@@ -18389,7 +18493,7 @@ async function runDaemonUpdateCheck() {
18389
18493
  return;
18390
18494
  }
18391
18495
  const entry = cliEntryPath();
18392
- if (!existsSync20(entry)) {
18496
+ if (!existsSync21(entry)) {
18393
18497
  log2("warn", `update check found ${availability.latest}, but CLI entry is missing at ${entry}`);
18394
18498
  return;
18395
18499
  }