clawatch 1.0.28 → 1.0.32
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/backend/dist/alertChecker.d.ts.map +1 -1
- package/backend/dist/alertChecker.js +14 -2
- package/backend/dist/alertChecker.js.map +1 -1
- package/backend/dist/routes.d.ts.map +1 -1
- package/backend/dist/routes.js +2 -1
- package/backend/dist/routes.js.map +1 -1
- package/backend/node_modules/.package-lock.json +18 -3
- package/backend/package-lock.json +18 -3
- package/dist/cli.js +91 -1
- package/dist/cli.js.map +1 -1
- package/frontend/.next/BUILD_ID +1 -1
- package/frontend/.next/build-manifest.json +2 -2
- package/frontend/.next/prerender-manifest.json +3 -3
- package/frontend/.next/required-server-files.json +4 -4
- package/frontend/.next/server/app/_global-error.html +2 -2
- package/frontend/.next/server/app/_global-error.rsc +1 -1
- package/frontend/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/frontend/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/frontend/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/frontend/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/frontend/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/frontend/.next/server/app/_not-found.html +1 -1
- package/frontend/.next/server/app/_not-found.rsc +1 -1
- package/frontend/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/frontend/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/frontend/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/frontend/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/frontend/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/frontend/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/frontend/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
- package/frontend/.next/server/app/dashboard/projects/[id]/page_client-reference-manifest.js +1 -1
- package/frontend/.next/server/app/dashboard/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/frontend/.next/server/app/dashboard.html +1 -1
- package/frontend/.next/server/app/dashboard.rsc +2 -2
- package/frontend/.next/server/app/dashboard.segments/_full.segment.rsc +2 -2
- package/frontend/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/frontend/.next/server/app/dashboard.segments/_index.segment.rsc +1 -1
- package/frontend/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/frontend/.next/server/app/dashboard.segments/dashboard/__PAGE__.segment.rsc +2 -2
- package/frontend/.next/server/app/dashboard.segments/dashboard.segment.rsc +1 -1
- package/frontend/.next/server/app/index.html +2 -2
- package/frontend/.next/server/app/index.rsc +1 -1
- package/frontend/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/frontend/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/frontend/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/frontend/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/frontend/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/frontend/.next/server/chunks/ssr/_b0ae6d33._.js +1 -1
- package/frontend/.next/server/pages/404.html +1 -1
- package/frontend/.next/server/pages/500.html +2 -2
- package/frontend/.next/server/server-reference-manifest.js +1 -1
- package/frontend/.next/server/server-reference-manifest.json +1 -1
- package/frontend/.next/static/chunks/{e286ecc1826dbc08.js → 411ee9af7239f043.js} +1 -1
- package/frontend/.next/static/chunks/{4377848a9c28ed1e.js → 461221b3377fd0f6.js} +1 -1
- package/frontend/.next/static/chunks/{89705374f0ef34d2.js → a4f36557083ee088.js} +1 -1
- package/frontend/server.js +1 -1
- package/package.json +1 -1
- package/frontend/.env +0 -1
- /package/frontend/.next/static/{0wK6XKeZM4pETq1rAH0LM → 9TLyPFNXZUL_yHMhwT7iY}/_buildManifest.js +0 -0
- /package/frontend/.next/static/{0wK6XKeZM4pETq1rAH0LM → 9TLyPFNXZUL_yHMhwT7iY}/_clientMiddlewareManifest.json +0 -0
- /package/frontend/.next/static/{0wK6XKeZM4pETq1rAH0LM → 9TLyPFNXZUL_yHMhwT7iY}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33525,(t,e,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"warnOnce",{enumerable:!0,get:function(){return o}});let o=t=>{}},18566,(t,e,s)=>{e.exports=t.r(76562)},15288,87486,9165,t=>{"use strict";let e,s,o,a,n;var i,r=t.i(43476),d=t.i(75157);function l({className:t,size:e="default",...s}){return(0,r.jsx)("div",{"data-slot":"card","data-size":e,className:(0,d.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",t),...s})}function c({className:t,...e}){return(0,r.jsx)("div",{"data-slot":"card-header",className:(0,d.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",t),...e})}function u({className:t,...e}){return(0,r.jsx)("div",{"data-slot":"card-title",className:(0,d.cn)("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function m({className:t,...e}){return(0,r.jsx)("div",{"data-slot":"card-content",className:(0,d.cn)("px-4 group-data-[size=sm]/card:px-3",t),...e})}t.s(["Card",()=>l,"CardContent",()=>m,"CardHeader",()=>c,"CardTitle",()=>u],15288);var p=t.i(19805),g=t.i(27601);let h=(0,t.i(25913).cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function f({className:t,variant:e="default",render:s,...o}){var a;return a={defaultTagName:"span",props:(0,p.mergeProps)({className:(0,d.cn)(h({variant:e}),t)},o),render:s,state:{slot:"badge",variant:e}},(0,g.useRenderElement)(a.defaultTagName??"div",a,a)}t.s(["Badge",()=>f],87486);var b=t.i(47167);let k=new Date,w=t=>new Date(k.getTime()-6e4*t).toISOString(),y=t=>new Date(k.getTime()-36e5*t).toISOString(),C=[{id:"agent-1",name:"code-reviewer",host:"prod-us-east-1",status:"running",lastHeartbeat:w(.5),costUsd:4.82,tokenCount:124e4,errorCount:0},{id:"agent-2",name:"deploy-bot",host:"prod-us-east-1",status:"running",lastHeartbeat:w(1),costUsd:2.15,tokenCount:52e4,errorCount:1},{id:"agent-3",name:"data-pipeline",host:"prod-eu-west-1",status:"error",lastHeartbeat:w(12),costUsd:8.43,tokenCount:21e5,errorCount:7},{id:"agent-4",name:"customer-support",host:"prod-us-west-2",status:"stuck",lastHeartbeat:w(45),costUsd:12.67,tokenCount:34e5,errorCount:3},{id:"agent-5",name:"test-runner",host:"staging-1",status:"paused",lastHeartbeat:y(2),costUsd:1.03,tokenCount:28e4,errorCount:0},{id:"agent-6",name:"doc-generator",host:"prod-us-east-1",status:"running",lastHeartbeat:w(.2),costUsd:3.21,tokenCount:89e4,errorCount:0},{id:"agent-7",name:"security-scanner",host:"prod-eu-west-1",status:"stopped",lastHeartbeat:y(6),costUsd:.45,tokenCount:12e4,errorCount:0},{id:"agent-8",name:"slack-responder",host:"prod-us-west-2",status:"running",lastHeartbeat:w(.1),costUsd:6.89,tokenCount:178e4,errorCount:2}],v=[{id:"alert-1",agentId:"agent-4",type:"stuck",severity:"critical",message:"customer-support has not sent a heartbeat in 45 minutes",timestamp:w(44),acknowledged:!1},{id:"alert-2",agentId:"agent-3",type:"error",severity:"critical",message:"data-pipeline encountered 7 errors in the last hour",timestamp:w(10),acknowledged:!1},{id:"alert-3",agentId:"agent-4",type:"cost_spike",severity:"warning",message:"customer-support cost increased 340% in the last hour",timestamp:y(1),acknowledged:!1},{id:"alert-4",agentId:"agent-8",type:"loop_detected",severity:"warning",message:"slack-responder may be in a retry loop (similar outputs detected)",timestamp:w(30),acknowledged:!0},{id:"alert-5",agentId:"agent-2",type:"error",severity:"info",message:"deploy-bot encountered a transient API error (auto-recovered)",timestamp:y(3),acknowledged:!0}],I={totalUsd:39.65,totalTokens:45e5,sessionCount:12,byAgent:C.map(t=>({agentId:t.id,name:t.name,costUsd:t.costUsd,tokenCount:t.tokenCount})),byModel:[{model:"claude-sonnet-4-20250514",costUsd:22.1},{model:"claude-haiku-4-20250506",costUsd:11.35},{model:"gpt-4o",costUsd:6.2}],byProject:[{projectId:"proj-1",name:"ClaWatch",costUsd:18.5,tokenCount:21e5,sessionCount:5},{projectId:"proj-2",name:"Auth Service",costUsd:12.35,tokenCount:14e5,sessionCount:4},{projectId:"proj-3",name:"Mobile App",costUsd:8.8,tokenCount:1e6,sessionCount:3}],daily:Array.from({length:7},(t,e)=>{let s=new Date("2026-03-04");return s.setDate(s.getDate()+e),{date:s.toISOString().slice(0,10),costUsd:+(3+8*Math.random()).toFixed(2),tokenCount:Math.floor(4e5+8e5*Math.random()),sessionCount:Math.floor(1+4*Math.random())}})},A=[{id:"session-1",agentId:"ofek",title:"Build ClaWatch dashboard with real-time alerts",status:"active",costUsd:3.47,tokenCount:892e3,messageCount:47,model:"claude-sonnet-4-20250514",startedAt:w(45),lastActivityAt:w(1),duration:2640,projects:[{id:"project-1",name:"Building ClaWatch"}]},{id:"session-2",agentId:"anas",title:"Fix authentication bug in user login flow",status:"completed",costUsd:1.23,tokenCount:34e4,messageCount:22,model:"claude-sonnet-4-20250514",startedAt:y(3),lastActivityAt:y(2),duration:3600,projects:[{id:"project-2",name:"Bug Fixes Sprint"}]},{id:"session-3",agentId:"dor",title:"Review PR #47 — add retry logic to API calls",status:"idle",costUsd:.87,tokenCount:215e3,messageCount:14,model:"claude-haiku-4-20250506",startedAt:w(90),lastActivityAt:w(12),duration:4680},{id:"session-4",agentId:"ofek",title:"Implement WebSocket event streaming for agent heartbeats",status:"active",costUsd:5.12,tokenCount:134e4,messageCount:63,model:"claude-sonnet-4-20250514",startedAt:y(1.5),lastActivityAt:w(.5),duration:5400,projects:[{id:"project-1",name:"Building ClaWatch"},{id:"project-2",name:"Bug Fixes Sprint"}]},{id:"session-5",agentId:"anas",title:"Refactor database schema for multi-tenant support",status:"completed",costUsd:2.89,tokenCount:78e4,messageCount:38,model:"claude-sonnet-4-20250514",startedAt:y(5),lastActivityAt:y(4),duration:3600},{id:"session-6",agentId:"dor",title:"Debug failing CI pipeline — Jest timeout errors",status:"idle",costUsd:.54,tokenCount:145e3,messageCount:11,model:"claude-haiku-4-20250506",startedAt:w(30),lastActivityAt:w(8),duration:1320},{id:"session-7",agentId:"ofek",title:"Add Telegram bot notification integration",status:"completed",costUsd:1.76,tokenCount:46e4,messageCount:29,model:"claude-sonnet-4-20250514",startedAt:y(8),lastActivityAt:y(7),duration:3600},{id:"session-8",agentId:"anas",title:"Write unit tests for cost calculation module",status:"active",costUsd:.92,tokenCount:248e3,messageCount:18,model:"claude-haiku-4-20250506",startedAt:w(15),lastActivityAt:w(2),duration:780},{id:"session-9",agentId:"dor",title:"Optimize SQL queries — reduce p95 latency from 800ms to 200ms",status:"completed",costUsd:4.31,tokenCount:112e4,messageCount:52,model:"claude-sonnet-4-20250514",startedAt:y(12),lastActivityAt:y(10),duration:7200},{id:"session-10",agentId:"ofek",title:"Set up Docker Compose for local development environment",status:"idle",costUsd:.63,tokenCount:172e3,messageCount:9,model:"claude-haiku-4-20250506",startedAt:w(60),lastActivityAt:w(20),duration:2400}],U=[{id:"project-1",name:"Building ClaWatch",description:"Full-stack AI observability platform with real-time monitoring, session tracking, and cost analytics",createdAt:y(48),updatedAt:w(5),sessionCount:3,totalCostUsd:185.98},{id:"project-2",name:"Bug Fixes Sprint",description:"Critical bug fixes for authentication, database schema, and CI pipeline issues",createdAt:y(24),updatedAt:w(30),sessionCount:2,totalCostUsd:12.5}],x=(e=[],s=0,(o=(t,o,a,n,i,r)=>{s++,e.push({sessionId:t,agentId:o,id:`tl-${s}`,role:a,timestamp:w(n),content:i,...r})})("session-1","ofek","user",120,"Build the ClaWatch dashboard with real-time alerts and agent monitoring. Use Next.js 15 + shadcn/ui."),o("session-1","ofek","assistant",119,"I'll build the ClaWatch dashboard. Let me start by setting up the project structure and examining existing code.",{model:"claude-sonnet-4-20250514",costUsd:.04}),o("session-3","dor","user",118,"Review the initial project setup and suggest architectural improvements for the monitoring system."),o("session-1","ofek","tool",117,"src/\n app/\n dashboard/\n page.tsx\n layout.tsx\n components/\n ui/\n lib/\n types.ts\n api.ts",{toolName:"read"}),o("session-3","dor","assistant",116,"Looking at the project structure. I'll review the architecture and suggest improvements for scalability.",{model:"claude-haiku-4-20250506",costUsd:.01}),o("session-1","ofek","assistant",115,"Project structure looks good. I'll create the type definitions for agents, sessions, alerts, and cost data.",{model:"claude-sonnet-4-20250514",costUsd:.06}),o("session-8","anas","user",114,"Write comprehensive unit tests for the cost calculation module including edge cases."),o("session-1","ofek","tool",113,"File written: src/lib/types.ts (78 lines)",{toolName:"write"}),o("session-8","anas","assistant",112,"I'll write thorough unit tests for cost calculations. Let me first examine the module.",{model:"claude-haiku-4-20250506",costUsd:.02}),o("session-3","dor","tool",111,"export interface Agent {\n id: string;\n name: string;\n status: AgentStatus;\n ...",{toolName:"read"}),o("session-3","dor","assistant",110,"The type definitions look solid. I'd suggest adding a `duration` field to Session for better analytics. Also, the cost tracking should support per-model breakdown.",{model:"claude-haiku-4-20250506",costUsd:.02}),o("session-1","ofek","assistant",108,"Good point from the review. I'll add duration tracking and per-model cost breakdown. Now creating the mock data layer.",{model:"claude-sonnet-4-20250514",costUsd:.05}),o("session-8","anas","tool",107,"export function calculateCost(tokens: number, model: string): number { ... }",{toolName:"read"}),o("session-1","ofek","tool",105,"File written: src/lib/mock-data.ts (280 lines)",{toolName:"write"}),o("session-8","anas","assistant",104,"Found the cost module. I'll test standard pricing, cache discount calculations, multi-model sessions, and zero-token edge cases.",{model:"claude-haiku-4-20250506",costUsd:.03}),o("session-1","ofek","system",103,"Context window: 45% utilized (90K/200K tokens)"),o("session-8","anas","tool",102,"File written: src/__tests__/cost-calculation.test.ts (156 lines)",{toolName:"write"}),o("session-1","ofek","assistant",100,"Mock data created. Now building the dashboard page with agent cards, alert banners, and cost overview.",{model:"claude-sonnet-4-20250514",costUsd:.12}),o("session-3","dor","user",98,"Can you also review the API layer and check for error handling gaps?"),o("session-1","ofek","tool",95,"File written: src/app/dashboard/page.tsx (320 lines)",{toolName:"write"}),o("session-8","anas","assistant",94,"All 12 test cases pass. Found one edge case where negative token counts could cause issues — adding a guard.",{model:"claude-haiku-4-20250506",costUsd:.02}),o("session-3","dor","assistant",92,"Reviewing API layer. The fetchJson wrapper needs better error handling — currently swallows network errors. I'll suggest adding retry logic and timeout handling.",{model:"claude-haiku-4-20250506",costUsd:.03}),o("session-8","anas","tool",90,"$ npm test -- --watchAll=false\n\nTest Suites: 1 passed, 1 total\nTests: 14 passed, 14 total\nTime: 2.834s",{toolName:"exec"}),o("session-1","ofek","assistant",88,"Dashboard page done. Adding real-time polling with 5-second intervals and the tabbed interface for Agents/Sessions views.",{model:"claude-sonnet-4-20250514",costUsd:.08}),o("session-1","ofek","tool",85,"$ npm run build\n\n ✓ Compiled successfully\n ✓ Generating static pages (5/5)\n\nBuild completed in 8.2s",{toolName:"exec"}),o("session-3","dor","assistant",83,"Here's my review summary:\n1. Add retry logic to fetchJson (3 retries with exponential backoff)\n2. Add request timeout (30s default)\n3. The mock fallback pattern is good but should log errors to a monitoring service\n4. Consider adding request deduplication for concurrent calls",{model:"claude-haiku-4-20250506",costUsd:.04}),o("session-1","ofek","user",80,"Add session detail view with message timeline, cost breakdown by model, and token analysis."),o("session-1","ofek","assistant",78,"I'll build the session detail page with a full message timeline. Each message type will have distinct visual treatment.",{model:"claude-sonnet-4-20250514",costUsd:.09}),o("session-1","ofek","tool",75,"File written: src/app/dashboard/sessions/[id]/page.tsx (340 lines)",{toolName:"write"}),o("session-8","anas","assistant",72,"All tests passing. Adding integration tests for the API mock fallback pattern now.",{model:"claude-haiku-4-20250506",costUsd:.02}),o("session-1","ofek","assistant",70,"Session detail page complete with:\n- Message timeline with user/assistant/tool/system styling\n- Cost breakdown by model with progress bars\n- Token breakdown (input/output/cache read/cache write)\n- Collapsible tool outputs",{model:"claude-sonnet-4-20250514",costUsd:.06}),o("session-1","ofek","system",68,"Context window: 72% utilized (144K/200K tokens)"),o("session-1","ofek","tool",65,"$ npm run build\n\n ✓ Compiled successfully\n ✓ Generating static pages (7/7)\n\nBuild completed in 9.1s",{toolName:"exec"}),o("session-1","ofek","assistant",60,"Build passes. The ClaWatch dashboard is fully functional with real-time monitoring, session tracking, and cost analytics.",{model:"claude-sonnet-4-20250514",costUsd:.04}),e.sort((t,e)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime())),S={"project-1":{id:"project-1",name:"Building ClaWatch",description:"Full-stack AI observability platform with real-time monitoring, session tracking, and cost analytics",stats:{totalCostUsd:185.98,totalTokens:482e4,totalMessages:128,sessionCount:3,dateRange:{from:y(48),to:w(5)}},agentBreakdown:[{agentId:"ofek",costUsd:142.5,tokenCount:32e5,messageCount:78,percentage:76.6},{agentId:"dor",costUsd:28.48,tokenCount:98e4,messageCount:32,percentage:15.3},{agentId:"anas",costUsd:15,tokenCount:64e4,messageCount:18,percentage:8.1}],sessions:[A.find(t=>"session-1"===t.id),A.find(t=>"session-3"===t.id),A.find(t=>"session-8"===t.id)],timeline:x},"project-2":{id:"project-2",name:"Bug Fixes Sprint",description:"Critical bug fixes for authentication, database schema, and CI pipeline issues",stats:{totalCostUsd:12.5,totalTokens:112e4,totalMessages:60,sessionCount:2,dateRange:{from:y(24),to:w(30)}},agentBreakdown:[{agentId:"anas",costUsd:7.8,tokenCount:68e4,messageCount:38,percentage:62.4},{agentId:"dor",costUsd:4.7,tokenCount:44e4,messageCount:22,percentage:37.6}],sessions:[A.find(t=>"session-2"===t.id),A.find(t=>"session-6"===t.id)],timeline:[{sessionId:"session-2",agentId:"anas",id:"tl-b1",role:"user",timestamp:y(3),content:"Fix the authentication bug in the user login flow. Users are getting 401 errors after token refresh."},{sessionId:"session-2",agentId:"anas",id:"tl-b2",role:"assistant",timestamp:y(2.9),content:"I'll investigate the auth flow. Let me check the token refresh logic.",model:"claude-sonnet-4-20250514",costUsd:.03},{sessionId:"session-6",agentId:"dor",id:"tl-b3",role:"user",timestamp:y(2.8),content:"Debug the failing CI pipeline. Jest tests are timing out on the session module."},{sessionId:"session-2",agentId:"anas",id:"tl-b4",role:"tool",timestamp:y(2.7),content:"Found: refreshToken() doesn't await the database write before returning new token",toolName:"read"},{sessionId:"session-6",agentId:"dor",id:"tl-b5",role:"assistant",timestamp:y(2.6),content:"Looking at the CI logs. The Jest timeout suggests an unresolved promise in the test setup.",model:"claude-haiku-4-20250506",costUsd:.01},{sessionId:"session-2",agentId:"anas",id:"tl-b6",role:"assistant",timestamp:y(2.5),content:"Found the bug: `refreshToken()` returns before the DB write completes. Adding await fixes the race condition.",model:"claude-sonnet-4-20250514",costUsd:.05},{sessionId:"session-6",agentId:"dor",id:"tl-b7",role:"tool",timestamp:y(2.4),content:"$ jest --verbose\nFAILED: session.test.ts > should persist session data\nTimeout: 5000ms exceeded",toolName:"exec"},{sessionId:"session-6",agentId:"dor",id:"tl-b8",role:"assistant",timestamp:y(2.2),content:"The test is missing `afterAll` cleanup — the database connection stays open. Adding proper teardown.",model:"claude-haiku-4-20250506",costUsd:.02},{sessionId:"session-2",agentId:"anas",id:"tl-b9",role:"tool",timestamp:y(2.1),content:"$ npm test -- auth.test.ts\n\nTests: 8 passed, 8 total",toolName:"exec"},{sessionId:"session-6",agentId:"dor",id:"tl-b10",role:"tool",timestamp:y(2),content:"$ jest session.test.ts --verbose\nPASSED: all 6 tests",toolName:"exec"},{sessionId:"session-2",agentId:"anas",id:"tl-b11",role:"assistant",timestamp:y(1.9),content:"Auth bug fixed and all tests passing. The root cause was a missing await in the token refresh handler.",model:"claude-sonnet-4-20250514",costUsd:.03},{sessionId:"session-6",agentId:"dor",id:"tl-b12",role:"assistant",timestamp:y(1.8),content:"CI pipeline fixed. Added proper test teardown and increased timeout for integration tests to 10s.",model:"claude-haiku-4-20250506",costUsd:.02}]}},j={};for(let t of A)j[t.id]={...t,costByModel:t.model.includes("sonnet")?[{model:"claude-sonnet-4-20250514",costUsd:.82*t.costUsd,tokenCount:Math.floor(.75*t.tokenCount)},{model:"claude-haiku-4-20250506",costUsd:.18*t.costUsd,tokenCount:Math.floor(.25*t.tokenCount)}]:[{model:"claude-haiku-4-20250506",costUsd:.65*t.costUsd,tokenCount:Math.floor(.6*t.tokenCount)},{model:"claude-sonnet-4-20250514",costUsd:.35*t.costUsd,tokenCount:Math.floor(.4*t.tokenCount)}],tokenBreakdown:{input:Math.floor(.35*t.tokenCount),output:Math.floor(.3*t.tokenCount),cacheRead:Math.floor(.25*t.tokenCount),cacheWrite:Math.floor(.1*t.tokenCount)},messages:(i=t.id,[{id:`${i}-msg-1`,role:"user",timestamp:w(44),content:"Build the ClaWatch dashboard with real-time alert monitoring. Use Next.js 15 with shadcn/ui components."},{id:`${i}-msg-2`,role:"assistant",timestamp:w(43),content:"I'll build the ClaWatch dashboard. Let me start by examining the project structure and existing code.",model:"claude-sonnet-4-20250514",costUsd:.03,tokenCount:12400},{id:`${i}-msg-3`,role:"tool",timestamp:w(43),content:"src/\n app/\n dashboard/\n page.tsx\n layout.tsx\n page.tsx\n components/\n ui/\n lib/\n types.ts\n api.ts\n mock-data.ts",toolName:"read",toolInput:'{"path": "src/"}'},{id:`${i}-msg-4`,role:"assistant",timestamp:w(42),content:"I can see the project structure. Let me read the existing types and API files to understand the data model.",model:"claude-sonnet-4-20250514",costUsd:.02,tokenCount:8200},{id:`${i}-msg-5`,role:"tool",timestamp:w(42),content:'export type AgentStatus = "running" | "paused" | "stopped" | "error" | "stuck";\n\nexport interface Agent {\n id: string;\n name: string;\n ...',toolName:"read",toolInput:'{"path": "src/lib/types.ts"}'},{id:`${i}-msg-6`,role:"assistant",timestamp:w(40),content:"Now I'll create the dashboard page with agent cards, alert banners, and cost overview panels. I'll use the existing shadcn/ui components.",model:"claude-sonnet-4-20250514",costUsd:.08,tokenCount:34600},{id:`${i}-msg-7`,role:"tool",timestamp:w(39),content:"File written: src/app/dashboard/page.tsx (358 lines)",toolName:"write",toolInput:'{"path": "src/app/dashboard/page.tsx", "content": "..."}'},{id:`${i}-msg-8`,role:"tool",timestamp:w(38),content:"$ npm run build\n\n ✓ Compiled successfully\n ✓ Collecting page data\n ✓ Generating static pages (5/5)\n ✓ Collecting build traces\n\nRoute (app) Size First Load JS\n├ ○ / 5.2 kB 92.1 kB\n└ ○ /dashboard 12.4 kB 99.3 kB",toolName:"exec",toolInput:'{"command": "npm run build"}'},{id:`${i}-msg-9`,role:"assistant",timestamp:w(37),content:"The build succeeded. Let me now add the real-time polling mechanism and alert notification sounds.",model:"claude-sonnet-4-20250514",costUsd:.04,tokenCount:15800},{id:`${i}-msg-10`,role:"tool",timestamp:w(36),content:"Lines 49-64 edited in src/app/dashboard/page.tsx",toolName:"edit",toolInput:'{"path": "src/app/dashboard/page.tsx", "old_string": "...", "new_string": "..."}'},{id:`${i}-msg-11`,role:"user",timestamp:w(35),content:"Can you also add a cost breakdown by model? Show it as horizontal progress bars."},{id:`${i}-msg-12`,role:"assistant",timestamp:w(34),content:"Sure! I'll add a cost breakdown section with progress bars for each model. Let me update the dashboard.",model:"claude-sonnet-4-20250514",costUsd:.06,tokenCount:24200},{id:`${i}-msg-13`,role:"tool",timestamp:w(33),content:"Lines 254-305 edited in src/app/dashboard/page.tsx",toolName:"edit",toolInput:'{"path": "src/app/dashboard/page.tsx", "old_string": "...", "new_string": "..."}'},{id:`${i}-msg-14`,role:"system",timestamp:w(32),content:"Context window: 78% utilized (156K/200K tokens)"},{id:`${i}-msg-15`,role:"assistant",timestamp:w(31),content:"I've added the cost breakdown panels. The dashboard now shows:\n\n1. **Agent cards** with status, cost, tokens, errors, and heartbeat\n2. **Alert banner** for critical/warning alerts\n3. **Cost by Agent** — horizontal progress bars\n4. **Cost by Model** — horizontal progress bars\n\nThe data refreshes every 5 seconds via polling.",model:"claude-sonnet-4-20250514",costUsd:.05,tokenCount:18900},{id:`${i}-msg-16`,role:"tool",timestamp:w(30),content:'{"results": [{"title": "shadcn/ui Tabs Component", "url": "https://ui.shadcn.com/docs/components/tabs"}]}',toolName:"web_search",toolInput:'{"query": "shadcn ui tabs component usage"}'},{id:`${i}-msg-17`,role:"assistant",timestamp:w(28),content:"Let me add a tabbed interface for Agents and Sessions views. I'll implement the tabs using a simple state-based approach.",model:"claude-sonnet-4-20250514",costUsd:.11,tokenCount:45200},{id:`${i}-msg-18`,role:"tool",timestamp:w(27),content:"$ npm run build\n\n ✓ Compiled successfully\n ✓ Linting and checking validity of types\n ✓ Generating static pages (5/5)\n\nBuild completed in 8.2s",toolName:"exec",toolInput:'{"command": "npm run build"}'},{id:`${i}-msg-19`,role:"assistant",timestamp:w(25),content:"Build passes. The dashboard now has Agents and Sessions tabs with full filtering and sorting. All existing functionality is preserved.",model:"claude-sonnet-4-20250514",costUsd:.03,tokenCount:11600},{id:`${i}-msg-20`,role:"tool",timestamp:w(24),content:"$ npm test -- --watchAll=false\n\nTest Suites: 3 passed, 3 total\nTests: 12 passed, 12 total\nTime: 4.231s",toolName:"exec",toolInput:'{"command": "npm test -- --watchAll=false"}'}])};let $={"alert-1":{alert:v[0],agent:{id:"agent-4",name:"customer-support",status:"stuck"},relatedErrors:[],context:{lastHeartbeat:w(45),stuckDurationMinutes:45,agentStatus:"stuck"}},"alert-2":{alert:v[1],agent:{id:"agent-3",name:"data-pipeline",status:"error"},relatedErrors:[{timestamp:w(12),error:"TypeError: Cannot read properties of undefined (reading 'map')"},{timestamp:w(11),error:"ECONNREFUSED: Connection refused to database at 127.0.0.1:5432"},{timestamp:w(11),error:"ECONNREFUSED: Connection refused to database at 127.0.0.1:5432"},{timestamp:w(10),error:"Unhandled promise rejection: Query timeout after 30000ms"},{timestamp:w(10),error:'FATAL: too many connections for role "app_user"'}]},"alert-3":{alert:v[2],agent:{id:"agent-4",name:"customer-support",status:"running"},relatedErrors:[],context:{currentCostUsd:12.67,thresholdUsd:10,overage:2.67}},"alert-4":{alert:v[3],agent:{id:"agent-8",name:"slack-responder",status:"running"},relatedErrors:[{timestamp:w(32),error:"Detected 5 consecutive similar outputs — possible retry loop"},{timestamp:w(31),error:"Output similarity score: 0.94 (threshold: 0.85)"}]},"alert-5":{alert:v[4],agent:{id:"agent-2",name:"deploy-bot",status:"running"},relatedErrors:[{timestamp:y(3),error:"API returned 503 Service Unavailable — auto-retried successfully"}]}},P=b.default.env.NEXT_PUBLIC_API_KEY||"",T=!1;function N(){return T}function M(){T=!0}async function B(t,e){let s={"Content-Type":"application/json","ngrok-skip-browser-warning":"true",...P?{"X-ClaWatch-Key":P}:{},...e?.headers||{}},o=await fetch(`${t}`,{...e,headers:s});if(!o.ok)throw Error(`API error: ${o.status}`);return o.json()}async function F(){try{return(await B("/api/profiles")).profiles}catch{return console.warn("API unreachable, skipping profiles"),[]}}async function L(){try{return(await B("/api/version")).version}catch{return console.warn("API unreachable, skipping version"),null}}async function D(t,e){try{let s=new URLSearchParams;t&&s.set("status",t),e&&s.set("profile",e);let o=s.toString();return(await B(`/api/agents${o?`?${o}`:""}`)).agents}catch{return console.warn("API unreachable, falling back to mock data"),M(),C}}async function E(t){try{let e=new URLSearchParams;t?.limit!==void 0&&e.set("limit",String(t.limit)),t?.offset!==void 0&&e.set("offset",String(t.offset)),t?.severity&&e.set("severity",t.severity),t?.acknowledged!==void 0&&e.set("acknowledged",String(t.acknowledged)),t?.profile&&e.set("profile",t.profile);let s=e.toString();return await B(`/api/alerts${s?`?${s}`:""}`)}catch{return console.warn("API unreachable, falling back to mock data"),M(),{alerts:v,total:v.length}}}async function O(t){return await B(`/api/alerts/acknowledge-all${t?`?severity=${t}`:""}`,{method:"POST"})}async function R(t){try{let e=new URLSearchParams;t?.profile&&e.set("profile",t.profile),t?.from&&e.set("from",t.from),t?.to&&e.set("to",t.to);let s=e.toString();return await B(`/api/costs${s?`?${s}`:""}`)}catch{return console.warn("API unreachable, falling back to mock data"),M(),I}}async function _(t){await B(`/api/agents/${t}/pause`,{method:"POST"})}async function z(t){await B(`/api/agents/${t}/resume`,{method:"POST"})}async function W(t){await B(`/api/alerts/${t}/acknowledge`,{method:"POST"})}async function H(t){try{return await B(`/api/alerts/${t}/details`)}catch{console.warn("API unreachable, falling back to mock data"),M();let e=$[t];if(e)return e;throw Error("Alert not found")}}async function K(t){let{agentId:e,status:s,sort:o,profile:a,limit:n,offset:i}=t||{};try{let t=new URLSearchParams;n&&t.set("limit",String(n)),i&&t.set("offset",String(i)),e&&t.set("agentId",e),s&&t.set("status",s),o&&t.set("sort",o),a&&t.set("profile",a);let r=t.toString(),d=await B(`/api/sessions${r?`?${r}`:""}`);return{sessions:d.sessions,total:d.total}}catch{return console.warn("API unreachable, falling back to mock data"),M(),{sessions:A,total:A.length}}}async function J(t){try{return await B(`/api/sessions/${t}`)}catch{console.warn("API unreachable, falling back to mock data"),M();let e=j[t];if(e)return e;throw Error("Session not found")}}async function G(t){try{let e=t?`?profile=${t}`:"";return(await B(`/api/projects${e}`)).projects}catch{return console.warn("API unreachable, falling back to mock data"),M(),U}}async function q(t){try{return await B(`/api/projects/${t}`)}catch{console.warn("API unreachable, falling back to mock data"),M();let e=S[t];if(e)return e;throw Error("Project not found")}}async function Q(t,e){return await B("/api/projects",{method:"POST",body:JSON.stringify({name:t,description:e})})}async function V(t,e){await B(`/api/sessions/${t}/projects`,{method:"PUT",body:JSON.stringify({projectIds:e})})}async function X(t,e){await B(`/api/sessions/${t}/projects/${e}`,{method:"DELETE"})}let Y=(n=(a=Array.from({length:14},(t,e)=>{let s=new Date("2026-02-24");return s.setDate(s.getDate()+e),s.toISOString().slice(0,10)})).map(t=>({date:t,costUsd:+(5+15*Math.random()).toFixed(2),tokenCount:Math.floor(1e6+4e6*Math.random()),sessionCount:Math.floor(3+10*Math.random())})),{buckets:n,byAgent:["ofek","anas","dor"].map(t=>({agentId:t,buckets:a.map(t=>({date:t,costUsd:+(1+6*Math.random()).toFixed(2),tokenCount:Math.floor(3e5+15e5*Math.random()),sessionCount:Math.floor(1+4*Math.random())}))})),byProject:[{projectId:"proj-1",name:"ClaWatch"},{projectId:"proj-2",name:"Auth Service"},{projectId:"proj-3",name:"Mobile App"}].map(({projectId:t,name:e})=>({projectId:t,name:e,buckets:a.map(t=>({date:t,costUsd:+(1+5*Math.random()).toFixed(2),tokenCount:Math.floor(2e5+12e5*Math.random()),sessionCount:Math.floor(1+3*Math.random())}))}))});async function Z(t){try{let e=new URLSearchParams;t.profile&&e.set("profile",t.profile),t.groupBy&&e.set("groupBy",t.groupBy),t.from&&e.set("from",t.from),t.to&&e.set("to",t.to);let s=e.toString();return await B(`/api/analytics${s?`?${s}`:""}`)}catch{return console.warn("API unreachable, falling back to mock analytics data"),Y}}let tt={today:94.72,mtd:236.83,byAgent:{anas:{today:36.21,mtd:69.12},ofek:{today:42.83,mtd:112.18},dor:{today:15.68,mtd:55.53}},limits:{type:null,amount:null,agentLimits:{}},usagePercent:null};async function te(t){try{let e=t?`?profile=${t}`:"";return await B(`/api/spend${e}`)}catch{return console.warn("API unreachable, falling back to mock spend data"),tt}}async function ts(t){return await B("/api/settings/cost-limits",{method:"PUT",body:JSON.stringify(t)})}t.s(["acknowledgeAlert",()=>W,"acknowledgeAllAlerts",()=>O,"createProject",()=>Q,"getAgents",()=>D,"getAlertDetails",()=>H,"getAlerts",()=>E,"getAnalytics",()=>Z,"getCosts",()=>R,"getProfiles",()=>F,"getProject",()=>q,"getProjects",()=>G,"getSession",()=>J,"getSessions",()=>K,"getSpend",()=>te,"getVersion",()=>L,"isUsingMockData",()=>N,"pauseAgent",()=>_,"removeSessionProject",()=>X,"resumeAgent",()=>z,"setCostLimits",()=>ts,"setSessionProjects",()=>V],9165)}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33525,(t,e,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"warnOnce",{enumerable:!0,get:function(){return o}});let o=t=>{}},18566,(t,e,s)=>{e.exports=t.r(76562)},15288,87486,9165,t=>{"use strict";let e,s,o,a,n;var i,r=t.i(43476),d=t.i(75157);function l({className:t,size:e="default",...s}){return(0,r.jsx)("div",{"data-slot":"card","data-size":e,className:(0,d.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",t),...s})}function c({className:t,...e}){return(0,r.jsx)("div",{"data-slot":"card-header",className:(0,d.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",t),...e})}function u({className:t,...e}){return(0,r.jsx)("div",{"data-slot":"card-title",className:(0,d.cn)("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function m({className:t,...e}){return(0,r.jsx)("div",{"data-slot":"card-content",className:(0,d.cn)("px-4 group-data-[size=sm]/card:px-3",t),...e})}t.s(["Card",()=>l,"CardContent",()=>m,"CardHeader",()=>c,"CardTitle",()=>u],15288);var p=t.i(19805),g=t.i(27601);let h=(0,t.i(25913).cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function f({className:t,variant:e="default",render:s,...o}){var a;return a={defaultTagName:"span",props:(0,p.mergeProps)({className:(0,d.cn)(h({variant:e}),t)},o),render:s,state:{slot:"badge",variant:e}},(0,g.useRenderElement)(a.defaultTagName??"div",a,a)}t.s(["Badge",()=>f],87486);var b=t.i(47167);let k=new Date,w=t=>new Date(k.getTime()-6e4*t).toISOString(),y=t=>new Date(k.getTime()-36e5*t).toISOString(),C=[{id:"agent-1",name:"code-reviewer",host:"prod-us-east-1",status:"running",lastHeartbeat:w(.5),costUsd:4.82,tokenCount:124e4,errorCount:0},{id:"agent-2",name:"deploy-bot",host:"prod-us-east-1",status:"running",lastHeartbeat:w(1),costUsd:2.15,tokenCount:52e4,errorCount:1},{id:"agent-3",name:"data-pipeline",host:"prod-eu-west-1",status:"error",lastHeartbeat:w(12),costUsd:8.43,tokenCount:21e5,errorCount:7},{id:"agent-4",name:"customer-support",host:"prod-us-west-2",status:"stuck",lastHeartbeat:w(45),costUsd:12.67,tokenCount:34e5,errorCount:3},{id:"agent-5",name:"test-runner",host:"staging-1",status:"paused",lastHeartbeat:y(2),costUsd:1.03,tokenCount:28e4,errorCount:0},{id:"agent-6",name:"doc-generator",host:"prod-us-east-1",status:"running",lastHeartbeat:w(.2),costUsd:3.21,tokenCount:89e4,errorCount:0},{id:"agent-7",name:"security-scanner",host:"prod-eu-west-1",status:"stopped",lastHeartbeat:y(6),costUsd:.45,tokenCount:12e4,errorCount:0},{id:"agent-8",name:"slack-responder",host:"prod-us-west-2",status:"running",lastHeartbeat:w(.1),costUsd:6.89,tokenCount:178e4,errorCount:2}],v=[{id:"alert-1",agentId:"agent-4",type:"stuck",severity:"critical",message:"customer-support has not sent a heartbeat in 45 minutes",timestamp:w(44),acknowledged:!1},{id:"alert-2",agentId:"agent-3",type:"error",severity:"critical",message:"data-pipeline encountered 7 errors in the last hour",timestamp:w(10),acknowledged:!1},{id:"alert-3",agentId:"agent-4",type:"cost_spike",severity:"warning",message:"customer-support cost increased 340% in the last hour",timestamp:y(1),acknowledged:!1},{id:"alert-4",agentId:"agent-8",type:"loop_detected",severity:"warning",message:"slack-responder may be in a retry loop (similar outputs detected)",timestamp:w(30),acknowledged:!0},{id:"alert-5",agentId:"agent-2",type:"error",severity:"info",message:"deploy-bot encountered a transient API error (auto-recovered)",timestamp:y(3),acknowledged:!0}],I={totalUsd:39.65,totalTokens:45e5,sessionCount:12,byAgent:C.map(t=>({agentId:t.id,name:t.name,costUsd:t.costUsd,tokenCount:t.tokenCount})),byModel:[{model:"claude-sonnet-4-20250514",costUsd:22.1},{model:"claude-haiku-4-20250506",costUsd:11.35},{model:"gpt-4o",costUsd:6.2}],byProject:[{projectId:"proj-1",name:"ClaWatch",costUsd:18.5,tokenCount:21e5,sessionCount:5},{projectId:"proj-2",name:"Auth Service",costUsd:12.35,tokenCount:14e5,sessionCount:4},{projectId:"proj-3",name:"Mobile App",costUsd:8.8,tokenCount:1e6,sessionCount:3}],daily:Array.from({length:7},(t,e)=>{let s=new Date("2026-03-04");return s.setDate(s.getDate()+e),{date:s.toISOString().slice(0,10),costUsd:+(3+8*Math.random()).toFixed(2),tokenCount:Math.floor(4e5+8e5*Math.random()),sessionCount:Math.floor(1+4*Math.random())}})},A=[{id:"session-1",agentId:"ofek",title:"Build ClaWatch dashboard with real-time alerts",status:"active",costUsd:3.47,tokenCount:892e3,messageCount:47,model:"claude-sonnet-4-20250514",startedAt:w(45),lastActivityAt:w(1),duration:2640,projects:[{id:"project-1",name:"Building ClaWatch"}]},{id:"session-2",agentId:"anas",title:"Fix authentication bug in user login flow",status:"completed",costUsd:1.23,tokenCount:34e4,messageCount:22,model:"claude-sonnet-4-20250514",startedAt:y(3),lastActivityAt:y(2),duration:3600,projects:[{id:"project-2",name:"Bug Fixes Sprint"}]},{id:"session-3",agentId:"dor",title:"Review PR #47 — add retry logic to API calls",status:"idle",costUsd:.87,tokenCount:215e3,messageCount:14,model:"claude-haiku-4-20250506",startedAt:w(90),lastActivityAt:w(12),duration:4680},{id:"session-4",agentId:"ofek",title:"Implement WebSocket event streaming for agent heartbeats",status:"active",costUsd:5.12,tokenCount:134e4,messageCount:63,model:"claude-sonnet-4-20250514",startedAt:y(1.5),lastActivityAt:w(.5),duration:5400,projects:[{id:"project-1",name:"Building ClaWatch"},{id:"project-2",name:"Bug Fixes Sprint"}]},{id:"session-5",agentId:"anas",title:"Refactor database schema for multi-tenant support",status:"completed",costUsd:2.89,tokenCount:78e4,messageCount:38,model:"claude-sonnet-4-20250514",startedAt:y(5),lastActivityAt:y(4),duration:3600},{id:"session-6",agentId:"dor",title:"Debug failing CI pipeline — Jest timeout errors",status:"idle",costUsd:.54,tokenCount:145e3,messageCount:11,model:"claude-haiku-4-20250506",startedAt:w(30),lastActivityAt:w(8),duration:1320},{id:"session-7",agentId:"ofek",title:"Add Telegram bot notification integration",status:"completed",costUsd:1.76,tokenCount:46e4,messageCount:29,model:"claude-sonnet-4-20250514",startedAt:y(8),lastActivityAt:y(7),duration:3600},{id:"session-8",agentId:"anas",title:"Write unit tests for cost calculation module",status:"active",costUsd:.92,tokenCount:248e3,messageCount:18,model:"claude-haiku-4-20250506",startedAt:w(15),lastActivityAt:w(2),duration:780},{id:"session-9",agentId:"dor",title:"Optimize SQL queries — reduce p95 latency from 800ms to 200ms",status:"completed",costUsd:4.31,tokenCount:112e4,messageCount:52,model:"claude-sonnet-4-20250514",startedAt:y(12),lastActivityAt:y(10),duration:7200},{id:"session-10",agentId:"ofek",title:"Set up Docker Compose for local development environment",status:"idle",costUsd:.63,tokenCount:172e3,messageCount:9,model:"claude-haiku-4-20250506",startedAt:w(60),lastActivityAt:w(20),duration:2400}],U=[{id:"project-1",name:"Building ClaWatch",description:"Full-stack AI observability platform with real-time monitoring, session tracking, and cost analytics",createdAt:y(48),updatedAt:w(5),sessionCount:3,totalCostUsd:185.98},{id:"project-2",name:"Bug Fixes Sprint",description:"Critical bug fixes for authentication, database schema, and CI pipeline issues",createdAt:y(24),updatedAt:w(30),sessionCount:2,totalCostUsd:12.5}],x=(e=[],s=0,(o=(t,o,a,n,i,r)=>{s++,e.push({sessionId:t,agentId:o,id:`tl-${s}`,role:a,timestamp:w(n),content:i,...r})})("session-1","ofek","user",120,"Build the ClaWatch dashboard with real-time alerts and agent monitoring. Use Next.js 15 + shadcn/ui."),o("session-1","ofek","assistant",119,"I'll build the ClaWatch dashboard. Let me start by setting up the project structure and examining existing code.",{model:"claude-sonnet-4-20250514",costUsd:.04}),o("session-3","dor","user",118,"Review the initial project setup and suggest architectural improvements for the monitoring system."),o("session-1","ofek","tool",117,"src/\n app/\n dashboard/\n page.tsx\n layout.tsx\n components/\n ui/\n lib/\n types.ts\n api.ts",{toolName:"read"}),o("session-3","dor","assistant",116,"Looking at the project structure. I'll review the architecture and suggest improvements for scalability.",{model:"claude-haiku-4-20250506",costUsd:.01}),o("session-1","ofek","assistant",115,"Project structure looks good. I'll create the type definitions for agents, sessions, alerts, and cost data.",{model:"claude-sonnet-4-20250514",costUsd:.06}),o("session-8","anas","user",114,"Write comprehensive unit tests for the cost calculation module including edge cases."),o("session-1","ofek","tool",113,"File written: src/lib/types.ts (78 lines)",{toolName:"write"}),o("session-8","anas","assistant",112,"I'll write thorough unit tests for cost calculations. Let me first examine the module.",{model:"claude-haiku-4-20250506",costUsd:.02}),o("session-3","dor","tool",111,"export interface Agent {\n id: string;\n name: string;\n status: AgentStatus;\n ...",{toolName:"read"}),o("session-3","dor","assistant",110,"The type definitions look solid. I'd suggest adding a `duration` field to Session for better analytics. Also, the cost tracking should support per-model breakdown.",{model:"claude-haiku-4-20250506",costUsd:.02}),o("session-1","ofek","assistant",108,"Good point from the review. I'll add duration tracking and per-model cost breakdown. Now creating the mock data layer.",{model:"claude-sonnet-4-20250514",costUsd:.05}),o("session-8","anas","tool",107,"export function calculateCost(tokens: number, model: string): number { ... }",{toolName:"read"}),o("session-1","ofek","tool",105,"File written: src/lib/mock-data.ts (280 lines)",{toolName:"write"}),o("session-8","anas","assistant",104,"Found the cost module. I'll test standard pricing, cache discount calculations, multi-model sessions, and zero-token edge cases.",{model:"claude-haiku-4-20250506",costUsd:.03}),o("session-1","ofek","system",103,"Context window: 45% utilized (90K/200K tokens)"),o("session-8","anas","tool",102,"File written: src/__tests__/cost-calculation.test.ts (156 lines)",{toolName:"write"}),o("session-1","ofek","assistant",100,"Mock data created. Now building the dashboard page with agent cards, alert banners, and cost overview.",{model:"claude-sonnet-4-20250514",costUsd:.12}),o("session-3","dor","user",98,"Can you also review the API layer and check for error handling gaps?"),o("session-1","ofek","tool",95,"File written: src/app/dashboard/page.tsx (320 lines)",{toolName:"write"}),o("session-8","anas","assistant",94,"All 12 test cases pass. Found one edge case where negative token counts could cause issues — adding a guard.",{model:"claude-haiku-4-20250506",costUsd:.02}),o("session-3","dor","assistant",92,"Reviewing API layer. The fetchJson wrapper needs better error handling — currently swallows network errors. I'll suggest adding retry logic and timeout handling.",{model:"claude-haiku-4-20250506",costUsd:.03}),o("session-8","anas","tool",90,"$ npm test -- --watchAll=false\n\nTest Suites: 1 passed, 1 total\nTests: 14 passed, 14 total\nTime: 2.834s",{toolName:"exec"}),o("session-1","ofek","assistant",88,"Dashboard page done. Adding real-time polling with 5-second intervals and the tabbed interface for Agents/Sessions views.",{model:"claude-sonnet-4-20250514",costUsd:.08}),o("session-1","ofek","tool",85,"$ npm run build\n\n ✓ Compiled successfully\n ✓ Generating static pages (5/5)\n\nBuild completed in 8.2s",{toolName:"exec"}),o("session-3","dor","assistant",83,"Here's my review summary:\n1. Add retry logic to fetchJson (3 retries with exponential backoff)\n2. Add request timeout (30s default)\n3. The mock fallback pattern is good but should log errors to a monitoring service\n4. Consider adding request deduplication for concurrent calls",{model:"claude-haiku-4-20250506",costUsd:.04}),o("session-1","ofek","user",80,"Add session detail view with message timeline, cost breakdown by model, and token analysis."),o("session-1","ofek","assistant",78,"I'll build the session detail page with a full message timeline. Each message type will have distinct visual treatment.",{model:"claude-sonnet-4-20250514",costUsd:.09}),o("session-1","ofek","tool",75,"File written: src/app/dashboard/sessions/[id]/page.tsx (340 lines)",{toolName:"write"}),o("session-8","anas","assistant",72,"All tests passing. Adding integration tests for the API mock fallback pattern now.",{model:"claude-haiku-4-20250506",costUsd:.02}),o("session-1","ofek","assistant",70,"Session detail page complete with:\n- Message timeline with user/assistant/tool/system styling\n- Cost breakdown by model with progress bars\n- Token breakdown (input/output/cache read/cache write)\n- Collapsible tool outputs",{model:"claude-sonnet-4-20250514",costUsd:.06}),o("session-1","ofek","system",68,"Context window: 72% utilized (144K/200K tokens)"),o("session-1","ofek","tool",65,"$ npm run build\n\n ✓ Compiled successfully\n ✓ Generating static pages (7/7)\n\nBuild completed in 9.1s",{toolName:"exec"}),o("session-1","ofek","assistant",60,"Build passes. The ClaWatch dashboard is fully functional with real-time monitoring, session tracking, and cost analytics.",{model:"claude-sonnet-4-20250514",costUsd:.04}),e.sort((t,e)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime())),S={"project-1":{id:"project-1",name:"Building ClaWatch",description:"Full-stack AI observability platform with real-time monitoring, session tracking, and cost analytics",stats:{totalCostUsd:185.98,totalTokens:482e4,totalMessages:128,sessionCount:3,dateRange:{from:y(48),to:w(5)}},agentBreakdown:[{agentId:"ofek",costUsd:142.5,tokenCount:32e5,messageCount:78,percentage:76.6},{agentId:"dor",costUsd:28.48,tokenCount:98e4,messageCount:32,percentage:15.3},{agentId:"anas",costUsd:15,tokenCount:64e4,messageCount:18,percentage:8.1}],sessions:[A.find(t=>"session-1"===t.id),A.find(t=>"session-3"===t.id),A.find(t=>"session-8"===t.id)],timeline:x},"project-2":{id:"project-2",name:"Bug Fixes Sprint",description:"Critical bug fixes for authentication, database schema, and CI pipeline issues",stats:{totalCostUsd:12.5,totalTokens:112e4,totalMessages:60,sessionCount:2,dateRange:{from:y(24),to:w(30)}},agentBreakdown:[{agentId:"anas",costUsd:7.8,tokenCount:68e4,messageCount:38,percentage:62.4},{agentId:"dor",costUsd:4.7,tokenCount:44e4,messageCount:22,percentage:37.6}],sessions:[A.find(t=>"session-2"===t.id),A.find(t=>"session-6"===t.id)],timeline:[{sessionId:"session-2",agentId:"anas",id:"tl-b1",role:"user",timestamp:y(3),content:"Fix the authentication bug in the user login flow. Users are getting 401 errors after token refresh."},{sessionId:"session-2",agentId:"anas",id:"tl-b2",role:"assistant",timestamp:y(2.9),content:"I'll investigate the auth flow. Let me check the token refresh logic.",model:"claude-sonnet-4-20250514",costUsd:.03},{sessionId:"session-6",agentId:"dor",id:"tl-b3",role:"user",timestamp:y(2.8),content:"Debug the failing CI pipeline. Jest tests are timing out on the session module."},{sessionId:"session-2",agentId:"anas",id:"tl-b4",role:"tool",timestamp:y(2.7),content:"Found: refreshToken() doesn't await the database write before returning new token",toolName:"read"},{sessionId:"session-6",agentId:"dor",id:"tl-b5",role:"assistant",timestamp:y(2.6),content:"Looking at the CI logs. The Jest timeout suggests an unresolved promise in the test setup.",model:"claude-haiku-4-20250506",costUsd:.01},{sessionId:"session-2",agentId:"anas",id:"tl-b6",role:"assistant",timestamp:y(2.5),content:"Found the bug: `refreshToken()` returns before the DB write completes. Adding await fixes the race condition.",model:"claude-sonnet-4-20250514",costUsd:.05},{sessionId:"session-6",agentId:"dor",id:"tl-b7",role:"tool",timestamp:y(2.4),content:"$ jest --verbose\nFAILED: session.test.ts > should persist session data\nTimeout: 5000ms exceeded",toolName:"exec"},{sessionId:"session-6",agentId:"dor",id:"tl-b8",role:"assistant",timestamp:y(2.2),content:"The test is missing `afterAll` cleanup — the database connection stays open. Adding proper teardown.",model:"claude-haiku-4-20250506",costUsd:.02},{sessionId:"session-2",agentId:"anas",id:"tl-b9",role:"tool",timestamp:y(2.1),content:"$ npm test -- auth.test.ts\n\nTests: 8 passed, 8 total",toolName:"exec"},{sessionId:"session-6",agentId:"dor",id:"tl-b10",role:"tool",timestamp:y(2),content:"$ jest session.test.ts --verbose\nPASSED: all 6 tests",toolName:"exec"},{sessionId:"session-2",agentId:"anas",id:"tl-b11",role:"assistant",timestamp:y(1.9),content:"Auth bug fixed and all tests passing. The root cause was a missing await in the token refresh handler.",model:"claude-sonnet-4-20250514",costUsd:.03},{sessionId:"session-6",agentId:"dor",id:"tl-b12",role:"assistant",timestamp:y(1.8),content:"CI pipeline fixed. Added proper test teardown and increased timeout for integration tests to 10s.",model:"claude-haiku-4-20250506",costUsd:.02}]}},j={};for(let t of A)j[t.id]={...t,costByModel:t.model.includes("sonnet")?[{model:"claude-sonnet-4-20250514",costUsd:.82*t.costUsd,tokenCount:Math.floor(.75*t.tokenCount)},{model:"claude-haiku-4-20250506",costUsd:.18*t.costUsd,tokenCount:Math.floor(.25*t.tokenCount)}]:[{model:"claude-haiku-4-20250506",costUsd:.65*t.costUsd,tokenCount:Math.floor(.6*t.tokenCount)},{model:"claude-sonnet-4-20250514",costUsd:.35*t.costUsd,tokenCount:Math.floor(.4*t.tokenCount)}],tokenBreakdown:{input:Math.floor(.35*t.tokenCount),output:Math.floor(.3*t.tokenCount),cacheRead:Math.floor(.25*t.tokenCount),cacheWrite:Math.floor(.1*t.tokenCount)},messages:(i=t.id,[{id:`${i}-msg-1`,role:"user",timestamp:w(44),content:"Build the ClaWatch dashboard with real-time alert monitoring. Use Next.js 15 with shadcn/ui components."},{id:`${i}-msg-2`,role:"assistant",timestamp:w(43),content:"I'll build the ClaWatch dashboard. Let me start by examining the project structure and existing code.",model:"claude-sonnet-4-20250514",costUsd:.03,tokenCount:12400},{id:`${i}-msg-3`,role:"tool",timestamp:w(43),content:"src/\n app/\n dashboard/\n page.tsx\n layout.tsx\n page.tsx\n components/\n ui/\n lib/\n types.ts\n api.ts\n mock-data.ts",toolName:"read",toolInput:'{"path": "src/"}'},{id:`${i}-msg-4`,role:"assistant",timestamp:w(42),content:"I can see the project structure. Let me read the existing types and API files to understand the data model.",model:"claude-sonnet-4-20250514",costUsd:.02,tokenCount:8200},{id:`${i}-msg-5`,role:"tool",timestamp:w(42),content:'export type AgentStatus = "running" | "paused" | "stopped" | "error" | "stuck";\n\nexport interface Agent {\n id: string;\n name: string;\n ...',toolName:"read",toolInput:'{"path": "src/lib/types.ts"}'},{id:`${i}-msg-6`,role:"assistant",timestamp:w(40),content:"Now I'll create the dashboard page with agent cards, alert banners, and cost overview panels. I'll use the existing shadcn/ui components.",model:"claude-sonnet-4-20250514",costUsd:.08,tokenCount:34600},{id:`${i}-msg-7`,role:"tool",timestamp:w(39),content:"File written: src/app/dashboard/page.tsx (358 lines)",toolName:"write",toolInput:'{"path": "src/app/dashboard/page.tsx", "content": "..."}'},{id:`${i}-msg-8`,role:"tool",timestamp:w(38),content:"$ npm run build\n\n ✓ Compiled successfully\n ✓ Collecting page data\n ✓ Generating static pages (5/5)\n ✓ Collecting build traces\n\nRoute (app) Size First Load JS\n├ ○ / 5.2 kB 92.1 kB\n└ ○ /dashboard 12.4 kB 99.3 kB",toolName:"exec",toolInput:'{"command": "npm run build"}'},{id:`${i}-msg-9`,role:"assistant",timestamp:w(37),content:"The build succeeded. Let me now add the real-time polling mechanism and alert notification sounds.",model:"claude-sonnet-4-20250514",costUsd:.04,tokenCount:15800},{id:`${i}-msg-10`,role:"tool",timestamp:w(36),content:"Lines 49-64 edited in src/app/dashboard/page.tsx",toolName:"edit",toolInput:'{"path": "src/app/dashboard/page.tsx", "old_string": "...", "new_string": "..."}'},{id:`${i}-msg-11`,role:"user",timestamp:w(35),content:"Can you also add a cost breakdown by model? Show it as horizontal progress bars."},{id:`${i}-msg-12`,role:"assistant",timestamp:w(34),content:"Sure! I'll add a cost breakdown section with progress bars for each model. Let me update the dashboard.",model:"claude-sonnet-4-20250514",costUsd:.06,tokenCount:24200},{id:`${i}-msg-13`,role:"tool",timestamp:w(33),content:"Lines 254-305 edited in src/app/dashboard/page.tsx",toolName:"edit",toolInput:'{"path": "src/app/dashboard/page.tsx", "old_string": "...", "new_string": "..."}'},{id:`${i}-msg-14`,role:"system",timestamp:w(32),content:"Context window: 78% utilized (156K/200K tokens)"},{id:`${i}-msg-15`,role:"assistant",timestamp:w(31),content:"I've added the cost breakdown panels. The dashboard now shows:\n\n1. **Agent cards** with status, cost, tokens, errors, and heartbeat\n2. **Alert banner** for critical/warning alerts\n3. **Cost by Agent** — horizontal progress bars\n4. **Cost by Model** — horizontal progress bars\n\nThe data refreshes every 5 seconds via polling.",model:"claude-sonnet-4-20250514",costUsd:.05,tokenCount:18900},{id:`${i}-msg-16`,role:"tool",timestamp:w(30),content:'{"results": [{"title": "shadcn/ui Tabs Component", "url": "https://ui.shadcn.com/docs/components/tabs"}]}',toolName:"web_search",toolInput:'{"query": "shadcn ui tabs component usage"}'},{id:`${i}-msg-17`,role:"assistant",timestamp:w(28),content:"Let me add a tabbed interface for Agents and Sessions views. I'll implement the tabs using a simple state-based approach.",model:"claude-sonnet-4-20250514",costUsd:.11,tokenCount:45200},{id:`${i}-msg-18`,role:"tool",timestamp:w(27),content:"$ npm run build\n\n ✓ Compiled successfully\n ✓ Linting and checking validity of types\n ✓ Generating static pages (5/5)\n\nBuild completed in 8.2s",toolName:"exec",toolInput:'{"command": "npm run build"}'},{id:`${i}-msg-19`,role:"assistant",timestamp:w(25),content:"Build passes. The dashboard now has Agents and Sessions tabs with full filtering and sorting. All existing functionality is preserved.",model:"claude-sonnet-4-20250514",costUsd:.03,tokenCount:11600},{id:`${i}-msg-20`,role:"tool",timestamp:w(24),content:"$ npm test -- --watchAll=false\n\nTest Suites: 3 passed, 3 total\nTests: 12 passed, 12 total\nTime: 4.231s",toolName:"exec",toolInput:'{"command": "npm test -- --watchAll=false"}'}])};let $={"alert-1":{alert:v[0],agent:{id:"agent-4",name:"customer-support",status:"stuck"},relatedErrors:[],context:{lastHeartbeat:w(45),stuckDurationMinutes:45,agentStatus:"stuck"}},"alert-2":{alert:v[1],agent:{id:"agent-3",name:"data-pipeline",status:"error"},relatedErrors:[{timestamp:w(12),error:"TypeError: Cannot read properties of undefined (reading 'map')"},{timestamp:w(11),error:"ECONNREFUSED: Connection refused to database at 127.0.0.1:5432"},{timestamp:w(11),error:"ECONNREFUSED: Connection refused to database at 127.0.0.1:5432"},{timestamp:w(10),error:"Unhandled promise rejection: Query timeout after 30000ms"},{timestamp:w(10),error:'FATAL: too many connections for role "app_user"'}]},"alert-3":{alert:v[2],agent:{id:"agent-4",name:"customer-support",status:"running"},relatedErrors:[],context:{currentCostUsd:12.67,thresholdUsd:10,overage:2.67}},"alert-4":{alert:v[3],agent:{id:"agent-8",name:"slack-responder",status:"running"},relatedErrors:[{timestamp:w(32),error:"Detected 5 consecutive similar outputs — possible retry loop"},{timestamp:w(31),error:"Output similarity score: 0.94 (threshold: 0.85)"}]},"alert-5":{alert:v[4],agent:{id:"agent-2",name:"deploy-bot",status:"running"},relatedErrors:[{timestamp:y(3),error:"API returned 503 Service Unavailable — auto-retried successfully"}]}},P=b.default.env.NEXT_PUBLIC_API_URL||"",T=b.default.env.NEXT_PUBLIC_API_KEY||"",N=!1;function M(){return N}function B(){N=!0}async function L(t,e){let s={"Content-Type":"application/json","ngrok-skip-browser-warning":"true",...T?{"X-ClaWatch-Key":T}:{},...e?.headers||{}},o=await fetch(`${P}${t}`,{...e,headers:s});if(!o.ok)throw Error(`API error: ${o.status}`);return o.json()}async function F(){try{return(await L("/api/profiles")).profiles}catch{return console.warn("API unreachable, skipping profiles"),[]}}async function E(){try{return(await L("/api/version")).version}catch{return console.warn("API unreachable, skipping version"),null}}async function D(t,e){try{let s=new URLSearchParams;t&&s.set("status",t),e&&s.set("profile",e);let o=s.toString();return(await L(`/api/agents${o?`?${o}`:""}`)).agents}catch{return console.warn("API unreachable, falling back to mock data"),B(),C}}async function _(t){try{let e=new URLSearchParams;t?.limit!==void 0&&e.set("limit",String(t.limit)),t?.offset!==void 0&&e.set("offset",String(t.offset)),t?.severity&&e.set("severity",t.severity),t?.acknowledged!==void 0&&e.set("acknowledged",String(t.acknowledged)),t?.profile&&e.set("profile",t.profile);let s=e.toString();return await L(`/api/alerts${s?`?${s}`:""}`)}catch{return console.warn("API unreachable, falling back to mock data"),B(),{alerts:v,total:v.length}}}async function O(t){return await L(`/api/alerts/acknowledge-all${t?`?severity=${t}`:""}`,{method:"POST"})}async function R(t){try{let e=new URLSearchParams;t?.profile&&e.set("profile",t.profile),t?.from&&e.set("from",t.from),t?.to&&e.set("to",t.to);let s=e.toString();return await L(`/api/costs${s?`?${s}`:""}`)}catch{return console.warn("API unreachable, falling back to mock data"),B(),I}}async function z(t){await L(`/api/agents/${t}/pause`,{method:"POST"})}async function W(t){await L(`/api/agents/${t}/resume`,{method:"POST"})}async function H(t){await L(`/api/alerts/${t}/acknowledge`,{method:"POST"})}async function K(t){try{return await L(`/api/alerts/${t}/details`)}catch{console.warn("API unreachable, falling back to mock data"),B();let e=$[t];if(e)return e;throw Error("Alert not found")}}async function J(t){let{agentId:e,status:s,sort:o,profile:a,limit:n,offset:i}=t||{};try{let t=new URLSearchParams;n&&t.set("limit",String(n)),i&&t.set("offset",String(i)),e&&t.set("agentId",e),s&&t.set("status",s),o&&t.set("sort",o),a&&t.set("profile",a);let r=t.toString(),d=await L(`/api/sessions${r?`?${r}`:""}`);return{sessions:d.sessions,total:d.total}}catch{return console.warn("API unreachable, falling back to mock data"),B(),{sessions:A,total:A.length}}}async function G(t){try{return await L(`/api/sessions/${t}`)}catch{console.warn("API unreachable, falling back to mock data"),B();let e=j[t];if(e)return e;throw Error("Session not found")}}async function q(t){try{let e=t?`?profile=${t}`:"";return(await L(`/api/projects${e}`)).projects}catch{return console.warn("API unreachable, falling back to mock data"),B(),U}}async function X(t){try{return await L(`/api/projects/${t}`)}catch{console.warn("API unreachable, falling back to mock data"),B();let e=S[t];if(e)return e;throw Error("Project not found")}}async function Q(t,e){return await L("/api/projects",{method:"POST",body:JSON.stringify({name:t,description:e})})}async function V(t,e){await L(`/api/sessions/${t}/projects`,{method:"PUT",body:JSON.stringify({projectIds:e})})}async function Y(t,e){await L(`/api/sessions/${t}/projects/${e}`,{method:"DELETE"})}let Z=(n=(a=Array.from({length:14},(t,e)=>{let s=new Date("2026-02-24");return s.setDate(s.getDate()+e),s.toISOString().slice(0,10)})).map(t=>({date:t,costUsd:+(5+15*Math.random()).toFixed(2),tokenCount:Math.floor(1e6+4e6*Math.random()),sessionCount:Math.floor(3+10*Math.random())})),{buckets:n,byAgent:["ofek","anas","dor"].map(t=>({agentId:t,buckets:a.map(t=>({date:t,costUsd:+(1+6*Math.random()).toFixed(2),tokenCount:Math.floor(3e5+15e5*Math.random()),sessionCount:Math.floor(1+4*Math.random())}))})),byProject:[{projectId:"proj-1",name:"ClaWatch"},{projectId:"proj-2",name:"Auth Service"},{projectId:"proj-3",name:"Mobile App"}].map(({projectId:t,name:e})=>({projectId:t,name:e,buckets:a.map(t=>({date:t,costUsd:+(1+5*Math.random()).toFixed(2),tokenCount:Math.floor(2e5+12e5*Math.random()),sessionCount:Math.floor(1+3*Math.random())}))}))});async function tt(t){try{let e=new URLSearchParams;t.profile&&e.set("profile",t.profile),t.groupBy&&e.set("groupBy",t.groupBy),t.from&&e.set("from",t.from),t.to&&e.set("to",t.to);let s=e.toString();return await L(`/api/analytics${s?`?${s}`:""}`)}catch{return console.warn("API unreachable, falling back to mock analytics data"),Z}}let te={today:94.72,mtd:236.83,byAgent:{anas:{today:36.21,mtd:69.12},ofek:{today:42.83,mtd:112.18},dor:{today:15.68,mtd:55.53}},limits:{type:null,amount:null,agentLimits:{}},usagePercent:null};async function ts(t){try{let e=t?`?profile=${t}`:"";return await L(`/api/spend${e}`)}catch{return console.warn("API unreachable, falling back to mock spend data"),te}}async function to(t){return await L("/api/settings/cost-limits",{method:"PUT",body:JSON.stringify(t)})}t.s(["acknowledgeAlert",()=>H,"acknowledgeAllAlerts",()=>O,"createProject",()=>Q,"getAgents",()=>D,"getAlertDetails",()=>K,"getAlerts",()=>_,"getAnalytics",()=>tt,"getCosts",()=>R,"getProfiles",()=>F,"getProject",()=>X,"getProjects",()=>q,"getSession",()=>G,"getSessions",()=>J,"getSpend",()=>ts,"getVersion",()=>E,"isUsingMockData",()=>M,"pauseAgent",()=>z,"removeSessionProject",()=>Y,"resumeAgent",()=>W,"setCostLimits",()=>to,"setSessionProjects",()=>V],9165)}]);
|
package/frontend/server.js
CHANGED
|
@@ -9,7 +9,7 @@ const currentPort = parseInt(process.env.PORT, 10) || 3000
|
|
|
9
9
|
const hostname = process.env.HOSTNAME || '0.0.0.0'
|
|
10
10
|
|
|
11
11
|
let keepAliveTimeout = parseInt(process.env.KEEP_ALIVE_TIMEOUT, 10)
|
|
12
|
-
const nextConfig = {"env":{},"webpack":null,"typescript":{"ignoreBuildErrors":false},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.ts","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":false},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":"/
|
|
12
|
+
const nextConfig = {"env":{},"webpack":null,"typescript":{"ignoreBuildErrors":false},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.ts","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":false},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":"/home/runner/work/clawatch/clawatch/frontend","cacheComponents":false,"cacheLife":{"default":{"stale":300,"revalidate":900,"expire":4294967294},"seconds":{"stale":30,"revalidate":1,"expire":60},"minutes":{"stale":300,"revalidate":60,"expire":3600},"hours":{"stale":300,"revalidate":3600,"expire":86400},"days":{"stale":300,"revalidate":86400,"expire":604800},"weeks":{"stale":300,"revalidate":604800,"expire":2592000},"max":{"stale":300,"revalidate":2592000,"expire":31536000}},"cacheHandlers":{},"experimental":{"useSkewCookie":false,"cssChunking":true,"multiZoneDraftMode":false,"appNavFailHandling":false,"prerenderEarlyExit":true,"serverMinification":true,"linkNoTouchStart":false,"caseSensitiveRoutes":false,"dynamicOnHover":false,"preloadEntriesOnStart":true,"clientRouterFilter":true,"clientRouterFilterRedirects":false,"fetchCacheKeyPrefix":"","proxyPrefetch":"flexible","optimisticClientCache":true,"manualClientBasePath":false,"cpus":1,"memoryBasedWorkersCount":false,"imgOptConcurrency":null,"imgOptTimeoutInSeconds":7,"imgOptMaxInputPixels":268402689,"imgOptSequentialRead":null,"imgOptSkipMetadata":null,"isrFlushToDisk":true,"workerThreads":false,"optimizeCss":false,"nextScriptWorkers":false,"scrollRestoration":false,"externalDir":false,"disableOptimizedLoading":false,"gzipSize":true,"craCompat":false,"esmExternals":true,"fullySpecified":false,"swcTraceProfiling":false,"forceSwcTransforms":false,"largePageDataBytes":128000,"typedEnv":false,"parallelServerCompiles":false,"parallelServerBuildTraces":false,"ppr":false,"authInterrupts":false,"webpackMemoryOptimizations":false,"optimizeServerReact":true,"viewTransition":false,"removeUncaughtErrorAndRejectionListeners":false,"validateRSCRequestHeaders":false,"staleTimes":{"dynamic":0,"static":300},"reactDebugChannel":false,"serverComponentsHmrCache":true,"staticGenerationMaxConcurrency":8,"staticGenerationMinPagesPerWorker":25,"transitionIndicator":false,"inlineCss":false,"useCache":false,"globalNotFound":false,"browserDebugInfoInTerminal":false,"lockDistDir":true,"isolatedDevBuild":true,"proxyClientMaxBodySize":10485760,"hideLogsAfterAbort":false,"mcpServer":true,"turbopackFileSystemCacheForDev":true,"turbopackFileSystemCacheForBuild":false,"turbopackInferModuleSideEffects":false,"optimizePackageImports":["lucide-react","date-fns","lodash-es","ramda","antd","react-bootstrap","ahooks","@ant-design/icons","@headlessui/react","@headlessui-float/react","@heroicons/react/20/solid","@heroicons/react/24/solid","@heroicons/react/24/outline","@visx/visx","@tremor/react","rxjs","@mui/material","@mui/icons-material","recharts","react-use","effect","@effect/schema","@effect/platform","@effect/platform-node","@effect/platform-browser","@effect/platform-bun","@effect/sql","@effect/sql-mssql","@effect/sql-mysql2","@effect/sql-pg","@effect/sql-sqlite-node","@effect/sql-sqlite-bun","@effect/sql-sqlite-wasm","@effect/sql-sqlite-react-native","@effect/rpc","@effect/rpc-http","@effect/typeclass","@effect/experimental","@effect/opentelemetry","@material-ui/core","@material-ui/icons","@tabler/icons-react","mui-core","react-icons/ai","react-icons/bi","react-icons/bs","react-icons/cg","react-icons/ci","react-icons/di","react-icons/fa","react-icons/fa6","react-icons/fc","react-icons/fi","react-icons/gi","react-icons/go","react-icons/gr","react-icons/hi","react-icons/hi2","react-icons/im","react-icons/io","react-icons/io5","react-icons/lia","react-icons/lib","react-icons/lu","react-icons/md","react-icons/pi","react-icons/ri","react-icons/rx","react-icons/si","react-icons/sl","react-icons/tb","react-icons/tfi","react-icons/ti","react-icons/vsc","react-icons/wi"],"trustHostHeader":false,"isExperimentalCompile":false},"htmlLimitedBots":"[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight","bundlePagesRouterDependencies":false,"configFileName":"next.config.ts","turbopack":{"root":"/home/runner/work/clawatch/clawatch/frontend"},"distDirRoot":".next","_originalRewrites":{"beforeFiles":[],"afterFiles":[{"source":"/api/:path*","destination":"http://localhost:3001/api/:path*"},{"source":"/health","destination":"http://localhost:3001/health"}],"fallback":[]}}
|
|
13
13
|
|
|
14
14
|
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(nextConfig)
|
|
15
15
|
|
package/package.json
CHANGED
package/frontend/.env
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
NEXT_PUBLIC_USE_MOCK=false
|
/package/frontend/.next/static/{0wK6XKeZM4pETq1rAH0LM → 9TLyPFNXZUL_yHMhwT7iY}/_buildManifest.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/frontend/.next/static/{0wK6XKeZM4pETq1rAH0LM → 9TLyPFNXZUL_yHMhwT7iY}/_ssgManifest.js
RENAMED
|
File without changes
|