fleetlens 0.15.2 → 0.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/apps/web/.next/BUILD_ID +1 -1
- package/app/apps/web/.next/app-path-routes-manifest.json +1 -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 +6 -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.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.nft.json +1 -1
- 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.nft.json +1 -1
- 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.nft.json +1 -1
- 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.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/projects/open-folder/route/app-paths-manifest.json +3 -0
- package/app/apps/web/.next/server/app/api/projects/open-folder/route/build-manifest.json +9 -0
- package/app/apps/web/.next/server/app/api/projects/open-folder/route/server-reference-manifest.json +4 -0
- package/app/apps/web/.next/server/app/api/projects/open-folder/route.js +7 -0
- package/app/apps/web/.next/server/app/api/projects/open-folder/route.js.map +5 -0
- package/app/apps/web/.next/server/app/api/projects/open-folder/route.js.nft.json +1 -0
- package/app/apps/web/.next/server/app/api/projects/open-folder/route_client-reference-manifest.js +3 -0
- 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.nft.json +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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/team/onboarding/page_client-reference-manifest.js +1 -1
- 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.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 +1 -0
- package/app/apps/web/.next/server/chunks/02dz_web__next-internal_server_app_api_projects_open-folder_route_actions_0m~419c.js +3 -0
- package/app/apps/web/.next/server/chunks/[root-of-the-server]__12iid50._.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]__0.zquoa._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__03svi~4._.js +8 -0
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__04eq6z2._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__04il6m2._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__08l86e-._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__09rjz7_._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0ar_8wr._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__10~b4bf._.js → [root-of-the-server]__0blm9gz._.js} +3 -3
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0c00i76._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0e.gxk3._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0g-tomj._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0i.q-1h._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0k1x-c9._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0lz4a~g._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0o1_g.~._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0p1x6v2._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0r4tks8._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0rvzdnx._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0stu~~r._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0tejjy_._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0u39afl._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0ufi3.w._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0xy1qim._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0~.f_3z._.js +3 -3
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__10srpu0._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__10xgshr._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/_02r-a1a._.js +8 -0
- package/app/apps/web/.next/server/chunks/ssr/_0k62ejd._.js +8 -0
- package/app/apps/web/.next/server/chunks/ssr/{_0wj750k._.js → _0t~mx7w._.js} +2 -2
- package/app/apps/web/.next/server/chunks/ssr/{_0kajk31._.js → _0whg~r-._.js} +2 -2
- package/app/apps/web/.next/server/chunks/ssr/_0xu2pvc._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/_13jdm1g._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/apps_web_app_sessions_sessions-grid_tsx_0bri5x.._.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/node_modules_lucide-react_dist_esm_icons_12vc-v-._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/packages_parser_dist_0mx_509._.js +1 -1
- package/app/apps/web/.next/server/functions-config-manifest.json +1 -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/{0~qdw1b2uz._5.js → 044mtrzh7d7va.js} +3 -3
- package/app/apps/web/.next/static/chunks/05b0dn.r00hq1.js +1 -0
- package/app/apps/web/.next/static/chunks/{14vx702c32kn6.js → 0_0~~ipv90vm3.js} +1 -1
- package/app/apps/web/.next/static/chunks/0_ujxc0.z66xb.js +14 -0
- package/app/apps/web/.next/static/chunks/0awkd5df28gvj.js +6 -0
- package/app/apps/web/.next/static/chunks/0bhwd68o~-xc_.js +1 -0
- package/app/apps/web/.next/static/chunks/{0m7dd-2zd9vl2.js → 0eoc4yy0s0gpe.js} +1 -1
- package/app/apps/web/.next/static/chunks/0rsp61c8wb.sx.js +6 -0
- package/app/apps/web/.next/static/chunks/{03rd.3cc_t~yf.js → 0s~0-8l~_kqnf.js} +1 -1
- package/app/apps/web/.next/static/chunks/0y3448zrint0k.js +6 -0
- package/app/apps/web/app/api/projects/open-folder/route.ts +60 -0
- package/app/apps/web/app/projects/[slug]/local-folders-button.tsx +406 -0
- package/app/apps/web/app/projects/[slug]/page.tsx +155 -20
- package/app/apps/web/app/projects/page.tsx +2 -2
- package/app/apps/web/app/sessions/[id]/page.tsx +4 -1
- package/app/apps/web/app/sessions/[id]/session-view/header-stats.tsx +81 -0
- package/app/apps/web/app/sessions/[id]/session-view.tsx +11 -0
- package/app/apps/web/app/sessions/sessions-grid.tsx +56 -25
- package/app/apps/web/lib/changelog-data.generated.ts +1 -1
- package/app/apps/web/lib/entries-index.ts +4 -4
- package/app/apps/web/package.json +1 -1
- package/app/apps/web/tsconfig.tsbuildinfo +1 -1
- package/dist/daemon-worker.js +405 -174
- package/dist/index.js +476 -245
- package/package.json +1 -1
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0a7n44-._.js +0 -3
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0lhwp-k._.js +0 -8
- package/app/apps/web/.next/server/chunks/ssr/_0s3n5mz._.js +0 -8
- package/app/apps/web/.next/server/chunks/ssr/_12mbgs5._.js +0 -3
- package/app/apps/web/.next/server/chunks/ssr/apps_web_components_0b-4-4j._.js +0 -8
- package/app/apps/web/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_0cepfi8._.js +0 -3
- package/app/apps/web/.next/static/chunks/03gy1evbn94qu.js +0 -6
- package/app/apps/web/.next/static/chunks/0d2x-wfu.m0-z.js +0 -6
- package/app/apps/web/.next/static/chunks/0i77er85v.rj..js +0 -1
- package/app/apps/web/.next/static/chunks/0nqklmbs5s3ax.js +0 -6
- package/app/apps/web/.next/static/chunks/0tirv_vo6q8uc.js +0 -1
- package/app/apps/web/.next/static/chunks/0u6gxpqhl0gc7.js +0 -14
- /package/app/apps/web/.next/static/{mTj8nKiazosAKJec15dLe → lIz-6F0SEIL9sgFO3XTJp}/_buildManifest.js +0 -0
- /package/app/apps/web/.next/static/{mTj8nKiazosAKJec15dLe → lIz-6F0SEIL9sgFO3XTJp}/_clientMiddlewareManifest.js +0 -0
- /package/app/apps/web/.next/static/{mTj8nKiazosAKJec15dLe → lIz-6F0SEIL9sgFO3XTJp}/_ssgManifest.js +0 -0
package/dist/daemon-worker.js
CHANGED
|
@@ -114,11 +114,22 @@ function worktreeName(projectName) {
|
|
|
114
114
|
return ss.workspaceName;
|
|
115
115
|
return null;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function projectKey(projectName) {
|
|
118
118
|
const canonical = canonicalProjectName(projectName);
|
|
119
119
|
const segs = canonical.replace(/\/+$/, "").split("/").filter(Boolean);
|
|
120
120
|
return segs[segs.length - 1] || canonical;
|
|
121
121
|
}
|
|
122
|
+
function sessionProjectKey(s) {
|
|
123
|
+
return s.repoName ?? projectKey(s.projectName);
|
|
124
|
+
}
|
|
125
|
+
function buildProjectKeyResolver(sessions) {
|
|
126
|
+
const alias = /* @__PURE__ */ new Map();
|
|
127
|
+
for (const s of sessions) {
|
|
128
|
+
if (s.repoName)
|
|
129
|
+
alias.set(projectKey(s.projectName), s.repoName);
|
|
130
|
+
}
|
|
131
|
+
return (s) => s.repoName ?? alias.get(projectKey(s.projectName)) ?? projectKey(s.projectName);
|
|
132
|
+
}
|
|
122
133
|
function makeDay(date) {
|
|
123
134
|
return {
|
|
124
135
|
date,
|
|
@@ -553,8 +564,9 @@ function summarizeBursts(bursts) {
|
|
|
553
564
|
}
|
|
554
565
|
function groupByProject(sessions) {
|
|
555
566
|
const map = /* @__PURE__ */ new Map();
|
|
567
|
+
const keyOf = buildProjectKeyResolver(sessions);
|
|
556
568
|
for (const s of sessions) {
|
|
557
|
-
const repo =
|
|
569
|
+
const repo = keyOf(s);
|
|
558
570
|
const key = repo;
|
|
559
571
|
let cur = map.get(key);
|
|
560
572
|
if (!cur) {
|
|
@@ -583,7 +595,7 @@ function groupByProject(sessions) {
|
|
|
583
595
|
p.metrics = highLevelMetrics(p.sessions);
|
|
584
596
|
const wtNames = /* @__PURE__ */ new Set();
|
|
585
597
|
for (const s of p.sessions) {
|
|
586
|
-
const wt = worktreeName(s.projectName);
|
|
598
|
+
const wt = s.worktreeName ?? worktreeName(s.projectName) ?? (s.cwd ? worktreeName(s.cwd) : null);
|
|
587
599
|
if (wt)
|
|
588
600
|
wtNames.add(wt);
|
|
589
601
|
}
|
|
@@ -602,7 +614,7 @@ function groupByProject(sessions) {
|
|
|
602
614
|
}
|
|
603
615
|
return Array.from(map.values()).sort((a, b) => (b.lastActiveMs ?? 0) - (a.lastActiveMs ?? 0));
|
|
604
616
|
}
|
|
605
|
-
var BLANK_USAGE, WORKTREE_MARKERS, CONDUCTOR_RE, SUPERSET_MARKER, UUID_SEG_RE, PR_CREATE_RE, PR_NUMBER_RE, TITLE_FLAG_RE;
|
|
617
|
+
var BLANK_USAGE, WORKTREE_MARKERS, CONDUCTOR_RE, SUPERSET_MARKER, UUID_SEG_RE, projectRepoName, PR_CREATE_RE, PR_NUMBER_RE, TITLE_FLAG_RE;
|
|
606
618
|
var init_analytics = __esm({
|
|
607
619
|
"../parser/dist/analytics.js"() {
|
|
608
620
|
"use strict";
|
|
@@ -615,6 +627,7 @@ var init_analytics = __esm({
|
|
|
615
627
|
CONDUCTOR_RE = /\/conductor\/workspaces\/[^/]+\/([^/]+)(?:\/|$)/;
|
|
616
628
|
SUPERSET_MARKER = "/.superset/worktrees/";
|
|
617
629
|
UUID_SEG_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
630
|
+
projectRepoName = projectKey;
|
|
618
631
|
PR_CREATE_RE = /gh\s+pr\s+create\b/i;
|
|
619
632
|
PR_NUMBER_RE = /#(\d+)/;
|
|
620
633
|
TITLE_FLAG_RE = /--title\s+["']([^"']+)["']/;
|
|
@@ -1413,6 +1426,187 @@ var init_parser = __esm({
|
|
|
1413
1426
|
}
|
|
1414
1427
|
});
|
|
1415
1428
|
|
|
1429
|
+
// ../parser/dist/git-project.js
|
|
1430
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3, realpathSync, statSync } from "node:fs";
|
|
1431
|
+
import { homedir as homedir2 } from "node:os";
|
|
1432
|
+
import { basename, dirname as dirname2, isAbsolute, join as join2, resolve } from "node:path";
|
|
1433
|
+
function resolveGitDir(root, dotGitText) {
|
|
1434
|
+
const m = dotGitText.match(/^gitdir:\s*(.+)\s*$/m);
|
|
1435
|
+
if (!m)
|
|
1436
|
+
return void 0;
|
|
1437
|
+
const gitDir = m[1].trim();
|
|
1438
|
+
return isAbsolute(gitDir) ? gitDir : resolve(root, gitDir);
|
|
1439
|
+
}
|
|
1440
|
+
function resolveCommonDir(gitDir) {
|
|
1441
|
+
const file = join2(gitDir, "commondir");
|
|
1442
|
+
if (!existsSync2(file))
|
|
1443
|
+
return void 0;
|
|
1444
|
+
const common = readFileSync3(file, "utf8").trim();
|
|
1445
|
+
if (!common)
|
|
1446
|
+
return void 0;
|
|
1447
|
+
return isAbsolute(common) ? common : resolve(gitDir, common);
|
|
1448
|
+
}
|
|
1449
|
+
function dotGitInfoFor(root) {
|
|
1450
|
+
const dotGit = join2(root, ".git");
|
|
1451
|
+
const st = statSync(dotGit, { throwIfNoEntry: false });
|
|
1452
|
+
if (!st)
|
|
1453
|
+
return null;
|
|
1454
|
+
if (st.isDirectory())
|
|
1455
|
+
return { root, gitDir: dotGit, commonDir: dotGit };
|
|
1456
|
+
const gitDir = resolveGitDir(root, readFileSync3(dotGit, "utf8"));
|
|
1457
|
+
if (!gitDir)
|
|
1458
|
+
return { root };
|
|
1459
|
+
return { root, gitDir, commonDir: resolveCommonDir(gitDir) };
|
|
1460
|
+
}
|
|
1461
|
+
function walkBoundary(start) {
|
|
1462
|
+
const home = realpathOrSelf(homedir2());
|
|
1463
|
+
return start === home || start.startsWith(`${home}/`) ? home : void 0;
|
|
1464
|
+
}
|
|
1465
|
+
function nearestDotGit(start) {
|
|
1466
|
+
if (!start || !isAbsolute(start))
|
|
1467
|
+
return null;
|
|
1468
|
+
const boundary = walkBoundary(start);
|
|
1469
|
+
for (let dir = start.replace(/\/+$/, "") || start; ; dir = dirname2(dir)) {
|
|
1470
|
+
if (dir === boundary)
|
|
1471
|
+
return null;
|
|
1472
|
+
const info = dotGitInfoFor(dir);
|
|
1473
|
+
if (info)
|
|
1474
|
+
return info;
|
|
1475
|
+
const parent = dirname2(dir);
|
|
1476
|
+
if (parent === dir)
|
|
1477
|
+
return null;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
function originUrl(configText) {
|
|
1481
|
+
let inOrigin = false;
|
|
1482
|
+
for (const line of configText.split("\n")) {
|
|
1483
|
+
const t = line.trim();
|
|
1484
|
+
if (t.startsWith("[")) {
|
|
1485
|
+
inOrigin = /^\[remote\s+"origin"\]/.test(t);
|
|
1486
|
+
continue;
|
|
1487
|
+
}
|
|
1488
|
+
if (!inOrigin)
|
|
1489
|
+
continue;
|
|
1490
|
+
const m = t.match(/^url\s*=\s*(.+)$/);
|
|
1491
|
+
if (m)
|
|
1492
|
+
return m[1].trim();
|
|
1493
|
+
}
|
|
1494
|
+
return void 0;
|
|
1495
|
+
}
|
|
1496
|
+
function parseRemote(url) {
|
|
1497
|
+
const m = url.match(REMOTE_URL_RE);
|
|
1498
|
+
if (!m)
|
|
1499
|
+
return void 0;
|
|
1500
|
+
const host = m[1];
|
|
1501
|
+
const segs = m[2].split("/").filter(Boolean);
|
|
1502
|
+
if (segs.length < 2)
|
|
1503
|
+
return void 0;
|
|
1504
|
+
const name = segs[segs.length - 1];
|
|
1505
|
+
const owner = segs.slice(0, -1).join("/");
|
|
1506
|
+
return { host, owner, name, url, webUrl: `https://${host}/${owner}/${name}` };
|
|
1507
|
+
}
|
|
1508
|
+
function remoteFor(git) {
|
|
1509
|
+
const dir = git.commonDir ?? git.gitDir;
|
|
1510
|
+
if (!dir)
|
|
1511
|
+
return void 0;
|
|
1512
|
+
const config = join2(dir, "config");
|
|
1513
|
+
if (!existsSync2(config))
|
|
1514
|
+
return void 0;
|
|
1515
|
+
const url = originUrl(readFileSync3(config, "utf8"));
|
|
1516
|
+
return url ? parseRemote(url) : void 0;
|
|
1517
|
+
}
|
|
1518
|
+
function headBranch(gitDir) {
|
|
1519
|
+
if (!gitDir)
|
|
1520
|
+
return void 0;
|
|
1521
|
+
const head = join2(gitDir, "HEAD");
|
|
1522
|
+
if (!existsSync2(head))
|
|
1523
|
+
return void 0;
|
|
1524
|
+
const t = readFileSync3(head, "utf8").trim();
|
|
1525
|
+
const m = t.match(/^ref:\s*refs\/heads\/(.+)$/);
|
|
1526
|
+
return m ? m[1] : `detached @ ${t.slice(0, 7)}`;
|
|
1527
|
+
}
|
|
1528
|
+
function defaultBranch(commonDir) {
|
|
1529
|
+
if (!commonDir)
|
|
1530
|
+
return void 0;
|
|
1531
|
+
const head = join2(commonDir, "refs", "remotes", "origin", "HEAD");
|
|
1532
|
+
if (existsSync2(head)) {
|
|
1533
|
+
const m = readFileSync3(head, "utf8").trim().match(/refs\/remotes\/origin\/(.+)$/);
|
|
1534
|
+
if (m)
|
|
1535
|
+
return m[1];
|
|
1536
|
+
}
|
|
1537
|
+
const packed = join2(commonDir, "packed-refs");
|
|
1538
|
+
if (existsSync2(packed)) {
|
|
1539
|
+
const m = readFileSync3(packed, "utf8").match(/refs\/remotes\/origin\/(\S+)/);
|
|
1540
|
+
if (m && m[1] !== "HEAD")
|
|
1541
|
+
return m[1];
|
|
1542
|
+
}
|
|
1543
|
+
return void 0;
|
|
1544
|
+
}
|
|
1545
|
+
function readGitFolder(path7) {
|
|
1546
|
+
if (!existsSync2(path7))
|
|
1547
|
+
return { exists: false, isWorktree: false };
|
|
1548
|
+
try {
|
|
1549
|
+
const git = nearestDotGit(realpathOrSelf(path7));
|
|
1550
|
+
if (!git)
|
|
1551
|
+
return { exists: true, isWorktree: false };
|
|
1552
|
+
const projectRoot = projectRootFromCommonDir(git.commonDir);
|
|
1553
|
+
const isWorktree = !!projectRoot && realpathOrSelf(projectRoot) !== realpathOrSelf(git.root);
|
|
1554
|
+
return {
|
|
1555
|
+
exists: true,
|
|
1556
|
+
isWorktree,
|
|
1557
|
+
branch: headBranch(git.gitDir),
|
|
1558
|
+
defaultBranch: defaultBranch(git.commonDir),
|
|
1559
|
+
remote: remoteFor(git)
|
|
1560
|
+
};
|
|
1561
|
+
} catch {
|
|
1562
|
+
return { exists: true, isWorktree: false };
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
function projectRootFromCommonDir(commonDir) {
|
|
1566
|
+
if (!commonDir)
|
|
1567
|
+
return void 0;
|
|
1568
|
+
return basename(commonDir) === ".git" ? dirname2(commonDir) : void 0;
|
|
1569
|
+
}
|
|
1570
|
+
function realpathOrSelf(p) {
|
|
1571
|
+
try {
|
|
1572
|
+
return realpathSync(p);
|
|
1573
|
+
} catch {
|
|
1574
|
+
return p;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
function resolveProjectIdentity(cwd) {
|
|
1578
|
+
const normalized = realpathOrSelf(cwd.replace(/\/{2,}/g, "/"));
|
|
1579
|
+
try {
|
|
1580
|
+
const git = nearestDotGit(normalized);
|
|
1581
|
+
if (git) {
|
|
1582
|
+
const projectRoot = realpathOrSelf(projectRootFromCommonDir(git.commonDir) ?? git.root);
|
|
1583
|
+
const gitRoot = realpathOrSelf(git.root);
|
|
1584
|
+
const wt2 = projectRoot !== gitRoot ? worktreeName(normalized) ?? basename(git.root) : void 0;
|
|
1585
|
+
const identity = { projectName: projectRoot };
|
|
1586
|
+
if (wt2)
|
|
1587
|
+
identity.worktreeName = wt2;
|
|
1588
|
+
const remote = remoteFor(git);
|
|
1589
|
+
if (remote) {
|
|
1590
|
+
identity.remote = remote;
|
|
1591
|
+
identity.repoName = remote.name;
|
|
1592
|
+
}
|
|
1593
|
+
return identity;
|
|
1594
|
+
}
|
|
1595
|
+
} catch {
|
|
1596
|
+
}
|
|
1597
|
+
const projectName = canonicalProjectName(normalized);
|
|
1598
|
+
const wt = worktreeName(normalized) ?? void 0;
|
|
1599
|
+
return wt ? { projectName, worktreeName: wt } : { projectName };
|
|
1600
|
+
}
|
|
1601
|
+
var REMOTE_URL_RE;
|
|
1602
|
+
var init_git_project = __esm({
|
|
1603
|
+
"../parser/dist/git-project.js"() {
|
|
1604
|
+
"use strict";
|
|
1605
|
+
init_analytics();
|
|
1606
|
+
REMOTE_URL_RE = /^(?:(?:https?|ssh|git):\/\/)?(?:[^@/]+@)?([^/:]+)[:/](.+?)(?:\.git)?\/?$/;
|
|
1607
|
+
}
|
|
1608
|
+
});
|
|
1609
|
+
|
|
1416
1610
|
// ../parser/dist/team.js
|
|
1417
1611
|
function groupByTeam(sessions, details) {
|
|
1418
1612
|
const byTeam = /* @__PURE__ */ new Map();
|
|
@@ -1881,12 +2075,16 @@ async function getCachedMeta(f) {
|
|
|
1881
2075
|
const sessionId = sessionIdFromFileName(f.fileName);
|
|
1882
2076
|
const projectDirPath = path.dirname(f.fullPath);
|
|
1883
2077
|
const wf = await scanWorkflowAggregate(projectDirPath, sessionId);
|
|
2078
|
+
const cwd = meta.cwd ?? decodeProjectName(f.projectDir);
|
|
2079
|
+
const project = resolveProjectIdentity(cwd);
|
|
1884
2080
|
const full = {
|
|
1885
2081
|
...meta,
|
|
1886
2082
|
id: sessionId,
|
|
1887
2083
|
filePath: f.fullPath,
|
|
1888
2084
|
projectDir: f.projectDir,
|
|
1889
|
-
projectName:
|
|
2085
|
+
projectName: project.projectName,
|
|
2086
|
+
worktreeName: project.worktreeName,
|
|
2087
|
+
repoName: project.repoName,
|
|
1890
2088
|
...wf.workflowCount > 0 ? { workflowCount: wf.workflowCount, spawnedAgentCount: wf.spawnedAgentCount } : {},
|
|
1891
2089
|
...foldWorkflowAgentTime(meta.activeSegments, wf.spans)
|
|
1892
2090
|
};
|
|
@@ -1907,12 +2105,16 @@ async function getCachedDetail(f) {
|
|
|
1907
2105
|
const sessionId = sessionIdFromFileName(f.fileName);
|
|
1908
2106
|
await applySubagentUsage(meta, rawLines, f);
|
|
1909
2107
|
const wf = await scanWorkflowAggregate(path.dirname(f.fullPath), sessionId);
|
|
2108
|
+
const cwd = meta.cwd ?? decodeProjectName(f.projectDir);
|
|
2109
|
+
const project = resolveProjectIdentity(cwd);
|
|
1910
2110
|
const detail = {
|
|
1911
2111
|
...meta,
|
|
1912
2112
|
id: sessionId,
|
|
1913
2113
|
filePath: f.fullPath,
|
|
1914
2114
|
projectDir: f.projectDir,
|
|
1915
|
-
projectName:
|
|
2115
|
+
projectName: project.projectName,
|
|
2116
|
+
worktreeName: project.worktreeName,
|
|
2117
|
+
repoName: project.repoName,
|
|
1916
2118
|
events,
|
|
1917
2119
|
...wf.workflowCount > 0 ? { workflowCount: wf.workflowCount, spawnedAgentCount: wf.spawnedAgentCount } : {},
|
|
1918
2120
|
...foldWorkflowAgentTime(meta.activeSegments, wf.spans)
|
|
@@ -2404,19 +2606,25 @@ async function listProjects(root = DEFAULT_ROOT) {
|
|
|
2404
2606
|
cur.lastActiveMs = f.mtimeMs;
|
|
2405
2607
|
byRawDir.set(f.projectDir, cur);
|
|
2406
2608
|
}
|
|
2407
|
-
const
|
|
2609
|
+
const cachedIdentityForProject = (dir) => {
|
|
2408
2610
|
for (const [, entry] of metaCache.entries()) {
|
|
2409
|
-
if (entry.meta.projectDir === dir
|
|
2410
|
-
return
|
|
2611
|
+
if (entry.meta.projectDir === dir) {
|
|
2612
|
+
return {
|
|
2613
|
+
cwd: entry.meta.cwd,
|
|
2614
|
+
projectName: entry.meta.projectName,
|
|
2615
|
+
worktreeName: entry.meta.worktreeName
|
|
2616
|
+
};
|
|
2411
2617
|
}
|
|
2412
2618
|
}
|
|
2413
2619
|
return void 0;
|
|
2414
2620
|
};
|
|
2415
2621
|
const canonicalMap = /* @__PURE__ */ new Map();
|
|
2416
2622
|
for (const [rawDir, { count, lastActiveMs }] of byRawDir) {
|
|
2417
|
-
const
|
|
2418
|
-
const
|
|
2419
|
-
const
|
|
2623
|
+
const cached = cachedIdentityForProject(rawDir);
|
|
2624
|
+
const cwdOrDecoded = cached?.cwd ?? decodeProjectName(rawDir);
|
|
2625
|
+
const projectName = cached?.projectName ?? canonicalProjectName(cwdOrDecoded);
|
|
2626
|
+
const wt = cached?.worktreeName ?? worktreeName(cwdOrDecoded) ?? void 0;
|
|
2627
|
+
const repo = projectKey(projectName);
|
|
2420
2628
|
const agg = canonicalMap.get(repo) ?? {
|
|
2421
2629
|
canonicalName: repo,
|
|
2422
2630
|
count: 0,
|
|
@@ -2482,6 +2690,7 @@ var init_claude_code = __esm({
|
|
|
2482
2690
|
"use strict";
|
|
2483
2691
|
init_parser();
|
|
2484
2692
|
init_analytics();
|
|
2693
|
+
init_git_project();
|
|
2485
2694
|
init_team();
|
|
2486
2695
|
init_agent_metadata();
|
|
2487
2696
|
init_calibration();
|
|
@@ -2788,13 +2997,16 @@ function parseRollout(file, lines) {
|
|
|
2788
2997
|
const activeSegments = computeActiveSegments2(tsMs);
|
|
2789
2998
|
const airTimeMs = activeSegments.reduce((acc, s) => acc + (s.endMs - s.startMs), 0);
|
|
2790
2999
|
const durationMs = firstTimestamp && lastTimestamp ? Date.parse(lastTimestamp) - Date.parse(firstTimestamp) : void 0;
|
|
2791
|
-
const
|
|
3000
|
+
const project = cwd ? resolveProjectIdentity(cwd) : void 0;
|
|
3001
|
+
const projectName = project?.projectName ?? "(unknown)";
|
|
2792
3002
|
const projectDir = cwd ? cwd.replace(/^\//, "-").replace(/\//g, "-") : "(unknown)";
|
|
2793
3003
|
const meta = {
|
|
2794
3004
|
agent: "codex",
|
|
2795
3005
|
id: file.sessionId,
|
|
2796
3006
|
filePath: file.filePath,
|
|
2797
3007
|
projectName,
|
|
3008
|
+
worktreeName: project?.worktreeName,
|
|
3009
|
+
repoName: project?.repoName,
|
|
2798
3010
|
projectDir,
|
|
2799
3011
|
sessionId: file.sessionId,
|
|
2800
3012
|
firstTimestamp,
|
|
@@ -2953,6 +3165,7 @@ var init_codex = __esm({
|
|
|
2953
3165
|
"../parser/dist/codex.js"() {
|
|
2954
3166
|
"use strict";
|
|
2955
3167
|
init_analytics();
|
|
3168
|
+
init_git_project();
|
|
2956
3169
|
init_user_input();
|
|
2957
3170
|
DEFAULT_CODEX_ROOT = path2.join(os2.homedir(), ".codex", "sessions");
|
|
2958
3171
|
ROLLOUT_RE = /^rollout-(\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2})-([0-9a-f-]+)\.jsonl$/;
|
|
@@ -3332,13 +3545,16 @@ async function parseSession(file) {
|
|
|
3332
3545
|
const airTimeMs = activeSegments.reduce((acc, s) => acc + (s.endMs - s.startMs), 0);
|
|
3333
3546
|
const durationMs = firstTimestamp && lastTimestamp ? Date.parse(lastTimestamp) - Date.parse(firstTimestamp) : void 0;
|
|
3334
3547
|
const sessionId = metaRec.sessionId ?? file.filenameId;
|
|
3335
|
-
const
|
|
3548
|
+
const project = cwd ? resolveProjectIdentity(cwd) : void 0;
|
|
3549
|
+
const projectName = project?.projectName ?? file.slug;
|
|
3336
3550
|
const projectDir = cwd ? cwd.replace(/^\//, "-").replace(/\//g, "-") : file.slug;
|
|
3337
3551
|
const meta = {
|
|
3338
3552
|
agent: "gemini",
|
|
3339
3553
|
id: sessionId,
|
|
3340
3554
|
filePath: file.filePath,
|
|
3341
3555
|
projectName,
|
|
3556
|
+
worktreeName: project?.worktreeName,
|
|
3557
|
+
repoName: project?.repoName,
|
|
3342
3558
|
projectDir,
|
|
3343
3559
|
sessionId,
|
|
3344
3560
|
firstTimestamp,
|
|
@@ -3452,6 +3668,7 @@ var init_gemini = __esm({
|
|
|
3452
3668
|
"../parser/dist/gemini.js"() {
|
|
3453
3669
|
"use strict";
|
|
3454
3670
|
init_analytics();
|
|
3671
|
+
init_git_project();
|
|
3455
3672
|
init_user_input();
|
|
3456
3673
|
DEFAULT_GEMINI_ROOT = path3.join(os3.homedir(), ".gemini", "tmp");
|
|
3457
3674
|
GEMINI_PROJECTS_FILE = path3.join(os3.homedir(), ".gemini", "projects.json");
|
|
@@ -3725,13 +3942,16 @@ async function parseSession2(file) {
|
|
|
3725
3942
|
const durationMs = firstTimestamp && lastTimestamp ? Date.parse(lastTimestamp) - Date.parse(firstTimestamp) : void 0;
|
|
3726
3943
|
const sessionId = file.conversationId;
|
|
3727
3944
|
const cwd = file.cwd;
|
|
3728
|
-
const
|
|
3945
|
+
const project = cwd ? resolveProjectIdentity(cwd) : void 0;
|
|
3946
|
+
const projectName = project?.projectName ?? file.conversationId;
|
|
3729
3947
|
const projectDir = cwd ? cwd.replace(/^\//, "-").replace(/\//g, "-") : file.conversationId;
|
|
3730
3948
|
const meta = {
|
|
3731
3949
|
agent: "antigravity",
|
|
3732
3950
|
id: sessionId,
|
|
3733
3951
|
filePath: file.filePath,
|
|
3734
3952
|
projectName,
|
|
3953
|
+
worktreeName: project?.worktreeName,
|
|
3954
|
+
repoName: project?.repoName,
|
|
3735
3955
|
projectDir,
|
|
3736
3956
|
sessionId,
|
|
3737
3957
|
firstTimestamp,
|
|
@@ -3838,6 +4058,7 @@ var init_antigravity = __esm({
|
|
|
3838
4058
|
"../parser/dist/antigravity.js"() {
|
|
3839
4059
|
"use strict";
|
|
3840
4060
|
init_analytics();
|
|
4061
|
+
init_git_project();
|
|
3841
4062
|
init_user_input();
|
|
3842
4063
|
DEFAULT_ANTIGRAVITY_ROOT = path4.join(os4.homedir(), ".gemini", "antigravity-cli");
|
|
3843
4064
|
IDLE_GAP_MS3 = 3 * 60 * 1e3;
|
|
@@ -3957,8 +4178,10 @@ function resolveProject(meta, spaceIdToPath) {
|
|
|
3957
4178
|
if (!projectPath) {
|
|
3958
4179
|
return { projectName: "cowork:unspaced", projectDir: "cowork-unspaced" };
|
|
3959
4180
|
}
|
|
4181
|
+
const project = resolveProjectIdentity(projectPath);
|
|
3960
4182
|
return {
|
|
3961
|
-
projectName:
|
|
4183
|
+
projectName: project.projectName,
|
|
4184
|
+
worktreeName: project.worktreeName,
|
|
3962
4185
|
projectDir: projectPath.replace(/^\//, "-").replace(/\//g, "-"),
|
|
3963
4186
|
cwd: projectPath
|
|
3964
4187
|
};
|
|
@@ -4185,8 +4408,8 @@ var DEFAULT_COWORK_ROOT, SESSION_ID_RE, spacesCache, metaCache5, detailCache5;
|
|
|
4185
4408
|
var init_cowork = __esm({
|
|
4186
4409
|
"../parser/dist/cowork.js"() {
|
|
4187
4410
|
"use strict";
|
|
4188
|
-
init_analytics();
|
|
4189
4411
|
init_claude_code();
|
|
4412
|
+
init_git_project();
|
|
4190
4413
|
init_parser();
|
|
4191
4414
|
DEFAULT_COWORK_ROOT = defaultCoworkRoot();
|
|
4192
4415
|
SESSION_ID_RE = /^local_[0-9a-f-]+$/;
|
|
@@ -4197,21 +4420,21 @@ var init_cowork = __esm({
|
|
|
4197
4420
|
});
|
|
4198
4421
|
|
|
4199
4422
|
// ../parser/dist/team-config.js
|
|
4200
|
-
import { readFileSync as
|
|
4201
|
-
import { join as
|
|
4202
|
-
function shouldSyncProject(
|
|
4423
|
+
import { readFileSync as readFileSync4, writeFileSync, unlinkSync, mkdirSync as mkdirSync2, renameSync } from "node:fs";
|
|
4424
|
+
import { join as join3 } from "node:path";
|
|
4425
|
+
function shouldSyncProject(projectKey2, sp) {
|
|
4203
4426
|
if (!sp)
|
|
4204
4427
|
return true;
|
|
4205
|
-
if (sp.excluded.includes(
|
|
4428
|
+
if (sp.excluded.includes(projectKey2))
|
|
4206
4429
|
return false;
|
|
4207
|
-
if (sp.included.includes(
|
|
4430
|
+
if (sp.included.includes(projectKey2))
|
|
4208
4431
|
return true;
|
|
4209
4432
|
return sp.autoIncludeNew;
|
|
4210
4433
|
}
|
|
4211
4434
|
function readTeamConfig(dir) {
|
|
4212
4435
|
const d = dir ?? cclensHome();
|
|
4213
4436
|
try {
|
|
4214
|
-
return JSON.parse(
|
|
4437
|
+
return JSON.parse(readFileSync4(join3(d, CONFIG_FILE), "utf8"));
|
|
4215
4438
|
} catch {
|
|
4216
4439
|
return null;
|
|
4217
4440
|
}
|
|
@@ -4219,14 +4442,14 @@ function readTeamConfig(dir) {
|
|
|
4219
4442
|
function writeTeamConfig(config, dir) {
|
|
4220
4443
|
const d = dir ?? cclensHome();
|
|
4221
4444
|
mkdirSync2(d, { recursive: true });
|
|
4222
|
-
const tmp =
|
|
4445
|
+
const tmp = join3(d, `${CONFIG_FILE}.${process.pid}.tmp`);
|
|
4223
4446
|
writeFileSync(tmp, JSON.stringify(config, null, 2), { mode: 384 });
|
|
4224
|
-
renameSync(tmp,
|
|
4447
|
+
renameSync(tmp, join3(d, CONFIG_FILE));
|
|
4225
4448
|
}
|
|
4226
4449
|
function clearTeamConfig(dir) {
|
|
4227
4450
|
const d = dir ?? cclensHome();
|
|
4228
4451
|
try {
|
|
4229
|
-
unlinkSync(
|
|
4452
|
+
unlinkSync(join3(d, CONFIG_FILE));
|
|
4230
4453
|
} catch {
|
|
4231
4454
|
}
|
|
4232
4455
|
}
|
|
@@ -4292,8 +4515,10 @@ __export(fs_exports, {
|
|
|
4292
4515
|
loadTeamForSession: () => loadTeamForSession,
|
|
4293
4516
|
loadUsageByDay: () => loadUsageByDay,
|
|
4294
4517
|
loadWorkflowAgentDetail: () => loadWorkflowAgentDetail,
|
|
4518
|
+
readGitFolder: () => readGitFolder,
|
|
4295
4519
|
readJsonlFile: () => readJsonlFile,
|
|
4296
4520
|
readTeamConfig: () => readTeamConfig,
|
|
4521
|
+
resolveProjectIdentity: () => resolveProjectIdentity,
|
|
4297
4522
|
sessionIdFromFileName: () => sessionIdFromFileName,
|
|
4298
4523
|
shouldSyncProject: () => shouldSyncProject,
|
|
4299
4524
|
walkJsonlFiles: () => walkJsonlFiles,
|
|
@@ -4569,6 +4794,7 @@ var init_fs = __esm({
|
|
|
4569
4794
|
init_antigravity();
|
|
4570
4795
|
init_cowork();
|
|
4571
4796
|
init_claude_code();
|
|
4797
|
+
init_git_project();
|
|
4572
4798
|
init_codex();
|
|
4573
4799
|
init_gemini();
|
|
4574
4800
|
init_antigravity();
|
|
@@ -5058,6 +5284,7 @@ __export(dist_exports, {
|
|
|
5058
5284
|
buildGanttDay: () => buildGanttDay,
|
|
5059
5285
|
buildMegaRows: () => buildMegaRows,
|
|
5060
5286
|
buildPresentation: () => buildPresentation,
|
|
5287
|
+
buildProjectKeyResolver: () => buildProjectKeyResolver,
|
|
5061
5288
|
buildSpendIndex: () => buildSpendIndex,
|
|
5062
5289
|
calendarMonth: () => calendarMonth,
|
|
5063
5290
|
calendarWeek: () => calendarWeek,
|
|
@@ -5086,10 +5313,12 @@ __export(dist_exports, {
|
|
|
5086
5313
|
predictAnchored: () => predictAnchored,
|
|
5087
5314
|
priorCalendarMonth: () => priorCalendarMonth,
|
|
5088
5315
|
priorCalendarWeek: () => priorCalendarWeek,
|
|
5316
|
+
projectKey: () => projectKey,
|
|
5089
5317
|
projectRepoName: () => projectRepoName,
|
|
5090
5318
|
rowPrimaryIndex: () => rowPrimaryIndex,
|
|
5091
5319
|
sessionAirTimeMs: () => sessionAirTimeMs,
|
|
5092
5320
|
sessionDay: () => sessionDay,
|
|
5321
|
+
sessionProjectKey: () => sessionProjectKey,
|
|
5093
5322
|
stripFrameworkBoilerplate: () => stripFrameworkBoilerplate,
|
|
5094
5323
|
summarizeBursts: () => summarizeBursts,
|
|
5095
5324
|
toLocalDay: () => toLocalDay,
|
|
@@ -5118,25 +5347,25 @@ __export(file_probe_exports, {
|
|
|
5118
5347
|
probeArtifactSignals: () => probeArtifactSignals
|
|
5119
5348
|
});
|
|
5120
5349
|
import { createHash } from "node:crypto";
|
|
5121
|
-
import { existsSync as
|
|
5122
|
-
import { homedir as
|
|
5123
|
-
import { join as
|
|
5350
|
+
import { existsSync as existsSync7, readdirSync as readdirSync3, statSync as statSync5 } from "node:fs";
|
|
5351
|
+
import { homedir as homedir3 } from "node:os";
|
|
5352
|
+
import { join as join8, relative, resolve as resolve3, sep } from "node:path";
|
|
5124
5353
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
5125
5354
|
function pathHash(relPath) {
|
|
5126
5355
|
return createHash("sha256").update(relPath.split(sep).join("/")).digest("hex").slice(0, 32);
|
|
5127
5356
|
}
|
|
5128
5357
|
function defaultScanRoots(extraRoots = []) {
|
|
5129
5358
|
const roots = [];
|
|
5130
|
-
const home =
|
|
5131
|
-
if (
|
|
5359
|
+
const home = join8(homedir3(), ".claude");
|
|
5360
|
+
if (existsSync7(home)) roots.push({ root: home, label: "user" });
|
|
5132
5361
|
for (const e of extraRoots) {
|
|
5133
|
-
const r =
|
|
5134
|
-
if (
|
|
5362
|
+
const r = resolve3(e, ".claude");
|
|
5363
|
+
if (existsSync7(r) && r !== home) roots.push({ root: r, label: "project" });
|
|
5135
5364
|
}
|
|
5136
5365
|
return roots;
|
|
5137
5366
|
}
|
|
5138
5367
|
function listMarkdownFiles(dir) {
|
|
5139
|
-
if (!
|
|
5368
|
+
if (!existsSync7(dir)) return [];
|
|
5140
5369
|
const out = [];
|
|
5141
5370
|
let entries;
|
|
5142
5371
|
try {
|
|
@@ -5146,10 +5375,10 @@ function listMarkdownFiles(dir) {
|
|
|
5146
5375
|
}
|
|
5147
5376
|
for (const name of entries) {
|
|
5148
5377
|
if (name.startsWith(".")) continue;
|
|
5149
|
-
const full =
|
|
5378
|
+
const full = join8(dir, name);
|
|
5150
5379
|
let stat;
|
|
5151
5380
|
try {
|
|
5152
|
-
stat =
|
|
5381
|
+
stat = statSync5(full);
|
|
5153
5382
|
} catch {
|
|
5154
5383
|
continue;
|
|
5155
5384
|
}
|
|
@@ -5166,19 +5395,19 @@ function firstSeenDateOf(file) {
|
|
|
5166
5395
|
const out = execFileSync2(
|
|
5167
5396
|
"git",
|
|
5168
5397
|
["log", "--diff-filter=A", "--follow", "--format=%cs", "--", file],
|
|
5169
|
-
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd:
|
|
5398
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname8(file) }
|
|
5170
5399
|
).trim().split("\n").filter(Boolean);
|
|
5171
5400
|
if (out.length > 0) return out[out.length - 1];
|
|
5172
5401
|
} catch {
|
|
5173
5402
|
}
|
|
5174
5403
|
try {
|
|
5175
|
-
const s =
|
|
5404
|
+
const s = statSync5(file);
|
|
5176
5405
|
return localDay(s.birthtime || s.mtime);
|
|
5177
5406
|
} catch {
|
|
5178
5407
|
return todayLocal();
|
|
5179
5408
|
}
|
|
5180
5409
|
}
|
|
5181
|
-
function
|
|
5410
|
+
function dirname8(p) {
|
|
5182
5411
|
const i = p.lastIndexOf(sep);
|
|
5183
5412
|
return i < 0 ? "." : p.slice(0, i);
|
|
5184
5413
|
}
|
|
@@ -5205,8 +5434,8 @@ function todayLocal() {
|
|
|
5205
5434
|
function scanAuthored(roots, subdir, day) {
|
|
5206
5435
|
const out = [];
|
|
5207
5436
|
for (const r of roots) {
|
|
5208
|
-
const dir =
|
|
5209
|
-
if (!
|
|
5437
|
+
const dir = join8(r.root, subdir);
|
|
5438
|
+
if (!existsSync7(dir)) continue;
|
|
5210
5439
|
for (const f of listMarkdownFiles(dir)) {
|
|
5211
5440
|
const firstSeen = firstSeenDateOf(f);
|
|
5212
5441
|
if (firstSeen !== day) continue;
|
|
@@ -5219,14 +5448,14 @@ function scanAuthored(roots, subdir, day) {
|
|
|
5219
5448
|
function scanEdited(roots, day) {
|
|
5220
5449
|
const out = [];
|
|
5221
5450
|
for (const r of roots) {
|
|
5222
|
-
const dir =
|
|
5223
|
-
if (!
|
|
5451
|
+
const dir = join8(r.root, "skills");
|
|
5452
|
+
if (!existsSync7(dir)) continue;
|
|
5224
5453
|
for (const f of listMarkdownFiles(dir)) {
|
|
5225
5454
|
const firstSeen = firstSeenDateOf(f);
|
|
5226
5455
|
if (firstSeen === day) continue;
|
|
5227
5456
|
let stat;
|
|
5228
5457
|
try {
|
|
5229
|
-
stat =
|
|
5458
|
+
stat = statSync5(f);
|
|
5230
5459
|
} catch {
|
|
5231
5460
|
continue;
|
|
5232
5461
|
}
|
|
@@ -5242,17 +5471,17 @@ function claudemdLineDelta(extraRoots, authorEmail, day) {
|
|
|
5242
5471
|
let delta = 0;
|
|
5243
5472
|
const candidates = [];
|
|
5244
5473
|
for (const e of extraRoots) {
|
|
5245
|
-
const f =
|
|
5246
|
-
if (
|
|
5474
|
+
const f = resolve3(e, "CLAUDE.md");
|
|
5475
|
+
if (existsSync7(f)) candidates.push(f);
|
|
5247
5476
|
}
|
|
5248
|
-
const homeClaudeMd =
|
|
5249
|
-
if (
|
|
5477
|
+
const homeClaudeMd = join8(homedir3(), "CLAUDE.md");
|
|
5478
|
+
if (existsSync7(homeClaudeMd)) candidates.push(homeClaudeMd);
|
|
5250
5479
|
for (const file of candidates) {
|
|
5251
5480
|
try {
|
|
5252
5481
|
const out = execFileSync2(
|
|
5253
5482
|
"git",
|
|
5254
5483
|
["log", "--numstat", "--format=COMMIT %cs %ae", "--", file],
|
|
5255
|
-
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd:
|
|
5484
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], cwd: dirname8(file) }
|
|
5256
5485
|
);
|
|
5257
5486
|
let currentDate = "";
|
|
5258
5487
|
let currentEmail = "";
|
|
@@ -5303,8 +5532,8 @@ var init_file_probe = __esm({
|
|
|
5303
5532
|
|
|
5304
5533
|
// src/daemon-worker.ts
|
|
5305
5534
|
import { spawn as spawn2 } from "node:child_process";
|
|
5306
|
-
import { closeSync, existsSync as
|
|
5307
|
-
import { dirname as
|
|
5535
|
+
import { closeSync, existsSync as existsSync14, mkdirSync as mkdirSync13, openSync, readFileSync as readFileSync17, writeFileSync as writeFileSync12 } from "node:fs";
|
|
5536
|
+
import { dirname as dirname11, join as join12 } from "node:path";
|
|
5308
5537
|
import { fileURLToPath } from "node:url";
|
|
5309
5538
|
|
|
5310
5539
|
// src/usage/token.ts
|
|
@@ -5486,9 +5715,9 @@ import { randomUUID } from "node:crypto";
|
|
|
5486
5715
|
|
|
5487
5716
|
// ../entries/dist/fs.js
|
|
5488
5717
|
init_fs();
|
|
5489
|
-
import { readFileSync as
|
|
5718
|
+
import { readFileSync as readFileSync6, readdirSync as readdirSync2, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, renameSync as renameSync3, existsSync as existsSync4 } from "node:fs";
|
|
5490
5719
|
import { randomBytes } from "node:crypto";
|
|
5491
|
-
import { join as
|
|
5720
|
+
import { join as join5 } from "node:path";
|
|
5492
5721
|
|
|
5493
5722
|
// ../entries/dist/types.js
|
|
5494
5723
|
var CURRENT_ENTRY_SCHEMA_VERSION = 2;
|
|
@@ -5561,12 +5790,12 @@ var PROMPT_FRAME_ORIGIN = {
|
|
|
5561
5790
|
|
|
5562
5791
|
// ../entries/dist/digest-fs.js
|
|
5563
5792
|
init_fs();
|
|
5564
|
-
import { readFileSync as
|
|
5565
|
-
import { dirname as
|
|
5793
|
+
import { readFileSync as readFileSync5, readdirSync, writeFileSync as writeFileSync2, renameSync as renameSync2, chmodSync, mkdirSync as mkdirSync3, existsSync as existsSync3 } from "node:fs";
|
|
5794
|
+
import { dirname as dirname3, join as join4 } from "node:path";
|
|
5566
5795
|
var digestsDirCached = null;
|
|
5567
5796
|
function parseDigestFile(path7, expectedVersion) {
|
|
5568
5797
|
try {
|
|
5569
|
-
const parsed = JSON.parse(
|
|
5798
|
+
const parsed = JSON.parse(readFileSync5(path7, "utf8"));
|
|
5570
5799
|
if (!parsed || typeof parsed !== "object")
|
|
5571
5800
|
return null;
|
|
5572
5801
|
if (parsed.version !== expectedVersion)
|
|
@@ -5586,14 +5815,14 @@ function digestsDir() {
|
|
|
5586
5815
|
return digestsDirCached;
|
|
5587
5816
|
}
|
|
5588
5817
|
function dayDigestPath(date) {
|
|
5589
|
-
return
|
|
5818
|
+
return join4(digestsDir(), "day", `${date}.json`);
|
|
5590
5819
|
}
|
|
5591
5820
|
function weekDigestPath(monday) {
|
|
5592
|
-
return
|
|
5821
|
+
return join4(digestsDir(), "week", `${monday}.json`);
|
|
5593
5822
|
}
|
|
5594
5823
|
function writeDayDigest(digest) {
|
|
5595
5824
|
const final = dayDigestPath(digest.key);
|
|
5596
|
-
mkdirSync3(
|
|
5825
|
+
mkdirSync3(dirname3(final), { recursive: true });
|
|
5597
5826
|
const tmp = `${final}.tmp`;
|
|
5598
5827
|
writeFileSync2(tmp, JSON.stringify(digest, null, 2), "utf8");
|
|
5599
5828
|
if (process.platform !== "win32") {
|
|
@@ -5606,7 +5835,7 @@ function writeDayDigest(digest) {
|
|
|
5606
5835
|
}
|
|
5607
5836
|
function readDayDigest(date) {
|
|
5608
5837
|
const p = dayDigestPath(date);
|
|
5609
|
-
if (!
|
|
5838
|
+
if (!existsSync3(p))
|
|
5610
5839
|
return null;
|
|
5611
5840
|
return parseDigestFile(p, CURRENT_DAY_DIGEST_SCHEMA_VERSION);
|
|
5612
5841
|
}
|
|
@@ -5626,7 +5855,7 @@ function setTodayDigestInCache(date, digest, nowMs) {
|
|
|
5626
5855
|
}
|
|
5627
5856
|
function writeWeekDigest(digest) {
|
|
5628
5857
|
const final = weekDigestPath(digest.key);
|
|
5629
|
-
mkdirSync3(
|
|
5858
|
+
mkdirSync3(dirname3(final), { recursive: true });
|
|
5630
5859
|
const tmp = `${final}.tmp`;
|
|
5631
5860
|
writeFileSync2(tmp, JSON.stringify(digest, null, 2), "utf8");
|
|
5632
5861
|
if (process.platform !== "win32") {
|
|
@@ -5639,7 +5868,7 @@ function writeWeekDigest(digest) {
|
|
|
5639
5868
|
}
|
|
5640
5869
|
function readWeekDigest(monday) {
|
|
5641
5870
|
const p = weekDigestPath(monday);
|
|
5642
|
-
if (!
|
|
5871
|
+
if (!existsSync3(p))
|
|
5643
5872
|
return null;
|
|
5644
5873
|
return parseDigestFile(p, CURRENT_WEEK_DIGEST_SCHEMA_VERSION);
|
|
5645
5874
|
}
|
|
@@ -5669,7 +5898,7 @@ function entriesDir() {
|
|
|
5669
5898
|
return entriesDirCached;
|
|
5670
5899
|
}
|
|
5671
5900
|
function pathFor(sessionId, localDay2) {
|
|
5672
|
-
return
|
|
5901
|
+
return join5(entriesDir(), `${entryKey(sessionId, localDay2)}.json`);
|
|
5673
5902
|
}
|
|
5674
5903
|
function tmpPathFor(final) {
|
|
5675
5904
|
return `${final}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
|
|
@@ -5717,17 +5946,17 @@ function writeEntryPreservingEnrichment(fresh) {
|
|
|
5717
5946
|
}
|
|
5718
5947
|
function readEntry(sessionId, localDay2) {
|
|
5719
5948
|
const p = pathFor(sessionId, localDay2);
|
|
5720
|
-
if (!
|
|
5949
|
+
if (!existsSync4(p))
|
|
5721
5950
|
return null;
|
|
5722
|
-
const raw =
|
|
5951
|
+
const raw = readFileSync6(p, "utf8");
|
|
5723
5952
|
return JSON.parse(raw);
|
|
5724
5953
|
}
|
|
5725
5954
|
function entryExists(sessionId, localDay2) {
|
|
5726
|
-
return
|
|
5955
|
+
return existsSync4(pathFor(sessionId, localDay2));
|
|
5727
5956
|
}
|
|
5728
5957
|
function listEntryKeys() {
|
|
5729
5958
|
const dir = entriesDir();
|
|
5730
|
-
if (!
|
|
5959
|
+
if (!existsSync4(dir))
|
|
5731
5960
|
return [];
|
|
5732
5961
|
return readdirSync2(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -".json".length));
|
|
5733
5962
|
}
|
|
@@ -5746,8 +5975,8 @@ function listEntriesForDay(localDay2) {
|
|
|
5746
5975
|
|
|
5747
5976
|
// src/perception/build-entries.ts
|
|
5748
5977
|
init_dist();
|
|
5749
|
-
import { statSync, readFileSync as
|
|
5750
|
-
import { basename, dirname as
|
|
5978
|
+
import { statSync as statSync2, readFileSync as readFileSync7 } from "node:fs";
|
|
5979
|
+
import { basename as basename2, dirname as dirname4 } from "node:path";
|
|
5751
5980
|
|
|
5752
5981
|
// ../entries/dist/signals.js
|
|
5753
5982
|
init_dist();
|
|
@@ -6338,6 +6567,7 @@ function buildEntries(sessionDetail) {
|
|
|
6338
6567
|
const entries = [];
|
|
6339
6568
|
const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6340
6569
|
const sessionFallbackProject = canonicalProjectName(sessionDetail.projectName ?? "");
|
|
6570
|
+
const trustSessionProject = !!sessionDetail.worktreeName;
|
|
6341
6571
|
for (const [local_day, dayEvents] of byDay) {
|
|
6342
6572
|
if (dayEvents.length === 0)
|
|
6343
6573
|
continue;
|
|
@@ -6402,7 +6632,7 @@ function buildEntries(sessionDetail) {
|
|
|
6402
6632
|
const finalAgentRaw = agg.finalAgent ?? "";
|
|
6403
6633
|
const final_agent = trunc(minimizeImages(finalAgentRaw), 400);
|
|
6404
6634
|
let project = sessionFallbackProject;
|
|
6405
|
-
if (agg.cwdCounts.size > 0) {
|
|
6635
|
+
if (!trustSessionProject && agg.cwdCounts.size > 0) {
|
|
6406
6636
|
const best = [...agg.cwdCounts.entries()].sort((a, b) => b[1] - a[1])[0];
|
|
6407
6637
|
project = canonicalProjectName(best[0]);
|
|
6408
6638
|
}
|
|
@@ -6484,8 +6714,8 @@ function decodeProjectDirName(projectDir) {
|
|
|
6484
6714
|
return projectDir.replace(/-/g, "/");
|
|
6485
6715
|
}
|
|
6486
6716
|
function buildEntriesForFile(filePath) {
|
|
6487
|
-
const stat =
|
|
6488
|
-
const raw =
|
|
6717
|
+
const stat = statSync2(filePath);
|
|
6718
|
+
const raw = readFileSync7(filePath, "utf8");
|
|
6489
6719
|
const rawLines = raw.split("\n").filter(Boolean).map((l) => {
|
|
6490
6720
|
try {
|
|
6491
6721
|
return JSON.parse(l);
|
|
@@ -6495,8 +6725,8 @@ function buildEntriesForFile(filePath) {
|
|
|
6495
6725
|
}).filter((x) => x !== null);
|
|
6496
6726
|
if (rawLines.length === 0) return null;
|
|
6497
6727
|
const { meta, events } = parseTranscript(rawLines);
|
|
6498
|
-
const fileName =
|
|
6499
|
-
const projectDir =
|
|
6728
|
+
const fileName = basename2(filePath);
|
|
6729
|
+
const projectDir = basename2(dirname4(filePath));
|
|
6500
6730
|
const sessionId = fileName.replace(/\.jsonl$/, "");
|
|
6501
6731
|
const sd = {
|
|
6502
6732
|
...meta,
|
|
@@ -6577,7 +6807,7 @@ function clipSegmentsToDay(segments, bounds) {
|
|
|
6577
6807
|
}
|
|
6578
6808
|
function filterSyncedSessions(sessions, syncProjects) {
|
|
6579
6809
|
if (!syncProjects) return sessions;
|
|
6580
|
-
return sessions.filter((s) => shouldSyncProject(
|
|
6810
|
+
return sessions.filter((s) => shouldSyncProject(projectKey(s.projectName), syncProjects));
|
|
6581
6811
|
}
|
|
6582
6812
|
function sessionTouchesDay(s, day) {
|
|
6583
6813
|
const bounds = dayBoundsMs(day);
|
|
@@ -6618,7 +6848,7 @@ function buildRichRollupBlocks(day, daySessions, entries, resolveRepo) {
|
|
|
6618
6848
|
const projects = /* @__PURE__ */ new Map();
|
|
6619
6849
|
for (const s of clippedSessions) {
|
|
6620
6850
|
const canonical = canonicalProjectName(s.projectName);
|
|
6621
|
-
const name =
|
|
6851
|
+
const name = projectKey(s.projectName);
|
|
6622
6852
|
const repo = resolveRepo?.(canonical) ?? sessionRepo.get(s.id);
|
|
6623
6853
|
const key = repo ?? name;
|
|
6624
6854
|
const ms = s.activeSegments.reduce((sum, seg) => sum + (seg.endMs - seg.startMs), 0);
|
|
@@ -6661,7 +6891,7 @@ function buildRichRollupBlocks(day, daySessions, entries, resolveRepo) {
|
|
|
6661
6891
|
commits += e.numbers.commits;
|
|
6662
6892
|
pushes += e.numbers.pushes;
|
|
6663
6893
|
if (e.github_repos?.length) {
|
|
6664
|
-
const key = sessionRepo.get(e.session_id) ??
|
|
6894
|
+
const key = sessionRepo.get(e.session_id) ?? projectKey(e.project);
|
|
6665
6895
|
const set = projectRepos.get(key) ?? /* @__PURE__ */ new Set();
|
|
6666
6896
|
for (const r of e.github_repos) set.add(r);
|
|
6667
6897
|
projectRepos.set(key, set);
|
|
@@ -6746,7 +6976,7 @@ function buildIngestPayload(inputs) {
|
|
|
6746
6976
|
return {
|
|
6747
6977
|
ingestId: randomUUID(),
|
|
6748
6978
|
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6749
|
-
cliVersion: "0.15.
|
|
6979
|
+
cliVersion: "0.15.3",
|
|
6750
6980
|
...richRollup || inputs.enrichedExtras || inputs.artifactSignals ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
|
|
6751
6981
|
...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
|
|
6752
6982
|
...richRollup ? { richRollup } : {},
|
|
@@ -6773,14 +7003,14 @@ async function pushToTeamServer(config, payload) {
|
|
|
6773
7003
|
}
|
|
6774
7004
|
|
|
6775
7005
|
// src/team/git-remote.ts
|
|
6776
|
-
import { existsSync as
|
|
6777
|
-
import { dirname as
|
|
7006
|
+
import { existsSync as existsSync5, readFileSync as readFileSync8, statSync as statSync3 } from "node:fs";
|
|
7007
|
+
import { dirname as dirname5, isAbsolute as isAbsolute2, join as join6, resolve as resolve2 } from "node:path";
|
|
6778
7008
|
var GITHUB_URL_RE = /github\.com[:/]([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+?)(?:\.git)?$/;
|
|
6779
7009
|
function parseGithubRemote(url) {
|
|
6780
7010
|
const m = url.trim().match(GITHUB_URL_RE);
|
|
6781
7011
|
return m ? `${m[1]}/${m[2]}`.toLowerCase() : null;
|
|
6782
7012
|
}
|
|
6783
|
-
function
|
|
7013
|
+
function originUrl2(configText) {
|
|
6784
7014
|
let inOrigin = false;
|
|
6785
7015
|
for (const line of configText.split("\n")) {
|
|
6786
7016
|
const t = line.trim();
|
|
@@ -6795,36 +7025,36 @@ function originUrl(configText) {
|
|
|
6795
7025
|
return null;
|
|
6796
7026
|
}
|
|
6797
7027
|
function gitConfigPathFor(dir) {
|
|
6798
|
-
const dotGit =
|
|
6799
|
-
const st =
|
|
7028
|
+
const dotGit = join6(dir, ".git");
|
|
7029
|
+
const st = statSync3(dotGit, { throwIfNoEntry: false });
|
|
6800
7030
|
if (!st) return null;
|
|
6801
|
-
if (st.isDirectory()) return
|
|
6802
|
-
const m =
|
|
7031
|
+
if (st.isDirectory()) return join6(dotGit, "config");
|
|
7032
|
+
const m = readFileSync8(dotGit, "utf8").match(/^gitdir:\s*(.+)\s*$/m);
|
|
6803
7033
|
if (!m) return null;
|
|
6804
|
-
const gd =
|
|
6805
|
-
const commondirFile =
|
|
6806
|
-
if (
|
|
6807
|
-
const common =
|
|
6808
|
-
return
|
|
7034
|
+
const gd = isAbsolute2(m[1]) ? m[1] : resolve2(dir, m[1]);
|
|
7035
|
+
const commondirFile = join6(gd, "commondir");
|
|
7036
|
+
if (existsSync5(commondirFile)) {
|
|
7037
|
+
const common = readFileSync8(commondirFile, "utf8").trim();
|
|
7038
|
+
return join6(isAbsolute2(common) ? common : resolve2(gd, common), "config");
|
|
6809
7039
|
}
|
|
6810
|
-
return
|
|
7040
|
+
return join6(gd, "config");
|
|
6811
7041
|
}
|
|
6812
7042
|
function createRepoResolver() {
|
|
6813
7043
|
const cache = /* @__PURE__ */ new Map();
|
|
6814
7044
|
return (dir) => {
|
|
6815
|
-
if (!dir || !
|
|
7045
|
+
if (!dir || !isAbsolute2(dir)) return null;
|
|
6816
7046
|
const hit = cache.get(dir);
|
|
6817
7047
|
if (hit !== void 0) return hit;
|
|
6818
7048
|
let repo = null;
|
|
6819
7049
|
try {
|
|
6820
|
-
for (let d = dir; ; d =
|
|
7050
|
+
for (let d = dir; ; d = dirname5(d)) {
|
|
6821
7051
|
const config = gitConfigPathFor(d);
|
|
6822
|
-
if (config &&
|
|
6823
|
-
const url =
|
|
7052
|
+
if (config && existsSync5(config)) {
|
|
7053
|
+
const url = originUrl2(readFileSync8(config, "utf8"));
|
|
6824
7054
|
repo = url ? parseGithubRemote(url) : null;
|
|
6825
7055
|
break;
|
|
6826
7056
|
}
|
|
6827
|
-
if (d ===
|
|
7057
|
+
if (d === dirname5(d)) break;
|
|
6828
7058
|
}
|
|
6829
7059
|
} catch {
|
|
6830
7060
|
repo = null;
|
|
@@ -6836,17 +7066,17 @@ function createRepoResolver() {
|
|
|
6836
7066
|
|
|
6837
7067
|
// src/team/queue.ts
|
|
6838
7068
|
init_fs();
|
|
6839
|
-
import { readFileSync as
|
|
6840
|
-
import { dirname as
|
|
7069
|
+
import { readFileSync as readFileSync9, writeFileSync as writeFileSync4, appendFileSync as appendFileSync3, statSync as statSync4, mkdirSync as mkdirSync5 } from "node:fs";
|
|
7070
|
+
import { dirname as dirname6 } from "node:path";
|
|
6841
7071
|
var QUEUE_PATH = cclensPath("ingest-queue.jsonl");
|
|
6842
7072
|
var MAX_SIZE_BYTES = 10 * 1024 * 1024;
|
|
6843
7073
|
var MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
6844
7074
|
function enqueuePayload(payload, queuePath = QUEUE_PATH) {
|
|
6845
|
-
mkdirSync5(
|
|
7075
|
+
mkdirSync5(dirname6(queuePath), { recursive: true });
|
|
6846
7076
|
const entry = { payload, enqueuedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
6847
7077
|
appendFileSync3(queuePath, JSON.stringify(entry) + "\n", "utf8");
|
|
6848
7078
|
try {
|
|
6849
|
-
const { size } =
|
|
7079
|
+
const { size } = statSync4(queuePath);
|
|
6850
7080
|
if (size > MAX_SIZE_BYTES) {
|
|
6851
7081
|
pruneOldest(queuePath);
|
|
6852
7082
|
}
|
|
@@ -6856,7 +7086,7 @@ function enqueuePayload(payload, queuePath = QUEUE_PATH) {
|
|
|
6856
7086
|
function dequeuePayloads(queuePath = QUEUE_PATH) {
|
|
6857
7087
|
let lines;
|
|
6858
7088
|
try {
|
|
6859
|
-
lines =
|
|
7089
|
+
lines = readFileSync9(queuePath, "utf8").trim().split("\n").filter(Boolean);
|
|
6860
7090
|
} catch {
|
|
6861
7091
|
return [];
|
|
6862
7092
|
}
|
|
@@ -6877,7 +7107,7 @@ function dequeuePayloads(queuePath = QUEUE_PATH) {
|
|
|
6877
7107
|
function pruneOldest(queuePath) {
|
|
6878
7108
|
let lines;
|
|
6879
7109
|
try {
|
|
6880
|
-
lines =
|
|
7110
|
+
lines = readFileSync9(queuePath, "utf8").trim().split("\n").filter(Boolean);
|
|
6881
7111
|
} catch {
|
|
6882
7112
|
return;
|
|
6883
7113
|
}
|
|
@@ -6890,8 +7120,8 @@ init_storage();
|
|
|
6890
7120
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
6891
7121
|
|
|
6892
7122
|
// src/usage/profile.ts
|
|
6893
|
-
import { existsSync as
|
|
6894
|
-
import { dirname as
|
|
7123
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "node:fs";
|
|
7124
|
+
import { dirname as dirname7 } from "node:path";
|
|
6895
7125
|
var PROFILE_ENDPOINT = "https://api.anthropic.com/api/oauth/profile";
|
|
6896
7126
|
var BETA_HEADER2 = "oauth-2025-04-20";
|
|
6897
7127
|
var PROFILE_CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -6934,9 +7164,9 @@ async function fetchProfile(nowMs = Date.now()) {
|
|
|
6934
7164
|
};
|
|
6935
7165
|
}
|
|
6936
7166
|
function readCachedProfile(cachePath) {
|
|
6937
|
-
if (!
|
|
7167
|
+
if (!existsSync6(cachePath)) return null;
|
|
6938
7168
|
try {
|
|
6939
|
-
const raw = JSON.parse(
|
|
7169
|
+
const raw = JSON.parse(readFileSync10(cachePath, "utf8"));
|
|
6940
7170
|
if (typeof raw.fetchedAtMs !== "number" || !raw.profile) return null;
|
|
6941
7171
|
return raw;
|
|
6942
7172
|
} catch {
|
|
@@ -6944,7 +7174,7 @@ function readCachedProfile(cachePath) {
|
|
|
6944
7174
|
}
|
|
6945
7175
|
}
|
|
6946
7176
|
function writeCachedProfile(cachePath, profile, nowMs = Date.now()) {
|
|
6947
|
-
mkdirSync6(
|
|
7177
|
+
mkdirSync6(dirname7(cachePath), { recursive: true });
|
|
6948
7178
|
writeFileSync5(
|
|
6949
7179
|
cachePath,
|
|
6950
7180
|
JSON.stringify({ fetchedAtMs: nowMs, profile }, null, 2),
|
|
@@ -7105,13 +7335,13 @@ async function runTeamBackfill(log3 = noopLog, filePath = USAGE_LOG, configOverr
|
|
|
7105
7335
|
|
|
7106
7336
|
// src/team/sync-log.ts
|
|
7107
7337
|
init_fs();
|
|
7108
|
-
import { readFileSync as
|
|
7338
|
+
import { readFileSync as readFileSync11 } from "node:fs";
|
|
7109
7339
|
var MAX_LINES = 300;
|
|
7110
7340
|
var MAX_MSG_CHARS = 1900;
|
|
7111
7341
|
function readPendingSyncLog(watermark) {
|
|
7112
7342
|
let raw;
|
|
7113
7343
|
try {
|
|
7114
|
-
raw =
|
|
7344
|
+
raw = readFileSync11(cclensPath("daemon.log"), "utf8");
|
|
7115
7345
|
} catch {
|
|
7116
7346
|
return { lines: [] };
|
|
7117
7347
|
}
|
|
@@ -7132,12 +7362,12 @@ function readPendingSyncLog(watermark) {
|
|
|
7132
7362
|
// src/team/last-push.ts
|
|
7133
7363
|
init_fs();
|
|
7134
7364
|
import { writeFileSync as writeFileSync6, unlinkSync as unlinkSync2, mkdirSync as mkdirSync7 } from "node:fs";
|
|
7135
|
-
import { join as
|
|
7365
|
+
import { join as join7 } from "node:path";
|
|
7136
7366
|
var LAST_PUSH_FILE = "team-last-push.json";
|
|
7137
7367
|
function write(record, dir) {
|
|
7138
7368
|
const d = dir ?? cclensHome();
|
|
7139
7369
|
mkdirSync7(d, { recursive: true });
|
|
7140
|
-
writeFileSync6(
|
|
7370
|
+
writeFileSync6(join7(d, LAST_PUSH_FILE), JSON.stringify(record, null, 2), { mode: 384 });
|
|
7141
7371
|
}
|
|
7142
7372
|
function writeLastPushSuccess(payload, dir) {
|
|
7143
7373
|
write({ pushedAt: (/* @__PURE__ */ new Date()).toISOString(), ok: true, payload }, dir);
|
|
@@ -7161,8 +7391,8 @@ async function dispatchCommand(command, config, log3) {
|
|
|
7161
7391
|
}
|
|
7162
7392
|
}
|
|
7163
7393
|
async function runActivityBackfill(command, config, log3) {
|
|
7164
|
-
const { listSessions: listSessions2, shouldSyncProject: shouldSyncProject2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
7165
|
-
const { toLocalDay: toLocalDay3,
|
|
7394
|
+
const { listSessions: listSessions2, resolveProjectIdentity: resolveProjectIdentity2, shouldSyncProject: shouldSyncProject2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
7395
|
+
const { toLocalDay: toLocalDay3, projectKey: projectKey2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
7166
7396
|
const { probeArtifactSignals: probeArtifactSignals2 } = await Promise.resolve().then(() => (init_file_probe(), file_probe_exports));
|
|
7167
7397
|
const days = command.params.days;
|
|
7168
7398
|
const todayMs = Date.now();
|
|
@@ -7196,7 +7426,7 @@ async function runActivityBackfill(command, config, log3) {
|
|
|
7196
7426
|
const richBlocks = buildRichBlocksForDay(rollup.day, daySessions, resolveRepo);
|
|
7197
7427
|
let artifactSignals = null;
|
|
7198
7428
|
try {
|
|
7199
|
-
const cwdAllowed = shouldSyncProject2(
|
|
7429
|
+
const cwdAllowed = shouldSyncProject2(projectKey2(resolveProjectIdentity2(process.cwd()).projectName), config.syncProjects);
|
|
7200
7430
|
artifactSignals = probeArtifactSignals2({ day: rollup.day, extraRoots: cwdAllowed ? [process.cwd()] : [] });
|
|
7201
7431
|
} catch {
|
|
7202
7432
|
}
|
|
@@ -7227,6 +7457,7 @@ async function runActivityBackfill(command, config, log3) {
|
|
|
7227
7457
|
}
|
|
7228
7458
|
|
|
7229
7459
|
// src/team/sync.ts
|
|
7460
|
+
init_dist();
|
|
7230
7461
|
init_fs();
|
|
7231
7462
|
var inFlightCommands = /* @__PURE__ */ new Set();
|
|
7232
7463
|
var USAGE_LOG2 = cclensPath("usage.jsonl");
|
|
@@ -7341,7 +7572,7 @@ async function runTeamSync(log3 = noopLog2, configOverride, options = {}) {
|
|
|
7341
7572
|
try {
|
|
7342
7573
|
resetEnsuredSessions();
|
|
7343
7574
|
const { listSessions: listSessions2, loadCalibrationCurve: loadCalibrationCurve2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
7344
|
-
const { toLocalDay: toLocalDay3
|
|
7575
|
+
const { toLocalDay: toLocalDay3 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
7345
7576
|
const today = toLocalDay3(Date.now());
|
|
7346
7577
|
let patches = {};
|
|
7347
7578
|
const persistConfig = (patch) => {
|
|
@@ -7528,7 +7759,7 @@ async function runTeamSync(log3 = noopLog2, configOverride, options = {}) {
|
|
|
7528
7759
|
} : void 0;
|
|
7529
7760
|
let artifactSignals = null;
|
|
7530
7761
|
try {
|
|
7531
|
-
const cwdAllowed = shouldSyncProject(
|
|
7762
|
+
const cwdAllowed = shouldSyncProject(projectKey(resolveProjectIdentity(process.cwd()).projectName), config.syncProjects);
|
|
7532
7763
|
artifactSignals = probeArtifactSignals2({ day: rollup.day, extraRoots: cwdAllowed ? [process.cwd()] : [] });
|
|
7533
7764
|
} catch {
|
|
7534
7765
|
}
|
|
@@ -7715,13 +7946,13 @@ async function buildCyclePeaksForPush(planTier, loadCurve) {
|
|
|
7715
7946
|
}
|
|
7716
7947
|
|
|
7717
7948
|
// src/perception/worker.ts
|
|
7718
|
-
import { statSync as
|
|
7949
|
+
import { statSync as statSync6 } from "node:fs";
|
|
7719
7950
|
init_fs();
|
|
7720
7951
|
|
|
7721
7952
|
// src/perception/state.ts
|
|
7722
7953
|
init_fs();
|
|
7723
|
-
import { existsSync as
|
|
7724
|
-
import { dirname as
|
|
7954
|
+
import { existsSync as existsSync8, readFileSync as readFileSync12, writeFileSync as writeFileSync7, mkdirSync as mkdirSync8, renameSync as renameSync4 } from "node:fs";
|
|
7955
|
+
import { dirname as dirname9 } from "node:path";
|
|
7725
7956
|
var STALE_MS = 15 * 60 * 1e3;
|
|
7726
7957
|
var pathCached = null;
|
|
7727
7958
|
function statePath() {
|
|
@@ -7731,7 +7962,7 @@ function statePath() {
|
|
|
7731
7962
|
}
|
|
7732
7963
|
function readState() {
|
|
7733
7964
|
const p = statePath();
|
|
7734
|
-
if (!
|
|
7965
|
+
if (!existsSync8(p)) {
|
|
7735
7966
|
return {
|
|
7736
7967
|
sweep_in_progress: false,
|
|
7737
7968
|
last_sweep_started_at: null,
|
|
@@ -7739,12 +7970,12 @@ function readState() {
|
|
|
7739
7970
|
file_checkpoints: {}
|
|
7740
7971
|
};
|
|
7741
7972
|
}
|
|
7742
|
-
const raw =
|
|
7973
|
+
const raw = readFileSync12(p, "utf8");
|
|
7743
7974
|
return JSON.parse(raw);
|
|
7744
7975
|
}
|
|
7745
7976
|
function writeState(s) {
|
|
7746
7977
|
const p = statePath();
|
|
7747
|
-
mkdirSync8(
|
|
7978
|
+
mkdirSync8(dirname9(p), { recursive: true });
|
|
7748
7979
|
const tmp = `${p}.tmp`;
|
|
7749
7980
|
writeFileSync7(tmp, JSON.stringify(s, null, 2), "utf8");
|
|
7750
7981
|
renameSync4(tmp, p);
|
|
@@ -7776,17 +8007,17 @@ function updateCheckpoint(jsonlPath, cp) {
|
|
|
7776
8007
|
|
|
7777
8008
|
// src/perception/scan.ts
|
|
7778
8009
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
7779
|
-
import { join as
|
|
7780
|
-
import { homedir as
|
|
8010
|
+
import { join as join9 } from "node:path";
|
|
8011
|
+
import { homedir as homedir4 } from "node:os";
|
|
7781
8012
|
async function listAllSessionJsonls(root) {
|
|
7782
|
-
const projectsRoot = root ??
|
|
8013
|
+
const projectsRoot = root ?? join9(homedir4(), ".claude", "projects");
|
|
7783
8014
|
const out = [];
|
|
7784
8015
|
try {
|
|
7785
8016
|
for (const project of readdirSync4(projectsRoot)) {
|
|
7786
|
-
const dir =
|
|
8017
|
+
const dir = join9(projectsRoot, project);
|
|
7787
8018
|
try {
|
|
7788
8019
|
for (const f of readdirSync4(dir)) {
|
|
7789
|
-
if (f.endsWith(".jsonl")) out.push(
|
|
8020
|
+
if (f.endsWith(".jsonl")) out.push(join9(dir, f));
|
|
7790
8021
|
}
|
|
7791
8022
|
} catch {
|
|
7792
8023
|
}
|
|
@@ -7813,7 +8044,7 @@ async function runPerceptionSweep(opts = {}) {
|
|
|
7813
8044
|
const files = await listAllSessionJsonls(opts.projectsRoot);
|
|
7814
8045
|
for (const f of files) {
|
|
7815
8046
|
try {
|
|
7816
|
-
const stat =
|
|
8047
|
+
const stat = statSync6(f);
|
|
7817
8048
|
const prev = state.file_checkpoints[f];
|
|
7818
8049
|
if (prev && prev.byte_offset >= stat.size) continue;
|
|
7819
8050
|
const built = buildEntriesForFile(f);
|
|
@@ -7845,7 +8076,7 @@ async function runPerceptionSweep(opts = {}) {
|
|
|
7845
8076
|
const built = buildEntries(detail);
|
|
7846
8077
|
for (const e of built) {
|
|
7847
8078
|
try {
|
|
7848
|
-
const stat =
|
|
8079
|
+
const stat = statSync6(meta.filePath);
|
|
7849
8080
|
e.source_checkpoint.byte_offset = stat.size;
|
|
7850
8081
|
} catch {
|
|
7851
8082
|
}
|
|
@@ -12002,14 +12233,14 @@ var ENRICHMENT_SYSTEM_PROMPT = SYSTEM_PROMPT;
|
|
|
12002
12233
|
// ../entries/dist/llm-runner.js
|
|
12003
12234
|
init_fs();
|
|
12004
12235
|
import { spawn } from "node:child_process";
|
|
12005
|
-
import { mkdirSync as mkdirSync10, appendFileSync as appendFileSync4, writeFileSync as writeFileSync9, existsSync as
|
|
12006
|
-
import { join as
|
|
12236
|
+
import { mkdirSync as mkdirSync10, appendFileSync as appendFileSync4, writeFileSync as writeFileSync9, existsSync as existsSync10 } from "node:fs";
|
|
12237
|
+
import { join as join11 } from "node:path";
|
|
12007
12238
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
12008
12239
|
|
|
12009
12240
|
// ../entries/dist/tmux-runner.js
|
|
12010
|
-
import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync8, existsSync as
|
|
12011
|
-
import { join as
|
|
12012
|
-
import { homedir as
|
|
12241
|
+
import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync8, existsSync as existsSync9, readdirSync as readdirSync5, realpathSync as realpathSync2, readFileSync as readFileSync13, unlinkSync as unlinkSync3, renameSync as renameSync5 } from "node:fs";
|
|
12242
|
+
import { join as join10 } from "node:path";
|
|
12243
|
+
import { homedir as homedir5 } from "node:os";
|
|
12013
12244
|
import { spawnSync } from "node:child_process";
|
|
12014
12245
|
var TmuxUnavailableError = class extends Error {
|
|
12015
12246
|
constructor(message) {
|
|
@@ -12037,16 +12268,16 @@ function tmuxRunnerAvailable() {
|
|
|
12037
12268
|
return { ok: true };
|
|
12038
12269
|
}
|
|
12039
12270
|
function runtimeCwd() {
|
|
12040
|
-
const dir =
|
|
12041
|
-
if (!
|
|
12271
|
+
const dir = join10(homedir5(), ".cclens", "runtime");
|
|
12272
|
+
if (!existsSync9(dir))
|
|
12042
12273
|
mkdirSync9(dir, { recursive: true });
|
|
12043
|
-
return
|
|
12274
|
+
return realpathSync2(dir);
|
|
12044
12275
|
}
|
|
12045
12276
|
function ensureRuntimeCwdTrusted(cwd) {
|
|
12046
|
-
const cfgPath =
|
|
12277
|
+
const cfgPath = join10(homedir5(), ".claude.json");
|
|
12047
12278
|
let cfg;
|
|
12048
12279
|
try {
|
|
12049
|
-
cfg = JSON.parse(
|
|
12280
|
+
cfg = JSON.parse(readFileSync13(cfgPath, "utf8"));
|
|
12050
12281
|
} catch {
|
|
12051
12282
|
return;
|
|
12052
12283
|
}
|
|
@@ -12089,9 +12320,9 @@ async function runClaudeUnderTmuxImpl(args) {
|
|
|
12089
12320
|
ensureRuntimeCwdTrusted(cwd);
|
|
12090
12321
|
const runId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
12091
12322
|
const sessionName = `cclens-${runId}`;
|
|
12092
|
-
const systemFile =
|
|
12093
|
-
const userFile =
|
|
12094
|
-
const wrapper =
|
|
12323
|
+
const systemFile = join10(cwd, `system-${runId}.txt`);
|
|
12324
|
+
const userFile = join10(cwd, `user-${runId}.txt`);
|
|
12325
|
+
const wrapper = join10(cwd, `run-${runId}.sh`);
|
|
12095
12326
|
writeFileSync8(systemFile, args.systemPrompt);
|
|
12096
12327
|
writeFileSync8(userFile, args.reminder ? `${args.userPrompt}
|
|
12097
12328
|
|
|
@@ -12170,7 +12401,7 @@ function num(v) {
|
|
|
12170
12401
|
function sleep(ms) {
|
|
12171
12402
|
return new Promise((r) => setTimeout(r, ms));
|
|
12172
12403
|
}
|
|
12173
|
-
var PROJECTS_ROOT = () =>
|
|
12404
|
+
var PROJECTS_ROOT = () => join10(homedir5(), ".claude", "projects");
|
|
12174
12405
|
function snapshotAllTranscripts() {
|
|
12175
12406
|
const out = /* @__PURE__ */ new Set();
|
|
12176
12407
|
const root = PROJECTS_ROOT();
|
|
@@ -12181,7 +12412,7 @@ function snapshotAllTranscripts() {
|
|
|
12181
12412
|
return out;
|
|
12182
12413
|
}
|
|
12183
12414
|
for (const sub of subs) {
|
|
12184
|
-
const dir =
|
|
12415
|
+
const dir = join10(root, sub);
|
|
12185
12416
|
let files;
|
|
12186
12417
|
try {
|
|
12187
12418
|
files = readdirSync5(dir);
|
|
@@ -12190,7 +12421,7 @@ function snapshotAllTranscripts() {
|
|
|
12190
12421
|
}
|
|
12191
12422
|
for (const f of files) {
|
|
12192
12423
|
if (f.endsWith(".jsonl"))
|
|
12193
|
-
out.add(
|
|
12424
|
+
out.add(join10(dir, f));
|
|
12194
12425
|
}
|
|
12195
12426
|
}
|
|
12196
12427
|
return out;
|
|
@@ -12198,7 +12429,7 @@ function snapshotAllTranscripts() {
|
|
|
12198
12429
|
function readJsonlCwd(path7, maxLines = 8) {
|
|
12199
12430
|
let raw;
|
|
12200
12431
|
try {
|
|
12201
|
-
raw =
|
|
12432
|
+
raw = readFileSync13(path7, "utf8");
|
|
12202
12433
|
} catch {
|
|
12203
12434
|
return void 0;
|
|
12204
12435
|
}
|
|
@@ -12231,7 +12462,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
|
|
|
12231
12462
|
subs = [];
|
|
12232
12463
|
}
|
|
12233
12464
|
for (const sub of subs) {
|
|
12234
|
-
const dir =
|
|
12465
|
+
const dir = join10(root, sub);
|
|
12235
12466
|
let files;
|
|
12236
12467
|
try {
|
|
12237
12468
|
files = readdirSync5(dir);
|
|
@@ -12241,7 +12472,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
|
|
|
12241
12472
|
for (const f of files) {
|
|
12242
12473
|
if (!f.endsWith(".jsonl"))
|
|
12243
12474
|
continue;
|
|
12244
|
-
const full =
|
|
12475
|
+
const full = join10(dir, f);
|
|
12245
12476
|
if (existingBefore.has(full))
|
|
12246
12477
|
continue;
|
|
12247
12478
|
if (readJsonlCwd(full) === targetCwd)
|
|
@@ -12255,7 +12486,7 @@ async function discoverTranscript(targetCwd, existingBefore, startMs, timeoutMs,
|
|
|
12255
12486
|
function parseTranscript2(path7, defaultModel) {
|
|
12256
12487
|
let raw;
|
|
12257
12488
|
try {
|
|
12258
|
-
raw =
|
|
12489
|
+
raw = readFileSync13(path7, "utf8");
|
|
12259
12490
|
} catch {
|
|
12260
12491
|
return { assembled: "", inputTokens: 0, outputTokens: 0, modelUsed: defaultModel, done: false };
|
|
12261
12492
|
}
|
|
@@ -12315,7 +12546,7 @@ function cleanup(cwd, runId, tmuxBin, sessionName, transcriptPath) {
|
|
|
12315
12546
|
}
|
|
12316
12547
|
for (const f of [`system-${runId}.txt`, `user-${runId}.txt`, `run-${runId}.sh`]) {
|
|
12317
12548
|
try {
|
|
12318
|
-
unlinkSync3(
|
|
12549
|
+
unlinkSync3(join10(cwd, f));
|
|
12319
12550
|
} catch {
|
|
12320
12551
|
}
|
|
12321
12552
|
}
|
|
@@ -12330,7 +12561,7 @@ function shellEscape(s) {
|
|
|
12330
12561
|
// ../entries/dist/llm-runner.js
|
|
12331
12562
|
var RUNS_DIR = cclensPath("llm-runs");
|
|
12332
12563
|
function ensureRunsDir() {
|
|
12333
|
-
if (!
|
|
12564
|
+
if (!existsSync10(RUNS_DIR)) {
|
|
12334
12565
|
try {
|
|
12335
12566
|
mkdirSync10(RUNS_DIR, { recursive: true });
|
|
12336
12567
|
} catch {
|
|
@@ -12359,7 +12590,7 @@ function newRunId(kind) {
|
|
|
12359
12590
|
return `${ts}_${kind}_${short}`;
|
|
12360
12591
|
}
|
|
12361
12592
|
function tracePath(runId) {
|
|
12362
|
-
return
|
|
12593
|
+
return join11(RUNS_DIR, `${runId}.jsonl`);
|
|
12363
12594
|
}
|
|
12364
12595
|
function safeAppend(path7, line) {
|
|
12365
12596
|
try {
|
|
@@ -12447,7 +12678,7 @@ async function runClaudeSubprocess(args) {
|
|
|
12447
12678
|
return runClaudePrintMode(args);
|
|
12448
12679
|
}
|
|
12449
12680
|
function runClaudePrintMode(args) {
|
|
12450
|
-
return new Promise((
|
|
12681
|
+
return new Promise((resolve4, reject) => {
|
|
12451
12682
|
ensureRunsDir();
|
|
12452
12683
|
const kind = detectKindFromSystemPrompt(args.systemPrompt);
|
|
12453
12684
|
const runId = newRunId(kind);
|
|
@@ -12578,7 +12809,7 @@ ${args.reminder}` : args.userPrompt;
|
|
|
12578
12809
|
reject(new Error(`claude exited ${code}: ${stderr.trim().slice(0, 300)}`));
|
|
12579
12810
|
return;
|
|
12580
12811
|
}
|
|
12581
|
-
|
|
12812
|
+
resolve4({ content: buffer, input_tokens: inputTokens, output_tokens: outputTokens, model: modelUsed });
|
|
12582
12813
|
});
|
|
12583
12814
|
proc.on("error", (err) => {
|
|
12584
12815
|
safeAppend(trace, JSON.stringify({ _meta: { type: "spawn_error", run_id: runId, ts: (/* @__PURE__ */ new Date()).toISOString(), error: err.message } }) + "\n");
|
|
@@ -12758,8 +12989,8 @@ function applyEnrichmentError(entry, errorMessage, model, costUsd, generatedAt,
|
|
|
12758
12989
|
|
|
12759
12990
|
// ../entries/dist/budget.js
|
|
12760
12991
|
init_fs();
|
|
12761
|
-
import { appendFileSync as appendFileSync5, readFileSync as
|
|
12762
|
-
import { dirname as
|
|
12992
|
+
import { appendFileSync as appendFileSync5, readFileSync as readFileSync14, existsSync as existsSync11, mkdirSync as mkdirSync11 } from "node:fs";
|
|
12993
|
+
import { dirname as dirname10 } from "node:path";
|
|
12763
12994
|
var spendPathCached = null;
|
|
12764
12995
|
function spendPath() {
|
|
12765
12996
|
if (spendPathCached)
|
|
@@ -12769,17 +13000,17 @@ function spendPath() {
|
|
|
12769
13000
|
}
|
|
12770
13001
|
function appendSpend(record) {
|
|
12771
13002
|
const p = spendPath();
|
|
12772
|
-
mkdirSync11(
|
|
13003
|
+
mkdirSync11(dirname10(p), { recursive: true });
|
|
12773
13004
|
appendFileSync5(p, JSON.stringify(record) + "\n", { encoding: "utf8" });
|
|
12774
13005
|
}
|
|
12775
13006
|
function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
|
|
12776
13007
|
const p = spendPath();
|
|
12777
|
-
if (!
|
|
13008
|
+
if (!existsSync11(p))
|
|
12778
13009
|
return 0;
|
|
12779
13010
|
const year = now.getUTCFullYear();
|
|
12780
13011
|
const month = now.getUTCMonth();
|
|
12781
13012
|
let total = 0;
|
|
12782
|
-
const raw =
|
|
13013
|
+
const raw = readFileSync14(p, "utf8");
|
|
12783
13014
|
for (const line of raw.split("\n")) {
|
|
12784
13015
|
if (!line)
|
|
12785
13016
|
continue;
|
|
@@ -12801,7 +13032,7 @@ function monthToDateSpend(now = /* @__PURE__ */ new Date()) {
|
|
|
12801
13032
|
|
|
12802
13033
|
// ../entries/dist/pipeline-lock.js
|
|
12803
13034
|
init_fs();
|
|
12804
|
-
import { writeFileSync as writeFileSync10, unlinkSync as unlinkSync4, existsSync as
|
|
13035
|
+
import { writeFileSync as writeFileSync10, unlinkSync as unlinkSync4, existsSync as existsSync12, readFileSync as readFileSync15, statSync as statSync7 } from "node:fs";
|
|
12805
13036
|
var STALE_MS2 = 60 * 1e3;
|
|
12806
13037
|
var HEARTBEAT_MS = 30 * 1e3;
|
|
12807
13038
|
var lockPathCached = null;
|
|
@@ -12847,13 +13078,13 @@ function pidAlive(pid) {
|
|
|
12847
13078
|
}
|
|
12848
13079
|
function interactiveLockFresh(nowMs) {
|
|
12849
13080
|
const p = lockPath();
|
|
12850
|
-
if (!
|
|
13081
|
+
if (!existsSync12(p))
|
|
12851
13082
|
return false;
|
|
12852
13083
|
try {
|
|
12853
|
-
const mtime =
|
|
13084
|
+
const mtime = statSync7(p).mtimeMs;
|
|
12854
13085
|
if (nowMs - mtime > STALE_MS2)
|
|
12855
13086
|
return false;
|
|
12856
|
-
const pid = Number(
|
|
13087
|
+
const pid = Number(readFileSync15(p, "utf8").trim());
|
|
12857
13088
|
if (!Number.isFinite(pid) || pid <= 0)
|
|
12858
13089
|
return false;
|
|
12859
13090
|
if (!pidAlive(pid))
|
|
@@ -12868,7 +13099,7 @@ function interactiveLockFresh(nowMs) {
|
|
|
12868
13099
|
var THIRTY_MIN_MS = 30 * 60 * 1e3;
|
|
12869
13100
|
|
|
12870
13101
|
// ../entries/dist/settings.js
|
|
12871
|
-
import { readFileSync as
|
|
13102
|
+
import { readFileSync as readFileSync16, writeFileSync as writeFileSync11, renameSync as renameSync6, chmodSync as chmodSync2, mkdirSync as mkdirSync12, existsSync as existsSync13 } from "node:fs";
|
|
12872
13103
|
init_fs();
|
|
12873
13104
|
var DEFAULT_SETTINGS = {
|
|
12874
13105
|
ai_features: {
|
|
@@ -12900,10 +13131,10 @@ function fromDisk(d) {
|
|
|
12900
13131
|
}
|
|
12901
13132
|
function readSettings() {
|
|
12902
13133
|
const p = settingsPath();
|
|
12903
|
-
if (!
|
|
13134
|
+
if (!existsSync13(p))
|
|
12904
13135
|
return DEFAULT_SETTINGS;
|
|
12905
13136
|
try {
|
|
12906
|
-
const raw =
|
|
13137
|
+
const raw = readFileSync16(p, "utf8");
|
|
12907
13138
|
return fromDisk(JSON.parse(raw));
|
|
12908
13139
|
} catch {
|
|
12909
13140
|
return DEFAULT_SETTINGS;
|
|
@@ -15660,14 +15891,14 @@ async function getUpdateAvailability() {
|
|
|
15660
15891
|
if (isDevMode()) return null;
|
|
15661
15892
|
const latest = await fetchLatestVersion();
|
|
15662
15893
|
if (latest === null) return {
|
|
15663
|
-
current: "0.15.
|
|
15894
|
+
current: "0.15.3",
|
|
15664
15895
|
latest: null,
|
|
15665
15896
|
updateAvailable: false
|
|
15666
15897
|
};
|
|
15667
15898
|
return {
|
|
15668
|
-
current: "0.15.
|
|
15899
|
+
current: "0.15.3",
|
|
15669
15900
|
latest,
|
|
15670
|
-
updateAvailable: shouldUpdate("0.15.
|
|
15901
|
+
updateAvailable: shouldUpdate("0.15.3", latest)
|
|
15671
15902
|
};
|
|
15672
15903
|
}
|
|
15673
15904
|
|
|
@@ -15677,7 +15908,7 @@ var DAEMON_LOG = cclensPath("daemon.log");
|
|
|
15677
15908
|
var UPDATE_STATE = cclensPath("daemon-update.json");
|
|
15678
15909
|
var WATCHDOG_INTERVAL_MS = 5 * 1e3;
|
|
15679
15910
|
var AUTO_UPDATE_INTERVAL_MS = 6 * 60 * 60 * 1e3;
|
|
15680
|
-
mkdirSync13(
|
|
15911
|
+
mkdirSync13(dirname11(USAGE_LOG3), { recursive: true });
|
|
15681
15912
|
function log2(level, message) {
|
|
15682
15913
|
appendDaemonLogLine(level, message);
|
|
15683
15914
|
}
|
|
@@ -15715,7 +15946,7 @@ var perceptionHandle = setInterval(async () => {
|
|
|
15715
15946
|
}, PERCEPTION_INTERVAL_MS);
|
|
15716
15947
|
function readUpdateState() {
|
|
15717
15948
|
try {
|
|
15718
|
-
return JSON.parse(
|
|
15949
|
+
return JSON.parse(readFileSync17(UPDATE_STATE, "utf8"));
|
|
15719
15950
|
} catch {
|
|
15720
15951
|
return null;
|
|
15721
15952
|
}
|
|
@@ -15735,7 +15966,7 @@ function nextUpdateCheckFromState(nowMs) {
|
|
|
15735
15966
|
}
|
|
15736
15967
|
var nextUpdateCheckAtMs = nextUpdateCheckFromState(Date.now());
|
|
15737
15968
|
function cliEntryPath() {
|
|
15738
|
-
return
|
|
15969
|
+
return join12(dirname11(fileURLToPath(import.meta.url)), "index.js");
|
|
15739
15970
|
}
|
|
15740
15971
|
async function runDaemonUpdateCheck() {
|
|
15741
15972
|
if (process.env.FLEETLENS_DAEMON_AUTO_UPDATE === "0") {
|
|
@@ -15767,7 +15998,7 @@ async function runDaemonUpdateCheck() {
|
|
|
15767
15998
|
return;
|
|
15768
15999
|
}
|
|
15769
16000
|
const entry = cliEntryPath();
|
|
15770
|
-
if (!
|
|
16001
|
+
if (!existsSync14(entry)) {
|
|
15771
16002
|
log2("warn", `update check found ${availability.latest}, but CLI entry is missing at ${entry}`);
|
|
15772
16003
|
return;
|
|
15773
16004
|
}
|
|
@@ -15859,7 +16090,7 @@ function scheduleAfter(now, outcome) {
|
|
|
15859
16090
|
nextPollAtMs = now + currentIntervalMs;
|
|
15860
16091
|
}
|
|
15861
16092
|
function sleep2(ms) {
|
|
15862
|
-
return new Promise((
|
|
16093
|
+
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
15863
16094
|
}
|
|
15864
16095
|
async function runLoop() {
|
|
15865
16096
|
while (true) {
|