fleetlens 0.11.0 → 0.11.2

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 (156) hide show
  1. package/app/apps/web/.next/BUILD_ID +1 -1
  2. package/app/apps/web/.next/app-path-routes-manifest.json +2 -0
  3. package/app/apps/web/.next/build-manifest.json +5 -5
  4. package/app/apps/web/.next/prerender-manifest.json +3 -3
  5. package/app/apps/web/.next/routes-manifest.json +12 -0
  6. package/app/apps/web/.next/server/app/_global-error/page/build-manifest.json +2 -2
  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 +2 -2
  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.nft.json +1 -1
  19. package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js.nft.json +1 -1
  20. package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js.nft.json +1 -1
  21. package/app/apps/web/.next/server/app/api/digest/month-index/route.js.nft.json +1 -1
  22. package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js.nft.json +1 -1
  23. package/app/apps/web/.next/server/app/api/digest/week-index/route.js.nft.json +1 -1
  24. package/app/apps/web/.next/server/app/api/runs/[runId]/route.js.nft.json +1 -1
  25. package/app/apps/web/.next/server/app/api/runs/[runId]/stream/route.js.nft.json +1 -1
  26. package/app/apps/web/.next/server/app/api/settings/route.js +3 -3
  27. package/app/apps/web/.next/server/app/api/settings/route.js.nft.json +1 -1
  28. package/app/apps/web/.next/server/app/api/team-config/route/app-paths-manifest.json +3 -0
  29. package/app/apps/web/.next/server/app/api/team-config/route/build-manifest.json +9 -0
  30. package/app/apps/web/.next/server/app/api/team-config/route/server-reference-manifest.json +4 -0
  31. package/app/apps/web/.next/server/app/api/team-config/route.js +8 -0
  32. package/app/apps/web/.next/server/app/api/team-config/route.js.map +5 -0
  33. package/app/apps/web/.next/server/app/api/team-config/route.js.nft.json +1 -0
  34. package/app/apps/web/.next/server/app/api/team-config/route_client-reference-manifest.js +3 -0
  35. package/app/apps/web/.next/server/app/changelog/page/build-manifest.json +2 -2
  36. package/app/apps/web/.next/server/app/changelog/page.js +1 -1
  37. package/app/apps/web/.next/server/app/changelog/page.js.nft.json +1 -1
  38. package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  39. package/app/apps/web/.next/server/app/day/[date]/page/build-manifest.json +2 -2
  40. package/app/apps/web/.next/server/app/day/[date]/page.js +1 -1
  41. package/app/apps/web/.next/server/app/day/[date]/page.js.nft.json +1 -1
  42. package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
  43. package/app/apps/web/.next/server/app/day/page/build-manifest.json +2 -2
  44. package/app/apps/web/.next/server/app/day/page.js +1 -1
  45. package/app/apps/web/.next/server/app/day/page.js.nft.json +1 -1
  46. package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
  47. package/app/apps/web/.next/server/app/digest/[date]/page/build-manifest.json +2 -2
  48. package/app/apps/web/.next/server/app/digest/[date]/page.js +1 -1
  49. package/app/apps/web/.next/server/app/digest/[date]/page.js.nft.json +1 -1
  50. package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
  51. package/app/apps/web/.next/server/app/digest/page/build-manifest.json +2 -2
  52. package/app/apps/web/.next/server/app/digest/page.js +1 -1
  53. package/app/apps/web/.next/server/app/digest/page.js.nft.json +1 -1
  54. package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
  55. package/app/apps/web/.next/server/app/insights/[key]/page/build-manifest.json +2 -2
  56. package/app/apps/web/.next/server/app/insights/[key]/page.js +1 -1
  57. package/app/apps/web/.next/server/app/insights/[key]/page.js.nft.json +1 -1
  58. package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
  59. package/app/apps/web/.next/server/app/insights/page/build-manifest.json +2 -2
  60. package/app/apps/web/.next/server/app/insights/page.js +1 -1
  61. package/app/apps/web/.next/server/app/insights/page.js.nft.json +1 -1
  62. package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
  63. package/app/apps/web/.next/server/app/page/build-manifest.json +2 -2
  64. package/app/apps/web/.next/server/app/page.js +2 -2
  65. package/app/apps/web/.next/server/app/page.js.nft.json +1 -1
  66. package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  67. package/app/apps/web/.next/server/app/parallelism/page/build-manifest.json +2 -2
  68. package/app/apps/web/.next/server/app/parallelism/page.js +1 -1
  69. package/app/apps/web/.next/server/app/parallelism/page.js.nft.json +1 -1
  70. package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
  71. package/app/apps/web/.next/server/app/projects/[slug]/page/build-manifest.json +2 -2
  72. package/app/apps/web/.next/server/app/projects/[slug]/page.js +2 -2
  73. package/app/apps/web/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
  74. package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  75. package/app/apps/web/.next/server/app/projects/page/build-manifest.json +2 -2
  76. package/app/apps/web/.next/server/app/projects/page.js +1 -1
  77. package/app/apps/web/.next/server/app/projects/page.js.nft.json +1 -1
  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/build-manifest.json +2 -2
  80. package/app/apps/web/.next/server/app/runs/page.js +1 -1
  81. package/app/apps/web/.next/server/app/runs/page.js.nft.json +1 -1
  82. package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  83. package/app/apps/web/.next/server/app/sessions/[id]/page/build-manifest.json +2 -2
  84. package/app/apps/web/.next/server/app/sessions/[id]/page.js +1 -1
  85. package/app/apps/web/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
  86. package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  87. package/app/apps/web/.next/server/app/sessions/page/build-manifest.json +2 -2
  88. package/app/apps/web/.next/server/app/sessions/page.js +1 -1
  89. package/app/apps/web/.next/server/app/sessions/page.js.nft.json +1 -1
  90. package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  91. package/app/apps/web/.next/server/app/settings/page/build-manifest.json +2 -2
  92. package/app/apps/web/.next/server/app/settings/page.js +1 -1
  93. package/app/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
  94. package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  95. package/app/apps/web/.next/server/app/team/page/app-paths-manifest.json +3 -0
  96. package/app/apps/web/.next/server/app/team/page/build-manifest.json +17 -0
  97. package/app/apps/web/.next/server/app/team/page/next-font-manifest.json +6 -0
  98. package/app/apps/web/.next/server/app/team/page/react-loadable-manifest.json +1 -0
  99. package/app/apps/web/.next/server/app/team/page/server-reference-manifest.json +4 -0
  100. package/app/apps/web/.next/server/app/team/page.js +17 -0
  101. package/app/apps/web/.next/server/app/team/page.js.map +5 -0
  102. package/app/apps/web/.next/server/app/team/page.js.nft.json +1 -0
  103. package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +3 -0
  104. package/app/apps/web/.next/server/app/usage/page/build-manifest.json +2 -2
  105. package/app/apps/web/.next/server/app/usage/page.js +1 -1
  106. package/app/apps/web/.next/server/app/usage/page.js.nft.json +1 -1
  107. package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  108. package/app/apps/web/.next/server/app-paths-manifest.json +2 -0
  109. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0atn.dt._.js +3 -0
  110. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0b.b7~1._.js +3 -0
  111. package/app/apps/web/.next/server/chunks/_0euqdko._.js +49 -0
  112. package/app/apps/web/.next/server/chunks/apps_web__next-internal_server_app_api_team-config_route_actions_0ad2gak.js +3 -0
  113. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0_xpuh7._.js +3 -0
  114. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0exckd4._.js +3 -0
  115. package/app/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__10~b4bf._.js → [root-of-the-server]__0o03ymy._.js} +2 -2
  116. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0q9qy0z._.js +3 -0
  117. package/app/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__08l86e-._.js → [root-of-the-server]__0z7mg0b._.js} +2 -2
  118. package/app/apps/web/.next/server/chunks/ssr/_0xu2pvc._.js +1 -1
  119. package/app/apps/web/.next/server/chunks/ssr/apps_web__next-internal_server_app_team_page_actions_0i26.dg.js +3 -0
  120. package/app/apps/web/.next/server/chunks/ssr/apps_web_app_team_team-sync-form_tsx_0choz0h._.js +3 -0
  121. package/app/apps/web/.next/server/chunks/ssr/apps_web_components_0txtsv5._.js +1 -1
  122. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_0af94gl._.js +1 -1
  123. package/app/apps/web/.next/server/chunks/ssr/{node_modules_0yrkyef._.js → node_modules_next_dist_0t-hj0x._.js} +2 -2
  124. package/app/apps/web/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_09rx8oz.js +4 -0
  125. package/app/apps/web/.next/server/functions-config-manifest.json +1 -0
  126. package/app/apps/web/.next/server/middleware-build-manifest.js +5 -5
  127. package/app/apps/web/.next/server/pages/500.html +1 -1
  128. package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
  129. package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
  130. package/app/apps/web/.next/static/chunks/{0e-wrhqh4h3r5.js → 0gblp_v.kiu-..js} +1 -1
  131. package/app/apps/web/.next/static/chunks/0s4eyofh28l~u.js +1 -0
  132. package/app/apps/web/.next/static/chunks/0~e7pnd7ot84w.js +14 -0
  133. package/app/apps/web/.next/static/chunks/12jvvc_w.cb45.css +1 -0
  134. package/app/apps/web/.next/static/chunks/14joqbsr9ihhu.js +1 -0
  135. package/app/apps/web/.next/static/chunks/{turbopack-04ud5x25hbc_4.js → turbopack-0lb9w090w5ezx.js} +1 -1
  136. package/app/apps/web/app/api/team-config/route.ts +39 -0
  137. package/app/apps/web/app/team/page.tsx +191 -0
  138. package/app/apps/web/app/team/team-sync-form.tsx +144 -0
  139. package/app/apps/web/components/sidebar.tsx +8 -0
  140. package/app/apps/web/lib/changelog-data.generated.ts +1 -1
  141. package/app/apps/web/lib/team-config.ts +52 -0
  142. package/app/apps/web/package.json +1 -1
  143. package/app/apps/web/tsconfig.tsbuildinfo +1 -1
  144. package/dist/daemon-worker.js +436 -283
  145. package/dist/index.js +191 -26
  146. package/package.json +1 -1
  147. package/app/apps/web/.next/server/chunks/[externals]__0o43ejh._.js +0 -3
  148. package/app/apps/web/.next/server/chunks/node_modules_next_036my~r._.js +0 -49
  149. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0yv0m0q._.js +0 -3
  150. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__100.ck7._.js +0 -3
  151. package/app/apps/web/.next/static/chunks/0bjcz5~ugoonp.js +0 -14
  152. package/app/apps/web/.next/static/chunks/0o5m5g1dfx4ev.css +0 -1
  153. package/app/apps/web/.next/static/chunks/10wg31hnd6phg.js +0 -1
  154. /package/app/apps/web/.next/static/{WHoyEWNo3d5LkDnYSmiG4 → m6ibRSdAu8jD10VBA2OFH}/_buildManifest.js +0 -0
  155. /package/app/apps/web/.next/static/{WHoyEWNo3d5LkDnYSmiG4 → m6ibRSdAu8jD10VBA2OFH}/_clientMiddlewareManifest.js +0 -0
  156. /package/app/apps/web/.next/static/{WHoyEWNo3d5LkDnYSmiG4 → m6ibRSdAu8jD10VBA2OFH}/_ssgManifest.js +0 -0
