@philippwassibauer/agentlens 0.1.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/.next/BUILD_ID +1 -0
- package/.next/app-build-manifest.json +44 -0
- package/.next/app-path-routes-manifest.json +1 -0
- package/.next/build-manifest.json +32 -0
- package/.next/export-marker.json +1 -0
- package/.next/images-manifest.json +1 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +1 -0
- package/.next/react-loadable-manifest.json +1 -0
- package/.next/required-server-files.json +1 -0
- package/.next/routes-manifest.json +1 -0
- package/.next/server/app/_not-found/page.js +1 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +6 -0
- package/.next/server/app/_not-found.rsc +9 -0
- package/.next/server/app/api/check-prs/route.js +86 -0
- package/.next/server/app/api/check-prs/route.js.nft.json +1 -0
- package/.next/server/app/api/events/route.js +86 -0
- package/.next/server/app/api/events/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/route.js +86 -0
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/route.js +86 -0
- package/.next/server/app/api/sessions/route.js.nft.json +1 -0
- package/.next/server/app/api/stats/route.js +86 -0
- package/.next/server/app/api/stats/route.js.nft.json +1 -0
- package/.next/server/app/page.js +1 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app/sessions/[id]/page.js +1 -0
- package/.next/server/app/sessions/[id]/page.js.nft.json +1 -0
- package/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -0
- package/.next/server/app/sessions/page.js +1 -0
- package/.next/server/app/sessions/page.js.nft.json +1 -0
- package/.next/server/app/sessions/page_client-reference-manifest.js +1 -0
- package/.next/server/app-paths-manifest.json +11 -0
- package/.next/server/chunks/111.js +1 -0
- package/.next/server/chunks/19.js +1 -0
- package/.next/server/chunks/218.js +1 -0
- package/.next/server/chunks/267.js +13 -0
- package/.next/server/chunks/449.js +12 -0
- package/.next/server/chunks/522.js +2 -0
- package/.next/server/chunks/590.js +6 -0
- package/.next/server/chunks/619.js +2 -0
- package/.next/server/chunks/780.js +1 -0
- package/.next/server/chunks/787.js +1 -0
- package/.next/server/chunks/938.js +1 -0
- package/.next/server/chunks/95.js +1 -0
- package/.next/server/chunks/98.js +86 -0
- package/.next/server/chunks/font-manifest.json +1 -0
- package/.next/server/font-manifest.json +1 -0
- package/.next/server/functions-config-manifest.json +1 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages/_app.js +1 -0
- package/.next/server/pages/_app.js.nft.json +1 -0
- package/.next/server/pages/_document.js +1 -0
- package/.next/server/pages/_document.js.nft.json +1 -0
- package/.next/server/pages/_error.js +1 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +1 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/VcvMciURiwijLrVt2jf_P/_buildManifest.js +1 -0
- package/.next/static/VcvMciURiwijLrVt2jf_P/_ssgManifest.js +1 -0
- package/.next/static/chunks/2200cc46-96120a9be9a790d7.js +1 -0
- package/.next/static/chunks/838-ee1ac53cffa08ff2.js +1 -0
- package/.next/static/chunks/919-13111e16ca5aad12.js +1 -0
- package/.next/static/chunks/945-08d88d38313883d1.js +2 -0
- package/.next/static/chunks/app/_not-found/page-52828565ce3bf1a5.js +1 -0
- package/.next/static/chunks/app/layout-d3c17bc5a9ba9afe.js +1 -0
- package/.next/static/chunks/app/page-f02e37b80f020816.js +1 -0
- package/.next/static/chunks/app/sessions/[id]/page-9cd58c2b3cbdb58c.js +1 -0
- package/.next/static/chunks/app/sessions/page-381d2eb994edfbe5.js +1 -0
- package/.next/static/chunks/framework-6e06c675866dc992.js +1 -0
- package/.next/static/chunks/main-921b2ae56ade90f2.js +1 -0
- package/.next/static/chunks/main-app-f7575201e7f66c72.js +1 -0
- package/.next/static/chunks/pages/_app-0c3037849002a4aa.js +1 -0
- package/.next/static/chunks/pages/_error-a647cd2c75dc4dc7.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-5a21843c4f0469c6.js +1 -0
- package/.next/static/css/e0ed3c3bd07a0247.css +3 -0
- package/.next/static/media/011e180705008d6f-s.woff2 +0 -0
- package/.next/static/media/0aa834ed78bf6d07-s.woff2 +0 -0
- package/.next/static/media/20535187d867b7b9-s.woff2 +0 -0
- package/.next/static/media/37786be940ec402b-s.p.woff2 +0 -0
- package/.next/static/media/46e154b2fcbd6033-s.woff2 +0 -0
- package/.next/static/media/5356a6a4f2c8c8d8-s.woff2 +0 -0
- package/.next/static/media/58f386aa6b1a2a92-s.woff2 +0 -0
- package/.next/static/media/656feb427634a431-s.woff2 +0 -0
- package/.next/static/media/67957d42bae0796d-s.woff2 +0 -0
- package/.next/static/media/704b853f32d191d5-s.woff2 +0 -0
- package/.next/static/media/73cb51aac9c97f90-s.woff2 +0 -0
- package/.next/static/media/7ba5fb2a8c88521c-s.woff2 +0 -0
- package/.next/static/media/886030b0b59bc5a7-s.woff2 +0 -0
- package/.next/static/media/92eeb95d069020cc-s.woff2 +0 -0
- package/.next/static/media/939c4f875ee75fbb-s.woff2 +0 -0
- package/.next/static/media/98e207f02528a563-s.p.woff2 +0 -0
- package/.next/static/media/991629005c80bdf1-s.woff2 +0 -0
- package/.next/static/media/99dcf268bda04fe5-s.woff2 +0 -0
- package/.next/static/media/bb3ef058b751a6ad-s.p.woff2 +0 -0
- package/.next/static/media/d26bbd13d6b70f89-s.woff2 +0 -0
- package/.next/static/media/d29838c109ef09b4-s.woff2 +0 -0
- package/.next/static/media/d3ebbfd689654d3a-s.p.woff2 +0 -0
- package/.next/static/media/db96af6b531dc71f-s.p.woff2 +0 -0
- package/.next/static/media/e40af3453d7c920a-s.woff2 +0 -0
- package/.next/static/media/ef4d5661765d0e49-s.woff2 +0 -0
- package/.next/static/media/f911b923c6adde36-s.woff2 +0 -0
- package/README.md +152 -0
- package/dist/bin/agentlens.mjs +1104 -0
- package/next.config.mjs +10 -0
- package/package.json +88 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";(()=>{var e={};e.id=533,e.ids=[533,98],e.modules={5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},237:(e,t,s)=>{let r;s.r(t),s.d(t,{originalPathname:()=>b,patchFetch:()=>k,requestAsyncStorage:()=>R,routeModule:()=>w,serverHooks:()=>y,staticGenerationAsyncStorage:()=>X});var i={};s.r(i),s.d(i,{GET:()=>v,POST:()=>O});var n=s(2085),a=s(1650),o=s(5980),l=s(627),u=s(9098),d=s(4210),T=s(3787),p=s(2960);let c=require("child_process");function N(e){let t=e.match(/github\.com[/:]([^/]+\/[^/.]+)/);return t?t[1].replace(/\.git$/,""):null}async function E(e,t){let s=new AbortController,r=setTimeout(()=>s.abort(),1e4);try{let r=await fetch(`https://api.github.com${e}`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/vnd.github.v3+json","User-Agent":"agentlens"},signal:s.signal});if(!r.ok){if(404===r.status)return null;if(403===r.status||401===r.status)throw Error(`GitHub API auth error: ${r.status}`);throw Error(`GitHub API error: ${r.status} ${r.statusText}`)}return r.json()}finally{clearTimeout(r)}}async function _(e,t,s,r){return E(`/repos/${e}/${t}/pulls/${s}`,r)}async function m(e,t,s,r){return await E(`/repos/${e}/${t}/pulls?head=${e}:${s}&state=all&per_page=10`,r)||[]}async function L(e,t,s,r){return await E(`/repos/${e}/${t}/pulls/${s}/reviews`,r)||[]}async function h(e,t,s,r){return await E(`/repos/${e}/${t}/pulls/${s}/comments?per_page=100`,r)||[]}async function f(e,t,s,r){return await E(`/repos/${e}/${t}/pulls/${s}/commits?per_page=100`,r)||[]}let g=new Set(["main","master","develop","dev"]);async function I(e,t,s){let r;let i=N(t.repo);if(!i)return{merged:!1,closed:!1,error:`bad repo URL: ${t.repo}`};let[n,a]=i.split("/"),o=await _(n,a,t.prNumber,s);if(!o)return{merged:!1,closed:!1,error:`PR #${t.prNumber} not found`};let l=await L(n,a,t.prNumber,s),u=l.filter(e=>"APPROVED"===e.state).length,d=l.filter(e=>"CHANGES_REQUESTED"===e.state).length,T=await h(n,a,t.prNumber,s),c=0,E=l.length>0?l.sort((e,t)=>e.submitted_at.localeCompare(t.submitted_at))[0].submitted_at:null;E&&(c=(await f(n,a,t.prNumber,s)).filter(e=>e.commit.author.date>E).length);let m=t.reviewsApproved,g=t.reviewsChangesRequested;if(u>m||d>g)for(let s of l)("APPROVED"===s.state||"CHANGES_REQUESTED"===s.state)&&(0,p.B8)(e,{sessionId:t.sessionId,eventType:"pr_review",timestamp:s.submitted_at,payload:{pr_number:t.prNumber,pr_url:t.prUrl,reviewer:s.user.login,state:s.state.toLowerCase(),body:s.body?s.body.slice(0,300):null}});let I=null!==o.merged_at,A="closed"===o.state&&!I;return I&&o.merged_at&&o.created_at&&(r=((new Date(o.merged_at).getTime()-new Date(o.created_at).getTime())/36e5).toFixed(1)),(0,p.zQ)(e,t.id,{status:I?"merged":A?"closed":"open",mergedAt:o.merged_at||void 0,reviewsApproved:u,reviewsChangesRequested:d,reviewComments:T.length,commitsAfterReview:c,firstReviewAt:E||void 0,timeToMergeHours:r}),I&&"merged"!==t.status&&(0,p.B8)(e,{sessionId:t.sessionId,eventType:"pr_merged",timestamp:o.merged_at,payload:{pr_number:t.prNumber,pr_url:o.html_url,pr_title:o.title,branch:t.branch,repo:t.repo,time_to_merge_hours:r?parseFloat(r):null,reviews_approved:u,reviews_changes_requested:d}}),A&&"closed"!==t.status&&(0,p.B8)(e,{sessionId:t.sessionId,eventType:"pr_closed",timestamp:o.updated_at,payload:{pr_number:t.prNumber,pr_url:o.html_url,pr_title:o.title,branch:t.branch}}),{merged:I,closed:A}}async function A(e,t){let s=e.select({id:p.iG.id,gitRepo:p.iG.gitRepo,gitBranch:p.iG.gitBranch}).from(p.iG).where((0,d.xD)((0,T.i6)`${p.iG.gitRepo} IS NOT NULL`,(0,T.i6)`${p.iG.gitBranch} IS NOT NULL`,(0,T.i6)`${p.iG.gitBranch} != ''`)).all(),r=new Set(e.select({sessionId:p.Nx.sessionId}).from(p.Nx).all().map(e=>e.sessionId)),i=0;for(let n of s){if(!n.gitRepo||!n.gitBranch||g.has(n.gitBranch)||r.has(n.id))continue;let s=N(n.gitRepo);if(!s)continue;let[a,o]=s.split("/");try{for(let s of(await m(a,o,n.gitBranch,t)))(0,p.LG)(e,{sessionId:n.id,repo:n.gitRepo,branch:n.gitBranch,prNumber:s.number,prUrl:s.html_url,prTitle:s.title,status:s.merged_at?"merged":"closed"===s.state?"closed":"open"}),i++,(0,p.B8)(e,{sessionId:n.id,eventType:"pr_opened",timestamp:s.created_at,payload:{pr_number:s.number,pr_url:s.html_url,pr_title:s.title,branch:n.gitBranch}})}catch{}}return{discovered:i}}async function U(e,t){let s=function(){if(void 0!==r)return r;if(process.env.GITHUB_TOKEN)return r=process.env.GITHUB_TOKEN;try{let e=(0,c.execSync)("gh auth token",{encoding:"utf-8",timeout:5e3,stdio:["pipe","pipe","pipe"]}).trim();if(e)return r=e}catch{}return r=null,null}();if(!s)return{status:200,body:{skipped:!0,message:"no GitHub token available (set GITHUB_TOKEN or install gh CLI)"}};let i=0;t?.backfill!==!1&&(i=(await A(e,s)).discovered);let n=(0,p.wI)(e),a=n.filter(e=>!e.checkedAt||Date.now()-new Date(e.checkedAt).getTime()>3e5),o=0,l=0,u=0,d=[];for(let t of a)try{let r=await I(e,t,s);o++,r.merged&&l++,r.closed&&u++,r.error&&d.push(r.error)}catch(e){d.push(`PR #${t.prNumber}: ${e.message}`)}return{status:200,body:{checked:o,merged:l,closed:u,backfilled:i,open_remaining:n.length-l-u,skipped:n.length-a.length,errors:d.length>0?d:void 0}}}async function O(e){try{let t=new URL(e.url),s="false"!==t.searchParams.get("backfill"),r=(0,u.getDb)(),i=await U(r,{backfill:s});return l.NextResponse.json(i.body,{status:i.status})}catch(e){return l.NextResponse.json({error:e.message||"check-prs failed"},{status:500})}}async function v(e){try{let t=new URL(e.url),s="false"!==t.searchParams.get("backfill"),r=(0,u.getDb)(),i=await U(r,{backfill:s});return l.NextResponse.json(i.body,{status:i.status})}catch(e){return l.NextResponse.json({error:e.message||"check-prs failed"},{status:500})}}let w=new n.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/check-prs/route",pathname:"/api/check-prs",filename:"route",bundlePath:"app/api/check-prs/route"},resolvedPagePath:"/Users/philippwassibauer/agentlens/app/api/check-prs/route.ts",nextConfigOutput:"",userland:i}),{requestAsyncStorage:R,staticGenerationAsyncStorage:X,serverHooks:y}=w,b="/api/check-prs/route";function k(){return(0,o.patchFetch)({serverHooks:y,staticGenerationAsyncStorage:X})}},9098:(e,t,s)=>{s.d(t,{getDb:()=>c});var r=s(5890),i=s.n(r),n=s(6267),a=s(3787),o=s(5315),l=s.n(o),u=s(2048),d=s.n(u),T=s(9801);let p=null;function c(){if(p)return p;let e=process.env.AGENTLENS_DB_PATH||l().join((0,T.homedir)(),".agentlens","agentlens.db"),t=l().dirname(e);d().existsSync(t)||d().mkdirSync(t,{recursive:!0});let s=new(i())(e);s.pragma("journal_mode = WAL");let r=(0,n.t)(s);r.run((0,a.i6)`
|
|
2
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
3
|
+
id TEXT PRIMARY KEY,
|
|
4
|
+
team_id TEXT NOT NULL,
|
|
5
|
+
user_id TEXT NOT NULL,
|
|
6
|
+
project TEXT NOT NULL,
|
|
7
|
+
git_repo TEXT,
|
|
8
|
+
git_branch TEXT,
|
|
9
|
+
pi_version TEXT NOT NULL DEFAULT '',
|
|
10
|
+
skills_used TEXT NOT NULL DEFAULT '[]',
|
|
11
|
+
model TEXT,
|
|
12
|
+
harness TEXT NOT NULL DEFAULT 'pi',
|
|
13
|
+
started_at TEXT NOT NULL,
|
|
14
|
+
ended_at TEXT,
|
|
15
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
16
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
17
|
+
)
|
|
18
|
+
`),r.run((0,a.i6)`
|
|
19
|
+
CREATE TABLE IF NOT EXISTS events (
|
|
20
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
21
|
+
session_id TEXT NOT NULL,
|
|
22
|
+
event_type TEXT NOT NULL,
|
|
23
|
+
timestamp TEXT NOT NULL,
|
|
24
|
+
payload TEXT NOT NULL DEFAULT '{}',
|
|
25
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
26
|
+
)
|
|
27
|
+
`);try{r.run((0,a.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_team_id ON sessions(team_id)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_user_id ON sessions(user_id)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_started_at ON sessions(started_at)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_status ON sessions(status)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_id ON events(session_id)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_timestamp ON events(session_id, timestamp)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_events_event_type ON events(event_type)`),r.run((0,a.i6)`
|
|
28
|
+
CREATE TABLE IF NOT EXISTS pull_requests (
|
|
29
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
30
|
+
session_id TEXT NOT NULL,
|
|
31
|
+
repo TEXT NOT NULL,
|
|
32
|
+
branch TEXT NOT NULL,
|
|
33
|
+
pr_number INTEGER NOT NULL,
|
|
34
|
+
pr_url TEXT NOT NULL,
|
|
35
|
+
pr_title TEXT NOT NULL DEFAULT '',
|
|
36
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
37
|
+
merged_at TEXT,
|
|
38
|
+
reviews_approved INTEGER NOT NULL DEFAULT 0,
|
|
39
|
+
reviews_changes_requested INTEGER NOT NULL DEFAULT 0,
|
|
40
|
+
review_comments INTEGER NOT NULL DEFAULT 0,
|
|
41
|
+
commits_after_review INTEGER NOT NULL DEFAULT 0,
|
|
42
|
+
first_review_at TEXT,
|
|
43
|
+
time_to_merge_hours REAL,
|
|
44
|
+
checked_at TEXT,
|
|
45
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
46
|
+
UNIQUE(session_id, pr_number)
|
|
47
|
+
)
|
|
48
|
+
`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_prs_session_id ON pull_requests(session_id)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_prs_status ON pull_requests(status)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_prs_repo_branch ON pull_requests(repo, branch)`);try{r.run((0,a.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}try{r.run((0,a.i6)`ALTER TABLE sessions ADD COLUMN harness TEXT NOT NULL DEFAULT 'pi'`)}catch{}for(let e of(r.run((0,a.i6)`
|
|
49
|
+
CREATE TABLE IF NOT EXISTS eval_checks (
|
|
50
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
51
|
+
session_id TEXT NOT NULL,
|
|
52
|
+
check_id TEXT NOT NULL,
|
|
53
|
+
check_version TEXT NOT NULL,
|
|
54
|
+
score REAL NOT NULL,
|
|
55
|
+
raw_score INTEGER NOT NULL,
|
|
56
|
+
reasoning TEXT NOT NULL DEFAULT '',
|
|
57
|
+
evidence TEXT,
|
|
58
|
+
model TEXT NOT NULL,
|
|
59
|
+
cost_usd REAL NOT NULL DEFAULT 0,
|
|
60
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
61
|
+
UNIQUE(session_id, check_id, check_version)
|
|
62
|
+
)
|
|
63
|
+
`),r.run((0,a.i6)`
|
|
64
|
+
CREATE TABLE IF NOT EXISTS eval_summaries (
|
|
65
|
+
session_id TEXT PRIMARY KEY,
|
|
66
|
+
qual_score REAL NOT NULL,
|
|
67
|
+
checks_passed INTEGER NOT NULL DEFAULT 0,
|
|
68
|
+
checks_total INTEGER NOT NULL DEFAULT 0,
|
|
69
|
+
total_eval_cost_usd REAL NOT NULL DEFAULT 0,
|
|
70
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
71
|
+
)
|
|
72
|
+
`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_session ON eval_checks(session_id)`),r.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_lookup ON eval_checks(session_id, check_id, check_version)`),r.run((0,a.i6)`
|
|
73
|
+
CREATE TABLE IF NOT EXISTS session_insights (
|
|
74
|
+
session_id TEXT PRIMARY KEY,
|
|
75
|
+
task_category TEXT NOT NULL,
|
|
76
|
+
task_size TEXT NOT NULL,
|
|
77
|
+
workflow_tags TEXT NOT NULL DEFAULT '[]',
|
|
78
|
+
prompting_tags TEXT NOT NULL DEFAULT '[]',
|
|
79
|
+
failure_modes TEXT NOT NULL DEFAULT '[]',
|
|
80
|
+
complexity_factors TEXT NOT NULL DEFAULT '[]',
|
|
81
|
+
key_learning TEXT,
|
|
82
|
+
extracted_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
83
|
+
model TEXT NOT NULL,
|
|
84
|
+
synced_at TEXT
|
|
85
|
+
)
|
|
86
|
+
`),["failure_modes TEXT NOT NULL DEFAULT '[]'","complexity_factors TEXT NOT NULL DEFAULT '[]'","key_learning TEXT"]))try{r.run(a.i6.raw(`ALTER TABLE session_insights ADD COLUMN ${e}`))}catch{}return p=r,r}},2960:(e,t,s)=>{s.d(t,{B8:()=>_,Ei:()=>N,JS:()=>E,Kk:()=>I,LF:()=>f,LG:()=>A,Nx:()=>p,U3:()=>T,bp:()=>c,dx:()=>g,iG:()=>d,jY:()=>h,kG:()=>v,wI:()=>O,zQ:()=>U});var r=s(3787),i=s(4210),n=s(652),a=s(7780),o=s(9563),l=s(7062),u=s(9765);let d=(0,o.Px)("sessions",{id:(0,l.fL)("id").primaryKey(),teamId:(0,l.fL)("team_id").notNull(),userId:(0,l.fL)("user_id").notNull(),project:(0,l.fL)("project").notNull(),gitRepo:(0,l.fL)("git_repo"),gitBranch:(0,l.fL)("git_branch"),piVersion:(0,l.fL)("pi_version").notNull().default(""),skillsUsed:(0,l.fL)("skills_used").notNull().default("[]"),model:(0,l.fL)("model"),harness:(0,l.fL)("harness").notNull().default("pi"),startedAt:(0,l.fL)("started_at").notNull(),endedAt:(0,l.fL)("ended_at"),status:(0,l.fL)("status").notNull().default("active"),createdAt:(0,l.fL)("created_at").notNull().default((0,r.i6)`(datetime('now'))`)}),T=(0,o.Px)("events",{id:(0,u._L)("id").primaryKey({autoIncrement:!0}),sessionId:(0,l.fL)("session_id").notNull(),eventType:(0,l.fL)("event_type").notNull(),timestamp:(0,l.fL)("timestamp").notNull(),payload:(0,l.fL)("payload").notNull().default("{}"),createdAt:(0,l.fL)("created_at").notNull().default((0,r.i6)`(datetime('now'))`)}),p=(0,o.Px)("pull_requests",{id:(0,u._L)("id").primaryKey({autoIncrement:!0}),sessionId:(0,l.fL)("session_id").notNull(),repo:(0,l.fL)("repo").notNull(),branch:(0,l.fL)("branch").notNull(),prNumber:(0,u._L)("pr_number").notNull(),prUrl:(0,l.fL)("pr_url").notNull(),prTitle:(0,l.fL)("pr_title").notNull().default(""),status:(0,l.fL)("status").notNull().default("open"),mergedAt:(0,l.fL)("merged_at"),reviewsApproved:(0,u._L)("reviews_approved").notNull().default(0),reviewsChangesRequested:(0,u._L)("reviews_changes_requested").notNull().default(0),reviewComments:(0,u._L)("review_comments").notNull().default(0),commitsAfterReview:(0,u._L)("commits_after_review").notNull().default(0),firstReviewAt:(0,l.fL)("first_review_at"),timeToMergeHours:(0,l.fL)("time_to_merge_hours"),checkedAt:(0,l.fL)("checked_at"),createdAt:(0,l.fL)("created_at").notNull().default((0,r.i6)`(datetime('now'))`)});function c(e,t,s,r){e.update(d).set({endedAt:s,status:r}).where((0,i.eq)(d.id,t)).run()}function N(e,t,s){e.update(d).set({model:s}).where((0,i.eq)(d.id,t)).run()}function E(e,t){e.select().from(d).where((0,i.eq)(d.id,t.id)).get()?e.update(d).set({userId:t.userId,project:t.project,gitRepo:t.gitRepo,gitBranch:t.gitBranch,piVersion:t.piVersion,skillsUsed:JSON.stringify(t.skillsUsed),model:t.model}).where((0,i.eq)(d.id,t.id)).run():function(e,t){e.insert(d).values({id:t.id,teamId:t.teamId,userId:t.userId,project:t.project,gitRepo:t.gitRepo,gitBranch:t.gitBranch,piVersion:t.piVersion,skillsUsed:JSON.stringify(t.skillsUsed),model:t.model,harness:t.harness||"pi",startedAt:t.startedAt}).run()}(e,t)}function _(e,t){e.insert(T).values({sessionId:t.sessionId,eventType:t.eventType,timestamp:t.timestamp,payload:JSON.stringify(t.payload)}).run()}function m(e){return{id:e.id,teamId:e.teamId,userId:e.userId,project:e.project,gitRepo:e.gitRepo,gitBranch:e.gitBranch,piVersion:e.piVersion,skillsUsed:JSON.parse(e.skillsUsed||"[]"),model:e.model||null,harness:e.harness||"pi",startedAt:e.startedAt,endedAt:e.endedAt,status:e.status}}function L(e){return{id:e.id,sessionId:e.sessionId,eventType:e.eventType,timestamp:e.timestamp,payload:JSON.parse(e.payload||"{}")}}function h(e,t){let s=e.select().from(d).where((0,i.eq)(d.id,t)).get();if(!s)return null;let r=e.select().from(T).where((0,i.eq)(T.sessionId,t)).orderBy((0,n.d)(T.timestamp),(0,n.d)(T.id)).all();return{session:m(s),events:r.map(L)}}function f(e,t){let s=[(0,i.eq)(d.teamId,t.teamId)];t.userId&&s.push((0,i.eq)(d.userId,t.userId)),t.project&&s.push((0,i.eq)(d.project,t.project)),t.harness&&s.push((0,i.eq)(d.harness,t.harness)),t.status&&s.push((0,i.eq)(d.status,t.status)),t.from&&s.push((0,i.eg)(d.startedAt,t.from)),t.to&&s.push((0,i.G)(d.startedAt,t.to));let r=1===s.length?s[0]:(0,i.xD)(...s),o=e.select({count:(0,a.QX)()}).from(d).where(r).get(),l=o?.count??0,u=Math.min(t.limit??50,200),T=t.offset??0;return{sessions:e.select().from(d).where(r).orderBy((0,n.C)(d.startedAt)).limit(u).offset(T).all().map(m),total:l}}function g(e,t){let s=e.select().from(T).where((0,i.xD)((0,i.eq)(T.sessionId,t),(0,i.eq)(T.eventType,"llm_response"))).orderBy((0,n.d)(T.timestamp)).all(),r=0,a=0,o=0,l=0,u=0,d=0,p=0,c=null,N=new Map;for(let e of s){let t=JSON.parse(e.payload||"{}");r+=t.input_tokens||0,a+=t.output_tokens||0,o+=t.cache_read_tokens||0,l+=t.cache_write_tokens||0,u+=t.total_tokens||0,d+=t.total_cost_usd||0,(t.input_tokens||0)>p&&(p=t.input_tokens||0),t.context_window&&(c=t.context_window),t.model&&N.set(t.model,(N.get(t.model)||0)+1)}let E=s.length,_=null,m=0;return N.forEach((e,t)=>{e>m&&(_=t,m=e)}),{totalInputTokens:r,totalOutputTokens:a,totalCacheReadTokens:o,totalCacheWriteTokens:l,totalTokens:u,totalCostUsd:d,llmCallCount:E,avgInputTokensPerCall:E>0?Math.round(r/E):0,peakInputTokens:p,contextWindow:c,contextUtilizationPct:c&&p>0?Math.round(p/c*1e4)/100:null,model:_}}function I(e,t){let s=e.select({eventType:T.eventType,count:(0,a.QX)()}).from(T).where((0,i.eq)(T.sessionId,t)).groupBy(T.eventType).all(),r={user_prompt:0,tool_call:0,error:0,file_change:0,heartbeat:0,session_start:0,session_end:0};for(let e of s)r[e.eventType]=e.count;return r}function A(e,t){let s=e.select().from(p).where((0,i.xD)((0,i.eq)(p.sessionId,t.sessionId),(0,i.eq)(p.prNumber,t.prNumber))).get();s?e.update(p).set({status:t.status,prTitle:t.prTitle,checkedAt:new Date().toISOString()}).where((0,i.eq)(p.id,s.id)).run():e.insert(p).values({sessionId:t.sessionId,repo:t.repo,branch:t.branch,prNumber:t.prNumber,prUrl:t.prUrl,prTitle:t.prTitle,status:t.status}).run()}function U(e,t,s){e.update(p).set({...s,checkedAt:new Date().toISOString()}).where((0,i.eq)(p.id,t)).run()}function O(e){return e.select().from(p).where((0,i.eq)(p.status,"open")).all()}function v(e,t){return e.select().from(p).where((0,i.eq)(p.sessionId,t)).all()}}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[522,787,218,267,449],()=>s(237));module.exports=r})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":1,"files":["../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/database.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/index.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/backup.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/function.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/table.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/util.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/package.json","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/bindings","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/package.json","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/file-uri-to-path","../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js","../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/package.json","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/async-local-storage.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/constants.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/tracer.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/package.json","../../../../../node_modules/better-sqlite3","../../../../../node_modules/next","../../../../../package.json","../../../../package.json","../../../chunks/218.js","../../../chunks/267.js","../../../chunks/449.js","../../../chunks/522.js","../../../chunks/787.js","../../../webpack-runtime.js"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";(()=>{var e={};e.id=873,e.ids=[873,98],e.modules={5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},8248:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>L,patchFetch:()=>c,requestAsyncStorage:()=>E,routeModule:()=>p,serverHooks:()=>_,staticGenerationAsyncStorage:()=>N});var r={};s.r(r),s.d(r,{POST:()=>u});var n=s(2085),i=s(1650),o=s(5980),a=s(627),T=s(9098),d=s(2960);async function l(e,t){if(!t.session_id||!t.event_type||!t.timestamp)return{status:400,body:{error:"Missing required fields: session_id, event_type, timestamp"}};let s=t.team_id||"default";try{if("session_start"===t.event_type){let r=t.payload||{};(0,d.JS)(e,{id:t.session_id,teamId:s,userId:r.user_id||"unknown",project:r.project||"unknown",gitRepo:r.git_repo||null,gitBranch:r.git_branch||null,piVersion:r.pi_version||"",skillsUsed:r.skills||[],model:r.model||null,startedAt:t.timestamp})}if("session_end"===t.event_type&&(0,d.bp)(e,t.session_id,t.timestamp,"completed"),"pr_snapshot"===t.event_type){let s=t.payload||{};for(let r of s.prs||[])(0,d.LG)(e,{sessionId:t.session_id,repo:s.repo||"",branch:s.branch||"",prNumber:r.number,prUrl:r.url||"",prTitle:r.title||"",status:"MERGED"===r.state?"merged":"CLOSED"===r.state?"closed":"open"})}if("llm_response"===t.event_type){let s=t.payload||{};s.model&&(0,d.Ei)(e,t.session_id,s.model)}return(0,d.B8)(e,{sessionId:t.session_id,eventType:t.event_type,timestamp:t.timestamp,payload:t.payload||{}}),{status:200,body:{ok:!0}}}catch(e){return{status:500,body:{error:"Internal server error"}}}}async function u(e){try{let t=await e.json(),s=(0,T.getDb)(),r=await l(s,t);return a.NextResponse.json(r.body,{status:r.status})}catch{return a.NextResponse.json({error:"Invalid request body"},{status:400})}}let p=new n.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/events/route",pathname:"/api/events",filename:"route",bundlePath:"app/api/events/route"},resolvedPagePath:"/Users/philippwassibauer/agentlens/app/api/events/route.ts",nextConfigOutput:"",userland:r}),{requestAsyncStorage:E,staticGenerationAsyncStorage:N,serverHooks:_}=p,L="/api/events/route";function c(){return(0,o.patchFetch)({serverHooks:_,staticGenerationAsyncStorage:N})}},9098:(e,t,s)=>{s.d(t,{getDb:()=>E});var r=s(5890),n=s.n(r),i=s(6267),o=s(3787),a=s(5315),T=s.n(a),d=s(2048),l=s.n(d),u=s(9801);let p=null;function E(){if(p)return p;let e=process.env.AGENTLENS_DB_PATH||T().join((0,u.homedir)(),".agentlens","agentlens.db"),t=T().dirname(e);l().existsSync(t)||l().mkdirSync(t,{recursive:!0});let s=new(n())(e);s.pragma("journal_mode = WAL");let r=(0,i.t)(s);r.run((0,o.i6)`
|
|
2
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
3
|
+
id TEXT PRIMARY KEY,
|
|
4
|
+
team_id TEXT NOT NULL,
|
|
5
|
+
user_id TEXT NOT NULL,
|
|
6
|
+
project TEXT NOT NULL,
|
|
7
|
+
git_repo TEXT,
|
|
8
|
+
git_branch TEXT,
|
|
9
|
+
pi_version TEXT NOT NULL DEFAULT '',
|
|
10
|
+
skills_used TEXT NOT NULL DEFAULT '[]',
|
|
11
|
+
model TEXT,
|
|
12
|
+
harness TEXT NOT NULL DEFAULT 'pi',
|
|
13
|
+
started_at TEXT NOT NULL,
|
|
14
|
+
ended_at TEXT,
|
|
15
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
16
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
17
|
+
)
|
|
18
|
+
`),r.run((0,o.i6)`
|
|
19
|
+
CREATE TABLE IF NOT EXISTS events (
|
|
20
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
21
|
+
session_id TEXT NOT NULL,
|
|
22
|
+
event_type TEXT NOT NULL,
|
|
23
|
+
timestamp TEXT NOT NULL,
|
|
24
|
+
payload TEXT NOT NULL DEFAULT '{}',
|
|
25
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
26
|
+
)
|
|
27
|
+
`);try{r.run((0,o.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_team_id ON sessions(team_id)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_user_id ON sessions(user_id)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_started_at ON sessions(started_at)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_status ON sessions(status)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_id ON events(session_id)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_timestamp ON events(session_id, timestamp)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_events_event_type ON events(event_type)`),r.run((0,o.i6)`
|
|
28
|
+
CREATE TABLE IF NOT EXISTS pull_requests (
|
|
29
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
30
|
+
session_id TEXT NOT NULL,
|
|
31
|
+
repo TEXT NOT NULL,
|
|
32
|
+
branch TEXT NOT NULL,
|
|
33
|
+
pr_number INTEGER NOT NULL,
|
|
34
|
+
pr_url TEXT NOT NULL,
|
|
35
|
+
pr_title TEXT NOT NULL DEFAULT '',
|
|
36
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
37
|
+
merged_at TEXT,
|
|
38
|
+
reviews_approved INTEGER NOT NULL DEFAULT 0,
|
|
39
|
+
reviews_changes_requested INTEGER NOT NULL DEFAULT 0,
|
|
40
|
+
review_comments INTEGER NOT NULL DEFAULT 0,
|
|
41
|
+
commits_after_review INTEGER NOT NULL DEFAULT 0,
|
|
42
|
+
first_review_at TEXT,
|
|
43
|
+
time_to_merge_hours REAL,
|
|
44
|
+
checked_at TEXT,
|
|
45
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
46
|
+
UNIQUE(session_id, pr_number)
|
|
47
|
+
)
|
|
48
|
+
`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_prs_session_id ON pull_requests(session_id)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_prs_status ON pull_requests(status)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_prs_repo_branch ON pull_requests(repo, branch)`);try{r.run((0,o.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}try{r.run((0,o.i6)`ALTER TABLE sessions ADD COLUMN harness TEXT NOT NULL DEFAULT 'pi'`)}catch{}for(let e of(r.run((0,o.i6)`
|
|
49
|
+
CREATE TABLE IF NOT EXISTS eval_checks (
|
|
50
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
51
|
+
session_id TEXT NOT NULL,
|
|
52
|
+
check_id TEXT NOT NULL,
|
|
53
|
+
check_version TEXT NOT NULL,
|
|
54
|
+
score REAL NOT NULL,
|
|
55
|
+
raw_score INTEGER NOT NULL,
|
|
56
|
+
reasoning TEXT NOT NULL DEFAULT '',
|
|
57
|
+
evidence TEXT,
|
|
58
|
+
model TEXT NOT NULL,
|
|
59
|
+
cost_usd REAL NOT NULL DEFAULT 0,
|
|
60
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
61
|
+
UNIQUE(session_id, check_id, check_version)
|
|
62
|
+
)
|
|
63
|
+
`),r.run((0,o.i6)`
|
|
64
|
+
CREATE TABLE IF NOT EXISTS eval_summaries (
|
|
65
|
+
session_id TEXT PRIMARY KEY,
|
|
66
|
+
qual_score REAL NOT NULL,
|
|
67
|
+
checks_passed INTEGER NOT NULL DEFAULT 0,
|
|
68
|
+
checks_total INTEGER NOT NULL DEFAULT 0,
|
|
69
|
+
total_eval_cost_usd REAL NOT NULL DEFAULT 0,
|
|
70
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
71
|
+
)
|
|
72
|
+
`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_session ON eval_checks(session_id)`),r.run((0,o.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_lookup ON eval_checks(session_id, check_id, check_version)`),r.run((0,o.i6)`
|
|
73
|
+
CREATE TABLE IF NOT EXISTS session_insights (
|
|
74
|
+
session_id TEXT PRIMARY KEY,
|
|
75
|
+
task_category TEXT NOT NULL,
|
|
76
|
+
task_size TEXT NOT NULL,
|
|
77
|
+
workflow_tags TEXT NOT NULL DEFAULT '[]',
|
|
78
|
+
prompting_tags TEXT NOT NULL DEFAULT '[]',
|
|
79
|
+
failure_modes TEXT NOT NULL DEFAULT '[]',
|
|
80
|
+
complexity_factors TEXT NOT NULL DEFAULT '[]',
|
|
81
|
+
key_learning TEXT,
|
|
82
|
+
extracted_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
83
|
+
model TEXT NOT NULL,
|
|
84
|
+
synced_at TEXT
|
|
85
|
+
)
|
|
86
|
+
`),["failure_modes TEXT NOT NULL DEFAULT '[]'","complexity_factors TEXT NOT NULL DEFAULT '[]'","key_learning TEXT"]))try{r.run(o.i6.raw(`ALTER TABLE session_insights ADD COLUMN ${e}`))}catch{}return p=r,r}},2960:(e,t,s)=>{s.d(t,{B8:()=>L,Ei:()=>N,JS:()=>_,Kk:()=>U,LF:()=>f,LG:()=>h,Nx:()=>p,U3:()=>u,bp:()=>E,dx:()=>A,iG:()=>l,jY:()=>I,kG:()=>X,wI:()=>v,zQ:()=>O});var r=s(3787),n=s(4210),i=s(652),o=s(7780),a=s(9563),T=s(7062),d=s(9765);let l=(0,a.Px)("sessions",{id:(0,T.fL)("id").primaryKey(),teamId:(0,T.fL)("team_id").notNull(),userId:(0,T.fL)("user_id").notNull(),project:(0,T.fL)("project").notNull(),gitRepo:(0,T.fL)("git_repo"),gitBranch:(0,T.fL)("git_branch"),piVersion:(0,T.fL)("pi_version").notNull().default(""),skillsUsed:(0,T.fL)("skills_used").notNull().default("[]"),model:(0,T.fL)("model"),harness:(0,T.fL)("harness").notNull().default("pi"),startedAt:(0,T.fL)("started_at").notNull(),endedAt:(0,T.fL)("ended_at"),status:(0,T.fL)("status").notNull().default("active"),createdAt:(0,T.fL)("created_at").notNull().default((0,r.i6)`(datetime('now'))`)}),u=(0,a.Px)("events",{id:(0,d._L)("id").primaryKey({autoIncrement:!0}),sessionId:(0,T.fL)("session_id").notNull(),eventType:(0,T.fL)("event_type").notNull(),timestamp:(0,T.fL)("timestamp").notNull(),payload:(0,T.fL)("payload").notNull().default("{}"),createdAt:(0,T.fL)("created_at").notNull().default((0,r.i6)`(datetime('now'))`)}),p=(0,a.Px)("pull_requests",{id:(0,d._L)("id").primaryKey({autoIncrement:!0}),sessionId:(0,T.fL)("session_id").notNull(),repo:(0,T.fL)("repo").notNull(),branch:(0,T.fL)("branch").notNull(),prNumber:(0,d._L)("pr_number").notNull(),prUrl:(0,T.fL)("pr_url").notNull(),prTitle:(0,T.fL)("pr_title").notNull().default(""),status:(0,T.fL)("status").notNull().default("open"),mergedAt:(0,T.fL)("merged_at"),reviewsApproved:(0,d._L)("reviews_approved").notNull().default(0),reviewsChangesRequested:(0,d._L)("reviews_changes_requested").notNull().default(0),reviewComments:(0,d._L)("review_comments").notNull().default(0),commitsAfterReview:(0,d._L)("commits_after_review").notNull().default(0),firstReviewAt:(0,T.fL)("first_review_at"),timeToMergeHours:(0,T.fL)("time_to_merge_hours"),checkedAt:(0,T.fL)("checked_at"),createdAt:(0,T.fL)("created_at").notNull().default((0,r.i6)`(datetime('now'))`)});function E(e,t,s,r){e.update(l).set({endedAt:s,status:r}).where((0,n.eq)(l.id,t)).run()}function N(e,t,s){e.update(l).set({model:s}).where((0,n.eq)(l.id,t)).run()}function _(e,t){e.select().from(l).where((0,n.eq)(l.id,t.id)).get()?e.update(l).set({userId:t.userId,project:t.project,gitRepo:t.gitRepo,gitBranch:t.gitBranch,piVersion:t.piVersion,skillsUsed:JSON.stringify(t.skillsUsed),model:t.model}).where((0,n.eq)(l.id,t.id)).run():function(e,t){e.insert(l).values({id:t.id,teamId:t.teamId,userId:t.userId,project:t.project,gitRepo:t.gitRepo,gitBranch:t.gitBranch,piVersion:t.piVersion,skillsUsed:JSON.stringify(t.skillsUsed),model:t.model,harness:t.harness||"pi",startedAt:t.startedAt}).run()}(e,t)}function L(e,t){e.insert(u).values({sessionId:t.sessionId,eventType:t.eventType,timestamp:t.timestamp,payload:JSON.stringify(t.payload)}).run()}function c(e){return{id:e.id,teamId:e.teamId,userId:e.userId,project:e.project,gitRepo:e.gitRepo,gitBranch:e.gitBranch,piVersion:e.piVersion,skillsUsed:JSON.parse(e.skillsUsed||"[]"),model:e.model||null,harness:e.harness||"pi",startedAt:e.startedAt,endedAt:e.endedAt,status:e.status}}function m(e){return{id:e.id,sessionId:e.sessionId,eventType:e.eventType,timestamp:e.timestamp,payload:JSON.parse(e.payload||"{}")}}function I(e,t){let s=e.select().from(l).where((0,n.eq)(l.id,t)).get();if(!s)return null;let r=e.select().from(u).where((0,n.eq)(u.sessionId,t)).orderBy((0,i.d)(u.timestamp),(0,i.d)(u.id)).all();return{session:c(s),events:r.map(m)}}function f(e,t){let s=[(0,n.eq)(l.teamId,t.teamId)];t.userId&&s.push((0,n.eq)(l.userId,t.userId)),t.project&&s.push((0,n.eq)(l.project,t.project)),t.harness&&s.push((0,n.eq)(l.harness,t.harness)),t.status&&s.push((0,n.eq)(l.status,t.status)),t.from&&s.push((0,n.eg)(l.startedAt,t.from)),t.to&&s.push((0,n.G)(l.startedAt,t.to));let r=1===s.length?s[0]:(0,n.xD)(...s),a=e.select({count:(0,o.QX)()}).from(l).where(r).get(),T=a?.count??0,d=Math.min(t.limit??50,200),u=t.offset??0;return{sessions:e.select().from(l).where(r).orderBy((0,i.C)(l.startedAt)).limit(d).offset(u).all().map(c),total:T}}function A(e,t){let s=e.select().from(u).where((0,n.xD)((0,n.eq)(u.sessionId,t),(0,n.eq)(u.eventType,"llm_response"))).orderBy((0,i.d)(u.timestamp)).all(),r=0,o=0,a=0,T=0,d=0,l=0,p=0,E=null,N=new Map;for(let e of s){let t=JSON.parse(e.payload||"{}");r+=t.input_tokens||0,o+=t.output_tokens||0,a+=t.cache_read_tokens||0,T+=t.cache_write_tokens||0,d+=t.total_tokens||0,l+=t.total_cost_usd||0,(t.input_tokens||0)>p&&(p=t.input_tokens||0),t.context_window&&(E=t.context_window),t.model&&N.set(t.model,(N.get(t.model)||0)+1)}let _=s.length,L=null,c=0;return N.forEach((e,t)=>{e>c&&(L=t,c=e)}),{totalInputTokens:r,totalOutputTokens:o,totalCacheReadTokens:a,totalCacheWriteTokens:T,totalTokens:d,totalCostUsd:l,llmCallCount:_,avgInputTokensPerCall:_>0?Math.round(r/_):0,peakInputTokens:p,contextWindow:E,contextUtilizationPct:E&&p>0?Math.round(p/E*1e4)/100:null,model:L}}function U(e,t){let s=e.select({eventType:u.eventType,count:(0,o.QX)()}).from(u).where((0,n.eq)(u.sessionId,t)).groupBy(u.eventType).all(),r={user_prompt:0,tool_call:0,error:0,file_change:0,heartbeat:0,session_start:0,session_end:0};for(let e of s)r[e.eventType]=e.count;return r}function h(e,t){let s=e.select().from(p).where((0,n.xD)((0,n.eq)(p.sessionId,t.sessionId),(0,n.eq)(p.prNumber,t.prNumber))).get();s?e.update(p).set({status:t.status,prTitle:t.prTitle,checkedAt:new Date().toISOString()}).where((0,n.eq)(p.id,s.id)).run():e.insert(p).values({sessionId:t.sessionId,repo:t.repo,branch:t.branch,prNumber:t.prNumber,prUrl:t.prUrl,prTitle:t.prTitle,status:t.status}).run()}function O(e,t,s){e.update(p).set({...s,checkedAt:new Date().toISOString()}).where((0,n.eq)(p.id,t)).run()}function v(e){return e.select().from(p).where((0,n.eq)(p.status,"open")).all()}function X(e,t){return e.select().from(p).where((0,n.eq)(p.sessionId,t)).all()}}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[522,787,218,267,449],()=>s(8248));module.exports=r})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":1,"files":["../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/database.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/index.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/backup.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/function.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/table.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/util.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/package.json","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/bindings","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/package.json","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/file-uri-to-path","../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js","../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/package.json","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/async-local-storage.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/constants.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/tracer.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/package.json","../../../../../node_modules/better-sqlite3","../../../../../node_modules/next","../../../../../package.json","../../../../package.json","../../../chunks/218.js","../../../chunks/267.js","../../../chunks/449.js","../../../chunks/522.js","../../../chunks/787.js","../../../webpack-runtime.js"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";(()=>{var e={};e.id=241,e.ids=[241,98],e.modules={5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},3718:(e,T,s)=>{s.r(T),s.d(T,{originalPathname:()=>U,patchFetch:()=>O,requestAsyncStorage:()=>_,routeModule:()=>a,serverHooks:()=>u,staticGenerationAsyncStorage:()=>d});var E={};s.r(E),s.d(E,{GET:()=>o});var i=s(2085),t=s(1650),r=s(5980),N=s(627),n=s(9098),L=s(8095);async function o(e,{params:T}){let s=(0,n.getDb)(),E=await (0,L.handleGetSessionById)(s,T.id);return N.NextResponse.json(E.body,{status:E.status})}let a=new i.AppRouteRouteModule({definition:{kind:t.x.APP_ROUTE,page:"/api/sessions/[id]/route",pathname:"/api/sessions/[id]",filename:"route",bundlePath:"app/api/sessions/[id]/route"},resolvedPagePath:"/Users/philippwassibauer/agentlens/app/api/sessions/[id]/route.ts",nextConfigOutput:"",userland:E}),{requestAsyncStorage:_,staticGenerationAsyncStorage:d,serverHooks:u}=a,U="/api/sessions/[id]/route";function O(){return(0,r.patchFetch)({serverHooks:u,staticGenerationAsyncStorage:d})}},9098:(e,T,s)=>{s.d(T,{getDb:()=>d});var E=s(5890),i=s.n(E),t=s(6267),r=s(3787),N=s(5315),n=s.n(N),L=s(2048),o=s.n(L),a=s(9801);let _=null;function d(){if(_)return _;let e=process.env.AGENTLENS_DB_PATH||n().join((0,a.homedir)(),".agentlens","agentlens.db"),T=n().dirname(e);o().existsSync(T)||o().mkdirSync(T,{recursive:!0});let s=new(i())(e);s.pragma("journal_mode = WAL");let E=(0,t.t)(s);E.run((0,r.i6)`
|
|
2
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
3
|
+
id TEXT PRIMARY KEY,
|
|
4
|
+
team_id TEXT NOT NULL,
|
|
5
|
+
user_id TEXT NOT NULL,
|
|
6
|
+
project TEXT NOT NULL,
|
|
7
|
+
git_repo TEXT,
|
|
8
|
+
git_branch TEXT,
|
|
9
|
+
pi_version TEXT NOT NULL DEFAULT '',
|
|
10
|
+
skills_used TEXT NOT NULL DEFAULT '[]',
|
|
11
|
+
model TEXT,
|
|
12
|
+
harness TEXT NOT NULL DEFAULT 'pi',
|
|
13
|
+
started_at TEXT NOT NULL,
|
|
14
|
+
ended_at TEXT,
|
|
15
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
16
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
17
|
+
)
|
|
18
|
+
`),E.run((0,r.i6)`
|
|
19
|
+
CREATE TABLE IF NOT EXISTS events (
|
|
20
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
21
|
+
session_id TEXT NOT NULL,
|
|
22
|
+
event_type TEXT NOT NULL,
|
|
23
|
+
timestamp TEXT NOT NULL,
|
|
24
|
+
payload TEXT NOT NULL DEFAULT '{}',
|
|
25
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
26
|
+
)
|
|
27
|
+
`);try{E.run((0,r.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_team_id ON sessions(team_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_user_id ON sessions(user_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_started_at ON sessions(started_at)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_status ON sessions(status)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_id ON events(session_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_timestamp ON events(session_id, timestamp)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_events_event_type ON events(event_type)`),E.run((0,r.i6)`
|
|
28
|
+
CREATE TABLE IF NOT EXISTS pull_requests (
|
|
29
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
30
|
+
session_id TEXT NOT NULL,
|
|
31
|
+
repo TEXT NOT NULL,
|
|
32
|
+
branch TEXT NOT NULL,
|
|
33
|
+
pr_number INTEGER NOT NULL,
|
|
34
|
+
pr_url TEXT NOT NULL,
|
|
35
|
+
pr_title TEXT NOT NULL DEFAULT '',
|
|
36
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
37
|
+
merged_at TEXT,
|
|
38
|
+
reviews_approved INTEGER NOT NULL DEFAULT 0,
|
|
39
|
+
reviews_changes_requested INTEGER NOT NULL DEFAULT 0,
|
|
40
|
+
review_comments INTEGER NOT NULL DEFAULT 0,
|
|
41
|
+
commits_after_review INTEGER NOT NULL DEFAULT 0,
|
|
42
|
+
first_review_at TEXT,
|
|
43
|
+
time_to_merge_hours REAL,
|
|
44
|
+
checked_at TEXT,
|
|
45
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
46
|
+
UNIQUE(session_id, pr_number)
|
|
47
|
+
)
|
|
48
|
+
`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_prs_session_id ON pull_requests(session_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_prs_status ON pull_requests(status)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_prs_repo_branch ON pull_requests(repo, branch)`);try{E.run((0,r.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}try{E.run((0,r.i6)`ALTER TABLE sessions ADD COLUMN harness TEXT NOT NULL DEFAULT 'pi'`)}catch{}for(let e of(E.run((0,r.i6)`
|
|
49
|
+
CREATE TABLE IF NOT EXISTS eval_checks (
|
|
50
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
51
|
+
session_id TEXT NOT NULL,
|
|
52
|
+
check_id TEXT NOT NULL,
|
|
53
|
+
check_version TEXT NOT NULL,
|
|
54
|
+
score REAL NOT NULL,
|
|
55
|
+
raw_score INTEGER NOT NULL,
|
|
56
|
+
reasoning TEXT NOT NULL DEFAULT '',
|
|
57
|
+
evidence TEXT,
|
|
58
|
+
model TEXT NOT NULL,
|
|
59
|
+
cost_usd REAL NOT NULL DEFAULT 0,
|
|
60
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
61
|
+
UNIQUE(session_id, check_id, check_version)
|
|
62
|
+
)
|
|
63
|
+
`),E.run((0,r.i6)`
|
|
64
|
+
CREATE TABLE IF NOT EXISTS eval_summaries (
|
|
65
|
+
session_id TEXT PRIMARY KEY,
|
|
66
|
+
qual_score REAL NOT NULL,
|
|
67
|
+
checks_passed INTEGER NOT NULL DEFAULT 0,
|
|
68
|
+
checks_total INTEGER NOT NULL DEFAULT 0,
|
|
69
|
+
total_eval_cost_usd REAL NOT NULL DEFAULT 0,
|
|
70
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
71
|
+
)
|
|
72
|
+
`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_session ON eval_checks(session_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_lookup ON eval_checks(session_id, check_id, check_version)`),E.run((0,r.i6)`
|
|
73
|
+
CREATE TABLE IF NOT EXISTS session_insights (
|
|
74
|
+
session_id TEXT PRIMARY KEY,
|
|
75
|
+
task_category TEXT NOT NULL,
|
|
76
|
+
task_size TEXT NOT NULL,
|
|
77
|
+
workflow_tags TEXT NOT NULL DEFAULT '[]',
|
|
78
|
+
prompting_tags TEXT NOT NULL DEFAULT '[]',
|
|
79
|
+
failure_modes TEXT NOT NULL DEFAULT '[]',
|
|
80
|
+
complexity_factors TEXT NOT NULL DEFAULT '[]',
|
|
81
|
+
key_learning TEXT,
|
|
82
|
+
extracted_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
83
|
+
model TEXT NOT NULL,
|
|
84
|
+
synced_at TEXT
|
|
85
|
+
)
|
|
86
|
+
`),["failure_modes TEXT NOT NULL DEFAULT '[]'","complexity_factors TEXT NOT NULL DEFAULT '[]'","key_learning TEXT"]))try{E.run(r.i6.raw(`ALTER TABLE session_insights ADD COLUMN ${e}`))}catch{}return _=E,E}}};var T=require("../../../../webpack-runtime.js");T.C(e);var s=e=>T(T.s=e),E=T.X(0,[522,787,218,267,449,95],()=>s(3718));module.exports=E})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":1,"files":["../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/database.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/index.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/backup.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/function.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/table.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/util.js","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/package.json","../../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/bindings","../../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js","../../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/package.json","../../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/file-uri-to-path","../../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js","../../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/package.json","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/async-local-storage.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/package.json","../../../../../../node_modules/better-sqlite3","../../../../../../node_modules/next","../../../../../../package.json","../../../../../package.json","../../../../chunks/218.js","../../../../chunks/267.js","../../../../chunks/449.js","../../../../chunks/522.js","../../../../chunks/787.js","../../../../chunks/95.js","../../../../webpack-runtime.js"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";(()=>{var e={};e.id=772,e.ids=[772,98],e.modules={5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},297:(e,T,s)=>{s.r(T),s.d(T,{originalPathname:()=>U,patchFetch:()=>O,requestAsyncStorage:()=>_,routeModule:()=>o,serverHooks:()=>u,staticGenerationAsyncStorage:()=>d});var E={};s.r(E),s.d(E,{GET:()=>a});var t=s(2085),i=s(1650),r=s(5980),N=s(627),n=s(9098),L=s(8095);async function a(e){let T=new URL(e.url),s={};T.searchParams.forEach((e,T)=>{s[T]=e});let E=(0,n.getDb)(),t=await (0,L.handleGetSessions)(E,s);return N.NextResponse.json(t.body,{status:t.status})}let o=new t.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/sessions/route",pathname:"/api/sessions",filename:"route",bundlePath:"app/api/sessions/route"},resolvedPagePath:"/Users/philippwassibauer/agentlens/app/api/sessions/route.ts",nextConfigOutput:"",userland:E}),{requestAsyncStorage:_,staticGenerationAsyncStorage:d,serverHooks:u}=o,U="/api/sessions/route";function O(){return(0,r.patchFetch)({serverHooks:u,staticGenerationAsyncStorage:d})}},9098:(e,T,s)=>{s.d(T,{getDb:()=>d});var E=s(5890),t=s.n(E),i=s(6267),r=s(3787),N=s(5315),n=s.n(N),L=s(2048),a=s.n(L),o=s(9801);let _=null;function d(){if(_)return _;let e=process.env.AGENTLENS_DB_PATH||n().join((0,o.homedir)(),".agentlens","agentlens.db"),T=n().dirname(e);a().existsSync(T)||a().mkdirSync(T,{recursive:!0});let s=new(t())(e);s.pragma("journal_mode = WAL");let E=(0,i.t)(s);E.run((0,r.i6)`
|
|
2
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
3
|
+
id TEXT PRIMARY KEY,
|
|
4
|
+
team_id TEXT NOT NULL,
|
|
5
|
+
user_id TEXT NOT NULL,
|
|
6
|
+
project TEXT NOT NULL,
|
|
7
|
+
git_repo TEXT,
|
|
8
|
+
git_branch TEXT,
|
|
9
|
+
pi_version TEXT NOT NULL DEFAULT '',
|
|
10
|
+
skills_used TEXT NOT NULL DEFAULT '[]',
|
|
11
|
+
model TEXT,
|
|
12
|
+
harness TEXT NOT NULL DEFAULT 'pi',
|
|
13
|
+
started_at TEXT NOT NULL,
|
|
14
|
+
ended_at TEXT,
|
|
15
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
16
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
17
|
+
)
|
|
18
|
+
`),E.run((0,r.i6)`
|
|
19
|
+
CREATE TABLE IF NOT EXISTS events (
|
|
20
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
21
|
+
session_id TEXT NOT NULL,
|
|
22
|
+
event_type TEXT NOT NULL,
|
|
23
|
+
timestamp TEXT NOT NULL,
|
|
24
|
+
payload TEXT NOT NULL DEFAULT '{}',
|
|
25
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
26
|
+
)
|
|
27
|
+
`);try{E.run((0,r.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_team_id ON sessions(team_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_user_id ON sessions(user_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_started_at ON sessions(started_at)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_status ON sessions(status)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_id ON events(session_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_timestamp ON events(session_id, timestamp)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_events_event_type ON events(event_type)`),E.run((0,r.i6)`
|
|
28
|
+
CREATE TABLE IF NOT EXISTS pull_requests (
|
|
29
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
30
|
+
session_id TEXT NOT NULL,
|
|
31
|
+
repo TEXT NOT NULL,
|
|
32
|
+
branch TEXT NOT NULL,
|
|
33
|
+
pr_number INTEGER NOT NULL,
|
|
34
|
+
pr_url TEXT NOT NULL,
|
|
35
|
+
pr_title TEXT NOT NULL DEFAULT '',
|
|
36
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
37
|
+
merged_at TEXT,
|
|
38
|
+
reviews_approved INTEGER NOT NULL DEFAULT 0,
|
|
39
|
+
reviews_changes_requested INTEGER NOT NULL DEFAULT 0,
|
|
40
|
+
review_comments INTEGER NOT NULL DEFAULT 0,
|
|
41
|
+
commits_after_review INTEGER NOT NULL DEFAULT 0,
|
|
42
|
+
first_review_at TEXT,
|
|
43
|
+
time_to_merge_hours REAL,
|
|
44
|
+
checked_at TEXT,
|
|
45
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
46
|
+
UNIQUE(session_id, pr_number)
|
|
47
|
+
)
|
|
48
|
+
`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_prs_session_id ON pull_requests(session_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_prs_status ON pull_requests(status)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_prs_repo_branch ON pull_requests(repo, branch)`);try{E.run((0,r.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}try{E.run((0,r.i6)`ALTER TABLE sessions ADD COLUMN harness TEXT NOT NULL DEFAULT 'pi'`)}catch{}for(let e of(E.run((0,r.i6)`
|
|
49
|
+
CREATE TABLE IF NOT EXISTS eval_checks (
|
|
50
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
51
|
+
session_id TEXT NOT NULL,
|
|
52
|
+
check_id TEXT NOT NULL,
|
|
53
|
+
check_version TEXT NOT NULL,
|
|
54
|
+
score REAL NOT NULL,
|
|
55
|
+
raw_score INTEGER NOT NULL,
|
|
56
|
+
reasoning TEXT NOT NULL DEFAULT '',
|
|
57
|
+
evidence TEXT,
|
|
58
|
+
model TEXT NOT NULL,
|
|
59
|
+
cost_usd REAL NOT NULL DEFAULT 0,
|
|
60
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
61
|
+
UNIQUE(session_id, check_id, check_version)
|
|
62
|
+
)
|
|
63
|
+
`),E.run((0,r.i6)`
|
|
64
|
+
CREATE TABLE IF NOT EXISTS eval_summaries (
|
|
65
|
+
session_id TEXT PRIMARY KEY,
|
|
66
|
+
qual_score REAL NOT NULL,
|
|
67
|
+
checks_passed INTEGER NOT NULL DEFAULT 0,
|
|
68
|
+
checks_total INTEGER NOT NULL DEFAULT 0,
|
|
69
|
+
total_eval_cost_usd REAL NOT NULL DEFAULT 0,
|
|
70
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
71
|
+
)
|
|
72
|
+
`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_session ON eval_checks(session_id)`),E.run((0,r.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_lookup ON eval_checks(session_id, check_id, check_version)`),E.run((0,r.i6)`
|
|
73
|
+
CREATE TABLE IF NOT EXISTS session_insights (
|
|
74
|
+
session_id TEXT PRIMARY KEY,
|
|
75
|
+
task_category TEXT NOT NULL,
|
|
76
|
+
task_size TEXT NOT NULL,
|
|
77
|
+
workflow_tags TEXT NOT NULL DEFAULT '[]',
|
|
78
|
+
prompting_tags TEXT NOT NULL DEFAULT '[]',
|
|
79
|
+
failure_modes TEXT NOT NULL DEFAULT '[]',
|
|
80
|
+
complexity_factors TEXT NOT NULL DEFAULT '[]',
|
|
81
|
+
key_learning TEXT,
|
|
82
|
+
extracted_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
83
|
+
model TEXT NOT NULL,
|
|
84
|
+
synced_at TEXT
|
|
85
|
+
)
|
|
86
|
+
`),["failure_modes TEXT NOT NULL DEFAULT '[]'","complexity_factors TEXT NOT NULL DEFAULT '[]'","key_learning TEXT"]))try{E.run(r.i6.raw(`ALTER TABLE session_insights ADD COLUMN ${e}`))}catch{}return _=E,E}}};var T=require("../../../webpack-runtime.js");T.C(e);var s=e=>T(T.s=e),E=T.X(0,[522,787,218,267,449,95],()=>s(297));module.exports=E})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":1,"files":["../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/database.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/index.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/backup.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/function.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/table.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/util.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/package.json","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/bindings","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/package.json","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/file-uri-to-path","../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js","../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/package.json","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/async-local-storage.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/constants.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/tracer.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/package.json","../../../../../node_modules/better-sqlite3","../../../../../node_modules/next","../../../../../package.json","../../../../package.json","../../../chunks/218.js","../../../chunks/267.js","../../../chunks/449.js","../../../chunks/522.js","../../../chunks/787.js","../../../chunks/95.js","../../../webpack-runtime.js"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";(()=>{var s={};s.id=961,s.ids=[961,98],s.modules={5890:s=>{s.exports=require("better-sqlite3")},399:s=>{s.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:s=>{s.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},2048:s=>{s.exports=require("fs")},9801:s=>{s.exports=require("os")},5315:s=>{s.exports=require("path")},7718:s=>{s.exports=require("node:child_process")},1210:(s,e,t)=>{t.r(e),t.d(e,{originalPathname:()=>N,patchFetch:()=>p,requestAsyncStorage:()=>u,routeModule:()=>l,serverHooks:()=>d,staticGenerationAsyncStorage:()=>E});var o={};t.r(o),t.d(o,{GET:()=>c});var n=t(2085),r=t(1650),a=t(5980),i=t(627),T=t(9098),_=t(1043);async function c(s){let e=new URL(s.url),t={};e.searchParams.forEach((s,e)=>{t[e]=s});let o=(0,T.getDb)(),n=await (0,_.handleGetStats)(o,t);return i.NextResponse.json(n.body,{status:n.status})}let l=new n.AppRouteRouteModule({definition:{kind:r.x.APP_ROUTE,page:"/api/stats/route",pathname:"/api/stats",filename:"route",bundlePath:"app/api/stats/route"},resolvedPagePath:"/Users/philippwassibauer/agentlens/app/api/stats/route.ts",nextConfigOutput:"",userland:o}),{requestAsyncStorage:u,staticGenerationAsyncStorage:E,serverHooks:d}=l,N="/api/stats/route";function p(){return(0,a.patchFetch)({serverHooks:d,staticGenerationAsyncStorage:E})}},1043:(s,e,t)=>{t.d(e,{handleGetStats:()=>i});var o=t(4210),n=t(2960),r=t(8095);function a(s,e){let t=new Date(s);return t.setDate(t.getDate()-e),t.toISOString()}async function i(s,e){let t=e.team_id||"default",i=new Date().toISOString(),T=e.from||a(i,30),_=e.to||i,c=a(T,30),l=e.harness,u=e.project,E=(await (0,r.handleGetSessions)(s,{team_id:t,from:T,to:_,harness:l,project:u,limit:"10000"})).body.sessions,d=(await (0,r.handleGetSessions)(s,{team_id:t,from:c,to:T,harness:l,project:u,limit:"10000"})).body.sessions,N=E.length,p=E.filter(s=>"completed"===s.status).length,L=E.filter(s=>"crashed"===s.status).length,m=E.filter(s=>null!==s.stats.score),h=m.length>0?m.reduce((s,e)=>s+e.stats.score.composite,0)/m.length:null,U=E.reduce((s,e)=>s+e.stats.prompt_count,0),O=N>0?Math.round(U/N*10)/10:0,A=E.reduce((s,e)=>s+(e.stats.total_cost_usd||0),0),X=E.reduce((s,e)=>s+(e.stats.total_tokens||0),0),I=E.reduce((s,e)=>s+(e.stats.total_input_tokens||0),0),g=E.reduce((s,e)=>s+(e.stats.total_output_tokens||0),0),D=E.reduce((s,e)=>s+(e.stats.total_cache_read_tokens||0),0),f=E.reduce((s,e)=>s+(e.stats.total_cache_write_tokens||0),0),R=E.filter(s=>null!==s.stats.context_utilization_pct),v=R.length>0?Math.round(R.reduce((s,e)=>s+e.stats.context_utilization_pct,0)/R.length*100)/100:null,S=R.filter(s=>s.stats.context_utilization_pct>80).length,k=new Map;for(let s of E){let e=s.stats.model||s.model||"unknown";k.has(e)||k.set(e,{session_count:0,total_cost:0,total_tokens:0});let t=k.get(e);t.session_count++,t.total_cost+=s.stats.total_cost_usd||0,t.total_tokens+=s.stats.total_tokens||0}let F=Array.from(k.entries()).filter(([s])=>"unknown"!==s).map(([s,e])=>({model:s,session_count:e.session_count,total_cost_usd:Math.round(1e4*e.total_cost)/1e4,total_tokens:e.total_tokens})).sort((s,e)=>e.session_count-s.session_count),w=d.length,y=d.filter(s=>null!==s.stats.score),M=y.length>0?y.reduce((s,e)=>s+e.stats.score.composite,0)/y.length:null,x=d.reduce((s,e)=>s+e.stats.prompt_count,0),C=w>0?Math.round(x/w*10)/10:0,b=new Map;for(let s of E){let e=s.started_at.slice(0,10);b.has(e)||b.set(e,{count:0,scores:[]});let t=b.get(e);t.count++,null!==s.stats.score&&t.scores.push(s.stats.score.composite)}let G=Array.from(b.entries()).map(([s,e])=>({date:s,count:e.count,avg_score:e.scores.length>0?e.scores.reduce((s,e)=>s+e,0)/e.scores.length:null})).sort((s,e)=>s.date.localeCompare(e.date)),q=new Map;for(let s of E){let e=s.user_id;q.has(e)||q.set(e,{session_count:0,scores:[]});let t=q.get(e);t.session_count++,null!==s.stats.score&&t.scores.push(s.stats.score.composite)}let P=Array.from(q.entries()).map(([s,e])=>({user_id:s,session_count:e.session_count,avg_score:e.scores.length>0?e.scores.reduce((s,e)=>s+e,0)/e.scores.length:null})),j=new Map;for(let s of E){let e=s.project;j.has(e)||j.set(e,{session_count:0,scores:[],total_cost:0});let t=j.get(e);t.session_count++,t.total_cost+=s.stats.total_cost_usd||0,null!==s.stats.score&&t.scores.push(s.stats.score.composite)}let Y=Array.from(j.entries()).map(([s,e])=>({project:s,session_count:e.session_count,total_cost_usd:Math.round(1e4*e.total_cost)/1e4,avg_score:e.scores.length>0?e.scores.reduce((s,e)=>s+e,0)/e.scores.length:null})).sort((s,e)=>e.session_count-s.session_count),B=new Map;for(let s of E){let e=s.harness||"pi",t=s.stats.model||s.model||"unknown",o=`${e}::${t}`;B.has(o)||B.set(o,{harness:e,model:t,session_count:0,scores:[],total_cost:0,total_prompts:0});let n=B.get(o);n.session_count++,n.total_cost+=s.stats.total_cost_usd||0,n.total_prompts+=s.stats.prompt_count||0,null!==s.stats.score&&n.scores.push(s.stats.score.composite)}let z=Array.from(B.values()).filter(s=>"unknown"!==s.model).map(s=>({harness:s.harness,model:s.model,session_count:s.session_count,avg_score:s.scores.length>0?Math.round(s.scores.reduce((s,e)=>s+e,0)/s.scores.length*100)/100:null,avg_cost_per_session:s.session_count>0?Math.round(s.total_cost/s.session_count*1e4)/1e4:0,avg_prompts_per_session:s.session_count>0?Math.round(s.total_prompts/s.session_count*10)/10:0,total_cost_usd:Math.round(1e4*s.total_cost)/1e4})).sort((s,e)=>e.session_count-s.session_count),K=new Map;for(let s of E);for(let e of s.select().from(n.U3).where((0,o.xD)((0,o.eq)(n.U3.eventType,"tool_call"),(0,o.eg)(n.U3.timestamp,T),(0,o.G)(n.U3.timestamp,_))).all()){let s=JSON.parse(e.payload||"{}"),t=s.tool||"unknown";K.has(t)||K.set(t,{count:0,errors:0,totalDuration:0});let o=K.get(t);o.count++,s.is_error&&o.errors++,o.totalDuration+=s.duration_ms||0}let J=Array.from(K.entries()).map(([s,e])=>({tool:s,count:e.count,errors:e.errors,success_rate:e.count>0?Math.round((e.count-e.errors)/e.count*100):100,avg_duration_ms:e.count>0?Math.round(e.totalDuration/e.count):0})).sort((s,e)=>e.count-s.count),$=s.select().from(n.U3).where((0,o.xD)((0,o.eq)(n.U3.eventType,"error"),(0,o.eg)(n.U3.timestamp,T),(0,o.G)(n.U3.timestamp,_))).all(),H=new Map;for(let s of $){let e=JSON.parse(s.payload||"{}"),t=(e.message||"unknown error").slice(0,80),o=e.tool||"unknown",n=t.split("\n")[0].trim();H.has(n)||H.set(n,{count:0,tool:o}),H.get(n).count++}let Q=Array.from(H.entries()).map(([s,e])=>({message:s,count:e.count,tool:e.tool})).sort((s,e)=>e.count-s.count).slice(0,10),W=new Map;for(let s of $){let e=JSON.parse(s.payload||"{}"),t=(e.message||"unknown error").slice(0,80).split("\n")[0].trim(),o=e.tool||"unknown";W.has(t)||W.set(t,{count:0,tool:o,sessionIds:new Set});let n=W.get(t);n.count++,n.sessionIds.add(s.sessionId)}return{status:200,body:{total_sessions:N,completed_sessions:p,crashed_sessions:L,avg_score:h,avg_prompts_per_session:O,sessions_per_day:G,by_user:P,by_project:Y,changes:{sessions:w>0?Math.round((N-w)/w*100):null,score:null!==h&&null!==M?Math.round((h-M)*100):null,prompts:C>0?Math.round((O-C)*10)/10:null},tool_breakdown:J,top_errors:Q,total_cost_usd:Math.round(1e4*A)/1e4,total_tokens:X,total_input_tokens:I,total_output_tokens:g,avg_cost_per_session:N>0?Math.round(A/N*1e4)/1e4:0,avg_context_utilization_pct:v,sessions_near_limit:S,total_cache_read_tokens:D,total_cache_write_tokens:f,cache_hit_rate:I>0?Math.round(D/I*1e4)/100:null,by_model:F,by_harness_model:z,trouble_spots:Array.from(W.entries()).map(([s,e])=>({message:s,count:e.count,session_count:e.sessionIds.size,tool:e.tool})).sort((s,e)=>e.count-s.count).slice(0,10)}}}},9098:(s,e,t)=>{t.d(e,{getDb:()=>E});var o=t(5890),n=t.n(o),r=t(6267),a=t(3787),i=t(5315),T=t.n(i),_=t(2048),c=t.n(_),l=t(9801);let u=null;function E(){if(u)return u;let s=process.env.AGENTLENS_DB_PATH||T().join((0,l.homedir)(),".agentlens","agentlens.db"),e=T().dirname(s);c().existsSync(e)||c().mkdirSync(e,{recursive:!0});let t=new(n())(s);t.pragma("journal_mode = WAL");let o=(0,r.t)(t);o.run((0,a.i6)`
|
|
2
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
3
|
+
id TEXT PRIMARY KEY,
|
|
4
|
+
team_id TEXT NOT NULL,
|
|
5
|
+
user_id TEXT NOT NULL,
|
|
6
|
+
project TEXT NOT NULL,
|
|
7
|
+
git_repo TEXT,
|
|
8
|
+
git_branch TEXT,
|
|
9
|
+
pi_version TEXT NOT NULL DEFAULT '',
|
|
10
|
+
skills_used TEXT NOT NULL DEFAULT '[]',
|
|
11
|
+
model TEXT,
|
|
12
|
+
harness TEXT NOT NULL DEFAULT 'pi',
|
|
13
|
+
started_at TEXT NOT NULL,
|
|
14
|
+
ended_at TEXT,
|
|
15
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
16
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
17
|
+
)
|
|
18
|
+
`),o.run((0,a.i6)`
|
|
19
|
+
CREATE TABLE IF NOT EXISTS events (
|
|
20
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
21
|
+
session_id TEXT NOT NULL,
|
|
22
|
+
event_type TEXT NOT NULL,
|
|
23
|
+
timestamp TEXT NOT NULL,
|
|
24
|
+
payload TEXT NOT NULL DEFAULT '{}',
|
|
25
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
26
|
+
)
|
|
27
|
+
`);try{o.run((0,a.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_team_id ON sessions(team_id)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_user_id ON sessions(user_id)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_started_at ON sessions(started_at)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_sessions_status ON sessions(status)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_id ON events(session_id)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_events_session_timestamp ON events(session_id, timestamp)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_events_event_type ON events(event_type)`),o.run((0,a.i6)`
|
|
28
|
+
CREATE TABLE IF NOT EXISTS pull_requests (
|
|
29
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
30
|
+
session_id TEXT NOT NULL,
|
|
31
|
+
repo TEXT NOT NULL,
|
|
32
|
+
branch TEXT NOT NULL,
|
|
33
|
+
pr_number INTEGER NOT NULL,
|
|
34
|
+
pr_url TEXT NOT NULL,
|
|
35
|
+
pr_title TEXT NOT NULL DEFAULT '',
|
|
36
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
37
|
+
merged_at TEXT,
|
|
38
|
+
reviews_approved INTEGER NOT NULL DEFAULT 0,
|
|
39
|
+
reviews_changes_requested INTEGER NOT NULL DEFAULT 0,
|
|
40
|
+
review_comments INTEGER NOT NULL DEFAULT 0,
|
|
41
|
+
commits_after_review INTEGER NOT NULL DEFAULT 0,
|
|
42
|
+
first_review_at TEXT,
|
|
43
|
+
time_to_merge_hours REAL,
|
|
44
|
+
checked_at TEXT,
|
|
45
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
46
|
+
UNIQUE(session_id, pr_number)
|
|
47
|
+
)
|
|
48
|
+
`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_prs_session_id ON pull_requests(session_id)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_prs_status ON pull_requests(status)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_prs_repo_branch ON pull_requests(repo, branch)`);try{o.run((0,a.i6)`ALTER TABLE sessions ADD COLUMN model TEXT`)}catch{}try{o.run((0,a.i6)`ALTER TABLE sessions ADD COLUMN harness TEXT NOT NULL DEFAULT 'pi'`)}catch{}for(let s of(o.run((0,a.i6)`
|
|
49
|
+
CREATE TABLE IF NOT EXISTS eval_checks (
|
|
50
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
51
|
+
session_id TEXT NOT NULL,
|
|
52
|
+
check_id TEXT NOT NULL,
|
|
53
|
+
check_version TEXT NOT NULL,
|
|
54
|
+
score REAL NOT NULL,
|
|
55
|
+
raw_score INTEGER NOT NULL,
|
|
56
|
+
reasoning TEXT NOT NULL DEFAULT '',
|
|
57
|
+
evidence TEXT,
|
|
58
|
+
model TEXT NOT NULL,
|
|
59
|
+
cost_usd REAL NOT NULL DEFAULT 0,
|
|
60
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
61
|
+
UNIQUE(session_id, check_id, check_version)
|
|
62
|
+
)
|
|
63
|
+
`),o.run((0,a.i6)`
|
|
64
|
+
CREATE TABLE IF NOT EXISTS eval_summaries (
|
|
65
|
+
session_id TEXT PRIMARY KEY,
|
|
66
|
+
qual_score REAL NOT NULL,
|
|
67
|
+
checks_passed INTEGER NOT NULL DEFAULT 0,
|
|
68
|
+
checks_total INTEGER NOT NULL DEFAULT 0,
|
|
69
|
+
total_eval_cost_usd REAL NOT NULL DEFAULT 0,
|
|
70
|
+
evaluated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
71
|
+
)
|
|
72
|
+
`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_session ON eval_checks(session_id)`),o.run((0,a.i6)`CREATE INDEX IF NOT EXISTS idx_eval_checks_lookup ON eval_checks(session_id, check_id, check_version)`),o.run((0,a.i6)`
|
|
73
|
+
CREATE TABLE IF NOT EXISTS session_insights (
|
|
74
|
+
session_id TEXT PRIMARY KEY,
|
|
75
|
+
task_category TEXT NOT NULL,
|
|
76
|
+
task_size TEXT NOT NULL,
|
|
77
|
+
workflow_tags TEXT NOT NULL DEFAULT '[]',
|
|
78
|
+
prompting_tags TEXT NOT NULL DEFAULT '[]',
|
|
79
|
+
failure_modes TEXT NOT NULL DEFAULT '[]',
|
|
80
|
+
complexity_factors TEXT NOT NULL DEFAULT '[]',
|
|
81
|
+
key_learning TEXT,
|
|
82
|
+
extracted_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
83
|
+
model TEXT NOT NULL,
|
|
84
|
+
synced_at TEXT
|
|
85
|
+
)
|
|
86
|
+
`),["failure_modes TEXT NOT NULL DEFAULT '[]'","complexity_factors TEXT NOT NULL DEFAULT '[]'","key_learning TEXT"]))try{o.run(a.i6.raw(`ALTER TABLE session_insights ADD COLUMN ${s}`))}catch{}return u=o,o}}};var e=require("../../../webpack-runtime.js");e.C(s);var t=s=>e(e.s=s),o=e.X(0,[522,787,218,267,449,95],()=>t(1210));module.exports=o})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":1,"files":["../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/database.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/index.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/backup.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/function.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/table.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/util.js","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/package.json","../../../../../node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/bindings","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/package.json","../../../../../node_modules/.pnpm/bindings@1.5.0/node_modules/file-uri-to-path","../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js","../../../../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/package.json","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/async-local-storage.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/constants.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/trace/tracer.js","../../../../../node_modules/.pnpm/next@14.2.35_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/package.json","../../../../../node_modules/better-sqlite3","../../../../../node_modules/next","../../../../../package.json","../../../../package.json","../../../chunks/218.js","../../../chunks/267.js","../../../chunks/449.js","../../../chunks/522.js","../../../chunks/787.js","../../../chunks/95.js","../../../webpack-runtime.js"]}
|