fleetlens 0.10.4 → 0.10.6

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 (179) 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 +6 -6
  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/page/build-manifest.json +3 -3
  7. package/app/apps/web/.next/server/app/_global-error.html +1 -1
  8. package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
  9. package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  10. package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/app/apps/web/.next/server/app/_not-found/page/build-manifest.json +3 -3
  15. package/app/apps/web/.next/server/app/_not-found/page.js +1 -1
  16. package/app/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/app/apps/web/.next/server/app/api/ask/route.js +3 -2
  19. package/app/apps/web/.next/server/app/api/ask/route.js.nft.json +1 -1
  20. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js +2 -1
  21. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js.nft.json +1 -1
  22. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js +2 -1
  23. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js.nft.json +1 -1
  24. package/app/apps/web/.next/server/app/api/digest/month-index/route.js +2 -1
  25. package/app/apps/web/.next/server/app/api/digest/month-index/route.js.nft.json +1 -1
  26. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js +2 -1
  27. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js.nft.json +1 -1
  28. package/app/apps/web/.next/server/app/api/digest/week-index/route.js +2 -1
  29. package/app/apps/web/.next/server/app/api/digest/week-index/route.js.nft.json +1 -1
  30. package/app/apps/web/.next/server/app/api/events/route.js +2 -1
  31. package/app/apps/web/.next/server/app/api/events/route.js.nft.json +1 -1
  32. package/app/apps/web/.next/server/app/api/jobs/route.js +2 -1
  33. package/app/apps/web/.next/server/app/api/jobs/route.js.nft.json +1 -1
  34. package/app/apps/web/.next/server/app/api/runs/[runId]/route.js +2 -1
  35. package/app/apps/web/.next/server/app/api/runs/[runId]/route.js.nft.json +1 -1
  36. package/app/apps/web/.next/server/app/api/runs/[runId]/stream/route.js +2 -1
  37. package/app/apps/web/.next/server/app/api/runs/[runId]/stream/route.js.nft.json +1 -1
  38. package/app/apps/web/.next/server/app/api/runs/route.js +2 -1
  39. package/app/apps/web/.next/server/app/api/runs/route.js.nft.json +1 -1
  40. package/app/apps/web/.next/server/app/api/settings/route.js +3 -2
  41. package/app/apps/web/.next/server/app/api/settings/route.js.nft.json +1 -1
  42. package/app/apps/web/.next/server/app/api/team/sync/route/app-paths-manifest.json +3 -0
  43. package/app/apps/web/.next/server/app/api/team/sync/route/build-manifest.json +9 -0
  44. package/app/apps/web/.next/server/app/api/team/sync/route/server-reference-manifest.json +4 -0
  45. package/app/apps/web/.next/server/app/api/team/sync/route.js +6 -0
  46. package/app/apps/web/.next/server/app/api/team/sync/route.js.map +5 -0
  47. package/app/apps/web/.next/server/app/api/team/sync/route.js.nft.json +1 -0
  48. package/app/apps/web/.next/server/app/api/team/sync/route_client-reference-manifest.js +3 -0
  49. package/app/apps/web/.next/server/app/changelog/page/build-manifest.json +3 -3
  50. package/app/apps/web/.next/server/app/changelog/page.js +1 -1
  51. package/app/apps/web/.next/server/app/changelog/page.js.nft.json +1 -1
  52. package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  53. package/app/apps/web/.next/server/app/day/[date]/page/build-manifest.json +3 -3
  54. package/app/apps/web/.next/server/app/day/[date]/page.js +1 -1
  55. package/app/apps/web/.next/server/app/day/[date]/page.js.nft.json +1 -1
  56. package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
  57. package/app/apps/web/.next/server/app/day/page/build-manifest.json +3 -3
  58. package/app/apps/web/.next/server/app/day/page.js +1 -1
  59. package/app/apps/web/.next/server/app/day/page.js.nft.json +1 -1
  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/build-manifest.json +3 -3
  62. package/app/apps/web/.next/server/app/digest/[date]/page.js +1 -1
  63. package/app/apps/web/.next/server/app/digest/[date]/page.js.nft.json +1 -1
  64. package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
  65. package/app/apps/web/.next/server/app/digest/page/build-manifest.json +3 -3
  66. package/app/apps/web/.next/server/app/digest/page.js +1 -1
  67. package/app/apps/web/.next/server/app/digest/page.js.nft.json +1 -1
  68. package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
  69. package/app/apps/web/.next/server/app/insights/[key]/page/build-manifest.json +3 -3
  70. package/app/apps/web/.next/server/app/insights/[key]/page.js +1 -1
  71. package/app/apps/web/.next/server/app/insights/[key]/page.js.nft.json +1 -1
  72. package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
  73. package/app/apps/web/.next/server/app/insights/page/build-manifest.json +3 -3
  74. package/app/apps/web/.next/server/app/insights/page.js +1 -1
  75. package/app/apps/web/.next/server/app/insights/page.js.nft.json +1 -1
  76. package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
  77. package/app/apps/web/.next/server/app/page/build-manifest.json +3 -3
  78. package/app/apps/web/.next/server/app/page.js +4 -3
  79. package/app/apps/web/.next/server/app/page.js.nft.json +1 -1
  80. package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  81. package/app/apps/web/.next/server/app/parallelism/page/build-manifest.json +3 -3
  82. package/app/apps/web/.next/server/app/parallelism/page.js +1 -1
  83. package/app/apps/web/.next/server/app/parallelism/page.js.nft.json +1 -1
  84. package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
  85. package/app/apps/web/.next/server/app/projects/[slug]/page/build-manifest.json +3 -3
  86. package/app/apps/web/.next/server/app/projects/[slug]/page.js +1 -1
  87. package/app/apps/web/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
  88. package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  89. package/app/apps/web/.next/server/app/projects/page/build-manifest.json +3 -3
  90. package/app/apps/web/.next/server/app/projects/page.js +1 -1
  91. package/app/apps/web/.next/server/app/projects/page.js.nft.json +1 -1
  92. package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  93. package/app/apps/web/.next/server/app/runs/page/build-manifest.json +3 -3
  94. package/app/apps/web/.next/server/app/runs/page.js +1 -1
  95. package/app/apps/web/.next/server/app/runs/page.js.nft.json +1 -1
  96. package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  97. package/app/apps/web/.next/server/app/sessions/[id]/page/build-manifest.json +3 -3
  98. package/app/apps/web/.next/server/app/sessions/[id]/page.js +1 -1
  99. package/app/apps/web/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
  100. package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  101. package/app/apps/web/.next/server/app/sessions/page/build-manifest.json +3 -3
  102. package/app/apps/web/.next/server/app/sessions/page.js +1 -1
  103. package/app/apps/web/.next/server/app/sessions/page.js.nft.json +1 -1
  104. package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  105. package/app/apps/web/.next/server/app/settings/page/build-manifest.json +3 -3
  106. package/app/apps/web/.next/server/app/settings/page.js +2 -2
  107. package/app/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
  108. package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  109. package/app/apps/web/.next/server/app/usage/page/build-manifest.json +3 -3
  110. package/app/apps/web/.next/server/app/usage/page.js +1 -1
  111. package/app/apps/web/.next/server/app/usage/page.js.nft.json +1 -1
  112. package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  113. package/app/apps/web/.next/server/app-paths-manifest.json +1 -0
  114. package/app/apps/web/.next/server/chunks/[root-of-the-server]__01a7b5j._.js +3 -0
  115. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0455vu3._.js +2 -2
  116. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0op9af~._.js +3 -0
  117. package/app/apps/web/.next/server/chunks/apps_web__next-internal_server_app_api_team_sync_route_actions_05yi-i~.js +3 -0
  118. package/app/apps/web/.next/server/chunks/packages_parser_dist_04rh1zd._.js +3 -0
  119. package/app/apps/web/.next/server/chunks/packages_parser_dist_0ndsxe6._.js +3 -0
  120. package/app/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__0yv-a8z._.js → [root-of-the-server]__08l86e-._.js} +2 -2
  121. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__09yxy53._.js +3 -0
  122. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__100.ck7._.js +3 -0
  123. package/app/apps/web/.next/server/chunks/ssr/_0xu2pvc._.js +1 -1
  124. package/app/apps/web/.next/server/chunks/ssr/apps_web_0.mu7c7._.js +3 -0
  125. package/app/apps/web/.next/server/chunks/ssr/{apps_web_app_settings_ai-features-form_tsx_01p699p._.js → apps_web_app_settings_0u6z6rj._.js} +2 -2
  126. package/app/apps/web/.next/server/chunks/ssr/{apps_web_components_0xs658s._.js → apps_web_components_0c-tpft._.js} +2 -2
  127. package/app/apps/web/.next/server/chunks/ssr/apps_web_components_0txtsv5._.js +1 -1
  128. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_0af94gl._.js +3 -0
  129. package/app/apps/web/.next/server/chunks/ssr/node_modules_0yrkyef._.js +3 -0
  130. package/app/apps/web/.next/server/chunks/ssr/packages_parser_dist_12.endt._.js +1 -1
  131. package/app/apps/web/.next/server/functions-config-manifest.json +1 -0
  132. package/app/apps/web/.next/server/middleware-build-manifest.js +6 -6
  133. package/app/apps/web/.next/server/pages/500.html +1 -1
  134. package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
  135. package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
  136. package/app/apps/web/.next/static/chunks/0-9zfeumkln-p.js +1 -0
  137. package/app/apps/web/.next/static/chunks/0bjcz5~ugoonp.js +14 -0
  138. package/app/apps/web/.next/static/chunks/0e-wrhqh4h3r5.js +2 -0
  139. package/app/apps/web/.next/static/chunks/0h.ua.-myj.6z.js +1 -0
  140. package/app/apps/web/.next/static/chunks/0h3.-_s-k0mj3.js +31 -0
  141. package/app/apps/web/.next/static/chunks/0o5m5g1dfx4ev.css +1 -0
  142. package/app/apps/web/.next/static/chunks/{0mc8aa8z.0-5l.js → 13po66tt.68f3.js} +2 -2
  143. package/app/apps/web/.next/static/chunks/{turbopack-00w.w1u3c~d-6.js → turbopack-04ud5x25hbc_4.js} +1 -1
  144. package/app/apps/web/app/api/events/route.ts +21 -12
  145. package/app/apps/web/app/api/team/sync/route.ts +92 -0
  146. package/app/apps/web/app/layout.tsx +3 -0
  147. package/app/apps/web/app/page.tsx +6 -0
  148. package/app/apps/web/app/settings/force-sync-button.tsx +73 -0
  149. package/app/apps/web/app/settings/page.tsx +4 -0
  150. package/app/apps/web/app/settings/team-connection-section.tsx +127 -0
  151. package/app/apps/web/components/live-refresher.tsx +5 -2
  152. package/app/apps/web/components/sidebar.tsx +6 -0
  153. package/app/apps/web/components/team-chip.tsx +107 -0
  154. package/app/apps/web/components/team-welcome-banner.tsx +71 -0
  155. package/app/apps/web/lib/changelog-data.generated.ts +1 -1
  156. package/app/apps/web/lib/team-data.test.ts +116 -0
  157. package/app/apps/web/lib/team-data.ts +68 -0
  158. package/app/apps/web/lib/team-health.test.ts +24 -0
  159. package/app/apps/web/lib/team-health.ts +18 -0
  160. package/app/apps/web/lib/use-live-events.ts +11 -2
  161. package/app/apps/web/package.json +1 -1
  162. package/app/apps/web/tsconfig.tsbuildinfo +1 -1
  163. package/dist/daemon-worker.js +148 -98
  164. package/dist/index.js +205 -144
  165. package/package.json +1 -1
  166. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02px2mk._.js +0 -3
  167. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0vm_41a._.js +0 -3
  168. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0.za3_3._.js +0 -3
  169. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0wwa6gh._.js +0 -3
  170. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_0m67-xi._.js +0 -3
  171. package/app/apps/web/.next/server/chunks/ssr/node_modules_0fx6-.x._.js +0 -3
  172. package/app/apps/web/.next/static/chunks/0257pdz1-imal.js +0 -2
  173. package/app/apps/web/.next/static/chunks/04a36uhu~p_z-.css +0 -1
  174. package/app/apps/web/.next/static/chunks/08nun7x9h-ro1.js +0 -14
  175. package/app/apps/web/.next/static/chunks/0kjot8367asxe.js +0 -31
  176. package/app/apps/web/.next/static/chunks/0n3-prt61k7pr.js +0 -1
  177. /package/app/apps/web/.next/static/{_8He0IMRxt70EDQL1JOFe → VquuqMXKjRSN6LfR7rRSz}/_buildManifest.js +0 -0
  178. /package/app/apps/web/.next/static/{_8He0IMRxt70EDQL1JOFe → VquuqMXKjRSN6LfR7rRSz}/_clientMiddlewareManifest.js +0 -0
  179. /package/app/apps/web/.next/static/{_8He0IMRxt70EDQL1JOFe → VquuqMXKjRSN6LfR7rRSz}/_ssgManifest.js +0 -0