@@ -3005,12 +3005,22 @@ var init_team_config = __esm({
3005
3005
  }
3006
3006
  });
3007
3007
 
3008
+ // ../parser/dist/team-wire.js
3009
+ var RICH_ROLLUP_SCHEMA_VERSION;
3010
+ var init_team_wire = __esm({
3011
+ "../parser/dist/team-wire.js"() {
3012
+ "use strict";
3013
+ RICH_ROLLUP_SCHEMA_VERSION = 2;
3014
+ }
3015
+ });
3016
+
3008
3017
  // ../parser/dist/fs.js
3009
3018
  var fs_exports = {};
3010
3019
  __export(fs_exports, {
3011
3020
  DEFAULT_CODEX_ROOT: () => DEFAULT_CODEX_ROOT,
3012
3021
  DEFAULT_GEMINI_ROOT: () => DEFAULT_GEMINI_ROOT,
3013
3022
  DEFAULT_ROOT: () => DEFAULT_ROOT,
3023
+ RICH_ROLLUP_SCHEMA_VERSION: () => RICH_ROLLUP_SCHEMA_VERSION,
3014
3024
  agentSources: () => agentSources,
3015
3025
  buildCalibrationCurve: () => buildCalibrationCurve,
3016
3026
  cacheStats: () => cacheStats,
@@ -3310,6 +3320,7 @@ var init_fs = __esm({
3310
3320
  init_codex();
3311
3321
  init_gemini();
3312
3322
  init_team_config();
3323
+ init_team_wire();
3313
3324
  codexSource = {
3314
3325
  ...CODEX_METADATA,
3315
3326
  defaultRoot: DEFAULT_CODEX_ROOT,
@@ -3984,8 +3995,262 @@ init_fs();
3984
3995
 
3985
3996
  // src/team/push.ts
3986
3997
  init_dist();
3987
- init_storage();
3998
+ init_fs();
3988
3999
  import { randomUUID } from "node:crypto";
4000
+
4001
+ // ../entries/dist/fs.js
4002
+ init_fs();
4003
+ import { readFileSync as readFileSync5, readdirSync as readdirSync2, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, renameSync as renameSync2, existsSync as existsSync3 } from "node:fs";
4004
+ import { randomBytes } from "node:crypto";
4005
+ import { join as join4 } from "node:path";
4006
+
4007
+ // ../entries/dist/types.js
4008
+ var CURRENT_ENTRY_SCHEMA_VERSION = 2;
4009
+ var GOAL_CATEGORIES = [
4010
+ "build",
4011
+ "plan",
4012
+ "debug",
4013
+ "review",
4014
+ "steer",
4015
+ "meta",
4016
+ "research",
4017
+ "refactor",
4018
+ "test",
4019
+ "release",
4020
+ "warmup_minimal"
4021
+ ];
4022
+ function pendingEnrichment() {
4023
+ return {
4024
+ status: "pending",
4025
+ generated_at: null,
4026
+ model: null,
4027
+ cost_usd: null,
4028
+ error: null,
4029
+ brief_summary: null,
4030
+ underlying_goal: null,
4031
+ friction_detail: null,
4032
+ user_instructions: [],
4033
+ outcome: null,
4034
+ claude_helpfulness: null,
4035
+ goal_categories: {},
4036
+ retry_count: 0
4037
+ };
4038
+ }
4039
+ function skippedTrivialEnrichment(generatedAt) {
4040
+ return {
4041
+ status: "skipped_trivial",
4042
+ generated_at: generatedAt,
4043
+ model: null,
4044
+ cost_usd: null,
4045
+ error: null,
4046
+ brief_summary: null,
4047
+ underlying_goal: null,
4048
+ friction_detail: null,
4049
+ user_instructions: [],
4050
+ outcome: "trivial",
4051
+ claude_helpfulness: null,
4052
+ goal_categories: {},
4053
+ retry_count: 0
4054
+ };
4055
+ }
4056
+ function entryKey(sessionId, localDay) {
4057
+ return `${sessionId}__${localDay}`;
4058
+ }
4059
+ function parseEntryKey(key) {
4060
+ const m = /^([^_]+(?:_[^_]+)*)__(\d{4}-\d{2}-\d{2})$/.exec(key);
4061
+ if (!m)
4062
+ return null;
4063
+ return { session_id: m[1], local_day: m[2] };
4064
+ }
4065
+ var CURRENT_DAY_DIGEST_SCHEMA_VERSION = 2;
4066
+ var CURRENT_WEEK_DIGEST_SCHEMA_VERSION = 2;
4067
+ var PROMPT_FRAME_ORIGIN = {
4068
+ teammate: "claude-feature",
4069
+ "task-notification": "claude-feature",
4070
+ "local-command-caveat": "claude-feature",
4071
+ "image-attached": "claude-feature",
4072
+ "slash-command": "claude-feature",
4073
+ "handoff-prose": "personal-habit"
4074
+ };
4075
+
4076
+ // ../entries/dist/digest-fs.js
4077
+ init_fs();
4078
+ import { readFileSync as readFileSync4, readdirSync, writeFileSync as writeFileSync2, renameSync, chmodSync, mkdirSync as mkdirSync3, existsSync as existsSync2 } from "node:fs";
4079
+ import { dirname as dirname2, join as join3 } from "node:path";
4080
+ var digestsDirCached = null;
4081
+ function digestsDir() {
4082
+ if (digestsDirCached)
4083
+ return digestsDirCached;
4084
+ const envOverride = process.env.CCLENS_DIGESTS_DIR;
4085
+ digestsDirCached = envOverride ?? cclensPath("digests");
4086
+ return digestsDirCached;
4087
+ }
4088
+ function dayDigestPath(date) {
4089
+ return join3(digestsDir(), "day", `${date}.json`);
4090
+ }
4091
+ function weekDigestPath(monday) {
4092
+ return join3(digestsDir(), "week", `${monday}.json`);
4093
+ }
4094
+ function writeDayDigest(digest) {
4095
+ const final = dayDigestPath(digest.key);
4096
+ mkdirSync3(dirname2(final), { recursive: true });
4097
+ const tmp = `${final}.tmp`;
4098
+ writeFileSync2(tmp, JSON.stringify(digest, null, 2), "utf8");
4099
+ if (process.platform !== "win32") {
4100
+ try {
4101
+ chmodSync(tmp, 384);
4102
+ } catch {
4103
+ }
4104
+ }
4105
+ renameSync(tmp, final);
4106
+ }
4107
+ function readDayDigest(date) {
4108
+ const p = dayDigestPath(date);
4109
+ if (!existsSync2(p))
4110
+ return null;
4111
+ try {
4112
+ return JSON.parse(readFileSync4(p, "utf8"));
4113
+ } catch {
4114
+ return null;
4115
+ }
4116
+ }
4117
+ var TODAY_TTL_MS = 10 * 60 * 1e3;
4118
+ var todayCache = null;
4119
+ function getTodayDigestFromCache(date, nowMs) {
4120
+ if (!todayCache)
4121
+ return null;
4122
+ if (todayCache.date !== date)
4123
+ return null;
4124
+ if (nowMs - todayCache.writtenAtMs > TODAY_TTL_MS)
4125
+ return null;
4126
+ return todayCache.digest;
4127
+ }
4128
+ function setTodayDigestInCache(date, digest, nowMs) {
4129
+ todayCache = { date, digest, writtenAtMs: nowMs };
4130
+ }
4131
+ function writeWeekDigest(digest) {
4132
+ const final = weekDigestPath(digest.key);
4133
+ mkdirSync3(dirname2(final), { recursive: true });
4134
+ const tmp = `${final}.tmp`;
4135
+ writeFileSync2(tmp, JSON.stringify(digest, null, 2), "utf8");
4136
+ if (process.platform !== "win32") {
4137
+ try {
4138
+ chmodSync(tmp, 384);
4139
+ } catch {
4140
+ }
4141
+ }
4142
+ renameSync(tmp, final);
4143
+ }
4144
+ function readWeekDigest(monday) {
4145
+ const p = weekDigestPath(monday);
4146
+ if (!existsSync2(p))
4147
+ return null;
4148
+ try {
4149
+ return JSON.parse(readFileSync4(p, "utf8"));
4150
+ } catch {
4151
+ return null;
4152
+ }
4153
+ }
4154
+ var CURRENT_WEEK_TTL_MS = 10 * 60 * 1e3;
4155
+ var currentWeekCache = null;
4156
+ function getCurrentWeekDigestFromCache(monday, nowMs) {
4157
+ if (!currentWeekCache)
4158
+ return null;
4159
+ if (currentWeekCache.monday !== monday)
4160
+ return null;
4161
+ if (nowMs - currentWeekCache.writtenAtMs > CURRENT_WEEK_TTL_MS)
4162
+ return null;
4163
+ return currentWeekCache.digest;
4164
+ }
4165
+ function setCurrentWeekDigestInCache(monday, digest, nowMs) {
4166
+ currentWeekCache = { monday, digest, writtenAtMs: nowMs };
4167
+ }
4168
+ var CURRENT_MONTH_TTL_MS = 10 * 60 * 1e3;
4169
+
4170
+ // ../entries/dist/fs.js
4171
+ var entriesDirCached = null;
4172
+ function entriesDir() {
4173
+ if (entriesDirCached)
4174
+ return entriesDirCached;
4175
+ const envOverride = process.env.CCLENS_ENTRIES_DIR;
4176
+ entriesDirCached = envOverride ?? cclensPath("entries");
4177
+ return entriesDirCached;
4178
+ }
4179
+ function pathFor(sessionId, localDay) {
4180
+ return join4(entriesDir(), `${entryKey(sessionId, localDay)}.json`);
4181
+ }
4182
+ function tmpPathFor(final) {
4183
+ return `${final}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
4184
+ }
4185
+ function writeEntry(entry) {
4186
+ const dir = entriesDir();
4187
+ mkdirSync4(dir, { recursive: true });
4188
+ const final = pathFor(entry.session_id, entry.local_day);
4189
+ const tmp = tmpPathFor(final);
4190
+ const json = JSON.stringify(entry, null, 2);
4191
+ writeFileSync3(tmp, json, { encoding: "utf8" });
4192
+ renameSync2(tmp, final);
4193
+ }
4194
+ var PRESERVABLE_STATUSES = /* @__PURE__ */ new Set([
4195
+ "done",
4196
+ "skipped_trivial"
4197
+ ]);
4198
+ function enrichmentInputHash(e) {
4199
+ return [
4200
+ e.numbers.active_min,
4201
+ e.numbers.turn_count,
4202
+ e.numbers.tools_total,
4203
+ e.numbers.subagent_calls,
4204
+ e.numbers.skill_calls,
4205
+ e.numbers.exit_plan_calls,
4206
+ e.numbers.interrupts,
4207
+ e.numbers.prs,
4208
+ e.flags.slice().sort().join(","),
4209
+ e.pr_titles.length,
4210
+ e.end_iso
4211
+ ].join("|");
4212
+ }
4213
+ function writeEntryPreservingEnrichment(fresh) {
4214
+ const dir = entriesDir();
4215
+ mkdirSync4(dir, { recursive: true });
4216
+ const final = pathFor(fresh.session_id, fresh.local_day);
4217
+ const existing = readEntry(fresh.session_id, fresh.local_day);
4218
+ let toWrite = fresh;
4219
+ if (existing && PRESERVABLE_STATUSES.has(existing.enrichment.status) && enrichmentInputHash(existing) === enrichmentInputHash(fresh)) {
4220
+ toWrite = { ...fresh, enrichment: existing.enrichment };
4221
+ }
4222
+ const tmp = tmpPathFor(final);
4223
+ writeFileSync3(tmp, JSON.stringify(toWrite, null, 2), { encoding: "utf8" });
4224
+ renameSync2(tmp, final);
4225
+ }
4226
+ function readEntry(sessionId, localDay) {
4227
+ const p = pathFor(sessionId, localDay);
4228
+ if (!existsSync3(p))
4229
+ return null;
4230
+ const raw = readFileSync5(p, "utf8");
4231
+ return JSON.parse(raw);
4232
+ }
4233
+ function listEntryKeys() {
4234
+ const dir = entriesDir();
4235
+ if (!existsSync3(dir))
4236
+ return [];
4237
+ return readdirSync2(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length));
4238
+ }
4239
+ function listEntriesForDay(localDay) {
4240
+ const out = [];
4241
+ for (const key of listEntryKeys()) {
4242
+ const parsed = parseEntryKey(key);
4243
+ if (!parsed || parsed.local_day !== localDay)
4244
+ continue;
4245
+ const e = readEntry(parsed.session_id, parsed.local_day);
4246
+ if (e)
4247
+ out.push(e);
4248
+ }
4249
+ return out;
4250
+ }
4251
+
4252
+ // src/team/push.ts
4253
+ init_storage();
3989
4254
  var SNAPSHOT_FRESHNESS_MS = 10 * 60 * 1e3;
3990
4255
  var POST_TIMEOUT_MS = 15e3;
3991
4256
  function readLatestUsageSnapshotForWire(filePath, nowMs = Date.now()) {
@@ -4033,14 +4298,142 @@ function buildRollupsForRange(sessions, sinceDay) {
4033
4298
  sessions: startCounts.get(b.date) ?? 0
4034
4299
  }));
4035
4300
  }
4036
- function buildIngestPayload(rollup, usageSnapshot, planTier, cyclePeaks) {
4301
+ function dayBoundsMs(day) {
4302
+ const [y, m, d] = day.split("-").map(Number);
4303
+ return {
4304
+ startMs: new Date(y, m - 1, d, 0, 0, 0, 0).getTime(),
4305
+ endMs: new Date(y, m - 1, d + 1, 0, 0, 0, 0).getTime()
4306
+ };
4307
+ }
4308
+ function clipSegmentsToDay(segments, bounds) {
4309
+ if (!segments || segments.length === 0) return [];
4310
+ const out = [];
4311
+ for (const seg of segments) {
4312
+ const s = Math.max(seg.startMs, bounds.startMs);
4313
+ const e = Math.min(seg.endMs, bounds.endMs);
4314
+ if (e > s) out.push({ startMs: s, endMs: e });
4315
+ }
4316
+ return out;
4317
+ }
4318
+ function sessionTouchesDay(s, day) {
4319
+ const bounds = dayBoundsMs(day);
4320
+ if (s.activeSegments && s.activeSegments.length > 0) {
4321
+ return s.activeSegments.some((seg) => seg.endMs > bounds.startMs && seg.startMs < bounds.endMs);
4322
+ }
4323
+ return sessionDay(s) === day;
4324
+ }
4325
+ function buildRichRollupBlocks(day, daySessions, entries, privateProjects) {
4326
+ const bounds = dayBoundsMs(day);
4327
+ const clippedSessions = [];
4328
+ for (const s of daySessions) {
4329
+ const clipped = clipSegmentsToDay(s.activeSegments, bounds);
4330
+ if (clipped.length === 0) continue;
4331
+ clippedSessions.push({ ...s, activeSegments: clipped });
4332
+ }
4333
+ const bursts = computeBurstsFromSessions(clippedSessions);
4334
+ const stats = summarizeBursts(bursts);
4335
+ const projects = /* @__PURE__ */ new Map();
4336
+ for (const s of clippedSessions) {
4337
+ const name = canonicalProjectName(s.projectName);
4338
+ if (privateProjects.has(name)) continue;
4339
+ const ms = s.activeSegments.reduce((sum, seg) => sum + (seg.endMs - seg.startMs), 0);
4340
+ const cur = projects.get(name) ?? { agentTimeMs: 0, sessions: 0 };
4341
+ cur.agentTimeMs += ms;
4342
+ cur.sessions += 1;
4343
+ projects.set(name, cur);
4344
+ }
4345
+ const workingShapes = /* @__PURE__ */ new Map();
4346
+ const skills = /* @__PURE__ */ new Map();
4347
+ const subagents = /* @__PURE__ */ new Map();
4348
+ let toolErrors = 0;
4349
+ let brainstorm = 0;
4350
+ let planMode = 0;
4351
+ let prs = 0;
4352
+ let commits = 0;
4353
+ let pushes = 0;
4354
+ let longCount = 0;
4355
+ let longTotalMin = 0;
4356
+ let longMaxSingleMin = 0;
4357
+ for (const e of entries) {
4358
+ if (privateProjects.has(e.project)) continue;
4359
+ const shape = e.signals?.working_shape ?? null;
4360
+ if (shape) {
4361
+ const cur = workingShapes.get(shape) ?? { sessions: 0, agentTimeMs: 0 };
4362
+ cur.sessions += 1;
4363
+ cur.agentTimeMs += e.numbers.active_min * 6e4;
4364
+ workingShapes.set(shape, cur);
4365
+ }
4366
+ for (const [name, count] of Object.entries(e.skills)) {
4367
+ if (count > 0) skills.set(name, (skills.get(name) ?? 0) + 1);
4368
+ }
4369
+ for (const sa of e.subagents) {
4370
+ subagents.set(sa.type, (subagents.get(sa.type) ?? 0) + 1);
4371
+ }
4372
+ toolErrors += e.numbers.tool_errors;
4373
+ if (e.signals?.brainstorm_warmup) brainstorm += 1;
4374
+ if (e.numbers.exit_plan_calls > 0) planMode += 1;
4375
+ prs += e.numbers.prs;
4376
+ commits += e.numbers.commits;
4377
+ pushes += e.numbers.pushes;
4378
+ if (e.flags.includes("long_autonomous")) {
4379
+ longCount += 1;
4380
+ longTotalMin += e.numbers.active_min;
4381
+ if (e.numbers.active_min > longMaxSingleMin) longMaxSingleMin = e.numbers.active_min;
4382
+ }
4383
+ }
4384
+ return {
4385
+ projects: Array.from(projects.entries()).map(([project, v]) => ({ project, ...v })).sort((a, b) => b.agentTimeMs - a.agentTimeMs),
4386
+ workingShapes: Array.from(workingShapes.entries()).map(([shape, v]) => ({ shape, ...v })).sort((a, b) => b.sessions - a.sessions),
4387
+ concurrencyPeak: stats.peakConcurrent,
4388
+ parallelMinutes: Math.round(stats.totalParallelMs / 6e4),
4389
+ longAutonomous: { count: longCount, totalMin: longTotalMin, maxSingleMin: longMaxSingleMin },
4390
+ toolErrors,
4391
+ skillsLoaded: Array.from(skills.entries()).map(([name, sessions]) => ({ name, sessions })).sort((a, b) => b.sessions - a.sessions),
4392
+ subagentsDispatched: Array.from(subagents.entries()).map(([type, count]) => ({ type, count })).sort((a, b) => b.count - a.count),
4393
+ brainstormWarmupSessions: brainstorm,
4394
+ planModeUsed: planMode,
4395
+ prs,
4396
+ commits,
4397
+ pushes
4398
+ };
4399
+ }
4400
+ function buildEnrichedExtras(entries) {
4401
+ const outcomeMix = {};
4402
+ const helpfulnessMix = {};
4403
+ const goalMix = {};
4404
+ for (const e of entries) {
4405
+ if (e.enrichment.status !== "done") continue;
4406
+ if (e.enrichment.outcome) {
4407
+ outcomeMix[e.enrichment.outcome] = (outcomeMix[e.enrichment.outcome] ?? 0) + 1;
4408
+ }
4409
+ if (e.enrichment.claude_helpfulness) {
4410
+ helpfulnessMix[e.enrichment.claude_helpfulness] = (helpfulnessMix[e.enrichment.claude_helpfulness] ?? 0) + 1;
4411
+ }
4412
+ for (const [cat, mins] of Object.entries(e.enrichment.goal_categories)) {
4413
+ if (typeof mins === "number") goalMix[cat] = (goalMix[cat] ?? 0) + mins;
4414
+ }
4415
+ }
4416
+ return { outcomeMix, helpfulnessMix, goalMix };
4417
+ }
4418
+ function buildRichBlocksForDay(day, daySessions, privateProjects, enrichmentOptIn) {
4419
+ const entries = listEntriesForDay(day);
4420
+ if (entries.length === 0) return void 0;
4421
+ const rich = buildRichRollupBlocks(day, daySessions, entries, privateProjects);
4422
+ const enriched = enrichmentOptIn ? buildEnrichedExtras(entries) : void 0;
4423
+ return enriched ? { rich, enriched } : { rich };
4424
+ }
4425
+ function buildIngestPayload(inputs) {
4426
+ const richRollup = inputs.rollup && inputs.richExtras ? { ...inputs.rollup, ...inputs.richExtras } : void 0;
4037
4427
  return {
4038
4428
  ingestId: randomUUID(),
4039
4429
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
4040
- ...rollup ? { dailyRollup: rollup } : {},
4041
- ...usageSnapshot ? { usageSnapshot } : {},
4042
- ...planTier ? { planTier } : {},
4043
- ...cyclePeaks ? { cyclePeaks } : {}
4430
+ ...richRollup || inputs.enrichedExtras ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
4431
+ ...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
4432
+ ...richRollup ? { richRollup } : {},
4433
+ ...inputs.enrichedExtras ? { enrichedExtras: inputs.enrichedExtras } : {},
4434
+ ...inputs.usageSnapshot ? { usageSnapshot: inputs.usageSnapshot } : {},
4435
+ ...inputs.planTier ? { planTier: inputs.planTier } : {},
4436
+ ...inputs.cyclePeaks ? { cyclePeaks: inputs.cyclePeaks } : {}
4044
4437
  };
4045
4438
  }
4046
4439
  async function pushToTeamServer(config, payload) {
@@ -4059,13 +4452,13 @@ async function pushToTeamServer(config, payload) {
4059
4452
 
4060
4453
  // src/team/queue.ts
4061
4454
  init_fs();
4062
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, appendFileSync as appendFileSync2, statSync, mkdirSync as mkdirSync3 } from "node:fs";
4063
- import { dirname as dirname2 } from "node:path";
4455
+ import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, appendFileSync as appendFileSync2, statSync, mkdirSync as mkdirSync5 } from "node:fs";
4456
+ import { dirname as dirname3 } from "node:path";
4064
4457
  var QUEUE_PATH = cclensPath("ingest-queue.jsonl");
4065
4458
  var MAX_SIZE_BYTES = 10 * 1024 * 1024;
4066
4459
  var MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
4067
4460
  function enqueuePayload(payload, queuePath = QUEUE_PATH) {
4068
- mkdirSync3(dirname2(queuePath), { recursive: true });
4461
+ mkdirSync5(dirname3(queuePath), { recursive: true });
4069
4462
  const entry = { payload, enqueuedAt: (/* @__PURE__ */ new Date()).toISOString() };
4070
4463
  appendFileSync2(queuePath, JSON.stringify(entry) + "\n", "utf8");
4071
4464
  try {
@@ -4079,7 +4472,7 @@ function enqueuePayload(payload, queuePath = QUEUE_PATH) {
4079
4472
  function dequeuePayloads(queuePath = QUEUE_PATH) {
4080
4473
  let lines;
4081
4474
  try {
4082
- lines = readFileSync4(queuePath, "utf8").trim().split("\n").filter(Boolean);
4475
+ lines = readFileSync6(queuePath, "utf8").trim().split("\n").filter(Boolean);
4083
4476
  } catch {
4084
4477
  return [];
4085
4478
  }
@@ -4094,18 +4487,18 @@ function dequeuePayloads(queuePath = QUEUE_PATH) {
4094
4487
  } catch {
4095
4488
  }
4096
4489
  }
4097
- writeFileSync2(queuePath, "", "utf8");
4490
+ writeFileSync4(queuePath, "", "utf8");
4098
4491
  return valid.map((e) => e.payload);
4099
4492
  }
4100
4493
  function pruneOldest(queuePath) {
4101
4494
  let lines;
4102
4495
  try {
4103
- lines = readFileSync4(queuePath, "utf8").trim().split("\n").filter(Boolean);
4496
+ lines = readFileSync6(queuePath, "utf8").trim().split("\n").filter(Boolean);
4104
4497
  } catch {
4105
4498
  return;
4106
4499
  }
4107
4500
  const keep = lines.slice(Math.floor(lines.length / 2));
4108
- writeFileSync2(queuePath, keep.join("\n") + "\n", "utf8");
4501
+ writeFileSync4(queuePath, keep.join("\n") + "\n", "utf8");
4109
4502
  }
4110
4503
 
4111
4504
  // src/team/backfill.ts
@@ -4113,8 +4506,8 @@ init_storage();
4113
4506
  import { randomUUID as randomUUID2 } from "node:crypto";
4114
4507
 
4115
4508
  // src/usage/profile.ts
4116
- import { existsSync as existsSync2, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
4117
- import { dirname as dirname3 } from "node:path";
4509
+ import { existsSync as existsSync4, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "node:fs";
4510
+ import { dirname as dirname4 } from "node:path";
4118
4511
  var PROFILE_ENDPOINT = "https://api.anthropic.com/api/oauth/profile";
4119
4512
  var BETA_HEADER2 = "oauth-2025-04-20";
4120
4513
  var PROFILE_CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
@@ -4157,9 +4550,9 @@ async function fetchProfile(nowMs = Date.now()) {
4157
4550
  };
4158
4551
  }
4159
4552
  function readCachedProfile(cachePath) {
4160
- if (!existsSync2(cachePath)) return null;
4553
+ if (!existsSync4(cachePath)) return null;
4161
4554
  try {
4162
- const raw = JSON.parse(readFileSync5(cachePath, "utf8"));
4555
+ const raw = JSON.parse(readFileSync7(cachePath, "utf8"));
4163
4556
  if (typeof raw.fetchedAtMs !== "number" || !raw.profile) return null;
4164
4557
  return raw;
4165
4558
  } catch {
@@ -4167,8 +4560,8 @@ function readCachedProfile(cachePath) {
4167
4560
  }
4168
4561
  }
4169
4562
  function writeCachedProfile(cachePath, profile, nowMs = Date.now()) {
4170
- mkdirSync4(dirname3(cachePath), { recursive: true });
4171
- writeFileSync3(
4563
+ mkdirSync6(dirname4(cachePath), { recursive: true });
4564
+ writeFileSync5(
4172
4565
  cachePath,
4173
4566
  JSON.stringify({ fetchedAtMs: nowMs, profile }, null, 2),
4174
4567
  { mode: 384 }
@@ -4328,13 +4721,13 @@ async function runTeamBackfill(log3 = noopLog, filePath = USAGE_LOG, configOverr
4328
4721
 
4329
4722
  // src/team/last-push.ts
4330
4723
  init_fs();
4331
- import { writeFileSync as writeFileSync4, unlinkSync as unlinkSync2, mkdirSync as mkdirSync5 } from "node:fs";
4332
- import { join as join3 } from "node:path";
4724
+ import { writeFileSync as writeFileSync6, unlinkSync as unlinkSync2, mkdirSync as mkdirSync7 } from "node:fs";
4725
+ import { join as join5 } from "node:path";
4333
4726
  var LAST_PUSH_FILE = "team-last-push.json";
4334
4727
  function write(record, dir) {
4335
4728
  const d = dir ?? cclensHome();
4336
- mkdirSync5(d, { recursive: true });
4337
- writeFileSync4(join3(d, LAST_PUSH_FILE), JSON.stringify(record, null, 2), { mode: 384 });
4729
+ mkdirSync7(d, { recursive: true });
4730
+ writeFileSync6(join5(d, LAST_PUSH_FILE), JSON.stringify(record, null, 2), { mode: 384 });
4338
4731
  }
4339
4732
  function writeLastPushSuccess(payload, dir) {
4340
4733
  write({ pushedAt: (/* @__PURE__ */ new Date()).toISOString(), ok: true, payload }, dir);
@@ -4387,7 +4780,7 @@ async function runActivityBackfill(command, config, log3) {
4387
4780
  }
4388
4781
  let pushed = 0;
4389
4782
  for (const rollup of rollups) {
4390
- const payload = buildIngestPayload(rollup);
4783
+ const payload = buildIngestPayload({ rollup });
4391
4784
  const result = await pushToTeamServer(config, payload);
4392
4785
  if (!result.ok) {
4393
4786
  return {
@@ -4481,7 +4874,7 @@ async function runTeamSync(log3 = noopLog2, configOverride, options = {}) {
4481
4874
  if (usageBackfill.sentSnapshots === 0) log3("info", "team push: nothing to sync");
4482
4875
  return { paired: true, pushed: 0, queued: 0, queuedDrained: 0, usageBackfill };
4483
4876
  }
4484
- const payload = buildIngestPayload(void 0, usageSnapshot, planTier, cyclePeaks);
4877
+ const payload = buildIngestPayload({ usageSnapshot, planTier, cyclePeaks });
4485
4878
  const result = await pushToTeamServer(config, payload);
4486
4879
  if (!result.ok) {
4487
4880
  const errLine = `team push failed (${result.status})`;
@@ -4511,17 +4904,28 @@ async function runTeamSync(log3 = noopLog2, configOverride, options = {}) {
4511
4904
  let queued = 0;
4512
4905
  let failedDay;
4513
4906
  let lastPushedDay;
4907
+ const privateProjects = new Set(config.privateProjects ?? []);
4908
+ const enrichmentOptIn = !!config.enrichmentOptIn;
4514
4909
  for (let i = 0; i < rollups.length; i++) {
4515
4910
  const rollup = rollups[i];
4516
4911
  const isLatest = i === rollups.length - 1;
4517
- const payload = buildIngestPayload(
4912
+ const daySessions = sessions.filter((s) => sessionTouchesDay(s, rollup.day));
4913
+ const richBlocks = buildRichBlocksForDay(
4914
+ rollup.day,
4915
+ daySessions,
4916
+ privateProjects,
4917
+ enrichmentOptIn
4918
+ );
4919
+ const payload = buildIngestPayload({
4518
4920
  rollup,
4519
- isLatest ? usageSnapshot : void 0,
4921
+ richExtras: richBlocks?.rich,
4922
+ enrichedExtras: richBlocks?.enriched,
4923
+ usageSnapshot: isLatest ? usageSnapshot : void 0,
4520
4924
  planTier,
4521
4925
  // Same rationale as usageSnapshot — current cycle data only on the
4522
4926
  // latest rollup so older days don't get tagged with today's peaks.
4523
- isLatest ? cyclePeaks : void 0
4524
- );
4927
+ cyclePeaks: isLatest ? cyclePeaks : void 0
4928
+ });
4525
4929
  const result = await pushToTeamServer(config, payload);
4526
4930
  if (!result.ok) {
4527
4931
  const errLine = `team push failed on ${rollup.day} (${result.status})`;
@@ -4637,75 +5041,6 @@ init_fs();
4637
5041
  import { statSync as statSync2, readFileSync as readFileSync9 } from "node:fs";
4638
5042
  import { basename, dirname as dirname6 } from "node:path";
4639
5043
 
4640
- // ../entries/dist/types.js
4641
- var CURRENT_ENTRY_SCHEMA_VERSION = 2;
4642
- var GOAL_CATEGORIES = [
4643
- "build",
4644
- "plan",
4645
- "debug",
4646
- "review",
4647
- "steer",
4648
- "meta",
4649
- "research",
4650
- "refactor",
4651
- "test",
4652
- "release",
4653
- "warmup_minimal"
4654
- ];
4655
- function pendingEnrichment() {
4656
- return {
4657
- status: "pending",
4658
- generated_at: null,
4659
- model: null,
4660
- cost_usd: null,
4661
- error: null,
4662
- brief_summary: null,
4663
- underlying_goal: null,
4664
- friction_detail: null,
4665
- user_instructions: [],
4666
- outcome: null,
4667
- claude_helpfulness: null,
4668
- goal_categories: {},
4669
- retry_count: 0
4670
- };
4671
- }
4672
- function skippedTrivialEnrichment(generatedAt) {
4673
- return {
4674
- status: "skipped_trivial",
4675
- generated_at: generatedAt,
4676
- model: null,
4677
- cost_usd: null,
4678
- error: null,
4679
- brief_summary: null,
4680
- underlying_goal: null,
4681
- friction_detail: null,
4682
- user_instructions: [],
4683
- outcome: "trivial",
4684
- claude_helpfulness: null,
4685
- goal_categories: {},
4686
- retry_count: 0
4687
- };
4688
- }
4689
- function entryKey(sessionId, localDay) {
4690
- return `${sessionId}__${localDay}`;
4691
- }
4692
- function parseEntryKey(key) {
4693
- const m = /^([^_]+(?:_[^_]+)*)__(\d{4}-\d{2}-\d{2})$/.exec(key);
4694
- if (!m)
4695
- return null;
4696
- return { session_id: m[1], local_day: m[2] };
4697
- }
4698
- var CURRENT_DAY_DIGEST_SCHEMA_VERSION = 2;
4699
- var CURRENT_WEEK_DIGEST_SCHEMA_VERSION = 2;
4700
- var PROMPT_FRAME_ORIGIN = {
4701
- teammate: "claude-feature",
4702
- "task-notification": "claude-feature",
4703
- "local-command-caveat": "claude-feature",
4704
- "image-attached": "claude-feature",
4705
- "slash-command": "claude-feature",
4706
- "handoff-prose": "personal-habit"
4707
- };
4708
-
4709
5044
  // ../entries/dist/signals.js
4710
5045
  init_dist();
4711
5046
  var TEAMMATE_RE = /^<teammate-message\b/;
@@ -5407,188 +5742,6 @@ function buildEntries(sessionDetail) {
5407
5742
  return entries;
5408
5743
  }
5409
5744
 
5410
- // ../entries/dist/fs.js
5411
- init_fs();
5412
- import { readFileSync as readFileSync7, readdirSync as readdirSync2, writeFileSync as writeFileSync6, mkdirSync as mkdirSync7, renameSync as renameSync2, existsSync as existsSync4 } from "node:fs";
5413
- import { randomBytes } from "node:crypto";
5414
- import { join as join5 } from "node:path";
5415
-
5416
- // ../entries/dist/digest-fs.js
5417
- init_fs();
5418
- import { readFileSync as readFileSync6, readdirSync, writeFileSync as writeFileSync5, renameSync, chmodSync, mkdirSync as mkdirSync6, existsSync as existsSync3 } from "node:fs";
5419
- import { dirname as dirname4, join as join4 } from "node:path";
5420
- var digestsDirCached = null;
5421
- function digestsDir() {
5422
- if (digestsDirCached)
5423
- return digestsDirCached;
5424
- const envOverride = process.env.CCLENS_DIGESTS_DIR;
5425
- digestsDirCached = envOverride ?? cclensPath("digests");
5426
- return digestsDirCached;
5427
- }
5428
- function dayDigestPath(date) {
5429
- return join4(digestsDir(), "day", `${date}.json`);
5430
- }
5431
- function weekDigestPath(monday) {
5432
- return join4(digestsDir(), "week", `${monday}.json`);
5433
- }
5434
- function writeDayDigest(digest) {
5435
- const final = dayDigestPath(digest.key);
5436
- mkdirSync6(dirname4(final), { recursive: true });
5437
- const tmp = `${final}.tmp`;
5438
- writeFileSync5(tmp, JSON.stringify(digest, null, 2), "utf8");
5439
- if (process.platform !== "win32") {
5440
- try {
5441
- chmodSync(tmp, 384);
5442
- } catch {
5443
- }
5444
- }
5445
- renameSync(tmp, final);
5446
- }
5447
- function readDayDigest(date) {
5448
- const p = dayDigestPath(date);
5449
- if (!existsSync3(p))
5450
- return null;
5451
- try {
5452
- return JSON.parse(readFileSync6(p, "utf8"));
5453
- } catch {
5454
- return null;
5455
- }
5456
- }
5457
- var TODAY_TTL_MS = 10 * 60 * 1e3;
5458
- var todayCache = null;
5459
- function getTodayDigestFromCache(date, nowMs) {
5460
- if (!todayCache)
5461
- return null;
5462
- if (todayCache.date !== date)
5463
- return null;
5464
- if (nowMs - todayCache.writtenAtMs > TODAY_TTL_MS)
5465
- return null;
5466
- return todayCache.digest;
5467
- }
5468
- function setTodayDigestInCache(date, digest, nowMs) {
5469
- todayCache = { date, digest, writtenAtMs: nowMs };
5470
- }
5471
- function writeWeekDigest(digest) {
5472
- const final = weekDigestPath(digest.key);
5473
- mkdirSync6(dirname4(final), { recursive: true });
5474
- const tmp = `${final}.tmp`;
5475
- writeFileSync5(tmp, JSON.stringify(digest, null, 2), "utf8");
5476
- if (process.platform !== "win32") {
5477
- try {
5478
- chmodSync(tmp, 384);
5479
- } catch {
5480
- }
5481
- }
5482
- renameSync(tmp, final);
5483
- }
5484
- function readWeekDigest(monday) {
5485
- const p = weekDigestPath(monday);
5486
- if (!existsSync3(p))
5487
- return null;
5488
- try {
5489
- return JSON.parse(readFileSync6(p, "utf8"));
5490
- } catch {
5491
- return null;
5492
- }
5493
- }
5494
- var CURRENT_WEEK_TTL_MS = 10 * 60 * 1e3;
5495
- var currentWeekCache = null;
5496
- function getCurrentWeekDigestFromCache(monday, nowMs) {
5497
- if (!currentWeekCache)
5498
- return null;
5499
- if (currentWeekCache.monday !== monday)
5500
- return null;
5501
- if (nowMs - currentWeekCache.writtenAtMs > CURRENT_WEEK_TTL_MS)
5502
- return null;
5503
- return currentWeekCache.digest;
5504
- }
5505
- function setCurrentWeekDigestInCache(monday, digest, nowMs) {
5506
- currentWeekCache = { monday, digest, writtenAtMs: nowMs };
5507
- }
5508
- var CURRENT_MONTH_TTL_MS = 10 * 60 * 1e3;
5509
-
5510
- // ../entries/dist/fs.js
5511
- var entriesDirCached = null;
5512
- function entriesDir() {
5513
- if (entriesDirCached)
5514
- return entriesDirCached;
5515
- const envOverride = process.env.CCLENS_ENTRIES_DIR;
5516
- entriesDirCached = envOverride ?? cclensPath("entries");
5517
- return entriesDirCached;
5518
- }
5519
- function pathFor(sessionId, localDay) {
5520
- return join5(entriesDir(), `${entryKey(sessionId, localDay)}.json`);
5521
- }
5522
- function tmpPathFor(final) {
5523
- return `${final}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
5524
- }
5525
- function writeEntry(entry) {
5526
- const dir = entriesDir();
5527
- mkdirSync7(dir, { recursive: true });
5528
- const final = pathFor(entry.session_id, entry.local_day);
5529
- const tmp = tmpPathFor(final);
5530
- const json = JSON.stringify(entry, null, 2);
5531
- writeFileSync6(tmp, json, { encoding: "utf8" });
5532
- renameSync2(tmp, final);
5533
- }
5534
- var PRESERVABLE_STATUSES = /* @__PURE__ */ new Set([
5535
- "done",
5536
- "skipped_trivial"
5537
- ]);
5538
- function enrichmentInputHash(e) {
5539
- return [
5540
- e.numbers.active_min,
5541
- e.numbers.turn_count,
5542
- e.numbers.tools_total,
5543
- e.numbers.subagent_calls,
5544
- e.numbers.skill_calls,
5545
- e.numbers.exit_plan_calls,
5546
- e.numbers.interrupts,
5547
- e.numbers.prs,
5548
- e.flags.slice().sort().join(","),
5549
- e.pr_titles.length,
5550
- e.end_iso
5551
- ].join("|");
5552
- }
5553
- function writeEntryPreservingEnrichment(fresh) {
5554
- const dir = entriesDir();
5555
- mkdirSync7(dir, { recursive: true });
5556
- const final = pathFor(fresh.session_id, fresh.local_day);
5557
- const existing = readEntry(fresh.session_id, fresh.local_day);
5558
- let toWrite = fresh;
5559
- if (existing && PRESERVABLE_STATUSES.has(existing.enrichment.status) && enrichmentInputHash(existing) === enrichmentInputHash(fresh)) {
5560
- toWrite = { ...fresh, enrichment: existing.enrichment };
5561
- }
5562
- const tmp = tmpPathFor(final);
5563
- writeFileSync6(tmp, JSON.stringify(toWrite, null, 2), { encoding: "utf8" });
5564
- renameSync2(tmp, final);
5565
- }
5566
- function readEntry(sessionId, localDay) {
5567
- const p = pathFor(sessionId, localDay);
5568
- if (!existsSync4(p))
5569
- return null;
5570
- const raw = readFileSync7(p, "utf8");
5571
- return JSON.parse(raw);
5572
- }
5573
- function listEntryKeys() {
5574
- const dir = entriesDir();
5575
- if (!existsSync4(dir))
5576
- return [];
5577
- return readdirSync2(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length));
5578
- }
5579
- function listEntriesForDay(localDay) {
5580
- const out = [];
5581
- for (const key of listEntryKeys()) {
5582
- const parsed = parseEntryKey(key);
5583
- if (!parsed || parsed.local_day !== localDay)
5584
- continue;
5585
- const e = readEntry(parsed.session_id, parsed.local_day);
5586
- if (e)
5587
- out.push(e);
5588
- }
5589
- return out;
5590
- }
5591
-
5592
5745
  // src/perception/state.ts
5593
5746
  init_fs();
5594
5747
  import { existsSync as existsSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync7, mkdirSync as mkdirSync8, renameSync as renameSync3 } from "node:fs";
@@ -13558,14 +13711,14 @@ async function getUpdateAvailability() {
13558
13711
  if (isDevMode()) return null;
13559
13712
  const latest = await fetchLatestVersion();
13560
13713
  if (latest === null) return {
13561
- current: "0.11.0",
13714
+ current: "0.11.2",
13562
13715
  latest: null,
13563
13716
  updateAvailable: false
13564
13717
  };
13565
13718
  return {
13566
- current: "0.11.0",
13719
+ current: "0.11.2",
13567
13720
  latest,
13568
- updateAvailable: shouldUpdate("0.11.0", latest)
13721
+ updateAvailable: shouldUpdate("0.11.2", latest)
13569
13722
  };
13570
13723
  }
13571
13724