fleetlens 0.14.0 → 0.15.0
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.
- package/app/apps/web/.next/BUILD_ID +1 -1
- package/app/apps/web/.next/app-path-routes-manifest.json +4 -0
- package/app/apps/web/.next/build-manifest.json +3 -3
- package/app/apps/web/.next/prerender-manifest.json +3 -3
- package/app/apps/web/.next/routes-manifest.json +24 -0
- package/app/apps/web/.next/server/app/_global-error.html +1 -1
- package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_not-found/page.js +1 -1
- package/app/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/api/ask/route.js +3 -3
- package/app/apps/web/.next/server/app/api/ask/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js +4 -4
- package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js +4 -4
- package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/month-index/route.js +2 -2
- package/app/apps/web/.next/server/app/api/digest/month-index/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js +4 -4
- package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/week-index/route.js +2 -2
- package/app/apps/web/.next/server/app/api/digest/week-index/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/pdf/[key]/route.js +4 -4
- package/app/apps/web/.next/server/app/api/pdf/[key]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/runs/[runId]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/runs/[runId]/stream/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/settings/route.js +5 -4
- package/app/apps/web/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/team/autostart/route/app-paths-manifest.json +3 -0
- package/app/apps/web/.next/server/app/api/team/autostart/route/build-manifest.json +9 -0
- package/app/apps/web/.next/server/app/api/team/autostart/route/server-reference-manifest.json +4 -0
- package/app/apps/web/.next/server/app/api/team/autostart/route.js +7 -0
- package/app/apps/web/.next/server/app/api/team/autostart/route.js.map +5 -0
- package/app/apps/web/.next/server/app/api/team/autostart/route.js.nft.json +1 -0
- package/app/apps/web/.next/server/app/api/team/autostart/route_client-reference-manifest.js +3 -0
- package/app/apps/web/.next/server/app/api/team/onboarding/start/route/app-paths-manifest.json +3 -0
- package/app/apps/web/.next/server/app/api/team/onboarding/start/route/build-manifest.json +9 -0
- package/app/apps/web/.next/server/app/api/team/onboarding/start/route/server-reference-manifest.json +4 -0
- package/app/apps/web/.next/server/app/api/team/onboarding/start/route.js +8 -0
- package/app/apps/web/.next/server/app/api/team/onboarding/start/route.js.map +5 -0
- package/app/apps/web/.next/server/app/api/team/onboarding/start/route.js.nft.json +1 -0
- package/app/apps/web/.next/server/app/api/team/onboarding/start/route_client-reference-manifest.js +3 -0
- package/app/apps/web/.next/server/app/api/team/sync-projects/route/app-paths-manifest.json +3 -0
- package/app/apps/web/.next/server/app/api/team/sync-projects/route/build-manifest.json +9 -0
- package/app/apps/web/.next/server/app/api/team/sync-projects/route/server-reference-manifest.json +4 -0
- package/app/apps/web/.next/server/app/api/team/sync-projects/route.js +8 -0
- package/app/apps/web/.next/server/app/api/team/sync-projects/route.js.map +5 -0
- package/app/apps/web/.next/server/app/api/team/sync-projects/route.js.nft.json +1 -0
- package/app/apps/web/.next/server/app/api/team/sync-projects/route_client-reference-manifest.js +3 -0
- package/app/apps/web/.next/server/app/changelog/page.js +1 -1
- package/app/apps/web/.next/server/app/changelog/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/day/[date]/page.js +1 -1
- package/app/apps/web/.next/server/app/day/[date]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/day/page.js +1 -1
- package/app/apps/web/.next/server/app/day/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/digest/[date]/page.js +1 -1
- package/app/apps/web/.next/server/app/digest/[date]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/digest/page.js +1 -1
- package/app/apps/web/.next/server/app/digest/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/insights/[key]/page.js +1 -1
- package/app/apps/web/.next/server/app/insights/[key]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/insights/page.js +1 -1
- package/app/apps/web/.next/server/app/insights/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/page.js +1 -1
- package/app/apps/web/.next/server/app/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/parallelism/page.js +1 -1
- package/app/apps/web/.next/server/app/parallelism/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/print/[key]/page.js +1 -1
- package/app/apps/web/.next/server/app/print/[key]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/print/[key]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/projects/[slug]/page.js +1 -1
- package/app/apps/web/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/projects/page.js +1 -1
- package/app/apps/web/.next/server/app/projects/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/runs/page.js +1 -1
- package/app/apps/web/.next/server/app/runs/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/sessions/[id]/page.js +3 -3
- package/app/apps/web/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/sessions/page.js +1 -1
- package/app/apps/web/.next/server/app/sessions/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/settings/page.js +2 -2
- package/app/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/team/onboarding/page/app-paths-manifest.json +3 -0
- package/app/apps/web/.next/server/app/team/onboarding/page/build-manifest.json +17 -0
- package/app/apps/web/.next/server/app/team/onboarding/page/next-font-manifest.json +6 -0
- package/app/apps/web/.next/server/app/team/onboarding/page/react-loadable-manifest.json +1 -0
- package/app/apps/web/.next/server/app/team/onboarding/page/server-reference-manifest.json +4 -0
- package/app/apps/web/.next/server/app/team/onboarding/page.js +19 -0
- package/app/apps/web/.next/server/app/team/onboarding/page.js.map +5 -0
- package/app/apps/web/.next/server/app/team/onboarding/page.js.nft.json +1 -0
- package/app/apps/web/.next/server/app/team/onboarding/page_client-reference-manifest.js +3 -0
- package/app/apps/web/.next/server/app/team/page.js +3 -2
- package/app/apps/web/.next/server/app/team/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/usage/page.js +1 -1
- package/app/apps/web/.next/server/app/usage/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app-paths-manifest.json +4 -0
- package/app/apps/web/.next/server/chunks/02dz_web__next-internal_server_app_api_team_onboarding_start_route_actions_0zeptl_.js +3 -0
- package/app/apps/web/.next/server/chunks/0fuv_zod_v4_classic_external_0.z.vap.js +39 -0
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__038-.1r._.js +6 -0
- package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0~utv~v._.js → [root-of-the-server]__03ewxxu._.js} +2 -2
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__03rmbz6._.js +3 -0
- package/app/apps/web/.next/server/chunks/{[externals]__0o43ejh._.js → [root-of-the-server]__065lib8._.js} +2 -2
- package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0e.f-t.._.js → [root-of-the-server]__0a0~7d6._.js} +2 -2
- package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0gril0u._.js → [root-of-the-server]__0acikq.._.js} +2 -2
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__0et2sqb._.js +3 -0
- package/app/apps/web/.next/server/chunks/{[externals]__09v47rg._.js → [root-of-the-server]__0jbc7tz._.js} +2 -2
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__0mq0or2._.js +3 -0
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__0mvl0qn._.js +3 -0
- package/app/apps/web/.next/server/chunks/{[root-of-the-server]__0n79hpm._.js → [root-of-the-server]__0ow1kn1._.js} +4 -4
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__0~xt99s._.js +3 -0
- package/app/apps/web/.next/server/chunks/apps_web__next-internal_server_app_api_team_autostart_route_actions_10-4s71.js +3 -0
- package/app/apps/web/.next/server/chunks/apps_web__next-internal_server_app_api_team_sync-projects_route_actions_0r_2f5n.js +3 -0
- package/app/apps/web/.next/server/chunks/node_modules_next_036my~r._.js +4 -40
- package/app/apps/web/.next/server/chunks/packages_09wmnv.._.js +3 -0
- package/app/apps/web/.next/server/chunks/packages_0o6.gpk._.js +3 -0
- package/app/apps/web/.next/server/chunks/packages_parser_dist_06d9se1._.js +1 -1
- package/app/apps/web/.next/server/chunks/packages_parser_dist_10ihc3~._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0a7n44-._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0c00i76._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0i.q-1h._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0stu~~r._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0ufi3.w._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/_0xu2pvc._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/apps_web_0.97l5.._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/{apps_web_app_settings_0u6z6rj._.js → apps_web_0q2x4a~._.js} +2 -2
- package/app/apps/web/.next/server/chunks/ssr/apps_web_114yo0v._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/apps_web__next-internal_server_app_team_onboarding_page_actions_0pss~.k.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/apps_web_components_0c-tpft._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/apps_web_components_0txtsv5._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0n7_p1d._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0nb5_-s._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_team-config_ts_10egg08._.js +39 -0
- package/app/apps/web/.next/server/chunks/ssr/node_modules_next_0w2y7fz._.js +2 -2
- package/app/apps/web/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0jxvcfi.js +2 -2
- package/app/apps/web/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0s5yhs4.js +4 -0
- package/app/apps/web/.next/server/chunks/ssr/packages_entries_dist_node_0_271yr.js +1 -1
- package/app/apps/web/.next/server/functions-config-manifest.json +3 -0
- package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/app/apps/web/.next/server/middleware-manifest.json +5 -5
- package/app/apps/web/.next/server/pages/500.html +1 -1
- package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/app/apps/web/.next/static/chunks/{0wwcx42ng8i2e.js → 0-3_u.90d79wi.js} +1 -1
- package/app/apps/web/.next/static/chunks/00a9oyw~h5i1p.js +1 -0
- package/app/apps/web/.next/static/chunks/040s42ypidk7s.css +1 -0
- package/app/apps/web/.next/static/chunks/06eiwghjkkbnh.js +1 -0
- package/app/apps/web/.next/static/chunks/06qeg4pt5jdqs.js +1 -0
- package/app/apps/web/.next/static/chunks/{0e_fzy0n8ij-o.js → 0u6gxpqhl0gc7.js} +1 -1
- package/app/apps/web/.next/static/chunks/18cj08-la37o-.js +1 -0
- package/app/apps/web/app/api/team/autostart/route.ts +41 -0
- package/app/apps/web/app/api/team/onboarding/start/route.ts +96 -0
- package/app/apps/web/app/api/team/sync-projects/route.ts +39 -0
- package/app/apps/web/app/globals.css +82 -0
- package/app/apps/web/app/settings/ai-features-form.tsx +1 -1
- package/app/apps/web/app/settings/page.tsx +21 -7
- package/app/apps/web/app/{settings → team}/force-sync-button.tsx +2 -4
- package/app/apps/web/app/team/onboarding/onboarding-wizard.tsx +503 -0
- package/app/apps/web/app/team/onboarding/page.tsx +28 -0
- package/app/apps/web/app/team/page.tsx +48 -17
- package/app/apps/web/app/{settings/team-connection-section.tsx → team/sync-activity-section.tsx} +6 -23
- package/app/apps/web/app/team/synced-projects-form.tsx +201 -0
- package/app/apps/web/app/team/synced-projects-section.tsx +37 -0
- package/app/apps/web/components/autostart-toggle.tsx +59 -0
- package/app/apps/web/components/project-sync-picker.tsx +109 -0
- package/app/apps/web/components/team-chip.tsx +1 -1
- package/app/apps/web/components/team-welcome-banner.tsx +1 -1
- package/app/apps/web/lib/autostart-data.ts +31 -0
- package/app/apps/web/lib/changelog-data.generated.ts +1 -1
- package/app/apps/web/lib/sync-projects-data.ts +36 -0
- package/app/apps/web/lib/team-config.ts +21 -2
- package/app/apps/web/package.json +1 -1
- package/app/apps/web/tsconfig.tsbuildinfo +1 -1
- package/dist/daemon-worker.js +150 -42
- package/dist/index.js +311 -100
- package/package.json +1 -1
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__08agijy._.js +0 -3
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__0i06ito._.js +0 -3
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__0y5p73y._.js +0 -3
- package/app/apps/web/.next/server/chunks/packages_0c-sz9n._.js +0 -3
- package/app/apps/web/.next/server/chunks/packages_0wywuu.._.js +0 -3
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__09yxy53._.js +0 -3
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0_hv6aq._.js +0 -3
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0dh0q7b._.js +0 -3
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0yv0m0q._.js +0 -3
- package/app/apps/web/.next/static/chunks/005ad7l-h1-.6.js +0 -1
- package/app/apps/web/.next/static/chunks/0h.ua.-myj.6z.js +0 -1
- package/app/apps/web/.next/static/chunks/0l4r0bqqtdju..css +0 -1
- /package/app/apps/web/.next/static/{3VbAChKD8EChlt8Tm5N5r → C4y6rare_ZCcXXQLc8ysA}/_buildManifest.js +0 -0
- /package/app/apps/web/.next/static/{3VbAChKD8EChlt8Tm5N5r → C4y6rare_ZCcXXQLc8ysA}/_clientMiddlewareManifest.js +0 -0
- /package/app/apps/web/.next/static/{3VbAChKD8EChlt8Tm5N5r → C4y6rare_ZCcXXQLc8ysA}/_ssgManifest.js +0 -0
package/dist/index.js
CHANGED
|
@@ -4222,8 +4222,17 @@ var init_cowork = __esm({
|
|
|
4222
4222
|
});
|
|
4223
4223
|
|
|
4224
4224
|
// ../parser/dist/team-config.js
|
|
4225
|
-
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, unlinkSync as unlinkSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
4225
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, unlinkSync as unlinkSync2, mkdirSync as mkdirSync2, renameSync } from "node:fs";
|
|
4226
4226
|
import { join } from "node:path";
|
|
4227
|
+
function shouldSyncProject(repoName, sp) {
|
|
4228
|
+
if (!sp)
|
|
4229
|
+
return true;
|
|
4230
|
+
if (sp.excluded.includes(repoName))
|
|
4231
|
+
return false;
|
|
4232
|
+
if (sp.included.includes(repoName))
|
|
4233
|
+
return true;
|
|
4234
|
+
return sp.autoIncludeNew;
|
|
4235
|
+
}
|
|
4227
4236
|
function readTeamConfig(dir) {
|
|
4228
4237
|
const d = dir ?? cclensHome();
|
|
4229
4238
|
try {
|
|
@@ -4235,7 +4244,9 @@ function readTeamConfig(dir) {
|
|
|
4235
4244
|
function writeTeamConfig(config, dir) {
|
|
4236
4245
|
const d = dir ?? cclensHome();
|
|
4237
4246
|
mkdirSync2(d, { recursive: true });
|
|
4238
|
-
|
|
4247
|
+
const tmp = join(d, `${CONFIG_FILE}.${process.pid}.tmp`);
|
|
4248
|
+
writeFileSync2(tmp, JSON.stringify(config, null, 2), { mode: 384 });
|
|
4249
|
+
renameSync(tmp, join(d, CONFIG_FILE));
|
|
4239
4250
|
}
|
|
4240
4251
|
function clearTeamConfig(dir) {
|
|
4241
4252
|
const d = dir ?? cclensHome();
|
|
@@ -4309,6 +4320,7 @@ __export(fs_exports, {
|
|
|
4309
4320
|
readJsonlFile: () => readJsonlFile,
|
|
4310
4321
|
readTeamConfig: () => readTeamConfig,
|
|
4311
4322
|
sessionIdFromFileName: () => sessionIdFromFileName,
|
|
4323
|
+
shouldSyncProject: () => shouldSyncProject,
|
|
4312
4324
|
walkJsonlFiles: () => walkJsonlFiles,
|
|
4313
4325
|
writeTeamConfig: () => writeTeamConfig
|
|
4314
4326
|
});
|
|
@@ -4677,7 +4689,7 @@ function getServerStatus() {
|
|
|
4677
4689
|
return { running: false };
|
|
4678
4690
|
}
|
|
4679
4691
|
function isServerStale(status2) {
|
|
4680
|
-
return status2.running === true && status2.version !== "0.
|
|
4692
|
+
return status2.running === true && status2.version !== "0.15.0";
|
|
4681
4693
|
}
|
|
4682
4694
|
async function ensureCurrentServer(opts = {}) {
|
|
4683
4695
|
const status2 = getServerStatus();
|
|
@@ -4733,8 +4745,8 @@ async function startServer(opts = {}) {
|
|
|
4733
4745
|
});
|
|
4734
4746
|
child.unref();
|
|
4735
4747
|
const pid = child.pid;
|
|
4736
|
-
writePid(PID_FILE, pid, port, "0.
|
|
4737
|
-
await waitForHealth(`http://localhost:${port}`,
|
|
4748
|
+
writePid(PID_FILE, pid, port, "0.15.0");
|
|
4749
|
+
await waitForHealth(`http://localhost:${port}`, 3e4);
|
|
4738
4750
|
return { pid, port };
|
|
4739
4751
|
}
|
|
4740
4752
|
function stopServer() {
|
|
@@ -4796,6 +4808,13 @@ var init_server = __esm({
|
|
|
4796
4808
|
});
|
|
4797
4809
|
|
|
4798
4810
|
// src/usage/storage.ts
|
|
4811
|
+
var storage_exports = {};
|
|
4812
|
+
__export(storage_exports, {
|
|
4813
|
+
appendSnapshot: () => appendSnapshot,
|
|
4814
|
+
latestClaudeCodeSnapshot: () => latestClaudeCodeSnapshot,
|
|
4815
|
+
latestSnapshot: () => latestSnapshot,
|
|
4816
|
+
readSnapshots: () => readSnapshots
|
|
4817
|
+
});
|
|
4799
4818
|
import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync3, existsSync as existsSync2 } from "node:fs";
|
|
4800
4819
|
import { dirname as dirname3 } from "node:path";
|
|
4801
4820
|
function appendSnapshot(filePath, snapshot) {
|
|
@@ -5093,9 +5112,9 @@ Installed: ${PACKAGE_NAME}@${verify.installedVersion} at ${verify.installedPath
|
|
|
5093
5112
|
console.warn(
|
|
5094
5113
|
` \u2022 reinstall in the correct Node env: 'npm install -g ${PACKAGE_NAME}@latest'`
|
|
5095
5114
|
);
|
|
5096
|
-
} else if (verify.installedVersion !== "0.
|
|
5115
|
+
} else if (verify.installedVersion !== "0.15.0") {
|
|
5097
5116
|
console.log(
|
|
5098
|
-
` \u2192 This process is still running ${"0.
|
|
5117
|
+
` \u2192 This process is still running ${"0.15.0"}. Next invocation will use ${verify.installedVersion}.`
|
|
5099
5118
|
);
|
|
5100
5119
|
}
|
|
5101
5120
|
}
|
|
@@ -5130,14 +5149,14 @@ async function getUpdateAvailability() {
|
|
|
5130
5149
|
if (isDevMode()) return null;
|
|
5131
5150
|
const latest = await fetchLatestVersion();
|
|
5132
5151
|
if (latest === null) return {
|
|
5133
|
-
current: "0.
|
|
5152
|
+
current: "0.15.0",
|
|
5134
5153
|
latest: null,
|
|
5135
5154
|
updateAvailable: false
|
|
5136
5155
|
};
|
|
5137
5156
|
return {
|
|
5138
|
-
current: "0.
|
|
5157
|
+
current: "0.15.0",
|
|
5139
5158
|
latest,
|
|
5140
|
-
updateAvailable: shouldUpdate("0.
|
|
5159
|
+
updateAvailable: shouldUpdate("0.15.0", latest)
|
|
5141
5160
|
};
|
|
5142
5161
|
}
|
|
5143
5162
|
async function checkForUpdate() {
|
|
@@ -5227,7 +5246,7 @@ async function restartServices(state) {
|
|
|
5227
5246
|
}
|
|
5228
5247
|
async function forceUpdate() {
|
|
5229
5248
|
const latest = await fetchLatestVersion();
|
|
5230
|
-
const current = "0.
|
|
5249
|
+
const current = "0.15.0";
|
|
5231
5250
|
if (latest === null) {
|
|
5232
5251
|
console.error("Could not reach npm registry. Check your network.");
|
|
5233
5252
|
process.exit(1);
|
|
@@ -5270,10 +5289,13 @@ __export(autostart_exports, {
|
|
|
5270
5289
|
autostart: () => autostart,
|
|
5271
5290
|
buildPlist: () => buildPlist,
|
|
5272
5291
|
dismissPrompt: () => dismissPrompt,
|
|
5292
|
+
ensureTeamAutostart: () => ensureTeamAutostart,
|
|
5293
|
+
hasOptedOut: () => hasOptedOut,
|
|
5273
5294
|
installAutostart: () => installAutostart,
|
|
5274
5295
|
isAutostartInstalled: () => isAutostartInstalled,
|
|
5275
5296
|
isPromptDismissed: () => isPromptDismissed,
|
|
5276
|
-
maybePromptAutostart: () => maybePromptAutostart
|
|
5297
|
+
maybePromptAutostart: () => maybePromptAutostart,
|
|
5298
|
+
recordOptOut: () => recordOptOut
|
|
5277
5299
|
});
|
|
5278
5300
|
import { existsSync as existsSync5, mkdirSync as mkdirSync4, writeFileSync as writeFileSync3, rmSync, readFileSync as readFileSync6, realpathSync as realpathSync2 } from "node:fs";
|
|
5279
5301
|
import { homedir as homedir2 } from "node:os";
|
|
@@ -5310,7 +5332,6 @@ function buildPlist(opts) {
|
|
|
5310
5332
|
<array>
|
|
5311
5333
|
<string>${nodePath}</string>
|
|
5312
5334
|
<string>${scriptPath}</string>
|
|
5313
|
-
<string>daemon</string>
|
|
5314
5335
|
<string>start</string>
|
|
5315
5336
|
</array>
|
|
5316
5337
|
<key>RunAtLoad</key>
|
|
@@ -5342,9 +5363,10 @@ async function installAutostart() {
|
|
|
5342
5363
|
await runLaunchctl(["unload", p]).catch(() => {
|
|
5343
5364
|
});
|
|
5344
5365
|
await runLaunchctl(["load", "-w", p]);
|
|
5345
|
-
|
|
5366
|
+
writeFlags({ optedOut: false });
|
|
5367
|
+
console.log("Autostart installed \u2014 Fleetlens (dashboard + usage daemon) will start at login.");
|
|
5346
5368
|
console.log(` LaunchAgent: ${p}`);
|
|
5347
|
-
console.log(` Runs: ${nodePath} ${scriptPath}
|
|
5369
|
+
console.log(` Runs: ${nodePath} ${scriptPath} start`);
|
|
5348
5370
|
console.log(
|
|
5349
5371
|
" Note: the Node path above is baked in. If you upgrade or switch Node (e.g. via nvm), re-run `fleetlens autostart install`."
|
|
5350
5372
|
);
|
|
@@ -5356,14 +5378,27 @@ async function uninstallAutostart() {
|
|
|
5356
5378
|
return;
|
|
5357
5379
|
}
|
|
5358
5380
|
const p = plistPath();
|
|
5381
|
+
recordOptOut();
|
|
5359
5382
|
if (!existsSync5(p)) {
|
|
5360
|
-
console.log("Autostart is not installed \u2014 nothing to remove.");
|
|
5383
|
+
console.log("Autostart is not installed \u2014 nothing to remove. Noted your opt-out; team join won't enable it.");
|
|
5361
5384
|
return;
|
|
5362
5385
|
}
|
|
5363
5386
|
await runLaunchctl(["unload", "-w", p]).catch(() => {
|
|
5364
5387
|
});
|
|
5365
5388
|
rmSync(p, { force: true });
|
|
5366
5389
|
console.log(`Autostart removed (${p}). The daemon will no longer start at login.`);
|
|
5390
|
+
console.log(" Opt-out recorded \u2014 team join/start won't re-enable it.");
|
|
5391
|
+
}
|
|
5392
|
+
async function ensureTeamAutostart() {
|
|
5393
|
+
try {
|
|
5394
|
+
if (!isMac()) return;
|
|
5395
|
+
if (isAutostartInstalled()) return;
|
|
5396
|
+
if (hasOptedOut()) return;
|
|
5397
|
+
console.log(" Team reporting stays on across reboots: enabling Fleetlens auto-start at login (dashboard + daemon).");
|
|
5398
|
+
console.log(" (Opt out anytime: fleetlens autostart uninstall \u2014 join won't re-enable it.)");
|
|
5399
|
+
await installAutostart();
|
|
5400
|
+
} catch {
|
|
5401
|
+
}
|
|
5367
5402
|
}
|
|
5368
5403
|
async function statusAutostart() {
|
|
5369
5404
|
if (!isMac()) {
|
|
@@ -5384,22 +5419,33 @@ async function statusAutostart() {
|
|
|
5384
5419
|
function promptFlagPath() {
|
|
5385
5420
|
return cclensPath("autostart.json");
|
|
5386
5421
|
}
|
|
5387
|
-
function
|
|
5422
|
+
function readFlags() {
|
|
5388
5423
|
try {
|
|
5389
|
-
|
|
5390
|
-
return j.promptDismissed === true;
|
|
5424
|
+
return JSON.parse(readFileSync6(promptFlagPath(), "utf8"));
|
|
5391
5425
|
} catch {
|
|
5392
|
-
return
|
|
5426
|
+
return {};
|
|
5393
5427
|
}
|
|
5394
5428
|
}
|
|
5395
|
-
function
|
|
5429
|
+
function writeFlags(patch) {
|
|
5396
5430
|
const p = promptFlagPath();
|
|
5397
5431
|
try {
|
|
5398
5432
|
mkdirSync4(dirname6(p), { recursive: true });
|
|
5399
|
-
writeFileSync3(p, JSON.stringify({
|
|
5433
|
+
writeFileSync3(p, JSON.stringify({ ...readFlags(), ...patch }, null, 2), "utf8");
|
|
5400
5434
|
} catch {
|
|
5401
5435
|
}
|
|
5402
5436
|
}
|
|
5437
|
+
function isPromptDismissed() {
|
|
5438
|
+
return readFlags().promptDismissed === true;
|
|
5439
|
+
}
|
|
5440
|
+
function dismissPrompt() {
|
|
5441
|
+
writeFlags({ promptDismissed: true });
|
|
5442
|
+
}
|
|
5443
|
+
function hasOptedOut() {
|
|
5444
|
+
return readFlags().optedOut === true;
|
|
5445
|
+
}
|
|
5446
|
+
function recordOptOut() {
|
|
5447
|
+
writeFlags({ optedOut: true });
|
|
5448
|
+
}
|
|
5403
5449
|
function promptYesNo(question, defaultYes) {
|
|
5404
5450
|
return new Promise((resolve3) => {
|
|
5405
5451
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -5414,15 +5460,20 @@ function promptYesNo(question, defaultYes) {
|
|
|
5414
5460
|
async function maybePromptAutostart(opts) {
|
|
5415
5461
|
try {
|
|
5416
5462
|
if (!isMac()) return;
|
|
5417
|
-
if (!opts.daemonStarted) return;
|
|
5418
5463
|
if (process.env.__FLEETLENS_UPDATED) return;
|
|
5464
|
+
const { readTeamConfig: readTeamConfig2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
5465
|
+
if (readTeamConfig2()) {
|
|
5466
|
+
await ensureTeamAutostart();
|
|
5467
|
+
return;
|
|
5468
|
+
}
|
|
5469
|
+
if (!opts.daemonStarted) return;
|
|
5419
5470
|
if (!process.stdin.isTTY) return;
|
|
5420
5471
|
if (isAutostartInstalled()) return;
|
|
5421
5472
|
if (isPromptDismissed()) return;
|
|
5422
5473
|
console.log("");
|
|
5423
|
-
console.log("Tip: keep
|
|
5424
|
-
console.log(" This installs a launchd LaunchAgent that runs `fleetlens
|
|
5425
|
-
console.log(" at login (
|
|
5474
|
+
console.log("Tip: keep Fleetlens running after you restart your Mac?");
|
|
5475
|
+
console.log(" This installs a launchd LaunchAgent that runs `fleetlens start`");
|
|
5476
|
+
console.log(" at login (dashboard server + usage daemon).");
|
|
5426
5477
|
const yes = await promptYesNo("Set that up now? [Y/n] ", true);
|
|
5427
5478
|
if (yes) {
|
|
5428
5479
|
await installAutostart();
|
|
@@ -5585,7 +5636,7 @@ async function status() {
|
|
|
5585
5636
|
console.log(`Server: running on ${url} (PID ${server.pid}, v${ver})`);
|
|
5586
5637
|
if (isServerStale(server)) {
|
|
5587
5638
|
console.log(
|
|
5588
|
-
` \u26A0 serving stale ${ver} (CLI is ${"0.
|
|
5639
|
+
` \u26A0 serving stale ${ver} (CLI is ${"0.15.0"}) \u2014 run 'fleetlens start' to restart on the current version`
|
|
5589
5640
|
);
|
|
5590
5641
|
}
|
|
5591
5642
|
} else {
|
|
@@ -5723,6 +5774,11 @@ var init_token = __esm({
|
|
|
5723
5774
|
});
|
|
5724
5775
|
|
|
5725
5776
|
// src/usage/api.ts
|
|
5777
|
+
var api_exports = {};
|
|
5778
|
+
__export(api_exports, {
|
|
5779
|
+
UsageApiError: () => UsageApiError,
|
|
5780
|
+
fetchUsage: () => fetchUsage
|
|
5781
|
+
});
|
|
5726
5782
|
async function fetchUsage() {
|
|
5727
5783
|
const creds = readOAuthCredentials();
|
|
5728
5784
|
if (!creds) {
|
|
@@ -7510,7 +7566,7 @@ var init_dist2 = __esm({
|
|
|
7510
7566
|
});
|
|
7511
7567
|
|
|
7512
7568
|
// ../entries/dist/digest-fs.js
|
|
7513
|
-
import { readFileSync as readFileSync8, readdirSync, writeFileSync as writeFileSync4, renameSync, chmodSync, mkdirSync as mkdirSync5, existsSync as existsSync6 } from "node:fs";
|
|
7569
|
+
import { readFileSync as readFileSync8, readdirSync, writeFileSync as writeFileSync4, renameSync as renameSync2, chmodSync, mkdirSync as mkdirSync5, existsSync as existsSync6 } from "node:fs";
|
|
7514
7570
|
import { dirname as dirname7, join as join7 } from "node:path";
|
|
7515
7571
|
function parseDigestFile(path7, expectedVersion) {
|
|
7516
7572
|
try {
|
|
@@ -7559,7 +7615,7 @@ function writeDayDigest(digest2) {
|
|
|
7559
7615
|
} catch {
|
|
7560
7616
|
}
|
|
7561
7617
|
}
|
|
7562
|
-
|
|
7618
|
+
renameSync2(tmp, final);
|
|
7563
7619
|
}
|
|
7564
7620
|
function readDayDigest(date) {
|
|
7565
7621
|
const p = dayDigestPath(date);
|
|
@@ -7595,7 +7651,7 @@ function writeWeekDigest(digest2) {
|
|
|
7595
7651
|
} catch {
|
|
7596
7652
|
}
|
|
7597
7653
|
}
|
|
7598
|
-
|
|
7654
|
+
renameSync2(tmp, final);
|
|
7599
7655
|
}
|
|
7600
7656
|
function readWeekDigest(monday) {
|
|
7601
7657
|
const p = weekDigestPath(monday);
|
|
@@ -7632,7 +7688,7 @@ function writeMonthDigest(digest2) {
|
|
|
7632
7688
|
} catch {
|
|
7633
7689
|
}
|
|
7634
7690
|
}
|
|
7635
|
-
|
|
7691
|
+
renameSync2(tmp, final);
|
|
7636
7692
|
}
|
|
7637
7693
|
function readMonthDigest(yearMonth) {
|
|
7638
7694
|
const p = monthDigestPath(yearMonth);
|
|
@@ -7704,7 +7760,7 @@ __export(fs_exports2, {
|
|
|
7704
7760
|
writeMonthDigest: () => writeMonthDigest,
|
|
7705
7761
|
writeWeekDigest: () => writeWeekDigest
|
|
7706
7762
|
});
|
|
7707
|
-
import { readFileSync as readFileSync9, readdirSync as readdirSync2, writeFileSync as writeFileSync5, mkdirSync as mkdirSync6, renameSync as
|
|
7763
|
+
import { readFileSync as readFileSync9, readdirSync as readdirSync2, writeFileSync as writeFileSync5, mkdirSync as mkdirSync6, renameSync as renameSync3, existsSync as existsSync7 } from "node:fs";
|
|
7708
7764
|
import { randomBytes } from "node:crypto";
|
|
7709
7765
|
import { join as join8 } from "node:path";
|
|
7710
7766
|
function entriesDir() {
|
|
@@ -7731,7 +7787,7 @@ function writeEntry(entry) {
|
|
|
7731
7787
|
const tmp = tmpPathFor(final);
|
|
7732
7788
|
const json = JSON.stringify(entry, null, 2);
|
|
7733
7789
|
writeFileSync5(tmp, json, { encoding: "utf8" });
|
|
7734
|
-
|
|
7790
|
+
renameSync3(tmp, final);
|
|
7735
7791
|
}
|
|
7736
7792
|
function enrichmentInputHash(e) {
|
|
7737
7793
|
return [
|
|
@@ -7759,7 +7815,7 @@ function writeEntryPreservingEnrichment(fresh) {
|
|
|
7759
7815
|
}
|
|
7760
7816
|
const tmp = tmpPathFor(final);
|
|
7761
7817
|
writeFileSync5(tmp, JSON.stringify(toWrite, null, 2), { encoding: "utf8" });
|
|
7762
|
-
|
|
7818
|
+
renameSync3(tmp, final);
|
|
7763
7819
|
}
|
|
7764
7820
|
function readEntry(sessionId, localDay2) {
|
|
7765
7821
|
const p = pathFor(sessionId, localDay2);
|
|
@@ -12052,7 +12108,7 @@ RESPOND WITH ONLY VALID JSON (no prose, no code fence):
|
|
|
12052
12108
|
});
|
|
12053
12109
|
|
|
12054
12110
|
// ../entries/dist/tmux-runner.js
|
|
12055
|
-
import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync6, existsSync as existsSync8, readdirSync as readdirSync3, realpathSync as realpathSync3, readFileSync as readFileSync10, unlinkSync as unlinkSync3, renameSync as
|
|
12111
|
+
import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync6, existsSync as existsSync8, readdirSync as readdirSync3, realpathSync as realpathSync3, readFileSync as readFileSync10, unlinkSync as unlinkSync3, renameSync as renameSync4 } from "node:fs";
|
|
12056
12112
|
import { join as join9 } from "node:path";
|
|
12057
12113
|
import { homedir as homedir4 } from "node:os";
|
|
12058
12114
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
@@ -12095,7 +12151,7 @@ function ensureRuntimeCwdTrusted(cwd) {
|
|
|
12095
12151
|
const tmp = `${cfgPath}.cclens-tmp-${process.pid}`;
|
|
12096
12152
|
try {
|
|
12097
12153
|
writeFileSync6(tmp, JSON.stringify(cfg, null, 2));
|
|
12098
|
-
|
|
12154
|
+
renameSync4(tmp, cfgPath);
|
|
12099
12155
|
} catch {
|
|
12100
12156
|
try {
|
|
12101
12157
|
unlinkSync3(tmp);
|
|
@@ -13038,7 +13094,7 @@ var init_queue = __esm({
|
|
|
13038
13094
|
});
|
|
13039
13095
|
|
|
13040
13096
|
// ../entries/dist/settings.js
|
|
13041
|
-
import { readFileSync as readFileSync13, writeFileSync as writeFileSync9, renameSync as
|
|
13097
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync9, renameSync as renameSync5, chmodSync as chmodSync2, mkdirSync as mkdirSync10, existsSync as existsSync12 } from "node:fs";
|
|
13042
13098
|
import { dirname as dirname9 } from "node:path";
|
|
13043
13099
|
function settingsPath() {
|
|
13044
13100
|
if (settingsPathCached)
|
|
@@ -13091,7 +13147,7 @@ function writeSettings(s) {
|
|
|
13091
13147
|
if (process.platform !== "win32") {
|
|
13092
13148
|
chmodSync2(tmp, 384);
|
|
13093
13149
|
}
|
|
13094
|
-
|
|
13150
|
+
renameSync5(tmp, p);
|
|
13095
13151
|
}
|
|
13096
13152
|
var DEFAULT_SETTINGS, settingsPathCached;
|
|
13097
13153
|
var init_settings = __esm({
|
|
@@ -16933,6 +16989,10 @@ function clipSegmentsToDay(segments, bounds) {
|
|
|
16933
16989
|
}
|
|
16934
16990
|
return out;
|
|
16935
16991
|
}
|
|
16992
|
+
function filterSyncedSessions(sessions, syncProjects) {
|
|
16993
|
+
if (!syncProjects) return sessions;
|
|
16994
|
+
return sessions.filter((s) => shouldSyncProject(projectRepoName(s.projectName), syncProjects));
|
|
16995
|
+
}
|
|
16936
16996
|
function sessionTouchesDay(s, day2) {
|
|
16937
16997
|
const bounds = dayBoundsMs(day2);
|
|
16938
16998
|
if (s.activeSegments && s.activeSegments.length > 0) {
|
|
@@ -17087,7 +17147,8 @@ function ensureEntriesForDay(day2, daySessions) {
|
|
|
17087
17147
|
}
|
|
17088
17148
|
function buildRichBlocksForDay(day2, daySessions, resolveRepo) {
|
|
17089
17149
|
ensureEntriesForDay(day2, daySessions);
|
|
17090
|
-
const
|
|
17150
|
+
const sessionIds = new Set(daySessions.map((s) => s.id));
|
|
17151
|
+
const entries2 = listEntriesForDay(day2).filter((e) => sessionIds.has(e.session_id));
|
|
17091
17152
|
if (entries2.length === 0) return void 0;
|
|
17092
17153
|
const rich = buildRichRollupBlocks(day2, daySessions, entries2, resolveRepo);
|
|
17093
17154
|
const enriched = buildEnrichedExtras(entries2);
|
|
@@ -17098,7 +17159,7 @@ function buildIngestPayload(inputs) {
|
|
|
17098
17159
|
return {
|
|
17099
17160
|
ingestId: randomUUID2(),
|
|
17100
17161
|
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
17101
|
-
cliVersion: "0.
|
|
17162
|
+
cliVersion: "0.15.0",
|
|
17102
17163
|
...richRollup || inputs.enrichedExtras || inputs.artifactSignals ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
|
|
17103
17164
|
...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
|
|
17104
17165
|
...richRollup ? { richRollup } : {},
|
|
@@ -17762,8 +17823,8 @@ async function dispatchCommand(command2, config, log) {
|
|
|
17762
17823
|
}
|
|
17763
17824
|
}
|
|
17764
17825
|
async function runActivityBackfill(command2, config, log) {
|
|
17765
|
-
const { listSessions: listSessions2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
17766
|
-
const { toLocalDay: toLocalDay4 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
17826
|
+
const { listSessions: listSessions2, shouldSyncProject: shouldSyncProject2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
17827
|
+
const { toLocalDay: toLocalDay4, projectRepoName: projectRepoName2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
17767
17828
|
const { probeArtifactSignals: probeArtifactSignals2 } = await Promise.resolve().then(() => (init_file_probe(), file_probe_exports));
|
|
17768
17829
|
const days = command2.params.days;
|
|
17769
17830
|
const todayMs = Date.now();
|
|
@@ -17772,7 +17833,7 @@ async function runActivityBackfill(command2, config, log) {
|
|
|
17772
17833
|
log("info", `command ${command2.id}: backfill-activity from ${targetDay} (${days} days)`);
|
|
17773
17834
|
let sessions;
|
|
17774
17835
|
try {
|
|
17775
|
-
sessions = await listSessions2({ limit: 1e4 });
|
|
17836
|
+
sessions = filterSyncedSessions(await listSessions2({ limit: 1e4 }), config.syncProjects);
|
|
17776
17837
|
} catch (err) {
|
|
17777
17838
|
return {
|
|
17778
17839
|
id: command2.id,
|
|
@@ -17797,7 +17858,8 @@ async function runActivityBackfill(command2, config, log) {
|
|
|
17797
17858
|
const richBlocks = buildRichBlocksForDay(rollup.day, daySessions, resolveRepo);
|
|
17798
17859
|
let artifactSignals = null;
|
|
17799
17860
|
try {
|
|
17800
|
-
|
|
17861
|
+
const cwdAllowed = shouldSyncProject2(projectRepoName2(process.cwd()), config.syncProjects);
|
|
17862
|
+
artifactSignals = probeArtifactSignals2({ day: rollup.day, extraRoots: cwdAllowed ? [process.cwd()] : [] });
|
|
17801
17863
|
} catch {
|
|
17802
17864
|
}
|
|
17803
17865
|
const payload = buildIngestPayload({
|
|
@@ -17902,6 +17964,26 @@ function buildSyncLine(status2, trigger, s, elapsedMs, nextSyncMs) {
|
|
|
17902
17964
|
async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
17903
17965
|
const config = configOverride === void 0 ? readTeamConfig() : configOverride;
|
|
17904
17966
|
if (!config) return { paired: false, pushed: 0, queued: 0, queuedDrained: 0 };
|
|
17967
|
+
if (config.setupPending) {
|
|
17968
|
+
log(
|
|
17969
|
+
"info",
|
|
17970
|
+
buildSyncLine(
|
|
17971
|
+
"idle",
|
|
17972
|
+
options.trigger ?? "auto",
|
|
17973
|
+
{
|
|
17974
|
+
pushedDays: [],
|
|
17975
|
+
droppedDays: [],
|
|
17976
|
+
queued: 0,
|
|
17977
|
+
queuedDrained: 0,
|
|
17978
|
+
usageSnapshots: 0,
|
|
17979
|
+
idleReason: "setup pending \u2014 finish onboarding in the dashboard (/team/onboarding)"
|
|
17980
|
+
},
|
|
17981
|
+
0,
|
|
17982
|
+
options.nextSyncMs
|
|
17983
|
+
)
|
|
17984
|
+
);
|
|
17985
|
+
return { paired: true, pushed: 0, queued: 0, queuedDrained: 0, setupPending: true };
|
|
17986
|
+
}
|
|
17905
17987
|
const startedAt = Date.now();
|
|
17906
17988
|
const trigger = options.trigger ?? "auto";
|
|
17907
17989
|
const summary = {
|
|
@@ -17923,15 +18005,19 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
17923
18005
|
summary.skipped = { ...summary.skipped, ...body.blocks.skipped };
|
|
17924
18006
|
}
|
|
17925
18007
|
};
|
|
18008
|
+
const emit = options.onProgress ?? (() => {
|
|
18009
|
+
});
|
|
17926
18010
|
try {
|
|
17927
18011
|
resetEnsuredSessions();
|
|
17928
18012
|
const { listSessions: listSessions2, loadCalibrationCurve: loadCalibrationCurve2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
17929
|
-
const { toLocalDay: toLocalDay4 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
18013
|
+
const { toLocalDay: toLocalDay4, projectRepoName: projectRepoName2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
17930
18014
|
const today = toLocalDay4(Date.now());
|
|
17931
|
-
let
|
|
18015
|
+
let patches = {};
|
|
17932
18016
|
const persistConfig = (patch) => {
|
|
17933
|
-
|
|
17934
|
-
|
|
18017
|
+
patches = { ...patches, ...patch };
|
|
18018
|
+
const onDisk = readTeamConfig();
|
|
18019
|
+
if (!onDisk) return;
|
|
18020
|
+
writeTeamConfig({ ...onDisk, ...patches });
|
|
17935
18021
|
};
|
|
17936
18022
|
const pendingLog = readPendingSyncLog(config.lastSyncedLogAt);
|
|
17937
18023
|
const collectedCommands = /* @__PURE__ */ new Map();
|
|
@@ -17976,7 +18062,12 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
17976
18062
|
let drained = 0;
|
|
17977
18063
|
const backlog = dequeuePayloads();
|
|
17978
18064
|
for (let i = 0; i < backlog.length; i++) {
|
|
17979
|
-
const
|
|
18065
|
+
const queuedPayload = backlog[i];
|
|
18066
|
+
if (queuedPayload.richRollup?.projects?.some((p) => !shouldSyncProject(p.project, config.syncProjects))) {
|
|
18067
|
+
log("info", "team push: dropped queued payload containing now-excluded project(s)");
|
|
18068
|
+
continue;
|
|
18069
|
+
}
|
|
18070
|
+
const qResult = await pushToTeamServer(config, queuedPayload);
|
|
17980
18071
|
if (!qResult.ok) {
|
|
17981
18072
|
if (isValidationPoison(qResult.status)) {
|
|
17982
18073
|
log("warn", `team push: queued payload rejected (HTTP ${qResult.status}); dropping unrecoverable item`);
|
|
@@ -17990,15 +18081,41 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
17990
18081
|
}
|
|
17991
18082
|
return drained;
|
|
17992
18083
|
};
|
|
18084
|
+
emit({ type: "phase", phase: "usage-backfill" });
|
|
17993
18085
|
const usageBackfill = await runTeamBackfill(log, USAGE_LOG4, config, {
|
|
17994
18086
|
sinceCapturedAt: options.forceUsageBackfill ? void 0 : config.lastSyncedUsageSnapshotAt
|
|
17995
18087
|
});
|
|
18088
|
+
emit({
|
|
18089
|
+
type: "usage",
|
|
18090
|
+
inserted: usageBackfill.insertedSnapshots ?? 0,
|
|
18091
|
+
alreadyKnown: usageBackfill.skippedSnapshots ?? 0
|
|
18092
|
+
});
|
|
17996
18093
|
if (usageBackfill.lastSnapshotAt) {
|
|
17997
18094
|
persistConfig({ lastSyncedUsageSnapshotAt: usageBackfill.lastSnapshotAt });
|
|
17998
18095
|
}
|
|
17999
|
-
const
|
|
18096
|
+
const unfilteredSessions = await listSessions2({ limit: 1e4 });
|
|
18097
|
+
const sessions = filterSyncedSessions(unfilteredSessions, config.syncProjects);
|
|
18000
18098
|
const allRollups = buildRollupsForRange(sessions);
|
|
18001
|
-
const
|
|
18099
|
+
const inWindow = (day2) => !config.lastSyncedDay || day2 >= config.lastSyncedDay;
|
|
18100
|
+
const rollups = allRollups.filter((r) => inWindow(r.day));
|
|
18101
|
+
if (config.syncProjects) {
|
|
18102
|
+
const filteredDays = new Set(allRollups.map((r) => r.day));
|
|
18103
|
+
for (const r of buildRollupsForRange(unfilteredSessions)) {
|
|
18104
|
+
if (!filteredDays.has(r.day) && inWindow(r.day)) {
|
|
18105
|
+
rollups.push({
|
|
18106
|
+
day: r.day,
|
|
18107
|
+
agentTimeMs: 0,
|
|
18108
|
+
sessions: 0,
|
|
18109
|
+
uniqueSessions: 0,
|
|
18110
|
+
toolCalls: 0,
|
|
18111
|
+
turns: 0,
|
|
18112
|
+
tokens: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }
|
|
18113
|
+
});
|
|
18114
|
+
}
|
|
18115
|
+
}
|
|
18116
|
+
rollups.sort((a, b) => a.day < b.day ? -1 : 1);
|
|
18117
|
+
}
|
|
18118
|
+
emit({ type: "phase", phase: "activity", totalDays: rollups.length });
|
|
18002
18119
|
const usageSnapshot = readLatestUsageSnapshotForWire(USAGE_LOG4) ?? void 0;
|
|
18003
18120
|
const planTier = await getPlanTier(PROFILE_CACHE2).catch(() => null) ?? void 0;
|
|
18004
18121
|
const cyclePeaks = await buildCyclePeaksForPush(planTier, loadCalibrationCurve2);
|
|
@@ -18012,6 +18129,7 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18012
18129
|
summary.idleReason = "nothing to sync";
|
|
18013
18130
|
finish("idle");
|
|
18014
18131
|
}
|
|
18132
|
+
emit({ type: "done", pushed: 0, queued: 0, pushedDays: summary.pushedDays });
|
|
18015
18133
|
return { paired: true, pushed: 0, queued: 0, queuedDrained: 0, usageBackfill };
|
|
18016
18134
|
}
|
|
18017
18135
|
summary.usageSnapshots = usageBackfill.sentSnapshots;
|
|
@@ -18024,6 +18142,7 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18024
18142
|
writeLastPushFailure(payload, errLine2);
|
|
18025
18143
|
summary.errorMsg = `live-snapshot push HTTP ${result.status} (validation) \u2014 dropped unrecoverable`;
|
|
18026
18144
|
finish("error");
|
|
18145
|
+
emit({ type: "done", pushed: 0, queued: 0, pushedDays: summary.pushedDays });
|
|
18027
18146
|
return { paired: true, pushed: 0, queued: 0, queuedDrained: 0, usageBackfill };
|
|
18028
18147
|
}
|
|
18029
18148
|
const errLine = `team push failed (${result.status})`;
|
|
@@ -18032,6 +18151,7 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18032
18151
|
summary.queued = 1;
|
|
18033
18152
|
summary.errorMsg = `live-snapshot push HTTP ${result.status} \u2014 queued for retry`;
|
|
18034
18153
|
finish("failed");
|
|
18154
|
+
emit({ type: "done", pushed: 0, queued: 1, pushedDays: summary.pushedDays });
|
|
18035
18155
|
return { paired: true, pushed: 0, queued: 1, queuedDrained: 0, usageBackfill };
|
|
18036
18156
|
}
|
|
18037
18157
|
writeLastPushSuccess(payload);
|
|
@@ -18045,12 +18165,12 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18045
18165
|
summary.idleReason = "no new daily activity";
|
|
18046
18166
|
finish(summary.skipped && Object.keys(summary.skipped).length ? "degraded" : "idle");
|
|
18047
18167
|
await dispatchAndReport();
|
|
18168
|
+
emit({ type: "done", pushed: 1, queued: 0, pushedDays: summary.pushedDays });
|
|
18048
18169
|
return { paired: true, pushed: 1, queued: 0, queuedDrained: queuedDrained2, usageBackfill };
|
|
18049
18170
|
}
|
|
18050
18171
|
let pushed = 0;
|
|
18051
18172
|
let queued = 0;
|
|
18052
18173
|
let failedDay;
|
|
18053
|
-
let lastResolvedDay;
|
|
18054
18174
|
const droppedDaysBefore = config.droppedDays ?? [];
|
|
18055
18175
|
const workingDropped = [...droppedDaysBefore];
|
|
18056
18176
|
let syncLogWasDelivered = false;
|
|
@@ -18059,15 +18179,32 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18059
18179
|
const buildDayPayload = (rollup, opts) => {
|
|
18060
18180
|
const daySessions = sessions.filter((s) => sessionTouchesDay(s, rollup.day));
|
|
18061
18181
|
const richBlocks = buildRichBlocksForDay(rollup.day, daySessions, resolveRepo);
|
|
18182
|
+
const tombstone = daySessions.length === 0 && !!config.syncProjects;
|
|
18183
|
+
const emptyRich = tombstone ? {
|
|
18184
|
+
projects: [],
|
|
18185
|
+
workingShapes: [],
|
|
18186
|
+
concurrencyPeak: 0,
|
|
18187
|
+
parallelMinutes: 0,
|
|
18188
|
+
longAutonomous: { count: 0, totalMin: 0, maxSingleMin: 0 },
|
|
18189
|
+
toolErrors: 0,
|
|
18190
|
+
skillsLoaded: [],
|
|
18191
|
+
subagentsDispatched: [],
|
|
18192
|
+
brainstormWarmupSessions: 0,
|
|
18193
|
+
planModeUsed: 0,
|
|
18194
|
+
prs: 0,
|
|
18195
|
+
commits: 0,
|
|
18196
|
+
pushes: 0
|
|
18197
|
+
} : void 0;
|
|
18062
18198
|
let artifactSignals = null;
|
|
18063
18199
|
try {
|
|
18064
|
-
|
|
18200
|
+
const cwdAllowed = shouldSyncProject(projectRepoName2(process.cwd()), config.syncProjects);
|
|
18201
|
+
artifactSignals = probeArtifactSignals2({ day: rollup.day, extraRoots: cwdAllowed ? [process.cwd()] : [] });
|
|
18065
18202
|
} catch {
|
|
18066
18203
|
}
|
|
18067
18204
|
return buildIngestPayload({
|
|
18068
18205
|
rollup,
|
|
18069
|
-
richExtras: richBlocks?.rich,
|
|
18070
|
-
enrichedExtras: richBlocks?.enriched,
|
|
18206
|
+
richExtras: richBlocks?.rich ?? emptyRich,
|
|
18207
|
+
enrichedExtras: richBlocks?.enriched ?? (tombstone ? { outcomeMix: {}, helpfulnessMix: {}, goalMix: {} } : void 0),
|
|
18071
18208
|
artifactSignals: artifactSignals ?? void 0,
|
|
18072
18209
|
// Current-cycle data only on the latest day so older days aren't tagged
|
|
18073
18210
|
// with today's snapshot / peaks.
|
|
@@ -18077,9 +18214,10 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18077
18214
|
syncLog: opts.syncLog
|
|
18078
18215
|
});
|
|
18079
18216
|
};
|
|
18080
|
-
|
|
18081
|
-
|
|
18082
|
-
const
|
|
18217
|
+
const rollupsDesc = [...rollups].reverse();
|
|
18218
|
+
for (let i = 0; i < rollupsDesc.length; i++) {
|
|
18219
|
+
const rollup = rollupsDesc[i];
|
|
18220
|
+
const isLatest = i === 0;
|
|
18083
18221
|
const payload = buildDayPayload(rollup, {
|
|
18084
18222
|
latest: isLatest,
|
|
18085
18223
|
syncLog: i === 0 ? pendingLog.lines : void 0
|
|
@@ -18091,7 +18229,7 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18091
18229
|
writeLastPushFailure(payload, errLine2);
|
|
18092
18230
|
summary.droppedDays.push(rollup.day);
|
|
18093
18231
|
if (!workingDropped.includes(rollup.day)) workingDropped.push(rollup.day);
|
|
18094
|
-
|
|
18232
|
+
emit({ type: "day", day: rollup.day, index: i + 1, total: rollupsDesc.length, outcome: "dropped" });
|
|
18095
18233
|
continue;
|
|
18096
18234
|
}
|
|
18097
18235
|
const errLine = `team push failed on ${rollup.day} (${result.status})`;
|
|
@@ -18101,6 +18239,7 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18101
18239
|
summary.queuedDay = rollup.day;
|
|
18102
18240
|
summary.queuedStatus = result.status;
|
|
18103
18241
|
failedDay = rollup.day;
|
|
18242
|
+
emit({ type: "day", day: rollup.day, index: i + 1, total: rollupsDesc.length, outcome: "queued" });
|
|
18104
18243
|
break;
|
|
18105
18244
|
}
|
|
18106
18245
|
writeLastPushSuccess(payload);
|
|
@@ -18109,11 +18248,24 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18109
18248
|
if (i === 0) syncLogWasDelivered = syncLogDelivered(result.body);
|
|
18110
18249
|
pushed++;
|
|
18111
18250
|
summary.pushedDays.push(rollup.day);
|
|
18112
|
-
|
|
18251
|
+
emit({ type: "day", day: rollup.day, index: i + 1, total: rollupsDesc.length, outcome: "pushed" });
|
|
18113
18252
|
}
|
|
18114
18253
|
if (!failedDay) {
|
|
18115
18254
|
const retryDay = [...droppedDaysBefore].sort().find((d) => !summary.droppedDays.includes(d));
|
|
18116
|
-
|
|
18255
|
+
if (retryDay && summary.pushedDays.includes(retryDay)) {
|
|
18256
|
+
const idx = workingDropped.indexOf(retryDay);
|
|
18257
|
+
if (idx >= 0) workingDropped.splice(idx, 1);
|
|
18258
|
+
summary.recoveredDays = [retryDay];
|
|
18259
|
+
}
|
|
18260
|
+
const retryRollup = retryDay && !summary.pushedDays.includes(retryDay) ? allRollups.find((r) => r.day === retryDay) ?? (config.syncProjects ? {
|
|
18261
|
+
day: retryDay,
|
|
18262
|
+
agentTimeMs: 0,
|
|
18263
|
+
sessions: 0,
|
|
18264
|
+
uniqueSessions: 0,
|
|
18265
|
+
toolCalls: 0,
|
|
18266
|
+
turns: 0,
|
|
18267
|
+
tokens: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }
|
|
18268
|
+
} : void 0) : void 0;
|
|
18117
18269
|
if (retryDay && retryRollup) {
|
|
18118
18270
|
const payload = buildDayPayload(retryRollup, { latest: false });
|
|
18119
18271
|
const result = await pushToTeamServer(config, payload);
|
|
@@ -18134,9 +18286,7 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18134
18286
|
const droppedChanged = nextDropped.length !== prevDropped.length || nextDropped.some((d, i) => d !== prevDropped[i]);
|
|
18135
18287
|
const droppedPatch = droppedChanged ? { droppedDays: nextDropped } : {};
|
|
18136
18288
|
if (failedDay) {
|
|
18137
|
-
if (
|
|
18138
|
-
persistConfig({ ...lastResolvedDay ? { lastSyncedDay: lastResolvedDay } : {}, ...droppedPatch });
|
|
18139
|
-
}
|
|
18289
|
+
if (droppedChanged) persistConfig(droppedPatch);
|
|
18140
18290
|
} else {
|
|
18141
18291
|
persistConfig({ lastSyncedDay: today, ...droppedPatch });
|
|
18142
18292
|
}
|
|
@@ -18153,10 +18303,12 @@ async function runTeamSync(log = noopLog2, configOverride, options = {}) {
|
|
|
18153
18303
|
else status2 = "ok";
|
|
18154
18304
|
finish(status2);
|
|
18155
18305
|
await dispatchAndReport();
|
|
18306
|
+
emit({ type: "done", pushed, queued, pushedDays: summary.pushedDays });
|
|
18156
18307
|
return { paired: true, pushed, queued, queuedDrained, usageBackfill, failedDay };
|
|
18157
18308
|
} catch (err) {
|
|
18158
18309
|
const message = err.message;
|
|
18159
18310
|
summary.errorMsg = `sync aborted: ${message}`;
|
|
18311
|
+
emit({ type: "error", message });
|
|
18160
18312
|
finish("error");
|
|
18161
18313
|
writeLastPushFailure(
|
|
18162
18314
|
{ ingestId: "n/a", observedAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
@@ -18279,12 +18431,20 @@ var init_daemon_log = __esm({
|
|
|
18279
18431
|
// src/team/join.ts
|
|
18280
18432
|
var join_exports = {};
|
|
18281
18433
|
__export(join_exports, {
|
|
18434
|
+
carryOverSyncProjects: () => carryOverSyncProjects,
|
|
18282
18435
|
joinTeam: () => joinTeam
|
|
18283
18436
|
});
|
|
18437
|
+
function carryOverSyncProjects(existing, serverUrl, teamSlug) {
|
|
18438
|
+
if (existing && existing.serverUrl === serverUrl && existing.teamSlug === teamSlug) {
|
|
18439
|
+
return existing.syncProjects;
|
|
18440
|
+
}
|
|
18441
|
+
return void 0;
|
|
18442
|
+
}
|
|
18284
18443
|
async function joinTeam(args2) {
|
|
18285
|
-
const
|
|
18444
|
+
const noBrowser = args2.includes("--no-browser");
|
|
18445
|
+
const [serverUrl, bearerToken] = args2.filter((a) => !a.startsWith("--"));
|
|
18286
18446
|
if (!serverUrl || !bearerToken) {
|
|
18287
|
-
console.error("Usage: fleetlens team join <server-url> <device-token>");
|
|
18447
|
+
console.error("Usage: fleetlens team join <server-url> <device-token> [--no-browser]");
|
|
18288
18448
|
console.error("");
|
|
18289
18449
|
console.error("Get the device token from the dashboard after signup,");
|
|
18290
18450
|
console.error("or from Settings \u2192 My device token.");
|
|
@@ -18300,6 +18460,7 @@ async function joinTeam(args2) {
|
|
|
18300
18460
|
process.exit(1);
|
|
18301
18461
|
}
|
|
18302
18462
|
const data = await res.json();
|
|
18463
|
+
const existing = readTeamConfig();
|
|
18303
18464
|
const config = {
|
|
18304
18465
|
serverUrl,
|
|
18305
18466
|
memberId: data.membership.id,
|
|
@@ -18311,36 +18472,70 @@ async function joinTeam(args2) {
|
|
|
18311
18472
|
// doesn't sweep the prior team's [sync] lines onto this team's log. The
|
|
18312
18473
|
// pair run's own [sync] line is written after this instant, so it still
|
|
18313
18474
|
// uploads on the next sync.
|
|
18314
|
-
lastSyncedLogAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
18475
|
+
lastSyncedLogAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
18476
|
+
syncProjects: carryOverSyncProjects(existing, serverUrl, data.team.slug),
|
|
18477
|
+
// Browser path: gate the daemon until the wizard's "Start syncing".
|
|
18478
|
+
...noBrowser ? {} : { setupPending: true }
|
|
18315
18479
|
};
|
|
18316
18480
|
writeTeamConfig(config);
|
|
18317
18481
|
console.log(`Paired with "${data.team.name}" as ${data.user.displayName || data.user.email}`);
|
|
18318
18482
|
console.log(` role: ${data.membership.role}`);
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
|
|
18326
|
-
|
|
18327
|
-
|
|
18328
|
-
|
|
18329
|
-
|
|
18330
|
-
|
|
18331
|
-
|
|
18332
|
-
|
|
18333
|
-
}
|
|
18334
|
-
|
|
18483
|
+
if (noBrowser) {
|
|
18484
|
+
console.log(" Syncing local history\u2026");
|
|
18485
|
+
const sync = await runTeamSync(logToDaemonLog, config, {
|
|
18486
|
+
forceUsageBackfill: true,
|
|
18487
|
+
trigger: "pair"
|
|
18488
|
+
});
|
|
18489
|
+
const backfill = sync.usageBackfill;
|
|
18490
|
+
if (backfill?.error) {
|
|
18491
|
+
console.log(` \u26A0 Usage history sync failed: ${backfill.error} \u2014 daemon will retry automatically.`);
|
|
18492
|
+
} else if ((backfill?.insertedSnapshots ?? 0) > 0) {
|
|
18493
|
+
console.log(
|
|
18494
|
+
` \u2713 Synced ${backfill.insertedSnapshots} usage snapshot${backfill.insertedSnapshots === 1 ? "" : "s"} from local history.`
|
|
18495
|
+
);
|
|
18496
|
+
} else if ((backfill?.sentSnapshots ?? 0) > 0) {
|
|
18497
|
+
console.log(` \u2713 ${backfill.sentSnapshots} usage snapshots already on server (deduped on capture time).`);
|
|
18498
|
+
} else {
|
|
18499
|
+
console.log(" \xB7 No local usage snapshots yet \u2014 daemon will start collecting.");
|
|
18500
|
+
}
|
|
18501
|
+
if (sync.error) {
|
|
18502
|
+
console.log(` \u26A0 Team sync failed: ${sync.error} \u2014 will retry on next daemon cycle.`);
|
|
18503
|
+
} else if (sync.pushed > 0) {
|
|
18504
|
+
console.log(` \u2713 Synced ${sync.pushed} activity payload${sync.pushed === 1 ? "" : "s"}.`);
|
|
18505
|
+
} else {
|
|
18506
|
+
console.log(" \xB7 No new session activity to push.");
|
|
18507
|
+
}
|
|
18508
|
+
console.log(" Daemon polls every 5 minutes \u2014 next push happens automatically.");
|
|
18509
|
+
const { ensureTeamAutostart: ensureNoBrowser } = await Promise.resolve().then(() => (init_autostart(), autostart_exports));
|
|
18510
|
+
await ensureNoBrowser();
|
|
18511
|
+
return;
|
|
18335
18512
|
}
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18513
|
+
try {
|
|
18514
|
+
const { fetchUsage: fetchUsage2 } = await Promise.resolve().then(() => (init_api(), api_exports));
|
|
18515
|
+
const { appendSnapshot: appendSnapshot2 } = await Promise.resolve().then(() => (init_storage(), storage_exports));
|
|
18516
|
+
const { cclensPath: cclensPath2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
18517
|
+
appendSnapshot2(cclensPath2("usage.jsonl"), await fetchUsage2());
|
|
18518
|
+
} catch {
|
|
18519
|
+
}
|
|
18520
|
+
const { ensureTeamAutostart: ensureTeamAutostart2 } = await Promise.resolve().then(() => (init_autostart(), autostart_exports));
|
|
18521
|
+
await ensureTeamAutostart2();
|
|
18522
|
+
console.log(" Opening your browser to finish setup\u2026");
|
|
18523
|
+
let url;
|
|
18524
|
+
try {
|
|
18525
|
+
const server = await ensureCurrentServer({});
|
|
18526
|
+
url = `http://localhost:${server.port}/team/onboarding`;
|
|
18527
|
+
const daemon2 = startDaemonSilent();
|
|
18528
|
+
if (!daemon2.started && !daemon2.alreadyRunning) {
|
|
18529
|
+
console.warn(` \u26A0 Daemon failed to start \u2014 ${daemon2.error}`);
|
|
18530
|
+
}
|
|
18531
|
+
} catch (err) {
|
|
18532
|
+
console.error(` \u26A0 Could not start the dashboard: ${err.message}`);
|
|
18533
|
+
console.error(" Re-run 'fleetlens team join' after fixing it, or use --no-browser to sync everything from the terminal.");
|
|
18534
|
+
process.exit(1);
|
|
18342
18535
|
}
|
|
18343
|
-
|
|
18536
|
+
openBrowser(url);
|
|
18537
|
+
console.log(` Continue in your browser: ${url}`);
|
|
18538
|
+
console.log(" Nothing syncs until you finish setup there.");
|
|
18344
18539
|
}
|
|
18345
18540
|
var logToDaemonLog;
|
|
18346
18541
|
var init_join = __esm({
|
|
@@ -18349,6 +18544,8 @@ var init_join = __esm({
|
|
|
18349
18544
|
init_config();
|
|
18350
18545
|
init_sync();
|
|
18351
18546
|
init_daemon_log();
|
|
18547
|
+
init_server();
|
|
18548
|
+
init_daemon();
|
|
18352
18549
|
logToDaemonLog = appendDaemonLogLine;
|
|
18353
18550
|
}
|
|
18354
18551
|
});
|
|
@@ -18481,28 +18678,42 @@ async function team(args2) {
|
|
|
18481
18678
|
break;
|
|
18482
18679
|
}
|
|
18483
18680
|
case "sync": {
|
|
18681
|
+
const progressJson = args2.includes("--progress-json");
|
|
18484
18682
|
const { runTeamSync: runTeamSync2 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
18485
18683
|
const { appendDaemonLogLine: appendDaemonLogLine2 } = await Promise.resolve().then(() => (init_daemon_log(), daemon_log_exports));
|
|
18486
18684
|
const outcome = await runTeamSync2(
|
|
18487
18685
|
(level, msg) => {
|
|
18488
|
-
console.log(`[${level}] ${msg}`);
|
|
18686
|
+
if (!progressJson) console.log(`[${level}] ${msg}`);
|
|
18489
18687
|
appendDaemonLogLine2(level, msg);
|
|
18490
18688
|
},
|
|
18491
18689
|
void 0,
|
|
18492
|
-
{
|
|
18690
|
+
{
|
|
18691
|
+
trigger: "manual",
|
|
18692
|
+
onProgress: progressJson ? (ev) => console.log(JSON.stringify(ev)) : void 0
|
|
18693
|
+
}
|
|
18493
18694
|
);
|
|
18494
18695
|
if (!outcome.paired) {
|
|
18495
18696
|
console.error("Not paired. Run 'fleetlens team join <url> <device-token>' first.");
|
|
18496
18697
|
process.exit(1);
|
|
18497
18698
|
}
|
|
18699
|
+
if (outcome.setupPending) {
|
|
18700
|
+
if (progressJson) {
|
|
18701
|
+
console.log(JSON.stringify({ type: "error", message: "setup pending \u2014 selection not saved yet" }));
|
|
18702
|
+
} else {
|
|
18703
|
+
console.error("Setup pending \u2014 nothing synced. Finish onboarding in the dashboard (/team/onboarding) or re-run 'fleetlens team join'.");
|
|
18704
|
+
}
|
|
18705
|
+
process.exit(1);
|
|
18706
|
+
}
|
|
18498
18707
|
const inserted = outcome.usageBackfill?.insertedSnapshots ?? 0;
|
|
18499
18708
|
const madeProgress = outcome.pushed > 0 || outcome.queuedDrained > 0 || inserted > 0;
|
|
18500
18709
|
if (outcome.error || outcome.usageBackfill?.error && !madeProgress) process.exit(1);
|
|
18501
|
-
|
|
18502
|
-
|
|
18503
|
-
|
|
18504
|
-
|
|
18505
|
-
|
|
18710
|
+
if (!progressJson) {
|
|
18711
|
+
const sent = outcome.usageBackfill?.sentSnapshots ?? 0;
|
|
18712
|
+
const usageChecked = sent > 0 ? `, ${sent} usage snapshot${sent === 1 ? "" : "s"} checked` : "";
|
|
18713
|
+
console.log(
|
|
18714
|
+
`\u2713 ${outcome.pushed} activity payload${outcome.pushed === 1 ? "" : "s"} pushed` + usageChecked + (outcome.queuedDrained ? `, ${outcome.queuedDrained} queued retried` : "") + (outcome.queued ? `, ${outcome.queued} queued for retry (will fire next cycle)` : "")
|
|
18715
|
+
);
|
|
18716
|
+
}
|
|
18506
18717
|
break;
|
|
18507
18718
|
}
|
|
18508
18719
|
case "backfill": {
|
|
@@ -18526,7 +18737,7 @@ async function team(args2) {
|
|
|
18526
18737
|
default:
|
|
18527
18738
|
console.log(`Usage: fleetlens team <join|status|leave|logs|sync|backfill>
|
|
18528
18739
|
|
|
18529
|
-
join <url> <device-token>
|
|
18740
|
+
join <url> <device-token> [--no-browser] Pair with a team server (opens browser setup; --no-browser syncs everything immediately)
|
|
18530
18741
|
status Show team pairing state and sync info
|
|
18531
18742
|
leave Unpair from the team server
|
|
18532
18743
|
logs Show recent team-related daemon log entries
|
|
@@ -18968,7 +19179,7 @@ async function main() {
|
|
|
18968
19179
|
case "version":
|
|
18969
19180
|
case "--version":
|
|
18970
19181
|
case "-v":
|
|
18971
|
-
console.log(`fleetlens ${"0.
|
|
19182
|
+
console.log(`fleetlens ${"0.15.0"}`);
|
|
18972
19183
|
break;
|
|
18973
19184
|
case "help":
|
|
18974
19185
|
case "--help":
|
|
@@ -18997,7 +19208,7 @@ Advanced:
|
|
|
18997
19208
|
autostart <install|uninstall|status> Run the usage daemon at login (macOS launchd)
|
|
18998
19209
|
|
|
18999
19210
|
Team:
|
|
19000
|
-
team join <url> <token> Pair with a team server
|
|
19211
|
+
team join <url> <token> Pair with a team server (browser setup)
|
|
19001
19212
|
team status Show team pairing state
|
|
19002
19213
|
team leave Unpair from team server
|
|
19003
19214
|
team logs Show team-related daemon logs
|