package/dist/index.js CHANGED
@@ -2990,6 +2990,38 @@ var init_gemini = __esm({
2990
2990
  }
2991
2991
  });
2992
2992
 
2993
+ // ../parser/dist/team-config.js
2994
+ import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, unlinkSync as unlinkSync2, mkdirSync as mkdirSync2 } from "node:fs";
2995
+ import { join } from "node:path";
2996
+ function readTeamConfig(dir) {
2997
+ const d = dir ?? cclensHome();
2998
+ try {
2999
+ return JSON.parse(readFileSync2(join(d, CONFIG_FILE), "utf8"));
3000
+ } catch {
3001
+ return null;
3002
+ }
3003
+ }
3004
+ function writeTeamConfig(config, dir) {
3005
+ const d = dir ?? cclensHome();
3006
+ mkdirSync2(d, { recursive: true });
3007
+ writeFileSync2(join(d, CONFIG_FILE), JSON.stringify(config, null, 2), { mode: 384 });
3008
+ }
3009
+ function clearTeamConfig(dir) {
3010
+ const d = dir ?? cclensHome();
3011
+ try {
3012
+ unlinkSync2(join(d, CONFIG_FILE));
3013
+ } catch {
3014
+ }
3015
+ }
3016
+ var CONFIG_FILE;
3017
+ var init_team_config = __esm({
3018
+ "../parser/dist/team-config.js"() {
3019
+ "use strict";
3020
+ init_fs();
3021
+ CONFIG_FILE = "team.json";
3022
+ }
3023
+ });
3024
+
2993
3025
  // ../parser/dist/fs.js
2994
3026
  var fs_exports = {};
2995
3027
  __export(fs_exports, {
@@ -3002,6 +3034,7 @@ __export(fs_exports, {
3002
3034
  cclensHome: () => cclensHome,
3003
3035
  cclensPath: () => cclensPath,
3004
3036
  clearCaches: () => clearCaches,
3037
+ clearTeamConfig: () => clearTeamConfig,
3005
3038
  codexSessionLocalDay: () => codexSessionLocalDay,
3006
3039
  decodeProjectName: () => decodeProjectName,
3007
3040
  findTeamLead: () => findTeamLead,
@@ -3025,8 +3058,10 @@ __export(fs_exports, {
3025
3058
  loadTeamForSession: () => loadTeamForSession,
3026
3059
  loadUsageByDay: () => loadUsageByDay,
3027
3060
  readJsonlFile: () => readJsonlFile,
3061
+ readTeamConfig: () => readTeamConfig,
3028
3062
  sessionIdFromFileName: () => sessionIdFromFileName,
3029
- walkJsonlFiles: () => walkJsonlFiles
3063
+ walkJsonlFiles: () => walkJsonlFiles,
3064
+ writeTeamConfig: () => writeTeamConfig
3030
3065
  });
3031
3066
  import { promises as fs4 } from "node:fs";
3032
3067
  import os4 from "node:os";
@@ -3291,6 +3326,7 @@ var init_fs = __esm({
3291
3326
  init_claude_code();
3292
3327
  init_codex();
3293
3328
  init_gemini();
3329
+ init_team_config();
3294
3330
  codexSource = {
3295
3331
  ...CODEX_METADATA,
3296
3332
  defaultRoot: DEFAULT_CODEX_ROOT,
@@ -3335,13 +3371,13 @@ __export(server_exports, {
3335
3371
  stopServer: () => stopServer
3336
3372
  });
3337
3373
  import { spawn } from "node:child_process";
3338
- import { join, dirname as dirname2 } from "node:path";
3374
+ import { join as join2, dirname as dirname2 } from "node:path";
3339
3375
  import { fileURLToPath } from "node:url";
3340
3376
  import { existsSync } from "node:fs";
3341
3377
  import { homedir } from "node:os";
3342
3378
  function appDir() {
3343
3379
  const here = dirname2(fileURLToPath(import.meta.url));
3344
- return join(here, "..", "app", "apps", "web");
3380
+ return join2(here, "..", "app", "apps", "web");
3345
3381
  }
3346
3382
  function getServerStatus() {
3347
3383
  cleanStalePid(PID_FILE);
@@ -3353,7 +3389,7 @@ function getServerStatus() {
3353
3389
  }
3354
3390
  async function startServer(opts = {}) {
3355
3391
  const port = opts.port ?? (parseInt(process.env.CCLENS_PORT ?? "", 10) || DEFAULT_PORT);
3356
- const serverJs = join(appDir(), "server.js");
3392
+ const serverJs = join2(appDir(), "server.js");
3357
3393
  if (!existsSync(serverJs)) {
3358
3394
  throw new Error(`Server not found at ${serverJs}. Reinstall with: npm install -g fleetlens`);
3359
3395
  }
@@ -3361,7 +3397,7 @@ async function startServer(opts = {}) {
3361
3397
  if (portInUse) {
3362
3398
  throw new Error(`Port ${port} is in use. Use --port to specify a different port.`);
3363
3399
  }
3364
- const dataDir = join(homedir(), ".claude", "projects");
3400
+ const dataDir = join2(homedir(), ".claude", "projects");
3365
3401
  const child = spawn(process.execPath, [serverJs], {
3366
3402
  detached: true,
3367
3403
  stdio: "ignore",
@@ -3369,7 +3405,8 @@ async function startServer(opts = {}) {
3369
3405
  ...process.env,
3370
3406
  PORT: String(port),
3371
3407
  HOSTNAME: "localhost",
3372
- CCLENS_DATA_DIR: dataDir
3408
+ CCLENS_DATA_DIR: dataDir,
3409
+ FLEETLENS_CLI_BIN: process.argv[1]
3373
3410
  },
3374
3411
  cwd: appDir()
3375
3412
  });
@@ -3431,15 +3468,15 @@ var init_server = __esm({
3431
3468
  });
3432
3469
 
3433
3470
  // src/usage/storage.ts
3434
- import { appendFileSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, existsSync as existsSync2 } from "node:fs";
3471
+ import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync3, existsSync as existsSync2 } from "node:fs";
3435
3472
  import { dirname as dirname3 } from "node:path";
3436
3473
  function appendSnapshot(filePath, snapshot) {
3437
- mkdirSync2(dirname3(filePath), { recursive: true });
3474
+ mkdirSync3(dirname3(filePath), { recursive: true });
3438
3475
  appendFileSync(filePath, JSON.stringify(snapshot) + "\n", "utf8");
3439
3476
  }
3440
3477
  function readSnapshots(filePath) {
3441
3478
  if (!existsSync2(filePath)) return [];
3442
- const content = readFileSync2(filePath, "utf8");
3479
+ const content = readFileSync3(filePath, "utf8");
3443
3480
  const snapshots = [];
3444
3481
  for (const line of content.split("\n")) {
3445
3482
  if (!line.trim()) continue;
@@ -3477,9 +3514,9 @@ __export(daemon_exports, {
3477
3514
  stopDaemonSilent: () => stopDaemonSilent
3478
3515
  });
3479
3516
  import { spawn as spawn2 } from "node:child_process";
3480
- import { join as join2, dirname as dirname4 } from "node:path";
3517
+ import { join as join3, dirname as dirname4 } from "node:path";
3481
3518
  import { fileURLToPath as fileURLToPath2 } from "node:url";
3482
- import { existsSync as existsSync3, statSync, readFileSync as readFileSync3 } from "node:fs";
3519
+ import { existsSync as existsSync3, statSync, readFileSync as readFileSync4 } from "node:fs";
3483
3520
  function startDaemonSilent() {
3484
3521
  cleanStalePid(DAEMON_PID);
3485
3522
  const existing = readPid(DAEMON_PID);
@@ -3532,7 +3569,7 @@ function getDaemonStatusInfo() {
3532
3569
  }
3533
3570
  function workerPath() {
3534
3571
  const here = dirname4(fileURLToPath2(import.meta.url));
3535
- return join2(here, "daemon-worker.js");
3572
+ return join3(here, "daemon-worker.js");
3536
3573
  }
3537
3574
  async function daemon(args2) {
3538
3575
  const sub = args2[0] ?? "status";
@@ -3601,7 +3638,7 @@ function daemonLogs() {
3601
3638
  console.log("No daemon logs yet.");
3602
3639
  return;
3603
3640
  }
3604
- const content = readFileSync3(DAEMON_LOG, "utf8");
3641
+ const content = readFileSync4(DAEMON_LOG, "utf8");
3605
3642
  const lines = content.trim().split("\n").slice(-20);
3606
3643
  for (const line of lines) process.stdout.write(line + "\n");
3607
3644
  }
@@ -3620,8 +3657,8 @@ var init_daemon = __esm({
3620
3657
 
3621
3658
  // src/updater.ts
3622
3659
  import { execSync, spawnSync } from "node:child_process";
3623
- import { existsSync as existsSync4, readFileSync as readFileSync4, realpathSync } from "node:fs";
3624
- import { dirname as dirname5, join as join3 } from "node:path";
3660
+ import { existsSync as existsSync4, readFileSync as readFileSync5, realpathSync } from "node:fs";
3661
+ import { dirname as dirname5, join as join4 } from "node:path";
3625
3662
  function shouldUpdate(local, remote) {
3626
3663
  const l = local.split(".").map(Number);
3627
3664
  const r = remote.split(".").map(Number);
@@ -3663,15 +3700,15 @@ function verifyInstalledVersion() {
3663
3700
  encoding: "utf8",
3664
3701
  timeout: 5e3
3665
3702
  }).trim();
3666
- const pkgPath = join3(globalRoot, PACKAGE_NAME, "package.json");
3667
- const pkg = JSON.parse(readFileSync4(pkgPath, "utf8"));
3703
+ const pkgPath = join4(globalRoot, PACKAGE_NAME, "package.json");
3704
+ const pkg = JSON.parse(readFileSync5(pkgPath, "utf8"));
3668
3705
  if (!pkg.version) {
3669
3706
  return { ok: false, reason: `no version field in ${pkgPath}` };
3670
3707
  }
3671
3708
  return {
3672
3709
  ok: true,
3673
3710
  installedVersion: pkg.version,
3674
- installedPath: join3(globalRoot, PACKAGE_NAME)
3711
+ installedPath: join4(globalRoot, PACKAGE_NAME)
3675
3712
  };
3676
3713
  } catch (err) {
3677
3714
  return { ok: false, reason: err.message };
@@ -3728,9 +3765,9 @@ Installed: ${PACKAGE_NAME}@${verify.installedVersion} at ${verify.installedPath
3728
3765
  console.warn(
3729
3766
  ` \u2022 reinstall in the correct Node env: 'npm install -g ${PACKAGE_NAME}@latest'`
3730
3767
  );
3731
- } else if (verify.installedVersion !== "0.10.4") {
3768
+ } else if (verify.installedVersion !== "0.10.6") {
3732
3769
  console.log(
3733
- ` \u2192 This process is still running ${"0.10.4"}. Next invocation will use ${verify.installedVersion}.`
3770
+ ` \u2192 This process is still running ${"0.10.6"}. Next invocation will use ${verify.installedVersion}.`
3734
3771
  );
3735
3772
  }
3736
3773
  }
@@ -3748,7 +3785,7 @@ function reExec() {
3748
3785
  const verify = verifyInstalledVersion();
3749
3786
  let script = process.argv[1] ?? "";
3750
3787
  if (verify.ok) {
3751
- const candidate = join3(verify.installedPath, "dist", "index.js");
3788
+ const candidate = join4(verify.installedPath, "dist", "index.js");
3752
3789
  if (existsSync4(candidate)) script = candidate;
3753
3790
  }
3754
3791
  const result = spawnSync(process.argv[0], [script, ...process.argv.slice(2)], {
@@ -3765,14 +3802,14 @@ async function getUpdateAvailability() {
3765
3802
  if (isDevMode()) return null;
3766
3803
  const latest = await fetchLatestVersion();
3767
3804
  if (latest === null) return {
3768
- current: "0.10.4",
3805
+ current: "0.10.6",
3769
3806
  latest: null,
3770
3807
  updateAvailable: false
3771
3808
  };
3772
3809
  return {
3773
- current: "0.10.4",
3810
+ current: "0.10.6",
3774
3811
  latest,
3775
- updateAvailable: shouldUpdate("0.10.4", latest)
3812
+ updateAvailable: shouldUpdate("0.10.6", latest)
3776
3813
  };
3777
3814
  }
3778
3815
  async function checkForUpdate() {
@@ -3862,7 +3899,7 @@ async function restartServices(state) {
3862
3899
  }
3863
3900
  async function forceUpdate() {
3864
3901
  const latest = await fetchLatestVersion();
3865
- const current = "0.10.4";
3902
+ const current = "0.10.6";
3866
3903
  if (latest === null) {
3867
3904
  console.error("Could not reach npm registry. Check your network.");
3868
3905
  process.exit(1);
@@ -4078,9 +4115,9 @@ var init_update = __esm({
4078
4115
 
4079
4116
  // src/usage/token.ts
4080
4117
  import { execFileSync } from "node:child_process";
4081
- import { readFileSync as readFileSync5 } from "node:fs";
4118
+ import { readFileSync as readFileSync6 } from "node:fs";
4082
4119
  import { homedir as homedir2, platform } from "node:os";
4083
- import { join as join4 } from "node:path";
4120
+ import { join as join5 } from "node:path";
4084
4121
  function readOAuthCredentials() {
4085
4122
  if (platform() === "darwin") {
4086
4123
  return readFromMacKeychain() ?? readFromCredentialsFile();
@@ -4101,12 +4138,12 @@ function readFromMacKeychain() {
4101
4138
  }
4102
4139
  function readFromCredentialsFile() {
4103
4140
  const candidates = [
4104
- join4(homedir2(), ".claude", ".credentials.json"),
4105
- join4(homedir2(), ".config", "claude", "credentials.json")
4141
+ join5(homedir2(), ".claude", ".credentials.json"),
4142
+ join5(homedir2(), ".config", "claude", "credentials.json")
4106
4143
  ];
4107
4144
  for (const path5 of candidates) {
4108
4145
  try {
4109
- const blob = readFileSync5(path5, "utf8");
4146
+ const blob = readFileSync6(path5, "utf8");
4110
4147
  const creds = extractCredentials(blob);
4111
4148
  if (creds) return creds;
4112
4149
  } catch {
@@ -5316,8 +5353,8 @@ var init_dist2 = __esm({
5316
5353
  });
5317
5354
 
5318
5355
  // ../entries/dist/digest-fs.js
5319
- import { readFileSync as readFileSync6, readdirSync, writeFileSync as writeFileSync2, renameSync, chmodSync, mkdirSync as mkdirSync3, existsSync as existsSync5 } from "node:fs";
5320
- import { dirname as dirname6, join as join5 } from "node:path";
5356
+ import { readFileSync as readFileSync7, readdirSync, writeFileSync as writeFileSync3, renameSync, chmodSync, mkdirSync as mkdirSync4, existsSync as existsSync5 } from "node:fs";
5357
+ import { dirname as dirname6, join as join6 } from "node:path";
5321
5358
  function digestsDir() {
5322
5359
  if (digestsDirCached)
5323
5360
  return digestsDirCached;
@@ -5327,24 +5364,24 @@ function digestsDir() {
5327
5364
  }
5328
5365
  function __setDigestsDirForTest(path5) {
5329
5366
  digestsDirCached = path5;
5330
- mkdirSync3(join5(path5, "day"), { recursive: true });
5331
- mkdirSync3(join5(path5, "week"), { recursive: true });
5332
- mkdirSync3(join5(path5, "month"), { recursive: true });
5367
+ mkdirSync4(join6(path5, "day"), { recursive: true });
5368
+ mkdirSync4(join6(path5, "week"), { recursive: true });
5369
+ mkdirSync4(join6(path5, "month"), { recursive: true });
5333
5370
  }
5334
5371
  function dayDigestPath(date) {
5335
- return join5(digestsDir(), "day", `${date}.json`);
5372
+ return join6(digestsDir(), "day", `${date}.json`);
5336
5373
  }
5337
5374
  function weekDigestPath(monday) {
5338
- return join5(digestsDir(), "week", `${monday}.json`);
5375
+ return join6(digestsDir(), "week", `${monday}.json`);
5339
5376
  }
5340
5377
  function monthDigestPath(yearMonth) {
5341
- return join5(digestsDir(), "month", `${yearMonth}.json`);
5378
+ return join6(digestsDir(), "month", `${yearMonth}.json`);
5342
5379
  }
5343
5380
  function writeDayDigest(digest2) {
5344
5381
  const final = dayDigestPath(digest2.key);
5345
- mkdirSync3(dirname6(final), { recursive: true });
5382
+ mkdirSync4(dirname6(final), { recursive: true });
5346
5383
  const tmp = `${final}.tmp`;
5347
- writeFileSync2(tmp, JSON.stringify(digest2, null, 2), "utf8");
5384
+ writeFileSync3(tmp, JSON.stringify(digest2, null, 2), "utf8");
5348
5385
  if (process.platform !== "win32") {
5349
5386
  try {
5350
5387
  chmodSync(tmp, 384);
@@ -5358,7 +5395,7 @@ function readDayDigest(date) {
5358
5395
  if (!existsSync5(p))
5359
5396
  return null;
5360
5397
  try {
5361
- return JSON.parse(readFileSync6(p, "utf8"));
5398
+ return JSON.parse(readFileSync7(p, "utf8"));
5362
5399
  } catch {
5363
5400
  return null;
5364
5401
  }
@@ -5382,9 +5419,9 @@ function __clearTodayCacheForTest() {
5382
5419
  }
5383
5420
  function writeWeekDigest(digest2) {
5384
5421
  const final = weekDigestPath(digest2.key);
5385
- mkdirSync3(dirname6(final), { recursive: true });
5422
+ mkdirSync4(dirname6(final), { recursive: true });
5386
5423
  const tmp = `${final}.tmp`;
5387
- writeFileSync2(tmp, JSON.stringify(digest2, null, 2), "utf8");
5424
+ writeFileSync3(tmp, JSON.stringify(digest2, null, 2), "utf8");
5388
5425
  if (process.platform !== "win32") {
5389
5426
  try {
5390
5427
  chmodSync(tmp, 384);
@@ -5398,13 +5435,13 @@ function readWeekDigest(monday) {
5398
5435
  if (!existsSync5(p))
5399
5436
  return null;
5400
5437
  try {
5401
- return JSON.parse(readFileSync6(p, "utf8"));
5438
+ return JSON.parse(readFileSync7(p, "utf8"));
5402
5439
  } catch {
5403
5440
  return null;
5404
5441
  }
5405
5442
  }
5406
5443
  function listWeekDigestKeys() {
5407
- const dir = join5(digestsDir(), "week");
5444
+ const dir = join6(digestsDir(), "week");
5408
5445
  if (!existsSync5(dir))
5409
5446
  return [];
5410
5447
  return readdirSync(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length)).filter((k) => /^\d{4}-\d{2}-\d{2}$/.test(k));
@@ -5423,9 +5460,9 @@ function setCurrentWeekDigestInCache(monday, digest2, nowMs) {
5423
5460
  }
5424
5461
  function writeMonthDigest(digest2) {
5425
5462
  const final = monthDigestPath(digest2.key);
5426
- mkdirSync3(dirname6(final), { recursive: true });
5463
+ mkdirSync4(dirname6(final), { recursive: true });
5427
5464
  const tmp = `${final}.tmp`;
5428
- writeFileSync2(tmp, JSON.stringify(digest2, null, 2), "utf8");
5465
+ writeFileSync3(tmp, JSON.stringify(digest2, null, 2), "utf8");
5429
5466
  if (process.platform !== "win32") {
5430
5467
  try {
5431
5468
  chmodSync(tmp, 384);
@@ -5439,13 +5476,13 @@ function readMonthDigest(yearMonth) {
5439
5476
  if (!existsSync5(p))
5440
5477
  return null;
5441
5478
  try {
5442
- return JSON.parse(readFileSync6(p, "utf8"));
5479
+ return JSON.parse(readFileSync7(p, "utf8"));
5443
5480
  } catch {
5444
5481
  return null;
5445
5482
  }
5446
5483
  }
5447
5484
  function listMonthDigestKeys() {
5448
- const dir = join5(digestsDir(), "month");
5485
+ const dir = join6(digestsDir(), "month");
5449
5486
  if (!existsSync5(dir))
5450
5487
  return [];
5451
5488
  return readdirSync(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length)).filter((k) => /^\d{4}-\d{2}$/.test(k));
@@ -5506,9 +5543,9 @@ __export(fs_exports2, {
5506
5543
  writeMonthDigest: () => writeMonthDigest,
5507
5544
  writeWeekDigest: () => writeWeekDigest
5508
5545
  });
5509
- import { readFileSync as readFileSync7, readdirSync as readdirSync2, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, renameSync as renameSync2, existsSync as existsSync6 } from "node:fs";
5546
+ import { readFileSync as readFileSync8, readdirSync as readdirSync2, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, renameSync as renameSync2, existsSync as existsSync6 } from "node:fs";
5510
5547
  import { randomBytes } from "node:crypto";
5511
- import { join as join6 } from "node:path";
5548
+ import { join as join7 } from "node:path";
5512
5549
  function entriesDir() {
5513
5550
  if (entriesDirCached)
5514
5551
  return entriesDirCached;
@@ -5518,21 +5555,21 @@ function entriesDir() {
5518
5555
  }
5519
5556
  function __setEntriesDirForTest(path5) {
5520
5557
  entriesDirCached = path5;
5521
- mkdirSync4(path5, { recursive: true });
5558
+ mkdirSync5(path5, { recursive: true });
5522
5559
  }
5523
5560
  function pathFor(sessionId, localDay) {
5524
- return join6(entriesDir(), `${entryKey(sessionId, localDay)}.json`);
5561
+ return join7(entriesDir(), `${entryKey(sessionId, localDay)}.json`);
5525
5562
  }
5526
5563
  function tmpPathFor(final) {
5527
5564
  return `${final}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
5528
5565
  }
5529
5566
  function writeEntry(entry) {
5530
5567
  const dir = entriesDir();
5531
- mkdirSync4(dir, { recursive: true });
5568
+ mkdirSync5(dir, { recursive: true });
5532
5569
  const final = pathFor(entry.session_id, entry.local_day);
5533
5570
  const tmp = tmpPathFor(final);
5534
5571
  const json = JSON.stringify(entry, null, 2);
5535
- writeFileSync3(tmp, json, { encoding: "utf8" });
5572
+ writeFileSync4(tmp, json, { encoding: "utf8" });
5536
5573
  renameSync2(tmp, final);
5537
5574
  }
5538
5575
  function enrichmentInputHash(e) {
@@ -5552,7 +5589,7 @@ function enrichmentInputHash(e) {
5552
5589
  }
5553
5590
  function writeEntryPreservingEnrichment(fresh) {
5554
5591
  const dir = entriesDir();
5555
- mkdirSync4(dir, { recursive: true });
5592
+ mkdirSync5(dir, { recursive: true });
5556
5593
  const final = pathFor(fresh.session_id, fresh.local_day);
5557
5594
  const existing = readEntry(fresh.session_id, fresh.local_day);
5558
5595
  let toWrite = fresh;
@@ -5560,14 +5597,14 @@ function writeEntryPreservingEnrichment(fresh) {
5560
5597
  toWrite = { ...fresh, enrichment: existing.enrichment };
5561
5598
  }
5562
5599
  const tmp = tmpPathFor(final);
5563
- writeFileSync3(tmp, JSON.stringify(toWrite, null, 2), { encoding: "utf8" });
5600
+ writeFileSync4(tmp, JSON.stringify(toWrite, null, 2), { encoding: "utf8" });
5564
5601
  renameSync2(tmp, final);
5565
5602
  }
5566
5603
  function readEntry(sessionId, localDay) {
5567
5604
  const p = pathFor(sessionId, localDay);
5568
5605
  if (!existsSync6(p))
5569
5606
  return null;
5570
- const raw = readFileSync7(p, "utf8");
5607
+ const raw = readFileSync8(p, "utf8");
5571
5608
  return JSON.parse(raw);
5572
5609
  }
5573
5610
  function listEntryKeys() {
@@ -9851,8 +9888,8 @@ RESPOND WITH ONLY VALID JSON (no prose, no code fence):
9851
9888
  });
9852
9889
 
9853
9890
  // ../entries/dist/tmux-runner.js
9854
- import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync4, existsSync as existsSync7, readdirSync as readdirSync3, realpathSync as realpathSync2, readFileSync as readFileSync8, unlinkSync as unlinkSync2, renameSync as renameSync3 } from "node:fs";
9855
- import { join as join7 } from "node:path";
9891
+ import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync5, existsSync as existsSync7, readdirSync as readdirSync3, realpathSync as realpathSync2, readFileSync as readFileSync9, unlinkSync as unlinkSync3, renameSync as renameSync3 } from "node:fs";
9892
+ import { join as join8 } from "node:path";
9856
9893
  import { homedir as homedir3 } from "node:os";
9857
9894
  import { spawnSync as spawnSync2 } from "node:child_process";
9858
9895
  function which(bin) {
@@ -9869,16 +9906,16 @@ function tmuxRunnerAvailable() {
9869
9906
  return { ok: true };
9870
9907
  }
9871
9908
  function runtimeCwd() {
9872
- const dir = join7(homedir3(), ".cclens", "runtime");
9909
+ const dir = join8(homedir3(), ".cclens", "runtime");
9873
9910
  if (!existsSync7(dir))
9874
- mkdirSync5(dir, { recursive: true });
9911
+ mkdirSync6(dir, { recursive: true });
9875
9912
  return realpathSync2(dir);
9876
9913
  }
9877
9914
  function ensureRuntimeCwdTrusted(cwd) {
9878
- const cfgPath = join7(homedir3(), ".claude.json");
9915
+ const cfgPath = join8(homedir3(), ".claude.json");
9879
9916
  let cfg;
9880
9917
  try {
9881
- cfg = JSON.parse(readFileSync8(cfgPath, "utf8"));
9918
+ cfg = JSON.parse(readFileSync9(cfgPath, "utf8"));
9882
9919
  } catch {
9883
9920
  return;
9884
9921
  }
@@ -9893,11 +9930,11 @@ function ensureRuntimeCwdTrusted(cwd) {
9893
9930
  cfg.projects = projects;
9894
9931
  const tmp = `${cfgPath}.cclens-tmp-${process.pid}`;
9895
9932
  try {
9896
- writeFileSync4(tmp, JSON.stringify(cfg, null, 2));
9933
+ writeFileSync5(tmp, JSON.stringify(cfg, null, 2));
9897
9934
  renameSync3(tmp, cfgPath);
9898
9935
  } catch {
9899
9936
  try {
9900
- unlinkSync2(tmp);
9937
+ unlinkSync3(tmp);
9901
9938
  } catch {
9902
9939
  }
9903
9940
  }
@@ -9920,16 +9957,16 @@ async function runClaudeUnderTmuxImpl(args2) {
9920
9957
  ensureRuntimeCwdTrusted(cwd);
9921
9958
  const runId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
9922
9959
  const sessionName = `cclens-${runId}`;
9923
- const systemFile = join7(cwd, `system-${runId}.txt`);
9924
- const userFile = join7(cwd, `user-${runId}.txt`);
9925
- const wrapper = join7(cwd, `run-${runId}.sh`);
9926
- writeFileSync4(systemFile, args2.systemPrompt);
9927
- writeFileSync4(userFile, args2.reminder ? `${args2.userPrompt}
9960
+ const systemFile = join8(cwd, `system-${runId}.txt`);
9961
+ const userFile = join8(cwd, `user-${runId}.txt`);
9962
+ const wrapper = join8(cwd, `run-${runId}.sh`);
9963
+ writeFileSync5(systemFile, args2.systemPrompt);
9964
+ writeFileSync5(userFile, args2.reminder ? `${args2.userPrompt}
9928
9965
 
9929
9966
  ---
9930
9967
 
9931
9968
  ${args2.reminder}` : args2.userPrompt);
9932
- writeFileSync4(wrapper, `#!/bin/bash
9969
+ writeFileSync5(wrapper, `#!/bin/bash
9933
9970
  SYS="$(cat ${shellEscape(systemFile)})"
9934
9971
  USR="$(cat ${shellEscape(userFile)})"
9935
9972
  exec ${shellEscape(claudeBin)} \\
@@ -10011,7 +10048,7 @@ function snapshotAllTranscripts() {
10011
10048
  return out;
10012
10049
  }
10013
10050
  for (const sub of subs) {
10014
- const dir = join7(root, sub);
10051
+ const dir = join8(root, sub);
10015
10052
  let files;
10016
10053
  try {
10017
10054
  files = readdirSync3(dir);
@@ -10020,7 +10057,7 @@ function snapshotAllTranscripts() {
10020
10057
  }
10021
10058
  for (const f of files) {
10022
10059
  if (f.endsWith(".jsonl"))
10023
- out.add(join7(dir, f));
10060
+ out.add(join8(dir, f));
10024
10061
  }
10025
10062
  }
10026
10063
  return out;
@@ -10028,7 +10065,7 @@ function snapshotAllTranscripts() {
10028
10065
  function readJsonlCwd(path5, maxLines = 8) {
10029
10066
  let raw;
10030
10067
  try {
10031
- raw = readFileSync8(path5, "utf8");
10068
+ raw = readFileSync9(path5, "utf8");
10032
10069
  } catch {
10033
10070
  return void 0;
10034
10071
  }
@@ -10061,7 +10098,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
10061
10098
  subs = [];
10062
10099
  }
10063
10100
  for (const sub of subs) {
10064
- const dir = join7(root, sub);
10101
+ const dir = join8(root, sub);
10065
10102
  let files;
10066
10103
  try {
10067
10104
  files = readdirSync3(dir);
@@ -10071,7 +10108,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
10071
10108
  for (const f of files) {
10072
10109
  if (!f.endsWith(".jsonl"))
10073
10110
  continue;
10074
- const full = join7(dir, f);
10111
+ const full = join8(dir, f);
10075
10112
  if (existingBefore.has(full))
10076
10113
  continue;
10077
10114
  if (readJsonlCwd(full) === targetCwd)
@@ -10085,7 +10122,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
10085
10122
  function parseTranscript2(path5, defaultModel) {
10086
10123
  let raw;
10087
10124
  try {
10088
- raw = readFileSync8(path5, "utf8");
10125
+ raw = readFileSync9(path5, "utf8");
10089
10126
  } catch {
10090
10127
  return { assembled: "", inputTokens: 0, outputTokens: 0, modelUsed: defaultModel, done: false };
10091
10128
  }
@@ -10139,13 +10176,13 @@ function cleanup(cwd, runId, tmuxBin, sessionName, transcriptPath) {
10139
10176
  if (process.env.FLEETLENS_TMUX_KEEP_WRAPPER !== "1") {
10140
10177
  if (transcriptPath) {
10141
10178
  try {
10142
- unlinkSync2(transcriptPath);
10179
+ unlinkSync3(transcriptPath);
10143
10180
  } catch {
10144
10181
  }
10145
10182
  }
10146
10183
  for (const f of [`system-${runId}.txt`, `user-${runId}.txt`, `run-${runId}.sh`]) {
10147
10184
  try {
10148
- unlinkSync2(join7(cwd, f));
10185
+ unlinkSync3(join8(cwd, f));
10149
10186
  } catch {
10150
10187
  }
10151
10188
  }
@@ -10173,19 +10210,19 @@ var init_tmux_runner = __esm({
10173
10210
  }
10174
10211
  };
10175
10212
  mutex = Promise.resolve();
10176
- PROJECTS_ROOT = () => join7(homedir3(), ".claude", "projects");
10213
+ PROJECTS_ROOT = () => join8(homedir3(), ".claude", "projects");
10177
10214
  }
10178
10215
  });
10179
10216
 
10180
10217
  // ../entries/dist/llm-runner.js
10181
10218
  import { spawn as spawn3 } from "node:child_process";
10182
- import { mkdirSync as mkdirSync6, appendFileSync as appendFileSync2, writeFileSync as writeFileSync5, existsSync as existsSync8 } from "node:fs";
10183
- import { join as join8 } from "node:path";
10219
+ import { mkdirSync as mkdirSync7, appendFileSync as appendFileSync2, writeFileSync as writeFileSync6, existsSync as existsSync8 } from "node:fs";
10220
+ import { join as join9 } from "node:path";
10184
10221
  import { randomUUID } from "node:crypto";
10185
10222
  function ensureRunsDir() {
10186
10223
  if (!existsSync8(RUNS_DIR)) {
10187
10224
  try {
10188
- mkdirSync6(RUNS_DIR, { recursive: true });
10225
+ mkdirSync7(RUNS_DIR, { recursive: true });
10189
10226
  } catch {
10190
10227
  }
10191
10228
  }
@@ -10212,7 +10249,7 @@ function newRunId(kind) {
10212
10249
  return `${ts}_${kind}_${short}`;
10213
10250
  }
10214
10251
  function tracePath(runId) {
10215
- return join8(RUNS_DIR, `${runId}.jsonl`);
10252
+ return join9(RUNS_DIR, `${runId}.jsonl`);
10216
10253
  }
10217
10254
  function safeAppend(path5, line) {
10218
10255
  try {
@@ -10222,7 +10259,7 @@ function safeAppend(path5, line) {
10222
10259
  }
10223
10260
  function safeWrite(path5, line) {
10224
10261
  try {
10225
- writeFileSync5(path5, line);
10262
+ writeFileSync6(path5, line);
10226
10263
  } catch {
10227
10264
  }
10228
10265
  }
@@ -10628,7 +10665,7 @@ var init_enrich2 = __esm({
10628
10665
  });
10629
10666
 
10630
10667
  // ../entries/dist/budget.js
10631
- import { appendFileSync as appendFileSync3, readFileSync as readFileSync9, existsSync as existsSync9, mkdirSync as mkdirSync7 } from "node:fs";
10668
+ import { appendFileSync as appendFileSync3, readFileSync as readFileSync10, existsSync as existsSync9, mkdirSync as mkdirSync8 } from "node:fs";
10632
10669
  import { dirname as dirname7 } from "node:path";
10633
10670
  function spendPath() {
10634
10671
  if (spendPathCached)
@@ -10641,7 +10678,7 @@ function __setSpendPathForTest(path5) {
10641
10678
  }
10642
10679
  function appendSpend(record) {
10643
10680
  const p = spendPath();
10644
- mkdirSync7(dirname7(p), { recursive: true });
10681
+ mkdirSync8(dirname7(p), { recursive: true });
10645
10682
  appendFileSync3(p, JSON.stringify(record) + "\n", { encoding: "utf8" });
10646
10683
  }
10647
10684
  function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
@@ -10651,7 +10688,7 @@ function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
10651
10688
  const year = now.getUTCFullYear();
10652
10689
  const month2 = now.getUTCMonth();
10653
10690
  let total = 0;
10654
- const raw = readFileSync9(p, "utf8");
10691
+ const raw = readFileSync10(p, "utf8");
10655
10692
  for (const line of raw.split("\n")) {
10656
10693
  if (!line)
10657
10694
  continue;
@@ -10680,7 +10717,7 @@ var init_budget = __esm({
10680
10717
  });
10681
10718
 
10682
10719
  // ../entries/dist/pipeline-lock.js
10683
- import { writeFileSync as writeFileSync6, unlinkSync as unlinkSync3, existsSync as existsSync10, readFileSync as readFileSync10, statSync as statSync2 } from "node:fs";
10720
+ import { writeFileSync as writeFileSync7, unlinkSync as unlinkSync4, existsSync as existsSync10, readFileSync as readFileSync11, statSync as statSync2 } from "node:fs";
10684
10721
  function lockPath() {
10685
10722
  if (lockPathCached)
10686
10723
  return lockPathCached;
@@ -10691,7 +10728,7 @@ function __setInteractiveLockPathForTest(path5) {
10691
10728
  lockPathCached = path5;
10692
10729
  }
10693
10730
  function touchLock() {
10694
- writeFileSync6(lockPath(), String(process.pid), "utf8");
10731
+ writeFileSync7(lockPath(), String(process.pid), "utf8");
10695
10732
  }
10696
10733
  function writeInteractiveLock() {
10697
10734
  touchLock();
@@ -10711,7 +10748,7 @@ function removeInteractiveLock() {
10711
10748
  heartbeat = null;
10712
10749
  }
10713
10750
  try {
10714
- unlinkSync3(lockPath());
10751
+ unlinkSync4(lockPath());
10715
10752
  } catch {
10716
10753
  }
10717
10754
  }
@@ -10731,7 +10768,7 @@ function interactiveLockFresh(nowMs) {
10731
10768
  const mtime = statSync2(p).mtimeMs;
10732
10769
  if (nowMs - mtime > STALE_MS)
10733
10770
  return false;
10734
- const pid = Number(readFileSync10(p, "utf8").trim());
10771
+ const pid = Number(readFileSync11(p, "utf8").trim());
10735
10772
  if (!Number.isFinite(pid) || pid <= 0)
10736
10773
  return false;
10737
10774
  if (!pidAlive(pid))
@@ -10837,7 +10874,7 @@ var init_queue = __esm({
10837
10874
  });
10838
10875
 
10839
10876
  // ../entries/dist/settings.js
10840
- import { readFileSync as readFileSync11, writeFileSync as writeFileSync7, renameSync as renameSync4, chmodSync as chmodSync2, mkdirSync as mkdirSync8, existsSync as existsSync11 } from "node:fs";
10877
+ import { readFileSync as readFileSync12, writeFileSync as writeFileSync8, renameSync as renameSync4, chmodSync as chmodSync2, mkdirSync as mkdirSync9, existsSync as existsSync11 } from "node:fs";
10841
10878
  import { dirname as dirname8 } from "node:path";
10842
10879
  function settingsPath() {
10843
10880
  if (settingsPathCached)
@@ -10876,7 +10913,7 @@ function readSettings() {
10876
10913
  if (!existsSync11(p))
10877
10914
  return DEFAULT_SETTINGS;
10878
10915
  try {
10879
- const raw = readFileSync11(p, "utf8");
10916
+ const raw = readFileSync12(p, "utf8");
10880
10917
  return fromDisk(JSON.parse(raw));
10881
10918
  } catch {
10882
10919
  return DEFAULT_SETTINGS;
@@ -10884,9 +10921,9 @@ function readSettings() {
10884
10921
  }
10885
10922
  function writeSettings(s) {
10886
10923
  const p = settingsPath();
10887
- mkdirSync8(dirname8(p), { recursive: true });
10924
+ mkdirSync9(dirname8(p), { recursive: true });
10888
10925
  const tmp = `${p}.tmp`;
10889
- writeFileSync7(tmp, JSON.stringify(toDisk(s), null, 2), { encoding: "utf8" });
10926
+ writeFileSync8(tmp, JSON.stringify(toDisk(s), null, 2), { encoding: "utf8" });
10890
10927
  if (process.platform !== "win32") {
10891
10928
  chmodSync2(tmp, 384);
10892
10929
  }
@@ -14615,34 +14652,10 @@ var init_digest = __esm({
14615
14652
  });
14616
14653
 
14617
14654
  // src/team/config.ts
14618
- import { readFileSync as readFileSync12, writeFileSync as writeFileSync8, unlinkSync as unlinkSync4, mkdirSync as mkdirSync9 } from "node:fs";
14619
- import { join as join9 } from "node:path";
14620
- function readTeamConfig(dir) {
14621
- const d = dir ?? cclensHome();
14622
- try {
14623
- return JSON.parse(readFileSync12(join9(d, CONFIG_FILE), "utf8"));
14624
- } catch {
14625
- return null;
14626
- }
14627
- }
14628
- function writeTeamConfig(config, dir) {
14629
- const d = dir ?? cclensHome();
14630
- mkdirSync9(d, { recursive: true });
14631
- writeFileSync8(join9(d, CONFIG_FILE), JSON.stringify(config, null, 2), { mode: 384 });
14632
- }
14633
- function clearTeamConfig(dir) {
14634
- const d = dir ?? cclensHome();
14635
- try {
14636
- unlinkSync4(join9(d, CONFIG_FILE));
14637
- } catch {
14638
- }
14639
- }
14640
- var CONFIG_FILE;
14641
14655
  var init_config = __esm({
14642
14656
  "src/team/config.ts"() {
14643
14657
  "use strict";
14644
14658
  init_fs();
14645
- CONFIG_FILE = "team.json";
14646
14659
  }
14647
14660
  });
14648
14661
 
@@ -14867,6 +14880,7 @@ var init_profile = __esm({
14867
14880
  });
14868
14881
 
14869
14882
  // src/team/backfill.ts
14883
+ import { randomUUID as randomUUID3 } from "node:crypto";
14870
14884
  function rawToWire(raw) {
14871
14885
  const win = (w) => w ? { utilization: w.utilization, resetsAt: w.resets_at } : null;
14872
14886
  return {
@@ -14892,23 +14906,26 @@ function chunk(items, size) {
14892
14906
  return out;
14893
14907
  }
14894
14908
  async function postBatch(config, snapshots, planTier) {
14895
- const res = await fetch(`${config.serverUrl}/api/ingest/usage-history`, {
14896
- method: "POST",
14897
- signal: AbortSignal.timeout(POST_TIMEOUT_MS2),
14898
- headers: {
14899
- "Content-Type": "application/json",
14900
- Authorization: `Bearer ${config.bearerToken}`
14901
- },
14902
- body: JSON.stringify({ snapshots, ...planTier ? { planTier } : {} })
14903
- });
14904
- if (!res.ok) {
14905
- return { inserted: 0, skipped: snapshots.length, status: res.status };
14909
+ const payload = {
14910
+ ingestId: `backfill-${randomUUID3()}`,
14911
+ observedAt: (/* @__PURE__ */ new Date()).toISOString(),
14912
+ snapshotHistory: snapshots,
14913
+ ...planTier ? { planTier } : {}
14914
+ };
14915
+ const result = await pushToTeamServer(config, payload);
14916
+ if (!result.ok) {
14917
+ return { inserted: 0, skipped: snapshots.length, status: result.status };
14918
+ }
14919
+ const body = result.body;
14920
+ if (!body?.snapshotHistory) {
14921
+ throw new Error(
14922
+ "team server accepted snapshotHistory but did not return a result block \u2014 older image, upgrade required"
14923
+ );
14906
14924
  }
14907
- const body = await res.json().catch(() => ({}));
14908
14925
  return {
14909
- inserted: body.inserted ?? 0,
14910
- skipped: body.skipped ?? 0,
14911
- status: res.status
14926
+ inserted: body.snapshotHistory.inserted ?? 0,
14927
+ skipped: body.snapshotHistory.skipped ?? 0,
14928
+ status: result.status
14912
14929
  };
14913
14930
  }
14914
14931
  function isAfterSince(snapshot, sinceCapturedAt) {
@@ -14995,23 +15012,53 @@ async function runTeamBackfill(log = noopLog, filePath = USAGE_LOG3, configOverr
14995
15012
  lastSnapshotAt
14996
15013
  };
14997
15014
  }
14998
- var USAGE_LOG3, PROFILE_CACHE, BATCH_SIZE, POST_TIMEOUT_MS2, noopLog;
15015
+ var USAGE_LOG3, PROFILE_CACHE, BATCH_SIZE, noopLog;
14999
15016
  var init_backfill = __esm({
15000
15017
  "src/team/backfill.ts"() {
15001
15018
  "use strict";
15002
15019
  init_storage();
15003
15020
  init_config();
15021
+ init_push();
15004
15022
  init_profile();
15005
15023
  init_fs();
15006
15024
  USAGE_LOG3 = cclensPath("usage.jsonl");
15007
15025
  PROFILE_CACHE = cclensPath("profile.json");
15008
15026
  BATCH_SIZE = 500;
15009
- POST_TIMEOUT_MS2 = 15e3;
15010
15027
  noopLog = () => {
15011
15028
  };
15012
15029
  }
15013
15030
  });
15014
15031
 
15032
+ // src/team/last-push.ts
15033
+ import { writeFileSync as writeFileSync11, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "node:fs";
15034
+ import { join as join10 } from "node:path";
15035
+ function write(record, dir) {
15036
+ const d = dir ?? cclensHome();
15037
+ mkdirSync12(d, { recursive: true });
15038
+ writeFileSync11(join10(d, LAST_PUSH_FILE), JSON.stringify(record, null, 2), { mode: 384 });
15039
+ }
15040
+ function writeLastPushSuccess(payload, dir) {
15041
+ write({ pushedAt: (/* @__PURE__ */ new Date()).toISOString(), ok: true, payload }, dir);
15042
+ }
15043
+ function writeLastPushFailure(payload, error, dir) {
15044
+ write({ pushedAt: (/* @__PURE__ */ new Date()).toISOString(), ok: false, payload, error }, dir);
15045
+ }
15046
+ function clearLastPush(dir) {
15047
+ const d = dir ?? cclensHome();
15048
+ try {
15049
+ unlinkSync5(join10(d, LAST_PUSH_FILE));
15050
+ } catch {
15051
+ }
15052
+ }
15053
+ var LAST_PUSH_FILE;
15054
+ var init_last_push = __esm({
15055
+ "src/team/last-push.ts"() {
15056
+ "use strict";
15057
+ init_fs();
15058
+ LAST_PUSH_FILE = "team-last-push.json";
15059
+ }
15060
+ });
15061
+
15015
15062
  // src/team/sync.ts
15016
15063
  var sync_exports = {};
15017
15064
  __export(sync_exports, {
@@ -15049,10 +15096,13 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
15049
15096
  const payload = buildIngestPayload(void 0, usageSnapshot, planTier, cyclePeaks);
15050
15097
  const result = await pushToTeamServer(config, payload);
15051
15098
  if (!result.ok) {
15052
- log("warn", `team push (live-only) failed (${result.status}); queueing`);
15099
+ const errLine = `team push failed (${result.status})`;
15100
+ log("warn", `${errLine}; queueing`);
15101
+ writeLastPushFailure(payload, errLine);
15053
15102
  enqueuePayload(payload);
15054
15103
  return { paired: true, pushed: 0, queued: 1, queuedDrained: 0, usageBackfill };
15055
15104
  }
15105
+ writeLastPushSuccess(payload);
15056
15106
  let queuedDrained2 = 0;
15057
15107
  const backlog = dequeuePayloads();
15058
15108
  for (let i = 0; i < backlog.length; i++) {
@@ -15083,12 +15133,15 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
15083
15133
  );
15084
15134
  const result = await pushToTeamServer(config, payload);
15085
15135
  if (!result.ok) {
15086
- log("warn", `team push failed on ${rollup.day} (${result.status}); queueing`);
15136
+ const errLine = `team push failed on ${rollup.day} (${result.status})`;
15137
+ log("warn", `${errLine}; queueing`);
15138
+ writeLastPushFailure(payload, errLine);
15087
15139
  enqueuePayload(payload);
15088
15140
  queued++;
15089
15141
  failedDay = rollup.day;
15090
15142
  break;
15091
15143
  }
15144
+ writeLastPushSuccess(payload);
15092
15145
  pushed++;
15093
15146
  lastPushedDay = rollup.day;
15094
15147
  }
@@ -15116,6 +15169,10 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
15116
15169
  } catch (err) {
15117
15170
  const message = err.message;
15118
15171
  log("warn", `team push error: ${message}`);
15172
+ writeLastPushFailure(
15173
+ { ingestId: "n/a", observedAt: (/* @__PURE__ */ new Date()).toISOString() },
15174
+ `team push error: ${message}`
15175
+ );
15119
15176
  return { paired: true, pushed: 0, queued: 0, queuedDrained: 0, error: message };
15120
15177
  }
15121
15178
  }
@@ -15187,6 +15244,7 @@ var init_sync = __esm({
15187
15244
  init_push();
15188
15245
  init_queue2();
15189
15246
  init_backfill();
15247
+ init_last_push();
15190
15248
  init_profile();
15191
15249
  init_fs();
15192
15250
  USAGE_LOG4 = cclensPath("usage.jsonl");
@@ -15225,6 +15283,7 @@ async function joinTeam(args2) {
15225
15283
  memberId: data.membership.id,
15226
15284
  bearerToken,
15227
15285
  teamSlug: data.team.slug,
15286
+ teamName: data.team.name,
15228
15287
  pairedAt: (/* @__PURE__ */ new Date()).toISOString()
15229
15288
  };
15230
15289
  writeTeamConfig(config);
@@ -15320,12 +15379,14 @@ async function teamLeave() {
15320
15379
  } catch {
15321
15380
  }
15322
15381
  clearTeamConfig();
15382
+ clearLastPush();
15323
15383
  console.log("Left team. Local data is unaffected.");
15324
15384
  }
15325
15385
  var init_leave = __esm({
15326
15386
  "src/team/leave.ts"() {
15327
15387
  "use strict";
15328
15388
  init_config();
15389
+ init_last_push();
15329
15390
  }
15330
15391
  });
15331
15392
 
@@ -15445,7 +15506,7 @@ __export(runs_exports, {
15445
15506
  });
15446
15507
  import { execSync as execSync2 } from "node:child_process";
15447
15508
  import { existsSync as existsSync13, readFileSync as readFileSync16, readdirSync as readdirSync4, statSync as statSync4 } from "node:fs";
15448
- import { join as join10 } from "node:path";
15509
+ import { join as join11 } from "node:path";
15449
15510
  async function runs(args2) {
15450
15511
  const json = args2.includes("--json");
15451
15512
  const watch = args2.includes("--watch");
@@ -15654,7 +15715,7 @@ function listTraceFiles() {
15654
15715
  if (!existsSync13(RUNS_DIR2)) return [];
15655
15716
  const entries2 = readdirSync4(RUNS_DIR2).filter((f) => f.endsWith(".jsonl"));
15656
15717
  return entries2.map((f) => {
15657
- const path5 = join10(RUNS_DIR2, f);
15718
+ const path5 = join11(RUNS_DIR2, f);
15658
15719
  const st = statSync4(path5);
15659
15720
  return { runId: f.replace(/\.jsonl$/, ""), path: path5, mtimeMs: st.mtimeMs };
15660
15721
  }).sort((a, b) => b.mtimeMs - a.mtimeMs);
@@ -15666,7 +15727,7 @@ function resolveRunId(arg) {
15666
15727
  if (all2.length === 0) return null;
15667
15728
  return { runId: all2[0].runId, path: all2[0].path };
15668
15729
  }
15669
- const exact = join10(RUNS_DIR2, `${arg}.jsonl`);
15730
+ const exact = join11(RUNS_DIR2, `${arg}.jsonl`);
15670
15731
  if (existsSync13(exact)) return { runId: arg, path: exact };
15671
15732
  const all = listTraceFiles();
15672
15733
  const matches = all.filter((r) => r.runId.includes(arg));
@@ -15861,7 +15922,7 @@ async function main() {
15861
15922
  case "version":
15862
15923
  case "--version":
15863
15924
  case "-v":
15864
- console.log(`fleetlens ${"0.10.4"}`);
15925
+ console.log(`fleetlens ${"0.10.6"}`);
15865
15926
  break;
15866
15927
  case "help":
15867
15928
  case "--help":